cc1-form 1.1.13 → 1.1.15

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.css CHANGED
@@ -1 +1 @@
1
- @media(max-width:650px){.curd-row .col-1,.curd-row .col-2,.curd-row .col-3,.curd-row .col-4,.curd-row .col-5,.curd-row .col-6,.curd-row .col-7,.curd-row .col-8,.curd-row .col-9,.curd-row .col-10,.curd-row .col-11,.curd-row .col-12{width:100%!important}}.curd-row.stripe{border-bottom:1px solid #eee;border-left:1px solid #eee;border-right:1px solid #eee}.curd-row.stripe .form-item-label{border-right:1px solid #eee}.curd-row.stripe:first-child{border-top:1px solid #eee}.curd-row.stripe:nth-child(odd){background-color:#f5f7fa}.curd-row.stripe .el-form-item__label{position:relative;padding:0 20px 0 0}.curd-row.stripe .el-form-item__label:after{content:"";position:absolute;top:-10px;right:10px;width:1px;height:52px;background-color:#eee}.curd-row.stripe [class^=col-]:nth-child(2n) .el-form-item__label:before{content:"";position:absolute;top:-10px;left:0;width:1px;height:52px;background-color:#eee}@media(max-width:650px){.curd-row.stripe [class^=col-]:nth-child(2n){border-top:1px solid #eee}.curd-row.stripe [class^=col-]:nth-child(2n) .el-form-item__label:before{content:"";position:absolute;opacity:0}}.curd-row.stripe .el-form-item{margin-bottom:0;height:50px;align-items:center;padding:0 10px}.cc1-form-box{min-height:500px}.cc1-form-box .el-table th.el-table__cell{word-break:break-word;color:#000000d9;background-color:#fafafa}.cc1-form-box .curd-search .el-form-item{margin-bottom:10px}.cc1-form-box .curd-search .el-form--inline .el-form-item{margin-right:10px}.cc1-form-box .hide-label .el-form-item__label{display:none}.cc1-form-box .mt-10{margin-top:10px}.cc1-form-box .mb-10{margin-bottom:10px}.cc1-form-box .curd-search .el-select{width:192px}.cc1-form-box .refresh-btn{width:16px;height:16px;border-radius:50%;padding:6px;font-size:14px;border:1px solid #dcdfe6;background-color:#fff;flex-shrink:0;display:flex;align-items:center;justify-content:center;color:#909399;cursor:pointer}.cc1-form-box .refresh-btn:hover{background-color:#f5f7fa}.cc1-form-box .table-text-click{color:var(--table-text-click-color);cursor:pointer}
1
+ @media(max-width:650px){.curd-row .col-1,.curd-row .col-2,.curd-row .col-3,.curd-row .col-4,.curd-row .col-5,.curd-row .col-6,.curd-row .col-7,.curd-row .col-8,.curd-row .col-9,.curd-row .col-10,.curd-row .col-11,.curd-row .col-12{width:100%!important}}.curd-row.stripe{border-bottom:1px solid #eee;border-left:1px solid #eee;border-right:1px solid #eee}.curd-row.stripe .form-item-label{border-right:1px solid #eee}.curd-row.stripe:first-child{border-top:1px solid #eee}.curd-row.stripe:nth-child(odd){background-color:#f5f7fa}.curd-row.stripe .el-form-item__label{position:relative;padding:0 20px 0 0}.curd-row.stripe .el-form-item__label:after{content:"";position:absolute;top:-10px;right:10px;width:1px;height:52px;background-color:#eee}.curd-row.stripe [class^=col-]:nth-child(2n) .el-form-item__label:before{content:"";position:absolute;top:-10px;left:0;width:1px;height:52px;background-color:#eee}@media(max-width:650px){.curd-row.stripe [class^=col-]:nth-child(2n){border-top:1px solid #eee}.curd-row.stripe [class^=col-]:nth-child(2n) .el-form-item__label:before{content:"";position:absolute;opacity:0}}.curd-row.stripe .el-form-item{margin-bottom:0;height:50px;align-items:center;padding:0 10px}.cc1-form-box{min-height:500px}.cc1-form-box .el-table th.el-table__cell{word-break:break-word;color:#000000d9;background-color:#fafafa}.cc1-form-box .curd-search .el-form-item{margin-bottom:10px}.cc1-form-box .curd-search .el-form--inline .el-form-item{margin-right:10px}.cc1-form-box .hide-label .el-form-item__label{display:none}.cc1-form-box .mt-10{margin-top:10px}.cc1-form-box .mb-10{margin-bottom:10px}.cc1-form-box .curd-search .el-select{width:192px}.cc1-form-box .refresh-btn{width:16px;height:16px;border-radius:50%;padding:6px;font-size:14px;border:1px solid #dcdfe6;background-color:#fff;flex-shrink:0;display:flex;align-items:center;justify-content:center;color:#909399;cursor:pointer}.cc1-form-box .refresh-btn:hover{background-color:#f5f7fa}.cc1-form-box .table-text-click{color:var(--table-text-click-color);cursor:pointer;text-decoration:underline}
package/dist/cc1-form.js CHANGED
@@ -156,7 +156,7 @@ class $ {
156
156
  }
157
157
  });
158
158
  }
159
- class T {
159
+ class L {
160
160
  /**
161
161
  * 自定义组件
162
162
  */
@@ -189,7 +189,7 @@ class T {
189
189
  )
190
190
  */
191
191
  static setOptionsData = (r, d, s) => {
192
- const f = T.findOptions(r, d);
192
+ const f = L.findOptions(r, d);
193
193
  f && (f.data = s);
194
194
  };
195
195
  static form = {
@@ -202,12 +202,12 @@ class T {
202
202
  * @param option 组件配置
203
203
  */
204
204
  parentId: (r, d, s, f) => {
205
- r ? d.type === $.EDialog.Insert ? (d.form.parentId = r._id, d.form.sort = r.children.length + 1) : d.form.parentId = r.parentId.substring(r.parentId.lastIndexOf(",") + 1) : (d.form.parentId = "0", d.form.sort = s.length + 1), T.setOptionsData(f, "parentId", [{ _id: "0", title: "根", children: s }]);
205
+ r ? d.type === $.EDialog.Insert ? (d.form.parentId = r._id, d.form.sort = r.children.length + 1) : d.form.parentId = r.parentId.substring(r.parentId.lastIndexOf(",") + 1) : (d.form.parentId = "0", d.form.sort = s.length + 1), L.setOptionsData(f, "parentId", [{ _id: "0", title: "根", children: s }]);
206
206
  }
207
207
  }
208
208
  };
209
209
  }
210
- class _ {
210
+ class T {
211
211
  /**
212
212
  * 获取id函数-可以直接覆盖
213
213
  */
@@ -222,7 +222,7 @@ class _ {
222
222
  s.forEach((m) => {
223
223
  let u = m.default ?? "";
224
224
  m.type === "number" && (u = m.default ?? 0), m.type === "boolean" && (u = m.default ?? !1), m.type === "time" && (u = m.default ?? /* @__PURE__ */ new Date()), f[m.value] === void 0 && (f[m.value] = u);
225
- }), f._id || (f._id = _.getIdFun());
225
+ }), f._id || (f._id = T.getIdFun());
226
226
  });
227
227
  };
228
228
  /**
@@ -234,13 +234,13 @@ class _ {
234
234
  */
235
235
  static add = (r, d, s, f) => {
236
236
  const m = JSONUtil.cp(s);
237
- _.setId(r, d, s), d[r].push(
237
+ T.setId(r, d, s), d[r].push(
238
238
  m.reduce(
239
239
  (u, e) => {
240
240
  let a = e.default ?? "";
241
241
  return e.type === "number" && (a = e.default ?? 0), e.type === "boolean" && (a = e.default ?? !1), e.type === "time" && (a = e.default ?? /* @__PURE__ */ new Date()), u[e.value] = a, u;
242
242
  },
243
- { _id: _.getIdFun() }
243
+ { _id: T.getIdFun() }
244
244
  )
245
245
  ), f?.(d);
246
246
  };
@@ -263,7 +263,7 @@ class _ {
263
263
  static getNoIdData = (r, d) => {
264
264
  const s = JSONUtil.cp(r);
265
265
  return s.forEach((f) => {
266
- f._id && delete f._id, d && f[d] && _.getNoIdData(f[d], d);
266
+ f._id && delete f._id, d && f[d] && T.getNoIdData(f[d], d);
267
267
  }), s;
268
268
  };
269
269
  }
@@ -313,18 +313,18 @@ const ge = {
313
313
  const d = p, s = oe({
314
314
  show: !1,
315
315
  add: (m, u, e) => {
316
- _.add(m, u, e, () => {
316
+ T.add(m, u, e, () => {
317
317
  f("change");
318
318
  });
319
319
  },
320
320
  remove: (m, u, e) => {
321
- _.remove(m, u, e, () => {
321
+ T.remove(m, u, e, () => {
322
322
  f("change");
323
323
  });
324
324
  }
325
325
  });
326
326
  ne(() => {
327
- _.setId(d.field, d.row, d.itemFields), s.show = !0;
327
+ T.setId(d.field, d.row, d.itemFields), s.show = !0;
328
328
  });
329
329
  const f = r;
330
330
  return (m, u) => {
@@ -407,7 +407,7 @@ const ge = {
407
407
  const l = (h) => {
408
408
  if (u.formDefault[h.key] = h.value, h.isForm) {
409
409
  h.form = h.form || { span: o }, h.form.span = h.form.span ?? o;
410
- let R = h.form.span, g = t.reduce((L, P) => L + P.span, R);
410
+ let R = h.form.span, g = t.reduce((_, P) => _ + P.span, R);
411
411
  const j = t.length;
412
412
  t.push({ item: h, span: R }), (j === 1 && t[0].span === 0 || g >= i || R === 0 && j > 1) && (a.push(t), t = []), h.rules && (u.rules[h.key] = h.rules);
413
413
  }
@@ -501,7 +501,7 @@ const ge = {
501
501
  "onUpdate:modelValue": (t) => u.form[o.item.key] = t
502
502
  }, { ref_for: !0 }, o.item.options?.datetime, I(o.item.options?.datetime?.on || {}), {
503
503
  disabled: u.getDisabled(o.item)
504
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(T).customComponent[o.item.type] ? (c(), y(Q(n(T).customComponent[o.item.type]), D({
504
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(L).customComponent[o.item.type] ? (c(), y(Q(n(L).customComponent[o.item.type]), D({
505
505
  key: 6,
506
506
  modelValue: u.form[o.item.key],
507
507
  "onUpdate:modelValue": (t) => u.form[o.item.key] = t
@@ -680,7 +680,7 @@ class E {
680
680
  };
681
681
  /** 设置全局默认配置 */
682
682
  static setConfig = (r) => {
683
- ObjectUtil.deepMerge(E.config, r);
683
+ E.config = ObjectUtil.deepMerge(E.config, r);
684
684
  };
685
685
  }
686
686
  const Fe = { class: "col relative cc1-form-box" }, Ie = {
@@ -689,10 +689,10 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
689
689
  }, Re = { class: "col column" }, je = {
690
690
  key: 0,
691
691
  class: "relative curd-search"
692
- }, ze = { class: "mb-10 flex justify-between items-center" }, Te = {
692
+ }, ze = { class: "mb-10 flex justify-between items-center" }, Le = {
693
693
  class: "flex items-center",
694
694
  style: { gap: "10px" }
695
- }, _e = { key: 0 }, Le = { key: 1 }, Me = { key: 2 }, Ke = { class: "export-btn" }, Ne = {
695
+ }, Te = { key: 0 }, _e = { key: 1 }, Me = { key: 2 }, Ke = { class: "export-btn" }, Ne = {
696
696
  class: "flex items-center",
697
697
  style: { gap: "10px" }
698
698
  }, Pe = { class: "col fit-width relative" }, Ae = { class: "absolute column fit" }, Be = ["onClick"], Je = { class: "row justify-end mt-10 mb-10" }, We = {
@@ -1041,12 +1041,12 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
1041
1041
  return s.option.api.update ? (await s.option.api.update({
1042
1042
  [E.config.tableRowKey]: g[E.config.tableRowKey],
1043
1043
  [R]: g[R] === j.activeValue ? j.inactiveValue : j.activeValue,
1044
- final(L, P, A) {
1044
+ final(_, P, A) {
1045
1045
  e.table.loading = !1;
1046
1046
  }
1047
1047
  }), e.table.loading = !1, $.success(w.tCurd("operationSuccess")), e.table.getList(), !0) : void 0;
1048
- } catch (L) {
1049
- return console.error(L), !1;
1048
+ } catch (_) {
1049
+ return console.error(_), !1;
1050
1050
  } finally {
1051
1051
  e.table.loading = !1;
1052
1052
  }
@@ -1102,9 +1102,9 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
1102
1102
  const h = (g) => {
1103
1103
  if (e.update.formDefault[g.key] = g.value, g.table.table && (g.show.table && e.table.column.show.list.push(g.key), g.table.table && e.table.column.show.listSource.push(g.key)), g.isForm) {
1104
1104
  g.form = g.form || { span: t }, g.form.span = g.form.span ?? t;
1105
- let j = g.form.span, L = l.reduce((A, q) => A + q.span, j);
1105
+ let j = g.form.span, _ = l.reduce((A, q) => A + q.span, j);
1106
1106
  const P = l.length;
1107
- if (l.push({ item: g, span: j }), (P === 1 && l[0].span === 0 || L >= o || j === 0 && P > 1) && (i.push(l), l = []), g.rules) {
1107
+ if (l.push({ item: g, span: j }), (P === 1 && l[0].span === 0 || _ >= o || j === 0 && P > 1) && (i.push(l), l = []), g.rules) {
1108
1108
  const A = {
1109
1109
  input: w.tCurd("placeholderInput"),
1110
1110
  select: w.tCurd("placeholderSelect")
@@ -1215,7 +1215,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
1215
1215
  "onUpdate:modelValue": (l) => e.search.form[t.key] = l
1216
1216
  }, { ref_for: !0 }, t.options?.datetime, I(t.options?.datetime?.on || {}), {
1217
1217
  disabled: t.disabled?.search
1218
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(T).customComponent[t.type] ? (c(), y(Q(n(T).customComponent[t.type]), D({
1218
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(L).customComponent[t.type] ? (c(), y(Q(n(L).customComponent[t.type]), D({
1219
1219
  key: 4,
1220
1220
  modelValue: e.search.form[t.key],
1221
1221
  "onUpdate:modelValue": (l) => e.search.form[t.key] = l
@@ -1265,8 +1265,8 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
1265
1265
  }, 8, ["model"])
1266
1266
  ])) : v("", !0),
1267
1267
  O("div", ze, [
1268
- O("div", Te, [
1269
- n(u)(p.option.tools?.add) ? (c(), k("div", _e, [
1268
+ O("div", Le, [
1269
+ n(u)(p.option.tools?.add) ? (c(), k("div", Te, [
1270
1270
  V(n(F), {
1271
1271
  type: "primary",
1272
1272
  onClick: i[0] || (i[0] = (t) => e.update.open(n(d).Insert))
@@ -1277,7 +1277,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
1277
1277
  _: 1
1278
1278
  })
1279
1279
  ])) : v("", !0),
1280
- p.option.table?.selectable && n(u)(p.option.tools?.delete) ? (c(), k("div", Le, [
1280
+ p.option.table?.selectable && n(u)(p.option.tools?.delete) ? (c(), k("div", _e, [
1281
1281
  V(n(F), {
1282
1282
  type: "danger",
1283
1283
  onClick: i[1] || (i[1] = (t) => e.remove.open(e.table.selection.list))
@@ -1427,8 +1427,8 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
1427
1427
  style: se({
1428
1428
  "--table-text-click-color": n(E).config.table.click.color
1429
1429
  }),
1430
- class: M({ "table-text-click": l.table?.click?.callback }),
1431
- onClick: (h) => l.table?.click?.callback?.(l)
1430
+ class: M({ "table-text-click": t.table?.click?.callback }),
1431
+ onClick: (h) => t.table?.click?.callback?.(l)
1432
1432
  }, U(l[t.key]), 15, Be))
1433
1433
  ])
1434
1434
  ]),
@@ -1652,7 +1652,7 @@ const Fe = { class: "col relative cc1-form-box" }, Ie = {
1652
1652
  "onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
1653
1653
  }, { ref_for: !0 }, l.item.options?.datetime, I(l.item.options?.datetime?.on || {}), {
1654
1654
  disabled: e.update.getDisabled(l.item)
1655
- }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(T).customComponent[l.item.type] ? (c(), y(Q(n(T).customComponent[l.item.type]), D({
1655
+ }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled"])) : n(L).customComponent[l.item.type] ? (c(), y(Q(n(L).customComponent[l.item.type]), D({
1656
1656
  key: 6,
1657
1657
  modelValue: e.update.form[l.item.key],
1658
1658
  "onUpdate:modelValue": (h) => e.update.form[l.item.key] = h
@@ -1771,7 +1771,7 @@ class et {
1771
1771
  }
1772
1772
  const Qe = (p, r) => {
1773
1773
  if (p.component("TCurd", Xe), p.component("TFormList", le), p.component("TColumn", Ce), r?.customComponent) {
1774
- T.customComponent = r.customComponent;
1774
+ L.customComponent = r.customComponent;
1775
1775
  for (const d in r.customComponent)
1776
1776
  p.component(d, r.customComponent[d]);
1777
1777
  }
@@ -1779,12 +1779,12 @@ const Qe = (p, r) => {
1779
1779
  install: Qe
1780
1780
  };
1781
1781
  export {
1782
- _ as ArrUtil,
1782
+ T as ArrUtil,
1783
1783
  ve as ExcelUtil,
1784
1784
  Ce as TColumn,
1785
1785
  Xe as TCurd,
1786
1786
  et as TFile,
1787
- T as TForm,
1787
+ L as TForm,
1788
1788
  E as TFormConfig,
1789
1789
  le as TFormList,
1790
1790
  $ as TSys,
@@ -1 +1 @@
1
- (function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.cc1Form={},w.Vue,w.ElementPlus))})(this,(function(w,e,f){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(s,c)=>Array.isArray(s)?s.some(r=>typeof r=="function"?r(c):r):typeof s=="function"?s(c):s;static getRouterParams=()=>{const s=this.router.currentRoute.value.query||{},c=this.router.currentRoute.value.params||{};return Object.keys(s).length?s:Object.keys(c).length?c:{}};static moduleObj={};static loadModule=async s=>{if(!b.moduleObj[s])throw new Error(`模块${s}未加载,请赋值如:TSys.moduleObj = { ${s}: ()=>import('${s}') }`);const c=await b.moduleObj[s]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(s,c,r={}){const m=Date.now();if(!this.tipMessages[s]||m-this.tipMessages[s]>this.tipMessagesGap){this.tipMessages[s]=m;const h=Object.assign({message:s,type:c},r);f.ElMessage(h),setTimeout(()=>{delete this.tipMessages[s]},this.tipMessagesGap)}}static fail=(s,c={})=>{this.showMessage(s,"error",c)};static success=(s,c={})=>{this.showMessage(s,"success",c)};static loadingObj=null;static loadingTimer=null;static loading=(s=!0,c="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{s?this.loadingObj=f.ElLoading.service({lock:!0,text:c,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(s,c=!0)=>{if(c){let r=screen.width/2-500,m=screen.height/2-800/2-30;window.open(s,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+m+", left="+r)}else window.open(s,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=s=>new Promise(async(c,r)=>{let m=document.getElementById(s.id);const h=await b.loadModule("html2canvas");try{h(m,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:s.windowWidth,height:s.windowHeight,windowWidth:s.windowWidth,windowHeight:s.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(d){let t=d.toDataURL("image/png");c(t)})}catch(d){r(d)}})}class E{static customComponent={};static findOptions=(s,c)=>{const r=s.column.find(h=>h.key===c),m=h=>h.replace(/-([a-z])/g,(d,t)=>t.toUpperCase());if(r)return r.options[m(r.type)]};static setOptionsData=(s,c,r)=>{const m=E.findOptions(s,c);m&&(m.data=r)};static form={openBefore:{parentId:(s,c,r,m)=>{s?c.type===b.EDialog.Insert?(c.form.parentId=s._id,c.form.sort=s.children.length+1):c.form.parentId=s.parentId.substring(s.parentId.lastIndexOf(",")+1):(c.form.parentId="0",c.form.sort=r.length+1),E.setOptionsData(m,"parentId",[{_id:"0",title:"根",children:r}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(s,c,r)=>{c[s]||(c[s]=[]),c[s].forEach(m=>{r.forEach(h=>{let d=h.default??"";h.type==="number"&&(d=h.default??0),h.type==="boolean"&&(d=h.default??!1),h.type==="time"&&(d=h.default??new Date),m[h.value]===void 0&&(m[h.value]=d)}),m._id||(m._id=B.getIdFun())})};static add=(s,c,r,m)=>{const h=JSONUtil.cp(r);B.setId(s,c,r),c[s].push(h.reduce((d,t)=>{let n=t.default??"";return t.type==="number"&&(n=t.default??0),t.type==="boolean"&&(n=t.default??!1),t.type==="time"&&(n=t.default??new Date),d[t.value]=n,d},{_id:B.getIdFun()})),m?.(c)};static remove=(s,c,r,m)=>{c[s]=c[s].filter(h=>h._id!==r._id),m?.(c)};static getNoIdData=(s,c)=>{const r=JSONUtil.cp(s);return r.forEach(m=>{m._id&&delete m._id,c&&m[c]&&B.getNoIdData(m[c],c)}),r}}const I={key:0,class:"column",style:{width:"100%",gap:"10px"}},L={class:"row items-center",style:{gap:"10px",width:"100%"}},N=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:""}},emits:["change"],setup(p,{emit:s}){const c=p,r=e.reactive({show:!1,add:(h,d,t)=>{B.add(h,d,t,()=>{m("change")})},remove:(h,d,t)=>{B.remove(h,d,t,()=>{m("change")})}});e.onMounted(()=>{B.setId(c.field,c.row,c.itemFields),r.show=!0});const m=s;return(h,d)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return r.show?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:d[0]||(d[0]=i=>r.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.row[p.field],i=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(h.$slots,"item-start",{item:i,row:p.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.itemFields,l=>(e.openBlock(),e.createBlock(n,{modelValue:i[l.value],"onUpdate:modelValue":o=>i[l.value]=o,style:e.normalizeStyle({width:p.inputWidth}),class:e.normalizeClass(p.inputClass),placeholder:l[p.label]||l[p.value],onChange:d[1]||(d[1]=o=>m("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:i,row:p.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>r.remove(p.field,p.row,i)},{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),z={class:"row curd-row"},F=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:s}){const c=b.isFun,r=b.EDialog,m=e.ref(),h=p,d=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||r.Insert)===r.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;d.formColumn=[];const n=[],i=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||i;let o=[];const a=u=>{if(d.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:l},u.form.span=u.form.span??l;let C=u.form.span,g=o.reduce((x,S)=>x+S.span,C);const V=o.length;o.push({item:u,span:C}),(V===1&&o[0].span===0||g>=i||C===0&&V>1)&&(n.push(o),o=[]),u.rules&&(d.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,a(u)}),o.length>0&&n.push(o),d.formColumn=n,d.form=JSONUtil.cp(d.formDefault)},init:async()=>{d.show=!1,await e.nextTick(),d.initColumnForm()}});return d.initColumnForm(),s({ref:m,conf:d}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(f.ElForm),{ref_key:"ruleFormRef",ref:m,model:d.form,rules:d.rules},{default:e.withCtx(()=>[d.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.formColumn,i=>(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(t.$slots,"form-start",{row:d.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(l.item.show?.form,d.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.item.form.span>0?`col-${l.item.form.span}`:"col")},[e.createVNode(e.unref(f.ElFormItem),{label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+l.item.key+"-start",{row:d.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:d.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:1,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:2,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:d.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(f.ElTreeSelect),e.mergeProps({key:4,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:5,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:d.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:d.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class T{static exportToExcel=async(s,c,r)=>{if(!s||s.length===0)return;const m=await b.loadModule("xlsx"),h=s.map(n=>{const i={};return c.forEach(l=>{i[l.label]=n[l.key]}),i}),d=m.utils.json_to_sheet(h),t=m.utils.book_new();m.utils.book_append_sheet(t,d,"Sheet1"),r?typeof r=="function"&&(r=r()):r=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,m.writeFile(t,`${r}.xlsx`)}}function fe(p){return p}const R={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class k{static t(s,...c){return typeof s=="function"?s(...c):(s=String(s),s.replace(/{([^}]+)}/g,(r,m,h)=>typeof c[h]<"u"?c[h]:`{${m}}`))}static tCurd(s,...c){return this.t(this.curd[s],...c)}static curd=R}const j={class:"dialog-footer"},_=e.defineComponent({__name:"switchConfirm",setup(p,{expose:s}){const c=e.ref(!1),r=e.ref("确认修改"),m=e.ref("确认要修改状态吗?");let h=null,d=null;const t=l=>(l?.title&&(r.value=l.title),l?.content&&(m.value=l.content),c.value=!0,new Promise((o,a)=>{h=o,d=a})),n=()=>{c.value=!1,h?.(!0),h=null,d=null},i=()=>{c.value=!1,d?.(new Error("用户取消操作")),h=null,d=null};return s({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(f.ElDialog),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=a=>c.value=a),title:r.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",j,[e.createVNode(e.unref(f.ElButton),{onClick:i},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:n},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(m.value),1)]),_:1},8,["modelValue","title"]))}}),M=(p,s)=>{const c=p.__vccOpts||p;for(const[r,m]of s)c[r]=m;return c},K={},H={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function A(p,s){return e.openBlock(),e.createElementBlock("svg",H,[...s[0]||(s[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 J=M(K,[["render",A]]);class y{static config={tableRowKey:"_id",page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},table:{click:{color:"#409EFF"}}};static setConfig=s=>{ObjectUtil.deepMerge(y.config,s)}}const W={class:"col relative cc1-form-box"},q={class:"absolute row fit",style:{overflow:"hidden"}},G={class:"col column"},X={key:0,class:"relative curd-search"},Q={class:"mb-10 flex justify-between items-center"},Y={class:"flex items-center",style:{gap:"10px"}},Z={key:0},P={key:1},v={key:2},ee={class:"export-btn"},te={class:"flex items-center",style:{gap:"10px"}},oe={class:"col fit-width relative"},le={class:"absolute column fit"},ae=["onClick"],ne={class:"row justify-end mt-10 mb-10"},re={class:"row form-item-content",style:{width:"100%"}},se={class:"col"},ie={class:"dialog-footer"},ce={class:"dialog-footer"},O=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:s}){const c=b.EDialog,r=p,m=e.ref(),h=e.ref(),d=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(n,i=k.tCurd("placeholderInput"))=>n.text?.search?.placeholder===void 0?`${i}${n.label}`:n.text?.search?.placeholder,getFormData:()=>{let n={};r.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(n[l.key]=t.search.form[l.key])});const i=r.option.search?.before?.(n);return i&&(n=i),n},reset:()=>{const n=t.search.formDefault;Object.keys(n).forEach(i=>{r.option.search?.resetMode==="none"?n[i]=void 0:n[i]=t.search.formDefault[i]}),t.search.form=JSONUtil.cp(n),t.page.num=1,r.option.init!==!1&&t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:r.option.page?.size||10,sizeList:r.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:r.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(n,i)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const n=i=>{let l=[];return i.forEach(o=>{l.push(o[y.config.tableRowKey]),o.children&&o.children.length>0&&(l=l.concat(n(o.children)))}),l};t.table.expand.rowKeys=n(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const n=r.option.api.list;try{const i=await n({[y.config.page.size]:t.page.size,[y.config.page.num]:t.page.num,...t.search.getFormData()}),l=y.config.result,o=i.data||{[l.list]:i};let a=(Array.isArray(o[l.list]),o[l.list]);t.table.data=r.option.data?await r.option.data(a):a,t.page.total=o[l.total]||0}catch(i){console.error(i)}finally{t.table.loading=!1}},selection:{list:[],change:n=>{t.table.selection.list=n}}},export:{run:{start:async n=>{let i=await t.export.run[n](),l=r.option.column;const o=JSONUtil.cp({data:i,columns:l}),a=r.option.tools?.export||{};a.before&&a.before(o),T.exportToExcel(o.data,o.columns,a.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all({[y.config.page.size]:t.page.size,[y.config.page.num]:t.page.num,...t.search.getFormData()});return}const n=r.option.api.list,i=await n({[y.config.page.size]:999999,[y.config.page.num]:1});return(i.data||{[y.config.result.list]:i})[y.config.result.list]}catch(n){console.error(n)}finally{t.export.loading=!1}}},loading:!1,click:n=>{t.export.loading||t.export.run.start(n)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:c.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===c.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(r.option.form?.editAll)return n;let i={[y.config.tableRowKey]:t.update.edit.data[y.config.tableRowKey]};return Object.keys(t.update.edit.data).forEach(l=>{n[l]!==t.update.edit.data[l]&&(i[l]=n[l])}),i}},open:(n,i)=>{t.update.showContent||FunUtil.throttle(async()=>{const l=n===c.Insert;if(!l&&r.option.table?.inlineEdit){t.inlineEdit.open(i);return}t.update.type=n,t.update.edit.data=i,t.update.title=l?k.tCurd("add"):k.tCurd("edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:i),await r.option.form?.openBefore?.(i,t.update),t.update.show=!0,t.update.showContent=!0,r.option.form?.openAfter?.(i,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,o)=>new Promise((a,u)=>{l||(b.fail(k.tCurd("checkFormData")),u(!1)),a()})),t.update.loading=!0;const n=t.update.type===c.Insert?r.option.api.create:r.option.api.update;let i=JSONUtil.cp(t.update.form);delete i.children,await r.option.form?.submitBefore?.(i,t.update),Object.keys(i).forEach(l=>{if(typeof i[l]=="string"&&i[l].indexOf("T")>-1){const o=new Date(i[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(i[l]=o)}});try{if(!n)return;await n({...i}),t.update.close(),await t.table.getList(),r.option.form?.submitAfter?.(i,t.update)}catch(l){console.error(l)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:n=>{t.inlineEdit.row=n,t.inlineEdit.form=JSONUtil.cp(n)},close:()=>{t.inlineEdit.row=null,t.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{t.inlineEdit.loading=!0;const n=r.option.api.update;let i=JSONUtil.cp(t.inlineEdit.form);delete i.children;try{if(!n)return;await n({...i}),t.inlineEdit.close(),await t.table.getList(),b.success(k.tCurd("operationSuccess"))}catch(l){console.error(l)}finally{t.inlineEdit.loading=!1}})}},remove:{title:k.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:n=>{if(n.length===0){b.fail(k.tCurd("selectDataToDelete"));return}t.remove.items=n,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const n=r.option.api.delete;try{if(!n)return;await n({[y.config.tableRowKey]:t.remove.items.map(i=>i[y.config.tableRowKey]),items:t.remove.items}),b.success(k.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(i){console.error(i)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const i={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:y.config.tableRowKey,emptyText:k.tCurd("noData"),highlightCurrentRow:!0}},l=r.option;Object.keys(i).forEach(o=>{l[o]=ObjectUtil.deepMerge(i[o],l[o]||{})})},initColumnOptions:()=>{const n=r.option,i=l=>{const a={options:{switch:{activeValue:!0,activeLabel:k.tCurd("switchOn"),inactiveValue:!1,inactiveLabel:k.tCurd("switchOff"),tableBeforeChange:async(C,g)=>{const V=l.options?.switch;try{await m.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({[y.config.tableRowKey]:g[y.config.tableRowKey],[C]:g[C]===V.activeValue?V.inactiveValue:V.activeValue,final(x,S,D){t.table.loading=!1}}),t.table.loading=!1,b.success(k.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(x){return console.error(x),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:y.config.tableRowKey,nodeKey:y.config.tableRowKey,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}},u=l;Object.keys(a).forEach(C=>{u[C]=ObjectUtil.deepMerge(a[C],u[C]||{})})};n.column.forEach(i),n.table?.column?.forEach(i)},initColumnForm:()=>{const n=r.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const i=[],l=r.option.form?.maxSpan||12,o=r.option.form?.defaultSpan||l/2;let a=[];const u=g=>{if(t.update.formDefault[g.key]=g.value,g.table.table&&(g.show.table&&t.table.column.show.list.push(g.key),g.table.table&&t.table.column.show.listSource.push(g.key)),g.isForm){g.form=g.form||{span:o},g.form.span=g.form.span??o;let V=g.form.span,x=a.reduce((D,U)=>D+U.span,V);const S=a.length;if(a.push({item:g,span:V}),(S===1&&a[0].span===0||x>=l||V===0&&S>1)&&(i.push(a),a=[]),g.rules){const D={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},U=(D[g.type]||D.input)+g.label;t.update.rules[g.key]=typeof g.rules=="boolean"?[{required:!0,message:U,trigger:"blur"}]:g.rules}}};n.column.forEach(g=>{g.isForm=!0,u(g)}),r.option.table?.column?.forEach(g=>{g.isForm=!1,u(g)}),t.search.column.list=n.column.concat(n.table?.column||[]),t.table.column.list=t.search.column.list.filter(g=>g.table?.table),t.search.column.list.sort((g,V)=>g.sort?.search-V.sort?.search),t.table.column.list.sort((g,V)=>g.sort?.table-V.sort?.table),a.length>0&&i.push(a),t.update.formColumn=i;const C=r.option.search?.formDefault;C&&Object.keys(C).forEach(g=>{t.search.formDefault[g]=C[g]}),n.column.forEach(g=>{g.show?.search||(t.search.formDefault[g.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{r.option.init!==!1&&t.table.getList()}),s({conf:t}),(n,i)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",q,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",G,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",X,[e.createVNode(e.unref(f.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(f.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,a=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:3,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.datetime,e.toHandlers(o.options?.datetime?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[o.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[o.type]),e.mergeProps({key:4,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.[o.type],e.toHandlers(o.options?.[o.type]?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"search-"+o.key+"-right",{row:t.search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),p.option.tools?.search||p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(f.ElFormItem),{key:0},{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[e.createElementVNode("div",Y,[e.unref(d)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:i[0]||(i[0]=o=>t.update.open(e.unref(c).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(d)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",P,[e.createVNode(e.unref(f.ElButton),{type:"danger",onClick:i[1]||(i[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",v,[e.createVNode(e.unref(f.ElButton),{type:"warning",onClick:i[2]||(i[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(f.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(f.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(f.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(f.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(f.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(e.unref(f.ElButton),{type:"warning",loading:t.export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tools-left")]),e.createElementVNode("div",te,[e.renderSlot(n.$slots,"tools-right"),p.option.tools?.refresh===void 0||p.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:i[3]||(i[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[e.createVNode(J)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",oe,[e.createElementVNode("div",le,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(f.ElTable),e.mergeProps({data:t.table.data,border:p.option.table?.border===void 0?!0:p.option.table?.border},p.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[p.option.table?.selectable&&(e.unref(d)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),{key:0,type:"selection",selectable:typeof p.option.table?.selectable=="function"?p.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:a})=>[p.option.table?.inlineEdit&&t.inlineEdit.row===a&&(o.type==="input"||o.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:t.inlineEdit.form[o.key],"onUpdate:modelValue":u=>t.inlineEdit.form[o.key]=u},{ref_for:!0},o.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(t.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:1,modelValue:t.inlineEdit.form[o.key],"onUpdate:modelValue":u=>t.inlineEdit.form[o.key]=u},{ref_for:!0},o.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(n.$slots,"table-"+o.key,{key:1,row:a,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:0,modelValue:a[o.key],"onUpdate:modelValue":u=>a[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,a)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":e.unref(y).config.table.click.color}),class:e.normalizeClass({"table-text-click":a.table?.click?.callback}),onClick:u=>a.table?.click?.callback?.(a)},e.toDisplayString(a[o.key]),15,ae))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(d)(p.option.tools?.add)||e.unref(d)(p.option.tools?.update)||e.unref(d)(p.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),{key:1,label:e.unref(k).tCurd("operation"),width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(n.$slots,"table-op-left",{row:o}),e.unref(d)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,link:"",type:"primary",onClick:a=>t.update.open(e.unref(c).Insert,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.table?.inlineEdit&&t.inlineEdit.row===o?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(f.ElButton),{link:"",onClick:t.inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{link:"",type:"primary",onClick:t.inlineEdit.submit,loading:t.inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(n.$slots,"table-op-edit-right",{row:o})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(d)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,link:"",type:"warning",onClick:a=>t.update.open(e.unref(c).Update,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(d)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:1,link:"",type:"danger",onClick:a=>t.remove.open([o])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"table-op-right",{row:o})],64))]),_:3},8,["label"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",ne,[e.createVNode(e.unref(f.ElPagination),{"current-page":t.page.num,"onUpdate:currentPage":i[4]||(i[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":i[5]||(i[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])])]),e.renderSlot(n.$slots,"box-right")]),e.createVNode(e.unref(f.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":i[6]||(i[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},p.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ie,[e.createVNode(e.unref(f.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(f.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(o.map(a=>a.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:p.option.form?.stripe===void 0?!0:p.option.form?.stripe}])},[e.renderSlot(n.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(a.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.item.form.span>0?`col-${a.item.form.span}`:"col")},[e.createVNode(e.unref(f.ElFormItem),{class:e.normalizeClass({"hide-label":typeof a.item.text?.form?.label=="boolean"?!a.item.text?.form?.label:!1}),label:typeof a.item.text?.form?.label=="string"?a.item.text?.form?.label:a.item.label,prop:a.item.key,"label-width":a.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",re,[e.renderSlot(n.$slots,"form-"+a.item.key+"-start",{row:t.update.form,item:a.item}),e.createElementVNode("div",se,[e.renderSlot(n.$slots,"form-"+a.item.key,{row:t.update.form,item:a.item},()=>[a.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.input,e.toHandlers(a.item.options?.input?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.switch,{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.select,e.toHandlers(a.item.options?.select?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:t.update.form,field:a.item.key},{ref_for:!0},a.item.options?.list,e.toHandlers(a.item.options?.list?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):a.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(f.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.treeSelect,e.toHandlers(a.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.datetime,e.toHandlers(a.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[a.item.type]),e.mergeProps({key:6,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.[a.item.type],e.toHandlers(a.item.options?.[a.item.type]?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"form-"+a.item.key+"-right",{row:t.update.form,item:a.item})]),e.renderSlot(n.$slots,"form-"+a.item.key+"-end",{row:t.update.form,item:a.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(n.$slots,"form-end",{row:t.update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(f.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":i[7]||(i[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ce,[e.createVNode(e.unref(f.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",t.remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(_,{ref_key:"switchConfirmRef",ref:m},null,512)])}}});class de{static async download(s,c="download.png"){const r=document.createElement("a");r.style.display="none",r.href=s,r.setAttribute("download",c),typeof r.download>"u"&&r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(s)}static exportJSONFile=(s,c)=>{const r=new Blob([JSON.stringify(s)],{type:"application/json"}),m=URL.createObjectURL(r),h=document.createElement("a");h.href=m,h.download=`${c||"config"}.json`,h.click()};static importFile=async s=>new Promise((c,r)=>{const m=document.createElement("input");m.type="file";const h=s?.accept||".json";m.accept=h,m.style.display="none",m.onchange=d=>{const t=d.target.files[0];if(!t){b.fail("未选择文件"),r("未选择文件");return}const n=new FileReader;n.onload=async i=>{const l=h==".json"?JSON.parse(i.target.result):i.target.result;c(l)},n.onerror=()=>{b.fail("文件读取失败"),r("文件读取失败")},n.readAsText(t),document.body.removeChild(m)},document.body.appendChild(m),m.click()})}const $=(p,s)=>{if(p.component("TCurd",O),p.component("TFormList",N),p.component("TColumn",F),s?.customComponent){E.customComponent=s.customComponent;for(const c in s.customComponent)p.component(c,s.customComponent[c])}},pe={install:$};w.ArrUtil=B,w.ExcelUtil=T,w.TColumn=F,w.TCurd=O,w.TFile=de,w.TForm=E,w.TFormConfig=y,w.TFormList=N,w.TSys=b,w.default=pe,w.install=$,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(w,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","element-plus"],e):(w=typeof globalThis<"u"?globalThis:w||self,e(w.cc1Form={},w.Vue,w.ElementPlus))})(this,(function(w,e,f){"use strict";class b{static router;static routes;static getRouterPath=()=>this.router.currentRoute.value.path;static EDialog={Insert:"Insert",Update:"Update",Remove:"Remove"};static isFun=(s,c)=>Array.isArray(s)?s.some(r=>typeof r=="function"?r(c):r):typeof s=="function"?s(c):s;static getRouterParams=()=>{const s=this.router.currentRoute.value.query||{},c=this.router.currentRoute.value.params||{};return Object.keys(s).length?s:Object.keys(c).length?c:{}};static moduleObj={};static loadModule=async s=>{if(!b.moduleObj[s])throw new Error(`模块${s}未加载,请赋值如:TSys.moduleObj = { ${s}: ()=>import('${s}') }`);const c=await b.moduleObj[s]();return c.default??c};static tipMessages={};static tipMessagesGap=500;static showMessage(s,c,r={}){const m=Date.now();if(!this.tipMessages[s]||m-this.tipMessages[s]>this.tipMessagesGap){this.tipMessages[s]=m;const h=Object.assign({message:s,type:c},r);f.ElMessage(h),setTimeout(()=>{delete this.tipMessages[s]},this.tipMessagesGap)}}static fail=(s,c={})=>{this.showMessage(s,"error",c)};static success=(s,c={})=>{this.showMessage(s,"success",c)};static loadingObj=null;static loadingTimer=null;static loading=(s=!0,c="加载中")=>{Timer.un(this.loadingTimer),this.loadingTimer=Timer.once(()=>{s?this.loadingObj=f.ElLoading.service({lock:!0,text:c,background:"rgba(0, 0, 0, 0.3)"}):this.loadingObj&&(this.loadingObj.close(),this.loadingObj=null)},50)};static openUrl=(s,c=!0)=>{if(c){let r=screen.width/2-500,m=screen.height/2-800/2-30;window.open(s,"_blank","toolbar=no, location=yes, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=1000, height=800, top="+m+", left="+r)}else window.open(s,"DescriptiveWindowName"+StrUtil.getId(),"resizable,scrollbars=yes,status=1,width=1024, height=600, top=0, left=0")};static getImgPic=s=>new Promise(async(c,r)=>{let m=document.getElementById(s.id);const h=await b.loadModule("html2canvas");try{h(m,{logging:!1,allowTaint:!0,scale:window.devicePixelRatio,width:s.windowWidth,height:s.windowHeight,windowWidth:s.windowWidth,windowHeight:s.windowHeight,useCORS:!0,backgroundColor:"#ffffff00"}).then(function(d){let t=d.toDataURL("image/png");c(t)})}catch(d){r(d)}})}class E{static customComponent={};static findOptions=(s,c)=>{const r=s.column.find(h=>h.key===c),m=h=>h.replace(/-([a-z])/g,(d,t)=>t.toUpperCase());if(r)return r.options[m(r.type)]};static setOptionsData=(s,c,r)=>{const m=E.findOptions(s,c);m&&(m.data=r)};static form={openBefore:{parentId:(s,c,r,m)=>{s?c.type===b.EDialog.Insert?(c.form.parentId=s._id,c.form.sort=s.children.length+1):c.form.parentId=s.parentId.substring(s.parentId.lastIndexOf(",")+1):(c.form.parentId="0",c.form.sort=r.length+1),E.setOptionsData(m,"parentId",[{_id:"0",title:"根",children:r}])}}}}class B{static getIdFun=()=>StrUtil.uuid();static setId=(s,c,r)=>{c[s]||(c[s]=[]),c[s].forEach(m=>{r.forEach(h=>{let d=h.default??"";h.type==="number"&&(d=h.default??0),h.type==="boolean"&&(d=h.default??!1),h.type==="time"&&(d=h.default??new Date),m[h.value]===void 0&&(m[h.value]=d)}),m._id||(m._id=B.getIdFun())})};static add=(s,c,r,m)=>{const h=JSONUtil.cp(r);B.setId(s,c,r),c[s].push(h.reduce((d,t)=>{let n=t.default??"";return t.type==="number"&&(n=t.default??0),t.type==="boolean"&&(n=t.default??!1),t.type==="time"&&(n=t.default??new Date),d[t.value]=n,d},{_id:B.getIdFun()})),m?.(c)};static remove=(s,c,r,m)=>{c[s]=c[s].filter(h=>h._id!==r._id),m?.(c)};static getNoIdData=(s,c)=>{const r=JSONUtil.cp(s);return r.forEach(m=>{m._id&&delete m._id,c&&m[c]&&B.getNoIdData(m[c],c)}),r}}const I={key:0,class:"column",style:{width:"100%",gap:"10px"}},L={class:"row items-center",style:{gap:"10px",width:"100%"}},N=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:""}},emits:["change"],setup(p,{emit:s}){const c=p,r=e.reactive({show:!1,add:(h,d,t)=>{B.add(h,d,t,()=>{m("change")})},remove:(h,d,t)=>{B.remove(h,d,t,()=>{m("change")})}});e.onMounted(()=>{B.setId(c.field,c.row,c.itemFields),r.show=!0});const m=s;return(h,d)=>{const t=e.resolveComponent("el-button"),n=e.resolveComponent("el-input");return r.show?(e.openBlock(),e.createElementBlock("div",I,[e.renderSlot(h.$slots,"list-start",{row:p.row}),e.createElementVNode("div",null,[e.createVNode(t,{link:"",type:"primary",onClick:d[0]||(d[0]=i=>r.add(p.field,p.row,p.itemFields))},{default:e.withCtx(()=>[...d[2]||(d[2]=[e.createTextVNode("添加",-1)])]),_:1})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.row[p.field],i=>(e.openBlock(),e.createElementBlock("div",L,[e.renderSlot(h.$slots,"item-start",{item:i,row:p.row}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.itemFields,l=>(e.openBlock(),e.createBlock(n,{modelValue:i[l.value],"onUpdate:modelValue":o=>i[l.value]=o,style:e.normalizeStyle({width:p.inputWidth}),class:e.normalizeClass(p.inputClass),placeholder:l[p.label]||l[p.value],onChange:d[1]||(d[1]=o=>m("change"))},null,8,["modelValue","onUpdate:modelValue","style","class","placeholder"]))),256)),e.renderSlot(h.$slots,"item-end",{item:i,row:p.row}),e.createVNode(t,{link:"",type:"danger",onClick:l=>r.remove(p.field,p.row,i)},{default:e.withCtx(()=>[...d[3]||(d[3]=[e.createTextVNode("删除",-1)])]),_:1},8,["onClick"])]))),256)),e.renderSlot(h.$slots,"list-end",{row:p.row})])):e.createCommentVNode("",!0)}}}),z={class:"row curd-row"},F=e.defineComponent({__name:"column",props:{option:{default:{}},type:{default:""}},setup(p,{expose:s}){const c=b.isFun,r=b.EDialog,m=e.ref(),h=p,d=e.reactive({rules:{},show:!0,form:{},formDefault:{},formColumn:[],getDisabled:t=>t.disabled?.[(h.type||r.Insert)===r.Insert?"create":"update"],initColumnForm:async()=>{const t=h.option;d.formColumn=[];const n=[],i=h.option.form?.maxSpan||12,l=h.option.form?.defaultSpan||i;let o=[];const a=u=>{if(d.formDefault[u.key]=u.value,u.isForm){u.form=u.form||{span:l},u.form.span=u.form.span??l;let C=u.form.span,g=o.reduce((x,S)=>x+S.span,C);const V=o.length;o.push({item:u,span:C}),(V===1&&o[0].span===0||g>=i||C===0&&V>1)&&(n.push(o),o=[]),u.rules&&(d.rules[u.key]=u.rules)}};t.column.forEach(u=>{u.isForm=!0,a(u)}),o.length>0&&n.push(o),d.formColumn=n,d.form=JSONUtil.cp(d.formDefault)},init:async()=>{d.show=!1,await e.nextTick(),d.initColumnForm()}});return d.initColumnForm(),s({ref:m,conf:d}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(f.ElForm),{ref_key:"ruleFormRef",ref:m,model:d.form,rules:d.rules},{default:e.withCtx(()=>[d.show?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.formColumn,i=>(e.openBlock(),e.createElementBlock("div",z,[e.renderSlot(t.$slots,"form-start",{row:d.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i,l=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(c)(l.item.show?.form,d.form)??!0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l.item.form.span>0?`col-${l.item.form.span}`:"col")},[e.createVNode(e.unref(f.ElFormItem),{label:l.item.label,prop:l.item.key,"label-width":l.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.renderSlot(t.$slots,"form-"+l.item.key+"-start",{row:d.form,item:l.item}),e.renderSlot(t.$slots,"form-"+l.item.key,{row:d.form,item:l.item},()=>[l.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.input,e.toHandlers(l.item.options?.input?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:1,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.switch,e.toHandlers(l.item.options?.switch?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:2,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.select,e.toHandlers(l.item.options?.select?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.item.options?.select?.data,o=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.value,label:o.label,value:o.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:d.form,field:l.item.key},{ref_for:!0},l.item.options?.list,e.toHandlers(l.item.options?.list?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):l.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(f.ElTreeSelect),e.mergeProps({key:4,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.treeSelect,e.toHandlers(l.item.options?.treeSelect?.on||{}),{disabled:d.getDisabled(l.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):l.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:5,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.datetime,e.toHandlers(l.item.options?.datetime?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[l.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[l.item.type]),e.mergeProps({key:6,modelValue:d.form[l.item.key],"onUpdate:modelValue":o=>d.form[l.item.key]=o},{ref_for:!0},l.item.options?.[l.item.type],e.toHandlers(l.item.options?.[l.item.type]?.on||{}),{disabled:d.getDisabled(l.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(t.$slots,"form-"+l.item.key+"-end",{row:d.form,item:l.item})]),_:2},1032,["label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(t.$slots,"form-end",{row:d.form})]))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"]))}});class O{static exportToExcel=async(s,c,r)=>{if(!s||s.length===0)return;const m=await b.loadModule("xlsx"),h=s.map(n=>{const i={};return c.forEach(l=>{i[l.label]=n[l.key]}),i}),d=m.utils.json_to_sheet(h),t=m.utils.book_new();m.utils.book_append_sheet(t,d,"Sheet1"),r?typeof r=="function"&&(r=r()):r=`导出数据_${new Date().Format("yyyy-MM-dd")}_${new Date().getTime()}`,m.writeFile(t,`${r}.xlsx`)}}function fe(p){return p}const R={search:"搜索",add:"新增",edit:"编辑",delete:"删除",export:"导出",exportSelect:"导出选中",exportPage:"导出本页",exportAll:"导出全部",import:"导入",refresh:"刷新",reset:"重置",expandCollapse:"展开/收缩",operation:"操作",close:"关闭",cancel:"取消",submit:"提交",confirm:"确认",confirmDelete:"确认删除",confirmDeleteMessage:"确认要删除【{count}】条数据吗?",placeholderInput:"请输入",placeholderSelect:"请选择",checkFormData:"请检查表单数据",selectDataToDelete:"请选择要删除的数据",selectDataToExport:"请选择要导出的数据",noData:"暂无数据",operationSuccess:"操作成功",switchOn:"开启",switchOff:"关闭",confirmModify:"确认修改",confirmSwitchMessage:"确认要修改吗?"};class k{static t(s,...c){return typeof s=="function"?s(...c):(s=String(s),s.replace(/{([^}]+)}/g,(r,m,h)=>typeof c[h]<"u"?c[h]:`{${m}}`))}static tCurd(s,...c){return this.t(this.curd[s],...c)}static curd=R}const j={class:"dialog-footer"},M=e.defineComponent({__name:"switchConfirm",setup(p,{expose:s}){const c=e.ref(!1),r=e.ref("确认修改"),m=e.ref("确认要修改状态吗?");let h=null,d=null;const t=l=>(l?.title&&(r.value=l.title),l?.content&&(m.value=l.content),c.value=!0,new Promise((o,a)=>{h=o,d=a})),n=()=>{c.value=!1,h?.(!0),h=null,d=null},i=()=>{c.value=!1,d?.(new Error("用户取消操作")),h=null,d=null};return s({open:t}),(l,o)=>(e.openBlock(),e.createBlock(e.unref(f.ElDialog),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=a=>c.value=a),title:r.value,"close-on-click-modal":!1,width:"400px"},{footer:e.withCtx(()=>[e.createElementVNode("span",j,[e.createVNode(e.unref(f.ElButton),{onClick:i},{default:e.withCtx(()=>[...o[1]||(o[1]=[e.createTextVNode("取消",-1)])]),_:1}),e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:n},{default:e.withCtx(()=>[...o[2]||(o[2]=[e.createTextVNode("确认",-1)])]),_:1})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(m.value),1)]),_:1},8,["modelValue","title"]))}}),_=(p,s)=>{const c=p.__vccOpts||p;for(const[r,m]of s)c[r]=m;return c},K={},H={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"};function A(p,s){return e.openBlock(),e.createElementBlock("svg",H,[...s[0]||(s[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 J=_(K,[["render",A]]);class y{static config={tableRowKey:"_id",page:{num:"num",size:"size"},result:{list:"list",pages:"pages",num:"num",size:"size",total:"total"},table:{click:{color:"#409EFF"}}};static setConfig=s=>{y.config=ObjectUtil.deepMerge(y.config,s)}}const W={class:"col relative cc1-form-box"},q={class:"absolute row fit",style:{overflow:"hidden"}},G={class:"col column"},X={key:0,class:"relative curd-search"},Q={class:"mb-10 flex justify-between items-center"},Y={class:"flex items-center",style:{gap:"10px"}},Z={key:0},P={key:1},v={key:2},ee={class:"export-btn"},te={class:"flex items-center",style:{gap:"10px"}},oe={class:"col fit-width relative"},le={class:"absolute column fit"},ae=["onClick"],ne={class:"row justify-end mt-10 mb-10"},re={class:"row form-item-content",style:{width:"100%"}},se={class:"col"},ie={class:"dialog-footer"},ce={class:"dialog-footer"},T=e.defineComponent({__name:"index",props:{option:{default:{}}},setup(p,{expose:s}){const c=b.EDialog,r=p,m=e.ref(),h=e.ref(),d=b.isFun,t=e.reactive({search:{column:{list:[]},form:{},formDefault:{},getPlaceholder:(n,i=k.tCurd("placeholderInput"))=>n.text?.search?.placeholder===void 0?`${i}${n.label}`:n.text?.search?.placeholder,getFormData:()=>{let n={};r.option.column.forEach(l=>{(typeof l.show?.search=="function"?l.show?.search(t.search.form):l.show?.search)&&(n[l.key]=t.search.form[l.key])});const i=r.option.search?.before?.(n);return i&&(n=i),n},reset:()=>{const n=t.search.formDefault;Object.keys(n).forEach(i=>{r.option.search?.resetMode==="none"?n[i]=void 0:n[i]=t.search.formDefault[i]}),t.search.form=JSONUtil.cp(n),t.page.num=1,r.option.init!==!1&&t.table.getList()},submit:()=>{t.page.num=1,t.table.getList()}},page:{size:r.option.page?.size||10,sizeList:r.option.page?.sizeList||[10,20,50,100],num:1,total:0,layout:r.option.page?.layout||"total, sizes, prev, pager, next, jumper"},table:{loading:!1,data:[],expand:{isExpand:!1,rowKeys:[],change:(n,i)=>{},all:()=>{if(t.table.expand.isExpand)t.table.expand.rowKeys=[];else{const n=i=>{let l=[];return i.forEach(o=>{l.push(o[y.config.tableRowKey]),o.children&&o.children.length>0&&(l=l.concat(n(o.children)))}),l};t.table.expand.rowKeys=n(t.table.data)}t.table.expand.isExpand=!t.table.expand.isExpand}},column:{list:[],show:{listSource:[],list:[]}},getList:async()=>{t.table.loading=!0;const n=r.option.api.list;try{const i=await n({[y.config.page.size]:t.page.size,[y.config.page.num]:t.page.num,...t.search.getFormData()}),l=y.config.result,o=i.data||{[l.list]:i};let a=(Array.isArray(o[l.list]),o[l.list]);t.table.data=r.option.data?await r.option.data(a):a,t.page.total=o[l.total]||0}catch(i){console.error(i)}finally{t.table.loading=!1}},selection:{list:[],change:n=>{t.table.selection.list=n}}},export:{run:{start:async n=>{let i=await t.export.run[n](),l=r.option.column;const o=JSONUtil.cp({data:i,columns:l}),a=r.option.tools?.export||{};a.before&&a.before(o),O.exportToExcel(o.data,o.columns,a.fileName)},select:()=>{if(t.table.selection.list.length===0)throw b.fail(k.tCurd("selectDataToExport")),new Error(k.tCurd("selectDataToExport"));return t.table.selection.list},page:()=>{if(t.table.data.length===0)throw b.fail(k.tCurd("noData")),new Error(k.tCurd("noData"));return t.table.data},all:async()=>{t.export.loading=!0;try{if(r.option.tools?.export?.all){await r.option.tools?.export?.all({[y.config.page.size]:t.page.size,[y.config.page.num]:t.page.num,...t.search.getFormData()});return}const n=r.option.api.list,i=await n({[y.config.page.size]:999999,[y.config.page.num]:1});return(i.data||{[y.config.result.list]:i})[y.config.result.list]}catch(n){console.error(n)}finally{t.export.loading=!1}}},loading:!1,click:n=>{t.export.loading||t.export.run.start(n)}},update:{title:"",rules:{},show:!1,showContent:!1,loading:!1,type:c.Insert,form:{},formDefault:{},formColumn:[],getDisabled:n=>n.disabled?.[t.update.type===c.Insert?"create":"update"],edit:{data:{},getApiData:n=>{if(r.option.form?.editAll)return n;let i={[y.config.tableRowKey]:t.update.edit.data[y.config.tableRowKey]};return Object.keys(t.update.edit.data).forEach(l=>{n[l]!==t.update.edit.data[l]&&(i[l]=n[l])}),i}},open:(n,i)=>{t.update.showContent||FunUtil.throttle(async()=>{const l=n===c.Insert;if(!l&&r.option.table?.inlineEdit){t.inlineEdit.open(i);return}t.update.type=n,t.update.edit.data=i,t.update.title=l?k.tCurd("add"):k.tCurd("edit"),t.update.form=JSONUtil.cp(l?t.update.formDefault:i),await r.option.form?.openBefore?.(i,t.update),t.update.show=!0,t.update.showContent=!0,r.option.form?.openAfter?.(i,t.update)})},submit:()=>{FunUtil.throttle(async()=>{await h.value?.validate(async(l,o)=>new Promise((a,u)=>{l||(b.fail(k.tCurd("checkFormData")),u(!1)),a()})),t.update.loading=!0;const n=t.update.type===c.Insert?r.option.api.create:r.option.api.update;let i=JSONUtil.cp(t.update.form);delete i.children,await r.option.form?.submitBefore?.(i,t.update),Object.keys(i).forEach(l=>{if(typeof i[l]=="string"&&i[l].indexOf("T")>-1){const o=new Date(i[l]).getTime();!isNaN(o)&&o>new Date("1971-01-01").getTime()&&(i[l]=o)}});try{if(!n)return;await n({...i}),t.update.close(),await t.table.getList(),r.option.form?.submitAfter?.(i,t.update)}catch(l){console.error(l)}finally{t.update.loading=!1}})},close:()=>{t.update.show=!1,setTimeout(()=>{t.update.showContent=!1},350)}},inlineEdit:{row:null,form:{},loading:!1,open:n=>{t.inlineEdit.row=n,t.inlineEdit.form=JSONUtil.cp(n)},close:()=>{t.inlineEdit.row=null,t.inlineEdit.form={}},submit:()=>{FunUtil.throttle(async()=>{t.inlineEdit.loading=!0;const n=r.option.api.update;let i=JSONUtil.cp(t.inlineEdit.form);delete i.children;try{if(!n)return;await n({...i}),t.inlineEdit.close(),await t.table.getList(),b.success(k.tCurd("operationSuccess"))}catch(l){console.error(l)}finally{t.inlineEdit.loading=!1}})}},remove:{title:k.tCurd("confirmDelete"),show:!1,items:[],loading:!1,close:()=>{t.remove.show=!1},open:n=>{if(n.length===0){b.fail(k.tCurd("selectDataToDelete"));return}t.remove.items=n,t.remove.show=!0},submit:()=>{FunUtil.throttle(async()=>{t.remove.loading=!0;const n=r.option.api.delete;try{if(!n)return;await n({[y.config.tableRowKey]:t.remove.items.map(i=>i[y.config.tableRowKey]),items:t.remove.items}),b.success(k.tCurd("operationSuccess")),t.table.data.length<=1&&t.page.num>1&&(t.page.num-=1),t.remove.close(),await t.table.getList()}catch(i){console.error(i)}finally{t.remove.loading=!1}})}},init:()=>{t.initCurdConfig(),t.initColumnOptions(),t.initColumnForm()},initCurdConfig:()=>{const i={tools:{search:!0,reset:!0,expand:!1,add:o=>o===void 0,update:!0,delete:!0,export:{show:!0}},table:{headerCellClassName:"table-header",rowKey:y.config.tableRowKey,emptyText:k.tCurd("noData"),highlightCurrentRow:!0}},l=r.option;Object.keys(i).forEach(o=>{l[o]=ObjectUtil.deepMerge(i[o],l[o]||{})})},initColumnOptions:()=>{const n=r.option,i=l=>{const a={options:{switch:{activeValue:!0,activeLabel:k.tCurd("switchOn"),inactiveValue:!1,inactiveLabel:k.tCurd("switchOff"),tableBeforeChange:async(C,g)=>{const V=l.options?.switch;try{await m.value?.open({title:k.tCurd("confirmModify"),content:k.tCurd("confirmSwitchMessage")}),t.table.loading=!0;try{return r.option.api.update?(await r.option.api.update({[y.config.tableRowKey]:g[y.config.tableRowKey],[C]:g[C]===V.activeValue?V.inactiveValue:V.activeValue,final(x,S,D){t.table.loading=!1}}),t.table.loading=!1,b.success(k.tCurd("operationSuccess")),t.table.getList(),!0):void 0}catch(x){return console.error(x),!1}finally{t.table.loading=!1}}catch{return!1}}},treeSelect:{rowKey:y.config.tableRowKey,nodeKey:y.config.tableRowKey,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}},u=l;Object.keys(a).forEach(C=>{u[C]=ObjectUtil.deepMerge(a[C],u[C]||{})})};n.column.forEach(i),n.table?.column?.forEach(i)},initColumnForm:()=>{const n=r.option;t.update.formColumn=[],t.table.column.show={list:[],listSource:[]};const i=[],l=r.option.form?.maxSpan||12,o=r.option.form?.defaultSpan||l/2;let a=[];const u=g=>{if(t.update.formDefault[g.key]=g.value,g.table.table&&(g.show.table&&t.table.column.show.list.push(g.key),g.table.table&&t.table.column.show.listSource.push(g.key)),g.isForm){g.form=g.form||{span:o},g.form.span=g.form.span??o;let V=g.form.span,x=a.reduce((D,U)=>D+U.span,V);const S=a.length;if(a.push({item:g,span:V}),(S===1&&a[0].span===0||x>=l||V===0&&S>1)&&(i.push(a),a=[]),g.rules){const D={input:k.tCurd("placeholderInput"),select:k.tCurd("placeholderSelect")},U=(D[g.type]||D.input)+g.label;t.update.rules[g.key]=typeof g.rules=="boolean"?[{required:!0,message:U,trigger:"blur"}]:g.rules}}};n.column.forEach(g=>{g.isForm=!0,u(g)}),r.option.table?.column?.forEach(g=>{g.isForm=!1,u(g)}),t.search.column.list=n.column.concat(n.table?.column||[]),t.table.column.list=t.search.column.list.filter(g=>g.table?.table),t.search.column.list.sort((g,V)=>g.sort?.search-V.sort?.search),t.table.column.list.sort((g,V)=>g.sort?.table-V.sort?.table),a.length>0&&i.push(a),t.update.formColumn=i;const C=r.option.search?.formDefault;C&&Object.keys(C).forEach(g=>{t.search.formDefault[g]=C[g]}),n.column.forEach(g=>{g.show?.search||(t.search.formDefault[g.key]=void 0)}),t.search.form=JSONUtil.cp(t.search.formDefault)}});return t.init(),e.onMounted(()=>{r.option.init!==!1&&t.table.getList()}),s({conf:t}),(n,i)=>{const l=e.resolveDirective("loading");return e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",q,[e.renderSlot(n.$slots,"box-left"),e.createElementVNode("div",G,[p.option.search?.show!==!1?(e.openBlock(),e.createElementBlock("div",X,[e.createVNode(e.unref(f.ElForm),{model:t.search.form,inline:""},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-start",{row:t.search.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.search.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[(typeof o.show?.search=="function"?o.show?.search(t.search.form):o.show?.search)?(e.openBlock(),e.createBlock(e.unref(f.ElFormItem),{key:0,label:typeof o.text?.search?.label=="string"?o.text?.search?.label:o.label,class:e.normalizeClass({"hide-label":typeof o.text?.search?.label=="boolean"?!o.text?.search?.label:!1})},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"search-"+o.key,{row:t.search.form},()=>[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),{key:0,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o),clearable:"",disabled:o.disabled?.search},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),{key:1,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.options?.switch?.activeValue,label:o.options?.switch?.activeLabel,value:o.options?.switch?.activeValue},null,8,["label","value"])),(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:o.options?.switch?.inactiveValue,label:o.options?.switch?.inactiveLabel,value:o.options?.switch?.inactiveValue},null,8,["label","value"]))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),{key:2,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a,placeholder:t.search.getPlaceholder(o,e.unref(k).tCurd("placeholderSelect")),clearable:"",disabled:o.disabled?.search},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,a=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:2},1032,["modelValue","onUpdate:modelValue","placeholder","disabled"])):o.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:3,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.datetime,e.toHandlers(o.options?.datetime?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[o.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[o.type]),e.mergeProps({key:4,modelValue:t.search.form[o.key],"onUpdate:modelValue":a=>t.search.form[o.key]=a},{ref_for:!0},o.options?.[o.type],e.toHandlers(o.options?.[o.type]?.on||{}),{disabled:o.disabled?.search}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"search-"+o.key+"-right",{row:t.search.form})]),_:2},1032,["label","class"])):e.createCommentVNode("",!0)],64))),128)),e.renderSlot(n.$slots,"search-center",{row:t.search.form}),p.option.tools?.search||p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(f.ElFormItem),{key:0},{default:e.withCtx(()=>[p.option.tools?.search?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,type:"primary",onClick:t.search.submit},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("search")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.tools?.reset?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:1,onClick:t.search.reset},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("reset")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:1})):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"search-end",{row:t.search.form})]),_:3},8,["model"])])):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[e.createElementVNode("div",Y,[e.unref(d)(p.option.tools?.add)?(e.openBlock(),e.createElementBlock("div",Z,[e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:i[0]||(i[0]=o=>t.update.open(e.unref(c).Insert))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.table?.selectable&&e.unref(d)(p.option.tools?.delete)?(e.openBlock(),e.createElementBlock("div",P,[e.createVNode(e.unref(f.ElButton),{type:"danger",onClick:i[1]||(i[1]=o=>t.remove.open(t.table.selection.list))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.expand?(e.openBlock(),e.createElementBlock("div",v,[e.createVNode(e.unref(f.ElButton),{type:"warning",onClick:i[2]||(i[2]=o=>t.table.expand.all())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("expandCollapse")),1)]),_:1})])):e.createCommentVNode("",!0),p.option.tools?.export?.show?(e.openBlock(),e.createBlock(e.unref(f.ElDropdown),{key:3,onCommand:t.export.click},{dropdown:e.withCtx(()=>[e.createVNode(e.unref(f.ElDropdownMenu),null,{default:e.withCtx(()=>[p.option.table?.selectable?(e.openBlock(),e.createBlock(e.unref(f.ElDropdownItem),{key:0,command:"select"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportSelect")),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(f.ElDropdownItem),{command:"page"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportPage")),1)]),_:1}),e.createVNode(e.unref(f.ElDropdownItem),{command:"all"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("exportAll")),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createElementVNode("div",ee,[e.createVNode(e.unref(f.ElButton),{type:"warning",loading:t.export.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("export")),1)]),_:1},8,["loading"])])]),_:1},8,["onCommand"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"tools-left")]),e.createElementVNode("div",te,[e.renderSlot(n.$slots,"tools-right"),p.option.tools?.refresh===void 0||p.option.tools?.refresh?(e.openBlock(),e.createElementBlock("div",{key:0,class:"refresh-btn",onClick:i[3]||(i[3]=(...o)=>t.table.getList&&t.table.getList(...o))},[e.createVNode(J)])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",oe,[e.createElementVNode("div",le,[e.withDirectives((e.openBlock(),e.createBlock(e.unref(f.ElTable),e.mergeProps({data:t.table.data,border:p.option.table?.border===void 0?!0:p.option.table?.border},p.option.table,{onSelectionChange:t.table.selection.change,"expand-row-keys":t.table.expand.rowKeys,onExpandChange:t.table.expand.change}),{default:e.withCtx(()=>[p.option.table?.selectable&&(e.unref(d)(p.option.tools?.delete)||p.option.tools?.export?.show)?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),{key:0,type:"selection",selectable:typeof p.option.table?.selectable=="function"?p.option.table?.selectable:void 0,width:"55"},null,8,["selectable"])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.table.column.list,o=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:o.key},[t.table.column.show.list.includes(o.key)?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),e.mergeProps({key:0,prop:o.key,label:o.label},{ref_for:!0},o.table),{default:e.withCtx(({row:a})=>[p.option.table?.inlineEdit&&t.inlineEdit.row===a&&(o.type==="input"||o.type==="select")?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[o.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:t.inlineEdit.form[o.key],"onUpdate:modelValue":u=>t.inlineEdit.form[o.key]=u},{ref_for:!0},o.options?.input,{size:"small",style:{width:"100%"},onKeyup:e.withKeys(t.inlineEdit.submit,["enter"])}),null,16,["modelValue","onUpdate:modelValue","onKeyup"])):o.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:1,modelValue:t.inlineEdit.form[o.key],"onUpdate:modelValue":u=>t.inlineEdit.form[o.key]=u},{ref_for:!0},o.options?.select,{size:"small",style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue"])):e.createCommentVNode("",!0)],64)):e.renderSlot(n.$slots,"table-"+o.key,{key:1,row:a,item:o},()=>[o.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:0,modelValue:a[o.key],"onUpdate:modelValue":u=>a[o.key]=u,"before-change":()=>o.options?.switch?.tableBeforeChange?.(o.key,a)},{ref_for:!0},o.options?.switch),null,16,["modelValue","onUpdate:modelValue","before-change"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle({"--table-text-click-color":e.unref(y).config.table.click.color}),class:e.normalizeClass({"table-text-click":o.table?.click?.callback}),onClick:u=>o.table?.click?.callback?.(a)},e.toDisplayString(a[o.key]),15,ae))])]),_:2},1040,["prop","label"])):e.createCommentVNode("",!0)],64))),128)),e.unref(d)(p.option.tools?.add)||e.unref(d)(p.option.tools?.update)||e.unref(d)(p.option.tools?.delete)||n.$slots["table-op-left"]||n.$slots["table-op-right"]?(e.openBlock(),e.createBlock(e.unref(f.ElTableColumn),{key:1,label:e.unref(k).tCurd("operation"),width:"180",align:"center",fixed:"right"},{default:e.withCtx(({row:o})=>[e.renderSlot(n.$slots,"table-op-left",{row:o}),e.unref(d)(p.option.tools?.add,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,link:"",type:"primary",onClick:a=>t.update.open(e.unref(c).Insert,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("add")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),p.option.table?.inlineEdit&&t.inlineEdit.row===o?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(f.ElButton),{link:"",onClick:t.inlineEdit.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("cancel")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{link:"",type:"primary",onClick:t.inlineEdit.submit,loading:t.inlineEdit.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirm")),1)]),_:1},8,["onClick","loading"]),e.renderSlot(n.$slots,"table-op-edit-right",{row:o})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.unref(d)(p.option.tools?.update,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:0,link:"",type:"warning",onClick:a=>t.update.open(e.unref(c).Update,o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("edit")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.unref(d)(p.option.tools?.delete,o)?(e.openBlock(),e.createBlock(e.unref(f.ElButton),{key:1,link:"",type:"danger",onClick:a=>t.remove.open([o])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("delete")),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"table-op-right",{row:o})],64))]),_:3},8,["label"])):e.createCommentVNode("",!0)]),_:3},16,["data","border","onSelectionChange","expand-row-keys","onExpandChange"])),[[l,t.table.loading]])])]),e.createElementVNode("div",ne,[e.createVNode(e.unref(f.ElPagination),{"current-page":t.page.num,"onUpdate:currentPage":i[4]||(i[4]=o=>t.page.num=o),"page-size":t.page.size,"onUpdate:pageSize":i[5]||(i[5]=o=>t.page.size=o),background:"","page-sizes":t.page.sizeList,"pager-count":7,layout:t.page.layout,total:t.page.total,onSizeChange:t.table.getList,onCurrentChange:t.table.getList},null,8,["current-page","page-size","page-sizes","layout","total","onSizeChange","onCurrentChange"])])]),e.renderSlot(n.$slots,"box-right")]),e.createVNode(e.unref(f.ElDialog),e.mergeProps({modelValue:t.update.show,"onUpdate:modelValue":i[6]||(i[6]=o=>t.update.show=o),title:t.update.title,"close-on-click-modal":!1,"before-close":t.update.close},p.option.dialog),{footer:e.withCtx(()=>[e.createElementVNode("span",ie,[e.createVNode(e.unref(f.ElButton),{onClick:t.update.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{type:"primary",onClick:t.update.submit,loading:t.update.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("submit")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createVNode(e.unref(f.ElForm),{ref_key:"ruleFormRef",ref:h,model:t.update.form,rules:t.update.rules},{default:e.withCtx(()=>[t.update.showContent?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.update.formColumn,o=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(o.map(a=>a.item.show?.form),t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["row curd-row",{stripe:p.option.form?.stripe===void 0?!0:p.option.form?.stripe}])},[e.renderSlot(n.$slots,"form-start",{row:t.update.form}),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o,a=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.unref(d)(a.item.show?.form,t.update.form)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(a.item.form.span>0?`col-${a.item.form.span}`:"col")},[e.createVNode(e.unref(f.ElFormItem),{class:e.normalizeClass({"hide-label":typeof a.item.text?.form?.label=="boolean"?!a.item.text?.form?.label:!1}),label:typeof a.item.text?.form?.label=="string"?a.item.text?.form?.label:a.item.label,prop:a.item.key,"label-width":a.item.form?.labelWidth||"100px"},{default:e.withCtx(()=>[e.createElementVNode("div",re,[e.renderSlot(n.$slots,"form-"+a.item.key+"-start",{row:t.update.form,item:a.item}),e.createElementVNode("div",se,[e.renderSlot(n.$slots,"form-"+a.item.key,{row:t.update.form,item:a.item},()=>[a.item.type==="input"?(e.openBlock(),e.createBlock(e.unref(f.ElInput),e.mergeProps({key:0,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.input,e.toHandlers(a.item.options?.input?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="switch"?(e.openBlock(),e.createBlock(e.unref(f.ElSwitch),e.mergeProps({key:1,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.switch,{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="select"?(e.openBlock(),e.createBlock(e.unref(f.ElSelect),e.mergeProps({key:2,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.select,e.toHandlers(a.item.options?.select?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.item.options?.select?.data,u=>(e.openBlock(),e.createBlock(e.unref(f.ElOption),{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]),_:2},1040,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="list"?(e.openBlock(),e.createBlock(N,e.mergeProps({key:3,row:t.update.form,field:a.item.key},{ref_for:!0},a.item.options?.list,e.toHandlers(a.item.options?.list?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["row","field","disabled"])):a.item.type==="tree-select"?(e.openBlock(),e.createBlock(e.unref(f.ElTreeSelect),e.mergeProps({key:4,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.treeSelect,e.toHandlers(a.item.options?.treeSelect?.on||{}),{disabled:t.update.getDisabled(a.item),style:{width:"100%"}}),null,16,["modelValue","onUpdate:modelValue","disabled"])):a.item.type==="datetime"?(e.openBlock(),e.createBlock(e.unref(f.ElDatePicker),e.mergeProps({key:5,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.datetime,e.toHandlers(a.item.options?.datetime?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.unref(E).customComponent[a.item.type]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(E).customComponent[a.item.type]),e.mergeProps({key:6,modelValue:t.update.form[a.item.key],"onUpdate:modelValue":u=>t.update.form[a.item.key]=u},{ref_for:!0},a.item.options?.[a.item.type],e.toHandlers(a.item.options?.[a.item.type]?.on||{}),{disabled:t.update.getDisabled(a.item)}),null,16,["modelValue","onUpdate:modelValue","disabled"])):e.createCommentVNode("",!0)]),e.renderSlot(n.$slots,"form-"+a.item.key+"-right",{row:t.update.form,item:a.item})]),e.renderSlot(n.$slots,"form-"+a.item.key+"-end",{row:t.update.form,item:a.item})])]),_:2},1032,["class","label","prop","label-width"])],2)):e.createCommentVNode("",!0)],64))),256)),e.renderSlot(n.$slots,"form-end",{row:t.update.form})],2)):e.createCommentVNode("",!0)],64))),256)):e.createCommentVNode("",!0)]),_:3},8,["model","rules"])]),_:3},16,["modelValue","title","before-close"]),e.createVNode(e.unref(f.ElDialog),{modelValue:t.remove.show,"onUpdate:modelValue":i[7]||(i[7]=o=>t.remove.show=o),title:t.remove.title,"close-on-click-modal":!1},{footer:e.withCtx(()=>[e.createElementVNode("span",ce,[e.createVNode(e.unref(f.ElButton),{onClick:t.remove.close},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("close")),1)]),_:1},8,["onClick"]),e.createVNode(e.unref(f.ElButton),{type:"danger",onClick:t.remove.submit,loading:t.remove.loading},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(k).tCurd("confirmDelete")),1)]),_:1},8,["onClick","loading"])])]),default:e.withCtx(()=>[e.createElementVNode("div",null,e.toDisplayString(e.unref(k).tCurd("confirmDeleteMessage",t.remove.items.length)),1)]),_:1},8,["modelValue","title"]),e.createVNode(M,{ref_key:"switchConfirmRef",ref:m},null,512)])}}});class de{static async download(s,c="download.png"){const r=document.createElement("a");r.style.display="none",r.href=s,r.setAttribute("download",c),typeof r.download>"u"&&r.setAttribute("target","_blank"),document.body.appendChild(r),r.click(),document.body.removeChild(r),window.URL.revokeObjectURL(s)}static exportJSONFile=(s,c)=>{const r=new Blob([JSON.stringify(s)],{type:"application/json"}),m=URL.createObjectURL(r),h=document.createElement("a");h.href=m,h.download=`${c||"config"}.json`,h.click()};static importFile=async s=>new Promise((c,r)=>{const m=document.createElement("input");m.type="file";const h=s?.accept||".json";m.accept=h,m.style.display="none",m.onchange=d=>{const t=d.target.files[0];if(!t){b.fail("未选择文件"),r("未选择文件");return}const n=new FileReader;n.onload=async i=>{const l=h==".json"?JSON.parse(i.target.result):i.target.result;c(l)},n.onerror=()=>{b.fail("文件读取失败"),r("文件读取失败")},n.readAsText(t),document.body.removeChild(m)},document.body.appendChild(m),m.click()})}const $=(p,s)=>{if(p.component("TCurd",T),p.component("TFormList",N),p.component("TColumn",F),s?.customComponent){E.customComponent=s.customComponent;for(const c in s.customComponent)p.component(c,s.customComponent[c])}},pe={install:$};w.ArrUtil=B,w.ExcelUtil=O,w.TColumn=F,w.TCurd=T,w.TFile=de,w.TForm=E,w.TFormConfig=y,w.TFormList=N,w.TSys=b,w.default=pe,w.install=$,Object.defineProperties(w,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc1-form",
3
- "version": "1.1.13",
3
+ "version": "1.1.15",
4
4
  "description": "我来助你-表单组件库",
5
5
  "repository": {
6
6
  "type": "git",