UNPKG

el-plus-crud

Version:

采用Vue3 + TS,封装的element-plus数据驱动表单、列表组件

1 lines 214 kB
(function(e,te){typeof exports=="object"&&typeof module<"u"?module.exports=te(require("vue"),require("@vueuse/core"),require("element-plus")):typeof define=="function"&&define.amd?define(["vue","@vueuse/core","element-plus"],te):(e=typeof globalThis<"u"?globalThis:e||self,e["el-plus-crud"]=te(e.vue,e.core,e.elementPlus))})(this,function(e,te,he){"use strict";const le=async(t,o)=>{var n,i,d,r,a,g;const l=Object.assign({},o,(n=t.desc)==null?void 0:n._attrs,t.desc,(i=t.desc)==null?void 0:i.attrs,Sn(t.desc));return t.desc.multiple&&(l.multiple=!0,l.showCheckbox=!0,["select"].indexOf(t.desc.type)>=0&&(l.collapseTags=((d=t.desc.attrs)==null?void 0:d.collapseTags)??((r=t.desc)==null?void 0:r.collapseTags)??!1,l.collapseTagsTooltip=((a=t.desc.attrs)==null?void 0:a.collapseTagsTooltip)??((g=t.desc)==null?void 0:g.collapseTagsTooltip)??!1)),t.desc.elType&&(typeof t.desc.elType=="function"?l.type=t.desc.elType(t.formData):l.type=t.desc.elType),delete l.label,l},re=t=>{var l;const o={};return(l=t.desc)!=null&&l.on&&Object.keys(t.desc.on).map(n=>{o[n]=i=>{e.nextTick(()=>{t.desc.on[n](t.formData,t.rowIndex,i)})}}),o};function Sn(t){if(t!=null&&t.placeholder)return{placeholder:t==null?void 0:t.placeholder};if(!t||!t.type)return"";switch(t.type){case"input":case"nbinput":case"password":case"number":case"validCode":case"tag":case"textarea":case"percentinput":return{placeholder:(t==null?void 0:t.placeholder)||"请输入"+((t==null?void 0:t._label)||"")};case"switch":return{};case"area":case"select":case"category":case"cascader":return{placeholder:(t==null?void 0:t.placeholder)||"请选择"+(t.remote?"(可输入进行搜索)":(t==null?void 0:t._label)||"")};case"data":case"datetime":case"datas":case"date":return{placeholder:"请选择日期"};case"daterange":case"datetimerange":case"timerange":case"monthrange":return{startPlaceholder:"开始日期",endPlaceholder:"结束日期"};case"dates":return{placeholder:"请选择一个或多个日期"};case"month":return{placeholder:"请选择月"};case"time":case"timsPicker":return{placeholder:"请选择时间"};case"week":return{placeholder:"请选择周"};case"year":return{placeholder:"请选择年"};case"upimg":return{placeholder:"请上传"};case"upfile":return{placeholder:"点击上传"}}}const Tn={name:"ElPlusFormArea",inheritAttrs:!1,typeName:"area",customOptions:{}},Dn=e.defineComponent({...Tn,props:{modelValue:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=e.inject("globalData"),n=t,i=o,d=e.ref([]),r=e.ref({}),a=e.ref(!1),g=e.ref(re(n)),c=te.useVModel(n,"modelValue",i);return e.watch(()=>n.modelValue,s=>{c.value=Array.isArray(s)?s:s==null?[]:[s]},{immediate:!0}),e.onBeforeMount(async()=>{r.value=await le(n,{props:{value:"id",label:"name",children:"childs",checkStrictly:!!n.desc.checkStrictly},clearable:!0,filterable:!0,...e.useAttrs()}),a.value=!0}),e.onMounted(async()=>{d.value=l.areaList||[]}),(s,p)=>{const u=e.resolveComponent("el-cascader");return a.value?(e.openBlock(),e.createBlock(u,e.mergeProps({key:0,class:"ElPlusFormArea-panel"},r.value,{disabled:t.disabled},e.toHandlers(g.value),{modelValue:e.unref(c),"onUpdate:modelValue":p[0]||(p[0]=m=>e.isRef(c)?c.value=m:null),options:d.value}),null,16,["disabled","modelValue","options"])):e.createCommentVNode("",!0)}}}),om="",ce=(t,o)=>{const l=t.__vccOpts||t;for(const[n,i]of o)l[n]=i;return l},il=ce(Dn,[["__scopeId","data-v-877642f2"]]),Fn=Object.freeze(Object.defineProperty({__proto__:null,default:il},Symbol.toStringTag,{value:"Module"})),Pn={name:"ElPlusFormAutocomplete",inheritAttrs:!1,typeName:"autocomplete",customOptions:{}},Nn=e.defineComponent({...Pn,props:{modelValue:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=t,n=o,i=te.useVModel(l,"modelValue",n),d=e.ref(Object.assign({},e.useSlots(),l.desc.slots)),r=e.ref({}),a=e.ref(re(l));return e.onBeforeMount(async()=>{r.value=await le(l,{autocomplete:"new-password",...e.useAttrs()})}),(g,c)=>{const s=e.resolveComponent("el-autocomplete");return e.openBlock(),e.createBlock(s,e.mergeProps({class:"ElPlusFormAutocomplete-panel"},r.value,{disabled:t.disabled},e.toHandlers(a.value),{modelValue:e.unref(i),"onUpdate:modelValue":c[0]||(c[0]=p=>e.isRef(i)?i.value=p:null)}),e.createSlots({default:e.withCtx(p=>[e.renderSlot(g.$slots,"default",{data:p},void 0,!0)]),_:2},[e.renderList(d.value,(p,u,m)=>({name:u,fn:e.withCtx(C=>[e.renderSlot(g.$slots,u,{data:C},void 0,!0)])}))]),1040,["disabled","modelValue"])}}}),nm="",cl=ce(Nn,[["__scopeId","data-v-23f5ab4b"]]),On=Object.freeze(Object.defineProperty({__proto__:null,default:cl},Symbol.toStringTag,{value:"Module"}));/*! Element Plus Icons Vue v2.3.2 */var In=e.defineComponent({name:"ArrowDown",__name:"arrow-down",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"})]))}}),dl=In,Mn=e.defineComponent({name:"ArrowRight",__name:"arrow-right",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"})]))}}),jn=Mn,Ln=e.defineComponent({name:"ArrowUp",__name:"arrow-up",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"})]))}}),zn=Ln,$n=e.defineComponent({name:"Download",__name:"download",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-253.696 236.288-236.352 45.248 45.248L508.8 704 192 387.2l45.248-45.248L480 584.704V128h64z"})]))}}),Un=$n,Rn=e.defineComponent({name:"Expand",__name:"expand",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M128 192h768v128H128zm0 256h512v128H128zm0 256h768v128H128zm576-352 192 160-192 128z"})]))}}),Kn=Rn,Hn=e.defineComponent({name:"Loading",__name:"loading",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"})]))}}),zt=Hn,Qn=e.defineComponent({name:"Menu",__name:"menu",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 448a32 32 0 0 1-32-32V160.064a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V416a32 32 0 0 1-32 32zm448 0a32 32 0 0 1-32-32V160.064a32 32 0 0 1 32-32h255.936a32 32 0 0 1 32 32V416a32 32 0 0 1-32 32zM160 896a32 32 0 0 1-32-32V608a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32zm448 0a32 32 0 0 1-32-32V608a32 32 0 0 1 32-32h255.936a32 32 0 0 1 32 32v256a32 32 0 0 1-32 32z"})]))}}),qn=Qn,vn=e.defineComponent({name:"Plus",__name:"plus",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"})]))}}),Gn=vn,Yn=e.defineComponent({name:"Search",__name:"search",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"})]))}}),Wn=Yn,Jn=e.defineComponent({name:"Setting",__name:"setting",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357 357 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a352 352 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357 357 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294 294 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293 293 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294 294 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288 288 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293 293 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a288 288 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384m0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256"})]))}}),Xn=Jn,Zn=e.defineComponent({name:"Share",__name:"share",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"m679.872 348.8-301.76 188.608a127.8 127.8 0 0 1 5.12 52.16l279.936 104.96a128 128 0 1 1-22.464 59.904l-279.872-104.96a128 128 0 1 1-16.64-166.272l301.696-188.608a128 128 0 1 1 33.92 54.272z"})]))}}),fl=Zn,ea=e.defineComponent({name:"Upload",__name:"upload",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M160 832h704a32 32 0 1 1 0 64H160a32 32 0 1 1 0-64m384-578.304V704h-64V247.296L237.248 490.048 192 444.8 508.8 128l316.8 316.8-45.312 45.248z"})]))}}),ta=ea,la=e.defineComponent({name:"UserFilled",__name:"user-filled",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M288 320a224 224 0 1 0 448 0 224 224 0 1 0-448 0m544 608H160a32 32 0 0 1-32-32v-96a160 160 0 0 1 160-160h448a160 160 0 0 1 160 160v96a32 32 0 0 1-32 32z"})]))}}),ul=la,oa=e.defineComponent({name:"WarningFilled",__name:"warning-filled",setup(t){return(o,l)=>(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"})]))}}),na=oa;const aa={name:"ElPlusFormBtn",inheritAttrs:!1,typeName:"btn",customOptions:{}},Re=e.defineComponent({...aa,props:{field:{},rowIndex:{},loading:{type:Boolean},desc:{},formData:{}},setup(t){const o=e.inject("lodash"),l=e.inject("defaultConf"),n=t,i=e.ref(n.loading??!1),d=e.computed(()=>{var m;if((m=n.desc)!=null&&m.auth)if(!l.auth)console.warn("使用auth属性,请在crud注册时传入auth校验方法~");else return l.auth(n.desc.auth);return!0}),r=e.computed(()=>{var m;return!!((m=n.desc)!=null&&m.text)}),a=new Set(["text","plain","bg","loading","round","circle","dashed","native-type","autofocus","auto-insert-space","tag","size","btnType","btnLabel","mask","confirm","auth","isTag","label","on","_attrs","type"]),g=e.computed(()=>{const m={};for(const C in s.value)a.has(C)||(m[C]=s.value[C]);return m}),c=e.computed(()=>{const m=s.value;return m.btnType?typeof m.btnType=="function"?m.btnType(n.formData||{})||"primary":m.btnType||"primary":m.type||"primary"}),s=e.computed(()=>{var C;const m=Object.assign({},e.useAttrs(),n.desc,(C=n.desc)==null?void 0:C._attrs);return m.btnType&&(typeof m.btnType=="function"?m.type=m.btnType(n.formData||{}):m.type=m.btnType,m.type||(m.type="primary")),m}),p=e.computed(()=>{const m={};if(n.desc&&n.desc.on)for(const C in n.desc.on)C==="click"&&n.desc.mask?m[C]=function(){var T;i.value=!0,(T=n.desc)==null||T.on[C]({row:n.formData||{},callBack:N=>{setTimeout(()=>i.value=!1,N||50)},field:n.field,rowIndex:n.rowIndex})}:m[C]=function(){var T;(T=n.desc)==null||T.on[C]({row:o.cloneDeep(n.formData||{}),field:n.field,rowIndex:n.rowIndex})};return m}),u=e.computed(()=>{var m,C;return(m=n.desc)!=null&&m.btnLabel?typeof n.desc.btnLabel=="function"?n.desc.btnLabel(n.formData||{}):n.desc.btnLabel:(C=n.desc)!=null&&C.label?typeof n.desc.label=="function"?n.desc.label(n.formData||{}):n.desc.label:""});return e.watch(()=>n.loading,m=>{i.value=m}),(m,C)=>{var M,L,V,F,A,O,_,E,k,x;const T=e.resolveComponent("el-icon"),N=e.resolveComponent("el-link"),w=e.resolveComponent("el-popconfirm"),I=e.resolveComponent("el-button");return d.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[r.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[(M=n.desc)!=null&&M.confirm?(e.openBlock(),e.createBlock(w,{key:0,onConfirm:p.value.click,title:(L=n.desc)==null?void 0:L.confirm},{reference:e.withCtx(()=>{var j,H;return[e.createVNode(N,e.mergeProps({underline:"never",type:c.value},g.value,{disabled:i.value||g.value.disabled,style:{pointerEvents:(j=t.desc)!=null&&j.isTag?"none":"all"},class:{"no-label":!((H=n.desc)!=null&&H.label)}}),{default:e.withCtx(()=>[i.value?(e.openBlock(),e.createBlock(T,{key:0,class:"is-loading"},{default:e.withCtx(()=>[e.createVNode(e.unref(zt))]),_:1})):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"default",{},()=>{var Q;return[(Q=n.desc)!=null&&Q.label?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(u.value),1)],64)):e.createCommentVNode("",!0)]})]),_:3},16,["type","disabled","style","class"])]}),_:3},8,["onConfirm","title"])):(e.openBlock(),e.createBlock(N,e.mergeProps({key:1,underline:"never",type:c.value},g.value,e.toHandlers(p.value),{disabled:i.value||g.value.disabled,style:{pointerEvents:(V=t.desc)!=null&&V.isTag?"none":"all"},class:{"no-label":!((F=n.desc)!=null&&F.label)}}),{default:e.withCtx(()=>[i.value?(e.openBlock(),e.createBlock(T,{key:0,class:"is-loading"},{default:e.withCtx(()=>[e.createVNode(e.unref(zt))]),_:1})):e.createCommentVNode("",!0),e.renderSlot(m.$slots,"default",{},()=>{var j;return[(j=n.desc)!=null&&j.label?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(u.value),1)],64)):e.createCommentVNode("",!0)]})]),_:3},16,["type","disabled","style","class"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[(A=n.desc)!=null&&A.confirm?(e.openBlock(),e.createBlock(w,{key:0,onConfirm:p.value.click,title:(O=n.desc)==null?void 0:O.confirm},{reference:e.withCtx(()=>{var j,H;return[e.createVNode(I,e.mergeProps({loading:i.value,size:((j=n.desc)==null?void 0:j.size)||e.unref(l).size},s.value,{class:{btnHideLabel:!((H=n.desc)!=null&&H.label)&&!m.$slots.default}}),{default:e.withCtx(()=>[e.renderSlot(m.$slots,"default",{},()=>{var Q;return[(Q=n.desc)!=null&&Q.label?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(u.value),1)],64)):e.createCommentVNode("",!0)]})]),_:3},16,["loading","size","class"])]}),_:3},8,["onConfirm","title"])):(e.openBlock(),e.createBlock(I,e.mergeProps({key:1,loading:i.value,size:((_=n.desc)==null?void 0:_.size)||e.unref(l).size},s.value,e.toHandlers(p.value),{style:{pointerEvents:(E=t.desc)!=null&&E.isTag?"none":"all"},class:{"no-label":!((k=n.desc)!=null&&k.label),btnHideLabel:!((x=n.desc)!=null&&x.label)&&!m.$slots.default}}),{default:e.withCtx(()=>[e.renderSlot(m.$slots,"default",{},()=>{var j;return[(j=n.desc)!=null&&j.label?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(u.value),1)],64)):e.createCommentVNode("",!0)]})]),_:3},16,["loading","size","style","class"]))],64))],64)):e.createCommentVNode("",!0)}}}),am="",ra=Object.freeze(Object.defineProperty({__proto__:null,default:Re},Symbol.toStringTag,{value:"Module"})),sa={class:"el-button el-plus-form-up-btn"},ia={name:"ElPlusFormUpbtn",inheritAttrs:!1,typeName:"upbtn",customOptions:{}},ca=e.defineComponent({...ia,props:{field:{},rowIndex:{},loading:{type:Boolean},desc:{},formData:{},disabled:{type:Boolean}},setup(t){const o=t,l=e.ref(!!o.loading),n=e.ref([]),i=e.ref({}),d=e.ref(!1),r={name:"file",showFileList:!1,listType:"text",accept:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel",beforeUpload:async c=>{var p,u;l.value=!0;let s=((p=o.desc)==null?void 0:p.confirm)||"";return s&&typeof((u=o.desc)==null?void 0:u.confirm)=="function"&&(s=o.desc.confirm()),s?new Promise(m=>{he.ElMessageBox.confirm(s,"提示",{type:"warning",confirmButtonText:"确定",cancelButtonText:"取消"}).then(()=>m(!0)).catch(()=>{m(!1),l.value=!1})}):await g(c)},onError:()=>{he.ElMessage.error("文件上传出错,请检查文件格式及内容是否正确!"),l.value=!1}},a=e.computed(()=>o.desc.btnLabel?typeof o.desc.btnLabel=="function"?o.desc.btnLabel(o.formData||{}):o.desc.btnLabel:o.desc.label?typeof o.desc.label=="function"?o.desc.label(o.formData||{}):o.desc.label:"");function g(c){return new Promise((s,p)=>{l.value=!0;const u=c.name.substring(c.name.lastIndexOf(".")),m=o.desc.accept||o.desc.attrs.accept||[".xlsx",".xls"];if(m.indexOf(u)<0)return he.ElMessage.warning(`请上传后缀为${m.join(",")}格式的文件!`),l.value=!1,p(!1),!1;if(c.size>20*1024*1024)return he.ElMessage.warning("超出文件大小限制(最大为20M)!"),l.value=!1,p(!1),!1;s(!0)})}return e.watch(()=>o.loading,c=>{l.value=c},{immediate:!0}),e.onBeforeMount(async()=>{i.value=await le(o,{...r,...e.useAttrs()}),i.value.action||console.warn("上传组件未填写action..."),i.value.onSuccess=c=>{var s,p;(p=(s=o.desc)==null?void 0:s.on)!=null&&p.success&&o.desc.on.success({row:c,callBack:()=>{setTimeout(()=>l.value=!1,500)},field:o.field,rowIndex:o.rowIndex})},d.value=!0}),(c,s)=>{const p=e.resolveComponent("el-button"),u=e.resolveComponent("el-upload");return e.openBlock(),e.createElementBlock("div",sa,[e.createVNode(u,e.mergeProps({class:"upload-demo",style:{display:"flex"}},i.value,{disabled:l.value||i.value.disabled,modelValue:n.value,"onUpdate:modelValue":s[0]||(s[0]=m=>n.value=m)}),{file:e.withCtx(()=>[...s[1]||(s[1]=[e.createElementVNode("div",null,null,-1)])]),default:e.withCtx(()=>[e.createVNode(p,{type:"primary",icon:e.unref(ta),loading:l.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value),1)]),_:1},8,["icon","loading"])]),_:1},16,["disabled","modelValue"])])}}}),rm="",yt=ce(ca,[["__scopeId","data-v-189da0c6"]]),da=Object.freeze(Object.defineProperty({__proto__:null,default:yt},Symbol.toStringTag,{value:"Module"})),fa={name:"ElPlusFormBtns",inheritAttrs:!1,typeName:"btns",customOptions:{}},pl=e.defineComponent({...fa,props:{field:{},rowIndex:{},desc:{},formData:{},disabled:{type:Boolean}},setup(t){const o=e.inject("defaultConf"),l=t,n=e.ref([]),i=e.ref([]),d=e.computed(()=>{switch(l.desc.align){case"right":return"flex-end";case"center":return"center";case void 0:case"left":return"flex-start";default:return"flex-start"}}),r=e.computed(()=>s=>{const p={};if(s&&s.on)for(const u in s.on)u==="click"&&s.confirm?p[u]=function(){he.ElMessageBox.confirm(s.confirm,"提示",{type:"warning",confirmButtonText:"确定",cancelButtonText:"取消"}).then(()=>{s.on[u]({row:l.formData||{},field:l.field,rowIndex:l.rowIndex})})}:p[u]=function(){s.on[u]({row:l.formData||{},field:l.field,rowIndex:l.rowIndex})};return p}),a=()=>{const s=[];i.value=[],l.desc.btns.length>0&&l.desc.btns.map(u=>{g(u)&&s.push(u)}),n.value=s;const p=l.desc.limit||3;n.value.length>p&&(i.value=n.value.splice(p-1))},g=s=>{let p=!0;return typeof s.vif=="function"?p=!!c(s.vif):typeof s.vif=="boolean"&&(p=s.vif),p&&s!=null&&s.auth&&(o.auth?p=o.auth(s.auth):console.warn("使用auth属性,请在crud注册时传入auth校验方法~")),p},c=s=>s(l.formData||{});return e.watch(()=>l.desc,()=>a()),e.watch(()=>l.formData,()=>a()),e.onMounted(()=>{a()}),(s,p)=>{const u=e.resolveComponent("el-icon"),m=e.resolveComponent("el-button"),C=e.resolveComponent("el-dropdown-item"),T=e.resolveComponent("el-dropdown-menu"),N=e.resolveComponent("el-dropdown");return e.openBlock(),e.createElementBlock("div",{class:"el-plus-form-btn-group",style:e.normalizeStyle({"justify-content":d.value})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(w,I)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:I+(w.label||w.title||"")},[w.elType==="upload"?(e.openBlock(),e.createBlock(yt,{key:0,type:"primary",field:t.field,desc:w||{},formData:t.formData,plain:(w&&w.plain)??t.desc.plain??!0,disabled:t.disabled||t.desc.disabled,text:t.desc.text,rowIndex:t.rowIndex},null,8,["field","desc","formData","plain","disabled","text","rowIndex"])):(e.openBlock(),e.createBlock(Re,{key:1,type:"primary",field:t.field,desc:w||{},formData:t.formData,plain:(w&&w.plain)??t.desc.plain??!0,disabled:t.disabled||t.desc.disabled,text:t.desc.text,rowIndex:t.rowIndex},null,8,["field","desc","formData","plain","disabled","text","rowIndex"]))],64))),128)),i.value&&i.value.length>0?(e.openBlock(),e.createBlock(N,{key:0,class:"group-menu-btn",size:t.desc.size||"default",disabled:t.disabled||t.desc.disabled},{dropdown:e.withCtx(()=>[e.createVNode(T,null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(w,I)=>(e.openBlock(),e.createBlock(C,e.mergeProps({key:I+(w.label||w.title)},e.toHandlers(r.value(w))),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(w.label||w.title),1)]),_:2},1040))),128))]),_:1})]),default:e.withCtx(()=>[e.createVNode(m,{type:"primary",size:t.desc.size||"default",plain:t.desc.plain??!0},{default:e.withCtx(()=>[p[0]||(p[0]=e.createTextVNode(" 更多",-1)),e.createVNode(u,{class:"el-icon--right"},{default:e.withCtx(()=>[e.createVNode(e.unref(dl))]),_:1})]),_:1},8,["size","plain"])]),_:1},8,["size","disabled"])):e.createCommentVNode("",!0)],4)}}}),sm="",ua=Object.freeze(Object.defineProperty({__proto__:null,default:pl},Symbol.toStringTag,{value:"Module"}));function pa(t){return Array.isArray(t)?t:t==null||t===""?[]:t.split(",")}function ma(t,o){const l={"M+":t.getMonth()+1,"d+|D+":t.getDate(),"h+":t.getHours()%12===0?12:t.getHours()%12,"H+":t.getHours(),"m+|M+":t.getMinutes(),"s+|S+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds(),a:t.getHours()<12?"上午":"下午",A:t.getHours()<12?"AM":"PM"};/(y+|Y+)/.test(o)&&(o=o.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(let n in l)new RegExp("("+n+")").test(o)&&(o=o.replace(RegExp.$1,RegExp.$1.length===1?l[n]:("00"+l[n]).substr((""+l[n]).length)));return o}function ze(t,o){if(!o||!t||t.length<=0)return null;if(Array.isArray(t)){let l=JSON.parse(JSON.stringify(o));for(let n=0;n<t.length;n++){if(l=l[Array.isArray(l)?parseInt(t[n]):t[n]],l==null)return null;if(l==="")return""}return l}else return o[t]||null}function ga(t){switch(t.type){case void 0:t.type="primary";break;case"add":t.type="primary",t.title=t.title||"新增",t.icon="ele-Plus";break;case"edit":t.type="primary",t.title=t.title||"编辑",t.icon="ele-EditPen";break;case"delete":case"del":t.type="danger",t.title=t.title||"删除",t.icon="ele-Delete";break}return t}function ml(t,o,l,n,i){const d=[],r=new Date().getTime();return t&&t.length>0&&t.map((a,g)=>{switch(a.children?(a.headerAlign=a.headerAlign||"center",a.children=ml(a.children,o,l,n||"center",i)):(a.headerAlign=a.headerAlign||n||"center",a.align=a.align||n||"center"),a.type||(a.type="text"),a.type){case"image":a.width=a.width||"110px",a.align=a.align||n||"center",a.headerAlign=a.headerAlign||n||"center";break;case"btns":if(!a.minWidth&&a.btns&&a.btns.length>=2){let c=0;for(let s=0;s<a.btns.length&&s<(a.limit||3);s++)a.btns[s]&&typeof a.btns[s].label=="string"?c+=a.btns[s].label.length:c+=4;a.width=a.width||c*24+"px"}a.align=a.align||n||"center",a.headerAlign=a.headerAlign||n||"center",a.text=!0;break}a.minWidth=a.minWidth||(a.label!=="操作"?i:"auto"),a.showOverflowTooltip=a.label!=="操作",ha(a,o,l),a.__id=`${r+g}`,d.push(a)}),d}function ha(t,o,l){t.vif!==void 0&&t.vif!==null?typeof t.vif=="function"?t._vif=t.vif(t):t._vif=!!t.vif:t._vif=!0,t.auth&&(o.auth?t._vif=o.auth(t.auth):console.warn("使用auth属性,请在crud注册时传入auth校验方法~")),t.__vif=l?t.scShow!==!1&&t._vif:t._vif,t.children&&t.children.every(n=>!n.__vif)&&(t.__vif=!1)}const ya=768,$t=e.ref(!1),Ut=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(`(max-width: ${ya}px)`):null;Ut&&($t.value=Ut.matches,Ut.addEventListener("change",t=>$t.value=t.matches));function nt(){return $t.value}function Ne(t,o){return JSON.stringify(t)===JSON.stringify(o)}function Oe(t){return t instanceof Promise||typeof(t==null?void 0:t.then)=="function"}const ba=(t,o)=>{let l="";for(const n in t)o&&Array.isArray(o)&&o.length>0&&o.indexOf(n)>=0||t[n]!==void 0&&t[n]!==null&&t[n]!==""&&(l!==""&&(l+="&"),l+=n+"="+t[n]);return l},at=(t,o)=>{if(t===""||t===null||t===void 0)return"";let l="YYYY-MM-DD HH:mm:ss";return o&&(typeof o=="string"?l=o:l=o(t)),ma(new Date(t),l)},_a={name:"ElPlusFormCascader",inheritAttrs:!1,typeName:"cascader",customOptions:{}},ka=e.defineComponent({..._a,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=e.inject("globalData"),n=t,i=o,d=te.useVModel(n,"modelValue",i),r=e.ref(!1),a=e.ref({}),g=e.ref(re(n)),c=e.reactive([]);return e.onBeforeMount(async()=>{a.value=await le(n,{clearable:!0,props:{value:"value",label:"label",children:"children",checkStrictly:!!n.desc.checkStrictly},...e.useAttrs()}),r.value=!0}),e.watch(()=>n.desc.options,async s=>{typeof s=="string"?c.splice(0,c.length,...l[s]||[]):typeof s=="function"?c.splice(0,c.length,...await s(n.formData||{})):Array.isArray(s)?s&&c&&!Ne(s,c)&&c.splice(0,c.length,...s):c.splice(0,c.length)},{immediate:!0}),(s,p)=>{const u=e.resolveComponent("el-cascader");return r.value?(e.openBlock(),e.createBlock(u,e.mergeProps({key:0,class:"ElPlusFormCascader-panel"},a.value,{disabled:t.disabled},e.toHandlers(g.value),{options:c,modelValue:e.unref(d),"onUpdate:modelValue":p[0]||(p[0]=m=>e.isRef(d)?d.value=m:null)}),null,16,["disabled","options","modelValue"])):e.createCommentVNode("",!0)}}}),im="",gl=ce(ka,[["__scopeId","data-v-c9c2c533"]]),Ca=Object.freeze(Object.defineProperty({__proto__:null,default:gl},Symbol.toStringTag,{value:"Module"})),wa={name:"ElPlusFormCascaderPanel",inheritAttrs:!1,typeName:"cascaderPanel",customOptions:{}},xa=e.defineComponent({...wa,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=e.inject("globalData"),n=t,i=o,d=te.useVModel(n,"modelValue",i);e.watch(()=>n.modelValue,s=>{d.value=s?Array.isArray(s)?s:[s]:[]},{immediate:!0});const r=e.ref({}),a=e.ref(!1),g=e.ref(re(n)),c=e.reactive([]);return e.onBeforeMount(async()=>{r.value=await le(n,{props:{value:"value",label:"label",children:"children"},fetchSuggestions(s,p){p([])},...e.useAttrs()}),a.value=!0}),e.watch(()=>n.desc.options,async s=>{typeof s=="string"?c.splice(0,c.length,...l[s]||[]):typeof s=="function"?c.splice(0,c.length,...await s(n.formData||{})):Array.isArray(s)?s&&c&&!Ne(s,c)&&c.splice(0,c.length,...s):c.splice(0,c.length)},{immediate:!0}),(s,p)=>{const u=e.resolveComponent("el-cascader-panel");return a.value?(e.openBlock(),e.createBlock(u,e.mergeProps({key:0,class:"ElPlusFormCascaderPanel-panel"},r.value,{disabled:t.disabled},e.toHandlers(g.value),{options:c,modelValue:e.unref(d),"onUpdate:modelValue":p[0]||(p[0]=m=>e.isRef(d)?d.value=m:null)}),null,16,["disabled","options","modelValue"])):e.createCommentVNode("",!0)}}}),cm="",hl=ce(xa,[["__scopeId","data-v-9f5b584f"]]),Ba=Object.freeze(Object.defineProperty({__proto__:null,default:hl},Symbol.toStringTag,{value:"Module"})),Va={key:1,class:"null-tip"},Aa={name:"ElPlusFormCheckbox",inheritAttrs:!1,typeName:"checkbox",customOptions:{}},Ea=e.defineComponent({...Aa,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=e.inject("globalData"),n=t,i=o,d=te.useVModel(n,"modelValue",i),r=e.reactive([]),a=e.ref(!1),g=e.ref({}),c=e.ref(re(n));return e.onBeforeMount(async()=>{g.value=await le(n,{...e.useAttrs()}),a.value=!0}),e.watch(()=>n.desc.options,async s=>{typeof s=="string"?r.splice(0,r.length,...l[s]||[]):typeof s=="function"?r.splice(0,r.length,...await s(n.formData||{})):Array.isArray(s)?s&&r&&!Ne(s,r)&&r.splice(0,r.length,...s):r.splice(0,r.length)},{immediate:!0}),e.watch(()=>n.modelValue,s=>{s?d.value=Array.isArray(s)?s:[s]:d.value=[]},{immediate:!0}),(s,p)=>{const u=e.resolveComponent("el-checkbox"),m=e.resolveComponent("el-checkbox-group");return a.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[r!=null&&r.length?(e.openBlock(),e.createBlock(m,e.mergeProps({key:0,class:"ElPlusFormCheckbox-panel"},g.value,{disabled:t.disabled},e.toHandlers(c.value),{modelValue:e.unref(d),"onUpdate:modelValue":p[0]||(p[0]=C=>e.isRef(d)?d.value=C:null)}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r,C=>(e.openBlock(),e.createBlock(u,{key:C.value,label:C.value,value:C.value},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(C.text||C.label),1)]),_:2},1032,["label","value"]))),128))]),_:1},16,["disabled","modelValue"])):(e.openBlock(),e.createElementBlock("div",Va,"暂无选项"))],64)):e.createCommentVNode("",!0)}}}),dm="",yl=ce(Ea,[["__scopeId","data-v-2a297ce7"]]),Sa=Object.freeze(Object.defineProperty({__proto__:null,default:yl},Symbol.toStringTag,{value:"Module"})),Ta={name:"ElPlusFormCheckboxButton",inheritAttrs:!1,typeName:"checkboxButton",customOptions:{}},Da=e.defineComponent({...Ta,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=t,n=o,i=te.useVModel(l,"modelValue",n);e.watch(()=>l.modelValue,g=>{i.value=g?Array.isArray(g)?g:[g]:[]},{immediate:!0});const d=e.ref({}),r=e.ref(!1),a=e.ref(re(l));return e.onBeforeMount(async()=>{d.value=await le(l,{...e.useAttrs()}),r.value=!0}),(g,c)=>{const s=e.resolveComponent("el-checkbox-button"),p=e.resolveComponent("el-checkbox-group");return r.value?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0,class:"ElPlusFormCheckboxButton-panel"},d.value,{disabled:t.disabled},e.toHandlers(a.value),{modelValue:e.unref(i),"onUpdate:modelValue":c[0]||(c[0]=u=>e.isRef(i)?i.value=u:null)}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.desc.options,u=>(e.openBlock(),e.createBlock(s,e.mergeProps({key:u.value,value:u.value},{ref_for:!0},u.attrs),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.text),1)]),_:2},1040,["value"]))),128))]),_:1},16,["disabled","modelValue"])):e.createCommentVNode("",!0)}}}),fm="",bl=ce(Da,[["__scopeId","data-v-4dc6128e"]]),Fa=Object.freeze(Object.defineProperty({__proto__:null,default:bl},Symbol.toStringTag,{value:"Module"})),Pa={name:"ElPlusFormColor",inheritAttrs:!1,typeName:"color",customOptions:{}},Na=e.defineComponent({...Pa,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=t,n=o,i=te.useVModel(l,"modelValue",n),d=e.ref({}),r=e.ref(re(l));return e.onBeforeMount(async()=>{d.value=await le(l,{...e.useAttrs()})}),(a,g)=>{const c=e.resolveComponent("el-color-picker");return e.openBlock(),e.createBlock(c,e.mergeProps({class:"ElPlusFormColor-panel"},d.value,{disabled:t.disabled},e.toHandlers(r.value),{modelValue:e.unref(i),"onUpdate:modelValue":g[0]||(g[0]=s=>e.isRef(i)?i.value=s:null)}),null,16,["disabled","modelValue"])}}}),um="",_l=ce(Na,[["__scopeId","data-v-b89e85de"]]),Oa=Object.freeze(Object.defineProperty({__proto__:null,default:_l},Symbol.toStringTag,{value:"Module"})),Ia={name:"ElPlusFormDate",inheritAttrs:!1,typeName:"date",customOptions:{}},Ma=e.defineComponent({...Ia,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=t,n=o,i=e.ref(!1),d=e.ref({}),r=e.ref(re(l)),a=te.useVModel(l,"modelValue",n);return e.onBeforeMount(async()=>{d.value=await le(l,{valueFormat:"YYYY-MM-DD HH:mm:ss",editable:!1,...e.useAttrs()}),i.value=!0}),(g,c)=>{const s=e.resolveComponent("el-date-picker");return i.value?(e.openBlock(),e.createBlock(s,e.mergeProps({key:0,class:"ElPlusFormDate-panel"},d.value,{disabled:t.disabled},e.toHandlers(r.value),{modelValue:e.unref(a),"onUpdate:modelValue":c[0]||(c[0]=p=>e.isRef(a)?a.value=p:null)}),null,16,["disabled","modelValue"])):e.createCommentVNode("",!0)}}}),pm="",kl=ce(Ma,[["__scopeId","data-v-9e53a749"]]),ja=Object.freeze(Object.defineProperty({__proto__:null,default:kl},Symbol.toStringTag,{value:"Module"})),La={name:"ElPlusFormDaterange",inheritAttrs:!1,typeName:"daterange",customOptions:{}},za=e.defineComponent({...La,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=t,n=o,i=te.useVModel(l,"modelValue",n),d=e.ref(Object.assign({},e.useSlots(),l.desc.slots)),r=e.ref(!1),a=e.ref({}),g=e.ref(re(l));return e.onBeforeMount(async()=>{const c=typeof l.desc.elType=="function"?l.desc.elType(l.formData):l.desc.elType,s=c==="monthrange"?"YYYY-MM":c==="yearrange"?"YYYY":"YYYY-MM-DD";a.value=await le(l,{type:"daterange",format:s,valueFormat:"x",editable:!1,...e.useAttrs()}),r.value=!0}),(c,s)=>{const p=e.resolveComponent("el-date-picker");return r.value?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0,class:"el-plusF-form-daterange-panel"},a.value,{disabled:t.disabled},e.toHandlers(g.value),{modelValue:e.unref(i),"onUpdate:modelValue":s[0]||(s[0]=u=>e.isRef(i)?i.value=u:null)}),e.createSlots({_:2},[e.renderList(d.value,(u,m,C)=>({name:m,fn:e.withCtx(T=>[e.renderSlot(c.$slots,m,{data:T},void 0,!0)])}))]),1040,["disabled","modelValue"])):e.createCommentVNode("",!0)}}}),mm="",Cl=ce(za,[["__scopeId","data-v-6bed53d6"]]),$a=Object.freeze(Object.defineProperty({__proto__:null,default:Cl},Symbol.toStringTag,{value:"Module"})),Ua={name:"ElPlusFormDatetime",inheritAttrs:!1,typeName:"datetime",customOptions:{}},Ra=e.defineComponent({...Ua,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=t,n=o,i=te.useVModel(l,"modelValue",n),d=e.ref({}),r=e.ref(!1),a=e.ref(re(l));return e.onBeforeMount(async()=>{d.value=await le(l,{valueFormat:"YYYY-MM-DD HH:mm:ss",...e.useAttrs()}),r.value=!0}),(g,c)=>{const s=e.resolveComponent("el-date-picker");return r.value?(e.openBlock(),e.createBlock(s,e.mergeProps({key:0,class:"ElPlusFormDatetime-panel"},d.value,{disabled:t.disabled},e.toHandlers(a.value),{type:"datetime",modelValue:e.unref(i),"onUpdate:modelValue":c[0]||(c[0]=p=>e.isRef(i)?i.value=p:null)}),null,16,["disabled","modelValue"])):e.createCommentVNode("",!0)}}}),gm="",wl=ce(Ra,[["__scopeId","data-v-6e06c923"]]),Ka=Object.freeze(Object.defineProperty({__proto__:null,default:wl},Symbol.toStringTag,{value:"Module"})),Ha={name:"ElPlusFormDatetimerange",inheritAttrs:!1,typeName:"datetimerange",customOptions:{}},Qa=e.defineComponent({...Ha,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:o}){const l=t,n=o,i=te.useVModel(l,"modelValue",n),d=e.ref(Object.assign({},e.useSlots(),l.desc.slots)),r=e.ref({}),a=e.ref(!1),g=e.ref(re(l));return e.onBeforeMount(async()=>{r.value=await le(l,{type:"datetimerange",format:"YYYY-MM-DD HH:mm:ss",valueFormat:"x",editable:!1,...e.useAttrs()}),a.value=!0}),(c,s)=>{const p=e.resolveComponent("el-date-picker");return a.value?(e.openBlock(),e.createBlock(p,e.mergeProps({key:0,class:"el-plusF-form-datetimerange-panel"},r.value,{disabled:t.disabled},e.toHandlers(g.value),{modelValue:e.unref(i),"onUpdate:modelValue":s[0]||(s[0]=u=>e.isRef(i)?i.value=u:null)}),e.createSlots({_:2},[e.renderList(d.value,(u,m,C)=>({name:m,fn:e.withCtx(T=>[e.renderSlot(c.$slots,m,{data:T},void 0,!0)])}))]),1040,["disabled","modelValue"])):e.createCommentVNode("",!0)}}}),hm="",xl=ce(Qa,[["__scopeId","data-v-42ba2168"]]),qa=Object.freeze(Object.defineProperty({__proto__:null,default:xl},Symbol.toStringTag,{value:"Module"})),Bl=["image/jpg","image/png","image/gif","image/jpeg"],rt=[".jpe",".jpeg",".jpg",".gif",".png"],Vl=["video/3gpp","video/mpeg","application/mp4","video/mp4","video/ogg","video/x-flv","video/x-msvideo"],Al=[".3gpp",".mpeg",".mpg",".mp4",".ogv",".flv",".avi"],El=["audio/x-wav","audio/x-ms-wma","audio/mp4","audio/mp3"],Sl=[".wav",".wma",".mp4a",".mp3"],Tl=["application/x-msaccess","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"," application/vnd.ms-powerpoint","application/vnd.ms-excel"," application/msword","application/pdf","application/vnd.ms-works"],Dl=[".mdb",".docx",".xlsx",".pptx",".ppt",".xls",".doc",".pdf"],Fl=["application/xml","application/x-sh","application/json","application/javascript","application/java-vm","application/java-archive","text/html","text/plain"],Pl=[".xml",".sh",".json",".js",".class",".jar",".html",".txt",".wdb",".wps"],Nl=["application/x-rar-compressed","application/x-msdownload","application/x-font-woff"," application/x-font-ttf","application/x-7z-compressed"," application/vnd.android.package-archive","application/zip"],Ol=[".rar",".exe",".woff",".ttf",".7z",".apk",".zip"],va=[...Bl,...Vl,...El,...Tl,...Fl,...Nl],Ga=[...rt,...Al,...Sl,...Dl,...Pl,...Ol],Ge=[{type:"pdf",suffixes:[".pdf"]},{type:"txt",suffixes:[".txt"]},{type:"excel",suffixes:[".xls",".xlsx"]},{type:"word",suffixes:[".doc",".docx"]},{type:"ppt",suffixes:[".ppt",".pptx"]},{type:"zip",suffixes:[".zip",".rar",".7z"]}],Il=Object.freeze(Object.defineProperty({__proto__:null,audioSuffixes:Sl,audioTypes:El,fileSuffixes:Ga,fileTypes:va,imageSuffixes:rt,imageTypes:Bl,officeSuffixes:Dl,officeTypes:Tl,otherSuffixes:Ol,otherTypes:Nl,suffixTypes:Ge,textSuffixes:Pl,textTypes:Fl,videoSuffixes:Al,videoTypes:Vl},Symbol.toStringTag,{value:"Module"})),Ml={pdf:{cls:"pdf",label:"PDF"},word:{cls:"word",label:"WORD"},excel:{cls:"excel",label:"EXCEL"},ppt:{cls:"ppt",label:"PPT"},txt:{cls:"txt",label:"TXT"},zip:{cls:"zip",label:"ZIP"},img:{cls:"img",label:"IMG"}};function Rt(t){const o=(t||"").toString().toLocaleLowerCase();return o&&!o.startsWith(".")?"."+o:o}function Tt(t){var n,i;let o=Rt((t==null?void 0:t.suffix)||((n=t==null?void 0:t.raw)==null?void 0:n.suffix)||"");if(!o){const d=((t==null?void 0:t.name)||((i=t==null?void 0:t.raw)==null?void 0:i.name)||"").toLowerCase(),r=d.lastIndexOf(".");o=r>=0?d.substring(r):""}if(rt.indexOf(o)>=0)return"img";const l=Ge.find(d=>d.suffixes.indexOf(o)>=0);return l?l.type:"file"}function Ya(t){const o=Ml[Tt(t)];return o?o.cls:"file"}function Wa(t){const o=Ml[Tt(t)];return o?o.label:"FILE"}function Ja(t){return Tt(t)==="img"}function st(t){const o=(t==null?void 0:t.raw)||{};return t.signUrl||o.signUrl||t.shareUrl||o.shareUrl||t.url||o.url||t.furl||o.furl||t.previewUrl||o.previewUrl||""}function jl(t){return Tt(t)==="img"?!0:st(t).toLowerCase().startsWith("data:image/")}function Xa(t){return st(t)}function Kt(t){const o=Xa(t);if(!o){he.ElMessage.warning("暂无下载地址");return}fetch(o).then(l=>{if(!l.ok)throw new Error(String(l.status));return l.blob()}).then(l=>{var i;const n=document.createElement("a");n.href=URL.createObjectURL(l),n.download=(t==null?void 0:t.name)||((i=t==null?void 0:t.raw)==null?void 0:i.name)||"文件",n.click(),setTimeout(()=>URL.revokeObjectURL(n.href),1e3)}).catch(()=>{window.open(o,"_blank","noopener,noreferrer")||he.ElMessage.warning("浏览器拦截了弹窗,且无法直接下载,请检查网络或稍后重试")})}function Ll(t){return t?t<1024?t+" B":t<1024*1024?(t/1024).toFixed(1)+" KB":(t/1024/1024).toFixed(1)+" MB":""}const Za={class:"ele-form-file"},er=["aria-label","onClick","onKeydown"],tr=["src"],lr={class:"file-info"},or={class:"file-name"},nr={key:0,class:"file-meta"},ar=["onClick","onKeydown"],rr={key:1,class:"no-img-tip"},sr={name:"ElPlusFormFile",inheritAttrs:!1,typeName:"file",customOptions:{}},ir=e.defineComponent({...sr,props:{modelValue:{},field:{},loading:{type:Boolean},desc:{},formData:{}},setup(t){const o=t,l=e.computed(()=>Array.isArray(o.modelValue)?o.modelValue:[]),n=e.ref(!1),i=e.ref(0),d=e.computed(()=>l.value.filter(a=>jl(a)).map(a=>st(a)).filter(Boolean));function r(a){var g;if(jl(a))i.value=Math.max(0,d.value.indexOf(st(a))),n.value=!0;else{const c=((g=a.raw)==null?void 0:g.previewUrl)||a.previewUrl;c?window.open(c,"_blank","noopener,noreferrer"):he.ElMessage.warning("暂无预览地址")}}return(a,g)=>{const c=e.resolveComponent("el-icon"),s=e.resolveComponent("el-tooltip"),p=e.resolveComponent("el-image-viewer");return e.openBlock(),e.createElementBlock("div",Za,[l.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(l.value,(u,m)=>(e.openBlock(),e.createElementBlock("div",{key:u.uid??m,class:"ele-form-file-card",role:"button",tabindex:"0","aria-label":u.name?"预览:"+u.name:"预览文件",style:e.normalizeStyle({maxWidth:t.desc.cardMaxWidth||"200px",minWidth:t.desc.cardMinWidth||t.desc.cardMaxWidth||"200px"}),onClick:C=>r(u),onKeydown:[e.withKeys(C=>r(u),["enter"]),e.withKeys(e.withModifiers(C=>r(u),["prevent"]),["space"])]},[e.unref(Ja)(u)&&e.unref(st)(u)?(e.openBlock(),e.createElementBlock("img",{key:0,class:"file-thumb",src:e.unref(st)(u)},null,8,tr)):(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["file-type-icon",e.unref(Ya)(u)])},e.toDisplayString(e.unref(Wa)(u)),3)),e.createElementVNode("div",lr,[e.createElementVNode("span",or,e.toDisplayString(u.name),1),e.unref(Ll)(u.fsize)?(e.openBlock(),e.createElementBlock("span",nr,e.toDisplayString(e.unref(Ll)(u.fsize)),1)):e.createCommentVNode("",!0)]),e.createVNode(s,{content:"下载",placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("span",{class:"file-download-btn",role:"button",tabindex:"0","aria-label":"下载文件",onClick:e.withModifiers(C=>e.unref(Kt)(u),["stop"]),onKeydown:[e.withKeys(e.withModifiers(C=>e.unref(Kt)(u),["stop","prevent"]),["enter"]),e.withKeys(e.withModifiers(C=>e.unref(Kt)(u),["stop","prevent"]),["space"])]},[e.createVNode(c,null,{default:e.withCtx(()=>[e.createVNode(e.unref(Un))]),_:1})],40,ar)]),_:2},1024)],44,er))),128)):(e.openBlock(),e.createElementBlock("span",rr,"暂无内容")),n.value?(e.openBlock(),e.createBlock(p,{key:2,onClose:g[0]||(g[0]=u=>n.value=!1),teleported:"",initialIndex:i.value,"url-list":d.value},null,8,["initialIndex","url-list"])):e.createCommentVNode("",!0)])}}}),ym="",zl=ce(ir,[["__scopeId","data-v-cedde1be"]]),cr=Object.freeze(Object.defineProperty({__proto__:null,default:zl},Symbol.toStringTag,{value:"Module"})),dr={class:"el-plus-form-formula"},fr={class:"formula-text-panel"},ur={class:"show-panel"},pr={class:"title-tip"},mr=["contenteditable"],gr={key:0,class:"options"},hr=["onClick"],yr={key:1,class:"empty"},br={name:"ElPlusFormFormula",inheritAttrs:!1,typeName:"formula",customOptions:{}},$l=e.defineComponent({...br,props:{modelValue:{},field:{},desc:{},formData:{},disabled:{type:Boolean}},emits:["update:modelValue","validateThis"],setup(t,{emit:o}){const l=e.inject("globalData"),n=t,i=o,d=e.reactive([]),r=e.ref({}),a=e.ref(!1),g=e.ref(!1),c=e.ref(!1),s=e.ref(""),p=e.ref(),u=e.ref(),m=e.ref("="),C=e.ref(""),T=e.computed(()=>s.value?d.filter(({label:x})=>x.includes(s.value)):d);function N(){g.value=!0,e.nextTick(()=>{var x,j,H;m.value=((x=n.modelValue)==null?void 0:x.value)||"=",p.value&&(p.value.innerHTML=((j=n.modelValue)==null?void 0:j.domStr)||"=",C.value=(H=p.value)==null?void 0:H.innerHTML)})}function w(x){c.value=!1;const j=`<div contenteditable="true">${x.label}<span>${x.value}</span></div>`;I("@",j),_()}function I(x,j=""){var Q;let H=((Q=p.value)==null?void 0:Q.innerHTML)||"";H&&H.includes(x)&&(H=H.replace(new RegExp(x,"g"),j),p.value.innerHTML=H+"&nbsp;")}function M(x){const{key:j}=x;switch(j){case"Enter":x.preventDefault();break;case"@":k();break}}function L(x){var se,v;const j=C.value.split(/<div\b[^>]*>(.*?)<\/div>/g)||[];let H=((v=(se=p.value)==null?void 0:se.innerHTML)==null?void 0:v.split(/<div\b[^>]*>(.*?)<\/div>/g))||[],Q=-1;if(j.length===H.length){for(let G=0;G<j.length;G++)if(j[G]!==H[G]){Q=G;break}}Q>=0&&j[Q].indexOf("</span>")>0&&(x.key==="Backspace"?H.splice(Q,1):H[Q]=j[Q],H=H.map(G=>G.indexOf("</span>")>0?`<div contenteditable="true">${G}</div>`:G),p.value.innerHTML=H.join(""),x.key==="Backspace"&&V(p.value,Q-1)),_()}function V(x,j){const H=document.createRange(),Q=window.getSelection();H.selectNodeContents(x),H.collapse(!1),x.childNodes[j]&&H.setStart(x.childNodes[j],0),H.collapse(!0),Q==null||Q.removeAllRanges(),Q==null||Q.addRange(H)}function F(){window.addEventListener("click",E)}function A(){window.removeEventListener("click",E)}function O(){var x;i("update:modelValue",{value:m.value,domStr:((x=p.value)==null?void 0:x.innerHTML)||""}),g.value=!1,e.nextTick(()=>{i("validateThis")})}function _(){var Q;C.value=p.value.innerHTML;let x=p.value.innerHTML;const j=((Q=x.match(/<span[^>]*>([\s\S]*?)<\/span>/g))==null?void 0:Q.map(se=>(se.match(/<span[^>]*>([\s\S]*?)<\/span>/)||[])[1]))||[];(x.match(/<div[^>]*>([\s\S]*?)<\/div>/g)||[]).map((se,v)=>{x=x.replace(se,"${"+j[v]+"}")}),m.value=x.replaceAll("&nbsp;","").replaceAll("&lt;","<").replaceAll("&gt;",">")}function E(x){c.value=!1,x&&I("@")}function k(){s.value="",c.value=!0,setTimeout(()=>{F(),u.value.focus()},0)}return e.onBeforeMount(async()=>{A(),r.value=await le(n,{clearable:!0,...e.useAttrs()}),a.value=!0}),e.watch(()=>n.desc.options,async x=>{if(typeof x=="string")d.splice(0,d.length,...l[x]||[]);else if(typeof x=="function"){const j=x(n.formData||{});Oe(j)?d.splice(0,d.length,...await j):d.splice(0,d.length,...j)}else Array.isArray(x)?x&&d&&!Ne(x,d)&&d.splice(0,d.length,...x):d.splice(0,d.length)},{immediate:!0}),e.watch(()=>n.modelValue,x=>{m.value=(x==null?void 0:x.value)||"=",p.value&&(p.value.innerHTML=(x==null?void 0:x.domStr)||"=")},{immediate:!0}),e.onUnmounted(()=>{A()}),(x,j)=>{const H=e.resolveComponent("el-button"),Q=e.resolveComponent("el-input"),se=e.resolveComponent("el-dialog");return e.openBlock(),e.createElementBlock("div",dr,[e.createElementVNode("div",fr,[e.createVNode(H,{class:"formula-btn",onClick:N,type:"warning",plain:"",text:""},{default:e.withCtx(()=>{var v;return[e.createTextVNode(e.toDisplayString(((v=t.modelValue)==null?void 0:v.value)||"点击进行编辑"),1)]}),_:1})]),e.createVNode(se,{class:"el-plus-form-formula-dialog",width:t.desc.dialogWidth||"800px",title:t.desc.title||t.desc.placeholder||"请编辑"+t.desc._label,draggable:"",closeOnClickModal:!1,showCancel:"",modelValue:g.value,"onUpdate:modelValue":j[3]||(j[3]=v=>g.value=v),"append-to-body":"","destroy-on-close":""},{footer:e.withCtx(()=>[e.createElementVNode("div",null,[e.createVNode(H,{type:"primary",onClick:O},{default:e.withCtx(()=>[...j[4]||(j[4]=[e.createTextVNode("确定",-1)])]),_:1}),e.createVNode(H,{onClick:j[2]||(j[2]=v=>g.value=!1)},{default:e.withCtx(()=>[...j[5]||(j[5]=[e.createTextVNode("取消",-1)])]),_:1})])]),default:e.withCtx(()=>{var v;return[e.createElementVNode("div",ur,[e.createElementVNode("h2",null,e.toDisplayString(m.value),1)]),e.createElementVNode("div",pr,e.toDisplayString(t.desc.tip||"请在下面输入框中输入您的公式,输入@符号,可以调出引用项"),1),e.createElementVNode("div",e.mergeProps({ref_key:"formulaRef",ref:p,class:"formula-input",contenteditable:t.disabled?"false":"plaintext-only"},r.value,{style:{"ime-mode":"disabled"},onKeydown:e.withModifiers(M,["stop"]),onKeyup:e.withModifiers(L,["stop"])}),null,16,mr),c.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"formula-input-selection",ref:"selection",onClick:j[1]||(j[1]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(Q,{modelValue:s.value,"onUpdate:modelValue":j[0]||(j[0]=G=>s.value=G),ref_key:"inputRef",ref:u,placeholder:"输入关键字筛选"},null,8,["modelValue"]),(v=T.value)!=null&&v.length?(e.openBlock(),e.createElementBlock("div",gr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,(G,oe)=>(e.openBlock(),e.createElementBlock("span",{class:"option",key:oe,onClick:J=>w(G)},e.toDisplayString(G.label),9,hr))),128))])):(e.openBlock(),e.createElementBlock("div",yr,"暂无数据"))],512)):e.createCommentVNode("",!0)]}),_:1},8,["width","title","modelValue"])])}}}),bm="",_m="",_r=Object.freeze(Object.defineProperty({__proto__:null,default:$l