bootstrap-table-reorder-rows.min.js 17 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.20.1
  5. * @homepage https://bootstrap-table.com
  6. * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
  7. * @license MIT
  8. */
  9. !function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).jQuery)}(this,(function(t){"use strict";function n(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var e=n(t);function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function o(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t){return i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},i(t)}function u(t,n){return u=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t},u(t,n)}function a(t,n){if(n&&("object"==typeof n||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function c(t){var n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var e,r=i(t);if(n){var o=i(this).constructor;e=Reflect.construct(r,arguments,o)}else e=r.apply(this,arguments);return a(this,e)}}function f(t,n){for(;!Object.prototype.hasOwnProperty.call(t,n)&&null!==(t=i(t)););return t}function l(){return l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,n,e){var r=f(t,n);if(r){var o=Object.getOwnPropertyDescriptor(r,n);return o.get?o.get.call(arguments.length<3?t:e):o.value}},l.apply(this,arguments)}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function p(t,n){return t(n={exports:{}},n.exports),n.exports}var d,y,h=function(t){return t&&t.Math==Math&&t},g=h("object"==typeof globalThis&&globalThis)||h("object"==typeof window&&window)||h("object"==typeof self&&self)||h("object"==typeof s&&s)||function(){return this}()||Function("return this")(),b=function(t){try{return!!t()}catch(t){return!0}},v=!b((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=!b((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),m=Function.prototype.call,O=w?m.bind(m):function(){return m.apply(m,arguments)},S={}.propertyIsEnumerable,j=Object.getOwnPropertyDescriptor,D={f:j&&!S.call({1:2},1)?function(t){var n=j(this,t);return!!n&&n.enumerable}:S},x=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}},P=Function.prototype,R=P.bind,T=P.call,E=w&&R.bind(T,T),A=w?function(t){return t&&E(t)}:function(t){return t&&function(){return T.apply(t,arguments)}},k=A({}.toString),I=A("".slice),_=function(t){return I(k(t),8,-1)},C=g.Object,F=A("".split),M=b((function(){return!C("z").propertyIsEnumerable(0)}))?function(t){return"String"==_(t)?F(t,""):C(t)}:C,B=g.TypeError,z=function(t){if(null==t)throw B("Can't call method on "+t);return t},L=function(t){return M(z(t))},N=function(t){return"function"==typeof t},G=function(t){return"object"==typeof t?null!==t:N(t)},$=function(t){return N(t)?t:void 0},q=function(t,n){return arguments.length<2?$(g[t]):g[t]&&g[t][n]},H=A({}.isPrototypeOf),U=q("navigator","userAgent")||"",V=g.process,W=g.Deno,K=V&&V.versions||W&&W.version,Q=K&&K.v8;Q&&(y=(d=Q.split("."))[0]>0&&d[0]<4?1:+(d[0]+d[1])),!y&&U&&(!(d=U.match(/Edge\/(\d+)/))||d[1]>=74)&&(d=U.match(/Chrome\/(\d+)/))&&(y=+d[1]);var X=y,Y=!!Object.getOwnPropertySymbols&&!b((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&X&&X<41})),J=Y&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Z=g.Object,tt=J?function(t){return"symbol"==typeof t}:function(t){var n=q("Symbol");return N(n)&&H(n.prototype,Z(t))},nt=g.String,et=g.TypeError,rt=function(t){if(N(t))return t;throw et(function(t){try{return nt(t)}catch(t){return"Object"}}(t)+" is not a function")},ot=g.TypeError,it=Object.defineProperty,ut=function(t,n){try{it(g,t,{value:n,configurable:!0,writable:!0})}catch(e){g[t]=n}return n},at="__core-js_shared__",ct=g[at]||ut(at,{}),ft=p((function(t){(t.exports=function(t,n){return ct[t]||(ct[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.22.4",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.22.4/LICENSE",source:"https://github.com/zloirock/core-js"})})),lt=g.Object,st=function(t){return lt(z(t))},pt=A({}.hasOwnProperty),dt=Object.hasOwn||function(t,n){return pt(st(t),n)},yt=0,ht=Math.random(),gt=A(1..toString),bt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+gt(++yt+ht,36)},vt=ft("wks"),wt=g.Symbol,mt=wt&&wt.for,Ot=J?wt:wt&&wt.withoutSetter||bt,St=function(t){if(!dt(vt,t)||!Y&&"string"!=typeof vt[t]){var n="Symbol."+t;Y&&dt(wt,t)?vt[t]=wt[t]:vt[t]=J&&mt?mt(n):Ot(n)}return vt[t]},jt=g.TypeError,Dt=St("toPrimitive"),xt=function(t,n){if(!G(t)||tt(t))return t;var e,r,o=null==(e=t[Dt])?void 0:rt(e);if(o){if(void 0===n&&(n="default"),r=O(o,t,n),!G(r)||tt(r))return r;throw jt("Can't convert object to primitive value")}return void 0===n&&(n="number"),function(t,n){var e,r;if("string"===n&&N(e=t.toString)&&!G(r=O(e,t)))return r;if(N(e=t.valueOf)&&!G(r=O(e,t)))return r;if("string"!==n&&N(e=t.toString)&&!G(r=O(e,t)))return r;throw ot("Can't convert object to primitive value")}(t,n)},Pt=function(t){var n=xt(t,"string");return tt(n)?n:n+""},Rt=g.document,Tt=G(Rt)&&G(Rt.createElement),Et=!v&&!b((function(){return 7!=Object.defineProperty((t="div",Tt?Rt.createElement(t):{}),"a",{get:function(){return 7}}).a;var t})),At=Object.getOwnPropertyDescriptor,kt={f:v?At:function(t,n){if(t=L(t),n=Pt(n),Et)try{return At(t,n)}catch(t){}if(dt(t,n))return x(!O(D.f,t,n),t[n])}},It=v&&b((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),_t=g.String,Ct=g.TypeError,Ft=function(t){if(G(t))return t;throw Ct(_t(t)+" is not an object")},Mt=g.TypeError,Bt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,Lt="enumerable",Nt="configurable",Gt="writable",$t={f:v?It?function(t,n,e){if(Ft(t),n=Pt(n),Ft(e),"function"==typeof t&&"prototype"===n&&"value"in e&&Gt in e&&!e.writable){var r=zt(t,n);r&&r.writable&&(t[n]=e.value,e={configurable:Nt in e?e.configurable:r.configurable,enumerable:Lt in e?e.enumerable:r.enumerable,writable:!1})}return Bt(t,n,e)}:Bt:function(t,n,e){if(Ft(t),n=Pt(n),Ft(e),Et)try{return Bt(t,n,e)}catch(t){}if("get"in e||"set"in e)throw Mt("Accessors not supported");return"value"in e&&(t[n]=e.value),t}},qt=v?function(t,n,e){return $t.f(t,n,x(1,e))}:function(t,n,e){return t[n]=e,t},Ht=Function.prototype,Ut=v&&Object.getOwnPropertyDescriptor,Vt=dt(Ht,"name"),Wt={EXISTS:Vt,PROPER:Vt&&"something"===function(){}.name,CONFIGURABLE:Vt&&(!v||v&&Ut(Ht,"name").configurable)},Kt=A(Function.toString);N(ct.inspectSource)||(ct.inspectSource=function(t){return Kt(t)});var Qt,Xt,Yt,Jt,Zt=ct.inspectSource,tn=g.WeakMap,nn=N(tn)&&/native code/.test(Zt(tn)),en=ft("keys"),rn={},on="Object already initialized",un=g.TypeError,an=g.WeakMap;if(nn||ct.state){var cn=ct.state||(ct.state=new an),fn=A(cn.get),ln=A(cn.has),sn=A(cn.set);Qt=function(t,n){if(ln(cn,t))throw new un(on);return n.facade=t,sn(cn,t,n),n},Xt=function(t){return fn(cn,t)||{}},Yt=function(t){return ln(cn,t)}}else{var pn=en[Jt="state"]||(en[Jt]=bt(Jt));rn[pn]=!0,Qt=function(t,n){if(dt(t,pn))throw new un(on);return n.facade=t,qt(t,pn,n),n},Xt=function(t){return dt(t,pn)?t[pn]:{}},Yt=function(t){return dt(t,pn)}}var dn={set:Qt,get:Xt,has:Yt,enforce:function(t){return Yt(t)?Xt(t):Qt(t,{})},getterFor:function(t){return function(n){var e;if(!G(n)||(e=Xt(n)).type!==t)throw un("Incompatible receiver, "+t+" required");return e}}},yn=p((function(t){var n=$t.f,e=Wt.CONFIGURABLE,r=dn.enforce,o=dn.get,i=!b((function(){return 8!==n((function(){}),"length",{value:8}).length})),u=String(String).split("String"),a=t.exports=function(t,o,a){"Symbol("===String(o).slice(0,7)&&(o="["+String(o).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),a&&a.getter&&(o="get "+o),a&&a.setter&&(o="set "+o),(!dt(t,"name")||e&&t.name!==o)&&n(t,"name",{value:o,configurable:!0}),i&&a&&dt(a,"arity")&&t.length!==a.arity&&n(t,"length",{value:a.arity});var c=r(t);return dt(c,"source")||(c.source=u.join("string"==typeof o?o:"")),t};Function.prototype.toString=a((function(){return N(this)&&o(this).source||Zt(this)}),"toString")})),hn=function(t,n,e,r){var o=!!r&&!!r.unsafe,i=!!r&&!!r.enumerable,u=!!r&&!!r.noTargetGet,a=r&&void 0!==r.name?r.name:n;return N(e)&&yn(e,a,r),t===g?(i?t[n]=e:ut(n,e),t):(o?!u&&t[n]&&(i=!0):delete t[n],i?t[n]=e:qt(t,n,e),t)},gn=Math.ceil,bn=Math.floor,vn=function(t){var n=+t;return n!=n||0===n?0:(n>0?bn:gn)(n)},wn=Math.max,mn=Math.min,On=function(t,n){var e=vn(t);return e<0?wn(e+n,0):mn(e,n)},Sn=Math.min,jn=function(t){return(n=t.length)>0?Sn(vn(n),9007199254740991):0;var n},Dn=function(t){return function(n,e,r){var o,i=L(n),u=jn(i),a=On(r,u);if(t&&e!=e){for(;u>a;)if((o=i[a++])!=o)return!0}else for(;u>a;a++)if((t||a in i)&&i[a]===e)return t||a||0;return!t&&-1}},xn={includes:Dn(!0),indexOf:Dn(!1)},Pn=xn.indexOf,Rn=A([].push),Tn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),En=Object.getOwnPropertyNames||function(t){return function(t,n){var e,r=L(t),o=0,i=[];for(e in r)!dt(rn,e)&&dt(r,e)&&Rn(i,e);for(;n.length>o;)dt(r,e=n[o++])&&(~Pn(i,e)||Rn(i,e));return i}(t,Tn)},An={f:En},kn={f:Object.getOwnPropertySymbols},In=A([].concat),_n=q("Reflect","ownKeys")||function(t){var n=An.f(Ft(t)),e=kn.f;return e?In(n,e(t)):n},Cn=function(t,n,e){for(var r=_n(n),o=$t.f,i=kt.f,u=0;u<r.length;u++){var a=r[u];dt(t,a)||e&&dt(e,a)||o(t,a,i(n,a))}},Fn=/#|\.prototype\./,Mn=function(t,n){var e=zn[Bn(t)];return e==Nn||e!=Ln&&(N(n)?b(n):!!n)},Bn=Mn.normalize=function(t){return String(t).replace(Fn,".").toLowerCase()},zn=Mn.data={},Ln=Mn.NATIVE="N",Nn=Mn.POLYFILL="P",Gn=Mn,$n=kt.f,qn=function(t,n){var e,r,o,i,u,a=t.target,c=t.global,f=t.stat;if(e=c?g:f?g[a]||ut(a,{}):(g[a]||{}).prototype)for(r in n){if(i=n[r],o=t.noTargetGet?(u=$n(e,r))&&u.value:e[r],!Gn(c?r:a+(f?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;Cn(i,o)}(t.sham||o&&o.sham)&&qt(i,"sham",!0),hn(e,r,i,t)}},Hn=Array.isArray||function(t){return"Array"==_(t)},Un=function(t,n,e){var r=Pt(n);r in t?$t.f(t,r,x(0,e)):t[r]=e},Vn={};Vn[St("toStringTag")]="z";var Wn="[object z]"===String(Vn),Kn=St("toStringTag"),Qn=g.Object,Xn="Arguments"==_(function(){return arguments}()),Yn=Wn?_:function(t){var n,e,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,n){try{return t[n]}catch(t){}}(n=Qn(t),Kn))?e:Xn?_(n):"Object"==(r=_(n))&&N(n.callee)?"Arguments":r},Jn=function(){},Zn=[],te=q("Reflect","construct"),ne=/^\s*(?:class|function)\b/,ee=A(ne.exec),re=!ne.exec(Jn),oe=function(t){if(!N(t))return!1;try{return te(Jn,Zn,t),!0}catch(t){return!1}},ie=function(t){if(!N(t))return!1;switch(Yn(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return re||!!ee(ne,Zt(t))}catch(t){return!0}};ie.sham=!0;var ue=!te||b((function(){var t;return oe(oe.call)||!oe(Object)||!oe((function(){t=!0}))||t}))?ie:oe,ae=St("species"),ce=g.Array,fe=function(t,n){return new(function(t){var n;return Hn(t)&&(n=t.constructor,(ue(n)&&(n===ce||Hn(n.prototype))||G(n)&&null===(n=n[ae]))&&(n=void 0)),void 0===n?ce:n}(t))(0===n?0:n)},le=St("species"),se=function(t){return X>=51||!b((function(){var n=[];return(n.constructor={})[le]=function(){return{foo:1}},1!==n[t](Boolean).foo}))},pe=St("isConcatSpreadable"),de=9007199254740991,ye="Maximum allowed index exceeded",he=g.TypeError,ge=X>=51||!b((function(){var t=[];return t[pe]=!1,t.concat()[0]!==t})),be=se("concat"),ve=function(t){if(!G(t))return!1;var n=t[pe];return void 0!==n?!!n:Hn(t)};qn({target:"Array",proto:!0,arity:1,forced:!ge||!be},{concat:function(t){var n,e,r,o,i,u=st(this),a=fe(u,0),c=0;for(n=-1,r=arguments.length;n<r;n++)if(ve(i=-1===n?u:arguments[n])){if(c+(o=jn(i))>de)throw he(ye);for(e=0;e<o;e++,c++)e in i&&Un(a,c,i[e])}else{if(c>=de)throw he(ye);Un(a,c++,i)}return a.length=c,a}});var we,me,Oe=xn.indexOf,Se=A([].indexOf),je=!!Se&&1/Se([1],1,-0)<0,De=!!(me=[]["indexOf"])&&b((function(){me.call(null,we||function(){return 1},1)}));qn({target:"Array",proto:!0,forced:je||!De},{indexOf:function(t){var n=arguments.length>1?arguments[1]:void 0;return je?Se(this,t,n)||0:Oe(this,t,n)}});var xe=se("splice"),Pe=g.TypeError,Re=Math.max,Te=Math.min,Ee=9007199254740991,Ae="Maximum allowed length exceeded";qn({target:"Array",proto:!0,forced:!xe},{splice:function(t,n){var e,r,o,i,u,a,c=st(this),f=jn(c),l=On(t,f),s=arguments.length;if(0===s?e=r=0:1===s?(e=0,r=f-l):(e=s-2,r=Te(Re(vn(n),0),f-l)),f+e-r>Ee)throw Pe(Ae);for(o=fe(c,r),i=0;i<r;i++)(u=l+i)in c&&Un(o,i,c[u]);if(o.length=r,e<r){for(i=l;i<f-r;i++)a=i+e,(u=i+r)in c?c[a]=c[u]:delete c[a];for(i=f;i>f-r+e;i--)delete c[i-1]}else if(e>r)for(i=f-r;i>l;i--)a=i+e-1,(u=i+r-1)in c?c[a]=c[u]:delete c[a];for(i=0;i<e;i++)c[i+l]=arguments[i+2];return c.length=f-r+e,o}});var ke=function(t,n){return{id:"customId_".concat(n)}};e.default.extend(e.default.fn.bootstrapTable.defaults,{reorderableRows:!1,onDragStyle:null,onDropStyle:null,onDragClass:"reorder_rows_onDragClass",dragHandle:">tbody>tr>td:not(.bs-checkbox)",useRowAttrFunc:!1,onReorderRowsDrag:function(t){return!1},onReorderRowsDrop:function(t){return!1},onReorderRow:function(t){return!1},onDragStop:function(){},onAllowDrop:function(){return!0}}),e.default.extend(e.default.fn.bootstrapTable.Constructor.EVENTS,{"reorder-row.bs.table":"onReorderRow"}),e.default.BootstrapTable=function(t){!function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&u(t,n)}(p,t);var n,a,f,s=c(p);function p(){return r(this,p),s.apply(this,arguments)}return n=p,a=[{key:"init",value:function(){for(var t,n=this,e=arguments.length,r=new Array(e),o=0;o<e;o++)r[o]=arguments[o];if(this.options.reorderableRows){this.options.useRowAttrFunc&&(this.options.rowAttributes=ke);var u=this.options.onPostBody;this.options.onPostBody=function(){setTimeout((function(){n.makeRowsReorderable(),u.call(n.options,n.options.data)}),1)},(t=l(i(p.prototype),"init",this)).call.apply(t,[this].concat(r))}else{var a;(a=l(i(p.prototype),"init",this)).call.apply(a,[this].concat(r))}}},{key:"makeRowsReorderable",value:function(){var t=this;this.$el.tableDnD({onDragStyle:this.options.onDragStyle,onDropStyle:this.options.onDropStyle,onDragClass:this.options.onDragClass,onAllowDrop:function(n,e){return t.onAllowDrop(n,e)},onDragStop:function(n,e){return t.onDragStop(n,e)},onDragStart:function(n,e){return t.onDropStart(n,e)},onDrop:function(n,e){return t.onDrop(n,e)},dragHandle:this.options.dragHandle})}},{key:"onDropStart",value:function(t,n){this.$draggingTd=e.default(n).css("cursor","move"),this.draggingIndex=e.default(this.$draggingTd.parent()).data("index"),this.options.onReorderRowsDrag(this.data[this.draggingIndex])}},{key:"onDragStop",value:function(t,n){var r=e.default(n).data("index"),o=this.data[r];this.options.onDragStop(t,o,n)}},{key:"onAllowDrop",value:function(t,n){var r=e.default(n).data("index"),o=e.default(t).data("index"),i=this.data[r],u=this.data[o];return this.options.onAllowDrop(u,i,t,n)}},{key:"onDrop",value:function(t){this.$draggingTd.css("cursor","");for(var n=[],r=0;r<t.tBodies[0].rows.length;r++){var o=e.default(t.tBodies[0].rows[r]);n.push(this.data[o.data("index")]),o.data("index",r)}var i=this.data[this.draggingIndex],u=n.indexOf(this.data[this.draggingIndex]),a=this.data[u],c=this.options.data.indexOf(this.data[u]);this.options.data.splice(this.options.data.indexOf(i),1),this.options.data.splice(c,0,i),this.initSearch(),this.options.onReorderRowsDrop(a),this.trigger("reorder-row",n,i,a)}},{key:"initSearch",value:function(){this.ignoreInitSort=!0,l(i(p.prototype),"initSearch",this).call(this)}},{key:"initSort",value:function(){this.ignoreInitSort?this.ignoreInitSort=!1:l(i(p.prototype),"initSort",this).call(this)}}],a&&o(n.prototype,a),f&&o(n,f),Object.defineProperty(n,"prototype",{writable:!1}),p}(e.default.BootstrapTable)}));