cnhis-design-vue 3.1.16-beta.8 → 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/form-config/index.d.ts +77 -3330
- package/es/packages/form-config/src/FormConfig.js +42 -34
- package/es/packages/form-config/src/FormConfig.vue.d.ts +121 -3374
- package/es/packages/form-config/src/components/FormConfigCreator.js +13 -11
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +10 -7
- package/es/packages/form-config/src/components/FormConfigEdit.js +1 -1
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +56 -28
- 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/src/hooks/useFieldListAdaptor.js +5 -2
- package/es/packages/index.css +26 -2
- package/global.d.ts +8 -8
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -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 });
|
package/es/packages/index.css
CHANGED
|
@@ -3184,6 +3184,7 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
3184
3184
|
.form-config__material {
|
|
3185
3185
|
padding: 16px;
|
|
3186
3186
|
box-sizing: border-box;
|
|
3187
|
+
flex-shrink: 0;
|
|
3187
3188
|
width: 200px;
|
|
3188
3189
|
background: white;
|
|
3189
3190
|
}
|
|
@@ -3194,8 +3195,12 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
3194
3195
|
height: 40px;
|
|
3195
3196
|
}
|
|
3196
3197
|
.form-config__materialContent {
|
|
3197
|
-
padding:
|
|
3198
|
-
|
|
3198
|
+
padding: 16px;
|
|
3199
|
+
box-sizing: border-box;
|
|
3200
|
+
flex-shrink: 0;
|
|
3201
|
+
overflow-y: auto;
|
|
3202
|
+
max-height: var(--max-height);
|
|
3203
|
+
min-height: 200px;
|
|
3199
3204
|
display: flex;
|
|
3200
3205
|
flex-direction: column;
|
|
3201
3206
|
gap: 8px;
|
|
@@ -3212,6 +3217,8 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
3212
3217
|
.form-config__displayWrapper {
|
|
3213
3218
|
padding: 16px;
|
|
3214
3219
|
box-sizing: border-box;
|
|
3220
|
+
flex-shrink: 0;
|
|
3221
|
+
min-width: 400px;
|
|
3215
3222
|
flex: 1;
|
|
3216
3223
|
padding: 16px 0;
|
|
3217
3224
|
}
|
|
@@ -3224,6 +3231,9 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
3224
3231
|
.form-config__displayContent {
|
|
3225
3232
|
padding: 16px;
|
|
3226
3233
|
box-sizing: border-box;
|
|
3234
|
+
flex-shrink: 0;
|
|
3235
|
+
overflow-y: auto;
|
|
3236
|
+
max-height: var(--max-height);
|
|
3227
3237
|
height: fit-content;
|
|
3228
3238
|
background: #eeeeee;
|
|
3229
3239
|
display: grid !important;
|
|
@@ -3237,9 +3247,23 @@ body > .vxe-table--tooltip-wrapper {
|
|
|
3237
3247
|
.form-config__config {
|
|
3238
3248
|
padding: 16px;
|
|
3239
3249
|
box-sizing: border-box;
|
|
3250
|
+
flex-shrink: 0;
|
|
3240
3251
|
width: 220px;
|
|
3241
3252
|
background: white;
|
|
3242
3253
|
}
|
|
3254
|
+
.form-config__configHeader {
|
|
3255
|
+
display: flex;
|
|
3256
|
+
align-items: center;
|
|
3257
|
+
justify-content: space-between;
|
|
3258
|
+
height: 40px;
|
|
3259
|
+
}
|
|
3260
|
+
.form-config__configContent {
|
|
3261
|
+
padding: 16px;
|
|
3262
|
+
box-sizing: border-box;
|
|
3263
|
+
flex-shrink: 0;
|
|
3264
|
+
overflow-y: auto;
|
|
3265
|
+
max-height: var(--max-height);
|
|
3266
|
+
}
|
|
3243
3267
|
.form-config__renderer--default {
|
|
3244
3268
|
display: flex;
|
|
3245
3269
|
align-items: center;
|
package/global.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as NaiveUI from 'naive-ui';
|
|
2
|
-
|
|
3
|
-
declare module 'naive-ui' {
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
export const NTree: any;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export {};
|
|
1
|
+
import * as NaiveUI from 'naive-ui';
|
|
2
|
+
|
|
3
|
+
declare module 'naive-ui' {
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
export const NTree: any;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export {};
|