cc1-form 1.3.9 → 1.4.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.
package/dist/cc1-form.js CHANGED
@@ -1929,7 +1929,7 @@ const we = (a) => {
1929
1929
  }
1930
1930
  },
1931
1931
  parseListResult: async (n) => {
1932
- const e = t(), r = T.config.field.result, l = n?.data || { [r.list]: n }, u = (Array.isArray(l[r.list]), l[r.list]), f = et(e.update.formGrid?.length ? e.update.formGrid : e.update.formColumn), b = ObjectUtil.deepMerge({ data: u }, {}).data.map((c) => (Object.keys(c).forEach((w) => {
1932
+ const e = t(), r = T.config.field.result, l = n?.data || { [r.list]: n }, u = Array.isArray(l) ? l : (Array.isArray(l[r.list]), l[r.list]), f = et(e.update.formGrid?.length ? e.update.formGrid : e.update.formColumn), b = ObjectUtil.deepMerge({ data: u }, {}).data.map((c) => (Object.keys(c).forEach((w) => {
1933
1933
  const F = f.find((B) => B.item.key === w);
1934
1934
  F && ["select", "radio"].includes(F.item.type) && (F.item.table.format || (F.item.table.format = (B) => F.item.options[F.item.type].data?.find((L) => L.value == B[w])?.label || B[w]));
1935
1935
  }), c));
@@ -3070,7 +3070,7 @@ const Oo = /* @__PURE__ */ se(zo, [["render", Mo]]), Fo = { class: "row flex-cen
3070
3070
  _: 1
3071
3071
  }, 8, ["size"])
3072
3072
  ])) : V("", !0),
3073
- a.option.table?.selectable && i(n)(a.option.tools?.delete) ? (m(), C("div", Io, [
3073
+ i(n)(a.option.tools?.delete) ? (m(), C("div", Io, [
3074
3074
  M(i(K), {
3075
3075
  type: "danger",
3076
3076
  onClick: d[1] || (d[1] = (p) => i(e).remove.open(i(e).table.selection.list)),
@@ -1 +1 @@
1
- (function(F,u){typeof exports=="object"&&typeof module<"u"?u(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"],u):(F=typeof globalThis<"u"?globalThis:F||self,u(F.cc1Form={},F.ElementPlus,F.VueRouter,F.Vue,F.cc1Vue3))})(this,(function(F,u,vt,e,J){"use strict";class w{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Add:"Add",Update:"Update",View:"View",Remove:"Remove"};static isFun=(n,...s)=>Array.isArray(n)?n.some(o=>typeof o=="function"?o(...s):o):typeof n=="function"?n(...s):n;static getRouterParams=()=>{const n=this.router.currentRoute.value.query||{},s=this.router.currentRoute.value.params||{};return Object.keys(n).length?n:Object.keys(s).length?s:{}};static moduleObj={};static setModule=n=>{Object.keys(n).forEach(s=>{w.moduleObj[s]=n[s]})};static loadModule=async n=>{if(!w.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const s=await w.moduleObj[n]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(n,s,o={}){const a=Date.now();if(!this.tipMessages[n]||a-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=a;const t=Object.assign({message:n,type:s},o);u.ElMessage(t),setTimeout(()=>{delete this.tipMessages[n]},this.tipMessagesGap)}}static fail=(n,s={})=>{this.showMessage(n,"error",s)};static success=(n,s={})=>{this.showMessage(n,"success",s)};static loadingObj=null;static loadingTimer=null;static loading=(n=!0,s="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{n?this.loadingObj=u.ElLoading.service({lock:!0,text:s,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(n,s=!0)=>{if(s){let o=screen.width/2-500,a=screen.height/2-800/2-30;window.open(n,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+o)}else window.open(n,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=n=>new Promise(async(s,o)=>{let a=document.getElementById(n.id);const t=await w.loadModule("html2canvas");try{t(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:n.windowWidth,height:n.windowHeight,windowWidth:n.windowWidth,windowHeight:n.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(i){let l=i.toDataURL("image/png");s(l)})}catch(i){o(i)}})}class V{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,sortable:{show:!1,button:!1,saveButton:!0,width:54,label:"",fixed:"left",page:!1,scroll:!1,field:"sortNo",rule:"index",api:{}}},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=n=>{V.config=ObjectUtil.deepMerge(V.config,n)}}class R{static customComponent={};static error={};static findOptions=(n,s)=>{const o=n.column.find(t=>t.key===s),a=t=>t.replace(/-([a-z])/g,(i,l)=>l.toUpperCase());if(o)return o.options[a(o.type)]};static setOptionsData=(n,s,o)=>{const a=R.findOptions(n,s);a&&(a.data=o)};static form={openBefore:{parentId:(n,s,o,a)=>{const t=V.config.table.rowKey;n?s.type===w.EDialog.Add?(s.form.parentId=n[t],s.form.sort=n.children.length+1):s.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=o.length+1),R.setOptionsData(a,"parentId",[{[t]:"0",title:"根",children:o}])}}}}class T{static getIdFun=()=>StrUtil.uuid();static setId=(n,s,o)=>{s[n]||(s[n]=[]);const a=V.config.table.rowKey;s[n].forEach(t=>{o.forEach(i=>{let l=i.default??"";i.type==="number"&&(l=i.default??0),i.type==="boolean"&&(l=i.default??!1),i.type==="time"&&(l=i.default??new Date),t[i.value]===void 0&&(t[i.value]=l)}),t[a]||(t[a]=T.getIdFun())})};static add=(n,s,o,a)=>{const t=JSONUtil.cp(o);T.setId(n,s,o);const i=V.config.table.rowKey;s[n].push(t.reduce((l,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),l[c.value]=f,l},{[i]:T.getIdFun()})),a?.(s)};static remove=(n,s,o,a)=>{const t=V.config.table.rowKey;s[n]=s[n].filter(i=>i[t]!==o[t]),a?.(s)};static getNoIdData=(n,s)=>{const o=JSONUtil.cp(n),a=V.config.table.rowKey;return o.forEach(t=>{t[a]&&delete t[a],s&&t[s]&&T.getNoIdData(t[s],s)}),o}}const Ce={key:0,class:"column curd-form-com-list",style:{width:"100%",gap:"10px"}},Be={key:0},Ve={class:"row items-center",style:{gap:"10px",width:"100%"}},Ee={key:1},Q=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(r,{emit:n}){const s=r,o=e.reactive({show:!1,add:(t,i,l)=>{T.add(t,i,l,()=>{a("change")})},remove:(t,i,l)=>{T.remove(t,i,l,()=>{a("change")})}});e.onMounted(()=>{T.setId(s.field,s.row,s.itemFields),o.show=!0});const a=n;return(t,i)=>{const l=e.resolveComponent("el-button"),c=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",Ce,[e.renderSlot(t.$slots,"list-start",{row:r.row}),r.addBottom?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Be,[e.createVNode(l,{link:"",type:"primary",onClick:i[0]||(i[0]=f=>o.add(r.field,r.row,r.itemFields))},{default:e.withCtx(()=>i[3]||(i[3]=[e.createTextVNode("添加")])),_:1})])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.row[r.field],f=>(e.openBlock(),e.createElementBlock("div",Ve,[e.renderSlot(t.$slots,"item-start",{item:f,row:r.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.itemFields,d=>(e.openBlock(),e.createBlock(c,{modelValue:f[d.value],"onUpdate:modelValue":g=>f[d.value]=g,style:e.normalizeStyle({width:r.inputWidth}),class:e.normalizeClass(r.inputClass),placeholder:d[r.label]||d[r.value],onChange:i[1]||(i[1]=g=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:f,row:r.row}),e.createVNode(l,{link:"",type:"danger",onClick:d=>o.remove(r.field,r.row,f)},{default:e.withCtx(()=>i[4]||(i[4]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),r.addBottom?(e.openBlock(),e.createElementBlock("div",Ee,[e.createVNode(l,{link:"",type:"primary",onClick:i[2]||(i[2]=f=>o.add(r.field,r.row,r.itemFields))},{default:e.withCtx(()=>i[5]||(i[5]=[e.createTextVNode("添加")])),_:1})])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"list-end",{row:r.row})])):e.createCommentVNode("",!0)}}}),Se={class:"row form-item-content",style:{width:"100%"}},Ne={class:"col column form-item-content-item"},De={class:"col"},Fe=["innerHTML"],ze=e.defineComponent({__name:"field",props:{item:{},form:{},type:{},labelWidth:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(r){const n=r,s=e.ref(),o=()=>{const t=s.value?.validateState;return t&&typeof t=="object"&&"value"in t?t.value:t},a=()=>{o()==="error"&&s.value?.clearValidate?.()};return e.watch(()=>n.form?.[n.item.key],()=>{a(),e.nextTick(()=>a())},{deep:!0,flush:"post"}),(t,i)=>(e.openBlock(),e.createBlock(e.unref(u.ElFormItem),{ref_key:"formItemRef",ref:s,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",Se,[e.renderSlot(t.$slots,"form-"+t.item.key+"-start",{row:t.form,item:t.item}),e.createElementVNode("div",Ne,[e.createElementVNode("div",De,[e.renderSlot(t.$slots,"form-"+t.item.key,{row:t.form,item:t.item},()=>[t.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(u.ElInput),e.mergeProps({key:0,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[0]||(i[0]=l=>t.form[t.item.key]=l)},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(u.ElInputNumber),e.mergeProps({key:1,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[1]||(i[1]=l=>t.form[t.item.key]=l)},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(u.ElInput),e.mergeProps({key:2,type:"textarea",modelValue:t.form[t.item.key],"onUpdate:modelValue":i[2]||(i[2]=l=>t.form[t.item.key]=l)},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(u.ElSwitch),e.mergeProps({key:3,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[3]||(i[3]=l=>t.form[t.item.key]=l)},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(u.ElSelect),e.mergeProps({key:4,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[4]||(i[4]=l=>t.form[t.item.key]=l)},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||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElOption),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(u.ElRadioGroup),e.mergeProps({key:5,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[5]||(i[5]=l=>t.form[t.item.key]=l)},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||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElRadioButton),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElRadio),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="checkbox"?(e.openBlock(),e.createBlock(e.unref(u.ElCheckboxGroup),e.mergeProps({key:6,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[6]||(i[6]=l=>t.form[t.item.key]=l)},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||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElCheckboxButton),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElCheckbox),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="color"?(e.openBlock(),e.createBlock(e.unref(u.ElColorPicker),e.mergeProps({key:7,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[7]||(i[7]=l=>t.form[t.item.key]=l)},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(u.ElSlider),e.mergeProps({key:8,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[8]||(i[8]=l=>t.form[t.item.key]=l)},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(Q,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(u.ElTreeSelect),e.mergeProps({key:10,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[9]||(i[9]=l=>t.form[t.item.key]=l)},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(u.ElDatePicker),e.mergeProps({key:11,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[10]||(i[10]=l=>t.form[t.item.key]=l)},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":i[11]||(i[11]=l=>t.form[t.item.key]=l)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&(e.unref(R).customComponent[t.item.type]||e.unref(R).customComponent[t.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(R).customComponent[t.item.type]?.form||e.unref(R).customComponent[t.item.type]),e.mergeProps({key:13,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[12]||(i[12]=l=>t.form[t.item.key]=l)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+t.item.key+"-right",{row:t.form,item:t.item})]),e.renderSlot(t.$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,Fe)):e.createCommentVNode("",!0)])]),e.renderSlot(t.$slots,"form-"+t.item.key+"-end",{row:t.form,item:t.item})])]),_:3},8,["label","prop","label-width"]))}});function eo(r){return r}const Oe={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:"展开栏位",sortable:"拖拽进行排序,点击保存排序可保存排序结果",sortableStart:"排序",sortableAction:"排序操作",sortableSave:"保存排序",sortableExit:"退出排序",sortableUpdateApiRequired:"未配置排序保存接口"};class k{static t(n,...s){if(typeof n=="function")return n(...s);n=String(n);let o=0;return n.replace(/{([^}]+)}/g,(a,t)=>o<s.length?String(s[o++]):`{${t}}`)}static setI18n=n=>{k.curd=ObjectUtil.deepMerge(k.curd,n)};static tCurd(n,...s){return this.t(this.curd[n],...s)}static curd=Oe}class U{static delAllKey=n=>{Object.keys(n).forEach(s=>{delete n[s]})};static setValue=(n,s,o=!1)=>{o&&U.delAllKey(n),Object.keys(s).forEach(a=>{n[a]!==s[a]&&(n[a]=s[a])})}}const G=r=>{const n=e.reactive({}),s=()=>typeof r=="function"?r():r,o=()=>{const a=s();return a??n};return{internal:n,isExternal:()=>s()!=null,get(){return o()},set(a){U.setValue(o(),a,!0)},merge(a){U.setValue(o(),a,!1)},clear(){U.delAllKey(o())}}},K=r=>{r.forEach(n=>{console.error({field:n.field||"",error:n.error||""})})},Me=r=>r?typeof r=="string"?r:r instanceof Error?r.message:r.message||String(r):"",q=r=>!r||typeof r!="object"?[]:Object.keys(r).flatMap(n=>(Array.isArray(r[n])?r[n]:[r[n]]).map(o=>({field:o?.field||n,error:Me(o)}))),W=w.EDialog,L=r=>typeof r.type=="object"?"component":r.type||"input",$e=(r,n,s)=>{const o=G(()=>n.form),a=i=>X(i.update.formGrid||[],i.update.form,i.update.type,i.update.formMaxSpan).map(c=>c.item.key).filter(Boolean),t=async i=>{const l=s.ruleFormRef.value;if(!l)return!0;await e.nextTick();const c=a(i),f=Object.keys(i.update.rules||{}).filter(g=>!c.includes(g));if(f.length&&l.clearValidate(f),!c.length)return!0;if(!await l.validateField(c,async(g,p)=>{g||K(q(p))}))throw!1;return!0};return{update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:W.Update,get form(){return o.get()},set form(i){o.set(i)},formDefault:{},formColumn:[],formGrid:[],formMaxSpan:12,getDisabled:(i,l=!1)=>{const c=r();return n.option.table?.editMode&&l?i.disabled?.table===void 0?!1:w.isFun(i.disabled?.table,c.update.form):oe(i,c.update.type,c.update.form)},getBind:i=>{const l=r();return ne(i,l.update.type)},getOn:(i,l)=>{const c=r();return re(i,c.update.type,[l||c.update.form,i])},getOptions:i=>{const l=r();try{const f=se(l.update.formGrid?.length?l.update.formGrid:l.update.formColumn).find(d=>d.item.key===i)?.item;return f?{options:f.options,bind:l.update.getBind(f)}:{options:{},bind:{}}}catch{return{options:{},bind:{}}}},edit:{data:{},getApiData:i=>{const l=r();if(n.option.form?.editAll)return i;const c={[n.option.table?.rowKey]:l.update.edit.data[n.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(f=>{i[f]!==l.update.edit.data[f]&&(c[f]=i[f])}),c}},view:{},openLoading:!1,open:async(i,l)=>{const c=r();if(!(c.update.showContent||c.update.openLoading)){w.loading(!0),c.update.openLoading=!0;try{c.update.type=i;const f=i===W.Add;c.update.edit.data=f?void 0:JSONUtil.cp(l),c.update.title=k.tCurd(f?"add":i===W.View?"view":"edit");const d=f?ObjectUtil.deepMerge(JSONUtil.cp(c.update.formDefault),l?JSONUtil.cp(l):{}):JSONUtil.cp(l);U.setValue(c.update.form,d,!0),await c.initApiData("update"),await n.option.form?.openBefore?.(c.update.form,c.update),(!n.option.table?.inlineEdit||f)&&(c.update.show=!0,c.update.showContent=!0),n.option.form?.openAfter?.(c.update.form,c.update)}catch(f){console.error(f)}finally{w.loading(!1),c.update.openLoading=!1}}},validate:async(i=!0)=>{const l=r();try{const c=n.option.table?.editMode?l.tableEditValidate.validate():t(l);return await Promise.all([c,l.formRef.validate()]),!0}catch{return i&&w.fail(k.tCurd("checkFormData")),!1}},submit:async()=>{const i=r();if(!await i.update.validate()||i.update.loading)return;i.update.loading=!0;const c=i.update.type===W.Add?n.option.api.create:n.option.api.update;try{await n.option.form?.submitBefore?.(i.update.form,i.update)}catch{i.update.loading=!1;return}let f=ObjectUtil.deepMerge(i.update.form,{});delete f.children;const d=new Set(n.option.column.filter(g=>g.type==="datetime").map(g=>g.key));Object.keys(f).forEach(g=>{if(d.has(g)&&f[g]!=null){const p=new Date(f[g]).getTime();isNaN(p)||(f[g]=p)}});try{if(!c)return;await c({...f}),i.update.close(),await i.table.getList(),n.option.form?.submitAfter?.(f,i.update)}catch(g){console.error(g)}finally{i.update.loading=!1}},close:()=>{const i=r();i.update.show=!1,i.update.edit.data=void 0,setTimeout(()=>{i.update.showContent=!1,s.ruleFormRef.value?.resetFields?.(),o.clear()},350)}}}},$=12,P=(r,n)=>{r.isForm=n,Array.isArray(r.children)&&r.children.forEach(s=>P(s,n))},Re=r=>r.isForm===!1?!1:typeof r.show?.form=="boolean"?r.show.form:!0,ee=r=>r>$?Math.floor(r/2):r,Te=(r,n,s)=>(r.form=r.form||{span:n},s==="column"?r.form.span=r.form.span??12:r.form.span=r.form.span??n,r.form.span=ee(r.form.span),r.form.span),te=r=>{const n=r.form;return n?.row!=null&&n.row>0?ee(n.row):$},H=r=>Math.floor((r.gridRow-1)/$),oe=(r,n,s)=>{if(n===w.EDialog.View)return r.disabled?.view===void 0?!0:w.isFun(r.disabled?.view,s);const o=r.disabled?.[n===w.EDialog.Add?"create":"update"];return w.isFun(o,s)},ne=(r,n)=>{const s=L(r);return r.options?.[n===w.EDialog.Add?"formAdd":"formUpdate"]?.[s]||r.options?.[s]||{}},re=(r,n,s=[])=>{const o=L(r),t=r.options?.[n===w.EDialog.Add?"formAdd":"formUpdate"]?.[o]?.on||r.options?.[o]?.on||{},i={};return Object.keys(t).forEach(l=>{const c=t[l];typeof c=="function"?i[l]=function(...f){return c.apply(this,[...f,...s])}:i[l]=c}),i},ae=(r,n,s,o,a)=>{const t=r,i=t.colSpan??r.span;if(!r.item.form?.spanCol)return i;const l=a?.maxSpan||12,c=a?.defaultSpan||l/2,f=t.gridBand,g=n.filter(p=>f!=null?p.gridBand===f&&!w.isFun(p.item.show?.form,s,o):p.gridRow===t.gridRow&&!w.isFun(p.item.show?.form,s,o)).reduce((p,m)=>p+(m.colSpan??m.span??c),0);return i+g},Ue=(r,n)=>{const s=(o,a)=>{const t=o.gridRow,i=o.gridRow+o.rowSpan-1,l=a.gridRow,c=a.gridRow+a.rowSpan-1;return t<=c&&l<=i};return r.map(o=>r.filter(t=>s(o,t)).length!==1||o.colSpan>=n?o:{...o,span:n,colSpan:n,gridColumn:1})},le=(r,n,s={})=>{const o=new Set,a=[];let t=0,i=0;const l=m=>Math.floor(m/$)*$,c=(m,h)=>`${m},${h}`,f=(m,h,C,E)=>{if(h+C>n)return!1;for(let S=0;S<E;S++)for(let N=0;N<C;N++)if(o.has(c(m+S,h+N)))return!1;return!0},d=(m,h,C,E)=>{for(let S=0;S<E;S++)for(let N=0;N<C;N++)o.add(c(m+S,h+N))},g=(m,h,C,E)=>{for(let N=l(m);N<500*$;N+=$){const Z=N+$,x=N===l(m)?Math.max(N,m):N;for(let A=x;A<Z;A++){const _=A===m?h:0;for(let I=_;I<=n-C;I++)if(f(A,I,C,E))return{tr:A,tc:I}}}return{tr:m,tc:h}},p=(m,h,C,E)=>{const S=l(m);if(E<$&&m+E<S+$){t=m+E,i=h;return}const N=h+C;if(N<n){i=N,t=S;return}i=0,t=S+$};return r.forEach(m=>{const h=m.colSpan??(m.span===0?n:m.span),C=m.rowSpan??te(m.item);m.item.form?.rowBreak&&a.length&&(i=0,t=l(t)+$);let{tr:E,tc:S}=f(t,i,h,C)?{tr:t,tc:i}:g(t,i,h,C);f(E,S,h,C)||({tr:E,tc:S}=g(0,0,h,C)),d(E,S,h,C);const N=E+1;a.push({...m,span:h,colSpan:h,rowSpan:C,gridRow:N,gridColumn:S+1,gridBand:H({gridRow:N})}),p(E,S,h,C)}),s.fillSingleRows?Ue(a,n):a},X=(r,n,s,o=$)=>{const a=r.filter(l=>w.isFun(l.item.show?.form,n,s)),t=new Map;r.forEach(l=>{const f=`${l.gridBand??H(l)}:${l.gridColumn}:${l.colSpan}`;t.has(f)||t.set(f,[]),t.get(f).push(l)});const i=new Map;return t.forEach(l=>{const c=l.reduce((p,m)=>p+m.rowSpan,0);if(!(l.length>1&&c===$&&l.every(p=>p.rowSpan<$)))return;const d=l.filter(p=>w.isFun(p.item.show?.form,n,s));if(d.length!==1)return;const g=d[0];i.set(g.item.key,{...g,rowSpan:$})}),le(a.map(l=>i.get(l.item.key)||l),o,{fillSingleRows:!0})},ie=r=>{const n=new Map;return r.forEach(s=>{const o=s.gridBand??H(s);n.has(o)||n.set(o,[]),n.get(o).push(s)}),Array.from(n.keys()).sort((s,o)=>s-o).map(s=>n.get(s))},se=r=>r?.length?Array.isArray(r[0])?r.flat():r:[],Ae=(r,n)=>{if(!Re(r)||!r.key)return null;const s=n.defaultSpan??(n.maxSpan||12)/2,o=Te(r,s,n.layout);return{item:r,span:o}},Le=(r,n={})=>{const s=[],o=a=>{if(a.children?.length){a.children.forEach(i=>o(i));return}const t=Ae(a,n);t&&s.push(t)};return r.forEach(a=>o(a)),s},de=(r,n={})=>{const s=n.maxSpan??12,o=n.defaultSpan??s/2,a=n.layout??"row",i=Le(r,{maxSpan:s,defaultSpan:o,layout:a});if(a==="column"){const l=[];let c=1;return i.forEach(f=>{const d=te(f.item),g=s;l.push({...f,span:g,colSpan:g,rowSpan:d,gridRow:c,gridColumn:1,gridBand:H({gridRow:c})}),c+=d}),{cells:l,maxSpan:s}}return{cells:le(i,s),maxSpan:s}},He=r=>r.map(n=>n.item?.show?.form),je=(r,n,s)=>{if(!r.rules)return;const o={required:!0,message:n(r),trigger:"blur"},a=L(r),t=r.options?.datetime?.type,i=a==="datetime"&&typeof t=="string"&&t.includes("range"),l=a==="select"&&!!r.options?.select?.multiple;(i||a==="checkbox"||l)&&(o.type="array",o.min=i?2:1);const c=typeof r.rules=="boolean"?[o]:r.rules;return s?c.map(f=>s(f)):c},ce=r=>typeof r=="function"?r():r,fe=r=>(n,s)=>je(n,r,o=>{const a=(t,i)=>{if(i&&Object.prototype.hasOwnProperty.call(i,n.key)&&i[n.key]!==void 0)return i[n.key];const l=ce(s);return l&&Object.prototype.hasOwnProperty.call(l,n.key)?l[n.key]:t};if(o.validator){const t=o.validator;return{...o,validator:(i,l,c,f)=>{const d=ce(s);return t(i,a(l,f),c,d||f)}}}return o}),pe=(r,n)=>{const s={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},o=(s[L(r)||"input"]||s.input)+r.label;return(n||R.error.callback)?.(r.key,r)||o},me=r=>fe(n=>pe(n,r?.error)),Ie=(r,n,s)=>{const o={},a={},t=n?.maxSpan||12,i=n?.defaultSpan||t/2,l=me(n);r.forEach(d=>P(d,!0)),Y(r,o,a,d=>l(d,s));const{cells:c,maxSpan:f}=de(r,{maxSpan:t,defaultSpan:i,layout:n?.layout});return{formDefault:o,rules:a,formGrid:c,formMaxSpan:f,formColumn:ie(c)}},Y=(r,n,s,o)=>{const a=t=>{if(t.children?.length){t.children.forEach(i=>a(i));return}if(t.key){n[t.key]=t.value;const i=o(t);i&&(s[t.key]=i)}};r.forEach(a)},Ke={class:"curd-form-cell-inner"},ge=e.defineComponent({__name:"layout",props:{formGrid:{},maxSpan:{},form:{},type:{},stripe:{type:Boolean},labelWidth:{},formOption:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(r){const n=w.isFun,s=r,o=e.computed(()=>X(s.formGrid,s.form,s.type,s.maxSpan)),a=e.computed(()=>{const p=Array.from(new Set(o.value.map(m=>m.gridBand??H(m)))).sort((m,h)=>m-h);return new Map(p.map((m,h)=>[m,h]))}),t=e.computed(()=>({gridTemplateColumns:`repeat(${s.maxSpan}, minmax(0, 1fr))`})),i=e.computed(()=>{let p=0;return o.value.forEach(m=>{const h=m.gridRow+m.rowSpan-1;h>p&&(p=h)}),p}),l=p=>p.gridRow+p.rowSpan-1>=i.value,c=p=>p.rowSpan>=$,f=p=>{const m=p.gridBand??H(p);return a.value.get(m)??m},d=p=>ae(p,o.value,s.form,s.type,{maxSpan:s.maxSpan,defaultSpan:s.formOption?.defaultSpan}),g=p=>{const m=d(p)||p.colSpan;return{gridRow:`${p.gridRow} / span ${p.rowSpan}`,gridColumn:`${p.gridColumn} / span ${m}`}};return(p,m)=>e.unref(n)(e.unref(He)(p.formGrid),p.form,p.type)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(p.$slots,"form-start",{row:p.form}),e.createElementVNode("div",{class:e.normalizeClass(["curd-form-grid",{stripe:p.stripe!==!1}]),style:e.normalizeStyle(t.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,h=>(e.openBlock(),e.createElementBlock("div",{key:h.item.key,class:e.normalizeClass(["curd-form-grid-cell",[p.stripe!==!1&&f(h)%2===0?"stripe-band-odd":"",h.gridColumn>1?"has-col-border":"",p.stripe!==!1&&l(h)?"is-last-row":"",c(h)?"is-row-span":"",`form-item-col-${h.item.key}`]]),style:e.normalizeStyle(g(h))},[e.createElementVNode("div",Ke,[e.unref(n)(h.item.show?.form,p.form,p.type)?(e.openBlock(),e.createBlock(ze,{key:0,class:e.normalizeClass({"is-row-span-field":c(h)}),item:h.item,form:p.form,type:p.type,"label-width":p.labelWidth,"get-bind":p.getBind,"get-on":p.getOn,"get-disabled":p.getDisabled},e.createSlots({_:2},[e.renderList(p.$slots,(C,E)=>({name:E,fn:e.withCtx(S=>[e.renderSlot(p.$slots,E,e.mergeProps({ref_for:!0},S||{}))])}))]),1032,["class","item","form","type","label-width","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)])],6))),128))],6),e.renderSlot(p.$slots,"form-end",{row:p.form})],64)):e.createCommentVNode("",!0)}}),be=e.defineComponent({__name:"column",props:{option:{default:()=>({form:{},column:[]})},type:{default:""},form:{default:void 0}},setup(r,{expose:n}){const s=w.EDialog,o=e.ref(),a=r;let t=G(a.form);const i=J.Scope.getConf("curdConf"),l="formRef-"+StrUtil.getId();e.onUnmounted(()=>{i?.formRef?.remove(l)});const c=e.reactive({rules:{},show:!0,formDefault:{},type:a.type||i?.update?.type||s.Add,formColumn:[],formGrid:[],formMaxSpan:12,get form(){return t.get()},set form(f){t.set(f)},getDisabled:f=>oe(f,c.type,c.form),getBind:f=>ne(f,c.type),getOn:f=>re(f,c.type,[c.form,f]),initColumnForm:()=>{const f=t,d=Ie(a.option.column,a.option.form,()=>f.get());c.formDefault=d.formDefault,c.rules=d.rules,c.formGrid=d.formGrid,c.formMaxSpan=d.formMaxSpan,c.formColumn=d.formColumn,c.type===s.Add?f.isExternal()?f.merge(JSONUtil.cp(c.formDefault)):f.set(JSONUtil.cp(c.formDefault)):!f.isExternal()&&a.form&&f.set(JSONUtil.cp(a.form))}});return i?.formRef?.set(l,{validate:async f=>{const d=o.value;if(!d)return f?.(!0),!0;await e.nextTick();const g=X(c.formGrid||[],c.form,c.type,c.formMaxSpan).map(h=>h.item.key).filter(Boolean),p=Object.keys(c.rules||{}).filter(h=>!g.includes(h));if(p.length&&d.clearValidate(p),!g.length)return f?.(!0),!0;const m=await d.validateField(g,async(h,C)=>{h||K(q(C))});if(f?.(!!m),!m)throw!1;return!0}}),a.option.form?.initStart?.(c),c.initColumnForm(),a.option.form?.initEnd?.(c),e.watch(()=>a.form,f=>{t=G(f),c.initColumnForm()}),n({ref:o,conf:c}),(f,d)=>(e.openBlock(),e.createBlock(e.unref(u.ElForm),{ref_key:"ruleFormRef",ref:o,model:c.form,rules:c.rules},{default:e.withCtx(()=>[c.show?(e.openBlock(),e.createBlock(ge,{key:0,"form-grid":c.formGrid,"max-span":c.formMaxSpan,form:c.form,type:c.type,stripe:r.option.form?.stripe,"label-width":r.option.form?.labelWidth||"100px","form-option":r.option.form,"get-bind":c.getBind,"get-on":c.getOn,"get-disabled":c.getDisabled},e.createSlots({_:2},[e.renderList(f.$slots,(g,p)=>({name:p,fn:e.withCtx(m=>[e.renderSlot(f.$slots,p,e.normalizeProps(e.guardReactiveProps(m||{})))])}))]),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"]))}}),Ge=r=>r?.value||r,qe=r=>{const n=Ge(r);return n?.validate?new Promise((s,o)=>{let a=!1;const t=(i,l)=>{a||(a=!0,i===!1?(K(q(l)),o(!1)):s(!0))};try{const i=n.validate(t);i&&typeof i.then=="function"?i.then(l=>t(l)).catch(l=>{K(q(l?.fields||l)),o(l)}):(i!==void 0||n.validate.length===0)&&t(i)}catch(i){o(i)}}):Promise.resolve(!0)},We=()=>{const r=e.reactive({formRef:{map:{},set(n,s){r.formRef.map[n]=s},remove(n){delete r.formRef.map[n]},validate(){const n=Object.keys(r.formRef.map).map(s=>r.formRef.map[s]);return Promise.all(n.map(s=>qe(s))).then(()=>!0)}},regFormRef(n,s,o){n?o?r.formRef.set(s,{validate:async a=>{try{a(await o())}catch{a(!1)}}}):r.formRef.set(s,n):r.formRef.remove(s)}});return r},Pe=(r,n)=>{const s=G(()=>n.searchForm);return{search:{column:{list:[]},get form(){return s.get()},set form(o){s.set(o)},formDefault:{},getPlaceholder:(o,a=k.tCurd("placeholderInput"))=>o.text?.search?.placeholder===void 0?`${a}${o.label}`:o.text?.search?.placeholder,getFormData:()=>{const o=r();let a={};n.option.column.forEach(i=>{(typeof i.show?.search=="function"?i.show?.search(o.search.form):i.show?.search)&&(a[i.key]=o.search.form[i.key])});const t=n.option.search?.before?.(a);return t&&(a=t),a},reset:()=>{const o=r(),a=o.search.formDefault;Object.keys(a).forEach(i=>{n.option.search?.resetMode==="none"?a[i]=void 0:a[i]=o.search.formDefault[i]});const t=ObjectUtil.deepMerge(a,{});U.setValue(o.search.form,t,!0),o.page.num=1,n.option.init!==!1&&o.table.getList()},submit:()=>{const o=r();o.page.num=1,o.table.getList()}}}},Je=(r,n)=>({page:{num:1,total:0,layout:n.option.page?.layout||V.config.pagination.layout,showTools:n.option.page?.showTools||V.config.pagination.showTools,size:n.option.page?.size||V.config.pagination.size,sizeList:n.option.page?.sizeList||V.config.pagination.pageSizes,pagerCount:n.option.page?.pagerCount||V.config.pagination.pagerCount,getQuery:(s={})=>{const o=r();return{[V.config.field.page.size]:s.size||o.page.size,[V.config.field.page.num]:s.num||o.page.num,...o.search.getFormData()}}}}),Qe=(r,n,s)=>{const o=r;return{table:{op:{width:(...a)=>a.filter(i=>i).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,t)=>{},all:()=>{const a=o();if(a.table.expand.isExpand)a.table.expand.rowKeys=[];else{const t=i=>{let l=[];return i.forEach(c=>{l.push(c[n.option.table.rowKey]),c.children?.length&&(l=l.concat(t(c.children)))}),l};a.table.expand.rowKeys=t(a.table.data)}a.table.expand.isExpand=!a.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},sortable:{mode:!1,actionLoading:!1,instance:void 0,modulePromise:void 0,getOption:()=>n.option.table?.sortable||{},showTriggerButton:()=>{const a=o();return n.option.table?.sortable?.button&&!a.table.sortable.mode},showActionButton:()=>{const a=o();return n.option.table?.sortable?.button&&a.table.sortable.mode},showSaveButton:()=>!n.option.table?.sortable?.button&&n.option.table?.sortable?.show&&n.option.table?.sortable?.saveButton,isActive:()=>{const a=o(),t=a.table.sortable.getOption();return t.button?a.table.sortable.mode:!!t.show},showPagination:()=>{const a=o();return!a.table.sortable.isActive()||a.table.sortable.getOption().page},disableScroll:()=>{const a=o(),t=a.table.sortable.getOption();return a.table.sortable.isActive()&&!t.page&&!t.scroll},getTableBindOption:()=>{const a=o();return{...n.option.table||{},...a.table.sortable.disableScroll()?{height:void 0,maxHeight:void 0}:{}}},getColumnBind:()=>{const{show:a,button:t,page:i,scroll:l,field:c,rule:f,api:d,onEnd:g,...p}=o().table.sortable.getOption();return p},destroy:()=>{const a=o();a.table.sortable.instance?.destroy(),a.table.sortable.instance=void 0},getBody:()=>s.tableRef.value?.$el?.querySelector(".el-table__body-wrapper tbody"),loadModule:async()=>{const a=o();a.table.sortable.modulePromise??=w.loadModule("sortablejs");const t=await a.table.sortable.modulePromise;return t.default||t},applyRule:(a,t,i,l)=>{if(i==="value"){a.forEach((c,f)=>{c[t]=l[f]});return}a.forEach((c,f)=>{c[t]=f+1})},sync:async()=>{const a=o();if(a.table.sortable.destroy(),!a.table.sortable.isActive()||a.table.loading)return;await e.nextTick();const t=a.table.sortable.getBody();if(!t)return;const i=await a.table.sortable.loadModule(),l=a.table.sortable.getOption();a.table.sortable.instance=i.create(t,{animation:150,handle:".cc1-form-drag-handle",draggable:".el-table__row",onEnd:({oldIndex:c,newIndex:f})=>{const d=(p,m,h)=>{if(!Number.isInteger(m)||!Number.isInteger(h)||m===h||m<0||h<0||m>=p.length||h>=p.length)return;const C=p.splice(m,1)[0];p.splice(h,0,C)},g=a.table.data.map(p=>p?.[l.field]);d(a.table.data,c,f),l.onEnd?l.onEnd(a.table.data):a.table.sortable.applyRule(a.table.data,l.field,l.rule,g)}})},refreshList:async()=>{const a=o();await a.table.getList(a.table.sortable.isActive()?"sortable":void 0),a.table.sortable.sync()},fitHeight:!1,start:async()=>{const a=o(),t=a.table?.sortable.getOption();a.table.sortable.fitHeight=n.option.table.fitHeight,t.scroll||(n.option.table.fitHeight=!1),a.table.sortable.mode=!0,await a.table.sortable.refreshList()},exit:async()=>{const a=o();n.option.table.fitHeight=a.table.sortable.fitHeight,await a.table.getList(),a.table.sortable.mode=!1,a.table.sortable.destroy()},save:async()=>{const a=o(),i=a.table.sortable.getOption().api?.update||n.option.api.update;if(!i){w.fail(k.tCurd("sortableUpdateApiRequired"));return}a.table.sortable.actionLoading=!0,a.table.loading=!0;try{await i(a.table.data,"sortable"),w.success(k.tCurd("operationSuccess")),await a.table.sortable.exit()}catch(l){console.error(l)}finally{a.table.sortable.actionLoading=!1,a.table.loading=!1}},command:async a=>{const t=o();if(a==="save"){await t.table.sortable.save();return}await t.table.sortable.exit()}},header:{group:{expand:!1,toggleExpandAll:()=>{const a=o(),t=!a.table.header.group.expand;a.table.header.group.expand=t;const i=l=>{l.forEach(c=>{c.table?.header?.group!==void 0&&(c.table.header.group=!t),c.table?.header?.groupKey!==void 0&&(c.table.header.show=t),Array.isArray(c.children)&&c.children.length&&i(c.children)})};i(a.table.column.list)}}},parseListResult:async a=>{const t=o(),i=V.config.field.result,l=a?.data||{[i.list]:a},c=(Array.isArray(l[i.list]),l[i.list]),f=se(t.update.formGrid?.length?t.update.formGrid:t.update.formColumn),g=ObjectUtil.deepMerge({data:c},{}).data.map(p=>(Object.keys(p).forEach(h=>{const C=f.find(E=>E.item.key===h);C&&["select","radio"].includes(C.item.type)&&(C.item.table.format||(C.item.table.format=E=>C.item.options[C.item.type].data?.find(S=>S.value==E[h])?.label||E[h]))}),p));return{data:n.option.data?await n.option.data(g,c):g,total:l[i.total]||0}},applyListResult:async(a,t)=>{const i=o(),l=await i.table.parseListResult(a);return i.table.data=l.data,i.page.total=t??l.total,i.tableEditValidate?.clear?.(),l},getList:async a=>{const t=o();t.table.loading=!0;const i=n.option.table?.sortable,l=a==="sortable"&&i?.api?.list||n.option.api.list,c=JSONUtil.cp(t.table.selection.list);try{await t.initApiData("init");let f={};if(t.table.sort.prop){const{props:p,order:m}=V.config.table.sort;f={[p.field]:t.table.sort.prop,[m.field]:t.table.sort.order}}const d=a==="sortable"&&i?.page===!1?t.page.getQuery({num:1,size:t.page.total||999999}):t.page.getQuery(),g=await l({...d,...f},a);await t.table.applyListResult(g,a==="sortable"&&i?.page===!1?t.page.total:void 0),setTimeout(()=>{t.table.selection.setList(c),n.option.table?.sortable?.show&&!n.option.table?.sortable?.button&&t.table.sortable.sync()},20)}catch(f){console.error(f)}finally{t.table.loading=!1}},selection:{list:[],change:a=>{o().table.selection.list=a},setList:(a,t)=>{const i=o();i.table.selection.list=[];const l=s.tableRef.value;if(l?.clearSelection(),!l||!a?.length)return;const c=n.option.table?.rowKey,f=d=>{const g=p=>{for(const m of p){if(c!=null&&c!==""){if(m[c]===d[c])return m}else if(m===d)return m;if(Array.isArray(m.children)&&m.children.length){const h=g(m.children);if(h!==void 0)return h}}};return g(i.table.data)};a.forEach(d=>{const g=f(d);if(g)if(t){const p=()=>l.toggleRowSelection(g,!0,!1);t(d)!==!1&&p()}else l.toggleRowSelection(g,!0,!1)})}},sort:{prop:"",order:"",change:a=>{const t=o();V.config.table.sort.resetPage&&(t.page.num=1);const i=V.config.table.sort;if(i.change){i.change(a,t);return}t.table.sort.prop=a.prop,a.order===null?(t.table.sort.order="",t.table.sort.prop=""):t.table.sort.order=a.order==="ascending"?i.order.asc:i.order.desc,t.table.getList()}}}}},Xe=(r,n)=>{const s=e.reactive({}),o=new WeakMap;let a=0;const t=b=>{let y=o.get(b);return y||(a+=1,y=`fallback-${a}`,o.set(b,y)),y},i=b=>{const y=n.option.table?.rowKey,B=y?b[y]:void 0;return B!=null&&B!==""?String(B):t(b)},l=(b,y)=>`${i(b)}-${y.key}`,c=b=>pe(b,n.option.form?.error),f=fe(c),d=()=>{Object.keys(s).forEach(b=>{delete s[b]})},g=(b,y)=>{delete s[l(b,y)]},p=(b,y)=>s[l(b,y)]||"",m=(b,y)=>b.message||c(y),h=b=>b==null||b===""||Array.isArray(b)&&b.length===0,C=b=>{if(typeof b=="number")return b;if(typeof b=="string"||Array.isArray(b))return b.length},E=(b,y)=>{if(b==="array")return Array.isArray(y);if(b==="integer")return typeof y=="number"&&Number.isInteger(y);if(b==="float")return typeof y=="number"&&!Number.isInteger(y);if(b==="number")return typeof y=="number"&&!Number.isNaN(y);if(b==="boolean")return typeof y=="boolean";if(b==="object")return y!==null&&typeof y=="object"&&!Array.isArray(y);if(b==="date")return y instanceof Date||!Number.isNaN(new Date(y).getTime());if(b==="email")return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(y));if(b==="url")try{return new URL(String(y)),!0}catch{return!1}return b==="string"?typeof y=="string":!0},S=(b,y,B)=>typeof b.validator!="function"?Promise.resolve(!0):new Promise(z=>{let O=!1;const D=M=>{if(!O){if(O=!0,M==null){z(!0);return}if(M instanceof Error){z(M.message||m(b,B));return}if(Array.isArray(M)){const v=M[0];z(v instanceof Error?v.message:String(v||m(b,B)));return}z(String(M))}};try{const M=b.validator(b,y,D);M&&typeof M.then=="function"?M.then(()=>D()).catch(D):M===!1?D(m(b,B)):typeof M=="string"||M instanceof Error?D(M):b.validator.length<3&&D()}catch(M){D(M)}}),N=async(b,y,B)=>{const z=typeof b.transform=="function"?b.transform(y):y,O=h(z);if(b.required&&O)return m(b,B);if(O&&!b.required)return!0;if(b.whitespace&&typeof z=="string"&&z.trim()===""||b.type&&!E(b.type,z)||Array.isArray(b.enum)&&!b.enum.includes(z)||b.pattern&&!new RegExp(b.pattern).test(String(z)))return m(b,B);const D=C(z);return b.len!==void 0&&D!==void 0&&D!==b.len||b.min!==void 0&&D!==void 0&&D<b.min||b.max!==void 0&&D!==void 0&&D>b.max?m(b,B):S(b,z,B)},Z=b=>{const y=r();return!b.key||!y.table.column.show.list.includes(b.key)||b.table?.header?.groupKey!==void 0&&!b.table.header.show?!1:b.show?.table!==void 0?w.isFun(b.show?.table,y.table.data):!0},x=(b,y)=>b.show?.form!==void 0?w.isFun(b.show.form,y,w.EDialog.Update):!0,A=()=>{const b=r(),y=[],B=z=>{z.forEach(O=>{if(Z(O)){if(O.children?.length){B(O.children);return}y.push(O)}})};return B(b.table.column.list),y},_=async(b,y)=>{if(!x(y,b))return g(b,y),!0;const B=f(y,b);if(!B)return!0;g(b,y);const z=Array.isArray(B)?B:[B];for(const O of z){const D=await N(O,b[y.key],y);if(D!==!0)return s[l(b,y)]=D,{field:y.key,error:D}}return!0},I=b=>{const y=[],B=z=>{z.forEach(O=>{y.push(O),Array.isArray(O.children)&&O.children.length&&B(O.children)})};return B(b),y};return{tableEditValidate:{errors:s,clear:d,clearField:g,getFieldError:p,validate:async()=>{if(d(),!n.option.table?.editMode)return!0;const b=r(),y=A(),B=I(b.table.data||[]),O=(await Promise.all(B.flatMap(D=>y.map(M=>_(D,M))))).filter(D=>D!==!0);if(O.length)throw K(O),!1;return!0}}}};class ue{static exportToExcel=async(n,s,o)=>{if(!n||n.length===0)return;const a=await w.loadModule("xlsx"),t=n.map(c=>{const f={};return s.forEach(d=>{f[d.label]=c[d.key]}),f}),i=a.utils.json_to_sheet(t),l=a.utils.book_new();a.utils.book_append_sheet(l,i,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(l,`${o}.xlsx`)}}const Ye=(r,n)=>({export:{run:{start:async s=>{let a=await r().export.run[s]();const t=n.option.column,i=ObjectUtil.deepMerge({data:a,columns:t},{}),l=n.option.tools?.export||{};l.before?.(i),ue.exportToExcel(i.data,i.columns,l.fileName)},select:async()=>{const s=r();s.export.loading=!0;try{if(n.option.tools?.export?.select){await n.option.tools.export.select({...s.page.getQuery(),items:s.table.selection.list});return}if(s.table.selection.list.length===0)throw w.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return s.table.selection.list}catch(o){console.error(o)}finally{s.export.loading=!1}},page:async()=>{const s=r();s.export.loading=!0;try{if(n.option.tools?.export?.page){await n.option.tools.export.page({...s.page.getQuery()});return}if(s.table.data.length===0)throw w.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return s.table.data}catch(o){console.error(o)}finally{s.export.loading=!1}},all:async()=>{const s=r();s.export.loading=!0;try{if(n.option.tools?.export?.all){await n.option.tools.export.all({...s.page.getQuery()});return}const o=n.option.api.list,a=await o({...s.page.getQuery({size:999999,num:1})});return(a.data||{[V.config.field.result.list]:a})[V.config.field.result.list]}catch(o){console.error(o)}finally{s.export.loading=!1}}},loading:!1,click:s=>{const o=r();o.export.loading||o.export.run.start(s)}}}),Ze=(r,n)=>({remove:{title:k.tCurd("deleteTitle"),show:!1,items:[],loading:!1,close:()=>{r().remove.show=!1},open:s=>{if(s.length===0){w.fail(k.tCurd("selectDataToDelete"));return}const o=r();o.remove.items=s,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{const s=r();s.remove.loading=!0;const o=n.option.api.delete;try{if(!o)return;await o({[n.option.table?.rowKey]:s.remove.items.map(a=>a[n.option.table?.rowKey]),items:s.remove.items}),w.success(k.tCurd("operationSuccess")),s.table.data.length<=1&&s.page.num>1&&(s.page.num-=1),s.remove.close(),await s.table.getList()}catch(a){console.error(a)}finally{s.remove.loading=!1}})}}}),xe=(r,n,s)=>({apiDataMap:{},getColumnSpan:(o,a)=>{const t=r(),i=t.update.formGrid?.length?t.update.formGrid:a||[];return ae(o,i,t.update.form,t.update.type,{maxSpan:t.update.formMaxSpan||n.option.form?.maxSpan,defaultSpan:n.option.form?.defaultSpan||V.config.form.defaultSpan})},init:()=>{const o=r();o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},initApiData:async o=>{const a=r(),t=[],i=l=>{if(l.children?.length){l.children.forEach(f=>i(f));return}const c=L(l);if(l.options?.[c]?.dataApi&&l.options?.[c]?.dataApiConfig?.[o]){if(a.apiDataMap[l.key]&&l.options?.[c]?.dataApiConfig?.once)return;const f=(async()=>{try{let d=await l.options?.[c]?.dataApi?.(a.update.form,a.update.type);if(d){const g=l.options?.[c]?.dataPath;!Array.isArray(d)&&g&&(d=ObjectUtil.getPathValue(d,g)),l.options[c].data=d,l.options.search[c].data=d,l.options.search[l.options.search.type??c]||(l.options.search[l.options.search.type??c]={}),l.options.search[l.options.search.type??c].data=d,l.options.formAdd[c].data=d,l.options.formUpdate[c].data=d,a.apiDataMap[l.key]=d}}catch{}})();t.push(f)}};return n.option.column.forEach(l=>i(l)),await Promise.all(t),!0},initCurdConfig:()=>{const o=ObjectUtil.deepMerge(V.config,{});o.table.emptyText=k.tCurd("noData"),n.option.size=n.option.size||{},o.table.size=n.option.size.table||o.size.table,o.form.size=n.option.size.form||o.size.form,o.size.search=n.option.size.search||o.size.search;const a=ObjectUtil.deepMerge(o,n.option||{});Object.keys(a).forEach(t=>{n.option[t]=a[t]})},initColumnOptions:()=>{const o=r();let a=JSONUtil.cp(V.config.columnConfig);a.options=ObjectUtil.deepMerge({switch:{activeText:k.tCurd("switchOn"),inactiveText:k.tCurd("switchOff")}},a.options);const t=i=>{const l=L(i);for(const f in a){if(f==="table"){if(i.table=ObjectUtil.deepMerge(a.table,i.table||{}),i.children){i.children.forEach(d=>t(d));return}}else f==="type"?i.type=i.type||a.type:i[f]=ObjectUtil.deepMerge(a[f],i[f]||{});i.options=i.options||{},i.options[l]=i.options[l]||{},i.options[l].size=n.option.size.form}["search","formAdd","formUpdate"].forEach(f=>{i.options[f]=ObjectUtil.deepMerge(i.options,i.options[f]||{}),f==="search"?n.option.size.search&&(i.options[f][l].size=n.option.size.search):n.option.size.form&&(i.options[f][l].size=n.option.size.form)}),i.table=ObjectUtil.deepMerge(i.table,i.options[l].table||{}),l==="switch"&&(i.options.switch.tableBeforeChange=async(f,d)=>{const g=i.options?.switch;try{g.tableConfig?.confirm&&await s.switchConfirmRef.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")});try{if(!n.option.api.update&&!g.tableConfig?.api)return;const p=d[n.option.table?.rowKey];g.loadingMap||(g.loadingMap={}),g.loadingMap[p]||(g.loadingMap[p]={loading:!1}),g.loadingMap[p].loading=!0;const m=d[f]===g.activeValue?g.inactiveValue:g.activeValue,h=g.tableConfig?.api?g.tableConfig.api:n.option.api.update;if(!h)return;try{await h({...d,[f]:m},"switch")}catch{return!1}finally{g.loadingMap[p].loading=!1}return w.success(k.tCurd("operationSuccess")),g.tableConfig?.loadList&&(o.table.loading=!0,o.table.getList(),o.table.loading=!1),!0}catch(p){return console.error(p),!1}finally{o.table.loading=!1}}catch{return!1}}),l==="treeSelect"&&(i.options.treeSelect.rowKey=n.option.table?.rowKey,i.options.treeSelect.nodeKey=n.option.table?.rowKey)};n.option.column.forEach(t),n.option.table?.column?.forEach(t)},initColumnForm:()=>{const o=r(),a=n.option;o.update.formColumn=[],o.update.formGrid=[],o.update.formMaxSpan=12,o.table.column.show={list:[],listSource:[]};const t=n.option.form?.maxSpan||12,i=n.option.form?.defaultSpan||t/2,l=me(n.option.form),c=p=>{if(p.children){o.table.column.show.list.push(p.key),p.children.forEach(m=>c(m));return}o.update.formDefault[p.key]=p.value,p.table?.table&&(p.show?.table&&o.table.column.show.list.push(p.key),o.table.column.show.listSource.push(p.key))};a.column.forEach(p=>{P(p,!0),c(p)}),n.option.table?.column?.forEach(p=>{P(p,!1),c(p)}),o.search.column.list=a.column.concat(a.table?.column||[]),o.table.column.list=o.search.column.list.filter(p=>p.table?.table),o.search.column.list.sort((p,m)=>p.sort?.search-m.sort?.search),o.table.column.list.sort((p,m)=>p.sort?.table-m.sort?.table),o.update.rules={},Y(a.column,o.update.formDefault,o.update.rules,p=>l(p,()=>o.update.form)),a.table?.editMode&&Y(a.table?.column||[],o.update.formDefault,o.update.rules,p=>l(p,()=>o.update.form));const f=de(a.column,{maxSpan:t,defaultSpan:i,layout:n.option.form?.layout});o.update.formGrid=f.cells,o.update.formMaxSpan=f.maxSpan,o.update.formColumn=ie(f.cells);const d=n.option.search?.formDefault;d&&Object.keys(d).forEach(p=>{o.search.formDefault[p]=d[p]}),a.column.forEach(p=>{p.show?.search||(o.search.formDefault[p.key]=void 0)});const g=ObjectUtil.deepMerge(o.search.formDefault,{});U.setValue(o.search.form,g,!0)}}),_e=r=>{const n=e.ref(),s=e.ref(),o=e.ref(),a={switchConfirmRef:n,ruleFormRef:s,tableRef:o},t=e.getCurrentInstance(),i=J.Scope.getConf("curdConf"),l=g=>{g=g||f;let p=g,m=g;for(;p?.parentCurdConf;)m=p.parentCurdConf,p=p.parentCurdConf;return m},c=()=>f;let f=e.reactive({parentCurdConf:i,getCurdConf:l,getRootCurdConf:l,...We(),option:r.option,...Pe(c,r),...Je(c,r),...Qe(c,r,a),...Xe(c,r),...Ye(c,r),...$e(c,r,a),...Ze(c,r),...xe(c,r,a)});f.init();const d=t?`curdRef-${t.uid}`:"";return i?.formRef&&d&&(i.formRef.set(d,{validate:async g=>{const p=await f.update.validate(!1);if(g?.(!!p),!p)throw!1;return!0}}),e.onUnmounted(()=>{i.formRef.remove(d)})),e.onMounted(()=>{if(r.option.init!==!1){if(r.option.table?.sortable?.show&&!r.option.table?.sortable?.button){(f.table?.sortable.getOption()).scroll||(r.option.table.fitHeight=!1),f.table.sortable.refreshList();return}f.table.getList()}}),e.onBeforeUnmount(()=>{f.table.sortable.destroy()}),J.Scope.setConf("curdConf",f),{conf:f,switchConfirmRef:n,ruleFormRef:s,tableRef:o}},ve={class:"dialog-footer"},et=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(r,{expose:n}){const s=e.ref(!1),o=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let t=null,i=null;const l=d=>(d?.title&&(o.value=d.title),d?.content&&(a.value=d.content),s.value=!0,new Promise((g,p)=>{t=g,i=p})),c=()=>{s.value=!1,t?.(!0),t=null,i=null},f=()=>{s.value=!1,i?.(new Error("用户取消操作")),t=null,i=null};return n({open:l}),(d,g)=>{const p=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(u.ElDialog),{modelValue:s.value,"onUpdate:modelValue":g[0]||(g[0]=m=>s.value=m),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(p,{size:d.size},{default:e.withCtx(()=>[e.createElementVNode("span",ve,[e.createVNode(e.unref(u.ElButton),{onClick:f},{default:e.withCtx(()=>g[1]||(g[1]=[e.createTextVNode("取消")])),_:1}),e.createVNode(e.unref(u.ElButton),{type:"primary",onClick:c},{default:e.withCtx(()=>g[2]||(g[2]=[e.createTextVNode("确认")])),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"])}}}),tt=["innerHTML"],ot=e.defineComponent({__name:"text",props:{content:{},value:{}},setup(r){const n=r,s=e.computed(()=>typeof n.content=="function"?n.content(n.value):n.content);return(o,a)=>typeof s.value=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value),{key:0})):(e.openBlock(),e.createElementBlock("div",{key:1,innerHTML:s.value},null,8,tt))}}),he=e.defineComponent({__name:"searchField",props:{item:{},conf:{},type:{}},setup(r){const n=r,s=e.computed({get:()=>n.conf.search.form?.[n.item?.key],set:o=>{n.item?.key!==void 0&&(n.conf.search.form[n.item.key]=o)}});return(o,a)=>e.unref(R).customComponent[o.type??""]?.search?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(R).customComponent[o.type??""]?.search),e.mergeProps({key:0,modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=t=>s.value=t)},o.item.options?.search?.[o.type??""],e.toHandlers(o.item.options?.search?.[o.type??""]?.on||{})),null,16,["modelValue"])):o.type==="input"?(e.openBlock(),e.createBlock(e.unref(u.ElInput),e.mergeProps({key:1,modelValue:s.value,"onUpdate:modelValue":a[1]||(a[1]=t=>s.value=t),placeholder:o.conf.search.getPlaceholder(o.item),clearable:"",disabled:o.item.disabled?.search},o.item.options?.search?.input||o.item.options?.input,e.toHandlers(o.item.options?.search?.input?.on||o.item.options?.input?.on||{})),null,16,["modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(u.ElSelect),e.mergeProps({key:2,modelValue:s.value,"onUpdate:modelValue":a[2]||(a[2]=t=>s.value=t),placeholder:o.conf.search.getPlaceholder(o.item,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.item.disabled?.search},o.item.options?.search?.switch||o.item.options?.switch,e.toHandlers(o.item.options?.search?.switch?.on||o.item.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:o.item.options?.switch?.activeValue,label:o.item.options?.switch?.activeText,value:o.item.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:o.item.options?.switch?.inactiveValue,label:o.item.options?.switch?.inactiveText,value:o.item.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:1},16,["modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(u.ElSelect),e.mergeProps({key:3,modelValue:s.value,"onUpdate:modelValue":a[3]||(a[3]=t=>s.value=t),placeholder:o.conf.search.getPlaceholder(o.item,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.item.disabled?.search},o.item.options?.search?.select||o.item.options?.select,e.toHandlers(o.item.options?.search?.select?.on||o.item.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.options?.search?.select?.data||o.item.options?.select?.data||[],t=>(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","placeholder","disabled"])):o.type==="radio"?(e.openBlock(),e.createBlock(e.unref(u.ElRadioGroup),e.mergeProps({key:4,modelValue:s.value,"onUpdate:modelValue":a[4]||(a[4]=t=>s.value=t),disabled:o.item.disabled?.search},o.item.options?.search?.radio||o.item.options?.radio,e.toHandlers(o.item.options?.search?.radio?.on||o.item.options?.radio?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.options?.radio?.data,t=>(e.openBlock(),e.createBlock(e.unref(u.ElRadio),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(u.ElDatePicker),e.mergeProps({key:5,modelValue:s.value,"onUpdate:modelValue":a[5]||(a[5]=t=>s.value=t),disabled:o.item.disabled?.search},o.item.options?.search?.datetime||o.item.options?.datetime,e.toHandlers(o.item.options?.search?.datetime?.on||o.item.options?.datetime?.on||{})),null,16,["modelValue","disabled"])):o.type&&e.unref(R).customComponent[o.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(R).customComponent[o.type]),e.mergeProps({key:6,modelValue:s.value,"onUpdate:modelValue":a[6]||(a[6]=t=>s.value=t)},o.item.options?.search?.[o.type]||o.item.options?.[o.type],e.toHandlers(o.item.options?.search?.[o.type]?.on||o.item.options?.[o.type]?.on||{}),{disabled:o.item.disabled?.search}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}),j=(r,n)=>{const s=r.__vccOpts||r;for(const[o,a]of n)s[o]=a;return s},nt={},rt={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function at(r,n){return e.openBlock(),e.createElementBlock("svg",rt,n[0]||(n[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 lt=j(nt,[["render",at]]),it={},st={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function dt(r,n){return e.openBlock(),e.createElementBlock("svg",st,n[0]||(n[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 ct=j(it,[["render",dt]]),ft={},pt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function mt(r,n){return e.openBlock(),e.createElementBlock("svg",pt,n[0]||(n[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 gt=j(ft,[["render",mt]]),bt={},ut={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function ht(r,n){return e.openBlock(),e.createElementBlock("svg",ut,n[0]||(n[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 ye=j(bt,[["render",ht]]),yt={},kt={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function wt(r,n){return e.openBlock(),e.createElementBlock("svg",kt,n[0]||(n[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 Ct=j(yt,[["render",wt]]),Bt={},Vt={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function Et(r,n){return e.openBlock(),e.createElementBlock("svg",Vt,n[0]||(n[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 St=j(Bt,[["render",Et]]),Nt={class:"row flex-center table-header-label inline"},Dt={class:"table-header-tooltip"},Ft=["innerHTML"],zt={key:1,class:"table-header-required"},Ot=["onClick"],Mt={key:0,class:"table-edit-form"},$t={key:1},Rt=["onClick","innerHTML"],Tt=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(r){const n=w.isFun,s=r,a=e.getCurrentInstance().type,t=l=>l===!0?!0:(Array.isArray(l)?l:l?[l]:[]).some(f=>f?.required===!0),i=l=>s.option.table?.editMode?t(l.rules)||t(s.conf.update.rules?.[l.key]):!1;return(l,c)=>{const f=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.columnList,d=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d.key},[l.conf.table.column.show.list.includes(d.key)&&(d.show?.table===void 0||e.unref(n)(d.show?.table,l.conf.table.data))?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.table?.header?.groupKey===void 0||d.table.header.show?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:0,prop:d.key,label:d.label,ref_for:!0},d.table),{header:e.withCtx(()=>[e.renderSlot(l.$slots,"table-header-"+d.key,{item:d},()=>[e.createElementVNode("div",Nt,[d.table?.header?.tooltip?(e.openBlock(),e.createBlock(f,{key:0,effect:"dark",placement:"top"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:d.table?.header?.tooltip},null,8,Ft)]),default:e.withCtx(()=>[e.createElementVNode("span",Dt,[e.createVNode(ye)])]),_:2},1024)):e.createCommentVNode("",!0),i(d)?(e.openBlock(),e.createElementBlock("span",zt,"*")):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(d.label)+" ",1),d.table?.header?.group!==void 0?(e.openBlock(),e.createElementBlock("span",{key:2,class:"table-header-plus",onClick:e.withModifiers(()=>{d.table.header.group=!d.table.header.group,l.columnList.forEach(g=>{g.table?.header?.groupKey===d.key&&(g.table.header.show=!d.table.header.group)})},["stop"])},[d.table.header.group?(e.openBlock(),e.createBlock(Ct,{key:0})):(e.openBlock(),e.createBlock(St,{key:1}))],8,Ot)):e.createCommentVNode("",!0)])])]),default:e.withCtx(({row:g})=>[d.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c[0]||(c[0]=e.createTextVNode("   ")),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(a)),{conf:l.conf,columnList:d.children,option:l.option},e.createSlots({_:2},[e.renderList(l.$slots,(p,m)=>({name:m,fn:e.withCtx(h=>[e.renderSlot(l.$slots,m,e.mergeProps({ref_for:!0},h||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l.option.table?.editMode?(e.openBlock(),e.createElementBlock("div",Mt,[e.createVNode(e.unref(u.ElFormItem),{size:l.option.size?.table,error:l.conf.tableEditValidate.getFieldError(g,d),class:"table-edit-form-item"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["row",["table-edit-"+d.key]]),style:{width:"100%"}},[e.renderSlot(l.$slots,"table-edit-left-"+d.key,{row:g,item:d}),d.type==="input"?(e.openBlock(),e.createBlock(e.unref(u.ElInput),e.mergeProps({key:0,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),class:"col",ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{"onUpdate:modelValue":p=>l.conf.tableEditValidate.clearField(g,d)}),e.createSlots({_:2},[d.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof d.options?.input?.prepend=="function"?d.options?.input?.prepend(g):d.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):d.type==="select"?(e.openBlock(),e.createBlock(e.unref(u.ElSelect),e.mergeProps({key:1,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),class:"col",ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{"onUpdate:modelValue":p=>l.conf.tableEditValidate.clearField(g,d)}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.options?.search?.select?.data||d.options?.select?.data,p=>(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):d.type==="switch"?(e.openBlock(),e.createBlock(e.unref(u.ElSwitch),e.mergeProps({key:2,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),class:"col",ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{"onUpdate:modelValue":p=>l.conf.tableEditValidate.clearField(g,d)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"table-edit-right-"+d.key,{row:g,item:d})],2)]),_:2},1032,["size","error"])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l.conf.update.type===e.unref(w).EDialog.Update&&e.unref(n)(d.show?.form,l.conf.update.form,e.unref(w).EDialog.Update)&&l.option.table?.inlineEdit&&l.conf.update.form[l.option.table?.rowKey]===g[l.option.table?.rowKey]&&(d.type==="input"||d.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.type==="input"?(e.openBlock(),e.createBlock(e.unref(u.ElInput),e.mergeProps({key:0,modelValue:l.conf.update.form[d.key],"onUpdate:modelValue":p=>l.conf.update.form[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{style:{width:"100%"}}),e.createSlots({_:2},[d.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof d.options?.input?.prepend=="function"?d.options?.input?.prepend(g):d.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):d.type==="select"?(e.openBlock(),e.createBlock(e.unref(u.ElSelect),e.mergeProps({key:1,modelValue:l.conf.update.form[d.key],"onUpdate:modelValue":p=>l.conf.update.form[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.options?.search?.select?.data||d.options?.select?.data,p=>(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):d.type==="switch"?(e.openBlock(),e.createBlock(e.unref(u.ElSwitch),e.mergeProps({key:2,modelValue:l.conf.update.form[d.key],"onUpdate:modelValue":p=>l.conf.update.form[d.key]=p,ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{disabled:l.conf.update.getDisabled(d,!0)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)],64)):e.renderSlot(l.$slots,"table-"+d.key,{key:1,row:g,item:d},()=>[e.unref(R).customComponent[d.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(R).customComponent[d.type??""]?.table),e.mergeProps({key:0,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,ref_for:!0},d.options?.[d.type??""],e.toHandlers(d.options?.[d.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):d.type==="switch"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[d.options?.switch?.tableConfig?.change?(e.openBlock(),e.createBlock(e.unref(u.ElSwitch),e.mergeProps({key:0,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,loading:d.options?.switch?.loadingMap?.[g[l.option.table?.rowKey]]?.loading,"before-change":()=>d.options?.switch?.tableBeforeChange?.(d.key,g),ref_for:!0},d.options?.switch),null,16,["modelValue","onUpdate:modelValue","loading","before-change"])):(e.openBlock(),e.createElementBlock("span",$t,e.toDisplayString(g[d.key]===d.options?.switch?.activeValue?d.options?.switch?.activeText:d.options?.switch?.inactiveText),1))],64)):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":d.table?.click?.color}),class:e.normalizeClass({"table-text-click":d.table?.click?.callback}),onClick:p=>d.table?.click?.callback?.(g),innerHTML:d.table?.format?d.table?.format(g):g[d.key]},null,14,Rt))])],64))],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],64))),128)}}}),Ut={key:0,class:"relative curd-search fit-width"},At={class:"mb-10 flex justify-between items-center fit-width"},Lt={class:"flex items-center",style:{gap:"10px"}},Ht={key:0},jt={key:1},It={key:2},Kt={class:"export-btn"},Gt={key:1,class:"export-btn"},qt={class:"flex items-center table-tools-right",style:{gap:"10px"}},Wt={class:"table-sortable-tooltip"},Pt=["innerHTML"],Jt={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},Qt={class:"dialog-footer"},Xt={key:0},Yt={key:1},Zt={class:"dialog-footer"},ke=e.defineComponent({__name:"index",props:{option:{default:{}},form:{default:void 0},searchForm:{default:void 0}},setup(r,{expose:n}){const s=w.EDialog,o=r,a=w.isFun,{conf:t,switchConfirmRef:i,ruleFormRef:l,tableRef:c}=_e(o);return n({conf:t}),(f,d)=>{const g=e.resolveComponent("el-tooltip"),p=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[r.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[r.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",[r.option.table?.fitHeight?"col":""]])},[r.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",Ut,[e.createVNode(e.unref(u.ElForm),{model:e.unref(t).search.form,inline:"",size:r.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-start",{row:e.unref(t).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).search.column.list,m=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m.key},[e.renderSlot(f.$slots,"search-"+m.key+"-start",{row:e.unref(t).search.form}),(typeof m.show?.search=="function"?m.show?.search(e.unref(t).search.form):m.show?.search)?(e.openBlock(),e.createBlock(e.unref(u.ElFormItem),{key:0,label:m.text?.search?.label??m.label},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-"+m.key+"-left",{row:e.unref(t).search.form}),e.renderSlot(f.$slots,"search-"+m.key,{row:e.unref(t).search.form},()=>[m.options?.search?.type?(e.openBlock(),e.createBlock(he,{key:0,item:m,conf:e.unref(t),type:m.options.search.type},null,8,["item","conf","type"])):(e.openBlock(),e.createBlock(he,{key:1,item:m,conf:e.unref(t),type:m.type},null,8,["item","conf","type"]))]),e.renderSlot(f.$slots,"search-"+m.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-"+m.key+"-end",{row:e.unref(t).search.form})],64))),128)),e.renderSlot(f.$slots,"search-center",{row:e.unref(t).search.form}),r.option.tools?.search||r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(u.ElFormItem),{key:0},{default:e.withCtx(()=>[r.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:0,type:"primary",onClick:e.unref(t).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:1,onClick:e.unref(t).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-end",{row:e.unref(t).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",At,[e.createElementVNode("div",Lt,[e.unref(a)(r.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Ht,[e.createVNode(e.unref(u.ElButton),{type:"primary",onClick:d[0]||(d[0]=m=>e.unref(t).update.open(e.unref(s).Add)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.table?.selectable&&e.unref(a)(r.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",jt,[e.createVNode(e.unref(u.ElButton),{type:"danger",onClick:d[1]||(d[1]=m=>e.unref(t).remove.open(e.unref(t).table.selection.list)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(e.unref(u.ElButton),{type:"warning",onClick:d[2]||(d[2]=m=>e.unref(t).table.expand.all()),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.export?.show?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[r.option.tools?.export?.dropdown?.show?(e.openBlock(),e.createBlock(e.unref(u.ElDropdown),{key:0,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(u.ElDropdownMenu),{size:r.option.size?.search},{default:e.withCtx(()=>[r.option.tools?.export?.dropdown?.select&&(r.option.table?.selectable||e.unref(a)(r.option.tools?.delete))?(e.openBlock(),e.createBlock(e.unref(u.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),r.option.tools?.export?.dropdown?.page?(e.openBlock(),e.createBlock(e.unref(u.ElDropdownItem),{key:1,command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1})):e.createCommentVNode("",!0),r.option.tools?.export?.dropdown?.all?(e.openBlock(),e.createBlock(e.unref(u.ElDropdownItem),{key:2,command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",Kt,[e.createVNode(e.unref(u.ElButton),{type:"warning",loading:e.unref(t).export.loading,size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading","size"])])]),_:1},8,["onCommand"])):(e.openBlock(),e.createElementBlock("div",Gt,[e.createVNode(e.unref(u.ElButton),{type:"warning",loading:e.unref(t).export.loading,size:r.option.size?.search,onClick:d[3]||(d[3]=m=>e.unref(t).export.run.start("all"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading","size"])]))],64)):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"tools-left")]),e.createElementVNode("div",qt,[e.renderSlot(f.$slots,"tools-right"),e.unref(t).page.showTools&&e.unref(t).table.sortable.showPagination()?(e.openBlock(),e.createBlock(e.unref(u.ElPagination),e.mergeProps({key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":d[4]||(d[4]=m=>e.unref(t).page.num=m),"page-size":e.unref(t).page.size,"onUpdate:pageSize":d[5]||(d[5]=m=>e.unref(t).page.size=m),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":e.unref(t).page.pagerCount,layout:e.unref(t).page.layout,total:e.unref(t).page.total,size:r.option.size?.table,onSizeChange:e.unref(t).table.sortable.refreshList,onCurrentChange:e.unref(t).table.sortable.refreshList},r.option.page?.pagination||{},e.toHandlers(r.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),e.unref(t).table.sortable.showTriggerButton()?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:1,type:"warning",onClick:e.unref(t).table.sortable.start,size:r.option.size?.search,loading:e.unref(t).table.sortable.actionLoading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableStart")),1)]),_:1},8,["onClick","size","loading"])):e.createCommentVNode("",!0),e.unref(t).table.sortable.showActionButton()?(e.openBlock(),e.createBlock(e.unref(u.ElDropdown),{key:2,onCommand:e.unref(t).table.sortable.command},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(u.ElDropdownMenu),{size:r.option.size?.search},{default:e.withCtx(()=>[e.createVNode(e.unref(u.ElDropdownItem),{command:"save"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableSave")),1)]),_:1}),e.createVNode(e.unref(u.ElDropdownItem),{command:"exit"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableExit")),1)]),_:1})]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createVNode(e.unref(u.ElButton),{type:"warning",size:r.option.size?.search,loading:e.unref(t).table.sortable.actionLoading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableAction")),1)]),_:1},8,["size","loading"])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.unref(t).table.sortable.showSaveButton()?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:3,type:"warning",onClick:e.unref(t).table.sortable.save,size:r.option.size?.search,loading:e.unref(t).table.sortable.actionLoading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableSave")),1)]),_:1},8,["onClick","size","loading"])):e.createCommentVNode("",!0),r.option.tools?.expandColumn===void 0||r.option.tools?.expandColumn?(e.openBlock(),e.createBlock(g,{key:4,effect:"dark",content:e.unref(t).table.header.group.expand?e.unref(k).tCurd("mergeColumn"):e.unref(k).tCurd("expandColumn"),placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["refresh-btn",[r.option.size?.search]]),onClick:d[6]||(d[6]=(...m)=>e.unref(t).table.header.group.toggleExpandAll&&e.unref(t).table.header.group.toggleExpandAll(...m))},[e.unref(t).table.header.group.expand?(e.openBlock(),e.createBlock(lt,{key:0})):(e.openBlock(),e.createBlock(ct,{key:1}))],2)]),_:1},8,["content"])):e.createCommentVNode("",!0),r.option.tools?.refresh===void 0||r.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:5,class:e.normalizeClass(["refresh-btn",[r.option.size?.search]]),onClick:d[7]||(d[7]=(...m)=>e.unref(t).table.sortable.refreshList&&e.unref(t).table.sortable.refreshList(...m))},[e.createVNode(gt)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[r.option.table?.fitHeight?"col ":"",r.option.table?.editMode?"edit-mode":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[r.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(u.ElTable),e.mergeProps({ref_key:"tableRef",ref:c,data:e.unref(t).table.data,border:r.option.table?.border===void 0?!0:r.option.table?.border,class:{"cc1-form-sortable-no-scroll":e.unref(t).table.sortable.disableScroll()},onSelectionChange:e.unref(t).table.selection.change,onSortChange:e.unref(t).table.sort.change,"expand-row-keys":e.unref(t).table.expand.rowKeys,onExpandChange:e.unref(t).table.expand.change},e.unref(t).table.sortable.getTableBindOption(),e.toHandlers(r.option.table?.on||{})),{default:e.withCtx(()=>[(typeof r.option.table?.selectable=="object"?r.option.table?.selectable?.show:r.option.table?.selectable)||e.unref(a)(r.option.tools?.delete)||r.option.tools?.export?.show&&r.option.tools?.export?.select?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:0,type:"selection",width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1,className:"cc1-form-selectable-column"},typeof r.option.table?.selectable=="object"?r.option.table?.selectable:{},e.toHandlers(typeof r.option.table?.selectable=="object"?r.option.table?.selectable?.on||{}:{})),null,16)):e.createCommentVNode("",!0),(typeof r.option.table?.index=="object"?r.option.table?.index?.show:r.option.table?.index)?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:1,type:"index",fixed:"left",width:"40",align:"center",label:"#","show-overflow-tooltip":!1,className:"cc1-form-index-column"},typeof r.option.table?.index=="object"?r.option.table?.index:{},e.toHandlers(typeof r.option.table?.index=="object"?r.option.table?.index?.on||{}:{})),null,16)):e.createCommentVNode("",!0),e.unref(t).table.sortable.isActive()?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:2,align:"center","show-overflow-tooltip":!1,className:"cc1-form-drag-column"},e.unref(t).table.sortable.getColumnBind(),e.toHandlers(e.unref(t).table.sortable.getColumnBind().on||{})),{header:e.withCtx(()=>[e.renderSlot(f.$slots,"table-header-sortable",{},()=>[e.createVNode(g,{effect:"dark",placement:"top"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:r.option.table?.sortable?.tipText??e.unref(k).tCurd("sortable")},null,8,Pt)]),default:e.withCtx(()=>[e.createElementVNode("span",Wt,[e.createVNode(ye)])]),_:1})])]),default:e.withCtx(()=>d[12]||(d[12]=[e.createElementVNode("span",{class:"cc1-form-drag-handle"},"::",-1)])),_:3},16)):e.createCommentVNode("",!0),e.createVNode(Tt,{conf:e.unref(t),columnList:e.unref(t).table.column.list,option:r.option},e.createSlots({_:2},[e.renderList(f.$slots,(m,h)=>({name:h,fn:e.withCtx(C=>[e.renderSlot(f.$slots,h,e.normalizeProps(e.guardReactiveProps(C||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(r.option.table?.add)||e.unref(a)(r.option.table?.update)||e.unref(a)(r.option.table?.delete)||e.unref(a)(r.option.table?.view)||f.$slots["table-op-left"]||f.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:3,align:"center",fixed:"right"},r.option.table?.operate,{width:r.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(k).tCurd("operation")),1)])]),default:e.withCtx(({row:m})=>[e.createVNode(e.unref(u.ElForm),{size:r.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"table-op-left",{row:m}),e.unref(t).update.type===e.unref(s).Update&&r.option.table?.inlineEdit&&e.unref(t).update.form[o.option.table?.rowKey]===m[o.option.table?.rowKey]?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(u.ElButton),{link:"",type:"info",onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(u.ElButton),{link:"",type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).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(a)(r.option.table?.add,m)?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:0,link:"",type:"primary",onClick:h=>e.unref(t).update.open(e.unref(s).Add,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.view,m)?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:1,link:"",type:"primary",onClick:h=>e.unref(t).update.open(e.unref(s).View,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("view")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.update,m)?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:2,link:"",type:"warning",onClick:h=>e.unref(t).update.open(e.unref(s).Update,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.delete,m)?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:3,link:"",type:"danger",onClick:h=>e.unref(t).remove.open([m])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:2},1032,["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","class","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[p,e.unref(t).table.loading]])],2)],2),e.createElementVNode("div",Jt,[(r.option.page?.show===void 0||r.option.page?.show)&&!e.unref(t).page.showTools&&e.unref(t).table.sortable.showPagination()?(e.openBlock(),e.createBlock(e.unref(u.ElPagination),e.mergeProps({key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":d[8]||(d[8]=m=>e.unref(t).page.num=m),"page-size":e.unref(t).page.size,"onUpdate:pageSize":d[9]||(d[9]=m=>e.unref(t).page.size=m),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":e.unref(t).page.pagerCount,layout:e.unref(t).page.layout,total:e.unref(t).page.total,size:r.option.size?.table,onSizeChange:e.unref(t).table.sortable.refreshList,onCurrentChange:e.unref(t).table.sortable.refreshList},r.option.page?.pagination||{},e.toHandlers(r.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(u.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":d[10]||(d[10]=m=>e.unref(t).update.show=m),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},r.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",Qt,[e.createVNode(e.unref(u.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"dialog-footer",{row:e.unref(t).update},()=>[e.createVNode(e.unref(u.ElButton),{onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(t).update.type!==e.unref(s).View?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:0,type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).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(t).update}),e.createVNode(e.unref(u.ElForm),{ref_key:"ruleFormRef",ref:l,model:e.unref(t).update.form,rules:e.unref(t).update.rules,size:r.option.size?.form,class:"update-dialog-form"},{default:e.withCtx(()=>[e.unref(t).update.showContent?(e.openBlock(),e.createBlock(ge,{key:0,"form-grid":e.unref(t).update.formGrid,"max-span":e.unref(t).update.formMaxSpan,form:e.unref(t).update.form,type:e.unref(t).update.type,stripe:r.option.form?.stripe,"label-width":r.option.form?.labelWidth,"form-option":r.option.form,"get-bind":e.unref(t).update.getBind,"get-on":e.unref(t).update.getOn,"get-disabled":e.unref(t).update.getDisabled},e.createSlots({_:2},[e.renderList(f.$slots,(m,h)=>({name:h,fn:e.withCtx(C=>[e.renderSlot(f.$slots,h,e.normalizeProps(e.guardReactiveProps(C||{})))])}))]),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(t).update})]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(u.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":d[11]||(d[11]=m=>e.unref(t).remove.show=m),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",Zt,[e.createVNode(e.unref(u.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(u.ElButton),{onClick:e.unref(t).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(u.ElButton),{type:"danger",onClick:e.unref(t).remove.submit,loading:e.unref(t).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["size"])])]),default:e.withCtx(()=>[r.option.dialog?.delete?.content?(e.openBlock(),e.createElementBlock("div",Xt,[e.createVNode(ot,{content:r.option.dialog?.delete?.content,value:e.unref(t).remove.items},null,8,["content","value"])])):(e.openBlock(),e.createElementBlock("div",Yt,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",e.unref(t).remove.items.length)),1))]),_:1},8,["modelValue","title"]),e.createVNode(et,{ref_key:"switchConfirmRef",ref:i,size:r.option.size?.form},null,8,["size"])],2)}}});class xt{static async download(n,s="download.png"){const o=document.createElement("a");o.style.display="none",o.href=n,o.setAttribute("download",s),typeof o.download>"u"&&o.setAttribute("target","_blank"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(n)}static exportJSONFile=(n,s)=>{const o=new Blob([JSON.stringify(n)],{type:"application/json"}),a=URL.createObjectURL(o),t=document.createElement("a");t.href=a,t.download=`${s||"config"}.json`,t.click()};static importFile=async n=>new Promise((s,o)=>{const a=document.createElement("input");a.type="file";const t=n?.accept||".json";a.accept=t,a.style.display="none",a.onchange=i=>{const l=i.target.files[0];if(!l){w.fail("未选择文件"),o("未选择文件");return}const c=new FileReader;c.onload=async f=>{const d=t==".json"?JSON.parse(f.target.result):f.target.result;s(d)},c.onerror=()=>{w.fail("文件读取失败"),o("文件读取失败")},c.readAsText(l),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const we=(r,n)=>{if(r.component("TCurd",ke),r.component("TFormList",Q),r.component("TColumn",be),n?.customComponent){R.customComponent=n.customComponent;for(const s in n.customComponent)r.component(s,n.customComponent[s])}},_t={install:we};F.ArrUtil=T,F.ExcelUtil=ue,F.TColumn=be,F.TCurd=ke,F.TFile=xt,F.TForm=R,F.TFormConfig=V,F.TFormI18n=k,F.TFormList=Q,F.TSys=w,F.default=_t,F.install=we,Object.defineProperties(F,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(F,u){typeof exports=="object"&&typeof module<"u"?u(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"],u):(F=typeof globalThis<"u"?globalThis:F||self,u(F.cc1Form={},F.ElementPlus,F.VueRouter,F.Vue,F.cc1Vue3))})(this,(function(F,u,vt,e,J){"use strict";class w{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Add:"Add",Update:"Update",View:"View",Remove:"Remove"};static isFun=(n,...s)=>Array.isArray(n)?n.some(o=>typeof o=="function"?o(...s):o):typeof n=="function"?n(...s):n;static getRouterParams=()=>{const n=this.router.currentRoute.value.query||{},s=this.router.currentRoute.value.params||{};return Object.keys(n).length?n:Object.keys(s).length?s:{}};static moduleObj={};static setModule=n=>{Object.keys(n).forEach(s=>{w.moduleObj[s]=n[s]})};static loadModule=async n=>{if(!w.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const s=await w.moduleObj[n]();return s.default??s};static tipMessages={};static tipMessagesGap=500;static showMessage(n,s,o={}){const a=Date.now();if(!this.tipMessages[n]||a-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=a;const t=Object.assign({message:n,type:s},o);u.ElMessage(t),setTimeout(()=>{delete this.tipMessages[n]},this.tipMessagesGap)}}static fail=(n,s={})=>{this.showMessage(n,"error",s)};static success=(n,s={})=>{this.showMessage(n,"success",s)};static loadingObj=null;static loadingTimer=null;static loading=(n=!0,s="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{n?this.loadingObj=u.ElLoading.service({lock:!0,text:s,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(n,s=!0)=>{if(s){let o=screen.width/2-500,a=screen.height/2-800/2-30;window.open(n,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+a+", left="+o)}else window.open(n,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=n=>new Promise(async(s,o)=>{let a=document.getElementById(n.id);const t=await w.loadModule("html2canvas");try{t(a,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:n.windowWidth,height:n.windowHeight,windowWidth:n.windowWidth,windowHeight:n.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(i){let l=i.toDataURL("image/png");s(l)})}catch(i){o(i)}})}class V{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,sortable:{show:!1,button:!1,saveButton:!0,width:54,label:"",fixed:"left",page:!1,scroll:!1,field:"sortNo",rule:"index",api:{}}},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=n=>{V.config=ObjectUtil.deepMerge(V.config,n)}}class R{static customComponent={};static error={};static findOptions=(n,s)=>{const o=n.column.find(t=>t.key===s),a=t=>t.replace(/-([a-z])/g,(i,l)=>l.toUpperCase());if(o)return o.options[a(o.type)]};static setOptionsData=(n,s,o)=>{const a=R.findOptions(n,s);a&&(a.data=o)};static form={openBefore:{parentId:(n,s,o,a)=>{const t=V.config.table.rowKey;n?s.type===w.EDialog.Add?(s.form.parentId=n[t],s.form.sort=n.children.length+1):s.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(s.form.parentId="0",s.form.sort=o.length+1),R.setOptionsData(a,"parentId",[{[t]:"0",title:"根",children:o}])}}}}class T{static getIdFun=()=>StrUtil.uuid();static setId=(n,s,o)=>{s[n]||(s[n]=[]);const a=V.config.table.rowKey;s[n].forEach(t=>{o.forEach(i=>{let l=i.default??"";i.type==="number"&&(l=i.default??0),i.type==="boolean"&&(l=i.default??!1),i.type==="time"&&(l=i.default??new Date),t[i.value]===void 0&&(t[i.value]=l)}),t[a]||(t[a]=T.getIdFun())})};static add=(n,s,o,a)=>{const t=JSONUtil.cp(o);T.setId(n,s,o);const i=V.config.table.rowKey;s[n].push(t.reduce((l,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),l[c.value]=f,l},{[i]:T.getIdFun()})),a?.(s)};static remove=(n,s,o,a)=>{const t=V.config.table.rowKey;s[n]=s[n].filter(i=>i[t]!==o[t]),a?.(s)};static getNoIdData=(n,s)=>{const o=JSONUtil.cp(n),a=V.config.table.rowKey;return o.forEach(t=>{t[a]&&delete t[a],s&&t[s]&&T.getNoIdData(t[s],s)}),o}}const Ce={key:0,class:"column curd-form-com-list",style:{width:"100%",gap:"10px"}},Be={key:0},Ve={class:"row items-center",style:{gap:"10px",width:"100%"}},Ee={key:1},Q=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(r,{emit:n}){const s=r,o=e.reactive({show:!1,add:(t,i,l)=>{T.add(t,i,l,()=>{a("change")})},remove:(t,i,l)=>{T.remove(t,i,l,()=>{a("change")})}});e.onMounted(()=>{T.setId(s.field,s.row,s.itemFields),o.show=!0});const a=n;return(t,i)=>{const l=e.resolveComponent("el-button"),c=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",Ce,[e.renderSlot(t.$slots,"list-start",{row:r.row}),r.addBottom?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Be,[e.createVNode(l,{link:"",type:"primary",onClick:i[0]||(i[0]=f=>o.add(r.field,r.row,r.itemFields))},{default:e.withCtx(()=>i[3]||(i[3]=[e.createTextVNode("添加")])),_:1})])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.row[r.field],f=>(e.openBlock(),e.createElementBlock("div",Ve,[e.renderSlot(t.$slots,"item-start",{item:f,row:r.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.itemFields,d=>(e.openBlock(),e.createBlock(c,{modelValue:f[d.value],"onUpdate:modelValue":g=>f[d.value]=g,style:e.normalizeStyle({width:r.inputWidth}),class:e.normalizeClass(r.inputClass),placeholder:d[r.label]||d[r.value],onChange:i[1]||(i[1]=g=>a("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(t.$slots,"item-end",{item:f,row:r.row}),e.createVNode(l,{link:"",type:"danger",onClick:d=>o.remove(r.field,r.row,f)},{default:e.withCtx(()=>i[4]||(i[4]=[e.createTextVNode("删除")])),_:2},1032,["onClick"])]))),256)),r.addBottom?(e.openBlock(),e.createElementBlock("div",Ee,[e.createVNode(l,{link:"",type:"primary",onClick:i[2]||(i[2]=f=>o.add(r.field,r.row,r.itemFields))},{default:e.withCtx(()=>i[5]||(i[5]=[e.createTextVNode("添加")])),_:1})])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"list-end",{row:r.row})])):e.createCommentVNode("",!0)}}}),Se={class:"row form-item-content",style:{width:"100%"}},Ne={class:"col column form-item-content-item"},De={class:"col"},Fe=["innerHTML"],ze=e.defineComponent({__name:"field",props:{item:{},form:{},type:{},labelWidth:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(r){const n=r,s=e.ref(),o=()=>{const t=s.value?.validateState;return t&&typeof t=="object"&&"value"in t?t.value:t},a=()=>{o()==="error"&&s.value?.clearValidate?.()};return e.watch(()=>n.form?.[n.item.key],()=>{a(),e.nextTick(()=>a())},{deep:!0,flush:"post"}),(t,i)=>(e.openBlock(),e.createBlock(e.unref(u.ElFormItem),{ref_key:"formItemRef",ref:s,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",Se,[e.renderSlot(t.$slots,"form-"+t.item.key+"-start",{row:t.form,item:t.item}),e.createElementVNode("div",Ne,[e.createElementVNode("div",De,[e.renderSlot(t.$slots,"form-"+t.item.key,{row:t.form,item:t.item},()=>[t.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(u.ElInput),e.mergeProps({key:0,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[0]||(i[0]=l=>t.form[t.item.key]=l)},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(u.ElInputNumber),e.mergeProps({key:1,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[1]||(i[1]=l=>t.form[t.item.key]=l)},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(u.ElInput),e.mergeProps({key:2,type:"textarea",modelValue:t.form[t.item.key],"onUpdate:modelValue":i[2]||(i[2]=l=>t.form[t.item.key]=l)},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(u.ElSwitch),e.mergeProps({key:3,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[3]||(i[3]=l=>t.form[t.item.key]=l)},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(u.ElSelect),e.mergeProps({key:4,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[4]||(i[4]=l=>t.form[t.item.key]=l)},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||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElOption),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(u.ElRadioGroup),e.mergeProps({key:5,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[5]||(i[5]=l=>t.form[t.item.key]=l)},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||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElRadioButton),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElRadio),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="checkbox"?(e.openBlock(),e.createBlock(e.unref(u.ElCheckboxGroup),e.mergeProps({key:6,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[6]||(i[6]=l=>t.form[t.item.key]=l)},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||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElCheckboxButton),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],l=>(e.openBlock(),e.createBlock(e.unref(u.ElCheckbox),e.mergeProps({key:l.value,ref_for:!0},l,e.toHandlers(l.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="color"?(e.openBlock(),e.createBlock(e.unref(u.ElColorPicker),e.mergeProps({key:7,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[7]||(i[7]=l=>t.form[t.item.key]=l)},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(u.ElSlider),e.mergeProps({key:8,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[8]||(i[8]=l=>t.form[t.item.key]=l)},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(Q,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(u.ElTreeSelect),e.mergeProps({key:10,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[9]||(i[9]=l=>t.form[t.item.key]=l)},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(u.ElDatePicker),e.mergeProps({key:11,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[10]||(i[10]=l=>t.form[t.item.key]=l)},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":i[11]||(i[11]=l=>t.form[t.item.key]=l)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&(e.unref(R).customComponent[t.item.type]||e.unref(R).customComponent[t.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(R).customComponent[t.item.type]?.form||e.unref(R).customComponent[t.item.type]),e.mergeProps({key:13,modelValue:t.form[t.item.key],"onUpdate:modelValue":i[12]||(i[12]=l=>t.form[t.item.key]=l)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+t.item.key+"-right",{row:t.form,item:t.item})]),e.renderSlot(t.$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,Fe)):e.createCommentVNode("",!0)])]),e.renderSlot(t.$slots,"form-"+t.item.key+"-end",{row:t.form,item:t.item})])]),_:3},8,["label","prop","label-width"]))}});function eo(r){return r}const Oe={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:"展开栏位",sortable:"拖拽进行排序,点击保存排序可保存排序结果",sortableStart:"排序",sortableAction:"排序操作",sortableSave:"保存排序",sortableExit:"退出排序",sortableUpdateApiRequired:"未配置排序保存接口"};class k{static t(n,...s){if(typeof n=="function")return n(...s);n=String(n);let o=0;return n.replace(/{([^}]+)}/g,(a,t)=>o<s.length?String(s[o++]):`{${t}}`)}static setI18n=n=>{k.curd=ObjectUtil.deepMerge(k.curd,n)};static tCurd(n,...s){return this.t(this.curd[n],...s)}static curd=Oe}class U{static delAllKey=n=>{Object.keys(n).forEach(s=>{delete n[s]})};static setValue=(n,s,o=!1)=>{o&&U.delAllKey(n),Object.keys(s).forEach(a=>{n[a]!==s[a]&&(n[a]=s[a])})}}const G=r=>{const n=e.reactive({}),s=()=>typeof r=="function"?r():r,o=()=>{const a=s();return a??n};return{internal:n,isExternal:()=>s()!=null,get(){return o()},set(a){U.setValue(o(),a,!0)},merge(a){U.setValue(o(),a,!1)},clear(){U.delAllKey(o())}}},K=r=>{r.forEach(n=>{console.error({field:n.field||"",error:n.error||""})})},Me=r=>r?typeof r=="string"?r:r instanceof Error?r.message:r.message||String(r):"",q=r=>!r||typeof r!="object"?[]:Object.keys(r).flatMap(n=>(Array.isArray(r[n])?r[n]:[r[n]]).map(o=>({field:o?.field||n,error:Me(o)}))),W=w.EDialog,L=r=>typeof r.type=="object"?"component":r.type||"input",$e=(r,n,s)=>{const o=G(()=>n.form),a=i=>X(i.update.formGrid||[],i.update.form,i.update.type,i.update.formMaxSpan).map(c=>c.item.key).filter(Boolean),t=async i=>{const l=s.ruleFormRef.value;if(!l)return!0;await e.nextTick();const c=a(i),f=Object.keys(i.update.rules||{}).filter(g=>!c.includes(g));if(f.length&&l.clearValidate(f),!c.length)return!0;if(!await l.validateField(c,async(g,p)=>{g||K(q(p))}))throw!1;return!0};return{update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:W.Update,get form(){return o.get()},set form(i){o.set(i)},formDefault:{},formColumn:[],formGrid:[],formMaxSpan:12,getDisabled:(i,l=!1)=>{const c=r();return n.option.table?.editMode&&l?i.disabled?.table===void 0?!1:w.isFun(i.disabled?.table,c.update.form):oe(i,c.update.type,c.update.form)},getBind:i=>{const l=r();return ne(i,l.update.type)},getOn:(i,l)=>{const c=r();return re(i,c.update.type,[l||c.update.form,i])},getOptions:i=>{const l=r();try{const f=se(l.update.formGrid?.length?l.update.formGrid:l.update.formColumn).find(d=>d.item.key===i)?.item;return f?{options:f.options,bind:l.update.getBind(f)}:{options:{},bind:{}}}catch{return{options:{},bind:{}}}},edit:{data:{},getApiData:i=>{const l=r();if(n.option.form?.editAll)return i;const c={[n.option.table?.rowKey]:l.update.edit.data[n.option.table?.rowKey]};return Object.keys(l.update.edit.data).forEach(f=>{i[f]!==l.update.edit.data[f]&&(c[f]=i[f])}),c}},view:{},openLoading:!1,open:async(i,l)=>{const c=r();if(!(c.update.showContent||c.update.openLoading)){w.loading(!0),c.update.openLoading=!0;try{c.update.type=i;const f=i===W.Add;c.update.edit.data=f?void 0:JSONUtil.cp(l),c.update.title=k.tCurd(f?"add":i===W.View?"view":"edit");const d=f?ObjectUtil.deepMerge(JSONUtil.cp(c.update.formDefault),l?JSONUtil.cp(l):{}):JSONUtil.cp(l);U.setValue(c.update.form,d,!0),await c.initApiData("update"),await n.option.form?.openBefore?.(c.update.form,c.update),(!n.option.table?.inlineEdit||f)&&(c.update.show=!0,c.update.showContent=!0),n.option.form?.openAfter?.(c.update.form,c.update)}catch(f){console.error(f)}finally{w.loading(!1),c.update.openLoading=!1}}},validate:async(i=!0)=>{const l=r();try{const c=n.option.table?.editMode?l.tableEditValidate.validate():t(l);return await Promise.all([c,l.formRef.validate()]),!0}catch{return i&&w.fail(k.tCurd("checkFormData")),!1}},submit:async()=>{const i=r();if(!await i.update.validate()||i.update.loading)return;i.update.loading=!0;const c=i.update.type===W.Add?n.option.api.create:n.option.api.update;try{await n.option.form?.submitBefore?.(i.update.form,i.update)}catch{i.update.loading=!1;return}let f=ObjectUtil.deepMerge(i.update.form,{});delete f.children;const d=new Set(n.option.column.filter(g=>g.type==="datetime").map(g=>g.key));Object.keys(f).forEach(g=>{if(d.has(g)&&f[g]!=null){const p=new Date(f[g]).getTime();isNaN(p)||(f[g]=p)}});try{if(!c)return;await c({...f}),i.update.close(),await i.table.getList(),n.option.form?.submitAfter?.(f,i.update)}catch(g){console.error(g)}finally{i.update.loading=!1}},close:()=>{const i=r();i.update.show=!1,i.update.edit.data=void 0,setTimeout(()=>{i.update.showContent=!1,s.ruleFormRef.value?.resetFields?.(),o.clear()},350)}}}},$=12,P=(r,n)=>{r.isForm=n,Array.isArray(r.children)&&r.children.forEach(s=>P(s,n))},Re=r=>r.isForm===!1?!1:typeof r.show?.form=="boolean"?r.show.form:!0,ee=r=>r>$?Math.floor(r/2):r,Te=(r,n,s)=>(r.form=r.form||{span:n},s==="column"?r.form.span=r.form.span??12:r.form.span=r.form.span??n,r.form.span=ee(r.form.span),r.form.span),te=r=>{const n=r.form;return n?.row!=null&&n.row>0?ee(n.row):$},H=r=>Math.floor((r.gridRow-1)/$),oe=(r,n,s)=>{if(n===w.EDialog.View)return r.disabled?.view===void 0?!0:w.isFun(r.disabled?.view,s);const o=r.disabled?.[n===w.EDialog.Add?"create":"update"];return w.isFun(o,s)},ne=(r,n)=>{const s=L(r);return r.options?.[n===w.EDialog.Add?"formAdd":"formUpdate"]?.[s]||r.options?.[s]||{}},re=(r,n,s=[])=>{const o=L(r),t=r.options?.[n===w.EDialog.Add?"formAdd":"formUpdate"]?.[o]?.on||r.options?.[o]?.on||{},i={};return Object.keys(t).forEach(l=>{const c=t[l];typeof c=="function"?i[l]=function(...f){return c.apply(this,[...f,...s])}:i[l]=c}),i},ae=(r,n,s,o,a)=>{const t=r,i=t.colSpan??r.span;if(!r.item.form?.spanCol)return i;const l=a?.maxSpan||12,c=a?.defaultSpan||l/2,f=t.gridBand,g=n.filter(p=>f!=null?p.gridBand===f&&!w.isFun(p.item.show?.form,s,o):p.gridRow===t.gridRow&&!w.isFun(p.item.show?.form,s,o)).reduce((p,m)=>p+(m.colSpan??m.span??c),0);return i+g},Ue=(r,n)=>{const s=(o,a)=>{const t=o.gridRow,i=o.gridRow+o.rowSpan-1,l=a.gridRow,c=a.gridRow+a.rowSpan-1;return t<=c&&l<=i};return r.map(o=>r.filter(t=>s(o,t)).length!==1||o.colSpan>=n?o:{...o,span:n,colSpan:n,gridColumn:1})},le=(r,n,s={})=>{const o=new Set,a=[];let t=0,i=0;const l=m=>Math.floor(m/$)*$,c=(m,h)=>`${m},${h}`,f=(m,h,C,E)=>{if(h+C>n)return!1;for(let S=0;S<E;S++)for(let N=0;N<C;N++)if(o.has(c(m+S,h+N)))return!1;return!0},d=(m,h,C,E)=>{for(let S=0;S<E;S++)for(let N=0;N<C;N++)o.add(c(m+S,h+N))},g=(m,h,C,E)=>{for(let N=l(m);N<500*$;N+=$){const Z=N+$,x=N===l(m)?Math.max(N,m):N;for(let A=x;A<Z;A++){const _=A===m?h:0;for(let I=_;I<=n-C;I++)if(f(A,I,C,E))return{tr:A,tc:I}}}return{tr:m,tc:h}},p=(m,h,C,E)=>{const S=l(m);if(E<$&&m+E<S+$){t=m+E,i=h;return}const N=h+C;if(N<n){i=N,t=S;return}i=0,t=S+$};return r.forEach(m=>{const h=m.colSpan??(m.span===0?n:m.span),C=m.rowSpan??te(m.item);m.item.form?.rowBreak&&a.length&&(i=0,t=l(t)+$);let{tr:E,tc:S}=f(t,i,h,C)?{tr:t,tc:i}:g(t,i,h,C);f(E,S,h,C)||({tr:E,tc:S}=g(0,0,h,C)),d(E,S,h,C);const N=E+1;a.push({...m,span:h,colSpan:h,rowSpan:C,gridRow:N,gridColumn:S+1,gridBand:H({gridRow:N})}),p(E,S,h,C)}),s.fillSingleRows?Ue(a,n):a},X=(r,n,s,o=$)=>{const a=r.filter(l=>w.isFun(l.item.show?.form,n,s)),t=new Map;r.forEach(l=>{const f=`${l.gridBand??H(l)}:${l.gridColumn}:${l.colSpan}`;t.has(f)||t.set(f,[]),t.get(f).push(l)});const i=new Map;return t.forEach(l=>{const c=l.reduce((p,m)=>p+m.rowSpan,0);if(!(l.length>1&&c===$&&l.every(p=>p.rowSpan<$)))return;const d=l.filter(p=>w.isFun(p.item.show?.form,n,s));if(d.length!==1)return;const g=d[0];i.set(g.item.key,{...g,rowSpan:$})}),le(a.map(l=>i.get(l.item.key)||l),o,{fillSingleRows:!0})},ie=r=>{const n=new Map;return r.forEach(s=>{const o=s.gridBand??H(s);n.has(o)||n.set(o,[]),n.get(o).push(s)}),Array.from(n.keys()).sort((s,o)=>s-o).map(s=>n.get(s))},se=r=>r?.length?Array.isArray(r[0])?r.flat():r:[],Ae=(r,n)=>{if(!Re(r)||!r.key)return null;const s=n.defaultSpan??(n.maxSpan||12)/2,o=Te(r,s,n.layout);return{item:r,span:o}},Le=(r,n={})=>{const s=[],o=a=>{if(a.children?.length){a.children.forEach(i=>o(i));return}const t=Ae(a,n);t&&s.push(t)};return r.forEach(a=>o(a)),s},de=(r,n={})=>{const s=n.maxSpan??12,o=n.defaultSpan??s/2,a=n.layout??"row",i=Le(r,{maxSpan:s,defaultSpan:o,layout:a});if(a==="column"){const l=[];let c=1;return i.forEach(f=>{const d=te(f.item),g=s;l.push({...f,span:g,colSpan:g,rowSpan:d,gridRow:c,gridColumn:1,gridBand:H({gridRow:c})}),c+=d}),{cells:l,maxSpan:s}}return{cells:le(i,s),maxSpan:s}},He=r=>r.map(n=>n.item?.show?.form),je=(r,n,s)=>{if(!r.rules)return;const o={required:!0,message:n(r),trigger:"blur"},a=L(r),t=r.options?.datetime?.type,i=a==="datetime"&&typeof t=="string"&&t.includes("range"),l=a==="select"&&!!r.options?.select?.multiple;(i||a==="checkbox"||l)&&(o.type="array",o.min=i?2:1);const c=typeof r.rules=="boolean"?[o]:r.rules;return s?c.map(f=>s(f)):c},ce=r=>typeof r=="function"?r():r,fe=r=>(n,s)=>je(n,r,o=>{const a=(t,i)=>{if(i&&Object.prototype.hasOwnProperty.call(i,n.key)&&i[n.key]!==void 0)return i[n.key];const l=ce(s);return l&&Object.prototype.hasOwnProperty.call(l,n.key)?l[n.key]:t};if(o.validator){const t=o.validator;return{...o,validator:(i,l,c,f)=>{const d=ce(s);return t(i,a(l,f),c,d||f)}}}return o}),pe=(r,n)=>{const s={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},o=(s[L(r)||"input"]||s.input)+r.label;return(n||R.error.callback)?.(r.key,r)||o},me=r=>fe(n=>pe(n,r?.error)),Ie=(r,n,s)=>{const o={},a={},t=n?.maxSpan||12,i=n?.defaultSpan||t/2,l=me(n);r.forEach(d=>P(d,!0)),Y(r,o,a,d=>l(d,s));const{cells:c,maxSpan:f}=de(r,{maxSpan:t,defaultSpan:i,layout:n?.layout});return{formDefault:o,rules:a,formGrid:c,formMaxSpan:f,formColumn:ie(c)}},Y=(r,n,s,o)=>{const a=t=>{if(t.children?.length){t.children.forEach(i=>a(i));return}if(t.key){n[t.key]=t.value;const i=o(t);i&&(s[t.key]=i)}};r.forEach(a)},Ke={class:"curd-form-cell-inner"},ge=e.defineComponent({__name:"layout",props:{formGrid:{},maxSpan:{},form:{},type:{},stripe:{type:Boolean},labelWidth:{},formOption:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(r){const n=w.isFun,s=r,o=e.computed(()=>X(s.formGrid,s.form,s.type,s.maxSpan)),a=e.computed(()=>{const p=Array.from(new Set(o.value.map(m=>m.gridBand??H(m)))).sort((m,h)=>m-h);return new Map(p.map((m,h)=>[m,h]))}),t=e.computed(()=>({gridTemplateColumns:`repeat(${s.maxSpan}, minmax(0, 1fr))`})),i=e.computed(()=>{let p=0;return o.value.forEach(m=>{const h=m.gridRow+m.rowSpan-1;h>p&&(p=h)}),p}),l=p=>p.gridRow+p.rowSpan-1>=i.value,c=p=>p.rowSpan>=$,f=p=>{const m=p.gridBand??H(p);return a.value.get(m)??m},d=p=>ae(p,o.value,s.form,s.type,{maxSpan:s.maxSpan,defaultSpan:s.formOption?.defaultSpan}),g=p=>{const m=d(p)||p.colSpan;return{gridRow:`${p.gridRow} / span ${p.rowSpan}`,gridColumn:`${p.gridColumn} / span ${m}`}};return(p,m)=>e.unref(n)(e.unref(He)(p.formGrid),p.form,p.type)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(p.$slots,"form-start",{row:p.form}),e.createElementVNode("div",{class:e.normalizeClass(["curd-form-grid",{stripe:p.stripe!==!1}]),style:e.normalizeStyle(t.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,h=>(e.openBlock(),e.createElementBlock("div",{key:h.item.key,class:e.normalizeClass(["curd-form-grid-cell",[p.stripe!==!1&&f(h)%2===0?"stripe-band-odd":"",h.gridColumn>1?"has-col-border":"",p.stripe!==!1&&l(h)?"is-last-row":"",c(h)?"is-row-span":"",`form-item-col-${h.item.key}`]]),style:e.normalizeStyle(g(h))},[e.createElementVNode("div",Ke,[e.unref(n)(h.item.show?.form,p.form,p.type)?(e.openBlock(),e.createBlock(ze,{key:0,class:e.normalizeClass({"is-row-span-field":c(h)}),item:h.item,form:p.form,type:p.type,"label-width":p.labelWidth,"get-bind":p.getBind,"get-on":p.getOn,"get-disabled":p.getDisabled},e.createSlots({_:2},[e.renderList(p.$slots,(C,E)=>({name:E,fn:e.withCtx(S=>[e.renderSlot(p.$slots,E,e.mergeProps({ref_for:!0},S||{}))])}))]),1032,["class","item","form","type","label-width","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)])],6))),128))],6),e.renderSlot(p.$slots,"form-end",{row:p.form})],64)):e.createCommentVNode("",!0)}}),be=e.defineComponent({__name:"column",props:{option:{default:()=>({form:{},column:[]})},type:{default:""},form:{default:void 0}},setup(r,{expose:n}){const s=w.EDialog,o=e.ref(),a=r;let t=G(a.form);const i=J.Scope.getConf("curdConf"),l="formRef-"+StrUtil.getId();e.onUnmounted(()=>{i?.formRef?.remove(l)});const c=e.reactive({rules:{},show:!0,formDefault:{},type:a.type||i?.update?.type||s.Add,formColumn:[],formGrid:[],formMaxSpan:12,get form(){return t.get()},set form(f){t.set(f)},getDisabled:f=>oe(f,c.type,c.form),getBind:f=>ne(f,c.type),getOn:f=>re(f,c.type,[c.form,f]),initColumnForm:()=>{const f=t,d=Ie(a.option.column,a.option.form,()=>f.get());c.formDefault=d.formDefault,c.rules=d.rules,c.formGrid=d.formGrid,c.formMaxSpan=d.formMaxSpan,c.formColumn=d.formColumn,c.type===s.Add?f.isExternal()?f.merge(JSONUtil.cp(c.formDefault)):f.set(JSONUtil.cp(c.formDefault)):!f.isExternal()&&a.form&&f.set(JSONUtil.cp(a.form))}});return i?.formRef?.set(l,{validate:async f=>{const d=o.value;if(!d)return f?.(!0),!0;await e.nextTick();const g=X(c.formGrid||[],c.form,c.type,c.formMaxSpan).map(h=>h.item.key).filter(Boolean),p=Object.keys(c.rules||{}).filter(h=>!g.includes(h));if(p.length&&d.clearValidate(p),!g.length)return f?.(!0),!0;const m=await d.validateField(g,async(h,C)=>{h||K(q(C))});if(f?.(!!m),!m)throw!1;return!0}}),a.option.form?.initStart?.(c),c.initColumnForm(),a.option.form?.initEnd?.(c),e.watch(()=>a.form,f=>{t=G(f),c.initColumnForm()}),n({ref:o,conf:c}),(f,d)=>(e.openBlock(),e.createBlock(e.unref(u.ElForm),{ref_key:"ruleFormRef",ref:o,model:c.form,rules:c.rules},{default:e.withCtx(()=>[c.show?(e.openBlock(),e.createBlock(ge,{key:0,"form-grid":c.formGrid,"max-span":c.formMaxSpan,form:c.form,type:c.type,stripe:r.option.form?.stripe,"label-width":r.option.form?.labelWidth||"100px","form-option":r.option.form,"get-bind":c.getBind,"get-on":c.getOn,"get-disabled":c.getDisabled},e.createSlots({_:2},[e.renderList(f.$slots,(g,p)=>({name:p,fn:e.withCtx(m=>[e.renderSlot(f.$slots,p,e.normalizeProps(e.guardReactiveProps(m||{})))])}))]),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"]))}}),Ge=r=>r?.value||r,qe=r=>{const n=Ge(r);return n?.validate?new Promise((s,o)=>{let a=!1;const t=(i,l)=>{a||(a=!0,i===!1?(K(q(l)),o(!1)):s(!0))};try{const i=n.validate(t);i&&typeof i.then=="function"?i.then(l=>t(l)).catch(l=>{K(q(l?.fields||l)),o(l)}):(i!==void 0||n.validate.length===0)&&t(i)}catch(i){o(i)}}):Promise.resolve(!0)},We=()=>{const r=e.reactive({formRef:{map:{},set(n,s){r.formRef.map[n]=s},remove(n){delete r.formRef.map[n]},validate(){const n=Object.keys(r.formRef.map).map(s=>r.formRef.map[s]);return Promise.all(n.map(s=>qe(s))).then(()=>!0)}},regFormRef(n,s,o){n?o?r.formRef.set(s,{validate:async a=>{try{a(await o())}catch{a(!1)}}}):r.formRef.set(s,n):r.formRef.remove(s)}});return r},Pe=(r,n)=>{const s=G(()=>n.searchForm);return{search:{column:{list:[]},get form(){return s.get()},set form(o){s.set(o)},formDefault:{},getPlaceholder:(o,a=k.tCurd("placeholderInput"))=>o.text?.search?.placeholder===void 0?`${a}${o.label}`:o.text?.search?.placeholder,getFormData:()=>{const o=r();let a={};n.option.column.forEach(i=>{(typeof i.show?.search=="function"?i.show?.search(o.search.form):i.show?.search)&&(a[i.key]=o.search.form[i.key])});const t=n.option.search?.before?.(a);return t&&(a=t),a},reset:()=>{const o=r(),a=o.search.formDefault;Object.keys(a).forEach(i=>{n.option.search?.resetMode==="none"?a[i]=void 0:a[i]=o.search.formDefault[i]});const t=ObjectUtil.deepMerge(a,{});U.setValue(o.search.form,t,!0),o.page.num=1,n.option.init!==!1&&o.table.getList()},submit:()=>{const o=r();o.page.num=1,o.table.getList()}}}},Je=(r,n)=>({page:{num:1,total:0,layout:n.option.page?.layout||V.config.pagination.layout,showTools:n.option.page?.showTools||V.config.pagination.showTools,size:n.option.page?.size||V.config.pagination.size,sizeList:n.option.page?.sizeList||V.config.pagination.pageSizes,pagerCount:n.option.page?.pagerCount||V.config.pagination.pagerCount,getQuery:(s={})=>{const o=r();return{[V.config.field.page.size]:s.size||o.page.size,[V.config.field.page.num]:s.num||o.page.num,...o.search.getFormData()}}}}),Qe=(r,n,s)=>{const o=r;return{table:{op:{width:(...a)=>a.filter(i=>i).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(a,t)=>{},all:()=>{const a=o();if(a.table.expand.isExpand)a.table.expand.rowKeys=[];else{const t=i=>{let l=[];return i.forEach(c=>{l.push(c[n.option.table.rowKey]),c.children?.length&&(l=l.concat(t(c.children)))}),l};a.table.expand.rowKeys=t(a.table.data)}a.table.expand.isExpand=!a.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},sortable:{mode:!1,actionLoading:!1,instance:void 0,modulePromise:void 0,getOption:()=>n.option.table?.sortable||{},showTriggerButton:()=>{const a=o();return n.option.table?.sortable?.button&&!a.table.sortable.mode},showActionButton:()=>{const a=o();return n.option.table?.sortable?.button&&a.table.sortable.mode},showSaveButton:()=>!n.option.table?.sortable?.button&&n.option.table?.sortable?.show&&n.option.table?.sortable?.saveButton,isActive:()=>{const a=o(),t=a.table.sortable.getOption();return t.button?a.table.sortable.mode:!!t.show},showPagination:()=>{const a=o();return!a.table.sortable.isActive()||a.table.sortable.getOption().page},disableScroll:()=>{const a=o(),t=a.table.sortable.getOption();return a.table.sortable.isActive()&&!t.page&&!t.scroll},getTableBindOption:()=>{const a=o();return{...n.option.table||{},...a.table.sortable.disableScroll()?{height:void 0,maxHeight:void 0}:{}}},getColumnBind:()=>{const{show:a,button:t,page:i,scroll:l,field:c,rule:f,api:d,onEnd:g,...p}=o().table.sortable.getOption();return p},destroy:()=>{const a=o();a.table.sortable.instance?.destroy(),a.table.sortable.instance=void 0},getBody:()=>s.tableRef.value?.$el?.querySelector(".el-table__body-wrapper tbody"),loadModule:async()=>{const a=o();a.table.sortable.modulePromise??=w.loadModule("sortablejs");const t=await a.table.sortable.modulePromise;return t.default||t},applyRule:(a,t,i,l)=>{if(i==="value"){a.forEach((c,f)=>{c[t]=l[f]});return}a.forEach((c,f)=>{c[t]=f+1})},sync:async()=>{const a=o();if(a.table.sortable.destroy(),!a.table.sortable.isActive()||a.table.loading)return;await e.nextTick();const t=a.table.sortable.getBody();if(!t)return;const i=await a.table.sortable.loadModule(),l=a.table.sortable.getOption();a.table.sortable.instance=i.create(t,{animation:150,handle:".cc1-form-drag-handle",draggable:".el-table__row",onEnd:({oldIndex:c,newIndex:f})=>{const d=(p,m,h)=>{if(!Number.isInteger(m)||!Number.isInteger(h)||m===h||m<0||h<0||m>=p.length||h>=p.length)return;const C=p.splice(m,1)[0];p.splice(h,0,C)},g=a.table.data.map(p=>p?.[l.field]);d(a.table.data,c,f),l.onEnd?l.onEnd(a.table.data):a.table.sortable.applyRule(a.table.data,l.field,l.rule,g)}})},refreshList:async()=>{const a=o();await a.table.getList(a.table.sortable.isActive()?"sortable":void 0),a.table.sortable.sync()},fitHeight:!1,start:async()=>{const a=o(),t=a.table?.sortable.getOption();a.table.sortable.fitHeight=n.option.table.fitHeight,t.scroll||(n.option.table.fitHeight=!1),a.table.sortable.mode=!0,await a.table.sortable.refreshList()},exit:async()=>{const a=o();n.option.table.fitHeight=a.table.sortable.fitHeight,await a.table.getList(),a.table.sortable.mode=!1,a.table.sortable.destroy()},save:async()=>{const a=o(),i=a.table.sortable.getOption().api?.update||n.option.api.update;if(!i){w.fail(k.tCurd("sortableUpdateApiRequired"));return}a.table.sortable.actionLoading=!0,a.table.loading=!0;try{await i(a.table.data,"sortable"),w.success(k.tCurd("operationSuccess")),await a.table.sortable.exit()}catch(l){console.error(l)}finally{a.table.sortable.actionLoading=!1,a.table.loading=!1}},command:async a=>{const t=o();if(a==="save"){await t.table.sortable.save();return}await t.table.sortable.exit()}},header:{group:{expand:!1,toggleExpandAll:()=>{const a=o(),t=!a.table.header.group.expand;a.table.header.group.expand=t;const i=l=>{l.forEach(c=>{c.table?.header?.group!==void 0&&(c.table.header.group=!t),c.table?.header?.groupKey!==void 0&&(c.table.header.show=t),Array.isArray(c.children)&&c.children.length&&i(c.children)})};i(a.table.column.list)}}},parseListResult:async a=>{const t=o(),i=V.config.field.result,l=a?.data||{[i.list]:a},c=Array.isArray(l)?l:(Array.isArray(l[i.list]),l[i.list]),f=se(t.update.formGrid?.length?t.update.formGrid:t.update.formColumn),g=ObjectUtil.deepMerge({data:c},{}).data.map(p=>(Object.keys(p).forEach(h=>{const C=f.find(E=>E.item.key===h);C&&["select","radio"].includes(C.item.type)&&(C.item.table.format||(C.item.table.format=E=>C.item.options[C.item.type].data?.find(S=>S.value==E[h])?.label||E[h]))}),p));return{data:n.option.data?await n.option.data(g,c):g,total:l[i.total]||0}},applyListResult:async(a,t)=>{const i=o(),l=await i.table.parseListResult(a);return i.table.data=l.data,i.page.total=t??l.total,i.tableEditValidate?.clear?.(),l},getList:async a=>{const t=o();t.table.loading=!0;const i=n.option.table?.sortable,l=a==="sortable"&&i?.api?.list||n.option.api.list,c=JSONUtil.cp(t.table.selection.list);try{await t.initApiData("init");let f={};if(t.table.sort.prop){const{props:p,order:m}=V.config.table.sort;f={[p.field]:t.table.sort.prop,[m.field]:t.table.sort.order}}const d=a==="sortable"&&i?.page===!1?t.page.getQuery({num:1,size:t.page.total||999999}):t.page.getQuery(),g=await l({...d,...f},a);await t.table.applyListResult(g,a==="sortable"&&i?.page===!1?t.page.total:void 0),setTimeout(()=>{t.table.selection.setList(c),n.option.table?.sortable?.show&&!n.option.table?.sortable?.button&&t.table.sortable.sync()},20)}catch(f){console.error(f)}finally{t.table.loading=!1}},selection:{list:[],change:a=>{o().table.selection.list=a},setList:(a,t)=>{const i=o();i.table.selection.list=[];const l=s.tableRef.value;if(l?.clearSelection(),!l||!a?.length)return;const c=n.option.table?.rowKey,f=d=>{const g=p=>{for(const m of p){if(c!=null&&c!==""){if(m[c]===d[c])return m}else if(m===d)return m;if(Array.isArray(m.children)&&m.children.length){const h=g(m.children);if(h!==void 0)return h}}};return g(i.table.data)};a.forEach(d=>{const g=f(d);if(g)if(t){const p=()=>l.toggleRowSelection(g,!0,!1);t(d)!==!1&&p()}else l.toggleRowSelection(g,!0,!1)})}},sort:{prop:"",order:"",change:a=>{const t=o();V.config.table.sort.resetPage&&(t.page.num=1);const i=V.config.table.sort;if(i.change){i.change(a,t);return}t.table.sort.prop=a.prop,a.order===null?(t.table.sort.order="",t.table.sort.prop=""):t.table.sort.order=a.order==="ascending"?i.order.asc:i.order.desc,t.table.getList()}}}}},Xe=(r,n)=>{const s=e.reactive({}),o=new WeakMap;let a=0;const t=b=>{let y=o.get(b);return y||(a+=1,y=`fallback-${a}`,o.set(b,y)),y},i=b=>{const y=n.option.table?.rowKey,B=y?b[y]:void 0;return B!=null&&B!==""?String(B):t(b)},l=(b,y)=>`${i(b)}-${y.key}`,c=b=>pe(b,n.option.form?.error),f=fe(c),d=()=>{Object.keys(s).forEach(b=>{delete s[b]})},g=(b,y)=>{delete s[l(b,y)]},p=(b,y)=>s[l(b,y)]||"",m=(b,y)=>b.message||c(y),h=b=>b==null||b===""||Array.isArray(b)&&b.length===0,C=b=>{if(typeof b=="number")return b;if(typeof b=="string"||Array.isArray(b))return b.length},E=(b,y)=>{if(b==="array")return Array.isArray(y);if(b==="integer")return typeof y=="number"&&Number.isInteger(y);if(b==="float")return typeof y=="number"&&!Number.isInteger(y);if(b==="number")return typeof y=="number"&&!Number.isNaN(y);if(b==="boolean")return typeof y=="boolean";if(b==="object")return y!==null&&typeof y=="object"&&!Array.isArray(y);if(b==="date")return y instanceof Date||!Number.isNaN(new Date(y).getTime());if(b==="email")return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(y));if(b==="url")try{return new URL(String(y)),!0}catch{return!1}return b==="string"?typeof y=="string":!0},S=(b,y,B)=>typeof b.validator!="function"?Promise.resolve(!0):new Promise(z=>{let O=!1;const D=M=>{if(!O){if(O=!0,M==null){z(!0);return}if(M instanceof Error){z(M.message||m(b,B));return}if(Array.isArray(M)){const v=M[0];z(v instanceof Error?v.message:String(v||m(b,B)));return}z(String(M))}};try{const M=b.validator(b,y,D);M&&typeof M.then=="function"?M.then(()=>D()).catch(D):M===!1?D(m(b,B)):typeof M=="string"||M instanceof Error?D(M):b.validator.length<3&&D()}catch(M){D(M)}}),N=async(b,y,B)=>{const z=typeof b.transform=="function"?b.transform(y):y,O=h(z);if(b.required&&O)return m(b,B);if(O&&!b.required)return!0;if(b.whitespace&&typeof z=="string"&&z.trim()===""||b.type&&!E(b.type,z)||Array.isArray(b.enum)&&!b.enum.includes(z)||b.pattern&&!new RegExp(b.pattern).test(String(z)))return m(b,B);const D=C(z);return b.len!==void 0&&D!==void 0&&D!==b.len||b.min!==void 0&&D!==void 0&&D<b.min||b.max!==void 0&&D!==void 0&&D>b.max?m(b,B):S(b,z,B)},Z=b=>{const y=r();return!b.key||!y.table.column.show.list.includes(b.key)||b.table?.header?.groupKey!==void 0&&!b.table.header.show?!1:b.show?.table!==void 0?w.isFun(b.show?.table,y.table.data):!0},x=(b,y)=>b.show?.form!==void 0?w.isFun(b.show.form,y,w.EDialog.Update):!0,A=()=>{const b=r(),y=[],B=z=>{z.forEach(O=>{if(Z(O)){if(O.children?.length){B(O.children);return}y.push(O)}})};return B(b.table.column.list),y},_=async(b,y)=>{if(!x(y,b))return g(b,y),!0;const B=f(y,b);if(!B)return!0;g(b,y);const z=Array.isArray(B)?B:[B];for(const O of z){const D=await N(O,b[y.key],y);if(D!==!0)return s[l(b,y)]=D,{field:y.key,error:D}}return!0},I=b=>{const y=[],B=z=>{z.forEach(O=>{y.push(O),Array.isArray(O.children)&&O.children.length&&B(O.children)})};return B(b),y};return{tableEditValidate:{errors:s,clear:d,clearField:g,getFieldError:p,validate:async()=>{if(d(),!n.option.table?.editMode)return!0;const b=r(),y=A(),B=I(b.table.data||[]),O=(await Promise.all(B.flatMap(D=>y.map(M=>_(D,M))))).filter(D=>D!==!0);if(O.length)throw K(O),!1;return!0}}}};class ue{static exportToExcel=async(n,s,o)=>{if(!n||n.length===0)return;const a=await w.loadModule("xlsx"),t=n.map(c=>{const f={};return s.forEach(d=>{f[d.label]=c[d.key]}),f}),i=a.utils.json_to_sheet(t),l=a.utils.book_new();a.utils.book_append_sheet(l,i,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,a.writeFile(l,`${o}.xlsx`)}}const Ye=(r,n)=>({export:{run:{start:async s=>{let a=await r().export.run[s]();const t=n.option.column,i=ObjectUtil.deepMerge({data:a,columns:t},{}),l=n.option.tools?.export||{};l.before?.(i),ue.exportToExcel(i.data,i.columns,l.fileName)},select:async()=>{const s=r();s.export.loading=!0;try{if(n.option.tools?.export?.select){await n.option.tools.export.select({...s.page.getQuery(),items:s.table.selection.list});return}if(s.table.selection.list.length===0)throw w.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return s.table.selection.list}catch(o){console.error(o)}finally{s.export.loading=!1}},page:async()=>{const s=r();s.export.loading=!0;try{if(n.option.tools?.export?.page){await n.option.tools.export.page({...s.page.getQuery()});return}if(s.table.data.length===0)throw w.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return s.table.data}catch(o){console.error(o)}finally{s.export.loading=!1}},all:async()=>{const s=r();s.export.loading=!0;try{if(n.option.tools?.export?.all){await n.option.tools.export.all({...s.page.getQuery()});return}const o=n.option.api.list,a=await o({...s.page.getQuery({size:999999,num:1})});return(a.data||{[V.config.field.result.list]:a})[V.config.field.result.list]}catch(o){console.error(o)}finally{s.export.loading=!1}}},loading:!1,click:s=>{const o=r();o.export.loading||o.export.run.start(s)}}}),Ze=(r,n)=>({remove:{title:k.tCurd("deleteTitle"),show:!1,items:[],loading:!1,close:()=>{r().remove.show=!1},open:s=>{if(s.length===0){w.fail(k.tCurd("selectDataToDelete"));return}const o=r();o.remove.items=s,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{const s=r();s.remove.loading=!0;const o=n.option.api.delete;try{if(!o)return;await o({[n.option.table?.rowKey]:s.remove.items.map(a=>a[n.option.table?.rowKey]),items:s.remove.items}),w.success(k.tCurd("operationSuccess")),s.table.data.length<=1&&s.page.num>1&&(s.page.num-=1),s.remove.close(),await s.table.getList()}catch(a){console.error(a)}finally{s.remove.loading=!1}})}}}),xe=(r,n,s)=>({apiDataMap:{},getColumnSpan:(o,a)=>{const t=r(),i=t.update.formGrid?.length?t.update.formGrid:a||[];return ae(o,i,t.update.form,t.update.type,{maxSpan:t.update.formMaxSpan||n.option.form?.maxSpan,defaultSpan:n.option.form?.defaultSpan||V.config.form.defaultSpan})},init:()=>{const o=r();o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},initApiData:async o=>{const a=r(),t=[],i=l=>{if(l.children?.length){l.children.forEach(f=>i(f));return}const c=L(l);if(l.options?.[c]?.dataApi&&l.options?.[c]?.dataApiConfig?.[o]){if(a.apiDataMap[l.key]&&l.options?.[c]?.dataApiConfig?.once)return;const f=(async()=>{try{let d=await l.options?.[c]?.dataApi?.(a.update.form,a.update.type);if(d){const g=l.options?.[c]?.dataPath;!Array.isArray(d)&&g&&(d=ObjectUtil.getPathValue(d,g)),l.options[c].data=d,l.options.search[c].data=d,l.options.search[l.options.search.type??c]||(l.options.search[l.options.search.type??c]={}),l.options.search[l.options.search.type??c].data=d,l.options.formAdd[c].data=d,l.options.formUpdate[c].data=d,a.apiDataMap[l.key]=d}}catch{}})();t.push(f)}};return n.option.column.forEach(l=>i(l)),await Promise.all(t),!0},initCurdConfig:()=>{const o=ObjectUtil.deepMerge(V.config,{});o.table.emptyText=k.tCurd("noData"),n.option.size=n.option.size||{},o.table.size=n.option.size.table||o.size.table,o.form.size=n.option.size.form||o.size.form,o.size.search=n.option.size.search||o.size.search;const a=ObjectUtil.deepMerge(o,n.option||{});Object.keys(a).forEach(t=>{n.option[t]=a[t]})},initColumnOptions:()=>{const o=r();let a=JSONUtil.cp(V.config.columnConfig);a.options=ObjectUtil.deepMerge({switch:{activeText:k.tCurd("switchOn"),inactiveText:k.tCurd("switchOff")}},a.options);const t=i=>{const l=L(i);for(const f in a){if(f==="table"){if(i.table=ObjectUtil.deepMerge(a.table,i.table||{}),i.children){i.children.forEach(d=>t(d));return}}else f==="type"?i.type=i.type||a.type:i[f]=ObjectUtil.deepMerge(a[f],i[f]||{});i.options=i.options||{},i.options[l]=i.options[l]||{},i.options[l].size=n.option.size.form}["search","formAdd","formUpdate"].forEach(f=>{i.options[f]=ObjectUtil.deepMerge(i.options,i.options[f]||{}),f==="search"?n.option.size.search&&(i.options[f][l].size=n.option.size.search):n.option.size.form&&(i.options[f][l].size=n.option.size.form)}),i.table=ObjectUtil.deepMerge(i.table,i.options[l].table||{}),l==="switch"&&(i.options.switch.tableBeforeChange=async(f,d)=>{const g=i.options?.switch;try{g.tableConfig?.confirm&&await s.switchConfirmRef.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")});try{if(!n.option.api.update&&!g.tableConfig?.api)return;const p=d[n.option.table?.rowKey];g.loadingMap||(g.loadingMap={}),g.loadingMap[p]||(g.loadingMap[p]={loading:!1}),g.loadingMap[p].loading=!0;const m=d[f]===g.activeValue?g.inactiveValue:g.activeValue,h=g.tableConfig?.api?g.tableConfig.api:n.option.api.update;if(!h)return;try{await h({...d,[f]:m},"switch")}catch{return!1}finally{g.loadingMap[p].loading=!1}return w.success(k.tCurd("operationSuccess")),g.tableConfig?.loadList&&(o.table.loading=!0,o.table.getList(),o.table.loading=!1),!0}catch(p){return console.error(p),!1}finally{o.table.loading=!1}}catch{return!1}}),l==="treeSelect"&&(i.options.treeSelect.rowKey=n.option.table?.rowKey,i.options.treeSelect.nodeKey=n.option.table?.rowKey)};n.option.column.forEach(t),n.option.table?.column?.forEach(t)},initColumnForm:()=>{const o=r(),a=n.option;o.update.formColumn=[],o.update.formGrid=[],o.update.formMaxSpan=12,o.table.column.show={list:[],listSource:[]};const t=n.option.form?.maxSpan||12,i=n.option.form?.defaultSpan||t/2,l=me(n.option.form),c=p=>{if(p.children){o.table.column.show.list.push(p.key),p.children.forEach(m=>c(m));return}o.update.formDefault[p.key]=p.value,p.table?.table&&(p.show?.table&&o.table.column.show.list.push(p.key),o.table.column.show.listSource.push(p.key))};a.column.forEach(p=>{P(p,!0),c(p)}),n.option.table?.column?.forEach(p=>{P(p,!1),c(p)}),o.search.column.list=a.column.concat(a.table?.column||[]),o.table.column.list=o.search.column.list.filter(p=>p.table?.table),o.search.column.list.sort((p,m)=>p.sort?.search-m.sort?.search),o.table.column.list.sort((p,m)=>p.sort?.table-m.sort?.table),o.update.rules={},Y(a.column,o.update.formDefault,o.update.rules,p=>l(p,()=>o.update.form)),a.table?.editMode&&Y(a.table?.column||[],o.update.formDefault,o.update.rules,p=>l(p,()=>o.update.form));const f=de(a.column,{maxSpan:t,defaultSpan:i,layout:n.option.form?.layout});o.update.formGrid=f.cells,o.update.formMaxSpan=f.maxSpan,o.update.formColumn=ie(f.cells);const d=n.option.search?.formDefault;d&&Object.keys(d).forEach(p=>{o.search.formDefault[p]=d[p]}),a.column.forEach(p=>{p.show?.search||(o.search.formDefault[p.key]=void 0)});const g=ObjectUtil.deepMerge(o.search.formDefault,{});U.setValue(o.search.form,g,!0)}}),_e=r=>{const n=e.ref(),s=e.ref(),o=e.ref(),a={switchConfirmRef:n,ruleFormRef:s,tableRef:o},t=e.getCurrentInstance(),i=J.Scope.getConf("curdConf"),l=g=>{g=g||f;let p=g,m=g;for(;p?.parentCurdConf;)m=p.parentCurdConf,p=p.parentCurdConf;return m},c=()=>f;let f=e.reactive({parentCurdConf:i,getCurdConf:l,getRootCurdConf:l,...We(),option:r.option,...Pe(c,r),...Je(c,r),...Qe(c,r,a),...Xe(c,r),...Ye(c,r),...$e(c,r,a),...Ze(c,r),...xe(c,r,a)});f.init();const d=t?`curdRef-${t.uid}`:"";return i?.formRef&&d&&(i.formRef.set(d,{validate:async g=>{const p=await f.update.validate(!1);if(g?.(!!p),!p)throw!1;return!0}}),e.onUnmounted(()=>{i.formRef.remove(d)})),e.onMounted(()=>{if(r.option.init!==!1){if(r.option.table?.sortable?.show&&!r.option.table?.sortable?.button){(f.table?.sortable.getOption()).scroll||(r.option.table.fitHeight=!1),f.table.sortable.refreshList();return}f.table.getList()}}),e.onBeforeUnmount(()=>{f.table.sortable.destroy()}),J.Scope.setConf("curdConf",f),{conf:f,switchConfirmRef:n,ruleFormRef:s,tableRef:o}},ve={class:"dialog-footer"},et=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(r,{expose:n}){const s=e.ref(!1),o=e.ref("确认修改"),a=e.ref("确认要修改状态吗?");let t=null,i=null;const l=d=>(d?.title&&(o.value=d.title),d?.content&&(a.value=d.content),s.value=!0,new Promise((g,p)=>{t=g,i=p})),c=()=>{s.value=!1,t?.(!0),t=null,i=null},f=()=>{s.value=!1,i?.(new Error("用户取消操作")),t=null,i=null};return n({open:l}),(d,g)=>{const p=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(u.ElDialog),{modelValue:s.value,"onUpdate:modelValue":g[0]||(g[0]=m=>s.value=m),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(p,{size:d.size},{default:e.withCtx(()=>[e.createElementVNode("span",ve,[e.createVNode(e.unref(u.ElButton),{onClick:f},{default:e.withCtx(()=>g[1]||(g[1]=[e.createTextVNode("取消")])),_:1}),e.createVNode(e.unref(u.ElButton),{type:"primary",onClick:c},{default:e.withCtx(()=>g[2]||(g[2]=[e.createTextVNode("确认")])),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(a.value),1)]),_:1},8,["modelValue","title"])}}}),tt=["innerHTML"],ot=e.defineComponent({__name:"text",props:{content:{},value:{}},setup(r){const n=r,s=e.computed(()=>typeof n.content=="function"?n.content(n.value):n.content);return(o,a)=>typeof s.value=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value),{key:0})):(e.openBlock(),e.createElementBlock("div",{key:1,innerHTML:s.value},null,8,tt))}}),he=e.defineComponent({__name:"searchField",props:{item:{},conf:{},type:{}},setup(r){const n=r,s=e.computed({get:()=>n.conf.search.form?.[n.item?.key],set:o=>{n.item?.key!==void 0&&(n.conf.search.form[n.item.key]=o)}});return(o,a)=>e.unref(R).customComponent[o.type??""]?.search?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(R).customComponent[o.type??""]?.search),e.mergeProps({key:0,modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=t=>s.value=t)},o.item.options?.search?.[o.type??""],e.toHandlers(o.item.options?.search?.[o.type??""]?.on||{})),null,16,["modelValue"])):o.type==="input"?(e.openBlock(),e.createBlock(e.unref(u.ElInput),e.mergeProps({key:1,modelValue:s.value,"onUpdate:modelValue":a[1]||(a[1]=t=>s.value=t),placeholder:o.conf.search.getPlaceholder(o.item),clearable:"",disabled:o.item.disabled?.search},o.item.options?.search?.input||o.item.options?.input,e.toHandlers(o.item.options?.search?.input?.on||o.item.options?.input?.on||{})),null,16,["modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(u.ElSelect),e.mergeProps({key:2,modelValue:s.value,"onUpdate:modelValue":a[2]||(a[2]=t=>s.value=t),placeholder:o.conf.search.getPlaceholder(o.item,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.item.disabled?.search},o.item.options?.search?.switch||o.item.options?.switch,e.toHandlers(o.item.options?.search?.switch?.on||o.item.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:o.item.options?.switch?.activeValue,label:o.item.options?.switch?.activeText,value:o.item.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:o.item.options?.switch?.inactiveValue,label:o.item.options?.switch?.inactiveText,value:o.item.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:1},16,["modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(u.ElSelect),e.mergeProps({key:3,modelValue:s.value,"onUpdate:modelValue":a[3]||(a[3]=t=>s.value=t),placeholder:o.conf.search.getPlaceholder(o.item,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.item.disabled?.search},o.item.options?.search?.select||o.item.options?.select,e.toHandlers(o.item.options?.search?.select?.on||o.item.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.options?.search?.select?.data||o.item.options?.select?.data||[],t=>(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","placeholder","disabled"])):o.type==="radio"?(e.openBlock(),e.createBlock(e.unref(u.ElRadioGroup),e.mergeProps({key:4,modelValue:s.value,"onUpdate:modelValue":a[4]||(a[4]=t=>s.value=t),disabled:o.item.disabled?.search},o.item.options?.search?.radio||o.item.options?.radio,e.toHandlers(o.item.options?.search?.radio?.on||o.item.options?.radio?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.item.options?.radio?.data,t=>(e.openBlock(),e.createBlock(e.unref(u.ElRadio),{key:t.value,label:t.label,value:t.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):o.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(u.ElDatePicker),e.mergeProps({key:5,modelValue:s.value,"onUpdate:modelValue":a[5]||(a[5]=t=>s.value=t),disabled:o.item.disabled?.search},o.item.options?.search?.datetime||o.item.options?.datetime,e.toHandlers(o.item.options?.search?.datetime?.on||o.item.options?.datetime?.on||{})),null,16,["modelValue","disabled"])):o.type&&e.unref(R).customComponent[o.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(R).customComponent[o.type]),e.mergeProps({key:6,modelValue:s.value,"onUpdate:modelValue":a[6]||(a[6]=t=>s.value=t)},o.item.options?.search?.[o.type]||o.item.options?.[o.type],e.toHandlers(o.item.options?.search?.[o.type]?.on||o.item.options?.[o.type]?.on||{}),{disabled:o.item.disabled?.search}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}),j=(r,n)=>{const s=r.__vccOpts||r;for(const[o,a]of n)s[o]=a;return s},nt={},rt={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function at(r,n){return e.openBlock(),e.createElementBlock("svg",rt,n[0]||(n[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 lt=j(nt,[["render",at]]),it={},st={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function dt(r,n){return e.openBlock(),e.createElementBlock("svg",st,n[0]||(n[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 ct=j(it,[["render",dt]]),ft={},pt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function mt(r,n){return e.openBlock(),e.createElementBlock("svg",pt,n[0]||(n[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 gt=j(ft,[["render",mt]]),bt={},ut={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function ht(r,n){return e.openBlock(),e.createElementBlock("svg",ut,n[0]||(n[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 ye=j(bt,[["render",ht]]),yt={},kt={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function wt(r,n){return e.openBlock(),e.createElementBlock("svg",kt,n[0]||(n[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 Ct=j(yt,[["render",wt]]),Bt={},Vt={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function Et(r,n){return e.openBlock(),e.createElementBlock("svg",Vt,n[0]||(n[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 St=j(Bt,[["render",Et]]),Nt={class:"row flex-center table-header-label inline"},Dt={class:"table-header-tooltip"},Ft=["innerHTML"],zt={key:1,class:"table-header-required"},Ot=["onClick"],Mt={key:0,class:"table-edit-form"},$t={key:1},Rt=["onClick","innerHTML"],Tt=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(r){const n=w.isFun,s=r,a=e.getCurrentInstance().type,t=l=>l===!0?!0:(Array.isArray(l)?l:l?[l]:[]).some(f=>f?.required===!0),i=l=>s.option.table?.editMode?t(l.rules)||t(s.conf.update.rules?.[l.key]):!1;return(l,c)=>{const f=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.columnList,d=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:d.key},[l.conf.table.column.show.list.includes(d.key)&&(d.show?.table===void 0||e.unref(n)(d.show?.table,l.conf.table.data))?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.table?.header?.groupKey===void 0||d.table.header.show?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:0,prop:d.key,label:d.label,ref_for:!0},d.table),{header:e.withCtx(()=>[e.renderSlot(l.$slots,"table-header-"+d.key,{item:d},()=>[e.createElementVNode("div",Nt,[d.table?.header?.tooltip?(e.openBlock(),e.createBlock(f,{key:0,effect:"dark",placement:"top"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:d.table?.header?.tooltip},null,8,Ft)]),default:e.withCtx(()=>[e.createElementVNode("span",Dt,[e.createVNode(ye)])]),_:2},1024)):e.createCommentVNode("",!0),i(d)?(e.openBlock(),e.createElementBlock("span",zt,"*")):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(d.label)+" ",1),d.table?.header?.group!==void 0?(e.openBlock(),e.createElementBlock("span",{key:2,class:"table-header-plus",onClick:e.withModifiers(()=>{d.table.header.group=!d.table.header.group,l.columnList.forEach(g=>{g.table?.header?.groupKey===d.key&&(g.table.header.show=!d.table.header.group)})},["stop"])},[d.table.header.group?(e.openBlock(),e.createBlock(Ct,{key:0})):(e.openBlock(),e.createBlock(St,{key:1}))],8,Ot)):e.createCommentVNode("",!0)])])]),default:e.withCtx(({row:g})=>[d.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[c[0]||(c[0]=e.createTextVNode("   ")),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(a)),{conf:l.conf,columnList:d.children,option:l.option},e.createSlots({_:2},[e.renderList(l.$slots,(p,m)=>({name:m,fn:e.withCtx(h=>[e.renderSlot(l.$slots,m,e.mergeProps({ref_for:!0},h||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l.option.table?.editMode?(e.openBlock(),e.createElementBlock("div",Mt,[e.createVNode(e.unref(u.ElFormItem),{size:l.option.size?.table,error:l.conf.tableEditValidate.getFieldError(g,d),class:"table-edit-form-item"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["row",["table-edit-"+d.key]]),style:{width:"100%"}},[e.renderSlot(l.$slots,"table-edit-left-"+d.key,{row:g,item:d}),d.type==="input"?(e.openBlock(),e.createBlock(e.unref(u.ElInput),e.mergeProps({key:0,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),class:"col",ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{"onUpdate:modelValue":p=>l.conf.tableEditValidate.clearField(g,d)}),e.createSlots({_:2},[d.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof d.options?.input?.prepend=="function"?d.options?.input?.prepend(g):d.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):d.type==="select"?(e.openBlock(),e.createBlock(e.unref(u.ElSelect),e.mergeProps({key:1,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),class:"col",ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{"onUpdate:modelValue":p=>l.conf.tableEditValidate.clearField(g,d)}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.options?.search?.select?.data||d.options?.select?.data,p=>(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):d.type==="switch"?(e.openBlock(),e.createBlock(e.unref(u.ElSwitch),e.mergeProps({key:2,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),class:"col",ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{"onUpdate:modelValue":p=>l.conf.tableEditValidate.clearField(g,d)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"table-edit-right-"+d.key,{row:g,item:d})],2)]),_:2},1032,["size","error"])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l.conf.update.type===e.unref(w).EDialog.Update&&e.unref(n)(d.show?.form,l.conf.update.form,e.unref(w).EDialog.Update)&&l.option.table?.inlineEdit&&l.conf.update.form[l.option.table?.rowKey]===g[l.option.table?.rowKey]&&(d.type==="input"||d.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[d.type==="input"?(e.openBlock(),e.createBlock(e.unref(u.ElInput),e.mergeProps({key:0,modelValue:l.conf.update.form[d.key],"onUpdate:modelValue":p=>l.conf.update.form[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{style:{width:"100%"}}),e.createSlots({_:2},[d.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof d.options?.input?.prepend=="function"?d.options?.input?.prepend(g):d.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):d.type==="select"?(e.openBlock(),e.createBlock(e.unref(u.ElSelect),e.mergeProps({key:1,modelValue:l.conf.update.form[d.key],"onUpdate:modelValue":p=>l.conf.update.form[d.key]=p,disabled:l.conf.update.getDisabled(d,!0),ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.options?.search?.select?.data||d.options?.select?.data,p=>(e.openBlock(),e.createBlock(e.unref(u.ElOption),{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):d.type==="switch"?(e.openBlock(),e.createBlock(e.unref(u.ElSwitch),e.mergeProps({key:2,modelValue:l.conf.update.form[d.key],"onUpdate:modelValue":p=>l.conf.update.form[d.key]=p,ref_for:!0},l.conf.update.getBind(d),e.toHandlers(l.conf.update.getOn(d,g)),{disabled:l.conf.update.getDisabled(d,!0)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)],64)):e.renderSlot(l.$slots,"table-"+d.key,{key:1,row:g,item:d},()=>[e.unref(R).customComponent[d.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(R).customComponent[d.type??""]?.table),e.mergeProps({key:0,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,ref_for:!0},d.options?.[d.type??""],e.toHandlers(d.options?.[d.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):d.type==="switch"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[d.options?.switch?.tableConfig?.change?(e.openBlock(),e.createBlock(e.unref(u.ElSwitch),e.mergeProps({key:0,modelValue:g[d.key],"onUpdate:modelValue":p=>g[d.key]=p,loading:d.options?.switch?.loadingMap?.[g[l.option.table?.rowKey]]?.loading,"before-change":()=>d.options?.switch?.tableBeforeChange?.(d.key,g),ref_for:!0},d.options?.switch),null,16,["modelValue","onUpdate:modelValue","loading","before-change"])):(e.openBlock(),e.createElementBlock("span",$t,e.toDisplayString(g[d.key]===d.options?.switch?.activeValue?d.options?.switch?.activeText:d.options?.switch?.inactiveText),1))],64)):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":d.table?.click?.color}),class:e.normalizeClass({"table-text-click":d.table?.click?.callback}),onClick:p=>d.table?.click?.callback?.(g),innerHTML:d.table?.format?d.table?.format(g):g[d.key]},null,14,Rt))])],64))],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],64))),128)}}}),Ut={key:0,class:"relative curd-search fit-width"},At={class:"mb-10 flex justify-between items-center fit-width"},Lt={class:"flex items-center",style:{gap:"10px"}},Ht={key:0},jt={key:1},It={key:2},Kt={class:"export-btn"},Gt={key:1,class:"export-btn"},qt={class:"flex items-center table-tools-right",style:{gap:"10px"}},Wt={class:"table-sortable-tooltip"},Pt=["innerHTML"],Jt={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},Qt={class:"dialog-footer"},Xt={key:0},Yt={key:1},Zt={class:"dialog-footer"},ke=e.defineComponent({__name:"index",props:{option:{default:{}},form:{default:void 0},searchForm:{default:void 0}},setup(r,{expose:n}){const s=w.EDialog,o=r,a=w.isFun,{conf:t,switchConfirmRef:i,ruleFormRef:l,tableRef:c}=_e(o);return n({conf:t}),(f,d)=>{const g=e.resolveComponent("el-tooltip"),p=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[r.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[r.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",[r.option.table?.fitHeight?"col":""]])},[r.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",Ut,[e.createVNode(e.unref(u.ElForm),{model:e.unref(t).search.form,inline:"",size:r.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-start",{row:e.unref(t).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(t).search.column.list,m=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m.key},[e.renderSlot(f.$slots,"search-"+m.key+"-start",{row:e.unref(t).search.form}),(typeof m.show?.search=="function"?m.show?.search(e.unref(t).search.form):m.show?.search)?(e.openBlock(),e.createBlock(e.unref(u.ElFormItem),{key:0,label:m.text?.search?.label??m.label},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"search-"+m.key+"-left",{row:e.unref(t).search.form}),e.renderSlot(f.$slots,"search-"+m.key,{row:e.unref(t).search.form},()=>[m.options?.search?.type?(e.openBlock(),e.createBlock(he,{key:0,item:m,conf:e.unref(t),type:m.options.search.type},null,8,["item","conf","type"])):(e.openBlock(),e.createBlock(he,{key:1,item:m,conf:e.unref(t),type:m.type},null,8,["item","conf","type"]))]),e.renderSlot(f.$slots,"search-"+m.key+"-right",{row:e.unref(t).search.form})]),_:2},1032,["label"])):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-"+m.key+"-end",{row:e.unref(t).search.form})],64))),128)),e.renderSlot(f.$slots,"search-center",{row:e.unref(t).search.form}),r.option.tools?.search||r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(u.ElFormItem),{key:0},{default:e.withCtx(()=>[r.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:0,type:"primary",onClick:e.unref(t).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),r.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:1,onClick:e.unref(t).search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"search-end",{row:e.unref(t).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",At,[e.createElementVNode("div",Lt,[e.unref(a)(r.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Ht,[e.createVNode(e.unref(u.ElButton),{type:"primary",onClick:d[0]||(d[0]=m=>e.unref(t).update.open(e.unref(s).Add)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),e.unref(a)(r.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",jt,[e.createVNode(e.unref(u.ElButton),{type:"danger",onClick:d[1]||(d[1]=m=>e.unref(t).remove.open(e.unref(t).table.selection.list)),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(e.unref(u.ElButton),{type:"warning",onClick:d[2]||(d[2]=m=>e.unref(t).table.expand.all()),size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),r.option.tools?.export?.show?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[r.option.tools?.export?.dropdown?.show?(e.openBlock(),e.createBlock(e.unref(u.ElDropdown),{key:0,onCommand:e.unref(t).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(u.ElDropdownMenu),{size:r.option.size?.search},{default:e.withCtx(()=>[r.option.tools?.export?.dropdown?.select&&(r.option.table?.selectable||e.unref(a)(r.option.tools?.delete))?(e.openBlock(),e.createBlock(e.unref(u.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),r.option.tools?.export?.dropdown?.page?(e.openBlock(),e.createBlock(e.unref(u.ElDropdownItem),{key:1,command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1})):e.createCommentVNode("",!0),r.option.tools?.export?.dropdown?.all?(e.openBlock(),e.createBlock(e.unref(u.ElDropdownItem),{key:2,command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",Kt,[e.createVNode(e.unref(u.ElButton),{type:"warning",loading:e.unref(t).export.loading,size:r.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading","size"])])]),_:1},8,["onCommand"])):(e.openBlock(),e.createElementBlock("div",Gt,[e.createVNode(e.unref(u.ElButton),{type:"warning",loading:e.unref(t).export.loading,size:r.option.size?.search,onClick:d[3]||(d[3]=m=>e.unref(t).export.run.start("all"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading","size"])]))],64)):e.createCommentVNode("",!0),e.renderSlot(f.$slots,"tools-left")]),e.createElementVNode("div",qt,[e.renderSlot(f.$slots,"tools-right"),e.unref(t).page.showTools&&e.unref(t).table.sortable.showPagination()?(e.openBlock(),e.createBlock(e.unref(u.ElPagination),e.mergeProps({key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":d[4]||(d[4]=m=>e.unref(t).page.num=m),"page-size":e.unref(t).page.size,"onUpdate:pageSize":d[5]||(d[5]=m=>e.unref(t).page.size=m),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":e.unref(t).page.pagerCount,layout:e.unref(t).page.layout,total:e.unref(t).page.total,size:r.option.size?.table,onSizeChange:e.unref(t).table.sortable.refreshList,onCurrentChange:e.unref(t).table.sortable.refreshList},r.option.page?.pagination||{},e.toHandlers(r.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),e.unref(t).table.sortable.showTriggerButton()?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:1,type:"warning",onClick:e.unref(t).table.sortable.start,size:r.option.size?.search,loading:e.unref(t).table.sortable.actionLoading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableStart")),1)]),_:1},8,["onClick","size","loading"])):e.createCommentVNode("",!0),e.unref(t).table.sortable.showActionButton()?(e.openBlock(),e.createBlock(e.unref(u.ElDropdown),{key:2,onCommand:e.unref(t).table.sortable.command},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(u.ElDropdownMenu),{size:r.option.size?.search},{default:e.withCtx(()=>[e.createVNode(e.unref(u.ElDropdownItem),{command:"save"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableSave")),1)]),_:1}),e.createVNode(e.unref(u.ElDropdownItem),{command:"exit"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableExit")),1)]),_:1})]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createVNode(e.unref(u.ElButton),{type:"warning",size:r.option.size?.search,loading:e.unref(t).table.sortable.actionLoading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableAction")),1)]),_:1},8,["size","loading"])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.unref(t).table.sortable.showSaveButton()?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:3,type:"warning",onClick:e.unref(t).table.sortable.save,size:r.option.size?.search,loading:e.unref(t).table.sortable.actionLoading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("sortableSave")),1)]),_:1},8,["onClick","size","loading"])):e.createCommentVNode("",!0),r.option.tools?.expandColumn===void 0||r.option.tools?.expandColumn?(e.openBlock(),e.createBlock(g,{key:4,effect:"dark",content:e.unref(t).table.header.group.expand?e.unref(k).tCurd("mergeColumn"):e.unref(k).tCurd("expandColumn"),placement:"top"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["refresh-btn",[r.option.size?.search]]),onClick:d[6]||(d[6]=(...m)=>e.unref(t).table.header.group.toggleExpandAll&&e.unref(t).table.header.group.toggleExpandAll(...m))},[e.unref(t).table.header.group.expand?(e.openBlock(),e.createBlock(lt,{key:0})):(e.openBlock(),e.createBlock(ct,{key:1}))],2)]),_:1},8,["content"])):e.createCommentVNode("",!0),r.option.tools?.refresh===void 0||r.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:5,class:e.normalizeClass(["refresh-btn",[r.option.size?.search]]),onClick:d[7]||(d[7]=(...m)=>e.unref(t).table.sortable.refreshList&&e.unref(t).table.sortable.refreshList(...m))},[e.createVNode(gt)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[r.option.table?.fitHeight?"col ":"",r.option.table?.editMode?"edit-mode":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[r.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(u.ElTable),e.mergeProps({ref_key:"tableRef",ref:c,data:e.unref(t).table.data,border:r.option.table?.border===void 0?!0:r.option.table?.border,class:{"cc1-form-sortable-no-scroll":e.unref(t).table.sortable.disableScroll()},onSelectionChange:e.unref(t).table.selection.change,onSortChange:e.unref(t).table.sort.change,"expand-row-keys":e.unref(t).table.expand.rowKeys,onExpandChange:e.unref(t).table.expand.change},e.unref(t).table.sortable.getTableBindOption(),e.toHandlers(r.option.table?.on||{})),{default:e.withCtx(()=>[(typeof r.option.table?.selectable=="object"?r.option.table?.selectable?.show:r.option.table?.selectable)||e.unref(a)(r.option.tools?.delete)||r.option.tools?.export?.show&&r.option.tools?.export?.select?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:0,type:"selection",width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1,className:"cc1-form-selectable-column"},typeof r.option.table?.selectable=="object"?r.option.table?.selectable:{},e.toHandlers(typeof r.option.table?.selectable=="object"?r.option.table?.selectable?.on||{}:{})),null,16)):e.createCommentVNode("",!0),(typeof r.option.table?.index=="object"?r.option.table?.index?.show:r.option.table?.index)?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:1,type:"index",fixed:"left",width:"40",align:"center",label:"#","show-overflow-tooltip":!1,className:"cc1-form-index-column"},typeof r.option.table?.index=="object"?r.option.table?.index:{},e.toHandlers(typeof r.option.table?.index=="object"?r.option.table?.index?.on||{}:{})),null,16)):e.createCommentVNode("",!0),e.unref(t).table.sortable.isActive()?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:2,align:"center","show-overflow-tooltip":!1,className:"cc1-form-drag-column"},e.unref(t).table.sortable.getColumnBind(),e.toHandlers(e.unref(t).table.sortable.getColumnBind().on||{})),{header:e.withCtx(()=>[e.renderSlot(f.$slots,"table-header-sortable",{},()=>[e.createVNode(g,{effect:"dark",placement:"top"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:r.option.table?.sortable?.tipText??e.unref(k).tCurd("sortable")},null,8,Pt)]),default:e.withCtx(()=>[e.createElementVNode("span",Wt,[e.createVNode(ye)])]),_:1})])]),default:e.withCtx(()=>d[12]||(d[12]=[e.createElementVNode("span",{class:"cc1-form-drag-handle"},"::",-1)])),_:3},16)):e.createCommentVNode("",!0),e.createVNode(Tt,{conf:e.unref(t),columnList:e.unref(t).table.column.list,option:r.option},e.createSlots({_:2},[e.renderList(f.$slots,(m,h)=>({name:h,fn:e.withCtx(C=>[e.renderSlot(f.$slots,h,e.normalizeProps(e.guardReactiveProps(C||{})))])}))]),1032,["conf","columnList","option"]),e.unref(a)(r.option.table?.add)||e.unref(a)(r.option.table?.update)||e.unref(a)(r.option.table?.delete)||e.unref(a)(r.option.table?.view)||f.$slots["table-op-left"]||f.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(u.ElTableColumn),e.mergeProps({key:3,align:"center",fixed:"right"},r.option.table?.operate,{width:r.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(k).tCurd("operation")),1)])]),default:e.withCtx(({row:m})=>[e.createVNode(e.unref(u.ElForm),{size:r.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"table-op-left",{row:m}),e.unref(t).update.type===e.unref(s).Update&&r.option.table?.inlineEdit&&e.unref(t).update.form[o.option.table?.rowKey]===m[o.option.table?.rowKey]?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(u.ElButton),{link:"",type:"info",onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(u.ElButton),{link:"",type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).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(a)(r.option.table?.add,m)?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:0,link:"",type:"primary",onClick:h=>e.unref(t).update.open(e.unref(s).Add,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.view,m)?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:1,link:"",type:"primary",onClick:h=>e.unref(t).update.open(e.unref(s).View,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("view")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.update,m)?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:2,link:"",type:"warning",onClick:h=>e.unref(t).update.open(e.unref(s).Update,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:2},1032,["onClick"])):e.createCommentVNode("",!0),e.unref(a)(r.option.table?.delete,m)?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:3,link:"",type:"danger",onClick:h=>e.unref(t).remove.open([m])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:2},1032,["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","class","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[p,e.unref(t).table.loading]])],2)],2),e.createElementVNode("div",Jt,[(r.option.page?.show===void 0||r.option.page?.show)&&!e.unref(t).page.showTools&&e.unref(t).table.sortable.showPagination()?(e.openBlock(),e.createBlock(e.unref(u.ElPagination),e.mergeProps({key:0,"current-page":e.unref(t).page.num,"onUpdate:currentPage":d[8]||(d[8]=m=>e.unref(t).page.num=m),"page-size":e.unref(t).page.size,"onUpdate:pageSize":d[9]||(d[9]=m=>e.unref(t).page.size=m),background:"","page-sizes":e.unref(t).page.sizeList,"pager-count":e.unref(t).page.pagerCount,layout:e.unref(t).page.layout,total:e.unref(t).page.total,size:r.option.size?.table,onSizeChange:e.unref(t).table.sortable.refreshList,onCurrentChange:e.unref(t).table.sortable.refreshList},r.option.page?.pagination||{},e.toHandlers(r.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(u.ElDialog),e.mergeProps({modelValue:e.unref(t).update.show,"onUpdate:modelValue":d[10]||(d[10]=m=>e.unref(t).update.show=m),title:e.unref(t).update.title,"before-close":e.unref(t).update.close},r.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",Qt,[e.createVNode(e.unref(u.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.renderSlot(f.$slots,"dialog-footer",{row:e.unref(t).update},()=>[e.createVNode(e.unref(u.ElButton),{onClick:e.unref(t).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(t).update.type!==e.unref(s).View?(e.openBlock(),e.createBlock(e.unref(u.ElButton),{key:0,type:"primary",onClick:e.unref(t).update.submit,loading:e.unref(t).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).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(t).update}),e.createVNode(e.unref(u.ElForm),{ref_key:"ruleFormRef",ref:l,model:e.unref(t).update.form,rules:e.unref(t).update.rules,size:r.option.size?.form,class:"update-dialog-form"},{default:e.withCtx(()=>[e.unref(t).update.showContent?(e.openBlock(),e.createBlock(ge,{key:0,"form-grid":e.unref(t).update.formGrid,"max-span":e.unref(t).update.formMaxSpan,form:e.unref(t).update.form,type:e.unref(t).update.type,stripe:r.option.form?.stripe,"label-width":r.option.form?.labelWidth,"form-option":r.option.form,"get-bind":e.unref(t).update.getBind,"get-on":e.unref(t).update.getOn,"get-disabled":e.unref(t).update.getDisabled},e.createSlots({_:2},[e.renderList(f.$slots,(m,h)=>({name:h,fn:e.withCtx(C=>[e.renderSlot(f.$slots,h,e.normalizeProps(e.guardReactiveProps(C||{})))])}))]),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(t).update})]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(u.ElDialog),{modelValue:e.unref(t).remove.show,"onUpdate:modelValue":d[11]||(d[11]=m=>e.unref(t).remove.show=m),title:e.unref(t).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",Zt,[e.createVNode(e.unref(u.ElForm),{size:r.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(u.ElButton),{onClick:e.unref(t).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(u.ElButton),{type:"danger",onClick:e.unref(t).remove.submit,loading:e.unref(t).remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])]),_:1},8,["size"])])]),default:e.withCtx(()=>[r.option.dialog?.delete?.content?(e.openBlock(),e.createElementBlock("div",Xt,[e.createVNode(ot,{content:r.option.dialog?.delete?.content,value:e.unref(t).remove.items},null,8,["content","value"])])):(e.openBlock(),e.createElementBlock("div",Yt,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",e.unref(t).remove.items.length)),1))]),_:1},8,["modelValue","title"]),e.createVNode(et,{ref_key:"switchConfirmRef",ref:i,size:r.option.size?.form},null,8,["size"])],2)}}});class xt{static async download(n,s="download.png"){const o=document.createElement("a");o.style.display="none",o.href=n,o.setAttribute("download",s),typeof o.download>"u"&&o.setAttribute("target","_blank"),document.body.appendChild(o),o.click(),document.body.removeChild(o),window.URL.revokeObjectURL(n)}static exportJSONFile=(n,s)=>{const o=new Blob([JSON.stringify(n)],{type:"application/json"}),a=URL.createObjectURL(o),t=document.createElement("a");t.href=a,t.download=`${s||"config"}.json`,t.click()};static importFile=async n=>new Promise((s,o)=>{const a=document.createElement("input");a.type="file";const t=n?.accept||".json";a.accept=t,a.style.display="none",a.onchange=i=>{const l=i.target.files[0];if(!l){w.fail("未选择文件"),o("未选择文件");return}const c=new FileReader;c.onload=async f=>{const d=t==".json"?JSON.parse(f.target.result):f.target.result;s(d)},c.onerror=()=>{w.fail("文件读取失败"),o("文件读取失败")},c.readAsText(l),document.body.removeChild(a)},document.body.appendChild(a),a.click()})}const we=(r,n)=>{if(r.component("TCurd",ke),r.component("TFormList",Q),r.component("TColumn",be),n?.customComponent){R.customComponent=n.customComponent;for(const s in n.customComponent)r.component(s,n.customComponent[s])}},_t={install:we};F.ArrUtil=T,F.ExcelUtil=ue,F.TColumn=be,F.TCurd=ke,F.TFile=xt,F.TForm=R,F.TFormConfig=V,F.TFormI18n=k,F.TFormList=Q,F.TSys=w,F.default=_t,F.install=we,Object.defineProperties(F,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
@@ -573,7 +573,7 @@ export interface CurdConfigColumn<T = any> {
573
573
  * - `upload` — 文件上传
574
574
  * - `editor` — 富文本编辑器
575
575
  * - `tree` — 树形控件
576
- * - `tree-select` — 树形选择器 (ElTreeSelect),通过 `options.treeSelect` 配置
576
+ * - `treeSelect` — 树形选择器 (ElTreeSelect),通过 `options.treeSelect` 配置
577
577
  * - `list` — 动态列表表单 (TFormList),通过 `options.list` 配置
578
578
  *
579
579
  * 也可传入自定义组件名称(需通过插件 `customComponent` 选项或 `TForm.customComponent` 注册),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc1-form",
3
- "version": "1.3.9",
3
+ "version": "1.4.0",
4
4
  "description": "我来助你-表单组件库",
5
5
  "repository": {
6
6
  "type": "git",