@katlux/toolkit 0.1.1-alpha.111 → 0.1.1-alpha.112
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/compiled/composables/locales.mjs +195 -27
- package/dist/compiled/composables/useDataProvider.mjs +121 -90
- package/dist/compiled/composables/useDataProvider.spec.mjs +20 -1
- package/dist/compiled/composables/useKatluxContext.mjs +21 -0
- package/dist/compiled/composables/useKatluxContext.spec.mjs +63 -0
- package/dist/compiled/composables/useKatluxI18n.mjs +20 -9
- package/dist/compiled/composables/usePresetComponent.mjs +12 -3
- package/dist/compiled/utils/PresetResolver.mjs +21 -7
- package/dist/compiled/utils/TemplateResolver.mjs +11 -5
- package/dist/module.cjs +3 -31
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -32
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +5 -5
- package/dist/runtime/components/KCombobox/KCombobox.global.vue +6 -0
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +5 -5
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +3 -0
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +192 -14
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +11 -11
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +11 -11
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +23 -16
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +36 -27
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +6 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +6 -6
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +7 -7
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +7 -7
- package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +1 -1
- 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 +2 -2
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KModal/KModal.global.d.vue.ts +15 -2
- package/dist/runtime/components/KModal/KModal.global.vue +6 -1
- package/dist/runtime/components/KModal/KModal.global.vue.d.ts +15 -2
- package/dist/runtime/components/KModal/KModal.logic.d.ts +8 -2
- package/dist/runtime/components/KModal/KModal.logic.js +21 -3
- package/dist/runtime/components/KPagination/KPagination.global.vue +2 -0
- package/dist/runtime/components/KPagination/KPagination.logic.d.ts +2 -1
- package/dist/runtime/components/KPagination/KPagination.logic.js +1 -0
- package/dist/runtime/components/KSlider/KSlider.global.d.vue.ts +1 -1
- package/dist/runtime/components/KSlider/KSlider.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTabs/KTabItem.logic.js +20 -5
- package/dist/runtime/components/KTabs/KTabs.logic.js +18 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KToast/KToast.logic.d.ts +1 -0
- package/dist/runtime/components/KToast/KToast.logic.js +19 -5
- package/dist/runtime/components/KTree/KTree.global.d.vue.ts +12 -3
- package/dist/runtime/components/KTree/KTree.global.vue +1 -0
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +12 -3
- package/dist/runtime/components/KTree/KTree.logic.d.ts +9 -4
- package/dist/runtime/components/KTree/KTree.logic.js +9 -6
- 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/KTreePicker/KTreePicker.logic.d.ts +3 -0
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +28 -4
- package/dist/runtime/components/KTreeView/KTreeView.global.vue +15 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +28 -4
- package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +18 -4
- package/dist/runtime/components/KTreeView/KTreeView.logic.js +26 -7
- package/dist/runtime/composables/locales.js +195 -27
- package/dist/runtime/composables/useDataProvider.d.ts +1 -1
- package/dist/runtime/composables/useDataProvider.js +121 -90
- package/dist/runtime/composables/useDebounce.d.ts +1 -1
- package/dist/runtime/composables/useKatluxContext.d.ts +13 -0
- package/dist/runtime/composables/useKatluxContext.js +21 -0
- package/dist/runtime/composables/useKatluxI18n.js +20 -9
- package/dist/runtime/composables/usePresetComponent.js +12 -3
- package/dist/runtime/directives/clickOutside.d.ts +3 -2
- package/dist/runtime/directives/clickOutside.js +9 -2
- package/dist/runtime/hydration/NuxtHydrationAdapter.d.ts +10 -0
- package/dist/runtime/hydration/NuxtHydrationAdapter.js +88 -0
- package/dist/runtime/plugins/PresetPlugin.js +9 -1
- package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +2 -3
- package/dist/runtime/plugins/nuxtCompatPlugin.js +6 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +24 -2
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +19 -6
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +36 -8
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue +1 -1
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +1 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +1 -1
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue +1 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +1 -20
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.d.vue.ts +2 -2
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue +2 -2
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue.d.ts +2 -2
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue +6 -2
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +1 -1
- package/dist/runtime/presets/default/components/KModal/KModal.vue +16 -4
- package/dist/runtime/presets/default/components/KPagination/KPagination.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue +5 -4
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +3 -1
- package/dist/runtime/presets/default/components/KSlider/KSlider.vue +2 -1
- package/dist/runtime/presets/default/components/KTabs/KTabs.vue +2 -1
- package/dist/runtime/presets/default/components/KToast/KToast.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KToast/KToast.vue +1 -1
- package/dist/runtime/presets/default/components/KToast/KToast.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KTooltip/KTooltip.vue +2 -0
- package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +20 -10
- package/dist/runtime/presets/default/components/KTree/KTree.vue +34 -24
- package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +20 -10
- package/dist/runtime/presets/default/components/KTreeView/KTreeCell.vue +2 -1
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +8 -2
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +10 -1
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +8 -2
- package/dist/runtime/server/middleware/session.d.ts +2 -0
- package/dist/runtime/server/middleware/session.js +36 -0
- package/dist/runtime/utils/PresetResolver.js +21 -7
- package/dist/runtime/utils/TemplateResolver.js +11 -5
- package/package.json +2 -2
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
.KCheckbox-wrapper
|
|
3
3
|
label.KCheckbox(
|
|
4
4
|
role="checkbox"
|
|
5
|
-
:aria-checked="
|
|
5
|
+
:aria-checked="isChecked"
|
|
6
6
|
:aria-disabled="isDisabled"
|
|
7
7
|
tabindex="0"
|
|
8
|
-
@keydown.space.prevent="
|
|
8
|
+
@keydown.space.prevent="handleSpaceKey"
|
|
9
9
|
)
|
|
10
10
|
input(type="checkbox" v-model="internalModel" :value="checkboxValue" :disabled="isDisabled" tabindex="-1")
|
|
11
11
|
.icon-container(:class="validation ? `is-${validation}` : ''")
|
|
@@ -38,6 +38,28 @@ const internalModel = computed({
|
|
|
38
38
|
get: () => props.model,
|
|
39
39
|
set: (value) => emit('update:model', value)
|
|
40
40
|
})
|
|
41
|
+
|
|
42
|
+
// Correctly compute checked state for both boolean and array models
|
|
43
|
+
const isChecked = computed(() => {
|
|
44
|
+
if (Array.isArray(internalModel.value)) {
|
|
45
|
+
return internalModel.value.includes(props.checkboxValue)
|
|
46
|
+
}
|
|
47
|
+
return !!internalModel.value
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// Handle Space key correctly for both boolean and array models
|
|
51
|
+
function handleSpaceKey() {
|
|
52
|
+
if (Array.isArray(internalModel.value)) {
|
|
53
|
+
const val = props.checkboxValue
|
|
54
|
+
const arr = [...internalModel.value]
|
|
55
|
+
const idx = arr.indexOf(val)
|
|
56
|
+
if (idx === -1) arr.push(val)
|
|
57
|
+
else arr.splice(idx, 1)
|
|
58
|
+
internalModel.value = arr
|
|
59
|
+
} else {
|
|
60
|
+
internalModel.value = !internalModel.value
|
|
61
|
+
}
|
|
62
|
+
}
|
|
41
63
|
</script>
|
|
42
64
|
|
|
43
65
|
<style lang="scss" scoped>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComboboxItem } from '
|
|
1
|
+
import type { ComboboxItem } from '#toolkit/components/KCombobox/KCombobox.logic';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
label?: string;
|
|
4
4
|
disabled: boolean;
|
|
@@ -24,6 +24,9 @@ type __VLS_Props = {
|
|
|
24
24
|
buffer?: number;
|
|
25
25
|
teleportTo?: string;
|
|
26
26
|
fullWidth: boolean;
|
|
27
|
+
highlightedIndex?: number;
|
|
28
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
29
|
+
setHighlightedIndex?: (idx: number) => void;
|
|
27
30
|
validation?: 'success' | 'warning' | 'error' | null;
|
|
28
31
|
validationText?: string;
|
|
29
32
|
};
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
.KCombobox(ref="activatorRef" :class="{ disabled: disabled, open: isOptionsOpen, ... (validation ? { [`is-${validation}`]: true } : {}) }")
|
|
5
5
|
KGrid(
|
|
6
6
|
@click.stop="toggleDropdown"
|
|
7
|
-
@keydown
|
|
8
|
-
@keydown.space.prevent="toggleDropdown"
|
|
9
|
-
@keydown.escape.prevent="closeDropdown"
|
|
7
|
+
@keydown="onKeyDown"
|
|
10
8
|
role="combobox"
|
|
11
9
|
:aria-expanded="isOptionsOpen"
|
|
12
10
|
aria-haspopup="listbox"
|
|
13
|
-
|
|
11
|
+
:aria-activedescendant="highlightedIndex !== undefined && highlightedIndex >= 0 ? `k-combobox-opt-${highlightedIndex}` : undefined"
|
|
12
|
+
:aria-disabled="disabled"
|
|
13
|
+
:tabindex="disabled ? -1 : 0"
|
|
14
14
|
align="center"
|
|
15
15
|
justify="space-between"
|
|
16
16
|
).KCombobox__selected-content-container
|
|
@@ -42,16 +42,19 @@
|
|
|
42
42
|
:labelField="labelField"
|
|
43
43
|
:selectItem="selectItem"
|
|
44
44
|
:isSelected="isSelected"
|
|
45
|
+
:highlightedIndex="highlightedIndex"
|
|
46
|
+
:onKeyDown="onKeyDown"
|
|
47
|
+
:setHighlightedIndex="setHighlightedIndex"
|
|
45
48
|
)
|
|
46
49
|
span.validation-text(v-if="validation && ['success', 'warning', 'error'].includes(validation) && validationText" :class="`is-${validation}`") {{ validationText }}
|
|
47
50
|
</template>
|
|
48
51
|
|
|
49
52
|
<script lang="ts" setup>
|
|
50
|
-
import { computed, ref, useSlots } from 'vue'
|
|
53
|
+
import { computed, ref, useSlots, watch } from 'vue'
|
|
51
54
|
const activatorRef = ref<HTMLElement | null>(null)
|
|
52
55
|
const slots = useSlots()
|
|
53
56
|
import KComboboxList from './KComboboxList.vue'
|
|
54
|
-
import type { ComboboxItem } from '
|
|
57
|
+
import type { ComboboxItem } from '#toolkit/components/KCombobox/KCombobox.logic'
|
|
55
58
|
|
|
56
59
|
const props = withDefaults(defineProps<{
|
|
57
60
|
label?: string
|
|
@@ -78,6 +81,9 @@ const props = withDefaults(defineProps<{
|
|
|
78
81
|
buffer?: number
|
|
79
82
|
teleportTo?: string
|
|
80
83
|
fullWidth: boolean
|
|
84
|
+
highlightedIndex?: number
|
|
85
|
+
onKeyDown?: (e: KeyboardEvent) => void
|
|
86
|
+
setHighlightedIndex?: (idx: number) => void
|
|
81
87
|
validation?: 'success' | 'warning' | 'error' | null
|
|
82
88
|
validationText?: string
|
|
83
89
|
}>(), {
|
|
@@ -103,6 +109,13 @@ const isOptionsOpenModel = computed({
|
|
|
103
109
|
get: () => props.isOptionsOpen,
|
|
104
110
|
set: (value) => emit('update:isOptionsOpen', value)
|
|
105
111
|
})
|
|
112
|
+
|
|
113
|
+
watch(isOptionsOpenModel, (isOpen, oldOpen) => {
|
|
114
|
+
if (oldOpen && !isOpen && activatorRef.value) {
|
|
115
|
+
const trigger = activatorRef.value.querySelector<HTMLElement>('[role="combobox"]')
|
|
116
|
+
trigger?.focus()
|
|
117
|
+
}
|
|
118
|
+
})
|
|
106
119
|
</script>
|
|
107
120
|
|
|
108
121
|
<style lang="scss" scoped>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComboboxItem } from '
|
|
1
|
+
import type { ComboboxItem } from '#toolkit/components/KCombobox/KCombobox.logic';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
label?: string;
|
|
4
4
|
disabled: boolean;
|
|
@@ -24,6 +24,9 @@ type __VLS_Props = {
|
|
|
24
24
|
buffer?: number;
|
|
25
25
|
teleportTo?: string;
|
|
26
26
|
fullWidth: boolean;
|
|
27
|
+
highlightedIndex?: number;
|
|
28
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
29
|
+
setHighlightedIndex?: (idx: number) => void;
|
|
27
30
|
validation?: 'success' | 'warning' | 'error' | null;
|
|
28
31
|
validationText?: string;
|
|
29
32
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComboboxItem } from '
|
|
1
|
+
import type { ComboboxItem } from '#toolkit/components/KCombobox/KCombobox.logic';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
searchbox: boolean;
|
|
4
4
|
searchtext: string;
|
|
@@ -15,6 +15,9 @@ type __VLS_Props = {
|
|
|
15
15
|
labelField: string;
|
|
16
16
|
selectItem: (option: ComboboxItem) => void;
|
|
17
17
|
isSelected: (option: ComboboxItem) => boolean;
|
|
18
|
+
highlightedIndex?: number;
|
|
19
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
20
|
+
setHighlightedIndex?: (idx: number) => void;
|
|
18
21
|
};
|
|
19
22
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
20
23
|
"update:searchtext": (value: string) => any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.KCombobox__options-content
|
|
3
|
-
KTextbox(v-if="searchbox" v-model="searchtextModel" :placeholder="searchPlaceholder" :showClear="true")
|
|
2
|
+
.KCombobox__options-content(ref="contentRef")
|
|
3
|
+
KTextbox(v-if="searchbox" v-model="searchtextModel" :placeholder="searchPlaceholder" :showClear="true" @keydown="onKeyDown")
|
|
4
4
|
.KCombobox__loading(v-if="initialLoading || (loading && filteredOptions.length === 0)")
|
|
5
5
|
.KCombobox__loading-spinner
|
|
6
6
|
.KCombobox__empty(v-else-if="filteredOptions.length === 0")
|
|
@@ -9,15 +9,18 @@
|
|
|
9
9
|
v-else
|
|
10
10
|
ref="listRef"
|
|
11
11
|
role="listbox"
|
|
12
|
-
:style="{ '--top-spacer': `${topSpacerHeight}px`, '--bottom-spacer': `${bottomSpacerHeight}px` }"
|
|
12
|
+
:style="{ '--top-spacer': `${topSpacerHeight}px`, '--bottom-spacer': `${bottomSpacerHeight}px`, '--k-combobox-item-height': `${itemH}px` }"
|
|
13
13
|
@scroll.passive="onScroll"
|
|
14
14
|
)
|
|
15
15
|
li.KCombobox__virtual-spacer.is-top(v-if="topSpacerHeight > 0" role="presentation")
|
|
16
16
|
li.KCombobox__options-list-item(
|
|
17
17
|
v-for="(option, index) in visibleOptions"
|
|
18
18
|
:key="getItemKey(option, startIndex + index)"
|
|
19
|
+
:id="'k-combobox-opt-' + (startIndex + index)"
|
|
19
20
|
role="option"
|
|
20
|
-
:aria-selected="isSelected(option)"
|
|
21
|
+
:aria-selected="isSelected(option) ? 'true' : 'false'"
|
|
22
|
+
:class="{ 'is-highlighted': (startIndex + index) === highlightedIndex }"
|
|
23
|
+
@mouseenter="setHighlightedIndex && setHighlightedIndex(startIndex + index)"
|
|
21
24
|
@click.stop="selectItem(option)"
|
|
22
25
|
)
|
|
23
26
|
KGrid(align="center" justify="space-between" wrap="nowrap")
|
|
@@ -31,7 +34,7 @@
|
|
|
31
34
|
<script lang="ts" setup>
|
|
32
35
|
import { computed, ref, onMounted, onBeforeUnmount, watch } from 'vue'
|
|
33
36
|
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
34
|
-
import type { ComboboxItem } from '
|
|
37
|
+
import type { ComboboxItem } from '#toolkit/components/KCombobox/KCombobox.logic'
|
|
35
38
|
|
|
36
39
|
const { t } = useKatluxI18n()
|
|
37
40
|
|
|
@@ -51,6 +54,9 @@ const props = withDefaults(defineProps<{
|
|
|
51
54
|
labelField: string
|
|
52
55
|
selectItem: (option: ComboboxItem) => void
|
|
53
56
|
isSelected: (option: ComboboxItem) => boolean
|
|
57
|
+
highlightedIndex?: number
|
|
58
|
+
onKeyDown?: (e: KeyboardEvent) => void
|
|
59
|
+
setHighlightedIndex?: (idx: number) => void
|
|
54
60
|
}>(), {
|
|
55
61
|
virtualScroll: true,
|
|
56
62
|
itemHeight: 40,
|
|
@@ -69,6 +75,7 @@ const searchtextModel = computed({
|
|
|
69
75
|
set: (value) => emit('update:searchtext', value)
|
|
70
76
|
})
|
|
71
77
|
|
|
78
|
+
const contentRef = ref<HTMLElement | null>(null)
|
|
72
79
|
const listRef = ref<HTMLElement | null>(null)
|
|
73
80
|
const scrollTop = ref(0)
|
|
74
81
|
const containerHeight = ref(200)
|
|
@@ -84,7 +91,7 @@ const startIndex = computed(() => {
|
|
|
84
91
|
|
|
85
92
|
const visibleCount = computed(() => {
|
|
86
93
|
if (!props.virtualScroll) return totalCount.value
|
|
87
|
-
return Math.ceil(containerHeight.value / itemH.value) + 2 * buf.value
|
|
94
|
+
return Math.ceil(containerHeight.value / itemH.value) + 2 * buf.value + 1
|
|
88
95
|
})
|
|
89
96
|
|
|
90
97
|
const endIndex = computed(() => {
|
|
@@ -137,9 +144,29 @@ watch(() => props.searchtext, () => {
|
|
|
137
144
|
}
|
|
138
145
|
})
|
|
139
146
|
|
|
147
|
+
watch(() => props.highlightedIndex, (idx) => {
|
|
148
|
+
if (idx === undefined || idx < 0 || !listRef.value) return
|
|
149
|
+
const targetTop = idx * itemH.value
|
|
150
|
+
const targetBottom = targetTop + itemH.value
|
|
151
|
+
const currentTop = listRef.value.scrollTop
|
|
152
|
+
const currentBottom = currentTop + containerHeight.value
|
|
153
|
+
if (targetTop < currentTop) {
|
|
154
|
+
listRef.value.scrollTop = targetTop
|
|
155
|
+
} else if (targetBottom > currentBottom) {
|
|
156
|
+
listRef.value.scrollTop = Math.max(0, targetBottom - containerHeight.value)
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
|
|
140
160
|
let resizeObserver: ResizeObserver | null = null
|
|
141
161
|
|
|
142
162
|
onMounted(() => {
|
|
163
|
+
if (props.searchbox && typeof requestAnimationFrame !== 'undefined') {
|
|
164
|
+
requestAnimationFrame(() => {
|
|
165
|
+
const inputEl = contentRef.value?.querySelector('input')
|
|
166
|
+
inputEl?.focus()
|
|
167
|
+
})
|
|
168
|
+
}
|
|
169
|
+
|
|
143
170
|
if (listRef.value) {
|
|
144
171
|
containerHeight.value = listRef.value.clientHeight || 200
|
|
145
172
|
if (typeof ResizeObserver !== 'undefined') {
|
|
@@ -183,12 +210,13 @@ onBeforeUnmount(() => {
|
|
|
183
210
|
|
|
184
211
|
&-item {
|
|
185
212
|
cursor: pointer;
|
|
186
|
-
height: 40px;
|
|
213
|
+
height: var(--k-combobox-item-height, 40px);
|
|
187
214
|
padding: 10px;
|
|
188
215
|
box-sizing: border-box;
|
|
189
216
|
|
|
190
217
|
border-bottom: 1px solid var(--border-color-light);
|
|
191
|
-
&:hover
|
|
218
|
+
&:hover,
|
|
219
|
+
&.is-highlighted {
|
|
192
220
|
background-color: var(--background-color-medium);
|
|
193
221
|
}
|
|
194
222
|
&:last-child {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComboboxItem } from '
|
|
1
|
+
import type { ComboboxItem } from '#toolkit/components/KCombobox/KCombobox.logic';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
searchbox: boolean;
|
|
4
4
|
searchtext: string;
|
|
@@ -15,6 +15,9 @@ type __VLS_Props = {
|
|
|
15
15
|
labelField: string;
|
|
16
16
|
selectItem: (option: ComboboxItem) => void;
|
|
17
17
|
isSelected: (option: ComboboxItem) => boolean;
|
|
18
|
+
highlightedIndex?: number;
|
|
19
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
|
20
|
+
setHighlightedIndex?: (idx: number) => void;
|
|
18
21
|
};
|
|
19
22
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
20
23
|
"update:searchtext": (value: string) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ADataProvider } from '@katlux/providers';
|
|
2
|
-
import type { ICompositeInputConfig } from '
|
|
2
|
+
import type { ICompositeInputConfig } from '#toolkit/components/KCompositeInput/KCompositeInput.logic';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
label?: string;
|
|
5
5
|
selectionValue: any;
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
<script lang="ts" setup>
|
|
84
84
|
import { computed } from 'vue'
|
|
85
85
|
import type { ADataProvider } from '@katlux/providers'
|
|
86
|
-
import type { ICompositeInputConfig } from '
|
|
86
|
+
import type { ICompositeInputConfig } from '#toolkit/components/KCompositeInput/KCompositeInput.logic'
|
|
87
87
|
|
|
88
88
|
const props = defineProps<{
|
|
89
89
|
label?: string
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ADataProvider } from '@katlux/providers';
|
|
2
|
-
import type { ICompositeInputConfig } from '
|
|
2
|
+
import type { ICompositeInputConfig } from '#toolkit/components/KCompositeInput/KCompositeInput.logic';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
label?: string;
|
|
5
5
|
selectionValue: any;
|
|
@@ -182,8 +182,7 @@ const onTaskDragStart = (
|
|
|
182
182
|
{ event, task, rowId, mode, wrapperEl }: { event: MouseEvent; task: IGanttTask; rowId: any; mode: string; wrapperEl: HTMLElement | null },
|
|
183
183
|
row: any
|
|
184
184
|
) => {
|
|
185
|
-
|
|
186
|
-
if (!props.editable) { console.warn('[KGantt] ABORT: not editable'); return }
|
|
185
|
+
if (!props.editable) { return }
|
|
187
186
|
event.preventDefault()
|
|
188
187
|
|
|
189
188
|
const wrapperRect = wrapperEl?.getBoundingClientRect()
|
|
@@ -266,14 +265,6 @@ const onMouseUp = () => {
|
|
|
266
265
|
[endField]: state.currentEndMs
|
|
267
266
|
}
|
|
268
267
|
|
|
269
|
-
console.log('[KGantt] onMouseUp', {
|
|
270
|
-
mode: state.mode,
|
|
271
|
-
originalStart: new Date(state.originalStartMs).toISOString(),
|
|
272
|
-
currentStart: new Date(state.currentStartMs).toISOString(),
|
|
273
|
-
sameTime: state.currentStartMs === state.originalStartMs,
|
|
274
|
-
wrapperWidth: state.wrapperWidth
|
|
275
|
-
})
|
|
276
|
-
|
|
277
268
|
let targetRow = state.sourceRow
|
|
278
269
|
|
|
279
270
|
// Check if the task was moved to a different row
|
|
@@ -288,11 +279,9 @@ const onMouseUp = () => {
|
|
|
288
279
|
if (resourceTypeField) {
|
|
289
280
|
const myType = state.sourceRow?.[resourceTypeField]
|
|
290
281
|
const theirType = hoverRow?.[resourceTypeField]
|
|
291
|
-
console.log('[KGantt] cross-row check', { myType, theirType, taskType, taskTypeField })
|
|
292
282
|
|
|
293
283
|
// If task has a specific type, it MUST match the target resource type
|
|
294
284
|
if (taskType && theirType && taskType !== theirType) {
|
|
295
|
-
console.warn('[KGantt] CANCEL: task type mismatch with target resource')
|
|
296
285
|
activeDragState.value = null
|
|
297
286
|
return
|
|
298
287
|
}
|
|
@@ -300,7 +289,6 @@ const onMouseUp = () => {
|
|
|
300
289
|
// Original logic: if source resource has a type, target must match (if resourceTypeField is set)
|
|
301
290
|
// This covers the case where the task doesn't have a type, but we still want to keep it within the same resource group
|
|
302
291
|
if (myType && theirType && myType !== theirType) {
|
|
303
|
-
console.warn('[KGantt] CANCEL: resource type mismatch')
|
|
304
292
|
activeDragState.value = null
|
|
305
293
|
return
|
|
306
294
|
}
|
|
@@ -315,19 +303,12 @@ const onMouseUp = () => {
|
|
|
315
303
|
: (targetRow?.[tasksField] || [])
|
|
316
304
|
|
|
317
305
|
const overlapping = isTaskOverlapping(updatedTask, targetTasks, startField, endField)
|
|
318
|
-
console.log('[KGantt] overlap check', {
|
|
319
|
-
updatedTask: { id: updatedTask.id, start: (updatedTask as any)[startField], end: (updatedTask as any)[endField] },
|
|
320
|
-
targetTaskCount: targetTasks.length,
|
|
321
|
-
overlapping
|
|
322
|
-
})
|
|
323
306
|
|
|
324
307
|
if (overlapping) {
|
|
325
|
-
console.warn('[KGantt] CANCEL: overlap detected')
|
|
326
308
|
activeDragState.value = null
|
|
327
309
|
return
|
|
328
310
|
}
|
|
329
311
|
|
|
330
|
-
console.log('[KGantt] COMMIT: emitting update:task')
|
|
331
312
|
emit('update:task', {
|
|
332
313
|
|
|
333
314
|
task: updatedTask,
|
|
@@ -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:isOpen": (value: boolean) => any;
|
|
21
20
|
"update:maskedModel": (value: string) => any;
|
|
21
|
+
"update:isOpen": (value: boolean) => any;
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
-
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
24
23
|
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
24
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
25
25
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
declare const _default: typeof __VLS_export;
|
|
27
27
|
export default _default;
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
<script lang="ts" setup>
|
|
33
33
|
import { ref, computed } from 'vue'
|
|
34
34
|
const activatorRef = ref<HTMLElement | null>(null)
|
|
35
|
-
import KHourSelect from '
|
|
36
|
-
import KMaskTextbox from '
|
|
35
|
+
import KHourSelect from '#toolkit/components/KHourSelect/KHourSelect.global.vue'
|
|
36
|
+
import KMaskTextbox from '#toolkit/components/KMaskTextbox/KMaskTextbox.global.vue'
|
|
37
37
|
|
|
38
38
|
const props = defineProps<{
|
|
39
39
|
label?: string
|
|
@@ -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:isOpen": (value: boolean) => any;
|
|
21
20
|
"update:maskedModel": (value: string) => any;
|
|
21
|
+
"update:isOpen": (value: boolean) => any;
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
-
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
24
23
|
"onUpdate:maskedModel"?: ((value: string) => any) | undefined;
|
|
24
|
+
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
25
25
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
26
|
declare const _default: typeof __VLS_export;
|
|
27
27
|
export default _default;
|
|
@@ -14,12 +14,16 @@ const props = defineProps<{
|
|
|
14
14
|
}>()
|
|
15
15
|
|
|
16
16
|
const computedClasses = computed(() => {
|
|
17
|
-
|
|
17
|
+
const base = {
|
|
18
18
|
'is-loading': props.loading,
|
|
19
19
|
'is-overlay': props.overlay,
|
|
20
20
|
[`is-${props.size || 'medium'}`]: true,
|
|
21
|
-
...props.loaderClasses
|
|
22
21
|
}
|
|
22
|
+
if (!props.loaderClasses) return base
|
|
23
|
+
if (Array.isArray(props.loaderClasses)) {
|
|
24
|
+
return [base, ...props.loaderClasses]
|
|
25
|
+
}
|
|
26
|
+
return { ...base, ...props.loaderClasses }
|
|
23
27
|
})
|
|
24
28
|
</script>
|
|
25
29
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</template>
|
|
16
16
|
|
|
17
17
|
<script lang="ts" setup>
|
|
18
|
-
import { getMaskPatternDef } from '
|
|
18
|
+
import { getMaskPatternDef } from '#toolkit/components/KMaskTextbox/KMaskTextbox.logic'
|
|
19
19
|
|
|
20
20
|
const props = defineProps<{
|
|
21
21
|
label?: string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
dialog.k-modal(ref="dialogRef" @close="closeModal" @click="handleBackdropClick" @mousedown="handleMouseDown" role="dialog" aria-modal="true" :aria-label="t('Dialog Window')")
|
|
3
|
-
.modal-portal(:id="modalId"
|
|
3
|
+
.modal-portal(:id="modalId")
|
|
4
4
|
KPanel(no-gap flex-content scrollable).modal-container
|
|
5
5
|
template(#header)
|
|
6
6
|
slot(name="header")
|
|
@@ -29,15 +29,19 @@ let isMouseDownOnBackdrop = false
|
|
|
29
29
|
watch(() => props.opened, (isOpen) => {
|
|
30
30
|
if (!dialogRef.value) return
|
|
31
31
|
if (isOpen) {
|
|
32
|
-
dialogRef.value.
|
|
32
|
+
if (!dialogRef.value.open) {
|
|
33
|
+
dialogRef.value.showModal()
|
|
34
|
+
}
|
|
33
35
|
} else {
|
|
34
|
-
dialogRef.value.
|
|
36
|
+
if (dialogRef.value.open) {
|
|
37
|
+
dialogRef.value.close()
|
|
38
|
+
}
|
|
35
39
|
}
|
|
36
40
|
})
|
|
37
41
|
|
|
38
42
|
// Sync the initial state if the modal was initially rendered as opened
|
|
39
43
|
onMounted(() => {
|
|
40
|
-
if (props.opened && dialogRef.value) {
|
|
44
|
+
if (props.opened && dialogRef.value && !dialogRef.value.open) {
|
|
41
45
|
dialogRef.value.showModal()
|
|
42
46
|
}
|
|
43
47
|
})
|
|
@@ -81,6 +85,14 @@ const handleBackdropClick = (event: MouseEvent) => {
|
|
|
81
85
|
backdrop-filter: blur(var(--modal-backdrop-blur));
|
|
82
86
|
}
|
|
83
87
|
|
|
88
|
+
.modal-portal {
|
|
89
|
+
position: absolute;
|
|
90
|
+
top: 0;
|
|
91
|
+
left: 0;
|
|
92
|
+
z-index: 9999;
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
}
|
|
95
|
+
|
|
84
96
|
.modal-container {
|
|
85
97
|
flex: 1;
|
|
86
98
|
display: flex;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
nav.k-pagination(v-if="totalPages > 1" :aria-label="t('Pagination Navigation')")
|
|
3
3
|
ul
|
|
4
4
|
li(v-if="showPrevButton")
|
|
5
|
-
KButton(@click="goToPrev" :href="getPageHref(
|
|
5
|
+
KButton(@click="goToPrev" :href="getPageHref(currentPage - 1)" size="small" variant="outline" :aria-label="t('Previous Page')") ‹
|
|
6
6
|
|
|
7
7
|
li(v-if="showFirstEllipsis")
|
|
8
8
|
KButton(@click="goToFirst" :href="getPageHref(1)" size="small" variant="outline" :aria-label="t('Go to Page 1')") 1
|
|
@@ -14,9 +14,9 @@ nav.k-pagination(v-if="totalPages > 1" :aria-label="t('Pagination Navigation')")
|
|
|
14
14
|
KButton(
|
|
15
15
|
@click="pageClicked(item)"
|
|
16
16
|
:href="getPageHref(item)"
|
|
17
|
-
:class="{'light': item==
|
|
17
|
+
:class="{'light': item==currentPage}"
|
|
18
18
|
size="small"
|
|
19
|
-
:aria-current="item ===
|
|
19
|
+
:aria-current="item === currentPage ? 'page' : undefined"
|
|
20
20
|
:aria-label="t('Page') + ' ' + item"
|
|
21
21
|
) {{item}}
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@ nav.k-pagination(v-if="totalPages > 1" :aria-label="t('Pagination Navigation')")
|
|
|
27
27
|
KButton(@click="goToLast" :href="getPageHref(totalPages)" size="small" variant="outline" :aria-label="t('Go to Page') + ' ' + totalPages") {{totalPages}}
|
|
28
28
|
|
|
29
29
|
li(v-if="showNextButton")
|
|
30
|
-
KButton(@click="goToNext" :href="getPageHref(
|
|
30
|
+
KButton(@click="goToNext" :href="getPageHref(currentPage + 1)" size="small" variant="outline" :aria-label="t('Next Page')") ›
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<script setup lang="ts">
|
|
@@ -38,6 +38,7 @@ const { t } = useKatluxI18n()
|
|
|
38
38
|
|
|
39
39
|
const props = defineProps<{
|
|
40
40
|
dp: any
|
|
41
|
+
currentPage: number
|
|
41
42
|
totalPages: number
|
|
42
43
|
getPageHref: (page: number) => string | undefined
|
|
43
44
|
visiblePages: number[]
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
label.k-input-label(v-if="label") {{ label }}
|
|
4
4
|
.slider-container(@click="handleTrackClick")
|
|
5
5
|
.slider-track
|
|
6
|
-
.slider-range(:style="{
|
|
6
|
+
.slider-range(:style="{ '--range-start': minPercent + '%', '--range-width': (maxPercent - minPercent) + '%' }")
|
|
7
7
|
input.slider-input.slider-min(
|
|
8
8
|
type="range"
|
|
9
9
|
:min="rangeMin"
|
|
@@ -119,6 +119,8 @@ const handleTrackClick = (event: MouseEvent) => {
|
|
|
119
119
|
.slider-range {
|
|
120
120
|
position: absolute;
|
|
121
121
|
height: 6px;
|
|
122
|
+
left: var(--range-start, 0%);
|
|
123
|
+
width: var(--range-width, 0%);
|
|
122
124
|
background-color: var(--primary-500);
|
|
123
125
|
border-radius: 3px;
|
|
124
126
|
z-index: 1;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
label.k-input-label(v-if="label") {{ label }}
|
|
4
4
|
.slider-container(@click="handleTrackClick")
|
|
5
5
|
.slider-track
|
|
6
|
-
.slider-fill(:style="{
|
|
6
|
+
.slider-fill(:style="{ '--slider-fill': valuePercent + '%' }")
|
|
7
7
|
input.slider-input(
|
|
8
8
|
type="range"
|
|
9
9
|
:min="rangeMin"
|
|
@@ -82,6 +82,7 @@ const handleTrackClick = (event: MouseEvent) => {
|
|
|
82
82
|
.slider-fill {
|
|
83
83
|
position: absolute;
|
|
84
84
|
height: 6px;
|
|
85
|
+
width: var(--slider-fill, 0%);
|
|
85
86
|
background-color: var(--primary-500);
|
|
86
87
|
border-radius: 3px;
|
|
87
88
|
z-index: 1;
|