bootstrap-table-copy-rows.min.js 15 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.18.2
  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),r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(t,e){return t(e={exports:{}},e.exports),e.exports}var i=function(t){return t&&t.Math==Math&&t},u=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof r&&r)||function(){return this}()||Function("return this")(),c=function(t){try{return!!t()}catch(t){return!0}},a=!c((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),f={}.propertyIsEnumerable,l=Object.getOwnPropertyDescriptor,s={f:l&&!f.call({1:2},1)?function(t){var e=l(this,t);return!!e&&e.enumerable}:f},p=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},y={}.toString,d=function(t){return y.call(t).slice(8,-1)},h="".split,b=c((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==d(t)?h.call(t,""):Object(t)}:Object,v=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},g=function(t){return b(v(t))},m=function(t){return"object"==typeof t?null!==t:"function"==typeof t},w=function(t,e){if(!m(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!m(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!m(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!m(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},O={}.hasOwnProperty,j=function(t,e){return O.call(t,e)},S=u.document,T=m(S)&&m(S.createElement),C=function(t){return T?S.createElement(t):{}},P=!a&&!c((function(){return 7!=Object.defineProperty(C("div"),"a",{get:function(){return 7}}).a})),E=Object.getOwnPropertyDescriptor,R={f:a?E:function(t,e){if(t=g(t),e=w(e,!0),P)try{return E(t,e)}catch(t){}if(j(t,e))return p(!s.f.call(t,e),t[e])}},x=function(t){if(!m(t))throw TypeError(String(t)+" is not an object");return t},A=Object.defineProperty,_={f:a?A:function(t,e,n){if(x(t),e=w(e,!0),x(n),P)try{return A(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}},k=a?function(t,e,n){return _.f(t,e,p(1,n))}:function(t,e,n){return t[e]=n,t},F=function(t,e){try{k(u,t,e)}catch(n){u[t]=e}return e},M="__core-js_shared__",B=u[M]||F(M,{}),D=Function.toString;"function"!=typeof B.inspectSource&&(B.inspectSource=function(t){return D.call(t)});var I,N,W,q=B.inspectSource,L=u.WeakMap,z="function"==typeof L&&/native code/.test(q(L)),$=o((function(t){(t.exports=function(t,e){return B[t]||(B[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.8.1",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),H=0,G=Math.random(),V=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++H+G).toString(36)},K=$("keys"),Q=function(t){return K[t]||(K[t]=V(t))},X={},Y=u.WeakMap;if(z){var J=B.state||(B.state=new Y),U=J.get,Z=J.has,tt=J.set;I=function(t,e){return e.facade=t,tt.call(J,t,e),e},N=function(t){return U.call(J,t)||{}},W=function(t){return Z.call(J,t)}}else{var et=Q("state");X[et]=!0,I=function(t,e){return e.facade=t,k(t,et,e),e},N=function(t){return j(t,et)?t[et]:{}},W=function(t){return j(t,et)}}var nt,rt,ot={set:I,get:N,has:W,enforce:function(t){return W(t)?N(t):I(t,{})},getterFor:function(t){return function(e){var n;if(!m(e)||(n=N(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},it=o((function(t){var e=ot.get,n=ot.enforce,r=String(String).split("String");(t.exports=function(t,e,o,i){var c,a=!!i&&!!i.unsafe,f=!!i&&!!i.enumerable,l=!!i&&!!i.noTargetGet;"function"==typeof o&&("string"!=typeof e||j(o,"name")||k(o,"name",e),(c=n(o)).source||(c.source=r.join("string"==typeof e?e:""))),t!==u?(a?!l&&t[e]&&(f=!0):delete t[e],f?t[e]=o:k(t,e,o)):f?t[e]=o:F(e,o)})(Function.prototype,"toString",(function(){return"function"==typeof this&&e(this).source||q(this)}))})),ut=u,ct=function(t){return"function"==typeof t?t:void 0},at=function(t,e){return arguments.length<2?ct(ut[t])||ct(u[t]):ut[t]&&ut[t][e]||u[t]&&u[t][e]},ft=Math.ceil,lt=Math.floor,st=function(t){return isNaN(t=+t)?0:(t>0?lt:ft)(t)},pt=Math.min,yt=function(t){return t>0?pt(st(t),9007199254740991):0},dt=Math.max,ht=Math.min,bt=function(t){return function(e,n,r){var o,i=g(e),u=yt(i.length),c=function(t,e){var n=st(t);return n<0?dt(n+e,0):ht(n,e)}(r,u);if(t&&n!=n){for(;u>c;)if((o=i[c++])!=o)return!0}else for(;u>c;c++)if((t||c in i)&&i[c]===n)return t||c||0;return!t&&-1}},vt={includes:bt(!0),indexOf:bt(!1)}.indexOf,gt=function(t,e){var n,r=g(t),o=0,i=[];for(n in r)!j(X,n)&&j(r,n)&&i.push(n);for(;e.length>o;)j(r,n=e[o++])&&(~vt(i,n)||i.push(n));return i},mt=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],wt=mt.concat("length","prototype"),Ot={f:Object.getOwnPropertyNames||function(t){return gt(t,wt)}},jt={f:Object.getOwnPropertySymbols},St=at("Reflect","ownKeys")||function(t){var e=Ot.f(x(t)),n=jt.f;return n?e.concat(n(t)):e},Tt=function(t,e){for(var n=St(e),r=_.f,o=R.f,i=0;i<n.length;i++){var u=n[i];j(t,u)||r(t,u,o(e,u))}},Ct=/#|\.prototype\./,Pt=function(t,e){var n=Rt[Et(t)];return n==At||n!=xt&&("function"==typeof e?c(e):!!e)},Et=Pt.normalize=function(t){return String(t).replace(Ct,".").toLowerCase()},Rt=Pt.data={},xt=Pt.NATIVE="N",At=Pt.POLYFILL="P",_t=Pt,kt=R.f,Ft=function(t,e){var n,r,o,i,c,a=t.target,f=t.global,l=t.stat;if(n=f?u:l?u[a]||F(a,{}):(u[a]||{}).prototype)for(r in e){if(i=e[r],o=t.noTargetGet?(c=kt(n,r))&&c.value:n[r],!_t(f?r:a+(l?".":"#")+r,t.forced)&&void 0!==o){if(typeof i==typeof o)continue;Tt(i,o)}(t.sham||o&&o.sham)&&k(i,"sham",!0),it(n,r,i,t)}},Mt=Array.isArray||function(t){return"Array"==d(t)},Bt=function(t){return Object(v(t))},Dt=function(t,e,n){var r=w(e);r in t?_.f(t,r,p(0,n)):t[r]=n},It=!!Object.getOwnPropertySymbols&&!c((function(){return!String(Symbol())})),Nt=It&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Wt=$("wks"),qt=u.Symbol,Lt=Nt?qt:qt&&qt.withoutSetter||V,zt=function(t){return j(Wt,t)||(It&&j(qt,t)?Wt[t]=qt[t]:Wt[t]=Lt("Symbol."+t)),Wt[t]},$t=zt("species"),Ht=function(t,e){var n;return Mt(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!Mt(n.prototype)?m(n)&&null===(n=n[$t])&&(n=void 0):n=void 0),new(void 0===n?Array:n)(0===e?0:e)},Gt=at("navigator","userAgent")||"",Vt=u.process,Kt=Vt&&Vt.versions,Qt=Kt&&Kt.v8;Qt?rt=(nt=Qt.split("."))[0]+nt[1]:Gt&&(!(nt=Gt.match(/Edge\/(\d+)/))||nt[1]>=74)&&(nt=Gt.match(/Chrome\/(\d+)/))&&(rt=nt[1]);var Xt,Yt=rt&&+rt,Jt=zt("species"),Ut=zt("isConcatSpreadable"),Zt=9007199254740991,te="Maximum allowed index exceeded",ee=Yt>=51||!c((function(){var t=[];return t[Ut]=!1,t.concat()[0]!==t})),ne=(Xt="concat",Yt>=51||!c((function(){var t=[];return(t.constructor={})[Jt]=function(){return{foo:1}},1!==t[Xt](Boolean).foo}))),re=function(t){if(!m(t))return!1;var e=t[Ut];return void 0!==e?!!e:Mt(t)};Ft({target:"Array",proto:!0,forced:!ee||!ne},{concat:function(t){var e,n,r,o,i,u=Bt(this),c=Ht(u,0),a=0;for(e=-1,r=arguments.length;e<r;e++)if(re(i=-1===e?u:arguments[e])){if(a+(o=yt(i.length))>Zt)throw TypeError(te);for(n=0;n<o;n++,a++)n in i&&Dt(c,a,i[n])}else{if(a>=Zt)throw TypeError(te);Dt(c,a++,i)}return c.length=a,c}});var oe,ie=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)}},ue=[].push,ce=function(t){var e=1==t,n=2==t,r=3==t,o=4==t,i=6==t,u=7==t,c=5==t||i;return function(a,f,l,s){for(var p,y,d=Bt(a),h=b(d),v=ie(f,l,3),g=yt(h.length),m=0,w=s||Ht,O=e?w(a,g):n||u?w(a,0):void 0;g>m;m++)if((c||m in h)&&(y=v(p=h[m],m,d),t))if(e)O[m]=y;else if(y)switch(t){case 3:return!0;case 5:return p;case 6:return m;case 2:ue.call(O,p)}else switch(t){case 4:return!1;case 7:ue.call(O,p)}return i?-1:r||o?o:O}},ae={forEach:ce(0),map:ce(1),filter:ce(2),some:ce(3),every:ce(4),find:ce(5),findIndex:ce(6),filterOut:ce(7)},fe=Object.keys||function(t){return gt(t,mt)},le=a?Object.defineProperties:function(t,e){x(t);for(var n,r=fe(e),o=r.length,i=0;o>i;)_.f(t,n=r[i++],e[n]);return t},se=at("document","documentElement"),pe=Q("IE_PROTO"),ye=function(){},de=function(t){return"<script>"+t+"</"+"script>"},he=function(){try{oe=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,e;he=oe?function(t){t.write(de("")),t.close();var e=t.parentWindow.Object;return t=null,e}(oe):((e=C("iframe")).style.display="none",se.appendChild(e),e.src=String("javascript:"),(t=e.contentWindow.document).open(),t.write(de("document.F=Object")),t.close(),t.F);for(var n=mt.length;n--;)delete he.prototype[mt[n]];return he()};X[pe]=!0;var be=Object.create||function(t,e){var n;return null!==t?(ye.prototype=x(t),n=new ye,ye.prototype=null,n[pe]=t):n=he(),void 0===e?n:le(n,e)},ve=zt("unscopables"),ge=Array.prototype;null==ge[ve]&&_.f(ge,ve,{configurable:!0,value:be(null)});var me,we=Object.defineProperty,Oe={},je=function(t){throw t},Se=ae.find,Te="find",Ce=!0,Pe=function(t,e){if(j(Oe,t))return Oe[t];e||(e={});var n=[][t],r=!!j(e,"ACCESSORS")&&e.ACCESSORS,o=j(e,0)?e[0]:je,i=j(e,1)?e[1]:void 0;return Oe[t]=!!n&&!c((function(){if(r&&!a)return!0;var t={length:-1};r?we(t,1,{enumerable:!0,get:je}):t[1]=1,n.call(t,o,i)}))}(Te);Te in[]&&Array(1).find((function(){Ce=!1})),Ft({target:"Array",proto:!0,forced:Ce||!Pe},{find:function(t){return Se(this,t,arguments.length>1?arguments[1]:void 0)}}),me=Te,ge[ve][me]=!0;var Ee=[].join,Re=b!=Object,xe=function(t,e){var n=[][t];return!!n&&c((function(){n.call(null,e||function(){throw 1},1)}))}("join",",");Ft({target:"Array",proto:!0,forced:Re||!xe},{join:function(t){return Ee.call(g(this),void 0===t?",":t)}});var Ae=Object.assign,_e=Object.defineProperty,ke=!Ae||c((function(){if(a&&1!==Ae({b:1},Ae(_e({},"a",{enumerable:!0,get:function(){_e(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=Ae({},t)[n]||fe(Ae({},e)).join("")!=r}))?function(t,e){for(var n=Bt(t),r=arguments.length,o=1,i=jt.f,u=s.f;r>o;)for(var c,f=b(arguments[o++]),l=i?fe(f).concat(i(f)):fe(f),p=l.length,y=0;p>y;)c=l[y++],a&&!u.call(f,c)||(n[c]=f[c]);return n}:Ae;function Fe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Me(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 Be(t){return(Be=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 Ie(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 Ne(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 Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,r=Be(t);if(e){var o=Be(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Ie(this,n)}}function We(t,e,n){return(We="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=Be(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)}Ft({target:"Object",stat:!0,forced:Object.assign!==ke},{assign:ke});var qe=n.default.fn.bootstrapTable.utils;n.default.extend(n.default.fn.bootstrapTable.locales,{formatCopyRows:function(){return"Copy Rows"}}),n.default.extend(n.default.fn.bootstrapTable.defaults,n.default.fn.bootstrapTable.locales),n.default.extend(n.default.fn.bootstrapTable.defaults.icons,{copy:{bootstrap3:"glyphicon-copy icon-pencil",materialize:"content_copy","bootstrap-table":"icon-copy"}[n.default.fn.bootstrapTable.theme]||"fa-copy"});n.default.extend(n.default.fn.bootstrapTable.defaults,{showCopyRows:!1,copyWithHidden:!1,copyDelimiter:", ",copyNewline:"\n"}),n.default.fn.bootstrapTable.methods.push("copyColumnsToClipboard"),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&&De(t,e)}(u,t);var e,r,o,i=Ne(u);function u(){return Fe(this,u),i.apply(this,arguments)}return e=u,(r=[{key:"initToolbar",value:function(){var t;this.options.showCopyRows&&this.header.stateField&&(this.buttons=Object.assign(this.buttons,{copyRows:{text:this.options.formatCopyRows(),icon:this.options.icons.copy,event:this.copyColumnsToClipboard,attributes:{"aria-label":this.options.formatCopyRows(),title:this.options.formatCopyRows()}}}));for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];(t=We(Be(u.prototype),"initToolbar",this)).call.apply(t,[this].concat(n)),this.$copyButton=this.$toolbar.find('>.columns [name="copyRows"]'),this.options.showCopyRows&&this.header.stateField&&this.updateCopyButton()}},{key:"copyColumnsToClipboard",value:function(){var t=this,e=[];n.default.each(this.getSelections(),(function(r,o){var i=[];n.default.each(t.options.columns[0],(function(e,n){n.field!==t.header.stateField&&(!t.options.copyWithHidden||t.options.copyWithHidden&&n.visible)&&null!==o[n.field]&&i.push(qe.calculateObjectValue(n,t.header.formatters[e],[o[n.field],o,r],o[n.field]))})),e.push(i.join(t.options.copyDelimiter))})),function(t){var e=document.createElement("textarea");n.default(e).html(t),document.body.appendChild(e),e.select();try{document.execCommand("copy")}catch(t){console.warn("Oops, unable to copy")}n.default(e).remove()}(e.join(this.options.copyNewline))}},{key:"updateSelected",value:function(){We(Be(u.prototype),"updateSelected",this).call(this),this.updateCopyButton()}},{key:"updateCopyButton",value:function(){this.options.showCopyRows&&this.header.stateField&&this.$copyButton&&this.$copyButton.prop("disabled",!this.getSelections().length)}}])&&Me(e.prototype,r),o&&Me(e,o),u}(n.default.BootstrapTable)}));