@webitel/ui-sdk 3.2.52 → 3.2.54
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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { onMounted } from 'vue';
|
|
2
|
+
import { useStore } from 'vuex';
|
|
3
|
+
|
|
4
|
+
export const useTableFilters = (namespace) => {
|
|
5
|
+
const store = useStore();
|
|
6
|
+
|
|
7
|
+
const filtersNamespace = `${namespace}/filters`;
|
|
8
|
+
|
|
9
|
+
function restoreFilters(payload) {
|
|
10
|
+
return store.dispatch(`${filtersNamespace.value}/RESTORE_FILTERS`, payload);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
onMounted(() => restoreFilters());
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
filtersNamespace,
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"restore" functions for filters
|
|
@@ -29,7 +29,11 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
actions = {
|
|
32
|
-
SET_FILTER: async (context, {
|
|
32
|
+
SET_FILTER: async (context, {
|
|
33
|
+
filter,
|
|
34
|
+
value,
|
|
35
|
+
source, // === restore, if this is filters restore call
|
|
36
|
+
}) => {
|
|
33
37
|
const { multiple, defaultValue } = context.state[filter];
|
|
34
38
|
let newValue = value;
|
|
35
39
|
if (newValue) {
|
|
@@ -43,12 +47,12 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
43
47
|
});
|
|
44
48
|
context.commit('SET_FILTER', { filter, value: newValue });
|
|
45
49
|
|
|
46
|
-
if (filter !== 'page') {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
50
|
+
if (source !== 'restore' && filter !== 'page') {
|
|
51
|
+
context.dispatch('SET_FILTER', {
|
|
52
|
+
filter: 'page',
|
|
53
|
+
value: 1,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
52
56
|
|
|
53
57
|
return context.dispatch('ON_FILTER_SET', { filter, value });
|
|
54
58
|
},
|
|
@@ -96,7 +100,7 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
96
100
|
=== 'sort') await context.dispatch('RESTORE_SORT', { value });
|
|
97
101
|
else if (filter
|
|
98
102
|
=== 'fields') await context.dispatch('RESTORE_FIELDS', { value });
|
|
99
|
-
await context.dispatch('SET_FILTER', ({ filter, value }));
|
|
103
|
+
await context.dispatch('SET_FILTER', ({ filter, value, source: 'restore' }));
|
|
100
104
|
return true;
|
|
101
105
|
}
|
|
102
106
|
return false;
|
|
@@ -53,6 +53,13 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
53
53
|
|
|
54
54
|
actions = {
|
|
55
55
|
LOAD_DATA_LIST: async (context, query) => {
|
|
56
|
+
/*
|
|
57
|
+
https://my.webitel.com/browse/WTEL-3560
|
|
58
|
+
preventively disable isNext to handle case when user is clicking
|
|
59
|
+
"next" faster than actual request is made
|
|
60
|
+
*/
|
|
61
|
+
context.commit('SET_IS_NEXT', false);
|
|
62
|
+
|
|
56
63
|
const params = context.getters.GET_LIST_PARAMS(query);
|
|
57
64
|
try {
|
|
58
65
|
context.commit('SET_LOADING', true);
|