|
|
@@ -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)
|
|
|
}
|
|
|
}
|