升级bootstrap-table到最新版本1.19.1

pull/294/MERGE
RuoYi 2022-02-21 09:06:55 +08:00
parent 248fe926c5
commit 6bd0dc8e05
9 changed files with 66 additions and 55 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,6 +8,7 @@ var Utils = $.fn.bootstrapTable.utils
$.extend($.fn.bootstrapTable.defaults, {
autoRefresh: false,
showAutoRefresh: true,
autoRefreshInterval: 60,
autoRefreshSilent: true,
autoRefreshStatus: true,
@ -17,6 +18,7 @@ $.extend($.fn.bootstrapTable.defaults, {
$.extend($.fn.bootstrapTable.defaults.icons, {
autoRefresh: {
bootstrap3: 'glyphicon-time icon-time',
bootstrap5: 'bi-clock',
materialize: 'access_time',
'bootstrap-table': 'icon-clock'
}[$.fn.bootstrapTable.theme] || 'fa-clock'

View File

@ -225,6 +225,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
const initFixedBody = ($fixedColumns, $fixedHeader) => {
$fixedColumns.find('.fixed-table-body').remove()
$fixedColumns.append(this.$tableBody.clone(true))
$fixedColumns.find('.fixed-table-body table').removeAttr('id')
const $fixedBody = $fixedColumns.find('.fixed-table-body')

View File

@ -1,5 +1,6 @@
/**
* @author zhixin wen <wenzhixin2010@gmail.com>
* @author: Dustin Utecht
* @github: https://github.com/UtechtDustin
*/
var Utils = $.fn.bootstrapTable.utils
@ -105,4 +106,4 @@ $.BootstrapTable = class extends $.BootstrapTable {
this.showCustomView = !this.showCustomView
this.initBody()
}
}
}

View File

@ -43,6 +43,7 @@ $.extend($.fn.bootstrapTable.columnDefaults, {
$.extend($.fn.bootstrapTable.defaults.icons, {
export: {
bootstrap3: 'glyphicon-export icon-share',
bootstrap5: 'bi-download',
materialize: 'file_download',
'bootstrap-table': 'icon-download'
}[$.fn.bootstrapTable.theme] || 'fa-download'
@ -91,30 +92,51 @@ $.BootstrapTable = class extends $.BootstrapTable {
this.buttons = Object.assign(this.buttons, {
export: {
html: exportTypes.length === 1 ? `
<div class="export ${this.constants.classes.buttonsDropdown}"
data-type="${exportTypes[0]}">
<button class="${this.constants.buttonsClass}"
aria-label="Export"
type="button"
title="${o.formatExport()}">
${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''}
${o.showButtonText ? o.formatExport() : ''}
</button>
</div>
` : `
<div class="export ${this.constants.classes.buttonsDropdown}">
<button class="${this.constants.buttonsClass} dropdown-toggle"
aria-label="Export"
${this.constants.dataToggle}="dropdown"
type="button"
title="${o.formatExport()}">
${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''}
${o.showButtonText ? o.formatExport() : ''}
${this.constants.html.dropdownCaret}
</button>
</div>
`
html:
(() => {
if (exportTypes.length === 1) {
return `
<div class="export ${this.constants.classes.buttonsDropdown}"
data-type="${exportTypes[0]}">
<button class="${this.constants.buttonsClass}"
aria-label="Export"
type="button"
title="${o.formatExport()}">
${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''}
${o.showButtonText ? o.formatExport() : ''}
</button>
</div>
`
}
const html = []
html.push(`
<div class="export ${this.constants.classes.buttonsDropdown}">
<button class="${this.constants.buttonsClass} dropdown-toggle"
aria-label="Export"
${this.constants.dataToggle}="dropdown"
type="button"
title="${o.formatExport()}">
${o.showButtonIcons ? Utils.sprintf(this.constants.html.icon, o.iconsPrefix, o.icons.export) : ''}
${o.showButtonText ? o.formatExport() : ''}
${this.constants.html.dropdownCaret}
</button>
${this.constants.html.toolbarDropdown[0]}
`)
for (const type of exportTypes) {
if (TYPE_NAME.hasOwnProperty(type)) {
const $item = $(Utils.sprintf(this.constants.html.pageDropdownItem, '', TYPE_NAME[type]))
$item.attr('data-type', type)
html.push($item.prop('outerHTML'))
}
}
html.push(this.constants.html.toolbarDropdown[1], '</div>')
return html.join('')
})
}
})
}
@ -126,32 +148,14 @@ $.BootstrapTable = class extends $.BootstrapTable {
return
}
let $menu = $(this.constants.html.toolbarDropdown.join(''))
let $items = this.$export
this.updateExportButton()
let $exportButtons = this.$export.find('[data-type]')
if (exportTypes.length > 1) {
this.$export.append($menu)
// themes support
if ($menu.children().length) {
$menu = $menu.children().eq(0)
}
for (const type of exportTypes) {
if (TYPE_NAME.hasOwnProperty(type)) {
const $item = $(Utils.sprintf(this.constants.html.pageDropdownItem,
'', TYPE_NAME[type]))
$item.attr('data-type', type)
$menu.append($item)
}
}
$items = $menu.children()
if (exportTypes.length === 1) {
$exportButtons = this.$export.find('button')
}
this.updateExportButton()
$items.click(e => {
$exportButtons.click(e => {
e.preventDefault()
const type = $(e.currentTarget).data('type')

View File

@ -134,7 +134,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
doPrint (data) {
const formatValue = (row, i, column) => {
const value = Utils.calculateObjectValue(column, column.printFormatter,
const value = Utils.calculateObjectValue(column,
column.printFormatter || column.formatter,
[row[column.field], row, i], row[column.field])
return typeof value === 'undefined' || value === null ?

View File

@ -13,7 +13,7 @@ $.extend($.fn.bootstrapTable.defaults, {
onDragStyle: null,
onDropStyle: null,
onDragClass: 'reorder_rows_onDragClass',
dragHandle: '>tbody>tr>td',
dragHandle: '>tbody>tr>td:not(.bs-checkbox)',
useRowAttrFunc: false,
// eslint-disable-next-line no-unused-vars
onReorderRowsDrag (row) {

View File

@ -43,6 +43,8 @@ $.BootstrapTable = class extends $.BootstrapTable {
.on('column-switch.bs.table page-change.bs.table', () => {
reInitResizable(this)
})
reInitResizable(this)
}
toggleView (...args) {