cnhis-design-vue 3.1.32-beta.2 → 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/LICENSE.md +0 -21
- package/es/components/big-table/src/components/edit-form/dist/edit-date.d.ts +0 -36
- package/es/components/big-table/src/components/edit-form/dist/edit-select.d.ts +0 -37
- package/es/components/big-table/src/components/edit-form/dist/edit-time.d.ts +0 -45
- package/es/components/form-render/src/components/renderer/dist/levelSearchCascader.d.ts +0 -65
- package/es/components/form-render/src/components/renderer/dist/remoteSearch.d.ts +0 -46
- package/es/components/form-render/src/components/renderer/dist/search.d.ts +0 -56
- package/es/components/form-render/src/components/renderer/dist/select.d.ts +0 -55
- 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
- package/es/components/iho-table/src/components/dist/IhoTableColumn.d.ts +0 -20
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dateRendererPlugin/dist/index.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dist/inputRendererPlugin.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dist/numberRendererPlugin.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/dist/timeRendererPlugin.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/dist/editSelect.d.ts +0 -42
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/selectRendererPlugin/dist/index.d.ts +0 -3
- package/es/components/iho-table/src/plugins/rendererPlugins/editableWidgets/separateRendererPlugin/dist/index.d.ts +0 -3
|
@@ -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
|
-
}>;
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { defineComponent, inject, createVNode } from 'vue';
|
|
2
|
-
import { useVModel } from '@vueuse/core';
|
|
3
|
-
import { cloneDeep } from 'lodash-es';
|
|
4
|
-
import { InjectionChangeContextCollector } from '../../constants/index.js';
|
|
5
|
-
import '../../../../../shared/utils/index.js';
|
|
6
|
-
import '../../../index.js';
|
|
7
|
-
import '../../utils/index.js';
|
|
8
|
-
import { useFormField } from '../../hooks/useFormField.js';
|
|
9
|
-
import '../../../../../shared/utils/tapable/SyncHook.js';
|
|
10
|
-
import '../../../../../shared/utils/tapable/SyncBailHook.js';
|
|
11
|
-
import '../../../../../shared/utils/tapable/SyncWaterfallHook.js';
|
|
12
|
-
import '../../../../../shared/utils/tapable/SyncLoopHook.js';
|
|
13
|
-
import '../../../../../shared/utils/tapable/AsyncParallelHook.js';
|
|
14
|
-
import '../../../../../shared/utils/tapable/AsyncParallelBailHook.js';
|
|
15
|
-
import '../../../../../shared/utils/tapable/AsyncSeriesHook.js';
|
|
16
|
-
import '../../../../../shared/utils/tapable/AsyncSeriesBailHook.js';
|
|
17
|
-
import '../../../../../shared/utils/tapable/AsyncSeriesLoopHook.js';
|
|
18
|
-
import '../../../../../shared/utils/tapable/AsyncSeriesWaterfallHook.js';
|
|
19
|
-
import '../../hooks/useFormValidator.js';
|
|
20
|
-
import '@formily/core';
|
|
21
|
-
import { useAutographOptions } from '../../hooks/useAutographOptions.js';
|
|
22
|
-
import '@vue/shared';
|
|
23
|
-
import { connect, mapProps } from '@formily/vue';
|
|
24
|
-
import './index.js';
|
|
25
|
-
import { useCommonInjection, useSelectOptionProps } from '../../hooks/useCommonInjection.js';
|
|
26
|
-
import { NSelect } from 'naive-ui';
|
|
27
|
-
import { visitedDecorator, assignUpdateValue, assignClearBindVisited } from '../../utils/schema.js';
|
|
28
|
-
|
|
29
|
-
const script = defineComponent({
|
|
30
|
-
name: "FormSearch",
|
|
31
|
-
props: {
|
|
32
|
-
value: {
|
|
33
|
-
type: String
|
|
34
|
-
},
|
|
35
|
-
autograph: {
|
|
36
|
-
type: String,
|
|
37
|
-
required: true
|
|
38
|
-
},
|
|
39
|
-
lazyRequest: {
|
|
40
|
-
type: Boolean,
|
|
41
|
-
default: true
|
|
42
|
-
},
|
|
43
|
-
requestCache: {
|
|
44
|
-
type: Boolean,
|
|
45
|
-
default: true
|
|
46
|
-
},
|
|
47
|
-
wordbook: {
|
|
48
|
-
type: Object,
|
|
49
|
-
required: true
|
|
50
|
-
},
|
|
51
|
-
onFocus: {
|
|
52
|
-
type: Function
|
|
53
|
-
},
|
|
54
|
-
onChange: {}
|
|
55
|
-
},
|
|
56
|
-
emits: ["update:value"],
|
|
57
|
-
setup(props, {
|
|
58
|
-
slots,
|
|
59
|
-
emit
|
|
60
|
-
}) {
|
|
61
|
-
const valueRef = useVModel(props, "value", emit);
|
|
62
|
-
const {
|
|
63
|
-
field,
|
|
64
|
-
fieldKey
|
|
65
|
-
} = useFormField();
|
|
66
|
-
const {
|
|
67
|
-
fetchData,
|
|
68
|
-
labelKey,
|
|
69
|
-
valueKey,
|
|
70
|
-
options
|
|
71
|
-
} = useAutographOptions(props, valueRef);
|
|
72
|
-
const changeContextCollector = inject(InjectionChangeContextCollector);
|
|
73
|
-
changeContextCollector.setContext(fieldKey.value, (v) => {
|
|
74
|
-
return {
|
|
75
|
-
currentOption: cloneDeep(getCurrentOption(v))
|
|
76
|
-
};
|
|
77
|
-
function getCurrentOption(v2) {
|
|
78
|
-
return options.value.find((option) => option[valueKey.value] === v2);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
const {
|
|
82
|
-
injectValueValidate,
|
|
83
|
-
injectValueWatchFromEmpty,
|
|
84
|
-
injectValueBindKey
|
|
85
|
-
} = useCommonInjection();
|
|
86
|
-
injectValueWatchFromEmpty(valueRef, fetchData);
|
|
87
|
-
injectValueValidate(valueRef);
|
|
88
|
-
const key = injectValueBindKey(valueRef);
|
|
89
|
-
const {
|
|
90
|
-
menuProps,
|
|
91
|
-
nodeProps
|
|
92
|
-
} = useSelectOptionProps();
|
|
93
|
-
return () => createVNode(NSelect, {
|
|
94
|
-
"remote": true,
|
|
95
|
-
"filterable": true,
|
|
96
|
-
"key": key.value,
|
|
97
|
-
"value": valueRef.value,
|
|
98
|
-
"onUpdate:value": ($event) => valueRef.value = $event,
|
|
99
|
-
"menu-props": menuProps,
|
|
100
|
-
"node-props": nodeProps,
|
|
101
|
-
"labelField": labelKey.value,
|
|
102
|
-
"valueField": valueKey.value,
|
|
103
|
-
"options": options.value,
|
|
104
|
-
"onSearch": fetchData,
|
|
105
|
-
"onUpdate:show": (show) => show && fetchData(),
|
|
106
|
-
"onFocus": visitedDecorator(field, props.onFocus)
|
|
107
|
-
}, slots);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
const SEARCH = connect(script, mapProps(assignUpdateValue, assignClearBindVisited));
|
|
111
|
-
|
|
112
|
-
export { SEARCH };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AnyObject } from '../../../../../es/shared/types';
|
|
2
|
-
import { Ref } from 'vue';
|
|
3
|
-
import { FormWordbook } from '../../../../../es/components/form-render';
|
|
4
|
-
export declare function useAutographOptions(props: {
|
|
5
|
-
requestCache?: boolean;
|
|
6
|
-
wordbook?: FormWordbook;
|
|
7
|
-
autograph?: string;
|
|
8
|
-
lazyRequest?: boolean;
|
|
9
|
-
options?: AnyObject[];
|
|
10
|
-
}, valueRef: Ref): {
|
|
11
|
-
valueRef: Ref<any>;
|
|
12
|
-
options: import("vue").ComputedRef<AnyObject[]>;
|
|
13
|
-
fetchData: (content?: string) => Promise<void>;
|
|
14
|
-
labelKey: import("vue").ComputedRef<string>;
|
|
15
|
-
valueKey: import("vue").ComputedRef<string>;
|
|
16
|
-
lastSearch: Ref<string>;
|
|
17
|
-
};
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { useDebounceFn } from '@vueuse/core';
|
|
2
|
-
import { isString, isEqual } from 'lodash-es';
|
|
3
|
-
import { getCurrentInstance, inject, computed, ref, watch } from 'vue';
|
|
4
|
-
import '../../index.js';
|
|
5
|
-
import { InjectionAsyncQueue } from '../constants/index.js';
|
|
6
|
-
import { formRenderLog, optionMatcherWithKeyword } from '../utils/index.js';
|
|
7
|
-
import { useFormField } from './useFormField.js';
|
|
8
|
-
import { useFormRequest } from './useFormRequest.js';
|
|
9
|
-
|
|
10
|
-
function useAutographOptions(props, valueRef) {
|
|
11
|
-
if (!getCurrentInstance())
|
|
12
|
-
throw new Error("can't use this hook out of setup environment");
|
|
13
|
-
const asyncQueue = inject(InjectionAsyncQueue);
|
|
14
|
-
const labelKey = computed(() => {
|
|
15
|
-
var _a, _b, _c;
|
|
16
|
-
return (_c = (_b = (_a = props.wordbook) == null ? void 0 : _a.render_key) == null ? void 0 : _b[0]) != null ? _c : "text";
|
|
17
|
-
});
|
|
18
|
-
const valueKey = computed(() => {
|
|
19
|
-
var _a, _b;
|
|
20
|
-
return (_b = (_a = props.wordbook) == null ? void 0 : _a.value_key) != null ? _b : "value";
|
|
21
|
-
});
|
|
22
|
-
const remoteOptions = ref(null);
|
|
23
|
-
const lastSearch = ref("");
|
|
24
|
-
const { fieldKey } = useFormField();
|
|
25
|
-
const { getSearchRequestInfo } = useFormRequest();
|
|
26
|
-
const fetchData = useDebounceFn(async function(content) {
|
|
27
|
-
if (!props.autograph || !props.wordbook)
|
|
28
|
-
return;
|
|
29
|
-
lastSearch.value = content || "";
|
|
30
|
-
try {
|
|
31
|
-
remoteOptions.value = await asyncQueue.addAsync(
|
|
32
|
-
createParams(props.wordbook, props.autograph, fieldKey.value)
|
|
33
|
-
);
|
|
34
|
-
} catch (e) {
|
|
35
|
-
isString(e) && formRenderLog(e);
|
|
36
|
-
}
|
|
37
|
-
function createParams(wordbook, autograph, key) {
|
|
38
|
-
const params = {
|
|
39
|
-
autograph,
|
|
40
|
-
wordbookId: wordbook.id,
|
|
41
|
-
wordbookType: wordbook.type,
|
|
42
|
-
fieldKeys: wordbook.search_key,
|
|
43
|
-
keyword: "",
|
|
44
|
-
page: 1
|
|
45
|
-
};
|
|
46
|
-
return { ...getSearchRequestInfo(), params, key, cache: props.requestCache };
|
|
47
|
-
}
|
|
48
|
-
}, 300);
|
|
49
|
-
const options = computed(() => {
|
|
50
|
-
var _a;
|
|
51
|
-
return remoteOptions.value ? optionMatcherWithKeyword(remoteOptions.value, lastSearch.value, labelKey.value) : (_a = props.options) != null ? _a : [];
|
|
52
|
-
});
|
|
53
|
-
watch(
|
|
54
|
-
() => props.wordbook,
|
|
55
|
-
(wordbook, oldWordbook) => {
|
|
56
|
-
if (isEqual(wordbook, oldWordbook))
|
|
57
|
-
return;
|
|
58
|
-
remoteOptions.value = null;
|
|
59
|
-
if (!wordbook)
|
|
60
|
-
return;
|
|
61
|
-
(valueRef.value || !props.lazyRequest) && fetchData();
|
|
62
|
-
},
|
|
63
|
-
{ immediate: true }
|
|
64
|
-
);
|
|
65
|
-
return { valueRef, options, fetchData, labelKey, valueKey, lastSearch };
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { useAutographOptions };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export const __esModule: true;
|
|
2
|
-
export default ColumnComponent;
|
|
3
|
-
declare var ColumnComponent: vue_1.DefineComponent<{
|
|
4
|
-
field: {
|
|
5
|
-
type: ObjectConstructor;
|
|
6
|
-
required: true;
|
|
7
|
-
};
|
|
8
|
-
annotation: {
|
|
9
|
-
type: ObjectConstructor;
|
|
10
|
-
};
|
|
11
|
-
}, () => any, any, {}, {}, vue_1.ComponentOptionsMixin, vue_1.ComponentOptionsMixin, {}, string, vue_1.VNodeProps & vue_1.AllowedComponentProps & vue_1.ComponentCustomProps, Readonly<vue_1.ExtractPropTypes<{
|
|
12
|
-
field: {
|
|
13
|
-
type: ObjectConstructor;
|
|
14
|
-
required: true;
|
|
15
|
-
};
|
|
16
|
-
annotation: {
|
|
17
|
-
type: ObjectConstructor;
|
|
18
|
-
};
|
|
19
|
-
}>>, {}>;
|
|
20
|
-
import vue_1 = require("vue");
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export const __esModule: true;
|
|
2
|
-
declare const _default: vue_1.DefineComponent<{
|
|
3
|
-
value: {
|
|
4
|
-
type: (ArrayConstructor | NumberConstructor | StringConstructor)[];
|
|
5
|
-
default: undefined;
|
|
6
|
-
};
|
|
7
|
-
column: {
|
|
8
|
-
type: ObjectConstructor;
|
|
9
|
-
required: true;
|
|
10
|
-
};
|
|
11
|
-
row: {
|
|
12
|
-
type: ObjectConstructor;
|
|
13
|
-
required: true;
|
|
14
|
-
};
|
|
15
|
-
index: {
|
|
16
|
-
type: NumberConstructor;
|
|
17
|
-
required: true;
|
|
18
|
-
};
|
|
19
|
-
}, () => any, any, {}, {}, vue_1.ComponentOptionsMixin, vue_1.ComponentOptionsMixin, "update:value"[], "update:value", vue_1.VNodeProps & vue_1.AllowedComponentProps & vue_1.ComponentCustomProps, Readonly<vue_1.ExtractPropTypes<{
|
|
20
|
-
value: {
|
|
21
|
-
type: (ArrayConstructor | NumberConstructor | StringConstructor)[];
|
|
22
|
-
default: undefined;
|
|
23
|
-
};
|
|
24
|
-
column: {
|
|
25
|
-
type: ObjectConstructor;
|
|
26
|
-
required: true;
|
|
27
|
-
};
|
|
28
|
-
row: {
|
|
29
|
-
type: ObjectConstructor;
|
|
30
|
-
required: true;
|
|
31
|
-
};
|
|
32
|
-
index: {
|
|
33
|
-
type: NumberConstructor;
|
|
34
|
-
required: true;
|
|
35
|
-
};
|
|
36
|
-
}>> & {
|
|
37
|
-
"onUpdate:value"?: ((...args: any[]) => any) | undefined;
|
|
38
|
-
}, {
|
|
39
|
-
value: string | number | unknown[];
|
|
40
|
-
}>;
|
|
41
|
-
export default _default;
|
|
42
|
-
import vue_1 = require("vue");
|