@timeax/form-palette 0.0.30 → 0.0.31
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/Readme.md +651 -0
- package/dist/extra.d.mts +213 -40
- package/dist/extra.d.ts +213 -40
- package/dist/extra.js +624 -85
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +622 -86
- package/dist/extra.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +241 -84
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +241 -84
- package/dist/index.mjs.map +1 -1
- package/dist/{variant-v0LBdshU.d.ts → variant-BhsBO5Yr.d.ts} +1 -1
- package/dist/{variant-BPDyK780.d.mts → variant-jHi2M5Ru.d.mts} +1 -1
- package/package.json +1 -1
package/dist/extra.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { M as
|
|
4
|
-
export {
|
|
3
|
+
import { M as ListerDefinition, N as ListerRuntimeState, O as ListerProviderHost, P as PresetMap, Q as ListerStoreState, U as ListerSessionId, W as ListerId, X as ListerSearchMode, Y as ListerSearchTarget, Z as ListerSearchPayload, _ as ListerFilterCtx, $ as ListerFilterOption, a0 as ListerMode, a1 as ListerApi, a2 as ShadcnJsonEditorProps, a3 as JsonEditorIndexHandle } from './variant-jHi2M5Ru.mjs';
|
|
4
|
+
export { a8 as ListerChangeEvent, as as ListerDetails, ai as ListerFilterApply, ah as ListerFilterApplyMode, aj as ListerFilterBindKey, al as ListerFilterGroupOption, ak as ListerFilterInput, an as ListerFilterInputOption, ao as ListerFilterSpec, am as ListerFilterValueOption, aa as ListerLogCode, ab as ListerLogEntry, a9 as ListerLogLevel, ae as ListerMapping, at as ListerOpenOptions, a4 as ListerOpenReason, au as ListerOpenResult, ad as ListerOption, ar as ListerOptionsForMode, ac as ListerPermissionCtx, aq as ListerRawForMode, ag as ListerSearchSpec, az as ListerSessionState, af as ListerSource, ap as ListerValueForMode, a7 as OpenAnchor, ax as PresetFilters, ay as PresetMeta, av as PresetRaw, aw as PresetValue, a6 as Resolver, a5 as Selector } from './variant-jHi2M5Ru.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './adapter-CvjXO9Gi.mjs';
|
|
7
7
|
import '@inertiajs/core';
|
|
@@ -31,8 +31,81 @@ type AnyDef = ListerDefinition<any, any, any, any>;
|
|
|
31
31
|
type AnyState = ListerRuntimeState<any, any, any, any, any> & {
|
|
32
32
|
searchSpec?: any;
|
|
33
33
|
searchTarget?: any;
|
|
34
|
+
searchPayload?: any;
|
|
34
35
|
ownerKey?: string;
|
|
35
36
|
};
|
|
37
|
+
type InternalContextValue = {
|
|
38
|
+
host: ListerProviderHost;
|
|
39
|
+
http: ListerHttpClient;
|
|
40
|
+
presetsRef: React.RefObject<PresetMap>;
|
|
41
|
+
store: ListerStoreState;
|
|
42
|
+
apiFetchAny: (kindOrDef: string | AnyDef, filters?: any, opts?: any) => Promise<any>;
|
|
43
|
+
apiOpenAny: (kindOrDef: string | AnyDef, filters?: any, opts?: any) => Promise<any>;
|
|
44
|
+
focus(id: ListerSessionId): void;
|
|
45
|
+
dispose(id: ListerSessionId): void;
|
|
46
|
+
apply(id: ListerSessionId): void;
|
|
47
|
+
cancel(id: ListerSessionId): void;
|
|
48
|
+
close(id: ListerSessionId): void;
|
|
49
|
+
toggle(id: ListerSessionId, value: ListerId): void;
|
|
50
|
+
select(id: ListerSessionId, value: ListerId): void;
|
|
51
|
+
deselect(id: ListerSessionId, value: ListerId): void;
|
|
52
|
+
clear(id: ListerSessionId): void;
|
|
53
|
+
setQuery(id: ListerSessionId, q: string): void;
|
|
54
|
+
setSearchMode(id: ListerSessionId, mode: ListerSearchMode): void;
|
|
55
|
+
/**
|
|
56
|
+
* Persist the user's current search target (subject/all/only)
|
|
57
|
+
* so all searches (local/remote/hybrid) can include it.
|
|
58
|
+
*/
|
|
59
|
+
setSearchTarget(id: ListerSessionId, target: ListerSearchTarget): void;
|
|
60
|
+
/**
|
|
61
|
+
* Backwards compatible signatures:
|
|
62
|
+
* - existing calls still work: searchRemote(id, q)
|
|
63
|
+
* - new calls can optionally override payload: searchRemote(id, q, payload)
|
|
64
|
+
*
|
|
65
|
+
* If payload is omitted, implementation should read from session.searchTarget.
|
|
66
|
+
*/
|
|
67
|
+
searchLocal: {
|
|
68
|
+
(id: ListerSessionId, q: string): void;
|
|
69
|
+
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
70
|
+
};
|
|
71
|
+
searchRemote: {
|
|
72
|
+
(id: ListerSessionId, q: string): void;
|
|
73
|
+
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
74
|
+
};
|
|
75
|
+
refresh(id: ListerSessionId): void;
|
|
76
|
+
setPosition(id: ListerSessionId, pos: {
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
} | null): void;
|
|
80
|
+
/** Filters (non-UI logic; per session) */
|
|
81
|
+
getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
|
|
82
|
+
/**
|
|
83
|
+
* NEW semantics:
|
|
84
|
+
* - `optionId` is the UI identifier of the filter option (NOT the db value)
|
|
85
|
+
* - `selectedFilterValues` tracks selected option ids (for UI checkmarks/badge)
|
|
86
|
+
*/
|
|
87
|
+
applyFilterOption(id: ListerSessionId, optionId: string | number): void;
|
|
88
|
+
registerPreset(kind: string, def: AnyDef): void;
|
|
89
|
+
getPreset(kind: string): AnyDef | undefined;
|
|
90
|
+
/** Derived list for UI later (local/hybrid filtering) */
|
|
91
|
+
getVisibleOptions(id: ListerSessionId): any[];
|
|
92
|
+
};
|
|
93
|
+
declare const Ctx: React.Context<InternalContextValue | null>;
|
|
94
|
+
type ResolvedFilterNode<TFilters> = {
|
|
95
|
+
option: ListerFilterOption<TFilters>;
|
|
96
|
+
id: string;
|
|
97
|
+
kind?: string;
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
bindKey?: string;
|
|
100
|
+
dbValue?: any;
|
|
101
|
+
apply?: {
|
|
102
|
+
key?: string;
|
|
103
|
+
mode?: "replace" | "merge" | "unset";
|
|
104
|
+
toggleable?: boolean;
|
|
105
|
+
value?: any;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
declare function buildSearchPayloadFromTarget(target?: ListerSearchTarget | null): ListerSearchPayload | undefined;
|
|
36
109
|
declare function ListerProvider(props: {
|
|
37
110
|
host: ListerProviderHost;
|
|
38
111
|
presets?: PresetMap;
|
|
@@ -41,6 +114,48 @@ declare function ListerProvider(props: {
|
|
|
41
114
|
remoteDebounceMs?: number;
|
|
42
115
|
children: React.ReactNode;
|
|
43
116
|
}): react_jsx_runtime.JSX.Element;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Search bar + trailing controls:
|
|
120
|
+
* - Search target (all/subject/only) popover (leading control)
|
|
121
|
+
* - Search mode toggle (remote/local/hybrid)
|
|
122
|
+
* - Filters UI (custom popover button)
|
|
123
|
+
*
|
|
124
|
+
* Notes:
|
|
125
|
+
* - Search mode is bound to session.searchMode via actions.setSearchMode(id, mode)
|
|
126
|
+
* - Search target is bound to session.searchTarget via actions.setSearchTarget(id, target)
|
|
127
|
+
* - Filters live in session.filtersSpec?.options and session.selectedFilterValues
|
|
128
|
+
*/
|
|
129
|
+
declare function SearchBar(props: {
|
|
130
|
+
id: ListerSessionId;
|
|
131
|
+
store: ListerStoreState;
|
|
132
|
+
}): react_jsx_runtime.JSX.Element;
|
|
133
|
+
|
|
134
|
+
declare function ListerUI(): react_jsx_runtime.JSX.Element | null;
|
|
135
|
+
declare function HeaderBar(props: {
|
|
136
|
+
id: ListerSessionId;
|
|
137
|
+
title: string;
|
|
138
|
+
loading: boolean;
|
|
139
|
+
refreshing: boolean;
|
|
140
|
+
showRefresh: boolean;
|
|
141
|
+
draggable: boolean;
|
|
142
|
+
onRefresh(): void;
|
|
143
|
+
onClose(): void;
|
|
144
|
+
}): react_jsx_runtime.JSX.Element;
|
|
145
|
+
|
|
146
|
+
declare function OptionList(props: {
|
|
147
|
+
id: ListerSessionId;
|
|
148
|
+
className?: string;
|
|
149
|
+
}): react_jsx_runtime.JSX.Element;
|
|
150
|
+
declare function FooterBar(props: {
|
|
151
|
+
id: ListerSessionId;
|
|
152
|
+
mode: ListerMode;
|
|
153
|
+
confirm: boolean;
|
|
154
|
+
onClear(): void;
|
|
155
|
+
onCancel(): void;
|
|
156
|
+
onApply(): void;
|
|
157
|
+
}): react_jsx_runtime.JSX.Element;
|
|
158
|
+
|
|
44
159
|
declare function useLister<P extends PresetMap>(): {
|
|
45
160
|
api: ListerApi<P>;
|
|
46
161
|
store: ListerStoreState;
|
|
@@ -82,46 +197,104 @@ declare function useLister<P extends PresetMap>(): {
|
|
|
82
197
|
};
|
|
83
198
|
|
|
84
199
|
/**
|
|
85
|
-
*
|
|
86
|
-
* -
|
|
87
|
-
* -
|
|
88
|
-
* - Filters UI (custom popover button)
|
|
89
|
-
*
|
|
90
|
-
* Notes:
|
|
91
|
-
* - Search mode is bound to session.searchMode via actions.setSearchMode(id, mode)
|
|
92
|
-
* - Search target is bound to session.searchTarget via actions.setSearchTarget(id, target)
|
|
93
|
-
* - Filters live in session.filtersSpec?.options and session.selectedFilterValues
|
|
200
|
+
* Minimal selector contract (matches extractArray contract used by lister)
|
|
201
|
+
* - function: (body) => array
|
|
202
|
+
* - string: path selector
|
|
94
203
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
204
|
+
type DataSelector<T> = any;
|
|
205
|
+
type DataSearchConfig = {
|
|
206
|
+
default?: string;
|
|
207
|
+
};
|
|
208
|
+
type DataBuildRequestCtx<TFilters> = {
|
|
209
|
+
filters?: TFilters;
|
|
210
|
+
query: string;
|
|
211
|
+
cursor: any;
|
|
212
|
+
};
|
|
213
|
+
type DataBuildRequestResult = {
|
|
214
|
+
params?: any;
|
|
215
|
+
body?: any;
|
|
216
|
+
headers?: any;
|
|
217
|
+
};
|
|
218
|
+
type DataKey = string | number;
|
|
219
|
+
type DataSelectionMode = "none" | "single" | "multiple";
|
|
220
|
+
type DataSelectionKey<TItem> = keyof TItem | string | ((item: TItem) => DataKey | null | undefined);
|
|
221
|
+
type DataSelectionConfig<TItem> = {
|
|
222
|
+
mode?: Exclude<DataSelectionMode, "none">;
|
|
223
|
+
/**
|
|
224
|
+
* How to resolve the ID for an item.
|
|
225
|
+
* - string/ keyof: item[key]
|
|
226
|
+
* - function: (item) => id
|
|
227
|
+
* Defaults to: item.id ?? item.value
|
|
228
|
+
*/
|
|
229
|
+
key?: DataSelectionKey<TItem>;
|
|
230
|
+
/**
|
|
231
|
+
* If "missing", selection IDs that don't exist in the *latest fetched list* are removed.
|
|
232
|
+
* Default: "never" (recommended; avoids wiping selection on remote searches).
|
|
233
|
+
*/
|
|
234
|
+
prune?: "never" | "missing";
|
|
235
|
+
};
|
|
236
|
+
type UseDataOptions<TItem = any, TFilters = Record<string, any>> = {
|
|
237
|
+
id?: string;
|
|
238
|
+
endpoint: string;
|
|
239
|
+
method?: "GET" | "POST";
|
|
240
|
+
selector?: DataSelector<TItem>;
|
|
241
|
+
/**
|
|
242
|
+
* Passed through into the inline def source.buildRequest (same signature as provider)
|
|
243
|
+
*/
|
|
244
|
+
buildRequest?: (ctx: DataBuildRequestCtx<TFilters>) => DataBuildRequestResult;
|
|
245
|
+
/**
|
|
246
|
+
* Minimal search config (default subject column).
|
|
247
|
+
*/
|
|
248
|
+
search?: DataSearchConfig;
|
|
249
|
+
/**
|
|
250
|
+
* Raw filters object
|
|
251
|
+
*/
|
|
252
|
+
filters?: TFilters;
|
|
253
|
+
initial?: TItem[];
|
|
254
|
+
enabled?: boolean;
|
|
255
|
+
fetchOnMount?: boolean;
|
|
256
|
+
searchMode?: ListerSearchMode;
|
|
257
|
+
debounceMs?: number;
|
|
258
|
+
autoFetchOnFilterChange?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Optional selection support (by stable item key)
|
|
261
|
+
*/
|
|
262
|
+
selection?: DataSelectionConfig<TItem>;
|
|
263
|
+
};
|
|
264
|
+
type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
265
|
+
id?: string;
|
|
266
|
+
data: TItem[];
|
|
267
|
+
visible: TItem[];
|
|
104
268
|
loading: boolean;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
269
|
+
error: any;
|
|
270
|
+
query: string;
|
|
271
|
+
setQuery: (q: string) => void;
|
|
272
|
+
searchMode: ListerSearchMode;
|
|
273
|
+
setSearchMode: (m: ListerSearchMode) => void;
|
|
274
|
+
searchTarget?: ListerSearchTarget;
|
|
275
|
+
setSearchTarget: (t: ListerSearchTarget) => void;
|
|
276
|
+
filters?: TFilters;
|
|
277
|
+
setFilters: (next: TFilters | undefined) => void;
|
|
278
|
+
patchFilters: (patch: Partial<TFilters>) => void;
|
|
279
|
+
clearFilters: () => void;
|
|
280
|
+
selectionMode: DataSelectionMode;
|
|
281
|
+
selectedIds: DataKey | DataKey[] | null;
|
|
282
|
+
selected: TItem | TItem[] | null;
|
|
283
|
+
select: (id: DataKey | DataKey[]) => void;
|
|
284
|
+
deselect: (id: DataKey | DataKey[]) => void;
|
|
285
|
+
toggle: (id: DataKey) => void;
|
|
286
|
+
clearSelection: () => void;
|
|
287
|
+
isSelected: (id: DataKey) => boolean;
|
|
288
|
+
getSelection: () => TItem | TItem[] | null;
|
|
289
|
+
refresh: () => void;
|
|
290
|
+
fetch: (override?: {
|
|
291
|
+
query?: string;
|
|
292
|
+
filters?: TFilters;
|
|
293
|
+
searchTarget?: ListerSearchTarget;
|
|
294
|
+
}) => Promise<TItem[]>;
|
|
295
|
+
};
|
|
296
|
+
declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters>): UseDataResult<TItem, TFilters>;
|
|
124
297
|
|
|
125
298
|
declare const ShadcnJsonEditorVariant: React.ForwardRefExoticComponent<ShadcnJsonEditorProps & React.RefAttributes<JsonEditorIndexHandle>>;
|
|
126
299
|
|
|
127
|
-
export { FooterBar, HeaderBar, ShadcnJsonEditorVariant as JsonEditor, ListerApi, ListerDefinition, ListerFilterCtx, ListerId, ListerMode, ListerProvider, ListerProviderHost, ListerRuntimeState, ListerSearchMode, ListerSearchPayload, ListerSearchTarget, ListerSessionId, ListerStoreState, ListerUI, OptionList, PresetMap, SearchBar, useLister };
|
|
300
|
+
export { type AnyDef, type AnyState, Ctx, type DataBuildRequestCtx, type DataBuildRequestResult, type DataKey, type DataSearchConfig, type DataSelectionConfig, type DataSelectionKey, type DataSelectionMode, type DataSelector, FooterBar, HeaderBar, type InternalContextValue, ShadcnJsonEditorVariant as JsonEditor, ListerApi, ListerDefinition, ListerFilterCtx, ListerFilterOption, ListerId, ListerMode, ListerProvider, ListerProviderHost, ListerRuntimeState, ListerSearchMode, ListerSearchPayload, ListerSearchTarget, ListerSessionId, ListerStoreState, ListerUI, OptionList, PresetMap, type ResolvedFilterNode, SearchBar, type UseDataOptions, type UseDataResult, buildSearchPayloadFromTarget, useData, useLister };
|
package/dist/extra.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { M as
|
|
4
|
-
export {
|
|
3
|
+
import { M as ListerDefinition, N as ListerRuntimeState, O as ListerProviderHost, P as PresetMap, Q as ListerStoreState, U as ListerSessionId, W as ListerId, X as ListerSearchMode, Y as ListerSearchTarget, Z as ListerSearchPayload, _ as ListerFilterCtx, $ as ListerFilterOption, a0 as ListerMode, a1 as ListerApi, a2 as ShadcnJsonEditorProps, a3 as JsonEditorIndexHandle } from './variant-BhsBO5Yr.js';
|
|
4
|
+
export { a8 as ListerChangeEvent, as as ListerDetails, ai as ListerFilterApply, ah as ListerFilterApplyMode, aj as ListerFilterBindKey, al as ListerFilterGroupOption, ak as ListerFilterInput, an as ListerFilterInputOption, ao as ListerFilterSpec, am as ListerFilterValueOption, aa as ListerLogCode, ab as ListerLogEntry, a9 as ListerLogLevel, ae as ListerMapping, at as ListerOpenOptions, a4 as ListerOpenReason, au as ListerOpenResult, ad as ListerOption, ar as ListerOptionsForMode, ac as ListerPermissionCtx, aq as ListerRawForMode, ag as ListerSearchSpec, az as ListerSessionState, af as ListerSource, ap as ListerValueForMode, a7 as OpenAnchor, ax as PresetFilters, ay as PresetMeta, av as PresetRaw, aw as PresetValue, a6 as Resolver, a5 as Selector } from './variant-BhsBO5Yr.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './adapter-CvjXO9Gi.js';
|
|
7
7
|
import '@inertiajs/core';
|
|
@@ -31,8 +31,81 @@ type AnyDef = ListerDefinition<any, any, any, any>;
|
|
|
31
31
|
type AnyState = ListerRuntimeState<any, any, any, any, any> & {
|
|
32
32
|
searchSpec?: any;
|
|
33
33
|
searchTarget?: any;
|
|
34
|
+
searchPayload?: any;
|
|
34
35
|
ownerKey?: string;
|
|
35
36
|
};
|
|
37
|
+
type InternalContextValue = {
|
|
38
|
+
host: ListerProviderHost;
|
|
39
|
+
http: ListerHttpClient;
|
|
40
|
+
presetsRef: React.RefObject<PresetMap>;
|
|
41
|
+
store: ListerStoreState;
|
|
42
|
+
apiFetchAny: (kindOrDef: string | AnyDef, filters?: any, opts?: any) => Promise<any>;
|
|
43
|
+
apiOpenAny: (kindOrDef: string | AnyDef, filters?: any, opts?: any) => Promise<any>;
|
|
44
|
+
focus(id: ListerSessionId): void;
|
|
45
|
+
dispose(id: ListerSessionId): void;
|
|
46
|
+
apply(id: ListerSessionId): void;
|
|
47
|
+
cancel(id: ListerSessionId): void;
|
|
48
|
+
close(id: ListerSessionId): void;
|
|
49
|
+
toggle(id: ListerSessionId, value: ListerId): void;
|
|
50
|
+
select(id: ListerSessionId, value: ListerId): void;
|
|
51
|
+
deselect(id: ListerSessionId, value: ListerId): void;
|
|
52
|
+
clear(id: ListerSessionId): void;
|
|
53
|
+
setQuery(id: ListerSessionId, q: string): void;
|
|
54
|
+
setSearchMode(id: ListerSessionId, mode: ListerSearchMode): void;
|
|
55
|
+
/**
|
|
56
|
+
* Persist the user's current search target (subject/all/only)
|
|
57
|
+
* so all searches (local/remote/hybrid) can include it.
|
|
58
|
+
*/
|
|
59
|
+
setSearchTarget(id: ListerSessionId, target: ListerSearchTarget): void;
|
|
60
|
+
/**
|
|
61
|
+
* Backwards compatible signatures:
|
|
62
|
+
* - existing calls still work: searchRemote(id, q)
|
|
63
|
+
* - new calls can optionally override payload: searchRemote(id, q, payload)
|
|
64
|
+
*
|
|
65
|
+
* If payload is omitted, implementation should read from session.searchTarget.
|
|
66
|
+
*/
|
|
67
|
+
searchLocal: {
|
|
68
|
+
(id: ListerSessionId, q: string): void;
|
|
69
|
+
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
70
|
+
};
|
|
71
|
+
searchRemote: {
|
|
72
|
+
(id: ListerSessionId, q: string): void;
|
|
73
|
+
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
74
|
+
};
|
|
75
|
+
refresh(id: ListerSessionId): void;
|
|
76
|
+
setPosition(id: ListerSessionId, pos: {
|
|
77
|
+
x: number;
|
|
78
|
+
y: number;
|
|
79
|
+
} | null): void;
|
|
80
|
+
/** Filters (non-UI logic; per session) */
|
|
81
|
+
getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
|
|
82
|
+
/**
|
|
83
|
+
* NEW semantics:
|
|
84
|
+
* - `optionId` is the UI identifier of the filter option (NOT the db value)
|
|
85
|
+
* - `selectedFilterValues` tracks selected option ids (for UI checkmarks/badge)
|
|
86
|
+
*/
|
|
87
|
+
applyFilterOption(id: ListerSessionId, optionId: string | number): void;
|
|
88
|
+
registerPreset(kind: string, def: AnyDef): void;
|
|
89
|
+
getPreset(kind: string): AnyDef | undefined;
|
|
90
|
+
/** Derived list for UI later (local/hybrid filtering) */
|
|
91
|
+
getVisibleOptions(id: ListerSessionId): any[];
|
|
92
|
+
};
|
|
93
|
+
declare const Ctx: React.Context<InternalContextValue | null>;
|
|
94
|
+
type ResolvedFilterNode<TFilters> = {
|
|
95
|
+
option: ListerFilterOption<TFilters>;
|
|
96
|
+
id: string;
|
|
97
|
+
kind?: string;
|
|
98
|
+
disabled?: boolean;
|
|
99
|
+
bindKey?: string;
|
|
100
|
+
dbValue?: any;
|
|
101
|
+
apply?: {
|
|
102
|
+
key?: string;
|
|
103
|
+
mode?: "replace" | "merge" | "unset";
|
|
104
|
+
toggleable?: boolean;
|
|
105
|
+
value?: any;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
declare function buildSearchPayloadFromTarget(target?: ListerSearchTarget | null): ListerSearchPayload | undefined;
|
|
36
109
|
declare function ListerProvider(props: {
|
|
37
110
|
host: ListerProviderHost;
|
|
38
111
|
presets?: PresetMap;
|
|
@@ -41,6 +114,48 @@ declare function ListerProvider(props: {
|
|
|
41
114
|
remoteDebounceMs?: number;
|
|
42
115
|
children: React.ReactNode;
|
|
43
116
|
}): react_jsx_runtime.JSX.Element;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Search bar + trailing controls:
|
|
120
|
+
* - Search target (all/subject/only) popover (leading control)
|
|
121
|
+
* - Search mode toggle (remote/local/hybrid)
|
|
122
|
+
* - Filters UI (custom popover button)
|
|
123
|
+
*
|
|
124
|
+
* Notes:
|
|
125
|
+
* - Search mode is bound to session.searchMode via actions.setSearchMode(id, mode)
|
|
126
|
+
* - Search target is bound to session.searchTarget via actions.setSearchTarget(id, target)
|
|
127
|
+
* - Filters live in session.filtersSpec?.options and session.selectedFilterValues
|
|
128
|
+
*/
|
|
129
|
+
declare function SearchBar(props: {
|
|
130
|
+
id: ListerSessionId;
|
|
131
|
+
store: ListerStoreState;
|
|
132
|
+
}): react_jsx_runtime.JSX.Element;
|
|
133
|
+
|
|
134
|
+
declare function ListerUI(): react_jsx_runtime.JSX.Element | null;
|
|
135
|
+
declare function HeaderBar(props: {
|
|
136
|
+
id: ListerSessionId;
|
|
137
|
+
title: string;
|
|
138
|
+
loading: boolean;
|
|
139
|
+
refreshing: boolean;
|
|
140
|
+
showRefresh: boolean;
|
|
141
|
+
draggable: boolean;
|
|
142
|
+
onRefresh(): void;
|
|
143
|
+
onClose(): void;
|
|
144
|
+
}): react_jsx_runtime.JSX.Element;
|
|
145
|
+
|
|
146
|
+
declare function OptionList(props: {
|
|
147
|
+
id: ListerSessionId;
|
|
148
|
+
className?: string;
|
|
149
|
+
}): react_jsx_runtime.JSX.Element;
|
|
150
|
+
declare function FooterBar(props: {
|
|
151
|
+
id: ListerSessionId;
|
|
152
|
+
mode: ListerMode;
|
|
153
|
+
confirm: boolean;
|
|
154
|
+
onClear(): void;
|
|
155
|
+
onCancel(): void;
|
|
156
|
+
onApply(): void;
|
|
157
|
+
}): react_jsx_runtime.JSX.Element;
|
|
158
|
+
|
|
44
159
|
declare function useLister<P extends PresetMap>(): {
|
|
45
160
|
api: ListerApi<P>;
|
|
46
161
|
store: ListerStoreState;
|
|
@@ -82,46 +197,104 @@ declare function useLister<P extends PresetMap>(): {
|
|
|
82
197
|
};
|
|
83
198
|
|
|
84
199
|
/**
|
|
85
|
-
*
|
|
86
|
-
* -
|
|
87
|
-
* -
|
|
88
|
-
* - Filters UI (custom popover button)
|
|
89
|
-
*
|
|
90
|
-
* Notes:
|
|
91
|
-
* - Search mode is bound to session.searchMode via actions.setSearchMode(id, mode)
|
|
92
|
-
* - Search target is bound to session.searchTarget via actions.setSearchTarget(id, target)
|
|
93
|
-
* - Filters live in session.filtersSpec?.options and session.selectedFilterValues
|
|
200
|
+
* Minimal selector contract (matches extractArray contract used by lister)
|
|
201
|
+
* - function: (body) => array
|
|
202
|
+
* - string: path selector
|
|
94
203
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
204
|
+
type DataSelector<T> = any;
|
|
205
|
+
type DataSearchConfig = {
|
|
206
|
+
default?: string;
|
|
207
|
+
};
|
|
208
|
+
type DataBuildRequestCtx<TFilters> = {
|
|
209
|
+
filters?: TFilters;
|
|
210
|
+
query: string;
|
|
211
|
+
cursor: any;
|
|
212
|
+
};
|
|
213
|
+
type DataBuildRequestResult = {
|
|
214
|
+
params?: any;
|
|
215
|
+
body?: any;
|
|
216
|
+
headers?: any;
|
|
217
|
+
};
|
|
218
|
+
type DataKey = string | number;
|
|
219
|
+
type DataSelectionMode = "none" | "single" | "multiple";
|
|
220
|
+
type DataSelectionKey<TItem> = keyof TItem | string | ((item: TItem) => DataKey | null | undefined);
|
|
221
|
+
type DataSelectionConfig<TItem> = {
|
|
222
|
+
mode?: Exclude<DataSelectionMode, "none">;
|
|
223
|
+
/**
|
|
224
|
+
* How to resolve the ID for an item.
|
|
225
|
+
* - string/ keyof: item[key]
|
|
226
|
+
* - function: (item) => id
|
|
227
|
+
* Defaults to: item.id ?? item.value
|
|
228
|
+
*/
|
|
229
|
+
key?: DataSelectionKey<TItem>;
|
|
230
|
+
/**
|
|
231
|
+
* If "missing", selection IDs that don't exist in the *latest fetched list* are removed.
|
|
232
|
+
* Default: "never" (recommended; avoids wiping selection on remote searches).
|
|
233
|
+
*/
|
|
234
|
+
prune?: "never" | "missing";
|
|
235
|
+
};
|
|
236
|
+
type UseDataOptions<TItem = any, TFilters = Record<string, any>> = {
|
|
237
|
+
id?: string;
|
|
238
|
+
endpoint: string;
|
|
239
|
+
method?: "GET" | "POST";
|
|
240
|
+
selector?: DataSelector<TItem>;
|
|
241
|
+
/**
|
|
242
|
+
* Passed through into the inline def source.buildRequest (same signature as provider)
|
|
243
|
+
*/
|
|
244
|
+
buildRequest?: (ctx: DataBuildRequestCtx<TFilters>) => DataBuildRequestResult;
|
|
245
|
+
/**
|
|
246
|
+
* Minimal search config (default subject column).
|
|
247
|
+
*/
|
|
248
|
+
search?: DataSearchConfig;
|
|
249
|
+
/**
|
|
250
|
+
* Raw filters object
|
|
251
|
+
*/
|
|
252
|
+
filters?: TFilters;
|
|
253
|
+
initial?: TItem[];
|
|
254
|
+
enabled?: boolean;
|
|
255
|
+
fetchOnMount?: boolean;
|
|
256
|
+
searchMode?: ListerSearchMode;
|
|
257
|
+
debounceMs?: number;
|
|
258
|
+
autoFetchOnFilterChange?: boolean;
|
|
259
|
+
/**
|
|
260
|
+
* Optional selection support (by stable item key)
|
|
261
|
+
*/
|
|
262
|
+
selection?: DataSelectionConfig<TItem>;
|
|
263
|
+
};
|
|
264
|
+
type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
265
|
+
id?: string;
|
|
266
|
+
data: TItem[];
|
|
267
|
+
visible: TItem[];
|
|
104
268
|
loading: boolean;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
269
|
+
error: any;
|
|
270
|
+
query: string;
|
|
271
|
+
setQuery: (q: string) => void;
|
|
272
|
+
searchMode: ListerSearchMode;
|
|
273
|
+
setSearchMode: (m: ListerSearchMode) => void;
|
|
274
|
+
searchTarget?: ListerSearchTarget;
|
|
275
|
+
setSearchTarget: (t: ListerSearchTarget) => void;
|
|
276
|
+
filters?: TFilters;
|
|
277
|
+
setFilters: (next: TFilters | undefined) => void;
|
|
278
|
+
patchFilters: (patch: Partial<TFilters>) => void;
|
|
279
|
+
clearFilters: () => void;
|
|
280
|
+
selectionMode: DataSelectionMode;
|
|
281
|
+
selectedIds: DataKey | DataKey[] | null;
|
|
282
|
+
selected: TItem | TItem[] | null;
|
|
283
|
+
select: (id: DataKey | DataKey[]) => void;
|
|
284
|
+
deselect: (id: DataKey | DataKey[]) => void;
|
|
285
|
+
toggle: (id: DataKey) => void;
|
|
286
|
+
clearSelection: () => void;
|
|
287
|
+
isSelected: (id: DataKey) => boolean;
|
|
288
|
+
getSelection: () => TItem | TItem[] | null;
|
|
289
|
+
refresh: () => void;
|
|
290
|
+
fetch: (override?: {
|
|
291
|
+
query?: string;
|
|
292
|
+
filters?: TFilters;
|
|
293
|
+
searchTarget?: ListerSearchTarget;
|
|
294
|
+
}) => Promise<TItem[]>;
|
|
295
|
+
};
|
|
296
|
+
declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters>): UseDataResult<TItem, TFilters>;
|
|
124
297
|
|
|
125
298
|
declare const ShadcnJsonEditorVariant: React.ForwardRefExoticComponent<ShadcnJsonEditorProps & React.RefAttributes<JsonEditorIndexHandle>>;
|
|
126
299
|
|
|
127
|
-
export { FooterBar, HeaderBar, ShadcnJsonEditorVariant as JsonEditor, ListerApi, ListerDefinition, ListerFilterCtx, ListerId, ListerMode, ListerProvider, ListerProviderHost, ListerRuntimeState, ListerSearchMode, ListerSearchPayload, ListerSearchTarget, ListerSessionId, ListerStoreState, ListerUI, OptionList, PresetMap, SearchBar, useLister };
|
|
300
|
+
export { type AnyDef, type AnyState, Ctx, type DataBuildRequestCtx, type DataBuildRequestResult, type DataKey, type DataSearchConfig, type DataSelectionConfig, type DataSelectionKey, type DataSelectionMode, type DataSelector, FooterBar, HeaderBar, type InternalContextValue, ShadcnJsonEditorVariant as JsonEditor, ListerApi, ListerDefinition, ListerFilterCtx, ListerFilterOption, ListerId, ListerMode, ListerProvider, ListerProviderHost, ListerRuntimeState, ListerSearchMode, ListerSearchPayload, ListerSearchTarget, ListerSessionId, ListerStoreState, ListerUI, OptionList, PresetMap, type ResolvedFilterNode, SearchBar, type UseDataOptions, type UseDataResult, buildSearchPayloadFromTarget, useData, useLister };
|