@katlux/toolkit 0.1.0-beta.72 → 0.1.0-beta.74
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/dist/module.json +1 -1
- package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +12 -3
- package/dist/runtime/components/KDropdown/KDropdown.global.vue +2 -1
- package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +12 -3
- package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +24 -2
- package/dist/runtime/components/KDropdown/KDropdown.logic.js +84 -24
- package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
- package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
- package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +1 -1
- package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +0 -1
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +7 -1
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +56 -13
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +7 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -16,7 +16,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
16
16
|
default: undefined;
|
|
17
17
|
};
|
|
18
18
|
align: {
|
|
19
|
-
type: import("vue").PropType<"
|
|
19
|
+
type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownAlign>;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
direction: {
|
|
23
|
+
type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownDirection>;
|
|
20
24
|
default: string;
|
|
21
25
|
};
|
|
22
26
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -39,7 +43,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
39
43
|
default: undefined;
|
|
40
44
|
};
|
|
41
45
|
align: {
|
|
42
|
-
type: import("vue").PropType<"
|
|
46
|
+
type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownAlign>;
|
|
47
|
+
default: string;
|
|
48
|
+
};
|
|
49
|
+
direction: {
|
|
50
|
+
type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownDirection>;
|
|
43
51
|
default: string;
|
|
44
52
|
};
|
|
45
53
|
}>> & Readonly<{
|
|
@@ -48,8 +56,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
48
56
|
isOpen: boolean;
|
|
49
57
|
teleportTo: string;
|
|
50
58
|
fullWidth: boolean;
|
|
51
|
-
align: "
|
|
59
|
+
align: import("./KDropdown.logic.js").KDropdownAlign;
|
|
52
60
|
anchorEl: HTMLElement;
|
|
61
|
+
direction: import("./KDropdown.logic.js").KDropdownDirection;
|
|
53
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
63
|
declare const _default: typeof __VLS_export;
|
|
55
64
|
export default _default;
|
|
@@ -16,7 +16,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
16
16
|
default: undefined;
|
|
17
17
|
};
|
|
18
18
|
align: {
|
|
19
|
-
type: import("vue").PropType<"
|
|
19
|
+
type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownAlign>;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
direction: {
|
|
23
|
+
type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownDirection>;
|
|
20
24
|
default: string;
|
|
21
25
|
};
|
|
22
26
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -39,7 +43,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
39
43
|
default: undefined;
|
|
40
44
|
};
|
|
41
45
|
align: {
|
|
42
|
-
type: import("vue").PropType<"
|
|
46
|
+
type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownAlign>;
|
|
47
|
+
default: string;
|
|
48
|
+
};
|
|
49
|
+
direction: {
|
|
50
|
+
type: import("vue").PropType<import("./KDropdown.logic.js").KDropdownDirection>;
|
|
43
51
|
default: string;
|
|
44
52
|
};
|
|
45
53
|
}>> & Readonly<{
|
|
@@ -48,8 +56,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
48
56
|
isOpen: boolean;
|
|
49
57
|
teleportTo: string;
|
|
50
58
|
fullWidth: boolean;
|
|
51
|
-
align: "
|
|
59
|
+
align: import("./KDropdown.logic.js").KDropdownAlign;
|
|
52
60
|
anchorEl: HTMLElement;
|
|
61
|
+
direction: import("./KDropdown.logic.js").KDropdownDirection;
|
|
53
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
54
63
|
declare const _default: typeof __VLS_export;
|
|
55
64
|
export default _default;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { type PropType, type Ref } from 'vue';
|
|
2
|
+
export type KDropdownDirection = 'auto' | 'bottom' | 'top' | 'left' | 'right';
|
|
3
|
+
export type KDropdownAlign = 'left' | 'right' | 'top' | 'bottom';
|
|
2
4
|
export interface KDropdownProps {
|
|
3
5
|
isOpen: boolean;
|
|
4
6
|
fullWidth: boolean;
|
|
5
7
|
anchorEl?: HTMLElement;
|
|
6
8
|
teleportTo?: string;
|
|
7
|
-
align?:
|
|
9
|
+
align?: KDropdownAlign;
|
|
10
|
+
direction?: KDropdownDirection;
|
|
8
11
|
}
|
|
9
12
|
export interface KDropdownEmits {
|
|
10
13
|
(e: 'update:isOpen', value: boolean): void;
|
|
@@ -27,7 +30,11 @@ export declare const KDropdownDefaultProps: {
|
|
|
27
30
|
default: undefined;
|
|
28
31
|
};
|
|
29
32
|
align: {
|
|
30
|
-
type: PropType<
|
|
33
|
+
type: PropType<KDropdownAlign>;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
direction: {
|
|
37
|
+
type: PropType<KDropdownDirection>;
|
|
31
38
|
default: string;
|
|
32
39
|
};
|
|
33
40
|
};
|
|
@@ -37,17 +44,32 @@ export declare function useKDropdownLogic(props: KDropdownProps, emit: KDropdown
|
|
|
37
44
|
top: number;
|
|
38
45
|
left: number;
|
|
39
46
|
right: number;
|
|
47
|
+
bottom: number;
|
|
40
48
|
width: number;
|
|
49
|
+
height: number;
|
|
50
|
+
maxHeight: number;
|
|
51
|
+
resolvedDirection: "top" | "bottom" | "left" | "right";
|
|
52
|
+
resolvedAlign: "left" | "right" | "top" | "bottom";
|
|
41
53
|
}, {
|
|
42
54
|
top: number;
|
|
43
55
|
left: number;
|
|
44
56
|
right: number;
|
|
57
|
+
bottom: number;
|
|
45
58
|
width: number;
|
|
59
|
+
height: number;
|
|
60
|
+
maxHeight: number;
|
|
61
|
+
resolvedDirection: "top" | "bottom" | "left" | "right";
|
|
62
|
+
resolvedAlign: "left" | "right" | "top" | "bottom";
|
|
46
63
|
} | {
|
|
47
64
|
top: number;
|
|
48
65
|
left: number;
|
|
49
66
|
right: number;
|
|
67
|
+
bottom: number;
|
|
50
68
|
width: number;
|
|
69
|
+
height: number;
|
|
70
|
+
maxHeight: number;
|
|
71
|
+
resolvedDirection: "top" | "bottom" | "left" | "right";
|
|
72
|
+
resolvedAlign: "left" | "right" | "top" | "bottom";
|
|
51
73
|
}>;
|
|
52
74
|
clickoutside: () => void;
|
|
53
75
|
teleportTarget: import("vue").ComputedRef<string>;
|
|
@@ -20,6 +20,10 @@ export const KDropdownDefaultProps = {
|
|
|
20
20
|
align: {
|
|
21
21
|
type: String,
|
|
22
22
|
default: "left"
|
|
23
|
+
},
|
|
24
|
+
direction: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "auto"
|
|
23
27
|
}
|
|
24
28
|
};
|
|
25
29
|
export function useKDropdownLogic(props, emit) {
|
|
@@ -38,42 +42,100 @@ export function useKDropdownLogic(props, emit) {
|
|
|
38
42
|
return "body";
|
|
39
43
|
});
|
|
40
44
|
const open = ref(false);
|
|
41
|
-
const dropdownRect = ref({
|
|
45
|
+
const dropdownRect = ref({
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
right: 0,
|
|
49
|
+
bottom: 0,
|
|
50
|
+
width: 0,
|
|
51
|
+
height: 0,
|
|
52
|
+
maxHeight: 300,
|
|
53
|
+
resolvedDirection: "bottom",
|
|
54
|
+
resolvedAlign: "left"
|
|
55
|
+
});
|
|
42
56
|
const clickoutside = () => {
|
|
43
57
|
open.value = false;
|
|
44
58
|
emit("update:isOpen", open.value);
|
|
45
59
|
};
|
|
60
|
+
function resolveDirection(rect, viewportWidth, viewportHeight, requested) {
|
|
61
|
+
const spaceBelow = viewportHeight - rect.bottom;
|
|
62
|
+
const spaceAbove = rect.top;
|
|
63
|
+
const spaceRight = viewportWidth - rect.right;
|
|
64
|
+
const spaceLeft = rect.left;
|
|
65
|
+
if (requested === "auto") {
|
|
66
|
+
return spaceBelow >= spaceAbove ? "bottom" : "top";
|
|
67
|
+
}
|
|
68
|
+
if (requested === "bottom") return spaceBelow >= spaceAbove ? "bottom" : "top";
|
|
69
|
+
if (requested === "top") return spaceAbove >= spaceBelow ? "top" : "bottom";
|
|
70
|
+
if (requested === "right") return spaceRight >= spaceLeft ? "right" : "left";
|
|
71
|
+
if (requested === "left") return spaceLeft >= spaceRight ? "left" : "right";
|
|
72
|
+
return "bottom";
|
|
73
|
+
}
|
|
74
|
+
function resolveAlign(rect, viewportWidth, viewportHeight, direction, requested) {
|
|
75
|
+
const isVertical = direction === "top" || direction === "bottom";
|
|
76
|
+
if (isVertical) {
|
|
77
|
+
const preferLeft = requested !== "right";
|
|
78
|
+
const spaceRight = viewportWidth - rect.left;
|
|
79
|
+
const spaceLeft = rect.right;
|
|
80
|
+
if (preferLeft) {
|
|
81
|
+
return spaceRight > 80 ? "left" : "right";
|
|
82
|
+
} else {
|
|
83
|
+
return spaceLeft > 80 ? "right" : "left";
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
const preferTop = requested !== "bottom";
|
|
87
|
+
const spaceBelow = viewportHeight - rect.top;
|
|
88
|
+
const spaceAbove = rect.bottom;
|
|
89
|
+
if (preferTop) {
|
|
90
|
+
return spaceBelow > 80 ? "top" : "bottom";
|
|
91
|
+
} else {
|
|
92
|
+
return spaceAbove > 80 ? "bottom" : "top";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
46
96
|
const updatePosition = () => {
|
|
47
97
|
try {
|
|
48
98
|
if (props.anchorEl) {
|
|
49
99
|
const el = props.anchorEl.$el || props.anchorEl;
|
|
50
100
|
if (el && typeof el.getBoundingClientRect === "function") {
|
|
51
101
|
const rect = el.getBoundingClientRect();
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
102
|
+
const viewportWidth = document.documentElement.clientWidth;
|
|
103
|
+
const viewportHeight = document.documentElement.clientHeight;
|
|
104
|
+
const resolvedDir = resolveDirection(
|
|
105
|
+
rect,
|
|
106
|
+
viewportWidth,
|
|
107
|
+
viewportHeight,
|
|
108
|
+
props.direction ?? "auto"
|
|
109
|
+
);
|
|
110
|
+
const resolvedAl = resolveAlign(
|
|
111
|
+
rect,
|
|
112
|
+
viewportWidth,
|
|
113
|
+
viewportHeight,
|
|
114
|
+
resolvedDir,
|
|
115
|
+
props.align ?? "left"
|
|
116
|
+
);
|
|
117
|
+
const spaceBelow = viewportHeight - rect.bottom;
|
|
118
|
+
const spaceAbove = rect.top;
|
|
119
|
+
const rawSpace = resolvedDir === "top" ? spaceAbove : spaceBelow;
|
|
120
|
+
const maxHeight = Math.min(300, rawSpace - 8);
|
|
121
|
+
dropdownRect.value = {
|
|
122
|
+
top: rect.bottom,
|
|
123
|
+
left: rect.left,
|
|
124
|
+
right: viewportWidth - rect.right,
|
|
125
|
+
bottom: viewportHeight - rect.top,
|
|
126
|
+
width: rect.width,
|
|
127
|
+
height: rect.height,
|
|
128
|
+
maxHeight,
|
|
129
|
+
resolvedDirection: resolvedDir,
|
|
130
|
+
resolvedAlign: resolvedAl
|
|
131
|
+
};
|
|
70
132
|
}
|
|
71
133
|
}
|
|
72
134
|
} catch (e) {
|
|
73
135
|
console.error("[KDropdown] Failed to update position", e);
|
|
74
136
|
}
|
|
75
137
|
};
|
|
76
|
-
const
|
|
138
|
+
const repositionOnScroll = () => {
|
|
77
139
|
if (open.value) {
|
|
78
140
|
updatePosition();
|
|
79
141
|
}
|
|
@@ -101,12 +163,10 @@ export function useKDropdownLogic(props, emit) {
|
|
|
101
163
|
}
|
|
102
164
|
);
|
|
103
165
|
onMounted(() => {
|
|
104
|
-
window.addEventListener("scroll",
|
|
105
|
-
window.addEventListener("resize", onScrollResize);
|
|
166
|
+
window.addEventListener("scroll", repositionOnScroll, true);
|
|
106
167
|
});
|
|
107
168
|
onUnmounted(() => {
|
|
108
|
-
window.removeEventListener("scroll",
|
|
109
|
-
window.removeEventListener("resize", onScrollResize);
|
|
169
|
+
window.removeEventListener("scroll", repositionOnScroll, true);
|
|
110
170
|
});
|
|
111
171
|
return {
|
|
112
172
|
open,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type KGridProps } from './KGrid.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<KGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KGridProps> & Readonly<{}>, {
|
|
3
3
|
align: "start" | "center" | "end" | "stretch" | "baseline";
|
|
4
|
-
wrap: "wrap" | "nowrap";
|
|
5
4
|
direction: "row" | "column";
|
|
5
|
+
wrap: "wrap" | "nowrap";
|
|
6
6
|
flexChild: boolean;
|
|
7
7
|
justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
|
|
8
8
|
noGap: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type KGridProps } from './KGrid.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<KGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KGridProps> & Readonly<{}>, {
|
|
3
3
|
align: "start" | "center" | "end" | "stretch" | "baseline";
|
|
4
|
-
wrap: "wrap" | "nowrap";
|
|
5
4
|
direction: "row" | "column";
|
|
5
|
+
wrap: "wrap" | "nowrap";
|
|
6
6
|
flexChild: boolean;
|
|
7
7
|
justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
|
|
8
8
|
noGap: boolean;
|
|
@@ -34,8 +34,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
34
34
|
};
|
|
35
35
|
}>> & Readonly<{}>, {
|
|
36
36
|
width: string | number;
|
|
37
|
-
rotate: string | number;
|
|
38
37
|
height: string | number;
|
|
38
|
+
rotate: string | number;
|
|
39
39
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
40
|
declare const _default: typeof __VLS_export;
|
|
41
41
|
export default _default;
|
|
@@ -34,8 +34,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
34
34
|
};
|
|
35
35
|
}>> & Readonly<{}>, {
|
|
36
36
|
width: string | number;
|
|
37
|
-
rotate: string | number;
|
|
38
37
|
height: string | number;
|
|
38
|
+
rotate: string | number;
|
|
39
39
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
40
40
|
declare const _default: typeof __VLS_export;
|
|
41
41
|
export default _default;
|
|
@@ -6,12 +6,18 @@ type __VLS_Props = {
|
|
|
6
6
|
top: number;
|
|
7
7
|
left: number;
|
|
8
8
|
right: number;
|
|
9
|
+
bottom: number;
|
|
9
10
|
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
maxHeight: number;
|
|
13
|
+
resolvedDirection: 'top' | 'bottom' | 'left' | 'right';
|
|
14
|
+
resolvedAlign: 'left' | 'right' | 'top' | 'bottom';
|
|
10
15
|
};
|
|
11
16
|
clickoutside: () => void;
|
|
12
17
|
teleportTarget: string | null;
|
|
13
18
|
isInModal: boolean;
|
|
14
|
-
align?:
|
|
19
|
+
align?: string;
|
|
20
|
+
direction?: string;
|
|
15
21
|
};
|
|
16
22
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
23
|
declare const _default: typeof __VLS_export;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Teleport(v-if="isMounted && open && teleportTarget" :to="teleportTarget")
|
|
4
4
|
.KDropdown-teleported
|
|
5
5
|
.KDropdown(v-click-outside="{ handler: clickoutside, extraInside: anchorEl }" :style="dialogStyle" v-bind="$attrs")
|
|
6
|
-
KPanel.KDropdown-container(:class="{'fullWidth': fullWidth}")
|
|
6
|
+
KPanel.KDropdown-container(:class="{'fullWidth': fullWidth}" :style="contentStyle")
|
|
7
7
|
slot
|
|
8
8
|
</template>
|
|
9
9
|
|
|
@@ -18,11 +18,22 @@ const props = defineProps<{
|
|
|
18
18
|
open: boolean
|
|
19
19
|
fullWidth: boolean
|
|
20
20
|
anchorEl?: HTMLElement
|
|
21
|
-
dropdownRect: {
|
|
21
|
+
dropdownRect: {
|
|
22
|
+
top: number
|
|
23
|
+
left: number
|
|
24
|
+
right: number
|
|
25
|
+
bottom: number
|
|
26
|
+
width: number
|
|
27
|
+
height: number
|
|
28
|
+
maxHeight: number
|
|
29
|
+
resolvedDirection: 'top' | 'bottom' | 'left' | 'right'
|
|
30
|
+
resolvedAlign: 'left' | 'right' | 'top' | 'bottom'
|
|
31
|
+
}
|
|
22
32
|
clickoutside: () => void
|
|
23
33
|
teleportTarget: string | null
|
|
24
34
|
isInModal: boolean
|
|
25
|
-
align?:
|
|
35
|
+
align?: string
|
|
36
|
+
direction?: string
|
|
26
37
|
}>()
|
|
27
38
|
|
|
28
39
|
const isMounted = ref(false)
|
|
@@ -31,22 +42,52 @@ onMounted(() => {
|
|
|
31
42
|
})
|
|
32
43
|
|
|
33
44
|
const dialogStyle = computed(() => {
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
const { top, left, right, bottom, width, resolvedDirection, resolvedAlign } = props.dropdownRect
|
|
46
|
+
const style: Record<string, string> = {
|
|
47
|
+
position: 'fixed',
|
|
48
|
+
zIndex: '2000',
|
|
49
|
+
width: 'fit-content',
|
|
50
|
+
minWidth: props.fullWidth ? `${width}px` : 'auto',
|
|
40
51
|
}
|
|
41
52
|
|
|
42
|
-
if (
|
|
43
|
-
style.
|
|
44
|
-
|
|
45
|
-
|
|
53
|
+
if (resolvedDirection === 'bottom') {
|
|
54
|
+
style.top = `${top}px`
|
|
55
|
+
if (resolvedAlign === 'right') {
|
|
56
|
+
style.right = `${right}px`
|
|
57
|
+
} else {
|
|
58
|
+
style.left = `${left}px`
|
|
59
|
+
}
|
|
60
|
+
} else if (resolvedDirection === 'top') {
|
|
61
|
+
style.bottom = `${bottom}px`
|
|
62
|
+
if (resolvedAlign === 'right') {
|
|
63
|
+
style.right = `${right}px`
|
|
64
|
+
} else {
|
|
65
|
+
style.left = `${left}px`
|
|
66
|
+
}
|
|
67
|
+
} else if (resolvedDirection === 'right') {
|
|
68
|
+
style.left = `${left + width}px`
|
|
69
|
+
if (resolvedAlign === 'bottom') {
|
|
70
|
+
style.bottom = `${bottom}px`
|
|
71
|
+
} else {
|
|
72
|
+
style.top = `${top - props.dropdownRect.height}px`
|
|
73
|
+
}
|
|
74
|
+
} else if (resolvedDirection === 'left') {
|
|
75
|
+
style.right = `${right + width}px`
|
|
76
|
+
if (resolvedAlign === 'bottom') {
|
|
77
|
+
style.bottom = `${bottom}px`
|
|
78
|
+
} else {
|
|
79
|
+
style.top = `${top - props.dropdownRect.height}px`
|
|
80
|
+
}
|
|
46
81
|
}
|
|
47
82
|
|
|
48
83
|
return style
|
|
49
84
|
})
|
|
85
|
+
|
|
86
|
+
// Applied to the KPanel content so the dropdown list can scroll inside
|
|
87
|
+
const contentStyle = computed(() => ({
|
|
88
|
+
maxHeight: `${props.dropdownRect.maxHeight}px`,
|
|
89
|
+
overflowY: 'auto',
|
|
90
|
+
}))
|
|
50
91
|
</script>
|
|
51
92
|
|
|
52
93
|
<style lang="scss" scoped>
|
|
@@ -55,9 +96,11 @@ const dialogStyle = computed(() => {
|
|
|
55
96
|
width: auto !important;
|
|
56
97
|
max-width: 100vw;
|
|
57
98
|
box-shadow: var(--shadow-xl);
|
|
99
|
+
overflow: hidden;
|
|
58
100
|
:deep {
|
|
59
101
|
.KPanel--content {
|
|
60
102
|
padding: var(--component-gap);
|
|
103
|
+
overflow-y: auto;
|
|
61
104
|
}
|
|
62
105
|
}
|
|
63
106
|
}
|
|
@@ -6,12 +6,18 @@ type __VLS_Props = {
|
|
|
6
6
|
top: number;
|
|
7
7
|
left: number;
|
|
8
8
|
right: number;
|
|
9
|
+
bottom: number;
|
|
9
10
|
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
maxHeight: number;
|
|
13
|
+
resolvedDirection: 'top' | 'bottom' | 'left' | 'right';
|
|
14
|
+
resolvedAlign: 'left' | 'right' | 'top' | 'bottom';
|
|
10
15
|
};
|
|
11
16
|
clickoutside: () => void;
|
|
12
17
|
teleportTarget: string | null;
|
|
13
18
|
isInModal: boolean;
|
|
14
|
-
align?:
|
|
19
|
+
align?: string;
|
|
20
|
+
direction?: string;
|
|
15
21
|
};
|
|
16
22
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
17
23
|
declare const _default: typeof __VLS_export;
|