Browse Source

Merge pull request #6618 from wenzhixin/feature/update-packages-version

Update packages to latest version
文翼 2 years ago
parent
commit
d9cd944c60

+ 34 - 20
.eslintrc.js

@@ -2,56 +2,69 @@ module.exports = {
   root: true,
   env: {
     browser: true,
+    es2021: true,
     node: true
   },
-  parserOptions: {
-    parser: 'babel-eslint',
-    ecmaVersion: 2017,
-    sourceType: 'module'
-  },
   extends: [
     'eslint:recommended'
   ],
+  parserOptions: {
+    parser: '@babel/eslint-parser',
+    ecmaVersion: 'latest',
+    sourceType: 'module'
+  },
   rules: {
     'array-bracket-newline': ['error', 'consistent'],
     'array-bracket-spacing': ['error', 'never'],
+    'array-element-newline': 'off',
     'arrow-parens': ['error', 'as-needed'],
     'arrow-spacing': ['error', { after: true, before: true }],
     'block-spacing': 'error',
+    'brace-style': ['error', '1tbs'],
     camelcase: 'off',
     'comma-dangle': ['error', 'never'],
     'comma-spacing': ['error', { after: true, before: false }],
+    'comma-style': 'off',
+    'computed-property-spacing': ['error', 'never'],
     'default-case': 'error',
     'dot-location': ['error', 'property'],
     'eol-last': ['error', 'always'],
     eqeqeq: 'error',
+    'func-call-spacing': ['error', 'never'],
     'guard-for-in': 'warn',
-    indent: ['error',
-      2,
-      {
-        ArrayExpression: 1,
-        CallExpression: { arguments: 1 },
-        FunctionDeclaration: { parameters: 'first' },
-        ImportDeclaration: 'first',
-        MemberExpression: 1,
-        ObjectExpression: 1,
-        SwitchCase: 1
-      }],
+    indent: ['error', 2, {
+      ArrayExpression: 1,
+      CallExpression: { arguments: 1 },
+      FunctionDeclaration: { parameters: 'first' },
+      ImportDeclaration: 'first',
+      MemberExpression: 1,
+      ObjectExpression: 1,
+      SwitchCase: 1
+    }],
     'jsdoc/require-jsdoc': 0,
     'key-spacing': ['error', { afterColon: true, beforeColon: false, mode: 'strict' }],
     'keyword-spacing': ['error', { after: true, before: true }],
     'linebreak-style': 'off',
+    'line-comment-position': 'off',
+    'lines-around-comment': 'off',
     'lines-between-class-members': ['error', 'always'],
+    'max-len': 'off',
+    'max-statements-per-line': ['error', { max: 1 }],
+    'multiline-ternary': 'off',
     'no-alert': 'error',
+    'no-async-promise-executor': 'off',
     'no-case-declarations': 'off',
     'no-console': ['warn', { allow: ['warn', 'error', 'trace'] }],
     'no-duplicate-imports': 'error',
     'no-else-return': ['error', { allowElseIf: false }],
+    'no-extra-parens': 'error',
     'no-lonely-if': 'error',
+    'no-mixed-spaces-and-tabs': 'error',
     'no-multi-spaces': 'error',
     'no-multi-str': 'error',
     'no-multiple-empty-lines': 'error',
     'no-new-func': 'error',
+    'no-param-reassign': 'off',
     'no-prototype-builtins': 'off',
     'no-return-assign': 'error',
     'no-return-await': 'error',
@@ -65,6 +78,7 @@ module.exports = {
     'no-useless-constructor': 'warn',
     'no-var': 'error',
     'no-void': 'error',
+    'no-whitespace-before-property': 'error',
     'object-curly-spacing': ['error', 'always'],
     'object-shorthand': 'error',
     'one-var': ['error', 'never'],
@@ -87,14 +101,14 @@ module.exports = {
     'sort-imports': 'off',
     'space-before-blocks': ['error', { classes: 'always', functions: 'always', keywords: 'always' }],
     'space-before-function-paren': ['error', 'always'],
-    'space-in-parens': [2, 'never'],
+    'space-in-parens': ['error', 'never'],
     'space-infix-ops': 'error',
     'spaced-comment': ['error', 'always'],
-    'switch-colon-spacing': 'error'
+    'switch-colon-spacing': 'error',
+    'template-curly-spacing': ['error', 'never']
   },
   globals: {
     $: true,
-    jQuery: true,
-    adsbygoogle: true
+    jQuery: true
   }
 }

+ 4 - 3
cypress.config.js

@@ -1,13 +1,14 @@
-const { defineConfig } = require('cypress')
+import { defineConfig } from 'cypress'
+import plugins from './cypress/plugins/index.js'
 
-module.exports = defineConfig({
+export default defineConfig({
   video: false,
   screenshot: false,
   e2e: {
     // We've imported your old cypress plugins here.
     // You may want to clean this up later by importing these.
     setupNodeEvents(on, config) {
-      return require('./cypress/plugins/index.js')(on, config)
+      return plugins(on, config)
     },
   },
 })

+ 1 - 1
cypress/plugins/index.js

@@ -15,7 +15,7 @@
 /**
  * @type {Cypress.PluginConfig}
  */
-module.exports = (on, config) => {
+export default (on, config) => {
   // `on` is used to hook into various events Cypress emits
   // `config` is the resolved Cypress config
 }

+ 21 - 19
package.json

@@ -2,6 +2,7 @@
   "name": "bootstrap-table",
   "description": "An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)",
   "version": "1.21.2",
+  "type": "module",
   "style": "dist/bootstrap-table.min.css",
   "sass": "src/bootstrap-table.scss",
   "main": "dist/bootstrap-table.min.js",
@@ -9,33 +10,34 @@
     "doc": "site"
   },
   "devDependencies": {
-    "@babel/core": "^7.17.10",
-    "@babel/preset-env": "^7.17.10",
-    "@rollup/plugin-babel": "^6.0.0",
-    "@rollup/plugin-commonjs": "^24.0.0",
-    "@rollup/plugin-inject": "^5.0.0",
+    "@babel/core": "^7.20.12",
+    "@babel/preset-env": "^7.20.2",
+    "@rollup/plugin-babel": "^6.0.3",
+    "@rollup/plugin-commonjs": "^24.0.1",
+    "@rollup/plugin-inject": "^5.0.3",
     "@rollup/plugin-multi-entry": "^6.0.0",
-    "@rollup/plugin-node-resolve": "^15.0.0",
-    "chalk": "^4.0.0",
-    "clean-css-cli": "^5.6.0",
-    "core-js": "^3.22.5",
+    "@rollup/plugin-node-resolve": "^15.0.1",
+    "@vue/compiler-sfc": "^3.2.45",
+    "chalk": "^5.2.0",
+    "clean-css-cli": "^5.6.2",
+    "core-js": "^3.27.2",
     "cross-env": "^7.0.3",
-    "cypress": "^12.1.0",
-    "eslint": "^8.15.0",
+    "cypress": "^12.4.1",
+    "eslint": "^8.33.0",
     "esm": "^3.2.25",
     "foreach-cli": "^1.8.1",
-    "glob": "^8.0.2",
+    "glob": "^8.1.0",
     "headr": "^0.0.4",
     "node-sass": "^8.0.0",
     "npm-run-all": "^4.1.5",
-    "rimraf": "^3.0.2",
-    "rollup": "^2.72.1",
+    "rimraf": "^4.1.2",
+    "rollup": "^3.12.0",
     "rollup-plugin-copy": "^3.4.0",
     "rollup-plugin-terser": "^7.0.2",
-    "rollup-plugin-vue": "5.1.9",
-    "stylelint": "^14.12.1",
-    "stylelint-config-standard-scss": "^6.0.0",
-    "vue-template-compiler": "^2.6.14"
+    "rollup-plugin-vue": "6.0.0",
+    "stylelint": "^14.16.1",
+    "stylelint-config-standard-scss": "^6.1.0",
+    "vue-template-compiler": "^2.7.14"
   },
   "scripts": {
     "lint:js": "eslint src",
@@ -61,7 +63,7 @@
     "pre-commit": "run-s lint docs:check"
   },
   "peerDependencies": {
-    "jquery": "1.9.1 - 3"
+    "jquery": "3"
   },
   "repository": {
     "type": "git",

+ 48 - 46
src/bootstrap-table.js

@@ -305,8 +305,8 @@ class BootstrapTable {
         let style = Utils.sprintf('vertical-align: %s; ', column.valign)
 
         style += Utils.sprintf('width: %s; ', (column.checkbox || column.radio) && !width ?
-          (!column.showSelectTitle ? '36px' : undefined) :
-          (width ? width + unitWidth : undefined))
+          !column.showSelectTitle ? '36px' : undefined :
+          width ? width + unitWidth : undefined)
 
         if (typeof column.fieldIndex === 'undefined' && !column.visible) {
           return
@@ -343,7 +343,7 @@ class BootstrapTable {
             return
           }
 
-          if (this.options.cardView && (!column.cardVisible)) {
+          if (this.options.cardView && !column.cardVisible) {
             return
           }
 
@@ -544,9 +544,9 @@ class BootstrapTable {
       if (currentSortOrder === undefined) {
         this.options.sortOrder = 'asc'
       } else if (currentSortOrder === 'asc') {
-        this.options.sortOrder = this.options.sortReset ? (initialSortOrder === 'asc' ? 'desc' : undefined) : 'desc'
+        this.options.sortOrder = this.options.sortReset ? initialSortOrder === 'asc' ? 'desc' : undefined : 'desc'
       } else if (this.options.sortOrder === 'desc') {
-        this.options.sortOrder = this.options.sortReset ? (initialSortOrder === 'desc' ? 'asc' : undefined) : 'asc'
+        this.options.sortOrder = this.options.sortReset ? initialSortOrder === 'desc' ? 'asc' : undefined : 'asc'
       }
 
       if (this.options.sortOrder === undefined) {
@@ -656,7 +656,7 @@ class BootstrapTable {
       },
       columns: {
         render: false,
-        html: (() => {
+        html: () => {
           const html = []
 
           html.push(`<div class="keep-open ${this.constants.classes.buttonsDropdown}" title="${opts.formatColumns()}">
@@ -708,7 +708,7 @@ class BootstrapTable {
             }
 
             const checked = column.visible ? ' checked="checked"' : ''
-            const disabled = (visibleColumns <= opts.minimumCountColumns) && checked ? ' disabled="disabled"' : ''
+            const disabled = visibleColumns <= opts.minimumCountColumns && checked ? ' disabled="disabled"' : ''
 
             if (column.switchable) {
               html.push(Utils.sprintf(this.constants.html.toolbarDropdownItem,
@@ -719,7 +719,7 @@ class BootstrapTable {
           })
           html.push(this.constants.html.toolbarDropdown[1], '</div>')
           return html.join('')
-        })
+        }
       }
     })
 
@@ -1012,10 +1012,10 @@ class BootstrapTable {
           if (filterAlgorithm === 'and') {
             for (const key in f) {
               if (
-                (Array.isArray(f[key]) &&
-                  !f[key].includes(item[key])) ||
-                (!Array.isArray(f[key]) &&
-                  item[key] !== f[key])
+                Array.isArray(f[key]) &&
+                  !f[key].includes(item[key]) ||
+                !Array.isArray(f[key]) &&
+                  item[key] !== f[key]
               ) {
                 return false
               }
@@ -1025,10 +1025,10 @@ class BootstrapTable {
 
             for (const key in f) {
               if (
-                (Array.isArray(f[key]) &&
-                  f[key].includes(item[key])) ||
-                (!Array.isArray(f[key]) &&
-                  item[key] === f[key])
+                Array.isArray(f[key]) &&
+                  f[key].includes(item[key]) ||
+                !Array.isArray(f[key]) &&
+                  item[key] === f[key]
               ) {
                 match = true
               }
@@ -1045,7 +1045,7 @@ class BootstrapTable {
 
       this.data = searchText ? this.data.filter((item, i) => {
         for (let j = 0; j < this.header.fields.length; j++) {
-          if (!this.header.searchables[j] || (this.options.visibleSearch && visibleFields.indexOf(this.header.fields[j]) === -1)) {
+          if (!this.header.searchables[j] || this.options.visibleSearch && visibleFields.indexOf(this.header.fields[j]) === -1) {
             continue
           }
 
@@ -1081,8 +1081,8 @@ class BootstrapTable {
 
           if (typeof value === 'string' || typeof value === 'number') {
             if (
-              this.options.strictSearch && (`${value}`).toLowerCase() === searchText ||
-              (this.options.regexSearch && Utils.regexCompare(value, rawSearchText))
+              this.options.strictSearch && `${value}`.toLowerCase() === searchText ||
+              this.options.regexSearch && Utils.regexCompare(value, rawSearchText)
             ) {
               return true
             }
@@ -1123,7 +1123,7 @@ class BootstrapTable {
               }
             }
 
-            if (comparisonCheck || (`${value}`).toLowerCase().includes(searchText)) {
+            if (comparisonCheck || `${value}`.toLowerCase().includes(searchText)) {
               return true
             }
           }
@@ -1166,8 +1166,8 @@ class BootstrapTable {
 
     pageList = pageList.map(value => {
       if (typeof value === 'string') {
-        return (value.toLowerCase() === opts.formatAllRows().toLowerCase() ||
-          ['all', 'unlimited'].includes(value.toLowerCase())) ? opts.formatAllRows() : +value
+        return value.toLowerCase() === opts.formatAllRows().toLowerCase() ||
+          ['all', 'unlimited'].includes(value.toLowerCase()) ? opts.formatAllRows() : +value
       }
       return value
     })
@@ -1267,10 +1267,10 @@ class BootstrapTable {
         to = this.totalPages
       } else {
         from = opts.pageNumber - opts.paginationPagesBySide
-        to = from + (opts.paginationPagesBySide * 2)
+        to = from + opts.paginationPagesBySide * 2
       }
 
-      if (opts.pageNumber < (opts.paginationSuccessivelySize - 1)) {
+      if (opts.pageNumber < opts.paginationSuccessivelySize - 1) {
         to = opts.paginationSuccessivelySize
       }
 
@@ -1297,15 +1297,15 @@ class BootstrapTable {
         for (i = 1; i <= max; i++) {
           html.push(pageItem(i))
         }
-        if ((from - 1) === max + 1) {
+        if (from - 1 === max + 1) {
           i = from - 1
           html.push(pageItem(i))
-        } else if ((from - 1) > max) {
+        } else if (from - 1 > max) {
           if (
-            (from - opts.paginationPagesBySide * 2) > opts.paginationPagesBySide &&
+            from - opts.paginationPagesBySide * 2 > opts.paginationPagesBySide &&
               opts.paginationUseIntermediate
           ) {
-            i = Math.round(((from - middleSize) / 2) + middleSize)
+            i = Math.round((from - middleSize) / 2 + middleSize)
             html.push(pageItem(i, ' page-intermediate'))
           } else {
             html.push(Utils.sprintf(this.constants.html.paginationItem,
@@ -1322,15 +1322,15 @@ class BootstrapTable {
         let min = this.totalPages - (opts.paginationPagesBySide - 1)
 
         if (to >= min) min = to + 1
-        if ((to + 1) === min - 1) {
+        if (to + 1 === min - 1) {
           i = to + 1
           html.push(pageItem(i))
-        } else if (min > (to + 1)) {
+        } else if (min > to + 1) {
           if (
-            (this.totalPages - to) > opts.paginationPagesBySide * 2 &&
+            this.totalPages - to > opts.paginationPagesBySide * 2 &&
               opts.paginationUseIntermediate
           ) {
-            i = Math.round(((this.totalPages - middleSize - to) / 2) + to)
+            i = Math.round((this.totalPages - middleSize - to) / 2 + to)
             html.push(pageItem(i, ' page-intermediate'))
           } else {
             html.push(Utils.sprintf(this.constants.html.paginationItem,
@@ -1432,7 +1432,7 @@ class BootstrapTable {
       return
     }
     event.preventDefault()
-    if ((this.options.pageNumber - 1) === 0) {
+    if (this.options.pageNumber - 1 === 0) {
       this.options.pageNumber = this.options.totalPages
     } else {
       this.options.pageNumber--
@@ -1446,7 +1446,7 @@ class BootstrapTable {
       return
     }
     event.preventDefault()
-    if ((this.options.pageNumber + 1) > this.options.totalPages) {
+    if (this.options.pageNumber + 1 > this.options.totalPages) {
       this.options.pageNumber = 1
     } else {
       this.options.pageNumber++
@@ -1512,7 +1512,7 @@ class BootstrapTable {
       Utils.sprintf(' style="%s"', Array.isArray(item) ? undefined : item._style),
       ` data-index="${i}"`,
       Utils.sprintf(' data-uniqueid="%s"', Utils.getItemField(item, this.options.uniqueId, false)),
-      Utils.sprintf(' data-has-detail-view="%s"', (this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item])) ? 'true' : undefined),
+      Utils.sprintf(' data-has-detail-view="%s"', this.options.detailView && Utils.calculateObjectValue(null, this.options.detailFilter, [i, item]) ? 'true' : undefined),
       Utils.sprintf('%s', data_),
       '>'
     )
@@ -1558,7 +1558,7 @@ class BootstrapTable {
       let title_ = ''
 
       if ((this.fromHtml || this.autoMergeCells) && typeof value_ === 'undefined') {
-        if ((!column.checkbox) && (!column.radio)) {
+        if (!column.checkbox && !column.radio) {
           return
         }
       }
@@ -1567,7 +1567,7 @@ class BootstrapTable {
         return
       }
 
-      if (this.options.cardView && (!column.cardVisible)) {
+      if (this.options.cardView && !column.cardVisible) {
         return
       }
 
@@ -1670,7 +1670,7 @@ class BootstrapTable {
         const c = column['class'] || ''
         const isChecked = Utils.isObject(value) && value.hasOwnProperty('checked') ?
           value.checked : (value === true || value_) && value !== false
-        const isDisabled = !column.checkboxEnabled || (value && value.disabled)
+        const isDisabled = !column.checkboxEnabled || value && value.disabled
 
         text = [
           this.options.cardView ?
@@ -1690,7 +1690,7 @@ class BootstrapTable {
           this.options.cardView ? '</div>' : '</td>'
         ].join('')
 
-        item[this.header.stateField] = value === true || (!!value_ || (value && value.checked))
+        item[this.header.stateField] = value === true || (!!value_ || value && value.checked)
       } else if (this.options.cardView) {
         const cardTitle = this.options.showHeader ?
           `<span class="card-view-title ${cellStyle.classes || ''}"${style_}>${Utils.getFieldTitle(this.columns, field)}</span>` : ''
@@ -1800,7 +1800,9 @@ class BootstrapTable {
       })
     }
 
-    toExpand.forEach(index => { this.expandRow(index) })
+    toExpand.forEach(index => {
+      this.expandRow(index)
+    })
 
     if (!fixedScroll) {
       this.scrollTo(0)
@@ -1994,7 +1996,7 @@ class BootstrapTable {
       }
     }
 
-    if (!(Utils.isEmptyObject(this.filterColumnsPartial))) {
+    if (!Utils.isEmptyObject(this.filterColumnsPartial)) {
       params.filter = JSON.stringify(this.filterColumnsPartial, null)
     }
 
@@ -2259,12 +2261,12 @@ class BootstrapTable {
 
       if (
         !column.visible ||
-        (this.footerData && this.footerData.length > 0 && !(column.field in this.footerData[0]))
+        this.footerData && this.footerData.length > 0 && !(column.field in this.footerData[0])
       ) {
         continue
       }
 
-      if (this.options.cardView && (!column.cardVisible)) {
+      if (this.options.cardView && !column.cardVisible) {
         return
       }
 
@@ -2404,7 +2406,7 @@ class BootstrapTable {
     for (const field of this.header.fields) {
       const column = this.columns[this.fieldsColumnsIndex[field]]
 
-      if (!column || !column.visible || (this.options.cardView && !column.cardVisible)) {
+      if (!column || !column.visible || this.options.cardView && !column.cardVisible) {
         continue
       }
       visibleFields.push(field)
@@ -2622,9 +2624,9 @@ class BootstrapTable {
       if (typeof rowUniqueId === 'string') {
         id = id.toString()
       } else if (typeof rowUniqueId === 'number') {
-        if ((Number(rowUniqueId) === rowUniqueId) && (rowUniqueId % 1 === 0)) {
+        if (Number(rowUniqueId) === rowUniqueId && rowUniqueId % 1 === 0) {
           id = parseInt(id, 10)
-        } else if ((rowUniqueId === Number(rowUniqueId)) && (rowUniqueId !== 0)) {
+        } else if (rowUniqueId === Number(rowUniqueId) && rowUniqueId !== 0) {
           id = parseFloat(id)
         }
       }

+ 2 - 2
src/extensions/auto-refresh/bootstrap-table-auto-refresh.js

@@ -49,8 +49,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
             <button class="auto-refresh ${this.constants.buttonsClass}
               ${this.options.autoRefreshStatus ? ` ${this.constants.classes.buttonActive}` : ''}"
               type="button" name="autoRefresh" title="${this.options.formatAutoRefresh()}">
-              ${ this.options.showButtonIcons ? Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.autoRefresh) : ''}
-              ${ this.options.showButtonText ? this.options.formatAutoRefresh() : ''}
+              ${this.options.showButtonIcons ? Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, this.options.icons.autoRefresh) : ''}
+              ${this.options.showButtonText ? this.options.formatAutoRefresh() : ''}
             </button>
            `,
           event: this.toggleAutoRefresh

+ 3 - 3
src/extensions/cookie/bootstrap-table-cookie.js

@@ -420,7 +420,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
       return
     }
 
-    if ((this.options.cookieIdTable === '') || (this.options.cookieExpire === '')) {
+    if (this.options.cookieIdTable === '' || this.options.cookieExpire === '') {
       console.error('Configuration error. Please review the cookieIdTable and the cookieExpire property. If the properties are correct, then this browser does not support cookies.')
       this.options.cookie = false // Make sure that the cookie extension is disabled
       return
@@ -561,7 +561,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
             that.options.cookiePath ? `; path=${that.options.cookiePath}` : '',
             that.options.cookieDomain ? `; domain=${that.options.cookieDomain}` : '',
             that.options.cookieSecure ? '; secure' : '',
-            `;SameSite=${ that.options.cookieSameSite}`
+            `;SameSite=${that.options.cookieSameSite}`
           ].join('')
         }
         this._storage.getItem = function (cookieName) {
@@ -576,7 +576,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
             '; expires=Thu, 01 Jan 1970 00:00:00 GMT',
             that.options.cookiePath ? `; path=${that.options.cookiePath}` : '',
             that.options.cookieDomain ? `; domain=${that.options.cookieDomain}` : '',
-            `;SameSite=${ that.options.cookieSameSite}`
+            `;SameSite=${that.options.cookieSameSite}`
           ].join('')
         }
         break

+ 2 - 2
src/extensions/export/bootstrap-table-export.js

@@ -93,7 +93,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
       this.buttons = Object.assign(this.buttons, {
         export: {
           html:
-            (() => {
+            () => {
               if (exportTypes.length === 1) {
                 return `
                   <div class="export ${this.constants.classes.buttonsDropdown}"
@@ -136,7 +136,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
               html.push(this.constants.html.toolbarDropdown[1], '</div>')
               return html.join('')
-            })
+            }
         }
       })
     }

+ 5 - 5
src/extensions/filter-control/bootstrap-table-filter-control.js

@@ -214,7 +214,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
         keys.forEach(key => {
           const thisColumn = that.columns[that.fieldsColumnsIndex[key]]
-          const rawFilterValue = (filterPartial[key] || '')
+          const rawFilterValue = filterPartial[key] || ''
           let filterValue = rawFilterValue.toLowerCase()
           let value = Utils.unescapeHTML(Utils.getItemField(item, key, false))
           let tmpItemIsExpected
@@ -300,17 +300,17 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
     if (
       column.filterStrictSearch ||
-      (column.filterControl === 'select' && column.passed.filterStrictSearch !== false)
+      column.filterControl === 'select' && column.passed.filterStrictSearch !== false
     ) {
       tmpItemIsExpected = value.toString().toLowerCase() === searchValue.toString().toLowerCase()
     } else if (column.filterStartsWithSearch) {
-      tmpItemIsExpected = (`${value}`).toLowerCase().indexOf(searchValue) === 0
+      tmpItemIsExpected = `${value}`.toLowerCase().indexOf(searchValue) === 0
     } else if (column.filterControl === 'datepicker') {
       tmpItemIsExpected = new Date(value).getTime() === new Date(searchValue).getTime()
     } else if (this.options.regexSearch) {
       tmpItemIsExpected = Utils.regexCompare(value, searchValue)
     } else {
-      tmpItemIsExpected = (`${value}`).toLowerCase().includes(searchValue)
+      tmpItemIsExpected = `${value}`.toLowerCase().includes(searchValue)
     }
 
     const largerSmallerEqualsRegex = /(?:(<=|=>|=<|>=|>|<)(?:\s+)?(\d+)?|(\d+)?(\s+)?(<=|=>|=<|>=|>|<))/gm
@@ -537,7 +537,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
     const text = this.options.showButtonText ? this.options.filterControlVisible ? this.options.formatFilterControlSwitchHide() : this.options.formatFilterControlSwitchShow() : ''
 
     this.$toolbar.find('>.columns').find('.filter-control-switch')
-      .html(`${Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon) } ${ text}`)
+      .html(`${Utils.sprintf(this.constants.html.icon, this.options.iconsPrefix, icon)} ${text}`)
   }
 
   triggerSearch () {

+ 6 - 8
src/extensions/filter-control/utils.js

@@ -61,7 +61,7 @@ export function existOptionInSelectControl (selectControl, value) {
 }
 
 export function addOptionToSelectControl (selectControl, _value, text, selected, shouldCompareText) {
-  let value = (_value === undefined || _value === null) ? '' : _value.toString().trim()
+  let value = _value === undefined || _value === null ? '' : _value.toString().trim()
 
   value = Utils.removeHTML(Utils.unescapeHTML(value))
   text = Utils.removeHTML(Utils.unescapeHTML(text))
@@ -70,7 +70,7 @@ export function addOptionToSelectControl (selectControl, _value, text, selected,
     return
   }
 
-  const isSelected = shouldCompareText ? (value === selected || text === selected) : value === selected
+  const isSelected = shouldCompareText ? value === selected || text === selected : value === selected
 
   const option = new Option(text, value, false, isSelected)
 
@@ -177,8 +177,7 @@ export function setCaretPosition (elem, caretPos) {
         elem.setSelectionRange(caretPos, caretPos)
       }
     }
-  }
-  catch (ex) {
+  } catch (ex) {
     // ignored
   }
 }
@@ -477,13 +476,12 @@ export function createControls (that, header) {
       if (Array.isArray(value)) {
         for (let i = 0; i < value.length; i++) {
           if (value[i] && value[i].length > 0 && value[i].trim()) {
-            $selectControl.find(`option[value="${ value[i] }"]`).attr('selected', true)
+            $selectControl.find(`option[value="${value[i]}"]`).attr('selected', true)
           }
         }
-      }
-      else if (value && value.length > 0 && value.trim()) {
+      } else if (value && value.length > 0 && value.trim()) {
         $selectControl.find('option[selected]').removeAttr('selected')
-        $selectControl.find(`option[value="${ value }"]`).attr('selected', true)
+        $selectControl.find(`option[value="${value}"]`).attr('selected', true)
       } else {
         $selectControl.find('option[selected]').removeAttr('selected')
       }

+ 24 - 8
src/extensions/fixed-columns/bootstrap-table-fixed-columns.js

@@ -16,10 +16,18 @@ function normalizeWheel (event) {
   let pY = 0 // pixelY
 
   // Legacy
-  if ('detail' in event) { sY = event.detail }
-  if ('wheelDelta' in event) { sY = -event.wheelDelta / 120 }
-  if ('wheelDeltaY' in event) { sY = -event.wheelDeltaY / 120 }
-  if ('wheelDeltaX' in event) { sX = -event.wheelDeltaX / 120 }
+  if ('detail' in event) {
+    sY = event.detail
+  }
+  if ('wheelDelta' in event) {
+    sY = -event.wheelDelta / 120
+  }
+  if ('wheelDeltaY' in event) {
+    sY = -event.wheelDeltaY / 120
+  }
+  if ('wheelDeltaX' in event) {
+    sX = -event.wheelDeltaX / 120
+  }
 
   // side scrolling on FF with DOMMouseScroll
   if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {
@@ -30,8 +38,12 @@ function normalizeWheel (event) {
   pX = sX * PIXEL_STEP
   pY = sY * PIXEL_STEP
 
-  if ('deltaY' in event) { pY = event.deltaY }
-  if ('deltaX' in event) { pX = event.deltaX }
+  if ('deltaY' in event) {
+    pY = event.deltaY
+  }
+  if ('deltaX' in event) {
+    pX = event.deltaX
+  }
 
   if ((pX || pY) && event.deltaMode) {
     if (event.deltaMode === 1) { // delta in LINE units
@@ -44,8 +56,12 @@ function normalizeWheel (event) {
   }
 
   // Fall-back if spin cannot be determined
-  if (pX && !sX) { sX = (pX < 1) ? -1 : 1 }
-  if (pY && !sY) { sY = (pY < 1) ? -1 : 1 }
+  if (pX && !sX) {
+    sX = pX < 1 ? -1 : 1
+  }
+  if (pY && !sY) {
+    sY = pY < 1 ? -1 : 1
+  }
 
   return {
     spinX: sX,

+ 7 - 7
src/extensions/group-by-v2/bootstrap-table-group-by.js

@@ -53,8 +53,8 @@ BootstrapTable.prototype.initSort = function (...args) {
 
   this.tableGroups = []
 
-  if ((this.options.groupBy) && (this.options.groupByField !== '')) {
-    if ((this.options.sortName !== this.options.groupByField)) {
+  if (this.options.groupBy && this.options.groupByField !== '') {
+    if (this.options.sortName !== this.options.groupByField) {
       if (this.options.customSort) {
         Utils.calculateObjectValue(this.options, this.options.customSort, [
           this.options.sortName,
@@ -122,7 +122,7 @@ BootstrapTable.prototype.initBody = function (...args) {
   initBodyCaller = true
   _initBody.apply(this, Array.prototype.slice.apply(args))
 
-  if ((this.options.groupBy) && (this.options.groupByField !== '')) {
+  if (this.options.groupBy && this.options.groupByField !== '') {
     const that = this
     let checkBox = false
     let visibleColumns = 0
@@ -185,8 +185,8 @@ BootstrapTable.prototype.initBody = function (...args) {
       that.$selectGroup.push({
         group: self,
         item: that.$selectItem.filter(function () {
-          return ($(this).closest('tr').data('parent-index') ===
-            self.closest('tr').data('group-index'))
+          return $(this).closest('tr').data('parent-index') ===
+            self.closest('tr').data('group-index')
         })
       })
     })
@@ -224,7 +224,7 @@ BootstrapTable.prototype.updateSelected = function (...args) {
   if (!initBodyCaller) {
     _updateSelected.apply(this, Array.prototype.slice.apply(args))
 
-    if ((this.options.groupBy) && (this.options.groupByField !== '')) {
+    if (this.options.groupBy && this.options.groupByField !== '') {
       this.$selectGroup.forEach(item => {
         const checkGroup = item.item.filter(':enabled').length ===
           item.item.filter(':enabled').filter(':checked').length
@@ -258,7 +258,7 @@ BootstrapTable.prototype.isCollapsed = function (groupKey, items) {
 BootstrapTable.prototype.checkGroup_ = function (index, checked) {
   const rowsBefore = this.getSelections()
   const filter = function () {
-    return ($(this).closest('tr').data('parent-index') === index)
+    return $(this).closest('tr').data('parent-index') === index
   }
 
   this.$selectItem.filter(filter).prop('checked', checked)

+ 2 - 2
src/extensions/mobile/bootstrap-table-mobile.js

@@ -107,9 +107,9 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
   changeView (width, height) {
     if (this.options.minHeight) {
-      if ((width <= this.options.minWidth) && (height <= this.options.minHeight)) {
+      if (width <= this.options.minWidth && height <= this.options.minHeight) {
         this.conditionCardView()
-      } else if ((width > this.options.minWidth) && (height > this.options.minHeight)) {
+      } else if (width > this.options.minWidth && height > this.options.minHeight) {
         this.conditionFullView()
       }
     } else if (width <= this.options.minWidth) {

+ 1 - 1
src/extensions/pipeline/bootstrap-table-pipeline.js

@@ -254,7 +254,7 @@ BootstrapTable.prototype.initServer = function (silent, query, url) {
   }
   // cached results can't be used
   // continue base initServer code
-  if (!($.isEmptyObject(this.filterColumnsPartial))) {
+  if (!$.isEmptyObject(this.filterColumnsPartial)) {
     params.filter = JSON.stringify(this.filterColumnsPartial, null)
   }
 

+ 5 - 5
src/extensions/print/bootstrap-table-print.js

@@ -177,7 +177,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
             for (let cs = 0; cs < currentMergedCell.colspan; cs++) {
               const col = currentMergedCell.col + cs
 
-              dontRender.push(`${row },${ col}`)
+              dontRender.push(`${row},${col}`)
             }
           }
         }
@@ -212,8 +212,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
           if (
             !columns[j].printIgnore && columns[j].visible && columns[j].field &&
               (
-                !dontRender.includes(`${i },${ j}`) ||
-                (rowspan > 0 && colspan > 0)
+                !dontRender.includes(`${i},${j}`) ||
+                rowspan > 0 && colspan > 0
               )
           ) {
             if (rowspan > 0 && colspan > 0) {
@@ -255,8 +255,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
       }
       let reverse = sortOrder !== 'asc'
 
-      reverse = -((+reverse) || -1)
-      return data.sort((a, b) => reverse * (a[colName].localeCompare(b[colName])))
+      reverse = -(+reverse || -1)
+      return data.sort((a, b) => reverse * a[colName].localeCompare(b[colName]))
     }
 
     const filterRow = (row, filters) => {

+ 2 - 2
src/extensions/sticky-header/bootstrap-table-sticky-header.js

@@ -83,7 +83,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
         const $target = $(e.target)
         const value = $target.val()
         const field = $target.parents('th').data('field')
-        const $coreTh = that.$header.find(`th[data-field="${ field }"]`)
+        const $coreTh = that.$header.find(`th[data-field="${field}"]`)
 
         if ($target.is('input')) {
           $coreTh.find('input').val(value)
@@ -91,7 +91,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
           const $select = $coreTh.find('select')
 
           $select.find('option[selected]').removeAttr('selected')
-          $select.find(`option[value="${ value }"]`).attr('selected', true)
+          $select.find(`option[value="${value}"]`).attr('selected', true)
         }
 
         that.triggerSearch()

+ 7 - 7
src/extensions/toolbar/bootstrap-table-toolbar.js

@@ -221,9 +221,9 @@ $.BootstrapTable = class extends $.BootstrapTable {
     const o = this.options
 
     this.showToolbar = this.showToolbar ||
-      (o.search &&
+      o.search &&
       o.advancedSearch &&
-      o.idTable)
+      o.idTable
 
     if (o.search && o.advancedSearch && o.idTable) {
       this.buttons = Object.assign(this.buttons, {
@@ -244,7 +244,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
   showAvdSearch () {
     const o = this.options
-    const modalSelector = `#avdSearchModal_${ o.idTable}`
+    const modalSelector = `#avdSearchModal_${o.idTable}`
 
     if ($(modalSelector).length <= 0) {
       $('body').append(Utils.sprintf(theme.html.modal, o.idTable, o.formatAdvancedSearch(), o.idTable, o.idTable, o.buttonsClass, o.formatAdvancedCloseButton()))
@@ -277,14 +277,14 @@ $.BootstrapTable = class extends $.BootstrapTable {
   }
 
   showModal () {
-    const modalSelector = `#avdSearchModal_${ this.options.idTable}`
+    const modalSelector = `#avdSearchModal_${this.options.idTable}`
 
     if ($.inArray($.fn.bootstrapTable.theme, ['bootstrap3', 'bootstrap4']) !== -1) {
       $(modalSelector).modal()
     } else if ($.fn.bootstrapTable.theme === 'bootstrap5') {
       if (!this.toolbarModal) {
       //   eslint-disable-next-line no-undef
-        this.toolbarModal = new bootstrap.Modal(document.getElementById(`avdSearchModal_${ this.options.idTable}`), {})
+        this.toolbarModal = new bootstrap.Modal(document.getElementById(`avdSearchModal_${this.options.idTable}`), {})
       }
       this.toolbarModal.show()
     } else if ($.fn.bootstrapTable.theme === 'bulma') {
@@ -306,7 +306,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
 
   hideModal () {
     const $closeModalButton = $(`#avdSearchModal_${this.options.idTable}`)
-    const modalSelector = `#avdSearchModal_${ this.options.idTable}`
+    const modalSelector = `#avdSearchModal_${this.options.idTable}`
 
     if ($.inArray($.fn.bootstrapTable.theme, ['bootstrap3', 'bootstrap4']) !== -1) {
       $closeModalButton.modal('hide')
@@ -374,7 +374,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
         if (
           !(index !== -1 &&
           (typeof value === 'string' || typeof value === 'number') &&
-          (`${value}`).toLowerCase().includes(fval))
+          `${value}`.toLowerCase().includes(fval))
         ) {
           return false
         }

+ 3 - 3
src/locale/bootstrap-table-da-DK.js

@@ -18,10 +18,10 @@ $.fn.bootstrapTable.locales['da-DK'] = $.fn.bootstrapTable.locales['da'] = {
   },
   formatShowingRows (pageFrom, pageTo, totalRows, totalNotFiltered) {
     if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
-      return `Viser ${pageFrom} til ${pageTo} af ${totalRows} række${(totalRows > 1) ? 'r' : ''} (filtered from ${totalNotFiltered} total rows)`
+      return `Viser ${pageFrom} til ${pageTo} af ${totalRows} række${totalRows > 1 ? 'r' : ''} (filtered from ${totalNotFiltered} total rows)`
     }
 
-    return `Viser ${pageFrom} til ${pageTo} af ${totalRows} række${(totalRows > 1) ? 'r' : ''}`
+    return `Viser ${pageFrom} til ${pageTo} af ${totalRows} række${totalRows > 1 ? 'r' : ''}`
   },
   formatSRPaginationPreText () {
     return 'previous page'
@@ -33,7 +33,7 @@ $.fn.bootstrapTable.locales['da-DK'] = $.fn.bootstrapTable.locales['da'] = {
     return 'next page'
   },
   formatDetailPagination (totalRows) {
-    return `Viser ${totalRows} række${(totalRows > 1) ? 'r' : ''}`
+    return `Viser ${totalRows} række${totalRows > 1 ? 'r' : ''}`
   },
   formatClearSearch () {
     return 'Ryd filtre'

+ 3 - 3
src/locale/bootstrap-table-de-DE.js

@@ -18,10 +18,10 @@ $.fn.bootstrapTable.locales['de-DE'] = $.fn.bootstrapTable.locales['de'] = {
   },
   formatShowingRows (pageFrom, pageTo, totalRows, totalNotFiltered) {
     if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
-      return `Zeige Zeile ${pageFrom} bis ${pageTo} von ${totalRows} Zeile${(totalRows > 1) ? 'n' : ''} (Gefiltert von ${totalNotFiltered} Zeile${(totalNotFiltered > 1) ? 'n' : ''})`
+      return `Zeige Zeile ${pageFrom} bis ${pageTo} von ${totalRows} Zeile${totalRows > 1 ? 'n' : ''} (Gefiltert von ${totalNotFiltered} Zeile${totalNotFiltered > 1 ? 'n' : ''})`
     }
 
-    return `Zeige Zeile ${pageFrom} bis ${pageTo} von ${totalRows} Zeile${(totalRows > 1) ? 'n' : ''}.`
+    return `Zeige Zeile ${pageFrom} bis ${pageTo} von ${totalRows} Zeile${totalRows > 1 ? 'n' : ''}.`
   },
   formatSRPaginationPreText () {
     return 'Vorherige Seite'
@@ -33,7 +33,7 @@ $.fn.bootstrapTable.locales['de-DE'] = $.fn.bootstrapTable.locales['de'] = {
     return 'Nächste Seite'
   },
   formatDetailPagination (totalRows) {
-    return `Zeige ${totalRows} Zeile${(totalRows > 1) ? 'n' : ''}.`
+    return `Zeige ${totalRows} Zeile${totalRows > 1 ? 'n' : ''}.`
   },
   formatClearSearch () {
     return 'Lösche Filter'

+ 2 - 2
src/locale/bootstrap-table-lb-LU.js

@@ -18,10 +18,10 @@ $.fn.bootstrapTable.locales['lb-LU'] = $.fn.bootstrapTable.locales['lb'] = {
   },
   formatShowingRows (pageFrom, pageTo, totalRows, totalNotFiltered) {
     if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
-      return `Weist Zeil ${pageFrom} bis ${pageTo} vun ${totalRows} Zeil${(totalRows > 1) ? 'en' : ''} (gefiltert vun insgesamt ${totalNotFiltered} Zeil${(totalRows > 1) ? 'en' : ''})`
+      return `Weist Zeil ${pageFrom} bis ${pageTo} vun ${totalRows} Zeil${totalRows > 1 ? 'en' : ''} (gefiltert vun insgesamt ${totalNotFiltered} Zeil${totalRows > 1 ? 'en' : ''})`
     }
 
-    return `Weist Zeil ${pageFrom} bis ${pageTo} vun ${totalRows} Zeil${(totalRows > 1) ? 'en' : ''}`
+    return `Weist Zeil ${pageFrom} bis ${pageTo} vun ${totalRows} Zeil${totalRows > 1 ? 'en' : ''}`
   },
   formatSRPaginationPreText () {
     return 'viregt Säit'

+ 3 - 3
src/locale/bootstrap-table-nl-BE.js

@@ -18,10 +18,10 @@ $.fn.bootstrapTable.locales['nl-BE'] = {
   },
   formatShowingRows (pageFrom, pageTo, totalRows, totalNotFiltered) {
     if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
-      return `Toon ${pageFrom} tot ${pageTo} van ${totalRows} record${(totalRows > 1) ? 's' : ''} (gefilterd van ${totalNotFiltered} records in totaal)`
+      return `Toon ${pageFrom} tot ${pageTo} van ${totalRows} record${totalRows > 1 ? 's' : ''} (gefilterd van ${totalNotFiltered} records in totaal)`
     }
 
-    return `Toon ${pageFrom} tot ${pageTo} van ${totalRows} record${(totalRows > 1) ? 's' : ''}`
+    return `Toon ${pageFrom} tot ${pageTo} van ${totalRows} record${totalRows > 1 ? 's' : ''}`
   },
   formatSRPaginationPreText () {
     return 'vorige pagina'
@@ -33,7 +33,7 @@ $.fn.bootstrapTable.locales['nl-BE'] = {
     return 'volgende pagina'
   },
   formatDetailPagination (totalRows) {
-    return `Toon ${totalRows} record${(totalRows > 1) ? 's' : ''}`
+    return `Toon ${totalRows} record${totalRows > 1 ? 's' : ''}`
   },
   formatClearSearch () {
     return 'Verwijder filters'

+ 3 - 3
src/locale/bootstrap-table-nl-NL.js

@@ -19,10 +19,10 @@ $.fn.bootstrapTable.locales['nl-NL'] = $.fn.bootstrapTable.locales['nl'] = {
   },
   formatShowingRows (pageFrom, pageTo, totalRows, totalNotFiltered) {
     if (totalNotFiltered !== undefined && totalNotFiltered > 0 && totalNotFiltered > totalRows) {
-      return `Toon ${pageFrom} tot ${pageTo} van ${totalRows} record${(totalRows > 1) ? 's' : ''} (gefilterd van ${totalNotFiltered} records in totaal)`
+      return `Toon ${pageFrom} tot ${pageTo} van ${totalRows} record${totalRows > 1 ? 's' : ''} (gefilterd van ${totalNotFiltered} records in totaal)`
     }
 
-    return `Toon ${pageFrom} tot ${pageTo} van ${totalRows} record${(totalRows > 1) ? 's' : ''}`
+    return `Toon ${pageFrom} tot ${pageTo} van ${totalRows} record${totalRows > 1 ? 's' : ''}`
   },
   formatSRPaginationPreText () {
     return 'vorige pagina'
@@ -34,7 +34,7 @@ $.fn.bootstrapTable.locales['nl-NL'] = $.fn.bootstrapTable.locales['nl'] = {
     return 'volgende pagina'
   },
   formatDetailPagination (totalRows) {
-    return `Toon ${totalRows} record${(totalRows > 1) ? 's' : ''}`
+    return `Toon ${totalRows} record${totalRows > 1 ? 's' : ''}`
   },
   formatClearSearch () {
     return 'Verwijder filters'

+ 4 - 5
tools/check-api.js

@@ -1,8 +1,7 @@
-// eslint-disable-next-line no-global-assign
-require = require('esm')(module)
-const fs = require('fs')
-const chalk = require('chalk')
-const Constants = require('../src/constants/index.js').default
+import fs from 'fs'
+import chalk from 'chalk'
+import Constants from '../src/constants/index.js'
+
 let errorSum = 0
 const exampleFilesFolder = './bootstrap-table-examples/'
 const exampleFilesFound = fs.existsSync(exampleFilesFolder)

+ 3 - 3
tools/check-locale.js

@@ -1,6 +1,6 @@
-const fs = require('fs')
-const _ = require('lodash')
-const chalk = require('chalk')
+import fs from 'fs'
+import chalk from 'chalk'
+import _ from 'lodash'
 
 const DIR = '../src/locale/'
 const readKeys = text => {

File diff suppressed because it is too large
+ 130 - 636
yarn.lock