lkt-table 2.0.42 → 2.0.43
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/dist/build.d.ts +8 -8
- package/dist/build.js +983 -948
- package/package.json +1 -1
- package/src/lib-components/LktTable.vue +69 -2
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import {computed, nextTick, onMounted, ref, useSlots, watch} from "vue";
|
|
|
6
6
|
import {
|
|
7
7
|
AccordionConfig,
|
|
8
8
|
ButtonConfig,
|
|
9
|
-
ButtonType, ClickEventArgs,
|
|
9
|
+
ButtonType, CalendarConfig, CalendarEventConfig, ClickEventArgs,
|
|
10
10
|
Column, ColumnConfig,
|
|
11
11
|
ensureButtonConfig,
|
|
12
12
|
extractI18nValue,
|
|
@@ -26,7 +26,7 @@ import {HTTPResponse} from "lkt-http-client";
|
|
|
26
26
|
import CreateButton from "../components/CreateButton.vue";
|
|
27
27
|
import Sortable from 'sortablejs';
|
|
28
28
|
import TableHeader from "../components/TableHeader.vue";
|
|
29
|
-
import {time} from "lkt-date-tools";
|
|
29
|
+
import {date, time} from "lkt-date-tools";
|
|
30
30
|
import {Settings} from "../settings/Settings";
|
|
31
31
|
import LktTableCell from "../components/LktTableCell.vue";
|
|
32
32
|
|
|
@@ -237,6 +237,14 @@ const emptyColumns = computed(() => {
|
|
|
237
237
|
|
|
238
238
|
computedAccordionHeaderColumn = computed(() => {
|
|
239
239
|
return Columns.value.find(c => c.isForAccordionHeader);
|
|
240
|
+
}),
|
|
241
|
+
|
|
242
|
+
computedCalendarDateColumn = computed(() => {
|
|
243
|
+
return Columns.value.find(c => c.isCalendarDate);
|
|
244
|
+
}),
|
|
245
|
+
|
|
246
|
+
computedCalendarGroupColumn = computed(() => {
|
|
247
|
+
return Columns.value.find(c => c.isCalendarGroup);
|
|
240
248
|
})
|
|
241
249
|
;
|
|
242
250
|
|
|
@@ -600,6 +608,52 @@ const checkUseItemSlot = (item: LktObject, index: number) => {
|
|
|
600
608
|
return props.useItemSlot;
|
|
601
609
|
}
|
|
602
610
|
|
|
611
|
+
const computedCalendarEvents = computed(() => {
|
|
612
|
+
if (!computedCalendarDateColumn.value || typeof computedCalendarDateColumn.value === 'undefined') return [];
|
|
613
|
+
|
|
614
|
+
let r: Array<CalendarEventConfig> = [];
|
|
615
|
+
let rControl: Array<string> = [];
|
|
616
|
+
|
|
617
|
+
Items.value.forEach((item: LktObject) => {
|
|
618
|
+
let dateObj = item[computedCalendarDateColumn.value.key];
|
|
619
|
+
let stringDate = date('Y-m-d H:i:s', dateObj);
|
|
620
|
+
|
|
621
|
+
let groupValue:string|undefined = undefined;
|
|
622
|
+
if (computedCalendarGroupColumn.value?.key) {
|
|
623
|
+
groupValue = item[computedCalendarGroupColumn.value.key];
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
let groupConfig = {};
|
|
627
|
+
if (groupValue && props.calendarGroups && typeof props.calendarGroups[groupValue] === 'object') {
|
|
628
|
+
groupConfig = props.calendarGroups[groupValue];
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
const controlKey = [stringDate, groupValue].join('-');
|
|
632
|
+
|
|
633
|
+
let i = -1;
|
|
634
|
+
if (!rControl.includes(controlKey)) {
|
|
635
|
+
i = rControl.length;
|
|
636
|
+
rControl.push(controlKey);
|
|
637
|
+
r.push({
|
|
638
|
+
date: dateObj,
|
|
639
|
+
data: {
|
|
640
|
+
items: [],
|
|
641
|
+
},
|
|
642
|
+
dot: {
|
|
643
|
+
...groupConfig,
|
|
644
|
+
class: `lkt-calendar-group--${groupValue}`,
|
|
645
|
+
},
|
|
646
|
+
})
|
|
647
|
+
} else {
|
|
648
|
+
i = rControl.findIndex(v => v === controlKey);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
r[i].data.items.push(item);
|
|
652
|
+
})
|
|
653
|
+
|
|
654
|
+
return r;
|
|
655
|
+
})
|
|
656
|
+
|
|
603
657
|
</script>
|
|
604
658
|
|
|
605
659
|
<template>
|
|
@@ -1094,6 +1148,19 @@ const checkUseItemSlot = (item: LktObject, index: number) => {
|
|
|
1094
1148
|
</template>
|
|
1095
1149
|
</carousel>
|
|
1096
1150
|
</div>
|
|
1151
|
+
|
|
1152
|
+
<div v-else-if="computedType === TableType.Calendar"
|
|
1153
|
+
ref="tableBody"
|
|
1154
|
+
:id="'lkt-table-body-' + uniqueId"
|
|
1155
|
+
class="lkt-table-items-container"
|
|
1156
|
+
:class="itemsContainerClass">
|
|
1157
|
+
<lkt-calendar
|
|
1158
|
+
v-bind="<CalendarConfig>{
|
|
1159
|
+
...calendar,
|
|
1160
|
+
events: computedCalendarEvents,
|
|
1161
|
+
}"
|
|
1162
|
+
/>
|
|
1163
|
+
</div>
|
|
1097
1164
|
</div>
|
|
1098
1165
|
|
|
1099
1166
|
<div class="lkt-table-empty" v-if="!isLoading && Items.length === 0">
|