@webitel/ui-sdk 3.1.57 → 3.1.59
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
|
@@ -17,19 +17,46 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
17
17
|
isNextPage: false,
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
+
getters = {
|
|
21
|
+
// required fields to send as "fields" param with GET_LIST
|
|
22
|
+
REQUIRED_FIELDS: () => ['id'],
|
|
23
|
+
|
|
24
|
+
// fields to send with GET_LIST
|
|
25
|
+
FIELDS: (state) => {
|
|
26
|
+
let fields = state.headers
|
|
27
|
+
.filter((header) => header.show)
|
|
28
|
+
.map((header) => header.field);
|
|
29
|
+
fields = [...new Set(fields)];
|
|
30
|
+
return fields;
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
// main GET_LIST params collector
|
|
34
|
+
GET_LIST_PARAMS: (state, getters) => (query) => {
|
|
35
|
+
const fields = getters.FIELDS.concat(getters.REQUIRED_FIELDS);
|
|
36
|
+
|
|
37
|
+
const filters = getters.GET_FILTERS || getters['filters/GET_FILTERS'];
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
...query,
|
|
41
|
+
...filters,
|
|
42
|
+
fields,
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
20
47
|
actions = {
|
|
21
48
|
// HOOKS TO BE OVERRIDEN, IF NEEDED
|
|
22
49
|
BEFORE_SET_DATA_LIST_HOOK: (context, { items, next }) => ({ items, next }),
|
|
23
50
|
AFTER_SET_DATA_LIST_HOOK: (context, { items, next }) => ({ items, next }),
|
|
24
51
|
|
|
25
|
-
LOAD_DATA_LIST: async (context,
|
|
26
|
-
const
|
|
52
|
+
LOAD_DATA_LIST: async (context, query) => {
|
|
53
|
+
const params = context.getters.GET_LIST_PARAMS(query);
|
|
27
54
|
try {
|
|
28
55
|
context.commit('SET_LOADING', true);
|
|
29
56
|
let {
|
|
30
57
|
items = [],
|
|
31
58
|
next = false,
|
|
32
|
-
} = await context.dispatch('api/GET_LIST', { context, params
|
|
59
|
+
} = await context.dispatch('api/GET_LIST', { context, params });
|
|
33
60
|
/* we should set _isSelected property to all items in tables cause their checkbox selection
|
|
34
61
|
* is based on this property. Previously, this prop was set it api consumers, but now
|
|
35
62
|
* admin-specific were replaced by webitel-sdk consumers and i supposed it will be
|