@silver-formily/vue 2.3.2 → 2.3.4
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 +6 -6
- package/README.md +6 -6
- package/esm/components/ArrayField.d.ts +67 -58
- package/esm/components/ArrayField.mjs +23 -23
- package/esm/components/ArrayField.mjs.map +1 -1
- package/esm/components/ExpressionScope.d.ts +21 -16
- package/esm/components/ExpressionScope.mjs +22 -24
- package/esm/components/ExpressionScope.mjs.map +1 -1
- package/esm/components/Field.d.ts +67 -58
- package/esm/components/Field.mjs +23 -23
- package/esm/components/Field.mjs.map +1 -1
- package/esm/components/FormConsumer.d.ts +9 -4
- package/esm/components/FormConsumer.mjs +17 -18
- package/esm/components/FormConsumer.mjs.map +1 -1
- package/esm/components/FormProvider.d.ts +21 -16
- package/esm/components/FormProvider.mjs +26 -26
- package/esm/components/FormProvider.mjs.map +1 -1
- package/esm/components/ObjectField.d.ts +68 -58
- package/esm/components/ObjectField.mjs +23 -23
- package/esm/components/ObjectField.mjs.map +1 -1
- package/esm/components/ReactiveField.mjs +103 -75
- package/esm/components/ReactiveField.mjs.map +1 -1
- package/esm/components/RecursionField.d.ts +142 -22
- package/esm/components/RecursionField.mjs +123 -127
- package/esm/components/RecursionField.mjs.map +1 -1
- package/esm/components/SchemaField.d.ts +3041 -2919
- package/esm/components/SchemaField.mjs +104 -97
- package/esm/components/SchemaField.mjs.map +1 -1
- package/esm/components/VoidField.d.ts +48 -42
- package/esm/components/VoidField.mjs +23 -23
- package/esm/components/VoidField.mjs.map +1 -1
- package/esm/components/index.d.ts +9 -9
- package/esm/components/index.mjs +10 -21
- package/esm/hooks/index.d.ts +5 -5
- package/esm/hooks/index.mjs +6 -13
- package/esm/hooks/useAttach.mjs +21 -13
- package/esm/hooks/useAttach.mjs.map +1 -1
- package/esm/hooks/useField.d.ts +8 -3
- package/esm/hooks/useField.mjs +9 -8
- package/esm/hooks/useField.mjs.map +1 -1
- package/esm/hooks/useFieldSchema.d.ts +8 -1
- package/esm/hooks/useFieldSchema.mjs +9 -8
- package/esm/hooks/useFieldSchema.mjs.map +1 -1
- package/esm/hooks/useForm.d.ts +8 -3
- package/esm/hooks/useForm.mjs +9 -8
- package/esm/hooks/useForm.mjs.map +1 -1
- package/esm/hooks/useFormEffects.d.ts +7 -2
- package/esm/hooks/useFormEffects.mjs +18 -15
- package/esm/hooks/useFormEffects.mjs.map +1 -1
- package/esm/hooks/useInjectionCleaner.mjs +8 -7
- package/esm/hooks/useInjectionCleaner.mjs.map +1 -1
- package/esm/hooks/useParentForm.d.ts +8 -3
- package/esm/hooks/useParentForm.mjs +18 -11
- package/esm/hooks/useParentForm.mjs.map +1 -1
- package/esm/index.d.ts +19 -4
- package/esm/index.mjs +20 -42
- package/esm/shared/connect.d.ts +10 -5
- package/esm/shared/connect.mjs +69 -63
- package/esm/shared/connect.mjs.map +1 -1
- package/esm/shared/context.d.ts +15 -10
- package/esm/shared/context.mjs +11 -10
- package/esm/shared/context.mjs.map +1 -1
- package/esm/shared/index.d.ts +2 -2
- package/esm/shared/index.mjs +3 -14
- package/esm/types/index.d.ts +72 -68
- package/esm/types/validator.d.ts +39 -35
- package/esm/utils/fieldProps.mjs +53 -51
- package/esm/utils/fieldProps.mjs.map +1 -1
- package/esm/utils/getRawComponent.mjs +16 -12
- package/esm/utils/getRawComponent.mjs.map +1 -1
- package/esm/utils/reactiveFieldHelpers.mjs +116 -94
- package/esm/utils/reactiveFieldHelpers.mjs.map +1 -1
- package/esm/utils/recursionFieldProps.mjs +14 -13
- package/esm/utils/recursionFieldProps.mjs.map +1 -1
- package/esm/utils/resolveSchemaProps.mjs +13 -10
- package/esm/utils/resolveSchemaProps.mjs.map +1 -1
- package/esm/utils/runtimeProps.d.ts +10 -7
- package/esm/utils/runtimeProps.mjs +15 -15
- package/esm/utils/runtimeProps.mjs.map +1 -1
- package/esm/utils/schemaFieldProps.mjs +63 -62
- package/esm/utils/schemaFieldProps.mjs.map +1 -1
- package/package.json +13 -12
- package/esm/components/ReactiveField.d.ts +0 -16
- package/esm/components/index.mjs.map +0 -1
- package/esm/global.d.d.ts +0 -1
- package/esm/global.d.mjs +0 -2
- package/esm/global.d.mjs.map +0 -1
- package/esm/hooks/index.mjs.map +0 -1
- package/esm/hooks/useAttach.d.ts +0 -7
- package/esm/hooks/useInjectionCleaner.d.ts +0 -2
- package/esm/index.mjs.map +0 -1
- package/esm/shared/index.mjs.map +0 -1
- package/esm/types/index.mjs +0 -2
- package/esm/types/index.mjs.map +0 -1
- package/esm/types/validator.mjs +0 -2
- package/esm/types/validator.mjs.map +0 -1
- package/esm/utils/fieldProps.d.ts +0 -51
- package/esm/utils/getRawComponent.d.ts +0 -8
- package/esm/utils/reactiveFieldHelpers.d.ts +0 -16
- package/esm/utils/recursionFieldProps.d.ts +0 -67
- package/esm/utils/resolveSchemaProps.d.ts +0 -1
- package/esm/utils/schemaFieldProps.d.ts +0 -232
package/esm/types/index.d.ts
CHANGED
|
@@ -1,87 +1,91 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { IValidateResult, IValidatorRules, MultiValidator, Validator, ValidatorFunction, ValidatorFunctionResponse } from "./validator.js";
|
|
2
|
+
import { Component } from "vue";
|
|
3
|
+
import { Field, FieldDisplayTypes, Form, FormPatternTypes, GeneralField, IFieldFactoryProps, IFieldProps, IVoidFieldFactoryProps } from "@formily/core";
|
|
4
|
+
import { FormPathPattern } from "@formily/shared";
|
|
5
|
+
import { ISchema, Schema, SchemaKey } from "@formily/json-schema";
|
|
6
|
+
|
|
7
|
+
//#region src/types/index.d.ts
|
|
8
|
+
type SchemaFieldValidator = Validator;
|
|
9
|
+
type SchemaValidatorFunction = ValidatorFunction<any>;
|
|
10
|
+
type SchemaValidatorRules = IValidatorRules<any>;
|
|
11
|
+
type SchemaMultiValidator = MultiValidator<any>;
|
|
12
|
+
type SchemaValidateResult = IValidateResult;
|
|
13
|
+
type SchemaValidatorResponse = ValidatorFunctionResponse;
|
|
14
|
+
interface VueComponentOptionsWithProps {
|
|
15
|
+
props: Record<string, unknown>;
|
|
14
16
|
}
|
|
15
17
|
type ComponentPropsOrRecord<T extends Component> = T extends VueComponentOptionsWithProps ? T['props'] : Record<string, unknown>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
type VueComponentProps<T extends Component> = ComponentPropsOrRecord<T> & Record<string, unknown>;
|
|
19
|
+
interface IProviderProps {
|
|
20
|
+
form: Form;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
interface IFieldProps$1<D extends Component = Component, C extends Component = Component, TextType = any, ValueType = any> extends Omit<IFieldProps<D, C, TextType, ValueType>, 'validator'> {
|
|
23
|
+
loading?: boolean;
|
|
24
|
+
validator?: SchemaFieldValidator;
|
|
25
|
+
decoratorContent?: any;
|
|
23
26
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
interface IFieldFactoryProps$1<D extends Component = Component, C extends Component = Component, TextType = any, ValueType = any> extends Omit<IFieldFactoryProps<D, C, TextType, ValueType>, 'validator'> {
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
validator?: SchemaFieldValidator;
|
|
30
|
+
decoratorContent?: any;
|
|
27
31
|
}
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
type IVoidFieldProps<D extends Component = Component, C extends Component = Component> = IVoidFieldFactoryProps<D, C> & {
|
|
33
|
+
decoratorContent?: any;
|
|
30
34
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
type IArrayFieldProps = IFieldProps$1;
|
|
36
|
+
type IObjectFieldProps = IFieldProps$1;
|
|
37
|
+
interface IReactiveFieldProps {
|
|
38
|
+
fieldType: 'Field' | 'ArrayField' | 'ObjectField' | 'VoidField';
|
|
39
|
+
fieldProps: IFieldProps$1 | IVoidFieldProps;
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
interface IComponentMapper<T extends Component = Component> {
|
|
42
|
+
(target: T): Component;
|
|
39
43
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
components?: Components;
|
|
47
|
-
scope?: SchemaExpressionScope;
|
|
44
|
+
type IStateMapper<Props> = { [key in keyof Field]?: keyof Props | boolean } | ((props: Props, field: GeneralField) => Props);
|
|
45
|
+
type SchemaVueComponents = Record<string, Component>;
|
|
46
|
+
type SchemaExpressionScope = Record<string, unknown>;
|
|
47
|
+
interface ISchemaFieldVueFactoryOptions<Components extends SchemaVueComponents = SchemaVueComponents> {
|
|
48
|
+
components?: Components;
|
|
49
|
+
scope?: SchemaExpressionScope;
|
|
48
50
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
interface ISchemaFieldProps extends Omit<IRecursionFieldProps, 'name' | 'schema'> {
|
|
52
|
+
schema?: ISchema;
|
|
53
|
+
components?: {
|
|
54
|
+
[key: string]: Component;
|
|
55
|
+
};
|
|
56
|
+
scope?: SchemaExpressionScope;
|
|
57
|
+
name?: SchemaKey;
|
|
56
58
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
interface ISchemaMapper {
|
|
60
|
+
(schema: Schema, name: SchemaKey): Schema;
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
interface ISchemaFilter {
|
|
63
|
+
(schema: Schema, name: SchemaKey): boolean;
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
65
|
+
interface IRecursionFieldProps {
|
|
66
|
+
schema: Schema | ISchema;
|
|
67
|
+
name?: SchemaKey;
|
|
68
|
+
basePath?: FormPathPattern;
|
|
69
|
+
onlyRenderProperties?: boolean;
|
|
70
|
+
onlyRenderSelf?: boolean;
|
|
71
|
+
mapProperties?: ISchemaMapper;
|
|
72
|
+
filterProperties?: ISchemaFilter;
|
|
71
73
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
type ComponentPath<T, Key extends keyof T = keyof T> = Key extends string ? Key : never;
|
|
75
|
+
type ComponentPropsByPathValue<T extends SchemaVueComponents, P extends ComponentPath<T>> = P extends keyof T ? VueComponentProps<T[P]> : never;
|
|
74
76
|
type SchemaContent<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message, ReactionField> = ISchema<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message, ReactionField>['x-content'];
|
|
75
77
|
type BaseSchemaMarkupFieldProps<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, SchemaFieldValidator, string, GeneralField> & {
|
|
76
|
-
|
|
78
|
+
'x-decorator-content'?: SchemaContent<Decorator, Component, ComponentPropsByPathValue<Components, Decorator>, ComponentPropsByPathValue<Components, Component>, FormPatternTypes, FieldDisplayTypes, SchemaFieldValidator, string, GeneralField>;
|
|
77
79
|
};
|
|
78
80
|
type SchemaMarkupFieldShape = ISchema<string, string, Record<string, unknown>, Record<string, unknown>, FormPatternTypes, FieldDisplayTypes, SchemaFieldValidator, string, GeneralField>;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
type SchemaMarkupValidator = SchemaMarkupFieldShape['x-validator'];
|
|
82
|
+
type ISchemaMarkupFieldProps<Components extends SchemaVueComponents = SchemaVueComponents, Decorator extends ComponentPath<Components> = ComponentPath<Components>, Component extends ComponentPath<Components> = ComponentPath<Components>> = Omit<BaseSchemaMarkupFieldProps<Components, Decorator, Component>, 'x-validator'> & {
|
|
83
|
+
'x-validator'?: SchemaMarkupValidator;
|
|
82
84
|
};
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
type ISchemaTypeFieldProps<Components extends SchemaVueComponents = SchemaVueComponents, Decorator extends ComponentPath<Components> = ComponentPath<Components>, Component extends ComponentPath<Components> = ComponentPath<Components>> = Omit<ISchemaMarkupFieldProps<Components, Decorator, Component>, 'type'>;
|
|
86
|
+
interface IExpressionScopeProps {
|
|
87
|
+
value: SchemaExpressionScope;
|
|
86
88
|
}
|
|
87
|
-
|
|
89
|
+
//#endregion
|
|
90
|
+
export { ComponentPath, ComponentPropsByPathValue, IArrayFieldProps, IComponentMapper, IExpressionScopeProps, IFieldFactoryProps$1 as IFieldFactoryProps, IFieldProps$1 as IFieldProps, IObjectFieldProps, IProviderProps, IReactiveFieldProps, IRecursionFieldProps, ISchemaFieldProps, ISchemaFieldVueFactoryOptions, ISchemaFilter, ISchemaMapper, ISchemaMarkupFieldProps, ISchemaTypeFieldProps, IStateMapper, IVoidFieldProps, SchemaExpressionScope, SchemaFieldValidator, SchemaMarkupValidator, SchemaMultiValidator, SchemaValidateResult, SchemaValidatorFunction, SchemaValidatorResponse, SchemaValidatorRules, SchemaVueComponents, VueComponentOptionsWithProps, VueComponentProps };
|
|
91
|
+
//# sourceMappingURL=index.d.ts.map
|
package/esm/types/validator.d.ts
CHANGED
|
@@ -1,69 +1,73 @@
|
|
|
1
|
+
//#region src/types/validator.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Supported built-in async-validator format keys; extend via `registerValidateFormats`.
|
|
3
4
|
* 支持的内置格式校验器字符串,可通过 `registerValidateFormats` 扩展。
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
|
+
type ValidatorFormats = 'url' | 'email' | 'ipv6' | 'ipv4' | 'number' | 'integer' | 'idcard' | 'qq' | 'phone' | 'money' | 'zh' | 'date' | 'zip' | (string & {});
|
|
6
7
|
/**
|
|
7
8
|
* Structured response object returned by function validators, with customizable `type`.
|
|
8
9
|
* 函数式校验器的结构化返回对象,允许自定义 `type`。
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
interface IValidateResult {
|
|
12
|
+
type: 'error' | 'warning' | 'success' | (string & {});
|
|
13
|
+
message: string;
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
16
|
* Union of all acceptable return values for a validator function.
|
|
16
17
|
* 函数式校验器可返回的联合类型。
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
type ValidatorFunctionResponse = null | string | boolean | IValidateResult;
|
|
19
20
|
/**
|
|
20
21
|
* Rule configuration object consumed by Formily validators.
|
|
21
22
|
* 与 Formily 核心一致的对象式校验规则配置。
|
|
22
23
|
*/
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
24
|
+
interface IValidatorRules<Context = any> {
|
|
25
|
+
triggerType?: 'onInput' | 'onFocus' | 'onBlur' | (string & {});
|
|
26
|
+
format?: ValidatorFormats;
|
|
27
|
+
validator?: ValidatorFunction<Context>;
|
|
28
|
+
required?: boolean;
|
|
29
|
+
pattern?: RegExp | string;
|
|
30
|
+
max?: number;
|
|
31
|
+
maximum?: number;
|
|
32
|
+
maxItems?: number;
|
|
33
|
+
minItems?: number;
|
|
34
|
+
maxLength?: number;
|
|
35
|
+
minLength?: number;
|
|
36
|
+
exclusiveMaximum?: number;
|
|
37
|
+
exclusiveMinimum?: number;
|
|
38
|
+
minimum?: number;
|
|
39
|
+
min?: number;
|
|
40
|
+
len?: number;
|
|
41
|
+
whitespace?: boolean;
|
|
42
|
+
enum?: any[];
|
|
43
|
+
const?: any;
|
|
44
|
+
multipleOf?: number;
|
|
45
|
+
uniqueItems?: boolean;
|
|
46
|
+
maxProperties?: number;
|
|
47
|
+
minProperties?: number;
|
|
48
|
+
message?: string;
|
|
49
|
+
[key: string]: any;
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
51
52
|
* Signature for function-style validators (sync or async) with `render` helper.
|
|
52
53
|
* 函数式校验器的签名,支持同步或异步返回并透传 `render` 辅助函数。
|
|
53
54
|
*/
|
|
54
|
-
|
|
55
|
+
type ValidatorFunction<Context = any> = (value: any, rule: IValidatorRules<Context>, ctx: Context, render: (message: string, scope?: any) => string) => ValidatorFunctionResponse | Promise<ValidatorFunctionResponse> | null;
|
|
55
56
|
/**
|
|
56
57
|
* Single `x-validator` entry: built-in format string, function, or rule object.
|
|
57
58
|
* 单个 `x-validator` 描述:内置格式字符串、函数或规则对象。
|
|
58
59
|
*/
|
|
59
|
-
|
|
60
|
+
type ValidatorDescription<Context = any> = ValidatorFormats | ValidatorFunction<Context> | IValidatorRules<Context>;
|
|
60
61
|
/**
|
|
61
62
|
* Ordered collection of validator descriptions executed in sequence.
|
|
62
63
|
* 以顺序执行的 `ValidatorDescription` 数组组合校验器。
|
|
63
64
|
*/
|
|
64
|
-
|
|
65
|
+
type MultiValidator<Context = any> = ValidatorDescription<Context>[];
|
|
65
66
|
/**
|
|
66
67
|
* Top-level union accepted by `x-validator`: single description or array combination.
|
|
67
68
|
* `x-validator` 参数可接受的最终联合类型:单个描述或描述数组。
|
|
68
69
|
*/
|
|
69
|
-
|
|
70
|
+
type Validator<Context = any> = ValidatorDescription<Context> | MultiValidator<Context>;
|
|
71
|
+
//#endregion
|
|
72
|
+
export { IValidateResult, IValidatorRules, MultiValidator, Validator, ValidatorFunction, ValidatorFunctionResponse };
|
|
73
|
+
//# sourceMappingURL=validator.d.ts.map
|
package/esm/utils/fieldProps.mjs
CHANGED
|
@@ -1,53 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
title: e(),
|
|
32
|
-
description: e(),
|
|
33
|
-
basePath: e(),
|
|
34
|
-
decorator: e(),
|
|
35
|
-
decoratorContent: e(),
|
|
36
|
-
component: e(),
|
|
37
|
-
display: e(),
|
|
38
|
-
pattern: e(),
|
|
39
|
-
hidden: t(),
|
|
40
|
-
visible: t(),
|
|
41
|
-
editable: t(),
|
|
42
|
-
disabled: t(),
|
|
43
|
-
readOnly: t(),
|
|
44
|
-
readPretty: t(),
|
|
45
|
-
reactions: e(),
|
|
46
|
-
content: e(),
|
|
47
|
-
data: e()
|
|
1
|
+
import { createBooleanProp, createProp } from "./runtimeProps.mjs";
|
|
2
|
+
//#region src/utils/fieldProps.ts
|
|
3
|
+
const fieldProps = {
|
|
4
|
+
name: createProp({ required: true }),
|
|
5
|
+
title: createProp(),
|
|
6
|
+
description: createProp(),
|
|
7
|
+
value: createProp(),
|
|
8
|
+
initialValue: createProp(),
|
|
9
|
+
basePath: createProp(),
|
|
10
|
+
decorator: createProp(),
|
|
11
|
+
decoratorContent: createProp(),
|
|
12
|
+
component: createProp(),
|
|
13
|
+
display: createProp(),
|
|
14
|
+
pattern: createProp(),
|
|
15
|
+
required: createBooleanProp(),
|
|
16
|
+
validateFirst: createBooleanProp(),
|
|
17
|
+
hidden: createBooleanProp(),
|
|
18
|
+
visible: createBooleanProp(),
|
|
19
|
+
editable: createBooleanProp(),
|
|
20
|
+
disabled: createBooleanProp(),
|
|
21
|
+
readOnly: createBooleanProp(),
|
|
22
|
+
readPretty: createBooleanProp(),
|
|
23
|
+
loading: createBooleanProp(),
|
|
24
|
+
dataSource: createProp(),
|
|
25
|
+
validatePattern: createProp(),
|
|
26
|
+
validateDisplay: createProp(),
|
|
27
|
+
validator: createProp(),
|
|
28
|
+
reactions: createProp(),
|
|
29
|
+
content: createProp(),
|
|
30
|
+
data: createProp()
|
|
48
31
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
const voidFieldProps = {
|
|
33
|
+
name: createProp({ required: true }),
|
|
34
|
+
title: createProp(),
|
|
35
|
+
description: createProp(),
|
|
36
|
+
basePath: createProp(),
|
|
37
|
+
decorator: createProp(),
|
|
38
|
+
decoratorContent: createProp(),
|
|
39
|
+
component: createProp(),
|
|
40
|
+
display: createProp(),
|
|
41
|
+
pattern: createProp(),
|
|
42
|
+
hidden: createBooleanProp(),
|
|
43
|
+
visible: createBooleanProp(),
|
|
44
|
+
editable: createBooleanProp(),
|
|
45
|
+
disabled: createBooleanProp(),
|
|
46
|
+
readOnly: createBooleanProp(),
|
|
47
|
+
readPretty: createBooleanProp(),
|
|
48
|
+
reactions: createProp(),
|
|
49
|
+
content: createProp(),
|
|
50
|
+
data: createProp()
|
|
52
51
|
};
|
|
53
|
-
//#
|
|
52
|
+
//#endregion
|
|
53
|
+
export { fieldProps, voidFieldProps };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=fieldProps.mjs.map
|
|
@@ -1 +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 decoratorContent: createProp<IFieldProps['decoratorContent']>(),\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 decoratorContent: createProp<IVoidFieldProps['decoratorContent']>(),\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"],"
|
|
1
|
+
{"version":3,"file":"fieldProps.mjs","names":[],"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 decoratorContent: createProp<IFieldProps['decoratorContent']>(),\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 loading: 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 decoratorContent: createProp<IVoidFieldProps['decoratorContent']>(),\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"],"mappings":";;AAIA,MAAa,aAAa;CACxB,MAAM,WAAgC,EAAE,UAAU,MAAM,CAAC;CACzD,OAAO,YAAkC;CACzC,aAAa,YAAwC;CACrD,OAAO,YAAkC;CACzC,cAAc,YAAyC;CACvD,UAAU,YAAqC;CAC/C,WAAW,YAAsC;CACjD,kBAAkB,YAA6C;CAC/D,WAAW,YAAsC;CACjD,SAAS,YAAoC;CAC7C,SAAS,YAAoC;CAC7C,UAAU,mBAAmB;CAC7B,eAAe,mBAAmB;CAClC,QAAQ,mBAAmB;CAC3B,SAAS,mBAAmB;CAC5B,UAAU,mBAAmB;CAC7B,UAAU,mBAAmB;CAC7B,UAAU,mBAAmB;CAC7B,YAAY,mBAAmB;CAC/B,SAAS,mBAAmB;CAC5B,YAAY,YAAuC;CACnD,iBAAiB,YAA4C;CAC7D,iBAAiB,YAA4C;CAC7D,WAAW,YAAsC;CACjD,WAAW,YAAsC;CACjD,SAAS,YAAoC;CAC7C,MAAM,YAAiC;CACxC;AAED,MAAa,iBAAiB;CAC5B,MAAM,WAAoC,EAAE,UAAU,MAAM,CAAC;CAC7D,OAAO,YAAsC;CAC7C,aAAa,YAA4C;CACzD,UAAU,YAAyC;CACnD,WAAW,YAA0C;CACrD,kBAAkB,YAAiD;CACnE,WAAW,YAA0C;CACrD,SAAS,YAAwC;CACjD,SAAS,YAAwC;CACjD,QAAQ,mBAAmB;CAC3B,SAAS,mBAAmB;CAC5B,UAAU,mBAAmB;CAC7B,UAAU,mBAAmB;CAC7B,UAAU,mBAAmB;CAC7B,YAAY,mBAAmB;CAC/B,WAAW,YAA0C;CACrD,SAAS,YAAwC;CACjD,MAAM,YAAqC;CAC5C"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { toRaw
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { toRaw } from "vue";
|
|
2
|
+
//#region src/utils/getRawComponent.ts
|
|
3
|
+
function getRawComponent(props) {
|
|
4
|
+
const { component, decorator } = props;
|
|
5
|
+
let newComponent;
|
|
6
|
+
let newDecorator;
|
|
7
|
+
if (Array.isArray(component)) newComponent = [toRaw(component[0]), component[1]];
|
|
8
|
+
if (Array.isArray(decorator)) newDecorator = [toRaw(decorator[0]), decorator[1]];
|
|
9
|
+
return {
|
|
10
|
+
component: newComponent ?? component,
|
|
11
|
+
decorator: newDecorator ?? decorator
|
|
12
|
+
};
|
|
9
13
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=getRawComponent.mjs.map
|
|
14
|
+
//#endregion
|
|
15
|
+
export { getRawComponent };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=getRawComponent.mjs.map
|
|
@@ -1 +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"],"
|
|
1
|
+
{"version":3,"file":"getRawComponent.mjs","names":[],"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"],"mappings":";;AAMA,SAAgB,gBAAgB,OAA2B;CACzD,MAAM,EAAE,WAAW,cAAc;CACjC,IAAI;CACJ,IAAI;AACJ,KAAI,MAAM,QAAQ,UAAU,CAC1B,gBAAe,CAAC,MAAM,UAAU,GAAG,EAAE,UAAU,GAAG;AAEpD,KAAI,MAAM,QAAQ,UAAU,CAC1B,gBAAe,CAAC,MAAM,UAAU,GAAG,EAAE,UAAU,GAAG;AAEpD,QAAO;EACL,WAAW,gBAAgB;EAC3B,WAAW,gBAAgB;EAC5B"}
|