UNPKG

17.9 kBJavaScriptView Raw
1/**
2 * bootstrap-table - An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)
3 *
4 * @version v1.15.5
5 * @homepage https://bootstrap-table.com
6 * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
7 * @license MIT
8 */
9
10!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],r):r((t=t||self).jQuery)}(this,(function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,r){return t(r={exports:{}},r.exports),r.exports}var n,o,i,c="object",u=function(t){return t&&t.Math==Math&&t},a=u(typeof globalThis==c&&globalThis)||u(typeof window==c&&window)||u(typeof self==c&&self)||u(typeof r==c&&r)||Function("return this")(),f=function(t){try{return!!t()}catch(t){return!0}},l=!f((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})),s={}.propertyIsEnumerable,p=Object.getOwnPropertyDescriptor,d={f:p&&!s.call({1:2},1)?function(t){var r=p(this,t);return!!r&&r.enumerable}:s},h=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}},y={}.toString,g=function(t){return y.call(t).slice(8,-1)},v="".split,m=f((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==g(t)?v.call(t,""):Object(t)}:Object,b=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},S=function(t){return m(b(t))},x=function(t){return"object"==typeof t?null!==t:"function"==typeof t},w=function(t,r){if(!x(t))return t;var e,n;if(r&&"function"==typeof(e=t.toString)&&!x(n=e.call(t)))return n;if("function"==typeof(e=t.valueOf)&&!x(n=e.call(t)))return n;if(!r&&"function"==typeof(e=t.toString)&&!x(n=e.call(t)))return n;throw TypeError("Can't convert object to primitive value")},E={}.hasOwnProperty,O=function(t,r){return E.call(t,r)},A=a.document,j=x(A)&&x(A.createElement),k=function(t){return j?A.createElement(t):{}},L=!l&&!f((function(){return 7!=Object.defineProperty(k("div"),"a",{get:function(){return 7}}).a})),T=Object.getOwnPropertyDescriptor,G={f:l?T:function(t,r){if(t=S(t),r=w(r,!0),L)try{return T(t,r)}catch(t){}if(O(t,r))return h(!d.f.call(t,r),t[r])}},M=function(t){if(!x(t))throw TypeError(String(t)+" is not an object");return t},P=Object.defineProperty,B={f:l?P:function(t,r,e){if(M(t),r=w(r,!0),M(e),L)try{return P(t,r,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported");return"value"in e&&(t[r]=e.value),t}},F=l?function(t,r,e){return B.f(t,r,h(1,e))}:function(t,r,e){return t[r]=e,t},I=function(t,r){try{F(a,t,r)}catch(e){a[t]=r}return r},_=e((function(t){var r=a["__core-js_shared__"]||I("__core-js_shared__",{});(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.1.3",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})),C=_("native-function-to-string",Function.toString),$=a.WeakMap,R="function"==typeof $&&/native code/.test(C.call($)),V=0,N=Math.random(),D=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++V+N).toString(36)},q=_("keys"),H=function(t){return q[t]||(q[t]=D(t))},z={},W=a.WeakMap;if(R){var K=new W,Q=K.get,Y=K.has,J=K.set;n=function(t,r){return J.call(K,t,r),r},o=function(t){return Q.call(K,t)||{}},i=function(t){return Y.call(K,t)}}else{var U=H("state");z[U]=!0,n=function(t,r){return F(t,U,r),r},o=function(t){return O(t,U)?t[U]:{}},i=function(t){return O(t,U)}}var X={set:n,get:o,has:i,enforce:function(t){return i(t)?o(t):n(t,{})},getterFor:function(t){return function(r){var e;if(!x(r)||(e=o(r)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return e}}},Z=e((function(t){var r=X.get,e=X.enforce,n=String(C).split("toString");_("inspectSource",(function(t){return C.call(t)})),(t.exports=function(t,r,o,i){var c=!!i&&!!i.unsafe,u=!!i&&!!i.enumerable,f=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof r||O(o,"name")||F(o,"name",r),e(o).source=n.join("string"==typeof r?r:"")),t!==a?(c?!f&&t[r]&&(u=!0):delete t[r],u?t[r]=o:F(t,r,o)):u?t[r]=o:I(r,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&r(this).source||C.call(this)}))})),tt=a,rt=function(t){return"function"==typeof t?t:void 0},et=function(t,r){return arguments.length<2?rt(tt[t])||rt(a[t]):tt[t]&&tt[t][r]||a[t]&&a[t][r]},nt=Math.ceil,ot=Math.floor,it=function(t){return isNaN(t=+t)?0:(t>0?ot:nt)(t)},ct=Math.min,ut=function(t){return t>0?ct(it(t),9007199254740991):0},at=Math.max,ft=Math.min,lt=function(t,r){var e=it(t);return e<0?at(e+r,0):ft(e,r)},st=function(t){return function(r,e,n){var o,i=S(r),c=ut(i.length),u=lt(n,c);if(t&&e!=e){for(;c>u;)if((o=i[u++])!=o)return!0}else for(;c>u;u++)if((t||u in i)&&i[u]===e)return t||u||0;return!t&&-1}},pt={includes:st(!0),indexOf:st(!1)}.indexOf,dt=function(t,r){var e,n=S(t),o=0,i=[];for(e in n)!O(z,e)&&O(n,e)&&i.push(e);for(;r.length>o;)O(n,e=r[o++])&&(~pt(i,e)||i.push(e));return i},ht=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yt=ht.concat("length","prototype"),gt={f:Object.getOwnPropertyNames||function(t){return dt(t,yt)}},vt={f:Object.getOwnPropertySymbols},mt=et("Reflect","ownKeys")||function(t){var r=gt.f(M(t)),e=vt.f;return e?r.concat(e(t)):r},bt=function(t,r){for(var e=mt(r),n=B.f,o=G.f,i=0;i<e.length;i++){var c=e[i];O(t,c)||n(t,c,o(r,c))}},St=/#|\.prototype\./,xt=function(t,r){var e=Et[wt(t)];return e==At||e!=Ot&&("function"==typeof r?f(r):!!r)},wt=xt.normalize=function(t){return String(t).replace(St,".").toLowerCase()},Et=xt.data={},Ot=xt.NATIVE="N",At=xt.POLYFILL="P",jt=xt,kt=G.f,Lt=function(t,r){var e,n,o,i,c,u=t.target,f=t.global,l=t.stat;if(e=f?a:l?a[u]||I(u,{}):(a[u]||{}).prototype)for(n in r){if(i=r[n],o=t.noTargetGet?(c=kt(e,n))&&c.value:e[n],!jt(f?n:u+(l?".":"#")+n,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;bt(i,o)}(t.sham||o&&o.sham)&&F(i,"sham",!0),Z(e,n,i,t)}},Tt=function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function");return t},Gt=function(t){return Object(b(t))},Mt=Array.isArray||function(t){return"Array"==g(t)},Pt=!!Object.getOwnPropertySymbols&&!f((function(){return!String(Symbol())})),Bt=a.Symbol,Ft=_("wks"),It=function(t){return Ft[t]||(Ft[t]=Pt&&Bt[t]||(Pt?Bt:D)("Symbol."+t))},_t=It("species"),Ct=function(t,r){var e;return Mt(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!Mt(e.prototype)?x(e)&&null===(e=e[_t])&&(e=void 0):e=void 0),new(void 0===e?Array:e)(0===r?0:r)},$t=[].push,Rt=function(t){var r=1==t,e=2==t,n=3==t,o=4==t,i=6==t,c=5==t||i;return function(u,a,f,l){for(var s,p,d=Gt(u),h=m(d),y=function(t,r,e){if(Tt(t),void 0===r)return t;switch(e){case 0:return function(){return t.call(r)};case 1:return function(e){return t.call(r,e)};case 2:return function(e,n){return t.call(r,e,n)};case 3:return function(e,n,o){return t.call(r,e,n,o)}}return function(){return t.apply(r,arguments)}}(a,f,3),g=ut(h.length),v=0,b=l||Ct,S=r?b(u,g):e?b(u,0):void 0;g>v;v++)if((c||v in h)&&(p=y(s=h[v],v,d),t))if(r)S[v]=p;else if(p)switch(t){case 3:return!0;case 5:return s;case 6:return v;case 2:$t.call(S,s)}else if(o)return!1;return i?-1:n||o?o:S}},Vt={forEach:Rt(0),map:Rt(1),filter:Rt(2),some:Rt(3),every:Rt(4),find:Rt(5),findIndex:Rt(6)},Nt=It("species"),Dt=function(t){return!f((function(){var r=[];return(r.constructor={})[Nt]=function(){return{foo:1}},1!==r[t](Boolean).foo}))},qt=Vt.filter;Lt({target:"Array",proto:!0,forced:!Dt("filter")},{filter:function(t){return qt(this,t,arguments.length>1?arguments[1]:void 0)}});var Ht=Object.keys||function(t){return dt(t,ht)},zt=l?Object.defineProperties:function(t,r){M(t);for(var e,n=Ht(r),o=n.length,i=0;o>i;)B.f(t,e=n[i++],r[e]);return t},Wt=et("document","documentElement"),Kt=H("IE_PROTO"),Qt=function(){},Yt=function(){var t,r=k("iframe"),e=ht.length;for(r.style.display="none",Wt.appendChild(r),r.src=String("javascript:"),(t=r.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),Yt=t.F;e--;)delete Yt.prototype[ht[e]];return Yt()},Jt=Object.create||function(t,r){var e;return null!==t?(Qt.prototype=M(t),e=new Qt,Qt.prototype=null,e[Kt]=t):e=Yt(),void 0===r?e:zt(e,r)};z[Kt]=!0;var Ut=It("unscopables"),Xt=Array.prototype;null==Xt[Ut]&&F(Xt,Ut,Jt(null));var Zt,tr=Vt.find,rr=!0;"find"in[]&&Array(1).find((function(){rr=!1})),Lt({target:"Array",proto:!0,forced:rr},{find:function(t){return tr(this,t,arguments.length>1?arguments[1]:void 0)}}),Zt="find",Xt[Ut][Zt]=!0;var er=function(t,r){var e=[][t];return!e||!f((function(){e.call(null,r||function(){throw 1},1)}))},nr=[].join,or=m!=Object,ir=er("join",",");Lt({target:"Array",proto:!0,forced:or||ir},{join:function(t){return nr.call(S(this),void 0===t?",":t)}});var cr=function(t,r,e){var n=w(r);n in t?B.f(t,n,h(0,e)):t[n]=e},ur=It("species"),ar=[].slice,fr=Math.max;Lt({target:"Array",proto:!0,forced:!Dt("slice")},{slice:function(t,r){var e,n,o,i=S(this),c=ut(i.length),u=lt(t,c),a=lt(void 0===r?c:r,c);if(Mt(i)&&("function"!=typeof(e=i.constructor)||e!==Array&&!Mt(e.prototype)?x(e)&&null===(e=e[ur])&&(e=void 0):e=void 0,e===Array||void 0===e))return ar.call(i,u,a);for(n=new(void 0===e?Array:e)(fr(a-u,0)),o=0;u<a;u++,o++)u in i&&cr(n,o,i[u]);return n.length=o,n}});var lr=[].sort,sr=[1,2,3],pr=f((function(){sr.sort(void 0)})),dr=f((function(){sr.sort(null)})),hr=er("sort");Lt({target:"Array",proto:!0,forced:pr||!dr||hr},{sort:function(t){return void 0===t?lr.call(Gt(this)):lr.call(Gt(this),Tt(t))}});var yr=B.f,gr=Function.prototype,vr=gr.toString,mr=/^\s*function ([^ (]*)/;!l||"name"in gr||yr(gr,"name",{configurable:!0,get:function(){try{return vr.call(this).match(mr)[1]}catch(t){return""}}});var br,Sr,xr=function(){var t=M(this),r="";return t.global&&(r+="g"),t.ignoreCase&&(r+="i"),t.multiline&&(r+="m"),t.dotAll&&(r+="s"),t.unicode&&(r+="u"),t.sticky&&(r+="y"),r},wr=RegExp.prototype.exec,Er=String.prototype.replace,Or=wr,Ar=(br=/a/,Sr=/b*/g,wr.call(br,"a"),wr.call(Sr,"a"),0!==br.lastIndex||0!==Sr.lastIndex),jr=void 0!==/()??/.exec("")[1];(Ar||jr)&&(Or=function(t){var r,e,n,o,i=this;return jr&&(e=new RegExp("^"+i.source+"$(?!\\s)",xr.call(i))),Ar&&(r=i.lastIndex),n=wr.call(i,t),Ar&&n&&(i.lastIndex=i.global?n.index+n[0].length:r),jr&&n&&n.length>1&&Er.call(n[0],e,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n});var kr=Or,Lr=It("species"),Tr=!f((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),Gr=!f((function(){var t=/(?:)/,r=t.exec;t.exec=function(){return r.apply(this,arguments)};var e="ab".split(t);return 2!==e.length||"a"!==e[0]||"b"!==e[1]})),Mr=function(t){return function(r,e){var n,o,i=String(b(r)),c=it(e),u=i.length;return c<0||c>=u?t?"":void 0:(n=i.charCodeAt(c))<55296||n>56319||c+1===u||(o=i.charCodeAt(c+1))<56320||o>57343?t?i.charAt(c):n:t?i.slice(c,c+2):o-56320+(n-55296<<10)+65536}},Pr={codeAt:Mr(!1),charAt:Mr(!0)}.charAt,Br=function(t,r,e){return r+(e?Pr(t,r).length:1)},Fr=function(t,r){var e=t.exec;if("function"==typeof e){var n=e.call(t,r);if("object"!=typeof n)throw TypeError("RegExp exec method returned something other than an Object or null");return n}if("RegExp"!==g(t))throw TypeError("RegExp#exec called on incompatible receiver");return kr.call(t,r)},Ir=Math.max,_r=Math.min,Cr=Math.floor,$r=/\$([$&'`]|\d\d?|<[^>]*>)/g,Rr=/\$([$&'`]|\d\d?)/g;!function(t,r,e,n){var o=It(t),i=!f((function(){var r={};return r[o]=function(){return 7},7!=""[t](r)})),c=i&&!f((function(){var r=!1,e=/a/;return e.exec=function(){return r=!0,null},"split"===t&&(e.constructor={},e.constructor[Lr]=function(){return e}),e[o](""),!r}));if(!i||!c||"replace"===t&&!Tr||"split"===t&&!Gr){var u=/./[o],a=e(o,""[t],(function(t,r,e,n,o){return r.exec===kr?i&&!o?{done:!0,value:u.call(r,e,n)}:{done:!0,value:t.call(e,r,n)}:{done:!1}})),l=a[0],s=a[1];Z(String.prototype,t,l),Z(RegExp.prototype,o,2==r?function(t,r){return s.call(t,this,r)}:function(t){return s.call(t,this)}),n&&F(RegExp.prototype[o],"sham",!0)}}("replace",2,(function(t,r,e){return[function(e,n){var o=b(this),i=null==e?void 0:e[t];return void 0!==i?i.call(e,o,n):r.call(String(o),e,n)},function(t,o){var i=e(r,t,this,o);if(i.done)return i.value;var c=M(t),u=String(this),a="function"==typeof o;a||(o=String(o));var f=c.global;if(f){var l=c.unicode;c.lastIndex=0}for(var s=[];;){var p=Fr(c,u);if(null===p)break;if(s.push(p),!f)break;""===String(p[0])&&(c.lastIndex=Br(u,ut(c.lastIndex),l))}for(var d,h="",y=0,g=0;g<s.length;g++){p=s[g];for(var v=String(p[0]),m=Ir(_r(it(p.index),u.length),0),b=[],S=1;S<p.length;S++)b.push(void 0===(d=p[S])?d:String(d));var x=p.groups;if(a){var w=[v].concat(b,m,u);void 0!==x&&w.push(x);var E=String(o.apply(void 0,w))}else E=n(v,u,m,b,x,o);m>=y&&(h+=u.slice(y,m)+E,y=m+v.length)}return h+u.slice(y)}];function n(t,e,n,o,i,c){var u=n+t.length,a=o.length,f=Rr;return void 0!==i&&(i=Gt(i),f=$r),r.call(c,f,(function(r,c){var f;switch(c.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,n);case"'":return e.slice(u);case"<":f=i[c.slice(1,-1)];break;default:var l=+c;if(0===l)return r;if(l>a){var s=Cr(l/10);return 0===s?r:s<=a?void 0===o[s-1]?c.charAt(1):o[s-1]+c.charAt(1):r}f=o[l-1]}return void 0===f?"":f}))}}));var Vr,Nr,Dr=Vt.forEach,qr=er("forEach")?function(t){return Dr(this,t,arguments.length>1?arguments[1]:void 0)}:[].forEach;for(var Hr in{CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}){var zr=a[Hr],Wr=zr&&zr.prototype;if(Wr&&Wr.forEach!==qr)try{F(Wr,"forEach",qr)}catch(t){Wr.forEach=qr}}var Kr=function(t){var r=arguments,e=!0,n=1;return t=t.replace(/%s/g,(function(){var t=r[n++];return void 0===t?(e=!1,""):t})),e?t:""},Qr=function(t,r){var e={};return t.forEach((function(t){var n=r(t);e[n]=e[n]||[],e[n].push(t)})),e};t.extend(t.fn.bootstrapTable.defaults,{groupBy:!1,groupByField:"",groupByFormatter:void 0});var Yr=t.fn.bootstrapTable.Constructor,Jr=Yr.prototype.initSort,Ur=Yr.prototype.initBody,Xr=Yr.prototype.updateSelected;Yr.prototype.initSort=function(){for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];Jr.apply(this,Array.prototype.slice.apply(e));var o=this;if(Nr=[],this.options.groupBy&&""!==this.options.groupByField){this.options.sortName!==this.options.groupByField&&this.data.sort((function(t,r){return t[o.options.groupByField].localeCompare(r[o.options.groupByField])}));var i=Qr(o.data,(function(t){return[t[o.options.groupByField]]})),c=0;t.each(i,(function(t,r){Nr.push({id:c,name:t,data:r}),r.forEach((function(t){t._data||(t._data={}),t._data["parent-index"]=c})),c++}))}},Yr.prototype.initBody=function(){Vr=!0;for(var r=arguments.length,e=new Array(r),n=0;n<r;n++)e[n]=arguments[n];if(Ur.apply(this,Array.prototype.slice.apply(e)),this.options.groupBy&&""!==this.options.groupByField){var o=this,i=!1,c=0;this.columns.forEach((function(t){t.checkbox?i=!0:t.visible&&(c+=1)})),this.options.detailView&&!this.options.cardView&&(c+=1),Nr.forEach((function(r){var e=[];e.push(Kr('<tr class="info groupBy expanded" data-group-index="%s">',r.id)),o.options.detailView&&!o.options.cardView&&e.push('<td class="detail"></td>'),i&&e.push('<td class="bs-checkbox">','<input name="btSelectGroup" type="checkbox" />',"</td>");var n=r.name;"function"==typeof o.options.groupByFormatter&&(n=o.options.groupByFormatter(r.name,r.id,r.data)),e.push("<td",Kr(' colspan="%s"',c),">",n,"</td>"),e.push("</tr>"),o.$body.find("tr[data-parent-index=".concat(r.id,"]:first")).before(t(e.join("")))})),this.$selectGroup=[],this.$body.find('[name="btSelectGroup"]').each((function(){var r=t(this);o.$selectGroup.push({group:r,item:o.$selectItem.filter((function(){return t(this).closest("tr").data("parent-index")===r.closest("tr").data("group-index")}))})})),this.$container.off("click",".groupBy").on("click",".groupBy",(function(){t(this).toggleClass("expanded"),o.$body.find("tr[data-parent-index=".concat(t(this).closest("tr").data("group-index"),"]")).toggleClass("hidden")})),this.$container.off("click",'[name="btSelectGroup"]').on("click",'[name="btSelectGroup"]',(function(r){r.stopImmediatePropagation();var e=t(this).prop("checked");o[e?"checkGroup":"uncheckGroup"](t(this).closest("tr").data("group-index"))}))}Vr=!1,this.updateSelected()},Yr.prototype.updateSelected=function(){if(!Vr){for(var t=arguments.length,r=new Array(t),e=0;e<t;e++)r[e]=arguments[e];Xr.apply(this,Array.prototype.slice.apply(r)),this.options.groupBy&&""!==this.options.groupByField&&this.$selectGroup.forEach((function(t){var r=t.item.filter(":enabled").length===t.item.filter(":enabled").filter(":checked").length;t.group.prop("checked",r)}))}},Yr.prototype.getGroupSelections=function(t){var r=this;return this.data.filter((function(e){return e[r.header.stateField]&&e._data["parent-index"]===t}))},Yr.prototype.checkGroup=function(t){this.checkGroup_(t,!0)},Yr.prototype.uncheckGroup=function(t){this.checkGroup_(t,!1)},Yr.prototype.checkGroup_=function(r,e){var n;e||(n=this.getGroupSelections(r)),this.$selectItem.filter((function(){return t(this).closest("tr").data("parent-index")===r})).prop("checked",e),this.updateRows(),this.updateSelected(),e&&(n=this.getGroupSelections(r)),this.trigger(e?"check-all":"uncheck-all",n)}}));