lkt-table 2.0.13 → 2.0.15
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.js +899 -869
- package/dist/components/LktTableRow.vue.d.ts +20 -3
- package/package.json +4 -4
- package/src/components/LktTableRow.vue +34 -17
- package/src/lib-components/LktTable.vue +34 -8
|
@@ -14,10 +14,13 @@ type __VLS_Props = {
|
|
|
14
14
|
sortable: boolean;
|
|
15
15
|
displayHiddenColumnsIndicator: boolean;
|
|
16
16
|
hiddenIsVisible: boolean;
|
|
17
|
+
isLoading: boolean;
|
|
17
18
|
addNavigation: boolean;
|
|
18
19
|
latestRow: boolean;
|
|
19
20
|
canDrop: boolean;
|
|
20
21
|
canEdit: boolean;
|
|
22
|
+
canCreate: boolean;
|
|
23
|
+
canRead: boolean;
|
|
21
24
|
editModeEnabled: boolean;
|
|
22
25
|
hasInlineEditPerm: boolean;
|
|
23
26
|
i: number;
|
|
@@ -30,15 +33,29 @@ type __VLS_Props = {
|
|
|
30
33
|
declare const Item: import("vue").Ref<LktObject, LktObject>;
|
|
31
34
|
declare const canCustomItem: boolean;
|
|
32
35
|
declare const canItem: boolean;
|
|
33
|
-
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
|
|
34
|
-
declare const canRenderDragIndicator: import("vue").ComputedRef<any>;
|
|
36
|
+
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;
|
|
37
|
+
declare const canRenderDragIndicator: import("vue").ComputedRef<any>, computedDragIndicatorRole: import("vue").ComputedRef<"drag-indicator" | "invalid-drag-indicator">;
|
|
35
38
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
36
39
|
declare var __VLS_26: `item-${number}`, __VLS_27: {
|
|
37
40
|
item: LktObject;
|
|
38
41
|
index: number;
|
|
42
|
+
editing: boolean;
|
|
43
|
+
canCreate: boolean;
|
|
44
|
+
canRead: boolean;
|
|
45
|
+
canUpdate: boolean;
|
|
46
|
+
canDrop: boolean;
|
|
47
|
+
isLoading: boolean;
|
|
48
|
+
doDrop: () => void;
|
|
39
49
|
}, __VLS_29: {
|
|
40
50
|
item: LktObject;
|
|
41
51
|
index: number;
|
|
52
|
+
editing: boolean;
|
|
53
|
+
canCreate: boolean;
|
|
54
|
+
canRead: boolean;
|
|
55
|
+
canUpdate: boolean;
|
|
56
|
+
canDrop: boolean;
|
|
57
|
+
isLoading: boolean;
|
|
58
|
+
doDrop: () => void;
|
|
42
59
|
}, __VLS_32: string, __VLS_33: {
|
|
43
60
|
value: any;
|
|
44
61
|
item: LktObject;
|
|
@@ -73,8 +90,8 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
|
|
|
73
90
|
onClickUp: typeof onClickUp;
|
|
74
91
|
onClickDown: typeof onClickDown;
|
|
75
92
|
onClickDrop: typeof onClickDrop;
|
|
76
|
-
onClickEdit: typeof onClickEdit;
|
|
77
93
|
canRenderDragIndicator: typeof canRenderDragIndicator;
|
|
94
|
+
computedDragIndicatorRole: typeof computedDragIndicatorRole;
|
|
78
95
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
79
96
|
"update:modelValue": (...args: any[]) => void;
|
|
80
97
|
click: (...args: any[]) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lkt-table",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lkt",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
"sortablejs": "^1.15.6"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"lkt-button": "^2.0.
|
|
53
|
+
"lkt-button": "^2.0.12",
|
|
54
54
|
"lkt-data-state": "^1.0.11",
|
|
55
55
|
"lkt-date-tools": "^1.0.4",
|
|
56
|
-
"lkt-field": "^1.2.
|
|
56
|
+
"lkt-field": "^1.2.6",
|
|
57
57
|
"lkt-http-client": "^1.0.34",
|
|
58
58
|
"lkt-i18n": "^1.1.0",
|
|
59
59
|
"lkt-loader": "^1.2.0",
|
|
60
60
|
"lkt-paginator": "^1.4.1",
|
|
61
61
|
"lkt-string-tools": "^1.1.0",
|
|
62
|
-
"lkt-vue-kernel": "^1.0.
|
|
62
|
+
"lkt-vue-kernel": "^1.0.51",
|
|
63
63
|
"vue": "^3.3",
|
|
64
64
|
"vue-router": "^4.2.5",
|
|
65
65
|
"vue3-carousel": "^0.14.0"
|
|
@@ -32,10 +32,13 @@ const props = withDefaults(defineProps<{
|
|
|
32
32
|
sortable: boolean
|
|
33
33
|
displayHiddenColumnsIndicator: boolean
|
|
34
34
|
hiddenIsVisible: boolean
|
|
35
|
+
isLoading: boolean
|
|
35
36
|
addNavigation: boolean
|
|
36
37
|
latestRow: boolean
|
|
37
38
|
canDrop: boolean
|
|
38
39
|
canEdit: boolean
|
|
40
|
+
canCreate: boolean
|
|
41
|
+
canRead: boolean
|
|
39
42
|
editModeEnabled: boolean
|
|
40
43
|
hasInlineEditPerm: boolean
|
|
41
44
|
i: number
|
|
@@ -104,10 +107,6 @@ const onClick = ($event: any) => emit('click', $event),
|
|
|
104
107
|
},
|
|
105
108
|
onClickDrop = () => {
|
|
106
109
|
emit('item-drop', props.i);
|
|
107
|
-
},
|
|
108
|
-
onClickEdit = () => {
|
|
109
|
-
|
|
110
|
-
// emit('item-drop', props.i);
|
|
111
110
|
};
|
|
112
111
|
|
|
113
112
|
watch(() => props.modelValue, (v) => Item.value = v);
|
|
@@ -122,16 +121,17 @@ const canRenderDragIndicator = computed(() => {
|
|
|
122
121
|
computedDisabledDrag = computed(() => {
|
|
123
122
|
if (typeof props.disabledDrag === 'function') return props.disabledDrag(Item.value);
|
|
124
123
|
return props.disabledDrag === true;
|
|
124
|
+
}),
|
|
125
|
+
computedDragIndicatorRole = computed(() => {
|
|
126
|
+
if (classes.value.includes('handle')) return 'drag-indicator';
|
|
127
|
+
return 'invalid-drag-indicator';
|
|
125
128
|
})
|
|
126
129
|
</script>
|
|
127
130
|
|
|
128
131
|
<template>
|
|
129
132
|
<tr :data-i="i" :data-draggable="isDraggable" :class="{'type-custom-item': canCustomItem, 'type-item': canItem}">
|
|
130
|
-
<td v-if="sortable &&
|
|
131
|
-
data-role="
|
|
132
|
-
<i class="lkt-icn-drag-indicator"/>
|
|
133
|
-
</td>
|
|
134
|
-
<td v-else-if="sortable && editModeEnabled && canRenderDragIndicator" data-role="invalid-drag-indicator">
|
|
133
|
+
<td v-if="sortable && editModeEnabled && canRenderDragIndicator"
|
|
134
|
+
:data-role="computedDragIndicatorRole" :class="classes" :data-i="i">
|
|
135
135
|
<i class="lkt-icn-drag-indicator"/>
|
|
136
136
|
</td>
|
|
137
137
|
<td v-if="addNavigation && editModeEnabled" class="lkt-table-nav-cell">
|
|
@@ -143,7 +143,7 @@ const canRenderDragIndicator = computed(() => {
|
|
|
143
143
|
direction="up"/>
|
|
144
144
|
</template>
|
|
145
145
|
<template v-else>
|
|
146
|
-
<i class=""/>
|
|
146
|
+
<i class="lkt-icn-arrow-top"/>
|
|
147
147
|
</template>
|
|
148
148
|
</lkt-button>
|
|
149
149
|
<lkt-button palette="table-nav" :disabled="latestRow" @click="onClickDown">
|
|
@@ -153,7 +153,7 @@ const canRenderDragIndicator = computed(() => {
|
|
|
153
153
|
direction="down"/>
|
|
154
154
|
</template>
|
|
155
155
|
<template v-else>
|
|
156
|
-
<i class=""/>
|
|
156
|
+
<i class="lkt-icn-arrow-bottom"/>
|
|
157
157
|
</template>
|
|
158
158
|
</lkt-button>
|
|
159
159
|
</div>
|
|
@@ -166,7 +166,15 @@ const canRenderDragIndicator = computed(() => {
|
|
|
166
166
|
<slot
|
|
167
167
|
:name="`item-${i}`"
|
|
168
168
|
:item="Item"
|
|
169
|
-
v-bind:index="i"
|
|
169
|
+
v-bind:index="i"
|
|
170
|
+
v-bind:editing="editModeEnabled"
|
|
171
|
+
v-bind:can-create="canCreate"
|
|
172
|
+
v-bind:can-read="canRead"
|
|
173
|
+
v-bind:can-update="canEdit"
|
|
174
|
+
v-bind:can-drop="canDrop"
|
|
175
|
+
v-bind:is-loading="isLoading"
|
|
176
|
+
v-bind:do-drop="() => onClickDrop()"
|
|
177
|
+
/>
|
|
170
178
|
</td>
|
|
171
179
|
</template>
|
|
172
180
|
<template v-else-if="canItem && slots.item">
|
|
@@ -174,7 +182,15 @@ const canRenderDragIndicator = computed(() => {
|
|
|
174
182
|
<slot
|
|
175
183
|
name="item"
|
|
176
184
|
:item="Item"
|
|
177
|
-
v-bind:index="i"
|
|
185
|
+
v-bind:index="i"
|
|
186
|
+
v-bind:editing="editModeEnabled"
|
|
187
|
+
v-bind:can-create="canCreate"
|
|
188
|
+
v-bind:can-read="canRead"
|
|
189
|
+
v-bind:can-update="canEdit"
|
|
190
|
+
v-bind:can-drop="canDrop"
|
|
191
|
+
v-bind:is-loading="isLoading"
|
|
192
|
+
v-bind:do-drop="() => onClickDrop()"
|
|
193
|
+
/>
|
|
178
194
|
</td>
|
|
179
195
|
</template>
|
|
180
196
|
<template v-else v-for="column in visibleColumns">
|
|
@@ -191,7 +207,8 @@ const canRenderDragIndicator = computed(() => {
|
|
|
191
207
|
:value="Item[column.key]"
|
|
192
208
|
:item="Item"
|
|
193
209
|
:column="column"
|
|
194
|
-
:i="i"
|
|
210
|
+
:i="i"
|
|
211
|
+
/>
|
|
195
212
|
</template>
|
|
196
213
|
<template v-else-if="Item">
|
|
197
214
|
<lkt-table-cell
|
|
@@ -200,7 +217,8 @@ const canRenderDragIndicator = computed(() => {
|
|
|
200
217
|
:columns="visibleColumns"
|
|
201
218
|
:edit-mode-enabled="editModeEnabled"
|
|
202
219
|
:has-inline-edit-perm="hasInlineEditPerm"
|
|
203
|
-
:i="i"
|
|
220
|
+
:i="i"
|
|
221
|
+
/>
|
|
204
222
|
</template>
|
|
205
223
|
</td>
|
|
206
224
|
</template>
|
|
@@ -213,8 +231,7 @@ const canRenderDragIndicator = computed(() => {
|
|
|
213
231
|
<td v-if="canEdit && editModeEnabled" class="lkt-table-col-edit">
|
|
214
232
|
<edit-button-component
|
|
215
233
|
:config="editButton"
|
|
216
|
-
:item="Item"
|
|
217
|
-
@click="onClickEdit"/>
|
|
234
|
+
:item="Item"/>
|
|
218
235
|
</td>
|
|
219
236
|
</tr>
|
|
220
237
|
</template>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import {Carousel,
|
|
2
|
+
import {Carousel, Navigation, Pagination, Slide} from "vue3-carousel";
|
|
3
3
|
import {defaultTableSorter, getColumnByKey, getDefaultSortColumn} from "../functions/table-functions";
|
|
4
4
|
import LktTableRow from "../components/LktTableRow.vue";
|
|
5
5
|
import {computed, nextTick, onMounted, ref, useSlots, watch} from "vue";
|
|
6
6
|
import {
|
|
7
|
+
ButtonConfig,
|
|
7
8
|
ButtonType,
|
|
8
9
|
Column,
|
|
9
10
|
ensureButtonConfig,
|
|
@@ -78,6 +79,11 @@ const safeCreateButton = ref(ensureButtonConfig(props.createButton, LktSettings.
|
|
|
78
79
|
const safeEditModeButton = ref(ensureButtonConfig(props.editModeButton, LktSettings.defaultEditModeButton));
|
|
79
80
|
const safeDropModeButton = ref(ensureButtonConfig(props.dropButton, LktSettings.defaultDropButton));
|
|
80
81
|
|
|
82
|
+
watch(() => props.saveButton, (v) => safeSaveButton.value = ensureButtonConfig(props.saveButton, LktSettings.defaultSaveButton));
|
|
83
|
+
watch(() => props.createButton, (v) => safeCreateButton.value = ensureButtonConfig(props.createButton, LktSettings.defaultCreateButton));
|
|
84
|
+
watch(() => props.editModeButton, (v) => safeEditModeButton.value = ensureButtonConfig(props.editModeButton, LktSettings.defaultEditModeButton));
|
|
85
|
+
watch(() => props.dropButton, (v) => safeDropModeButton.value = ensureButtonConfig(props.dropButton, LktSettings.defaultDropButton));
|
|
86
|
+
|
|
81
87
|
const dataStateChanged = ref(false);
|
|
82
88
|
|
|
83
89
|
watch(isLoading, v => emit('update:loading', v));
|
|
@@ -521,14 +527,16 @@ const hasEmptySlot = computed(() => {
|
|
|
521
527
|
>
|
|
522
528
|
<div
|
|
523
529
|
class="lkt-table-page-buttons"
|
|
524
|
-
v-
|
|
530
|
+
v-show="showEditionButtons">
|
|
525
531
|
<lkt-button
|
|
526
532
|
class="lkt-table--save-button"
|
|
527
533
|
ref="saveButtonRef"
|
|
528
534
|
v-show="showSaveButton"
|
|
529
|
-
v-bind="
|
|
530
|
-
|
|
531
|
-
|
|
535
|
+
v-bind="<ButtonConfig>{
|
|
536
|
+
...safeSaveButton,
|
|
537
|
+
disabled: saveIsDisabled,
|
|
538
|
+
resourceData: computedSaveResourceData
|
|
539
|
+
}"
|
|
532
540
|
@loading="onButtonLoading"
|
|
533
541
|
@loaded="onButtonLoaded"
|
|
534
542
|
@click="onSave">
|
|
@@ -544,7 +552,8 @@ const hasEmptySlot = computed(() => {
|
|
|
544
552
|
:do-root-click="doRootClick"
|
|
545
553
|
:data-state="dataState"
|
|
546
554
|
:on-button-loading="onButtonLoading"
|
|
547
|
-
:on-button-loaded="onButtonLoaded"
|
|
555
|
+
:on-button-loaded="onButtonLoaded"
|
|
556
|
+
/>
|
|
548
557
|
</template>
|
|
549
558
|
</lkt-button>
|
|
550
559
|
|
|
@@ -557,10 +566,10 @@ const hasEmptySlot = computed(() => {
|
|
|
557
566
|
/>
|
|
558
567
|
|
|
559
568
|
<div class="switch-edition-mode">
|
|
560
|
-
<lkt-
|
|
569
|
+
<lkt-button
|
|
561
570
|
v-bind="safeEditModeButton"
|
|
562
571
|
v-show="showSwitchButton"
|
|
563
|
-
v-model="editModeEnabled"/>
|
|
572
|
+
v-model:checked="editModeEnabled"/>
|
|
564
573
|
</div>
|
|
565
574
|
</div>
|
|
566
575
|
|
|
@@ -625,11 +634,14 @@ const hasEmptySlot = computed(() => {
|
|
|
625
634
|
:latest-row="i+1 === amountOfItems"
|
|
626
635
|
:can-drop="hasDropPerm && editModeEnabled"
|
|
627
636
|
:can-edit="hasEditPerm && hasUpdatePerm && editModeEnabled"
|
|
637
|
+
:can-read="hasReadPerm"
|
|
638
|
+
:can-create="hasCreatePerm"
|
|
628
639
|
:edit-mode-enabled="editModeEnabled"
|
|
629
640
|
:has-inline-edit-perm="hasInlineEditPerm"
|
|
630
641
|
:row-display-type="rowDisplayType"
|
|
631
642
|
:render-drag="computedRenderDrag"
|
|
632
643
|
:disabled-drag="computedDisabledDrag"
|
|
644
|
+
:is-loading="isLoading"
|
|
633
645
|
@click="onClick"
|
|
634
646
|
@show="show"
|
|
635
647
|
@item-up="onItemUp"
|
|
@@ -641,6 +653,13 @@ const hasEmptySlot = computed(() => {
|
|
|
641
653
|
:name="`item-${i}`"
|
|
642
654
|
:[slotItemVar]="row.item"
|
|
643
655
|
v-bind:index="i"
|
|
656
|
+
v-bind:editing="row.editing"
|
|
657
|
+
v-bind:can-create="row.canCreate"
|
|
658
|
+
v-bind:can-read="row.canRead"
|
|
659
|
+
v-bind:can-update="row.canUpdate"
|
|
660
|
+
v-bind:can-drop="row.canDrop"
|
|
661
|
+
v-bind:is-loading="row.isLoading"
|
|
662
|
+
v-bind:do-drop="row.doDrop"
|
|
644
663
|
/>
|
|
645
664
|
</template>
|
|
646
665
|
<template v-else-if="slots.item" #item="row">
|
|
@@ -648,6 +667,13 @@ const hasEmptySlot = computed(() => {
|
|
|
648
667
|
name="item"
|
|
649
668
|
:[slotItemVar]="row.item"
|
|
650
669
|
v-bind:index="i"
|
|
670
|
+
v-bind:editing="row.editing"
|
|
671
|
+
v-bind:can-create="row.canCreate"
|
|
672
|
+
v-bind:can-read="row.canRead"
|
|
673
|
+
v-bind:can-update="row.canUpdate"
|
|
674
|
+
v-bind:can-drop="row.canDrop"
|
|
675
|
+
v-bind:is-loading="row.isLoading"
|
|
676
|
+
v-bind:do-drop="row.doDrop"
|
|
651
677
|
/>
|
|
652
678
|
</template>
|
|
653
679
|
<template
|