@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
package/dist/module.json
CHANGED
|
@@ -22,7 +22,7 @@ export interface KButtonEmits {
|
|
|
22
22
|
export declare function useKButtonLogic(props: KButtonProps, emit: KButtonEmits): {
|
|
23
23
|
isLink: import("vue").ComputedRef<boolean>;
|
|
24
24
|
isDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
25
|
-
buttonClasses: import("vue").ComputedRef<("info" | "default" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | "
|
|
25
|
+
buttonClasses: import("vue").ComputedRef<("info" | "default" | "small" | "primary" | "danger" | "success" | "warning" | "light" | "dark" | "large" | "medium" | {
|
|
26
26
|
disabled: boolean | undefined;
|
|
27
27
|
})[]>;
|
|
28
28
|
onClick: () => void;
|
|
@@ -157,19 +157,19 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
157
157
|
label: string;
|
|
158
158
|
disabled: boolean;
|
|
159
159
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
160
|
+
validationText: string;
|
|
161
|
+
modelValue: any;
|
|
160
162
|
searchbox: boolean;
|
|
161
163
|
searchPlaceholder: string;
|
|
162
164
|
isOptionsOpen: boolean;
|
|
163
165
|
placeholder: string;
|
|
164
166
|
teleportTo: string;
|
|
165
167
|
fullWidth: boolean;
|
|
166
|
-
validationText: string;
|
|
167
168
|
closeOnSelect: boolean;
|
|
168
169
|
multiSelect: boolean;
|
|
169
170
|
maxSelectedDisplay: string | number | boolean;
|
|
170
171
|
visibleFields: String[];
|
|
171
172
|
valueField: string;
|
|
172
|
-
modelValue: any;
|
|
173
173
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
174
174
|
declare const _default: typeof __VLS_export;
|
|
175
175
|
export default _default;
|
|
@@ -157,19 +157,19 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
157
157
|
label: string;
|
|
158
158
|
disabled: boolean;
|
|
159
159
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
160
|
+
validationText: string;
|
|
161
|
+
modelValue: any;
|
|
160
162
|
searchbox: boolean;
|
|
161
163
|
searchPlaceholder: string;
|
|
162
164
|
isOptionsOpen: boolean;
|
|
163
165
|
placeholder: string;
|
|
164
166
|
teleportTo: string;
|
|
165
167
|
fullWidth: boolean;
|
|
166
|
-
validationText: string;
|
|
167
168
|
closeOnSelect: boolean;
|
|
168
169
|
multiSelect: boolean;
|
|
169
170
|
maxSelectedDisplay: string | number | boolean;
|
|
170
171
|
visibleFields: String[];
|
|
171
172
|
valueField: string;
|
|
172
|
-
modelValue: any;
|
|
173
173
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
174
174
|
declare const _default: typeof __VLS_export;
|
|
175
175
|
export default _default;
|
|
@@ -191,13 +191,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
label: string;
|
|
192
192
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
193
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
194
|
+
validationText: string;
|
|
195
|
+
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
194
196
|
searchbox: boolean;
|
|
195
197
|
labelField: string;
|
|
196
198
|
placeholder: string;
|
|
197
199
|
teleportTo: string;
|
|
198
|
-
validationText: string;
|
|
199
200
|
valueField: string;
|
|
200
|
-
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
201
201
|
inputType: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
202
202
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
203
203
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
@@ -191,13 +191,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
191
191
|
label: string;
|
|
192
192
|
type: import("./KCompositeInput.logic.js").CompositeInputType;
|
|
193
193
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
194
|
+
validationText: string;
|
|
195
|
+
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
194
196
|
searchbox: boolean;
|
|
195
197
|
labelField: string;
|
|
196
198
|
placeholder: string;
|
|
197
199
|
teleportTo: string;
|
|
198
|
-
validationText: string;
|
|
199
200
|
valueField: string;
|
|
200
|
-
modelValue: import("./KCompositeInput.logic.js").ICompositeItem[];
|
|
201
201
|
inputType: "number" | "text" | "url" | "search" | "password" | "email" | "tel" | undefined;
|
|
202
202
|
selectionValue: string | number | Record<string, any> | unknown[];
|
|
203
203
|
inputValue: string | number | Record<string, any> | unknown[];
|
|
@@ -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
|
+
isOpen: boolean;
|
|
49
|
+
teleportTo: string;
|
|
50
|
+
x: number;
|
|
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
|
+
isOpen: boolean;
|
|
49
|
+
teleportTo: string;
|
|
50
|
+
x: number;
|
|
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
|
}
|
|
@@ -11,8 +11,8 @@ interface Props {
|
|
|
11
11
|
page?: number;
|
|
12
12
|
}
|
|
13
13
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
14
|
-
search: string;
|
|
15
14
|
bulkActions: IKDatatableAction[];
|
|
15
|
+
search: string;
|
|
16
16
|
loading: boolean;
|
|
17
17
|
visibleFields: Array<string> | null;
|
|
18
18
|
rowActions: IKDatatableAction[];
|
|
@@ -11,8 +11,8 @@ interface Props {
|
|
|
11
11
|
page?: number;
|
|
12
12
|
}
|
|
13
13
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
14
|
-
search: string;
|
|
15
14
|
bulkActions: IKDatatableAction[];
|
|
15
|
+
search: string;
|
|
16
16
|
loading: boolean;
|
|
17
17
|
visibleFields: Array<string> | null;
|
|
18
18
|
rowActions: IKDatatableAction[];
|
|
@@ -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,19 +115,19 @@ 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;
|
|
125
125
|
day: string | Date;
|
|
126
126
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
127
|
-
placeholder: string;
|
|
128
|
-
teleportTo: string;
|
|
129
127
|
validationText: string;
|
|
130
128
|
modelValue: string | Date;
|
|
129
|
+
placeholder: string;
|
|
130
|
+
teleportTo: string;
|
|
131
131
|
showClear: boolean;
|
|
132
132
|
align: "left" | "right" | undefined;
|
|
133
133
|
format: string;
|
|
@@ -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,19 +115,19 @@ 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;
|
|
125
125
|
day: string | Date;
|
|
126
126
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
127
|
-
placeholder: string;
|
|
128
|
-
teleportTo: string;
|
|
129
127
|
validationText: string;
|
|
130
128
|
modelValue: string | Date;
|
|
129
|
+
placeholder: string;
|
|
130
|
+
teleportTo: string;
|
|
131
131
|
showClear: boolean;
|
|
132
132
|
align: "left" | "right" | undefined;
|
|
133
133
|
format: string;
|
|
@@ -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,18 +122,18 @@ 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;
|
|
131
131
|
day: string | Date;
|
|
132
132
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
133
|
-
placeholder: string;
|
|
134
|
-
teleportTo: string;
|
|
135
133
|
validationText: string;
|
|
136
134
|
modelValue: string | Date;
|
|
135
|
+
placeholder: string;
|
|
136
|
+
teleportTo: string;
|
|
137
137
|
showClear: boolean;
|
|
138
138
|
format: string;
|
|
139
139
|
calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
@@ -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,18 +122,18 @@ 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;
|
|
131
131
|
day: string | Date;
|
|
132
132
|
validation: "error" | "success" | "warning" | null | undefined;
|
|
133
|
-
placeholder: string;
|
|
134
|
-
teleportTo: string;
|
|
135
133
|
validationText: string;
|
|
136
134
|
modelValue: string | Date;
|
|
135
|
+
placeholder: string;
|
|
136
|
+
teleportTo: string;
|
|
137
137
|
showClear: boolean;
|
|
138
138
|
format: string;
|
|
139
139
|
calendarDefinedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
@@ -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;
|