@_tc/template-core 0.0.1-bate.42 → 0.0.1-bate.43
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.
|
@@ -15,7 +15,7 @@ const generateSchemas = (schema) => {
|
|
|
15
15
|
return [];
|
|
16
16
|
return Object.keys(schema.properties).reduce((schemas, key) => {
|
|
17
17
|
const fieldInfo = schema.properties[key];
|
|
18
|
-
const option = fieldInfo
|
|
18
|
+
const option = fieldInfo?.option;
|
|
19
19
|
if (!option || option.visible === false)
|
|
20
20
|
return schemas;
|
|
21
21
|
const { comType = 'input', default: _defaultValue, visible: _visible, ...fieldProps } = option;
|
|
@@ -49,7 +49,7 @@ const generateDefaultValue = (schema, data) => {
|
|
|
49
49
|
if (!schema?.properties)
|
|
50
50
|
return defaultValue;
|
|
51
51
|
Object.keys(schema.properties).forEach((key) => {
|
|
52
|
-
const defaultFieldValue = schema.properties[key]
|
|
52
|
+
const defaultFieldValue = schema.properties[key]?.option?.default;
|
|
53
53
|
if (typeof defaultFieldValue !== 'undefined' && typeof defaultValue[key] === 'undefined') {
|
|
54
54
|
defaultValue[key] = defaultFieldValue;
|
|
55
55
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FormFieldType, FormItemProps, SchemaFormAllPropsMap } from '../../../packages/ui/react';
|
|
2
2
|
import { FetchInfo } from './fetchInfo';
|
|
3
3
|
export type ComponentConfig = {
|
|
4
4
|
createForm?: {
|
|
@@ -47,15 +47,9 @@ export type ComponentsOption = {
|
|
|
47
47
|
editForm: ComponentsOption['createForm'];
|
|
48
48
|
detailPanel: {};
|
|
49
49
|
};
|
|
50
|
-
export type ComponentOption =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} &
|
|
54
|
-
|
|
55
|
-
comType: 'inputNumber';
|
|
56
|
-
} & InputNumberProps;
|
|
57
|
-
type SelectOption = {
|
|
58
|
-
comType: 'select';
|
|
59
|
-
} & SelectProps;
|
|
60
|
-
export {};
|
|
50
|
+
export type ComponentOption = {
|
|
51
|
+
[K in FormFieldType]: {
|
|
52
|
+
comType: K;
|
|
53
|
+
} & (K extends keyof SchemaFormAllPropsMap ? SchemaFormAllPropsMap[K] : unknown);
|
|
54
|
+
}[FormFieldType];
|
|
61
55
|
//# sourceMappingURL=component.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FormFieldType, FormItemProps, SchemaFormAllPropsMap } from '../../../fe/packages/ui/react';
|
|
2
2
|
import { FetchInfo } from './fetchInfo';
|
|
3
3
|
export type ComponentConfig = {
|
|
4
4
|
createForm?: {
|
|
@@ -47,15 +47,9 @@ export type ComponentsOption = {
|
|
|
47
47
|
editForm: ComponentsOption['createForm'];
|
|
48
48
|
detailPanel: {};
|
|
49
49
|
};
|
|
50
|
-
export type ComponentOption =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} &
|
|
54
|
-
|
|
55
|
-
comType: 'inputNumber';
|
|
56
|
-
} & InputNumberProps;
|
|
57
|
-
type SelectOption = {
|
|
58
|
-
comType: 'select';
|
|
59
|
-
} & SelectProps;
|
|
60
|
-
export {};
|
|
50
|
+
export type ComponentOption = {
|
|
51
|
+
[K in FormFieldType]: {
|
|
52
|
+
comType: K;
|
|
53
|
+
} & (K extends keyof SchemaFormAllPropsMap ? SchemaFormAllPropsMap[K] : unknown);
|
|
54
|
+
}[FormFieldType];
|
|
61
55
|
//# sourceMappingURL=component.d.ts.map
|