10 lines
7.8 KiB
JavaScript
Executable File
10 lines
7.8 KiB
JavaScript
Executable File
/**
|
|
* bootstrap-table - An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features. (supports twitter bootstrap v2 and v3).
|
|
*
|
|
* @version v1.14.2
|
|
* @homepage https://bootstrap-table.com
|
|
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
|
|
* @license MIT
|
|
*/
|
|
|
|
(function(a,b){if('function'==typeof define&&define.amd)define([],b);else if('undefined'!=typeof exports)b();else{b(),a.bootstrapTableToolbar={exports:{}}.exports}})(this,function(){'use strict';function a(a,b){if(!(a instanceof b))throw new TypeError('Cannot call a class as a function')}function b(a,b){if(!a)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return b&&('object'==typeof b||'function'==typeof b)?b:a}function c(a,b){if('function'!=typeof b&&null!==b)throw new TypeError('Super expression must either be null or a function, not '+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var d=function(){function a(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!(b&&c.length===b));d=!0);}catch(a){e=!0,f=a}finally{try{!d&&h['return']&&h['return']()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError('Invalid attempt to destructure non-iterable instance')}}(),e=function(){function a(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,'value'in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),f=function a(b,c,d){null===b&&(b=Function.prototype);var e=Object.getOwnPropertyDescriptor(b,c);if(e===void 0){var f=Object.getPrototypeOf(b);return null===f?void 0:a(f,c,d)}if('value'in e)return e.value;var g=e.get;return void 0===g?void 0:g.call(d)};(function(g){var h=g.fn.bootstrapTable.utils,i={3:{icons:{advancedSearchIcon:'glyphicon-chevron-down'},html:{modalHeader:'\n <div class="modal-header">\n <button type="button" class="close" data-dismiss="modal" aria-label="Close">\n <span aria-hidden="true">×</span>\n </button>\n <h4 class="modal-title">%s</h4>\n </div>\n '}},4:{icons:{advancedSearchIcon:'fa-chevron-down'},html:{modalHeader:'\n <div class="modal-header">\n <h4 class="modal-title">%s</h4>\n <button type="button" class="close" data-dismiss="modal" aria-label="Close">\n <span aria-hidden="true">×</span>\n </button>\n </div>\n '}}}[h.bootstrapVersion];g.extend(g.fn.bootstrapTable.defaults,{advancedSearch:!1,idForm:'advancedSearch',actionForm:'',idTable:void 0,onColumnAdvancedSearch:function(){return!1}}),g.extend(g.fn.bootstrapTable.defaults.icons,{advancedSearchIcon:i.icons.advancedSearchIcon}),g.extend(g.fn.bootstrapTable.Constructor.EVENTS,{"column-advanced-search.bs.table":'onColumnAdvancedSearch'}),g.extend(g.fn.bootstrapTable.locales,{formatAdvancedSearch:function(){return'Advanced search'},formatAdvancedCloseButton:function(){return'Close'}}),g.extend(g.fn.bootstrapTable.defaults,g.fn.bootstrapTable.locales),g.BootstrapTable=function(j){function k(){return a(this,k),b(this,(k.__proto__||Object.getPrototypeOf(k)).apply(this,arguments))}return c(k,j),e(k,[{key:'initToolbar',value:function(){var a=this,b=this.options;this.showToolbar=this.showToolbar||b.search&&b.advancedSearch&&b.idTable,f(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),'initToolbar',this).call(this),b.search&&b.advancedSearch&&b.idTable&&(this.$toolbar.find('>.btn-group').append('\n <button class="btn btn-default'+h.sprintf(' btn-%s',b.buttonsClass)+h.sprintf(' btn-%s',b.iconSize)+'"\n type="button"\n name="advancedSearch"\n aria-label="advanced search"\n title="'+b.formatAdvancedSearch()+'">\n <i class="'+b.iconsPrefix+' '+b.icons.advancedSearchIcon+'"></i>\n </button>\n '),this.$toolbar.find('button[name="advancedSearch"]').off('click').on('click',function(){return a.showAvdSearch()}))}},{key:'showAvdSearch',value:function(){var a=this,b=this.options;if(!g('#avdSearchModal_'+b.idTable).hasClass('modal')){g('body').append('\n <div id="avdSearchModal_'+b.idTable+'" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">\n <div class="modal-dialog modal-xs">\n <div class="modal-content">\n '+h.sprintf(i.html.modalHeader,b.formatAdvancedSearch())+'\n <div class="modal-body modal-body-custom">\n <div class="container-fluid" id="avdSearchModalContent_'+b.idTable+'"\n style="padding-right: 0px; padding-left: 0px;" >\n </div>\n </div>\n <div class="modal-footer">\n <button type="button" id="btnCloseAvd_'+b.idTable+'" class="btn btn-'+b.buttonsClass+'">\n '+b.formatAdvancedCloseButton()+'\n </button>\n </div>\n </div>\n </div>\n </div>\n ');var c=0;g('#avdSearchModalContent_'+b.idTable).append(this.createFormAvd().join('')),g('#'+b.idForm).off('keyup blur','input').on('keyup blur','input',function(d){'server'===b.sidePagination?a.onColumnAdvancedSearch(d):(clearTimeout(c),c=setTimeout(function(){a.onColumnAdvancedSearch(d)},b.searchTimeOut))}),g('#btnCloseAvd_'+b.idTable).click(function(){g('#avdSearchModal_'+b.idTable).modal('hide'),'server'===b.sidePagination&&(a.options.pageNumber=1,a.updatePagination(),a.trigger('column-advanced-search',a.filterColumnsPartial))}),g('#avdSearchModal_'+b.idTable).modal()}else g('#avdSearchModal_'+b.idTable).modal()}},{key:'createFormAvd',value:function(){for(var a=this.options,b=['<form class="form-horizontal" id="'+a.idForm+'" action="'+a.actionForm+'">'],c=this.columns,d=Array.isArray(c),e=0,_iterator=d?c:c[Symbol.iterator]();;){var f;if(d){if(e>=c.length)break;f=c[e++]}else{if(e=c.next(),e.done)break;f=e.value}var g=f;!g.checkbox&&g.visible&&g.searchable&&b.push('\n <div class="form-group row">\n <label class="col-sm-4 control-label">'+g.title+'</label>\n <div class="col-sm-6">\n <input type="text" class="form-control input-md" name="'+g.field+'" placeholder="'+g.title+'" id="'+g.field+'">\n </div>\n </div>\n ')}return b.push('</form>'),b}},{key:'initSearch',value:function(){var a=this;if(f(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),'initSearch',this).call(this),this.options.advancedSearch&&'server'!==this.options.sidePagination){var b=g.isEmptyObject(this.filterColumnsPartial)?null:this.filterColumnsPartial;this.data=b?g.grep(this.data,function(c,e){for(var f=function(a){return Object.keys(a).map(function(b){return[b,a[b]]})}(b),g=Array.isArray(f),i=0,_iterator2=g?f:f[Symbol.iterator]();;){var j;if(g){if(i>=f.length)break;j=f[i++]}else{if(i=f.next(),i.done)break;j=i.value}var k=j,l=d(k,2),m=l[0],n=l[1],o=n.toLowerCase(),p=c[m],q=a.header.fields.indexOf(m);if(p=h.calculateObjectValue(a.header,a.header.formatters[q],[p,c,e],p),-1===q||'string'!=typeof p&&'number'!=typeof p||-1===(''+p).toLowerCase().indexOf(o))return!1}return!0}):this.data}}},{key:'onColumnAdvancedSearch',value:function(a){var b=g.trim(g(a.currentTarget).val()),c=g(a.currentTarget)[0].id;g.isEmptyObject(this.filterColumnsPartial)&&(this.filterColumnsPartial={}),b?this.filterColumnsPartial[c]=b:delete this.filterColumnsPartial[c],'server'!==this.options.sidePagination&&(this.options.pageNumber=1,this.onSearch(a),this.updatePagination(),this.trigger('column-advanced-search',c,b))}}]),k}(g.BootstrapTable)})(jQuery)}); |