lkt-table 1.2.21 → 1.2.22
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.d.ts +73 -31
- package/dist/build.js +291 -287
- package/package.json +1 -1
- package/src/components/LktTableRow.vue +15 -10
- package/src/lib-components/LktTable.vue +5 -1
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import {createLktEvent} from "lkt-events";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
canRenderColumn,
|
|
5
|
+
colPreferSlot,
|
|
6
|
+
getColumnDisplayContent,
|
|
7
|
+
getHorizontalColSpan
|
|
8
|
+
} from "../functions/table-functions";
|
|
4
9
|
import {LktTableColumn} from "../instances/LktTableColumn";
|
|
5
10
|
import LktTableCell from "./LktTableCell.vue";
|
|
6
11
|
import {computed, ref, watch} from "vue";
|
|
@@ -132,17 +137,17 @@ watch(Item, (v) => {
|
|
|
132
137
|
<template v-for="column in visibleColumns">
|
|
133
138
|
<td v-if="canRenderColumn(column, emptyColumns, Item)"
|
|
134
139
|
:key="'td' + i"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
140
|
+
:data-column="column.key"
|
|
141
|
+
:colspan="getHorizontalColSpan(column,Item)"
|
|
142
|
+
:title="getColumnDisplayContent (column, Item, i, visibleColumns)"
|
|
138
143
|
v-on:click="onClick($event, Item, column)"
|
|
139
144
|
>
|
|
140
|
-
<template v-if="!!$slots[column.key]">
|
|
141
|
-
<slot
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
<template v-if="!!$slots[column.key] && colPreferSlot(column, Item)">
|
|
146
|
+
<slot :name="column.key"
|
|
147
|
+
:value="Item[column.key]"
|
|
148
|
+
:item="Item"
|
|
149
|
+
:column="column"
|
|
150
|
+
:i="i"/>
|
|
146
151
|
</template>
|
|
147
152
|
<template v-else-if="Item">
|
|
148
153
|
<lkt-table-cell
|
|
@@ -28,6 +28,7 @@ const props = withDefaults(defineProps<{
|
|
|
28
28
|
checkValidDrag?: Function
|
|
29
29
|
sortable?: boolean
|
|
30
30
|
hideEmptyColumns?: boolean
|
|
31
|
+
initialSorting?: boolean
|
|
31
32
|
draggableItemKey?: string
|
|
32
33
|
|
|
33
34
|
|
|
@@ -83,6 +84,7 @@ const props = withDefaults(defineProps<{
|
|
|
83
84
|
checkValidDrag: undefined,
|
|
84
85
|
sortable: false,
|
|
85
86
|
hideEmptyColumns: false,
|
|
87
|
+
initialSorting: false,
|
|
86
88
|
draggableItemKey: 'name',
|
|
87
89
|
|
|
88
90
|
|
|
@@ -460,7 +462,9 @@ const getItemByEvent = (e: any) => {
|
|
|
460
462
|
|
|
461
463
|
onMounted(() => {
|
|
462
464
|
autoLoadSelectColumnsOptions();
|
|
463
|
-
|
|
465
|
+
if (props.initialSorting) {
|
|
466
|
+
sort(getColumnByKey(props.columns, SortBy.value));
|
|
467
|
+
}
|
|
464
468
|
dataState.value.store({items: Items.value}).turnStoredIntoOriginal();
|
|
465
469
|
if (props.sortable) {
|
|
466
470
|
nextTick(() => {
|