@dazhicheng/ui 1.5.224 → 1.5.225

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 (26) hide show
  1. package/dist/components/tt-form/index.d.ts +5 -3
  2. package/dist/components/tt-form/src/form/RenderContent.vue.js +8 -8
  3. package/dist/components/tt-form/src/form-render/FormField.vue2.js +122 -122
  4. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +4 -4
  5. package/dist/components/tt-form/src/form-render/context.d.ts +1 -1
  6. package/dist/components/tt-form/src/form-render/dependencies.js +56 -56
  7. package/dist/components/tt-form/src/form-render/form.vue.d.ts +1 -1
  8. package/dist/components/tt-form/src/formApi.d.ts +1 -1
  9. package/dist/components/tt-form/src/group-form/GroupForm.vue.d.ts +1 -1
  10. package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +35 -35
  11. package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +135 -134
  12. package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +68 -68
  13. package/dist/components/tt-form/src/group-form/groupFormApi.js +4 -4
  14. package/dist/components/tt-form/src/group-form/types.d.ts +25 -24
  15. package/dist/components/tt-form/src/group-form/useGroupForm.d.ts +2 -6
  16. package/dist/components/tt-form/src/group-form/utils.d.ts +8 -8
  17. package/dist/components/tt-form/src/index.vue.d.ts +12 -12
  18. package/dist/components/tt-form/src/types.d.ts +48 -47
  19. package/dist/components/tt-form/src/useForm.d.ts +2 -2
  20. package/dist/components/tt-select/src/Select.vue.d.ts +4 -4
  21. package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
  22. package/dist/components/tt-table/index.d.ts +12 -12
  23. package/dist/components/tt-table/src/Table.vue.d.ts +4 -4
  24. package/dist/components/tt-table/src/TableForm.vue.d.ts +1 -1
  25. package/dist/components/tt-table/src/hooks/useTableForm.d.ts +1 -1
  26. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { ref as n, computed as V, watch as N } from "vue";
1
+ import { unref as V, ref as n, computed as N, watch as k } from "vue";
2
2
  import "axios";
3
3
  import "element-plus";
4
- import { isFunction as o, isBoolean as F, isString as S } from "../../../../packages/utils/src/is.js";
4
+ import { isFunction as l, isBoolean as E, isString as S } from "../../../../packages/utils/src/is.js";
5
5
  import "xe-utils";
6
6
  import "dayjs";
7
7
  import "dayjs/plugin/utc";
@@ -12,90 +12,90 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
12
12
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
13
13
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
14
14
  import "lodash-es";
15
- import { get as k } from "es-toolkit/compat";
15
+ import { get as A } from "es-toolkit/compat";
16
16
  import { useFormValues as B } from "vee-validate";
17
- import { injectRenderFormProps as C } from "./context.js";
17
+ import { injectFormProps as C } from "../useFormContext.js";
18
18
  const K = /* @__PURE__ */ new Set(["ElInput", "FormElInput", "ElInputNumber", "ElInputTag", "ElMention"]);
19
- function er(r) {
19
+ function tr(r) {
20
20
  const e = S(r) ? r : (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.__name);
21
21
  return S(e) && K.has(e) ? "required" : "selectRequired";
22
22
  }
23
23
  function M(r, e) {
24
24
  if (e.startsWith("[") && e.endsWith("]")) {
25
- const E = e.slice(1, -1);
26
- return r[E];
25
+ const w = e.slice(1, -1);
26
+ return r[w];
27
27
  }
28
- return k(r, e);
28
+ return A(r, e);
29
29
  }
30
- function tr(r) {
31
- var R;
32
- const e = B(), s = C().form;
30
+ function ir(r) {
31
+ var x;
32
+ const e = B(), [w] = C(), u = V(w).formApi;
33
33
  if (!e)
34
34
  throw new Error("useDependencies should be used within <TtForm>");
35
- const l = n(!0), f = n(!1), m = n(!0), w = n(!1), g = n({}), d = n(), _ = V(() => {
35
+ const o = n(!0), f = n(!1), m = n(!0), g = n(!1), h = n({}), F = n(), _ = N(() => {
36
36
  var i;
37
- return (((i = r()) == null ? void 0 : i.triggerFields) ?? []).map((h) => M(e.value, h));
37
+ return (((i = r()) == null ? void 0 : i.triggerFields) ?? []).map((d) => M(e.value, d));
38
38
  });
39
39
  let I = 0;
40
- return N(
40
+ return k(
41
41
  [_, r],
42
42
  async ([b, i]) => {
43
- var q;
44
- if (!i || !((q = i == null ? void 0 : i.triggerFields) != null && q.length))
43
+ var R;
44
+ if (!i || !((R = i == null ? void 0 : i.triggerFields) != null && R.length))
45
45
  return;
46
- const h = ++I, u = () => h !== I, { componentProps: x, disabled: v, if: c, required: P, rules: y, show: p, trigger: T } = i, a = e.value;
47
- if (o(c)) {
48
- const t = !!await c(a, s);
49
- if (u() || (l.value = t, !l.value)) return;
50
- } else if (F(c)) {
51
- if (l.value = c, !l.value) return;
46
+ const d = ++I, s = () => d !== I, { componentProps: y, disabled: v, if: c, required: P, rules: T, show: p, trigger: q } = i, a = e.value;
47
+ if (l(c)) {
48
+ const t = !!await c(a, u);
49
+ if (s() || (o.value = t, !o.value)) return;
50
+ } else if (E(c)) {
51
+ if (o.value = c, !o.value) return;
52
52
  } else
53
- l.value = !0;
54
- if (o(p)) {
55
- const t = !!await p(a, s);
56
- if (u()) return;
53
+ o.value = !0;
54
+ if (l(p)) {
55
+ const t = !!await p(a, u);
56
+ if (s()) return;
57
57
  m.value = t;
58
- } else F(p) ? m.value = p : m.value = !0;
59
- if (o(x)) {
60
- const t = await x(a, s);
61
- if (u()) return;
62
- g.value = t;
58
+ } else E(p) ? m.value = p : m.value = !0;
59
+ if (l(y)) {
60
+ const t = await y(a, u);
61
+ if (s()) return;
62
+ h.value = t;
63
63
  } else
64
- g.value = {};
65
- if (o(y)) {
66
- const t = await y(a, s);
67
- if (u()) return;
68
- d.value = t;
64
+ h.value = {};
65
+ if (l(T)) {
66
+ const t = await T(a, u);
67
+ if (s()) return;
68
+ F.value = t;
69
69
  } else
70
- d.value = void 0;
71
- if (o(v)) {
72
- const t = !!await v(a, s);
73
- if (u()) return;
70
+ F.value = void 0;
71
+ if (l(v)) {
72
+ const t = !!await v(a, u);
73
+ if (s()) return;
74
74
  f.value = t;
75
- } else F(v) ? f.value = v : f.value = !1;
76
- if (o(P)) {
77
- const t = !!await P(a, s);
78
- if (u()) return;
79
- w.value = t;
75
+ } else E(v) ? f.value = v : f.value = !1;
76
+ if (l(P)) {
77
+ const t = !!await P(a, u);
78
+ if (s()) return;
79
+ g.value = t;
80
80
  } else
81
- w.value = !1;
82
- if (o(T)) {
83
- if (u()) return;
84
- await T(a, s);
81
+ g.value = !1;
82
+ if (l(q)) {
83
+ if (s()) return;
84
+ await q(a, u);
85
85
  }
86
86
  },
87
- { deep: !0, immediate: ((R = r()) == null ? void 0 : R.immediate) ?? !0 }
87
+ { deep: !0, immediate: ((x = r()) == null ? void 0 : x.immediate) ?? !0 }
88
88
  ), {
89
- dynamicComponentProps: g,
90
- dynamicRules: d,
89
+ dynamicComponentProps: h,
90
+ dynamicRules: F,
91
91
  isDisabled: f,
92
- isIf: l,
93
- isRequired: w,
92
+ isIf: o,
93
+ isRequired: g,
94
94
  isShow: m
95
95
  };
96
96
  }
97
97
  export {
98
- tr as default,
99
- er as resolveRequiredRuleName,
98
+ ir as default,
99
+ tr as resolveRequiredRuleName,
100
100
  M as resolveValueByFieldName
101
101
  };
@@ -27,7 +27,7 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {
27
27
  onSubmit?: ((event: any) => any) | undefined;
28
28
  }>, {
29
29
  collapsedRows: number;
30
- commonConfig: FormCommonConfig;
30
+ commonConfig: FormCommonConfig<Record<string, any>>;
31
31
  showCollapseButton: boolean;
32
32
  wrapperClass: import('../types').WrapperClassType;
33
33
  globalCommonConfig: FormCommonConfig;
@@ -35,7 +35,7 @@ export declare class FormApi {
35
35
  */
36
36
  getFocusedField(): string | undefined;
37
37
  getLatestSubmissionValues(): Recordable<any>;
38
- getState(): TtFormProps<keyof import('./types').BaseFormComponentMap> | null;
38
+ getState(): TtFormProps<Record<string, any>> | null;
39
39
  getValues<T = Recordable<any>>(): Promise<T>;
40
40
  isFieldValid(fieldName: string): Promise<boolean>;
41
41
  merge(formApi: FormApi): any;
@@ -32,7 +32,7 @@ declare const __VLS_component: import('vue').DefineComponent<GroupFormSectionPro
32
32
  whenAllRendered: typeof whenAllRendered;
33
33
  navItems: import('vue').ComputedRef<NavAnchorItem[]>;
34
34
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<GroupFormSectionProps> & Readonly<{}>, {
35
- commonConfig: import('../types').FormCommonConfig;
35
+ commonConfig: import('../types').FormCommonConfig<Record<string, any>>;
36
36
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
37
37
  scrollRef: HTMLDivElement;
38
38
  }, any>;
@@ -53,18 +53,18 @@ const Le = 5, Ve = 500, po = /* @__PURE__ */ ae({
53
53
  },
54
54
  setup(Y, { expose: $ }) {
55
55
  var k;
56
- const { prefixCls: A } = Te("group-form"), g = Y, h = se(), i = g.formApi, c = Oe();
56
+ const { prefixCls: A } = Te("group-form"), g = Y, h = se(), s = g.formApi, c = Oe();
57
57
  _(Ne, c), _(He, (e) => {
58
- e.type === "group" ? i.setGroupVisible(e.key, e.visible) : i.setFieldsVisible(e.fieldNames, e.visible);
59
- }), _(Pe, i.hiddenGroupKeys);
60
- const { collapseStates: B } = i, f = g.formApi.useStore(), r = Re(g, f), M = /* @__PURE__ */ new Map(), U = a(
58
+ e.type === "group" ? s.setGroupVisible(e.key, e.visible) : s.setFieldsVisible(e.fieldNames, e.visible);
59
+ }), _(Pe, s.hiddenGroupKeys);
60
+ const { collapseStates: B } = s, p = g.formApi.useStore(), r = Re(g, p), M = /* @__PURE__ */ new Map(), U = a(
61
61
  () => ({
62
62
  ...r.value,
63
- schema: f.value.schema
63
+ schema: p.value.schema
64
64
  })
65
- ), { form: u } = Ae(U);
66
- Be([r, u]);
67
- const b = a(() => f.value.groupSchema ?? []), q = a(() => ({
65
+ ), { form: f } = Ae(U);
66
+ Be([r, f]);
67
+ const b = a(() => p.value.groupSchema ?? []), q = a(() => ({
68
68
  collapseStates: B,
69
69
  commonConfig: r.value.commonConfig,
70
70
  globalCommonConfig: Se,
@@ -77,15 +77,15 @@ const Le = 5, Ve = 500, po = /* @__PURE__ */ ae({
77
77
  estimateFieldHeight: r.value.estimateFieldHeight
78
78
  }));
79
79
  Fe({
80
- schema: f.value.schema,
80
+ schema: p.value.schema,
81
81
  commonConfig: r.value.commonConfig,
82
82
  componentMap: _e,
83
83
  componentBindEventMap: Ee,
84
- form: u,
84
+ form: f,
85
85
  layout: r.value.layout,
86
86
  compact: r.value.compact,
87
87
  wrapperClass: r.value.wrapperClass
88
- }), Me(M), g.formApi.mount(u, M);
88
+ }), Me(M), g.formApi.mount(f, M);
89
89
  const v = ie("scrollRef"), y = a(() => {
90
90
  const e = r.value.containerHeight;
91
91
  return e !== "100%" && e !== void 0;
@@ -98,13 +98,13 @@ const Le = 5, Ve = 500, po = /* @__PURE__ */ ae({
98
98
  };
99
99
  });
100
100
  function W(e) {
101
- i.toggleCollapse(e);
101
+ s.toggleCollapse(e);
102
102
  }
103
103
  function j(e) {
104
104
  const o = [];
105
105
  for (const t of e)
106
106
  if (Ie(t)) {
107
- const n = t.title, l = ye(n) ? () => n(u.values, u) : n;
107
+ const n = t.title, l = ye(n) ? () => n(f.values, s) : n;
108
108
  o.push({ key: t.key, title: l });
109
109
  }
110
110
  return o;
@@ -117,8 +117,8 @@ const Le = 5, Ve = 500, po = /* @__PURE__ */ ae({
117
117
  })
118
118
  ), N = a(() => ({
119
119
  ...r.value.navAnchorProps ?? {},
120
- badgeCounts: i.navErrorCounts
121
- })), O = a(() => N.value.show ?? !1), S = a(() => O.value ? j(b.value).filter((e) => !i.hiddenGroupKeys.has(e.key)) : []), Q = a(() => {
120
+ badgeCounts: s.navErrorCounts
121
+ })), O = a(() => N.value.show ?? !1), S = a(() => O.value ? j(b.value).filter((e) => !s.hiddenGroupKeys.has(e.key)) : []), Q = a(() => {
122
122
  const { show: e, ...o } = N.value;
123
123
  return { ...o, items: S.value };
124
124
  }), E = ce(((k = S.value[0]) == null ? void 0 : k.key) || "");
@@ -126,7 +126,7 @@ const Le = 5, Ve = 500, po = /* @__PURE__ */ ae({
126
126
  var o;
127
127
  return ((o = h[`nav-description-${e.row.key}`]) == null ? void 0 : o.call(h, {
128
128
  row: e.row,
129
- values: u.values
129
+ values: f.values
130
130
  })) ?? [];
131
131
  }
132
132
  function Z() {
@@ -163,14 +163,14 @@ const Le = 5, Ve = 500, po = /* @__PURE__ */ ae({
163
163
  e ? e.scrollTo({ top: n, behavior: t }) : window.scrollTo({ top: n, behavior: t });
164
164
  }
165
165
  function G(e) {
166
- const o = v.value, t = f.value.scrollOffset ?? 0, n = ee(e) || o, l = n && n.scrollHeight > n.clientHeight ? n : null, s = l ?? document.documentElement, m = H(e, l, t);
167
- P(l, m, "smooth");
166
+ const o = v.value, t = p.value.scrollOffset ?? 0, n = ee(e) || o, l = n && n.scrollHeight > n.clientHeight ? n : null, i = l ?? document.documentElement, u = H(e, l, t);
167
+ P(l, u, "smooth");
168
168
  let d = !1;
169
- const p = () => {
170
- d || (d = !0, s.removeEventListener("scrollend", p), clearTimeout(C), c.resume(), r.value.virtual && te(e, l, t));
169
+ const m = () => {
170
+ d || (d = !0, i.removeEventListener("scrollend", m), clearTimeout(C), c.resume(), r.value.virtual && te(e, l, t));
171
171
  };
172
- s.addEventListener("scrollend", p, { once: !0 });
173
- const C = setTimeout(p, 800);
172
+ i.addEventListener("scrollend", m, { once: !0 });
173
+ const C = setTimeout(m, 800);
174
174
  }
175
175
  function I(e) {
176
176
  c.pause(), R(() => {
@@ -194,27 +194,27 @@ const Le = 5, Ve = 500, po = /* @__PURE__ */ ae({
194
194
  }
195
195
  function te(e, o, t) {
196
196
  const n = o ?? document.documentElement;
197
- let l, s;
198
- function m() {
199
- p.disconnect(), clearTimeout(l), cancelAnimationFrame(s);
197
+ let l, i;
198
+ function u() {
199
+ m.disconnect(), clearTimeout(l), cancelAnimationFrame(i);
200
200
  }
201
201
  function d() {
202
- clearTimeout(l), l = setTimeout(m, Ve);
202
+ clearTimeout(l), l = setTimeout(u, Ve);
203
203
  }
204
- const p = new ResizeObserver(() => {
204
+ const m = new ResizeObserver(() => {
205
205
  if (!e.isConnected) {
206
- m();
206
+ u();
207
207
  return;
208
208
  }
209
- cancelAnimationFrame(s), s = requestAnimationFrame(() => {
209
+ cancelAnimationFrame(i), i = requestAnimationFrame(() => {
210
210
  const C = H(e, o, t), le = o ? o.scrollTop : window.scrollY;
211
211
  Math.abs(C - le) > Le && P(o, C, "instant");
212
212
  }), d();
213
213
  });
214
- p.observe(n), d();
214
+ m.observe(n), d();
215
215
  }
216
216
  function re(e) {
217
- E.value = e, B[e] && i.toggleCollapse(e), I(e);
217
+ E.value = e, B[e] && s.toggleCollapse(e), I(e);
218
218
  }
219
219
  async function ne() {
220
220
  c.resume(), await c.whenAllSettled(), await R(), await new Promise((e) => requestAnimationFrame(() => e()));
@@ -235,10 +235,10 @@ const Le = 5, Ve = 500, po = /* @__PURE__ */ ae({
235
235
  key: w(Ge)(t, n),
236
236
  schema: t
237
237
  }, { ref_for: !0 }, q.value, { onToggleCollapse: W }), ve({ _: 2 }, [
238
- x(w(h), (l, s) => ({
239
- name: s,
240
- fn: de((m) => [
241
- ge(e.$slots, s, F({ ref_for: !0 }, m || {}))
238
+ x(w(h), (l, i) => ({
239
+ name: i,
240
+ fn: de((u) => [
241
+ ge(e.$slots, i, F({ ref_for: !0 }, u || {}))
242
242
  ])
243
243
  }))
244
244
  ]), 1040, ["schema"]))), 128))