@katlux/toolkit 0.1.1-alpha.119 → 0.1.1-alpha.121

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.
Files changed (84) hide show
  1. package/bin/add-ai-reference.mjs +152 -39
  2. package/bin/cli.mjs +20 -1
  3. package/dist/compiled/composables/useDataProvider.mjs +20 -0
  4. package/dist/compiled/composables/useKatluxForm.mjs +55 -12
  5. package/dist/compiled/composables/useVirtualScroll.mjs +78 -8
  6. package/dist/module.json +1 -1
  7. package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +26 -17
  8. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +12 -0
  9. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue +4 -2
  10. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +12 -0
  11. package/dist/runtime/components/KCheckbox/KCheckbox.logic.d.ts +5 -0
  12. package/dist/runtime/components/KCheckbox/KCheckbox.logic.js +4 -0
  13. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +2 -0
  14. package/dist/runtime/components/KCombobox/KCombobox.global.vue +2 -2
  15. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +2 -0
  16. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +1 -0
  17. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +5 -33
  18. package/dist/runtime/components/KDatatable/KDatatable.logic.js +30 -31
  19. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +4 -2
  20. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +2 -1
  21. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +4 -2
  22. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
  23. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
  24. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +1 -1
  25. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +1 -1
  26. package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +36 -0
  27. package/dist/runtime/components/KGantt/KGantt.global.vue +5 -1
  28. package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +36 -0
  29. package/dist/runtime/components/KGantt/KGantt.logic.d.ts +20 -0
  30. package/dist/runtime/components/KGantt/KGantt.logic.js +17 -6
  31. package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +2 -0
  32. package/dist/runtime/components/KPagination/KPagination.global.vue +1 -1
  33. package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +2 -0
  34. package/dist/runtime/components/KPagination/KPagination.logic.d.ts +1 -0
  35. package/dist/runtime/components/KPagination/KPagination.logic.js +6 -1
  36. package/dist/runtime/components/KTooltip/KTooltip.global.d.vue.ts +1 -1
  37. package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
  38. package/dist/runtime/components/KTree/KTree.global.d.vue.ts +1 -1
  39. package/dist/runtime/components/KTree/KTree.global.vue +0 -1
  40. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +1 -1
  41. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +1 -1
  42. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +1 -1
  43. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +1 -1
  44. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +1 -1
  45. package/dist/runtime/composables/useDataProvider.d.ts +1 -0
  46. package/dist/runtime/composables/useDataProvider.js +20 -0
  47. package/dist/runtime/composables/useFilterLogic.d.ts +1 -0
  48. package/dist/runtime/composables/useKatluxForm.d.ts +2 -0
  49. package/dist/runtime/composables/useKatluxForm.js +55 -12
  50. package/dist/runtime/composables/useVirtualScroll.d.ts +1 -1
  51. package/dist/runtime/composables/useVirtualScroll.js +78 -8
  52. package/dist/runtime/presets/default/assets/scss/css-variables.css +1 -0
  53. package/dist/runtime/presets/default/assets/scss/css-variables.scss +1 -0
  54. package/dist/runtime/presets/default/assets/scss/index.css +1 -0
  55. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +4 -4
  56. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.d.vue.ts +3 -0
  57. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +7 -0
  58. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue.d.ts +3 -0
  59. package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +2 -0
  60. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +3 -1
  61. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +2 -0
  62. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +2 -0
  63. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +20 -6
  64. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +2 -0
  65. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +85 -15
  66. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +3 -1
  67. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +3 -1
  68. package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +3 -1
  69. package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +4 -0
  70. package/dist/runtime/presets/default/components/KGantt/KGantt.vue +16 -2
  71. package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +4 -0
  72. package/dist/runtime/presets/default/components/KGrid/KGrid.vue +1 -0
  73. package/dist/runtime/presets/default/components/KLayout/KLayout.d.vue.ts +6 -1
  74. package/dist/runtime/presets/default/components/KLayout/KLayout.vue +53 -5
  75. package/dist/runtime/presets/default/components/KLayout/KLayout.vue.d.ts +6 -1
  76. package/dist/runtime/presets/default/components/KPagination/KPagination.vue +29 -7
  77. package/dist/runtime/presets/default/components/KTextarea/KTextarea.vue +1 -0
  78. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +1 -1
  79. package/dist/runtime/presets/default/components/KToast/KToast.vue +0 -1
  80. package/dist/runtime/presets/default/components/KToastContainer/KToastContainer.vue +0 -1
  81. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +2 -3
  82. package/dist/runtime/presets/default/components/KTree/KTree.vue +7 -5
  83. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +2 -3
  84. package/package.json +2 -2
@@ -14,14 +14,16 @@ type __VLS_Props = {
14
14
  dateSelected: (date: Date) => void;
15
15
  teleportTo?: string;
16
16
  placeholder?: string;
17
- validation?: 'success' | 'warning' | 'error' | null;
17
+ validation?: 'success' | 'warning' | null | 'error';
18
18
  validationText?: string;
19
19
  align?: 'left' | 'right';
20
20
  };
21
21
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
22
+ blur: (event: FocusEvent) => any;
22
23
  "update:maskedModel": (value: string) => any;
23
24
  "update:calendarShow": (value: boolean) => any;
24
25
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
26
+ onBlur?: ((event: FocusEvent) => any) | undefined;
25
27
  "onUpdate:maskedModel"?: ((value: string) => any) | undefined;
26
28
  "onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
27
29
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -9,6 +9,7 @@
9
9
  @click.stop="textboxClicked"
10
10
  :showClear="showClear"
11
11
  @clear="onClear"
12
+ @blur="emit('blur', $event)"
12
13
  :validation="validation"
13
14
  :validationText="validationText"
14
15
  )
@@ -39,7 +40,7 @@ const props = defineProps<{
39
40
  dateSelected: (date: Date) => void
40
41
  teleportTo?: string
41
42
  placeholder?: string
42
- validation?: 'success' | 'warning' | 'error' | null
43
+ validation?: 'success' | 'warning' | null | 'error'
43
44
  validationText?: string
44
45
  align?: 'left' | 'right'
45
46
  }>()
@@ -47,6 +48,7 @@ const props = defineProps<{
47
48
  const emit = defineEmits<{
48
49
  (e: 'update:maskedModel', value: string): void
49
50
  (e: 'update:calendarShow', value: boolean): void
51
+ (e: 'blur', event: FocusEvent): void
50
52
  }>()
51
53
 
52
54
  const maskedModel = computed({
@@ -14,14 +14,16 @@ type __VLS_Props = {
14
14
  dateSelected: (date: Date) => void;
15
15
  teleportTo?: string;
16
16
  placeholder?: string;
17
- validation?: 'success' | 'warning' | 'error' | null;
17
+ validation?: 'success' | 'warning' | null | 'error';
18
18
  validationText?: string;
19
19
  align?: 'left' | 'right';
20
20
  };
21
21
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
22
+ blur: (event: FocusEvent) => any;
22
23
  "update:maskedModel": (value: string) => any;
23
24
  "update:calendarShow": (value: boolean) => any;
24
25
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
26
+ onBlur?: ((event: FocusEvent) => any) | undefined;
25
27
  "onUpdate:maskedModel"?: ((value: string) => any) | undefined;
26
28
  "onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
27
29
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -25,6 +25,10 @@ type __VLS_Props = {
25
25
  headerSlots?: any;
26
26
  endingPoint?: Date | string | number;
27
27
  mode?: 'date' | 'numeric';
28
+ virtualScroll?: boolean;
29
+ itemHeight?: number;
30
+ viewportHeight?: number;
31
+ buffer?: number;
28
32
  moveTime?: (amount: number) => void;
29
33
  zoom?: (factor: number) => void;
30
34
  };
@@ -1,5 +1,5 @@
1
1
  <template lang="pug">
2
- .KGantt
2
+ .KGantt(:class="{ 'is-virtual-scroll': virtualScroll }")
3
3
  .KGantt__scroll-container(
4
4
  ref="scrollContainer"
5
5
  @wheel="onWheel"
@@ -16,6 +16,10 @@
16
16
  :headerSlots="headerSlots"
17
17
  :selectedRows="selectedRows"
18
18
  :selectAll="selectAll"
19
+ :virtualScroll="virtualScroll"
20
+ :itemHeight="itemHeight"
21
+ :viewportHeight="viewportHeight"
22
+ :buffer="buffer"
19
23
  @update:selectedRows="$emit('update:selectedRows', $event)"
20
24
  @update:selectAll="$emit('update:selectAll', $event)"
21
25
  )
@@ -88,6 +92,11 @@ const props = defineProps<{
88
92
  endingPoint?: Date | string | number
89
93
  mode?: 'date' | 'numeric'
90
94
 
95
+ virtualScroll?: boolean
96
+ itemHeight?: number
97
+ viewportHeight?: number
98
+ buffer?: number
99
+
91
100
  moveTime?: (amount: number) => void
92
101
  zoom?: (factor: number) => void
93
102
  }>()
@@ -328,7 +337,6 @@ onBeforeUnmount(() => {
328
337
  }
329
338
  })
330
339
 
331
- // User columns shrink to content; timeline fills remaining space
332
340
  const ganttColumns = computed(() => {
333
341
  const cols = props.columns.map(col => ({ ...col, width: col.width ?? '1%' }))
334
342
 
@@ -371,6 +379,12 @@ const ganttColumns = computed(() => {
371
379
  }
372
380
  }
373
381
 
382
+ &.is-virtual-scroll {
383
+ .KGantt__scroll-container {
384
+ overflow-y: hidden;
385
+ }
386
+ }
387
+
374
388
  &__inner {
375
389
  min-width: 100%;
376
390
  }
@@ -25,6 +25,10 @@ type __VLS_Props = {
25
25
  headerSlots?: any;
26
26
  endingPoint?: Date | string | number;
27
27
  mode?: 'date' | 'numeric';
28
+ virtualScroll?: boolean;
29
+ itemHeight?: number;
30
+ viewportHeight?: number;
31
+ buffer?: number;
28
32
  moveTime?: (amount: number) => void;
29
33
  zoom?: (factor: number) => void;
30
34
  };
@@ -15,6 +15,7 @@ const props = defineProps<{
15
15
  gap: var(--grid-gap);
16
16
  box-sizing: border-box;
17
17
  min-width: 0;
18
+ max-width: 100%;
18
19
 
19
20
  &.direction-row {
20
21
  flex-direction: row;
@@ -1,3 +1,8 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ type __VLS_Props = {
2
+ scrollMode?: 'window' | 'container';
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ scrollMode: "window" | "container";
6
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
7
  declare const _default: typeof __VLS_export;
3
8
  export default _default;
@@ -1,5 +1,5 @@
1
1
  <template lang="pug">
2
- .KLayout(:class="{ 'has-aside': Boolean($slots.aside) }")
2
+ .KLayout(:class="layoutClasses")
3
3
  header.KLayout__header(v-if="$slots.header")
4
4
  slot(name="header")
5
5
  aside.KLayout__aside(v-if="$slots.aside")
@@ -12,15 +12,27 @@
12
12
  </template>
13
13
 
14
14
  <script lang="ts" setup>
15
+ import { computed, useSlots } from 'vue'
16
+
17
+ const slots = useSlots()
15
18
  // Default preset component for KLayout
19
+ const props = withDefaults(defineProps<{
20
+ scrollMode?: 'window' | 'container'
21
+ }>(), {
22
+ scrollMode: 'container'
23
+ })
24
+
25
+ const layoutClasses = computed(() => [
26
+ { 'has-aside': Boolean(slots.aside) },
27
+ `is-scroll-${props.scrollMode || 'container'}`
28
+ ])
16
29
  </script>
17
30
 
18
31
  <style lang="scss" scoped>
19
32
  .KLayout {
20
33
  display: grid;
21
- height: 100vh;
22
- max-height: 100vh;
23
- overflow: hidden;
34
+ min-height: 100vh;
35
+ min-height: 100dvh;
24
36
  grid-template-rows: auto minmax(0, 1fr) auto;
25
37
  grid-template-columns: 1fr;
26
38
  grid-template-areas:
@@ -31,6 +43,27 @@
31
43
  color: var(--text-color, inherit);
32
44
  box-sizing: border-box;
33
45
 
46
+ &.is-scroll-container {
47
+ height: 100vh;
48
+ height: 100dvh;
49
+ max-height: 100dvh;
50
+ overflow: hidden;
51
+
52
+ .KLayout__main {
53
+ overflow-y: auto;
54
+ }
55
+ }
56
+
57
+ &.is-scroll-window {
58
+ min-height: 100vh;
59
+ min-height: 100dvh;
60
+ overflow: visible;
61
+
62
+ .KLayout__main {
63
+ overflow-y: visible;
64
+ }
65
+ }
66
+
34
67
  &.has-aside {
35
68
  grid-template-columns: var(--layout-sidebar-width, 240px) 1fr;
36
69
  grid-template-areas:
@@ -57,12 +90,27 @@
57
90
  &__main {
58
91
  grid-area: main;
59
92
  min-width: 0;
60
- overflow-y: auto;
61
93
  box-sizing: border-box;
62
94
  }
63
95
 
64
96
  &__footer {
65
97
  grid-area: footer;
66
98
  }
99
+
100
+ @media (max-width: 900px) {
101
+ &.has-aside {
102
+ grid-template-columns: 100%;
103
+ grid-template-rows: auto auto minmax(0, 1fr) auto;
104
+ grid-template-areas:
105
+ "header"
106
+ "aside"
107
+ "main"
108
+ "footer";
109
+ }
110
+
111
+ &__aside {
112
+ overflow-y: visible;
113
+ }
114
+ }
67
115
  }
68
116
  </style>
@@ -1,3 +1,8 @@
1
- declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ type __VLS_Props = {
2
+ scrollMode?: 'window' | 'container';
3
+ };
4
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
5
+ scrollMode: "window" | "container";
6
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
2
7
  declare const _default: typeof __VLS_export;
3
8
  export default _default;
@@ -1,16 +1,16 @@
1
1
  <template lang="pug">
2
2
  nav.k-pagination(v-if="totalPages > 1" :aria-label="t('Pagination Navigation')")
3
3
  ul
4
- li(v-if="showPrevButton")
4
+ li.nav-prev(v-if="showPrevButton")
5
5
  KButton(@click="goToPrev" :href="getPageHref(currentPage - 1)" size="small" variant="outline" :aria-label="t('Previous Page')") ‹
6
6
 
7
- li(v-if="showFirstEllipsis")
7
+ li.nav-first(v-if="showFirstEllipsis")
8
8
  KButton(@click="goToFirst" :href="getPageHref(1)" size="small" variant="outline" :aria-label="t('Go to Page 1')") 1
9
9
 
10
- li(v-if="showFirstEllipsis")
10
+ li.nav-ellipsis.first-ellipsis(v-if="showFirstEllipsis")
11
11
  span.ellipsis ...
12
12
 
13
- li(v-for="item in visiblePages" :key="item")
13
+ li.nav-page(v-for="item in visiblePages" :key="item" :class="{ 'is-active': item === currentPage }")
14
14
  KButton(
15
15
  @click="pageClicked(item)"
16
16
  :href="getPageHref(item)"
@@ -20,13 +20,13 @@ nav.k-pagination(v-if="totalPages > 1" :aria-label="t('Pagination Navigation')")
20
20
  :aria-label="t('Page') + ' ' + item"
21
21
  ) {{item}}
22
22
 
23
- li(v-if="showLastEllipsis")
23
+ li.nav-ellipsis.last-ellipsis(v-if="showLastEllipsis")
24
24
  span.ellipsis ...
25
25
 
26
- li(v-if="showLastEllipsis")
26
+ li.nav-last(v-if="showLastEllipsis")
27
27
  KButton(@click="goToLast" :href="getPageHref(totalPages)" size="small" variant="outline" :aria-label="t('Go to Page') + ' ' + totalPages") {{totalPages}}
28
28
 
29
- li(v-if="showNextButton")
29
+ li.nav-next(v-if="showNextButton")
30
30
  KButton(@click="goToNext" :href="getPageHref(currentPage + 1)" size="small" variant="outline" :aria-label="t('Next Page')") ›
31
31
  </template>
32
32
 
@@ -79,5 +79,27 @@ const props = defineProps<{
79
79
  }
80
80
  }
81
81
  }
82
+
83
+ @media (max-width: 640px) {
84
+ text-align: center;
85
+ ul {
86
+ justify-content: center;
87
+ gap: 4px;
88
+
89
+ li .ellipsis {
90
+ padding: 4px 6px;
91
+ }
92
+ }
93
+ }
94
+
95
+ @media (max-width: 480px) {
96
+ ul {
97
+ li.nav-first,
98
+ li.nav-last,
99
+ li.nav-ellipsis {
100
+ display: none;
101
+ }
102
+ }
103
+ }
82
104
  }
83
105
  </style>
@@ -42,6 +42,7 @@ const textareaAttrs = computed(() => {
42
42
  resize: vertical;
43
43
  outline: none;
44
44
  width: 100%;
45
+ min-width: var(--input-min-width, 140px);
45
46
  box-sizing: border-box;
46
47
 
47
48
  &::placeholder {
@@ -52,7 +52,7 @@ const inputAttrs = computed(() => {
52
52
  display: flex;
53
53
  flex-direction: column;
54
54
  flex: 1;
55
- min-width: 0;
55
+ min-width: var(--input-min-width, 140px);
56
56
  }
57
57
 
58
58
  .KTextbox {
@@ -5,7 +5,6 @@ Teleport(to="body" :disabled="!teleport")
5
5
  v-if="modelValue"
6
6
  :class="[`type-${type}`, { 'is-fixed': teleport }]"
7
7
  :role="type === 'error' || type === 'danger' ? 'alert' : 'status'"
8
- :aria-live="type === 'error' || type === 'danger' ? 'assertive' : 'polite'"
9
8
  @mouseenter="$emit('mouseenter', $event)"
10
9
  @mouseleave="$emit('mouseleave', $event)"
11
10
  )
@@ -7,7 +7,6 @@ Teleport(to="body" :disabled="!teleport")
7
7
  :class="[`pos-${pos}`]"
8
8
  role="region"
9
9
  aria-label="Notifications"
10
- aria-live="polite"
11
10
  @mouseenter="handleMouseEnter"
12
11
  @mouseleave="handleMouseLeave"
13
12
  )
@@ -9,6 +9,7 @@ type __VLS_Props = {
9
9
  multiSelect?: boolean;
10
10
  isNodeSelected?: (node: any) => boolean;
11
11
  toggleNode: (id: string | number) => void;
12
+ selectNode?: (node: any) => void;
12
13
  selectable?: boolean;
13
14
  dataProvider?: any;
14
15
  searchtext?: string;
@@ -20,13 +21,12 @@ type __VLS_Props = {
20
21
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
21
22
  select: (row: TTreeRow) => any;
22
23
  "node-toggle": (id: string | number) => any;
23
- "node-click": (row: TTreeRow) => any;
24
24
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
25
  onSelect?: ((row: TTreeRow) => any) | undefined;
26
26
  "onNode-toggle"?: ((id: string | number) => any) | undefined;
27
- "onNode-click"?: ((row: TTreeRow) => any) | undefined;
28
27
  }>, {
29
28
  disabled: boolean;
29
+ idKey: string;
30
30
  searchtext: string;
31
31
  virtualScroll: boolean;
32
32
  itemHeight: number;
@@ -35,7 +35,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
35
35
  multiSelect: boolean;
36
36
  viewportHeight: number;
37
37
  iconField: string;
38
- idKey: string;
39
38
  isNodeSelected: (node: any) => boolean;
40
39
  selectable: boolean;
41
40
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,5 +1,6 @@
1
1
  <template lang="pug">
2
2
  .KTree(
3
+ ref="treeRootRef"
3
4
  role="tree"
4
5
  :aria-label="t('Hierarchical Tree')"
5
6
  :class="{ 'is-virtual-scroll': props.virtualScroll }"
@@ -66,7 +67,7 @@
66
67
  //- Traditional standard tree list
67
68
  .tree-list(v-else)
68
69
  .tree-node(
69
- v-for="row in visibleRows"
70
+ v-for="(row, idx) in visibleRows"
70
71
  :key="row[idKey] || row.id"
71
72
  :class="{ 'has-children': row.__treeNode?.hasChildren }"
72
73
  :style="{ '--tree-depth': row.__treeNode?.depth || 0 }"
@@ -130,6 +131,7 @@ const props = withDefaults(
130
131
  multiSelect?: boolean
131
132
  isNodeSelected?: (node: any) => boolean
132
133
  toggleNode: (id: string | number) => void
134
+ selectNode?: (node: any) => void
133
135
  selectable?: boolean
134
136
  dataProvider?: any
135
137
  searchtext?: string
@@ -156,7 +158,6 @@ const props = withDefaults(
156
158
 
157
159
  const emit = defineEmits<{
158
160
  (e: 'select', row: TTreeRow): void
159
- (e: 'node-click', row: TTreeRow): void
160
161
  (e: 'node-toggle', id: string | number): void
161
162
  }>()
162
163
 
@@ -168,7 +169,6 @@ function toggleNode(id: string | number) {
168
169
  function onNodeClick(row: TTreeRow) {
169
170
  if (!props.disabled) {
170
171
  emit('select', row)
171
- emit('node-click', row)
172
172
  }
173
173
  }
174
174
 
@@ -244,13 +244,15 @@ const onNodeFocus = (row: TTreeRow, idx: number) => {
244
244
  focusedNodeId.value = getNodeKey(row, idx)
245
245
  }
246
246
 
247
+ const treeRootRef = ref<HTMLElement | null>(null)
248
+
247
249
  const focusNextNode = (currentIdx: number) => {
248
250
  const rows = props.virtualScroll ? displayRows.value : (props.visibleRows || [])
249
251
  if (currentIdx < rows.length - 1) {
250
252
  const nextRow = rows[currentIdx + 1]
251
253
  focusedNodeId.value = getNodeKey(nextRow, currentIdx + 1)
252
254
  nextTick(() => {
253
- const activeEl = document.querySelector<HTMLElement>(`.KTree .tree-node[tabindex="0"]`)
255
+ const activeEl = (treeRootRef.value || containerRef.value)?.querySelector<HTMLElement>(`.tree-node[tabindex="0"]`)
254
256
  activeEl?.focus()
255
257
  })
256
258
  }
@@ -263,7 +265,7 @@ const focusPrevNode = (currentIdx: number) => {
263
265
  const prevRow = rows[currentIdx - 1]
264
266
  focusedNodeId.value = getNodeKey(prevRow, currentIdx - 1)
265
267
  nextTick(() => {
266
- const activeEl = document.querySelector<HTMLElement>(`.KTree .tree-node[tabindex="0"]`)
268
+ const activeEl = (treeRootRef.value || containerRef.value)?.querySelector<HTMLElement>(`.tree-node[tabindex="0"]`)
267
269
  activeEl?.focus()
268
270
  })
269
271
  }
@@ -9,6 +9,7 @@ type __VLS_Props = {
9
9
  multiSelect?: boolean;
10
10
  isNodeSelected?: (node: any) => boolean;
11
11
  toggleNode: (id: string | number) => void;
12
+ selectNode?: (node: any) => void;
12
13
  selectable?: boolean;
13
14
  dataProvider?: any;
14
15
  searchtext?: string;
@@ -20,13 +21,12 @@ type __VLS_Props = {
20
21
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
21
22
  select: (row: TTreeRow) => any;
22
23
  "node-toggle": (id: string | number) => any;
23
- "node-click": (row: TTreeRow) => any;
24
24
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
25
  onSelect?: ((row: TTreeRow) => any) | undefined;
26
26
  "onNode-toggle"?: ((id: string | number) => any) | undefined;
27
- "onNode-click"?: ((row: TTreeRow) => any) | undefined;
28
27
  }>, {
29
28
  disabled: boolean;
29
+ idKey: string;
30
30
  searchtext: string;
31
31
  virtualScroll: boolean;
32
32
  itemHeight: number;
@@ -35,7 +35,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
35
35
  multiSelect: boolean;
36
36
  viewportHeight: number;
37
37
  iconField: string;
38
- idKey: string;
39
38
  isNodeSelected: (node: any) => boolean;
40
39
  selectable: boolean;
41
40
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@katlux/toolkit",
3
- "version": "0.1.1-alpha.119",
3
+ "version": "0.1.1-alpha.121",
4
4
  "description": "Core UI toolkit and utilities for the Katlux ecosystem",
5
5
  "author": "Katlux",
6
6
  "license": "Apache-2.0",
@@ -41,7 +41,7 @@
41
41
  "./dist/runtime/presets/*": "./dist/runtime/presets/*"
42
42
  },
43
43
  "dependencies": {
44
- "@katlux/providers": "^0.1.1-alpha.105",
44
+ "@katlux/providers": "^0.1.1-alpha.109",
45
45
  "@nuxt/kit": "^3.12.0",
46
46
  "@nuxtjs/i18n": "^10.4.0",
47
47
  "pug": "^3.0.0",