@katlux/toolkit 0.1.0-beta.76 → 0.1.0-beta.78
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/KButton/KButton.logic.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +2 -2
- 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/KDatatable/KDataIterator.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +4 -4
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +4 -4
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +4 -4
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +4 -4
- 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/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.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/components/KTreePicker/KTreePicker.global.d.vue.ts +4 -4
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +4 -4
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +3 -3
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +3 -3
- package/dist/runtime/components/MultiTabs/MultiTabs.global.d.vue.ts +23 -0
- package/dist/runtime/components/MultiTabs/MultiTabs.global.vue +27 -0
- package/dist/runtime/components/MultiTabs/MultiTabs.global.vue.d.ts +23 -0
- package/dist/runtime/components/MultiTabs/MultiTabs.logic.d.ts +25 -0
- package/dist/runtime/components/MultiTabs/MultiTabs.logic.js +52 -0
- 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/KGrid/KGrid.vue +1 -0
- 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/KPanel/KPanel.vue +3 -1
- package/dist/runtime/presets/default/components/KTabs/KTabs.vue +96 -2
- 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.d.vue.ts +9 -0
- package/dist/runtime/presets/default/components/MultiTabs/MultiTabs.vue +55 -0
- package/dist/runtime/presets/default/components/MultiTabs/MultiTabs.vue.d.ts +9 -0
- package/package.json +1 -1
|
@@ -110,9 +110,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
110
110
|
isOpen: boolean;
|
|
111
111
|
disabled: boolean;
|
|
112
112
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
113
|
-
placeholder: string;
|
|
114
113
|
validationText: string;
|
|
115
114
|
modelValue: string;
|
|
115
|
+
placeholder: string;
|
|
116
116
|
showClear: boolean;
|
|
117
117
|
format: string;
|
|
118
118
|
step: number;
|
|
@@ -110,9 +110,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
110
110
|
isOpen: boolean;
|
|
111
111
|
disabled: boolean;
|
|
112
112
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
113
|
-
placeholder: string;
|
|
114
113
|
validationText: string;
|
|
115
114
|
modelValue: string;
|
|
115
|
+
placeholder: string;
|
|
116
116
|
showClear: boolean;
|
|
117
117
|
format: string;
|
|
118
118
|
step: number;
|
|
@@ -66,9 +66,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
66
66
|
}>, {
|
|
67
67
|
label: string;
|
|
68
68
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
69
|
-
placeholder: string;
|
|
70
69
|
validationText: string;
|
|
71
70
|
modelValue: string;
|
|
71
|
+
placeholder: string;
|
|
72
72
|
showClear: boolean;
|
|
73
73
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
74
|
declare const _default: typeof __VLS_export;
|
|
@@ -66,9 +66,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
66
66
|
}>, {
|
|
67
67
|
label: string;
|
|
68
68
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
69
|
-
placeholder: string;
|
|
70
69
|
validationText: string;
|
|
71
70
|
modelValue: string;
|
|
71
|
+
placeholder: string;
|
|
72
72
|
showClear: boolean;
|
|
73
73
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
74
74
|
declare const _default: typeof __VLS_export;
|
|
@@ -59,8 +59,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
59
59
|
label: string;
|
|
60
60
|
rows: number;
|
|
61
61
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
62
|
-
placeholder: string;
|
|
63
62
|
validationText: string;
|
|
63
|
+
placeholder: string;
|
|
64
64
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
65
65
|
declare const _default: typeof __VLS_export;
|
|
66
66
|
export default _default;
|
|
@@ -59,8 +59,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
59
59
|
label: string;
|
|
60
60
|
rows: number;
|
|
61
61
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
62
|
-
placeholder: string;
|
|
63
62
|
validationText: string;
|
|
63
|
+
placeholder: string;
|
|
64
64
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
65
65
|
declare const _default: typeof __VLS_export;
|
|
66
66
|
export default _default;
|
|
@@ -69,9 +69,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
69
|
label: string;
|
|
70
70
|
type: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
71
71
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
72
|
-
placeholder: string;
|
|
73
72
|
validationText: string;
|
|
74
73
|
modelValue: string;
|
|
74
|
+
placeholder: string;
|
|
75
75
|
showClear: boolean;
|
|
76
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
77
|
declare const _default: typeof __VLS_export;
|
|
@@ -69,9 +69,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
69
|
label: string;
|
|
70
70
|
type: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
71
71
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
72
|
-
placeholder: string;
|
|
73
72
|
validationText: string;
|
|
74
73
|
modelValue: string;
|
|
74
|
+
placeholder: string;
|
|
75
75
|
showClear: boolean;
|
|
76
76
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
77
|
declare const _default: typeof __VLS_export;
|
|
@@ -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
|
}
|
|
@@ -165,22 +165,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
165
165
|
"onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
|
|
166
166
|
}>, {
|
|
167
167
|
label: string;
|
|
168
|
-
parentKey: string;
|
|
169
|
-
idKey: string;
|
|
170
168
|
disabled: boolean;
|
|
171
169
|
loading: boolean;
|
|
172
170
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
171
|
+
validationText: string;
|
|
172
|
+
modelValue: any;
|
|
173
173
|
searchbox: boolean;
|
|
174
174
|
searchPlaceholder: string;
|
|
175
175
|
isOptionsOpen: boolean;
|
|
176
176
|
placeholder: string;
|
|
177
177
|
fullWidth: boolean;
|
|
178
|
-
validationText: string;
|
|
179
178
|
closeOnSelect: boolean;
|
|
180
179
|
multiSelect: boolean;
|
|
181
180
|
valueField: string;
|
|
182
|
-
modelValue: any;
|
|
183
181
|
iconField: string;
|
|
182
|
+
idKey: string;
|
|
183
|
+
parentKey: string;
|
|
184
184
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
185
185
|
declare const _default: typeof __VLS_export;
|
|
186
186
|
export default _default;
|
|
@@ -165,22 +165,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
165
165
|
"onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
|
|
166
166
|
}>, {
|
|
167
167
|
label: string;
|
|
168
|
-
parentKey: string;
|
|
169
|
-
idKey: string;
|
|
170
168
|
disabled: boolean;
|
|
171
169
|
loading: boolean;
|
|
172
170
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
171
|
+
validationText: string;
|
|
172
|
+
modelValue: any;
|
|
173
173
|
searchbox: boolean;
|
|
174
174
|
searchPlaceholder: string;
|
|
175
175
|
isOptionsOpen: boolean;
|
|
176
176
|
placeholder: string;
|
|
177
177
|
fullWidth: boolean;
|
|
178
|
-
validationText: string;
|
|
179
178
|
closeOnSelect: boolean;
|
|
180
179
|
multiSelect: boolean;
|
|
181
180
|
valueField: string;
|
|
182
|
-
modelValue: any;
|
|
183
181
|
iconField: string;
|
|
182
|
+
idKey: string;
|
|
183
|
+
parentKey: string;
|
|
184
184
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
185
185
|
declare const _default: typeof __VLS_export;
|
|
186
186
|
export default _default;
|
|
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
81
|
default: () => {};
|
|
82
82
|
};
|
|
83
83
|
}>> & Readonly<{}>, {
|
|
84
|
-
parentKey: string;
|
|
85
|
-
idKey: string;
|
|
86
|
-
expandedByDefault: boolean;
|
|
87
84
|
bulkActions: import("@katlux/providers").IKDatatableAction[];
|
|
88
85
|
rowActions: import("./KTreeView.logic.js").IRowAction[];
|
|
89
86
|
cellSlots: Record<string, any>;
|
|
90
87
|
headerSlots: Record<string, any>;
|
|
91
88
|
treeColumnIndex: number;
|
|
89
|
+
idKey: string;
|
|
90
|
+
parentKey: string;
|
|
91
|
+
expandedByDefault: boolean;
|
|
92
92
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
93
93
|
declare const _default: typeof __VLS_export;
|
|
94
94
|
export default _default;
|
|
@@ -81,14 +81,14 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
81
81
|
default: () => {};
|
|
82
82
|
};
|
|
83
83
|
}>> & Readonly<{}>, {
|
|
84
|
-
parentKey: string;
|
|
85
|
-
idKey: string;
|
|
86
|
-
expandedByDefault: boolean;
|
|
87
84
|
bulkActions: import("@katlux/providers").IKDatatableAction[];
|
|
88
85
|
rowActions: import("./KTreeView.logic.js").IRowAction[];
|
|
89
86
|
cellSlots: Record<string, any>;
|
|
90
87
|
headerSlots: Record<string, any>;
|
|
91
88
|
treeColumnIndex: number;
|
|
89
|
+
idKey: string;
|
|
90
|
+
parentKey: string;
|
|
91
|
+
expandedByDefault: boolean;
|
|
92
92
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
93
93
|
declare const _default: typeof __VLS_export;
|
|
94
94
|
export default _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
modelValue: {
|
|
3
|
+
type: import("vue").PropType<import("./MultiTabs.logic.js").MultiTabsGroup[]>;
|
|
4
|
+
default: undefined;
|
|
5
|
+
};
|
|
6
|
+
}>, {
|
|
7
|
+
addTab: (tab: import("./MultiTabs.logic.js").MultiTabsTab, groupId?: string) => void;
|
|
8
|
+
splitScreen: (initialTab?: import("./MultiTabs.logic.js").MultiTabsTab) => string;
|
|
9
|
+
closeSplit: (groupId: string) => void;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (...args: any[]) => void;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
modelValue: {
|
|
14
|
+
type: import("vue").PropType<import("./MultiTabs.logic.js").MultiTabsGroup[]>;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
}>> & Readonly<{
|
|
18
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
modelValue: import("./MultiTabs.logic.js").MultiTabsGroup[];
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useMultiTabsLogic, MultiTabsDefaultProps } from "./MultiTabs.logic";
|
|
3
|
+
import { usePresetComponent } from "../../composables/usePresetComponent";
|
|
4
|
+
import { computed } from "vue";
|
|
5
|
+
import MultiTabsDefault from "../../presets/default/components/MultiTabs/MultiTabs.vue";
|
|
6
|
+
const props = defineProps(MultiTabsDefaultProps);
|
|
7
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
8
|
+
const { groups, addTab, splitScreen, closeSplit } = useMultiTabsLogic(props, emit);
|
|
9
|
+
const presetComponent = usePresetComponent("MultiTabs", MultiTabsDefault);
|
|
10
|
+
const templateProps = computed(() => ({
|
|
11
|
+
groups: groups.value,
|
|
12
|
+
addTab,
|
|
13
|
+
splitScreen,
|
|
14
|
+
closeSplit
|
|
15
|
+
}));
|
|
16
|
+
defineExpose({
|
|
17
|
+
addTab,
|
|
18
|
+
splitScreen,
|
|
19
|
+
closeSplit
|
|
20
|
+
});
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template lang="pug">
|
|
24
|
+
component(:is="presetComponent" v-bind="templateProps")
|
|
25
|
+
template(v-for="(_, slot) in $slots" #[slot]="scope")
|
|
26
|
+
slot(:name="slot" v-bind="scope")
|
|
27
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
modelValue: {
|
|
3
|
+
type: import("vue").PropType<import("./MultiTabs.logic.js").MultiTabsGroup[]>;
|
|
4
|
+
default: undefined;
|
|
5
|
+
};
|
|
6
|
+
}>, {
|
|
7
|
+
addTab: (tab: import("./MultiTabs.logic.js").MultiTabsTab, groupId?: string) => void;
|
|
8
|
+
splitScreen: (initialTab?: import("./MultiTabs.logic.js").MultiTabsTab) => string;
|
|
9
|
+
closeSplit: (groupId: string) => void;
|
|
10
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:modelValue": (...args: any[]) => void;
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
13
|
+
modelValue: {
|
|
14
|
+
type: import("vue").PropType<import("./MultiTabs.logic.js").MultiTabsGroup[]>;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
}>> & Readonly<{
|
|
18
|
+
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
19
|
+
}>, {
|
|
20
|
+
modelValue: import("./MultiTabs.logic.js").MultiTabsGroup[];
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
export interface MultiTabsTab {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
slotName?: string;
|
|
6
|
+
component?: any;
|
|
7
|
+
props?: Record<string, any>;
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface MultiTabsGroup {
|
|
11
|
+
id: string;
|
|
12
|
+
tabs: MultiTabsTab[];
|
|
13
|
+
}
|
|
14
|
+
export declare const MultiTabsDefaultProps: {
|
|
15
|
+
modelValue: {
|
|
16
|
+
type: PropType<MultiTabsGroup[]>;
|
|
17
|
+
default: undefined;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare function useMultiTabsLogic(props: any, emit: any): {
|
|
21
|
+
groups: import("vue").WritableComputedRef<any, any>;
|
|
22
|
+
addTab: (tab: MultiTabsTab, groupId?: string) => void;
|
|
23
|
+
splitScreen: (initialTab?: MultiTabsTab) => string;
|
|
24
|
+
closeSplit: (groupId: string) => void;
|
|
25
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
export const MultiTabsDefaultProps = {
|
|
3
|
+
modelValue: {
|
|
4
|
+
type: Array,
|
|
5
|
+
default: void 0
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
export function useMultiTabsLogic(props, emit) {
|
|
9
|
+
const internalGroups = ref([{ id: "default", tabs: [] }]);
|
|
10
|
+
const groups = computed({
|
|
11
|
+
get: () => props.modelValue || internalGroups.value,
|
|
12
|
+
set: (val) => {
|
|
13
|
+
emit("update:modelValue", val);
|
|
14
|
+
if (props.modelValue === void 0) {
|
|
15
|
+
internalGroups.value = val;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const addTab = (tab, groupId) => {
|
|
20
|
+
const gs = [...groups.value];
|
|
21
|
+
const targetGroupId = groupId || gs[0]?.id;
|
|
22
|
+
const group = gs.find((g) => g.id === targetGroupId);
|
|
23
|
+
if (group) {
|
|
24
|
+
group.tabs.forEach((t) => t.isOpen = false);
|
|
25
|
+
const existingTabIndex = group.tabs.findIndex((t) => t.id === tab.id);
|
|
26
|
+
if (existingTabIndex >= 0) {
|
|
27
|
+
group.tabs[existingTabIndex].isOpen = true;
|
|
28
|
+
} else {
|
|
29
|
+
group.tabs.push({ ...tab, isOpen: true });
|
|
30
|
+
}
|
|
31
|
+
groups.value = gs;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const splitScreen = (initialTab) => {
|
|
35
|
+
const gs = [...groups.value];
|
|
36
|
+
const newId = `group-${Date.now()}`;
|
|
37
|
+
const tabs = initialTab ? [{ ...initialTab, isOpen: true }] : [];
|
|
38
|
+
gs.push({ id: newId, tabs });
|
|
39
|
+
groups.value = gs;
|
|
40
|
+
return newId;
|
|
41
|
+
};
|
|
42
|
+
const closeSplit = (groupId) => {
|
|
43
|
+
const gs = groups.value.filter((g) => g.id !== groupId);
|
|
44
|
+
groups.value = gs.length > 0 ? gs : [{ id: "default", tabs: [] }];
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
groups,
|
|
48
|
+
addTab,
|
|
49
|
+
splitScreen,
|
|
50
|
+
closeSplit
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -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>
|