@proveanything/smartlinks-utils-ui 0.12.16 → 0.12.17
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.
|
@@ -2094,6 +2094,13 @@ interface UseRecordListArgs {
|
|
|
2094
2094
|
};
|
|
2095
2095
|
/** Page size requested from the SDK (default 100). */
|
|
2096
2096
|
pageSize?: number;
|
|
2097
|
+
/**
|
|
2098
|
+
* Optional extra search corpus per record. Folded into the haystack
|
|
2099
|
+
* alongside `label` + `subtitle`. Used by the shell on the Rules tab
|
|
2100
|
+
* to make facet keys + value labels (the chips users actually see)
|
|
2101
|
+
* searchable.
|
|
2102
|
+
*/
|
|
2103
|
+
searchCorpus?: (record: RecordSummary) => string | undefined | null;
|
|
2097
2104
|
/**
|
|
2098
2105
|
* Lifecycle values treated as "active". Defaults to `['active']`. Records
|
|
2099
2106
|
* with a missing/empty `status` are always treated as active (legacy
|
|
@@ -912,6 +912,7 @@ var useRecordList = (args) => {
|
|
|
912
912
|
scaffolder,
|
|
913
913
|
contextScope,
|
|
914
914
|
pageSize = 100,
|
|
915
|
+
searchCorpus,
|
|
915
916
|
activeStatuses = DEFAULT_ACTIVE_STATUSES
|
|
916
917
|
} = args;
|
|
917
918
|
const queryClient = useQueryClient();
|
|
@@ -965,10 +966,13 @@ var useRecordList = (args) => {
|
|
|
965
966
|
if (filter !== "all") out = out.filter((r) => r.status === filter);
|
|
966
967
|
if (search.trim()) {
|
|
967
968
|
const q = search.trim().toLowerCase();
|
|
968
|
-
out = out.filter((r) =>
|
|
969
|
+
out = out.filter((r) => {
|
|
970
|
+
const extra = searchCorpus?.(r) ?? "";
|
|
971
|
+
return `${r.label} ${r.subtitle ?? ""} ${extra}`.toLowerCase().includes(q);
|
|
972
|
+
});
|
|
969
973
|
}
|
|
970
974
|
return out;
|
|
971
|
-
}, [items, filter, search]);
|
|
975
|
+
}, [items, filter, search, searchCorpus]);
|
|
972
976
|
const counts = useMemo(() => ({
|
|
973
977
|
all: items.length,
|
|
974
978
|
configured: items.filter((r) => r.status === "configured").length,
|
|
@@ -1298,7 +1302,8 @@ function useShellBrowser(opts) {
|
|
|
1298
1302
|
drillTab,
|
|
1299
1303
|
classify: classify3,
|
|
1300
1304
|
pageSize,
|
|
1301
|
-
activeStatuses
|
|
1305
|
+
activeStatuses,
|
|
1306
|
+
searchCorpus
|
|
1302
1307
|
} = opts;
|
|
1303
1308
|
const [search, setSearch] = useState("");
|
|
1304
1309
|
const [filter, setFilter] = useState("all");
|
|
@@ -1326,7 +1331,8 @@ function useShellBrowser(opts) {
|
|
|
1326
1331
|
contextScope,
|
|
1327
1332
|
enabled: recordListEnabled,
|
|
1328
1333
|
pageSize,
|
|
1329
|
-
activeStatuses
|
|
1334
|
+
activeStatuses,
|
|
1335
|
+
searchCorpus
|
|
1330
1336
|
});
|
|
1331
1337
|
const facetBrowse = useFacetBrowse({
|
|
1332
1338
|
SL,
|
|
@@ -9465,6 +9471,27 @@ function RecordsAdminShellInner(props) {
|
|
|
9465
9471
|
if (requested === "header" && !headerWillRender) return "footer";
|
|
9466
9472
|
return requested;
|
|
9467
9473
|
}, [intro?.reopenAffordance, headerWillRender]);
|
|
9474
|
+
const ruleLabelLookupRef = useRef(null);
|
|
9475
|
+
const ruleSearchCorpus = useCallback((r) => {
|
|
9476
|
+
const rule = r.facetRule;
|
|
9477
|
+
if (!rule?.all?.length) return "";
|
|
9478
|
+
const lookup = ruleLabelLookupRef.current;
|
|
9479
|
+
const parts = [];
|
|
9480
|
+
for (const clause of rule.all) {
|
|
9481
|
+
if (clause.facetKey) {
|
|
9482
|
+
parts.push(clause.facetKey);
|
|
9483
|
+
const fl = lookup?.facetLabel?.(clause.facetKey);
|
|
9484
|
+
if (fl) parts.push(fl);
|
|
9485
|
+
}
|
|
9486
|
+
for (const v of clause.anyOf ?? []) {
|
|
9487
|
+
if (!v) continue;
|
|
9488
|
+
parts.push(v);
|
|
9489
|
+
const vl = lookup?.valueLabel?.(clause.facetKey, v);
|
|
9490
|
+
if (vl) parts.push(vl);
|
|
9491
|
+
}
|
|
9492
|
+
}
|
|
9493
|
+
return parts.join(" ");
|
|
9494
|
+
}, []);
|
|
9468
9495
|
const browser = useShellBrowser({
|
|
9469
9496
|
ctx,
|
|
9470
9497
|
SL,
|
|
@@ -9476,7 +9503,8 @@ function RecordsAdminShellInner(props) {
|
|
|
9476
9503
|
drillTab,
|
|
9477
9504
|
classify: classify3,
|
|
9478
9505
|
pageSize: railPageSize,
|
|
9479
|
-
activeStatuses
|
|
9506
|
+
activeStatuses,
|
|
9507
|
+
searchCorpus: ruleSearchCorpus
|
|
9480
9508
|
});
|
|
9481
9509
|
const {
|
|
9482
9510
|
search,
|
|
@@ -10382,9 +10410,20 @@ function RecordsAdminShellInner(props) {
|
|
|
10382
10410
|
);
|
|
10383
10411
|
}
|
|
10384
10412
|
return withNav(
|
|
10385
|
-
/* @__PURE__ */ jsxs("div", { className: "relative h-full", children: [
|
|
10386
|
-
baseEditor(
|
|
10387
|
-
|
|
10413
|
+
/* @__PURE__ */ jsxs("div", { className: "relative h-full", ref: previewAnchorRef, children: [
|
|
10414
|
+
baseEditor(),
|
|
10415
|
+
!drawerOpen && /* @__PURE__ */ jsxs(
|
|
10416
|
+
PreviewReopenPill,
|
|
10417
|
+
{
|
|
10418
|
+
anchorRef: previewAnchorRef,
|
|
10419
|
+
onClick: () => setDrawerOpen(true),
|
|
10420
|
+
ariaLabel: i18n.openPreview,
|
|
10421
|
+
title: i18n.openPreview,
|
|
10422
|
+
children: [
|
|
10423
|
+
/* @__PURE__ */ jsx(Eye, { "aria-hidden": "true" }),
|
|
10424
|
+
i18n.preview
|
|
10425
|
+
]
|
|
10426
|
+
}
|
|
10388
10427
|
),
|
|
10389
10428
|
/* @__PURE__ */ jsx(
|
|
10390
10429
|
DrawerPreview,
|
|
@@ -10478,6 +10517,7 @@ function RecordsAdminShellInner(props) {
|
|
|
10478
10517
|
valueLabel: (k, v) => map.get(k)?.values.get(v)
|
|
10479
10518
|
};
|
|
10480
10519
|
}, [facetBrowse.items]);
|
|
10520
|
+
ruleLabelLookupRef.current = ruleLabelLookup;
|
|
10481
10521
|
const effectiveGroupBy = useMemo(() => {
|
|
10482
10522
|
if (groupBy) return groupBy;
|
|
10483
10523
|
if (isAllTab) return void 0;
|
|
@@ -11201,7 +11241,7 @@ function RecordsAdminShellInner(props) {
|
|
|
11201
11241
|
),
|
|
11202
11242
|
!(isGlobalTab && !isCollection) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
11203
11243
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
11204
|
-
/* @__PURE__ */ jsxs("div", { className: "relative flex-1 min-w-0", children: [
|
|
11244
|
+
!isGlobalTab && /* @__PURE__ */ jsxs("div", { className: "relative flex-1 min-w-0", children: [
|
|
11205
11245
|
/* @__PURE__ */ jsx(Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 opacity-50" }),
|
|
11206
11246
|
/* @__PURE__ */ jsx(
|
|
11207
11247
|
"input",
|