Browse Source

Updated options

zhixin 6 years ago
parent
commit
2f1b214c71
4 changed files with 20 additions and 11 deletions
  1. 2 2
      site/docs/api/table-options.md
  2. 0 1
      src/bootstrap-table.js
  3. 18 5
      tools/check-api.js
  4. 0 3
      tools/check-locale.js

+ 2 - 2
site/docs/api/table-options.md

@@ -807,7 +807,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Default:** `false`
 - **Default:** `false`
 
 
-- **Example:** [ShowSearchButton](https://examples.bootstrap-table.com/#options/show-search-button.html)
+- **Example:** [Show Search Button](https://examples.bootstrap-table.com/#options/show-search-button.html)
 
 
 ## showSearchClearButton
 ## showSearchClearButton
 
 
@@ -821,7 +821,7 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 
 - **Default:** `false`
 - **Default:** `false`
 
 
-- **Example:** [ShowSearchClearButton](https://examples.bootstrap-table.com/#options/show-search-clear-button.html)
+- **Example:** [Show Search Clear Button](https://examples.bootstrap-table.com/#options/show-search-clear-button.html)
 
 
 ## trimOnSearch
 ## trimOnSearch
 
 

+ 0 - 1
src/bootstrap-table.js

@@ -598,7 +598,6 @@ class BootstrapTable {
     if (o.search) {
     if (o.search) {
       html = []
       html = []
 
 
-
       html.push(Utils.sprintf(`
       html.push(Utils.sprintf(`
         <div class="${this.constants.classes.pull}-${o.searchAlign} search ${this.constants.classes.inputGroup}">
         <div class="${this.constants.classes.pull}-${o.searchAlign} search ${this.constants.classes.inputGroup}">
             %s
             %s

+ 18 - 5
tools/check-api.js

@@ -3,6 +3,7 @@ require = require('esm')(module)
 const fs = require('fs')
 const fs = require('fs')
 const chalk = require('chalk')
 const chalk = require('chalk')
 const Constants = require('../src/constants/index.js').default
 const Constants = require('../src/constants/index.js').default
+let errorSum = 0
 
 
 class API {
 class API {
   constructor () {
   constructor () {
@@ -16,10 +17,7 @@ class API {
     const content = fs.readFileSync(file).toString()
     const content = fs.readFileSync(file).toString()
     const lines = content.split('## ')
     const lines = content.split('## ')
     const outLines = lines.slice(0, 1)
     const outLines = lines.slice(0, 1)
-
-    console.log('-------------------------')
-    console.log(`Checking file: ${file}`)
-    console.log('-------------------------')
+    const errors = []
 
 
     for (const item of lines.slice(1)) {
     for (const item of lines.slice(1)) {
       md[item.split('\n')[0]] = item
       md[item.split('\n')[0]] = item
@@ -37,7 +35,7 @@ class API {
             continue
             continue
           }
           }
           if (!details[i + 1] || details[i + 1].indexOf(`**${name}:**`) === -1) {
           if (!details[i + 1] || details[i + 1].indexOf(`**${name}:**`) === -1) {
-            console.log(chalk.red(`[${key}] missing '${name}'`))
+            errors.push(chalk.red(`[${key}] missing '${name}'`))
           }
           }
         }
         }
       } else {
       } else {
@@ -45,6 +43,17 @@ class API {
       }
       }
     }
     }
 
 
+    errorSum += errors.length
+    if (errors.length > 0) {
+      console.log('-------------------------')
+      console.log(`Checking file: ${file}`)
+      console.log('-------------------------')
+
+      errors.forEach((error) => {
+        console.log(error)
+      })
+    }
+
     fs.writeFile(file, outLines.join('## '), () => {})
     fs.writeFile(file, outLines.join('## '), () => {})
   }
   }
 }
 }
@@ -104,3 +113,7 @@ new ColumnOptions()
 new Methods()
 new Methods()
 new Events()
 new Events()
 new Localizations()
 new Localizations()
+
+if (errorSum === 0) {
+  console.log('Good job! Anything up to date!')
+}

+ 0 - 3
tools/check-locale.js

@@ -33,8 +33,6 @@ fs.readdir(`${DIR}`, (err, files) => {
       continue
       continue
     }
     }
 
 
-
-
     const text = fs.readFileSync(DIR + file).toString()
     const text = fs.readFileSync(DIR + file).toString()
     const obj = readString(readObj(text), text)
     const obj = readString(readObj(text), text)
     const keys = Object.keys(obj)
     const keys = Object.keys(obj)
@@ -65,5 +63,4 @@ fs.readdir(`${DIR}`, (err, files) => {
   if (errorSum === 0) {
   if (errorSum === 0) {
     console.log('Good job! Anything up to date!')
     console.log('Good job! Anything up to date!')
   }
   }
-
 })
 })