@katlux/toolkit 0.1.1-alpha.111 → 0.1.1-alpha.112
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiled/composables/locales.mjs +195 -27
- package/dist/compiled/composables/useDataProvider.mjs +121 -90
- package/dist/compiled/composables/useDataProvider.spec.mjs +20 -1
- package/dist/compiled/composables/useKatluxContext.mjs +21 -0
- package/dist/compiled/composables/useKatluxContext.spec.mjs +63 -0
- package/dist/compiled/composables/useKatluxI18n.mjs +20 -9
- package/dist/compiled/composables/usePresetComponent.mjs +12 -3
- package/dist/compiled/utils/PresetResolver.mjs +21 -7
- package/dist/compiled/utils/TemplateResolver.mjs +11 -5
- package/dist/module.cjs +3 -31
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -32
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +5 -5
- package/dist/runtime/components/KCombobox/KCombobox.global.vue +6 -0
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +5 -5
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +3 -0
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +192 -14
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +11 -11
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +11 -11
- package/dist/runtime/components/KCompositeInput/KCompositeInput.logic.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +23 -16
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +36 -27
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +6 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +6 -6
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +7 -7
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +7 -7
- package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +1 -1
- package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
- package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KModal/KModal.global.d.vue.ts +15 -2
- package/dist/runtime/components/KModal/KModal.global.vue +6 -1
- package/dist/runtime/components/KModal/KModal.global.vue.d.ts +15 -2
- package/dist/runtime/components/KModal/KModal.logic.d.ts +8 -2
- package/dist/runtime/components/KModal/KModal.logic.js +21 -3
- package/dist/runtime/components/KPagination/KPagination.global.vue +2 -0
- package/dist/runtime/components/KPagination/KPagination.logic.d.ts +2 -1
- package/dist/runtime/components/KPagination/KPagination.logic.js +1 -0
- package/dist/runtime/components/KSlider/KSlider.global.d.vue.ts +1 -1
- package/dist/runtime/components/KSlider/KSlider.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTabs/KTabItem.logic.js +20 -5
- package/dist/runtime/components/KTabs/KTabs.logic.js +18 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +2 -2
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +2 -2
- package/dist/runtime/components/KToast/KToast.logic.d.ts +1 -0
- package/dist/runtime/components/KToast/KToast.logic.js +19 -5
- package/dist/runtime/components/KTree/KTree.global.d.vue.ts +12 -3
- package/dist/runtime/components/KTree/KTree.global.vue +1 -0
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +12 -3
- package/dist/runtime/components/KTree/KTree.logic.d.ts +9 -4
- package/dist/runtime/components/KTree/KTree.logic.js +9 -6
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +4 -4
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +4 -4
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +3 -0
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +28 -4
- package/dist/runtime/components/KTreeView/KTreeView.global.vue +15 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +28 -4
- package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +18 -4
- package/dist/runtime/components/KTreeView/KTreeView.logic.js +26 -7
- package/dist/runtime/composables/locales.js +195 -27
- package/dist/runtime/composables/useDataProvider.d.ts +1 -1
- package/dist/runtime/composables/useDataProvider.js +121 -90
- package/dist/runtime/composables/useDebounce.d.ts +1 -1
- package/dist/runtime/composables/useKatluxContext.d.ts +13 -0
- package/dist/runtime/composables/useKatluxContext.js +21 -0
- package/dist/runtime/composables/useKatluxI18n.js +20 -9
- package/dist/runtime/composables/usePresetComponent.js +12 -3
- package/dist/runtime/directives/clickOutside.d.ts +3 -2
- package/dist/runtime/directives/clickOutside.js +9 -2
- package/dist/runtime/hydration/NuxtHydrationAdapter.d.ts +10 -0
- package/dist/runtime/hydration/NuxtHydrationAdapter.js +88 -0
- package/dist/runtime/plugins/PresetPlugin.js +9 -1
- package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +2 -3
- package/dist/runtime/plugins/nuxtCompatPlugin.js +6 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarWeek.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +24 -2
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +19 -6
- package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +4 -1
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +36 -8
- package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +4 -1
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue +1 -1
- package/dist/runtime/presets/default/components/KCompositeInput/KCompositeInput.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +1 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +1 -1
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue +1 -1
- package/dist/runtime/presets/default/components/KDateTimePicker/KDateTimePicker.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +1 -20
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.d.vue.ts +2 -2
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue +2 -2
- package/dist/runtime/presets/default/components/KHourPicker/KHourPicker.vue.d.ts +2 -2
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue +6 -2
- package/dist/runtime/presets/default/components/KMaskTextbox/KMaskTextbox.vue +1 -1
- package/dist/runtime/presets/default/components/KModal/KModal.vue +16 -4
- package/dist/runtime/presets/default/components/KPagination/KPagination.d.vue.ts +1 -0
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue +5 -4
- package/dist/runtime/presets/default/components/KPagination/KPagination.vue.d.ts +1 -0
- package/dist/runtime/presets/default/components/KRangeSlider/KRangeSlider.vue +3 -1
- package/dist/runtime/presets/default/components/KSlider/KSlider.vue +2 -1
- package/dist/runtime/presets/default/components/KTabs/KTabs.vue +2 -1
- package/dist/runtime/presets/default/components/KToast/KToast.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KToast/KToast.vue +1 -1
- package/dist/runtime/presets/default/components/KToast/KToast.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KTooltip/KTooltip.vue +2 -0
- package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +20 -10
- package/dist/runtime/presets/default/components/KTree/KTree.vue +34 -24
- package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +20 -10
- package/dist/runtime/presets/default/components/KTreeView/KTreeCell.vue +2 -1
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +8 -2
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +10 -1
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +8 -2
- package/dist/runtime/server/middleware/session.d.ts +2 -0
- package/dist/runtime/server/middleware/session.js +36 -0
- package/dist/runtime/utils/PresetResolver.js +21 -7
- package/dist/runtime/utils/TemplateResolver.js +11 -5
- package/package.json +2 -2
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
:key="index"
|
|
12
12
|
@click="toggleItem(index)"
|
|
13
13
|
size="small"
|
|
14
|
-
:
|
|
14
|
+
:type="isOpen(index) ? 'primary' : 'default'"
|
|
15
|
+
:class="{ 'is-active': isOpen(index) }"
|
|
15
16
|
role="tab"
|
|
16
17
|
:aria-selected="isOpen(index)"
|
|
17
18
|
:tabindex="isOpen(index) ? 0 : -1"
|
|
@@ -13,7 +13,7 @@ Teleport(to="body" :disabled="!teleport")
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script lang="ts" setup>
|
|
16
|
-
import type { KToastType } from '
|
|
16
|
+
import type { KToastType } from '#toolkit/components/KToast/KToast.logic'
|
|
17
17
|
|
|
18
18
|
defineProps<{
|
|
19
19
|
modelValue: boolean
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
|
+
import type { TTreeRow } from '@katlux/providers';
|
|
2
3
|
type __VLS_Props = {
|
|
3
|
-
visibleRows:
|
|
4
|
+
visibleRows: TTreeRow[];
|
|
4
5
|
expandedNodes: Set<string | number>;
|
|
5
|
-
labelField
|
|
6
|
-
iconField
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
labelField?: string;
|
|
7
|
+
iconField?: string;
|
|
8
|
+
idKey?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
multiSelect?: boolean;
|
|
11
|
+
isNodeSelected?: (node: any) => boolean;
|
|
10
12
|
toggleNode: (id: string | number) => void;
|
|
11
|
-
selectable
|
|
13
|
+
selectable?: boolean;
|
|
12
14
|
dataProvider?: {
|
|
13
15
|
loading: Ref<boolean>;
|
|
14
16
|
initialLoad?: Ref<boolean>;
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
18
|
-
select: (row:
|
|
20
|
+
select: (row: TTreeRow) => any;
|
|
19
21
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
-
onSelect?: ((row:
|
|
21
|
-
}>, {
|
|
22
|
+
onSelect?: ((row: TTreeRow) => any) | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
idKey: string;
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
labelField: string;
|
|
27
|
+
multiSelect: boolean;
|
|
28
|
+
iconField: string;
|
|
29
|
+
isNodeSelected: (node: any) => boolean;
|
|
30
|
+
selectable: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
32
|
declare const _default: typeof __VLS_export;
|
|
23
33
|
export default _default;
|
|
@@ -6,19 +6,19 @@
|
|
|
6
6
|
v-for="row in visibleRows"
|
|
7
7
|
:key="row[idKey] || row.id"
|
|
8
8
|
:class="{ 'has-children': row.__treeNode?.hasChildren }"
|
|
9
|
-
:style="{
|
|
9
|
+
:style="{ '--tree-depth': row.__treeNode?.depth || 0 }"
|
|
10
10
|
role="treeitem"
|
|
11
11
|
:aria-expanded="row.__treeNode?.hasChildren ? row.__treeNode?.isExpanded : undefined"
|
|
12
12
|
:aria-level="(row.__treeNode?.depth || 0) + 1"
|
|
13
13
|
tabindex="0"
|
|
14
14
|
@keydown.enter.prevent="onNodeClick(row)"
|
|
15
|
-
@keydown.space.prevent="row.__treeNode?.hasChildren ? toggleNode(row.__treeNode
|
|
15
|
+
@keydown.space.prevent="row.__treeNode?.hasChildren && row.__treeNode?.id !== undefined ? toggleNode(row.__treeNode.id) : onNodeClick(row)"
|
|
16
16
|
)
|
|
17
17
|
.node-content
|
|
18
18
|
// Toggle
|
|
19
19
|
.tree-toggle(
|
|
20
|
-
v-if="row.__treeNode?.hasChildren"
|
|
21
|
-
@click="toggleNode(row.__treeNode
|
|
20
|
+
v-if="row.__treeNode?.hasChildren && row.__treeNode?.id !== undefined"
|
|
21
|
+
@click="toggleNode(row.__treeNode.id)"
|
|
22
22
|
:class="{ expanded: row.__treeNode?.isExpanded }"
|
|
23
23
|
role="button"
|
|
24
24
|
:aria-label="t('Toggle node')"
|
|
@@ -50,34 +50,44 @@
|
|
|
50
50
|
|
|
51
51
|
<script lang="ts" setup>
|
|
52
52
|
import { computed, type Ref } from 'vue'
|
|
53
|
+
import type { TTreeRow } from '@katlux/providers'
|
|
53
54
|
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
54
55
|
|
|
55
56
|
const { t } = useKatluxI18n()
|
|
56
57
|
|
|
57
|
-
const props =
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
const props = withDefaults(
|
|
59
|
+
defineProps<{
|
|
60
|
+
visibleRows: TTreeRow[]
|
|
61
|
+
expandedNodes: Set<string | number>
|
|
62
|
+
labelField?: string
|
|
63
|
+
iconField?: string
|
|
64
|
+
idKey?: string
|
|
65
|
+
disabled?: boolean
|
|
66
|
+
multiSelect?: boolean
|
|
67
|
+
isNodeSelected?: (node: any) => boolean
|
|
68
|
+
toggleNode: (id: string | number) => void
|
|
69
|
+
selectable?: boolean
|
|
70
|
+
dataProvider?: {
|
|
71
|
+
loading: Ref<boolean>
|
|
72
|
+
initialLoad?: Ref<boolean>
|
|
73
|
+
}
|
|
74
|
+
}>(),
|
|
75
|
+
{
|
|
76
|
+
labelField: 'name',
|
|
77
|
+
iconField: 'icon',
|
|
78
|
+
idKey: 'id',
|
|
79
|
+
disabled: false,
|
|
80
|
+
multiSelect: false,
|
|
81
|
+
selectable: false,
|
|
82
|
+
isNodeSelected: () => false,
|
|
70
83
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// Helper to get ID if needed, but we use row[idKey] or row.id in key
|
|
74
|
-
const idKey = 'id' // Simplify for now, or pass as prop if needed. usually id.
|
|
84
|
+
)
|
|
75
85
|
|
|
76
86
|
const emit = defineEmits<{
|
|
77
|
-
(e: 'select', row:
|
|
87
|
+
(e: 'select', row: TTreeRow): void
|
|
78
88
|
}>()
|
|
79
89
|
|
|
80
|
-
function onNodeClick(row:
|
|
90
|
+
function onNodeClick(row: TTreeRow) {
|
|
81
91
|
if (!props.disabled) {
|
|
82
92
|
emit('select', row)
|
|
83
93
|
}
|
|
@@ -99,7 +109,7 @@ const isLoading = computed(() => props.dataProvider?.loading?.value || props.dat
|
|
|
99
109
|
.tree-node {
|
|
100
110
|
display: flex;
|
|
101
111
|
align-items: center;
|
|
102
|
-
padding: 4px 8px;
|
|
112
|
+
padding: 4px 8px 4px calc(8px + var(--tree-depth, 0) * var(--tree-indent, 20px));
|
|
103
113
|
min-height: 32px;
|
|
104
114
|
transition: background-color 0.2s;
|
|
105
115
|
|
|
@@ -1,23 +1,33 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
|
+
import type { TTreeRow } from '@katlux/providers';
|
|
2
3
|
type __VLS_Props = {
|
|
3
|
-
visibleRows:
|
|
4
|
+
visibleRows: TTreeRow[];
|
|
4
5
|
expandedNodes: Set<string | number>;
|
|
5
|
-
labelField
|
|
6
|
-
iconField
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
labelField?: string;
|
|
7
|
+
iconField?: string;
|
|
8
|
+
idKey?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
multiSelect?: boolean;
|
|
11
|
+
isNodeSelected?: (node: any) => boolean;
|
|
10
12
|
toggleNode: (id: string | number) => void;
|
|
11
|
-
selectable
|
|
13
|
+
selectable?: boolean;
|
|
12
14
|
dataProvider?: {
|
|
13
15
|
loading: Ref<boolean>;
|
|
14
16
|
initialLoad?: Ref<boolean>;
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
18
|
-
select: (row:
|
|
20
|
+
select: (row: TTreeRow) => any;
|
|
19
21
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
20
|
-
onSelect?: ((row:
|
|
21
|
-
}>, {
|
|
22
|
+
onSelect?: ((row: TTreeRow) => any) | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
idKey: string;
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
labelField: string;
|
|
27
|
+
multiSelect: boolean;
|
|
28
|
+
iconField: string;
|
|
29
|
+
isNodeSelected: (node: any) => boolean;
|
|
30
|
+
selectable: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
32
|
declare const _default: typeof __VLS_export;
|
|
23
33
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.tree-cell(:style="{
|
|
2
|
+
.tree-cell(:style="{ '--tree-depth': depth }")
|
|
3
3
|
.tree-toggle(v-if="hasChildren" @click.stop="toggle")
|
|
4
4
|
KIcon(iconname="chevron" :width="12" :height="12" :rotate="isExpanded ? '90' : '0'")
|
|
5
5
|
.tree-spacer(v-else)
|
|
@@ -21,6 +21,7 @@ defineProps<{
|
|
|
21
21
|
display: flex;
|
|
22
22
|
align-items: center;
|
|
23
23
|
gap: 4px;
|
|
24
|
+
padding-left: calc(var(--tree-depth, 0) * var(--tree-indent, 24px));
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
.tree-toggle {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ITreeViewColumn } from '
|
|
1
|
+
import type { ITreeViewColumn } from '#toolkit/components/KTreeView/KTreeView.logic';
|
|
2
2
|
import type { IKDatatableAction } from '@katlux/providers';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
dataProvider: any;
|
|
@@ -19,6 +19,12 @@ type __VLS_Props = {
|
|
|
19
19
|
columnHeaders?: Record<string, string>;
|
|
20
20
|
columnWidths?: Record<string, string>;
|
|
21
21
|
};
|
|
22
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}
|
|
22
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
23
|
+
"update:selectedRows": (value: any[]) => any;
|
|
24
|
+
"update:selectAll": (value: boolean) => any;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
26
|
+
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
27
|
+
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
28
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
29
|
declare const _default: typeof __VLS_export;
|
|
24
30
|
export default _default;
|
|
@@ -9,6 +9,10 @@
|
|
|
9
9
|
:headerSlots="headerSlots"
|
|
10
10
|
:columnHeaders="columnHeaders"
|
|
11
11
|
:columnWidths="columnWidths"
|
|
12
|
+
:selectedRows="selectedRows"
|
|
13
|
+
:selectAll="selectAll"
|
|
14
|
+
@update:selectedRows="$emit('update:selectedRows', $event)"
|
|
15
|
+
@update:selectAll="$emit('update:selectAll', $event)"
|
|
12
16
|
)
|
|
13
17
|
//- Tree column cell: rendered natively via dynamic slot name — no h() needed
|
|
14
18
|
template(v-if="treeColumnField" v-slot:[treeCellSlotName]="slotProps")
|
|
@@ -24,7 +28,7 @@
|
|
|
24
28
|
<script lang="ts" setup>
|
|
25
29
|
import { computed } from 'vue'
|
|
26
30
|
import KTreeCell from './KTreeCell.vue'
|
|
27
|
-
import type { ITreeViewColumn } from '
|
|
31
|
+
import type { ITreeViewColumn } from '#toolkit/components/KTreeView/KTreeView.logic'
|
|
28
32
|
import type { IKDatatableAction } from '@katlux/providers'
|
|
29
33
|
|
|
30
34
|
const props = defineProps<{
|
|
@@ -48,6 +52,11 @@ const props = defineProps<{
|
|
|
48
52
|
columnWidths?: Record<string, string>
|
|
49
53
|
}>()
|
|
50
54
|
|
|
55
|
+
const emit = defineEmits<{
|
|
56
|
+
(e: 'update:selectedRows', value: any[]): void
|
|
57
|
+
(e: 'update:selectAll', value: boolean): void
|
|
58
|
+
}>()
|
|
59
|
+
|
|
51
60
|
const visibleFields = computed(() => (props.columns as ITreeViewColumn[]).map(col => col.field))
|
|
52
61
|
|
|
53
62
|
// Compute the tree column field and the dynamic slot name
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ITreeViewColumn } from '
|
|
1
|
+
import type { ITreeViewColumn } from '#toolkit/components/KTreeView/KTreeView.logic';
|
|
2
2
|
import type { IKDatatableAction } from '@katlux/providers';
|
|
3
3
|
type __VLS_Props = {
|
|
4
4
|
dataProvider: any;
|
|
@@ -19,6 +19,12 @@ type __VLS_Props = {
|
|
|
19
19
|
columnHeaders?: Record<string, string>;
|
|
20
20
|
columnWidths?: Record<string, string>;
|
|
21
21
|
};
|
|
22
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}
|
|
22
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
23
|
+
"update:selectedRows": (value: any[]) => any;
|
|
24
|
+
"update:selectAll": (value: boolean) => any;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
26
|
+
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
27
|
+
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
28
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
29
|
declare const _default: typeof __VLS_export;
|
|
24
30
|
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineEventHandler, getCookie, setCookie } from "h3";
|
|
2
|
+
export default defineEventHandler((event) => {
|
|
3
|
+
const path = event.path || event.node?.req?.url || "";
|
|
4
|
+
if (path.startsWith("/_nuxt") || path.startsWith("/__") || /\.(js|css|png|jpg|jpeg|svg|ico|woff2?|map)$/i.test(path)) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
let sessionId = getCookie(event, "_session_id");
|
|
8
|
+
if (!sessionId) {
|
|
9
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
10
|
+
sessionId = crypto.randomUUID();
|
|
11
|
+
} else if (typeof crypto !== "undefined" && typeof crypto.getRandomValues === "function") {
|
|
12
|
+
const bytes = new Uint8Array(16);
|
|
13
|
+
crypto.getRandomValues(bytes);
|
|
14
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
15
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
16
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
17
|
+
sessionId = `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
18
|
+
} else {
|
|
19
|
+
sessionId = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
20
|
+
const r = Math.random() * 16 | 0;
|
|
21
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
22
|
+
return v.toString(16);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
setCookie(event, "_session_id", sessionId, {
|
|
27
|
+
path: "/",
|
|
28
|
+
maxAge: 365 * 24 * 60 * 60,
|
|
29
|
+
sameSite: "lax",
|
|
30
|
+
httpOnly: false
|
|
31
|
+
});
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
event.context.sessionId = sessionId;
|
|
36
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useRuntimeConfig, useAppConfig, useCookie, useNuxtApp } from "#app";
|
|
1
|
+
import { useRuntimeConfig, useAppConfig, useCookie, useNuxtApp, useState } from "#app";
|
|
2
2
|
export class PresetResolver {
|
|
3
3
|
cache = {};
|
|
4
4
|
activePreset = "default";
|
|
@@ -50,10 +50,12 @@ export class PresetResolver {
|
|
|
50
50
|
hasCustomPreset: false,
|
|
51
51
|
hasCustomStyles: false
|
|
52
52
|
};
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
const presetList = Array.isArray(this.activePreset) ? this.activePreset : [this.activePreset];
|
|
54
|
+
const candidatePresets = presetList.filter((p) => p && p !== "default");
|
|
55
|
+
if (candidatePresets.length > 0) {
|
|
56
|
+
const targetPreset = candidatePresets[0];
|
|
57
|
+
metadata.presetPath = `${this.presetsDir}/${targetPreset}/${componentName}.pug`;
|
|
58
|
+
metadata.stylesPath = `${this.presetsDir}/${targetPreset}/${componentName}.scss`;
|
|
57
59
|
metadata.hasCustomPreset = true;
|
|
58
60
|
metadata.hasCustomStyles = true;
|
|
59
61
|
}
|
|
@@ -74,8 +76,20 @@ export class PresetResolver {
|
|
|
74
76
|
if (JSON.stringify(this.activePreset) !== JSON.stringify(presetName)) {
|
|
75
77
|
this.activePreset = presetName;
|
|
76
78
|
this.clearCache();
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
try {
|
|
80
|
+
const activePresetState = useState("katlux-active-preset-state");
|
|
81
|
+
activePresetState.value = presetName;
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
const presetCookie = useCookie("katlux-active-preset");
|
|
86
|
+
presetCookie.value = typeof presetName === "string" ? presetName : JSON.stringify(presetName);
|
|
87
|
+
} catch {
|
|
88
|
+
if (typeof document !== "undefined") {
|
|
89
|
+
const val = typeof presetName === "string" ? presetName : JSON.stringify(presetName);
|
|
90
|
+
document.cookie = `katlux-active-preset=${encodeURIComponent(val)}; path=/; max-age=31536000; SameSite=Lax`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
95
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PresetResolver, usePresetResolver } from "./PresetResolver.js";
|
|
2
|
+
import { useNuxtApp } from "#app";
|
|
2
3
|
export class TemplateResolver extends PresetResolver {
|
|
3
4
|
resolveTemplate(componentName) {
|
|
4
5
|
const presetMeta = this.resolvePreset(componentName);
|
|
@@ -18,14 +19,19 @@ export class TemplateResolver extends PresetResolver {
|
|
|
18
19
|
}
|
|
19
20
|
export function useTemplateResolver() {
|
|
20
21
|
try {
|
|
22
|
+
const nuxtApp = useNuxtApp();
|
|
23
|
+
if (nuxtApp?.$templateResolver) {
|
|
24
|
+
return nuxtApp.$templateResolver;
|
|
25
|
+
}
|
|
21
26
|
const nuxtPresetResolver = usePresetResolver();
|
|
27
|
+
const tr = new TemplateResolver();
|
|
22
28
|
if (nuxtPresetResolver) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return tr;
|
|
29
|
+
tr.setActivePreset(nuxtPresetResolver.getActivePreset());
|
|
30
|
+
}
|
|
31
|
+
if (nuxtApp?.provide) {
|
|
32
|
+
nuxtApp.provide("templateResolver", tr);
|
|
28
33
|
}
|
|
34
|
+
return tr;
|
|
29
35
|
} catch {
|
|
30
36
|
}
|
|
31
37
|
return new TemplateResolver();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@katlux/toolkit",
|
|
3
|
-
"version": "0.1.1-alpha.
|
|
3
|
+
"version": "0.1.1-alpha.112",
|
|
4
4
|
"description": "Core UI toolkit and utilities for the Katlux ecosystem",
|
|
5
5
|
"author": "Katlux",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"./dist/runtime/presets/*": "./dist/runtime/presets/*"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@katlux/providers": "
|
|
41
|
+
"@katlux/providers": "^0.1.1-alpha.100",
|
|
42
42
|
"@nuxt/kit": "^3.12.0",
|
|
43
43
|
"@nuxtjs/i18n": "^10.4.0",
|
|
44
44
|
"pug": "^3.0.0",
|