@webitel/ui-sdk 24.12.21 → 24.12.22

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": "24.12.21",
3
+ "version": "24.12.22",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -1,3 +1,4 @@
1
+ import deepCopy from 'deep-copy';
1
2
  import FilterEvent from '../../../../modules/Filters/enums/FilterEvent.enum.js';
2
3
  import {
3
4
  queryToSortAdapter,
@@ -11,6 +12,7 @@ const state = () => ({
11
12
  error: {},
12
13
  isLoading: false,
13
14
  isNextPage: false,
15
+ _resettable: {},
14
16
  });
15
17
 
16
18
  const getters = {
@@ -234,10 +236,21 @@ const actions = {
234
236
  context,
235
237
  payload,
236
238
  ) => context.dispatch('api/DELETE_ITEM', payload),
239
+
240
+ RESET_TABLE_STATE: async (context) => {
241
+ context.commit('RESET_TABLE_STATE');
242
+ },
243
+ };
244
+
245
+ const mutations = {
246
+ RESET_TABLE_STATE: (state) => {
247
+ Object.assign(state, deepCopy(state._resettable));
248
+ },
237
249
  };
238
250
 
239
251
  export default () => ({
240
252
  state: state(),
241
253
  getters,
242
254
  actions,
255
+ mutations,
243
256
  });
@@ -46,6 +46,10 @@ export const useTableStore = (namespace) => {
46
46
  return store.dispatch(`${tableNamespace}/SET_SELECTED`, payload);
47
47
  }
48
48
 
49
+ function resetState(payload) {
50
+ return store.dispatch(`${tableNamespace}/RESET_TABLE_STATE`, payload);
51
+ }
52
+
49
53
  return {
50
54
  namespace: tableNamespace,
51
55
 
@@ -62,5 +66,6 @@ export const useTableStore = (namespace) => {
62
66
  deleteData,
63
67
  sort,
64
68
  setSelected,
69
+ resetState,
65
70
  };
66
71
  };