UNPKG

bootstrap-table

Version:

An extended table to integration with some of the most widely used CSS frameworks. (Supports Bootstrap, Semantic UI, Bulma, Material Design, Foundation)

6 lines (5 loc) 15.5 kB
(function(k,w){typeof exports=="object"&&typeof module<"u"?module.exports=w():typeof define=="function"&&define.amd?define(w):(k=typeof globalThis<"u"?globalThis:k||self,k.BootstrapTable=w())})(this,function(){"use strict";var k={};const w=k.NODE_ENV!=="production"?Object.freeze({}):{},Ne=k.NODE_ENV!=="production"?Object.freeze([]):[],Ee=()=>{},we=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),F=Object.assign,m=Array.isArray,C=e=>typeof e=="function",N=e=>typeof e=="string",Ce=e=>typeof e=="symbol",S=e=>e!==null&&typeof e=="object";let te;const D=()=>te||(te=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function J(e){if(m(e)){const t={};for(let n=0;n<e.length;n++){const o=e[n],s=N(o)?ke(o):J(o);if(s)for(const r in s)t[r]=s[r]}return t}else if(N(e)||S(e))return e}const Se=/;(?![^(]*\))/g,Oe=/:([^]+)/,Te=/\/\*[^]*?\*\//g;function ke(e){const t={};return e.replace(Te,"").split(Se).forEach(n=>{if(n){const o=n.split(Oe);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function q(e){let t="";if(N(e))t=e;else if(m(e))for(let n=0;n<e.length;n++){const o=q(e[n]);o&&(t+=o+" ")}else if(S(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ce));function ne(e){return W(e)?ne(e.__v_raw):!!(e&&e.__v_isReactive)}function W(e){return!!(e&&e.__v_isReadonly)}function K(e){return!!(e&&e.__v_isShallow)}function L(e){return e?!!e.__v_raw:!1}function O(e){const t=e&&e.__v_raw;return t?O(t):e}function Y(e){return e?e.__v_isRef===!0:!1}var f={};const T=[];function xe(e){T.push(e)}function Re(){T.pop()}let G=!1;function V(e,...t){if(G)return;G=!0;const n=T.length?T[T.length-1].component:null,o=n&&n.appContext.config.warnHandler,s=Ve();if(o)Q(o,n,11,[e+t.map(r=>{var l,c;return(c=(l=r.toString)==null?void 0:l.call(r))!=null?c:JSON.stringify(r)}).join(""),n&&n.proxy,s.map(({vnode:r})=>`at <${ye(n,r.type)}>`).join(` `),s]);else{const r=[`[Vue warn]: ${e}`,...t];s.length&&r.push(` `,...Ie(s)),console.warn(...r)}G=!1}function Ve(){let e=T[T.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const o=e.component&&e.component.parent;e=o&&o.vnode}return t}function Ie(e){const t=[];return e.forEach((n,o)=>{t.push(...o===0?[]:[` `],...$e(n))}),t}function $e({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",o=e.component?e.component.parent==null:!1,s=` at <${ye(e.component,e.type,o)}`,r=">"+n;return e.props?[s,...Fe(e.props),r]:[s+r]}function Fe(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(o=>{t.push(...oe(o,e[o]))}),n.length>3&&t.push(" ..."),t}function oe(e,t,n){return N(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:Y(t)?(t=oe(e,O(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):C(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=O(t),n?t:[`${e}=`,t])}const re={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function Q(e,t,n,o){try{return o?e(...o):e()}catch(s){se(s,t,n)}}function se(e,t,n,o=!0){const s=t?t.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:l}=t&&t.appContext.config||w;if(t){let c=t.parent;const a=t.proxy,_=f.NODE_ENV!=="production"?re[n]:`https://vuejs.org/error-reference/#runtime-${n}`;for(;c;){const b=c.ec;if(b){for(let i=0;i<b.length;i++)if(b[i](e,a,_)===!1)return}c=c.parent}if(r){Q(r,null,10,[e,a,_]);return}}De(e,n,s,o,l)}function De(e,t,n,o=!0,s=!1){if(f.NODE_ENV!=="production"){const r=re[t];if(n&&xe(n),V(`Unhandled error${r?` during execution of ${r}`:""}`),n&&Re(),o)throw e;console.error(e)}else{if(s)throw e;console.error(e)}}const d=[];let y=-1;const x=[];let E=null,R=0;const Ae=Promise.resolve();let Z=null;const Pe=100;function Me(e){let t=y+1,n=d.length;for(;t<n;){const o=t+n>>>1,s=d[o],r=I(s);r<e||r===e&&s.flags&2?t=o+1:n=o}return t}function Ue(e){if(!(e.flags&1)){const t=I(e),n=d[d.length-1];!n||!(e.flags&2)&&t>=I(n)?d.push(e):d.splice(Me(t),0,e),e.flags|=1,ie()}}function ie(){Z||(Z=Ae.then(le))}function ze(e){m(e)?x.push(...e):E&&e.id===-1?E.splice(R+1,0,e):e.flags&1||(x.push(e),e.flags|=1),ie()}function Be(e){if(x.length){const t=[...new Set(x)].sort((n,o)=>I(n)-I(o));if(x.length=0,E){E.push(...t);return}for(E=t,f.NODE_ENV!=="production"&&(e=e||new Map),R=0;R<E.length;R++){const n=E[R];f.NODE_ENV!=="production"&&ce(e,n)||(n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2)}E=null,R=0}}const I=e=>e.id==null?e.flags&2?-1:1/0:e.id;function le(e){f.NODE_ENV!=="production"&&(e=e||new Map);const t=f.NODE_ENV!=="production"?n=>ce(e,n):Ee;try{for(y=0;y<d.length;y++){const n=d[y];if(n&&!(n.flags&8)){if(f.NODE_ENV!=="production"&&t(n))continue;n.flags&4&&(n.flags&=-2),Q(n,n.i,n.i?15:14),n.flags&4||(n.flags&=-2)}}}finally{for(;y<d.length;y++){const n=d[y];n&&(n.flags&=-2)}y=-1,d.length=0,Be(e),Z=null,(d.length||x.length)&&le(e)}}function ce(e,t){const n=e.get(t)||0;if(n>Pe){const o=t.i,s=o&&ge(o.type);return se(`Maximum recursive updates exceeded${s?` in component <${s}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`,null,10),!0}return e.set(t,n+1),!1}const X=new Map;f.NODE_ENV!=="production"&&(D().__VUE_HMR_RUNTIME__={createRecord:v(He),rerender:v(je),reload:v(Je)});const A=new Map;function He(e,t){return A.has(e)?!1:(A.set(e,{initialDef:P(t),instances:new Set}),!0)}function P(e){return be(e)?e.__vccOpts:e}function je(e,t){const n=A.get(e);n&&(n.initialDef.render=t,[...n.instances].forEach(o=>{t&&(o.render=t,P(o.type).render=t),o.renderCache=[],o.update()}))}function Je(e,t){const n=A.get(e);if(!n)return;t=P(t),ae(n.initialDef,t);const o=[...n.instances];for(let s=0;s<o.length;s++){const r=o[s],l=P(r.type);let c=X.get(l);c||(l!==n.initialDef&&ae(l,t),X.set(l,c=new Set)),c.add(r),r.appContext.propsCache.delete(r.type),r.appContext.emitsCache.delete(r.type),r.appContext.optionsCache.delete(r.type),r.ceReload?(c.add(r),r.ceReload(t.styles),c.delete(r)):r.parent?Ue(()=>{r.parent.update(),c.delete(r)}):r.appContext.reload?r.appContext.reload():typeof window<"u"?window.location.reload():console.warn("[HMR] Root or manually mounted instance modified. Full reload required."),r.root.ce&&r!==r.root&&r.root.ce._removeChildStyle(l)}ze(()=>{X.clear()})}function ae(e,t){F(e,t);for(const n in e)n!=="__file"&&!(n in t)&&delete e[n]}function v(e){return(t,n)=>{try{return e(t,n)}catch(o){console.error(o),console.warn("[HMR] Something went wrong during Vue component hot-reload. Full reload required.")}}}let M=null,qe=null;const We=e=>e.__isTeleport;function ue(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ue(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}D().requestIdleCallback,D().cancelIdleCallback;const Ke=Symbol.for("v-ndc"),Le={};f.NODE_ENV!=="production"&&(Le.ownKeys=e=>(V("Avoid app logic that relies on enumerating keys on a component instance. The keys will be empty in production mode to avoid performance overhead."),Reflect.ownKeys(e)));const Ye={},fe=e=>Object.getPrototypeOf(e)===Ye,Ge=e=>e.__isSuspense,de=Symbol.for("v-fgt"),Qe=Symbol.for("v-txt"),Ze=Symbol.for("v-cmt"),U=[];let h=null;function Xe(e=!1){U.push(h=e?null:[])}function ve(){U.pop(),h=U[U.length-1]||null}function et(e){return e.dynamicChildren=h||Ne,ve(),h&&h.push(e),e}function tt(e,t,n,o,s,r){return et(he(e,t,n,o,s,r,!0))}function nt(e){return e?e.__v_isVNode===!0:!1}const ot=(...e)=>me(...e),pe=({key:e})=>e??null,z=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?N(e)||Y(e)||C(e)?{i:M,r:e,k:t,f:!!n}:e:null);function he(e,t=null,n=null,o=0,s=null,r=e===de?0:1,l=!1,c=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&pe(t),ref:t&&z(t),scopeId:qe,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:o,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:M};return c?(ee(a,n),r&128&&e.normalize(a)):n&&(a.shapeFlag|=N(n)?8:16),f.NODE_ENV!=="production"&&a.key!==a.key&&V("VNode created with invalid key (NaN). VNode type:",a.type),!l&&h&&(a.patchFlag>0||r&6)&&a.patchFlag!==32&&h.push(a),a}const rt=f.NODE_ENV!=="production"?ot:me;function me(e,t=null,n=null,o=0,s=null,r=!1){if((!e||e===Ke)&&(f.NODE_ENV!=="production"&&!e&&V(`Invalid vnode type when creating vnode: ${e}.`),e=Ze),nt(e)){const c=B(e,t,!0);return n&&ee(c,n),!r&&h&&(c.shapeFlag&6?h[h.indexOf(e)]=c:h.push(c)),c.patchFlag=-2,c}if(be(e)&&(e=e.__vccOpts),t){t=st(t);let{class:c,style:a}=t;c&&!N(c)&&(t.class=q(c)),S(a)&&(L(a)&&!m(a)&&(a=F({},a)),t.style=J(a))}const l=N(e)?1:Ge(e)?128:We(e)?64:S(e)?4:C(e)?2:0;return f.NODE_ENV!=="production"&&l&4&&L(e)&&(e=O(e),V("Vue received a Component that was made a reactive object. This can lead to unnecessary performance overhead and should be avoided by marking the component with `markRaw` or using `shallowRef` instead of `ref`.",` Component that was made reactive: `,e)),he(e,t,n,o,s,l,r,!0)}function st(e){return e?L(e)||fe(e)?F({},e):e:null}function B(e,t,n=!1,o=!1){const{props:s,ref:r,patchFlag:l,children:c,transition:a}=e,_=t?lt(s||{},t):s,b={__v_isVNode:!0,__v_skip:!0,type:e.type,props:_,key:_&&pe(_),ref:t&&t.ref?n&&r?m(r)?r.concat(z(t)):[r,z(t)]:z(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:f.NODE_ENV!=="production"&&l===-1&&m(c)?c.map(_e):c,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==de?l===-1?16:l|16:l,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:a,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&B(e.ssContent),ssFallback:e.ssFallback&&B(e.ssFallback),el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&o&&ue(b,a.clone(b)),b}function _e(e){const t=B(e);return m(e.children)&&(t.children=e.children.map(_e)),t}function it(e=" ",t=0){return rt(Qe,null,e,t)}function ee(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(m(t))n=16;else if(typeof t=="object")if(o&65){const s=t.default;s&&(s._c&&(s._d=!1),ee(e,s()),s._c&&(s._d=!0));return}else n=32,!t._&&!fe(t)&&(t._ctx=M);else C(t)?(t={default:t,_ctx:M},n=32):(t=String(t),o&64?(n=16,t=[it(t)]):n=8);e.children=t,e.shapeFlag|=n}function lt(...e){const t={};for(let n=0;n<e.length;n++){const o=e[n];for(const s in o)if(s==="class")t.class!==o.class&&(t.class=q([t.class,o.class]));else if(s==="style")t.style=J([t.style,o.style]);else if(we(s)){const r=t[s],l=o[s];l&&r!==l&&!(m(r)&&r.includes(l))&&(t[s]=r?[].concat(r,l):l)}else s!==""&&(t[s]=o[s])}return t}{const e=D(),t=(n,o)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(o),r=>{s.length>1?s.forEach(l=>l(r)):s[0](r)}};t("__VUE_INSTANCE_SETTERS__",n=>n),t("__VUE_SSR_SETTERS__",n=>n)}const ct=/(?:^|[-_])(\w)/g,at=e=>e.replace(ct,t=>t.toUpperCase()).replace(/[-_]/g,"");function ge(e,t=!0){return C(e)?e.displayName||e.name:e.name||t&&e.__name}function ye(e,t,n=!1){let o=ge(t);if(!o&&t.__file){const s=t.__file.match(/([^/\\]+)\.\w+$/);s&&(o=s[1])}if(!o&&e&&e.parent){const s=r=>{for(const l in r)if(r[l]===t)return l};o=s(e.components||e.parent.type.components)||s(e.appContext.components)}return o?at(o):n?"App":"Anonymous"}function be(e){return C(e)&&"__vccOpts"in e}function ut(){if(f.NODE_ENV==="production"||typeof window>"u")return;const e={style:"color:#3ba776"},t={style:"color:#1677ff"},n={style:"color:#f5222d"},o={style:"color:#eb2f96"},s={__vue_custom_formatter:!0,header(i){if(!S(i))return null;if(i.__isVue)return["div",e,"VueInstance"];if(Y(i)){const u=i.value;return["div",{},["span",e,b(i)],"<",c(u),">"]}else{if(ne(i))return["div",{},["span",e,K(i)?"ShallowReactive":"Reactive"],"<",c(i),`>${W(i)?" (readonly)":""}`];if(W(i))return["div",{},["span",e,K(i)?"ShallowReadonly":"Readonly"],"<",c(i),">"]}return null},hasBody(i){return i&&i.__isVue},body(i){if(i&&i.__isVue)return["div",{},...r(i.$)]}};function r(i){const u=[];i.type.props&&i.props&&u.push(l("props",O(i.props))),i.setupState!==w&&u.push(l("setup",i.setupState)),i.data!==w&&u.push(l("data",O(i.data)));const p=a(i,"computed");p&&u.push(l("computed",p));const g=a(i,"inject");return g&&u.push(l("injected",g)),u.push(["div",{},["span",{style:o.style+";opacity:0.66"},"$ (internal): "],["object",{object:i}]]),u}function l(i,u){return u=F({},u),Object.keys(u).length?["div",{style:"line-height:1.25em;margin-bottom:0.6em"},["div",{style:"color:#476582"},i],["div",{style:"padding-left:1.25em"},...Object.keys(u).map(p=>["div",{},["span",o,p+": "],c(u[p],!1)])]]:["span",{}]}function c(i,u=!0){return typeof i=="number"?["span",t,i]:typeof i=="string"?["span",n,JSON.stringify(i)]:typeof i=="boolean"?["span",o,i]:S(i)?["object",{object:u?O(i):i}]:["span",n,String(i)]}function a(i,u){const p=i.type;if(C(p))return;const g={};for(const $ in i.ctx)_(p,$,u)&&(g[$]=i.ctx[$]);return g}function _(i,u,p){const g=i[p];if(m(g)&&g.includes(u)||S(g)&&u in g||i.extends&&_(i.extends,u,p)||i.mixins&&i.mixins.some($=>_($,u,p)))return!0}function b(i){return K(i)?"ShallowRef":i.effect?"ComputedRef":"Ref"}window.devtoolsFormatters?window.devtoolsFormatters.push(s):window.devtoolsFormatters=[s]}var ft={};function dt(){ut()}ft.NODE_ENV!=="production"&&dt();const pt=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n},H=window.jQuery,j=e=>e===void 0?e:H.fn.bootstrapTable.utils.extend(!0,Array.isArray(e)?[]:{},e),ht={name:"BootstrapTable",props:{columns:{type:Array,require:!0},data:{type:[Array,Object],default(){}},options:{type:Object,default(){return{}}}},data(){return{optionsChangedIdx:0}},mounted(){this.$table=H(this.$el),this.$table.on("all.bs.table",(e,t,n)=>{let o=H.fn.bootstrapTable.events[t];o=o.replace(/([A-Z])/g,"-$1").toLowerCase(),this.$emit("on-all",...n),this.$emit(o,...n)}),this._initTable()},beforeUnmount(){this.$table.bootstrapTable("destroy")},methods:{_initTable(){const e={...j(this.options),columns:j(this.columns),data:j(this.data)};this._hasInit?this.refreshOptions(e):(this.$table.bootstrapTable(e),this._hasInit=!0)},...(()=>{const e={};for(const t of H.fn.bootstrapTable.methods)e[t]=function(...n){return this.$table.bootstrapTable(t,...n)};return e})()},watch:{options:{handler(){this.optionsChangedIdx++},deep:!0},columns:{handler(){this.optionsChangedIdx++},deep:!0},optionsChangedIdx(){this._initTable()},data:{handler(){this.load(j(this.data))},deep:!0}}};function mt(e,t,n,o,s,r){return Xe(),tt("table")}return pt(ht,[["render",mt]])});