@webitel/ui-datalist 1.0.94 → 1.0.96
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-datalist",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.96",
|
|
4
4
|
"description": "Toolkit for building data lists in webitel ui system",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"make-all": "npm version patch --git-tag-version false && ( npm run lint:fix || true) && (npm run build:types || true) && npm run utils:publish",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@vuelidate/core": "^2.0.3",
|
|
37
37
|
"@vuelidate/validators": "^2.0.4",
|
|
38
38
|
"@vueuse/core": "^13.3.0",
|
|
39
|
-
"@webitel/api-services": "^0.0.
|
|
39
|
+
"@webitel/api-services": "^0.0.105",
|
|
40
40
|
"@webitel/styleguide": "^24.12.61",
|
|
41
41
|
"@webitel/ui-sdk": "^25.8.62",
|
|
42
42
|
"zod": "^3.25.55"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import deepEqual from 'deep-equal';
|
|
1
2
|
import set from 'lodash/fp/set';
|
|
2
|
-
import { type Ref, ref, watch } from 'vue';
|
|
3
|
+
import { type Ref, ref, toRaw, watch } from 'vue';
|
|
3
4
|
|
|
4
5
|
import {
|
|
5
6
|
createDatalistStore,
|
|
@@ -46,9 +47,14 @@ export const tableStoreBody = <Entity extends { id: string; etag?: string }>(
|
|
|
46
47
|
} = paginationStore;
|
|
47
48
|
|
|
48
49
|
const headersStore = useHeadersStore();
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const {
|
|
51
|
+
headers,
|
|
52
|
+
shownHeaders,
|
|
53
|
+
fields,
|
|
54
|
+
sort,
|
|
55
|
+
columnWidths,
|
|
56
|
+
isReorderingColumn,
|
|
57
|
+
} = makeThisToRefs<typeof headersStore>(headersStore, storeType);
|
|
52
58
|
const {
|
|
53
59
|
updateSort,
|
|
54
60
|
columnResize,
|
|
@@ -58,9 +64,11 @@ export const tableStoreBody = <Entity extends { id: string; etag?: string }>(
|
|
|
58
64
|
} = headersStore;
|
|
59
65
|
|
|
60
66
|
const filtersStore = useFiltersStore();
|
|
61
|
-
const {
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
const {
|
|
68
|
+
filtersManager,
|
|
69
|
+
isRestoring: isFiltersRestoring,
|
|
70
|
+
searchMode,
|
|
71
|
+
} = makeThisToRefs<typeof filtersStore>(filtersStore, storeType);
|
|
64
72
|
const {
|
|
65
73
|
hasFilter,
|
|
66
74
|
addFilter,
|
|
@@ -109,7 +117,16 @@ export const tableStoreBody = <Entity extends { id: string; etag?: string }>(
|
|
|
109
117
|
const { items, next } = await apiModule.getList(params);
|
|
110
118
|
|
|
111
119
|
dataList.value = items;
|
|
112
|
-
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @author: @Oleksandr Palonnyi
|
|
123
|
+
*
|
|
124
|
+
* [WTEL-8571](https://webitel.atlassian.net/browse/WTEL-8571)
|
|
125
|
+
*
|
|
126
|
+
* link to refactor task - https://webitel.atlassian.net/browse/WTEL-8599
|
|
127
|
+
* */
|
|
128
|
+
updateSelected(filterSelected(items));
|
|
129
|
+
|
|
113
130
|
$patchPaginationStore({ next });
|
|
114
131
|
} catch (err) {
|
|
115
132
|
error.value = err;
|
|
@@ -119,6 +136,14 @@ export const tableStoreBody = <Entity extends { id: string; etag?: string }>(
|
|
|
119
136
|
}
|
|
120
137
|
};
|
|
121
138
|
|
|
139
|
+
function filterSelected(items: Entity[]): Entity[] {
|
|
140
|
+
const selectedToRaw = selected.value.map(toRaw);
|
|
141
|
+
|
|
142
|
+
return items.filter((item) =>
|
|
143
|
+
selectedToRaw.some((s) => deepEqual(s, item)),
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
122
147
|
const appendToDataList = async () => {
|
|
123
148
|
isLoading.value = true;
|
|
124
149
|
$patchPaginationStore({ next: false });
|
|
@@ -203,9 +228,9 @@ export const tableStoreBody = <Entity extends { id: string; etag?: string }>(
|
|
|
203
228
|
[() => filtersManager.value.getAllValues(), sort, fields, size],
|
|
204
229
|
async () => {
|
|
205
230
|
/*
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
231
|
+
* @author @Lera24
|
|
232
|
+
* https://webitel.atlassian.net/browse/WTEL-7597?focusedCommentId=697115
|
|
233
|
+
* */
|
|
209
234
|
if (isReorderingColumn.value) {
|
|
210
235
|
return;
|
|
211
236
|
}
|
|
@@ -5,6 +5,8 @@ import { WtTableHeader } from '../../../../../src/components/wt-table/types/WtTa
|
|
|
5
5
|
import { IFiltersManager } from '../filters';
|
|
6
6
|
import { DatalistStoreProviderType } from './StoreProvider';
|
|
7
7
|
|
|
8
|
+
export type TrackSelectedRowBy<T> = (row: T) => T;
|
|
9
|
+
|
|
8
10
|
export interface useTableStoreConfig<Entity> {
|
|
9
11
|
apiModule: ApiModule<Entity>;
|
|
10
12
|
headers: WtTableHeader[];
|
|
@@ -3,6 +3,7 @@ import type { Ref } from 'vue';
|
|
|
3
3
|
import { WtTableHeader } from '../../../../../src/components/wt-table/types/WtTable';
|
|
4
4
|
import { IFiltersManager } from '../filters';
|
|
5
5
|
import { DatalistStoreProviderType } from './StoreProvider';
|
|
6
|
+
export type TrackSelectedRowBy<T> = (row: T) => T;
|
|
6
7
|
export interface useTableStoreConfig<Entity> {
|
|
7
8
|
apiModule: ApiModule<Entity>;
|
|
8
9
|
headers: WtTableHeader[];
|