diff --git a/package.json b/package.json index d768a434..ac4c479e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@webitel/ui-sdk", - "version": "24.12.21", + "version": "24.12.22", "private": false, "scripts": { "dev": "vite", diff --git a/src/store/new/modules/tableStoreModule/tableStoreModule.js b/src/store/new/modules/tableStoreModule/tableStoreModule.js index 4a1a4410..4c06b081 100644 --- a/src/store/new/modules/tableStoreModule/tableStoreModule.js +++ b/src/store/new/modules/tableStoreModule/tableStoreModule.js @@ -1,3 +1,4 @@ +import deepCopy from 'deep-copy'; import FilterEvent from '../../../../modules/Filters/enums/FilterEvent.enum.js'; import { queryToSortAdapter, @@ -11,6 +12,7 @@ const state = () => ({ error: {}, isLoading: false, isNextPage: false, + _resettable: {}, }); const getters = { @@ -234,10 +236,21 @@ const actions = { context, payload, ) => context.dispatch('api/DELETE_ITEM', payload), + + RESET_TABLE_STATE: async (context) => { + context.commit('RESET_TABLE_STATE'); + }, +}; + +const mutations = { + RESET_TABLE_STATE: (state) => { + Object.assign(state, deepCopy(state._resettable)); + }, }; export default () => ({ state: state(), getters, actions, + mutations, }); diff --git a/src/store/new/modules/tableStoreModule/useTableStore.js b/src/store/new/modules/tableStoreModule/useTableStore.js index c13aabaa..f7f8b17b 100644 --- a/src/store/new/modules/tableStoreModule/useTableStore.js +++ b/src/store/new/modules/tableStoreModule/useTableStore.js @@ -46,6 +46,10 @@ export const useTableStore = (namespace) => { return store.dispatch(`${tableNamespace}/SET_SELECTED`, payload); } + function resetState(payload) { + return store.dispatch(`${tableNamespace}/RESET_TABLE_STATE`, payload); + } + return { namespace: tableNamespace, @@ -62,5 +66,6 @@ export const useTableStore = (namespace) => { deleteData, sort, setSelected, + resetState, }; };