@timeax/form-palette 0.1.6 → 0.1.7
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/extra.d.mts +2 -1
- package/dist/extra.d.ts +2 -1
- package/dist/extra.js +11 -7
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +11 -7
- package/dist/extra.mjs.map +1 -1
- package/package.json +1 -1
package/dist/extra.d.mts
CHANGED
|
@@ -257,6 +257,7 @@ type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
|
257
257
|
isSelected: (id: DataKey) => boolean;
|
|
258
258
|
getSelection: () => TItem | TItem[] | null;
|
|
259
259
|
refresh: () => void;
|
|
260
|
+
override(data: TItem[]): void;
|
|
260
261
|
fetch: (override?: {
|
|
261
262
|
query?: string;
|
|
262
263
|
filters?: TFilters;
|
|
@@ -264,7 +265,7 @@ type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
|
264
265
|
search?: ListerSearchPayload;
|
|
265
266
|
}) => Promise<TItem[]>;
|
|
266
267
|
};
|
|
267
|
-
declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters
|
|
268
|
+
declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters>, deps: any[]): UseDataResult<TItem, TFilters>;
|
|
268
269
|
|
|
269
270
|
declare const ShadcnJsonEditorVariant: React.ForwardRefExoticComponent<ShadcnJsonEditorProps & React.RefAttributes<JsonEditorIndexHandle>>;
|
|
270
271
|
|
package/dist/extra.d.ts
CHANGED
|
@@ -257,6 +257,7 @@ type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
|
257
257
|
isSelected: (id: DataKey) => boolean;
|
|
258
258
|
getSelection: () => TItem | TItem[] | null;
|
|
259
259
|
refresh: () => void;
|
|
260
|
+
override(data: TItem[]): void;
|
|
260
261
|
fetch: (override?: {
|
|
261
262
|
query?: string;
|
|
262
263
|
filters?: TFilters;
|
|
@@ -264,7 +265,7 @@ type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
|
264
265
|
search?: ListerSearchPayload;
|
|
265
266
|
}) => Promise<TItem[]>;
|
|
266
267
|
};
|
|
267
|
-
declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters
|
|
268
|
+
declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters>, deps: any[]): UseDataResult<TItem, TFilters>;
|
|
268
269
|
|
|
269
270
|
declare const ShadcnJsonEditorVariant: React.ForwardRefExoticComponent<ShadcnJsonEditorProps & React.RefAttributes<JsonEditorIndexHandle>>;
|
|
270
271
|
|
package/dist/extra.js
CHANGED
|
@@ -26355,7 +26355,7 @@ function stringifyForSearch(v2) {
|
|
|
26355
26355
|
}
|
|
26356
26356
|
return String(v2);
|
|
26357
26357
|
}
|
|
26358
|
-
function useData(opts) {
|
|
26358
|
+
function useData(opts, deps) {
|
|
26359
26359
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
26360
26360
|
const enabled = (_a = opts.enabled) != null ? _a : true;
|
|
26361
26361
|
const debounceMs = (_b = opts.debounceMs) != null ? _b : 300;
|
|
@@ -26445,19 +26445,19 @@ function useData(opts) {
|
|
|
26445
26445
|
[getItemKey, selectionMode]
|
|
26446
26446
|
);
|
|
26447
26447
|
const fetchImpl = React72__namespace.useCallback(
|
|
26448
|
-
async (
|
|
26448
|
+
async (override2) => {
|
|
26449
26449
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
26450
26450
|
if (!enabled) return dataRef.current;
|
|
26451
|
-
const q2 = (_a2 =
|
|
26452
|
-
const f2 = (_b2 =
|
|
26453
|
-
const t4 = (_c2 =
|
|
26451
|
+
const q2 = (_a2 = override2 == null ? void 0 : override2.query) != null ? _a2 : query;
|
|
26452
|
+
const f2 = (_b2 = override2 == null ? void 0 : override2.filters) != null ? _b2 : filters;
|
|
26453
|
+
const t4 = (_c2 = override2 == null ? void 0 : override2.searchTarget) != null ? _c2 : searchTarget;
|
|
26454
26454
|
const requestId = createRequestId();
|
|
26455
26455
|
const inflightKey = inflightKeyRef.current;
|
|
26456
26456
|
const { signal } = inflight.begin(inflightKey, requestId);
|
|
26457
26457
|
setLoading(true);
|
|
26458
26458
|
setError(void 0);
|
|
26459
26459
|
try {
|
|
26460
|
-
const payload = (_d2 =
|
|
26460
|
+
const payload = (_d2 = override2 == null ? void 0 : override2.search) != null ? _d2 : buildSearchPayloadFromTarget(t4);
|
|
26461
26461
|
const built = (_f2 = (_e2 = opts.buildRequest) == null ? void 0 : _e2.call(opts, {
|
|
26462
26462
|
filters: f2,
|
|
26463
26463
|
query: q2,
|
|
@@ -26529,6 +26529,9 @@ function useData(opts) {
|
|
|
26529
26529
|
const refresh = React72__namespace.useCallback(() => {
|
|
26530
26530
|
void fetchImpl();
|
|
26531
26531
|
}, [fetchImpl]);
|
|
26532
|
+
const override = React72__namespace.useCallback((newData) => {
|
|
26533
|
+
setData(newData);
|
|
26534
|
+
}, []);
|
|
26532
26535
|
const setQuery = React72__namespace.useCallback((q2) => _setQuery(q2), []);
|
|
26533
26536
|
const setSearchMode = React72__namespace.useCallback(
|
|
26534
26537
|
(m2) => {
|
|
@@ -26568,7 +26571,7 @@ function useData(opts) {
|
|
|
26568
26571
|
if (!enabled) return;
|
|
26569
26572
|
if (!fetchOnMount) return;
|
|
26570
26573
|
void fetchImpl();
|
|
26571
|
-
},
|
|
26574
|
+
}, deps);
|
|
26572
26575
|
React72__namespace.useEffect(() => {
|
|
26573
26576
|
if (!enabled) return;
|
|
26574
26577
|
if (!didMountRef.current) {
|
|
@@ -26742,6 +26745,7 @@ function useData(opts) {
|
|
|
26742
26745
|
isSelected,
|
|
26743
26746
|
getSelection,
|
|
26744
26747
|
refresh,
|
|
26748
|
+
override,
|
|
26745
26749
|
fetch: fetchImpl
|
|
26746
26750
|
};
|
|
26747
26751
|
}
|