lkt-table 1.4.2 → 2.0.0

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.
@@ -3,14 +3,16 @@ import {defaultTableSorter, getColumnByKey, getDefaultSortColumn} from "../funct
3
3
  import LktTableRow from "../components/LktTableRow.vue";
4
4
  import {computed, nextTick, onMounted, ref, useSlots, watch} from "vue";
5
5
  import {
6
+ ButtonType,
6
7
  Column,
8
+ extractI18nValue,
9
+ getDefaultValues,
10
+ LktObject,
7
11
  SortDirection,
12
+ Table,
13
+ TableConfig,
8
14
  TablePermission,
9
- TableRowType,
10
- TableType,
11
- ValidTablePermission,
12
- ValidTableRowTypeValue,
13
- LktObject
15
+ TableType
14
16
  } from "lkt-vue-kernel";
15
17
  import LktHiddenRow from "../components/LktHiddenRow.vue";
16
18
  import {generateRandomString, replaceAll} from "lkt-string-tools";
@@ -19,7 +21,6 @@ import {HTTPResponse} from "lkt-http-client";
19
21
  import CreateButton from "../components/CreateButton.vue";
20
22
  import Sortable from 'sortablejs';
21
23
  import TableHeader from "../components/TableHeader.vue";
22
- import {__} from "lkt-i18n";
23
24
  import {time} from "lkt-date-tools";
24
25
  import {Settings} from "../settings/Settings";
25
26
 
@@ -40,156 +41,30 @@ const emit = defineEmits([
40
41
 
41
42
  const slots = useSlots();
42
43
 
43
- const props = withDefaults(defineProps<{
44
- modelValue: LktObject[]
45
- type?: TableType,
46
- columns: Column[]
47
- sorter?: Function
48
- draggableChecker?: Function
49
- checkValidDrag?: Function
50
- renderDrag?: boolean|Function
51
- disabledDrag?: boolean|Function
52
- sortable?: boolean
53
- hideEmptyColumns?: boolean
54
- initialSorting?: boolean
55
- draggableItemKey?: string
56
- itemDisplayChecker?: Function
57
- loading?: boolean
58
-
59
-
60
- page?: number
61
- perms?: ValidTablePermission[]
62
- resource?: string
63
- noResultsText?: string
64
- title?: string
65
- titleTag?: string
66
- titleIcon?: string
67
- headerClass?: string
68
- wrapContentTag?: string
69
- wrapContentClass?: string
70
- itemsContainerClass?: string
71
- filters?: LktObject[]
72
- dataStateConfig?: LktObject
73
- hiddenSave?: boolean
74
- editMode?: boolean
75
- saveDisabled?: boolean
76
- saveValidator?: Function
77
- saveConfirm?: string
78
- confirmData?: LktObject
79
- saveResource?: string
80
- saveResourceData?: LktObject
81
- saveTooltipEngine?: string
82
- splitSave?: boolean
83
- saveText?: string
84
- createText?: string
85
- createIcon?: string
86
- createRoute?: string
87
- dropText?: string
88
- dropIcon?: string
89
- editText?: string
90
- editIcon?: string
91
- editLink?: string
92
- editModeText?: string
93
- switchEditionEnabled?: boolean
94
- createDisabled?: boolean
95
- dropConfirm?: string
96
- dropResource?: string
97
- addNavigation?: boolean
98
- itemMode?: boolean
99
- createEnabledValidator?: Function
100
- newValueGenerator?: Function
101
- requiredItemsForTopCreate?: number
102
- requiredItemsForBottomCreate?: number
103
-
104
- slotItemVar?: string
105
- rowDisplayType?: ValidTableRowTypeValue
106
- modal?: string,
107
- modalData?: LktObject,
108
-
109
- }>(), {
110
- modelValue: () => [],
111
- type: TableType.Table,
112
- columns: () => [],
113
- sorter: defaultTableSorter,
114
- draggableChecker: (item: any) => true,
115
- checkValidDrag: undefined,
116
- renderDrag: true,
117
- sortable: false,
118
- hideEmptyColumns: false,
119
- initialSorting: false,
120
- draggableItemKey: 'name',
121
- loading: false,
122
-
123
-
124
- page: 1,
125
- perms: () => [],
126
- resource: '',
127
- noResultsText: Settings.defaultNoResultsMessage,
128
- title: '',
129
- titleTag: 'h2',
130
- titleIcon: '',
131
- headerClass: '',
132
- wrapContentTag: 'div',
133
- wrapContentClass: '',
134
- itemsContainerClass: '',
135
- saveTooltipEngine: 'absolute',
136
- filters: () => [],
137
- dataStateConfig: () => ({}),
138
- hiddenSave: false,
139
- editMode: false,
140
- saveDisabled: false,
141
- saveValidator: () => true,
142
- saveConfirm: '',
143
- confirmData: () => ({}),
144
- saveResource: '',
145
- saveResourceData: () => ({}),
146
- splitSave: false,
147
- saveText: 'Save',
148
- dropText: 'Delete',
149
- dropIcon: '',
150
- editText: 'Edit',
151
- editIcon: '',
152
- editLink: '',
153
- createText: 'Add item',
154
- createIcon: '',
155
- createRoute: '',
156
- editModeText: 'Edit mode',
157
- switchEditionEnabled: false,
158
- dropConfirm: '',
159
- dropResource: '',
160
- addNavigation: false,
161
- itemMode: false,
162
- createEnabledValidator: undefined,
163
- newValueGenerator: undefined,
164
- requiredItemsForTopCreate: 0,
165
- requiredItemsForBottomCreate: 0,
166
-
167
- slotItemVar: 'item',
168
- rowDisplayType: TableRowType.Auto,
169
- modal: ''
170
- });
44
+ //@ts-nocheck
45
+ const props = withDefaults(defineProps<TableConfig>(), getDefaultValues(Table));
171
46
 
172
47
  const hiddenColumnsStack: LktObject = {};
173
48
 
174
49
  const Sorter = ref(typeof props.sorter === 'function' ? props.sorter : defaultTableSorter),
175
50
  SortBy = ref(getDefaultSortColumn(props.columns)),
176
- SortingDirection = ref(<SortDirection>SortDirection.Asc),
51
+ SortingDirection = ref(SortDirection.Asc),
177
52
  Items = ref(props.modelValue),
178
53
  Hidden = ref(hiddenColumnsStack),
179
- tableBody = ref(<HTMLElement|null>null),
54
+ tableBody = ref(<HTMLElement | null>null),
180
55
  Columns = ref(props.columns);
181
56
 
182
- const Page = ref(props.page),
57
+ const Page = ref(props.paginator?.modelValue),
183
58
  isLoading = ref(props.loading),
184
59
  firstLoadReady = ref(false),
185
60
  permissions = ref(props.perms),
186
- paginator = ref(null),
61
+ paginatorRef = ref(null),
187
62
  element = ref(null),
188
63
  sortableObject = ref({}),
189
- dataState = ref(new DataState({items: Items.value}, props.dataStateConfig)),
64
+ dataState = ref(<DataState>new DataState({items: Items.value}, props.dataStateConfig)),
190
65
  editModeEnabled = ref(props.editMode),
191
66
  updateTimeStamp = ref(0),
192
- sortableContainer = ref(<HTMLElement|null>null)
67
+ sortableContainer = ref(<HTMLElement | null>null)
193
68
  ;
194
69
 
195
70
  const dataStateChanged = ref(false);
@@ -198,11 +73,6 @@ watch(isLoading, v => emit('update:loading', v));
198
73
 
199
74
  watch(Page, (v) => emit('page', v));
200
75
 
201
- const Type = ref(props.type);
202
- if (props.itemMode && Type.value === TableType.Table) {
203
- Type.value = TableType.Item;
204
- }
205
-
206
76
  const onPerms = (r: string[]) => {
207
77
  permissions.value = r;
208
78
  },
@@ -214,13 +84,14 @@ const onPerms = (r: string[]) => {
214
84
  dataState.value.store({items: Items.value}).turnStoredIntoOriginal();
215
85
  dataStateChanged.value = false;
216
86
  nextTick(() => {
87
+ saveIsDisabled.value; // Force calc call
217
88
  emit('read-response', r);
218
89
  })
219
90
  },
220
91
  onLoading = () => nextTick(() => isLoading.value = true),
221
92
  doRefresh = () => {
222
93
  //@ts-ignore
223
- paginator.value.doRefresh();
94
+ paginatorRef.value.doRefresh();
224
95
  };
225
96
 
226
97
 
@@ -273,7 +144,7 @@ const emptyColumns = computed(() => {
273
144
  showSaveButton = computed(() => {
274
145
  if (props.hiddenSave) return false;
275
146
  if (isLoading.value) return false;
276
- if (!props.saveResource) return false;
147
+ if (!(props.saveButton?.resource || props.saveButton.type)) return false;
277
148
  if (editModeEnabled.value && dataStateChanged.value) return true;
278
149
 
279
150
  return editModeEnabled.value;
@@ -283,10 +154,14 @@ const emptyColumns = computed(() => {
283
154
  if (props.switchEditionEnabled) return true;
284
155
  return showSaveButton.value || (editModeEnabled.value && hasCreatePerm.value);
285
156
  }),
286
- ableToSave = computed(() => {
287
- if (props.saveDisabled) return false;
288
- if (typeof props.saveValidator === 'function' && !props.saveValidator(Items.value)) return false;
289
- return dataStateChanged.value;
157
+ saveIsDisabled = computed(() => {
158
+ updateTimeStamp.value;
159
+ if (typeof props.saveButton?.disabled === 'function') return props.saveButton.disabled({
160
+ value: Items.value,
161
+ dataState: <DataState>dataState.value,
162
+ });
163
+ if (typeof props.saveButton?.disabled === 'boolean') return props.saveButton.disabled;
164
+ return !dataStateChanged.value;
290
165
  }),
291
166
  amountOfItems = computed(() => {
292
167
  return Items.value.length;
@@ -294,7 +169,7 @@ const emptyColumns = computed(() => {
294
169
  computedSaveResourceData = computed(() => {
295
170
  return {
296
171
  items: Items.value,
297
- ...props.saveResourceData
172
+ ...props.saveButton?.resourceData
298
173
  }
299
174
  }),
300
175
  computedTitleTag = computed(() => {
@@ -306,22 +181,13 @@ const emptyColumns = computed(() => {
306
181
  return props.wrapContentTag;
307
182
  }),
308
183
  computedTitle = computed(() => {
309
- if (props.title.startsWith('__:')) {
310
- return __(props.title.substring(3));
311
- }
312
- return props.title;
313
- }),
314
- computedSaveText = computed(() => {
315
- if (props.saveText.startsWith('__:')) {
316
- return __(props.saveText.substring(3));
317
- }
318
- return props.saveText;
184
+ return extractI18nValue(props.title);
319
185
  }),
320
186
  computedEditModeText = computed(() => {
321
- if (props.editModeText.startsWith('__:')) {
322
- return __(props.editModeText.substring(3));
323
- }
324
- return props.editModeText;
187
+ return extractI18nValue(props.editModeText);
188
+ }),
189
+ computedDragModeEnabled = computed(() => {
190
+ return props.drag?.enabled;
325
191
  }),
326
192
  hasCreatePerm = computed(() => permissions.value.includes(TablePermission.Create)),
327
193
  hasReadPerm = computed(() => permissions.value.includes('read')),
@@ -379,13 +245,12 @@ const getItemByEvent = (e: any) => {
379
245
  },
380
246
  validDragChecker = (evt: any) => {
381
247
  let targetIndex = parseInt(evt?.originalEvent?.toElement?.closest('tr')?.dataset?.i);
382
- if (typeof props.disabledDrag === 'function' && props.disabledDrag(Items.value[targetIndex])) return false;
383
- if (typeof props.disabledDrag === 'boolean' && props.disabledDrag) return false;
384
- if (typeof props.checkValidDrag === 'function') return props.checkValidDrag(evt);
248
+ if (typeof props.drag?.isValid === 'function' && !props.drag?.isValid(Items.value[targetIndex])) return false;
249
+ if (typeof props.drag?.isValid === 'boolean' && !props.drag?.isValid) return false;
385
250
  return true;
386
251
  },
387
252
  isDraggable = (element: any) => {
388
- if (typeof props.draggableChecker === 'function') return props.draggableChecker(element);
253
+ if (typeof props.drag?.isDraggable === 'function') return props.drag?.isDraggable(element);
389
254
  return true;
390
255
  },
391
256
  onClickAddItem = () => {
@@ -398,7 +263,7 @@ const getItemByEvent = (e: any) => {
398
263
  if (typeof props.newValueGenerator === 'function') {
399
264
  let newValue = props.newValueGenerator();
400
265
 
401
- if (typeof newValue === 'object' || Type.value !== TableType.Table) {
266
+ if (typeof newValue === 'object' || props.type !== TableType.Table) {
402
267
  Items.value.push(newValue);
403
268
  return;
404
269
  }
@@ -411,15 +276,21 @@ const getItemByEvent = (e: any) => {
411
276
  onAppend = (data: LktObject) => {
412
277
  Items.value.push(data);
413
278
  },
414
- onButtonLoading = () => {
415
- isLoading.value = true;
416
- },
417
- onButtonLoaded = () => {
418
- isLoading.value = false;
419
- },
279
+ onButtonLoading = () => isLoading.value = true,
280
+ onButtonLoaded = () => isLoading.value = false,
420
281
  onSave = ($event: PointerEvent, r: HTTPResponse) => {
282
+ if (props.saveButton?.type) {
283
+ if ([
284
+ ButtonType.Split,
285
+ ButtonType.SplitEver,
286
+ ButtonType.SplitLazy,
287
+ ].includes(props.saveButton?.type)) {
288
+ return;
289
+ }
290
+ }
291
+
421
292
  emit('before-save');
422
- if (props.saveResource) {
293
+ if (props.saveButton?.resource) {
423
294
  isLoading.value = false;
424
295
  if (!r.success) {
425
296
  emit('error', r.httpStatus);
@@ -511,6 +382,9 @@ const getItemByEvent = (e: any) => {
511
382
  || (hasInlineCreatePerm.value && editModeEnabled.value)
512
383
  || (hasModalCreatePerm.value && editModeEnabled.value);
513
384
  }),
385
+ computedIsList = computed(() => {
386
+ return [TableType.Ol, TableType.Ul].includes(props.type);
387
+ }),
514
388
  canDisplayItem = (item: LktObject, index: number) => {
515
389
  if (typeof props.itemDisplayChecker === 'function') return props.itemDisplayChecker(item);
516
390
  return true;
@@ -522,14 +396,14 @@ onMounted(() => {
522
396
  }
523
397
  dataState.value.store({items: Items.value}).turnStoredIntoOriginal();
524
398
  dataStateChanged.value = false;
525
- if (props.sortable) {
399
+ if (props.drag?.enabled) {
526
400
  nextTick(() => {
527
401
  initSortable();
528
402
  })
529
403
  }
530
404
  })
531
405
 
532
- watch(() => props.sortable, (v) => {
406
+ watch(() => props.drag?.enabled, (v) => {
533
407
  if (v) {
534
408
  initSortable();
535
409
  } else {
@@ -554,6 +428,12 @@ defineExpose({
554
428
  getRowByIndex,
555
429
  doRefresh,
556
430
  getHtml: () => element.value,
431
+ turnStoredIntoOriginal: () => {
432
+ dataState.value.turnStoredIntoOriginal();
433
+ nextTick(()=> {
434
+ updateTimeStamp.value = time();
435
+ })
436
+ },
557
437
  });
558
438
 
559
439
  const hasEmptySlot = computed(() => {
@@ -589,14 +469,9 @@ const hasEmptySlot = computed(() => {
589
469
  class="lkt-table--save-button"
590
470
  ref="saveButton"
591
471
  v-show="showSaveButton"
592
- :icon="Settings.defaultSaveIcon"
593
- :disabled="!ableToSave"
594
- :confirm-modal="saveConfirm"
595
- :confirm-data="confirmData"
596
- :resource="saveResource"
597
- :resource-data="computedSaveResourceData"
598
- :split="splitSave"
599
- :tooltip-engine="saveTooltipEngine"
472
+ v-bind="saveButton"
473
+ :disabled="saveIsDisabled"
474
+ :modal-data="computedSaveResourceData"
600
475
  v-on:loading="onButtonLoading"
601
476
  v-on:loaded="onButtonLoaded"
602
477
  v-on:click="onSave">
@@ -604,8 +479,7 @@ const hasEmptySlot = computed(() => {
604
479
  name="button-save"
605
480
  :items="Items"
606
481
  :edit-mode="editMode"
607
- :can-update="!saveDisabled"></slot>
608
- <span v-else>{{ computedSaveText }}</span>
482
+ :can-update="!saveIsDisabled"/>
609
483
 
610
484
  <template v-slot:split="{doClose, doRootClick}">
611
485
  <slot name="button-save-split"
@@ -613,18 +487,14 @@ const hasEmptySlot = computed(() => {
613
487
  :do-root-click="doRootClick"
614
488
  :data-state="dataState"
615
489
  :on-button-loading="onButtonLoading"
616
- :on-button-loaded="onButtonLoaded" />
490
+ :on-button-loaded="onButtonLoaded"/>
617
491
  </template>
618
492
  </lkt-button>
619
493
 
620
494
  <create-button
621
495
  v-if="computedDisplayCreateButton && Items.length >= requiredItemsForTopCreate"
496
+ :config="createButton"
622
497
  :disabled="!createEnabled || createDisabled"
623
- :text="createText"
624
- :icon="createIcon"
625
- :to="createRoute"
626
- :modal="modal"
627
- :modal-data="modalData"
628
498
  @click="onClickAddItem"
629
499
  @append="onAppend"
630
500
  />
@@ -650,11 +520,11 @@ const hasEmptySlot = computed(() => {
650
520
 
651
521
  <lkt-loader v-if="isLoading"/>
652
522
 
653
- <div v-show="!isLoading && Items.length > 0" class="lkt-table" :data-sortable="sortable">
654
- <table v-if="Type === TableType.Table">
523
+ <div v-show="!isLoading && Items.length > 0" class="lkt-table">
524
+ <table v-if="type === TableType.Table">
655
525
  <thead>
656
526
  <tr>
657
- <th v-if="sortable && editModeEnabled" data-role="drag-indicator"/>
527
+ <th v-if="computedDragModeEnabled && editModeEnabled" data-role="drag-indicator"/>
658
528
  <th v-if="addNavigation && editModeEnabled"/>
659
529
  <th v-if="displayHiddenColumnsIndicator"/>
660
530
  <template v-for="column in visibleColumns">
@@ -682,98 +552,98 @@ const hasEmptySlot = computed(() => {
682
552
  ref="tableBody"
683
553
  :id="'lkt-table-body-' + uniqueId"
684
554
  >
685
- <lkt-table-row
686
- v-for="(item, i) in Items"
687
- v-model="Items[i]"
688
- v-show="canDisplayItem(Items[i], i)"
689
- :key="getRowKey(item, i)"
690
- :i="i"
691
- :display-hidden-columns-indicator="displayHiddenColumnsIndicator"
692
- :is-draggable="isDraggable(item)"
693
- :sortable="sortable"
694
- :visible-columns="visibleColumns"
695
- :empty-columns="emptyColumns"
696
- :add-navigation="addNavigation"
697
- :hidden-is-visible="isVisible(i)"
698
- :latest-row="i+1 === amountOfItems"
699
- :can-drop="hasDropPerm && editModeEnabled"
700
- :drop-confirm="dropConfirm"
701
- :drop-resource="dropResource"
702
- :drop-text="dropText"
703
- :drop-icon="dropIcon"
704
- :can-edit="hasEditPerm && hasUpdatePerm && editModeEnabled"
705
- :edit-text="editText"
706
- :edit-icon="editIcon"
707
- :edit-link="editLink"
708
- :edit-mode-enabled="editModeEnabled"
709
- :has-inline-edit-perm="hasInlineEditPerm"
710
- :row-display-type="rowDisplayType"
711
- :render-drag="renderDrag"
712
- :disabled-drag="disabledDrag"
713
- v-on:click="onClick"
714
- v-on:show="show"
715
- v-on:item-up="onItemUp"
716
- v-on:item-down="onItemDown"
717
- v-on:item-drop="onItemDrop"
718
- >
719
- <template v-if="slots[`item-${i}`]" v-slot:[`item-${i}`]="row">
720
- <slot
721
- :name="`item-${i}`"
722
- :[slotItemVar]="row.item"
723
- v-bind:index="i"
724
- />
725
- </template>
726
- <template v-else-if="slots.item" #item="row">
727
- <slot
728
- name="item"
729
- :[slotItemVar]="row.item"
730
- v-bind:index="i"
731
- />
732
- </template>
733
- <template
734
- v-for="column in colSlots"
735
- v-slot:[column]="row">
736
- <slot
737
- :name="column"
738
- :[slotItemVar]="row.item"
739
- :value="row.value"
740
- :column="row.column"
741
- />
742
- </template>
743
- </lkt-table-row>
744
- <lkt-hidden-row
745
- v-if="hiddenColumns.length > 0"
746
- v-model="Items[i]"
747
- v-for="(item, i) in Items"
748
- :key="getRowKey(item, i, true)"
749
- :i="i"
750
- :hidden-columns="hiddenColumns"
751
- :hidden-columns-col-span="hiddenColumnsColSpan"
752
- :is-draggable="isDraggable(item)"
753
- :sortable="sortable"
754
- :visible-columns="visibleColumns"
755
- :empty-columns="emptyColumns"
756
- :hidden-is-visible="isVisible(i)"
757
- :edit-mode-enabled="editModeEnabled"
758
- :has-inline-edit-perm="hasInlineEditPerm"
759
- v-on:click="onClick"
760
- v-on:show="show"
761
- >
762
- <template
763
- v-for="column in colSlots"
764
- v-slot:[column]="row">
765
- <slot
766
- :name="column"
767
- :[slotItemVar]="row.item"
768
- :value="row.value"
769
- :column="row.column"
770
- />
771
- </template>
772
- </lkt-hidden-row>
555
+ <lkt-table-row
556
+ v-for="(item, i) in Items"
557
+ v-model="Items[i]"
558
+ v-show="canDisplayItem(Items[i], i)"
559
+ :key="getRowKey(item, i)"
560
+ :i="i"
561
+ :display-hidden-columns-indicator="displayHiddenColumnsIndicator"
562
+ :is-draggable="isDraggable(item)"
563
+ :sortable="computedDragModeEnabled"
564
+ :visible-columns="visibleColumns"
565
+ :empty-columns="emptyColumns"
566
+ :add-navigation="addNavigation"
567
+ :hidden-is-visible="isVisible(i)"
568
+ :latest-row="i+1 === amountOfItems"
569
+ :can-drop="hasDropPerm && editModeEnabled"
570
+ :drop-confirm="dropConfirm"
571
+ :drop-resource="dropResource"
572
+ :drop-text="dropText"
573
+ :drop-icon="dropIcon"
574
+ :can-edit="hasEditPerm && hasUpdatePerm && editModeEnabled"
575
+ :edit-text="editText"
576
+ :edit-icon="editIcon"
577
+ :edit-link="editLink"
578
+ :edit-mode-enabled="editModeEnabled"
579
+ :has-inline-edit-perm="hasInlineEditPerm"
580
+ :row-display-type="rowDisplayType"
581
+ :render-drag="drag?.canRender"
582
+ :disabled-drag="drag?.isDisabled"
583
+ v-on:click="onClick"
584
+ v-on:show="show"
585
+ v-on:item-up="onItemUp"
586
+ v-on:item-down="onItemDown"
587
+ v-on:item-drop="onItemDrop"
588
+ >
589
+ <template v-if="slots[`item-${i}`]" v-slot:[`item-${i}`]="row">
590
+ <slot
591
+ :name="`item-${i}`"
592
+ :[slotItemVar]="row.item"
593
+ v-bind:index="i"
594
+ />
595
+ </template>
596
+ <template v-else-if="slots.item" #item="row">
597
+ <slot
598
+ name="item"
599
+ :[slotItemVar]="row.item"
600
+ v-bind:index="i"
601
+ />
602
+ </template>
603
+ <template
604
+ v-for="column in colSlots"
605
+ v-slot:[column]="row">
606
+ <slot
607
+ :name="column"
608
+ :[slotItemVar]="row.item"
609
+ :value="row.value"
610
+ :column="row.column"
611
+ />
612
+ </template>
613
+ </lkt-table-row>
614
+ <lkt-hidden-row
615
+ v-if="hiddenColumns.length > 0"
616
+ v-model="Items[i]"
617
+ v-for="(item, i) in Items"
618
+ :key="getRowKey(item, i, true)"
619
+ :i="i"
620
+ :hidden-columns="hiddenColumns"
621
+ :hidden-columns-col-span="hiddenColumnsColSpan"
622
+ :is-draggable="isDraggable(item)"
623
+ :sortable="computedDragModeEnabled"
624
+ :visible-columns="visibleColumns"
625
+ :empty-columns="emptyColumns"
626
+ :hidden-is-visible="isVisible(i)"
627
+ :edit-mode-enabled="editModeEnabled"
628
+ :has-inline-edit-perm="hasInlineEditPerm"
629
+ v-on:click="onClick"
630
+ v-on:show="show"
631
+ >
632
+ <template
633
+ v-for="column in colSlots"
634
+ v-slot:[column]="row">
635
+ <slot
636
+ :name="column"
637
+ :[slotItemVar]="row.item"
638
+ :value="row.value"
639
+ :column="row.column"
640
+ />
641
+ </template>
642
+ </lkt-hidden-row>
773
643
  </tbody>
774
644
  </table>
775
645
 
776
- <div v-else-if="Type === TableType.Item"
646
+ <div v-else-if="type === TableType.Item"
777
647
  ref="tableBody"
778
648
  :id="'lkt-table-body-' + uniqueId"
779
649
  class="lkt-table-items-container"
@@ -800,26 +670,8 @@ const hasEmptySlot = computed(() => {
800
670
  </template>
801
671
  </div>
802
672
 
803
- <ul v-else-if="TableType.Ul" class="lkt-table-items-container" :class="itemsContainerClass">
804
- <template
805
- v-for="(item, i) in Items">
806
- <li class="lkt-table-item" v-if="canDisplayItem(item, i)" :data-i="i">
807
- <slot name="item"
808
- v-bind:[slotItemVar]="item"
809
- v-bind:index="i"
810
- v-bind:editing="editModeEnabled"
811
- v-bind:can-create="hasCreatePerm"
812
- v-bind:can-read="hasReadPerm"
813
- v-bind:can-update="hasUpdatePerm"
814
- v-bind:can-drop="hasDropPerm"
815
- v-bind:is-loading="isLoading"
816
- v-bind:do-drop="() => onItemDrop(i)"
817
- />
818
- </li>
819
- </template>
820
- </ul>
821
-
822
- <ol v-else-if="TableType.Ul" class="lkt-table-items-container" :class="itemsContainerClass">
673
+ <component :is="type" v-else-if="computedIsList" class="lkt-table-items-container"
674
+ :class="itemsContainerClass">
823
675
  <template
824
676
  v-for="(item, i) in Items">
825
677
  <li class="lkt-table-item" v-if="canDisplayItem(item, i)" :data-i="i">
@@ -836,7 +688,7 @@ const hasEmptySlot = computed(() => {
836
688
  />
837
689
  </li>
838
690
  </template>
839
- </ol>
691
+ </component>
840
692
  </div>
841
693
 
842
694
  <div class="lkt-table-empty" v-if="!isLoading && Items.length === 0">
@@ -855,12 +707,8 @@ const hasEmptySlot = computed(() => {
855
707
  class="lkt-table-page-buttons lkt-table-page-buttons-bottom">
856
708
  <create-button
857
709
  v-if="computedDisplayCreateButton && Items.length >= requiredItemsForBottomCreate"
710
+ :config="createButton"
858
711
  :disabled="!createEnabled || createDisabled"
859
- :text="createText"
860
- :icon="createIcon"
861
- :to="createRoute"
862
- :modal="modal"
863
- :modal-data="modalData"
864
712
  @click="onClickAddItem"
865
713
  @append="onAppend"
866
714
  />
@@ -868,7 +716,7 @@ const hasEmptySlot = computed(() => {
868
716
  </div>
869
717
 
870
718
  <lkt-paginator
871
- ref="paginator"
719
+ ref="paginatorRef"
872
720
  v-if="resource.length > 0"
873
721
  v-model="Page"
874
722
  :resource="resource"