@silver-formily/vue 2.2.1 → 2.3.1

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.
package/README.en.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Silver Formily Vue
2
2
 
3
- [Documentation](https://vue.silver-formily.org/) · [Local docs index](./docs/index.md) · [中文 README](./README.md)
3
+ [Documentation](https://vue.silver-formily.org/) · [中文 README](./README.md)
4
4
 
5
5
  @silver-formily/vue is a Vue 3–first runtime wrapper around [Formily](https://formilyjs.org/). It keeps the orchestration power of `@formily/vue` while removing Vue 2 compatibility layers, redundant DOM wrappers, and inconsistent event contracts. The source lives in `src/`, docs in `docs/`, and build artifacts in `esm/`.
6
6
 
@@ -10,7 +10,7 @@
10
10
  - **Native DOM & events** – relies on `modelValue` / `onUpdate:modelValue`, so Element Plus and most Vue 3 UI kits work without extra adapters.
11
11
  - **Richer TypeScript hints** – explicit generics and shared interfaces sit beside the runtime to keep emitted `.d.ts` files in sync.
12
12
  - **Formily ecosystem alignment** – works with `@formily/core`, `@formily/json-schema`, and other official packages, keeping migration costs low.
13
- - **Decorator slots** – wire `FormItem` and other wrappers to the form schema via `:decorator-content` / `x-decorator-content`, covering `default`, `label`, `extra`, or any named slot. See the [FAQ entry](./docs/en/questions/index.md#how-do-i-pass-slots-to-a-decorator).
13
+ - **Decorator slots** – wire `FormItem` and other wrappers to the form schema via `:decorator-content` / `x-decorator-content`, covering `default`, `label`, `extra`, or any named slot. See the [FAQ entry](../../apps/vue-docs/en/questions/index.md#how-do-i-pass-slots-to-a-decorator).
14
14
  - **Docs & demos included** – VitePress docs describe APIs, migration notes, and Element Plus demos; run `pnpm docs:dev` to browse locally.
15
15
 
16
16
  ## 🔄 Differences vs `@formily/vue`
@@ -31,7 +31,7 @@ Install these alongside the library in your host app:
31
31
  @formily/core ^2
32
32
  @formily/json-schema ^2
33
33
  @formily/reactive ^2
34
- @formily/reactive-vue ^2
34
+ @silver-formily/reactive-vue ^1
35
35
  @formily/shared ^2
36
36
  vue ^3.3.0+
37
37
  ```
@@ -41,7 +41,7 @@ vue ^3.3.0+
41
41
  Recommended pnpm command:
42
42
 
43
43
  ```bash
44
- pnpm add @silver-formily/vue @formily/core @formily/json-schema @formily/reactive @formily/reactive-vue @formily/shared
44
+ pnpm add @silver-formily/vue @formily/core @formily/json-schema @formily/reactive @silver-formily/reactive-vue @formily/shared
45
45
  ```
46
46
 
47
47
  ## ⚡️ Quick Start
@@ -51,22 +51,16 @@ The snippet below wires Element Plus inputs into Formily:
51
51
  ```vue
52
52
  <script setup lang="ts">
53
53
  import { createForm } from '@formily/core'
54
- import {
55
- connect,
56
- Field,
57
- FormProvider,
58
- mapProps,
59
- } from '@silver-formily/vue'
54
+ import { connect, Field, FormProvider, mapProps } from '@silver-formily/vue'
60
55
  import { ElFormItem, ElInput } from 'element-plus'
61
56
 
62
57
  const form = createForm({ validateFirst: true })
63
58
 
64
59
  const FormItem = connect(
65
60
  ElFormItem,
66
- mapProps(
67
- { title: 'label', required: true },
68
- (_, field) => ({ error: field.selfErrors[0] || undefined })
69
- ),
61
+ mapProps({ title: 'label', required: true }, (_, field) => ({
62
+ error: field.selfErrors[0] || undefined,
63
+ })),
70
64
  )
71
65
  </script>
72
66
 
@@ -83,7 +77,7 @@ const FormItem = connect(
83
77
  </template>
84
78
  ```
85
79
 
86
- Explore more components (`SchemaField`, `RecursionField`, `ArrayField`, etc.) and composables in [`docs/api`](./docs/api).
80
+ Explore more components (`SchemaField`, `RecursionField`, `ArrayField`, etc.) and composables in [`docs/api`](../../apps/vue-docs/api).
87
81
 
88
82
  ## 🧱 API Overview
89
83
 
@@ -102,7 +96,7 @@ pnpm build # Build the library + types via Vite
102
96
  pnpm docs:dev # Launch the VitePress docs site
103
97
  pnpm docs:build # Generate static docs into docs/.vitepress/dist
104
98
  pnpm commit # Conventional Commit helper (czg)
105
- pnpm release # release-it workflow (requires clean tree)
99
+ pnpm release # Changeset-driven release (requires clean tree)
106
100
  ```
107
101
 
108
102
  - Build output is generated into `esm/`; do not hand-edit this directory.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Silver Formily Vue
2
2
 
3
- [文档网站](https://vue.silver-formily.org/) · [本地文档首页](./docs/zh/index.md) · [English README](./README.en.md)
3
+ [文档网站](https://vue.silver-formily.org/) · [本地文档首页](../../apps/vue-docs/index.md) · [English README](./README.en.md)
4
4
 
5
5
  @silver-formily/vue 是一个专注于 Vue 3 生态的 [Formily](https://formilyjs.org/) 运行时封装。它保留了 `@formily/vue` 的编排能力,同时去除了 Vue 2 兼容层、冗余 DOM 包裹以及不一致的事件契约。源码位于 `src/`,文档位于 `docs/`,构建产物存放在 `esm/`。
6
6
 
@@ -10,7 +10,7 @@
10
10
  - **原生 DOM 与事件语义**:统一使用 `modelValue` / `onUpdate:modelValue`,Element Plus 等组件可直接对接。
11
11
  - **完善的 TypeScript 类型**:在运行时附近维护显式泛型与公共接口,确保生成的 `.d.ts` 与实现同步。
12
12
  - **Formily 生态对齐**:与 `@formily/core`、`@formily/json-schema` 等官方包保持兼容,迁移成本低。
13
- - **Decorator 插槽支持**:通过 `:decorator-content` 与 `x-decorator-content` 将 `FormItem` 等装饰器的 `default`、`label`、`extra` 插槽与 schema 数据解耦,详见[常见问题](./docs/questions/index.md#如何向装饰器传递插槽)。
13
+ - **Decorator 插槽支持**:通过 `:decorator-content` 与 `x-decorator-content` 将 `FormItem` 等装饰器的 `default`、`label`、`extra` 插槽与 schema 数据解耦,详见[常见问题](../../apps/vue-docs/questions/index.md#如何向装饰器传递插槽)。
14
14
  - **配套文档与示例**:内置 VitePress 文档,包含 API、迁移提示以及 Element Plus 示例,执行 `pnpm docs:dev` 即可查看。
15
15
 
16
16
  ## 🔄 与 `@formily/vue` 的差异
@@ -31,7 +31,7 @@
31
31
  @formily/core ^2
32
32
  @formily/json-schema ^2
33
33
  @formily/reactive ^2
34
- @formily/reactive-vue ^2
34
+ @silver-formily/reactive-vue ^1
35
35
  @formily/shared ^2
36
36
  vue ^3.3.0+
37
37
  ```
@@ -41,7 +41,7 @@ vue ^3.3.0+
41
41
  推荐使用 pnpm:
42
42
 
43
43
  ```bash
44
- pnpm add @silver-formily/vue @formily/core @formily/json-schema @formily/reactive @formily/reactive-vue @formily/shared
44
+ pnpm add @silver-formily/vue @formily/core @formily/json-schema @formily/reactive @silver-formily/reactive-vue @formily/shared
45
45
  ```
46
46
 
47
47
  ## ⚡️ 快速开始
@@ -51,22 +51,16 @@ pnpm add @silver-formily/vue @formily/core @formily/json-schema @formily/reactiv
51
51
  ```vue
52
52
  <script setup lang="ts">
53
53
  import { createForm } from '@formily/core'
54
- import {
55
- connect,
56
- Field,
57
- FormProvider,
58
- mapProps,
59
- } from '@silver-formily/vue'
54
+ import { connect, Field, FormProvider, mapProps } from '@silver-formily/vue'
60
55
  import { ElFormItem, ElInput } from 'element-plus'
61
56
 
62
57
  const form = createForm({ validateFirst: true })
63
58
 
64
59
  const FormItem = connect(
65
60
  ElFormItem,
66
- mapProps(
67
- { title: 'label', required: true },
68
- (_, field) => ({ error: field.selfErrors[0] || undefined })
69
- ),
61
+ mapProps({ title: 'label', required: true }, (_, field) => ({
62
+ error: field.selfErrors[0] || undefined,
63
+ })),
70
64
  )
71
65
  </script>
72
66
 
@@ -83,7 +77,7 @@ const FormItem = connect(
83
77
  </template>
84
78
  ```
85
79
 
86
- 更多组件(`SchemaField`、`RecursionField`、`ArrayField` 等)与组合式 API 请参阅 [`docs/api`](./docs/api)。
80
+ 更多组件(`SchemaField`、`RecursionField`、`ArrayField` 等)与组合式 API 请参阅 [`docs/api`](../../apps/vue-docs/api)。
87
81
 
88
82
  ## 🧱 API 速览
89
83
 
@@ -102,7 +96,7 @@ pnpm build # 基于 Vite 生成库与类型
102
96
  pnpm docs:dev # 启动 VitePress 文档站点
103
97
  pnpm docs:build # 生成静态文档 (docs/.vitepress/dist)
104
98
  pnpm commit # 使用 czg 编写 Conventional Commit
105
- pnpm release # release-it 发布,需要干净工作区
99
+ pnpm release # Changeset 发布流程(需要干净工作区)
106
100
  ```
107
101
 
108
102
  - 构建输出位于 `esm/`,请勿手动修改。
@@ -1,58 +1,58 @@
1
1
  declare const _default: import('vue').DefineComponent<{
2
- validator?: string | import('../types/validator').ValidatorFunction<any> | import('../types/validator').IValidatorRules<any> | import('../types/validator').MultiValidator<any>;
2
+ validator?: string | import('../types/validator').ValidatorFunction<any> | import('../types/validator').IValidatorRules<any> | import('../types/validator').MultiValidator<any> | undefined;
3
3
  decoratorContent?: any;
4
- required?: boolean;
5
- pattern?: string;
4
+ required?: boolean | undefined;
5
+ pattern?: string | undefined;
6
6
  name: import('@formily/core').FormPathPattern;
7
7
  data?: any;
8
- basePath?: import('@formily/core').FormPathPattern;
8
+ basePath?: import('@formily/core').FormPathPattern | undefined;
9
9
  title?: any;
10
10
  description?: any;
11
11
  value?: any;
12
12
  initialValue?: any;
13
- display?: string;
14
- hidden?: boolean;
15
- visible?: boolean;
16
- editable?: boolean;
17
- disabled?: boolean;
18
- readOnly?: boolean;
19
- readPretty?: boolean;
20
- dataSource?: import('@formily/core').FieldDataSource;
21
- validateFirst?: boolean;
22
- validatePattern?: import('@formily/core').FieldPatternTypes[];
23
- validateDisplay?: import('@formily/core').FieldDisplayTypes[];
24
- decorator?: import('@formily/core').FieldDecorator<import('vue').Component, any>;
25
- component?: import('@formily/core').FieldComponent<import('vue').Component, any>;
26
- reactions?: import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction;
13
+ display?: string | undefined;
14
+ hidden?: boolean | undefined;
15
+ visible?: boolean | undefined;
16
+ editable?: boolean | undefined;
17
+ disabled?: boolean | undefined;
18
+ readOnly?: boolean | undefined;
19
+ readPretty?: boolean | undefined;
20
+ dataSource?: import('@formily/core').FieldDataSource | undefined;
21
+ validateFirst?: boolean | undefined;
22
+ validatePattern?: import('@formily/core').FieldPatternTypes[] | undefined;
23
+ validateDisplay?: import('@formily/core').FieldDisplayTypes[] | undefined;
24
+ decorator?: boolean | any[] | undefined;
25
+ component?: boolean | any[] | undefined;
26
+ reactions?: (import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction) | undefined;
27
27
  content?: any;
28
28
  }, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
29
29
  [key: string]: any;
30
30
  }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
31
- validator?: string | import('../types/validator').ValidatorFunction<any> | import('../types/validator').IValidatorRules<any> | import('../types/validator').MultiValidator<any>;
31
+ validator?: string | import('../types/validator').ValidatorFunction<any> | import('../types/validator').IValidatorRules<any> | import('../types/validator').MultiValidator<any> | undefined;
32
32
  decoratorContent?: any;
33
- required?: boolean;
34
- pattern?: string;
33
+ required?: boolean | undefined;
34
+ pattern?: string | undefined;
35
35
  name: import('@formily/core').FormPathPattern;
36
36
  data?: any;
37
- basePath?: import('@formily/core').FormPathPattern;
37
+ basePath?: import('@formily/core').FormPathPattern | undefined;
38
38
  title?: any;
39
39
  description?: any;
40
40
  value?: any;
41
41
  initialValue?: any;
42
- display?: string;
43
- hidden?: boolean;
44
- visible?: boolean;
45
- editable?: boolean;
46
- disabled?: boolean;
47
- readOnly?: boolean;
48
- readPretty?: boolean;
49
- dataSource?: import('@formily/core').FieldDataSource;
50
- validateFirst?: boolean;
51
- validatePattern?: import('@formily/core').FieldPatternTypes[];
52
- validateDisplay?: import('@formily/core').FieldDisplayTypes[];
53
- decorator?: import('@formily/core').FieldDecorator<import('vue').Component, any>;
54
- component?: import('@formily/core').FieldComponent<import('vue').Component, any>;
55
- reactions?: import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction;
42
+ display?: string | undefined;
43
+ hidden?: boolean | undefined;
44
+ visible?: boolean | undefined;
45
+ editable?: boolean | undefined;
46
+ disabled?: boolean | undefined;
47
+ readOnly?: boolean | undefined;
48
+ readPretty?: boolean | undefined;
49
+ dataSource?: import('@formily/core').FieldDataSource | undefined;
50
+ validateFirst?: boolean | undefined;
51
+ validatePattern?: import('@formily/core').FieldPatternTypes[] | undefined;
52
+ validateDisplay?: import('@formily/core').FieldDisplayTypes[] | undefined;
53
+ decorator?: boolean | any[] | undefined;
54
+ component?: boolean | any[] | undefined;
55
+ reactions?: (import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction) | undefined;
56
56
  content?: any;
57
57
  }> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
58
58
  export default _default;
@@ -7,7 +7,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
7
7
  };
8
8
  }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
9
9
  [key: string]: any;
10
- }>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
10
+ }>[] | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
11
11
  value: {
12
12
  type: PropType<IExpressionScopeProps["value"]>;
13
13
  required: true;
@@ -1,7 +1,7 @@
1
1
  import { lazyMerge as s } from "@formily/shared";
2
2
  import { defineComponent as c, inject as i, computed as m, provide as a } from "vue";
3
3
  import "@formily/core";
4
- import "@formily/reactive-vue";
4
+ import "@silver-formily/reactive-vue";
5
5
  import { SchemaExpressionScopeSymbol as e } from "../shared/context.mjs";
6
6
  const x = c({
7
7
  name: "ExpressionScope",
@@ -1,58 +1,58 @@
1
1
  declare const _default: import('vue').DefineComponent<{
2
- validator?: string | import('../types/validator').ValidatorFunction<any> | import('../types/validator').IValidatorRules<any> | import('../types/validator').MultiValidator<any>;
2
+ validator?: string | import('../types/validator').ValidatorFunction<any> | import('../types/validator').IValidatorRules<any> | import('../types/validator').MultiValidator<any> | undefined;
3
3
  decoratorContent?: any;
4
- required?: boolean;
5
- pattern?: string;
4
+ required?: boolean | undefined;
5
+ pattern?: string | undefined;
6
6
  name: import('@formily/core').FormPathPattern;
7
7
  data?: any;
8
- basePath?: import('@formily/core').FormPathPattern;
8
+ basePath?: import('@formily/core').FormPathPattern | undefined;
9
9
  title?: any;
10
10
  description?: any;
11
11
  value?: any;
12
12
  initialValue?: any;
13
- display?: string;
14
- hidden?: boolean;
15
- visible?: boolean;
16
- editable?: boolean;
17
- disabled?: boolean;
18
- readOnly?: boolean;
19
- readPretty?: boolean;
20
- dataSource?: import('@formily/core').FieldDataSource;
21
- validateFirst?: boolean;
22
- validatePattern?: import('@formily/core').FieldPatternTypes[];
23
- validateDisplay?: import('@formily/core').FieldDisplayTypes[];
24
- decorator?: import('@formily/core').FieldDecorator<import('vue').Component, any>;
25
- component?: import('@formily/core').FieldComponent<import('vue').Component, any>;
26
- reactions?: import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction;
13
+ display?: string | undefined;
14
+ hidden?: boolean | undefined;
15
+ visible?: boolean | undefined;
16
+ editable?: boolean | undefined;
17
+ disabled?: boolean | undefined;
18
+ readOnly?: boolean | undefined;
19
+ readPretty?: boolean | undefined;
20
+ dataSource?: import('@formily/core').FieldDataSource | undefined;
21
+ validateFirst?: boolean | undefined;
22
+ validatePattern?: import('@formily/core').FieldPatternTypes[] | undefined;
23
+ validateDisplay?: import('@formily/core').FieldDisplayTypes[] | undefined;
24
+ decorator?: boolean | any[] | undefined;
25
+ component?: boolean | any[] | undefined;
26
+ reactions?: (import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction) | undefined;
27
27
  content?: any;
28
28
  }, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
29
29
  [key: string]: any;
30
30
  }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
31
- validator?: string | import('../types/validator').ValidatorFunction<any> | import('../types/validator').IValidatorRules<any> | import('../types/validator').MultiValidator<any>;
31
+ validator?: string | import('../types/validator').ValidatorFunction<any> | import('../types/validator').IValidatorRules<any> | import('../types/validator').MultiValidator<any> | undefined;
32
32
  decoratorContent?: any;
33
- required?: boolean;
34
- pattern?: string;
33
+ required?: boolean | undefined;
34
+ pattern?: string | undefined;
35
35
  name: import('@formily/core').FormPathPattern;
36
36
  data?: any;
37
- basePath?: import('@formily/core').FormPathPattern;
37
+ basePath?: import('@formily/core').FormPathPattern | undefined;
38
38
  title?: any;
39
39
  description?: any;
40
40
  value?: any;
41
41
  initialValue?: any;
42
- display?: string;
43
- hidden?: boolean;
44
- visible?: boolean;
45
- editable?: boolean;
46
- disabled?: boolean;
47
- readOnly?: boolean;
48
- readPretty?: boolean;
49
- dataSource?: import('@formily/core').FieldDataSource;
50
- validateFirst?: boolean;
51
- validatePattern?: import('@formily/core').FieldPatternTypes[];
52
- validateDisplay?: import('@formily/core').FieldDisplayTypes[];
53
- decorator?: import('@formily/core').FieldDecorator<import('vue').Component, any>;
54
- component?: import('@formily/core').FieldComponent<import('vue').Component, any>;
55
- reactions?: import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction;
42
+ display?: string | undefined;
43
+ hidden?: boolean | undefined;
44
+ visible?: boolean | undefined;
45
+ editable?: boolean | undefined;
46
+ disabled?: boolean | undefined;
47
+ readOnly?: boolean | undefined;
48
+ readPretty?: boolean | undefined;
49
+ dataSource?: import('@formily/core').FieldDataSource | undefined;
50
+ validateFirst?: boolean | undefined;
51
+ validatePattern?: import('@formily/core').FieldPatternTypes[] | undefined;
52
+ validateDisplay?: import('@formily/core').FieldDisplayTypes[] | undefined;
53
+ decorator?: boolean | any[] | undefined;
54
+ component?: boolean | any[] | undefined;
55
+ reactions?: (import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction) | undefined;
56
56
  content?: any;
57
57
  }> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
58
58
  export default _default;
@@ -1,4 +1,4 @@
1
1
  declare const _default: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
2
2
  [key: string]: any;
3
- }>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
3
+ }>[] | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
- import { useObserver as m } from "@formily/reactive-vue";
1
+ import { useObserver as m } from "@silver-formily/reactive-vue";
2
2
  import { defineComponent as t } from "vue";
3
3
  import { useForm as s } from "../hooks/useForm.mjs";
4
4
  import "@formily/core";
@@ -1 +1 @@
1
- {"version":3,"file":"FormConsumer.mjs","sources":["../../src/components/FormConsumer.ts"],"sourcesContent":["import { useObserver } from '@formily/reactive-vue'\nimport { defineComponent } from 'vue'\nimport { useForm } from '../hooks'\n\nexport default defineComponent({\n name: 'FormConsumer',\n inheritAttrs: false,\n setup(_, { slots }) {\n useObserver({\n scheduler: update => Promise.resolve().then(update),\n })\n\n const form = useForm()\n\n return () => slots.default?.({ form: form.value }) ?? null\n },\n})\n"],"names":["FormConsumer","defineComponent","_","slots","useObserver","update","form","useForm"],"mappings":";;;;AAIA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,MAAMC,GAAG,EAAE,OAAAC,KAAS;AAClB,IAAAC,EAAY;AAAA,MACV,WAAW,CAAAC,MAAU,QAAQ,QAAA,EAAU,KAAKA,CAAM;AAAA,IAAA,CACnD;AAED,UAAMC,IAAOC,EAAA;AAEb,WAAO,MAAMJ,EAAM,UAAU,EAAE,MAAMG,EAAK,MAAA,CAAO,KAAK;AAAA,EACxD;AACF,CAAC;"}
1
+ {"version":3,"file":"FormConsumer.mjs","sources":["../../src/components/FormConsumer.ts"],"sourcesContent":["import { useObserver } from '@silver-formily/reactive-vue'\nimport { defineComponent } from 'vue'\nimport { useForm } from '../hooks'\n\nexport default defineComponent({\n name: 'FormConsumer',\n inheritAttrs: false,\n setup(_, { slots }) {\n useObserver({\n scheduler: update => Promise.resolve().then(update),\n })\n\n const form = useForm()\n\n return () => slots.default?.({ form: form.value }) ?? null\n },\n})\n"],"names":["FormConsumer","defineComponent","_","slots","useObserver","update","form","useForm"],"mappings":";;;;AAIA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,MAAMC,GAAG,EAAE,OAAAC,KAAS;AAClB,IAAAC,EAAY;AAAA,MACV,WAAW,CAAAC,MAAU,QAAQ,QAAA,EAAU,KAAKA,CAAM;AAAA,IAAA,CACnD;AAED,UAAMC,IAAOC,EAAA;AAEb,WAAO,MAAMJ,EAAM,UAAU,EAAE,MAAMG,EAAK,MAAA,CAAO,KAAK;AAAA,EACxD;AACF,CAAC;"}
@@ -7,7 +7,7 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
7
7
  };
8
8
  }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
9
9
  [key: string]: any;
10
- }>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
10
+ }>[] | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
11
11
  form: {
12
12
  type: PropType<IProviderProps["form"]>;
13
13
  required: true;
@@ -4,12 +4,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
4
4
  readonly description: import('../utils/runtimeProps').RuntimeProp<any>;
5
5
  readonly value: import('../utils/runtimeProps').RuntimeProp<any>;
6
6
  readonly initialValue: import('../utils/runtimeProps').RuntimeProp<any>;
7
- readonly basePath: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern>;
8
- readonly decorator: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDecorator<import('vue').Component, any>>;
7
+ readonly basePath: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern | undefined>;
8
+ readonly decorator: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDecorator<import('vue').Component, any> | undefined>;
9
9
  readonly decoratorContent: import('../utils/runtimeProps').RuntimeProp<any>;
10
- readonly component: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldComponent<import('vue').Component, any>>;
11
- readonly display: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes>;
12
- readonly pattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes>;
10
+ readonly component: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldComponent<import('vue').Component, any> | undefined>;
11
+ readonly display: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes | undefined>;
12
+ readonly pattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes | undefined>;
13
13
  readonly required: import('../utils/runtimeProps').RuntimeProp<boolean>;
14
14
  readonly validateFirst: import('../utils/runtimeProps').RuntimeProp<boolean>;
15
15
  readonly hidden: import('../utils/runtimeProps').RuntimeProp<boolean>;
@@ -18,11 +18,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
18
18
  readonly disabled: import('../utils/runtimeProps').RuntimeProp<boolean>;
19
19
  readonly readOnly: import('../utils/runtimeProps').RuntimeProp<boolean>;
20
20
  readonly readPretty: import('../utils/runtimeProps').RuntimeProp<boolean>;
21
- readonly dataSource: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDataSource>;
22
- readonly validatePattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes[]>;
23
- readonly validateDisplay: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes[]>;
24
- readonly validator: import('../utils/runtimeProps').RuntimeProp<import('..').SchemaFieldValidator>;
25
- readonly reactions: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldReaction | import('@formily/core').FieldReaction[]>;
21
+ readonly dataSource: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDataSource | undefined>;
22
+ readonly validatePattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes[] | undefined>;
23
+ readonly validateDisplay: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes[] | undefined>;
24
+ readonly validator: import('../utils/runtimeProps').RuntimeProp<import('..').SchemaFieldValidator | undefined>;
25
+ readonly reactions: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldReaction | import('@formily/core').FieldReaction[] | undefined>;
26
26
  readonly content: import('../utils/runtimeProps').RuntimeProp<any>;
27
27
  readonly data: import('../utils/runtimeProps').RuntimeProp<any>;
28
28
  }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
@@ -33,12 +33,12 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
33
33
  readonly description: import('../utils/runtimeProps').RuntimeProp<any>;
34
34
  readonly value: import('../utils/runtimeProps').RuntimeProp<any>;
35
35
  readonly initialValue: import('../utils/runtimeProps').RuntimeProp<any>;
36
- readonly basePath: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern>;
37
- readonly decorator: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDecorator<import('vue').Component, any>>;
36
+ readonly basePath: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern | undefined>;
37
+ readonly decorator: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDecorator<import('vue').Component, any> | undefined>;
38
38
  readonly decoratorContent: import('../utils/runtimeProps').RuntimeProp<any>;
39
- readonly component: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldComponent<import('vue').Component, any>>;
40
- readonly display: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes>;
41
- readonly pattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes>;
39
+ readonly component: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldComponent<import('vue').Component, any> | undefined>;
40
+ readonly display: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes | undefined>;
41
+ readonly pattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes | undefined>;
42
42
  readonly required: import('../utils/runtimeProps').RuntimeProp<boolean>;
43
43
  readonly validateFirst: import('../utils/runtimeProps').RuntimeProp<boolean>;
44
44
  readonly hidden: import('../utils/runtimeProps').RuntimeProp<boolean>;
@@ -47,11 +47,11 @@ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropT
47
47
  readonly disabled: import('../utils/runtimeProps').RuntimeProp<boolean>;
48
48
  readonly readOnly: import('../utils/runtimeProps').RuntimeProp<boolean>;
49
49
  readonly readPretty: import('../utils/runtimeProps').RuntimeProp<boolean>;
50
- readonly dataSource: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDataSource>;
51
- readonly validatePattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes[]>;
52
- readonly validateDisplay: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes[]>;
53
- readonly validator: import('../utils/runtimeProps').RuntimeProp<import('..').SchemaFieldValidator>;
54
- readonly reactions: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldReaction | import('@formily/core').FieldReaction[]>;
50
+ readonly dataSource: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDataSource | undefined>;
51
+ readonly validatePattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes[] | undefined>;
52
+ readonly validateDisplay: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes[] | undefined>;
53
+ readonly validator: import('../utils/runtimeProps').RuntimeProp<import('..').SchemaFieldValidator | undefined>;
54
+ readonly reactions: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldReaction | import('@formily/core').FieldReaction[] | undefined>;
55
55
  readonly content: import('../utils/runtimeProps').RuntimeProp<any>;
56
56
  readonly data: import('../utils/runtimeProps').RuntimeProp<any>;
57
57
  }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
@@ -6,7 +6,7 @@ declare const _default: import('vue').DefineComponent<{
6
6
  [key: string]: any;
7
7
  }> | VNode<import('vue').RendererNode, import('vue').RendererElement, {
8
8
  [key: string]: any;
9
- }>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
9
+ }>[] | null | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
10
10
  fieldType: "Field" | "ArrayField" | "ObjectField" | "VoidField";
11
11
  fieldProps: import('..').IVoidFieldProps<import('vue').Component, import('vue').Component>;
12
12
  }> & Readonly<{}>, {
@@ -1,7 +1,7 @@
1
1
  import { isVoidField as r } from "@formily/core";
2
2
  import { toJS as P } from "@formily/reactive";
3
- import { useObserver as z } from "@formily/reactive-vue";
4
3
  import { FormPath as h } from "@formily/shared";
4
+ import { useObserver as z } from "@silver-formily/reactive-vue";
5
5
  import { defineComponent as B, inject as F, ref as S, shallowRef as J, watch as N, provide as U, h as A } from "vue";
6
6
  import { useField as $ } from "../hooks/useField.mjs";
7
7
  import { SchemaOptionsSymbol as k, SchemaSymbol as q, FieldSymbol as G } from "../shared/context.mjs";
@@ -1 +1 @@
1
- {"version":3,"file":"ReactiveField.mjs","sources":["../../src/components/ReactiveField.ts"],"sourcesContent":["import type { GeneralField } from '@formily/core'\nimport type { Ref, VNode } from 'vue'\nimport type { IReactiveFieldProps } from '../types'\nimport { isVoidField } from '@formily/core'\nimport { toJS } from '@formily/reactive'\nimport { useObserver } from '@formily/reactive-vue'\nimport { FormPath } from '@formily/shared'\nimport { defineComponent, h, inject, provide, ref, shallowRef, watch } from 'vue'\nimport { useField, useForm } from '../hooks'\nimport { useAttach } from '../hooks/useAttach'\n\nimport { FieldSymbol, SchemaOptionsSymbol, SchemaSymbol } from '../shared'\nimport { createVNodeProps, extractAttrsAndEvents, mergeSlots, wrapFragment } from '../utils/reactiveFieldHelpers'\n\ntype ComponentEventArgs = unknown[]\ntype ComponentEventHandler = (...args: ComponentEventArgs) => unknown\n\nexport default defineComponent({\n name: 'ReactiveField',\n props: {\n fieldType: {\n type: String,\n default: 'Field',\n },\n fieldProps: {\n type: Object,\n default: () => ({}),\n },\n },\n setup(props: IReactiveFieldProps, { slots }) {\n const formRef = useForm()\n const parentRef = useField()\n const optionsRef = inject(SchemaOptionsSymbol, ref())\n const schemaRef = inject(SchemaSymbol, ref())\n\n useObserver()\n\n const createField = () =>\n formRef?.value?.[`create${props.fieldType}`]?.({\n ...props.fieldProps,\n basePath: props.fieldProps?.basePath ?? parentRef.value?.address,\n })\n\n const fieldRef = shallowRef(createField()) as Ref<GeneralField>\n\n watch(\n () => props.fieldProps,\n () => (fieldRef.value = createField()),\n )\n\n useAttach(fieldRef)\n provide(FieldSymbol, fieldRef)\n\n return () => {\n const field = fieldRef.value\n const options = optionsRef.value\n\n if (!field) {\n return slots.default?.()\n }\n\n if (field.display !== 'visible') {\n return null\n }\n\n const mergedSlots = mergeSlots(field, slots, field.content)\n const decoratorContent = schemaRef.value?.['x-decorator-content']\n ?? props.fieldProps?.decoratorContent\n const decoratorSlots = mergeSlots(field, slots, decoratorContent)\n\n const renderDecorator = (childNodes: Array<VNode | null | undefined>) => {\n const normalizedChildren = childNodes.filter(child => child != null) as VNode[]\n if (!field.decoratorType) {\n return wrapFragment(normalizedChildren)\n }\n\n const finalComponent\n = FormPath.getIn(options?.components, field.decoratorType as string) ?? field.decoratorType\n const decoratorEntry = Array.isArray(field.decorator) ? field.decorator[1] : undefined\n const decoratorAttrs = toJS(decoratorEntry) || {}\n const { attrs, events } = extractAttrsAndEvents(decoratorAttrs)\n const decoratorProps = createVNodeProps(attrs, events)\n\n return h(finalComponent, decoratorProps, {\n ...decoratorSlots,\n default: () => normalizedChildren,\n })\n }\n\n const renderComponent = (): VNode | null => {\n if (!field.componentType) {\n return wrapFragment(mergedSlots?.default?.())\n }\n\n const component\n = FormPath.getIn(options?.components, field.componentType as string) ?? field.componentType\n\n const componentEntry = Array.isArray(field.component) ? field.component[1] : undefined\n const originData = toJS(componentEntry) || {}\n const fieldValue = !isVoidField(field) ? field.value : undefined\n const composedAttrs = {\n disabled: !isVoidField(field)\n ? field.pattern === 'disabled' || field.pattern === 'readPretty'\n : undefined,\n readOnly: !isVoidField(field) ? field.pattern === 'readOnly' : undefined,\n ...originData,\n modelValue: fieldValue,\n }\n const { attrs, events } = extractAttrsAndEvents(composedAttrs)\n const modelUpdateHandler: ComponentEventHandler | undefined = events['update:modelValue']\n const focusHandler: ComponentEventHandler | undefined = events.focus\n const blurHandler: ComponentEventHandler | undefined = events.blur\n\n const emitInput = (...args: ComponentEventArgs) => {\n if (!isVoidField(field)) {\n field.onInput(...(args as Parameters<typeof field.onInput>))\n }\n }\n\n events['update:modelValue'] = (...args: ComponentEventArgs) => {\n emitInput(...args)\n modelUpdateHandler?.(...args)\n }\n events.focus = (...args: ComponentEventArgs) => {\n if (!isVoidField(field)) {\n field.onFocus(...(args as Parameters<typeof field.onFocus>))\n }\n focusHandler?.(...args)\n }\n events.blur = (...args: ComponentEventArgs) => {\n if (!isVoidField(field)) {\n field.onBlur(...(args as Parameters<typeof field.onBlur>))\n }\n blurHandler?.(...args)\n }\n\n const componentProps = createVNodeProps(attrs, events)\n return h(component, componentProps, mergedSlots)\n }\n\n return renderDecorator([renderComponent()])\n }\n },\n})\n"],"names":["ReactiveField","defineComponent","props","slots","formRef","useForm","parentRef","useField","optionsRef","inject","SchemaOptionsSymbol","ref","schemaRef","SchemaSymbol","useObserver","createField","fieldRef","shallowRef","watch","useAttach","provide","FieldSymbol","field","options","mergedSlots","mergeSlots","decoratorContent","decoratorSlots","childNodes","normalizedChildren","child","wrapFragment","finalComponent","FormPath","decoratorEntry","decoratorAttrs","toJS","attrs","events","extractAttrsAndEvents","decoratorProps","createVNodeProps","h","component","componentEntry","originData","fieldValue","isVoidField","composedAttrs","modelUpdateHandler","focusHandler","blurHandler","emitInput","args","componentProps"],"mappings":";;;;;;;;;;AAiBA,MAAAA,KAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO;AAAA,IACL,WAAW;AAAA,MACT,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,IAEX,YAAY;AAAA,MACV,MAAM;AAAA,MACN,SAAS,OAAO,CAAA;AAAA,IAAC;AAAA,EACnB;AAAA,EAEF,MAAMC,GAA4B,EAAE,OAAAC,KAAS;AAC3C,UAAMC,IAAUC,EAAA,GACVC,IAAYC,EAAA,GACZC,IAAaC,EAAOC,GAAqBC,EAAA,CAAK,GAC9CC,IAAYH,EAAOI,GAAcF,EAAA,CAAK;AAE5C,IAAAG,EAAA;AAEA,UAAMC,IAAc,MAClBX,GAAS,QAAQ,SAASF,EAAM,SAAS,EAAE,IAAI;AAAA,MAC7C,GAAGA,EAAM;AAAA,MACT,UAAUA,EAAM,YAAY,YAAYI,EAAU,OAAO;AAAA,IAAA,CAC1D,GAEGU,IAAWC,EAAWF,GAAa;AAEzC,WAAAG;AAAA,MACE,MAAMhB,EAAM;AAAA,MACZ,MAAOc,EAAS,QAAQD,EAAA;AAAA,IAAY,GAGtCI,EAAUH,CAAQ,GAClBI,EAAQC,GAAaL,CAAQ,GAEtB,MAAM;AACX,YAAMM,IAAQN,EAAS,OACjBO,IAAUf,EAAW;AAE3B,UAAI,CAACc;AACH,eAAOnB,EAAM,UAAA;AAGf,UAAImB,EAAM,YAAY;AACpB,eAAO;AAGT,YAAME,IAAcC,EAAWH,GAAOnB,GAAOmB,EAAM,OAAO,GAC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AAO,mBAAmB,GAClFY,IAAkDZ,EAAO,OACzDa,IAAiDb,EAAO,MAExDc,IAAY,IAAIC,MAA6B;AACjD,UAAKN,EAAYzB,CAAK,KACpBA,EAAM,QAAQ,GAAI+B,CAAyC;AAAA,QAE/D;AAEA,QAAAf,EAAO,mBAAmB,IAAI,IAAIe,MAA6B;AAC7D,UAAAD,EAAU,GAAGC,CAAI,GACjBJ,IAAqB,GAAGI,CAAI;AAAA,QAC9B,GACAf,EAAO,QAAQ,IAAIe,MAA6B;AAC9C,UAAKN,EAAYzB,CAAK,KACpBA,EAAM,QAAQ,GAAI+B,CAAyC,GAE7DH,IAAe,GAAGG,CAAI;AAAA,QACxB,GACAf,EAAO,OAAO,IAAIe,MAA6B;AAC7C,UAAKN,EAAYzB,CAAK,KACpBA,EAAM,OAAO,GAAI+B,CAAwC,GAE3DF,IAAc,GAAGE,CAAI;AAAA,QACvB;AAEA,cAAMC,IAAiBb,EAAiBJ,GAAOC,CAAM;AACrD,eAAOI,EAAEC,GAAWW,GAAgB9B,CAAW;AAAA,MACjD,GAEwB,CAAiB,CAAC;AAAA,IAC5C;AAAA,EACF;AACF,CAAC;"}
1
+ {"version":3,"file":"ReactiveField.mjs","sources":["../../src/components/ReactiveField.ts"],"sourcesContent":["import type { GeneralField } from '@formily/core'\nimport type { Ref, VNode } from 'vue'\nimport type { IReactiveFieldProps } from '../types'\nimport { isVoidField } from '@formily/core'\nimport { toJS } from '@formily/reactive'\nimport { FormPath } from '@formily/shared'\nimport { useObserver } from '@silver-formily/reactive-vue'\nimport { defineComponent, h, inject, provide, ref, shallowRef, watch } from 'vue'\nimport { useField, useForm } from '../hooks'\nimport { useAttach } from '../hooks/useAttach'\n\nimport { FieldSymbol, SchemaOptionsSymbol, SchemaSymbol } from '../shared'\nimport { createVNodeProps, extractAttrsAndEvents, mergeSlots, wrapFragment } from '../utils/reactiveFieldHelpers'\n\ntype ComponentEventArgs = unknown[]\ntype ComponentEventHandler = (...args: ComponentEventArgs) => unknown\n\nexport default defineComponent({\n name: 'ReactiveField',\n props: {\n fieldType: {\n type: String,\n default: 'Field',\n },\n fieldProps: {\n type: Object,\n default: () => ({}),\n },\n },\n setup(props: IReactiveFieldProps, { slots }) {\n const formRef = useForm()\n const parentRef = useField()\n const optionsRef = inject(SchemaOptionsSymbol, ref())\n const schemaRef = inject(SchemaSymbol, ref())\n\n useObserver()\n\n const createField = () =>\n formRef?.value?.[`create${props.fieldType}`]?.({\n ...props.fieldProps,\n basePath: props.fieldProps?.basePath ?? parentRef.value?.address,\n })\n\n const fieldRef = shallowRef(createField()) as Ref<GeneralField>\n\n watch(\n () => props.fieldProps,\n () => (fieldRef.value = createField()),\n )\n\n useAttach(fieldRef)\n provide(FieldSymbol, fieldRef)\n\n return () => {\n const field = fieldRef.value\n const options = optionsRef.value\n\n if (!field) {\n return slots.default?.()\n }\n\n if (field.display !== 'visible') {\n return null\n }\n\n const mergedSlots = mergeSlots(field, slots, field.content)\n const decoratorContent = schemaRef.value?.['x-decorator-content']\n ?? props.fieldProps?.decoratorContent\n const decoratorSlots = mergeSlots(field, slots, decoratorContent)\n\n const renderDecorator = (childNodes: Array<VNode | null | undefined>) => {\n const normalizedChildren = childNodes.filter(child => child != null) as VNode[]\n if (!field.decoratorType) {\n return wrapFragment(normalizedChildren)\n }\n\n const finalComponent\n = FormPath.getIn(options?.components, field.decoratorType as string) ?? field.decoratorType\n const decoratorEntry = Array.isArray(field.decorator) ? field.decorator[1] : undefined\n const decoratorAttrs = toJS(decoratorEntry) || {}\n const { attrs, events } = extractAttrsAndEvents(decoratorAttrs)\n const decoratorProps = createVNodeProps(attrs, events)\n\n return h(finalComponent, decoratorProps, {\n ...decoratorSlots,\n default: () => normalizedChildren,\n })\n }\n\n const renderComponent = (): VNode | null => {\n if (!field.componentType) {\n return wrapFragment(mergedSlots?.default?.())\n }\n\n const component\n = FormPath.getIn(options?.components, field.componentType as string) ?? field.componentType\n\n const componentEntry = Array.isArray(field.component) ? field.component[1] : undefined\n const originData = toJS(componentEntry) || {}\n const fieldValue = !isVoidField(field) ? field.value : undefined\n const composedAttrs = {\n disabled: !isVoidField(field)\n ? field.pattern === 'disabled' || field.pattern === 'readPretty'\n : undefined,\n readOnly: !isVoidField(field) ? field.pattern === 'readOnly' : undefined,\n ...originData,\n modelValue: fieldValue,\n }\n const { attrs, events } = extractAttrsAndEvents(composedAttrs)\n const modelUpdateHandler: ComponentEventHandler | undefined = events['update:modelValue']\n const focusHandler: ComponentEventHandler | undefined = events.focus\n const blurHandler: ComponentEventHandler | undefined = events.blur\n\n const emitInput = (...args: ComponentEventArgs) => {\n if (!isVoidField(field)) {\n field.onInput(...(args as Parameters<typeof field.onInput>))\n }\n }\n\n events['update:modelValue'] = (...args: ComponentEventArgs) => {\n emitInput(...args)\n modelUpdateHandler?.(...args)\n }\n events.focus = (...args: ComponentEventArgs) => {\n if (!isVoidField(field)) {\n field.onFocus(...(args as Parameters<typeof field.onFocus>))\n }\n focusHandler?.(...args)\n }\n events.blur = (...args: ComponentEventArgs) => {\n if (!isVoidField(field)) {\n field.onBlur(...(args as Parameters<typeof field.onBlur>))\n }\n blurHandler?.(...args)\n }\n\n const componentProps = createVNodeProps(attrs, events)\n return h(component, componentProps, mergedSlots)\n }\n\n return renderDecorator([renderComponent()])\n }\n },\n})\n"],"names":["ReactiveField","defineComponent","props","slots","formRef","useForm","parentRef","useField","optionsRef","inject","SchemaOptionsSymbol","ref","schemaRef","SchemaSymbol","useObserver","createField","fieldRef","shallowRef","watch","useAttach","provide","FieldSymbol","field","options","mergedSlots","mergeSlots","decoratorContent","decoratorSlots","childNodes","normalizedChildren","child","wrapFragment","finalComponent","FormPath","decoratorEntry","decoratorAttrs","toJS","attrs","events","extractAttrsAndEvents","decoratorProps","createVNodeProps","h","component","componentEntry","originData","fieldValue","isVoidField","composedAttrs","modelUpdateHandler","focusHandler","blurHandler","emitInput","args","componentProps"],"mappings":";;;;;;;;;;AAiBA,MAAAA,KAAeC,EAAgB;AAAA,EAC7B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AAKN,EAAYzB,CAAK,KACpBA,EAAM,QAAQ,GAAI+B,CAAyC,GAE7DH,IAAe,GAAGG,CAAI;AAAA,QACxB,GACAf,EAAO,OAAO,IAAIe,MAA6B;AAC7C,UAAKN,EAAYzB,CAAK,KACpBA,EAAM,OAAO,GAAI+B,CAAwC,GAE3DF,IAAc,GAAGE,CAAI;AAAA,QACvB;AAEA,cAAMC,IAAiBb,EAAiBJ,GAAOC,CAAM;AACrD,eAAOI,EAAEC,GAAWW,GAAgB9B,CAAW;AAAA,MACjD,GAEwB,CAAiB,CAAC;AAAA,IAC5C;AAAA,EACF;AACF,CAAC;"}
@@ -2,21 +2,21 @@ import { VNode } from 'vue';
2
2
  import { Schema } from '@formily/json-schema';
3
3
  declare const RecursionField: import('vue').DefineComponent<{
4
4
  schema: Schema | import('@formily/json-schema').ISchema;
5
- name?: import('@formily/json-schema').SchemaKey;
6
- basePath?: import('@formily/shared').FormPathPattern;
7
- onlyRenderProperties?: boolean;
8
- onlyRenderSelf?: boolean;
9
- mapProperties?: import('..').ISchemaMapper;
10
- filterProperties?: import('..').ISchemaFilter;
5
+ name?: import('@formily/json-schema').SchemaKey | undefined;
6
+ basePath?: import('@formily/shared').FormPathPattern | undefined;
7
+ onlyRenderProperties?: boolean | undefined;
8
+ onlyRenderSelf?: boolean | undefined;
9
+ mapProperties?: import('..').ISchemaMapper | undefined;
10
+ filterProperties?: import('..').ISchemaFilter | undefined;
11
11
  }, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
12
12
  [key: string]: any;
13
- }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
13
+ }> | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
14
14
  schema: Schema | import('@formily/json-schema').ISchema;
15
- name?: import('@formily/json-schema').SchemaKey;
16
- basePath?: import('@formily/shared').FormPathPattern;
17
- onlyRenderProperties?: boolean;
18
- onlyRenderSelf?: boolean;
19
- mapProperties?: import('..').ISchemaMapper;
20
- filterProperties?: import('..').ISchemaFilter;
15
+ name?: import('@formily/json-schema').SchemaKey | undefined;
16
+ basePath?: import('@formily/shared').FormPathPattern | undefined;
17
+ onlyRenderProperties?: boolean | undefined;
18
+ onlyRenderSelf?: boolean | undefined;
19
+ mapProperties?: import('..').ISchemaMapper | undefined;
20
+ filterProperties?: import('..').ISchemaFilter | undefined;
21
21
  }> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
22
22
  export default RecursionField;