@dazhicheng/ui 1.5.223 → 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 (31) 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-modal/src/components/ModalHeader.vue.js +1 -1
  21. package/dist/components/tt-select/src/Select.vue.d.ts +4 -4
  22. package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
  23. package/dist/components/tt-table/index.d.ts +12 -12
  24. package/dist/components/tt-table/src/Table.vue.d.ts +4 -4
  25. package/dist/components/tt-table/src/TableForm.vue.d.ts +162 -58
  26. package/dist/components/tt-table/src/TableForm.vue.js +126 -113
  27. package/dist/components/tt-table/src/components/TableColumnModal.vue.d.ts +19 -1
  28. package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +103 -94
  29. package/dist/components/tt-table/src/hooks/useTableForm.d.ts +1 -1
  30. package/dist/style.css +1 -1
  31. package/package.json +1 -1
@@ -1,22 +1,22 @@
1
- import { defineComponent as Y, inject as K, computed as O, ref as A, watch as S, useTemplateRef as G, shallowRef as J, onMounted as Q, onBeforeUnmount as W, createElementBlock as q, openBlock as h, normalizeClass as p, unref as i, createBlock as x, createCommentVNode as X, mergeProps as Z, withCtx as T, renderSlot as ee, normalizeProps as te, guardReactiveProps as ne, normalizeStyle as V, createElementVNode as oe, createVNode as N, nextTick as re } from "vue";
2
- import { ElSkeleton as le, ElSkeletonItem as z } from "element-plus";
1
+ import { defineComponent as K, unref as i, inject as O, computed as G, ref as E, watch as S, useTemplateRef as J, shallowRef as Q, onMounted as W, onBeforeUnmount as X, createElementBlock as q, openBlock as h, normalizeClass as p, createBlock as T, createCommentVNode as Z, mergeProps as ee, withCtx as V, renderSlot as te, normalizeProps as oe, guardReactiveProps as ne, normalizeStyle as x, createElementVNode as re, createVNode as N, nextTick as le } from "vue";
2
+ import { ElSkeleton as ie, ElSkeletonItem as z } from "element-plus";
3
3
  import "../../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
4
- import { useDesign as ie } from "../../../../packages/hooks/src/useDesign.js";
4
+ import { useDesign as se } from "../../../../packages/hooks/src/useDesign.js";
5
5
  import "axios";
6
- import { isFunction as se, isBoolean as ae } from "../../../../packages/utils/src/is.js";
7
- import { clnm as ue } from "../../../../packages/utils/src/tool.js";
6
+ import { isFunction as ae, isBoolean as ue } from "../../../../packages/utils/src/is.js";
7
+ import { clnm as fe } from "../../../../packages/utils/src/tool.js";
8
8
  import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
9
9
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
10
10
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
11
11
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
12
12
  import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
13
13
  import "lodash-es";
14
- import { useFormValues as fe } from "vee-validate";
15
- import ce from "../form-render/FormField.vue2.js";
16
- import { injectRenderFormProps as me } from "../form-render/context.js";
17
- import { RENDER_SCHEDULER_KEY as de } from "./lazyContext.js";
18
- import { resolveValueByFieldName as pe } from "../form-render/dependencies.js";
19
- const ve = ["data-field-anchor"], Te = /* @__PURE__ */ Y({
14
+ import { useFormValues as ce } from "vee-validate";
15
+ import me from "../form-render/FormField.vue2.js";
16
+ import { injectFormProps as de } from "../useFormContext.js";
17
+ import { RENDER_SCHEDULER_KEY as pe } from "./lazyContext.js";
18
+ import { resolveValueByFieldName as ve } from "../form-render/dependencies.js";
19
+ const ge = ["data-field-anchor"], Ve = /* @__PURE__ */ K({
20
20
  name: "LazyFormField",
21
21
  inheritAttrs: !1,
22
22
  __name: "LazyFormField",
@@ -32,95 +32,95 @@ const ve = ["data-field-anchor"], Te = /* @__PURE__ */ Y({
32
32
  skeletonAnimated: { type: Boolean, default: !0 }
33
33
  },
34
34
  setup(L) {
35
- const { prefixCls: u } = ie("lazy-form-field"), a = L, I = me().form, b = a.fieldProps.fieldName, o = K(de, void 0), P = fe(), C = O(() => a.fieldProps.dependencies), l = A(!0);
35
+ const { prefixCls: u } = se("lazy-form-field"), a = L, [I] = de(), b = i(I).formApi, D = a.fieldProps.fieldName, n = O(pe, void 0), R = ce(), C = G(() => a.fieldProps.dependencies), l = E(!0);
36
36
  let v = 0;
37
37
  S(
38
38
  () => {
39
- var n;
39
+ var o;
40
40
  const e = C.value;
41
- if ((n = e == null ? void 0 : e.triggerFields) != null && n.length)
42
- return e.triggerFields.map((t) => pe(P.value, t));
41
+ if ((o = e == null ? void 0 : e.triggerFields) != null && o.length)
42
+ return e.triggerFields.map((t) => ve(R.value, t));
43
43
  },
44
44
  async () => {
45
- const e = ++v, n = C.value;
46
- if (!n || n.if === void 0) {
45
+ const e = ++v, o = C.value;
46
+ if (!o || o.if === void 0) {
47
47
  if (e !== v) return;
48
48
  l.value = !0;
49
49
  return;
50
50
  }
51
- if (se(n.if)) {
52
- const t = !!await n.if(P.value, I);
51
+ if (ae(o.if)) {
52
+ const t = !!await o.if(R.value, b);
53
53
  if (e !== v) return;
54
54
  l.value = t;
55
- } else if (ae(n.if)) {
55
+ } else if (ue(o.if)) {
56
56
  if (e !== v) return;
57
- l.value = n.if;
57
+ l.value = o.if;
58
58
  }
59
59
  },
60
60
  { deep: !0, immediate: !0 }
61
61
  );
62
- const s = G("containerRef"), f = A(!1);
62
+ const s = J("containerRef"), f = E(!1);
63
63
  let m = !1;
64
- const H = `${u}--offscreen`, M = J(a.estimateHeight);
64
+ const H = `${u}--offscreen`, M = Q(a.estimateHeight);
65
65
  let c = null, r = null, y = null;
66
66
  function w(e) {
67
- let n = e.parentElement;
68
- for (; n; ) {
69
- const t = getComputedStyle(n).overflowY;
70
- if (t === "auto" || t === "scroll") return n;
71
- n = n.parentElement;
67
+ let o = e.parentElement;
68
+ for (; o; ) {
69
+ const t = getComputedStyle(o).overflowY;
70
+ if (t === "auto" || t === "scroll") return o;
71
+ o = o.parentElement;
72
72
  }
73
73
  return null;
74
74
  }
75
75
  function k() {
76
76
  const e = s.value;
77
77
  if (!e || f.value) return;
78
- const n = e.offsetHeight;
79
- e.style.height = `${n}px`, e.style.overflow = "hidden", f.value = !0, re(() => {
78
+ const o = e.offsetHeight;
79
+ e.style.height = `${o}px`, e.style.overflow = "hidden", f.value = !0, le(() => {
80
80
  requestAnimationFrame(() => {
81
81
  const t = s.value;
82
82
  if (!t) return;
83
- const E = t.scrollHeight - n;
84
- t.style.height = "", t.style.overflow = "", !(Math.abs(E) <= 2) && requestAnimationFrame(() => {
85
- const R = s.value;
86
- if (!R) return;
87
- const _ = y ?? w(R);
83
+ const B = t.scrollHeight - o;
84
+ t.style.height = "", t.style.overflow = "", !(Math.abs(B) <= 2) && requestAnimationFrame(() => {
85
+ const _ = s.value;
88
86
  if (!_) return;
89
- const j = R.getBoundingClientRect().top, U = _.getBoundingClientRect().top;
90
- j < U && (_.scrollTop += E);
87
+ const P = y ?? w(_);
88
+ if (!P) return;
89
+ const U = _.getBoundingClientRect().top, Y = P.getBoundingClientRect().top;
90
+ U < Y && (P.scrollTop += B);
91
91
  });
92
92
  });
93
93
  });
94
94
  }
95
95
  let F = !1, g = !1;
96
- function $() {
97
- r = null, l.value && (F = !0, o == null || o.trackMount(), k());
96
+ function A() {
97
+ r = null, l.value && (F = !0, n == null || n.trackMount(), k());
98
98
  }
99
- function B() {
100
- f.value || r || !l.value || (r = o ? o.request($) : (() => {
101
- const e = requestAnimationFrame($);
99
+ function $() {
100
+ f.value || r || !l.value || (r = n ? n.request(A) : (() => {
101
+ const e = requestAnimationFrame(A);
102
102
  return () => cancelAnimationFrame(e);
103
103
  })());
104
104
  }
105
- function D() {
106
- !a.progressive || g || !F || (g = !0, o == null || o.settleMount());
105
+ function j() {
106
+ !a.progressive || g || !F || (g = !0, n == null || n.settleMount());
107
107
  }
108
108
  return S(l, (e) => {
109
- a.progressive && e && B();
110
- }), Q(() => {
109
+ a.progressive && e && $();
110
+ }), W(() => {
111
111
  if (s.value) {
112
112
  if (y = w(s.value), a.progressive) {
113
- B();
113
+ $();
114
114
  return;
115
115
  }
116
116
  c = new IntersectionObserver(
117
117
  (e) => {
118
- const n = e[0];
119
- if (n)
120
- if (n.isIntersecting) {
118
+ const o = e[0];
119
+ if (o)
120
+ if (o.isIntersecting) {
121
121
  m = !0;
122
122
  const t = s.value;
123
- t && (t.style.minHeight = "", t.classList.remove(H)), !f.value && !r && l.value && (r = o ? o.request(() => {
123
+ t && (t.style.minHeight = "", t.classList.remove(H)), !f.value && !r && l.value && (r = n ? n.request(() => {
124
124
  r = null, !(!m || !l.value) && k();
125
125
  }) : (() => {
126
126
  const d = requestAnimationFrame(() => {
@@ -143,30 +143,30 @@ const ve = ["data-field-anchor"], Te = /* @__PURE__ */ Y({
143
143
  }
144
144
  ), c.observe(s.value);
145
145
  }
146
- }), W(() => {
147
- r && (r(), r = null), a.progressive && F && !g && (g = !0, o == null || o.settleMount()), c == null || c.disconnect(), c = null;
148
- }), (e, n) => (h(), q("div", {
146
+ }), X(() => {
147
+ r && (r(), r = null), a.progressive && F && !g && (g = !0, n == null || n.settleMount()), c == null || c.disconnect(), c = null;
148
+ }), (e, o) => (h(), q("div", {
149
149
  ref_key: "containerRef",
150
150
  ref: s,
151
- "data-field-anchor": i(b),
152
- class: p(i(ue)(i(u), e.fieldClass, { [`${i(u)}--hidden`]: !l.value }))
151
+ "data-field-anchor": i(D),
152
+ class: p(i(fe)(i(u), e.fieldClass, { [`${i(u)}--hidden`]: !l.value }))
153
153
  }, [
154
- f.value ? (h(), x(ce, Z({ key: 0 }, e.fieldProps, {
154
+ f.value ? (h(), T(me, ee({ key: 0 }, e.fieldProps, {
155
155
  rules: e.rules,
156
- onVnodeMounted: D
156
+ onVnodeMounted: j
157
157
  }), {
158
- default: T((t) => [
159
- ee(e.$slots, "default", te(ne(t)))
158
+ default: V((t) => [
159
+ te(e.$slots, "default", oe(ne(t)))
160
160
  ]),
161
161
  _: 3
162
- }, 16, ["rules"])) : e.skeleton && l.value ? (h(), x(i(le), {
162
+ }, 16, ["rules"])) : e.skeleton && l.value ? (h(), T(i(ie), {
163
163
  key: 1,
164
164
  animated: e.skeletonAnimated,
165
165
  class: p(`${i(u)}__skeleton`),
166
- style: V({ minHeight: `${M.value}px` })
166
+ style: x({ minHeight: `${M.value}px` })
167
167
  }, {
168
- template: T(() => [
169
- oe("div", {
168
+ template: V(() => [
169
+ re("div", {
170
170
  class: p(`${i(u)}__row`)
171
171
  }, [
172
172
  N(i(z), {
@@ -182,11 +182,11 @@ const ve = ["data-field-anchor"], Te = /* @__PURE__ */ Y({
182
182
  _: 1
183
183
  }, 8, ["animated", "class", "style"])) : l.value ? (h(), q("div", {
184
184
  key: 2,
185
- style: V({ height: `${M.value}px` })
186
- }, null, 4)) : X("", !0)
187
- ], 10, ve));
185
+ style: x({ height: `${M.value}px` })
186
+ }, null, 4)) : Z("", !0)
187
+ ], 10, ge));
188
188
  }
189
189
  });
190
190
  export {
191
- Te as default
191
+ Ve as default
192
192
  };
@@ -558,14 +558,14 @@ class Se extends x {
558
558
  const s = e.dependencies;
559
559
  let r;
560
560
  s && v(s.rules) && (r = await this._safeInvoke(
561
- () => s.rules(t, this.form),
561
+ () => s.rules(t, this),
562
562
  void 0,
563
563
  `${e.fieldName}.dependencies.rules`
564
564
  ));
565
565
  const i = r || e.rules;
566
566
  let o = !1;
567
567
  return s && v(s.required) && (o = !!await this._safeInvoke(
568
- () => s.required(t, this.form),
568
+ () => s.required(t, this),
569
569
  !1,
570
570
  `${e.fieldName}.dependencies.required`
571
571
  )), i ? F(i) ? i : o ? ((a = i == null ? void 0 : i.unwrap) == null ? void 0 : a.call(i)) ?? i : i : o ? j(e.component) : void 0;
@@ -583,10 +583,10 @@ class Se extends x {
583
583
  const i = e.dependencies;
584
584
  if (!i) return !0;
585
585
  const o = i.if;
586
- if (o != null && (E(o) && !o || v(o) && !await this._safeInvoke(() => o(t, this.form), !0, `${r}.dependencies.if`)))
586
+ if (o != null && (E(o) && !o || v(o) && !await this._safeInvoke(() => o(t, this), !0, `${r}.dependencies.if`)))
587
587
  return !1;
588
588
  const a = i.show;
589
- return !(a != null && (E(a) && !a || v(a) && !await this._safeInvoke(() => a(t, this.form), !0, `${r}.dependencies.show`)));
589
+ return !(a != null && (E(a) && !a || v(a) && !await this._safeInvoke(() => a(t, this), !0, `${r}.dependencies.show`)));
590
590
  }
591
591
  /**
592
592
  * @description 收集当前需要校验的全部可见字段(顶层字段 + 数组行递归展开的行内字段)。
@@ -1,29 +1,30 @@
1
- import { FormActions, FormCommonConfig, FormSchema, FormSlotSchema, CustomRenderType, TtFormProps, WrapperClassType } from '../types';
1
+ import { FormCommonConfig, FormSchema, FormSlotSchema, CustomRenderType, TtFormProps, WrapperClassType } from '../types';
2
+ import { FormApi } from '../formApi';
2
3
  import { TtNavAnchorProps } from '../../../tt-nav-anchor';
3
4
  import { GroupFormApi } from './groupFormApi';
4
- export type CollapsibleType = boolean | ((values: Record<string, any>, actions: FormActions) => boolean | PromiseLike<boolean>);
5
- /** 控制 group / row / slot 是否显示,支持布尔值或函数(接收表单值与 formActions,可返回 Promise) */
6
- export type IfShowConditionType = boolean | ((values: Record<string, any>, actions: FormActions) => boolean | PromiseLike<boolean>);
5
+ export type CollapsibleType<TValues extends Record<string, any> = Record<string, any>> = boolean | ((values: TValues, formApi: FormApi) => boolean | PromiseLike<boolean>);
6
+ /** 控制 group / row / slot 是否显示,支持布尔值或函数(接收表单值与 formApi,可返回 Promise) */
7
+ export type IfShowConditionType<TValues extends Record<string, any> = Record<string, any>> = boolean | ((values: TValues, formApi: FormApi) => boolean | PromiseLike<boolean>);
7
8
  /** 分组表单项 */
8
- export interface FormGroupSchema {
9
+ export interface FormGroupSchema<TValues extends Record<string, any> = Record<string, any>> {
9
10
  /** 类型 */
10
11
  type: "group";
11
12
  /** 分组唯一标识 */
12
13
  key: string;
13
14
  /** 分组标题 */
14
- title: CustomRenderType;
15
- /** 是否可折叠,支持布尔值或函数 (values, actions) => boolean | Promise<boolean> */
16
- collapsible?: CollapsibleType;
15
+ title: CustomRenderType<TValues>;
16
+ /** 是否可折叠,支持布尔值或函数 `(values, formApi) => boolean | Promise<boolean>` */
17
+ collapsible?: CollapsibleType<TValues>;
17
18
  /** 初始是否折叠 */
18
19
  defaultCollapsed?: boolean;
19
20
  /** 子项(字段或嵌套分组) */
20
- children: GroupFormSchema[];
21
+ children: GroupFormSchema<TValues>[];
21
22
  /** 组内字段栅格布局 */
22
23
  wrapperClass?: WrapperClassType;
23
24
  /** 组内字段通用配置(覆盖外层 commonConfig) */
24
- commonConfig?: FormCommonConfig;
25
- /** 是否显示,支持布尔值或函数 (values, actions) => boolean | Promise<boolean>,默认 true */
26
- ifShow?: IfShowConditionType;
25
+ commonConfig?: FormCommonConfig<TValues>;
26
+ /** 是否显示,支持布尔值或函数 `(values, formApi) => boolean | Promise<boolean>`,默认 true */
27
+ ifShow?: IfShowConditionType<TValues>;
27
28
  }
28
29
  /**
29
30
  * 纯布局行容器,不产生分组标题,仅将若干字段包裹在一行内并支持自定义样式
@@ -31,17 +32,17 @@ export interface FormGroupSchema {
31
32
  * @property {FormSchema[]} children - 行内字段列表
32
33
  * @property {WrapperClassType} [wrapperClass] - 行容器额外 class(如 grid-cols-3、bg-xxx 等)
33
34
  */
34
- export interface FormRowSchema {
35
+ export interface FormRowSchema<TValues extends Record<string, any> = Record<string, any>> {
35
36
  /** 类型标识 */
36
37
  type: "row";
37
38
  /** 行内字段列表 */
38
- children: FormSchema[];
39
+ children: FormSchema<TValues>[];
39
40
  /** 行容器额外 class,可用于设置列数、背景、圆角等 */
40
41
  wrapperClass?: WrapperClassType;
41
- /** 是否显示,支持布尔值或函数 (values, actions) => boolean | Promise<boolean>,默认 true */
42
- ifShow?: IfShowConditionType;
42
+ /** 是否显示,支持布尔值或函数 `(values, formApi) => boolean | Promise<boolean>`,默认 true */
43
+ ifShow?: IfShowConditionType<TValues>;
43
44
  }
44
- export type GroupFormSchema = FormSchema | FormGroupSchema | FormRowSchema | FormSlotSchema;
45
+ export type GroupFormSchema<TValues extends Record<string, any> = Record<string, any>> = FormSchema<TValues> | FormGroupSchema<TValues> | FormRowSchema<TValues> | FormSlotSchema<TValues>;
45
46
  /**
46
47
  * 导航锚点基础配置:排除由内部维护的 `items` 与 `modelValue`,增加 `show` 控制是否渲染。
47
48
  * @property {boolean} [show] - 是否显示悬浮导航,默认 true
@@ -63,7 +64,7 @@ export type UseGroupFormNavAnchorProps = Omit<NavAnchorPropsBase, "badgeCounts">
63
64
  */
64
65
  export type GroupFormNavAnchorProps = UseGroupFormNavAnchorProps;
65
66
  /** useGroupForm 除分组 schema 外的公共选项 */
66
- export type UseGroupFormOptionsCommon = Omit<TtFormProps, "schema" | "showDefaultActions"> & {
67
+ export type UseGroupFormOptionsCommon<TValues extends Record<string, any> = Record<string, any>> = Omit<TtFormProps<TValues>, "schema" | "showDefaultActions"> & {
67
68
  /** 是否启用虚拟化,默认 true */
68
69
  virtual?: boolean;
69
70
  /**
@@ -87,29 +88,29 @@ export type UseGroupFormOptionsCommon = Omit<TtFormProps, "schema" | "showDefaul
87
88
  scrollOffset?: number;
88
89
  };
89
90
  /** 推荐:使用 groupSchema 传入分组树 */
90
- export interface UseGroupFormOptionsWithGroupSchema extends UseGroupFormOptionsCommon {
91
+ export interface UseGroupFormOptionsWithGroupSchema<TValues extends Record<string, any> = Record<string, any>> extends UseGroupFormOptionsCommon<TValues> {
91
92
  /** 分组 schema 树形结构 */
92
- groupSchema: GroupFormSchema[];
93
+ groupSchema: GroupFormSchema<TValues>[];
93
94
  }
94
95
  /**
95
96
  * @description 已废弃的分组表单入参(兼容旧代码)
96
97
  * @deprecated 请改用 {@link UseGroupFormOptionsWithGroupSchema},通过 `groupSchema` 传入分组树
97
98
  */
98
- export interface UseGroupFormOptionsWithLegacySchema extends UseGroupFormOptionsCommon {
99
+ export interface UseGroupFormOptionsWithLegacySchema<TValues extends Record<string, any> = Record<string, any>> extends UseGroupFormOptionsCommon<TValues> {
99
100
  /**
100
101
  * 分组 schema 树形结构
101
102
  * @deprecated 请使用 `groupSchema` 替代
102
103
  */
103
- schema: GroupFormSchema[];
104
+ schema: GroupFormSchema<TValues>[];
104
105
  }
105
106
  /** groupSchema 与 schema 二选一(至少传一个) */
106
- export type UseGroupFormOptions = UseGroupFormOptionsWithGroupSchema | UseGroupFormOptionsWithLegacySchema;
107
+ export type UseGroupFormOptions<TValues extends Record<string, any> = Record<string, any>> = UseGroupFormOptionsWithGroupSchema<TValues> | UseGroupFormOptionsWithLegacySchema<TValues>;
107
108
  export type GroupFormExtraState = Partial<Pick<UseGroupFormOptions, "virtual" | "progressive" | "navAnchorProps" | "containerHeight" | "rootMargin" | "estimateFieldHeight" | "scrollOffset">> & {
108
109
  /** 分组 schema 树形结构(store 状态,由 GroupFormApi.setState 维护) */
109
110
  groupSchema?: GroupFormSchema[];
110
111
  };
111
112
  /** 分组表单完整 store 状态类型 */
112
- export type GroupFormState = TtFormProps & GroupFormExtraState;
113
+ export type GroupFormState<TValues extends Record<string, any> = Record<string, any>> = TtFormProps<TValues> & GroupFormExtraState;
113
114
  /** LazyFormField 组件 props */
114
115
  export interface LazyFormFieldProps {
115
116
  /** 传给 FormField 的完整 props(通过 v-bind 透传) */
@@ -1,14 +1,10 @@
1
1
  import { DefineComponent } from 'vue';
2
2
  import { GroupFormApi } from './groupFormApi';
3
- import { UseGroupFormOptions, UseGroupFormOptionsCommon, UseGroupFormOptionsWithLegacySchema } from './types';
3
+ import { UseGroupFormOptions, UseGroupFormOptionsCommon } from './types';
4
4
  type GroupFormOverrideProps = Partial<UseGroupFormOptionsCommon>;
5
5
  type UseGroupFormReturn = readonly [DefineComponent<GroupFormOverrideProps>, GroupFormApi];
6
6
  /**
7
7
  * @description 返回可渲染的包装组件、扩展后的表单 API,以及分组折叠状态对象。
8
8
  */
9
- export declare function useGroupForm(options: UseGroupFormOptions): UseGroupFormReturn;
10
- /**
11
- * @deprecated 请改用 `groupSchema` 传入分组树
12
- */
13
- export declare function useGroupForm(options: UseGroupFormOptionsWithLegacySchema): UseGroupFormReturn;
9
+ export declare function useGroupForm<TValues extends Record<string, any> = Record<string, any>>(options: UseGroupFormOptions<TValues>): UseGroupFormReturn;
14
10
  export {};
@@ -7,7 +7,7 @@ import { FormSchema, FormSlotSchema } from '../types';
7
7
  * @example
8
8
  * if (isGroupSchema(item)) item.children; // 可安全访问 children
9
9
  */
10
- export declare function isGroupSchema(schema: GroupFormSchema): schema is FormGroupSchema;
10
+ export declare function isGroupSchema<TValues extends Record<string, any> = Record<string, any>>(schema: GroupFormSchema<TValues>): schema is FormGroupSchema<TValues>;
11
11
  /**
12
12
  * 判断当前节点是否为纯布局行容器(type: 'row')
13
13
  * @param {GroupFormSchema} schema - 分组表单 schema 节点
@@ -15,7 +15,7 @@ export declare function isGroupSchema(schema: GroupFormSchema): schema is FormGr
15
15
  * @example
16
16
  * if (isRowSchema(item)) item.children; // 可安全访问 children(均为字段)
17
17
  */
18
- export declare function isRowSchema(schema: GroupFormSchema): schema is FormRowSchema;
18
+ export declare function isRowSchema<TValues extends Record<string, any> = Record<string, any>>(schema: GroupFormSchema<TValues>): schema is FormRowSchema<TValues>;
19
19
  /**
20
20
  * 判断当前节点是否为自定义插槽(type: 'slot')
21
21
  * @param {GroupFormSchema} schema - 分组表单 schema 节点
@@ -23,7 +23,7 @@ export declare function isRowSchema(schema: GroupFormSchema): schema is FormRowS
23
23
  * @example
24
24
  * if (isSlotSchema(item)) console.log(item.content);
25
25
  */
26
- export declare function isSlotSchema(schema: GroupFormSchema): schema is FormSlotSchema;
26
+ export declare function isSlotSchema<TValues extends Record<string, any> = Record<string, any>>(schema: GroupFormSchema<TValues>): schema is FormSlotSchema<TValues>;
27
27
  /**
28
28
  * 为 v-for 生成稳定的 :key,根据 schema 类型选择最合适的标识
29
29
  * @param {GroupFormSchema} schema - 分组表单 schema 节点
@@ -48,16 +48,16 @@ export declare function getFieldNames(fields: FormSchema[]): string[];
48
48
  * ]);
49
49
  * // 返回: [{ fieldName: 'name' }, { fieldName: 'age' }]
50
50
  */
51
- export type GroupSchemaSourceOptions = {
52
- groupSchema?: GroupFormSchema[];
51
+ export type GroupSchemaSourceOptions<TValues extends Record<string, any> = Record<string, any>> = {
52
+ groupSchema?: GroupFormSchema<TValues>[];
53
53
  /** @deprecated 请使用 groupSchema */
54
- schema?: GroupFormSchema[];
54
+ schema?: GroupFormSchema<TValues>[];
55
55
  };
56
56
  /**
57
57
  * @description 解析分组 schema:优先 `groupSchema`,兼容已废弃的 `schema`
58
58
  */
59
- export declare function resolveGroupSchema(options: GroupSchemaSourceOptions): GroupFormSchema[];
60
- export declare function extractFlatSchemas(schemas: GroupFormSchema[]): FormSchema[];
59
+ export declare function resolveGroupSchema<TValues extends Record<string, any> = Record<string, any>>(options: GroupSchemaSourceOptions<TValues>): GroupFormSchema<TValues>[];
60
+ export declare function extractFlatSchemas<TValues extends Record<string, any> = Record<string, any>>(schemas: GroupFormSchema<TValues>[]): FormSchema<TValues>[];
61
61
  /**
62
62
  * 递归收集分组 schema 中 defaultCollapsed 为 true 的分组 key,写入 states
63
63
  * @param {GroupFormSchema[]} schemas - 分组表单 schema 数组
@@ -23,14 +23,14 @@ declare function __VLS_template(): {
23
23
  readonly collapsed?: boolean | undefined;
24
24
  readonly collapsedRows?: number | undefined;
25
25
  readonly collapseTriggerResize?: boolean | undefined;
26
- readonly commonConfig?: import('./types').FormCommonConfig | undefined;
26
+ readonly commonConfig?: import('./types').FormCommonConfig<Record<string, any>> | undefined;
27
27
  readonly compact?: boolean | undefined;
28
28
  readonly componentBindEventMap?: Partial<Record<import('./types').BaseFormComponentType, string>> | undefined;
29
29
  readonly componentMap: Record<import('./types').BaseFormComponentType, import('vue').Component>;
30
30
  readonly fieldMappingTime?: import('./types').FieldMappingTime | undefined;
31
31
  readonly form?: import('./types').FormActions | undefined;
32
32
  readonly layout?: import('./types').FormLayout | undefined;
33
- readonly schema?: (FormSchema<keyof import('./types').BaseFormComponentMap> | import('./types').FormSlotSchema | import('./types').FormSchemaItem<keyof import('./types').BaseFormComponentMap>)[] | undefined;
33
+ readonly schema?: (FormSchema<Record<string, any>> | import('./types').FormSchemaItem<Record<string, any>> | import('./types').FormSlotSchema<Record<string, any>>)[] | undefined;
34
34
  readonly showCollapseButton?: boolean | undefined;
35
35
  readonly wrapperClass?: import('./types').WrapperClassType | undefined;
36
36
  readonly globalCommonConfig?: import('./types').FormCommonConfig | undefined;
@@ -52,7 +52,7 @@ declare function __VLS_template(): {
52
52
  $host: Element | null;
53
53
  $emit: (event: "submit", event: any) => void;
54
54
  $el: any;
55
- $options: import('vue').ComponentOptionsBase<Readonly<import('./types').FormRenderProps<keyof import('./types').BaseFormComponentMap> & {
55
+ $options: import('vue').ComponentOptionsBase<Readonly<import('./types').FormRenderProps<Record<string, any>> & {
56
56
  globalCommonConfig?: import('./types').FormCommonConfig;
57
57
  }> & Readonly<{
58
58
  onSubmit?: ((event: any) => any) | undefined;
@@ -62,7 +62,7 @@ declare function __VLS_template(): {
62
62
  submit: (event: any) => any;
63
63
  }, string, {
64
64
  collapsedRows: number;
65
- commonConfig: import('./types').FormCommonConfig;
65
+ commonConfig: import('./types').FormCommonConfig<Record<string, any>>;
66
66
  showCollapseButton: boolean;
67
67
  wrapperClass: import('./types').WrapperClassType;
68
68
  globalCommonConfig: import('./types').FormCommonConfig;
@@ -88,11 +88,11 @@ declare function __VLS_template(): {
88
88
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
89
89
  } & Readonly<{
90
90
  collapsedRows: number;
91
- commonConfig: import('./types').FormCommonConfig;
91
+ commonConfig: import('./types').FormCommonConfig<Record<string, any>>;
92
92
  showCollapseButton: boolean;
93
93
  wrapperClass: import('./types').WrapperClassType;
94
94
  globalCommonConfig: import('./types').FormCommonConfig;
95
- }> & Omit<Readonly<import('./types').FormRenderProps<keyof import('./types').BaseFormComponentMap> & {
95
+ }> & Omit<Readonly<import('./types').FormRenderProps<Record<string, any>> & {
96
96
  globalCommonConfig?: import('./types').FormCommonConfig;
97
97
  }> & Readonly<{
98
98
  onSubmit?: ((event: any) => any) | undefined;
@@ -121,14 +121,14 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
121
121
  readonly collapsed?: boolean | undefined;
122
122
  readonly collapsedRows?: number | undefined;
123
123
  readonly collapseTriggerResize?: boolean | undefined;
124
- readonly commonConfig?: import('./types').FormCommonConfig | undefined;
124
+ readonly commonConfig?: import('./types').FormCommonConfig<Record<string, any>> | undefined;
125
125
  readonly compact?: boolean | undefined;
126
126
  readonly componentBindEventMap?: Partial<Record<import('./types').BaseFormComponentType, string>> | undefined;
127
127
  readonly componentMap: Record<import('./types').BaseFormComponentType, import('vue').Component>;
128
128
  readonly fieldMappingTime?: import('./types').FieldMappingTime | undefined;
129
129
  readonly form?: import('./types').FormActions | undefined;
130
130
  readonly layout?: import('./types').FormLayout | undefined;
131
- readonly schema?: (FormSchema<keyof import('./types').BaseFormComponentMap> | import('./types').FormSlotSchema | import('./types').FormSchemaItem<keyof import('./types').BaseFormComponentMap>)[] | undefined;
131
+ readonly schema?: (FormSchema<Record<string, any>> | import('./types').FormSchemaItem<Record<string, any>> | import('./types').FormSlotSchema<Record<string, any>>)[] | undefined;
132
132
  readonly showCollapseButton?: boolean | undefined;
133
133
  readonly wrapperClass?: import('./types').WrapperClassType | undefined;
134
134
  readonly globalCommonConfig?: import('./types').FormCommonConfig | undefined;
@@ -150,7 +150,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
150
150
  $host: Element | null;
151
151
  $emit: (event: "submit", event: any) => void;
152
152
  $el: any;
153
- $options: import('vue').ComponentOptionsBase<Readonly<import('./types').FormRenderProps<keyof import('./types').BaseFormComponentMap> & {
153
+ $options: import('vue').ComponentOptionsBase<Readonly<import('./types').FormRenderProps<Record<string, any>> & {
154
154
  globalCommonConfig?: import('./types').FormCommonConfig;
155
155
  }> & Readonly<{
156
156
  onSubmit?: ((event: any) => any) | undefined;
@@ -160,7 +160,7 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
160
160
  submit: (event: any) => any;
161
161
  }, string, {
162
162
  collapsedRows: number;
163
- commonConfig: import('./types').FormCommonConfig;
163
+ commonConfig: import('./types').FormCommonConfig<Record<string, any>>;
164
164
  showCollapseButton: boolean;
165
165
  wrapperClass: import('./types').WrapperClassType;
166
166
  globalCommonConfig: import('./types').FormCommonConfig;
@@ -186,11 +186,11 @@ declare const __VLS_component: import('vue').DefineComponent<Props, {}, {}, {},
186
186
  $watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (...args: [R, R, import('@vue/reactivity').OnCleanup]) => any : (...args: [any, any, import('@vue/reactivity').OnCleanup]) => any, options?: import('vue').WatchOptions): import('vue').WatchStopHandle;
187
187
  } & Readonly<{
188
188
  collapsedRows: number;
189
- commonConfig: import('./types').FormCommonConfig;
189
+ commonConfig: import('./types').FormCommonConfig<Record<string, any>>;
190
190
  showCollapseButton: boolean;
191
191
  wrapperClass: import('./types').WrapperClassType;
192
192
  globalCommonConfig: import('./types').FormCommonConfig;
193
- }> & Omit<Readonly<import('./types').FormRenderProps<keyof import('./types').BaseFormComponentMap> & {
193
+ }> & Omit<Readonly<import('./types').FormRenderProps<Record<string, any>> & {
194
194
  globalCommonConfig?: import('./types').FormCommonConfig;
195
195
  }> & Readonly<{
196
196
  onSubmit?: ((event: any) => any) | undefined;