升级bootstrap-table到最新版本1.19.1

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

View File

@ -225,6 +225,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
const initFixedBody = ($fixedColumns, $fixedHeader) => { const initFixedBody = ($fixedColumns, $fixedHeader) => {
$fixedColumns.find('.fixed-table-body').remove() $fixedColumns.find('.fixed-table-body').remove()
$fixedColumns.append(this.$tableBody.clone(true)) $fixedColumns.append(this.$tableBody.clone(true))
$fixedColumns.find('.fixed-table-body table').removeAttr('id')
const $fixedBody = $fixedColumns.find('.fixed-table-body') 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 var Utils = $.fn.bootstrapTable.utils

View File

@ -43,6 +43,7 @@ $.extend($.fn.bootstrapTable.columnDefaults, {
$.extend($.fn.bootstrapTable.defaults.icons, { $.extend($.fn.bootstrapTable.defaults.icons, {
export: { export: {
bootstrap3: 'glyphicon-export icon-share', bootstrap3: 'glyphicon-export icon-share',
bootstrap5: 'bi-download',
materialize: 'file_download', materialize: 'file_download',
'bootstrap-table': 'icon-download' 'bootstrap-table': 'icon-download'
}[$.fn.bootstrapTable.theme] || 'fa-download' }[$.fn.bootstrapTable.theme] || 'fa-download'
@ -91,7 +92,10 @@ $.BootstrapTable = class extends $.BootstrapTable {
this.buttons = Object.assign(this.buttons, { this.buttons = Object.assign(this.buttons, {
export: { export: {
html: exportTypes.length === 1 ? ` html:
(() => {
if (exportTypes.length === 1) {
return `
<div class="export ${this.constants.classes.buttonsDropdown}" <div class="export ${this.constants.classes.buttonsDropdown}"
data-type="${exportTypes[0]}"> data-type="${exportTypes[0]}">
<button class="${this.constants.buttonsClass}" <button class="${this.constants.buttonsClass}"
@ -102,7 +106,12 @@ $.BootstrapTable = class extends $.BootstrapTable {
${o.showButtonText ? o.formatExport() : ''} ${o.showButtonText ? o.formatExport() : ''}
</button> </button>
</div> </div>
` : ` `
}
const html = []
html.push(`
<div class="export ${this.constants.classes.buttonsDropdown}"> <div class="export ${this.constants.classes.buttonsDropdown}">
<button class="${this.constants.buttonsClass} dropdown-toggle" <button class="${this.constants.buttonsClass} dropdown-toggle"
aria-label="Export" aria-label="Export"
@ -113,8 +122,21 @@ $.BootstrapTable = class extends $.BootstrapTable {
${o.showButtonText ? o.formatExport() : ''} ${o.showButtonText ? o.formatExport() : ''}
${this.constants.html.dropdownCaret} ${this.constants.html.dropdownCaret}
</button> </button>
</div> ${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 return
} }
let $menu = $(this.constants.html.toolbarDropdown.join(''))
let $items = this.$export
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()
}
this.updateExportButton() this.updateExportButton()
let $exportButtons = this.$export.find('[data-type]')
$items.click(e => { if (exportTypes.length === 1) {
$exportButtons = this.$export.find('button')
}
$exportButtons.click(e => {
e.preventDefault() e.preventDefault()
const type = $(e.currentTarget).data('type') const type = $(e.currentTarget).data('type')

View File

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

View File

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

View File

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