@webitel/ui-sdk 3.2.41 → 3.2.42
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,13 @@
|
|
|
1
|
+
export default class BaseFilterSchema {
|
|
2
|
+
constructor({
|
|
3
|
+
value = '',
|
|
4
|
+
defaultValue = '',
|
|
5
|
+
restore,
|
|
6
|
+
localStorageKey,
|
|
7
|
+
} = {}) {
|
|
8
|
+
this.value = value;
|
|
9
|
+
this.defaultValue = defaultValue;
|
|
10
|
+
this.restore = restore;
|
|
11
|
+
this.localStorageKey = localStorageKey;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -83,6 +83,7 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
83
83
|
const value = context.state[filter].restore ? context.state[filter].restore({ query }) : query;
|
|
84
84
|
if (value) {
|
|
85
85
|
if (filter === 'sort') await context.dispatch('RESTORE_SORT', { value });
|
|
86
|
+
else if (filter === 'fields') await context.dispatch('RESTORE_FIELDS', { value });
|
|
86
87
|
await context.dispatch('SET_FILTER', ({ filter, value }));
|
|
87
88
|
return true;
|
|
88
89
|
}
|
|
@@ -117,6 +118,11 @@ export default class FiltersStoreModule extends BaseStoreModule {
|
|
|
117
118
|
{ value },
|
|
118
119
|
{ root: true },
|
|
119
120
|
),
|
|
121
|
+
RESTORE_FIELDS: (context, { value }) => context.dispatch(
|
|
122
|
+
`${context.getters.TABLE_NAMESPACE}/RESTORE_FIELDS_FROM_FILTER`,
|
|
123
|
+
{ value },
|
|
124
|
+
{ root: true },
|
|
125
|
+
),
|
|
120
126
|
};
|
|
121
127
|
|
|
122
128
|
mutations = {
|
|
@@ -97,6 +97,13 @@ export default class TableStoreModule extends BaseStoreModule {
|
|
|
97
97
|
const page = 1;
|
|
98
98
|
context.commit('SET_PAGE', page);
|
|
99
99
|
},
|
|
100
|
+
RESTORE_FIELDS_FROM_FILTER: (context, { value }) => {
|
|
101
|
+
const headers = context.state.headers.map((header) => ({
|
|
102
|
+
...header,
|
|
103
|
+
show: value.includes(header.field),
|
|
104
|
+
}));
|
|
105
|
+
return context.dispatch('SET_HEADERS', headers);
|
|
106
|
+
},
|
|
100
107
|
SET_HEADERS: (context, headers) => context.commit('SET_HEADERS', headers),
|
|
101
108
|
SORT: async (context, { header, nextSortOrder }) => {
|
|
102
109
|
const sort = nextSortOrder
|