@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
@@ -5,29 +5,38 @@ export function getApplicableRows(action, selectedRows, selectAll) {
5
5
  if (!action.visible) {
6
6
  return selectedRows || [];
7
7
  }
8
- if (!selectedRows || selectedRows.length === 0) {
8
+ if (!selectAll && (!selectedRows || selectedRows.length === 0)) {
9
9
  return [];
10
10
  }
11
- const isBulkAction = action.isBulk || typeof action.visible === "function" && action.visible.length >= 2;
11
+ const isBulkAction = action.isBulk || action.bulk || typeof action.visible === "function" && action.visible.length >= 2;
12
12
  if (isBulkAction) {
13
13
  try {
14
- const isVisible = action.visible(selectedRows, selectAll);
15
- return isVisible ? selectedRows : [];
14
+ const isVisible = action.visible(selectedRows || [], selectAll);
15
+ return isVisible ? selectedRows || [] : [];
16
16
  } catch {
17
- return selectedRows;
17
+ return selectedRows || [];
18
18
  }
19
19
  }
20
+ if (selectAll && (!selectedRows || selectedRows.length === 0)) {
21
+ return [];
22
+ }
20
23
  let isPerRowPredicate = false;
21
- try {
22
- const testResult = action.visible(selectedRows[0]);
23
- if (typeof testResult === "boolean") {
24
- isPerRowPredicate = true;
24
+ if (typeof action.visible === "function" && selectedRows && selectedRows.length > 0) {
25
+ try {
26
+ const arrayResult = action.visible(selectedRows);
27
+ const singleResult = action.visible(selectedRows[0]);
28
+ if (typeof arrayResult === "boolean" && typeof singleResult !== "boolean") {
29
+ return arrayResult ? selectedRows : [];
30
+ }
31
+ if (typeof singleResult === "boolean") {
32
+ isPerRowPredicate = true;
33
+ }
34
+ } catch {
35
+ isPerRowPredicate = false;
25
36
  }
26
- } catch {
27
- isPerRowPredicate = false;
28
37
  }
29
38
  if (isPerRowPredicate) {
30
- return selectedRows.filter((row) => {
39
+ return (selectedRows || []).filter((row) => {
31
40
  try {
32
41
  return Boolean(action.visible(row));
33
42
  } catch {
@@ -36,10 +45,10 @@ export function getApplicableRows(action, selectedRows, selectAll) {
36
45
  });
37
46
  }
38
47
  try {
39
- const isVisible = action.visible(selectedRows, selectAll);
40
- return isVisible ? selectedRows : [];
48
+ const isVisible = action.visible(selectedRows || [], selectAll);
49
+ return isVisible ? selectedRows || [] : [];
41
50
  } catch {
42
- return selectedRows;
51
+ return selectedRows || [];
43
52
  }
44
53
  }
45
54
  export function useKBulkActionsLogic(props) {
@@ -48,7 +57,7 @@ export function useKBulkActionsLogic(props) {
48
57
  const visibleBulkActions = computed(() => {
49
58
  return props.bulkActions.filter((action) => {
50
59
  if (!action.visible) return true;
51
- if (!props.selectedRows || props.selectedRows.length === 0) {
60
+ if (!props.selectAll && (!props.selectedRows || props.selectedRows.length === 0)) {
52
61
  try {
53
62
  return Boolean(action.visible([], props.selectAll));
54
63
  } catch {
@@ -56,7 +65,7 @@ export function useKBulkActionsLogic(props) {
56
65
  }
57
66
  }
58
67
  const applicable = getApplicableRows(action, props.selectedRows, props.selectAll);
59
- return applicable.length > 0;
68
+ return props.selectAll || applicable.length > 0;
60
69
  });
61
70
  });
62
71
  watch(visibleBulkActions, (actions) => {
@@ -21,11 +21,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
21
21
  type: StringConstructor;
22
22
  default: string;
23
23
  };
24
+ idKey: {
25
+ type: StringConstructor;
26
+ default: undefined;
27
+ };
24
28
  modelValue: {
25
29
  type: import("vue").PropType<any>;
26
30
  };
27
31
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
32
  "update:modelValue": (value: any) => any;
33
+ } & {
34
+ blur: (event: FocusEvent) => any;
29
35
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
30
36
  disabled: {
31
37
  type: BooleanConstructor;
@@ -48,16 +54,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
48
54
  type: StringConstructor;
49
55
  default: string;
50
56
  };
57
+ idKey: {
58
+ type: StringConstructor;
59
+ default: undefined;
60
+ };
51
61
  modelValue: {
52
62
  type: import("vue").PropType<any>;
53
63
  };
54
64
  }>> & Readonly<{
55
65
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
66
+ onBlur?: ((event: FocusEvent) => any) | undefined;
56
67
  }>, {
57
68
  label: string;
58
69
  disabled: boolean;
59
70
  validation: "error" | "success" | "warning" | null | undefined;
60
71
  validationText: string;
72
+ idKey: string;
61
73
  value: any;
62
74
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
63
75
  declare const _default: typeof __VLS_export;
@@ -7,18 +7,20 @@ const props = defineProps(KCheckboxDefaultProps);
7
7
  const model = defineModel();
8
8
  const { isDisabled, checkboxValue } = useKCheckboxLogic(props, model);
9
9
  const presetComponent = usePresetComponent("KCheckbox", KCheckboxDefault);
10
+ defineEmits(["blur"]);
10
11
  const templateProps = computed(() => ({
11
12
  model: model.value,
12
13
  checkboxValue: checkboxValue.value,
13
14
  isDisabled: isDisabled.value,
14
15
  validation: props.validation,
15
16
  validationText: props.validationText,
16
- label: props.label
17
+ label: props.label,
18
+ idKey: props.idKey
17
19
  }));
18
20
  </script>
19
21
 
20
22
  <template lang="pug">
21
- component(:is="presetComponent" v-bind="templateProps" @update:model="model = $event")
23
+ component(:is="presetComponent" v-bind="templateProps" @update:model="model = $event" @blur="$emit('blur', $event)")
22
24
  template(v-for="(_, slot) in $slots" #[slot]="scope")
23
25
  slot(:name="slot" v-bind="scope")
24
26
  </template>
@@ -21,11 +21,17 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
21
21
  type: StringConstructor;
22
22
  default: string;
23
23
  };
24
+ idKey: {
25
+ type: StringConstructor;
26
+ default: undefined;
27
+ };
24
28
  modelValue: {
25
29
  type: import("vue").PropType<any>;
26
30
  };
27
31
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
28
32
  "update:modelValue": (value: any) => any;
33
+ } & {
34
+ blur: (event: FocusEvent) => any;
29
35
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
30
36
  disabled: {
31
37
  type: BooleanConstructor;
@@ -48,16 +54,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
48
54
  type: StringConstructor;
49
55
  default: string;
50
56
  };
57
+ idKey: {
58
+ type: StringConstructor;
59
+ default: undefined;
60
+ };
51
61
  modelValue: {
52
62
  type: import("vue").PropType<any>;
53
63
  };
54
64
  }>> & Readonly<{
55
65
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
66
+ onBlur?: ((event: FocusEvent) => any) | undefined;
56
67
  }>, {
57
68
  label: string;
58
69
  disabled: boolean;
59
70
  validation: "error" | "success" | "warning" | null | undefined;
60
71
  validationText: string;
72
+ idKey: string;
61
73
  value: any;
62
74
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
63
75
  declare const _default: typeof __VLS_export;
@@ -5,6 +5,7 @@ export interface KCheckboxProps {
5
5
  validation?: 'success' | 'warning' | 'error' | null;
6
6
  validationText?: string;
7
7
  label?: string;
8
+ idKey?: string;
8
9
  }
9
10
  /**
10
11
  * KCheckbox Logic Composable
@@ -42,4 +43,8 @@ export declare const KCheckboxDefaultProps: {
42
43
  type: StringConstructor;
43
44
  default: string;
44
45
  };
46
+ idKey: {
47
+ type: StringConstructor;
48
+ default: undefined;
49
+ };
45
50
  };
@@ -31,5 +31,9 @@ export const KCheckboxDefaultProps = {
31
31
  label: {
32
32
  type: String,
33
33
  default: ""
34
+ },
35
+ idKey: {
36
+ type: String,
37
+ default: void 0
34
38
  }
35
39
  };
@@ -107,6 +107,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
107
107
  closeDropdown: () => void;
108
108
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
109
109
  "update:modelValue": (value: any) => any;
110
+ blur: (event: FocusEvent) => any;
110
111
  "update:isOptionsOpen": (value: boolean) => any;
111
112
  "update:searchtext": (value: string) => any;
112
113
  "scroll-state-change": (state: {
@@ -211,6 +212,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
211
212
  };
212
213
  }>> & Readonly<{
213
214
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
215
+ onBlur?: ((event: FocusEvent) => any) | undefined;
214
216
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
215
217
  "onUpdate:searchtext"?: ((value: string) => any) | undefined;
216
218
  "onScroll-state-change"?: ((state: {
@@ -4,7 +4,7 @@ import { usePresetComponent } from "../../composables/usePresetComponent";
4
4
  import { computed, watch } from "vue";
5
5
  import KComboboxDefault from "../../presets/default/components/KCombobox/KCombobox.vue";
6
6
  const props = defineProps(KComboboxDefaultProps);
7
- const emit = defineEmits(["update:modelValue", "update:isOptionsOpen", "update:searchtext", "scroll-state-change"]);
7
+ const emit = defineEmits(["update:modelValue", "update:isOptionsOpen", "update:searchtext", "scroll-state-change", "blur"]);
8
8
  const {
9
9
  selectedItems,
10
10
  isOptionsOpen,
@@ -79,7 +79,7 @@ function updateIsOptionsOpen(val) {
79
79
  </script>
80
80
 
81
81
  <template lang="pug">
82
- component(:is="presetComponent" v-bind="{...templateProps, ...$attrs}" @update:searchtext="updateSearchText" @update:isOptionsOpen="updateIsOptionsOpen")
82
+ component(:is="presetComponent" v-bind="{...templateProps, ...$attrs}" @update:searchtext="updateSearchText" @update:isOptionsOpen="updateIsOptionsOpen" @blur="emit('blur', $event)")
83
83
  template(v-for="(_, slot) in $slots" #[slot]="scope")
84
84
  slot(:name="slot" v-bind="scope")
85
85
  </template>
@@ -107,6 +107,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
107
107
  closeDropdown: () => void;
108
108
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
109
109
  "update:modelValue": (value: any) => any;
110
+ blur: (event: FocusEvent) => any;
110
111
  "update:isOptionsOpen": (value: boolean) => any;
111
112
  "update:searchtext": (value: string) => any;
112
113
  "scroll-state-change": (state: {
@@ -211,6 +212,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
211
212
  };
212
213
  }>> & Readonly<{
213
214
  "onUpdate:modelValue"?: ((value: any) => any) | undefined;
215
+ onBlur?: ((event: FocusEvent) => any) | undefined;
214
216
  "onUpdate:isOptionsOpen"?: ((value: boolean) => any) | undefined;
215
217
  "onUpdate:searchtext"?: ((value: string) => any) | undefined;
216
218
  "onScroll-state-change"?: ((state: {
@@ -37,6 +37,7 @@ export interface KComboboxEmits {
37
37
  lastAppendedPage: number;
38
38
  totalCount: number;
39
39
  }): void;
40
+ (e: 'blur', event: FocusEvent): void;
40
41
  }
41
42
  export declare const KComboboxDefaultProps: {
42
43
  label: {
@@ -108,44 +108,16 @@ export function useKDataIteratorLogic(props, emit) {
108
108
  watch(() => selectAll.value, (newVal) => {
109
109
  if (isInternalUpdating || newVal === lastSyncedSelectAll) return;
110
110
  lastSyncedSelectAll = newVal;
111
- const currentRows = pageRows.value;
112
- if (newVal === false) {
113
- const pageIds = new Set(currentRows.map(getRowId));
114
- selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
115
- } else {
116
- const currentSelectedIds = new Set(selectedRows.value.map(getRowId));
117
- const newSelections = currentRows.filter((r) => !currentSelectedIds.has(getRowId(r)));
118
- selectedRows.value = [...selectedRows.value, ...newSelections];
119
- }
111
+ selectedRows.value = [];
120
112
  emit?.("update:selectedRows", selectedRows.value);
121
113
  emit?.("update:selectAll", newVal);
122
114
  syncToProvider();
123
115
  });
124
- watch([pageRows, () => selectedRows.value], () => {
125
- const currentRows = pageRows.value;
126
- if (currentRows.length === 0) {
127
- if (selectAll.value) {
128
- lastSyncedSelectAll = false;
129
- isInternalUpdating = true;
130
- selectAll.value = false;
131
- isInternalUpdating = false;
132
- emit?.("update:selectAll", false);
133
- syncToProvider();
134
- }
135
- return;
136
- }
137
- const currentSelectedIds = new Set(selectedRows.value.map(getRowId));
138
- const allSelected = currentRows.every((r) => currentSelectedIds.has(getRowId(r)));
139
- if (selectAll.value !== allSelected) {
140
- lastSyncedSelectAll = allSelected;
141
- isInternalUpdating = true;
142
- selectAll.value = allSelected;
143
- isInternalUpdating = false;
144
- emit?.("update:selectAll", allSelected);
145
- }
146
- emit?.("update:selectedRows", selectedRows.value);
116
+ watch(() => selectedRows.value, (newVal) => {
117
+ if (isInternalUpdating) return;
118
+ emit?.("update:selectedRows", newVal || []);
147
119
  syncToProvider();
148
- });
120
+ }, { deep: true });
149
121
  return {
150
122
  selectedRows,
151
123
  selectAll,
@@ -12,6 +12,7 @@ export const KDatatableDefaultProps = {
12
12
  export function useKDatatableLogic(props, emit) {
13
13
  const {
14
14
  pageData,
15
+ virtualRows,
15
16
  selectedRows: dpSelectedRows,
16
17
  selectAll: dpSelectAll,
17
18
  currentPage: dpCurrentPage,
@@ -124,47 +125,45 @@ export function useKDatatableLogic(props, emit) {
124
125
  emit?.("filter-change", newVal);
125
126
  }, { deep: true });
126
127
  let lastSyncedSelectAll = Boolean(selectAll.value);
128
+ const getTargetRows = () => {
129
+ if (props.virtualScroll) {
130
+ const dp = props.dataProvider;
131
+ if (Array.isArray(dp?.rowMap)) return dp.rowMap;
132
+ if (Array.isArray(dp?.rowMap?.value)) return dp.rowMap.value;
133
+ if (Array.isArray(virtualRows?.value) && virtualRows.value.length > 0) return virtualRows.value;
134
+ if (Array.isArray(dp?.allVisibleRows)) return dp.allVisibleRows;
135
+ if (Array.isArray(dp?.allVisibleRows?.value)) return dp.allVisibleRows.value;
136
+ if (Array.isArray(dp?.allData?.value)) return dp.allData.value;
137
+ if (Array.isArray(dp?.allData)) return dp.allData;
138
+ if (Array.isArray(dp?.data)) return dp.data;
139
+ }
140
+ return pageRows.value;
141
+ };
127
142
  watch(() => selectAll.value, (newVal) => {
128
143
  if (isInternalUpdating || newVal === lastSyncedSelectAll) return;
129
144
  lastSyncedSelectAll = newVal;
130
- const currentRows = pageRows.value;
131
- if (newVal === false) {
132
- const pageIds = new Set(currentRows.map(getRowId));
133
- selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
145
+ if (props.virtualScroll) {
146
+ const currentRows = getTargetRows();
147
+ if (newVal === false) {
148
+ const pageIds = new Set(currentRows.map(getRowId));
149
+ selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
150
+ } else {
151
+ const currentSelectedIds = new Set(selectedRows.value.map(getRowId));
152
+ const newSelections = currentRows.filter((r) => !currentSelectedIds.has(getRowId(r)));
153
+ selectedRows.value = [...selectedRows.value, ...newSelections];
154
+ }
134
155
  } else {
135
- const currentSelectedIds = new Set(selectedRows.value.map(getRowId));
136
- const newSelections = currentRows.filter((r) => !currentSelectedIds.has(getRowId(r)));
137
- selectedRows.value = [...selectedRows.value, ...newSelections];
156
+ selectedRows.value = [];
138
157
  }
139
158
  emit?.("update:selectedRows", selectedRows.value);
140
159
  emit?.("update:selectAll", newVal);
141
160
  syncToProvider();
142
161
  });
143
- watch([pageRows, () => selectedRows.value], () => {
144
- const currentRows = pageRows.value;
145
- if (currentRows.length === 0) {
146
- if (selectAll.value) {
147
- lastSyncedSelectAll = false;
148
- isInternalUpdating = true;
149
- selectAll.value = false;
150
- isInternalUpdating = false;
151
- emit?.("update:selectAll", false);
152
- syncToProvider();
153
- }
154
- return;
155
- }
156
- const selectedIds = new Set(selectedRows.value.map(getRowId));
157
- const allCurrentSelected = currentRows.every((r) => selectedIds.has(getRowId(r)));
158
- if (selectAll.value !== allCurrentSelected) {
159
- lastSyncedSelectAll = allCurrentSelected;
160
- isInternalUpdating = true;
161
- selectAll.value = allCurrentSelected;
162
- isInternalUpdating = false;
163
- emit?.("update:selectAll", allCurrentSelected);
164
- }
165
- emit?.("update:selectedRows", selectedRows.value);
162
+ watch(() => selectedRows.value, (newVal) => {
163
+ if (isInternalUpdating) return;
164
+ emit?.("update:selectedRows", newVal || []);
166
165
  syncToProvider();
167
- }, { immediate: true });
166
+ }, { deep: true });
168
167
  return {
169
168
  selectedRows,
170
169
  selectAll,
@@ -56,6 +56,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
56
56
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
57
57
  "update:modelValue": (value: string | Date) => any;
58
58
  change: (value: string | Date) => any;
59
+ blur: (event: FocusEvent) => any;
59
60
  "update:isOpen": (value: boolean) => any;
60
61
  "update:maskedModel": (value: string) => any;
61
62
  "update:calendarShow": (value: boolean) => any;
@@ -117,6 +118,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
117
118
  }>> & Readonly<{
118
119
  "onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
119
120
  onChange?: ((value: string | Date) => any) | undefined;
121
+ onBlur?: ((event: FocusEvent) => any) | undefined;
120
122
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
121
123
  "onUpdate:maskedModel"?: ((value: string) => any) | undefined;
122
124
  "onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
@@ -125,11 +127,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
125
127
  modelValue: string | Date;
126
128
  isOpen: boolean;
127
129
  label: string;
130
+ validation: "error" | "success" | "warning" | null | undefined;
131
+ validationText: string;
128
132
  definedDays: import("../KCalendar/types.js").IDefinedDay[];
129
133
  markedDays: import("../KCalendar/types.js").IMarkedDay[];
130
134
  day: string | Date;
131
- validation: "error" | "success" | "warning" | null | undefined;
132
- validationText: string;
133
135
  placeholder: string;
134
136
  teleportTo: string;
135
137
  showClear: boolean;
@@ -4,7 +4,7 @@ import { usePresetComponent } from "../../composables/usePresetComponent";
4
4
  import { computed, watch } from "vue";
5
5
  import KDatePickerDefault from "../../presets/default/components/KDatePicker/KDatePicker.vue";
6
6
  const props = defineProps(KDatePickerDefaultProps);
7
- const emit = defineEmits(["update:maskedModel", "update:calendarShow", "update:day", "update:modelValue", "update:isOpen", "change"]);
7
+ const emit = defineEmits(["update:maskedModel", "update:calendarShow", "update:day", "update:modelValue", "update:isOpen", "change", "blur"]);
8
8
  const {
9
9
  _date,
10
10
  maskedModel,
@@ -70,5 +70,6 @@ component(
70
70
  v-bind="{ ...templateProps, ...$attrs }"
71
71
  @update:maskedModel="updateMaskedModel"
72
72
  @update:calendarShow="updateCalendarShow"
73
+ @blur="emit('blur', $event)"
73
74
  )
74
75
  </template>
@@ -56,6 +56,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
56
56
  }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
57
57
  "update:modelValue": (value: string | Date) => any;
58
58
  change: (value: string | Date) => any;
59
+ blur: (event: FocusEvent) => any;
59
60
  "update:isOpen": (value: boolean) => any;
60
61
  "update:maskedModel": (value: string) => any;
61
62
  "update:calendarShow": (value: boolean) => any;
@@ -117,6 +118,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
117
118
  }>> & Readonly<{
118
119
  "onUpdate:modelValue"?: ((value: string | Date) => any) | undefined;
119
120
  onChange?: ((value: string | Date) => any) | undefined;
121
+ onBlur?: ((event: FocusEvent) => any) | undefined;
120
122
  "onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
121
123
  "onUpdate:maskedModel"?: ((value: string) => any) | undefined;
122
124
  "onUpdate:calendarShow"?: ((value: boolean) => any) | undefined;
@@ -125,11 +127,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
125
127
  modelValue: string | Date;
126
128
  isOpen: boolean;
127
129
  label: string;
130
+ validation: "error" | "success" | "warning" | null | undefined;
131
+ validationText: string;
128
132
  definedDays: import("../KCalendar/types.js").IDefinedDay[];
129
133
  markedDays: import("../KCalendar/types.js").IMarkedDay[];
130
134
  day: string | Date;
131
- validation: "error" | "success" | "warning" | null | undefined;
132
- validationText: string;
133
135
  placeholder: string;
134
136
  teleportTo: string;
135
137
  showClear: boolean;
@@ -129,11 +129,11 @@ 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: "error" | "success" | "warning" | null | undefined;
133
+ validationText: string;
132
134
  definedDays: import("../KCalendar/types.js").IDefinedDay[];
133
135
  markedDays: import("../KCalendar/types.js").IMarkedDay[];
134
136
  day: string | Date;
135
- validation: "error" | "success" | "warning" | null | undefined;
136
- validationText: string;
137
137
  placeholder: string;
138
138
  teleportTo: string;
139
139
  showClear: boolean;
@@ -129,11 +129,11 @@ 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: "error" | "success" | "warning" | null | undefined;
133
+ validationText: string;
132
134
  definedDays: import("../KCalendar/types.js").IDefinedDay[];
133
135
  markedDays: import("../KCalendar/types.js").IMarkedDay[];
134
136
  day: string | Date;
135
- validation: "error" | "success" | "warning" | null | undefined;
136
- validationText: string;
137
137
  placeholder: string;
138
138
  teleportTo: string;
139
139
  showClear: boolean;
@@ -66,8 +66,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
66
66
  teleportTo: string;
67
67
  fullWidth: boolean;
68
68
  maxHeight: number;
69
- align: import("./KDropdown.logic.js").KDropdownAlign;
70
69
  anchorEl: HTMLElement;
70
+ align: import("./KDropdown.logic.js").KDropdownAlign;
71
71
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
72
72
  declare const _default: typeof __VLS_export;
73
73
  export default _default;
@@ -66,8 +66,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
66
66
  teleportTo: string;
67
67
  fullWidth: boolean;
68
68
  maxHeight: number;
69
- align: import("./KDropdown.logic.js").KDropdownAlign;
70
69
  anchorEl: HTMLElement;
70
+ align: import("./KDropdown.logic.js").KDropdownAlign;
71
71
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
72
72
  declare const _default: typeof __VLS_export;
73
73
  export default _default;
@@ -67,6 +67,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
67
67
  type: ObjectConstructor;
68
68
  default: () => {};
69
69
  };
70
+ virtualScroll: {
71
+ type: BooleanConstructor;
72
+ default: boolean;
73
+ };
74
+ itemHeight: {
75
+ type: NumberConstructor;
76
+ default: number;
77
+ };
78
+ viewportHeight: {
79
+ type: NumberConstructor;
80
+ default: number;
81
+ };
82
+ buffer: {
83
+ type: NumberConstructor;
84
+ default: number;
85
+ };
70
86
  }>, {
71
87
  moveTime: (amount: number) => void;
72
88
  zoom: (factor: number) => void;
@@ -145,6 +161,22 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
145
161
  type: ObjectConstructor;
146
162
  default: () => {};
147
163
  };
164
+ virtualScroll: {
165
+ type: BooleanConstructor;
166
+ default: boolean;
167
+ };
168
+ itemHeight: {
169
+ type: NumberConstructor;
170
+ default: number;
171
+ };
172
+ viewportHeight: {
173
+ type: NumberConstructor;
174
+ default: number;
175
+ };
176
+ buffer: {
177
+ type: NumberConstructor;
178
+ default: number;
179
+ };
148
180
  }>> & Readonly<{
149
181
  "onUpdate:selectedRows"?: ((...args: any[]) => any) | undefined;
150
182
  "onUpdate:selectAll"?: ((...args: any[]) => any) | undefined;
@@ -153,7 +185,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
153
185
  "onUpdate:endingPoint"?: ((...args: any[]) => any) | undefined;
154
186
  }>, {
155
187
  bulkActions: unknown[];
188
+ virtualScroll: boolean;
189
+ itemHeight: number;
190
+ buffer: number;
156
191
  rowActions: unknown[];
192
+ viewportHeight: number;
157
193
  cellSlots: Record<string, any>;
158
194
  headerSlots: Record<string, any>;
159
195
  startDate: string | number | Date;
@@ -58,7 +58,11 @@ const templateProps = computed(() => ({
58
58
  zoom,
59
59
  selectedRows: selectedRows.value,
60
60
  selectAll: selectAll.value,
61
- cellSlots: { ...slots, ...props.cellSlots || {} }
61
+ cellSlots: { ...slots, ...props.cellSlots || {} },
62
+ virtualScroll: props.virtualScroll,
63
+ itemHeight: props.itemHeight,
64
+ viewportHeight: props.viewportHeight,
65
+ buffer: props.buffer
62
66
  }));
63
67
  </script>
64
68