@webitel/ui-datalist 1.1.53 → 1.1.55
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 +1 -1
- package/src/index.ts +2 -0
- package/src/modules/_shared/createDatalistStore.ts +2 -4
- package/src/modules/filter-presets/stores/createFilterPresetsStore.ts +37 -13
- package/src/modules/filters/modules/filterConfig/components/_shared/durations/duration-filter-value-field.vue +2 -2
- package/src/modules/types/createDatalistStore.types.ts +11 -5
- package/types/.tsbuildinfo +1 -1
- package/types/index.d.ts +2 -0
- package/types/modules/filter-presets/stores/createFilterPresetsStore.d.ts +16 -158
- package/types/modules/headers/createTableHeadersStore.d.ts +18 -18
- package/types/modules/permissions-page/stores/createPermissionsStore.d.ts +20 -20
- package/types/modules/table/createTableStore.store.d.ts +20 -20
- package/types/modules/types/createDatalistStore.types.d.ts +8 -3
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -61,10 +61,8 @@ export const createDatalistStore = <
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
if (thisStoreType === DatalistStoreProvider.Pinia) {
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
// not structurally match PatchableStoreFactory. Reconcile the two factory
|
|
67
|
-
// types instead of asserting here.
|
|
64
|
+
// Pinia StoreDefinition is a valid PatchableStoreFactory at runtime;
|
|
65
|
+
// PatchableStore includes StoreGeneric so consumers can use storeToRefs.
|
|
68
66
|
return definePiniaStore(namespace, () =>
|
|
69
67
|
storeBody({
|
|
70
68
|
...config,
|
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
import { ref } from 'vue';
|
|
2
2
|
import type { EnginePresetQuery } from 'webitel-sdk';
|
|
3
3
|
|
|
4
|
+
import { createDatalistStore } from '../../_shared/createDatalistStore';
|
|
4
5
|
import { PersistedStorageType } from '../../persist/PersistedStorage.types';
|
|
5
6
|
import { usePersistedStorage } from '../../persist/usePersistedStorage';
|
|
6
7
|
import { tableStoreBody } from '../../table/createTableStore.store';
|
|
8
|
+
import type { PatchableStoreFactory } from '../../types/createDatalistStore.types';
|
|
7
9
|
import PresetQueryAPI from '../api/PresetQuery';
|
|
8
10
|
import { headers } from './headers/headers';
|
|
9
11
|
|
|
12
|
+
const presetsTableConfig = {
|
|
13
|
+
/* PresetQueryAPI's add/update take preset-specific params, so only the
|
|
14
|
+
ApiModule-conforming methods the table store actually calls go in */
|
|
15
|
+
apiModule: {
|
|
16
|
+
getList: PresetQueryAPI.getList,
|
|
17
|
+
get: PresetQueryAPI.get,
|
|
18
|
+
delete: PresetQueryAPI.delete,
|
|
19
|
+
},
|
|
20
|
+
headers,
|
|
21
|
+
disablePersistence: true as const,
|
|
22
|
+
};
|
|
23
|
+
|
|
10
24
|
export const filterPresetsStoreBody = (namespace = 'presets') => {
|
|
11
25
|
const presetsNamespace = namespace.endsWith('presets')
|
|
12
26
|
? namespace
|
|
@@ -40,17 +54,10 @@ export const filterPresetsStoreBody = (namespace = 'presets') => {
|
|
|
40
54
|
await restorePreset();
|
|
41
55
|
};
|
|
42
56
|
|
|
43
|
-
const tableStore = tableStoreBody<EnginePresetQuery>(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
getList: PresetQueryAPI.getList,
|
|
48
|
-
get: PresetQueryAPI.get,
|
|
49
|
-
delete: PresetQueryAPI.delete,
|
|
50
|
-
},
|
|
51
|
-
headers,
|
|
52
|
-
disablePersistence: true,
|
|
53
|
-
});
|
|
57
|
+
const tableStore = tableStoreBody<EnginePresetQuery>(
|
|
58
|
+
presetsNamespace,
|
|
59
|
+
presetsTableConfig,
|
|
60
|
+
);
|
|
54
61
|
|
|
55
62
|
const resetPreset = () => {
|
|
56
63
|
presetId.value = null;
|
|
@@ -65,6 +72,23 @@ export const filterPresetsStoreBody = (namespace = 'presets') => {
|
|
|
65
72
|
};
|
|
66
73
|
};
|
|
67
74
|
|
|
68
|
-
export
|
|
69
|
-
|
|
75
|
+
export type FilterPresetsStore = ReturnType<typeof filterPresetsStoreBody>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Pinia store factory (via createDatalistStore), same pattern as createTableStore.
|
|
79
|
+
* Previously returned a plain object factory — that broke storeToRefs / props typed
|
|
80
|
+
* as `() => StoreGeneric` and forced app-level asPiniaStoreFactory casts.
|
|
81
|
+
*/
|
|
82
|
+
export const createFilterPresetsStore = (
|
|
83
|
+
namespace: string,
|
|
84
|
+
): PatchableStoreFactory<FilterPresetsStore> => {
|
|
85
|
+
const presetsNamespace = namespace.endsWith('presets')
|
|
86
|
+
? namespace
|
|
87
|
+
: `${namespace}/presets`;
|
|
88
|
+
|
|
89
|
+
return createDatalistStore<FilterPresetsStore, EnginePresetQuery>({
|
|
90
|
+
namespace: presetsNamespace,
|
|
91
|
+
config: presetsTableConfig,
|
|
92
|
+
storeBody: () => filterPresetsStoreBody(namespace),
|
|
93
|
+
});
|
|
70
94
|
};
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:label="t('reusable.from')"
|
|
6
6
|
:model-value="model.from"
|
|
7
7
|
:v="vFrom"
|
|
8
|
-
format="mm:ss"
|
|
8
|
+
format="hh:mm:ss"
|
|
9
9
|
@update:model-value="handleInput('from', $event)"
|
|
10
10
|
/>
|
|
11
11
|
<wt-timepicker
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:label="t('reusable.to')"
|
|
14
14
|
:model-value="model.to"
|
|
15
15
|
:v="vTo"
|
|
16
|
-
format="mm:ss"
|
|
16
|
+
format="hh:mm:ss"
|
|
17
17
|
@update:model-value="handleInput('to', $event)"
|
|
18
18
|
/>
|
|
19
19
|
</div>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { StoreGeneric } from 'pinia';
|
|
1
2
|
import type { Ref } from 'vue';
|
|
2
3
|
|
|
3
4
|
import type { useTableStoreConfig } from './tableStore.types';
|
|
@@ -32,10 +33,15 @@ export interface CreateDatalistStoreParams<
|
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
* PatchableStore is needed to indicate that the store we are using also has a storePatch method (previously $patch)
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
* PatchableStore is needed to indicate that the store we are using also has a storePatch method (previously $patch).
|
|
37
|
+
*
|
|
38
|
+
* Intersects StoreGeneric so pinia helpers (`storeToRefs`) and props typed as
|
|
39
|
+
* `() => StoreGeneric` accept the factory result — runtime pinia stores already
|
|
40
|
+
* satisfy StoreGeneric; the previous plain-record shape forced app-level casts.
|
|
41
|
+
*/
|
|
42
|
+
export type PatchableStore<T extends StoreInstance> = T &
|
|
43
|
+
StoreGeneric & {
|
|
44
|
+
$patch: (val: Patch) => void;
|
|
45
|
+
};
|
|
40
46
|
export type PatchableStoreFactory<T extends StoreInstance> =
|
|
41
47
|
() => PatchableStore<T>;
|