@webitel/ui-sdk 3.1.69 → 3.1.71
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
|
@@ -4,10 +4,13 @@ import isEmpty from '../../../scripts/isEmpty';
|
|
|
4
4
|
export default class QueryFiltersStoreModule extends BaseStoreModule {
|
|
5
5
|
getters = {
|
|
6
6
|
GET_FILTERS: (state, getters) => Object.keys(state)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
.reduce((filters, filterKey) => {
|
|
8
|
+
const filterValue = getters.GET_FILTER(filterKey);
|
|
9
|
+
return isEmpty(filterValue) ? filters : {
|
|
10
|
+
...filters,
|
|
11
|
+
[filterKey]: filterValue,
|
|
12
|
+
};
|
|
13
|
+
}, {}),
|
|
11
14
|
GET_FILTER: (state) => (filter) => {
|
|
12
15
|
const { value, storedProp, multiple } = state[filter];
|
|
13
16
|
if (multiple) return value.map((item) => item[storedProp]); // if arr, map
|
|
@@ -22,7 +25,8 @@ export default class QueryFiltersStoreModule extends BaseStoreModule {
|
|
|
22
25
|
let newValue = value;
|
|
23
26
|
if (newValue) {
|
|
24
27
|
if (multiple && !Array.isArray(newValue)) newValue = [newValue];
|
|
25
|
-
} else if (newValue === null || newValue ===
|
|
28
|
+
} else if (newValue === null || newValue ===
|
|
29
|
+
undefined) newValue = defaultValue;
|
|
26
30
|
context.commit('SET_FILTER', { filter, value: newValue });
|
|
27
31
|
},
|
|
28
32
|
RESET_FILTERS: (context) => {
|
|
@@ -41,8 +45,17 @@ export default class QueryFiltersStoreModule extends BaseStoreModule {
|
|
|
41
45
|
},
|
|
42
46
|
};
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
/* FIXME REMOVE COMPLETELY AND USE GET_MODULE() INSERTION*/
|
|
49
|
+
constructor({
|
|
50
|
+
state = {},
|
|
51
|
+
getters = {},
|
|
52
|
+
actions = {},
|
|
53
|
+
mutations = {},
|
|
54
|
+
} = {}) {
|
|
45
55
|
super();
|
|
46
|
-
this.state = state;
|
|
47
|
-
|
|
56
|
+
this.state = { ...this.state, ...state };
|
|
57
|
+
this.getters = { ...this.getters, ...getters };
|
|
58
|
+
this.actions = { ...this.actions, ...actions };
|
|
59
|
+
this.mutations = { ...this.mutations, ...mutations };
|
|
60
|
+
};
|
|
48
61
|
}
|