cnhis-design-vue 3.1.23-beta.4 → 3.1.23-beta.7
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/README.md +123 -123
- package/es/components/fabric-chart/src/components/PopupMenu.js +7 -2
- package/es/components/fabric-chart/src/hooks/useCenter2.js +9 -5
- package/es/components/form-config/index.d.ts +1 -1
- package/es/components/form-config/src/FormConfig.vue.d.ts +1 -1
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +1 -1
- package/es/components/form-render/index2.js +2 -1
- package/es/components/form-render/src/components/renderer/index.d.ts +2 -1
- package/es/components/form-render/src/components/renderer/index.js +2 -1
- package/es/components/form-render/src/components/renderer/index2.js +2 -1
- package/es/components/form-render/src/components/renderer/{searchCascader.d.ts → levelSearchCascade.d.ts} +29 -6
- package/es/components/form-render/src/components/renderer/levelSearchCascade.js +227 -0
- package/es/components/form-render/src/components/renderer/search.d.ts +2 -2
- package/es/components/form-render/src/components/renderer/search.js +2 -1
- package/es/components/form-render/src/components/renderer/{cascader.d.ts → searchCascade.d.ts} +0 -0
- package/es/components/form-render/src/components/renderer/{cascader.js → searchCascade.js} +1 -0
- package/es/components/form-render/src/components/renderer/select.js +2 -1
- package/es/components/form-render/src/hooks/useAsyncQueue2.js +5 -4
- package/es/components/form-render/src/hooks/useFieldListAdaptor2.js +11 -4
- package/es/components/form-render/src/hooks/useFormRequest.d.ts +2 -0
- package/es/components/form-render/src/hooks/useFormRequest2.js +1 -1
- package/es/components/form-render/src/types/fieldItem.d.ts +1 -1
- package/es/components/iho-table/index.d.ts +270 -101
- package/es/components/iho-table/src/IhoTable.vue.d.ts +270 -101
- package/es/components/iho-table/src/plugins/lowCodeFieldAdaptorPlugin/index2.js +11 -8
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/edit-separate.js +18 -20
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/edit-separate.vue.d.ts +1 -17
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/index.js +9 -5
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/separate-utils2.js +2 -2
- package/es/components/iho-table/src/types/index.d.ts +0 -3
- package/es/components/index.css +1 -1
- package/es/components/search-cascader/index.d.ts +69 -6
- package/es/components/search-cascader/src/SearchCascader.js +21 -42
- package/es/components/search-cascader/src/SearchCascader.vue.d.ts +69 -6
- package/es/components/search-cascader/src/components/SearchMenu.d.ts +9 -0
- package/es/components/search-cascader/src/components/SearchMenu.js +11 -2
- package/es/components/search-cascader/style/index.css +1 -1
- package/es/components/shortcut-provider/src/ShortcutProvider.js +2 -1
- package/es/components/shortcut-setter/index.d.ts +1 -1
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +1 -1
- package/es/shared/components/no-data/NoData.js +74 -0
- package/es/shared/components/no-data/NoData.vue.d.ts +51 -0
- package/es/shared/components/no-data/index.d.ts +2 -0
- package/es/shared/components/no-data/index.js +1 -0
- package/es/shared/components/no-data/index2.js +2 -0
- package/package.json +2 -2
- package/es/components/big-table/src/components/edit-form/useCommon.d.ts +0 -4
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +0 -1
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +0 -1
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +0 -1
- package/es/components/fabric-chart/src/utils/index.d.ts +0 -6823
- package/es/shared/utils/tapable/index.d.ts +0 -139
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { defineComponent, computed, ref, inject, watch, createVNode } from 'vue';
|
|
2
|
+
import { arrayed } from '../../../../../shared/utils/index2.js';
|
|
3
|
+
import { isEqual, isString, isEmpty } from 'lodash-es';
|
|
4
|
+
import '../../../index2.js';
|
|
5
|
+
import { InjectAsyncQueue } from '../../constants/index2.js';
|
|
6
|
+
import { useCommonInjection } from '../../hooks/useCommonInjection2.js';
|
|
7
|
+
import { formRenderLog } from '../../utils/index.js';
|
|
8
|
+
import { connect, mapProps } from '@formily/vue';
|
|
9
|
+
import SearchCascader from '../../../../search-cascader/index2.js';
|
|
10
|
+
import script$1 from '../../../../../shared/components/no-data/NoData.js';
|
|
11
|
+
import { useFormField } from '../../hooks/useFormField2.js';
|
|
12
|
+
import { visitedDecorator, assignUpdateValue } from '../../utils/schema2.js';
|
|
13
|
+
import { useFormRequest } from '../../hooks/useFormRequest2.js';
|
|
14
|
+
|
|
15
|
+
const script = defineComponent({
|
|
16
|
+
name: "FormSearchCascade",
|
|
17
|
+
props: {
|
|
18
|
+
options: {
|
|
19
|
+
type: Array,
|
|
20
|
+
default: () => []
|
|
21
|
+
},
|
|
22
|
+
onFocus: {
|
|
23
|
+
type: Function
|
|
24
|
+
},
|
|
25
|
+
autograph: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
lazyRequest: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: true
|
|
32
|
+
},
|
|
33
|
+
wordbook: {
|
|
34
|
+
type: Object,
|
|
35
|
+
required: true
|
|
36
|
+
},
|
|
37
|
+
onChange: {},
|
|
38
|
+
value: {
|
|
39
|
+
type: [String, Array]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: ["update:value"],
|
|
43
|
+
setup(props, {
|
|
44
|
+
emit
|
|
45
|
+
}) {
|
|
46
|
+
const valueRef = computed({
|
|
47
|
+
get: () => props.value,
|
|
48
|
+
set: (v) => emit("update:value", v)
|
|
49
|
+
});
|
|
50
|
+
const optionsRef = ref([]);
|
|
51
|
+
const {
|
|
52
|
+
field,
|
|
53
|
+
fieldKey
|
|
54
|
+
} = useFormField();
|
|
55
|
+
const labelKey = computed(() => {
|
|
56
|
+
var _a, _b, _c;
|
|
57
|
+
return (_c = (_b = (_a = props.wordbook) == null ? void 0 : _a.render_key) == null ? void 0 : _b[0]) != null ? _c : "text";
|
|
58
|
+
});
|
|
59
|
+
const valueKey = computed(() => {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
return (_b = (_a = props.wordbook) == null ? void 0 : _a.value_key) != null ? _b : "value";
|
|
62
|
+
});
|
|
63
|
+
computed(() => {
|
|
64
|
+
var _a;
|
|
65
|
+
return ((_a = props.wordbook) == null ? void 0 : _a.level_num) || Infinity;
|
|
66
|
+
});
|
|
67
|
+
const asyncQueue = inject(InjectAsyncQueue);
|
|
68
|
+
const {
|
|
69
|
+
getSearchRequestInfo
|
|
70
|
+
} = useFormRequest();
|
|
71
|
+
async function fetchData(node, keyword) {
|
|
72
|
+
try {
|
|
73
|
+
if (node && !node.__keyword && node.isLeaf) {
|
|
74
|
+
valueRef.value = createOptionValue(node);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const result = await asyncQueue.addAsync(createParams(props.wordbook, props.autograph, field.value, fieldKey.value));
|
|
78
|
+
if (!node) {
|
|
79
|
+
optionsRef.value = result.map((option) => {
|
|
80
|
+
option.__keyword = !!keyword;
|
|
81
|
+
option.isLeaf = !!keyword;
|
|
82
|
+
return option;
|
|
83
|
+
});
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (node == null ? void 0 : node.__keyword) {
|
|
87
|
+
if (!isString(node.id_link))
|
|
88
|
+
return;
|
|
89
|
+
const linkList = parseLinkFromString2List(node.id_link);
|
|
90
|
+
const primaryKeyOptions = await fetchPrimaryKeyValue(linkList);
|
|
91
|
+
if (!primaryKeyOptions)
|
|
92
|
+
return;
|
|
93
|
+
const {
|
|
94
|
+
lastOption,
|
|
95
|
+
options
|
|
96
|
+
} = generateOptionWithIdList(primaryKeyOptions, linkList);
|
|
97
|
+
await fetchData(lastOption);
|
|
98
|
+
if (isEmpty(lastOption.children)) {
|
|
99
|
+
valueRef.value = sortOptionWithIdList(primaryKeyOptions, linkList);
|
|
100
|
+
} else {
|
|
101
|
+
optionsRef.value = options;
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
node.children = result.map((option) => {
|
|
105
|
+
return {
|
|
106
|
+
...option,
|
|
107
|
+
parent: node
|
|
108
|
+
};
|
|
109
|
+
});
|
|
110
|
+
console.log(node);
|
|
111
|
+
}
|
|
112
|
+
} catch (e) {
|
|
113
|
+
isString(e) && formRenderLog(e);
|
|
114
|
+
}
|
|
115
|
+
function sortOptionWithIdList(options, idList) {
|
|
116
|
+
return idList.map((id) => {
|
|
117
|
+
return options.find((option) => option[valueKey.value] === id);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function generateOptionWithIdList(options, idList) {
|
|
121
|
+
let lastOption = options[0];
|
|
122
|
+
const resultOption = idList.reduce((res, id, index) => {
|
|
123
|
+
const option = getTargetOption(options, id);
|
|
124
|
+
if (index === 0)
|
|
125
|
+
return [option];
|
|
126
|
+
lastOption = option;
|
|
127
|
+
res[0].children = [option];
|
|
128
|
+
return res;
|
|
129
|
+
}, []);
|
|
130
|
+
return {
|
|
131
|
+
options: resultOption,
|
|
132
|
+
lastOption
|
|
133
|
+
};
|
|
134
|
+
function getTargetOption(options2, value) {
|
|
135
|
+
return options2.find((o) => o[valueKey.value] === value);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function parseLinkFromString2List(linkString) {
|
|
139
|
+
return linkString.split("_").filter((s) => s);
|
|
140
|
+
}
|
|
141
|
+
function createParams(wordbook, autograph, field2, key2) {
|
|
142
|
+
const params = {
|
|
143
|
+
autograph,
|
|
144
|
+
wordbookId: wordbook.id,
|
|
145
|
+
wordbookType: wordbook.type,
|
|
146
|
+
fieldKeys: wordbook.search_key,
|
|
147
|
+
conObj: wordbook.conObj ? arrayed(wordbook.conObj).map((item) => ({
|
|
148
|
+
...item,
|
|
149
|
+
value: node == null ? void 0 : node[valueKey.value]
|
|
150
|
+
})) : void 0,
|
|
151
|
+
keyword,
|
|
152
|
+
page: 1
|
|
153
|
+
};
|
|
154
|
+
return {
|
|
155
|
+
...getSearchRequestInfo(),
|
|
156
|
+
params,
|
|
157
|
+
key: key2
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async function fetchPrimaryKeyValue(primaryKeys) {
|
|
162
|
+
if (!getSearchRequestInfo().primaryKeyUrl)
|
|
163
|
+
return [];
|
|
164
|
+
try {
|
|
165
|
+
return await asyncQueue.addAsync(createParams(props.wordbook, props.autograph, primaryKeys, fieldKey.value));
|
|
166
|
+
} catch (e) {
|
|
167
|
+
isString(e) && formRenderLog(e);
|
|
168
|
+
}
|
|
169
|
+
function createParams(wordbook, autograph, primaryKeys2, key2) {
|
|
170
|
+
const requestInfo = getSearchRequestInfo();
|
|
171
|
+
return {
|
|
172
|
+
key: key2,
|
|
173
|
+
autograph,
|
|
174
|
+
tableId: wordbook.id,
|
|
175
|
+
primaryKeyValue: primaryKeys2.join(","),
|
|
176
|
+
page: 1,
|
|
177
|
+
...requestInfo,
|
|
178
|
+
url: requestInfo.primaryKeyUrl
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function createOptionValue(node) {
|
|
183
|
+
const result = [];
|
|
184
|
+
let current = node;
|
|
185
|
+
while (current) {
|
|
186
|
+
result.unshift(node);
|
|
187
|
+
current = node.parent;
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
watch(() => props.wordbook, (wordbook, oldWordbook) => {
|
|
192
|
+
if (isEqual(wordbook, oldWordbook))
|
|
193
|
+
return;
|
|
194
|
+
optionsRef.value = [];
|
|
195
|
+
if (!wordbook)
|
|
196
|
+
return;
|
|
197
|
+
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
198
|
+
}, {
|
|
199
|
+
immediate: true
|
|
200
|
+
});
|
|
201
|
+
const {
|
|
202
|
+
injectValueValidate,
|
|
203
|
+
injectValueWatchFromEmpty,
|
|
204
|
+
injectValueBindKey
|
|
205
|
+
} = useCommonInjection();
|
|
206
|
+
injectValueWatchFromEmpty(valueRef, fetchData);
|
|
207
|
+
injectValueValidate(valueRef);
|
|
208
|
+
const key = injectValueBindKey(valueRef);
|
|
209
|
+
return () => createVNode(SearchCascader, {
|
|
210
|
+
"value": valueRef.value,
|
|
211
|
+
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
212
|
+
"options": optionsRef.value,
|
|
213
|
+
"key": key.value,
|
|
214
|
+
"labelKey": labelKey.value,
|
|
215
|
+
"valueKey": valueKey.value,
|
|
216
|
+
"search": fetchData,
|
|
217
|
+
"onFocus": visitedDecorator(field, props.onFocus)
|
|
218
|
+
}, {
|
|
219
|
+
empty: () => createVNode(script$1, null, null)
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
const LEVEL_SEARCH_CASCADE = connect(script, mapProps({
|
|
224
|
+
dataSource: "options"
|
|
225
|
+
}, assignUpdateValue));
|
|
226
|
+
|
|
227
|
+
export { LEVEL_SEARCH_CASCADE };
|
|
@@ -24,7 +24,7 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
24
24
|
level_key: string;
|
|
25
25
|
link_key: string;
|
|
26
26
|
link_key_split: string;
|
|
27
|
-
show_key: string;
|
|
27
|
+
show_key: string[];
|
|
28
28
|
conObj: AnyObject[];
|
|
29
29
|
conObjFirstLevel: AnyObject[];
|
|
30
30
|
}>>;
|
|
@@ -58,7 +58,7 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
58
58
|
level_key: string;
|
|
59
59
|
link_key: string;
|
|
60
60
|
link_key_split: string;
|
|
61
|
-
show_key: string;
|
|
61
|
+
show_key: string[];
|
|
62
62
|
conObj: AnyObject[];
|
|
63
63
|
conObjFirstLevel: AnyObject[];
|
|
64
64
|
}>>;
|
|
@@ -28,7 +28,7 @@ import './inputNumber.js';
|
|
|
28
28
|
import './linebar.js';
|
|
29
29
|
import './inputGroup2.js';
|
|
30
30
|
import './date.js';
|
|
31
|
-
import './
|
|
31
|
+
import './levelSearchCascade.js';
|
|
32
32
|
import './jsonCombination/index.js';
|
|
33
33
|
import './combination.js';
|
|
34
34
|
import './checkbox.js';
|
|
@@ -38,6 +38,7 @@ import './labelSelect.js';
|
|
|
38
38
|
import './slider.js';
|
|
39
39
|
import './complex.js';
|
|
40
40
|
import './simpleComponent.js';
|
|
41
|
+
import './searchCascade.js';
|
|
41
42
|
import { NSelect } from 'naive-ui';
|
|
42
43
|
import { visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema2.js';
|
|
43
44
|
|
package/es/components/form-render/src/components/renderer/{cascader.d.ts → searchCascade.d.ts}
RENAMED
|
File without changes
|
|
@@ -26,7 +26,7 @@ import './inputNumber.js';
|
|
|
26
26
|
import './linebar.js';
|
|
27
27
|
import './inputGroup2.js';
|
|
28
28
|
import './date.js';
|
|
29
|
-
import './
|
|
29
|
+
import './levelSearchCascade.js';
|
|
30
30
|
import './jsonCombination/index.js';
|
|
31
31
|
import './combination.js';
|
|
32
32
|
import './checkbox.js';
|
|
@@ -37,6 +37,7 @@ import './slider.js';
|
|
|
37
37
|
import './complex.js';
|
|
38
38
|
import './simpleComponent.js';
|
|
39
39
|
import './search.js';
|
|
40
|
+
import './searchCascade.js';
|
|
40
41
|
import { NSelect } from 'naive-ui';
|
|
41
42
|
import { traverseDependKey, visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema2.js';
|
|
42
43
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isFunction } from 'lodash-es';
|
|
1
|
+
import { cloneDeep, isFunction } from 'lodash-es';
|
|
2
2
|
import '../../index2.js';
|
|
3
3
|
import { useCommonLog } from './useCommonLog2.js';
|
|
4
4
|
import { useFormRequest } from './useFormRequest2.js';
|
|
@@ -42,7 +42,8 @@ class AsyncQueue {
|
|
|
42
42
|
const entry = this._entries.get(key);
|
|
43
43
|
if (entry.state === 1 /* DONE */) {
|
|
44
44
|
setTimeout(() => {
|
|
45
|
-
|
|
45
|
+
console.log("useCache", key);
|
|
46
|
+
callback && callback(cloneDeep(entry.error), cloneDeep(entry.result));
|
|
46
47
|
});
|
|
47
48
|
} else if (!entry.callbacks) {
|
|
48
49
|
entry.callbacks = [callback];
|
|
@@ -91,8 +92,8 @@ class AsyncQueue {
|
|
|
91
92
|
const callback = entry.callback;
|
|
92
93
|
entry.state = 1 /* DONE */;
|
|
93
94
|
entry.callback = void 0;
|
|
94
|
-
entry.result = r;
|
|
95
|
-
entry.error = e;
|
|
95
|
+
entry.result = cloneDeep(r);
|
|
96
|
+
entry.error = cloneDeep(e);
|
|
96
97
|
this._activeTasks--;
|
|
97
98
|
callback && callback(e, r);
|
|
98
99
|
if (entry.callbacks) {
|
|
@@ -79,8 +79,7 @@ function useFieldListAdaptor(collector) {
|
|
|
79
79
|
function bindAutoGraphProps(schema2, item2) {
|
|
80
80
|
schema2["x-component"] = "SEARCH";
|
|
81
81
|
Object.assign(schema2["x-component-props"], {
|
|
82
|
-
...pick(item2, ["wordbook", "lazyRequest"])
|
|
83
|
-
autograph: item2.autograph
|
|
82
|
+
...pick(item2, ["wordbook", "lazyRequest", "autograph"])
|
|
84
83
|
});
|
|
85
84
|
}
|
|
86
85
|
function bindUrlProps(schema2, item2) {
|
|
@@ -106,7 +105,7 @@ function useFieldListAdaptor(collector) {
|
|
|
106
105
|
});
|
|
107
106
|
return schema;
|
|
108
107
|
};
|
|
109
|
-
const
|
|
108
|
+
const createSearchCascadeSchema = (item) => {
|
|
110
109
|
var _a;
|
|
111
110
|
const schema = createStandardSchema(item);
|
|
112
111
|
Object.assign(schema["x-component-props"], {
|
|
@@ -116,6 +115,13 @@ function useFieldListAdaptor(collector) {
|
|
|
116
115
|
});
|
|
117
116
|
return schema;
|
|
118
117
|
};
|
|
118
|
+
const createLevelSearchCascadeSchema = (item) => {
|
|
119
|
+
const schema = createStandardSchema(item);
|
|
120
|
+
Object.assign(schema["x-component-props"], {
|
|
121
|
+
...pick(item, ["wordbook", "lazyRequest", "autograph"])
|
|
122
|
+
});
|
|
123
|
+
return schema;
|
|
124
|
+
};
|
|
119
125
|
const createSwitchSchema = (item) => {
|
|
120
126
|
const schema = createStandardSchema(item);
|
|
121
127
|
Object.assign(schema["x-component-props"], {
|
|
@@ -210,7 +216,8 @@ function useFieldListAdaptor(collector) {
|
|
|
210
216
|
["INPUT_NUMBER", createInputNumberSchema],
|
|
211
217
|
["SELECT", createSelectSchema],
|
|
212
218
|
["DATE", createDateSchema],
|
|
213
|
-
["
|
|
219
|
+
["LEVEL_SEARCH_CASCADE", createLevelSearchCascadeSchema],
|
|
220
|
+
["SEARCH_CASCADE", createSearchCascadeSchema],
|
|
214
221
|
["COMBINATION", createCombinationSchema],
|
|
215
222
|
["RADIO", createRadioSchema],
|
|
216
223
|
["CHECKBOX", createRadioSchema],
|
|
@@ -4,6 +4,7 @@ declare type RequestInstance = Record<string, Func>;
|
|
|
4
4
|
declare type SearchRequestInfo = {
|
|
5
5
|
method: FormRequestType;
|
|
6
6
|
url: string;
|
|
7
|
+
primaryKeyUrl?: string;
|
|
7
8
|
};
|
|
8
9
|
export declare function useFormRequest(): {
|
|
9
10
|
getHttpInstance: () => Nullable<RequestInstance>;
|
|
@@ -11,6 +12,7 @@ export declare function useFormRequest(): {
|
|
|
11
12
|
getSearchRequestInfo: () => {
|
|
12
13
|
method: FormRequestType;
|
|
13
14
|
url: string;
|
|
15
|
+
primaryKeyUrl?: string | undefined;
|
|
14
16
|
};
|
|
15
17
|
registGlobSearchInfo: (info: SearchRequestInfo) => void;
|
|
16
18
|
};
|