eslink-ui-plus
Version:
vue3 component library, css framework
11 lines (10 loc) • 10.6 kB
JavaScript
var ft=Object.defineProperty;var Q=Object.getOwnPropertySymbols;var dt=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable;var X=(s,e,_)=>e in s?ft(s,e,{enumerable:!0,configurable:!0,writable:!0,value:_}):s[e]=_,Y=(s,e)=>{for(var _ in e||(e={}))dt.call(e,_)&&X(s,_,e[_]);if(Q)for(var _ of Q(e))ht.call(e,_)&&X(s,_,e[_]);return s};(function(s,e){typeof exports=="object"&&typeof module!="undefined"?module.exports=e(require("vue"),require("vue-demi")):typeof define=="function"&&define.amd?define(["vue","vue-demi"],e):(s=typeof globalThis!="undefined"?globalThis:s||self,s["es-page-table"]=e(s.Vue,s.vueDemi))})(this,function(s,e){"use strict";/*!
* pinia v2.0.11
* (c) 2022 Eduardo San Martin Morote
* @license MIT
*/let _;const B=t=>_=t,Z=process.env.NODE_ENV!=="production"?Symbol("pinia"):Symbol();function k(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var j;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(j||(j={}));const R=typeof window!="undefined";function F(t,u){for(const l in u){const o=u[l];if(!(l in t))continue;const c=t[l];k(c)&&k(o)&&!e.isRef(o)&&!e.isReactive(o)?t[l]=F(c,o):e.isVue2?e.set(t,l,o):t[l]=o}return t}const H=()=>{};function U(t,u,l,o=H){t.push(u);const c=()=>{const h=t.indexOf(u);h>-1&&(t.splice(h,1),o())};return!l&&e.getCurrentInstance()&&e.onUnmounted(c),c}function P(t,...u){t.slice().forEach(l=>{l(...u)})}function $(t,u){for(const l in u){const o=u[l],c=t[l];k(c)&&k(o)&&!e.isRef(o)&&!e.isReactive(o)?t[l]=$(c,o):t[l]=o}return t}const G=process.env.NODE_ENV!=="production"?Symbol("pinia:skipHydration"):Symbol(),v=new WeakMap;function K(t){return e.isVue2?!v.has(t):!k(t)||!t.hasOwnProperty(G)}const{assign:V}=Object;function q(t){return!!(e.isRef(t)&&t.effect)}function W(t,u,l,o){const{state:c,actions:h,getters:y}=u,f=l.state.value[t];let N;function p(){!f&&(process.env.NODE_ENV==="production"||!o)&&(e.isVue2?e.set(l.state.value,t,c?c():{}):l.state.value[t]=c?c():{});const g=process.env.NODE_ENV!=="production"&&o?e.toRefs(e.ref(c?c():{}).value):e.toRefs(l.state.value[t]);return V(g,h,Object.keys(y||{}).reduce((d,E)=>(d[E]=e.markRaw(e.computed(()=>{B(l);const O=l._s.get(t);if(!(e.isVue2&&!O._r))return y[E].call(O,O)})),d),{}))}return N=A(t,p,u,l,o),N.$reset=function(){const d=c?c():{};this.$patch(E=>{V(E,d)})},N}function A(t,u,l={},o,c){let h;const y=l.state,f=V({actions:{}},l);if(process.env.NODE_ENV!=="production"&&!o._e.active)throw new Error("Pinia destroyed");const N={deep:!0};process.env.NODE_ENV!=="production"&&!e.isVue2&&(N.onTrigger=a=>{p?O=a:p==!1&&!r._hotUpdating&&(Array.isArray(O)?O.push(a):console.error("\u{1F34D} debuggerEvents should be an array. This is most likely an internal Pinia bug."))});let p,g,d=e.markRaw([]),E=e.markRaw([]),O;const m=o.state.value[t];!y&&!m&&(process.env.NODE_ENV==="production"||!c)&&(e.isVue2?e.set(o.state.value,t,{}):o.state.value[t]={});const L=e.ref({});function J(a){let n;p=g=!1,process.env.NODE_ENV!=="production"&&(O=[]),typeof a=="function"?(a(o.state.value[t]),n={type:j.patchFunction,storeId:t,events:O}):($(o.state.value[t],a),n={type:j.patchObject,payload:a,storeId:t,events:O}),e.nextTick().then(()=>{p=!0}),g=!0,P(d,n,o.state.value[t])}const at=process.env.NODE_ENV!=="production"?()=>{throw new Error(`\u{1F34D}: Store "${t}" is build using the setup syntax and does not implement $reset().`)}:H;function lt(){h.stop(),d=[],E=[],o._s.delete(t)}function M(a,n){return function(){B(o);const i=Array.from(arguments),b=[],S=[];function it(C){b.push(C)}function ut(C){S.push(C)}P(E,{args:i,name:a,store:r,after:it,onError:ut});let x;try{x=n.apply(this&&this.$id===t?this:r,i)}catch(C){throw P(S,C),C}return x instanceof Promise?x.then(C=>(P(b,C),C)).catch(C=>(P(S,C),Promise.reject(C))):(P(b,x),x)}}const T=e.markRaw({actions:{},getters:{},state:[],hotState:L}),z={_p:o,$id:t,$onAction:U.bind(null,E),$patch:J,$reset:at,$subscribe(a,n={}){const i=U(d,a,n.detached,()=>b()),b=h.run(()=>e.watch(()=>o.state.value[t],S=>{(n.flush==="sync"?g:p)&&a({storeId:t,type:j.direct,events:O},S)},V({},N,n)));return i},$dispose:lt};e.isVue2&&(z._r=!1);const r=e.reactive(V(process.env.NODE_ENV!=="production"&&R?{_customProperties:e.markRaw(new Set),_hmrPayload:T}:{},z));o._s.set(t,r);const w=o._e.run(()=>(h=e.effectScope(),h.run(()=>u())));for(const a in w){const n=w[a];if(e.isRef(n)&&!q(n)||e.isReactive(n))process.env.NODE_ENV!=="production"&&c?e.set(L.value,a,e.toRef(w,a)):y||(m&&K(n)&&(e.isRef(n)?n.value=m[a]:$(n,m[a])),e.isVue2?e.set(o.state.value[t],a,n):o.state.value[t][a]=n),process.env.NODE_ENV!=="production"&&T.state.push(a);else if(typeof n=="function"){const i=process.env.NODE_ENV!=="production"&&c?n:M(a,n);e.isVue2?e.set(w,a,i):w[a]=i,process.env.NODE_ENV!=="production"&&(T.actions[a]=n),f.actions[a]=n}else process.env.NODE_ENV!=="production"&&q(n)&&(T.getters[a]=y?l.getters[a]:n,R&&(w._getters||(w._getters=e.markRaw([]))).push(a))}if(e.isVue2?Object.keys(w).forEach(a=>{e.set(r,a,w[a])}):(V(r,w),V(e.toRaw(r),w)),Object.defineProperty(r,"$state",{get:()=>process.env.NODE_ENV!=="production"&&c?L.value:o.state.value[t],set:a=>{if(process.env.NODE_ENV!=="production"&&c)throw new Error("cannot set hotState");J(n=>{V(n,a)})}}),process.env.NODE_ENV!=="production"){r._hotUpdate=e.markRaw(n=>{r._hotUpdating=!0,n._hmrPayload.state.forEach(i=>{if(i in r.$state){const b=n.$state[i],S=r.$state[i];typeof b=="object"&&k(b)&&k(S)?F(b,S):n.$state[i]=S}e.set(r,i,e.toRef(n.$state,i))}),Object.keys(r.$state).forEach(i=>{i in n.$state||e.del(r,i)}),p=!1,g=!1,o.state.value[t]=e.toRef(n._hmrPayload,"hotState"),g=!0,e.nextTick().then(()=>{p=!0});for(const i in n._hmrPayload.actions){const b=n[i];e.set(r,i,M(i,b))}for(const i in n._hmrPayload.getters){const b=n._hmrPayload.getters[i],S=y?e.computed(()=>(B(o),b.call(r,r))):b;e.set(r,i,S)}Object.keys(r._hmrPayload.getters).forEach(i=>{i in n._hmrPayload.getters||e.del(r,i)}),Object.keys(r._hmrPayload.actions).forEach(i=>{i in n._hmrPayload.actions||e.del(r,i)}),r._hmrPayload=n._hmrPayload,r._getters=n._getters,r._hotUpdating=!1});const a={writable:!0,configurable:!0,enumerable:!1};R&&["_p","_hmrPayload","_getters","_customProperties"].forEach(n=>{Object.defineProperty(r,n,Y({value:r[n]},a))})}return e.isVue2&&(r._r=!0),o._p.forEach(a=>{if(process.env.NODE_ENV!=="production"&&R){const n=h.run(()=>a({store:r,app:o._a,pinia:o,options:f}));Object.keys(n||{}).forEach(i=>r._customProperties.add(i)),V(r,n)}else V(r,h.run(()=>a({store:r,app:o._a,pinia:o,options:f})))}),process.env.NODE_ENV!=="production"&&r.$state&&typeof r.$state=="object"&&typeof r.$state.constructor=="function"&&!r.$state.constructor.toString().includes("[native code]")&&console.warn(`[\u{1F34D}]: The "state" must be a plain object. It cannot be
state: () => new MyClass()
Found in store "${r.$id}".`),m&&y&&l.hydrate&&l.hydrate(r.$state,m),p=!0,g=!0,r}function D(t,u,l){let o,c;const h=typeof u=="function";typeof t=="string"?(o=t,c=h?l:u):(c=t,o=t.id);function y(f,N){const p=e.getCurrentInstance();if(f=(process.env.NODE_ENV==="test"&&_&&_._testing?null:f)||p&&e.inject(Z),f&&B(f),process.env.NODE_ENV!=="production"&&!_)throw new Error(`[\u{1F34D}]: getActivePinia was called with no active Pinia. Did you forget to install pinia?
const pinia = createPinia()
app.use(pinia)
This will fail in production.`);f=_,f._s.has(o)||(h?A(o,u,c,f):W(o,c,f),process.env.NODE_ENV!=="production"&&(y._pinia=f));const g=f._s.get(o);if(process.env.NODE_ENV!=="production"&&N){const d="__hot:"+o,E=h?A(d,u,c,f,!0):W(d,V({},c),f,!0);N._hotUpdate(E),delete f.state.value[d],f._s.delete(d)}if(process.env.NODE_ENV!=="production"&&R&&p&&p.proxy&&!N){const d=p.proxy,E="_pStores"in d?d._pStores:d._pStores={};E[o]=g}return g}return y.$id=o,y}const tt=D({id:"counter",state:()=>({selectCount:0}),actions:{updateCounter(t){this.selectCount=t}}});function et(){const t=tt();let u=-1;return{handleRowClick:(c,h)=>{u=h,t.selectCount<=1&&(u>=0?t.updateCounter(1):t.updateCounter(0))},handleCheckedChange:c=>{t.updateCounter(c.length),console.log(c.length,u),c.length<=0&&u>=0&&t.updateCounter(1)}}}const ot={class:"area-1"},nt={class:"area-2",style:{position:"relative",width:"100%"}},st=s.createElementVNode("div",null,"\u6D4B\u8BD5\u6807\u9898",-1),rt=s.createElementVNode("div",null,"content",-1),ct=s.createElementVNode("p",null,"footer",-1);var I=s.defineComponent({props:{checkedValue:Array,isLoading:{type:Boolean,require:!0},isSummary:{type:Boolean,require:!0},notSummary:{type:[Object,Array],default:()=>({})},hasCheckbox:{type:Boolean,default:!1},hasExpand:{type:Boolean,default:!1},columns:{type:Array,default:()=>[]},rows:{type:Array,default:()=>[]},sortable:{type:Object,default:()=>({field:"id",order:""})},headerFixed:{type:Boolean,default:!0},scrollHeight:{type:String,default:"100%"},searchCondition:{type:[Object,Array],default:()=>({})},rowspanField:{type:[Array],default:()=>[]},highlight:{type:Boolean,default:!0},highlightIndex:{type:[Number],default:-1},operaterConfig:{type:Object,default:()=>({})}},emits:["done","clear"],setup(t,{emit:u}){const{handleRowClick:l,handleCheckedChange:o}=et();return(c,h)=>{const y=s.resolveComponent("es-page-operater-bar"),f=s.resolveComponent("es-table"),N=s.resolveComponent("es-drawer"),p=s.resolveComponent("es-split-area");return s.openBlock(),s.createElementBlock(s.Fragment,null,[s.createVNode(y,{operaterConfig:t.operaterConfig},null,8,["operaterConfig"]),s.createVNode(p,{area:[2,1],direction:"x","use-mouse":""},{"area-1":s.withCtx(()=>[s.createElementVNode("div",ot,[s.createVNode(f,{"scroll-height":t.scrollHeight,columns:t.columns,rows:t.rows,"has-checkbox":t.hasCheckbox,sortable:t.sortable,searchCondition:t.searchCondition,onSortChange:c.handleSortChange,onRowClick:s.unref(l),onSelectionChange:s.unref(o),onTableScrollBottom:c.handlePullLoading},s.createSlots({_:2},[s.renderList(t.columns,g=>({name:g.field,fn:s.withCtx(({row:d,index:E})=>[s.renderSlot(c.$slots,g.field,{data:d,index:E})])}))]),1032,["scroll-height","columns","rows","has-checkbox","sortable","searchCondition","onSortChange","onRowClick","onSelectionChange","onTableScrollBottom"])])]),"area-2":s.withCtx(()=>[s.createElementVNode("div",nt,[s.createVNode(N,{"is-drawer":!1,"title-color":"#000","footer-height":"60px",width:"100%",visible:"",title:"\u6D4B\u8BD5\u6807\u9898"},{header:s.withCtx(()=>[st]),footer:s.withCtx(()=>[ct]),default:s.withCtx(()=>[rt]),_:1})])]),_:3})],64)}}});return I.__file="components/page-table/index.vue",I.install=t=>{t.component("es-page-table",I)},I});