cnhis-design-vue 3.1.16-beta.8 → 3.1.17-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/es/packages/big-table/index.d.ts +1 -1
- package/es/packages/big-table/src/BigTable.vue.d.ts +3 -19
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +6 -4
- package/es/packages/big-table/src/components/edit-form/edit-date.js +13 -3
- package/es/packages/big-table/src/components/edit-form/edit-time.js +1 -0
- package/es/packages/big-table/src/hooks/useAnchor.d.ts +1 -1
- package/es/packages/big-table/src/hooks/useAnchor.js +20 -12
- package/es/packages/big-table/src/hooks/useSeparateRow.js +5 -2
- package/es/packages/button-print/index.d.ts +4 -1
- package/es/packages/button-print/src/ButtonPrint.vue.d.ts +4 -1
- package/es/packages/button-print/src/components/IdentityVerification.js +5 -7
- package/es/packages/button-print/src/components/IdentityVerification.vue.d.ts +4 -1
- package/es/packages/fabric-chart/src/FabricChart.js +1 -1
- package/es/packages/fabric-chart/src/components/PopupTip.js +2 -2
- package/es/packages/fabric-chart/src/hooks/constant.js +1 -1
- package/es/packages/fabric-chart/src/hooks/useCenter.js +11 -2
- package/es/packages/fabric-chart/src/hooks/useOther.js +63 -13
- package/es/packages/form-config/index.d.ts +90 -3338
- package/es/packages/form-config/src/FormConfig.js +42 -34
- package/es/packages/form-config/src/FormConfig.vue.d.ts +134 -3382
- package/es/packages/form-config/src/components/FormConfigCreator.js +13 -11
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +16 -11
- package/es/packages/form-config/src/components/FormConfigEdit.js +1 -1
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +60 -29
- package/es/packages/form-config/src/constants/index.d.ts +21 -21
- package/es/packages/form-config/src/constants/index.js +27 -36
- package/es/packages/form-config/src/hooks/useConfigurationField.d.ts +2 -1
- package/es/packages/form-config/src/hooks/useConfigurationField.js +28 -42
- package/es/packages/form-config/src/hooks/usePresetRenderer.d.ts +2 -3
- package/es/packages/form-config/src/hooks/usePresetRenderer.js +16 -19
- package/es/packages/form-config/src/hooks/useSortable.js +1 -1
- package/es/packages/form-config/src/types/index.d.ts +22 -4
- package/es/packages/form-config/src/utils/index.d.ts +2 -0
- package/es/packages/form-config/src/utils/index.js +15 -0
- package/es/packages/form-config/style/index.css +27 -3
- package/es/packages/form-render/index.d.ts +6 -4
- package/es/packages/form-render/index.js +0 -1
- package/es/packages/form-render/src/FormRender.js +8 -9
- package/es/packages/form-render/src/FormRender.vue.d.ts +6 -4
- package/es/packages/form-render/src/components/renderer/{combination/index.d.ts → combination.d.ts} +3 -3
- package/es/packages/form-render/src/components/renderer/combination.js +92 -0
- package/es/packages/form-render/src/components/renderer/date.js +12 -4
- package/es/packages/form-render/src/components/renderer/formItem.js +12 -5
- package/es/packages/form-render/src/components/renderer/index.d.ts +1 -0
- package/es/packages/form-render/src/components/renderer/index.js +2 -1
- package/es/packages/form-render/src/components/renderer/inputGroup.js +1 -1
- package/es/packages/form-render/src/components/renderer/{combination → jsonCombination}/hooks/useDeepValidate.d.ts +0 -0
- package/es/packages/form-render/src/components/renderer/{combination → jsonCombination}/hooks/useDeepValidate.js +0 -0
- package/es/packages/form-render/src/components/renderer/jsonCombination/index.d.ts +44 -0
- package/es/packages/form-render/src/components/renderer/{combination → jsonCombination}/index.js +29 -14
- package/es/packages/form-render/src/components/renderer/select.js +11 -8
- package/es/packages/form-render/src/constants/index.d.ts +2 -2
- package/es/packages/form-render/src/hooks/index.d.ts +0 -1
- package/es/packages/form-render/src/hooks/index.js +0 -1
- package/es/packages/form-render/src/hooks/useAnchor.d.ts +3 -3
- package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +2 -2
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.d.ts +1 -1
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +12 -5
- package/es/packages/form-render/src/hooks/useFieldVisitor.js +6 -5
- package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.d.ts +4 -4
- package/es/packages/form-render/src/hooks/useFormRequest.d.ts +2 -2
- package/es/packages/form-render/src/hooks/useTypeNormalize.js +2 -1
- package/es/packages/form-render/src/types/fieldItem.d.ts +4 -0
- package/es/packages/form-render/src/types/index.d.ts +4 -4
- package/es/packages/form-render/src/utils/dom.d.ts +2 -2
- package/es/packages/form-render/src/utils/index.js +3 -2
- package/es/packages/form-render/src/utils/schema.d.ts +62 -2
- package/es/packages/form-render/src/utils/schema.js +5 -2
- package/es/packages/form-render/style/index.css +11 -8
- package/es/packages/index.css +38 -11
- package/es/packages/index.js +0 -1
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +1 -0
- package/es/packages/shortcut-setter/index.d.ts +7 -4
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +7 -4
- package/es/src/types/index.d.ts +2 -2
- package/es/src/utils/index.d.ts +1 -0
- package/es/src/utils/index.js +11 -1
- package/global.d.ts +8 -8
- package/package.json +4 -4
- package/es/packages/form-render/src/hooks/useInitialData.d.ts +0 -5
- package/es/packages/form-render/src/hooks/useInitialData.js +0 -16
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { defineComponent, inject, computed, createVNode } from 'vue';
|
|
2
2
|
import { isVoidField } from '@formily/core';
|
|
3
|
-
import { connect, mapProps } from '@formily/vue';
|
|
3
|
+
import { useField, connect, mapProps } from '@formily/vue';
|
|
4
4
|
import { NFormItem } from 'naive-ui';
|
|
5
5
|
import AnnotationEdit from '../../../../../packages/annotation-edit';
|
|
6
|
-
import { InjectionAnnotation } from '../../../../../packages/form-render/src/constants';
|
|
6
|
+
import { InjectionAnnotation, InjectionFormUUID } from '../../../../../packages/form-render/src/constants';
|
|
7
|
+
import { elementIdEscape } from '../../../../../packages/form-render/src/utils';
|
|
7
8
|
|
|
8
9
|
const script = defineComponent({
|
|
9
10
|
props: {
|
|
@@ -38,6 +39,11 @@ const script = defineComponent({
|
|
|
38
39
|
return annotation.value && props.annotation !== false;
|
|
39
40
|
});
|
|
40
41
|
const showLabel = computed(() => props.label && props.label !== " ");
|
|
42
|
+
const field = useField();
|
|
43
|
+
const uuid = inject(InjectionFormUUID);
|
|
44
|
+
const id = computed(() => {
|
|
45
|
+
return elementIdEscape(`${uuid}-${field.value.path.toString()}`);
|
|
46
|
+
});
|
|
41
47
|
function renderLabel() {
|
|
42
48
|
return showLabel.value ? createVNode("section", {
|
|
43
49
|
"class": "form-render__formItemLabel"
|
|
@@ -47,7 +53,9 @@ const script = defineComponent({
|
|
|
47
53
|
}]
|
|
48
54
|
}, [props.label]), showAnnotation.value ? renderAnnotation() : null]) : null;
|
|
49
55
|
}
|
|
50
|
-
return () => createVNode(NFormItem,
|
|
56
|
+
return () => createVNode(NFormItem, {
|
|
57
|
+
id: id.value
|
|
58
|
+
}, {
|
|
51
59
|
...slots,
|
|
52
60
|
label: renderLabel
|
|
53
61
|
});
|
|
@@ -56,14 +64,13 @@ const script = defineComponent({
|
|
|
56
64
|
const FORM_ITEM = connect(script, mapProps({
|
|
57
65
|
title: "label"
|
|
58
66
|
}, (props, field) => {
|
|
59
|
-
var _a;
|
|
60
67
|
const feedback = !isVoidField(field) ? field.selfErrors.length ? field.selfErrors.join(",") : void 0 : void 0;
|
|
61
68
|
return {
|
|
62
69
|
...props,
|
|
63
70
|
required: isVoidField(field) ? void 0 : field.required,
|
|
64
71
|
class: "form-render__formItem",
|
|
65
72
|
style: {
|
|
66
|
-
"--form-item-column":
|
|
73
|
+
"--form-item-column": props.span
|
|
67
74
|
},
|
|
68
75
|
feedback,
|
|
69
76
|
"validation-status": feedback ? "error" : void 0
|
|
@@ -7,7 +7,8 @@ export { LINEBAR } from './linebar.js';
|
|
|
7
7
|
export { INPUT_GROUP } from './inputGroup.js';
|
|
8
8
|
export { DATE } from './date.js';
|
|
9
9
|
export { SEARCH_CASCADE } from './cascader.js';
|
|
10
|
-
export {
|
|
10
|
+
export { JSON_COMBINATION } from './jsonCombination/index.js';
|
|
11
|
+
export { COMBINATION } from './combination.js';
|
|
11
12
|
export { CHECKBOX } from './checkbox.js';
|
|
12
13
|
export { SWITCH } from './switch.js';
|
|
13
14
|
export { RADIO } from './radio.js';
|
|
@@ -2,7 +2,7 @@ import { connect, mapProps } from '@formily/vue';
|
|
|
2
2
|
import { NInputGroup } from 'naive-ui';
|
|
3
3
|
|
|
4
4
|
const INPUT_GROUP = connect(NInputGroup, mapProps((props) => {
|
|
5
|
-
return { style: { "--column": props.span
|
|
5
|
+
return { style: { "--column": props.span }, class: "form-render__inputGroup" };
|
|
6
6
|
}));
|
|
7
7
|
|
|
8
8
|
export { INPUT_GROUP };
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FieldItem } from '../../../../../../../es/packages/form-render';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
export declare const JSON_COMBINATION: import("vue").DefineComponent<{
|
|
4
|
+
title: {
|
|
5
|
+
type: StringConstructor;
|
|
6
|
+
default: string;
|
|
7
|
+
};
|
|
8
|
+
value: {
|
|
9
|
+
type: (ArrayConstructor | StringConstructor)[];
|
|
10
|
+
};
|
|
11
|
+
maxGroupNum: {
|
|
12
|
+
type: NumberConstructor;
|
|
13
|
+
};
|
|
14
|
+
getProperties: {
|
|
15
|
+
type: PropType<() => FieldItem[]>;
|
|
16
|
+
default: () => never[];
|
|
17
|
+
};
|
|
18
|
+
onInput: {};
|
|
19
|
+
onBlur: {};
|
|
20
|
+
onChange: {};
|
|
21
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
title: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
value: {
|
|
27
|
+
type: (ArrayConstructor | StringConstructor)[];
|
|
28
|
+
};
|
|
29
|
+
maxGroupNum: {
|
|
30
|
+
type: NumberConstructor;
|
|
31
|
+
};
|
|
32
|
+
getProperties: {
|
|
33
|
+
type: PropType<() => FieldItem[]>;
|
|
34
|
+
default: () => never[];
|
|
35
|
+
};
|
|
36
|
+
onInput: {};
|
|
37
|
+
onBlur: {};
|
|
38
|
+
onChange: {};
|
|
39
|
+
}>> & {
|
|
40
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
title: string;
|
|
43
|
+
getProperties: () => FieldItem[];
|
|
44
|
+
}>;
|
package/es/packages/form-render/src/components/renderer/{combination → jsonCombination}/index.js
RENAMED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { defineComponent, ref, computed, watch, onMounted, createVNode
|
|
1
|
+
import { defineComponent, ref, computed, watch, onMounted, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
3
|
import { Path } from '@formily/path';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { AddCircleOutline, RemoveCircle } from '@vicons/ionicons5';
|
|
5
|
+
import { isNumber, isArray, isEqual } from 'lodash-es';
|
|
6
|
+
import { useDeepValidate } from '../../../../../../packages/form-render/src/components/renderer/jsonCombination/hooks/useDeepValidate';
|
|
7
|
+
import { formRenderLog, mergeDeepProperties } from '../../../utils/index.js';
|
|
7
8
|
import { connect, mapProps } from '@formily/vue';
|
|
8
9
|
import { useDebounceFn, isObject } from '@vueuse/core';
|
|
9
|
-
import { NButton } from 'naive-ui';
|
|
10
|
+
import { NButton, NIcon } from 'naive-ui';
|
|
10
11
|
import FormRender from '../../../FormRender.js';
|
|
11
12
|
import { assignUpdateValue } from '../../../utils/schema.js';
|
|
12
13
|
|
|
13
14
|
const script = defineComponent({
|
|
14
|
-
name: "
|
|
15
|
+
name: "FormJsonCombination",
|
|
15
16
|
props: {
|
|
16
17
|
title: {
|
|
17
18
|
type: String,
|
|
18
19
|
default: ""
|
|
19
20
|
},
|
|
20
21
|
value: {
|
|
21
|
-
type: String
|
|
22
|
+
type: [String, Array]
|
|
22
23
|
},
|
|
23
24
|
maxGroupNum: {
|
|
24
25
|
type: Number
|
|
@@ -35,12 +36,18 @@ const script = defineComponent({
|
|
|
35
36
|
setup(props, {
|
|
36
37
|
emit
|
|
37
38
|
}) {
|
|
39
|
+
formRenderLog("\u5F53\u524DCOMBINATION\u63A7\u4EF6\u4E3Ajson\u6A21\u5F0F,\u63A8\u8350\u4F7F\u7528\u975Ejson\u6A21\u5F0F,FieldItem.jsonCombination=false", "warn");
|
|
38
40
|
const emitChange = useDebounceFn(function emitChange2() {
|
|
39
41
|
emit("update:value", JSON.stringify(combinationData.value));
|
|
40
42
|
}, 300);
|
|
41
43
|
const combinationData = ref([]);
|
|
42
44
|
const currentGroupNum = computed(() => combinationData.value.length);
|
|
43
45
|
function setCombinationData(data, withInitialData = false) {
|
|
46
|
+
if (isArray(data)) {
|
|
47
|
+
if (!data.length)
|
|
48
|
+
data.push({});
|
|
49
|
+
data = JSON.stringify(data);
|
|
50
|
+
}
|
|
44
51
|
const parsedData = getParsedData(data);
|
|
45
52
|
if (!needLoad(parsedData))
|
|
46
53
|
return;
|
|
@@ -66,7 +73,6 @@ const script = defineComponent({
|
|
|
66
73
|
return null;
|
|
67
74
|
return result;
|
|
68
75
|
} catch (e) {
|
|
69
|
-
formRenderLog(`invalid JSON value ${data2} in COMBINATION => ${props.title}`, "warn");
|
|
70
76
|
return null;
|
|
71
77
|
}
|
|
72
78
|
}
|
|
@@ -137,22 +143,31 @@ const script = defineComponent({
|
|
|
137
143
|
"text": true,
|
|
138
144
|
"disabled": currentGroupNum.value >= maxGroupNum.value
|
|
139
145
|
}, {
|
|
140
|
-
|
|
146
|
+
icon: () => createVNode(NIcon, {
|
|
147
|
+
"component": AddCircleOutline
|
|
148
|
+
}, null),
|
|
149
|
+
default: () => "\u65B0\u589E"
|
|
141
150
|
})]), Array.from({
|
|
142
151
|
length: currentGroupNum.value
|
|
143
152
|
}).map((_, idx) => createVNode("section", {
|
|
144
|
-
"class": "form-
|
|
153
|
+
"class": "form-render__combinationContentJson"
|
|
145
154
|
}, [createVNode(FormRenderComponent, {
|
|
146
155
|
"ref": (_ref) => setFormRenderRef(idx, _ref),
|
|
147
156
|
"fieldList": props.getProperties(),
|
|
148
157
|
"onFormChange": (payload) => onChange(idx, payload)
|
|
149
|
-
}, null), idx === 0 ? null : createVNode(
|
|
158
|
+
}, null), idx === 0 ? null : createVNode(NButton, {
|
|
159
|
+
"text": true,
|
|
150
160
|
"class": "form-render__combinationClose",
|
|
161
|
+
"type": "error",
|
|
151
162
|
"onClick": () => removeGroup(idx)
|
|
152
|
-
},
|
|
163
|
+
}, {
|
|
164
|
+
icon: () => createVNode(NIcon, {
|
|
165
|
+
"component": RemoveCircle
|
|
166
|
+
}, null)
|
|
167
|
+
})]))]);
|
|
153
168
|
};
|
|
154
169
|
}
|
|
155
170
|
});
|
|
156
|
-
const
|
|
171
|
+
const JSON_COMBINATION = connect(script, mapProps(assignUpdateValue));
|
|
157
172
|
|
|
158
|
-
export {
|
|
173
|
+
export { JSON_COMBINATION };
|
|
@@ -72,12 +72,12 @@ const script = defineComponent({
|
|
|
72
72
|
try {
|
|
73
73
|
traverseDependKey(config.dependKey, (dependKey, valueKey2, required) => {
|
|
74
74
|
const _field = field2.query(dependKey).take();
|
|
75
|
-
if (isField(_field))
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
_params[valueKey2] = _field.value;
|
|
75
|
+
if (!isField(_field))
|
|
76
|
+
return;
|
|
77
|
+
if (required && _field.value == null) {
|
|
78
|
+
throw `\u7F3A\u5C11\u5FC5\u987B\u7684\u53C2\u6570=>${dependKey}`;
|
|
80
79
|
}
|
|
80
|
+
_params[valueKey2] = _field.value;
|
|
81
81
|
});
|
|
82
82
|
} catch (e) {
|
|
83
83
|
return Promise.reject(e);
|
|
@@ -105,11 +105,14 @@ const script = defineComponent({
|
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
108
|
-
changeContextCollector
|
|
108
|
+
changeContextCollector.setContext(fieldKey.value, async () => {
|
|
109
109
|
await nextTick();
|
|
110
110
|
return {
|
|
111
|
-
currentOption: cloneDeep(
|
|
111
|
+
currentOption: cloneDeep(getCurrentOption())
|
|
112
112
|
};
|
|
113
|
+
function getCurrentOption() {
|
|
114
|
+
return parsedOptions.value.find((option) => option[valueKey.value] === valueRef.value);
|
|
115
|
+
}
|
|
113
116
|
});
|
|
114
117
|
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
115
118
|
watch(() => props.urlConfig, (config, oldConfig) => {
|
|
@@ -120,7 +123,7 @@ const script = defineComponent({
|
|
|
120
123
|
return;
|
|
121
124
|
formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], async () => {
|
|
122
125
|
remoteOptions.value = null;
|
|
123
|
-
|
|
126
|
+
valueRef.value = null;
|
|
124
127
|
!props.lazyRequest && await fetchData();
|
|
125
128
|
});
|
|
126
129
|
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nullable } from '../../../../../es/src/types';
|
|
2
2
|
import { ContextCollector } from '../../../../../es/packages/form-render/src/hooks/useChangeContext';
|
|
3
3
|
import { BusinessCollector, FormItemDepsCollector } from '../hooks';
|
|
4
4
|
import { FormAsyncQueue } from '../types';
|
|
@@ -9,7 +9,7 @@ export declare const InjectionBusinessCollector: InjectionKey<BusinessCollector>
|
|
|
9
9
|
export declare const InjectionChangeContextCollector: InjectionKey<ContextCollector>;
|
|
10
10
|
export declare const InjectionFormItemDepsCollector: InjectionKey<FormItemDepsCollector>;
|
|
11
11
|
export declare const InjectionFormUUID: InjectionKey<string>;
|
|
12
|
-
export declare const InjectionAnnotation: InjectionKey<WritableComputedRef<
|
|
12
|
+
export declare const InjectionAnnotation: InjectionKey<WritableComputedRef<Nullable<Record<string, string>>>>;
|
|
13
13
|
export declare const FormItemLineBarDepKeyPrepend = "__dep_LINEBAR_";
|
|
14
14
|
export declare enum FIELD_BUSINESS_TYPE {
|
|
15
15
|
PASSWORD = "password",
|
|
@@ -9,6 +9,5 @@ export { useFormValidator } from './useFormValidator.js';
|
|
|
9
9
|
export { BusinessCollector, useBusinessBinding } from './useBusinessBinding.js';
|
|
10
10
|
export { ContextCollector, useChangeContext } from './useChangeContext.js';
|
|
11
11
|
export { FormItemDepsCollector, useFormItemDeps } from './useFormItemDeps.js';
|
|
12
|
-
export { useInitialData } from './useInitialData.js';
|
|
13
12
|
export { useAnchor } from './useAnchor.js';
|
|
14
13
|
export { useFormContext } from './useFormContext.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UndefinedAble } from '../../../../../es/src/types';
|
|
2
2
|
import { ISchema } from '@formily/json-schema/esm/types';
|
|
3
3
|
import { Ref } from 'vue';
|
|
4
4
|
import { FormItemDepsCollector, FormRenderProps } from '../../../../../es/packages/form-render';
|
|
5
|
-
export declare function useAnchor(props: Readonly<FormRenderProps>, scrollbarRef: Ref<
|
|
5
|
+
export declare function useAnchor(props: Readonly<FormRenderProps>, scrollbarRef: Ref<UndefinedAble<HTMLElement>>, collector: FormItemDepsCollector): {
|
|
6
6
|
currentAnchor: import("vue").WritableComputedRef<string>;
|
|
7
7
|
onScroll: () => void;
|
|
8
8
|
formHeight: import("vue").ComputedRef<string | undefined>;
|
|
@@ -11,6 +11,6 @@ export declare function useAnchor(props: Readonly<FormRenderProps>, scrollbarRef
|
|
|
11
11
|
title: string;
|
|
12
12
|
}[]>;
|
|
13
13
|
generateAnchorList: (schema: ISchema) => void;
|
|
14
|
-
scrollbarRef: Ref<
|
|
14
|
+
scrollbarRef: Ref<UndefinedAble<HTMLElement>>;
|
|
15
15
|
scrollTo: (id: string) => Promise<void>;
|
|
16
16
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { AnyObject,
|
|
1
|
+
import { AnyObject, UndefinedAble } from '../../../../../es/src/types';
|
|
2
2
|
import { FormAsyncQueueItem } from '../types';
|
|
3
3
|
declare type ProcessorOption = Partial<{
|
|
4
4
|
afterRequest(key: string, payload?: unknown): AnyObject[];
|
|
5
|
-
beforeRequest(key: string, params?: unknown):
|
|
5
|
+
beforeRequest(key: string, params?: unknown): UndefinedAble<AnyObject> | void;
|
|
6
6
|
}>;
|
|
7
7
|
interface EntryCallback {
|
|
8
8
|
(err?: any, result?: any): void;
|
|
@@ -3,7 +3,7 @@ import { FieldItem } from '../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* @description 胶水层, 将低代码平台中的fieldList转换为JSONSchema
|
|
5
5
|
*/
|
|
6
|
-
export declare function useFieldListAdaptor(collector: BusinessCollector
|
|
6
|
+
export declare function useFieldListAdaptor(collector: BusinessCollector): {
|
|
7
7
|
schemaAdaptor: (fieldList: FieldItem[]) => Record<string, import("@formily/json-schema/esm/types").Stringify<{
|
|
8
8
|
[key: symbol]: any;
|
|
9
9
|
[key: `x-${string}`]: any;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { isObject } from '@vueuse/core';
|
|
2
2
|
import { pick } from 'lodash-es';
|
|
3
3
|
import { useFormValidator, useTypeNormalize } from '../../../../packages/form-render';
|
|
4
|
-
import { arrayed, parseNumberFromMaybeString } from '../utils/index.js';
|
|
5
|
-
import { fieldKeyEscape, createLinebarId
|
|
4
|
+
import { arrayed, parseNumberFromMaybeString, formRenderLog } from '../utils/index.js';
|
|
5
|
+
import { fieldKeyEscape, createLinebarId } from '../utils/schema.js';
|
|
6
6
|
import { transformDateFormat } from '../utils/business.js';
|
|
7
7
|
|
|
8
|
-
function useFieldListAdaptor(collector
|
|
8
|
+
function useFieldListAdaptor(collector) {
|
|
9
9
|
const { createValidatorSchema } = useFormValidator();
|
|
10
10
|
const createStandardSchema = (item) => {
|
|
11
11
|
var _a;
|
|
@@ -14,6 +14,7 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
14
14
|
type: (_a = item.fieldType) != null ? _a : "string",
|
|
15
15
|
title: item.alias || item.name,
|
|
16
16
|
"x-component": item.html_type,
|
|
17
|
+
default: item.default_val,
|
|
17
18
|
"x-component-props": {
|
|
18
19
|
placeholder: item.placeholder,
|
|
19
20
|
clearable: item.is_empty === "0",
|
|
@@ -38,7 +39,6 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
38
39
|
showLabel: item.hide_title !== "1",
|
|
39
40
|
propertyKey: item.val_key,
|
|
40
41
|
annotation: item.annotation,
|
|
41
|
-
id: elementIdEscape(`${uuid}-${item.val_key}`),
|
|
42
42
|
...item.decoratorProps || {}
|
|
43
43
|
}
|
|
44
44
|
});
|
|
@@ -102,6 +102,10 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
102
102
|
};
|
|
103
103
|
const createCombinationSchema = (item) => {
|
|
104
104
|
const schema = createStandardSchema(item);
|
|
105
|
+
schema.type = "array";
|
|
106
|
+
if (item.jsonCombination !== false) {
|
|
107
|
+
schema["x-component"] = "JSON_COMBINATION";
|
|
108
|
+
}
|
|
105
109
|
Object.assign(schema["x-decorator-props"], {
|
|
106
110
|
showLabel: false,
|
|
107
111
|
showFeedback: false
|
|
@@ -158,7 +162,10 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
158
162
|
};
|
|
159
163
|
const createComplexSchema = (item) => {
|
|
160
164
|
const schema = createStandardSchema(item);
|
|
161
|
-
|
|
165
|
+
if (Array.isArray(item.properties)) {
|
|
166
|
+
formRenderLog("COMPLEX\u63A7\u4EF6\u7684properties\u5C5E\u6027\u5DF2\u7ECF\u5E9F\u5F03, \u8BF7\u4F7F\u7528children\u4F5C\u4E3A\u66FF\u4EE3, \u5728\u4E4B\u540E\u7684\u7248\u672C\u4E2Dproperties\u5C5E\u6027\u5C06\u4E0D\u518D\u652F\u6301", "warn");
|
|
167
|
+
}
|
|
168
|
+
const properties = Array.isArray(item.properties || item.children) ? schemaAdaptor(item.properties || item.children) : {};
|
|
162
169
|
schema.type = item.fieldType || "void";
|
|
163
170
|
schema.properties = properties;
|
|
164
171
|
Object.assign(schema["x-decorator-props"], { showFeedback: false });
|
|
@@ -3,8 +3,6 @@ import { isFunction } from '@vueuse/core';
|
|
|
3
3
|
|
|
4
4
|
function useFieldVisitor() {
|
|
5
5
|
function traverse(fieldList, visitorMap, key = "val_key") {
|
|
6
|
-
if (!visitorMap)
|
|
7
|
-
return fieldList;
|
|
8
6
|
return fieldList.reduce((fin, field) => {
|
|
9
7
|
if (Array.isArray(field.children)) {
|
|
10
8
|
field.children = traverse(field.children, visitorMap, key);
|
|
@@ -15,7 +13,7 @@ function useFieldVisitor() {
|
|
|
15
13
|
if (field.suffixConfig) {
|
|
16
14
|
field.suffixConfig = traverse(arrayed(field.suffixConfig), visitorMap, key);
|
|
17
15
|
}
|
|
18
|
-
const visitor = visitorMap[field[key]];
|
|
16
|
+
const visitor = visitorMap == null ? void 0 : visitorMap[field[key]];
|
|
19
17
|
let current = field;
|
|
20
18
|
const before = [];
|
|
21
19
|
const after = [];
|
|
@@ -31,10 +29,13 @@ function useFieldVisitor() {
|
|
|
31
29
|
after.push(...arrayed(field2));
|
|
32
30
|
}
|
|
33
31
|
});
|
|
34
|
-
fin.
|
|
35
|
-
return fin;
|
|
32
|
+
return fin.concat([...before, current, ...after].map(defaultTransfer));
|
|
36
33
|
}, []);
|
|
37
34
|
}
|
|
35
|
+
function defaultTransfer(field) {
|
|
36
|
+
field.elem_width = ~~((field.elem_width || 3) * 2);
|
|
37
|
+
return field;
|
|
38
|
+
}
|
|
38
39
|
return { traverse };
|
|
39
40
|
}
|
|
40
41
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UndefinedAble } from '../../../../../es/src/types';
|
|
2
2
|
import { FormRenderLifeCycle, FormRenderProps } from '../../../../../es/packages/form-render';
|
|
3
3
|
export declare function useFormRenderLifeCycle(props: FormRenderProps): {
|
|
4
4
|
callLifeCycle: <T extends "onSetup" | "beforeRequest" | "afterRequest">(lifeCycleName: T, payload?: Parameters<Required<Partial<{
|
|
5
5
|
onSetup(): void;
|
|
6
|
-
beforeRequest(fieldKey: string, params?: import("../../../../../es/src/types").AnyObject | undefined): void |
|
|
6
|
+
beforeRequest(fieldKey: string, params?: import("../../../../../es/src/types").AnyObject | undefined): void | UndefinedAble<import("../../../../../es/src/types").AnyObject>;
|
|
7
7
|
afterRequest(fieldKey: string, payload?: any): import("../../../../../es/src/types").AnyObject[];
|
|
8
|
-
}>>[T]> | undefined) =>
|
|
8
|
+
}>>[T]> | undefined) => UndefinedAble<ReturnType<Required<Partial<{
|
|
9
9
|
onSetup(): void;
|
|
10
|
-
beforeRequest(fieldKey: string, params?: import("../../../../../es/src/types").AnyObject | undefined): void |
|
|
10
|
+
beforeRequest(fieldKey: string, params?: import("../../../../../es/src/types").AnyObject | undefined): void | UndefinedAble<import("../../../../../es/src/types").AnyObject>;
|
|
11
11
|
afterRequest(fieldKey: string, payload?: any): import("../../../../../es/src/types").AnyObject[];
|
|
12
12
|
}>>[T]>>;
|
|
13
13
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Func,
|
|
1
|
+
import { Func, Nullable } from '../../../../../es/src/types';
|
|
2
2
|
declare type RequestInstance = Record<string, Func>;
|
|
3
3
|
export declare function useFormRequest(): {
|
|
4
|
-
getHttpInstance: () =>
|
|
4
|
+
getHttpInstance: () => Nullable<RequestInstance>;
|
|
5
5
|
registGlobHttpInstance: (instance: RequestInstance) => void;
|
|
6
6
|
};
|
|
7
7
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyObject,
|
|
1
|
+
import { AnyObject, UndefinedAble } from '../../../../../es/src/types';
|
|
2
2
|
import { DataField, Field } from '@formily/core';
|
|
3
3
|
import { ISchema } from '@formily/json-schema/esm/types';
|
|
4
4
|
import { Component, FunctionalComponent } from 'vue';
|
|
@@ -25,7 +25,7 @@ export declare type FormAsyncQueue = AsyncQueue<FormAsyncQueueItem, any, AnyObje
|
|
|
25
25
|
export declare type AgeContext = Record<'age' | 'day' | 'month' | 'year', number>;
|
|
26
26
|
export declare type IdCardParseInfo = Record<'sex' | 'birthday', string> & AgeContext;
|
|
27
27
|
export declare type FormRenderExpose = {
|
|
28
|
-
validate(path?: string): Promise<
|
|
28
|
+
validate(path?: string): Promise<unknown>;
|
|
29
29
|
getFormValues(): AnyObject;
|
|
30
30
|
setFieldState(path: string, setter: (field: Field) => void): void;
|
|
31
31
|
resetFields(path?: string): void;
|
|
@@ -43,7 +43,7 @@ export declare type FormChangePayload = {
|
|
|
43
43
|
fieldKey: string;
|
|
44
44
|
fieldName: string;
|
|
45
45
|
fieldInstance: DataField;
|
|
46
|
-
context
|
|
46
|
+
context?: FormChangeContext;
|
|
47
47
|
};
|
|
48
48
|
export declare type DependKeyType = string | Record<string, string> | Array<{
|
|
49
49
|
paramName: string;
|
|
@@ -52,7 +52,7 @@ export declare type DependKeyType = string | Record<string, string> | Array<{
|
|
|
52
52
|
} | string>;
|
|
53
53
|
export declare type FormRenderLifeCycle = Partial<{
|
|
54
54
|
onSetup(): void;
|
|
55
|
-
beforeRequest(fieldKey: string, params?: AnyObject):
|
|
55
|
+
beforeRequest(fieldKey: string, params?: AnyObject): UndefinedAble<AnyObject> | void;
|
|
56
56
|
afterRequest(fieldKey: string, payload?: any): AnyObject[];
|
|
57
57
|
}>;
|
|
58
58
|
export declare type FormRenderProps = Partial<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Nullable } from '../../../../../es/src/types';
|
|
2
2
|
export declare function queryDecorator(key: string, wrapperElement: HTMLElement, formUUID: string): HTMLElement | null;
|
|
3
|
-
export declare function queryInput(decoratorElement?:
|
|
3
|
+
export declare function queryInput(decoratorElement?: Nullable<HTMLElement>): {
|
|
4
4
|
widgetElement: HTMLInputElement | null | undefined;
|
|
5
5
|
widgetElementList: HTMLInputElement[];
|
|
6
6
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { inject, provide, computed, createVNode, Fragment } from 'vue';
|
|
2
|
+
import { Path } from '@formily/path';
|
|
2
3
|
import { isObject } from '@vue/shared';
|
|
3
4
|
import { isNumber, isString, isFunction } from 'lodash-es';
|
|
4
5
|
export { isIdCard, isMobile, parseAge2Birthday, parseAge2FromContext, parseBirthday, parseIdCard, transformDateFormat } from './business.js';
|
|
5
6
|
export { queryDecorator, queryInput } from './dom.js';
|
|
6
|
-
export { assignUpdateValue, createLinebarId, elementIdEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseFieldList, traverseSchema } from './schema.js';
|
|
7
|
+
export { assignUpdateValue, createLinebarId, createObjSchema, elementIdEscape, fieldKeyEscape, getParentLinebar, traverseDependKey, traverseFieldList, traverseSchema } from './schema.js';
|
|
7
8
|
|
|
8
9
|
function formRenderLog(message, type = "log") {
|
|
9
10
|
console[type](`[FormRender]: ${message}`);
|
|
@@ -19,7 +20,7 @@ function mergeDeepProperties(target, fieldList, traverseProperties = ["children"
|
|
|
19
20
|
if (!isObject(field))
|
|
20
21
|
return;
|
|
21
22
|
if (targetPropertyFor(field) != null && _target[propertyFor(field)] == null) {
|
|
22
|
-
_target
|
|
23
|
+
Path.setIn(_target, propertyFor(field), targetPropertyFor(field));
|
|
23
24
|
}
|
|
24
25
|
traverseProperties.forEach((p) => {
|
|
25
26
|
if (!field[p])
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyObject
|
|
1
|
+
import { AnyObject } from '../../../../../es/src/types';
|
|
2
2
|
import { GeneralField } from '@formily/core';
|
|
3
3
|
import { ISchema } from '@formily/json-schema/esm/types';
|
|
4
4
|
import { DependKeyType, FieldItem } from '../../../../../es/packages/form-render';
|
|
@@ -9,8 +9,68 @@ export declare function createLinebarId(id: string): string;
|
|
|
9
9
|
export declare function traverseDependKey(dependKeys: DependKeyType, handler: {
|
|
10
10
|
(dependKey: string, valueKey: string, required?: boolean): void;
|
|
11
11
|
}): void;
|
|
12
|
-
export declare function getParentLinebar(key: string, fieldList: FieldItem[]):
|
|
12
|
+
export declare function getParentLinebar(key: string, fieldList: FieldItem[]): string | null;
|
|
13
13
|
export declare function assignUpdateValue(props: AnyObject, field: GeneralField): {
|
|
14
14
|
[x: string]: any;
|
|
15
15
|
};
|
|
16
16
|
export declare function traverseFieldList(fieldList: FieldItem[], handler: (field: FieldItem) => void): void;
|
|
17
|
+
export declare function createObjSchema(properties: Record<string, ISchema>): {
|
|
18
|
+
type: string;
|
|
19
|
+
properties: Record<string, import("@formily/json-schema/esm/types").Stringify<{
|
|
20
|
+
[key: symbol]: any;
|
|
21
|
+
[key: `x-${string}`]: any;
|
|
22
|
+
[key: `x-${number}`]: any;
|
|
23
|
+
version?: string | undefined;
|
|
24
|
+
name?: import("@formily/json-schema/esm/types").SchemaKey | undefined;
|
|
25
|
+
title?: any;
|
|
26
|
+
description?: any;
|
|
27
|
+
default?: any;
|
|
28
|
+
readOnly?: boolean | undefined;
|
|
29
|
+
writeOnly?: boolean | undefined;
|
|
30
|
+
type?: import("@formily/json-schema/esm/types").SchemaTypes | undefined;
|
|
31
|
+
enum?: import("@formily/json-schema/esm/types").SchemaEnum<any> | undefined;
|
|
32
|
+
const?: any;
|
|
33
|
+
multipleOf?: number | undefined;
|
|
34
|
+
maximum?: number | undefined;
|
|
35
|
+
exclusiveMaximum?: number | undefined;
|
|
36
|
+
minimum?: number | undefined;
|
|
37
|
+
exclusiveMinimum?: number | undefined;
|
|
38
|
+
maxLength?: number | undefined;
|
|
39
|
+
minLength?: number | undefined;
|
|
40
|
+
pattern?: string | RegExp | undefined;
|
|
41
|
+
maxItems?: number | undefined;
|
|
42
|
+
minItems?: number | undefined;
|
|
43
|
+
uniqueItems?: boolean | undefined;
|
|
44
|
+
maxProperties?: number | undefined;
|
|
45
|
+
minProperties?: number | undefined;
|
|
46
|
+
required?: string | boolean | string[] | undefined;
|
|
47
|
+
format?: string | undefined;
|
|
48
|
+
$ref?: string | undefined;
|
|
49
|
+
$namespace?: string | undefined;
|
|
50
|
+
definitions?: import("@formily/json-schema/esm/types").SchemaProperties<any, any, any, any, any, any, any, any> | undefined;
|
|
51
|
+
properties?: import("@formily/json-schema/esm/types").SchemaProperties<any, any, any, any, any, any, any, any> | undefined;
|
|
52
|
+
items?: import("@formily/json-schema/esm/types").SchemaItems<any, any, any, any, any, any, any, any> | undefined;
|
|
53
|
+
additionalItems?: import("@formily/json-schema/esm/types").Stringify<any> | undefined;
|
|
54
|
+
patternProperties?: import("@formily/json-schema/esm/types").SchemaProperties<any, any, any, any, any, any, any, any> | undefined;
|
|
55
|
+
additionalProperties?: import("@formily/json-schema/esm/types").Stringify<any> | undefined;
|
|
56
|
+
"x-value"?: any;
|
|
57
|
+
"x-index"?: number | undefined;
|
|
58
|
+
"x-pattern"?: any;
|
|
59
|
+
"x-display"?: any;
|
|
60
|
+
"x-validator"?: any;
|
|
61
|
+
"x-decorator"?: any;
|
|
62
|
+
"x-decorator-props"?: any;
|
|
63
|
+
"x-component"?: any;
|
|
64
|
+
"x-component-props"?: any;
|
|
65
|
+
"x-reactions"?: import("@formily/json-schema/esm/types").SchemaReactions<any> | undefined;
|
|
66
|
+
"x-content"?: any;
|
|
67
|
+
"x-data"?: any;
|
|
68
|
+
"x-visible"?: boolean | undefined;
|
|
69
|
+
"x-hidden"?: boolean | undefined;
|
|
70
|
+
"x-disabled"?: boolean | undefined;
|
|
71
|
+
"x-editable"?: boolean | undefined;
|
|
72
|
+
"x-read-only"?: boolean | undefined;
|
|
73
|
+
"x-read-pretty"?: boolean | undefined;
|
|
74
|
+
"x-compile-omitted"?: string[] | undefined;
|
|
75
|
+
}>>;
|
|
76
|
+
};
|