bootstrap-table-editable.min.js 16 KB

12345678910
  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.0
  5. * @homepage https://bootstrap-table.com
  6. * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
  7. * @license MIT
  8. */
  9. (function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],b):(a=a||self,b(a.jQuery))})(this,function(a){'use strict';var n=Math.max,o=Math.min,p=Math.floor;function b(a,b){return b={exports:{}},a(b,b.exports),b.exports}function c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function d(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)}function e(a,b,c){return b&&d(a.prototype,b),c&&d(a,c),a}function g(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function");a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),b&&i(a,b)}function h(a){return h=Object.setPrototypeOf?Object.getPrototypeOf:function(a){return a.__proto__||Object.getPrototypeOf(a)},h(a)}function i(a,b){return i=Object.setPrototypeOf||function(a,b){return a.__proto__=b,a},i(a,b)}function j(a){if(void 0===a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a}function k(a,b){return b&&("object"==typeof b||"function"==typeof b)?b:j(a)}function l(a,b){for(;!Object.prototype.hasOwnProperty.call(a,b)&&(a=h(a),null!==a););return a}function m(a,b,c){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(a,b,c){var d=l(a,b);if(d){var e=Object.getOwnPropertyDescriptor(d,b);return e.get?e.get.call(c):e.value}},m(a,b,c||a)}a=a&&a.hasOwnProperty("default")?a["default"]:a;var q,r,s,t={}.toString,u=function(a){return t.call(a).slice(8,-1)},v=Array.isArray||function(a){return"Array"==u(a)},w=function(a){return"object"==typeof a?null!==a:"function"==typeof a},x=function(a){if(a==null)throw TypeError("Can't call method on "+a);return a},y=function(a){return Object(x(a))},z=Math.ceil,A=function(a){return isNaN(a=+a)?0:(0<a?p:z)(a)},B=function(a){return 0<a?o(A(a),9007199254740991):0},C=function(a,b){if(!w(a))return a;var c,d;if(b&&"function"==typeof(c=a.toString)&&!w(d=c.call(a)))return d;if("function"==typeof(c=a.valueOf)&&!w(d=c.call(a)))return d;if(!b&&"function"==typeof(c=a.toString)&&!w(d=c.call(a)))return d;throw TypeError("Can't convert object to primitive value")},D=function(a){try{return!!a()}catch(a){return!0}},E=!D(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),F="object"==typeof window&&window&&window.Math==Math?window:"object"==typeof self&&self&&self.Math==Math?self:Function("return this")(),G=F.document,H=w(G)&&w(G.createElement),I=function(a){return H?G.createElement(a):{}},J=!E&&!D(function(){return 7!=Object.defineProperty(I("div"),"a",{get:function(){return 7}}).a}),K=function(a){if(!w(a))throw TypeError(a+" is not an object");return a},L=Object.defineProperty,M=E?L:function(a,b,c){if(K(a),b=C(b,!0),K(c),J)try{return L(a,b,c)}catch(a){}if("get"in c||"set"in c)throw TypeError("Accessors not supported");return"value"in c&&(a[b]=c.value),a},f={f:M},N=function(a,b){return{enumerable:!(1&a),configurable:!(2&a),writable:!(4&a),value:b}},O=function(a,b,c){var d=C(b);d in a?f.f(a,d,N(0,c)):a[d]=c},P=E?function(a,b,c){return f.f(a,b,N(1,c))}:function(a,b,c){return a[b]=c,a},Q=function(a,b){try{P(F,a,b)}catch(c){F[a]=b}return b},R=b(function(a){var b=F["__core-js_shared__"]||Q("__core-js_shared__",{});(a.exports=function(a,c){return b[a]||(b[a]=c===void 0?{}:c)})("versions",[]).push({version:"3.0.0",mode:"global",copyright:"\xA9 2019 Denis Pushkarev (zloirock.ru)"})}),S=0,T=Math.random(),U=function(a){return"Symbol(".concat(a===void 0?"":a,")_",(++S+T).toString(36))},V=!D(function(){}),W=R("wks"),X=F.Symbol,Y=function(a){return W[a]||(W[a]=V&&X[a]||(V?X:U)("Symbol."+a))},Z=Y("species"),_=function(a,b){var c;return v(a)&&(c=a.constructor,"function"==typeof c&&(c===Array||v(c.prototype))?c=void 0:w(c)&&(c=c[Z],null===c&&(c=void 0))),new(void 0===c?Array:c)(0===b?0:b)},aa=Y("species"),ba={}.propertyIsEnumerable,ca=Object.getOwnPropertyDescriptor,da=ca&&!ba.call({1:2},1),ea=da?function(a){var b=ca(this,a);return!!b&&b.enumerable}:ba,fa={f:ea},ga="".split,ha=D(function(){return!Object("z").propertyIsEnumerable(0)})?function(a){return"String"==u(a)?ga.call(a,""):Object(a)}:Object,ia=function(a){return ha(x(a))},ja={}.hasOwnProperty,ka=function(a,b){return ja.call(a,b)},la=Object.getOwnPropertyDescriptor,ma=E?la:function(a,b){if(a=ia(a),b=C(b,!0),J)try{return la(a,b)}catch(a){}return ka(a,b)?N(!fa.f.call(a,b),a[b]):void 0},na={f:ma},oa=R("native-function-to-string",Function.toString),pa=F.WeakMap,qa="function"==typeof pa&&/native code/.test(oa.call(pa)),ra=R("keys"),sa=function(a){return ra[a]||(ra[a]=U(a))},ta={},ua=F.WeakMap,va=function(a){return s(a)?r(a):q(a,{})};if(qa){var wa=new ua,xa=wa.get,ya=wa.has,za=wa.set;q=function(a,b){return za.call(wa,a,b),b},r=function(a){return xa.call(wa,a)||{}},s=function(a){return ya.call(wa,a)}}else{var Aa=sa("state");ta[Aa]=!0,q=function(a,b){return P(a,Aa,b),b},r=function(a){return ka(a,Aa)?a[Aa]:{}},s=function(a){return ka(a,Aa)}}var Ba={set:q,get:r,has:s,enforce:va,getterFor:function(a){return function(b){var c;if(!w(b)||(c=r(b)).type!==a)throw TypeError("Incompatible receiver, "+a+" required");return c}}},Ca=b(function(a){var b=Ba.get,c=Ba.enforce,d=(oa+"").split("toString");R("inspectSource",function(a){return oa.call(a)}),(a.exports=function(a,b,e,f){var g=!!f&&!!f.unsafe,h=!!f&&!!f.enumerable,i=!!f&&!!f.noTargetGet;return("function"==typeof e&&("string"==typeof b&&!ka(e,"name")&&P(e,"name",b),c(e).source=d.join("string"==typeof b?b:"")),a===F)?void(h?a[b]=e:Q(b,e)):void(g?!i&&a[b]&&(h=!0):delete a[b],h?a[b]=e:P(a,b,e))})(Function.prototype,"toString",function(){return"function"==typeof this&&b(this).source||oa.call(this)})}),Da=function(a,b){var c=A(a);return 0>c?n(c+b,0):o(c,b)},Ea=function(a){return function(b,c,d){var e,f=ia(b),g=B(f.length),h=Da(d,g);if(a&&c!=c){for(;g>h;)if(e=f[h++],e!=e)return!0;}else for(;g>h;h++)if((a||h in f)&&f[h]===c)return a||h||0;return!a&&-1}},Fa=Ea(!1),Ga=function(a,b){var c,d=ia(a),e=0,f=[];for(c in d)!ka(ta,c)&&ka(d,c)&&f.push(c);for(;b.length>e;)ka(d,c=b[e++])&&(~Fa(f,c)||f.push(c));return f},Ha=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Ia=Ha.concat("length","prototype"),Ja=Object.getOwnPropertyNames||function(a){return Ga(a,Ia)},Ka={f:Ja},La=Object.getOwnPropertySymbols,Ma={f:La},Na=F.Reflect,Oa=Na&&Na.ownKeys||function(a){var b=Ka.f(K(a)),c=Ma.f;return c?b.concat(c(a)):b},Pa=function(a,b){for(var c,d=Oa(b),e=f.f,g=na.f,h=0;h<d.length;h++)c=d[h],ka(a,c)||e(a,c,g(b,c))},Qa=/#|\.prototype\./,Ra=function(a,b){var c=Ta[Sa(a)];return!(c!=Va)||c!=Ua&&("function"==typeof b?D(b):!!b)},Sa=Ra.normalize=function(a){return(a+"").replace(Qa,".").toLowerCase()},Ta=Ra.data={},Ua=Ra.NATIVE="N",Va=Ra.POLYFILL="P",Wa=na.f,Xa=function(a,b){var c,d,e,f,g,h,i=a.target,j=a.global,k=a.stat;if(d=j?F:k?F[i]||Q(i,{}):(F[i]||{}).prototype,d)for(e in b){if(g=b[e],a.noTargetGet?(h=Wa(d,e),f=h&&h.value):f=d[e],c=Ra(j?e:i+(k?".":"#")+e,a.forced),!c&&void 0!==f){if(typeof g==typeof f)continue;Pa(g,f)}(a.sham||f&&f.sham)&&P(g,"sham",!0),Ca(d,e,g,a)}},Ya=Y("isConcatSpreadable"),Za=9007199254740991,$a="Maximum allowed index exceeded",_a=!D(function(){var a=[];return a[Ya]=!1,a.concat()[0]!==a}),ab=function(a){return!D(function(){var b=[],c=b.constructor={};return c[aa]=function(){return{foo:1}},1!==b[a](Boolean).foo})}("concat"),bb=function(a){if(!w(a))return!1;var b=a[Ya];return b===void 0?v(a):!!b};Xa({target:"Array",proto:!0,forced:!_a||!ab},{concat:function(){var a,b,c,d,e,f=y(this),g=_(f,0),h=0;for(a=-1,c=arguments.length;a<c;a++)if(e=-1===a?f:arguments[a],bb(e)){if(d=B(e.length),h+d>Za)throw TypeError($a);for(b=0;b<d;b++,h++)b in e&&O(g,h,e[b])}else{if(h>=Za)throw TypeError($a);O(g,h++,e)}return g.length=h,g}});var cb=function(a){if("function"!=typeof a)throw TypeError(a+" is not a function");return a},db=function(d,e,f){return(cb(d),void 0===e)?d:0===f?function(){return d.call(e)}:1===f?function(b){return d.call(e,b)}:2===f?function(c,a){return d.call(e,c,a)}:3===f?function(f,a,b){return d.call(e,f,a,b)}:function(){return d.apply(e,arguments)}},eb=Object.keys||function(a){return Ga(a,Ha)},fb=E?Object.defineProperties:function(a,b){K(a);for(var c,d=eb(b),e=d.length,g=0;e>g;)f.f(a,c=d[g++],b[c]);return a},gb=F.document,hb=gb&&gb.documentElement,ib=sa("IE_PROTO"),jb="prototype",kb=function(){},lb=function(){var a,b=I("iframe"),c=Ha.length,d="<",e="script",f=">";for(b.style.display="none",hb.appendChild(b),b.src="java"+e+":"+"",a=b.contentWindow.document,a.open(),a.write(d+e+f+"document.F=Object"+d+"/"+e+f),a.close(),lb=a.F;c--;)delete lb[jb][Ha[c]];return lb()},mb=Object.create||function(a,b){var c;return null===a?c=lb():(kb[jb]=K(a),c=new kb,kb[jb]=null,c[ib]=a),void 0===b?c:fb(c,b)};ta[ib]=!0;var nb=Y("unscopables"),ob=Array.prototype;ob[nb]==null&&P(ob,nb,mb(null));var pb=function(a,b){var c=1==a,d=4==a,e=6==a,f=b||_;return function(b,g,h){for(var i,j,k=y(b),l=ha(k),m=db(g,h,3),n=B(l.length),o=0,p=c?f(b,n):2==a?f(b,0):void 0;n>o;o++)if((5==a||e||o in l)&&(i=l[o],j=m(i,o,k),a))if(c)p[o]=j;else if(j)switch(a){case 3:return!0;case 5:return i;case 6:return o;case 2:p.push(i);}else if(d)return!1;return e?-1:3==a||d?d:p}}(5),qb="find",rb=!0;qb in[]&&[,][qb](function(){rb=!1}),Xa({target:"Array",proto:!0,forced:rb},{find:function(a){return pb(this,a,1<arguments.length?arguments[1]:void 0)}}),function(a){ob[nb][a]=!0}(qb);var sb=function(a,b){var c=[][a];return!c||!D(function(){c.call(null,b||function(){throw Error()},1)})},tb=Ea(!1),ub=[].indexOf,vb=!!ub&&0>1/[1].indexOf(1,-0),wb=sb("indexOf");Xa({target:"Array",proto:!0,forced:vb||wb},{indexOf:function(a){return vb?ub.apply(this,arguments)||0:tb(this,a,arguments[1])}});var xb=[].join,yb=ha!=Object,zb=sb("join",",");Xa({target:"Array",proto:!0,forced:yb||zb},{join:function(a){return xb.call(ia(this),a===void 0?",":a)}});var Ab=function(a,b,c){var d,e,f=x(a)+"",g=A(b),h=f.length;return 0>g||g>=h?c?"":void 0:(d=f.charCodeAt(g),55296>d||56319<d||g+1===h||56320>(e=f.charCodeAt(g+1))||57343<e?c?f.charAt(g):d:c?f.slice(g,g+2):(d-55296<<10)+(e-56320)+65536)},Bb=function(a,b,c){return b+(c?Ab(a,b,!0).length:1)},Cb=function(){var a=K(this),b="";return a.global&&(b+="g"),a.ignoreCase&&(b+="i"),a.multiline&&(b+="m"),a.unicode&&(b+="u"),a.sticky&&(b+="y"),b},Db=RegExp.prototype.exec,Eb=String.prototype.replace,Fb=Db,Gb=function(){var a=/a/,b=/b*/g;return Db.call(a,"a"),Db.call(b,"a"),0!==a.lastIndex||0!==b.lastIndex}(),Hb=/()??/.exec("")[1]!==void 0;(Gb||Hb)&&(Fb=function(a){var b,c,d,e,f=this;return Hb&&(c=new RegExp("^"+f.source+"$(?!\\s)",Cb.call(f))),Gb&&(b=f.lastIndex),d=Db.call(f,a),Gb&&d&&(f.lastIndex=f.global?d.index+d[0].length:b),Hb&&d&&1<d.length&&Eb.call(d[0],c,function(){for(e=1;e<arguments.length-2;e++)void 0===arguments[e]&&(d[e]=void 0)}),d});var Ib=Fb,Jb=function(a,b){var c=a.exec;if("function"==typeof c){var d=c.call(a,b);if("object"!=typeof d)throw TypeError("RegExp exec method returned something other than an Object or null");return d}if("RegExp"!==u(a))throw TypeError("RegExp#exec called on incompatible receiver");return Ib.call(a,b)},Kb=Y("species"),Lb=!D(function(){var a=/./;return a.exec=function(){var a=[];return a.groups={a:"7"},a},"7"!=="".replace(a,"$<a>")}),Mb=!D(function(){var a=/(?:)/,b=a.exec;a.exec=function(){return b.apply(this,arguments)};var c="ab".split(a);return 2!==c.length||"a"!==c[0]||"b"!==c[1]}),Nb=/\$([$&`']|\d\d?|<[^>]*>)/g,Ob=/\$([$&`']|\d\d?)/g,Pb=function(a){return a===void 0?a:a+""};(function(a,b,c,d){var e=Y(a),f=!D(function(){var b={};return b[e]=function(){return 7},7!=""[a](b)}),g=f&&!D(function(){var b=!1,c=/a/;return c.exec=function(){return b=!0,null},"split"===a&&(c.constructor={},c.constructor[Kb]=function(){return c}),c[e](""),!b});if(!f||!g||"replace"===a&&!Lb||"split"===a&&!Mb){var h=/./[e],i=c(e,""[a],function(a,b,c,d,e){return b.exec===Ib?f&&!e?{done:!0,value:h.call(b,c,d)}:{done:!0,value:a.call(c,b,d)}:{done:!1}}),j=i[0],k=i[1];Ca(String.prototype,a,j),Ca(RegExp.prototype,e,2==b?function(a,b){return k.call(a,this,b)}:function(a){return k.call(a,this)}),d&&P(RegExp.prototype[e],"sham",!0)}})("replace",2,function(a,b,c){function d(a,c,d,e,g,h){var i=d+a.length,j=e.length,f=Ob;return void 0!==g&&(g=y(g),f=Nb),b.call(h,f,function(b,h){var k;switch(h.charAt(0)){case"$":return"$";case"&":return a;case"`":return c.slice(0,d);case"'":return c.slice(i);case"<":k=g[h.slice(1,-1)];break;default:var l=+h;if(0==l)return b;if(l>j){var m=p(l/10);return 0===m?b:m<=j?void 0===e[m-1]?h.charAt(1):e[m-1]+h.charAt(1):b}k=e[l-1];}return void 0===k?"":k})}return[function(c,d){var e=x(this),f=c==null?void 0:c[a];return f===void 0?b.call(e+"",c,d):f.call(c,e,d)},function(a,e){var f=c(b,a,this,e);if(f.done)return f.value;var g=K(a),h=this+"",k="function"==typeof e;k||(e=e+"");var l=g.global;if(l){var m=g.unicode;g.lastIndex=0}for(var p,q=[];(p=Jb(g,h),null!==p)&&!(q.push(p),!l);){var r=p[0]+"";""==r&&(g.lastIndex=Bb(h,B(g.lastIndex),m))}for(var s="",t=0,u=0;u<q.length;u++){p=q[u];for(var v=p[0]+"",w=n(o(A(p.index),h.length),0),x=[],y=1;y<p.length;y++)x.push(Pb(p[y]));var z=p.groups;if(k){var C=[v].concat(x,w,h);z!==void 0&&C.push(z);var D=e.apply(void 0,C)+""}else D=d(v,h,w,x,z,e);w>=t&&(s+=h.slice(t,w)+D,t=w+v.length)}return s+h.slice(t)}]});var Qb=a.fn.bootstrapTable.utils;a.extend(a.fn.bootstrapTable.defaults,{editable:!0,onEditableInit:function(){return!1},onEditableSave:function(){return!1},onEditableShown:function(){return!1},onEditableHidden:function(){return!1}}),a.extend(a.fn.bootstrapTable.Constructor.EVENTS,{"editable-init.bs.table":"onEditableInit","editable-save.bs.table":"onEditableSave","editable-shown.bs.table":"onEditableShown","editable-hidden.bs.table":"onEditableHidden"}),a.BootstrapTable=function(b){function d(){return c(this,d),k(this,h(d).apply(this,arguments))}return g(d,b),e(d,[{key:"initTable",value:function(){var b=this;m(h(d.prototype),"initTable",this).call(this),this.options.editable&&a.each(this.columns,function(c,d){if(d.editable){var e={},f=[],g="editable-",h=function(a,b){var c=a.replace(/([A-Z])/g,function(a){return"-".concat(a.toLowerCase())});0===c.indexOf(g)&&(e[c.replace(g,"data-")]=b)};a.each(b.options,h),d.formatter=d.formatter||function(a){return a},d._formatter=d._formatter?d._formatter:d.formatter,d.formatter=function(c,g,i){var j=Qb.calculateObjectValue(d,d._formatter,[c,g,i],c);j="undefined"==typeof j||null===j?b.options.undefinedText:j,a.each(d,h),a.each(e,function(a,b){f.push(" ".concat(a,"=\"").concat(b,"\""))});var k=!1;return d.editable.hasOwnProperty("noeditFormatter")&&(k=d.editable.noeditFormatter(c,g,i)),!1===k?"<a href=\"javascript:void(0)\"\n data-name=\"".concat(d.field,"\"\n data-pk=\"").concat(g[b.options.idField],"\"\n data-value=\"").concat(j,"\"\n ").concat(f.join(""),"></a>"):k}}})}},{key:"initBody",value:function(b){var c=this;m(h(d.prototype),"initBody",this).call(this,b),this.options.editable&&(a.each(this.columns,function(b,d){if(d.editable){var e=c.getData(),f=c.$body.find("a[data-name=\"".concat(d.field,"\"]"));f.each(function(b,c){var f=a(c),g=f.closest("tr"),h=g.data("index"),i=e[h],j=Qb.calculateObjectValue(d,d.editable,[h,i,f],{});f.editable(j)}),f.off("save").on("save",function(b,e){var f=b.currentTarget,g=e.submitValue,h=a(f),i=c.getData(),j=h.parents("tr[data-index]").data("index"),k=i[j],l=k[d.field];h.data("value",g),k[d.field]=g,c.trigger("editable-save",d.field,k,j,l,h),c.initBody()}),f.off("shown").on("shown",function(b,e){var f=b.currentTarget,g=a(f),h=c.getData(),i=g.parents("tr[data-index]").data("index"),j=h[i];c.trigger("editable-shown",d.field,j,g,e)}),f.off("hidden").on("hidden",function(b,e){var f=b.currentTarget,g=a(f),h=c.getData(),i=g.parents("tr[data-index]").data("index"),j=h[i];c.trigger("editable-hidden",d.field,j,g,e)})}}),this.trigger("editable-init"))}}]),d}(a.BootstrapTable)});