bootstrap-table-reorder-rows.min.js 13 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.19.1
  5. * @homepage https://bootstrap-table.com
  6. * @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
  7. * @license MIT
  8. */
  9. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).jQuery)}(this,(function(t){"use strict";function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var n=e(t);function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(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 i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function u(t,e){return(u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(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 c(t){var e=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 n,r=i(t);if(e){var o=i(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return a(this,n)}}function f(t,e,n){return(f="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=i(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)}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function l(t,e){return t(e={exports:{}},e.exports),e.exports}var p=function(t){return t&&t.Math==Math&&t},d=p("object"==typeof globalThis&&globalThis)||p("object"==typeof window&&window)||p("object"==typeof self&&self)||p("object"==typeof s&&s)||function(){return this}()||Function("return this")(),h=function(t){try{return!!t()}catch(t){return!0}},y=!h((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),g={}.propertyIsEnumerable,v=Object.getOwnPropertyDescriptor,b={f:v&&!g.call({1:2},1)?function(t){var e=v(this,t);return!!e&&e.enumerable}:g},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},m={}.toString,O=function(t){return m.call(t).slice(8,-1)},S="".split,j=h((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==O(t)?S.call(t,""):Object(t)}:Object,x=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},R=function(t){return j(x(t))},T=function(t){return"object"==typeof t?null!==t:"function"==typeof t},D=function(t,e){if(!T(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!T(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!T(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!T(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},P={}.hasOwnProperty,E=function(t,e){return P.call(t,e)},_=d.document,k=T(_)&&T(_.createElement),A=!y&&!h((function(){return 7!=Object.defineProperty((t="div",k?_.createElement(t):{}),"a",{get:function(){return 7}}).a;var t})),I=Object.getOwnPropertyDescriptor,M={f:y?I:function(t,e){if(t=R(t),e=D(e,!0),A)try{return I(t,e)}catch(t){}if(E(t,e))return w(!b.f.call(t,e),t[e])}},C=function(t){if(!T(t))throw TypeError(String(t)+" is not an object");return t},B=Object.defineProperty,F={f:y?B:function(t,e,n){if(C(t),e=D(e,!0),C(n),A)try{return B(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}},N=y?function(t,e,n){return F.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},L=function(t,e){try{N(d,t,e)}catch(n){d[t]=e}return e},q="__core-js_shared__",$=d[q]||L(q,{}),z=Function.toString;"function"!=typeof $.inspectSource&&($.inspectSource=function(t){return z.call(t)});var H,G,V,W,K=$.inspectSource,Q=d.WeakMap,Y="function"==typeof Q&&/native code/.test(K(Q)),J=l((function(t){(t.exports=function(t,e){return $[t]||($[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.10.1",mode:"global",copyright:"© 2021 Denis Pushkarev (zloirock.ru)"})})),U=0,X=Math.random(),Z=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++U+X).toString(36)},tt=J("keys"),et={},nt=d.WeakMap;if(Y){var rt=$.state||($.state=new nt),ot=rt.get,it=rt.has,ut=rt.set;H=function(t,e){return e.facade=t,ut.call(rt,t,e),e},G=function(t){return ot.call(rt,t)||{}},V=function(t){return it.call(rt,t)}}else{var at=tt[W="state"]||(tt[W]=Z(W));et[at]=!0,H=function(t,e){return e.facade=t,N(t,at,e),e},G=function(t){return E(t,at)?t[at]:{}},V=function(t){return E(t,at)}}var ct,ft,st={set:H,get:G,has:V,enforce:function(t){return V(t)?G(t):H(t,{})},getterFor:function(t){return function(e){var n;if(!T(e)||(n=G(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},lt=l((function(t){var e=st.get,n=st.enforce,r=String(String).split("String");(t.exports=function(t,e,o,i){var u,a=!!i&&!!i.unsafe,c=!!i&&!!i.enumerable,f=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||E(o,"name")||N(o,"name",e),(u=n(o)).source||(u.source=r.join("string"==typeof e?e:""))),t!==d?(a?!f&&t[e]&&(c=!0):delete t[e],c?t[e]=o:N(t,e,o)):c?t[e]=o:L(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||K(this)}))})),pt=d,dt=function(t){return"function"==typeof t?t:void 0},ht=function(t,e){return arguments.length<2?dt(pt[t])||dt(d[t]):pt[t]&&pt[t][e]||d[t]&&d[t][e]},yt=Math.ceil,gt=Math.floor,vt=function(t){return isNaN(t=+t)?0:(t>0?gt:yt)(t)},bt=Math.min,wt=function(t){return t>0?bt(vt(t),9007199254740991):0},mt=Math.max,Ot=Math.min,St=function(t,e){var n=vt(t);return n<0?mt(n+e,0):Ot(n,e)},jt=function(t){return function(e,n,r){var o,i=R(e),u=wt(i.length),a=St(r,u);if(t&&n!=n){for(;u>a;)if((o=i[a++])!=o)return!0}else for(;u>a;a++)if((t||a in i)&&i[a]===n)return t||a||0;return!t&&-1}},xt={includes:jt(!0),indexOf:jt(!1)},Rt=xt.indexOf,Tt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),Dt={f:Object.getOwnPropertyNames||function(t){return function(t,e){var n,r=R(t),o=0,i=[];for(n in r)!E(et,n)&&E(r,n)&&i.push(n);for(;e.length>o;)E(r,n=e[o++])&&(~Rt(i,n)||i.push(n));return i}(t,Tt)}},Pt={f:Object.getOwnPropertySymbols},Et=ht("Reflect","ownKeys")||function(t){var e=Dt.f(C(t)),n=Pt.f;return n?e.concat(n(t)):e},_t=function(t,e){for(var n=Et(e),r=F.f,o=M.f,i=0;i<n.length;i++){var u=n[i];E(t,u)||r(t,u,o(e,u))}},kt=/#|\.prototype\./,At=function(t,e){var n=Mt[It(t)];return n==Bt||n!=Ct&&("function"==typeof e?h(e):!!e)},It=At.normalize=function(t){return String(t).replace(kt,".").toLowerCase()},Mt=At.data={},Ct=At.NATIVE="N",Bt=At.POLYFILL="P",Ft=At,Nt=M.f,Lt=function(t,e){var n,r,o,i,u,a=t.target,c=t.global,f=t.stat;if(n=c?d:f?d[a]||L(a,{}):(d[a]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(u=Nt(n,r))&&u.value:n[r],!Ft(c?r:a+(f?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;_t(i,o)}(t.sham||o&&o.sham)&&N(i,"sham",!0),lt(n,r,i,t)}},qt=Array.isArray||function(t){return"Array"==O(t)},$t=function(t){return Object(x(t))},zt=function(t,e,n){var r=D(e);r in t?F.f(t,r,w(0,n)):t[r]=n},Ht="process"==O(d.process),Gt=ht("navigator","userAgent")||"",Vt=d.process,Wt=Vt&&Vt.versions,Kt=Wt&&Wt.v8;Kt?ft=(ct=Kt.split("."))[0]+ct[1]:Gt&&(!(ct=Gt.match(/Edge\/(\d+)/))||ct[1]>=74)&&(ct=Gt.match(/Chrome\/(\d+)/))&&(ft=ct[1]);var Qt=ft&&+ft,Yt=!!Object.getOwnPropertySymbols&&!h((function(){return!Symbol.sham&&(Ht?38===Qt:Qt>37&&Qt<41)})),Jt=Yt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ut=J("wks"),Xt=d.Symbol,Zt=Jt?Xt:Xt&&Xt.withoutSetter||Z,te=function(t){return E(Ut,t)&&(Yt||"string"==typeof Ut[t])||(Yt&&E(Xt,t)?Ut[t]=Xt[t]:Ut[t]=Zt("Symbol."+t)),Ut[t]},ee=te("species"),ne=function(t,e){var n;return qt(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!qt(n.prototype)?T(n)&&null===(n=n[ee])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},re=te("species"),oe=function(t){return Qt>=51||!h((function(){var e=[];return(e.constructor={})[re]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},ie=te("isConcatSpreadable"),ue=9007199254740991,ae="Maximum allowed index exceeded",ce=Qt>=51||!h((function(){var t=[];return t[ie]=!1,t.concat()[0]!==t})),fe=oe("concat"),se=function(t){if(!T(t))return!1;var e=t[ie];return void 0!==e?!!e:qt(t)};Lt({target:"Array",proto:!0,forced:!ce||!fe},{concat:function(t){var e,n,r,o,i,u=$t(this),a=ne(u,0),c=0;for(e=-1,r=arguments.length;e<r;e++)if(se(i=-1===e?u:arguments[e])){if(c+(o=wt(i.length))>ue)throw TypeError(ae);for(n=0;n<o;n++,c++)n in i&&zt(a,c,i[n])}else{if(c>=ue)throw TypeError(ae);zt(a,c++,i)}return a.length=c,a}});var le,pe,de=xt.indexOf,he=[].indexOf,ye=!!he&&1/[1].indexOf(1,-0)<0,ge=!!(pe=[]["indexOf"])&&h((function(){pe.call(null,le||function(){throw 1},1)}));Lt({target:"Array",proto:!0,forced:ye||!ge},{indexOf:function(t){return ye?he.apply(this,arguments)||0:de(this,t,arguments.length>1?arguments[1]:void 0)}});var ve=oe("splice"),be=Math.max,we=Math.min,me=9007199254740991,Oe="Maximum allowed length exceeded";Lt({target:"Array",proto:!0,forced:!ve},{splice:function(t,e){var n,r,o,i,u,a,c=$t(this),f=wt(c.length),s=St(t,f),l=arguments.length;if(0===l?n=r=0:1===l?(n=0,r=f-s):(n=l-2,r=we(be(vt(e),0),f-s)),f+n-r>me)throw TypeError(Oe);for(o=ne(c,r),i=0;i<r;i++)(u=s+i)in c&&zt(o,i,c[u]);if(o.length=r,n<r){for(i=s;i<f-r;i++)a=i+n,(u=i+r)in c?c[a]=c[u]:delete c[a];for(i=f;i>f-r+n;i--)delete c[i-1]}else if(n>r)for(i=f-r;i>s;i--)a=i+n-1,(u=i+r-1)in c?c[a]=c[u]:delete c[a];for(i=0;i<n;i++)c[i+s]=arguments[i+2];return c.length=f-r+n,o}});var Se=function(t,e){return{id:"customId_".concat(e)}};n.default.extend(n.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}}),n.default.extend(n.default.fn.bootstrapTable.Constructor.EVENTS,{"reorder-row.bs.table":"onReorderRow"}),n.default.BootstrapTable=function(t){!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&&u(t,e)}(p,t);var e,a,s,l=c(p);function p(){return r(this,p),l.apply(this,arguments)}return e=p,(a=[{key:"init",value:function(){for(var t,e=this,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];if(this.options.reorderableRows){this.options.useRowAttrFunc&&(this.options.rowAttributes=Se);var u=this.options.onPostBody;this.options.onPostBody=function(){setTimeout((function(){e.makeRowsReorderable(),u.call(e.options,e.options.data)}),1)},(t=f(i(p.prototype),"init",this)).call.apply(t,[this].concat(r))}else{var a;(a=f(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,onDragStart:function(e,n){return t.onDropStart(e,n)},onDrop:function(e,n){return t.onDrop(e,n)},dragHandle:this.options.dragHandle})}},{key:"onDropStart",value:function(t,e){this.$draggingTd=n.default(e).css("cursor","move"),this.draggingIndex=n.default(this.$draggingTd.parent()).data("index"),this.options.onReorderRowsDrag(this.data[this.draggingIndex])}},{key:"onDrop",value:function(t){this.$draggingTd.css("cursor","");for(var e=[],r=0;r<t.tBodies[0].rows.length;r++){var o=n.default(t.tBodies[0].rows[r]);e.push(this.data[o.data("index")]),o.data("index",r)}var i=this.data[this.draggingIndex],u=e.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",e,i,a)}},{key:"initSearch",value:function(){this.ignoreInitSort=!0,f(i(p.prototype),"initSearch",this).call(this)}},{key:"initSort",value:function(){this.ignoreInitSort?this.ignoreInitSort=!1:f(i(p.prototype),"initSort",this).call(this)}}])&&o(e.prototype,a),s&&o(e,s),p}(n.default.BootstrapTable)}));