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

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 (118) hide show
  1. package/bin/create-preset.mjs +373 -21
  2. package/dist/compiled/composables/useKatluxContext.mjs +6 -3
  3. package/dist/compiled/composables/useKatluxForm.mjs +268 -0
  4. package/dist/compiled/composables/useToast.mjs +164 -0
  5. package/dist/compiled/composables/useVirtualScroll.mjs +176 -0
  6. package/dist/module.cjs +1 -0
  7. package/dist/module.json +1 -1
  8. package/dist/module.mjs +1 -0
  9. package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +6 -2
  10. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +3 -3
  11. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +6 -2
  12. package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +9 -0
  13. package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +9 -0
  14. package/dist/runtime/components/KCombobox/KCombobox.global.vue +2 -1
  15. package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +9 -0
  16. package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +5 -0
  17. package/dist/runtime/components/KCombobox/KCombobox.logic.js +22 -3
  18. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +8 -0
  19. package/dist/runtime/components/KDatatable/KDataIterator.global.vue +10 -2
  20. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +8 -0
  21. package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +8 -0
  22. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +10 -2
  23. package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +8 -0
  24. package/dist/runtime/components/KDatatable/KDatatable.global.vue +12 -4
  25. package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +8 -0
  26. package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +8 -0
  27. package/dist/runtime/components/KDatatable/KDatatable.logic.js +11 -3
  28. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +2 -0
  29. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +5 -1
  30. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +2 -0
  31. package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +7 -6
  32. package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +7 -6
  33. package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +9 -0
  34. package/dist/runtime/components/KDropdown/KDropdown.global.vue +2 -1
  35. package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +9 -0
  36. package/dist/runtime/components/KDropdown/KDropdown.logic.d.ts +5 -0
  37. package/dist/runtime/components/KDropdown/KDropdown.logic.js +10 -7
  38. package/dist/runtime/components/KGantt/KGantt.logic.js +11 -4
  39. package/dist/runtime/components/KPagination/KPagination.logic.js +7 -4
  40. package/dist/runtime/components/KToast/KToast.global.d.vue.ts +24 -1
  41. package/dist/runtime/components/KToast/KToast.global.vue +12 -2
  42. package/dist/runtime/components/KToast/KToast.global.vue.d.ts +24 -1
  43. package/dist/runtime/components/KToast/KToast.logic.d.ts +13 -0
  44. package/dist/runtime/components/KToast/KToast.logic.js +45 -5
  45. package/dist/runtime/components/KToastContainer/KToastContainer.global.d.vue.ts +3 -0
  46. package/dist/runtime/components/KToastContainer/KToastContainer.global.vue +11 -0
  47. package/dist/runtime/components/KToastContainer/KToastContainer.global.vue.d.ts +3 -0
  48. package/dist/runtime/components/KTree/KTree.global.d.vue.ts +38 -0
  49. package/dist/runtime/components/KTree/KTree.global.vue +7 -3
  50. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +38 -0
  51. package/dist/runtime/components/KTree/KTree.logic.d.ts +21 -0
  52. package/dist/runtime/components/KTree/KTree.logic.js +17 -0
  53. package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +52 -1
  54. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +30 -3
  55. package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +52 -1
  56. package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +20 -0
  57. package/dist/runtime/components/KTreePicker/KTreePicker.logic.js +16 -0
  58. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +36 -0
  59. package/dist/runtime/components/KTreeView/KTreeView.global.vue +5 -1
  60. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +36 -0
  61. package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +20 -0
  62. package/dist/runtime/components/KTreeView/KTreeView.logic.js +16 -0
  63. package/dist/runtime/composables/useKatluxContext.js +6 -3
  64. package/dist/runtime/composables/useKatluxForm.d.ts +143 -0
  65. package/dist/runtime/composables/useKatluxForm.js +268 -0
  66. package/dist/runtime/composables/useToast.d.ts +49 -0
  67. package/dist/runtime/composables/useToast.js +164 -0
  68. package/dist/runtime/composables/useVirtualScroll.d.ts +34 -0
  69. package/dist/runtime/composables/useVirtualScroll.js +176 -0
  70. package/dist/runtime/plugins/PresetPlugin.js +9 -1
  71. package/dist/runtime/plugins/nuxtCompatPlugin.js +0 -1
  72. package/dist/runtime/plugins/toastPlugin.client.d.ts +2 -0
  73. package/dist/runtime/plugins/toastPlugin.client.js +16 -0
  74. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +1 -0
  75. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +36 -7
  76. package/dist/runtime/presets/default/components/KCombobox/KCombobox.d.vue.ts +1 -0
  77. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue +10 -4
  78. package/dist/runtime/presets/default/components/KCombobox/KCombobox.vue.d.ts +1 -0
  79. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.d.vue.ts +1 -0
  80. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue +7 -2
  81. package/dist/runtime/presets/default/components/KCombobox/KComboboxList.vue.d.ts +1 -0
  82. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +10 -1
  83. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +128 -6
  84. package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +10 -1
  85. package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +12 -1
  86. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +206 -27
  87. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +12 -1
  88. package/dist/runtime/presets/default/components/KDropdown/KDropdown.d.vue.ts +1 -0
  89. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +23 -2
  90. package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue.d.ts +1 -0
  91. package/dist/runtime/presets/default/components/KLayout/KLayout.vue +4 -2
  92. package/dist/runtime/presets/default/components/KModal/KModal.vue +8 -1
  93. package/dist/runtime/presets/default/components/KTabs/KTabItem.vue +1 -1
  94. package/dist/runtime/presets/default/components/KTextbox/KTextbox.vue +6 -4
  95. package/dist/runtime/presets/default/components/KToast/KToast.d.vue.ts +6 -0
  96. package/dist/runtime/presets/default/components/KToast/KToast.vue +22 -4
  97. package/dist/runtime/presets/default/components/KToast/KToast.vue.d.ts +6 -0
  98. package/dist/runtime/presets/default/components/KToastContainer/KToastContainer.d.vue.ts +11 -0
  99. package/dist/runtime/presets/default/components/KToastContainer/KToastContainer.vue +207 -0
  100. package/dist/runtime/presets/default/components/KToastContainer/KToastContainer.vue.d.ts +11 -0
  101. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +15 -5
  102. package/dist/runtime/presets/default/components/KTree/KTree.vue +232 -13
  103. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +15 -5
  104. package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.d.vue.ts +14 -1
  105. package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue +118 -13
  106. package/dist/runtime/presets/default/components/KTreePicker/KTreePicker.vue.d.ts +14 -1
  107. package/dist/runtime/presets/default/components/KTreeView/KTreeCell.vue +12 -3
  108. package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +4 -0
  109. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +8 -0
  110. package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +4 -0
  111. package/dist/runtime/server/middleware/session.js +1 -1
  112. package/package.json +3 -4
  113. package/dist/compiled/composables/useDataProvider.spec.mjs +0 -157
  114. package/dist/compiled/composables/useKatluxContext.spec.mjs +0 -63
  115. package/dist/compiled/composables/useKatluxI18n.spec.mjs +0 -10
  116. package/dist/compiled/composables/usePresetComponent.spec.mjs +0 -106
  117. package/dist/compiled/composables/useTemplate.spec.mjs +0 -30
  118. package/dist/compiled/utils/PresetResolver.spec.mjs +0 -68
@@ -8,6 +8,7 @@ export interface KDropdownProps {
8
8
  teleportTo?: string;
9
9
  align?: KDropdownAlign;
10
10
  direction?: KDropdownDirection;
11
+ maxHeight?: number;
11
12
  }
12
13
  export interface KDropdownEmits {
13
14
  (e: 'update:isOpen', value: boolean): void;
@@ -37,6 +38,10 @@ export declare const KDropdownDefaultProps: {
37
38
  type: PropType<KDropdownDirection>;
38
39
  default: string;
39
40
  };
41
+ maxHeight: {
42
+ type: NumberConstructor;
43
+ default: undefined;
44
+ };
40
45
  };
41
46
  export declare function useKDropdownLogic(props: KDropdownProps, emit: KDropdownEmits): {
42
47
  open: Ref<boolean, boolean>;
@@ -24,6 +24,10 @@ export const KDropdownDefaultProps = {
24
24
  direction: {
25
25
  type: String,
26
26
  default: "auto"
27
+ },
28
+ maxHeight: {
29
+ type: Number,
30
+ default: void 0
27
31
  }
28
32
  };
29
33
  export function useKDropdownLogic(props, emit) {
@@ -101,12 +105,8 @@ export function useKDropdownLogic(props, emit) {
101
105
  const rect = el.getBoundingClientRect();
102
106
  const viewportWidth = document.documentElement.clientWidth;
103
107
  const viewportHeight = document.documentElement.clientHeight;
104
- const resolvedDir = resolveDirection(
105
- rect,
106
- viewportWidth,
107
- viewportHeight,
108
- props.direction ?? "auto"
109
- );
108
+ const existingDir = open.value ? dropdownRect.value.resolvedDirection : void 0;
109
+ const resolvedDir = props.direction && props.direction !== "auto" ? resolveDirection(rect, viewportWidth, viewportHeight, props.direction) : existingDir || resolveDirection(rect, viewportWidth, viewportHeight, "auto");
110
110
  const resolvedAl = resolveAlign(
111
111
  rect,
112
112
  viewportWidth,
@@ -117,7 +117,8 @@ export function useKDropdownLogic(props, emit) {
117
117
  const spaceBelow = viewportHeight - rect.bottom;
118
118
  const spaceAbove = rect.top;
119
119
  const rawSpace = resolvedDir === "top" ? spaceAbove : spaceBelow;
120
- const maxHeight = Math.min(300, rawSpace - 8);
120
+ const requestedMax = props.maxHeight ?? 400;
121
+ const maxHeight = Math.max(100, Math.min(requestedMax, rawSpace - 8));
121
122
  dropdownRect.value = {
122
123
  top: rect.bottom,
123
124
  left: rect.left,
@@ -164,9 +165,11 @@ export function useKDropdownLogic(props, emit) {
164
165
  );
165
166
  onMounted(() => {
166
167
  window.addEventListener("scroll", repositionOnScroll, true);
168
+ window.addEventListener("resize", repositionOnScroll);
167
169
  });
168
170
  onUnmounted(() => {
169
171
  window.removeEventListener("scroll", repositionOnScroll, true);
172
+ window.removeEventListener("resize", repositionOnScroll);
170
173
  });
171
174
  return {
172
175
  open,
@@ -1,4 +1,5 @@
1
- import { computed } from "vue";
1
+ import { computed, isRef, ref } from "vue";
2
+ import { useDataProvider } from "../../composables/useDataProvider.js";
2
3
  export const KGanttDefaultProps = {
3
4
  dataProvider: {
4
5
  type: Object,
@@ -80,7 +81,12 @@ export const KGanttDefaultProps = {
80
81
  }
81
82
  };
82
83
  export function useKGanttLogic(props) {
83
- const baseNow = Date.now();
84
+ let baseNow = Date.now();
85
+ try {
86
+ const nuxtState = globalThis.useState?.("gantt-base-now", () => Date.now());
87
+ if (nuxtState?.value) baseNow = nuxtState.value;
88
+ } catch {
89
+ }
84
90
  const globalDateRange = computed(() => {
85
91
  const now = baseNow;
86
92
  const msInDay = 24 * 60 * 60 * 1e3;
@@ -172,8 +178,9 @@ export function useKGanttLogic(props) {
172
178
  };
173
179
  }
174
180
  };
175
- const selectedRows = props.dataProvider.selectedRows;
176
- const selectAll = props.dataProvider.selectAll;
181
+ const dpBridge = props.dataProvider ? useDataProvider(props.dataProvider) : null;
182
+ const selectedRows = isRef(props.dataProvider?.selectedRows) ? props.dataProvider.selectedRows : dpBridge?.selectedRows ?? ref([]);
183
+ const selectAll = isRef(props.dataProvider?.selectAll) ? props.dataProvider.selectAll : dpBridge?.selectAll ?? ref(false);
177
184
  return {
178
185
  globalDateRange,
179
186
  totalDuration,
@@ -11,7 +11,8 @@ export function useKPaginationLogic(props, emit) {
11
11
  const localCurrentPage = ref(props.modelValue ?? props.currentPage ?? 1);
12
12
  const localPageSize = ref(props.pageSize ?? 10);
13
13
  watch(() => props.modelValue, (val) => {
14
- if (val !== void 0 && val !== localCurrentPage.value) {
14
+ const currentDpPage = dp?.currentPage?.value ?? dp?.currentPage;
15
+ if (val !== void 0 && val !== localCurrentPage.value && val !== currentDpPage) {
15
16
  localCurrentPage.value = val;
16
17
  if (dp && typeof dp.setCurrentPage === "function") {
17
18
  dp.setCurrentPage(val);
@@ -19,7 +20,8 @@ export function useKPaginationLogic(props, emit) {
19
20
  }
20
21
  });
21
22
  watch(() => props.currentPage, (val) => {
22
- if (val !== void 0 && val !== localCurrentPage.value) {
23
+ const currentDpPage = dp?.currentPage?.value ?? dp?.currentPage;
24
+ if (val !== void 0 && val !== localCurrentPage.value && val !== currentDpPage) {
23
25
  localCurrentPage.value = val;
24
26
  if (dp && typeof dp.setCurrentPage === "function") {
25
27
  dp.setCurrentPage(val);
@@ -27,7 +29,8 @@ export function useKPaginationLogic(props, emit) {
27
29
  }
28
30
  });
29
31
  watch(() => props.pageSize, (val) => {
30
- if (val !== void 0 && val !== localPageSize.value) {
32
+ const currentDpSize = dp?.pageSize?.value ?? dp?.pageSize;
33
+ if (val !== void 0 && val !== localPageSize.value && val !== currentDpSize) {
31
34
  localPageSize.value = val;
32
35
  if (dp && typeof dp.setPageSize === "function") {
33
36
  dp.setPageSize(val);
@@ -89,7 +92,7 @@ export function useKPaginationLogic(props, emit) {
89
92
  () => (visiblePages.value[visiblePages.value.length - 1] || 0) < totalPages.value - 1
90
93
  );
91
94
  const pageClicked = (item) => {
92
- if (item < 1 || item > totalPages.value) return;
95
+ if (item < 1 || item > totalPages.value || item === currentPage.value) return;
93
96
  localCurrentPage.value = item;
94
97
  if (typeof dp?.setCurrentPage === "function") {
95
98
  dp.setCurrentPage(item);
@@ -7,6 +7,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
7
7
  type: StringConstructor;
8
8
  default: string;
9
9
  };
10
+ title: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ };
10
14
  timeout: {
11
15
  type: NumberConstructor;
12
16
  default: number;
@@ -19,7 +23,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
19
23
  type: import("vue").PropType<import("./KToast.logic.js").KToastType>;
20
24
  default: string;
21
25
  };
22
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
+ pauseOnHover: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ }>, {
31
+ startTimeout: () => void;
32
+ stopTimeout: () => void;
33
+ pause: () => void;
34
+ resume: () => void;
35
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
36
  "update:modelValue": (...args: any[]) => void;
24
37
  close: (...args: any[]) => void;
25
38
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -31,6 +44,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
31
44
  type: StringConstructor;
32
45
  default: string;
33
46
  };
47
+ title: {
48
+ type: StringConstructor;
49
+ default: string;
50
+ };
34
51
  timeout: {
35
52
  type: NumberConstructor;
36
53
  default: number;
@@ -43,15 +60,21 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
43
60
  type: import("vue").PropType<import("./KToast.logic.js").KToastType>;
44
61
  default: string;
45
62
  };
63
+ pauseOnHover: {
64
+ type: BooleanConstructor;
65
+ default: boolean;
66
+ };
46
67
  }>> & Readonly<{
47
68
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
48
69
  onClose?: ((...args: any[]) => any) | undefined;
49
70
  }>, {
50
71
  modelValue: boolean;
51
72
  type: import("./KToast.logic.js").KToastType;
73
+ title: string;
52
74
  text: string;
53
75
  timeout: number;
54
76
  teleport: boolean;
77
+ pauseOnHover: boolean;
55
78
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
56
79
  declare const _default: typeof __VLS_export;
57
80
  export default _default;
@@ -5,19 +5,27 @@ import { computed } from "vue";
5
5
  import KToastDefault from "../../presets/default/components/KToast/KToast.vue";
6
6
  const props = defineProps(KToastDefaultProps);
7
7
  const emit = defineEmits(["update:modelValue", "close"]);
8
- const { startTimeout } = useKToastLogic(props, emit);
8
+ const { startTimeout, stopTimeout, pause, resume } = useKToastLogic(props, emit);
9
9
  const presetComponent = usePresetComponent("KToast", KToastDefault);
10
10
  const templateProps = computed(() => ({
11
11
  modelValue: props.modelValue,
12
12
  text: props.text,
13
+ title: props.title,
13
14
  timeout: props.timeout,
14
15
  teleport: props.teleport,
15
- type: props.type
16
+ type: props.type,
17
+ pauseOnHover: props.pauseOnHover
16
18
  }));
17
19
  const onClose = () => {
18
20
  emit("update:modelValue", false);
19
21
  emit("close");
20
22
  };
23
+ defineExpose({
24
+ startTimeout,
25
+ stopTimeout,
26
+ pause,
27
+ resume
28
+ });
21
29
  </script>
22
30
 
23
31
  <template lang="pug">
@@ -26,6 +34,8 @@ component(
26
34
  v-bind="templateProps"
27
35
  @update:modelValue="$emit('update:modelValue', $event)"
28
36
  @close="onClose"
37
+ @mouseenter="pause"
38
+ @mouseleave="resume"
29
39
  )
30
40
  template(v-for="(_, slot) in $slots" #[slot]="scope")
31
41
  slot(:name="slot" v-bind="scope")
@@ -7,6 +7,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
7
7
  type: StringConstructor;
8
8
  default: string;
9
9
  };
10
+ title: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ };
10
14
  timeout: {
11
15
  type: NumberConstructor;
12
16
  default: number;
@@ -19,7 +23,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
19
23
  type: import("vue").PropType<import("./KToast.logic.js").KToastType>;
20
24
  default: string;
21
25
  };
22
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
+ pauseOnHover: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ }>, {
31
+ startTimeout: () => void;
32
+ stopTimeout: () => void;
33
+ pause: () => void;
34
+ resume: () => void;
35
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
23
36
  "update:modelValue": (...args: any[]) => void;
24
37
  close: (...args: any[]) => void;
25
38
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -31,6 +44,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
31
44
  type: StringConstructor;
32
45
  default: string;
33
46
  };
47
+ title: {
48
+ type: StringConstructor;
49
+ default: string;
50
+ };
34
51
  timeout: {
35
52
  type: NumberConstructor;
36
53
  default: number;
@@ -43,15 +60,21 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
43
60
  type: import("vue").PropType<import("./KToast.logic.js").KToastType>;
44
61
  default: string;
45
62
  };
63
+ pauseOnHover: {
64
+ type: BooleanConstructor;
65
+ default: boolean;
66
+ };
46
67
  }>> & Readonly<{
47
68
  "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
48
69
  onClose?: ((...args: any[]) => any) | undefined;
49
70
  }>, {
50
71
  modelValue: boolean;
51
72
  type: import("./KToast.logic.js").KToastType;
73
+ title: string;
52
74
  text: string;
53
75
  timeout: number;
54
76
  teleport: boolean;
77
+ pauseOnHover: boolean;
55
78
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
56
79
  declare const _default: typeof __VLS_export;
57
80
  export default _default;
@@ -1,11 +1,14 @@
1
1
  import { type PropType } from 'vue';
2
2
  export type KToastType = 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'error' | 'default';
3
+ export type KToastPosition = 'top-right' | 'top-left' | 'top-center' | 'bottom-right' | 'bottom-left' | 'bottom-center';
3
4
  export interface KToastProps {
4
5
  modelValue: boolean;
5
6
  text?: string;
7
+ title?: string;
6
8
  timeout?: number;
7
9
  teleport?: boolean;
8
10
  type?: KToastType;
11
+ pauseOnHover?: boolean;
9
12
  }
10
13
  export declare const KToastDefaultProps: {
11
14
  modelValue: {
@@ -16,6 +19,10 @@ export declare const KToastDefaultProps: {
16
19
  type: StringConstructor;
17
20
  default: string;
18
21
  };
22
+ title: {
23
+ type: StringConstructor;
24
+ default: string;
25
+ };
19
26
  timeout: {
20
27
  type: NumberConstructor;
21
28
  default: number;
@@ -28,8 +35,14 @@ export declare const KToastDefaultProps: {
28
35
  type: PropType<KToastType>;
29
36
  default: string;
30
37
  };
38
+ pauseOnHover: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
31
42
  };
32
43
  export declare function useKToastLogic(props: KToastProps, emit: any): {
33
44
  startTimeout: () => void;
34
45
  stopTimeout: () => void;
46
+ pause: () => void;
47
+ resume: () => void;
35
48
  };
@@ -8,6 +8,10 @@ export const KToastDefaultProps = {
8
8
  type: String,
9
9
  default: ""
10
10
  },
11
+ title: {
12
+ type: String,
13
+ default: ""
14
+ },
11
15
  timeout: {
12
16
  type: Number,
13
17
  default: 3e3
@@ -19,23 +23,54 @@ export const KToastDefaultProps = {
19
23
  type: {
20
24
  type: String,
21
25
  default: "info"
26
+ },
27
+ pauseOnHover: {
28
+ type: Boolean,
29
+ default: true
22
30
  }
23
31
  };
24
32
  export function useKToastLogic(props, emit) {
25
33
  let timeoutId = null;
34
+ let startTime = 0;
35
+ let remaining = props.timeout ?? 3e3;
36
+ let isPaused = false;
26
37
  const stopTimeout = () => {
27
38
  if (timeoutId) {
28
39
  clearTimeout(timeoutId);
29
40
  timeoutId = null;
30
41
  }
42
+ isPaused = false;
31
43
  };
32
44
  const startTimeout = () => {
33
45
  stopTimeout();
34
- if (props.timeout && props.timeout > 0 && props.modelValue) {
46
+ remaining = props.timeout ?? 3e3;
47
+ if (remaining > 0 && props.modelValue) {
48
+ startTime = Date.now();
35
49
  timeoutId = setTimeout(() => {
36
50
  timeoutId = null;
37
51
  emit("update:modelValue", false);
38
- }, props.timeout);
52
+ emit("close");
53
+ }, remaining);
54
+ }
55
+ };
56
+ const pause = () => {
57
+ if (!props.pauseOnHover || isPaused || !timeoutId) return;
58
+ clearTimeout(timeoutId);
59
+ timeoutId = null;
60
+ const elapsed = Date.now() - startTime;
61
+ remaining = Math.max(0, remaining - elapsed);
62
+ isPaused = true;
63
+ };
64
+ const resume = () => {
65
+ if (!props.pauseOnHover || !isPaused || !props.modelValue) return;
66
+ isPaused = false;
67
+ if (remaining > 0) {
68
+ startTime = Date.now();
69
+ timeoutId = setTimeout(() => {
70
+ timeoutId = null;
71
+ emit("update:modelValue", false);
72
+ emit("close");
73
+ }, remaining);
39
74
  }
40
75
  };
41
76
  watch(() => props.modelValue, (val) => {
@@ -45,8 +80,11 @@ export function useKToastLogic(props, emit) {
45
80
  stopTimeout();
46
81
  }
47
82
  }, { immediate: true });
48
- watch(() => props.timeout, () => {
49
- if (props.modelValue) startTimeout();
83
+ watch(() => props.timeout, (val) => {
84
+ if (props.modelValue) {
85
+ remaining = val ?? 3e3;
86
+ startTimeout();
87
+ }
50
88
  });
51
89
  try {
52
90
  onScopeDispose(() => {
@@ -56,6 +94,8 @@ export function useKToastLogic(props, emit) {
56
94
  }
57
95
  return {
58
96
  startTimeout,
59
- stopTimeout
97
+ stopTimeout,
98
+ pause,
99
+ resume
60
100
  };
61
101
  }
@@ -0,0 +1,3 @@
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>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -0,0 +1,11 @@
1
+ <script setup>
2
+ import { usePresetComponent } from "../../composables/usePresetComponent";
3
+ import KToastContainerDefault from "../../presets/default/components/KToastContainer/KToastContainer.vue";
4
+ const presetComponent = usePresetComponent("KToastContainer", KToastContainerDefault);
5
+ </script>
6
+
7
+ <template lang="pug">
8
+ component(:is="presetComponent" v-bind="$attrs")
9
+ template(v-for="(_, slot) in $slots" #[slot]="scope")
10
+ slot(:name="slot" v-bind="scope")
11
+ </template>
@@ -0,0 +1,3 @@
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>;
2
+ declare const _default: typeof __VLS_export;
3
+ export default _default;
@@ -47,6 +47,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
47
47
  type: import("vue").PropType<Set<string | number> | (string | number)[]>;
48
48
  default: undefined;
49
49
  };
50
+ virtualScroll: {
51
+ type: BooleanConstructor;
52
+ default: boolean;
53
+ };
54
+ itemHeight: {
55
+ type: NumberConstructor;
56
+ default: number;
57
+ };
58
+ viewportHeight: {
59
+ type: NumberConstructor;
60
+ default: number;
61
+ };
62
+ buffer: {
63
+ type: NumberConstructor;
64
+ default: number;
65
+ };
50
66
  }>, {
51
67
  visibleRows: import("vue").ComputedRef<import("@katlux/providers").TTreeRow[]>;
52
68
  expandedNodes: import("vue").Ref<Set<string | number> & Omit<Set<string | number>, keyof Set<any>>, Set<string | number> | (Set<string | number> & Omit<Set<string | number>, keyof Set<any>>)>;
@@ -54,6 +70,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
54
70
  selectNode: (node: any) => void;
55
71
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
56
72
  "update:modelValue": (val: any) => any;
73
+ select: (node: any) => any;
57
74
  "update:searchtext": (val: string) => any;
58
75
  "update:expandedNodes": (val: (string | number)[] | Set<string | number>) => any;
59
76
  "node-toggle": (nodeId: string | number) => any;
@@ -108,8 +125,25 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
108
125
  type: import("vue").PropType<Set<string | number> | (string | number)[]>;
109
126
  default: undefined;
110
127
  };
128
+ virtualScroll: {
129
+ type: BooleanConstructor;
130
+ default: boolean;
131
+ };
132
+ itemHeight: {
133
+ type: NumberConstructor;
134
+ default: number;
135
+ };
136
+ viewportHeight: {
137
+ type: NumberConstructor;
138
+ default: number;
139
+ };
140
+ buffer: {
141
+ type: NumberConstructor;
142
+ default: number;
143
+ };
111
144
  }>> & Readonly<{
112
145
  "onUpdate:modelValue"?: ((val: any) => any) | undefined;
146
+ onSelect?: ((node: any) => any) | undefined;
113
147
  "onUpdate:searchtext"?: ((val: string) => any) | undefined;
114
148
  "onUpdate:expandedNodes"?: ((val: (string | number)[] | Set<string | number>) => any) | undefined;
115
149
  "onNode-toggle"?: ((nodeId: string | number) => any) | undefined;
@@ -119,8 +153,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
119
153
  modelValue: any;
120
154
  disabled: boolean;
121
155
  searchtext: string;
156
+ virtualScroll: boolean;
157
+ itemHeight: number;
158
+ buffer: number;
122
159
  labelField: string;
123
160
  multiSelect: boolean;
161
+ viewportHeight: number;
124
162
  expandedNodes: (string | number)[] | Set<string | number>;
125
163
  iconField: string;
126
164
  idKey: string;
@@ -4,7 +4,7 @@ import { useKTreeLogic, KTreeDefaultProps } from "./KTree.logic";
4
4
  import { usePresetComponent } from "../../composables/usePresetComponent";
5
5
  import KTreeDefault from "../../presets/default/components/KTree/KTree.vue";
6
6
  const props = defineProps(KTreeDefaultProps);
7
- const emit = defineEmits(["update:searchtext", "update:modelValue", "update:selectedNode", "update:expandedNodes", "node-click", "node-toggle"]);
7
+ const emit = defineEmits(["update:searchtext", "update:modelValue", "update:selectedNode", "update:expandedNodes", "select", "node-click", "node-toggle"]);
8
8
  const {
9
9
  visibleRows,
10
10
  expandedNodes,
@@ -25,7 +25,11 @@ const templateProps = computed(() => ({
25
25
  searchtext: props.searchtext,
26
26
  toggleNode,
27
27
  selectNode,
28
- dataProvider: props.dataProvider
28
+ dataProvider: props.dataProvider,
29
+ virtualScroll: props.virtualScroll,
30
+ itemHeight: props.itemHeight,
31
+ viewportHeight: props.viewportHeight,
32
+ buffer: props.buffer
29
33
  }));
30
34
  defineExpose({
31
35
  visibleRows,
@@ -39,8 +43,8 @@ defineExpose({
39
43
  component(
40
44
  :is="presetComponent"
41
45
  v-bind="templateProps"
46
+ @select="selectNode"
42
47
  @node-click="selectNode"
43
- @node-toggle="toggleNode"
44
48
  )
45
49
  // Passes slots from parent to template (for custom node content)
46
50
  template(v-for="(_, slot) in $slots" v-slot:[slot]="scope")
@@ -47,6 +47,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
47
47
  type: import("vue").PropType<Set<string | number> | (string | number)[]>;
48
48
  default: undefined;
49
49
  };
50
+ virtualScroll: {
51
+ type: BooleanConstructor;
52
+ default: boolean;
53
+ };
54
+ itemHeight: {
55
+ type: NumberConstructor;
56
+ default: number;
57
+ };
58
+ viewportHeight: {
59
+ type: NumberConstructor;
60
+ default: number;
61
+ };
62
+ buffer: {
63
+ type: NumberConstructor;
64
+ default: number;
65
+ };
50
66
  }>, {
51
67
  visibleRows: import("vue").ComputedRef<import("@katlux/providers").TTreeRow[]>;
52
68
  expandedNodes: import("vue").Ref<Set<string | number> & Omit<Set<string | number>, keyof Set<any>>, Set<string | number> | (Set<string | number> & Omit<Set<string | number>, keyof Set<any>>)>;
@@ -54,6 +70,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
54
70
  selectNode: (node: any) => void;
55
71
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
56
72
  "update:modelValue": (val: any) => any;
73
+ select: (node: any) => any;
57
74
  "update:searchtext": (val: string) => any;
58
75
  "update:expandedNodes": (val: (string | number)[] | Set<string | number>) => any;
59
76
  "node-toggle": (nodeId: string | number) => any;
@@ -108,8 +125,25 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
108
125
  type: import("vue").PropType<Set<string | number> | (string | number)[]>;
109
126
  default: undefined;
110
127
  };
128
+ virtualScroll: {
129
+ type: BooleanConstructor;
130
+ default: boolean;
131
+ };
132
+ itemHeight: {
133
+ type: NumberConstructor;
134
+ default: number;
135
+ };
136
+ viewportHeight: {
137
+ type: NumberConstructor;
138
+ default: number;
139
+ };
140
+ buffer: {
141
+ type: NumberConstructor;
142
+ default: number;
143
+ };
111
144
  }>> & Readonly<{
112
145
  "onUpdate:modelValue"?: ((val: any) => any) | undefined;
146
+ onSelect?: ((node: any) => any) | undefined;
113
147
  "onUpdate:searchtext"?: ((val: string) => any) | undefined;
114
148
  "onUpdate:expandedNodes"?: ((val: (string | number)[] | Set<string | number>) => any) | undefined;
115
149
  "onNode-toggle"?: ((nodeId: string | number) => any) | undefined;
@@ -119,8 +153,12 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
119
153
  modelValue: any;
120
154
  disabled: boolean;
121
155
  searchtext: string;
156
+ virtualScroll: boolean;
157
+ itemHeight: number;
158
+ buffer: number;
122
159
  labelField: string;
123
160
  multiSelect: boolean;
161
+ viewportHeight: number;
124
162
  expandedNodes: (string | number)[] | Set<string | number>;
125
163
  iconField: string;
126
164
  idKey: string;
@@ -13,12 +13,17 @@ export interface KTreeProps {
13
13
  modelValue?: any;
14
14
  selectedNode?: any;
15
15
  expandedNodes?: Set<string | number> | (string | number)[];
16
+ virtualScroll?: boolean;
17
+ itemHeight?: number;
18
+ viewportHeight?: number;
19
+ buffer?: number;
16
20
  }
17
21
  export type KTreeEmits = {
18
22
  (e: 'update:searchtext', val: string): void;
19
23
  (e: 'update:modelValue', val: any): void;
20
24
  (e: 'update:selectedNode', val: any): void;
21
25
  (e: 'update:expandedNodes', val: Set<string | number> | (string | number)[]): void;
26
+ (e: 'select', node: any): void;
22
27
  (e: 'node-click', node: any): void;
23
28
  (e: 'node-toggle', nodeId: string | number): void;
24
29
  };
@@ -71,6 +76,22 @@ export declare const KTreeDefaultProps: {
71
76
  type: PropType<Set<string | number> | (string | number)[]>;
72
77
  default: undefined;
73
78
  };
79
+ virtualScroll: {
80
+ type: BooleanConstructor;
81
+ default: boolean;
82
+ };
83
+ itemHeight: {
84
+ type: NumberConstructor;
85
+ default: number;
86
+ };
87
+ viewportHeight: {
88
+ type: NumberConstructor;
89
+ default: number;
90
+ };
91
+ buffer: {
92
+ type: NumberConstructor;
93
+ default: number;
94
+ };
74
95
  };
75
96
  export declare function useKTreeLogic(props: KTreeProps, emit?: KTreeEmits): {
76
97
  visibleRows: import("vue").ComputedRef<TTreeRow[]>;