cnhis-design-vue 3.1.23-beta.11 → 3.1.23-beta.13
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/components/fabric-chart/src/hooks/useEvent2.js +18 -4
- package/es/components/form-config/index.d.ts +1 -0
- package/es/components/form-config/src/FormConfig.vue.d.ts +1 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +1 -0
- package/es/components/form-render/src/components/renderer/levelSearchCascade.d.ts +2 -0
- package/es/components/form-render/src/components/renderer/levelSearchCascade.js +23 -15
- package/es/components/form-render/src/components/renderer/search.d.ts +2 -0
- package/es/components/form-render/src/components/renderer/search.js +1 -0
- package/es/components/form-render/src/components/renderer/searchCascade.js +1 -0
- package/es/components/form-render/src/components/renderer/select.js +1 -0
- package/es/components/form-render/src/types/fieldItem.d.ts +1 -0
- package/es/components/iho-table/src/components/IhoTableColumn.js +1 -1
- package/es/components/iho-table/src/plugins/defaultConfigPlugin/index2.js +1 -1
- package/es/components/iho-table/src/plugins/index.d.ts +1 -0
- package/es/components/iho-table/src/plugins/index.js +1 -0
- package/es/components/iho-table/src/plugins/index2.js +1 -0
- package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index2.js +1 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/checkRendererPlugin.js +2 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/labelRendererPlugin.js +2 -0
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/pictureRendererPlugin.js +3 -1
- package/es/components/iho-table/src/plugins/rendererPlugins/widgets/seqRendererPlugin.js +16 -26
- package/es/components/iho-table/src/plugins/virtualTreePlugin/index.d.ts +1 -0
- package/es/components/iho-table/src/plugins/virtualTreePlugin/index.js +1 -0
- package/es/components/iho-table/src/plugins/virtualTreePlugin/index2.js +84 -0
- package/es/components/iho-table/src/types/index.d.ts +1 -0
- package/es/components/shortcut-setter/index.d.ts +1 -0
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -0
- package/es/shared/utils/index.d.ts +2 -1
- package/es/shared/utils/index.js +1 -1
- package/es/shared/utils/index2.js +5 -4
- package/package.json +2 -2
|
@@ -18,13 +18,13 @@ function useCanvasEvent(canvas, propItems, emits) {
|
|
|
18
18
|
width,
|
|
19
19
|
height,
|
|
20
20
|
stroke: "transparent",
|
|
21
|
-
strokeWidth: 1,
|
|
22
21
|
fill: "transparent",
|
|
23
22
|
lockMovementX: true,
|
|
24
23
|
lockMovementY: true,
|
|
25
24
|
transparentCorners: false,
|
|
26
25
|
hasControls: false,
|
|
27
|
-
...selectionStyle
|
|
26
|
+
...selectionStyle,
|
|
27
|
+
strokeWidth: 0
|
|
28
28
|
});
|
|
29
29
|
canvas.value.add(rect);
|
|
30
30
|
return rect;
|
|
@@ -77,12 +77,15 @@ function useCanvasEvent(canvas, propItems, emits) {
|
|
|
77
77
|
if (button == 1) {
|
|
78
78
|
const _key = obj.key.replace("All", "");
|
|
79
79
|
const key = pointer.x <= originX ? _key + "Title" : _key;
|
|
80
|
+
obj.sendToBack();
|
|
80
81
|
select(key);
|
|
81
82
|
emits("select", key);
|
|
82
83
|
}
|
|
83
84
|
});
|
|
84
85
|
} else {
|
|
85
86
|
obj.on("mousedown", () => {
|
|
87
|
+
resetStrokeWidth();
|
|
88
|
+
setActiveObj(obj);
|
|
86
89
|
emits("select", obj.key);
|
|
87
90
|
});
|
|
88
91
|
setTimeout(() => {
|
|
@@ -95,18 +98,19 @@ function useCanvasEvent(canvas, propItems, emits) {
|
|
|
95
98
|
}
|
|
96
99
|
function addSelectionListener() {
|
|
97
100
|
canvas.value.on("selection:cleared", selectionCB);
|
|
98
|
-
canvas.value.on("selection:updated", selectionCB);
|
|
99
101
|
function selectionCB(event) {
|
|
100
102
|
const { deselected = [] } = event;
|
|
101
103
|
deselected.forEach((obj) => {
|
|
104
|
+
obj.set("strokeWidth", 0);
|
|
102
105
|
obj.key.endsWith("All") && obj.sendToBack();
|
|
103
106
|
});
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
function select(key) {
|
|
107
110
|
canvas.value.discardActiveObject().renderAll();
|
|
111
|
+
resetStrokeWidth();
|
|
108
112
|
const obj = selections == null ? void 0 : selections.find((obj2) => obj2.key === key);
|
|
109
|
-
obj
|
|
113
|
+
setActiveObj(obj);
|
|
110
114
|
obj && canvas.value.setActiveObject(obj);
|
|
111
115
|
}
|
|
112
116
|
function init() {
|
|
@@ -115,6 +119,16 @@ function useCanvasEvent(canvas, propItems, emits) {
|
|
|
115
119
|
selections = initSelection();
|
|
116
120
|
addSelectionListener();
|
|
117
121
|
}
|
|
122
|
+
function resetStrokeWidth() {
|
|
123
|
+
selections.forEach((obj) => {
|
|
124
|
+
obj.set("strokeWidth", 0);
|
|
125
|
+
obj.key.endsWith("All") && obj.sendToBack();
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function setActiveObj(obj) {
|
|
129
|
+
var _a;
|
|
130
|
+
obj == null ? void 0 : obj.bringToFront().set("strokeWidth", (_a = selectionStyle.strokeWidth) != null ? _a : 2);
|
|
131
|
+
}
|
|
118
132
|
init();
|
|
119
133
|
return { select };
|
|
120
134
|
}
|
|
@@ -938,6 +938,7 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
938
938
|
name?: string | undefined;
|
|
939
939
|
render_key?: string[] | undefined;
|
|
940
940
|
search_key?: string[] | undefined;
|
|
941
|
+
primary_key?: string | undefined;
|
|
941
942
|
type?: string | undefined;
|
|
942
943
|
value_key?: string | undefined;
|
|
943
944
|
level_key?: string | undefined;
|
|
@@ -940,6 +940,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
940
940
|
name?: string | undefined;
|
|
941
941
|
render_key?: string[] | undefined;
|
|
942
942
|
search_key?: string[] | undefined;
|
|
943
|
+
primary_key?: string | undefined;
|
|
943
944
|
type?: string | undefined;
|
|
944
945
|
value_key?: string | undefined;
|
|
945
946
|
level_key?: string | undefined;
|
|
@@ -67,6 +67,7 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
67
67
|
name?: string | undefined;
|
|
68
68
|
render_key?: string[] | undefined;
|
|
69
69
|
search_key?: string[] | undefined;
|
|
70
|
+
primary_key?: string | undefined;
|
|
70
71
|
type?: string | undefined;
|
|
71
72
|
value_key?: string | undefined;
|
|
72
73
|
level_key?: string | undefined;
|
|
@@ -24,6 +24,7 @@ export declare const LEVEL_SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
24
24
|
name: string;
|
|
25
25
|
render_key: string[];
|
|
26
26
|
search_key: string[];
|
|
27
|
+
primary_key: string;
|
|
27
28
|
type: string;
|
|
28
29
|
value_key: string;
|
|
29
30
|
level_key: string;
|
|
@@ -62,6 +63,7 @@ export declare const LEVEL_SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
62
63
|
name: string;
|
|
63
64
|
render_key: string[];
|
|
64
65
|
search_key: string[];
|
|
66
|
+
primary_key: string;
|
|
65
67
|
type: string;
|
|
66
68
|
value_key: string;
|
|
67
69
|
level_key: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineComponent, computed, ref, inject, watch, createVNode } from 'vue';
|
|
2
|
-
import { arrayed } from '../../../../../shared/utils/index2.js';
|
|
3
2
|
import { isEqual, isString, isEmpty } from 'lodash-es';
|
|
4
3
|
import '../../../index2.js';
|
|
5
4
|
import { InjectAsyncQueue } from '../../constants/index2.js';
|
|
@@ -74,7 +73,7 @@ const script = defineComponent({
|
|
|
74
73
|
valueRef.value = createOptionValue(node);
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
const result = await asyncQueue.addAsync(createParams(props.wordbook, props.autograph, field.value, fieldKey.value));
|
|
76
|
+
const result = await asyncQueue.addAsync(createParams(props.wordbook, props.autograph, field.value, node, fieldKey.value));
|
|
78
77
|
if (!node) {
|
|
79
78
|
optionsRef.value = result.map((option) => {
|
|
80
79
|
option.__keyword = !!keyword;
|
|
@@ -137,13 +136,15 @@ const script = defineComponent({
|
|
|
137
136
|
function parseLinkFromString2List(linkString) {
|
|
138
137
|
return linkString.split("_").filter((s) => s);
|
|
139
138
|
}
|
|
140
|
-
function createParams(wordbook, autograph, field2, key2) {
|
|
139
|
+
function createParams(wordbook, autograph, field2, node2, key2) {
|
|
141
140
|
const params = {
|
|
142
141
|
autograph,
|
|
143
142
|
wordbookId: wordbook.id,
|
|
144
143
|
wordbookType: wordbook.type,
|
|
145
144
|
fieldKeys: wordbook.search_key ? JSON.stringify(wordbook.search_key) : void 0,
|
|
146
|
-
conObj:
|
|
145
|
+
conObj: JSON.stringify(createConfigObject(wordbook), node2),
|
|
146
|
+
primaryKey: wordbook.primary_key,
|
|
147
|
+
levelKey: wordbook.level_key,
|
|
147
148
|
keyword,
|
|
148
149
|
page: 1
|
|
149
150
|
};
|
|
@@ -152,19 +153,24 @@ const script = defineComponent({
|
|
|
152
153
|
params,
|
|
153
154
|
key: key2
|
|
154
155
|
};
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
}
|
|
157
|
+
function createConfigObject(wordbook, node2) {
|
|
158
|
+
if (!node2)
|
|
159
|
+
return wordbook.conObjFirstLevel || [];
|
|
160
|
+
return [{
|
|
161
|
+
con: "EQ",
|
|
162
|
+
is_compare_field: false,
|
|
163
|
+
field_key: wordbook.level_key,
|
|
164
|
+
value: node2[valueKey.value]
|
|
165
|
+
}];
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
async function fetchPrimaryKeyValue(primaryKeys) {
|
|
164
169
|
if (!getSearchRequestInfo().primaryKeyUrl)
|
|
165
170
|
return [];
|
|
166
171
|
try {
|
|
167
|
-
|
|
172
|
+
const params = createParams(props.wordbook, props.autograph, primaryKeys, fieldKey.value);
|
|
173
|
+
return await asyncQueue.addAsync(params);
|
|
168
174
|
} catch (e) {
|
|
169
175
|
isString(e) && formRenderLog(e);
|
|
170
176
|
}
|
|
@@ -172,10 +178,12 @@ const script = defineComponent({
|
|
|
172
178
|
const requestInfo = getSearchRequestInfo();
|
|
173
179
|
return {
|
|
174
180
|
key: key2,
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
181
|
+
params: {
|
|
182
|
+
autograph,
|
|
183
|
+
tableId: wordbook.id,
|
|
184
|
+
primaryKeyValue: primaryKeys2.join(","),
|
|
185
|
+
page: 1
|
|
186
|
+
},
|
|
179
187
|
...requestInfo,
|
|
180
188
|
url: requestInfo.primaryKeyUrl
|
|
181
189
|
};
|
|
@@ -19,6 +19,7 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
19
19
|
name: string;
|
|
20
20
|
render_key: string[];
|
|
21
21
|
search_key: string[];
|
|
22
|
+
primary_key: string;
|
|
22
23
|
type: string;
|
|
23
24
|
value_key: string;
|
|
24
25
|
level_key: string;
|
|
@@ -53,6 +54,7 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
53
54
|
name: string;
|
|
54
55
|
render_key: string[];
|
|
55
56
|
search_key: string[];
|
|
57
|
+
primary_key: string;
|
|
56
58
|
type: string;
|
|
57
59
|
value_key: string;
|
|
58
60
|
level_key: string;
|
|
@@ -3,6 +3,7 @@ import { useDebounceFn } from '@vueuse/core';
|
|
|
3
3
|
import { isString, cloneDeep, isEqual } from 'lodash-es';
|
|
4
4
|
import { useCommonInjection } from '../../hooks/useCommonInjection2.js';
|
|
5
5
|
import { InjectAsyncQueue, InjectionChangeContextCollector } from '../../constants/index2.js';
|
|
6
|
+
import '../../../../../shared/utils/index2.js';
|
|
6
7
|
import '../../../index2.js';
|
|
7
8
|
import { formRenderLog, optionMatcher } from '../../utils/index.js';
|
|
8
9
|
import { useFormRequest } from '../../hooks/useFormRequest2.js';
|
|
@@ -3,6 +3,7 @@ import { isField } from '@formily/core';
|
|
|
3
3
|
import { isEqual, isArray } from 'lodash-es';
|
|
4
4
|
import { useCommonInjection } from '../../hooks/useCommonInjection2.js';
|
|
5
5
|
import { InjectAsyncQueue } from '../../constants/index2.js';
|
|
6
|
+
import '../../../../../shared/utils/index2.js';
|
|
6
7
|
import '@vueuse/core';
|
|
7
8
|
import '../../../index2.js';
|
|
8
9
|
import '../../utils/index.js';
|
|
@@ -4,6 +4,7 @@ import { useDebounceFn } from '@vueuse/core';
|
|
|
4
4
|
import { isString, cloneDeep, isEqual } from 'lodash-es';
|
|
5
5
|
import { useCommonInjection } from '../../hooks/useCommonInjection2.js';
|
|
6
6
|
import { InjectAsyncQueue, InjectionChangeContextCollector, InjectionFormItemDepsCollector } from '../../constants/index2.js';
|
|
7
|
+
import '../../../../../shared/utils/index2.js';
|
|
7
8
|
import '../../../index2.js';
|
|
8
9
|
import { formRenderLog, optionMatcher } from '../../utils/index.js';
|
|
9
10
|
import { useFormField } from '../../hooks/useFormField2.js';
|
|
@@ -13,7 +13,7 @@ const ColumnComponent = defineComponent({
|
|
|
13
13
|
const VxeColumn = resolveComponent("vxe-column");
|
|
14
14
|
const VxeColumnGroup = resolveComponent("vxe-colgroup");
|
|
15
15
|
function renderColumn(field) {
|
|
16
|
-
return createVNode(VxeColumn, field,
|
|
16
|
+
return createVNode(VxeColumn, field, field.slots);
|
|
17
17
|
}
|
|
18
18
|
function renderColumnGroup(group, children) {
|
|
19
19
|
return createVNode(VxeColumnGroup, omit(group, ["children"]), {
|
|
@@ -14,7 +14,7 @@ function defaultConfigPlugin() {
|
|
|
14
14
|
showSeq: true,
|
|
15
15
|
selectType: "checkbox",
|
|
16
16
|
columnConfig: { resizable: true },
|
|
17
|
-
rowConfig: { height:
|
|
17
|
+
rowConfig: { height: 48, isHover: true, isCurrent: true, keyField: "theUniqueKey" },
|
|
18
18
|
editConfig: {
|
|
19
19
|
trigger: "click",
|
|
20
20
|
mode: "cell",
|
|
@@ -12,3 +12,4 @@ export { selectRendererPlugin } from './rendererPlugins/editableWidgets/selectRe
|
|
|
12
12
|
export { dateRendererPlugin } from './rendererPlugins/editableWidgets/dateRendererPlugin/index.js';
|
|
13
13
|
export { timeRendererPlugin } from './rendererPlugins/editableWidgets/timeRendererPlugin/index.js';
|
|
14
14
|
export { rowGroupSettingPlugin } from './rowGroupSettingPlugin/index2.js';
|
|
15
|
+
export { virtualTreePlugin } from './virtualTreePlugin/index2.js';
|
|
@@ -12,3 +12,4 @@ export { selectRendererPlugin } from './rendererPlugins/editableWidgets/selectRe
|
|
|
12
12
|
export { dateRendererPlugin } from './rendererPlugins/editableWidgets/dateRendererPlugin/index.js';
|
|
13
13
|
export { timeRendererPlugin } from './rendererPlugins/editableWidgets/timeRendererPlugin/index.js';
|
|
14
14
|
export { rowGroupSettingPlugin } from './rowGroupSettingPlugin/index2.js';
|
|
15
|
+
export { virtualTreePlugin } from './virtualTreePlugin/index2.js';
|
|
@@ -15,6 +15,8 @@ function labelRendererPlugin() {
|
|
|
15
15
|
column
|
|
16
16
|
}) {
|
|
17
17
|
try {
|
|
18
|
+
if (!row[column.field])
|
|
19
|
+
return [];
|
|
18
20
|
const value = JSON.parse(row[column.field]);
|
|
19
21
|
const labels = isArray(value.labels) ? value.labels : parseLabelString(value.labelStr);
|
|
20
22
|
return labels.map(renderLabelItem);
|
package/es/components/iho-table/src/plugins/rendererPlugins/widgets/pictureRendererPlugin.js
CHANGED
|
@@ -19,8 +19,10 @@ function pictureRendererPlugin() {
|
|
|
19
19
|
column
|
|
20
20
|
}) {
|
|
21
21
|
try {
|
|
22
|
+
if (!row[column.field])
|
|
23
|
+
return [];
|
|
22
24
|
const value = JSON.parse(row[column.field]);
|
|
23
|
-
const height = getRowHeight();
|
|
25
|
+
const height = getRowHeight() - 16;
|
|
24
26
|
return [createVNode("section", {
|
|
25
27
|
"style": "display:flex;justify-content:center"
|
|
26
28
|
}, [createVNode(ViewerImage, {
|
|
@@ -2,34 +2,13 @@ import { inject, createVNode } from 'vue';
|
|
|
2
2
|
import { SettingsSharp } from '@vicons/ionicons5';
|
|
3
3
|
import { NIcon } from 'naive-ui';
|
|
4
4
|
import '../../../../index2.js';
|
|
5
|
-
import {
|
|
5
|
+
import { InjectionIhoTableEmits } from '../../../constants/index2.js';
|
|
6
6
|
import { defineTablePlugin } from '../../../hooks/useTablePlugin2.js';
|
|
7
7
|
|
|
8
8
|
function seqRendererPlugin() {
|
|
9
9
|
const pluginName = "seqRendererPlugin";
|
|
10
10
|
return defineTablePlugin({
|
|
11
11
|
name: pluginName,
|
|
12
|
-
vxe(instance) {
|
|
13
|
-
instance.renderer.add(WIDGET_TYPE.SEQUENCE, {
|
|
14
|
-
renderCell(renderOpts, {
|
|
15
|
-
$rowIndex
|
|
16
|
-
}) {
|
|
17
|
-
return [`${$rowIndex}`];
|
|
18
|
-
},
|
|
19
|
-
renderHeader() {
|
|
20
|
-
const emits = inject(InjectionIhoTableEmits);
|
|
21
|
-
function onClick() {
|
|
22
|
-
emits && emits("settingClick");
|
|
23
|
-
}
|
|
24
|
-
return [createVNode(NIcon, {
|
|
25
|
-
"size": "14",
|
|
26
|
-
"color": "#777",
|
|
27
|
-
"component": SettingsSharp,
|
|
28
|
-
"onClick": onClick
|
|
29
|
-
}, null)];
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
12
|
apply(hooks) {
|
|
34
13
|
hooks.fieldHooks.field.tap(pluginName, (field, {
|
|
35
14
|
index,
|
|
@@ -39,10 +18,21 @@ function seqRendererPlugin() {
|
|
|
39
18
|
insertBefore({
|
|
40
19
|
align: "center",
|
|
41
20
|
fixed: "left",
|
|
42
|
-
width:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
21
|
+
width: 50,
|
|
22
|
+
type: "seq",
|
|
23
|
+
slots: {
|
|
24
|
+
header() {
|
|
25
|
+
const emits = inject(InjectionIhoTableEmits);
|
|
26
|
+
function onClick() {
|
|
27
|
+
emits && emits("settingClick");
|
|
28
|
+
}
|
|
29
|
+
return [createVNode(NIcon, {
|
|
30
|
+
"size": "14",
|
|
31
|
+
"color": "#777",
|
|
32
|
+
"component": SettingsSharp,
|
|
33
|
+
"onClick": onClick
|
|
34
|
+
}, null)];
|
|
35
|
+
}
|
|
46
36
|
}
|
|
47
37
|
});
|
|
48
38
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function virtualTreePlugin(): import("../../../../../../es/components/iho-table").TablePlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { virtualTreePlugin } from './index2.js';
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { DMZ, traverse, uuidGenerator } from '../../../../../shared/utils/index2.js';
|
|
2
|
+
import { isArray, isFunction } from 'lodash-es';
|
|
3
|
+
import { onBeforeUnmount } from 'vue';
|
|
4
|
+
import '../../../index2.js';
|
|
5
|
+
import { defineTablePlugin } from '../../hooks/useTablePlugin2.js';
|
|
6
|
+
|
|
7
|
+
function virtualTreePlugin() {
|
|
8
|
+
const pluginName = "virtualTreePlugin";
|
|
9
|
+
const treeNodeColumnIndexMap = /* @__PURE__ */ new Map();
|
|
10
|
+
return defineTablePlugin({
|
|
11
|
+
name: pluginName,
|
|
12
|
+
apply(hooks) {
|
|
13
|
+
hooks.dataHooks.data.tap(pluginName, (rowData, context, config) => {
|
|
14
|
+
const {
|
|
15
|
+
transform,
|
|
16
|
+
rowField = "__parentId",
|
|
17
|
+
parentField = "parentId",
|
|
18
|
+
children = "childrenList"
|
|
19
|
+
} = config.treeConfig || DMZ;
|
|
20
|
+
if (!transform)
|
|
21
|
+
return;
|
|
22
|
+
enrichRowData(rowData);
|
|
23
|
+
if (!isArray(rowData[children]))
|
|
24
|
+
return;
|
|
25
|
+
traverse(rowData[children], (item, _, parent) => {
|
|
26
|
+
parent && (item[parentField] = parent[rowField]);
|
|
27
|
+
context.insertAfter(item);
|
|
28
|
+
enrichRowData(item);
|
|
29
|
+
}, children, rowData);
|
|
30
|
+
function enrichRowData(rowData2) {
|
|
31
|
+
rowData2[rowField] = rowData2[rowField] || rowData2.theUniqueKey || uuidGenerator();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
hooks.fieldHooks.fieldList.tap(pluginName, (fieldList, config) => {
|
|
35
|
+
const { transform } = config.treeConfig || DMZ;
|
|
36
|
+
if (transform && config.uuid) {
|
|
37
|
+
const treeNodeColumnIndex = fieldList.findIndex((field) => field.treeNode);
|
|
38
|
+
treeNodeColumnIndexMap.set(config.uuid, {
|
|
39
|
+
index: ~treeNodeColumnIndex ? treeNodeColumnIndex : 0,
|
|
40
|
+
length: fieldList.length
|
|
41
|
+
});
|
|
42
|
+
!~treeNodeColumnIndex && Reflect.set(fieldList[0], "treeNode", true);
|
|
43
|
+
}
|
|
44
|
+
return fieldList;
|
|
45
|
+
});
|
|
46
|
+
hooks.configHooks.config.tap(pluginName, (config) => {
|
|
47
|
+
const { transform, parentField = "parentId", rowField = "__parentId" } = config.treeConfig || DMZ;
|
|
48
|
+
if (!transform)
|
|
49
|
+
return config;
|
|
50
|
+
Object.assign(config.treeConfig, { parentField, rowField });
|
|
51
|
+
if (transform && !isFunction(config.spanMethod)) {
|
|
52
|
+
config.spanMethod = (...args) => {
|
|
53
|
+
const { row, column, columnIndex } = args[0];
|
|
54
|
+
const treeNodeColumnInfo = treeNodeColumnIndexMap.get(config.uuid);
|
|
55
|
+
if (!treeNodeColumnInfo)
|
|
56
|
+
return;
|
|
57
|
+
if (column.treeNode) {
|
|
58
|
+
if (row[parentField])
|
|
59
|
+
return { rowspan: 1, colspan: 1 };
|
|
60
|
+
return { rowspan: 1, colspan: 99999 };
|
|
61
|
+
} else {
|
|
62
|
+
if (row[parentField])
|
|
63
|
+
return { rowspan: 1, colspan: 1 };
|
|
64
|
+
if (columnIndex < treeNodeColumnInfo.index)
|
|
65
|
+
return { rowspan: 1, colspan: 1 };
|
|
66
|
+
return { rowspan: 0, colspan: 0 };
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return config;
|
|
71
|
+
});
|
|
72
|
+
hooks.setupHooks.setup.tap(pluginName, (configRef) => {
|
|
73
|
+
onBeforeUnmount(() => {
|
|
74
|
+
var _a;
|
|
75
|
+
if (!((_a = configRef.value) == null ? void 0 : _a.uuid))
|
|
76
|
+
return;
|
|
77
|
+
treeNodeColumnIndexMap.delete(configRef.value.uuid);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export { virtualTreePlugin };
|
|
@@ -98,6 +98,7 @@ declare const ShortcutSetter: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
98
98
|
name?: string | undefined;
|
|
99
99
|
render_key?: string[] | undefined;
|
|
100
100
|
search_key?: string[] | undefined;
|
|
101
|
+
primary_key?: string | undefined;
|
|
101
102
|
type?: string | undefined;
|
|
102
103
|
value_key?: string | undefined;
|
|
103
104
|
level_key?: string | undefined;
|
|
@@ -100,6 +100,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
100
100
|
name?: string | undefined;
|
|
101
101
|
render_key?: string[] | undefined;
|
|
102
102
|
search_key?: string[] | undefined;
|
|
103
|
+
primary_key?: string | undefined;
|
|
103
104
|
type?: string | undefined;
|
|
104
105
|
value_key?: string | undefined;
|
|
105
106
|
level_key?: string | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AnyObject, ArrayAble } from '../../../es/shared/types';
|
|
2
2
|
import { App, Component } from 'vue';
|
|
3
|
-
export declare function traverse<T extends ArrayAble<AnyObject>>(target: T, handler: (item: T extends Array<infer P> ? P : T, stop: () => void) => void, keys?: ArrayAble<string
|
|
3
|
+
export declare function traverse<T extends ArrayAble<AnyObject>>(target: T, handler: (item: T extends Array<infer P> ? P : T, stop: () => void, parent?: typeof item) => void, keys?: ArrayAble<string>, parent?: T): void;
|
|
4
4
|
export declare function safeComponentRegister(app: App, component: Component, cName?: string | undefined, scheduler?: () => void): void;
|
|
5
5
|
export declare function generateTimeFormat(format: string): string | undefined;
|
|
6
6
|
export declare function arrayed<T>(maybeArray: T): T extends Array<any> ? T : [T];
|
|
7
7
|
export declare function uuidGenerator(): string;
|
|
8
8
|
export declare const getStringWidth: import("@vueuse/core").UseMemoizedFn<number, [str: string]>;
|
|
9
|
+
export declare const DMZ: AnyObject;
|
package/es/shared/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { arrayed, generateTimeFormat, getStringWidth, safeComponentRegister, traverse, uuidGenerator } from './index2.js';
|
|
1
|
+
export { DMZ, arrayed, generateTimeFormat, getStringWidth, safeComponentRegister, traverse, uuidGenerator } from './index2.js';
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { useMemoize } from '@vueuse/core';
|
|
2
2
|
import { isArray, isString } from 'lodash-es';
|
|
3
3
|
|
|
4
|
-
function traverse(target, handler, keys = "children") {
|
|
4
|
+
function traverse(target, handler, keys = "children", parent) {
|
|
5
5
|
function stop() {
|
|
6
6
|
throw "silence break traverse";
|
|
7
7
|
}
|
|
8
8
|
try {
|
|
9
9
|
arrayed(target).forEach((item) => {
|
|
10
|
-
handler(item, stop);
|
|
10
|
+
handler(item, stop, parent);
|
|
11
11
|
arrayed(keys).forEach((key) => {
|
|
12
|
-
isArray(item[key]) && traverse(item[key], handler);
|
|
12
|
+
isArray(item[key]) && traverse(item[key], handler, keys, item);
|
|
13
13
|
});
|
|
14
14
|
});
|
|
15
15
|
} catch (err) {
|
|
@@ -93,5 +93,6 @@ const getStringWidth = /* @__PURE__ */ useMemoize(function(str) {
|
|
|
93
93
|
return width + 6;
|
|
94
94
|
}, 0);
|
|
95
95
|
});
|
|
96
|
+
const DMZ = Object.seal(/* @__PURE__ */ Object.create(null));
|
|
96
97
|
|
|
97
|
-
export { arrayed, generateTimeFormat, getStringWidth, safeComponentRegister, traverse, uuidGenerator };
|
|
98
|
+
export { DMZ, arrayed, generateTimeFormat, getStringWidth, safeComponentRegister, traverse, uuidGenerator };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.23-beta.
|
|
3
|
+
"version": "3.1.23-beta.13",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"iOS 7",
|
|
67
67
|
"last 3 iOS versions"
|
|
68
68
|
],
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "167f92da3f533240af1a598f58f70b85a365414f"
|
|
70
70
|
}
|