@aplus-frontend/ui 0.1.28 → 0.1.29

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 (39) hide show
  1. package/es/src/ap-field/date-range/index.vue.mjs +154 -109
  2. package/es/src/ap-field/interface.d.ts +4 -0
  3. package/es/src/ap-field/select/index.vue.mjs +4 -2
  4. package/es/src/ap-form/style/ap-form-item.css +2 -0
  5. package/es/src/ap-table/components/setting/modal/index.vue2.mjs +72 -97
  6. package/es/src/ap-table/components/setting/select-group/index.vue2.mjs +37 -33
  7. package/es/src/ap-table/components/setting/sorter/index.vue2.mjs +91 -87
  8. package/es/src/ap-table/components/setting/utils.d.ts +7 -1
  9. package/es/src/ap-table/components/setting/utils.mjs +37 -22
  10. package/es/src/ap-table/constants.d.ts +12 -0
  11. package/es/src/ap-table/hooks/use-table-column-state.d.ts +6 -2
  12. package/es/src/ap-table/hooks/use-table-column-state.mjs +101 -33
  13. package/es/src/ap-table/interface.d.ts +8 -1
  14. package/es/src/editable-table/form-item.vue.d.ts +1 -0
  15. package/es/src/editable-table/form-item.vue.mjs +63 -59
  16. package/es/src/editable-table/index.vue.d.ts +1 -0
  17. package/es/src/editable-table/index.vue.mjs +77 -72
  18. package/es/src/editable-table/interface.d.ts +6 -0
  19. package/es/src/theme/ap-form/ap-form-item.css +2 -0
  20. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  21. package/lib/src/ap-field/interface.d.ts +4 -0
  22. package/lib/src/ap-field/select/index.vue.js +1 -1
  23. package/lib/src/ap-form/style/ap-form-item.css +2 -0
  24. package/lib/src/ap-table/components/setting/modal/index.vue2.js +1 -1
  25. package/lib/src/ap-table/components/setting/select-group/index.vue2.js +1 -1
  26. package/lib/src/ap-table/components/setting/sorter/index.vue2.js +1 -1
  27. package/lib/src/ap-table/components/setting/utils.d.ts +7 -1
  28. package/lib/src/ap-table/components/setting/utils.js +1 -1
  29. package/lib/src/ap-table/constants.d.ts +12 -0
  30. package/lib/src/ap-table/hooks/use-table-column-state.d.ts +6 -2
  31. package/lib/src/ap-table/hooks/use-table-column-state.js +1 -1
  32. package/lib/src/ap-table/interface.d.ts +8 -1
  33. package/lib/src/editable-table/form-item.vue.d.ts +1 -0
  34. package/lib/src/editable-table/form-item.vue.js +1 -1
  35. package/lib/src/editable-table/index.vue.d.ts +1 -0
  36. package/lib/src/editable-table/index.vue.js +1 -1
  37. package/lib/src/editable-table/interface.d.ts +6 -0
  38. package/lib/src/theme/ap-form/ap-form-item.css +2 -0
  39. package/package.json +1 -1
@@ -1,46 +1,114 @@
1
- import { ref as d, computed as h, unref as r } from "vue";
2
- import { isDef as w } from "../../utils/index.mjs";
3
- function s(c, e) {
4
- c.forEach((n) => {
5
- var o;
6
- e(n), (o = n.children) != null && o.length && s(n.children, e);
1
+ import { ref as _, unref as i, computed as j, watchEffect as z } from "vue";
2
+ import { isDef as D } from "../../utils/index.mjs";
3
+ import G, { customCloneColumnStates as k, getColumnStateString as R } from "../components/setting/utils.mjs";
4
+ import { useInjectApTable as W } from "../context.mjs";
5
+ import { isObject as v, mergeWith as E, isBoolean as X, omit as q, isNumber as N } from "lodash-unified";
6
+ function f(r, o) {
7
+ r.forEach((t) => {
8
+ var c;
9
+ o(t), (c = t.children) != null && c.length && f(t.children, o);
7
10
  });
8
11
  }
9
- const p = (c) => {
10
- const e = d(c), n = h(() => r(e).every((t) => t.show));
11
- function o() {
12
- const t = r(e);
13
- s(t, (l) => {
14
- !l.disabled && (l.show = !0);
12
+ function H(r, o) {
13
+ if (!o)
14
+ return {};
15
+ const t = r.getItem(o);
16
+ return t ? JSON.parse(t) : {};
17
+ }
18
+ function I(r, o) {
19
+ if (v(r) && v(o))
20
+ return E({}, r, o, I);
21
+ }
22
+ const B = Number.MAX_SAFE_INTEGER, Z = (r, o) => {
23
+ const t = _(o);
24
+ let c = k(o);
25
+ const { columnsBackup: h, updateColumns: u } = W(), T = r.persistenceType || "localStorage", S = window[T];
26
+ function F() {
27
+ const e = H(
28
+ S,
29
+ r.persistenceKey
30
+ ), n = E(
31
+ {},
32
+ r.defaultValue || {},
33
+ e,
34
+ I
35
+ ), l = i(h);
36
+ function b(M, d, x) {
37
+ return M.map((s) => {
38
+ var A;
39
+ const a = (d == null ? void 0 : d[s.key]) || {}, m = {
40
+ key: s.key,
41
+ label: s.title,
42
+ show: !0,
43
+ fixed: x ? x.fixed : X(s.fixed) ? s.fixed ? "left" : void 0 : s.fixed,
44
+ disabled: !1,
45
+ ...q(a, "children")
46
+ };
47
+ return m.children = (A = s.children) != null && A.length ? b(
48
+ s.children,
49
+ a.children,
50
+ m
51
+ ) : void 0, m;
52
+ }).sort(
53
+ (s, a) => (N(s.order) ? s.order : B) - (N(a.order) ? a.order : B)
54
+ );
55
+ }
56
+ return b(l || [], n);
57
+ }
58
+ const g = j(() => i(t).every((e) => e.show));
59
+ function p() {
60
+ const e = i(t);
61
+ f(e, (n) => {
62
+ !n.disabled && (n.show = !0);
15
63
  });
16
64
  }
17
- function u() {
18
- const t = r(e);
19
- s(t, (l) => {
20
- !l.disabled && (l.show = !1);
65
+ function C() {
66
+ const e = i(t);
67
+ f(e, (n) => {
68
+ !n.disabled && (n.show = !1);
21
69
  });
22
70
  }
23
- function i() {
24
- r(n) ? u() : o();
71
+ function O() {
72
+ i(g) ? C() : p();
25
73
  }
26
- function a(t, l) {
27
- s(r(e), (f) => {
28
- f.key === t && (f.show = w(l) ? l : !f.show);
74
+ function K(e, n) {
75
+ f(i(t), (l) => {
76
+ l.key === e && (l.show = D(n) ? n : !l.show);
29
77
  });
30
78
  }
31
- function S(t) {
32
- e.value = t;
33
- }
34
- return {
35
- columnState: e,
36
- selectAll: o,
37
- unSelectAll: u,
38
- toggleSelect: a,
39
- setColumnState: S,
40
- isAllSelected: n,
41
- toggleSelectAll: i
79
+ function w(e) {
80
+ t.value = e;
81
+ }
82
+ function J(e) {
83
+ c = e;
84
+ }
85
+ function y(e) {
86
+ if (r.persistenceKey) {
87
+ const n = R(e);
88
+ S.setItem(r.persistenceKey, JSON.stringify(n));
89
+ }
90
+ }
91
+ return z(() => {
92
+ const e = F();
93
+ w(e), u == null || u(
94
+ G(
95
+ i(h),
96
+ i(e)
97
+ )
98
+ ), c = k(e), y(e);
99
+ }), {
100
+ columnState: t,
101
+ selectAll: p,
102
+ unSelectAll: C,
103
+ toggleSelect: K,
104
+ setColumnState: w,
105
+ isAllSelected: g,
106
+ toggleSelectAll: O,
107
+ columnStateBackup: c,
108
+ setColumnStateBackup: J,
109
+ cacheColumnStateIfNeeded: y
42
110
  };
43
111
  };
44
112
  export {
45
- p as useTableColumnState
113
+ Z as useTableColumnState
46
114
  };
@@ -84,7 +84,7 @@ export type ApTableSettingType = {
84
84
  /**
85
85
  * 列的默认状态
86
86
  */
87
- defaultValue?: Recordable<Omit<ApColumnState, 'children' | 'key'>>;
87
+ defaultValue?: ApTableSettingDefaultValueType;
88
88
  /**
89
89
  * 列状态变更时的回调(注意,返回的是全量状态)
90
90
  * @param val
@@ -92,6 +92,9 @@ export type ApTableSettingType = {
92
92
  */
93
93
  onChange?: (val: ApColumnState[]) => void;
94
94
  };
95
+ export type ApTableSettingDefaultValueType = Recordable<Omit<ApColumnState, 'label' | 'key' | 'children'> & {
96
+ children?: ApTableSettingDefaultValueType;
97
+ }>;
95
98
  export type ApColumnState = {
96
99
  /**
97
100
  * 列的唯一标识
@@ -117,6 +120,10 @@ export type ApColumnState = {
117
120
  * 子节点状态
118
121
  */
119
122
  children?: ApColumnState[];
123
+ /**
124
+ * 字段排序(和其同级的表头排序)
125
+ */
126
+ order?: number;
120
127
  };
121
128
  export type FieldPropsType<ReturnType, RecordType, ExtraValueType, ValueType extends ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType> = ReturnType | ((opt: Partial<{
122
129
  value: any;
@@ -12,6 +12,7 @@ declare const _default: <RecordType = any>(__VLS_props: NonNullable<Awaited<type
12
12
  setRowData: (index: number, payload: any) => void;
13
13
  addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
14
14
  scrollTo: (index: number | "end", options?: StandardBehaviorOptions) => void;
15
+ setTableData: (nextTableData: RecordType[]) => void;
15
16
  }>): void;
16
17
  attrs: any;
17
18
  slots: Readonly<{
@@ -1,18 +1,18 @@
1
- import { defineComponent as M, ref as x, unref as a, useSlots as q, watch as G, openBlock as m, createBlock as y, mergeProps as C, withCtx as d, createVNode as b, createSlots as H, createElementBlock as I, normalizeClass as W, createCommentVNode as w, createElementVNode as $, toDisplayString as Q, normalizeStyle as U, renderList as J, renderSlot as X, normalizeProps as Y, guardReactiveProps as Z } from "vue";
2
- import { Table as ee, Tooltip as te } from "ant-design-vue";
1
+ import { defineComponent as q, ref as x, unref as a, useSlots as G, watch as H, openBlock as m, createBlock as y, mergeProps as C, withCtx as d, createVNode as b, createSlots as W, createElementBlock as $, normalizeClass as Q, createCommentVNode as w, createElementVNode as U, toDisplayString as I, normalizeStyle as J, renderList as X, renderSlot as Y, normalizeProps as Z, guardReactiveProps as ee } from "vue";
2
+ import { Table as te, Tooltip as oe } from "ant-design-vue";
3
3
  import { ApForm as R } from "../ap-form/index.mjs";
4
- import { isArray as oe, isNumber as i, cloneDeep as f, omit as ae } from "lodash-unified";
4
+ import { isArray as ae, isNumber as i, cloneDeep as f, omit as le } from "lodash-unified";
5
5
  import "../config-provider/index.mjs";
6
- import { useInjectForm as le } from "../ap-form/context.mjs";
6
+ import { useInjectForm as ne } from "../ap-form/context.mjs";
7
7
  import "./style/index.css";
8
- import { isDef as c } from "../utils/index.mjs";
9
- import ne from "./hooks/use-get-columns.mjs";
10
- import { scrollToRowIndex as re, getColumnIsRequired as se } from "./utils.mjs";
11
- import { QuestionCircleOutlined as ue } from "@ant-design/icons-vue";
12
- import { useToken as de } from "ant-design-vue/es/theme/internal";
13
- import { useNamespace as me } from "../config-provider/hooks/use-namespace.mjs";
14
- import { useGlobalConfig as ie } from "../config-provider/hooks/use-global-config.mjs";
15
- const Le = /* @__PURE__ */ M({
8
+ import { isDef as p } from "../utils/index.mjs";
9
+ import re from "./hooks/use-get-columns.mjs";
10
+ import { scrollToRowIndex as ue, getColumnIsRequired as se } from "./utils.mjs";
11
+ import { QuestionCircleOutlined as de } from "@ant-design/icons-vue";
12
+ import { useToken as me } from "ant-design-vue/es/theme/internal";
13
+ import { useNamespace as ie } from "../config-provider/hooks/use-namespace.mjs";
14
+ import { useGlobalConfig as fe } from "../config-provider/hooks/use-global-config.mjs";
15
+ const Fe = /* @__PURE__ */ q({
16
16
  name: "EditableTableInner",
17
17
  __name: "form-item",
18
18
  props: {
@@ -113,101 +113,105 @@ const Le = /* @__PURE__ */ M({
113
113
  }
114
114
  },
115
115
  setup(B, {
116
- expose: k
116
+ expose: D
117
117
  }) {
118
118
  const l = B;
119
- function D(e, t) {
120
- return oe(t) ? t.reduce((o, n) => o == null ? void 0 : o[n], e) : e == null ? void 0 : e[t];
119
+ function k(e, t) {
120
+ return ae(t) ? t.reduce((o, r) => o == null ? void 0 : o[r], e) : e == null ? void 0 : e[t];
121
121
  }
122
122
  const {
123
- internalInstance: r,
124
- model: L
125
- } = le(), s = x(D(a(L), l.name) || []), T = q(), E = R.useWatch(l.name);
126
- G(() => E.value, (e) => {
123
+ internalInstance: n,
124
+ model: T
125
+ } = ne(), u = x(k(a(T), l.name) || []), F = G(), L = R.useWatch(l.name);
126
+ H(() => L.value, (e) => {
127
127
  var t;
128
- s.value = e, (t = l.onChange) == null || t.call(l, e);
128
+ u.value = e, (t = l.onChange) == null || t.call(l, e);
129
129
  }, {
130
130
  deep: !0
131
131
  });
132
132
  const {
133
- b: F,
133
+ b: E,
134
134
  em: N
135
- } = me("editable-table"), p = x(), S = ie("valueTypeMap"), [, V] = de(), _ = ne(l, S);
135
+ } = ie("editable-table"), c = x(), S = fe("valueTypeMap"), [, V] = me(), _ = re(l, S);
136
136
  function v(e, t) {
137
- var u;
138
- const o = ((u = a(s)) == null ? void 0 : u.length) || 0;
139
- if (c(l.maxLength) && o >= l.maxLength)
137
+ var s;
138
+ const o = ((s = a(u)) == null ? void 0 : s.length) || 0;
139
+ if (p(l.maxLength) && o >= l.maxLength)
140
140
  return;
141
- const n = [...a(s) || []];
142
- c(t) ? n.splice(t, 0, {
141
+ const r = [...a(u) || []];
142
+ p(t) ? r.splice(t, 0, {
143
143
  ...e || {}
144
- }) : n.push({
144
+ }) : r.push({
145
145
  ...e || {}
146
- }), r == null || r.setFieldValue(l.name, n);
146
+ }), n == null || n.setFieldValue(l.name, r);
147
147
  }
148
148
  function z(e, t = "suffix") {
149
149
  var g;
150
- const o = ((g = a(s)) == null ? void 0 : g.length) || 0, n = i(e) ? e : e.length;
151
- if (c(l.maxLength) && o + n > l.maxLength)
150
+ const o = ((g = a(u)) == null ? void 0 : g.length) || 0, r = i(e) ? e : e.length;
151
+ if (p(l.maxLength) && o + r > l.maxLength)
152
152
  return;
153
- const u = [...a(s) || []], h = i(e) ? new Array(e).fill({}) : f(e);
154
- t === "suffix" ? u.push(...h) : u.unshift(...h), r == null || r.setFieldValue(l.name, u);
153
+ const s = [...a(u) || []], h = i(e) ? new Array(e).fill({}) : f(e);
154
+ t === "suffix" ? s.push(...h) : s.unshift(...h), n == null || n.setFieldValue(l.name, s);
155
155
  }
156
156
  function P(e) {
157
- let t = f(a(s) || []);
157
+ let t = f(a(u) || []);
158
158
  const o = i(e) ? [e] : e;
159
- t = t.filter((n, u) => !o.includes(u)), r == null || r.setFieldValue(l.name, t);
159
+ t = t.filter((r, s) => !o.includes(s)), n == null || n.setFieldValue(l.name, t);
160
160
  }
161
161
  function j() {
162
- return a(s);
162
+ return a(u);
163
163
  }
164
164
  function A(e) {
165
165
  var t;
166
- return (t = a(s)) == null ? void 0 : t[e];
166
+ return (t = a(u)) == null ? void 0 : t[e];
167
167
  }
168
168
  function O(e, t) {
169
- const o = f(a(s));
169
+ const o = f(a(u));
170
170
  o[e] && (o[e] = {
171
171
  ...o[e],
172
172
  ...t
173
- }, r == null || r.setFieldValue(l.name, [...o]));
173
+ }, n == null || n.setFieldValue(l.name, [...o]));
174
174
  }
175
- function K(e, t) {
176
- var n;
177
- const o = e === "end" ? s.value.length - 1 : e;
178
- re(o, (n = p.value) == null ? void 0 : n.$el, t);
175
+ function K(e) {
176
+ n == null || n.setFieldValue(l.name, e);
179
177
  }
180
- return k({
178
+ function M(e, t) {
179
+ var r;
180
+ const o = e === "end" ? u.value.length - 1 : e;
181
+ ue(o, (r = c.value) == null ? void 0 : r.$el, t);
182
+ }
183
+ return D({
181
184
  add: v,
182
185
  remove: P,
183
186
  getRowData: A,
184
187
  getRowsData: j,
185
188
  setRowData: O,
186
189
  addMultiple: z,
187
- scrollTo: K
190
+ scrollTo: M,
191
+ setTableData: K
188
192
  }), (e, t) => (m(), y(a(R).FormItem, C(e.formItem, {
189
193
  name: e.name,
190
194
  label: e.label
191
195
  }), {
192
- default: d(() => [b(a(ee), C(a(ae)(l, ["name", "maxLength", "onChange"]), {
193
- class: a(F)(),
196
+ default: d(() => [b(a(te), C(a(le)(l, ["name", "maxLength", "onChange"]), {
197
+ class: a(E)(),
194
198
  columns: a(_),
195
- "data-source": s.value,
199
+ "data-source": u.value,
196
200
  ref_key: "tableRef",
197
- ref: p
198
- }), H({
201
+ ref: c
202
+ }), W({
199
203
  headerCell: d(({
200
204
  column: o
201
- }) => [a(se)(o) ? (m(), I("span", {
205
+ }) => [a(se)(o) ? (m(), $("span", {
202
206
  key: 0,
203
- class: W(a(N)("header-cell", "required"))
204
- }, "*", 2)) : w("", !0), $("span", null, Q(o.title), 1), o.tooltip ? (m(), y(a(te), {
207
+ class: Q(a(N)("header-cell", "required"))
208
+ }, "*", 2)) : w("", !0), U("span", null, I(o.title), 1), o.tooltip ? (m(), y(a(oe), {
205
209
  key: 1,
206
210
  title: o.tooltip,
207
211
  placement: "bottom"
208
212
  }, {
209
- default: d(() => [b(a(ue), {
210
- style: U({
213
+ default: d(() => [b(a(de), {
214
+ style: J({
211
215
  paddingLeft: "4px",
212
216
  color: a(V).colorPrimary
213
217
  })
@@ -215,14 +219,14 @@ const Le = /* @__PURE__ */ M({
215
219
  _: 2
216
220
  }, 1032, ["title"])) : w("", !0)]),
217
221
  _: 2
218
- }, [J(T, (o, n) => ({
219
- name: n,
220
- fn: d((u) => [X(e.$slots, n, Y(Z(u || {})))])
222
+ }, [X(F, (o, r) => ({
223
+ name: r,
224
+ fn: d((s) => [Y(e.$slots, r, Z(ee(s || {})))])
221
225
  }))]), 1040, ["class", "columns", "data-source"])]),
222
226
  _: 3
223
227
  }, 16, ["name", "label"]));
224
228
  }
225
229
  });
226
230
  export {
227
- Le as default
231
+ Fe as default
228
232
  };
@@ -20,6 +20,7 @@ declare const _default: <RecordType extends Recordable = any>(__VLS_props: NonNu
20
20
  addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
21
21
  scrollTo: (index: number | "end", options?: StandardBehaviorOptions) => void;
22
22
  clear: () => void;
23
+ setTableData: (nextTableData: RecordType[]) => void;
23
24
  }>): void;
24
25
  attrs: any;
25
26
  slots: Readonly<{
@@ -1,19 +1,19 @@
1
- import { defineComponent as Q, useSlots as J, ref as b, watch as R, unref as n, openBlock as p, createBlock as B, withCtx as m, createVNode as x, mergeProps as X, createSlots as Y, createElementBlock as Z, normalizeClass as ee, createCommentVNode as F, createElementVNode as te, toDisplayString as ae, normalizeStyle as oe, renderList as ne, renderSlot as le, normalizeProps as re, guardReactiveProps as se } from "vue";
2
- import { Table as ue, Tooltip as ie } from "ant-design-vue";
1
+ import { defineComponent as J, useSlots as X, ref as b, watch as R, unref as o, openBlock as p, createBlock as F, withCtx as m, createVNode as x, mergeProps as Y, createSlots as Z, createElementBlock as ee, normalizeClass as te, createCommentVNode as B, createElementVNode as ae, toDisplayString as ne, normalizeStyle as oe, renderList as le, renderSlot as re, normalizeProps as ue, guardReactiveProps as se } from "vue";
2
+ import { Table as ie, Tooltip as de } from "ant-design-vue";
3
3
  import { ApForm as y } from "../ap-form/index.mjs";
4
- import { isEqual as de, isArray as k, isNumber as g, cloneDeep as h, omit as me } from "lodash-unified";
4
+ import { isEqual as me, isArray as k, isNumber as g, cloneDeep as h, omit as fe } from "lodash-unified";
5
5
  import "../config-provider/index.mjs";
6
6
  import "../hooks/index.mjs";
7
7
  import { isDef as C } from "../utils/index.mjs";
8
- import { scrollToRowIndex as fe, getColumnIsRequired as ce } from "./utils.mjs";
9
- import pe from "./hooks/use-get-columns.mjs";
8
+ import { scrollToRowIndex as ce, getColumnIsRequired as pe } from "./utils.mjs";
9
+ import xe from "./hooks/use-get-columns.mjs";
10
10
  import "./style/index.css";
11
- import { useToken as xe } from "ant-design-vue/es/theme/internal";
12
- import { QuestionCircleOutlined as ye } from "@ant-design/icons-vue";
13
- import { useNamespace as ge } from "../config-provider/hooks/use-namespace.mjs";
14
- import { useControllableValue as he } from "../hooks/useControllableValue.mjs";
15
- import { useGlobalConfig as Ce } from "../config-provider/hooks/use-global-config.mjs";
16
- const Ae = /* @__PURE__ */ Q({
11
+ import { useToken as ye } from "ant-design-vue/es/theme/internal";
12
+ import { QuestionCircleOutlined as ge } from "@ant-design/icons-vue";
13
+ import { useNamespace as he } from "../config-provider/hooks/use-namespace.mjs";
14
+ import { useControllableValue as Ce } from "../hooks/useControllableValue.mjs";
15
+ import { useGlobalConfig as ve } from "../config-provider/hooks/use-global-config.mjs";
16
+ const ze = /* @__PURE__ */ J({
17
17
  name: "EditableTable",
18
18
  __name: "index",
19
19
  props: {
@@ -113,141 +113,146 @@ const Ae = /* @__PURE__ */ Q({
113
113
  },
114
114
  emits: ["update:value"],
115
115
  setup(V, {
116
- expose: E,
117
- emit: L
116
+ expose: T,
117
+ emit: D
118
118
  }) {
119
119
  const l = V, {
120
- b: N,
121
- em: T
122
- } = ge("editable-table"), _ = J(), D = L, v = b(), {
123
- value: s,
120
+ b: E,
121
+ em: L
122
+ } = he("editable-table"), N = X(), _ = D, v = b(), {
123
+ value: u,
124
124
  updateValue: S
125
- } = he(l, D), u = b(), [, A] = xe(), z = Ce("valueTypeMap"), c = y.useWatch(l.name, u);
125
+ } = Ce(l, _), s = b(), [, A] = ye(), z = ve("valueTypeMap"), c = y.useWatch(l.name, s);
126
126
  R(() => c.value, (e) => {
127
127
  var t;
128
128
  S(e), (t = l.onChange) == null || t.call(l, e);
129
129
  }, {
130
130
  deep: !0
131
- }), R(s, (e) => {
131
+ }), R(u, (e) => {
132
132
  var t;
133
- e !== n(c) && (de(e, n(c)) || (t = u.value) == null || t.setFieldValue(l.name, e));
133
+ e !== o(c) && (me(e, o(c)) || (t = s.value) == null || t.setFieldValue(l.name, e));
134
134
  }, {
135
135
  deep: !0
136
136
  });
137
- const P = pe(l, z);
137
+ const P = xe(l, z);
138
138
  function I() {
139
139
  var e;
140
- (e = u.value) == null || e.resetFields();
140
+ (e = s.value) == null || e.resetFields();
141
141
  }
142
142
  function O(e) {
143
143
  return e ? (k(e) ? e : [e]).map((a) => k(a) ? [l.name, ...a] : [l.name, a]) : void 0;
144
144
  }
145
145
  async function j(e, t) {
146
- var o;
147
- const a = await ((o = u.value) == null ? void 0 : o.validateFields(O(e), t));
146
+ var n;
147
+ const a = await ((n = s.value) == null ? void 0 : n.validateFields(O(e), t));
148
148
  return a == null ? void 0 : a[l.name];
149
149
  }
150
150
  function q(e, t) {
151
151
  var r, i, d;
152
- const a = ((r = n(s)) == null ? void 0 : r.length) || 0;
152
+ const a = ((r = o(u)) == null ? void 0 : r.length) || 0;
153
153
  if (C(l.maxLength) && a >= l.maxLength)
154
154
  return;
155
- const o = [...n(s) || []];
156
- C(t) ? o.splice(t, 0, {
155
+ const n = [...o(u) || []];
156
+ C(t) ? n.splice(t, 0, {
157
157
  ...e || {}
158
- }) : o.push({
158
+ }) : n.push({
159
159
  ...e || {}
160
- }), (d = (i = u.value) == null ? void 0 : i.setFieldValue) == null || d.call(i, l.name, o);
160
+ }), (d = (i = s.value) == null ? void 0 : i.setFieldValue) == null || d.call(i, l.name, n);
161
161
  }
162
162
  function K(e, t = "suffix") {
163
163
  var d, f, w;
164
- const a = ((d = n(s)) == null ? void 0 : d.length) || 0, o = g(e) ? e : e.length;
165
- if (C(l.maxLength) && a + o > l.maxLength)
164
+ const a = ((d = o(u)) == null ? void 0 : d.length) || 0, n = g(e) ? e : e.length;
165
+ if (C(l.maxLength) && a + n > l.maxLength)
166
166
  return;
167
- const r = [...n(s) || []], i = g(e) ? new Array(e).fill({}) : h(e);
168
- t === "suffix" ? r.push(...i) : r.unshift(...i), (w = (f = u.value) == null ? void 0 : f.setFieldValue) == null || w.call(f, l.name, r);
167
+ const r = [...o(u) || []], i = g(e) ? new Array(e).fill({}) : h(e);
168
+ t === "suffix" ? r.push(...i) : r.unshift(...i), (w = (f = s.value) == null ? void 0 : f.setFieldValue) == null || w.call(f, l.name, r);
169
169
  }
170
170
  function M(e) {
171
- var o, r;
172
- let t = h(n(s) || []);
171
+ var n, r;
172
+ let t = h(o(u) || []);
173
173
  const a = g(e) ? [e] : e;
174
- t = t.filter((i, d) => !a.includes(d)), (r = (o = u.value) == null ? void 0 : o.setFieldValue) == null || r.call(o, l.name, t);
174
+ t = t.filter((i, d) => !a.includes(d)), (r = (n = s.value) == null ? void 0 : n.setFieldValue) == null || r.call(n, l.name, t);
175
175
  }
176
176
  function G() {
177
- return n(s);
177
+ return o(u);
178
178
  }
179
179
  function H(e) {
180
180
  var t;
181
- return (t = n(s)) == null ? void 0 : t[e];
181
+ (t = s.value) == null || t.setFieldValue(l.name, e);
182
182
  }
183
- function U(e, t) {
184
- var o, r;
185
- const a = h(n(s));
183
+ function U(e) {
184
+ var t;
185
+ return (t = o(u)) == null ? void 0 : t[e];
186
+ }
187
+ function W(e, t) {
188
+ var n, r;
189
+ const a = h(o(u));
186
190
  a[e] && (a[e] = {
187
191
  ...a[e],
188
192
  ...t
189
- }, (r = (o = u.value) == null ? void 0 : o.setFieldValue) == null || r.call(o, l.name, [...a]));
193
+ }, (r = (n = s.value) == null ? void 0 : n.setFieldValue) == null || r.call(n, l.name, [...a]));
190
194
  }
191
- function W(e, t) {
192
- var o;
193
- const a = e === "end" ? s.value.length - 1 : e;
194
- fe(a, (o = v.value) == null ? void 0 : o.$el, t);
195
+ function $(e, t) {
196
+ var n;
197
+ const a = e === "end" ? u.value.length - 1 : e;
198
+ ce(a, (n = v.value) == null ? void 0 : n.$el, t);
195
199
  }
196
- function $() {
200
+ function Q() {
197
201
  var e, t;
198
- (t = (e = u.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, l.name, []);
202
+ (t = (e = s.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, l.name, []);
199
203
  }
200
- return E({
204
+ return T({
201
205
  resetFields: I,
202
206
  validateFields: j,
203
207
  add: q,
204
208
  remove: M,
205
- getRowData: H,
209
+ getRowData: U,
206
210
  getRowsData: G,
207
- setRowData: U,
211
+ setRowData: W,
208
212
  addMultiple: K,
209
- scrollTo: W,
210
- clear: $
211
- }), (e, t) => (p(), B(n(y), {
213
+ scrollTo: $,
214
+ clear: Q,
215
+ setTableData: H
216
+ }), (e, t) => (p(), F(o(y), {
212
217
  "initial-values": {
213
- [l.name]: n(s)
218
+ [l.name]: o(u)
214
219
  },
215
220
  ref_key: "formRef",
216
- ref: u
221
+ ref: s
217
222
  }, {
218
- default: m(() => [x(n(y).FormItem, {
223
+ default: m(() => [x(o(y).FormItem, {
219
224
  name: e.name,
220
225
  "no-style": ""
221
226
  }, {
222
- default: m(() => [x(n(ue), X(n(me)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
223
- class: n(N)(),
224
- columns: n(P),
225
- "data-source": n(s),
227
+ default: m(() => [x(o(ie), Y(o(fe)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
228
+ class: o(E)(),
229
+ columns: o(P),
230
+ "data-source": o(u),
226
231
  ref_key: "tableRef",
227
232
  ref: v
228
- }), Y({
233
+ }), Z({
229
234
  headerCell: m(({
230
235
  column: a
231
- }) => [n(ce)(a) ? (p(), Z("span", {
236
+ }) => [o(pe)(a) ? (p(), ee("span", {
232
237
  key: 0,
233
- class: ee(n(T)("header-cell", "required"))
234
- }, "*", 2)) : F("", !0), te("span", null, ae(a.title), 1), a.tooltip ? (p(), B(n(ie), {
238
+ class: te(o(L)("header-cell", "required"))
239
+ }, "*", 2)) : B("", !0), ae("span", null, ne(a.title), 1), a.tooltip ? (p(), F(o(de), {
235
240
  key: 1,
236
241
  title: a.tooltip,
237
242
  placement: "bottom"
238
243
  }, {
239
- default: m(() => [x(n(ye), {
244
+ default: m(() => [x(o(ge), {
240
245
  style: oe({
241
246
  paddingLeft: "4px",
242
- color: n(A).colorPrimary
247
+ color: o(A).colorPrimary
243
248
  })
244
249
  }, null, 8, ["style"])]),
245
250
  _: 2
246
- }, 1032, ["title"])) : F("", !0)]),
251
+ }, 1032, ["title"])) : B("", !0)]),
247
252
  _: 2
248
- }, [ne(_, (a, o) => ({
249
- name: o,
250
- fn: m((r) => [le(e.$slots, o, re(se(r || {})))])
253
+ }, [le(N, (a, n) => ({
254
+ name: n,
255
+ fn: m((r) => [re(e.$slots, n, ue(se(r || {})))])
251
256
  }))]), 1040, ["class", "columns", "data-source"])]),
252
257
  _: 3
253
258
  }, 8, ["name"])]),
@@ -256,5 +261,5 @@ const Ae = /* @__PURE__ */ Q({
256
261
  }
257
262
  });
258
263
  export {
259
- Ae as default
264
+ ze as default
260
265
  };
@@ -163,6 +163,12 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
163
163
  * @returns
164
164
  */
165
165
  scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
166
+ /**
167
+ * 设置表格数据
168
+ * @param nextTableData
169
+ * @returns
170
+ */
171
+ setTableData: (nextTableData: RecordType[]) => void;
166
172
  };
167
173
  /**
168
174
  * 可编辑表格作为表单项暴露的实例