@webitel/ui-sdk 25.10.47 → 25.10.48
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/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +3473 -3439
- package/dist/ui-sdk.umd.cjs +36 -36
- package/package.json +1 -1
- package/src/components/wt-table/wt-table.vue +48 -2
- package/types/components/wt-table/wt-table.vue.d.ts +24 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "25.10.
|
|
3
|
+
"version": "25.10.48",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"make-all": "npm version patch --git-tag-version false && npm run build && (npm run build:types || true) && (npm run lint:fix || true) && npm run publish-lib",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<p-table
|
|
3
3
|
:key="tableKey"
|
|
4
4
|
ref="table"
|
|
5
|
+
:expanded-rows="expandedRows"
|
|
5
6
|
:reorderable-columns="reorderableColumns"
|
|
6
7
|
:resizable-columns="resizableColumns"
|
|
7
8
|
:row-class="rowClass"
|
|
@@ -14,10 +15,32 @@
|
|
|
14
15
|
scroll-height="flex"
|
|
15
16
|
scrollable
|
|
16
17
|
@sort="sort"
|
|
18
|
+
@update:expanded-rows="expandedRows = $event"
|
|
17
19
|
@column-resize-end="columnResize"
|
|
18
20
|
@column-reorder="columnReorder"
|
|
19
21
|
@row-reorder="({dragIndex, dropIndex}) => emit('reorder:row', { oldIndex: dragIndex, newIndex: dropIndex })"
|
|
20
22
|
>
|
|
23
|
+
<p-column
|
|
24
|
+
v-if="rowExpansion"
|
|
25
|
+
:pt="{
|
|
26
|
+
columnresizer: {
|
|
27
|
+
class: {
|
|
28
|
+
'hidden': true
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}"
|
|
32
|
+
body-style="width: 1%;"
|
|
33
|
+
column-key="row-expander"
|
|
34
|
+
header-style="width: 1%;"
|
|
35
|
+
>
|
|
36
|
+
<template #body="{ data: row }">
|
|
37
|
+
<wt-icon-btn
|
|
38
|
+
:disabled="props.rowExpansionDisabled(row)"
|
|
39
|
+
:icon="isRowExpanded(row) ? 'arrow-down' : 'arrow-right'"
|
|
40
|
+
@click.stop="toggleRow(row)"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
43
|
+
</p-column>
|
|
21
44
|
<p-column
|
|
22
45
|
v-if="rowReorder"
|
|
23
46
|
:pt="{
|
|
@@ -163,6 +186,11 @@
|
|
|
163
186
|
</div>
|
|
164
187
|
</template>
|
|
165
188
|
</p-column>
|
|
189
|
+
<template #expansion="{ data: row }">
|
|
190
|
+
<div>
|
|
191
|
+
<slot :item="row" name="expansion"></slot>
|
|
192
|
+
</div>
|
|
193
|
+
</template>
|
|
166
194
|
<template
|
|
167
195
|
v-if="isTableFooter"
|
|
168
196
|
#footer
|
|
@@ -218,10 +246,12 @@ interface Props extends DataTableProps{
|
|
|
218
246
|
* 'If true, restrict sprecific row reorder.'
|
|
219
247
|
*/
|
|
220
248
|
isRowReorderDisabled?: (row) => boolean;
|
|
249
|
+
rowExpansion?: boolean;
|
|
221
250
|
rowClass?: () => string;
|
|
222
251
|
rowStyle?: () => { [key: string]: string };
|
|
223
252
|
resizableColumns?: boolean
|
|
224
253
|
reorderableColumns?: boolean
|
|
254
|
+
rowExpansionDisabled?: (row: object) => boolean;
|
|
225
255
|
}
|
|
226
256
|
|
|
227
257
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -233,11 +263,13 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
233
263
|
fixedActions: false,
|
|
234
264
|
headless: false,
|
|
235
265
|
rowReorder: false,
|
|
266
|
+
rowExpansion: false,
|
|
236
267
|
isRowReorderDisabled: () => false,
|
|
237
268
|
rowClass: () => '',
|
|
238
269
|
rowStyle: () => ({}),
|
|
239
270
|
resizableColumns: false,
|
|
240
271
|
reorderableColumns: false,
|
|
272
|
+
rowExpansionDisabled: () => false,
|
|
241
273
|
});
|
|
242
274
|
|
|
243
275
|
const { t } = useI18n();
|
|
@@ -248,6 +280,7 @@ const emit = defineEmits(['sort', 'update:selected', 'reorder:row', 'column-resi
|
|
|
248
280
|
|
|
249
281
|
const table = useTemplateRef('table');
|
|
250
282
|
const tableKey = ref(0);
|
|
283
|
+
const expandedRows = ref([]);
|
|
251
284
|
|
|
252
285
|
// table's columns that should be excluded from reorder
|
|
253
286
|
const excludeColumnsFromReorder = ['row-select', 'row-reorder', 'row-actions']
|
|
@@ -255,8 +288,8 @@ const excludeColumnsFromReorder = ['row-select', 'row-reorder', 'row-actions']
|
|
|
255
288
|
const _selected = computed(() => {
|
|
256
289
|
// _isSelected for backwards compatibility
|
|
257
290
|
return props.selectable
|
|
258
|
-
|
|
259
|
-
|
|
291
|
+
? props.selected || props.data.filter(item => item._isSelected)
|
|
292
|
+
: [];
|
|
260
293
|
});
|
|
261
294
|
|
|
262
295
|
const dataHeaders = computed(() => {
|
|
@@ -371,6 +404,19 @@ const columnReorder = () => {
|
|
|
371
404
|
tableKey.value += 1;
|
|
372
405
|
emit('column-reorder', newOrder)
|
|
373
406
|
}
|
|
407
|
+
|
|
408
|
+
const isRowExpanded = (row) => {
|
|
409
|
+
return expandedRows.value.some(r => r?.id === row?.id);
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
const toggleRow = (row) => {
|
|
413
|
+
const index = expandedRows.value.findIndex(r => r.id === row.id);
|
|
414
|
+
if (index !== -1) {
|
|
415
|
+
expandedRows.value.splice(index, 1);
|
|
416
|
+
} else {
|
|
417
|
+
expandedRows.value.push(row);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
374
420
|
</script>
|
|
375
421
|
|
|
376
422
|
<style lang="scss">
|
|
@@ -38,15 +38,18 @@ interface Props extends DataTableProps {
|
|
|
38
38
|
* 'If true, restrict sprecific row reorder.'
|
|
39
39
|
*/
|
|
40
40
|
isRowReorderDisabled?: (row: any) => boolean;
|
|
41
|
+
rowExpansion?: boolean;
|
|
41
42
|
rowClass?: () => string;
|
|
42
43
|
rowStyle?: () => {
|
|
43
44
|
[key: string]: string;
|
|
44
45
|
};
|
|
45
46
|
resizableColumns?: boolean;
|
|
46
47
|
reorderableColumns?: boolean;
|
|
48
|
+
rowExpansionDisabled?: (row: object) => boolean;
|
|
47
49
|
}
|
|
48
50
|
declare const emit: (event: "sort" | "update:selected" | "reorder:row" | "column-resize" | "column-reorder", ...args: any[]) => void;
|
|
49
51
|
declare const tableKey: import("vue").Ref<number, number>;
|
|
52
|
+
declare const expandedRows: import("vue").Ref<any[], any[]>;
|
|
50
53
|
declare const _selected: import("vue").ComputedRef<unknown[]>;
|
|
51
54
|
declare const dataHeaders: import("vue").ComputedRef<WtTableHeader[]>;
|
|
52
55
|
declare const isColumnHidden: (col: any) => boolean;
|
|
@@ -68,28 +71,35 @@ declare const columnResize: ({ element }: {
|
|
|
68
71
|
element: any;
|
|
69
72
|
}) => void;
|
|
70
73
|
declare const columnReorder: () => void;
|
|
74
|
+
declare const isRowExpanded: (row: any) => boolean;
|
|
75
|
+
declare const toggleRow: (row: any) => void;
|
|
71
76
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
72
|
-
declare var
|
|
77
|
+
declare var __VLS_68: string, __VLS_69: {
|
|
73
78
|
index: any;
|
|
74
79
|
item: any;
|
|
75
|
-
},
|
|
80
|
+
}, __VLS_72: `${string}-footer`, __VLS_73: {}, __VLS_79: {}, __VLS_81: {
|
|
76
81
|
index: any;
|
|
77
82
|
item: any;
|
|
78
|
-
},
|
|
83
|
+
}, __VLS_83: {
|
|
84
|
+
item: any;
|
|
85
|
+
}, __VLS_85: {};
|
|
79
86
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
80
|
-
[K in NonNullable<typeof
|
|
87
|
+
[K in NonNullable<typeof __VLS_68>]?: (props: typeof __VLS_69) => any;
|
|
88
|
+
} & {
|
|
89
|
+
[K in NonNullable<typeof __VLS_72>]?: (props: typeof __VLS_73) => any;
|
|
81
90
|
} & {
|
|
82
|
-
|
|
91
|
+
'actions-header'?: (props: typeof __VLS_79) => any;
|
|
83
92
|
} & {
|
|
84
|
-
|
|
93
|
+
actions?: (props: typeof __VLS_81) => any;
|
|
85
94
|
} & {
|
|
86
|
-
|
|
95
|
+
expansion?: (props: typeof __VLS_83) => any;
|
|
87
96
|
} & {
|
|
88
|
-
footer?: (props: typeof
|
|
97
|
+
footer?: (props: typeof __VLS_85) => any;
|
|
89
98
|
}>;
|
|
90
99
|
declare const __VLS_self: import("vue").DefineComponent<Props, {
|
|
91
100
|
emit: typeof emit;
|
|
92
101
|
tableKey: typeof tableKey;
|
|
102
|
+
expandedRows: typeof expandedRows;
|
|
93
103
|
_selected: typeof _selected;
|
|
94
104
|
dataHeaders: typeof dataHeaders;
|
|
95
105
|
isColumnHidden: typeof isColumnHidden;
|
|
@@ -103,6 +113,8 @@ declare const __VLS_self: import("vue").DefineComponent<Props, {
|
|
|
103
113
|
handleSelection: typeof handleSelection;
|
|
104
114
|
columnResize: typeof columnResize;
|
|
105
115
|
columnReorder: typeof columnReorder;
|
|
116
|
+
isRowExpanded: typeof isRowExpanded;
|
|
117
|
+
toggleRow: typeof toggleRow;
|
|
106
118
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
107
119
|
sort: (...args: any[]) => void;
|
|
108
120
|
"update:selected": (...args: any[]) => void;
|
|
@@ -125,12 +137,14 @@ declare const __VLS_self: import("vue").DefineComponent<Props, {
|
|
|
125
137
|
headless: boolean;
|
|
126
138
|
rowReorder: boolean;
|
|
127
139
|
isRowReorderDisabled: (row: any) => boolean;
|
|
140
|
+
rowExpansion: boolean;
|
|
128
141
|
rowClass: () => string;
|
|
129
142
|
rowStyle: () => {
|
|
130
143
|
[key: string]: string;
|
|
131
144
|
};
|
|
132
145
|
resizableColumns: boolean;
|
|
133
146
|
reorderableColumns: boolean;
|
|
147
|
+
rowExpansionDisabled: (row: object) => boolean;
|
|
134
148
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
135
149
|
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
136
150
|
sort: (...args: any[]) => void;
|
|
@@ -154,12 +168,14 @@ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {},
|
|
|
154
168
|
headless: boolean;
|
|
155
169
|
rowReorder: boolean;
|
|
156
170
|
isRowReorderDisabled: (row: any) => boolean;
|
|
171
|
+
rowExpansion: boolean;
|
|
157
172
|
rowClass: () => string;
|
|
158
173
|
rowStyle: () => {
|
|
159
174
|
[key: string]: string;
|
|
160
175
|
};
|
|
161
176
|
resizableColumns: boolean;
|
|
162
177
|
reorderableColumns: boolean;
|
|
178
|
+
rowExpansionDisabled: (row: object) => boolean;
|
|
163
179
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
164
180
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
165
181
|
export default _default;
|