@web-utils/form-ui 1.0.0-beta51 → 1.0.0-beta53

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.
Files changed (119) hide show
  1. package/chunks/{Dt3lfDnL.mjs → 7GmKqdbC.mjs} +48 -33
  2. package/chunks/{6yfBZFOB.mjs → 9MExJqL-.mjs} +4 -3
  3. package/chunks/{BQk3-Ppb2.mjs → B3yVc-P62.mjs} +38 -39
  4. package/chunks/{bFbPPcdq.mjs → B6yWUT6z.mjs} +2 -2
  5. package/chunks/BEvOkSfB.mjs +417 -0
  6. package/chunks/{D_qiRmiE.mjs → BHbMJZPp.mjs} +69 -62
  7. package/chunks/{B9gA65rt2.mjs → BJYlobMz2.mjs} +2 -2
  8. package/chunks/{CJdkjadi.mjs → BNXbI4OG.mjs} +1 -1
  9. package/chunks/{V2p-PCpL.mjs → BV-XUugQ.mjs} +3 -3
  10. package/chunks/B_RAcbs_.mjs +108 -0
  11. package/chunks/{CqVd8D222.mjs → BgTCTXs72.mjs} +4 -3
  12. package/chunks/{BtcjAHE6.mjs → BjGlxyi6.mjs} +2 -2
  13. package/chunks/{pIzhYsBe.mjs → BqC_VU52.mjs} +2 -2
  14. package/chunks/{eae6huQB.mjs → BqzJ6vY6.mjs} +2 -2
  15. package/chunks/ByTyNsWf.mjs +653 -0
  16. package/chunks/{BfxDxIg0.mjs → CB9QUXUX.mjs} +2 -2
  17. package/chunks/CGDnQr1c.mjs +67 -0
  18. package/chunks/{DKwp6AMl.mjs → CGuDBVCB.mjs} +4 -3
  19. package/chunks/{C7G-cAoI.mjs → CPvdsnRN.mjs} +1 -1
  20. package/chunks/{Bwbtu2cp.mjs → CgN7m-1v.mjs} +4 -3
  21. package/chunks/{D_Fs3bkZ.mjs → D5EQJdPL.mjs} +3 -3
  22. package/chunks/D7R9Or2m2.mjs +87 -0
  23. package/chunks/D9IFsT272.mjs +513 -0
  24. package/chunks/{CuAoMR3n.mjs → DFFNxlqD.mjs} +5 -16
  25. package/chunks/{BWh6u1O0.mjs → DWMePN6q.mjs} +1 -1
  26. package/chunks/{CAd1zK9Q.mjs → DawYTjoT.mjs} +2 -2
  27. package/chunks/{BqWvBF14.mjs → DjnHvHXo.mjs} +2 -2
  28. package/chunks/{CabldOLo.mjs → DwkOWXIR.mjs} +6 -5
  29. package/chunks/{BQyL45PF2.mjs → DyCO22Ia2.mjs} +1 -1
  30. package/chunks/{B1IPSTA6.mjs → Dytof5EW.mjs} +2 -2
  31. package/chunks/{wXeqV-_7.mjs → H70Z56YY.mjs} +9 -3
  32. package/chunks/{BBERmTup.mjs → XoImEoke.mjs} +19 -4
  33. package/chunks/{ByHz4mmh.mjs → XwerN1TU.mjs} +2 -2
  34. package/chunks/{DA7oGHSX.mjs → c0Niqotr.mjs} +2 -2
  35. package/chunks/{C2zgFLYO.mjs → oVFbZ6yk.mjs} +30 -30
  36. package/chunks/{BbSPWDDZ.mjs → z5FJgzdc.mjs} +4 -3
  37. package/constants/index.d.ts +1 -0
  38. package/editable-tree/index.mjs +1 -1
  39. package/element-dialog/index.d.ts +2 -2
  40. package/form-cascader/index.d.ts +8 -2
  41. package/form-cascader/index.mjs +1 -1
  42. package/form-checkbox/index.d.ts +10 -4
  43. package/form-checkbox/index.mjs +1 -1
  44. package/form-checkbox-group/index.d.ts +8 -2
  45. package/form-checkbox-group/index.mjs +1 -1
  46. package/form-date-picker/index.d.ts +8 -2
  47. package/form-date-picker/index.mjs +1 -1
  48. package/form-holder/index.mjs +1 -1
  49. package/form-image/index.d.ts +8 -2
  50. package/form-image/index.mjs +1 -1
  51. package/form-input/index.d.ts +8 -2
  52. package/form-input/index.mjs +1 -1
  53. package/form-input-cron-expression/index.d.ts +8 -2
  54. package/form-input-cron-expression/index.mjs +1 -1
  55. package/form-input-email/index.d.ts +8 -2
  56. package/form-input-email/index.mjs +1 -1
  57. package/form-input-id-card/index.d.ts +8 -2
  58. package/form-input-id-card/index.mjs +1 -1
  59. package/form-input-number/index.d.ts +8 -2
  60. package/form-input-number/index.mjs +1 -1
  61. package/form-input-phone-number/index.d.ts +8 -2
  62. package/form-input-phone-number/index.mjs +1 -1
  63. package/form-input-tag/index.d.ts +8 -2
  64. package/form-input-tag/index.mjs +1 -1
  65. package/form-input-time/index.d.ts +8 -2
  66. package/form-input-time/index.mjs +1 -1
  67. package/form-item-group/index.mjs +1 -1
  68. package/form-item-x/index.d.ts +8 -2
  69. package/form-item-x/index.mjs +1 -1
  70. package/form-item-x/style.css +1 -1
  71. package/form-radio-group/index.d.ts +8 -2
  72. package/form-radio-group/index.mjs +1 -1
  73. package/form-rate/index.d.ts +8 -2
  74. package/form-rate/index.mjs +1 -1
  75. package/form-select/index.d.ts +8 -2
  76. package/form-select/index.mjs +1 -1
  77. package/form-slider/index.d.ts +8 -2
  78. package/form-slider/index.mjs +1 -1
  79. package/form-switch/index.d.ts +8 -2
  80. package/form-switch/index.mjs +1 -1
  81. package/form-table/index.d.ts +43 -25
  82. package/form-table/index.mjs +1 -1
  83. package/form-table-plus/index.d.ts +8 -8
  84. package/form-table-plus/index.mjs +1 -1
  85. package/form-text/index.d.ts +8 -2
  86. package/form-text/index.mjs +1 -1
  87. package/form-textarea/index.d.ts +12 -12
  88. package/form-textarea/index.mjs +1 -1
  89. package/form-time-select/index.d.ts +8 -2
  90. package/form-time-select/index.mjs +1 -1
  91. package/helper/sub-table-plus.d.ts +38 -0
  92. package/helper/sub-table-plus.mjs +4 -0
  93. package/index.css +1 -1
  94. package/index.mjs +35 -35
  95. package/package.json +1 -1
  96. package/pageable-table/index.d.ts +11 -11
  97. package/pageable-table/index.mjs +1 -1
  98. package/sub-table/index.d.ts +36 -30
  99. package/sub-table/index.mjs +2 -537
  100. package/sub-table-plus/index.d.ts +11 -2
  101. package/sub-table-plus/index.mjs +1 -1
  102. package/table-column/index.d.ts +8 -5
  103. package/table-column/index.mjs +1 -1
  104. package/table-column-def/index.d.ts +14 -12
  105. package/table-column-def/index.mjs +1 -1
  106. package/table-view/index.d.ts +4 -0
  107. package/table-view/index.mjs +16 -8
  108. package/toolbar/index.mjs +1 -1
  109. package/toolbar-button/index.mjs +1 -1
  110. package/toolbar-button/style.css +1 -0
  111. package/vue-cron/index.mjs +1 -1
  112. package/web-types.json +1 -1
  113. package/x-input-tag/index.mjs +1 -1
  114. package/chunks/BG8z3V9d2.mjs +0 -643
  115. package/chunks/BsZgAJX_2.mjs +0 -81
  116. package/chunks/YFiU0ngn.mjs +0 -622
  117. package/chunks/gCeDFHo1.mjs +0 -32
  118. package/chunks/hlha6Bhc.mjs +0 -107
  119. package/chunks/wDS9KBFw.mjs +0 -67
@@ -2,11 +2,11 @@ import { f as e } from "./DcTVYqeJ.mjs";
2
2
  import { hasAuthority as t } from "../api/index.mjs";
3
3
  import { toolbarContextKey as n } from "../constants/index.mjs";
4
4
  import { isArray as r, isFunction as i } from "@web-utils/core";
5
- import { computed as a, createVNode as o, defineComponent as s, getCurrentInstance as c, inject as l, mergeProps as u, ref as d } from "vue";
6
- import { ElMessage as f, ElMessageBox as p } from "element-plus";
7
- import { ElButton as m } from "element-plus/es";
5
+ import { computed as a, createVNode as o, getCurrentInstance as s, inject as c, mergeProps as l, ref as u } from "vue";
6
+ import { ElMessage as d, ElMessageBox as f } from "element-plus";
7
+ import { ElButton as p } from "element-plus/es";
8
8
  //#region src/components/toolbar/button.ts
9
- var h = {
9
+ var m = {
10
10
  size: {
11
11
  type: String,
12
12
  default: "default"
@@ -91,34 +91,49 @@ var h = {
91
91
  title: String,
92
92
  cancelButtonText: String,
93
93
  confirmButtonText: String
94
- }, g = {
94
+ }, h = {
95
95
  icon: !0,
96
96
  type: !0,
97
97
  text: !0,
98
98
  title: !0,
99
99
  disabled: !0,
100
- loading: !0
101
- }, _ = (e) => g[e] !== !0, v = /* @__PURE__ */ s({
100
+ loading: !0,
101
+ label: !0,
102
+ loadable: !0,
103
+ footer: !0,
104
+ primary: !0,
105
+ warning: !0,
106
+ privilege: !0,
107
+ condition: !0,
108
+ conditionTips: !0,
109
+ confirm: !0,
110
+ confirmTips: !0,
111
+ beforeExecute: !0,
112
+ afterExecute: !0,
113
+ route: !0,
114
+ cancelButtonText: !0,
115
+ confirmButtonText: !0
116
+ }, g = (e) => h[e] !== !0, _ = {
102
117
  name: "ToolbarButton",
103
118
  inheritAttrs: !1,
104
- props: { ...h },
105
- setup(s, { attrs: h, slots: g }) {
106
- let v = c(), y = l(n, null), b = d(!1), x = a(() => s.privilege ? t(s.privilege) : !0), S = async (e) => {
119
+ props: { ...m },
120
+ setup(m, { attrs: h, slots: _ }) {
121
+ let v = s(), y = c(n, null), b = u(!1), x = a(() => m.privilege ? t(m.privilege) : !0), S = async (e) => {
107
122
  try {
108
- if (i(s.beforeExecute) && await s.beforeExecute() === !1) return;
109
- if (s.conditionTips) {
123
+ if (i(m.beforeExecute) && await m.beforeExecute() === !1) return;
124
+ if (m.conditionTips) {
110
125
  let e;
111
- if (e = r(s.condition) ? s.condition.length <= 0 : i(s.condition) ? !s.condition() : !s.condition, e) {
112
- f.warning(s.conditionTips);
126
+ if (e = r(m.condition) ? m.condition.length <= 0 : i(m.condition) ? !m.condition() : !m.condition, e) {
127
+ d.warning(m.conditionTips);
113
128
  return;
114
129
  }
115
130
  }
116
- if (s.confirm || s.confirmTips) try {
117
- await p.confirm(s.confirmTips || "你确定要删除该记录吗?", "系统提示", {
131
+ if (m.confirm || m.confirmTips) try {
132
+ await f.confirm(m.confirmTips || "你确定要删除该记录吗?", "系统提示", {
118
133
  type: "warning",
119
134
  distinguishCancelAndClose: !0,
120
- cancelButtonText: s.cancelButtonText,
121
- confirmButtonText: s.confirmButtonText
135
+ cancelButtonText: m.cancelButtonText,
136
+ confirmButtonText: m.confirmButtonText
122
137
  });
123
138
  } catch (e) {
124
139
  if (e === "cancel") {
@@ -132,35 +147,35 @@ var h = {
132
147
  }
133
148
  b.value = !0;
134
149
  let n;
135
- if (s.route) {
150
+ if (m.route) {
136
151
  var t;
137
- await ((t = v.proxy.$router) == null ? void 0 : t.push(s.route));
152
+ await ((t = v.proxy.$router) == null ? void 0 : t.push(m.route));
138
153
  } else {
139
154
  let { onClick: t } = h;
140
155
  if (i(t)) try {
141
156
  n = await t(e);
142
157
  } catch {}
143
158
  }
144
- b.value = !1, i(s.afterExecute) && await s.afterExecute(n);
159
+ b.value = !1, i(m.afterExecute) && await m.afterExecute(n);
145
160
  } catch {}
146
- }, C = a(() => s.text ? !0 : s.type === "text"), w = a(() => {
147
- if (!C.value) return s.primary ? "primary" : s.warning ? "warning" : s.type;
148
- }), T = e(s, _);
149
- return () => x.value ? o(m, u(T.value, {
150
- title: s.footer || y != null && y.footer ? null : s.title,
151
- disabled: s.disabled || b.value,
152
- loading: s.loadable ? b.value : !1,
161
+ }, C = a(() => m.text ? !0 : m.type === "text"), w = a(() => {
162
+ if (!C.value) return m.primary ? "primary" : m.warning ? "warning" : m.type;
163
+ }), T = e(m, g);
164
+ return () => x.value ? o(p, l(T.value, {
165
+ title: m.footer || y != null && y.footer ? null : m.title,
166
+ disabled: m.disabled || b.value,
167
+ loading: m.loadable ? b.value : !1,
153
168
  type: w.value,
154
169
  text: C.value,
155
170
  class: h.class,
156
171
  style: h.style,
157
172
  onClick: S
158
173
  }), {
159
- default: !s.circle && (s.label || g.default) ? () => g.default ? g.default() : s.label : null,
160
- loading: g.loading,
161
- icon: g.icon ? g.icon : s.icon ? () => o("i", { class: s.icon }, null) : null
174
+ default: !m.circle && (m.label || _.default) ? () => _.default ? _.default() : m.label : null,
175
+ loading: _.loading,
176
+ icon: _.icon ? _.icon : m.icon ? () => o("i", { class: m.icon }, null) : null
162
177
  }) : null;
163
178
  }
164
- });
179
+ };
165
180
  //#endregion
166
- export { v as t };
181
+ export { _ as t };
@@ -1,5 +1,5 @@
1
- import { i as e, n as t } from "./D_qiRmiE.mjs";
2
- import { n, t as r } from "./CJdkjadi.mjs";
1
+ import { i as e, n as t } from "./BHbMJZPp.mjs";
2
+ import { n, t as r } from "./BNXbI4OG.mjs";
3
3
  import i from "../x-input-tag/index.mjs";
4
4
  import { createVNode as a, mergeProps as o } from "vue";
5
5
  //#region src/components/form/props/input-tag.ts
@@ -41,7 +41,8 @@ var s = {
41
41
  emit: n,
42
42
  slots: r,
43
43
  attrs: s,
44
- predicate: l
44
+ predicate: l,
45
+ block: t.block === void 0 ? !0 : t.block
45
46
  });
46
47
  return () => u({ vNodes: a(i, o(p.value, m.value, {
47
48
  style: "width: 100%",
@@ -1,33 +1,30 @@
1
1
  import { i as e } from "./DcTVYqeJ.mjs";
2
- import { i as t, n } from "./D_qiRmiE.mjs";
3
- import { n as r, t as i } from "./CJdkjadi.mjs";
4
- import { r as a } from "./CabldOLo.mjs";
5
- import { n as o } from "./gCeDFHo1.mjs";
6
- import { n as s, t as c } from "./BG8z3V9d2.mjs";
7
- import { isArray as l, isString as u, trace as d, warning as f } from "@web-utils/core";
8
- import { computed as p, createVNode as m, getCurrentInstance as h, mergeProps as g, useModel as _, useTemplateRef as v } from "vue";
9
- import { useEventBus as y } from "@web-utils/vue/hooks/useEventBus";
10
- //#endregion
11
- //#region src/components/form/FormTablePlus.vue
12
- var b = {
2
+ import { i as t, n } from "./BHbMJZPp.mjs";
3
+ import { n as r, t as i } from "./BNXbI4OG.mjs";
4
+ import { r as a } from "./DwkOWXIR.mjs";
5
+ import { n as o, t as s } from "./D9IFsT272.mjs";
6
+ import { isArray as c, isString as l, trace as u, warning as d } from "@web-utils/core";
7
+ import { computed as f, createVNode as p, getCurrentInstance as m, mergeProps as h, useModel as g, useTemplateRef as _ } from "vue";
8
+ import { useEventBus as v } from "@web-utils/vue/hooks/useEventBus";
9
+ //#region src/components/table/form-table-plus.ts
10
+ var y = {
11
+ ...r,
12
+ ...i,
13
+ ...o,
14
+ rowDbClick: Function,
15
+ viewId: [String, Array],
16
+ formPath: [String, Function]
17
+ }, b = {
18
+ readonly: !0,
19
+ block: !0
20
+ }, x = (e) => r[e] === void 0 && b[e] !== !0, S = {
13
21
  name: "FormTablePlus",
14
- props: {
15
- ...r,
16
- ...i,
17
- ...s,
18
- rowDbClick: Function,
19
- viewId: [String, Array],
20
- block: {
21
- type: Boolean,
22
- default: !0
23
- },
24
- formPath: [String, Function]
25
- },
22
+ props: { ...y },
26
23
  emits: { ...n },
27
- setup(n, { emit: r, slots: i, attrs: s, expose: b }) {
28
- let x = _(n, "modelValue"), S = v("table"), C = [];
24
+ setup(n, { emit: r, slots: i, attrs: o, expose: y }) {
25
+ let b = g(n, "modelValue"), S = _("table"), C = [];
29
26
  n.viewId && C.push(n.viewId);
30
- let w = h();
27
+ let w = m();
31
28
  C.includes(w.parent.proxy.$options.name) || C.push(w.parent.proxy.$options.name);
32
29
  let T = () => {
33
30
  var e;
@@ -36,27 +33,28 @@ var b = {
36
33
  var e;
37
34
  return await ((e = S.value.table) == null ? void 0 : e.refreshTable());
38
35
  };
39
- y("reloadTableView", (e) => {
40
- if (C) if (u(e) || l(e)) {
36
+ v("reloadTableView", (e) => {
37
+ if (C) if (l(e) || c(e)) {
41
38
  let t = e;
42
- u(t) && (t = t.split(",")), C.some((e) => t.includes(e)) && (d.call(w.parent.proxy || {}, "reloadTableView"), T());
43
- } else f.call(w.parent.proxy || {}, "`viewId`的类型必须是字符串或数组");
39
+ l(t) && (t = t.split(",")), C.some((e) => t.includes(e)) && (u.call(w.parent.proxy || {}, "reloadTableView"), T());
40
+ } else d.call(w.parent.proxy || {}, "`viewId`的类型必须是字符串或数组");
44
41
  });
45
42
  let D = (...t) => {
46
43
  n.rowDbClick ? n.rowDbClick(...t) : w.proxy.$router.push(e(n.formPath, t[0]));
47
44
  }, O = () => {
48
45
  w.proxy.$router.push(e(n.formPath));
49
46
  }, { render: k, placeholder: A, disabled: j, listeners: M, inputProps: N } = t(n, {
50
- rules: p(() => [n.fetchApi ? {
47
+ rules: f(() => [n.fetchApi ? {
51
48
  required: !0,
52
49
  validator: a
53
50
  } : { required: !0 }]),
54
51
  emit: r,
55
52
  slots: i,
56
- attrs: s,
57
- predicate: o
53
+ attrs: o,
54
+ predicate: x,
55
+ block: n.block === void 0 ? !0 : n.block
58
56
  });
59
- return b({
57
+ return y({
60
58
  reloadTable: T,
61
59
  refreshTable: E
62
60
  }), () => {
@@ -75,12 +73,13 @@ var b = {
75
73
  });
76
74
  };
77
75
  }
78
- return k({ vNodes: m(c, g({ ref: "table" }, M.value, N.value, {
76
+ return k({ vNodes: p(s, h({ ref: "table" }, M.value, N.value, {
79
77
  prop: n.prop,
80
78
  disabled: j.value,
81
- "on-row-db-click": D,
82
- modelValue: x.value,
83
- "onUpdate:modelValue": (e) => x.value = e,
79
+ onRowDbClick: D,
80
+ rowDbClick: D,
81
+ modelValue: b.value,
82
+ "onUpdate:modelValue": (e) => b.value = e,
84
83
  placeholder: A.value,
85
84
  onAddRow: O
86
85
  }), {
@@ -143,4 +142,4 @@ var b = {
143
142
  }
144
143
  };
145
144
  //#endregion
146
- export { b as t };
145
+ export { S as t };
@@ -1,5 +1,5 @@
1
- import { n as e } from "./D_qiRmiE.mjs";
2
- import { n as t, t as n } from "./CabldOLo.mjs";
1
+ import { n as e } from "./BHbMJZPp.mjs";
2
+ import { n as t, t as n } from "./DwkOWXIR.mjs";
3
3
  import { createVNode as r, isVNode as i, mergeProps as a, useModel as o } from "vue";
4
4
  //#region src/components/form/FormInputPhoneNumber.vue?vue&type=script&lang.jsx
5
5
  function s(e) {
@@ -0,0 +1,417 @@
1
+ import { t as e } from "./DOZRzqlo.mjs";
2
+ import { t } from "./7GmKqdbC.mjs";
3
+ import { t as n } from "./CkOD-_VV.mjs";
4
+ import { n as r } from "./BHbMJZPp.mjs";
5
+ import { t as i } from "./CgN7m-1v.mjs";
6
+ import { t as a } from "./DwkOWXIR.mjs";
7
+ import { t as o } from "./BV-XUugQ.mjs";
8
+ import { t as s } from "./Dytof5EW.mjs";
9
+ import { t as c } from "./z5FJgzdc.mjs";
10
+ import { t as l } from "./B6yWUT6z.mjs";
11
+ import { t as u } from "./BjGlxyi6.mjs";
12
+ import { t as d } from "./ByTyNsWf.mjs";
13
+ import f from "../table-column-def/index.mjs";
14
+ import { t as p } from "./DFFNxlqD.mjs";
15
+ import { findTreeChildren as m, isFunction as h } from "@web-utils/core";
16
+ import { Fragment as g, createBlock as _, createCommentVNode as v, createElementBlock as y, createElementVNode as b, createSlots as x, createTextVNode as S, createVNode as C, mergeProps as w, openBlock as T, renderList as E, renderSlot as D, resolveComponent as O, toDisplayString as k, withCtx as A, withModifiers as j } from "vue";
17
+ import { formContextKey as M, formItemContextKey as N } from "element-plus";
18
+ import { cloneDeep as P } from "@web-utils/integrations/lodash";
19
+ //#region src/components/table/sub-table.ts
20
+ var F = {
21
+ modelValue: Array,
22
+ columns: Array,
23
+ allowEmpty: Boolean,
24
+ handleColumn: {
25
+ type: Boolean,
26
+ default: !0
27
+ },
28
+ editable: Boolean,
29
+ showHandleColumnAddButton: {
30
+ type: Boolean,
31
+ default: !0
32
+ },
33
+ showEmptyAddButton: {
34
+ type: Boolean,
35
+ default: !0
36
+ },
37
+ prop: String,
38
+ limit: {
39
+ type: Number,
40
+ default: Infinity
41
+ },
42
+ maxLimit: {
43
+ type: Number,
44
+ default: Infinity
45
+ },
46
+ disabled: {
47
+ type: Boolean,
48
+ default: void 0
49
+ },
50
+ showSummary: Boolean,
51
+ selectionWidth: String,
52
+ fetchApi: Function,
53
+ delApi: Function
54
+ }, I = {
55
+ name: "SubTable",
56
+ emits: {
57
+ ...r,
58
+ "add-row": null
59
+ },
60
+ inject: {
61
+ elForm: {
62
+ from: M,
63
+ default: ""
64
+ },
65
+ elFormItem: {
66
+ from: N,
67
+ default: ""
68
+ }
69
+ },
70
+ props: { ...F },
71
+ data() {
72
+ return {
73
+ rows: [],
74
+ selectedRows: []
75
+ };
76
+ },
77
+ computed: {
78
+ available() {
79
+ return this.editable && this.enabled;
80
+ },
81
+ enabled() {
82
+ return !this.disabled;
83
+ },
84
+ rowProps() {
85
+ let e = {};
86
+ return this.columns && this.columns.map((e) => e.prop).forEach((t) => {
87
+ e[t] = null;
88
+ }), e;
89
+ },
90
+ filteredColumns() {
91
+ return this.columns.filter((e) => e.label && !e.hide && !e.slot);
92
+ }
93
+ },
94
+ watch: {
95
+ modelValue: {
96
+ deep: !0,
97
+ immediate: !0,
98
+ handler(e) {
99
+ this.rows = e || [];
100
+ }
101
+ },
102
+ rows: {
103
+ deep: !0,
104
+ immediate: !0,
105
+ handler(e) {
106
+ this.$emit("update:modelValue", e);
107
+ }
108
+ }
109
+ },
110
+ methods: {
111
+ getCellType(e, t) {
112
+ return h(t.getType) ? t.getType(e, t) : t.type;
113
+ },
114
+ getInputAttr(e, t, n) {
115
+ var r;
116
+ let i = {
117
+ ...t.attrs,
118
+ ...t.getAttrs ? t.getAttrs(e) : {}
119
+ };
120
+ return i.modelValue = e[t.prop], i.label = t.label, i.wrapCol = !1, i.required = t.required, i.disabled = (r = t.isDisabled) == null ? void 0 : r.call(t, e), i.prop = `${this.prop}[${n}].${t.prop}`, this.getCellType(e, t) === "select" ? i.options = t.options : this.getCellType(e, t) === "textarea" ? i.rows = t.rows || "3" : this.getCellType(e, t) === "cascader" ? (i.labelKey = t.labelKey, i.valueKey = t.valueKey) : this.getCellType(e, t) === "department" && (i.ouType = t.ouType), i;
121
+ },
122
+ isInputDisabled(e, t) {
123
+ return t.isDisabled && t.isDisabled(e);
124
+ },
125
+ onInput(e, t, n) {
126
+ n.setValue ? n.setValue(e, t, n, this.rows) : e[n.prop] = t;
127
+ },
128
+ onSelectionChange(e) {
129
+ this.selectedRows = e;
130
+ },
131
+ remove(e, t) {
132
+ try {
133
+ this.rows.splice(t, 1);
134
+ } catch {}
135
+ },
136
+ add(e, t) {
137
+ let n = P(this.rowProps);
138
+ this.rows.splice(t + 1, 0, n);
139
+ },
140
+ addRow() {
141
+ this.$emit("add-row");
142
+ },
143
+ async delRow() {
144
+ if (!this.selectedRows.length) {
145
+ this.$message.warning("请选择要删除的记录!");
146
+ return;
147
+ }
148
+ try {
149
+ if (this.delApi) try {
150
+ await this.delApi(this.selectedRows.map((e) => e.id).join(",")), this.refresh();
151
+ } catch {
152
+ this.$message.error("删除失败!");
153
+ }
154
+ else this.$emit("update:modelValue", this.rows.filter((e) => !this.selectedRows.includes(e)));
155
+ this.$message.success("删除成功!");
156
+ } catch {}
157
+ },
158
+ refresh() {
159
+ this.$refs.table.getPage();
160
+ },
161
+ getVal(e, t, n) {
162
+ var r, i;
163
+ if (n.type === "select" && (r = n.attrs) != null && r.options) {
164
+ let r = n.attrs.options.find((n) => n.code === e[t.property]);
165
+ if (r) return r.name;
166
+ }
167
+ if (n.type === "cascader" && (i = n.attrs) != null && i.options) {
168
+ let [r] = m(n.attrs.options, (r) => r[n.attrs.valueKey || "value"] === e[t.property]);
169
+ if (r) return r[n.attrs.valueKey || "label"];
170
+ }
171
+ return e[t.property];
172
+ }
173
+ }
174
+ }, L = {
175
+ key: 0,
176
+ class: "table-header"
177
+ }, R = {
178
+ key: 0,
179
+ style: { color: "#f56c6c" }
180
+ }, z = ["onClick"];
181
+ function B(n, r, m, h, M, N) {
182
+ let P = t, F = a, I = l, B = O("FormInputUser"), V = O("FormInputDepartment"), H = u, U = s, W = i, G = o, K = c, q = p, J = e, Y = f, X = d;
183
+ return T(), _(X, w({
184
+ ref: "table",
185
+ class: "sub-table",
186
+ "auto-height": "",
187
+ data: M.rows,
188
+ api: n.fetchApi,
189
+ "show-summary": n.showSummary,
190
+ "selection-width": n.selectionWidth
191
+ }, n.$attrs, {
192
+ "hide-on-single-page": "",
193
+ selection: N.enabled,
194
+ "row-db-click": n.rowDbClick,
195
+ onSelectionChange: N.onSelectionChange
196
+ }), x({
197
+ default: A(() => [
198
+ D(n.$slots, "columns", { columns: n.columns }, () => [(T(!0), y(g, null, E(N.filteredColumns, (e) => (T(), _(Y, {
199
+ key: e.prop,
200
+ label: e.label,
201
+ width: e.width,
202
+ "dict-type": e.dictType,
203
+ clickable: e.clickable,
204
+ align: e.align,
205
+ prop: e.prop,
206
+ options: e.options,
207
+ "show-overflow-tooltip": !N.available && e.showOverflowTooltip
208
+ }, {
209
+ header: A(() => [!n.disabled && e.required ? (T(), y("span", R, "*")) : v("v-if", !0), S(" " + k(e.label), 1)]),
210
+ default: A(({ row: t, column: r, $index: i }) => [
211
+ v("tag 插槽"),
212
+ D(n.$slots, "tag", {
213
+ row: t,
214
+ column: r,
215
+ index: i
216
+ }),
217
+ v("列默认插槽,名字和 prop 保持一致"),
218
+ D(n.$slots, e.prop, {
219
+ row: t,
220
+ column: r,
221
+ index: i
222
+ }, () => {
223
+ var n;
224
+ return [N.available ? (T(), y(g, { key: 0 }, [N.getCellType(t, e) === "input" ? (T(), _(F, w({
225
+ key: 0,
226
+ ref_for: !0
227
+ }, N.getInputAttr(t, e, i), { onInput: (n) => N.onInput(t, n, e) }), null, 16, ["onInput"])) : N.getCellType(t, e) === "inputPhoneNumber" ? (T(), _(I, w({
228
+ key: 1,
229
+ ref_for: !0
230
+ }, N.getInputAttr(t, e, i), { onInput: (n) => N.onInput(t, n, e) }), null, 16, ["onInput"])) : N.getCellType(t, e) === "user" ? (T(), y(g, { key: 2 }, [e.single ? (T(), _(B, w({
231
+ key: 0,
232
+ ref_for: !0
233
+ }, N.getInputAttr(t, e, i), { onInput: (n) => N.onInput(t, n, e) }), null, 16, ["onInput"])) : (T(), _(B, w({
234
+ key: 1,
235
+ ref_for: !0
236
+ }, N.getInputAttr(t, e, i), { onInput: (n) => N.onInput(t, n, e) }), null, 16, ["onInput"]))], 64)) : N.getCellType(t, e) === "department" ? (T(), y(g, { key: 3 }, [e.single ? (T(), _(V, w({
237
+ key: 0,
238
+ ref_for: !0
239
+ }, N.getInputAttr(t, e, i), {
240
+ name: t[r.property],
241
+ "onUpdate:name": (e) => t[r.property] = e,
242
+ onInput: (n) => N.onInput(t, n, e)
243
+ }), null, 16, [
244
+ "name",
245
+ "onUpdate:name",
246
+ "onInput"
247
+ ])) : (T(), _(V, w({
248
+ key: 1,
249
+ ref_for: !0
250
+ }, N.getInputAttr(t, e, i), {
251
+ disabled: N.isInputDisabled(t, e),
252
+ onInput: (n) => N.onInput(t, n, e)
253
+ }), null, 16, ["disabled", "onInput"]))], 64)) : N.getCellType(t, e) === "select" ? (T(), _(H, w({
254
+ key: 4,
255
+ ref_for: !0
256
+ }, N.getInputAttr(t, e, i), { onInput: (n) => N.onInput(t, n, e) }), null, 16, ["onInput"])) : N.getCellType(t, e) === "datePicker" ? (T(), _(U, w({
257
+ key: 5,
258
+ ref_for: !0
259
+ }, N.getInputAttr(t, e, i), {
260
+ start: t[e.start],
261
+ "onUpdate:start": (n) => t[e.start] = n,
262
+ end: t[e.end],
263
+ "onUpdate:end": (n) => t[e.end] = n,
264
+ onInput: (n) => N.onInput(t, n, e)
265
+ }), null, 16, [
266
+ "start",
267
+ "onUpdate:start",
268
+ "end",
269
+ "onUpdate:end",
270
+ "onInput"
271
+ ])) : N.getCellType(t, e) === "cascader" ? (T(), _(W, w({
272
+ key: 6,
273
+ ref_for: !0
274
+ }, N.getInputAttr(t, e, i), { onInput: (n) => N.onInput(t, n, e) }), null, 16, ["onInput"])) : N.getCellType(t, e) === "checkbox" ? (T(), _(G, w({
275
+ key: 7,
276
+ ref_for: !0
277
+ }, N.getInputAttr(t, e, i), { onInput: (n) => N.onInput(t, n, e) }), null, 16, ["onInput"])) : N.getCellType(t, e) === "number" ? (T(), _(K, w({
278
+ key: 8,
279
+ ref_for: !0
280
+ }, N.getInputAttr(t, e, i), { onInput: (n) => N.onInput(t, n, e) }), null, 16, ["onInput"])) : N.getCellType(t, e) === "textarea" ? (T(), _(q, w({
281
+ key: 9,
282
+ ref_for: !0
283
+ }, N.getInputAttr(t, e, i), { onInput: (n) => N.onInput(t, n, e) }), null, 16, ["onInput"])) : (T(), y(g, { key: 10 }, [S(k(N.getVal(t, r, e)), 1)], 64))], 64)) : e.dicType || (n = e.options) != null && n.length ? (T(), _(J, {
284
+ key: 1,
285
+ "dict-type": e.dicType,
286
+ "id-as-value": e.idAsValue,
287
+ "label-as-value": e.labelAsValue,
288
+ column: r,
289
+ row: t,
290
+ options: e.options
291
+ }, null, 8, [
292
+ "dict-type",
293
+ "id-as-value",
294
+ "label-as-value",
295
+ "column",
296
+ "row",
297
+ "options"
298
+ ])) : (T(), y(g, { key: 2 }, [S(k(N.getVal(t, r, e)), 1)], 64))];
299
+ })
300
+ ]),
301
+ _: 2
302
+ }, 1032, [
303
+ "label",
304
+ "width",
305
+ "dict-type",
306
+ "clickable",
307
+ "align",
308
+ "prop",
309
+ "options",
310
+ "show-overflow-tooltip"
311
+ ]))), 128))]),
312
+ v(" 自定义操作列 "),
313
+ D(n.$slots, "handle", {
314
+ add: N.add,
315
+ remove: N.remove
316
+ }),
317
+ v(" 操作列 "),
318
+ (!n.modelValue || n.modelValue.length < n.limit) && !n.disabled && N.enabled && n.editable && n.handleColumn ? (T(), _(Y, {
319
+ key: 0,
320
+ label: "操作",
321
+ fixed: "right",
322
+ width: "80",
323
+ align: "center",
324
+ prop: "menu"
325
+ }, {
326
+ header: A(({ column: e, $index: t }) => [D(n.$slots, "handle-column-header", {
327
+ column: e,
328
+ index: t
329
+ }, () => [S(k(e.label), 1)])]),
330
+ default: A(({ row: e, $index: t }) => [n.showHandleColumnAddButton && n.modelValue.length < n.maxLimit ? (T(), y("i", {
331
+ key: 0,
332
+ class: "el-icon-circle-plus sub-table-handle-button table-button-add",
333
+ style: {
334
+ "margin-right": "5px",
335
+ "font-size": "20px",
336
+ cursor: "pointer"
337
+ },
338
+ title: "添加",
339
+ onClick: j((n) => N.add(e, t), ["stop"])
340
+ }, null, 8, z)) : v("v-if", !0), n.modelValue && n.modelValue.length > 1 || n.allowEmpty ? (T(), _(P, {
341
+ key: 1,
342
+ class: "el-icon-error sub-table-handle-button table-button-remove",
343
+ style: {
344
+ "font-size": "20px",
345
+ cursor: "pointer"
346
+ },
347
+ title: "删除",
348
+ confirm: "",
349
+ text: "",
350
+ message: "您确定要删除该行吗?",
351
+ onClick: j((n) => N.remove(e, t), ["stop"])
352
+ }, null, 8, ["onClick"])) : v("v-if", !0)]),
353
+ _: 3
354
+ })) : v("v-if", !0)
355
+ ]),
356
+ _: 2
357
+ }, [n.editable ? void 0 : {
358
+ name: "toolbar",
359
+ fn: A(() => [N.enabled || n.fetchApi ? (T(), y("div", L, [D(n.$slots, "toolbar", {
360
+ addRow: N.addRow,
361
+ delRow: N.delRow,
362
+ refresh: N.refresh
363
+ }, () => [N.enabled ? (T(), y(g, { key: 0 }, [C(P, {
364
+ class: "table-header-button add",
365
+ icon: "el-icon-circle-plus",
366
+ type: "text",
367
+ onClick: N.addRow
368
+ }, {
369
+ default: A(() => [...r[1] || (r[1] = [S(" 添加 ", -1)])]),
370
+ _: 1
371
+ }, 8, ["onClick"]), C(P, {
372
+ class: "table-header-button remove",
373
+ confirm: "",
374
+ message: "您确定要删除选中的记录吗?",
375
+ icon: "el-icon-error",
376
+ text: "",
377
+ onClick: N.delRow
378
+ }, {
379
+ default: A(() => [...r[2] || (r[2] = [S(" 删除 ", -1)])]),
380
+ _: 1
381
+ }, 8, ["onClick"])], 64)) : v("v-if", !0), n.fetchApi ? (T(), _(P, {
382
+ key: 1,
383
+ class: "table-header-button refresh",
384
+ icon: "el-icon-refresh-left",
385
+ text: "",
386
+ disabled: !1,
387
+ onClick: N.refresh
388
+ }, {
389
+ default: A(() => [...r[3] || (r[3] = [S(" 刷新 ", -1)])]),
390
+ _: 1
391
+ }, 8, ["onClick"])) : v("v-if", !0)])])) : v("v-if", !0)]),
392
+ key: "0"
393
+ }, n.allowEmpty && !n.disabled && n.showEmptyAddButton ? {
394
+ name: "empty",
395
+ fn: A(() => [b("i", {
396
+ class: "el-icon-circle-plus sub-table-handle-button table-button-add",
397
+ style: {
398
+ "font-size": "20px",
399
+ cursor: "pointer"
400
+ },
401
+ title: "添加",
402
+ onClick: r[0] || (r[0] = j((e) => N.add(null, 0), ["stop"]))
403
+ })]),
404
+ key: "1"
405
+ } : void 0]), 1040, [
406
+ "data",
407
+ "api",
408
+ "show-summary",
409
+ "selection-width",
410
+ "selection",
411
+ "row-db-click",
412
+ "onSelectionChange"
413
+ ]);
414
+ }
415
+ var V = /* @__PURE__ */ n(I, [["render", B]]);
416
+ //#endregion
417
+ export { F as n, V as t };