mirror of https://gitee.com/y_project/RuoYi.git
升级bootstrap-table到最新版本1.24.1
parent
723d8d50cb
commit
93f9e0048c
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -6,7 +6,7 @@
|
|||
|
||||
var Utils = $.fn.bootstrapTable.utils
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
Object.assign($.fn.bootstrapTable.defaults, {
|
||||
autoRefresh: false,
|
||||
showAutoRefresh: true,
|
||||
autoRefreshInterval: 60,
|
||||
|
@ -15,22 +15,21 @@ $.extend($.fn.bootstrapTable.defaults, {
|
|||
autoRefreshFunction: null
|
||||
})
|
||||
|
||||
$.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'
|
||||
Utils.assignIcons($.fn.bootstrapTable.icons, 'autoRefresh', {
|
||||
glyphicon: 'glyphicon-time icon-time',
|
||||
fa: 'fa-clock',
|
||||
bi: 'bi-clock',
|
||||
icon: 'icon-clock',
|
||||
'material-icons': 'access_time'
|
||||
})
|
||||
|
||||
$.extend($.fn.bootstrapTable.locales, {
|
||||
Object.assign($.fn.bootstrapTable.locales, {
|
||||
formatAutoRefresh () {
|
||||
return 'Auto Refresh'
|
||||
}
|
||||
})
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales)
|
||||
Object.assign($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales)
|
||||
|
||||
$.BootstrapTable = class extends $.BootstrapTable {
|
||||
init (...args) {
|
||||
|
@ -45,15 +44,14 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
if (this.options.autoRefresh) {
|
||||
this.buttons = Object.assign(this.buttons, {
|
||||
autoRefresh: {
|
||||
html: `
|
||||
<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() : ''}
|
||||
</button>
|
||||
`,
|
||||
event: this.toggleAutoRefresh
|
||||
text: this.options.formatAutoRefresh(),
|
||||
icon: this.options.icons.autoRefresh,
|
||||
render: false,
|
||||
event: this.toggleAutoRefresh,
|
||||
attributes: {
|
||||
'aria-label': this.options.formatAutoRefresh(),
|
||||
title: this.options.formatAutoRefresh()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,6 +11,7 @@ var UtilsCookie = {
|
|||
pageNumber: 'bs.table.pageNumber',
|
||||
pageList: 'bs.table.pageList',
|
||||
hiddenColumns: 'bs.table.hiddenColumns',
|
||||
columns: 'bs.table.columns',
|
||||
cardView: 'bs.table.cardView',
|
||||
customView: 'bs.table.customView',
|
||||
searchText: 'bs.table.searchText',
|
||||
|
@ -28,6 +29,9 @@ var UtilsCookie = {
|
|||
return navigator.cookieEnabled
|
||||
},
|
||||
isCookieEnabled (that, cookieName) {
|
||||
if (cookieName === 'bs.table.columns') {
|
||||
return that.options.cookiesEnabled.includes('bs.table.hiddenColumns')
|
||||
}
|
||||
return that.options.cookiesEnabled.includes(cookieName)
|
||||
},
|
||||
setCookie (that, cookieName, cookieValue) {
|
||||
|
@ -228,6 +232,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
try {
|
||||
filterByCookie = JSON.parse(filterByCookieValue)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
throw new Error('Could not parse the json of the filterBy cookie!')
|
||||
}
|
||||
this.filterColumns = filterByCookie ? filterByCookie : {}
|
||||
|
@ -242,27 +247,25 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
this.options.cookiesEnabled
|
||||
|
||||
if (this.options.filterControl) {
|
||||
const that = this
|
||||
|
||||
this.$el.on('column-search.bs.table', (e, field, text) => {
|
||||
let isNewField = true
|
||||
|
||||
for (let i = 0; i < that._filterControls.length; i++) {
|
||||
if (that._filterControls[i].field === field) {
|
||||
that._filterControls[i].text = text
|
||||
for (let i = 0; i < this._filterControls.length; i++) {
|
||||
if (this._filterControls[i].field === field) {
|
||||
this._filterControls[i].text = text
|
||||
isNewField = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if (isNewField) {
|
||||
that._filterControls.push({
|
||||
this._filterControls.push({
|
||||
field,
|
||||
text
|
||||
})
|
||||
}
|
||||
|
||||
UtilsCookie.setCookie(that, UtilsCookie.cookieIds.filterControl, JSON.stringify(that._filterControls))
|
||||
}).on('created-controls.bs.table', UtilsCookie.initCookieFilters(that))
|
||||
UtilsCookie.setCookie(this, UtilsCookie.cookieIds.filterControl, JSON.stringify(this._filterControls))
|
||||
}).on('created-controls.bs.table', UtilsCookie.initCookieFilters(this))
|
||||
}
|
||||
}
|
||||
super.init()
|
||||
|
@ -365,7 +368,10 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
if (!this.options.cookie) {
|
||||
return
|
||||
}
|
||||
UtilsCookie.setCookie(this, UtilsCookie.cookieIds.hiddenColumns, JSON.stringify(this.getHiddenColumns().map(column => column.field)))
|
||||
UtilsCookie.setCookie(this, UtilsCookie.cookieIds.hiddenColumns,
|
||||
JSON.stringify(this.getHiddenColumns().map(column => column.field)))
|
||||
UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns,
|
||||
JSON.stringify(this.columns.map(column => column.field)))
|
||||
}
|
||||
|
||||
_toggleAllColumns (...args) {
|
||||
|
@ -373,7 +379,10 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
if (!this.options.cookie) {
|
||||
return
|
||||
}
|
||||
UtilsCookie.setCookie(this, UtilsCookie.cookieIds.hiddenColumns, JSON.stringify(this.getHiddenColumns().map(column => column.field)))
|
||||
UtilsCookie.setCookie(this, UtilsCookie.cookieIds.hiddenColumns,
|
||||
JSON.stringify(this.getHiddenColumns().map(column => column.field)))
|
||||
UtilsCookie.setCookie(this, UtilsCookie.cookieIds.columns,
|
||||
JSON.stringify(this.columns.map(column => column.field)))
|
||||
}
|
||||
|
||||
toggleView () {
|
||||
|
@ -444,18 +453,23 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
const cardViewCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.cardView)
|
||||
const customViewCookie = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.customView)
|
||||
const hiddenColumnsCookieValue = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.hiddenColumns)
|
||||
const columnsCookieValue = UtilsCookie.getCookie(this, UtilsCookie.cookieIds.columns)
|
||||
|
||||
let hiddenColumnsCookie = {}
|
||||
let columnsCookie = {}
|
||||
|
||||
try {
|
||||
hiddenColumnsCookie = JSON.parse(hiddenColumnsCookieValue)
|
||||
columnsCookie = JSON.parse(columnsCookieValue)
|
||||
} catch (e) {
|
||||
throw new Error('Could not parse the json of the hidden columns cookie!', hiddenColumnsCookieValue)
|
||||
console.error(e)
|
||||
throw new Error('Could not parse the json of the columns cookie!')
|
||||
}
|
||||
|
||||
try {
|
||||
sortPriorityCookie = JSON.parse(sortPriorityCookie)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
throw new Error('Could not parse the json of the sortPriority cookie!', sortPriorityCookie)
|
||||
}
|
||||
|
||||
|
@ -493,8 +507,13 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
this.customViewDefaultView = customViewCookie === 'true'
|
||||
|
||||
if (hiddenColumnsCookie) {
|
||||
columnsCookie = columnsCookie || this.columns.map(column => column.field)
|
||||
|
||||
for (const column of this.columns) {
|
||||
if (!column.switchable) {
|
||||
if (
|
||||
!column.switchable ||
|
||||
!columnsCookie.includes(column.field)
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -505,12 +524,11 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
}
|
||||
|
||||
getCookies () {
|
||||
const bootstrapTable = this
|
||||
const cookies = {}
|
||||
|
||||
for (const [key, value] of Object.entries(UtilsCookie.cookieIds)) {
|
||||
cookies[key] = UtilsCookie.getCookie(bootstrapTable, value)
|
||||
if (key === 'columns' || key === 'hiddenColumns' || key === 'sortPriority') {
|
||||
cookies[key] = UtilsCookie.getCookie(this, value)
|
||||
if (['columns', 'hiddenColumns', 'sortPriority'].includes(key)) {
|
||||
cookies[key] = JSON.parse(cookies[key])
|
||||
}
|
||||
}
|
||||
|
@ -518,7 +536,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
}
|
||||
|
||||
deleteCookie (cookieName) {
|
||||
if (!cookieName) {
|
||||
if (!cookieName || !this.options.cookie) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -526,56 +544,50 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
}
|
||||
|
||||
configureStorage () {
|
||||
const that = this
|
||||
|
||||
this._storage = {}
|
||||
switch (this.options.cookieStorage) {
|
||||
case 'cookieStorage':
|
||||
this._storage.setItem = function (cookieName, cookieValue) {
|
||||
this._storage.setItem = (cookieName, cookieValue) => {
|
||||
document.cookie = [
|
||||
cookieName, '=', encodeURIComponent(cookieValue),
|
||||
`; expires=${UtilsCookie.calculateExpiration(that.options.cookieExpire)}`,
|
||||
that.options.cookiePath ? `; path=${that.options.cookiePath}` : '',
|
||||
that.options.cookieDomain ? `; domain=${that.options.cookieDomain}` : '',
|
||||
that.options.cookieSecure ? '; secure' : '',
|
||||
`;SameSite=${that.options.cookieSameSite}`
|
||||
`; expires=${UtilsCookie.calculateExpiration(this.options.cookieExpire)}`,
|
||||
this.options.cookiePath ? `; path=${this.options.cookiePath}` : '',
|
||||
this.options.cookieDomain ? `; domain=${this.options.cookieDomain}` : '',
|
||||
this.options.cookieSecure ? '; secure' : '',
|
||||
`;SameSite=${this.options.cookieSameSite}`
|
||||
].join('')
|
||||
}
|
||||
this._storage.getItem = function (cookieName) {
|
||||
this._storage.getItem = cookieName => {
|
||||
const value = `; ${document.cookie}`
|
||||
const parts = value.split(`; ${cookieName}=`)
|
||||
|
||||
return parts.length === 2 ? decodeURIComponent(parts.pop().split(';').shift()) : null
|
||||
}
|
||||
this._storage.removeItem = function (cookieName) {
|
||||
this._storage.removeItem = cookieName => {
|
||||
document.cookie = [
|
||||
encodeURIComponent(cookieName), '=',
|
||||
'; 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}`
|
||||
this.options.cookiePath ? `; path=${this.options.cookiePath}` : '',
|
||||
this.options.cookieDomain ? `; domain=${this.options.cookieDomain}` : '',
|
||||
`;SameSite=${this.options.cookieSameSite}`
|
||||
].join('')
|
||||
}
|
||||
break
|
||||
case 'localStorage':
|
||||
this._storage.setItem = function (cookieName, cookieValue) {
|
||||
this._storage.setItem = (cookieName, cookieValue) => {
|
||||
localStorage.setItem(cookieName, cookieValue)
|
||||
}
|
||||
this._storage.getItem = function (cookieName) {
|
||||
return localStorage.getItem(cookieName)
|
||||
}
|
||||
this._storage.removeItem = function (cookieName) {
|
||||
this._storage.getItem = cookieName => localStorage.getItem(cookieName)
|
||||
this._storage.removeItem = cookieName => {
|
||||
localStorage.removeItem(cookieName)
|
||||
}
|
||||
break
|
||||
case 'sessionStorage':
|
||||
this._storage.setItem = function (cookieName, cookieValue) {
|
||||
this._storage.setItem = (cookieName, cookieValue) => {
|
||||
sessionStorage.setItem(cookieName, cookieValue)
|
||||
}
|
||||
this._storage.getItem = function (cookieName) {
|
||||
return sessionStorage.getItem(cookieName)
|
||||
}
|
||||
this._storage.removeItem = function (cookieName) {
|
||||
this._storage.getItem = cookieName => sessionStorage.getItem(cookieName)
|
||||
this._storage.removeItem = cookieName => {
|
||||
sessionStorage.removeItem(cookieName)
|
||||
}
|
||||
break
|
||||
|
@ -588,19 +600,16 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
throw new Error('The following options must be set while using the customStorage: cookieCustomStorageSet, cookieCustomStorageGet and cookieCustomStorageDelete')
|
||||
}
|
||||
|
||||
this._storage.setItem = function (cookieName, cookieValue) {
|
||||
Utils.calculateObjectValue(that.options, that.options.cookieCustomStorageSet, [cookieName, cookieValue], '')
|
||||
this._storage.setItem = (cookieName, cookieValue) => {
|
||||
Utils.calculateObjectValue(this.options, this.options.cookieCustomStorageSet, [cookieName, cookieValue], '')
|
||||
}
|
||||
this._storage.getItem = function (cookieName) {
|
||||
return Utils.calculateObjectValue(that.options, that.options.cookieCustomStorageGet, [cookieName], '')
|
||||
this._storage.getItem = cookieName => Utils.calculateObjectValue(this.options, this.options.cookieCustomStorageGet, [cookieName], '')
|
||||
this._storage.removeItem = cookieName => {
|
||||
Utils.calculateObjectValue(this.options, this.options.cookieCustomStorageDelete, [cookieName], '')
|
||||
}
|
||||
this._storage.removeItem = function (cookieName) {
|
||||
Utils.calculateObjectValue(that.options, that.options.cookieCustomStorageDelete, [cookieName], '')
|
||||
}
|
||||
|
||||
break
|
||||
default:
|
||||
throw new Error('Storage method not supported.')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,25 +11,20 @@ Object.assign($.fn.bootstrapTable.defaults, {
|
|||
customViewDefaultView: false
|
||||
})
|
||||
|
||||
Object.assign($.fn.bootstrapTable.defaults.icons, {
|
||||
customViewOn: {
|
||||
bootstrap3: 'glyphicon glyphicon-list',
|
||||
bootstrap5: 'bi-list',
|
||||
bootstrap4: 'fa fa-list',
|
||||
semantic: 'fa fa-list',
|
||||
foundation: 'fa fa-list',
|
||||
bulma: 'fa fa-list',
|
||||
materialize: 'list'
|
||||
}[$.fn.bootstrapTable.theme] || 'fa-list',
|
||||
customViewOff: {
|
||||
bootstrap3: 'glyphicon glyphicon-eye-open',
|
||||
bootstrap5: 'bi-grid',
|
||||
bootstrap4: 'fa fa-th',
|
||||
semantic: 'fa fa-th',
|
||||
foundation: 'fa fa-th',
|
||||
bulma: 'fa fa-th',
|
||||
materialize: 'grid_on'
|
||||
}[$.fn.bootstrapTable.theme] || 'fa-th'
|
||||
Utils.assignIcons($.fn.bootstrapTable.icons, 'customViewOn', {
|
||||
glyphicon: 'glyphicon-list',
|
||||
fa: 'fa-list',
|
||||
bi: 'bi-list',
|
||||
icon: 'list',
|
||||
'material-icons': 'list'
|
||||
})
|
||||
|
||||
Utils.assignIcons($.fn.bootstrapTable.icons, 'customViewOff', {
|
||||
glyphicon: 'glyphicon-thumbnails',
|
||||
fa: 'fa-th',
|
||||
bi: 'bi-grid',
|
||||
icon: 'grid_on',
|
||||
'material-icons': 'grid_on'
|
||||
})
|
||||
|
||||
Object.assign($.fn.bootstrapTable.defaults, {
|
||||
|
@ -132,4 +127,4 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
this.initBody()
|
||||
this.trigger('toggle-custom-view', this.customViewDefaultView)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint-disable no-unused-vars */
|
||||
/**
|
||||
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||
* extensions: https://github.com/vitalets/x-editable
|
||||
|
@ -6,7 +5,7 @@
|
|||
|
||||
var Utils = $.fn.bootstrapTable.utils
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
Object.assign($.fn.bootstrapTable.defaults, {
|
||||
editable: true,
|
||||
onEditableInit () {
|
||||
return false
|
||||
|
@ -22,11 +21,11 @@ $.extend($.fn.bootstrapTable.defaults, {
|
|||
}
|
||||
})
|
||||
|
||||
$.extend($.fn.bootstrapTable.columnDefaults, {
|
||||
Object.assign($.fn.bootstrapTable.columnDefaults, {
|
||||
alwaysUseFormatter: false
|
||||
})
|
||||
|
||||
$.extend($.fn.bootstrapTable.events, {
|
||||
Object.assign($.fn.bootstrapTable.events, {
|
||||
'editable-init.bs.table': 'onEditableInit',
|
||||
'editable-save.bs.table': 'onEditableSave',
|
||||
'editable-shown.bs.table': 'onEditableShown',
|
||||
|
@ -48,7 +47,6 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
}
|
||||
|
||||
const editableOptions = {}
|
||||
const editableDataMarkup = []
|
||||
const editableDataPrefix = 'editable-'
|
||||
const processDataOptions = (key, value) => {
|
||||
// Replace camel case with dashes.
|
||||
|
@ -59,12 +57,14 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
}
|
||||
}
|
||||
|
||||
const formatterIsSet = column.formatter ? true : false
|
||||
|
||||
$.each(this.options, processDataOptions)
|
||||
|
||||
column.formatter = column.formatter || (value => value)
|
||||
column._formatter = column._formatter ? column._formatter : column.formatter
|
||||
column.formatter = (value, row, index, field) => {
|
||||
let result = Utils.calculateObjectValue(column, column._formatter, [value, row, index], value)
|
||||
let result = Utils.calculateObjectValue(column, column._formatter, [value, row, index, field], value)
|
||||
|
||||
result = typeof result === 'undefined' || result === null ? this.options.undefinedText : result
|
||||
if (this.options.uniqueId !== undefined && !column.alwaysUseFormatter) {
|
||||
|
@ -77,26 +77,26 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
|
||||
$.each(column, processDataOptions)
|
||||
|
||||
$.each(editableOptions, (key, value) => {
|
||||
editableDataMarkup.push(` ${key}="${value}"`)
|
||||
})
|
||||
|
||||
let noEditFormatter = false
|
||||
const editableOpts = Utils.calculateObjectValue(column,
|
||||
column.editable, [index, row], {})
|
||||
const noEditFormatter = editableOpts.hasOwnProperty('noEditFormatter') &&
|
||||
editableOpts.noEditFormatter(value, row, index, field)
|
||||
|
||||
if (editableOpts.hasOwnProperty('noEditFormatter')) {
|
||||
noEditFormatter = editableOpts.noEditFormatter(value, row, index, field)
|
||||
if (noEditFormatter) {
|
||||
return noEditFormatter
|
||||
}
|
||||
|
||||
if (noEditFormatter === false) {
|
||||
return `<a href="javascript:void(0)"
|
||||
data-name="${column.field}"
|
||||
data-pk="${row[this.options.idField]}"
|
||||
data-value="${result}"
|
||||
${editableDataMarkup.join('')}></a>`
|
||||
}
|
||||
return noEditFormatter
|
||||
let editableDataMarkup = ''
|
||||
|
||||
$.each(editableOptions, (key, value) => {
|
||||
editableDataMarkup += ` ${key}="${value}"`
|
||||
})
|
||||
|
||||
return `<a href="javascript:void(0)"
|
||||
data-name="${column.field}"
|
||||
data-pk="${row[this.options.idField]}"
|
||||
data-value="${value || ''}"
|
||||
${editableDataMarkup}>${formatterIsSet ? result : ''}</a>` // expand all data-editable-XXX
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
for (const row of data) {
|
||||
for (const [key, value] of Object.entries(row)) {
|
||||
if (typeof(value) !== "number") {
|
||||
row[key] = Utils.unescapeHTML(value)
|
||||
row[key] = Utils.unescapeHTML(value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,4 +186,4 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
|
||||
return data
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,13 +32,12 @@ Object.assign($.fn.bootstrapTable.columnDefaults, {
|
|||
forceHide: false
|
||||
})
|
||||
|
||||
Object.assign($.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'
|
||||
Utils.assignIcons($.fn.bootstrapTable.icons, 'export', {
|
||||
glyphicon: 'glyphicon-export icon-share',
|
||||
fa: 'fa-download',
|
||||
bi: 'bi-download',
|
||||
icon: 'icon-download',
|
||||
'material-icons': 'file_download'
|
||||
})
|
||||
|
||||
Object.assign($.fn.bootstrapTable.locales, {
|
||||
|
@ -207,7 +206,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
const footerData = {}
|
||||
const footerHtml = []
|
||||
|
||||
$.each($footerRow.children(), (index, footerCell) => {
|
||||
$footerRow.children().forEach((footerCell, index) => {
|
||||
const footerCellHtml = $(footerCell).children('.th-inner').first().html()
|
||||
|
||||
footerData[this.columns[index].field] = footerCellHtml === ' ' ? null : footerCellHtml
|
||||
|
@ -219,7 +218,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
this.$body.append(this.$body.children().last()[0].outerHTML)
|
||||
const $lastTableRow = this.$body.children().last()
|
||||
|
||||
$.each($lastTableRow.children(), (index, lastTableRowCell) => {
|
||||
$lastTableRow.children().forEach((lastTableRowCell, index) => {
|
||||
$(lastTableRowCell).html(footerHtml[index])
|
||||
})
|
||||
}
|
||||
|
@ -332,4 +331,4 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
.prop('disabled', !this.getSelections().length)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,12 +74,12 @@ Object.assign($.fn.bootstrapTable.columnDefaults, {
|
|||
printFormatter: undefined
|
||||
})
|
||||
|
||||
Object.assign($.fn.bootstrapTable.defaults.icons, {
|
||||
print: {
|
||||
bootstrap3: 'glyphicon-print icon-share',
|
||||
bootstrap5: 'bi-printer',
|
||||
'bootstrap-table': 'icon-printer'
|
||||
}[$.fn.bootstrapTable.theme] || 'fa-print'
|
||||
Utils.assignIcons($.fn.bootstrapTable.icons, 'print', {
|
||||
glyphicon: 'glyphicon-print icon-share',
|
||||
fa: 'fa-print',
|
||||
bi: 'bi-printer',
|
||||
icon: 'icon-printer',
|
||||
'material-icons': 'print'
|
||||
})
|
||||
|
||||
$.BootstrapTable = class extends $.BootstrapTable {
|
||||
|
@ -131,15 +131,13 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
this.mergedCells.push({
|
||||
row: options.index,
|
||||
col,
|
||||
rowspan: options.rowspan || 1,
|
||||
colspan: options.colspan || 1
|
||||
rowspan: +options.rowspan || 1,
|
||||
colspan: +options.colspan || 1
|
||||
})
|
||||
}
|
||||
|
||||
doPrint (data) {
|
||||
const canPrint = column => {
|
||||
return !column.printIgnore && column.visible
|
||||
}
|
||||
const canPrint = column => !column.printIgnore && column.visible
|
||||
|
||||
const formatValue = (row, i, column) => {
|
||||
const value_ = Utils.getItemField(row, column.field, this.options.escape, column.escape)
|
||||
|
@ -148,7 +146,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
[value_, row, i], value_)
|
||||
|
||||
return typeof value === 'undefined' || value === null ?
|
||||
this.options.undefinedText : value
|
||||
this.options.undefinedText : $('<div>').html(value).html()
|
||||
}
|
||||
|
||||
const buildTable = (data, columnsArray) => {
|
||||
|
@ -194,9 +192,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
|
||||
const columns = columnsArray.flat(1)
|
||||
|
||||
columns.sort((c1, c2) => {
|
||||
return c1.colspanIndex - c2.colspanIndex
|
||||
})
|
||||
columns.sort((c1, c2) => c1.colspanIndex - c2.colspanIndex)
|
||||
|
||||
for (let j = 0; j < columns.length; j++) {
|
||||
if (columns[j].colspanGroup > 0) continue
|
||||
|
@ -309,4 +305,4 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
startPrint()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
try {
|
||||
$(this.$el).dragtable('destroy')
|
||||
} catch (e) {
|
||||
// do nothing
|
||||
console.error(e)
|
||||
}
|
||||
$(this.$el).dragtable({
|
||||
maxMovingRows: this.options.maxMovingRows,
|
||||
|
@ -136,7 +136,9 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
const sortOrder = {}
|
||||
|
||||
table.el.find('th').each((i, el) => {
|
||||
sortOrder[$(el).data('field')] = i
|
||||
if (el.dataset.field !== undefined) {
|
||||
sortOrder[el.dataset.field] = i
|
||||
}
|
||||
})
|
||||
|
||||
this.columnsSortOrder = sortOrder
|
||||
|
@ -177,7 +179,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
this.columns = columns
|
||||
|
||||
filterFn() // Support <IE9
|
||||
$.each(this.columns, (i, column) => {
|
||||
for (const column of this.columns) {
|
||||
let found = false
|
||||
const field = column.field
|
||||
|
||||
|
@ -189,7 +191,7 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
}
|
||||
return true
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.options.columns[0] = optionsColumns
|
||||
|
||||
|
@ -209,4 +211,4 @@ $.BootstrapTable = class extends $.BootstrapTable {
|
|||
this.columnsSortOrder = order
|
||||
this.makeColumnsReorderable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<link th:href="@{/css/bootstrap.min.css?v=3.3.7}" rel="stylesheet"/>
|
||||
<link th:href="@{/css/font-awesome.min.css?v=4.7.0}" rel="stylesheet"/>
|
||||
<!-- bootstrap-table 表格插件样式 -->
|
||||
<link th:href="@{/ajax/libs/bootstrap-table/bootstrap-table.min.css?v=1.22.6}" rel="stylesheet"/>
|
||||
<link th:href="@{/ajax/libs/bootstrap-table/bootstrap-table.min.css?v=1.24.1}" rel="stylesheet"/>
|
||||
<link th:href="@{/css/animate.min.css?v=20210831}" rel="stylesheet"/>
|
||||
<link th:href="@{/css/style.min.css?v=20210831}" rel="stylesheet"/>
|
||||
<link th:href="@{/ruoyi/css/ry-ui.css?v=4.8.0}" rel="stylesheet"/>
|
||||
|
@ -23,15 +23,15 @@
|
|||
<script th:src="@{/js/jquery.min.js?v=3.7.1}"></script>
|
||||
<script th:src="@{/js/bootstrap.min.js?v=3.3.7}"></script>
|
||||
<!-- bootstrap-table 表格插件 -->
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/bootstrap-table.min.js?v=1.24.1}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/locale/bootstrap-table-zh-CN.min.js?v=1.24.1}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/mobile/bootstrap-table-mobile.js?v=1.24.1}"></script>
|
||||
<!-- jquery-validate 表单验证插件 -->
|
||||
<script th:src="@{/ajax/libs/validate/jquery.validate.min.js?v=1.21.0}"></script>
|
||||
<script th:src="@{/ajax/libs/validate/jquery.validate.extend.js?v=1.21.0}"></script>
|
||||
<script th:src="@{/ajax/libs/validate/messages_zh.js?v=1.21.0}"></script>
|
||||
<!-- bootstrap-table 表格树插件 -->
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/tree/bootstrap-table-tree.min.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/tree/bootstrap-table-tree.min.js?v=1.24.1}"></script>
|
||||
<!-- 遮罩层 -->
|
||||
<script th:src="@{/ajax/libs/blockUI/jquery.blockUI.js?v=2.70.0}"></script>
|
||||
<script th:src="@{/ajax/libs/iCheck/icheck.min.js?v=1.0.3}"></script>
|
||||
|
@ -171,20 +171,20 @@
|
|||
|
||||
<!-- 表格行拖拽插件 -->
|
||||
<div th:fragment="bootstrap-table-reorder-rows-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/reorder-rows/bootstrap-table-reorder-rows.js?v=1.24.1}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/reorder-rows/jquery.tablednd.js?v=1.0.3}"></script>
|
||||
</div>
|
||||
|
||||
<!-- 表格列拖拽插件 -->
|
||||
<div th:fragment="bootstrap-table-reorder-columns-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/reorder-columns/jquery.dragtable.js?v=5.3.5}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/reorder-columns/bootstrap-table-reorder-columns.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/reorder-columns/bootstrap-table-reorder-columns.js?v=1.24.1}"></script>
|
||||
</div>
|
||||
|
||||
<!-- 表格列宽拖动插件 -->
|
||||
<div th:fragment="bootstrap-table-resizable-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/resizable/jquery.resizableColumns.min.js?v=0.1.0}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/resizable/bootstrap-table-resizable.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/resizable/bootstrap-table-resizable.js?v=1.24.1}"></script>
|
||||
</div>
|
||||
|
||||
<!-- 表格行内编辑插件 -->
|
||||
|
@ -193,36 +193,36 @@
|
|||
</div>
|
||||
<div th:fragment="bootstrap-table-editable-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/editable/bootstrap-editable.min.js?v=1.5.1}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/editable/bootstrap-table-editable.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/editable/bootstrap-table-editable.js?v=1.24.1}"></script>
|
||||
</div>
|
||||
|
||||
<!-- 表格导出插件 -->
|
||||
<div th:fragment="bootstrap-table-export-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/export/bootstrap-table-export.js?v=1.24.1}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/export/tableExport.min.js?v=1.10.24}"></script>
|
||||
</div>
|
||||
|
||||
<!-- 表格冻结列插件 -->
|
||||
<div th:fragment="bootstrap-table-fixed-columns-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/columns/bootstrap-table-fixed-columns.js?v=1.24.1}"></script>
|
||||
</div>
|
||||
|
||||
<!-- 表格自动刷新插件 -->
|
||||
<div th:fragment="bootstrap-table-auto-refresh-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/auto-refresh/bootstrap-table-auto-refresh.js?v=1.24.1}"></script>
|
||||
</div>
|
||||
|
||||
<!-- 表格打印插件 -->
|
||||
<div th:fragment="bootstrap-table-print-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/print/bootstrap-table-print.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/print/bootstrap-table-print.js?v=1.24.1}"></script>
|
||||
</div>
|
||||
|
||||
<!-- 表格视图分页插件 -->
|
||||
<div th:fragment="bootstrap-table-custom-view-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/custom-view/bootstrap-table-custom-view.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/custom-view/bootstrap-table-custom-view.js?v=1.24.1}"></script>
|
||||
</div>
|
||||
|
||||
<!-- 表格保存状态插件 -->
|
||||
<div th:fragment="bootstrap-table-cookie-js">
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/cookie/bootstrap-table-cookie.js?v=1.22.6}"></script>
|
||||
<script th:src="@{/ajax/libs/bootstrap-table/extensions/cookie/bootstrap-table-cookie.js?v=1.24.1}"></script>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue