@v1nt1248/3nclient-lib 0.1.1 → 0.1.2
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/README.md +2 -0
- package/dist/components/index.d.ts +3 -3
- package/dist/components/ui3n-badge-simple.vue.d.ts +13 -13
- package/dist/components/ui3n-badge.vue.d.ts +18 -16
- package/dist/components/ui3n-breadcrumb.vue.d.ts +15 -13
- package/dist/components/ui3n-breadcrumbs.vue.d.ts +17 -15
- package/dist/components/ui3n-button.vue.d.ts +22 -19
- package/dist/components/ui3n-checkbox.vue.d.ts +17 -15
- package/dist/components/ui3n-chip.vue.d.ts +18 -16
- package/dist/components/ui3n-dialog.vue.d.ts +4 -5
- package/dist/components/ui3n-drop-files.vue.d.ts +16 -14
- package/dist/components/ui3n-emoji.vue.d.ts +11 -11
- package/dist/components/ui3n-icon.vue.d.ts +12 -12
- package/dist/components/ui3n-input.vue.d.ts +4 -4
- package/dist/components/ui3n-list.vue.d.ts +12 -39
- package/dist/components/ui3n-menu.vue.d.ts +14 -12
- package/dist/components/ui3n-notification.vue.d.ts +14 -15
- package/dist/components/ui3n-progress-circular.vue.d.ts +13 -13
- package/dist/components/ui3n-progress-linear.vue.d.ts +13 -13
- package/dist/components/ui3n-step-line-bar.vue.d.ts +11 -11
- package/dist/components/ui3n-switch.vue.d.ts +15 -13
- package/dist/components/ui3n-table/composables/useTable.d.ts +26 -0
- package/dist/components/ui3n-table/types.d.ts +65 -0
- package/dist/components/ui3n-table/ui3n-table.vue.d.ts +22 -0
- package/dist/components/ui3n-table-sort-icon.vue.d.ts +2 -2
- package/dist/components/ui3n-tabs.vue.d.ts +18 -16
- package/dist/components/ui3n-text.vue.d.ts +13 -13
- package/dist/components/ui3n-virtual-scroll.vue.d.ts +6 -28
- package/dist/directives/index.d.ts +0 -1
- package/dist/directives/ui3n-click-outside.d.ts +0 -1
- package/dist/directives/ui3n-html.d.ts +0 -1
- package/dist/index.d.ts +4 -1
- package/dist/plugins/dialogs.d.ts +0 -1
- package/dist/plugins/i18n.d.ts +0 -1
- package/dist/plugins/icons.d.ts +0 -1
- package/dist/plugins/index.d.ts +0 -1
- package/dist/plugins/notifications.d.ts +0 -1
- package/dist/plugins/store-dialogs.d.ts +0 -1
- package/dist/plugins/store-notifications.d.ts +0 -1
- package/dist/plugins/store-vue-bus.d.ts +0 -1
- package/dist/plugins/vue-bus.d.ts +0 -1
- package/dist/style.css +1 -1
- package/dist/tools/sqlite-on-3nstorage/index.d.ts +0 -1
- package/dist/tools/ui.helpers.d.ts +0 -1
- package/dist/ui-3n-lib.js +5471 -5634
- package/package.json +28 -27
- package/src/components/index.ts +34 -4
- package/src/components/ui3n-checkbox.vue +1 -1
- package/src/components/ui3n-dialog.vue +6 -1
- package/src/components/ui3n-table/composables/useTable.ts +206 -0
- package/src/components/ui3n-table/types.ts +80 -0
- package/src/components/ui3n-table/ui3n-table.vue +319 -0
- package/src/components/ui3n-table-sort-icon.vue +9 -6
- package/dist/components/ui3n-table.vue.d.ts +0 -36
- /package/src/components/{ui3n-table.vue → ui3n-table-simple.vue} +0 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
<script setup lang="ts" generic="T extends Ui3nTableBodyBaseItem">
|
|
2
|
+
import { useTable } from './composables/useTable';
|
|
3
|
+
import {
|
|
4
|
+
Ui3nTableBodyBaseItem,
|
|
5
|
+
Ui3nTableEmits,
|
|
6
|
+
Ui3nTableProps,
|
|
7
|
+
Ui3nTableSlots,
|
|
8
|
+
} from './types';
|
|
9
|
+
import Ui3nButton from '../ui3n-button.vue';
|
|
10
|
+
import Ui3nCheckbox from '../ui3n-checkbox.vue';
|
|
11
|
+
import Ui3nTableSortIcon from '../ui3n-table-sort-icon.vue';
|
|
12
|
+
|
|
13
|
+
const props = defineProps<Ui3nTableProps<T>>();
|
|
14
|
+
const emits = defineEmits<Ui3nTableEmits<T>>();
|
|
15
|
+
defineSlots<Ui3nTableSlots<T, string & keyof T>>();
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
tableEl,
|
|
19
|
+
currentConfig,
|
|
20
|
+
visibleColumns,
|
|
21
|
+
showGroupActionsRow,
|
|
22
|
+
selectedRowsArray,
|
|
23
|
+
selectedRowsSize,
|
|
24
|
+
closeGroupActionsRow,
|
|
25
|
+
getRowKey,
|
|
26
|
+
isRowSelected,
|
|
27
|
+
getRowStyle,
|
|
28
|
+
processSelection,
|
|
29
|
+
toggleSelectedRows,
|
|
30
|
+
changeSortOrder,
|
|
31
|
+
} = useTable(props, emits);
|
|
32
|
+
|
|
33
|
+
const eventsHandlers = {
|
|
34
|
+
select: processSelection,
|
|
35
|
+
};
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<template>
|
|
39
|
+
<div ref="tableEl" :class="$style.table">
|
|
40
|
+
<div :class="[$style.header, showGroupActionsRow && $style.withGroupActions]">
|
|
41
|
+
<!-- group actions -->
|
|
42
|
+
<div v-if="showGroupActionsRow" :class="$style.groupActions">
|
|
43
|
+
<ui3n-checkbox
|
|
44
|
+
:indeterminate="selectedRowsSize < body.content.length && selectedRowsSize !== 0"
|
|
45
|
+
:model-value="selectedRowsSize === body.content.length"
|
|
46
|
+
@change="toggleSelectedRows"
|
|
47
|
+
>
|
|
48
|
+
Selected: {{ selectedRowsSize }}
|
|
49
|
+
</ui3n-checkbox>
|
|
50
|
+
|
|
51
|
+
<div :class="$style.groupActionsBody">
|
|
52
|
+
<slot name="group-actions" :selected-rows="selectedRowsArray" />
|
|
53
|
+
</div>
|
|
54
|
+
|
|
55
|
+
<ui3n-button
|
|
56
|
+
type="secondary"
|
|
57
|
+
@click="closeGroupActionsRow"
|
|
58
|
+
>
|
|
59
|
+
Cancel
|
|
60
|
+
</ui3n-button>
|
|
61
|
+
</div>
|
|
62
|
+
<!-- table header -->
|
|
63
|
+
<template
|
|
64
|
+
v-for="h in visibleColumns"
|
|
65
|
+
:key="h.key"
|
|
66
|
+
>
|
|
67
|
+
<div
|
|
68
|
+
:class="[
|
|
69
|
+
$style.headerItemWrapper,
|
|
70
|
+
h.sortable && $style.sortable,
|
|
71
|
+
h.sortable && currentConfig.sortOrder?.field === h.key && $style.sortableActive,
|
|
72
|
+
]"
|
|
73
|
+
:style="h.headCellStyle"
|
|
74
|
+
>
|
|
75
|
+
<div
|
|
76
|
+
:class="$style.headerItem"
|
|
77
|
+
:style="h.headCellStyle"
|
|
78
|
+
v-on="h.sortable ? { click: () => changeSortOrder(h.key) }: {}"
|
|
79
|
+
>
|
|
80
|
+
<slot :name="`header-cell-${h.key as string & keyof T}`">
|
|
81
|
+
<span :class="$style.headerText">
|
|
82
|
+
{{ h.text }}
|
|
83
|
+
</span>
|
|
84
|
+
</slot>
|
|
85
|
+
<ui3n-table-sort-icon
|
|
86
|
+
v-if="h.sortable && currentConfig.sortOrder?.field === h.key"
|
|
87
|
+
:value="currentConfig.sortOrder?.direction"
|
|
88
|
+
size="16"
|
|
89
|
+
/>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<!-- table body -->
|
|
96
|
+
<div :class="$style.body">
|
|
97
|
+
<template v-if="$slots['row']">
|
|
98
|
+
<div
|
|
99
|
+
v-for="(row, rowIndex) in body.content"
|
|
100
|
+
:class="[
|
|
101
|
+
$style.row,
|
|
102
|
+
isRowSelected(row) && $style.selected,
|
|
103
|
+
config.selectable && $style.selectable,
|
|
104
|
+
]"
|
|
105
|
+
:key="getRowKey(row, rowIndex)"
|
|
106
|
+
>
|
|
107
|
+
<slot
|
|
108
|
+
name="body-row"
|
|
109
|
+
:row="row"
|
|
110
|
+
:row-style="getRowStyle(row)"
|
|
111
|
+
:row-index="rowIndex"
|
|
112
|
+
:events="eventsHandlers"
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</template>
|
|
116
|
+
|
|
117
|
+
<template v-else>
|
|
118
|
+
<div
|
|
119
|
+
v-for="(row, rowIndex) in body.content"
|
|
120
|
+
:class="[
|
|
121
|
+
$style.row,
|
|
122
|
+
isRowSelected(row) && $style.selected,
|
|
123
|
+
config.selectable && $style.selectable,
|
|
124
|
+
]"
|
|
125
|
+
:key="getRowKey(row, rowIndex)"
|
|
126
|
+
:style="getRowStyle(row)"
|
|
127
|
+
>
|
|
128
|
+
<div
|
|
129
|
+
v-if="config.selectable"
|
|
130
|
+
:class="$style.rowCheckbox"
|
|
131
|
+
>
|
|
132
|
+
<ui3n-checkbox
|
|
133
|
+
:model-value="isRowSelected(row)"
|
|
134
|
+
@change="processSelection(row)"
|
|
135
|
+
/>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<template
|
|
139
|
+
v-for="(col, colIndex) in visibleColumns"
|
|
140
|
+
:key="col.key"
|
|
141
|
+
>
|
|
142
|
+
<div :class="[$style.bodyItem, colIndex === 0 && $style.bodyItemFirst]">
|
|
143
|
+
<slot
|
|
144
|
+
:name="`body-row-cell-${(col.key as string & keyof T)}`"
|
|
145
|
+
:row="row"
|
|
146
|
+
:row-index="rowIndex"
|
|
147
|
+
:cell="row[col.key]"
|
|
148
|
+
>
|
|
149
|
+
<span :class="$style.cell">
|
|
150
|
+
{{ row[col.key] }}
|
|
151
|
+
</span>
|
|
152
|
+
</slot>
|
|
153
|
+
</div>
|
|
154
|
+
</template>
|
|
155
|
+
</div>
|
|
156
|
+
</template>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
</template>
|
|
160
|
+
|
|
161
|
+
<style lang="scss" module>
|
|
162
|
+
@import "../../assets/styles/mixins.scss";
|
|
163
|
+
|
|
164
|
+
.table {
|
|
165
|
+
--ui3n-table-columns-width: auto;
|
|
166
|
+
--ui3n-table-base-head-height: 36px;
|
|
167
|
+
--ui3n-table-group-actions-height: 48px;
|
|
168
|
+
--ui3n-table-body-row-height: 28px;
|
|
169
|
+
--ui3n-table-group-actions-bg-color: var(--color-bg-block-primary-default);
|
|
170
|
+
|
|
171
|
+
position: relative;
|
|
172
|
+
width: 100%;
|
|
173
|
+
height: 100%;
|
|
174
|
+
background-color: transparent;
|
|
175
|
+
overflow-y: auto;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.header {
|
|
179
|
+
position: sticky;
|
|
180
|
+
top: 0;
|
|
181
|
+
width: 100%;
|
|
182
|
+
min-height: var(--ui3n-table-header-height);
|
|
183
|
+
height: var(--ui3n-table-base-head-height);
|
|
184
|
+
display: grid;
|
|
185
|
+
grid-template-columns: var(--ui3n-table-columns-width);
|
|
186
|
+
background-color: var(--color-bg-table-header-default);
|
|
187
|
+
padding-left: var(--spacing-m);
|
|
188
|
+
z-index: 5;
|
|
189
|
+
|
|
190
|
+
&.withGroupActions {
|
|
191
|
+
height: calc(var(--ui3n-table-base-head-height) + var(--ui3n-table-group-actions-height));
|
|
192
|
+
padding-top: var(--ui3n-table-group-actions-height);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.headerItemWrapper:not(:first-child) {
|
|
196
|
+
padding: 0 var(--spacing-xs);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.headerItemWrapper {
|
|
201
|
+
position: relative;
|
|
202
|
+
display: flex;
|
|
203
|
+
justify-content: flex-start;
|
|
204
|
+
align-items: center;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.headerItem {
|
|
208
|
+
position: relative;
|
|
209
|
+
display: flex;
|
|
210
|
+
justify-content: flex-start;
|
|
211
|
+
align-items: center;
|
|
212
|
+
width: fit-content;
|
|
213
|
+
max-width: 100%;
|
|
214
|
+
user-select: none;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.sortable {
|
|
218
|
+
.headerItem {
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.headerText {
|
|
224
|
+
display: block;
|
|
225
|
+
font-size: var(--font-14);
|
|
226
|
+
font-weight: 500;
|
|
227
|
+
color: var(--color-text-table-primary-default);
|
|
228
|
+
@include text-overflow-ellipsis;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.sortableActive {
|
|
232
|
+
.headerItem {
|
|
233
|
+
gap: var(--spacing-s);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.groupActions {
|
|
238
|
+
position: absolute;
|
|
239
|
+
top: 0;
|
|
240
|
+
left: 0;
|
|
241
|
+
display: flex;
|
|
242
|
+
width: 100%;
|
|
243
|
+
height: var(--ui3n-table-group-actions-height);
|
|
244
|
+
padding: 0 var(--spacing-m);
|
|
245
|
+
justify-content: space-between;
|
|
246
|
+
align-items: center;
|
|
247
|
+
background-color: var(--ui3n-table-group-actions-bg-color);
|
|
248
|
+
border-left: 1px solid var(--color-border-block-primary-default);
|
|
249
|
+
border-top: 1px solid var(--color-border-block-primary-default);
|
|
250
|
+
border-right: 1px solid var(--color-border-block-primary-default);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.groupActionsBody {
|
|
254
|
+
display: flex;
|
|
255
|
+
height: 100%;
|
|
256
|
+
padding: 0 var(--spacing-s);
|
|
257
|
+
flex-grow: 1;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.body {
|
|
261
|
+
position: relative;
|
|
262
|
+
width: 100%;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.row {
|
|
266
|
+
position: relative;
|
|
267
|
+
width: 100%;
|
|
268
|
+
min-height: var(--ui3n-table-body-row-height);
|
|
269
|
+
display: grid;
|
|
270
|
+
grid-template-columns: var(--ui3n-table-columns-width);
|
|
271
|
+
padding-left: var(--spacing-m);
|
|
272
|
+
border-left: 1px solid var(--color-border-table-primary-default);
|
|
273
|
+
border-right: 1px solid var(--color-border-table-primary-default);
|
|
274
|
+
border-bottom: 1px solid var(--color-border-block-primary-default);
|
|
275
|
+
background-color: transparent;
|
|
276
|
+
|
|
277
|
+
&.selectable {
|
|
278
|
+
cursor: pointer;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
&:hover {
|
|
282
|
+
background-color: var(--color-bg-control-primary-hover);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.selected {
|
|
287
|
+
background-color: var(--color-bg-control-primary-hover);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.rowCheckbox {
|
|
291
|
+
position: absolute;
|
|
292
|
+
top: 0;
|
|
293
|
+
left: 16px;
|
|
294
|
+
width: var(--spacing-m);
|
|
295
|
+
height: 100%;
|
|
296
|
+
display: flex;
|
|
297
|
+
justify-content: flex-start;
|
|
298
|
+
align-items: center;
|
|
299
|
+
z-index: 1;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.bodyItem {
|
|
303
|
+
position: relative;
|
|
304
|
+
height: 100%;
|
|
305
|
+
display: flex;
|
|
306
|
+
justify-content: flex-start;
|
|
307
|
+
align-items: center;
|
|
308
|
+
|
|
309
|
+
&.bodyItemFirst {
|
|
310
|
+
padding-left: var(--spacing-ml);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.cell {
|
|
315
|
+
font-size: var(--font-12);
|
|
316
|
+
font-weight: 400;
|
|
317
|
+
color: var(--color-text-table-primary-default);
|
|
318
|
+
}
|
|
319
|
+
</style>
|
|
@@ -15,10 +15,13 @@
|
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<template>
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
<transition mode="out-in" name="fade">
|
|
19
|
+
<ui3n-icon
|
|
20
|
+
:key="value === 'asc' ? 'arrow-downward' : 'arrow-upward'"
|
|
21
|
+
:icon="value === 'asc' ? 'arrow-downward' : 'arrow-upward'"
|
|
22
|
+
:width="iconSize"
|
|
23
|
+
:height="iconSize"
|
|
24
|
+
:color="iconColor"
|
|
25
|
+
/>
|
|
26
|
+
</transition>
|
|
24
27
|
</template>
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ListingEntryTypeExtended, EntityAction } from '../constants';
|
|
2
|
-
|
|
3
|
-
export interface Ui3nTableProps {
|
|
4
|
-
items: ListingEntryTypeExtended[];
|
|
5
|
-
textIfEmpty?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface Ui3nTableEmits {
|
|
8
|
-
(ev: 'go', name: string): void;
|
|
9
|
-
(ev: 'action', value: {
|
|
10
|
-
action: EntityAction;
|
|
11
|
-
entity: ListingEntryTypeExtended;
|
|
12
|
-
}): void;
|
|
13
|
-
}
|
|
14
|
-
declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<Ui3nTableProps>, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
15
|
-
go: (name: string) => void;
|
|
16
|
-
action: (value: {
|
|
17
|
-
action: EntityAction;
|
|
18
|
-
entity: ListingEntryTypeExtended;
|
|
19
|
-
}) => void;
|
|
20
|
-
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Ui3nTableProps>>> & {
|
|
21
|
-
onGo?: ((name: string) => any) | undefined;
|
|
22
|
-
onAction?: ((value: {
|
|
23
|
-
action: EntityAction;
|
|
24
|
-
entity: ListingEntryTypeExtended;
|
|
25
|
-
}) => any) | undefined;
|
|
26
|
-
}, {}, {}>;
|
|
27
|
-
export default _default;
|
|
28
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
29
|
-
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
30
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
31
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
32
|
-
} : {
|
|
33
|
-
type: import('vue').PropType<T[K]>;
|
|
34
|
-
required: true;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
File without changes
|