@katlux/toolkit 0.1.1-alpha.146 → 0.1.1-alpha.147
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/README.md +32 -22
- package/bin/ai-init.mjs +71 -13
- package/bin/ai-tokens/adapters/antigravityAdapter.mjs +22 -0
- package/bin/ai-tokens/adapters/claudeCodeAdapter.mjs +192 -0
- package/bin/ai-tokens/adapters/codexAdapter.mjs +176 -0
- package/bin/ai-tokens/adapters/cursorAdapter.mjs +202 -0
- package/bin/ai-tokens/adapters/index.mjs +30 -0
- package/bin/ai-tokens/cliViews.mjs +301 -0
- package/bin/ai-tokens/formatAndDates.mjs +89 -0
- package/bin/ai-tokens/reportGenerator.mjs +232 -0
- package/bin/ai-tokens/transcriptParser.mjs +299 -0
- package/bin/ai-tokens.mjs +38 -1030
- package/bin/cli.mjs +14 -10
- package/bin/preset-contracts.json +66 -10
- package/dist/compiled/composables/locales/asianAndPacific.mjs +296 -0
- package/dist/compiled/composables/locales/northernAndEasternEuropean.mjs +342 -0
- package/dist/compiled/composables/locales/westernEuropean.mjs +268 -0
- package/dist/compiled/composables/locales.mjs +28 -895
- package/dist/compiled/composables/useDataProvider.mjs +3 -1
- package/dist/compiled/composables/useKatluxForm.mjs +7 -7
- package/dist/compiled/composables/usePresetComponent.mjs +2 -0
- package/dist/compiled/composables/useRequestQueue.mjs +3 -1
- package/dist/compiled/composables/useVirtualDataset.mjs +322 -354
- package/dist/compiled/composables/useVirtualScroll.mjs +69 -62
- package/dist/compiled/composables/virtualDataset/cacheStateHelpers.mjs +76 -0
- package/dist/compiled/composables/virtualDataset/keyboardNavHelpers.mjs +60 -0
- package/dist/compiled/composables/virtualDataset/treeSelectionHelpers.mjs +103 -0
- package/dist/compiled/composables/virtualDataset/types.mjs +0 -0
- package/dist/compiled/utils/deprecation.mjs +44 -0
- package/dist/compiled/utils/dom.mjs +124 -0
- package/dist/module.cjs +0 -5
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -6
- package/dist/runtime/app.config.d.ts +3 -0
- package/dist/runtime/components/KAccordion/KAccordion.global.d.vue.ts +1 -1
- package/dist/runtime/components/KAccordion/KAccordion.global.vue.d.ts +1 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +8 -0
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +21 -55
- package/dist/runtime/components/KButton/KButton.global.d.vue.ts +2 -2
- package/dist/runtime/components/KButton/KButton.global.vue.d.ts +2 -2
- package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
- package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +4 -4
- package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +4 -4
- package/dist/runtime/components/KCalendar/KCalendar.logic.js +8 -4
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue +4 -0
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +2 -0
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +41 -26
- package/dist/runtime/components/KCalendar/recurringUtils.js +6 -5
- 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 +17 -2
- package/dist/runtime/components/KCombobox/KCombobox.global.vue +9 -4
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +17 -2
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +10 -2
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +32 -13
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +7 -7
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +7 -7
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +3 -3
- package/dist/runtime/components/KContextMenu/KContextMenu.global.d.vue.ts +3 -3
- package/dist/runtime/components/KContextMenu/KContextMenu.global.vue +4 -1
- package/dist/runtime/components/KContextMenu/KContextMenu.global.vue.d.ts +3 -3
- package/dist/runtime/components/KContextMenu/KContextMenu.logic.d.ts +24 -4
- package/dist/runtime/components/KContextMenu/KContextMenu.logic.js +43 -27
- package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +25 -2
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue +19 -7
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +25 -2
- package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +20 -0
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +54 -14
- package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +6 -5
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +5 -3
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +45 -26
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +5 -3
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +2 -0
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +66 -20
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +4 -4
- package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +4 -4
- package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +3 -2
- package/dist/runtime/components/KDropdown/KDropdown.logic.js +14 -13
- package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +3 -1
- package/dist/runtime/components/KGantt/KGantt.global.vue +7 -1
- package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +3 -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 +1 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KIcon/KIcon.global.d.vue.ts +1 -1
- package/dist/runtime/components/KIcon/KIcon.global.vue.d.ts +1 -1
- package/dist/runtime/components/KLayout/KLayout.global.d.vue.ts +4 -1
- package/dist/runtime/components/KLayout/KLayout.global.vue +4 -1
- package/dist/runtime/components/KLayout/KLayout.global.vue.d.ts +4 -1
- package/dist/runtime/components/KLoader/KLoader.global.d.vue.ts +9 -0
- package/dist/runtime/components/KLoader/KLoader.global.vue +1 -0
- package/dist/runtime/components/KLoader/KLoader.global.vue.d.ts +9 -0
- package/dist/runtime/components/KLoader/KLoader.logic.d.ts +5 -0
- package/dist/runtime/components/KLoader/KLoader.logic.js +4 -0
- 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/KMaskTextbox/KMaskTextbox.logic.js +30 -7
- package/dist/runtime/components/KMultiTabs/KMultiTabs.logic.d.ts +1 -0
- package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue +6 -4
- package/dist/runtime/components/KPagination/KPagination.logic.d.ts +1 -1
- package/dist/runtime/components/KPagination/KPagination.logic.js +17 -9
- package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTabs/KTabs.logic.js +33 -11
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +2 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +14 -3
- package/dist/runtime/components/KTextbox/KTextbox.global.vue +8 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +14 -3
- package/dist/runtime/components/KTextbox/KTextbox.logic.d.ts +5 -0
- package/dist/runtime/components/KTextbox/KTextbox.logic.js +4 -0
- package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.logic.d.ts +11 -2
- package/dist/runtime/components/KTooltip/KTooltip.logic.js +7 -5
- package/dist/runtime/components/KTree/KTree.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTree/KTree.logic.js +21 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +8 -4
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +4 -2
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +8 -4
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +3 -2
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +10 -1
- 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/KTreeView/KTreeView.logic.d.ts +1 -1
- package/dist/runtime/components/KTreeView/KTreeView.logic.js +36 -12
- package/dist/runtime/composables/locales/asianAndPacific.d.ts +11 -0
- package/dist/runtime/composables/locales/asianAndPacific.js +296 -0
- package/dist/runtime/composables/locales/northernAndEasternEuropean.d.ts +12 -0
- package/dist/runtime/composables/locales/northernAndEasternEuropean.js +342 -0
- package/dist/runtime/composables/locales/westernEuropean.d.ts +10 -0
- package/dist/runtime/composables/locales/westernEuropean.js +268 -0
- package/dist/runtime/composables/locales.d.ts +4 -24
- package/dist/runtime/composables/locales.js +28 -895
- package/dist/runtime/composables/useDataProvider.js +3 -1
- package/dist/runtime/composables/useKatluxForm.js +7 -7
- package/dist/runtime/composables/usePresetComponent.js +2 -0
- package/dist/runtime/composables/useRequestQueue.d.ts +2 -0
- package/dist/runtime/composables/useRequestQueue.js +3 -1
- package/dist/runtime/composables/useVirtualDataset.d.ts +6 -118
- package/dist/runtime/composables/useVirtualDataset.js +322 -354
- package/dist/runtime/composables/useVirtualScroll.d.ts +9 -9
- package/dist/runtime/composables/useVirtualScroll.js +69 -62
- package/dist/runtime/composables/virtualDataset/cacheStateHelpers.d.ts +49 -0
- package/dist/runtime/composables/virtualDataset/cacheStateHelpers.js +76 -0
- package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.d.ts +26 -0
- package/dist/runtime/composables/virtualDataset/keyboardNavHelpers.js +60 -0
- package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.d.ts +24 -0
- package/dist/runtime/composables/virtualDataset/treeSelectionHelpers.js +103 -0
- package/dist/runtime/composables/virtualDataset/types.d.ts +113 -0
- package/dist/runtime/composables/virtualDataset/types.js +0 -0
- package/dist/runtime/directives/clickOutside.d.ts +1 -1
- package/dist/runtime/directives/clickOutside.js +41 -13
- package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +2 -1
- package/dist/runtime/plugins/nuxtCompatPlugin.js +7 -0
- package/dist/runtime/plugins/toastPlugin.client.js +2 -2
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +24 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +6 -5
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +27 -17
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +10 -10
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.d.vue.ts +2 -0
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +60 -21
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +12 -1
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +109 -15
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +12 -1
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +14 -0
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +5 -2
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +15 -12
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +5 -2
- package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +10 -0
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +23 -69
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +10 -0
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.d.vue.ts +6 -2
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +22 -8
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue.d.ts +6 -2
- package/dist/runtime/presets/default/components/KLayout/KLayout.vue +2 -2
- package/dist/runtime/presets/default/components/KLoader/KLoader.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue +13 -2
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +1 -94
- package/dist/runtime/presets/default/components/KMultiTabs/KMultiTabs.vue +69 -4
- package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +18 -46
- package/dist/runtime/presets/default/components/KSlider/KSlider.vue +11 -23
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +24 -8
- package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KTree/KTree.vue +51 -80
- package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue +12 -2
- package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue.d.ts +1 -0
- package/dist/runtime/server/middleware/session.js +7 -0
- package/dist/runtime/utils/deprecation.d.ts +14 -0
- package/dist/runtime/utils/deprecation.js +44 -0
- package/dist/runtime/utils/dom.d.ts +31 -0
- package/dist/runtime/utils/dom.js +124 -0
- package/dist/skills/KATLUX_INDEX.md +15 -19
- package/dist/skills/katlux-components/components/KBulkActions.md +1 -1
- package/dist/skills/katlux-components/components/KDataIterator.md +5 -0
- package/dist/skills/katlux-components/components/KLayout.md +4 -0
- package/dist/skills/katlux-components/components/KLoader.md +3 -0
- package/dist/skills/katlux-components/components/KTextbox.md +1 -0
- package/dist/skills/katlux-config/SKILL.md +15 -7
- package/dist/skills/katlux-presets/SKILL.md +42 -2
- package/dist/skills/katlux-providers/SKILL.md +12 -0
- package/dist/skills/katlux-providers/providers/ADataProvider.md +1 -0
- package/dist/skills/katlux-providers/providers/CAPITreeServerDataProvider.md +13 -0
- package/dist/skills/katlux-providers/providers/RequestProvider.md +2 -2
- package/dist/skills/katlux-providers/providers/encryption-field-level.md +5 -2
- package/dist/skills/katlux-providers/providers/encryption-key-management.md +5 -2
- package/dist/skills/katlux-providers/providers/encryption-searchable.md +150 -27
- package/dist/skills/katlux-providers/providers/encryption-symmetric.md +4 -1
- package/dist/skills/katlux-providers/providers/encryption-threat-model.md +12 -6
- package/dist/skills/katlux-providers/providers/encryption.md +1 -1
- package/package.json +3 -3
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.KRangeSlider(:class="{ disabled: isDisabled }")
|
|
3
3
|
label.k-input-label(v-if="label") {{ label }}
|
|
4
|
-
.slider-container
|
|
4
|
+
.slider-container
|
|
5
5
|
.slider-track
|
|
6
6
|
.slider-range(:style="{ '--range-start': minPercent + '%', '--range-width': (maxPercent - minPercent) + '%' }")
|
|
7
7
|
input.slider-input.slider-min(
|
|
8
|
+
v-model.number="minInputValue"
|
|
8
9
|
type="range"
|
|
9
10
|
:min="rangeMin"
|
|
10
11
|
:max="rangeMax"
|
|
11
12
|
:step="rangeStep"
|
|
12
|
-
:value="currentMinValue"
|
|
13
13
|
:disabled="isDisabled"
|
|
14
|
-
@input="updateMinValue"
|
|
15
14
|
)
|
|
16
15
|
input.slider-input.slider-max(
|
|
16
|
+
v-model.number="maxInputValue"
|
|
17
17
|
type="range"
|
|
18
18
|
:min="rangeMin"
|
|
19
19
|
:max="rangeMax"
|
|
20
20
|
:step="rangeStep"
|
|
21
|
-
:value="currentMaxValue"
|
|
22
21
|
:disabled="isDisabled"
|
|
23
|
-
@input="updateMaxValue"
|
|
24
22
|
)
|
|
25
23
|
</template>
|
|
26
24
|
|
|
@@ -45,51 +43,25 @@ const emit = defineEmits<{
|
|
|
45
43
|
(e: 'update:maxValue', value: number): void
|
|
46
44
|
}>()
|
|
47
45
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const updateMaxValue = (event: Event) => {
|
|
57
|
-
const value = parseFloat((event.target as HTMLInputElement).value)
|
|
58
|
-
// Ensure max doesn't go below min
|
|
59
|
-
if (value >= props.currentMinValue) {
|
|
60
|
-
emit('update:maxValue', value)
|
|
46
|
+
const minInputValue = computed({
|
|
47
|
+
get: () => props.currentMinValue,
|
|
48
|
+
set: (val: number) => {
|
|
49
|
+
const numeric = Number(val)
|
|
50
|
+
if (!Number.isNaN(numeric) && numeric <= props.currentMaxValue) {
|
|
51
|
+
emit('update:minValue', numeric)
|
|
52
|
+
}
|
|
61
53
|
}
|
|
62
|
-
}
|
|
54
|
+
})
|
|
63
55
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const percentage = clickX / rect.width
|
|
71
|
-
const rawValue = props.rangeMin + (percentage * (props.rangeMax - props.rangeMin))
|
|
72
|
-
|
|
73
|
-
// Round to step
|
|
74
|
-
const steppedValue = Math.round(rawValue / props.rangeStep) * props.rangeStep
|
|
75
|
-
const value = Math.max(props.rangeMin, Math.min(props.rangeMax, steppedValue))
|
|
76
|
-
|
|
77
|
-
// Determine which handle is closer
|
|
78
|
-
const distanceToMin = Math.abs(value - props.currentMinValue)
|
|
79
|
-
const distanceToMax = Math.abs(value - props.currentMaxValue)
|
|
80
|
-
|
|
81
|
-
if (distanceToMin < distanceToMax) {
|
|
82
|
-
// Move min handle
|
|
83
|
-
if (value <= props.currentMaxValue) {
|
|
84
|
-
emit('update:minValue', value)
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
// Move max handle
|
|
88
|
-
if (value >= props.currentMinValue) {
|
|
89
|
-
emit('update:maxValue', value)
|
|
56
|
+
const maxInputValue = computed({
|
|
57
|
+
get: () => props.currentMaxValue,
|
|
58
|
+
set: (val: number) => {
|
|
59
|
+
const numeric = Number(val)
|
|
60
|
+
if (!Number.isNaN(numeric) && numeric >= props.currentMinValue) {
|
|
61
|
+
emit('update:maxValue', numeric)
|
|
90
62
|
}
|
|
91
63
|
}
|
|
92
|
-
}
|
|
64
|
+
})
|
|
93
65
|
</script>
|
|
94
66
|
|
|
95
67
|
<style lang="scss" scoped>
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.KSlider(:class="{ disabled: isDisabled }")
|
|
3
3
|
label.k-input-label(v-if="label") {{ label }}
|
|
4
|
-
.slider-container
|
|
4
|
+
.slider-container
|
|
5
5
|
.slider-track
|
|
6
6
|
.slider-fill(:style="{ '--slider-fill': valuePercent + '%' }")
|
|
7
7
|
input.slider-input(
|
|
8
|
+
v-model.number="sliderValue"
|
|
8
9
|
type="range"
|
|
9
10
|
:min="rangeMin"
|
|
10
11
|
:max="rangeMax"
|
|
11
12
|
:step="rangeStep"
|
|
12
|
-
:value="currentValue"
|
|
13
13
|
:disabled="isDisabled"
|
|
14
|
-
@input="updateValue"
|
|
15
14
|
)
|
|
16
15
|
</template>
|
|
17
16
|
|
|
@@ -33,26 +32,15 @@ const emit = defineEmits<{
|
|
|
33
32
|
(e: 'update:value', value: number): void
|
|
34
33
|
}>()
|
|
35
34
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const rect = target.getBoundingClientRect()
|
|
46
|
-
const clickX = event.clientX - rect.left
|
|
47
|
-
const percentage = clickX / rect.width
|
|
48
|
-
const rawValue = props.rangeMin + (percentage * (props.rangeMax - props.rangeMin))
|
|
49
|
-
|
|
50
|
-
// Round to step
|
|
51
|
-
const steppedValue = Math.round(rawValue / props.rangeStep) * props.rangeStep
|
|
52
|
-
const value = Math.max(props.rangeMin, Math.min(props.rangeMax, steppedValue))
|
|
53
|
-
|
|
54
|
-
emit('update:value', value)
|
|
55
|
-
}
|
|
35
|
+
const sliderValue = computed({
|
|
36
|
+
get: () => props.currentValue,
|
|
37
|
+
set: (val: number) => {
|
|
38
|
+
const numeric = Number(val)
|
|
39
|
+
if (!Number.isNaN(numeric)) {
|
|
40
|
+
emit('update:value', Math.max(props.rangeMin, Math.min(props.rangeMax, numeric)))
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
})
|
|
56
44
|
</script>
|
|
57
45
|
|
|
58
46
|
<style lang="scss" scoped>
|
|
@@ -3,12 +3,15 @@ type __VLS_Props = {
|
|
|
3
3
|
text: string;
|
|
4
4
|
showClear: boolean;
|
|
5
5
|
clear: () => void;
|
|
6
|
+
loading?: boolean;
|
|
6
7
|
placeholder: string;
|
|
7
8
|
type: string;
|
|
8
9
|
validation?: 'success' | 'warning' | 'error' | null;
|
|
9
10
|
validationText?: string;
|
|
10
11
|
};
|
|
11
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
13
|
+
focus: () => void | undefined;
|
|
14
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
12
15
|
"update:text": (value: string) => any;
|
|
13
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
17
|
"onUpdate:text"?: ((value: string) => any) | undefined;
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.KTextbox-wrapper(:class="$attrs.class" :style="$attrs.style")
|
|
3
3
|
label.k-input-label(v-if="label" :for="inputId") {{ label }}
|
|
4
|
-
.KTextbox(:class="validation ? `is-${validation}` : ''")
|
|
5
|
-
input(:id="inputId" v-bind="inputAttrs" :type="props.type" v-model="text" :placeholder="placeholder")
|
|
6
|
-
|
|
4
|
+
.KTextbox(:class="[validation ? `is-${validation}` : '', { 'is-loading': loading }]")
|
|
5
|
+
input(ref="inputRef" :id="inputId" v-bind="inputAttrs" :type="props.type" v-model="text" :placeholder="placeholder" :aria-busy="loading ? 'true' : undefined")
|
|
6
|
+
.KTextbox__actions(v-if="loading || showClear")
|
|
7
|
+
KLoader.KTextbox__loader(v-if="loading" :loading="loading" size="small")
|
|
8
|
+
KIcon(v-if="showClear" @click.stop="clear" @mousedown.stop iconname="close" width="10" height="10" role="button" :aria-label="t('Clear input')").closeIcon
|
|
7
9
|
span.validation-text(v-if="validation && ['success', 'warning', 'error'].includes(validation) && validationText" :class="`is-${validation}`") {{ validationText }}
|
|
8
10
|
</template>
|
|
9
11
|
|
|
10
12
|
<script lang="ts" setup>
|
|
11
|
-
import { computed, useAttrs, useId } from 'vue'
|
|
13
|
+
import { computed, ref, useAttrs, useId } from 'vue'
|
|
12
14
|
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
13
15
|
|
|
14
16
|
const { t } = useKatluxI18n()
|
|
15
17
|
const generatedId = useId()
|
|
18
|
+
const inputRef = ref<{ focus?: () => void } | null>(null)
|
|
19
|
+
|
|
20
|
+
defineExpose({
|
|
21
|
+
focus: () => inputRef.value?.focus?.()
|
|
22
|
+
})
|
|
16
23
|
|
|
17
24
|
defineOptions({
|
|
18
25
|
inheritAttrs: false
|
|
@@ -24,6 +31,7 @@ const props = defineProps<{
|
|
|
24
31
|
text: string
|
|
25
32
|
showClear: boolean
|
|
26
33
|
clear: () => void
|
|
34
|
+
loading?: boolean
|
|
27
35
|
placeholder: string
|
|
28
36
|
type: string
|
|
29
37
|
validation?: 'success' | 'warning' | 'error' | null
|
|
@@ -106,11 +114,19 @@ const inputAttrs = computed(() => {
|
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
|
|
117
|
+
.KTextbox__actions {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
gap: var(--gap-sm);
|
|
121
|
+
padding-right: var(--component-gap);
|
|
122
|
+
flex-shrink: 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.KTextbox__loader {
|
|
126
|
+
flex-shrink: 0;
|
|
127
|
+
}
|
|
128
|
+
|
|
109
129
|
.closeIcon {
|
|
110
|
-
position: absolute;
|
|
111
|
-
right: var(--component-gap);
|
|
112
|
-
top: 50%;
|
|
113
|
-
transform: translateY(-50%);
|
|
114
130
|
color: var(--icon-color-medium);
|
|
115
131
|
cursor: pointer;
|
|
116
132
|
flex-shrink: 0;
|
|
@@ -3,12 +3,15 @@ type __VLS_Props = {
|
|
|
3
3
|
text: string;
|
|
4
4
|
showClear: boolean;
|
|
5
5
|
clear: () => void;
|
|
6
|
+
loading?: boolean;
|
|
6
7
|
placeholder: string;
|
|
7
8
|
type: string;
|
|
8
9
|
validation?: 'success' | 'warning' | 'error' | null;
|
|
9
10
|
validationText?: string;
|
|
10
11
|
};
|
|
11
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
13
|
+
focus: () => void | undefined;
|
|
14
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
12
15
|
"update:text": (value: string) => any;
|
|
13
16
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
14
17
|
"onUpdate:text"?: ((value: string) => any) | undefined;
|
|
@@ -27,8 +27,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
27
27
|
onSelect?: ((row: TTreeRow) => any) | undefined;
|
|
28
28
|
}>, {
|
|
29
29
|
disabled: boolean;
|
|
30
|
-
idKey: string;
|
|
31
30
|
loading: boolean;
|
|
31
|
+
idKey: string;
|
|
32
32
|
searchtext: string;
|
|
33
33
|
virtualScroll: boolean;
|
|
34
34
|
itemHeight: number | ((node: any, index: number) => number);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.KTree(
|
|
3
|
-
ref="treeRootRef"
|
|
4
3
|
role="tree"
|
|
5
4
|
:aria-label="t('Hierarchical Tree')"
|
|
6
5
|
:class="{ 'is-virtual-scroll': props.virtualScroll }"
|
|
@@ -18,9 +17,10 @@
|
|
|
18
17
|
.tree-node(
|
|
19
18
|
v-for="(row, idx) in displayRows"
|
|
20
19
|
:key="getNodeKey(row, startIndex + idx)"
|
|
20
|
+
:ref="(el) => setVirtualNodeRef(getNodeKey(row, startIndex + idx), el)"
|
|
21
21
|
:data-node-id="getNodeKey(row, startIndex + idx)"
|
|
22
22
|
:class="{ 'has-children': (row.__treeNode?.hasChildren || row.hasChildren), 'is-selected': isSelected(row) }"
|
|
23
|
-
:style="
|
|
23
|
+
:style="getRowStyle(row, startIndex + idx)"
|
|
24
24
|
role="treeitem"
|
|
25
25
|
:aria-expanded="(row.__treeNode?.hasChildren || row.hasChildren) ? (row.__treeNode?.isExpanded ?? row.isExpanded) : undefined"
|
|
26
26
|
:aria-level="((row.__treeNode?.depth ?? row.depth ?? 0) + 1)"
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
:iconField="iconField"
|
|
73
73
|
:selectable="selectable"
|
|
74
74
|
:focusedNodeId="effectiveFocusedNodeId"
|
|
75
|
+
:focusRequestId="focusRequestId"
|
|
75
76
|
:isSelected="isSelected"
|
|
76
77
|
@focus="onNodeFocus"
|
|
77
78
|
@click="onNodeClick"
|
|
@@ -86,8 +87,7 @@
|
|
|
86
87
|
import { ref, computed, watch, nextTick } from 'vue'
|
|
87
88
|
import type { TTreeRow } from '@katlux/providers'
|
|
88
89
|
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
89
|
-
import {
|
|
90
|
-
import { useDataProvider } from '#toolkit/composables/useDataProvider'
|
|
90
|
+
import { useVirtualDataset } from '#toolkit/composables/useVirtualDataset'
|
|
91
91
|
import KTreeNodeItem, { type ITreeRenderNode } from './KTreeNodeItem.vue'
|
|
92
92
|
|
|
93
93
|
const { t } = useKatluxI18n()
|
|
@@ -161,90 +161,42 @@ const isSelected = (row: TTreeRow): boolean => {
|
|
|
161
161
|
return false
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
const {
|
|
164
|
+
const {
|
|
165
|
+
datasetItems,
|
|
166
|
+
displayRows: datasetDisplayRows,
|
|
167
|
+
startIndex,
|
|
168
|
+
containerRef,
|
|
169
|
+
onScroll,
|
|
170
|
+
scrollToIndex,
|
|
171
|
+
containerCssVars,
|
|
172
|
+
isLoading: datasetIsLoading
|
|
173
|
+
} = useVirtualDataset<TTreeRow>({
|
|
174
|
+
dataProvider: () => props.dataProvider,
|
|
175
|
+
virtualScroll: () => !!props.virtualScroll,
|
|
176
|
+
itemHeight: () => (typeof props.itemHeight === 'function' ? props.itemHeight : (props.itemHeight || 32)),
|
|
177
|
+
viewportHeight: () => props.viewportHeight || 400,
|
|
178
|
+
buffer: () => props.buffer ?? 5,
|
|
179
|
+
idKey: () => props.idKey || 'id'
|
|
180
|
+
})
|
|
165
181
|
|
|
166
182
|
const isLoading = computed(() => {
|
|
167
183
|
if (typeof props.loading === 'boolean') {
|
|
168
184
|
return props.loading
|
|
169
185
|
}
|
|
170
|
-
|
|
171
|
-
return Boolean(dpLoading.value || dpInitialLoad.value)
|
|
172
|
-
}
|
|
173
|
-
return false
|
|
186
|
+
return Boolean(datasetIsLoading.value)
|
|
174
187
|
})
|
|
175
188
|
|
|
176
189
|
// Virtual scrolling data source
|
|
177
190
|
const treeRows = computed<TTreeRow[]>(() => {
|
|
178
|
-
const _ver = dpStateVersion?.value
|
|
179
|
-
const currentVisible = props.visibleRows || []
|
|
180
|
-
const dp = props.dataProvider as any
|
|
181
191
|
if (props.virtualScroll) {
|
|
182
|
-
|
|
183
|
-
if (Array.isArray(dp?.allVisibleRows?.value)) return dp.allVisibleRows.value
|
|
184
|
-
if (Array.isArray(dp?.allVisibleNodes)) return dp.allVisibleNodes
|
|
185
|
-
if (Array.isArray(dp?.allVisibleNodes?.value)) return dp.allVisibleNodes.value
|
|
186
|
-
if (Array.isArray(dp?.visibleRows)) return dp.visibleRows
|
|
187
|
-
if (Array.isArray(dp?.visibleRows?.value)) return dp.visibleRows.value
|
|
188
|
-
}
|
|
189
|
-
return currentVisible
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
const {
|
|
193
|
-
visibleItems,
|
|
194
|
-
startIndex,
|
|
195
|
-
endIndex,
|
|
196
|
-
topSpacerHeight,
|
|
197
|
-
bottomSpacerHeight,
|
|
198
|
-
containerRef,
|
|
199
|
-
onScroll,
|
|
200
|
-
scrollToIndex,
|
|
201
|
-
containerCssVars
|
|
202
|
-
} = useVirtualScroll({
|
|
203
|
-
items: treeRows,
|
|
204
|
-
itemHeight: computed(() => (typeof props.itemHeight === 'function' ? props.itemHeight : (props.itemHeight || 32))),
|
|
205
|
-
containerHeight: computed(() => props.viewportHeight || 400),
|
|
206
|
-
buffer: props.buffer ?? 5,
|
|
207
|
-
virtualScroll: computed(() => !!props.virtualScroll),
|
|
208
|
-
onThresholdReach: () => {
|
|
209
|
-
const dp = props.dataProvider as any
|
|
210
|
-
if (typeof dp?.loadMore === 'function') {
|
|
211
|
-
dp.loadMore()
|
|
212
|
-
}
|
|
192
|
+
return datasetItems.value
|
|
213
193
|
}
|
|
194
|
+
return props.visibleRows || []
|
|
214
195
|
})
|
|
215
196
|
|
|
216
|
-
|
|
217
|
-
[startIndex, endIndex, () => props.virtualScroll],
|
|
218
|
-
([start, end, isVirt]) => {
|
|
219
|
-
if (!isVirt) return
|
|
220
|
-
const dp = props.dataProvider as any
|
|
221
|
-
if (!dp) return
|
|
222
|
-
if (typeof dp.resolveRangeRows === 'function') {
|
|
223
|
-
dp.resolveRangeRows(start, end)
|
|
224
|
-
} else if (typeof dp.getWindowRows === 'function') {
|
|
225
|
-
dp.getWindowRows(start, end)
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
{ immediate: true }
|
|
229
|
-
)
|
|
230
|
-
|
|
231
|
-
const displayRows = computed(() => {
|
|
197
|
+
const displayRows = computed<TTreeRow[]>(() => {
|
|
232
198
|
if (props.virtualScroll) {
|
|
233
|
-
|
|
234
|
-
return visibleItems.value.map((r: any) => {
|
|
235
|
-
if (dp && dp.isEncryptionEnabled && typeof dp._decryptedNodeMap?.get === 'function') {
|
|
236
|
-
const id = r?.[props.idKey] ?? r?.id ?? r?.__treeNode?.id
|
|
237
|
-
const dec = dp._decryptedNodeMap.get(id)
|
|
238
|
-
if (dec) {
|
|
239
|
-
return {
|
|
240
|
-
...r,
|
|
241
|
-
...dec,
|
|
242
|
-
data: { ...(r.data || {}), ...dec }
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return r
|
|
247
|
-
})
|
|
199
|
+
return datasetDisplayRows.value
|
|
248
200
|
}
|
|
249
201
|
return props.visibleRows || []
|
|
250
202
|
})
|
|
@@ -318,6 +270,16 @@ const getNodeKey = (row: TTreeRow, idx?: number): string | number => {
|
|
|
318
270
|
return row[props.idKey] ?? row.id ?? row.__treeNode?.id ?? (idx !== undefined ? idx : 0)
|
|
319
271
|
}
|
|
320
272
|
|
|
273
|
+
const getRowStyle = (row: TTreeRow, index: number): Record<string, string | number> => {
|
|
274
|
+
const style: Record<string, string | number> = {
|
|
275
|
+
'--tree-depth': row.__treeNode?.depth ?? row.depth ?? 0
|
|
276
|
+
}
|
|
277
|
+
if (typeof props.itemHeight === 'function') {
|
|
278
|
+
style.height = `${props.itemHeight(row, index)}px`
|
|
279
|
+
}
|
|
280
|
+
return style
|
|
281
|
+
}
|
|
282
|
+
|
|
321
283
|
const effectiveFocusedNodeId = computed<string | number | null>(() => {
|
|
322
284
|
if (focusedNodeId.value !== null) return focusedNodeId.value
|
|
323
285
|
const visibleList = props.virtualScroll ? treeRows.value : (props.visibleRows || [])
|
|
@@ -336,7 +298,17 @@ const onNodeFocus = (row: TTreeRow, key?: string | number) => {
|
|
|
336
298
|
focusedNodeId.value = key ?? getNodeKey(row)
|
|
337
299
|
}
|
|
338
300
|
|
|
339
|
-
const
|
|
301
|
+
const focusRequestId = ref(0)
|
|
302
|
+
const virtualNodeRefs = new Map<string, { focus?: () => void }>()
|
|
303
|
+
|
|
304
|
+
const setVirtualNodeRef = (key: string | number, el: unknown) => {
|
|
305
|
+
const k = String(key)
|
|
306
|
+
if (el && typeof (el as { focus?: () => void }).focus === 'function') {
|
|
307
|
+
virtualNodeRefs.set(k, el as { focus?: () => void })
|
|
308
|
+
} else {
|
|
309
|
+
virtualNodeRefs.delete(k)
|
|
310
|
+
}
|
|
311
|
+
}
|
|
340
312
|
|
|
341
313
|
const setFocusToNode = (row: TTreeRow, idx?: number) => {
|
|
342
314
|
const key = getNodeKey(row, idx)
|
|
@@ -358,11 +330,10 @@ const setFocusToNode = (row: TTreeRow, idx?: number) => {
|
|
|
358
330
|
}
|
|
359
331
|
}
|
|
360
332
|
nextTick(() => {
|
|
361
|
-
|
|
362
|
-
if (
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
targetEl?.focus()
|
|
333
|
+
focusRequestId.value++
|
|
334
|
+
if (props.virtualScroll) {
|
|
335
|
+
virtualNodeRefs.get(String(key))?.focus?.()
|
|
336
|
+
}
|
|
366
337
|
})
|
|
367
338
|
}
|
|
368
339
|
|
|
@@ -27,8 +27,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
27
27
|
onSelect?: ((row: TTreeRow) => any) | undefined;
|
|
28
28
|
}>, {
|
|
29
29
|
disabled: boolean;
|
|
30
|
-
idKey: string;
|
|
31
30
|
loading: boolean;
|
|
31
|
+
idKey: string;
|
|
32
32
|
searchtext: string;
|
|
33
33
|
virtualScroll: boolean;
|
|
34
34
|
itemHeight: number | ((node: any, index: number) => number);
|
|
@@ -10,6 +10,7 @@ type __VLS_Props = {
|
|
|
10
10
|
iconField: string;
|
|
11
11
|
selectable: boolean;
|
|
12
12
|
focusedNodeId: string | number | null;
|
|
13
|
+
focusRequestId?: number;
|
|
13
14
|
isSelected: (row: TTreeRow) => boolean;
|
|
14
15
|
};
|
|
15
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.tree-node(
|
|
3
|
+
ref="nodeRef"
|
|
3
4
|
:data-node-id="node.key"
|
|
4
5
|
:class="{ 'has-children': hasChildren, 'is-selected': isSelected(node.row) }"
|
|
5
6
|
:style="{ '--tree-depth': node.row.__treeNode?.depth ?? node.row.depth ?? 0 }"
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
:iconField="iconField"
|
|
51
52
|
:selectable="selectable"
|
|
52
53
|
:focusedNodeId="focusedNodeId"
|
|
54
|
+
:focusRequestId="focusRequestId"
|
|
53
55
|
:isSelected="isSelected"
|
|
54
56
|
@focus="(row, key) => $emit('focus', row, key)"
|
|
55
57
|
@click="row => $emit('click', row)"
|
|
@@ -61,7 +63,7 @@
|
|
|
61
63
|
</template>
|
|
62
64
|
|
|
63
65
|
<script lang="ts" setup>
|
|
64
|
-
import { computed } from 'vue'
|
|
66
|
+
import { computed, ref, watch } from 'vue'
|
|
65
67
|
import type { TTreeRow } from '@katlux/providers'
|
|
66
68
|
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
67
69
|
|
|
@@ -72,6 +74,7 @@ export interface ITreeRenderNode {
|
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
const { t } = useKatluxI18n()
|
|
77
|
+
const nodeRef = ref<{ focus?: () => void } | null>(null)
|
|
75
78
|
|
|
76
79
|
const props = defineProps<{
|
|
77
80
|
node: ITreeRenderNode
|
|
@@ -79,6 +82,7 @@ const props = defineProps<{
|
|
|
79
82
|
iconField: string
|
|
80
83
|
selectable: boolean
|
|
81
84
|
focusedNodeId: string | number | null
|
|
85
|
+
focusRequestId?: number
|
|
82
86
|
isSelected: (row: TTreeRow) => boolean
|
|
83
87
|
}>()
|
|
84
88
|
|
|
@@ -98,7 +102,13 @@ const isExpanded = computed(() => {
|
|
|
98
102
|
})
|
|
99
103
|
|
|
100
104
|
const isFocused = computed(() => {
|
|
101
|
-
return props.focusedNodeId === props.node.key
|
|
105
|
+
return String(props.focusedNodeId) === String(props.node.key)
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
watch(() => props.focusRequestId, (reqId, prevReqId) => {
|
|
109
|
+
if (reqId && reqId !== prevReqId && isFocused.value) {
|
|
110
|
+
nodeRef.value?.focus?.()
|
|
111
|
+
}
|
|
102
112
|
})
|
|
103
113
|
</script>
|
|
104
114
|
|
|
@@ -10,6 +10,7 @@ type __VLS_Props = {
|
|
|
10
10
|
iconField: string;
|
|
11
11
|
selectable: boolean;
|
|
12
12
|
focusedNodeId: string | number | null;
|
|
13
|
+
focusRequestId?: number;
|
|
13
14
|
isSelected: (row: TTreeRow) => boolean;
|
|
14
15
|
};
|
|
15
16
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { defineEventHandler, getCookie, setCookie } from "h3";
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
+
const ssrEventStorage = new AsyncLocalStorage();
|
|
4
|
+
if (typeof globalThis !== "undefined" && !globalThis.__katlux_get_event) {
|
|
5
|
+
;
|
|
6
|
+
globalThis.__katlux_get_event = () => ssrEventStorage.getStore();
|
|
7
|
+
}
|
|
2
8
|
export default defineEventHandler((event) => {
|
|
9
|
+
ssrEventStorage.enterWith(event);
|
|
3
10
|
const path = event.path || event.node?.req?.url || "";
|
|
4
11
|
if (path.startsWith("/_nuxt") || path.startsWith("/__") || /\.(js|css|png|jpg|jpeg|svg|ico|woff2?|map)$/i.test(path)) {
|
|
5
12
|
return;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs a one-time deprecation warning in non-production environments.
|
|
3
|
+
*/
|
|
4
|
+
export declare function warnDeprecatedOnce(key: string, message: string): void;
|
|
5
|
+
/**
|
|
6
|
+
* Clears recorded deprecation warnings (for deterministic unit testing).
|
|
7
|
+
*/
|
|
8
|
+
export declare function clearDeprecationWarnings(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Creates an event emitter bound to the current setup() component instance
|
|
11
|
+
* that emits both canonical events and backward-compatible legacy aliases,
|
|
12
|
+
* logging a dev-mode deprecation warning when legacy listeners are used.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createLegacyEventEmitter<TEmit extends (...args: any[]) => void>(componentName: string, emit?: TEmit): (canonicalEvent: string, legacyEvents: string[], payload: any) => void;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { getCurrentInstance } from "vue";
|
|
2
|
+
const warnedDeprecations = /* @__PURE__ */ new Set();
|
|
3
|
+
function isProductionEnv() {
|
|
4
|
+
return typeof process !== "undefined" && process.env?.NODE_ENV === "production";
|
|
5
|
+
}
|
|
6
|
+
function toCamelCase(eventName) {
|
|
7
|
+
return eventName.replace(/-([a-z])/g, (_, ch) => ch.toUpperCase());
|
|
8
|
+
}
|
|
9
|
+
function capitalize(str) {
|
|
10
|
+
return str ? str.charAt(0).toUpperCase() + str.slice(1) : "";
|
|
11
|
+
}
|
|
12
|
+
function hasLegacyListener(vnodeProps, eventName) {
|
|
13
|
+
if (!vnodeProps) return false;
|
|
14
|
+
const exactKey = `on${capitalize(eventName)}`;
|
|
15
|
+
const camelKey = `on${capitalize(toCamelCase(eventName))}`;
|
|
16
|
+
return typeof vnodeProps[exactKey] === "function" || typeof vnodeProps[camelKey] === "function";
|
|
17
|
+
}
|
|
18
|
+
export function warnDeprecatedOnce(key, message) {
|
|
19
|
+
if (isProductionEnv() || warnedDeprecations.has(key)) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
warnedDeprecations.add(key);
|
|
23
|
+
console.warn(`[Katlux Toolkit]: ${message}`);
|
|
24
|
+
}
|
|
25
|
+
export function clearDeprecationWarnings() {
|
|
26
|
+
warnedDeprecations.clear();
|
|
27
|
+
}
|
|
28
|
+
export function createLegacyEventEmitter(componentName, emit) {
|
|
29
|
+
const instance = getCurrentInstance();
|
|
30
|
+
return (canonicalEvent, legacyEvents, payload) => {
|
|
31
|
+
if (!emit) return;
|
|
32
|
+
emit(canonicalEvent, payload);
|
|
33
|
+
const vnodeProps = instance?.vnode?.props;
|
|
34
|
+
for (const legacyEvent of legacyEvents) {
|
|
35
|
+
if (!instance || hasLegacyListener(vnodeProps, legacyEvent)) {
|
|
36
|
+
warnDeprecatedOnce(
|
|
37
|
+
`${componentName}:${legacyEvent}`,
|
|
38
|
+
`<${componentName}> event "@${legacyEvent}" is deprecated and will be removed in a future release. Use "@${canonicalEvent}" instead.`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
emit(legacyEvent, payload);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ComponentPublicInstance } from 'vue';
|
|
2
|
+
export interface MeasurableAndFocusableElement extends Element {
|
|
3
|
+
focus?: (options?: FocusOptions) => void;
|
|
4
|
+
tabIndex?: number;
|
|
5
|
+
}
|
|
6
|
+
export type DomTargetLike = Element | Node | ComponentPublicInstance | {
|
|
7
|
+
$el?: unknown;
|
|
8
|
+
focus?: () => void;
|
|
9
|
+
getBoundingClientRect?: () => DOMRect;
|
|
10
|
+
} | null | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Resolves one or more rendered DOM `Element` nodes from a Vue template ref,
|
|
13
|
+
* `ComponentPublicInstance` (including multi-root fragment components), or raw `Node`/`Element`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveElements(target: unknown): Element[];
|
|
16
|
+
/**
|
|
17
|
+
* Resolves a single DOM `Element` (or test mock exposing DOM measurement/event methods)
|
|
18
|
+
* from a ref, `ComponentPublicInstance` (single-root or fragment), or element.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveElement<T extends Element = MeasurableAndFocusableElement>(target: unknown): T | null;
|
|
21
|
+
/**
|
|
22
|
+
* Focuses a component instance (via exposed `focus()` contract) or a DOM element
|
|
23
|
+
* (including multi-root fragment components), returning `true` when a target was focused.
|
|
24
|
+
*/
|
|
25
|
+
export declare function focusTarget(target: unknown): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the `<Teleport>` target for floating overlays (`KDropdown`, `KContextMenu`)
|
|
28
|
+
* when rendered inside a `KModal`, falling back safely to `'body'` if a custom modal
|
|
29
|
+
* preset does not mount a portal host element with `modalPortalId`.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveModalTeleportTarget(explicitTeleportTo: string | undefined, modalPortalId: unknown): string;
|