@webitel/ui-sdk 25.10.27 → 25.10.29
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/img/sprite/index.js +2 -2
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +4968 -4926
- package/dist/ui-sdk.umd.cjs +42 -33
- package/package.json +1 -1
- package/src/components/wt-table/wt-table.vue +64 -4
- package/src/modules/TableComponentModule/composables/useTableEmpty.js +1 -1
- package/src/plugins/primevue/theme/components/table/table.js +9 -0
- package/types/components/wt-table/wt-table.vue.d.ts +31 -9
- package/types/enums/index.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "25.10.
|
|
3
|
+
"version": "25.10.29",
|
|
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",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<p-table
|
|
3
3
|
ref="table"
|
|
4
|
+
:key="tableKey"
|
|
4
5
|
class="wt-table"
|
|
5
6
|
:value="data"
|
|
6
7
|
:show-headers="!headless"
|
|
@@ -8,16 +9,28 @@
|
|
|
8
9
|
:row-style="rowStyle"
|
|
9
10
|
lazy
|
|
10
11
|
scrollable
|
|
11
|
-
:resizable-columns="resizableColumns"
|
|
12
12
|
scroll-height="flex"
|
|
13
|
+
:resizable-columns="resizableColumns"
|
|
14
|
+
:reorderable-columns="reorderableColumns"
|
|
15
|
+
column-resize-mode="expand"
|
|
13
16
|
@sort="sort"
|
|
17
|
+
@column-resize-end="columnResize"
|
|
18
|
+
@column-reorder="columnReorder"
|
|
14
19
|
@row-reorder="({dragIndex, dropIndex}) => emit('reorder:row', { oldIndex: dragIndex, newIndex: dropIndex })"
|
|
15
20
|
>
|
|
16
21
|
<p-column
|
|
17
22
|
v-if="rowReorder"
|
|
18
23
|
column-key="row-reorder"
|
|
19
24
|
row-reorder
|
|
25
|
+
:reorderable-column="false"
|
|
20
26
|
header-style="width: 1%;"
|
|
27
|
+
:pt="{
|
|
28
|
+
columnresizer: {
|
|
29
|
+
class: {
|
|
30
|
+
'hidden': true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}"
|
|
21
34
|
>
|
|
22
35
|
<template #body="{ data: row }">
|
|
23
36
|
<wt-icon
|
|
@@ -30,7 +43,15 @@
|
|
|
30
43
|
<p-column
|
|
31
44
|
v-if="selectable"
|
|
32
45
|
column-key="row-select"
|
|
46
|
+
:reorderable-column="false"
|
|
33
47
|
header-style="width: 1%;"
|
|
48
|
+
:pt="{
|
|
49
|
+
columnresizer: {
|
|
50
|
+
class: {
|
|
51
|
+
'hidden': true
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}"
|
|
34
55
|
>
|
|
35
56
|
<template #header>
|
|
36
57
|
<wt-checkbox
|
|
@@ -55,7 +76,13 @@
|
|
|
55
76
|
:field="col.field"
|
|
56
77
|
:sortable="isColSortable(col)"
|
|
57
78
|
:hidden="isColumnHidden(col)"
|
|
79
|
+
:pt="{
|
|
80
|
+
root: {
|
|
81
|
+
'data-column-field': col.field // required for column-resizer to get column field
|
|
82
|
+
}
|
|
83
|
+
}"
|
|
58
84
|
>
|
|
85
|
+
|
|
59
86
|
<template #header>
|
|
60
87
|
<div class="wt-table__th__content">
|
|
61
88
|
{{ col.text }}
|
|
@@ -191,7 +218,8 @@ interface Props extends DataTableProps{
|
|
|
191
218
|
isRowReorderDisabled?: (row) => boolean;
|
|
192
219
|
rowClass?: () => string;
|
|
193
220
|
rowStyle?: () => { [key: string]: string };
|
|
194
|
-
resizableColumns?: boolean
|
|
221
|
+
resizableColumns?: boolean
|
|
222
|
+
reorderableColumns?: boolean
|
|
195
223
|
}
|
|
196
224
|
|
|
197
225
|
const props = withDefaults(defineProps<Props>(), {
|
|
@@ -206,16 +234,21 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
206
234
|
isRowReorderDisabled: () => false,
|
|
207
235
|
rowClass: () => '',
|
|
208
236
|
rowStyle: () => ({}),
|
|
209
|
-
resizableColumns: false
|
|
237
|
+
resizableColumns: false,
|
|
238
|
+
reorderableColumns: false,
|
|
210
239
|
});
|
|
211
240
|
|
|
212
241
|
const { t } = useI18n();
|
|
213
242
|
|
|
214
243
|
const slots = useSlots();
|
|
215
244
|
|
|
216
|
-
const emit = defineEmits(['sort', 'update:selected', 'reorder:row']);
|
|
245
|
+
const emit = defineEmits(['sort', 'update:selected', 'reorder:row', 'column-resize', 'column-reorder']);
|
|
217
246
|
|
|
218
247
|
const table = useTemplateRef('table');
|
|
248
|
+
const tableKey = ref(0);
|
|
249
|
+
|
|
250
|
+
// table's columns that should be excluded from reorder
|
|
251
|
+
const excludeColumnsFromReorder = ['row-select', 'row-reorder', 'row-actions']
|
|
219
252
|
|
|
220
253
|
const _selected = computed(() => {
|
|
221
254
|
// _isSelected for backwards compatibility
|
|
@@ -317,6 +350,32 @@ const handleSelection = (row, select) => {
|
|
|
317
350
|
row._isSelected = !row._isSelected;
|
|
318
351
|
}
|
|
319
352
|
}
|
|
353
|
+
|
|
354
|
+
const columnResize = ({element}) => {
|
|
355
|
+
// getting column name by custom attribute due Primevue does not provide it
|
|
356
|
+
const field = element.getAttribute('data-column-field')
|
|
357
|
+
|
|
358
|
+
const computedStyle = getComputedStyle(element);
|
|
359
|
+
const paddingLeft = parseFloat(computedStyle.paddingLeft);
|
|
360
|
+
const paddingRight = parseFloat(computedStyle.paddingRight);
|
|
361
|
+
|
|
362
|
+
const columnWidth = element.offsetWidth - paddingLeft - paddingRight
|
|
363
|
+
|
|
364
|
+
emit('column-resize', { columnName: field, columnWidth: `${columnWidth}px` })
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const columnReorder = async ({dropIndex, originalEvent}) => {
|
|
368
|
+
const newOrder = table.value.d_columnOrder.filter(col => !excludeColumnsFromReorder.includes(col))
|
|
369
|
+
|
|
370
|
+
//save scroll position after table rerender
|
|
371
|
+
const tableScrollTopPosition = table.value.$el.querySelector('.p-datatable-table').scrollTop
|
|
372
|
+
const tableScrollLeftPosition = table.value.$el.querySelector('.p-datatable-table').scrollLeft
|
|
373
|
+
tableKey.value += 1 // rerender table preventing unexpected behavior
|
|
374
|
+
table.value.$el.querySelector('.p-datatable-table').scrollTop = tableScrollTopPosition
|
|
375
|
+
table.value.$el.querySelector('.p-datatable-table').scrollLeft = tableScrollLeftPosition
|
|
376
|
+
|
|
377
|
+
emit('column-reorder', newOrder)
|
|
378
|
+
}
|
|
320
379
|
</script>
|
|
321
380
|
|
|
322
381
|
<style lang="scss">
|
|
@@ -326,6 +385,7 @@ const handleSelection = (row, select) => {
|
|
|
326
385
|
<style lang="scss" scoped>
|
|
327
386
|
@use '@webitel/styleguide/scroll' as *;
|
|
328
387
|
@use '@webitel/styleguide/typography' as *;
|
|
388
|
+
@use '@webitel/styleguide/typography' as *;
|
|
329
389
|
|
|
330
390
|
.wt-table {
|
|
331
391
|
@extend %wt-scrollbar;
|
|
@@ -3,7 +3,7 @@ import { computed, inject } from 'vue';
|
|
|
3
3
|
import { useI18n } from 'vue-i18n';
|
|
4
4
|
import { useStore } from 'vuex';
|
|
5
5
|
|
|
6
|
-
import { EmptyCause } from '../../../enums/index
|
|
6
|
+
import { EmptyCause } from '../../../enums/index';
|
|
7
7
|
import { isEmpty } from '../../../scripts/index.js';
|
|
8
8
|
import EmptyFiltersDark from '../_internals/assets/empty-filters-dark.svg';
|
|
9
9
|
import EmptyFiltersLight from '../_internals/assets/empty-filters-light.svg';
|
|
@@ -54,6 +54,15 @@ const table = {
|
|
|
54
54
|
|
|
55
55
|
.p-datatable-column-resizer {
|
|
56
56
|
background: ${dt('datatable.columnResizer.background')};
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.p-datatable-resizable-table > .p-datatable-tbody > tr > td {
|
|
61
|
+
white-space: normal;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.p-datatable-column-resize-indicator {
|
|
65
|
+
|
|
57
66
|
}
|
|
58
67
|
`,
|
|
59
68
|
};
|
|
@@ -43,8 +43,10 @@ interface Props extends DataTableProps {
|
|
|
43
43
|
[key: string]: string;
|
|
44
44
|
};
|
|
45
45
|
resizableColumns?: boolean;
|
|
46
|
+
reorderableColumns?: boolean;
|
|
46
47
|
}
|
|
47
|
-
declare const emit: (event: "sort" | "update:selected" | "reorder:row", ...args: any[]) => void;
|
|
48
|
+
declare const emit: (event: "sort" | "update:selected" | "reorder:row" | "column-resize" | "column-reorder", ...args: any[]) => void;
|
|
49
|
+
declare const tableKey: import("vue").Ref<number, number>;
|
|
48
50
|
declare const _selected: import("vue").ComputedRef<unknown[]>;
|
|
49
51
|
declare const dataHeaders: import("vue").ComputedRef<WtTableHeader[]>;
|
|
50
52
|
declare const isColumnHidden: (col: any) => boolean;
|
|
@@ -62,27 +64,35 @@ declare const isColSortable: ({ sort }: {
|
|
|
62
64
|
}) => boolean;
|
|
63
65
|
declare const selectAll: () => void;
|
|
64
66
|
declare const handleSelection: (row: any, select: any) => void;
|
|
67
|
+
declare const columnResize: ({ element }: {
|
|
68
|
+
element: any;
|
|
69
|
+
}) => void;
|
|
70
|
+
declare const columnReorder: ({ dropIndex, originalEvent }: {
|
|
71
|
+
dropIndex: any;
|
|
72
|
+
originalEvent: any;
|
|
73
|
+
}) => Promise<void>;
|
|
65
74
|
declare const __VLS_ctx: InstanceType<__VLS_PickNotAny<typeof __VLS_self, new () => {}>>;
|
|
66
|
-
declare var
|
|
75
|
+
declare var __VLS_55: string, __VLS_56: {
|
|
67
76
|
index: any;
|
|
68
77
|
item: any;
|
|
69
|
-
},
|
|
78
|
+
}, __VLS_59: `${string}-footer`, __VLS_60: {}, __VLS_66: {}, __VLS_68: {
|
|
70
79
|
index: any;
|
|
71
80
|
item: any;
|
|
72
|
-
},
|
|
81
|
+
}, __VLS_70: {};
|
|
73
82
|
type __VLS_Slots = __VLS_PrettifyGlobal<__VLS_OmitStringIndex<typeof __VLS_ctx.$slots> & {
|
|
74
|
-
[K in NonNullable<typeof
|
|
83
|
+
[K in NonNullable<typeof __VLS_55>]?: (props: typeof __VLS_56) => any;
|
|
75
84
|
} & {
|
|
76
|
-
[K in NonNullable<typeof
|
|
85
|
+
[K in NonNullable<typeof __VLS_59>]?: (props: typeof __VLS_60) => any;
|
|
77
86
|
} & {
|
|
78
|
-
'actions-header'?: (props: typeof
|
|
87
|
+
'actions-header'?: (props: typeof __VLS_66) => any;
|
|
79
88
|
} & {
|
|
80
|
-
actions?: (props: typeof
|
|
89
|
+
actions?: (props: typeof __VLS_68) => any;
|
|
81
90
|
} & {
|
|
82
|
-
footer?: (props: typeof
|
|
91
|
+
footer?: (props: typeof __VLS_70) => any;
|
|
83
92
|
}>;
|
|
84
93
|
declare const __VLS_self: import("vue").DefineComponent<Props, {
|
|
85
94
|
emit: typeof emit;
|
|
95
|
+
tableKey: typeof tableKey;
|
|
86
96
|
_selected: typeof _selected;
|
|
87
97
|
dataHeaders: typeof dataHeaders;
|
|
88
98
|
isColumnHidden: typeof isColumnHidden;
|
|
@@ -94,14 +104,20 @@ declare const __VLS_self: import("vue").DefineComponent<Props, {
|
|
|
94
104
|
isColSortable: typeof isColSortable;
|
|
95
105
|
selectAll: typeof selectAll;
|
|
96
106
|
handleSelection: typeof handleSelection;
|
|
107
|
+
columnResize: typeof columnResize;
|
|
108
|
+
columnReorder: typeof columnReorder;
|
|
97
109
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
98
110
|
sort: (...args: any[]) => void;
|
|
99
111
|
"update:selected": (...args: any[]) => void;
|
|
100
112
|
"reorder:row": (...args: any[]) => void;
|
|
113
|
+
"column-resize": (...args: any[]) => void;
|
|
114
|
+
"column-reorder": (...args: any[]) => void;
|
|
101
115
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
102
116
|
onSort?: (...args: any[]) => any;
|
|
103
117
|
"onUpdate:selected"?: (...args: any[]) => any;
|
|
104
118
|
"onReorder:row"?: (...args: any[]) => any;
|
|
119
|
+
"onColumn-resize"?: (...args: any[]) => any;
|
|
120
|
+
"onColumn-reorder"?: (...args: any[]) => any;
|
|
105
121
|
}>, {
|
|
106
122
|
headers: WtTableHeader[];
|
|
107
123
|
data: Array<unknown>;
|
|
@@ -117,15 +133,20 @@ declare const __VLS_self: import("vue").DefineComponent<Props, {
|
|
|
117
133
|
[key: string]: string;
|
|
118
134
|
};
|
|
119
135
|
resizableColumns: boolean;
|
|
136
|
+
reorderableColumns: boolean;
|
|
120
137
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
121
138
|
declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
122
139
|
sort: (...args: any[]) => void;
|
|
123
140
|
"update:selected": (...args: any[]) => void;
|
|
124
141
|
"reorder:row": (...args: any[]) => void;
|
|
142
|
+
"column-resize": (...args: any[]) => void;
|
|
143
|
+
"column-reorder": (...args: any[]) => void;
|
|
125
144
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
126
145
|
onSort?: (...args: any[]) => any;
|
|
127
146
|
"onUpdate:selected"?: (...args: any[]) => any;
|
|
128
147
|
"onReorder:row"?: (...args: any[]) => any;
|
|
148
|
+
"onColumn-resize"?: (...args: any[]) => any;
|
|
149
|
+
"onColumn-reorder"?: (...args: any[]) => any;
|
|
129
150
|
}>, {
|
|
130
151
|
headers: WtTableHeader[];
|
|
131
152
|
data: Array<unknown>;
|
|
@@ -141,6 +162,7 @@ declare const __VLS_component: import("vue").DefineComponent<Props, {}, {}, {},
|
|
|
141
162
|
[key: string]: string;
|
|
142
163
|
};
|
|
143
164
|
resizableColumns: boolean;
|
|
165
|
+
reorderableColumns: boolean;
|
|
144
166
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
145
167
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
146
168
|
export default _default;
|
package/types/enums/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import AgentStatus from './AgentStatus/AgentStatus.enum.js';
|
|
|
3
3
|
import { ButtonColor } from './ButtonColor/ButtonColor';
|
|
4
4
|
import ChatGatewayProvider from './ChatGatewayProvider/ChatGatewayProvider.enum.js';
|
|
5
5
|
import { ChipColor } from './ChipColor/ChipColor';
|
|
6
|
-
import { EmptyCause } from './EmptyCause/EmptyCause';
|
|
7
6
|
import { ComponentSize } from './ComponentSize/ComponentSize';
|
|
8
7
|
import { CrudAction } from './CrudAction/CrudAction';
|
|
8
|
+
import { EmptyCause } from './EmptyCause/EmptyCause';
|
|
9
9
|
import IconAction from './IconAction/IconAction.enum.js';
|
|
10
10
|
import { IconColor } from './IconColor/IconColor';
|
|
11
11
|
import { ProcessingTableColumnType } from './ProcessingTableColumnType/ProcessingTableColumnType';
|
|
@@ -20,4 +20,4 @@ import WebitelApplications from './WebitelApplications/WebitelApplications.enum.
|
|
|
20
20
|
import { WtApplication } from './WebitelApplications/WtApplication';
|
|
21
21
|
import { WtObject } from './WtObject/WtObject';
|
|
22
22
|
import { WtTypeExtensionFieldKind } from './WtTypeExtensionFieldKind/WtTypeExtensionFieldKind';
|
|
23
|
-
export { AbstractUserStatus, AdminSections, AgentStatus, AuditorSections, ButtonColor,
|
|
23
|
+
export { AbstractUserStatus, AdminSections, AgentStatus, AuditorSections, ButtonColor, ChatGatewayProvider, ChipColor, ComponentSize, CrmSections, CrudAction, EmptyCause, IconAction, IconColor, ProcessingTableColumnType, QueueType, RelativeDatetimeValue, SupervisorSections, TypesExportedSettings, WebitelApplications, WtApplication, WtObject, WtTypeExtensionFieldKind, };
|