init
- 框架初始化 - 安装插件 - 修复PHP8.4报错
This commit is contained in:
138
public/assets/libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.js
vendored
Normal file
138
public/assets/libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.js
vendored
Normal file
@@ -0,0 +1,138 @@
|
||||
/**
|
||||
* @author zhixin wen <wenzhixin2010@gmail.com>
|
||||
* extensions: https://github.com/kayalshri/tableExport.jquery.plugin
|
||||
*/
|
||||
|
||||
(function ($) {
|
||||
'use strict';
|
||||
var sprintf = $.fn.bootstrapTable.utils.sprintf;
|
||||
|
||||
var TYPE_NAME = {
|
||||
json: 'JSON',
|
||||
xml: 'XML',
|
||||
png: 'PNG',
|
||||
csv: 'CSV',
|
||||
txt: 'TXT',
|
||||
sql: 'SQL',
|
||||
doc: 'MS-Word',
|
||||
excel: 'MS-Excel',
|
||||
xlsx: 'MS-Excel (OpenXML)',
|
||||
powerpoint: 'MS-Powerpoint',
|
||||
pdf: 'PDF'
|
||||
};
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults, {
|
||||
showExport: false,
|
||||
exportDataType: 'basic', // basic, all, selected
|
||||
// 'json', 'xml', 'png', 'csv', 'txt', 'sql', 'doc', 'excel', 'powerpoint', 'pdf'
|
||||
exportTypes: ['json', 'xml', 'csv', 'txt', 'sql', 'excel'],
|
||||
exportOptions: {}
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.defaults.icons, {
|
||||
export: 'glyphicon-export icon-share'
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.locales, {
|
||||
formatExport: function () {
|
||||
return 'Export data';
|
||||
}
|
||||
});
|
||||
$.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales);
|
||||
|
||||
var BootstrapTable = $.fn.bootstrapTable.Constructor,
|
||||
_initToolbar = BootstrapTable.prototype.initToolbar;
|
||||
|
||||
BootstrapTable.prototype.initToolbar = function () {
|
||||
this.showToolbar = this.options.showExport;
|
||||
|
||||
_initToolbar.apply(this, Array.prototype.slice.apply(arguments));
|
||||
|
||||
if (this.options.showExport) {
|
||||
var that = this,
|
||||
$btnGroup = this.$toolbar.find('>.btn-group'),
|
||||
$export = $btnGroup.find('div.export');
|
||||
|
||||
if (!$export.length) {
|
||||
$export = $([
|
||||
'<div class="export btn-group">',
|
||||
'<button class="btn' +
|
||||
sprintf(' btn-%s', this.options.buttonsClass) +
|
||||
sprintf(' btn-%s', this.options.iconSize) +
|
||||
' dropdown-toggle" aria-label="export type" ' +
|
||||
'title="' + this.options.formatExport() + '" ' +
|
||||
'data-toggle="dropdown" type="button">',
|
||||
sprintf('<i class="%s %s"></i> ', this.options.iconsPrefix, this.options.icons.export),
|
||||
'<span class="caret"></span>',
|
||||
'</button>',
|
||||
'<ul class="dropdown-menu" role="menu">',
|
||||
'</ul>',
|
||||
'</div>'].join('')).appendTo($btnGroup);
|
||||
|
||||
var $menu = $export.find('.dropdown-menu'),
|
||||
exportTypes = this.options.exportTypes;
|
||||
|
||||
if (typeof this.options.exportTypes === 'string') {
|
||||
var types = this.options.exportTypes.slice(1, -1).replace(/ /g, '').split(',');
|
||||
|
||||
exportTypes = [];
|
||||
$.each(types, function (i, value) {
|
||||
exportTypes.push(value.slice(1, -1));
|
||||
});
|
||||
}
|
||||
$.each(exportTypes, function (i, type) {
|
||||
if (TYPE_NAME.hasOwnProperty(type)) {
|
||||
$menu.append(['<li role="menuitem" data-type="' + type + '">',
|
||||
'<a href="javascript:void(0)">',
|
||||
TYPE_NAME[type],
|
||||
'</a>',
|
||||
'</li>'].join(''));
|
||||
}
|
||||
});
|
||||
|
||||
$menu.find('li').click(function () {
|
||||
var li = this;
|
||||
if (typeof require !== 'function') {
|
||||
throw new Error("RequireJS not found");
|
||||
}
|
||||
require(['tableexport'], function () {
|
||||
var type = $(li).data('type'),
|
||||
doExport = function () {
|
||||
that.$el.tableExport($.extend({}, that.options.exportOptions, {
|
||||
type: type,
|
||||
escape: false
|
||||
}));
|
||||
};
|
||||
|
||||
if (that.options.exportDataType === 'all' && that.options.pagination) {
|
||||
that.$el.one(that.options.sidePagination === 'server' ? 'post-body.bs.table' : 'page-change.bs.table', function () {
|
||||
doExport();
|
||||
that.togglePagination();
|
||||
});
|
||||
that.togglePagination();
|
||||
} else if (that.options.exportDataType === 'selected') {
|
||||
var data = that.getData(),
|
||||
selectedData = that.getAllSelections();
|
||||
|
||||
// Quick fix #2220
|
||||
if (that.options.sidePagination === 'server') {
|
||||
data = {total: that.options.totalRows};
|
||||
data[that.options.dataField] = that.getData();
|
||||
|
||||
var Table = typeof require === 'function' ? require('table') : null;
|
||||
selectedData = {total: that.options.totalRows};
|
||||
selectedData[that.options.dataField] = Table && that.options.maintainSelected ? Table.api.selecteddata(that.$el) : that.getAllSelections();
|
||||
}
|
||||
|
||||
that.load(selectedData);
|
||||
doExport();
|
||||
that.load(data);
|
||||
} else {
|
||||
doExport();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
7
public/assets/libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min.js
vendored
Normal file
7
public/assets/libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min.js
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* bootstrap-table - v1.11.12 - 2024-03-28
|
||||
https://github.com/wenzhixin/bootstrap-table
|
||||
* Copyright (c) 2017 zhixin wen
|
||||
* Licensed MIT License
|
||||
*/
|
||||
!function(p){"use strict";var o=p.fn.bootstrapTable.utils.sprintf,i={json:"JSON",xml:"XML",png:"PNG",csv:"CSV",txt:"TXT",sql:"SQL",doc:"MS-Word",excel:"MS-Excel",xlsx:"MS-Excel (OpenXML)",powerpoint:"MS-Powerpoint",pdf:"PDF"},t=(p.extend(p.fn.bootstrapTable.defaults,{showExport:!1,exportDataType:"basic",exportTypes:["json","xml","csv","txt","sql","excel"],exportOptions:{}}),p.extend(p.fn.bootstrapTable.defaults.icons,{export:"glyphicon-export icon-share"}),p.extend(p.fn.bootstrapTable.locales,{formatExport:function(){return"Export data"}}),p.extend(p.fn.bootstrapTable.defaults,p.fn.bootstrapTable.locales),p.fn.bootstrapTable.Constructor),s=t.prototype.initToolbar;t.prototype.initToolbar=function(){var a,e,t,n;this.showToolbar=this.options.showExport,s.apply(this,Array.prototype.slice.apply(arguments)),this.options.showExport&&!(t=(a=this).$toolbar.find(">.btn-group")).find("div.export").length&&(e=p(['<div class="export btn-group">','<button class="btn'+o(" btn-%s",this.options.buttonsClass)+o(" btn-%s",this.options.iconSize)+' dropdown-toggle" aria-label="export type" title="'+this.options.formatExport()+'" data-toggle="dropdown" type="button">',o('<i class="%s %s"></i> ',this.options.iconsPrefix,this.options.icons.export),'<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">',"</ul>","</div>"].join("")).appendTo(t).find(".dropdown-menu"),n=this.options.exportTypes,"string"==typeof this.options.exportTypes&&(t=this.options.exportTypes.slice(1,-1).replace(/ /g,"").split(","),n=[],p.each(t,function(t,o){n.push(o.slice(1,-1))})),p.each(n,function(t,o){i.hasOwnProperty(o)&&e.append(['<li role="menuitem" data-type="'+o+'">','<a href="javascript:void(0)">',i[o],"</a>","</li>"].join(""))}),e.find("li").click(function(){var s=this;if("function"!=typeof require)throw new Error("RequireJS not found");require(["tableexport"],function(){function t(){a.$el.tableExport(p.extend({},a.options.exportOptions,{type:i,escape:!1}))}var o,e,n,i=p(s).data("type");"all"===a.options.exportDataType&&a.options.pagination?(a.$el.one("server"===a.options.sidePagination?"post-body.bs.table":"page-change.bs.table",function(){t(),a.togglePagination()}),a.togglePagination()):"selected"===a.options.exportDataType?(o=a.getData(),n=a.getAllSelections(),"server"===a.options.sidePagination&&((o={total:a.options.totalRows})[a.options.dataField]=a.getData(),e="function"==typeof require?require("table"):null,(n={total:a.options.totalRows})[a.options.dataField]=e&&a.options.maintainSelected?e.api.selecteddata(a.$el):a.getAllSelections()),a.load(n),t(),a.load(o)):t()})}))}}(jQuery);
|
||||
Reference in New Issue
Block a user