@katlux/toolkit 0.1.1-alpha.100 → 0.1.1-alpha.108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/compiled/composables/useDataProvider.mjs +140 -0
- package/dist/compiled/composables/useDataProvider.spec.mjs +86 -0
- package/dist/compiled/composables/useDebounce.mjs +3 -11
- package/dist/compiled/composables/useFilterLogic.mjs +23 -169
- package/dist/compiled/composables/usePresetComponent.mjs +62 -38
- package/dist/compiled/composables/usePresetComponent.spec.mjs +106 -0
- package/dist/compiled/composables/useRequestProvider.mjs +9 -0
- package/dist/compiled/composables/useSortLogic.mjs +3 -55
- package/dist/compiled/composables/useTemplate.spec.mjs +30 -0
- package/dist/compiled/composables/useUnregisterProvider.mjs +4 -0
- package/dist/compiled/utils/PresetResolver.mjs +1 -1
- package/dist/compiled/utils/TemplateResolver.mjs +32 -0
- package/dist/module.cjs +1 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/components/KAlert/KAlert.global.d.vue.ts +2 -0
- package/dist/runtime/components/KAlert/KAlert.global.vue +3 -1
- package/dist/runtime/components/KAlert/KAlert.global.vue.d.ts +2 -0
- package/dist/runtime/components/KAlert/KAlert.logic.d.ts +4 -2
- package/dist/runtime/components/KAlert/KAlert.logic.js +12 -6
- package/dist/runtime/components/KCalendar/KCalendar.logic.js +13 -6
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.d.vue.ts +13 -13
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue.d.ts +13 -13
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +6 -5
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +4 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCheckbox/KCheckbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.d.vue.ts +3 -3
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +3 -3
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +2 -2
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +6 -9
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +1 -1
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue +0 -1
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +1 -1
- package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +2 -2
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +1 -1
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -2
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +45 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +5 -5
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +5 -5
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +5 -5
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +5 -5
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.d.ts +2 -2
- package/dist/runtime/components/KDropdown/KDropdown.global.d.vue.ts +1 -1
- package/dist/runtime/components/KDropdown/KDropdown.global.vue.d.ts +1 -1
- package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +8 -8
- package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +8 -8
- package/dist/runtime/components/KGantt/KGantt.logic.d.ts +4 -4
- package/dist/runtime/components/KGantt/KGantt.logic.js +21 -25
- package/dist/runtime/components/KGrid/KGrid.global.d.vue.ts +1 -1
- package/dist/runtime/components/KGrid/KGrid.global.vue.d.ts +1 -1
- package/dist/runtime/components/KGrid/KGrid.logic.d.ts +1 -0
- package/dist/runtime/components/KHourPicker/KHourPicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KHourPicker/KHourPicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KIcon/KIcon.logic.d.ts +14 -0
- package/dist/runtime/components/KIcon/KIcon.logic.js +74 -17
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KMaskTextbox/KMaskTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KRadiobox/KRadiobox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextarea/KTextarea.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTextbox/KTextbox.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTreePicker/KTreePicker.logic.d.ts +1 -1
- package/dist/runtime/components/MultiTabs/MultiTabs.logic.d.ts +1 -1
- package/dist/runtime/components/MultiTabs/MultiTabs.logic.js +25 -14
- package/dist/runtime/composables/useDataProvider.d.ts +37 -0
- package/dist/runtime/composables/useDataProvider.js +140 -0
- package/dist/runtime/composables/useDebounce.d.ts +2 -6
- package/dist/runtime/composables/useDebounce.js +3 -11
- package/dist/runtime/composables/useFilterLogic.d.ts +5 -4
- package/dist/runtime/composables/useFilterLogic.js +23 -169
- package/dist/runtime/composables/usePresetComponent.d.ts +14 -3
- package/dist/runtime/composables/usePresetComponent.js +62 -38
- package/dist/runtime/composables/useRequestProvider.d.ts +23 -0
- package/dist/runtime/composables/useRequestProvider.js +9 -0
- package/dist/runtime/composables/useSortLogic.d.ts +3 -2
- package/dist/runtime/composables/useSortLogic.js +3 -55
- package/dist/runtime/composables/useTemplate.d.ts +1 -1
- package/dist/runtime/composables/useTemplate.js +1 -1
- package/dist/runtime/composables/useUnregisterProvider.d.ts +25 -0
- package/dist/runtime/composables/useUnregisterProvider.js +4 -0
- package/dist/runtime/plugins/nuxtCompatPlugin.d.ts +9 -0
- package/dist/runtime/plugins/nuxtCompatPlugin.js +11 -0
- package/dist/runtime/presets/default/assets/scss/css-variables.css +2 -0
- package/dist/runtime/presets/default/assets/scss/css-variables.scss +2 -0
- package/dist/runtime/presets/default/assets/scss/index.css +2 -0
- package/dist/runtime/presets/default/components/KAlert/KAlert.d.vue.ts +1 -1
- package/dist/runtime/presets/default/components/KAlert/KAlert.vue +16 -9
- package/dist/runtime/presets/default/components/KAlert/KAlert.vue.d.ts +1 -1
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +1 -1
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +45 -3
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +22 -4
- package/dist/runtime/presets/default/components/KDropdown/KDropdown.vue +28 -2
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +11 -2
- package/dist/runtime/presets/default/components/KLoader/KLoader.vue +1 -1
- package/dist/runtime/utils/PresetResolver.js +1 -1
- package/dist/runtime/utils/TemplateResolver.d.ts +14 -0
- package/dist/runtime/utils/TemplateResolver.js +32 -0
- package/package.json +1 -1
- package/dist/runtime/components/KThree/KThree.global.d.vue.ts +0 -3
- package/dist/runtime/components/KThree/KThree.global.vue +0 -7
- package/dist/runtime/components/KThree/KThree.global.vue.d.ts +0 -3
|
@@ -11,6 +11,8 @@ export declare const KDatatableDefaultProps: {
|
|
|
11
11
|
emptyFilterStateText: string;
|
|
12
12
|
};
|
|
13
13
|
export declare function useKDatatableLogic(props: KDatatableProps): {
|
|
14
|
-
selectedRows: import("
|
|
15
|
-
selectAll: import("
|
|
14
|
+
selectedRows: import("@katlux/providers").CompatRef<any[]>;
|
|
15
|
+
selectAll: import("@katlux/providers").CompatRef<boolean>;
|
|
16
|
+
getRowKey: (row: any, index: number) => string | number;
|
|
17
|
+
pageData: import("vue").Ref<import("@katlux/providers").TDataRow[], import("@katlux/providers").TDataRow[]>;
|
|
16
18
|
};
|
|
@@ -1,21 +1,60 @@
|
|
|
1
1
|
import { watch } from "vue";
|
|
2
|
+
import { useDataProvider } from "../../composables/useDataProvider.js";
|
|
2
3
|
export const KDatatableDefaultProps = {
|
|
3
4
|
visibleFields: null,
|
|
4
5
|
emptyStateText: "no result",
|
|
5
6
|
emptyFilterStateText: "no result found for filter"
|
|
6
7
|
};
|
|
7
8
|
export function useKDatatableLogic(props) {
|
|
8
|
-
const selectedRows = props.dataProvider
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const { pageData, selectedRows: dpSelectedRows, selectAll: dpSelectAll } = useDataProvider(props.dataProvider);
|
|
10
|
+
const selectedRows = props.dataProvider?.selectedRows || dpSelectedRows;
|
|
11
|
+
const selectAll = props.dataProvider?.selectAll || dpSelectAll;
|
|
12
|
+
const idKey = props.dataProvider?.idKey || "id";
|
|
13
|
+
const getRowId = (row) => row?.[idKey] ?? row?.id ?? row;
|
|
14
|
+
const getRowKey = (row, index) => {
|
|
15
|
+
if (row && row[idKey] !== void 0 && row[idKey] !== null) {
|
|
16
|
+
return row[idKey];
|
|
17
|
+
}
|
|
18
|
+
if (row && row.id !== void 0 && row.id !== null) {
|
|
19
|
+
return row.id;
|
|
20
|
+
}
|
|
21
|
+
if (row && row._id !== void 0 && row._id !== null) {
|
|
22
|
+
return row._id;
|
|
23
|
+
}
|
|
24
|
+
return index;
|
|
25
|
+
};
|
|
26
|
+
let isInternalUpdating = false;
|
|
27
|
+
const getPageRows = () => (props.dataProvider?.pageData?.value ?? props.dataProvider?.pageData ?? pageData.value) || [];
|
|
28
|
+
watch(() => selectAll.value, (newVal) => {
|
|
29
|
+
if (isInternalUpdating) return;
|
|
30
|
+
const currentRows = getPageRows();
|
|
11
31
|
if (newVal === false) {
|
|
12
|
-
|
|
32
|
+
const pageIds = new Set(currentRows.map(getRowId));
|
|
33
|
+
selectedRows.value = selectedRows.value.filter((r) => !pageIds.has(getRowId(r)));
|
|
13
34
|
} else {
|
|
14
|
-
|
|
35
|
+
const currentSelectedIds = new Set(selectedRows.value.map(getRowId));
|
|
36
|
+
const newSelections = currentRows.filter((r) => !currentSelectedIds.has(getRowId(r)));
|
|
37
|
+
selectedRows.value = [...selectedRows.value, ...newSelections];
|
|
15
38
|
}
|
|
16
39
|
});
|
|
40
|
+
watch([getPageRows, () => selectedRows.value], () => {
|
|
41
|
+
const currentRows = getPageRows();
|
|
42
|
+
if (currentRows.length === 0) {
|
|
43
|
+
isInternalUpdating = true;
|
|
44
|
+
selectAll.value = false;
|
|
45
|
+
isInternalUpdating = false;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const selectedIds = new Set(selectedRows.value.map(getRowId));
|
|
49
|
+
const allCurrentSelected = currentRows.every((r) => selectedIds.has(getRowId(r)));
|
|
50
|
+
isInternalUpdating = true;
|
|
51
|
+
selectAll.value = allCurrentSelected;
|
|
52
|
+
isInternalUpdating = false;
|
|
53
|
+
}, { immediate: true });
|
|
17
54
|
return {
|
|
18
55
|
selectedRows,
|
|
19
|
-
selectAll
|
|
56
|
+
selectAll,
|
|
57
|
+
getRowKey,
|
|
58
|
+
pageData
|
|
20
59
|
};
|
|
21
60
|
}
|
|
@@ -9,11 +9,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
9
9
|
default: string;
|
|
10
10
|
};
|
|
11
11
|
day: {
|
|
12
|
-
type: (
|
|
12
|
+
type: (DateConstructor | StringConstructor)[];
|
|
13
13
|
default: undefined;
|
|
14
14
|
};
|
|
15
15
|
modelValue: {
|
|
16
|
-
type: (
|
|
16
|
+
type: (DateConstructor | StringConstructor)[];
|
|
17
17
|
default: undefined;
|
|
18
18
|
};
|
|
19
19
|
isOpen: {
|
|
@@ -69,11 +69,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
69
|
default: string;
|
|
70
70
|
};
|
|
71
71
|
day: {
|
|
72
|
-
type: (
|
|
72
|
+
type: (DateConstructor | StringConstructor)[];
|
|
73
73
|
default: undefined;
|
|
74
74
|
};
|
|
75
75
|
modelValue: {
|
|
76
|
-
type: (
|
|
76
|
+
type: (DateConstructor | StringConstructor)[];
|
|
77
77
|
default: undefined;
|
|
78
78
|
};
|
|
79
79
|
isOpen: {
|
|
@@ -123,7 +123,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
123
123
|
isOpen: boolean;
|
|
124
124
|
label: string;
|
|
125
125
|
day: string | Date;
|
|
126
|
-
validation: "
|
|
126
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
127
127
|
validationText: string;
|
|
128
128
|
modelValue: string | Date;
|
|
129
129
|
placeholder: string;
|
|
@@ -9,11 +9,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
9
9
|
default: string;
|
|
10
10
|
};
|
|
11
11
|
day: {
|
|
12
|
-
type: (
|
|
12
|
+
type: (DateConstructor | StringConstructor)[];
|
|
13
13
|
default: undefined;
|
|
14
14
|
};
|
|
15
15
|
modelValue: {
|
|
16
|
-
type: (
|
|
16
|
+
type: (DateConstructor | StringConstructor)[];
|
|
17
17
|
default: undefined;
|
|
18
18
|
};
|
|
19
19
|
isOpen: {
|
|
@@ -69,11 +69,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
69
69
|
default: string;
|
|
70
70
|
};
|
|
71
71
|
day: {
|
|
72
|
-
type: (
|
|
72
|
+
type: (DateConstructor | StringConstructor)[];
|
|
73
73
|
default: undefined;
|
|
74
74
|
};
|
|
75
75
|
modelValue: {
|
|
76
|
-
type: (
|
|
76
|
+
type: (DateConstructor | StringConstructor)[];
|
|
77
77
|
default: undefined;
|
|
78
78
|
};
|
|
79
79
|
isOpen: {
|
|
@@ -123,7 +123,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
123
123
|
isOpen: boolean;
|
|
124
124
|
label: string;
|
|
125
125
|
day: string | Date;
|
|
126
|
-
validation: "
|
|
126
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
127
127
|
validationText: string;
|
|
128
128
|
modelValue: string | Date;
|
|
129
129
|
placeholder: string;
|
|
@@ -25,11 +25,11 @@ export declare const KDatePickerDefaultProps: {
|
|
|
25
25
|
default: string;
|
|
26
26
|
};
|
|
27
27
|
day: {
|
|
28
|
-
type: (
|
|
28
|
+
type: (DateConstructor | StringConstructor)[];
|
|
29
29
|
default: undefined;
|
|
30
30
|
};
|
|
31
31
|
modelValue: {
|
|
32
|
-
type: (
|
|
32
|
+
type: (DateConstructor | StringConstructor)[];
|
|
33
33
|
default: undefined;
|
|
34
34
|
};
|
|
35
35
|
isOpen: {
|
|
@@ -13,11 +13,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
13
13
|
default: string;
|
|
14
14
|
};
|
|
15
15
|
day: {
|
|
16
|
-
type: (
|
|
16
|
+
type: (DateConstructor | StringConstructor)[];
|
|
17
17
|
default: undefined;
|
|
18
18
|
};
|
|
19
19
|
modelValue: {
|
|
20
|
-
type: (
|
|
20
|
+
type: (DateConstructor | StringConstructor)[];
|
|
21
21
|
default: undefined;
|
|
22
22
|
};
|
|
23
23
|
isOpen: {
|
|
@@ -76,11 +76,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
76
76
|
default: string;
|
|
77
77
|
};
|
|
78
78
|
day: {
|
|
79
|
-
type: (
|
|
79
|
+
type: (DateConstructor | StringConstructor)[];
|
|
80
80
|
default: undefined;
|
|
81
81
|
};
|
|
82
82
|
modelValue: {
|
|
83
|
-
type: (
|
|
83
|
+
type: (DateConstructor | StringConstructor)[];
|
|
84
84
|
default: undefined;
|
|
85
85
|
};
|
|
86
86
|
isOpen: {
|
|
@@ -129,7 +129,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
129
129
|
isOpen: boolean;
|
|
130
130
|
label: string;
|
|
131
131
|
day: string | Date;
|
|
132
|
-
validation: "
|
|
132
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
133
133
|
validationText: string;
|
|
134
134
|
modelValue: string | Date;
|
|
135
135
|
placeholder: string;
|
|
@@ -13,11 +13,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
13
13
|
default: string;
|
|
14
14
|
};
|
|
15
15
|
day: {
|
|
16
|
-
type: (
|
|
16
|
+
type: (DateConstructor | StringConstructor)[];
|
|
17
17
|
default: undefined;
|
|
18
18
|
};
|
|
19
19
|
modelValue: {
|
|
20
|
-
type: (
|
|
20
|
+
type: (DateConstructor | StringConstructor)[];
|
|
21
21
|
default: undefined;
|
|
22
22
|
};
|
|
23
23
|
isOpen: {
|
|
@@ -76,11 +76,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
76
76
|
default: string;
|
|
77
77
|
};
|
|
78
78
|
day: {
|
|
79
|
-
type: (
|
|
79
|
+
type: (DateConstructor | StringConstructor)[];
|
|
80
80
|
default: undefined;
|
|
81
81
|
};
|
|
82
82
|
modelValue: {
|
|
83
|
-
type: (
|
|
83
|
+
type: (DateConstructor | StringConstructor)[];
|
|
84
84
|
default: undefined;
|
|
85
85
|
};
|
|
86
86
|
isOpen: {
|
|
@@ -129,7 +129,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
129
129
|
isOpen: boolean;
|
|
130
130
|
label: string;
|
|
131
131
|
day: string | Date;
|
|
132
|
-
validation: "
|
|
132
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
133
133
|
validationText: string;
|
|
134
134
|
modelValue: string | Date;
|
|
135
135
|
placeholder: string;
|
|
@@ -30,11 +30,11 @@ export declare const KDateTimePickerDefaultProps: {
|
|
|
30
30
|
default: string;
|
|
31
31
|
};
|
|
32
32
|
day: {
|
|
33
|
-
type: (
|
|
33
|
+
type: (DateConstructor | StringConstructor)[];
|
|
34
34
|
default: undefined;
|
|
35
35
|
};
|
|
36
36
|
modelValue: {
|
|
37
|
-
type: (
|
|
37
|
+
type: (DateConstructor | StringConstructor)[];
|
|
38
38
|
default: undefined;
|
|
39
39
|
};
|
|
40
40
|
isOpen: {
|
|
@@ -54,11 +54,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
54
54
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
55
55
|
}>, {
|
|
56
56
|
isOpen: boolean;
|
|
57
|
+
direction: import("./KDropdown.logic.js").KDropdownDirection;
|
|
57
58
|
teleportTo: string;
|
|
58
59
|
fullWidth: boolean;
|
|
59
60
|
align: import("./KDropdown.logic.js").KDropdownAlign;
|
|
60
61
|
anchorEl: HTMLElement;
|
|
61
|
-
direction: import("./KDropdown.logic.js").KDropdownDirection;
|
|
62
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
63
63
|
declare const _default: typeof __VLS_export;
|
|
64
64
|
export default _default;
|
|
@@ -54,11 +54,11 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
54
54
|
"onUpdate:isOpen"?: ((value: boolean) => any) | undefined;
|
|
55
55
|
}>, {
|
|
56
56
|
isOpen: boolean;
|
|
57
|
+
direction: import("./KDropdown.logic.js").KDropdownDirection;
|
|
57
58
|
teleportTo: string;
|
|
58
59
|
fullWidth: boolean;
|
|
59
60
|
align: import("./KDropdown.logic.js").KDropdownAlign;
|
|
60
61
|
anchorEl: HTMLElement;
|
|
61
|
-
direction: import("./KDropdown.logic.js").KDropdownDirection;
|
|
62
62
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
63
63
|
declare const _default: typeof __VLS_export;
|
|
64
64
|
export default _default;
|
|
@@ -20,19 +20,19 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
20
20
|
default: () => never[];
|
|
21
21
|
};
|
|
22
22
|
startDate: {
|
|
23
|
-
type: (
|
|
23
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
24
24
|
default: null;
|
|
25
25
|
};
|
|
26
26
|
endDate: {
|
|
27
|
-
type: (
|
|
27
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
28
28
|
default: null;
|
|
29
29
|
};
|
|
30
30
|
startingPoint: {
|
|
31
|
-
type: (
|
|
31
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
32
32
|
default: null;
|
|
33
33
|
};
|
|
34
34
|
endingPoint: {
|
|
35
|
-
type: (
|
|
35
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
36
36
|
default: null;
|
|
37
37
|
};
|
|
38
38
|
taskMapping: {
|
|
@@ -98,19 +98,19 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
98
98
|
default: () => never[];
|
|
99
99
|
};
|
|
100
100
|
startDate: {
|
|
101
|
-
type: (
|
|
101
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
102
102
|
default: null;
|
|
103
103
|
};
|
|
104
104
|
endDate: {
|
|
105
|
-
type: (
|
|
105
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
106
106
|
default: null;
|
|
107
107
|
};
|
|
108
108
|
startingPoint: {
|
|
109
|
-
type: (
|
|
109
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
110
110
|
default: null;
|
|
111
111
|
};
|
|
112
112
|
endingPoint: {
|
|
113
|
-
type: (
|
|
113
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
114
114
|
default: null;
|
|
115
115
|
};
|
|
116
116
|
taskMapping: {
|
|
@@ -20,19 +20,19 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
20
20
|
default: () => never[];
|
|
21
21
|
};
|
|
22
22
|
startDate: {
|
|
23
|
-
type: (
|
|
23
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
24
24
|
default: null;
|
|
25
25
|
};
|
|
26
26
|
endDate: {
|
|
27
|
-
type: (
|
|
27
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
28
28
|
default: null;
|
|
29
29
|
};
|
|
30
30
|
startingPoint: {
|
|
31
|
-
type: (
|
|
31
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
32
32
|
default: null;
|
|
33
33
|
};
|
|
34
34
|
endingPoint: {
|
|
35
|
-
type: (
|
|
35
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
36
36
|
default: null;
|
|
37
37
|
};
|
|
38
38
|
taskMapping: {
|
|
@@ -98,19 +98,19 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
98
98
|
default: () => never[];
|
|
99
99
|
};
|
|
100
100
|
startDate: {
|
|
101
|
-
type: (
|
|
101
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
102
102
|
default: null;
|
|
103
103
|
};
|
|
104
104
|
endDate: {
|
|
105
|
-
type: (
|
|
105
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
106
106
|
default: null;
|
|
107
107
|
};
|
|
108
108
|
startingPoint: {
|
|
109
|
-
type: (
|
|
109
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
110
110
|
default: null;
|
|
111
111
|
};
|
|
112
112
|
endingPoint: {
|
|
113
|
-
type: (
|
|
113
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
114
114
|
default: null;
|
|
115
115
|
};
|
|
116
116
|
taskMapping: {
|
|
@@ -81,19 +81,19 @@ export declare const KGanttDefaultProps: {
|
|
|
81
81
|
default: () => never[];
|
|
82
82
|
};
|
|
83
83
|
startDate: {
|
|
84
|
-
type: (
|
|
84
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
85
85
|
default: null;
|
|
86
86
|
};
|
|
87
87
|
endDate: {
|
|
88
|
-
type: (
|
|
88
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
89
89
|
default: null;
|
|
90
90
|
};
|
|
91
91
|
startingPoint: {
|
|
92
|
-
type: (
|
|
92
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
93
93
|
default: null;
|
|
94
94
|
};
|
|
95
95
|
endingPoint: {
|
|
96
|
-
type: (
|
|
96
|
+
type: (DateConstructor | StringConstructor | NumberConstructor)[];
|
|
97
97
|
default: null;
|
|
98
98
|
};
|
|
99
99
|
taskMapping: {
|
|
@@ -80,8 +80,9 @@ export const KGanttDefaultProps = {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
export function useKGanttLogic(props) {
|
|
83
|
+
const baseNow = Date.now();
|
|
83
84
|
const globalDateRange = computed(() => {
|
|
84
|
-
const now =
|
|
85
|
+
const now = baseNow;
|
|
85
86
|
const msInDay = 24 * 60 * 60 * 1e3;
|
|
86
87
|
const start = props.startingPoint !== null && props.startingPoint !== void 0 ? props.startingPoint : props.startDate;
|
|
87
88
|
const end = props.endingPoint !== null && props.endingPoint !== void 0 ? props.endingPoint : props.endDate;
|
|
@@ -104,27 +105,20 @@ export function useKGanttLogic(props) {
|
|
|
104
105
|
...props.taskMapping || {}
|
|
105
106
|
}));
|
|
106
107
|
const getTasksForRow = (row) => {
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
if (!row) return [];
|
|
109
|
+
const field = resolvedMapping.value.tasksField || "tasks";
|
|
110
|
+
return row[field] || [];
|
|
109
111
|
};
|
|
110
112
|
const getTaskStyle = (task) => {
|
|
111
113
|
const m = resolvedMapping.value;
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const tStart = toMs(taskStartVal);
|
|
121
|
-
const tEnd = toMs(taskEndVal);
|
|
122
|
-
if (isNaN(tStart) || isNaN(tEnd)) return { display: "none" };
|
|
123
|
-
const gStart = globalDateRange.value.start;
|
|
124
|
-
const duration = totalDuration.value;
|
|
125
|
-
if (duration <= 0) return { display: "none" };
|
|
126
|
-
let leftPct = (tStart - gStart) / duration * 100;
|
|
127
|
-
let widthPct = (tEnd - tStart) / duration * 100;
|
|
114
|
+
const isDate = props.mode === "date";
|
|
115
|
+
const startMs = isDate ? new Date(task[m.startDate]).getTime() : Number(task[m.startDate]);
|
|
116
|
+
const endMs = isDate ? new Date(task[m.endDate]).getTime() : Number(task[m.endDate]);
|
|
117
|
+
const rangeStart = globalDateRange.value.start;
|
|
118
|
+
const totalMs = totalDuration.value;
|
|
119
|
+
if (totalMs <= 0) return { display: "none" };
|
|
120
|
+
let leftPct = (startMs - rangeStart) / totalMs * 100;
|
|
121
|
+
let widthPct = (endMs - startMs) / totalMs * 100;
|
|
128
122
|
if (leftPct < 0) {
|
|
129
123
|
widthPct += leftPct;
|
|
130
124
|
leftPct = 0;
|
|
@@ -141,20 +135,22 @@ export function useKGanttLogic(props) {
|
|
|
141
135
|
};
|
|
142
136
|
const moveTime = (delta, startingPoint, endingPoint) => {
|
|
143
137
|
const isDate = props.mode === "date";
|
|
138
|
+
const currentStart = startingPoint !== null && startingPoint !== void 0 ? isDate ? new Date(startingPoint).getTime() : Number(startingPoint) : globalDateRange.value.start;
|
|
139
|
+
const currentEnd = endingPoint !== null && endingPoint !== void 0 ? isDate ? new Date(endingPoint).getTime() : Number(endingPoint) : globalDateRange.value.end;
|
|
144
140
|
if (isDate) {
|
|
145
|
-
const newStart = new Date(
|
|
146
|
-
const newEnd = new Date(
|
|
141
|
+
const newStart = new Date(currentStart + delta).toISOString();
|
|
142
|
+
const newEnd = new Date(currentEnd + delta).toISOString();
|
|
147
143
|
return { startingPoint: newStart, endingPoint: newEnd };
|
|
148
144
|
} else {
|
|
149
|
-
const newStart =
|
|
150
|
-
const newEnd =
|
|
145
|
+
const newStart = currentStart + delta;
|
|
146
|
+
const newEnd = currentEnd + delta;
|
|
151
147
|
return { startingPoint: newStart, endingPoint: newEnd };
|
|
152
148
|
}
|
|
153
149
|
};
|
|
154
150
|
const zoom = (factor, startingPoint, endingPoint) => {
|
|
155
151
|
const isDate = props.mode === "date";
|
|
156
|
-
const start = isDate ? new Date(startingPoint).getTime() : Number(startingPoint);
|
|
157
|
-
const end = isDate ? new Date(endingPoint).getTime() : Number(endingPoint);
|
|
152
|
+
const start = startingPoint !== null && startingPoint !== void 0 ? isDate ? new Date(startingPoint).getTime() : Number(startingPoint) : globalDateRange.value.start;
|
|
153
|
+
const end = endingPoint !== null && endingPoint !== void 0 ? isDate ? new Date(endingPoint).getTime() : Number(endingPoint) : globalDateRange.value.end;
|
|
158
154
|
const duration = end - start;
|
|
159
155
|
const change = duration * factor;
|
|
160
156
|
const newStart = start + change;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type KGridProps } from './KGrid.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<KGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KGridProps> & Readonly<{}>, {
|
|
3
|
+
direction: "row" | "column";
|
|
3
4
|
noGap: boolean;
|
|
4
5
|
align: "start" | "center" | "end" | "stretch" | "baseline";
|
|
5
|
-
direction: "row" | "column";
|
|
6
6
|
wrap: "wrap" | "nowrap";
|
|
7
7
|
flexChild: boolean;
|
|
8
8
|
justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type KGridProps } from './KGrid.logic.js';
|
|
2
2
|
declare const __VLS_export: import("vue").DefineComponent<KGridProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<KGridProps> & Readonly<{}>, {
|
|
3
|
+
direction: "row" | "column";
|
|
3
4
|
noGap: boolean;
|
|
4
5
|
align: "start" | "center" | "end" | "stretch" | "baseline";
|
|
5
|
-
direction: "row" | "column";
|
|
6
6
|
wrap: "wrap" | "nowrap";
|
|
7
7
|
flexChild: boolean;
|
|
8
8
|
justify: "start" | "center" | "end" | "space-between" | "around" | "evenly";
|
|
@@ -109,7 +109,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
109
109
|
isOpen: boolean;
|
|
110
110
|
label: string;
|
|
111
111
|
disabled: boolean;
|
|
112
|
-
validation: "
|
|
112
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
113
113
|
validationText: string;
|
|
114
114
|
modelValue: string;
|
|
115
115
|
placeholder: string;
|
|
@@ -109,7 +109,7 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
109
109
|
isOpen: boolean;
|
|
110
110
|
label: string;
|
|
111
111
|
disabled: boolean;
|
|
112
|
-
validation: "
|
|
112
|
+
validation: "error" | "success" | "warning" | null | undefined;
|
|
113
113
|
validationText: string;
|
|
114
114
|
modelValue: string;
|
|
115
115
|
placeholder: string;
|
|
@@ -22,6 +22,20 @@ export declare const KIconDefaultProps: {
|
|
|
22
22
|
default: number;
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Register a custom SVG icon or dynamic loader.
|
|
27
|
+
* Allows tenant themes, packages, or apps to register custom iconography.
|
|
28
|
+
*/
|
|
29
|
+
export declare function registerSvgIcon(name: string, svgOrLoader: string | (() => Promise<string>)): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get an SVG string directly from the in-memory cache if available.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getCachedSvgIcon(name: string): string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Clear the SVG cache (primarily for test environments).
|
|
36
|
+
*/
|
|
37
|
+
export declare function clearSvgCache(): void;
|
|
38
|
+
export declare function formatIconSize(val: number | string | undefined): string | undefined;
|
|
25
39
|
export declare function useKIconLogic(props: KIconProps): {
|
|
26
40
|
widthPx: import("vue").ComputedRef<string | undefined>;
|
|
27
41
|
heightPx: import("vue").ComputedRef<string>;
|