lkt-table 2.0.7 → 2.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-table",
3
- "version": "2.0.7",
3
+ "version": "2.0.9",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lkt",
@@ -50,17 +50,18 @@
50
50
  "sortablejs": "^1.15.6"
51
51
  },
52
52
  "peerDependencies": {
53
- "lkt-button": "^2.0.7",
53
+ "lkt-button": "^2.0.8",
54
54
  "lkt-data-state": "^1.0.11",
55
55
  "lkt-date-tools": "^1.0.4",
56
- "lkt-field": "^1.0.0",
56
+ "lkt-field": "^1.2.1",
57
57
  "lkt-http-client": "^1.0.34",
58
- "lkt-i18n": "^1.0.6",
58
+ "lkt-i18n": "^1.1.0",
59
59
  "lkt-loader": "^1.2.0",
60
- "lkt-paginator": "^1.3.3",
60
+ "lkt-paginator": "^1.4.1",
61
61
  "lkt-string-tools": "^1.1.0",
62
- "lkt-vue-kernel": "^1.0.37",
62
+ "lkt-vue-kernel": "^1.0.42",
63
63
  "vue": "^3.3",
64
- "vue-router": "^4.2.5"
64
+ "vue-router": "^4.2.5",
65
+ "vue3-carousel": "^0.14.0"
65
66
  }
66
67
  }
@@ -3,7 +3,10 @@ import {computed} from "vue";
3
3
  import {Settings} from "../settings/Settings";
4
4
  import {ButtonConfig, LktObject} from "lkt-vue-kernel";
5
5
 
6
- const emit = defineEmits(['click', 'append']);
6
+ const emit = defineEmits([
7
+ 'click',
8
+ 'append'
9
+ ]);
7
10
 
8
11
  const props = withDefaults(defineProps<{
9
12
  config?: ButtonConfig
@@ -3,7 +3,9 @@ import {computed} from "vue";
3
3
  import {Settings} from "../settings/Settings";
4
4
  import {ButtonConfig, LktObject, prepareResourceData} from "lkt-vue-kernel";
5
5
 
6
- const emit = defineEmits(['click']);
6
+ const emit = defineEmits([
7
+ 'click'
8
+ ]);
7
9
 
8
10
  const props = withDefaults(defineProps<{
9
11
  config: ButtonConfig
@@ -3,7 +3,9 @@ import {computed} from "vue";
3
3
  import {Settings} from "../settings/Settings";
4
4
  import {ButtonConfig, LktObject, prepareResourceData} from "lkt-vue-kernel";
5
5
 
6
- const emit = defineEmits(['click']);
6
+ const emit = defineEmits([
7
+ 'click'
8
+ ]);
7
9
 
8
10
  const props = withDefaults(defineProps<{
9
11
  config: ButtonConfig
@@ -4,7 +4,10 @@ import LktTableCell from "./LktTableCell.vue";
4
4
  import {ref, watch} from "vue";
5
5
  import {LktObject, Column} from "lkt-vue-kernel";
6
6
 
7
- const emit = defineEmits(['update:modelValue', 'click']);
7
+ const emit = defineEmits([
8
+ 'update:modelValue',
9
+ 'click'
10
+ ]);
8
11
 
9
12
  const props = withDefaults(defineProps<{
10
13
  modelValue: LktObject
@@ -3,7 +3,9 @@ import {getColumnDisplayContent} from "../functions/table-functions";
3
3
  import {computed, ref, watch} from "vue";
4
4
  import {Column, ColumnType, LktObject} from "lkt-vue-kernel";
5
5
 
6
- const emit = defineEmits(['update:modelValue']);
6
+ const emit = defineEmits([
7
+ 'update:modelValue'
8
+ ]);
7
9
 
8
10
  const props = withDefaults(defineProps<{
9
11
  modelValue: LktObject
@@ -15,7 +15,14 @@ import {replaceAll} from "lkt-string-tools";
15
15
  import {ButtonConfig, Column, LktObject, TableRowType, ValidTableRowTypeValue} from "lkt-vue-kernel";
16
16
 
17
17
  const slots = useSlots();
18
- const emit = defineEmits(['update:modelValue', 'click', 'show', 'item-up', 'item-down', 'item-drop']);
18
+ const emit = defineEmits([
19
+ 'update:modelValue',
20
+ 'click',
21
+ 'show',
22
+ 'item-up',
23
+ 'item-down',
24
+ 'item-drop'
25
+ ]);
19
26
 
20
27
  const props = withDefaults(defineProps<{
21
28
  modelValue: LktObject
@@ -3,7 +3,9 @@ import {getColumnClasses, getVerticalColSpan} from "../functions/table-functions
3
3
  import {Column, extractI18nValue, LktObject, LktSettings, SortDirection} from "lkt-vue-kernel";
4
4
  import {computed} from "vue";
5
5
 
6
- const emit = defineEmits(['click']);
6
+ const emit = defineEmits([
7
+ 'click'
8
+ ]);
7
9
 
8
10
  const props = withDefaults(defineProps<{
9
11
  column: Column,
@@ -1,4 +1,5 @@
1
1
  <script lang="ts" setup>
2
+ import {Carousel, Slide, Navigation, Pagination} from "vue3-carousel";
2
3
  import {defaultTableSorter, getColumnByKey, getDefaultSortColumn} from "../functions/table-functions";
3
4
  import LktTableRow from "../components/LktTableRow.vue";
4
5
  import {computed, nextTick, onMounted, ref, useSlots, watch} from "vue";
@@ -68,7 +69,8 @@ const Page = ref(props.paginator?.modelValue),
68
69
  dataState = ref(<DataState>new DataState({items: Items.value}, props.dataStateConfig)),
69
70
  editModeEnabled = ref(props.editMode),
70
71
  updateTimeStamp = ref(0),
71
- sortableContainer = ref(<HTMLElement | null>null)
72
+ sortableContainer = ref(<HTMLElement | null>null),
73
+ currentSlide = ref(props.carousel?.currentSlide || 0)
72
74
  ;
73
75
 
74
76
  const safeSaveButton = ref(ensureButtonConfig(props.saveButton, LktSettings.defaultSaveButton));
@@ -156,6 +158,11 @@ const emptyColumns = computed(() => {
156
158
  for (let k in slots) if (columnKeys.value.indexOf(k) !== -1) r.push(k);
157
159
  return r;
158
160
  }),
161
+ slides = computed((): LktObject => {
162
+ let r = [];
163
+ for (let k in slots) if (k.indexOf('slide-') !== -1) r.push(k);
164
+ return r;
165
+ }),
159
166
  showSaveButton = computed(() => {
160
167
  if (props.hiddenSave) return false;
161
168
  if (isLoading.value) return false;
@@ -725,6 +732,48 @@ const hasEmptySlot = computed(() => {
725
732
  </li>
726
733
  </template>
727
734
  </component>
735
+
736
+ <div v-else-if="type === TableType.Carousel"
737
+ ref="tableBody"
738
+ :id="'lkt-table-body-' + uniqueId"
739
+ class="lkt-table-items-container"
740
+ :class="itemsContainerClass">
741
+ <carousel
742
+ v-model="currentSlide"
743
+ v-bind="carousel"
744
+ >
745
+ <template v-for="(slide, i) in slides" :key="slide">
746
+ <slide :index="i">
747
+ <div class="lkt-carousel-slide">
748
+ <slot :name="slide"/>
749
+ </div>
750
+ </slide>
751
+ </template>
752
+
753
+ <template v-for="(item, i) in Items" :key="slide">
754
+ <slide :index="i">
755
+ <div class="lkt-carousel-slide">
756
+ <slot name="item"
757
+ v-bind:[slotItemVar]="item"
758
+ v-bind:index="i"
759
+ v-bind:editing="editModeEnabled"
760
+ v-bind:can-create="hasCreatePerm"
761
+ v-bind:can-read="hasReadPerm"
762
+ v-bind:can-update="hasUpdatePerm"
763
+ v-bind:can-drop="hasDropPerm"
764
+ v-bind:is-loading="isLoading"
765
+ v-bind:do-drop="() => onItemDrop(i)"
766
+ />
767
+ </div>
768
+ </slide>
769
+ </template>
770
+
771
+ <template #addons>
772
+ <Navigation />
773
+ <Pagination />
774
+ </template>
775
+ </carousel>
776
+ </div>
728
777
  </div>
729
778
 
730
779
  <div class="lkt-table-empty" v-if="!isLoading && Items.length === 0">