@schemx/vue 1.0.0-next.1 → 1.0.0-next.3

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 (45) hide show
  1. package/README.md +72 -44
  2. package/dist/analyze.html +1 -1
  3. package/dist/bridge/fieldBridge.d.ts +23 -0
  4. package/dist/bridge/fieldBridge.d.ts.map +1 -0
  5. package/dist/bridge/formBridge.d.ts +81 -0
  6. package/dist/bridge/formBridge.d.ts.map +1 -0
  7. package/dist/bridge/formFacade.d.ts +65 -0
  8. package/dist/bridge/formFacade.d.ts.map +1 -0
  9. package/dist/bridge/helpers.d.ts +31 -0
  10. package/dist/bridge/helpers.d.ts.map +1 -0
  11. package/dist/bridge/index.d.ts +11 -0
  12. package/dist/bridge/index.d.ts.map +1 -0
  13. package/dist/bridge/types.d.ts +109 -0
  14. package/dist/bridge/types.d.ts.map +1 -0
  15. package/dist/components/Button/index.d.ts +3 -0
  16. package/dist/components/Button/index.d.ts.map +1 -0
  17. package/dist/components/Button/index.vue.d.ts +30 -0
  18. package/dist/components/Button/index.vue.d.ts.map +1 -0
  19. package/dist/components/Button/types.d.ts +21 -0
  20. package/dist/components/Button/types.d.ts.map +1 -0
  21. package/dist/components/FormItem/index.d.ts +1 -1
  22. package/dist/components/FormItem/index.d.ts.map +1 -1
  23. package/dist/config/appConfig.d.ts.map +1 -1
  24. package/dist/hooks/index.d.ts +4 -0
  25. package/dist/hooks/index.d.ts.map +1 -1
  26. package/dist/hooks/provideFormContext.d.ts +4 -3
  27. package/dist/hooks/provideFormContext.d.ts.map +1 -1
  28. package/dist/hooks/useField.d.ts +3 -29
  29. package/dist/hooks/useField.d.ts.map +1 -1
  30. package/dist/hooks/useForm.d.ts +3 -2
  31. package/dist/hooks/useForm.d.ts.map +1 -1
  32. package/dist/hooks/useFormSelector.d.ts +38 -0
  33. package/dist/hooks/useFormSelector.d.ts.map +1 -0
  34. package/dist/hooks/useViewSchemas.d.ts +23 -3
  35. package/dist/hooks/useViewSchemas.d.ts.map +1 -1
  36. package/dist/hooks/useWatch.d.ts.map +1 -1
  37. package/dist/index.cjs +1 -1
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.mjs +614 -109
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/style.css +1 -1
  42. package/dist/types/field.d.ts +1 -1
  43. package/dist/types/form.d.ts +33 -1
  44. package/dist/types/form.d.ts.map +1 -1
  45. package/package.json +3 -3
@@ -0,0 +1,109 @@
1
+ import { ShallowRef } from 'vue';
2
+ import { FieldValue, NamePath, SchemxInstance, Values } from '@schemx/core';
3
+ import { FieldSnapshotSource, FormStateAdapter } from '@schemx/core/adapter';
4
+ /**
5
+ * 可在 Vue effect 中直接读取 Form 方法的结构兼容实例类型。
6
+ *
7
+ * Facade 与 Core Form 不同一引用,但保留完整的 `SchemxInstance` API。
8
+ *
9
+ * @typeParam TValues - Form 的值类型。
10
+ */
11
+ export type VueSchemxInstance<TValues extends Values = Values> = SchemxInstance<TValues>;
12
+ /**
13
+ * FormStateAdapter 中 pending 字段的只读聚合快照。
14
+ *
15
+ * @typeParam TValues - Form 的值类型。
16
+ */
17
+ export type PendingFieldsSnapshot<TValues extends Values> = readonly ReturnType<SchemxInstance<TValues>["getPendingFields"]>[number][];
18
+ /**
19
+ * Vue 中单个字段状态的 Ref 投影。
20
+ *
21
+ * @typeParam TValues - Form 的值类型。
22
+ * @typeParam TName - 字段路径类型。
23
+ */
24
+ export interface VueFieldBridge<TValues extends Values = Values, TName extends NamePath<TValues> = NamePath<TValues>> {
25
+ /**
26
+ * 对应的 Core 字段快照来源。
27
+ */
28
+ readonly source: FieldSnapshotSource<TValues, TName>;
29
+ /**
30
+ * 当前字段值。
31
+ */
32
+ readonly value: ShallowRef<FieldValue<TValues, TName> | undefined>;
33
+ /**
34
+ * 当前字段错误消息。
35
+ */
36
+ readonly errors: ShallowRef<readonly string[]>;
37
+ /**
38
+ * 当前字段 touched 状态。
39
+ */
40
+ readonly touched: ShallowRef<boolean>;
41
+ /**
42
+ * 当前字段 pending 状态。
43
+ */
44
+ readonly pending: ShallowRef<boolean>;
45
+ }
46
+ /**
47
+ * 包含唯一 Vue Facade 的共享 Form Bridge。
48
+ *
49
+ * @typeParam TValues - Form 的值类型。
50
+ */
51
+ export interface VueFormBridge<TValues extends Values = Values> {
52
+ /**
53
+ * 原始 Core Form。
54
+ */
55
+ readonly form: SchemxInstance<TValues>;
56
+ /**
57
+ * 该 Form 的 Core 状态适配器。
58
+ */
59
+ readonly stateAdapter: FormStateAdapter<TValues>;
60
+ /**
61
+ * 全表值 Ref。
62
+ */
63
+ readonly values: ShallowRef<TValues>;
64
+ /**
65
+ * 已 touched 字段 Ref。
66
+ */
67
+ readonly touchedFields: ShallowRef<readonly NamePath<TValues>[]>;
68
+ /**
69
+ * pending 字段 Ref。
70
+ */
71
+ readonly pendingFields: ShallowRef<PendingFieldsSnapshot<TValues>>;
72
+ /**
73
+ * 当前表单提交状态的 Vue Ref 投影。
74
+ */
75
+ readonly loading: ShallowRef<boolean>;
76
+ /**
77
+ * 按字段快照来源身份缓存的字段 Ref 投影。
78
+ */
79
+ readonly fieldBridges: Map<object, ManagedVueFieldBridge<TValues>>;
80
+ /**
81
+ * 正在使用当前 Bridge 的 Vue owner 数量。
82
+ */
83
+ refCount: number;
84
+ /**
85
+ * Bridge 是否已被手动或自动释放。
86
+ */
87
+ destroyed: boolean;
88
+ /**
89
+ * 取消 Form 级状态适配器订阅。
90
+ */
91
+ readonly unsubscribe: () => void;
92
+ /**
93
+ * 与原始 Core Form 对应的唯一 Vue Facade。
94
+ */
95
+ readonly facade: VueSchemxInstance<TValues>;
96
+ }
97
+ /**
98
+ * 内部使用的、可停止订阅的字段 Ref 投影。
99
+ *
100
+ * @internal
101
+ * @typeParam TValues - Form 的值类型。
102
+ */
103
+ export interface ManagedVueFieldBridge<TValues extends Values> extends VueFieldBridge<TValues> {
104
+ /**
105
+ * 停止字段快照到 Vue Ref 的同步订阅。
106
+ */
107
+ dispose(): void;
108
+ }
109
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bridge/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAErC,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEjF;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,IAAI,cAAc,CAAC,OAAO,CAAC,CAAA;AAExF;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,CAAC,OAAO,SAAS,MAAM,IAAI,SAAS,UAAU,CAC7E,cAAc,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAC5C,CAAC,MAAM,CAAC,EAAE,CAAA;AAEX;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAC7B,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/B,KAAK,SAAS,QAAQ,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC;IAEnD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACpD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC,CAAA;IAClE;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,SAAS,MAAM,EAAE,CAAC,CAAA;IAC9C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IAC5D;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,CAAA;IACtC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAChD;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IACpC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,SAAS,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAChE;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,UAAU,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAA;IAClE;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAC,CAAA;IACrC;;OAEG;IACH,QAAQ,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAA;IAClE;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,IAAI,CAAA;IAChC;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;CAC5C;AAED;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB,CACpC,OAAO,SAAS,MAAM,CACtB,SAAQ,cAAc,CAAC,OAAO,CAAC;IAC/B;;OAEG;IACH,OAAO,IAAI,IAAI,CAAA;CAChB"}
@@ -0,0 +1,3 @@
1
+ export { default } from './index.vue';
2
+ export type { SchemxButtonProps, SchemxButtonSize } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AACrC,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { SchemxButtonSize } from './types';
2
+ interface Props {
3
+ loading?: boolean;
4
+ loadingText?: string;
5
+ disabled?: boolean;
6
+ size?: SchemxButtonSize;
7
+ }
8
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {};
9
+ type __VLS_Slots = {} & {
10
+ prefix?: (props: typeof __VLS_1) => any;
11
+ } & {
12
+ default?: (props: typeof __VLS_3) => any;
13
+ } & {
14
+ suffix?: (props: typeof __VLS_5) => any;
15
+ };
16
+ declare const __VLS_base: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<Props> & Readonly<{}>, {
17
+ disabled: boolean;
18
+ size: SchemxButtonSize;
19
+ loading: boolean;
20
+ loadingText: string;
21
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
22
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
23
+ declare const _default: typeof __VLS_export;
24
+ export default _default;
25
+ type __VLS_WithSlots<T, S> = T & {
26
+ new (): {
27
+ $slots: S;
28
+ };
29
+ };
30
+ //# sourceMappingURL=index.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/index.vue"],"names":[],"mappings":"AAuJE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAE/C,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,gBAAgB,CAAA;CACxB;AAiHH,QAAA,IAAI,OAAO,IAAU,EAAE,OAAO,IAAU,EAAE,OAAO,IAAW,CAAE;AAC9D,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC3C;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK9C,QAAA,MAAM,UAAU;cA5HD,OAAO;UACX,gBAAgB;aAHb,OAAO;iBACH,MAAM;6EAgItB,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AAWzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { ButtonHTMLAttributes } from 'vue';
2
+ /**
3
+ * 内置按钮的尺寸。
4
+ */
5
+ export type SchemxButtonSize = "small" | "medium" | "large";
6
+ /**
7
+ * 内置按钮的 Props。
8
+ */
9
+ export interface SchemxButtonProps extends Omit<ButtonHTMLAttributes, "disabled" | "size"> {
10
+ /** 点击事件。 */
11
+ onClick?: (event: MouseEvent) => void;
12
+ /** 是否显示加载状态。加载时按钮不可点击。 */
13
+ loading?: boolean;
14
+ /** 加载状态下替换按钮内容的文本。 */
15
+ loadingText?: string;
16
+ /** 是否禁用按钮。 */
17
+ disabled?: boolean;
18
+ /** 按钮尺寸。 */
19
+ size?: SchemxButtonSize;
20
+ }
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,KAAK,CAAA;AAE/C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE3D;;GAEG;AACH,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,MAAM,CAAC;IACvD,YAAY;IACZ,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;IACrC,0BAA0B;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,sBAAsB;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc;IACd,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY;IACZ,IAAI,CAAC,EAAE,gBAAgB,CAAA;CACxB"}
@@ -2,7 +2,7 @@ import { PropType, VNodeChild } from 'vue';
2
2
  /**
3
3
  * FormItem 属性。
4
4
  *
5
- * @typeParam TValues - 表单值类型
5
+ * 提供待渲染的原始 ViewSchema;具体字段或分组类型由组件内部运行时收窄。
6
6
  */
7
7
  export interface SchemxItemProps {
8
8
  schema: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormItem/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAA6C,QAAQ,EAAc,MAAM,KAAK,CAAA;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AA4BrC;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,QAAA,MAAM,QAAQ;;cAKQ,QAAQ,CAAC,OAAO,CAAC;;;UAMxB,UAAU;;cANH,QAAQ,CAAC,OAAO,CAAC;;;iGAgBrC,CAAA;AA+LF,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormItem/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAgC,QAAQ,EAAE,MAAM,KAAK,CAAA;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AA6BrC;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,CAAA;CAChB;AAED,QAAA,MAAM,QAAQ;;cAKQ,QAAQ,CAAC,OAAO,CAAC;;;UAYxB,UAAU;;cAZH,QAAQ,CAAC,OAAO,CAAC;;;iGAsBrC,CAAA;AAsLF,eAAe,QAAQ,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"appConfig.d.ts","sourceRoot":"","sources":["../../src/config/appConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAiD,MAAM,KAAK,CAAA;AAE7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAoChD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAE,YAAiB,GAAG,IAAI,CAKhF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAQjD"}
1
+ {"version":3,"file":"appConfig.d.ts","sourceRoot":"","sources":["../../src/config/appConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAiD,MAAM,KAAK,CAAA;AAE7E,OAAO,KAAK,EAAE,YAAY,EAA0B,MAAM,cAAc,CAAA;AA0DxE;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,GAAE,YAAiB,GAAG,IAAI,CAKhF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,CAQjD"}
@@ -5,6 +5,8 @@
5
5
  */
6
6
  /** useForm - 表单状态管理 */
7
7
  export { useForm } from './useForm';
8
+ /** Vue Form Facade - 在 Vue effect 中可追踪的 Form 实例。 */
9
+ export { getCoreForm, type VueSchemxInstance } from '../bridge';
8
10
  /** createFormContext - 表单上下文注入与消费 */
9
11
  export { createFormContext, useFormContext } from './provideFormContext';
10
12
  /** useField - 单字段控制 */
@@ -21,4 +23,6 @@ export { createFormConfigContext, useFormConfigContext, type FormContextProps, }
21
23
  export { useStableRef } from './useStableRef';
22
24
  /** useViewSchemas - ViewSchemas Vue 桥接 */
23
25
  export { useViewSchemas } from './useViewSchemas';
26
+ /** useFormSelector - 表单值 Selector Vue 桥接 */
27
+ export { useFormSelector, type UseFormSelectorOptions, } from './useFormSelector';
24
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uBAAuB;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,qCAAqC;AACrC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAExE,uBAAuB;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,sCAAsC;AACtC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE3E,wBAAwB;AACxB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAEjF,6BAA6B;AAC7B,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAEzE,wCAAwC;AACxC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAA;AAEnC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,0CAA0C;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,uBAAuB;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,oDAAoD;AACpD,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE/D,qCAAqC;AACrC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAExE,uBAAuB;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,sCAAsC;AACtC,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE3E,wBAAwB;AACxB,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAEjF,6BAA6B;AAC7B,OAAO,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAEzE,wCAAwC;AACxC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,gBAAgB,GACtB,MAAM,4BAA4B,CAAA;AAEnC,uCAAuC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,0CAA0C;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD,4CAA4C;AAC5C,OAAO,EACL,eAAe,EACf,KAAK,sBAAsB,GAC5B,MAAM,mBAAmB,CAAA"}
@@ -1,6 +1,7 @@
1
1
  import { InjectionKey } from 'vue';
2
+ import { VueSchemxInstance } from '../bridge';
2
3
  import { SchemxInstance, Values } from '@schemx/core';
3
- type FormContextInstance = SchemxInstance<any>;
4
+ type FormContextInstance = VueSchemxInstance<any>;
4
5
  /**
5
6
  * SchemxInstance 在 Vue provide/inject 中使用的注入 key。
6
7
  *
@@ -34,7 +35,7 @@ export declare const FORM_INSTANCE_KEY: InjectionKey<FormContextInstance>;
34
35
  * createFormContext(form)
35
36
  * ```
36
37
  */
37
- export declare function createFormContext<TValues extends Values = Values>(instance: SchemxInstance<TValues>): void;
38
+ export declare function createFormContext<TValues extends Values = Values>(instance: SchemxInstance<TValues>): VueSchemxInstance<TValues>;
38
39
  /**
39
40
  * 获取最近祖先组件提供的表单实例。
40
41
  *
@@ -53,6 +54,6 @@ export declare function createFormContext<TValues extends Values = Values>(insta
53
54
  * form.setFieldValue("name", "Schemx")
54
55
  * ```
55
56
  */
56
- export declare function useFormContext<TValues extends Values = Values>(): SchemxInstance<TValues>;
57
+ export declare function useFormContext<TValues extends Values = Values>(): VueSchemxInstance<TValues>;
57
58
  export {};
58
59
  //# sourceMappingURL=provideFormContext.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provideFormContext.d.ts","sourceRoot":"","sources":["../../src/hooks/provideFormContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAU,KAAK,YAAY,EAAW,MAAM,KAAK,CAAA;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1D,KAAK,mBAAmB,GAAG,cAAc,CAAC,GAAG,CAAC,CAAA;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAgC,YAAY,CAC/E,mBAAmB,CACpB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,mCAA2B,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/D,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,GAChC,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,SAAS,MAAM,GAAG,MAAM,KAC5B,cAAc,CAAC,OAAO,CAAC,CAW3B"}
1
+ {"version":3,"file":"provideFormContext.d.ts","sourceRoot":"","sources":["../../src/hooks/provideFormContext.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAU,KAAK,YAAY,EAA2B,MAAM,KAAK,CAAA;AAExE,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,WAAW,CAAA;AAElB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAK1D,KAAK,mBAAmB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAgC,YAAY,CAC/E,mBAAmB,CACpB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,mCAA2B,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/D,QAAQ,EAAE,cAAc,CAAC,OAAO,CAAC,GAChC,iBAAiB,CAAC,OAAO,CAAC,CAS5B;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAC5B,OAAO,SAAS,MAAM,GAAG,MAAM,KAC5B,iBAAiB,CAAC,OAAO,CAAC,CAW9B"}
@@ -1,36 +1,10 @@
1
1
  import { FieldInstance } from '../types/field';
2
2
  import { NamePath, Values } from '@schemx/core';
3
3
  /**
4
- * 获取单个字段的控制能力
4
+ * 获取单个字段的控制能力。
5
5
  *
6
- * 通过 core 层 createField 提供字段操作方法,
7
- * 通过 subscribe 回调桥接 Signal 变化到 Vue shallowRef。
8
- *
9
- * @param name - 字段名(支持嵌套路径,如 'user.address.city')
10
- * @returns 字段状态和操作方法
11
- *
12
- * @example
13
- * ```typescript
14
- * const field = useField('username')
15
- *
16
- * // 响应式值(在 computed/watchEffect/template 中自动追踪)
17
- * field.getValue()
18
- *
19
- * // 响应式错误
20
- * field.errors.value // readonly string[]
21
- *
22
- * // 响应式脏状态
23
- * field.dirty.value // boolean
24
- *
25
- * // 响应式操作中状态
26
- * field.pending.value // boolean
27
- *
28
- * // 写入值
29
- * field.setValue('new value')
30
- *
31
- * // 校验
32
- * const result = await field.validate()
33
- * ```
6
+ * @param name - 字段路径(支持嵌套字段)。
7
+ * @returns 包含 Vue Ref 状态和 Core 字段操作的控制器。
34
8
  */
35
9
  export declare const useField: <TValues extends Values = Values>(name: NamePath<TValues>) => FieldInstance<TValues>;
36
10
  export default useField;
@@ -1 +1 @@
1
- {"version":3,"file":"useField.d.ts","sourceRoot":"","sources":["../../src/hooks/useField.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAMH,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAI9C,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,EAAE,MAAM,cAAc,CAAA;AAwEpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,MAAM,GAAG,MAAM,EACtD,MAAM,QAAQ,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,OAAO,CAuCvB,CAAA;AAED,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"useField.d.ts","sourceRoot":"","sources":["../../src/hooks/useField.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAgDpD;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,SAAS,MAAM,GAAG,MAAM,EACtD,MAAM,QAAQ,CAAC,OAAO,CAAC,KACtB,aAAa,CAAC,OAAO,CAUvB,CAAA;AAED,eAAe,QAAQ,CAAA"}
@@ -1,4 +1,5 @@
1
- import { CreateFormOptions, NamePath, SchemxInstance, Values } from '@schemx/core';
1
+ import { VueSchemxInstance } from '../bridge';
2
+ import { CreateFormOptions, NamePath, Values } from '@schemx/core';
2
3
  /**
3
4
  * useForm 配置选项。
4
5
  *
@@ -52,5 +53,5 @@ export interface UseFormOptions<TValues extends Values> extends CreateFormOption
52
53
  * createFormContext(form)
53
54
  * ```
54
55
  */
55
- export declare function useForm<TValues extends Values = Values>(options?: UseFormOptions<TValues>): SchemxInstance<TValues>;
56
+ export declare function useForm<TValues extends Values = Values>(options?: UseFormOptions<TValues>): VueSchemxInstance<TValues>;
56
57
  //# sourceMappingURL=useForm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../src/hooks/useForm.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAEvF;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,MAAM,CAAE,SAAQ,iBAAiB,CAC/E,OAAO,EACP,QAAQ,CAAC,OAAO,CAAC,CAClB;CAAG;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,OAAO,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACrD,OAAO,GAAE,cAAc,CAAC,OAAO,CAAM,GACpC,cAAc,CAAC,OAAO,CAAC,CA0BzB"}
1
+ {"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../src/hooks/useForm.ts"],"names":[],"mappings":"AAaA,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,WAAW,CAAA;AAKlB,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAEvE;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc,CAAC,OAAO,SAAS,MAAM,CAAE,SAAQ,iBAAiB,CAC/E,OAAO,EACP,QAAQ,CAAC,OAAO,CAAC,CAClB;CAAG;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,OAAO,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACrD,OAAO,GAAE,cAAc,CAAC,OAAO,CAAM,GACpC,iBAAiB,CAAC,OAAO,CAAC,CAgC5B"}
@@ -0,0 +1,38 @@
1
+ import { ShallowRef } from 'vue';
2
+ import { SchemxInstance, Values } from '@schemx/core';
3
+ /**
4
+ * `useFormSelector` 的选中结果比较配置。
5
+ */
6
+ export interface UseFormSelectorOptions<TSelected> {
7
+ /**
8
+ * 判断两次 selector 结果是否等价;返回 true 时保持当前 Ref 值。
9
+ * 默认使用 `Object.is`。
10
+ */
11
+ equals?: (previous: TSelected, next: TSelected) => boolean;
12
+ }
13
+ /**
14
+ * 将 Core 表单值按 selector 映射为 Vue 只读浅引用。
15
+ *
16
+ * selector 只应读取快照,不应通过快照修改表单值或调用表单写入方法。
17
+ * `Readonly<TValues>` 仅表达顶层只读,嵌套字段应按不可变值使用;字段值需通过
18
+ * `setFieldValue()` 或 `setFieldsValue()` 更新,才能触发后续计算。
19
+ *
20
+ * @typeParam TValues - 表单值类型。
21
+ * @typeParam TSelected - selector 返回值类型。
22
+ * @param form - 要订阅的表单实例。
23
+ * @param selector - 从当前表单值快照派生结果的纯函数。
24
+ * @param options - 选中结果的比较配置。
25
+ * @returns selector 当前结果的 Vue 只读浅引用。
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const selectedName = useFormSelector(form, (values) => values.name)
30
+ *
31
+ * watchEffect(() => {
32
+ * console.log(selectedName.value)
33
+ * })
34
+ * ```
35
+ */
36
+ export declare function useFormSelector<TValues extends Values = Values, TSelected = unknown>(form: SchemxInstance<TValues>, selector: (values: Readonly<TValues>) => TSelected, options?: UseFormSelectorOptions<TSelected>): Readonly<ShallowRef<TSelected>>;
37
+ export default useFormSelector;
38
+ //# sourceMappingURL=useFormSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormSelector.d.ts","sourceRoot":"","sources":["../../src/hooks/useFormSelector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAIrC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1D;;GAEG;AACH,MAAM,WAAW,sBAAsB,CAAC,SAAS;IAC/C;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,KAAK,OAAO,CAAA;CAC3D;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,SAAS,MAAM,GAAG,MAAM,EAC/B,SAAS,GAAG,OAAO,EAEnB,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,EAC7B,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,SAAS,EAClD,OAAO,GAAE,sBAAsB,CAAC,SAAS,CAAM,GAC9C,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAgCjC;AAED,eAAe,eAAe,CAAA"}
@@ -1,11 +1,13 @@
1
- import { ShallowRef } from 'vue';
1
+ import { ComputedRef, ShallowRef } from 'vue';
2
2
  import { SchemxInstance, SchemxViewSchema, Values } from '@schemx/core';
3
3
  /**
4
- * 将表单 ViewSchema 映射为 Vue 响应式引用,并在当前作用域销毁时自动取消订阅。
4
+ * 将表单 ViewSchema 映射为共享的 Vue 响应式引用。
5
+ *
6
+ * 当前作用域释放一个桥接使用者;所有使用者都释放后才取消 Core 订阅。
5
7
  *
6
8
  * @typeParam TValues - 表单值类型。
7
9
  * @param form - 要订阅的表单实例。
8
- * @returns 当前 ViewSchema 列表的只读浅引用。
10
+ * @returns 当前 ViewSchema 列表的共享响应式浅引用;调用方不应直接改写其值。
9
11
  *
10
12
  * @example
11
13
  * ```ts
@@ -16,5 +18,23 @@ import { SchemxInstance, SchemxViewSchema, Values } from '@schemx/core';
16
18
  * ```
17
19
  */
18
20
  export declare function useViewSchemas<TValues extends Values = Values>(form: SchemxInstance<TValues>): ShallowRef<readonly SchemxViewSchema<TValues>[]>;
21
+ /**
22
+ * 获取指定 key 的响应式 ViewSchema,并复用当前表单的共享订阅。
23
+ *
24
+ * @typeParam TValues - 表单值类型。
25
+ * @param form - 要读取的表单实例。
26
+ * @param getKey - 返回当前 schema key 的响应式 getter。
27
+ * @returns 对应的最新 ViewSchema;不存在时返回 undefined。
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const schema = useViewSchema(form, () => fieldKey)
32
+ *
33
+ * watchEffect(() => {
34
+ * console.log(schema.value?.label)
35
+ * })
36
+ * ```
37
+ */
38
+ export declare function useViewSchema<TValues extends Values = Values>(form: SchemxInstance<TValues>, getKey: () => string): ComputedRef<SchemxViewSchema<TValues> | undefined>;
19
39
  export default useViewSchemas;
20
40
  //# sourceMappingURL=useViewSchemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useViewSchemas.d.ts","sourceRoot":"","sources":["../../src/hooks/useViewSchemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE5E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC5D,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,GAC5B,UAAU,CAAC,SAAS,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,CAYlD;AAED,eAAe,cAAc,CAAA"}
1
+ {"version":3,"file":"useViewSchemas.d.ts","sourceRoot":"","sources":["../../src/hooks/useViewSchemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAElD,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,MAAM,EACZ,MAAM,cAAc,CAAA;AA+BrB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC5D,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,GAC5B,UAAU,CAAC,SAAS,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC,CAIlD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC3D,IAAI,EAAE,cAAc,CAAC,OAAO,CAAC,EAC7B,MAAM,EAAE,MAAM,MAAM,GACnB,WAAW,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC,CAIpD;AAqGD,eAAe,cAAc,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useWatch.d.ts","sourceRoot":"","sources":["../../src/hooks/useWatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAQH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,OAAO,SAAS,MAAM,EAC7C,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,EACnC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAAA;AACb;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,OAAO,SAAS,MAAM,EAC7C,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,EACvB,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACrC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAAA;AACb;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,OAAO,SAAS,MAAM,EAC7C,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,EAC1B,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,EACtC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAAA;AA2Bb;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC3D,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,EACvB,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACrC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAEZ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,EACnD,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,EAC1B,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,EACtC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAEZ;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACzD,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,EACnC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAEZ;AAED,eAAe,QAAQ,CAAA"}
1
+ {"version":3,"file":"useWatch.d.ts","sourceRoot":"","sources":["../../src/hooks/useWatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAUH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,OAAO,SAAS,MAAM,EAC7C,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,EACnC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAAA;AACb;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,OAAO,SAAS,MAAM,EAC7C,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,EACvB,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACrC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAAA;AACb;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,OAAO,SAAS,MAAM,EAC7C,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,EAC1B,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,EACtC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAAA;AA2Bb;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EAC3D,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,EACvB,QAAQ,EAAE,kBAAkB,CAAC,OAAO,CAAC,EACrC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAEZ;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,EACnD,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,EAC1B,QAAQ,EAAE,mBAAmB,CAAC,OAAO,CAAC,EACtC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAEZ;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,WAAW,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACzD,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,EACnC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,MAAM,IAAI,CAEZ;AAED,eAAe,QAAQ,CAAA"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("@schemx/core"),r=require("classnames"),n=require("es-toolkit"),o=require("@schemx/core/adapter"),a=Symbol("schemx:app-config"),l=Object.freeze({schemaConfig:Object.freeze({}),validatorAdapters:Object.freeze([])});function s(e,t={}){const r=function(e){const t=Object.freeze({...e.schemaConfig??{}}),r=Object.freeze([...e.validatorAdapters??[]]);return Object.freeze({schemaConfig:t,validatorAdapters:r,defaultRendererType:e.defaultRendererType,rendererRegistry:e.rendererRegistry,validationRuleRegistry:e.validationRuleRegistry})}(t);e.provide(a,r)}const i=o.createRendererRegistry("input"),c=t.createValidationRuleRegistry();function u(r={}){const n=t.mergeSchemxConfig(function(e){const{schemaConfig:t={},validatorAdapters:r=[],defaultRendererType:n,rendererRegistry:o,validationRuleRegistry:a}=e;return{schemaConfig:t,defaultRendererType:n,rendererRegistry:o,validationRuleRegistry:a,validatorAdapters:r}}(r),null===e.getCurrentInstance()?l:e.inject(a,l),{rendererRegistry:i,validationRuleRegistry:c}),o={...r,...n},s=t.createForm(o);return e.onScopeDispose(()=>{s.destroy()}),s}const d=Symbol("schemx:instance");function m(t){e.provide(d,t)}function p(){const t=e.inject(d,null);if(!t)throw new Error("[schemx] useFormContext() must be called inside a <SchemxForm> descendant. Ensure createFormContext(form) is called synchronously during setup().");return t}const h=new WeakMap;const f=r=>{const n=p(),o=r;let a=h.get(n);a||(a=new Map,h.set(n,a));const l=a.get(o);let s;if(l)l.refCount++,s=l;else{const{result:l,dispose:i}=function(r,n){const o=t.createField(r,n),a=e.shallowRef(o.getValue()),l=e.shallowRef(o.getErrors()),s=e.shallowRef(o.isPending()),i=o.effect(()=>{a.value=o.getValue(),l.value=o.getErrors(),s.value=o.isPending()}),c=e.computed(()=>l.value),u=e.computed(()=>(a.value,o.isTouched())),d=e.computed(()=>s.value);return{result:{name:n,value:a,errors:c,dirty:u,pending:d,...o,getValue:()=>a.value},dispose:i}}(n,r);s={refCount:1,result:l,dispose:i},a.set(o,s)}return e.onUnmounted(()=>{--s.refCount<=0&&(s.dispose(),a.delete(o))}),s.result},v=Symbol("schemx:field");function y(t){e.provide(v,t)}function g(){const t=e.inject(v);if(!t)throw new Error("[schemx] useFieldContext() must be called inside a component tree where createFieldContext(field) has been called.");return t}function b(r,n,o){const a=p(),l=t.createWatch(a,r,n,o);return e.onUnmounted(l),l}function x(e,t,r){return b(e,t,r)}function C(e){return e instanceof Error?e:new Error(String(e))}const w=(t,r)=>{var n;const o=p(),a=e.shallowRef([]),l=e.ref(!1),s=e.ref(void 0);let i=0;const c=async()=>{try{const e=o.getFieldsValue();if("function"==typeof t.shouldFetch&&!t.shouldFetch(e))return a.value=[],void(l.value=!1);l.value=!0,s.value=void 0;const r=++i,n=await(async e=>{const r=t.retryCount??0,n=t.retryInterval??1e3;let a=new Error("Unknown error");for(let s=0;s<=r;s++)try{return await t.api(e,o)}catch(l){a=C(l),s<r&&await new Promise(e=>setTimeout(e,n))}throw a})(e);if(r!==i)return;const c=await(async e=>{if("function"==typeof(null==t?void 0:t.formatter))return await t.formatter(e,o);if(!Array.isArray(e))throw new Error("[schemx] Dictionary api must return an array when formatter is not provided.");return e})(n);if(r!==i)return;a.value=c,s.value=void 0,"function"==typeof t.onSuccess&&t.onSuccess(c,o),l.value=!1}catch(e){const r=C(e);s.value=r,a.value=[],l.value=!1,"function"==typeof t.onError&&t.onError(r,o)}};(null==(n=t.dependsOn)?void 0:n.length)&&x(t.dependsOn,(e,n)=>{"function"==typeof t.onDepsChange&&t.onDepsChange(e,o),t.resetOnDepsChange&&r&&o.setFieldValue(r,void 0),c()});const u=t.immediate??!0;return e.onMounted(()=>{u&&c()}),{list:a,loading:l,error:s,loadDict:c,refresh:()=>c(),mutate:e=>{a.value=e}}},F=Symbol("schemx:form-config"),R=t=>{e.provide(F,t)};function S(){const t=e.inject(F);if(!t)throw new Error("[schemx] useFormConfigContext() must be called inside a <SchemxForm> descendant. Ensure createFormConfigContext(props) is called synchronously during setup().");return t}function V(t){const r=e.shallowRef({});return e.watchEffect(()=>{const e=t();((e,t)=>{const r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(r=>e[r]===t[r])})(r.value,e)||(r.value=e)}),r}function A(t){const r=e.shallowRef(t.getViewSchemas()),n=t.subscribeViewSchemas(e=>{r.value=e});return e.onScopeDispose(n),r}function k(e){return void 0!==e&&(!Array.isArray(e)||0!==e.length)}function _(e,t){if(!t)return!1;return(Array.isArray(t)?t:[t]).some(t=>function(e){return{onBlur:"blur",onChange:"change",onSubmit:"submit",blur:"blur",change:"change",submit:"submit"}[e]??"submit"}(t)===e)}const O=e=>/[A-Z]/.test(e),j=e=>e.includes("-"),E=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),P=e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),B=(e,t)=>{if(e[t])return e[t];const r=O(t)?E(t):j(t)?P(t):void 0;return r&&e[r]?e[r]:void 0},T=(e,t)=>{const r={},n=(o=String(e),(j(o)?P(o):o)+":");var o;const a=(e=>O(e)?E(e):e)(String(e))+":";for(const[l,s]of Object.entries(t))l.startsWith(n)?r[l.slice(n.length)]=s:l.startsWith(a)&&a!==n&&(r[l.slice(a.length)]=s);return r},N=e.defineComponent((t,{slots:n})=>{var o;const a=e.ref(Boolean(t.schema.defaultCollapsed)),l=e.computed(()=>t.schema.collapsed??a.value),s=(null==(o=e.getCurrentInstance())?void 0:o.uid)??0;e.watch(()=>t.schema.collapsed,(e,t)=>{void 0!==e?a.value=e:void 0!==t&&(a.value=t)});const i=()=>{var e,r;if(!t.schema.collapsible||t.schema.disabled)return;const n=!l.value;void 0===t.schema.collapsed&&(a.value=n),null==(r=(e=t.schema).onCollapsedChange)||r.call(e,n)};return()=>{var o;const a=t.schema;if(!1===a.visible)return null;const c=Boolean(a.collapsible),u=l.value,d=a.destroyOnCollapse??!0,m=`schemx-group-${(null==(o=a.debug)?void 0:o.runtimeNodeId)??`local-${s}`}-${$(a.key)}`,p=`${m}-header`,h=`${m}-body`,f=e.createVNode("div",{id:h,role:"group","aria-labelledby":a.label?p:void 0,"aria-hidden":u||void 0,class:"schemx-group__body",style:!d&&u?{display:"none"}:void 0},[a.children.map(t=>e.createVNode(z,{key:t.key,schema:t},n))]);return e.createVNode("div",{class:r("schemx-group",{"schemx-group--collapsed":u,"is-readonly":a.readonly,"is-disabled":a.disabled},a.class),style:a.style,"data-key":a.key,"aria-disabled":a.disabled||void 0},[a.label&&e.createVNode("div",{id:p,role:c?"button":void 0,tabindex:c?a.disabled?-1:0:void 0,"aria-expanded":c?!u:void 0,"aria-controls":c?h:void 0,"aria-disabled":c&&a.disabled||void 0,class:r("schemx-group__header",{"schemx-group__header--clickable":c&&!a.disabled}),onClick:i,onKeydown:e=>{a.disabled||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i())}},[e.createVNode("span",{class:"schemx-group__title"},[a.label]),c&&e.createVNode("span",{class:r("schemx-group__arrow",{"schemx-group__arrow--down":!u})},null)]),d?!u&&f:f])}},{name:"SchemxGroup",props:{schema:{type:Object,required:!0}}}),$=e=>String(e).replace(/[^a-zA-Z0-9_-]/g,"-");function q(e){return Array.isArray(e)?e.map(e=>String(e)).join("."):String(e)}const W=e.defineComponent({name:"SchemxItem",props:{schema:{type:Object,required:!0}},setup:(r,{slots:n})=>()=>{const o=r.schema;return t.isViewGroupSchema(o)?e.h(N,{schema:o},n):e.h(I,{schema:o},n)}}),I=e.defineComponent({name:"SchemxFieldItem",inheritAttrs:!1,props:{schema:{type:Object,required:!0}},setup(n,{attrs:o,slots:a}){const l=p(),s=n.schema,i=e.shallowRef(0),c=l.effect(()=>{l.getViewSchemas(),i.value++});e.onUnmounted(c);const u=e.computed(()=>{i.value;const e=l.getViewSchemas().find(e=>e.key===s.key);return e&&t.isSchemxViewFieldSchema(e)?e:s}),d=S(),m=f(u.value.name);y(m);const h=e.computed(()=>{return e=u.value.validationTrigger,t=d.schemaConfig.validationTrigger,r="onChange",k(e)?e:k(t)?t:r;var e,t,r}),v=e.computed(()=>{const e=u.value.visible&&!u.value.readonly&&!u.value.disabled,t=u.value.rules,r=Array.isArray(t)?(null==t?void 0:t.length)>0:!!u.value.rules;return e&&(Boolean(u.value.required)||r)}),g=e=>{var t,r;m.setValue(e),null==(r=null==(t=u.value.componentProps)?void 0:t.onChange)||r.call(t,e),v.value&&_("change",h.value)&&m.validate()},b=e=>{var t,r;null==(r=null==(t=u.value.componentProps)?void 0:t.onBlur)||r.call(t,e),v.value&&_("blur",h.value)&&m.validate()},x=e=>{m.setValue(e)},C=V(()=>{const e=u.value,t=e.componentProps??{},r={name:e.name,label:e.label,componentType:e.componentType,...t.formItemProps};return{...t,value:m.value.value,disabled:e.disabled,readonly:e.readonly,readonlyPlaceholder:e.readonlyPlaceholder,placeholder:e.placeholder,formItemProps:{...r,disabled:e.disabled,readonly:e.readonly,readonlyPlaceholder:e.readonlyPlaceholder,placeholder:e.placeholder},onChange:g,onBlur:b,"onUpdate:value":x}}),{createSlotProps:w,renderAfter:F,renderBefore:R,renderContent:A,renderError:O,renderLabel:j}=function(t){const{schemaRef:r,field:n,form:o,formContext:a,componentProps:l,slots:s}=t,i=(e={})=>({...l.value,value:n.value.value,...e}),c=e=>{const t=B(s,`${r.value.name}${e}`);return(null==t?void 0:t(i()))??null};return{createSlotProps:i,renderAfter:()=>c("After"),renderBefore:()=>c("Before"),renderContent:()=>{const t=o.getRenderer(r.value.componentType);if(!t)throw new Error(`[schemx] Can not find component renderer of "${r.value.componentType}".`);const n=T(q(r.value.name),s),a=e.h(t,l.value,n),c=B(s,`${r.value.name}Content`);return c?c(i({columnElement:a})):e.createVNode("div",{class:"schemx-item__control"},[a])},renderError:()=>{const t=B(s,`${r.value.name}Error`);return t?t(i({errors:n.errors.value})):0===n.errors.value.length?null:e.createVNode("div",{class:"schemx-item__error"},[n.errors.value[0]])},renderLabel:()=>{const t=B(s,`${r.value.name}Label`);if(t)return t(r.value);const n=r.value.labelAlign||a.schemaConfig.labelAlign,o=r.value.labelWidth||a.schemaConfig.labelWidth,l=r.value.colon??a.schemaConfig.colon;return e.createVNode("label",{class:"schemx-item__label",style:{width:o,textAlign:n}},[!(r.value.showRequiredMark??Boolean(r.value.required))||r.value.disabled||r.value.readonly?null:e.createVNode("span",{class:"schemx-item__required"},[e.createTextVNode("*")]),e.createVNode("span",{class:"schemx-item__label-text"},[r.value.label,l?":":""])])}}}({schemaRef:u,field:m,form:l,formContext:d,componentProps:C,slots:a});return()=>{if(!u.value.visible)return null;const t=B(a,q(u.value.name));if(t)return t(w());const n=u.value.labelPosition||d.schemaConfig.labelPosition;return e.createVNode("div",e.mergeProps(o,{class:r("schemx-item-wrapper",o.class),style:[o.style,u.value.style]}),[e.createVNode("div",{class:r("schemx-item",`schemx-item--label-${n}`,u.value.class,{"is-readonly":u.value.readonly,"is-disabled":u.value.disabled}),style:{...u.value.style??{}}},[j(),e.createVNode("div",{class:"schemx-item__content"},[R(),A(),F(),O()])])])}}}),z=W;function L(e){return!!e&&!t.isViewGroupSchema(e)&&!1!==e.visible}function D(e,r,n){for(let o=r+n;o>=0&&o<e.length;o+=n){const r=e[o];if(!1!==r.visible){if(t.isViewGroupSchema(r))return!1;if(L(r))return!0}}return!1}const M=e.defineComponent({name:"SchemxForm",__name:"form",props:{schemas:{default:()=>[]},initialValues:{default:()=>({})},modelValue:{default:()=>({})},form:{default:void 0},class:{default:""},style:{type:[Boolean,null,String,Object,Array],default:()=>({})},validatorAdapters:{},defaultRendererType:{},rendererRegistry:{default:void 0},validationRuleRegistry:{default:void 0},onRuleError:{},onFinish:{type:Function,default:void 0},onFinishFailed:{type:Function,default:void 0},onValuesChange:{type:Function,default:void 0},onFieldsChange:{type:Function,default:void 0},lifecycleHooks:{},required:{type:[Boolean,Object]},readonly:{type:Boolean},disabled:{type:Boolean},visible:{type:Boolean,default:!0},labelIcon:{},labelAlign:{},labelPosition:{},labelWidth:{},contentAlign:{},validationTrigger:{},colon:{type:Boolean},showRequiredMark:{type:Boolean}},emits:["update:modelValue"],setup(r,{expose:o,emit:a}){const l=r,s=a,i=()=>n.pick(l,t.defaultSchemxConfigKeys),c=e.reactive(i());R({schemaConfig:c});const d=l.form?l.form:u({schemas:l.schemas,schemaConfig:i(),initialValues:Object.keys(l.modelValue).length>0?l.modelValue:l.initialValues,rendererRegistry:l.rendererRegistry,defaultRendererType:l.defaultRendererType,validationRuleRegistry:l.validationRuleRegistry,validatorAdapters:l.validatorAdapters,onFinish:async e=>{var t;null==(t=l.onFinish)||t.call(l,e)},onFinishFailed:async e=>{var t;null==(t=l.onFinishFailed)||t.call(l,e)},onValuesChange:(e,t)=>{var r;null==(r=l.onValuesChange)||r.call(l,e,t)},onFieldsChange:(e,t)=>{var r;null==(r=l.onFieldsChange)||r.call(l,e,t)}}),p=void 0!==l.form;m(d);let h=!1;e.watch(()=>l.modelValue,e=>{h=!0,d.setFieldsValue(e),h=!1},{deep:!0});const f=t.createWatch(d,e=>{h||s("update:modelValue",e)});e.onUnmounted(f),e.watch(()=>l.schemas,e=>{t.isSchemxSchemas(e)||d.setSchemas(e)},{deep:!1,immediate:!!l.form});const v=A(d),y=e=>{const{isFirst:t,isLast:r}=function(e,t){const r=e.findIndex(e=>e.key===t);return-1===r?{found:!1,isFirst:!1,isLast:!1}:L(e[r])?{found:!0,isFirst:!D(e,r,-1),isLast:!D(e,r,1)}:{found:!0,isFirst:!1,isLast:!1}}(v.value,e.key);return{"schemx-item-wrapper--first":t,"schemx-item-wrapper--last":r}};return e.watch(i,e=>{Object.assign(c,e),d.updateSchemaConfig(e)},{deep:!1,immediate:p}),o({...d}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["schemx",l.class]),style:e.normalizeStyle(l.style)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(v),r=>(e.openBlock(),e.createBlock(e.unref(z),{key:r.key,schema:r,class:e.normalizeClass(y(r))},e.createSlots({_:2},[e.renderList(t.$slots,(r,n)=>({name:n,fn:e.withCtx(r=>[e.renderSlot(t.$slots,n,e.mergeProps({ref_for:!0},r??{}))])}))]),1032,["schema","class"]))),128))],6))}});var U,G;const Z=(U=M,G={install(e,t={}){s(e,t),e.component("SchemxForm",M)},FormItem:z},Object.assign(U,G));exports.FormGroup=N,exports.FormItem=z,exports.WithRemoteOptions=function(t){return e.defineComponent({name:`WithRemoteOptions(${t.name||"Anonymous"})`,inheritAttrs:!1,props:{dict:{type:[Object,Function],default:void 0}},setup(r,{attrs:n,slots:o}){const a=function(e){return"function"==typeof e?{api:e}:e}(r.dict),l=a?n.fieldName??g().name:void 0,s=a?w(a,l):null,i=e.computed(()=>({...n,dict:a,options:a?null==s?void 0:s.list.value:n.options,loading:a?null==s?void 0:s.loading.value:n.loading}));return()=>e.h(t,i.value,o)}})},exports.createFieldContext=y,exports.createFormConfigContext=R,exports.createFormContext=m,exports.default=Z,exports.rendererRegistry=i,exports.schemxForm=Z,exports.useDictionary=w,exports.useField=f,exports.useFieldContext=g,exports.useForm=u,exports.useFormConfigContext=S,exports.useFormContext=p,exports.useStableRef=V,exports.useViewSchemas=A,exports.useWatch=b,exports.useWatchAll=function(e,t){return b(e,t)},exports.useWatchField=function(e,t,r){return b(e,t,r)},exports.useWatchFields=x,exports.validationRuleRegistry=c,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),t=require("@schemx/core"),r=require("classnames"),o=require("@schemx/core/adapter"),n=require("es-toolkit");function a(t){return e.shallowRef(t)}function s(e,t){const r=e.stateAdapter.field(t),o=e.fieldBridges.get(r);if(o)return o;const n=r.getSnapshot(),s=a(n.value),l=a(n.errors),i=a(n.touched),u=a(n.pending),d=r.subscribe(()=>{const e=r.getSnapshot();var t,o;Object.is(s.value,e.value)||(s.value=e.value),t=l.value,o=e.errors,t.length===o.length&&t.every((e,t)=>e===o[t])||(l.value=e.errors),i.value!==e.touched&&(i.value=e.touched),u.value!==e.pending&&(u.value=e.pending)}),c={source:r,value:s,errors:l,touched:i,pending:u,dispose:()=>{d()}};return e.fieldBridges.set(r,c),c}const l=new WeakMap,i=new WeakMap,u=new WeakMap;function d(e){return u.get(e)??e}function c(e){const t=d(e),r=l.get(t);if(r)return r;const n=function(e){const t=o.createFormStateAdapter(e),r=a(t.values.getSnapshot()),n=a(t.touchedFields.getSnapshot()),s=a(t.pendingFields.getSnapshot()),l=a(t.loading.getSnapshot()),i=new Map,u=()=>{r.value=t.values.getSnapshot()},d=()=>{n.value=t.touchedFields.getSnapshot()},c=()=>{s.value=t.pendingFields.getSnapshot()},p=()=>{l.value=t.loading.getSnapshot()},v=t.values.subscribe(u),f=t.touchedFields.subscribe(d),h=t.pendingFields.subscribe(c),g=t.loading.subscribe(p),y=()=>{v(),f(),h(),g()},b=m(e),x={form:e,stateAdapter:t,values:r,touchedFields:n,pendingFields:s,loading:l,fieldBridges:i,refCount:0,destroyed:!1,unsubscribe:y,facade:b};return x}(t);return l.set(t,n),n}function m(e){const t=d(e),r=i.get(t);if(r)return r;const o=function(e,t){let r=!1;return{...e,getFieldValue:o=>{if(!r){const r=t.getFormBridge(e);t.getFieldBridge(r,o).value.value}return e.getFieldValue(o)},getFieldErrors:o=>{if(!r){const r=t.getFormBridge(e);t.getFieldBridge(r,o).errors.value}return e.getFieldErrors(o)},isFieldTouched:o=>{if(!r){const r=t.getFormBridge(e);t.getFieldBridge(r,o).touched.value}return e.isFieldTouched(o)},isFieldPending:o=>{if(!r){const r=t.getFormBridge(e);t.getFieldBridge(r,o).pending.value}return e.isFieldPending(o)},getFieldsValue:o=>{if(!r){const r=t.getFormBridge(e);if(void 0===o)r.values.value;else for(const e of o)t.getFieldBridge(r,e).value.value}return e.getFieldsValue(o)},getTouchedFields:()=>(r||t.getFormBridge(e).touchedFields.value,e.getTouchedFields()),getPendingFields:()=>(r||t.getFormBridge(e).pendingFields.value,e.getPendingFields()),isLoading:()=>(r||t.getFormBridge(e).loading.value,e.isLoading()),destroy:()=>{if(r)return;r=!0;const o=t.getCachedFormBridge(e);o&&t.disposeFormBridge(o),e.destroy()}}}(t,{getFormBridge:e=>c(e),getFieldBridge:(e,t)=>s(e,t),getCachedFormBridge:e=>l.get(e),disposeFormBridge:e=>v(e)});return i.set(t,o),u.set(o,t),o}function p(e){if(e.destroyed)return()=>{};e.refCount++;let t=!1;return()=>{t||e.destroyed||(t=!0,e.refCount--,0===e.refCount&&v(e))}}function v(e){if(!e.destroyed){e.destroyed=!0,e.refCount=0,e.unsubscribe();for(const t of e.fieldBridges.values())t.dispose();e.fieldBridges.clear(),e.stateAdapter.dispose(),l.delete(e.form)}}const f=Symbol("schemx:app-config"),h=Object.freeze({schemaConfig:Object.freeze({}),validatorAdapters:Object.freeze([])});function g(e){if(void 0===e)return;const t=Object.entries(e).map(([e,t])=>[e,void 0===t?void 0:Object.freeze({...t})]);return Object.freeze(Object.fromEntries(t))}function y(e,t={}){const r=function(e){const t=Object.freeze({...e.schemaConfig??{}}),r=Object.freeze([...e.validatorAdapters??[]]);return Object.freeze({schemaConfig:t,rendererProps:g(e.rendererProps),validatorAdapters:r,defaultRendererType:e.defaultRendererType,rendererRegistry:e.rendererRegistry,validationRuleRegistry:e.validationRuleRegistry})}(t);e.provide(f,r)}const b=o.createRendererRegistry("input"),x=t.createValidationRuleRegistry();function F(r={}){const o=t.mergeSchemxConfig(function(e){const{schemaConfig:t={},rendererProps:r,validatorAdapters:o=[],defaultRendererType:n,rendererRegistry:a,validationRuleRegistry:s}=e;return{schemaConfig:t,rendererProps:r,defaultRendererType:n,rendererRegistry:a,validationRuleRegistry:s,validatorAdapters:o}}(r),null===e.getCurrentInstance()?h:e.inject(f,h),{rendererRegistry:b,validationRuleRegistry:x}),n={...r,...o},a=t.createForm(n),s=m(a),l=p(c(a));return e.onScopeDispose(()=>{l(),s.destroy()}),s}const C=Symbol("schemx:instance");function B(t){const r=m(t),o=p(c(r));return e.provide(C,r),e.onScopeDispose(o),r}function S(){const t=e.inject(C,null);if(!t)throw new Error("[schemx] useFormContext() must be called inside a <SchemxForm> descendant. Ensure createFormContext(form) is called synchronously during setup().");return t}const w=r=>{const o=S();return function(r,o,n){const a=d(r),s=t.createField(a,o),l=e.computed(()=>n.errors.value),i=e.computed(()=>n.touched.value),u=e.computed(()=>n.pending.value);return{...s,name:o,value:n.value,errors:l,dirty:i,pending:u,getValue:()=>n.value.value,getErrors:()=>n.errors.value,isTouched:()=>n.touched.value,isPending:()=>n.pending.value,getValues:()=>r.getFieldsValue()}}(o,r,s(c(d(o)),r))},k=Symbol("schemx:field");function V(t){e.provide(k,t)}function R(){const t=e.inject(k);if(!t)throw new Error("[schemx] useFieldContext() must be called inside a component tree where createFieldContext(field) has been called.");return t}function O(r,o,n){const a=S(),s=t.createWatch(d(a),r,o,n);return e.onUnmounted(s),s}function _(e,t,r){return O(e,t,r)}function j(e){return e instanceof Error?e:new Error(String(e))}const A=(t,r)=>{var o;const n=S(),a=e.shallowRef([]),s=e.ref(!1),l=e.ref(void 0);let i=0;const u=async()=>{try{const e=n.getFieldsValue();if("function"==typeof t.shouldFetch&&!t.shouldFetch(e))return a.value=[],void(s.value=!1);s.value=!0,l.value=void 0;const r=++i,o=await(async e=>{const r=t.retryCount??0,o=t.retryInterval??1e3;let a=new Error("Unknown error");for(let l=0;l<=r;l++)try{return await t.api(e,n)}catch(s){a=j(s),l<r&&await new Promise(e=>setTimeout(e,o))}throw a})(e);if(r!==i)return;const u=await(async e=>{if("function"==typeof(null==t?void 0:t.formatter))return await t.formatter(e,n);if(!Array.isArray(e))throw new Error("[schemx] Dictionary api must return an array when formatter is not provided.");return e})(o);if(r!==i)return;a.value=u,l.value=void 0,"function"==typeof t.onSuccess&&t.onSuccess(u,n),s.value=!1}catch(e){const r=j(e);l.value=r,a.value=[],s.value=!1,"function"==typeof t.onError&&t.onError(r,n)}};(null==(o=t.dependsOn)?void 0:o.length)&&_(t.dependsOn,(e,o)=>{"function"==typeof t.onDepsChange&&t.onDepsChange(e,n),t.resetOnDepsChange&&r&&n.setFieldValue(r,void 0),u()});const d=t.immediate??!0;return e.onMounted(()=>{d&&u()}),{list:a,loading:s,error:l,loadDict:u,refresh:()=>u(),mutate:e=>{a.value=e}}},E=Symbol("schemx:form-config"),P=t=>{e.provide(E,t)};function N(){const t=e.inject(E);if(!t)throw new Error("[schemx] useFormConfigContext() must be called inside a <SchemxForm> descendant. Ensure createFormConfigContext(props) is called synchronously during setup().");return t}function T(t){const r=e.shallowRef({});return e.watchEffect(()=>{const e=t();((e,t)=>{const r=Object.keys(e),o=Object.keys(t);return r.length===o.length&&r.every(r=>e[r]===t[r])})(r.value,e)||(r.value=e)}),r}const $=new WeakMap;function L(e){return q(d(e)).viewSchemas}function W(r){const o=e.shallowRef(r.getViewSchemas()),n=e.computed(()=>function(e){const r=new Map,o=e=>{for(const n of e)r.set(n.key,n),t.isViewGroupSchema(n)&&o(n.children)};return o(e),r}(o.value));return{refCount:0,schemasByKey:n,unsubscribe:r.subscribeViewSchemas(e=>{o.value=e}),viewSchemas:o}}function q(t){const r=$.get(t),o=r??W(t);return r||$.set(t,o),o.refCount++,e.onScopeDispose(()=>{o.refCount--,o.refCount>0||(o.unsubscribe(),$.delete(t))}),o}function z(t,r,o={}){const n=c(d(t)),a=p(n),s=e.shallowRef(r(n.values.value)),l=o.equals??Object.is,i=e.watch(n.values,e=>{const t=r(e);l(s.value,t)||(s.value=t)},{flush:"sync"});return e.onScopeDispose(()=>{i(),a()}),e.readonly(s)}function M(e){return void 0!==e&&(!Array.isArray(e)||0!==e.length)}function D(e,t){if(!t)return!1;return(Array.isArray(t)?t:[t]).some(t=>function(e){return{onBlur:"blur",onChange:"change",onSubmit:"submit",blur:"blur",change:"change",submit:"submit"}[e]??"submit"}(t)===e)}const I=e=>/[A-Z]/.test(e),G=e=>e.includes("-"),K=e=>e.replace(/([A-Z])/g,"-$1").toLowerCase(),U=e=>e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase()),Z=(e,t)=>{if(e[t])return e[t];const r=I(t)?K(t):G(t)?U(t):void 0;return r&&e[r]?e[r]:void 0},H=(e,t)=>{const r={},o=(n=String(e),(G(n)?U(n):n)+":");var n;const a=(e=>I(e)?K(e):e)(String(e))+":";for(const[s,l]of Object.entries(t))s.startsWith(o)?r[s.slice(o.length)]=l:s.startsWith(a)&&a!==o&&(r[s.slice(a.length)]=l);return r},J=e.defineComponent((t,{slots:o})=>{var n;const a=e.ref(Boolean(t.schema.defaultCollapsed)),s=e.computed(()=>t.schema.collapsed??a.value),l=(null==(n=e.getCurrentInstance())?void 0:n.uid)??0;e.watch(()=>t.schema.collapsed,(e,t)=>{void 0!==e?a.value=e:void 0!==t&&(a.value=t)});const i=()=>{var e,r;if(!t.schema.collapsible||t.schema.disabled)return;const o=!s.value;void 0===t.schema.collapsed&&(a.value=o),null==(r=(e=t.schema).onCollapsedChange)||r.call(e,o)};return()=>{var n;const a=t.schema;if(!1===a.visible)return null;const u=Boolean(a.collapsible),d=s.value,c=a.destroyOnCollapse??!0,m=`schemx-group-${(null==(n=a.debug)?void 0:n.runtimeNodeId)??`local-${l}`}-${Q(a.key)}`,p=`${m}-header`,v=`${m}-body`,f=e.createVNode("div",{id:v,role:"group","aria-labelledby":a.label?p:void 0,"aria-hidden":d||void 0,class:"schemx-group__body",style:!c&&d?{display:"none"}:void 0},[a.children.map(t=>e.createVNode(te,{key:t.key,schema:t},o))]);return e.createVNode("div",{class:r("schemx-group",{"schemx-group--collapsed":d,"is-readonly":a.readonly,"is-disabled":a.disabled},a.class),style:a.style,"data-key":a.key,"aria-disabled":a.disabled||void 0},[a.label&&e.createVNode("div",{id:p,role:u?"button":void 0,tabindex:u?a.disabled?-1:0:void 0,"aria-expanded":u?!d:void 0,"aria-controls":u?v:void 0,"aria-disabled":u&&a.disabled||void 0,class:r("schemx-group__header",{"schemx-group__header--clickable":u&&!a.disabled}),onClick:i,onKeydown:e=>{a.disabled||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),i())}},[e.createVNode("span",{class:"schemx-group__title"},[a.label]),u&&e.createVNode("span",{class:r("schemx-group__arrow",{"schemx-group__arrow--down":!d})},null)]),c?!d&&f:f])}},{name:"SchemxGroup",props:{schema:{type:Object,required:!0}}}),Q=e=>String(e).replace(/[^a-zA-Z0-9_-]/g,"-");function X(e){return Array.isArray(e)?e.map(e=>String(e)).join("."):String(e)}const Y=e.defineComponent({name:"SchemxItem",props:{schema:{type:Object,required:!0}},setup:(r,{slots:o})=>()=>{const n=r.schema;return t.isViewGroupSchema(n)?e.h(J,{schema:n},o):e.h(ee,{schema:n},o)}}),ee=e.defineComponent({name:"SchemxFieldItem",inheritAttrs:!1,props:{schema:{type:Object,required:!0}},setup(o,{attrs:n,slots:a}){const s=S(),l=e.computed(()=>o.schema),i=function(t,r){const o=q(d(t));return e.computed(()=>o.schemasByKey.value.get(r()))}(s,()=>l.value.key),u=e.computed(()=>i.value&&t.isSchemxViewFieldSchema(i.value)?i.value:l.value),c=N(),m=w(u.value.name);V(m);const p=e.computed(()=>{return e=u.value.validationTrigger,t=c.schemaConfig.validationTrigger,r="onChange",M(e)?e:M(t)?t:r;var e,t,r}),v=e.computed(()=>{const e=u.value.visible&&!u.value.readonly&&!u.value.disabled,t=u.value.rules,r=Array.isArray(t)?(null==t?void 0:t.length)>0:!!u.value.rules;return e&&(Boolean(u.value.required)||r)}),f=e=>{var t,r;m.setValue(e),null==(r=null==(t=u.value.componentProps)?void 0:t.onChange)||r.call(t,e),v.value&&D("change",p.value)&&m.validate()},h=e=>{var t,r;null==(r=null==(t=u.value.componentProps)?void 0:t.onBlur)||r.call(t,e),v.value&&D("blur",p.value)&&m.validate()},g=e=>{m.setValue(e)},y=T(()=>({...u.value.componentProps??{},value:m.value.value,onChange:f,onBlur:h,"onUpdate:value":g})),{createSlotProps:b,renderAfter:x,renderBefore:F,renderContent:C,renderError:B,renderLabel:k}=function(t){const{schemaRef:r,field:o,form:n,formContext:a,componentProps:s,slots:l}=t,i=(e={})=>({...s.value,value:o.value.value,...e}),u=e=>{const t=Z(l,`${r.value.name}${e}`);return(null==t?void 0:t(i()))??null};return{createSlotProps:i,renderAfter:()=>u("After"),renderBefore:()=>u("Before"),renderContent:()=>{const t=n.getRenderer(r.value.componentType);if(!t)throw new Error(`[schemx] Can not find component renderer of "${r.value.componentType}".`);const o=H(X(r.value.name),l),a=e.h(t,s.value,o),u=Z(l,`${r.value.name}Content`);return u?u(i({columnElement:a})):e.createVNode("div",{class:"schemx-item__control"},[a])},renderError:()=>{const t=Z(l,`${r.value.name}Error`);return t?t(i({errors:o.errors.value})):0===o.errors.value.length?null:e.createVNode("div",{class:"schemx-item__error"},[o.errors.value[0]])},renderLabel:()=>{const t=Z(l,`${r.value.name}Label`);if(t)return t(r.value);const o=r.value.labelAlign||a.schemaConfig.labelAlign,n=r.value.labelWidth||a.schemaConfig.labelWidth,s=r.value.colon??a.schemaConfig.colon;return e.createVNode("label",{class:"schemx-item__label",style:{width:n,textAlign:o}},[!(r.value.showRequiredMark??Boolean(r.value.required))||r.value.disabled||r.value.readonly?null:e.createVNode("span",{class:"schemx-item__required"},[e.createTextVNode("*")]),e.createVNode("span",{class:"schemx-item__label-text"},[r.value.label,s?":":""])])}}}({schemaRef:u,field:m,form:s,formContext:c,componentProps:y,slots:a});return()=>{if(!u.value.visible)return null;const t=Z(a,X(u.value.name));if(t)return t(b());const o=u.value.labelPosition||c.schemaConfig.labelPosition;return e.createVNode("div",e.mergeProps(n,{class:r("schemx-item-wrapper",n.class),style:[n.style,u.value.style]}),[e.createVNode("div",{class:r("schemx-item",`schemx-item--label-${o}`,u.value.class,{"is-readonly":u.value.readonly,"is-disabled":u.value.disabled}),style:{...u.value.style??{}}},[k(),e.createVNode("div",{class:"schemx-item__content"},[F(),C(),x(),B()])])])}}}),te=Y,re=["aria-busy","data-loading","disabled"],oe={key:0,class:"schemx-button__prefix"},ne={key:1,class:"schemx-button__loading",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},ae={key:4,class:"schemx-button__suffix"},se=e.defineComponent({name:"SchemxButton",inheritAttrs:!1,__name:"index",props:{loading:{type:Boolean,default:!1},loadingText:{default:void 0},disabled:{type:Boolean,default:!1},size:{default:"medium"}},setup(t){const r=t,o=e.useAttrs(),n=e.computed(()=>r.disabled||r.loading),a=e.computed(()=>["schemx-button",`schemx-button--${r.size}`]);return(t,s)=>(e.openBlock(),e.createElementBlock("button",e.mergeProps(e.unref(o),{class:a.value,"aria-busy":r.loading||void 0,"data-loading":r.loading||void 0,disabled:n.value}),[t.$slots.prefix?(e.openBlock(),e.createElementBlock("span",oe,[e.renderSlot(t.$slots,"prefix")])):e.createCommentVNode("",!0),r.loading?(e.openBlock(),e.createElementBlock("svg",ne,[...s[0]||(s[0]=[e.createStaticVNode('<path d="M12 2v4"></path><path d="m16.2 7.8 2.9-2.9"></path><path d="M18 12h4"></path><path d="m16.2 16.2 2.9 2.9"></path><path d="M12 18v4"></path><path d="m4.9 19.1 2.9-2.9"></path><path d="M2 12h4"></path><path d="m4.9 4.9 2.9 2.9"></path>',8)])])):e.createCommentVNode("",!0),r.loading&&r.loadingText?(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createTextVNode(e.toDisplayString(r.loadingText),1)],64)):e.renderSlot(t.$slots,"default",{},void 0,void 0,3),t.$slots.suffix?(e.openBlock(),e.createElementBlock("span",ae,[e.renderSlot(t.$slots,"suffix")])):e.createCommentVNode("",!0)],16,re))}});function le(e){return!!e&&!t.isViewGroupSchema(e)&&!1!==e.visible}function ie(e,r,o){for(let n=r+o;n>=0&&n<e.length;n+=o){const r=e[n];if(!1!==r.visible){if(t.isViewGroupSchema(r))return!1;if(le(r))return!0}}return!1}const ue={key:0,class:"schemx-actions"},de=e.defineComponent({name:"SchemxForm",__name:"form",props:{schemas:{default:()=>[]},initialValues:{default:()=>({})},modelValue:{default:()=>({})},form:{default:void 0},loading:{type:Boolean,default:void 0},submitter:{type:[Boolean,Object],default:void 0},resetter:{type:[Boolean,Object],default:void 0},class:{default:""},style:{type:[Boolean,null,String,Object,Array],default:()=>({})},rendererProps:{default:void 0},validatorAdapters:{},defaultRendererType:{},rendererRegistry:{default:void 0},validationRuleRegistry:{default:void 0},onRuleError:{},onFinish:{type:Function,default:void 0},onFinishFailed:{type:Function,default:void 0},onReset:{type:Function,default:void 0},onLoadingChange:{type:Function,default:void 0},onValuesChange:{type:Function,default:void 0},onFieldsChange:{type:Function,default:void 0},lifecycleHooks:{},required:{type:[Boolean,Object]},readonly:{type:Boolean},disabled:{type:Boolean},visible:{type:Boolean,default:!0},labelIcon:{},labelAlign:{},labelPosition:{},labelWidth:{},contentAlign:{},validationTrigger:{},colon:{type:Boolean},showRequiredMark:{type:Boolean}},emits:["update:modelValue"],setup(r,{expose:o,emit:a}){const s=r,l=a,i=e.useSlots(),u=()=>n.pick(s,t.defaultSchemxConfigKeys),d=e.reactive(u());P({schemaConfig:d});const c=s.form?s.form:F({schemas:s.schemas,schemaConfig:u(),initialValues:Object.keys(s.modelValue).length>0?s.modelValue:s.initialValues,rendererProps:s.rendererProps,rendererRegistry:s.rendererRegistry,defaultRendererType:s.defaultRendererType,validationRuleRegistry:s.validationRuleRegistry,validatorAdapters:s.validatorAdapters,onFinish:e=>{var t;return null==(t=s.onFinish)?void 0:t.call(s,e)},onFinishFailed:e=>{var t;return null==(t=s.onFinishFailed)?void 0:t.call(s,e)},onReset:()=>{var e;null==(e=s.onReset)||e.call(s)},onLoadingChange:e=>{var t;null==(t=s.onLoadingChange)||t.call(s,e)},onValuesChange:(e,t)=>{var r;null==(r=s.onValuesChange)||r.call(s,e,t)},onFieldsChange:(e,t)=>{var r;null==(r=s.onFieldsChange)||r.call(s,e,t)}}),m=void 0!==s.form,p=B(c),v=e.computed(()=>s.loading??p.isLoading()),f=e=>!0===e?{}:e||{},h=e.computed(()=>f(s.submitter)),g=e.computed(()=>f(s.resetter)),y=e=>Object.fromEntries(Object.entries(e.buttonProps??{}).filter(([e])=>"type"!==e&&"onClick"!==e)),b=e.computed(()=>y(h.value)),x=e.computed(()=>y(g.value)),C=e.computed(()=>!1!==s.submitter&&(void 0!==s.submitter||i.submitter)),S=e.computed(()=>!1!==s.resetter&&(void 0!==s.resetter||i.resetter)),w=e.computed(()=>C.value||S.value),k=e.computed(()=>Object.fromEntries(Object.entries(i).filter(([e])=>"submitter"!==e&&"resetter"!==e))),V=e.computed(()=>v.value||Boolean(b.value.disabled)),R=e.computed(()=>v.value||Boolean(x.value.disabled));let O=!1;e.watch(()=>s.modelValue,e=>{O=!0,p.setFieldsValue(e),O=!1},{deep:!0});const _=()=>p.submit(),j=()=>{p.reset()},A=z(p,e=>e);e.watch(A,e=>{O||l("update:modelValue",e)},{flush:"sync"}),e.watch(()=>s.schemas,e=>{t.isSchemxSchemas(e)||p.setSchemas(e)},{deep:!1,immediate:!!s.form});const E=L(p),N=e=>{const{isFirst:t,isLast:r}=function(e,t){const r=e.findIndex(e=>e.key===t);return-1===r?{found:!1,isFirst:!1,isLast:!1}:le(e[r])?{found:!0,isFirst:!ie(e,r,-1),isLast:!ie(e,r,1)}:{found:!0,isFirst:!1,isLast:!1}}(E.value,e.key);return{"schemx-item-wrapper--first":t,"schemx-item-wrapper--last":r}};e.watch(u,e=>{Object.assign(d,e),p.updateSchemaConfig(e)},{deep:!1,immediate:m});return o({...p,submit:_,reset:j}),(t,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["schemx",s.class]),style:e.normalizeStyle(s.style)},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),r=>(e.openBlock(),e.createBlock(e.unref(te),{key:r.key,schema:r,class:e.normalizeClass(N(r))},e.createSlots({_:2},[e.renderList(k.value,(r,o)=>({name:o,fn:e.withCtx(r=>[e.renderSlot(t.$slots,o,e.mergeProps({ref_for:!0},r??{}))])}))]),1032,["schema","class"]))),128)),w.value?(e.openBlock(),e.createElementBlock("div",ue,[S.value&&e.unref(i).resetter?e.renderSlot(t.$slots,"resetter",{form:e.unref(p),loading:v.value,disabled:R.value,reset:j},void 0,void 0,0):S.value?(e.openBlock(),e.createBlock(e.unref(se),e.mergeProps({key:1},x.value,{class:"schemx-actions-button schemx-actions-button--reset",type:"button",disabled:R.value,onClick:j}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(g.value.text??"重置"),1)]),_:1},16,["disabled"])):e.createCommentVNode("",!0),C.value&&e.unref(i).submitter?e.renderSlot(t.$slots,"submitter",{form:e.unref(p),loading:v.value,disabled:V.value,submit:_},void 0,void 0,2):C.value?(e.openBlock(),e.createBlock(e.unref(se),e.mergeProps({key:3},b.value,{class:"schemx-actions-button schemx-actions-button--submit",type:"button",loading:v.value,disabled:V.value,onClick:_}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(h.value.text??"提交"),1)]),_:1},16,["loading","disabled"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],6))}});var ce,me;const pe=(ce=de,me={install(e,t={}){y(e,t),e.component("SchemxForm",de)},FormItem:te},Object.assign(ce,me));exports.FormGroup=J,exports.FormItem=te,exports.WithRemoteOptions=function(t){return e.defineComponent({name:`WithRemoteOptions(${t.name||"Anonymous"})`,inheritAttrs:!1,props:{dict:{type:[Object,Function],default:void 0}},setup(r,{attrs:o,slots:n}){const a=function(e){return"function"==typeof e?{api:e}:e}(r.dict),s=a?o.fieldName??R().name:void 0,l=a?A(a,s):null,i=e.computed(()=>({...o,dict:a,options:a?null==l?void 0:l.list.value:o.options,loading:a?null==l?void 0:l.loading.value:o.loading}));return()=>e.h(t,i.value,n)}})},exports.createFieldContext=V,exports.createFormConfigContext=P,exports.createFormContext=B,exports.default=pe,exports.getCoreForm=d,exports.rendererRegistry=b,exports.schemxForm=pe,exports.useDictionary=A,exports.useField=w,exports.useFieldContext=R,exports.useForm=F,exports.useFormConfigContext=N,exports.useFormContext=S,exports.useFormSelector=z,exports.useStableRef=T,exports.useViewSchemas=L,exports.useWatch=O,exports.useWatchAll=function(e,t){return O(e,t)},exports.useWatchField=function(e,t,r){return O(e,t,r)},exports.useWatchFields=_,exports.validationRuleRegistry=x,Object.keys(t).forEach(e=>{"default"===e||Object.prototype.hasOwnProperty.call(exports,e)||Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
2
2
  //# sourceMappingURL=index.cjs.map