@ai-matrx/records-ui 0.116.102 → 0.116.103
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/CHANGELOG.md +3 -1
- package/dist/index.cjs +37 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +35 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -6751,6 +6751,27 @@ function WholeTextDialog({
|
|
|
6751
6751
|
] }) });
|
|
6752
6752
|
}
|
|
6753
6753
|
|
|
6754
|
+
// src/systemFields.ts
|
|
6755
|
+
function isSystemField(field) {
|
|
6756
|
+
return field.config?.hidden === true;
|
|
6757
|
+
}
|
|
6758
|
+
function systemFieldKeys(fields) {
|
|
6759
|
+
return (fields ?? []).filter(isSystemField).map((f) => f.key);
|
|
6760
|
+
}
|
|
6761
|
+
function hiddenOrSystemDefault(saved, fields) {
|
|
6762
|
+
if (saved) return [...saved];
|
|
6763
|
+
const system = systemFieldKeys(fields);
|
|
6764
|
+
return system.length > 0 ? system : void 0;
|
|
6765
|
+
}
|
|
6766
|
+
function hiddenFieldsEntry(hidden, fields) {
|
|
6767
|
+
const kept = hiddenToWrite(hidden, fields);
|
|
6768
|
+
return kept ? { hiddenFields: kept } : {};
|
|
6769
|
+
}
|
|
6770
|
+
function hiddenToWrite(hidden, fields) {
|
|
6771
|
+
if (hidden.length > 0) return [...hidden];
|
|
6772
|
+
return systemFieldKeys(fields).length > 0 ? [] : void 0;
|
|
6773
|
+
}
|
|
6774
|
+
|
|
6754
6775
|
// src/gridControls.tsx
|
|
6755
6776
|
import { Fragment as Fragment4, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6756
6777
|
var VALUE_COUNTS_FRESH_MS = 1e4;
|
|
@@ -6842,8 +6863,8 @@ function useMergedGridControls(args) {
|
|
|
6842
6863
|
}, [held, fieldKeys, keptOrder, frozenKeys]);
|
|
6843
6864
|
const hidden = useMemo14(() => {
|
|
6844
6865
|
const known = new Set(fieldKeys);
|
|
6845
|
-
return (held?.hidden ?? keptHidden ?? []).filter((k) => known.has(k) || k.startsWith(REVERSE_COLUMN_PREFIX));
|
|
6846
|
-
}, [held, keptHidden, fieldKeys]);
|
|
6866
|
+
return (held?.hidden ?? hiddenOrSystemDefault(keptHidden, fields) ?? []).filter((k) => known.has(k) || k.startsWith(REVERSE_COLUMN_PREFIX));
|
|
6867
|
+
}, [held, keptHidden, fieldKeys, fields]);
|
|
6847
6868
|
const naturalOrder = useMemo14(
|
|
6848
6869
|
() => [...fieldKeys.filter((k) => frozenKeys.has(k)), ...fieldKeys.filter((k) => !frozenKeys.has(k))],
|
|
6849
6870
|
[fieldKeys, frozenKeys]
|
|
@@ -6856,10 +6877,10 @@ function useMergedGridControls(args) {
|
|
|
6856
6877
|
writeLook({
|
|
6857
6878
|
...rest,
|
|
6858
6879
|
...moved ? { columnOrder: next.order } : {},
|
|
6859
|
-
...next.hidden
|
|
6880
|
+
...hiddenFieldsEntry(next.hidden, fields)
|
|
6860
6881
|
});
|
|
6861
6882
|
},
|
|
6862
|
-
[presentation, writeLook, naturalOrder]
|
|
6883
|
+
[presentation, writeLook, naturalOrder, fields]
|
|
6863
6884
|
);
|
|
6864
6885
|
const pendingInsert = useRef9(null);
|
|
6865
6886
|
useEffect19(() => {
|
|
@@ -12947,7 +12968,7 @@ function GridBody({
|
|
|
12947
12968
|
}),
|
|
12948
12969
|
[host, tableId, table.data, fields.data]
|
|
12949
12970
|
);
|
|
12950
|
-
const hiddenKeys = presentation.hiddenFields;
|
|
12971
|
+
const hiddenKeys = hiddenOrSystemDefault(presentation.hiddenFields, fields.data);
|
|
12951
12972
|
const shownKeys = useMemo27(
|
|
12952
12973
|
() => hiddenKeys && hiddenKeys.length > 0 ? columnIds.filter((k) => !hiddenKeys.includes(k)) : columnIds,
|
|
12953
12974
|
[columnIds, hiddenKeys]
|
|
@@ -13429,7 +13450,7 @@ function GridBody({
|
|
|
13429
13450
|
// THE CLASSIC GRID OBEYS THE VIEW TOO (CHAIR-GRID-LINKS 07): with no merged controls the kept
|
|
13430
13451
|
// `presentation.hiddenFields` / `columnOrder` still decide what is drawn.
|
|
13431
13452
|
order: controls.columns?.order ?? localColumns?.order ?? (presentation.columnOrder?.length ? columnsInKeptOrder(columnIds, presentation.columnOrder) : columnIds),
|
|
13432
|
-
hidden: controls.columns?.hidden ?? localColumns?.hidden ?? presentation.hiddenFields ?? [],
|
|
13453
|
+
hidden: controls.columns?.hidden ?? localColumns?.hidden ?? hiddenOrSystemDefault(presentation.hiddenFields, fields.data) ?? [],
|
|
13433
13454
|
onChange: (drawn) => {
|
|
13434
13455
|
const next = { order: fieldColumnIds(drawn.order, fields.data ?? []), hidden: fieldColumnIds(drawn.hidden, fields.data ?? []) };
|
|
13435
13456
|
if (controls.columns) controls.columns.onChange(next);
|
|
@@ -20836,7 +20857,7 @@ function isEmptyOnCard(value) {
|
|
|
20836
20857
|
return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
|
|
20837
20858
|
}
|
|
20838
20859
|
function cardFieldsShown(fields, hiddenFields, exclude) {
|
|
20839
|
-
const hidden = new Set(hiddenFields ?? []);
|
|
20860
|
+
const hidden = new Set(hiddenOrSystemDefault(hiddenFields, fields) ?? []);
|
|
20840
20861
|
const out = new Set(exclude.filter((k) => Boolean(k)));
|
|
20841
20862
|
return fields.filter((field) => !hidden.has(field.key) && !out.has(field.key));
|
|
20842
20863
|
}
|
|
@@ -20848,7 +20869,7 @@ function CardFieldsPicker({
|
|
|
20848
20869
|
remembered,
|
|
20849
20870
|
layout
|
|
20850
20871
|
}) {
|
|
20851
|
-
const hidden = new Set(hiddenFields ?? []);
|
|
20872
|
+
const hidden = new Set(hiddenOrSystemDefault(hiddenFields, fields) ?? []);
|
|
20852
20873
|
return /* @__PURE__ */ jsxs73("details", { className: "text-xs text-muted-foreground", "data-records-card-fields": layout, children: [
|
|
20853
20874
|
/* @__PURE__ */ jsx81("summary", { className: "cursor-pointer select-none", children: summary }),
|
|
20854
20875
|
/* @__PURE__ */ jsx81("div", { className: "mt-1 flex flex-wrap gap-2", children: fields.map((field) => /* @__PURE__ */ jsxs73("label", { className: "flex items-center gap-1", children: [
|
|
@@ -25603,7 +25624,8 @@ function selfLinkFields(fields, tableId) {
|
|
|
25603
25624
|
function orgCardFields(fields, hidden, exclude) {
|
|
25604
25625
|
const skip = new Set(exclude.filter((k) => Boolean(k)));
|
|
25605
25626
|
const usable = fields.filter((f) => !skip.has(f.key) && !["attachment", "button", "formula"].includes(String(f.type)));
|
|
25606
|
-
const
|
|
25627
|
+
const kept = hiddenOrSystemDefault(hidden, fields);
|
|
25628
|
+
const shown4 = kept === void 0 ? usable : usable.filter((f) => !kept.includes(f.key));
|
|
25607
25629
|
return shown4.slice(0, 2);
|
|
25608
25630
|
}
|
|
25609
25631
|
function orgNotes(forest, total) {
|
|
@@ -27369,7 +27391,7 @@ function Gallery({
|
|
|
27369
27391
|
onNew,
|
|
27370
27392
|
newLabel
|
|
27371
27393
|
}) {
|
|
27372
|
-
const hidden = useMemo53(() => new Set(hiddenFields ?? []), [hiddenFields]);
|
|
27394
|
+
const hidden = useMemo53(() => new Set(hiddenOrSystemDefault(hiddenFields, fields) ?? []), [hiddenFields, fields]);
|
|
27373
27395
|
const imageField = imageKey ? fields.find((field) => field.key === imageKey) : void 0;
|
|
27374
27396
|
const shown4 = fields.filter((field) => !hidden.has(field.key) && field.key !== imageKey && field.key !== titleKey);
|
|
27375
27397
|
const chose = hiddenFields !== void 0;
|
|
@@ -41553,6 +41575,7 @@ function TablePage({
|
|
|
41553
41575
|
});
|
|
41554
41576
|
}, [view, looks]);
|
|
41555
41577
|
const hiddenNow = shown4?.presentation?.hiddenFields ?? [];
|
|
41578
|
+
const hiddenInList = hiddenOrSystemDefault(shown4?.presentation?.hiddenFields, allFields.data) ?? [];
|
|
41556
41579
|
const hiddenSaved = view?.presentation?.hiddenFields ?? [];
|
|
41557
41580
|
const hiddenDiffers = JSON.stringify(hiddenNow) !== JSON.stringify(hiddenSaved);
|
|
41558
41581
|
const addressNow = {
|
|
@@ -42412,12 +42435,12 @@ function TablePage({
|
|
|
42412
42435
|
tableId,
|
|
42413
42436
|
archiveAsked,
|
|
42414
42437
|
columns: view ? {
|
|
42415
|
-
hidden:
|
|
42438
|
+
hidden: hiddenInList,
|
|
42416
42439
|
order: shown4?.presentation?.columnOrder ?? null,
|
|
42417
42440
|
onChange: ({ hidden, order }) => {
|
|
42418
42441
|
const { hiddenFields: _h, columnOrder: _o, ...rest } = shown4?.presentation ?? {};
|
|
42419
42442
|
return patchView({
|
|
42420
|
-
presentation: { ...rest, ...hidden.
|
|
42443
|
+
presentation: { ...rest, ...hiddenFieldsEntry(hidden, allFields.data), ...order ? { columnOrder: order } : {} }
|
|
42421
42444
|
});
|
|
42422
42445
|
}
|
|
42423
42446
|
} : void 0
|