@katlux/toolkit 0.1.1-alpha.123 → 0.1.1-alpha.125

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 (68) hide show
  1. package/bin/cli.mjs +0 -0
  2. package/bin/create-preset.mjs +0 -0
  3. package/dist/compiled/composables/useDataProvider.mjs +7 -59
  4. package/dist/compiled/composables/useKatluxForm.mjs +23 -4
  5. package/dist/compiled/composables/usePresetComponent.mjs +1 -1
  6. package/dist/compiled/composables/useVirtualScroll.mjs +24 -11
  7. package/dist/compiled/utils/sanitize.mjs +39 -0
  8. package/dist/module.json +1 -1
  9. package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +3 -1
  10. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +2 -0
  11. package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +3 -1
  12. package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +2 -0
  13. package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +22 -1
  14. package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +11 -0
  15. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue +4 -3
  16. package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +11 -0
  17. package/dist/runtime/components/KCheckbox/KCheckbox.logic.d.ts +5 -0
  18. package/dist/runtime/components/KCheckbox/KCheckbox.logic.js +4 -0
  19. package/dist/runtime/components/KCombobox/KCombobox.logic.js +3 -1
  20. package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +1 -1
  21. package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +1 -1
  22. package/dist/runtime/components/KDatatable/KDataIterator.logic.js +3 -41
  23. package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +9 -1
  24. package/dist/runtime/components/KDatatable/KDatatable.global.vue +17 -1
  25. package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +9 -1
  26. package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +7 -1
  27. package/dist/runtime/components/KDatatable/KDatatable.logic.js +58 -54
  28. package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +1 -1
  29. package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +1 -1
  30. package/dist/runtime/components/KGantt/KGantt.logic.js +2 -4
  31. package/dist/runtime/components/KMaskTextbox/KMaskTextbox.logic.js +2 -0
  32. package/dist/runtime/components/KRadiobox/KRadiobox.global.vue +1 -1
  33. package/dist/runtime/components/KRangeSlider/KRangeSlider.global.vue +1 -1
  34. package/dist/runtime/components/KSlider/KSlider.global.vue +1 -1
  35. package/dist/runtime/components/KTextarea/KTextarea.global.vue +1 -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 +2 -0
  40. package/dist/runtime/components/KTree/KTree.global.vue.d.ts +1 -1
  41. package/dist/runtime/components/KTree/KTree.logic.js +38 -12
  42. package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +1 -1
  43. package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +1 -1
  44. package/dist/runtime/composables/useDataProvider.d.ts +1 -5
  45. package/dist/runtime/composables/useDataProvider.js +7 -59
  46. package/dist/runtime/composables/useKatluxForm.js +23 -4
  47. package/dist/runtime/composables/usePresetComponent.js +1 -1
  48. package/dist/runtime/composables/useVirtualScroll.js +24 -11
  49. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +1 -0
  50. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +2 -1
  51. package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +1 -0
  52. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.d.vue.ts +9 -3
  53. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue +35 -12
  54. package/dist/runtime/presets/default/components/KCheckbox/KCheckbox.vue.d.ts +9 -3
  55. package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +8 -0
  56. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +183 -31
  57. package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +8 -0
  58. package/dist/runtime/presets/default/components/KIcon/KIcon.vue +5 -2
  59. package/dist/runtime/presets/default/components/KRadiobox/KRadiobox.vue +1 -0
  60. package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +3 -3
  61. package/dist/runtime/presets/default/components/KTree/KTree.vue +245 -115
  62. package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +3 -3
  63. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.d.vue.ts +27 -0
  64. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue +179 -0
  65. package/dist/runtime/presets/default/components/KTree/KTreeNodeItem.vue.d.ts +27 -0
  66. package/dist/runtime/utils/sanitize.d.ts +5 -0
  67. package/dist/runtime/utils/sanitize.js +39 -0
  68. package/package.json +6 -3
@@ -14,8 +14,6 @@ export const KDataIteratorDefaultProps = {
14
14
  export function useKDataIteratorLogic(props, emit) {
15
15
  const {
16
16
  pageData,
17
- selectedRows: dpSelectedRows,
18
- selectAll: dpSelectAll,
19
17
  currentPage: dpCurrentPage,
20
18
  pageSize: dpPageSize,
21
19
  loading: dpLoading,
@@ -24,47 +22,16 @@ export function useKDataIteratorLogic(props, emit) {
24
22
  setPageSize,
25
23
  setFilter
26
24
  } = useDataProvider(props.dataProvider);
27
- const selectedRows = isRef(props.dataProvider?.selectedRows) ? props.dataProvider.selectedRows : props.selectedRows !== void 0 ? ref(props.selectedRows) : dpSelectedRows;
28
- const selectAll = isRef(props.dataProvider?.selectAll) ? props.dataProvider.selectAll : props.selectAll !== void 0 ? ref(props.selectAll) : dpSelectAll;
25
+ const selectedRows = props.selectedRows !== void 0 ? ref(props.selectedRows) : ref([]);
26
+ const selectAll = props.selectAll !== void 0 ? ref(props.selectAll) : ref(false);
29
27
  const idKey = props.dataProvider?.idKey || "id";
30
28
  const getRowId = (row) => row?.[idKey] ?? row?.id ?? row;
31
- let isInternalUpdating = false;
32
29
  const pageRows = computed(() => {
33
30
  if (props.dataProvider?.pageData && isRef(props.dataProvider.pageData)) {
34
31
  return props.dataProvider.pageData.value || [];
35
32
  }
36
33
  return pageData.value || [];
37
34
  });
38
- const syncToProvider = () => {
39
- if (props.dataProvider) {
40
- isInternalUpdating = true;
41
- const update = () => {
42
- if (typeof props.dataProvider.setSelectAll === "function") {
43
- props.dataProvider.setSelectAll(selectAll.value);
44
- } else if (isRef(props.dataProvider.selectAll)) {
45
- props.dataProvider.selectAll.value = selectAll.value;
46
- } else {
47
- props.dataProvider.selectAll = selectAll.value;
48
- }
49
- if (typeof props.dataProvider.setSelectedRows === "function") {
50
- props.dataProvider.setSelectedRows(selectedRows.value);
51
- } else if (isRef(props.dataProvider.selectedRows)) {
52
- props.dataProvider.selectedRows.value = selectedRows.value;
53
- } else {
54
- props.dataProvider.selectedRows = selectedRows.value;
55
- }
56
- };
57
- try {
58
- if (typeof props.dataProvider.batchUpdates === "function") {
59
- props.dataProvider.batchUpdates(update);
60
- } else {
61
- update();
62
- }
63
- } finally {
64
- isInternalUpdating = false;
65
- }
66
- }
67
- };
68
35
  watch([() => props.page, () => props.currentPage], ([p, cp]) => {
69
36
  const targetPage = p ?? cp;
70
37
  if (targetPage !== void 0 && targetPage !== dpCurrentPage.value) {
@@ -86,13 +53,11 @@ export function useKDataIteratorLogic(props, emit) {
86
53
  watch(() => props.selectedRows, (val) => {
87
54
  if (val !== void 0 && val !== selectedRows.value) {
88
55
  selectedRows.value = val;
89
- syncToProvider();
90
56
  }
91
57
  }, { deep: true });
92
58
  watch(() => props.selectAll, (val) => {
93
59
  if (val !== void 0 && val !== selectAll.value) {
94
60
  selectAll.value = val;
95
- syncToProvider();
96
61
  }
97
62
  });
98
63
  watch(dpCurrentPage, (newVal) => {
@@ -106,17 +71,14 @@ export function useKDataIteratorLogic(props, emit) {
106
71
  });
107
72
  let lastSyncedSelectAll = Boolean(selectAll.value);
108
73
  watch(() => selectAll.value, (newVal) => {
109
- if (isInternalUpdating || newVal === lastSyncedSelectAll) return;
74
+ if (newVal === lastSyncedSelectAll) return;
110
75
  lastSyncedSelectAll = newVal;
111
76
  selectedRows.value = [];
112
77
  emit?.("update:selectedRows", selectedRows.value);
113
78
  emit?.("update:selectAll", newVal);
114
- syncToProvider();
115
79
  });
116
80
  watch(() => selectedRows.value, (newVal) => {
117
- if (isInternalUpdating) return;
118
81
  emit?.("update:selectedRows", newVal || []);
119
- syncToProvider();
120
82
  }, { deep: true });
121
83
  return {
122
84
  selectedRows,
@@ -17,6 +17,8 @@ interface Props {
17
17
  filter?: IDataFilter | null;
18
18
  selectedRows?: any[];
19
19
  selectAll?: boolean;
20
+ selectAllScope?: 'page' | 'dataset';
21
+ unselectedRows?: any[];
20
22
  virtualScroll?: boolean;
21
23
  itemHeight?: number;
22
24
  viewportHeight?: number;
@@ -30,6 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
30
32
  "page-change": (value: number) => any;
31
33
  "update:sortList": (value: IDataSort[]) => any;
32
34
  "update:filter": (value: IDataFilter | null) => any;
35
+ "update:unselectedRows": (value: any[]) => any;
36
+ "update:selectAllScope": (value: "page" | "dataset") => any;
33
37
  "sort-change": (value: IDataSort[]) => any;
34
38
  "filter-change": (value: IDataFilter | null) => any;
35
39
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
@@ -40,12 +44,15 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
40
44
  "onPage-change"?: ((value: number) => any) | undefined;
41
45
  "onUpdate:sortList"?: ((value: IDataSort[]) => any) | undefined;
42
46
  "onUpdate:filter"?: ((value: IDataFilter | null) => any) | undefined;
47
+ "onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
48
+ "onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
43
49
  "onSort-change"?: ((value: IDataSort[]) => any) | undefined;
44
50
  "onFilter-change"?: ((value: IDataFilter | null) => any) | undefined;
45
51
  }>, {
46
52
  filter: IDataFilter | null;
47
- bulkActions: Array<IKDatatableAction>;
48
53
  selectedRows: any[];
54
+ unselectedRows: any[];
55
+ bulkActions: Array<IKDatatableAction>;
49
56
  selectAll: boolean;
50
57
  currentPage: number;
51
58
  pageSize: number;
@@ -56,6 +63,7 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
56
63
  visibleFields: Array<string> | null;
57
64
  rowActions: Array<IKDatatableAction>;
58
65
  viewportHeight: number;
66
+ selectAllScope: "page" | "dataset";
59
67
  cellSlots: Record<string, any>;
60
68
  headerSlots: Record<string, any>;
61
69
  columnHeaders: Record<string, string>;
@@ -21,15 +21,19 @@ const props = defineProps({
21
21
  filter: { type: [Object, null], required: false, default: void 0 },
22
22
  selectedRows: { type: Array, required: false, default: void 0 },
23
23
  selectAll: { type: Boolean, required: false, default: void 0 },
24
+ selectAllScope: { type: String, required: false, default: void 0 },
25
+ unselectedRows: { type: Array, required: false, default: void 0 },
24
26
  virtualScroll: { type: Boolean, required: false, default: false },
25
27
  itemHeight: { type: Number, required: false, default: 40 },
26
28
  viewportHeight: { type: Number, required: false, default: 500 },
27
29
  buffer: { type: Number, required: false, default: 5 }
28
30
  });
29
- const emit = defineEmits(["update:currentPage", "update:pageSize", "update:sortList", "update:filter", "update:selectedRows", "update:selectAll", "page-change", "sort-change", "filter-change"]);
31
+ const emit = defineEmits(["update:currentPage", "update:pageSize", "update:sortList", "update:filter", "update:selectedRows", "update:selectAll", "update:unselectedRows", "update:selectAllScope", "page-change", "sort-change", "filter-change"]);
30
32
  const {
31
33
  selectedRows,
32
34
  selectAll,
35
+ selectAllScope,
36
+ unselectedRows,
33
37
  currentPage,
34
38
  pageSize,
35
39
  sortList,
@@ -54,6 +58,8 @@ const templateProps = computed(() => ({
54
58
  bulkActions: props.bulkActions,
55
59
  selectedRows: selectedRows.value,
56
60
  selectAll: selectAll.value,
61
+ selectAllScope: selectAllScope.value,
62
+ unselectedRows: unselectedRows.value,
57
63
  currentPage: currentPage.value,
58
64
  pageSize: pageSize.value,
59
65
  cellSlots: mergedCellSlots.value,
@@ -75,6 +81,14 @@ const updateSelectAll = (val) => {
75
81
  selectAll.value = val;
76
82
  emit("update:selectAll", val);
77
83
  };
84
+ const updateUnselectedRows = (val) => {
85
+ unselectedRows.value = val;
86
+ emit("update:unselectedRows", val);
87
+ };
88
+ const updateSelectAllScope = (val) => {
89
+ selectAllScope.value = val;
90
+ emit("update:selectAllScope", val);
91
+ };
78
92
  const updateCurrentPage = (val) => {
79
93
  setCurrentPage(val);
80
94
  emit("update:currentPage", val);
@@ -92,6 +106,8 @@ component(
92
106
  v-bind="templateProps"
93
107
  @update:selectedRows="updateSelectedRows"
94
108
  @update:selectAll="updateSelectAll"
109
+ @update:unselectedRows="updateUnselectedRows"
110
+ @update:selectAllScope="updateSelectAllScope"
95
111
  @update:currentPage="updateCurrentPage"
96
112
  @update:pageSize="updatePageSize"
97
113
  )
@@ -17,6 +17,8 @@ interface Props {
17
17
  filter?: IDataFilter | null;
18
18
  selectedRows?: any[];
19
19
  selectAll?: boolean;
20
+ selectAllScope?: 'page' | 'dataset';
21
+ unselectedRows?: any[];
20
22
  virtualScroll?: boolean;
21
23
  itemHeight?: number;
22
24
  viewportHeight?: number;
@@ -30,6 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
30
32
  "page-change": (value: number) => any;
31
33
  "update:sortList": (value: IDataSort[]) => any;
32
34
  "update:filter": (value: IDataFilter | null) => any;
35
+ "update:unselectedRows": (value: any[]) => any;
36
+ "update:selectAllScope": (value: "page" | "dataset") => any;
33
37
  "sort-change": (value: IDataSort[]) => any;
34
38
  "filter-change": (value: IDataFilter | null) => any;
35
39
  }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
@@ -40,12 +44,15 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
40
44
  "onPage-change"?: ((value: number) => any) | undefined;
41
45
  "onUpdate:sortList"?: ((value: IDataSort[]) => any) | undefined;
42
46
  "onUpdate:filter"?: ((value: IDataFilter | null) => any) | undefined;
47
+ "onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
48
+ "onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
43
49
  "onSort-change"?: ((value: IDataSort[]) => any) | undefined;
44
50
  "onFilter-change"?: ((value: IDataFilter | null) => any) | undefined;
45
51
  }>, {
46
52
  filter: IDataFilter | null;
47
- bulkActions: Array<IKDatatableAction>;
48
53
  selectedRows: any[];
54
+ unselectedRows: any[];
55
+ bulkActions: Array<IKDatatableAction>;
49
56
  selectAll: boolean;
50
57
  currentPage: number;
51
58
  pageSize: number;
@@ -56,6 +63,7 @@ declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {},
56
63
  visibleFields: Array<string> | null;
57
64
  rowActions: Array<IKDatatableAction>;
58
65
  viewportHeight: number;
66
+ selectAllScope: "page" | "dataset";
59
67
  cellSlots: Record<string, any>;
60
68
  headerSlots: Record<string, any>;
61
69
  columnHeaders: Record<string, string>;
@@ -11,6 +11,8 @@ export interface KDatatableProps {
11
11
  filter?: IDataFilter | null;
12
12
  selectedRows?: any[];
13
13
  selectAll?: boolean;
14
+ selectAllScope?: 'page' | 'dataset';
15
+ unselectedRows?: any[];
14
16
  virtualScroll?: boolean;
15
17
  itemHeight?: number;
16
18
  viewportHeight?: number;
@@ -23,6 +25,8 @@ export type KDatatableEmits = {
23
25
  (e: 'update:filter', filter: IDataFilter | null): void;
24
26
  (e: 'update:selectedRows', rows: any[]): void;
25
27
  (e: 'update:selectAll', selectAll: boolean): void;
28
+ (e: 'update:unselectedRows', rows: any[]): void;
29
+ (e: 'update:selectAllScope', scope: 'page' | 'dataset'): void;
26
30
  (e: 'page-change', page: number): void;
27
31
  (e: 'sort-change', sortList: IDataSort[]): void;
28
32
  (e: 'filter-change', filter: IDataFilter | null): void;
@@ -39,6 +43,8 @@ export declare const KDatatableDefaultProps: {
39
43
  export declare function useKDatatableLogic(props: KDatatableProps, emit?: KDatatableEmits): {
40
44
  selectedRows: Ref<any[], any[]>;
41
45
  selectAll: Ref<boolean, boolean>;
46
+ selectAllScope: Ref<"page" | "dataset", "page" | "dataset">;
47
+ unselectedRows: Ref<any[], any[]>;
42
48
  currentPage: Ref<number, number>;
43
49
  pageSize: Ref<number, number>;
44
50
  sortList: Ref<IDataSort[], IDataSort[]>;
@@ -46,7 +52,7 @@ export declare function useKDatatableLogic(props: KDatatableProps, emit?: KDatat
46
52
  setCurrentPage: (page: number) => void;
47
53
  setPageSize: (size: number) => void;
48
54
  setSortList: (sortList: IDataSort[]) => void;
49
- setFilter: (filter: IDataFilter | null) => void;
55
+ setFilter: (filter: IDataFilter | null, immediate?: boolean) => void;
50
56
  getRowKey: (row: any, index: number) => string | number;
51
57
  pageData: import("vue").ComputedRef<any[]>;
52
58
  };
@@ -13,8 +13,6 @@ export function useKDatatableLogic(props, emit) {
13
13
  const {
14
14
  pageData,
15
15
  virtualRows,
16
- selectedRows: dpSelectedRows,
17
- selectAll: dpSelectAll,
18
16
  currentPage: dpCurrentPage,
19
17
  pageSize: dpPageSize,
20
18
  sortList: dpSortList,
@@ -24,11 +22,19 @@ export function useKDatatableLogic(props, emit) {
24
22
  setSortList,
25
23
  setFilter
26
24
  } = useDataProvider(props.dataProvider);
27
- const selectedRows = isRef(props.dataProvider?.selectedRows) ? props.dataProvider.selectedRows : props.selectedRows !== void 0 ? ref(props.selectedRows) : dpSelectedRows;
28
- const selectAll = isRef(props.dataProvider?.selectAll) ? props.dataProvider.selectAll : props.selectAll !== void 0 ? ref(props.selectAll) : dpSelectAll;
25
+ const selectedRows = isRef(props.selectedRows) ? props.selectedRows : ref(props.selectedRows !== void 0 ? props.selectedRows : []);
26
+ const selectAll = isRef(props.selectAll) ? props.selectAll : ref(props.selectAll !== void 0 ? props.selectAll : false);
27
+ const rawScope = isRef(props.selectAllScope) ? props.selectAllScope.value : props.selectAllScope;
28
+ const effectiveInitialScope = props.virtualScroll ? (() => {
29
+ if (rawScope === "page") {
30
+ console.warn('[KDatatable] virtualScroll is enabled with selectAllScope="page". Overriding selectAllScope to "dataset" because page-scoped selection is incompatible with virtual scrolling.');
31
+ }
32
+ return "dataset";
33
+ })() : rawScope || "page";
34
+ const selectAllScope = isRef(props.selectAllScope) ? props.selectAllScope : ref(effectiveInitialScope);
35
+ const unselectedRows = isRef(props.unselectedRows) ? props.unselectedRows : ref(props.unselectedRows !== void 0 ? props.unselectedRows : []);
29
36
  const idKey = props.dataProvider?.idKey || "id";
30
37
  const getRowId = (row) => row?.[idKey] ?? row?.id ?? row;
31
- let isInternalUpdating = false;
32
38
  const pageRows = computed(() => {
33
39
  if (props.dataProvider?.pageData && isRef(props.dataProvider.pageData)) {
34
40
  return props.dataProvider.pageData.value || [];
@@ -47,36 +53,6 @@ export function useKDatatableLogic(props, emit) {
47
53
  }
48
54
  return index;
49
55
  };
50
- const syncToProvider = () => {
51
- if (props.dataProvider) {
52
- isInternalUpdating = true;
53
- const update = () => {
54
- if (typeof props.dataProvider.setSelectAll === "function") {
55
- props.dataProvider.setSelectAll(selectAll.value);
56
- } else if (isRef(props.dataProvider.selectAll)) {
57
- props.dataProvider.selectAll.value = selectAll.value;
58
- } else {
59
- props.dataProvider.selectAll = selectAll.value;
60
- }
61
- if (typeof props.dataProvider.setSelectedRows === "function") {
62
- props.dataProvider.setSelectedRows(selectedRows.value);
63
- } else if (isRef(props.dataProvider.selectedRows)) {
64
- props.dataProvider.selectedRows.value = selectedRows.value;
65
- } else {
66
- props.dataProvider.selectedRows = selectedRows.value;
67
- }
68
- };
69
- try {
70
- if (typeof props.dataProvider.batchUpdates === "function") {
71
- props.dataProvider.batchUpdates(update);
72
- } else {
73
- update();
74
- }
75
- } finally {
76
- isInternalUpdating = false;
77
- }
78
- }
79
- };
80
56
  watch(() => props.currentPage, (val) => {
81
57
  if (val !== void 0 && val !== dpCurrentPage.value) {
82
58
  setCurrentPage(val);
@@ -97,18 +73,39 @@ export function useKDatatableLogic(props, emit) {
97
73
  setFilter(val);
98
74
  }
99
75
  }, { deep: true });
100
- watch(() => props.selectedRows, (val) => {
101
- if (val !== void 0 && val !== selectedRows.value) {
102
- selectedRows.value = val;
103
- syncToProvider();
104
- }
105
- }, { deep: true });
106
- watch(() => props.selectAll, (val) => {
107
- if (val !== void 0 && val !== selectAll.value) {
108
- selectAll.value = val;
109
- syncToProvider();
110
- }
111
- });
76
+ if (!isRef(props.selectedRows)) {
77
+ watch(() => props.selectedRows, (val) => {
78
+ if (val !== void 0 && val !== selectedRows.value) {
79
+ selectedRows.value = val;
80
+ }
81
+ }, { deep: true });
82
+ }
83
+ if (!isRef(props.selectAll)) {
84
+ watch(() => props.selectAll, (val) => {
85
+ if (val !== void 0 && val !== selectAll.value) {
86
+ selectAll.value = val;
87
+ }
88
+ });
89
+ }
90
+ if (!isRef(props.selectAllScope)) {
91
+ watch(() => props.selectAllScope, (val) => {
92
+ if (val !== void 0) {
93
+ if (props.virtualScroll && val === "page") {
94
+ console.warn('[KDatatable] virtualScroll is enabled with selectAllScope="page". Overriding selectAllScope to "dataset" because page-scoped selection is incompatible with virtual scrolling.');
95
+ selectAllScope.value = "dataset";
96
+ } else if (val !== selectAllScope.value) {
97
+ selectAllScope.value = val;
98
+ }
99
+ }
100
+ });
101
+ }
102
+ if (!isRef(props.unselectedRows)) {
103
+ watch(() => props.unselectedRows, (val) => {
104
+ if (val !== void 0 && val !== unselectedRows.value) {
105
+ unselectedRows.value = val;
106
+ }
107
+ }, { deep: true });
108
+ }
112
109
  watch(dpCurrentPage, (newVal) => {
113
110
  emit?.("update:currentPage", newVal);
114
111
  emit?.("page-change", newVal);
@@ -140,9 +137,12 @@ export function useKDatatableLogic(props, emit) {
140
137
  return pageRows.value;
141
138
  };
142
139
  watch(() => selectAll.value, (newVal) => {
143
- if (isInternalUpdating || newVal === lastSyncedSelectAll) return;
140
+ if (newVal === lastSyncedSelectAll) return;
144
141
  lastSyncedSelectAll = newVal;
145
- if (props.virtualScroll) {
142
+ if (selectAllScope.value === "dataset") {
143
+ unselectedRows.value = [];
144
+ selectedRows.value = [];
145
+ } else {
146
146
  const currentRows = getTargetRows();
147
147
  if (newVal === false) {
148
148
  const pageIds = new Set(currentRows.map(getRowId));
@@ -152,21 +152,25 @@ export function useKDatatableLogic(props, emit) {
152
152
  const newSelections = currentRows.filter((r) => !currentSelectedIds.has(getRowId(r)));
153
153
  selectedRows.value = [...selectedRows.value, ...newSelections];
154
154
  }
155
- } else {
156
- selectedRows.value = [];
157
155
  }
158
156
  emit?.("update:selectedRows", selectedRows.value);
159
157
  emit?.("update:selectAll", newVal);
160
- syncToProvider();
158
+ emit?.("update:unselectedRows", unselectedRows.value);
161
159
  });
162
160
  watch(() => selectedRows.value, (newVal) => {
163
- if (isInternalUpdating) return;
164
161
  emit?.("update:selectedRows", newVal || []);
165
- syncToProvider();
166
162
  }, { deep: true });
163
+ watch(() => unselectedRows.value, (newVal) => {
164
+ emit?.("update:unselectedRows", newVal || []);
165
+ }, { deep: true });
166
+ watch(() => selectAllScope.value, (newVal) => {
167
+ emit?.("update:selectAllScope", newVal);
168
+ });
167
169
  return {
168
170
  selectedRows,
169
171
  selectAll,
172
+ selectAllScope,
173
+ unselectedRows,
170
174
  currentPage: dpCurrentPage,
171
175
  pageSize: dpPageSize,
172
176
  sortList: dpSortList,
@@ -135,8 +135,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
135
135
  placeholder: string;
136
136
  teleportTo: string;
137
137
  showClear: boolean;
138
- align: "left" | "right" | undefined;
139
138
  format: string;
139
+ align: "left" | "right" | undefined;
140
140
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
141
141
  declare const _default: typeof __VLS_export;
142
142
  export default _default;
@@ -135,8 +135,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
135
135
  placeholder: string;
136
136
  teleportTo: string;
137
137
  showClear: boolean;
138
- align: "left" | "right" | undefined;
139
138
  format: string;
139
+ align: "left" | "right" | undefined;
140
140
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
141
141
  declare const _default: typeof __VLS_export;
142
142
  export default _default;
@@ -1,5 +1,4 @@
1
1
  import { computed, isRef, ref } from "vue";
2
- import { useDataProvider } from "../../composables/useDataProvider.js";
3
2
  export const KGanttDefaultProps = {
4
3
  dataProvider: {
5
4
  type: Object,
@@ -189,9 +188,8 @@ export function useKGanttLogic(props) {
189
188
  };
190
189
  }
191
190
  };
192
- const dpBridge = props.dataProvider ? useDataProvider(props.dataProvider) : null;
193
- const selectedRows = isRef(props.dataProvider?.selectedRows) ? props.dataProvider.selectedRows : dpBridge?.selectedRows ?? ref([]);
194
- const selectAll = isRef(props.dataProvider?.selectAll) ? props.dataProvider.selectAll : dpBridge?.selectAll ?? ref(false);
191
+ const selectedRows = isRef(props.dataProvider?.selectedRows) ? props.dataProvider.selectedRows : ref([]);
192
+ const selectAll = isRef(props.dataProvider?.selectAll) ? props.dataProvider.selectAll : ref(false);
195
193
  return {
196
194
  globalDateRange,
197
195
  totalDuration,
@@ -71,6 +71,7 @@ function getMaskPatternDef(mask, position) {
71
71
  const char = mask[position];
72
72
  switch (char) {
73
73
  case "9":
74
+ case "#":
74
75
  return { pattern: /[0-9]/, length: 1 };
75
76
  case "A":
76
77
  return {
@@ -100,6 +101,7 @@ function getPatternLength(mask, position) {
100
101
  return def ? def.length : 1;
101
102
  }
102
103
  export function applyMask(rawValue, mask) {
104
+ if (!rawValue) return "";
103
105
  let result = "";
104
106
  let valueIndex = 0;
105
107
  let maskIndex = 0;
@@ -18,7 +18,7 @@ const templateProps = computed(() => ({
18
18
  </script>
19
19
 
20
20
  <template lang="pug">
21
- component(:is="presetComponent" v-bind="templateProps" v-model="model")
21
+ component(:is="presetComponent" v-bind="{ ...templateProps, ...$attrs }" v-model="model")
22
22
  template(v-for="(_, slot) in $slots" #[slot]="scope")
23
23
  slot(:name="slot" v-bind="scope")
24
24
  </template>
@@ -46,7 +46,7 @@ const handleUpdateMax = (val) => {
46
46
  <template lang="pug">
47
47
  component(
48
48
  :is="presetComponent"
49
- v-bind="templateProps"
49
+ v-bind="{ ...templateProps, ...$attrs }"
50
50
  @update:minValue="handleUpdateMin"
51
51
  @update:maxValue="handleUpdateMax"
52
52
  )
@@ -32,7 +32,7 @@ const handleUpdateValue = (val) => {
32
32
  </script>
33
33
 
34
34
  <template lang="pug">
35
- component(:is="presetComponent" v-bind="templateProps" @update:value="handleUpdateValue")
35
+ component(:is="presetComponent" v-bind="{ ...templateProps, ...$attrs }" @update:value="handleUpdateValue")
36
36
  template(v-for="(_, slot) in $slots" #[slot]="scope")
37
37
  slot(:name="slot" v-bind="scope")
38
38
  </template>
@@ -18,5 +18,5 @@ const templateProps = computed(() => ({
18
18
  </script>
19
19
 
20
20
  <template lang="pug">
21
- component(:is="presetComponent" v-bind="templateProps" @update:text="text = $event")
21
+ component(:is="presetComponent" v-bind="{ ...templateProps, ...$attrs }" @update:text="text = $event")
22
22
  </template>
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
27
27
  }>> & Readonly<{}>, {
28
28
  disabled: boolean;
29
29
  text: string;
30
- position: "left" | "right" | "top" | "bottom";
30
+ position: "top" | "left" | "right" | "bottom";
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
32
  declare const _default: typeof __VLS_export;
33
33
  export default _default;
@@ -27,7 +27,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
27
27
  }>> & Readonly<{}>, {
28
28
  disabled: boolean;
29
29
  text: string;
30
- position: "left" | "right" | "top" | "bottom";
30
+ position: "top" | "left" | "right" | "bottom";
31
31
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
32
32
  declare const _default: typeof __VLS_export;
33
33
  export default _default;
@@ -162,8 +162,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
162
162
  viewportHeight: number;
163
163
  expandedNodes: (string | number)[] | Set<string | number>;
164
164
  iconField: string;
165
- isNodeSelected: (node: any) => boolean;
166
165
  selectable: boolean;
166
+ isNodeSelected: (node: any) => boolean;
167
167
  selectedNode: any;
168
168
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
169
169
  declare const _default: typeof __VLS_export;
@@ -23,6 +23,8 @@ const templateProps = computed(() => ({
23
23
  isNodeSelected: props.isNodeSelected,
24
24
  selectable: props.selectable,
25
25
  searchtext: props.searchtext,
26
+ modelValue: props.modelValue,
27
+ selectedNode: props.selectedNode,
26
28
  toggleNode,
27
29
  selectNode,
28
30
  dataProvider: props.dataProvider,
@@ -162,8 +162,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
162
162
  viewportHeight: number;
163
163
  expandedNodes: (string | number)[] | Set<string | number>;
164
164
  iconField: string;
165
- isNodeSelected: (node: any) => boolean;
166
165
  selectable: boolean;
166
+ isNodeSelected: (node: any) => boolean;
167
167
  selectedNode: any;
168
168
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
169
169
  declare const _default: typeof __VLS_export;