lkt-table 2.0.23 → 2.0.25
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 +10 -10
- package/dist/build.js +1246 -1192
- package/dist/components/LktHiddenRow.vue.d.ts +2 -31
- package/dist/components/LktTableRow.vue.d.ts +2 -72
- package/package.json +1 -1
- package/src/components/LktTableCell.vue +17 -3
- package/src/lib-components/LktTable.vue +57 -1
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { getColumnDisplayContent } from "../functions/table-functions";
|
|
2
|
-
import LktTableCell from "./LktTableCell.vue";
|
|
3
1
|
import { LktObject, Column } from "lkt-vue-kernel";
|
|
4
2
|
type __VLS_Props = {
|
|
5
3
|
modelValue: LktObject;
|
|
@@ -14,42 +12,15 @@ type __VLS_Props = {
|
|
|
14
12
|
editModeEnabled: boolean;
|
|
15
13
|
hasInlineEditPerm: boolean;
|
|
16
14
|
};
|
|
17
|
-
declare const item: import("vue").Ref<LktObject, LktObject>;
|
|
18
|
-
declare const onClick: ($event: any) => void;
|
|
19
|
-
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
20
15
|
declare var __VLS_2: string, __VLS_3: {
|
|
21
16
|
value: any;
|
|
22
17
|
item: LktObject;
|
|
23
18
|
column: Column;
|
|
24
19
|
i: number;
|
|
25
20
|
};
|
|
26
|
-
type __VLS_Slots =
|
|
21
|
+
type __VLS_Slots = {} & {
|
|
27
22
|
[K in NonNullable<typeof __VLS_2>]?: (props: typeof __VLS_3) => any;
|
|
28
|
-
}
|
|
29
|
-
declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
|
|
30
|
-
getColumnDisplayContent: typeof getColumnDisplayContent;
|
|
31
|
-
LktTableCell: typeof LktTableCell;
|
|
32
|
-
item: typeof item;
|
|
33
|
-
onClick: typeof onClick;
|
|
34
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
35
|
-
"update:modelValue": (...args: any[]) => void;
|
|
36
|
-
click: (...args: any[]) => void;
|
|
37
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
38
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
39
|
-
onClick?: ((...args: any[]) => any) | undefined;
|
|
40
|
-
}>, {
|
|
41
|
-
modelValue: LktObject;
|
|
42
|
-
i: number;
|
|
43
|
-
editModeEnabled: boolean;
|
|
44
|
-
hasInlineEditPerm: boolean;
|
|
45
|
-
isDraggable: boolean;
|
|
46
|
-
sortable: boolean;
|
|
47
|
-
hiddenIsVisible: boolean;
|
|
48
|
-
visibleColumns: Column[];
|
|
49
|
-
emptyColumns: string[];
|
|
50
|
-
hiddenColumnsColSpan: number;
|
|
51
|
-
hiddenColumns: Column[];
|
|
52
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
};
|
|
53
24
|
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
54
25
|
"update:modelValue": (...args: any[]) => void;
|
|
55
26
|
click: (...args: any[]) => void;
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { canRenderColumn, colPreferSlot, getColumnClasses, getColumnDisplayContent, getHorizontalColSpan } from "../functions/table-functions";
|
|
2
|
-
import LktTableCell from "./LktTableCell.vue";
|
|
3
|
-
import DropButtonComponent from "./DropButtonComponent.vue";
|
|
4
|
-
import EditButtonComponent from "./EditButtonComponent.vue";
|
|
5
1
|
import { ButtonConfig, Column, LktObject, ValidTableRowTypeValue } from "lkt-vue-kernel";
|
|
6
|
-
declare const slots: Readonly<{
|
|
7
|
-
[name: string]: import("vue").Slot<any> | undefined;
|
|
8
|
-
}>;
|
|
9
2
|
type __VLS_Props = {
|
|
10
3
|
modelValue: LktObject;
|
|
11
4
|
editButton: ButtonConfig;
|
|
@@ -31,12 +24,6 @@ type __VLS_Props = {
|
|
|
31
24
|
disabledDrag?: boolean | Function;
|
|
32
25
|
itemContainerClass?: string | Function;
|
|
33
26
|
};
|
|
34
|
-
declare const Item: import("vue").Ref<LktObject, LktObject>;
|
|
35
|
-
declare const canCustomItem: boolean;
|
|
36
|
-
declare const canItem: boolean;
|
|
37
|
-
declare const onClick: ($event: any) => void, onShow: ($event: any, i: any) => void, classes: import("vue").ComputedRef<string>, hasNavButtonSlot: import("vue").ComputedRef<boolean>, navButtonSlot: import("vue").ComputedRef<string | import("vue").Component>, onClickUp: () => void, onClickDown: () => void, onClickDrop: () => void;
|
|
38
|
-
declare const canRenderDragIndicator: import("vue").ComputedRef<any>, computedDragIndicatorRole: import("vue").ComputedRef<"drag-indicator" | "invalid-drag-indicator">, computedContainerClasses: import("vue").ComputedRef<string>;
|
|
39
|
-
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
40
27
|
declare var __VLS_26: `item-${number}`, __VLS_27: {
|
|
41
28
|
item: LktObject;
|
|
42
29
|
index: number;
|
|
@@ -63,70 +50,13 @@ declare var __VLS_26: `item-${number}`, __VLS_27: {
|
|
|
63
50
|
column: Column;
|
|
64
51
|
i: number;
|
|
65
52
|
};
|
|
66
|
-
type __VLS_Slots =
|
|
53
|
+
type __VLS_Slots = {} & {
|
|
67
54
|
[K in NonNullable<typeof __VLS_26>]?: (props: typeof __VLS_27) => any;
|
|
68
55
|
} & {
|
|
69
56
|
[K in NonNullable<typeof __VLS_32>]?: (props: typeof __VLS_33) => any;
|
|
70
57
|
} & {
|
|
71
58
|
item?: (props: typeof __VLS_29) => any;
|
|
72
|
-
}
|
|
73
|
-
declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
|
|
74
|
-
canRenderColumn: typeof canRenderColumn;
|
|
75
|
-
colPreferSlot: typeof colPreferSlot;
|
|
76
|
-
getColumnClasses: typeof getColumnClasses;
|
|
77
|
-
getColumnDisplayContent: typeof getColumnDisplayContent;
|
|
78
|
-
getHorizontalColSpan: typeof getHorizontalColSpan;
|
|
79
|
-
LktTableCell: typeof LktTableCell;
|
|
80
|
-
DropButtonComponent: typeof DropButtonComponent;
|
|
81
|
-
EditButtonComponent: typeof EditButtonComponent;
|
|
82
|
-
slots: typeof slots;
|
|
83
|
-
Item: typeof Item;
|
|
84
|
-
canCustomItem: typeof canCustomItem;
|
|
85
|
-
canItem: typeof canItem;
|
|
86
|
-
onClick: typeof onClick;
|
|
87
|
-
onShow: typeof onShow;
|
|
88
|
-
classes: typeof classes;
|
|
89
|
-
hasNavButtonSlot: typeof hasNavButtonSlot;
|
|
90
|
-
navButtonSlot: typeof navButtonSlot;
|
|
91
|
-
onClickUp: typeof onClickUp;
|
|
92
|
-
onClickDown: typeof onClickDown;
|
|
93
|
-
onClickDrop: typeof onClickDrop;
|
|
94
|
-
canRenderDragIndicator: typeof canRenderDragIndicator;
|
|
95
|
-
computedDragIndicatorRole: typeof computedDragIndicatorRole;
|
|
96
|
-
computedContainerClasses: typeof computedContainerClasses;
|
|
97
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
98
|
-
"update:modelValue": (...args: any[]) => void;
|
|
99
|
-
click: (...args: any[]) => void;
|
|
100
|
-
show: (...args: any[]) => void;
|
|
101
|
-
"item-up": (...args: any[]) => void;
|
|
102
|
-
"item-down": (...args: any[]) => void;
|
|
103
|
-
"item-drop": (...args: any[]) => void;
|
|
104
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
105
|
-
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
106
|
-
onClick?: ((...args: any[]) => any) | undefined;
|
|
107
|
-
onShow?: ((...args: any[]) => any) | undefined;
|
|
108
|
-
"onItem-up"?: ((...args: any[]) => any) | undefined;
|
|
109
|
-
"onItem-down"?: ((...args: any[]) => any) | undefined;
|
|
110
|
-
"onItem-drop"?: ((...args: any[]) => any) | undefined;
|
|
111
|
-
}>, {
|
|
112
|
-
modelValue: LktObject;
|
|
113
|
-
i: number;
|
|
114
|
-
editModeEnabled: boolean;
|
|
115
|
-
isDraggable: boolean;
|
|
116
|
-
sortable: boolean;
|
|
117
|
-
displayHiddenColumnsIndicator: boolean;
|
|
118
|
-
hiddenIsVisible: boolean;
|
|
119
|
-
addNavigation: boolean;
|
|
120
|
-
latestRow: boolean;
|
|
121
|
-
canDrop: boolean;
|
|
122
|
-
canEdit: boolean;
|
|
123
|
-
visibleColumns: Column[];
|
|
124
|
-
emptyColumns: string[];
|
|
125
|
-
rowDisplayType: ValidTableRowTypeValue;
|
|
126
|
-
renderDrag: boolean | Function;
|
|
127
|
-
disabledDrag: boolean | Function;
|
|
128
|
-
itemContainerClass: string | Function;
|
|
129
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
59
|
+
};
|
|
130
60
|
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
131
61
|
"update:modelValue": (...args: any[]) => void;
|
|
132
62
|
click: (...args: any[]) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import {getColumnDisplayContent} from "../functions/table-functions";
|
|
3
3
|
import {computed, ref, watch} from "vue";
|
|
4
|
-
import {Column, ColumnType, extractPropValue, LktObject} from "lkt-vue-kernel";
|
|
4
|
+
import {Column, ColumnType, extractPropValue, FieldType, LktObject} from "lkt-vue-kernel";
|
|
5
5
|
|
|
6
6
|
const emit = defineEmits([
|
|
7
7
|
'update:modelValue'
|
|
@@ -63,6 +63,20 @@ const computedFieldConfig = computed(() => {
|
|
|
63
63
|
}
|
|
64
64
|
return props.column.field;
|
|
65
65
|
})
|
|
66
|
+
|
|
67
|
+
const computedFieldLabel = computed(() => {
|
|
68
|
+
if (props.column.type === ColumnType.Field) {
|
|
69
|
+
if (!props.column?.field?.label && [
|
|
70
|
+
FieldType.Switch,
|
|
71
|
+
FieldType.Check,
|
|
72
|
+
].includes(props.column.field?.type)) {
|
|
73
|
+
return props.column.label;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return props.column.field?.label;
|
|
77
|
+
}
|
|
78
|
+
return '';
|
|
79
|
+
})
|
|
66
80
|
</script>
|
|
67
81
|
|
|
68
82
|
<template>
|
|
@@ -83,7 +97,7 @@ const computedFieldConfig = computed(() => {
|
|
|
83
97
|
:read-mode="!column.editable || !editModeEnabled"
|
|
84
98
|
:ref="(el:any) => inputElement = el"
|
|
85
99
|
:slot-data="slotData"
|
|
86
|
-
:label="
|
|
100
|
+
:label="computedFieldLabel"
|
|
87
101
|
:modal-data="computedModalData"
|
|
88
102
|
:prop="item"
|
|
89
103
|
v-model="value"/>
|
|
@@ -94,7 +108,7 @@ const computedFieldConfig = computed(() => {
|
|
|
94
108
|
read-mode
|
|
95
109
|
:ref="(el:any) => inputElement = el"
|
|
96
110
|
:slot-data="slotData"
|
|
97
|
-
:label="
|
|
111
|
+
:label="computedFieldLabel"
|
|
98
112
|
:modal-data="computedModalData"
|
|
99
113
|
:prop="item"
|
|
100
114
|
:model-value="value"/>
|
|
@@ -4,6 +4,7 @@ import {defaultTableSorter, getColumnByKey, getDefaultSortColumn} from "../funct
|
|
|
4
4
|
import LktTableRow from "../components/LktTableRow.vue";
|
|
5
5
|
import {computed, nextTick, onMounted, ref, useSlots, watch} from "vue";
|
|
6
6
|
import {
|
|
7
|
+
AccordionConfig,
|
|
7
8
|
ButtonConfig,
|
|
8
9
|
ButtonType,
|
|
9
10
|
Column,
|
|
@@ -28,6 +29,7 @@ import Sortable from 'sortablejs';
|
|
|
28
29
|
import TableHeader from "../components/TableHeader.vue";
|
|
29
30
|
import {time} from "lkt-date-tools";
|
|
30
31
|
import {Settings} from "../settings/Settings";
|
|
32
|
+
import LktTableCell from "../components/LktTableCell.vue";
|
|
31
33
|
|
|
32
34
|
const emit = defineEmits([
|
|
33
35
|
'update:modelValue',
|
|
@@ -144,6 +146,7 @@ const emptyColumns = computed(() => {
|
|
|
144
146
|
return Columns.value.filter((c: Column) => !c.hidden);
|
|
145
147
|
}),
|
|
146
148
|
hiddenColumns = computed(() => {
|
|
149
|
+
return [];
|
|
147
150
|
return Columns.value.filter((c: Column) => c.hidden);
|
|
148
151
|
}),
|
|
149
152
|
hiddenColumnsColSpan = computed(() => {
|
|
@@ -242,6 +245,10 @@ const emptyColumns = computed(() => {
|
|
|
242
245
|
}
|
|
243
246
|
|
|
244
247
|
return !isLoading.value && Items.value.length > 0;
|
|
248
|
+
}),
|
|
249
|
+
|
|
250
|
+
computedAccordionHeaderColumn = computed(() => {
|
|
251
|
+
return Columns.value.find(c => c.isForAccordionHeader);
|
|
245
252
|
})
|
|
246
253
|
;
|
|
247
254
|
|
|
@@ -442,6 +449,11 @@ const getItemByEvent = (e: any) => {
|
|
|
442
449
|
getItemContainerClass = (item: LktObject, index: number) => {
|
|
443
450
|
if (typeof props.itemContainerClass === 'function') return props.itemContainerClass(item, index);
|
|
444
451
|
return props.itemContainerClass;
|
|
452
|
+
},
|
|
453
|
+
getAccordionHeaderText = (item: LktObject, index: number) => {
|
|
454
|
+
if (!computedAccordionHeaderColumn.value) return '';
|
|
455
|
+
|
|
456
|
+
return item[computedAccordionHeaderColumn.value.key];
|
|
445
457
|
};
|
|
446
458
|
|
|
447
459
|
onMounted(() => {
|
|
@@ -840,9 +852,9 @@ const hasEmptySlot = computed(() => {
|
|
|
840
852
|
<template
|
|
841
853
|
v-for="(item, i) in Items">
|
|
842
854
|
<div
|
|
855
|
+
v-if="canDisplayItem(item, i)"
|
|
843
856
|
class="lkt-table-item"
|
|
844
857
|
:class="getItemContainerClass(item, i)"
|
|
845
|
-
v-if="canDisplayItem(item, i)"
|
|
846
858
|
:data-i="i"
|
|
847
859
|
:key="getRowKey(item, i)">
|
|
848
860
|
<slot name="item"
|
|
@@ -860,6 +872,50 @@ const hasEmptySlot = computed(() => {
|
|
|
860
872
|
</template>
|
|
861
873
|
</div>
|
|
862
874
|
|
|
875
|
+
<div v-else-if="type === TableType.Accordion"
|
|
876
|
+
ref="tableBody"
|
|
877
|
+
:id="'lkt-table-body-' + uniqueId"
|
|
878
|
+
class="lkt-table-items-container"
|
|
879
|
+
:class="itemsContainerClass">
|
|
880
|
+
<template
|
|
881
|
+
v-for="(item, i) in Items">
|
|
882
|
+
<lkt-accordion
|
|
883
|
+
v-if="canDisplayItem(item, i)"
|
|
884
|
+
class="lkt-table-item"
|
|
885
|
+
:class="getItemContainerClass(item, i)"
|
|
886
|
+
:data-i="i"
|
|
887
|
+
:key="getRowKey(item, i)"
|
|
888
|
+
v-bind="<AccordionConfig>{
|
|
889
|
+
...accordion,
|
|
890
|
+
title: getAccordionHeaderText(item, i),
|
|
891
|
+
}"
|
|
892
|
+
>
|
|
893
|
+
<template #header>
|
|
894
|
+
<lkt-table-cell
|
|
895
|
+
v-model="Items[i]"
|
|
896
|
+
:i="i"
|
|
897
|
+
:column="computedAccordionHeaderColumn"
|
|
898
|
+
:columns="visibleColumns"
|
|
899
|
+
:edit-mode-enabled="editModeEnabled"
|
|
900
|
+
:has-inline-edit-perm="hasInlineEditPerm"
|
|
901
|
+
/>
|
|
902
|
+
</template>
|
|
903
|
+
|
|
904
|
+
<template v-for="column in visibleColumns">
|
|
905
|
+
<lkt-table-cell
|
|
906
|
+
v-if="column.key !== computedAccordionHeaderColumn?.key"
|
|
907
|
+
v-model="Items[i]"
|
|
908
|
+
:i="i"
|
|
909
|
+
:column="column"
|
|
910
|
+
:columns="visibleColumns"
|
|
911
|
+
:edit-mode-enabled="editModeEnabled"
|
|
912
|
+
:has-inline-edit-perm="hasInlineEditPerm"
|
|
913
|
+
/>
|
|
914
|
+
</template>
|
|
915
|
+
</lkt-accordion>
|
|
916
|
+
</template>
|
|
917
|
+
</div>
|
|
918
|
+
|
|
863
919
|
<component :is="type" v-else-if="computedIsList" class="lkt-table-items-container"
|
|
864
920
|
:class="itemsContainerClass">
|
|
865
921
|
<template
|