cc1-form 1.2.29 → 1.3.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.
@@ -1 +1 @@
1
- (function(B,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("element-plus"),require("vue-router"),require("vue"),require("cc1-vue3")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue-router","vue","cc1-vue3"],h):(B=typeof globalThis<"u"?globalThis:B||self,h(B.cc1Form={},B.ElementPlus,B.VueRouter,B.Vue,B.cc1Vue3))})(this,(function(B,h,Mt,e,K){"use strict";class k{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Add:"Add",Update:"Update",View:"View",Remove:"Remove"};static isFun=(a,...r)=>Array.isArray(a)?a.some(o=>typeof o=="function"?o(...r):o):typeof a=="function"?a(...r):a;static getRouterParams=()=>{const a=this.router.currentRoute.value.query||{},r=this.router.currentRoute.value.params||{};return Object.keys(a).length?a:Object.keys(r).length?r:{}};static moduleObj={};static loadModule=async a=>{if(!k.moduleObj[a])throw new Error(`模块${a}未加载,请赋值如:TSys.moduleObj = { ${a}: ()=>import('${a}') }`);const r=await k.moduleObj[a]();return r.default??r};static tipMessages={};static tipMessagesGap=500;static showMessage(a,r,o={}){const i=Date.now();if(!this.tipMessages[a]||i-this.tipMessages[a]>this.tipMessagesGap){this.tipMessages[a]=i;const l=Object.assign({message:a,type:r},o);h.ElMessage(l),setTimeout(()=>{delete this.tipMessages[a]},this.tipMessagesGap)}}static fail=(a,r={})=>{this.showMessage(a,"error",r)};static success=(a,r={})=>{this.showMessage(a,"success",r)};static loadingObj=null;static loadingTimer=null;static loading=(a=!0,r="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{a?this.loadingObj=h.ElLoading.service({lock:!0,text:r,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(a,r=!0)=>{if(r){let o=screen.width/2-500,i=screen.height/2-800/2-30;window.open(a,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+i+", left="+o)}else window.open(a,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=a=>new Promise(async(r,o)=>{let i=document.getElementById(a.id);const l=await k.loadModule("html2canvas");try{l(i,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:a.windowWidth,height:a.windowHeight,windowWidth:a.windowWidth,windowHeight:a.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(n){let d=n.toDataURL("image/png");r(d)})}catch(n){o(n)}})}class C{static config={field:{page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"}},dialog:{width:"980px",closeOnClickModal:!1},pagination:{layout:"total, sizes, prev, pager, next, jumper",pageSizes:[10,20,50,100],size:10,pagerCount:7,showTools:!1},size:{table:"default",form:"default",search:"default"},tools:{expandColumn:!1,refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,dropdown:{show:!0,select:!0,page:!0,all:!0},fileName:"Export Data "}},form:{size:"default",labelWidth:"120px",stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{index:!1,labelWidth:"100px",size:"default",emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0},fitHeight:!0},columnConfig:{type:"input",form:{width:"100%",spanCol:!1},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},disabled:{view:!0},options:{switch:{activeValue:!0,inactiveValue:!1,tableConfig:{change:!0,confirm:!0,loadList:!0}},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=a=>{C.config=ObjectUtil.deepMerge(C.config,a)}}class N{static customComponent={};static error={};static findOptions=(a,r)=>{const o=a.column.find(l=>l.key===r),i=l=>l.replace(/-([a-z])/g,(n,d)=>d.toUpperCase());if(o)return o.options[i(o.type)]};static setOptionsData=(a,r,o)=>{const i=N.findOptions(a,r);i&&(i.data=o)};static form={openBefore:{parentId:(a,r,o,i)=>{const l=C.config.table.rowKey;a?r.type===k.EDialog.Add?(r.form.parentId=a[l],r.form.sort=a.children.length+1):r.form.parentId=a.parentId.substring(a.parentId.lastIndexOf(",")+1):(r.form.parentId="0",r.form.sort=o.length+1),N.setOptionsData(i,"parentId",[{[l]:"0",title:"根",children:o}])}}}}class F{static getIdFun=()=>StrUtil.uuid();static setId=(a,r,o)=>{r[a]||(r[a]=[]);const i=C.config.table.rowKey;r[a].forEach(l=>{o.forEach(n=>{let d=n.default??"";n.type==="number"&&(d=n.default??0),n.type==="boolean"&&(d=n.default??!1),n.type==="time"&&(d=n.default??new Date),l[n.value]===void 0&&(l[n.value]=d)}),l[i]||(l[i]=F.getIdFun())})};static add=(a,r,o,i)=>{const l=JSONUtil.cp(o);F.setId(a,r,o);const n=C.config.table.rowKey;r[a].push(l.reduce((d,c)=>{let f=c.default??"";return c.type==="number"&&(f=c.default??0),c.type==="boolean"&&(f=c.default??!1),c.type==="time"&&(f=c.default??new Date),d[c.value]=f,d},{[n]:F.getIdFun()})),i?.(r)};static remove=(a,r,o,i)=>{const l=C.config.table.rowKey;r[a]=r[a].filter(n=>n[l]!==o[l]),i?.(r)};static getNoIdData=(a,r)=>{const o=JSONUtil.cp(a),i=C.config.table.rowKey;return o.forEach(l=>{l[i]&&delete l[i],r&&l[r]&&F.getNoIdData(l[r],r)}),o}}const le={key:0,class:"column curd-form-com-list",style:{width:"100%",gap:"10px"}},re={key:0},ie={class:"row items-center",style:{gap:"10px",width:"100%"}},de={key:1},I=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""},addBottom:{default:!1}},emits:["change"],setup(t,{emit:a}){const r=t,o=e.reactive({show:!1,add:(l,n,d)=>{F.add(l,n,d,()=>{i("change")})},remove:(l,n,d)=>{F.remove(l,n,d,()=>{i("change")})}});e.onMounted(()=>{F.setId(r.field,r.row,r.itemFields),o.show=!0});const i=a;return(l,n)=>{const d=e.resolveComponent("el-button"),c=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",le,[e.renderSlot(l.$slots,"list-start",{row:t.row}),t.addBottom?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(d,{link:"",type:"primary",onClick:n[0]||(n[0]=f=>o.add(t.field,t.row,t.itemFields))},{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("添加",-1)])]),_:1})])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.row[t.field],f=>(e.openBlock(),e.createElementBlock("div",ie,[e.renderSlot(l.$slots,"item-start",{item:f,row:t.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.itemFields,s=>(e.openBlock(),e.createBlock(c,{modelValue:f[s.value],"onUpdate:modelValue":u=>f[s.value]=u,style:e.normalizeStyle({width:t.inputWidth}),class:e.normalizeClass(t.inputClass),placeholder:s[t.label]||s[t.value],onChange:n[1]||(n[1]=u=>i("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(l.$slots,"item-end",{item:f,row:t.row}),e.createVNode(d,{link:"",type:"danger",onClick:s=>o.remove(t.field,t.row,f)},{default:e.withCtx(()=>[...n[4]||(n[4]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),t.addBottom?(e.openBlock(),e.createElementBlock("div",de,[e.createVNode(d,{link:"",type:"primary",onClick:n[2]||(n[2]=f=>o.add(t.field,t.row,t.itemFields))},{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode("添加",-1)])]),_:1})])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"list-end",{row:t.row})])):e.createCommentVNode("",!0)}}}),ce={class:"row form-item-content",style:{width:"100%"}},se={class:"col column form-item-content-item"},fe={class:"col"},me=["innerHTML"],ge=e.defineComponent({__name:"field",props:{item:{},form:{},type:{},labelWidth:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(t){return(a,r)=>(e.openBlock(),e.createBlock(e.unref(h.ElFormItem),{label:t.item.text?.form?.label??t.item.label,prop:t.item.key,"label-width":t.item.text?.form?.label==""?0:t.item.form?.labelWidth||t.labelWidth},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[e.renderSlot(a.$slots,"form-"+t.item.key+"-start",{row:t.form,item:t.item}),e.createElementVNode("div",se,[e.createElementVNode("div",fe,[e.renderSlot(a.$slots,"form-"+t.item.key,{row:t.form,item:t.item},()=>[t.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:0,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[0]||(r[0]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),e.createSlots({_:2},[t.getBind(t.item).prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof t.getBind(t.item).prepend=="function"?t.getBind(t.item).prepend(t.form):t.getBind(t.item).prepend),1)]),key:"0"}:void 0]),1040,["modelValue","disabled"])):t.item.type==="number"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:1,type:"number",modelValue:t.form[t.item.key],"onUpdate:modelValue":r[1]||(r[1]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="textarea"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:2,type:"textarea",modelValue:t.form[t.item.key],"onUpdate:modelValue":r[2]||(r[2]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(h.ElSwitch),e.mergeProps({key:3,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[3]||(r[3]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:4,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[4]||(r[4]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElOption),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(h.ElRadioGroup),e.mergeProps({key:5,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[5]||(r[5]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[t.getBind(t.item).type==="group"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElRadioButton),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElRadio),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="checkbox"?(e.openBlock(),e.createBlock(e.unref(h.ElCheckboxGroup),e.mergeProps({key:6,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[6]||(r[6]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[t.getBind(t.item).type==="group"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElCheckboxButton),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElCheckbox),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="color"?(e.openBlock(),e.createBlock(e.unref(h.ElColorPicker),e.mergeProps({key:7,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[7]||(r[7]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="slider"?(e.openBlock(),e.createBlock(e.unref(h.ElSlider),e.mergeProps({key:8,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[8]||(r[8]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="list"?(e.openBlock(),e.createBlock(I,e.mergeProps({key:9,row:t.form,field:t.item.key},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):t.item.type==="treeSelect"?(e.openBlock(),e.createBlock(e.unref(h.ElTreeSelect),e.mergeProps({key:10,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[9]||(r[9]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):t.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(h.ElDatePicker),e.mergeProps({key:11,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[10]||(r[10]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&typeof t.item.type=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.item.type),e.mergeProps({key:12,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[11]||(r[11]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&(e.unref(N).customComponent[t.item.type]||e.unref(N).customComponent[t.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(N).customComponent[t.item.type]?.form||e.unref(N).customComponent[t.item.type]),e.mergeProps({key:13,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[12]||(r[12]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(a.$slots,"form-"+t.item.key+"-right",{row:t.form,item:t.item})]),e.renderSlot(a.$slots,"form-"+t.item.key+"-tip",{row:t.form,item:t.item},()=>[t.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-tip-text",innerHTML:typeof t.item.form?.tipText=="function"?t.item.form?.tipText(t.form,t.type):t.item.form?.tipText},null,8,me)):e.createCommentVNode("",!0)])]),e.renderSlot(a.$slots,"form-"+t.item.key+"-end",{row:t.form,item:t.item})])]),_:3},8,["label","prop","label-width"]))}});function Tt(t){return t}const he={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",deleteTitle:"删除提示",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"部分内容未输入或输入错误,请检查",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?",mergeColumn:"合并栏位",expandColumn:"展开栏位"};class p{static t(a,...r){if(typeof a=="function")return a(...r);a=String(a);let o=0;return a.replace(/{([^}]+)}/g,(i,l)=>o<r.length?String(r[o++]):`{${l}}`)}static setI18n=a=>{p.curd=ObjectUtil.deepMerge(p.curd,a)};static tCurd(a,...r){return this.t(this.curd[a],...r)}static curd=he}class ${static delAllKey=a=>{Object.keys(a).forEach(r=>{delete a[r]})};static setValue=(a,r,o=!1)=>{o&&$.delAllKey(a),Object.keys(r).forEach(i=>{a[i]!==r[i]&&(a[i]=r[i])})}}const R=t=>{const a=e.reactive({}),r=()=>typeof t=="function"?t():t,o=()=>{const i=r();return i??a};return{internal:a,isExternal:()=>r()!=null,get(){return o()},set(i){$.setValue(o(),i,!0)},merge(i){$.setValue(o(),i,!1)},clear(){$.delAllKey(o())}}},A=k.EDialog,M=t=>typeof t.type=="object"?"component":t.type||"input",pe=(t,a,r)=>{const o=R(()=>a.form);return{update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:A.Update,get form(){return o.get()},set form(i){o.set(i)},formDefault:{},formColumn:[],formGrid:[],formMaxSpan:12,getDisabled:(i,l=!1)=>{const n=t();return a.option.table?.editMode&&l?i.disabled?.table===void 0?!1:k.isFun(i.disabled?.table,n.update.form):W(i,n.update.type,n.update.form)},getBind:i=>{const l=t();return P(i,l.update.type)},getOn:(i,l)=>{const n=t();return J(i,n.update.type,[l||n.update.form,i])},getOptions:i=>{const l=t();try{const d=X(l.update.formGrid?.length?l.update.formGrid:l.update.formColumn).find(c=>c.item.key===i)?.item;return d?{options:d.options,bind:l.update.getBind(d)}:{options:{},bind:{}}}catch{return{options:{},bind:{}}}},edit:{data:{},getApiData:i=>{const l=t();if(a.option.form?.editAll)return i;const n={[a.option.table?.rowKey]:l.update.edit.data[a.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(d=>{i[d]!==l.update.edit.data[d]&&(n[d]=i[d])}),n}},view:{},openLoading:!1,open:async(i,l)=>{const n=t();if(!(n.update.showContent||n.update.openLoading)){k.loading(!0),n.update.openLoading=!0;try{n.update.type=i;const d=i===A.Add;n.update.edit.data=d?void 0:JSONUtil.cp(l),n.update.title=p.tCurd(d?"add":i===A.View?"view":"edit");const c=d?ObjectUtil.deepMerge(JSONUtil.cp(n.update.formDefault),l?JSONUtil.cp(l):{}):JSONUtil.cp(l);$.setValue(n.update.form,c,!0),await n.initApiData("update"),await a.option.form?.openBefore?.(n.update.form,n.update),(!a.option.table?.inlineEdit||d)&&(n.update.show=!0,n.update.showContent=!0),a.option.form?.openAfter?.(n.update.form,n.update)}catch(d){console.error(d)}finally{k.loading(!1),n.update.openLoading=!1}}},validate:async()=>{const i=t();try{return await Promise.all([r.ruleFormRef.value?.validate(async l=>new Promise((n,d)=>{l||d(!1),n(void 0)})),i.formRef.validate()]),!0}catch{k.fail(p.tCurd("checkFormData"))}},submit:async()=>{const i=t();if(!await i.update.validate()||i.update.loading)return;i.update.loading=!0;const n=i.update.type===A.Add?a.option.api.create:a.option.api.update;try{await a.option.form?.submitBefore?.(i.update.form,i.update)}catch{i.update.loading=!1;return}let d=ObjectUtil.deepMerge(i.update.form,{});delete d.children;const c=new Set(a.option.column.filter(f=>f.type==="datetime").map(f=>f.key));Object.keys(d).forEach(f=>{if(c.has(f)&&d[f]!=null){const s=new Date(d[f]).getTime();isNaN(s)||(d[f]=s)}});try{if(!n)return;await n({...d}),i.update.close(),await i.table.getList(),a.option.form?.submitAfter?.(d,i.update)}catch(f){console.error(f)}finally{i.update.loading=!1}},close:()=>{const i=t();i.update.show=!1,i.update.edit.data=void 0,setTimeout(()=>{i.update.showContent=!1,r.ruleFormRef.value?.resetFields?.(),o.clear()},350)}}}},D=12,H=(t,a)=>{t.isForm=a,Array.isArray(t.children)&&t.children.forEach(r=>H(r,a))},ue=t=>t.isForm===!1?!1:typeof t.show?.form=="boolean"?t.show.form:!0,ye=(t,a,r)=>(t.form=t.form||{span:a},r==="column"?t.form.span=t.form.span??12:t.form.span=t.form.span??a,t.form.span),G=t=>{const a=t.form;return a?.row!=null&&a.row>0?a.row:D},U=t=>Math.floor((t.gridRow-1)/D),W=(t,a,r)=>{if(a===k.EDialog.View)return t.disabled?.view===void 0?!0:k.isFun(t.disabled?.view,r);const o=t.disabled?.[a===k.EDialog.Add?"create":"update"];return k.isFun(o,r)},P=(t,a)=>{const r=M(t);return t.options?.[a===k.EDialog.Add?"formAdd":"formUpdate"]?.[r]||t.options?.[r]||{}},J=(t,a,r=[])=>{const o=M(t),l=t.options?.[a===k.EDialog.Add?"formAdd":"formUpdate"]?.[o]?.on||t.options?.[o]?.on||{},n={};return Object.keys(l).forEach(d=>{const c=l[d];typeof c=="function"?n[d]=function(...f){return c.apply(this,[...f,...r])}:n[d]=c}),n},q=(t,a,r,o,i)=>{const l=t,n=l.colSpan??t.span;if(!t.item.form?.spanCol)return n;const d=i?.maxSpan||12,c=i?.defaultSpan||d/2,f=l.gridBand,u=a.filter(g=>f!=null?g.gridBand===f&&!k.isFun(g.item.show?.form,r,o):g.gridRow===l.gridRow&&!k.isFun(g.item.show?.form,r,o)).reduce((g,m)=>g+(m.colSpan??m.span??c),0);return n+u},Q=t=>{const a=new Map;return t.forEach(r=>{const o=r.gridBand??U(r);a.has(o)||a.set(o,[]),a.get(o).push(r)}),Array.from(a.keys()).sort((r,o)=>r-o).map(r=>a.get(r))},X=t=>t?.length?Array.isArray(t[0])?t.flat():t:[],be=(t,a)=>{if(!ue(t)||!t.key)return null;const r=a.defaultSpan??(a.maxSpan||12)/2,o=ye(t,r,a.layout);return{item:t,span:o}},ke=(t,a={})=>{const r=[],o=i=>{if(i.children?.length){i.children.forEach(n=>o(n));return}const l=be(i,a);l&&r.push(l)};return t.forEach(i=>o(i)),r},Y=(t,a={})=>{const r=a.maxSpan??12,o=a.defaultSpan??r/2,i=a.layout??"row",n=ke(t,{maxSpan:r,defaultSpan:o,layout:i});if(i==="column"){const b=[];let w=1;return n.forEach(V=>{const S=G(V.item),x=r;b.push({...V,span:x,colSpan:x,rowSpan:S,gridRow:w,gridColumn:1,gridBand:U({gridRow:w})}),w+=S}),{cells:b,maxSpan:r}}const d=new Set,c=[];let f=0,s=0;const u=b=>Math.floor(b/D)*D,g=(b,w)=>`${b},${w}`,m=(b,w,V,S)=>{if(w+V>r)return!1;for(let x=0;x<S;x++)for(let E=0;E<V;E++)if(d.has(g(b+x,w+E)))return!1;return!0},y=(b,w,V,S)=>{for(let x=0;x<S;x++)for(let E=0;E<V;E++)d.add(g(b+x,w+E))},z=(b,w,V,S)=>{for(let E=u(b);E<500*D;E+=D){const Ft=E+D,$t=E===u(b)?Math.max(E,b):E;for(let L=$t;L<Ft;L++){const Ot=L===b?w:0;for(let j=Ot;j<=r-V;j++)if(m(L,j,V,S))return{tr:L,tc:j}}}return{tr:b,tc:w}},O=(b,w,V,S)=>{const x=u(b);if(S<D&&b+S<x+D){f=b+S,s=w;return}const E=w+V;if(E<r){s=E,f=x;return}s=0,f=x+D};for(const b of n){const w=b.span===0?r:b.span,V=G(b.item);b.item.form?.rowBreak&&c.length&&(s=0,f=u(f)+D);let{tr:S,tc:x}=m(f,s,w,V)?{tr:f,tc:s}:z(f,s,w,V);m(S,x,w,V)||({tr:S,tc:x}=z(0,0,w,V)),y(S,x,w,V);const E=S+1;c.push({...b,span:w,colSpan:w,rowSpan:V,gridRow:E,gridColumn:x+1,gridBand:U({gridRow:E})}),O(S,x,w,V)}return{cells:c,maxSpan:r}},we=t=>t.map(a=>a.item?.show?.form),Ce=(t,a,r)=>{if(!t.rules)return;const o=typeof t.rules=="boolean"?[{required:!0,message:a(t),trigger:"blur"}]:t.rules;return r?o.map(i=>r(i)):o},Z=t=>(a,r)=>Ce(a,t,o=>{if(o.validator){const i=o.validator;return{...o,validator:(l,n,d)=>i(l,n,d,r)}}return o}),Be=t=>Z(a=>{const r={input:p.tCurd("placeholderInput"),select:p.tCurd("placeholderSelect")},o=(r[M(a)||"input"]||r.input)+a.label;return(t?.error||N.error.callback)?.(a.key,a)||o}),Ve=(t,a,r)=>{const o={},i={},l=a?.maxSpan||12,n=a?.defaultSpan||l/2,d=Be(a);t.forEach(s=>H(s,!0)),v(t,o,i,s=>d(s,r));const{cells:c,maxSpan:f}=Y(t,{maxSpan:l,defaultSpan:n,layout:a?.layout});return{formDefault:o,rules:i,formGrid:c,formMaxSpan:f,formColumn:Q(c)}},v=(t,a,r,o)=>{const i=l=>{if(l.children?.length){l.children.forEach(n=>i(n));return}if(l.key){a[l.key]=l.value;const n=o(l);n&&(r[l.key]=n)}};t.forEach(i)},xe={class:"curd-form-cell-inner"},_=e.defineComponent({__name:"layout",props:{formGrid:{},maxSpan:{},form:{},type:{},stripe:{type:Boolean},labelWidth:{},formOption:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(t){const a=k.isFun,r=t,o=e.computed(()=>r.formGrid.filter(g=>a(g.item.show?.form,r.form,r.type))),i=e.computed(()=>{const g=Array.from(new Set(o.value.map(m=>m.gridBand??U(m)))).sort((m,y)=>m-y);return new Map(g.map((m,y)=>[m,y]))}),l=e.computed(()=>({gridTemplateColumns:`repeat(${r.maxSpan}, minmax(0, 1fr))`})),n=e.computed(()=>{let g=0;return o.value.forEach(m=>{const y=m.gridRow+m.rowSpan-1;y>g&&(g=y)}),g}),d=g=>g.gridRow+g.rowSpan-1>=n.value,c=g=>g.rowSpan>=D,f=g=>{const m=g.gridBand??U(g);return i.value.get(m)??m},s=g=>q(g,r.formGrid,r.form,r.type,{maxSpan:r.maxSpan,defaultSpan:r.formOption?.defaultSpan}),u=g=>{const m=s(g)||g.colSpan;return{gridRow:`${g.gridRow} / span ${g.rowSpan}`,gridColumn:`${g.gridColumn} / span ${m}`}};return(g,m)=>e.unref(a)(e.unref(we)(t.formGrid),t.form,t.type)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(g.$slots,"form-start",{row:t.form}),e.createElementVNode("div",{class:e.normalizeClass(["curd-form-grid",{stripe:t.stripe!==!1}]),style:e.normalizeStyle(l.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y.item.key,class:e.normalizeClass(["curd-form-grid-cell",[t.stripe!==!1&&f(y)%2===0?"stripe-band-odd":"",y.gridColumn>1?"has-col-border":"",t.stripe!==!1&&d(y)?"is-last-row":"",c(y)?"is-row-span":"",`form-item-col-${y.item.key}`]]),style:e.normalizeStyle(u(y))},[e.createElementVNode("div",xe,[e.unref(a)(y.item.show?.form,t.form,t.type)?(e.openBlock(),e.createBlock(ge,{key:0,class:e.normalizeClass({"is-row-span-field":c(y)}),item:y.item,form:t.form,type:t.type,"label-width":t.labelWidth,"get-bind":t.getBind,"get-on":t.getOn,"get-disabled":t.getDisabled},e.createSlots({_:2},[e.renderList(g.$slots,(z,O)=>({name:O,fn:e.withCtx(b=>[e.renderSlot(g.$slots,O,e.mergeProps({ref_for:!0},b||{}))])}))]),1032,["class","item","form","type","label-width","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)])],6))),128))],6),e.renderSlot(g.$slots,"form-end",{row:t.form})],64)):e.createCommentVNode("",!0)}}),ee=e.defineComponent({__name:"column",props:{option:{default:()=>({form:{},column:[]})},type:{default:""},form:{default:void 0}},setup(t,{expose:a}){const r=k.EDialog,o=e.ref(),i=t;let l=R(i.form);const n=K.Scope.getConf();n?.formRef?.set("formRef-"+StrUtil.getId(),o);const d=e.reactive({rules:{},show:!0,formDefault:{},type:i.type||n?.update?.type||r.Add,formColumn:[],formGrid:[],formMaxSpan:12,get form(){return l.get()},set form(c){l.set(c)},getDisabled:c=>W(c,d.type,d.form),getBind:c=>P(c,d.type),getOn:c=>J(c,d.type,[d.form,c]),initColumnForm:()=>{const c=l,f=Ve(i.option.column,i.option.form,c.get());d.formDefault=f.formDefault,d.rules=f.rules,d.formGrid=f.formGrid,d.formMaxSpan=f.formMaxSpan,d.formColumn=f.formColumn,d.type===r.Add?c.isExternal()?c.merge(JSONUtil.cp(d.formDefault)):c.set(JSONUtil.cp(d.formDefault)):!c.isExternal()&&i.form&&c.set(JSONUtil.cp(i.form))}});return i.option.form?.initStart?.(d),d.initColumnForm(),i.option.form?.initEnd?.(d),e.watch(()=>i.form,c=>{l=R(c),d.initColumnForm()}),a({ref:o,conf:d}),(c,f)=>(e.openBlock(),e.createBlock(e.unref(h.ElForm),{ref_key:"ruleFormRef",ref:o,model:d.form,rules:d.rules},{default:e.withCtx(()=>[d.show?(e.openBlock(),e.createBlock(_,{key:0,"form-grid":d.formGrid,"max-span":d.formMaxSpan,form:d.form,type:d.type,stripe:t.option.form?.stripe,"label-width":t.option.form?.labelWidth||"100px","form-option":t.option.form,"get-bind":d.getBind,"get-on":d.getOn,"get-disabled":d.getDisabled},e.createSlots({_:2},[e.renderList(c.$slots,(s,u)=>({name:u,fn:e.withCtx(g=>[e.renderSlot(c.$slots,u,e.normalizeProps(e.guardReactiveProps(g||{})))])}))]),1032,["form-grid","max-span","form","type","stripe","label-width","form-option","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}}),Ee=()=>({formRef:{map:{},set(t,a){this.map[t]=a},validate(){return new Promise(async(t,a)=>{try{const r=Object.keys(this.map);await Promise.all(r.map(o=>this.map[o]?.validate(async i=>new Promise((l,n)=>{i||n(!1),l(!0)})))),t(!0)}catch(r){a(r)}})}}}),Se=(t,a)=>{const r=R(()=>a.searchForm);return{search:{column:{list:[]},get form(){return r.get()},set form(o){r.set(o)},formDefault:{},getPlaceholder:(o,i=p.tCurd("placeholderInput"))=>o.text?.search?.placeholder===void 0?`${i}${o.label}`:o.text?.search?.placeholder,getFormData:()=>{const o=t();let i={};a.option.column.forEach(n=>{(typeof n.show?.search=="function"?n.show?.search(o.search.form):n.show?.search)&&(i[n.key]=o.search.form[n.key])});const l=a.option.search?.before?.(i);return l&&(i=l),i},reset:()=>{const o=t(),i=o.search.formDefault;Object.keys(i).forEach(n=>{a.option.search?.resetMode==="none"?i[n]=void 0:i[n]=o.search.formDefault[n]});const l=ObjectUtil.deepMerge(i,{});$.setValue(o.search.form,l,!0),o.page.num=1,a.option.init!==!1&&o.table.getList()},submit:()=>{const o=t();o.page.num=1,o.table.getList()}}}},Ne=(t,a)=>({page:{num:1,total:0,layout:a.option.page?.layout||C.config.pagination.layout,showTools:a.option.page?.showTools||C.config.pagination.showTools,size:a.option.page?.size||C.config.pagination.size,sizeList:a.option.page?.sizeList||C.config.pagination.pageSizes,pagerCount:a.option.page?.pagerCount||C.config.pagination.pagerCount,getQuery:(r={})=>{const o=t();return{[C.config.field.page.size]:r.size||o.page.size,[C.config.field.page.num]:r.num||o.page.num,...o.search.getFormData()}}}}),De=(t,a,r)=>({table:{op:{width:(...o)=>o.filter(l=>l).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(o,i)=>{},all:()=>{const o=t();if(o.table.expand.isExpand)o.table.expand.rowKeys=[];else{const i=l=>{let n=[];return l.forEach(d=>{n.push(d[a.option.table.rowKey]),d.children?.length&&(n=n.concat(i(d.children)))}),n};o.table.expand.rowKeys=i(o.table.data)}o.table.expand.isExpand=!o.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},header:{group:{expand:!1,toggleExpandAll:()=>{const o=t(),i=!o.table.header.group.expand;o.table.header.group.expand=i;const l=n=>{n.forEach(d=>{d.table?.header?.group!==void 0&&(d.table.header.group=!i),d.table?.header?.groupKey!==void 0&&(d.table.header.show=i),Array.isArray(d.children)&&d.children.length&&l(d.children)})};l(o.table.column.list)}}},getList:async()=>{const o=t();o.table.loading=!0;const i=a.option.api.list,l=JSONUtil.cp(o.table.selection.list);try{await o.initApiData("init");let n={};if(o.table.sort.prop){const{props:y,order:z}=C.config.table.sort;n={[y.field]:o.table.sort.prop,[z.field]:o.table.sort.order}}const d=await i({...o.page.getQuery(),...n}),c=C.config.field.result,f=d.data||{[c.list]:d},s=(Array.isArray(f[c.list]),f[c.list]),u=X(o.update.formGrid?.length?o.update.formGrid:o.update.formColumn),m=ObjectUtil.deepMerge({data:s},{}).data.map(y=>(Object.keys(y).forEach(O=>{const b=u.find(w=>w.item.key===O);b&&["select","radio"].includes(b.item.type)&&(b.item.table.format||(b.item.table.format=w=>b.item.options[b.item.type].data?.find(V=>V.value==w[O])?.label||w[O]))}),y));o.table.data=a.option.data?await a.option.data(m,s):m,o.page.total=f[c.total]||0,setTimeout(()=>{o.table.selection.setList(l)},20)}catch(n){console.error(n)}finally{o.table.loading=!1}},selection:{list:[],change:o=>{t().table.selection.list=o},setList:(o,i)=>{const l=t();l.table.selection.list=[];const n=r.tableRef.value;if(n?.clearSelection(),!n||!o?.length)return;const d=a.option.table?.rowKey,c=f=>{const s=u=>{for(const g of u){if(d!=null&&d!==""){if(g[d]===f[d])return g}else if(g===f)return g;if(Array.isArray(g.children)&&g.children.length){const m=s(g.children);if(m!==void 0)return m}}};return s(l.table.data)};o.forEach(f=>{const s=c(f);if(s)if(i){const u=()=>n.toggleRowSelection(s,!0,!1);i(f)!==!1&&u()}else n.toggleRowSelection(s,!0,!1)})}},sort:{prop:"",order:"",change:o=>{const i=t();C.config.table.sort.resetPage&&(i.page.num=1);const l=C.config.table.sort;if(l.change){l.change(o,i);return}i.table.sort.prop=o.prop,o.order===null?(i.table.sort.order="",i.table.sort.prop=""):i.table.sort.order=o.order==="ascending"?l.order.asc:l.order.desc,i.table.getList()}}}});class te{static exportToExcel=async(a,r,o)=>{if(!a||a.length===0)return;const i=await k.loadModule("xlsx"),l=a.map(c=>{const f={};return r.forEach(s=>{f[s.label]=c[s.key]}),f}),n=i.utils.json_to_sheet(l),d=i.utils.book_new();i.utils.book_append_sheet(d,n,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,i.writeFile(d,`${o}.xlsx`)}}const ze=(t,a)=>({export:{run:{start:async r=>{let i=await t().export.run[r]();const l=a.option.column,n=ObjectUtil.deepMerge({data:i,columns:l},{}),d=a.option.tools?.export||{};d.before?.(n),te.exportToExcel(n.data,n.columns,d.fileName)},select:async()=>{const r=t();r.export.loading=!0;try{if(a.option.tools?.export?.select){await a.option.tools.export.select({...r.page.getQuery(),items:r.table.selection.list});return}if(r.table.selection.list.length===0)throw k.fail(p.tCurd("selectDataToExport")),new Error(p.tCurd("selectDataToExport"));return r.table.selection.list}catch(o){console.error(o)}finally{r.export.loading=!1}},page:async()=>{const r=t();r.export.loading=!0;try{if(a.option.tools?.export?.page){await a.option.tools.export.page({...r.page.getQuery()});return}if(r.table.data.length===0)throw k.fail(p.tCurd("noData")),new Error(p.tCurd("noData"));return r.table.data}catch(o){console.error(o)}finally{r.export.loading=!1}},all:async()=>{const r=t();r.export.loading=!0;try{if(a.option.tools?.export?.all){await a.option.tools.export.all({...r.page.getQuery()});return}const o=a.option.api.list,i=await o({...r.page.getQuery({size:999999,num:1})});return(i.data||{[C.config.field.result.list]:i})[C.config.field.result.list]}catch(o){console.error(o)}finally{r.export.loading=!1}}},loading:!1,click:r=>{const o=t();o.export.loading||o.export.run.start(r)}}}),Fe=(t,a)=>({remove:{title:p.tCurd("deleteTitle"),show:!1,items:[],loading:!1,close:()=>{t().remove.show=!1},open:r=>{if(r.length===0){k.fail(p.tCurd("selectDataToDelete"));return}const o=t();o.remove.items=r,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{const r=t();r.remove.loading=!0;const o=a.option.api.delete;try{if(!o)return;await o({[a.option.table?.rowKey]:r.remove.items.map(i=>i[a.option.table?.rowKey]),items:r.remove.items}),k.success(p.tCurd("operationSuccess")),r.table.data.length<=1&&r.page.num>1&&(r.page.num-=1),r.remove.close(),await r.table.getList()}catch(i){console.error(i)}finally{r.remove.loading=!1}})}}}),$e=(t,a,r)=>({apiDataMap:{},getColumnSpan:(o,i)=>{const l=t(),n=l.update.formGrid?.length?l.update.formGrid:i||[];return q(o,n,l.update.form,l.update.type,{maxSpan:l.update.formMaxSpan||a.option.form?.maxSpan,defaultSpan:a.option.form?.defaultSpan||C.config.form.defaultSpan})},init:()=>{const o=t();o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},initApiData:async o=>{const i=t(),l=[],n=d=>{if(d.children?.length){d.children.forEach(f=>n(f));return}const c=M(d);if(d.options?.[c]?.dataApi&&d.options?.[c]?.dataApiConfig?.[o]){if(i.apiDataMap[d.key]&&d.options?.[c]?.dataApiConfig?.once)return;const f=(async()=>{try{let s=await d.options?.[c]?.dataApi?.(i.update.form,i.update.type);if(s){const u=d.options?.[c]?.dataPath;!Array.isArray(s)&&u&&(s=ObjectUtil.getPathValue(s,u)),d.options[c].data=s,d.options.search[c].data=s,d.options.search[d.options.search.type??c]||(d.options.search[d.options.search.type??c]={}),d.options.search[d.options.search.type??c].data=s,d.options.formAdd[c].data=s,d.options.formUpdate[c].data=s,i.apiDataMap[d.key]=s}}catch{}})();l.push(f)}};return a.option.column.forEach(d=>n(d)),await Promise.all(l),!0},initCurdConfig:()=>{const o=ObjectUtil.deepMerge(C.config,{});o.table.emptyText=p.tCurd("noData"),a.option.size=a.option.size||{},o.table.size=a.option.size.table||o.size.table,o.form.size=a.option.size.form||o.size.form,o.size.search=a.option.size.search||o.size.search;const i=ObjectUtil.deepMerge(o,a.option||{});Object.keys(i).forEach(l=>{a.option[l]=i[l]})},initColumnOptions:()=>{const o=t();let i=JSONUtil.cp(C.config.columnConfig);i.options=ObjectUtil.deepMerge({switch:{activeText:p.tCurd("switchOn"),inactiveText:p.tCurd("switchOff")}},i.options);const l=n=>{const d=M(n);for(const c in i){if(c==="table"){if(n.table=ObjectUtil.deepMerge(i.table,n.table||{}),n.children){n.children.forEach(s=>l(s));return}}else c==="type"?n.type=n.type||i.type:n[c]=ObjectUtil.deepMerge(i[c],n[c]||{});n.options=n.options||{},n.options[d]=n.options[d]||{},n.options[d].size=a.option.size.form,["search","formAdd","formUpdate"].forEach(s=>{n.options[s]=n.options[s]||ObjectUtil.deepMerge(n.options,{}),n.options[s][d]=n.options[s][d]||{},n.options[s][d].size=s==="search"?a.option.size.search:a.option.size.form}),n.table=ObjectUtil.deepMerge(n.table,n.options[d].table||{})}d==="switch"&&(n.options.switch.tableBeforeChange=async(c,f)=>{const s=n.options?.switch;try{s.tableConfig?.confirm&&await r.switchConfirmRef.value?.open({title:p.tCurd("confirmModify"),content:p.tCurd("confirmSwitchMessage")});try{if(!a.option.api.update&&!s.tableConfig?.api)return;const u=f[a.option.table?.rowKey];s.loadingMap||(s.loadingMap={}),s.loadingMap[u]||(s.loadingMap[u]={loading:!1}),s.loadingMap[u].loading=!0;const g=f[c]===s.activeValue?s.inactiveValue:s.activeValue,m=s.tableConfig?.api?s.tableConfig.api:a.option.api.update;if(!m)return;try{await m({...f,[c]:g},"switch")}catch{return!1}finally{s.loadingMap[u].loading=!1}return k.success(p.tCurd("operationSuccess")),s.tableConfig?.loadList&&(o.table.loading=!0,o.table.getList(),o.table.loading=!1),!0}catch(u){return console.error(u),!1}finally{o.table.loading=!1}}catch{return!1}}),d==="treeSelect"&&(n.options.treeSelect.rowKey=a.option.table?.rowKey,n.options.treeSelect.nodeKey=a.option.table?.rowKey)};a.option.column.forEach(l),a.option.table?.column?.forEach(l)},initColumnForm:()=>{const o=t(),i=a.option;o.update.formColumn=[],o.update.formGrid=[],o.update.formMaxSpan=12,o.table.column.show={list:[],listSource:[]};const l=a.option.form?.maxSpan||12,n=a.option.form?.defaultSpan||l/2,d=Z(g=>{const m={input:p.tCurd("placeholderInput"),select:p.tCurd("placeholderSelect")},y=(m[M(g)||"input"]||m.input)+g.label;return(a.option.form?.error||N.error.callback)?.(g.key,g)||y}),c=g=>{if(g.children){o.table.column.show.list.push(g.key),g.children.forEach(m=>c(m));return}o.update.formDefault[g.key]=g.value,g.table?.table&&(g.show?.table&&o.table.column.show.list.push(g.key),o.table.column.show.listSource.push(g.key))};i.column.forEach(g=>{H(g,!0),c(g)}),a.option.table?.column?.forEach(g=>{H(g,!1),c(g)}),o.search.column.list=i.column.concat(i.table?.column||[]),o.table.column.list=o.search.column.list.filter(g=>g.table?.table),o.search.column.list.sort((g,m)=>g.sort?.search-m.sort?.search),o.table.column.list.sort((g,m)=>g.sort?.table-m.sort?.table),o.update.rules={},v(i.column,o.update.formDefault,o.update.rules,g=>d(g,o.update.form));const f=Y(i.column,{maxSpan:l,defaultSpan:n,layout:a.option.form?.layout});o.update.formGrid=f.cells,o.update.formMaxSpan=f.maxSpan,o.update.formColumn=Q(f.cells);const s=a.option.search?.formDefault;s&&Object.keys(s).forEach(g=>{o.search.formDefault[g]=s[g]}),i.column.forEach(g=>{g.show?.search||(o.search.formDefault[g.key]=void 0)});const u=ObjectUtil.deepMerge(o.search.formDefault,{});$.setValue(o.search.form,u,!0)}}),Oe=t=>{const a=e.ref(),r=e.ref(),o=e.ref(),i={switchConfirmRef:a,ruleFormRef:r,tableRef:o},l=()=>n;let n=e.reactive({...Ee(),option:t.option,...Se(l,t),...Ne(l,t),...De(l,t,i),...ze(l,t),...pe(l,t,i),...Fe(l,t),...$e(l,t,i)});return n.init(),e.onMounted(()=>{t.option.init!==!1&&n.table.getList()}),K.Scope.setConf(n),{conf:n,switchConfirmRef:a,ruleFormRef:r,tableRef:o}},Me={class:"dialog-footer"},Te=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(t,{expose:a}){const r=e.ref(!1),o=e.ref("确认修改"),i=e.ref("确认要修改状态吗?");let l=null,n=null;const d=s=>(s?.title&&(o.value=s.title),s?.content&&(i.value=s.content),r.value=!0,new Promise((u,g)=>{l=u,n=g})),c=()=>{r.value=!1,l?.(!0),l=null,n=null},f=()=>{r.value=!1,n?.(new Error("用户取消操作")),l=null,n=null};return a({open:d}),(s,u)=>{const g=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(h.ElDialog),{modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=m=>r.value=m),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(g,{size:t.size},{default:e.withCtx(()=>[e.createElementVNode("span",Me,[e.createVNode(e.unref(h.ElButton),{onClick:f},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(h.ElButton),{type:"primary",onClick:c},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(i.value),1)]),_:1},8,["modelValue","title"])}}}),Ue=["innerHTML"],Le=e.defineComponent({__name:"text",props:{content:{},value:{}},setup(t){const a=t,r=e.computed(()=>typeof a.content=="function"?a.content(a.value):a.content);return(o,i)=>typeof r.value=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0})):(e.openBlock(),e.createElementBlock("div",{key:1,innerHTML:r.value},null,8,Ue))}}),oe=e.defineComponent({__name:"searchField",props:{item:{},conf:{},type:{}},setup(t){const a=t,r=e.computed({get:()=>a.conf.search.form?.[a.item?.key],set:o=>{a.item?.key!==void 0&&(a.conf.search.form[a.item.key]=o)}});return(o,i)=>e.unref(N).customComponent[t.type??""]?.search?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(N).customComponent[t.type??""]?.search),e.mergeProps({key:0,modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=l=>r.value=l)},t.item.options?.search?.[t.type??""],e.toHandlers(t.item.options?.search?.[t.type??""]?.on||{})),null,16,["modelValue"])):t.type==="input"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:1,modelValue:r.value,"onUpdate:modelValue":i[1]||(i[1]=l=>r.value=l),placeholder:t.conf.search.getPlaceholder(t.item),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.input||t.item.options?.input,e.toHandlers(t.item.options?.search?.input?.on||t.item.options?.input?.on||{})),null,16,["modelValue","placeholder","disabled"])):t.type==="switch"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:2,modelValue:r.value,"onUpdate:modelValue":i[2]||(i[2]=l=>r.value=l),placeholder:t.conf.search.getPlaceholder(t.item,e.unref(p).tCurd("placeholderSelect")),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.switch||t.item.options?.switch,e.toHandlers(t.item.options?.search?.switch?.on||t.item.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:t.item.options?.switch?.activeValue,label:t.item.options?.switch?.activeText,value:t.item.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:t.item.options?.switch?.inactiveValue,label:t.item.options?.switch?.inactiveText,value:t.item.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:1},16,["modelValue","placeholder","disabled"])):t.type==="select"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:3,modelValue:r.value,"onUpdate:modelValue":i[3]||(i[3]=l=>r.value=l),placeholder:t.conf.search.getPlaceholder(t.item,e.unref(p).tCurd("placeholderSelect")),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.select||t.item.options?.select,e.toHandlers(t.item.options?.search?.select?.on||t.item.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.options?.search?.select?.data||t.item.options?.select?.data||[],l=>(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","placeholder","disabled"])):t.type==="radio"?(e.openBlock(),e.createBlock(e.unref(h.ElRadioGroup),e.mergeProps({key:4,modelValue:r.value,"onUpdate:modelValue":i[4]||(i[4]=l=>r.value=l),disabled:t.item.disabled?.search},t.item.options?.search?.radio||t.item.options?.radio,e.toHandlers(t.item.options?.search?.radio?.on||t.item.options?.radio?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.options?.radio?.data,l=>(e.openBlock(),e.createBlock(e.unref(h.ElRadio),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):t.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(h.ElDatePicker),e.mergeProps({key:5,modelValue:r.value,"onUpdate:modelValue":i[5]||(i[5]=l=>r.value=l),disabled:t.item.disabled?.search},t.item.options?.search?.datetime||t.item.options?.datetime,e.toHandlers(t.item.options?.search?.datetime?.on||t.item.options?.datetime?.on||{})),null,16,["modelValue","disabled"])):t.type&&e.unref(N).customComponent[t.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(N).customComponent[t.type]),e.mergeProps({key:6,modelValue:r.value,"onUpdate:modelValue":i[6]||(i[6]=l=>r.value=l)},t.item.options?.search?.[t.type]||t.item.options?.[t.type],e.toHandlers(t.item.options?.search?.[t.type]?.on||t.item.options?.[t.type]?.on||{}),{disabled:t.item.disabled?.search}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}),T=(t,a)=>{const r=t.__vccOpts||t;for(const[o,i]of a)r[o]=i;return r},Re={},Ae={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function He(t,a){return e.openBlock(),e.createElementBlock("svg",Ae,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M482.2 508.4L331.3 389c-3-2.4-7.3-.2-7.3 3.6V478H184V184h204v128c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V144c0-15.5-12.5-28-28-28H144c-15.5 0-28 12.5-28 28v736c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v128H184V546h140v85.4c0 3.8 4.4 6 7.3 3.6l150.9-119.4a4.5 4.5 0 000-7.2zM880 116H596c-15.5 0-28 12.5-28 28v168c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V184h204v294H700v-85.4c0-3.8-4.3-6-7.3-3.6l-151 119.4a4.52 4.52 0 000 7.1l151 119.5c2.9 2.3 7.3.2 7.3-3.6V546h140v294H636V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v168c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V144c0-15.5-12.5-28-28-28z"},null,-1)])])}const je=T(Re,[["render",He]]),Ie={},Ke={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function Ge(t,a){return e.openBlock(),e.createElementBlock("svg",Ke,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M180 176h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zm724 0h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zM785.3 504.3L657.7 403.6a7.23 7.23 0 00-11.7 5.7V476H378v-62.8c0-6-7-9.4-11.7-5.7L238.7 508.3a7.14 7.14 0 000 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h268v62.8c0 6 7 9.4 11.7 5.7l127.5-100.8c3.8-2.9 3.8-8.5.2-11.4z"},null,-1)])])}const We=T(Ie,[["render",Ge]]),Pe={},Je={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function qe(t,a){return e.openBlock(),e.createElementBlock("svg",Je,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)])])}const Qe=T(Pe,[["render",qe]]),Xe={},Ye={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function Ze(t,a){return e.openBlock(),e.createElementBlock("svg",Ye,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)])])}const ve=T(Xe,[["render",Ze]]),_e={},et={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function tt(t,a){return e.openBlock(),e.createElementBlock("svg",et,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-38.4 409.6H326.4a38.4 38.4 0 1 0 0 76.8h147.2v147.2a38.4 38.4 0 0 0 76.8 0V550.4h147.2a38.4 38.4 0 0 0 0-76.8H550.4V326.4a38.4 38.4 0 1 0-76.8 0z"},null,-1)])])}const ot=T(_e,[["render",tt]]),nt={},at={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function lt(t,a){return e.openBlock(),e.createElementBlock("svg",at,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896M288 512a38.4 38.4 0 0 0 38.4 38.4h371.2a38.4 38.4 0 0 0 0-76.8H326.4A38.4 38.4 0 0 0 288 512"},null,-1)])])}const rt=T(nt,[["render",lt]]),it={class:"row flex-center table-header-label inline"},dt={class:"table-header-tooltip"},ct=["innerHTML"],st=["onClick"],ft={key:1},mt=["onClick","innerHTML"],gt=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(t){const a=k.isFun,r=e.getCurrentInstance().type;return(o,i)=>{const l=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnList,n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.key},[t.conf.table.column.show.list.includes(n.key)&&(n.show?.table===void 0||e.unref(a)(n.show?.table,t.conf.table.data))?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.table?.header?.groupKey===void 0||n.table.header.show?(e.openBlock(),e.createBlock(e.unref(h.ElTableColumn),e.mergeProps({key:0,prop:n.key,label:n.label},{ref_for:!0},n.table),{header:e.withCtx(()=>[e.renderSlot(o.$slots,"table-header-"+n.key,{item:n},()=>[e.createElementVNode("div",it,[n.table?.header?.tooltip?(e.openBlock(),e.createBlock(l,{key:0,effect:"dark",placement:"top"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:n.table?.header?.tooltip},null,8,ct)]),default:e.withCtx(()=>[e.createElementVNode("span",dt,[e.createVNode(ve)])]),_:2},1024)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label)+" ",1),n.table?.header?.group!==void 0?(e.openBlock(),e.createElementBlock("span",{key:1,class:"table-header-plus",onClick:e.withModifiers(()=>{n.table.header.group=!n.table.header.group,t.columnList.forEach(d=>{d.table?.header?.groupKey===n.key&&(d.table.header.show=!n.table.header.group)})},["stop"])},[n.table.header.group?(e.openBlock(),e.createBlock(ot,{key:0})):(e.openBlock(),e.createBlock(rt,{key:1}))],8,st)):e.createCommentVNode("",!0)])])]),default:e.withCtx(({row:d})=>[n.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i[0]||(i[0]=e.createTextVNode("   ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(r)),{conf:t.conf,columnList:n.children,option:t.option},e.createSlots({_:2},[e.renderList(o.$slots,(c,f)=>({name:f,fn:e.withCtx(s=>[e.renderSlot(o.$slots,f,e.mergeProps({ref_for:!0},s||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.option.table?.editMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row",["table-edit-"+n.key]]),style:{width:"100%"}},[e.renderSlot(o.$slots,"table-edit-left-"+n.key,{row:d,item:n}),n.type==="input"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":c=>d[n.key]=c,disabled:t.conf.update.getDisabled(n,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d))),e.createSlots({_:2},[n.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof n.options?.input?.prepend=="function"?n.options?.input?.prepend(d):n.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):n.type==="select"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:1,modelValue:d[n.key],"onUpdate:modelValue":c=>d[n.key]=c,disabled:t.conf.update.getDisabled(n,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d))),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options?.search?.select?.data||n.options?.select?.data,c=>(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):n.type==="switch"?(e.openBlock(),e.createBlock(e.unref(h.ElSwitch),e.mergeProps({key:2,modelValue:d[n.key],"onUpdate:modelValue":c=>d[n.key]=c,disabled:t.conf.update.getDisabled(n,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d))),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"table-edit-right-"+n.key,{row:d,item:n})],2)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.conf.update.type===e.unref(k).EDialog.Update&&e.unref(a)(n.show?.form,t.conf.update.form,e.unref(k).EDialog.Update)&&t.option.table?.inlineEdit&&t.conf.update.form[t.option.table?.rowKey]===d[t.option.table?.rowKey]&&(n.type==="input"||n.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.type==="input"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:0,modelValue:t.conf.update.form[n.key],"onUpdate:modelValue":c=>t.conf.update.form[n.key]=c,disabled:t.conf.update.getDisabled(n,!0)},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d)),{style:{width:"100%"}}),e.createSlots({_:2},[n.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof n.options?.input?.prepend=="function"?n.options?.input?.prepend(d):n.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):n.type==="select"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:1,modelValue:t.conf.update.form[n.key],"onUpdate:modelValue":c=>t.conf.update.form[n.key]=c,disabled:t.conf.update.getDisabled(n,!0)},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d)),{style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options?.search?.select?.data||n.options?.select?.data,c=>(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:c.value,label:c.label,value:c.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):n.type==="switch"?(e.openBlock(),e.createBlock(e.unref(h.ElSwitch),e.mergeProps({key:2,modelValue:t.conf.update.form[n.key],"onUpdate:modelValue":c=>t.conf.update.form[n.key]=c},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d)),{disabled:t.conf.update.getDisabled(n,!0)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)],64)):e.renderSlot(o.$slots,"table-"+n.key,{key:1,row:d,item:n},()=>[e.unref(N).customComponent[n.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(N).customComponent[n.type??""]?.table),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":c=>d[n.key]=c},{ref_for:!0},n.options?.[n.type??""],e.toHandlers(n.options?.[n.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):n.type==="switch"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n.options?.switch?.tableConfig?.change?(e.openBlock(),e.createBlock(e.unref(h.ElSwitch),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":c=>d[n.key]=c,loading:n.options?.switch?.loadingMap?.[d[t.option.table?.rowKey]]?.loading,"before-change":()=>n.options?.switch?.tableBeforeChange?.(n.key,d)},{ref_for:!0},n.options?.switch),null,16,["modelValue","onUpdate:modelValue","loading","before-change"])):(e.openBlock(),e.createElementBlock("span",ft,e.toDisplayString(d[n.key]===n.options?.switch?.activeValue?n.options?.switch?.activeText:n.options?.switch?.inactiveText),1))],64)):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":n.table?.click?.color}),class:e.normalizeClass({"table-text-click":n.table?.click?.callback}),onClick:c=>n.table?.click?.callback?.(d),innerHTML:n.table?.format?n.table?.format(d):d[n.key]},null,14,mt))])],64))],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],64))),128)}}}),ht={key:0,class:"relative curd-search fit-width"},pt={class:"mb-10 flex justify-between items-center fit-width"},ut={class:"flex items-center",style:{gap:"10px"}},yt={key:0},bt={key:1},kt={key:2},wt={class:"export-btn"},Ct={key:1,class:"export-btn"},Bt={class:"flex items-center table-tools-right",style:{gap:"10px"}},Vt={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},xt={class:"dialog-footer"},Et={key:0},St={key:1},Nt={class:"dialog-footer"},ne=e.defineComponent({__name:"index",props:{option:{default:{}},form:{default:void 0},searchForm:{default:void 0}},setup(t,{expose:a}){const r=k.EDialog,o=t,i=k.isFun,{conf:l,switchConfirmRef:n,ruleFormRef:d,tableRef:c}=Oe(o);return a({conf:l}),(f,s)=>{const u=e.resolveComponent("el-tooltip"),g=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[t.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[t.option.table?.fitHeight?"absolute fit":""]]),style:{overflow:"hidden"}},[e.renderSlot(f.$slots,"box-left"),e.createElementVNode("div",{class:e.normalizeClass(["column fit-width no-wrap",[t.option.table?.fitHeight?"col":""]])},[t.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",ht,[e.createVNode(e.unref(h.ElForm),{model:e.unref(l).search.form,inline:"",size:t.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-start",{row:e.unref(l).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).search.column.list,m=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m.key},[e.renderSlot(f.$slots,"search-"+m.key+"-start",{row:e.unref(l).search.form}),(typeof m.show?.search=="function"?m.show?.search(e.unref(l).search.form):m.show?.search)?(e.openBlock(),e.createBlock(e.unref(h.ElFormItem),{key:0,label:m.text?.search?.label??m.label},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-"+m.key+"-left",{row:e.unref(l).search.form}),e.renderSlot(f.$slots,"search-"+m.key,{row:e.unref(l).search.form},()=>[m.options?.search?.type?(e.openBlock(),e.createBlock(oe,{key:0,item:m,conf:e.unref(l),type:m.options.search.type},null,8,["item","conf","type"])):(e.openBlock(),e.createBlock(oe,{key:1,item:m,conf:e.unref(l),type:m.type},null,8,["item","conf","type"]))]),e.renderSlot(f.$slots,"search-"+m.key+"-right",{row:e.unref(l).search.form})]),_:2},1032,["label"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-"+m.key+"-end",{row:e.unref(l).search.form})],64))),128)),e.renderSlot(f.$slots,"search-center",{row:e.unref(l).search.form}),t.option.tools?.search||t.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(h.ElFormItem),{key:0},{default:e.withCtx(()=>[t.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:0,type:"primary",onClick:e.unref(l).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),t.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:1,onClick:e.unref(l).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-end",{row:e.unref(l).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",pt,[e.createElementVNode("div",ut,[e.unref(i)(t.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",yt,[e.createVNode(e.unref(h.ElButton),{type:"primary",onClick:s[0]||(s[0]=m=>e.unref(l).update.open(e.unref(r).Add)),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.table?.selectable&&e.unref(i)(t.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",bt,[e.createVNode(e.unref(h.ElButton),{type:"danger",onClick:s[1]||(s[1]=m=>e.unref(l).remove.open(e.unref(l).table.selection.list)),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",kt,[e.createVNode(e.unref(h.ElButton),{type:"warning",onClick:s[2]||(s[2]=m=>e.unref(l).table.expand.all()),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.tools?.export?.show?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[t.option.tools?.export?.dropdown?.show?(e.openBlock(),e.createBlock(e.unref(h.ElDropdown),{key:0,onCommand:e.unref(l).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(h.ElDropdownMenu),{size:t.option.size?.search},{default:e.withCtx(()=>[t.option.tools?.export?.dropdown?.select&&(t.option.table?.selectable||e.unref(i)(t.option.tools?.delete))?(e.openBlock(),e.createBlock(e.unref(h.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),t.option.tools?.export?.dropdown?.page?(e.openBlock(),e.createBlock(e.unref(h.ElDropdownItem),{key:1,command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("exportPage")),1)]),_:1})):e.createCommentVNode("",!0),t.option.tools?.export?.dropdown?.all?(e.openBlock(),e.createBlock(e.unref(h.ElDropdownItem),{key:2,command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("exportAll")),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",wt,[e.createVNode(e.unref(h.ElButton),{type:"warning",loading:e.unref(l).export.loading,size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("export")),1)]),_:1},8,["loading","size"])])]),_:1},8,["onCommand"])):(e.openBlock(),e.createElementBlock("div",Ct,[e.createVNode(e.unref(h.ElButton),{type:"warning",loading:e.unref(l).export.loading,size:t.option.size?.search,onClick:s[3]||(s[3]=m=>e.unref(l).export.run.start("all"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("export")),1)]),_:1},8,["loading","size"])]))],64)):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"tools-left")]),e.createElementVNode("div",Bt,[e.renderSlot(f.$slots,"tools-right"),e.unref(l).page.showTools?(e.openBlock(),e.createBlock(e.unref(h.ElPagination),e.mergeProps({key:0,"current-page":e.unref(l).page.num,"onUpdate:currentPage":s[4]||(s[4]=m=>e.unref(l).page.num=m),"page-size":e.unref(l).page.size,"onUpdate:pageSize":s[5]||(s[5]=m=>e.unref(l).page.size=m),background:"","page-sizes":e.unref(l).page.sizeList,"pager-count":e.unref(l).page.pagerCount,layout:e.unref(l).page.layout,total:e.unref(l).page.total,size:t.option.size?.table,onSizeChange:e.unref(l).table.getList,onCurrentChange:e.unref(l).table.getList},t.option.page?.pagination||{},e.toHandlers(t.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),t.option.tools?.expandColumn===void 0||t.option.tools?.expandColumn?(e.openBlock(),e.createBlock(u,{key:1,effect:"dark",content:e.unref(l).table.header.group.expand?e.unref(p).tCurd("mergeColumn"):e.unref(p).tCurd("expandColumn"),placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["refresh-btn",[t.option.size?.search]]),onClick:s[6]||(s[6]=(...m)=>e.unref(l).table.header.group.toggleExpandAll&&e.unref(l).table.header.group.toggleExpandAll(...m))},[e.unref(l).table.header.group.expand?(e.openBlock(),e.createBlock(je,{key:0})):(e.openBlock(),e.createBlock(We,{key:1}))],2)]),_:1},8,["content"])):e.createCommentVNode("",!0),t.option.tools?.refresh===void 0||t.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["refresh-btn",[t.option.size?.search]]),onClick:s[7]||(s[7]=(...m)=>e.unref(l).table.getList&&e.unref(l).table.getList(...m))},[e.createVNode(Qe)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[t.option.table?.fitHeight?"col ":"",t.option.table?.editMode?"edit-mode":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[t.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(h.ElTable),e.mergeProps({ref_key:"tableRef",ref:c,data:e.unref(l).table.data,border:t.option.table?.border===void 0?!0:t.option.table?.border,onSelectionChange:e.unref(l).table.selection.change,onSortChange:e.unref(l).table.sort.change,"expand-row-keys":e.unref(l).table.expand.rowKeys,onExpandChange:e.unref(l).table.expand.change},t.option.table,e.toHandlers(t.option.table?.on||{})),{default:e.withCtx(()=>[(typeof t.option.table?.selectable=="object"?t.option.table?.selectable?.show:t.option.table?.selectable)||e.unref(i)(t.option.tools?.delete)||t.option.tools?.export?.show&&t.option.tools?.export?.select?(e.openBlock(),e.createBlock(e.unref(h.ElTableColumn),e.mergeProps({key:0,type:"selection",width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1,className:"cc1-form-selectable-column"},typeof t.option.table?.selectable=="object"?t.option.table?.selectable:{},e.toHandlers(typeof t.option.table?.selectable=="object"?t.option.table?.selectable?.on||{}:{})),null,16)):e.createCommentVNode("",!0),(typeof t.option.table?.index=="object"?t.option.table?.index?.show:t.option.table?.index)?(e.openBlock(),e.createBlock(e.unref(h.ElTableColumn),e.mergeProps({key:1,type:"index",fixed:"left",width:"40",align:"center",label:"#","show-overflow-tooltip":!1,className:"cc1-form-index-column"},typeof t.option.table?.index=="object"?t.option.table?.index:{},e.toHandlers(typeof t.option.table?.index=="object"?t.option.table?.index?.on||{}:{})),null,16)):e.createCommentVNode("",!0),e.createVNode(gt,{conf:e.unref(l),columnList:e.unref(l).table.column.list,option:t.option},e.createSlots({_:2},[e.renderList(f.$slots,(m,y)=>({name:y,fn:e.withCtx(z=>[e.renderSlot(f.$slots,y,e.normalizeProps(e.guardReactiveProps(z||{})))])}))]),1032,["conf","columnList","option"]),e.unref(i)(t.option.table?.add)||e.unref(i)(t.option.table?.update)||e.unref(i)(t.option.table?.delete)||e.unref(i)(t.option.table?.view)||f.$slots["table-op-left"]||f.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(h.ElTableColumn),e.mergeProps({key:2,align:"center",fixed:"right"},t.option.table?.operate,{width:t.option.table?.operate?.width||120,"show-overflow-tooltip":!1}),{header:e.withCtx(()=>[e.renderSlot(f.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("operation")),1)])]),default:e.withCtx(({row:m})=>[e.createVNode(e.unref(h.ElForm),{size:t.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"table-op-left",{row:m}),e.unref(l).update.type===e.unref(r).Update&&t.option.table?.inlineEdit&&e.unref(l).update.form[o.option.table?.rowKey]===m[o.option.table?.rowKey]?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(h.ElButton),{link:"",type:"info",onClick:e.unref(l).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(h.ElButton),{link:"",type:"primary",onClick:e.unref(l).update.submit,loading:e.unref(l).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(f.$slots,"table-op-edit-right",{row:m})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(i)(t.option.table?.add,m)?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:0,link:"",type:"primary",onClick:y=>e.unref(l).update.open(e.unref(r).Add,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(t.option.table?.view,m)?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:1,link:"",type:"primary",onClick:y=>e.unref(l).update.open(e.unref(r).View,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("view")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(t.option.table?.update,m)?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:2,link:"",type:"warning",onClick:y=>e.unref(l).update.open(e.unref(r).Update,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(t.option.table?.delete,m)?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:3,link:"",type:"danger",onClick:y=>e.unref(l).remove.open([m])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"table-op-right",{row:m})],64))]),_:2},1032,["size"])]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[g,e.unref(l).table.loading]])],2)],2),e.createElementVNode("div",Vt,[(t.option.page?.show===void 0||t.option.page?.show)&&!e.unref(l).page.showTools?(e.openBlock(),e.createBlock(e.unref(h.ElPagination),e.mergeProps({key:0,"current-page":e.unref(l).page.num,"onUpdate:currentPage":s[8]||(s[8]=m=>e.unref(l).page.num=m),"page-size":e.unref(l).page.size,"onUpdate:pageSize":s[9]||(s[9]=m=>e.unref(l).page.size=m),background:"","page-sizes":e.unref(l).page.sizeList,"pager-count":e.unref(l).page.pagerCount,layout:e.unref(l).page.layout,total:e.unref(l).page.total,size:t.option.size?.table,onSizeChange:e.unref(l).table.getList,onCurrentChange:e.unref(l).table.getList},t.option.page?.pagination||{},e.toHandlers(t.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])],2),e.renderSlot(f.$slots,"box-right")],2),e.createVNode(e.unref(h.ElDialog),e.mergeProps({modelValue:e.unref(l).update.show,"onUpdate:modelValue":s[10]||(s[10]=m=>e.unref(l).update.show=m),title:e.unref(l).update.title,"before-close":e.unref(l).update.close},t.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",xt,[e.createVNode(e.unref(h.ElForm),{size:t.option.size?.form},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"dialog-footer",{row:e.unref(l).update},()=>[e.createVNode(e.unref(h.ElButton),{onClick:e.unref(l).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(l).update.type!==e.unref(r).View?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:0,type:"primary",onClick:e.unref(l).update.submit,loading:e.unref(l).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)])]),_:3},8,["size"])])]),default:e.withCtx(()=>[e.renderSlot(f.$slots,"dialog-start",{row:e.unref(l).update}),e.createVNode(e.unref(h.ElForm),{ref_key:"ruleFormRef",ref:d,model:e.unref(l).update.form,rules:e.unref(l).update.rules,size:t.option.size?.form,class:"update-dialog-form"},{default:e.withCtx(()=>[e.unref(l).update.showContent?(e.openBlock(),e.createBlock(_,{key:0,"form-grid":e.unref(l).update.formGrid,"max-span":e.unref(l).update.formMaxSpan,form:e.unref(l).update.form,type:e.unref(l).update.type,stripe:t.option.form?.stripe,"label-width":t.option.form?.labelWidth,"form-option":t.option.form,"get-bind":e.unref(l).update.getBind,"get-on":e.unref(l).update.getOn,"get-disabled":e.unref(l).update.getDisabled},e.createSlots({_:2},[e.renderList(f.$slots,(m,y)=>({name:y,fn:e.withCtx(z=>[e.renderSlot(f.$slots,y,e.normalizeProps(e.guardReactiveProps(z||{})))])}))]),1032,["form-grid","max-span","form","type","stripe","label-width","form-option","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)]),_:3},8,["model","rules","size"]),e.renderSlot(f.$slots,"dialog-end",{row:e.unref(l).update})]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(h.ElDialog),{modelValue:e.unref(l).remove.show,"onUpdate:modelValue":s[11]||(s[11]=m=>e.unref(l).remove.show=m),title:e.unref(l).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",Nt,[e.createVNode(e.unref(h.ElForm),{size:t.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(h.ElButton),{onClick:e.unref(l).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(h.ElButton),{type:"danger",onClick:e.unref(l).remove.submit,loading:e.unref(l).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(p).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["size"])])]),default:e.withCtx(()=>[t.option.dialog?.delete?.content?(e.openBlock(),e.createElementBlock("div",Et,[e.createVNode(Le,{content:t.option.dialog?.delete?.content,value:e.unref(l).remove.items},null,8,["content","value"])])):(e.openBlock(),e.createElementBlock("div",St,e.toDisplayString(e.unref(p).tCurd("confirmDeleteMessage",e.unref(l).remove.items.length)),1))]),_:1},8,["modelValue","title"]),e.createVNode(Te,{ref_key:"switchConfirmRef",ref:n,size:t.option.size?.form},null,8,["size"])],2)}}});class Dt{static async download(a,r="download.png"){const o=document.createElement("a");o.style.display="none",o.href=a,o.setAttribute("download",r),typeof o.download>"u"&&o.setAttribute("target","_blank"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(a)}static exportJSONFile=(a,r)=>{const o=new Blob([JSON.stringify(a)],{type:"application/json"}),i=URL.createObjectURL(o),l=document.createElement("a");l.href=i,l.download=`${r||"config"}.json`,l.click()};static importFile=async a=>new Promise((r,o)=>{const i=document.createElement("input");i.type="file";const l=a?.accept||".json";i.accept=l,i.style.display="none",i.onchange=n=>{const d=n.target.files[0];if(!d){k.fail("未选择文件"),o("未选择文件");return}const c=new FileReader;c.onload=async f=>{const s=l==".json"?JSON.parse(f.target.result):f.target.result;r(s)},c.onerror=()=>{k.fail("文件读取失败"),o("文件读取失败")},c.readAsText(d),document.body.removeChild(i)},document.body.appendChild(i),i.click()})}const ae=(t,a)=>{if(t.component("TCurd",ne),t.component("TFormList",I),t.component("TColumn",ee),a?.customComponent){N.customComponent=a.customComponent;for(const r in a.customComponent)t.component(r,a.customComponent[r])}},zt={install:ae};B.ArrUtil=F,B.ExcelUtil=te,B.TColumn=ee,B.TCurd=ne,B.TFile=Dt,B.TForm=N,B.TFormConfig=C,B.TFormI18n=p,B.TFormList=I,B.TObj=$,B.TSys=k,B.default=zt,B.install=ae,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(V,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("element-plus"),require("vue-router"),require("vue"),require("cc1-vue3")):typeof define=="function"&&define.amd?define(["exports","element-plus","vue-router","vue","cc1-vue3"],h):(V=typeof globalThis<"u"?globalThis:V||self,h(V.cc1Form={},V.ElementPlus,V.VueRouter,V.Vue,V.cc1Vue3))})(this,(function(V,h,Mt,e,K){"use strict";class k{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Add:"Add",Update:"Update",View:"View",Remove:"Remove"};static isFun=(a,...r)=>Array.isArray(a)?a.some(o=>typeof o=="function"?o(...r):o):typeof a=="function"?a(...r):a;static getRouterParams=()=>{const a=this.router.currentRoute.value.query||{},r=this.router.currentRoute.value.params||{};return Object.keys(a).length?a:Object.keys(r).length?r:{}};static moduleObj={};static loadModule=async a=>{if(!k.moduleObj[a])throw new Error(`模块${a}未加载,请赋值如:TSys.moduleObj = { ${a}: ()=>import('${a}') }`);const r=await k.moduleObj[a]();return r.default??r};static tipMessages={};static tipMessagesGap=500;static showMessage(a,r,o={}){const i=Date.now();if(!this.tipMessages[a]||i-this.tipMessages[a]>this.tipMessagesGap){this.tipMessages[a]=i;const l=Object.assign({message:a,type:r},o);h.ElMessage(l),setTimeout(()=>{delete this.tipMessages[a]},this.tipMessagesGap)}}static fail=(a,r={})=>{this.showMessage(a,"error",r)};static success=(a,r={})=>{this.showMessage(a,"success",r)};static loadingObj=null;static loadingTimer=null;static loading=(a=!0,r="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{a?this.loadingObj=h.ElLoading.service({lock:!0,text:r,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(a,r=!0)=>{if(r){let o=screen.width/2-500,i=screen.height/2-800/2-30;window.open(a,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+i+", left="+o)}else window.open(a,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=a=>new Promise(async(r,o)=>{let i=document.getElementById(a.id);const l=await k.loadModule("html2canvas");try{l(i,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:a.windowWidth,height:a.windowHeight,windowWidth:a.windowWidth,windowHeight:a.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(n){let d=n.toDataURL("image/png");r(d)})}catch(n){o(n)}})}class C{static config={field:{page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"}},dialog:{width:"980px",closeOnClickModal:!1},pagination:{layout:"total, sizes, prev, pager, next, jumper",pageSizes:[10,20,50,100],size:10,pagerCount:7,showTools:!1},size:{table:"default",form:"default",search:"default"},tools:{expandColumn:!1,refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,dropdown:{show:!0,select:!0,page:!0,all:!0},fileName:"Export Data "}},form:{size:"default",labelWidth:"120px",stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{index:!1,labelWidth:"100px",size:"default",emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0},fitHeight:!0},columnConfig:{type:"input",form:{width:"100%",spanCol:!1},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},disabled:{view:!0},options:{switch:{activeValue:!0,inactiveValue:!1,tableConfig:{change:!0,confirm:!0,loadList:!0}},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=a=>{C.config=ObjectUtil.deepMerge(C.config,a)}}class N{static customComponent={};static error={};static findOptions=(a,r)=>{const o=a.column.find(l=>l.key===r),i=l=>l.replace(/-([a-z])/g,(n,d)=>d.toUpperCase());if(o)return o.options[i(o.type)]};static setOptionsData=(a,r,o)=>{const i=N.findOptions(a,r);i&&(i.data=o)};static form={openBefore:{parentId:(a,r,o,i)=>{const l=C.config.table.rowKey;a?r.type===k.EDialog.Add?(r.form.parentId=a[l],r.form.sort=a.children.length+1):r.form.parentId=a.parentId.substring(a.parentId.lastIndexOf(",")+1):(r.form.parentId="0",r.form.sort=o.length+1),N.setOptionsData(i,"parentId",[{[l]:"0",title:"根",children:o}])}}}}class F{static getIdFun=()=>StrUtil.uuid();static setId=(a,r,o)=>{r[a]||(r[a]=[]);const i=C.config.table.rowKey;r[a].forEach(l=>{o.forEach(n=>{let d=n.default??"";n.type==="number"&&(d=n.default??0),n.type==="boolean"&&(d=n.default??!1),n.type==="time"&&(d=n.default??new Date),l[n.value]===void 0&&(l[n.value]=d)}),l[i]||(l[i]=F.getIdFun())})};static add=(a,r,o,i)=>{const l=JSONUtil.cp(o);F.setId(a,r,o);const n=C.config.table.rowKey;r[a].push(l.reduce((d,s)=>{let c=s.default??"";return s.type==="number"&&(c=s.default??0),s.type==="boolean"&&(c=s.default??!1),s.type==="time"&&(c=s.default??new Date),d[s.value]=c,d},{[n]:F.getIdFun()})),i?.(r)};static remove=(a,r,o,i)=>{const l=C.config.table.rowKey;r[a]=r[a].filter(n=>n[l]!==o[l]),i?.(r)};static getNoIdData=(a,r)=>{const o=JSONUtil.cp(a),i=C.config.table.rowKey;return o.forEach(l=>{l[i]&&delete l[i],r&&l[r]&&F.getNoIdData(l[r],r)}),o}}const le={key:0,class:"column curd-form-com-list",style:{width:"100%",gap:"10px"}},re={key:0},ie={class:"row items-center",style:{gap:"10px",width:"100%"}},de={key:1},I=e.defineComponent({__name:"list",props:{row:{default:{}},label:{default:"label"},value:{default:"value"},itemFields:{default:[{label:"label",value:"label"},{label:"value",value:"value"}]},field:{default:"value"},inputWidth:{default:"120px"},inputClass:{default:""},addBottom:{default:!1}},emits:["change"],setup(t,{emit:a}){const r=t,o=e.reactive({show:!1,add:(l,n,d)=>{F.add(l,n,d,()=>{i("change")})},remove:(l,n,d)=>{F.remove(l,n,d,()=>{i("change")})}});e.onMounted(()=>{F.setId(r.field,r.row,r.itemFields),o.show=!0});const i=a;return(l,n)=>{const d=e.resolveComponent("el-button"),s=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",le,[e.renderSlot(l.$slots,"list-start",{row:t.row}),t.addBottom?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",re,[e.createVNode(d,{link:"",type:"primary",onClick:n[0]||(n[0]=c=>o.add(t.field,t.row,t.itemFields))},{default:e.withCtx(()=>[...n[3]||(n[3]=[e.createTextVNode("添加",-1)])]),_:1})])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.row[t.field],c=>(e.openBlock(),e.createElementBlock("div",ie,[e.renderSlot(l.$slots,"item-start",{item:c,row:t.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.itemFields,m=>(e.openBlock(),e.createBlock(s,{modelValue:c[m.value],"onUpdate:modelValue":p=>c[m.value]=p,style:e.normalizeStyle({width:t.inputWidth}),class:e.normalizeClass(t.inputClass),placeholder:m[t.label]||m[t.value],onChange:n[1]||(n[1]=p=>i("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(l.$slots,"item-end",{item:c,row:t.row}),e.createVNode(d,{link:"",type:"danger",onClick:m=>o.remove(t.field,t.row,c)},{default:e.withCtx(()=>[...n[4]||(n[4]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),t.addBottom?(e.openBlock(),e.createElementBlock("div",de,[e.createVNode(d,{link:"",type:"primary",onClick:n[2]||(n[2]=c=>o.add(t.field,t.row,t.itemFields))},{default:e.withCtx(()=>[...n[5]||(n[5]=[e.createTextVNode("添加",-1)])]),_:1})])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"list-end",{row:t.row})])):e.createCommentVNode("",!0)}}}),ce={class:"row form-item-content",style:{width:"100%"}},se={class:"col column form-item-content-item"},fe={class:"col"},me=["innerHTML"],ge=e.defineComponent({__name:"field",props:{item:{},form:{},type:{},labelWidth:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(t){return(a,r)=>(e.openBlock(),e.createBlock(e.unref(h.ElFormItem),{label:t.item.text?.form?.label??t.item.label,prop:t.item.key,"label-width":t.item.text?.form?.label==""?0:t.item.form?.labelWidth||t.labelWidth},{default:e.withCtx(()=>[e.createElementVNode("div",ce,[e.renderSlot(a.$slots,"form-"+t.item.key+"-start",{row:t.form,item:t.item}),e.createElementVNode("div",se,[e.createElementVNode("div",fe,[e.renderSlot(a.$slots,"form-"+t.item.key,{row:t.form,item:t.item},()=>[t.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:0,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[0]||(r[0]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),e.createSlots({_:2},[t.getBind(t.item).prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof t.getBind(t.item).prepend=="function"?t.getBind(t.item).prepend(t.form):t.getBind(t.item).prepend),1)]),key:"0"}:void 0]),1040,["modelValue","disabled"])):t.item.type==="number"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:1,type:"number",modelValue:t.form[t.item.key],"onUpdate:modelValue":r[1]||(r[1]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="textarea"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:2,type:"textarea",modelValue:t.form[t.item.key],"onUpdate:modelValue":r[2]||(r[2]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(h.ElSwitch),e.mergeProps({key:3,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[3]||(r[3]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:4,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[4]||(r[4]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElOption),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(h.ElRadioGroup),e.mergeProps({key:5,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[5]||(r[5]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[t.getBind(t.item).type==="group"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElRadioButton),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElRadio),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="checkbox"?(e.openBlock(),e.createBlock(e.unref(h.ElCheckboxGroup),e.mergeProps({key:6,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[6]||(r[6]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[t.getBind(t.item).type==="group"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElCheckboxButton),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(h.ElCheckbox),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="color"?(e.openBlock(),e.createBlock(e.unref(h.ElColorPicker),e.mergeProps({key:7,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[7]||(r[7]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="slider"?(e.openBlock(),e.createBlock(e.unref(h.ElSlider),e.mergeProps({key:8,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[8]||(r[8]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="list"?(e.openBlock(),e.createBlock(I,e.mergeProps({key:9,row:t.form,field:t.item.key},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):t.item.type==="treeSelect"?(e.openBlock(),e.createBlock(e.unref(h.ElTreeSelect),e.mergeProps({key:10,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[9]||(r[9]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):t.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(h.ElDatePicker),e.mergeProps({key:11,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[10]||(r[10]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&typeof t.item.type=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.item.type),e.mergeProps({key:12,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[11]||(r[11]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&(e.unref(N).customComponent[t.item.type]||e.unref(N).customComponent[t.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(N).customComponent[t.item.type]?.form||e.unref(N).customComponent[t.item.type]),e.mergeProps({key:13,modelValue:t.form[t.item.key],"onUpdate:modelValue":r[12]||(r[12]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(a.$slots,"form-"+t.item.key+"-right",{row:t.form,item:t.item})]),e.renderSlot(a.$slots,"form-"+t.item.key+"-tip",{row:t.form,item:t.item},()=>[t.item.form?.tipText?(e.openBlock(),e.createElementBlock("div",{key:0,class:"form-tip-text",innerHTML:typeof t.item.form?.tipText=="function"?t.item.form?.tipText(t.form,t.type):t.item.form?.tipText},null,8,me)):e.createCommentVNode("",!0)])]),e.renderSlot(a.$slots,"form-"+t.item.key+"-end",{row:t.form,item:t.item})])]),_:3},8,["label","prop","label-width"]))}});function Tt(t){return t}const he={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",deleteTitle:"删除提示",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"部分内容未输入或输入错误,请检查",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?",mergeColumn:"合并栏位",expandColumn:"展开栏位"};class u{static t(a,...r){if(typeof a=="function")return a(...r);a=String(a);let o=0;return a.replace(/{([^}]+)}/g,(i,l)=>o<r.length?String(r[o++]):`{${l}}`)}static setI18n=a=>{u.curd=ObjectUtil.deepMerge(u.curd,a)};static tCurd(a,...r){return this.t(this.curd[a],...r)}static curd=he}class ${static delAllKey=a=>{Object.keys(a).forEach(r=>{delete a[r]})};static setValue=(a,r,o=!1)=>{o&&$.delAllKey(a),Object.keys(r).forEach(i=>{a[i]!==r[i]&&(a[i]=r[i])})}}const R=t=>{const a=e.reactive({}),r=()=>typeof t=="function"?t():t,o=()=>{const i=r();return i??a};return{internal:a,isExternal:()=>r()!=null,get(){return o()},set(i){$.setValue(o(),i,!0)},merge(i){$.setValue(o(),i,!1)},clear(){$.delAllKey(o())}}},A=k.EDialog,M=t=>typeof t.type=="object"?"component":t.type||"input",pe=(t,a,r)=>{const o=R(()=>a.form);return{update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:A.Update,get form(){return o.get()},set form(i){o.set(i)},formDefault:{},formColumn:[],formGrid:[],formMaxSpan:12,getDisabled:(i,l=!1)=>{const n=t();return a.option.table?.editMode&&l?i.disabled?.table===void 0?!1:k.isFun(i.disabled?.table,n.update.form):W(i,n.update.type,n.update.form)},getBind:i=>{const l=t();return P(i,l.update.type)},getOn:(i,l)=>{const n=t();return J(i,n.update.type,[l||n.update.form,i])},getOptions:i=>{const l=t();try{const d=X(l.update.formGrid?.length?l.update.formGrid:l.update.formColumn).find(s=>s.item.key===i)?.item;return d?{options:d.options,bind:l.update.getBind(d)}:{options:{},bind:{}}}catch{return{options:{},bind:{}}}},edit:{data:{},getApiData:i=>{const l=t();if(a.option.form?.editAll)return i;const n={[a.option.table?.rowKey]:l.update.edit.data[a.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(d=>{i[d]!==l.update.edit.data[d]&&(n[d]=i[d])}),n}},view:{},openLoading:!1,open:async(i,l)=>{const n=t();if(!(n.update.showContent||n.update.openLoading)){k.loading(!0),n.update.openLoading=!0;try{n.update.type=i;const d=i===A.Add;n.update.edit.data=d?void 0:JSONUtil.cp(l),n.update.title=u.tCurd(d?"add":i===A.View?"view":"edit");const s=d?ObjectUtil.deepMerge(JSONUtil.cp(n.update.formDefault),l?JSONUtil.cp(l):{}):JSONUtil.cp(l);$.setValue(n.update.form,s,!0),await n.initApiData("update"),await a.option.form?.openBefore?.(n.update.form,n.update),(!a.option.table?.inlineEdit||d)&&(n.update.show=!0,n.update.showContent=!0),a.option.form?.openAfter?.(n.update.form,n.update)}catch(d){console.error(d)}finally{k.loading(!1),n.update.openLoading=!1}}},validate:async()=>{const i=t();try{return await Promise.all([r.ruleFormRef.value?.validate(async l=>new Promise((n,d)=>{l||d(!1),n(void 0)})),i.formRef.validate()]),!0}catch{k.fail(u.tCurd("checkFormData"))}},submit:async()=>{const i=t();if(!await i.update.validate()||i.update.loading)return;i.update.loading=!0;const n=i.update.type===A.Add?a.option.api.create:a.option.api.update;try{await a.option.form?.submitBefore?.(i.update.form,i.update)}catch{i.update.loading=!1;return}let d=ObjectUtil.deepMerge(i.update.form,{});delete d.children;const s=new Set(a.option.column.filter(c=>c.type==="datetime").map(c=>c.key));Object.keys(d).forEach(c=>{if(s.has(c)&&d[c]!=null){const m=new Date(d[c]).getTime();isNaN(m)||(d[c]=m)}});try{if(!n)return;await n({...d}),i.update.close(),await i.table.getList(),a.option.form?.submitAfter?.(d,i.update)}catch(c){console.error(c)}finally{i.update.loading=!1}},close:()=>{const i=t();i.update.show=!1,i.update.edit.data=void 0,setTimeout(()=>{i.update.showContent=!1,r.ruleFormRef.value?.resetFields?.(),o.clear()},350)}}}},D=12,H=(t,a)=>{t.isForm=a,Array.isArray(t.children)&&t.children.forEach(r=>H(r,a))},ue=t=>t.isForm===!1?!1:typeof t.show?.form=="boolean"?t.show.form:!0,ye=(t,a,r)=>(t.form=t.form||{span:a},r==="column"?t.form.span=t.form.span??12:t.form.span=t.form.span??a,t.form.span),G=t=>{const a=t.form;return a?.row!=null&&a.row>0?a.row:D},U=t=>Math.floor((t.gridRow-1)/D),W=(t,a,r)=>{if(a===k.EDialog.View)return t.disabled?.view===void 0?!0:k.isFun(t.disabled?.view,r);const o=t.disabled?.[a===k.EDialog.Add?"create":"update"];return k.isFun(o,r)},P=(t,a)=>{const r=M(t);return t.options?.[a===k.EDialog.Add?"formAdd":"formUpdate"]?.[r]||t.options?.[r]||{}},J=(t,a,r=[])=>{const o=M(t),l=t.options?.[a===k.EDialog.Add?"formAdd":"formUpdate"]?.[o]?.on||t.options?.[o]?.on||{},n={};return Object.keys(l).forEach(d=>{const s=l[d];typeof s=="function"?n[d]=function(...c){return s.apply(this,[...c,...r])}:n[d]=s}),n},q=(t,a,r,o,i)=>{const l=t,n=l.colSpan??t.span;if(!t.item.form?.spanCol)return n;const d=i?.maxSpan||12,s=i?.defaultSpan||d/2,c=l.gridBand,p=a.filter(f=>c!=null?f.gridBand===c&&!k.isFun(f.item.show?.form,r,o):f.gridRow===l.gridRow&&!k.isFun(f.item.show?.form,r,o)).reduce((f,g)=>f+(g.colSpan??g.span??s),0);return n+p},Q=t=>{const a=new Map;return t.forEach(r=>{const o=r.gridBand??U(r);a.has(o)||a.set(o,[]),a.get(o).push(r)}),Array.from(a.keys()).sort((r,o)=>r-o).map(r=>a.get(r))},X=t=>t?.length?Array.isArray(t[0])?t.flat():t:[],be=(t,a)=>{if(!ue(t)||!t.key)return null;const r=a.defaultSpan??(a.maxSpan||12)/2,o=ye(t,r,a.layout);return{item:t,span:o}},ke=(t,a={})=>{const r=[],o=i=>{if(i.children?.length){i.children.forEach(n=>o(n));return}const l=be(i,a);l&&r.push(l)};return t.forEach(i=>o(i)),r},Y=(t,a={})=>{const r=a.maxSpan??12,o=a.defaultSpan??r/2,i=a.layout??"row",n=ke(t,{maxSpan:r,defaultSpan:o,layout:i});if(i==="column"){const b=[];let w=1;return n.forEach(B=>{const S=G(B.item),x=r;b.push({...B,span:x,colSpan:x,rowSpan:S,gridRow:w,gridColumn:1,gridBand:U({gridRow:w})}),w+=S}),{cells:b,maxSpan:r}}const d=new Set,s=[];let c=0,m=0;const p=b=>Math.floor(b/D)*D,f=(b,w)=>`${b},${w}`,g=(b,w,B,S)=>{if(w+B>r)return!1;for(let x=0;x<S;x++)for(let E=0;E<B;E++)if(d.has(f(b+x,w+E)))return!1;return!0},y=(b,w,B,S)=>{for(let x=0;x<S;x++)for(let E=0;E<B;E++)d.add(f(b+x,w+E))},z=(b,w,B,S)=>{for(let E=p(b);E<500*D;E+=D){const Ft=E+D,$t=E===p(b)?Math.max(E,b):E;for(let L=$t;L<Ft;L++){const Ot=L===b?w:0;for(let j=Ot;j<=r-B;j++)if(g(L,j,B,S))return{tr:L,tc:j}}}return{tr:b,tc:w}},O=(b,w,B,S)=>{const x=p(b);if(S<D&&b+S<x+D){c=b+S,m=w;return}const E=w+B;if(E<r){m=E,c=x;return}m=0,c=x+D};for(const b of n){const w=b.span===0?r:b.span,B=G(b.item);b.item.form?.rowBreak&&s.length&&(m=0,c=p(c)+D);let{tr:S,tc:x}=g(c,m,w,B)?{tr:c,tc:m}:z(c,m,w,B);g(S,x,w,B)||({tr:S,tc:x}=z(0,0,w,B)),y(S,x,w,B);const E=S+1;s.push({...b,span:w,colSpan:w,rowSpan:B,gridRow:E,gridColumn:x+1,gridBand:U({gridRow:E})}),O(S,x,w,B)}return{cells:s,maxSpan:r}},we=t=>t.map(a=>a.item?.show?.form),Ce=(t,a,r)=>{if(!t.rules)return;const o=typeof t.rules=="boolean"?[{required:!0,message:a(t),trigger:"blur"}]:t.rules;return r?o.map(i=>r(i)):o},Z=t=>(a,r)=>Ce(a,t,o=>{if(o.validator){const i=o.validator;return{...o,validator:(l,n,d)=>i(l,n,d,r)}}return o}),Be=t=>Z(a=>{const r={input:u.tCurd("placeholderInput"),select:u.tCurd("placeholderSelect")},o=(r[M(a)||"input"]||r.input)+a.label;return(t?.error||N.error.callback)?.(a.key,a)||o}),Ve=(t,a,r)=>{const o={},i={},l=a?.maxSpan||12,n=a?.defaultSpan||l/2,d=Be(a);t.forEach(m=>H(m,!0)),v(t,o,i,m=>d(m,r));const{cells:s,maxSpan:c}=Y(t,{maxSpan:l,defaultSpan:n,layout:a?.layout});return{formDefault:o,rules:i,formGrid:s,formMaxSpan:c,formColumn:Q(s)}},v=(t,a,r,o)=>{const i=l=>{if(l.children?.length){l.children.forEach(n=>i(n));return}if(l.key){a[l.key]=l.value;const n=o(l);n&&(r[l.key]=n)}};t.forEach(i)},xe={class:"curd-form-cell-inner"},_=e.defineComponent({__name:"layout",props:{formGrid:{},maxSpan:{},form:{},type:{},stripe:{type:Boolean},labelWidth:{},formOption:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(t){const a=k.isFun,r=t,o=e.computed(()=>r.formGrid.filter(f=>a(f.item.show?.form,r.form,r.type))),i=e.computed(()=>{const f=Array.from(new Set(o.value.map(g=>g.gridBand??U(g)))).sort((g,y)=>g-y);return new Map(f.map((g,y)=>[g,y]))}),l=e.computed(()=>({gridTemplateColumns:`repeat(${r.maxSpan}, minmax(0, 1fr))`})),n=e.computed(()=>{let f=0;return o.value.forEach(g=>{const y=g.gridRow+g.rowSpan-1;y>f&&(f=y)}),f}),d=f=>f.gridRow+f.rowSpan-1>=n.value,s=f=>f.rowSpan>=D,c=f=>{const g=f.gridBand??U(f);return i.value.get(g)??g},m=f=>q(f,r.formGrid,r.form,r.type,{maxSpan:r.maxSpan,defaultSpan:r.formOption?.defaultSpan}),p=f=>{const g=m(f)||f.colSpan;return{gridRow:`${f.gridRow} / span ${f.rowSpan}`,gridColumn:`${f.gridColumn} / span ${g}`}};return(f,g)=>e.unref(a)(e.unref(we)(t.formGrid),t.form,t.type)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(f.$slots,"form-start",{row:t.form}),e.createElementVNode("div",{class:e.normalizeClass(["curd-form-grid",{stripe:t.stripe!==!1}]),style:e.normalizeStyle(l.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y.item.key,class:e.normalizeClass(["curd-form-grid-cell",[t.stripe!==!1&&c(y)%2===0?"stripe-band-odd":"",y.gridColumn>1?"has-col-border":"",t.stripe!==!1&&d(y)?"is-last-row":"",s(y)?"is-row-span":"",`form-item-col-${y.item.key}`]]),style:e.normalizeStyle(p(y))},[e.createElementVNode("div",xe,[e.unref(a)(y.item.show?.form,t.form,t.type)?(e.openBlock(),e.createBlock(ge,{key:0,class:e.normalizeClass({"is-row-span-field":s(y)}),item:y.item,form:t.form,type:t.type,"label-width":t.labelWidth,"get-bind":t.getBind,"get-on":t.getOn,"get-disabled":t.getDisabled},e.createSlots({_:2},[e.renderList(f.$slots,(z,O)=>({name:O,fn:e.withCtx(b=>[e.renderSlot(f.$slots,O,e.mergeProps({ref_for:!0},b||{}))])}))]),1032,["class","item","form","type","label-width","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)])],6))),128))],6),e.renderSlot(f.$slots,"form-end",{row:t.form})],64)):e.createCommentVNode("",!0)}}),ee=e.defineComponent({__name:"column",props:{option:{default:()=>({form:{},column:[]})},type:{default:""},form:{default:void 0}},setup(t,{expose:a}){const r=k.EDialog,o=e.ref(),i=t;let l=R(i.form);const n=K.Scope.getConf();n?.formRef?.set("formRef-"+StrUtil.getId(),o);const d=e.reactive({rules:{},show:!0,formDefault:{},type:i.type||n?.update?.type||r.Add,formColumn:[],formGrid:[],formMaxSpan:12,get form(){return l.get()},set form(s){l.set(s)},getDisabled:s=>W(s,d.type,d.form),getBind:s=>P(s,d.type),getOn:s=>J(s,d.type,[d.form,s]),initColumnForm:()=>{const s=l,c=Ve(i.option.column,i.option.form,s.get());d.formDefault=c.formDefault,d.rules=c.rules,d.formGrid=c.formGrid,d.formMaxSpan=c.formMaxSpan,d.formColumn=c.formColumn,d.type===r.Add?s.isExternal()?s.merge(JSONUtil.cp(d.formDefault)):s.set(JSONUtil.cp(d.formDefault)):!s.isExternal()&&i.form&&s.set(JSONUtil.cp(i.form))}});return i.option.form?.initStart?.(d),d.initColumnForm(),i.option.form?.initEnd?.(d),e.watch(()=>i.form,s=>{l=R(s),d.initColumnForm()}),a({ref:o,conf:d}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(h.ElForm),{ref_key:"ruleFormRef",ref:o,model:d.form,rules:d.rules},{default:e.withCtx(()=>[d.show?(e.openBlock(),e.createBlock(_,{key:0,"form-grid":d.formGrid,"max-span":d.formMaxSpan,form:d.form,type:d.type,stripe:t.option.form?.stripe,"label-width":t.option.form?.labelWidth||"100px","form-option":t.option.form,"get-bind":d.getBind,"get-on":d.getOn,"get-disabled":d.getDisabled},e.createSlots({_:2},[e.renderList(s.$slots,(m,p)=>({name:p,fn:e.withCtx(f=>[e.renderSlot(s.$slots,p,e.normalizeProps(e.guardReactiveProps(f||{})))])}))]),1032,["form-grid","max-span","form","type","stripe","label-width","form-option","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}}),Ee=()=>({formRef:{map:{},set(t,a){this.map[t]=a},validate(){return new Promise(async(t,a)=>{try{const r=Object.keys(this.map);await Promise.all(r.map(o=>this.map[o]?.validate(async i=>new Promise((l,n)=>{i||n(!1),l(!0)})))),t(!0)}catch(r){a(r)}})}}}),Se=(t,a)=>{const r=R(()=>a.searchForm);return{search:{column:{list:[]},get form(){return r.get()},set form(o){r.set(o)},formDefault:{},getPlaceholder:(o,i=u.tCurd("placeholderInput"))=>o.text?.search?.placeholder===void 0?`${i}${o.label}`:o.text?.search?.placeholder,getFormData:()=>{const o=t();let i={};a.option.column.forEach(n=>{(typeof n.show?.search=="function"?n.show?.search(o.search.form):n.show?.search)&&(i[n.key]=o.search.form[n.key])});const l=a.option.search?.before?.(i);return l&&(i=l),i},reset:()=>{const o=t(),i=o.search.formDefault;Object.keys(i).forEach(n=>{a.option.search?.resetMode==="none"?i[n]=void 0:i[n]=o.search.formDefault[n]});const l=ObjectUtil.deepMerge(i,{});$.setValue(o.search.form,l,!0),o.page.num=1,a.option.init!==!1&&o.table.getList()},submit:()=>{const o=t();o.page.num=1,o.table.getList()}}}},Ne=(t,a)=>({page:{num:1,total:0,layout:a.option.page?.layout||C.config.pagination.layout,showTools:a.option.page?.showTools||C.config.pagination.showTools,size:a.option.page?.size||C.config.pagination.size,sizeList:a.option.page?.sizeList||C.config.pagination.pageSizes,pagerCount:a.option.page?.pagerCount||C.config.pagination.pagerCount,getQuery:(r={})=>{const o=t();return{[C.config.field.page.size]:r.size||o.page.size,[C.config.field.page.num]:r.num||o.page.num,...o.search.getFormData()}}}}),De=(t,a,r)=>({table:{op:{width:(...o)=>o.filter(l=>l).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(o,i)=>{},all:()=>{const o=t();if(o.table.expand.isExpand)o.table.expand.rowKeys=[];else{const i=l=>{let n=[];return l.forEach(d=>{n.push(d[a.option.table.rowKey]),d.children?.length&&(n=n.concat(i(d.children)))}),n};o.table.expand.rowKeys=i(o.table.data)}o.table.expand.isExpand=!o.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},header:{group:{expand:!1,toggleExpandAll:()=>{const o=t(),i=!o.table.header.group.expand;o.table.header.group.expand=i;const l=n=>{n.forEach(d=>{d.table?.header?.group!==void 0&&(d.table.header.group=!i),d.table?.header?.groupKey!==void 0&&(d.table.header.show=i),Array.isArray(d.children)&&d.children.length&&l(d.children)})};l(o.table.column.list)}}},getList:async()=>{const o=t();o.table.loading=!0;const i=a.option.api.list,l=JSONUtil.cp(o.table.selection.list);try{await o.initApiData("init");let n={};if(o.table.sort.prop){const{props:y,order:z}=C.config.table.sort;n={[y.field]:o.table.sort.prop,[z.field]:o.table.sort.order}}const d=await i({...o.page.getQuery(),...n}),s=C.config.field.result,c=d.data||{[s.list]:d},m=(Array.isArray(c[s.list]),c[s.list]),p=X(o.update.formGrid?.length?o.update.formGrid:o.update.formColumn),g=ObjectUtil.deepMerge({data:m},{}).data.map(y=>(Object.keys(y).forEach(O=>{const b=p.find(w=>w.item.key===O);b&&["select","radio"].includes(b.item.type)&&(b.item.table.format||(b.item.table.format=w=>b.item.options[b.item.type].data?.find(B=>B.value==w[O])?.label||w[O]))}),y));o.table.data=a.option.data?await a.option.data(g,m):g,o.page.total=c[s.total]||0,setTimeout(()=>{o.table.selection.setList(l)},20)}catch(n){console.error(n)}finally{o.table.loading=!1}},selection:{list:[],change:o=>{t().table.selection.list=o},setList:(o,i)=>{const l=t();l.table.selection.list=[];const n=r.tableRef.value;if(n?.clearSelection(),!n||!o?.length)return;const d=a.option.table?.rowKey,s=c=>{const m=p=>{for(const f of p){if(d!=null&&d!==""){if(f[d]===c[d])return f}else if(f===c)return f;if(Array.isArray(f.children)&&f.children.length){const g=m(f.children);if(g!==void 0)return g}}};return m(l.table.data)};o.forEach(c=>{const m=s(c);if(m)if(i){const p=()=>n.toggleRowSelection(m,!0,!1);i(c)!==!1&&p()}else n.toggleRowSelection(m,!0,!1)})}},sort:{prop:"",order:"",change:o=>{const i=t();C.config.table.sort.resetPage&&(i.page.num=1);const l=C.config.table.sort;if(l.change){l.change(o,i);return}i.table.sort.prop=o.prop,o.order===null?(i.table.sort.order="",i.table.sort.prop=""):i.table.sort.order=o.order==="ascending"?l.order.asc:l.order.desc,i.table.getList()}}}});class te{static exportToExcel=async(a,r,o)=>{if(!a||a.length===0)return;const i=await k.loadModule("xlsx"),l=a.map(s=>{const c={};return r.forEach(m=>{c[m.label]=s[m.key]}),c}),n=i.utils.json_to_sheet(l),d=i.utils.book_new();i.utils.book_append_sheet(d,n,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,i.writeFile(d,`${o}.xlsx`)}}const ze=(t,a)=>({export:{run:{start:async r=>{let i=await t().export.run[r]();const l=a.option.column,n=ObjectUtil.deepMerge({data:i,columns:l},{}),d=a.option.tools?.export||{};d.before?.(n),te.exportToExcel(n.data,n.columns,d.fileName)},select:async()=>{const r=t();r.export.loading=!0;try{if(a.option.tools?.export?.select){await a.option.tools.export.select({...r.page.getQuery(),items:r.table.selection.list});return}if(r.table.selection.list.length===0)throw k.fail(u.tCurd("selectDataToExport")),new Error(u.tCurd("selectDataToExport"));return r.table.selection.list}catch(o){console.error(o)}finally{r.export.loading=!1}},page:async()=>{const r=t();r.export.loading=!0;try{if(a.option.tools?.export?.page){await a.option.tools.export.page({...r.page.getQuery()});return}if(r.table.data.length===0)throw k.fail(u.tCurd("noData")),new Error(u.tCurd("noData"));return r.table.data}catch(o){console.error(o)}finally{r.export.loading=!1}},all:async()=>{const r=t();r.export.loading=!0;try{if(a.option.tools?.export?.all){await a.option.tools.export.all({...r.page.getQuery()});return}const o=a.option.api.list,i=await o({...r.page.getQuery({size:999999,num:1})});return(i.data||{[C.config.field.result.list]:i})[C.config.field.result.list]}catch(o){console.error(o)}finally{r.export.loading=!1}}},loading:!1,click:r=>{const o=t();o.export.loading||o.export.run.start(r)}}}),Fe=(t,a)=>({remove:{title:u.tCurd("deleteTitle"),show:!1,items:[],loading:!1,close:()=>{t().remove.show=!1},open:r=>{if(r.length===0){k.fail(u.tCurd("selectDataToDelete"));return}const o=t();o.remove.items=r,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{const r=t();r.remove.loading=!0;const o=a.option.api.delete;try{if(!o)return;await o({[a.option.table?.rowKey]:r.remove.items.map(i=>i[a.option.table?.rowKey]),items:r.remove.items}),k.success(u.tCurd("operationSuccess")),r.table.data.length<=1&&r.page.num>1&&(r.page.num-=1),r.remove.close(),await r.table.getList()}catch(i){console.error(i)}finally{r.remove.loading=!1}})}}}),$e=(t,a,r)=>({apiDataMap:{},getColumnSpan:(o,i)=>{const l=t(),n=l.update.formGrid?.length?l.update.formGrid:i||[];return q(o,n,l.update.form,l.update.type,{maxSpan:l.update.formMaxSpan||a.option.form?.maxSpan,defaultSpan:a.option.form?.defaultSpan||C.config.form.defaultSpan})},init:()=>{const o=t();o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},initApiData:async o=>{const i=t(),l=[],n=d=>{if(d.children?.length){d.children.forEach(c=>n(c));return}const s=M(d);if(d.options?.[s]?.dataApi&&d.options?.[s]?.dataApiConfig?.[o]){if(i.apiDataMap[d.key]&&d.options?.[s]?.dataApiConfig?.once)return;const c=(async()=>{try{let m=await d.options?.[s]?.dataApi?.(i.update.form,i.update.type);if(m){const p=d.options?.[s]?.dataPath;!Array.isArray(m)&&p&&(m=ObjectUtil.getPathValue(m,p)),d.options[s].data=m,d.options.search[s].data=m,d.options.search[d.options.search.type??s]||(d.options.search[d.options.search.type??s]={}),d.options.search[d.options.search.type??s].data=m,d.options.formAdd[s].data=m,d.options.formUpdate[s].data=m,i.apiDataMap[d.key]=m}}catch{}})();l.push(c)}};return a.option.column.forEach(d=>n(d)),await Promise.all(l),!0},initCurdConfig:()=>{const o=ObjectUtil.deepMerge(C.config,{});o.table.emptyText=u.tCurd("noData"),a.option.size=a.option.size||{},o.table.size=a.option.size.table||o.size.table,o.form.size=a.option.size.form||o.size.form,o.size.search=a.option.size.search||o.size.search;const i=ObjectUtil.deepMerge(o,a.option||{});Object.keys(i).forEach(l=>{a.option[l]=i[l]})},initColumnOptions:()=>{const o=t();let i=JSONUtil.cp(C.config.columnConfig);i.options=ObjectUtil.deepMerge({switch:{activeText:u.tCurd("switchOn"),inactiveText:u.tCurd("switchOff")}},i.options);const l=n=>{const d=M(n);for(const c in i){if(c==="table"){if(n.table=ObjectUtil.deepMerge(i.table,n.table||{}),n.children){n.children.forEach(m=>l(m));return}}else c==="type"?n.type=n.type||i.type:n[c]=ObjectUtil.deepMerge(i[c],n[c]||{});n.options=n.options||{},n.options[d]=n.options[d]||{},n.options[d].size=a.option.size.form}["search","formAdd","formUpdate"].forEach(c=>{n.options[c]=ObjectUtil.deepMerge(n.options,n.options[c]||{}),c==="search"?a.option.size.search&&(n.options[c][d].size=a.option.size.search):a.option.size.form&&(n.options[c][d].size=a.option.size.form)}),n.table=ObjectUtil.deepMerge(n.table,n.options[d].table||{}),d==="switch"&&(n.options.switch.tableBeforeChange=async(c,m)=>{const p=n.options?.switch;try{p.tableConfig?.confirm&&await r.switchConfirmRef.value?.open({title:u.tCurd("confirmModify"),content:u.tCurd("confirmSwitchMessage")});try{if(!a.option.api.update&&!p.tableConfig?.api)return;const f=m[a.option.table?.rowKey];p.loadingMap||(p.loadingMap={}),p.loadingMap[f]||(p.loadingMap[f]={loading:!1}),p.loadingMap[f].loading=!0;const g=m[c]===p.activeValue?p.inactiveValue:p.activeValue,y=p.tableConfig?.api?p.tableConfig.api:a.option.api.update;if(!y)return;try{await y({...m,[c]:g},"switch")}catch{return!1}finally{p.loadingMap[f].loading=!1}return k.success(u.tCurd("operationSuccess")),p.tableConfig?.loadList&&(o.table.loading=!0,o.table.getList(),o.table.loading=!1),!0}catch(f){return console.error(f),!1}finally{o.table.loading=!1}}catch{return!1}}),d==="treeSelect"&&(n.options.treeSelect.rowKey=a.option.table?.rowKey,n.options.treeSelect.nodeKey=a.option.table?.rowKey)};a.option.column.forEach(l),a.option.table?.column?.forEach(l)},initColumnForm:()=>{const o=t(),i=a.option;o.update.formColumn=[],o.update.formGrid=[],o.update.formMaxSpan=12,o.table.column.show={list:[],listSource:[]};const l=a.option.form?.maxSpan||12,n=a.option.form?.defaultSpan||l/2,d=Z(f=>{const g={input:u.tCurd("placeholderInput"),select:u.tCurd("placeholderSelect")},y=(g[M(f)||"input"]||g.input)+f.label;return(a.option.form?.error||N.error.callback)?.(f.key,f)||y}),s=f=>{if(f.children){o.table.column.show.list.push(f.key),f.children.forEach(g=>s(g));return}o.update.formDefault[f.key]=f.value,f.table?.table&&(f.show?.table&&o.table.column.show.list.push(f.key),o.table.column.show.listSource.push(f.key))};i.column.forEach(f=>{H(f,!0),s(f)}),a.option.table?.column?.forEach(f=>{H(f,!1),s(f)}),o.search.column.list=i.column.concat(i.table?.column||[]),o.table.column.list=o.search.column.list.filter(f=>f.table?.table),o.search.column.list.sort((f,g)=>f.sort?.search-g.sort?.search),o.table.column.list.sort((f,g)=>f.sort?.table-g.sort?.table),o.update.rules={},v(i.column,o.update.formDefault,o.update.rules,f=>d(f,o.update.form));const c=Y(i.column,{maxSpan:l,defaultSpan:n,layout:a.option.form?.layout});o.update.formGrid=c.cells,o.update.formMaxSpan=c.maxSpan,o.update.formColumn=Q(c.cells);const m=a.option.search?.formDefault;m&&Object.keys(m).forEach(f=>{o.search.formDefault[f]=m[f]}),i.column.forEach(f=>{f.show?.search||(o.search.formDefault[f.key]=void 0)});const p=ObjectUtil.deepMerge(o.search.formDefault,{});$.setValue(o.search.form,p,!0)}}),Oe=t=>{const a=e.ref(),r=e.ref(),o=e.ref(),i={switchConfirmRef:a,ruleFormRef:r,tableRef:o},l=()=>n;let n=e.reactive({...Ee(),option:t.option,...Se(l,t),...Ne(l,t),...De(l,t,i),...ze(l,t),...pe(l,t,i),...Fe(l,t),...$e(l,t,i)});return n.init(),e.onMounted(()=>{t.option.init!==!1&&n.table.getList()}),K.Scope.setConf(n),{conf:n,switchConfirmRef:a,ruleFormRef:r,tableRef:o}},Me={class:"dialog-footer"},Te=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(t,{expose:a}){const r=e.ref(!1),o=e.ref("确认修改"),i=e.ref("确认要修改状态吗?");let l=null,n=null;const d=m=>(m?.title&&(o.value=m.title),m?.content&&(i.value=m.content),r.value=!0,new Promise((p,f)=>{l=p,n=f})),s=()=>{r.value=!1,l?.(!0),l=null,n=null},c=()=>{r.value=!1,n?.(new Error("用户取消操作")),l=null,n=null};return a({open:d}),(m,p)=>{const f=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(h.ElDialog),{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=g=>r.value=g),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(f,{size:t.size},{default:e.withCtx(()=>[e.createElementVNode("span",Me,[e.createVNode(e.unref(h.ElButton),{onClick:c},{default:e.withCtx(()=>[...p[1]||(p[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(h.ElButton),{type:"primary",onClick:s},{default:e.withCtx(()=>[...p[2]||(p[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(i.value),1)]),_:1},8,["modelValue","title"])}}}),Ue=["innerHTML"],Le=e.defineComponent({__name:"text",props:{content:{},value:{}},setup(t){const a=t,r=e.computed(()=>typeof a.content=="function"?a.content(a.value):a.content);return(o,i)=>typeof r.value=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0})):(e.openBlock(),e.createElementBlock("div",{key:1,innerHTML:r.value},null,8,Ue))}}),oe=e.defineComponent({__name:"searchField",props:{item:{},conf:{},type:{}},setup(t){const a=t,r=e.computed({get:()=>a.conf.search.form?.[a.item?.key],set:o=>{a.item?.key!==void 0&&(a.conf.search.form[a.item.key]=o)}});return(o,i)=>e.unref(N).customComponent[t.type??""]?.search?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(N).customComponent[t.type??""]?.search),e.mergeProps({key:0,modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=l=>r.value=l)},t.item.options?.search?.[t.type??""],e.toHandlers(t.item.options?.search?.[t.type??""]?.on||{})),null,16,["modelValue"])):t.type==="input"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:1,modelValue:r.value,"onUpdate:modelValue":i[1]||(i[1]=l=>r.value=l),placeholder:t.conf.search.getPlaceholder(t.item),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.input||t.item.options?.input,e.toHandlers(t.item.options?.search?.input?.on||t.item.options?.input?.on||{})),null,16,["modelValue","placeholder","disabled"])):t.type==="switch"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:2,modelValue:r.value,"onUpdate:modelValue":i[2]||(i[2]=l=>r.value=l),placeholder:t.conf.search.getPlaceholder(t.item,e.unref(u).tCurd("placeholderSelect")),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.switch||t.item.options?.switch,e.toHandlers(t.item.options?.search?.switch?.on||t.item.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:t.item.options?.switch?.activeValue,label:t.item.options?.switch?.activeText,value:t.item.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:t.item.options?.switch?.inactiveValue,label:t.item.options?.switch?.inactiveText,value:t.item.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:1},16,["modelValue","placeholder","disabled"])):t.type==="select"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:3,modelValue:r.value,"onUpdate:modelValue":i[3]||(i[3]=l=>r.value=l),placeholder:t.conf.search.getPlaceholder(t.item,e.unref(u).tCurd("placeholderSelect")),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.select||t.item.options?.select,e.toHandlers(t.item.options?.search?.select?.on||t.item.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.options?.search?.select?.data||t.item.options?.select?.data||[],l=>(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","placeholder","disabled"])):t.type==="radio"?(e.openBlock(),e.createBlock(e.unref(h.ElRadioGroup),e.mergeProps({key:4,modelValue:r.value,"onUpdate:modelValue":i[4]||(i[4]=l=>r.value=l),disabled:t.item.disabled?.search},t.item.options?.search?.radio||t.item.options?.radio,e.toHandlers(t.item.options?.search?.radio?.on||t.item.options?.radio?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.options?.radio?.data,l=>(e.openBlock(),e.createBlock(e.unref(h.ElRadio),{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):t.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(h.ElDatePicker),e.mergeProps({key:5,modelValue:r.value,"onUpdate:modelValue":i[5]||(i[5]=l=>r.value=l),disabled:t.item.disabled?.search},t.item.options?.search?.datetime||t.item.options?.datetime,e.toHandlers(t.item.options?.search?.datetime?.on||t.item.options?.datetime?.on||{})),null,16,["modelValue","disabled"])):t.type&&e.unref(N).customComponent[t.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(N).customComponent[t.type]),e.mergeProps({key:6,modelValue:r.value,"onUpdate:modelValue":i[6]||(i[6]=l=>r.value=l)},t.item.options?.search?.[t.type]||t.item.options?.[t.type],e.toHandlers(t.item.options?.search?.[t.type]?.on||t.item.options?.[t.type]?.on||{}),{disabled:t.item.disabled?.search}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}),T=(t,a)=>{const r=t.__vccOpts||t;for(const[o,i]of a)r[o]=i;return r},Re={},Ae={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function He(t,a){return e.openBlock(),e.createElementBlock("svg",Ae,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M482.2 508.4L331.3 389c-3-2.4-7.3-.2-7.3 3.6V478H184V184h204v128c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V144c0-15.5-12.5-28-28-28H144c-15.5 0-28 12.5-28 28v736c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v128H184V546h140v85.4c0 3.8 4.4 6 7.3 3.6l150.9-119.4a4.5 4.5 0 000-7.2zM880 116H596c-15.5 0-28 12.5-28 28v168c0 2.2 1.8 4 4 4h60c2.2 0 4-1.8 4-4V184h204v294H700v-85.4c0-3.8-4.3-6-7.3-3.6l-151 119.4a4.52 4.52 0 000 7.1l151 119.5c2.9 2.3 7.3.2 7.3-3.6V546h140v294H636V712c0-2.2-1.8-4-4-4h-60c-2.2 0-4 1.8-4 4v168c0 15.5 12.5 28 28 28h284c15.5 0 28-12.5 28-28V144c0-15.5-12.5-28-28-28z"},null,-1)])])}const je=T(Re,[["render",He]]),Ie={},Ke={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function Ge(t,a){return e.openBlock(),e.createElementBlock("svg",Ke,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M180 176h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zm724 0h-60c-4.4 0-8 3.6-8 8v656c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V184c0-4.4-3.6-8-8-8zM785.3 504.3L657.7 403.6a7.23 7.23 0 00-11.7 5.7V476H378v-62.8c0-6-7-9.4-11.7-5.7L238.7 508.3a7.14 7.14 0 000 11.3l127.5 100.8c4.7 3.7 11.7.4 11.7-5.7V548h268v62.8c0 6 7 9.4 11.7 5.7l127.5-100.8c3.8-2.9 3.8-8.5.2-11.4z"},null,-1)])])}const We=T(Ie,[["render",Ge]]),Pe={},Je={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function qe(t,a){return e.openBlock(),e.createElementBlock("svg",Je,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M771.776 794.88A384 384 0 0 1 128 512h64a320 320 0 0 0 555.712 216.448H654.72a32 32 0 1 1 0-64h149.056a32 32 0 0 1 32 32v148.928a32 32 0 1 1-64 0v-50.56zM276.288 295.616h92.992a32 32 0 0 1 0 64H220.16a32 32 0 0 1-32-32V178.56a32 32 0 0 1 64 0v50.56A384 384 0 0 1 896.128 512h-64a320 320 0 0 0-555.776-216.384z"},null,-1)])])}const Qe=T(Pe,[["render",qe]]),Xe={},Ye={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function Ze(t,a){return e.openBlock(),e.createElementBlock("svg",Ye,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"},null,-1)])])}const ve=T(Xe,[["render",Ze]]),_e={},et={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function tt(t,a){return e.openBlock(),e.createElementBlock("svg",et,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-38.4 409.6H326.4a38.4 38.4 0 1 0 0 76.8h147.2v147.2a38.4 38.4 0 0 0 76.8 0V550.4h147.2a38.4 38.4 0 0 0 0-76.8H550.4V326.4a38.4 38.4 0 1 0-76.8 0z"},null,-1)])])}const ot=T(_e,[["render",tt]]),nt={},at={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function lt(t,a){return e.openBlock(),e.createElementBlock("svg",at,[...a[0]||(a[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896M288 512a38.4 38.4 0 0 0 38.4 38.4h371.2a38.4 38.4 0 0 0 0-76.8H326.4A38.4 38.4 0 0 0 288 512"},null,-1)])])}const rt=T(nt,[["render",lt]]),it={class:"row flex-center table-header-label inline"},dt={class:"table-header-tooltip"},ct=["innerHTML"],st=["onClick"],ft={key:1},mt=["onClick","innerHTML"],gt=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(t){const a=k.isFun,r=e.getCurrentInstance().type;return(o,i)=>{const l=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnList,n=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:n.key},[t.conf.table.column.show.list.includes(n.key)&&(n.show?.table===void 0||e.unref(a)(n.show?.table,t.conf.table.data))?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.table?.header?.groupKey===void 0||n.table.header.show?(e.openBlock(),e.createBlock(e.unref(h.ElTableColumn),e.mergeProps({key:0,prop:n.key,label:n.label},{ref_for:!0},n.table),{header:e.withCtx(()=>[e.renderSlot(o.$slots,"table-header-"+n.key,{item:n},()=>[e.createElementVNode("div",it,[n.table?.header?.tooltip?(e.openBlock(),e.createBlock(l,{key:0,effect:"dark",placement:"top"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:n.table?.header?.tooltip},null,8,ct)]),default:e.withCtx(()=>[e.createElementVNode("span",dt,[e.createVNode(ve)])]),_:2},1024)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(n.label)+" ",1),n.table?.header?.group!==void 0?(e.openBlock(),e.createElementBlock("span",{key:1,class:"table-header-plus",onClick:e.withModifiers(()=>{n.table.header.group=!n.table.header.group,t.columnList.forEach(d=>{d.table?.header?.groupKey===n.key&&(d.table.header.show=!n.table.header.group)})},["stop"])},[n.table.header.group?(e.openBlock(),e.createBlock(ot,{key:0})):(e.openBlock(),e.createBlock(rt,{key:1}))],8,st)):e.createCommentVNode("",!0)])])]),default:e.withCtx(({row:d})=>[n.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i[0]||(i[0]=e.createTextVNode("   ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(r)),{conf:t.conf,columnList:n.children,option:t.option},e.createSlots({_:2},[e.renderList(o.$slots,(s,c)=>({name:c,fn:e.withCtx(m=>[e.renderSlot(o.$slots,c,e.mergeProps({ref_for:!0},m||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.option.table?.editMode?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row",["table-edit-"+n.key]]),style:{width:"100%"}},[e.renderSlot(o.$slots,"table-edit-left-"+n.key,{row:d,item:n}),n.type==="input"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":s=>d[n.key]=s,disabled:t.conf.update.getDisabled(n,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d))),e.createSlots({_:2},[n.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof n.options?.input?.prepend=="function"?n.options?.input?.prepend(d):n.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):n.type==="select"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:1,modelValue:d[n.key],"onUpdate:modelValue":s=>d[n.key]=s,disabled:t.conf.update.getDisabled(n,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d))),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options?.search?.select?.data||n.options?.select?.data,s=>(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):n.type==="switch"?(e.openBlock(),e.createBlock(e.unref(h.ElSwitch),e.mergeProps({key:2,modelValue:d[n.key],"onUpdate:modelValue":s=>d[n.key]=s,disabled:t.conf.update.getDisabled(n,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d))),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0),e.renderSlot(o.$slots,"table-edit-right-"+n.key,{row:d,item:n})],2)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.conf.update.type===e.unref(k).EDialog.Update&&e.unref(a)(n.show?.form,t.conf.update.form,e.unref(k).EDialog.Update)&&t.option.table?.inlineEdit&&t.conf.update.form[t.option.table?.rowKey]===d[t.option.table?.rowKey]&&(n.type==="input"||n.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[n.type==="input"?(e.openBlock(),e.createBlock(e.unref(h.ElInput),e.mergeProps({key:0,modelValue:t.conf.update.form[n.key],"onUpdate:modelValue":s=>t.conf.update.form[n.key]=s,disabled:t.conf.update.getDisabled(n,!0)},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d)),{style:{width:"100%"}}),e.createSlots({_:2},[n.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof n.options?.input?.prepend=="function"?n.options?.input?.prepend(d):n.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):n.type==="select"?(e.openBlock(),e.createBlock(e.unref(h.ElSelect),e.mergeProps({key:1,modelValue:t.conf.update.form[n.key],"onUpdate:modelValue":s=>t.conf.update.form[n.key]=s,disabled:t.conf.update.getDisabled(n,!0)},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d)),{style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options?.search?.select?.data||n.options?.select?.data,s=>(e.openBlock(),e.createBlock(e.unref(h.ElOption),{key:s.value,label:s.label,value:s.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):n.type==="switch"?(e.openBlock(),e.createBlock(e.unref(h.ElSwitch),e.mergeProps({key:2,modelValue:t.conf.update.form[n.key],"onUpdate:modelValue":s=>t.conf.update.form[n.key]=s},{ref_for:!0},t.conf.update.getBind(n),e.toHandlers(t.conf.update.getOn(n,d)),{disabled:t.conf.update.getDisabled(n,!0)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)],64)):e.renderSlot(o.$slots,"table-"+n.key,{key:1,row:d,item:n},()=>[e.unref(N).customComponent[n.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(N).customComponent[n.type??""]?.table),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":s=>d[n.key]=s},{ref_for:!0},n.options?.[n.type??""],e.toHandlers(n.options?.[n.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):n.type==="switch"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[n.options?.switch?.tableConfig?.change?(e.openBlock(),e.createBlock(e.unref(h.ElSwitch),e.mergeProps({key:0,modelValue:d[n.key],"onUpdate:modelValue":s=>d[n.key]=s,loading:n.options?.switch?.loadingMap?.[d[t.option.table?.rowKey]]?.loading,"before-change":()=>n.options?.switch?.tableBeforeChange?.(n.key,d)},{ref_for:!0},n.options?.switch),null,16,["modelValue","onUpdate:modelValue","loading","before-change"])):(e.openBlock(),e.createElementBlock("span",ft,e.toDisplayString(d[n.key]===n.options?.switch?.activeValue?n.options?.switch?.activeText:n.options?.switch?.inactiveText),1))],64)):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":n.table?.click?.color}),class:e.normalizeClass({"table-text-click":n.table?.click?.callback}),onClick:s=>n.table?.click?.callback?.(d),innerHTML:n.table?.format?n.table?.format(d):d[n.key]},null,14,mt))])],64))],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],64))),128)}}}),ht={key:0,class:"relative curd-search fit-width"},pt={class:"mb-10 flex justify-between items-center fit-width"},ut={class:"flex items-center",style:{gap:"10px"}},yt={key:0},bt={key:1},kt={key:2},wt={class:"export-btn"},Ct={key:1,class:"export-btn"},Bt={class:"flex items-center table-tools-right",style:{gap:"10px"}},Vt={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},xt={class:"dialog-footer"},Et={key:0},St={key:1},Nt={class:"dialog-footer"},ne=e.defineComponent({__name:"index",props:{option:{default:{}},form:{default:void 0},searchForm:{default:void 0}},setup(t,{expose:a}){const r=k.EDialog,o=t,i=k.isFun,{conf:l,switchConfirmRef:n,ruleFormRef:d,tableRef:s}=Oe(o);return a({conf:l}),(c,m)=>{const p=e.resolveComponent("el-tooltip"),f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[t.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[t.option.table?.fitHeight?"absolute fit":""]]),style:{overflow:"hidden"}},[e.renderSlot(c.$slots,"box-left"),e.createElementVNode("div",{class:e.normalizeClass(["column fit-width no-wrap",[t.option.table?.fitHeight?"col":""]])},[t.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",ht,[e.createVNode(e.unref(h.ElForm),{model:e.unref(l).search.form,inline:"",size:t.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"search-start",{row:e.unref(l).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(l).search.column.list,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.key},[e.renderSlot(c.$slots,"search-"+g.key+"-start",{row:e.unref(l).search.form}),(typeof g.show?.search=="function"?g.show?.search(e.unref(l).search.form):g.show?.search)?(e.openBlock(),e.createBlock(e.unref(h.ElFormItem),{key:0,label:g.text?.search?.label??g.label},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"search-"+g.key+"-left",{row:e.unref(l).search.form}),e.renderSlot(c.$slots,"search-"+g.key,{row:e.unref(l).search.form},()=>[g.options?.search?.type?(e.openBlock(),e.createBlock(oe,{key:0,item:g,conf:e.unref(l),type:g.options.search.type},null,8,["item","conf","type"])):(e.openBlock(),e.createBlock(oe,{key:1,item:g,conf:e.unref(l),type:g.type},null,8,["item","conf","type"]))]),e.renderSlot(c.$slots,"search-"+g.key+"-right",{row:e.unref(l).search.form})]),_:2},1032,["label"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"search-"+g.key+"-end",{row:e.unref(l).search.form})],64))),128)),e.renderSlot(c.$slots,"search-center",{row:e.unref(l).search.form}),t.option.tools?.search||t.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(h.ElFormItem),{key:0},{default:e.withCtx(()=>[t.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:0,type:"primary",onClick:e.unref(l).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),t.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:1,onClick:e.unref(l).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"search-end",{row:e.unref(l).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",pt,[e.createElementVNode("div",ut,[e.unref(i)(t.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",yt,[e.createVNode(e.unref(h.ElButton),{type:"primary",onClick:m[0]||(m[0]=g=>e.unref(l).update.open(e.unref(r).Add)),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.table?.selectable&&e.unref(i)(t.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",bt,[e.createVNode(e.unref(h.ElButton),{type:"danger",onClick:m[1]||(m[1]=g=>e.unref(l).remove.open(e.unref(l).table.selection.list)),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",kt,[e.createVNode(e.unref(h.ElButton),{type:"warning",onClick:m[2]||(m[2]=g=>e.unref(l).table.expand.all()),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.tools?.export?.show?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[t.option.tools?.export?.dropdown?.show?(e.openBlock(),e.createBlock(e.unref(h.ElDropdown),{key:0,onCommand:e.unref(l).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(h.ElDropdownMenu),{size:t.option.size?.search},{default:e.withCtx(()=>[t.option.tools?.export?.dropdown?.select&&(t.option.table?.selectable||e.unref(i)(t.option.tools?.delete))?(e.openBlock(),e.createBlock(e.unref(h.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),t.option.tools?.export?.dropdown?.page?(e.openBlock(),e.createBlock(e.unref(h.ElDropdownItem),{key:1,command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("exportPage")),1)]),_:1})):e.createCommentVNode("",!0),t.option.tools?.export?.dropdown?.all?(e.openBlock(),e.createBlock(e.unref(h.ElDropdownItem),{key:2,command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("exportAll")),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",wt,[e.createVNode(e.unref(h.ElButton),{type:"warning",loading:e.unref(l).export.loading,size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("export")),1)]),_:1},8,["loading","size"])])]),_:1},8,["onCommand"])):(e.openBlock(),e.createElementBlock("div",Ct,[e.createVNode(e.unref(h.ElButton),{type:"warning",loading:e.unref(l).export.loading,size:t.option.size?.search,onClick:m[3]||(m[3]=g=>e.unref(l).export.run.start("all"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("export")),1)]),_:1},8,["loading","size"])]))],64)):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"tools-left")]),e.createElementVNode("div",Bt,[e.renderSlot(c.$slots,"tools-right"),e.unref(l).page.showTools?(e.openBlock(),e.createBlock(e.unref(h.ElPagination),e.mergeProps({key:0,"current-page":e.unref(l).page.num,"onUpdate:currentPage":m[4]||(m[4]=g=>e.unref(l).page.num=g),"page-size":e.unref(l).page.size,"onUpdate:pageSize":m[5]||(m[5]=g=>e.unref(l).page.size=g),background:"","page-sizes":e.unref(l).page.sizeList,"pager-count":e.unref(l).page.pagerCount,layout:e.unref(l).page.layout,total:e.unref(l).page.total,size:t.option.size?.table,onSizeChange:e.unref(l).table.getList,onCurrentChange:e.unref(l).table.getList},t.option.page?.pagination||{},e.toHandlers(t.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),t.option.tools?.expandColumn===void 0||t.option.tools?.expandColumn?(e.openBlock(),e.createBlock(p,{key:1,effect:"dark",content:e.unref(l).table.header.group.expand?e.unref(u).tCurd("mergeColumn"):e.unref(u).tCurd("expandColumn"),placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["refresh-btn",[t.option.size?.search]]),onClick:m[6]||(m[6]=(...g)=>e.unref(l).table.header.group.toggleExpandAll&&e.unref(l).table.header.group.toggleExpandAll(...g))},[e.unref(l).table.header.group.expand?(e.openBlock(),e.createBlock(je,{key:0})):(e.openBlock(),e.createBlock(We,{key:1}))],2)]),_:1},8,["content"])):e.createCommentVNode("",!0),t.option.tools?.refresh===void 0||t.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["refresh-btn",[t.option.size?.search]]),onClick:m[7]||(m[7]=(...g)=>e.unref(l).table.getList&&e.unref(l).table.getList(...g))},[e.createVNode(Qe)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[t.option.table?.fitHeight?"col ":"",t.option.table?.editMode?"edit-mode":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[t.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(h.ElTable),e.mergeProps({ref_key:"tableRef",ref:s,data:e.unref(l).table.data,border:t.option.table?.border===void 0?!0:t.option.table?.border,onSelectionChange:e.unref(l).table.selection.change,onSortChange:e.unref(l).table.sort.change,"expand-row-keys":e.unref(l).table.expand.rowKeys,onExpandChange:e.unref(l).table.expand.change},t.option.table,e.toHandlers(t.option.table?.on||{})),{default:e.withCtx(()=>[(typeof t.option.table?.selectable=="object"?t.option.table?.selectable?.show:t.option.table?.selectable)||e.unref(i)(t.option.tools?.delete)||t.option.tools?.export?.show&&t.option.tools?.export?.select?(e.openBlock(),e.createBlock(e.unref(h.ElTableColumn),e.mergeProps({key:0,type:"selection",width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1,className:"cc1-form-selectable-column"},typeof t.option.table?.selectable=="object"?t.option.table?.selectable:{},e.toHandlers(typeof t.option.table?.selectable=="object"?t.option.table?.selectable?.on||{}:{})),null,16)):e.createCommentVNode("",!0),(typeof t.option.table?.index=="object"?t.option.table?.index?.show:t.option.table?.index)?(e.openBlock(),e.createBlock(e.unref(h.ElTableColumn),e.mergeProps({key:1,type:"index",fixed:"left",width:"40",align:"center",label:"#","show-overflow-tooltip":!1,className:"cc1-form-index-column"},typeof t.option.table?.index=="object"?t.option.table?.index:{},e.toHandlers(typeof t.option.table?.index=="object"?t.option.table?.index?.on||{}:{})),null,16)):e.createCommentVNode("",!0),e.createVNode(gt,{conf:e.unref(l),columnList:e.unref(l).table.column.list,option:t.option},e.createSlots({_:2},[e.renderList(c.$slots,(g,y)=>({name:y,fn:e.withCtx(z=>[e.renderSlot(c.$slots,y,e.normalizeProps(e.guardReactiveProps(z||{})))])}))]),1032,["conf","columnList","option"]),e.unref(i)(t.option.table?.add)||e.unref(i)(t.option.table?.update)||e.unref(i)(t.option.table?.delete)||e.unref(i)(t.option.table?.view)||c.$slots["table-op-left"]||c.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(h.ElTableColumn),e.mergeProps({key:2,align:"center",fixed:"right"},t.option.table?.operate,{width:t.option.table?.operate?.width||120,"show-overflow-tooltip":!1}),{header:e.withCtx(()=>[e.renderSlot(c.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("operation")),1)])]),default:e.withCtx(({row:g})=>[e.createVNode(e.unref(h.ElForm),{size:t.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"table-op-left",{row:g}),e.unref(l).update.type===e.unref(r).Update&&t.option.table?.inlineEdit&&e.unref(l).update.form[o.option.table?.rowKey]===g[o.option.table?.rowKey]?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(h.ElButton),{link:"",type:"info",onClick:e.unref(l).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(h.ElButton),{link:"",type:"primary",onClick:e.unref(l).update.submit,loading:e.unref(l).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(c.$slots,"table-op-edit-right",{row:g})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(i)(t.option.table?.add,g)?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:0,link:"",type:"primary",onClick:y=>e.unref(l).update.open(e.unref(r).Add,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(t.option.table?.view,g)?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:1,link:"",type:"primary",onClick:y=>e.unref(l).update.open(e.unref(r).View,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("view")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(t.option.table?.update,g)?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:2,link:"",type:"warning",onClick:y=>e.unref(l).update.open(e.unref(r).Update,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(t.option.table?.delete,g)?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:3,link:"",type:"danger",onClick:y=>e.unref(l).remove.open([g])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"table-op-right",{row:g})],64))]),_:2},1032,["size"])]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[f,e.unref(l).table.loading]])],2)],2),e.createElementVNode("div",Vt,[(t.option.page?.show===void 0||t.option.page?.show)&&!e.unref(l).page.showTools?(e.openBlock(),e.createBlock(e.unref(h.ElPagination),e.mergeProps({key:0,"current-page":e.unref(l).page.num,"onUpdate:currentPage":m[8]||(m[8]=g=>e.unref(l).page.num=g),"page-size":e.unref(l).page.size,"onUpdate:pageSize":m[9]||(m[9]=g=>e.unref(l).page.size=g),background:"","page-sizes":e.unref(l).page.sizeList,"pager-count":e.unref(l).page.pagerCount,layout:e.unref(l).page.layout,total:e.unref(l).page.total,size:t.option.size?.table,onSizeChange:e.unref(l).table.getList,onCurrentChange:e.unref(l).table.getList},t.option.page?.pagination||{},e.toHandlers(t.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])],2),e.renderSlot(c.$slots,"box-right")],2),e.createVNode(e.unref(h.ElDialog),e.mergeProps({modelValue:e.unref(l).update.show,"onUpdate:modelValue":m[10]||(m[10]=g=>e.unref(l).update.show=g),title:e.unref(l).update.title,"before-close":e.unref(l).update.close},t.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",xt,[e.createVNode(e.unref(h.ElForm),{size:t.option.size?.form},{default:e.withCtx(()=>[e.renderSlot(c.$slots,"dialog-footer",{row:e.unref(l).update},()=>[e.createVNode(e.unref(h.ElButton),{onClick:e.unref(l).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(l).update.type!==e.unref(r).View?(e.openBlock(),e.createBlock(e.unref(h.ElButton),{key:0,type:"primary",onClick:e.unref(l).update.submit,loading:e.unref(l).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("submit")),1)]),_:1},8,["onClick","loading"])):e.createCommentVNode("",!0)])]),_:3},8,["size"])])]),default:e.withCtx(()=>[e.renderSlot(c.$slots,"dialog-start",{row:e.unref(l).update}),e.createVNode(e.unref(h.ElForm),{ref_key:"ruleFormRef",ref:d,model:e.unref(l).update.form,rules:e.unref(l).update.rules,size:t.option.size?.form,class:"update-dialog-form"},{default:e.withCtx(()=>[e.unref(l).update.showContent?(e.openBlock(),e.createBlock(_,{key:0,"form-grid":e.unref(l).update.formGrid,"max-span":e.unref(l).update.formMaxSpan,form:e.unref(l).update.form,type:e.unref(l).update.type,stripe:t.option.form?.stripe,"label-width":t.option.form?.labelWidth,"form-option":t.option.form,"get-bind":e.unref(l).update.getBind,"get-on":e.unref(l).update.getOn,"get-disabled":e.unref(l).update.getDisabled},e.createSlots({_:2},[e.renderList(c.$slots,(g,y)=>({name:y,fn:e.withCtx(z=>[e.renderSlot(c.$slots,y,e.normalizeProps(e.guardReactiveProps(z||{})))])}))]),1032,["form-grid","max-span","form","type","stripe","label-width","form-option","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)]),_:3},8,["model","rules","size"]),e.renderSlot(c.$slots,"dialog-end",{row:e.unref(l).update})]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(h.ElDialog),{modelValue:e.unref(l).remove.show,"onUpdate:modelValue":m[11]||(m[11]=g=>e.unref(l).remove.show=g),title:e.unref(l).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",Nt,[e.createVNode(e.unref(h.ElForm),{size:t.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(h.ElButton),{onClick:e.unref(l).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(h.ElButton),{type:"danger",onClick:e.unref(l).remove.submit,loading:e.unref(l).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["size"])])]),default:e.withCtx(()=>[t.option.dialog?.delete?.content?(e.openBlock(),e.createElementBlock("div",Et,[e.createVNode(Le,{content:t.option.dialog?.delete?.content,value:e.unref(l).remove.items},null,8,["content","value"])])):(e.openBlock(),e.createElementBlock("div",St,e.toDisplayString(e.unref(u).tCurd("confirmDeleteMessage",e.unref(l).remove.items.length)),1))]),_:1},8,["modelValue","title"]),e.createVNode(Te,{ref_key:"switchConfirmRef",ref:n,size:t.option.size?.form},null,8,["size"])],2)}}});class Dt{static async download(a,r="download.png"){const o=document.createElement("a");o.style.display="none",o.href=a,o.setAttribute("download",r),typeof o.download>"u"&&o.setAttribute("target","_blank"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(a)}static exportJSONFile=(a,r)=>{const o=new Blob([JSON.stringify(a)],{type:"application/json"}),i=URL.createObjectURL(o),l=document.createElement("a");l.href=i,l.download=`${r||"config"}.json`,l.click()};static importFile=async a=>new Promise((r,o)=>{const i=document.createElement("input");i.type="file";const l=a?.accept||".json";i.accept=l,i.style.display="none",i.onchange=n=>{const d=n.target.files[0];if(!d){k.fail("未选择文件"),o("未选择文件");return}const s=new FileReader;s.onload=async c=>{const m=l==".json"?JSON.parse(c.target.result):c.target.result;r(m)},s.onerror=()=>{k.fail("文件读取失败"),o("文件读取失败")},s.readAsText(d),document.body.removeChild(i)},document.body.appendChild(i),i.click()})}const ae=(t,a)=>{if(t.component("TCurd",ne),t.component("TFormList",I),t.component("TColumn",ee),a?.customComponent){N.customComponent=a.customComponent;for(const r in a.customComponent)t.component(r,a.customComponent[r])}},zt={install:ae};V.ArrUtil=F,V.ExcelUtil=te,V.TColumn=ee,V.TCurd=ne,V.TFile=Dt,V.TForm=N,V.TFormConfig=C,V.TFormI18n=u,V.TFormList=I,V.TSys=k,V.default=zt,V.install=ae,Object.defineProperties(V,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/dist/index.d.ts CHANGED
@@ -12,7 +12,6 @@ import TFormConfig from './utils/TFormConfig';
12
12
  import TFormI18n from './utils/TFormI18n';
13
13
  import TSys from './utils/TSys';
14
14
  import TFile from './utils/TFile';
15
- import TObj from './utils/TObj';
16
15
  /**
17
16
  * 安装 cc1-form 插件,注册全局组件 `TCurd`、`TFormList`、`TColumn`
18
17
  *
@@ -47,7 +46,7 @@ export declare const install: (app: App, options?: {
47
46
  [key: string]: any;
48
47
  };
49
48
  }) => void;
50
- export { ArrUtil, ExcelUtil, TColumn, TCurd, TForm, TFormList, TFormI18n, TSys, TFile, TFormConfig, type CurdConfig, type CurdConfigColumn, type CurdOption, type curdConfType, TObj };
49
+ export { ArrUtil, ExcelUtil, TColumn, TCurd, TForm, TFormList, TFormI18n, TSys, TFile, TFormConfig, type CurdConfig, type CurdConfigColumn, type CurdOption, type curdConfType };
51
50
  declare const _default: {
52
51
  install: (app: App, options?: {
53
52
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc1-form",
3
- "version": "1.2.29",
3
+ "version": "1.3.0",
4
4
  "description": "我来助你-表单组件库",
5
5
  "repository": {
6
6
  "type": "git",