fast-element-plus 2.0.6 → 2.0.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/CHANGELOG.md +26 -0
- package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +3 -3
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +5 -2
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +4 -4
- package/dist/components/select/src/select.mjs +53 -47
- package/dist/components/select/src/select.mjs.map +1 -1
- package/dist/components/selectPage/src/selectPage.d.ts +4 -4
- package/dist/components/selectPage/src/selectPage.mjs +65 -51
- package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
- package/dist/components/selectV2/src/selectV2.d.ts +4 -4
- package/dist/components/selectV2/src/selectV2.mjs +80 -48
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
- package/dist/components/table/src/table.mjs +2 -2
- package/dist/components/table/src/table.mjs.map +1 -1
- package/dist/components/table/src/tableSearchForm.mjs +4 -4
- package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +5 -5
- package/dist/components/tree/src/tree.mjs +11 -7
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +13 -13
- package/dist/components/treeSelect/src/treeSelect.mjs +61 -56
- package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
- package/dist/components/upload/src/upload.d.ts +0 -5
- package/dist/components/upload/src/upload.mjs +6 -6
- package/dist/components/upload/src/upload.mjs.map +1 -1
- package/dist/components/upload/src/useUpload.d.ts +1 -1
- package/dist/components/upload/src/useUpload.mjs +4 -17
- package/dist/components/upload/src/useUpload.mjs.map +1 -1
- package/dist/components/uploadImage/src/uploadImage.d.ts +0 -5
- package/dist/components/uploadImage/src/uploadImage.mjs +1 -3
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/dist/components/uploadImages/src/uploadImages.d.ts +0 -5
- package/dist/components/uploadImages/src/uploadImages.mjs +3 -3
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.global.min.js +4 -4
- package/dist/index.global.min.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -91,13 +91,13 @@ const faSelectPageProps = {
|
|
|
91
91
|
const faSelectPageEmits = {
|
|
92
92
|
...selectEmits,
|
|
93
93
|
/** @description v-model 回调 */
|
|
94
|
-
"update:modelValue": (value) => isString(value) || isNumber(value) || isBoolean(value) || isObject(value) || isArray(value) ||
|
|
94
|
+
"update:modelValue": (value) => isString(value) || isNumber(value) || isBoolean(value) || isObject(value) || isArray(value) || isNil(value),
|
|
95
|
+
/** @description 选中数据改变 */
|
|
96
|
+
change: (_data, _value) => true,
|
|
95
97
|
/** @description v-model:label 回调 */
|
|
96
98
|
"update:label": (value) => isString(value) || isArray(value) || isNull(value),
|
|
97
99
|
/** @description 数据改变 */
|
|
98
|
-
dataChangeCallBack: (data) => isArray(data)
|
|
99
|
-
/** @description 改变 */
|
|
100
|
-
change: (_data, _value) => true
|
|
100
|
+
dataChangeCallBack: (data) => isArray(data)
|
|
101
101
|
};
|
|
102
102
|
var selectPage_default = defineComponent({
|
|
103
103
|
name: "FaSelectPage",
|
|
@@ -178,46 +178,9 @@ var selectPage_default = defineComponent({
|
|
|
178
178
|
loadData(pageIndex);
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if (valueArr?.length === 0) {
|
|
185
|
-
state.value = null;
|
|
186
|
-
selectedLabel.value = null;
|
|
187
|
-
state.selectedList = [];
|
|
188
|
-
emit("update:modelValue", null);
|
|
189
|
-
emit("change", null, null);
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
const dataList = state.selectorData.filter((item) => item.value !== void 0 && valueArr.includes(item.value));
|
|
193
|
-
state.value = value;
|
|
194
|
-
selectedLabel.value = dataList.map((item) => item.label ?? "");
|
|
195
|
-
state.selectedList = [...state.selectedList.filter((f) => !dataList.some((s) => s.value === f.value)), ...dataList].filter((item) => item.value !== void 0 && valueArr.includes(item.value));
|
|
196
|
-
emit("update:modelValue", value);
|
|
197
|
-
emit("change", dataList, value);
|
|
198
|
-
} else {
|
|
199
|
-
if (isNil(value)) {
|
|
200
|
-
state.value = null;
|
|
201
|
-
selectedLabel.value = null;
|
|
202
|
-
state.selectedList = [];
|
|
203
|
-
emit("update:modelValue", null);
|
|
204
|
-
emit("change", null, null);
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
const data = state.selectorData.find((f) => f.value === value);
|
|
208
|
-
state.value = value;
|
|
209
|
-
selectedLabel.value = data?.label ?? null;
|
|
210
|
-
if (data && !state.selectedList.some((s) => s.value === value)) state.selectedList = [data];
|
|
211
|
-
emit("update:modelValue", value);
|
|
212
|
-
emit("change", data ?? null, value);
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
const handleClear = () => {
|
|
216
|
-
state.value = null;
|
|
217
|
-
selectedLabel.value = null;
|
|
218
|
-
state.selectedList = [];
|
|
219
|
-
emit("update:modelValue", null);
|
|
220
|
-
emit("clear");
|
|
181
|
+
const handleModelValueUpdate = (value) => {
|
|
182
|
+
state.value = value;
|
|
183
|
+
emit("update:modelValue", value);
|
|
221
184
|
};
|
|
222
185
|
const handleVisibleChange = async (visible) => {
|
|
223
186
|
if (visible) {
|
|
@@ -268,11 +231,64 @@ var selectPage_default = defineComponent({
|
|
|
268
231
|
}
|
|
269
232
|
state.value = newValue;
|
|
270
233
|
}, { immediate: true });
|
|
234
|
+
const flattenOptions = (data) => data.flatMap((item) => [item, ...flattenOptions(item.children ?? [])]);
|
|
235
|
+
const handleChange = (value) => {
|
|
236
|
+
const selectorData = flattenOptions([
|
|
237
|
+
...state.selectedList,
|
|
238
|
+
...state.defaultSelectorData ? [state.defaultSelectorData] : [],
|
|
239
|
+
...state.selectorData
|
|
240
|
+
]);
|
|
241
|
+
if (props.multiple) {
|
|
242
|
+
const valueList = Array.isArray(value) ? value : [];
|
|
243
|
+
if (valueList.length === 0) {
|
|
244
|
+
emit("change", null, null);
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
emit("change", valueList.map((item) => selectorData.find((option) => option.value !== void 0 && isEqual(option.value, item))).filter((item) => item !== void 0), value);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
if (isNil(value) || Array.isArray(value)) {
|
|
251
|
+
emit("change", null, null);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
emit("change", selectorData.find((item) => item.value !== void 0 && isEqual(item.value, value)) ?? null, value);
|
|
255
|
+
};
|
|
256
|
+
watch([() => state.value, () => state.selectorData], ([value]) => {
|
|
257
|
+
const selectorData = flattenOptions([
|
|
258
|
+
...state.selectedList,
|
|
259
|
+
...state.defaultSelectorData ? [state.defaultSelectorData] : [],
|
|
260
|
+
...state.selectorData
|
|
261
|
+
]);
|
|
262
|
+
if (props.multiple) {
|
|
263
|
+
if (!Array.isArray(value)) {
|
|
264
|
+
state.selectedList = [];
|
|
265
|
+
selectedLabel.value = null;
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
state.selectedList = value.map((item) => selectorData.find((option) => option.value !== void 0 && isEqual(option.value, item))).filter((item) => item !== void 0);
|
|
269
|
+
selectedLabel.value = value.map((item, index) => {
|
|
270
|
+
return state.selectedList.find((option) => option.value !== void 0 && isEqual(option.value, item))?.label ?? (Array.isArray(props.label) ? props.label[index] ?? "" : "");
|
|
271
|
+
});
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (isNil(value) || Array.isArray(value)) {
|
|
275
|
+
state.selectedList = [];
|
|
276
|
+
selectedLabel.value = null;
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
const data = selectorData.find((item) => item.value !== void 0 && isEqual(item.value, value));
|
|
280
|
+
state.selectedList = data ? [data] : [];
|
|
281
|
+
selectedLabel.value = data?.label ?? (typeof props.label === "string" ? props.label : null);
|
|
282
|
+
}, {
|
|
283
|
+
deep: true,
|
|
284
|
+
flush: "sync",
|
|
285
|
+
immediate: true
|
|
286
|
+
});
|
|
271
287
|
onMounted(() => {
|
|
272
288
|
watch(() => props.initParam, (newValue, oldValue) => {
|
|
273
289
|
if (!isEqual(newValue, oldValue)) {
|
|
274
290
|
state.nextRefresh = true;
|
|
275
|
-
if (!isNil(state.value))
|
|
291
|
+
if (!isNil(state.value)) handleModelValueUpdate(props.multiple ? [] : void 0);
|
|
276
292
|
}
|
|
277
293
|
});
|
|
278
294
|
});
|
|
@@ -285,7 +301,6 @@ var selectPage_default = defineComponent({
|
|
|
285
301
|
const elSelectEmits = useEmits(selectEmits, emit, [
|
|
286
302
|
"update:modelValue",
|
|
287
303
|
"change",
|
|
288
|
-
"clear",
|
|
289
304
|
"visible-change"
|
|
290
305
|
]);
|
|
291
306
|
const elPopperClass = computed(() => [
|
|
@@ -299,10 +314,9 @@ var selectPage_default = defineComponent({
|
|
|
299
314
|
"popperClass": elPopperClass.value,
|
|
300
315
|
"style": { width: addCssUnit(props.width) },
|
|
301
316
|
"modelValue": state.value,
|
|
302
|
-
"onUpdate:modelValue":
|
|
303
|
-
"loading": state.loading,
|
|
317
|
+
"onUpdate:modelValue": handleModelValueUpdate,
|
|
304
318
|
"onChange": handleChange,
|
|
305
|
-
"
|
|
319
|
+
"loading": state.loading,
|
|
306
320
|
"onVisible-change": handleVisibleChange
|
|
307
321
|
}), {
|
|
308
322
|
default: () => state.selectorData.map((item) => createVNode(FaSelectOption, {
|
|
@@ -375,9 +389,9 @@ var selectPage_default = defineComponent({
|
|
|
375
389
|
/** @description 刷新 */
|
|
376
390
|
refresh: loadData,
|
|
377
391
|
/** @description 设置选择 */
|
|
378
|
-
setSelection: (value) =>
|
|
392
|
+
setSelection: (value) => handleModelValueUpdate(value),
|
|
379
393
|
/** @description 清除选择 */
|
|
380
|
-
clearSelection: () =>
|
|
394
|
+
clearSelection: () => handleModelValueUpdate(props.multiple ? [] : void 0)
|
|
381
395
|
});
|
|
382
396
|
}
|
|
383
397
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectPage.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/selectPage/src/selectPage.tsx"],"sourcesContent":["import { useVModel } from \"@vueuse/core\";\nimport { Fragment, computed, defineComponent, onMounted, reactive, ref, watch } from \"vue\";\nimport { Search } from \"@element-plus/icons-vue\";\nimport { ElButton, ElInput, ElOption, ElPagination, ElSelect, selectEmits, selectProps, useGlobalSize } from \"element-plus\";\nimport { isArray, isBoolean, isEqual, isNil, isNull, isNumber, isObject, isString } from \"lodash-unified\";\nimport { addCssUnit, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\nimport { FaSelectOption } from \"../../select\";\nimport type { VNode } from \"vue\";\nimport type { ElSelectorModelValue, ElSelectorOutput, ElSelectorValue } from \"../../select\";\nimport type { SelectComponentProps } from \"../../select/src/select\";\nimport type { PagedInput, PagedResult } from \"../../table\";\n\n/** FaSelectPage 的运行时 Props 定义。 */\nexport const faSelectPageProps = {\n\t...selectProps,\n\t/** @description whether Select is disabled 重载使其支持 ElForm*/\n\tdisabled: {\n\t\ttype: Boolean,\n\t\tdefault: undefined,\n\t},\n\t/** @description displayed text while loading data from server, default is 'Loading' */\n\tloadingText: {\n\t\ttype: String,\n\t\tdefault: \"加载中...\",\n\t},\n\t/** @description displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data' */\n\tnoMatchText: {\n\t\ttype: String,\n\t\tdefault: \"暂无匹配的数据\",\n\t},\n\t/** @description displayed text when there is no options, you can also use slot `empty`, default is 'No data' */\n\tnoDataText: {\n\t\ttype: String,\n\t\tdefault: \"暂无数据\",\n\t},\n\t/** @description whether to collapse tags to a text when multiple selecting */\n\tcollapseTags: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true */\n\tcollapseTagsTooltip: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: {\n\t\ttype: definePropType<ElSelectorModelValue>([String, Number, Boolean, Object, Array]),\n\t\tdefault: undefined,\n\t},\n\t/** @description v-model:label绑定值 */\n\tlabel: definePropType<string | string[] | null>([String, Array]),\n\t/** @description 宽度 */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"100%\",\n\t},\n\t/** @description 更多细节,只有使用slot的时候有用 */\n\tmoreDetail: Boolean,\n\t/** @description 配置选项 */\n\tprops: {\n\t\ttype: definePropType<SelectComponentProps>(Object),\n\t\tdefault: (): Partial<SelectComponentProps> => ({\n\t\t\tlabel: \"label\",\n\t\t\thide: \"hide\",\n\t\t\tdisabled: \"disabled\",\n\t\t\tchildren: \"children\",\n\t\t}),\n\t},\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult<ElSelectorOutput>>>(Function),\n\t\trequired: true as const,\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | PagedInput>([String, Number, Object]),\n};\n\n/** FaSelectPage 的运行时 Emits 定义。 */\nexport const faSelectPageEmits = {\n\t...selectEmits,\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: ElSelectorModelValue): boolean =>\n\t\tisString(value) || isNumber(value) || isBoolean(value) || isObject(value) || isArray(value) || isNull(value),\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string | string[] | null): boolean => isString(value) || isArray(value) || isNull(value),\n\t/** @description 数据改变 */\n\tdataChangeCallBack: (data: ElSelectorOutput[]): boolean => isArray(data),\n\t/** @description 改变 */\n\tchange: (_data: ElSelectorOutput | ElSelectorOutput[] | null, _value?: ElSelectorModelValue): boolean => true,\n};\n\n/** FaSelectPage 的插槽参数。 */\nexport interface FaSelectPageSlots extends Record<string, unknown> {\n\t/** @description FaSelectOption 默认内容插槽 */\n\tdefault: ElSelectorOutput;\n\t/** @description 下拉列表顶部的内容 */\n\theader: never;\n\t/** @description 下拉列表底部的内容 */\n\tfooter: never;\n\t/** @description Select 组件头部内容 */\n\tprefix: never;\n\t/** @description 无选项时的列表 */\n\tempty: never;\n\t/** @description select 组件自定义标签内容 */\n\ttag: never;\n\t/** @description select 组件自定义 loading内容 */\n\tloading: never;\n\t/** @description select 组件自定义标签内容 */\n\tlabel: { label: string; value: string | number | boolean | object };\n}\n\nexport default defineComponent({\n\tname: \"FaSelectPage\",\n\tprops: faSelectPageProps,\n\temits: faSelectPageEmits,\n\tslots: makeSlots<FaSelectPageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst selectedLabel = useVModel(props, \"label\", emit, { passive: true });\n\t\tconst _globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tvalue: withDefineType<ElSelectorModelValue>(),\n\t\t\tloading: false,\n\t\t\tselectorData: withDefineType<ElSelectorOutput[]>([]),\n\t\t\t/** 选中的数据 */\n\t\t\tselectedList: withDefineType<ElSelectorOutput[]>([]),\n\t\t\t/** 首次出现 */\n\t\t\tdebut: true,\n\t\t\t/** 回显 */\n\t\t\techo: true,\n\t\t\t/** 下次刷新 */\n\t\t\tnextRefresh: false,\n\t\t\tpageIndex: 1,\n\t\t\tpageSize: 15,\n\t\t\ttotalRows: 0,\n\t\t\tsearchValue: undefined,\n\t\t\tdefaultSelectorData: withDefineType<ElSelectorOutput>(),\n\t\t});\n\n\t\tconst selectRef = ref<InstanceType<typeof ElSelect>>();\n\t\tlet requestVersion = 0;\n\n\t\tconst handleData = (data: ElSelectorOutput[]): ElSelectorOutput[] => {\n\t\t\treturn data\n\t\t\t\t.map((item): ElSelectorOutput => {\n\t\t\t\t\tconst value: unknown = item[props.valueKey];\n\t\t\t\t\tconst label: unknown = typeof props.props.label === \"function\" ? props.props.label(item) : item[props.props.label ?? \"label\"];\n\t\t\t\t\tconst hide: unknown = typeof props.props.hide === \"function\" ? props.props.hide(item) : item[props.props.hide ?? \"hide\"];\n\t\t\t\t\tconst disabled: unknown =\n\t\t\t\t\t\ttypeof props.props.disabled === \"function\" ? props.props.disabled(item) : item[props.props.disabled ?? \"disabled\"];\n\t\t\t\t\tconst children: unknown = item[props.props.children ?? \"children\"];\n\t\t\t\t\tconst selectorValue: ElSelectorValue | undefined =\n\t\t\t\t\t\tvalue !== null &&\n\t\t\t\t\t\t(typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"object\")\n\t\t\t\t\t\t\t? value\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...item,\n\t\t\t\t\t\tchildren: Array.isArray(children) ? handleData(children as ElSelectorOutput[]) : [],\n\t\t\t\t\t\tdisabled: typeof disabled === \"boolean\" ? disabled : undefined,\n\t\t\t\t\t\thide: typeof hide === \"boolean\" ? hide : undefined,\n\t\t\t\t\t\tlabel: typeof label === \"string\" ? label : undefined,\n\t\t\t\t\t\tvalue: selectorValue,\n\t\t\t\t\t};\n\t\t\t\t})\n\t\t\t\t.filter((item) => item.hide !== true);\n\t\t};\n\n\t\tconst loadData = async (pageIndex?: number): Promise<void> => {\n\t\t\tconst currentRequestVersion = ++requestVersion;\n\t\t\tstate.loading = true;\n\t\t\tstate.pageIndex = pageIndex ?? state.pageIndex;\n\t\t\tconst params: PagedInput = {\n\t\t\t\t...(typeof props.initParam === \"object\" && props.initParam !== null ? props.initParam : {}),\n\t\t\t\tpageIndex: state.pageIndex,\n\t\t\t\tpageSize: state.pageSize,\n\t\t\t\tsearchValue: state.searchValue,\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tconst resData = await props.requestApi(params);\n\t\t\t\tif (currentRequestVersion !== requestVersion) return;\n\t\t\t\t// 这里不允许回显了\n\t\t\t\tstate.echo = false;\n\t\t\t\tstate.totalRows = resData.totalRows ?? 0;\n\t\t\t\tstate.selectorData = handleData(resData.rows ?? []);\n\t\t\t\temit(\"dataChangeCallBack\", state.selectorData);\n\t\t\t} catch (error) {\n\t\t\t\tif (currentRequestVersion !== requestVersion) return;\n\t\t\t\tstate.pageIndex = 1;\n\t\t\t\tstate.totalRows = 0;\n\t\t\t\tstate.selectorData = [];\n\t\t\t\tthrow error;\n\t\t\t} finally {\n\t\t\t\tif (currentRequestVersion === requestVersion) state.loading = false;\n\t\t\t}\n\t\t};\n\t\tconst pageIndexModel = computed({\n\t\t\tget: () => state.pageIndex,\n\t\t\tset: (pageIndex: number) => {\n\t\t\t\tvoid loadData(pageIndex);\n\t\t\t},\n\t\t});\n\n\t\tconst handleChange = (value?: ElSelectorModelValue): void => {\n\t\t\t// 判断是否为多选\n\t\t\tif (props.multiple) {\n\t\t\t\t// value 必然是数组\n\t\t\t\tconst valueArr = Array.isArray(value) ? value : [];\n\t\t\t\tif (valueArr?.length === 0) {\n\t\t\t\t\tstate.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\tstate.selectedList = [];\n\t\t\t\t\temit(\"update:modelValue\", null);\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst dataList = state.selectorData.filter((item) => item.value !== undefined && valueArr.includes(item.value));\n\t\t\t\tstate.value = value;\n\t\t\t\tselectedLabel.value = dataList.map((item) => item.label ?? \"\");\n\t\t\t\tstate.selectedList = [...state.selectedList.filter((f) => !dataList.some((s) => s.value === f.value)), ...dataList]\n\t\t\t\t\t// 过滤不存在的\n\t\t\t\t\t.filter((item) => item.value !== undefined && valueArr.includes(item.value));\n\t\t\t\temit(\"update:modelValue\", value);\n\t\t\t\temit(\"change\", dataList, value);\n\t\t\t} else {\n\t\t\t\t// value 必然不是数组\n\t\t\t\tif (isNil(value)) {\n\t\t\t\t\tstate.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\tstate.selectedList = [];\n\t\t\t\t\temit(\"update:modelValue\", null);\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst data = state.selectorData.find((f) => f.value === value);\n\t\t\t\tstate.value = value;\n\t\t\t\tselectedLabel.value = data?.label ?? null;\n\t\t\t\tif (data && !state.selectedList.some((s) => s.value === value)) {\n\t\t\t\t\tstate.selectedList = [data];\n\t\t\t\t}\n\t\t\t\temit(\"update:modelValue\", value);\n\t\t\t\temit(\"change\", data ?? null, value);\n\t\t\t}\n\t\t};\n\n\t\tconst handleClear = (): void => {\n\t\t\tstate.value = null;\n\t\t\tselectedLabel.value = null;\n\t\t\tstate.selectedList = [];\n\t\t\temit(\"update:modelValue\", null);\n\t\t\temit(\"clear\");\n\t\t};\n\n\t\tconst handleVisibleChange = async (visible: boolean): Promise<void> => {\n\t\t\tif (visible) {\n\t\t\t\tif (state.debut) {\n\t\t\t\t\t// 首次出现\n\t\t\t\t\tstate.debut = false;\n\t\t\t\t\tawait loadData();\n\t\t\t\t} else {\n\t\t\t\t\t// 判断再次出现是否需要刷新数据\n\t\t\t\t\tif (state.nextRefresh) {\n\t\t\t\t\t\tstate.nextRefresh = false;\n\t\t\t\t\t\tawait loadData();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\temit(\"visible-change\", visible);\n\t\t};\n\n\t\twatch(\n\t\t\t() => props.modelValue,\n\t\t\t(newValue) => {\n\t\t\t\tif (state.echo && !isNil(newValue)) {\n\t\t\t\t\tconst hasLabel = !isNil(props.label);\n\t\t\t\t\t// 判断是否为多选\n\t\t\t\t\tif (props.multiple) {\n\t\t\t\t\t\tif (!Array.isArray(newValue)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelectPage]\", \"当启用 multiple 时,传入的 modelValue 必须是 Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (hasLabel && !isArray(props.label)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelectPage]\", \"当启用 multiple 时,传入的 modelValue:label 必须是 Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.selectedList = newValue\n\t\t\t\t\t\t\t// 最大选项截取\n\t\t\t\t\t\t\t.slice(0, props.multipleLimit > 0 ? props.multipleLimit : newValue.length)\n\t\t\t\t\t\t\t.map((item, index) => {\n\t\t\t\t\t\t\t\tconst value: unknown = item;\n\t\t\t\t\t\t\t\tconst label: unknown = Array.isArray(props.label) ? props.label[index] : undefined;\n\t\t\t\t\t\t\t\tconst selectorValue: ElSelectorValue | undefined =\n\t\t\t\t\t\t\t\t\tvalue !== null &&\n\t\t\t\t\t\t\t\t\t(typeof value === \"string\" ||\n\t\t\t\t\t\t\t\t\t\ttypeof value === \"number\" ||\n\t\t\t\t\t\t\t\t\t\ttypeof value === \"boolean\" ||\n\t\t\t\t\t\t\t\t\t\ttypeof value === \"object\")\n\t\t\t\t\t\t\t\t\t\t? value\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\tvalue: selectorValue,\n\t\t\t\t\t\t\t\t\tlabel: hasLabel && typeof label === \"string\" ? label : undefined,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (Array.isArray(newValue)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelectPage]\", \"当禁用 multiple 时,传入的 modelValue 不能是 Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (hasLabel && isArray(props.label)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelectPage]\", \"当禁用 multiple 时,传入的 modelValue:label 不能是 Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.defaultSelectorData = {\n\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\tlabel: typeof props.label === \"string\" ? props.label : undefined,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstate.value = newValue;\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tonMounted(() => {\n\t\t\twatch(\n\t\t\t\t() => props.initParam,\n\t\t\t\t(newValue, oldValue) => {\n\t\t\t\t\tif (!isEqual(newValue, oldValue)) {\n\t\t\t\t\t\tstate.nextRefresh = true;\n\t\t\t\t\t\tif (!isNil(state.value)) {\n\t\t\t\t\t\t\thandleChange();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\n\t\tconst elSelectProps = useProps(props, selectProps, [\"modelValue\", \"popperClass\", \"loading\", \"props\"]);\n\t\tconst elSelectEmits = useEmits(selectEmits, emit, [\"update:modelValue\", \"change\", \"clear\", \"visible-change\"]);\n\t\tconst elPopperClass = computed(() => [\n\t\t\t`fa-select-page-dropdown fa-select-page-dropdown-${_globalSize.value}`,\n\t\t\tprops.popperClass,\n\t\t\tprops.moreDetail && `fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${_globalSize.value}`,\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<ElSelect\n\t\t\t\t{...elSelectProps.value}\n\t\t\t\t{...elSelectEmits.value}\n\t\t\t\tref={selectRef}\n\t\t\t\tclass=\"fa-select-page\"\n\t\t\t\tpopperClass={elPopperClass.value}\n\t\t\t\tstyle={{ width: addCssUnit(props.width) }}\n\t\t\t\tvModel={state.value}\n\t\t\t\tloading={state.loading}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tonClear={handleClear}\n\t\t\t\tonVisible-change={handleVisibleChange}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: (): VNode[] =>\n\t\t\t\t\t\tstate.selectorData.map((item) => (\n\t\t\t\t\t\t\t<FaSelectOption vSlots={{ default: slots.default }} data={item} moreDetail={props.moreDetail} />\n\t\t\t\t\t\t)),\n\t\t\t\t\theader: (): VNode[] => [\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t{state.defaultSelectorData?.value !== undefined && (\n\t\t\t\t\t\t\t\t<ElOption\n\t\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__default-selector\"\n\t\t\t\t\t\t\t\t\tvalue={state.defaultSelectorData.value}\n\t\t\t\t\t\t\t\t\tlabel={state.defaultSelectorData.label ?? \"\"}\n\t\t\t\t\t\t\t\t\tdisabled={true}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span>{state.defaultSelectorData.label}</span>\n\t\t\t\t\t\t\t\t\t<span>Default</span>\n\t\t\t\t\t\t\t\t</ElOption>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__search-input\"\n\t\t\t\t\t\t\t\t\tclearable={Boolean(state.searchValue)}\n\t\t\t\t\t\t\t\t\tplaceholder=\"请输入关键字搜索\"\n\t\t\t\t\t\t\t\t\tvModel_trim={state.searchValue}\n\t\t\t\t\t\t\t\t\tonKeyup={(event: KeyboardEvent) => {\n\t\t\t\t\t\t\t\t\t\tif (event.key === \"Enter\") {\n\t\t\t\t\t\t\t\t\t\t\tvoid loadData(1);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\t\t\tappend: () => (\n\t\t\t\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t\t\t\t\t\t\ticon={Search}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tvoid loadData(1);\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t</ElInput>\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t{slots.header?.()}\n\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t],\n\t\t\t\t\tfooter: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<ElPagination\n\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__pagination\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tvModel:currentPage={pageIndexModel.value}\n\t\t\t\t\t\t\t\tpageSize={state.pageSize}\n\t\t\t\t\t\t\t\ttotal={state.totalRows}\n\t\t\t\t\t\t\t\tlayout=\"prev, pager, next, total\"\n\t\t\t\t\t\t\t\tpagerCount={5}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{slots.footer?.()}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\t...(slots.prefix && { prefix: (): VNode[] => slots.prefix?.() ?? [] }),\n\t\t\t\t\t...(slots.empty && { empty: (): VNode[] => slots.empty?.() ?? [] }),\n\t\t\t\t\t...(slots.tag && { tag: (): VNode[] => slots.tag?.() ?? [] }),\n\t\t\t\t\t...(slots.loading && { loading: (): VNode[] => slots.loading?.() ?? [] }),\n\t\t\t\t\t...(props.multiple\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tlabel: ({ label: _label, value }: { label: string; value: string | number | boolean | object }): VNode[] => {\n\t\t\t\t\t\t\t\t\tconst selectedData = state.selectedList.find((f) => f.value === value);\n\t\t\t\t\t\t\t\t\tif (slots.label) {\n\t\t\t\t\t\t\t\t\t\treturn slots.label({ label: selectedData?.label ?? _label, value: selectedData?.value ?? value });\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn selectedData ? [<span class=\"el-select__tags-text\">{selectedData.label}</span>] : [];\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: slots.label && {\n\t\t\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }): VNode[] =>\n\t\t\t\t\t\t\t\t\tslots.label?.({ label, value }) ?? [],\n\t\t\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElSelect>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 使选择器的输入框获取焦点 */\n\t\t\tfocus: computed(() => selectRef.value?.focus),\n\t\t\t/** @description 使选择器的输入框失去焦点,并隐藏下拉框 */\n\t\t\tblur: computed(() => selectRef.value?.blur),\n\t\t\t/** @description 获取当前选中的标签 */\n\t\t\tselectedLabel: computed(() => selectRef.value?.selectedLabel),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 选中的数据 */\n\t\t\tselectedList: computed(() => state.selectedList),\n\t\t\t/** @description 刷新 */\n\t\t\trefresh: loadData,\n\t\t\t/** @description 设置选择 */\n\t\t\tsetSelection: (value: Exclude<ElSelectorModelValue, null | undefined>) => handleChange(value),\n\t\t\t/** @description 清除选择 */\n\t\t\tclearSelection: () => handleChange(null),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,oBAAoB;CAChC,GAAG;;CAEH,UAAU;EACT,MAAM;EACN,SAAS,KAAA;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;EACX,MAAM;EACN,SAAS;CACV;;CAEA,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,qBAAqB;EACpB,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;EACX,MAAM,eAAqC;GAAC;GAAQ;GAAQ;GAAS;GAAQ;EAAK,CAAC;EACnF,SAAS,KAAA;CACV;;CAEA,OAAO,eAAyC,CAAC,Q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WACP,EACA,QAAQ,EAAE,OAAO,QAAQ,YAAmF;IAC3G,MAAM,eAAe,MAAM,aAAa,MAAM,MAAM,EAAE,UAAU,KAAK;IACrE,IAAI,MAAM,OACT,OAAO,MAAM,MAAM;KAAE,OAAO,cAAc,SAAS;KAAQ,OAAO,cAAc,SAAS;IAAM,CAAC;IAEjG,OAAO,eAAe,CAAA,YAAA,QAAA,EAAA,SAAA,uBAAA,GAAA,CAAqC,aAAa,KAAK,CAAA,CAAA,IAAY,CAAA;GAC1F,EACD,IACC,MAAM,SAAS,EACf,QAAQ,EAAE,OAAO,YAChB,MAAM,QAAQ;IAAE;IAAO;GAAM,CAAC,KAAK,CAAA,EACrC;EAAE,CAAA,CAGN;EAED,OAAO,UAAU,QAAQ;;GAExB,OAAO,eAAe,UAAU,OAAO,KAAK;;GAE5C,MAAM,eAAe,UAAU,OAAO,IAAI;;GAE1C,eAAe,eAAe,UAAU,OAAO,aAAa;;GAE5D,SAAS,eAAe,MAAM,OAAO;;GAErC,cAAc,eAAe,MAAM,YAAY;;GAE/C,SAAS;;GAET,eAAe,UAA2D,aAAa,KAAK;;GAE5F,sBAAsB,aAAa,IAAI;EACxC,CAAC;CACF;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"selectPage.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/selectPage/src/selectPage.tsx"],"sourcesContent":["import { useVModel } from \"@vueuse/core\";\nimport { Fragment, computed, defineComponent, onMounted, reactive, ref, watch } from \"vue\";\nimport { Search } from \"@element-plus/icons-vue\";\nimport { ElButton, ElInput, ElOption, ElPagination, ElSelect, selectEmits, selectProps, useGlobalSize } from \"element-plus\";\nimport { isArray, isBoolean, isEqual, isNil, isNull, isNumber, isObject, isString } from \"lodash-unified\";\nimport { addCssUnit, definePropType, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\nimport { FaSelectOption } from \"../../select\";\nimport type { VNode } from \"vue\";\nimport type { ElSelectorModelValue, ElSelectorOutput, ElSelectorValue } from \"../../select\";\nimport type { SelectComponentProps } from \"../../select/src/select\";\nimport type { PagedInput, PagedResult } from \"../../table\";\n\n/** FaSelectPage 的运行时 Props 定义。 */\nexport const faSelectPageProps = {\n\t...selectProps,\n\t/** @description whether Select is disabled 重载使其支持 ElForm*/\n\tdisabled: {\n\t\ttype: Boolean,\n\t\tdefault: undefined,\n\t},\n\t/** @description displayed text while loading data from server, default is 'Loading' */\n\tloadingText: {\n\t\ttype: String,\n\t\tdefault: \"加载中...\",\n\t},\n\t/** @description displayed text when no data matches the filtering query, you can also use slot `empty`, default is 'No matching data' */\n\tnoMatchText: {\n\t\ttype: String,\n\t\tdefault: \"暂无匹配的数据\",\n\t},\n\t/** @description displayed text when there is no options, you can also use slot `empty`, default is 'No data' */\n\tnoDataText: {\n\t\ttype: String,\n\t\tdefault: \"暂无数据\",\n\t},\n\t/** @description whether to collapse tags to a text when multiple selecting */\n\tcollapseTags: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description whether show all selected tags when mouse hover text of collapse-tags. To use this, `collapse-tags` must be true */\n\tcollapseTagsTooltip: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: {\n\t\ttype: definePropType<ElSelectorModelValue>([String, Number, Boolean, Object, Array]),\n\t\tdefault: undefined,\n\t},\n\t/** @description v-model:label绑定值 */\n\tlabel: definePropType<string | string[] | null>([String, Array]),\n\t/** @description 宽度 */\n\twidth: {\n\t\ttype: [String, Number],\n\t\tdefault: \"100%\",\n\t},\n\t/** @description 更多细节,只有使用slot的时候有用 */\n\tmoreDetail: Boolean,\n\t/** @description 配置选项 */\n\tprops: {\n\t\ttype: definePropType<SelectComponentProps>(Object),\n\t\tdefault: (): Partial<SelectComponentProps> => ({\n\t\t\tlabel: \"label\",\n\t\t\thide: \"hide\",\n\t\t\tdisabled: \"disabled\",\n\t\t\tchildren: \"children\",\n\t\t}),\n\t},\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult<ElSelectorOutput>>>(Function),\n\t\trequired: true as const,\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | PagedInput>([String, Number, Object]),\n};\n\n/** FaSelectPage 的运行时 Emits 定义。 */\nexport const faSelectPageEmits = {\n\t...selectEmits,\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: ElSelectorModelValue): boolean =>\n\t\tisString(value) || isNumber(value) || isBoolean(value) || isObject(value) || isArray(value) || isNil(value),\n\t/** @description 选中数据改变 */\n\tchange: (_data: ElSelectorOutput | ElSelectorOutput[] | null, _value?: ElSelectorModelValue): boolean => true,\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string | string[] | null): boolean => isString(value) || isArray(value) || isNull(value),\n\t/** @description 数据改变 */\n\tdataChangeCallBack: (data: ElSelectorOutput[]): boolean => isArray(data),\n};\n\n/** FaSelectPage 的插槽参数。 */\nexport interface FaSelectPageSlots extends Record<string, unknown> {\n\t/** @description FaSelectOption 默认内容插槽 */\n\tdefault: ElSelectorOutput;\n\t/** @description 下拉列表顶部的内容 */\n\theader: never;\n\t/** @description 下拉列表底部的内容 */\n\tfooter: never;\n\t/** @description Select 组件头部内容 */\n\tprefix: never;\n\t/** @description 无选项时的列表 */\n\tempty: never;\n\t/** @description select 组件自定义标签内容 */\n\ttag: never;\n\t/** @description select 组件自定义 loading内容 */\n\tloading: never;\n\t/** @description select 组件自定义标签内容 */\n\tlabel: { label: string; value: string | number | boolean | object };\n}\n\nexport default defineComponent({\n\tname: \"FaSelectPage\",\n\tprops: faSelectPageProps,\n\temits: faSelectPageEmits,\n\tslots: makeSlots<FaSelectPageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst selectedLabel = useVModel(props, \"label\", emit, { passive: true });\n\t\tconst _globalSize = useGlobalSize();\n\n\t\tconst state = reactive({\n\t\t\tvalue: withDefineType<ElSelectorModelValue>(),\n\t\t\tloading: false,\n\t\t\tselectorData: withDefineType<ElSelectorOutput[]>([]),\n\t\t\t/** 选中的数据 */\n\t\t\tselectedList: withDefineType<ElSelectorOutput[]>([]),\n\t\t\t/** 首次出现 */\n\t\t\tdebut: true,\n\t\t\t/** 回显 */\n\t\t\techo: true,\n\t\t\t/** 下次刷新 */\n\t\t\tnextRefresh: false,\n\t\t\tpageIndex: 1,\n\t\t\tpageSize: 15,\n\t\t\ttotalRows: 0,\n\t\t\tsearchValue: undefined,\n\t\t\tdefaultSelectorData: withDefineType<ElSelectorOutput>(),\n\t\t});\n\n\t\tconst selectRef = ref<InstanceType<typeof ElSelect>>();\n\t\tlet requestVersion = 0;\n\n\t\tconst handleData = (data: ElSelectorOutput[]): ElSelectorOutput[] => {\n\t\t\treturn data\n\t\t\t\t.map((item): ElSelectorOutput => {\n\t\t\t\t\tconst value: unknown = item[props.valueKey];\n\t\t\t\t\tconst label: unknown = typeof props.props.label === \"function\" ? props.props.label(item) : item[props.props.label ?? \"label\"];\n\t\t\t\t\tconst hide: unknown = typeof props.props.hide === \"function\" ? props.props.hide(item) : item[props.props.hide ?? \"hide\"];\n\t\t\t\t\tconst disabled: unknown =\n\t\t\t\t\t\ttypeof props.props.disabled === \"function\" ? props.props.disabled(item) : item[props.props.disabled ?? \"disabled\"];\n\t\t\t\t\tconst children: unknown = item[props.props.children ?? \"children\"];\n\t\t\t\t\tconst selectorValue: ElSelectorValue | undefined =\n\t\t\t\t\t\tvalue !== null &&\n\t\t\t\t\t\t(typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\" || typeof value === \"object\")\n\t\t\t\t\t\t\t? value\n\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...item,\n\t\t\t\t\t\tchildren: Array.isArray(children) ? handleData(children as ElSelectorOutput[]) : [],\n\t\t\t\t\t\tdisabled: typeof disabled === \"boolean\" ? disabled : undefined,\n\t\t\t\t\t\thide: typeof hide === \"boolean\" ? hide : undefined,\n\t\t\t\t\t\tlabel: typeof label === \"string\" ? label : undefined,\n\t\t\t\t\t\tvalue: selectorValue,\n\t\t\t\t\t};\n\t\t\t\t})\n\t\t\t\t.filter((item) => item.hide !== true);\n\t\t};\n\n\t\tconst loadData = async (pageIndex?: number): Promise<void> => {\n\t\t\tconst currentRequestVersion = ++requestVersion;\n\t\t\tstate.loading = true;\n\t\t\tstate.pageIndex = pageIndex ?? state.pageIndex;\n\t\t\tconst params: PagedInput = {\n\t\t\t\t...(typeof props.initParam === \"object\" && props.initParam !== null ? props.initParam : {}),\n\t\t\t\tpageIndex: state.pageIndex,\n\t\t\t\tpageSize: state.pageSize,\n\t\t\t\tsearchValue: state.searchValue,\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tconst resData = await props.requestApi(params);\n\t\t\t\tif (currentRequestVersion !== requestVersion) return;\n\t\t\t\t// 这里不允许回显了\n\t\t\t\tstate.echo = false;\n\t\t\t\tstate.totalRows = resData.totalRows ?? 0;\n\t\t\t\tstate.selectorData = handleData(resData.rows ?? []);\n\t\t\t\temit(\"dataChangeCallBack\", state.selectorData);\n\t\t\t} catch (error) {\n\t\t\t\tif (currentRequestVersion !== requestVersion) return;\n\t\t\t\tstate.pageIndex = 1;\n\t\t\t\tstate.totalRows = 0;\n\t\t\t\tstate.selectorData = [];\n\t\t\t\tthrow error;\n\t\t\t} finally {\n\t\t\t\tif (currentRequestVersion === requestVersion) state.loading = false;\n\t\t\t}\n\t\t};\n\n\t\tconst pageIndexModel = computed({\n\t\t\tget: () => state.pageIndex,\n\t\t\tset: (pageIndex: number) => {\n\t\t\t\tvoid loadData(pageIndex);\n\t\t\t},\n\t\t});\n\n\t\tconst handleModelValueUpdate = (value: ElSelectorModelValue): void => {\n\t\t\tstate.value = value;\n\t\t\temit(\"update:modelValue\", value);\n\t\t};\n\n\t\tconst handleVisibleChange = async (visible: boolean): Promise<void> => {\n\t\t\tif (visible) {\n\t\t\t\tif (state.debut) {\n\t\t\t\t\t// 首次出现\n\t\t\t\t\tstate.debut = false;\n\t\t\t\t\tawait loadData();\n\t\t\t\t} else {\n\t\t\t\t\t// 判断再次出现是否需要刷新数据\n\t\t\t\t\tif (state.nextRefresh) {\n\t\t\t\t\t\tstate.nextRefresh = false;\n\t\t\t\t\t\tawait loadData();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\temit(\"visible-change\", visible);\n\t\t};\n\n\t\twatch(\n\t\t\t() => props.modelValue,\n\t\t\t(newValue) => {\n\t\t\t\tif (state.echo && !isNil(newValue)) {\n\t\t\t\t\tconst hasLabel = !isNil(props.label);\n\t\t\t\t\t// 判断是否为多选\n\t\t\t\t\tif (props.multiple) {\n\t\t\t\t\t\tif (!Array.isArray(newValue)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelectPage]\", \"当启用 multiple 时,传入的 modelValue 必须是 Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (hasLabel && !isArray(props.label)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelectPage]\", \"当启用 multiple 时,传入的 modelValue:label 必须是 Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.selectedList = newValue\n\t\t\t\t\t\t\t// 最大选项截取\n\t\t\t\t\t\t\t.slice(0, props.multipleLimit > 0 ? props.multipleLimit : newValue.length)\n\t\t\t\t\t\t\t.map((item, index) => {\n\t\t\t\t\t\t\t\tconst value: unknown = item;\n\t\t\t\t\t\t\t\tconst label: unknown = Array.isArray(props.label) ? props.label[index] : undefined;\n\t\t\t\t\t\t\t\tconst selectorValue: ElSelectorValue | undefined =\n\t\t\t\t\t\t\t\t\tvalue !== null &&\n\t\t\t\t\t\t\t\t\t(typeof value === \"string\" ||\n\t\t\t\t\t\t\t\t\t\ttypeof value === \"number\" ||\n\t\t\t\t\t\t\t\t\t\ttypeof value === \"boolean\" ||\n\t\t\t\t\t\t\t\t\t\ttypeof value === \"object\")\n\t\t\t\t\t\t\t\t\t\t? value\n\t\t\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\tvalue: selectorValue,\n\t\t\t\t\t\t\t\t\tlabel: hasLabel && typeof label === \"string\" ? label : undefined,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (Array.isArray(newValue)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelectPage]\", \"当禁用 multiple 时,传入的 modelValue 不能是 Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (hasLabel && isArray(props.label)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelectPage]\", \"当禁用 multiple 时,传入的 modelValue:label 不能是 Array。\");\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstate.defaultSelectorData = {\n\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\tlabel: typeof props.label === \"string\" ? props.label : undefined,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstate.value = newValue;\n\t\t\t},\n\t\t\t{\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tconst flattenOptions = (data: ElSelectorOutput[]): ElSelectorOutput[] =>\n\t\t\tdata.flatMap((item) => [item, ...flattenOptions(item.children ?? [])]);\n\n\t\tconst handleChange = (value?: ElSelectorModelValue): void => {\n\t\t\tconst selectorData = flattenOptions([\n\t\t\t\t...state.selectedList,\n\t\t\t\t...(state.defaultSelectorData ? [state.defaultSelectorData] : []),\n\t\t\t\t...state.selectorData,\n\t\t\t]);\n\t\t\tif (props.multiple) {\n\t\t\t\tconst valueList = Array.isArray(value) ? value : [];\n\t\t\t\tif (valueList.length === 0) {\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst dataList = valueList\n\t\t\t\t\t.map((item) => selectorData.find((option) => option.value !== undefined && isEqual(option.value, item)))\n\t\t\t\t\t.filter((item): item is ElSelectorOutput => item !== undefined);\n\t\t\t\temit(\"change\", dataList, value);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (isNil(value) || Array.isArray(value)) {\n\t\t\t\temit(\"change\", null, null);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst data = selectorData.find((item) => item.value !== undefined && isEqual(item.value, value));\n\t\t\temit(\"change\", data ?? null, value);\n\t\t};\n\n\t\twatch(\n\t\t\t[() => state.value, () => state.selectorData],\n\t\t\t([value]) => {\n\t\t\t\tconst selectorData = flattenOptions([\n\t\t\t\t\t...state.selectedList,\n\t\t\t\t\t...(state.defaultSelectorData ? [state.defaultSelectorData] : []),\n\t\t\t\t\t...state.selectorData,\n\t\t\t\t]);\n\n\t\t\t\tif (props.multiple) {\n\t\t\t\t\tif (!Array.isArray(value)) {\n\t\t\t\t\t\tstate.selectedList = [];\n\t\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstate.selectedList = value\n\t\t\t\t\t\t.map((item) => selectorData.find((option) => option.value !== undefined && isEqual(option.value, item)))\n\t\t\t\t\t\t.filter((item): item is ElSelectorOutput => item !== undefined);\n\t\t\t\t\tselectedLabel.value = value.map((item, index) => {\n\t\t\t\t\t\tconst data = state.selectedList.find((option) => option.value !== undefined && isEqual(option.value, item));\n\n\t\t\t\t\t\treturn data?.label ?? (Array.isArray(props.label) ? (props.label[index] ?? \"\") : \"\");\n\t\t\t\t\t});\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (isNil(value) || Array.isArray(value)) {\n\t\t\t\t\tstate.selectedList = [];\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst data = selectorData.find((item) => item.value !== undefined && isEqual(item.value, value));\n\t\t\t\tstate.selectedList = data ? [data] : [];\n\t\t\t\tselectedLabel.value = data?.label ?? (typeof props.label === \"string\" ? props.label : null);\n\t\t\t},\n\t\t\t{\n\t\t\t\tdeep: true,\n\t\t\t\tflush: \"sync\",\n\t\t\t\timmediate: true,\n\t\t\t}\n\t\t);\n\n\t\tonMounted(() => {\n\t\t\twatch(\n\t\t\t\t() => props.initParam,\n\t\t\t\t(newValue, oldValue) => {\n\t\t\t\t\tif (!isEqual(newValue, oldValue)) {\n\t\t\t\t\t\tstate.nextRefresh = true;\n\t\t\t\t\t\tif (!isNil(state.value)) {\n\t\t\t\t\t\t\thandleModelValueUpdate(props.multiple ? [] : undefined);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t);\n\t\t});\n\n\t\tconst elSelectProps = useProps(props, selectProps, [\"modelValue\", \"popperClass\", \"loading\", \"props\"]);\n\t\tconst elSelectEmits = useEmits(selectEmits, emit, [\"update:modelValue\", \"change\", \"visible-change\"]);\n\t\tconst elPopperClass = computed(() => [\n\t\t\t`fa-select-page-dropdown fa-select-page-dropdown-${_globalSize.value}`,\n\t\t\tprops.popperClass,\n\t\t\tprops.moreDetail && `fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${_globalSize.value}`,\n\t\t]);\n\n\t\tuseRender(() => (\n\t\t\t<ElSelect\n\t\t\t\t{...elSelectProps.value}\n\t\t\t\t{...elSelectEmits.value}\n\t\t\t\tref={selectRef}\n\t\t\t\tclass=\"fa-select-page\"\n\t\t\t\tpopperClass={elPopperClass.value}\n\t\t\t\tstyle={{ width: addCssUnit(props.width) }}\n\t\t\t\tmodelValue={state.value}\n\t\t\t\tonUpdate:modelValue={handleModelValueUpdate}\n\t\t\t\tonChange={handleChange}\n\t\t\t\tloading={state.loading}\n\t\t\t\tonVisible-change={handleVisibleChange}\n\t\t\t>\n\t\t\t\t{{\n\t\t\t\t\tdefault: (): VNode[] =>\n\t\t\t\t\t\tstate.selectorData.map((item) => (\n\t\t\t\t\t\t\t<FaSelectOption vSlots={{ default: slots.default }} data={item} moreDetail={props.moreDetail} />\n\t\t\t\t\t\t)),\n\t\t\t\t\theader: (): VNode[] => [\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t{state.defaultSelectorData?.value !== undefined && (\n\t\t\t\t\t\t\t\t<ElOption\n\t\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__default-selector\"\n\t\t\t\t\t\t\t\t\tvalue={state.defaultSelectorData.value}\n\t\t\t\t\t\t\t\t\tlabel={state.defaultSelectorData.label ?? \"\"}\n\t\t\t\t\t\t\t\t\tdisabled={true}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span>{state.defaultSelectorData.label}</span>\n\t\t\t\t\t\t\t\t\t<span>Default</span>\n\t\t\t\t\t\t\t\t</ElOption>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t<ElInput\n\t\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__search-input\"\n\t\t\t\t\t\t\t\t\tclearable={Boolean(state.searchValue)}\n\t\t\t\t\t\t\t\t\tplaceholder=\"请输入关键字搜索\"\n\t\t\t\t\t\t\t\t\tvModel_trim={state.searchValue}\n\t\t\t\t\t\t\t\t\tonKeyup={(event: KeyboardEvent) => {\n\t\t\t\t\t\t\t\t\t\tif (event.key === \"Enter\") {\n\t\t\t\t\t\t\t\t\t\t\tvoid loadData(1);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{{\n\t\t\t\t\t\t\t\t\t\tappend: () => (\n\t\t\t\t\t\t\t\t\t\t\t<ElButton\n\t\t\t\t\t\t\t\t\t\t\t\tloading={state.loading}\n\t\t\t\t\t\t\t\t\t\t\t\ticon={Search}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\t\t\t\t\t\t\tvoid loadData(1);\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t</ElInput>\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t{slots.header?.()}\n\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t],\n\t\t\t\t\tfooter: () => (\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<ElPagination\n\t\t\t\t\t\t\t\tclass=\"fa-select-page-dropdown__pagination\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tvModel:currentPage={pageIndexModel.value}\n\t\t\t\t\t\t\t\tpageSize={state.pageSize}\n\t\t\t\t\t\t\t\ttotal={state.totalRows}\n\t\t\t\t\t\t\t\tlayout=\"prev, pager, next, total\"\n\t\t\t\t\t\t\t\tpagerCount={5}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{slots.footer?.()}\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t),\n\t\t\t\t\t...(slots.prefix && { prefix: (): VNode[] => slots.prefix?.() ?? [] }),\n\t\t\t\t\t...(slots.empty && { empty: (): VNode[] => slots.empty?.() ?? [] }),\n\t\t\t\t\t...(slots.tag && { tag: (): VNode[] => slots.tag?.() ?? [] }),\n\t\t\t\t\t...(slots.loading && { loading: (): VNode[] => slots.loading?.() ?? [] }),\n\t\t\t\t\t...(props.multiple\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tlabel: ({ label: _label, value }: { label: string; value: string | number | boolean | object }): VNode[] => {\n\t\t\t\t\t\t\t\t\tconst selectedData = state.selectedList.find((f) => f.value === value);\n\t\t\t\t\t\t\t\t\tif (slots.label) {\n\t\t\t\t\t\t\t\t\t\treturn slots.label({ label: selectedData?.label ?? _label, value: selectedData?.value ?? value });\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn selectedData ? [<span class=\"el-select__tags-text\">{selectedData.label}</span>] : [];\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: slots.label && {\n\t\t\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }): VNode[] =>\n\t\t\t\t\t\t\t\t\tslots.label?.({ label, value }) ?? [],\n\t\t\t\t\t\t\t}),\n\t\t\t\t}}\n\t\t\t</ElSelect>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 使选择器的输入框获取焦点 */\n\t\t\tfocus: computed(() => selectRef.value?.focus),\n\t\t\t/** @description 使选择器的输入框失去焦点,并隐藏下拉框 */\n\t\t\tblur: computed(() => selectRef.value?.blur),\n\t\t\t/** @description 获取当前选中的标签 */\n\t\t\tselectedLabel: computed(() => selectRef.value?.selectedLabel),\n\t\t\t/** @description 加载状态 */\n\t\t\tloading: computed(() => state.loading),\n\t\t\t/** @description 选中的数据 */\n\t\t\tselectedList: computed(() => state.selectedList),\n\t\t\t/** @description 刷新 */\n\t\t\trefresh: loadData,\n\t\t\t/** @description 设置选择 */\n\t\t\tsetSelection: (value: Exclude<ElSelectorModelValue, null | undefined>) => handleModelValueUpdate(value),\n\t\t\t/** @description 清除选择 */\n\t\t\tclearSelection: () => handleModelValueUpdate(props.multiple ? [] : undefined),\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,oBAAoB;CAChC,GAAG;;CAEH,UAAU;EACT,MAAM;EACN,SAAS,KAAA;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;EACX,MAAM;EACN,SAAS;CACV;;CAEA,cAAc;EACb,MAAM;EACN,SAAS;CACV;;CAEA,qBAAqB;EACpB,MAAM;EACN,SAAS;CACV;;CAEA,YAAY;EACX,MAAM,eAAqC;GAAC;GAAQ;GAAQ;GAAS;GAAQ;E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,KAAK;;GAE5C,MAAM,eAAe,UAAU,OAAO,IAAI;;GAE1C,eAAe,eAAe,UAAU,OAAO,aAAa;;GAE5D,SAAS,eAAe,MAAM,OAAO;;GAErC,cAAc,eAAe,MAAM,YAAY;;GAE/C,SAAS;;GAET,eAAe,UAA2D,uBAAuB,KAAK;;GAEtG,sBAAsB,uBAAuB,MAAM,WAAW,CAAA,IAAK,KAAA,CAAS;EAC7E,CAAC;CACF;AACD,CAAC"}
|
|
@@ -662,12 +662,12 @@ export declare const faSelectV2Props: {
|
|
|
662
662
|
export declare const faSelectV2Emits: {
|
|
663
663
|
/** @description v-model 回调 */
|
|
664
664
|
"update:modelValue": (value: ElSelectorModelValue) => boolean;
|
|
665
|
+
/** @description 选中数据改变 */
|
|
666
|
+
change: (_data: ElSelectorOutput | ElSelectorOutput[] | null, _value?: ElSelectorModelValue) => boolean;
|
|
665
667
|
/** @description v-model:label 回调 */
|
|
666
668
|
"update:label": (value: string | string[] | null) => boolean;
|
|
667
669
|
/** @description 数据改变 */
|
|
668
670
|
dataChangeCallBack: (data: ElSelectorOutput[]) => boolean;
|
|
669
|
-
/** @description 改变 */
|
|
670
|
-
change: (_data: ElSelectorOutput | ElSelectorOutput[] | null, _value?: ElSelectorModelValue) => boolean;
|
|
671
671
|
"end-reached": (_direction: ScrollbarDirection) => boolean;
|
|
672
672
|
"remove-tag": (_value: ElSelectorValue) => boolean;
|
|
673
673
|
"visible-change": (_visible: boolean) => boolean;
|
|
@@ -1055,12 +1055,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1055
1055
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
1056
1056
|
/** @description v-model 回调 */
|
|
1057
1057
|
"update:modelValue": (value: ElSelectorModelValue) => boolean;
|
|
1058
|
+
/** @description 选中数据改变 */
|
|
1059
|
+
change: (_data: ElSelectorOutput | ElSelectorOutput[] | null, _value?: ElSelectorModelValue) => boolean;
|
|
1058
1060
|
/** @description v-model:label 回调 */
|
|
1059
1061
|
"update:label": (value: string | string[] | null) => boolean;
|
|
1060
1062
|
/** @description 数据改变 */
|
|
1061
1063
|
dataChangeCallBack: (data: ElSelectorOutput[]) => boolean;
|
|
1062
|
-
/** @description 改变 */
|
|
1063
|
-
change: (_data: ElSelectorOutput | ElSelectorOutput[] | null, _value?: ElSelectorModelValue) => boolean;
|
|
1064
1064
|
"end-reached": (_direction: ScrollbarDirection) => boolean;
|
|
1065
1065
|
"remove-tag": (_value: ElSelectorValue) => boolean;
|
|
1066
1066
|
"visible-change": (_visible: boolean) => boolean;
|
|
@@ -410,13 +410,13 @@ const faSelectV2Props = {
|
|
|
410
410
|
const faSelectV2Emits = {
|
|
411
411
|
...selectV2Emits,
|
|
412
412
|
/** @description v-model 回调 */
|
|
413
|
-
"update:modelValue": (value) => isString(value) || isNumber(value) || isBoolean(value) || isObject(value) || isArray(value) ||
|
|
413
|
+
"update:modelValue": (value) => isString(value) || isNumber(value) || isBoolean(value) || isObject(value) || isArray(value) || isNil(value),
|
|
414
|
+
/** @description 选中数据改变 */
|
|
415
|
+
change: (_data, _value) => true,
|
|
414
416
|
/** @description v-model:label 回调 */
|
|
415
417
|
"update:label": (value) => isString(value) || isArray(value) || isNull(value),
|
|
416
418
|
/** @description 数据改变 */
|
|
417
|
-
dataChangeCallBack: (data) => isArray(data)
|
|
418
|
-
/** @description 改变 */
|
|
419
|
-
change: (_data, _value) => true
|
|
419
|
+
dataChangeCallBack: (data) => isArray(data)
|
|
420
420
|
};
|
|
421
421
|
var selectV2_default = defineComponent({
|
|
422
422
|
name: "FaSelectV2",
|
|
@@ -464,41 +464,9 @@ var selectV2_default = defineComponent({
|
|
|
464
464
|
state.selectorData = props.data ?? [];
|
|
465
465
|
}
|
|
466
466
|
};
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
if (valueArr?.length === 0) {
|
|
471
|
-
state.value = null;
|
|
472
|
-
selectedLabel.value = null;
|
|
473
|
-
emit("update:modelValue", null);
|
|
474
|
-
emit("change", null, null);
|
|
475
|
-
return;
|
|
476
|
-
}
|
|
477
|
-
const dataList = state.selectorData.filter((item) => item.value !== void 0 && valueArr.includes(item.value));
|
|
478
|
-
state.value = value;
|
|
479
|
-
selectedLabel.value = dataList.map((item) => item.label ?? "");
|
|
480
|
-
emit("update:modelValue", value);
|
|
481
|
-
emit("change", dataList, value);
|
|
482
|
-
} else {
|
|
483
|
-
if (isNil(value)) {
|
|
484
|
-
state.value = null;
|
|
485
|
-
selectedLabel.value = null;
|
|
486
|
-
emit("update:modelValue", null);
|
|
487
|
-
emit("change", null, null);
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
const data = state.selectorData.find((f) => f.value === value);
|
|
491
|
-
state.value = value;
|
|
492
|
-
selectedLabel.value = data?.label ?? null;
|
|
493
|
-
emit("update:modelValue", value);
|
|
494
|
-
emit("change", data ?? null, value);
|
|
495
|
-
}
|
|
496
|
-
};
|
|
497
|
-
const handleClear = () => {
|
|
498
|
-
state.value = null;
|
|
499
|
-
selectedLabel.value = null;
|
|
500
|
-
emit("update:modelValue", null);
|
|
501
|
-
emit("clear");
|
|
467
|
+
const handleModelValueUpdate = (value) => {
|
|
468
|
+
state.value = value;
|
|
469
|
+
emit("update:modelValue", value);
|
|
502
470
|
};
|
|
503
471
|
const handleVisibleChange = async (visible) => {
|
|
504
472
|
if (visible) {
|
|
@@ -549,11 +517,77 @@ var selectV2_default = defineComponent({
|
|
|
549
517
|
}
|
|
550
518
|
state.value = newValue;
|
|
551
519
|
}, { immediate: true });
|
|
520
|
+
const getOptionValue = (item) => {
|
|
521
|
+
const value = item[props.props.value ?? "value"];
|
|
522
|
+
return value !== null && (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "object") ? value : void 0;
|
|
523
|
+
};
|
|
524
|
+
const getOptionLabel = (item) => {
|
|
525
|
+
const label = item[props.props.label ?? "label"];
|
|
526
|
+
return typeof label === "string" ? label : void 0;
|
|
527
|
+
};
|
|
528
|
+
const flattenOptions = (data) => data.flatMap((item) => {
|
|
529
|
+
const children = item[props.props.options ?? "options"];
|
|
530
|
+
return [item, ...Array.isArray(children) ? flattenOptions(children) : []];
|
|
531
|
+
});
|
|
532
|
+
const handleChange = (value) => {
|
|
533
|
+
const selectorData = flattenOptions(state.selectorData);
|
|
534
|
+
if (props.multiple) {
|
|
535
|
+
const valueList = Array.isArray(value) ? value : [];
|
|
536
|
+
if (valueList.length === 0) {
|
|
537
|
+
emit("change", null, null);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
emit("change", valueList.map((item) => selectorData.find((option) => {
|
|
541
|
+
const optionValue = getOptionValue(option);
|
|
542
|
+
return optionValue !== void 0 && isEqual(optionValue, item);
|
|
543
|
+
})).filter((item) => item !== void 0), value);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (isNil(value) || Array.isArray(value)) {
|
|
547
|
+
emit("change", null, null);
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
emit("change", selectorData.find((option) => {
|
|
551
|
+
const optionValue = getOptionValue(option);
|
|
552
|
+
return optionValue !== void 0 && isEqual(optionValue, value);
|
|
553
|
+
}) ?? null, value);
|
|
554
|
+
};
|
|
555
|
+
watch([() => state.value, () => state.selectorData], ([value]) => {
|
|
556
|
+
const selectorData = flattenOptions(state.selectorData);
|
|
557
|
+
if (props.multiple) {
|
|
558
|
+
if (!Array.isArray(value)) {
|
|
559
|
+
selectedLabel.value = null;
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
selectedLabel.value = value.map((item, index) => {
|
|
563
|
+
const data = selectorData.find((option) => {
|
|
564
|
+
const optionValue = getOptionValue(option);
|
|
565
|
+
return optionValue !== void 0 && isEqual(optionValue, item);
|
|
566
|
+
});
|
|
567
|
+
return (data && getOptionLabel(data)) ?? (Array.isArray(props.label) ? props.label[index] ?? "" : "");
|
|
568
|
+
});
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
if (isNil(value) || Array.isArray(value)) {
|
|
572
|
+
selectedLabel.value = null;
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
const data = selectorData.find((option) => {
|
|
576
|
+
const optionValue = getOptionValue(option);
|
|
577
|
+
return optionValue !== void 0 && isEqual(optionValue, value);
|
|
578
|
+
});
|
|
579
|
+
selectedLabel.value = (data && getOptionLabel(data)) ?? (typeof props.label === "string" ? props.label : null);
|
|
580
|
+
}, {
|
|
581
|
+
deep: true,
|
|
582
|
+
flush: "sync",
|
|
583
|
+
immediate: true
|
|
584
|
+
});
|
|
552
585
|
onMounted(async () => {
|
|
553
586
|
if (props.defaultSelected) {
|
|
554
587
|
await loadData();
|
|
555
588
|
const firstItem = state.selectorData[0];
|
|
556
|
-
|
|
589
|
+
const firstValue = firstItem && getOptionValue(firstItem);
|
|
590
|
+
if (firstValue !== void 0) handleModelValueUpdate(props.multiple ? [firstValue] : firstValue);
|
|
557
591
|
} else if (!props.requestApi && props.data?.length > 0) {
|
|
558
592
|
state.debut = false;
|
|
559
593
|
await loadData();
|
|
@@ -561,7 +595,7 @@ var selectV2_default = defineComponent({
|
|
|
561
595
|
watch(() => props.initParam, (newValue, oldValue) => {
|
|
562
596
|
if (!isEqual(newValue, oldValue)) {
|
|
563
597
|
state.nextRefresh = true;
|
|
564
|
-
if (!isNil(state.value))
|
|
598
|
+
if (!isNil(state.value)) handleModelValueUpdate(props.multiple ? [] : void 0);
|
|
565
599
|
}
|
|
566
600
|
});
|
|
567
601
|
watch(() => props.data, () => {
|
|
@@ -575,10 +609,9 @@ var selectV2_default = defineComponent({
|
|
|
575
609
|
"options",
|
|
576
610
|
"itemHeight"
|
|
577
611
|
]);
|
|
578
|
-
const elSelectV2Emits = useEmits(
|
|
612
|
+
const elSelectV2Emits = useEmits(selectV2Emits, emit, [
|
|
579
613
|
"update:modelValue",
|
|
580
614
|
"change",
|
|
581
|
-
"clear",
|
|
582
615
|
"visible-change"
|
|
583
616
|
]);
|
|
584
617
|
const elPopperClass = computed(() => {
|
|
@@ -592,12 +625,11 @@ var selectV2_default = defineComponent({
|
|
|
592
625
|
"popperClass": elPopperClass.value,
|
|
593
626
|
"style": { width: addCssUnit(props.width) },
|
|
594
627
|
"modelValue": state.value,
|
|
595
|
-
"onUpdate:modelValue":
|
|
628
|
+
"onUpdate:modelValue": handleModelValueUpdate,
|
|
629
|
+
"onChange": handleChange,
|
|
596
630
|
"loading": state.loading,
|
|
597
631
|
"options": state.selectorData,
|
|
598
632
|
"itemHeight": props.itemHeight + (_globalSize.value === "small" ? 0 : 8),
|
|
599
|
-
"onChange": handleChange,
|
|
600
|
-
"onClear": handleClear,
|
|
601
633
|
"onVisible-change": handleVisibleChange
|
|
602
634
|
}), {
|
|
603
635
|
...slots.default && { default: ({ item, index, disabled }) => slots.default?.({
|
|
@@ -630,9 +662,9 @@ var selectV2_default = defineComponent({
|
|
|
630
662
|
/** @description 刷新 */
|
|
631
663
|
refresh: loadData,
|
|
632
664
|
/** @description 设置选择 */
|
|
633
|
-
setSelection: (value) =>
|
|
665
|
+
setSelection: (value) => handleModelValueUpdate(value),
|
|
634
666
|
/** @description 清除选择 */
|
|
635
|
-
clearSelection: () =>
|
|
667
|
+
clearSelection: () => handleModelValueUpdate(props.multiple ? [] : void 0)
|
|
636
668
|
});
|
|
637
669
|
}
|
|
638
670
|
});
|