cc1-form 1.3.1 → 1.3.2
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.umd.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(N,y){typeof exports=="object"&&typeof module<"u"?y(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"],y):(N=typeof globalThis<"u"?globalThis:N||self,y(N.cc1Form={},N.ElementPlus,N.VueRouter,N.Vue,N.cc1Vue3))})(this,(function(N,y,qt,e,W){"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,...l)=>Array.isArray(n)?n.some(o=>typeof o=="function"?o(...l):o):typeof n=="function"?n(...l):n;static getRouterParams=()=>{const n=this.router.currentRoute.value.query||{},l=this.router.currentRoute.value.params||{};return Object.keys(n).length?n:Object.keys(l).length?l:{}};static moduleObj={};static loadModule=async n=>{if(!w.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const l=await w.moduleObj[n]();return l.default??l};static tipMessages={};static tipMessagesGap=500;static showMessage(n,l,o={}){const r=Date.now();if(!this.tipMessages[n]||r-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=r;const a=Object.assign({message:n,type:l},o);y.ElMessage(a),setTimeout(()=>{delete this.tipMessages[n]},this.tipMessagesGap)}}static fail=(n,l={})=>{this.showMessage(n,"error",l)};static success=(n,l={})=>{this.showMessage(n,"success",l)};static loadingObj=null;static loadingTimer=null;static loading=(n=!0,l="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{n?this.loadingObj=y.ElLoading.service({lock:!0,text:l,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(n,l=!0)=>{if(l){let o=screen.width/2-500,r=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="+r+", 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(l,o)=>{let r=document.getElementById(n.id);const a=await w.loadModule("html2canvas");try{a(r,{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(d){let c=d.toDataURL("image/png");l(c)})}catch(d){o(d)}})}class E{static config={field:{page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"}},dialog:{width:"980px",closeOnClickModal:!1},pagination:{layout:"total, sizes, prev, pager, next, jumper",pageSizes:[10,20,50,100],size:10,pagerCount:7,showTools:!1},size:{table:"default",form:"default",search:"default"},tools:{expandColumn:!1,refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,dropdown:{show:!0,select:!0,page:!0,all:!0},fileName:"Export Data "}},form:{size:"default",labelWidth:"120px",stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{index:!1,labelWidth:"100px",size:"default",emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0},fitHeight:!0},columnConfig:{type:"input",form:{width:"100%",spanCol:!1},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},disabled:{view:!0},options:{switch:{activeValue:!0,inactiveValue:!1,tableConfig:{change:!0,confirm:!0,loadList:!0}},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=n=>{E.config=ObjectUtil.deepMerge(E.config,n)}}class ${static customComponent={};static error={};static findOptions=(n,l)=>{const o=n.column.find(a=>a.key===l),r=a=>a.replace(/-([a-z])/g,(d,c)=>c.toUpperCase());if(o)return o.options[r(o.type)]};static setOptionsData=(n,l,o)=>{const r=$.findOptions(n,l);r&&(r.data=o)};static form={openBefore:{parentId:(n,l,o,r)=>{const a=E.config.table.rowKey;n?l.type===w.EDialog.Add?(l.form.parentId=n[a],l.form.sort=n.children.length+1):l.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(l.form.parentId="0",l.form.sort=o.length+1),$.setOptionsData(r,"parentId",[{[a]:"0",title:"根",children:o}])}}}}class R{static getIdFun=()=>StrUtil.uuid();static setId=(n,l,o)=>{l[n]||(l[n]=[]);const r=E.config.table.rowKey;l[n].forEach(a=>{o.forEach(d=>{let c=d.default??"";d.type==="number"&&(c=d.default??0),d.type==="boolean"&&(c=d.default??!1),d.type==="time"&&(c=d.default??new Date),a[d.value]===void 0&&(a[d.value]=c)}),a[r]||(a[r]=R.getIdFun())})};static add=(n,l,o,r)=>{const a=JSONUtil.cp(o);R.setId(n,l,o);const d=E.config.table.rowKey;l[n].push(a.reduce((c,g)=>{let s=g.default??"";return g.type==="number"&&(s=g.default??0),g.type==="boolean"&&(s=g.default??!1),g.type==="time"&&(s=g.default??new Date),c[g.value]=s,c},{[d]:R.getIdFun()})),r?.(l)};static remove=(n,l,o,r)=>{const a=E.config.table.rowKey;l[n]=l[n].filter(d=>d[a]!==o[a]),r?.(l)};static getNoIdData=(n,l)=>{const o=JSONUtil.cp(n),r=E.config.table.rowKey;return o.forEach(a=>{a[r]&&delete a[r],l&&a[l]&&R.getNoIdData(a[l],l)}),o}}const ue={key:0,class:"column curd-form-com-list",style:{width:"100%",gap:"10px"}},he={key:0},ye={class:"row items-center",style:{gap:"10px",width:"100%"}},pe={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(t,{emit:n}){const l=t,o=e.reactive({show:!1,add:(a,d,c)=>{R.add(a,d,c,()=>{r("change")})},remove:(a,d,c)=>{R.remove(a,d,c,()=>{r("change")})}});e.onMounted(()=>{R.setId(l.field,l.row,l.itemFields),o.show=!0});const r=n;return(a,d)=>{const c=e.resolveComponent("el-button"),g=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",ue,[e.renderSlot(a.$slots,"list-start",{row:t.row}),t.addBottom?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(c,{link:"",type:"primary",onClick:d[0]||(d[0]=s=>o.add(t.field,t.row,t.itemFields))},{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("添加",-1)])]),_:1})])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.row[t.field],s=>(e.openBlock(),e.createElementBlock("div",ye,[e.renderSlot(a.$slots,"item-start",{item:s,row:t.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.itemFields,i=>(e.openBlock(),e.createBlock(g,{modelValue:s[i.value],"onUpdate:modelValue":u=>s[i.value]=u,style:e.normalizeStyle({width:t.inputWidth}),class:e.normalizeClass(t.inputClass),placeholder:i[t.label]||i[t.value],onChange:d[1]||(d[1]=u=>r("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(a.$slots,"item-end",{item:s,row:t.row}),e.createVNode(c,{link:"",type:"danger",onClick:i=>o.remove(t.field,t.row,s)},{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),t.addBottom?(e.openBlock(),e.createElementBlock("div",pe,[e.createVNode(c,{link:"",type:"primary",onClick:d[2]||(d[2]=s=>o.add(t.field,t.row,t.itemFields))},{default:e.withCtx(()=>[...d[5]||(d[5]=[e.createTextVNode("添加",-1)])]),_:1})])):e.createCommentVNode("",!0),e.renderSlot(a.$slots,"list-end",{row:t.row})])):e.createCommentVNode("",!0)}}}),be={class:"row form-item-content",style:{width:"100%"}},ke={class:"col column form-item-content-item"},we={class:"col"},Ce=["innerHTML"],Be=e.defineComponent({__name:"field",props:{item:{},form:{},type:{},labelWidth:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(t){return(n,l)=>(e.openBlock(),e.createBlock(e.unref(y.ElFormItem),{label:t.item.text?.form?.label??t.item.label,prop:t.item.key,"label-width":t.item.text?.form?.label==""?0:t.item.form?.labelWidth||t.labelWidth},{default:e.withCtx(()=>[e.createElementVNode("div",be,[e.renderSlot(n.$slots,"form-"+t.item.key+"-start",{row:t.form,item:t.item}),e.createElementVNode("div",ke,[e.createElementVNode("div",we,[e.renderSlot(n.$slots,"form-"+t.item.key,{row:t.form,item:t.item},()=>[t.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:0,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[0]||(l[0]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),e.createSlots({_:2},[t.getBind(t.item).prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof t.getBind(t.item).prepend=="function"?t.getBind(t.item).prepend(t.form):t.getBind(t.item).prepend),1)]),key:"0"}:void 0]),1040,["modelValue","disabled"])):t.item.type==="number"?(e.openBlock(),e.createBlock(e.unref(y.ElInputNumber),e.mergeProps({key:1,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[1]||(l[1]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="textarea"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:2,type:"textarea",modelValue:t.form[t.item.key],"onUpdate:modelValue":l[2]||(l[2]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(y.ElSwitch),e.mergeProps({key:3,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[3]||(l[3]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:4,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[4]||(l[4]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElOption),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(y.ElRadioGroup),e.mergeProps({key:5,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[5]||(l[5]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[t.getBind(t.item).type==="group"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElRadioButton),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElRadio),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="checkbox"?(e.openBlock(),e.createBlock(e.unref(y.ElCheckboxGroup),e.mergeProps({key:6,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[6]||(l[6]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[t.getBind(t.item).type==="group"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElCheckboxButton),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElCheckbox),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="color"?(e.openBlock(),e.createBlock(e.unref(y.ElColorPicker),e.mergeProps({key:7,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[7]||(l[7]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="slider"?(e.openBlock(),e.createBlock(e.unref(y.ElSlider),e.mergeProps({key:8,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[8]||(l[8]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="list"?(e.openBlock(),e.createBlock(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(y.ElTreeSelect),e.mergeProps({key:10,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[9]||(l[9]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):t.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(y.ElDatePicker),e.mergeProps({key:11,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[10]||(l[10]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&typeof t.item.type=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.item.type),e.mergeProps({key:12,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[11]||(l[11]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&(e.unref($).customComponent[t.item.type]||e.unref($).customComponent[t.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref($).customComponent[t.item.type]?.form||e.unref($).customComponent[t.item.type]),e.mergeProps({key:13,modelValue:t.form[t.item.key],"onUpdate:modelValue":l[12]||(l[12]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"form-"+t.item.key+"-right",{row:t.form,item:t.item})]),e.renderSlot(n.$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,Ce)):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+t.item.key+"-end",{row:t.form,item:t.item})])]),_:3},8,["label","prop","label-width"]))}});function Pt(t){return t}const Ve={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",deleteTitle:"删除提示",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"部分内容未输入或输入错误,请检查",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?",mergeColumn:"合并栏位",expandColumn:"展开栏位"};class k{static t(n,...l){if(typeof n=="function")return n(...l);n=String(n);let o=0;return n.replace(/{([^}]+)}/g,(r,a)=>o<l.length?String(l[o++]):`{${a}}`)}static setI18n=n=>{k.curd=ObjectUtil.deepMerge(k.curd,n)};static tCurd(n,...l){return this.t(this.curd[n],...l)}static curd=Ve}class T{static delAllKey=n=>{Object.keys(n).forEach(l=>{delete n[l]})};static setValue=(n,l,o=!1)=>{o&&T.delAllKey(n),Object.keys(l).forEach(r=>{n[r]!==l[r]&&(n[r]=l[r])})}}const I=t=>{const n=e.reactive({}),l=()=>typeof t=="function"?t():t,o=()=>{const r=l();return r??n};return{internal:n,isExternal:()=>l()!=null,get(){return o()},set(r){T.setValue(o(),r,!0)},merge(r){T.setValue(o(),r,!1)},clear(){T.delAllKey(o())}}},K=w.EDialog,H=t=>typeof t.type=="object"?"component":t.type||"input",xe=(t,n,l)=>{const o=I(()=>n.form);return{update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:K.Update,get form(){return o.get()},set form(r){o.set(r)},formDefault:{},formColumn:[],formGrid:[],formMaxSpan:12,getDisabled:(r,a=!1)=>{const d=t();return n.option.table?.editMode&&a?r.disabled?.table===void 0?!1:w.isFun(r.disabled?.table,d.update.form):Z(r,d.update.type,d.update.form)},getBind:r=>{const a=t();return v(r,a.update.type)},getOn:(r,a)=>{const d=t();return _(r,d.update.type,[a||d.update.form,r])},getOptions:r=>{const a=t();try{const c=ne(a.update.formGrid?.length?a.update.formGrid:a.update.formColumn).find(g=>g.item.key===r)?.item;return c?{options:c.options,bind:a.update.getBind(c)}:{options:{},bind:{}}}catch{return{options:{},bind:{}}}},edit:{data:{},getApiData:r=>{const a=t();if(n.option.form?.editAll)return r;const d={[n.option.table?.rowKey]:a.update.edit.data[n.option.table?.rowKey]};return Object.keys(a.update.edit.data).forEach(c=>{r[c]!==a.update.edit.data[c]&&(d[c]=r[c])}),d}},view:{},openLoading:!1,open:async(r,a)=>{const d=t();if(!(d.update.showContent||d.update.openLoading)){w.loading(!0),d.update.openLoading=!0;try{d.update.type=r;const c=r===K.Add;d.update.edit.data=c?void 0:JSONUtil.cp(a),d.update.title=k.tCurd(c?"add":r===K.View?"view":"edit");const g=c?ObjectUtil.deepMerge(JSONUtil.cp(d.update.formDefault),a?JSONUtil.cp(a):{}):JSONUtil.cp(a);T.setValue(d.update.form,g,!0),await d.initApiData("update"),await n.option.form?.openBefore?.(d.update.form,d.update),(!n.option.table?.inlineEdit||c)&&(d.update.show=!0,d.update.showContent=!0),n.option.form?.openAfter?.(d.update.form,d.update)}catch(c){console.error(c)}finally{w.loading(!1),d.update.openLoading=!1}}},validate:async(r=!0)=>{const a=t();try{const d=n.option.table?.editMode?a.tableEditValidate.validate():l.ruleFormRef.value?.validate(async c=>new Promise((g,s)=>{c||s(!1),g(void 0)}));return await Promise.all([d,a.formRef.validate()]),!0}catch{return r&&w.fail(k.tCurd("checkFormData")),!1}},submit:async()=>{const r=t();if(!await r.update.validate()||r.update.loading)return;r.update.loading=!0;const d=r.update.type===K.Add?n.option.api.create:n.option.api.update;try{await n.option.form?.submitBefore?.(r.update.form,r.update)}catch{r.update.loading=!1;return}let c=ObjectUtil.deepMerge(r.update.form,{});delete c.children;const g=new Set(n.option.column.filter(s=>s.type==="datetime").map(s=>s.key));Object.keys(c).forEach(s=>{if(g.has(s)&&c[s]!=null){const i=new Date(c[s]).getTime();isNaN(i)||(c[s]=i)}});try{if(!d)return;await d({...c}),r.update.close(),await r.table.getList(),n.option.form?.submitAfter?.(c,r.update)}catch(s){console.error(s)}finally{r.update.loading=!1}},close:()=>{const r=t();r.update.show=!1,r.update.edit.data=void 0,setTimeout(()=>{r.update.showContent=!1,l.ruleFormRef.value?.resetFields?.(),o.clear()},350)}}}},M=12,G=(t,n)=>{t.isForm=n,Array.isArray(t.children)&&t.children.forEach(l=>G(l,n))},Ee=t=>t.isForm===!1?!1:typeof t.show?.form=="boolean"?t.show.form:!0,Se=(t,n,l)=>(t.form=t.form||{span:n},l==="column"?t.form.span=t.form.span??12:t.form.span=t.form.span??n,t.form.span),Y=t=>{const n=t.form;return n?.row!=null&&n.row>0?n.row:M},A=t=>Math.floor((t.gridRow-1)/M),Z=(t,n,l)=>{if(n===w.EDialog.View)return t.disabled?.view===void 0?!0:w.isFun(t.disabled?.view,l);const o=t.disabled?.[n===w.EDialog.Add?"create":"update"];return w.isFun(o,l)},v=(t,n)=>{const l=H(t);return t.options?.[n===w.EDialog.Add?"formAdd":"formUpdate"]?.[l]||t.options?.[l]||{}},_=(t,n,l=[])=>{const o=H(t),a=t.options?.[n===w.EDialog.Add?"formAdd":"formUpdate"]?.[o]?.on||t.options?.[o]?.on||{},d={};return Object.keys(a).forEach(c=>{const g=a[c];typeof g=="function"?d[c]=function(...s){return g.apply(this,[...s,...l])}:d[c]=g}),d},ee=(t,n,l,o,r)=>{const a=t,d=a.colSpan??t.span;if(!t.item.form?.spanCol)return d;const c=r?.maxSpan||12,g=r?.defaultSpan||c/2,s=a.gridBand,u=n.filter(f=>s!=null?f.gridBand===s&&!w.isFun(f.item.show?.form,l,o):f.gridRow===a.gridRow&&!w.isFun(f.item.show?.form,l,o)).reduce((f,m)=>f+(m.colSpan??m.span??g),0);return d+u},Ne=(t,n)=>{const l=(o,r)=>{const a=o.gridRow,d=o.gridRow+o.rowSpan-1,c=r.gridRow,g=r.gridRow+r.rowSpan-1;return a<=g&&c<=d};return t.map(o=>t.filter(a=>l(o,a)).length!==1||o.colSpan>=n?o:{...o,span:n,colSpan:n,gridColumn:1})},te=(t,n,l={})=>{const o=new Set,r=[];let a=0,d=0;const c=m=>Math.floor(m/M)*M,g=(m,p)=>`${m},${p}`,s=(m,p,V,S)=>{if(p+V>n)return!1;for(let B=0;B<S;B++)for(let x=0;x<V;x++)if(o.has(g(m+B,p+x)))return!1;return!0},i=(m,p,V,S)=>{for(let B=0;B<S;B++)for(let x=0;x<V;x++)o.add(g(m+B,p+x))},u=(m,p,V,S)=>{for(let x=c(m);x<500*M;x+=M){const j=x+M,J=x===c(m)?Math.max(x,m):x;for(let U=J;U<j;U++){const Q=U===m?p:0;for(let h=Q;h<=n-V;h++)if(s(U,h,V,S))return{tr:U,tc:h}}}return{tr:m,tc:p}},f=(m,p,V,S)=>{const B=c(m);if(S<M&&m+S<B+M){a=m+S,d=p;return}const x=p+V;if(x<n){d=x,a=B;return}d=0,a=B+M};return t.forEach(m=>{const p=m.colSpan??(m.span===0?n:m.span),V=m.rowSpan??Y(m.item);m.item.form?.rowBreak&&r.length&&(d=0,a=c(a)+M);let{tr:S,tc:B}=s(a,d,p,V)?{tr:a,tc:d}:u(a,d,p,V);s(S,B,p,V)||({tr:S,tc:B}=u(0,0,p,V)),i(S,B,p,V);const x=S+1;r.push({...m,span:p,colSpan:p,rowSpan:V,gridRow:x,gridColumn:B+1,gridBand:A({gridRow:x})}),f(S,B,p,V)}),l.fillSingleRows?Ne(r,n):r},Fe=(t,n,l,o=M)=>{const r=t.filter(c=>w.isFun(c.item.show?.form,n,l)),a=new Map;t.forEach(c=>{const s=`${c.gridBand??A(c)}:${c.gridColumn}:${c.colSpan}`;a.has(s)||a.set(s,[]),a.get(s).push(c)});const d=new Map;return a.forEach(c=>{const g=c.reduce((f,m)=>f+m.rowSpan,0);if(!(c.length>1&&g===M&&c.every(f=>f.rowSpan<M)))return;const i=c.filter(f=>w.isFun(f.item.show?.form,n,l));if(i.length!==1)return;const u=i[0];d.set(u.item.key,{...u,rowSpan:M})}),te(r.map(c=>d.get(c.item.key)||c),o,{fillSingleRows:!0})},oe=t=>{const n=new Map;return t.forEach(l=>{const o=l.gridBand??A(l);n.has(o)||n.set(o,[]),n.get(o).push(l)}),Array.from(n.keys()).sort((l,o)=>l-o).map(l=>n.get(l))},ne=t=>t?.length?Array.isArray(t[0])?t.flat():t:[],De=(t,n)=>{if(!Ee(t)||!t.key)return null;const l=n.defaultSpan??(n.maxSpan||12)/2,o=Se(t,l,n.layout);return{item:t,span:o}},ze=(t,n={})=>{const l=[],o=r=>{if(r.children?.length){r.children.forEach(d=>o(d));return}const a=De(r,n);a&&l.push(a)};return t.forEach(r=>o(r)),l},ae=(t,n={})=>{const l=n.maxSpan??12,o=n.defaultSpan??l/2,r=n.layout??"row",d=ze(t,{maxSpan:l,defaultSpan:o,layout:r});if(r==="column"){const c=[];let g=1;return d.forEach(s=>{const i=Y(s.item),u=l;c.push({...s,span:u,colSpan:u,rowSpan:i,gridRow:g,gridColumn:1,gridBand:A({gridRow:g})}),g+=i}),{cells:c,maxSpan:l}}return{cells:te(d,l),maxSpan:l}},$e=t=>t.map(n=>n.item?.show?.form),Me=(t,n,l)=>{if(!t.rules)return;const o=typeof t.rules=="boolean"?[{required:!0,message:n(t),trigger:"blur"}]:t.rules;return l?o.map(r=>l(r)):o},le=t=>(n,l)=>Me(n,t,o=>{if(o.validator){const r=o.validator;return{...o,validator:(a,d,c)=>r(a,d,c,l)}}return o}),re=(t,n)=>{const l={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},o=(l[H(t)||"input"]||l.input)+t.label;return(n||$.error.callback)?.(t.key,t)||o},ie=t=>le(n=>re(n,t?.error)),Oe=(t,n,l)=>{const o={},r={},a=n?.maxSpan||12,d=n?.defaultSpan||a/2,c=ie(n);t.forEach(i=>G(i,!0)),P(t,o,r,i=>c(i,l));const{cells:g,maxSpan:s}=ae(t,{maxSpan:a,defaultSpan:d,layout:n?.layout});return{formDefault:o,rules:r,formGrid:g,formMaxSpan:s,formColumn:oe(g)}},P=(t,n,l,o)=>{const r=a=>{if(a.children?.length){a.children.forEach(d=>r(d));return}if(a.key){n[a.key]=a.value;const d=o(a);d&&(l[a.key]=d)}};t.forEach(r)},Re={class:"curd-form-cell-inner"},de=e.defineComponent({__name:"layout",props:{formGrid:{},maxSpan:{},form:{},type:{},stripe:{type:Boolean},labelWidth:{},formOption:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(t){const n=w.isFun,l=t,o=e.computed(()=>Fe(l.formGrid,l.form,l.type,l.maxSpan)),r=e.computed(()=>{const f=Array.from(new Set(o.value.map(m=>m.gridBand??A(m)))).sort((m,p)=>m-p);return new Map(f.map((m,p)=>[m,p]))}),a=e.computed(()=>({gridTemplateColumns:`repeat(${l.maxSpan}, minmax(0, 1fr))`})),d=e.computed(()=>{let f=0;return o.value.forEach(m=>{const p=m.gridRow+m.rowSpan-1;p>f&&(f=p)}),f}),c=f=>f.gridRow+f.rowSpan-1>=d.value,g=f=>f.rowSpan>=M,s=f=>{const m=f.gridBand??A(f);return r.value.get(m)??m},i=f=>ee(f,o.value,l.form,l.type,{maxSpan:l.maxSpan,defaultSpan:l.formOption?.defaultSpan}),u=f=>{const m=i(f)||f.colSpan;return{gridRow:`${f.gridRow} / span ${f.rowSpan}`,gridColumn:`${f.gridColumn} / span ${m}`}};return(f,m)=>e.unref(n)(e.unref($e)(t.formGrid),t.form,t.type)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(f.$slots,"form-start",{row:t.form}),e.createElementVNode("div",{class:e.normalizeClass(["curd-form-grid",{stripe:t.stripe!==!1}]),style:e.normalizeStyle(a.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,p=>(e.openBlock(),e.createElementBlock("div",{key:p.item.key,class:e.normalizeClass(["curd-form-grid-cell",[t.stripe!==!1&&s(p)%2===0?"stripe-band-odd":"",p.gridColumn>1?"has-col-border":"",t.stripe!==!1&&c(p)?"is-last-row":"",g(p)?"is-row-span":"",`form-item-col-${p.item.key}`]]),style:e.normalizeStyle(u(p))},[e.createElementVNode("div",Re,[e.unref(n)(p.item.show?.form,t.form,t.type)?(e.openBlock(),e.createBlock(Be,{key:0,class:e.normalizeClass({"is-row-span-field":g(p)}),item:p.item,form:t.form,type:t.type,"label-width":t.labelWidth,"get-bind":t.getBind,"get-on":t.getOn,"get-disabled":t.getDisabled},e.createSlots({_:2},[e.renderList(f.$slots,(V,S)=>({name:S,fn:e.withCtx(B=>[e.renderSlot(f.$slots,S,e.mergeProps({ref_for:!0},B||{}))])}))]),1032,["class","item","form","type","label-width","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)])],6))),128))],6),e.renderSlot(f.$slots,"form-end",{row:t.form})],64)):e.createCommentVNode("",!0)}}),ce=e.defineComponent({__name:"column",props:{option:{default:()=>({form:{},column:[]})},type:{default:""},form:{default:void 0}},setup(t,{expose:n}){const l=w.EDialog,o=e.ref(),r=t;let a=I(r.form);const d=W.Scope.getConf("curdConf"),c="formRef-"+StrUtil.getId();d?.formRef?.set(c,o),e.onUnmounted(()=>{d?.formRef?.remove(c)});const g=e.reactive({rules:{},show:!0,formDefault:{},type:r.type||d?.update?.type||l.Add,formColumn:[],formGrid:[],formMaxSpan:12,get form(){return a.get()},set form(s){a.set(s)},getDisabled:s=>Z(s,g.type,g.form),getBind:s=>v(s,g.type),getOn:s=>_(s,g.type,[g.form,s]),initColumnForm:()=>{const s=a,i=Oe(r.option.column,r.option.form,s.get());g.formDefault=i.formDefault,g.rules=i.rules,g.formGrid=i.formGrid,g.formMaxSpan=i.formMaxSpan,g.formColumn=i.formColumn,g.type===l.Add?s.isExternal()?s.merge(JSONUtil.cp(g.formDefault)):s.set(JSONUtil.cp(g.formDefault)):!s.isExternal()&&r.form&&s.set(JSONUtil.cp(r.form))}});return r.option.form?.initStart?.(g),g.initColumnForm(),r.option.form?.initEnd?.(g),e.watch(()=>r.form,s=>{a=I(s),g.initColumnForm()}),n({ref:o,conf:g}),(s,i)=>(e.openBlock(),e.createBlock(e.unref(y.ElForm),{ref_key:"ruleFormRef",ref:o,model:g.form,rules:g.rules},{default:e.withCtx(()=>[g.show?(e.openBlock(),e.createBlock(de,{key:0,"form-grid":g.formGrid,"max-span":g.formMaxSpan,form:g.form,type:g.type,stripe:t.option.form?.stripe,"label-width":t.option.form?.labelWidth||"100px","form-option":t.option.form,"get-bind":g.getBind,"get-on":g.getOn,"get-disabled":g.getDisabled},e.createSlots({_:2},[e.renderList(s.$slots,(u,f)=>({name:f,fn:e.withCtx(m=>[e.renderSlot(s.$slots,f,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"]))}}),Te=t=>t?.value||t,Ue=t=>{const n=Te(t);return n?.validate?new Promise((l,o)=>{let r=!1;const a=d=>{r||(r=!0,d===!1?o(!1):l(!0))};try{const d=n.validate(a);d&&typeof d.then=="function"?d.then(c=>a(c)).catch(o):n.validate.length===0&&a(d)}catch(d){o(d)}}):Promise.resolve(!0)},Ae=()=>{const t=e.reactive({formRef:{map:{},set(n,l){t.formRef.map[n]=l},remove(n){delete t.formRef.map[n]},validate(){const n=Object.keys(t.formRef.map).map(l=>t.formRef.map[l]);return Promise.all(n.map(l=>Ue(l))).then(()=>!0)}},regFormRef(n,l,o){n?o?t.formRef.set(l,{validate:async r=>{try{r(await o())}catch{r(!1)}}}):t.formRef.set(l,n):t.formRef.remove(l)}});return t},Le=(t,n)=>{const l=I(()=>n.searchForm);return{search:{column:{list:[]},get form(){return l.get()},set form(o){l.set(o)},formDefault:{},getPlaceholder:(o,r=k.tCurd("placeholderInput"))=>o.text?.search?.placeholder===void 0?`${r}${o.label}`:o.text?.search?.placeholder,getFormData:()=>{const o=t();let r={};n.option.column.forEach(d=>{(typeof d.show?.search=="function"?d.show?.search(o.search.form):d.show?.search)&&(r[d.key]=o.search.form[d.key])});const a=n.option.search?.before?.(r);return a&&(r=a),r},reset:()=>{const o=t(),r=o.search.formDefault;Object.keys(r).forEach(d=>{n.option.search?.resetMode==="none"?r[d]=void 0:r[d]=o.search.formDefault[d]});const a=ObjectUtil.deepMerge(r,{});T.setValue(o.search.form,a,!0),o.page.num=1,n.option.init!==!1&&o.table.getList()},submit:()=>{const o=t();o.page.num=1,o.table.getList()}}}},He=(t,n)=>({page:{num:1,total:0,layout:n.option.page?.layout||E.config.pagination.layout,showTools:n.option.page?.showTools||E.config.pagination.showTools,size:n.option.page?.size||E.config.pagination.size,sizeList:n.option.page?.sizeList||E.config.pagination.pageSizes,pagerCount:n.option.page?.pagerCount||E.config.pagination.pagerCount,getQuery:(l={})=>{const o=t();return{[E.config.field.page.size]:l.size||o.page.size,[E.config.field.page.num]:l.num||o.page.num,...o.search.getFormData()}}}}),je=(t,n,l)=>({table:{op:{width:(...o)=>o.filter(a=>a).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(o,r)=>{},all:()=>{const o=t();if(o.table.expand.isExpand)o.table.expand.rowKeys=[];else{const r=a=>{let d=[];return a.forEach(c=>{d.push(c[n.option.table.rowKey]),c.children?.length&&(d=d.concat(r(c.children)))}),d};o.table.expand.rowKeys=r(o.table.data)}o.table.expand.isExpand=!o.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},header:{group:{expand:!1,toggleExpandAll:()=>{const o=t(),r=!o.table.header.group.expand;o.table.header.group.expand=r;const a=d=>{d.forEach(c=>{c.table?.header?.group!==void 0&&(c.table.header.group=!r),c.table?.header?.groupKey!==void 0&&(c.table.header.show=r),Array.isArray(c.children)&&c.children.length&&a(c.children)})};a(o.table.column.list)}}},getList:async()=>{const o=t();o.table.loading=!0;const r=n.option.api.list,a=JSONUtil.cp(o.table.selection.list);try{await o.initApiData("init");let d={};if(o.table.sort.prop){const{props:p,order:V}=E.config.table.sort;d={[p.field]:o.table.sort.prop,[V.field]:o.table.sort.order}}const c=await r({...o.page.getQuery(),...d}),g=E.config.field.result,s=c.data||{[g.list]:c},i=(Array.isArray(s[g.list]),s[g.list]),u=ne(o.update.formGrid?.length?o.update.formGrid:o.update.formColumn),m=ObjectUtil.deepMerge({data:i},{}).data.map(p=>(Object.keys(p).forEach(S=>{const B=u.find(x=>x.item.key===S);B&&["select","radio"].includes(B.item.type)&&(B.item.table.format||(B.item.table.format=x=>B.item.options[B.item.type].data?.find(j=>j.value==x[S])?.label||x[S]))}),p));o.table.data=n.option.data?await n.option.data(m,i):m,o.tableEditValidate?.clear?.(),o.page.total=s[g.total]||0,setTimeout(()=>{o.table.selection.setList(a)},20)}catch(d){console.error(d)}finally{o.table.loading=!1}},selection:{list:[],change:o=>{t().table.selection.list=o},setList:(o,r)=>{const a=t();a.table.selection.list=[];const d=l.tableRef.value;if(d?.clearSelection(),!d||!o?.length)return;const c=n.option.table?.rowKey,g=s=>{const i=u=>{for(const f of u){if(c!=null&&c!==""){if(f[c]===s[c])return f}else if(f===s)return f;if(Array.isArray(f.children)&&f.children.length){const m=i(f.children);if(m!==void 0)return m}}};return i(a.table.data)};o.forEach(s=>{const i=g(s);if(i)if(r){const u=()=>d.toggleRowSelection(i,!0,!1);r(s)!==!1&&u()}else d.toggleRowSelection(i,!0,!1)})}},sort:{prop:"",order:"",change:o=>{const r=t();E.config.table.sort.resetPage&&(r.page.num=1);const a=E.config.table.sort;if(a.change){a.change(o,r);return}r.table.sort.prop=o.prop,o.order===null?(r.table.sort.order="",r.table.sort.prop=""):r.table.sort.order=o.order==="ascending"?a.order.asc:a.order.desc,r.table.getList()}}}}),Ie=(t,n)=>{const l=e.reactive({}),o=new WeakMap;let r=0;const a=h=>{let b=o.get(h);return b||(r+=1,b=`fallback-${r}`,o.set(h,b)),b},d=h=>{const b=n.option.table?.rowKey,C=b?h[b]:void 0;return C!=null&&C!==""?String(C):a(h)},c=(h,b)=>`${d(h)}-${b.key}`,g=h=>re(h,n.option.form?.error),s=le(g),i=()=>{Object.keys(l).forEach(h=>{delete l[h]})},u=(h,b)=>{delete l[c(h,b)]},f=(h,b)=>l[c(h,b)]||"",m=(h,b)=>h.message||g(b),p=h=>h==null||h===""||Array.isArray(h)&&h.length===0,V=h=>{if(typeof h=="number")return h;if(typeof h=="string"||Array.isArray(h))return h.length},S=(h,b)=>{if(h==="array")return Array.isArray(b);if(h==="integer")return typeof b=="number"&&Number.isInteger(b);if(h==="float")return typeof b=="number"&&!Number.isInteger(b);if(h==="number")return typeof b=="number"&&!Number.isNaN(b);if(h==="boolean")return typeof b=="boolean";if(h==="object")return b!==null&&typeof b=="object"&&!Array.isArray(b);if(h==="date")return b instanceof Date||!Number.isNaN(new Date(b).getTime());if(h==="email")return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(b));if(h==="url")try{return new URL(String(b)),!0}catch{return!1}return h==="string"?typeof b=="string":!0},B=(h,b,C)=>typeof h.validator!="function"?Promise.resolve(!0):new Promise(D=>{let F=!1;const z=O=>{if(!F){if(F=!0,!O){D(!0);return}if(O instanceof Error){D(O.message||m(h,C));return}if(Array.isArray(O)){const X=O[0];D(X instanceof Error?X.message:String(X||m(h,C)));return}D(String(O))}};try{const O=h.validator(h,b,z);O&&typeof O.then=="function"?O.then(()=>z()).catch(z):O===!1?z(m(h,C)):typeof O=="string"||O instanceof Error?z(O):h.validator.length<3&&z()}catch(O){z(O)}}),x=async(h,b,C)=>{const D=typeof h.transform=="function"?h.transform(b):b,F=p(D);if(h.required&&F)return m(h,C);if(F&&!h.required)return!0;if(h.whitespace&&typeof D=="string"&&D.trim()===""||h.type&&!S(h.type,D)||Array.isArray(h.enum)&&!h.enum.includes(D)||h.pattern&&!new RegExp(h.pattern).test(String(D)))return m(h,C);const z=V(D);return h.len!==void 0&&z!==void 0&&z!==h.len||h.min!==void 0&&z!==void 0&&z<h.min||h.max!==void 0&&z!==void 0&&z>h.max?m(h,C):B(h,D,C)},j=h=>{const b=t();return!h.key||!b.table.column.show.list.includes(h.key)||h.table?.header?.groupKey!==void 0&&!h.table.header.show?!1:h.show?.table!==void 0?w.isFun(h.show?.table,b.table.data):!0},J=()=>{const h=t(),b=[],C=D=>{D.forEach(F=>{if(j(F)){if(F.children?.length){C(F.children);return}b.push(F)}})};return C(h.table.column.list),b},U=async(h,b)=>{const C=s(b,h);if(!C)return!0;u(h,b);const D=Array.isArray(C)?C:[C];for(const F of D){const z=await x(F,h[b.key],b);if(z!==!0)return l[c(h,b)]=z,!1}return!0},Q=h=>{const b=[],C=D=>{D.forEach(F=>{b.push(F),Array.isArray(F.children)&&F.children.length&&C(F.children)})};return C(h),b};return{tableEditValidate:{errors:l,clear:i,clearField:u,getFieldError:f,validate:async()=>{if(i(),!n.option.table?.editMode)return!0;const h=t(),b=J(),C=Q(h.table.data||[]);if((await Promise.all(C.flatMap(F=>b.map(z=>U(F,z))))).some(F=>!F))throw!1;return!0}}}};class se{static exportToExcel=async(n,l,o)=>{if(!n||n.length===0)return;const r=await w.loadModule("xlsx"),a=n.map(g=>{const s={};return l.forEach(i=>{s[i.label]=g[i.key]}),s}),d=r.utils.json_to_sheet(a),c=r.utils.book_new();r.utils.book_append_sheet(c,d,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,r.writeFile(c,`${o}.xlsx`)}}const Ke=(t,n)=>({export:{run:{start:async l=>{let r=await t().export.run[l]();const a=n.option.column,d=ObjectUtil.deepMerge({data:r,columns:a},{}),c=n.option.tools?.export||{};c.before?.(d),se.exportToExcel(d.data,d.columns,c.fileName)},select:async()=>{const l=t();l.export.loading=!0;try{if(n.option.tools?.export?.select){await n.option.tools.export.select({...l.page.getQuery(),items:l.table.selection.list});return}if(l.table.selection.list.length===0)throw w.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return l.table.selection.list}catch(o){console.error(o)}finally{l.export.loading=!1}},page:async()=>{const l=t();l.export.loading=!0;try{if(n.option.tools?.export?.page){await n.option.tools.export.page({...l.page.getQuery()});return}if(l.table.data.length===0)throw w.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return l.table.data}catch(o){console.error(o)}finally{l.export.loading=!1}},all:async()=>{const l=t();l.export.loading=!0;try{if(n.option.tools?.export?.all){await n.option.tools.export.all({...l.page.getQuery()});return}const o=n.option.api.list,r=await o({...l.page.getQuery({size:999999,num:1})});return(r.data||{[E.config.field.result.list]:r})[E.config.field.result.list]}catch(o){console.error(o)}finally{l.export.loading=!1}}},loading:!1,click:l=>{const o=t();o.export.loading||o.export.run.start(l)}}}),Ge=(t,n)=>({remove:{title:k.tCurd("deleteTitle"),show:!1,items:[],loading:!1,close:()=>{t().remove.show=!1},open:l=>{if(l.length===0){w.fail(k.tCurd("selectDataToDelete"));return}const o=t();o.remove.items=l,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{const l=t();l.remove.loading=!0;const o=n.option.api.delete;try{if(!o)return;await o({[n.option.table?.rowKey]:l.remove.items.map(r=>r[n.option.table?.rowKey]),items:l.remove.items}),w.success(k.tCurd("operationSuccess")),l.table.data.length<=1&&l.page.num>1&&(l.page.num-=1),l.remove.close(),await l.table.getList()}catch(r){console.error(r)}finally{l.remove.loading=!1}})}}}),We=(t,n,l)=>({apiDataMap:{},getColumnSpan:(o,r)=>{const a=t(),d=a.update.formGrid?.length?a.update.formGrid:r||[];return ee(o,d,a.update.form,a.update.type,{maxSpan:a.update.formMaxSpan||n.option.form?.maxSpan,defaultSpan:n.option.form?.defaultSpan||E.config.form.defaultSpan})},init:()=>{const o=t();o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},initApiData:async o=>{const r=t(),a=[],d=c=>{if(c.children?.length){c.children.forEach(s=>d(s));return}const g=H(c);if(c.options?.[g]?.dataApi&&c.options?.[g]?.dataApiConfig?.[o]){if(r.apiDataMap[c.key]&&c.options?.[g]?.dataApiConfig?.once)return;const s=(async()=>{try{let i=await c.options?.[g]?.dataApi?.(r.update.form,r.update.type);if(i){const u=c.options?.[g]?.dataPath;!Array.isArray(i)&&u&&(i=ObjectUtil.getPathValue(i,u)),c.options[g].data=i,c.options.search[g].data=i,c.options.search[c.options.search.type??g]||(c.options.search[c.options.search.type??g]={}),c.options.search[c.options.search.type??g].data=i,c.options.formAdd[g].data=i,c.options.formUpdate[g].data=i,r.apiDataMap[c.key]=i}}catch{}})();a.push(s)}};return n.option.column.forEach(c=>d(c)),await Promise.all(a),!0},initCurdConfig:()=>{const o=ObjectUtil.deepMerge(E.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 r=ObjectUtil.deepMerge(o,n.option||{});Object.keys(r).forEach(a=>{n.option[a]=r[a]})},initColumnOptions:()=>{const o=t();let r=JSONUtil.cp(E.config.columnConfig);r.options=ObjectUtil.deepMerge({switch:{activeText:k.tCurd("switchOn"),inactiveText:k.tCurd("switchOff")}},r.options);const a=d=>{const c=H(d);for(const s in r){if(s==="table"){if(d.table=ObjectUtil.deepMerge(r.table,d.table||{}),d.children){d.children.forEach(i=>a(i));return}}else s==="type"?d.type=d.type||r.type:d[s]=ObjectUtil.deepMerge(r[s],d[s]||{});d.options=d.options||{},d.options[c]=d.options[c]||{},d.options[c].size=n.option.size.form}["search","formAdd","formUpdate"].forEach(s=>{d.options[s]=ObjectUtil.deepMerge(d.options,d.options[s]||{}),s==="search"?n.option.size.search&&(d.options[s][c].size=n.option.size.search):n.option.size.form&&(d.options[s][c].size=n.option.size.form)}),d.table=ObjectUtil.deepMerge(d.table,d.options[c].table||{}),c==="switch"&&(d.options.switch.tableBeforeChange=async(s,i)=>{const u=d.options?.switch;try{u.tableConfig?.confirm&&await l.switchConfirmRef.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")});try{if(!n.option.api.update&&!u.tableConfig?.api)return;const f=i[n.option.table?.rowKey];u.loadingMap||(u.loadingMap={}),u.loadingMap[f]||(u.loadingMap[f]={loading:!1}),u.loadingMap[f].loading=!0;const m=i[s]===u.activeValue?u.inactiveValue:u.activeValue,p=u.tableConfig?.api?u.tableConfig.api:n.option.api.update;if(!p)return;try{await p({...i,[s]:m},"switch")}catch{return!1}finally{u.loadingMap[f].loading=!1}return w.success(k.tCurd("operationSuccess")),u.tableConfig?.loadList&&(o.table.loading=!0,o.table.getList(),o.table.loading=!1),!0}catch(f){return console.error(f),!1}finally{o.table.loading=!1}}catch{return!1}}),c==="treeSelect"&&(d.options.treeSelect.rowKey=n.option.table?.rowKey,d.options.treeSelect.nodeKey=n.option.table?.rowKey)};n.option.column.forEach(a),n.option.table?.column?.forEach(a)},initColumnForm:()=>{const o=t(),r=n.option;o.update.formColumn=[],o.update.formGrid=[],o.update.formMaxSpan=12,o.table.column.show={list:[],listSource:[]};const a=n.option.form?.maxSpan||12,d=n.option.form?.defaultSpan||a/2,c=ie(n.option.form),g=f=>{if(f.children){o.table.column.show.list.push(f.key),f.children.forEach(m=>g(m));return}o.update.formDefault[f.key]=f.value,f.table?.table&&(f.show?.table&&o.table.column.show.list.push(f.key),o.table.column.show.listSource.push(f.key))};r.column.forEach(f=>{G(f,!0),g(f)}),n.option.table?.column?.forEach(f=>{G(f,!1),g(f)}),o.search.column.list=r.column.concat(r.table?.column||[]),o.table.column.list=o.search.column.list.filter(f=>f.table?.table),o.search.column.list.sort((f,m)=>f.sort?.search-m.sort?.search),o.table.column.list.sort((f,m)=>f.sort?.table-m.sort?.table),o.update.rules={},P(r.column,o.update.formDefault,o.update.rules,f=>c(f,o.update.form)),r.table?.editMode&&P(r.table?.column||[],o.update.formDefault,o.update.rules,f=>c(f,o.update.form));const s=ae(r.column,{maxSpan:a,defaultSpan:d,layout:n.option.form?.layout});o.update.formGrid=s.cells,o.update.formMaxSpan=s.maxSpan,o.update.formColumn=oe(s.cells);const i=n.option.search?.formDefault;i&&Object.keys(i).forEach(f=>{o.search.formDefault[f]=i[f]}),r.column.forEach(f=>{f.show?.search||(o.search.formDefault[f.key]=void 0)});const u=ObjectUtil.deepMerge(o.search.formDefault,{});T.setValue(o.search.form,u,!0)}}),qe=t=>{const n=e.ref(),l=e.ref(),o=e.ref(),r={switchConfirmRef:n,ruleFormRef:l,tableRef:o},a=e.getCurrentInstance(),d=W.Scope.getConf("curdConf");let c;const g=u=>{u=u||c;let f=u,m=u;for(;f?.parentCurdConf;)m=f.parentCurdConf,f=f.parentCurdConf;return m},s=()=>c;c=e.reactive({parentCurdConf:d,getCurdConf:g,getRootCurdConf:g,...Ae(),option:t.option,...Le(s,t),...He(s,t),...je(s,t,r),...Ie(s,t),...Ke(s,t),...xe(s,t,r),...Ge(s,t),...We(s,t,r)}),c.init();const i=a?`curdRef-${a.uid}`:"";return d?.formRef&&i&&(d.formRef.set(i,{validate:async u=>{const f=await c.update.validate(!1);if(u?.(!!f),!f)throw!1;return!0}}),e.onUnmounted(()=>{d.formRef.remove(i)})),e.onMounted(()=>{t.option.init!==!1&&c.table.getList()}),W.Scope.setConf("curdConf",c),{conf:c,switchConfirmRef:n,ruleFormRef:l,tableRef:o}},Pe={class:"dialog-footer"},Je=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(t,{expose:n}){const l=e.ref(!1),o=e.ref("确认修改"),r=e.ref("确认要修改状态吗?");let a=null,d=null;const c=i=>(i?.title&&(o.value=i.title),i?.content&&(r.value=i.content),l.value=!0,new Promise((u,f)=>{a=u,d=f})),g=()=>{l.value=!1,a?.(!0),a=null,d=null},s=()=>{l.value=!1,d?.(new Error("用户取消操作")),a=null,d=null};return n({open:c}),(i,u)=>{const f=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(y.ElDialog),{modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=m=>l.value=m),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(f,{size:t.size},{default:e.withCtx(()=>[e.createElementVNode("span",Pe,[e.createVNode(e.unref(y.ElButton),{onClick:s},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(y.ElButton),{type:"primary",onClick:g},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(r.value),1)]),_:1},8,["modelValue","title"])}}}),Qe=["innerHTML"],Xe=e.defineComponent({__name:"text",props:{content:{},value:{}},setup(t){const n=t,l=e.computed(()=>typeof n.content=="function"?n.content(n.value):n.content);return(o,r)=>typeof l.value=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value),{key:0})):(e.openBlock(),e.createElementBlock("div",{key:1,innerHTML:l.value},null,8,Qe))}}),fe=e.defineComponent({__name:"searchField",props:{item:{},conf:{},type:{}},setup(t){const n=t,l=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,r)=>e.unref($).customComponent[t.type??""]?.search?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref($).customComponent[t.type??""]?.search),e.mergeProps({key:0,modelValue:l.value,"onUpdate:modelValue":r[0]||(r[0]=a=>l.value=a)},t.item.options?.search?.[t.type??""],e.toHandlers(t.item.options?.search?.[t.type??""]?.on||{})),null,16,["modelValue"])):t.type==="input"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:1,modelValue:l.value,"onUpdate:modelValue":r[1]||(r[1]=a=>l.value=a),placeholder:t.conf.search.getPlaceholder(t.item),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.input||t.item.options?.input,e.toHandlers(t.item.options?.search?.input?.on||t.item.options?.input?.on||{})),null,16,["modelValue","placeholder","disabled"])):t.type==="switch"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:2,modelValue:l.value,"onUpdate:modelValue":r[2]||(r[2]=a=>l.value=a),placeholder:t.conf.search.getPlaceholder(t.item,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.switch||t.item.options?.switch,e.toHandlers(t.item.options?.search?.switch?.on||t.item.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:t.item.options?.switch?.activeValue,label:t.item.options?.switch?.activeText,value:t.item.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:t.item.options?.switch?.inactiveValue,label:t.item.options?.switch?.inactiveText,value:t.item.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:1},16,["modelValue","placeholder","disabled"])):t.type==="select"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:3,modelValue:l.value,"onUpdate:modelValue":r[3]||(r[3]=a=>l.value=a),placeholder:t.conf.search.getPlaceholder(t.item,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.select||t.item.options?.select,e.toHandlers(t.item.options?.search?.select?.on||t.item.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.options?.search?.select?.data||t.item.options?.select?.data||[],a=>(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","placeholder","disabled"])):t.type==="radio"?(e.openBlock(),e.createBlock(e.unref(y.ElRadioGroup),e.mergeProps({key:4,modelValue:l.value,"onUpdate:modelValue":r[4]||(r[4]=a=>l.value=a),disabled:t.item.disabled?.search},t.item.options?.search?.radio||t.item.options?.radio,e.toHandlers(t.item.options?.search?.radio?.on||t.item.options?.radio?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.options?.radio?.data,a=>(e.openBlock(),e.createBlock(e.unref(y.ElRadio),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):t.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(y.ElDatePicker),e.mergeProps({key:5,modelValue:l.value,"onUpdate:modelValue":r[5]||(r[5]=a=>l.value=a),disabled:t.item.disabled?.search},t.item.options?.search?.datetime||t.item.options?.datetime,e.toHandlers(t.item.options?.search?.datetime?.on||t.item.options?.datetime?.on||{})),null,16,["modelValue","disabled"])):t.type&&e.unref($).customComponent[t.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref($).customComponent[t.type]),e.mergeProps({key:6,modelValue:l.value,"onUpdate:modelValue":r[6]||(r[6]=a=>l.value=a)},t.item.options?.search?.[t.type]||t.item.options?.[t.type],e.toHandlers(t.item.options?.search?.[t.type]?.on||t.item.options?.[t.type]?.on||{}),{disabled:t.item.disabled?.search}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}),L=(t,n)=>{const l=t.__vccOpts||t;for(const[o,r]of n)l[o]=r;return l},Ye={},Ze={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function ve(t,n){return e.openBlock(),e.createElementBlock("svg",Ze,[...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 _e=L(Ye,[["render",ve]]),et={},tt={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function ot(t,n){return e.openBlock(),e.createElementBlock("svg",tt,[...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 nt=L(et,[["render",ot]]),at={},lt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function rt(t,n){return e.openBlock(),e.createElementBlock("svg",lt,[...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 it=L(at,[["render",rt]]),dt={},ct={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function st(t,n){return e.openBlock(),e.createElementBlock("svg",ct,[...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 ft=L(dt,[["render",st]]),mt={},gt={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function ut(t,n){return e.openBlock(),e.createElementBlock("svg",gt,[...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 ht=L(mt,[["render",ut]]),yt={},pt={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function bt(t,n){return e.openBlock(),e.createElementBlock("svg",pt,[...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 kt=L(yt,[["render",bt]]),wt={class:"row flex-center table-header-label inline"},Ct={class:"table-header-tooltip"},Bt=["innerHTML"],Vt={key:1,class:"table-header-required"},xt=["onClick"],Et={key:0,class:"table-edit-form"},St={key:1},Nt=["onClick","innerHTML"],Ft=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(t){const n=w.isFun,l=t,r=e.getCurrentInstance().type,a=c=>c===!0?!0:(Array.isArray(c)?c:c?[c]:[]).some(s=>s?.required===!0),d=c=>l.option.table?.editMode?a(c.rules)||a(l.conf.update.rules?.[c.key]):!1;return(c,g)=>{const s=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnList,i=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i.key},[t.conf.table.column.show.list.includes(i.key)&&(i.show?.table===void 0||e.unref(n)(i.show?.table,t.conf.table.data))?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.table?.header?.groupKey===void 0||i.table.header.show?(e.openBlock(),e.createBlock(e.unref(y.ElTableColumn),e.mergeProps({key:0,prop:i.key,label:i.label},{ref_for:!0},i.table),{header:e.withCtx(()=>[e.renderSlot(c.$slots,"table-header-"+i.key,{item:i},()=>[e.createElementVNode("div",wt,[i.table?.header?.tooltip?(e.openBlock(),e.createBlock(s,{key:0,effect:"dark",placement:"top"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:i.table?.header?.tooltip},null,8,Bt)]),default:e.withCtx(()=>[e.createElementVNode("span",Ct,[e.createVNode(ft)])]),_:2},1024)):e.createCommentVNode("",!0),d(i)?(e.openBlock(),e.createElementBlock("span",Vt,"*")):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(i.label)+" ",1),i.table?.header?.group!==void 0?(e.openBlock(),e.createElementBlock("span",{key:2,class:"table-header-plus",onClick:e.withModifiers(()=>{i.table.header.group=!i.table.header.group,t.columnList.forEach(u=>{u.table?.header?.groupKey===i.key&&(u.table.header.show=!i.table.header.group)})},["stop"])},[i.table.header.group?(e.openBlock(),e.createBlock(ht,{key:0})):(e.openBlock(),e.createBlock(kt,{key:1}))],8,xt)):e.createCommentVNode("",!0)])])]),default:e.withCtx(({row:u})=>[i.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[g[0]||(g[0]=e.createTextVNode(" ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(r)),{conf:t.conf,columnList:i.children,option:t.option},e.createSlots({_:2},[e.renderList(c.$slots,(f,m)=>({name:m,fn:e.withCtx(p=>[e.renderSlot(c.$slots,m,e.mergeProps({ref_for:!0},p||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.option.table?.editMode?(e.openBlock(),e.createElementBlock("div",Et,[e.createVNode(e.unref(y.ElFormItem),{size:t.option.size?.table,error:t.conf.tableEditValidate.getFieldError(u,i),class:"table-edit-form-item"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["row",["table-edit-"+i.key]]),style:{width:"100%"}},[e.renderSlot(c.$slots,"table-edit-left-"+i.key,{row:u,item:i}),i.type==="input"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:0,modelValue:u[i.key],"onUpdate:modelValue":f=>u[i.key]=f,disabled:t.conf.update.getDisabled(i,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(i),e.toHandlers(t.conf.update.getOn(i,u)),{"onUpdate:modelValue":f=>t.conf.tableEditValidate.clearField(u,i)}),e.createSlots({_:2},[i.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof i.options?.input?.prepend=="function"?i.options?.input?.prepend(u):i.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):i.type==="select"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:1,modelValue:u[i.key],"onUpdate:modelValue":f=>u[i.key]=f,disabled:t.conf.update.getDisabled(i,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(i),e.toHandlers(t.conf.update.getOn(i,u)),{"onUpdate:modelValue":f=>t.conf.tableEditValidate.clearField(u,i)}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.options?.search?.select?.data||i.options?.select?.data,f=>(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):i.type==="switch"?(e.openBlock(),e.createBlock(e.unref(y.ElSwitch),e.mergeProps({key:2,modelValue:u[i.key],"onUpdate:modelValue":f=>u[i.key]=f,disabled:t.conf.update.getDisabled(i,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(i),e.toHandlers(t.conf.update.getOn(i,u)),{"onUpdate:modelValue":f=>t.conf.tableEditValidate.clearField(u,i)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"table-edit-right-"+i.key,{row:u,item:i})],2)]),_:2},1032,["size","error"])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.conf.update.type===e.unref(w).EDialog.Update&&e.unref(n)(i.show?.form,t.conf.update.form,e.unref(w).EDialog.Update)&&t.option.table?.inlineEdit&&t.conf.update.form[t.option.table?.rowKey]===u[t.option.table?.rowKey]&&(i.type==="input"||i.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[i.type==="input"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:0,modelValue:t.conf.update.form[i.key],"onUpdate:modelValue":f=>t.conf.update.form[i.key]=f,disabled:t.conf.update.getDisabled(i,!0)},{ref_for:!0},t.conf.update.getBind(i),e.toHandlers(t.conf.update.getOn(i,u)),{style:{width:"100%"}}),e.createSlots({_:2},[i.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof i.options?.input?.prepend=="function"?i.options?.input?.prepend(u):i.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):i.type==="select"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:1,modelValue:t.conf.update.form[i.key],"onUpdate:modelValue":f=>t.conf.update.form[i.key]=f,disabled:t.conf.update.getDisabled(i,!0)},{ref_for:!0},t.conf.update.getBind(i),e.toHandlers(t.conf.update.getOn(i,u)),{style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.options?.search?.select?.data||i.options?.select?.data,f=>(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:f.value,label:f.label,value:f.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):i.type==="switch"?(e.openBlock(),e.createBlock(e.unref(y.ElSwitch),e.mergeProps({key:2,modelValue:t.conf.update.form[i.key],"onUpdate:modelValue":f=>t.conf.update.form[i.key]=f},{ref_for:!0},t.conf.update.getBind(i),e.toHandlers(t.conf.update.getOn(i,u)),{disabled:t.conf.update.getDisabled(i,!0)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)],64)):e.renderSlot(c.$slots,"table-"+i.key,{key:1,row:u,item:i},()=>[e.unref($).customComponent[i.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref($).customComponent[i.type??""]?.table),e.mergeProps({key:0,modelValue:u[i.key],"onUpdate:modelValue":f=>u[i.key]=f},{ref_for:!0},i.options?.[i.type??""],e.toHandlers(i.options?.[i.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):i.type==="switch"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[i.options?.switch?.tableConfig?.change?(e.openBlock(),e.createBlock(e.unref(y.ElSwitch),e.mergeProps({key:0,modelValue:u[i.key],"onUpdate:modelValue":f=>u[i.key]=f,loading:i.options?.switch?.loadingMap?.[u[t.option.table?.rowKey]]?.loading,"before-change":()=>i.options?.switch?.tableBeforeChange?.(i.key,u)},{ref_for:!0},i.options?.switch),null,16,["modelValue","onUpdate:modelValue","loading","before-change"])):(e.openBlock(),e.createElementBlock("span",St,e.toDisplayString(u[i.key]===i.options?.switch?.activeValue?i.options?.switch?.activeText:i.options?.switch?.inactiveText),1))],64)):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":i.table?.click?.color}),class:e.normalizeClass({"table-text-click":i.table?.click?.callback}),onClick:f=>i.table?.click?.callback?.(u),innerHTML:i.table?.format?i.table?.format(u):u[i.key]},null,14,Nt))])],64))],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],64))),128)}}}),Dt={key:0,class:"relative curd-search fit-width"},zt={class:"mb-10 flex justify-between items-center fit-width"},$t={class:"flex items-center",style:{gap:"10px"}},Mt={key:0},Ot={key:1},Rt={key:2},Tt={class:"export-btn"},Ut={key:1,class:"export-btn"},At={class:"flex items-center table-tools-right",style:{gap:"10px"}},Lt={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},Ht={class:"dialog-footer"},jt={key:0},It={key:1},Kt={class:"dialog-footer"},me=e.defineComponent({__name:"index",props:{option:{default:{}},form:{default:void 0},searchForm:{default:void 0}},setup(t,{expose:n}){const l=w.EDialog,o=t,r=w.isFun,{conf:a,switchConfirmRef:d,ruleFormRef:c,tableRef:g}=qe(o);return n({conf:a}),(s,i)=>{const u=e.resolveComponent("el-tooltip"),f=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[t.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[t.option.table?.fitHeight?"absolute fit":""]]),style:{overflow:"hidden"}},[e.renderSlot(s.$slots,"box-left"),e.createElementVNode("div",{class:e.normalizeClass(["column fit-width no-wrap",[t.option.table?.fitHeight?"col":""]])},[t.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",Dt,[e.createVNode(e.unref(y.ElForm),{model:e.unref(a).search.form,inline:"",size:t.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"search-start",{row:e.unref(a).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a).search.column.list,m=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:m.key},[e.renderSlot(s.$slots,"search-"+m.key+"-start",{row:e.unref(a).search.form}),(typeof m.show?.search=="function"?m.show?.search(e.unref(a).search.form):m.show?.search)?(e.openBlock(),e.createBlock(e.unref(y.ElFormItem),{key:0,label:m.text?.search?.label??m.label},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"search-"+m.key+"-left",{row:e.unref(a).search.form}),e.renderSlot(s.$slots,"search-"+m.key,{row:e.unref(a).search.form},()=>[m.options?.search?.type?(e.openBlock(),e.createBlock(fe,{key:0,item:m,conf:e.unref(a),type:m.options.search.type},null,8,["item","conf","type"])):(e.openBlock(),e.createBlock(fe,{key:1,item:m,conf:e.unref(a),type:m.type},null,8,["item","conf","type"]))]),e.renderSlot(s.$slots,"search-"+m.key+"-right",{row:e.unref(a).search.form})]),_:2},1032,["label"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"search-"+m.key+"-end",{row:e.unref(a).search.form})],64))),128)),e.renderSlot(s.$slots,"search-center",{row:e.unref(a).search.form}),t.option.tools?.search||t.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(y.ElFormItem),{key:0},{default:e.withCtx(()=>[t.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:0,type:"primary",onClick:e.unref(a).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),t.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:1,onClick:e.unref(a).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(s.$slots,"search-end",{row:e.unref(a).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",zt,[e.createElementVNode("div",$t,[e.unref(r)(t.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Mt,[e.createVNode(e.unref(y.ElButton),{type:"primary",onClick:i[0]||(i[0]=m=>e.unref(a).update.open(e.unref(l).Add)),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.table?.selectable&&e.unref(r)(t.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",Ot,[e.createVNode(e.unref(y.ElButton),{type:"danger",onClick:i[1]||(i[1]=m=>e.unref(a).remove.open(e.unref(a).table.selection.list)),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",Rt,[e.createVNode(e.unref(y.ElButton),{type:"warning",onClick:i[2]||(i[2]=m=>e.unref(a).table.expand.all()),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.tools?.export?.show?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[t.option.tools?.export?.dropdown?.show?(e.openBlock(),e.createBlock(e.unref(y.ElDropdown),{key:0,onCommand:e.unref(a).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(y.ElDropdownMenu),{size:t.option.size?.search},{default:e.withCtx(()=>[t.option.tools?.export?.dropdown?.select&&(t.option.table?.selectable||e.unref(r)(t.option.tools?.delete))?(e.openBlock(),e.createBlock(e.unref(y.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),t.option.tools?.export?.dropdown?.page?(e.openBlock(),e.createBlock(e.unref(y.ElDropdownItem),{key:1,command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1})):e.createCommentVNode("",!0),t.option.tools?.export?.dropdown?.all?(e.openBlock(),e.createBlock(e.unref(y.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",Tt,[e.createVNode(e.unref(y.ElButton),{type:"warning",loading:e.unref(a).export.loading,size:t.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",Ut,[e.createVNode(e.unref(y.ElButton),{type:"warning",loading:e.unref(a).export.loading,size:t.option.size?.search,onClick:i[3]||(i[3]=m=>e.unref(a).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(s.$slots,"tools-left")]),e.createElementVNode("div",At,[e.renderSlot(s.$slots,"tools-right"),e.unref(a).page.showTools?(e.openBlock(),e.createBlock(e.unref(y.ElPagination),e.mergeProps({key:0,"current-page":e.unref(a).page.num,"onUpdate:currentPage":i[4]||(i[4]=m=>e.unref(a).page.num=m),"page-size":e.unref(a).page.size,"onUpdate:pageSize":i[5]||(i[5]=m=>e.unref(a).page.size=m),background:"","page-sizes":e.unref(a).page.sizeList,"pager-count":e.unref(a).page.pagerCount,layout:e.unref(a).page.layout,total:e.unref(a).page.total,size:t.option.size?.table,onSizeChange:e.unref(a).table.getList,onCurrentChange:e.unref(a).table.getList},t.option.page?.pagination||{},e.toHandlers(t.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),t.option.tools?.expandColumn===void 0||t.option.tools?.expandColumn?(e.openBlock(),e.createBlock(u,{key:1,effect:"dark",content:e.unref(a).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",[t.option.size?.search]]),onClick:i[6]||(i[6]=(...m)=>e.unref(a).table.header.group.toggleExpandAll&&e.unref(a).table.header.group.toggleExpandAll(...m))},[e.unref(a).table.header.group.expand?(e.openBlock(),e.createBlock(_e,{key:0})):(e.openBlock(),e.createBlock(nt,{key:1}))],2)]),_:1},8,["content"])):e.createCommentVNode("",!0),t.option.tools?.refresh===void 0||t.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["refresh-btn",[t.option.size?.search]]),onClick:i[7]||(i[7]=(...m)=>e.unref(a).table.getList&&e.unref(a).table.getList(...m))},[e.createVNode(it)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[t.option.table?.fitHeight?"col ":"",t.option.table?.editMode?"edit-mode":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[t.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(y.ElTable),e.mergeProps({ref_key:"tableRef",ref:g,data:e.unref(a).table.data,border:t.option.table?.border===void 0?!0:t.option.table?.border,onSelectionChange:e.unref(a).table.selection.change,onSortChange:e.unref(a).table.sort.change,"expand-row-keys":e.unref(a).table.expand.rowKeys,onExpandChange:e.unref(a).table.expand.change},t.option.table,e.toHandlers(t.option.table?.on||{})),{default:e.withCtx(()=>[(typeof t.option.table?.selectable=="object"?t.option.table?.selectable?.show:t.option.table?.selectable)||e.unref(r)(t.option.tools?.delete)||t.option.tools?.export?.show&&t.option.tools?.export?.select?(e.openBlock(),e.createBlock(e.unref(y.ElTableColumn),e.mergeProps({key:0,type:"selection",width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1,className:"cc1-form-selectable-column"},typeof t.option.table?.selectable=="object"?t.option.table?.selectable:{},e.toHandlers(typeof t.option.table?.selectable=="object"?t.option.table?.selectable?.on||{}:{})),null,16)):e.createCommentVNode("",!0),(typeof t.option.table?.index=="object"?t.option.table?.index?.show:t.option.table?.index)?(e.openBlock(),e.createBlock(e.unref(y.ElTableColumn),e.mergeProps({key:1,type:"index",fixed:"left",width:"40",align:"center",label:"#","show-overflow-tooltip":!1,className:"cc1-form-index-column"},typeof t.option.table?.index=="object"?t.option.table?.index:{},e.toHandlers(typeof t.option.table?.index=="object"?t.option.table?.index?.on||{}:{})),null,16)):e.createCommentVNode("",!0),e.createVNode(Ft,{conf:e.unref(a),columnList:e.unref(a).table.column.list,option:t.option},e.createSlots({_:2},[e.renderList(s.$slots,(m,p)=>({name:p,fn:e.withCtx(V=>[e.renderSlot(s.$slots,p,e.normalizeProps(e.guardReactiveProps(V||{})))])}))]),1032,["conf","columnList","option"]),e.unref(r)(t.option.table?.add)||e.unref(r)(t.option.table?.update)||e.unref(r)(t.option.table?.delete)||e.unref(r)(t.option.table?.view)||s.$slots["table-op-left"]||s.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(y.ElTableColumn),e.mergeProps({key:2,align:"center",fixed:"right"},t.option.table?.operate,{width:t.option.table?.operate?.width||120,"show-overflow-tooltip":!1}),{header:e.withCtx(()=>[e.renderSlot(s.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("operation")),1)])]),default:e.withCtx(({row:m})=>[e.createVNode(e.unref(y.ElForm),{size:t.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"table-op-left",{row:m}),e.unref(a).update.type===e.unref(l).Update&&t.option.table?.inlineEdit&&e.unref(a).update.form[o.option.table?.rowKey]===m[o.option.table?.rowKey]?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(y.ElButton),{link:"",type:"info",onClick:e.unref(a).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(y.ElButton),{link:"",type:"primary",onClick:e.unref(a).update.submit,loading:e.unref(a).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(s.$slots,"table-op-edit-right",{row:m})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(r)(t.option.table?.add,m)?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:0,link:"",type:"primary",onClick:p=>e.unref(a).update.open(e.unref(l).Add,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(t.option.table?.view,m)?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:1,link:"",type:"primary",onClick:p=>e.unref(a).update.open(e.unref(l).View,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("view")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(t.option.table?.update,m)?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:2,link:"",type:"warning",onClick:p=>e.unref(a).update.open(e.unref(l).Update,m)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(r)(t.option.table?.delete,m)?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:3,link:"",type:"danger",onClick:p=>e.unref(a).remove.open([m])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"table-op-right",{row:m})],64))]),_:2},1032,["size"])]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[f,e.unref(a).table.loading]])],2)],2),e.createElementVNode("div",Lt,[(t.option.page?.show===void 0||t.option.page?.show)&&!e.unref(a).page.showTools?(e.openBlock(),e.createBlock(e.unref(y.ElPagination),e.mergeProps({key:0,"current-page":e.unref(a).page.num,"onUpdate:currentPage":i[8]||(i[8]=m=>e.unref(a).page.num=m),"page-size":e.unref(a).page.size,"onUpdate:pageSize":i[9]||(i[9]=m=>e.unref(a).page.size=m),background:"","page-sizes":e.unref(a).page.sizeList,"pager-count":e.unref(a).page.pagerCount,layout:e.unref(a).page.layout,total:e.unref(a).page.total,size:t.option.size?.table,onSizeChange:e.unref(a).table.getList,onCurrentChange:e.unref(a).table.getList},t.option.page?.pagination||{},e.toHandlers(t.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])],2),e.renderSlot(s.$slots,"box-right")],2),e.createVNode(e.unref(y.ElDialog),e.mergeProps({modelValue:e.unref(a).update.show,"onUpdate:modelValue":i[10]||(i[10]=m=>e.unref(a).update.show=m),title:e.unref(a).update.title,"before-close":e.unref(a).update.close},t.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",Ht,[e.createVNode(e.unref(y.ElForm),{size:t.option.size?.form},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"dialog-footer",{row:e.unref(a).update},()=>[e.createVNode(e.unref(y.ElButton),{onClick:e.unref(a).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(a).update.type!==e.unref(l).View?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:0,type:"primary",onClick:e.unref(a).update.submit,loading:e.unref(a).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(s.$slots,"dialog-start",{row:e.unref(a).update}),e.createVNode(e.unref(y.ElForm),{ref_key:"ruleFormRef",ref:c,model:e.unref(a).update.form,rules:e.unref(a).update.rules,size:t.option.size?.form,class:"update-dialog-form"},{default:e.withCtx(()=>[e.unref(a).update.showContent?(e.openBlock(),e.createBlock(de,{key:0,"form-grid":e.unref(a).update.formGrid,"max-span":e.unref(a).update.formMaxSpan,form:e.unref(a).update.form,type:e.unref(a).update.type,stripe:t.option.form?.stripe,"label-width":t.option.form?.labelWidth,"form-option":t.option.form,"get-bind":e.unref(a).update.getBind,"get-on":e.unref(a).update.getOn,"get-disabled":e.unref(a).update.getDisabled},e.createSlots({_:2},[e.renderList(s.$slots,(m,p)=>({name:p,fn:e.withCtx(V=>[e.renderSlot(s.$slots,p,e.normalizeProps(e.guardReactiveProps(V||{})))])}))]),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(s.$slots,"dialog-end",{row:e.unref(a).update})]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(y.ElDialog),{modelValue:e.unref(a).remove.show,"onUpdate:modelValue":i[11]||(i[11]=m=>e.unref(a).remove.show=m),title:e.unref(a).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",Kt,[e.createVNode(e.unref(y.ElForm),{size:t.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(y.ElButton),{onClick:e.unref(a).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(y.ElButton),{type:"danger",onClick:e.unref(a).remove.submit,loading:e.unref(a).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(()=>[t.option.dialog?.delete?.content?(e.openBlock(),e.createElementBlock("div",jt,[e.createVNode(Xe,{content:t.option.dialog?.delete?.content,value:e.unref(a).remove.items},null,8,["content","value"])])):(e.openBlock(),e.createElementBlock("div",It,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",e.unref(a).remove.items.length)),1))]),_:1},8,["modelValue","title"]),e.createVNode(Je,{ref_key:"switchConfirmRef",ref:d,size:t.option.size?.form},null,8,["size"])],2)}}});class Gt{static async download(n,l="download.png"){const o=document.createElement("a");o.style.display="none",o.href=n,o.setAttribute("download",l),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,l)=>{const o=new Blob([JSON.stringify(n)],{type:"application/json"}),r=URL.createObjectURL(o),a=document.createElement("a");a.href=r,a.download=`${l||"config"}.json`,a.click()};static importFile=async n=>new Promise((l,o)=>{const r=document.createElement("input");r.type="file";const a=n?.accept||".json";r.accept=a,r.style.display="none",r.onchange=d=>{const c=d.target.files[0];if(!c){w.fail("未选择文件"),o("未选择文件");return}const g=new FileReader;g.onload=async s=>{const i=a==".json"?JSON.parse(s.target.result):s.target.result;l(i)},g.onerror=()=>{w.fail("文件读取失败"),o("文件读取失败")},g.readAsText(c),document.body.removeChild(r)},document.body.appendChild(r),r.click()})}const ge=(t,n)=>{if(t.component("TCurd",me),t.component("TFormList",q),t.component("TColumn",ce),n?.customComponent){$.customComponent=n.customComponent;for(const l in n.customComponent)t.component(l,n.customComponent[l])}},Wt={install:ge};N.ArrUtil=R,N.ExcelUtil=se,N.TColumn=ce,N.TCurd=me,N.TFile=Gt,N.TForm=$,N.TFormConfig=E,N.TFormI18n=k,N.TFormList=q,N.TSys=w,N.default=Wt,N.install=ge,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(F,y){typeof exports=="object"&&typeof module<"u"?y(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"],y):(F=typeof globalThis<"u"?globalThis:F||self,y(F.cc1Form={},F.ElementPlus,F.VueRouter,F.Vue,F.cc1Vue3))})(this,(function(F,y,Xt,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,...a)=>Array.isArray(n)?n.some(o=>typeof o=="function"?o(...a):o):typeof n=="function"?n(...a):n;static getRouterParams=()=>{const n=this.router.currentRoute.value.query||{},a=this.router.currentRoute.value.params||{};return Object.keys(n).length?n:Object.keys(a).length?a:{}};static moduleObj={};static loadModule=async n=>{if(!w.moduleObj[n])throw new Error(`模块${n}未加载,请赋值如:TSys.moduleObj = { ${n}: ()=>import('${n}') }`);const a=await w.moduleObj[n]();return a.default??a};static tipMessages={};static tipMessagesGap=500;static showMessage(n,a,o={}){const i=Date.now();if(!this.tipMessages[n]||i-this.tipMessages[n]>this.tipMessagesGap){this.tipMessages[n]=i;const r=Object.assign({message:n,type:a},o);y.ElMessage(r),setTimeout(()=>{delete this.tipMessages[n]},this.tipMessagesGap)}}static fail=(n,a={})=>{this.showMessage(n,"error",a)};static success=(n,a={})=>{this.showMessage(n,"success",a)};static loadingObj=null;static loadingTimer=null;static loading=(n=!0,a="Loading...")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{n?this.loadingObj=y.ElLoading.service({lock:!0,text:a,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(n,a=!0)=>{if(a){let o=screen.width/2-500,i=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="+i+", 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(a,o)=>{let i=document.getElementById(n.id);const r=await w.loadModule("html2canvas");try{r(i,{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(d){let c=d.toDataURL("image/png");a(c)})}catch(d){o(d)}})}class x{static config={field:{page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"}},dialog:{width:"980px",closeOnClickModal:!1},pagination:{layout:"total, sizes, prev, pager, next, jumper",pageSizes:[10,20,50,100],size:10,pagerCount:7,showTools:!1},size:{table:"default",form:"default",search:"default"},tools:{expandColumn:!1,refresh:!0,expand:!1,search:!0,reset:!0,add:!0,delete:!0,export:{show:!0,dropdown:{show:!0,select:!0,page:!0,all:!0},fileName:"Export Data "}},form:{size:"default",labelWidth:"120px",stripe:!0,editAll:!1,maxSpan:12,defaultSpan:6,openBefore:void 0,openAfter:void 0,closeBefore:void 0,submitBefore:void 0,submitAfter:void 0},table:{index:!1,labelWidth:"100px",size:"default",emptyText:"",headerCellClassName:"table-header",rowKey:"_id",highlightCurrentRow:!0,border:!0,selectable:!1,column:[],showOverflowTooltip:!0,showSummary:!1,summaryMethod:()=>[],inlineEdit:!1,operate:{width:void 0},add:!1,update:!0,delete:!0,sort:{props:{field:"sortField"},order:{field:"sortOrder",asc:"asc",desc:"desc"},resetPage:!1,change:void 0},fitHeight:!0},columnConfig:{type:"input",form:{width:"100%",spanCol:!1},table:{table:!0,minWidth:120,width:void 0,fixed:void 0,align:"center",showOverflowTooltip:!0,format:void 0,click:{callback:void 0,color:"#409EFF"},tooltip:void 0},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0},disabled:{view:!0},options:{switch:{activeValue:!0,inactiveValue:!1,tableConfig:{change:!0,confirm:!0,loadList:!0}},treeSelect:{multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"},select:{data:[],clearable:!0,filterable:!0,dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}},radio:{data:[],dataPath:"data.data",dataApiConfig:{once:!0,init:!0,create:!0,update:!0}}}}};static setConfig=n=>{x.config=ObjectUtil.deepMerge(x.config,n)}}class M{static customComponent={};static error={};static findOptions=(n,a)=>{const o=n.column.find(r=>r.key===a),i=r=>r.replace(/-([a-z])/g,(d,c)=>c.toUpperCase());if(o)return o.options[i(o.type)]};static setOptionsData=(n,a,o)=>{const i=M.findOptions(n,a);i&&(i.data=o)};static form={openBefore:{parentId:(n,a,o,i)=>{const r=x.config.table.rowKey;n?a.type===w.EDialog.Add?(a.form.parentId=n[r],a.form.sort=n.children.length+1):a.form.parentId=n.parentId.substring(n.parentId.lastIndexOf(",")+1):(a.form.parentId="0",a.form.sort=o.length+1),M.setOptionsData(i,"parentId",[{[r]:"0",title:"根",children:o}])}}}}class R{static getIdFun=()=>StrUtil.uuid();static setId=(n,a,o)=>{a[n]||(a[n]=[]);const i=x.config.table.rowKey;a[n].forEach(r=>{o.forEach(d=>{let c=d.default??"";d.type==="number"&&(c=d.default??0),d.type==="boolean"&&(c=d.default??!1),d.type==="time"&&(c=d.default??new Date),r[d.value]===void 0&&(r[d.value]=c)}),r[i]||(r[i]=R.getIdFun())})};static add=(n,a,o,i)=>{const r=JSONUtil.cp(o);R.setId(n,a,o);const d=x.config.table.rowKey;a[n].push(r.reduce((c,f)=>{let s=f.default??"";return f.type==="number"&&(s=f.default??0),f.type==="boolean"&&(s=f.default??!1),f.type==="time"&&(s=f.default??new Date),c[f.value]=s,c},{[d]:R.getIdFun()})),i?.(a)};static remove=(n,a,o,i)=>{const r=x.config.table.rowKey;a[n]=a[n].filter(d=>d[r]!==o[r]),i?.(a)};static getNoIdData=(n,a)=>{const o=JSONUtil.cp(n),i=x.config.table.rowKey;return o.forEach(r=>{r[i]&&delete r[i],a&&r[a]&&R.getNoIdData(r[a],a)}),o}}const be={key:0,class:"column curd-form-com-list",style:{width:"100%",gap:"10px"}},ke={key:0},we={class:"row items-center",style:{gap:"10px",width:"100%"}},Ce={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(t,{emit:n}){const a=t,o=e.reactive({show:!1,add:(r,d,c)=>{R.add(r,d,c,()=>{i("change")})},remove:(r,d,c)=>{R.remove(r,d,c,()=>{i("change")})}});e.onMounted(()=>{R.setId(a.field,a.row,a.itemFields),o.show=!0});const i=n;return(r,d)=>{const c=e.resolveComponent("el-button"),f=e.resolveComponent("el-input");return o.show?(e.openBlock(),e.createElementBlock("div",be,[e.renderSlot(r.$slots,"list-start",{row:t.row}),t.addBottom?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(c,{link:"",type:"primary",onClick:d[0]||(d[0]=s=>o.add(t.field,t.row,t.itemFields))},{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("添加",-1)])]),_:1})])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.row[t.field],s=>(e.openBlock(),e.createElementBlock("div",we,[e.renderSlot(r.$slots,"item-start",{item:s,row:t.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.itemFields,l=>(e.openBlock(),e.createBlock(f,{modelValue:s[l.value],"onUpdate:modelValue":u=>s[l.value]=u,style:e.normalizeStyle({width:t.inputWidth}),class:e.normalizeClass(t.inputClass),placeholder:l[t.label]||l[t.value],onChange:d[1]||(d[1]=u=>i("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(r.$slots,"item-end",{item:s,row:t.row}),e.createVNode(c,{link:"",type:"danger",onClick:l=>o.remove(t.field,t.row,s)},{default:e.withCtx(()=>[...d[4]||(d[4]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),t.addBottom?(e.openBlock(),e.createElementBlock("div",Ce,[e.createVNode(c,{link:"",type:"primary",onClick:d[2]||(d[2]=s=>o.add(t.field,t.row,t.itemFields))},{default:e.withCtx(()=>[...d[5]||(d[5]=[e.createTextVNode("添加",-1)])]),_:1})])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"list-end",{row:t.row})])):e.createCommentVNode("",!0)}}}),Be={class:"row form-item-content",style:{width:"100%"}},Ve={class:"col column form-item-content-item"},Ee={class:"col"},xe=["innerHTML"],Se=e.defineComponent({__name:"field",props:{item:{},form:{},type:{},labelWidth:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(t){return(n,a)=>(e.openBlock(),e.createBlock(e.unref(y.ElFormItem),{label:t.item.text?.form?.label??t.item.label,prop:t.item.key,"label-width":t.item.text?.form?.label==""?0:t.item.form?.labelWidth||t.labelWidth},{default:e.withCtx(()=>[e.createElementVNode("div",Be,[e.renderSlot(n.$slots,"form-"+t.item.key+"-start",{row:t.form,item:t.item}),e.createElementVNode("div",Ve,[e.createElementVNode("div",Ee,[e.renderSlot(n.$slots,"form-"+t.item.key,{row:t.form,item:t.item},()=>[t.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:0,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[0]||(a[0]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),e.createSlots({_:2},[t.getBind(t.item).prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof t.getBind(t.item).prepend=="function"?t.getBind(t.item).prepend(t.form):t.getBind(t.item).prepend),1)]),key:"0"}:void 0]),1040,["modelValue","disabled"])):t.item.type==="number"?(e.openBlock(),e.createBlock(e.unref(y.ElInputNumber),e.mergeProps({key:1,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[1]||(a[1]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="textarea"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:2,type:"textarea",modelValue:t.form[t.item.key],"onUpdate:modelValue":a[2]||(a[2]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(y.ElSwitch),e.mergeProps({key:3,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[3]||(a[3]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:4,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[4]||(a[4]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElOption),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="radio"?(e.openBlock(),e.createBlock(e.unref(y.ElRadioGroup),e.mergeProps({key:5,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[5]||(a[5]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[t.getBind(t.item).type==="group"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElRadioButton),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElRadio),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="checkbox"?(e.openBlock(),e.createBlock(e.unref(y.ElCheckboxGroup),e.mergeProps({key:6,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[6]||(a[6]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),{default:e.withCtx(()=>[t.getBind(t.item).type==="group"?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElCheckboxButton),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(t.getBind(t.item).data||[],o=>(e.openBlock(),e.createBlock(e.unref(y.ElCheckbox),e.mergeProps({key:o.value},{ref_for:!0},o,e.toHandlers(o.on||{})),null,16))),128))]),_:1},16,["modelValue","disabled"])):t.item.type==="color"?(e.openBlock(),e.createBlock(e.unref(y.ElColorPicker),e.mergeProps({key:7,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[7]||(a[7]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="slider"?(e.openBlock(),e.createBlock(e.unref(y.ElSlider),e.mergeProps({key:8,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[8]||(a[8]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type==="list"?(e.openBlock(),e.createBlock(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(y.ElTreeSelect),e.mergeProps({key:10,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[9]||(a[9]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item),style:{width:"100%"}}),null,16,["modelValue","disabled"])):t.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(y.ElDatePicker),e.mergeProps({key:11,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[10]||(a[10]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&typeof t.item.type=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.item.type),e.mergeProps({key:12,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[11]||(a[11]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):t.item.type&&(e.unref(M).customComponent[t.item.type]||e.unref(M).customComponent[t.item.type]?.form)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(M).customComponent[t.item.type]?.form||e.unref(M).customComponent[t.item.type]),e.mergeProps({key:13,modelValue:t.form[t.item.key],"onUpdate:modelValue":a[12]||(a[12]=o=>t.form[t.item.key]=o)},t.getBind(t.item),e.toHandlers(t.getOn(t.item)),{disabled:t.getDisabled(t.item)}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"form-"+t.item.key+"-right",{row:t.form,item:t.item})]),e.renderSlot(n.$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,xe)):e.createCommentVNode("",!0)])]),e.renderSlot(n.$slots,"form-"+t.item.key+"-end",{row:t.form,item:t.item})])]),_:3},8,["label","prop","label-width"]))}});function Yt(t){return t}const Ne={search:"搜索",add:"新增",edit:"编辑",view:"查看",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",deleteTitle:"删除提示",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"部分内容未输入或输入错误,请检查",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?",mergeColumn:"合并栏位",expandColumn:"展开栏位"};class k{static t(n,...a){if(typeof n=="function")return n(...a);n=String(n);let o=0;return n.replace(/{([^}]+)}/g,(i,r)=>o<a.length?String(a[o++]):`{${r}}`)}static setI18n=n=>{k.curd=ObjectUtil.deepMerge(k.curd,n)};static tCurd(n,...a){return this.t(this.curd[n],...a)}static curd=Ne}class T{static delAllKey=n=>{Object.keys(n).forEach(a=>{delete n[a]})};static setValue=(n,a,o=!1)=>{o&&T.delAllKey(n),Object.keys(a).forEach(i=>{n[i]!==a[i]&&(n[i]=a[i])})}}const G=t=>{const n=e.reactive({}),a=()=>typeof t=="function"?t():t,o=()=>{const i=a();return i??n};return{internal:n,isExternal:()=>a()!=null,get(){return o()},set(i){T.setValue(o(),i,!0)},merge(i){T.setValue(o(),i,!1)},clear(){T.delAllKey(o())}}},j=t=>{t.forEach(n=>{console.log({field:n.field||"",error:n.error||""})})},Fe=t=>t?typeof t=="string"?t:t instanceof Error?t.message:t.message||String(t):"",W=t=>!t||typeof t!="object"?[]:Object.keys(t).flatMap(n=>(Array.isArray(t[n])?t[n]:[t[n]]).map(o=>({field:o?.field||n,error:Fe(o)}))),q=w.EDialog,I=t=>typeof t.type=="object"?"component":t.type||"input",De=(t,n,a)=>{const o=G(()=>n.form),i=d=>X(d.update.formGrid||[],d.update.form,d.update.type,d.update.formMaxSpan).map(f=>f.item.key).filter(Boolean),r=async d=>{const c=a.ruleFormRef.value;if(!c)return!0;const f=i(d),s=Object.keys(d.update.rules||{}).filter(u=>!f.includes(u));if(s.length&&c.clearValidate(s),!f.length)return!0;if(!await c.validateField(f,async(u,m)=>{u||j(W(m))}))throw!1;return!0};return{update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:q.Update,get form(){return o.get()},set form(d){o.set(d)},formDefault:{},formColumn:[],formGrid:[],formMaxSpan:12,getDisabled:(d,c=!1)=>{const f=t();return n.option.table?.editMode&&c?d.disabled?.table===void 0?!1:w.isFun(d.disabled?.table,f.update.form):te(d,f.update.type,f.update.form)},getBind:d=>{const c=t();return oe(d,c.update.type)},getOn:(d,c)=>{const f=t();return ne(d,f.update.type,[c||f.update.form,d])},getOptions:d=>{const c=t();try{const s=ie(c.update.formGrid?.length?c.update.formGrid:c.update.formColumn).find(l=>l.item.key===d)?.item;return s?{options:s.options,bind:c.update.getBind(s)}:{options:{},bind:{}}}catch{return{options:{},bind:{}}}},edit:{data:{},getApiData:d=>{const c=t();if(n.option.form?.editAll)return d;const f={[n.option.table?.rowKey]:c.update.edit.data[n.option.table?.rowKey]};return Object.keys(c.update.edit.data).forEach(s=>{d[s]!==c.update.edit.data[s]&&(f[s]=d[s])}),f}},view:{},openLoading:!1,open:async(d,c)=>{const f=t();if(!(f.update.showContent||f.update.openLoading)){w.loading(!0),f.update.openLoading=!0;try{f.update.type=d;const s=d===q.Add;f.update.edit.data=s?void 0:JSONUtil.cp(c),f.update.title=k.tCurd(s?"add":d===q.View?"view":"edit");const l=s?ObjectUtil.deepMerge(JSONUtil.cp(f.update.formDefault),c?JSONUtil.cp(c):{}):JSONUtil.cp(c);T.setValue(f.update.form,l,!0),await f.initApiData("update"),await n.option.form?.openBefore?.(f.update.form,f.update),(!n.option.table?.inlineEdit||s)&&(f.update.show=!0,f.update.showContent=!0),n.option.form?.openAfter?.(f.update.form,f.update)}catch(s){console.error(s)}finally{w.loading(!1),f.update.openLoading=!1}}},validate:async(d=!0)=>{const c=t();try{const f=n.option.table?.editMode?c.tableEditValidate.validate():r(c);return await Promise.all([f,c.formRef.validate()]),!0}catch{return d&&w.fail(k.tCurd("checkFormData")),!1}},submit:async()=>{const d=t();if(!await d.update.validate()||d.update.loading)return;d.update.loading=!0;const f=d.update.type===q.Add?n.option.api.create:n.option.api.update;try{await n.option.form?.submitBefore?.(d.update.form,d.update)}catch{d.update.loading=!1;return}let s=ObjectUtil.deepMerge(d.update.form,{});delete s.children;const l=new Set(n.option.column.filter(u=>u.type==="datetime").map(u=>u.key));Object.keys(s).forEach(u=>{if(l.has(u)&&s[u]!=null){const m=new Date(s[u]).getTime();isNaN(m)||(s[u]=m)}});try{if(!f)return;await f({...s}),d.update.close(),await d.table.getList(),n.option.form?.submitAfter?.(s,d.update)}catch(u){console.error(u)}finally{d.update.loading=!1}},close:()=>{const d=t();d.update.show=!1,d.update.edit.data=void 0,setTimeout(()=>{d.update.showContent=!1,a.ruleFormRef.value?.resetFields?.(),o.clear()},350)}}}},O=12,P=(t,n)=>{t.isForm=n,Array.isArray(t.children)&&t.children.forEach(a=>P(a,n))},ze=t=>t.isForm===!1?!1:typeof t.show?.form=="boolean"?t.show.form:!0,$e=(t,n,a)=>(t.form=t.form||{span:n},a==="column"?t.form.span=t.form.span??12:t.form.span=t.form.span??n,t.form.span),ee=t=>{const n=t.form;return n?.row!=null&&n.row>0?n.row:O},A=t=>Math.floor((t.gridRow-1)/O),te=(t,n,a)=>{if(n===w.EDialog.View)return t.disabled?.view===void 0?!0:w.isFun(t.disabled?.view,a);const o=t.disabled?.[n===w.EDialog.Add?"create":"update"];return w.isFun(o,a)},oe=(t,n)=>{const a=I(t);return t.options?.[n===w.EDialog.Add?"formAdd":"formUpdate"]?.[a]||t.options?.[a]||{}},ne=(t,n,a=[])=>{const o=I(t),r=t.options?.[n===w.EDialog.Add?"formAdd":"formUpdate"]?.[o]?.on||t.options?.[o]?.on||{},d={};return Object.keys(r).forEach(c=>{const f=r[c];typeof f=="function"?d[c]=function(...s){return f.apply(this,[...s,...a])}:d[c]=f}),d},ae=(t,n,a,o,i)=>{const r=t,d=r.colSpan??t.span;if(!t.item.form?.spanCol)return d;const c=i?.maxSpan||12,f=i?.defaultSpan||c/2,s=r.gridBand,u=n.filter(m=>s!=null?m.gridBand===s&&!w.isFun(m.item.show?.form,a,o):m.gridRow===r.gridRow&&!w.isFun(m.item.show?.form,a,o)).reduce((m,g)=>m+(g.colSpan??g.span??f),0);return d+u},Me=(t,n)=>{const a=(o,i)=>{const r=o.gridRow,d=o.gridRow+o.rowSpan-1,c=i.gridRow,f=i.gridRow+i.rowSpan-1;return r<=f&&c<=d};return t.map(o=>t.filter(r=>a(o,r)).length!==1||o.colSpan>=n?o:{...o,span:n,colSpan:n,gridColumn:1})},re=(t,n,a={})=>{const o=new Set,i=[];let r=0,d=0;const c=g=>Math.floor(g/O)*O,f=(g,p)=>`${g},${p}`,s=(g,p,B,S)=>{if(p+B>n)return!1;for(let V=0;V<S;V++)for(let E=0;E<B;E++)if(o.has(f(g+V,p+E)))return!1;return!0},l=(g,p,B,S)=>{for(let V=0;V<S;V++)for(let E=0;E<B;E++)o.add(f(g+V,p+E))},u=(g,p,B,S)=>{for(let E=c(g);E<500*O;E+=O){const K=E+O,Z=E===c(g)?Math.max(E,g):E;for(let U=Z;U<K;U++){const v=U===g?p:0;for(let H=v;H<=n-B;H++)if(s(U,H,B,S))return{tr:U,tc:H}}}return{tr:g,tc:p}},m=(g,p,B,S)=>{const V=c(g);if(S<O&&g+S<V+O){r=g+S,d=p;return}const E=p+B;if(E<n){d=E,r=V;return}d=0,r=V+O};return t.forEach(g=>{const p=g.colSpan??(g.span===0?n:g.span),B=g.rowSpan??ee(g.item);g.item.form?.rowBreak&&i.length&&(d=0,r=c(r)+O);let{tr:S,tc:V}=s(r,d,p,B)?{tr:r,tc:d}:u(r,d,p,B);s(S,V,p,B)||({tr:S,tc:V}=u(0,0,p,B)),l(S,V,p,B);const E=S+1;i.push({...g,span:p,colSpan:p,rowSpan:B,gridRow:E,gridColumn:V+1,gridBand:A({gridRow:E})}),m(S,V,p,B)}),a.fillSingleRows?Me(i,n):i},X=(t,n,a,o=O)=>{const i=t.filter(c=>w.isFun(c.item.show?.form,n,a)),r=new Map;t.forEach(c=>{const s=`${c.gridBand??A(c)}:${c.gridColumn}:${c.colSpan}`;r.has(s)||r.set(s,[]),r.get(s).push(c)});const d=new Map;return r.forEach(c=>{const f=c.reduce((m,g)=>m+g.rowSpan,0);if(!(c.length>1&&f===O&&c.every(m=>m.rowSpan<O)))return;const l=c.filter(m=>w.isFun(m.item.show?.form,n,a));if(l.length!==1)return;const u=l[0];d.set(u.item.key,{...u,rowSpan:O})}),re(i.map(c=>d.get(c.item.key)||c),o,{fillSingleRows:!0})},le=t=>{const n=new Map;return t.forEach(a=>{const o=a.gridBand??A(a);n.has(o)||n.set(o,[]),n.get(o).push(a)}),Array.from(n.keys()).sort((a,o)=>a-o).map(a=>n.get(a))},ie=t=>t?.length?Array.isArray(t[0])?t.flat():t:[],Oe=(t,n)=>{if(!ze(t)||!t.key)return null;const a=n.defaultSpan??(n.maxSpan||12)/2,o=$e(t,a,n.layout);return{item:t,span:o}},Re=(t,n={})=>{const a=[],o=i=>{if(i.children?.length){i.children.forEach(d=>o(d));return}const r=Oe(i,n);r&&a.push(r)};return t.forEach(i=>o(i)),a},de=(t,n={})=>{const a=n.maxSpan??12,o=n.defaultSpan??a/2,i=n.layout??"row",d=Re(t,{maxSpan:a,defaultSpan:o,layout:i});if(i==="column"){const c=[];let f=1;return d.forEach(s=>{const l=ee(s.item),u=a;c.push({...s,span:u,colSpan:u,rowSpan:l,gridRow:f,gridColumn:1,gridBand:A({gridRow:f})}),f+=l}),{cells:c,maxSpan:a}}return{cells:re(d,a),maxSpan:a}},Te=t=>t.map(n=>n.item?.show?.form),Ue=(t,n,a)=>{if(!t.rules)return;const o=typeof t.rules=="boolean"?[{required:!0,message:n(t),trigger:"blur"}]:t.rules;return a?o.map(i=>a(i)):o},ce=t=>(n,a)=>Ue(n,t,o=>{if(o.validator){const i=o.validator;return{...o,validator:(r,d,c)=>{const f=a&&Object.prototype.hasOwnProperty.call(a,n.key)?a[n.key]:d;return i(r,f,c,a)}}}return o}),se=(t,n)=>{const a={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},o=(a[I(t)||"input"]||a.input)+t.label;return(n||M.error.callback)?.(t.key,t)||o},fe=t=>ce(n=>se(n,t?.error)),Ae=(t,n,a)=>{const o={},i={},r=n?.maxSpan||12,d=n?.defaultSpan||r/2,c=fe(n);t.forEach(l=>P(l,!0)),Y(t,o,i,l=>c(l,a));const{cells:f,maxSpan:s}=de(t,{maxSpan:r,defaultSpan:d,layout:n?.layout});return{formDefault:o,rules:i,formGrid:f,formMaxSpan:s,formColumn:le(f)}},Y=(t,n,a,o)=>{const i=r=>{if(r.children?.length){r.children.forEach(d=>i(d));return}if(r.key){n[r.key]=r.value;const d=o(r);d&&(a[r.key]=d)}};t.forEach(i)},Le={class:"curd-form-cell-inner"},me=e.defineComponent({__name:"layout",props:{formGrid:{},maxSpan:{},form:{},type:{},stripe:{type:Boolean},labelWidth:{},formOption:{},getBind:{type:Function},getOn:{type:Function},getDisabled:{type:Function}},setup(t){const n=w.isFun,a=t,o=e.computed(()=>X(a.formGrid,a.form,a.type,a.maxSpan)),i=e.computed(()=>{const m=Array.from(new Set(o.value.map(g=>g.gridBand??A(g)))).sort((g,p)=>g-p);return new Map(m.map((g,p)=>[g,p]))}),r=e.computed(()=>({gridTemplateColumns:`repeat(${a.maxSpan}, minmax(0, 1fr))`})),d=e.computed(()=>{let m=0;return o.value.forEach(g=>{const p=g.gridRow+g.rowSpan-1;p>m&&(m=p)}),m}),c=m=>m.gridRow+m.rowSpan-1>=d.value,f=m=>m.rowSpan>=O,s=m=>{const g=m.gridBand??A(m);return i.value.get(g)??g},l=m=>ae(m,o.value,a.form,a.type,{maxSpan:a.maxSpan,defaultSpan:a.formOption?.defaultSpan}),u=m=>{const g=l(m)||m.colSpan;return{gridRow:`${m.gridRow} / span ${m.rowSpan}`,gridColumn:`${m.gridColumn} / span ${g}`}};return(m,g)=>e.unref(n)(e.unref(Te)(t.formGrid),t.form,t.type)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.renderSlot(m.$slots,"form-start",{row:t.form}),e.createElementVNode("div",{class:e.normalizeClass(["curd-form-grid",{stripe:t.stripe!==!1}]),style:e.normalizeStyle(r.value)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,p=>(e.openBlock(),e.createElementBlock("div",{key:p.item.key,class:e.normalizeClass(["curd-form-grid-cell",[t.stripe!==!1&&s(p)%2===0?"stripe-band-odd":"",p.gridColumn>1?"has-col-border":"",t.stripe!==!1&&c(p)?"is-last-row":"",f(p)?"is-row-span":"",`form-item-col-${p.item.key}`]]),style:e.normalizeStyle(u(p))},[e.createElementVNode("div",Le,[e.unref(n)(p.item.show?.form,t.form,t.type)?(e.openBlock(),e.createBlock(Se,{key:0,class:e.normalizeClass({"is-row-span-field":f(p)}),item:p.item,form:t.form,type:t.type,"label-width":t.labelWidth,"get-bind":t.getBind,"get-on":t.getOn,"get-disabled":t.getDisabled},e.createSlots({_:2},[e.renderList(m.$slots,(B,S)=>({name:S,fn:e.withCtx(V=>[e.renderSlot(m.$slots,S,e.mergeProps({ref_for:!0},V||{}))])}))]),1032,["class","item","form","type","label-width","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)])],6))),128))],6),e.renderSlot(m.$slots,"form-end",{row:t.form})],64)):e.createCommentVNode("",!0)}}),ge=e.defineComponent({__name:"column",props:{option:{default:()=>({form:{},column:[]})},type:{default:""},form:{default:void 0}},setup(t,{expose:n}){const a=w.EDialog,o=e.ref(),i=t;let r=G(i.form);const d=J.Scope.getConf("curdConf"),c="formRef-"+StrUtil.getId();e.onUnmounted(()=>{d?.formRef?.remove(c)});const f=e.reactive({rules:{},show:!0,formDefault:{},type:i.type||d?.update?.type||a.Add,formColumn:[],formGrid:[],formMaxSpan:12,get form(){return r.get()},set form(s){r.set(s)},getDisabled:s=>te(s,f.type,f.form),getBind:s=>oe(s,f.type),getOn:s=>ne(s,f.type,[f.form,s]),initColumnForm:()=>{const s=r,l=Ae(i.option.column,i.option.form,s.get());f.formDefault=l.formDefault,f.rules=l.rules,f.formGrid=l.formGrid,f.formMaxSpan=l.formMaxSpan,f.formColumn=l.formColumn,f.type===a.Add?s.isExternal()?s.merge(JSONUtil.cp(f.formDefault)):s.set(JSONUtil.cp(f.formDefault)):!s.isExternal()&&i.form&&s.set(JSONUtil.cp(i.form))}});return d?.formRef?.set(c,{validate:async s=>{const l=o.value;if(!l)return s?.(!0),!0;const u=X(f.formGrid||[],f.form,f.type,f.formMaxSpan).map(p=>p.item.key).filter(Boolean),m=Object.keys(f.rules||{}).filter(p=>!u.includes(p));if(m.length&&l.clearValidate(m),!u.length)return s?.(!0),!0;const g=await l.validateField(u,async(p,B)=>{p||j(W(B))});if(s?.(!!g),!g)throw!1;return!0}}),i.option.form?.initStart?.(f),f.initColumnForm(),i.option.form?.initEnd?.(f),e.watch(()=>i.form,s=>{r=G(s),f.initColumnForm()}),n({ref:o,conf:f}),(s,l)=>(e.openBlock(),e.createBlock(e.unref(y.ElForm),{ref_key:"ruleFormRef",ref:o,model:f.form,rules:f.rules},{default:e.withCtx(()=>[f.show?(e.openBlock(),e.createBlock(me,{key:0,"form-grid":f.formGrid,"max-span":f.formMaxSpan,form:f.form,type:f.type,stripe:t.option.form?.stripe,"label-width":t.option.form?.labelWidth||"100px","form-option":t.option.form,"get-bind":f.getBind,"get-on":f.getOn,"get-disabled":f.getDisabled},e.createSlots({_:2},[e.renderList(s.$slots,(u,m)=>({name:m,fn:e.withCtx(g=>[e.renderSlot(s.$slots,m,e.normalizeProps(e.guardReactiveProps(g||{})))])}))]),1032,["form-grid","max-span","form","type","stripe","label-width","form-option","get-bind","get-on","get-disabled"])):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}}),He=t=>t?.value||t,je=t=>{const n=He(t);return n?.validate?new Promise((a,o)=>{let i=!1;const r=(d,c)=>{i||(i=!0,d===!1?(j(W(c)),o(!1)):a(!0))};try{const d=n.validate(r);d&&typeof d.then=="function"?d.then(c=>r(c)).catch(c=>{j(W(c?.fields||c)),o(c)}):(d!==void 0||n.validate.length===0)&&r(d)}catch(d){o(d)}}):Promise.resolve(!0)},Ie=()=>{const t=e.reactive({formRef:{map:{},set(n,a){t.formRef.map[n]=a},remove(n){delete t.formRef.map[n]},validate(){const n=Object.keys(t.formRef.map).map(a=>t.formRef.map[a]);return Promise.all(n.map(a=>je(a))).then(()=>!0)}},regFormRef(n,a,o){n?o?t.formRef.set(a,{validate:async i=>{try{i(await o())}catch{i(!1)}}}):t.formRef.set(a,n):t.formRef.remove(a)}});return t},Ke=(t,n)=>{const a=G(()=>n.searchForm);return{search:{column:{list:[]},get form(){return a.get()},set form(o){a.set(o)},formDefault:{},getPlaceholder:(o,i=k.tCurd("placeholderInput"))=>o.text?.search?.placeholder===void 0?`${i}${o.label}`:o.text?.search?.placeholder,getFormData:()=>{const o=t();let i={};n.option.column.forEach(d=>{(typeof d.show?.search=="function"?d.show?.search(o.search.form):d.show?.search)&&(i[d.key]=o.search.form[d.key])});const r=n.option.search?.before?.(i);return r&&(i=r),i},reset:()=>{const o=t(),i=o.search.formDefault;Object.keys(i).forEach(d=>{n.option.search?.resetMode==="none"?i[d]=void 0:i[d]=o.search.formDefault[d]});const r=ObjectUtil.deepMerge(i,{});T.setValue(o.search.form,r,!0),o.page.num=1,n.option.init!==!1&&o.table.getList()},submit:()=>{const o=t();o.page.num=1,o.table.getList()}}}},Ge=(t,n)=>({page:{num:1,total:0,layout:n.option.page?.layout||x.config.pagination.layout,showTools:n.option.page?.showTools||x.config.pagination.showTools,size:n.option.page?.size||x.config.pagination.size,sizeList:n.option.page?.sizeList||x.config.pagination.pageSizes,pagerCount:n.option.page?.pagerCount||x.config.pagination.pagerCount,getQuery:(a={})=>{const o=t();return{[x.config.field.page.size]:a.size||o.page.size,[x.config.field.page.num]:a.num||o.page.num,...o.search.getFormData()}}}}),We=(t,n,a)=>({table:{op:{width:(...o)=>o.filter(r=>r).length*30+60},loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(o,i)=>{},all:()=>{const o=t();if(o.table.expand.isExpand)o.table.expand.rowKeys=[];else{const i=r=>{let d=[];return r.forEach(c=>{d.push(c[n.option.table.rowKey]),c.children?.length&&(d=d.concat(i(c.children)))}),d};o.table.expand.rowKeys=i(o.table.data)}o.table.expand.isExpand=!o.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},header:{group:{expand:!1,toggleExpandAll:()=>{const o=t(),i=!o.table.header.group.expand;o.table.header.group.expand=i;const r=d=>{d.forEach(c=>{c.table?.header?.group!==void 0&&(c.table.header.group=!i),c.table?.header?.groupKey!==void 0&&(c.table.header.show=i),Array.isArray(c.children)&&c.children.length&&r(c.children)})};r(o.table.column.list)}}},getList:async()=>{const o=t();o.table.loading=!0;const i=n.option.api.list,r=JSONUtil.cp(o.table.selection.list);try{await o.initApiData("init");let d={};if(o.table.sort.prop){const{props:p,order:B}=x.config.table.sort;d={[p.field]:o.table.sort.prop,[B.field]:o.table.sort.order}}const c=await i({...o.page.getQuery(),...d}),f=x.config.field.result,s=c.data||{[f.list]:c},l=(Array.isArray(s[f.list]),s[f.list]),u=ie(o.update.formGrid?.length?o.update.formGrid:o.update.formColumn),g=ObjectUtil.deepMerge({data:l},{}).data.map(p=>(Object.keys(p).forEach(S=>{const V=u.find(E=>E.item.key===S);V&&["select","radio"].includes(V.item.type)&&(V.item.table.format||(V.item.table.format=E=>V.item.options[V.item.type].data?.find(K=>K.value==E[S])?.label||E[S]))}),p));o.table.data=n.option.data?await n.option.data(g,l):g,o.tableEditValidate?.clear?.(),o.page.total=s[f.total]||0,setTimeout(()=>{o.table.selection.setList(r)},20)}catch(d){console.error(d)}finally{o.table.loading=!1}},selection:{list:[],change:o=>{t().table.selection.list=o},setList:(o,i)=>{const r=t();r.table.selection.list=[];const d=a.tableRef.value;if(d?.clearSelection(),!d||!o?.length)return;const c=n.option.table?.rowKey,f=s=>{const l=u=>{for(const m of u){if(c!=null&&c!==""){if(m[c]===s[c])return m}else if(m===s)return m;if(Array.isArray(m.children)&&m.children.length){const g=l(m.children);if(g!==void 0)return g}}};return l(r.table.data)};o.forEach(s=>{const l=f(s);if(l)if(i){const u=()=>d.toggleRowSelection(l,!0,!1);i(s)!==!1&&u()}else d.toggleRowSelection(l,!0,!1)})}},sort:{prop:"",order:"",change:o=>{const i=t();x.config.table.sort.resetPage&&(i.page.num=1);const r=x.config.table.sort;if(r.change){r.change(o,i);return}i.table.sort.prop=o.prop,o.order===null?(i.table.sort.order="",i.table.sort.prop=""):i.table.sort.order=o.order==="ascending"?r.order.asc:r.order.desc,i.table.getList()}}}}),qe=(t,n)=>{const a=e.reactive({}),o=new WeakMap;let i=0;const r=h=>{let b=o.get(h);return b||(i+=1,b=`fallback-${i}`,o.set(h,b)),b},d=h=>{const b=n.option.table?.rowKey,C=b?h[b]:void 0;return C!=null&&C!==""?String(C):r(h)},c=(h,b)=>`${d(h)}-${b.key}`,f=h=>se(h,n.option.form?.error),s=ce(f),l=()=>{Object.keys(a).forEach(h=>{delete a[h]})},u=(h,b)=>{delete a[c(h,b)]},m=(h,b)=>a[c(h,b)]||"",g=(h,b)=>h.message||f(b),p=h=>h==null||h===""||Array.isArray(h)&&h.length===0,B=h=>{if(typeof h=="number")return h;if(typeof h=="string"||Array.isArray(h))return h.length},S=(h,b)=>{if(h==="array")return Array.isArray(b);if(h==="integer")return typeof b=="number"&&Number.isInteger(b);if(h==="float")return typeof b=="number"&&!Number.isInteger(b);if(h==="number")return typeof b=="number"&&!Number.isNaN(b);if(h==="boolean")return typeof b=="boolean";if(h==="object")return b!==null&&typeof b=="object"&&!Array.isArray(b);if(h==="date")return b instanceof Date||!Number.isNaN(new Date(b).getTime());if(h==="email")return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(b));if(h==="url")try{return new URL(String(b)),!0}catch{return!1}return h==="string"?typeof b=="string":!0},V=(h,b,C)=>typeof h.validator!="function"?Promise.resolve(!0):new Promise(D=>{let z=!1;const N=$=>{if(!z){if(z=!0,$==null){D(!0);return}if($ instanceof Error){D($.message||g(h,C));return}if(Array.isArray($)){const _=$[0];D(_ instanceof Error?_.message:String(_||g(h,C)));return}D(String($))}};try{const $=h.validator(h,b,N);$&&typeof $.then=="function"?$.then(()=>N()).catch(N):$===!1?N(g(h,C)):typeof $=="string"||$ instanceof Error?N($):h.validator.length<3&&N()}catch($){N($)}}),E=async(h,b,C)=>{const D=typeof h.transform=="function"?h.transform(b):b,z=p(D);if(h.required&&z)return g(h,C);if(z&&!h.required)return!0;if(h.whitespace&&typeof D=="string"&&D.trim()===""||h.type&&!S(h.type,D)||Array.isArray(h.enum)&&!h.enum.includes(D)||h.pattern&&!new RegExp(h.pattern).test(String(D)))return g(h,C);const N=B(D);return h.len!==void 0&&N!==void 0&&N!==h.len||h.min!==void 0&&N!==void 0&&N<h.min||h.max!==void 0&&N!==void 0&&N>h.max?g(h,C):V(h,D,C)},K=h=>{const b=t();return!h.key||!b.table.column.show.list.includes(h.key)||h.table?.header?.groupKey!==void 0&&!h.table.header.show?!1:h.show?.table!==void 0?w.isFun(h.show?.table,b.table.data):!0},Z=(h,b)=>h.show?.form!==void 0?w.isFun(h.show.form,b,w.EDialog.Update):!0,U=()=>{const h=t(),b=[],C=D=>{D.forEach(z=>{if(K(z)){if(z.children?.length){C(z.children);return}b.push(z)}})};return C(h.table.column.list),b},v=async(h,b)=>{if(!Z(b,h))return u(h,b),!0;const C=s(b,h);if(!C)return!0;u(h,b);const D=Array.isArray(C)?C:[C];for(const z of D){const N=await E(z,h[b.key],b);if(N!==!0)return a[c(h,b)]=N,{field:b.key,error:N}}return!0},H=h=>{const b=[],C=D=>{D.forEach(z=>{b.push(z),Array.isArray(z.children)&&z.children.length&&C(z.children)})};return C(h),b};return{tableEditValidate:{errors:a,clear:l,clearField:u,getFieldError:m,validate:async()=>{if(l(),!n.option.table?.editMode)return!0;const h=t(),b=U(),C=H(h.table.data||[]),z=(await Promise.all(C.flatMap(N=>b.map($=>v(N,$))))).filter(N=>N!==!0);if(z.length)throw j(z),!1;return!0}}}};class ue{static exportToExcel=async(n,a,o)=>{if(!n||n.length===0)return;const i=await w.loadModule("xlsx"),r=n.map(f=>{const s={};return a.forEach(l=>{s[l.label]=f[l.key]}),s}),d=i.utils.json_to_sheet(r),c=i.utils.book_new();i.utils.book_append_sheet(c,d,"Sheet1"),o?typeof o=="function"&&(o=o()):o=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,i.writeFile(c,`${o}.xlsx`)}}const Pe=(t,n)=>({export:{run:{start:async a=>{let i=await t().export.run[a]();const r=n.option.column,d=ObjectUtil.deepMerge({data:i,columns:r},{}),c=n.option.tools?.export||{};c.before?.(d),ue.exportToExcel(d.data,d.columns,c.fileName)},select:async()=>{const a=t();a.export.loading=!0;try{if(n.option.tools?.export?.select){await n.option.tools.export.select({...a.page.getQuery(),items:a.table.selection.list});return}if(a.table.selection.list.length===0)throw w.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return a.table.selection.list}catch(o){console.error(o)}finally{a.export.loading=!1}},page:async()=>{const a=t();a.export.loading=!0;try{if(n.option.tools?.export?.page){await n.option.tools.export.page({...a.page.getQuery()});return}if(a.table.data.length===0)throw w.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return a.table.data}catch(o){console.error(o)}finally{a.export.loading=!1}},all:async()=>{const a=t();a.export.loading=!0;try{if(n.option.tools?.export?.all){await n.option.tools.export.all({...a.page.getQuery()});return}const o=n.option.api.list,i=await o({...a.page.getQuery({size:999999,num:1})});return(i.data||{[x.config.field.result.list]:i})[x.config.field.result.list]}catch(o){console.error(o)}finally{a.export.loading=!1}}},loading:!1,click:a=>{const o=t();o.export.loading||o.export.run.start(a)}}}),Je=(t,n)=>({remove:{title:k.tCurd("deleteTitle"),show:!1,items:[],loading:!1,close:()=>{t().remove.show=!1},open:a=>{if(a.length===0){w.fail(k.tCurd("selectDataToDelete"));return}const o=t();o.remove.items=a,o.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{const a=t();a.remove.loading=!0;const o=n.option.api.delete;try{if(!o)return;await o({[n.option.table?.rowKey]:a.remove.items.map(i=>i[n.option.table?.rowKey]),items:a.remove.items}),w.success(k.tCurd("operationSuccess")),a.table.data.length<=1&&a.page.num>1&&(a.page.num-=1),a.remove.close(),await a.table.getList()}catch(i){console.error(i)}finally{a.remove.loading=!1}})}}}),Qe=(t,n,a)=>({apiDataMap:{},getColumnSpan:(o,i)=>{const r=t(),d=r.update.formGrid?.length?r.update.formGrid:i||[];return ae(o,d,r.update.form,r.update.type,{maxSpan:r.update.formMaxSpan||n.option.form?.maxSpan,defaultSpan:n.option.form?.defaultSpan||x.config.form.defaultSpan})},init:()=>{const o=t();o.initCurdConfig(),o.initColumnOptions(),o.initColumnForm()},initApiData:async o=>{const i=t(),r=[],d=c=>{if(c.children?.length){c.children.forEach(s=>d(s));return}const f=I(c);if(c.options?.[f]?.dataApi&&c.options?.[f]?.dataApiConfig?.[o]){if(i.apiDataMap[c.key]&&c.options?.[f]?.dataApiConfig?.once)return;const s=(async()=>{try{let l=await c.options?.[f]?.dataApi?.(i.update.form,i.update.type);if(l){const u=c.options?.[f]?.dataPath;!Array.isArray(l)&&u&&(l=ObjectUtil.getPathValue(l,u)),c.options[f].data=l,c.options.search[f].data=l,c.options.search[c.options.search.type??f]||(c.options.search[c.options.search.type??f]={}),c.options.search[c.options.search.type??f].data=l,c.options.formAdd[f].data=l,c.options.formUpdate[f].data=l,i.apiDataMap[c.key]=l}}catch{}})();r.push(s)}};return n.option.column.forEach(c=>d(c)),await Promise.all(r),!0},initCurdConfig:()=>{const o=ObjectUtil.deepMerge(x.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 i=ObjectUtil.deepMerge(o,n.option||{});Object.keys(i).forEach(r=>{n.option[r]=i[r]})},initColumnOptions:()=>{const o=t();let i=JSONUtil.cp(x.config.columnConfig);i.options=ObjectUtil.deepMerge({switch:{activeText:k.tCurd("switchOn"),inactiveText:k.tCurd("switchOff")}},i.options);const r=d=>{const c=I(d);for(const s in i){if(s==="table"){if(d.table=ObjectUtil.deepMerge(i.table,d.table||{}),d.children){d.children.forEach(l=>r(l));return}}else s==="type"?d.type=d.type||i.type:d[s]=ObjectUtil.deepMerge(i[s],d[s]||{});d.options=d.options||{},d.options[c]=d.options[c]||{},d.options[c].size=n.option.size.form}["search","formAdd","formUpdate"].forEach(s=>{d.options[s]=ObjectUtil.deepMerge(d.options,d.options[s]||{}),s==="search"?n.option.size.search&&(d.options[s][c].size=n.option.size.search):n.option.size.form&&(d.options[s][c].size=n.option.size.form)}),d.table=ObjectUtil.deepMerge(d.table,d.options[c].table||{}),c==="switch"&&(d.options.switch.tableBeforeChange=async(s,l)=>{const u=d.options?.switch;try{u.tableConfig?.confirm&&await a.switchConfirmRef.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")});try{if(!n.option.api.update&&!u.tableConfig?.api)return;const m=l[n.option.table?.rowKey];u.loadingMap||(u.loadingMap={}),u.loadingMap[m]||(u.loadingMap[m]={loading:!1}),u.loadingMap[m].loading=!0;const g=l[s]===u.activeValue?u.inactiveValue:u.activeValue,p=u.tableConfig?.api?u.tableConfig.api:n.option.api.update;if(!p)return;try{await p({...l,[s]:g},"switch")}catch{return!1}finally{u.loadingMap[m].loading=!1}return w.success(k.tCurd("operationSuccess")),u.tableConfig?.loadList&&(o.table.loading=!0,o.table.getList(),o.table.loading=!1),!0}catch(m){return console.error(m),!1}finally{o.table.loading=!1}}catch{return!1}}),c==="treeSelect"&&(d.options.treeSelect.rowKey=n.option.table?.rowKey,d.options.treeSelect.nodeKey=n.option.table?.rowKey)};n.option.column.forEach(r),n.option.table?.column?.forEach(r)},initColumnForm:()=>{const o=t(),i=n.option;o.update.formColumn=[],o.update.formGrid=[],o.update.formMaxSpan=12,o.table.column.show={list:[],listSource:[]};const r=n.option.form?.maxSpan||12,d=n.option.form?.defaultSpan||r/2,c=fe(n.option.form),f=m=>{if(m.children){o.table.column.show.list.push(m.key),m.children.forEach(g=>f(g));return}o.update.formDefault[m.key]=m.value,m.table?.table&&(m.show?.table&&o.table.column.show.list.push(m.key),o.table.column.show.listSource.push(m.key))};i.column.forEach(m=>{P(m,!0),f(m)}),n.option.table?.column?.forEach(m=>{P(m,!1),f(m)}),o.search.column.list=i.column.concat(i.table?.column||[]),o.table.column.list=o.search.column.list.filter(m=>m.table?.table),o.search.column.list.sort((m,g)=>m.sort?.search-g.sort?.search),o.table.column.list.sort((m,g)=>m.sort?.table-g.sort?.table),o.update.rules={},Y(i.column,o.update.formDefault,o.update.rules,m=>c(m,o.update.form)),i.table?.editMode&&Y(i.table?.column||[],o.update.formDefault,o.update.rules,m=>c(m,o.update.form));const s=de(i.column,{maxSpan:r,defaultSpan:d,layout:n.option.form?.layout});o.update.formGrid=s.cells,o.update.formMaxSpan=s.maxSpan,o.update.formColumn=le(s.cells);const l=n.option.search?.formDefault;l&&Object.keys(l).forEach(m=>{o.search.formDefault[m]=l[m]}),i.column.forEach(m=>{m.show?.search||(o.search.formDefault[m.key]=void 0)});const u=ObjectUtil.deepMerge(o.search.formDefault,{});T.setValue(o.search.form,u,!0)}}),Xe=t=>{const n=e.ref(),a=e.ref(),o=e.ref(),i={switchConfirmRef:n,ruleFormRef:a,tableRef:o},r=e.getCurrentInstance(),d=J.Scope.getConf("curdConf");let c;const f=u=>{u=u||c;let m=u,g=u;for(;m?.parentCurdConf;)g=m.parentCurdConf,m=m.parentCurdConf;return g},s=()=>c;c=e.reactive({parentCurdConf:d,getCurdConf:f,getRootCurdConf:f,...Ie(),option:t.option,...Ke(s,t),...Ge(s,t),...We(s,t,i),...qe(s,t),...Pe(s,t),...De(s,t,i),...Je(s,t),...Qe(s,t,i)}),c.init();const l=r?`curdRef-${r.uid}`:"";return d?.formRef&&l&&(d.formRef.set(l,{validate:async u=>{const m=await c.update.validate(!1);if(u?.(!!m),!m)throw!1;return!0}}),e.onUnmounted(()=>{d.formRef.remove(l)})),e.onMounted(()=>{t.option.init!==!1&&c.table.getList()}),J.Scope.setConf("curdConf",c),{conf:c,switchConfirmRef:n,ruleFormRef:a,tableRef:o}},Ye={class:"dialog-footer"},Ze=e.defineComponent({__name:"switchConfirm",props:{size:{}},setup(t,{expose:n}){const a=e.ref(!1),o=e.ref("确认修改"),i=e.ref("确认要修改状态吗?");let r=null,d=null;const c=l=>(l?.title&&(o.value=l.title),l?.content&&(i.value=l.content),a.value=!0,new Promise((u,m)=>{r=u,d=m})),f=()=>{a.value=!1,r?.(!0),r=null,d=null},s=()=>{a.value=!1,d?.(new Error("用户取消操作")),r=null,d=null};return n({open:c}),(l,u)=>{const m=e.resolveComponent("el-form");return e.openBlock(),e.createBlock(e.unref(y.ElDialog),{modelValue:a.value,"onUpdate:modelValue":u[0]||(u[0]=g=>a.value=g),title:o.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createVNode(m,{size:t.size},{default:e.withCtx(()=>[e.createElementVNode("span",Ye,[e.createVNode(e.unref(y.ElButton),{onClick:s},{default:e.withCtx(()=>[...u[1]||(u[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(y.ElButton),{type:"primary",onClick:f},{default:e.withCtx(()=>[...u[2]||(u[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),_:1},8,["size"])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(i.value),1)]),_:1},8,["modelValue","title"])}}}),ve=["innerHTML"],_e=e.defineComponent({__name:"text",props:{content:{},value:{}},setup(t){const n=t,a=e.computed(()=>typeof n.content=="function"?n.content(n.value):n.content);return(o,i)=>typeof a.value=="object"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{key:0})):(e.openBlock(),e.createElementBlock("div",{key:1,innerHTML:a.value},null,8,ve))}}),he=e.defineComponent({__name:"searchField",props:{item:{},conf:{},type:{}},setup(t){const n=t,a=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,i)=>e.unref(M).customComponent[t.type??""]?.search?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(M).customComponent[t.type??""]?.search),e.mergeProps({key:0,modelValue:a.value,"onUpdate:modelValue":i[0]||(i[0]=r=>a.value=r)},t.item.options?.search?.[t.type??""],e.toHandlers(t.item.options?.search?.[t.type??""]?.on||{})),null,16,["modelValue"])):t.type==="input"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:1,modelValue:a.value,"onUpdate:modelValue":i[1]||(i[1]=r=>a.value=r),placeholder:t.conf.search.getPlaceholder(t.item),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.input||t.item.options?.input,e.toHandlers(t.item.options?.search?.input?.on||t.item.options?.input?.on||{})),null,16,["modelValue","placeholder","disabled"])):t.type==="switch"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:2,modelValue:a.value,"onUpdate:modelValue":i[2]||(i[2]=r=>a.value=r),placeholder:t.conf.search.getPlaceholder(t.item,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.switch||t.item.options?.switch,e.toHandlers(t.item.options?.search?.switch?.on||t.item.options?.switch?.on||{})),{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:t.item.options?.switch?.activeValue,label:t.item.options?.switch?.activeText,value:t.item.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:t.item.options?.switch?.inactiveValue,label:t.item.options?.switch?.inactiveText,value:t.item.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:1},16,["modelValue","placeholder","disabled"])):t.type==="select"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:3,modelValue:a.value,"onUpdate:modelValue":i[3]||(i[3]=r=>a.value=r),placeholder:t.conf.search.getPlaceholder(t.item,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:t.item.disabled?.search},t.item.options?.search?.select||t.item.options?.select,e.toHandlers(t.item.options?.search?.select?.on||t.item.options?.select?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.options?.search?.select?.data||t.item.options?.select?.data||[],r=>(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","placeholder","disabled"])):t.type==="radio"?(e.openBlock(),e.createBlock(e.unref(y.ElRadioGroup),e.mergeProps({key:4,modelValue:a.value,"onUpdate:modelValue":i[4]||(i[4]=r=>a.value=r),disabled:t.item.disabled?.search},t.item.options?.search?.radio||t.item.options?.radio,e.toHandlers(t.item.options?.search?.radio?.on||t.item.options?.radio?.on||{})),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.options?.radio?.data,r=>(e.openBlock(),e.createBlock(e.unref(y.ElRadio),{key:r.value,label:r.label,value:r.value},null,8,["label","value"]))),128))]),_:1},16,["modelValue","disabled"])):t.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(y.ElDatePicker),e.mergeProps({key:5,modelValue:a.value,"onUpdate:modelValue":i[5]||(i[5]=r=>a.value=r),disabled:t.item.disabled?.search},t.item.options?.search?.datetime||t.item.options?.datetime,e.toHandlers(t.item.options?.search?.datetime?.on||t.item.options?.datetime?.on||{})),null,16,["modelValue","disabled"])):t.type&&e.unref(M).customComponent[t.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(M).customComponent[t.type]),e.mergeProps({key:6,modelValue:a.value,"onUpdate:modelValue":i[6]||(i[6]=r=>a.value=r)},t.item.options?.search?.[t.type]||t.item.options?.[t.type],e.toHandlers(t.item.options?.search?.[t.type]?.on||t.item.options?.[t.type]?.on||{}),{disabled:t.item.disabled?.search}),null,16,["modelValue","disabled"])):e.createCommentVNode("",!0)}}),L=(t,n)=>{const a=t.__vccOpts||t;for(const[o,i]of n)a[o]=i;return a},et={},tt={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function ot(t,n){return e.openBlock(),e.createElementBlock("svg",tt,[...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 nt=L(et,[["render",ot]]),at={},rt={xmlns:"http://www.w3.org/2000/svg",viewBox:"64 64 896 896"};function lt(t,n){return e.openBlock(),e.createElementBlock("svg",rt,[...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 it=L(at,[["render",lt]]),dt={},ct={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function st(t,n){return e.openBlock(),e.createElementBlock("svg",ct,[...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 ft=L(dt,[["render",st]]),mt={},gt={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function ut(t,n){return e.openBlock(),e.createElementBlock("svg",gt,[...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 ht=L(mt,[["render",ut]]),yt={},pt={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function bt(t,n){return e.openBlock(),e.createElementBlock("svg",pt,[...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 kt=L(yt,[["render",bt]]),wt={},Ct={"data-v-58697b5c":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function Bt(t,n){return e.openBlock(),e.createElementBlock("svg",Ct,[...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 Vt=L(wt,[["render",Bt]]),Et={class:"row flex-center table-header-label inline"},xt={class:"table-header-tooltip"},St=["innerHTML"],Nt={key:1,class:"table-header-required"},Ft=["onClick"],Dt={key:0,class:"table-edit-form"},zt={key:1},$t=["onClick","innerHTML"],Mt=e.defineComponent({__name:"tableColumn",props:{conf:{},columnList:{},option:{}},setup(t){const n=w.isFun,a=t,i=e.getCurrentInstance().type,r=c=>c===!0?!0:(Array.isArray(c)?c:c?[c]:[]).some(s=>s?.required===!0),d=c=>a.option.table?.editMode?r(c.rules)||r(a.conf.update.rules?.[c.key]):!1;return(c,f)=>{const s=e.resolveComponent("el-tooltip");return e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.columnList,l=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l.key},[t.conf.table.column.show.list.includes(l.key)&&(l.show?.table===void 0||e.unref(n)(l.show?.table,t.conf.table.data))?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l.table?.header?.groupKey===void 0||l.table.header.show?(e.openBlock(),e.createBlock(e.unref(y.ElTableColumn),e.mergeProps({key:0,prop:l.key,label:l.label},{ref_for:!0},l.table),{header:e.withCtx(()=>[e.renderSlot(c.$slots,"table-header-"+l.key,{item:l},()=>[e.createElementVNode("div",Et,[l.table?.header?.tooltip?(e.openBlock(),e.createBlock(s,{key:0,effect:"dark",placement:"top"},{content:e.withCtx(()=>[e.createElementVNode("div",{innerHTML:l.table?.header?.tooltip},null,8,St)]),default:e.withCtx(()=>[e.createElementVNode("span",xt,[e.createVNode(ht)])]),_:2},1024)):e.createCommentVNode("",!0),d(l)?(e.openBlock(),e.createElementBlock("span",Nt,"*")):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(l.label)+" ",1),l.table?.header?.group!==void 0?(e.openBlock(),e.createElementBlock("span",{key:2,class:"table-header-plus",onClick:e.withModifiers(()=>{l.table.header.group=!l.table.header.group,t.columnList.forEach(u=>{u.table?.header?.groupKey===l.key&&(u.table.header.show=!l.table.header.group)})},["stop"])},[l.table.header.group?(e.openBlock(),e.createBlock(kt,{key:0})):(e.openBlock(),e.createBlock(Vt,{key:1}))],8,Ft)):e.createCommentVNode("",!0)])])]),default:e.withCtx(({row:u})=>[l.children?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[f[0]||(f[0]=e.createTextVNode(" ",-1)),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)),{conf:t.conf,columnList:l.children,option:t.option},e.createSlots({_:2},[e.renderList(c.$slots,(m,g)=>({name:g,fn:e.withCtx(p=>[e.renderSlot(c.$slots,g,e.mergeProps({ref_for:!0},p||{}))])}))]),1032,["conf","columnList","option"]))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.option.table?.editMode?(e.openBlock(),e.createElementBlock("div",Dt,[e.createVNode(e.unref(y.ElFormItem),{size:t.option.size?.table,error:t.conf.tableEditValidate.getFieldError(u,l),class:"table-edit-form-item"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["row",["table-edit-"+l.key]]),style:{width:"100%"}},[e.renderSlot(c.$slots,"table-edit-left-"+l.key,{row:u,item:l}),l.type==="input"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:0,modelValue:u[l.key],"onUpdate:modelValue":m=>u[l.key]=m,disabled:t.conf.update.getDisabled(l,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(l),e.toHandlers(t.conf.update.getOn(l,u)),{"onUpdate:modelValue":m=>t.conf.tableEditValidate.clearField(u,l)}),e.createSlots({_:2},[l.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof l.options?.input?.prepend=="function"?l.options?.input?.prepend(u):l.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):l.type==="select"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:1,modelValue:u[l.key],"onUpdate:modelValue":m=>u[l.key]=m,disabled:t.conf.update.getDisabled(l,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(l),e.toHandlers(t.conf.update.getOn(l,u)),{"onUpdate:modelValue":m=>t.conf.tableEditValidate.clearField(u,l)}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options?.search?.select?.data||l.options?.select?.data,m=>(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.type==="switch"?(e.openBlock(),e.createBlock(e.unref(y.ElSwitch),e.mergeProps({key:2,modelValue:u[l.key],"onUpdate:modelValue":m=>u[l.key]=m,disabled:t.conf.update.getDisabled(l,!0),class:"col"},{ref_for:!0},t.conf.update.getBind(l),e.toHandlers(t.conf.update.getOn(l,u)),{"onUpdate:modelValue":m=>t.conf.tableEditValidate.clearField(u,l)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"table-edit-right-"+l.key,{row:u,item:l})],2)]),_:2},1032,["size","error"])])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.conf.update.type===e.unref(w).EDialog.Update&&e.unref(n)(l.show?.form,t.conf.update.form,e.unref(w).EDialog.Update)&&t.option.table?.inlineEdit&&t.conf.update.form[t.option.table?.rowKey]===u[t.option.table?.rowKey]&&(l.type==="input"||l.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[l.type==="input"?(e.openBlock(),e.createBlock(e.unref(y.ElInput),e.mergeProps({key:0,modelValue:t.conf.update.form[l.key],"onUpdate:modelValue":m=>t.conf.update.form[l.key]=m,disabled:t.conf.update.getDisabled(l,!0)},{ref_for:!0},t.conf.update.getBind(l),e.toHandlers(t.conf.update.getOn(l,u)),{style:{width:"100%"}}),e.createSlots({_:2},[l.options?.input?.prepend?{name:"prepend",fn:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(typeof l.options?.input?.prepend=="function"?l.options?.input?.prepend(u):l.options?.input?.prepend),1)]),key:"0"}:void 0]),1040,["modelValue","onUpdate:modelValue","disabled"])):l.type==="select"?(e.openBlock(),e.createBlock(e.unref(y.ElSelect),e.mergeProps({key:1,modelValue:t.conf.update.form[l.key],"onUpdate:modelValue":m=>t.conf.update.form[l.key]=m,disabled:t.conf.update.getDisabled(l,!0)},{ref_for:!0},t.conf.update.getBind(l),e.toHandlers(t.conf.update.getOn(l,u)),{style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options?.search?.select?.data||l.options?.select?.data,m=>(e.openBlock(),e.createBlock(e.unref(y.ElOption),{key:m.value,label:m.label,value:m.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.type==="switch"?(e.openBlock(),e.createBlock(e.unref(y.ElSwitch),e.mergeProps({key:2,modelValue:t.conf.update.form[l.key],"onUpdate:modelValue":m=>t.conf.update.form[l.key]=m},{ref_for:!0},t.conf.update.getBind(l),e.toHandlers(t.conf.update.getOn(l,u)),{disabled:t.conf.update.getDisabled(l,!0)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)],64)):e.renderSlot(c.$slots,"table-"+l.key,{key:1,row:u,item:l},()=>[e.unref(M).customComponent[l.type??""]?.table?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(M).customComponent[l.type??""]?.table),e.mergeProps({key:0,modelValue:u[l.key],"onUpdate:modelValue":m=>u[l.key]=m},{ref_for:!0},l.options?.[l.type??""],e.toHandlers(l.options?.[l.type??""]?.on||{})),null,16,["modelValue","onUpdate:modelValue"])):l.type==="switch"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[l.options?.switch?.tableConfig?.change?(e.openBlock(),e.createBlock(e.unref(y.ElSwitch),e.mergeProps({key:0,modelValue:u[l.key],"onUpdate:modelValue":m=>u[l.key]=m,loading:l.options?.switch?.loadingMap?.[u[t.option.table?.rowKey]]?.loading,"before-change":()=>l.options?.switch?.tableBeforeChange?.(l.key,u)},{ref_for:!0},l.options?.switch),null,16,["modelValue","onUpdate:modelValue","loading","before-change"])):(e.openBlock(),e.createElementBlock("span",zt,e.toDisplayString(u[l.key]===l.options?.switch?.activeValue?l.options?.switch?.activeText:l.options?.switch?.inactiveText),1))],64)):(e.openBlock(),e.createElementBlock("span",{key:2,style:e.normalizeStyle({"--table-text-click-color":l.table?.click?.color}),class:e.normalizeClass({"table-text-click":l.table?.click?.callback}),onClick:m=>l.table?.click?.callback?.(u),innerHTML:l.table?.format?l.table?.format(u):u[l.key]},null,14,$t))])],64))],64))]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],64))),128)}}}),Ot={key:0,class:"relative curd-search fit-width"},Rt={class:"mb-10 flex justify-between items-center fit-width"},Tt={class:"flex items-center",style:{gap:"10px"}},Ut={key:0},At={key:1},Lt={key:2},Ht={class:"export-btn"},jt={key:1,class:"export-btn"},It={class:"flex items-center table-tools-right",style:{gap:"10px"}},Kt={class:"row justify-end mt-10 mb-10 table-bottom-pagination"},Gt={class:"dialog-footer"},Wt={key:0},qt={key:1},Pt={class:"dialog-footer"},ye=e.defineComponent({__name:"index",props:{option:{default:{}},form:{default:void 0},searchForm:{default:void 0}},setup(t,{expose:n}){const a=w.EDialog,o=t,i=w.isFun,{conf:r,switchConfirmRef:d,ruleFormRef:c,tableRef:f}=Xe(o);return n({conf:r}),(s,l)=>{const u=e.resolveComponent("el-tooltip"),m=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["relative cc1-form-box",[t.option.table?.fitHeight?"col":"no-min-height"]])},[e.createElementVNode("div",{class:e.normalizeClass(["row",[t.option.table?.fitHeight?"absolute fit":""]]),style:{overflow:"hidden"}},[e.renderSlot(s.$slots,"box-left"),e.createElementVNode("div",{class:e.normalizeClass(["column fit-width no-wrap",[t.option.table?.fitHeight?"col":""]])},[t.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",Ot,[e.createVNode(e.unref(y.ElForm),{model:e.unref(r).search.form,inline:"",size:t.option.size?.search},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"search-start",{row:e.unref(r).search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(r).search.column.list,g=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g.key},[e.renderSlot(s.$slots,"search-"+g.key+"-start",{row:e.unref(r).search.form}),(typeof g.show?.search=="function"?g.show?.search(e.unref(r).search.form):g.show?.search)?(e.openBlock(),e.createBlock(e.unref(y.ElFormItem),{key:0,label:g.text?.search?.label??g.label},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"search-"+g.key+"-left",{row:e.unref(r).search.form}),e.renderSlot(s.$slots,"search-"+g.key,{row:e.unref(r).search.form},()=>[g.options?.search?.type?(e.openBlock(),e.createBlock(he,{key:0,item:g,conf:e.unref(r),type:g.options.search.type},null,8,["item","conf","type"])):(e.openBlock(),e.createBlock(he,{key:1,item:g,conf:e.unref(r),type:g.type},null,8,["item","conf","type"]))]),e.renderSlot(s.$slots,"search-"+g.key+"-right",{row:e.unref(r).search.form})]),_:2},1032,["label"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"search-"+g.key+"-end",{row:e.unref(r).search.form})],64))),128)),e.renderSlot(s.$slots,"search-center",{row:e.unref(r).search.form}),t.option.tools?.search||t.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(y.ElFormItem),{key:0},{default:e.withCtx(()=>[t.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:0,type:"primary",onClick:e.unref(r).search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),t.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:1,onClick:e.unref(r).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(s.$slots,"search-end",{row:e.unref(r).search.form})]),_:3},8,["model","size"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Rt,[e.createElementVNode("div",Tt,[e.unref(i)(t.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Ut,[e.createVNode(e.unref(y.ElButton),{type:"primary",onClick:l[0]||(l[0]=g=>e.unref(r).update.open(e.unref(a).Add)),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.table?.selectable&&e.unref(i)(t.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",At,[e.createVNode(e.unref(y.ElButton),{type:"danger",onClick:l[1]||(l[1]=g=>e.unref(r).remove.open(e.unref(r).table.selection.list)),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",Lt,[e.createVNode(e.unref(y.ElButton),{type:"warning",onClick:l[2]||(l[2]=g=>e.unref(r).table.expand.all()),size:t.option.size?.search},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1},8,["size"])])):e.createCommentVNode("",!0),t.option.tools?.export?.show?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[t.option.tools?.export?.dropdown?.show?(e.openBlock(),e.createBlock(e.unref(y.ElDropdown),{key:0,onCommand:e.unref(r).export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(y.ElDropdownMenu),{size:t.option.size?.search},{default:e.withCtx(()=>[t.option.tools?.export?.dropdown?.select&&(t.option.table?.selectable||e.unref(i)(t.option.tools?.delete))?(e.openBlock(),e.createBlock(e.unref(y.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),t.option.tools?.export?.dropdown?.page?(e.openBlock(),e.createBlock(e.unref(y.ElDropdownItem),{key:1,command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1})):e.createCommentVNode("",!0),t.option.tools?.export?.dropdown?.all?(e.openBlock(),e.createBlock(e.unref(y.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",Ht,[e.createVNode(e.unref(y.ElButton),{type:"warning",loading:e.unref(r).export.loading,size:t.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",jt,[e.createVNode(e.unref(y.ElButton),{type:"warning",loading:e.unref(r).export.loading,size:t.option.size?.search,onClick:l[3]||(l[3]=g=>e.unref(r).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(s.$slots,"tools-left")]),e.createElementVNode("div",It,[e.renderSlot(s.$slots,"tools-right"),e.unref(r).page.showTools?(e.openBlock(),e.createBlock(e.unref(y.ElPagination),e.mergeProps({key:0,"current-page":e.unref(r).page.num,"onUpdate:currentPage":l[4]||(l[4]=g=>e.unref(r).page.num=g),"page-size":e.unref(r).page.size,"onUpdate:pageSize":l[5]||(l[5]=g=>e.unref(r).page.size=g),background:"","page-sizes":e.unref(r).page.sizeList,"pager-count":e.unref(r).page.pagerCount,layout:e.unref(r).page.layout,total:e.unref(r).page.total,size:t.option.size?.table,onSizeChange:e.unref(r).table.getList,onCurrentChange:e.unref(r).table.getList},t.option.page?.pagination||{},e.toHandlers(t.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0),t.option.tools?.expandColumn===void 0||t.option.tools?.expandColumn?(e.openBlock(),e.createBlock(u,{key:1,effect:"dark",content:e.unref(r).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",[t.option.size?.search]]),onClick:l[6]||(l[6]=(...g)=>e.unref(r).table.header.group.toggleExpandAll&&e.unref(r).table.header.group.toggleExpandAll(...g))},[e.unref(r).table.header.group.expand?(e.openBlock(),e.createBlock(nt,{key:0})):(e.openBlock(),e.createBlock(it,{key:1}))],2)]),_:1},8,["content"])):e.createCommentVNode("",!0),t.option.tools?.refresh===void 0||t.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["refresh-btn",[t.option.size?.search]]),onClick:l[7]||(l[7]=(...g)=>e.unref(r).table.getList&&e.unref(r).table.getList(...g))},[e.createVNode(ft)],2)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",{class:e.normalizeClass(["fit-width relative form-box",[t.option.table?.fitHeight?"col ":"",t.option.table?.editMode?"edit-mode":""]])},[e.createElementVNode("div",{class:e.normalizeClass(["column form-box-content",[t.option.table?.fitHeight?"absolute fit":""]])},[e.withDirectives((e.openBlock(),e.createBlock(e.unref(y.ElTable),e.mergeProps({ref_key:"tableRef",ref:f,data:e.unref(r).table.data,border:t.option.table?.border===void 0?!0:t.option.table?.border,onSelectionChange:e.unref(r).table.selection.change,onSortChange:e.unref(r).table.sort.change,"expand-row-keys":e.unref(r).table.expand.rowKeys,onExpandChange:e.unref(r).table.expand.change},t.option.table,e.toHandlers(t.option.table?.on||{})),{default:e.withCtx(()=>[(typeof t.option.table?.selectable=="object"?t.option.table?.selectable?.show:t.option.table?.selectable)||e.unref(i)(t.option.tools?.delete)||t.option.tools?.export?.show&&t.option.tools?.export?.select?(e.openBlock(),e.createBlock(e.unref(y.ElTableColumn),e.mergeProps({key:0,type:"selection",width:"40",align:"center",fixed:"left","show-overflow-tooltip":!1,className:"cc1-form-selectable-column"},typeof t.option.table?.selectable=="object"?t.option.table?.selectable:{},e.toHandlers(typeof t.option.table?.selectable=="object"?t.option.table?.selectable?.on||{}:{})),null,16)):e.createCommentVNode("",!0),(typeof t.option.table?.index=="object"?t.option.table?.index?.show:t.option.table?.index)?(e.openBlock(),e.createBlock(e.unref(y.ElTableColumn),e.mergeProps({key:1,type:"index",fixed:"left",width:"40",align:"center",label:"#","show-overflow-tooltip":!1,className:"cc1-form-index-column"},typeof t.option.table?.index=="object"?t.option.table?.index:{},e.toHandlers(typeof t.option.table?.index=="object"?t.option.table?.index?.on||{}:{})),null,16)):e.createCommentVNode("",!0),e.createVNode(Mt,{conf:e.unref(r),columnList:e.unref(r).table.column.list,option:t.option},e.createSlots({_:2},[e.renderList(s.$slots,(g,p)=>({name:p,fn:e.withCtx(B=>[e.renderSlot(s.$slots,p,e.normalizeProps(e.guardReactiveProps(B||{})))])}))]),1032,["conf","columnList","option"]),e.unref(i)(t.option.table?.add)||e.unref(i)(t.option.table?.update)||e.unref(i)(t.option.table?.delete)||e.unref(i)(t.option.table?.view)||s.$slots["table-op-left"]||s.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(y.ElTableColumn),e.mergeProps({key:2,align:"center",fixed:"right"},t.option.table?.operate,{width:t.option.table?.operate?.width||120,"show-overflow-tooltip":!1}),{header:e.withCtx(()=>[e.renderSlot(s.$slots,"table-header-op",{},()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("operation")),1)])]),default:e.withCtx(({row:g})=>[e.createVNode(e.unref(y.ElForm),{size:t.option.size?.table},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"table-op-left",{row:g}),e.unref(r).update.type===e.unref(a).Update&&t.option.table?.inlineEdit&&e.unref(r).update.form[o.option.table?.rowKey]===g[o.option.table?.rowKey]?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(y.ElButton),{link:"",type:"info",onClick:e.unref(r).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(y.ElButton),{link:"",type:"primary",onClick:e.unref(r).update.submit,loading:e.unref(r).update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(s.$slots,"table-op-edit-right",{row:g})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.unref(i)(t.option.table?.add,g)?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:0,link:"",type:"primary",onClick:p=>e.unref(r).update.open(e.unref(a).Add,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(t.option.table?.view,g)?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:1,link:"",type:"primary",onClick:p=>e.unref(r).update.open(e.unref(a).View,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("view")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(t.option.table?.update,g)?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:2,link:"",type:"warning",onClick:p=>e.unref(r).update.open(e.unref(a).Update,g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(i)(t.option.table?.delete,g)?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:3,link:"",type:"danger",onClick:p=>e.unref(r).remove.open([g])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"table-op-right",{row:g})],64))]),_:2},1032,["size"])]),_:3},16,["width"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","onSortChange","expand-row-keys","onExpandChange"])),[[m,e.unref(r).table.loading]])],2)],2),e.createElementVNode("div",Kt,[(t.option.page?.show===void 0||t.option.page?.show)&&!e.unref(r).page.showTools?(e.openBlock(),e.createBlock(e.unref(y.ElPagination),e.mergeProps({key:0,"current-page":e.unref(r).page.num,"onUpdate:currentPage":l[8]||(l[8]=g=>e.unref(r).page.num=g),"page-size":e.unref(r).page.size,"onUpdate:pageSize":l[9]||(l[9]=g=>e.unref(r).page.size=g),background:"","page-sizes":e.unref(r).page.sizeList,"pager-count":e.unref(r).page.pagerCount,layout:e.unref(r).page.layout,total:e.unref(r).page.total,size:t.option.size?.table,onSizeChange:e.unref(r).table.getList,onCurrentChange:e.unref(r).table.getList},t.option.page?.pagination||{},e.toHandlers(t.option.page?.pagination?.on||{})),null,16,["current-page","page-size","page-sizes","pager-count","layout","total","size","onSizeChange","onCurrentChange"])):e.createCommentVNode("",!0)])],2),e.renderSlot(s.$slots,"box-right")],2),e.createVNode(e.unref(y.ElDialog),e.mergeProps({modelValue:e.unref(r).update.show,"onUpdate:modelValue":l[10]||(l[10]=g=>e.unref(r).update.show=g),title:e.unref(r).update.title,"before-close":e.unref(r).update.close},t.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",Gt,[e.createVNode(e.unref(y.ElForm),{size:t.option.size?.form},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"dialog-footer",{row:e.unref(r).update},()=>[e.createVNode(e.unref(y.ElButton),{onClick:e.unref(r).update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.unref(r).update.type!==e.unref(a).View?(e.openBlock(),e.createBlock(e.unref(y.ElButton),{key:0,type:"primary",onClick:e.unref(r).update.submit,loading:e.unref(r).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(s.$slots,"dialog-start",{row:e.unref(r).update}),e.createVNode(e.unref(y.ElForm),{ref_key:"ruleFormRef",ref:c,model:e.unref(r).update.form,rules:e.unref(r).update.rules,size:t.option.size?.form,class:"update-dialog-form"},{default:e.withCtx(()=>[e.unref(r).update.showContent?(e.openBlock(),e.createBlock(me,{key:0,"form-grid":e.unref(r).update.formGrid,"max-span":e.unref(r).update.formMaxSpan,form:e.unref(r).update.form,type:e.unref(r).update.type,stripe:t.option.form?.stripe,"label-width":t.option.form?.labelWidth,"form-option":t.option.form,"get-bind":e.unref(r).update.getBind,"get-on":e.unref(r).update.getOn,"get-disabled":e.unref(r).update.getDisabled},e.createSlots({_:2},[e.renderList(s.$slots,(g,p)=>({name:p,fn:e.withCtx(B=>[e.renderSlot(s.$slots,p,e.normalizeProps(e.guardReactiveProps(B||{})))])}))]),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(s.$slots,"dialog-end",{row:e.unref(r).update})]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(y.ElDialog),{modelValue:e.unref(r).remove.show,"onUpdate:modelValue":l[11]||(l[11]=g=>e.unref(r).remove.show=g),title:e.unref(r).remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",Pt,[e.createVNode(e.unref(y.ElForm),{size:t.option.size?.form},{default:e.withCtx(()=>[e.createVNode(e.unref(y.ElButton),{onClick:e.unref(r).remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(y.ElButton),{type:"danger",onClick:e.unref(r).remove.submit,loading:e.unref(r).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(()=>[t.option.dialog?.delete?.content?(e.openBlock(),e.createElementBlock("div",Wt,[e.createVNode(_e,{content:t.option.dialog?.delete?.content,value:e.unref(r).remove.items},null,8,["content","value"])])):(e.openBlock(),e.createElementBlock("div",qt,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",e.unref(r).remove.items.length)),1))]),_:1},8,["modelValue","title"]),e.createVNode(Ze,{ref_key:"switchConfirmRef",ref:d,size:t.option.size?.form},null,8,["size"])],2)}}});class Jt{static async download(n,a="download.png"){const o=document.createElement("a");o.style.display="none",o.href=n,o.setAttribute("download",a),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,a)=>{const o=new Blob([JSON.stringify(n)],{type:"application/json"}),i=URL.createObjectURL(o),r=document.createElement("a");r.href=i,r.download=`${a||"config"}.json`,r.click()};static importFile=async n=>new Promise((a,o)=>{const i=document.createElement("input");i.type="file";const r=n?.accept||".json";i.accept=r,i.style.display="none",i.onchange=d=>{const c=d.target.files[0];if(!c){w.fail("未选择文件"),o("未选择文件");return}const f=new FileReader;f.onload=async s=>{const l=r==".json"?JSON.parse(s.target.result):s.target.result;a(l)},f.onerror=()=>{w.fail("文件读取失败"),o("文件读取失败")},f.readAsText(c),document.body.removeChild(i)},document.body.appendChild(i),i.click()})}const pe=(t,n)=>{if(t.component("TCurd",ye),t.component("TFormList",Q),t.component("TColumn",ge),n?.customComponent){M.customComponent=n.customComponent;for(const a in n.customComponent)t.component(a,n.customComponent[a])}},Qt={install:pe};F.ArrUtil=R,F.ExcelUtil=ue,F.TColumn=ge,F.TCurd=ye,F.TFile=Jt,F.TForm=M,F.TFormConfig=x,F.TFormI18n=k,F.TFormList=Q,F.TSys=w,F.default=Qt,F.install=pe,Object.defineProperties(F,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
@@ -86,10 +86,10 @@ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
86
86
|
label: string;
|
|
87
87
|
row: any;
|
|
88
88
|
value: string;
|
|
89
|
+
field: string;
|
|
89
90
|
itemFields: any[];
|
|
90
91
|
inputWidth: string;
|
|
91
92
|
inputClass: string;
|
|
92
|
-
field: string;
|
|
93
93
|
addBottom: boolean;
|
|
94
94
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
95
95
|
declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -150,10 +150,10 @@ declare const __VLS_component: import("vue").DefineComponent<import("vue").Extra
|
|
|
150
150
|
label: string;
|
|
151
151
|
row: any;
|
|
152
152
|
value: string;
|
|
153
|
+
field: string;
|
|
153
154
|
itemFields: any[];
|
|
154
155
|
inputWidth: string;
|
|
155
156
|
inputClass: string;
|
|
156
|
-
field: string;
|
|
157
157
|
addBottom: boolean;
|
|
158
158
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
159
159
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ValidateLogItem = {
|
|
2
|
+
field: string;
|
|
3
|
+
error: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const printValidateErrors: (errors: ValidateLogItem[]) => void;
|
|
6
|
+
export declare const getErrorMessage: (error: any) => any;
|
|
7
|
+
export declare const normalizeElementValidateFields: (invalidFields: any) => ValidateLogItem[];
|