@webitel/ui-sdk 3.2.23 → 3.2.25

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.23",
3
+ "version": "3.2.25",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -75,6 +75,7 @@ export default class FiltersStoreModule extends BaseStoreModule {
75
75
  // eslint-disable-next-line consistent-return
76
76
  RESTORE_FILTER: (context, { filter }) => {
77
77
  const value = context.getters.GET_VALUE_FROM_QUERY({ filterQuery: filter });
78
+ if (filter === 'sort') context.dispatch('RESTORE_SORT', { value });
78
79
  if (value) return context.dispatch('SET_FILTER', ({ filter, value }));
79
80
  },
80
81
  RESTORE_FILTERS: (context) => {
@@ -85,7 +86,17 @@ export default class FiltersStoreModule extends BaseStoreModule {
85
86
  context.commit('RESET_FILTERS');
86
87
  },
87
88
  ON_FILTER_SET: (context, { filter, value }) => context.dispatch('LOAD_DATA_LIST'),
88
- LOAD_DATA_LIST: () => console.error('please override LOAD_DATA_LIST action in filters store'),
89
+
90
+ LOAD_DATA_LIST: (context) => context.dispatch(
91
+ `${context.getters.TABLE_NAMESPACE}/LOAD_DATA_LIST`,
92
+ { filters: context.getters.GET_FILTERS },
93
+ { root: true },
94
+ ),
95
+ RESTORE_SORT: (context, { value }) => context.dispatch(
96
+ `${context.getters.TABLE_NAMESPACE}/RESTORE_SORT_FROM_FILTER`,
97
+ { value },
98
+ { root: true },
99
+ ),
89
100
  };
90
101
 
91
102
  mutations = {
@@ -1,4 +1,5 @@
1
1
  import {
2
+ queryToSortAdapter,
2
3
  SortSymbols,
3
4
  sortToQueryAdapter,
4
5
  } from '../../../scripts/sortQueryAdapters';
@@ -101,10 +102,13 @@ export default class TableStoreModule extends BaseStoreModule {
101
102
  const sort = nextSortOrder
102
103
  ? `${sortToQueryAdapter(nextSortOrder)}${header.field}`
103
104
  : nextSortOrder;
104
- context.commit('SET_SORT', sort);
105
- context.dispatch('UPDATE_HEADER_SORT', { header, nextSortOrder });
106
- await context.dispatch('RESET_PAGE');
107
- return context.dispatch('LOAD_DATA_LIST');
105
+ await context.dispatch('filters/SET_FILTER', { filter: 'sort', value: sort });
106
+ await context.dispatch('UPDATE_HEADER_SORT', { header, nextSortOrder });
107
+ },
108
+ RESTORE_SORT_FROM_FILTER: (context, { value }) => {
109
+ const sort = queryToSortAdapter(value.slice(0, 1));
110
+ const header = sort ? value.slice(1) : value;
111
+ return context.dispatch('UPDATE_HEADER_SORT', { header, nextSortOrder: sort });
108
112
  },
109
113
  UPDATE_HEADER_SORT: (context, { header, nextSortOrder }) => {
110
114
  const headers = context.state.headers.map((oldHeader) => {
@@ -185,9 +189,6 @@ export default class TableStoreModule extends BaseStoreModule {
185
189
  SET_PAGE: (state, page) => {
186
190
  state.page = page;
187
191
  },
188
- SET_SORT: (state, sort) => {
189
- state.sort = sort;
190
- },
191
192
  SET_IS_NEXT: (state, next) => {
192
193
  state.isNextPage = next;
193
194
  },