@katlux/toolkit 0.1.1-alpha.146 → 0.1.1-alpha.148
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/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 +1 -1
- package/dist/runtime/components/KButton/KButton.global.vue.d.ts +1 -1
- 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 +1 -1
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +1 -1
- 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 +24 -1
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue +19 -7
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +24 -1
- 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 +6 -4
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +45 -26
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +6 -4
- 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 +3 -3
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +3 -3
- 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.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/KRangeSlider/KRangeSlider.global.d.vue.ts +1 -1
- package/dist/runtime/components/KRangeSlider/KRangeSlider.global.vue.d.ts +1 -1
- 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/KTabs.logic.js +33 -11
- 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 +12 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.vue +8 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +12 -1
- 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
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
aria-orientation="vertical"
|
|
11
11
|
tabindex="-1"
|
|
12
12
|
@keydown="handleKeydown"
|
|
13
|
+
@click.capture="handleMenuClick"
|
|
13
14
|
v-bind="$attrs"
|
|
14
15
|
)
|
|
15
16
|
KPanel.KContextMenu-container(:style="containerStyle")
|
|
16
|
-
slot(:close="
|
|
17
|
+
slot(:close="closeMenuHandler")
|
|
17
18
|
</template>
|
|
18
19
|
|
|
19
20
|
<script lang="ts" setup>
|
|
@@ -28,14 +29,45 @@ const props = defineProps<{
|
|
|
28
29
|
open: boolean
|
|
29
30
|
menuRect: { top: number, left: number, maxHeight: number }
|
|
30
31
|
clickoutside: () => void
|
|
32
|
+
closeMenu?: () => void
|
|
33
|
+
focusRequestId?: number
|
|
31
34
|
teleportTarget: string | null
|
|
32
35
|
isInModal: boolean
|
|
33
36
|
}>()
|
|
34
37
|
|
|
35
38
|
const emit = defineEmits(['update:isOpen', 'registerRef', 'registerSourceRef'])
|
|
36
39
|
|
|
37
|
-
const
|
|
38
|
-
|
|
40
|
+
const closeMenuHandler = () => {
|
|
41
|
+
;(props.closeMenu ?? props.clickoutside)()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface FocusableMenuNode extends Element {
|
|
45
|
+
focus?: () => void
|
|
46
|
+
click?: () => void
|
|
47
|
+
offsetParent?: Element | null
|
|
48
|
+
isConnected: boolean
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const internalMenuRef = ref<FocusableMenuNode | null>(null)
|
|
52
|
+
const sourceElementRef = ref<Element | null>(null)
|
|
53
|
+
let previousActiveTarget: { focus?: () => void; isConnected?: boolean } | null = null
|
|
54
|
+
|
|
55
|
+
const handleMenuClick = (e: MouseEvent) => {
|
|
56
|
+
const target = e.target as Element | null
|
|
57
|
+
if (!target || typeof target.closest !== 'function' || !internalMenuRef.value) return
|
|
58
|
+
const item = target.closest(
|
|
59
|
+
'a, button, [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], .menu-link'
|
|
60
|
+
)
|
|
61
|
+
if (!item || !internalMenuRef.value.contains(item)) return
|
|
62
|
+
if (
|
|
63
|
+
item.hasAttribute('disabled') ||
|
|
64
|
+
item.getAttribute('aria-disabled') === 'true' ||
|
|
65
|
+
item.classList.contains('disabled')
|
|
66
|
+
) {
|
|
67
|
+
return
|
|
68
|
+
}
|
|
69
|
+
closeMenuHandler()
|
|
70
|
+
}
|
|
39
71
|
|
|
40
72
|
const menuStyle = computed(() => ({
|
|
41
73
|
top: `${props.menuRect.top}px`,
|
|
@@ -46,10 +78,10 @@ const containerStyle = computed(() => ({
|
|
|
46
78
|
maxHeight: `${props.menuRect.maxHeight}px`
|
|
47
79
|
}))
|
|
48
80
|
|
|
49
|
-
const getFocusableItems = ():
|
|
81
|
+
const getFocusableItems = (): FocusableMenuNode[] => {
|
|
50
82
|
if (!internalMenuRef.value) return []
|
|
51
83
|
return Array.from(
|
|
52
|
-
internalMenuRef.value.querySelectorAll<
|
|
84
|
+
internalMenuRef.value.querySelectorAll<FocusableMenuNode>(
|
|
53
85
|
'a[href], button:not([disabled]), [role="menuitem"], [tabindex]:not([tabindex="-1"])'
|
|
54
86
|
)
|
|
55
87
|
).filter(el => el.offsetParent !== null)
|
|
@@ -61,20 +93,20 @@ const handleKeydown = (e: KeyboardEvent) => {
|
|
|
61
93
|
if (e.key === 'Escape') {
|
|
62
94
|
e.preventDefault()
|
|
63
95
|
e.stopPropagation()
|
|
64
|
-
|
|
96
|
+
closeMenuHandler()
|
|
65
97
|
return
|
|
66
98
|
}
|
|
67
99
|
|
|
68
100
|
if (e.key === 'Tab') {
|
|
69
101
|
e.stopPropagation()
|
|
70
|
-
|
|
102
|
+
closeMenuHandler()
|
|
71
103
|
return
|
|
72
104
|
}
|
|
73
105
|
|
|
74
106
|
const items = getFocusableItems()
|
|
75
107
|
if (items.length === 0) return
|
|
76
108
|
|
|
77
|
-
const activeEl = typeof document !== 'undefined' ? (document.activeElement as
|
|
109
|
+
const activeEl = typeof document !== 'undefined' ? (document.activeElement as FocusableMenuNode | null) : null
|
|
78
110
|
const currentIndex = activeEl ? items.indexOf(activeEl) : -1
|
|
79
111
|
|
|
80
112
|
switch (e.key) {
|
|
@@ -82,33 +114,33 @@ const handleKeydown = (e: KeyboardEvent) => {
|
|
|
82
114
|
e.preventDefault()
|
|
83
115
|
e.stopPropagation()
|
|
84
116
|
const nextIndex = currentIndex < items.length - 1 ? currentIndex + 1 : 0
|
|
85
|
-
items[nextIndex]?.focus()
|
|
117
|
+
items[nextIndex]?.focus?.()
|
|
86
118
|
break
|
|
87
119
|
}
|
|
88
120
|
case 'ArrowUp': {
|
|
89
121
|
e.preventDefault()
|
|
90
122
|
e.stopPropagation()
|
|
91
123
|
const prevIndex = currentIndex > 0 ? currentIndex - 1 : items.length - 1
|
|
92
|
-
items[prevIndex]?.focus()
|
|
124
|
+
items[prevIndex]?.focus?.()
|
|
93
125
|
break
|
|
94
126
|
}
|
|
95
127
|
case 'Home': {
|
|
96
128
|
e.preventDefault()
|
|
97
129
|
e.stopPropagation()
|
|
98
|
-
items[0]?.focus()
|
|
130
|
+
items[0]?.focus?.()
|
|
99
131
|
break
|
|
100
132
|
}
|
|
101
133
|
case 'End': {
|
|
102
134
|
e.preventDefault()
|
|
103
135
|
e.stopPropagation()
|
|
104
|
-
items[items.length - 1]?.focus()
|
|
136
|
+
items[items.length - 1]?.focus?.()
|
|
105
137
|
break
|
|
106
138
|
}
|
|
107
139
|
case ' ': {
|
|
108
140
|
if (activeEl && activeEl.tagName === 'A') {
|
|
109
141
|
e.preventDefault()
|
|
110
142
|
e.stopPropagation()
|
|
111
|
-
activeEl.click()
|
|
143
|
+
activeEl.click?.()
|
|
112
144
|
}
|
|
113
145
|
break
|
|
114
146
|
}
|
|
@@ -118,20 +150,29 @@ const handleKeydown = (e: KeyboardEvent) => {
|
|
|
118
150
|
const handleWindowKeydown = (e: KeyboardEvent) => {
|
|
119
151
|
if (e.key === 'Escape' && props.open) {
|
|
120
152
|
e.preventDefault()
|
|
121
|
-
|
|
153
|
+
closeMenuHandler()
|
|
122
154
|
}
|
|
123
155
|
}
|
|
124
156
|
|
|
157
|
+
watch(() => props.focusRequestId, (reqId, prevReqId) => {
|
|
158
|
+
if (reqId && reqId !== prevReqId && previousActiveTarget && previousActiveTarget.isConnected !== false) {
|
|
159
|
+
previousActiveTarget.focus?.()
|
|
160
|
+
previousActiveTarget = null
|
|
161
|
+
}
|
|
162
|
+
})
|
|
163
|
+
|
|
125
164
|
watch(() => props.open, (isOpen) => {
|
|
126
165
|
if (typeof window !== 'undefined') {
|
|
127
166
|
if (isOpen) {
|
|
167
|
+
const currentActive = document.activeElement as { focus?: () => void; isConnected?: boolean } | null
|
|
168
|
+
previousActiveTarget = currentActive && typeof currentActive.focus === 'function' ? currentActive : null
|
|
128
169
|
window.addEventListener('keydown', handleWindowKeydown)
|
|
129
170
|
nextTick(() => {
|
|
130
171
|
const items = getFocusableItems()
|
|
131
172
|
if (items.length > 0) {
|
|
132
|
-
items[0].focus()
|
|
173
|
+
items[0].focus?.()
|
|
133
174
|
} else if (internalMenuRef.value) {
|
|
134
|
-
internalMenuRef.value.focus()
|
|
175
|
+
internalMenuRef.value.focus?.()
|
|
135
176
|
}
|
|
136
177
|
})
|
|
137
178
|
} else {
|
|
@@ -176,11 +217,9 @@ watch(sourceElementRef, (newVal) => {
|
|
|
176
217
|
max-width: 100vw;
|
|
177
218
|
box-shadow: var(--shadow-xl);
|
|
178
219
|
overflow: hidden;
|
|
179
|
-
:deep {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
overflow-y: auto;
|
|
183
|
-
}
|
|
220
|
+
:deep(.KPanel--content) {
|
|
221
|
+
padding: var(--component-gap);
|
|
222
|
+
overflow-y: auto;
|
|
184
223
|
}
|
|
185
224
|
}
|
|
186
225
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ADataProvider } from '@katlux/providers';
|
|
2
2
|
import type { IKDatatableAction, IDataFilter } from '@katlux/providers';
|
|
3
|
+
import { type KDataIteratorLayout } from '#toolkit/components/KDatatable/KDataIterator.logic';
|
|
3
4
|
type __VLS_Props = {
|
|
4
5
|
dataProvider: ADataProvider;
|
|
5
6
|
visibleFields?: Array<string> | null;
|
|
@@ -21,6 +22,9 @@ type __VLS_Props = {
|
|
|
21
22
|
viewportHeight?: number;
|
|
22
23
|
buffer?: number;
|
|
23
24
|
urlPageParam?: string;
|
|
25
|
+
layout?: KDataIteratorLayout;
|
|
26
|
+
columns?: number | string;
|
|
27
|
+
showLayoutToggle?: boolean;
|
|
24
28
|
};
|
|
25
29
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
26
30
|
"update:currentPage": (value: number) => any;
|
|
@@ -31,6 +35,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
31
35
|
"update:selectAllScope": (value: "page" | "dataset") => any;
|
|
32
36
|
"update:unselectedRows": (value: any[]) => any;
|
|
33
37
|
"update:filter": (value: IDataFilter | null) => any;
|
|
38
|
+
"update:layout": (value: KDataIteratorLayout) => any;
|
|
39
|
+
"update:columns": (value: number) => any;
|
|
34
40
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
35
41
|
"onUpdate:currentPage"?: ((value: number) => any) | undefined;
|
|
36
42
|
"onUpdate:pageSize"?: ((value: number) => any) | undefined;
|
|
@@ -40,18 +46,23 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
40
46
|
"onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
|
|
41
47
|
"onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
|
|
42
48
|
"onUpdate:filter"?: ((value: IDataFilter | null) => any) | undefined;
|
|
49
|
+
"onUpdate:layout"?: ((value: KDataIteratorLayout) => any) | undefined;
|
|
50
|
+
"onUpdate:columns"?: ((value: number) => any) | undefined;
|
|
43
51
|
}>, {
|
|
44
52
|
filter: IDataFilter | null;
|
|
45
53
|
selectedRows: any[];
|
|
46
54
|
unselectedRows: any[];
|
|
47
55
|
selectAll: boolean;
|
|
56
|
+
selectAllScope: "page" | "dataset";
|
|
48
57
|
virtualScroll: boolean;
|
|
49
58
|
itemHeight: number | ((row: any, index: number) => number);
|
|
50
59
|
buffer: number;
|
|
51
60
|
viewportHeight: number;
|
|
52
|
-
selectAllScope: "page" | "dataset";
|
|
53
61
|
gap: number;
|
|
54
62
|
urlPageParam: string;
|
|
63
|
+
layout: KDataIteratorLayout;
|
|
64
|
+
columns: number | string;
|
|
65
|
+
showLayoutToggle: boolean;
|
|
55
66
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
56
67
|
declare const _default: typeof __VLS_export;
|
|
57
68
|
export default _default;
|
|
@@ -2,10 +2,29 @@
|
|
|
2
2
|
.k-data-iterator(
|
|
3
3
|
role="region"
|
|
4
4
|
:aria-label="t('Data Iterator')"
|
|
5
|
-
:class="{ 'is-virtual-scroll': props.virtualScroll }"
|
|
6
|
-
:style="
|
|
5
|
+
:class="{ 'is-virtual-scroll': props.virtualScroll, 'is-grid': isGridLayout, 'is-list': !isGridLayout }"
|
|
6
|
+
:style="rootCssVars"
|
|
7
7
|
)
|
|
8
8
|
KLoader(:loading="isLoading" overlay)
|
|
9
|
+
.k-data-iterator-toolbar(
|
|
10
|
+
v-if="props.showLayoutToggle"
|
|
11
|
+
role="group"
|
|
12
|
+
:aria-label="t('Layout view')"
|
|
13
|
+
)
|
|
14
|
+
KButton.k-data-iterator-layout-btn(
|
|
15
|
+
size="small"
|
|
16
|
+
:type="!isGridLayout ? 'primary' : 'light'"
|
|
17
|
+
:aria-label="t('List view')"
|
|
18
|
+
:aria-pressed="!isGridLayout"
|
|
19
|
+
@click="setLayout('list')"
|
|
20
|
+
) {{ t('List') }}
|
|
21
|
+
KButton.k-data-iterator-layout-btn(
|
|
22
|
+
size="small"
|
|
23
|
+
:type="isGridLayout ? 'primary' : 'light'"
|
|
24
|
+
:aria-label="t('Grid view')"
|
|
25
|
+
:aria-pressed="isGridLayout"
|
|
26
|
+
@click="setLayout('grid')"
|
|
27
|
+
) {{ t('Grid') }}
|
|
9
28
|
KGrid(v-if="hasData" direction="column" align="stretch")
|
|
10
29
|
//- Virtual scrolling mode
|
|
11
30
|
.k-data-iterator-virtual-container(
|
|
@@ -20,18 +39,20 @@
|
|
|
20
39
|
@keydown.up.prevent="onKeyDownUp"
|
|
21
40
|
)
|
|
22
41
|
.k-virtual-spacer.is-top(aria-hidden="true")
|
|
23
|
-
.k-data-iterator-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
42
|
+
.k-data-iterator-items(:class="{ 'is-grid': isGridLayout, 'is-list': !isGridLayout }")
|
|
43
|
+
.k-data-iterator-item.k-data-item(
|
|
44
|
+
v-for="(row, index) in displayRows"
|
|
45
|
+
:key="getRowKey(row, startIndex + index)"
|
|
46
|
+
:data-index="startIndex + index"
|
|
47
|
+
:style="getRowStyle(row, startIndex + index)"
|
|
48
|
+
)
|
|
49
|
+
slot(name="row" :row="row" :index="startIndex + index" :rowActions="props.rowActions")
|
|
50
|
+
slot(:row="row" :index="startIndex + index" :rowActions="props.rowActions")
|
|
30
51
|
.k-virtual-spacer.is-bottom(aria-hidden="true")
|
|
31
52
|
|
|
32
53
|
//- Traditional paginated mode
|
|
33
|
-
|
|
34
|
-
.k-data-iterator-item(v-for="(row, index) in pageRows" :key="getRowKey(row, index)")
|
|
54
|
+
.k-data-iterator-items(v-else :class="{ 'is-grid': isGridLayout, 'is-list': !isGridLayout }")
|
|
55
|
+
.k-data-iterator-item.k-data-item(v-for="(row, index) in pageRows" :key="getRowKey(row, index)")
|
|
35
56
|
slot(name="row" :row="row" :index="index" :rowActions="props.rowActions")
|
|
36
57
|
slot(:row="row" :index="index" :rowActions="props.rowActions")
|
|
37
58
|
|
|
@@ -50,11 +71,12 @@
|
|
|
50
71
|
</template>
|
|
51
72
|
|
|
52
73
|
<script setup lang="ts">
|
|
53
|
-
import { computed } from 'vue'
|
|
74
|
+
import { computed, ref, watch } from 'vue'
|
|
54
75
|
import { ADataProvider } from '@katlux/providers'
|
|
55
76
|
import type { IKDatatableAction, IDataFilter } from '@katlux/providers'
|
|
56
77
|
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
57
78
|
import { useVirtualDataset } from '#toolkit/composables/useVirtualDataset'
|
|
79
|
+
import { normalizeIteratorColumns, type KDataIteratorLayout } from '#toolkit/components/KDatatable/KDataIterator.logic'
|
|
58
80
|
|
|
59
81
|
const { t } = useKatluxI18n()
|
|
60
82
|
|
|
@@ -79,6 +101,9 @@ const props = withDefaults(defineProps<{
|
|
|
79
101
|
viewportHeight?: number
|
|
80
102
|
buffer?: number
|
|
81
103
|
urlPageParam?: string
|
|
104
|
+
layout?: KDataIteratorLayout
|
|
105
|
+
columns?: number | string
|
|
106
|
+
showLayoutToggle?: boolean
|
|
82
107
|
}>(), {
|
|
83
108
|
selectedRows: () => [],
|
|
84
109
|
selectAll: false,
|
|
@@ -90,7 +115,10 @@ const props = withDefaults(defineProps<{
|
|
|
90
115
|
gap: 10,
|
|
91
116
|
viewportHeight: 500,
|
|
92
117
|
buffer: 5,
|
|
93
|
-
urlPageParam: undefined
|
|
118
|
+
urlPageParam: undefined,
|
|
119
|
+
layout: 'list',
|
|
120
|
+
columns: 3,
|
|
121
|
+
showLayoutToggle: false
|
|
94
122
|
})
|
|
95
123
|
|
|
96
124
|
const emit = defineEmits<{
|
|
@@ -102,8 +130,31 @@ const emit = defineEmits<{
|
|
|
102
130
|
(e: 'update:selectAllScope', value: 'page' | 'dataset'): void
|
|
103
131
|
(e: 'update:unselectedRows', value: any[]): void
|
|
104
132
|
(e: 'update:filter', value: IDataFilter | null): void
|
|
133
|
+
(e: 'update:layout', value: KDataIteratorLayout): void
|
|
134
|
+
(e: 'update:columns', value: number): void
|
|
105
135
|
}>()
|
|
106
136
|
|
|
137
|
+
const internalLayout = ref<KDataIteratorLayout>(props.layout === 'grid' ? 'grid' : 'list')
|
|
138
|
+
|
|
139
|
+
watch(() => props.layout, (val) => {
|
|
140
|
+
if (val === 'grid' || val === 'list') {
|
|
141
|
+
internalLayout.value = val
|
|
142
|
+
}
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
const setLayout = (next: KDataIteratorLayout) => {
|
|
146
|
+
const normalized: KDataIteratorLayout = next === 'grid' ? 'grid' : 'list'
|
|
147
|
+
internalLayout.value = normalized
|
|
148
|
+
emit('update:layout', normalized)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const isGridLayout = computed(() => internalLayout.value === 'grid')
|
|
152
|
+
const normalizedColumns = computed(() => normalizeIteratorColumns(props.columns, 3))
|
|
153
|
+
const rootCssVars = computed(() => ({
|
|
154
|
+
'--k-data-iterator-gap': (props.gap ?? 10) + 'px',
|
|
155
|
+
'--k-data-iterator-columns': String(normalizedColumns.value)
|
|
156
|
+
}))
|
|
157
|
+
|
|
107
158
|
const selectedRows = computed({
|
|
108
159
|
get: () => props.selectedRows || [],
|
|
109
160
|
set: (val) => emit('update:selectedRows', val)
|
|
@@ -160,6 +211,7 @@ const {
|
|
|
160
211
|
itemHeight: effectivePitchHeight,
|
|
161
212
|
viewportHeight: computed(() => props.viewportHeight || 500),
|
|
162
213
|
buffer: computed(() => props.buffer ?? 5),
|
|
214
|
+
columns: computed(() => (isGridLayout.value ? normalizedColumns.value : 1)),
|
|
163
215
|
selectedRows,
|
|
164
216
|
selectAll,
|
|
165
217
|
unselectedRows,
|
|
@@ -186,6 +238,11 @@ const isLoading = computed(() => props.loading || dpLoading.value || dpInitialLo
|
|
|
186
238
|
const hasData = computed(() => (props.virtualScroll ? iteratorItems.value.length > 0 : pageRows.value.length > 0))
|
|
187
239
|
const showNoRecord = computed(() => !isLoading.value && !hasData.value)
|
|
188
240
|
|
|
241
|
+
const getRowStyle = (row: any, index: number): Record<string, string> | undefined => {
|
|
242
|
+
if (typeof props.itemHeight !== 'function') return undefined
|
|
243
|
+
return { height: `${props.itemHeight(row, index)}px` }
|
|
244
|
+
}
|
|
245
|
+
|
|
189
246
|
|
|
190
247
|
</script>
|
|
191
248
|
|
|
@@ -194,6 +251,39 @@ const showNoRecord = computed(() => !isLoading.value && !hasData.value)
|
|
|
194
251
|
position: relative;
|
|
195
252
|
width: 100%;
|
|
196
253
|
|
|
254
|
+
.k-data-iterator-toolbar {
|
|
255
|
+
display: flex;
|
|
256
|
+
justify-content: flex-end;
|
|
257
|
+
align-items: center;
|
|
258
|
+
gap: var(--gap-sm, 0.5rem);
|
|
259
|
+
margin-bottom: var(--k-data-iterator-gap, var(--component-gap, var(--grid-gap, 10px)));
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.k-data-iterator-items {
|
|
263
|
+
width: 100%;
|
|
264
|
+
|
|
265
|
+
&.is-list {
|
|
266
|
+
display: flex;
|
|
267
|
+
flex-direction: column;
|
|
268
|
+
gap: var(--k-data-iterator-gap, var(--component-gap, var(--grid-gap, 10px)));
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&.is-grid {
|
|
272
|
+
display: grid;
|
|
273
|
+
grid-template-columns: repeat(var(--k-data-iterator-columns, 3), minmax(0, 1fr));
|
|
274
|
+
gap: var(--k-data-iterator-gap, var(--component-gap, var(--grid-gap, 10px)));
|
|
275
|
+
align-items: stretch;
|
|
276
|
+
|
|
277
|
+
@media (max-width: 768px) {
|
|
278
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
@media (max-width: 480px) {
|
|
282
|
+
grid-template-columns: minmax(0, 1fr);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
197
287
|
.no-record {
|
|
198
288
|
display: block;
|
|
199
289
|
padding: 1rem;
|
|
@@ -214,8 +304,12 @@ const showNoRecord = computed(() => !isLoading.value && !hasData.value)
|
|
|
214
304
|
outline-offset: -2px;
|
|
215
305
|
}
|
|
216
306
|
|
|
217
|
-
.k-data-iterator-
|
|
218
|
-
|
|
307
|
+
.k-data-iterator-items.is-list {
|
|
308
|
+
gap: 0;
|
|
309
|
+
|
|
310
|
+
.k-data-iterator-item {
|
|
311
|
+
margin-bottom: var(--k-data-iterator-gap, var(--component-gap, var(--grid-gap, 10px)));
|
|
312
|
+
}
|
|
219
313
|
}
|
|
220
314
|
|
|
221
315
|
.k-virtual-spacer {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ADataProvider } from '@katlux/providers';
|
|
2
2
|
import type { IKDatatableAction, IDataFilter } from '@katlux/providers';
|
|
3
|
+
import { type KDataIteratorLayout } from '#toolkit/components/KDatatable/KDataIterator.logic';
|
|
3
4
|
type __VLS_Props = {
|
|
4
5
|
dataProvider: ADataProvider;
|
|
5
6
|
visibleFields?: Array<string> | null;
|
|
@@ -21,6 +22,9 @@ type __VLS_Props = {
|
|
|
21
22
|
viewportHeight?: number;
|
|
22
23
|
buffer?: number;
|
|
23
24
|
urlPageParam?: string;
|
|
25
|
+
layout?: KDataIteratorLayout;
|
|
26
|
+
columns?: number | string;
|
|
27
|
+
showLayoutToggle?: boolean;
|
|
24
28
|
};
|
|
25
29
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
26
30
|
"update:currentPage": (value: number) => any;
|
|
@@ -31,6 +35,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
31
35
|
"update:selectAllScope": (value: "page" | "dataset") => any;
|
|
32
36
|
"update:unselectedRows": (value: any[]) => any;
|
|
33
37
|
"update:filter": (value: IDataFilter | null) => any;
|
|
38
|
+
"update:layout": (value: KDataIteratorLayout) => any;
|
|
39
|
+
"update:columns": (value: number) => any;
|
|
34
40
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
35
41
|
"onUpdate:currentPage"?: ((value: number) => any) | undefined;
|
|
36
42
|
"onUpdate:pageSize"?: ((value: number) => any) | undefined;
|
|
@@ -40,18 +46,23 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
40
46
|
"onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
|
|
41
47
|
"onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
|
|
42
48
|
"onUpdate:filter"?: ((value: IDataFilter | null) => any) | undefined;
|
|
49
|
+
"onUpdate:layout"?: ((value: KDataIteratorLayout) => any) | undefined;
|
|
50
|
+
"onUpdate:columns"?: ((value: number) => any) | undefined;
|
|
43
51
|
}>, {
|
|
44
52
|
filter: IDataFilter | null;
|
|
45
53
|
selectedRows: any[];
|
|
46
54
|
unselectedRows: any[];
|
|
47
55
|
selectAll: boolean;
|
|
56
|
+
selectAllScope: "page" | "dataset";
|
|
48
57
|
virtualScroll: boolean;
|
|
49
58
|
itemHeight: number | ((row: any, index: number) => number);
|
|
50
59
|
buffer: number;
|
|
51
60
|
viewportHeight: number;
|
|
52
|
-
selectAllScope: "page" | "dataset";
|
|
53
61
|
gap: number;
|
|
54
62
|
urlPageParam: string;
|
|
63
|
+
layout: KDataIteratorLayout;
|
|
64
|
+
columns: number | string;
|
|
65
|
+
showLayoutToggle: boolean;
|
|
55
66
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
56
67
|
declare const _default: typeof __VLS_export;
|
|
57
68
|
export default _default;
|
|
@@ -42,13 +42,13 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
42
42
|
unselectedRows: any[];
|
|
43
43
|
bulkActions: Array<IKDatatableAction>;
|
|
44
44
|
selectAll: boolean;
|
|
45
|
+
selectAllScope: "page" | "dataset";
|
|
45
46
|
virtualScroll: boolean;
|
|
46
47
|
itemHeight: number | ((row: any, index: number) => number);
|
|
47
48
|
buffer: number;
|
|
48
49
|
visibleFields: Array<string> | null;
|
|
49
50
|
viewportHeight: number;
|
|
50
51
|
rowActions: Array<IKDatatableAction>;
|
|
51
|
-
selectAllScope: "page" | "dataset";
|
|
52
52
|
urlPageParam: string;
|
|
53
53
|
emptyStateText: string;
|
|
54
54
|
emptyFilterStateText: string;
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
v-for="(row, index) in displayRows"
|
|
48
48
|
:key="getRowKey(row, index)"
|
|
49
49
|
:class="{ 'selected': isRowSelected(row), 'active-focus': focusedIndex === (props.virtualScroll ? startIndex + index : index), 'alt-row': (props.virtualScroll ? (startIndex + index) % 2 === 1 : index % 2 === 1) }"
|
|
50
|
+
:style="getRowStyle(row, index)"
|
|
50
51
|
)
|
|
51
52
|
td.check(v-if="props.bulkActions && props.bulkActions.length > 0")
|
|
52
53
|
KCheckbox(:model-value="isRowSelected(row)" @update:model-value="toggleRow(row)" :idKey="rowIdKey")
|
|
@@ -227,6 +228,19 @@ const getHeaderSlot = (fieldName: string) => {
|
|
|
227
228
|
return props.headerSlots?.[slotName] || props.cellSlots?.[slotName]
|
|
228
229
|
}
|
|
229
230
|
|
|
231
|
+
const getRowStyle = (row: any, index: number) => {
|
|
232
|
+
if (typeof props.itemHeight !== 'function') return undefined
|
|
233
|
+
const absIndex = props.virtualScroll ? startIndex.value + index : index
|
|
234
|
+
const h = props.itemHeight(row, absIndex)
|
|
235
|
+
if (typeof h === 'number' && Number.isFinite(h) && h > 0) {
|
|
236
|
+
return {
|
|
237
|
+
'--virtual-item-height': `${h}px`,
|
|
238
|
+
height: `${h}px`
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
return undefined
|
|
242
|
+
}
|
|
243
|
+
|
|
230
244
|
const getColumnStyle = (field: string) => {
|
|
231
245
|
const w = props.columnWidths?.[field]
|
|
232
246
|
if (!w) return undefined
|
|
@@ -42,13 +42,13 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
42
42
|
unselectedRows: any[];
|
|
43
43
|
bulkActions: Array<IKDatatableAction>;
|
|
44
44
|
selectAll: boolean;
|
|
45
|
+
selectAllScope: "page" | "dataset";
|
|
45
46
|
virtualScroll: boolean;
|
|
46
47
|
itemHeight: number | ((row: any, index: number) => number);
|
|
47
48
|
buffer: number;
|
|
48
49
|
visibleFields: Array<string> | null;
|
|
49
50
|
viewportHeight: number;
|
|
50
51
|
rowActions: Array<IKDatatableAction>;
|
|
51
|
-
selectAllScope: "page" | "dataset";
|
|
52
52
|
urlPageParam: string;
|
|
53
53
|
emptyStateText: string;
|
|
54
54
|
emptyFilterStateText: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { DomTargetLike } from '#toolkit/utils/dom';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
open: boolean;
|
|
3
4
|
fullWidth: boolean;
|
|
4
|
-
anchorEl?:
|
|
5
|
+
anchorEl?: DomTargetLike;
|
|
5
6
|
dropdownRect: {
|
|
6
7
|
top: number;
|
|
7
8
|
left: number;
|
|
@@ -20,6 +21,8 @@ type __VLS_Props = {
|
|
|
20
21
|
direction?: string;
|
|
21
22
|
updatePosition?: () => void;
|
|
22
23
|
};
|
|
23
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
24
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
25
|
+
dropdownEl: import("vue").Ref<Element | null, Element | null>;
|
|
26
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
27
|
declare const _default: typeof __VLS_export;
|
|
25
28
|
export default _default;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
<script lang="ts" setup>
|
|
11
11
|
import { computed, ref, onMounted, onBeforeUnmount, watch, nextTick } from 'vue'
|
|
12
|
+
import type { DomTargetLike } from '#toolkit/utils/dom'
|
|
12
13
|
|
|
13
14
|
defineOptions({
|
|
14
15
|
inheritAttrs: false
|
|
@@ -17,7 +18,7 @@ defineOptions({
|
|
|
17
18
|
const props = defineProps<{
|
|
18
19
|
open: boolean
|
|
19
20
|
fullWidth: boolean
|
|
20
|
-
anchorEl?:
|
|
21
|
+
anchorEl?: DomTargetLike
|
|
21
22
|
dropdownRect: {
|
|
22
23
|
top: number
|
|
23
24
|
left: number
|
|
@@ -38,9 +39,13 @@ const props = defineProps<{
|
|
|
38
39
|
}>()
|
|
39
40
|
|
|
40
41
|
const isMounted = ref(false)
|
|
41
|
-
const dropdownEl = ref<
|
|
42
|
+
const dropdownEl = ref<Element | null>(null)
|
|
42
43
|
let resizeObserver: ResizeObserver | null = null
|
|
43
44
|
|
|
45
|
+
defineExpose({
|
|
46
|
+
dropdownEl
|
|
47
|
+
})
|
|
48
|
+
|
|
44
49
|
onMounted(() => {
|
|
45
50
|
isMounted.value = true
|
|
46
51
|
})
|
|
@@ -148,16 +153,14 @@ const contentStyle = computed(() => ({
|
|
|
148
153
|
overflow: hidden;
|
|
149
154
|
background-color: var(--panel-bg-default);
|
|
150
155
|
color: var(--font-color-primary);
|
|
151
|
-
:deep {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
flex: 1;
|
|
160
|
-
}
|
|
156
|
+
:deep(.KPanel--content) {
|
|
157
|
+
padding: var(--component-gap);
|
|
158
|
+
background-color: var(--panel-bg-default);
|
|
159
|
+
color: var(--font-color-primary);
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
min-height: 0;
|
|
163
|
+
flex: 1;
|
|
161
164
|
}
|
|
162
165
|
}
|
|
163
166
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { DomTargetLike } from '#toolkit/utils/dom';
|
|
1
2
|
type __VLS_Props = {
|
|
2
3
|
open: boolean;
|
|
3
4
|
fullWidth: boolean;
|
|
4
|
-
anchorEl?:
|
|
5
|
+
anchorEl?: DomTargetLike;
|
|
5
6
|
dropdownRect: {
|
|
6
7
|
top: number;
|
|
7
8
|
left: number;
|
|
@@ -20,6 +21,8 @@ type __VLS_Props = {
|
|
|
20
21
|
direction?: string;
|
|
21
22
|
updatePosition?: () => void;
|
|
22
23
|
};
|
|
23
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
24
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
25
|
+
dropdownEl: import("vue").Ref<Element | null, Element | null>;
|
|
26
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
27
|
declare const _default: typeof __VLS_export;
|
|
25
28
|
export default _default;
|
|
@@ -57,6 +57,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
57
57
|
sourceRow: any;
|
|
58
58
|
targetRow?: any;
|
|
59
59
|
}) => any;
|
|
60
|
+
"task-change": (payload: {
|
|
61
|
+
task: IGanttTask;
|
|
62
|
+
sourceRow: any;
|
|
63
|
+
targetRow?: any;
|
|
64
|
+
}) => any;
|
|
60
65
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
61
66
|
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
62
67
|
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
@@ -78,6 +83,11 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
78
83
|
sourceRow: any;
|
|
79
84
|
targetRow?: any;
|
|
80
85
|
}) => any) | undefined;
|
|
86
|
+
"onTask-change"?: ((payload: {
|
|
87
|
+
task: IGanttTask;
|
|
88
|
+
sourceRow: any;
|
|
89
|
+
targetRow?: any;
|
|
90
|
+
}) => any) | undefined;
|
|
81
91
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
82
92
|
declare const _default: typeof __VLS_export;
|
|
83
93
|
export default _default;
|