@katlux/toolkit 0.1.0-beta.77 → 0.1.0-beta.79
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/KContextMenu/KContextMenu.global.d.vue.ts +53 -1
- package/dist/runtime/components/KContextMenu/KContextMenu.global.vue +20 -1
- package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +53 -1
- package/dist/runtime/components/KContextMenu/KContextMenu.logic.d.ts +53 -2
- package/dist/runtime/components/KContextMenu/KContextMenu.logic.js +167 -3
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
- 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/KPanel/KPanel.global.d.vue.ts +1 -1
- package/dist/runtime/components/KPanel/KPanel.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +31 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.vue +20 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +31 -1
- package/dist/runtime/components/KTooltip/KTooltip.logic.d.ts +25 -2
- package/dist/runtime/components/KTooltip/KTooltip.logic.js +81 -3
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.d.vue.ts +20 -1
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +60 -3
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue.d.ts +20 -1
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.d.vue.ts +2 -2
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue.d.ts +2 -2
- package/dist/runtime/presets/default/components/KIcon/KIcon.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KIcon/KIcon.vue +1 -1
- package/dist/runtime/presets/default/components/KIcon/KIcon.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KTabs/KTabItem.vue +1 -1
- package/dist/runtime/presets/default/components/KTooltip/KTooltip.d.vue.ts +14 -1
- package/dist/runtime/presets/default/components/KTooltip/KTooltip.vue +70 -3
- package/dist/runtime/presets/default/components/KTooltip/KTooltip.vue.d.ts +14 -1
- package/dist/runtime/presets/default/components/MultiTabs/MultiTabs.vue +7 -1
- package/package.json +1 -1
package/dist/module.json
CHANGED
|
@@ -1,3 +1,55 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
isOpen: {
|
|
3
|
+
type: BooleanConstructor;
|
|
4
|
+
default: boolean;
|
|
5
|
+
};
|
|
6
|
+
x: {
|
|
7
|
+
type: NumberConstructor;
|
|
8
|
+
default: undefined;
|
|
9
|
+
};
|
|
10
|
+
y: {
|
|
11
|
+
type: NumberConstructor;
|
|
12
|
+
default: undefined;
|
|
13
|
+
};
|
|
14
|
+
teleportTo: {
|
|
15
|
+
type: import("vue").PropType<string>;
|
|
16
|
+
default: undefined;
|
|
17
|
+
};
|
|
18
|
+
target: {
|
|
19
|
+
type: import("vue").PropType<string | HTMLElement>;
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
23
|
+
"update:isOpen": (value: boolean) => any;
|
|
24
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
|
+
isOpen: {
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
default: boolean;
|
|
28
|
+
};
|
|
29
|
+
x: {
|
|
30
|
+
type: NumberConstructor;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
33
|
+
y: {
|
|
34
|
+
type: NumberConstructor;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
teleportTo: {
|
|
38
|
+
type: import("vue").PropType<string>;
|
|
39
|
+
default: undefined;
|
|
40
|
+
};
|
|
41
|
+
target: {
|
|
42
|
+
type: import("vue").PropType<string | HTMLElement>;
|
|
43
|
+
default: undefined;
|
|
44
|
+
};
|
|
45
|
+
}>> & Readonly<{
|
|
46
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
47
|
+
}>, {
|
|
48
|
+
x: number;
|
|
49
|
+
isOpen: boolean;
|
|
50
|
+
teleportTo: string;
|
|
51
|
+
y: number;
|
|
52
|
+
target: string | HTMLElement;
|
|
53
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
54
|
declare const _default: typeof __VLS_export;
|
|
3
55
|
export default _default;
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useKContextMenuLogic, KContextMenuDefaultProps } from "./KContextMenu.logic";
|
|
2
3
|
import { usePresetComponent } from "../../composables/usePresetComponent";
|
|
4
|
+
import { computed, watch } from "vue";
|
|
3
5
|
import KContextMenuDefault from "../../presets/default/components/KContextMenu/KContextMenu.vue";
|
|
6
|
+
const props = defineProps(KContextMenuDefaultProps);
|
|
7
|
+
const emit = defineEmits(["update:isOpen"]);
|
|
8
|
+
const { open, sourceRef, menuRef, menuRect, clickoutside, teleportTarget, isInModal, updatePosition } = useKContextMenuLogic(props, emit);
|
|
4
9
|
const presetComponent = usePresetComponent("KContextMenu", KContextMenuDefault);
|
|
10
|
+
watch(presetComponent, () => {
|
|
11
|
+
if (open.value) {
|
|
12
|
+
updatePosition();
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const templateProps = computed(() => ({
|
|
16
|
+
open: open.value,
|
|
17
|
+
menuRect: menuRect.value,
|
|
18
|
+
clickoutside,
|
|
19
|
+
teleportTarget: teleportTarget.value,
|
|
20
|
+
isInModal: isInModal.value
|
|
21
|
+
}));
|
|
5
22
|
</script>
|
|
6
23
|
|
|
7
24
|
<template lang="pug">
|
|
8
|
-
component(:is="presetComponent")
|
|
25
|
+
component(:is="presetComponent" v-bind="{ ...templateProps, ...$attrs }" @update:isOpen="emit('update:isOpen', $event)" @registerRef="el => menuRef = el" @registerSourceRef="el => sourceRef = el")
|
|
26
|
+
template(v-for="(_, slot) in $slots" #[slot]="scope")
|
|
27
|
+
slot(:name="slot" v-bind="scope")
|
|
9
28
|
</template>
|
|
@@ -1,3 +1,55 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
isOpen: {
|
|
3
|
+
type: BooleanConstructor;
|
|
4
|
+
default: boolean;
|
|
5
|
+
};
|
|
6
|
+
x: {
|
|
7
|
+
type: NumberConstructor;
|
|
8
|
+
default: undefined;
|
|
9
|
+
};
|
|
10
|
+
y: {
|
|
11
|
+
type: NumberConstructor;
|
|
12
|
+
default: undefined;
|
|
13
|
+
};
|
|
14
|
+
teleportTo: {
|
|
15
|
+
type: import("vue").PropType<string>;
|
|
16
|
+
default: undefined;
|
|
17
|
+
};
|
|
18
|
+
target: {
|
|
19
|
+
type: import("vue").PropType<string | HTMLElement>;
|
|
20
|
+
default: undefined;
|
|
21
|
+
};
|
|
22
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
23
|
+
"update:isOpen": (value: boolean) => any;
|
|
24
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
25
|
+
isOpen: {
|
|
26
|
+
type: BooleanConstructor;
|
|
27
|
+
default: boolean;
|
|
28
|
+
};
|
|
29
|
+
x: {
|
|
30
|
+
type: NumberConstructor;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
33
|
+
y: {
|
|
34
|
+
type: NumberConstructor;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
teleportTo: {
|
|
38
|
+
type: import("vue").PropType<string>;
|
|
39
|
+
default: undefined;
|
|
40
|
+
};
|
|
41
|
+
target: {
|
|
42
|
+
type: import("vue").PropType<string | HTMLElement>;
|
|
43
|
+
default: undefined;
|
|
44
|
+
};
|
|
45
|
+
}>> & Readonly<{
|
|
46
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
47
|
+
}>, {
|
|
48
|
+
x: number;
|
|
49
|
+
isOpen: boolean;
|
|
50
|
+
teleportTo: string;
|
|
51
|
+
y: number;
|
|
52
|
+
target: string | HTMLElement;
|
|
53
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
54
|
declare const _default: typeof __VLS_export;
|
|
3
55
|
export default _default;
|
|
@@ -1,4 +1,55 @@
|
|
|
1
|
+
import { type PropType, type Ref } from 'vue';
|
|
1
2
|
export interface KContextMenuProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
x?: number;
|
|
5
|
+
y?: number;
|
|
6
|
+
teleportTo?: string;
|
|
7
|
+
target?: string | HTMLElement;
|
|
2
8
|
}
|
|
3
|
-
export
|
|
4
|
-
|
|
9
|
+
export interface KContextMenuEmits {
|
|
10
|
+
(e: 'update:isOpen', value: boolean): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const KContextMenuDefaultProps: {
|
|
13
|
+
isOpen: {
|
|
14
|
+
type: BooleanConstructor;
|
|
15
|
+
default: boolean;
|
|
16
|
+
};
|
|
17
|
+
x: {
|
|
18
|
+
type: NumberConstructor;
|
|
19
|
+
default: undefined;
|
|
20
|
+
};
|
|
21
|
+
y: {
|
|
22
|
+
type: NumberConstructor;
|
|
23
|
+
default: undefined;
|
|
24
|
+
};
|
|
25
|
+
teleportTo: {
|
|
26
|
+
type: PropType<string>;
|
|
27
|
+
default: undefined;
|
|
28
|
+
};
|
|
29
|
+
target: {
|
|
30
|
+
type: PropType<string | HTMLElement>;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function useKContextMenuLogic(props: KContextMenuProps, emit: KContextMenuEmits): {
|
|
35
|
+
open: Ref<boolean, boolean>;
|
|
36
|
+
sourceRef: Ref<HTMLElement | null, HTMLElement | null>;
|
|
37
|
+
menuRef: Ref<HTMLElement | null, HTMLElement | null>;
|
|
38
|
+
menuRect: Ref<{
|
|
39
|
+
top: number;
|
|
40
|
+
left: number;
|
|
41
|
+
maxHeight: number;
|
|
42
|
+
}, {
|
|
43
|
+
top: number;
|
|
44
|
+
left: number;
|
|
45
|
+
maxHeight: number;
|
|
46
|
+
} | {
|
|
47
|
+
top: number;
|
|
48
|
+
left: number;
|
|
49
|
+
maxHeight: number;
|
|
50
|
+
}>;
|
|
51
|
+
clickoutside: () => void;
|
|
52
|
+
teleportTarget: import("vue").ComputedRef<string>;
|
|
53
|
+
isInModal: import("vue").ComputedRef<boolean>;
|
|
54
|
+
updatePosition: () => void;
|
|
55
|
+
};
|
|
@@ -1,4 +1,168 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ref, watch, onMounted, onUnmounted, nextTick, inject, computed } from "vue";
|
|
2
|
+
import { KMODAL_PORTAL_ID_KEY } from "../KModal/KModal.logic.js";
|
|
3
|
+
export const KContextMenuDefaultProps = {
|
|
4
|
+
isOpen: {
|
|
5
|
+
type: Boolean,
|
|
6
|
+
default: false
|
|
7
|
+
},
|
|
8
|
+
x: {
|
|
9
|
+
type: Number,
|
|
10
|
+
default: void 0
|
|
11
|
+
},
|
|
12
|
+
y: {
|
|
13
|
+
type: Number,
|
|
14
|
+
default: void 0
|
|
15
|
+
},
|
|
16
|
+
teleportTo: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: void 0
|
|
19
|
+
},
|
|
20
|
+
target: {
|
|
21
|
+
type: [String, Object],
|
|
22
|
+
default: void 0
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export function useKContextMenuLogic(props, emit) {
|
|
26
|
+
const modalPortalId = inject(KMODAL_PORTAL_ID_KEY, null);
|
|
27
|
+
const isInModal = computed(() => !!modalPortalId?.value);
|
|
28
|
+
const teleportTarget = computed(() => {
|
|
29
|
+
if (props.teleportTo) return props.teleportTo;
|
|
30
|
+
if (isInModal.value && modalPortalId?.value) {
|
|
31
|
+
const targetId = `#${modalPortalId.value}`;
|
|
32
|
+
if (typeof document !== "undefined" && !document.querySelector(targetId)) {
|
|
33
|
+
const activePortal = document.querySelector(".modal-portal");
|
|
34
|
+
if (activePortal && activePortal.id) return `#${activePortal.id}`;
|
|
35
|
+
}
|
|
36
|
+
return targetId;
|
|
37
|
+
}
|
|
38
|
+
return "body";
|
|
39
|
+
});
|
|
40
|
+
const open = ref(false);
|
|
41
|
+
const sourceRef = ref(null);
|
|
42
|
+
const menuRef = ref(null);
|
|
43
|
+
const localX = ref(0);
|
|
44
|
+
const localY = ref(0);
|
|
45
|
+
const menuRect = ref({
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
maxHeight: 500
|
|
49
|
+
});
|
|
50
|
+
const clickoutside = () => {
|
|
51
|
+
open.value = false;
|
|
52
|
+
emit("update:isOpen", open.value);
|
|
53
|
+
};
|
|
54
|
+
const updatePosition = () => {
|
|
55
|
+
if (typeof document === "undefined") return;
|
|
56
|
+
try {
|
|
57
|
+
const viewportWidth = document.documentElement.clientWidth;
|
|
58
|
+
const viewportHeight = document.documentElement.clientHeight;
|
|
59
|
+
let left = props.x !== void 0 ? props.x : localX.value;
|
|
60
|
+
let top = props.y !== void 0 ? props.y : localY.value;
|
|
61
|
+
if (menuRef.value) {
|
|
62
|
+
const rect = menuRef.value.getBoundingClientRect();
|
|
63
|
+
if (left + rect.width > viewportWidth) left = viewportWidth - rect.width - 8;
|
|
64
|
+
if (top + rect.height > viewportHeight) top = viewportHeight - rect.height - 8;
|
|
65
|
+
left = Math.max(8, left);
|
|
66
|
+
top = Math.max(8, top);
|
|
67
|
+
}
|
|
68
|
+
menuRect.value = {
|
|
69
|
+
top,
|
|
70
|
+
left,
|
|
71
|
+
maxHeight: Math.min(viewportHeight - 16, 500)
|
|
72
|
+
};
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.error("[KContextMenu] Failed to update position", e);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
const repositionOnScroll = () => {
|
|
78
|
+
if (open.value) {
|
|
79
|
+
clickoutside();
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const onContextMenu = (event) => {
|
|
83
|
+
event.preventDefault();
|
|
84
|
+
event.stopPropagation();
|
|
85
|
+
localX.value = event.clientX;
|
|
86
|
+
localY.value = event.clientY;
|
|
87
|
+
open.value = true;
|
|
88
|
+
emit("update:isOpen", true);
|
|
89
|
+
nextTick(() => {
|
|
90
|
+
updatePosition();
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
let boundElement = null;
|
|
94
|
+
const setupTriggerListener = () => {
|
|
95
|
+
if (typeof document === "undefined") return;
|
|
96
|
+
if (boundElement) {
|
|
97
|
+
boundElement.removeEventListener("contextmenu", onContextMenu);
|
|
98
|
+
boundElement = null;
|
|
99
|
+
}
|
|
100
|
+
if (props.x !== void 0 || props.y !== void 0) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (props.target) {
|
|
104
|
+
if (typeof props.target === "string") {
|
|
105
|
+
boundElement = document.querySelector(props.target);
|
|
106
|
+
} else {
|
|
107
|
+
boundElement = props.target;
|
|
108
|
+
}
|
|
109
|
+
} else if (sourceRef.value) {
|
|
110
|
+
boundElement = sourceRef.value.parentElement;
|
|
111
|
+
}
|
|
112
|
+
if (boundElement) {
|
|
113
|
+
boundElement.addEventListener("contextmenu", onContextMenu);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
watch(() => [props.target, sourceRef.value, props.x, props.y], () => {
|
|
117
|
+
setupTriggerListener();
|
|
118
|
+
});
|
|
119
|
+
watch(
|
|
120
|
+
() => props.isOpen,
|
|
121
|
+
(newValue) => {
|
|
122
|
+
if (newValue) {
|
|
123
|
+
updatePosition();
|
|
124
|
+
nextTick(() => {
|
|
125
|
+
open.value = true;
|
|
126
|
+
nextTick(() => {
|
|
127
|
+
updatePosition();
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
} else {
|
|
131
|
+
open.value = false;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
{ immediate: true }
|
|
135
|
+
);
|
|
136
|
+
watch(
|
|
137
|
+
() => [props.x, props.y],
|
|
138
|
+
() => {
|
|
139
|
+
if (open.value) {
|
|
140
|
+
updatePosition();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
);
|
|
144
|
+
onMounted(() => {
|
|
145
|
+
if (typeof window !== "undefined") {
|
|
146
|
+
window.addEventListener("scroll", repositionOnScroll, true);
|
|
147
|
+
}
|
|
148
|
+
setupTriggerListener();
|
|
149
|
+
});
|
|
150
|
+
onUnmounted(() => {
|
|
151
|
+
if (typeof window !== "undefined") {
|
|
152
|
+
window.removeEventListener("scroll", repositionOnScroll, true);
|
|
153
|
+
}
|
|
154
|
+
if (boundElement) {
|
|
155
|
+
boundElement.removeEventListener("contextmenu", onContextMenu);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
return {
|
|
159
|
+
open,
|
|
160
|
+
sourceRef,
|
|
161
|
+
menuRef,
|
|
162
|
+
menuRect,
|
|
163
|
+
clickoutside,
|
|
164
|
+
teleportTarget,
|
|
165
|
+
isInModal,
|
|
166
|
+
updatePosition
|
|
167
|
+
};
|
|
4
168
|
}
|
|
@@ -55,10 +55,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
55
55
|
};
|
|
56
56
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
57
57
|
"update:modelValue": (value: string | Date) => any;
|
|
58
|
+
"update:isOpen": (value: boolean) => any;
|
|
58
59
|
"update:maskedModel": (value: string) => any;
|
|
59
60
|
"update:calendarShow": (value: boolean) => any;
|
|
60
61
|
"update:day": (value: string | Date) => any;
|
|
61
|
-
"update:isOpen": (value: boolean) => any;
|
|
62
62
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
63
|
label: {
|
|
64
64
|
type: StringConstructor;
|
|
@@ -115,10 +115,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
115
115
|
};
|
|
116
116
|
}>> & Readonly<{
|
|
117
117
|
"onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
|
|
118
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
118
119
|
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
119
120
|
"onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
|
|
120
121
|
"onUpdate:day"?: ((value: string | Date) => any) | undefined;
|
|
121
|
-
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
122
122
|
}>, {
|
|
123
123
|
label: string;
|
|
124
124
|
isOpen: boolean;
|
|
@@ -55,10 +55,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
55
55
|
};
|
|
56
56
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
57
57
|
"update:modelValue": (value: string | Date) => any;
|
|
58
|
+
"update:isOpen": (value: boolean) => any;
|
|
58
59
|
"update:maskedModel": (value: string) => any;
|
|
59
60
|
"update:calendarShow": (value: boolean) => any;
|
|
60
61
|
"update:day": (value: string | Date) => any;
|
|
61
|
-
"update:isOpen": (value: boolean) => any;
|
|
62
62
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
63
63
|
label: {
|
|
64
64
|
type: StringConstructor;
|
|
@@ -115,10 +115,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
115
115
|
};
|
|
116
116
|
}>> & Readonly<{
|
|
117
117
|
"onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
|
|
118
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
118
119
|
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
119
120
|
"onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
|
|
120
121
|
"onUpdate:day"?: ((value: string | Date) => any) | undefined;
|
|
121
|
-
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
122
122
|
}>, {
|
|
123
123
|
label: string;
|
|
124
124
|
isOpen: boolean;
|
|
@@ -59,9 +59,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
59
59
|
};
|
|
60
60
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
61
61
|
"update:modelValue": (value: string | Date) => any;
|
|
62
|
+
"update:isOpen": (value: boolean) => any;
|
|
62
63
|
"update:maskedModel": (value: string) => any;
|
|
63
64
|
"update:calendarShow": (value: boolean) => any;
|
|
64
|
-
"update:isOpen": (value: boolean) => any;
|
|
65
65
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
66
66
|
label: {
|
|
67
67
|
type: StringConstructor;
|
|
@@ -122,9 +122,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
122
122
|
};
|
|
123
123
|
}>> & Readonly<{
|
|
124
124
|
"onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
|
|
125
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
125
126
|
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
126
127
|
"onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
|
|
127
|
-
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
128
128
|
}>, {
|
|
129
129
|
label: string;
|
|
130
130
|
isOpen: boolean;
|
|
@@ -59,9 +59,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
59
59
|
};
|
|
60
60
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
61
61
|
"update:modelValue": (value: string | Date) => any;
|
|
62
|
+
"update:isOpen": (value: boolean) => any;
|
|
62
63
|
"update:maskedModel": (value: string) => any;
|
|
63
64
|
"update:calendarShow": (value: boolean) => any;
|
|
64
|
-
"update:isOpen": (value: boolean) => any;
|
|
65
65
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
66
66
|
label: {
|
|
67
67
|
type: StringConstructor;
|
|
@@ -122,9 +122,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
122
122
|
};
|
|
123
123
|
}>> & Readonly<{
|
|
124
124
|
"onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
|
|
125
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
125
126
|
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
126
127
|
"onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
|
|
127
|
-
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
128
128
|
}>, {
|
|
129
129
|
label: string;
|
|
130
130
|
isOpen: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
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
|
+
noGap: boolean;
|
|
3
4
|
align: "start" | "center" | "end" | "stretch" | "baseline";
|
|
4
5
|
direction: "row" | "column";
|
|
5
6
|
wrap: "wrap" | "nowrap";
|
|
6
7
|
flexChild: boolean;
|
|
7
8
|
justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
|
|
8
|
-
noGap: boolean;
|
|
9
9
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
10
|
declare const _default: typeof __VLS_export;
|
|
11
11
|
export default _default;
|
|
@@ -1,11 +1,11 @@
|
|
|
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
|
+
noGap: boolean;
|
|
3
4
|
align: "start" | "center" | "end" | "stretch" | "baseline";
|
|
4
5
|
direction: "row" | "column";
|
|
5
6
|
wrap: "wrap" | "nowrap";
|
|
6
7
|
flexChild: boolean;
|
|
7
8
|
justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
|
|
8
|
-
noGap: boolean;
|
|
9
9
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
10
|
declare const _default: typeof __VLS_export;
|
|
11
11
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type KPanelProps } from './KPanel.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<KPanelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KPanelProps> & Readonly<{}>, {
|
|
3
|
-
type: "default" | "primary" | "danger" | "success" | "warning" | "info";
|
|
4
3
|
title: string;
|
|
4
|
+
type: "default" | "primary" | "danger" | "success" | "warning" | "info";
|
|
5
5
|
noGap: boolean;
|
|
6
6
|
flexContent: boolean;
|
|
7
7
|
scrollable: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type KPanelProps } from './KPanel.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<KPanelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KPanelProps> & Readonly<{}>, {
|
|
3
|
-
type: "default" | "primary" | "danger" | "success" | "warning" | "info";
|
|
4
3
|
title: string;
|
|
4
|
+
type: "default" | "primary" | "danger" | "success" | "warning" | "info";
|
|
5
5
|
noGap: boolean;
|
|
6
6
|
flexContent: boolean;
|
|
7
7
|
scrollable: boolean;
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
text: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
position: {
|
|
7
|
+
type: import("vue").PropType<"top" | "bottom" | "left" | "right">;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
disabled: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
text: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
position: {
|
|
20
|
+
type: import("vue").PropType<"top" | "bottom" | "left" | "right">;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
disabled: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
}>> & Readonly<{}>, {
|
|
28
|
+
text: string;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
position: "left" | "right" | "top" | "bottom";
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
32
|
declare const _default: typeof __VLS_export;
|
|
3
33
|
export default _default;
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
<script setup>
|
|
2
|
+
import { useKTooltipLogic, KTooltipDefaultProps } from "./KTooltip.logic";
|
|
2
3
|
import { usePresetComponent } from "../../composables/usePresetComponent";
|
|
4
|
+
import { computed } from "vue";
|
|
3
5
|
import KTooltipDefault from "../../presets/default/components/KTooltip/KTooltip.vue";
|
|
6
|
+
const props = defineProps(KTooltipDefaultProps);
|
|
7
|
+
const { visible, wrapperRef, showTooltip, hideTooltip, tooltipStyle } = useKTooltipLogic(props);
|
|
4
8
|
const presetComponent = usePresetComponent("KTooltip", KTooltipDefault);
|
|
9
|
+
const templateProps = computed(() => ({
|
|
10
|
+
visible: visible.value,
|
|
11
|
+
tooltipStyle: tooltipStyle.value,
|
|
12
|
+
showTooltip,
|
|
13
|
+
hideTooltip,
|
|
14
|
+
text: props.text,
|
|
15
|
+
position: props.position,
|
|
16
|
+
disabled: props.disabled
|
|
17
|
+
}));
|
|
5
18
|
</script>
|
|
6
19
|
|
|
7
20
|
<template lang="pug">
|
|
8
|
-
component(
|
|
21
|
+
component(
|
|
22
|
+
:is="presetComponent"
|
|
23
|
+
v-bind="{ ...templateProps, ...$attrs }"
|
|
24
|
+
@registerWrapperRef="el => wrapperRef = el"
|
|
25
|
+
)
|
|
26
|
+
template(v-for="(_, slot) in $slots" #[slot]="scope")
|
|
27
|
+
slot(:name="slot" v-bind="scope")
|
|
9
28
|
</template>
|
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
text: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
position: {
|
|
7
|
+
type: import("vue").PropType<"top" | "bottom" | "left" | "right">;
|
|
8
|
+
default: string;
|
|
9
|
+
};
|
|
10
|
+
disabled: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
15
|
+
text: {
|
|
16
|
+
type: StringConstructor;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
position: {
|
|
20
|
+
type: import("vue").PropType<"top" | "bottom" | "left" | "right">;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
disabled: {
|
|
24
|
+
type: BooleanConstructor;
|
|
25
|
+
default: boolean;
|
|
26
|
+
};
|
|
27
|
+
}>> & Readonly<{}>, {
|
|
28
|
+
text: string;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
position: "left" | "right" | "top" | "bottom";
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
32
|
declare const _default: typeof __VLS_export;
|
|
3
33
|
export default _default;
|
|
@@ -1,4 +1,27 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
1
2
|
export interface KTooltipProps {
|
|
3
|
+
text: string;
|
|
4
|
+
position: 'top' | 'bottom' | 'left' | 'right';
|
|
5
|
+
disabled: boolean;
|
|
2
6
|
}
|
|
3
|
-
export declare const KTooltipDefaultProps: {
|
|
4
|
-
|
|
7
|
+
export declare const KTooltipDefaultProps: {
|
|
8
|
+
text: {
|
|
9
|
+
type: StringConstructor;
|
|
10
|
+
default: string;
|
|
11
|
+
};
|
|
12
|
+
position: {
|
|
13
|
+
type: PropType<"top" | "bottom" | "left" | "right">;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
disabled: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare function useKTooltipLogic(props: KTooltipProps): {
|
|
22
|
+
visible: import("vue").Ref<boolean, boolean>;
|
|
23
|
+
wrapperRef: import("vue").Ref<HTMLElement | null, HTMLElement | null>;
|
|
24
|
+
showTooltip: () => void;
|
|
25
|
+
hideTooltip: () => void;
|
|
26
|
+
tooltipStyle: import("vue").ComputedRef<Record<string, string>>;
|
|
27
|
+
};
|
|
@@ -1,4 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
1
|
+
import { ref, computed, onMounted, onUnmounted } from "vue";
|
|
2
|
+
export const KTooltipDefaultProps = {
|
|
3
|
+
text: {
|
|
4
|
+
type: String,
|
|
5
|
+
default: ""
|
|
6
|
+
},
|
|
7
|
+
position: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "top"
|
|
10
|
+
},
|
|
11
|
+
disabled: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export function useKTooltipLogic(props) {
|
|
17
|
+
const visible = ref(false);
|
|
18
|
+
const wrapperRef = ref(null);
|
|
19
|
+
const coords = ref({ top: 0, left: 0 });
|
|
20
|
+
const updateCoords = () => {
|
|
21
|
+
if (!wrapperRef.value) return;
|
|
22
|
+
const rect = wrapperRef.value.getBoundingClientRect();
|
|
23
|
+
if (props.position === "top") {
|
|
24
|
+
coords.value = { top: rect.top, left: rect.left + rect.width / 2 };
|
|
25
|
+
} else if (props.position === "bottom") {
|
|
26
|
+
coords.value = { top: rect.bottom, left: rect.left + rect.width / 2 };
|
|
27
|
+
} else if (props.position === "left") {
|
|
28
|
+
coords.value = { top: rect.top + rect.height / 2, left: rect.left };
|
|
29
|
+
} else if (props.position === "right") {
|
|
30
|
+
coords.value = { top: rect.top + rect.height / 2, left: rect.right };
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const showTooltip = () => {
|
|
34
|
+
if (props.disabled) return;
|
|
35
|
+
updateCoords();
|
|
36
|
+
visible.value = true;
|
|
37
|
+
};
|
|
38
|
+
const hideTooltip = () => {
|
|
39
|
+
visible.value = false;
|
|
40
|
+
};
|
|
41
|
+
const handleScroll = () => {
|
|
42
|
+
if (visible.value) {
|
|
43
|
+
hideTooltip();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
onMounted(() => {
|
|
47
|
+
if (typeof window !== "undefined") {
|
|
48
|
+
window.addEventListener("scroll", handleScroll, true);
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
onUnmounted(() => {
|
|
52
|
+
if (typeof window !== "undefined") {
|
|
53
|
+
window.removeEventListener("scroll", handleScroll, true);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const tooltipStyle = computed(() => {
|
|
57
|
+
const baseStyle = {
|
|
58
|
+
position: "fixed",
|
|
59
|
+
top: `${coords.value.top}px`,
|
|
60
|
+
left: `${coords.value.left}px`,
|
|
61
|
+
zIndex: "3000",
|
|
62
|
+
pointerEvents: "none"
|
|
63
|
+
};
|
|
64
|
+
if (props.position === "top") {
|
|
65
|
+
baseStyle.transform = "translate(-50%, -100%) translateY(-8px)";
|
|
66
|
+
} else if (props.position === "bottom") {
|
|
67
|
+
baseStyle.transform = "translate(-50%, 0) translateY(8px)";
|
|
68
|
+
} else if (props.position === "left") {
|
|
69
|
+
baseStyle.transform = "translate(-100%, -50%) translateX(-8px)";
|
|
70
|
+
} else if (props.position === "right") {
|
|
71
|
+
baseStyle.transform = "translate(0, -50%) translateX(8px)";
|
|
72
|
+
}
|
|
73
|
+
return baseStyle;
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
visible,
|
|
77
|
+
wrapperRef,
|
|
78
|
+
showTooltip,
|
|
79
|
+
hideTooltip,
|
|
80
|
+
tooltipStyle
|
|
81
|
+
};
|
|
4
82
|
}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
open: boolean;
|
|
3
|
+
menuRect: {
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
maxHeight: number;
|
|
7
|
+
};
|
|
8
|
+
clickoutside: () => void;
|
|
9
|
+
teleportTarget: string | null;
|
|
10
|
+
isInModal: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:isOpen": (...args: any[]) => void;
|
|
14
|
+
registerRef: (...args: any[]) => void;
|
|
15
|
+
registerSourceRef: (...args: any[]) => void;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:isOpen"?: ((...args: any[]) => any) | undefined;
|
|
18
|
+
onRegisterRef?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
onRegisterSourceRef?: ((...args: any[]) => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
21
|
declare const _default: typeof __VLS_export;
|
|
3
22
|
export default _default;
|
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.KContextMenu
|
|
3
|
-
|
|
2
|
+
.KContextMenu-source(ref="sourceElementRef")
|
|
3
|
+
Teleport(v-if="open && teleportTarget" :to="teleportTarget")
|
|
4
|
+
.KContextMenu-teleported
|
|
5
|
+
.KContextMenu(
|
|
6
|
+
ref="internalMenuRef"
|
|
7
|
+
v-click-outside="clickoutside"
|
|
8
|
+
:style="{ top: `${menuRect.top}px`, left: `${menuRect.left}px`, position: 'fixed', zIndex: 2000 }"
|
|
9
|
+
v-bind="$attrs"
|
|
10
|
+
)
|
|
11
|
+
KPanel.KContextMenu-container(:style="{ maxHeight: `${menuRect.maxHeight}px`, overflowY: 'auto' }")
|
|
12
|
+
slot(:close="clickoutside")
|
|
4
13
|
</template>
|
|
5
|
-
|
|
14
|
+
|
|
15
|
+
<script lang="ts" setup>
|
|
16
|
+
import { ref, watch } from 'vue'
|
|
17
|
+
import KPanel from '../KPanel/KPanel.vue'
|
|
18
|
+
|
|
19
|
+
defineOptions({
|
|
20
|
+
inheritAttrs: false
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const props = defineProps<{
|
|
24
|
+
open: boolean
|
|
25
|
+
menuRect: { top: number, left: number, maxHeight: number }
|
|
26
|
+
clickoutside: () => void
|
|
27
|
+
teleportTarget: string | null
|
|
28
|
+
isInModal: boolean
|
|
29
|
+
}>()
|
|
30
|
+
|
|
31
|
+
const emit = defineEmits(['update:isOpen', 'registerRef', 'registerSourceRef'])
|
|
32
|
+
|
|
33
|
+
const internalMenuRef = ref<HTMLElement | null>(null)
|
|
34
|
+
const sourceElementRef = ref<HTMLElement | null>(null)
|
|
35
|
+
|
|
36
|
+
watch(internalMenuRef, (newVal) => {
|
|
37
|
+
emit('registerRef', newVal)
|
|
38
|
+
}, { immediate: true })
|
|
39
|
+
|
|
40
|
+
watch(sourceElementRef, (newVal) => {
|
|
41
|
+
emit('registerSourceRef', newVal)
|
|
42
|
+
}, { immediate: true })
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<style lang="scss" scoped>
|
|
46
|
+
.KContextMenu {
|
|
47
|
+
width: fit-content;
|
|
48
|
+
|
|
49
|
+
.KPanel {
|
|
50
|
+
width: auto !important;
|
|
51
|
+
max-width: 100vw;
|
|
52
|
+
box-shadow: var(--shadow-xl);
|
|
53
|
+
overflow: hidden;
|
|
54
|
+
:deep {
|
|
55
|
+
.KPanel--content {
|
|
56
|
+
padding: var(--component-gap);
|
|
57
|
+
overflow-y: auto;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
</style>
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
open: boolean;
|
|
3
|
+
menuRect: {
|
|
4
|
+
top: number;
|
|
5
|
+
left: number;
|
|
6
|
+
maxHeight: number;
|
|
7
|
+
};
|
|
8
|
+
clickoutside: () => void;
|
|
9
|
+
teleportTarget: string | null;
|
|
10
|
+
isInModal: boolean;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:isOpen": (...args: any[]) => void;
|
|
14
|
+
registerRef: (...args: any[]) => void;
|
|
15
|
+
registerSourceRef: (...args: any[]) => void;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
+
"onUpdate:isOpen"?: ((...args: any[]) => any) | undefined;
|
|
18
|
+
onRegisterRef?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
onRegisterSourceRef?: ((...args: any[]) => any) | undefined;
|
|
20
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
21
|
declare const _default: typeof __VLS_export;
|
|
3
22
|
export default _default;
|
|
@@ -17,11 +17,11 @@ type __VLS_Props = {
|
|
|
17
17
|
validationText?: string;
|
|
18
18
|
};
|
|
19
19
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
20
|
-
"update:maskedModel": (value: string) => any;
|
|
21
20
|
"update:isOpen": (value: boolean) => any;
|
|
21
|
+
"update:maskedModel": (value: string) => any;
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
-
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
24
23
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
24
|
+
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
25
25
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
declare const _default: typeof __VLS_export;
|
|
27
27
|
export default _default;
|
|
@@ -17,11 +17,11 @@ type __VLS_Props = {
|
|
|
17
17
|
validationText?: string;
|
|
18
18
|
};
|
|
19
19
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
20
|
-
"update:maskedModel": (value: string) => any;
|
|
21
20
|
"update:isOpen": (value: boolean) => any;
|
|
21
|
+
"update:maskedModel": (value: string) => any;
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
-
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
24
23
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
24
|
+
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
25
25
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
declare const _default: typeof __VLS_export;
|
|
27
27
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
widthPx?: string;
|
|
3
3
|
heightPx?: string;
|
|
4
|
-
iconComponent: string;
|
|
4
|
+
iconComponent: string | null;
|
|
5
5
|
rotate: number | string;
|
|
6
6
|
};
|
|
7
7
|
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>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
2
|
widthPx?: string;
|
|
3
3
|
heightPx?: string;
|
|
4
|
-
iconComponent: string;
|
|
4
|
+
iconComponent: string | null;
|
|
5
5
|
rotate: number | string;
|
|
6
6
|
};
|
|
7
7
|
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>;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
visible: boolean;
|
|
3
|
+
tooltipStyle: Record<string, string>;
|
|
4
|
+
showTooltip: () => void;
|
|
5
|
+
hideTooltip: () => void;
|
|
6
|
+
text: string;
|
|
7
|
+
position: 'top' | 'bottom' | 'left' | 'right';
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
registerWrapperRef: (...args: any[]) => void;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
onRegisterWrapperRef?: ((...args: any[]) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
15
|
declare const _default: typeof __VLS_export;
|
|
3
16
|
export default _default;
|
|
@@ -1,5 +1,72 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.KTooltip
|
|
3
|
-
|
|
2
|
+
.KTooltip-wrapper(
|
|
3
|
+
ref="internalWrapperRef"
|
|
4
|
+
@mouseenter="showTooltip"
|
|
5
|
+
@mouseleave="hideTooltip"
|
|
6
|
+
)
|
|
7
|
+
slot
|
|
8
|
+
Teleport(v-if="isMounted && visible" to="body")
|
|
9
|
+
.KTooltip(
|
|
10
|
+
:style="tooltipStyle"
|
|
11
|
+
:class="[position]"
|
|
12
|
+
)
|
|
13
|
+
slot(name="content")
|
|
14
|
+
span {{ text }}
|
|
4
15
|
</template>
|
|
5
|
-
|
|
16
|
+
|
|
17
|
+
<script lang="ts" setup>
|
|
18
|
+
import { ref, onMounted, watch } from 'vue'
|
|
19
|
+
|
|
20
|
+
const props = defineProps<{
|
|
21
|
+
visible: boolean
|
|
22
|
+
tooltipStyle: Record<string, string>
|
|
23
|
+
showTooltip: () => void
|
|
24
|
+
hideTooltip: () => void
|
|
25
|
+
text: string
|
|
26
|
+
position: 'top' | 'bottom' | 'left' | 'right'
|
|
27
|
+
disabled: boolean
|
|
28
|
+
}>()
|
|
29
|
+
|
|
30
|
+
const emit = defineEmits(['registerWrapperRef'])
|
|
31
|
+
|
|
32
|
+
const internalWrapperRef = ref<HTMLElement | null>(null)
|
|
33
|
+
const isMounted = ref(false)
|
|
34
|
+
|
|
35
|
+
onMounted(() => {
|
|
36
|
+
isMounted.value = true
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
watch(internalWrapperRef, (newVal) => {
|
|
40
|
+
emit('registerWrapperRef', newVal)
|
|
41
|
+
}, { immediate: true })
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<style lang="scss" scoped>
|
|
45
|
+
.KTooltip-wrapper {
|
|
46
|
+
display: inline-block;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.KTooltip {
|
|
50
|
+
background-color: var(--neutral-800, #1f2937);
|
|
51
|
+
color: var(--font-color-light, #ffffff);
|
|
52
|
+
padding: 6px 10px;
|
|
53
|
+
border-radius: var(--border-radius-sm, 4px);
|
|
54
|
+
font-size: 11px;
|
|
55
|
+
line-height: 1.4;
|
|
56
|
+
white-space: nowrap;
|
|
57
|
+
box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
|
|
58
|
+
max-width: 250px;
|
|
59
|
+
pointer-events: none;
|
|
60
|
+
opacity: 0;
|
|
61
|
+
animation: tooltip-fade-in 0.15s ease-out forwards;
|
|
62
|
+
|
|
63
|
+
@keyframes tooltip-fade-in {
|
|
64
|
+
from {
|
|
65
|
+
opacity: 0;
|
|
66
|
+
}
|
|
67
|
+
to {
|
|
68
|
+
opacity: 1;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
visible: boolean;
|
|
3
|
+
tooltipStyle: Record<string, string>;
|
|
4
|
+
showTooltip: () => void;
|
|
5
|
+
hideTooltip: () => void;
|
|
6
|
+
text: string;
|
|
7
|
+
position: 'top' | 'bottom' | 'left' | 'right';
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
registerWrapperRef: (...args: any[]) => void;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
13
|
+
onRegisterWrapperRef?: ((...args: any[]) => any) | undefined;
|
|
14
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
15
|
declare const _default: typeof __VLS_export;
|
|
3
16
|
export default _default;
|