@dazhicheng/ui 1.5.213 → 1.5.216

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 (33) hide show
  1. package/dist/components/tt-form/src/config.js +44 -42
  2. package/dist/components/tt-form/src/form-render/FormField.vue2.js +67 -70
  3. package/dist/components/tt-form/src/form-render/FormFieldContact.d.ts +9 -0
  4. package/dist/components/tt-form/src/form-render/FormFieldContact.js +28 -25
  5. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.d.ts +3 -0
  6. package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +20 -18
  7. package/dist/components/tt-form/src/form-render/array-register/props.d.ts +4 -0
  8. package/dist/components/tt-form/src/form-render/array-register/props.js +1 -0
  9. package/dist/components/tt-form/src/form-render/array-register/types.d.ts +4 -0
  10. package/dist/components/tt-form/src/form-render/dependencies.d.ts +5 -0
  11. package/dist/components/tt-form/src/form-render/dependencies.js +77 -39
  12. package/dist/components/tt-form/src/group-form/GroupForm.vue.d.ts +15 -7
  13. package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +120 -104
  14. package/dist/components/tt-form/src/group-form/GroupSection.vue.d.ts +1 -0
  15. package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +68 -64
  16. package/dist/components/tt-form/src/group-form/LazyFormField.vue.d.ts +1 -0
  17. package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +131 -101
  18. package/dist/components/tt-form/src/group-form/groupFormApi.d.ts +110 -46
  19. package/dist/components/tt-form/src/group-form/groupFormApi.js +465 -314
  20. package/dist/components/tt-form/src/group-form/lazyContext.d.ts +15 -13
  21. package/dist/components/tt-form/src/group-form/lazyContext.js +42 -26
  22. package/dist/components/tt-form/src/group-form/types.d.ts +13 -3
  23. package/dist/components/tt-form/src/group-form/useGroupForm.js +47 -50
  24. package/dist/components/tt-form/src/hooks/useFieldArray.js +101 -93
  25. package/dist/components/tt-form/src/hooks/useSelectCollapse.js +47 -47
  26. package/dist/components/tt-form/src/types.d.ts +3 -5
  27. package/dist/components/tt-modal-form/index.vue.js +12 -11
  28. package/dist/components/tt-radio-group/index.d.ts +5 -1
  29. package/dist/components/tt-radio-group/index.vue.d.ts +8 -1
  30. package/dist/components/tt-radio-group/index.vue.js +31 -33
  31. package/dist/components/tt-table/src/TableForm.vue.js +3 -2
  32. package/dist/style.css +1 -1
  33. package/package.json +3 -3
@@ -22,7 +22,7 @@ import { getMergedDisabled as me, resolveArrayItemState as x } from "./utils.js"
22
22
  function de(r) {
23
23
  return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !U(r);
24
24
  }
25
- const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rules", "formItemClass", "wrapperClass", "defaultValue", "hide", "disabled", "dependencies"], se = /* @__PURE__ */ M({
25
+ const se = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rules", "formItemClass", "wrapperClass", "defaultValue", "hide", "disabled", "dependencies"], ue = /* @__PURE__ */ M({
26
26
  name: "FormArrayRegister",
27
27
  props: le,
28
28
  setup(r, {
@@ -53,7 +53,7 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
53
53
  isDisabled: R,
54
54
  isIf: H,
55
55
  isShow: L
56
- } = ie(() => r.dependencies), w = h(() => Q(D, ue)), g = h(() => I(r.fieldName)), A = h(() => {
56
+ } = ie(() => r.dependencies), w = h(() => Q(D, se)), g = h(() => I(r.fieldName)), A = h(() => {
57
57
  var e;
58
58
  return (e = v.value) == null ? void 0 : e.at(g.value);
59
59
  });
@@ -65,12 +65,12 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
65
65
  const {
66
66
  entry: a,
67
67
  index: t,
68
- itemFieldName: s,
68
+ itemFieldName: u,
69
69
  parentItemPath: m
70
70
  } = e;
71
71
  return te({
72
72
  arrayPath: g.value,
73
- itemPath: I(s),
73
+ itemPath: I(u),
74
74
  index: t,
75
75
  row: a.value,
76
76
  arrayLength: ((n = b(l.fields)) == null ? void 0 : n.length) ?? 0,
@@ -83,7 +83,7 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
83
83
  function k(e, a) {
84
84
  const {
85
85
  entry: t,
86
- index: s,
86
+ index: u,
87
87
  itemFieldName: m,
88
88
  parentItemPath: n
89
89
  } = a, d = `${m}.${e.fieldName}`;
@@ -92,7 +92,7 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
92
92
  dynamicRules: F.value,
93
93
  dynamicDisabled: R.value,
94
94
  props: r
95
- }), u = {
95
+ }), s = {
96
96
  ...w.value,
97
97
  ...e,
98
98
  fieldName: d,
@@ -100,11 +100,12 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
100
100
  disabled: i.disabled,
101
101
  formItemClass: i.formItemClass,
102
102
  virtual: r.virtual,
103
+ progressive: r.progressive,
103
104
  arraySchema: e.arraySchema
104
105
  };
105
- return P(se, G({
106
+ return P(ue, G({
106
107
  key: d
107
- }, u), de(o) ? o : {
108
+ }, s), de(o) ? o : {
108
109
  default: () => [o]
109
110
  });
110
111
  }
@@ -124,32 +125,33 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
124
125
  key: `${t.key}-${d}`,
125
126
  fieldConfig: S,
126
127
  rules: S.rules,
127
- virtual: r.virtual
128
+ virtual: r.virtual,
129
+ progressive: r.progressive
128
130
  }, {
129
131
  default: (i) => {
130
- var u, f;
132
+ var s, f;
131
133
  return (f = o[e.fieldName]) == null ? void 0 : f.call(o, {
132
134
  ...i,
133
135
  action: l,
134
136
  entry: t,
135
- index: s,
137
+ index: u,
136
138
  fieldName: m,
137
139
  form: p,
138
140
  arrayPath: g.value,
139
141
  arrayHandle: A.value,
140
142
  arrayAction: v.value,
141
143
  parentItemPath: n,
142
- arrayLength: ((u = b(l.fields)) == null ? void 0 : u.length) ?? 0
144
+ arrayLength: ((s = b(l.fields)) == null ? void 0 : s.length) ?? 0
143
145
  });
144
146
  }
145
147
  });
146
148
  }
147
149
  function E(e, a) {
148
- var u;
149
- const t = `${r.fieldName}[${a}]`, s = o[r.fieldName], m = r.fieldName.lastIndexOf("."), n = m !== -1 ? r.fieldName.slice(0, m) : void 0;
150
- if (s) {
150
+ var s;
151
+ const t = `${r.fieldName}[${a}]`, u = o[r.fieldName], m = r.fieldName.lastIndexOf("."), n = m !== -1 ? r.fieldName.slice(0, m) : void 0;
152
+ if (u) {
151
153
  const f = me(R.value, void 0, r.disabled);
152
- return s({
154
+ return u({
153
155
  action: l,
154
156
  entry: e,
155
157
  index: a,
@@ -160,7 +162,7 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
160
162
  arrayHandle: A.value,
161
163
  arrayAction: v.value,
162
164
  parentItemPath: n,
163
- arrayLength: ((u = b(l.fields)) == null ? void 0 : u.length) ?? 0
165
+ arrayLength: ((s = b(l.fields)) == null ? void 0 : s.length) ?? 0
164
166
  });
165
167
  }
166
168
  const d = {
@@ -199,5 +201,5 @@ const ue = ["fieldName", "arraySchema", "useArraySchema", "useFieldArray", "rule
199
201
  }
200
202
  });
201
203
  export {
202
- se as FormArrayRegister
204
+ ue as FormArrayRegister
203
205
  };
@@ -44,6 +44,10 @@ export declare const formArrayRegisterProps: {
44
44
  readonly type: BooleanConstructor;
45
45
  readonly default: false;
46
46
  };
47
+ readonly progressive: {
48
+ readonly type: BooleanConstructor;
49
+ readonly default: false;
50
+ };
47
51
  /** useArraySchema 时:数组整体最外层容器 class(边框、间距等) */
48
52
  readonly wrapperClass: {
49
53
  readonly type: PropType<NonNullable<FormSchema["wrapperClass"]>>;
@@ -36,6 +36,7 @@ const e = {
36
36
  default: void 0
37
37
  },
38
38
  virtual: { type: Boolean, default: !1 },
39
+ progressive: { type: Boolean, default: !1 },
39
40
  /** useArraySchema 时:数组整体最外层容器 class(边框、间距等) */
40
41
  wrapperClass: {
41
42
  type: String,
@@ -6,6 +6,10 @@ export type ArrayRegisterProps = Pick<ArrayRegisterSchema, "fieldName" | "arrayS
6
6
  * 虚拟滚动/懒渲染开关(来自渲染层,不属于 FormSchema)
7
7
  */
8
8
  virtual?: boolean;
9
+ /**
10
+ * 渐进式挂载开关(来自渲染层,不属于 FormSchema)
11
+ */
12
+ progressive?: boolean;
9
13
  };
10
14
  export type { ArrayRegisterDependencies };
11
15
  export type RowRenderCtx = {
@@ -1,4 +1,9 @@
1
1
  import { FormItemDependencies, FormSchemaRuleType, MaybeComponentProps } from '../types';
2
+ /**
3
+ * @param component - 字段 schema 的 component 配置,或 FormField.vue 解析后的组件对象
4
+ * @returns {"required" | "selectRequired"} 必填规则名
5
+ */
6
+ export declare function resolveRequiredRuleName(component: unknown): "required" | "selectRequired";
2
7
  /**
3
8
  * 解析Nested Objects对应的字段值
4
9
  * @param values 表单值
@@ -1,7 +1,7 @@
1
- import { ref as u, computed as C, watch as I } from "vue";
1
+ import { ref as n, computed as V, watch as N } from "vue";
2
2
  import "axios";
3
3
  import "element-plus";
4
- import { isFunction as o, isBoolean as d } from "../../../../packages/utils/src/is.js";
4
+ import { isFunction as o, isBoolean as F, 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,52 +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 S } from "es-toolkit/compat";
16
- import { useFormValues as W } from "vee-validate";
17
- import { injectRenderFormProps as j } from "./context.js";
18
- function x(a, r) {
19
- if (r.startsWith("[") && r.endsWith("]")) {
20
- const h = r.slice(1, -1);
21
- return a[h];
15
+ import { get as k } from "es-toolkit/compat";
16
+ import { useFormValues as B } from "vee-validate";
17
+ import { injectRenderFormProps as C } from "./context.js";
18
+ const K = /* @__PURE__ */ new Set(["ElInput", "FormElInput", "ElInputNumber", "ElInputTag", "ElMention"]);
19
+ function er(r) {
20
+ const e = S(r) ? r : (r == null ? void 0 : r.name) ?? (r == null ? void 0 : r.__name);
21
+ return S(e) && K.has(e) ? "required" : "selectRequired";
22
+ }
23
+ function M(r, e) {
24
+ if (e.startsWith("[") && e.endsWith("]")) {
25
+ const E = e.slice(1, -1);
26
+ return r[E];
22
27
  }
23
- return S(a, r);
28
+ return k(r, e);
24
29
  }
25
- function Y(a) {
26
- var F;
27
- const r = W(), e = j().form;
28
- if (!r)
30
+ function tr(r) {
31
+ var R;
32
+ const e = B(), s = C().form;
33
+ if (!e)
29
34
  throw new Error("useDependencies should be used within <TtForm>");
30
- const s = u(!0), l = u(!1), m = u(!0), c = u(!1), w = u({}), g = u(), b = C(() => {
31
- var t;
32
- return (((t = a()) == null ? void 0 : t.triggerFields) ?? []).map((n) => x(r.value, n));
33
- }), q = () => {
34
- l.value = !1, s.value = !0, m.value = !0, c.value = !1, g.value = void 0, w.value = {};
35
- };
36
- return I(
37
- [b, a],
38
- async ([B, t]) => {
39
- var V;
40
- if (!t || !((V = t == null ? void 0 : t.triggerFields) != null && V.length))
35
+ const l = n(!0), f = n(!1), m = n(!0), w = n(!1), g = n({}), d = n(), _ = V(() => {
36
+ var i;
37
+ return (((i = r()) == null ? void 0 : i.triggerFields) ?? []).map((h) => M(e.value, h));
38
+ });
39
+ let I = 0;
40
+ return N(
41
+ [_, r],
42
+ async ([b, i]) => {
43
+ var q;
44
+ if (!i || !((q = i == null ? void 0 : i.triggerFields) != null && q.length))
41
45
  return;
42
- q();
43
- const { componentProps: n, disabled: f, if: p, required: y, rules: P, show: v, trigger: R } = t, i = r.value;
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;
52
+ } else
53
+ l.value = !0;
44
54
  if (o(p)) {
45
- if (s.value = !!await p(i, e), !s.value) return;
46
- } else if (d(p) && (s.value = p, !s.value))
47
- return;
48
- o(v) ? m.value = !!await v(i, e) : d(v) && (m.value = v), o(n) && (w.value = await n(i, e)), o(P) && (g.value = await P(i, e)), o(f) ? l.value = !!await f(i, e) : d(f) && (l.value = f), o(y) && (c.value = !!await y(i, e)), o(R) && await R(i, e);
55
+ const t = !!await p(a, s);
56
+ if (u()) return;
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;
63
+ } else
64
+ g.value = {};
65
+ if (o(y)) {
66
+ const t = await y(a, s);
67
+ if (u()) return;
68
+ d.value = t;
69
+ } else
70
+ d.value = void 0;
71
+ if (o(v)) {
72
+ const t = !!await v(a, s);
73
+ if (u()) return;
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;
80
+ } else
81
+ w.value = !1;
82
+ if (o(T)) {
83
+ if (u()) return;
84
+ await T(a, s);
85
+ }
49
86
  },
50
- { deep: !0, immediate: ((F = a()) == null ? void 0 : F.immediate) ?? !0 }
87
+ { deep: !0, immediate: ((R = r()) == null ? void 0 : R.immediate) ?? !0 }
51
88
  ), {
52
- dynamicComponentProps: w,
53
- dynamicRules: g,
54
- isDisabled: l,
55
- isIf: s,
56
- isRequired: c,
89
+ dynamicComponentProps: g,
90
+ dynamicRules: d,
91
+ isDisabled: f,
92
+ isIf: l,
93
+ isRequired: w,
57
94
  isShow: m
58
95
  };
59
96
  }
60
97
  export {
61
- Y as default,
62
- x as resolveValueByFieldName
98
+ tr as default,
99
+ er as resolveRequiredRuleName,
100
+ M as resolveValueByFieldName
63
101
  };
@@ -1,14 +1,20 @@
1
1
  import { NavAnchorItem } from '../../../tt-nav-anchor';
2
2
  import { GroupFormSectionProps } from './types';
3
+ declare function scrollToGroup(key: string): void;
3
4
  /**
4
- * @description 滚动到指定分组(通过 data-group-key 定位 DOM)。
5
- * 滚动期间暂停 LazyFormField 渲染,滚动结束后才恢复,
6
- * 避免途经字段挂载导致高度变化引起布局抖动。
7
- * 虚拟滚动场景下,通过 ResizeObserver 监听容器高度变化,
8
- * 在字段渲染导致高度变化时自动校正位置,高度稳定后停止。
9
- * @param {string} key 分组 key
5
+ * @description 滚动到指定字段(通过 LazyFormField 容器上的 data-field-anchor 定位)。
6
+ * 该锚点在字段未挂载(虚拟懒渲染仅骨架/占位)时也存在于 DOM,因此可用于滚动到
7
+ * 「无分组、且尚未挂载」的字段——这类字段没有分组锚点可用。
8
+ * @param {string} fieldName 字段名(完整路径)
10
9
  */
11
- declare function scrollToGroup(key: string): void;
10
+ declare function scrollToField(fieldName: string): void;
11
+ /**
12
+ * @description 等待渐进式挂载完成:调度器基于「挂载计数」精确判定所有字段真实 DOM 已就绪
13
+ * (由 FormField 的 vue:mounted 抵消 trackMount 计数),再等一帧绘制。
14
+ * 用于需要操作全量 DOM 的场景(截图、导出、爬虫等)前调用。
15
+ * @returns {Promise<void>}
16
+ */
17
+ declare function whenAllRendered(): Promise<void>;
12
18
  declare function __VLS_template(): {
13
19
  attrs: Partial<{}>;
14
20
  slots: Partial<Record<NonNullable<string | number>, (_: {
@@ -22,6 +28,8 @@ declare function __VLS_template(): {
22
28
  type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
23
29
  declare const __VLS_component: import('vue').DefineComponent<GroupFormSectionProps, {
24
30
  scrollToGroup: typeof scrollToGroup;
31
+ scrollToField: typeof scrollToField;
32
+ whenAllRendered: typeof whenAllRendered;
25
33
  navItems: import('vue').ComputedRef<NavAnchorItem[]>;
26
34
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<GroupFormSectionProps> & Readonly<{}>, {
27
35
  commonConfig: import('../types').FormCommonConfig;