@timeax/form-palette 0.0.34 → 0.0.36
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 +3 -3
- package/dist/extra.d.ts +3 -3
- package/dist/extra.js +50 -28
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +50 -28
- 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 +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{variant-DK7UrSwZ.d.mts → variant-BYqslKTy.d.mts} +10 -1
- package/dist/{variant-Dk9A4ceE.d.ts → variant-DLlGPgPJ.d.ts} +10 -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 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-
|
|
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-
|
|
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-BYqslKTy.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-BYqslKTy.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './adapter-CvjXO9Gi.mjs';
|
|
7
7
|
import '@inertiajs/core';
|
|
@@ -201,7 +201,7 @@ declare function useLister<P extends PresetMap>(): {
|
|
|
201
201
|
* - function: (body) => array
|
|
202
202
|
* - string: path selector
|
|
203
203
|
*/
|
|
204
|
-
type DataSelector<T> = any;
|
|
204
|
+
type DataSelector<T> = ((body: any) => T[]) | string;
|
|
205
205
|
type DataSearchConfig = {
|
|
206
206
|
default?: string;
|
|
207
207
|
};
|
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 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-
|
|
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-
|
|
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-DLlGPgPJ.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-DLlGPgPJ.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './adapter-CvjXO9Gi.js';
|
|
7
7
|
import '@inertiajs/core';
|
|
@@ -201,7 +201,7 @@ declare function useLister<P extends PresetMap>(): {
|
|
|
201
201
|
* - function: (body) => array
|
|
202
202
|
* - string: path selector
|
|
203
203
|
*/
|
|
204
|
-
type DataSelector<T> = any;
|
|
204
|
+
type DataSelector<T> = ((body: any) => T[]) | string;
|
|
205
205
|
type DataSearchConfig = {
|
|
206
206
|
default?: string;
|
|
207
207
|
};
|
package/dist/extra.js
CHANGED
|
@@ -15443,6 +15443,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
15443
15443
|
required,
|
|
15444
15444
|
// radio UI
|
|
15445
15445
|
items,
|
|
15446
|
+
options,
|
|
15446
15447
|
mappers,
|
|
15447
15448
|
optionValue,
|
|
15448
15449
|
optionLabel,
|
|
@@ -15470,13 +15471,13 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
15470
15471
|
const hasError = !!error;
|
|
15471
15472
|
const normalized = React__namespace.useMemo(
|
|
15472
15473
|
() => normalizeItems(
|
|
15473
|
-
items,
|
|
15474
|
+
items != null ? items : options,
|
|
15474
15475
|
mappers,
|
|
15475
15476
|
//@ts-ignore
|
|
15476
15477
|
optionValue,
|
|
15477
15478
|
optionLabel
|
|
15478
15479
|
),
|
|
15479
|
-
[items, mappers, optionValue, optionLabel]
|
|
15480
|
+
[items, options, mappers, optionValue, optionLabel]
|
|
15480
15481
|
);
|
|
15481
15482
|
const selectedString = React__namespace.useMemo(() => {
|
|
15482
15483
|
if (value === void 0) return void 0;
|
|
@@ -15805,6 +15806,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
15805
15806
|
required,
|
|
15806
15807
|
// UI / behaviour
|
|
15807
15808
|
items,
|
|
15809
|
+
options,
|
|
15808
15810
|
mappers,
|
|
15809
15811
|
optionValue,
|
|
15810
15812
|
optionLabel,
|
|
@@ -15910,12 +15912,12 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
15910
15912
|
const groupValue = asGroupValue(value);
|
|
15911
15913
|
const normalized = React__namespace.useMemo(
|
|
15912
15914
|
() => normalizeItems2(
|
|
15913
|
-
items,
|
|
15915
|
+
items != null ? items : options,
|
|
15914
15916
|
mappers,
|
|
15915
15917
|
optionValue,
|
|
15916
15918
|
optionLabel
|
|
15917
15919
|
),
|
|
15918
|
-
[items, mappers, optionValue, optionLabel]
|
|
15920
|
+
[items, options, mappers, optionValue, optionLabel]
|
|
15919
15921
|
);
|
|
15920
15922
|
const {
|
|
15921
15923
|
groupStyle,
|
|
@@ -26448,6 +26450,27 @@ function defaultSearchTarget(search) {
|
|
|
26448
26450
|
function isKey(x2) {
|
|
26449
26451
|
return typeof x2 === "string" || typeof x2 === "number";
|
|
26450
26452
|
}
|
|
26453
|
+
function stringifyForSearch(v2) {
|
|
26454
|
+
if (v2 == null) return "";
|
|
26455
|
+
if (typeof v2 === "string") return v2;
|
|
26456
|
+
if (typeof v2 === "number" || typeof v2 === "boolean" || typeof v2 === "bigint") {
|
|
26457
|
+
return String(v2);
|
|
26458
|
+
}
|
|
26459
|
+
if (v2 instanceof Date) {
|
|
26460
|
+
return Number.isNaN(v2.getTime()) ? "" : v2.toISOString();
|
|
26461
|
+
}
|
|
26462
|
+
if (Array.isArray(v2)) {
|
|
26463
|
+
return v2.map(stringifyForSearch).join(" ");
|
|
26464
|
+
}
|
|
26465
|
+
if (typeof v2 === "object") {
|
|
26466
|
+
try {
|
|
26467
|
+
return JSON.stringify(v2);
|
|
26468
|
+
} catch {
|
|
26469
|
+
return String(v2);
|
|
26470
|
+
}
|
|
26471
|
+
}
|
|
26472
|
+
return String(v2);
|
|
26473
|
+
}
|
|
26451
26474
|
function useData(opts) {
|
|
26452
26475
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
26453
26476
|
const ctx = React__namespace.useContext(Ctx);
|
|
@@ -26460,6 +26483,10 @@ function useData(opts) {
|
|
|
26460
26483
|
});
|
|
26461
26484
|
const [loading, setLoading] = React__namespace.useState(false);
|
|
26462
26485
|
const [error, setError] = React__namespace.useState(void 0);
|
|
26486
|
+
const dataRef = React__namespace.useRef(data);
|
|
26487
|
+
React__namespace.useEffect(() => {
|
|
26488
|
+
dataRef.current = data;
|
|
26489
|
+
}, [data]);
|
|
26463
26490
|
const [query, _setQuery] = React__namespace.useState("");
|
|
26464
26491
|
const [searchMode, _setSearchMode] = React__namespace.useState(
|
|
26465
26492
|
(_c = opts.searchMode) != null ? _c : "remote"
|
|
@@ -26497,6 +26524,11 @@ function useData(opts) {
|
|
|
26497
26524
|
const timerRef = React__namespace.useRef(null);
|
|
26498
26525
|
const didMountRef = React__namespace.useRef(false);
|
|
26499
26526
|
const skipNextModeEffectRef = React__namespace.useRef(false);
|
|
26527
|
+
React__namespace.useEffect(() => {
|
|
26528
|
+
return () => {
|
|
26529
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
26530
|
+
};
|
|
26531
|
+
}, []);
|
|
26500
26532
|
const inlineDef = React__namespace.useMemo(() => {
|
|
26501
26533
|
var _a2;
|
|
26502
26534
|
return makeInlineDef({
|
|
@@ -26542,7 +26574,7 @@ function useData(opts) {
|
|
|
26542
26574
|
const fetchImpl = React__namespace.useCallback(
|
|
26543
26575
|
async (override) => {
|
|
26544
26576
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
26545
|
-
if (!enabled) return
|
|
26577
|
+
if (!enabled) return dataRef.current;
|
|
26546
26578
|
const q2 = (_a2 = override == null ? void 0 : override.query) != null ? _a2 : query;
|
|
26547
26579
|
const f2 = (_b2 = override == null ? void 0 : override.filters) != null ? _b2 : filters;
|
|
26548
26580
|
const t4 = (_c2 = override == null ? void 0 : override.searchTarget) != null ? _c2 : searchTarget;
|
|
@@ -26556,6 +26588,7 @@ function useData(opts) {
|
|
|
26556
26588
|
search: payload
|
|
26557
26589
|
});
|
|
26558
26590
|
const list = (_f2 = (_e2 = res == null ? void 0 : res.rawList) != null ? _e2 : res == null ? void 0 : res.raw) != null ? _f2 : [];
|
|
26591
|
+
if (reqIdRef.current !== myReq) return list;
|
|
26559
26592
|
commitSelectedCache(list);
|
|
26560
26593
|
if (selectionMode !== "none" && selectionPrune === "missing") {
|
|
26561
26594
|
const nextIds = /* @__PURE__ */ new Set();
|
|
@@ -26567,29 +26600,27 @@ function useData(opts) {
|
|
|
26567
26600
|
(prev) => prev.filter((x2) => nextIds.has(x2))
|
|
26568
26601
|
);
|
|
26569
26602
|
}
|
|
26570
|
-
if (reqIdRef.current !== myReq) return list;
|
|
26571
26603
|
setData(list);
|
|
26572
26604
|
setLoading(false);
|
|
26573
26605
|
return list;
|
|
26574
26606
|
} catch (e4) {
|
|
26575
|
-
if (reqIdRef.current !== myReq) return
|
|
26607
|
+
if (reqIdRef.current !== myReq) return dataRef.current;
|
|
26576
26608
|
setError(e4);
|
|
26577
26609
|
setLoading(false);
|
|
26578
|
-
return
|
|
26610
|
+
return dataRef.current;
|
|
26579
26611
|
}
|
|
26580
26612
|
},
|
|
26581
26613
|
[
|
|
26582
|
-
commitSelectedCache,
|
|
26583
|
-
ctx,
|
|
26584
|
-
data,
|
|
26585
26614
|
enabled,
|
|
26586
|
-
filters,
|
|
26587
|
-
getItemKey,
|
|
26588
|
-
inlineDef,
|
|
26589
26615
|
query,
|
|
26616
|
+
filters,
|
|
26590
26617
|
searchTarget,
|
|
26618
|
+
ctx,
|
|
26619
|
+
inlineDef,
|
|
26620
|
+
commitSelectedCache,
|
|
26591
26621
|
selectionMode,
|
|
26592
|
-
selectionPrune
|
|
26622
|
+
selectionPrune,
|
|
26623
|
+
getItemKey
|
|
26593
26624
|
]
|
|
26594
26625
|
);
|
|
26595
26626
|
const refresh = React__namespace.useCallback(() => {
|
|
@@ -26615,18 +26646,9 @@ function useData(opts) {
|
|
|
26615
26646
|
},
|
|
26616
26647
|
[fetchImpl]
|
|
26617
26648
|
);
|
|
26618
|
-
const setSearchTarget = React__namespace.useCallback(
|
|
26619
|
-
(t4)
|
|
26620
|
-
|
|
26621
|
-
if (searchMode === "remote" || searchMode === "hybrid") {
|
|
26622
|
-
if (timerRef.current) clearTimeout(timerRef.current);
|
|
26623
|
-
timerRef.current = setTimeout(() => {
|
|
26624
|
-
void fetchImpl({ searchTarget: t4 });
|
|
26625
|
-
}, debounceMs);
|
|
26626
|
-
}
|
|
26627
|
-
},
|
|
26628
|
-
[debounceMs, fetchImpl, searchMode]
|
|
26629
|
-
);
|
|
26649
|
+
const setSearchTarget = React__namespace.useCallback((t4) => {
|
|
26650
|
+
_setSearchTarget(t4);
|
|
26651
|
+
}, []);
|
|
26630
26652
|
const setFilters = React__namespace.useCallback(
|
|
26631
26653
|
(next) => _setFilters(next),
|
|
26632
26654
|
[]
|
|
@@ -26694,7 +26716,7 @@ function useData(opts) {
|
|
|
26694
26716
|
);
|
|
26695
26717
|
}
|
|
26696
26718
|
return list.filter(
|
|
26697
|
-
(item) =>
|
|
26719
|
+
(item) => stringifyForSearch(item).toLowerCase().includes(ql)
|
|
26698
26720
|
);
|
|
26699
26721
|
}, [data, getItemKey, query, searchMode, searchTarget]);
|
|
26700
26722
|
const selectedIds = React__namespace.useMemo(() => {
|