@webitel/ui-datalist 1.0.60 → 1.0.61

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-datalist",
3
- "version": "1.0.60",
3
+ "version": "1.0.61",
4
4
  "description": "Toolkit for building data lists in webitel ui system",
5
5
  "scripts": {
6
6
  "make-all": "npm version patch --git-tag-version false && ( npm run lint:fix || true) && (npm run build:types || true) && npm run utils:publish",
@@ -92,7 +92,7 @@ const props = defineProps<{
92
92
  * presets "section" namespace
93
93
  */
94
94
  namespace: string;
95
- usePresetsStore: Store;
95
+ presetsStore: () => Store;
96
96
  filterConfigs: AnyFilterConfig[];
97
97
  }>();
98
98
 
@@ -106,7 +106,7 @@ const { t } = useI18n();
106
106
 
107
107
  const showPresetsList = ref(false);
108
108
 
109
- const presetsStore = props.usePresetsStore();
109
+ const presetsStore = props.presetsStore;
110
110
  const { dataList, error, isLoading, filtersManager, presetId } =
111
111
  storeToRefs(presetsStore);
112
112
 
@@ -15,13 +15,16 @@ export const filterPresetsStoreBody = (namespace = 'presets') => {
15
15
  const presetId = ref(null);
16
16
 
17
17
  const setupPresetPersistence = async () => {
18
- const { restore: restorePreset } = usePersistedStorage({
18
+ const { restore: restorePreset, reset } = usePersistedStorage({
19
19
  name: 'preset',
20
20
  value: presetId,
21
21
  storages: [PersistedStorageType.LocalStorage],
22
22
  storagePath: presetsNamespace,
23
23
  onStore: (save, { name }) => {
24
24
  const value = presetId.value;
25
+ if (!value) {
26
+ return reset();
27
+ }
25
28
  return save({ name, value });
26
29
  },
27
30
  onRestore: async (restore, name) => {
@@ -38,11 +41,16 @@ export const filterPresetsStoreBody = (namespace = 'presets') => {
38
41
  disablePersistence: true,
39
42
  });
40
43
 
44
+ const resetPreset = () => {
45
+ presetId.value = null;
46
+ };
47
+
41
48
  return {
42
49
  ...tableStore,
43
50
 
44
51
  presetId,
45
52
  setupPresetPersistence,
53
+ resetPreset,
46
54
  };
47
55
  };
48
56
 
@@ -38,7 +38,7 @@
38
38
  <apply-preset-action
39
39
  :filter-configs="filterConfigs"
40
40
  :namespace="props.presetNamespace"
41
- :use-presets-store="props.usePresetsStore"
41
+ :presets-store="presetStore"
42
42
  @apply="emit('preset:apply', $event)"
43
43
  />
44
44
 
@@ -53,7 +53,7 @@
53
53
  <wt-icon-action
54
54
  :disabled="!listSelectedFilters.size"
55
55
  action="clear"
56
- @click="emit('filter:reset-all')"
56
+ @click="handleResetFilters"
57
57
  />
58
58
 
59
59
  <wt-icon-action
@@ -181,6 +181,15 @@ Clear filters button should be active only if filters are defined in the table-f
181
181
 
182
182
  const listSelectedFilters = computed(()=>
183
183
  new Map([...props.filtersManager.filters].filter(([key]) => props.filterOptions.includes(key))));
184
+
185
+ const presetStore = props.usePresetsStore();
186
+
187
+ const handleResetFilters = () => {
188
+ emit('filter:reset-all')
189
+ if (presetStore) {
190
+ presetStore.resetPreset()
191
+ }
192
+ }
184
193
  </script>
185
194
 
186
195
  <style>
@@ -5,7 +5,7 @@ type __VLS_Props = {
5
5
  * presets "section" namespace
6
6
  */
7
7
  namespace: string;
8
- usePresetsStore: Store;
8
+ presetsStore: () => Store;
9
9
  filterConfigs: AnyFilterConfig[];
10
10
  };
11
11
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
@@ -1,6 +1,7 @@
1
1
  export declare const filterPresetsStoreBody: (namespace?: string) => {
2
2
  presetId: import("vue").Ref<any, any>;
3
3
  setupPresetPersistence: () => Promise<void>;
4
+ resetPreset: () => void;
4
5
  dataList: import("vue").Ref<EnginePresetQuery[], EnginePresetQuery[]>;
5
6
  selected: import("vue").Ref<EnginePresetQuery[], EnginePresetQuery[]>;
6
7
  error: import("vue").Ref<any, any>;
@@ -94,6 +95,7 @@ export declare const filterPresetsStoreBody: (namespace?: string) => {
94
95
  export declare const createFilterPresetsStore: (namespace: string) => () => {
95
96
  presetId: import("vue").Ref<any, any>;
96
97
  setupPresetPersistence: () => Promise<void>;
98
+ resetPreset: () => void;
97
99
  dataList: import("vue").Ref<EnginePresetQuery[], EnginePresetQuery[]>;
98
100
  selected: import("vue").Ref<EnginePresetQuery[], EnginePresetQuery[]>;
99
101
  error: import("vue").Ref<any, any>;