zl-arco-comp
Version:
install ``` npm install zl-arco-comp ```
6 lines (5 loc) • 26.9 kB
JavaScript
(function(b,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@arco-design/web-vue")):typeof define=="function"&&define.amd?define(["exports","vue","@arco-design/web-vue"],e):(b=typeof globalThis<"u"?globalThis:b||self,e(b.ZLArcoComp={},b.vue,b.webVue))})(this,function(b,e,ae){"use strict";const N=(t,n)=>{const o=t.__vccOpts||t;for(const[l,r]of n)o[l]=r;return o},re={};function se(t,n){const o=e.resolveComponent("a-layout-header"),l=e.resolveComponent("a-layout-sider"),r=e.resolveComponent("a-layout-content"),c=e.resolveComponent("a-layout"),_=e.resolveComponent("a-layout-footer");return e.openBlock(),e.createBlock(c,{class:"zl-layout"},{default:e.withCtx(()=>[e.createVNode(o,{class:"zl-layout-header"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"header",{},void 0,!0)]),_:3}),e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(l,{class:"zl-layout-sider"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"sider",{},void 0,!0)]),_:3}),e.createVNode(r,{class:"zl-layout-content"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"content",{},void 0,!0)]),_:3})]),_:3}),e.createVNode(_,null,{default:e.withCtx(()=>[e.renderSlot(t.$slots,"footer",{},void 0,!0)]),_:3})]),_:3})}const z=N(re,[["render",se],["__scopeId","data-v-4971bcf1"]]);z.install=t=>{t.component("ZlLayout",z)};let H;function ie(t){return H||(H=e.computed(()=>t()?"10px":"0px 10px 10px 10px")),{contentBorderRadius:H}}const I=N(e.defineComponent({__name:"index",props:{autoBorderRadius:{type:[Boolean,Function],default:!1},occupiedHeight:{default:0},isFirst:{type:Function,default:()=>!1}},setup(t){const n=t,o=e.computed(()=>`calc(100vh - 60px - 32px - 24px - ${n.occupiedHeight}px)`),{contentBorderRadius:l}=ie(n.isFirst);return(r,c)=>(e.openBlock(),e.createElementBlock("div",{class:"zl-content-box",style:e.normalizeStyle({"--border":r.autoBorderRadius?e.unref(l):"10px","--height":o.value})},[e.renderSlot(r.$slots,"default",{},void 0,!0)],4))}}),[["__scopeId","data-v-6c88c753"]]);I.install=t=>{t.component("ZLContentBox",I)};const ce={class:"my-icon"},$=N(e.defineComponent({__name:"index",props:{src:{default:""},icon:{default:""},size:{default:"12px"},style:{}},setup(t){const n=t,o=e.computed(()=>n.src.includes("http://")||n.src.includes("https://")?e.h("img",{src:n.src,style:{width:n.size,height:n.size,fontSize:n.size,...n.style}}):n.icon);return(l,r)=>(e.openBlock(),e.createElementBlock("div",ce,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value)))]))}}),[["__scopeId","data-v-8c01a026"]]);function de(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}const ue=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const pe=Object.prototype.toString,fe=t=>pe.call(t)==="[object Object]",me=()=>{};function he(...t){if(t.length!==1)return e.toRef(...t);const n=t[0];return typeof n=="function"?e.readonly(e.customRef(()=>({get:n,set:me}))):e.ref(n)}function _e(t,n){function o(...l){return new Promise((r,c)=>{Promise.resolve(t(()=>n.apply(this,l),{fn:n,thisArg:this,args:l})).then(r).catch(c)})}return o}const Y=t=>t();function ge(t=Y,n={}){const{initialState:o="active"}=n,l=he(o==="active");function r(){l.value=!1}function c(){l.value=!0}const _=(...i)=>{l.value&&t(...i)};return{isActive:e.readonly(l),pause:r,resume:c,eventFilter:_}}function W(t){return Array.isArray(t)?t:[t]}function ye(t){return e.getCurrentInstance()}function be(t,n,o={}){const{eventFilter:l=Y,...r}=o;return e.watch(t,_e(l,n),r)}function Ce(t,n,o={}){const{eventFilter:l,initialState:r="active",...c}=o,{eventFilter:_,pause:i,resume:s,isActive:f}=ge(l,{initialState:r});return{stop:be(t,n,{...c,eventFilter:_}),pause:i,resume:s,isActive:f}}function we(t,n=!0,o){ye()?e.onMounted(t,o):n?t():e.nextTick(t)}function Se(t,n,o){return e.watch(t,n,{...o,immediate:!0})}const j=ue?window:void 0;function ke(t){var n;const o=e.toValue(t);return(n=o==null?void 0:o.$el)!=null?n:o}function G(...t){const n=[],o=()=>{n.forEach(i=>i()),n.length=0},l=(i,s,f,h)=>(i.addEventListener(s,f,h),()=>i.removeEventListener(s,f,h)),r=e.computed(()=>{const i=W(e.toValue(t[0])).filter(s=>s!=null);return i.every(s=>typeof s!="string")?i:void 0}),c=Se(()=>{var i,s;return[(s=(i=r.value)==null?void 0:i.map(f=>ke(f)))!=null?s:[j].filter(f=>f!=null),W(e.toValue(r.value?t[1]:t[0])),W(e.unref(r.value?t[2]:t[1])),e.toValue(r.value?t[3]:t[2])]},([i,s,f,h])=>{if(o(),!(i!=null&&i.length)||!(s!=null&&s.length)||!(f!=null&&f.length))return;const u=fe(h)?{...h}:h;n.push(...i.flatMap(C=>s.flatMap(w=>f.map(p=>l(C,w,p,u)))))},{flush:"post"}),_=()=>{c(),o()};return de(o),_}const F=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},R="__vueuse_ssr_handlers__",xe=Ve();function Ve(){return R in F||(F[R]=F[R]||{}),F[R]}function Be(t,n){return xe[t]||n}function Ne(t){return t==null?"any":t instanceof Set?"set":t instanceof Map?"map":t instanceof Date?"date":typeof t=="boolean"?"boolean":typeof t=="string"?"string":typeof t=="object"?"object":Number.isNaN(t)?"any":"number"}const Ee={boolean:{read:t=>t==="true",write:t=>String(t)},object:{read:t=>JSON.parse(t),write:t=>JSON.stringify(t)},number:{read:t=>Number.parseFloat(t),write:t=>String(t)},any:{read:t=>t,write:t=>String(t)},string:{read:t=>t,write:t=>String(t)},map:{read:t=>new Map(JSON.parse(t)),write:t=>JSON.stringify(Array.from(t.entries()))},set:{read:t=>new Set(JSON.parse(t)),write:t=>JSON.stringify(Array.from(t))},date:{read:t=>new Date(t),write:t=>t.toISOString()}},Q="vueuse-storage";function X(t,n,o,l={}){var r;const{flush:c="pre",deep:_=!0,listenToStorageChanges:i=!0,writeDefaults:s=!0,mergeDefaults:f=!1,shallow:h,window:u=j,eventFilter:C,onError:w=g=>{console.error(g)},initOnMounted:p}=l,a=(h?e.shallowRef:e.ref)(typeof n=="function"?n():n),d=e.computed(()=>e.toValue(t));if(!o)try{o=Be("getDefaultStorage",()=>{var g;return(g=j)==null?void 0:g.localStorage})()}catch(g){w(g)}if(!o)return a;const y=e.toValue(n),k=Ne(y),B=(r=l.serializer)!=null?r:Ee[k],{pause:Z,resume:P}=Ce(a,()=>J(a.value),{flush:c,deep:_,eventFilter:C});e.watch(d,()=>M(),{flush:c});let A=!1;const q=g=>{p&&!A||M(g)},m=g=>{p&&!A||ct(g)};u&&i&&(o instanceof Storage?G(u,"storage",q,{passive:!0}):G(u,Q,m)),p?we(()=>{A=!0,M()}):M();function S(g,x){if(u){const V={key:d.value,oldValue:g,newValue:x,storageArea:o};u.dispatchEvent(o instanceof Storage?new StorageEvent("storage",V):new CustomEvent(Q,{detail:V}))}}function J(g){try{const x=o.getItem(d.value);if(g==null)S(x,null),o.removeItem(d.value);else{const V=B.write(g);x!==V&&(o.setItem(d.value,V),S(x,V))}}catch(x){w(x)}}function it(g){const x=g?g.newValue:o.getItem(d.value);if(x==null)return s&&y!=null&&o.setItem(d.value,B.write(y)),y;if(!g&&f){const V=B.read(x);return typeof f=="function"?f(V,y):k==="object"&&!Array.isArray(V)?{...y,...V}:V}else return typeof x!="string"?x:B.read(x)}function M(g){if(!(g&&g.storageArea!==o)){if(g&&g.key==null){a.value=y;return}if(!(g&&g.key!==d.value)){Z();try{(g==null?void 0:g.newValue)!==B.write(a.value)&&(a.value=it(g))}catch(x){w(x)}finally{g?e.nextTick(P):P()}}}}function ct(g){M(g.detail)}return a}/*!
* vue-router v4.5.1
* (c) 2025 Eduardo San Martin Morote
* @license MIT
*/var v;(function(t){t.pop="pop",t.push="push"})(v||(v={}));var ee;(function(t){t.back="back",t.forward="forward",t.unknown=""})(ee||(ee={})),Symbol(process.env.NODE_ENV!=="production"?"navigation failure":"");var te;(function(t){t[t.aborted=4]="aborted",t[t.cancelled=8]="cancelled",t[t.duplicated=16]="duplicated"})(te||(te={})),Symbol(process.env.NODE_ENV!=="production"?"router view location matched":""),Symbol(process.env.NODE_ENV!=="production"?"router view depth":""),Symbol(process.env.NODE_ENV!=="production"?"router":"");const $e=Symbol(process.env.NODE_ENV!=="production"?"route location":"");Symbol(process.env.NODE_ENV!=="production"?"router view location":"");function oe(t){return e.inject($e)}const E=N(e.defineComponent({__name:"index",props:e.mergeModels({trigger:{default:"click"},position:{default:"bottom"},duration:{default:.5},disabled:{type:Boolean},popupContainer:{},popupOffset:{default:0}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const n=t,o=e.useModel(t,"modelValue"),l=e.ref(),r=e.ref(!1),c=e.computed({get(){return typeof o!==void 0?!!o.value:r.value},set(h){h?s():i()}}),_=()=>{e.nextTick(()=>{const{height:h}=l.value.getBoundingClientRect();l.value.style.height="0px",l.value.getBoundingClientRect(),l.value.style.height=`${h}px`,l.value.style.transition=`height ${n.duration}s`})},i=()=>{l.value.style.height="0px",f(new Date)},s=()=>{o.value=!0,r.value=!0,_()},f=h=>{requestAnimationFrame(()=>{if(new Date().getTime()-h.getTime()>=n.duration*1e3){o.value=!1,r.value=!1;return}return f(h)})};return(h,u)=>{const C=e.resolveComponent("a-trigger");return e.openBlock(),e.createBlock(C,{"popup-visible":c.value,"onUpdate:popupVisible":u[0]||(u[0]=w=>c.value=w),trigger:h.trigger,position:h.position,duration:h.duration,"popup-container":h.popupContainer,"popup-offset":h.popupOffset},{content:e.withCtx(()=>[e.createElementVNode("div",{ref_key:"popupRef",ref:l,class:"content-popup"},[e.renderSlot(h.$slots,"content",{},void 0,!0)],512)]),default:e.withCtx(()=>[e.renderSlot(h.$slots,"default",{},void 0,!0)]),_:3},8,["popup-visible","trigger","position","duration","popup-container","popup-offset"])}}}),[["__scopeId","data-v-d40be7ec"]]),ze={class:"custom-column-box"},Ie=N({__name:"SearchItem",setup(t){const{searchItem:n,modelValue:o}=e.inject("searchItem");return(l,r)=>{const c=e.resolveComponent("a-checkbox"),_=e.resolveComponent("a-checkbox-group"),i=e.resolveComponent("a-form-item");return e.openBlock(),e.createBlock(i,{field:"search-item__custom","hide-label":""},{default:e.withCtx(()=>[e.createVNode(E,{"popup-translate":[20,0]},{content:e.withCtx(()=>[e.createElementVNode("div",ze,[e.createVNode(_,{direction:"vertical",modelValue:e.unref(o),"onUpdate:modelValue":r[0]||(r[0]=s=>e.isRef(o)?o.value=s:null)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(n),(s,f)=>(e.openBlock(),e.createBlock(c,{key:s.field,value:s.field,disabled:!f},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(s.label),1)]),_:2},1032,["value","disabled"]))),128))]),_:1},8,["modelValue"])])]),default:e.withCtx(()=>[r[1]||(r[1]=e.createElementVNode("div",{class:"custom-column"},"筛选项",-1))]),_:1,__:[1]})]),_:1})}}},[["__scopeId","data-v-f194a3bf"]]);function Oe(t,n="searchItem"){const o=oe(),l=e.useSlots(),c=o.name+"-"+n;if(!l.default)return{};const _=l.default,s=_()[0];if(!s.children)return{};const f=s.children;if(!f.default)return{};const h=f.default(),u=e.computed(()=>h.filter(a=>a.props).map(a=>a.props)),C=X(c,[]),w=e.computed({get:()=>{var a;return(a=C.value)!=null&&a.length?C.value:t!=null&&t.length?t.filter(d=>u.value.some(y=>(y==null?void 0:y.field)===d)):u.value.map(d=>d==null?void 0:d.field).filter(Boolean)},set:a=>{C.value=a}}),p=e.computed(()=>{const a=e.cloneVNode(s);return a.children={default:()=>{const d=h.filter(y=>{var k,B;return(B=w.value)==null?void 0:B.includes((k=y==null?void 0:y.props)==null?void 0:k.field)});return d.push(e.h(Ie)),d}},a});return{modelValue:w,searchItem:u,newVnode:p}}const Te={class:"search-container"},De={ref:"fromRef",class:"from-container"},Le={class:"btn-container"},Ze={class:"search"},Ae={class:"reset"},Me={key:0,class:"line"},O=N(e.defineComponent({__name:"index",props:{hideLine:{type:Boolean,default:!1},formItemWidth:{default:"14vw"},openSearchItem:{type:Boolean,default:!1},defaultItem:{default:()=>[]},localKey:{}},emits:["search","reset"],setup(t,{emit:n}){const o=t,l=n;let r=null;if(o.openSearchItem){const{modelValue:i,searchItem:s,newVnode:f}=Oe(o.defaultItem,o.localKey);r=f,e.provide("searchItem",{searchItem:s,modelValue:i})}const c=()=>{l("search")},_=()=>{l("reset")};return(i,s)=>{const f=e.resolveComponent("a-button");return e.openBlock(),e.createElementBlock("div",{class:"zl-search-box",style:e.normalizeStyle({"--formItemWidth":i.formItemWidth})},[e.createElementVNode("div",Te,[e.createElementVNode("div",De,[o.openSearchItem?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(r)),{key:0})):e.renderSlot(i.$slots,"default",{key:1},void 0,!0)],512),e.createElementVNode("div",Le,[e.createElementVNode("div",Ze,[e.createVNode(f,{type:"primary",onClick:c},{icon:e.withCtx(()=>[e.createVNode($,{src:"https://static.wi-fi.cn/omc/202506/1a543473cbdd4bfbc258462f854d39076aea3b75.png"})]),_:1})]),e.createElementVNode("div",Ae,[e.createVNode(f,{onClick:_},{default:e.withCtx(()=>s[0]||(s[0]=[e.createTextVNode("重置")])),_:1,__:[0]})])])]),o.hideLine?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Me))],4)}}}),[["__scopeId","data-v-8ee10491"]]);O.install=t=>{t.component("ZlSearchBox",O)},E.install=t=>{t.component("ZlTrigger",E)},$.install=t=>{t.component("ZlIcon",$)};const Fe={class:"select-footer"},Re={class:"select-footer"},T=N(e.defineComponent({__name:"index",props:e.mergeModels({options:{},maxTagCount:{default:1},fieldNames:{default:()=>({label:"label",value:"value"})},placeholder:{default:"请选择"},multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},hideClean:{type:Boolean,default:!1},allowCreate:{type:Boolean,default:!1},virtualListProps:{default:()=>({height:200})},loading:{type:Boolean,default:void 0},formatLabel:{type:Function,default:void 0}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change","input-value-change"],["update:modelValue"]),setup(t,{emit:n}){const o=t,l=e.useModel(t,"modelValue"),r=e.computed({get:()=>{var p;return o.multiple?Array.isArray(l.value)&&((p=l.value)!=null&&p.length)?l.value:[]:l.value?l.value:""},set(p){l.value=p}});let c=!0;const _=e.computed(()=>{var p;return o.loading!==void 0?o.loading:(p=o.options)!=null&&p.length?!1:c}),i=e.ref(""),s=n;e.onMounted(()=>{setTimeout(()=>c=!1,15*1e3)});const f=()=>{const a=o.options.filter(d=>d[o.fieldNames.label].includes(i.value)).map(d=>d[o.fieldNames.value]);r.value=Array.from(new Set([...Array.isArray(r.value)?r.value:[],...a])),s("change",a),i.value=""},h=p=>{s("change",p)},u=p=>{s("input-value-change",p)},C=()=>{i.value=""},w=p=>{const a=p[o.fieldNames.label]||"";return(a==null?void 0:a.length)>10?`${a.slice(0,10)}...`:a};return(p,a)=>{const d=e.resolveComponent("a-button"),y=e.resolveComponent("a-select");return e.openBlock(),e.createBlock(y,{modelValue:r.value,"onUpdate:modelValue":a[0]||(a[0]=k=>r.value=k),"input-value":i.value,"onUpdate:inputValue":a[1]||(a[1]=k=>i.value=k),loading:_.value,"allow-search":p.multiple?{retainInputValue:!0}:!0,options:p.options,"filter-option":!0,placeholder:p.placeholder,multiple:p.multiple,disabled:p.disabled,"field-names":p.fieldNames,"allow-clear":!p.hideClean||!p.disabled,"allow-create":p.allowCreate,"max-tag-count":p.maxTagCount,"virtual-list-props":o.virtualListProps,"format-label":p.formatLabel?p.formatLabel:w,onChange:h,onInputValueChange:u},e.createSlots({_:2},[o.multiple&&i.value?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",Fe,[e.createVNode(d,{type:"text",size:"mini",onClick:f},{default:e.withCtx(()=>a[2]||(a[2]=[e.createTextVNode("全选")])),_:1,__:[2]}),e.createVNode(d,{type:"text",size:"mini",onClick:C},{default:e.withCtx(()=>a[3]||(a[3]=[e.createTextVNode("清除")])),_:1,__:[3]})])]),key:"0"}:void 0,i.value?{name:"empty",fn:e.withCtx(()=>[e.createElementVNode("div",Re,[e.createVNode(d,{type:"text",size:"mini",onClick:C},{default:e.withCtx(()=>a[4]||(a[4]=[e.createTextVNode("清除")])),_:1,__:[4]})])]),key:"1"}:void 0]),1032,["modelValue","input-value","loading","allow-search","options","placeholder","multiple","disabled","field-names","allow-clear","allow-create","max-tag-count","virtual-list-props","format-label"])}}}),[["__scopeId","data-v-6a0292e1"]]);T.install=t=>{t.component("ZlSelect",T)};const Pe={class:"zl-dialog"},He={class:"zl-dialog__content"},We={key:0,class:"zl-dialog__footer"},je={class:"zl-dialog__footer__custom"},Ue={class:"zl-dialog__footer__btn"},D=N(e.defineComponent({__name:"index",props:{visible:{type:Boolean,default:!1},title:{default:""},width:{default:800},titleAlign:{default:"start"},hideCustomFooter:{type:Boolean,default:!1},maskClosable:{type:Boolean,default:!1},onBeforeOk:{}},emits:["update:visible","ok","cancel"],setup(t,{emit:n}){const o=t,l=n,r=e.useSlots(),c=e.ref(!1),_=e.computed(()=>{const u={...r};return delete u.default,delete u["custom-footer"],u}),i=u=>{u&&(l("update:visible",!1),l("ok")),c.value=!1},s=()=>{if(c.value=!0,!o.onBeforeOk){l("ok");return}const u=o.onBeforeOk(i);h(u)?u.then(()=>i(!0)).catch(()=>i(!1)).finally(()=>c.value=!1):typeof u=="boolean"&&i(u)},f=()=>{l("cancel")},h=u=>!!u&&(typeof u=="object"||typeof u=="function")&&typeof u.then=="function";return(u,C)=>{const w=e.resolveComponent("a-button"),p=e.resolveComponent("a-modal");return e.openBlock(),e.createBlock(p,e.mergeProps({visible:o.visible,"onUpdate:visible":C[0]||(C[0]=a=>o.visible=a),width:o.width,closable:!0,footer:!1,title:o.title,"title-align":o.titleAlign,"mask-closable":o.maskClosable,onCancel:C[1]||(C[1]=a=>i(!0))},u.$attrs),e.createSlots({default:e.withCtx(()=>[e.createElementVNode("div",Pe,[e.createElementVNode("div",He,[e.renderSlot(u.$slots,"default",{},void 0,!0)]),o.hideCustomFooter?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",We,[e.createElementVNode("div",je,[e.renderSlot(u.$slots,"custom-footer",{},void 0,!0)]),e.createElementVNode("div",Ue,[e.createVNode(w,{class:"zl-dialog__footer__btn_cancel",onClick:f},{default:e.withCtx(()=>C[2]||(C[2]=[e.createTextVNode("取消")])),_:1,__:[2]}),e.createVNode(w,{loading:c.value,type:"primary",class:"zl-dialog__footer__btn_confirm",onClick:s},{default:e.withCtx(()=>C[3]||(C[3]=[e.createTextVNode("确认")])),_:1,__:[3]},8,["loading"])])]))])]),_:2},[e.renderList(_.value,(a,d)=>({name:d,fn:e.withCtx(y=>[e.renderSlot(u.$slots,d,{data:y},void 0,!0)])}))]),1040,["visible","width","title","title-align","mask-closable"])}}}),[["__scopeId","data-v-ce703b82"]]);D.install=t=>{t.component("ZlDialog",D)};function Ke(t){t.component("ZlLayout",z),t.component("ZlContentBox",I),t.component("ZlSearchBox",O),t.component("ZlTrigger",E),t.component("ZlTable",L),t.component("ZlIcon",$),t.component("ZlSelect",T),t.component("ZlDialog",D)}function qe(t,n,o){const l=e.ref(!0),r=()=>e.h(ae.Modal,{...n,visible:l.value,onCancel:()=>{l.value=!1},onOk:()=>{l.value=!1}},{...o,defalut:()=>e.h(t,n)}),c=e.createApp(r);Ke(c);const _=document.createElement("div");return c.mount(_),document.body.appendChild(_),{unmount:()=>{c.unmount(),_.remove(),document.body.removeChild(_)}}}const Je=Object.freeze(Object.defineProperty({__proto__:null,default:qe},Symbol.toStringTag,{value:"Module"}));function U(t){return t&&typeof t=="object"}function ne(t){return Array.isArray(t)}function Ye(t){return typeof t=="function"}function K(t,n=new Map){const o={};if(n.has(t))return n.get(t);n.set(t,t);for(const l in t)ne(t[l])?o[l]=t[l].map(r=>U(r)?K(r,n):r):U(t[l])?o[l]=K(t[l],n):o[l]=t[l];return o}function Ge(t){const n={};return Object.keys(t).forEach(o=>{[void 0,null,""].includes(t[o])||(n[o]=t[o])}),n}function Qe(){let t=new Date().getTime();return"xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx".replace(/[xy]/g,function(n){let o=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(n==="x"?o:o&3|8).toString(16)})}function le(t,n){let o;return function(...l){o&&clearTimeout(o),o=setTimeout(()=>{t.apply(this,l)},n)}}function Xe(){const t=e.ref(0);let n=!1;const o=le(()=>{t.value=ve()},200);return e.onMounted(()=>{n=!0,window.addEventListener("resize",o)}),e.onUnmounted(()=>{window.removeEventListener("resize",o)}),e.onActivated(()=>{n||(n=!0,window.addEventListener("resize",o)),o()}),e.onDeactivated(()=>{n=!1,window.removeEventListener("resize",o)}),o(),{tableHeight:t}}function ve(){const t=document.querySelector(".zl-content-box");if(!t)return"100%";const n=t.querySelector(".zl-search-box"),o=t.querySelector(".header-optional"),l=t.querySelector(".table-header-extend"),r=t.querySelector("thead"),c=window.getComputedStyle(t),_=+(c==null?void 0:c.height.replace("px",""))-et(c==null?void 0:c.padding),i=(n==null?void 0:n.offsetHeight)||0,s=_-i-((o==null?void 0:o.offsetHeight)||0)-((l==null?void 0:l.offsetHeight)||0)-((r==null?void 0:r.offsetHeight)||0)-81;return s>400?s:400}function et(t){const o=t.split(" ").map(l=>+l.replace("px",""));return[1,2].includes(o==null?void 0:o.length)?o[0]*2:[3,4].includes(o==null?void 0:o.length)?o[0]+o[2]:0}function tt(t,n,o="-tableCustomColumns"){if(!n)return{customColumn:e.ref([]),customColumnData:e.ref([])};const r=oe().name+o,c=X(r,[]),_=e.computed(()=>t.filter(s=>!s.hidden).map(ot));return{customColumn:e.computed({get:()=>{var s;return(s=c.value)!=null&&s.length?c.value:t.map(f=>f.key||f.dataIndex)},set:s=>{c.value=s}}),customColumnData:_}}function ot(t){const n={...t};return n.dataIndex&&(n.key=n.dataIndex),n}const nt={class:"header-optional"},lt={class:"table-header-extend"},at={key:1},rt={class:"operate-btn-box"},L=N(e.defineComponent({__name:"index",props:{columns:{default:()=>[]},data:{default:()=>[]},loading:{type:Boolean,default:!1},scroll:{default:void 0},noCache:{type:Boolean,default:!0},hideOperate:{type:Boolean,default:!1},operateWidth:{default:240},page:{default:1},limit:{default:10},total:{default:0},pagination:{default:void 0},pageSizeOptions:{default:()=>[10,20,50,100,200]},tableHeaderSplitLine:{type:Boolean,default:!0},customColumnKey:{}},emits:["pageChange"],setup(t,{emit:n}){const o=t,l=n,r=e.useSlots(),{tableHeight:c}=Xe(),_=e.ref(),i=e.computed(()=>o.columns.filter(a=>o.noCache?!a.hidden:!a.hidden&&s.value.includes(a.key||a.dataIndex)).map(a=>{const d={...a};return d.key&&(d.dataIndex=d.key),d})),{customColumn:s,customColumnData:f}=tt(o.columns,!o.noCache,o.customColumnKey),h=e.computed(()=>{var a,d;return{x:((a=o.scroll)==null?void 0:a.x)||o.columns.reduce((y,k)=>y+(k.width||120),o.operateWidth),y:((d=o.scroll)==null?void 0:d.y)||c.value}}),u=e.computed(()=>o.pagination!==void 0?o.pagination:{current:o.page||1,total:o.total||0,pageSize:o.limit||10,showTotal:!0,showPageSize:!0,pageSizeOptions:o.pageSizeOptions||[10,20,50,100,200],size:"small"}),C=e.computed(()=>{var d;const a={...r};return delete a.columns,delete a["header-left-optional"],delete a["header-right-optional"],delete a["table-extend"],(d=o.columns)==null||d.forEach(y=>{if(y.custom){const k=y.key||y.dataIndex;delete a[k]}}),a}),w=a=>{l("pageChange",a,o.limit)},p=a=>{l("pageChange",o.page,a)};return(a,d)=>{const y=e.resolveComponent("a-space"),k=e.resolveComponent("a-checkbox"),B=e.resolveComponent("a-checkbox-group"),Z=e.resolveComponent("a-table-column"),P=e.resolveComponent("a-tooltip"),A=e.resolveComponent("a-table"),q=e.resolveDirective("ellipsis");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["zl-table",{"zl-table-header-split-line":o.tableHeaderSplitLine}]),style:e.normalizeStyle({"--table-height":e.unref(c)-20+"px"})},[e.createElementVNode("div",nt,[e.createVNode(y,null,{default:e.withCtx(()=>[e.renderSlot(a.$slots,"custom-left",{},void 0,!0)]),_:3}),e.createVNode(y,null,{default:e.withCtx(()=>[e.renderSlot(a.$slots,"custom-right",{},void 0,!0),o.noCache?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(E,{key:0,"popup-translate":[-35,0]},{content:e.withCtx(()=>[e.createElementVNode("div",{class:"custom-column-box",style:e.normalizeStyle({maxHeight:e.unref(c)+"px"})},[e.createVNode(B,{direction:"vertical",modelValue:e.unref(s),"onUpdate:modelValue":d[0]||(d[0]=m=>e.isRef(s)?s.value=m:null)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(f),(m,S)=>(e.openBlock(),e.createBlock(k,{key:m.key,value:m.key,disabled:S<2},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.title),1)]),_:2},1032,["value","disabled"]))),128))]),_:1},8,["modelValue"])],4)]),default:e.withCtx(()=>[d[1]||(d[1]=e.createElementVNode("div",{class:"custom-column"},"自定义列",-1))]),_:1,__:[1]}))]),_:3})]),e.createElementVNode("div",lt,[e.renderSlot(a.$slots,"table-extend",{},void 0,!0)]),e.createVNode(A,e.mergeProps({ref_key:"tableRef",ref:_,columns:i.value,data:o.data,pagination:u.value,scroll:h.value,loading:a.loading,rowClass:["zl-table-row"],stripe:"","column-resizable":"",onPageChange:w,onPageSizeChange:p},{...a.$attrs}),e.createSlots({columns:e.withCtx(()=>[e.renderSlot(a.$slots,"columns",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,m=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[m.custom?(e.openBlock(),e.createBlock(Z,e.mergeProps({key:0,ref_for:!0},m,{width:m.width||120,ellipsis:!!m.ellipsis}),{cell:e.withCtx(({record:S})=>[e.renderSlot(a.$slots,m.dataIndex,{data:S},void 0,!0)]),_:2},1040,["width","ellipsis"])):(e.openBlock(),e.createBlock(Z,e.mergeProps({key:1,ref_for:!0},m,{width:m.width||100,ellipsis:!!m.ellipsis}),{cell:e.withCtx(({record:S})=>[m.ellipsis?(e.openBlock(),e.createBlock(P,{key:0,position:"left",content:m!=null&&m.computed?m.computed(S):S[m.dataIndex]},{default:e.withCtx(()=>[e.withDirectives((e.openBlock(),e.createElementBlock("div",null,[e.createTextVNode(e.toDisplayString(m!=null&&m.computed?m.computed(S):S[m.dataIndex]),1)])),[[q,m.ellipsis]])]),_:2},1032,["content"])):(e.openBlock(),e.createElementBlock("div",at,e.toDisplayString(m!=null&&m.computed?m.computed(S):S[m.dataIndex]),1))]),_:2},1040,["width","ellipsis"]))],64))),256)),o.hideOperate?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Z,{key:0,title:"操作",align:"left",fixed:"right",cellStyle:{width:o.operateWidth+"px"}},{cell:e.withCtx(({record:m})=>[e.createElementVNode("div",rt,[e.renderSlot(a.$slots,"table-operate",{data:m},void 0,!0)])]),_:3},8,["cellStyle"]))],!0)]),empty:e.withCtx(()=>[d[2]||(d[2]=e.createElementVNode("div",{class:"empty-container"},[e.createElementVNode("img",{src:"https://static.wi-fi.cn/omc/202507/2fd4569592c959158357dc30ba24c45f8cdc0841.png",alt:""})],-1))]),_:2},[e.renderList(C.value,(m,S)=>({name:S,fn:e.withCtx(J=>[e.renderSlot(a.$slots,S,{data:J},void 0,!0)])}))]),1040,["columns","data","pagination","scroll","loading"])],6)}}}),[["__scopeId","data-v-9ad7b719"]]);L.install=t=>{t.component("ZlTable",L)};const st={install(t){t.component("ZlLayout",z),t.component("ZlContentBox",I),t.component("ZlSearchBox",O),t.component("ZlTrigger",E),t.component("ZlTable",L),t.component("ZlIcon",$),t.component("ZlSelect",T),t.component("ZlDialog",D)}};b.ZlContentBox=I,b.ZlDialog=D,b.ZlIcon=$,b.ZlLayout=z,b.ZlSearchBox=O,b.ZlSelect=T,b.ZlTable=L,b.ZlTrigger=E,b.clean=Ge,b.debounce=le,b.deepClone=K,b.default=st,b.getUUID=Qe,b.isArray=ne,b.isFunction=Ye,b.isObject=U,b.showDialog=Je,Object.defineProperties(b,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});