lkt-table 2.0.40 → 2.0.41

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.
@@ -1,4 +1,5 @@
1
- import { Column, LktObject, ValidTableRowTypeValue } from "lkt-vue-kernel";
1
+ import { Component } from "vue";
2
+ import { Column, LktObject, TablePermission, ValidTableRowTypeValue } from "lkt-vue-kernel";
2
3
  type __VLS_Props = {
3
4
  modelValue: LktObject;
4
5
  isDraggable: boolean;
@@ -19,8 +20,12 @@ type __VLS_Props = {
19
20
  renderDrag?: boolean | Function;
20
21
  disabledDrag?: boolean | Function;
21
22
  itemContainerClass?: string | Function;
23
+ itemSlotComponent?: string | Function | Component;
24
+ itemSlotData?: LktObject | Function;
25
+ itemSlotEvents?: LktObject | Function;
26
+ permissions?: Array<TablePermission>;
22
27
  };
23
- declare var __VLS_26: `item-${number}`, __VLS_27: {
28
+ declare var __VLS_30: `item-${number}`, __VLS_31: {
24
29
  item: LktObject;
25
30
  index: number;
26
31
  editing: boolean;
@@ -30,7 +35,7 @@ declare var __VLS_26: `item-${number}`, __VLS_27: {
30
35
  canDrop: boolean;
31
36
  isLoading: boolean;
32
37
  doDrop: () => void;
33
- }, __VLS_29: {
38
+ }, __VLS_33: {
34
39
  item: LktObject;
35
40
  index: number;
36
41
  editing: boolean;
@@ -40,18 +45,18 @@ declare var __VLS_26: `item-${number}`, __VLS_27: {
40
45
  canDrop: boolean;
41
46
  isLoading: boolean;
42
47
  doDrop: () => void;
43
- }, __VLS_32: string, __VLS_33: {
48
+ }, __VLS_36: string, __VLS_37: {
44
49
  value: any;
45
50
  item: LktObject;
46
51
  column: Column;
47
52
  i: number;
48
53
  };
49
54
  type __VLS_Slots = {} & {
50
- [K in NonNullable<typeof __VLS_26>]?: (props: typeof __VLS_27) => any;
55
+ [K in NonNullable<typeof __VLS_30>]?: (props: typeof __VLS_31) => any;
51
56
  } & {
52
- [K in NonNullable<typeof __VLS_32>]?: (props: typeof __VLS_33) => any;
57
+ [K in NonNullable<typeof __VLS_36>]?: (props: typeof __VLS_37) => any;
53
58
  } & {
54
- item?: (props: typeof __VLS_29) => any;
59
+ item?: (props: typeof __VLS_33) => any;
55
60
  };
56
61
  declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
57
62
  "update:modelValue": (...args: any[]) => void;
@@ -81,6 +86,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
81
86
  renderDrag: boolean | Function;
82
87
  disabledDrag: boolean | Function;
83
88
  itemContainerClass: string | Function;
89
+ permissions: Array<TablePermission>;
84
90
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
85
91
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
86
92
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-table",
3
- "version": "2.0.40",
3
+ "version": "2.0.41",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lkt",
@@ -112,6 +112,19 @@ const computedFieldLabel = computed(() => {
112
112
  :prop="item"
113
113
  @click="onClickInlineDrop"
114
114
  >{{ getColumnDisplayContent(column, item, i) }}</lkt-button>
115
+
116
+ <lkt-field
117
+ v-else-if="column.type === ColumnType.ColumnIndex && column.field"
118
+ v-bind="<FieldConfig>{
119
+ ...computedFieldConfig,
120
+ modelValue: getColumnDisplayContent(column, item, i, columns),
121
+ readMode: true,
122
+ slotData,
123
+ label: computedFieldLabel,
124
+ modalData: computedModalData,
125
+ prop: item,
126
+ }"
127
+ />
115
128
  <template v-else>
116
129
  {{ getColumnDisplayContent(column, item, i, columns) }}
117
130
  </template>
@@ -7,9 +7,16 @@ import {
7
7
  getHorizontalColSpan
8
8
  } from "../functions/table-functions";
9
9
  import LktTableCell from "./LktTableCell.vue";
10
- import {computed, ref, useSlots, watch} from "vue";
10
+ import {Component, computed, ref, useSlots, watch} from "vue";
11
11
  import {Settings} from "../settings/Settings";
12
- import {Column, LktObject, TableRowType, ValidTableRowTypeValue} from "lkt-vue-kernel";
12
+ import {
13
+ Column,
14
+ ItemSlotComponentConfig,
15
+ LktObject,
16
+ TablePermission,
17
+ TableRowType,
18
+ ValidTableRowTypeValue
19
+ } from "lkt-vue-kernel";
13
20
 
14
21
  const slots = useSlots();
15
22
  const emit = defineEmits([
@@ -40,6 +47,10 @@ const props = withDefaults(defineProps<{
40
47
  renderDrag?: boolean | Function
41
48
  disabledDrag?: boolean | Function
42
49
  itemContainerClass?: string | Function
50
+ itemSlotComponent?: string | Function | Component
51
+ itemSlotData?: LktObject | Function
52
+ itemSlotEvents?: LktObject | Function
53
+ permissions?: Array<TablePermission>
43
54
  }>(), {
44
55
  modelValue: () => ({}),
45
56
  isDraggable: true,
@@ -56,6 +67,7 @@ const props = withDefaults(defineProps<{
56
67
  renderDrag: true,
57
68
  disabledDrag: true,
58
69
  itemContainerClass: '',
70
+ permissions: () => [],
59
71
  });
60
72
 
61
73
  const Item = ref(props.modelValue);
@@ -156,7 +168,22 @@ const canRenderDragIndicator = computed(() => {
156
168
  </lkt-button>
157
169
  </div>
158
170
  </td>
159
- <template v-if="canCustomItem && slots[`item-${i}`]">
171
+ <template v-if="itemSlotComponent">
172
+ <td :key="'td' + i" :colspan="visibleColumns.length">
173
+ <component
174
+ :is="itemSlotComponent"
175
+ v-bind="<ItemSlotComponentConfig>{
176
+ item: Item,
177
+ index: i,
178
+ editing: editModeEnabled,
179
+ perms: permissions,
180
+ data: itemSlotData,
181
+ events: itemSlotEvents
182
+ }"
183
+ />
184
+ </td>
185
+ </template>
186
+ <template v-else-if="canCustomItem && slots[`item-${i}`]">
160
187
  <td :key="'td' + i" :colspan="visibleColumns.length">
161
188
  <slot
162
189
  :name="`item-${i}`"
@@ -759,6 +759,10 @@ const hasEmptySlot = computed(() => {
759
759
  :disabled-drag="computedDisabledDrag"
760
760
  :is-loading="isLoading"
761
761
  :item-container-class="itemContainerClass"
762
+ :item-slot-component="computedItemSlotComponent"
763
+ :item-slot-data="computedItemSlotData"
764
+ :item-slot-events="itemSlotEvents"
765
+ :permissions="permissions"
762
766
  @click="onClick"
763
767
  @item-up="onItemUp"
764
768
  @item-down="onItemDown"