@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.mjs
CHANGED
|
@@ -26317,7 +26317,7 @@ function stringifyForSearch(v2) {
|
|
|
26317
26317
|
}
|
|
26318
26318
|
return String(v2);
|
|
26319
26319
|
}
|
|
26320
|
-
function useData(opts) {
|
|
26320
|
+
function useData(opts, deps) {
|
|
26321
26321
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
26322
26322
|
const enabled = (_a = opts.enabled) != null ? _a : true;
|
|
26323
26323
|
const debounceMs = (_b = opts.debounceMs) != null ? _b : 300;
|
|
@@ -26407,19 +26407,19 @@ function useData(opts) {
|
|
|
26407
26407
|
[getItemKey, selectionMode]
|
|
26408
26408
|
);
|
|
26409
26409
|
const fetchImpl = React72.useCallback(
|
|
26410
|
-
async (
|
|
26410
|
+
async (override2) => {
|
|
26411
26411
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
26412
26412
|
if (!enabled) return dataRef.current;
|
|
26413
|
-
const q2 = (_a2 =
|
|
26414
|
-
const f2 = (_b2 =
|
|
26415
|
-
const t4 = (_c2 =
|
|
26413
|
+
const q2 = (_a2 = override2 == null ? void 0 : override2.query) != null ? _a2 : query;
|
|
26414
|
+
const f2 = (_b2 = override2 == null ? void 0 : override2.filters) != null ? _b2 : filters;
|
|
26415
|
+
const t4 = (_c2 = override2 == null ? void 0 : override2.searchTarget) != null ? _c2 : searchTarget;
|
|
26416
26416
|
const requestId = createRequestId();
|
|
26417
26417
|
const inflightKey = inflightKeyRef.current;
|
|
26418
26418
|
const { signal } = inflight.begin(inflightKey, requestId);
|
|
26419
26419
|
setLoading(true);
|
|
26420
26420
|
setError(void 0);
|
|
26421
26421
|
try {
|
|
26422
|
-
const payload = (_d2 =
|
|
26422
|
+
const payload = (_d2 = override2 == null ? void 0 : override2.search) != null ? _d2 : buildSearchPayloadFromTarget(t4);
|
|
26423
26423
|
const built = (_f2 = (_e2 = opts.buildRequest) == null ? void 0 : _e2.call(opts, {
|
|
26424
26424
|
filters: f2,
|
|
26425
26425
|
query: q2,
|
|
@@ -26491,6 +26491,9 @@ function useData(opts) {
|
|
|
26491
26491
|
const refresh = React72.useCallback(() => {
|
|
26492
26492
|
void fetchImpl();
|
|
26493
26493
|
}, [fetchImpl]);
|
|
26494
|
+
const override = React72.useCallback((newData) => {
|
|
26495
|
+
setData(newData);
|
|
26496
|
+
}, []);
|
|
26494
26497
|
const setQuery = React72.useCallback((q2) => _setQuery(q2), []);
|
|
26495
26498
|
const setSearchMode = React72.useCallback(
|
|
26496
26499
|
(m2) => {
|
|
@@ -26530,7 +26533,7 @@ function useData(opts) {
|
|
|
26530
26533
|
if (!enabled) return;
|
|
26531
26534
|
if (!fetchOnMount) return;
|
|
26532
26535
|
void fetchImpl();
|
|
26533
|
-
},
|
|
26536
|
+
}, deps);
|
|
26534
26537
|
React72.useEffect(() => {
|
|
26535
26538
|
if (!enabled) return;
|
|
26536
26539
|
if (!didMountRef.current) {
|
|
@@ -26704,6 +26707,7 @@ function useData(opts) {
|
|
|
26704
26707
|
isSelected,
|
|
26705
26708
|
getSelection,
|
|
26706
26709
|
refresh,
|
|
26710
|
+
override,
|
|
26707
26711
|
fetch: fetchImpl
|
|
26708
26712
|
};
|
|
26709
26713
|
}
|