fast-element-plus 2.0.16 → 2.0.18
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/CONTRIBUTING.md +8 -0
- package/dist/component.d.ts +6564 -2
- package/dist/component.mjs.map +1 -1
- package/dist/components/avatar/src/avatar.d.ts +19 -7
- package/dist/components/avatar/src/avatar.mjs +5 -0
- package/dist/components/avatar/src/avatar.mjs.map +1 -1
- package/dist/components/button/src/button.d.ts +4 -4
- package/dist/components/button/src/button.mjs +3 -4
- package/dist/components/button/src/button.mjs.map +1 -1
- package/dist/components/carNumber/src/carNumber.mjs +7 -9
- package/dist/components/carNumber/src/carNumber.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.mjs +8 -7
- package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -1
- package/dist/components/dialog/src/dialog.d.ts +7 -4
- package/dist/components/dialog/src/dialog.mjs +6 -7
- package/dist/components/dialog/src/dialog.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.mjs +14 -14
- package/dist/components/drawer/src/drawer.mjs.map +1 -1
- package/dist/components/form/src/form.d.ts +36 -24
- package/dist/components/form/src/form.mjs +8 -9
- package/dist/components/form/src/form.mjs.map +1 -1
- package/dist/components/form/src/formItem.d.ts +3 -3
- package/dist/components/form/src/formItem.mjs +18 -17
- package/dist/components/form/src/formItem.mjs.map +1 -1
- package/dist/components/form/utils/form.d.ts +2 -2
- package/dist/components/form/utils/form.mjs +2 -2
- package/dist/components/form/utils/form.mjs.map +1 -1
- package/dist/components/icon/src/icon.mjs.map +1 -1
- package/dist/components/iconSelector/src/iconSelector.d.ts +2 -2
- package/dist/components/iconSelector/src/iconSelector.mjs +4 -5
- package/dist/components/iconSelector/src/iconSelector.mjs.map +1 -1
- package/dist/components/image/src/image.d.ts +1 -1
- package/dist/components/image/src/image.mjs +2 -2
- package/dist/components/image/src/image.mjs.map +1 -1
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +10 -12
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.d.ts +23 -11
- package/dist/components/layoutGrid/src/layoutGrid.mjs +42 -43
- package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.type.d.ts +1 -1
- package/dist/components/layoutGrid/src/layoutGridItem.mjs +13 -14
- package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +27 -12
- package/dist/components/select/src/select.mjs +46 -44
- package/dist/components/select/src/select.mjs.map +1 -1
- package/dist/components/select/src/selectOption.mjs +4 -5
- package/dist/components/select/src/selectOption.mjs.map +1 -1
- package/dist/components/selectPage/src/selectPage.d.ts +24 -9
- package/dist/components/selectPage/src/selectPage.mjs +45 -52
- package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
- package/dist/components/selectV2/src/selectV2.d.ts +49 -29
- package/dist/components/selectV2/src/selectV2.mjs +64 -62
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
- package/dist/components/table/src/table.d.ts +63 -29
- package/dist/components/table/src/table.mjs +77 -81
- package/dist/components/table/src/table.mjs.map +1 -1
- package/dist/components/table/src/table.type.d.ts +2 -2
- package/dist/components/table/src/table.type.mjs.map +1 -1
- package/dist/components/table/src/tableColumn.d.ts +13 -13
- package/dist/components/table/src/tableColumn.mjs +17 -30
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/src/tableColumnSettingDialog.mjs +24 -14
- package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
- package/dist/components/table/src/tablePagination.mjs +2 -3
- package/dist/components/table/src/tablePagination.mjs.map +1 -1
- package/dist/components/table/src/tableSearchForm.d.ts +4 -4
- package/dist/components/table/src/tableSearchForm.mjs +24 -27
- package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
- package/dist/components/table/src/tableSearchFormItem.d.ts +1 -7
- package/dist/components/table/src/tableSearchFormItem.mjs +3 -6
- package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -1
- package/dist/components/table/src/useTable.d.ts +4 -4
- package/dist/components/table/src/useTable.mjs +13 -14
- package/dist/components/table/src/useTable.mjs.map +1 -1
- package/dist/components/table/utils/table.mjs +5 -7
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +6 -6
- package/dist/components/tree/src/tree.mjs +28 -26
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +30 -27
- package/dist/components/treeSelect/src/treeSelect.mjs +45 -43
- package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
- package/dist/components/upload/src/upload.d.ts +1 -1
- package/dist/components/upload/src/upload.mjs +4 -5
- package/dist/components/upload/src/upload.mjs.map +1 -1
- package/dist/components/upload/src/useUpload.mjs +5 -7
- package/dist/components/upload/src/useUpload.mjs.map +1 -1
- package/dist/components/upload/utils/upload.mjs +1 -1
- package/dist/components/upload/utils/upload.mjs.map +1 -1
- package/dist/components/uploadImage/src/uploadImage.d.ts +4 -16
- package/dist/components/uploadImage/src/uploadImage.mjs +7 -13
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/dist/components/uploadImages/src/uploadImages.d.ts +1 -1
- package/dist/components/uploadImages/src/uploadImages.mjs +7 -8
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/dist/directives/click-copy/index.mjs +5 -9
- package/dist/directives/click-copy/index.mjs.map +1 -1
- package/dist/element-plus.mjs +5 -6
- package/dist/element-plus.mjs.map +1 -1
- package/dist/hooks/use-screenFull/index.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/utils/async/index.mjs.map +1 -1
- package/dist/utils/date/index.mjs.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/object/index.d.ts +30 -0
- package/dist/utils/object/index.mjs +159 -0
- package/dist/utils/object/index.mjs.map +1 -0
- package/dist/utils/string/index.mjs.map +1 -1
- package/dist/utils/vue/emits.mjs.map +1 -1
- package/dist/utils/vue/install.mjs.map +1 -1
- package/dist/utils/vue/render.mjs.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 +7 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layoutGrid.mjs","names":[],"sources":["../../../../src/components/layoutGrid/src/layoutGrid.tsx"],"sourcesContent":["import { computed, defineComponent, nextTick, onActivated, onDeactivated, onMounted, onUnmounted, provide, ref, watch } from \"vue\";\nimport {
|
|
1
|
+
{"version":3,"file":"layoutGrid.mjs","names":[],"sources":["../../../../src/components/layoutGrid/src/layoutGrid.tsx"],"sourcesContent":["import { computed, defineComponent, nextTick, onActivated, onDeactivated, onMounted, onUnmounted, provide, ref, shallowRef, watch } from \"vue\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"../../../utils\";\nimport type { VNode, VNodeArrayChildren } from \"vue\";\nimport type { FaLayoutGridBreakpoint, FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\n\n/** FaLayoutGrid 的插槽参数。 */\nexport interface FaLayoutGridSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaLayoutGrid\",\n\tprops: {\n\t\t/** @description Grid布局列配置 */\n\t\tcols: {\n\t\t\ttype: definePropType<string | number | Partial<Record<FaLayoutGridBreakpoint, number>>>([String, Number, Object]),\n\t\t\tdefault: () => ({ xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }),\n\t\t},\n\t\t/** @description 折叠 */\n\t\tcollapsed: Boolean,\n\t\t/** @description 折叠行数 */\n\t\tcollapsedRows: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 1,\n\t\t},\n\t\t/** @description 间距,偏移 */\n\t\tgap: {\n\t\t\ttype: definePropType<number | [number, number]>([Number, Array]),\n\t\t\tdefault: 0,\n\t\t},\n\t},\n\temits: {\n\t\t/** @description 断点变化事件 */\n\t\tbreakpointChange: ({ breakpoint: _breakpoint }: { breakpoint: FaLayoutGridBreakpoint }) => true,\n\t},\n\tslots: makeSlots<FaLayoutGridSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst containerRef = shallowRef<HTMLElement | null>(null);\n\n\t\t// 注入响应式横向 gap 间距\n\t\tconst horizontalGap = computed(() => (Array.isArray(props.gap) ? props.gap[0] : props.gap));\n\t\tprovide(\"gap\", horizontalGap);\n\n\t\t// 注入响应式断点\n\t\tconst breakpoint = ref<FaLayoutGridBreakpoint>(\"xl\");\n\t\tprovide(\"breakpoint\", breakpoint);\n\n\t\t// 注入要开始折叠的 index\n\t\tconst firstHiddenIndex = ref(-1);\n\t\tprovide(\"firstHiddenIndex\", firstHiddenIndex);\n\n\t\t// 注入 cols\n\t\tconst cols = computed<string | number>(() => {\n\t\t\tif (typeof props.cols === \"object\" && props.cols !== null) return props.cols[breakpoint.value] ?? 1;\n\t\t\treturn props.cols;\n\t\t});\n\t\tprovide(\"cols\", cols);\n\n\t\tconst collapsedRows = computed(() => (typeof props.collapsedRows === \"number\" ? props.collapsedRows : Number(props.collapsedRows)));\n\n\t\t// 设置间距\n\t\tconst gap = computed(() => {\n\t\t\tif (typeof props.gap === \"number\") return `${props.gap}px`;\n\t\t\tif (Array.isArray(props.gap)) return `${props.gap[1]}px ${props.gap[0]}px`;\n\t\t\treturn \"unset\";\n\t\t});\n\n\t\t// 设置 style\n\t\tconst style = computed(() => {\n\t\t\treturn {\n\t\t\t\tdisplay: \"grid\",\n\t\t\t\tgridGap: gap.value,\n\t\t\t\tgridTemplateColumns: `repeat(${cols.value}, minmax(0, 1fr))`,\n\t\t\t};\n\t\t});\n\n\t\t// 断点映射\n\t\tconst breakpoints = {\n\t\t\t// 小于480屏幕(如手机)\n\t\t\txs: { min: 0, max: 479 },\n\t\t\t// 平板竖屏\n\t\t\tsm: { min: 480, max: 768 },\n\t\t\t// 平板横屏\n\t\t\tmd: { min: 768, max: 1024 },\n\t\t\t// 小型桌面\n\t\t\tlg: { min: 1024, max: 1440 },\n\t\t\t// 大型桌面\n\t\t\txl: { min: 1440, max: Infinity },\n\t\t};\n\n\t\t// 监听屏幕变化\n\t\tconst resize = (e: ResizeObserverEntry[]) => {\n\t\t\t// 当前只监听布局容器,ResizeObserver 每次回调应当只有一个目标。\n\t\t\tif (e.length !== 1 || e[0] === undefined) throw new Error(\"FaLayoutGrid 监听到了非预期数量的布局容器。\");\n\t\t\tconst curEl = e[0];\n\t\t\tconst width = curEl.target.scrollWidth;\n\n\t\t\tfor (const [key, { min, max }] of Object.entries(breakpoints)) {\n\t\t\t\tif (width >= min && width <= max) {\n\t\t\t\t\tbreakpoint.value = key as FaLayoutGridBreakpoint;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tlet resizeObserver: ResizeObserver | undefined;\n\t\tconst observeResize = () => {\n\t\t\tconst element = containerRef.value;\n\t\t\tif (!element) return;\n\t\t\tresizeObserver?.disconnect();\n\t\t\tresizeObserver = new ResizeObserver(resize);\n\t\t\tresizeObserver.observe(element);\n\t\t};\n\n\t\twatch(\n\t\t\t() => breakpoint.value,\n\t\t\t(newValue) => {\n\t\t\t\temit(\"breakpointChange\", { breakpoint: newValue });\n\t\t\t}\n\t\t);\n\n\t\tonMounted(() => {\n\t\t\tnextTick(observeResize);\n\t\t\temit(\"breakpointChange\", { breakpoint: breakpoint.value });\n\t\t});\n\n\t\tonActivated(() => nextTick(observeResize));\n\n\t\tonDeactivated(() => {\n\t\t\tresizeObserver?.disconnect();\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tresizeObserver?.disconnect();\n\t\t});\n\n\t\tuseRender(() => {\n\t\t\tconst defaultSlot = slots.default?.() ?? [];\n\n\t\t\tif (props.collapsed) {\n\t\t\t\tconst fields: VNodeArrayChildren = [];\n\t\t\t\tlet suffix: VNode | undefined;\n\n\t\t\t\tdefaultSlot.forEach((slot) => {\n\t\t\t\t\t// suffix\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof slot.type === \"object\" &&\n\t\t\t\t\t\t\"name\" in slot.type &&\n\t\t\t\t\t\tslot.type.name === \"FaLayoutGridItem\" &&\n\t\t\t\t\t\tslot.props?.[\"suffix\"] !== undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\tsuffix = slot;\n\t\t\t\t\t}\n\t\t\t\t\t// slot children\n\t\t\t\t\tif (typeof slot.type === \"symbol\" && Array.isArray(slot.children)) fields.push(...slot.children);\n\t\t\t\t});\n\n\t\t\t\t// 计算 suffix 所占用的列\n\t\t\t\tlet suffixCols = 0;\n\t\t\t\tif (suffix?.props) {\n\t\t\t\t\tconst activeBreakpointProps = suffix.props[breakpoint.value] as FaLayoutGridItemResponsive | undefined;\n\t\t\t\t\tsuffixCols =\n\t\t\t\t\t\t(activeBreakpointProps?.span ?? Number(suffix.props[\"span\"] ?? 1)) +\n\t\t\t\t\t\t(activeBreakpointProps?.offset ?? Number(suffix.props[\"offset\"] ?? 0));\n\t\t\t\t}\n\n\t\t\t\tlet occupiedCols = 0;\n\t\t\t\tfirstHiddenIndex.value = -1;\n\t\t\t\tfor (const [index, current] of fields.entries()) {\n\t\t\t\t\tconst currentVNode = current as VNode;\n\t\t\t\t\tconst currentProps = currentVNode.props;\n\t\t\t\t\tif (currentProps === null) continue;\n\t\t\t\t\tconst activeBreakpointProps = currentProps[breakpoint.value] as FaLayoutGridItemResponsive | undefined;\n\t\t\t\t\toccupiedCols +=\n\t\t\t\t\t\t(activeBreakpointProps?.span ?? Number(currentProps[\"span\"] ?? 1)) +\n\t\t\t\t\t\t(activeBreakpointProps?.offset ?? Number(currentProps[\"offset\"] ?? 0));\n\t\t\t\t\tif (occupiedCols > collapsedRows.value * Number(cols.value) - suffixCols) {\n\t\t\t\t\t\tfirstHiddenIndex.value = index;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfirstHiddenIndex.value = -1;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div ref={containerRef} style={style.value}>\n\t\t\t\t\t{defaultSlot}\n\t\t\t\t</div>\n\t\t\t);\n\t\t});\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 响应式断点 */\n\t\t\tbreakpoint,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;AAWA,IAAA,qBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;;EAEN,MAAM;GACL,MAAM,eAAkF;IAAC;IAAQ;IAAQ;GAAM,CAAC;GAChH,gBAAgB;IAAE,IAAI;IAAG,IAAI;IAAG,IAAI;IAAG,IAAI;IAAG,IAAI;GAAE;EACrD;;EAEA,WAAW;;EAEX,eAAe;GACd,MAAM,CAAC,QAAQ,MAAM;GACrB,SAAS;EACV;;EAEA,KAAK;GACJ,MAAM,eAA0C,CAAC,QAAQ,KAAK,CAAC;GAC/D,SAAS;EACV;CACD;CACA,OAAO;;AAEN,mBAAmB,EAAE,YAAY,kBAA0D,KAC5F;CACA,OAAO,UAA6B;CACpC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,eAAe,WAA+B,IAAI;EAGxD,MAAM,gBAAgB,eAAgB,MAAM,QAAQ,MAAM,GAAG,IAAI,MAAM,IAAI,KAAK,MAAM,GAAI;EAC1F,QAAQ,OAAO,aAAa;EAG5B,MAAM,aAAa,IAA4B,IAAI;EACnD,QAAQ,cAAc,UAAU;EAGhC,MAAM,mBAAmB,IAAI,EAAE;EAC/B,QAAQ,oBAAoB,gBAAgB;EAG5C,MAAM,OAAO,eAAgC;GAC5C,IAAI,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,MAAM,OAAO,MAAM,KAAK,WAAW,UAAU;GAClG,OAAO,MAAM;EACd,CAAC;EACD,QAAQ,QAAQ,IAAI;EAE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W,CAAA;EAGf,CAAC;EAED,OAAO,UAAU,QAAQ;;AAExB,WACD,CAAC;CACF;AACD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** 响应式布局断点;从 xs 到 xl 依次表示最小、小、中、大和最大容器。 */
|
|
2
|
-
export type
|
|
2
|
+
export type FaLayoutGridBreakpoint = "xs" | "sm" | "md" | "lg" | "xl";
|
|
3
3
|
/** 布局项在不同断点下的栅格跨度。 */
|
|
4
4
|
export interface FaLayoutGridItemResponsive {
|
|
5
5
|
span?: number;
|
|
@@ -3,7 +3,6 @@ import { definePropType } from "../../../utils/vue/props.mjs";
|
|
|
3
3
|
import { useRender } from "../../../utils/vue/render.mjs";
|
|
4
4
|
import { makeSlots } from "../../../utils/vue/slots.mjs";
|
|
5
5
|
import { computed, createVNode, defineComponent, inject, reactive, ref, vShow, watch, withDirectives } from "vue";
|
|
6
|
-
import { isNumber } from "lodash-unified";
|
|
7
6
|
//#region src/components/layoutGrid/src/layoutGridItem.tsx
|
|
8
7
|
var layoutGridItem_default = defineComponent({
|
|
9
8
|
name: "FaLayoutGridItem",
|
|
@@ -51,30 +50,30 @@ var layoutGridItem_default = defineComponent({
|
|
|
51
50
|
},
|
|
52
51
|
slots: makeSlots(),
|
|
53
52
|
setup(props, { attrs, slots, expose }) {
|
|
54
|
-
const state = reactive({ show: true });
|
|
55
53
|
const attrsObj = attrs;
|
|
56
|
-
const
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
const index = Number(attrsObj["data-index"] ?? attrsObj["index"]);
|
|
60
|
-
if (Number.isInteger(index)) state.show = !(n[0] !== -1 && index >= Number(n[0]));
|
|
61
|
-
}, { immediate: true });
|
|
62
|
-
const gap = inject("gap", 0);
|
|
54
|
+
const breakpoint = inject("breakpoint", ref("xl"));
|
|
55
|
+
const firstHiddenIndex = inject("firstHiddenIndex", ref(-1));
|
|
56
|
+
const gap = inject("gap", ref(0));
|
|
63
57
|
const cols = inject("cols", ref(5));
|
|
58
|
+
const state = reactive({ show: true });
|
|
64
59
|
const style = computed(() => {
|
|
65
|
-
const
|
|
66
|
-
const span =
|
|
67
|
-
const offset =
|
|
60
|
+
const activeBreakpointProps = props[breakpoint.value];
|
|
61
|
+
const span = activeBreakpointProps?.span ?? (typeof props.span === "number" ? props.span : Number(props.span));
|
|
62
|
+
const offset = activeBreakpointProps?.offset ?? (typeof props.offset === "number" ? props.offset : Number(props.offset));
|
|
68
63
|
if (props.suffix) return {
|
|
69
64
|
gridColumnStart: cols.value - span - offset + 1,
|
|
70
65
|
gridColumnEnd: `span ${span + offset}`,
|
|
71
|
-
marginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : "unset"
|
|
66
|
+
marginLeft: offset !== 0 ? `calc(((100% + ${gap.value}px) / ${span + offset}) * ${offset})` : "unset"
|
|
72
67
|
};
|
|
73
68
|
else return {
|
|
74
69
|
gridColumn: `span ${span + offset > cols.value ? cols.value : span + offset}/span ${span + offset > cols.value ? cols.value : span + offset}`,
|
|
75
|
-
marginLeft: offset !== 0 ? `calc(((100% + ${gap}px) / ${span + offset}) * ${offset})` : "unset"
|
|
70
|
+
marginLeft: offset !== 0 ? `calc(((100% + ${gap.value}px) / ${span + offset}) * ${offset})` : "unset"
|
|
76
71
|
};
|
|
77
72
|
});
|
|
73
|
+
watch(() => [firstHiddenIndex.value, breakpoint.value], (n) => {
|
|
74
|
+
const index = Number(attrsObj["data-index"] ?? attrsObj["index"]);
|
|
75
|
+
if (Number.isInteger(index)) state.show = !(n[0] !== -1 && index >= Number(n[0]));
|
|
76
|
+
}, { immediate: true });
|
|
78
77
|
useRender(() => withDirectives(createVNode("div", { "style": style.value }, [slots.default?.()]), [[vShow, state.show]]));
|
|
79
78
|
return useExpose(expose, { show: state.show });
|
|
80
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layoutGridItem.mjs","names":[],"sources":["../../../../src/components/layoutGrid/src/layoutGridItem.tsx"],"sourcesContent":["import { computed, defineComponent, inject, reactive, ref, watch } from \"vue\";\nimport {
|
|
1
|
+
{"version":3,"file":"layoutGridItem.mjs","names":[],"sources":["../../../../src/components/layoutGrid/src/layoutGridItem.tsx"],"sourcesContent":["import { computed, defineComponent, inject, reactive, ref, watch } from \"vue\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"../../../utils\";\nimport type { Ref } from \"vue\";\nimport type { FaLayoutGridBreakpoint, FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\n\n/** FaLayoutGridItem 的插槽参数。 */\nexport interface FaLayoutGridItemSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaLayoutGridItem\",\n\tprops: {\n\t\t/** @description 偏移 */\n\t\toffset: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 0,\n\t\t},\n\t\t/** @description 占位 */\n\t\tspan: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 1,\n\t\t},\n\t\t/** @description 后缀 */\n\t\tsuffix: { type: Boolean, default: false },\n\t\t/** @description 响应式,小于480px屏幕配置 */\n\t\txs: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined,\n\t\t},\n\t\t/** @description 响应式,平板竖屏配置 */\n\t\tsm: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined,\n\t\t},\n\t\t/** @description 响应式,平板横屏配置 */\n\t\tmd: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined,\n\t\t},\n\t\t/** @description 响应式,小型桌面配置 */\n\t\tlg: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined,\n\t\t},\n\t\t/** @description 响应式,大型桌面配置 */\n\t\txl: {\n\t\t\ttype: definePropType<FaLayoutGridItemResponsive>(Object),\n\t\t\tdefault: undefined,\n\t\t},\n\t},\n\tslots: makeSlots<FaLayoutGridItemSlots>(),\n\tsetup(props, { attrs, slots, expose }) {\n\t\tconst attrsObj = attrs as Record<string, unknown>;\n\n\t\t// 注入布局状态\n\t\tconst breakpoint = inject<Ref<FaLayoutGridBreakpoint>>(\"breakpoint\", ref(\"xl\"));\n\t\tconst firstHiddenIndex = inject<Ref<number>>(\"firstHiddenIndex\", ref(-1));\n\t\tconst gap = inject<Ref<number>>(\"gap\", ref(0));\n\t\tconst cols = inject<Ref<number>>(\"cols\", ref(5));\n\n\t\tconst state = reactive({\n\t\t\tshow: true,\n\t\t});\n\n\t\tconst style = computed(() => {\n\t\t\tconst activeBreakpointProps = props[breakpoint.value];\n\t\t\tconst span = activeBreakpointProps?.span ?? (typeof props.span === \"number\" ? props.span : Number(props.span));\n\t\t\tconst offset = activeBreakpointProps?.offset ?? (typeof props.offset === \"number\" ? props.offset : Number(props.offset));\n\t\t\tif (props.suffix) {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumnStart: cols.value - span - offset + 1,\n\t\t\t\t\tgridColumnEnd: `span ${span + offset}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap.value}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\treturn {\n\t\t\t\t\tgridColumn: `span ${span + offset > cols.value ? cols.value : span + offset}/span ${\n\t\t\t\t\t\tspan + offset > cols.value ? cols.value : span + offset\n\t\t\t\t\t}`,\n\t\t\t\t\tmarginLeft: offset !== 0 ? `calc(((100% + ${gap.value}px) / ${span + offset}) * ${offset})` : \"unset\",\n\t\t\t\t};\n\t\t\t}\n\t\t});\n\n\t\twatch(\n\t\t\t() => [firstHiddenIndex.value, breakpoint.value],\n\t\t\t(n) => {\n\t\t\t\tconst index = Number(attrsObj[\"data-index\"] ?? attrsObj[\"index\"]);\n\t\t\t\tif (Number.isInteger(index)) {\n\t\t\t\t\tstate.show = !(n[0] !== -1 && index >= Number(n[0]));\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tuseRender(() => (\n\t\t\t<div style={style.value} vShow={state.show}>\n\t\t\t\t{slots.default?.()}\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\tshow: state.show,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;AAWA,IAAA,yBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;;EAEN,QAAQ;GACP,MAAM,CAAC,QAAQ,MAAM;GACrB,SAAS;EACV;;EAEA,MAAM;GACL,MAAM,CAAC,QAAQ,MAAM;GACrB,SAAS;EACV;;EAEA,QAAQ;GAAE,MAAM;GAAS,SAAS;EAAM;;EAExC,IAAI;GACH,MAAM,eAA2C,MAAM;GACvD,SAAS,KAAA;EACV;;EAEA,IAAI;GACH,MAAM,eAA2C,MAAM;GACvD,SAAS,KAAA;EACV;;EAEA,IAAI;GACH,MAAM,eAA2C,MAAM;GACvD,SAAS,KAAA;EACV;;EAEA,IAAI;GACH,MAAM,eAA2C,MAAM;GACvD,SAAS,KAAA;EACV;;EAEA,IAAI;GACH,MAAM,eAA2C,MAAM;GACvD,SAAS,KAAA;EACV;CACD;CACA,OAAO,UAAiC;CACxC,MAAM,OAAO,EAAE,OAAO,OAAO,UAAU;EACtC,MAAM,WAAW;EAGjB,MAAM,aAAa,OAAoC,cAAc,IAAI,IAAI,CAAC;EAC9E,MAAM,mBAAmB,OAAoB,oBAAoB,IAAI,EAAE,CAAC;EACxE,MAAM,MAAM,OAAoB,OAAO,IAAI,CAAC,CAAC;EAC7C,MAAM,OAAO,OAAoB,QAAQ,IAAI,CAAC,CAAC;EAE/C,MAAM,QAAQ,SAAS,EACtB,MAAM,KACP,CAAC;EAED,MAAM,QAAQ,eAAe;GAC5B,MAAM,wBAAwB,MAAM,WAAW;GAC/C,MAAM,OAAO,uBAAuB,SAAS,OAAO,MAAM,SAAS,WAAW,MAAM,OAAO,OAAO,MAAM,IAAI;GAC5G,MAAM,SAAS,uBAAuB,WAAW,OAAO,MAAM,WAAW,WAAW,MAAM,SAAS,OAAO,MAAM,MAAM;GACtH,IAAI,MAAM,QACT,OAAO;IACN,iBAAiB,KAAK,QAAQ,OAAO,SAAS;IAC9C,eAAe,QAAQ,OAAO;IAC9B,YAAY,WAAW,IAAI,iBAAiB,IAAI,MAAK,QAAS,OAAO,OAAM,MAAO,OAAM,KAAM;GAC/F;QAEA,OAAO;IACN,YAAY,QAAQ,OAAO,SAAS,KAAK,QAAQ,KAAK,QAAQ,OAAO,OAAM,QAC1E,OAAO,SAAS,KAAK,QAAQ,KAAK,QAAQ,OAAO;IAElD,YAAY,WAAW,IAAI,iBAAiB,IAAI,MAAK,QAAS,OAAO,OAAM,MAAO,OAAM,KAAM;GAC/F;EAEF,CAAC;EAED,YACO,CAAC,iBAAiB,OAAO,WAAW,KAAK,IAC9C,MAAM;GACN,MAAM,QAAQ,OAAO,SAAS,iBAAiB,SAAS,QAAQ;GAChE,IAAI,OAAO,UAAU,KAAK,GACzB,MAAM,OAAO,EAAE,EAAE,OAAO,MAAM,SAAS,OAAO,EAAE,EAAE;EAEpD,GACA,EAAE,WAAW,KAAK,CACnB;EAEA,gBAAU,eAAA,YAAA,OAAA,EAAA,SACG,MAAM,MAAK,GAAA,CACrB,MAAM,UAAU,CAAC,CAAA,GAAA,CAAA,CAAA,OADa,MAAM,IAAI,CAAA,CAAA,CAG1C;EAED,OAAO,UAAU,QAAQ,EACxB,MAAM,MAAM,KACb,CAAC;CACF;AACD,CAAC"}
|
|
@@ -67,12 +67,17 @@ export declare const faSelectProps: {
|
|
|
67
67
|
/** @description 配置选项 */
|
|
68
68
|
props: {
|
|
69
69
|
type: import("vue").PropType<SelectComponentProps>;
|
|
70
|
-
default: () =>
|
|
70
|
+
default: () => {
|
|
71
|
+
label: string;
|
|
72
|
+
hide: string;
|
|
73
|
+
disabled: string;
|
|
74
|
+
children: string;
|
|
75
|
+
};
|
|
71
76
|
};
|
|
72
77
|
/** @description 下拉框数据 */
|
|
73
78
|
data: {
|
|
74
79
|
type: import("vue").PropType<ElSelectorOutput<ElSelectorValue, any>[]>;
|
|
75
|
-
default: () =>
|
|
80
|
+
default: () => never[];
|
|
76
81
|
};
|
|
77
82
|
/** @description 请求api */
|
|
78
83
|
requestApi: {
|
|
@@ -170,13 +175,13 @@ export declare const faSelectProps: {
|
|
|
170
175
|
/** FaSelect 的运行时 Emits 定义。 */
|
|
171
176
|
export declare const faSelectEmits: {
|
|
172
177
|
/** @description v-model 回调 */
|
|
173
|
-
"update:modelValue": (value: ElSelectorModelValue) => boolean;
|
|
178
|
+
"update:modelValue": (value: ElSelectorModelValue) => value is string | number | boolean | object | ElSelectorValue[] | null | undefined;
|
|
174
179
|
/** @description 选中数据改变 */
|
|
175
180
|
change: (_data: ElSelectorOutput | ElSelectorOutput[] | null, _value?: ElSelectorModelValue) => boolean;
|
|
176
181
|
/** @description v-model:label 回调 */
|
|
177
182
|
"update:label": (value: string | string[] | null) => boolean;
|
|
178
183
|
/** @description 数据改变 */
|
|
179
|
-
|
|
184
|
+
dataChange: (data: ElSelectorOutput[]) => boolean;
|
|
180
185
|
'popup-scroll': ({ scrollTop, scrollLeft }: {
|
|
181
186
|
scrollTop: number;
|
|
182
187
|
scrollLeft: number;
|
|
@@ -265,12 +270,17 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
265
270
|
/** @description 配置选项 */
|
|
266
271
|
props: {
|
|
267
272
|
type: import("vue").PropType<SelectComponentProps>;
|
|
268
|
-
default: () =>
|
|
273
|
+
default: () => {
|
|
274
|
+
label: string;
|
|
275
|
+
hide: string;
|
|
276
|
+
disabled: string;
|
|
277
|
+
children: string;
|
|
278
|
+
};
|
|
269
279
|
};
|
|
270
280
|
/** @description 下拉框数据 */
|
|
271
281
|
data: {
|
|
272
282
|
type: import("vue").PropType<ElSelectorOutput<ElSelectorValue, any>[]>;
|
|
273
|
-
default: () =>
|
|
283
|
+
default: () => never[];
|
|
274
284
|
};
|
|
275
285
|
/** @description 请求api */
|
|
276
286
|
requestApi: {
|
|
@@ -381,13 +391,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
381
391
|
clearSelection: () => void;
|
|
382
392
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
383
393
|
/** @description v-model 回调 */
|
|
384
|
-
"update:modelValue": (value: ElSelectorModelValue) => boolean;
|
|
394
|
+
"update:modelValue": (value: ElSelectorModelValue) => value is string | number | boolean | object | ElSelectorValue[] | null | undefined;
|
|
385
395
|
/** @description 选中数据改变 */
|
|
386
396
|
change: (_data: ElSelectorOutput | ElSelectorOutput[] | null, _value?: ElSelectorModelValue) => boolean;
|
|
387
397
|
/** @description v-model:label 回调 */
|
|
388
398
|
"update:label": (value: string | string[] | null) => boolean;
|
|
389
399
|
/** @description 数据改变 */
|
|
390
|
-
|
|
400
|
+
dataChange: (data: ElSelectorOutput[]) => boolean;
|
|
391
401
|
'popup-scroll': ({ scrollTop, scrollLeft }: {
|
|
392
402
|
scrollTop: number;
|
|
393
403
|
scrollLeft: number;
|
|
@@ -453,12 +463,17 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
453
463
|
/** @description 配置选项 */
|
|
454
464
|
props: {
|
|
455
465
|
type: import("vue").PropType<SelectComponentProps>;
|
|
456
|
-
default: () =>
|
|
466
|
+
default: () => {
|
|
467
|
+
label: string;
|
|
468
|
+
hide: string;
|
|
469
|
+
disabled: string;
|
|
470
|
+
children: string;
|
|
471
|
+
};
|
|
457
472
|
};
|
|
458
473
|
/** @description 下拉框数据 */
|
|
459
474
|
data: {
|
|
460
475
|
type: import("vue").PropType<ElSelectorOutput<ElSelectorValue, any>[]>;
|
|
461
|
-
default: () =>
|
|
476
|
+
default: () => never[];
|
|
462
477
|
};
|
|
463
478
|
/** @description 请求api */
|
|
464
479
|
requestApi: {
|
|
@@ -561,7 +576,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
561
576
|
"onEnd-reached"?: ((direction: import("element-plus").ScrollbarDirection) => any) | undefined;
|
|
562
577
|
"onVisible-change"?: ((visible: boolean) => any) | undefined;
|
|
563
578
|
"onUpdate:label"?: ((value: string | string[] | null) => any) | undefined;
|
|
564
|
-
|
|
579
|
+
onDataChange?: ((data: ElSelectorOutput<ElSelectorValue, any>[]) => any) | undefined;
|
|
565
580
|
"onPopup-scroll"?: ((args_0: {
|
|
566
581
|
scrollTop: number;
|
|
567
582
|
scrollLeft: number;
|
|
@@ -569,10 +584,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
569
584
|
"onRemove-tag"?: ((val: unknown) => any) | undefined;
|
|
570
585
|
}>, {
|
|
571
586
|
data: ElSelectorOutput<ElSelectorValue, any>[];
|
|
587
|
+
loading: boolean;
|
|
572
588
|
props: SelectComponentProps;
|
|
573
589
|
offset: number;
|
|
574
590
|
placement: import("element-plus/es/utils/vue/props/types.mjs").EpPropMergeType<(new (...args: any[]) => "left" | "right" | "top" | "auto" | "bottom" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("element-plus").Placement) | ((new (...args: any[]) => "left" | "right" | "top" | "auto" | "bottom" | "auto-start" | "auto-end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end") | (() => import("element-plus").Placement) | null)[], import("element-plus").Placement, unknown>;
|
|
575
|
-
loading: boolean;
|
|
576
591
|
disabled: boolean;
|
|
577
592
|
modelValue: ElSelectorModelValue;
|
|
578
593
|
autocomplete: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { addCssUnit } from "../../../utils/dom/index.mjs";
|
|
2
|
+
import { isEqual } from "../../../utils/object/index.mjs";
|
|
2
3
|
import { useEmits } from "../../../utils/vue/emits.mjs";
|
|
3
4
|
import { useExpose } from "../../../utils/vue/expose.mjs";
|
|
4
5
|
import { definePropType, useProps } from "../../../utils/vue/props.mjs";
|
|
@@ -6,10 +7,8 @@ import { useRender } from "../../../utils/vue/render.mjs";
|
|
|
6
7
|
import { makeSlots } from "../../../utils/vue/slots.mjs";
|
|
7
8
|
import { withDefineType } from "../../../utils/vue/with.mjs";
|
|
8
9
|
import selectOption_default from "./selectOption.mjs";
|
|
9
|
-
import { computed, createVNode, defineComponent, mergeProps, onMounted, reactive,
|
|
10
|
+
import { computed, createVNode, defineComponent, mergeProps, onMounted, reactive, shallowRef, useModel, watch } from "vue";
|
|
10
11
|
import { ElSelect, selectEmits, selectProps, useGlobalSize } from "element-plus";
|
|
11
|
-
import { isArray, isBoolean, isEqual, isNil, isNull, isNumber, isObject, isString } from "lodash-unified";
|
|
12
|
-
import { useVModel } from "@vueuse/core";
|
|
13
12
|
//#region src/components/select/src/select.tsx
|
|
14
13
|
/** FaSelect 的运行时 Props 定义。 */
|
|
15
14
|
const faSelectProps = {
|
|
@@ -99,13 +98,13 @@ const faSelectProps = {
|
|
|
99
98
|
const faSelectEmits = {
|
|
100
99
|
...selectEmits,
|
|
101
100
|
/** @description v-model 回调 */
|
|
102
|
-
"update:modelValue": (value) =>
|
|
101
|
+
"update:modelValue": (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "object" && value !== null || value == null,
|
|
103
102
|
/** @description 选中数据改变 */
|
|
104
103
|
change: (_data, _value) => true,
|
|
105
104
|
/** @description v-model:label 回调 */
|
|
106
|
-
"update:label": (value) =>
|
|
105
|
+
"update:label": (value) => typeof value === "string" || Array.isArray(value) || value === null,
|
|
107
106
|
/** @description 数据改变 */
|
|
108
|
-
|
|
107
|
+
dataChange: (data) => Array.isArray(data)
|
|
109
108
|
};
|
|
110
109
|
var select_default = defineComponent({
|
|
111
110
|
name: "FaSelect",
|
|
@@ -113,8 +112,9 @@ var select_default = defineComponent({
|
|
|
113
112
|
emits: faSelectEmits,
|
|
114
113
|
slots: makeSlots(),
|
|
115
114
|
setup(props, { slots, emit, expose }) {
|
|
116
|
-
const selectedLabel =
|
|
117
|
-
const
|
|
115
|
+
const selectedLabel = useModel(props, "label");
|
|
116
|
+
const globalSize = useGlobalSize();
|
|
117
|
+
const selectRef = shallowRef(null);
|
|
118
118
|
const state = reactive({
|
|
119
119
|
value: withDefineType(),
|
|
120
120
|
loading: false,
|
|
@@ -122,11 +122,10 @@ var select_default = defineComponent({
|
|
|
122
122
|
/** 首次出现 */
|
|
123
123
|
debut: true,
|
|
124
124
|
/** 回显 */
|
|
125
|
-
echo:
|
|
125
|
+
echo: true,
|
|
126
126
|
/** 下次刷新 */
|
|
127
127
|
nextRefresh: false
|
|
128
128
|
});
|
|
129
|
-
const selectRef = ref();
|
|
130
129
|
let requestVersion = 0;
|
|
131
130
|
const handleData = (data) => {
|
|
132
131
|
return data.map((item) => {
|
|
@@ -156,7 +155,7 @@ var select_default = defineComponent({
|
|
|
156
155
|
if (currentRequestVersion !== requestVersion) return;
|
|
157
156
|
state.echo = false;
|
|
158
157
|
state.selectorData = handleData(resData);
|
|
159
|
-
emit("
|
|
158
|
+
emit("dataChange", state.selectorData);
|
|
160
159
|
} catch (error) {
|
|
161
160
|
if (currentRequestVersion !== requestVersion) return;
|
|
162
161
|
state.selectorData = [];
|
|
@@ -186,15 +185,33 @@ var select_default = defineComponent({
|
|
|
186
185
|
}
|
|
187
186
|
emit("visible-change", visible);
|
|
188
187
|
};
|
|
188
|
+
const flattenOptions = (data) => data.flatMap((item) => [item, ...flattenOptions(item.children ?? [])]);
|
|
189
|
+
const handleChange = (value) => {
|
|
190
|
+
if (props.multiple) {
|
|
191
|
+
const valueList = Array.isArray(value) ? value : [];
|
|
192
|
+
if (valueList.length === 0) {
|
|
193
|
+
emit("change", null, null);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const selectorData = flattenOptions(state.selectorData);
|
|
197
|
+
emit("change", valueList.map((item) => selectorData.find((option) => option.value !== void 0 && isEqual(option.value, item))).filter((item) => item !== void 0), value);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (value == null || Array.isArray(value)) {
|
|
201
|
+
emit("change", null, null);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
emit("change", flattenOptions(state.selectorData).find((item) => item.value !== void 0 && isEqual(item.value, value)) ?? null, value);
|
|
205
|
+
};
|
|
189
206
|
watch(() => props.modelValue, (newValue) => {
|
|
190
|
-
if (state.echo &&
|
|
191
|
-
const hasLabel =
|
|
207
|
+
if (state.echo && newValue != null) {
|
|
208
|
+
const hasLabel = props.label != null;
|
|
192
209
|
if (props.multiple) {
|
|
193
210
|
if (!Array.isArray(newValue)) {
|
|
194
211
|
console.error("[Fast:FaSelect]", "当启用 multiple 时,传入的 modelValue 必须是 Array。");
|
|
195
212
|
return;
|
|
196
213
|
}
|
|
197
|
-
if (hasLabel && !isArray(props.label)) {
|
|
214
|
+
if (hasLabel && !Array.isArray(props.label)) {
|
|
198
215
|
console.error("[Fast:FaSelect]", "当启用 multiple 时,传入的 modelValue:label 必须是 Array。");
|
|
199
216
|
return;
|
|
200
217
|
}
|
|
@@ -211,7 +228,7 @@ var select_default = defineComponent({
|
|
|
211
228
|
console.error("[Fast:FaSelect]", "当禁用 multiple 时,传入的 modelValue 不能是 Array。");
|
|
212
229
|
return;
|
|
213
230
|
}
|
|
214
|
-
if (hasLabel && isArray(props.label)) {
|
|
231
|
+
if (hasLabel && Array.isArray(props.label)) {
|
|
215
232
|
console.error("[Fast:FaSelect]", "当禁用 multiple 时,传入的 modelValue:label 不能是 Array。");
|
|
216
233
|
return;
|
|
217
234
|
}
|
|
@@ -223,24 +240,6 @@ var select_default = defineComponent({
|
|
|
223
240
|
}
|
|
224
241
|
state.value = newValue;
|
|
225
242
|
}, { immediate: true });
|
|
226
|
-
const flattenOptions = (data) => data.flatMap((item) => [item, ...flattenOptions(item.children ?? [])]);
|
|
227
|
-
const handleChange = (value) => {
|
|
228
|
-
if (props.multiple) {
|
|
229
|
-
const valueList = Array.isArray(value) ? value : [];
|
|
230
|
-
if (valueList.length === 0) {
|
|
231
|
-
emit("change", null, null);
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
const selectorData = flattenOptions(state.selectorData);
|
|
235
|
-
emit("change", valueList.map((item) => selectorData.find((option) => option.value !== void 0 && isEqual(option.value, item))).filter((item) => item !== void 0), value);
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
if (isNil(value) || Array.isArray(value)) {
|
|
239
|
-
emit("change", null, null);
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
emit("change", flattenOptions(state.selectorData).find((item) => item.value !== void 0 && isEqual(item.value, value)) ?? null, value);
|
|
243
|
-
};
|
|
244
243
|
watch([() => state.value, () => state.selectorData], ([value]) => {
|
|
245
244
|
const selectorData = flattenOptions(state.selectorData);
|
|
246
245
|
if (props.multiple) {
|
|
@@ -253,7 +252,7 @@ var select_default = defineComponent({
|
|
|
253
252
|
});
|
|
254
253
|
return;
|
|
255
254
|
}
|
|
256
|
-
if (
|
|
255
|
+
if (value == null || Array.isArray(value)) {
|
|
257
256
|
selectedLabel.value = null;
|
|
258
257
|
return;
|
|
259
258
|
}
|
|
@@ -263,6 +262,18 @@ var select_default = defineComponent({
|
|
|
263
262
|
flush: "sync",
|
|
264
263
|
immediate: true
|
|
265
264
|
});
|
|
265
|
+
watch(() => props.initParam, (newValue, oldValue) => {
|
|
266
|
+
if (!isEqual(newValue, oldValue)) {
|
|
267
|
+
state.nextRefresh = true;
|
|
268
|
+
if (state.value != null) handleModelValueUpdate(props.multiple ? [] : void 0);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
watch(() => props.data, () => {
|
|
272
|
+
if (!props.requestApi) return loadData();
|
|
273
|
+
}, { deep: true });
|
|
274
|
+
watch(() => props.data.length, (length) => {
|
|
275
|
+
if (state.debut) state.echo = length === 0;
|
|
276
|
+
}, { immediate: true });
|
|
266
277
|
onMounted(async () => {
|
|
267
278
|
if (props.defaultSelected) {
|
|
268
279
|
await loadData();
|
|
@@ -272,15 +283,6 @@ var select_default = defineComponent({
|
|
|
272
283
|
state.debut = false;
|
|
273
284
|
await loadData();
|
|
274
285
|
} else if (!props.lazy) await loadData();
|
|
275
|
-
watch(() => props.initParam, (newValue, oldValue) => {
|
|
276
|
-
if (!isEqual(newValue, oldValue)) {
|
|
277
|
-
state.nextRefresh = true;
|
|
278
|
-
if (!isNil(state.value)) handleModelValueUpdate(props.multiple ? [] : void 0);
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
watch(() => props.data, () => {
|
|
282
|
-
if (!props.requestApi) return loadData();
|
|
283
|
-
}, { deep: true });
|
|
284
286
|
});
|
|
285
287
|
const elSelectProps = useProps(props, selectProps, [
|
|
286
288
|
"modelValue",
|
|
@@ -296,7 +298,7 @@ var select_default = defineComponent({
|
|
|
296
298
|
const elPopperClass = computed(() => [
|
|
297
299
|
"fa-select-dropdown",
|
|
298
300
|
props.popperClass,
|
|
299
|
-
props.moreDetail && `fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${
|
|
301
|
+
props.moreDetail && `fa-select-dropdown__more-detail fa-select-dropdown__more-detail-${globalSize.value}`
|
|
300
302
|
]);
|
|
301
303
|
useRender(() => createVNode(ElSelect, mergeProps(elSelectProps.value, elSelectEmits.value, {
|
|
302
304
|
"ref": selectRef,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/select/src/select.tsx"],"sourcesContent":["import { useVModel } from \"@vueuse/core\";\nimport { computed, defineComponent, onMounted, reactive, ref, watch } from \"vue\";\nimport { 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 \"./selectOption\";\nimport type { VNode } from \"vue\";\nimport type { PagedInput } from \"../../table\";\nimport type { ElSelectorModelValue, ElSelectorOutput, ElSelectorValue } from \"./select.type\";\n\n/** 传递给底层 Element Plus 选择器的扩展 Props。 */\nexport interface SelectComponentProps {\n\t/** @description 指定标签为节点的某个属性值 */\n\tlabel?: string | ((data: ElSelectorOutput) => string);\n\t/** @description 指定是否隐藏为节点的某个属性值 */\n\thide?: string | ((data: ElSelectorOutput) => boolean);\n\t/** @description 指定是否禁用为节点的某个属性值 */\n\tdisabled?: string | ((data: ElSelectorOutput) => boolean);\n\t/** @description 指定子节点对象为节点的某个属性值 */\n\tchildren?: string;\n}\n\n/** FaSelect 的运行时 Props 定义。 */\nexport const faSelectProps = {\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 懒加载远程数据,默认 true。当下拉框第一次显示的时候才会加载远程数据*/\n\tlazy: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 默认选中。不能和懒加载一起使用 */\n\tdefaultSelected: 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 下拉框数据 */\n\tdata: {\n\t\ttype: definePropType<ElSelectorOutput[]>(Array),\n\t\tdefault: (): ElSelectorOutput[] => [],\n\t},\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: string | number | PagedInput) => Promise<ElSelectorOutput[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | PagedInput>([String, Number, Object]),\n};\n\n/** FaSelect 的运行时 Emits 定义。 */\nexport const faSelectEmits = {\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/** FaSelect 的插槽参数。 */\nexport interface FaSelectSlots 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: \"FaSelect\",\n\tprops: faSelectProps,\n\temits: faSelectEmits,\n\tslots: makeSlots<FaSelectSlots>(),\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\tdebut: true,\n\t\t\t/** 回显 */\n\t\t\techo: props.data.length > 0 ? false : true,\n\t\t\t/** 下次刷新 */\n\t\t\tnextRefresh: false,\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 (): Promise<void> => {\n\t\t\tconst currentRequestVersion = ++requestVersion;\n\t\t\t// 判断是否需要自动请求\n\t\t\tif (props.requestApi) {\n\t\t\t\tstate.loading = true;\n\t\t\t\tconst params = props.initParam ?? {};\n\t\t\t\ttry {\n\t\t\t\t\tconst resData = await props.requestApi(params);\n\t\t\t\t\tif (currentRequestVersion !== requestVersion) return;\n\t\t\t\t\t// 这里不允许回显了\n\t\t\t\t\tstate.echo = false;\n\t\t\t\t\tstate.selectorData = handleData(resData);\n\t\t\t\t\temit(\"dataChangeCallBack\", state.selectorData);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (currentRequestVersion !== requestVersion) return;\n\t\t\t\t\tstate.selectorData = [];\n\t\t\t\t\tthrow error;\n\t\t\t\t} finally {\n\t\t\t\t\tif (currentRequestVersion === requestVersion) state.loading = false;\n\t\t\t\t}\n\t\t\t} else {\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.selectorData = handleData(props.data);\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\t// 懒加载\n\t\t\t\t\t!props.defaultSelected && props.lazy && (await 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\t// 判断是否为数组\n\t\t\t\t\t\tif (!Array.isArray(newValue)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelect]\", \"当启用 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:FaSelect]\", \"当启用 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.selectorData = 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:FaSelect]\", \"当禁用 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:FaSelect]\", \"当禁用 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.selectorData = [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\t\tlabel: typeof props.label === \"string\" ? props.label : undefined,\n\t\t\t\t\t\t\t},\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\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 selectorData = flattenOptions(state.selectorData);\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 = flattenOptions(state.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(state.selectorData);\n\n\t\t\t\tif (props.multiple) {\n\t\t\t\t\tif (!Array.isArray(value)) {\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\tselectedLabel.value = value.map((item, index) => {\n\t\t\t\t\t\tconst data = selectorData.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\tselectedLabel.value = null;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselectedLabel.value =\n\t\t\t\t\tselectorData.find((item) => item.value !== undefined && isEqual(item.value, value))?.label ??\n\t\t\t\t\t(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(async () => {\n\t\t\tif (props.defaultSelected) {\n\t\t\t\tawait loadData();\n\t\t\t\tconst firstItem = state.selectorData[0];\n\t\t\t\tif (firstItem?.value !== undefined) {\n\t\t\t\t\thandleModelValueUpdate(props.multiple ? [firstItem.value] : firstItem.value);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 判断是否为本地数据\n\t\t\telse if (!props.requestApi && props.data.length > 0) {\n\t\t\t\tstate.debut = false;\n\t\t\t\tawait loadData();\n\t\t\t}\n\t\t\t// 判断是否非默认选中,且未启用懒加载\n\t\t\telse if (!props.lazy) {\n\t\t\t\tawait loadData();\n\t\t\t}\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\twatch(\n\t\t\t\t() => props.data,\n\t\t\t\t() => {\n\t\t\t\t\tif (!props.requestApi) {\n\t\t\t\t\t\treturn loadData();\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t{ deep: true }\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-dropdown\",\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\"\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\t...(slots.header && { header: (): VNode[] => slots.header?.() ?? [] }),\n\t\t\t\t\t...(slots.footer && { footer: (): VNode[] => slots.footer?.() ?? [] }),\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...(slots.label && {\n\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }): VNode[] =>\n\t\t\t\t\t\t\tslots.label?.({ label, value }) ?? [],\n\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\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":";;;;;;;;;;;;;;AAuBA,MAAa,gBAAgB;CAC5B,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,QAAQ,KAAK,CAAC;;CAE/D,OAAO;EACN,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,YAAY;;CAEZ,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,iBAAiB;;CAEjB,OAAO;EACN,MAAM,eAAqC,MAAM;EACjD,gBAA+C;GAC9C,OAAO;GACP,MAAM;GACN,UAAU;GACV,UAAU;EACX;CACD;;CAEA,MAAM;EACL,MAAM,eAAmC,KAAK;EAC9C,eAAmC,CAAA;CACpC;;CAEA,YAAY,EACX,MAAM,eAAuF,QAAQ,EACtG;;CAEA,WAAW,eAA6C;EAAC;EAAQ;EAAQ;CAAM,CAAC;AACjF;;AAGA,MAAa,gBAAgB;CAC5B,GAAG;;CAEH,sBAAsB,UACrB,SAAS,KAAK,KAAK,SAAS,KAAK,KAAK,UAAU,KAAK,KAAK,SAAS,KAAK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GAAI,MAAM,UAAU,EAAE,cAAuB,MAAM,SAAS,KAAK,CAAA,EAAG;GACpE,GAAI,MAAM,UAAU,EAAE,cAAuB,MAAM,SAAS,KAAK,CAAA,EAAG;GACpE,GAAI,MAAM,SAAS,EAAE,aAAsB,MAAM,QAAQ,KAAK,CAAA,EAAG;GACjE,GAAI,MAAM,OAAO,EAAE,WAAoB,MAAM,MAAM,KAAK,CAAA,EAAG;GAC3D,GAAI,MAAM,WAAW,EAAE,eAAwB,MAAM,UAAU,KAAK,CAAA,EAAG;GACvE,GAAI,MAAM,SAAS,EAClB,QAAQ,EAAE,OAAO,YAChB,MAAM,QAAQ;IAAE;IAAO;GAAM,CAAC,KAAK,CAAA,EACrC;EAAE,CAAA,CAGJ;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,SAAS;;GAET,eAAe,UAA2D,uBAAuB,KAAK;;GAEtG,sBAAsB,uBAAuB,MAAM,WAAW,CAAA,IAAK,KAAA,CAAS;EAC7E,CAAC;CACF;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"select.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/select/src/select.tsx"],"sourcesContent":["import { computed, defineComponent, onMounted, reactive, shallowRef, useModel, watch } from \"vue\";\nimport { ElSelect, selectEmits, selectProps, useGlobalSize } from \"element-plus\";\nimport { addCssUnit, definePropType, isEqual, makeSlots, useEmits, useExpose, useProps, useRender, withDefineType } from \"../../../utils\";\nimport FaSelectOption from \"./selectOption\";\nimport type { PagedInput } from \"../../table\";\nimport type { ElSelectorModelValue, ElSelectorOutput, ElSelectorValue } from \"./select.type\";\n\n/** 传递给底层 Element Plus 选择器的扩展 Props。 */\nexport interface SelectComponentProps {\n\t/** @description 指定标签为节点的某个属性值 */\n\tlabel?: string | ((data: ElSelectorOutput) => string);\n\t/** @description 指定是否隐藏为节点的某个属性值 */\n\thide?: string | ((data: ElSelectorOutput) => boolean);\n\t/** @description 指定是否禁用为节点的某个属性值 */\n\tdisabled?: string | ((data: ElSelectorOutput) => boolean);\n\t/** @description 指定子节点对象为节点的某个属性值 */\n\tchildren?: string;\n}\n\n/** FaSelect 的运行时 Props 定义。 */\nexport const faSelectProps = {\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 懒加载远程数据,默认 true。当下拉框第一次显示的时候才会加载远程数据*/\n\tlazy: {\n\t\ttype: Boolean,\n\t\tdefault: true,\n\t},\n\t/** @description 默认选中。不能和懒加载一起使用 */\n\tdefaultSelected: Boolean,\n\t/** @description 配置选项 */\n\tprops: {\n\t\ttype: definePropType<SelectComponentProps>(Object),\n\t\tdefault: () => ({\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 下拉框数据 */\n\tdata: {\n\t\ttype: definePropType<ElSelectorOutput[]>(Array),\n\t\tdefault: () => [],\n\t},\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: string | number | PagedInput) => Promise<ElSelectorOutput[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | PagedInput>([String, Number, Object]),\n};\n\n/** FaSelect 的运行时 Emits 定义。 */\nexport const faSelectEmits = {\n\t...selectEmits,\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: ElSelectorModelValue) =>\n\t\ttypeof value === \"string\" ||\n\t\ttypeof value === \"number\" ||\n\t\ttypeof value === \"boolean\" ||\n\t\t(typeof value === \"object\" && value !== null) ||\n\t\tvalue == null,\n\t/** @description 选中数据改变 */\n\tchange: (_data: ElSelectorOutput | ElSelectorOutput[] | null, _value?: ElSelectorModelValue) => true,\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string | string[] | null) => typeof value === \"string\" || Array.isArray(value) || value === null,\n\t/** @description 数据改变 */\n\tdataChange: (data: ElSelectorOutput[]) => Array.isArray(data),\n};\n\n/** FaSelect 的插槽参数。 */\nexport interface FaSelectSlots 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: \"FaSelect\",\n\tprops: faSelectProps,\n\temits: faSelectEmits,\n\tslots: makeSlots<FaSelectSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst selectedLabel = useModel(props, \"label\");\n\n\t\tconst globalSize = useGlobalSize();\n\t\tconst selectRef = shallowRef<InstanceType<typeof ElSelect> | null>(null);\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\tdebut: true,\n\t\t\t/** 回显 */\n\t\t\techo: true,\n\t\t\t/** 下次刷新 */\n\t\t\tnextRefresh: false,\n\t\t});\n\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) => {\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 () => {\n\t\t\tconst currentRequestVersion = ++requestVersion;\n\t\t\t// 判断是否需要自动请求\n\t\t\tif (props.requestApi) {\n\t\t\t\tstate.loading = true;\n\t\t\t\tconst params = props.initParam ?? {};\n\t\t\t\ttry {\n\t\t\t\t\tconst resData = await props.requestApi(params);\n\t\t\t\t\tif (currentRequestVersion !== requestVersion) return;\n\t\t\t\t\t// 这里不允许回显了\n\t\t\t\t\tstate.echo = false;\n\t\t\t\t\tstate.selectorData = handleData(resData);\n\t\t\t\t\temit(\"dataChange\", state.selectorData);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (currentRequestVersion !== requestVersion) return;\n\t\t\t\t\tstate.selectorData = [];\n\t\t\t\t\tthrow error;\n\t\t\t\t} finally {\n\t\t\t\t\tif (currentRequestVersion === requestVersion) state.loading = false;\n\t\t\t\t}\n\t\t\t} else {\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.selectorData = handleData(props.data);\n\t\t\t}\n\t\t};\n\n\t\tconst handleModelValueUpdate = (value: ElSelectorModelValue) => {\n\t\t\tstate.value = value;\n\t\t\temit(\"update:modelValue\", value);\n\t\t};\n\n\t\tconst handleVisibleChange = async (visible: boolean) => {\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\t// 懒加载\n\t\t\t\t\t!props.defaultSelected && props.lazy && (await 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\t// eslint-disable-next-line vue/custom-event-name-casing -- Element Plus 的公开事件名为 visible-change,需要保持原始名称透传。\n\t\t\temit(\"visible-change\", visible);\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) => {\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 selectorData = flattenOptions(state.selectorData);\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 !== undefined);\n\t\t\t\temit(\"change\", dataList, value);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (value == null || 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 = flattenOptions(state.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() => props.modelValue,\n\t\t\t(newValue) => {\n\t\t\t\tif (state.echo && newValue != null) {\n\t\t\t\t\tconst hasLabel = props.label != null;\n\t\t\t\t\t// 判断是否为多选\n\t\t\t\t\tif (props.multiple) {\n\t\t\t\t\t\t// 判断是否为数组\n\t\t\t\t\t\tif (!Array.isArray(newValue)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelect]\", \"当启用 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 && !Array.isArray(props.label)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelect]\", \"当启用 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.selectorData = 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:FaSelect]\", \"当禁用 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 && Array.isArray(props.label)) {\n\t\t\t\t\t\t\tconsole.error(\"[Fast:FaSelect]\", \"当禁用 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.selectorData = [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tvalue: newValue,\n\t\t\t\t\t\t\t\tlabel: typeof props.label === \"string\" ? props.label : undefined,\n\t\t\t\t\t\t\t},\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\twatch(\n\t\t\t[() => state.value, () => state.selectorData],\n\t\t\t([value]) => {\n\t\t\t\tconst selectorData = flattenOptions(state.selectorData);\n\n\t\t\t\tif (props.multiple) {\n\t\t\t\t\tif (!Array.isArray(value)) {\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\tselectedLabel.value = value.map((item, index) => {\n\t\t\t\t\t\tconst data = selectorData.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 (value == null || Array.isArray(value)) {\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tselectedLabel.value =\n\t\t\t\t\tselectorData.find((item) => item.value !== undefined && isEqual(item.value, value))?.label ??\n\t\t\t\t\t(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\twatch(\n\t\t\t() => props.initParam,\n\t\t\t(newValue, oldValue) => {\n\t\t\t\tif (!isEqual(newValue, oldValue)) {\n\t\t\t\t\tstate.nextRefresh = true;\n\t\t\t\t\tif (state.value != null) {\n\t\t\t\t\t\thandleModelValueUpdate(props.multiple ? [] : undefined);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\twatch(\n\t\t\t() => props.data,\n\t\t\t() => {\n\t\t\t\tif (!props.requestApi) {\n\t\t\t\t\treturn loadData();\n\t\t\t\t}\n\t\t\t},\n\t\t\t{ deep: true }\n\t\t);\n\n\t\twatch(\n\t\t\t() => props.data.length,\n\t\t\t(length) => {\n\t\t\t\tif (state.debut) state.echo = length === 0;\n\t\t\t},\n\t\t\t{ immediate: true }\n\t\t);\n\n\t\tonMounted(async () => {\n\t\t\tif (props.defaultSelected) {\n\t\t\t\tawait loadData();\n\t\t\t\tconst firstItem = state.selectorData[0];\n\t\t\t\tif (firstItem?.value !== undefined) {\n\t\t\t\t\thandleModelValueUpdate(props.multiple ? [firstItem.value] : firstItem.value);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// 判断是否为本地数据\n\t\t\telse if (!props.requestApi && props.data.length > 0) {\n\t\t\t\tstate.debut = false;\n\t\t\t\tawait loadData();\n\t\t\t}\n\t\t\t// 判断是否非默认选中,且未启用懒加载\n\t\t\telse if (!props.lazy) {\n\t\t\t\tawait loadData();\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-dropdown\",\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\"\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: () =>\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\t...(slots.header && { header: () => slots.header?.() ?? [] }),\n\t\t\t\t\t...(slots.footer && { footer: () => slots.footer?.() ?? [] }),\n\t\t\t\t\t...(slots.prefix && { prefix: () => slots.prefix?.() ?? [] }),\n\t\t\t\t\t...(slots.empty && { empty: () => slots.empty?.() ?? [] }),\n\t\t\t\t\t...(slots.tag && { tag: () => slots.tag?.() ?? [] }),\n\t\t\t\t\t...(slots.loading && { loading: () => slots.loading?.() ?? [] }),\n\t\t\t\t\t...(slots.label && {\n\t\t\t\t\t\tlabel: ({ label, value }: { label: string; value: string | number | boolean | object }) =>\n\t\t\t\t\t\t\tslots.label?.({ label, value }) ?? [],\n\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\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":";;;;;;;;;;;;;AAoBA,MAAa,gBAAgB;CAC5B,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,QAAQ,KAAK,CAAC;;CAE/D,OAAO;EACN,MAAM,CAAC,QAAQ,MAAM;EACrB,SAAS;CACV;;CAEA,YAAY;;CAEZ,MAAM;EACL,MAAM;EACN,SAAS;CACV;;CAEA,iBAAiB;;CAEjB,OAAO;EACN,MAAM,eAAqC,MAAM;EACjD,gBAAgB;GACf,OAAO;GACP,MAAM;GACN,UAAU;GACV,UAAU;EACX;CACD;;CAEA,MAAM;EACL,MAAM,eAAmC,KAAK;EAC9C,eAAe,CAAA;CAChB;;CAEA,YAAY,EACX,MAAM,eAAuF,QAAQ,EACtG;;CAEA,WAAW,eAA6C;EAAC;EAAQ;EAAQ;CAAM,CAAC;AACjF;;AAGA,MAAa,gBAAgB;CAC5B,GAAG;;CAEH,sBAAsB,UACrB,OAAO,UAAU,YACjB,OAAO,UAAU,YACjB,OAAO,UAAU,aAChB,OAAO,UAAU,YAAY,UAAU,QACxC,SAAS;;CAEV,SAAS,OAAqD,WAAkC;;CAEhG,iBAAiB,UAAoC,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,KAAK,UAAU;;CAEpH,aAAa,SAA6B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AAI,MAAM,SAAS,EAAE,aAAa,MAAM,QAAQ,KAAK,CAAA,EAAG;GACxD,GAAI,MAAM,OAAO,EAAE,WAAW,MAAM,MAAM,KAAK,CAAA,EAAG;GAClD,GAAI,MAAM,WAAW,EAAE,eAAe,MAAM,UAAU,KAAK,CAAA,EAAG;GAC9D,GAAI,MAAM,SAAS,EAClB,QAAQ,EAAE,OAAO,YAChB,MAAM,QAAQ;IAAE;IAAO;GAAM,CAAC,KAAK,CAAA,EACrC;EAAE,CAAA,CAGJ;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,SAAS;;GAET,eAAe,UAA2D,uBAAuB,KAAK;;GAEtG,sBAAsB,uBAAuB,MAAM,WAAW,CAAA,IAAK,KAAA,CAAS;EAC7E,CAAC;CACF;AACD,CAAC"}
|
|
@@ -3,7 +3,6 @@ import { useRender } from "../../../utils/vue/render.mjs";
|
|
|
3
3
|
import { makeSlots } from "../../../utils/vue/slots.mjs";
|
|
4
4
|
import { Fragment, computed, createVNode, defineComponent, h, isVNode, reactive, resolveComponent } from "vue";
|
|
5
5
|
import { ElOption, ElOptionGroup } from "element-plus";
|
|
6
|
-
import { isUndefined } from "lodash-unified";
|
|
7
6
|
//#region src/components/select/src/selectOption.tsx
|
|
8
7
|
function _isSlot(s) {
|
|
9
8
|
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
@@ -41,10 +40,10 @@ var selectOption_default = defineComponent({
|
|
|
41
40
|
slots: makeSlots(),
|
|
42
41
|
setup(props, { slots }) {
|
|
43
42
|
const state = reactive({
|
|
44
|
-
value: computed(() =>
|
|
45
|
-
label: computed(() =>
|
|
46
|
-
disabled: computed(() =>
|
|
47
|
-
children: computed(() =>
|
|
43
|
+
value: computed(() => props.value ?? props.data.value ?? ""),
|
|
44
|
+
label: computed(() => props.label ?? props.data.label),
|
|
45
|
+
disabled: computed(() => props.disabled ?? props.data.disabled ?? false),
|
|
46
|
+
children: computed(() => props.children ?? props.data.children ?? [])
|
|
48
47
|
});
|
|
49
48
|
useRender(() => {
|
|
50
49
|
let _slot;
|