@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,64 @@
|
|
|
1
|
+
import { Field, FieldDisplayTypes, FieldValidator, Form, FormPatternTypes, GeneralField, IFieldFactoryProps, IVoidFieldFactoryProps } from '@formily/core';
|
|
2
|
+
import { ISchema, Schema, SchemaKey } from '@formily/json-schema';
|
|
3
|
+
import { FormPathPattern } from '@formily/shared';
|
|
4
|
+
import { Validator as FormilyValidator } from '@formily/validator';
|
|
5
|
+
import { Component } from 'vue';
|
|
6
|
+
export interface VueComponentOptionsWithProps {
|
|
7
|
+
props: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
type ComponentPropsOrRecord<T extends Component> = T extends VueComponentOptionsWithProps ? T['props'] : Record<string, unknown>;
|
|
10
|
+
export type VueComponentProps<T extends Component> = ComponentPropsOrRecord<T> & Record<string, unknown>;
|
|
11
|
+
export interface IProviderProps {
|
|
12
|
+
form: Form;
|
|
13
|
+
}
|
|
14
|
+
export type IFieldProps<D extends Component = Component, C extends Component = Component> = IFieldFactoryProps<D, C>;
|
|
15
|
+
export type IVoidFieldProps<D extends Component = Component, C extends Component = Component> = IVoidFieldFactoryProps<D, C>;
|
|
16
|
+
export type IArrayFieldProps = IFieldProps;
|
|
17
|
+
export type IObjectFieldProps = IFieldProps;
|
|
18
|
+
export interface IReactiveFieldProps {
|
|
19
|
+
fieldType: 'Field' | 'ArrayField' | 'ObjectField' | 'VoidField';
|
|
20
|
+
fieldProps: IFieldProps | IVoidFieldProps;
|
|
21
|
+
}
|
|
22
|
+
export interface IComponentMapper<T extends Component = Component> {
|
|
23
|
+
(target: T): Component;
|
|
24
|
+
}
|
|
25
|
+
export type IStateMapper<Props> = {
|
|
26
|
+
[key in keyof Field]?: keyof Props | boolean;
|
|
27
|
+
} | ((props: Props, field: GeneralField) => Props);
|
|
28
|
+
export type SchemaVueComponents = Record<string, Component>;
|
|
29
|
+
export type SchemaExpressionScope = Record<string, unknown>;
|
|
30
|
+
export interface ISchemaFieldVueFactoryOptions<Components extends SchemaVueComponents = SchemaVueComponents> {
|
|
31
|
+
components?: Components;
|
|
32
|
+
scope?: SchemaExpressionScope;
|
|
33
|
+
}
|
|
34
|
+
export interface ISchemaFieldProps extends Omit<IRecursionFieldProps, 'name' | 'schema'> {
|
|
35
|
+
schema?: ISchema;
|
|
36
|
+
components?: {
|
|
37
|
+
[key: string]: Component;
|
|
38
|
+
};
|
|
39
|
+
scope?: SchemaExpressionScope;
|
|
40
|
+
name?: SchemaKey;
|
|
41
|
+
}
|
|
42
|
+
export interface ISchemaMapper {
|
|
43
|
+
(schema: Schema, name: SchemaKey): Schema;
|
|
44
|
+
}
|
|
45
|
+
export interface ISchemaFilter {
|
|
46
|
+
(schema: Schema, name: SchemaKey): boolean;
|
|
47
|
+
}
|
|
48
|
+
export interface IRecursionFieldProps {
|
|
49
|
+
schema: Schema | ISchema;
|
|
50
|
+
name?: SchemaKey;
|
|
51
|
+
basePath?: FormPathPattern;
|
|
52
|
+
onlyRenderProperties?: boolean;
|
|
53
|
+
onlyRenderSelf?: boolean;
|
|
54
|
+
mapProperties?: ISchemaMapper;
|
|
55
|
+
filterProperties?: ISchemaFilter;
|
|
56
|
+
}
|
|
57
|
+
export type ComponentPath<T, Key extends keyof T = keyof T> = Key extends string ? Key : never;
|
|
58
|
+
export type ComponentPropsByPathValue<T extends SchemaVueComponents, P extends ComponentPath<T>> = P extends keyof T ? VueComponentProps<T[P]> : never;
|
|
59
|
+
export type ISchemaMarkupFieldProps<Components extends SchemaVueComponents = SchemaVueComponents, Decorator extends ComponentPath<Components> = ComponentPath<Components>, Component extends ComponentPath<Components> = ComponentPath<Components>> = ISchema<Decorator, Component, ComponentPropsByPathValue<Components, Decorator>, ComponentPropsByPathValue<Components, Component>, FormPatternTypes, FieldDisplayTypes, FieldValidator, string, GeneralField>;
|
|
60
|
+
export type ISchemaTypeFieldProps<Components extends SchemaVueComponents = SchemaVueComponents, Decorator extends ComponentPath<Components> = ComponentPath<Components>, Component extends ComponentPath<Components> = ComponentPath<Components>> = Omit<ISchemaMarkupFieldProps<Components, Decorator, Component>, 'type'>;
|
|
61
|
+
export interface IExpressionScopeProps {
|
|
62
|
+
value: SchemaExpressionScope;
|
|
63
|
+
}
|
|
64
|
+
export type { FormilyValidator };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ExtractPropTypes } from 'vue';
|
|
2
|
+
export declare const fieldProps: {
|
|
3
|
+
readonly name: import('./runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern>;
|
|
4
|
+
readonly title: import('./runtimeProps').RuntimeProp<any>;
|
|
5
|
+
readonly description: import('./runtimeProps').RuntimeProp<any>;
|
|
6
|
+
readonly value: import('./runtimeProps').RuntimeProp<any>;
|
|
7
|
+
readonly initialValue: import('./runtimeProps').RuntimeProp<any>;
|
|
8
|
+
readonly basePath: import('./runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern>;
|
|
9
|
+
readonly decorator: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldDecorator<import('vue').Component, any>>;
|
|
10
|
+
readonly component: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldComponent<import('vue').Component, any>>;
|
|
11
|
+
readonly display: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes>;
|
|
12
|
+
readonly pattern: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes>;
|
|
13
|
+
readonly required: import('./runtimeProps').RuntimeProp<boolean>;
|
|
14
|
+
readonly validateFirst: import('./runtimeProps').RuntimeProp<boolean>;
|
|
15
|
+
readonly hidden: import('./runtimeProps').RuntimeProp<boolean>;
|
|
16
|
+
readonly visible: import('./runtimeProps').RuntimeProp<boolean>;
|
|
17
|
+
readonly editable: import('./runtimeProps').RuntimeProp<boolean>;
|
|
18
|
+
readonly disabled: import('./runtimeProps').RuntimeProp<boolean>;
|
|
19
|
+
readonly readOnly: import('./runtimeProps').RuntimeProp<boolean>;
|
|
20
|
+
readonly readPretty: import('./runtimeProps').RuntimeProp<boolean>;
|
|
21
|
+
readonly dataSource: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldDataSource>;
|
|
22
|
+
readonly validatePattern: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes[]>;
|
|
23
|
+
readonly validateDisplay: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes[]>;
|
|
24
|
+
readonly validator: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldValidator>;
|
|
25
|
+
readonly reactions: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldReaction | import('@formily/core').FieldReaction[]>;
|
|
26
|
+
readonly content: import('./runtimeProps').RuntimeProp<any>;
|
|
27
|
+
readonly data: import('./runtimeProps').RuntimeProp<any>;
|
|
28
|
+
};
|
|
29
|
+
export declare const voidFieldProps: {
|
|
30
|
+
readonly name: import('./runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern>;
|
|
31
|
+
readonly title: import('./runtimeProps').RuntimeProp<any>;
|
|
32
|
+
readonly description: import('./runtimeProps').RuntimeProp<any>;
|
|
33
|
+
readonly basePath: import('./runtimeProps').RuntimeProp<import('@formily/core').FormPathPattern>;
|
|
34
|
+
readonly decorator: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldDecorator<import('vue').Component, any>>;
|
|
35
|
+
readonly component: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldComponent<import('vue').Component, any>>;
|
|
36
|
+
readonly display: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldDisplayTypes>;
|
|
37
|
+
readonly pattern: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldPatternTypes>;
|
|
38
|
+
readonly hidden: import('./runtimeProps').RuntimeProp<boolean>;
|
|
39
|
+
readonly visible: import('./runtimeProps').RuntimeProp<boolean>;
|
|
40
|
+
readonly editable: import('./runtimeProps').RuntimeProp<boolean>;
|
|
41
|
+
readonly disabled: import('./runtimeProps').RuntimeProp<boolean>;
|
|
42
|
+
readonly readOnly: import('./runtimeProps').RuntimeProp<boolean>;
|
|
43
|
+
readonly readPretty: import('./runtimeProps').RuntimeProp<boolean>;
|
|
44
|
+
readonly reactions: import('./runtimeProps').RuntimeProp<import('@formily/core').FieldReaction | import('@formily/core').FieldReaction[]>;
|
|
45
|
+
readonly content: import('./runtimeProps').RuntimeProp<any>;
|
|
46
|
+
readonly data: import('./runtimeProps').RuntimeProp<any>;
|
|
47
|
+
};
|
|
48
|
+
export type FieldProps = ExtractPropTypes<typeof fieldProps>;
|
|
49
|
+
export type VoidFieldProps = ExtractPropTypes<typeof voidFieldProps>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createProp as e, createBooleanProp as t } from "./runtimeProps.mjs";
|
|
2
|
+
const r = {
|
|
3
|
+
name: e({ required: !0 }),
|
|
4
|
+
title: e(),
|
|
5
|
+
description: e(),
|
|
6
|
+
value: e(),
|
|
7
|
+
initialValue: e(),
|
|
8
|
+
basePath: e(),
|
|
9
|
+
decorator: e(),
|
|
10
|
+
component: e(),
|
|
11
|
+
display: e(),
|
|
12
|
+
pattern: e(),
|
|
13
|
+
required: t(),
|
|
14
|
+
validateFirst: t(),
|
|
15
|
+
hidden: t(),
|
|
16
|
+
visible: t(),
|
|
17
|
+
editable: t(),
|
|
18
|
+
disabled: t(),
|
|
19
|
+
readOnly: t(),
|
|
20
|
+
readPretty: t(),
|
|
21
|
+
dataSource: e(),
|
|
22
|
+
validatePattern: e(),
|
|
23
|
+
validateDisplay: e(),
|
|
24
|
+
validator: e(),
|
|
25
|
+
reactions: e(),
|
|
26
|
+
content: e(),
|
|
27
|
+
data: e()
|
|
28
|
+
}, i = {
|
|
29
|
+
name: e({ required: !0 }),
|
|
30
|
+
title: e(),
|
|
31
|
+
description: e(),
|
|
32
|
+
basePath: e(),
|
|
33
|
+
decorator: e(),
|
|
34
|
+
component: e(),
|
|
35
|
+
display: e(),
|
|
36
|
+
pattern: e(),
|
|
37
|
+
hidden: t(),
|
|
38
|
+
visible: t(),
|
|
39
|
+
editable: t(),
|
|
40
|
+
disabled: t(),
|
|
41
|
+
readOnly: t(),
|
|
42
|
+
readPretty: t(),
|
|
43
|
+
reactions: e(),
|
|
44
|
+
content: e(),
|
|
45
|
+
data: e()
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
r as fieldProps,
|
|
49
|
+
i as voidFieldProps
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=fieldProps.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fieldProps.mjs","sources":["../../src/utils/fieldProps.ts"],"sourcesContent":["import type { ComponentObjectPropsOptions, ExtractPropTypes } from 'vue'\nimport type { IFieldProps, IVoidFieldProps } from '../types'\nimport { createBooleanProp, createProp } from './runtimeProps'\n\nexport const fieldProps = {\n name: createProp<IFieldProps['name']>({ required: true }),\n title: createProp<IFieldProps['title']>(),\n description: createProp<IFieldProps['description']>(),\n value: createProp<IFieldProps['value']>(),\n initialValue: createProp<IFieldProps['initialValue']>(),\n basePath: createProp<IFieldProps['basePath']>(),\n decorator: createProp<IFieldProps['decorator']>(),\n component: createProp<IFieldProps['component']>(),\n display: createProp<IFieldProps['display']>(),\n pattern: createProp<IFieldProps['pattern']>(),\n required: createBooleanProp(),\n validateFirst: createBooleanProp(),\n hidden: createBooleanProp(),\n visible: createBooleanProp(),\n editable: createBooleanProp(),\n disabled: createBooleanProp(),\n readOnly: createBooleanProp(),\n readPretty: createBooleanProp(),\n dataSource: createProp<IFieldProps['dataSource']>(),\n validatePattern: createProp<IFieldProps['validatePattern']>(),\n validateDisplay: createProp<IFieldProps['validateDisplay']>(),\n validator: createProp<IFieldProps['validator']>(),\n reactions: createProp<IFieldProps['reactions']>(),\n content: createProp<IFieldProps['content']>(),\n data: createProp<IFieldProps['data']>(),\n} as const satisfies ComponentObjectPropsOptions<IFieldProps>\n\nexport const voidFieldProps = {\n name: createProp<IVoidFieldProps['name']>({ required: true }),\n title: createProp<IVoidFieldProps['title']>(),\n description: createProp<IVoidFieldProps['description']>(),\n basePath: createProp<IVoidFieldProps['basePath']>(),\n decorator: createProp<IVoidFieldProps['decorator']>(),\n component: createProp<IVoidFieldProps['component']>(),\n display: createProp<IVoidFieldProps['display']>(),\n pattern: createProp<IVoidFieldProps['pattern']>(),\n hidden: createBooleanProp(),\n visible: createBooleanProp(),\n editable: createBooleanProp(),\n disabled: createBooleanProp(),\n readOnly: createBooleanProp(),\n readPretty: createBooleanProp(),\n reactions: createProp<IVoidFieldProps['reactions']>(),\n content: createProp<IVoidFieldProps['content']>(),\n data: createProp<IVoidFieldProps['data']>(),\n} as const satisfies ComponentObjectPropsOptions<IVoidFieldProps>\n\nexport type FieldProps = ExtractPropTypes<typeof fieldProps>\nexport type VoidFieldProps = ExtractPropTypes<typeof voidFieldProps>\n"],"names":["fieldProps","createProp","createBooleanProp","voidFieldProps"],"mappings":";AAIO,MAAMA,IAAa;AAAA,EACxB,MAAMC,EAAgC,EAAE,UAAU,IAAM;AAAA,EACxD,OAAOA,EAAA;AAAA,EACP,aAAaA,EAAA;AAAA,EACb,OAAOA,EAAA;AAAA,EACP,cAAcA,EAAA;AAAA,EACd,UAAUA,EAAA;AAAA,EACV,WAAWA,EAAA;AAAA,EACX,WAAWA,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,SAASA,EAAA;AAAA,EACT,UAAUC,EAAA;AAAA,EACV,eAAeA,EAAA;AAAA,EACf,QAAQA,EAAA;AAAA,EACR,SAASA,EAAA;AAAA,EACT,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,YAAYA,EAAA;AAAA,EACZ,YAAYD,EAAA;AAAA,EACZ,iBAAiBA,EAAA;AAAA,EACjB,iBAAiBA,EAAA;AAAA,EACjB,WAAWA,EAAA;AAAA,EACX,WAAWA,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,MAAMA,EAAA;AACR,GAEaE,IAAiB;AAAA,EAC5B,MAAMF,EAAoC,EAAE,UAAU,IAAM;AAAA,EAC5D,OAAOA,EAAA;AAAA,EACP,aAAaA,EAAA;AAAA,EACb,UAAUA,EAAA;AAAA,EACV,WAAWA,EAAA;AAAA,EACX,WAAWA,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,SAASA,EAAA;AAAA,EACT,QAAQC,EAAA;AAAA,EACR,SAASA,EAAA;AAAA,EACT,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,UAAUA,EAAA;AAAA,EACV,YAAYA,EAAA;AAAA,EACZ,WAAWD,EAAA;AAAA,EACX,SAASA,EAAA;AAAA,EACT,MAAMA,EAAA;AACR;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
import { IFieldProps } from '../types';
|
|
3
|
+
type ComponentLikeProps = Pick<IFieldProps<Component, Component>, 'component' | 'decorator'>;
|
|
4
|
+
export declare function getRawComponent(props: ComponentLikeProps): {
|
|
5
|
+
component: import('@formily/core').FieldComponent<Component, any>;
|
|
6
|
+
decorator: import('@formily/core').FieldDecorator<Component, any>;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { toRaw as n } from "vue";
|
|
2
|
+
function i(a) {
|
|
3
|
+
const { component: o, decorator: r } = a;
|
|
4
|
+
let t, e;
|
|
5
|
+
return Array.isArray(o) && (t = [n(o[0]), o[1]]), Array.isArray(r) && (e = [n(r[0]), r[1]]), {
|
|
6
|
+
component: t ?? o,
|
|
7
|
+
decorator: e ?? r
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
i as getRawComponent
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=getRawComponent.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRawComponent.mjs","sources":["../../src/utils/getRawComponent.ts"],"sourcesContent":["import type { Component } from 'vue'\nimport type { IFieldProps } from '../types'\nimport { toRaw } from 'vue'\n\ntype ComponentLikeProps = Pick<IFieldProps<Component, Component>, 'component' | 'decorator'>\n\nexport function getRawComponent(props: ComponentLikeProps) {\n const { component, decorator } = props\n let newComponent: typeof component | undefined\n let newDecorator: typeof decorator | undefined\n if (Array.isArray(component)) {\n newComponent = [toRaw(component[0]), component[1]]\n }\n if (Array.isArray(decorator)) {\n newDecorator = [toRaw(decorator[0]), decorator[1]]\n }\n return {\n component: newComponent ?? component,\n decorator: newDecorator ?? decorator,\n }\n}\n"],"names":["getRawComponent","props","component","decorator","newComponent","newDecorator","toRaw"],"mappings":";AAMO,SAASA,EAAgBC,GAA2B;AACzD,QAAM,EAAE,WAAAC,GAAW,WAAAC,EAAA,IAAcF;AACjC,MAAIG,GACAC;AACJ,SAAI,MAAM,QAAQH,CAAS,MACzBE,IAAe,CAACE,EAAMJ,EAAU,CAAC,CAAC,GAAGA,EAAU,CAAC,CAAC,IAE/C,MAAM,QAAQC,CAAS,MACzBE,IAAe,CAACC,EAAMH,EAAU,CAAC,CAAC,GAAGA,EAAU,CAAC,CAAC,IAE5C;AAAA,IACL,WAAWC,KAAgBF;AAAA,IAC3B,WAAWG,KAAgBF;AAAA,EAAA;AAE/B;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GeneralField } from '@formily/core';
|
|
2
|
+
import { Component, Slots, VNode } from 'vue';
|
|
3
|
+
type SlotContent = string | Component | null | undefined;
|
|
4
|
+
type SlotContentMap = Record<string, SlotContent>;
|
|
5
|
+
type FieldContent = SlotContent | SlotContentMap | null | undefined;
|
|
6
|
+
type EventHandler = (...args: unknown[]) => unknown;
|
|
7
|
+
type EventMap = Partial<Record<string, EventHandler>>;
|
|
8
|
+
type Attrs = Record<string, unknown>;
|
|
9
|
+
export declare function wrapFragment(childNodes?: VNode[] | VNode | null): VNode | null;
|
|
10
|
+
export declare function mergeSlots(field: GeneralField, slots: Slots, content: FieldContent): Slots;
|
|
11
|
+
export declare function extractAttrsAndEvents(rawAttrs?: Attrs): {
|
|
12
|
+
attrs: Attrs;
|
|
13
|
+
events: EventMap;
|
|
14
|
+
};
|
|
15
|
+
export declare function createVNodeProps(attrs: Attrs, events: EventMap): Attrs;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { createTextVNode as y, h as p, Fragment as h } from "vue";
|
|
2
|
+
const l = () => [];
|
|
3
|
+
function m(t) {
|
|
4
|
+
return t ? Array.isArray(t) ? t.map((n) => String(n)) : typeof t == "object" ? Object.keys(t) : null : null;
|
|
5
|
+
}
|
|
6
|
+
function b(t) {
|
|
7
|
+
return !t || typeof t == "string" ? null : m(t.props);
|
|
8
|
+
}
|
|
9
|
+
function j(t, n) {
|
|
10
|
+
if (!t)
|
|
11
|
+
return;
|
|
12
|
+
if (!n || !n.length)
|
|
13
|
+
return t;
|
|
14
|
+
const r = {};
|
|
15
|
+
if (n.forEach((e) => {
|
|
16
|
+
e in t && (r[e] = t[e]);
|
|
17
|
+
}), !!Object.keys(r).length)
|
|
18
|
+
return r;
|
|
19
|
+
}
|
|
20
|
+
function g(t) {
|
|
21
|
+
if (typeof t != "object" || t === null)
|
|
22
|
+
return !1;
|
|
23
|
+
const n = t;
|
|
24
|
+
return typeof n.template == "string" || typeof n.render == "function" || typeof n.setup == "function";
|
|
25
|
+
}
|
|
26
|
+
function E(t) {
|
|
27
|
+
return typeof t != "object" || t === null ? !1 : !g(t);
|
|
28
|
+
}
|
|
29
|
+
function A(t) {
|
|
30
|
+
return t ? Array.isArray(t) ? t.length === 0 ? null : t.length === 1 ? t[0] ?? null : p(h, null, t) : t : null;
|
|
31
|
+
}
|
|
32
|
+
function a(t, n) {
|
|
33
|
+
if (n == null)
|
|
34
|
+
return t;
|
|
35
|
+
if (typeof n == "string")
|
|
36
|
+
return () => [...t(), y(n)];
|
|
37
|
+
const r = n, e = b(r);
|
|
38
|
+
return typeof r == "function" && r.length > 1 || g(r) && typeof r.render == "function" && r.render.length > 1 || !!(e && e.length) ? (u) => [
|
|
39
|
+
...t(),
|
|
40
|
+
p(r, j(u, e) ?? {})
|
|
41
|
+
] : () => [...t(), p(r)];
|
|
42
|
+
}
|
|
43
|
+
function P(t, n, r) {
|
|
44
|
+
const e = Object.keys(n);
|
|
45
|
+
if (!e.length) {
|
|
46
|
+
if (!r)
|
|
47
|
+
return {};
|
|
48
|
+
if (typeof r == "string")
|
|
49
|
+
return {
|
|
50
|
+
default: a(l, r)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const s = (o) => (...f) => {
|
|
54
|
+
const i = f[0], c = typeof i == "object" && i !== null ? i : {};
|
|
55
|
+
return n[o]?.({ field: t, form: t.form, ...c }) ?? [];
|
|
56
|
+
}, u = {};
|
|
57
|
+
return e.forEach((o) => {
|
|
58
|
+
u[o] = s(o);
|
|
59
|
+
}), E(r) ? (Object.keys(r).forEach((o) => {
|
|
60
|
+
const f = r[o], i = u[o] ?? l;
|
|
61
|
+
u[o] = a(i, f);
|
|
62
|
+
}), u) : (u.default = a(u.default ?? l, r), u);
|
|
63
|
+
}
|
|
64
|
+
function d(t) {
|
|
65
|
+
if (t.length <= 2)
|
|
66
|
+
return "";
|
|
67
|
+
const n = t.slice(2);
|
|
68
|
+
return n.charAt(0).toLowerCase() + n.slice(1);
|
|
69
|
+
}
|
|
70
|
+
function O(t) {
|
|
71
|
+
return t ? `on${t.charAt(0).toUpperCase()}${t.slice(1)}` : "";
|
|
72
|
+
}
|
|
73
|
+
function C(t = {}) {
|
|
74
|
+
const n = { ...t }, r = {};
|
|
75
|
+
return Object.keys(t).forEach((e) => {
|
|
76
|
+
const s = t[e], u = e.startsWith("on"), o = e.startsWith("@");
|
|
77
|
+
if (!u && !o)
|
|
78
|
+
return;
|
|
79
|
+
if (o) {
|
|
80
|
+
const i = e.slice(1);
|
|
81
|
+
delete n[e], typeof s == "function" && (r[i] = s);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const f = d(e);
|
|
85
|
+
f && (!r[f] && typeof s == "function" && (r[f] = s), delete n[e]);
|
|
86
|
+
}), { attrs: n, events: r };
|
|
87
|
+
}
|
|
88
|
+
function k(t, n) {
|
|
89
|
+
const { style: r, class: e, ...s } = t, u = Object.keys(n).reduce((o, f) => {
|
|
90
|
+
const i = O(f), c = n[f];
|
|
91
|
+
return i && c && (o[i] = c), o;
|
|
92
|
+
}, {});
|
|
93
|
+
return {
|
|
94
|
+
...s,
|
|
95
|
+
style: r,
|
|
96
|
+
class: e,
|
|
97
|
+
...u
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
k as createVNodeProps,
|
|
102
|
+
C as extractAttrsAndEvents,
|
|
103
|
+
P as mergeSlots,
|
|
104
|
+
A as wrapFragment
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=reactiveFieldHelpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reactiveFieldHelpers.mjs","sources":["../../src/utils/reactiveFieldHelpers.ts"],"sourcesContent":["import type { GeneralField } from '@formily/core'\nimport type { Component, Slot, Slots, VNode } from 'vue'\nimport { createTextVNode, Fragment, h } from 'vue'\n\ninterface VueLikeOptions {\n template?: string\n render?: (...args: unknown[]) => unknown\n setup?: (...args: unknown[]) => unknown\n}\n\ntype SlotContent = string | Component | null | undefined\ntype SlotContentMap = Record<string, SlotContent>\ntype FieldContent = SlotContent | SlotContentMap | null | undefined\n\ntype EventHandler = (...args: unknown[]) => unknown\ntype EventMap = Partial<Record<string, EventHandler>>\ntype Attrs = Record<string, unknown>\n\nconst EMPTY_SLOT: Slot = () => []\n\ntype ComponentWithProps = Component & { props?: unknown }\n\nfunction normalizePropKeys(propsDef: unknown): string[] | null {\n if (!propsDef)\n return null\n if (Array.isArray(propsDef))\n return propsDef.map(key => String(key))\n if (typeof propsDef === 'object')\n return Object.keys(propsDef as Record<string, unknown>)\n return null\n}\n\nfunction extractComponentPropKeys(component: SlotContent): string[] | null {\n if (!component || typeof component === 'string')\n return null\n const target = component as ComponentWithProps\n return normalizePropKeys(target.props)\n}\n\nfunction pickScopedProps(\n scopedProps: Record<string, unknown> | undefined,\n propKeys: string[] | null | undefined,\n) {\n if (!scopedProps)\n return undefined\n if (!propKeys || !propKeys.length)\n return scopedProps\n const picked: Record<string, unknown> = {}\n propKeys.forEach((key) => {\n if (key in scopedProps)\n picked[key] = scopedProps[key]\n })\n if (!Object.keys(picked).length)\n return undefined\n return picked\n}\n\nfunction isVueOptions(options: unknown): options is VueLikeOptions {\n if (typeof options !== 'object' || options === null) {\n return false\n }\n const candidates = options as Record<string, unknown>\n return (\n typeof candidates.template === 'string'\n || typeof candidates.render === 'function'\n || typeof candidates.setup === 'function'\n )\n}\n\nfunction isSlotContentMap(content: unknown): content is SlotContentMap {\n if (typeof content !== 'object' || content === null) {\n return false\n }\n return !isVueOptions(content)\n}\n\nexport function wrapFragment(childNodes?: VNode[] | VNode | null): VNode | null {\n if (!childNodes) {\n return null\n }\n if (!Array.isArray(childNodes)) {\n return childNodes\n }\n if (childNodes.length === 0) {\n return null\n }\n if (childNodes.length === 1) {\n return childNodes[0] ?? null\n }\n return h(Fragment, null, childNodes)\n}\n\nfunction resolveComponent(render: Slot, extra?: SlotContent): Slot {\n if (extra === undefined || extra === null) {\n return render\n }\n if (typeof extra === 'string') {\n return () => [...render(), createTextVNode(extra)]\n }\n\n const component = extra\n const propKeys = extractComponentPropKeys(component)\n const needsScopedProps\n = (typeof component === 'function' && component.length > 1)\n || (isVueOptions(component)\n && typeof component.render === 'function'\n && component.render.length > 1)\n || !!(propKeys && propKeys.length)\n\n if (needsScopedProps) {\n return (scopedProps?: Record<string, unknown>) => [\n ...render(),\n h(component, pickScopedProps(scopedProps, propKeys) ?? {}),\n ]\n }\n\n return () => [...render(), h(component)]\n}\n\nexport function mergeSlots(field: GeneralField, slots: Slots, content: FieldContent): Slots {\n const slotNames = Object.keys(slots)\n if (!slotNames.length) {\n if (!content) {\n return {}\n }\n if (typeof content === 'string') {\n return {\n default: resolveComponent(EMPTY_SLOT, content),\n }\n }\n }\n const patchSlot\n = (slotName: string): Slot =>\n (...originArgs: Parameters<Slot>) => {\n const firstArg = originArgs[0]\n const scopedProps\n = typeof firstArg === 'object' && firstArg !== null\n ? (firstArg as Record<string, unknown>)\n : {}\n return slots[slotName]?.({ field, form: field.form, ...scopedProps }) ?? []\n }\n\n const patchedSlots: Record<string, Slot> = {}\n slotNames.forEach((name) => {\n patchedSlots[name] = patchSlot(name)\n })\n\n if (isSlotContentMap(content)) {\n Object.keys(content).forEach((key) => {\n const child = content[key]\n const slot = patchedSlots[key] ?? EMPTY_SLOT\n patchedSlots[key] = resolveComponent(slot, child)\n })\n return patchedSlots\n }\n patchedSlots.default = resolveComponent(patchedSlots.default ?? EMPTY_SLOT, content)\n return patchedSlots\n}\n\nfunction normalizeOnEventName(eventKey: string) {\n if (eventKey.length <= 2)\n return ''\n const rawName = eventKey.slice(2)\n return rawName.charAt(0).toLowerCase() + rawName.slice(1)\n}\n\nfunction toEventPropKey(eventName: string) {\n if (!eventName)\n return ''\n return `on${eventName.charAt(0).toUpperCase()}${eventName.slice(1)}`\n}\n\nexport function extractAttrsAndEvents(rawAttrs: Attrs = {}): { attrs: Attrs, events: EventMap } {\n const normalizedAttrs: Attrs = { ...rawAttrs }\n const events: EventMap = {}\n\n Object.keys(rawAttrs).forEach((eventKey) => {\n const value = rawAttrs[eventKey]\n const onEvent = eventKey.startsWith('on')\n const atEvent = eventKey.startsWith('@')\n if (!onEvent && !atEvent)\n return\n if (atEvent) {\n const eventName = eventKey.slice(1)\n delete normalizedAttrs[eventKey]\n if (typeof value === 'function') {\n events[eventName] = value as EventHandler\n }\n return\n }\n const eventName = normalizeOnEventName(eventKey)\n if (!eventName)\n return\n if (!events[eventName] && typeof value === 'function') {\n events[eventName] = value as EventHandler\n }\n delete normalizedAttrs[eventKey]\n })\n\n return { attrs: normalizedAttrs, events }\n}\n\nexport function createVNodeProps(attrs: Attrs, events: EventMap): Attrs {\n const { style, class: className, ...rest } = attrs\n const eventProps = Object.keys(events).reduce<Record<string, EventHandler>>((acc, eventName) => {\n const propKey = toEventPropKey(eventName)\n const handler = events[eventName]\n if (propKey && handler) {\n acc[propKey] = handler\n }\n return acc\n }, {})\n\n return {\n ...rest,\n style,\n class: className,\n ...eventProps,\n }\n}\n"],"names":["EMPTY_SLOT","normalizePropKeys","propsDef","key","extractComponentPropKeys","component","pickScopedProps","scopedProps","propKeys","picked","isVueOptions","options","candidates","isSlotContentMap","content","wrapFragment","childNodes","h","Fragment","resolveComponent","render","extra","createTextVNode","mergeSlots","field","slots","slotNames","patchSlot","slotName","originArgs","firstArg","patchedSlots","name","child","slot","normalizeOnEventName","eventKey","rawName","toEventPropKey","eventName","extractAttrsAndEvents","rawAttrs","normalizedAttrs","events","value","onEvent","atEvent","createVNodeProps","attrs","style","className","rest","eventProps","acc","propKey","handler"],"mappings":";AAkBA,MAAMA,IAAmB,MAAM,CAAA;AAI/B,SAASC,EAAkBC,GAAoC;AAC7D,SAAKA,IAED,MAAM,QAAQA,CAAQ,IACjBA,EAAS,IAAI,CAAAC,MAAO,OAAOA,CAAG,CAAC,IACpC,OAAOD,KAAa,WACf,OAAO,KAAKA,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IACH,OAAAF;AAAA,IACA,OAAOC;AAAA,IACP,GAAGE;AAAA,EAAA;AAEP;"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { ExtractPropTypes } from 'vue';
|
|
2
|
+
export declare const recursionFieldProps: {
|
|
3
|
+
readonly schema: import('./runtimeProps').RuntimeProp<import('@formily/json-schema').Stringify<{
|
|
4
|
+
[key: symbol]: any;
|
|
5
|
+
[key: `x-${string}`]: any;
|
|
6
|
+
[key: `x-${number}`]: any;
|
|
7
|
+
version?: string;
|
|
8
|
+
name?: import('@formily/json-schema').SchemaKey;
|
|
9
|
+
title?: any;
|
|
10
|
+
description?: any;
|
|
11
|
+
default?: any;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
writeOnly?: boolean;
|
|
14
|
+
type?: import('@formily/json-schema').SchemaTypes;
|
|
15
|
+
enum?: import('@formily/json-schema').SchemaEnum<any>;
|
|
16
|
+
const?: any;
|
|
17
|
+
multipleOf?: number;
|
|
18
|
+
maximum?: number;
|
|
19
|
+
exclusiveMaximum?: number;
|
|
20
|
+
minimum?: number;
|
|
21
|
+
exclusiveMinimum?: number;
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
minLength?: number;
|
|
24
|
+
pattern?: string | RegExp;
|
|
25
|
+
maxItems?: number;
|
|
26
|
+
minItems?: number;
|
|
27
|
+
uniqueItems?: boolean;
|
|
28
|
+
maxProperties?: number;
|
|
29
|
+
minProperties?: number;
|
|
30
|
+
required?: string[] | boolean | string;
|
|
31
|
+
format?: string;
|
|
32
|
+
$ref?: string;
|
|
33
|
+
$namespace?: string;
|
|
34
|
+
definitions?: import('@formily/json-schema').SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
35
|
+
properties?: import('@formily/json-schema').SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
36
|
+
items?: import('@formily/json-schema').SchemaItems<any, any, any, any, any, any, any, any>;
|
|
37
|
+
additionalItems?: import('@formily/json-schema').Stringify</*elided*/ any>;
|
|
38
|
+
patternProperties?: import('@formily/json-schema').SchemaProperties<any, any, any, any, any, any, any, any>;
|
|
39
|
+
additionalProperties?: import('@formily/json-schema').Stringify</*elided*/ any>;
|
|
40
|
+
"x-value"?: any;
|
|
41
|
+
"x-index"?: number;
|
|
42
|
+
"x-pattern"?: any;
|
|
43
|
+
"x-display"?: any;
|
|
44
|
+
"x-validator"?: any;
|
|
45
|
+
"x-decorator"?: any;
|
|
46
|
+
"x-decorator-props"?: any;
|
|
47
|
+
"x-component"?: any;
|
|
48
|
+
"x-component-props"?: any;
|
|
49
|
+
"x-reactions"?: import('@formily/json-schema').SchemaReactions<any>;
|
|
50
|
+
"x-content"?: any;
|
|
51
|
+
"x-data"?: any;
|
|
52
|
+
"x-visible"?: boolean;
|
|
53
|
+
"x-hidden"?: boolean;
|
|
54
|
+
"x-disabled"?: boolean;
|
|
55
|
+
"x-editable"?: boolean;
|
|
56
|
+
"x-read-only"?: boolean;
|
|
57
|
+
"x-read-pretty"?: boolean;
|
|
58
|
+
"x-compile-omitted"?: string[];
|
|
59
|
+
}> | import('@formily/json-schema').Schema<any, any, any, any, any, any, any, any, any>>;
|
|
60
|
+
readonly name: import('./runtimeProps').RuntimeProp<import('@formily/json-schema').SchemaKey>;
|
|
61
|
+
readonly basePath: import('./runtimeProps').RuntimeProp<import('@formily/shared').FormPathPattern>;
|
|
62
|
+
readonly onlyRenderProperties: import('./runtimeProps').RuntimeProp<boolean>;
|
|
63
|
+
readonly onlyRenderSelf: import('./runtimeProps').RuntimeProp<boolean>;
|
|
64
|
+
readonly mapProperties: import('./runtimeProps').RuntimeProp<import('..').ISchemaMapper>;
|
|
65
|
+
readonly filterProperties: import('./runtimeProps').RuntimeProp<import('..').ISchemaFilter>;
|
|
66
|
+
};
|
|
67
|
+
export type RecursionFieldProps = ExtractPropTypes<typeof recursionFieldProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createProp as e, createBooleanProp as r } from "./runtimeProps.mjs";
|
|
2
|
+
const t = {
|
|
3
|
+
schema: e({ required: !0 }),
|
|
4
|
+
name: e(),
|
|
5
|
+
basePath: e(),
|
|
6
|
+
onlyRenderProperties: r(),
|
|
7
|
+
onlyRenderSelf: r(),
|
|
8
|
+
mapProperties: e(),
|
|
9
|
+
filterProperties: e()
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
t as recursionFieldProps
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=recursionFieldProps.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recursionFieldProps.mjs","sources":["../../src/utils/recursionFieldProps.ts"],"sourcesContent":["import type { ComponentObjectPropsOptions, ExtractPropTypes } from 'vue'\nimport type { IRecursionFieldProps } from '../types'\nimport { createBooleanProp, createProp } from './runtimeProps'\n\nexport const recursionFieldProps = {\n schema: createProp<IRecursionFieldProps['schema']>({ required: true }),\n name: createProp<IRecursionFieldProps['name']>(),\n basePath: createProp<IRecursionFieldProps['basePath']>(),\n onlyRenderProperties: createBooleanProp(),\n onlyRenderSelf: createBooleanProp(),\n mapProperties: createProp<IRecursionFieldProps['mapProperties']>(),\n filterProperties: createProp<IRecursionFieldProps['filterProperties']>(),\n} as const satisfies ComponentObjectPropsOptions<IRecursionFieldProps>\n\nexport type RecursionFieldProps = ExtractPropTypes<typeof recursionFieldProps>\n"],"names":["recursionFieldProps","createProp","createBooleanProp"],"mappings":";AAIO,MAAMA,IAAsB;AAAA,EACjC,QAAQC,EAA2C,EAAE,UAAU,IAAM;AAAA,EACrE,MAAMA,EAAA;AAAA,EACN,UAAUA,EAAA;AAAA,EACV,sBAAsBC,EAAA;AAAA,EACtB,gBAAgBA,EAAA;AAAA,EAChB,eAAeD,EAAA;AAAA,EACf,kBAAkBA,EAAA;AACpB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveSchemaProps(props: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { paramCase as o } from "@formily/shared";
|
|
2
|
+
function s(r) {
|
|
3
|
+
const n = {};
|
|
4
|
+
return Object.keys(r).forEach((e) => {
|
|
5
|
+
e.indexOf("x") === 0 && !e.includes("x-") ? n[o(e)] = r[e] : n[e] = r[e];
|
|
6
|
+
}), n;
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
s as resolveSchemaProps
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=resolveSchemaProps.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveSchemaProps.mjs","sources":["../../src/utils/resolveSchemaProps.ts"],"sourcesContent":["import { paramCase } from '@formily/shared'\n\nexport function resolveSchemaProps(props: Record<string, unknown>) {\n const newProps = {} as Record<string, unknown>\n Object.keys(props).forEach((key) => {\n if (key.indexOf('x') === 0 && !key.includes('x-')) {\n newProps[paramCase(key)] = props[key]\n }\n else {\n newProps[key] = props[key]\n }\n })\n return newProps\n}\n"],"names":["resolveSchemaProps","props","newProps","key","paramCase"],"mappings":";AAEO,SAASA,EAAmBC,GAAgC;AACjE,QAAMC,IAAW,CAAA;AACjB,gBAAO,KAAKD,CAAK,EAAE,QAAQ,CAACE,MAAQ;AAClC,IAAIA,EAAI,QAAQ,GAAG,MAAM,KAAK,CAACA,EAAI,SAAS,IAAI,IAC9CD,EAASE,EAAUD,CAAG,CAAC,IAAIF,EAAME,CAAG,IAGpCD,EAASC,CAAG,IAAIF,EAAME,CAAG;AAAA,EAE7B,CAAC,GACMD;AACT;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
export interface RuntimeProp<T> {
|
|
3
|
+
type: PropType<T> | null;
|
|
4
|
+
required?: boolean;
|
|
5
|
+
default?: T | (() => T);
|
|
6
|
+
}
|
|
7
|
+
export declare function createProp<T>(options?: Partial<RuntimeProp<T>>): RuntimeProp<T>;
|
|
8
|
+
export declare function createBooleanProp(): RuntimeProp<boolean>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
function t(e = {}) {
|
|
2
|
+
return {
|
|
3
|
+
type: e.type ?? null,
|
|
4
|
+
...e
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
function r() {
|
|
8
|
+
return t({
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: void 0
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
r as createBooleanProp,
|
|
15
|
+
t as createProp
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=runtimeProps.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeProps.mjs","sources":["../../src/utils/runtimeProps.ts"],"sourcesContent":["import type { PropType } from 'vue'\n\nexport interface RuntimeProp<T> {\n type: PropType<T> | null\n required?: boolean\n default?: T | (() => T)\n}\n\nexport function createProp<T>(options: Partial<RuntimeProp<T>> = {}): RuntimeProp<T> {\n return {\n type: options.type ?? (null as unknown as PropType<T>),\n ...options,\n }\n}\n\nexport function createBooleanProp() {\n return createProp<boolean>({\n type: Boolean as PropType<boolean>,\n default: undefined,\n })\n}\n"],"names":["createProp","options","createBooleanProp"],"mappings":"AAQO,SAASA,EAAcC,IAAmC,IAAoB;AACnF,SAAO;AAAA,IACL,MAAMA,EAAQ,QAAS;AAAA,IACvB,GAAGA;AAAA,EAAA;AAEP;AAEO,SAASC,IAAoB;AAClC,SAAOF,EAAoB;AAAA,IACzB,MAAM;AAAA,IACN,SAAS;AAAA,EAAA,CACV;AACH;"}
|