vue3-element-dict 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ (function(G,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(G=typeof globalThis<"u"?globalThis:G||self,t(G["vue3-element-dict"]={},G.Vue))})(this,function(G,t){"use strict";const X=(e,i,m)=>{const n={};for(let s in e)n[s]=m(i(e[s]));return n},N=t.reactive({dictConfig:{getDictCodeApi:new Promise((e,i)=>{e({})}),filterDataFun:e=>e,disabledDataFun:e=>e,treeSetting:{idField:"id",parentIdField:"parentId",childrenField:"children",firstId:"0",labelField:"label",labelArrField:"labelArr",idArrField:"idArr",levelField:"level",level:1,leafField:"leaf"},query:"type",versionKey:"currentVersion",dictDataKey:"dictCodeList",format:{value:"value",label:"label",disabled:"disabled",type:"type",color:"color"},formatterRequest:(e,i)=>i?{[e]:i}:{[e]:""},formatterDictList:(e,i)=>e.dictCodeList,formatterDictVersion:e=>e.version,storage:localStorage,usuallyGetDictTypes:"",isGetAll:!1,localDictCodes:{},getDictEveryTime:!1},dictCodes:{},isGettingDictTypes:[],isGettingAllDictTypes:!1,unfindDictTypes:[]}),V={SET_DICT_SETTING(e){N.dictConfig=e},SET_DICT_CODES(e){N.dictCodes=e},ADD_IS_EGTTING_DICT_TYPES(e){const m=[...e.split(","),...N.isGettingDictTypes],n=new Set(m);N.isGettingDictTypes=Array.from(n)},REMOVE_IS_EGTTING_DICT_TYPES(e){const i=e.split(","),m=[...new Set(N.isGettingDictTypes)].filter(n=>!new Set(i).has(n));N.isGettingDictTypes=Array.from(m)},SETTING_ISGETTING_ALL_DICT_TYPES(e){N.isGettingAllDictTypes=e},ADD_UNFIND_DICT_TYPES(e){const m=[...e.split(","),...N.unfindDictTypes],n=new Set(m);N.unfindDictTypes=Array.from(n)},REMOVE_UNFIND_DICT_TYPES(e){const i=e.split(","),m=[...new Set(N.unfindDictTypes)].filter(n=>!new Set(i).has(n));N.unfindDictTypes=Array.from(m)}},o={state:N,mutations:V,actions:{getDictDataObj(e){return new Promise((i,m)=>{if(!e)return;const{storage:n,dictDataKey:s,getDictCodeApi:l,usuallyGetDictTypes:d,formatterRequest:r,query:f,versionKey:a,localDictCodes:c,formatterDictList:p,formatterDictVersion:T,isGetAll:I,filterDataFun:k,disabledDataFun:O}=N.dictConfig,F=N.dictCodes||c;if(!F[e]||F[e].length===0){if(N.isGettingDictTypes.includes(e)||N.isGettingAllDictTypes)return;if(V.ADD_IS_EGTTING_DICT_TYPES(e),N.unfindDictTypes.includes(e)){m(`不存在类型为:${e} 的字典字段,请确认后再填写`);return}V.ADD_UNFIND_DICT_TYPES(e),l(r(f,e)).then(E=>{V.REMOVE_IS_EGTTING_DICT_TYPES(e);const h=T(E),S=n.getItem(a);if(h!==S){let b="";if(I)b="",V.SETTING_ISGETTING_ALL_DICT_TYPES(!0);else{if(d){const g=Object.keys(F),u=d.split(","),C=g.concat(u);C.push(e),b=Array.from(new Set(C)).join(",")}else{const g=Object.keys(F);g.push(e),b=Array.from(new Set(g)).join(",")}V.ADD_IS_EGTTING_DICT_TYPES(b)}l(r(f,b)).then(g=>{const u=p(g,e);if(!(u[e]&&u[e].length>0)){m(`不存在类型为:${e} 的字典字段,请确认后再填写`);return}V.REMOVE_UNFIND_DICT_TYPES(e);const C=T(g),y=Object.assign(JSON.parse(JSON.stringify(c)),u),D=X(y,k,O);n.setItem(s,JSON.stringify(D)),n.setItem(a,C),V.SET_DICT_CODES(D),i(N.dictCodes),N.isGettingAllDictTypes?V.SETTING_ISGETTING_ALL_DICT_TYPES(!1):V.REMOVE_IS_EGTTING_DICT_TYPES(b)})}else{const b=p(E,e);if(!(b[e]&&b[e].length>0)){m(`不存在类型为:${e} 的字典字段,请确认后再填写`);return}V.REMOVE_UNFIND_DICT_TYPES(e);const g=N.dictCodes||c,u=X(b,k,O);Object.assign(g,u),n.setItem(s,JSON.stringify(g)),V.SET_DICT_CODES(g),i(N.dictCodes)}})}else V.REMOVE_UNFIND_DICT_TYPES(e),V.SET_DICT_CODES(F),i(N.dictCodes)})}}},It=(e,i,m)=>new Promise((n,s)=>{const{format:l}=o.state.dictConfig,d=o.state.dictCodes;let r=[];if(!d||!d[i])if(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes){const f=setInterval(()=>{if(!(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes)){if(clearInterval(f),r=o.state.dictCodes[i],!r){s(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const a=r.find(c=>c[l.value]===e);n(a?a[l.label]:m??"")}},1e3)}else o.actions.getDictDataObj(i).then(f=>{if(r=f[i],!r){s(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const a=r.find(c=>c[l.value]===e);n(a?a[l.label]:m??"")});else{r=d[i];const f=r.find(a=>a[l.value]===e);n(f?f[l.label]:m??"")}});function Y(e,i,m,n){const s=[];for(let l=0;l<e.length;l++){const d=i.find(r=>r[m.value]===e[l]);d?s.push(d):s.push({[m.label]:n,[m.value]:e[l]})}return s}const kt=(e,i,m)=>{const n={defaultVal:"",formatFun:(s,l)=>s.map(d=>d[l.label]).join(","),spacer:","};return Object.assign(n,m),new Promise((s,l)=>{let d=[];Array.isArray(e)?d=e:typeof e=="string"&&(d=e.split(n.spacer));const{format:r}=o.state.dictConfig,f=o.state.dictCodes;let a=[];if(!f||!f[i])if(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes){const c=setInterval(()=>{if(!(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes)){if(clearInterval(c),a=o.state.dictCodes[i],!a){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const p=Y(d,a,r,n.defaultVal);s(p&&p.length>0?n.formatFun(p,r):n.defaultVal)}},1e3)}else o.actions.getDictDataObj(i).then(c=>{if(a=c[i],!a){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const p=Y(d,a,r,n.defaultVal);s(p&&p.length>0?n.formatFun(p,r):n.defaultVal)});else{a=f[i];const c=Y(d,a,r,n.defaultVal);s(c&&c.length>0?n.formatFun(c,r):n.defaultVal)}})},jt=(e,i,m)=>new Promise((n,s)=>{const{format:l}=o.state.dictConfig,d=o.state.dictCodes;let r=[];if(!d||!d[i])if(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes){const f=setInterval(()=>{if(!(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes)){if(clearInterval(f),r=o.state.dictCodes[i],!r){s(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const a=r.find(c=>c[l.label]===e);n(a?a[l.value]:m??"")}},1e3)}else o.actions.getDictDataObj(i).then(f=>{if(r=f[i],!r){s(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const a=r.find(c=>c[l.label]===e);n(a?a[l.value]:m??"")});else{r=d[i];const f=r.find(a=>a[l.label]===e);n(f?f[l.value]:m??"")}});function K(e,i,m,n){const s=[];for(let l=0;l<e.length;l++){const d=i.find(r=>r[m.label]===e[l]);d?s.push(d):s.push({[m.label]:e[l],[m.value]:n})}return s}const At=(e,i,m)=>{const n={defaultVal:"",formatFun:(s,l)=>s.map(d=>d[l.value]).join(","),spacer:","};return Object.assign(n,m),new Promise((s,l)=>{let d=[];Array.isArray(e)?d=e:typeof e=="string"&&(d=e.split(n.spacer));const{format:r}=o.state.dictConfig,f=o.state.dictCodes;let a=[];if(!f||!f[i])if(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes){const c=setInterval(()=>{if(!(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes)){if(clearInterval(c),a=o.state.dictCodes[i],!a){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const p=K(d,a,r,n.defaultVal);s(p&&p.length>0?n.formatFun(p,r):n.defaultVal)}},1e3)}else o.actions.getDictDataObj(i).then(c=>{if(a=c[i],!a){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const p=K(d,a,r,n.defaultVal);s(p&&p.length>0?n.formatFun(p,r):n.defaultVal)});else{a=f[i];const c=K(d,a,r,n.defaultVal);s(c&&c.length>0?n.formatFun(c,r):n.defaultVal)}})},Gt=e=>new Promise((i,m)=>{let n=[],s="";Array.isArray(e)?(s=e.join(","),n=e):typeof e=="string"&&(n=e.split(","));const l=o.state.dictCodes,d=o.state.dictConfig;if(!l)o.mutations.ADD_IS_EGTTING_DICT_TYPES(s),d.getDictCodeApi(d.formatterRequest(d.query,s)).then(r=>{o.mutations.REMOVE_IS_EGTTING_DICT_TYPES(s);const f=d.formatterDictList(r,e),a=X(f,d.filterDataFun,d.disabledDataFun),c=JSON.parse(JSON.stringify(a)),p=Object.assign(o.state.dictCodes,c);d.storage.setItem(d.dictDataKey,JSON.stringify(p)),o.mutations.SET_DICT_CODES(p),i(a)});else{const r=[],f={};for(let a=0;a<n.length;a++){if(l[n[a]]){f[n[a]]=l[n[a]];continue}r.push(n[a])}r.length>0?(o.mutations.ADD_IS_EGTTING_DICT_TYPES(r.join(",")),d.getDictCodeApi(d.formatterRequest(d.query,r.join(","))).then(a=>{o.mutations.REMOVE_IS_EGTTING_DICT_TYPES(r.join(","));const c=d.formatterDictList(a,e),p=X(c,d.filterDataFun,d.disabledDataFun),T=JSON.parse(JSON.stringify(p)),I=Object.assign(o.state.dictCodes,T);d.storage.setItem(d.dictDataKey,JSON.stringify(I)),o.mutations.SET_DICT_CODES(I);const k=Object.assign(f,c),O=[];for(const F in k)(!k[F]||k[F].length===0)&&O.push(F);O.length>0&&m(`不存在类型为:${O.join("、")} 的字典字段,请确认后再填写`),i(p)})):i(f)}}),U=(e,i,m)=>new Promise((n,s)=>{const{format:l}=o.state.dictConfig,d=o.state.dictCodes;let r=[];if(!d||!d[i])if(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes){const f=setInterval(()=>{if(!(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes)){if(clearInterval(f),r=o.state.dictCodes[i],!r){s(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const a=r.find(c=>c[l.value]===e);n(a||(m??""))}},1e3)}else o.actions.getDictDataObj(i).then(f=>{if(r=f[i],!r){s(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const a=r.find(c=>c[l.value]===e);n(a||(m??""))});else{r=d[i];const f=r.find(a=>a[l.value]===e);n(f||(m??""))}}),Et={name:"ElButtonDict"},Z=t.defineComponent({...Et,props:{value:{type:[String,Number],required:!0},dictType:{type:[String],required:!0},judgeTypeFun:{type:Function},type:{type:String,default:""},judgeColorFun:{type:Function},color:{type:String,default:""},judgeDisabledFun:{type:Function},disabled:{type:Boolean}},setup(e,{expose:i}){const m=e,{value:n,dictType:s,judgeTypeFun:l,type:d,judgeColorFun:r,color:f,judgeDisabledFun:a,disabled:c}=t.toRefs(m),p=t.toRaw(o.state.dictConfig),T=t.computed(()=>l!=null&&l.value?l.value(n.value):d.value?d.value:O.value&&O.value[p.format.type]?O.value[p.format.type]:"primary"),I=t.computed(()=>r!=null&&r.value?r.value(n.value):f!=null&&f.value?f.value:O.value&&O.value[p.format.color]?O.value[p.format.color]:""),k=t.computed(()=>O.value&&O.value[p.format.disabled]?O.value[p.format.disabled]:a!=null&&a.value?a.value(n.value):!!c.value);let O=t.ref(null),F=t.ref(null);t.watchEffect(()=>{U(n.value,s.value).then(S=>{O.value=S,F.value=S[p.format.label]})});const E=t.ref(null);return i({getRef:()=>E.value}),(S,b)=>{const g=t.resolveComponent("el-button");return t.openBlock(),t.createBlock(g,t.mergeProps({ref_key:"ElButtonDict",ref:E,type:t.unref(T),color:t.unref(I),disabled:t.unref(k)},S.$attrs),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(t.unref(F)),1)]),_:2},[t.renderList(S.$slots,(u,C,y)=>({name:C,fn:t.withCtx(D=>[t.renderSlot(S.$slots,C,t.normalizeProps(t.guardReactiveProps(D)))])}))]),1040,["type","color","disabled"])}}});Z.install=function(e){e.component(Z.name,Z)};const Bt=Object.freeze(Object.defineProperty({__proto__:null,default:Z},Symbol.toStringTag,{value:"Module"})),H=(e,i,m)=>{const n={idField:"id",parentIdField:"parentId",childrenField:"children",firstId:"0",labelField:"label",labelArrField:"labelArr",idArrField:"idArr",levelField:"level",level:0,leafField:"leaf"};i&&Object.assign(n,i),m||(m={[n.idField]:n.firstId,[n.levelField]:n.level,[n.labelArrField]:[],[n.idArrField]:[]});for(var s=[],l,d=0;d<e.length;d++)if(e[d][n.parentIdField]===m[n.idField]){var r=e[d];r[n.levelField]=m[n.levelField]+1,r[n.labelArrField]=m[n.labelArrField].concat(r[n.labelField]),r[n.idArrField]=m[n.idArrField].concat(r[n.idField]),l=H(e,i,r),l.length>0?(r[n.childrenField]=l,r[n.leafField]=!1):r[n.leafField]=!0,s.push(r)}return s},J=(e,i,m)=>{const n={idField:"id",parentIdField:"parentId"};Object.assign(n,m);const s=i.find(l=>l[n.idField]===e);return s?J(s[n.parentIdField],i,n).concat([s]):[]},z=(e,i,m)=>{const n={idField:"id",labelField:"label",parentIdField:"parentId"};Object.assign(n,m);const s=i.find(l=>l[n.labelField]===e);return J(s[n.idField],i,n)},Lt={name:"ElCascaderDict"},v=t.defineComponent({...Lt,props:{maxLevel:{type:[Number,String]},dictType:{type:[String,Object],required:!0},disableObj:{type:Object},filterDataFun:{type:Function},disabledDataFun:{type:Function}},emits:["dictChange"],setup(e,{expose:i,emit:m}){const{maxLevel:n,dictType:s,disableObj:l,filterDataFun:d,disabledDataFun:r}=e,f=t.useAttrs(),a=t.ref(""),c=t.toRaw(o.state.dictConfig),p=t.toRaw(o.state.dictCodes),T=u=>{m("dictChange",u)},I=t.reactive({list:[]}),k=(u,C)=>{for(let y=0;y<u.length;y++){const D=u[y];if(D[c.treeSetting.levelField]===C){delete D[h.value.children],D[h.value.leaf]=!0;continue}else k(D[h.value.children],C)}},O=async()=>{if(!s)return;let u=[];if(typeof s=="object"){a.value=s.type,await o.actions.getDictDataObj(a.value),u=[].concat(p[a.value]);const{filters:C,filterType:y=c.format.value,reverse:D=!1}=s,_=typeof C=="string"?C.split(","):C;D?u=u.filter(j=>!_.includes(j[y])):u=u.filter(j=>_.includes(j[y]))}else a.value=s,await o.actions.getDictDataObj(a.value),u=[].concat(p[a.value]);if(d&&(u=d(u)),r&&(u=u.map(C=>({...C,[c.format.disabled]:C[c.format.disabled]||r(C)}))),l){const{disableValue:C,disableType:y=c.format.value,reverse:D=!1}=l,_=typeof C=="string"?C.split(","):C;D?u=u.map(j=>{const B=JSON.parse(JSON.stringify(j));return B[c.format.disabled]=!_.includes(B[y])||B[c.format.disabled],B}):u=u.map(j=>{const B=JSON.parse(JSON.stringify(j));return B[c.format.disabled]=_.includes(B[y])||B[c.format.disabled],B})}I.list=u},F=t.computed(()=>o.state.isGettingDictTypes.includes(a.value)),E=t.computed(()=>o.state.isGettingAllDictTypes),h=t.computed(()=>{const u=f.props??{};return u.disabled=u.disabled??c.format.disabled,u.value=u.value??c.treeSetting.idField,u.label=u.label??c.treeSetting.labelField,u.children=u.children??c.treeSetting.childrenField,u.leaf=u.leaf??c.treeSetting.leafField,u}),S=t.computed(()=>{const u=f.props??{},C={idField:u.value??c.treeSetting.idField,labelField:u.label??c.treeSetting.labelField,childrenField:u.children??c.treeSetting.childrenField,leafField:u.leaf??c.treeSetting.leafField},y=Object.assign(c.treeSetting,C),D=JSON.parse(JSON.stringify(I.list)),_=H(D,y);return n&&k(_,+n),_});t.watch([F,E],([u],[C])=>{(!u||!C)&&O()},{immediate:!0});const b=t.ref(null);return i({getRef:()=>b.value}),(u,C)=>{const y=t.resolveComponent("el-cascader");return t.openBlock(),t.createBlock(y,{ref_key:"ElCascaderDict",ref:b,options:t.unref(S),props:t.unref(h),onChange:T},t.createSlots({_:2},[t.renderList(u.$slots,(D,_,j)=>({name:_,fn:t.withCtx(B=>[t.renderSlot(u.$slots,_,t.normalizeProps(t.guardReactiveProps(B)))])}))]),1032,["options","props"])}}});v.install=function(e){e.component(v.name,v)};const Nt=Object.freeze(Object.defineProperty({__proto__:null,default:v},Symbol.toStringTag,{value:"Module"})),wt={name:"ElCheckboxButtonDict"},tt=t.defineComponent({...wt,props:{dictType:{type:[String,Object],required:!0},disableObj:{type:Object},name:{type:String,default:""},checked:{type:Boolean,default:!1},trueValue:{type:[String,Number],default:""},falseValue:{type:[String,Number],default:""},trueLabel:{type:[String,Number],default:""},falseLabel:{type:[String,Number],default:""},keyValue:{type:Boolean,default:!1},filterDataFun:{type:Function},disabledDataFun:{type:Function}},emits:["dictChange"],setup(e,{expose:i,emit:m}){const{dictType:n,disableObj:s,name:l,checked:d,trueValue:r,falseValue:f,trueLabel:a,falseLabel:c,keyValue:p,filterDataFun:T,disabledDataFun:I}=e,k=t.ref(""),O=t.toRaw(o.state.dictConfig),F=t.toRaw(o.state.dictCodes),E=y=>{if(!p){m("dictChange",y);return}const D=h.list.filter(_=>y.includes(_[O.format.value]));m("dictChange",D)},h=t.reactive({list:[]}),S=async()=>{if(!n)return;let y=[];if(typeof n=="object"){k.value=n.type,await o.actions.getDictDataObj(k.value),y=[].concat(F[k.value]);const{filters:D,filterType:_=O.format.value,reverse:j=!1}=n,B=typeof D=="string"?D.split(","):D;j?y=y.filter(L=>!B.includes(L[_])):y=y.filter(L=>B.includes(L[_]))}else k.value=n,await o.actions.getDictDataObj(k.value),y=[].concat(F[k.value]);if(T&&(y=T(y)),I&&(y=y.map(D=>({...D,[O.format.disabled]:D[O.format.disabled]||I(D)}))),s){const{disableValue:D,disableType:_=O.format.value,reverse:j=!1}=s,B=typeof D=="string"?D.split(","):D;j?y=y.map(L=>{const A=JSON.parse(JSON.stringify(L));return A[O.format.disabled]=!B.includes(A[_])||A[O.format.disabled],A}):y=y.map(L=>{const A=JSON.parse(JSON.stringify(L));return A[O.format.disabled]=B.includes(A[_])||A[O.format.disabled],A})}h.list=y},b=t.computed(()=>o.state.isGettingDictTypes.includes(k.value)),g=t.computed(()=>o.state.isGettingAllDictTypes);t.watch([b,g],([y],[D])=>{(!y||!D)&&S()},{immediate:!0});const u=t.ref(null);return i({getRef:()=>u.value}),(y,D)=>{const _=t.resolveComponent("el-checkbox-button"),j=t.resolveComponent("el-checkbox-group");return t.openBlock(),t.createBlock(j,t.mergeProps({ref_key:"ElCheckboxButtonDict",ref:u},y.$attrs,{onChange:E}),t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(h.list,B=>(t.openBlock(),t.createBlock(_,{key:B[t.unref(O).format.value],disabled:B[t.unref(O).format.disabled],label:B[t.unref(O).format.value],name:e.name,"true-value":e.trueValue,"false-value":e.falseValue,"true-label":e.trueLabel,"false-label":e.falseLabel,checked:e.checked},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(B[t.unref(O).format.label]),1)]),_:2},1032,["disabled","label","name","true-value","false-value","true-label","false-label","checked"]))),128))]),_:2},[t.renderList(y.$slots,(B,L,A)=>({name:L,fn:t.withCtx(w=>[t.renderSlot(y.$slots,L,t.normalizeProps(t.guardReactiveProps(w)))])}))]),1040)}}});tt.install=function(e){e.component(tt.name,tt)};const Vt=Object.freeze(Object.defineProperty({__proto__:null,default:tt},Symbol.toStringTag,{value:"Module"})),$t={name:"ElCheckboxDict"},et=t.defineComponent({...$t,props:{dictType:{type:[String,Object],required:!0},disableObj:{type:Object},border:{type:Boolean,default:!1},size:{type:String,default:""},name:{type:String,default:""},checked:{type:Boolean,default:!1},indeterminate:{type:Boolean,default:!1},trueValue:{type:[String,Number],default:""},falseValue:{type:[String,Number],default:""},trueLabel:{type:[String,Number],default:""},falseLabel:{type:[String,Number],default:""},keyValue:{type:Boolean,default:!1},filterDataFun:{type:Function},disabledDataFun:{type:Function},validateEvent:{type:Boolean},tabindex:{type:[String,Number]},id:{type:String}},emits:["dictChange"],setup(e,{expose:i,emit:m}){const{dictType:n,disableObj:s,border:l,size:d,name:r,checked:f,indeterminate:a,trueValue:c,falseValue:p,trueLabel:T,falseLabel:I,keyValue:k,filterDataFun:O,disabledDataFun:F,validateEvent:E,tabindex:h,id:S}=e,b=t.ref(""),g=t.toRaw(o.state.dictConfig),u=t.toRaw(o.state.dictCodes),C=A=>{if(!k){m("dictChange",A);return}const w=y.list.find($=>A.includes($[g.format.value]));m("dictChange",w)},y=t.reactive({list:[]}),D=async()=>{if(!n)return;let A=[];if(typeof n=="object"){b.value=n.type,await o.actions.getDictDataObj(b.value),A=[].concat(u[b.value]);const{filters:w,filterType:$=g.format.value,reverse:M=!1}=n,R=typeof w=="string"?w.split(","):w;M?A=A.filter(P=>!R.includes(P[$])):A=A.filter(P=>R.includes(P[$]))}else b.value=n,await o.actions.getDictDataObj(b.value),A=[].concat(u[b.value]);if(O&&(A=O(A)),F&&(A=A.map(w=>({...w,[g.format.disabled]:w[g.format.disabled]||F(w)}))),s){const{disableValue:w,disableType:$=g.format.value,reverse:M=!1}=s,R=typeof w=="string"?w.split(","):w;M?A=A.map(P=>{const x=JSON.parse(JSON.stringify(P));return x[g.format.disabled]=!R.includes(x[$])||x[g.format.disabled],x}):A=A.map(P=>{const x=JSON.parse(JSON.stringify(P));return x[g.format.disabled]=R.includes(x[$])||x[g.format.disabled],x})}y.list=A},_=t.computed(()=>o.state.isGettingDictTypes.includes(b.value)),j=t.computed(()=>o.state.isGettingAllDictTypes);t.watch([_,j],([A],[w])=>{(!A||!w)&&D()},{immediate:!0});const B=t.ref(null);return i({getRef:()=>B.value}),(A,w)=>{const $=t.resolveComponent("el-checkbox"),M=t.resolveComponent("el-checkbox-group");return t.openBlock(),t.createBlock(M,t.mergeProps({ref_key:"ElCheckboxDict",ref:B},A.$attrs,{onChange:C}),t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(y.list,R=>(t.openBlock(),t.createBlock($,{key:R[t.unref(g).format.value],label:R[t.unref(g).format.value],"true-value":e.trueValue,"false-value":e.falseValue,"true-label":e.trueLabel,"false-label":e.falseLabel,disabled:R[t.unref(g).format.disabled],border:e.border,size:e.size,name:e.name,checked:e.checked,indeterminate:e.indeterminate,"validate-event":e.validateEvent,tabindex:e.tabindex,id:e.id},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(R[t.unref(g).format.label]),1)]),_:2},1032,["label","true-value","false-value","true-label","false-label","disabled","border","size","name","checked","indeterminate","validate-event","tabindex","id"]))),128))]),_:2},[t.renderList(A.$slots,(R,P,x)=>({name:P,fn:t.withCtx(ut=>[t.renderSlot(A.$slots,P,t.normalizeProps(t.guardReactiveProps(ut)))])}))]),1040)}}});et.install=function(e){e.component(et.name,et)};const Rt=Object.freeze(Object.defineProperty({__proto__:null,default:et},Symbol.toStringTag,{value:"Module"})),Pt={name:"ElLinkDict"},nt=t.defineComponent({...Pt,props:{value:{type:[String,Number],required:!0},dictType:{type:[String],required:!0},judgeTypeFun:{type:Function},type:{type:String,default:""},judgeDisabledFun:{type:Function},disabled:{type:Boolean}},setup(e,{expose:i}){const m=e,{value:n,dictType:s,judgeTypeFun:l,type:d,judgeDisabledFun:r,disabled:f}=t.toRefs(m),a=t.toRaw(o.state.dictConfig),c=t.computed(()=>l!=null&&l.value?l.value(n.value):d.value?d.value:T.value&&T.value[a.format.type]?T.value[a.format.type]:"primary"),p=t.computed(()=>T.value&&T.value[a.format.disabled]?T.value[a.format.disabled]:r!=null&&r.value?r.value(n.value):!!f.value);let T=t.ref(null),I=t.ref(null);t.watchEffect(()=>{U(n.value,s.value).then(F=>{T.value=F,I.value=F[a.format.label]})});const k=t.ref(null);return i({getRef:()=>k.value}),(F,E)=>{const h=t.resolveComponent("el-link");return t.openBlock(),t.createBlock(h,t.mergeProps({ref_key:"ElLinkDict",ref:k,type:t.unref(c),disabled:t.unref(p)},F.$attrs),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(t.unref(I)),1)]),_:2},[t.renderList(F.$slots,(S,b,g)=>({name:b,fn:t.withCtx(u=>[t.renderSlot(F.$slots,b,t.normalizeProps(t.guardReactiveProps(u)))])}))]),1040,["type","disabled"])}}});nt.install=function(e){e.component(nt.name,nt)};const xt=Object.freeze(Object.defineProperty({__proto__:null,default:nt},Symbol.toStringTag,{value:"Module"})),Jt={name:"ElRadioButtonDict"},it=t.defineComponent({...Jt,props:{dictType:{type:[String,Object],required:!0},disableObj:{type:Object},name:{type:String,default:""},keyValue:{type:Boolean,default:!1},filterDataFun:{type:Function},disabledDataFun:{type:Function}},emits:["dictChange"],setup(e,{expose:i,emit:m}){const{dictType:n,disableObj:s,name:l,keyValue:d,filterDataFun:r,disabledDataFun:f}=e,a=t.ref(""),c=t.toRaw(o.state.dictConfig),p=t.toRaw(o.state.dictCodes),T=S=>{if(!d){m("dictChange",S);return}const b=I.list.find(g=>g[c.format.value]===S);m("dictChange",b)},I=t.reactive({list:[]}),k=async()=>{if(!n)return;let S=[];if(typeof n=="object"){a.value=n.type,await o.actions.getDictDataObj(a.value),S=[].concat(p[a.value]);const{filters:b,filterType:g=c.format.value,reverse:u=!1}=n,C=typeof b=="string"?b.split(","):b;u?S=S.filter(y=>!C.includes(y[g])):S=S.filter(y=>C.includes(y[g]))}else a.value=n,await o.actions.getDictDataObj(a.value),S=[].concat(p[a.value]);if(r&&(S=r(S)),f&&(S=S.map(b=>({...b,[c.format.disabled]:b[c.format.disabled]||f(b)}))),s){const{disableValue:b,disableType:g=c.format.value,reverse:u=!1}=s,C=typeof b=="string"?b.split(","):b;u?S=S.map(y=>{const D=JSON.parse(JSON.stringify(y));return D[c.format.disabled]=!C.includes(D[g])||D[c.format.disabled],D}):S=S.map(y=>{const D=JSON.parse(JSON.stringify(y));return D[c.format.disabled]=C.includes(D[g])||D[c.format.disabled],D})}I.list=S},O=t.computed(()=>o.state.isGettingDictTypes.includes(a.value)),F=t.computed(()=>o.state.isGettingAllDictTypes);t.watch([O,F],([S],[b])=>{(!S||!b)&&k()},{immediate:!0});const E=t.ref(null);return i({getRef:()=>E.value}),(S,b)=>{const g=t.resolveComponent("el-radio-button"),u=t.resolveComponent("el-radio-group");return t.openBlock(),t.createBlock(u,t.mergeProps({ref_key:"ElRadioButtonDict",ref:E},S.$attrs,{onChange:T}),t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(I.list,C=>(t.openBlock(),t.createBlock(g,{key:C[t.unref(c).format.value],disabled:C[t.unref(c).format.disabled],label:C[t.unref(c).format.value],name:e.name},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(C[t.unref(c).format.label]),1)]),_:2},1032,["disabled","label","name"]))),128))]),_:2},[t.renderList(S.$slots,(C,y,D)=>({name:y,fn:t.withCtx(_=>[t.renderSlot(S.$slots,y,t.normalizeProps(t.guardReactiveProps(_)))])}))]),1040)}}});it.install=function(e){e.component(it.name,it)};const Mt=Object.freeze(Object.defineProperty({__proto__:null,default:it},Symbol.toStringTag,{value:"Module"})),zt={name:"ElRadioDict"},at=t.defineComponent({...zt,props:{dictType:{type:[String,Object],required:!0},disableObj:{type:Object},border:{type:Boolean,default:!1},size:{type:String,default:""},name:{type:String,default:""},keyValue:{type:Boolean,default:!1},filterDataFun:{type:Function},disabledDataFun:{type:Function}},emits:["dictChange"],setup(e,{expose:i,emit:m}){const{dictType:n,disableObj:s,border:l,size:d,name:r,keyValue:f,filterDataFun:a,disabledDataFun:c}=e,p=t.ref(""),T=t.toRaw(o.state.dictConfig),I=t.toRaw(o.state.dictCodes),k=g=>{if(!f){m("dictChange",g);return}const u=O.list.find(C=>C[T.format.value]===g);m("dictChange",u)},O=t.reactive({list:[]}),F=async()=>{if(!n)return;let g=[];if(typeof n=="object"){p.value=n.type,await o.actions.getDictDataObj(p.value),g=[].concat(I[p.value]);const{filters:u,filterType:C=T.format.value,reverse:y=!1}=n,D=typeof u=="string"?u.split(","):u;y?g=g.filter(_=>!D.includes(_[C])):g=g.filter(_=>D.includes(_[C]))}else p.value=n,await o.actions.getDictDataObj(p.value),g=[].concat(I[p.value]);if(a&&(g=a(g)),c&&(g=g.map(u=>({...u,[T.format.disabled]:u[T.format.disabled]||c(u)}))),s){const{disableValue:u,disableType:C=T.format.value,reverse:y=!1}=s,D=typeof u=="string"?u.split(","):u;y?g=g.map(_=>{const j=JSON.parse(JSON.stringify(_));return j[T.format.disabled]=!D.includes(j[C])||j[T.format.disabled],j}):g=g.map(_=>{const j=JSON.parse(JSON.stringify(_));return j[T.format.disabled]=D.includes(j[C])||j[T.format.disabled],j})}O.list=g},E=t.computed(()=>o.state.isGettingDictTypes.includes(p.value)),h=t.computed(()=>o.state.isGettingAllDictTypes);t.watch([E,h],([g],[u])=>{(!g||!u)&&F()},{immediate:!0});const S=t.ref(null);return i({getRef:()=>S.value}),(g,u)=>{const C=t.resolveComponent("el-radio"),y=t.resolveComponent("el-radio-group");return t.openBlock(),t.createBlock(y,t.mergeProps({ref_key:"ElRadioDict",ref:S},g.$attrs,{onChange:k}),t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(O.list,D=>(t.openBlock(),t.createBlock(C,{key:D[t.unref(T).format.value],disabled:D[t.unref(T).format.disabled],label:D[t.unref(T).format.value],border:e.border,size:e.size,name:e.name},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(D[t.unref(T).format.label]),1)]),_:2},1032,["disabled","label","border","size","name"]))),128))]),_:2},[t.renderList(g.$slots,(D,_,j)=>({name:_,fn:t.withCtx(B=>[t.renderSlot(g.$slots,_,t.normalizeProps(t.guardReactiveProps(B)))])}))]),1040)}}});at.install=function(e){e.component(at.name,at)};const qt=Object.freeze(Object.defineProperty({__proto__:null,default:at},Symbol.toStringTag,{value:"Module"})),Yt={name:"ElSelectDict"},rt=t.defineComponent({...Yt,props:{dictType:{type:[String,Object],required:!0},disableObj:{type:Object},keyValue:{type:Boolean,default:!1},filterDataFun:{type:Function},disabledDataFun:{type:Function}},emits:["dictChange"],setup(e,{expose:i,emit:m}){const{dictType:n,disableObj:s,keyValue:l,filterDataFun:d,disabledDataFun:r}=e,f=t.ref(""),a=t.toRaw(o.state.dictConfig),c=t.toRaw(o.state.dictCodes),p=h=>{m("dictChange",h)},T=t.reactive({list:[]}),I=async()=>{if(!n)return;let h=[];if(typeof n=="object"){f.value=n.type,await o.actions.getDictDataObj(f.value),h=[].concat(c[f.value]);const{filters:S,filterType:b=a.format.value,reverse:g=!1}=n,u=typeof S=="string"?S.split(","):S;g?h=h.filter(C=>!u.includes(C[b])):h=h.filter(C=>u.includes(C[b]))}else f.value=n,await o.actions.getDictDataObj(f.value),h=[].concat(c[f.value]);if(d&&(h=d(h)),r&&(h=h.map(S=>({...S,[a.format.disabled]:S[a.format.disabled]||r(S)}))),s){const{disableValue:S,disableType:b=a.format.value,reverse:g=!1}=s,u=typeof S=="string"?S.split(","):S;g?h=h.map(C=>{const y=JSON.parse(JSON.stringify(C));return y[a.format.disabled]=!u.includes(y[b])||y[a.format.disabled],y}):h=h.map(C=>{const y=JSON.parse(JSON.stringify(C));return y[a.format.disabled]=u.includes(y[b])||y[a.format.disabled],y})}T.list=h},k=t.computed(()=>o.state.isGettingDictTypes.includes(f.value)),O=t.computed(()=>o.state.isGettingAllDictTypes);t.watch([k,O],([h],[S])=>{(!h||!S)&&I()},{immediate:!0});const F=t.ref(null);return i({getRef:()=>F.value}),(h,S)=>{const b=t.resolveComponent("el-option"),g=t.resolveComponent("el-select");return t.openBlock(),t.createBlock(g,t.mergeProps({ref_key:"ElSelectDict",ref:F},h.$attrs,{"value-key":e.keyValue?t.unref(a).format.label:"",onChange:p}),t.createSlots({default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(T.list,u=>(t.openBlock(),t.createBlock(b,{key:u[t.unref(a).format.value],disabled:u[t.unref(a).format.disabled],label:u[t.unref(a).format.label],value:e.keyValue?u:u[t.unref(a).format.value]},null,8,["disabled","label","value"]))),128))]),_:2},[t.renderList(h.$slots,(u,C,y)=>({name:C,fn:t.withCtx(D=>[t.renderSlot(h.$slots,C,t.normalizeProps(t.guardReactiveProps(D)))])}))]),1040,["value-key"])}}});rt.install=function(e){e.component(rt.name,rt)};const Kt=Object.freeze(Object.defineProperty({__proto__:null,default:rt},Symbol.toStringTag,{value:"Module"})),Ut=(e,i,m)=>{const{format:n}=o.state.dictConfig,s=o.state.dictCodes;let l=[];if(!s||!s[i])o.actions.getDictDataObj(i).then(d=>{if(l=d[i],!l)return;const r=l.find(f=>f[n.value]===e);return r?r[n.label]:m??""});else{l=s[i];const d=l.find(r=>r[n.value]===e);return d?d[n.label]:m??""}},gt=(e,i,m)=>{const n={defaultVal:"",formatFun:(f,a)=>f.map(c=>c[a.label]).join(","),spacer:","};Object.assign(n,m);let s=[];Array.isArray(e)?s=e:typeof e=="string"&&(s=e.split(n.spacer));const{format:l}=o.state.dictConfig,d=o.state.dictCodes;let r=[];if(!d||!d[i])o.actions.getDictDataObj(i).then(f=>{if(r=f[i],!r)return;const a=Y(s,r,l,n.defaultVal);return a&&a.length>0?n.formatFun(a,l):n.defaultVal});else{r=d[i];const f=Y(s,r,l,n.defaultVal);return f&&f.length>0?n.formatFun(f,l):n.defaultVal}},Ht=(e,i,m)=>{const{format:n}=o.state.dictConfig,s=o.state.dictCodes;let l=[];if(!s||!s[i])o.actions.getDictDataObj(i).then(d=>{if(l=d[i],!l)return;const r=l.find(f=>f[n.label]===e);return r?r[n.value]:m??""});else{l=s[i];const d=l.find(r=>r[n.label]===e);return d?d[n.value]:m??""}},Qt=(e,i,m)=>{const n={defaultVal:"",formatFun:(f,a)=>f.map(c=>c[a.value]).join(","),spacer:","};Object.assign(n,m);let s=[];Array.isArray(e)?s=e:typeof e=="string"&&(s=e.split(n.spacer));const{format:l}=o.state.dictConfig,d=o.state.dictCodes;let r=[];if(!d||!d[i])o.actions.getDictDataObj(i).then(f=>{if(r=f[i],!r)return;const a=K(s,r,l,n.defaultVal);return a&&a.length>0?n.formatFun(a,l):n.defaultVal});else{r=d[i];const f=K(s,r,l,n.defaultVal);return f&&f.length>0?n.formatFun(f,l):n.defaultVal}},Wt=(e,i,m)=>{const n={defaultVal:"",formatFun:(s,l)=>s.map(d=>d[l.labelField]).join(","),treeSetting:{}};return Object.assign(n,m),new Promise((s,l)=>{const{treeSetting:d}=o.state.dictConfig,r=Object.assign(d,n.treeSetting),f=o.state.dictCodes;let a=[];if(!f||!f[i])if(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes){const c=setInterval(()=>{if(!(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes)){if(clearInterval(c),a=o.state.dictCodes[i],!a){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const p=a.find(T=>T[r.idField]===e);s(p?n.formatFun(J(p[r.idField],a,r),r):n.defaultVal)}},1e3)}else o.actions.getDictDataObj(i).then(c=>{if(a=c[i],!a){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const p=a.find(T=>T[r.idField]===e);s(p?n.formatFun(J(p[r.idField],a,r),r):n.defaultVal)});else{a=f[i];const c=a.find(p=>p[r.idField]===e);s(c?n.formatFun(J(c[r.idField],a,r),r):n.defaultVal)}})};function Q(e,i,m,n,s){const l=[];for(let d=0;d<e.length;d++){const r=i.find(f=>f[s.idField]===e[d]);r?l.push(n(J(r[s.idField],i,s),s)):l.push(m)}return l}const Xt=(e,i,m)=>{const n={defaultVal:"",formatFunIn:(s,l)=>s.map(d=>d[l.labelField]).join("/"),treeSetting:{},formatFunOut:s=>s.join(","),spacer:","};return Object.assign(n,m),new Promise((s,l)=>{let d=[];Array.isArray(e)?d=e:typeof e=="string"&&(d=e.split(n.spacer));const{treeSetting:r}=o.state.dictConfig,f=Object.assign(r,n.treeSetting),a=o.state.dictCodes;let c=[];if(!a||!a[i])if(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes){const p=setInterval(()=>{if(!(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes)){if(clearInterval(p),c=o.state.dictCodes[i],!c){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const T=Q(d,c,n.defaultVal,n.formatFunIn,f);s(T&&T.length>0?n.formatFunOut(T):n.defaultVal)}},1e3)}else o.actions.getDictDataObj(i).then(p=>{if(c=p[i],!c){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const T=Q(d,c,n.defaultVal,n.formatFunIn,f);s(T&&T.length>0?n.formatFunOut(T):n.defaultVal)});else{c=a[i];const p=Q(d,c,n.defaultVal,n.formatFunIn,f);s(p&&p.length>0?n.formatFunOut(p):n.defaultVal)}})},Zt=(e,i,m)=>{const n={defaultVal:"",formatFun:(s,l)=>s.map(d=>d[l.idField]).join(","),treeSetting:{}};return Object.assign(n,m),new Promise((s,l)=>{const{treeSetting:d}=o.state.dictConfig,r=Object.assign(d,n.treeSetting),f=o.state.dictCodes;let a=[];if(!f||!f[i])if(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes){const c=setInterval(()=>{if(!(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes)){if(clearInterval(c),a=o.state.dictCodes[i],!a){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const p=a.find(T=>T[r.labelField]===e);s(p?n.formatFun(z(p[r.labelField],a,r),r):n.defaultVal)}},1e3)}else o.actions.getDictDataObj(i).then(c=>{if(a=c[i],!a){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const p=a.find(T=>T[r.labelField]===e);s(p?n.formatFun(z(p[r.labelField],a,r),r):n.defaultVal)});else{a=f[i];const c=a.find(p=>p[r.labelField]===e);s(c?n.formatFun(z(c[r.labelField],a,r),r):n.defaultVal)}})};function W(e,i,m,n,s){const l=[];for(let d=0;d<e.length;d++){const r=i.find(f=>f[s.labelField]===e[d]);r?l.push(n(z(r[s.labelField],i,s),s)):l.push(m)}return l}const vt=(e,i,m)=>{const n={defaultVal:"",formatFunIn:(s,l)=>s.map(d=>d[l.idField]).join("/"),treeSetting:{},formatFunOut:s=>s.join(","),spacer:","};return Object.assign(n,m),new Promise((s,l)=>{let d=[];Array.isArray(e)?d=e:typeof e=="string"&&(d=e.split(n.spacer));const{treeSetting:r}=o.state.dictConfig,f=Object.assign(r,n.treeSetting),a=o.state.dictCodes;let c=[];if(!a||!a[i])if(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes){const p=setInterval(()=>{if(!(o.state.isGettingDictTypes.includes(i)||o.state.isGettingAllDictTypes)){if(clearInterval(p),c=o.state.dictCodes[i],!c){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const T=W(d,c,n.defaultVal,n.formatFunIn,f);s(T&&T.length>0?n.formatFunOut(T):n.defaultVal)}},1e3)}else o.actions.getDictDataObj(i).then(p=>{if(c=p[i],!c){l(`不存在类型为:${i} 的字典字段,请确认后再填写`);return}const T=W(d,c,n.defaultVal,n.formatFunIn,f);s(T&&T.length>0?n.formatFunOut(T):n.defaultVal)});else{c=a[i];const p=W(d,c,n.defaultVal,n.formatFunIn,f);s(p&&p.length>0?n.formatFunOut(p):n.defaultVal)}})},te=(e,i,m)=>{const n={defaultVal:"",formatFun:(f,a)=>f.map(c=>c[a.labelField]).join(","),treeSetting:{}};Object.assign(n,m);const{treeSetting:s}=o.state.dictConfig,l=Object.assign(s,n.treeSetting),d=o.state.dictCodes;let r=[];if(!d||!d[i])o.actions.getDictDataObj(i).then(f=>{if(r=f[i],!r)return new Error(`不存在类型为:${i} 的字典字段,请确认后再填写`);const a=r.find(c=>c[l.idField]===e);return a?n.formatFun(J(a[l.idField],r,l),l):n.defaultVal});else{r=d[i];const f=r.find(a=>a[l.idField]===e);return f?n.formatFun(J(f[l.idField],r,l),l):n.defaultVal}},mt=(e,i,m)=>{const n={defaultVal:"",formatFunIn:(a,c)=>a.map(p=>p[c.labelField]).join("/"),treeSetting:{},formatFunOut:a=>a.join(","),spacer:","};Object.assign(n,m);let s=[];Array.isArray(e)?s=e:typeof e=="string"&&(s=e.split(n.spacer));const{treeSetting:l}=o.state.dictConfig,d=Object.assign(l,n.treeSetting),r=o.state.dictCodes;let f=[];if(!r||!r[i])o.actions.getDictDataObj(i).then(a=>{if(f=a[i],!f)return new Error(`不存在类型为:${i} 的字典字段,请确认后再填写`);const c=Q(s,f,n.defaultVal,n.formatFunIn,d);return c&&c.length>0?n.formatFunOut(c):n.defaultVal});else{f=r[i];const a=Q(s,f,n.defaultVal,n.formatFunIn,d);return a&&a.length>0?n.formatFunOut(a):n.defaultVal}},ee=(e,i,m)=>{const n={defaultVal:"",formatFun:(f,a)=>f.map(c=>c[a.idField]).join(","),treeSetting:{}};Object.assign(n,m);const{treeSetting:s}=o.state.dictConfig,l=Object.assign(s,n.treeSetting),d=o.state.dictCodes;let r=[];if(!d||!d[i])o.actions.getDictDataObj(i).then(f=>{if(r=f[i],!r)return new Error(`不存在类型为:${i} 的字典字段,请确认后再填写`);const a=r.find(c=>c[l.labelField]===e);return a?n.formatFun(z(a[l.labelField],r,l),l):n.defaultVal});else{r=d[i];const f=r.find(a=>a[l.labelField]===e);return f?n.formatFun(z(f[l.labelField],r,l),l):n.defaultVal}},ne=(e,i,m)=>{const n={defaultVal:"",formatFunIn:(a,c)=>a.map(p=>p[c.idField]).join("/"),treeSetting:{},formatFunOut:a=>a.join(","),spacer:","};Object.assign(n,m);let s=[];Array.isArray(e)?s=e:typeof e=="string"&&(s=e.split(n.spacer));const{treeSetting:l}=o.state.dictConfig,d=Object.assign(l,n.treeSetting),r=o.state.dictCodes;let f=[];if(!r||!r[i])o.actions.getDictDataObj(i).then(a=>{if(f=a[i],!f)return new Error(`不存在类型为:${i} 的字典字段,请确认后再填写`);const c=W(s,f,n.defaultVal,n.formatFunIn,d);return c&&c.length>0?n.formatFunOut(c):n.defaultVal});else{f=r[i];const a=W(s,f,n.defaultVal,n.formatFunIn,d);return a&&a.length>0?n.formatFunOut(a):n.defaultVal}},pt={date:"yyyy-MM-dd",month:"yyyy-MM",datetime:"yyyy-MM-dd hh:mm:ss",time:"hh:mm:ss",year:"yyyy"},bt=e=>{const i=e.replaceAll("-","/");var m=new Date(e),n=new Date(i);return!isNaN(m.getTime())||!isNaN(n.getTime())},yt=(e,i="datetime",m)=>{if(!e||!i)return m??"";Object.keys(pt).includes(i)&&(i=pt[i]),e instanceof Date||(typeof e=="number"||bt(e)?e=new Date(e):e=new Date(Number(e)));const n={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(i)&&(i=i.replace(RegExp.$1,String(e.getFullYear()).substr(4-RegExp.$1.length)));for(const s in n){const l=new RegExp(`(${s})`);l.test(i)&&(i=i.replace(l,RegExp.$1.length===1?n[s]:("00"+n[s]).substr(String(n[s]).length)))}return i},q=(e,i)=>{let n=Object.assign({start:0,end:0,middle:0,symbol:"*"},i);if(n||(n={start:0,end:0,symbol:"*"}),n.start<0||n.end<0)return"";const s=e.length;if(n.start+n.end+n.middle>s)return e;let l="";for(let f=0;f<n.start&&f<s;f++)l+=e.charAt(f);let d="";for(let f=s-1;f>=0&&f>=s-n.end;f--)d=e.charAt(f)+d;const r=n.symbol.repeat(Math.max(n.middle||s-n.start-n.end,0));return l+r+d},Dt=(e,i="*")=>{if(!e)return"";const m=e.length;if(m===1)return e;const n=e.charAt(0),s=e.charAt(m-1);return q(e.substring(1,m-1),{start:1,symbol:i})?`${n}*${s}`:`${n}${s}`},Ct=(e,i="*")=>e?q(e,{start:4,end:4,symbol:i}):"",Tt=(e,i="*")=>e?q(String(e),{start:3,end:4,symbol:i}):"",_t=(e,i="*")=>{if(!e)return"";const m=e.trim().split(/\s+/),n=m.length;let s="";for(let l=0;l<n;l++)/^[\u4e00-\u9fa5]+$/.test(m[l])?s+=q(m[l],{start:1,symbol:i}):s+=q(m[l],{start:2,symbol:i}),l<n-1&&(s+=" ");return s},ie={mobile:Tt,name:Dt,address:_t,idCard:Ct},St=(e,i)=>{if(typeof i=="string"&&(i={maskType:i}),i.maskType==="none")return e;const m={start:0,end:0,symbol:"*",defaultVal:"",maskType:""};if(Object.assign(m,i),!e)return m.defaultVal;if(m.maskType)return ie[m.maskType](e,m.symbol);const n={start:m.start,end:m.end,middle:m.middle,symbol:m.symbol};return q(e,n)},ae={name:"ElTableColumnDict"},lt=t.defineComponent({...ae,props:{dictType:{type:String,default:""},dictTreeType:{type:String,default:""},dateFormat:{type:String},defaultVal:{type:String,default:""},formatFun:{type:Function,default:null},formatFunIn:{type:Function,default:null},formatFunOut:{type:Function,default:null},spacer:{type:String,default:","},treeSetting:{type:Object,default:null},maskType:{type:String,validator(e){return["mobile","address","idCard","name"].includes(e)}},maskStart:{type:Number},maskEnd:{type:Number},maskMiddle:{type:Number},maskSymbol:{type:String,default:"*"},dictTypeNode:{type:String,validator(e){return["link","button","tag","text"].includes(e)}}},setup(e,{expose:i}){const{dictType:m,dictTreeType:n,dateFormat:s,defaultVal:l,treeSetting:d,formatFun:r,formatFunIn:f,formatFunOut:a,spacer:c,maskType:p,maskStart:T,maskEnd:I,maskMiddle:k,maskSymbol:O}=e,F=t.useAttrs(),E=t.computed(()=>{let u={};return l&&(u.defaultVal=l),r&&(u.formatFun=r),c&&(u.spacer=c),u}),h=t.computed(()=>{let u={};return l&&(u.defaultVal=l),f&&(u.formatFunIn=f),a&&(u.formatFunOut=a),d&&(u.treeSetting=d),c&&(u.spacer=c),u}),S=t.computed(()=>{const u={};return l&&(u.defaultVal=l),p&&(u.maskType=p),T&&(u.start=T),I&&(u.end=I),k&&(u.middle=k),O&&(u.symbol=O),u}),b=t.ref(null);return i({getRef:()=>b.value}),(u,C)=>{const y=t.resolveComponent("el-button-dict"),D=t.resolveComponent("el-link-dict"),_=t.resolveComponent("el-tag-dict"),j=t.resolveComponent("el-text-dict"),B=t.resolveComponent("el-table-column");return t.openBlock(),t.createBlock(B,t.mergeProps({ref_key:"ElTableColumnDict",ref:b},u.$attrs),t.createSlots({default:t.withCtx(L=>{var A,w,$,M,R,P,x,ut,ht;return[e.dictType?(t.openBlock(),t.createElementBlock(t.Fragment,{key:0},[e.dictTypeNode==="button"?(t.openBlock(),t.createBlock(y,{key:0,value:L.row[(A=t.unref(F))==null?void 0:A.prop]||"",dictType:e.dictType},null,8,["value","dictType"])):e.dictTypeNode==="link"?(t.openBlock(),t.createBlock(D,{key:1,value:L.row[(w=t.unref(F))==null?void 0:w.prop]||"",dictType:e.dictType},null,8,["value","dictType"])):e.dictTypeNode==="tag"?(t.openBlock(),t.createBlock(_,{key:2,value:L.row[($=t.unref(F))==null?void 0:$.prop]||"",dictType:e.dictType},null,8,["value","dictType"])):e.dictTypeNode==="text"?(t.openBlock(),t.createBlock(j,{key:3,value:L.row[(M=t.unref(F))==null?void 0:M.prop]||"",dictType:e.dictType},null,8,["value","dictType"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[t.createTextVNode(t.toDisplayString(t.unref(gt)(L.row[(R=t.unref(F))==null?void 0:R.prop],e.dictType,t.unref(E))),1)],64))],64)):e.dictTreeType?(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(t.unref(mt)(L.row[(P=t.unref(F))==null?void 0:P.prop],e.dictTreeType,t.unref(h))),1)],64)):e.dateFormat?(t.openBlock(),t.createElementBlock(t.Fragment,{key:2},[t.createTextVNode(t.toDisplayString(t.unref(yt)(L.row[(x=t.unref(F))==null?void 0:x.prop],e.dateFormat,e.defaultVal)),1)],64)):e.maskType||e.maskStart?(t.openBlock(),t.createElementBlock(t.Fragment,{key:3},[t.createTextVNode(t.toDisplayString(t.unref(St)(L.row[(ut=t.unref(F))==null?void 0:ut.prop],t.unref(S))),1)],64)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:4},[t.createTextVNode(t.toDisplayString(L.row[(ht=t.unref(F))==null?void 0:ht.prop]||e.defaultVal),1)],64))]}),_:2},[t.renderList(u.$slots,(L,A,w)=>({name:A,fn:t.withCtx($=>[t.renderSlot(u.$slots,A,t.normalizeProps(t.guardReactiveProps($)))])}))]),1040)}}});lt.install=function(e){e.component(lt.name,lt)};const re=Object.freeze(Object.defineProperty({__proto__:null,default:lt},Symbol.toStringTag,{value:"Module"})),le={name:"ElTabsDict"},st=t.defineComponent({...le,props:{badgeObj:{type:Object,default:()=>({})},dictType:{type:[String,Object],required:!0},disableObj:{type:Object},keyValue:{type:Boolean,default:!1},filterDataFun:{type:Function},disabledDataFun:{type:Function}},emits:["dictChange"],setup(e,{expose:i,emit:m}){const{badgeObj:n,dictType:s,disableObj:l,keyValue:d,filterDataFun:r,disabledDataFun:f}=e,a=t.useAttrs(),c=t.ref(""),p=t.toRaw(o.state.dictConfig),T=t.toRaw(o.state.dictCodes),I=b=>{window.setTimeout(()=>{if(!d){m("dictChange",a.modelValue);return}const g=k.list.find(u=>u[p.format.value]===a.modelValue);m("dictChange",g)},0)},k=t.reactive({list:[]}),O=async()=>{if(!s)return;let b=[];if(typeof s=="object"){c.value=s.type,await o.actions.getDictDataObj(c.value),b=[].concat(T[c.value]);const{filters:g,filterType:u=p.format.value,reverse:C=!1}=s,y=typeof g=="string"?g.split(","):g;C?b=b.filter(D=>!y.includes(D[u])):b=b.filter(D=>y.includes(D[u]))}else c.value=s,await o.actions.getDictDataObj(c.value),b=[].concat(T[c.value]);if(r&&(b=r(b)),f&&(b=b.map(g=>({...g,[p.format.disabled]:g[p.format.disabled]||f(g)}))),l){const{disableValue:g,disableType:u=p.format.value,reverse:C=!1}=l,y=typeof g=="string"?g.split(","):g;C?b=b.map(D=>{const _=JSON.parse(JSON.stringify(D));return _[p.format.disabled]=!y.includes(_[u])||_[p.format.disabled],_}):b=b.map(D=>{const _=JSON.parse(JSON.stringify(D));return _[p.format.disabled]=y.includes(_[u])||_[p.format.disabled],_})}k.list=b},F=t.computed(()=>o.state.isGettingDictTypes.includes(c.value)),E=t.computed(()=>o.state.isGettingAllDictTypes);t.watch([F,E],([b],[g])=>{(!b||!g)&&O()},{immediate:!0});const h=t.ref(null);return i({getRef:()=>h.value}),(b,g)=>{const u=t.resolveComponent("el-badge"),C=t.resolveComponent("el-tab-pane"),y=t.resolveComponent("el-tabs");return t.openBlock(),t.createBlock(y,t.mergeProps({ref_key:"ElTabsDict",ref:h,class:"vue-element-dict-tabs"},b.$attrs,{onTabClick:I}),{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(k.list,D=>(t.openBlock(),t.createBlock(C,{disabled:D[t.unref(p).format.disabled],label:D[t.unref(p).format.label],key:D[t.unref(p).format.value],name:D[t.unref(p).format.value]},t.createSlots({default:t.withCtx(()=>[t.renderSlot(b.$slots,D[t.unref(p).format.value])]),_:2},[t.renderList(b.$slots,(_,j,B)=>({name:j,fn:t.withCtx(L=>[t.renderSlot(b.$slots,j,t.normalizeProps(t.guardReactiveProps(L)))])})),e.badgeObj[D[t.unref(p).format.value]]?{name:"label",fn:t.withCtx(()=>[t.createVNode(u,{type:e.badgeObj[D[t.unref(p).format.value]].type,"is-dot":e.badgeObj[D[t.unref(p).format.value]].isDot,value:e.badgeObj[D[t.unref(p).format.value]].value,max:e.badgeObj[D[t.unref(p).format.value]].max,hidden:e.badgeObj[D[t.unref(p).format.value]].hidden,class:"item"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(D[t.unref(p).format.label]),1)]),_:2},1032,["type","is-dot","value","max","hidden"])]),key:"0"}:void 0]),1032,["disabled","label","name"]))),128))]),_:3},16)}}});st.install=function(e){e.component(st.name,st)};const se=Object.freeze(Object.defineProperty({__proto__:null,default:st},Symbol.toStringTag,{value:"Module"})),oe={name:"ElTagDict"},ot=t.defineComponent({...oe,props:{value:{type:[String,Number],required:!0},dictType:{type:[String],required:!0},judgeTypeFun:{type:Function},type:{type:String,default:""},judgeColorFun:{type:Function},color:{type:String,default:""}},setup(e,{expose:i}){const m=e,{value:n,dictType:s,judgeTypeFun:l,type:d,judgeColorFun:r,color:f}=t.toRefs(m),a=t.toRaw(o.state.dictConfig),c=t.computed(()=>l!=null&&l.value?l==null?void 0:l.value(n.value):d.value?d.value:T.value&&T.value[a.format.type]?T.value[a.format.type]:"success"),p=t.computed(()=>r!=null&&r.value?r==null?void 0:r.value(n):f.value?f.value:T.value&&T.value[a.format.color]?T.value[a.format.color]:"");let T=t.ref(null),I=t.ref(null);t.watchEffect(()=>{U(n.value,s.value).then(F=>{T.value=F,I.value=F[a.format.label]})});const k=t.ref(null);return i({getRef:()=>k.value}),(F,E)=>{const h=t.resolveComponent("el-tag");return t.openBlock(),t.createBlock(h,t.mergeProps({ref_key:"ElTagDict",ref:k,type:t.unref(c),color:t.unref(p)},F.$attrs),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(t.unref(I)),1)]),_:2},[t.renderList(F.$slots,(S,b,g)=>({name:b,fn:t.withCtx(u=>[t.renderSlot(F.$slots,b,t.normalizeProps(t.guardReactiveProps(u)))])}))]),1040,["type","color"])}}});ot.install=function(e){e.component(ot.name,ot)};const ce=Object.freeze(Object.defineProperty({__proto__:null,default:ot},Symbol.toStringTag,{value:"Module"})),de={name:"ElTextDict"},ct=t.defineComponent({...de,props:{value:{type:[String,Number],required:!0},dictType:{type:[String],required:!0},judgeTypeFun:{type:Function},type:{type:String,default:""}},setup(e,{expose:i}){const m=e,{value:n,dictType:s,judgeTypeFun:l,type:d}=t.toRefs(m),r=t.toRaw(o.state.dictConfig),f=t.computed(()=>l!=null&&l.value?l==null?void 0:l.value(n.value):d!=null&&d.value?d.value:a.value&&a.value[r.format.type]?a.value[r.format.type]:"primary");let a=t.ref(null),c=t.ref(null);t.watchEffect(()=>{U(n.value,s.value).then(I=>{a.value=I,c.value=I[r.format.label]})});const p=t.ref(null);return i({getRef:()=>p.value}),(I,k)=>{const O=t.resolveComponent("el-text");return t.openBlock(),t.createBlock(O,t.mergeProps({ref:"ElTextDict",type:t.unref(f)},I.$attrs),t.createSlots({default:t.withCtx(()=>[t.createTextVNode(" "+t.toDisplayString(t.unref(c)),1)]),_:2},[t.renderList(I.$slots,(F,E,h)=>({name:E,fn:t.withCtx(S=>[t.renderSlot(I.$slots,E,t.normalizeProps(t.guardReactiveProps(S)))])}))]),1040,["type"])}}});ct.install=function(e){e.component(ct.name,ct)};const fe=Object.freeze(Object.defineProperty({__proto__:null,default:ct},Symbol.toStringTag,{value:"Module"})),ue={name:"ElTreeDict"},dt=t.defineComponent({...ue,props:{maxLevel:{type:[Number,String]},dictType:{type:[String,Object],required:!0},disableObj:{type:Object},filterDataFun:{type:Function},disabledDataFun:{type:Function}},setup(e,{expose:i}){const{maxLevel:m,dictType:n,disableObj:s,filterDataFun:l,disabledDataFun:d}=e,r=t.useAttrs(),f=t.ref(""),a=t.toRaw(o.state.dictConfig),c=t.toRaw(o.state.dictCodes),p=t.reactive({list:[]}),T=(b,g)=>{for(let u=0;u<b.length;u++){const C=b[u];if(C[a.treeSetting.levelField]===g){delete C[F.value.children],C[F.value.isLeaf]=!0;continue}else T(C[F.value.children],g)}},I=async()=>{if(!n)return;let b=[];if(typeof n=="object"){f.value=n.type,await o.actions.getDictDataObj(f.value),b=[].concat(c[f.value]);const{filters:g,filterType:u=a.format.value,reverse:C=!1}=n,y=typeof g=="string"?g.split(","):g;C?b=b.filter(D=>!y.includes(D[u])):b=b.filter(D=>y.includes(D[u]))}else f.value=n,await o.actions.getDictDataObj(f.value),b=[].concat(c[f.value]);if(l&&(b=l(b)),d&&(b=b.map(g=>({...g,[a.format.disabled]:g[a.format.disabled]||d(g)}))),s){const{disableValue:g,disableType:u=a.format.value,reverse:C=!1}=s,y=typeof g=="string"?g.split(","):g;C?b=b.map(D=>{const _=JSON.parse(JSON.stringify(D));return _[a.format.disabled]=!y.includes(_[u])||_[a.format.disabled],_}):b=b.map(D=>{const _=JSON.parse(JSON.stringify(D));return _[a.format.disabled]=y.includes(_[u])||_[a.format.disabled],_})}p.list=b},k=t.computed(()=>o.state.isGettingDictTypes.includes(f.value)),O=t.computed(()=>o.state.isGettingAllDictTypes),F=t.computed(()=>{const b=r.props??{};return b.disabled=b.disabled??o.state.dictConfig.format.disabled,b.label=b.label??o.state.dictConfig.treeSetting.labelField,b.children=b.children??o.state.dictConfig.treeSetting.childrenField,b.isLeaf=b.leaf??o.state.dictConfig.treeSetting.leafField,b}),E=t.computed(()=>{const b=r.props??{},g={labelField:b.label??a.treeSetting.labelField,childrenField:b.children??a.treeSetting.childrenField,leafField:b.leaf??a.treeSetting.leafField},u=Object.assign(o.state.dictConfig.treeSetting,g),C=JSON.parse(JSON.stringify(p.list)),y=H(C,u);return m&&T(y,+m),y});t.watch([k,O],([b],[g])=>{(!b||!g)&&I()},{immediate:!0});const h=t.ref(null);return i({getRef:()=>h.value}),(b,g)=>{const u=t.resolveComponent("el-tree");return t.openBlock(),t.createBlock(u,{ref_key:"ElTreeDict",ref:h,data:t.unref(E),props:t.unref(F)},t.createSlots({_:2},[t.renderList(b.$slots,(C,y,D)=>({name:y,fn:t.withCtx(_=>[t.renderSlot(b.$slots,y,t.normalizeProps(t.guardReactiveProps(_)))])}))]),1032,["data","props"])}}});dt.install=function(e){e.component(dt.name,dt)};const ge=Object.freeze(Object.defineProperty({__proto__:null,default:dt},Symbol.toStringTag,{value:"Module"})),me={name:"ElTreeSelectDict"},ft=t.defineComponent({...me,props:{maxLevel:{type:[Number,String]},nodeKey:{type:String,default:o.state.dictConfig.treeSetting.idField},dictType:{type:[String,Object],required:!0},disableObj:{type:Object},filterDataFun:{type:Function},disabledDataFun:{type:Function}},setup(e,{expose:i}){const{maxLevel:m,nodeKey:n,dictType:s,disableObj:l,filterDataFun:d,disabledDataFun:r}=e,f=t.useAttrs(),a=t.ref(""),c=t.toRaw(o.state.dictConfig),p=t.toRaw(o.state.dictCodes),T=t.reactive({list:[]}),I=(g,u)=>{for(let C=0;C<g.length;C++){const y=g[C];if(y[c.treeSetting.levelField]===u){delete y[E.value.children],y[E.value.isLeaf]=!0;continue}else I(y[E.value.children],u)}},k=async()=>{if(!s)return;let g=[];if(typeof s=="object"){a.value=s.type,await o.actions.getDictDataObj(a.value),g=[].concat(p[a.value]);const{filters:u,filterType:C=c.format.value,reverse:y=!1}=s,D=typeof u=="string"?u.split(","):u;y?g=g.filter(_=>!D.includes(_[C])):g=g.filter(_=>D.includes(_[C]))}else a.value=s,await o.actions.getDictDataObj(a.value),g=[].concat(p[a.value]);if(d&&(g=d(g)),r&&(g=g.map(u=>({...u,[c.format.disabled]:u[c.format.disabled]||r(u)}))),l){const{disableValue:u,disableType:C=c.format.value,reverse:y=!1}=l,D=typeof u=="string"?u.split(","):u;y?g=g.map(_=>{const j=JSON.parse(JSON.stringify(_));return j[c.format.disabled]=!D.includes(j[C])||j[c.format.disabled],j}):g=g.map(_=>{const j=JSON.parse(JSON.stringify(_));return j[c.format.disabled]=D.includes(j[C])||j[c.format.disabled],j})}T.list=g},O=t.computed(()=>o.state.isGettingDictTypes.includes(a.value)),F=t.computed(()=>o.state.isGettingAllDictTypes),E=t.computed(()=>{const g=f.props??{};return g.disabled=g.disabled??o.state.dictConfig.format.disabled,g.label=g.label??o.state.dictConfig.treeSetting.labelField,g.children=g.children??o.state.dictConfig.treeSetting.childrenField,g.isLeaf=g.leaf??o.state.dictConfig.treeSetting.leafField,g}),h=t.computed(()=>{const g=f.props??{},u={labelField:g.label??c.treeSetting.labelField,childrenField:g.children??c.treeSetting.childrenField,leafField:g.leaf??c.treeSetting.leafField},C=Object.assign(o.state.dictConfig.treeSetting,u),y=JSON.parse(JSON.stringify(T.list)),D=H(y,C);return m&&I(D,+m),D});t.watch([O,F],([g],[u])=>{(!g||!u)&&k()},{immediate:!0});const S=t.ref(null);return i({getRef:()=>S.value}),(g,u)=>{const C=t.resolveComponent("el-tree-select");return t.openBlock(),t.createBlock(C,{ref_key:"ElTreeSelectDict",ref:S,data:t.unref(h),"node-key":e.nodeKey,props:t.unref(E)},t.createSlots({_:2},[t.renderList(g.$slots,(y,D,_)=>({name:D,fn:t.withCtx(j=>[t.renderSlot(g.$slots,D,t.normalizeProps(t.guardReactiveProps(j)))])}))]),1032,["data","node-key","props"])}}});ft.install=function(e){e.component(ft.name,ft)};const Ft=Object.assign({"./el-button-dict/index.ts":Bt,"./el-cascader-dict/index.ts":Nt,"./el-checkbox-button-dict/index.ts":Vt,"./el-checkbox-dict/index.ts":Rt,"./el-link-dict/index.ts":xt,"./el-radio-button-dict/index.ts":Mt,"./el-radio-dict/index.ts":qt,"./el-select-dict/index.ts":Kt,"./el-table-column-dict/index.ts":re,"./el-tabs-dict/index.ts":se,"./el-tag-dict/index.ts":ce,"./el-text-dict/index.ts":fe,"./el-tree-dict/index.ts":ge,"./el-tree-select-dict/index.ts":Object.freeze(Object.defineProperty({__proto__:null,default:ft},Symbol.toStringTag,{value:"Module"}))});let Ot=[];Object.keys(Ft).forEach(e=>{Ot.push(Ft[e].default)});const pe=()=>o.state.dictConfig,be=e=>o.state.dictConfig[e],ye=pe,De=be,Ce=It,Te=kt,_e=jt,Se=At,Fe=Gt,Oe=U,he=Ut,Ie=gt,ke=Ht,je=Qt,Ae=q,Ge=_t,Ee=Ct,Be=Dt,Le=Tt,Ne=St,we=yt,Ve=bt,$e=H,Re=J,Pe=z,xe=Wt,Je=Zt,Me=Xt,ze=vt,qe=te,Ye=ee,Ke=mt,Ue=ne;async function He(e){const i=e.storage.getItem(e.dictDataKey)||"{}",m=JSON.parse(i),n=e.usuallyGetDictTypes?e.usuallyGetDictTypes.split(","):[];let s=[];if(e.usuallyGetDictTypesByApi)s=n;else if(n.length>0)for(let l=0;l<n.length;l++)m[n[l]]||s.push(n[l]);if(i==="{}"||e.isGetAll||s.length>0){let l,d="";e.isGetAll?(o.mutations.SETTING_ISGETTING_ALL_DICT_TYPES(!0),l=await e.getDictCodeApi(e.formatterRequest(e.query,d)),o.mutations.SETTING_ISGETTING_ALL_DICT_TYPES(!1)):s.length>0&&(d=s.join(","),o.mutations.ADD_IS_EGTTING_DICT_TYPES(d),l=await e.getDictCodeApi(e.formatterRequest(e.query,d)),o.mutations.REMOVE_IS_EGTTING_DICT_TYPES(d));const r=e.formatterDictList(l,d),f=e.formatterDictVersion(l);e.storage.setItem(e.versionKey,f);const a=Object.assign(o.state.dictCodes,r);o.mutations.SET_DICT_CODES(a),e.storage.setItem(e.dictDataKey,JSON.stringify(a))}}let Qe={async install(e,i){const m={filterDataFun:r=>r,disabledDataFun:r=>r,treeSetting:{idField:"id",parentIdField:"parentId",childrenField:"children",firstId:"0",labelField:"label",labelArrField:"labelArr",idArrField:"idArr",levelField:"level",level:0,leafField:"leaf"},query:"dictType",versionKey:"vue3ElementDictVersion",dictDataKey:"vue3ElementDictData",format:{value:"value",label:"label",disabled:"disabled",type:"type",color:"color"},formatterRequest:(r,f)=>f?{[r]:f}:{[r]:""},formatterDictList:(r,f)=>!r||!r.dictData?{}:r.dictData,formatterDictVersion:r=>!r||!r.version?"unknow":r.version,version:"unknow",storage:localStorage,isGetAll:!1,usuallyGetDictTypes:"",usuallyGetDictTypesByApi:!1,localDictCodes:{}};i.format=Object.assign(m.format,i.format),i.treeSetting=Object.assign(m.treeSetting,i.treeSetting);const n=Object.assign(m,i);o.mutations.SET_DICT_SETTING(n);const s=JSON.parse(n.storage.getItem(n.dictDataKey))||{};let l=JSON.parse(JSON.stringify(n.localDictCodes));l=Object.assign(s,l),n.storage.setItem(n.dictDataKey,JSON.stringify(l)),o.mutations.SET_DICT_CODES(l);const d=n.storage.getItem(n.versionKey);n.version!==d&&(n.storage.removeItem(n.dictDataKey),n.storage.setItem(n.versionKey,n.version),n.storage.setItem(n.dictDataKey,JSON.stringify(n.localDictCodes)),o.mutations.SET_DICT_CODES(n.localDictCodes)),(n.isGetAll||n.usuallyGetDictTypes)&&He(n),Ot.forEach(r=>{e.component(r.name,r)})}};G.default=Qe,G.desensitization=Ne,G.formatDate=we,G.getCodeByLabel=_e,G.getCodeByLabelFilter=ke,G.getCodeByLabels=Se,G.getCodeByLabelsFilter=je,G.getDictConfig=ye,G.getDictConfigByKey=De,G.getDictObjByDictTypes=Fe,G.getItemByCode=Oe,G.getLabelByCode=Ce,G.getLabelByCodeFilter=he,G.getLabelByCodes=Te,G.getLabelByCodesFilter=Ie,G.getTreeCodeByLabel=Je,G.getTreeCodeByLabelFilter=Ye,G.getTreeCodeByLabels=ze,G.getTreeCodeByLabelsFilter=Ue,G.getTreeItemByCode=Re,G.getTreeItemByLabel=Pe,G.getTreeLabelByCode=xe,G.getTreeLabelByCodeFilter=qe,G.getTreeLabelByCodes=Me,G.getTreeLabelByCodesFilter=Ke,G.isDate=Ve,G.listToTree=$e,G.mask=Ae,G.maskAddress=Ge,G.maskIdCard=Ee,G.maskName=Be,G.maskPhone=Le,Object.defineProperties(G,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "vue3-element-dict",
3
+ "private": false,
4
+ "version": "2.0.0",
5
+ "author": {
6
+ "name": "shenxiaobu",
7
+ "url": "https://shenxiaobu.github.io"
8
+ },
9
+ "keywords": [
10
+ "vue3字典包",
11
+ "elementPlus字典包",
12
+ "dict",
13
+ "elementPlus",
14
+ "vue3",
15
+ "爆米花小布"
16
+ ],
17
+ "main": "lib/vue3-element-dict.js",
18
+ "type": "module",
19
+ "types": "lib/index.d.ts",
20
+ "scripts": {
21
+ "dev": "vite",
22
+ "build:tsc": "vue-tsc && vite build",
23
+ "build": "vite build",
24
+ "preview": "vite preview",
25
+ "tsc": "vue-tsc"
26
+ },
27
+ "devDependencies": {
28
+ "@element-plus/icons-vue": "^2.1.0",
29
+ "@types/node": "^18.15.12",
30
+ "@vitejs/plugin-vue": "^4.1.0",
31
+ "element-plus": "^2.3.3",
32
+ "typescript": "^4.9.3",
33
+ "vite": "^4.2.0",
34
+ "vue": "^3.2.47",
35
+ "vue-router": "^4.1.6",
36
+ "vue-tsc": "^1.2.0"
37
+ }
38
+ }
@@ -0,0 +1,350 @@
1
+ /**
2
+ * 字典配置相关开始
3
+ */
4
+ export type TreeSetting = {
5
+ idField: string, //唯一标识字段名
6
+ parentIdField: string, //父节点唯一标识字段名
7
+ childrenField: string, //子节点标识字段名
8
+ firstId: string|number, // 根节点值
9
+ labelField: string, //label字段名
10
+ labelArrField: string, //给对象新增的中文数组字段名
11
+ idArrField: string, //给对象新增的id数组字段名
12
+ levelField: string, //给对象新增的层级字段名
13
+ level: number, // 给根目录配置的层级
14
+ leafField: string //叶子节点标识字段名
15
+ }
16
+
17
+ export interface IFilterDataFun {
18
+ (list: {[key: string]: any}[]): {key: string}[]
19
+ }
20
+ export interface IDisabledDataFun extends IFilterDataFun {}
21
+
22
+ export type DictConfig = {
23
+ getDictCodeApi: any; // 获取字典的接口
24
+ version: string; // 当前字典最新版本号
25
+ localDictCodes: { [key: string]: object[] }; // 本地字典数据
26
+ versionKey: string; // 版本号缓存键名
27
+ dictDataKey: string; // 字典数据缓存键名
28
+ query: string; // 请求字典的参数名
29
+ format: {
30
+ // 格式化字典数据的 值和名 字段
31
+ value: string;
32
+ label: string;
33
+ disabled: string;
34
+ type: string;
35
+ color: string;
36
+ };
37
+ formatterDictList: (
38
+ data: { dictData: object; version: string },
39
+ query?: string
40
+ ) => object; //格式化字典数据
41
+ formatterDictVersion: (data: {
42
+ dictData: object;
43
+ version: string;
44
+ }) => string; // 格式化返回的最新字典版本号
45
+ filterDataFun: IFilterDataFun; // 字典数据过滤方法
46
+ disabledDataFun: IDisabledDataFun; // 字典数据禁用方法
47
+ formatterRequest: (query: string, dictType: string) => object; // 格式化请求体
48
+ storage: any; // localstorage sessionstorage
49
+
50
+ isGetAll?: boolean; // 是否请求全部
51
+ usuallyGetDictTypes?: string; // 经常获取的字典数据
52
+ usuallyGetDictTypesByApi?: boolean; // 是否每次都通过接口获取数据
53
+ treeSetting: TreeSetting;
54
+ }
55
+
56
+ // 可选的字典配置
57
+ export type OptionalDictConfig = {
58
+ getDictCodeApi: any; // 获取字典的接口
59
+ version: string; // 当前字典最新版本号
60
+ localDictCodes?: { [key: string]: object[] }; // 本地字典数据
61
+ versionKey?: string; // 版本号缓存键名
62
+ dictDataKey?: string; // 字典数据缓存键名
63
+ query?: string; // 请求字典的参数名
64
+ format?: {
65
+ // 格式化字典数据的 值和名 字段
66
+ value: string;
67
+ label: string;
68
+ disabled: string;
69
+ type: string;
70
+ color: string;
71
+ };
72
+ formatterDictList?: (
73
+ data: { dictCodeList: object; version: string },
74
+ query?: string
75
+ ) => object; //格式化字典数据
76
+ formatterDictVersion?: (data: {
77
+ dictCodeList: object;
78
+ version: string;
79
+ }) => string; // 格式化返回的最新字典版本号
80
+ filterDataFun?: (list: object[]) => object[]; // 字典数据过滤方法
81
+ disabledDataFun?: (list: object[]) => object[]; // 字典数据禁用方法
82
+
83
+ formatterRequest?: (query: string, dictType: string) => object; // 格式化请求体
84
+ storage?: any; // localstorage sessionstorage
85
+ isGetAll?: boolean; // 是否请求全部
86
+ usuallyGetDictTypes?: string; // 经常获取的字典数据
87
+ usuallyGetDictTypesByApi?: boolean; // 是否每次都通过接口获取数据
88
+ treeSetting?: FewTreeSetting;
89
+ }
90
+
91
+
92
+ // 可选的树形配置
93
+ export type OptionalTreeSetting = {
94
+ idField?: "id", //唯一标识字段名
95
+ parentIdField?: "parentId", //父节点唯一标识字段名
96
+ childrenField?: "children", //子节点标识字段名
97
+ firstId?: "0", // 根节点值
98
+ labelField?: "label", //label字段名
99
+ labelArrField?: "labelArr", //给对象新增的中文数组字段名
100
+ idArrField?: "idArr", //给对象新增的id数组字段名
101
+ levelField?: "level", //给对象新增的层级字段名
102
+ level?: 0, // 给根目录配置的层级
103
+ leafField?: "leaf" //叶子节点标识字段名
104
+ }
105
+
106
+ // 通过code获取树形数据配置
107
+ export type GetTreeItemByCodeOptions = {
108
+ idField: string,
109
+ parentIdField: string
110
+ }
111
+
112
+ export type GetTreeItemByLabelOptions = {
113
+ idField: string,
114
+ labelField: string, //唯一标识字段名
115
+ parentIdField: string //父节点唯一标识字段名
116
+ }
117
+
118
+ /**
119
+ * 字典配置相关结束
120
+ */
121
+
122
+ /**
123
+ * 脱敏相关开始
124
+ */
125
+ export type OptionalMaskOptions = {
126
+ start?: number; // 从前往后保留的位数,默认为 1
127
+ end?: number; // 从后往前保留的位数,默认为 0
128
+ middle?: number; // 中间展示几个symbol
129
+ symbol?: string; // 替换的字符,默认为 *
130
+ }
131
+
132
+ export type MaskOptions = {
133
+ start: number; // 从前往后保留的位数,默认为 1
134
+ end: number; // 从后往前保留的位数,默认为 0
135
+ symbol: string; // 替换的字符,默认为 *
136
+ middle?: number; // 中间展示几个symbol
137
+ }
138
+
139
+ export type MaskType = "name" | "mobile" |"address" | "idCard" | "none" | ""
140
+
141
+ // 必填的脱敏配置
142
+ export type DesensitizationOptions = MaskOptions & {
143
+ defaultVal: string,
144
+ maskType: MaskType,
145
+ middle?: number;
146
+ }
147
+
148
+ // 可选的脱敏方法配置
149
+ export type OptionalDesensitizationOptions = OptionalMaskOptions & {
150
+ middle?: number,
151
+ defaultVal?: string,
152
+ maskType?: MaskType
153
+ }
154
+ /**
155
+ * 脱敏相关结束
156
+ */
157
+
158
+ /**
159
+ * 日期格式化 开始
160
+ */
161
+ export type DefaultForamt = {
162
+ date: string,
163
+ month: string,
164
+ datetime: string,
165
+ time: string,
166
+ year: string
167
+ }
168
+
169
+ export type FormatType = "date" | "month" | "datetime" | "time" | "year"
170
+
171
+ /**
172
+ * 日期格式化 结束
173
+ */
174
+
175
+ // 获取字典配置接口
176
+ export interface IGetDictConfig {
177
+ (): DictConfig
178
+ }
179
+
180
+ // 通过key获取对应字典配置接口
181
+ export interface IGetDictConfigByKey {
182
+ (string): any
183
+ }
184
+
185
+ // 判断是否是日期接口
186
+ export interface IIsDate {
187
+ (string): boolean
188
+ }
189
+
190
+ // 格式化日期接口
191
+ export interface IFormatDate {
192
+ (date: Date|string|number, format: string, defaultVal?:string): string
193
+ }
194
+
195
+
196
+ // 通过code获取字典数据接口
197
+ export interface IGetLabelByCode {
198
+ (val: string | number, type: string, defaultVal?: string | number): Promise<string | number>
199
+ }
200
+
201
+ export interface IGetLabelByCodeFilter {
202
+ (val: string | number, type: string, defaultVal?: string | number): string | number | undefined
203
+ }
204
+
205
+ export type Format = { label: string | number; value: string | number }
206
+
207
+ export type GetLabelByCodesOptions = {
208
+ defaultVal?: string | number,
209
+ formatFun?: (arr: object[], format: Format) => string|number,
210
+ spacer?: string
211
+ }
212
+
213
+ // 通过多个code获取多个label
214
+ export interface IGetLabelByCodes {
215
+ (vals: string | (string | number)[], type: string, options?: GetLabelByCodesOptions): Promise<string|number>
216
+ }
217
+
218
+ export interface IGetLabelByCodesFilter {
219
+ (vals: string | (string | number)[], type: string, options?: GetLabelByCodesOptions): string | number | undefined
220
+ }
221
+
222
+
223
+ export interface IGetCodeByLabel {
224
+ (val: string | number, type: string, defaultVal?: string | number): Promise<string | number>
225
+ }
226
+
227
+ export interface IGetCodeByLabelFilter {
228
+ (val: string | number, type: string, defaultVal?: string | number): string | number | undefined
229
+ }
230
+
231
+
232
+ export type GetCodeByLabelsOptions = GetLabelByCodesOptions
233
+ export interface IGetCodeByLabels {
234
+ (vals: string | (string | number)[], type: string, options?: GetCodeByLabelsOptions): Promise<string|number>
235
+ }
236
+
237
+ export interface IGetCodeByLabelsFilter {
238
+ (vals: string | (string | number)[], type: string, options?: GetCodeByLabelsOptions): string|number|undefined
239
+ }
240
+
241
+ export interface IGetDictObjByDictTypes {
242
+ (dictTypes: string | string[]): Promise<object>
243
+ }
244
+
245
+ export interface IListToTree {
246
+ (data: object[], config?: OptionalTreeSetting, parentObj?:{ [key: string]: any }): object[]
247
+ }
248
+
249
+ export interface IGetTreeItemByCode {
250
+ (id: string | number, arr: {[key: string]: any}[], options: GetTreeItemByCodeOptions): object[]
251
+ }
252
+
253
+ export interface IGetTreeItemByLabel {
254
+ (label: string | number, arr: {[key: string]: any}[], options: GetTreeItemByLabelOptions): object[]
255
+ }
256
+
257
+ export interface IMask {
258
+ (str: string, paramsOptions: OptionalMaskOptions): string
259
+ }
260
+
261
+ export interface IMaskName {
262
+ (name: string, symbol:string): string
263
+ }
264
+
265
+ export interface IMaskIdCard {
266
+ (idcard: string, symbol: string): string
267
+ }
268
+
269
+ export interface IMaskPhone {
270
+ (phone: string | number, symbol: string): string
271
+ }
272
+
273
+ export interface IMaskAddress {
274
+ (address: string, symbol: string): string
275
+ }
276
+
277
+ export type MaskTypeObj = {
278
+ mobile: IMaskPhone
279
+ name: IMaskName
280
+ address: IMaskAddress
281
+ idCard: IMaskIdCard
282
+ }
283
+
284
+ export interface IDesensitization {
285
+ (str: string, options: OptionalDesensitizationOptions): string
286
+ }
287
+
288
+ export interface IFormatFun {
289
+ (arr: any, treeSetting: TreeSetting): string|number
290
+ }
291
+ export type GetTreeLabelByCodeOptions = {
292
+ defaultVal?: string | number,
293
+ formatFun?: IFormatFun,
294
+ treeSetting?: OptionalTreeSetting
295
+ }
296
+ export interface IGetTreeLabelByCode {
297
+ (val: string, type: string, options?:GetTreeLabelByCodeOptions): Promise<string|number>
298
+ }
299
+
300
+ export interface IGetTreeLabelByCodeFilter {
301
+ (val: string, type: string, options?:GetTreeLabelByCodeOptions): string | number | undefined
302
+ }
303
+
304
+ export interface IFormatFunIn {
305
+ (arr: any, treeSetting: TreeSetting): string
306
+ }
307
+
308
+ export interface IFormatFunOut {
309
+ (arr: any, treeSetting: TreeSetting): string
310
+ }
311
+
312
+ export type GetTreeLabelByCodesOptions = {
313
+ defaultVal?: string | number,
314
+ formatFunIn?: IFormatFunIn,
315
+ treeSetting?: OptionalTreeSetting,
316
+ formatFunOut?: IFormatFunOut,
317
+ spacer?: string
318
+ }
319
+
320
+ export interface IGetTreeLabelByCodes {
321
+ (vals: string[] | string, type: string, options?: GetTreeLabelByCodesOptions): Promise<string|number>
322
+ }
323
+
324
+ export interface IGetTreeLabelByCodesFilter {
325
+ (vals: string[] | string, type: string, options?: GetTreeLabelByCodesOptions): string | number | undefined
326
+ }
327
+
328
+ export type GetTreeCodeByLabelOptions = GetTreeLabelByCodeOptions
329
+ export interface IGetTreeCodeByLabel {
330
+ ( val: string, type: string, options?: GetTreeCodeByLabelOptions): Promise<string | number>
331
+ }
332
+
333
+ export interface IGetTreeCodeByLabelFilter {
334
+ ( val: string, type: string, options?: GetTreeCodeByLabelOptions): string | number | undefined
335
+ }
336
+
337
+ export type GetTreeCodeByLabelsOptions = GetTreeLabelByCodesOptions
338
+ export interface IGetTreeCodeByLabels {
339
+ ( vals: string[] | string, type: string, options?: GetTreeCodeByLabelsOptions): Promise<string|number>
340
+ }
341
+
342
+ export interface IGetTreeCodeByLabelsFilter {
343
+ ( vals: string[] | string, type: string, options?: GetTreeCodeByLabelsOptions): string | number | undefined
344
+ }
345
+
346
+
347
+
348
+ export interface IGetItemByCode {
349
+ (val: string | number, type: string, defaultVal?: string | number): Promise<object | string | number>
350
+ }