lkt-table 2.0.6 → 2.0.7

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.
@@ -0,0 +1,14 @@
1
+ import { ButtonConfig, LktObject } from "lkt-vue-kernel";
2
+ type __VLS_Props = {
3
+ config: ButtonConfig;
4
+ item: LktObject;
5
+ disabled?: boolean;
6
+ };
7
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ click: (...args: any[]) => void;
9
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ onClick?: ((...args: any[]) => any) | undefined;
11
+ }>, {
12
+ disabled: boolean;
13
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { ButtonConfig, LktObject } from "lkt-vue-kernel";
2
+ type __VLS_Props = {
3
+ config: ButtonConfig;
4
+ item: LktObject;
5
+ disabled?: boolean;
6
+ };
7
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ click: (...args: any[]) => void;
9
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
10
+ onClick?: ((...args: any[]) => any) | undefined;
11
+ }>, {
12
+ disabled: boolean;
13
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ export default _default;
@@ -1,7 +1,7 @@
1
1
  import { canRenderColumn, colPreferSlot, getColumnClasses, getColumnDisplayContent, getHorizontalColSpan } from "../functions/table-functions";
2
2
  import LktTableCell from "./LktTableCell.vue";
3
- import DropButton from "./DropButton.vue";
4
- import EditButton from "./EditButton.vue";
3
+ import DropButtonComponent from "./DropButtonComponent.vue";
4
+ import EditButtonComponent from "./EditButtonComponent.vue";
5
5
  import { ButtonConfig, Column, LktObject, ValidTableRowTypeValue } from "lkt-vue-kernel";
6
6
  declare const slots: Readonly<{
7
7
  [name: string]: import("vue").Slot<any> | undefined;
@@ -33,24 +33,24 @@ declare const canItem: boolean;
33
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, onClickEdit: () => void;
34
34
  declare const canRenderDragIndicator: import("vue").ComputedRef<any>;
35
35
  declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
36
- declare var __VLS_24: `item-${number}`, __VLS_25: {
36
+ declare var __VLS_26: `item-${number}`, __VLS_27: {
37
37
  item: LktObject;
38
38
  index: number;
39
- }, __VLS_27: {
39
+ }, __VLS_29: {
40
40
  item: LktObject;
41
41
  index: number;
42
- }, __VLS_30: string, __VLS_31: {
42
+ }, __VLS_32: string, __VLS_33: {
43
43
  value: any;
44
44
  item: LktObject;
45
45
  column: Column;
46
46
  i: number;
47
47
  };
48
48
  type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
49
- [K in NonNullable<typeof __VLS_24>]?: (props: typeof __VLS_25) => any;
49
+ [K in NonNullable<typeof __VLS_26>]?: (props: typeof __VLS_27) => any;
50
50
  } & {
51
- [K in NonNullable<typeof __VLS_30>]?: (props: typeof __VLS_31) => any;
51
+ [K in NonNullable<typeof __VLS_32>]?: (props: typeof __VLS_33) => any;
52
52
  } & {
53
- item?: (props: typeof __VLS_27) => any;
53
+ item?: (props: typeof __VLS_29) => any;
54
54
  }>;
55
55
  declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
56
56
  canRenderColumn: typeof canRenderColumn;
@@ -59,8 +59,8 @@ declare const __VLS_self: import("vue").DefineComponent<__VLS_Props, {
59
59
  getColumnDisplayContent: typeof getColumnDisplayContent;
60
60
  getHorizontalColSpan: typeof getHorizontalColSpan;
61
61
  LktTableCell: typeof LktTableCell;
62
- DropButton: typeof DropButton;
63
- EditButton: typeof EditButton;
62
+ DropButtonComponent: typeof DropButtonComponent;
63
+ EditButtonComponent: typeof EditButtonComponent;
64
64
  slots: typeof slots;
65
65
  Item: typeof Item;
66
66
  canCustomItem: typeof canCustomItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lkt-table",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lkt",
@@ -59,7 +59,7 @@
59
59
  "lkt-loader": "^1.2.0",
60
60
  "lkt-paginator": "^1.3.3",
61
61
  "lkt-string-tools": "^1.1.0",
62
- "lkt-vue-kernel": "^1.0.35",
62
+ "lkt-vue-kernel": "^1.0.37",
63
63
  "vue": "^3.3",
64
64
  "vue-router": "^4.2.5"
65
65
  }
@@ -1,12 +1,13 @@
1
1
  <script setup lang="ts">
2
2
  import {computed} from "vue";
3
3
  import {Settings} from "../settings/Settings";
4
- import {ButtonConfig} from "lkt-vue-kernel";
4
+ import {ButtonConfig, LktObject, prepareResourceData} from "lkt-vue-kernel";
5
5
 
6
6
  const emit = defineEmits(['click']);
7
7
 
8
8
  const props = withDefaults(defineProps<{
9
- config?: ButtonConfig
9
+ config: ButtonConfig
10
+ item: LktObject
10
11
  disabled?: boolean
11
12
  }>(), {
12
13
  disabled: false,
@@ -14,19 +15,21 @@ const props = withDefaults(defineProps<{
14
15
 
15
16
  const hasButtonSlot = computed(() => Settings.dropButtonSlot !== ''),
16
17
  buttonSlot = computed(() => Settings.dropButtonSlot);
18
+
19
+ const computedResourceData = computed(() => {
20
+ return prepareResourceData(props.config.resourceData, props.item);
21
+ })
17
22
  </script>
18
23
 
19
24
  <template>
20
25
  <lkt-button
21
26
  palette="table-delete"
22
27
  v-bind="props.config"
23
- :icon="hasButtonSlot ? '' : config?.icon"
24
- :text="hasButtonSlot ? '' : config?.text"
25
28
  :disabled="disabled"
26
- @click.prevent.stop="emit('click')">
29
+ :resource-data="computedResourceData"
30
+ @click.prevent.stop="emit('click', $event)">
27
31
  <template v-if="hasButtonSlot">
28
- <component
29
- :is="buttonSlot"/>
32
+ <component :is="buttonSlot"/>
30
33
  </template>
31
34
  </lkt-button>
32
35
  </template>
@@ -1,32 +1,35 @@
1
1
  <script setup lang="ts">
2
2
  import {computed} from "vue";
3
3
  import {Settings} from "../settings/Settings";
4
- import {ButtonConfig} from "lkt-vue-kernel";
4
+ import {ButtonConfig, LktObject, prepareResourceData} from "lkt-vue-kernel";
5
5
 
6
6
  const emit = defineEmits(['click']);
7
7
 
8
8
  const props = withDefaults(defineProps<{
9
- config?: ButtonConfig
9
+ config: ButtonConfig
10
+ item: LktObject
10
11
  disabled?: boolean
11
12
  }>(), {
12
13
  disabled: false,
13
14
  });
14
15
 
15
16
  const hasButtonSlot = computed(() => Settings.editButtonSlot !== ''),
16
- buttonSlot = computed(() => Settings.editButtonSlot)
17
+ buttonSlot = computed(() => Settings.editButtonSlot);
18
+
19
+ const computedResourceData = computed(() => {
20
+ return prepareResourceData(props.config.resourceData, props.item);
21
+ })
17
22
  </script>
18
23
 
19
24
  <template>
20
25
  <lkt-button
21
- palette="table-delete"
26
+ palette="table-edit"
22
27
  v-bind="props.config"
23
- :icon="hasButtonSlot ? '' : config?.icon"
24
- :text="hasButtonSlot ? '' : config?.text"
25
28
  :disabled="disabled"
29
+ :resource-data="computedResourceData"
26
30
  @click.prevent.stop="emit('click')">
27
31
  <template v-if="hasButtonSlot">
28
- <component
29
- :is="buttonSlot"/>
32
+ <component :is="buttonSlot"/>
30
33
  </template>
31
34
  </lkt-button>
32
35
  </template>
@@ -9,8 +9,8 @@ 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 DropButton from "./DropButton.vue";
13
- import EditButton from "./EditButton.vue";
12
+ import DropButtonComponent from "./DropButtonComponent.vue";
13
+ import EditButtonComponent from "./EditButtonComponent.vue";
14
14
  import {replaceAll} from "lkt-string-tools";
15
15
  import {ButtonConfig, Column, LktObject, TableRowType, ValidTableRowTypeValue} from "lkt-vue-kernel";
16
16
 
@@ -148,8 +148,8 @@ const canRenderDragIndicator = computed(() => {
148
148
  </div>
149
149
  </td>
150
150
  <td v-if="displayHiddenColumnsIndicator"
151
- v-on:click="onShow($event, i)" data-role="show-more"
152
- v-bind:class="hiddenIsVisible ? 'state-open' : ''"/>
151
+ @click="onShow($event, i)" data-role="show-more"
152
+ :class="hiddenIsVisible ? 'state-open' : ''"/>
153
153
  <template v-if="canCustomItem && slots[`item-${i}`]">
154
154
  <td :key="'td' + i" :colspan="visibleColumns.length">
155
155
  <slot
@@ -173,7 +173,7 @@ const canRenderDragIndicator = computed(() => {
173
173
  :colspan="getHorizontalColSpan(column,Item)"
174
174
  :title="getColumnDisplayContent (column, Item, i, visibleColumns)"
175
175
  :class="getColumnClasses(column)"
176
- v-on:click="onClick($event)"
176
+ @click="onClick($event)"
177
177
  >
178
178
  <template v-if="!!$slots[column.key] && colPreferSlot(column, Item)">
179
179
  <slot :name="column.key"
@@ -194,13 +194,15 @@ const canRenderDragIndicator = computed(() => {
194
194
  </td>
195
195
  </template>
196
196
  <td v-if="canDrop && editModeEnabled" class="lkt-table-col-drop">
197
- <drop-button
197
+ <drop-button-component
198
198
  :config="dropButton"
199
+ :item="Item"
199
200
  @click="onClickDrop"/>
200
201
  </td>
201
202
  <td v-if="canEdit && editModeEnabled" class="lkt-table-col-edit">
202
- <edit-button
203
+ <edit-button-component
203
204
  :config="editButton"
205
+ :item="Item"
204
206
  @click="onClickEdit"/>
205
207
  </td>
206
208
  </tr>
@@ -74,6 +74,7 @@ const Page = ref(props.paginator?.modelValue),
74
74
  const safeSaveButton = ref(ensureButtonConfig(props.saveButton, LktSettings.defaultSaveButton));
75
75
  const safeCreateButton = ref(ensureButtonConfig(props.createButton, LktSettings.defaultCreateButton));
76
76
  const safeEditModeButton = ref(ensureButtonConfig(props.editModeButton, LktSettings.defaultEditModeButton));
77
+ const safeDropModeButton = ref(ensureButtonConfig(props.dropButton, LktSettings.defaultDropButton));
77
78
 
78
79
  const dataStateChanged = ref(false);
79
80
 
@@ -515,9 +516,9 @@ const hasEmptySlot = computed(() => {
515
516
  v-bind="safeSaveButton"
516
517
  :disabled="saveIsDisabled"
517
518
  :modal-data="computedSaveResourceData"
518
- v-on:loading="onButtonLoading"
519
- v-on:loaded="onButtonLoaded"
520
- v-on:click="onSave">
519
+ @loading="onButtonLoading"
520
+ @loaded="onButtonLoaded"
521
+ @click="onSave">
521
522
  <slot v-if="!!slots['button-save']"
522
523
  name="button-save"
523
524
  :items="Items"
@@ -598,7 +599,7 @@ const hasEmptySlot = computed(() => {
598
599
  v-show="canDisplayItem(Items[i], i)"
599
600
  :key="getRowKey(item, i)"
600
601
  :i="i"
601
- :drop-button="dropButton"
602
+ :drop-button="safeDropModeButton"
602
603
  :edit-button="editButton"
603
604
  :display-hidden-columns-indicator="displayHiddenColumnsIndicator"
604
605
  :is-draggable="isDraggable(item)"
@@ -615,11 +616,11 @@ const hasEmptySlot = computed(() => {
615
616
  :row-display-type="rowDisplayType"
616
617
  :render-drag="computedRenderDrag"
617
618
  :disabled-drag="computedDisabledDrag"
618
- v-on:click="onClick"
619
- v-on:show="show"
620
- v-on:item-up="onItemUp"
621
- v-on:item-down="onItemDown"
622
- v-on:item-drop="onItemDrop"
619
+ @click="onClick"
620
+ @show="show"
621
+ @item-up="onItemUp"
622
+ @item-down="onItemDown"
623
+ @item-drop="onItemDrop"
623
624
  >
624
625
  <template v-if="slots[`item-${i}`]" v-slot:[`item-${i}`]="row">
625
626
  <slot
@@ -661,8 +662,8 @@ const hasEmptySlot = computed(() => {
661
662
  :hidden-is-visible="isVisible(i)"
662
663
  :edit-mode-enabled="editModeEnabled"
663
664
  :has-inline-edit-perm="hasInlineEditPerm"
664
- v-on:click="onClick"
665
- v-on:show="show"
665
+ @click="onClick"
666
+ @show="show"
666
667
  >
667
668
  <template
668
669
  v-for="column in colSlots"