@starasia/admin 8.27.0 → 8.28.0
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/dist/components/FilterBar/hooks/useLastFilterState.d.ts +11 -1
- package/dist/components/FilterBar/types.d.ts +7 -0
- package/dist/index.cjs.js +18 -18
- package/dist/index.es.js +1434 -1404
- package/dist/index.umd.js +16 -16
- package/package.json +1 -1
|
@@ -7,6 +7,16 @@ interface UseLastFilterStateOptions {
|
|
|
7
7
|
snapshotKeys: string[];
|
|
8
8
|
/** Opt-out toggle (default true when scopeId is provided). */
|
|
9
9
|
enabled?: boolean;
|
|
10
|
+
/** URL param holding the JSON-blob of filter values (default `'filter'`). */
|
|
11
|
+
filterKey?: string;
|
|
12
|
+
/** Field name for search inside the `filterKey` blob (default `'q'`). */
|
|
13
|
+
searchKey?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the search term is kept in the snapshot. Default `true`. When
|
|
16
|
+
* `false`, `searchKey` is stripped from the `filterKey` blob on both write
|
|
17
|
+
* and read, so filters + page still persist/restore but search does not.
|
|
18
|
+
*/
|
|
19
|
+
persistSearch?: boolean;
|
|
10
20
|
}
|
|
11
21
|
/**
|
|
12
22
|
* Persists the latest filter URL params per scope, so link-based back
|
|
@@ -25,7 +35,7 @@ interface UseLastFilterStateOptions {
|
|
|
25
35
|
* supaya state "sudah di-clear" tidak ter-restore lagi saat balik ke halaman.
|
|
26
36
|
* - **`clear()`**: removes the snapshot (dipanggil dari Reset).
|
|
27
37
|
*/
|
|
28
|
-
export declare function useLastFilterState({ scopeId, storage, snapshotKeys, enabled }: UseLastFilterStateOptions): {
|
|
38
|
+
export declare function useLastFilterState({ scopeId, storage, snapshotKeys, enabled, filterKey, searchKey, persistSearch }: UseLastFilterStateOptions): {
|
|
29
39
|
enabled: boolean;
|
|
30
40
|
read: () => Record<string, string> | null;
|
|
31
41
|
clear: () => void;
|
|
@@ -201,6 +201,13 @@ export interface FilterBarProps {
|
|
|
201
201
|
* params (e.g. link-based back navigation). Requires `scopeId`. Default `true`.
|
|
202
202
|
*/
|
|
203
203
|
persistLastState?: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Whether the search term is included in the auto last-state snapshot.
|
|
206
|
+
* Default `true`. Set `false` to keep filters + page persisted/restored on
|
|
207
|
+
* back-navigation while the search box always starts empty. Only affects the
|
|
208
|
+
* automatic snapshot — Saved Views still capture search.
|
|
209
|
+
*/
|
|
210
|
+
persistSearch?: boolean;
|
|
204
211
|
/** Persistence adapter (default: localStorage via @starasia/storage). */
|
|
205
212
|
storage?: FilterStorageAdapter;
|
|
206
213
|
/** Called after a full reset (clears filters + search). */
|