fast-element-plus 2.0.15 → 2.0.17
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 +28 -0
- package/dist/component.d.ts +6570 -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/index.d.ts +1 -1
- package/dist/components/contextMenu/index.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.d.ts +2 -2
- package/dist/components/contextMenu/src/contextMenu.mjs +10 -9
- 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 +10 -11
- package/dist/components/dialog/src/dialog.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.d.ts +2 -2
- package/dist/components/drawer/src/drawer.mjs +18 -18
- package/dist/components/drawer/src/drawer.mjs.map +1 -1
- package/dist/components/form/src/form.d.ts +34 -16
- 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 +4 -4
- 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 +3 -3
- package/dist/components/form/utils/form.mjs +6 -10
- 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 +3 -3
- package/dist/components/image/src/image.mjs.map +1 -1
- package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +4 -4
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +11 -15
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/dist/components/layoutGrid/index.d.ts +1 -1
- package/dist/components/layoutGrid/index.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.d.ts +23 -11
- package/dist/components/layoutGrid/src/layoutGrid.mjs +44 -45
- 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/index.d.ts +1 -1
- package/dist/components/select/index.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +29 -14
- package/dist/components/select/src/select.mjs +47 -45
- 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 +29 -14
- 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 +51 -31
- package/dist/components/selectV2/src/selectV2.mjs +66 -64
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
- package/dist/components/table/index.d.ts +3 -3
- package/dist/components/table/index.mjs +1 -3
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/table/src/table.d.ts +72 -38
- package/dist/components/table/src/table.mjs +98 -104
- 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 +7 -7
- package/dist/components/table/src/tableColumn.mjs +25 -45
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/src/tableColumnSettingDialog.mjs +32 -22
- 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 +35 -44
- 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 +19 -20
- package/dist/components/table/src/useTable.mjs.map +1 -1
- package/dist/components/table/utils/table.mjs +6 -8
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/index.d.ts +1 -1
- package/dist/components/tree/index.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +9 -9
- package/dist/components/tree/src/tree.mjs +29 -27
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +38 -35
- package/dist/components/treeSelect/src/treeSelect.mjs +47 -45
- 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 +5 -6
- package/dist/components/upload/src/upload.mjs.map +1 -1
- package/dist/components/upload/src/useUpload.mjs +8 -10
- package/dist/components/upload/src/useUpload.mjs.map +1 -1
- package/dist/components/upload/utils/upload.d.ts +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 +8 -5
- package/dist/components/uploadImage/src/uploadImage.mjs +18 -13
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/dist/components/uploadImages/src/uploadImages.d.ts +8 -5
- package/dist/components/uploadImages/src/uploadImages.mjs +16 -11
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/dist/directives/click-copy/index.d.ts +1 -1
- package/dist/directives/click-copy/index.mjs +5 -9
- package/dist/directives/click-copy/index.mjs.map +1 -1
- package/dist/directives/click-debounce/index.d.ts +1 -1
- package/dist/directives/click-draggable/index.d.ts +1 -1
- package/dist/directives/click-icon-copy/index.d.ts +1 -1
- package/dist/directives/click-icon-copy/index.mjs.map +1 -1
- package/dist/directives/click-longpress/index.d.ts +1 -1
- package/dist/directives/click-throttle/index.d.ts +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/index.mjs +1 -3
- package/dist/index.mjs.map +1 -1
- package/dist/utils/async/index.mjs +6 -4
- package/dist/utils/async/index.mjs.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/object/index.d.ts +8 -0
- package/dist/utils/object/index.mjs +113 -0
- package/dist/utils/object/index.mjs.map +1 -0
- package/dist/utils/string/index.mjs +19 -11
- 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 +5 -10
- package/dist/components/table/src/page.type.mjs +0 -45
- package/dist/components/table/src/page.type.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FaLayoutGridBreakpoint } from "./layoutGrid.type";
|
|
2
2
|
/** FaLayoutGrid 的插槽参数。 */
|
|
3
3
|
export interface FaLayoutGridSlots extends Record<string, unknown> {
|
|
4
4
|
/** @description 默认内容插槽 */
|
|
@@ -7,8 +7,14 @@ export interface FaLayoutGridSlots extends Record<string, unknown> {
|
|
|
7
7
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
8
|
/** @description Grid布局列配置 */
|
|
9
9
|
cols: {
|
|
10
|
-
type: import("vue").PropType<string | number | Record<
|
|
11
|
-
default: () =>
|
|
10
|
+
type: import("vue").PropType<string | number | Partial<Record<FaLayoutGridBreakpoint, number>>>;
|
|
11
|
+
default: () => {
|
|
12
|
+
xs: number;
|
|
13
|
+
sm: number;
|
|
14
|
+
md: number;
|
|
15
|
+
lg: number;
|
|
16
|
+
xl: number;
|
|
17
|
+
};
|
|
12
18
|
};
|
|
13
19
|
/** @description 折叠 */
|
|
14
20
|
collapsed: BooleanConstructor;
|
|
@@ -24,17 +30,23 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
24
30
|
};
|
|
25
31
|
}>, {
|
|
26
32
|
/** @description 响应式断点 */
|
|
27
|
-
|
|
33
|
+
breakpoint: import("vue").Ref<FaLayoutGridBreakpoint, FaLayoutGridBreakpoint>;
|
|
28
34
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
35
|
/** @description 断点变化事件 */
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
breakpointChange: ({ breakpoint: _breakpoint }: {
|
|
37
|
+
breakpoint: FaLayoutGridBreakpoint;
|
|
32
38
|
}) => true;
|
|
33
39
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
40
|
/** @description Grid布局列配置 */
|
|
35
41
|
cols: {
|
|
36
|
-
type: import("vue").PropType<string | number | Record<
|
|
37
|
-
default: () =>
|
|
42
|
+
type: import("vue").PropType<string | number | Partial<Record<FaLayoutGridBreakpoint, number>>>;
|
|
43
|
+
default: () => {
|
|
44
|
+
xs: number;
|
|
45
|
+
sm: number;
|
|
46
|
+
md: number;
|
|
47
|
+
lg: number;
|
|
48
|
+
xl: number;
|
|
49
|
+
};
|
|
38
50
|
};
|
|
39
51
|
/** @description 折叠 */
|
|
40
52
|
collapsed: BooleanConstructor;
|
|
@@ -49,12 +61,12 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
49
61
|
default: number;
|
|
50
62
|
};
|
|
51
63
|
}>> & Readonly<{
|
|
52
|
-
|
|
53
|
-
|
|
64
|
+
onBreakpointChange?: ((args_0: {
|
|
65
|
+
breakpoint: FaLayoutGridBreakpoint;
|
|
54
66
|
}) => any) | undefined;
|
|
55
67
|
}>, {
|
|
56
68
|
collapsed: boolean;
|
|
57
|
-
cols: string | number | Record<
|
|
69
|
+
cols: string | number | Partial<Record<FaLayoutGridBreakpoint, number>>;
|
|
58
70
|
collapsedRows: string | number;
|
|
59
71
|
gap: number | [number, number];
|
|
60
72
|
}, import("../../../utils").TypedSlotsDeclaration<FaLayoutGridSlots>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -2,8 +2,7 @@ import { useExpose } from "../../../utils/vue/expose.mjs";
|
|
|
2
2
|
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
|
-
import { computed, createVNode, defineComponent, nextTick, onActivated, onDeactivated, onMounted, onUnmounted, provide, ref, watch } from "vue";
|
|
6
|
-
import { isArray, isNumber, isObject } from "lodash-unified";
|
|
5
|
+
import { computed, createVNode, defineComponent, nextTick, onActivated, onDeactivated, onMounted, onUnmounted, provide, ref, shallowRef, watch } from "vue";
|
|
7
6
|
//#region src/components/layoutGrid/src/layoutGrid.tsx
|
|
8
7
|
var layoutGrid_default = defineComponent({
|
|
9
8
|
name: "FaLayoutGrid",
|
|
@@ -38,21 +37,34 @@ var layoutGrid_default = defineComponent({
|
|
|
38
37
|
},
|
|
39
38
|
emits: {
|
|
40
39
|
/** @description 断点变化事件 */
|
|
41
|
-
|
|
40
|
+
breakpointChange: ({ breakpoint: _breakpoint }) => true },
|
|
42
41
|
slots: makeSlots(),
|
|
43
42
|
setup(props, { slots, emit, expose }) {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
const containerRef = shallowRef(null);
|
|
44
|
+
const horizontalGap = computed(() => Array.isArray(props.gap) ? props.gap[0] : props.gap);
|
|
45
|
+
provide("gap", horizontalGap);
|
|
46
|
+
const breakpoint = ref("xl");
|
|
47
|
+
provide("breakpoint", breakpoint);
|
|
48
|
+
const firstHiddenIndex = ref(-1);
|
|
49
|
+
provide("firstHiddenIndex", firstHiddenIndex);
|
|
50
50
|
const cols = computed(() => {
|
|
51
|
-
if (
|
|
51
|
+
if (typeof props.cols === "object" && props.cols !== null) return props.cols[breakpoint.value] ?? 1;
|
|
52
52
|
return props.cols;
|
|
53
53
|
});
|
|
54
54
|
provide("cols", cols);
|
|
55
|
-
const collapsedRows =
|
|
55
|
+
const collapsedRows = computed(() => typeof props.collapsedRows === "number" ? props.collapsedRows : Number(props.collapsedRows));
|
|
56
|
+
const gap = computed(() => {
|
|
57
|
+
if (typeof props.gap === "number") return `${props.gap}px`;
|
|
58
|
+
if (Array.isArray(props.gap)) return `${props.gap[1]}px ${props.gap[0]}px`;
|
|
59
|
+
return "unset";
|
|
60
|
+
});
|
|
61
|
+
const style = computed(() => {
|
|
62
|
+
return {
|
|
63
|
+
display: "grid",
|
|
64
|
+
gridGap: gap.value,
|
|
65
|
+
gridTemplateColumns: `repeat(${cols.value}, minmax(0, 1fr))`
|
|
66
|
+
};
|
|
67
|
+
});
|
|
56
68
|
const breakpoints = {
|
|
57
69
|
xs: {
|
|
58
70
|
min: 0,
|
|
@@ -79,44 +91,31 @@ breakPointChange: ({ breakPoint: _breakPoint }) => true },
|
|
|
79
91
|
if (e.length !== 1 || e[0] === void 0) throw new Error("FaLayoutGrid 监听到了非预期数量的布局容器。");
|
|
80
92
|
const width = e[0].target.scrollWidth;
|
|
81
93
|
for (const [key, { min, max }] of Object.entries(breakpoints)) if (width >= min && width <= max) {
|
|
82
|
-
|
|
94
|
+
breakpoint.value = key;
|
|
83
95
|
break;
|
|
84
96
|
}
|
|
85
97
|
};
|
|
86
98
|
let resizeObserver;
|
|
87
99
|
const observeResize = () => {
|
|
88
|
-
const element =
|
|
100
|
+
const element = containerRef.value;
|
|
89
101
|
if (!element) return;
|
|
90
102
|
resizeObserver?.disconnect();
|
|
91
103
|
resizeObserver = new ResizeObserver(resize);
|
|
92
104
|
resizeObserver.observe(element);
|
|
93
105
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
watch(() => breakPoint.value, (newValue) => {
|
|
97
|
-
emit("breakPointChange", { breakPoint: newValue });
|
|
98
|
-
}, { immediate: true });
|
|
106
|
+
watch(() => breakpoint.value, (newValue) => {
|
|
107
|
+
emit("breakpointChange", { breakpoint: newValue });
|
|
99
108
|
});
|
|
100
|
-
|
|
109
|
+
onMounted(() => {
|
|
101
110
|
nextTick(observeResize);
|
|
111
|
+
emit("breakpointChange", { breakpoint: breakpoint.value });
|
|
102
112
|
});
|
|
103
|
-
|
|
104
|
-
resizeObserver?.disconnect();
|
|
105
|
-
});
|
|
113
|
+
onActivated(() => nextTick(observeResize));
|
|
106
114
|
onDeactivated(() => {
|
|
107
115
|
resizeObserver?.disconnect();
|
|
108
116
|
});
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if (isArray(props.gap)) return `${props.gap[1]}px ${props.gap[0]}px`;
|
|
112
|
-
return "unset";
|
|
113
|
-
});
|
|
114
|
-
const style = computed(() => {
|
|
115
|
-
return {
|
|
116
|
-
display: "grid",
|
|
117
|
-
gridGap: gap.value,
|
|
118
|
-
gridTemplateColumns: `repeat(${cols.value}, minmax(0, 1fr))`
|
|
119
|
-
};
|
|
117
|
+
onUnmounted(() => {
|
|
118
|
+
resizeObserver?.disconnect();
|
|
120
119
|
});
|
|
121
120
|
useRender(() => {
|
|
122
121
|
const defaultSlot = slots.default?.() ?? [];
|
|
@@ -124,35 +123,35 @@ breakPointChange: ({ breakPoint: _breakPoint }) => true },
|
|
|
124
123
|
const fields = [];
|
|
125
124
|
let suffix;
|
|
126
125
|
defaultSlot.forEach((slot) => {
|
|
127
|
-
if (typeof slot.type === "object" &&
|
|
128
|
-
if (typeof slot.type === "symbol" && Array.isArray(slot
|
|
126
|
+
if (typeof slot.type === "object" && "name" in slot.type && slot.type.name === "FaLayoutGridItem" && slot.props?.["suffix"] !== void 0) suffix = slot;
|
|
127
|
+
if (typeof slot.type === "symbol" && Array.isArray(slot.children)) fields.push(...slot.children);
|
|
129
128
|
});
|
|
130
129
|
let suffixCols = 0;
|
|
131
130
|
if (suffix?.props) {
|
|
132
|
-
const
|
|
133
|
-
suffixCols = (
|
|
131
|
+
const activeBreakpointProps = suffix.props[breakpoint.value];
|
|
132
|
+
suffixCols = (activeBreakpointProps?.span ?? Number(suffix.props["span"] ?? 1)) + (activeBreakpointProps?.offset ?? Number(suffix.props["offset"] ?? 0));
|
|
134
133
|
}
|
|
135
134
|
let occupiedCols = 0;
|
|
136
|
-
|
|
135
|
+
firstHiddenIndex.value = -1;
|
|
137
136
|
for (const [index, current] of fields.entries()) {
|
|
138
137
|
const currentProps = current.props;
|
|
139
138
|
if (currentProps === null) continue;
|
|
140
|
-
const
|
|
141
|
-
occupiedCols += (
|
|
142
|
-
if (occupiedCols > collapsedRows * Number(cols.value) - suffixCols) {
|
|
143
|
-
|
|
139
|
+
const activeBreakpointProps = currentProps[breakpoint.value];
|
|
140
|
+
occupiedCols += (activeBreakpointProps?.span ?? Number(currentProps["span"] ?? 1)) + (activeBreakpointProps?.offset ?? Number(currentProps["offset"] ?? 0));
|
|
141
|
+
if (occupiedCols > collapsedRows.value * Number(cols.value) - suffixCols) {
|
|
142
|
+
firstHiddenIndex.value = index;
|
|
144
143
|
break;
|
|
145
144
|
}
|
|
146
145
|
}
|
|
147
|
-
} else
|
|
146
|
+
} else firstHiddenIndex.value = -1;
|
|
148
147
|
return createVNode("div", {
|
|
149
|
-
"ref":
|
|
148
|
+
"ref": containerRef,
|
|
150
149
|
"style": style.value
|
|
151
150
|
}, [defaultSlot]);
|
|
152
151
|
});
|
|
153
152
|
return useExpose(expose, {
|
|
154
153
|
/** @description 响应式断点 */
|
|
155
|
-
|
|
154
|
+
breakpoint });
|
|
156
155
|
}
|
|
157
156
|
});
|
|
158
157
|
//#endregion
|
|
@@ -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":"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"}
|
|
@@ -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"}
|
|
@@ -12,7 +12,7 @@ export default FaSelect;
|
|
|
12
12
|
export declare const FaSelectOption: TSXWithInstall<typeof SelectOption>;
|
|
13
13
|
export { faSelectProps };
|
|
14
14
|
export type { FaSelectSlots } from "./src/select";
|
|
15
|
-
export * from "./src/select.type";
|
|
15
|
+
export type * from "./src/select.type";
|
|
16
16
|
/** FaSelect 暴露的组件实例类型。 */
|
|
17
17
|
export type FaSelectInstance = InstanceType<typeof Select>;
|
|
18
18
|
/** FaSelect 的完整 Props 类型。 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Select","SelectOption"],"sources":["../../../src/components/select/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from \"../../utils\";\nimport Select, { faSelectProps } from \"./src/select\";\nimport SelectOption from \"./src/selectOption\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\nimport type { faSelectEmits } from \"./src/select\";\n\n/** 支持远程数据、分页和自定义选项的选择器组件。 */\nexport const FaSelect: TSXWithInstall<typeof Select> & { SelectOption: typeof SelectOption } = withInstall(Select, {\n\tSelectOption,\n});\nexport default FaSelect;\n\n/** 可独立注册的 FaSelect 选项组件。 */\nexport const FaSelectOption: TSXWithInstall<typeof SelectOption> = withNoopInstall(SelectOption);\n\nexport { faSelectProps };\nexport type { FaSelectSlots } from \"./src/select\";\nexport * from \"./src/select.type\";\n\n/** FaSelect 暴露的组件实例类型。 */\nexport type FaSelectInstance = InstanceType<typeof Select>;\n\n/** FaSelect 的完整 Props 类型。 */\nexport type FaSelectProps = ExtractPropTypes<typeof faSelectProps>;\n\n/** FaSelect 的 Emits 类型。 */\nexport type FaSelectEmits = typeof faSelectEmits;\n\n/** FaSelectOption 暴露的组件实例类型。 */\nexport type FaSelectOptionInstance = InstanceType<typeof SelectOption>;\n"],"mappings":";;;;;AAQA,MAAa,WAAkF,YAAYA,gBAAQ,EAClH,cAAA,qBACD,CAAC;;AAID,MAAa,iBAAsD,gBAAgBC,oBAAY"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Select","SelectOption"],"sources":["../../../src/components/select/index.ts"],"sourcesContent":["import { withInstall, withNoopInstall } from \"../../utils\";\nimport Select, { faSelectProps } from \"./src/select\";\nimport SelectOption from \"./src/selectOption\";\nimport type { ExtractPropTypes } from \"vue\";\nimport type { TSXWithInstall } from \"../../utils\";\nimport type { faSelectEmits } from \"./src/select\";\n\n/** 支持远程数据、分页和自定义选项的选择器组件。 */\nexport const FaSelect: TSXWithInstall<typeof Select> & { SelectOption: typeof SelectOption } = withInstall(Select, {\n\tSelectOption,\n});\nexport default FaSelect;\n\n/** 可独立注册的 FaSelect 选项组件。 */\nexport const FaSelectOption: TSXWithInstall<typeof SelectOption> = withNoopInstall(SelectOption);\n\nexport { faSelectProps };\nexport type { FaSelectSlots } from \"./src/select\";\nexport type * from \"./src/select.type\";\n\n/** FaSelect 暴露的组件实例类型。 */\nexport type FaSelectInstance = InstanceType<typeof Select>;\n\n/** FaSelect 的完整 Props 类型。 */\nexport type FaSelectProps = ExtractPropTypes<typeof faSelectProps>;\n\n/** FaSelect 的 Emits 类型。 */\nexport type FaSelectEmits = typeof faSelectEmits;\n\n/** FaSelectOption 暴露的组件实例类型。 */\nexport type FaSelectOptionInstance = InstanceType<typeof SelectOption>;\n"],"mappings":";;;;;AAQA,MAAa,WAAkF,YAAYA,gBAAQ,EAClH,cAAA,qBACD,CAAC;;AAID,MAAa,iBAAsD,gBAAgBC,oBAAY"}
|
|
@@ -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: {
|
|
@@ -553,15 +568,15 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
553
568
|
__epPropKey: true;
|
|
554
569
|
};
|
|
555
570
|
}>> & Readonly<{
|
|
556
|
-
onBlur?: ((evt: FocusEvent) => any) | undefined;
|
|
557
|
-
onFocus?: ((evt: FocusEvent) => any) | undefined;
|
|
558
571
|
onClear?: (() => any) | undefined;
|
|
559
572
|
onChange?: ((_data: ElSelectorOutput<ElSelectorValue, any> | ElSelectorOutput<ElSelectorValue, any>[] | null, _value?: ElSelectorModelValue) => any) | undefined;
|
|
560
573
|
"onUpdate:modelValue"?: ((value: ElSelectorModelValue) => any) | undefined;
|
|
574
|
+
onFocus?: ((evt: FocusEvent) => any) | undefined;
|
|
575
|
+
onBlur?: ((evt: FocusEvent) => any) | undefined;
|
|
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;
|