cc1-form 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ (function(E,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],t):(E=typeof globalThis<"u"?globalThis:E||self,t(E.cc1Form={},E.Vue,E.ElementPlus))})(this,(function(E,t,m){"use strict";class v{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(i,p)=>typeof i=="function"?i(p):i;static getRouterParams=()=>{const i=this.router.currentRoute.value.query||{},p=this.router.currentRoute.value.params||{};return Object.keys(i).length?i:Object.keys(p).length?p:{}};static moduleObj={};static loadModule=async i=>{if(!v.moduleObj[i])throw new Error(`模块${i}未加载,请赋值如:TSys.moduleObj = { ${i}: ()=>import('${i}') }`);const p=await v.moduleObj[i]();return p.default??p};static tipMessages={};static tipMessagesGap=500;static showMessage(i,p,d={}){const u=Date.now();if(!this.tipMessages[i]||u-this.tipMessages[i]>this.tipMessagesGap){this.tipMessages[i]=u;const h=Object.assign({message:i,type:p},d);m.ElMessage(h),setTimeout(()=>{delete this.tipMessages[i]},this.tipMessagesGap)}}static fail=(i,p={})=>{this.showMessage(i,"error",p)};static success=(i,p={})=>{this.showMessage(i,"success",p)};static loadingObj=null;static loadingTimer=null;static loading=(i=!0,p="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{i?this.loadingObj=m.ElLoading.service({lock:!0,text:p,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(i,p=!0)=>{if(p){let d=screen.width/2-500,u=screen.height/2-800/2-30;window.open(i,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+u+", left="+d)}else window.open(i,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=i=>new Promise(async(p,d)=>{let u=document.getElementById(i.id);const h=await v.loadModule("html2canvas");try{h(u,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:i.windowWidth,height:i.windowHeight,windowWidth:i.windowWidth,windowHeight:i.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(f){let c=f.toDataURL("image/png");p(c)})}catch(f){d(f)}});static async download(i,p="download.png"){const d=document.createElement("a");d.style.display="none",d.href=i,d.setAttribute("download",p),typeof d.download>"u"&&d.setAttribute("target","_blank"),document.body.appendChild(d),d.click(),document.body.removeChild(d),window.URL.revokeObjectURL(i)}}class N{static customComponent={};static findOptions=(i,p)=>{const d=i.column.find(h=>h.key===p),u=h=>h.replace(/-([a-z])/g,(f,c)=>c.toUpperCase());if(d)return d.options[u(d.type)]};static setOptionsData=(i,p,d)=>{const u=N.findOptions(i,p);u&&(u.data=d)};static form={openBefore:{parentId:(i,p,d,u)=>{i?p.type===v.EDialog.Insert?(p.form.parentId=i._id,p.form.sort=i.children.length+1):p.form.parentId=i.parentId.substring(i.parentId.lastIndexOf(",")+1):(p.form.parentId="0",p.form.sort=d.length+1),N.setOptionsData(u,"parentId",[{_id:"0",title:"根",children:d}])}}}}const R={class:"row curd-row"},O=t.defineComponent({__name:"column",props:{option:{default:{}}},setup(r,{expose:i}){const p=v.isFun,d=v.EDialog,u=t.ref(),h=r,f=t.reactive({rules:{},show:!1,showContent:!1,loading:!1,type:d.Insert,form:{},formDefault:{},formColumn:[],getDisabled:c=>c.disabled?.[f.type===d.Insert?"create":"update"],initColumnForm:()=>{const c=h.option;f.formColumn=[];const e=[],s=h.option.form?.maxSpan||12,o=h.option.form?.defaultSpan||s;let l=[];const a=n=>{if(f.formDefault[n.key]=n.value,n.isForm){n.form=n.form||{span:o},n.form.span=n.form.span??o;let g=n.form.span,V=l.reduce((C,D)=>C+D.span,g);const k=l.length;l.push({item:n,span:g}),(k===1&&l[0].span===0||V>=s||g===0&&k>1)&&(e.push(l),l=[]),n.rules&&(f.rules[n.key]=n.rules)}};c.column.forEach(n=>{n.isForm=!0,a(n)}),l.length>0&&e.push(l),f.formColumn=e}});return f.initColumnForm(),i({ref:u,conf:f}),(c,e)=>{const s=t.resolveComponent("FormList");return t.openBlock(),t.createBlock(t.unref(m.ElForm),{ref_key:"ruleFormRef",ref:u,model:f.form,rules:f.rules},{default:t.withCtx(()=>[f.showContent?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(f.formColumn,o=>(t.openBlock(),t.createElementBlock("div",R,[t.renderSlot(c.$slots,"form-start",{row:f.form}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o,l=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.unref(p)(l.item.show?.form,f.form)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(l.item.form.span>0?`col-${l.item.form.span}`:"col")},[t.createVNode(t.unref(m.ElFormItem),{label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||"100px"},{default:t.withCtx(()=>[t.renderSlot(c.$slots,"form-"+l.item.key+"-start",{row:f.form,item:l.item}),t.renderSlot(c.$slots,"form-"+l.item.key,{row:f.form,item:l.item},()=>[l.item.type==="input"?(t.openBlock(),t.createBlock(t.unref(m.ElInput),t.mergeProps({key:0,modelValue:f.form[l.item.key],"onUpdate:modelValue":a=>f.form[l.item.key]=a},{ref_for:!0},l.item.options?.input,t.toHandlers(l.item.options?.input?.on),{disabled:f.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(t.openBlock(),t.createBlock(t.unref(m.ElSwitch),t.mergeProps({key:1,modelValue:f.form[l.item.key],"onUpdate:modelValue":a=>f.form[l.item.key]=a},{ref_for:!0},l.item.options?.switch,{disabled:f.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(t.openBlock(),t.createBlock(t.unref(m.ElSelect),t.mergeProps({key:2,modelValue:f.form[l.item.key],"onUpdate:modelValue":a=>f.form[l.item.key]=a},{ref_for:!0},l.item.options?.select,{disabled:f.getDisabled(l.item),style:{width:"100%"}}),{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.item.options?.select?.data,a=>(t.openBlock(),t.createBlock(t.unref(m.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(t.openBlock(),t.createBlock(s,t.mergeProps({key:3,row:f.form,field:l.item.key},{ref_for:!0},l.item.options?.list,{disabled:f.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(t.openBlock(),t.createBlock(t.unref(m.ElTreeSelect),t.mergeProps({key:4,modelValue:f.form[l.item.key],"onUpdate:modelValue":a=>f.form[l.item.key]=a},{ref_for:!0},l.item.options?.treeSelect,{disabled:f.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(t.openBlock(),t.createBlock(t.unref(m.ElDatePicker),t.mergeProps({key:5,modelValue:f.form[l.item.key],"onUpdate:modelValue":a=>f.form[l.item.key]=a},{ref_for:!0},l.item.options?.datetime,{disabled:f.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):t.unref(N).customComponent[l.item.type]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(N).customComponent[l.item.type]),t.mergeProps({key:6,modelValue:f.form[l.item.key],"onUpdate:modelValue":a=>f.form[l.item.key]=a},{ref_for:!0},l.item.options?.[l.item.type],{disabled:f.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):t.createCommentVNode("",!0)]),t.renderSlot(c.$slots,"form-"+l.item.key+"-end",{row:f.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):t.createCommentVNode("",!0)],64))),256)),t.renderSlot(c.$slots,"form-end",{row:f.form})]))),256)):t.createCommentVNode("",!0)]),_:3},8,["model","rules"])}}});class S{static getIdFun=()=>StrUtil.uuid();static setId=(i,p,d)=>{p[i]||(p[i]=[]),p[i].forEach(u=>{d.forEach(h=>{let f=h.default??"";h.type==="number"&&(f=h.default??0),h.type==="boolean"&&(f=h.default??!1),h.type==="time"&&(f=h.default??new Date),u[h.value]===void 0&&(u[h.value]=f)}),u._id||(u._id=S.getIdFun())})};static add=(i,p,d,u)=>{const h=JSONUtil.cp(d);S.setId(i,p,d),p[i].push(h.reduce((f,c)=>{let e=c.default??"";return c.type==="number"&&(e=c.default??0),c.type==="boolean"&&(e=c.default??!1),c.type==="time"&&(e=c.default??new Date),f[c.value]=e,f},{_id:S.getIdFun()})),u?.(p)};static remove=(i,p,d,u)=>{p[i]=p[i].filter(h=>h._id!==d._id),u?.(p)};static getNoIdData=(i,p)=>{const d=JSONUtil.cp(i);return d.forEach(u=>{u._id&&delete u._id,p&&u[p]&&S.getNoIdData(u[p],p)}),d}}const M={key:0,class:"column",style:{width:"100%",gap:"10px"}},z={class:"row items-center",style:{gap:"10px",width:"100%"}},T=t.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:""}},emits:["change"],setup(r,{emit:i}){const p=r,d=t.reactive({show:!1,add:(h,f,c)=>{S.add(h,f,c,()=>{u("change")})},remove:(h,f,c)=>{S.remove(h,f,c,()=>{u("change")})}});t.onMounted(()=>{S.setId(p.field,p.row,p.itemFields),d.show=!0});const u=i;return(h,f)=>{const c=t.resolveComponent("el-button"),e=t.resolveComponent("el-input");return d.show?(t.openBlock(),t.createElementBlock("div",M,[t.renderSlot(h.$slots,"list-start",{row:r.row}),t.createElementVNode("div",null,[t.createVNode(c,{link:"",type:"primary",onClick:f[0]||(f[0]=s=>d.add(r.field,r.row,r.itemFields))},{default:t.withCtx(()=>[...f[2]||(f[2]=[t.createTextVNode("添加",-1)])]),_:1})]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.row[r.field],s=>(t.openBlock(),t.createElementBlock("div",z,[t.renderSlot(h.$slots,"item-start",{item:s,row:r.row}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.itemFields,o=>(t.openBlock(),t.createBlock(e,{modelValue:s[o.value],"onUpdate:modelValue":l=>s[o.value]=l,style:t.normalizeStyle({width:r.inputWidth}),class:t.normalizeClass(r.inputClass),placeholder:o[r.label]||o[r.value],onChange:f[1]||(f[1]=l=>u("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),t.renderSlot(h.$slots,"item-end",{item:s,row:r.row}),t.createVNode(c,{link:"",type:"danger",onClick:o=>d.remove(r.field,r.row,s)},{default:t.withCtx(()=>[...f[3]||(f[3]=[t.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),t.renderSlot(h.$slots,"list-end",{row:r.row})])):t.createCommentVNode("",!0)}}});class I{static exportToExcel=async(i,p,d)=>{const u=await v.loadModule("xlsx"),h=i.map(e=>{const s={};return p.forEach(o=>{s[o.label]=e[o.key]}),s}),f=u.utils.json_to_sheet(h),c=u.utils.book_new();u.utils.book_append_sheet(c,f,"Sheet1"),d?typeof d=="function"&&(d=d()):d=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,u.writeFile(c,`${d}.xlsx`)}}var F={exports:{}},_=F.exports,L;function A(){return L||(L=1,(function(r,i){(function(p,d){d(i,t)})(_,function(p,d){const u="__scopeObjFun";class h{static map={};static get(e,s){const o=h,l=d.getCurrentInstance();return l?(o.map[e]||(o.map[e]={value:s(),refs:new Set}),o.map[e].refs.add(l),d.onUnmounted(()=>{o.map[e]?.refs.delete(l),o.map[e]?.refs.size===0&&delete o.map[e]}),o.map[e].value):s()}}const f=window.Scope||class{static setConf=(c,e)=>{e||typeof c=="string"||(e=c,c="conf");const s=d.getCurrentInstance();let o=e;if(typeof o!="function"&&(o=()=>e),s){let l=s[u];l||(l=[]),l.push({key:c,fun:o}),s[u]=l}};static getConf=(c,e)=>{c?typeof c=="number"&&(e=c,c="conf"):c="conf",e||(e=1);let s=d.getCurrentInstance(),o=0,l=()=>null;for(;s=s.parent;){const a=s[u];if(a)for(let n=0;n<a.length;n++){const g=a[n];if(g.key===c&&(o++,l=g.fun,o===e))return g.fun()}}return l()};static CEventBean=null;static CEventBeanDeactivated=!1;static Event=()=>{if(!this.CEventBean)return null;const c=d.getCurrentInstance(),e=new this.CEventBean;return e.vm=()=>()=>c.isDeactivated?this.CEventBeanDeactivated:!c.isUnmounted,e};static TimerBean=null;static TimerBeanDeactivated="pause";static Timer=()=>{if(!this.TimerBean)return null;const c=new this.TimerBean,e=d.getCurrentInstance();return c.vm=()=>()=>e.isDeactivated?this.TimerBeanDeactivated:!e.isUnmounted,c}};window.TimerBean&&(f.TimerBean=window.TimerBean),window.CEventBean&&(f.CEventBean=window.CEventBean),window.Scope||(window.Scope=f),p.CRouter=class{static init=c=>{const e=c.root||"/src/views";if(!c.modules)throw new Error("modules is required");const s=c.modules,o={},l=c.diffModules||{},a={},n=c.pathHook||(w=>w),g=(w,b)=>{Object.keys(b).forEach(y=>{let x=y.replace(e,"").replace(".vue","");const B=c.mapKeyPathHook?.(x)||y;w[B]={path:n(x),component:b[y],useNum:0}})};g(o,s),g(a,l),((w,b)=>{for(const y in b)y in w||(w[y]=b[y])})(o,a);const V=c.children||[],k=[],C=w=>{const b=Object.keys(o);for(let y=0;y<b.length;y++)if(o[b[y]].path===w)return o[b[y]]};if(V.length){const w=b=>{if(b.children=b.children||[],b.childrenList&&b.childrenList.forEach(x=>{const B=C(x);B&&(b.children.push({path:x,component:B.component}),B.useNum++)}),b.children&&b.children.forEach(x=>{w(x)}),b.component){const x=C(b.component);x&&(b.component=x.component,x.useNum++)}if(b.childrenReg){const x=(y=b.childrenReg,Array.isArray(y)?y.map(B=>B instanceof RegExp?B:new RegExp(B)):y instanceof RegExp?[y]:y?[new RegExp(y)]:[]);Object.keys(o).forEach(B=>{x.some(pt=>pt.test(B))&&(b.children.push({path:B,component:o[B].component}),o[B].useNum++)})}var y};for(let b=0;b<V.length;b++){const y=V[b];w(y),k.push(y)}}Object.keys(o).forEach(w=>{o[w].useNum===0&&k.push({path:w,component:o[w].component})});const D=w=>{w.path=o[w.path].path,c.setInfoHook?.(w),w.children&&w.children.forEach(b=>{D(b)})};k.forEach(w=>{D(w)});const U={};return Object.keys(o).forEach(w=>{U[o[w].path]=o[w]}),{array:k,map:U}}},p.CVue3=class{static onDispose=c=>{const e=d.getCurrentInstance();let s=e.vnode.el?.parentElement?.parentElement,o=!1;const l=setInterval(()=>{if(o)return void clearInterval(l);const a=e.vnode.el?.parentElement?.parentElement;return s===void 0&&(s=a),s&&!a?(clearInterval(l),void c()):void 0},50);d.onUnmounted(()=>{o=!0,c()})};static createCom=c=>{let e=c.domOrIdOrClass||document.body;typeof e=="string"&&(e=document.querySelector(e));const s=(...a)=>{o.unmount(),o=void 0,a.forEach(n=>{n&&e.removeChild(n)}),e.removeChild(l)};c.props||(c.props={}),c.props.remove=s;let o=d.createApp(c.component,c.props);const l=document.createElement("div");return c.beforeMount&&c.beforeMount(o),o.mount(l),c.first?e.insertBefore(l,e.firstChild):e.appendChild(l),{vm:o,remove:s}}},p.Minxins=h,p.Scope=f})})(F,F.exports)),F.exports}var W=A();const H={class:"dialog-footer"},K=t.defineComponent({__name:"switchConfirm",setup(r,{expose:i}){const p=t.ref(!1),d=t.ref("确认修改"),u=t.ref("确认要修改状态吗?");let h=null,f=null;const c=o=>(o?.title&&(d.value=o.title),o?.content&&(u.value=o.content),p.value=!0,new Promise((l,a)=>{h=l,f=a})),e=()=>{p.value=!1,h?.(!0),h=null,f=null},s=()=>{p.value=!1,f?.(new Error("用户取消操作")),h=null,f=null};return i({open:c}),(o,l)=>(t.openBlock(),t.createBlock(t.unref(m.ElDialog),{modelValue:p.value,"onUpdate:modelValue":l[0]||(l[0]=a=>p.value=a),title:d.value,"close-on-click-modal":!1,width:"400px"},{footer:t.withCtx(()=>[t.createElementVNode("span",H,[t.createVNode(t.unref(m.ElButton),{onClick:s},{default:t.withCtx(()=>[...l[1]||(l[1]=[t.createTextVNode("取消",-1)])]),_:1}),t.createVNode(t.unref(m.ElButton),{type:"primary",onClick:e},{default:t.withCtx(()=>[...l[2]||(l[2]=[t.createTextVNode("确认",-1)])]),_:1})])]),default:t.withCtx(()=>[t.createElementVNode("div",null,t.toDisplayString(u.value),1)]),_:1},8,["modelValue","title"]))}}),J={class:"col relative cc1-form-box"},G={class:"absolute row fit",style:{overflow:"hidden"}},X={class:"col column"},Q={key:0,class:"relative curd-search"},Y={class:"mb-20 flex justify-between items-center"},Z={class:"flex items-center",style:{gap:"10px"}},P={key:0},q={key:1},$={key:2},tt={class:"export-btn"},et={class:"flex items-center",style:{gap:"10px"}},ot={class:"col fit-width relative"},lt={class:"absolute column fit"},at={class:"row justify-end mt-20 mb-20"},nt={class:"row curd-row"},st={class:"dialog-footer"},dt={class:"dialog-footer"},j=t.defineComponent({__name:"index",props:{option:{default:{}}},setup(r,{expose:i}){const p=v.EDialog,d=r,u=t.ref(),h=t.ref(),f=W.Scope.Timer(),c=v.isFun,e=t.reactive({search:{column:{list:[]},form:{},formDefault:{},getFormData:()=>{let s={};d.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(e.search.form):l.show?.search)&&(s[l.key]=e.search.form[l.key])});const o=d.option.search?.before?.(s);return o&&(s=o),s},reset:()=>{const s=e.search.formDefault;Object.keys(s).forEach(o=>{d.option.search?.resetMode==="default"?s[o]=e.search.formDefault[o]:s[o]=void 0}),e.search.form=JSONUtil.cp(s),e.page.num=1,e.table.getList()},submit:()=>{e.page.num=1,e.table.getList()}},page:{size:d.option.page?.size||10,sizeList:d.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:d.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(s,o)=>{},all:()=>{if(e.table.expand.isExpand)e.table.expand.rowKeys=[];else{const s=o=>{let l=[];return o.forEach(a=>{l.push(a._id),a.children&&a.children.length>0&&(l=l.concat(s(a.children)))}),l};e.table.expand.rowKeys=s(e.table.data)}e.table.expand.isExpand=!e.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{e.table.loading=!0;const s=d.option.api.list,o=await s({size:e.page.size,num:e.page.num,...e.search.getFormData(),final(n,g,V){e.table.loading=!1}}),l=o.data||{list:o};let a=Array.isArray(l.list)?l.list:l;e.table.data=d.option.data?await d.option.data(a):a,e.page.total=l.total||0},selection:{list:[],change:s=>{e.table.selection.list=s}},exportFun:{start:async s=>{let o=await e.table.exportFun[s](),l=d.option.column;const a=JSONUtil.cp({data:o,columns:l}),n=d.option.tools?.export||{};n.before&&n.before(a),I.exportToExcel(a.data,a.columns,n.fileName)},select:()=>{if(e.table.selection.list.length===0)throw v.fail("请选择要导出的数据"),new Error("请选择要导出的数据");return e.table.selection.list},page:()=>{if(e.table.data.length===0)throw v.fail("暂无数据"),new Error("暂无数据");return e.table.data},all:async()=>{e.table.loading=!0;const s=d.option.api.list,{data:o}=await s({size:999999,num:1,final(l,a,n){e.table.loading=!1}});return o.list}},export:s=>{e.table.exportFun.start(s)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:p.Insert,form:{},formDefault:{},formColumn:[],getDisabled:s=>s.disabled?.[e.update.type===p.Insert?"create":"update"],edit:{data:{},getApiData:s=>{if(d.option.form?.editAll)return s;let o={_id:e.update.edit.data._id};return Object.keys(e.update.edit.data).forEach(l=>{s[l]!==e.update.edit.data[l]&&(o[l]=s[l])}),o}},open:(s,o)=>{e.update.showContent||FunUtil.throttle(async()=>{e.update.type=s;const l=s===p.Insert;e.update.edit.data=o,e.update.title=l?"新增":"编辑",e.update.form=JSONUtil.cp(l?e.update.formDefault:o),await d.option.form?.openBefore?.(o,e.update),e.update.show=!0,e.update.showContent=!0,d.option.form?.openAfter?.(o,e.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,a)=>new Promise((n,g)=>{l||(v.fail("请检查表单数据"),g(!1)),n()})),e.update.loading=!0;const s=e.update.type===p.Insert?d.option.api.create:d.option.api.update;let o=JSONUtil.cp(e.update.form);delete o.children,await d.option.form?.submitBefore?.(o,e.update),Object.keys(o).forEach(l=>{if(typeof o[l]=="string"&&o[l].indexOf("T")>-1){const a=new Date(o[l]).getTime();!isNaN(a)&&a>new Date("1971-01-01").getTime()&&(o[l]=a)}}),await s({...o,final(l,a,n){e.update.loading=!1}}),e.update.close(),await e.table.getList(),d.option.form?.submitAfter?.(o,e.update)})},close:()=>{e.update.show=!1,f.once(()=>{e.update.showContent=!1},350)}},remove:{title:"确认删除",show:!1,items:[],loading:!1,close:()=>{e.remove.show=!1},open:s=>{if(s.length===0){v.fail("请选择要删除的数据");return}e.remove.items=s,e.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{e.table.loading=!0;const s=d.option.api.delete;await s({_id:e.remove.items.map(o=>o._id),final(o,l,a){e.table.loading=!1}}),v.success("操作成功"),e.table.data.length<=1&&e.page.num>1&&(e.page.num-=1),e.remove.close(),await e.table.getList()})}},init:()=>{e.initCurdConfig(),e.initColumnOptions(),e.initColumnForm()},initCurdConfig:()=>{const o={tools:{search:!0,reset:!0,expand:!1,add:a=>a===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:"_id",emptyText:"暂无数据",highlightCurrentRow:!0}},l=d.option;Object.keys(o).forEach(a=>{l[a]=ObjectUtil.deepMerge(o[a],l[a]||{})})},initColumnOptions:()=>{const s=d.option,o=l=>{const n={options:{switch:{activeValue:!0,activeLabel:"开启",inactiveValue:!1,inactiveLabel:"关闭",tableBeforeChange:async(V,k)=>{const C=l.options?.switch;try{return await u.value?.open({title:"确认修改",content:`确认要${k[V]===C.activeValue?C.inactiveLabel:C.activeLabel}吗?`}),e.table.loading=!0,await d.option.api.update({_id:k._id,[V]:k[V]===C.activeValue?C.inactiveValue:C.activeValue,final(D,U,w){e.table.loading=!1}}),v.success("操作成功"),e.table.getList(),!0}catch{return!1}}},treeSelect:{rowKey:"_id",nodeKey:"_id",multiple:!0,renderAfterExpand:!1,showCheckbox:!0,checkStrictly:!0,checkOnClickNode:!0,props:{label:"title",children:"children"}},datetime:{type:"datetime"}},table:{table:!0,minWidth:"100px",align:"center"},show:{table:!0,search:!1,form:!0},sort:{search:0,table:0,form:0}},g=l;Object.keys(n).forEach(V=>{g[V]=ObjectUtil.deepMerge(n[V],g[V]||{})})};s.column.forEach(o),s.table?.column?.forEach(o)},initColumnForm:()=>{const s=d.option;e.update.formColumn=[],e.table.column.show={list:[],listSource:[]};const o=[],l=d.option.form?.maxSpan||12,a=d.option.form?.defaultSpan||l/2;let n=[];const g=k=>{if(e.update.formDefault[k.key]=k.value,k.table.table&&(k.show.table&&e.table.column.show.list.push(k.key),k.table.table&&e.table.column.show.listSource.push(k.key)),k.isForm){k.form=k.form||{span:a},k.form.span=k.form.span??a;let C=k.form.span,D=n.reduce((w,b)=>w+b.span,C);const U=n.length;n.push({item:k,span:C}),(U===1&&n[0].span===0||D>=l||C===0&&U>1)&&(o.push(n),n=[]),k.rules&&(e.update.rules[k.key]=k.rules)}};s.column.forEach(k=>{k.isForm=!0,g(k)}),d.option.table?.column?.forEach(k=>{k.isForm=!1,g(k)}),e.search.column.list=s.column.concat(s.table?.column||[]),e.table.column.list=e.search.column.list.filter(k=>k.table?.table),e.search.column.list.sort((k,C)=>k.sort?.search-C.sort?.search),e.table.column.list.sort((k,C)=>k.sort?.table-C.sort?.table),n.length>0&&o.push(n),e.update.formColumn=o;const V=d.option.search?.formDefault;V&&Object.keys(V).forEach(k=>{e.search.formDefault[k]=V[k]}),s.column.forEach(k=>{k.show?.search||(e.search.formDefault[k.key]=void 0)}),e.search.form=JSONUtil.cp(e.search.formDefault)}});return e.init(),t.onMounted(()=>{e.table.getList()}),i({conf:e}),(s,o)=>{const l=t.resolveDirective("loading");return t.openBlock(),t.createElementBlock("div",J,[t.createElementVNode("div",G,[t.renderSlot(s.$slots,"box-left"),t.createElementVNode("div",X,[r.option.search?.show!==!1?(t.openBlock(),t.createElementBlock("div",Q,[t.createVNode(t.unref(m.ElForm),{model:e.search.form,inline:""},{default:t.withCtx(()=>[t.renderSlot(s.$slots,"search-start",{row:e.search.form}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.search.column.list,a=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:a.key},[(typeof a.show?.search=="function"?a.show?.search(e.search.form):a.show?.search)?(t.openBlock(),t.createBlock(t.unref(m.ElFormItem),{key:0,label:a.label},{default:t.withCtx(()=>[t.renderSlot(s.$slots,"search-"+a.key,{row:e.search.form},()=>[a.type==="input"?(t.openBlock(),t.createBlock(t.unref(m.ElInput),{key:0,modelValue:e.search.form[a.key],"onUpdate:modelValue":n=>e.search.form[a.key]=n,placeholder:`请输入${a.label}`,clearable:"",disabled:a.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="switch"?(t.openBlock(),t.createBlock(t.unref(m.ElSelect),{key:1,modelValue:e.search.form[a.key],"onUpdate:modelValue":n=>e.search.form[a.key]=n,placeholder:`请选择${a.label}`,clearable:"",disabled:a.disabled?.search},{default:t.withCtx(()=>[(t.openBlock(),t.createBlock(t.unref(m.ElOption),{key:a.options?.switch?.activeValue,label:a.options?.switch?.activeLabel,value:a.options?.switch?.activeValue},null,8,["label","value"])),(t.openBlock(),t.createBlock(t.unref(m.ElOption),{key:a.options?.switch?.inactiveValue,label:a.options?.switch?.inactiveLabel,value:a.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):a.type==="select"?(t.openBlock(),t.createBlock(t.unref(m.ElSelect),{key:2,modelValue:e.search.form[a.key],"onUpdate:modelValue":n=>e.search.form[a.key]=n,placeholder:`请选择${a.label}`,clearable:"",disabled:a.disabled?.search},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.options?.select?.data,n=>(t.openBlock(),t.createBlock(t.unref(m.ElOption),{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):t.createCommentVNode("",!0)])]),_:2},1032,["label"])):t.createCommentVNode("",!0)],64))),128)),t.renderSlot(s.$slots,"search-center",{row:e.search.form}),t.createVNode(t.unref(m.ElFormItem),null,{default:t.withCtx(()=>[r.option.tools?.search?(t.openBlock(),t.createBlock(t.unref(m.ElButton),{key:0,type:"primary",onClick:e.search.submit},{default:t.withCtx(()=>[...o[7]||(o[7]=[t.createTextVNode(" 搜索 ",-1)])]),_:1},8,["onClick"])):t.createCommentVNode("",!0),r.option.tools?.reset?(t.openBlock(),t.createBlock(t.unref(m.ElButton),{key:1,onClick:e.search.reset},{default:t.withCtx(()=>[...o[8]||(o[8]=[t.createTextVNode("重置",-1)])]),_:1},8,["onClick"])):t.createCommentVNode("",!0)]),_:1}),t.renderSlot(s.$slots,"search-end",{row:e.search.form})]),_:3},8,["model"])])):t.createCommentVNode("",!0),t.createElementVNode("div",Y,[t.createElementVNode("div",Z,[t.unref(c)(r.option.tools?.add)?(t.openBlock(),t.createElementBlock("div",P,[t.createVNode(t.unref(m.ElButton),{type:"primary",onClick:o[0]||(o[0]=a=>e.update.open(t.unref(p).Insert))},{default:t.withCtx(()=>[...o[9]||(o[9]=[t.createTextVNode("新增",-1)])]),_:1})])):t.createCommentVNode("",!0),r.option.table?.selectable&&t.unref(c)(r.option.tools?.delete)?(t.openBlock(),t.createElementBlock("div",q,[t.createVNode(t.unref(m.ElButton),{type:"danger",onClick:o[1]||(o[1]=a=>e.remove.open(e.table.selection.list))},{default:t.withCtx(()=>[...o[10]||(o[10]=[t.createTextVNode(" 删除 ",-1)])]),_:1})])):t.createCommentVNode("",!0),r.option.tools?.expand?(t.openBlock(),t.createElementBlock("div",$,[t.createVNode(t.unref(m.ElButton),{type:"warning",onClick:o[2]||(o[2]=a=>e.table.expand.all())},{default:t.withCtx(()=>[...o[11]||(o[11]=[t.createTextVNode("展开/收缩",-1)])]),_:1})])):t.createCommentVNode("",!0),r.option.tools?.export?.show?(t.openBlock(),t.createBlock(t.unref(m.ElDropdown),{key:3,onCommand:e.table.export},{dropdown:t.withCtx(()=>[t.createVNode(t.unref(m.ElDropdownMenu),null,{default:t.withCtx(()=>[t.createVNode(t.unref(m.ElDropdownItem),{command:"select"},{default:t.withCtx(()=>[...o[13]||(o[13]=[t.createTextVNode("导出选中",-1)])]),_:1}),t.createVNode(t.unref(m.ElDropdownItem),{command:"page"},{default:t.withCtx(()=>[...o[14]||(o[14]=[t.createTextVNode("导出本页",-1)])]),_:1}),t.createVNode(t.unref(m.ElDropdownItem),{command:"all"},{default:t.withCtx(()=>[...o[15]||(o[15]=[t.createTextVNode("导出全部",-1)])]),_:1})]),_:1})]),default:t.withCtx(()=>[t.createElementVNode("div",tt,[t.createVNode(t.unref(m.ElButton),{type:"warning"},{default:t.withCtx(()=>[...o[12]||(o[12]=[t.createTextVNode("导出",-1)])]),_:1})])]),_:1},8,["onCommand"])):t.createCommentVNode("",!0),t.renderSlot(s.$slots,"tools-left")]),t.createElementVNode("div",et,[t.renderSlot(s.$slots,"tools-right")])]),t.createElementVNode("div",ot,[t.createElementVNode("div",lt,[t.withDirectives((t.openBlock(),t.createBlock(t.unref(m.ElTable),t.mergeProps({data:e.table.data},r.option.table,{onSelectionChange:e.table.selection.change,"expand-row-keys":e.table.expand.rowKeys,onExpandChange:e.table.expand.change}),{default:t.withCtx(()=>[r.option.table?.selectable&&t.unref(c)(r.option.tools?.delete)?(t.openBlock(),t.createBlock(t.unref(m.ElTableColumn),{key:0,type:"selection",selectable:typeof r.option.table?.selectable=="function"?r.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.table.column.list,a=>(t.openBlock(),t.createElementBlock(t.Fragment,{key:a.key},[e.table.column.show.list.includes(a.key)?(t.openBlock(),t.createBlock(t.unref(m.ElTableColumn),t.mergeProps({key:0,prop:a.key,label:a.label},{ref_for:!0},a.table),{default:t.withCtx(({row:n})=>[t.renderSlot(s.$slots,"table-"+a.key,{row:n,item:a},()=>[a.type==="switch"?(t.openBlock(),t.createBlock(t.unref(m.ElSwitch),t.mergeProps({key:0,modelValue:n[a.key],"onUpdate:modelValue":g=>n[a.key]=g,"before-change":()=>a.options?.switch?.tableBeforeChange?.(a.key,n)},{ref_for:!0},a.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createTextVNode(t.toDisplayString(n[a.key]),1)],64))])]),_:2},1040,["prop","label"])):t.createCommentVNode("",!0)],64))),128)),t.unref(c)(r.option.tools?.add)||t.unref(c)(r.option.tools?.update)||t.unref(c)(r.option.tools?.delete)||s.$slots["table-op-left"]||s.$slots["table-op-right"]?(t.openBlock(),t.createBlock(t.unref(m.ElTableColumn),{key:1,label:"操作",width:"180",align:"center",fixed:"right"},{default:t.withCtx(({row:a})=>[t.renderSlot(s.$slots,"table-op-left",{row:a}),t.unref(c)(r.option.tools?.add,a)?(t.openBlock(),t.createBlock(t.unref(m.ElButton),{key:0,link:"",type:"primary",onClick:n=>e.update.open(t.unref(p).Insert,a)},{default:t.withCtx(()=>[...o[16]||(o[16]=[t.createTextVNode(" 新增 ",-1)])]),_:1},8,["onClick"])):t.createCommentVNode("",!0),t.unref(c)(r.option.tools?.update,a)?(t.openBlock(),t.createBlock(t.unref(m.ElButton),{key:1,link:"",type:"warning",onClick:n=>e.update.open(t.unref(p).Update,a)},{default:t.withCtx(()=>[...o[17]||(o[17]=[t.createTextVNode(" 编辑 ",-1)])]),_:1},8,["onClick"])):t.createCommentVNode("",!0),t.unref(c)(r.option.tools?.delete,a)?(t.openBlock(),t.createBlock(t.unref(m.ElButton),{key:2,link:"",type:"danger",onClick:n=>e.remove.open([a])},{default:t.withCtx(()=>[...o[18]||(o[18]=[t.createTextVNode(" 删除 ",-1)])]),_:1},8,["onClick"])):t.createCommentVNode("",!0),t.renderSlot(s.$slots,"table-op-right",{row:a})]),_:3})):t.createCommentVNode("",!0)]),_:3},16,["data","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,e.table.loading]])])]),t.createElementVNode("div",at,[e.page.total>e.page.size?(t.openBlock(),t.createBlock(t.unref(m.ElPagination),{key:0,"current-page":e.page.num,"onUpdate:currentPage":o[3]||(o[3]=a=>e.page.num=a),"page-size":e.page.size,"onUpdate:pageSize":o[4]||(o[4]=a=>e.page.size=a),background:"","page-sizes":e.page.sizeList,"pager-count":7,layout:e.page.layout,total:e.page.total,onSizeChange:e.table.getList,onCurrentChange:e.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])):t.createCommentVNode("",!0)])]),t.renderSlot(s.$slots,"box-right")]),t.createVNode(t.unref(m.ElDialog),t.mergeProps({modelValue:e.update.show,"onUpdate:modelValue":o[5]||(o[5]=a=>e.update.show=a),title:e.update.title,"close-on-click-modal":!1,"before-close":e.update.close},r.option.dialog),{footer:t.withCtx(()=>[t.createElementVNode("span",st,[t.createVNode(t.unref(m.ElButton),{onClick:e.update.close},{default:t.withCtx(()=>[...o[19]||(o[19]=[t.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),t.createVNode(t.unref(m.ElButton),{type:"primary",onClick:e.update.submit,loading:e.update.loading},{default:t.withCtx(()=>[...o[20]||(o[20]=[t.createTextVNode(" 提交 ",-1)])]),_:1},8,["onClick","loading"])])]),default:t.withCtx(()=>[t.createVNode(t.unref(m.ElForm),{ref_key:"ruleFormRef",ref:h,model:e.update.form,rules:e.update.rules},{default:t.withCtx(()=>[e.update.showContent?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(e.update.formColumn,a=>(t.openBlock(),t.createElementBlock("div",nt,[t.renderSlot(s.$slots,"form-start",{row:e.update.form}),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a,n=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.unref(c)(n.item.show?.form,e.update.form)?(t.openBlock(),t.createElementBlock("div",{key:0,class:t.normalizeClass(n.item.form.span>0?`col-${n.item.form.span}`:"col")},[t.createVNode(t.unref(m.ElFormItem),{label:n.item.label,prop:n.item.key,"label-width":n.item.form?.labelWidth||"100px"},{default:t.withCtx(()=>[t.renderSlot(s.$slots,"form-"+n.item.key+"-start",{row:e.update.form,item:n.item}),t.renderSlot(s.$slots,"form-"+n.item.key,{row:e.update.form,item:n.item},()=>[n.item.type==="input"?(t.openBlock(),t.createBlock(t.unref(m.ElInput),t.mergeProps({key:0,modelValue:e.update.form[n.item.key],"onUpdate:modelValue":g=>e.update.form[n.item.key]=g},{ref_for:!0},n.item.options?.input,t.toHandlers(n.item.options?.input?.on),{disabled:e.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="switch"?(t.openBlock(),t.createBlock(t.unref(m.ElSwitch),t.mergeProps({key:1,modelValue:e.update.form[n.item.key],"onUpdate:modelValue":g=>e.update.form[n.item.key]=g},{ref_for:!0},n.item.options?.switch,{disabled:e.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="select"?(t.openBlock(),t.createBlock(t.unref(m.ElSelect),t.mergeProps({key:2,modelValue:e.update.form[n.item.key],"onUpdate:modelValue":g=>e.update.form[n.item.key]=g},{ref_for:!0},n.item.options?.select,{disabled:e.update.getDisabled(n.item),style:{width:"100%"}}),{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(n.item.options?.select?.data,g=>(t.openBlock(),t.createBlock(t.unref(m.ElOption),{key:g.value,label:g.label,value:g.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="list"?(t.openBlock(),t.createBlock(T,t.mergeProps({key:3,row:e.update.form,field:n.item.key},{ref_for:!0},n.item.options?.list,{disabled:e.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):n.item.type==="tree-select"?(t.openBlock(),t.createBlock(t.unref(m.ElTreeSelect),t.mergeProps({key:4,modelValue:e.update.form[n.item.key],"onUpdate:modelValue":g=>e.update.form[n.item.key]=g},{ref_for:!0},n.item.options?.treeSelect,{disabled:e.update.getDisabled(n.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):n.item.type==="datetime"?(t.openBlock(),t.createBlock(t.unref(m.ElDatePicker),t.mergeProps({key:5,modelValue:e.update.form[n.item.key],"onUpdate:modelValue":g=>e.update.form[n.item.key]=g},{ref_for:!0},n.item.options?.datetime,{disabled:e.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):t.unref(N).customComponent[n.item.type]?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(N).customComponent[n.item.type]),t.mergeProps({key:6,modelValue:e.update.form[n.item.key],"onUpdate:modelValue":g=>e.update.form[n.item.key]=g},{ref_for:!0},n.item.options?.[n.item.type],{disabled:e.update.getDisabled(n.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):t.createCommentVNode("",!0)]),t.renderSlot(s.$slots,"form-"+n.item.key+"-end",{row:e.update.form,item:n.item})]),_:2},1032,["label","prop","label-width"])],2)):t.createCommentVNode("",!0)],64))),256)),t.renderSlot(s.$slots,"form-end",{row:e.update.form})]))),256)):t.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),t.createVNode(t.unref(m.ElDialog),{modelValue:e.remove.show,"onUpdate:modelValue":o[6]||(o[6]=a=>e.remove.show=a),title:e.remove.title,"close-on-click-modal":!1},{footer:t.withCtx(()=>[t.createElementVNode("span",dt,[t.createVNode(t.unref(m.ElButton),{onClick:e.remove.close},{default:t.withCtx(()=>[...o[21]||(o[21]=[t.createTextVNode("关闭",-1)])]),_:1},8,["onClick"]),t.createVNode(t.unref(m.ElButton),{type:"danger",onClick:e.remove.submit,loading:e.remove.loading},{default:t.withCtx(()=>[...o[22]||(o[22]=[t.createTextVNode(" 确认删除 ",-1)])]),_:1},8,["onClick","loading"])])]),default:t.withCtx(()=>[t.createElementVNode("div",null,"确认要删除【"+t.toDisplayString(e.remove.items.length)+"】条数据吗?",1)]),_:1},8,["modelValue","title"]),t.createVNode(K,{ref_key:"switchConfirmRef",ref:u},null,512)])}}}),ct=(r,i)=>{if(r.component("TCurd",j),r.component("TFormList",T),r.component("TColumn",O),i?.customComponent){N.customComponent=i.customComponent;for(const p in i.customComponent)r.component(p,i.customComponent[p])}};E.ArrUtil=S,E.ExcelUtil=I,E.TColumn=O,E.TCurd=j,E.TForm=N,E.TFormList=T,E.TSys=v,E.install=ct,Object.defineProperty(E,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,7 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {
2
+ open: (options?: {
3
+ title?: string;
4
+ content?: string;
5
+ }) => Promise<boolean>;
6
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
+ export default _default;
@@ -0,0 +1,443 @@
1
+ import TForm from '../../../../utils/TForm';
2
+ import { type FormInstance, ElDatePicker, ElForm, ElFormItem, ElInput, ElOption, ElSelect, ElSwitch, ElTreeSelect } from 'element-plus';
3
+ import { type CurdConfigColumn } from '../../index';
4
+ declare const isFun: (fun: any, data?: any) => any;
5
+ declare const ruleFormRef: import("vue").Ref<FormInstance | undefined, FormInstance | undefined>;
6
+ declare const conf: {
7
+ rules: any;
8
+ show: boolean;
9
+ showContent: boolean;
10
+ loading: boolean;
11
+ type: any;
12
+ form: any;
13
+ formDefault: any;
14
+ formColumn: {
15
+ item: {
16
+ key: string;
17
+ label: string;
18
+ value: any;
19
+ disabled?: {
20
+ create?: boolean | undefined;
21
+ update?: boolean | undefined;
22
+ search?: boolean | undefined;
23
+ } | undefined;
24
+ options?: {
25
+ [x: string]: any;
26
+ input?: Record<string, any> | undefined;
27
+ switch?: {
28
+ activeValue: any;
29
+ activeLabel: string;
30
+ inactiveValue: any;
31
+ inactiveLabel: string;
32
+ tableBeforeChange: (key: string, data: any) => any;
33
+ } | undefined;
34
+ select?: Record<string, any> | undefined;
35
+ treeSelect?: Record<string, any> | undefined;
36
+ datetime?: Record<string, any> | undefined;
37
+ list?: {
38
+ label?: string | undefined;
39
+ value?: string | undefined;
40
+ itemFields?: ({
41
+ [x: string]: string;
42
+ label: string;
43
+ value: string;
44
+ } | undefined)[] | undefined;
45
+ inputWidth?: string | undefined;
46
+ inputClass?: string | undefined;
47
+ } | undefined;
48
+ } | undefined;
49
+ form?: {
50
+ labelWidth?: string | undefined;
51
+ width?: string | undefined;
52
+ span?: number | undefined;
53
+ } | undefined;
54
+ type: "input" | "select" | "switch" | "textarea" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list";
55
+ table?: {
56
+ table?: boolean | undefined;
57
+ minWidth?: string | undefined;
58
+ width?: string | undefined;
59
+ fixed?: "left" | "right" | undefined;
60
+ align?: "left" | "right" | "center" | undefined;
61
+ showOverflowTooltip?: boolean | undefined;
62
+ } | undefined;
63
+ rules?: any[] | undefined;
64
+ show?: {
65
+ table?: boolean | undefined;
66
+ search?: boolean | ((data: any) => boolean) | undefined;
67
+ form?: boolean | ((data: any) => boolean) | undefined;
68
+ } | undefined;
69
+ sort?: {
70
+ search?: number | undefined;
71
+ table?: number | undefined;
72
+ } | undefined;
73
+ };
74
+ span: number;
75
+ }[][];
76
+ getDisabled: (item: CurdConfigColumn) => boolean | undefined;
77
+ initColumnForm: () => void;
78
+ };
79
+ declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
80
+ declare var __VLS_7: {
81
+ row: any;
82
+ }, __VLS_14: string, __VLS_15: {
83
+ row: any;
84
+ item: {
85
+ key: string;
86
+ label: string;
87
+ value: any;
88
+ disabled?: {
89
+ create?: boolean | undefined;
90
+ update?: boolean | undefined;
91
+ search?: boolean | undefined;
92
+ } | undefined;
93
+ options?: {
94
+ [x: string]: any;
95
+ input?: Record<string, any> | undefined;
96
+ switch?: {
97
+ activeValue: any;
98
+ activeLabel: string;
99
+ inactiveValue: any;
100
+ inactiveLabel: string;
101
+ tableBeforeChange: (key: string, data: any) => any;
102
+ } | undefined;
103
+ select?: Record<string, any> | undefined;
104
+ treeSelect?: Record<string, any> | undefined;
105
+ datetime?: Record<string, any> | undefined;
106
+ list?: {
107
+ label?: string | undefined;
108
+ value?: string | undefined;
109
+ itemFields?: ({
110
+ [x: string]: string;
111
+ label: string;
112
+ value: string;
113
+ } | undefined)[] | undefined;
114
+ inputWidth?: string | undefined;
115
+ inputClass?: string | undefined;
116
+ } | undefined;
117
+ } | undefined;
118
+ form?: {
119
+ labelWidth?: string | undefined;
120
+ width?: string | undefined;
121
+ span?: number | undefined;
122
+ } | undefined;
123
+ type: "input" | "select" | "switch" | "textarea" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list";
124
+ table?: {
125
+ table?: boolean | undefined;
126
+ minWidth?: string | undefined;
127
+ width?: string | undefined;
128
+ fixed?: "left" | "right" | undefined;
129
+ align?: "left" | "right" | "center" | undefined;
130
+ showOverflowTooltip?: boolean | undefined;
131
+ } | undefined;
132
+ rules?: any[] | undefined;
133
+ show?: {
134
+ table?: boolean | undefined;
135
+ search?: boolean | ((data: any) => boolean) | undefined;
136
+ form?: boolean | ((data: any) => boolean) | undefined;
137
+ } | undefined;
138
+ sort?: {
139
+ search?: number | undefined;
140
+ table?: number | undefined;
141
+ } | undefined;
142
+ };
143
+ }, __VLS_18: string, __VLS_19: {
144
+ row: any;
145
+ item: {
146
+ key: string;
147
+ label: string;
148
+ value: any;
149
+ disabled?: {
150
+ create?: boolean | undefined;
151
+ update?: boolean | undefined;
152
+ search?: boolean | undefined;
153
+ } | undefined;
154
+ options?: {
155
+ [x: string]: any;
156
+ input?: Record<string, any> | undefined;
157
+ switch?: {
158
+ activeValue: any;
159
+ activeLabel: string;
160
+ inactiveValue: any;
161
+ inactiveLabel: string;
162
+ tableBeforeChange: (key: string, data: any) => any;
163
+ } | undefined;
164
+ select?: Record<string, any> | undefined;
165
+ treeSelect?: Record<string, any> | undefined;
166
+ datetime?: Record<string, any> | undefined;
167
+ list?: {
168
+ label?: string | undefined;
169
+ value?: string | undefined;
170
+ itemFields?: ({
171
+ [x: string]: string;
172
+ label: string;
173
+ value: string;
174
+ } | undefined)[] | undefined;
175
+ inputWidth?: string | undefined;
176
+ inputClass?: string | undefined;
177
+ } | undefined;
178
+ } | undefined;
179
+ form?: {
180
+ labelWidth?: string | undefined;
181
+ width?: string | undefined;
182
+ span?: number | undefined;
183
+ } | undefined;
184
+ type: "input" | "select" | "switch" | "textarea" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list";
185
+ table?: {
186
+ table?: boolean | undefined;
187
+ minWidth?: string | undefined;
188
+ width?: string | undefined;
189
+ fixed?: "left" | "right" | undefined;
190
+ align?: "left" | "right" | "center" | undefined;
191
+ showOverflowTooltip?: boolean | undefined;
192
+ } | undefined;
193
+ rules?: any[] | undefined;
194
+ show?: {
195
+ table?: boolean | undefined;
196
+ search?: boolean | ((data: any) => boolean) | undefined;
197
+ form?: boolean | ((data: any) => boolean) | undefined;
198
+ } | undefined;
199
+ sort?: {
200
+ search?: number | undefined;
201
+ table?: number | undefined;
202
+ } | undefined;
203
+ };
204
+ }, __VLS_54: string, __VLS_55: {
205
+ row: any;
206
+ item: {
207
+ key: string;
208
+ label: string;
209
+ value: any;
210
+ disabled?: {
211
+ create?: boolean | undefined;
212
+ update?: boolean | undefined;
213
+ search?: boolean | undefined;
214
+ } | undefined;
215
+ options?: {
216
+ [x: string]: any;
217
+ input?: Record<string, any> | undefined;
218
+ switch?: {
219
+ activeValue: any;
220
+ activeLabel: string;
221
+ inactiveValue: any;
222
+ inactiveLabel: string;
223
+ tableBeforeChange: (key: string, data: any) => any;
224
+ } | undefined;
225
+ select?: Record<string, any> | undefined;
226
+ treeSelect?: Record<string, any> | undefined;
227
+ datetime?: Record<string, any> | undefined;
228
+ list?: {
229
+ label?: string | undefined;
230
+ value?: string | undefined;
231
+ itemFields?: ({
232
+ [x: string]: string;
233
+ label: string;
234
+ value: string;
235
+ } | undefined)[] | undefined;
236
+ inputWidth?: string | undefined;
237
+ inputClass?: string | undefined;
238
+ } | undefined;
239
+ } | undefined;
240
+ form?: {
241
+ labelWidth?: string | undefined;
242
+ width?: string | undefined;
243
+ span?: number | undefined;
244
+ } | undefined;
245
+ type: "input" | "select" | "switch" | "textarea" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list";
246
+ table?: {
247
+ table?: boolean | undefined;
248
+ minWidth?: string | undefined;
249
+ width?: string | undefined;
250
+ fixed?: "left" | "right" | undefined;
251
+ align?: "left" | "right" | "center" | undefined;
252
+ showOverflowTooltip?: boolean | undefined;
253
+ } | undefined;
254
+ rules?: any[] | undefined;
255
+ show?: {
256
+ table?: boolean | undefined;
257
+ search?: boolean | ((data: any) => boolean) | undefined;
258
+ form?: boolean | ((data: any) => boolean) | undefined;
259
+ } | undefined;
260
+ sort?: {
261
+ search?: number | undefined;
262
+ table?: number | undefined;
263
+ } | undefined;
264
+ };
265
+ }, __VLS_57: {
266
+ row: any;
267
+ };
268
+ type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
269
+ [K in NonNullable<typeof __VLS_14>]?: (props: typeof __VLS_15) => any;
270
+ } & {
271
+ [K in NonNullable<typeof __VLS_18>]?: (props: typeof __VLS_19) => any;
272
+ } & {
273
+ [K in NonNullable<typeof __VLS_54>]?: (props: typeof __VLS_55) => any;
274
+ } & {
275
+ 'form-start'?: (props: typeof __VLS_7) => any;
276
+ } & {
277
+ 'form-end'?: (props: typeof __VLS_57) => any;
278
+ }>;
279
+ declare const __VLS_self: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
280
+ /**
281
+ * 配置
282
+ */
283
+ option: {
284
+ default: {
285
+ form?: {
286
+ maxSpan?: number;
287
+ defaultSpan?: number;
288
+ };
289
+ column: CurdConfigColumn[];
290
+ };
291
+ };
292
+ }>, {
293
+ TForm: typeof TForm;
294
+ ElDatePicker: typeof ElDatePicker;
295
+ ElForm: typeof ElForm;
296
+ ElFormItem: typeof ElFormItem;
297
+ ElInput: typeof ElInput;
298
+ ElOption: typeof ElOption;
299
+ ElSelect: typeof ElSelect;
300
+ ElSwitch: typeof ElSwitch;
301
+ ElTreeSelect: typeof ElTreeSelect;
302
+ isFun: typeof isFun;
303
+ ruleFormRef: typeof ruleFormRef;
304
+ conf: typeof conf;
305
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
306
+ /**
307
+ * 配置
308
+ */
309
+ option: {
310
+ default: {
311
+ form?: {
312
+ maxSpan?: number;
313
+ defaultSpan?: number;
314
+ };
315
+ column: CurdConfigColumn[];
316
+ };
317
+ };
318
+ }>> & Readonly<{}>, {
319
+ option: {
320
+ form?: {
321
+ maxSpan?: number;
322
+ defaultSpan?: number;
323
+ };
324
+ column: CurdConfigColumn[];
325
+ };
326
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
327
+ declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
328
+ /**
329
+ * 配置
330
+ */
331
+ option: {
332
+ default: {
333
+ form?: {
334
+ maxSpan?: number;
335
+ defaultSpan?: number;
336
+ };
337
+ column: CurdConfigColumn[];
338
+ };
339
+ };
340
+ }>, {
341
+ ref: import("vue").Ref<FormInstance | undefined, FormInstance | undefined>;
342
+ conf: {
343
+ rules: any;
344
+ show: boolean;
345
+ showContent: boolean;
346
+ loading: boolean;
347
+ type: any;
348
+ form: any;
349
+ formDefault: any;
350
+ formColumn: {
351
+ item: {
352
+ key: string;
353
+ label: string;
354
+ value: any;
355
+ disabled?: {
356
+ create?: boolean | undefined;
357
+ update?: boolean | undefined;
358
+ search?: boolean | undefined;
359
+ } | undefined;
360
+ options?: {
361
+ [x: string]: any;
362
+ input?: Record<string, any> | undefined;
363
+ switch?: {
364
+ activeValue: any;
365
+ activeLabel: string;
366
+ inactiveValue: any;
367
+ inactiveLabel: string;
368
+ tableBeforeChange: (key: string, data: any) => any;
369
+ } | undefined;
370
+ select?: Record<string, any> | undefined;
371
+ treeSelect?: Record<string, any> | undefined;
372
+ datetime?: Record<string, any> | undefined;
373
+ list?: {
374
+ label?: string | undefined;
375
+ value?: string | undefined;
376
+ itemFields?: ({
377
+ [x: string]: string;
378
+ label: string;
379
+ value: string;
380
+ } | undefined)[] | undefined;
381
+ inputWidth?: string | undefined;
382
+ inputClass?: string | undefined;
383
+ } | undefined;
384
+ } | undefined;
385
+ form?: {
386
+ labelWidth?: string | undefined;
387
+ width?: string | undefined;
388
+ span?: number | undefined;
389
+ } | undefined;
390
+ type: "input" | "select" | "switch" | "textarea" | "radio" | "checkbox" | "date" | "time" | "datetime" | "number" | "color" | "icon" | "slider" | "upload" | "editor" | "tree" | "tree-select" | "list";
391
+ table?: {
392
+ table?: boolean | undefined;
393
+ minWidth?: string | undefined;
394
+ width?: string | undefined;
395
+ fixed?: "left" | "right" | undefined;
396
+ align?: "left" | "right" | "center" | undefined;
397
+ showOverflowTooltip?: boolean | undefined;
398
+ } | undefined;
399
+ rules?: any[] | undefined;
400
+ show?: {
401
+ table?: boolean | undefined;
402
+ search?: boolean | ((data: any) => boolean) | undefined;
403
+ form?: boolean | ((data: any) => boolean) | undefined;
404
+ } | undefined;
405
+ sort?: {
406
+ search?: number | undefined;
407
+ table?: number | undefined;
408
+ } | undefined;
409
+ };
410
+ span: number;
411
+ }[][];
412
+ getDisabled: (item: CurdConfigColumn) => boolean | undefined;
413
+ initColumnForm: () => void;
414
+ };
415
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
416
+ /**
417
+ * 配置
418
+ */
419
+ option: {
420
+ default: {
421
+ form?: {
422
+ maxSpan?: number;
423
+ defaultSpan?: number;
424
+ };
425
+ column: CurdConfigColumn[];
426
+ };
427
+ };
428
+ }>> & Readonly<{}>, {
429
+ option: {
430
+ form?: {
431
+ maxSpan?: number;
432
+ defaultSpan?: number;
433
+ };
434
+ column: CurdConfigColumn[];
435
+ };
436
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
437
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
438
+ export default _default;
439
+ type __VLS_WithSlots<T, S> = T & {
440
+ new (): {
441
+ $slots: S;
442
+ };
443
+ };