`,
'
',
hit.anchor.split('/')[0].slice(1),
'
',
@@ -120,7 +126,8 @@ function doSearch() {
)
$(document).on('click', '.ais-Hits-item .link', function (e) {
- var href = $(e.currentTarget).data('href')
+ const href = $(e.currentTarget).data('href')
+
if ($(e.target).is('a')) {
return
}
@@ -134,7 +141,7 @@ function doSearch() {
}
function initViewSource () {
- var isSource = /view-source$/.test(location.hash)
+ const isSource = /view-source$/.test(location.hash)
if (isSource) {
$('.view-example').css('display', 'block')
@@ -147,15 +154,13 @@ function initViewSource () {
$('.view-example, .view-source').off('click').click(function () {
if (isSource) {
location.hash = location.hash.replace('#view-source', '')
- } else {
- if (location.hash.indexOf('view-source') === -1) {
- location.hash += '#view-source'
- }
+ } else if (location.hash.indexOf('view-source') === -1) {
+ location.hash += '#view-source'
}
})
- $('.view-online').attr('href', 'https://live.bootstrap-table.com/example/' +
- (location.hash.slice(1).split('#')[0] || 'welcome.html'))
+ $('.view-online').attr('href', `https://live.bootstrap-table.com/example/${
+ location.hash.slice(1).split('#')[0] || 'welcome.html'}`)
}
$(function () {
@@ -166,14 +171,16 @@ $(function () {
$('[data-toggle="tooltip"]').tooltip()
$(window).hashchange(function () {
- var href = initUrl()
+ const href = initUrl()
+
loadUrl(href)
initNavigation(href)
initViewSource()
})
initThemes()
- var href = initUrl()
+ const href = initUrl()
+
loadUrl(href)
initNavigation(href)
autoScrollNavigation()
diff --git a/assets/js/template.js b/assets/js/template.js
index a6118bc2..a7fd34c0 100644
--- a/assets/js/template.js
+++ b/assets/js/template.js
@@ -6,42 +6,44 @@ window._config = {
testUrl: '/src/'
}
-function _getLink(file) {
- var url = file
+function _getLink (file) {
+ let url = file
+
if (!/^http/.test(file)) {
url = window._config.cdnUrl + file
if (window._config.isDebug) {
- url = (location.href.includes('for-test') ? window._config.testUrl : window._config.localUrl) +
- file.replace(/\.min/, '') + '?t=' + (+new Date())
+ url = `${(location.href.includes('for-test') ? window._config.testUrl : window._config.localUrl) +
+ file.replace(/\.min/, '')}?t=${+new Date()}`
}
}
- return '
'
+ return `
`
}
-function _getScript(file, isScriptTag) {
- var url = file
+function _getScript (file, isScriptTag) {
+ let url = file
+
if (!/^http/.test(file)) {
url = window._config.cdnUrl + file
if (window._config.isDebug) {
- url = (location.href.includes('for-test') ? window._config.testUrl : window._config.localUrl) +
- file.replace(/\.min/, '') + '?t=' + (+new Date())
+ url = `${(location.href.includes('for-test') ? window._config.testUrl : window._config.localUrl) +
+ file.replace(/\.min/, '')}?t=${+new Date()}`
}
}
if (isScriptTag) {
- return ''
+ return ``
}
return url
}
-function _link(file) {
+function _link (file) {
$('head').append(_getLink(file))
}
-function _script(file, callback) {
- var head = document.getElementsByTagName('head')[0]
- var script = document.createElement('script')
+function _script (file, callback) {
+ const head = document.getElementsByTagName('head')[0]
+ const script = document.createElement('script')
if (window._config.isDebug && !/^http/.test(file)) {
script.type = 'module'
@@ -49,9 +51,10 @@ function _script(file, callback) {
script.src = _getScript(file)
- var done = false
+ let done = false
+
// Attach handlers for all browsers
- script.onload = script.onreadystatechange = function() {
+ script.onload = script.onreadystatechange = function () {
if (!done && (!this.readyState ||
this.readyState === 'loaded' || this.readyState === 'complete')) {
done = true
@@ -66,18 +69,19 @@ function _script(file, callback) {
head.appendChild(script)
}
-function _scripts(scripts, callback) {
+function _scripts (scripts, callback) {
if (!scripts.length) {
return callback()
}
- var eachSeries = function (arr, iterator, callback_) {
- var callback = callback_ || function () {}
+ const eachSeries = function (arr, iterator, callback_) {
+ let callback = callback_ || function () {}
+
if (!arr.length) {
return callback()
}
- var completed = 0
- var iterate = function () {
+ let completed = 0
+ const iterate = function () {
iterator(arr[completed], function (err) {
if (err) {
callback(err)
@@ -92,6 +96,7 @@ function _scripts(scripts, callback) {
}
})
}
+
iterate()
}
@@ -100,7 +105,9 @@ function _scripts(scripts, callback) {
})
}
-function _themeUpdate(data) {
+function _themeUpdate (_data) {
+ const data = _data.replace('
', '').replace('', '')
+
if (/bootstrap3.html$/.test(location.pathname)) {
return data.replace(/btn-secondary/g, 'btn-default')
}
@@ -140,19 +147,21 @@ function _themeUpdate(data) {
return data
}
-function _beautifySource(data) {
- var lines = data.split('\n')
- var scriptStart = lines.indexOf('', scriptStart)
- var strings = lines.slice(scriptStart + 1, scriptEnd)
+function _beautifySource (data) {
+ let lines = data.split('\n')
+ const scriptStart = lines.indexOf('', scriptStart)
+ let strings = lines.slice(scriptStart + 1, scriptEnd)
+
strings = $.map(strings, function (s) {
return $.trim(s)
})
/* eslint-disable no-control-regex */
- var obj = eval('(' + strings.join('').replace(/[^\u0000-\u007E]/g, '')
- .replace(/^init\((.*)\)$/, '$1') + ')')
+ const obj = eval(`(${strings.join('').replace(/[^\u0000-\u007E]/g, '')
+ .replace(/^init\((.*)\)$/, '$1')})`)
+
+ let result = []
- var result = []
result = result.concat($.map(obj.links, _getLink))
result.push('')
result = result.concat($.map(obj.scripts, function (script) {
@@ -160,8 +169,9 @@ function _beautifySource(data) {
}))
lines = result.concat(lines.slice(scriptEnd + 1))
- var mountedStart = lines.indexOf(' function mounted() {')
- var mountedEnd = lines.indexOf(' }', mountedStart)
+ const mountedStart = lines.indexOf(' function mounted() {')
+ const mountedEnd = lines.indexOf(' }', mountedStart)
+
lines[mountedStart] = ' $(function() {'
lines[mountedEnd] = ' })'
@@ -169,24 +179,25 @@ function _beautifySource(data) {
}
$(function () {
- var run = function () {
- var query = {}
+ const run = function () {
+ const query = {}
+
location.search.substring(1).split('&').forEach(function (item) {
query[item.split('=')[0]] = item.split('=')[1]
})
- var url = query.url
- var isSource = location.hash.substring(1) === 'view-source'
+ const url = query.url
+ const isSource = location.hash.substring(1) === 'view-source'
delete query.url
$.ajax({
type: 'GET',
- url: url + '?' + $.param(query),
+ url: `${url}?${$.param(query)}`,
dataType: 'html',
global: false,
cache: true, // (warning: setting it to false will cause a timestamp and will call the request twice)
- success: function (_data) {
- var data = _themeUpdate(_data)
+ success (_data) {
+ const data = _themeUpdate(_data)
if (isSource) {
$('#example').hide().html(data)
@@ -197,7 +208,7 @@ $(function () {
$('#example').html(data.replace(/ data-toggle="table"/g, ' data-toggle="bootstrap-table"'))
}
},
- error: function () {
+ error () {
parent.location.href = 'index.html'
}
})
@@ -208,12 +219,12 @@ $(function () {
})
window.init = function (options_) {
- var options = $.extend({
+ const options = $.extend({
title: '',
desc: '',
links: [],
scripts: [],
- callback: function () {
+ callback () {
if ($('[data-toggle="bootstrap-table"]').length) {
$('[data-toggle="bootstrap-table"]').bootstrapTable()
}
@@ -230,7 +241,7 @@ window.init = function (options_) {
$('.bd-title span').html(options.title)
}
if ($('.bd-lead').length) {
- $('.bd-lead').html(marked(options.desc)).find('a').attr('target', '_blank')
+ $('.bd-lead').html(window.marked(options.desc)).find('a').attr('target', '_blank')
}
$.each(options.links, function (i, file) {
_link(file)
diff --git a/column-options/checkbox-disabled.html b/column-options/checkbox-disabled.html
index fbd90900..93102427 100644
--- a/column-options/checkbox-disabled.html
+++ b/column-options/checkbox-disabled.html
@@ -23,7 +23,7 @@
data-field="state"
data-checkbox="true"
data-formatter="stateFormatter"
- />
+ >
ID
|
diff --git a/column-options/checkbox-enabled.html b/column-options/checkbox-enabled.html
index 3160965f..dca09a2e 100644
--- a/column-options/checkbox-enabled.html
+++ b/column-options/checkbox-enabled.html
@@ -19,7 +19,7 @@
|
+ >
Item Name
|
diff --git a/column-options/checkbox.html b/column-options/checkbox.html
index 9857fdd6..7868872e 100644
--- a/column-options/checkbox.html
+++ b/column-options/checkbox.html
@@ -16,7 +16,7 @@
>
- |
+ |
Item Name
|
diff --git a/column-options/click-to-select.html b/column-options/click-to-select.html
index 5bb6ef53..7bd3581a 100644
--- a/column-options/click-to-select.html
+++ b/column-options/click-to-select.html
@@ -20,7 +20,7 @@
|
+ >
ID
|
diff --git a/column-options/natural-sorting.html b/column-options/natural-sorting.html
index 0b14d5a3..d324e159 100644
--- a/column-options/natural-sorting.html
+++ b/column-options/natural-sorting.html
@@ -30,7 +30,7 @@
-
+
-
+
diff --git a/for-tests/extensions/filter-control/filter-control-searchOnEnterKey.html b/for-tests/extensions/filter-control/filter-control-searchOnEnterKey.html
index d99c3596..50e6b399 100644
--- a/for-tests/extensions/filter-control/filter-control-searchOnEnterKey.html
+++ b/for-tests/extensions/filter-control/filter-control-searchOnEnterKey.html
@@ -27,7 +27,7 @@
diff --git a/for-tests/extensions/filter-control/filter-control.html b/for-tests/extensions/filter-control/filter-control.html
index 832e9f8f..e29e93bb 100644
--- a/for-tests/extensions/filter-control/filter-control.html
+++ b/for-tests/extensions/filter-control/filter-control.html
@@ -27,7 +27,7 @@
diff --git a/index.html b/index.html
index c59d232c..76d54a20 100644
--- a/index.html
+++ b/index.html
@@ -26,7 +26,9 @@
@@ -594,7 +596,8 @@
-
+
diff --git a/integrate/angular/app.js b/integrate/angular/app.js
index b85defc4..0cf572b3 100644
--- a/integrate/angular/app.js
+++ b/integrate/angular/app.js
@@ -7,34 +7,36 @@ window.angular.module('app', ['bsTable'])
$scope.workspaces.push({ name: 'Workspace 3' })
function makeRandomRows (colData) {
- var rows = []
- for (var i = 0; i < 500; i++) {
+ const rows = []
+
+ for (let i = 0; i < 500; i++) {
rows.push($.extend({
index: i,
- id: 'row ' + i,
- name: 'GOOG' + i,
- flagImage: Math.random() < 0.4
- ? 'img/blueFlag16.png'
- : Math.random() < 0.75
- ? 'img/yellowFlag16.png'
- : 'img/greenFlag16.png'
+ id: `row ${i}`,
+ name: `GOOG${i}`,
+ flagImage: Math.random() < 0.4 ?
+ 'img/blueFlag16.png' :
+ Math.random() < 0.75 ?
+ 'img/yellowFlag16.png' :
+ 'img/greenFlag16.png'
}, colData))
}
return rows
}
- function flagFormatter(value, row, index) {
- return ''
+ function flagFormatter (value, row, index) {
+ return ``
}
- $scope.workspaces.forEach(function (wk,index) {
- var colData = {workspace: wk.name}
+ $scope.workspaces.forEach(function (wk, index) {
+ const colData = { workspace: wk.name }
+
wk.rows = makeRandomRows(colData)
wk.bsTableControl = {
options: {
data: wk.rows,
- rowStyle: function (row, index) {
+ rowStyle (row, index) {
return { classes: 'none' }
},
cache: false,
diff --git a/integrate/angular/index.html b/integrate/angular/index.html
index 70f3c42a..4f15c296 100644
--- a/integrate/angular/index.html
+++ b/integrate/angular/index.html
@@ -2,13 +2,13 @@
-
+
Angular Demo
-
+
- {{wk.name}}
diff --git a/issues/1167.html b/issues/1167.html
index 4f56f0f9..288ed1df 100644
--- a/issues/1167.html
+++ b/issues/1167.html
@@ -1,32 +1,54 @@
-
-
-
-
-
-
-
- |
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+
+
+
+ |
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-Method: Get
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+ Method: Get
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
-Method: Post
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+ Method: Post
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
+
+
+
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
-
-
-
- |
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+
+
+ |
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
+
+
+
+
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+ Item Column1
+ |
+
+ Item Column2
+ |
+
+ Item Column3
+ |
+
+ Item Column4
+ |
+
+
+
+
+
-
-
-
-
- |
- Item Name |
- Item Price |
- Item Column1 |
- Item Column2 |
- Item Column3 |
- Item Column4 |
-
-
-
diff --git a/issues/2619.html b/issues/2619.html
index 7dcb32a3..b4e1b6c4 100644
--- a/issues/2619.html
+++ b/issues/2619.html
@@ -1,46 +1,60 @@
-
-
-
- |
- Name |
- Label |
- Link |
-
-
-
-
- |
- test0 |
- label0 |
- Link |
-
-
- |
- test1 |
- label1 |
- Link |
-
-
- |
- test2 |
- label2 |
- Link |
-
-
-
+
+
+
+
+ |
+
+ Name
+ |
+
+ Label
+ |
+ Link |
+
+
+
+
+ |
+ test0 |
+ label0 |
+ Link |
+
+
+ |
+ test1 |
+ label1 |
+ Link |
+
+
+ |
+ test2 |
+ label2 |
+ Link |
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/issues/3345.html b/issues/3345.html
index 656f86ab..3dd59cc2 100644
--- a/issues/3345.html
+++ b/issues/3345.html
@@ -1,35 +1,57 @@
-
-
-
-
-
-
-
- |
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+
+
+
+ |
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
+
+
+
-
-
-
-
-
- |
- ID |
- Item Name |
- Item Price |
-
-
-
-
+
+
+
+
+
+ |
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
+
+
diff --git a/issues/383.html b/issues/383.html
index 5ae4f3c9..34acba16 100644
--- a/issues/383.html
+++ b/issues/383.html
@@ -1,18 +1,60 @@
+
+
+
+
+
+
+ |
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
+
-
-
-
-
- |
- ID |
- Item Name |
- Item Price |
-
-
-
-
-
diff --git a/issues/3830.html b/issues/3830.html
index ac834bc9..3b88ffb4 100644
--- a/issues/3830.html
+++ b/issues/3830.html
@@ -1,34 +1,43 @@
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
-
- ID |
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+
+ ID
+ |
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
diff --git a/issues/409.html b/issues/409.html
index 7d4a9a41..08043524 100644
--- a/issues/409.html
+++ b/issues/409.html
@@ -1,27 +1,42 @@
-
-
-
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
-
- |
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ |
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
+
+
+
+
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
- Index |
- Item Name |
-
-
-
+
+
+
+
+
+ Index
+ |
+
+ Item Name
+ |
+
+
+
+
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
diff --git a/issues/431.html b/issues/431.html
index 77b9e10d..877e1b5c 100644
--- a/issues/431.html
+++ b/issues/431.html
@@ -1,25 +1,34 @@
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/issues/563.html b/issues/563.html
index 5d06dc95..539db587 100644
--- a/issues/563.html
+++ b/issues/563.html
@@ -1,34 +1,12 @@
-
-
-
-
-
- Item Name |
- Item Price |
-
-
-
-
+
+
+
+
+
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
+
+
diff --git a/issues/579.html b/issues/579.html
index fc2adf05..3460a7d5 100644
--- a/issues/579.html
+++ b/issues/579.html
@@ -1,27 +1,42 @@
-
-
-
- Image |
- Name |
- Action |
-
-
-
+
+
+
+
+
+ Image
+ |
+
+ Name
+ |
+
+ Action
+ |
+
+
+
+
-
-
-
-
+
+
+
+
+
+
diff --git a/issues/917.html b/issues/917.html
index c9c97922..b358421a 100644
--- a/issues/917.html
+++ b/issues/917.html
@@ -1,31 +1,43 @@
-
-
-
- |
- ID |
- Item Name |
- Item Price |
-
-
-
+
+
+
+
+ |
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+
+
+
-
+
+
+
-
-
-
- ID |
- Item Name |
- Item Price |
- Selling |
-
-
-
+
+
+
+
+
+ ID
+ |
+
+ Item Name
+ |
+
+ Item Price
+ |
+
+ Selling
+ |
+
+
+
+
diff --git a/template-bootstrap3.html b/template-bootstrap3.html
index b8f03f8a..c85d6b34 100644
--- a/template-bootstrap3.html
+++ b/template-bootstrap3.html
@@ -29,7 +29,9 @@
diff --git a/template-bootstrap4.html b/template-bootstrap4.html
index 782dc08a..ae2a31b0 100644
--- a/template-bootstrap4.html
+++ b/template-bootstrap4.html
@@ -28,7 +28,9 @@
diff --git a/template-bulma.html b/template-bulma.html
index 8547b8fc..827cb03c 100644
--- a/template-bulma.html
+++ b/template-bulma.html
@@ -27,7 +27,9 @@
diff --git a/template-foundation.html b/template-foundation.html
index d2b85cff..a2b0ad3d 100644
--- a/template-foundation.html
+++ b/template-foundation.html
@@ -28,7 +28,9 @@
diff --git a/template-materialize.html b/template-materialize.html
index cfd5c83d..4b62fef8 100644
--- a/template-materialize.html
+++ b/template-materialize.html
@@ -35,7 +35,9 @@
diff --git a/template-semantic.html b/template-semantic.html
index dc90cd42..c163307b 100644
--- a/template-semantic.html
+++ b/template-semantic.html
@@ -28,7 +28,9 @@
diff --git a/template.html b/template.html
index 3cb22763..db0daf1a 100644
--- a/template.html
+++ b/template.html
@@ -47,7 +47,9 @@
diff --git a/tools/lint.sh b/tools/lint.sh
new file mode 100755
index 00000000..a1b8aa7c
--- /dev/null
+++ b/tools/lint.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+FOLDERS=("column-options" "extensions" "issues" "methods" "options" "welcomes")
+
+# 检查传入参数
+if [[ $# -eq 0 ]]; then
+ echo "Usage: $0 [--pre | --post]"
+ exit 1
+fi
+
+# 遍历文件夹并处理文件扩展名
+process_files() {
+ local extension_from=$1
+ local extension_to=$2
+
+ for folder in "${FOLDERS[@]}"; do
+ if [[ -d $folder ]]; then
+ for file in "$folder"/*.$extension_from; do
+ if [[ -f $file ]]; then
+ mv "$file" "${file%.$extension_from}.$extension_to"
+ fi
+ done
+ else
+ echo "Warning: $folder does not exist."
+ fi
+ done
+}
+
+# 根据参数执行对应操作
+case $1 in
+ --pre)
+ process_files "html" "vue"
+ ;;
+ --post)
+ process_files "vue" "html"
+ ;;
+ *)
+ echo "Invalid option: $1. Use --pre or --post."
+ exit 1
+ ;;
+esac
diff --git a/tools/template.js b/tools/template.js
index e366a399..576d72b4 100644
--- a/tools/template.js
+++ b/tools/template.js
@@ -16,7 +16,7 @@ const options = getopts(process.argv.slice(2), {
}
})
-function showHelp() {
+function showHelp () {
const baseCmd = 'node tools/template.js'
console.info(`usage:
@@ -34,7 +34,7 @@ function showHelp() {
`)
}
-function run() {
+function run () {
if (options.help || Object.keys(options).length === 1) {
return showHelp()
}
@@ -50,12 +50,14 @@ function run() {
let url = CLIENT_URL
let attrs = ''
+
if (options.server) {
url = SERVER_URL
attrs = '\n data-pagination="true"\n data-side-pagination="server"'
}
let content = fs.readFileSync(`${__dirname}/example.tpl`).toString()
+
content = content.replace(/@title@/, options.title || '')
.replace(/@desc@/, options.desc || '')
.replace(/@url@/, url)
diff --git a/utils/natural-sorting/src/natural-sorting.js b/utils/natural-sorting/src/natural-sorting.js
index fb289ec9..1664bfc8 100644
--- a/utils/natural-sorting/src/natural-sorting.js
+++ b/utils/natural-sorting/src/natural-sorting.js
@@ -5,6 +5,7 @@
* add data-sorter="alphanum" or data-sorter="numericOnly" to any th
*/
+// eslint-disable-next-line no-unused-vars
function alphanum (a, b) {
function chunkify (t) {
const tz = []
@@ -14,7 +15,8 @@ function alphanum (a, b) {
for (let i = 0; i <= t.length; i++) {
const char = t.charAt(i)
const charCode = char.charCodeAt(0)
- const m = (charCode === 46 || (charCode >= 48 && charCode <= 57))
+ const m = charCode === 46 || charCode >= 48 && charCode <= 57
+
if (m !== n) {
tz[++y] = ''
n = m
@@ -26,7 +28,7 @@ function alphanum (a, b) {
}
function stringfy (v) {
- if (typeof(v) === 'number') {
+ if (typeof v === 'number') {
v = `${v}`
}
if (!v) {
@@ -46,13 +48,14 @@ function alphanum (a, b) {
if (c === aa[x] && d === bb[x]) {
return c - d
}
- return (aa[x] > bb[x]) ? 1 : -1
+ return aa[x] > bb[x] ? 1 : -1
}
}
return aa.length - bb.length
}
+// eslint-disable-next-line no-unused-vars
function numericOnly (a, b) {
function stripNonNumber (s) {
s = s.replace(/^(-)|[.,](?=[^.,]*[.,](?!$))|[,.]+$|[^0-9.,]+/g, '$1')
diff --git a/welcome.html b/welcome.html
index 3cfc35c9..b7f77527 100644
--- a/welcome.html
+++ b/welcome.html
@@ -106,32 +106,33 @@
+ data-url="json/data3.json"
+>
Name |
diff --git a/welcomes/from-data.html b/welcomes/from-data.html
index c5527bbb..a9445d68 100644
--- a/welcomes/from-data.html
+++ b/welcomes/from-data.html
@@ -1,10 +1,10 @@
diff --git a/welcomes/from-html.html b/welcomes/from-html.html
index c2977678..a63c3442 100644
--- a/welcomes/from-html.html
+++ b/welcomes/from-html.html
@@ -1,16 +1,17 @@
+ data-show-columns="true"
+>
Name |
diff --git a/welcomes/from-url.html b/welcomes/from-url.html
index a64eb58b..64566c88 100644
--- a/welcomes/from-url.html
+++ b/welcomes/from-url.html
@@ -1,16 +1,17 @@
+ data-url="json/data1.json"
+>
ID |
diff --git a/welcomes/group-columns.html b/welcomes/group-columns.html
index 6c378d85..6125c8c8 100644
--- a/welcomes/group-columns.html
+++ b/welcomes/group-columns.html
@@ -1,10 +1,10 @@
+ data-url="json/data1.json"
+>
Item Detail |
diff --git a/welcomes/large-data.html b/welcomes/large-data.html
index 7ecdc7b8..59555879 100644
--- a/welcomes/large-data.html
+++ b/welcomes/large-data.html
@@ -1,10 +1,10 @@