UNPKG

17.1 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,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e((t=t||self).jQuery)}(this,(function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(t,e){return t(e={exports:{}},e.exports),e.exports}var r,o,i,a="object",c=function(t){return t&&t.Math==Math&&t},u=c(typeof globalThis==a&&globalThis)||c(typeof window==a&&window)||c(typeof self==a&&self)||c(typeof e==a&&e)||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,d=Object.getOwnPropertyDescriptor,p={f:d&&!s.call({1:2},1)?function(t){var e=d(this,t);return!!e&&e.enumerable}:s},h=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},v={}.toString,y=function(t){return v.call(t).slice(8,-1)},g="".split,b=f((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==y(t)?g.call(t,""):Object(t)}:Object,m=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},w=function(t){return b(m(t))},x=function(t){return"object"==typeof t?null!==t:"function"==typeof t},O=function(t,e){if(!x(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!x(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!x(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!x(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},j={}.hasOwnProperty,S=function(t,e){return j.call(t,e)},E=u.document,T=x(E)&&x(E.createElement),P=function(t){return T?E.createElement(t):{}},A=!l&&!f((function(){return 7!=Object.defineProperty(P("div"),"a",{get:function(){return 7}}).a})),_=Object.getOwnPropertyDescriptor,I={f:l?_:function(t,e){if(t=w(t),e=O(e,!0),A)try{return _(t,e)}catch(t){}if(S(t,e))return h(!p.f.call(t,e),t[e])}},k=function(t){if(!x(t))throw TypeError(String(t)+" is not an object");return t},M=Object.defineProperty,R={f:l?M:function(t,e,n){if(k(t),e=O(e,!0),k(n),A)try{return M(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},C=l?function(t,e,n){return R.f(t,e,h(1,n))}:function(t,e,n){return t[e]=n,t},F=function(t,e){try{C(u,t,e)}catch(n){u[t]=e}return e},$=n((function(t){var e=u["__core-js_shared__"]||F("__core-js_shared__",{});(t.exports=function(t,n){return e[t]||(e[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.1.3",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})),D=$("native-function-to-string",Function.toString),B=u.WeakMap,L="function"==typeof B&&/native code/.test(D.call(B)),N=0,V=Math.random(),q=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++N+V).toString(36)},z=$("keys"),W=function(t){return z[t]||(z[t]=q(t))},G={},H=u.WeakMap;if(L){var K=new H,Q=K.get,Y=K.has,Z=K.set;r=function(t,e){return Z.call(K,t,e),e},o=function(t){return Q.call(K,t)||{}},i=function(t){return Y.call(K,t)}}else{var J=W("state");G[J]=!0,r=function(t,e){return C(t,J,e),e},o=function(t){return S(t,J)?t[J]:{}},i=function(t){return S(t,J)}}var U,X={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(e){var n;if(!x(e)||(n=o(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},tt=n((function(t){var e=X.get,n=X.enforce,r=String(D).split("toString");$("inspectSource",(function(t){return D.call(t)})),(t.exports=function(t,e,o,i){var a=!!i&&!!i.unsafe,c=!!i&&!!i.enumerable,f=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||S(o,"name")||C(o,"name",e),n(o).source=r.join("string"==typeof e?e:"")),t!==u?(a?!f&&t[e]&&(c=!0):delete t[e],c?t[e]=o:C(t,e,o)):c?t[e]=o:F(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||D.call(this)}))})),et=u,nt=function(t){return"function"==typeof t?t:void 0},rt=function(t,e){return arguments.length<2?nt(et[t])||nt(u[t]):et[t]&&et[t][e]||u[t]&&u[t][e]},ot=Math.ceil,it=Math.floor,at=function(t){return isNaN(t=+t)?0:(t>0?it:ot)(t)},ct=Math.min,ut=function(t){return t>0?ct(at(t),9007199254740991):0},ft=Math.max,lt=Math.min,st=function(t){return function(e,n,r){var o,i=w(e),a=ut(i.length),c=function(t,e){var n=at(t);return n<0?ft(n+e,0):lt(n,e)}(r,a);if(t&&n!=n){for(;a>c;)if((o=i[c++])!=o)return!0}else for(;a>c;c++)if((t||c in i)&&i[c]===n)return t||c||0;return!t&&-1}},dt={includes:st(!0),indexOf:st(!1)},pt=dt.indexOf,ht=function(t,e){var n,r=w(t),o=0,i=[];for(n in r)!S(G,n)&&S(r,n)&&i.push(n);for(;e.length>o;)S(r,n=e[o++])&&(~pt(i,n)||i.push(n));return i},vt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],yt=vt.concat("length","prototype"),gt={f:Object.getOwnPropertyNames||function(t){return ht(t,yt)}},bt={f:Object.getOwnPropertySymbols},mt=rt("Reflect","ownKeys")||function(t){var e=gt.f(k(t)),n=bt.f;return n?e.concat(n(t)):e},wt=function(t,e){for(var n=mt(e),r=R.f,o=I.f,i=0;i<n.length;i++){var a=n[i];S(t,a)||r(t,a,o(e,a))}},xt=/#|\.prototype\./,Ot=function(t,e){var n=St[jt(t)];return n==Tt||n!=Et&&("function"==typeof e?f(e):!!e)},jt=Ot.normalize=function(t){return String(t).replace(xt,".").toLowerCase()},St=Ot.data={},Et=Ot.NATIVE="N",Tt=Ot.POLYFILL="P",Pt=Ot,At=I.f,_t=function(t,e){var n,r,o,i,a,c=t.target,f=t.global,l=t.stat;if(n=f?u:l?u[c]||F(c,{}):(u[c]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(a=At(n,r))&&a.value:n[r],!Pt(f?r:c+(l?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;wt(i,o)}(t.sham||o&&o.sham)&&C(i,"sham",!0),tt(n,r,i,t)}},It=Array.isArray||function(t){return"Array"==y(t)},kt=function(t){return Object(m(t))},Mt=function(t,e,n){var r=O(e);r in t?R.f(t,r,h(0,n)):t[r]=n},Rt=!!Object.getOwnPropertySymbols&&!f((function(){return!String(Symbol())})),Ct=u.Symbol,Ft=$("wks"),$t=function(t){return Ft[t]||(Ft[t]=Rt&&Ct[t]||(Rt?Ct:q)("Symbol."+t))},Dt=$t("species"),Bt=function(t,e){var n;return It(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!It(n.prototype)?x(n)&&null===(n=n[Dt])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},Lt=$t("species"),Nt=$t("isConcatSpreadable"),Vt=!f((function(){var t=[];return t[Nt]=!1,t.concat()[0]!==t})),qt=(U="concat",!f((function(){var t=[];return(t.constructor={})[Lt]=function(){return{foo:1}},1!==t[U](Boolean).foo}))),zt=function(t){if(!x(t))return!1;var e=t[Nt];return void 0!==e?!!e:It(t)};_t({target:"Array",proto:!0,forced:!Vt||!qt},{concat:function(t){var e,n,r,o,i,a=kt(this),c=Bt(a,0),u=0;for(e=-1,r=arguments.length;e<r;e++)if(i=-1===e?a:arguments[e],zt(i)){if(u+(o=ut(i.length))>9007199254740991)throw TypeError("Maximum allowed index exceeded");for(n=0;n<o;n++,u++)n in i&&Mt(c,u,i[n])}else{if(u>=9007199254740991)throw TypeError("Maximum allowed index exceeded");Mt(c,u++,i)}return c.length=u,c}});var Wt=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(String(t)+" is not a function")}(t),void 0===e)return t;switch(n){case 0:return function(){return t.call(e)};case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}},Gt=[].push,Ht=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,a=5==t||i;return function(c,u,f,l){for(var s,d,p=kt(c),h=b(p),v=Wt(u,f,3),y=ut(h.length),g=0,m=l||Bt,w=e?m(c,y):n?m(c,0):void 0;y>g;g++)if((a||g in h)&&(d=v(s=h[g],g,p),t))if(e)w[g]=d;else if(d)switch(t){case 3:return!0;case 5:return s;case 6:return g;case 2:Gt.call(w,s)}else if(o)return!1;return i?-1:r||o?o:w}},Kt={forEach:Ht(0),map:Ht(1),filter:Ht(2),some:Ht(3),every:Ht(4),find:Ht(5),findIndex:Ht(6)},Qt=Object.keys||function(t){return ht(t,vt)},Yt=l?Object.defineProperties:function(t,e){k(t);for(var n,r=Qt(e),o=r.length,i=0;o>i;)R.f(t,n=r[i++],e[n]);return t},Zt=rt("document","documentElement"),Jt=W("IE_PROTO"),Ut=function(){},Xt=function(){var t,e=P("iframe"),n=vt.length;for(e.style.display="none",Zt.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),Xt=t.F;n--;)delete Xt.prototype[vt[n]];return Xt()},te=Object.create||function(t,e){var n;return null!==t?(Ut.prototype=k(t),n=new Ut,Ut.prototype=null,n[Jt]=t):n=Xt(),void 0===e?n:Yt(n,e)};G[Jt]=!0;var ee=$t("unscopables"),ne=Array.prototype;null==ne[ee]&&C(ne,ee,te(null));var re,oe=Kt.find,ie=!0;"find"in[]&&Array(1).find((function(){ie=!1})),_t({target:"Array",proto:!0,forced:ie},{find:function(t){return oe(this,t,arguments.length>1?arguments[1]:void 0)}}),re="find",ne[ee][re]=!0;var ae=function(t,e){var n=[][t];return!n||!f((function(){n.call(null,e||function(){throw 1},1)}))},ce=dt.indexOf,ue=[].indexOf,fe=!!ue&&1/[1].indexOf(1,-0)<0,le=ae("indexOf");_t({target:"Array",proto:!0,forced:fe||le},{indexOf:function(t){return fe?ue.apply(this,arguments)||0:ce(this,t,arguments.length>1?arguments[1]:void 0)}});var se=[].join,de=b!=Object,pe=ae("join",",");_t({target:"Array",proto:!0,forced:de||pe},{join:function(t){return se.call(w(this),void 0===t?",":t)}});var he,ve,ye=function(){var t=k(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e},ge=RegExp.prototype.exec,be=String.prototype.replace,me=ge,we=(he=/a/,ve=/b*/g,ge.call(he,"a"),ge.call(ve,"a"),0!==he.lastIndex||0!==ve.lastIndex),xe=void 0!==/()??/.exec("")[1];(we||xe)&&(me=function(t){var e,n,r,o,i=this;return xe&&(n=new RegExp("^"+i.source+"$(?!\\s)",ye.call(i))),we&&(e=i.lastIndex),r=ge.call(i,t),we&&r&&(i.lastIndex=i.global?r.index+r[0].length:e),xe&&r&&r.length>1&&be.call(r[0],n,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)})),r});var Oe=me,je=$t("species"),Se=!f((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),Ee=!f((function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var n="ab".split(t);return 2!==n.length||"a"!==n[0]||"b"!==n[1]})),Te=function(t){return function(e,n){var r,o,i=String(m(e)),a=at(n),c=i.length;return a<0||a>=c?t?"":void 0:(r=i.charCodeAt(a))<55296||r>56319||a+1===c||(o=i.charCodeAt(a+1))<56320||o>57343?t?i.charAt(a):r:t?i.slice(a,a+2):o-56320+(r-55296<<10)+65536}},Pe={codeAt:Te(!1),charAt:Te(!0)}.charAt,Ae=function(t,e,n){return e+(n?Pe(t,e).length:1)},_e=function(t,e){var n=t.exec;if("function"==typeof n){var r=n.call(t,e);if("object"!=typeof r)throw TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==y(t))throw TypeError("RegExp#exec called on incompatible receiver");return Oe.call(t,e)},Ie=Math.max,ke=Math.min,Me=Math.floor,Re=/\$([$&'`]|\d\d?|<[^>]*>)/g,Ce=/\$([$&'`]|\d\d?)/g;function Fe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function $e(t){return($e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function De(t,e){return(De=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Be(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Le(t,e,n){return(Le="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=$e(t)););return t}(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(n):o.value}})(t,e,n||t)}!function(t,e,n,r){var o=$t(t),i=!f((function(){var e={};return e[o]=function(){return 7},7!=""[t](e)})),a=i&&!f((function(){var e=!1,n=/a/;return n.exec=function(){return e=!0,null},"split"===t&&(n.constructor={},n.constructor[je]=function(){return n}),n[o](""),!e}));if(!i||!a||"replace"===t&&!Se||"split"===t&&!Ee){var c=/./[o],u=n(o,""[t],(function(t,e,n,r,o){return e.exec===Oe?i&&!o?{done:!0,value:c.call(e,n,r)}:{done:!0,value:t.call(n,e,r)}:{done:!1}})),l=u[0],s=u[1];tt(String.prototype,t,l),tt(RegExp.prototype,o,2==e?function(t,e){return s.call(t,this,e)}:function(t){return s.call(t,this)}),r&&C(RegExp.prototype[o],"sham",!0)}}("replace",2,(function(t,e,n){return[function(n,r){var o=m(this),i=null==n?void 0:n[t];return void 0!==i?i.call(n,o,r):e.call(String(o),n,r)},function(t,o){var i=n(e,t,this,o);if(i.done)return i.value;var a=k(t),c=String(this),u="function"==typeof o;u||(o=String(o));var f=a.global;if(f){var l=a.unicode;a.lastIndex=0}for(var s=[];;){var d=_e(a,c);if(null===d)break;if(s.push(d),!f)break;""===String(d[0])&&(a.lastIndex=Ae(c,ut(a.lastIndex),l))}for(var p,h="",v=0,y=0;y<s.length;y++){d=s[y];for(var g=String(d[0]),b=Ie(ke(at(d.index),c.length),0),m=[],w=1;w<d.length;w++)m.push(void 0===(p=d[w])?p:String(p));var x=d.groups;if(u){var O=[g].concat(m,b,c);void 0!==x&&O.push(x);var j=String(o.apply(void 0,O))}else j=r(g,c,b,m,x,o);b>=v&&(h+=c.slice(v,b)+j,v=b+g.length)}return h+c.slice(v)}];function r(t,n,r,o,i,a){var c=r+t.length,u=o.length,f=Ce;return void 0!==i&&(i=kt(i),f=Re),e.call(a,f,(function(e,a){var f;switch(a.charAt(0)){case"$":return"$";case"&":return t;case"`":return n.slice(0,r);case"'":return n.slice(c);case"<":f=i[a.slice(1,-1)];break;default:var l=+a;if(0===l)return e;if(l>u){var s=Me(l/10);return 0===s?e:s<=u?void 0===o[s-1]?a.charAt(1):o[s-1]+a.charAt(1):e}f=o[l-1]}return void 0===f?"":f}))}}));var Ne=t.fn.bootstrapTable.utils;t.extend(t.fn.bootstrapTable.defaults,{editable:!0,onEditableInit:function(){return!1},onEditableSave:function(t,e,n,r,o){return!1},onEditableShown:function(t,e,n,r){return!1},onEditableHidden:function(t,e,n,r){return!1}}),t.extend(t.fn.bootstrapTable.Constructor.EVENTS,{"editable-init.bs.table":"onEditableInit","editable-save.bs.table":"onEditableSave","editable-shown.bs.table":"onEditableShown","editable-hidden.bs.table":"onEditableHidden"}),t.BootstrapTable=function(e){function n(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),Be(this,$e(n).apply(this,arguments))}var r,o,i;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&De(t,e)}(n,e),r=n,(o=[{key:"initTable",value:function(){var e=this;Le($e(n.prototype),"initTable",this).call(this),this.options.editable&&t.each(this.columns,(function(n,r){if(r.editable){var o={},i=[],a=function(t,e){var n=t.replace(/([A-Z])/g,(function(t){return"-".concat(t.toLowerCase())}));0===n.indexOf("editable-")&&(o[n.replace("editable-","data-")]=e)};t.each(e.options,a),r.formatter=r.formatter||function(t){return t},r._formatter=r._formatter?r._formatter:r.formatter,r.formatter=function(n,c,u){var f=Ne.calculateObjectValue(r,r._formatter,[n,c,u],n);f=null==f?e.options.undefinedText:f,t.each(r,a),t.each(o,(function(t,e){i.push(" ".concat(t,'="').concat(e,'"'))}));var l=!1;return r.editable.hasOwnProperty("noeditFormatter")&&(l=r.editable.noeditFormatter(n,c,u)),!1===l?'<a href="javascript:void(0)"\n data-name="'.concat(r.field,'"\n data-pk="').concat(c[e.options.idField],'"\n data-value="').concat(f,'"\n ').concat(i.join(""),"></a>"):l}}}))}},{key:"initBody",value:function(e){var r=this;Le($e(n.prototype),"initBody",this).call(this,e),this.options.editable&&(t.each(this.columns,(function(e,n){if(n.editable){var o=r.getData(),i=r.$body.find('a[data-name="'.concat(n.field,'"]'));i.each((function(e,r){var i=t(r),a=i.closest("tr").data("index"),c=o[a],u=Ne.calculateObjectValue(n,n.editable,[a,c,i],{});i.editable(u)})),i.off("save").on("save",(function(e,o){var i=e.currentTarget,a=o.submitValue,c=t(i),u=r.getData(),f=c.parents("tr[data-index]").data("index"),l=u[f],s=l[n.field];c.data("value",a),l[n.field]=a,r.trigger("editable-save",n.field,l,f,s,c),r.initBody()})),i.off("shown").on("shown",(function(e,o){var i=e.currentTarget,a=t(i),c=r.getData()[a.parents("tr[data-index]").data("index")];r.trigger("editable-shown",n.field,c,a,o)})),i.off("hidden").on("hidden",(function(e,o){var i=e.currentTarget,a=t(i),c=r.getData()[a.parents("tr[data-index]").data("index")];r.trigger("editable-hidden",n.field,c,a,o)}))}})),this.trigger("editable-init"))}}])&&Fe(r.prototype,o),i&&Fe(r,i),n}(t.BootstrapTable)}));