lkt-table 2.0.28 → 2.0.29
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 +7 -9
- package/dist/build.js +1090 -1289
- package/dist/components/LktTableRow.vue.d.ts +1 -9
- package/dist/index.d.ts +0 -2
- package/dist/settings/Settings.d.ts +0 -4
- package/package.json +1 -1
- package/src/components/CreateButton.vue +2 -2
- package/src/components/LktTableRow.vue +1 -31
- package/src/lib-components/LktTable.vue +0 -68
- package/src/components/DropButtonComponent.vue +0 -37
- package/src/components/EditButtonComponent.vue +0 -37
- package/src/components/LktHiddenRow.vue +0 -82
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Column, LktObject, ValidTableRowTypeValue } from "lkt-vue-kernel";
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
modelValue: LktObject;
|
|
4
|
-
editButton: ButtonConfig;
|
|
5
|
-
dropButton: ButtonConfig;
|
|
6
4
|
isDraggable: boolean;
|
|
7
5
|
sortable: boolean;
|
|
8
|
-
displayHiddenColumnsIndicator: boolean;
|
|
9
|
-
hiddenIsVisible: boolean;
|
|
10
6
|
isLoading: boolean;
|
|
11
7
|
addNavigation: boolean;
|
|
12
8
|
latestRow: boolean;
|
|
@@ -60,14 +56,12 @@ type __VLS_Slots = {} & {
|
|
|
60
56
|
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
61
57
|
"update:modelValue": (...args: any[]) => void;
|
|
62
58
|
click: (...args: any[]) => void;
|
|
63
|
-
show: (...args: any[]) => void;
|
|
64
59
|
"item-up": (...args: any[]) => void;
|
|
65
60
|
"item-down": (...args: any[]) => void;
|
|
66
61
|
"item-drop": (...args: any[]) => void;
|
|
67
62
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
68
63
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
69
64
|
onClick?: ((...args: any[]) => any) | undefined;
|
|
70
|
-
onShow?: ((...args: any[]) => any) | undefined;
|
|
71
65
|
"onItem-up"?: ((...args: any[]) => any) | undefined;
|
|
72
66
|
"onItem-down"?: ((...args: any[]) => any) | undefined;
|
|
73
67
|
"onItem-drop"?: ((...args: any[]) => any) | undefined;
|
|
@@ -77,8 +71,6 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
|
|
|
77
71
|
editModeEnabled: boolean;
|
|
78
72
|
isDraggable: boolean;
|
|
79
73
|
sortable: boolean;
|
|
80
|
-
displayHiddenColumnsIndicator: boolean;
|
|
81
|
-
hiddenIsVisible: boolean;
|
|
82
74
|
addNavigation: boolean;
|
|
83
75
|
latestRow: boolean;
|
|
84
76
|
canDrop: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,5 @@ import "./../lkt-table.css";
|
|
|
5
5
|
declare const LktTable: Plugin;
|
|
6
6
|
export default LktTable;
|
|
7
7
|
export declare const setTableNavButtonSlot: (component: string | Component) => boolean;
|
|
8
|
-
export declare const setTableDropButtonSlot: (component: string | Component) => boolean;
|
|
9
8
|
export declare const setTableCreateButtonSlot: (component: string | Component) => boolean;
|
|
10
9
|
export declare const setTableEmptySlot: (component?: string | Component) => void;
|
|
11
|
-
export declare const setTableSaveIcon: (icon: string) => void;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Component } from "vue";
|
|
2
2
|
export declare class Settings {
|
|
3
3
|
static navButtonSlot: string | Component;
|
|
4
|
-
static dropButtonSlot: string | Component;
|
|
5
|
-
static editButtonSlot: string | Component;
|
|
6
4
|
static createButtonSlot: string | Component;
|
|
7
5
|
static defaultEmptySlot: string | Component | undefined;
|
|
8
|
-
static defaultSaveIcon: string;
|
|
9
|
-
static defaultNoResultsMessage: string;
|
|
10
6
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import {computed} from "vue";
|
|
3
3
|
import {Settings} from "../settings/Settings";
|
|
4
|
-
import {ButtonConfig, LktObject} from "lkt-vue-kernel";
|
|
4
|
+
import {ButtonConfig, LktObject, ModalConfig} from "lkt-vue-kernel";
|
|
5
5
|
|
|
6
6
|
const emit = defineEmits([
|
|
7
7
|
'click',
|
|
@@ -19,7 +19,7 @@ const props = withDefaults(defineProps<{
|
|
|
19
19
|
const hasCreateButtonSlot = computed(() => Settings.createButtonSlot !== ''),
|
|
20
20
|
createButtonSlot = computed(() => Settings.createButtonSlot);
|
|
21
21
|
|
|
22
|
-
const calculatedModalData = {
|
|
22
|
+
const calculatedModalData = <ModalConfig>{
|
|
23
23
|
...props.config?.modalData,
|
|
24
24
|
beforeClose: (data: LktObject) => {
|
|
25
25
|
// Checks lkt-item-crud as modal flow
|
|
@@ -9,16 +9,12 @@ import {
|
|
|
9
9
|
import LktTableCell from "./LktTableCell.vue";
|
|
10
10
|
import {computed, ref, useSlots, watch} from "vue";
|
|
11
11
|
import {Settings} from "../settings/Settings";
|
|
12
|
-
import
|
|
13
|
-
import EditButtonComponent from "./EditButtonComponent.vue";
|
|
14
|
-
import {replaceAll} from "lkt-string-tools";
|
|
15
|
-
import {ButtonConfig, Column, LktObject, TableRowType, ValidTableRowTypeValue} from "lkt-vue-kernel";
|
|
12
|
+
import {Column, LktObject, TableRowType, ValidTableRowTypeValue} from "lkt-vue-kernel";
|
|
16
13
|
|
|
17
14
|
const slots = useSlots();
|
|
18
15
|
const emit = defineEmits([
|
|
19
16
|
'update:modelValue',
|
|
20
17
|
'click',
|
|
21
|
-
'show',
|
|
22
18
|
'item-up',
|
|
23
19
|
'item-down',
|
|
24
20
|
'item-drop'
|
|
@@ -26,12 +22,8 @@ const emit = defineEmits([
|
|
|
26
22
|
|
|
27
23
|
const props = withDefaults(defineProps<{
|
|
28
24
|
modelValue: LktObject
|
|
29
|
-
editButton: ButtonConfig
|
|
30
|
-
dropButton: ButtonConfig
|
|
31
25
|
isDraggable: boolean
|
|
32
26
|
sortable: boolean
|
|
33
|
-
displayHiddenColumnsIndicator: boolean
|
|
34
|
-
hiddenIsVisible: boolean
|
|
35
27
|
isLoading: boolean
|
|
36
28
|
addNavigation: boolean
|
|
37
29
|
latestRow: boolean
|
|
@@ -52,8 +44,6 @@ const props = withDefaults(defineProps<{
|
|
|
52
44
|
modelValue: () => ({}),
|
|
53
45
|
isDraggable: true,
|
|
54
46
|
sortable: true,
|
|
55
|
-
displayHiddenColumnsIndicator: false,
|
|
56
|
-
hiddenIsVisible: false,
|
|
57
47
|
addNavigation: false,
|
|
58
48
|
latestRow: false,
|
|
59
49
|
canDrop: false,
|
|
@@ -76,13 +66,7 @@ if (!calculatedRowDisplayType) calculatedRowDisplayType = TableRowType.Auto;
|
|
|
76
66
|
const canCustomItem = [TableRowType.Auto, TableRowType.PreferCustomItem].includes(calculatedRowDisplayType);
|
|
77
67
|
const canItem = [TableRowType.Auto, TableRowType.PreferItem].includes(calculatedRowDisplayType);
|
|
78
68
|
|
|
79
|
-
const parsedEditLink = ref(props.editButton.anchor?.to);
|
|
80
|
-
for (let k in Item.value) parsedEditLink.value = replaceAll(parsedEditLink.value, ':' + k, Item.value[k]);
|
|
81
|
-
|
|
82
69
|
const onClick = ($event: any) => emit('click', $event),
|
|
83
|
-
onShow = ($event: any, i: any) => {
|
|
84
|
-
emit('show', $event, i)
|
|
85
|
-
},
|
|
86
70
|
classes = computed(() => {
|
|
87
71
|
let r: string[] = [];
|
|
88
72
|
|
|
@@ -172,9 +156,6 @@ const canRenderDragIndicator = computed(() => {
|
|
|
172
156
|
</lkt-button>
|
|
173
157
|
</div>
|
|
174
158
|
</td>
|
|
175
|
-
<td v-if="displayHiddenColumnsIndicator"
|
|
176
|
-
@click="onShow($event, i)" data-role="show-more"
|
|
177
|
-
:class="hiddenIsVisible ? 'state-open' : ''"/>
|
|
178
159
|
<template v-if="canCustomItem && slots[`item-${i}`]">
|
|
179
160
|
<td :key="'td' + i" :colspan="visibleColumns.length">
|
|
180
161
|
<slot
|
|
@@ -236,16 +217,5 @@ const canRenderDragIndicator = computed(() => {
|
|
|
236
217
|
</template>
|
|
237
218
|
</td>
|
|
238
219
|
</template>
|
|
239
|
-
<td v-if="canDrop && editModeEnabled" class="lkt-table-col-drop">
|
|
240
|
-
<drop-button-component
|
|
241
|
-
:config="dropButton"
|
|
242
|
-
:item="Item"
|
|
243
|
-
@click="onClickDrop"/>
|
|
244
|
-
</td>
|
|
245
|
-
<td v-if="canEdit && editModeEnabled" class="lkt-table-col-edit">
|
|
246
|
-
<edit-button-component
|
|
247
|
-
:config="editButton"
|
|
248
|
-
:item="Item"/>
|
|
249
|
-
</td>
|
|
250
220
|
</tr>
|
|
251
221
|
</template>
|
|
@@ -20,7 +20,6 @@ import {
|
|
|
20
20
|
TablePermission,
|
|
21
21
|
TableType
|
|
22
22
|
} from "lkt-vue-kernel";
|
|
23
|
-
import LktHiddenRow from "../components/LktHiddenRow.vue";
|
|
24
23
|
import {generateRandomString, replaceAll} from "lkt-string-tools";
|
|
25
24
|
import {DataState} from "lkt-data-state";
|
|
26
25
|
import {HTTPResponse} from "lkt-http-client";
|
|
@@ -52,13 +51,10 @@ const slots = useSlots();
|
|
|
52
51
|
//@ts-nocheck
|
|
53
52
|
const props = withDefaults(defineProps<TableConfig>(), getDefaultValues(Table));
|
|
54
53
|
|
|
55
|
-
const hiddenColumnsStack: LktObject = {};
|
|
56
|
-
|
|
57
54
|
const Sorter = ref(typeof props.sorter === 'function' ? props.sorter : defaultTableSorter),
|
|
58
55
|
SortBy = ref(getDefaultSortColumn(props.columns)),
|
|
59
56
|
SortingDirection = ref(SortDirection.Asc),
|
|
60
57
|
Items = ref(props.modelValue),
|
|
61
|
-
Hidden = ref(hiddenColumnsStack),
|
|
62
58
|
tableBody = ref(<HTMLElement | null>null),
|
|
63
59
|
Columns = ref(props.columns);
|
|
64
60
|
|
|
@@ -80,13 +76,11 @@ const Page = ref(props.paginator?.modelValue),
|
|
|
80
76
|
const safeSaveButton = ref(ensureButtonConfig(props.saveButton, LktSettings.defaultSaveButton)),
|
|
81
77
|
safeCreateButton = ref(ensureButtonConfig(props.createButton, LktSettings.defaultCreateButton)),
|
|
82
78
|
safeEditModeButton = ref(ensureButtonConfig(props.editModeButton, LktSettings.defaultEditModeButton)),
|
|
83
|
-
safeDropModeButton = ref(ensureButtonConfig(props.dropButton, LktSettings.defaultDropButton)),
|
|
84
79
|
safeGroupButton = ref(ensureButtonConfig(props.groupButton, LktSettings.defaultGroupButton));
|
|
85
80
|
|
|
86
81
|
watch(() => props.saveButton, (v) => safeSaveButton.value = ensureButtonConfig(props.saveButton, LktSettings.defaultSaveButton));
|
|
87
82
|
watch(() => props.createButton, (v) => safeCreateButton.value = ensureButtonConfig(props.createButton, LktSettings.defaultCreateButton));
|
|
88
83
|
watch(() => props.editModeButton, (v) => safeEditModeButton.value = ensureButtonConfig(props.editModeButton, LktSettings.defaultEditModeButton));
|
|
89
|
-
watch(() => props.dropButton, (v) => safeDropModeButton.value = ensureButtonConfig(props.dropButton, LktSettings.defaultDropButton));
|
|
90
84
|
|
|
91
85
|
const dataStateChanged = ref(false);
|
|
92
86
|
|
|
@@ -145,21 +139,9 @@ const emptyColumns = computed(() => {
|
|
|
145
139
|
visibleColumns = computed(() => {
|
|
146
140
|
return Columns.value.filter((c: Column) => !c.hidden);
|
|
147
141
|
}),
|
|
148
|
-
hiddenColumns = computed(() => {
|
|
149
|
-
return [];
|
|
150
|
-
return Columns.value.filter((c: Column) => c.hidden);
|
|
151
|
-
}),
|
|
152
|
-
hiddenColumnsColSpan = computed(() => {
|
|
153
|
-
let r = visibleColumns.value.length + 1;
|
|
154
|
-
if (props.sortable) ++r;
|
|
155
|
-
return r;
|
|
156
|
-
}),
|
|
157
142
|
rowKeyColumns = computed(() => {
|
|
158
143
|
return Columns.value.filter((c: Column) => c.isForRowKey);
|
|
159
144
|
}),
|
|
160
|
-
displayHiddenColumnsIndicator = computed(() => {
|
|
161
|
-
return hiddenColumns.value.length > 0 && !props.sortable;
|
|
162
|
-
}),
|
|
163
145
|
columnKeys = computed((): string[] => {
|
|
164
146
|
return Columns.value.map(c => c.key);
|
|
165
147
|
|
|
@@ -278,9 +260,6 @@ const getItemByEvent = (e: any) => {
|
|
|
278
260
|
getRowByIndex = (index: number) => {
|
|
279
261
|
return tableBody.value?.querySelector(`[data-i="${index}"]`);
|
|
280
262
|
},
|
|
281
|
-
isVisible = (index: number) => {
|
|
282
|
-
return Hidden.value['tr_' + index] === true;
|
|
283
|
-
},
|
|
284
263
|
sort = (column: Column | null) => {
|
|
285
264
|
if (!column) return;
|
|
286
265
|
if (column.sortable) {
|
|
@@ -296,10 +275,6 @@ const getItemByEvent = (e: any) => {
|
|
|
296
275
|
onClick = ($event: any) => {
|
|
297
276
|
emit('click', $event);
|
|
298
277
|
},
|
|
299
|
-
show = ($event: any, i: number) => {
|
|
300
|
-
let k = 'tr_' + i;
|
|
301
|
-
Hidden.value[k] = typeof Hidden.value[k] === 'undefined' ? true : !Hidden.value[k];
|
|
302
|
-
},
|
|
303
278
|
validDragChecker = (evt: any) => {
|
|
304
279
|
let targetIndex = parseInt(evt?.originalEvent?.toElement?.closest('tr')?.dataset?.i);
|
|
305
280
|
if (typeof props.drag?.isValid === 'function' && !props.drag?.isValid(Items.value[targetIndex])) return false;
|
|
@@ -713,7 +688,6 @@ const hasEmptySlot = computed(() => {
|
|
|
713
688
|
<tr>
|
|
714
689
|
<th v-if="computedDragModeEnabled && editModeEnabled" data-role="drag-indicator"/>
|
|
715
690
|
<th v-if="addNavigation && editModeEnabled"/>
|
|
716
|
-
<th v-if="displayHiddenColumnsIndicator"/>
|
|
717
691
|
<template v-for="column in visibleColumns">
|
|
718
692
|
<table-header
|
|
719
693
|
v-if="emptyColumns.indexOf(column.key) === -1"
|
|
@@ -725,14 +699,6 @@ const hasEmptySlot = computed(() => {
|
|
|
725
699
|
@click="sort(column)"
|
|
726
700
|
/>
|
|
727
701
|
</template>
|
|
728
|
-
<th
|
|
729
|
-
v-if="hasDropPerm && editModeEnabled"
|
|
730
|
-
class="lkt-table-col-drop"
|
|
731
|
-
/>
|
|
732
|
-
<th
|
|
733
|
-
v-if="hasEditPerm && hasUpdatePerm && editModeEnabled"
|
|
734
|
-
class="lkt-table-col-edit"
|
|
735
|
-
/>
|
|
736
702
|
</tr>
|
|
737
703
|
</thead>
|
|
738
704
|
<tbody
|
|
@@ -746,15 +712,11 @@ const hasEmptySlot = computed(() => {
|
|
|
746
712
|
v-show="canDisplayItem(Items[i], i)"
|
|
747
713
|
:key="getRowKey(item, i)"
|
|
748
714
|
:i="i"
|
|
749
|
-
:drop-button="safeDropModeButton"
|
|
750
|
-
:edit-button="editButton"
|
|
751
|
-
:display-hidden-columns-indicator="displayHiddenColumnsIndicator"
|
|
752
715
|
:is-draggable="isDraggable(item)"
|
|
753
716
|
:sortable="computedDragModeEnabled"
|
|
754
717
|
:visible-columns="visibleColumns"
|
|
755
718
|
:empty-columns="emptyColumns"
|
|
756
719
|
:add-navigation="addNavigation"
|
|
757
|
-
:hidden-is-visible="isVisible(i)"
|
|
758
720
|
:latest-row="i+1 === amountOfItems"
|
|
759
721
|
:can-drop="hasDropPerm && editModeEnabled"
|
|
760
722
|
:can-edit="hasEditPerm && hasUpdatePerm && editModeEnabled"
|
|
@@ -768,7 +730,6 @@ const hasEmptySlot = computed(() => {
|
|
|
768
730
|
:is-loading="isLoading"
|
|
769
731
|
:item-container-class="itemContainerClass"
|
|
770
732
|
@click="onClick"
|
|
771
|
-
@show="show"
|
|
772
733
|
@item-up="onItemUp"
|
|
773
734
|
@item-down="onItemDown"
|
|
774
735
|
@item-drop="onItemDrop"
|
|
@@ -812,35 +773,6 @@ const hasEmptySlot = computed(() => {
|
|
|
812
773
|
/>
|
|
813
774
|
</template>
|
|
814
775
|
</lkt-table-row>
|
|
815
|
-
<lkt-hidden-row
|
|
816
|
-
v-if="hiddenColumns.length > 0"
|
|
817
|
-
v-model="Items[i]"
|
|
818
|
-
v-for="(item, i) in Items"
|
|
819
|
-
:key="getRowKey(item, i, true)"
|
|
820
|
-
:i="i"
|
|
821
|
-
:hidden-columns="hiddenColumns"
|
|
822
|
-
:hidden-columns-col-span="hiddenColumnsColSpan"
|
|
823
|
-
:is-draggable="isDraggable(item)"
|
|
824
|
-
:sortable="computedDragModeEnabled"
|
|
825
|
-
:visible-columns="visibleColumns"
|
|
826
|
-
:empty-columns="emptyColumns"
|
|
827
|
-
:hidden-is-visible="isVisible(i)"
|
|
828
|
-
:edit-mode-enabled="editModeEnabled"
|
|
829
|
-
:has-inline-edit-perm="hasInlineEditPerm"
|
|
830
|
-
@click="onClick"
|
|
831
|
-
@show="show"
|
|
832
|
-
>
|
|
833
|
-
<template
|
|
834
|
-
v-for="column in colSlots"
|
|
835
|
-
v-slot:[column]="row">
|
|
836
|
-
<slot
|
|
837
|
-
:name="column"
|
|
838
|
-
:[slotItemVar]="row.item"
|
|
839
|
-
:value="row.value"
|
|
840
|
-
:column="row.column"
|
|
841
|
-
/>
|
|
842
|
-
</template>
|
|
843
|
-
</lkt-hidden-row>
|
|
844
776
|
</tbody>
|
|
845
777
|
</table>
|
|
846
778
|
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {computed} from "vue";
|
|
3
|
-
import {Settings} from "../settings/Settings";
|
|
4
|
-
import {ButtonConfig, LktObject, prepareResourceData} from "lkt-vue-kernel";
|
|
5
|
-
|
|
6
|
-
const emit = defineEmits([
|
|
7
|
-
'click'
|
|
8
|
-
]);
|
|
9
|
-
|
|
10
|
-
const props = withDefaults(defineProps<{
|
|
11
|
-
config: ButtonConfig
|
|
12
|
-
item: LktObject
|
|
13
|
-
disabled?: boolean
|
|
14
|
-
}>(), {
|
|
15
|
-
disabled: false,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const hasButtonSlot = computed(() => Settings.dropButtonSlot !== ''),
|
|
19
|
-
buttonSlot = computed(() => Settings.dropButtonSlot);
|
|
20
|
-
|
|
21
|
-
const computedResourceData = computed(() => {
|
|
22
|
-
return prepareResourceData(props.config.resourceData, props.item);
|
|
23
|
-
})
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<template>
|
|
27
|
-
<lkt-button
|
|
28
|
-
palette="table-delete"
|
|
29
|
-
v-bind="props.config"
|
|
30
|
-
:disabled="disabled"
|
|
31
|
-
:resource-data="computedResourceData"
|
|
32
|
-
@click.prevent.stop="emit('click', $event)">
|
|
33
|
-
<template v-if="hasButtonSlot">
|
|
34
|
-
<component :is="buttonSlot"/>
|
|
35
|
-
</template>
|
|
36
|
-
</lkt-button>
|
|
37
|
-
</template>
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import {computed} from "vue";
|
|
3
|
-
import {Settings} from "../settings/Settings";
|
|
4
|
-
import {ButtonConfig, LktObject, prepareResourceData} from "lkt-vue-kernel";
|
|
5
|
-
|
|
6
|
-
const emit = defineEmits([
|
|
7
|
-
'click'
|
|
8
|
-
]);
|
|
9
|
-
|
|
10
|
-
const props = withDefaults(defineProps<{
|
|
11
|
-
config: ButtonConfig
|
|
12
|
-
item: LktObject
|
|
13
|
-
disabled?: boolean
|
|
14
|
-
}>(), {
|
|
15
|
-
disabled: false,
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const hasButtonSlot = computed(() => Settings.editButtonSlot !== ''),
|
|
19
|
-
buttonSlot = computed(() => Settings.editButtonSlot);
|
|
20
|
-
|
|
21
|
-
const computedResourceData = computed(() => {
|
|
22
|
-
return prepareResourceData(props.config.resourceData, props.item);
|
|
23
|
-
})
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<template>
|
|
27
|
-
<lkt-button
|
|
28
|
-
palette="table-edit"
|
|
29
|
-
v-bind="props.config"
|
|
30
|
-
:disabled="disabled"
|
|
31
|
-
:resource-data="computedResourceData"
|
|
32
|
-
@click.prevent.stop="emit('click')">
|
|
33
|
-
<template v-if="hasButtonSlot">
|
|
34
|
-
<component :is="buttonSlot"/>
|
|
35
|
-
</template>
|
|
36
|
-
</lkt-button>
|
|
37
|
-
</template>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<script lang="ts" setup>
|
|
2
|
-
import {getColumnDisplayContent} from "../functions/table-functions";
|
|
3
|
-
import LktTableCell from "./LktTableCell.vue";
|
|
4
|
-
import {ref, watch} from "vue";
|
|
5
|
-
import {LktObject, Column} from "lkt-vue-kernel";
|
|
6
|
-
|
|
7
|
-
const emit = defineEmits([
|
|
8
|
-
'update:modelValue',
|
|
9
|
-
'click'
|
|
10
|
-
]);
|
|
11
|
-
|
|
12
|
-
const props = withDefaults(defineProps<{
|
|
13
|
-
modelValue: LktObject
|
|
14
|
-
isDraggable: boolean
|
|
15
|
-
sortable: boolean
|
|
16
|
-
hiddenIsVisible: boolean
|
|
17
|
-
i: number
|
|
18
|
-
hiddenColumnsColSpan: number
|
|
19
|
-
visibleColumns: Column[]
|
|
20
|
-
hiddenColumns: Column[]
|
|
21
|
-
emptyColumns: string[]
|
|
22
|
-
editModeEnabled: boolean
|
|
23
|
-
hasInlineEditPerm: boolean
|
|
24
|
-
}>(), {
|
|
25
|
-
modelValue: () => ({}),
|
|
26
|
-
isDraggable: true,
|
|
27
|
-
sortable: true,
|
|
28
|
-
hiddenIsVisible: false,
|
|
29
|
-
i: 0,
|
|
30
|
-
hiddenColumnsColSpan: 0,
|
|
31
|
-
visibleColumns: () => [],
|
|
32
|
-
hiddenColumns: () => [],
|
|
33
|
-
emptyColumns: () => [],
|
|
34
|
-
editModeEnabled: false,
|
|
35
|
-
hasInlineEditPerm: false,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const item = ref(props.modelValue);
|
|
39
|
-
|
|
40
|
-
const onClick = ($event: any) => emit('click', $event);
|
|
41
|
-
|
|
42
|
-
watch(() => props.modelValue, (v) => item.value = v);
|
|
43
|
-
watch(item, () => emit('update:modelValue', item.value));
|
|
44
|
-
</script>
|
|
45
|
-
|
|
46
|
-
<template>
|
|
47
|
-
<tr v-show="hiddenIsVisible" data-role="hidden-row">
|
|
48
|
-
<td :colspan="hiddenColumnsColSpan">
|
|
49
|
-
<table>
|
|
50
|
-
<tr>
|
|
51
|
-
<th v-for="column in hiddenColumns" :data-column="column.key">
|
|
52
|
-
<div>{{ column.label }}</div>
|
|
53
|
-
</th>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr :data-i="i">
|
|
56
|
-
<td v-for="(column, i) in hiddenColumns"
|
|
57
|
-
v-bind:data-column="column.key"
|
|
58
|
-
v-bind:title="getColumnDisplayContent (column, item, i, hiddenColumns)"
|
|
59
|
-
v-on:click="onClick($event)">
|
|
60
|
-
<template v-if="!!$slots[column.key]">
|
|
61
|
-
<slot v-bind:name="column.key"
|
|
62
|
-
v-bind:value="item[column.key]"
|
|
63
|
-
v-bind:item="item"
|
|
64
|
-
v-bind:column="column"
|
|
65
|
-
v-bind:i="i"/>
|
|
66
|
-
</template>
|
|
67
|
-
<template v-else>
|
|
68
|
-
<lkt-table-cell
|
|
69
|
-
:column="column"
|
|
70
|
-
:columns="hiddenColumns"
|
|
71
|
-
v-model="item"
|
|
72
|
-
:i="i"
|
|
73
|
-
:edit-mode-enabled="editModeEnabled"
|
|
74
|
-
:has-inline-edit-perm="hasInlineEditPerm"
|
|
75
|
-
/>
|
|
76
|
-
</template>
|
|
77
|
-
</td>
|
|
78
|
-
</tr>
|
|
79
|
-
</table>
|
|
80
|
-
</td>
|
|
81
|
-
</tr>
|
|
82
|
-
</template>
|