cnhis-design-vue 3.1.14-beta.10 → 3.1.14-beta.11
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/fabric-chart/src/FabricChart.vue_vue_type_script_setup_true_lang.js +2 -1
- package/es/packages/fabric-chart/src/hooks/useCenter.js +41 -25
- package/es/packages/fabric-chart/src/hooks/useEvent.js +8 -7
- package/es/packages/form-render/src/components/renderer/cascader.d.ts +2 -2
- package/es/packages/form-render/src/components/renderer/cascader.js +40 -47
- package/es/packages/form-render/src/components/renderer/select.js +8 -9
- package/es/packages/form-render/src/hooks/useAsyncQueue.js +1 -1
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +1 -1
- package/es/packages/form-render/src/hooks/useFormItemDeps.d.ts +2 -2
- package/es/packages/form-render/src/hooks/useFormItemDeps.js +5 -6
- package/global.d.ts +8 -8
- package/package.json +1 -1
|
@@ -38,6 +38,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
38
38
|
const shadowLinesCache = /* @__PURE__ */ new Set();
|
|
39
39
|
const maiboPoints = /* @__PURE__ */ new Set();
|
|
40
40
|
const otherPoints = /* @__PURE__ */ new Set();
|
|
41
|
+
const prevLines = /* @__PURE__ */ new Set();
|
|
41
42
|
onMounted(() => {
|
|
42
43
|
nextTick(() => {
|
|
43
44
|
init();
|
|
@@ -47,6 +48,7 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
47
48
|
drawShaDow();
|
|
48
49
|
maiboPoints.clear();
|
|
49
50
|
otherPoints.clear();
|
|
51
|
+
prevLines.clear();
|
|
50
52
|
left.yScaleValue.forEach((scaleValue) => {
|
|
51
53
|
drawPositionLine(scaleValue);
|
|
52
54
|
scaleValue.dataList.forEach((item, dataIndex) => {
|
|
@@ -94,12 +96,11 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
94
96
|
y: item.y
|
|
95
97
|
};
|
|
96
98
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
y = y < vitalSignsOriginY.originY ? vitalSignsOriginY.originY : y > vitalSignsOriginY.endY ? vitalSignsOriginY.endY : y;
|
|
99
|
+
const point = getPointer(item, pulseObj);
|
|
100
|
+
if (point == null ? void 0 : point.length) {
|
|
100
101
|
return {
|
|
101
|
-
x:
|
|
102
|
-
y
|
|
102
|
+
x: point[0],
|
|
103
|
+
y: point[1]
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
};
|
|
@@ -278,24 +279,10 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
278
279
|
const lineList = [];
|
|
279
280
|
const otherList = [];
|
|
280
281
|
item.list.forEach((v, index) => {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
if (isEffectiveNode(v)) {
|
|
284
|
-
const x = cumputedX(v.time);
|
|
285
|
-
const y = cumputedY(scaleValue.type, scaleValue.list, v.value);
|
|
286
|
-
if (isLimit(v.time)) {
|
|
287
|
-
points = [x, y < newY.originY ? newY.originY : y > newY.endY ? newY.endY : y];
|
|
288
|
-
}
|
|
289
|
-
}
|
|
282
|
+
var _a;
|
|
283
|
+
const points = getPointer(v, scaleValue);
|
|
290
284
|
const nextV = item.list[index + 1];
|
|
291
|
-
|
|
292
|
-
if (isEffectiveNode(nextV)) {
|
|
293
|
-
const nextX = cumputedX(nextV.time);
|
|
294
|
-
const nextY = cumputedY(scaleValue.type, scaleValue.list, nextV.value);
|
|
295
|
-
if (isLimit(nextV.time)) {
|
|
296
|
-
nextPoint = [nextX, nextY < newY.originY ? newY.originY : nextY > newY.endY ? newY.endY : nextY];
|
|
297
|
-
}
|
|
298
|
-
}
|
|
285
|
+
const nextPoint = getPointer(nextV, scaleValue);
|
|
299
286
|
let coolLine, coolPoint, noRiseText, arrowGroup, verifiedText;
|
|
300
287
|
if (points && scaleValue.type === "temperature") {
|
|
301
288
|
if (v.noRise) {
|
|
@@ -357,9 +344,22 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
357
344
|
}
|
|
358
345
|
}
|
|
359
346
|
let point;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
347
|
+
let line;
|
|
348
|
+
if (points && nextPoint && !v.breakpoint) {
|
|
349
|
+
line = drawLine([...points, ...nextPoint], {
|
|
350
|
+
...lineAttr
|
|
351
|
+
});
|
|
352
|
+
} else if (points && !nextPoint && !v.breakpoint && scaleValue.type === "temperature" && dataIndex < scaleValue.dataList.length - 1 && index === item.list.length - 1) {
|
|
353
|
+
const nextV2 = (_a = scaleValue.dataList[dataIndex + 1].list) == null ? void 0 : _a[0];
|
|
354
|
+
const nextLinePoint = getPointer(nextV2, scaleValue);
|
|
355
|
+
line = nextLinePoint ? drawLine([...points, ...nextLinePoint], {
|
|
356
|
+
...lineAttr
|
|
357
|
+
}) : null;
|
|
358
|
+
nextLinePoint && prevLines.add({
|
|
359
|
+
dataIndex,
|
|
360
|
+
line
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
363
|
const previousLine = lineList[index - 1];
|
|
364
364
|
const pointAttrNew = {
|
|
365
365
|
origin: {
|
|
@@ -390,6 +390,12 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
390
390
|
} else {
|
|
391
391
|
if (points) {
|
|
392
392
|
pointAttrNew.leftLine = null;
|
|
393
|
+
if (scaleValue.type === "temperature" && index === 0) {
|
|
394
|
+
const objLine = [...prevLines].find((v2) => v2.dataIndex === dataIndex - 1);
|
|
395
|
+
if (objLine) {
|
|
396
|
+
pointAttrNew.leftLine = objLine.line;
|
|
397
|
+
}
|
|
398
|
+
}
|
|
393
399
|
point = drawPoint(type, {
|
|
394
400
|
left: points[0],
|
|
395
401
|
top: points[1],
|
|
@@ -521,6 +527,16 @@ function useCenter(canvas, propItems, emits, cumputedX, cumputedY, getXValue, ge
|
|
|
521
527
|
const getTime = new Date(time).getTime();
|
|
522
528
|
return getTime >= minMinute && getTime <= maxMinute;
|
|
523
529
|
}
|
|
530
|
+
function getPointer(v, scaleValue) {
|
|
531
|
+
let points;
|
|
532
|
+
const objOriginY = scaleValue.type === "pain" ? painOriginY : vitalSignsOriginY;
|
|
533
|
+
if (isEffectiveNode(v) && isLimit(v.time)) {
|
|
534
|
+
const x = cumputedX(v.time);
|
|
535
|
+
const y = cumputedY(scaleValue.type, scaleValue.list, v.value);
|
|
536
|
+
points = [x, y < objOriginY.originY ? objOriginY.originY : y > objOriginY.endY ? objOriginY.endY : y];
|
|
537
|
+
}
|
|
538
|
+
return points;
|
|
539
|
+
}
|
|
524
540
|
function clickMenu({ item, target }) {
|
|
525
541
|
if (!target) {
|
|
526
542
|
emits("add", {
|
|
@@ -23,6 +23,7 @@ function useCanvasEvent(canvas, propItems, emits) {
|
|
|
23
23
|
lockMovementX: true,
|
|
24
24
|
lockMovementY: true,
|
|
25
25
|
transparentCorners: false,
|
|
26
|
+
hasControls: false,
|
|
26
27
|
...selectionStyle
|
|
27
28
|
});
|
|
28
29
|
canvas.value.add(rect);
|
|
@@ -37,9 +38,9 @@ function useCanvasEvent(canvas, propItems, emits) {
|
|
|
37
38
|
const selections2 = [];
|
|
38
39
|
selections2.push(drawRect({
|
|
39
40
|
left: iconsWidth,
|
|
40
|
-
top: originY,
|
|
41
|
+
top: originY + 1,
|
|
41
42
|
width: originX - iconsWidth,
|
|
42
|
-
height: endY
|
|
43
|
+
height: endY - originY - 3
|
|
43
44
|
}, "left"));
|
|
44
45
|
let topY = 0;
|
|
45
46
|
topList.forEach((item, index) => {
|
|
@@ -48,16 +49,16 @@ function useCanvasEvent(canvas, propItems, emits) {
|
|
|
48
49
|
}
|
|
49
50
|
selections2.push(drawRect({
|
|
50
51
|
left: iconsWidth,
|
|
51
|
-
top: topY,
|
|
52
|
+
top: topY + 1,
|
|
52
53
|
width: endX - iconsWidth,
|
|
53
|
-
height: propItems[`${item.key}Height`]
|
|
54
|
+
height: propItems[`${item.key}Height`] - 1
|
|
54
55
|
}, item.key));
|
|
55
56
|
});
|
|
56
57
|
selections2.push(drawRect({
|
|
57
58
|
left: originX,
|
|
58
|
-
top: originY,
|
|
59
|
+
top: originY + 1,
|
|
59
60
|
width: endX - originX,
|
|
60
|
-
height: endY - originY
|
|
61
|
+
height: endY - originY - 3
|
|
61
62
|
}, "grid"));
|
|
62
63
|
canvas.value.renderAll();
|
|
63
64
|
return selections2;
|
|
@@ -67,7 +68,7 @@ function useCanvasEvent(canvas, propItems, emits) {
|
|
|
67
68
|
canvas.value.discardActiveObject();
|
|
68
69
|
canvas.value.renderAll();
|
|
69
70
|
const obj = selections == null ? void 0 : selections.find((obj2) => obj2.key === key);
|
|
70
|
-
obj
|
|
71
|
+
obj == null ? void 0 : obj.bringToFront();
|
|
71
72
|
obj && canvas.value.setActiveObject(obj);
|
|
72
73
|
}
|
|
73
74
|
return { select };
|
|
@@ -17,7 +17,7 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
17
17
|
type: PropType<AnyObject[]>;
|
|
18
18
|
default: () => never[];
|
|
19
19
|
};
|
|
20
|
-
|
|
20
|
+
depth: {
|
|
21
21
|
type: (NumberConstructor | StringConstructor)[];
|
|
22
22
|
required: true;
|
|
23
23
|
};
|
|
@@ -34,7 +34,7 @@ export declare const SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
|
34
34
|
type: PropType<AnyObject[]>;
|
|
35
35
|
default: () => never[];
|
|
36
36
|
};
|
|
37
|
-
|
|
37
|
+
depth: {
|
|
38
38
|
type: (NumberConstructor | StringConstructor)[];
|
|
39
39
|
required: true;
|
|
40
40
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent, ref, inject, computed, watch, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import {
|
|
3
|
+
import { isEqual } from 'lodash-es';
|
|
4
4
|
import { InjectAsyncQueue } from '../../constants/index.js';
|
|
5
|
-
import { assignUpdateValue,
|
|
5
|
+
import { assignUpdateValue, traverseDependKey } from '../../utils/index.js';
|
|
6
6
|
import { connect, mapProps } from '@formily/vue';
|
|
7
7
|
import { NCascader } from 'naive-ui';
|
|
8
8
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
@@ -14,7 +14,7 @@ const script = defineComponent({
|
|
|
14
14
|
type: Array,
|
|
15
15
|
default: () => []
|
|
16
16
|
},
|
|
17
|
-
|
|
17
|
+
depth: {
|
|
18
18
|
type: [Number, String],
|
|
19
19
|
required: true
|
|
20
20
|
},
|
|
@@ -32,55 +32,41 @@ const script = defineComponent({
|
|
|
32
32
|
slots,
|
|
33
33
|
emit
|
|
34
34
|
}) {
|
|
35
|
-
const
|
|
35
|
+
const remoteOptions = ref(null);
|
|
36
36
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
37
37
|
const {
|
|
38
38
|
field,
|
|
39
39
|
title
|
|
40
40
|
} = useFormField();
|
|
41
41
|
async function fetchData(option) {
|
|
42
|
-
if (!option &&
|
|
42
|
+
if (!option && remoteOptions.value)
|
|
43
43
|
return;
|
|
44
|
-
|
|
45
|
-
if (!config)
|
|
44
|
+
if (!configFor(props))
|
|
46
45
|
return;
|
|
47
|
-
if (
|
|
48
|
-
formRenderLog(`invalid urlConfig (${config}) in CASCADER => ${title.value}`, "warn");
|
|
46
|
+
if (deepFor(option) + 1 >= deepFor(props))
|
|
49
47
|
return;
|
|
50
|
-
|
|
51
|
-
if (
|
|
52
|
-
return;
|
|
53
|
-
let data = await asyncQueue.addAsync({
|
|
54
|
-
...createRequestParams(deepFor(option), config, option),
|
|
55
|
-
key: title.value
|
|
56
|
-
});
|
|
57
|
-
if (!Array.isArray(data)) {
|
|
58
|
-
data = [];
|
|
59
|
-
}
|
|
60
|
-
if (!data.length && isObject(option)) {
|
|
48
|
+
const data = await asyncQueue.addAsync(createRequestParams(deepFor(option), configFor(props), title.value, option));
|
|
49
|
+
if (!data.length && option) {
|
|
61
50
|
option.isLeaf = true;
|
|
62
51
|
updateValue(null, null, getOptionChain(option));
|
|
63
52
|
show.value = false;
|
|
64
53
|
return;
|
|
65
54
|
}
|
|
66
55
|
const result = data.map((item) => optionNormalize(item, deepFor(option)));
|
|
67
|
-
option ? option.children = result :
|
|
68
|
-
function
|
|
69
|
-
var _a;
|
|
70
|
-
return (_a = option2 == null ? void 0 : option2.depth) != null ? _a : -1;
|
|
71
|
-
}
|
|
72
|
-
function createRequestParams(deep, config2, option2) {
|
|
56
|
+
option ? option.children = result : remoteOptions.value = result;
|
|
57
|
+
function createRequestParams(deep, config, key, option2) {
|
|
73
58
|
const params = {
|
|
74
59
|
lvlnr: deep + 1 + ""
|
|
75
60
|
};
|
|
76
|
-
if (option2 &&
|
|
77
|
-
traverseDependKey(
|
|
61
|
+
if (option2 && config.dependKey) {
|
|
62
|
+
traverseDependKey(config.dependKey, (dependKey, valueKey2) => {
|
|
78
63
|
params[valueKey2] = option2[dependKey];
|
|
79
64
|
});
|
|
80
65
|
}
|
|
81
66
|
return {
|
|
82
67
|
params,
|
|
83
|
-
...
|
|
68
|
+
...config,
|
|
69
|
+
key
|
|
84
70
|
};
|
|
85
71
|
}
|
|
86
72
|
function getOptionChain(option2) {
|
|
@@ -92,30 +78,39 @@ const script = defineComponent({
|
|
|
92
78
|
}
|
|
93
79
|
return result2;
|
|
94
80
|
}
|
|
95
|
-
function optionNormalize(data2,
|
|
81
|
+
function optionNormalize(data2, depth) {
|
|
96
82
|
return {
|
|
97
83
|
[labelKey.value]: data2[labelKey.value],
|
|
98
84
|
[valueKey.value]: data2[valueKey.value],
|
|
99
|
-
depth:
|
|
85
|
+
depth: depth + 1,
|
|
100
86
|
parent: option,
|
|
101
|
-
isLeaf:
|
|
87
|
+
isLeaf: depth + 2 >= deepFor(props)
|
|
102
88
|
};
|
|
103
89
|
}
|
|
90
|
+
function configFor(target) {
|
|
91
|
+
return target.urlConfig;
|
|
92
|
+
}
|
|
93
|
+
function deepFor(target) {
|
|
94
|
+
var _a;
|
|
95
|
+
return (_a = target == null ? void 0 : target.depth) != null ? _a : -1;
|
|
96
|
+
}
|
|
104
97
|
}
|
|
105
|
-
const
|
|
106
|
-
return
|
|
98
|
+
const parsedOptions = computed(() => {
|
|
99
|
+
return remoteOptions.value || props.options || [];
|
|
107
100
|
});
|
|
108
101
|
watch(() => props.value, (n, o) => {
|
|
109
102
|
var _a, _b;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
if (isField(field.value) && field.value.visited) {
|
|
114
|
-
(_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a);
|
|
115
|
-
}
|
|
103
|
+
n != null && o == null && fetchData();
|
|
104
|
+
isField(field.value) && field.value.visited && ((_b = (_a = field.value).validate) == null ? void 0 : _b.call(_a));
|
|
116
105
|
}, {
|
|
117
106
|
immediate: true
|
|
118
107
|
});
|
|
108
|
+
watch(() => props.urlConfig, async (config, oldConfig) => {
|
|
109
|
+
if (isEqual(config, oldConfig))
|
|
110
|
+
return;
|
|
111
|
+
remoteOptions.value = null;
|
|
112
|
+
await fetchData();
|
|
113
|
+
});
|
|
119
114
|
const labelKey = computed(() => {
|
|
120
115
|
var _a, _b;
|
|
121
116
|
return (_b = (_a = props.urlConfig) == null ? void 0 : _a.nameKey) != null ? _b : "text";
|
|
@@ -127,13 +122,11 @@ const script = defineComponent({
|
|
|
127
122
|
const _value = computed(() => {
|
|
128
123
|
try {
|
|
129
124
|
const parsed = Array.isArray(props.value) ? props.value : JSON.parse(props.value || "");
|
|
130
|
-
if (Array.isArray(parsed))
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
return [];
|
|
134
|
-
}
|
|
125
|
+
if (!Array.isArray(parsed) || !parsed.length)
|
|
126
|
+
return null;
|
|
127
|
+
return parsed.map((option) => option[labelKey.value]).join(" / ");
|
|
135
128
|
} catch (e) {
|
|
136
|
-
return
|
|
129
|
+
return null;
|
|
137
130
|
}
|
|
138
131
|
});
|
|
139
132
|
function updateValue(_, __, options) {
|
|
@@ -168,7 +161,7 @@ const script = defineComponent({
|
|
|
168
161
|
"remote": true,
|
|
169
162
|
"labelField": labelKey.value,
|
|
170
163
|
"valueField": valueKey.value,
|
|
171
|
-
"options":
|
|
164
|
+
"options": parsedOptions.value,
|
|
172
165
|
"checkStrategy": "child",
|
|
173
166
|
"onLoad": fetchData,
|
|
174
167
|
"onFocus": focusDecorator(props.onFocus),
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { defineComponent, ref, inject, computed,
|
|
1
|
+
import { defineComponent, ref, watch, inject, computed, nextTick, createVNode } from 'vue';
|
|
2
2
|
import { isField } from '@formily/core';
|
|
3
|
-
import { cloneDeep } from 'lodash-es';
|
|
3
|
+
import { isEqual, cloneDeep } from 'lodash-es';
|
|
4
4
|
import { InjectAsyncQueue, InjectionFormItemDepsCollector, InjectionChangeContextCollector } from '../../constants/index.js';
|
|
5
|
-
import { assignUpdateValue,
|
|
6
|
-
import { isObject } from '@vueuse/core';
|
|
5
|
+
import { assignUpdateValue, traverseDependKey } from '../../utils/index.js';
|
|
7
6
|
import { connect, mapProps } from '@formily/vue';
|
|
8
7
|
import { NSelect } from 'naive-ui';
|
|
9
8
|
import { useFormField } from '../../hooks/useFormField.js';
|
|
@@ -32,6 +31,7 @@ const script = defineComponent({
|
|
|
32
31
|
emit
|
|
33
32
|
}) {
|
|
34
33
|
const remoteOptions = ref(null);
|
|
34
|
+
watch(remoteOptions, (o) => console.log("remoteOption", o));
|
|
35
35
|
const lastSearch = ref("");
|
|
36
36
|
const asyncQueue = inject(InjectAsyncQueue);
|
|
37
37
|
const {
|
|
@@ -52,10 +52,6 @@ const script = defineComponent({
|
|
|
52
52
|
if (!config) {
|
|
53
53
|
return remoteOptions.value = null;
|
|
54
54
|
}
|
|
55
|
-
if (!isObject(config)) {
|
|
56
|
-
formRenderLog(`invalid urlConfig (${config}) in SELECT => ${title.value}`, "warn");
|
|
57
|
-
return remoteOptions.value = null;
|
|
58
|
-
}
|
|
59
55
|
try {
|
|
60
56
|
remoteOptions.value = await asyncQueue.addAsync({
|
|
61
57
|
...createParams(config, field.value),
|
|
@@ -86,13 +82,16 @@ const script = defineComponent({
|
|
|
86
82
|
return filterOption(props.options, lastSearch.value);
|
|
87
83
|
});
|
|
88
84
|
const formItemDepsCollector = inject(InjectionFormItemDepsCollector);
|
|
89
|
-
watch(() => props.urlConfig, (config) => {
|
|
85
|
+
watch(() => props.urlConfig, (config, oldConfig) => {
|
|
86
|
+
if (isEqual(config, oldConfig))
|
|
87
|
+
return;
|
|
90
88
|
remoteOptions.value = null;
|
|
91
89
|
config && formItemDepsCollector.setDeps(fieldKey.value, config.dependKey || [], async () => {
|
|
92
90
|
remoteOptions.value = null;
|
|
93
91
|
await nextTick();
|
|
94
92
|
props.value != null && await fetchData();
|
|
95
93
|
});
|
|
94
|
+
config && fetchData();
|
|
96
95
|
}, {
|
|
97
96
|
immediate: true
|
|
98
97
|
});
|
|
@@ -80,7 +80,7 @@ function useFieldListAdaptor(collector, uuid) {
|
|
|
80
80
|
const schema = createStandardSchema(item);
|
|
81
81
|
Object.assign(schema["x-component-props"], {
|
|
82
82
|
urlConfig: item.urlConfig,
|
|
83
|
-
|
|
83
|
+
depth: (_a = item.wordbook) == null ? void 0 : _a.level_num,
|
|
84
84
|
options: item.option
|
|
85
85
|
});
|
|
86
86
|
return schema;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Func } from '../../../../../es/src/types';
|
|
1
|
+
import { ArrayAble, Func } from '../../../../../es/src/types';
|
|
2
2
|
export declare class FormItemDepsCollector {
|
|
3
3
|
private readonly collector;
|
|
4
|
-
setDeps(key: string,
|
|
4
|
+
setDeps(key: string, dependKeys: ArrayAble<string> | Record<string, string> | ArrayAble<Record<'paramName' | 'paramValue', string>>, callback: Func): void;
|
|
5
5
|
trigger(dependKey: string, payload?: any): void;
|
|
6
6
|
}
|
|
7
7
|
export declare function useFormItemDeps(): {
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { isFunction } from 'lodash-es';
|
|
2
|
-
import {
|
|
2
|
+
import { traverseDependKey } from '../../../../packages/form-render/src/utils';
|
|
3
3
|
|
|
4
4
|
class FormItemDepsCollector {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.collector = /* @__PURE__ */ new Map();
|
|
7
7
|
}
|
|
8
|
-
setDeps(key,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const map = this.collector.get(dependKey2) || /* @__PURE__ */ new Map();
|
|
8
|
+
setDeps(key, dependKeys, callback) {
|
|
9
|
+
traverseDependKey(dependKeys, (dependKey) => {
|
|
10
|
+
const map = this.collector.get(dependKey) || /* @__PURE__ */ new Map();
|
|
12
11
|
map.set(key, callback);
|
|
13
|
-
this.collector.set(
|
|
12
|
+
this.collector.set(dependKey, map);
|
|
14
13
|
});
|
|
15
14
|
}
|
|
16
15
|
trigger(dependKey, payload) {
|
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 {};
|