@katlux/toolkit 0.1.1-alpha.145 → 0.1.1-alpha.146
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/bin/ai-init.mjs +517 -0
- package/bin/ai-tokens.mjs +212 -54
- package/bin/cli.mjs +76 -47
- package/bin/create-preset.mjs +1 -0
- package/bin/preset-contracts.json +2941 -0
- package/dist/compiled/composables/locales.mjs +204 -25
- package/dist/compiled/composables/useDataProvider.mjs +36 -25
- package/dist/compiled/composables/useFilterLogic.mjs +10 -2
- package/dist/compiled/composables/useKatluxForm.mjs +6 -4
- package/dist/compiled/composables/useVirtualDataset.mjs +689 -0
- package/dist/compiled/composables/useVirtualScroll.mjs +29 -9
- package/dist/module.cjs +63 -77
- package/dist/module.d.cts +5 -0
- package/dist/module.d.mts +4 -1
- package/dist/module.mjs +60 -78
- package/dist/runtime/components/KBulkActions/KBulkActions.global.d.vue.ts +7 -3
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue +4 -1
- package/dist/runtime/components/KBulkActions/KBulkActions.global.vue.d.ts +7 -3
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.d.ts +4 -2
- package/dist/runtime/components/KBulkActions/KBulkActions.logic.js +70 -37
- package/dist/runtime/components/KButton/KButton.global.d.vue.ts +2 -2
- package/dist/runtime/components/KButton/KButton.global.vue.d.ts +2 -2
- package/dist/runtime/components/KButton/KButton.logic.d.ts +1 -1
- package/dist/runtime/components/KCalendar/KCalendar.global.d.vue.ts +19 -10
- package/dist/runtime/components/KCalendar/KCalendar.global.vue +7 -2
- package/dist/runtime/components/KCalendar/KCalendar.global.vue.d.ts +19 -10
- package/dist/runtime/components/KCalendar/KCalendar.logic.d.ts +14 -201
- package/dist/runtime/components/KCalendar/KCalendar.logic.js +60 -11
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.d.vue.ts +25 -5
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue +11 -1
- package/dist/runtime/components/KCalendar/KCalendarMonth.global.vue.d.ts +25 -5
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.d.ts +19 -3
- package/dist/runtime/components/KCalendar/KCalendarMonth.logic.js +115 -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 +1 -1
- package/dist/runtime/components/KCombobox/KCombobox.global.vue.d.ts +3 -3
- package/dist/runtime/components/KCombobox/KCombobox.logic.d.ts +7 -1
- package/dist/runtime/components/KCombobox/KCombobox.logic.js +1 -1
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.d.vue.ts +2 -2
- package/dist/runtime/components/KCompositeInput/KCompositeInput.global.vue.d.ts +2 -2
- package/dist/runtime/components/KContextMenu/KContextMenu.logic.js +5 -0
- package/dist/runtime/components/KDatatable/KDataIterator.global.d.vue.ts +21 -17
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue +23 -16
- package/dist/runtime/components/KDatatable/KDataIterator.global.vue.d.ts +21 -17
- package/dist/runtime/components/KDatatable/KDataIterator.logic.d.ts +13 -10
- package/dist/runtime/components/KDatatable/KDataIterator.logic.js +25 -20
- package/dist/runtime/components/KDatatable/KDatatable.global.d.vue.ts +9 -13
- package/dist/runtime/components/KDatatable/KDatatable.global.vue +6 -5
- package/dist/runtime/components/KDatatable/KDatatable.global.vue.d.ts +9 -13
- package/dist/runtime/components/KDatatable/KDatatable.logic.d.ts +4 -6
- package/dist/runtime/components/KDatatable/KDatatable.logic.js +26 -19
- package/dist/runtime/components/KDatePicker/KDatePicker.global.d.vue.ts +30 -14
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue +38 -13
- package/dist/runtime/components/KDatePicker/KDatePicker.global.vue.d.ts +30 -14
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.d.ts +28 -6
- package/dist/runtime/components/KDatePicker/KDatePicker.logic.js +197 -53
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.d.vue.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.global.vue.d.ts +2 -2
- package/dist/runtime/components/KDateTimePicker/KDateTimePicker.logic.js +2 -0
- package/dist/runtime/components/KGantt/KGantt.global.d.vue.ts +55 -6
- package/dist/runtime/components/KGantt/KGantt.global.vue +12 -3
- package/dist/runtime/components/KGantt/KGantt.global.vue.d.ts +55 -6
- package/dist/runtime/components/KGantt/KGantt.logic.d.ts +33 -5
- package/dist/runtime/components/KGantt/KGantt.logic.js +39 -6
- 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/KLoader/KLoader.global.vue +2 -0
- 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/KMultiTabs/MultiTabs.global.d.vue.ts +23 -0
- package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue +22 -0
- package/dist/runtime/components/KMultiTabs/MultiTabs.global.vue.d.ts +23 -0
- package/dist/runtime/components/KPagination/KPagination.global.d.vue.ts +3 -1
- package/dist/runtime/components/KPagination/KPagination.global.vue +2 -1
- package/dist/runtime/components/KPagination/KPagination.global.vue.d.ts +3 -1
- package/dist/runtime/components/KPagination/KPagination.logic.d.ts +1 -0
- package/dist/runtime/components/KPagination/KPagination.logic.js +57 -5
- 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/KTooltip/KTooltip.global.d.vue.ts +1 -1
- package/dist/runtime/components/KTooltip/KTooltip.global.vue.d.ts +1 -1
- package/dist/runtime/components/KTree/KTree.global.d.vue.ts +4 -4
- package/dist/runtime/components/KTree/KTree.global.vue.d.ts +4 -4
- package/dist/runtime/components/KTree/KTree.logic.d.ts +2 -2
- package/dist/runtime/components/KTree/KTree.logic.js +16 -12
- package/dist/runtime/components/KTreePicker/KTreePicker.global.d.vue.ts +5 -7
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue +1 -5
- package/dist/runtime/components/KTreePicker/KTreePicker.global.vue.d.ts +5 -7
- package/dist/runtime/components/KTreeView/KTreeView.global.d.vue.ts +39 -5
- package/dist/runtime/components/KTreeView/KTreeView.global.vue +19 -1
- package/dist/runtime/components/KTreeView/KTreeView.global.vue.d.ts +39 -5
- package/dist/runtime/components/KTreeView/KTreeView.logic.d.ts +23 -3
- package/dist/runtime/components/KTreeView/KTreeView.logic.js +76 -6
- package/dist/runtime/composables/locales.js +204 -25
- package/dist/runtime/composables/useDataProvider.d.ts +5 -3
- package/dist/runtime/composables/useDataProvider.js +36 -25
- package/dist/runtime/composables/useFilterLogic.d.ts +16 -4
- package/dist/runtime/composables/useFilterLogic.js +10 -2
- package/dist/runtime/composables/useKatluxForm.d.ts +4 -4
- package/dist/runtime/composables/useKatluxForm.js +6 -4
- package/dist/runtime/composables/useSortLogic.d.ts +1 -1
- package/dist/runtime/composables/useVirtualDataset.d.ts +121 -0
- package/dist/runtime/composables/useVirtualDataset.js +689 -0
- package/dist/runtime/composables/useVirtualScroll.d.ts +8 -4
- package/dist/runtime/composables/useVirtualScroll.js +29 -9
- package/dist/runtime/plugins/nuxtCompatPlugin.js +9 -1
- package/dist/runtime/presets/default/assets/scss/css-variables.css +3 -0
- package/dist/runtime/presets/default/assets/scss/css-variables.scss +6 -1
- package/dist/runtime/presets/default/assets/scss/index.css +3 -0
- package/dist/runtime/presets/default/assets/svg/katlux-logo.svg +7 -0
- package/dist/runtime/presets/default/assets/svg/katlux.svg +6 -0
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.d.vue.ts +3 -2
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue +31 -3
- package/dist/runtime/presets/default/components/KBulkActions/KBulkActions.vue.d.ts +3 -2
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.d.vue.ts +3 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue +6 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendar.vue.d.ts +3 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.d.vue.ts +5 -0
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue +33 -2
- package/dist/runtime/presets/default/components/KCalendar/KCalendarMonth.vue.d.ts +5 -0
- package/dist/runtime/presets/default/components/KContextMenu/KContextMenu.vue +7 -1
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.d.vue.ts +30 -8
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue +80 -164
- package/dist/runtime/presets/default/components/KDataIterator/KDataIterator.vue.d.ts +30 -8
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.d.vue.ts +16 -9
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue +99 -394
- package/dist/runtime/presets/default/components/KDatatable/KDatatable.vue.d.ts +16 -9
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.d.vue.ts +6 -0
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue +71 -4
- package/dist/runtime/presets/default/components/KDatePicker/KDatePicker.vue.d.ts +6 -0
- package/dist/runtime/presets/default/components/KGantt/KGantt.d.vue.ts +11 -12
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue +77 -14
- package/dist/runtime/presets/default/components/KGantt/KGantt.vue.d.ts +11 -12
- package/dist/runtime/presets/default/components/KGantt/KGanttTimeline.vue +1 -0
- package/dist/runtime/presets/default/components/KTree/KTree.d.vue.ts +3 -3
- package/dist/runtime/presets/default/components/KTree/KTree.vue +48 -14
- package/dist/runtime/presets/default/components/KTree/KTree.vue.d.ts +3 -3
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.d.vue.ts +11 -2
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue +14 -2
- package/dist/runtime/presets/default/components/KTreeView/KTreeView.vue.d.ts +11 -2
- package/dist/skills/KATLUX_INDEX.md +9 -6
- package/dist/skills/katlux-components/SKILL.md +2 -0
- package/dist/skills/katlux-components/components/KBulkActions.md +25 -1
- package/dist/skills/katlux-components/components/KCombobox.md +2 -2
- package/dist/skills/katlux-components/components/KDataIterator.md +12 -4
- package/dist/skills/katlux-components/components/KDatatable.md +38 -0
- package/dist/skills/katlux-components/components/KDatePicker.md +3 -1
- package/dist/skills/katlux-components/components/KGantt.md +9 -0
- package/dist/skills/katlux-components/components/KIcon.md +1 -1
- package/dist/skills/katlux-components/components/KLineChart.md +3 -0
- package/dist/skills/katlux-components/components/KProductList.md +0 -1
- package/dist/skills/katlux-components/components/KScatterChart.md +3 -0
- package/dist/skills/katlux-components/components/KTreePicker.md +2 -1
- package/dist/skills/katlux-components/components/KTreeView.md +12 -0
- package/dist/skills/katlux-config/SKILL.md +19 -8
- package/dist/skills/katlux-presets/SKILL.md +121 -1
- package/dist/skills/katlux-presets/creating-a-preset.md +67 -0
- package/dist/skills/katlux-providers/SKILL.md +7 -5
- package/dist/skills/katlux-providers/providers/ADataProvider.md +16 -9
- package/dist/skills/katlux-providers/providers/CAPIFlatClientDataProvider.md +27 -3
- package/dist/skills/katlux-providers/providers/CAPIFlatServerDataProvider.md +11 -1
- package/dist/skills/katlux-providers/providers/CFlatClientDataProvider.md +19 -4
- package/dist/skills/katlux-providers/providers/CFlatServerDataProvider.md +4 -2
- package/dist/skills/katlux-providers/providers/CTreeClientDataProvider.md +2 -2
- package/dist/skills/katlux-providers/providers/RequestProvider.md +10 -0
- package/dist/skills/katlux-providers/providers/encryption-field-level.md +63 -19
- package/dist/skills/katlux-providers/providers/encryption-key-management.md +20 -2
- package/dist/skills/katlux-providers/providers/encryption-key-pinning.md +25 -11
- package/dist/skills/katlux-providers/providers/encryption-searchable.md +218 -0
- package/dist/skills/katlux-providers/providers/encryption-symmetric.md +25 -1
- package/dist/skills/katlux-providers/providers/encryption-threat-model.md +63 -0
- package/dist/skills/katlux-providers/providers/encryption.md +26 -1
- package/dist/skills/katlux-providers/providers/types.md +3 -1
- package/dist/skills/katlux-providers/providers/useDataProvider.md +2 -1
- package/dist/skills/katlux-providers/providers/useVirtualDataset.md +154 -0
- package/dist/skills/katlux-tokens/SKILL.md +2 -1
- package/dist/types.d.mts +1 -1
- package/package.json +7 -3
- package/bin/add-ai-reference.mjs +0 -259
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
KMaskTextbox(
|
|
5
5
|
v-model="maskedModel"
|
|
6
6
|
:key="maskedModel"
|
|
7
|
-
:mask="format"
|
|
8
|
-
:placeholder="placeholder || format"
|
|
7
|
+
:mask="effectiveMask || format"
|
|
8
|
+
:placeholder="placeholder || (effectiveMask || format)"
|
|
9
9
|
@click.stop="textboxClicked"
|
|
10
10
|
:showClear="showClear"
|
|
11
11
|
@clear="onClear"
|
|
@@ -14,16 +14,38 @@
|
|
|
14
14
|
:validationText="validationText"
|
|
15
15
|
)
|
|
16
16
|
KDropdown(v-model:isOpen="calendarShow" :anchorEl="activatorRef" :teleportTo="teleportTo" :align="align")
|
|
17
|
-
|
|
17
|
+
.k-datepicker-dropdown-content(:class="{ 'is-range': range }")
|
|
18
|
+
.k-datepicker-presets(v-if="range && quickPresets && quickPresets.length > 0")
|
|
19
|
+
button.k-datepicker-preset-btn(
|
|
20
|
+
v-for="preset in quickPresets"
|
|
21
|
+
:key="preset.id"
|
|
22
|
+
type="button"
|
|
23
|
+
@click="applyQuickPreset ? applyQuickPreset(preset.id) : null"
|
|
24
|
+
) {{ t(preset.label) }}
|
|
25
|
+
.k-datepicker-calendar
|
|
26
|
+
KCalendar(
|
|
27
|
+
view="month"
|
|
28
|
+
:viewCount="viewCount || 1"
|
|
29
|
+
:day="calendarDay"
|
|
30
|
+
:selectedDay="_date"
|
|
31
|
+
:range="range"
|
|
32
|
+
@dayClicked="dateSelected"
|
|
33
|
+
:definedDays="definedDays"
|
|
34
|
+
:markedDays="markedDays"
|
|
35
|
+
)
|
|
18
36
|
</template>
|
|
19
37
|
|
|
20
38
|
<script lang="ts" setup>
|
|
21
39
|
import { computed, watch, ref } from 'vue'
|
|
22
|
-
|
|
40
|
+
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
23
41
|
import type {
|
|
24
42
|
IMarkedDay,
|
|
25
43
|
IDefinedDay,
|
|
26
44
|
} from '#toolkit/components/KCalendar/types'
|
|
45
|
+
import type { IDatePickerQuickPreset } from '#toolkit/components/KDatePicker/KDatePicker.logic'
|
|
46
|
+
|
|
47
|
+
const { t } = useKatluxI18n()
|
|
48
|
+
const activatorRef = ref<HTMLElement | null>(null)
|
|
27
49
|
|
|
28
50
|
const props = defineProps<{
|
|
29
51
|
label?: string
|
|
@@ -32,6 +54,7 @@ const props = defineProps<{
|
|
|
32
54
|
_date: any
|
|
33
55
|
calendarDay: Date | string
|
|
34
56
|
format: string
|
|
57
|
+
effectiveMask?: string
|
|
35
58
|
showClear: boolean
|
|
36
59
|
definedDays?: IDefinedDay[]
|
|
37
60
|
markedDays?: IMarkedDay[]
|
|
@@ -43,6 +66,10 @@ const props = defineProps<{
|
|
|
43
66
|
validation?: 'success' | 'warning' | null | 'error'
|
|
44
67
|
validationText?: string
|
|
45
68
|
align?: 'left' | 'right'
|
|
69
|
+
range?: boolean
|
|
70
|
+
viewCount?: number
|
|
71
|
+
quickPresets?: IDatePickerQuickPreset[]
|
|
72
|
+
applyQuickPreset?: (id: string) => void
|
|
46
73
|
}>()
|
|
47
74
|
|
|
48
75
|
const emit = defineEmits<{
|
|
@@ -67,4 +94,44 @@ watch(() => props.maskedModel, (newVal) => {
|
|
|
67
94
|
</script>
|
|
68
95
|
|
|
69
96
|
<style lang="scss" scoped>
|
|
97
|
+
.k-datepicker-dropdown-content {
|
|
98
|
+
display: flex;
|
|
99
|
+
flex-direction: row;
|
|
100
|
+
|
|
101
|
+
&.is-range {
|
|
102
|
+
gap: var(--grid-gap, 16px);
|
|
103
|
+
padding: var(--gap-sm, 8px);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.k-datepicker-presets {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
gap: 4px;
|
|
110
|
+
border-right: 1px solid var(--border-color-light);
|
|
111
|
+
padding-right: var(--gap-sm, 8px);
|
|
112
|
+
min-width: 110px;
|
|
113
|
+
|
|
114
|
+
.k-datepicker-preset-btn {
|
|
115
|
+
background: transparent;
|
|
116
|
+
border: none;
|
|
117
|
+
padding: 6px 10px;
|
|
118
|
+
text-align: left;
|
|
119
|
+
font-size: var(--font-size-sm, 13px);
|
|
120
|
+
color: var(--font-color-primary);
|
|
121
|
+
border-radius: var(--border-radius-sm, 4px);
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
transition: all 0.2s ease;
|
|
124
|
+
white-space: nowrap;
|
|
125
|
+
|
|
126
|
+
&:hover {
|
|
127
|
+
background-color: var(--border-color-light);
|
|
128
|
+
color: var(--font-color-heading);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
&:focus-visible {
|
|
132
|
+
outline: 2px solid var(--primary-500);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
70
137
|
</style>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IMarkedDay, IDefinedDay } from '#toolkit/components/KCalendar/types';
|
|
2
|
+
import type { IDatePickerQuickPreset } from '#toolkit/components/KDatePicker/KDatePicker.logic';
|
|
2
3
|
type __VLS_Props = {
|
|
3
4
|
label?: string;
|
|
4
5
|
maskedModel: string;
|
|
@@ -6,6 +7,7 @@ type __VLS_Props = {
|
|
|
6
7
|
_date: any;
|
|
7
8
|
calendarDay: Date | string;
|
|
8
9
|
format: string;
|
|
10
|
+
effectiveMask?: string;
|
|
9
11
|
showClear: boolean;
|
|
10
12
|
definedDays?: IDefinedDay[];
|
|
11
13
|
markedDays?: IMarkedDay[];
|
|
@@ -17,6 +19,10 @@ type __VLS_Props = {
|
|
|
17
19
|
validation?: 'success' | 'warning' | null | 'error';
|
|
18
20
|
validationText?: string;
|
|
19
21
|
align?: 'left' | 'right';
|
|
22
|
+
range?: boolean;
|
|
23
|
+
viewCount?: number;
|
|
24
|
+
quickPresets?: IDatePickerQuickPreset[];
|
|
25
|
+
applyQuickPreset?: (id: string) => void;
|
|
20
26
|
};
|
|
21
27
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
22
28
|
blur: (event: FocusEvent) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ITreeViewColumn } from '#toolkit/components/KTreeView/KTreeView.logic';
|
|
2
|
-
import type { IKDatatableAction } from '@katlux/providers';
|
|
2
|
+
import type { IKDatatableAction, IDataFilter } from '@katlux/providers';
|
|
3
3
|
import type { IGanttTask } from '#toolkit/components/KGantt/KGantt.logic';
|
|
4
4
|
type __VLS_Props = {
|
|
5
5
|
dataProvider: any;
|
|
@@ -21,13 +21,16 @@ type __VLS_Props = {
|
|
|
21
21
|
taskTypeField?: string;
|
|
22
22
|
selectedRows?: any[];
|
|
23
23
|
selectAll?: boolean;
|
|
24
|
+
selectAllScope?: 'page' | 'dataset';
|
|
25
|
+
unselectedRows?: any[];
|
|
26
|
+
filter?: IDataFilter | null;
|
|
24
27
|
cellSlots?: any;
|
|
25
28
|
headerSlots?: any;
|
|
26
29
|
endingPoint?: Date | string | number;
|
|
27
30
|
mode?: 'date' | 'numeric';
|
|
28
31
|
inclusiveEndDate?: boolean;
|
|
29
32
|
virtualScroll?: boolean;
|
|
30
|
-
itemHeight?: number;
|
|
33
|
+
itemHeight?: number | ((row: any, index: number) => number);
|
|
31
34
|
viewportHeight?: number;
|
|
32
35
|
buffer?: number;
|
|
33
36
|
moveTime?: (amount: number) => void;
|
|
@@ -36,6 +39,9 @@ type __VLS_Props = {
|
|
|
36
39
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
37
40
|
"update:selectedRows": (value: any[]) => any;
|
|
38
41
|
"update:selectAll": (value: boolean) => any;
|
|
42
|
+
"update:selectAllScope": (value: "page" | "dataset") => any;
|
|
43
|
+
"update:unselectedRows": (value: any[]) => any;
|
|
44
|
+
"update:filter": (value: IDataFilter | null) => any;
|
|
39
45
|
"task-click": (payload: {
|
|
40
46
|
task: IGanttTask;
|
|
41
47
|
row: any;
|
|
@@ -51,14 +57,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
51
57
|
sourceRow: any;
|
|
52
58
|
targetRow?: any;
|
|
53
59
|
}) => any;
|
|
54
|
-
"task-change": (payload: {
|
|
55
|
-
task: IGanttTask;
|
|
56
|
-
sourceRow: any;
|
|
57
|
-
targetRow?: any;
|
|
58
|
-
}) => any;
|
|
59
60
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
60
61
|
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
61
62
|
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
63
|
+
"onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
|
|
64
|
+
"onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
|
|
65
|
+
"onUpdate:filter"?: ((value: IDataFilter | null) => any) | undefined;
|
|
62
66
|
"onTask-click"?: ((payload: {
|
|
63
67
|
task: IGanttTask;
|
|
64
68
|
row: any;
|
|
@@ -74,11 +78,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
74
78
|
sourceRow: any;
|
|
75
79
|
targetRow?: any;
|
|
76
80
|
}) => any) | undefined;
|
|
77
|
-
"onTask-change"?: ((payload: {
|
|
78
|
-
task: IGanttTask;
|
|
79
|
-
sourceRow: any;
|
|
80
|
-
targetRow?: any;
|
|
81
|
-
}) => any) | undefined;
|
|
82
81
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
83
82
|
declare const _default: typeof __VLS_export;
|
|
84
83
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.KGantt(:class="{ 'is-virtual-scroll': virtualScroll }")
|
|
2
|
+
.KGantt(ref="chartRef" :class="{ 'is-virtual-scroll': virtualScroll }")
|
|
3
3
|
.KGantt__scroll-container(
|
|
4
4
|
ref="scrollContainer"
|
|
5
5
|
@wheel="onWheel"
|
|
@@ -16,12 +16,18 @@
|
|
|
16
16
|
:headerSlots="headerSlots"
|
|
17
17
|
:selectedRows="selectedRows"
|
|
18
18
|
:selectAll="selectAll"
|
|
19
|
+
:selectAllScope="selectAllScope"
|
|
20
|
+
:unselectedRows="unselectedRows"
|
|
21
|
+
:filter="filter"
|
|
19
22
|
:virtualScroll="virtualScroll"
|
|
20
23
|
:itemHeight="itemHeight"
|
|
21
24
|
:viewportHeight="viewportHeight"
|
|
22
25
|
:buffer="buffer"
|
|
23
26
|
@update:selectedRows="$emit('update:selectedRows', $event)"
|
|
24
27
|
@update:selectAll="$emit('update:selectAll', $event)"
|
|
28
|
+
@update:selectAllScope="$emit('update:selectAllScope', $event)"
|
|
29
|
+
@update:unselectedRows="$emit('update:unselectedRows', $event)"
|
|
30
|
+
@update:filter="$emit('update:filter', $event)"
|
|
25
31
|
)
|
|
26
32
|
template(#cell-_ganttActions="{ row }")
|
|
27
33
|
.gantt-actions
|
|
@@ -66,7 +72,7 @@ import { computed, ref, onBeforeUnmount } from 'vue'
|
|
|
66
72
|
import KGanttRuler from './KGanttRuler.vue'
|
|
67
73
|
import KGanttTimeline from './KGanttTimeline.vue'
|
|
68
74
|
import type { ITreeViewColumn } from '#toolkit/components/KTreeView/KTreeView.logic'
|
|
69
|
-
import type { IKDatatableAction } from '@katlux/providers'
|
|
75
|
+
import type { IKDatatableAction, IDataFilter } from '@katlux/providers'
|
|
70
76
|
import type { IGanttTask } from '#toolkit/components/KGantt/KGantt.logic'
|
|
71
77
|
import { getSnapMs, isTaskOverlapping, calculateGanttMinWidth } from '#toolkit/components/KGantt/KGantt.logic'
|
|
72
78
|
|
|
@@ -90,6 +96,9 @@ const props = defineProps<{
|
|
|
90
96
|
|
|
91
97
|
selectedRows?: any[]
|
|
92
98
|
selectAll?: boolean
|
|
99
|
+
selectAllScope?: 'page' | 'dataset'
|
|
100
|
+
unselectedRows?: any[]
|
|
101
|
+
filter?: IDataFilter | null
|
|
93
102
|
cellSlots?: any
|
|
94
103
|
headerSlots?: any
|
|
95
104
|
|
|
@@ -98,7 +107,7 @@ const props = defineProps<{
|
|
|
98
107
|
inclusiveEndDate?: boolean
|
|
99
108
|
|
|
100
109
|
virtualScroll?: boolean
|
|
101
|
-
itemHeight?: number
|
|
110
|
+
itemHeight?: number | ((row: any, index: number) => number)
|
|
102
111
|
viewportHeight?: number
|
|
103
112
|
buffer?: number
|
|
104
113
|
|
|
@@ -108,9 +117,11 @@ const props = defineProps<{
|
|
|
108
117
|
|
|
109
118
|
const emit = defineEmits<{
|
|
110
119
|
(e: 'update:task', payload: { task: IGanttTask; sourceRow: any; targetRow?: any }): void
|
|
111
|
-
(e: 'task-change', payload: { task: IGanttTask; sourceRow: any; targetRow?: any }): void
|
|
112
120
|
(e: 'update:selectedRows', value: any[]): void
|
|
113
121
|
(e: 'update:selectAll', value: boolean): void
|
|
122
|
+
(e: 'update:selectAllScope', value: 'page' | 'dataset'): void
|
|
123
|
+
(e: 'update:unselectedRows', value: any[]): void
|
|
124
|
+
(e: 'update:filter', value: IDataFilter | null): void
|
|
114
125
|
(e: 'task-click', payload: { task: IGanttTask; row: any }): void
|
|
115
126
|
(e: 'task-dblclick', payload: { task: IGanttTask; row: any }): void
|
|
116
127
|
(e: 'task-contextmenu', payload: any): void
|
|
@@ -121,6 +132,7 @@ const emit = defineEmits<{
|
|
|
121
132
|
interface ActiveDrag {
|
|
122
133
|
taskId: string | number
|
|
123
134
|
task: IGanttTask
|
|
135
|
+
taskElement?: HTMLElement | null
|
|
124
136
|
sourceRow: any
|
|
125
137
|
sourceRowId: string | number
|
|
126
138
|
currentHoverRow: any
|
|
@@ -136,6 +148,7 @@ interface ActiveDrag {
|
|
|
136
148
|
|
|
137
149
|
const activeDragState = ref<ActiveDrag | null>(null)
|
|
138
150
|
const scrollContainer = ref<HTMLElement | null>(null)
|
|
151
|
+
const chartRef = ref<HTMLElement | null>(null)
|
|
139
152
|
|
|
140
153
|
// ── Drag to pan state ─────────────
|
|
141
154
|
const isDraggingGantt = ref(false)
|
|
@@ -199,9 +212,12 @@ const onWheel = (e: WheelEvent) => {
|
|
|
199
212
|
}
|
|
200
213
|
|
|
201
214
|
let wasDragging = false
|
|
215
|
+
let draggedTaskIdForClick: string | number | null = null
|
|
216
|
+
let captureClickTimer: ReturnType<typeof setTimeout> | null = null
|
|
217
|
+
let activeCaptureHandler: ((e: MouseEvent) => void) | null = null
|
|
202
218
|
|
|
203
219
|
const onTaskClick = (payload: { task: IGanttTask; row: any }) => {
|
|
204
|
-
if (wasDragging) return
|
|
220
|
+
if (wasDragging && draggedTaskIdForClick !== null && payload.task?.id === draggedTaskIdForClick) return
|
|
205
221
|
emit('task-click', payload)
|
|
206
222
|
}
|
|
207
223
|
|
|
@@ -226,6 +242,7 @@ const onTaskDragStart = (
|
|
|
226
242
|
row: any
|
|
227
243
|
) => {
|
|
228
244
|
wasDragging = false
|
|
245
|
+
draggedTaskIdForClick = null
|
|
229
246
|
if (!props.editable || event.button !== 0) { return }
|
|
230
247
|
event.preventDefault()
|
|
231
248
|
|
|
@@ -236,10 +253,12 @@ const onTaskDragStart = (
|
|
|
236
253
|
const endField = props.resolvedMapping?.endDate ?? 'endDate'
|
|
237
254
|
const originalStartMs = new Date(task[startField]).getTime()
|
|
238
255
|
const originalEndMs = new Date(task[endField]).getTime()
|
|
256
|
+
const taskElement = (event.target as HTMLElement)?.closest('.gantt-bar') as HTMLElement | null
|
|
239
257
|
|
|
240
258
|
activeDragState.value = {
|
|
241
259
|
taskId: task.id,
|
|
242
260
|
task,
|
|
261
|
+
taskElement,
|
|
243
262
|
sourceRow: row,
|
|
244
263
|
sourceRowId: row?.id,
|
|
245
264
|
currentHoverRow: row,
|
|
@@ -316,18 +335,55 @@ const onMouseUp = () => {
|
|
|
316
335
|
|
|
317
336
|
if (hasMoved || wasDragging) {
|
|
318
337
|
wasDragging = true
|
|
338
|
+
draggedTaskIdForClick = state.taskId
|
|
339
|
+
const draggedTaskId = state.taskId
|
|
340
|
+
const draggedEl = state.taskElement
|
|
341
|
+
const root = chartRef.value
|
|
342
|
+
|
|
343
|
+
if (activeCaptureHandler && root) {
|
|
344
|
+
root.removeEventListener('click', activeCaptureHandler, true)
|
|
345
|
+
activeCaptureHandler = null
|
|
346
|
+
}
|
|
347
|
+
if (captureClickTimer) {
|
|
348
|
+
clearTimeout(captureClickTimer)
|
|
349
|
+
captureClickTimer = null
|
|
350
|
+
}
|
|
351
|
+
|
|
319
352
|
// Intercept and prevent the browser's subsequent click event in the capture phase
|
|
353
|
+
// strictly on the Gantt root container, never on window
|
|
320
354
|
const captureClick = (e: MouseEvent) => {
|
|
321
|
-
e.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
355
|
+
const target = e.target as Element | null
|
|
356
|
+
const bar = target?.closest?.('.gantt-bar')
|
|
357
|
+
const isFromDraggedBar = Boolean(
|
|
358
|
+
(draggedEl && (draggedEl === bar || (target && draggedEl.contains(target)))) ||
|
|
359
|
+
(bar && draggedTaskId != null && bar.getAttribute('data-task-id') === String(draggedTaskId))
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
if (isFromDraggedBar) {
|
|
363
|
+
e.stopPropagation()
|
|
364
|
+
e.stopImmediatePropagation()
|
|
365
|
+
e.preventDefault()
|
|
366
|
+
root?.removeEventListener('click', captureClick, true)
|
|
367
|
+
activeCaptureHandler = null
|
|
368
|
+
}
|
|
325
369
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
370
|
+
|
|
371
|
+
if (root) {
|
|
372
|
+
activeCaptureHandler = captureClick
|
|
373
|
+
root.addEventListener('click', captureClick, true)
|
|
374
|
+
captureClickTimer = setTimeout(() => {
|
|
375
|
+
root.removeEventListener('click', captureClick, true)
|
|
376
|
+
if (activeCaptureHandler === captureClick) {
|
|
377
|
+
activeCaptureHandler = null
|
|
378
|
+
}
|
|
379
|
+
captureClickTimer = null
|
|
380
|
+
wasDragging = false
|
|
381
|
+
draggedTaskIdForClick = null
|
|
382
|
+
}, 100)
|
|
383
|
+
} else {
|
|
329
384
|
wasDragging = false
|
|
330
|
-
|
|
385
|
+
draggedTaskIdForClick = null
|
|
386
|
+
}
|
|
331
387
|
}
|
|
332
388
|
|
|
333
389
|
if (!hasMoved) {
|
|
@@ -398,7 +454,6 @@ const onMouseUp = () => {
|
|
|
398
454
|
}
|
|
399
455
|
|
|
400
456
|
emit('update:task', emitPayload)
|
|
401
|
-
emit('task-change', emitPayload)
|
|
402
457
|
|
|
403
458
|
activeDragState.value = null
|
|
404
459
|
}
|
|
@@ -410,6 +465,14 @@ onBeforeUnmount(() => {
|
|
|
410
465
|
window.removeEventListener('mousemove', onGanttMouseMove)
|
|
411
466
|
window.removeEventListener('mouseup', onGanttMouseUp)
|
|
412
467
|
}
|
|
468
|
+
if (activeCaptureHandler && chartRef.value) {
|
|
469
|
+
chartRef.value.removeEventListener('click', activeCaptureHandler, true)
|
|
470
|
+
activeCaptureHandler = null
|
|
471
|
+
}
|
|
472
|
+
if (captureClickTimer) {
|
|
473
|
+
clearTimeout(captureClickTimer)
|
|
474
|
+
captureClickTimer = null
|
|
475
|
+
}
|
|
413
476
|
})
|
|
414
477
|
|
|
415
478
|
const ganttColumns = computed(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ITreeViewColumn } from '#toolkit/components/KTreeView/KTreeView.logic';
|
|
2
|
-
import type { IKDatatableAction } from '@katlux/providers';
|
|
2
|
+
import type { IKDatatableAction, IDataFilter } from '@katlux/providers';
|
|
3
3
|
import type { IGanttTask } from '#toolkit/components/KGantt/KGantt.logic';
|
|
4
4
|
type __VLS_Props = {
|
|
5
5
|
dataProvider: any;
|
|
@@ -21,13 +21,16 @@ type __VLS_Props = {
|
|
|
21
21
|
taskTypeField?: string;
|
|
22
22
|
selectedRows?: any[];
|
|
23
23
|
selectAll?: boolean;
|
|
24
|
+
selectAllScope?: 'page' | 'dataset';
|
|
25
|
+
unselectedRows?: any[];
|
|
26
|
+
filter?: IDataFilter | null;
|
|
24
27
|
cellSlots?: any;
|
|
25
28
|
headerSlots?: any;
|
|
26
29
|
endingPoint?: Date | string | number;
|
|
27
30
|
mode?: 'date' | 'numeric';
|
|
28
31
|
inclusiveEndDate?: boolean;
|
|
29
32
|
virtualScroll?: boolean;
|
|
30
|
-
itemHeight?: number;
|
|
33
|
+
itemHeight?: number | ((row: any, index: number) => number);
|
|
31
34
|
viewportHeight?: number;
|
|
32
35
|
buffer?: number;
|
|
33
36
|
moveTime?: (amount: number) => void;
|
|
@@ -36,6 +39,9 @@ type __VLS_Props = {
|
|
|
36
39
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
37
40
|
"update:selectedRows": (value: any[]) => any;
|
|
38
41
|
"update:selectAll": (value: boolean) => any;
|
|
42
|
+
"update:selectAllScope": (value: "page" | "dataset") => any;
|
|
43
|
+
"update:unselectedRows": (value: any[]) => any;
|
|
44
|
+
"update:filter": (value: IDataFilter | null) => any;
|
|
39
45
|
"task-click": (payload: {
|
|
40
46
|
task: IGanttTask;
|
|
41
47
|
row: any;
|
|
@@ -51,14 +57,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
51
57
|
sourceRow: any;
|
|
52
58
|
targetRow?: any;
|
|
53
59
|
}) => any;
|
|
54
|
-
"task-change": (payload: {
|
|
55
|
-
task: IGanttTask;
|
|
56
|
-
sourceRow: any;
|
|
57
|
-
targetRow?: any;
|
|
58
|
-
}) => any;
|
|
59
60
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
60
61
|
"onUpdate:selectedRows"?: ((value: any[]) => any) | undefined;
|
|
61
62
|
"onUpdate:selectAll"?: ((value: boolean) => any) | undefined;
|
|
63
|
+
"onUpdate:selectAllScope"?: ((value: "page" | "dataset") => any) | undefined;
|
|
64
|
+
"onUpdate:unselectedRows"?: ((value: any[]) => any) | undefined;
|
|
65
|
+
"onUpdate:filter"?: ((value: IDataFilter | null) => any) | undefined;
|
|
62
66
|
"onTask-click"?: ((payload: {
|
|
63
67
|
task: IGanttTask;
|
|
64
68
|
row: any;
|
|
@@ -74,11 +78,6 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
74
78
|
sourceRow: any;
|
|
75
79
|
targetRow?: any;
|
|
76
80
|
}) => any) | undefined;
|
|
77
|
-
"onTask-change"?: ((payload: {
|
|
78
|
-
task: IGanttTask;
|
|
79
|
-
sourceRow: any;
|
|
80
|
-
targetRow?: any;
|
|
81
|
-
}) => any) | undefined;
|
|
82
81
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
83
82
|
declare const _default: typeof __VLS_export;
|
|
84
83
|
export default _default;
|
|
@@ -16,7 +16,7 @@ type __VLS_Props = {
|
|
|
16
16
|
modelValue?: any;
|
|
17
17
|
selectedNode?: any;
|
|
18
18
|
virtualScroll?: boolean;
|
|
19
|
-
itemHeight?: number;
|
|
19
|
+
itemHeight?: number | ((node: any, index: number) => number);
|
|
20
20
|
viewportHeight?: number;
|
|
21
21
|
buffer?: number;
|
|
22
22
|
loading?: boolean;
|
|
@@ -27,14 +27,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
27
27
|
onSelect?: ((row: TTreeRow) => any) | undefined;
|
|
28
28
|
}>, {
|
|
29
29
|
disabled: boolean;
|
|
30
|
+
idKey: string;
|
|
30
31
|
loading: boolean;
|
|
31
32
|
searchtext: string;
|
|
32
33
|
virtualScroll: boolean;
|
|
33
|
-
itemHeight: number;
|
|
34
|
+
itemHeight: number | ((node: any, index: number) => number);
|
|
34
35
|
buffer: number;
|
|
35
36
|
labelField: string;
|
|
36
37
|
multiSelect: boolean;
|
|
37
|
-
idKey: string;
|
|
38
38
|
viewportHeight: number;
|
|
39
39
|
iconField: string;
|
|
40
40
|
selectable: boolean;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
// Toggle
|
|
36
36
|
.tree-toggle(
|
|
37
37
|
v-if="(row.__treeNode?.hasChildren || row.hasChildren)"
|
|
38
|
-
@click.stop="toggleNode(row
|
|
38
|
+
@click.stop="toggleNode(getNodeKey(row))"
|
|
39
39
|
:class="{ expanded: (row.__treeNode?.isExpanded ?? row.isExpanded) }"
|
|
40
40
|
role="button"
|
|
41
41
|
:aria-label="t('Toggle node')"
|
|
@@ -83,10 +83,11 @@
|
|
|
83
83
|
</template>
|
|
84
84
|
|
|
85
85
|
<script lang="ts" setup>
|
|
86
|
-
import { ref, computed, watch, nextTick
|
|
86
|
+
import { ref, computed, watch, nextTick } from 'vue'
|
|
87
87
|
import type { TTreeRow } from '@katlux/providers'
|
|
88
88
|
import { useKatluxI18n } from '#toolkit/composables/useKatluxI18n'
|
|
89
89
|
import { useVirtualScroll } from '#toolkit/composables/useVirtualScroll'
|
|
90
|
+
import { useDataProvider } from '#toolkit/composables/useDataProvider'
|
|
90
91
|
import KTreeNodeItem, { type ITreeRenderNode } from './KTreeNodeItem.vue'
|
|
91
92
|
|
|
92
93
|
const { t } = useKatluxI18n()
|
|
@@ -109,7 +110,7 @@ const props = withDefaults(
|
|
|
109
110
|
modelValue?: any
|
|
110
111
|
selectedNode?: any
|
|
111
112
|
virtualScroll?: boolean
|
|
112
|
-
itemHeight?: number
|
|
113
|
+
itemHeight?: number | ((node: any, index: number) => number)
|
|
113
114
|
viewportHeight?: number
|
|
114
115
|
buffer?: number
|
|
115
116
|
loading?: boolean
|
|
@@ -160,19 +161,21 @@ const isSelected = (row: TTreeRow): boolean => {
|
|
|
160
161
|
return false
|
|
161
162
|
}
|
|
162
163
|
|
|
164
|
+
const { loading: dpLoading, initialLoad: dpInitialLoad, stateVersion: dpStateVersion } = useDataProvider(() => props.dataProvider)
|
|
165
|
+
|
|
163
166
|
const isLoading = computed(() => {
|
|
164
167
|
if (typeof props.loading === 'boolean') {
|
|
165
168
|
return props.loading
|
|
166
169
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
return Boolean(loadingVal || initVal)
|
|
170
|
+
if (props.dataProvider) {
|
|
171
|
+
return Boolean(dpLoading.value || dpInitialLoad.value)
|
|
172
|
+
}
|
|
173
|
+
return false
|
|
172
174
|
})
|
|
173
175
|
|
|
174
176
|
// Virtual scrolling data source
|
|
175
177
|
const treeRows = computed<TTreeRow[]>(() => {
|
|
178
|
+
const _ver = dpStateVersion?.value
|
|
176
179
|
const currentVisible = props.visibleRows || []
|
|
177
180
|
const dp = props.dataProvider as any
|
|
178
181
|
if (props.virtualScroll) {
|
|
@@ -198,7 +201,7 @@ const {
|
|
|
198
201
|
containerCssVars
|
|
199
202
|
} = useVirtualScroll({
|
|
200
203
|
items: treeRows,
|
|
201
|
-
itemHeight: props.itemHeight || 32,
|
|
204
|
+
itemHeight: computed(() => (typeof props.itemHeight === 'function' ? props.itemHeight : (props.itemHeight || 32))),
|
|
202
205
|
containerHeight: computed(() => props.viewportHeight || 400),
|
|
203
206
|
buffer: props.buffer ?? 5,
|
|
204
207
|
virtualScroll: computed(() => !!props.virtualScroll),
|
|
@@ -210,9 +213,38 @@ const {
|
|
|
210
213
|
}
|
|
211
214
|
})
|
|
212
215
|
|
|
216
|
+
watch(
|
|
217
|
+
[startIndex, endIndex, () => props.virtualScroll],
|
|
218
|
+
([start, end, isVirt]) => {
|
|
219
|
+
if (!isVirt) return
|
|
220
|
+
const dp = props.dataProvider as any
|
|
221
|
+
if (!dp) return
|
|
222
|
+
if (typeof dp.resolveRangeRows === 'function') {
|
|
223
|
+
dp.resolveRangeRows(start, end)
|
|
224
|
+
} else if (typeof dp.getWindowRows === 'function') {
|
|
225
|
+
dp.getWindowRows(start, end)
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
{ immediate: true }
|
|
229
|
+
)
|
|
230
|
+
|
|
213
231
|
const displayRows = computed(() => {
|
|
214
232
|
if (props.virtualScroll) {
|
|
215
|
-
|
|
233
|
+
const dp = props.dataProvider as any
|
|
234
|
+
return visibleItems.value.map((r: any) => {
|
|
235
|
+
if (dp && dp.isEncryptionEnabled && typeof dp._decryptedNodeMap?.get === 'function') {
|
|
236
|
+
const id = r?.[props.idKey] ?? r?.id ?? r?.__treeNode?.id
|
|
237
|
+
const dec = dp._decryptedNodeMap.get(id)
|
|
238
|
+
if (dec) {
|
|
239
|
+
return {
|
|
240
|
+
...r,
|
|
241
|
+
...dec,
|
|
242
|
+
data: { ...(r.data || {}), ...dec }
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return r
|
|
247
|
+
})
|
|
216
248
|
}
|
|
217
249
|
return props.visibleRows || []
|
|
218
250
|
})
|
|
@@ -310,7 +342,9 @@ const setFocusToNode = (row: TTreeRow, idx?: number) => {
|
|
|
310
342
|
const key = getNodeKey(row, idx)
|
|
311
343
|
focusedNodeId.value = key
|
|
312
344
|
if (props.virtualScroll && idx !== undefined) {
|
|
313
|
-
const itemH = props.itemHeight
|
|
345
|
+
const itemH = typeof props.itemHeight === 'number' && props.itemHeight > 0
|
|
346
|
+
? props.itemHeight
|
|
347
|
+
: (typeof props.itemHeight === 'function' ? props.itemHeight(row, idx) : 32)
|
|
314
348
|
const vpH = props.viewportHeight || 400
|
|
315
349
|
const targetTop = idx * itemH
|
|
316
350
|
if (containerRef.value) {
|
|
@@ -367,7 +401,7 @@ const handleKeyDown = (e: KeyboardEvent, row: TTreeRow) => {
|
|
|
367
401
|
const isExpanded = Boolean(currentRow.__treeNode?.isExpanded ?? currentRow.isExpanded)
|
|
368
402
|
if (hasChildren) {
|
|
369
403
|
if (!isExpanded) {
|
|
370
|
-
toggleNode(currentRow
|
|
404
|
+
toggleNode(getNodeKey(currentRow))
|
|
371
405
|
} else if (currentIdx < visibleList.length - 1) {
|
|
372
406
|
setFocusToNode(visibleList[currentIdx + 1], currentIdx + 1)
|
|
373
407
|
}
|
|
@@ -377,7 +411,7 @@ const handleKeyDown = (e: KeyboardEvent, row: TTreeRow) => {
|
|
|
377
411
|
const hasChildren = Boolean(currentRow.__treeNode?.hasChildren ?? currentRow.hasChildren)
|
|
378
412
|
const isExpanded = Boolean(currentRow.__treeNode?.isExpanded ?? currentRow.isExpanded)
|
|
379
413
|
if (hasChildren && isExpanded) {
|
|
380
|
-
toggleNode(currentRow
|
|
414
|
+
toggleNode(getNodeKey(currentRow))
|
|
381
415
|
} else {
|
|
382
416
|
const parentId = currentRow.__treeNode?.parentId ?? currentRow.parentId
|
|
383
417
|
if (parentId !== null && parentId !== undefined) {
|
|
@@ -407,7 +441,7 @@ const handleKeyDown = (e: KeyboardEvent, row: TTreeRow) => {
|
|
|
407
441
|
e.preventDefault()
|
|
408
442
|
const hasChildren = Boolean(currentRow.__treeNode?.hasChildren ?? currentRow.hasChildren)
|
|
409
443
|
if (hasChildren) {
|
|
410
|
-
toggleNode(currentRow
|
|
444
|
+
toggleNode(getNodeKey(currentRow))
|
|
411
445
|
} else {
|
|
412
446
|
onNodeClick(currentRow)
|
|
413
447
|
}
|
|
@@ -16,7 +16,7 @@ type __VLS_Props = {
|
|
|
16
16
|
modelValue?: any;
|
|
17
17
|
selectedNode?: any;
|
|
18
18
|
virtualScroll?: boolean;
|
|
19
|
-
itemHeight?: number;
|
|
19
|
+
itemHeight?: number | ((node: any, index: number) => number);
|
|
20
20
|
viewportHeight?: number;
|
|
21
21
|
buffer?: number;
|
|
22
22
|
loading?: boolean;
|
|
@@ -27,14 +27,14 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
27
27
|
onSelect?: ((row: TTreeRow) => any) | undefined;
|
|
28
28
|
}>, {
|
|
29
29
|
disabled: boolean;
|
|
30
|
+
idKey: string;
|
|
30
31
|
loading: boolean;
|
|
31
32
|
searchtext: string;
|
|
32
33
|
virtualScroll: boolean;
|
|
33
|
-
itemHeight: number;
|
|
34
|
+
itemHeight: number | ((node: any, index: number) => number);
|
|
34
35
|
buffer: number;
|
|
35
36
|
labelField: string;
|
|
36
37
|
multiSelect: boolean;
|
|
37
|
-
idKey: string;
|
|
38
38
|
viewportHeight: number;
|
|
39
39
|
iconField: string;
|
|
40
40
|
selectable: boolean;
|