@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,4 +1,11 @@
|
|
|
1
1
|
import { ref, watch, onMounted, computed } from "vue";
|
|
2
|
+
export const defaultQuickPresets = [
|
|
3
|
+
{ id: "today", label: "Today" },
|
|
4
|
+
{ id: "yesterday", label: "Yesterday" },
|
|
5
|
+
{ id: "last7Days", label: "Last 7 Days" },
|
|
6
|
+
{ id: "last30Days", label: "Last 30 Days" },
|
|
7
|
+
{ id: "thisMonth", label: "This Month" }
|
|
8
|
+
];
|
|
2
9
|
export const KDatePickerDefaultProps = {
|
|
3
10
|
label: {
|
|
4
11
|
type: String,
|
|
@@ -9,11 +16,11 @@ export const KDatePickerDefaultProps = {
|
|
|
9
16
|
default: "MM-DD-YYYY"
|
|
10
17
|
},
|
|
11
18
|
day: {
|
|
12
|
-
type: [Date, String],
|
|
19
|
+
type: [Date, String, Array],
|
|
13
20
|
default: void 0
|
|
14
21
|
},
|
|
15
22
|
modelValue: {
|
|
16
|
-
type: [Date, String],
|
|
23
|
+
type: [Date, String, Array],
|
|
17
24
|
default: void 0
|
|
18
25
|
},
|
|
19
26
|
isOpen: {
|
|
@@ -52,38 +59,117 @@ export const KDatePickerDefaultProps = {
|
|
|
52
59
|
align: {
|
|
53
60
|
type: String,
|
|
54
61
|
default: "left"
|
|
62
|
+
},
|
|
63
|
+
range: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
viewCount: {
|
|
68
|
+
type: Number,
|
|
69
|
+
default: void 0
|
|
55
70
|
}
|
|
56
71
|
};
|
|
72
|
+
export function parseSingleDate(str, format) {
|
|
73
|
+
if (!str || !format) return null;
|
|
74
|
+
let day = "", month = "", year = "";
|
|
75
|
+
for (let i = 0; i < format.length; i++) {
|
|
76
|
+
const char = format[i];
|
|
77
|
+
if (char === "M") {
|
|
78
|
+
month += str[i] || "";
|
|
79
|
+
} else if (char === "D") {
|
|
80
|
+
day += str[i] || "";
|
|
81
|
+
} else if (char === "Y") {
|
|
82
|
+
year += str[i] || "";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (month.length === 2 && day.length === 2 && year.length === 4) {
|
|
86
|
+
const d = new Date(parseInt(year, 10), parseInt(month, 10) - 1, parseInt(day, 10));
|
|
87
|
+
if (!isNaN(d.getTime())) {
|
|
88
|
+
return d;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
export function parseDateValue(val) {
|
|
94
|
+
if (!val) return null;
|
|
95
|
+
if (val instanceof Date) return isNaN(val.getTime()) ? null : val;
|
|
96
|
+
if (typeof val === "string" || val instanceof String) {
|
|
97
|
+
const str = val.toString().trim();
|
|
98
|
+
const isoMatch = str.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
99
|
+
if (isoMatch) {
|
|
100
|
+
const d2 = new Date(parseInt(isoMatch[1], 10), parseInt(isoMatch[2], 10) - 1, parseInt(isoMatch[3], 10));
|
|
101
|
+
return isNaN(d2.getTime()) ? null : d2;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const d = new Date(val);
|
|
105
|
+
return isNaN(d.getTime()) ? null : d;
|
|
106
|
+
}
|
|
107
|
+
export function areDateValuesEqual(a, b) {
|
|
108
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
109
|
+
if (a.length !== b.length) return false;
|
|
110
|
+
return a.every((item, i) => areDateValuesEqual(item, b[i]));
|
|
111
|
+
}
|
|
112
|
+
if (!a && !b) return true;
|
|
113
|
+
if (!a || !b) return false;
|
|
114
|
+
const d1 = parseDateValue(a);
|
|
115
|
+
const d2 = parseDateValue(b);
|
|
116
|
+
if (d1 && d2) return d1.getTime() === d2.getTime();
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
57
119
|
export function useKDatePickerLogic(props) {
|
|
58
|
-
const _date = ref("");
|
|
120
|
+
const _date = ref(props.range ? [] : "");
|
|
59
121
|
const maskedModel = ref("");
|
|
60
122
|
const calendarShow = ref(false);
|
|
123
|
+
const effectiveMask = computed(() => {
|
|
124
|
+
return props.range ? `${props.format} - ${props.format}` : props.format;
|
|
125
|
+
});
|
|
126
|
+
const effectivePlaceholder = computed(() => {
|
|
127
|
+
return props.placeholder || (props.range ? `${props.format} - ${props.format}` : props.format);
|
|
128
|
+
});
|
|
129
|
+
const formatDate = (date) => {
|
|
130
|
+
const day = date.getDate().toString().padStart(2, "0");
|
|
131
|
+
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
|
132
|
+
const year = date.getFullYear();
|
|
133
|
+
let formattedDate = props.format;
|
|
134
|
+
formattedDate = formattedDate.replace("DD", day);
|
|
135
|
+
formattedDate = formattedDate.replace("MM", month);
|
|
136
|
+
formattedDate = formattedDate.replace("YYYY", year.toString());
|
|
137
|
+
return formattedDate;
|
|
138
|
+
};
|
|
61
139
|
watch(maskedModel, (newVal) => {
|
|
62
|
-
if (newVal === "") {
|
|
63
|
-
if (
|
|
64
|
-
_date.value
|
|
140
|
+
if (!newVal || newVal.trim() === "") {
|
|
141
|
+
if (props.range) {
|
|
142
|
+
if (!Array.isArray(_date.value) || _date.value.length > 0) {
|
|
143
|
+
_date.value = [];
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
if (_date.value !== "") {
|
|
147
|
+
_date.value = "";
|
|
148
|
+
}
|
|
65
149
|
}
|
|
66
150
|
return;
|
|
67
151
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
152
|
+
if (props.range) {
|
|
153
|
+
const parts = newVal.split(/\s+-\s+/);
|
|
154
|
+
if (parts.length === 2 && parts[0] && parts[1]) {
|
|
155
|
+
const d1 = parseSingleDate(parts[0].trim(), props.format);
|
|
156
|
+
const d2 = parseSingleDate(parts[1].trim(), props.format);
|
|
157
|
+
if (d1 && d2) {
|
|
158
|
+
const start = d1.getTime() <= d2.getTime() ? d1 : d2;
|
|
159
|
+
const end = d1.getTime() <= d2.getTime() ? d2 : d1;
|
|
160
|
+
if (!areDateValuesEqual(_date.value, [start, end])) {
|
|
161
|
+
_date.value = [start, end];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
78
164
|
}
|
|
165
|
+
return;
|
|
79
166
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
167
|
+
const d = parseSingleDate(newVal, props.format);
|
|
168
|
+
if (d) {
|
|
169
|
+
const oldParsed = parseDateValue(_date.value);
|
|
170
|
+
const oldTime = oldParsed ? oldParsed.getTime() : NaN;
|
|
171
|
+
if (d.getTime() !== oldTime) {
|
|
172
|
+
_date.value = d;
|
|
87
173
|
}
|
|
88
174
|
}
|
|
89
175
|
});
|
|
@@ -91,29 +177,97 @@ export function useKDatePickerLogic(props) {
|
|
|
91
177
|
calendarShow.value = true;
|
|
92
178
|
};
|
|
93
179
|
const dateSelected = (date) => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
180
|
+
if (props.range) {
|
|
181
|
+
if (!Array.isArray(_date.value) || _date.value.length === 0 || _date.value.length === 2 && _date.value[0] && _date.value[1]) {
|
|
182
|
+
_date.value = [date, null];
|
|
183
|
+
maskedModel.value = `${formatDate(date)} - `;
|
|
184
|
+
calendarShow.value = true;
|
|
185
|
+
} else {
|
|
186
|
+
let start = _date.value[0];
|
|
187
|
+
let end = date;
|
|
188
|
+
if (end.getTime() < start.getTime()) {
|
|
189
|
+
const temp = start;
|
|
190
|
+
start = end;
|
|
191
|
+
end = temp;
|
|
192
|
+
}
|
|
193
|
+
const rangeResult = [start, end];
|
|
194
|
+
_date.value = rangeResult;
|
|
195
|
+
maskedModel.value = `${formatDate(start)} - ${formatDate(end)}`;
|
|
196
|
+
calendarShow.value = false;
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
_date.value = date;
|
|
200
|
+
const formatted = formatDate(date);
|
|
201
|
+
maskedModel.value = formatted;
|
|
202
|
+
calendarShow.value = false;
|
|
203
|
+
}
|
|
98
204
|
};
|
|
99
|
-
const
|
|
100
|
-
const
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
205
|
+
const applyQuickPreset = (presetId) => {
|
|
206
|
+
const now = /* @__PURE__ */ new Date();
|
|
207
|
+
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
208
|
+
let start;
|
|
209
|
+
let end;
|
|
210
|
+
switch (presetId) {
|
|
211
|
+
case "today":
|
|
212
|
+
start = today;
|
|
213
|
+
end = today;
|
|
214
|
+
break;
|
|
215
|
+
case "yesterday": {
|
|
216
|
+
const yest = new Date(today);
|
|
217
|
+
yest.setDate(yest.getDate() - 1);
|
|
218
|
+
start = yest;
|
|
219
|
+
end = yest;
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
case "last7Days": {
|
|
223
|
+
const past7 = new Date(today);
|
|
224
|
+
past7.setDate(past7.getDate() - 6);
|
|
225
|
+
start = past7;
|
|
226
|
+
end = today;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
case "last30Days": {
|
|
230
|
+
const past30 = new Date(today);
|
|
231
|
+
past30.setDate(past30.getDate() - 29);
|
|
232
|
+
start = past30;
|
|
233
|
+
end = today;
|
|
234
|
+
break;
|
|
235
|
+
}
|
|
236
|
+
case "thisMonth": {
|
|
237
|
+
start = new Date(today.getFullYear(), today.getMonth(), 1);
|
|
238
|
+
end = new Date(today.getFullYear(), today.getMonth() + 1, 0);
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
default:
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
const rangeResult = [start, end];
|
|
245
|
+
_date.value = rangeResult;
|
|
246
|
+
maskedModel.value = `${formatDate(start)} - ${formatDate(end)}`;
|
|
247
|
+
calendarShow.value = false;
|
|
108
248
|
};
|
|
109
249
|
const syncValue = (val) => {
|
|
110
250
|
if (val === void 0 || val === null || val === "") {
|
|
111
|
-
_date.value = "";
|
|
251
|
+
_date.value = props.range ? [] : "";
|
|
112
252
|
maskedModel.value = "";
|
|
113
253
|
return;
|
|
114
254
|
}
|
|
115
|
-
|
|
116
|
-
|
|
255
|
+
if (props.range) {
|
|
256
|
+
if (Array.isArray(val) && val.length >= 2 && val[0] && val[1]) {
|
|
257
|
+
const d1 = parseDateValue(val[0]);
|
|
258
|
+
const d2 = parseDateValue(val[1]);
|
|
259
|
+
if (d1 && d2) {
|
|
260
|
+
_date.value = [d1, d2];
|
|
261
|
+
maskedModel.value = `${formatDate(d1)} - ${formatDate(d2)}`;
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
_date.value = [];
|
|
266
|
+
maskedModel.value = "";
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
const d = parseDateValue(val);
|
|
270
|
+
if (d) {
|
|
117
271
|
_date.value = val;
|
|
118
272
|
maskedModel.value = formatDate(d);
|
|
119
273
|
} else {
|
|
@@ -121,46 +275,76 @@ export function useKDatePickerLogic(props) {
|
|
|
121
275
|
maskedModel.value = "";
|
|
122
276
|
}
|
|
123
277
|
};
|
|
124
|
-
syncValue(props.modelValue
|
|
278
|
+
syncValue(props.modelValue !== void 0 ? props.modelValue : props.day);
|
|
125
279
|
onMounted(() => {
|
|
126
|
-
|
|
280
|
+
const initVal = props.modelValue !== void 0 ? props.modelValue : props.day;
|
|
281
|
+
if (!areDateValuesEqual(initVal, _date.value)) {
|
|
282
|
+
syncValue(initVal);
|
|
283
|
+
}
|
|
127
284
|
if (props.isOpen) {
|
|
128
285
|
calendarShow.value = props.isOpen;
|
|
129
286
|
}
|
|
130
287
|
});
|
|
131
288
|
watch(() => props.day, (newDay) => {
|
|
132
|
-
if (newDay !== void 0) {
|
|
133
|
-
|
|
134
|
-
const d2 = _date.value instanceof Date ? _date.value.getTime() : new Date(_date.value || "").getTime();
|
|
135
|
-
if (d1 !== d2 || !newDay && _date.value) {
|
|
136
|
-
syncValue(newDay);
|
|
137
|
-
}
|
|
289
|
+
if (newDay !== void 0 && !areDateValuesEqual(newDay, _date.value)) {
|
|
290
|
+
syncValue(newDay);
|
|
138
291
|
}
|
|
139
292
|
});
|
|
140
293
|
watch(() => props.modelValue, (newVal) => {
|
|
141
|
-
if (newVal !== void 0) {
|
|
142
|
-
|
|
143
|
-
const d2 = _date.value instanceof Date ? _date.value.getTime() : new Date(_date.value || "").getTime();
|
|
144
|
-
if (d1 !== d2 || !newVal && _date.value) {
|
|
145
|
-
syncValue(newVal);
|
|
146
|
-
}
|
|
294
|
+
if (newVal !== void 0 && !areDateValuesEqual(newVal, _date.value)) {
|
|
295
|
+
syncValue(newVal);
|
|
147
296
|
}
|
|
148
297
|
});
|
|
149
298
|
watch(() => props.isOpen, (newVal) => {
|
|
150
299
|
calendarShow.value = !!newVal;
|
|
151
300
|
});
|
|
301
|
+
const reconcileIncompleteRange = () => {
|
|
302
|
+
if (!props.range) return;
|
|
303
|
+
const isIncompleteDate = Array.isArray(_date.value) && _date.value.length === 2 && (!_date.value[0] || !_date.value[1]);
|
|
304
|
+
let expectedMasked = "";
|
|
305
|
+
if (Array.isArray(_date.value) && _date.value.length === 2 && _date.value[0] && _date.value[1]) {
|
|
306
|
+
const d1 = parseDateValue(_date.value[0]);
|
|
307
|
+
const d2 = parseDateValue(_date.value[1]);
|
|
308
|
+
if (d1 && d2) {
|
|
309
|
+
expectedMasked = `${formatDate(d1)} - ${formatDate(d2)}`;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
if (isIncompleteDate || maskedModel.value !== expectedMasked) {
|
|
313
|
+
syncValue(props.modelValue !== void 0 ? props.modelValue : props.day);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
watch(calendarShow, (newVal, oldVal) => {
|
|
317
|
+
if (oldVal === true && newVal === false) {
|
|
318
|
+
reconcileIncompleteRange();
|
|
319
|
+
}
|
|
320
|
+
});
|
|
152
321
|
watch(() => props.format, () => {
|
|
153
|
-
if (
|
|
154
|
-
|
|
155
|
-
|
|
322
|
+
if (props.range) {
|
|
323
|
+
if (Array.isArray(_date.value) && _date.value.length === 2 && _date.value[0] && _date.value[1]) {
|
|
324
|
+
const d1 = parseDateValue(_date.value[0]);
|
|
325
|
+
const d2 = parseDateValue(_date.value[1]);
|
|
326
|
+
if (d1 && d2) {
|
|
327
|
+
maskedModel.value = `${formatDate(d1)} - ${formatDate(d2)}`;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
} else if (_date.value && _date.value !== "") {
|
|
331
|
+
const d = parseDateValue(_date.value);
|
|
332
|
+
if (d) {
|
|
156
333
|
maskedModel.value = formatDate(d);
|
|
157
334
|
}
|
|
158
335
|
}
|
|
159
336
|
});
|
|
160
337
|
const calendarDay = computed(() => {
|
|
161
|
-
const val = props.modelValue
|
|
338
|
+
const val = props.modelValue !== void 0 ? props.modelValue : props.day;
|
|
162
339
|
if (val) {
|
|
163
|
-
|
|
340
|
+
if (Array.isArray(val)) {
|
|
341
|
+
if (val[0]) return val[0];
|
|
342
|
+
} else {
|
|
343
|
+
return val;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
if (Array.isArray(_date.value) && _date.value[0]) {
|
|
347
|
+
return _date.value[0];
|
|
164
348
|
}
|
|
165
349
|
return /* @__PURE__ */ new Date();
|
|
166
350
|
});
|
|
@@ -169,7 +353,13 @@ export function useKDatePickerLogic(props) {
|
|
|
169
353
|
maskedModel,
|
|
170
354
|
calendarShow,
|
|
171
355
|
calendarDay,
|
|
356
|
+
effectiveMask,
|
|
357
|
+
effectivePlaceholder,
|
|
358
|
+
quickPresets: defaultQuickPresets,
|
|
359
|
+
applyQuickPreset,
|
|
172
360
|
textboxClicked,
|
|
173
|
-
dateSelected
|
|
361
|
+
dateSelected,
|
|
362
|
+
reconcileIncompleteRange,
|
|
363
|
+
formatDate
|
|
174
364
|
};
|
|
175
365
|
}
|
|
@@ -129,13 +129,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
129
129
|
modelValue: string | Date;
|
|
130
130
|
isOpen: boolean;
|
|
131
131
|
label: string;
|
|
132
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
132
133
|
definedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
133
134
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
134
135
|
day: string | Date;
|
|
135
|
-
|
|
136
|
+
validationText: string;
|
|
136
137
|
placeholder: string;
|
|
137
138
|
teleportTo: string;
|
|
138
|
-
validationText: string;
|
|
139
139
|
showClear: boolean;
|
|
140
140
|
format: string;
|
|
141
141
|
timeFormat: string;
|
|
@@ -129,13 +129,13 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
129
129
|
modelValue: string | Date;
|
|
130
130
|
isOpen: boolean;
|
|
131
131
|
label: string;
|
|
132
|
+
validation: "success" | "warning" | "error" | null | undefined;
|
|
132
133
|
definedDays: import("../KCalendar/types.js").IDefinedDay[];
|
|
133
134
|
markedDays: import("../KCalendar/types.js").IMarkedDay[];
|
|
134
135
|
day: string | Date;
|
|
135
|
-
|
|
136
|
+
validationText: string;
|
|
136
137
|
placeholder: string;
|
|
137
138
|
teleportTo: string;
|
|
138
|
-
validationText: string;
|
|
139
139
|
showClear: boolean;
|
|
140
140
|
format: string;
|
|
141
141
|
timeFormat: string;
|
|
@@ -8,7 +8,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
8
8
|
default: boolean;
|
|
9
9
|
};
|
|
10
10
|
anchorEl: {
|
|
11
|
-
type: import("vue").PropType<
|
|
11
|
+
type: import("vue").PropType<import("../../utils/dom.js").DomTargetLike>;
|
|
12
12
|
default: undefined;
|
|
13
13
|
};
|
|
14
14
|
teleportTo: {
|
|
@@ -39,7 +39,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
39
39
|
default: boolean;
|
|
40
40
|
};
|
|
41
41
|
anchorEl: {
|
|
42
|
-
type: import("vue").PropType<
|
|
42
|
+
type: import("vue").PropType<import("../../utils/dom.js").DomTargetLike>;
|
|
43
43
|
default: undefined;
|
|
44
44
|
};
|
|
45
45
|
teleportTo: {
|
|
@@ -62,12 +62,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
62
62
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
63
63
|
}>, {
|
|
64
64
|
isOpen: boolean;
|
|
65
|
+
align: import("./KDropdown.logic.js").KDropdownAlign;
|
|
65
66
|
direction: import("./KDropdown.logic.js").KDropdownDirection;
|
|
66
67
|
teleportTo: string;
|
|
67
68
|
fullWidth: boolean;
|
|
68
69
|
maxHeight: number;
|
|
69
|
-
|
|
70
|
-
anchorEl: HTMLElement;
|
|
70
|
+
anchorEl: import("../../utils/dom.js").DomTargetLike;
|
|
71
71
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
72
72
|
declare const _default: typeof __VLS_export;
|
|
73
73
|
export default _default;
|
|
@@ -8,7 +8,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
8
8
|
default: boolean;
|
|
9
9
|
};
|
|
10
10
|
anchorEl: {
|
|
11
|
-
type: import("vue").PropType<
|
|
11
|
+
type: import("vue").PropType<import("../../utils/dom.js").DomTargetLike>;
|
|
12
12
|
default: undefined;
|
|
13
13
|
};
|
|
14
14
|
teleportTo: {
|
|
@@ -39,7 +39,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
39
39
|
default: boolean;
|
|
40
40
|
};
|
|
41
41
|
anchorEl: {
|
|
42
|
-
type: import("vue").PropType<
|
|
42
|
+
type: import("vue").PropType<import("../../utils/dom.js").DomTargetLike>;
|
|
43
43
|
default: undefined;
|
|
44
44
|
};
|
|
45
45
|
teleportTo: {
|
|
@@ -62,12 +62,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
62
62
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
63
63
|
}>, {
|
|
64
64
|
isOpen: boolean;
|
|
65
|
+
align: import("./KDropdown.logic.js").KDropdownAlign;
|
|
65
66
|
direction: import("./KDropdown.logic.js").KDropdownDirection;
|
|
66
67
|
teleportTo: string;
|
|
67
68
|
fullWidth: boolean;
|
|
68
69
|
maxHeight: number;
|
|
69
|
-
|
|
70
|
-
anchorEl: HTMLElement;
|
|
70
|
+
anchorEl: import("../../utils/dom.js").DomTargetLike;
|
|
71
71
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
72
72
|
declare const _default: typeof __VLS_export;
|
|
73
73
|
export default _default;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type PropType, type Ref } from 'vue';
|
|
2
|
+
import { type DomTargetLike } from '../../utils/dom.js';
|
|
2
3
|
export type KDropdownDirection = 'auto' | 'bottom' | 'top' | 'left' | 'right';
|
|
3
4
|
export type KDropdownAlign = 'left' | 'right' | 'top' | 'bottom';
|
|
4
5
|
export interface KDropdownProps {
|
|
5
6
|
isOpen: boolean;
|
|
6
7
|
fullWidth: boolean;
|
|
7
|
-
anchorEl?:
|
|
8
|
+
anchorEl?: DomTargetLike;
|
|
8
9
|
teleportTo?: string;
|
|
9
10
|
align?: KDropdownAlign;
|
|
10
11
|
direction?: KDropdownDirection;
|
|
@@ -23,7 +24,7 @@ export declare const KDropdownDefaultProps: {
|
|
|
23
24
|
default: boolean;
|
|
24
25
|
};
|
|
25
26
|
anchorEl: {
|
|
26
|
-
type: PropType<
|
|
27
|
+
type: PropType<DomTargetLike>;
|
|
27
28
|
default: undefined;
|
|
28
29
|
};
|
|
29
30
|
teleportTo: {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ref, watch, onMounted, onUnmounted, nextTick, inject, computed } from "vue";
|
|
2
2
|
import { KMODAL_PORTAL_ID_KEY } from "../KModal/KModal.logic.js";
|
|
3
|
+
import { resolveElement, resolveModalTeleportTarget } from "../../utils/dom.js";
|
|
3
4
|
export const KDropdownDefaultProps = {
|
|
4
5
|
isOpen: {
|
|
5
6
|
type: Boolean,
|
|
@@ -33,19 +34,13 @@ export const KDropdownDefaultProps = {
|
|
|
33
34
|
export function useKDropdownLogic(props, emit) {
|
|
34
35
|
const modalPortalId = inject(KMODAL_PORTAL_ID_KEY, null);
|
|
35
36
|
const isInModal = computed(() => !!modalPortalId?.value);
|
|
37
|
+
const isMounted = ref(false);
|
|
38
|
+
const open = ref(false);
|
|
36
39
|
const teleportTarget = computed(() => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (typeof document !== "undefined" && !document.querySelector(targetId)) {
|
|
41
|
-
const activePortal = document.querySelector(".modal-portal");
|
|
42
|
-
if (activePortal && activePortal.id) return `#${activePortal.id}`;
|
|
43
|
-
}
|
|
44
|
-
return targetId;
|
|
45
|
-
}
|
|
46
|
-
return "body";
|
|
40
|
+
void isMounted.value;
|
|
41
|
+
void open.value;
|
|
42
|
+
return resolveModalTeleportTarget(props.teleportTo, modalPortalId);
|
|
47
43
|
});
|
|
48
|
-
const open = ref(false);
|
|
49
44
|
const dropdownRect = ref({
|
|
50
45
|
top: 0,
|
|
51
46
|
left: 0,
|
|
@@ -57,7 +52,9 @@ export function useKDropdownLogic(props, emit) {
|
|
|
57
52
|
resolvedDirection: "bottom",
|
|
58
53
|
resolvedAlign: "left"
|
|
59
54
|
});
|
|
55
|
+
let openRequestId = 0;
|
|
60
56
|
const clickoutside = () => {
|
|
57
|
+
openRequestId++;
|
|
61
58
|
open.value = false;
|
|
62
59
|
emit("update:isOpen", open.value);
|
|
63
60
|
};
|
|
@@ -100,7 +97,7 @@ export function useKDropdownLogic(props, emit) {
|
|
|
100
97
|
const updatePosition = () => {
|
|
101
98
|
try {
|
|
102
99
|
if (props.anchorEl) {
|
|
103
|
-
const el = props.anchorEl
|
|
100
|
+
const el = resolveElement(props.anchorEl);
|
|
104
101
|
if (el && typeof el.getBoundingClientRect === "function") {
|
|
105
102
|
const rect = el.getBoundingClientRect();
|
|
106
103
|
const viewportWidth = document.documentElement.clientWidth;
|
|
@@ -144,10 +141,13 @@ export function useKDropdownLogic(props, emit) {
|
|
|
144
141
|
watch(
|
|
145
142
|
() => props.isOpen,
|
|
146
143
|
(newValue) => {
|
|
144
|
+
const requestId = ++openRequestId;
|
|
147
145
|
if (newValue) {
|
|
148
146
|
updatePosition();
|
|
149
147
|
nextTick(() => {
|
|
150
|
-
|
|
148
|
+
if (requestId === openRequestId && props.isOpen) {
|
|
149
|
+
open.value = true;
|
|
150
|
+
}
|
|
151
151
|
});
|
|
152
152
|
} else {
|
|
153
153
|
open.value = false;
|
|
@@ -164,6 +164,7 @@ export function useKDropdownLogic(props, emit) {
|
|
|
164
164
|
}
|
|
165
165
|
);
|
|
166
166
|
onMounted(() => {
|
|
167
|
+
isMounted.value = true;
|
|
167
168
|
window.addEventListener("scroll", repositionOnScroll, true);
|
|
168
169
|
window.addEventListener("resize", repositionOnScroll);
|
|
169
170
|
});
|