cnhis-design-vue 3.1.16-beta.6 → 3.1.16-beta.9
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 +2 -23
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +4 -2
- 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/button-print/src/ButtonPrint.vue_vue_type_script_setup_true_lang.js +2 -1
- package/es/packages/fabric-chart/src/hooks/constant.js +4 -4
- package/es/packages/fabric-chart/src/hooks/useCenter.js +20 -23
- package/es/packages/fabric-chart/src/hooks/useDraw.js +11 -4
- package/es/packages/fabric-chart/src/hooks/useEvent.js +11 -3
- package/es/packages/fabric-chart/src/hooks/useTop.js +5 -8
- package/es/packages/form-config/index.d.ts +100 -3335
- package/es/packages/form-config/src/FormConfig.js +42 -34
- package/es/packages/form-config/src/FormConfig.vue.d.ts +137 -3372
- package/es/packages/form-config/src/components/FormConfigCreator.js +13 -11
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +19 -7
- package/es/packages/form-config/src/components/FormConfigEdit.js +1 -1
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +69 -32
- package/es/packages/form-config/src/constants/index.d.ts +20 -20
- 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 +21 -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 +26 -2
- package/es/packages/form-render/index.d.ts +9 -0
- package/es/packages/form-render/src/FormRender.js +1 -0
- package/es/packages/form-render/src/FormRender.vue.d.ts +10 -1
- package/es/packages/form-render/src/components/renderer/cascader.d.ts +2 -14
- package/es/packages/form-render/src/components/renderer/select.d.ts +1 -10
- package/es/packages/form-render/src/components/renderer/select.js +7 -4
- package/es/packages/form-render/src/hooks/useBusinessBinding.d.ts +5 -2
- package/es/packages/form-render/src/hooks/useBusinessBinding.js +9 -5
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +5 -2
- package/es/packages/form-render/src/hooks/useFormContext.js +1 -1
- package/es/packages/form-render/src/types/fieldItem.d.ts +11 -12
- package/es/packages/form-render/src/types/index.d.ts +7 -0
- package/es/packages/index.css +26 -2
- package/es/packages/shortcut-setter/index.d.ts +14 -5
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +14 -5
- package/package.json +1 -1
|
@@ -2,62 +2,48 @@ import { EditAbleField, widgetWidthOptionConfig, isShowOptionConfig, isNotFoldOp
|
|
|
2
2
|
|
|
3
3
|
function useConfigurationField() {
|
|
4
4
|
const fieldMap = /* @__PURE__ */ new Map([
|
|
5
|
-
[EditAbleField.
|
|
6
|
-
[EditAbleField.
|
|
5
|
+
[EditAbleField.NAME, { alias: "\u540D\u79F0", elem_width: 12, is_null: "0", html_type: "INPUT" }],
|
|
6
|
+
[EditAbleField.NOTES, { alias: "\u95EE\u53F7\u63D0\u793A", elem_width: 12, html_type: "INPUT" }],
|
|
7
7
|
[
|
|
8
|
-
EditAbleField.
|
|
9
|
-
{ alias: "\u9ED8\u8BA4\u503C",
|
|
8
|
+
EditAbleField.DEFAULT_VALUE,
|
|
9
|
+
{ alias: "\u9ED8\u8BA4\u503C", elem_width: 12, html_type: "INPUT", validate: { max_length: 20 } }
|
|
10
10
|
],
|
|
11
11
|
[
|
|
12
|
-
EditAbleField.
|
|
13
|
-
{
|
|
14
|
-
alias: "\u5BBD\u5EA6",
|
|
15
|
-
fieldType: "number",
|
|
16
|
-
val_key: "elem_width",
|
|
17
|
-
html_type: "SELECT",
|
|
18
|
-
elem_width: 12,
|
|
19
|
-
...widgetWidthOptionConfig()
|
|
20
|
-
}
|
|
12
|
+
EditAbleField.LAYOUT_WIDTH_ENUM,
|
|
13
|
+
{ alias: "\u5BBD\u5EA6", fieldType: "number", html_type: "SELECT", elem_width: 12, ...widgetWidthOptionConfig() }
|
|
21
14
|
],
|
|
15
|
+
[EditAbleField.DESC, { alias: "\u8BF4\u660E\u6587\u672C", elem_width: 12, html_type: "INPUT", validate: { max_length: 30 } }],
|
|
22
16
|
[
|
|
23
|
-
EditAbleField.
|
|
24
|
-
{ alias: "\
|
|
17
|
+
EditAbleField.DEFAULT_EXPAND,
|
|
18
|
+
{ alias: "\u662F\u5426\u9ED8\u8BA4\u5C55\u5F00", html_type: "SWITCH", elem_width: 12, ...isShowOptionConfig() }
|
|
25
19
|
],
|
|
26
|
-
[
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
],
|
|
30
|
-
[
|
|
31
|
-
EditAbleField.IS_NOT_FOLD,
|
|
32
|
-
{ val_key: "is_not_fold", alias: "\u662F\u5426\u53EF\u6298\u53E0", html_type: "SWITCH", elem_width: 12, ...isNotFoldOptionConfig() }
|
|
33
|
-
],
|
|
34
|
-
[
|
|
35
|
-
EditAbleField.IS_EDIT,
|
|
36
|
-
{ val_key: "is_edit", alias: "\u662F\u5426\u53EF\u7F16\u8F91", html_type: "SWITCH", elem_width: 12, ...isEditOptionConfig() }
|
|
37
|
-
],
|
|
38
|
-
[
|
|
39
|
-
EditAbleField.IS_NULL,
|
|
40
|
-
{ val_key: "is_null", alias: "\u662F\u5426\u5FC5\u586B", html_type: "SWITCH", elem_width: 12, ...isNullOptionConfig() }
|
|
41
|
-
]
|
|
20
|
+
[EditAbleField.FOLD, { alias: "\u662F\u5426\u53EF\u6298\u53E0", html_type: "SWITCH", elem_width: 12, ...isNotFoldOptionConfig() }],
|
|
21
|
+
[EditAbleField.EDITABLE, { alias: "\u662F\u5426\u53EF\u7F16\u8F91", html_type: "SWITCH", elem_width: 12, ...isEditOptionConfig() }],
|
|
22
|
+
[EditAbleField.REQUIRED, { alias: "\u662F\u5426\u5FC5\u586B", html_type: "SWITCH", elem_width: 12, ...isNullOptionConfig() }]
|
|
42
23
|
]);
|
|
43
24
|
function generateFieldListByKeys(keyList) {
|
|
44
|
-
return keyList.map((key) =>
|
|
25
|
+
return keyList.map((key) => {
|
|
26
|
+
return { ...fieldMap.get(key), val_key: key };
|
|
27
|
+
});
|
|
45
28
|
}
|
|
46
29
|
function generateFieldListByFieldItem(fieldItem) {
|
|
47
30
|
const htmlMap = new Map([
|
|
48
|
-
[
|
|
49
|
-
|
|
31
|
+
[
|
|
32
|
+
"LINE_BAR",
|
|
33
|
+
[EditAbleField.NAME, EditAbleField.LAYOUT_WIDTH_ENUM, EditAbleField.DEFAULT_EXPAND, EditAbleField.FOLD]
|
|
34
|
+
],
|
|
35
|
+
...["NEWLINE", "COMPLEX", "COMBINATION"].map((key) => [key, [EditAbleField.NAME, EditAbleField.LAYOUT_WIDTH_ENUM]])
|
|
50
36
|
]);
|
|
51
37
|
const defaultItems = [
|
|
52
|
-
EditAbleField.
|
|
53
|
-
EditAbleField.
|
|
54
|
-
EditAbleField.
|
|
55
|
-
EditAbleField.
|
|
56
|
-
EditAbleField.
|
|
57
|
-
EditAbleField.
|
|
58
|
-
EditAbleField.
|
|
38
|
+
EditAbleField.NAME,
|
|
39
|
+
EditAbleField.DEFAULT_VALUE,
|
|
40
|
+
EditAbleField.LAYOUT_WIDTH_ENUM,
|
|
41
|
+
EditAbleField.DESC,
|
|
42
|
+
EditAbleField.NOTES,
|
|
43
|
+
EditAbleField.EDITABLE,
|
|
44
|
+
EditAbleField.REQUIRED
|
|
59
45
|
];
|
|
60
|
-
const keys = htmlMap.get(fieldItem.
|
|
46
|
+
const keys = htmlMap.get(fieldItem.type) || defaultItems;
|
|
61
47
|
return generateFieldListByKeys(keys);
|
|
62
48
|
}
|
|
63
49
|
return { generateFieldListByKeys, generateFieldListByFieldItem };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FormConfigTextFormatter } from '../types';
|
|
1
|
+
import { FormConfigItem, FormConfigTextFormatter } from '../types';
|
|
3
2
|
export declare function usePresetRenderer(textFormatter: FormConfigTextFormatter): {
|
|
4
|
-
getRenderer: (fieldItem:
|
|
3
|
+
getRenderer: (fieldItem: FormConfigItem) => import("vue").Component<any, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | import("vue").FunctionalComponent<{}, {}>;
|
|
5
4
|
};
|
|
@@ -2,7 +2,8 @@ import { defineComponent, computed, createVNode, mergeProps, inject } from 'vue'
|
|
|
2
2
|
import { isString, isArray, isFunction } from 'lodash-es';
|
|
3
3
|
import Draggable from 'vuedraggable';
|
|
4
4
|
import { InjectionActiveFieldItem, WidgetTextMap } from '../../../../packages/form-config/src/constants';
|
|
5
|
-
import { useSortable } from '../../../../packages/form-config/src/hooks';
|
|
5
|
+
import { useSortable } from '../../../../packages/form-config/src/hooks/useSortable';
|
|
6
|
+
import { layoutWidthEnum2Column } from '../../../../packages/form-config/src/utils';
|
|
6
7
|
import { NEllipsis } from 'naive-ui';
|
|
7
8
|
|
|
8
9
|
function usePresetRenderer(textFormatter) {
|
|
@@ -19,14 +20,15 @@ function usePresetRenderer(textFormatter) {
|
|
|
19
20
|
}
|
|
20
21
|
}, [createVNode(NEllipsis, {
|
|
21
22
|
"class": ["form-config__renderer--default", {
|
|
22
|
-
"is-required": fieldItem.
|
|
23
|
-
"is-disabled": fieldItem.
|
|
23
|
+
"is-required": fieldItem.required,
|
|
24
|
+
"is-disabled": fieldItem.editable === false
|
|
24
25
|
}]
|
|
25
26
|
}, {
|
|
26
27
|
default: () => getDisplayText()
|
|
27
28
|
})]);
|
|
28
29
|
function getDisplayText() {
|
|
29
|
-
|
|
30
|
+
const type = WidgetTextMap.get(fieldItem.type);
|
|
31
|
+
return textFormatter(fieldItem, `${fieldItem.name}${type ? `(${type})` : ""}`);
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
};
|
|
@@ -44,12 +46,11 @@ function usePresetRenderer(textFormatter) {
|
|
|
44
46
|
return props.fieldItem[key];
|
|
45
47
|
}
|
|
46
48
|
const classList = computed(() => {
|
|
47
|
-
return
|
|
49
|
+
return "form-config__renderer--complex form-config__renderer--complex--grid";
|
|
48
50
|
});
|
|
49
51
|
const style = computed(() => {
|
|
50
52
|
return {
|
|
51
|
-
"--item-column": fieldFor("
|
|
52
|
-
...fieldFor("wrapperStyle")
|
|
53
|
+
"--item-column": layoutWidthEnum2Column(fieldFor("layoutWidthEnum"))
|
|
53
54
|
};
|
|
54
55
|
});
|
|
55
56
|
function renderField(fieldItem) {
|
|
@@ -57,7 +58,7 @@ function usePresetRenderer(textFormatter) {
|
|
|
57
58
|
return createVNode("div", {
|
|
58
59
|
"class": "form-config__displayContentItem",
|
|
59
60
|
"style": {
|
|
60
|
-
"--item-column": fieldItem.
|
|
61
|
+
"--item-column": layoutWidthEnum2Column(fieldItem.layoutWidthEnum)
|
|
61
62
|
}
|
|
62
63
|
}, [createVNode(Renderer, {
|
|
63
64
|
"fieldItem": fieldItem
|
|
@@ -65,14 +66,10 @@ function usePresetRenderer(textFormatter) {
|
|
|
65
66
|
}
|
|
66
67
|
const childrenList = computed({
|
|
67
68
|
get() {
|
|
68
|
-
return fieldFor("
|
|
69
|
+
return fieldFor("children");
|
|
69
70
|
},
|
|
70
71
|
set(v) {
|
|
71
|
-
|
|
72
|
-
props.fieldItem.children = v;
|
|
73
|
-
} else {
|
|
74
|
-
props.fieldItem.properties = v;
|
|
75
|
-
}
|
|
72
|
+
props.fieldItem.children = v;
|
|
76
73
|
}
|
|
77
74
|
});
|
|
78
75
|
const {
|
|
@@ -82,7 +79,7 @@ function usePresetRenderer(textFormatter) {
|
|
|
82
79
|
return () => createVNode(DraggableComponent, mergeProps(commonConfig, {
|
|
83
80
|
"class": classList.value,
|
|
84
81
|
"style": style.value,
|
|
85
|
-
"group": fieldFor("
|
|
82
|
+
"group": fieldFor("key"),
|
|
86
83
|
"modelValue": childrenList.value,
|
|
87
84
|
"onUpdate:modelValue": ($event) => childrenList.value = $event
|
|
88
85
|
}), {
|
|
@@ -101,12 +98,12 @@ function usePresetRenderer(textFormatter) {
|
|
|
101
98
|
matcher
|
|
102
99
|
}) => {
|
|
103
100
|
if (isString(matcher))
|
|
104
|
-
return matcher === fieldItem.
|
|
101
|
+
return matcher === fieldItem.type;
|
|
105
102
|
if (isArray(matcher))
|
|
106
|
-
return matcher.includes(fieldItem.
|
|
103
|
+
return matcher.includes(fieldItem.type);
|
|
107
104
|
if (isFunction(matcher))
|
|
108
|
-
return matcher(fieldItem.
|
|
109
|
-
return matcher.test(fieldItem.
|
|
105
|
+
return matcher(fieldItem.type);
|
|
106
|
+
return matcher.test(fieldItem.type);
|
|
110
107
|
}).renderer;
|
|
111
108
|
}
|
|
112
109
|
return {
|
|
@@ -24,7 +24,7 @@ function useSortable() {
|
|
|
24
24
|
}
|
|
25
25
|
to.classList.add("is-choosing-area");
|
|
26
26
|
}
|
|
27
|
-
const commonConfig = { onMove, onChoose, onUnchoose, tag: "section", animation: "150", "item-key": "
|
|
27
|
+
const commonConfig = { onMove, onChoose, onUnchoose, tag: "section", animation: "150", "item-key": "key" };
|
|
28
28
|
return { commonConfig };
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Component, FunctionalComponent } from 'vue';
|
|
2
2
|
import { ArrayAble } from '../../../../../es/src/types';
|
|
3
|
-
import { FieldItem } from '../../../../../es/packages/form-render';
|
|
4
3
|
interface Matcher {
|
|
5
4
|
(type: string): boolean;
|
|
6
5
|
}
|
|
@@ -8,11 +7,29 @@ export declare type FormConfigRenderer = {
|
|
|
8
7
|
matcher: ArrayAble<string> | RegExp | Matcher;
|
|
9
8
|
renderer: Component | FunctionalComponent;
|
|
10
9
|
};
|
|
10
|
+
export declare type FormConfigType = 'NEWLINE' | 'LINE_BAR' | 'OTHER' | string;
|
|
11
|
+
export declare type FormConfigWidth = 'ALL_LINE' | 'HALF_LINE' | 'FIVE_SIX' | 'TWO_THREE' | 'ONE_THREE' | 'THREE_FOUR' | 'ONE_FOUR' | 'ONE_SIX';
|
|
12
|
+
export declare type FormConfigItem = {
|
|
13
|
+
key: string;
|
|
14
|
+
layoutWidthEnum: FormConfigWidth;
|
|
15
|
+
type: FormConfigType;
|
|
16
|
+
name: string;
|
|
17
|
+
} & Partial<{
|
|
18
|
+
show: boolean;
|
|
19
|
+
defaultValue: any;
|
|
20
|
+
defaultExpand: boolean;
|
|
21
|
+
fold: boolean;
|
|
22
|
+
required: boolean;
|
|
23
|
+
editable: boolean;
|
|
24
|
+
notes: string;
|
|
25
|
+
desc: string;
|
|
26
|
+
children: FormConfigItem[];
|
|
27
|
+
}>;
|
|
11
28
|
export interface FormConfigTextFormatter {
|
|
12
|
-
(fieldItem:
|
|
29
|
+
(fieldItem: FormConfigItem, parsedText: string): string;
|
|
13
30
|
}
|
|
14
31
|
export interface FormConfigExpose {
|
|
15
|
-
loadData(payload: Record<'fieldList'
|
|
16
|
-
getData(): Record<'fieldList' | 'materialList',
|
|
32
|
+
loadData(payload: Record<'fieldList', FormConfigItem[]>): void;
|
|
33
|
+
getData(): Record<'fieldList' | 'materialList', FormConfigItem[]>;
|
|
17
34
|
}
|
|
18
35
|
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function layoutWidthEnum2Column(layoutWidthEnum) {
|
|
2
|
+
const transferMap = {
|
|
3
|
+
ALL_LINE: 12,
|
|
4
|
+
HALF_LINE: 6,
|
|
5
|
+
FIVE_SIX: 10,
|
|
6
|
+
TWO_THREE: 8,
|
|
7
|
+
ONE_THREE: 4,
|
|
8
|
+
THREE_FOUR: 9,
|
|
9
|
+
ONE_FOUR: 3,
|
|
10
|
+
ONE_SIX: 2
|
|
11
|
+
};
|
|
12
|
+
return transferMap[layoutWidthEnum] || 12;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { layoutWidthEnum2Column };
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
.form-config__material {
|
|
6
6
|
padding: 16px;
|
|
7
7
|
box-sizing: border-box;
|
|
8
|
+
flex-shrink: 0;
|
|
8
9
|
width: 200px;
|
|
9
10
|
background: white;
|
|
10
11
|
}
|
|
@@ -15,8 +16,12 @@
|
|
|
15
16
|
height: 40px;
|
|
16
17
|
}
|
|
17
18
|
.form-config__materialContent {
|
|
18
|
-
padding:
|
|
19
|
-
|
|
19
|
+
padding: 16px;
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
max-height: var(--max-height);
|
|
24
|
+
min-height: 200px;
|
|
20
25
|
display: flex;
|
|
21
26
|
flex-direction: column;
|
|
22
27
|
gap: 8px;
|
|
@@ -33,6 +38,8 @@
|
|
|
33
38
|
.form-config__displayWrapper {
|
|
34
39
|
padding: 16px;
|
|
35
40
|
box-sizing: border-box;
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
min-width: 400px;
|
|
36
43
|
flex: 1;
|
|
37
44
|
padding: 16px 0;
|
|
38
45
|
}
|
|
@@ -45,6 +52,9 @@
|
|
|
45
52
|
.form-config__displayContent {
|
|
46
53
|
padding: 16px;
|
|
47
54
|
box-sizing: border-box;
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
overflow-y: auto;
|
|
57
|
+
max-height: var(--max-height);
|
|
48
58
|
height: fit-content;
|
|
49
59
|
background: #eeeeee;
|
|
50
60
|
display: grid !important;
|
|
@@ -58,9 +68,23 @@
|
|
|
58
68
|
.form-config__config {
|
|
59
69
|
padding: 16px;
|
|
60
70
|
box-sizing: border-box;
|
|
71
|
+
flex-shrink: 0;
|
|
61
72
|
width: 220px;
|
|
62
73
|
background: white;
|
|
63
74
|
}
|
|
75
|
+
.form-config__configHeader {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: space-between;
|
|
79
|
+
height: 40px;
|
|
80
|
+
}
|
|
81
|
+
.form-config__configContent {
|
|
82
|
+
padding: 16px;
|
|
83
|
+
box-sizing: border-box;
|
|
84
|
+
flex-shrink: 0;
|
|
85
|
+
overflow-y: auto;
|
|
86
|
+
max-height: var(--max-height);
|
|
87
|
+
}
|
|
64
88
|
.form-config__renderer--default {
|
|
65
89
|
display: flex;
|
|
66
90
|
align-items: center;
|
|
@@ -29,6 +29,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
29
29
|
type: NumberConstructor;
|
|
30
30
|
default: number;
|
|
31
31
|
};
|
|
32
|
+
businessFormatter: {
|
|
33
|
+
type: import("vue").PropType<import("./src/types").FormBusinessFormatter>;
|
|
34
|
+
};
|
|
32
35
|
schema: {
|
|
33
36
|
type: import("vue").PropType<import("@formily/json-schema").Stringify<{
|
|
34
37
|
[key: symbol]: any;
|
|
@@ -141,6 +144,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
141
144
|
type: NumberConstructor;
|
|
142
145
|
default: number;
|
|
143
146
|
};
|
|
147
|
+
businessFormatter: {
|
|
148
|
+
type: import("vue").PropType<import("./src/types").FormBusinessFormatter>;
|
|
149
|
+
};
|
|
144
150
|
schema: {
|
|
145
151
|
type: import("vue").PropType<import("@formily/json-schema").Stringify<{
|
|
146
152
|
[key: symbol]: any;
|
|
@@ -1638,6 +1644,9 @@ declare const FormRender: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
1638
1644
|
type: NumberConstructor;
|
|
1639
1645
|
default: number;
|
|
1640
1646
|
};
|
|
1647
|
+
businessFormatter: {
|
|
1648
|
+
type: import("vue").PropType<import("./src/types").FormBusinessFormatter>;
|
|
1649
|
+
};
|
|
1641
1650
|
schema: {
|
|
1642
1651
|
type: import("vue").PropType<import("@formily/json-schema").Stringify<{
|
|
1643
1652
|
[key: symbol]: any;
|
|
@@ -30,6 +30,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30
30
|
maxHeight: { type: [Number, String], default: "" },
|
|
31
31
|
anchor: { type: Boolean, default: false },
|
|
32
32
|
parallelism: { type: Number, default: 3 },
|
|
33
|
+
businessFormatter: { type: Function },
|
|
33
34
|
schema: { type: Object },
|
|
34
35
|
components: {
|
|
35
36
|
type: Object,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
2
|
import { AnyObject } from '../../../../es/src/types';
|
|
3
3
|
import { Component, FunctionalComponent, nextTick, PropType } from 'vue';
|
|
4
|
-
import { FieldItem, FieldVisitor } from './types';
|
|
4
|
+
import { FieldItem, FieldVisitor, FormBusinessFormatter } from './types';
|
|
5
5
|
declare const _default: import("vue").DefineComponent<{
|
|
6
6
|
fieldList: {
|
|
7
7
|
type: PropType<FieldItem[]>;
|
|
@@ -29,6 +29,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
29
29
|
type: NumberConstructor;
|
|
30
30
|
default: number;
|
|
31
31
|
};
|
|
32
|
+
businessFormatter: {
|
|
33
|
+
type: PropType<FormBusinessFormatter>;
|
|
34
|
+
};
|
|
32
35
|
schema: {
|
|
33
36
|
type: PropType<import("@formily/vue").Stringify<{
|
|
34
37
|
[key: symbol]: any;
|
|
@@ -141,6 +144,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
141
144
|
type: NumberConstructor;
|
|
142
145
|
default: number;
|
|
143
146
|
};
|
|
147
|
+
businessFormatter: {
|
|
148
|
+
type: PropType<FormBusinessFormatter>;
|
|
149
|
+
};
|
|
144
150
|
schema: {
|
|
145
151
|
type: PropType<import("@formily/vue").Stringify<{
|
|
146
152
|
[key: symbol]: any;
|
|
@@ -1638,6 +1644,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1638
1644
|
type: NumberConstructor;
|
|
1639
1645
|
default: number;
|
|
1640
1646
|
};
|
|
1647
|
+
businessFormatter: {
|
|
1648
|
+
type: PropType<FormBusinessFormatter>;
|
|
1649
|
+
};
|
|
1641
1650
|
schema: {
|
|
1642
1651
|
type: PropType<import("@formily/vue").Stringify<{
|
|
1643
1652
|
[key: symbol]: any;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import { AnyObject,
|
|
2
|
-
import {
|
|
1
|
+
import { AnyObject, Func } from '../../../../../../es/src/types';
|
|
2
|
+
import { UrlConfig } from '../../../../../../es/packages/form-render';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
|
-
declare type DependKeyObj = {
|
|
5
|
-
paramName: string;
|
|
6
|
-
paramValue: string;
|
|
7
|
-
};
|
|
8
|
-
declare type UrlConfig = {
|
|
9
|
-
method?: FormRequestType;
|
|
10
|
-
nameKey?: string;
|
|
11
|
-
valueKey?: string;
|
|
12
|
-
dependKey?: ArrayAble<string> | Record<string, string> | ArrayAble<DependKeyObj>;
|
|
13
|
-
url: string;
|
|
14
|
-
};
|
|
15
4
|
export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
16
5
|
options: {
|
|
17
6
|
type: PropType<AnyObject[]>;
|
|
@@ -51,4 +40,3 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
51
40
|
}, {
|
|
52
41
|
options: AnyObject[];
|
|
53
42
|
}>;
|
|
54
|
-
export {};
|
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { AnyObject, Func } from '../../../../../../es/src/types';
|
|
2
|
-
import {
|
|
2
|
+
import { UrlConfig } from '../../types';
|
|
3
3
|
import { PropType } from 'vue';
|
|
4
|
-
declare type UrlConfig = {
|
|
5
|
-
method: FormRequestType;
|
|
6
|
-
dependKey?: string | string[];
|
|
7
|
-
nameKey: string;
|
|
8
|
-
url: string;
|
|
9
|
-
params?: AnyObject;
|
|
10
|
-
valueKey: string;
|
|
11
|
-
};
|
|
12
4
|
export declare const SELECT: import("vue").DefineComponent<{
|
|
13
5
|
value: {
|
|
14
6
|
type: StringConstructor;
|
|
@@ -53,4 +45,3 @@ export declare const SELECT: import("vue").DefineComponent<{
|
|
|
53
45
|
options: AnyObject[];
|
|
54
46
|
lazyRequest: boolean;
|
|
55
47
|
}>;
|
|
56
|
-
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, inject, nextTick, watch, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import { cloneDeep, isEqual } from 'lodash-es';
|
|
3
|
+
import { cloneDeep, isEqual, isString } from 'lodash-es';
|
|
4
4
|
import { useCommonInjection } from '../../../../../packages/form-render/src/hooks/useCommonInjection';
|
|
5
5
|
import { InjectAsyncQueue, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../constants/index.js';
|
|
6
|
+
import { formRenderLog } from '../../utils/index.js';
|
|
6
7
|
import { connect, mapProps } from '@formily/vue';
|
|
7
8
|
import { NSelect } from 'naive-ui';
|
|
8
9
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
@@ -61,9 +62,11 @@ const script = defineComponent({
|
|
|
61
62
|
}
|
|
62
63
|
if (remoteOptions.value)
|
|
63
64
|
return;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})
|
|
65
|
+
try {
|
|
66
|
+
remoteOptions.value = await asyncQueue.addAsync(await createParams(configFor(props), field.value, fieldKey.value));
|
|
67
|
+
} catch (e) {
|
|
68
|
+
isString(e) && formRenderLog(e, "warn");
|
|
69
|
+
}
|
|
67
70
|
async function createParams(config, field2, key) {
|
|
68
71
|
const _params = {};
|
|
69
72
|
try {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { Form } from '@formily/core';
|
|
2
|
+
import { FormBusinessFormatter } from '../../../../../es/packages/form-render';
|
|
2
3
|
import { FIELD_BUSINESS_TYPE } from '../constants';
|
|
3
4
|
export declare class BusinessCollector {
|
|
4
5
|
private formModel;
|
|
6
|
+
private businessFormatter?;
|
|
5
7
|
private readonly typeCollector;
|
|
6
8
|
private readonly fieldNameCollector;
|
|
7
|
-
constructor(formModel: Form);
|
|
9
|
+
constructor(formModel: Form, businessFormatter?: FormBusinessFormatter | undefined);
|
|
10
|
+
private formatter;
|
|
8
11
|
collect(type: FIELD_BUSINESS_TYPE, fieldName: string): void;
|
|
9
12
|
private getField;
|
|
10
13
|
private getType;
|
|
@@ -19,5 +22,5 @@ export declare class BusinessCollector {
|
|
|
19
22
|
trigger(fieldName: string, triggerType?: 'change' | 'blur'): void;
|
|
20
23
|
}
|
|
21
24
|
export declare function useBusinessBinding(): {
|
|
22
|
-
create: (formModel: Form) => BusinessCollector;
|
|
25
|
+
create: (formModel: Form, formatter?: FormBusinessFormatter) => BusinessCollector;
|
|
23
26
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { isField } from '@formily/core';
|
|
2
2
|
import { isString } from '@vueuse/core';
|
|
3
|
-
import { isNumber } from 'lodash-es';
|
|
3
|
+
import { isFunction, isNumber } from 'lodash-es';
|
|
4
4
|
import { FIELD_BUSINESS_TYPE } from '../constants/index.js';
|
|
5
5
|
import { isIdCard, parseIdCard, parseAge2FromContext, parseBirthday, parseAge2Birthday } from '../utils/business.js';
|
|
6
6
|
|
|
7
7
|
class BusinessCollector {
|
|
8
|
-
constructor(formModel) {
|
|
8
|
+
constructor(formModel, businessFormatter) {
|
|
9
9
|
this.formModel = formModel;
|
|
10
|
+
this.businessFormatter = businessFormatter;
|
|
10
11
|
this.typeCollector = /* @__PURE__ */ new Map();
|
|
11
12
|
this.fieldNameCollector = /* @__PURE__ */ new Map();
|
|
12
13
|
this.handlerChangeMap = /* @__PURE__ */ new Map([
|
|
@@ -18,6 +19,9 @@ class BusinessCollector {
|
|
|
18
19
|
[FIELD_BUSINESS_TYPE.AGE, this.handlerAgeType.bind(this)]
|
|
19
20
|
]);
|
|
20
21
|
}
|
|
22
|
+
formatter(...args) {
|
|
23
|
+
return isFunction(this.businessFormatter) ? this.businessFormatter(...args) : args[0].value;
|
|
24
|
+
}
|
|
21
25
|
collect(type, fieldName) {
|
|
22
26
|
this.typeCollector.set(type, fieldName);
|
|
23
27
|
this.fieldNameCollector.set(fieldName, type);
|
|
@@ -41,7 +45,7 @@ class BusinessCollector {
|
|
|
41
45
|
field && this.formModel.setFieldState(field, (state) => {
|
|
42
46
|
if (!force && state.value)
|
|
43
47
|
return;
|
|
44
|
-
state.value = value;
|
|
48
|
+
state.value = this.formatter({ value, type, fieldKey: field });
|
|
45
49
|
});
|
|
46
50
|
}
|
|
47
51
|
handlerIdCardType() {
|
|
@@ -80,8 +84,8 @@ class BusinessCollector {
|
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
function useBusinessBinding() {
|
|
83
|
-
function create(formModel) {
|
|
84
|
-
return new BusinessCollector(formModel);
|
|
87
|
+
function create(formModel, formatter) {
|
|
88
|
+
return new BusinessCollector(formModel, formatter);
|
|
85
89
|
}
|
|
86
90
|
return { create };
|
|
87
91
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
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';
|
|
4
|
+
import { arrayed, parseNumberFromMaybeString, formRenderLog } from '../utils/index.js';
|
|
5
5
|
import { fieldKeyEscape, createLinebarId, elementIdEscape } from '../utils/schema.js';
|
|
6
6
|
import { transformDateFormat } from '../utils/business.js';
|
|
7
7
|
|
|
@@ -158,7 +158,10 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
158
158
|
};
|
|
159
159
|
const createComplexSchema = (item) => {
|
|
160
160
|
const schema = createStandardSchema(item);
|
|
161
|
-
|
|
161
|
+
if (Array.isArray(item.properties)) {
|
|
162
|
+
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");
|
|
163
|
+
}
|
|
164
|
+
const properties = Array.isArray(item.properties || item.children) ? schemaAdaptor(item.properties || item.children) : {};
|
|
162
165
|
schema.type = item.fieldType || "void";
|
|
163
166
|
schema.properties = properties;
|
|
164
167
|
Object.assign(schema["x-decorator-props"], { showFeedback: false });
|
|
@@ -34,7 +34,7 @@ function useFormContext(props, formModel) {
|
|
|
34
34
|
},
|
|
35
35
|
scope: Object.assign({}, usePresetScope(), props.scope)
|
|
36
36
|
}).SchemaField);
|
|
37
|
-
const businessCollector = useBusinessBinding().create(formModel);
|
|
37
|
+
const businessCollector = useBusinessBinding().create(formModel, props.businessFormatter);
|
|
38
38
|
provide(InjectionBusinessCollector, businessCollector);
|
|
39
39
|
const changeContextCollector = useChangeContext().create();
|
|
40
40
|
provide(InjectionChangeContextCollector, changeContextCollector);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyObject, ArrayAble } from '../../../../../es/src/types';
|
|
2
2
|
import { SchemaTypes } from '@formily/vue';
|
|
3
3
|
import { CSSProperties, VNode } from 'vue';
|
|
4
|
-
import { DependKeyType, FormCommonState } from '../../../../../es/packages/form-render';
|
|
4
|
+
import { DependKeyType, FormCommonState, FormRequestType } from '../../../../../es/packages/form-render';
|
|
5
5
|
declare type FieldBusinessType = 'password' | 'id_card' | 'age' | 'age_unit' | 'mobile' | 'telephone' | 'email' | 'sex' | 'birthday' | 'bank_card' | 'website' | 'gestational_weeks' | 'gestational_stage' | 'customer_name';
|
|
6
6
|
export declare type ValidateItem = Partial<{
|
|
7
7
|
/**
|
|
@@ -36,6 +36,15 @@ interface FormRendererPayload {
|
|
|
36
36
|
export interface FormRenderer {
|
|
37
37
|
(payload: FormRendererPayload): ArrayAble<VNode> | any;
|
|
38
38
|
}
|
|
39
|
+
export declare type UrlConfig = {
|
|
40
|
+
url: string;
|
|
41
|
+
} & Partial<{
|
|
42
|
+
method?: FormRequestType;
|
|
43
|
+
nameKey?: string;
|
|
44
|
+
valueKey?: string;
|
|
45
|
+
params?: AnyObject;
|
|
46
|
+
dependKey?: DependKeyType;
|
|
47
|
+
}>;
|
|
39
48
|
interface SwitchProperty {
|
|
40
49
|
value?: any;
|
|
41
50
|
describe?: string;
|
|
@@ -141,17 +150,7 @@ export declare type FieldItem = {
|
|
|
141
150
|
* slider控件间距
|
|
142
151
|
*/
|
|
143
152
|
step_length: string | number;
|
|
144
|
-
urlConfig:
|
|
145
|
-
url: string;
|
|
146
|
-
method: 'post' | 'get' | 'put' | 'patch' | 'delete';
|
|
147
|
-
/**
|
|
148
|
-
* 请求参数依赖关系
|
|
149
|
-
*/
|
|
150
|
-
dependKey: DependKeyType;
|
|
151
|
-
params: AnyObject;
|
|
152
|
-
nameKey: string;
|
|
153
|
-
valueKey: string;
|
|
154
|
-
}>;
|
|
153
|
+
urlConfig: UrlConfig;
|
|
155
154
|
/**
|
|
156
155
|
* 控件组
|
|
157
156
|
*/
|
|
@@ -2,6 +2,7 @@ import { AnyObject, WithUndefined } 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';
|
|
5
|
+
import { FIELD_BUSINESS_TYPE } from '../../../../../es/packages/form-render/src/constants';
|
|
5
6
|
import { FieldItem } from '../types';
|
|
6
7
|
import { AsyncQueue } from '../hooks';
|
|
7
8
|
export * from './fieldItem';
|
|
@@ -69,4 +70,10 @@ export declare type FormRenderProps = Partial<{
|
|
|
69
70
|
consumer: boolean;
|
|
70
71
|
uuid: string;
|
|
71
72
|
lifeCycle: FormRenderLifeCycle;
|
|
73
|
+
businessFormatter: FormBusinessFormatter;
|
|
72
74
|
}>;
|
|
75
|
+
export declare type FormBusinessFormatter = (payload: {
|
|
76
|
+
fieldKey: string;
|
|
77
|
+
value: unknown;
|
|
78
|
+
type: FIELD_BUSINESS_TYPE;
|
|
79
|
+
}) => unknown;
|