cnhis-design-vue 3.1.23-beta.6 → 3.1.23-beta.8
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/big-table/src/components/edit-form/useCommon.d.ts +4 -0
- package/es/components/bpmn-workflow/src/BpmnWorkflow.d.ts +0 -0
- package/es/components/bpmn-workflow/types/BpmnViewer.d.ts +1 -0
- package/es/components/bpmn-workflow/types/ModelingModule.d.ts +1 -0
- package/es/components/bpmn-workflow/types/MoveCanvasModule.d.ts +1 -0
- package/es/components/fabric-chart/src/components/PopupMenu.js +1 -1
- package/es/components/fabric-chart/src/hooks/useCenter2.js +9 -4
- package/es/components/fabric-chart/src/utils/index.d.ts +6823 -0
- package/es/components/form-config/index.d.ts +6 -0
- package/es/components/form-config/src/FormConfig.vue.d.ts +6 -0
- package/es/components/form-config/src/components/FormConfigEdit.vue.d.ts +6 -0
- 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/levelSearchCascade.d.ts +86 -0
- package/es/components/form-render/src/components/renderer/levelSearchCascade.js +229 -0
- package/es/components/form-render/src/components/renderer/search.d.ts +13 -1
- 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 +4 -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 +6 -0
- package/es/components/iho-table/index.d.ts +100 -271
- package/es/components/iho-table/src/IhoTable.vue.d.ts +100 -271
- 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 +79 -6
- package/es/components/search-cascader/src/SearchCascader.js +29 -43
- package/es/components/search-cascader/src/SearchCascader.vue.d.ts +83 -9
- 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 +6 -0
- package/es/components/shortcut-setter/src/ShortcutSetter.vue.d.ts +6 -0
- 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/es/shared/utils/tapable/index.d.ts +139 -0
- package/package.json +2 -2
- package/es/components/form-render/src/components/renderer/searchCascader.d.ts +0 -51
|
@@ -940,6 +940,12 @@ declare const FormConfig: SFCWithInstall<import("vue").DefineComponent<{
|
|
|
940
940
|
search_key?: string[] | undefined;
|
|
941
941
|
type?: string | undefined;
|
|
942
942
|
value_key?: string | undefined;
|
|
943
|
+
level_key?: string | undefined;
|
|
944
|
+
link_key?: string | undefined;
|
|
945
|
+
link_key_split?: string | undefined;
|
|
946
|
+
show_key?: string[] | undefined;
|
|
947
|
+
conObj?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
948
|
+
conObjFirstLevel?: import("../../../es/shared/types").AnyObject[] | undefined;
|
|
943
949
|
} | undefined;
|
|
944
950
|
open?: {
|
|
945
951
|
value?: any;
|
|
@@ -942,6 +942,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
942
942
|
search_key?: string[] | undefined;
|
|
943
943
|
type?: string | undefined;
|
|
944
944
|
value_key?: string | undefined;
|
|
945
|
+
level_key?: string | undefined;
|
|
946
|
+
link_key?: string | undefined;
|
|
947
|
+
link_key_split?: string | undefined;
|
|
948
|
+
show_key?: string[] | undefined;
|
|
949
|
+
conObj?: import("../../../../es/shared/types").AnyObject[] | undefined;
|
|
950
|
+
conObjFirstLevel?: import("../../../../es/shared/types").AnyObject[] | undefined;
|
|
945
951
|
} | undefined;
|
|
946
952
|
open?: {
|
|
947
953
|
value?: any;
|
|
@@ -69,6 +69,12 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
69
69
|
search_key?: string[] | undefined;
|
|
70
70
|
type?: string | undefined;
|
|
71
71
|
value_key?: string | undefined;
|
|
72
|
+
level_key?: string | undefined;
|
|
73
|
+
link_key?: string | undefined;
|
|
74
|
+
link_key_split?: string | undefined;
|
|
75
|
+
show_key?: string[] | undefined;
|
|
76
|
+
conObj?: import("../../../../../es/shared/types").AnyObject[] | undefined;
|
|
77
|
+
conObjFirstLevel?: import("../../../../../es/shared/types").AnyObject[] | undefined;
|
|
72
78
|
} | undefined;
|
|
73
79
|
open?: {
|
|
74
80
|
value?: any;
|
|
@@ -26,7 +26,7 @@ import './src/components/renderer/inputNumber.js';
|
|
|
26
26
|
import './src/components/renderer/linebar.js';
|
|
27
27
|
import './src/components/renderer/inputGroup2.js';
|
|
28
28
|
import './src/components/renderer/date.js';
|
|
29
|
-
import './src/components/renderer/
|
|
29
|
+
import './src/components/renderer/levelSearchCascade.js';
|
|
30
30
|
import './src/components/renderer/jsonCombination/index.js';
|
|
31
31
|
import './src/components/renderer/combination.js';
|
|
32
32
|
import './src/components/renderer/checkbox.js';
|
|
@@ -37,6 +37,7 @@ import './src/components/renderer/slider.js';
|
|
|
37
37
|
import './src/components/renderer/complex.js';
|
|
38
38
|
import './src/components/renderer/simpleComponent.js';
|
|
39
39
|
import './src/components/renderer/search.js';
|
|
40
|
+
import './src/components/renderer/searchCascade.js';
|
|
40
41
|
|
|
41
42
|
const FormRender = script;
|
|
42
43
|
FormRender.install = function(app) {
|
|
@@ -6,7 +6,7 @@ export * from './inputNumber';
|
|
|
6
6
|
export * from './linebar';
|
|
7
7
|
export * from './inputGroup';
|
|
8
8
|
export * from './date';
|
|
9
|
-
export * from './
|
|
9
|
+
export * from './levelSearchCascade';
|
|
10
10
|
export * from './jsonCombination';
|
|
11
11
|
export * from './combination';
|
|
12
12
|
export * from './checkbox';
|
|
@@ -17,3 +17,4 @@ export * from './slider';
|
|
|
17
17
|
export * from './complex';
|
|
18
18
|
export * from './simpleComponent';
|
|
19
19
|
export * from './search';
|
|
20
|
+
export * from './searchCascade';
|
|
@@ -6,7 +6,7 @@ export { INPUT_NUMBER } from './inputNumber.js';
|
|
|
6
6
|
export { LINEBAR } from './linebar.js';
|
|
7
7
|
export { INPUT_GROUP } from './inputGroup2.js';
|
|
8
8
|
export { DATE } from './date.js';
|
|
9
|
-
export {
|
|
9
|
+
export { LEVEL_SEARCH_CASCADE } from './levelSearchCascade.js';
|
|
10
10
|
export { JSON_COMBINATION } from './jsonCombination/index.js';
|
|
11
11
|
export { COMBINATION } from './combination.js';
|
|
12
12
|
export { CHECKBOX } from './checkbox.js';
|
|
@@ -17,3 +17,4 @@ export { SLIDER } from './slider.js';
|
|
|
17
17
|
export { COMPLEX } from './complex.js';
|
|
18
18
|
export { BUTTON, LINE_BREAKS, TEXT } from './simpleComponent.js';
|
|
19
19
|
export { SEARCH } from './search.js';
|
|
20
|
+
export { SEARCH_CASCADE } from './searchCascade.js';
|
|
@@ -6,7 +6,7 @@ export { INPUT_NUMBER } from './inputNumber.js';
|
|
|
6
6
|
export { LINEBAR } from './linebar.js';
|
|
7
7
|
export { INPUT_GROUP } from './inputGroup2.js';
|
|
8
8
|
export { DATE } from './date.js';
|
|
9
|
-
export {
|
|
9
|
+
export { LEVEL_SEARCH_CASCADE } from './levelSearchCascade.js';
|
|
10
10
|
export { JSON_COMBINATION } from './jsonCombination/index.js';
|
|
11
11
|
export { COMBINATION } from './combination.js';
|
|
12
12
|
export { CHECKBOX } from './checkbox.js';
|
|
@@ -17,3 +17,4 @@ export { SLIDER } from './slider.js';
|
|
|
17
17
|
export { COMPLEX } from './complex.js';
|
|
18
18
|
export { BUTTON, LINE_BREAKS, TEXT } from './simpleComponent.js';
|
|
19
19
|
export { SEARCH } from './search.js';
|
|
20
|
+
export { SEARCH_CASCADE } from './searchCascade.js';
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { AnyObject, Func } from '../../../../../../es/shared/types';
|
|
2
|
+
import { PropType } from 'vue';
|
|
3
|
+
declare type ValueType = string | AnyObject[];
|
|
4
|
+
export declare const LEVEL_SEARCH_CASCADE: import("vue").DefineComponent<{
|
|
5
|
+
options: {
|
|
6
|
+
type: PropType<AnyObject[]>;
|
|
7
|
+
default: () => never[];
|
|
8
|
+
};
|
|
9
|
+
onFocus: {
|
|
10
|
+
type: PropType<Func<any[], any>>;
|
|
11
|
+
};
|
|
12
|
+
autograph: {
|
|
13
|
+
type: StringConstructor;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
lazyRequest: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
wordbook: {
|
|
21
|
+
type: PropType<Partial<{
|
|
22
|
+
level_num: number;
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
render_key: string[];
|
|
26
|
+
search_key: string[];
|
|
27
|
+
type: string;
|
|
28
|
+
value_key: string;
|
|
29
|
+
level_key: string;
|
|
30
|
+
link_key: string;
|
|
31
|
+
link_key_split: string;
|
|
32
|
+
show_key: string[];
|
|
33
|
+
conObj: AnyObject[];
|
|
34
|
+
conObjFirstLevel: AnyObject[];
|
|
35
|
+
}>>;
|
|
36
|
+
required: true;
|
|
37
|
+
};
|
|
38
|
+
onChange: {};
|
|
39
|
+
value: {
|
|
40
|
+
type: PropType<ValueType>;
|
|
41
|
+
};
|
|
42
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "update:value"[], "update:value", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
43
|
+
options: {
|
|
44
|
+
type: PropType<AnyObject[]>;
|
|
45
|
+
default: () => never[];
|
|
46
|
+
};
|
|
47
|
+
onFocus: {
|
|
48
|
+
type: PropType<Func<any[], any>>;
|
|
49
|
+
};
|
|
50
|
+
autograph: {
|
|
51
|
+
type: StringConstructor;
|
|
52
|
+
required: true;
|
|
53
|
+
};
|
|
54
|
+
lazyRequest: {
|
|
55
|
+
type: BooleanConstructor;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
58
|
+
wordbook: {
|
|
59
|
+
type: PropType<Partial<{
|
|
60
|
+
level_num: number;
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
render_key: string[];
|
|
64
|
+
search_key: string[];
|
|
65
|
+
type: string;
|
|
66
|
+
value_key: string;
|
|
67
|
+
level_key: string;
|
|
68
|
+
link_key: string;
|
|
69
|
+
link_key_split: string;
|
|
70
|
+
show_key: string[];
|
|
71
|
+
conObj: AnyObject[];
|
|
72
|
+
conObjFirstLevel: AnyObject[];
|
|
73
|
+
}>>;
|
|
74
|
+
required: true;
|
|
75
|
+
};
|
|
76
|
+
onChange: {};
|
|
77
|
+
value: {
|
|
78
|
+
type: PropType<ValueType>;
|
|
79
|
+
};
|
|
80
|
+
}>> & {
|
|
81
|
+
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
82
|
+
}, {
|
|
83
|
+
options: AnyObject[];
|
|
84
|
+
lazyRequest: boolean;
|
|
85
|
+
}>;
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,229 @@
|
|
|
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
|
+
}
|
|
111
|
+
} catch (e) {
|
|
112
|
+
isString(e) && formRenderLog(e);
|
|
113
|
+
}
|
|
114
|
+
function sortOptionWithIdList(options, idList) {
|
|
115
|
+
return idList.map((id) => {
|
|
116
|
+
return options.find((option) => option[valueKey.value] === id);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function generateOptionWithIdList(options, idList) {
|
|
120
|
+
let lastOption = options[0];
|
|
121
|
+
const resultOption = idList.reduce((res, id, index) => {
|
|
122
|
+
const option = getTargetOption(options, id);
|
|
123
|
+
if (index === 0)
|
|
124
|
+
return [option];
|
|
125
|
+
lastOption = option;
|
|
126
|
+
res[0].children = [option];
|
|
127
|
+
return res;
|
|
128
|
+
}, []);
|
|
129
|
+
return {
|
|
130
|
+
options: resultOption,
|
|
131
|
+
lastOption
|
|
132
|
+
};
|
|
133
|
+
function getTargetOption(options2, value) {
|
|
134
|
+
return options2.find((o) => o[valueKey.value] === value);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
function parseLinkFromString2List(linkString) {
|
|
138
|
+
return linkString.split("_").filter((s) => s);
|
|
139
|
+
}
|
|
140
|
+
function createParams(wordbook, autograph, field2, key2) {
|
|
141
|
+
const params = {
|
|
142
|
+
autograph,
|
|
143
|
+
wordbookId: wordbook.id,
|
|
144
|
+
wordbookType: wordbook.type,
|
|
145
|
+
fieldKeys: wordbook.search_key ? JSON.stringify(wordbook.search_key) : void 0,
|
|
146
|
+
conObj: wordbook.conObj ? JSON.stringify(enrichConObj(wordbook.conObj, node)) : void 0,
|
|
147
|
+
keyword,
|
|
148
|
+
page: 1
|
|
149
|
+
};
|
|
150
|
+
return {
|
|
151
|
+
...getSearchRequestInfo(),
|
|
152
|
+
params,
|
|
153
|
+
key: key2
|
|
154
|
+
};
|
|
155
|
+
function enrichConObj(conObj, node2) {
|
|
156
|
+
return arrayed(conObj).map((item) => ({
|
|
157
|
+
...item,
|
|
158
|
+
value: node2 == null ? void 0 : node2[valueKey.value]
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
async function fetchPrimaryKeyValue(primaryKeys) {
|
|
164
|
+
if (!getSearchRequestInfo().primaryKeyUrl)
|
|
165
|
+
return [];
|
|
166
|
+
try {
|
|
167
|
+
return await asyncQueue.addAsync(createParams(props.wordbook, props.autograph, primaryKeys, fieldKey.value));
|
|
168
|
+
} catch (e) {
|
|
169
|
+
isString(e) && formRenderLog(e);
|
|
170
|
+
}
|
|
171
|
+
function createParams(wordbook, autograph, primaryKeys2, key2) {
|
|
172
|
+
const requestInfo = getSearchRequestInfo();
|
|
173
|
+
return {
|
|
174
|
+
key: key2,
|
|
175
|
+
autograph,
|
|
176
|
+
tableId: wordbook.id,
|
|
177
|
+
primaryKeyValue: primaryKeys2.join(","),
|
|
178
|
+
page: 1,
|
|
179
|
+
...requestInfo,
|
|
180
|
+
url: requestInfo.primaryKeyUrl
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function createOptionValue(node) {
|
|
185
|
+
const result = [];
|
|
186
|
+
let current = node;
|
|
187
|
+
while (current) {
|
|
188
|
+
result.unshift(node);
|
|
189
|
+
current = node.parent;
|
|
190
|
+
}
|
|
191
|
+
return result;
|
|
192
|
+
}
|
|
193
|
+
watch(() => props.wordbook, (wordbook, oldWordbook) => {
|
|
194
|
+
if (isEqual(wordbook, oldWordbook))
|
|
195
|
+
return;
|
|
196
|
+
optionsRef.value = [];
|
|
197
|
+
if (!wordbook)
|
|
198
|
+
return;
|
|
199
|
+
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
200
|
+
}, {
|
|
201
|
+
immediate: true
|
|
202
|
+
});
|
|
203
|
+
const {
|
|
204
|
+
injectValueValidate,
|
|
205
|
+
injectValueWatchFromEmpty,
|
|
206
|
+
injectValueBindKey
|
|
207
|
+
} = useCommonInjection();
|
|
208
|
+
injectValueWatchFromEmpty(valueRef, fetchData);
|
|
209
|
+
injectValueValidate(valueRef);
|
|
210
|
+
const key = injectValueBindKey(valueRef);
|
|
211
|
+
return () => createVNode(SearchCascader, {
|
|
212
|
+
"value": valueRef.value,
|
|
213
|
+
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
214
|
+
"options": optionsRef.value,
|
|
215
|
+
"key": key.value,
|
|
216
|
+
"labelKey": labelKey.value,
|
|
217
|
+
"valueKey": valueKey.value,
|
|
218
|
+
"search": fetchData,
|
|
219
|
+
"onFocus": visitedDecorator(field, props.onFocus)
|
|
220
|
+
}, {
|
|
221
|
+
empty: () => createVNode(script$1, null, null)
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
const LEVEL_SEARCH_CASCADE = connect(script, mapProps({
|
|
226
|
+
dataSource: "options"
|
|
227
|
+
}, assignUpdateValue));
|
|
228
|
+
|
|
229
|
+
export { LEVEL_SEARCH_CASCADE };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Func } from '../../../../../../es/shared/types';
|
|
1
|
+
import { AnyObject, Func } from '../../../../../../es/shared/types';
|
|
2
2
|
import { PropType } from 'vue';
|
|
3
3
|
export declare const SEARCH: import("vue").DefineComponent<{
|
|
4
4
|
value: {
|
|
@@ -21,6 +21,12 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
21
21
|
search_key: string[];
|
|
22
22
|
type: string;
|
|
23
23
|
value_key: string;
|
|
24
|
+
level_key: string;
|
|
25
|
+
link_key: string;
|
|
26
|
+
link_key_split: string;
|
|
27
|
+
show_key: string[];
|
|
28
|
+
conObj: AnyObject[];
|
|
29
|
+
conObjFirstLevel: AnyObject[];
|
|
24
30
|
}>>;
|
|
25
31
|
required: true;
|
|
26
32
|
};
|
|
@@ -49,6 +55,12 @@ export declare const SEARCH: import("vue").DefineComponent<{
|
|
|
49
55
|
search_key: string[];
|
|
50
56
|
type: string;
|
|
51
57
|
value_key: string;
|
|
58
|
+
level_key: string;
|
|
59
|
+
link_key: string;
|
|
60
|
+
link_key_split: string;
|
|
61
|
+
show_key: string[];
|
|
62
|
+
conObj: AnyObject[];
|
|
63
|
+
conObjFirstLevel: AnyObject[];
|
|
52
64
|
}>>;
|
|
53
65
|
required: true;
|
|
54
66
|
};
|
|
@@ -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,7 @@ class AsyncQueue {
|
|
|
42
42
|
const entry = this._entries.get(key);
|
|
43
43
|
if (entry.state === 1 /* DONE */) {
|
|
44
44
|
setTimeout(() => {
|
|
45
|
-
callback && callback(entry.error, entry.result);
|
|
45
|
+
callback && callback(cloneDeep(entry.error), cloneDeep(entry.result));
|
|
46
46
|
});
|
|
47
47
|
} else if (!entry.callbacks) {
|
|
48
48
|
entry.callbacks = [callback];
|
|
@@ -91,8 +91,8 @@ class AsyncQueue {
|
|
|
91
91
|
const callback = entry.callback;
|
|
92
92
|
entry.state = 1 /* DONE */;
|
|
93
93
|
entry.callback = void 0;
|
|
94
|
-
entry.result = r;
|
|
95
|
-
entry.error = e;
|
|
94
|
+
entry.result = cloneDeep(r);
|
|
95
|
+
entry.error = cloneDeep(e);
|
|
96
96
|
this._activeTasks--;
|
|
97
97
|
callback && callback(e, r);
|
|
98
98
|
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
|
};
|
|
@@ -74,6 +74,12 @@ export declare type FormWordbook = Partial<{
|
|
|
74
74
|
search_key: string[];
|
|
75
75
|
type: string;
|
|
76
76
|
value_key: string;
|
|
77
|
+
level_key: string;
|
|
78
|
+
link_key: string;
|
|
79
|
+
link_key_split: string;
|
|
80
|
+
show_key: string[];
|
|
81
|
+
conObj: AnyObject[];
|
|
82
|
+
conObjFirstLevel: AnyObject[];
|
|
77
83
|
}>;
|
|
78
84
|
export declare type FieldItem = {
|
|
79
85
|
/**
|