@silver-formily/vue 0.0.1-beta.0
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/esm/components/ArrayField.d.ts +56 -0
- package/esm/components/ArrayField.mjs +24 -0
- package/esm/components/ArrayField.mjs.map +1 -0
- package/esm/components/ExpressionScope.d.ts +16 -0
- package/esm/components/ExpressionScope.mjs +25 -0
- package/esm/components/ExpressionScope.mjs.map +1 -0
- package/esm/components/Field.d.ts +56 -0
- package/esm/components/Field.mjs +24 -0
- package/esm/components/Field.mjs.map +1 -0
- package/esm/components/FormConsumer.d.ts +4 -0
- package/esm/components/FormConsumer.mjs +19 -0
- package/esm/components/FormConsumer.mjs.map +1 -0
- package/esm/components/FormProvider.d.ts +16 -0
- package/esm/components/FormProvider.mjs +27 -0
- package/esm/components/FormProvider.mjs.map +1 -0
- package/esm/components/ObjectField.d.ts +56 -0
- package/esm/components/ObjectField.mjs +24 -0
- package/esm/components/ObjectField.mjs.map +1 -0
- package/esm/components/ReactiveField.d.ts +16 -0
- package/esm/components/ReactiveField.mjs +75 -0
- package/esm/components/ReactiveField.mjs.map +1 -0
- package/esm/components/RecursionField.d.ts +22 -0
- package/esm/components/RecursionField.mjs +129 -0
- package/esm/components/RecursionField.mjs.map +1 -0
- package/esm/components/SchemaField.d.ts +2900 -0
- package/esm/components/SchemaField.mjs +106 -0
- package/esm/components/SchemaField.mjs.map +1 -0
- package/esm/components/VoidField.d.ts +40 -0
- package/esm/components/VoidField.mjs +24 -0
- package/esm/components/VoidField.mjs.map +1 -0
- package/esm/components/index.d.ts +9 -0
- package/esm/components/index.mjs +21 -0
- package/esm/components/index.mjs.map +1 -0
- package/esm/global.d.mjs +2 -0
- package/esm/global.d.mjs.map +1 -0
- package/esm/hooks/index.d.ts +5 -0
- package/esm/hooks/index.mjs +13 -0
- package/esm/hooks/index.mjs.map +1 -0
- package/esm/hooks/useAttach.d.ts +7 -0
- package/esm/hooks/useAttach.mjs +14 -0
- package/esm/hooks/useAttach.mjs.map +1 -0
- package/esm/hooks/useField.d.ts +3 -0
- package/esm/hooks/useField.mjs +9 -0
- package/esm/hooks/useField.mjs.map +1 -0
- package/esm/hooks/useFieldSchema.d.ts +1 -0
- package/esm/hooks/useFieldSchema.mjs +9 -0
- package/esm/hooks/useFieldSchema.mjs.map +1 -0
- package/esm/hooks/useForm.d.ts +3 -0
- package/esm/hooks/useForm.mjs +9 -0
- package/esm/hooks/useForm.mjs.map +1 -0
- package/esm/hooks/useFormEffects.d.ts +2 -0
- package/esm/hooks/useFormEffects.mjs +16 -0
- package/esm/hooks/useFormEffects.mjs.map +1 -0
- package/esm/hooks/useInjectionCleaner.d.ts +2 -0
- package/esm/hooks/useInjectionCleaner.mjs +8 -0
- package/esm/hooks/useInjectionCleaner.mjs.map +1 -0
- package/esm/hooks/useParentForm.d.ts +3 -0
- package/esm/hooks/useParentForm.mjs +12 -0
- package/esm/hooks/useParentForm.mjs.map +1 -0
- package/esm/index.d.ts +4 -0
- package/esm/index.mjs +42 -0
- package/esm/index.mjs.map +1 -0
- package/esm/shared/connect.d.ts +9 -0
- package/esm/shared/connect.mjs +66 -0
- package/esm/shared/connect.mjs.map +1 -0
- package/esm/shared/context.d.ts +10 -0
- package/esm/shared/context.mjs +10 -0
- package/esm/shared/context.mjs.map +1 -0
- package/esm/shared/index.d.ts +2 -0
- package/esm/shared/index.mjs +14 -0
- package/esm/shared/index.mjs.map +1 -0
- package/esm/types/index.d.ts +64 -0
- package/esm/types/index.mjs +2 -0
- package/esm/types/index.mjs.map +1 -0
- package/esm/utils/fieldProps.d.ts +49 -0
- package/esm/utils/fieldProps.mjs +51 -0
- package/esm/utils/fieldProps.mjs.map +1 -0
- package/esm/utils/getRawComponent.d.ts +8 -0
- package/esm/utils/getRawComponent.mjs +13 -0
- package/esm/utils/getRawComponent.mjs.map +1 -0
- package/esm/utils/reactiveFieldHelpers.d.ts +16 -0
- package/esm/utils/reactiveFieldHelpers.mjs +106 -0
- package/esm/utils/reactiveFieldHelpers.mjs.map +1 -0
- package/esm/utils/recursionFieldProps.d.ts +67 -0
- package/esm/utils/recursionFieldProps.mjs +14 -0
- package/esm/utils/recursionFieldProps.mjs.map +1 -0
- package/esm/utils/resolveSchemaProps.d.ts +1 -0
- package/esm/utils/resolveSchemaProps.mjs +11 -0
- package/esm/utils/resolveSchemaProps.mjs.map +1 -0
- package/esm/utils/runtimeProps.d.ts +8 -0
- package/esm/utils/runtimeProps.mjs +17 -0
- package/esm/utils/runtimeProps.mjs.map +1 -0
- package/esm/utils/schemaFieldProps.d.ts +231 -0
- package/esm/utils/schemaFieldProps.mjs +63 -0
- package/esm/utils/schemaFieldProps.mjs.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{
|
|
2
|
+
name: import('@formily/core').FormPathPattern;
|
|
3
|
+
basePath?: import('@formily/core').FormPathPattern;
|
|
4
|
+
title?: any;
|
|
5
|
+
description?: any;
|
|
6
|
+
value?: any;
|
|
7
|
+
initialValue?: any;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
display?: string;
|
|
10
|
+
pattern?: string;
|
|
11
|
+
hidden?: boolean;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
editable?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
readPretty?: boolean;
|
|
17
|
+
dataSource?: import('@formily/core').FieldDataSource;
|
|
18
|
+
validateFirst?: boolean;
|
|
19
|
+
validatePattern?: import('@formily/core').FieldPatternTypes[];
|
|
20
|
+
validateDisplay?: import('@formily/core').FieldDisplayTypes[];
|
|
21
|
+
validator?: string | import('@formily/validator').ValidatorFunction<import('@formily/core').FieldValidatorContext> | import('@formily/validator').IValidatorRules<import('@formily/core').FieldValidatorContext> | import('@formily/validator').MultiValidator<import('@formily/core').FieldValidatorContext>;
|
|
22
|
+
decorator?: import('@formily/core').FieldDecorator<import('vue').Component, any>;
|
|
23
|
+
component?: import('@formily/core').FieldComponent<import('vue').Component, any>;
|
|
24
|
+
reactions?: import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction;
|
|
25
|
+
content?: any;
|
|
26
|
+
data?: any;
|
|
27
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
30
|
+
name: import('@formily/core').FormPathPattern;
|
|
31
|
+
basePath?: import('@formily/core').FormPathPattern;
|
|
32
|
+
title?: any;
|
|
33
|
+
description?: any;
|
|
34
|
+
value?: any;
|
|
35
|
+
initialValue?: any;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
display?: string;
|
|
38
|
+
pattern?: string;
|
|
39
|
+
hidden?: boolean;
|
|
40
|
+
visible?: boolean;
|
|
41
|
+
editable?: boolean;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
readOnly?: boolean;
|
|
44
|
+
readPretty?: boolean;
|
|
45
|
+
dataSource?: import('@formily/core').FieldDataSource;
|
|
46
|
+
validateFirst?: boolean;
|
|
47
|
+
validatePattern?: import('@formily/core').FieldPatternTypes[];
|
|
48
|
+
validateDisplay?: import('@formily/core').FieldDisplayTypes[];
|
|
49
|
+
validator?: string | import('@formily/validator').ValidatorFunction<import('@formily/core').FieldValidatorContext> | import('@formily/validator').IValidatorRules<import('@formily/core').FieldValidatorContext> | import('@formily/validator').MultiValidator<import('@formily/core').FieldValidatorContext>;
|
|
50
|
+
decorator?: import('@formily/core').FieldDecorator<import('vue').Component, any>;
|
|
51
|
+
component?: import('@formily/core').FieldComponent<import('vue').Component, any>;
|
|
52
|
+
reactions?: import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction;
|
|
53
|
+
content?: any;
|
|
54
|
+
data?: any;
|
|
55
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
56
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineComponent as t, h as i } from "vue";
|
|
2
|
+
import { fieldProps as m } from "../utils/fieldProps.mjs";
|
|
3
|
+
import { getRawComponent as n } from "../utils/getRawComponent.mjs";
|
|
4
|
+
import p from "./ReactiveField.mjs";
|
|
5
|
+
const s = t({
|
|
6
|
+
name: "ArrayField",
|
|
7
|
+
props: m,
|
|
8
|
+
setup(e, { slots: r }) {
|
|
9
|
+
return () => {
|
|
10
|
+
const o = {
|
|
11
|
+
fieldType: "ArrayField",
|
|
12
|
+
fieldProps: {
|
|
13
|
+
...e,
|
|
14
|
+
...n(e)
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return i(p, o, r);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
s as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=ArrayField.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ArrayField.mjs","sources":["../../src/components/ArrayField.ts"],"sourcesContent":["import type { IArrayFieldProps } from '../types'\nimport { defineComponent, h } from 'vue'\nimport { fieldProps } from '../utils/fieldProps'\nimport { getRawComponent } from '../utils/getRawComponent'\nimport ReactiveField from './ReactiveField'\n\nexport default defineComponent({\n name: 'ArrayField',\n props: fieldProps,\n setup(props: IArrayFieldProps, { slots }) {\n return () => {\n const componentData = {\n fieldType: 'ArrayField',\n fieldProps: {\n ...props,\n ...getRawComponent(props),\n },\n }\n return h(ReactiveField, componentData, slots)\n }\n },\n})\n"],"names":["ArrayField","defineComponent","fieldProps","props","slots","componentData","getRawComponent","h","ReactiveField"],"mappings":";;;;AAMA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,OAAOC;AAAA,EACP,MAAMC,GAAyB,EAAE,OAAAC,KAAS;AACxC,WAAO,MAAM;AACX,YAAMC,IAAgB;AAAA,QACpB,WAAW;AAAA,QACX,YAAY;AAAA,UACV,GAAGF;AAAA,UACH,GAAGG,EAAgBH,CAAK;AAAA,QAAA;AAAA,MAC1B;AAEF,aAAOI,EAAEC,GAAeH,GAAeD,CAAK;AAAA,IAC9C;AAAA,EACF;AACF,CAAC;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { IExpressionScopeProps } from '../types';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
value: {
|
|
5
|
+
type: PropType<IExpressionScopeProps["value"]>;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
11
|
+
value: {
|
|
12
|
+
type: PropType<IExpressionScopeProps["value"]>;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { lazyMerge as s } from "@formily/shared";
|
|
2
|
+
import { defineComponent as c, inject as i, computed as m, provide as a } from "vue";
|
|
3
|
+
import "@formily/core";
|
|
4
|
+
import "@formily/reactive-vue";
|
|
5
|
+
import { SchemaExpressionScopeSymbol as e } from "../shared/context.mjs";
|
|
6
|
+
const x = c({
|
|
7
|
+
name: "ExpressionScope",
|
|
8
|
+
props: {
|
|
9
|
+
value: {
|
|
10
|
+
type: Object,
|
|
11
|
+
required: !0
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
setup(o, { slots: p }) {
|
|
15
|
+
const r = i(e), t = m(() => {
|
|
16
|
+
const n = r?.value ?? {};
|
|
17
|
+
return s(n, o.value);
|
|
18
|
+
});
|
|
19
|
+
return a(e, t), () => p.default?.();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export {
|
|
23
|
+
x as default
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=ExpressionScope.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpressionScope.mjs","sources":["../../src/components/ExpressionScope.ts"],"sourcesContent":["import type { PropType, Ref } from 'vue'\nimport type { IExpressionScopeProps, SchemaExpressionScope } from '../types'\nimport { lazyMerge } from '@formily/shared'\nimport { computed, defineComponent, inject, provide } from 'vue'\nimport { SchemaExpressionScopeSymbol } from '../shared'\n\nexport default defineComponent({\n name: 'ExpressionScope',\n props: {\n value: {\n type: Object as PropType<IExpressionScopeProps['value']>,\n required: true,\n },\n },\n setup(props, { slots }) {\n const parentScopeRef = inject<Ref<SchemaExpressionScope>>(SchemaExpressionScopeSymbol)\n const expressionScopeRef = computed<SchemaExpressionScope>(() => {\n const parentScope = parentScopeRef?.value ?? {}\n return lazyMerge(parentScope, props.value)\n })\n\n provide(SchemaExpressionScopeSymbol, expressionScopeRef)\n\n return () => slots.default?.()\n },\n})\n"],"names":["ExpressionScope","defineComponent","props","slots","parentScopeRef","inject","SchemaExpressionScopeSymbol","expressionScopeRef","computed","parentScope","lazyMerge","provide"],"mappings":";;;;;AAMA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO;AAAA,IACL,OAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,EACZ;AAAA,EAEF,MAAMC,GAAO,EAAE,OAAAC,KAAS;AACtB,UAAMC,IAAiBC,EAAmCC,CAA2B,GAC/EC,IAAqBC,EAAgC,MAAM;AAC/D,YAAMC,IAAcL,GAAgB,SAAS,CAAA;AAC7C,aAAOM,EAAUD,GAAaP,EAAM,KAAK;AAAA,IAC3C,CAAC;AAED,WAAAS,EAAQL,GAA6BC,CAAkB,GAEhD,MAAMJ,EAAM,UAAA;AAAA,EACrB;AACF,CAAC;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{
|
|
2
|
+
name: import('@formily/core').FormPathPattern;
|
|
3
|
+
basePath?: import('@formily/core').FormPathPattern;
|
|
4
|
+
title?: any;
|
|
5
|
+
description?: any;
|
|
6
|
+
value?: any;
|
|
7
|
+
initialValue?: any;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
display?: string;
|
|
10
|
+
pattern?: string;
|
|
11
|
+
hidden?: boolean;
|
|
12
|
+
visible?: boolean;
|
|
13
|
+
editable?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
readOnly?: boolean;
|
|
16
|
+
readPretty?: boolean;
|
|
17
|
+
dataSource?: import('@formily/core').FieldDataSource;
|
|
18
|
+
validateFirst?: boolean;
|
|
19
|
+
validatePattern?: import('@formily/core').FieldPatternTypes[];
|
|
20
|
+
validateDisplay?: import('@formily/core').FieldDisplayTypes[];
|
|
21
|
+
validator?: string | import('@formily/validator').ValidatorFunction<import('@formily/core').FieldValidatorContext> | import('@formily/validator').IValidatorRules<import('@formily/core').FieldValidatorContext> | import('@formily/validator').MultiValidator<import('@formily/core').FieldValidatorContext>;
|
|
22
|
+
decorator?: import('@formily/core').FieldDecorator<import('vue').Component, any>;
|
|
23
|
+
component?: import('@formily/core').FieldComponent<import('vue').Component, any>;
|
|
24
|
+
reactions?: import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction;
|
|
25
|
+
content?: any;
|
|
26
|
+
data?: any;
|
|
27
|
+
}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
30
|
+
name: import('@formily/core').FormPathPattern;
|
|
31
|
+
basePath?: import('@formily/core').FormPathPattern;
|
|
32
|
+
title?: any;
|
|
33
|
+
description?: any;
|
|
34
|
+
value?: any;
|
|
35
|
+
initialValue?: any;
|
|
36
|
+
required?: boolean;
|
|
37
|
+
display?: string;
|
|
38
|
+
pattern?: string;
|
|
39
|
+
hidden?: boolean;
|
|
40
|
+
visible?: boolean;
|
|
41
|
+
editable?: boolean;
|
|
42
|
+
disabled?: boolean;
|
|
43
|
+
readOnly?: boolean;
|
|
44
|
+
readPretty?: boolean;
|
|
45
|
+
dataSource?: import('@formily/core').FieldDataSource;
|
|
46
|
+
validateFirst?: boolean;
|
|
47
|
+
validatePattern?: import('@formily/core').FieldPatternTypes[];
|
|
48
|
+
validateDisplay?: import('@formily/core').FieldDisplayTypes[];
|
|
49
|
+
validator?: string | import('@formily/validator').ValidatorFunction<import('@formily/core').FieldValidatorContext> | import('@formily/validator').IValidatorRules<import('@formily/core').FieldValidatorContext> | import('@formily/validator').MultiValidator<import('@formily/core').FieldValidatorContext>;
|
|
50
|
+
decorator?: import('@formily/core').FieldDecorator<import('vue').Component, any>;
|
|
51
|
+
component?: import('@formily/core').FieldComponent<import('vue').Component, any>;
|
|
52
|
+
reactions?: import('@formily/core').FieldReaction[] | import('@formily/core').FieldReaction;
|
|
53
|
+
content?: any;
|
|
54
|
+
data?: any;
|
|
55
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
56
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineComponent as r, h as i } from "vue";
|
|
2
|
+
import { fieldProps as m } from "../utils/fieldProps.mjs";
|
|
3
|
+
import { getRawComponent as n } from "../utils/getRawComponent.mjs";
|
|
4
|
+
import p from "./ReactiveField.mjs";
|
|
5
|
+
const a = r({
|
|
6
|
+
name: "Field",
|
|
7
|
+
props: m,
|
|
8
|
+
setup(e, o) {
|
|
9
|
+
return () => {
|
|
10
|
+
const t = {
|
|
11
|
+
fieldType: "Field",
|
|
12
|
+
fieldProps: {
|
|
13
|
+
...e,
|
|
14
|
+
...n(e)
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return i(p, t, o.slots);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
a as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Field.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.mjs","sources":["../../src/components/Field.ts"],"sourcesContent":["import type { IFieldProps, IReactiveFieldProps } from '../types'\nimport { defineComponent, h } from 'vue'\nimport { fieldProps } from '../utils/fieldProps'\nimport { getRawComponent } from '../utils/getRawComponent'\nimport ReactiveField from './ReactiveField'\n\nexport default defineComponent({\n name: 'Field',\n props: fieldProps,\n setup(props: IFieldProps, context) {\n return () => {\n const componentData: IReactiveFieldProps = {\n fieldType: 'Field',\n fieldProps: {\n ...props,\n ...getRawComponent(props),\n },\n }\n return h(ReactiveField, componentData, context.slots)\n }\n },\n})\n"],"names":["Field","defineComponent","fieldProps","props","context","componentData","getRawComponent","h","ReactiveField"],"mappings":";;;;AAMA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,OAAOC;AAAA,EACP,MAAMC,GAAoBC,GAAS;AACjC,WAAO,MAAM;AACX,YAAMC,IAAqC;AAAA,QACzC,WAAW;AAAA,QACX,YAAY;AAAA,UACV,GAAGF;AAAA,UACH,GAAGG,EAAgBH,CAAK;AAAA,QAAA;AAAA,MAC1B;AAEF,aAAOI,EAAEC,GAAeH,GAAeD,EAAQ,KAAK;AAAA,IACtD;AAAA,EACF;AACF,CAAC;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<{}, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useObserver as m } from "@formily/reactive-vue";
|
|
2
|
+
import { defineComponent as t } from "vue";
|
|
3
|
+
import { useForm as s } from "../hooks/useForm.mjs";
|
|
4
|
+
import "@formily/core";
|
|
5
|
+
const p = t({
|
|
6
|
+
name: "FormConsumer",
|
|
7
|
+
inheritAttrs: !1,
|
|
8
|
+
setup(n, { slots: e }) {
|
|
9
|
+
m({
|
|
10
|
+
scheduler: (o) => Promise.resolve().then(o)
|
|
11
|
+
});
|
|
12
|
+
const r = s();
|
|
13
|
+
return () => e.default?.({ form: r.value }) ?? null;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
p as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=FormConsumer.mjs.map
|
|
@@ -0,0 +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;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { IProviderProps } from '../types';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
4
|
+
form: {
|
|
5
|
+
type: PropType<IProviderProps["form"]>;
|
|
6
|
+
required: true;
|
|
7
|
+
};
|
|
8
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
11
|
+
form: {
|
|
12
|
+
type: PropType<IProviderProps["form"]>;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { defineComponent as m, toRef as t, provide as p } from "vue";
|
|
2
|
+
import { useAttach as i } from "../hooks/useAttach.mjs";
|
|
3
|
+
import { useInjectionCleaner as f } from "../hooks/useInjectionCleaner.mjs";
|
|
4
|
+
import { FormSymbol as n, FieldSymbol as a, SchemaMarkupSymbol as S, SchemaSymbol as c, SchemaExpressionScopeSymbol as l, SchemaOptionsSymbol as s } from "../shared/context.mjs";
|
|
5
|
+
const h = m({
|
|
6
|
+
name: "FormProvider",
|
|
7
|
+
props: {
|
|
8
|
+
form: {
|
|
9
|
+
type: Object,
|
|
10
|
+
required: !0
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
setup(o, { slots: e }) {
|
|
14
|
+
const r = i(t(o, "form"));
|
|
15
|
+
return p(n, r), f([
|
|
16
|
+
a,
|
|
17
|
+
S,
|
|
18
|
+
c,
|
|
19
|
+
l,
|
|
20
|
+
s
|
|
21
|
+
]), () => e.default?.();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
h as default
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=FormProvider.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormProvider.mjs","sources":["../../src/components/FormProvider.ts"],"sourcesContent":["import type { PropType } from 'vue'\nimport type { IProviderProps } from '../types'\nimport { defineComponent, provide, toRef } from 'vue'\nimport { useAttach } from '../hooks/useAttach'\nimport { useInjectionCleaner } from '../hooks/useInjectionCleaner'\nimport {\n FieldSymbol,\n FormSymbol,\n SchemaExpressionScopeSymbol,\n SchemaMarkupSymbol,\n SchemaOptionsSymbol,\n SchemaSymbol,\n} from '../shared/context'\n\nexport default defineComponent({\n name: 'FormProvider',\n props: {\n form: {\n type: Object as PropType<IProviderProps['form']>,\n required: true,\n },\n },\n setup(props, { slots }) {\n const formRef = useAttach(toRef(props, 'form'))\n provide(FormSymbol, formRef)\n useInjectionCleaner([\n FieldSymbol,\n SchemaMarkupSymbol,\n SchemaSymbol,\n SchemaExpressionScopeSymbol,\n SchemaOptionsSymbol,\n ])\n\n return () => slots.default?.()\n },\n})\n"],"names":["FormProvider","defineComponent","props","slots","formRef","useAttach","toRef","provide","FormSymbol","useInjectionCleaner","FieldSymbol","SchemaMarkupSymbol","SchemaSymbol","SchemaExpressionScopeSymbol","SchemaOptionsSymbol"],"mappings":";;;;AAcA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO;AAAA,IACL,MAAM;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA,IAAA;AAAA,EACZ;AAAA,EAEF,MAAMC,GAAO,EAAE,OAAAC,KAAS;AACtB,UAAMC,IAAUC,EAAUC,EAAMJ,GAAO,MAAM,CAAC;AAC9C,WAAAK,EAAQC,GAAYJ,CAAO,GAC3BK,EAAoB;AAAA,MAClBC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA,CACD,GAEM,MAAMX,EAAM,UAAA;AAAA,EACrB;AACF,CAAC;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
2
|
+
readonly name: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern>;
|
|
3
|
+
readonly title: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
4
|
+
readonly description: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
5
|
+
readonly value: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
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>>;
|
|
9
|
+
readonly component: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldComponent<import('vue').Component, any>>;
|
|
10
|
+
readonly display: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes>;
|
|
11
|
+
readonly pattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes>;
|
|
12
|
+
readonly required: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
13
|
+
readonly validateFirst: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
14
|
+
readonly hidden: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
15
|
+
readonly visible: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
16
|
+
readonly editable: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
17
|
+
readonly disabled: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
18
|
+
readonly readOnly: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
19
|
+
readonly readPretty: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
20
|
+
readonly dataSource: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDataSource>;
|
|
21
|
+
readonly validatePattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes[]>;
|
|
22
|
+
readonly validateDisplay: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes[]>;
|
|
23
|
+
readonly validator: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldValidator>;
|
|
24
|
+
readonly reactions: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldReaction | import('@formily/core').FieldReaction[]>;
|
|
25
|
+
readonly content: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
26
|
+
readonly data: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
27
|
+
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
28
|
+
[key: string]: any;
|
|
29
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
30
|
+
readonly name: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern>;
|
|
31
|
+
readonly title: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
32
|
+
readonly description: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
33
|
+
readonly value: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
34
|
+
readonly initialValue: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
35
|
+
readonly basePath: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern>;
|
|
36
|
+
readonly decorator: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDecorator<import('vue').Component, any>>;
|
|
37
|
+
readonly component: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldComponent<import('vue').Component, any>>;
|
|
38
|
+
readonly display: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes>;
|
|
39
|
+
readonly pattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes>;
|
|
40
|
+
readonly required: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
41
|
+
readonly validateFirst: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
42
|
+
readonly hidden: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
43
|
+
readonly visible: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
44
|
+
readonly editable: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
45
|
+
readonly disabled: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
46
|
+
readonly readOnly: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
47
|
+
readonly readPretty: import('../utils/runtimeProps').RuntimeProp<boolean>;
|
|
48
|
+
readonly dataSource: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDataSource>;
|
|
49
|
+
readonly validatePattern: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes[]>;
|
|
50
|
+
readonly validateDisplay: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes[]>;
|
|
51
|
+
readonly validator: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldValidator>;
|
|
52
|
+
readonly reactions: import('../utils/runtimeProps').RuntimeProp<import('@formily/core').FieldReaction | import('@formily/core').FieldReaction[]>;
|
|
53
|
+
readonly content: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
54
|
+
readonly data: import('../utils/runtimeProps').RuntimeProp<any>;
|
|
55
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
56
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineComponent as r, h as i } from "vue";
|
|
2
|
+
import { fieldProps as m } from "../utils/fieldProps.mjs";
|
|
3
|
+
import { getRawComponent as n } from "../utils/getRawComponent.mjs";
|
|
4
|
+
import p from "./ReactiveField.mjs";
|
|
5
|
+
const c = r({
|
|
6
|
+
name: "ObjectField",
|
|
7
|
+
props: m,
|
|
8
|
+
setup(e, { slots: t }) {
|
|
9
|
+
return () => {
|
|
10
|
+
const o = {
|
|
11
|
+
fieldType: "ObjectField",
|
|
12
|
+
fieldProps: {
|
|
13
|
+
...e,
|
|
14
|
+
...n(e)
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return i(p, o, t);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
c as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=ObjectField.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectField.mjs","sources":["../../src/components/ObjectField.ts"],"sourcesContent":["import { defineComponent, h } from 'vue'\nimport { fieldProps } from '../utils/fieldProps'\nimport { getRawComponent } from '../utils/getRawComponent'\nimport ReactiveField from './ReactiveField'\n\nexport default defineComponent({\n name: 'ObjectField',\n props: fieldProps,\n setup(props, { slots }) {\n return () => {\n const componentData = {\n fieldType: 'ObjectField',\n fieldProps: {\n ...props,\n ...getRawComponent(props),\n },\n }\n return h(ReactiveField, componentData, slots)\n }\n },\n})\n"],"names":["ObjectField","defineComponent","fieldProps","props","slots","componentData","getRawComponent","h","ReactiveField"],"mappings":";;;;AAKA,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,OAAOC;AAAA,EACP,MAAMC,GAAO,EAAE,OAAAC,KAAS;AACtB,WAAO,MAAM;AACX,YAAMC,IAAgB;AAAA,QACpB,WAAW;AAAA,QACX,YAAY;AAAA,UACV,GAAGF;AAAA,UACH,GAAGG,EAAgBH,CAAK;AAAA,QAAA;AAAA,MAC1B;AAEF,aAAOI,EAAEC,GAAeH,GAAeD,CAAK;AAAA,IAC9C;AAAA,EACF;AACF,CAAC;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<{
|
|
3
|
+
fieldType: "Field" | "ArrayField" | "ObjectField" | "VoidField";
|
|
4
|
+
fieldProps: import('..').IVoidFieldProps<import('vue').Component, import('vue').Component>;
|
|
5
|
+
}, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}> | VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}>[], {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
10
|
+
fieldType: "Field" | "ArrayField" | "ObjectField" | "VoidField";
|
|
11
|
+
fieldProps: import('..').IVoidFieldProps<import('vue').Component, import('vue').Component>;
|
|
12
|
+
}> & Readonly<{}>, {
|
|
13
|
+
fieldType: string;
|
|
14
|
+
fieldProps: Record<string, any>;
|
|
15
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { isVoidField as r } from "@formily/core";
|
|
2
|
+
import { toJS as F } from "@formily/reactive";
|
|
3
|
+
import { useObserver as w } from "@formily/reactive-vue";
|
|
4
|
+
import { FormPath as P } from "@formily/shared";
|
|
5
|
+
import { defineComponent as D, inject as E, ref as H, shallowRef as j, watch as x, provide as z, h } from "vue";
|
|
6
|
+
import { useField as B } from "../hooks/useField.mjs";
|
|
7
|
+
import { SchemaOptionsSymbol as J, FieldSymbol as N } from "../shared/context.mjs";
|
|
8
|
+
import { useForm as U } from "../hooks/useForm.mjs";
|
|
9
|
+
import { useAttach as $ } from "../hooks/useAttach.mjs";
|
|
10
|
+
import { mergeSlots as k, wrapFragment as A, extractAttrsAndEvents as T, createVNodeProps as R } from "../utils/reactiveFieldHelpers.mjs";
|
|
11
|
+
const oe = D({
|
|
12
|
+
name: "ReactiveField",
|
|
13
|
+
props: {
|
|
14
|
+
fieldType: {
|
|
15
|
+
type: String,
|
|
16
|
+
default: "Field"
|
|
17
|
+
},
|
|
18
|
+
fieldProps: {
|
|
19
|
+
type: Object,
|
|
20
|
+
default: () => ({})
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setup(n, { slots: u }) {
|
|
24
|
+
const S = U(), V = B(), C = E(J, H());
|
|
25
|
+
w();
|
|
26
|
+
const y = () => S?.value?.[`create${n.fieldType}`]?.({
|
|
27
|
+
...n.fieldProps,
|
|
28
|
+
basePath: n.fieldProps?.basePath ?? V.value?.address
|
|
29
|
+
}), a = j(y());
|
|
30
|
+
return x(
|
|
31
|
+
() => n.fieldProps,
|
|
32
|
+
() => a.value = y()
|
|
33
|
+
), $(a), z(N, a), () => {
|
|
34
|
+
const e = a.value, v = C.value;
|
|
35
|
+
if (!e)
|
|
36
|
+
return u.default?.();
|
|
37
|
+
if (e.display !== "visible")
|
|
38
|
+
return null;
|
|
39
|
+
const b = k(e, u, e.content);
|
|
40
|
+
return ((s) => {
|
|
41
|
+
const d = s.filter((f) => f != null);
|
|
42
|
+
if (!e.decoratorType)
|
|
43
|
+
return A(d);
|
|
44
|
+
const c = P.getIn(v?.components, e.decoratorType) ?? e.decoratorType, i = Array.isArray(e.decorator) ? e.decorator[1] : void 0, l = F(i) || {}, { attrs: p, events: t } = T(l), m = R(p, t);
|
|
45
|
+
return h(c, m, {
|
|
46
|
+
default: () => d
|
|
47
|
+
});
|
|
48
|
+
})([(() => {
|
|
49
|
+
if (!e.componentType)
|
|
50
|
+
return A(b?.default?.());
|
|
51
|
+
const s = P.getIn(v?.components, e.componentType) ?? e.componentType, d = Array.isArray(e.component) ? e.component[1] : void 0, c = F(d) || {}, i = r(e) ? void 0 : e.value, l = {
|
|
52
|
+
disabled: r(e) ? void 0 : e.pattern === "disabled" || e.pattern === "readPretty",
|
|
53
|
+
readOnly: r(e) ? void 0 : e.pattern === "readOnly",
|
|
54
|
+
...c,
|
|
55
|
+
modelValue: i
|
|
56
|
+
}, { attrs: p, events: t } = T(l), m = t["update:modelValue"], f = t.focus, O = t.blur, g = (...o) => {
|
|
57
|
+
r(e) || e.onInput(...o);
|
|
58
|
+
};
|
|
59
|
+
t["update:modelValue"] = (...o) => {
|
|
60
|
+
g(...o), m?.(...o);
|
|
61
|
+
}, t.focus = (...o) => {
|
|
62
|
+
r(e) || e.onFocus(...o), f?.(...o);
|
|
63
|
+
}, t.blur = (...o) => {
|
|
64
|
+
r(e) || e.onBlur(...o), O?.(...o);
|
|
65
|
+
};
|
|
66
|
+
const I = R(p, t);
|
|
67
|
+
return h(s, I, b);
|
|
68
|
+
})()]);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
oe as default
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=ReactiveField.mjs.map
|
|
@@ -0,0 +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 } 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\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\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 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","useObserver","createField","fieldRef","shallowRef","watch","useAttach","provide","FieldSymbol","field","options","mergedSlots","mergeSlots","childNodes","normalizedChildren","child","wrapFragment","finalComponent","FormPath","decoratorEntry","decoratorAttrs","toJS","attrs","events","extractAttrsAndEvents","decoratorProps","createVNodeProps","component","componentEntry","originData","fieldValue","isVoidField","composedAttrs","modelUpdateHandler","focusHandler","blurHandler","emitInput","args","componentProps"],"mappings":"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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { VNode } from 'vue';
|
|
2
|
+
import { Schema } from '@formily/json-schema';
|
|
3
|
+
declare const RecursionField: import('vue').DefineComponent<{
|
|
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;
|
|
11
|
+
}, () => VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{
|
|
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;
|
|
21
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
export default RecursionField;
|