@v1nt1248/3nclient-lib 0.1.45 → 0.1.46
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/components/ui3n-table/types.d.ts +5 -1
- package/dist/components/ui3n-table/ui3n-table.vue.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/ui3n-components.js +4035 -3944
- package/package.json +1 -1
- package/src/components/ui3n-table/types.ts +8 -1
- package/src/components/ui3n-table/ui3n-table.vue +65 -43
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ export type Ui3nTableConfig<T extends Ui3nTableBodyBaseItem, K extends keyof T =
|
|
|
17
17
|
// draggableColumns?: boolean; // ToDo this will be done in the next version
|
|
18
18
|
columnStyle?: { [P in Omit<K, 'id'> as string | number]: Record<string, string> };
|
|
19
19
|
fieldAsRowKey?: keyof T;
|
|
20
|
+
showNoDataMessage?: boolean;
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
export type Ui3nTableHeadProps<T extends Ui3nTableBodyBaseItem> = {
|
|
@@ -42,9 +43,14 @@ export interface Ui3nTableProps<T extends Ui3nTableBodyBaseItem> {
|
|
|
42
43
|
|
|
43
44
|
export interface Ui3nTableEmits<T extends Ui3nTableBodyBaseItem> {
|
|
44
45
|
(ev: 'change:sort', val: Ui3nTableSort<T>): void;
|
|
46
|
+
|
|
45
47
|
(ev: 'select:row', val: T[]): void;
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
export type Ui3nTableNoDataSlot = {
|
|
51
|
+
'no-data': () => VNode;
|
|
52
|
+
};
|
|
53
|
+
|
|
48
54
|
export type Ui3nTableGroupActionsSlot = {
|
|
49
55
|
'group-actions': () => VNode;
|
|
50
56
|
};
|
|
@@ -80,7 +86,8 @@ export type Ui3nTableBodyRowCellSlot<T extends Ui3nTableBodyBaseItem, K extends
|
|
|
80
86
|
[p in `row-cell-${K}`]: (scope: Ui3nTableBodyRowCellSlotScope<T, K>) => VNode;
|
|
81
87
|
};
|
|
82
88
|
|
|
83
|
-
export type Ui3nTableSlots<T extends Ui3nTableBodyBaseItem, K extends string & keyof T> =
|
|
89
|
+
export type Ui3nTableSlots<T extends Ui3nTableBodyBaseItem, K extends string & keyof T> = Ui3nTableNoDataSlot &
|
|
90
|
+
Ui3nTableGroupActionsSlot &
|
|
84
91
|
Ui3nTableHeaderCellSlot<T, K> &
|
|
85
92
|
Ui3nTableBodyRowSlot<T> &
|
|
86
93
|
Ui3nTableBodyRowCellSlot<T, K>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts" generic="T extends Ui3nTableBodyBaseItem">
|
|
2
|
+
import size from 'lodash/size';
|
|
2
3
|
import { useTable } from './composables/useTable';
|
|
3
4
|
import type { Ui3nTableBodyBaseItem, Ui3nTableEmits, Ui3nTableProps, Ui3nTableSlots } from './types';
|
|
4
5
|
import Ui3nButton from '../ui3n-button/ui3n-button.vue';
|
|
@@ -98,61 +99,69 @@
|
|
|
98
99
|
|
|
99
100
|
<!-- table body -->
|
|
100
101
|
<div :class="$style.body">
|
|
101
|
-
<template v-if="
|
|
102
|
-
<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
:class="[$style.row, isRowSelected(row) && $style.selected, config.selectable && $style.selectable]"
|
|
106
|
-
>
|
|
107
|
-
<slot
|
|
108
|
-
name="row"
|
|
109
|
-
:row="row"
|
|
110
|
-
:row-style="getRowStyle(row)"
|
|
111
|
-
:row-index="rowIndex"
|
|
112
|
-
:is-row-selected="isRowSelected(row)"
|
|
113
|
-
:column-style="config?.columnStyle"
|
|
114
|
-
:events="eventHandlers"
|
|
115
|
-
/>
|
|
116
|
-
</div>
|
|
102
|
+
<template v-if="config?.showNoDataMessage && !size(body.content)">
|
|
103
|
+
<slot name="no-data">
|
|
104
|
+
<div :class="$style.noData">No data</div>
|
|
105
|
+
</slot>
|
|
117
106
|
</template>
|
|
118
107
|
|
|
119
108
|
<template v-else>
|
|
120
|
-
<
|
|
121
|
-
v-for="(row, rowIndex) in body.content"
|
|
122
|
-
:key="getRowKey(row, rowIndex)"
|
|
123
|
-
:class="[$style.row, isRowSelected(row) && $style.selected, config.selectable && $style.selectable]"
|
|
124
|
-
:style="getRowStyle(row)"
|
|
125
|
-
>
|
|
109
|
+
<template v-if="$slots['row']">
|
|
126
110
|
<div
|
|
127
|
-
v-
|
|
128
|
-
:
|
|
111
|
+
v-for="(row, rowIndex) in body.content"
|
|
112
|
+
:key="getRowKey(row, rowIndex)"
|
|
113
|
+
:class="[$style.row, isRowSelected(row) && $style.selected, config.selectable && $style.selectable]"
|
|
129
114
|
>
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
115
|
+
<slot
|
|
116
|
+
name="row"
|
|
117
|
+
:row="row"
|
|
118
|
+
:row-style="getRowStyle(row)"
|
|
119
|
+
:row-index="rowIndex"
|
|
120
|
+
:is-row-selected="isRowSelected(row)"
|
|
121
|
+
:column-style="config?.columnStyle"
|
|
122
|
+
:events="eventHandlers"
|
|
133
123
|
/>
|
|
134
124
|
</div>
|
|
125
|
+
</template>
|
|
135
126
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
127
|
+
<template v-else>
|
|
128
|
+
<div
|
|
129
|
+
v-for="(row, rowIndex) in body.content"
|
|
130
|
+
:key="getRowKey(row, rowIndex)"
|
|
131
|
+
:class="[$style.row, isRowSelected(row) && $style.selected, config.selectable && $style.selectable]"
|
|
132
|
+
:style="getRowStyle(row)"
|
|
139
133
|
>
|
|
140
|
-
<div
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
:
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
134
|
+
<div
|
|
135
|
+
v-if="config.selectable"
|
|
136
|
+
:class="$style.rowCheckbox"
|
|
137
|
+
>
|
|
138
|
+
<ui3n-checkbox
|
|
139
|
+
:model-value="isRowSelected(row)"
|
|
140
|
+
@change="processSelection(row)"
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<template
|
|
145
|
+
v-for="(col, colIndex) in visibleColumns"
|
|
146
|
+
:key="col.key"
|
|
147
|
+
>
|
|
148
|
+
<div :class="[$style.bodyItem, colIndex === 0 && $style.bodyItemFirst]">
|
|
149
|
+
<slot
|
|
150
|
+
:name="`row-cell-${col.key as string & keyof T}`"
|
|
151
|
+
:row="row"
|
|
152
|
+
:row-index="rowIndex"
|
|
153
|
+
:is-row-selected="isRowSelected(row)"
|
|
154
|
+
:column-style="config?.columnStyle"
|
|
155
|
+
:cell="row[col.key]"
|
|
156
|
+
>
|
|
149
157
|
<span :class="$style.cell">
|
|
150
158
|
{{ row[col.key] }}
|
|
151
159
|
</span>
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
160
|
+
</slot>
|
|
161
|
+
</div>
|
|
162
|
+
</template>
|
|
163
|
+
</div>
|
|
164
|
+
</template>
|
|
156
165
|
</template>
|
|
157
166
|
</div>
|
|
158
167
|
</div>
|
|
@@ -317,4 +326,17 @@
|
|
|
317
326
|
font-weight: 400;
|
|
318
327
|
color: var(--color-text-table-primary-default);
|
|
319
328
|
}
|
|
329
|
+
|
|
330
|
+
.noData {
|
|
331
|
+
position: relative;
|
|
332
|
+
width: 100%;
|
|
333
|
+
height: var(--spacing-xxl);
|
|
334
|
+
padding-top: var(--spacing-ml);
|
|
335
|
+
display: flex;
|
|
336
|
+
justify-content: center;
|
|
337
|
+
align-items: center;
|
|
338
|
+
font-size: var(--font-12);
|
|
339
|
+
font-weight: 600;
|
|
340
|
+
color: var(--color-text-control-secondary-default);
|
|
341
|
+
}
|
|
320
342
|
</style>
|