Browse Source

Improve tools

zhixin 5 years ago
parent
commit
67c5c5b397
5 changed files with 12 additions and 44 deletions
  1. 3 0
      .travis.yml
  2. 1 2
      package.json
  3. 0 18
      site/docs/api/table-options.md
  4. 0 1
      src/constants/index.js
  5. 8 23
      tools/check-api.js

+ 3 - 0
.travis.yml

@@ -9,6 +9,9 @@ jobs:
       node_js:
         - 12
       name: "Lint src and check docs"
+      before_install:
+        - cd tools
+        - git clone --depth=1 https://github.com/wenzhixin/bootstrap-table-examples
       script: npm run pre-commit
       if: type = pull_request
 

+ 1 - 2
package.json

@@ -32,8 +32,7 @@
     "safe-eval": "^0.4.1",
     "stylelint": "^13.3.3",
     "stylelint-config-standard": "^20.0.0",
-    "vue-template-compiler": "^2.6.10",
-    "xmlhttprequest": "^1.8.0"
+    "vue-template-compiler": "^2.6.10"
   },
   "scripts": {
     "lint:js": "eslint src",

+ 0 - 18
site/docs/api/table-options.md

@@ -510,22 +510,6 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 - **Example:** [Table Height](https://examples.bootstrap-table.com/#options/table-height.html)
 
-## html
-
-- **Attribute:** `data-html`
-
-- **Type:** `Object`
-
-- **Detail:**
-
-  Defines some html of the table.
-
-- **Default:**
-
-  Too much code, please checkout the source code of the `index.js`
-
-- **Example:** [Table Html](https://examples.bootstrap-table.com/#options/table-html.html)
-
 ## iconSize
 
 - **Attribute:** `data-icon-size`
@@ -1702,8 +1686,6 @@ The table options are defined in `jQuery.fn.bootstrapTable.defaults`.
 
 - **Default:** `undefined`
 
-- **Example:** [Virtual Scroll Item Height](https://examples.bootstrap-table.com/#options/virtual-scroll-item-height.html)
-
 ## visibleSearch
 
 - **Attribute:** `visible-search`

+ 0 - 1
src/constants/index.js

@@ -292,7 +292,6 @@ const DEFAULTS = {
   buttonsPrefix: CONSTANTS.classes.buttonsPrefix,
   buttonsClass: CONSTANTS.classes.buttons,
   icons: CONSTANTS.icons,
-  html: CONSTANTS.html,
   iconSize: undefined,
   iconsPrefix: CONSTANTS.iconsPrefix, // glyphicon or fa(font-awesome)
   loadingFontSize: 'auto',

+ 8 - 23
tools/check-api.js

@@ -3,29 +3,13 @@ require = require('esm')(module)
 const fs = require('fs')
 const chalk = require('chalk')
 const Constants = require('../src/constants/index.js').default
-const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest
 let errorSum = 0
-
-function loadExampleLink (url) {
-  const request = new XMLHttpRequest()
-  request.open('GET', url, false)
-  request.send(null)
-
-  const filesJson = JSON.parse(request.responseText)
-  const fileNames = []
-
-  for (const [key, value] of Object.entries(filesJson)) {
-    fileNames.push(value.name)
-  }
-
-  return fileNames
-}
-
-let exampleFiles = []
-exampleFiles = exampleFiles.concat(loadExampleLink('https://api.github.com/repos/wenzhixin/bootstrap-table-examples/contents/options'))
-exampleFiles = exampleFiles.concat(loadExampleLink('https://api.github.com/repos/wenzhixin/bootstrap-table-examples/contents/methods'))
-exampleFiles = exampleFiles.concat(loadExampleLink('https://api.github.com/repos/wenzhixin/bootstrap-table-examples/contents/column-options'))
-exampleFiles = exampleFiles.concat(loadExampleLink('https://api.github.com/repos/wenzhixin/bootstrap-table-examples/contents/welcomes'))
+const exampleFiles = [
+  ...fs.readdirSync('./bootstrap-table-examples/welcomes'),
+  ...fs.readdirSync('./bootstrap-table-examples/options'),
+  ...fs.readdirSync('./bootstrap-table-examples/column-options'),
+  ...fs.readdirSync('./bootstrap-table-examples/methods')
+]
 
 class API {
   constructor () {
@@ -109,7 +93,8 @@ class TableOptions extends API {
     this.attributes = ['Attribute', 'Type', 'Detail', 'Default', 'Example']
     this.ignore = {
       totalRows: ['Example'],
-      totalNotFiltered: ['Example']
+      totalNotFiltered: ['Example'],
+      virtualScrollItemHeight: ['Example']
     }
   }
 }