@webitel/ui-sdk 3.2.42 → 3.2.44

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-sdk",
3
- "version": "3.2.42",
3
+ "version": "3.2.44",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -7,7 +7,7 @@ export default class BaseFilterSchema {
7
7
  } = {}) {
8
8
  this.value = value;
9
9
  this.defaultValue = defaultValue;
10
- this.restore = restore;
11
- this.localStorageKey = localStorageKey;
10
+ if (restore) this.restore = restore;
11
+ if (localStorageKey) this.localStorageKey = localStorageKey;
12
12
  }
13
13
  }
@@ -18,21 +18,15 @@ export default class TableStoreModule extends BaseStoreModule {
18
18
  // required fields to send as "fields" param with GET_LIST
19
19
  REQUIRED_FIELDS: () => ['id'],
20
20
 
21
- // fields to send with GET_LIST
22
- FIELDS: (state) => {
23
- let fields = state.headers
24
- .filter((header) => header.show)
25
- .map((header) => header.field);
26
- fields = [...new Set(fields)];
27
- return fields;
28
- },
29
-
30
21
  // main GET_LIST params collector
31
22
  GET_LIST_PARAMS: (state, getters) => (overrideFilters) => {
32
- const fields = getters.FIELDS.concat(getters.REQUIRED_FIELDS);
33
-
34
23
  const filters = getters.GET_FILTERS || getters['filters/GET_FILTERS'];
35
24
 
25
+ const fields = (filters.fields || [
26
+ ...new Set(state.headers.filter((header) => header.show)
27
+ .map((header) => header.field)),
28
+ ]).concat(getters.REQUIRED_FIELDS);
29
+
36
30
  return {
37
31
  ...filters,
38
32
  fields,
@@ -98,11 +92,12 @@ export default class TableStoreModule extends BaseStoreModule {
98
92
  context.commit('SET_PAGE', page);
99
93
  },
100
94
  RESTORE_FIELDS_FROM_FILTER: (context, { value }) => {
95
+ console.info(value, context.state.headers);
101
96
  const headers = context.state.headers.map((header) => ({
102
97
  ...header,
103
98
  show: value.includes(header.field),
104
99
  }));
105
- return context.dispatch('SET_HEADERS', headers);
100
+ return context.dispatch('SET_HEADERS', headers);
106
101
  },
107
102
  SET_HEADERS: (context, headers) => context.commit('SET_HEADERS', headers),
108
103
  SORT: async (context, { header, nextSortOrder }) => {