@katlux/toolkit 0.1.1-alpha.145 → 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 +575 -0
- 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 -872
- package/bin/cli.mjs +81 -48
- package/bin/create-preset.mjs +1 -0
- package/bin/preset-contracts.json +2997 -0
- 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 +32 -720
- package/dist/compiled/composables/useDataProvider.mjs +39 -26
- package/dist/compiled/composables/useFilterLogic.mjs +10 -2
- package/dist/compiled/composables/useKatluxForm.mjs +13 -11
- package/dist/compiled/composables/usePresetComponent.mjs +2 -0
- package/dist/compiled/composables/useRequestQueue.mjs +3 -1
- package/dist/compiled/composables/useVirtualDataset.mjs +657 -0
- package/dist/compiled/composables/useVirtualScroll.mjs +93 -66
- 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 +58 -77
- package/dist/module.d.cts +5 -0
- package/dist/module.d.mts +4 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +54 -77
- 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.global.d.vue.ts +7 -3
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +4 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +7 -3
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +12 -2
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +40 -41
- 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 +19 -10
- package/dist/runtime/components/KCalendar/KCalendar.global.vue +7 -2
- package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +19 -10
- package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +14 -201
- package/dist/runtime/components/KCalendar/KCalendar.logic.js +67 -14
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.d.vue.ts +25 -5
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue +15 -1
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue.d.ts +25 -5
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +21 -3
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +136 -7
- package/dist/runtime/components/KCalendar/recurringUtils.js +6 -5
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +18 -3
- package/dist/runtime/components/KCombobox/KCombobox.global.vue +9 -4
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +18 -3
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +16 -2
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +32 -13
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +8 -8
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +8 -8
- 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 -22
- package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +38 -11
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue +39 -20
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +38 -11
- package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +31 -8
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +69 -24
- package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +10 -14
- package/dist/runtime/components/KDatatable/KDatatable.global.vue +6 -5
- package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +10 -14
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -6
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +32 -24
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +33 -15
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +60 -16
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +33 -15
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +30 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +249 -59
- 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/KDateTimePicker/KDateTimePicker.logic.js +2 -0
- 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 +55 -4
- package/dist/runtime/components/KGantt/KGantt.global.vue +18 -3
- package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +55 -4
- package/dist/runtime/components/KGantt/KGantt.logic.d.ts +33 -5
- package/dist/runtime/components/KGantt/KGantt.logic.js +39 -6
- 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/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 +3 -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 +2 -2
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +2 -2
- 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.d.vue.ts +23 -0
- package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue +24 -0
- package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue.d.ts +23 -0
- package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +3 -1
- package/dist/runtime/components/KPagination/KPagination.global.vue +2 -1
- package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +3 -1
- package/dist/runtime/components/KPagination/KPagination.logic.d.ts +2 -1
- package/dist/runtime/components/KPagination/KPagination.logic.js +74 -14
- 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 +15 -4
- package/dist/runtime/components/KTextbox/KTextbox.global.vue +8 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +15 -4
- 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.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 +4 -4
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +4 -4
- package/dist/runtime/components/KTree/KTree.logic.d.ts +2 -2
- package/dist/runtime/components/KTree/KTree.logic.js +37 -13
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +7 -5
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +4 -6
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +7 -5
- 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 +40 -6
- package/dist/runtime/components/KTreeView/KTreeView.global.vue +19 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +40 -6
- package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +24 -4
- package/dist/runtime/components/KTreeView/KTreeView.logic.js +105 -11
- 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 +32 -720
- package/dist/runtime/composables/useDataProvider.d.ts +5 -3
- package/dist/runtime/composables/useDataProvider.js +39 -26
- package/dist/runtime/composables/useFilterLogic.d.ts +16 -4
- package/dist/runtime/composables/useFilterLogic.js +10 -2
- package/dist/runtime/composables/useKatluxForm.d.ts +4 -4
- package/dist/runtime/composables/useKatluxForm.js +13 -11
- 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/useSortLogic.d.ts +1 -1
- package/dist/runtime/composables/useVirtualDataset.d.ts +9 -0
- package/dist/runtime/composables/useVirtualDataset.js +657 -0
- package/dist/runtime/composables/useVirtualScroll.d.ts +14 -10
- package/dist/runtime/composables/useVirtualScroll.js +93 -66
- 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 +16 -1
- package/dist/runtime/plugins/toastPlugin.client.js +2 -2
- package/dist/runtime/presets/default/assets/scss/css-variables.css +3 -0
- package/dist/runtime/presets/default/assets/scss/css-variables.scss +6 -1
- package/dist/runtime/presets/default/assets/scss/index.css +3 -0
- package/dist/runtime/presets/default/assets/svg/katlux-logo.svg +7 -0
- package/dist/runtime/presets/default/assets/svg/katlux.svg +6 -0
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +3 -2
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +31 -3
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +3 -2
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +6 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +7 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +57 -2
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +7 -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 +67 -22
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue.d.ts +2 -0
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +41 -8
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +184 -174
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +41 -8
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +17 -10
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +113 -394
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +17 -10
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +6 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +71 -4
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +6 -0
- 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 +11 -2
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +46 -29
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +11 -2
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.d.vue.ts +6 -2
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +23 -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 +3 -3
- package/dist/runtime/presets/default/components/KTree/KTree.vue +61 -56
- package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +3 -3
- 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/presets/default/components/KTreeView/KTreeView.d.vue.ts +11 -2
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +14 -2
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +11 -2
- 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 +18 -19
- package/dist/skills/katlux-components/SKILL.md +2 -0
- package/dist/skills/katlux-components/components/KBulkActions.md +26 -2
- package/dist/skills/katlux-components/components/KCombobox.md +2 -2
- package/dist/skills/katlux-components/components/KDataIterator.md +17 -4
- package/dist/skills/katlux-components/components/KDatatable.md +38 -0
- package/dist/skills/katlux-components/components/KDatePicker.md +3 -1
- package/dist/skills/katlux-components/components/KGantt.md +9 -0
- package/dist/skills/katlux-components/components/KIcon.md +1 -1
- package/dist/skills/katlux-components/components/KLayout.md +4 -0
- package/dist/skills/katlux-components/components/KLineChart.md +3 -0
- package/dist/skills/katlux-components/components/KLoader.md +3 -0
- package/dist/skills/katlux-components/components/KProductList.md +0 -1
- package/dist/skills/katlux-components/components/KScatterChart.md +3 -0
- package/dist/skills/katlux-components/components/KTextbox.md +1 -0
- package/dist/skills/katlux-components/components/KTreePicker.md +2 -1
- package/dist/skills/katlux-components/components/KTreeView.md +12 -0
- package/dist/skills/katlux-config/SKILL.md +27 -8
- package/dist/skills/katlux-presets/SKILL.md +163 -3
- package/dist/skills/katlux-presets/creating-a-preset.md +67 -0
- package/dist/skills/katlux-providers/SKILL.md +19 -5
- package/dist/skills/katlux-providers/providers/ADataProvider.md +17 -9
- package/dist/skills/katlux-providers/providers/CAPIFlatClientDataProvider.md +27 -3
- package/dist/skills/katlux-providers/providers/CAPIFlatServerDataProvider.md +11 -1
- package/dist/skills/katlux-providers/providers/CAPITreeServerDataProvider.md +13 -0
- package/dist/skills/katlux-providers/providers/CFlatClientDataProvider.md +19 -4
- package/dist/skills/katlux-providers/providers/CFlatServerDataProvider.md +4 -2
- package/dist/skills/katlux-providers/providers/CTreeClientDataProvider.md +2 -2
- package/dist/skills/katlux-providers/providers/RequestProvider.md +10 -0
- package/dist/skills/katlux-providers/providers/encryption-field-level.md +67 -20
- package/dist/skills/katlux-providers/providers/encryption-key-management.md +23 -2
- package/dist/skills/katlux-providers/providers/encryption-key-pinning.md +25 -11
- package/dist/skills/katlux-providers/providers/encryption-searchable.md +341 -0
- package/dist/skills/katlux-providers/providers/encryption-symmetric.md +29 -2
- package/dist/skills/katlux-providers/providers/encryption-threat-model.md +70 -1
- package/dist/skills/katlux-providers/providers/encryption.md +26 -1
- package/dist/skills/katlux-providers/providers/types.md +3 -1
- package/dist/skills/katlux-providers/providers/useDataProvider.md +2 -1
- package/dist/skills/katlux-providers/providers/useVirtualDataset.md +154 -0
- package/dist/skills/katlux-tokens/SKILL.md +2 -1
- package/dist/types.d.mts +1 -1
- package/package.json +7 -3
- package/bin/add-ai-reference.mjs +0 -259
|
@@ -1,45 +1,55 @@
|
|
|
1
|
-
import { ref, computed, unref, watch, getCurrentScope, onScopeDispose } from "vue";
|
|
1
|
+
import { ref, computed, unref, toValue, watch, getCurrentScope, onScopeDispose } from "vue";
|
|
2
|
+
import { resolveElement } from "../utils/dom.js";
|
|
2
3
|
export function useVirtualScroll(options) {
|
|
3
4
|
const containerRef = ref(null);
|
|
4
5
|
const scrollTop = ref(0);
|
|
5
6
|
const resolveItems = () => {
|
|
6
|
-
|
|
7
|
-
return options.items();
|
|
8
|
-
}
|
|
9
|
-
return unref(options.items) || [];
|
|
7
|
+
return toValue(options.items) || [];
|
|
10
8
|
};
|
|
11
9
|
const allItems = computed(() => resolveItems());
|
|
12
|
-
const
|
|
10
|
+
const resolveTotalCount = () => {
|
|
11
|
+
if (options.totalCount !== void 0) {
|
|
12
|
+
const val = toValue(options.totalCount);
|
|
13
|
+
return typeof val === "number" && val >= 0 ? val : 0;
|
|
14
|
+
}
|
|
15
|
+
return allItems.value.length;
|
|
16
|
+
};
|
|
17
|
+
const totalCount = computed(() => resolveTotalCount());
|
|
13
18
|
const isVirtual = computed(() => {
|
|
14
19
|
if (options.virtualScroll === void 0) return false;
|
|
15
|
-
return
|
|
20
|
+
return toValue(options.virtualScroll) === true;
|
|
16
21
|
});
|
|
17
22
|
const colCount = computed(() => {
|
|
18
|
-
const c =
|
|
23
|
+
const c = toValue(options.columns);
|
|
19
24
|
return typeof c === "number" && c > 1 ? c : 1;
|
|
20
25
|
});
|
|
21
26
|
const buf = computed(() => {
|
|
22
|
-
const b =
|
|
23
|
-
return typeof b === "number" ? b : 5;
|
|
27
|
+
const b = toValue(options.buffer);
|
|
28
|
+
return typeof b === "number" && Number.isFinite(b) && b >= 0 ? b : 5;
|
|
24
29
|
});
|
|
25
30
|
const defaultHeight = 40;
|
|
31
|
+
const resolveItemHeightOption = () => {
|
|
32
|
+
const raw = unref(options.itemHeight);
|
|
33
|
+
if (typeof raw === "function" && raw.length === 0) {
|
|
34
|
+
return raw();
|
|
35
|
+
}
|
|
36
|
+
return raw;
|
|
37
|
+
};
|
|
26
38
|
const getItemHeight = (item, index) => {
|
|
27
|
-
|
|
28
|
-
|
|
39
|
+
const raw = resolveItemHeightOption();
|
|
40
|
+
if (typeof raw === "function") {
|
|
41
|
+
const h = raw(item, index);
|
|
42
|
+
return typeof h === "number" && Number.isFinite(h) && h > 0 ? h : defaultHeight;
|
|
29
43
|
}
|
|
30
|
-
|
|
31
|
-
return typeof h === "number" && h > 0 ? h : defaultHeight;
|
|
44
|
+
return typeof raw === "number" && raw > 0 ? raw : defaultHeight;
|
|
32
45
|
};
|
|
33
46
|
const baseItemHeight = computed(() => {
|
|
34
|
-
const h =
|
|
47
|
+
const h = resolveItemHeightOption();
|
|
35
48
|
if (typeof h === "number" && h > 0) return h;
|
|
36
49
|
return defaultHeight;
|
|
37
50
|
});
|
|
38
51
|
const resolveContainerHeight = () => {
|
|
39
|
-
|
|
40
|
-
return options.containerHeight() || 400;
|
|
41
|
-
}
|
|
42
|
-
const val = unref(options.containerHeight);
|
|
52
|
+
const val = toValue(options.containerHeight);
|
|
43
53
|
return typeof val === "number" && val > 0 ? val : 400;
|
|
44
54
|
};
|
|
45
55
|
const configuredContainerHeight = computed(() => resolveContainerHeight());
|
|
@@ -54,40 +64,47 @@ export function useVirtualScroll(options) {
|
|
|
54
64
|
);
|
|
55
65
|
watch([containerRef, isVirtual], ([el, virtual], [oldEl]) => {
|
|
56
66
|
if (typeof window === "undefined" || typeof ResizeObserver === "undefined") return;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
const prevEl = resolveElement(oldEl) ?? oldEl;
|
|
68
|
+
if (prevEl && prevEl.__vsObserver) {
|
|
69
|
+
;
|
|
70
|
+
prevEl.__vsObserver.disconnect();
|
|
71
|
+
delete prevEl.__vsObserver;
|
|
60
72
|
}
|
|
61
|
-
|
|
73
|
+
const targetEl = resolveElement(el) ?? el;
|
|
74
|
+
if (targetEl && virtual && typeof Element !== "undefined" && targetEl instanceof Element) {
|
|
62
75
|
const ro = new ResizeObserver((entries) => {
|
|
63
76
|
for (const entry of entries) {
|
|
64
|
-
const h = Math.round(entry.contentRect.height ||
|
|
77
|
+
const h = Math.round(entry.contentRect.height || targetEl.clientHeight);
|
|
65
78
|
if (h > 0 && h !== viewportHeight.value) {
|
|
66
79
|
viewportHeight.value = h;
|
|
67
80
|
}
|
|
68
81
|
}
|
|
69
82
|
});
|
|
70
|
-
ro.observe(
|
|
71
|
-
|
|
83
|
+
ro.observe(targetEl);
|
|
84
|
+
targetEl.__vsObserver = ro;
|
|
72
85
|
}
|
|
73
86
|
});
|
|
74
87
|
if (getCurrentScope()) {
|
|
75
88
|
onScopeDispose(() => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
89
|
+
const targetEl = resolveElement(containerRef.value) ?? containerRef.value;
|
|
90
|
+
if (targetEl && targetEl.__vsObserver) {
|
|
91
|
+
;
|
|
92
|
+
targetEl.__vsObserver.disconnect();
|
|
93
|
+
delete targetEl.__vsObserver;
|
|
79
94
|
}
|
|
80
95
|
});
|
|
81
96
|
}
|
|
82
|
-
const isDynamicHeight = computed(() => typeof
|
|
97
|
+
const isDynamicHeight = computed(() => typeof resolveItemHeightOption() === "function");
|
|
83
98
|
const rowOffsets = computed(() => {
|
|
84
99
|
if (!isDynamicHeight.value || colCount.value > 1) return [];
|
|
100
|
+
const count = totalCount.value;
|
|
85
101
|
const items = allItems.value;
|
|
86
|
-
const offsets = new Array(
|
|
102
|
+
const offsets = new Array(count + 1);
|
|
87
103
|
offsets[0] = 0;
|
|
88
104
|
let current = 0;
|
|
89
|
-
for (let i = 0; i <
|
|
90
|
-
|
|
105
|
+
for (let i = 0; i < count; i++) {
|
|
106
|
+
const item = items[i] ?? (typeof options.getItem === "function" ? options.getItem(i) : void 0);
|
|
107
|
+
current += getItemHeight(item, i);
|
|
91
108
|
offsets[i + 1] = current;
|
|
92
109
|
}
|
|
93
110
|
return offsets;
|
|
@@ -154,6 +171,16 @@ export function useVirtualScroll(options) {
|
|
|
154
171
|
});
|
|
155
172
|
const visibleItems = computed(() => {
|
|
156
173
|
if (!isVirtual.value) return allItems.value;
|
|
174
|
+
if (typeof options.getItem === "function") {
|
|
175
|
+
const start = startIndex.value;
|
|
176
|
+
const end = endIndex.value;
|
|
177
|
+
const count = Math.max(0, end - start);
|
|
178
|
+
const res = new Array(count);
|
|
179
|
+
for (let i = 0; i < count; i++) {
|
|
180
|
+
res[i] = options.getItem(start + i);
|
|
181
|
+
}
|
|
182
|
+
return res;
|
|
183
|
+
}
|
|
157
184
|
return allItems.value.slice(startIndex.value, endIndex.value);
|
|
158
185
|
});
|
|
159
186
|
const topSpacerHeight = computed(() => {
|
|
@@ -188,14 +215,22 @@ export function useVirtualScroll(options) {
|
|
|
188
215
|
}
|
|
189
216
|
}
|
|
190
217
|
});
|
|
191
|
-
const containerCssVars = computed(() =>
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
218
|
+
const containerCssVars = computed(() => {
|
|
219
|
+
const vars = {
|
|
220
|
+
"--virtual-spacer-top": `${topSpacerHeight.value}px`,
|
|
221
|
+
"--virtual-spacer-bottom": `${bottomSpacerHeight.value}px`,
|
|
222
|
+
"--virtual-total-height": `${totalHeight.value}px`,
|
|
223
|
+
"--virtual-container-height": `${configuredContainerHeight.value}px`
|
|
224
|
+
};
|
|
225
|
+
if (!isDynamicHeight.value) {
|
|
226
|
+
vars["--virtual-item-height"] = `${baseItemHeight.value}px`;
|
|
227
|
+
}
|
|
228
|
+
return vars;
|
|
229
|
+
});
|
|
230
|
+
const scrollThreshold = computed(() => {
|
|
231
|
+
const val = toValue(options.scrollThreshold);
|
|
232
|
+
return typeof val === "number" && Number.isFinite(val) && val >= 0 ? val : 100;
|
|
233
|
+
});
|
|
199
234
|
const onScroll = (e) => {
|
|
200
235
|
const target = e.target;
|
|
201
236
|
if (!target) return;
|
|
@@ -204,43 +239,35 @@ export function useVirtualScroll(options) {
|
|
|
204
239
|
viewportHeight.value = target.clientHeight;
|
|
205
240
|
}
|
|
206
241
|
const distanceToBottom = target.scrollHeight - (target.scrollTop + target.clientHeight);
|
|
207
|
-
if (distanceToBottom <= scrollThreshold && typeof options.onThresholdReach === "function") {
|
|
242
|
+
if (distanceToBottom <= scrollThreshold.value && typeof options.onThresholdReach === "function") {
|
|
208
243
|
options.onThresholdReach();
|
|
209
244
|
}
|
|
210
245
|
};
|
|
246
|
+
const applyScrollTop = (targetScrollTop, behavior) => {
|
|
247
|
+
const el = resolveElement(containerRef.value) ?? containerRef.value;
|
|
248
|
+
if (!el) return;
|
|
249
|
+
el.scrollTop = targetScrollTop;
|
|
250
|
+
if (typeof el.scrollTo === "function") {
|
|
251
|
+
try {
|
|
252
|
+
el.scrollTo({
|
|
253
|
+
top: targetScrollTop,
|
|
254
|
+
behavior
|
|
255
|
+
});
|
|
256
|
+
} catch {
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
};
|
|
211
260
|
const scrollToIndex = (index, behavior = "auto", offset = 0) => {
|
|
212
261
|
if (isDynamicHeight.value && colCount.value <= 1) {
|
|
213
262
|
const targetScrollTop2 = Math.max(0, (rowOffsets.value[index] || 0) - offset);
|
|
214
263
|
scrollTop.value = targetScrollTop2;
|
|
215
|
-
|
|
216
|
-
containerRef.value.scrollTop = targetScrollTop2;
|
|
217
|
-
if (typeof containerRef.value.scrollTo === "function") {
|
|
218
|
-
try {
|
|
219
|
-
containerRef.value.scrollTo({
|
|
220
|
-
top: targetScrollTop2,
|
|
221
|
-
behavior
|
|
222
|
-
});
|
|
223
|
-
} catch {
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
264
|
+
applyScrollTop(targetScrollTop2, behavior);
|
|
227
265
|
return;
|
|
228
266
|
}
|
|
229
267
|
const targetRow = colCount.value <= 1 ? index : Math.floor(index / colCount.value);
|
|
230
268
|
const targetScrollTop = Math.max(0, targetRow * baseItemHeight.value - offset);
|
|
231
269
|
scrollTop.value = targetScrollTop;
|
|
232
|
-
|
|
233
|
-
containerRef.value.scrollTop = targetScrollTop;
|
|
234
|
-
if (typeof containerRef.value.scrollTo === "function") {
|
|
235
|
-
try {
|
|
236
|
-
containerRef.value.scrollTo({
|
|
237
|
-
top: targetScrollTop,
|
|
238
|
-
behavior
|
|
239
|
-
});
|
|
240
|
-
} catch {
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
270
|
+
applyScrollTop(targetScrollTop, behavior);
|
|
244
271
|
};
|
|
245
272
|
return {
|
|
246
273
|
startIndex,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { IUseDataProviderReturn } from '../useDataProvider.js';
|
|
2
|
+
export interface IVirtualProviderSnapshot {
|
|
3
|
+
provider: any;
|
|
4
|
+
stateVersion: number;
|
|
5
|
+
pageRowsRef: any[];
|
|
6
|
+
allDataRef: any;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
initialLoad: boolean;
|
|
9
|
+
error: any;
|
|
10
|
+
rowCount: number;
|
|
11
|
+
currentPage: number;
|
|
12
|
+
batchGeneration: any;
|
|
13
|
+
loadedBatchesSize: number;
|
|
14
|
+
batchProgress: any;
|
|
15
|
+
isBatchLoading: boolean;
|
|
16
|
+
customChangeCount: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Type guard identifying an initialized `useDataProvider` composable return object.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isUseDataProviderReturn<T>(val: any): val is IUseDataProviderReturn<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Resolves the underlying dataset array reference from a client/server/tree DataProvider.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveProviderAllDataRef(dp: any): any;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the ordered item source array exposed to the virtual scroll window.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveVirtualItemsArray<T>(dp: any, fallbackPageRows: T[], isVirtual: boolean): T[];
|
|
30
|
+
/**
|
|
31
|
+
* Resolves total scrollable item count for virtual window calculations.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveVirtualTotalCount<T>(dp: any, bridgeRowCount: number | undefined, datasetItems: T[], pageRowsLength: number, isVirtual: boolean): number;
|
|
34
|
+
/**
|
|
35
|
+
* Classifies a provider state change so `useVirtualDataset` can distinguish cache-preserving
|
|
36
|
+
* page switches from full dataset invalidations.
|
|
37
|
+
*/
|
|
38
|
+
export declare function classifyVirtualStateChange(params: {
|
|
39
|
+
dp: any;
|
|
40
|
+
dpBridgeStateVersion: number;
|
|
41
|
+
pageRowsRef: any[];
|
|
42
|
+
loading: boolean;
|
|
43
|
+
initialLoad: boolean;
|
|
44
|
+
error: any;
|
|
45
|
+
currentPage: number;
|
|
46
|
+
customChangeCount: number;
|
|
47
|
+
isFetchingPage: boolean;
|
|
48
|
+
snapshot: IVirtualProviderSnapshot;
|
|
49
|
+
}): 'none' | 'pageSwitch' | 'skip' | 'invalidate';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { isRef, unref } from "vue";
|
|
2
|
+
export function isUseDataProviderReturn(val) {
|
|
3
|
+
return val !== null && typeof val === "object" && "pageData" in val && isRef(val.pageData) && "stateVersion" in val && isRef(val.stateVersion);
|
|
4
|
+
}
|
|
5
|
+
export function resolveProviderAllDataRef(dp) {
|
|
6
|
+
if (!dp) return void 0;
|
|
7
|
+
return dp.allData?.value ?? dp.allData ?? dp.rowMap?.value ?? dp.rowMap ?? dp.data;
|
|
8
|
+
}
|
|
9
|
+
export function resolveVirtualItemsArray(dp, fallbackPageRows, isVirtual) {
|
|
10
|
+
if (isVirtual && dp) {
|
|
11
|
+
const candidates = [
|
|
12
|
+
dp.rowMap,
|
|
13
|
+
dp.rowMap?.value,
|
|
14
|
+
dp.allVisibleRows,
|
|
15
|
+
dp.allVisibleRows?.value,
|
|
16
|
+
dp.allVisibleNodes,
|
|
17
|
+
dp.allVisibleNodes?.value,
|
|
18
|
+
dp.visibleRows,
|
|
19
|
+
dp.visibleRows?.value,
|
|
20
|
+
dp.filteredData?.value,
|
|
21
|
+
dp.filteredData,
|
|
22
|
+
dp.allData?.value,
|
|
23
|
+
dp.allData,
|
|
24
|
+
dp.data
|
|
25
|
+
];
|
|
26
|
+
for (const candidate of candidates) {
|
|
27
|
+
if (Array.isArray(candidate)) return candidate;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return fallbackPageRows;
|
|
31
|
+
}
|
|
32
|
+
export function resolveVirtualTotalCount(dp, bridgeRowCount, datasetItems, pageRowsLength, isVirtual) {
|
|
33
|
+
if (!isVirtual) return pageRowsLength;
|
|
34
|
+
if (dp?.paginateBy === "root" && Array.isArray(dp.allVisibleRows)) {
|
|
35
|
+
return dp.allVisibleRows.length;
|
|
36
|
+
}
|
|
37
|
+
const rc = bridgeRowCount ?? dp?.rowCount;
|
|
38
|
+
const count = typeof rc === "number" ? rc : unref(rc);
|
|
39
|
+
if (typeof count === "number" && (count > 0 || datasetItems.length === 0)) return count;
|
|
40
|
+
if (Array.isArray(dp?.rowMap)) {
|
|
41
|
+
return dp.rowMap.length;
|
|
42
|
+
}
|
|
43
|
+
return datasetItems.length;
|
|
44
|
+
}
|
|
45
|
+
export function classifyVirtualStateChange(params) {
|
|
46
|
+
const { dp, snapshot } = params;
|
|
47
|
+
if (dp !== snapshot.provider) {
|
|
48
|
+
return "invalidate";
|
|
49
|
+
}
|
|
50
|
+
const stateChanged = params.dpBridgeStateVersion !== snapshot.stateVersion;
|
|
51
|
+
const pageChanged = params.pageRowsRef !== snapshot.pageRowsRef;
|
|
52
|
+
const allDataChanged = resolveProviderAllDataRef(dp) !== snapshot.allDataRef;
|
|
53
|
+
const customChanged = params.customChangeCount !== snapshot.customChangeCount;
|
|
54
|
+
if (!stateChanged && !pageChanged && !allDataChanged && !customChanged) {
|
|
55
|
+
return "none";
|
|
56
|
+
}
|
|
57
|
+
const batchGenNow = dp?._batchGeneration;
|
|
58
|
+
const loadedBatchesSizeNow = dp?.loadedBatches instanceof Set ? dp.loadedBatches.size : 0;
|
|
59
|
+
const isIncrementalBatchAppend = Boolean(
|
|
60
|
+
dp && dp.batchLoad === "onDemand" && dp.loadedBatches instanceof Set && batchGenNow === snapshot.batchGeneration && loadedBatchesSizeNow > snapshot.loadedBatchesSize
|
|
61
|
+
);
|
|
62
|
+
if (isIncrementalBatchAppend && !customChanged) {
|
|
63
|
+
return "skip";
|
|
64
|
+
}
|
|
65
|
+
if (params.currentPage !== snapshot.currentPage && !allDataChanged && !customChanged) {
|
|
66
|
+
return "pageSwitch";
|
|
67
|
+
}
|
|
68
|
+
if (pageChanged || allDataChanged || customChanged) {
|
|
69
|
+
return "invalidate";
|
|
70
|
+
}
|
|
71
|
+
const loadingChanged = params.loading !== snapshot.loading || params.initialLoad !== snapshot.initialLoad || params.error !== snapshot.error || dp?.batchProgress !== snapshot.batchProgress || Boolean(dp?.isBatchLoading) !== snapshot.isBatchLoading;
|
|
72
|
+
if (loadingChanged || params.isFetchingPage) {
|
|
73
|
+
return "skip";
|
|
74
|
+
}
|
|
75
|
+
return "invalidate";
|
|
76
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves measured `<thead>` height from the scroll container DOM or falls back to configured offset.
|
|
3
|
+
*/
|
|
4
|
+
export declare function resolveDomTheadOffset(container: HTMLElement | null, fallbackOffset: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves rendered row height in pixels from DOM measurement or static numeric option.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveDomItemHeight(container: HTMLElement | null, optionHeight: number | ((item: any, index: number) => number) | undefined): number;
|
|
9
|
+
/**
|
|
10
|
+
* Resolves effective viewport height in pixels from container DOM measurement, reactive height, or options.
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolveDomViewportHeight(container: HTMLElement | null, measuredHeight: number, optionHeight: number | undefined): number;
|
|
13
|
+
/**
|
|
14
|
+
* Computes next focused row index for virtualized Arrow/PageUp/PageDown/Home/End navigation keys.
|
|
15
|
+
*/
|
|
16
|
+
export declare function computeNextKeyboardFocusIndex(params: {
|
|
17
|
+
key: string;
|
|
18
|
+
currentFocus: number;
|
|
19
|
+
total: number;
|
|
20
|
+
firstInView: number;
|
|
21
|
+
lastInView: number;
|
|
22
|
+
pageStep: number;
|
|
23
|
+
}): {
|
|
24
|
+
nextIndex: number;
|
|
25
|
+
scrollMode: 'ensureVisible' | 'home' | 'end';
|
|
26
|
+
} | null;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export function resolveDomTheadOffset(container, fallbackOffset) {
|
|
2
|
+
if (container) {
|
|
3
|
+
const thead = container.querySelector("thead");
|
|
4
|
+
if (thead && thead.offsetHeight > 0) {
|
|
5
|
+
return thead.offsetHeight;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return fallbackOffset;
|
|
9
|
+
}
|
|
10
|
+
export function resolveDomItemHeight(container, optionHeight) {
|
|
11
|
+
if (container) {
|
|
12
|
+
const rowEl = container.querySelector('tbody tr, [role="row"]');
|
|
13
|
+
if (rowEl && rowEl.offsetHeight > 0) {
|
|
14
|
+
return rowEl.offsetHeight;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (typeof optionHeight === "function") return 40;
|
|
18
|
+
return typeof optionHeight === "number" && optionHeight > 0 ? optionHeight : 40;
|
|
19
|
+
}
|
|
20
|
+
export function resolveDomViewportHeight(container, measuredHeight, optionHeight) {
|
|
21
|
+
if (container && container.clientHeight > 0) {
|
|
22
|
+
return container.clientHeight;
|
|
23
|
+
}
|
|
24
|
+
if (measuredHeight > 0) {
|
|
25
|
+
return measuredHeight;
|
|
26
|
+
}
|
|
27
|
+
return typeof optionHeight === "number" && optionHeight > 0 ? optionHeight : 500;
|
|
28
|
+
}
|
|
29
|
+
export function computeNextKeyboardFocusIndex(params) {
|
|
30
|
+
const { key, currentFocus, total, firstInView, lastInView, pageStep } = params;
|
|
31
|
+
const outOfView = currentFocus < firstInView || currentFocus > lastInView;
|
|
32
|
+
switch (key) {
|
|
33
|
+
case "ArrowDown":
|
|
34
|
+
return {
|
|
35
|
+
nextIndex: outOfView ? Math.min(total - 1, firstInView) : Math.min(total - 1, currentFocus + 1),
|
|
36
|
+
scrollMode: "ensureVisible"
|
|
37
|
+
};
|
|
38
|
+
case "ArrowUp":
|
|
39
|
+
return {
|
|
40
|
+
nextIndex: outOfView ? Math.max(0, lastInView) : Math.max(0, currentFocus - 1),
|
|
41
|
+
scrollMode: "ensureVisible"
|
|
42
|
+
};
|
|
43
|
+
case "PageDown":
|
|
44
|
+
return {
|
|
45
|
+
nextIndex: outOfView ? Math.min(total - 1, firstInView + pageStep) : Math.min(total - 1, currentFocus + pageStep),
|
|
46
|
+
scrollMode: "ensureVisible"
|
|
47
|
+
};
|
|
48
|
+
case "PageUp":
|
|
49
|
+
return {
|
|
50
|
+
nextIndex: outOfView ? Math.max(0, lastInView - pageStep) : Math.max(0, currentFocus - pageStep),
|
|
51
|
+
scrollMode: "ensureVisible"
|
|
52
|
+
};
|
|
53
|
+
case "Home":
|
|
54
|
+
return { nextIndex: 0, scrollMode: "home" };
|
|
55
|
+
case "End":
|
|
56
|
+
return { nextIndex: total - 1, scrollMode: "end" };
|
|
57
|
+
default:
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a row's canonical identifier using explicit `idKey` or standard fallbacks (`id`, `_id`, `__treeNode.id`).
|
|
3
|
+
*/
|
|
4
|
+
export declare function extractVirtualRowId(row: any, idKey: string): any;
|
|
5
|
+
/**
|
|
6
|
+
* Resolves all descendant rows (including the target root row) in a hierarchical dataset for cascade selection.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getTreeBranchRows(row: any, dp: any, fallbackRows: any[], idKey: string): any[];
|
|
9
|
+
/**
|
|
10
|
+
* Walks upward along parent references to collect ancestor node IDs for partial unselection cascades.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getTreeAncestorIds(row: any, dp: any, fallbackRows: any[], idKey: string): any[];
|
|
13
|
+
/**
|
|
14
|
+
* Builds a lookup set containing both extracted IDs and raw object references for selection membership checks.
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildSelectionIdSet(rows: any[] | undefined, idKey: string): Set<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Detects whether a cell value carries an encrypted payload envelope or provider ciphertext format.
|
|
19
|
+
*/
|
|
20
|
+
export declare function detectEncryptedCellValue(val: any, rawProvider: any): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Computes next `selectedRows` array when toggling select-all in page-scoped mode.
|
|
23
|
+
*/
|
|
24
|
+
export declare function computePageScopedSelectAllRows(datasetItems: any[], currentSelected: any[], selectedRowIds: Set<any>, dp: any, idKey: string, allSelected: boolean): any[];
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { unref } from "vue";
|
|
2
|
+
import { isEncrypted } from "@katlux/providers";
|
|
3
|
+
export function extractVirtualRowId(row, idKey) {
|
|
4
|
+
return row?.[idKey] ?? row?.id ?? row?._id ?? row?.__treeNode?.id;
|
|
5
|
+
}
|
|
6
|
+
export function getTreeBranchRows(row, dp, fallbackRows, idKey) {
|
|
7
|
+
if (!dp || !("parentKey" in dp) && typeof dp.toggleNode !== "function") {
|
|
8
|
+
return [row];
|
|
9
|
+
}
|
|
10
|
+
const parentKey = dp.parentKey || "parentId";
|
|
11
|
+
const sourceRows = unref(dp.allData) || fallbackRows || [];
|
|
12
|
+
const rootId = extractVirtualRowId(row, idKey);
|
|
13
|
+
if (rootId === null || rootId === void 0) return [row];
|
|
14
|
+
const childrenByParent = /* @__PURE__ */ new Map();
|
|
15
|
+
for (const r of sourceRows) {
|
|
16
|
+
const pId = r?.__treeNode?.parentId ?? r?.[parentKey];
|
|
17
|
+
if (pId === null || pId === void 0) continue;
|
|
18
|
+
let list = childrenByParent.get(pId);
|
|
19
|
+
if (!list) {
|
|
20
|
+
list = [];
|
|
21
|
+
childrenByParent.set(pId, list);
|
|
22
|
+
}
|
|
23
|
+
list.push(r);
|
|
24
|
+
}
|
|
25
|
+
const result = [row];
|
|
26
|
+
const visited = /* @__PURE__ */ new Set([rootId]);
|
|
27
|
+
const queue = [rootId];
|
|
28
|
+
while (queue.length > 0) {
|
|
29
|
+
const curr = queue.shift();
|
|
30
|
+
for (const child of childrenByParent.get(curr) || []) {
|
|
31
|
+
const cId = extractVirtualRowId(child, idKey);
|
|
32
|
+
if (cId !== null && cId !== void 0 && !visited.has(cId)) {
|
|
33
|
+
visited.add(cId);
|
|
34
|
+
result.push(child);
|
|
35
|
+
queue.push(cId);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
export function getTreeAncestorIds(row, dp, fallbackRows, idKey) {
|
|
42
|
+
if (!dp || !("parentKey" in dp) && typeof dp.toggleNode !== "function") return [];
|
|
43
|
+
const parentKey = dp.parentKey || "parentId";
|
|
44
|
+
const sourceRows = unref(dp.allData) || fallbackRows || [];
|
|
45
|
+
const parentById = /* @__PURE__ */ new Map();
|
|
46
|
+
for (const r of sourceRows) {
|
|
47
|
+
const id = extractVirtualRowId(r, idKey);
|
|
48
|
+
if (id !== null && id !== void 0) parentById.set(id, r?.__treeNode?.parentId ?? r?.[parentKey] ?? null);
|
|
49
|
+
}
|
|
50
|
+
const ancestors = [];
|
|
51
|
+
const startId = extractVirtualRowId(row, idKey);
|
|
52
|
+
const visited = /* @__PURE__ */ new Set([startId]);
|
|
53
|
+
let currParent = row?.__treeNode?.parentId ?? row?.[parentKey] ?? parentById.get(startId) ?? null;
|
|
54
|
+
while (currParent !== null && currParent !== void 0 && !visited.has(currParent)) {
|
|
55
|
+
visited.add(currParent);
|
|
56
|
+
ancestors.push(currParent);
|
|
57
|
+
currParent = parentById.get(currParent) ?? null;
|
|
58
|
+
}
|
|
59
|
+
return ancestors;
|
|
60
|
+
}
|
|
61
|
+
export function buildSelectionIdSet(rows, idKey) {
|
|
62
|
+
const set = /* @__PURE__ */ new Set();
|
|
63
|
+
for (const r of rows || []) {
|
|
64
|
+
const id = r?.[idKey] ?? r?.id ?? r?._id ?? r;
|
|
65
|
+
set.add(id);
|
|
66
|
+
set.add(r);
|
|
67
|
+
}
|
|
68
|
+
return set;
|
|
69
|
+
}
|
|
70
|
+
export function detectEncryptedCellValue(val, rawProvider) {
|
|
71
|
+
if (!val || typeof val !== "object") return false;
|
|
72
|
+
if (val.__encrypted === true) return true;
|
|
73
|
+
const cipher = rawProvider?.cipherProvider;
|
|
74
|
+
if (cipher && typeof cipher.isEncrypted === "function") {
|
|
75
|
+
return cipher.isEncrypted(val);
|
|
76
|
+
}
|
|
77
|
+
return typeof isEncrypted === "function" ? isEncrypted(val) : false;
|
|
78
|
+
}
|
|
79
|
+
export function computePageScopedSelectAllRows(datasetItems, currentSelected, selectedRowIds, dp, idKey, allSelected) {
|
|
80
|
+
if (allSelected) {
|
|
81
|
+
const pageIdSet = new Set(
|
|
82
|
+
datasetItems.flatMap(
|
|
83
|
+
(r) => getTreeBranchRows(r, dp, datasetItems, idKey).map((b) => b?.[idKey] ?? b?.id ?? b?._id ?? b)
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
return currentSelected.filter((r) => {
|
|
87
|
+
const id = r?.[idKey] ?? r?.id ?? r?._id ?? r;
|
|
88
|
+
return !pageIdSet.has(id) && !pageIdSet.has(r);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const existingIds = new Set(selectedRowIds);
|
|
92
|
+
const toAdd = [];
|
|
93
|
+
for (const r of datasetItems) {
|
|
94
|
+
for (const item of getTreeBranchRows(r, dp, datasetItems, idKey)) {
|
|
95
|
+
const id = item?.[idKey] ?? item?.id ?? item?._id ?? item;
|
|
96
|
+
if (!existingIds.has(id) && !existingIds.has(item)) {
|
|
97
|
+
existingIds.add(id);
|
|
98
|
+
toAdd.push(item);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return [...currentSelected, ...toAdd];
|
|
103
|
+
}
|