cnhis-design-vue 3.1.32 → 3.1.33-beta.0
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/form-render/index.js +1 -1
- package/es/components/form-render/src/FormRender.vue.js +1 -0
- package/es/components/form-render/src/components/renderer/checkbox.js +1 -1
- package/es/components/form-render/src/components/renderer/index.js +0 -6
- package/es/components/form-render/src/components/renderer/radio.js +1 -1
- package/es/components/form-render/src/components/renderer/searchCascade.d.ts +1 -1
- package/es/components/form-render/src/components/renderer/searchCascade.js +3 -2
- package/es/components/form-render/src/components/renderer/select.d.ts +97 -7
- package/es/components/form-render/src/components/renderer/select.js +64 -61
- package/es/components/form-render/src/hooks/index.d.ts +1 -1
- package/es/components/form-render/src/hooks/index.js +1 -1
- package/es/components/form-render/src/hooks/useBusinessBinding.d.ts +3 -3
- package/es/components/form-render/src/hooks/useBusinessBinding.js +15 -9
- package/es/components/form-render/src/hooks/useFieldListAdaptor.js +2 -10
- package/es/components/form-render/src/hooks/useFieldNormalize.js +2 -1
- package/es/components/form-render/src/hooks/useFormRenderOptions.d.ts +41 -0
- package/es/components/form-render/src/hooks/useFormRenderOptions.js +230 -0
- package/es/components/index.d.ts +1 -0
- package/es/components/index.js +2 -1
- package/es/components/insurance-sdk/index.d.ts +1 -0
- package/es/components/insurance-sdk/index.js +1 -0
- package/es/components/insurance-sdk/src/constants/index.d.ts +161 -0
- package/es/components/insurance-sdk/src/constants/index.js +160 -0
- package/es/components/insurance-sdk/src/utils/index.d.ts +1 -0
- package/es/components/insurance-sdk/src/utils/index.js +1 -0
- package/es/components/insurance-sdk/src/utils/insurance.d.ts +260 -0
- package/es/components/insurance-sdk/src/utils/insurance.js +268 -0
- package/es/components/recommend-search/index.d.ts +1 -1
- package/es/components/recommend-search/src/RecommendSearch.vue.d.ts +1 -1
- package/es/components/recommend-search/src/components/BaseSearch.vue.js +5 -5
- package/es/components/recommend-search/src/components/RecommendInput.vue.d.ts +1 -0
- package/es/components/recommend-search/src/components/RecommendInput.vue.js +6 -0
- package/es/components/recommend-search/src/components/RecommendMenu.vue.js +12 -12
- package/es/components/recommend-search/src/components/RecommendSelect.vue.d.ts +0 -1
- package/es/components/recommend-search/src/components/RecommendSelect.vue.js +2 -11
- package/es/shared/utils/index.d.ts +1 -0
- package/es/shared/utils/index.js +11 -1
- package/package.json +2 -2
- package/es/components/form-render/src/components/renderer/labelSelect.d.ts +0 -1
- package/es/components/form-render/src/components/renderer/labelSelect.js +0 -18
- package/es/components/form-render/src/components/renderer/recommendSelect.d.ts +0 -131
- package/es/components/form-render/src/components/renderer/recommendSelect.js +0 -213
- package/es/components/form-render/src/components/renderer/search.d.ts +0 -86
- package/es/components/form-render/src/components/renderer/search.js +0 -112
- package/es/components/form-render/src/hooks/useAutographOptions.d.ts +0 -17
- package/es/components/form-render/src/hooks/useAutographOptions.js +0 -68
|
@@ -7,12 +7,12 @@ import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.js';
|
|
|
7
7
|
const _hoisted_1 = { class: "recommend-search__menuRecommend" };
|
|
8
8
|
const _hoisted_2 = {
|
|
9
9
|
key: 0,
|
|
10
|
-
class: "recommend-
|
|
10
|
+
class: "recommend-search__commonRecommend"
|
|
11
11
|
};
|
|
12
12
|
const _hoisted_3 = { class: "recommend-search__menuRecommendList" };
|
|
13
13
|
const _hoisted_4 = {
|
|
14
14
|
key: 1,
|
|
15
|
-
class: "recommend-
|
|
15
|
+
class: "recommend-search__recentRecommend"
|
|
16
16
|
};
|
|
17
17
|
const _hoisted_5 = { class: "recommend-search__menuRecommendList" };
|
|
18
18
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
@@ -45,20 +45,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
45
45
|
}
|
|
46
46
|
return (_ctx, _cache) => {
|
|
47
47
|
return openBlock(), createElementBlock("section", _hoisted_1, [
|
|
48
|
-
__props.
|
|
48
|
+
__props.recentList.length ? (openBlock(), createElementBlock("section", _hoisted_2, [
|
|
49
49
|
createElementVNode("header", null, [
|
|
50
|
-
createTextVNode(" \
|
|
50
|
+
createTextVNode(" \u6700\u8FD1\u641C\u7D22 "),
|
|
51
51
|
__props.deletable ? (openBlock(), createBlock(unref(NIcon), {
|
|
52
52
|
key: 0,
|
|
53
53
|
component: unref(TrashOutline),
|
|
54
|
-
onClick:
|
|
54
|
+
onClick: deleteCommonTag
|
|
55
55
|
}, null, 8, ["component"])) : createCommentVNode("v-if", true)
|
|
56
56
|
]),
|
|
57
57
|
createElementVNode("div", _hoisted_3, [
|
|
58
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.
|
|
58
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.recentList, (item) => {
|
|
59
59
|
return openBlock(), createBlock(unref(NTag), {
|
|
60
60
|
size: "small",
|
|
61
|
-
onClick: ($event) =>
|
|
61
|
+
onClick: ($event) => clickRecentTag(item),
|
|
62
62
|
type: "primary",
|
|
63
63
|
key: item.itemObj
|
|
64
64
|
}, {
|
|
@@ -70,20 +70,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
70
70
|
}), 128))
|
|
71
71
|
])
|
|
72
72
|
])) : createCommentVNode("v-if", true),
|
|
73
|
-
__props.
|
|
73
|
+
__props.commonList.length ? (openBlock(), createElementBlock("section", _hoisted_4, [
|
|
74
74
|
createElementVNode("header", null, [
|
|
75
|
-
createTextVNode(" \
|
|
75
|
+
createTextVNode(" \u5E38\u7528\u641C\u7D22 "),
|
|
76
76
|
__props.deletable ? (openBlock(), createBlock(unref(NIcon), {
|
|
77
77
|
key: 0,
|
|
78
78
|
component: unref(TrashOutline),
|
|
79
|
-
onClick:
|
|
79
|
+
onClick: deleteRecentTag
|
|
80
80
|
}, null, 8, ["component"])) : createCommentVNode("v-if", true)
|
|
81
81
|
]),
|
|
82
82
|
createElementVNode("div", _hoisted_5, [
|
|
83
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.
|
|
83
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.commonList, (item) => {
|
|
84
84
|
return openBlock(), createBlock(unref(NTag), {
|
|
85
85
|
size: "small",
|
|
86
|
-
onClick: ($event) =>
|
|
86
|
+
onClick: ($event) => clickCommonTag(item),
|
|
87
87
|
type: "primary",
|
|
88
88
|
key: item.itemObj
|
|
89
89
|
}, {
|
|
@@ -79,7 +79,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
79
79
|
showRef: import("vue").Ref<boolean>;
|
|
80
80
|
displayPlaceholder: import("vue").ComputedRef<string>;
|
|
81
81
|
currentOption: import("vue").Ref<AnyObject | undefined>;
|
|
82
|
-
jsonParse: import("@vueuse/core").UseMemoizedFn<any, [value: string]>;
|
|
83
82
|
getRecommendOption: (item: RecommendItem) => any;
|
|
84
83
|
commonOptions: import("vue").ComputedRef<any[]>;
|
|
85
84
|
recentOptions: import("vue").ComputedRef<any[]>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineComponent, ref, computed, openBlock, createElementBlock, createVNode, mergeProps, unref, isRef, withCtx, createElementVNode, normalizeProps, guardReactiveProps, Fragment, renderList, normalizeClass, toDisplayString, createBlock, createCommentVNode, renderSlot } from 'vue';
|
|
2
|
+
import { jsonParse } from '../../../../shared/utils/index.js';
|
|
2
3
|
import { Checkmark } from '@vicons/ionicons5';
|
|
3
|
-
import {
|
|
4
|
+
import { useVModel, useVirtualList } from '@vueuse/core';
|
|
4
5
|
import { isObject } from 'lodash-es';
|
|
5
6
|
import BaseSearch from './BaseSearch.vue.js';
|
|
6
7
|
import { NIcon } from 'naive-ui';
|
|
@@ -30,16 +31,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30
31
|
return showRef.value ? props.editPlaceholder : props.placeholder;
|
|
31
32
|
});
|
|
32
33
|
const currentOption = ref();
|
|
33
|
-
const jsonParse = useMemoize(
|
|
34
|
-
(value) => {
|
|
35
|
-
try {
|
|
36
|
-
return JSON.parse(value);
|
|
37
|
-
} catch (e) {
|
|
38
|
-
return {};
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
{ getKey: (value) => value }
|
|
42
|
-
);
|
|
43
34
|
function getRecommendOption(item) {
|
|
44
35
|
return jsonParse(item.itemObj);
|
|
45
36
|
}
|
|
@@ -12,3 +12,4 @@ export declare function separateMetaModule<T extends AnyObject>(modules: Record<
|
|
|
12
12
|
export declare function findAncestor(ele: HTMLElement | null, finder: (ele: HTMLElement) => boolean): HTMLElement | null;
|
|
13
13
|
export declare function widthAppend(value: string | number, append?: string): string;
|
|
14
14
|
export declare function targetStringIncludes(arr: string[], target: string): boolean;
|
|
15
|
+
export declare const jsonParse: import("@vueuse/core").UseMemoizedFn<any, [value: string]>;
|
package/es/shared/utils/index.js
CHANGED
|
@@ -139,5 +139,15 @@ function widthAppend(value, append = "px") {
|
|
|
139
139
|
function targetStringIncludes(arr, target) {
|
|
140
140
|
return arr.some((value) => target.includes(value));
|
|
141
141
|
}
|
|
142
|
+
const jsonParse = useMemoize(
|
|
143
|
+
(value) => {
|
|
144
|
+
try {
|
|
145
|
+
return JSON.parse(value);
|
|
146
|
+
} catch (e) {
|
|
147
|
+
return {};
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
{ getKey: (value) => value }
|
|
151
|
+
);
|
|
142
152
|
|
|
143
|
-
export { DMZ, arrayed, deepOmit, findAncestor, generateTimeFormat, getStringWidth, safeComponentRegister, separateMetaModule, targetStringIncludes, traverse, uuidGenerator, widthAppend };
|
|
153
|
+
export { DMZ, arrayed, deepOmit, findAncestor, generateTimeFormat, getStringWidth, jsonParse, safeComponentRegister, separateMetaModule, targetStringIncludes, traverse, uuidGenerator, widthAppend };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cnhis-design-vue",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.33-beta.0",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"module": "./es/components/index.js",
|
|
6
6
|
"main": "./es/components/index.js",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"iOS 7",
|
|
62
62
|
"last 3 iOS versions"
|
|
63
63
|
],
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "772c8fae6e11c1010a9b1c3e1e047de233ad2ad3"
|
|
65
65
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const LABEL: import("vue").DefineComponent<{}, () => string, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { connect, mapProps } from '@formily/vue';
|
|
2
|
-
import { defineComponent } from 'vue';
|
|
3
|
-
|
|
4
|
-
const script = defineComponent({
|
|
5
|
-
name: "FormLabel",
|
|
6
|
-
setup(props) {
|
|
7
|
-
return () => {
|
|
8
|
-
return "";
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const LABEL = connect(script, mapProps((props, field) => {
|
|
13
|
-
return {
|
|
14
|
-
...props
|
|
15
|
-
};
|
|
16
|
-
}));
|
|
17
|
-
|
|
18
|
-
export { LABEL };
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../../es/shared/types';
|
|
2
|
-
import { PropType } from 'vue';
|
|
3
|
-
import { RecommendIds } from '../../../../../../es/components/form-render';
|
|
4
|
-
export declare const RECOMMEND_SELECT: import("vue").DefineComponent<{
|
|
5
|
-
value: {
|
|
6
|
-
type: StringConstructor;
|
|
7
|
-
};
|
|
8
|
-
commonList: {
|
|
9
|
-
type: PropType<AnyObject[]>;
|
|
10
|
-
};
|
|
11
|
-
recentList: {
|
|
12
|
-
type: PropType<AnyObject[]>;
|
|
13
|
-
};
|
|
14
|
-
options: {
|
|
15
|
-
type: PropType<AnyObject[]>;
|
|
16
|
-
default: () => never[];
|
|
17
|
-
};
|
|
18
|
-
autograph: {
|
|
19
|
-
type: StringConstructor;
|
|
20
|
-
};
|
|
21
|
-
lazyRequest: {
|
|
22
|
-
type: BooleanConstructor;
|
|
23
|
-
default: boolean;
|
|
24
|
-
};
|
|
25
|
-
requestCache: {
|
|
26
|
-
type: BooleanConstructor;
|
|
27
|
-
default: boolean;
|
|
28
|
-
};
|
|
29
|
-
wordbook: {
|
|
30
|
-
type: PropType<Partial<{
|
|
31
|
-
level_num: number;
|
|
32
|
-
id: string;
|
|
33
|
-
name: string;
|
|
34
|
-
render_key: string[];
|
|
35
|
-
search_key: string[];
|
|
36
|
-
primary_key: string;
|
|
37
|
-
type: string;
|
|
38
|
-
value_key: string;
|
|
39
|
-
level_key: string;
|
|
40
|
-
link_key: string;
|
|
41
|
-
link_key_split: string;
|
|
42
|
-
show_key: string[];
|
|
43
|
-
conObj: AnyObject[];
|
|
44
|
-
conObjFirstLevel: AnyObject[];
|
|
45
|
-
}>>;
|
|
46
|
-
};
|
|
47
|
-
getRecommendInfo: {
|
|
48
|
-
type: PropType<() => RecommendIds>;
|
|
49
|
-
};
|
|
50
|
-
recommendNum: {
|
|
51
|
-
type: NumberConstructor;
|
|
52
|
-
default: number;
|
|
53
|
-
};
|
|
54
|
-
recommendCache: {
|
|
55
|
-
type: BooleanConstructor;
|
|
56
|
-
default: boolean;
|
|
57
|
-
};
|
|
58
|
-
recommendDeletable: {
|
|
59
|
-
type: BooleanConstructor;
|
|
60
|
-
default: boolean;
|
|
61
|
-
};
|
|
62
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:value" | "postRecommend" | "deleteRecommend")[], "update:value" | "postRecommend" | "deleteRecommend", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
|
-
value: {
|
|
64
|
-
type: StringConstructor;
|
|
65
|
-
};
|
|
66
|
-
commonList: {
|
|
67
|
-
type: PropType<AnyObject[]>;
|
|
68
|
-
};
|
|
69
|
-
recentList: {
|
|
70
|
-
type: PropType<AnyObject[]>;
|
|
71
|
-
};
|
|
72
|
-
options: {
|
|
73
|
-
type: PropType<AnyObject[]>;
|
|
74
|
-
default: () => never[];
|
|
75
|
-
};
|
|
76
|
-
autograph: {
|
|
77
|
-
type: StringConstructor;
|
|
78
|
-
};
|
|
79
|
-
lazyRequest: {
|
|
80
|
-
type: BooleanConstructor;
|
|
81
|
-
default: boolean;
|
|
82
|
-
};
|
|
83
|
-
requestCache: {
|
|
84
|
-
type: BooleanConstructor;
|
|
85
|
-
default: boolean;
|
|
86
|
-
};
|
|
87
|
-
wordbook: {
|
|
88
|
-
type: PropType<Partial<{
|
|
89
|
-
level_num: number;
|
|
90
|
-
id: string;
|
|
91
|
-
name: string;
|
|
92
|
-
render_key: string[];
|
|
93
|
-
search_key: string[];
|
|
94
|
-
primary_key: string;
|
|
95
|
-
type: string;
|
|
96
|
-
value_key: string;
|
|
97
|
-
level_key: string;
|
|
98
|
-
link_key: string;
|
|
99
|
-
link_key_split: string;
|
|
100
|
-
show_key: string[];
|
|
101
|
-
conObj: AnyObject[];
|
|
102
|
-
conObjFirstLevel: AnyObject[];
|
|
103
|
-
}>>;
|
|
104
|
-
};
|
|
105
|
-
getRecommendInfo: {
|
|
106
|
-
type: PropType<() => RecommendIds>;
|
|
107
|
-
};
|
|
108
|
-
recommendNum: {
|
|
109
|
-
type: NumberConstructor;
|
|
110
|
-
default: number;
|
|
111
|
-
};
|
|
112
|
-
recommendCache: {
|
|
113
|
-
type: BooleanConstructor;
|
|
114
|
-
default: boolean;
|
|
115
|
-
};
|
|
116
|
-
recommendDeletable: {
|
|
117
|
-
type: BooleanConstructor;
|
|
118
|
-
default: boolean;
|
|
119
|
-
};
|
|
120
|
-
}>> & {
|
|
121
|
-
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
122
|
-
onPostRecommend?: ((...args: any[]) => any) | undefined;
|
|
123
|
-
onDeleteRecommend?: ((...args: any[]) => any) | undefined;
|
|
124
|
-
}, {
|
|
125
|
-
options: AnyObject[];
|
|
126
|
-
lazyRequest: boolean;
|
|
127
|
-
requestCache: boolean;
|
|
128
|
-
recommendDeletable: boolean;
|
|
129
|
-
recommendNum: number;
|
|
130
|
-
recommendCache: boolean;
|
|
131
|
-
}>;
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { defineComponent, inject, createVNode, ref, computed } from 'vue';
|
|
2
|
-
import { connect, mapProps } from '@formily/vue';
|
|
3
|
-
import { useVModel } from '@vueuse/core';
|
|
4
|
-
import { isFunction, omit } from 'lodash-es';
|
|
5
|
-
import '../../../index.js';
|
|
6
|
-
import { InjectionAsyncQueue } from '../../constants/index.js';
|
|
7
|
-
import RecommendSearch from '../../../../recommend-search/index.js';
|
|
8
|
-
import { useFormField } from '../../hooks/useFormField.js';
|
|
9
|
-
import { useAutographOptions } from '../../hooks/useAutographOptions.js';
|
|
10
|
-
import { assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
|
|
11
|
-
import { useCommonInjection } from '../../hooks/useCommonInjection.js';
|
|
12
|
-
import { useFormRequest } from '../../hooks/useFormRequest.js';
|
|
13
|
-
|
|
14
|
-
function createPropRef(props, key) {
|
|
15
|
-
const _list = ref();
|
|
16
|
-
return computed({
|
|
17
|
-
get() {
|
|
18
|
-
if (_list.value)
|
|
19
|
-
return _list.value;
|
|
20
|
-
return props[key];
|
|
21
|
-
},
|
|
22
|
-
set(value) {
|
|
23
|
-
_list.value = value;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
const script = defineComponent({
|
|
28
|
-
name: "FormRecommendSearch",
|
|
29
|
-
props: {
|
|
30
|
-
value: {
|
|
31
|
-
type: String
|
|
32
|
-
},
|
|
33
|
-
commonList: {
|
|
34
|
-
type: Array
|
|
35
|
-
},
|
|
36
|
-
recentList: {
|
|
37
|
-
type: Array
|
|
38
|
-
},
|
|
39
|
-
options: {
|
|
40
|
-
type: Array,
|
|
41
|
-
default: () => []
|
|
42
|
-
},
|
|
43
|
-
autograph: {
|
|
44
|
-
type: String
|
|
45
|
-
},
|
|
46
|
-
lazyRequest: {
|
|
47
|
-
type: Boolean,
|
|
48
|
-
default: false
|
|
49
|
-
},
|
|
50
|
-
requestCache: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
default: true
|
|
53
|
-
},
|
|
54
|
-
wordbook: {
|
|
55
|
-
type: Object
|
|
56
|
-
},
|
|
57
|
-
getRecommendInfo: {
|
|
58
|
-
type: Function
|
|
59
|
-
},
|
|
60
|
-
recommendNum: {
|
|
61
|
-
type: Number,
|
|
62
|
-
default: 5
|
|
63
|
-
},
|
|
64
|
-
recommendCache: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: false
|
|
67
|
-
},
|
|
68
|
-
recommendDeletable: {
|
|
69
|
-
type: Boolean,
|
|
70
|
-
default: true
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
emits: ["update:value", "postRecommend", "deleteRecommend"],
|
|
74
|
-
setup(props, {
|
|
75
|
-
emit
|
|
76
|
-
}) {
|
|
77
|
-
const valueRef = useVModel(props, "value", emit);
|
|
78
|
-
const {
|
|
79
|
-
fieldKey
|
|
80
|
-
} = useFormField();
|
|
81
|
-
const {
|
|
82
|
-
labelKey,
|
|
83
|
-
valueKey,
|
|
84
|
-
options,
|
|
85
|
-
fetchData: fetchOptions
|
|
86
|
-
} = useAutographOptions(props, valueRef);
|
|
87
|
-
const commonListRef = createPropRef(props, "commonList");
|
|
88
|
-
const recentListRef = createPropRef(props, "recentList");
|
|
89
|
-
const asyncQueue = inject(InjectionAsyncQueue);
|
|
90
|
-
const {
|
|
91
|
-
getRecommendRequestInfo,
|
|
92
|
-
getHttpInstance
|
|
93
|
-
} = useFormRequest();
|
|
94
|
-
function getRecommendConfig(type) {
|
|
95
|
-
const {
|
|
96
|
-
url,
|
|
97
|
-
getRecommendIds
|
|
98
|
-
} = getRecommendRequestInfo();
|
|
99
|
-
const globInfo = isFunction(getRecommendIds) ? getRecommendIds() : {};
|
|
100
|
-
const widgetInfo = isFunction(props.getRecommendInfo) ? props.getRecommendInfo() : {};
|
|
101
|
-
return {
|
|
102
|
-
url: url[type],
|
|
103
|
-
info: Object.assign({}, globInfo, widgetInfo)
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
async function getRecommend() {
|
|
107
|
-
if (commonListRef.value && recentListRef.value && props.recommendCache)
|
|
108
|
-
return;
|
|
109
|
-
const list = await asyncQueue.addAsync(createParams(fieldKey.value, props.recommendCache));
|
|
110
|
-
const {
|
|
111
|
-
commonly,
|
|
112
|
-
recently
|
|
113
|
-
} = classifyList(list);
|
|
114
|
-
commonListRef.value = commonly;
|
|
115
|
-
recentListRef.value = recently;
|
|
116
|
-
function classifyList(list2) {
|
|
117
|
-
return list2.reduce((res, item) => {
|
|
118
|
-
if (item.type === "commonly") {
|
|
119
|
-
res.commonly.push(omit(item, ["type"]));
|
|
120
|
-
} else if (item.type === "recently") {
|
|
121
|
-
res.recently.push(omit(item, ["type"]));
|
|
122
|
-
}
|
|
123
|
-
return res;
|
|
124
|
-
}, {
|
|
125
|
-
commonly: [],
|
|
126
|
-
recently: []
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
function createParams(key2, cache) {
|
|
130
|
-
const {
|
|
131
|
-
url,
|
|
132
|
-
info
|
|
133
|
-
} = getRecommendConfig("get");
|
|
134
|
-
return {
|
|
135
|
-
url,
|
|
136
|
-
method: "get",
|
|
137
|
-
key: key2,
|
|
138
|
-
cache,
|
|
139
|
-
params: {
|
|
140
|
-
...info,
|
|
141
|
-
recNum: props.recommendNum,
|
|
142
|
-
keyword: ""
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
async function postRecommend({
|
|
148
|
-
option
|
|
149
|
-
}) {
|
|
150
|
-
const http = getHttpInstance();
|
|
151
|
-
if (!http)
|
|
152
|
-
return;
|
|
153
|
-
const {
|
|
154
|
-
url,
|
|
155
|
-
info
|
|
156
|
-
} = getRecommendConfig("post");
|
|
157
|
-
emit("postRecommend", await http.post(url, {
|
|
158
|
-
...info,
|
|
159
|
-
keyword: "",
|
|
160
|
-
itemId: valueKey.value,
|
|
161
|
-
itemObj: JSON.stringify(option)
|
|
162
|
-
}));
|
|
163
|
-
}
|
|
164
|
-
async function deleteRecommend(recType) {
|
|
165
|
-
const http = getHttpInstance();
|
|
166
|
-
if (!http)
|
|
167
|
-
return;
|
|
168
|
-
const {
|
|
169
|
-
url,
|
|
170
|
-
info
|
|
171
|
-
} = getRecommendConfig("delete");
|
|
172
|
-
if (recType === "COMMONLY")
|
|
173
|
-
commonListRef.value = [];
|
|
174
|
-
else if (recType === "RECENTLY")
|
|
175
|
-
recentListRef.value = [];
|
|
176
|
-
emit("deleteRecommend", await http.delete(url, {
|
|
177
|
-
...info,
|
|
178
|
-
keyword: "",
|
|
179
|
-
recType
|
|
180
|
-
}));
|
|
181
|
-
}
|
|
182
|
-
async function fetchData(content = "") {
|
|
183
|
-
fetchOptions(content);
|
|
184
|
-
getRecommend();
|
|
185
|
-
}
|
|
186
|
-
const {
|
|
187
|
-
injectValueBindKey
|
|
188
|
-
} = useCommonInjection();
|
|
189
|
-
const key = injectValueBindKey(valueRef);
|
|
190
|
-
return () => {
|
|
191
|
-
return createVNode(RecommendSearch, {
|
|
192
|
-
"mode": "select",
|
|
193
|
-
"value": valueRef.value,
|
|
194
|
-
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
195
|
-
"label-key": labelKey.value,
|
|
196
|
-
"value-key": valueKey.value,
|
|
197
|
-
"key": key.value,
|
|
198
|
-
"options": options.value,
|
|
199
|
-
"common-list": commonListRef.value,
|
|
200
|
-
"recent-list": recentListRef.value,
|
|
201
|
-
"recommend-deletable": props.recommendDeletable,
|
|
202
|
-
"onSearch": fetchData,
|
|
203
|
-
"onChoose": postRecommend,
|
|
204
|
-
"onDelete": deleteRecommend
|
|
205
|
-
}, null);
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
const RECOMMEND_SELECT = connect(script, mapProps({
|
|
210
|
-
dataSource: "options"
|
|
211
|
-
}, assignUpdateValue, assignClearBindVisited));
|
|
212
|
-
|
|
213
|
-
export { RECOMMEND_SELECT };
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Func } from '../../../../../../es/shared/types';
|
|
2
|
-
import { PropType } from 'vue';
|
|
3
|
-
export declare const SEARCH: import("vue").DefineComponent<{
|
|
4
|
-
value: {
|
|
5
|
-
type: StringConstructor;
|
|
6
|
-
};
|
|
7
|
-
autograph: {
|
|
8
|
-
type: StringConstructor;
|
|
9
|
-
required: true;
|
|
10
|
-
};
|
|
11
|
-
lazyRequest: {
|
|
12
|
-
type: BooleanConstructor;
|
|
13
|
-
default: boolean;
|
|
14
|
-
};
|
|
15
|
-
requestCache: {
|
|
16
|
-
type: BooleanConstructor;
|
|
17
|
-
default: boolean;
|
|
18
|
-
};
|
|
19
|
-
wordbook: {
|
|
20
|
-
type: PropType<Partial<{
|
|
21
|
-
level_num: number;
|
|
22
|
-
id: string;
|
|
23
|
-
name: string;
|
|
24
|
-
render_key: string[];
|
|
25
|
-
search_key: string[];
|
|
26
|
-
primary_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: import("../../../../../../es/shared/types").AnyObject[];
|
|
34
|
-
conObjFirstLevel: import("../../../../../../es/shared/types").AnyObject[];
|
|
35
|
-
}>>;
|
|
36
|
-
required: true;
|
|
37
|
-
};
|
|
38
|
-
onFocus: {
|
|
39
|
-
type: PropType<Func<any[], any>>;
|
|
40
|
-
};
|
|
41
|
-
onChange: {};
|
|
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
|
-
value: {
|
|
44
|
-
type: StringConstructor;
|
|
45
|
-
};
|
|
46
|
-
autograph: {
|
|
47
|
-
type: StringConstructor;
|
|
48
|
-
required: true;
|
|
49
|
-
};
|
|
50
|
-
lazyRequest: {
|
|
51
|
-
type: BooleanConstructor;
|
|
52
|
-
default: boolean;
|
|
53
|
-
};
|
|
54
|
-
requestCache: {
|
|
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
|
-
primary_key: string;
|
|
66
|
-
type: string;
|
|
67
|
-
value_key: string;
|
|
68
|
-
level_key: string;
|
|
69
|
-
link_key: string;
|
|
70
|
-
link_key_split: string;
|
|
71
|
-
show_key: string[];
|
|
72
|
-
conObj: import("../../../../../../es/shared/types").AnyObject[];
|
|
73
|
-
conObjFirstLevel: import("../../../../../../es/shared/types").AnyObject[];
|
|
74
|
-
}>>;
|
|
75
|
-
required: true;
|
|
76
|
-
};
|
|
77
|
-
onFocus: {
|
|
78
|
-
type: PropType<Func<any[], any>>;
|
|
79
|
-
};
|
|
80
|
-
onChange: {};
|
|
81
|
-
}>> & {
|
|
82
|
-
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
83
|
-
}, {
|
|
84
|
-
lazyRequest: boolean;
|
|
85
|
-
requestCache: boolean;
|
|
86
|
-
}>;
|