@ai-matrx/records-ui 0.101.31 → 0.101.34
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 +18 -0
- package/dist/index.cjs +147 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -2
- package/dist/index.d.ts +41 -2
- package/dist/index.js +226 -106
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +24 -4
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +24 -4
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records-ui
|
|
2
2
|
|
|
3
|
+
## 0.101.34
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/records-ui/v0.101.33..npm/records-ui/v0.101.34 -- apps/shared/records-ui`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
9
|
+
## 0.101.33
|
|
10
|
+
|
|
11
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
12
|
+
`git diff npm/records-ui/v0.101.31..npm/records-ui/v0.101.33 -- apps/shared/records-ui`).
|
|
13
|
+
No source changes intended and no consumer action required.
|
|
14
|
+
|
|
15
|
+
## 0.101.32
|
|
16
|
+
|
|
17
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
18
|
+
`git diff npm/records-ui/v0.101.31..npm/records-ui/v0.101.32 -- apps/shared/records-ui`).
|
|
19
|
+
No source changes intended and no consumer action required.
|
|
20
|
+
|
|
3
21
|
## 0.101.31
|
|
4
22
|
|
|
5
23
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/index.cjs
CHANGED
|
@@ -2368,10 +2368,10 @@ function shown(value) {
|
|
|
2368
2368
|
if (typeof value === "number" || typeof value === "boolean") return String(value);
|
|
2369
2369
|
return null;
|
|
2370
2370
|
}
|
|
2371
|
-
function tellApart(rows,
|
|
2371
|
+
function tellApart(rows, nameOf2) {
|
|
2372
2372
|
const byName = /* @__PURE__ */ new Map();
|
|
2373
2373
|
for (const row of rows) {
|
|
2374
|
-
const name =
|
|
2374
|
+
const name = nameOf2(row.id).trim().toLowerCase();
|
|
2375
2375
|
byName.set(name, [...byName.get(name) ?? [], row]);
|
|
2376
2376
|
}
|
|
2377
2377
|
const out = /* @__PURE__ */ new Map();
|
|
@@ -2979,6 +2979,7 @@ function RecordLabelProvider({ children }) {
|
|
|
2979
2979
|
const client = (0, import_react14.useRecordsClient)();
|
|
2980
2980
|
const [names, setNames] = (0, import_react13.useState)({});
|
|
2981
2981
|
const [archivedRefs, setArchivedRefs] = (0, import_react13.useState)({});
|
|
2982
|
+
const [iconsOf, setIconsOf] = (0, import_react13.useState)({});
|
|
2982
2983
|
const [settled, setSettled] = (0, import_react13.useState)({});
|
|
2983
2984
|
const [waitingLines, setWaitingLines] = (0, import_react13.useState)({});
|
|
2984
2985
|
const asked3 = (0, import_react13.useRef)(/* @__PURE__ */ new Set());
|
|
@@ -3061,6 +3062,7 @@ function RecordLabelProvider({ children }) {
|
|
|
3061
3062
|
void (async () => {
|
|
3062
3063
|
const learned = {};
|
|
3063
3064
|
const archivedNow = {};
|
|
3065
|
+
const iconsNow = {};
|
|
3064
3066
|
await Promise.all(
|
|
3065
3067
|
batch.map(async ({ field: field2, ids }) => {
|
|
3066
3068
|
const wanted = [...ids];
|
|
@@ -3073,10 +3075,12 @@ function RecordLabelProvider({ children }) {
|
|
|
3073
3075
|
learned[id] = !result.ok ? UNREAD_RECORD_LABEL : typeof words2 === "string" && words2 !== "" ? words2 : WITHHELD_RECORD_LABEL;
|
|
3074
3076
|
}
|
|
3075
3077
|
if (result.ok) for (const id of result.archived ?? []) archivedNow[`${field2.id}:${id}`] = true;
|
|
3078
|
+
if (result.ok) for (const [id, pair] of Object.entries(result.icons ?? {})) iconsNow[id] = pair;
|
|
3076
3079
|
})
|
|
3077
3080
|
);
|
|
3078
3081
|
setNames((current) => ({ ...current, ...learned }));
|
|
3079
3082
|
if (Object.keys(archivedNow).length > 0) setArchivedRefs((current) => ({ ...current, ...archivedNow }));
|
|
3083
|
+
if (Object.keys(iconsNow).length > 0) setIconsOf((current) => ({ ...current, ...iconsNow }));
|
|
3080
3084
|
for (const { field: field2 } of batch) stopWaitClock(field2.id);
|
|
3081
3085
|
})();
|
|
3082
3086
|
}, [client, stopWaitClock]);
|
|
@@ -3124,9 +3128,10 @@ function RecordLabelProvider({ children }) {
|
|
|
3124
3128
|
() => {
|
|
3125
3129
|
const answer = ((field2, id) => lookupWords(field2, id));
|
|
3126
3130
|
answer.archived = (field2, id) => archivedRefs[`${field2.id}:${id}`] === true;
|
|
3131
|
+
answer.icons = (_field, id) => iconsOf[id];
|
|
3127
3132
|
return answer;
|
|
3128
3133
|
},
|
|
3129
|
-
[lookupWords, archivedRefs]
|
|
3134
|
+
[lookupWords, archivedRefs, iconsOf]
|
|
3130
3135
|
);
|
|
3131
3136
|
const waiting = (0, import_react13.useCallback)((field2) => waitingLines[field2.id] ?? null, [waitingLines]);
|
|
3132
3137
|
const value = (0, import_react13.useMemo)(() => ({ lookup, want, waiting }), [lookup, want, waiting]);
|
|
@@ -5694,6 +5699,7 @@ var EMBEDDED_TABLE_CLASS = [
|
|
|
5694
5699
|
"[&_thead_th:last-child]:border-r-0"
|
|
5695
5700
|
].join(" ");
|
|
5696
5701
|
var EMBEDDED_PLAIN_FOOTER_CLASS = "[&_tfoot]:bg-transparent [&_tfoot]:border-t-0";
|
|
5702
|
+
var EMBEDDED_PAGE_SIZE = 50;
|
|
5697
5703
|
|
|
5698
5704
|
// src/enumLabels.ts
|
|
5699
5705
|
function exhaustiveValuesOf() {
|
|
@@ -5986,6 +5992,20 @@ function kindLabel(kind) {
|
|
|
5986
5992
|
|
|
5987
5993
|
// src/ReferenceChips.tsx
|
|
5988
5994
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
5995
|
+
function glyphOf(icon) {
|
|
5996
|
+
const text = (icon ?? "").trim();
|
|
5997
|
+
return text !== "" && text.length <= 8 && /[^\u0000-\u007f]/.test(text) ? text : null;
|
|
5998
|
+
}
|
|
5999
|
+
function nameOf(icon) {
|
|
6000
|
+
const text = (icon ?? "").trim();
|
|
6001
|
+
return /^[A-Za-z][A-Za-z0-9_-]{1,40}$/.test(text) ? text : null;
|
|
6002
|
+
}
|
|
6003
|
+
function iconOf(pair) {
|
|
6004
|
+
const own3 = glyphOf(pair?.icon) ?? nameOf(pair?.icon);
|
|
6005
|
+
const table = glyphOf(pair?.tableIcon) ?? nameOf(pair?.tableIcon);
|
|
6006
|
+
const chosen = own3 ?? table;
|
|
6007
|
+
return chosen ? { icon: chosen } : {};
|
|
6008
|
+
}
|
|
5989
6009
|
function referencesOf(field2, value, kind, labels) {
|
|
5990
6010
|
if (kind === "entity_reference") {
|
|
5991
6011
|
return (0, import_records13.entityRefsOf)(value).map((r) => ({ token: r.token, id: r.id, label: r.label }));
|
|
@@ -5997,6 +6017,7 @@ function referencesOf(field2, value, kind, labels) {
|
|
|
5997
6017
|
id,
|
|
5998
6018
|
label: labels?.(field2, id) ?? null,
|
|
5999
6019
|
tableId,
|
|
6020
|
+
...iconOf(labels?.icons?.(field2, id)),
|
|
6000
6021
|
...labels?.archived?.(field2, id) ? { archived: true } : {}
|
|
6001
6022
|
}));
|
|
6002
6023
|
}
|
|
@@ -6028,7 +6049,7 @@ function ReferenceChip({ reference, waiting }) {
|
|
|
6028
6049
|
"data-records-reference-archived": reference.archived ? "" : void 0,
|
|
6029
6050
|
title: reference.archived ? ARCHIVED_REFERENCE_TIP : words2,
|
|
6030
6051
|
children: [
|
|
6031
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: reference.icon ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PageGlyph, {}) }),
|
|
6052
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": "true", "data-records-reference-icon": "", className: "inline-flex size-4 shrink-0 items-center justify-center text-muted-foreground", children: glyphOf(reference.icon) ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm leading-none", children: reference.icon }) : reference.icon && host.renderIcon?.(reference.icon) || /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PageGlyph, {}) }),
|
|
6032
6053
|
drawn ?? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate", children: words2 }),
|
|
6033
6054
|
reference.archived ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-muted-foreground", children: ARCHIVED_REFERENCE_WORD }) : null
|
|
6034
6055
|
]
|
|
@@ -16496,7 +16517,7 @@ function opensOnKey(event) {
|
|
|
16496
16517
|
}
|
|
16497
16518
|
return true;
|
|
16498
16519
|
}
|
|
16499
|
-
function withOpenRecord(columns, onOpen,
|
|
16520
|
+
function withOpenRecord(columns, onOpen, nameOf2, place = "end", hrefOf) {
|
|
16500
16521
|
if (!onOpen) return columns;
|
|
16501
16522
|
return columns.map((column, index) => {
|
|
16502
16523
|
const original = column.cell;
|
|
@@ -16506,8 +16527,8 @@ function withOpenRecord(columns, onOpen, nameOf, place = "end", hrefOf) {
|
|
|
16506
16527
|
{
|
|
16507
16528
|
type: "button",
|
|
16508
16529
|
"data-records-open-record": row.id,
|
|
16509
|
-
"aria-label": openRecordLabel(
|
|
16510
|
-
title: `${openRecordLabel(
|
|
16530
|
+
"aria-label": openRecordLabel(nameOf2(row)),
|
|
16531
|
+
title: `${openRecordLabel(nameOf2(row))} (Space)`,
|
|
16511
16532
|
className: "shrink-0 rounded px-1 text-xs leading-5 text-muted-foreground opacity-40 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/matrx-row:opacity-100",
|
|
16512
16533
|
onClick: (event) => {
|
|
16513
16534
|
event.stopPropagation();
|
|
@@ -21361,7 +21382,9 @@ function GridBody({
|
|
|
21361
21382
|
onAskWhoChanged,
|
|
21362
21383
|
embedded = false,
|
|
21363
21384
|
newRowLabel,
|
|
21364
|
-
sortOverride
|
|
21385
|
+
sortOverride,
|
|
21386
|
+
searchOverride,
|
|
21387
|
+
onSearchChange
|
|
21365
21388
|
}) {
|
|
21366
21389
|
const toolbarSlot = useTableToolbarSlot();
|
|
21367
21390
|
const tableCard = (0, import_data_table10.useMatrxTableCard)();
|
|
@@ -21438,6 +21461,14 @@ function GridBody({
|
|
|
21438
21461
|
page: 1
|
|
21439
21462
|
}));
|
|
21440
21463
|
}, [overrideKey]);
|
|
21464
|
+
const overrideSearchSeen = (0, import_react113.useRef)(void 0);
|
|
21465
|
+
(0, import_react113.useEffect)(() => {
|
|
21466
|
+
if (searchOverride === void 0) return;
|
|
21467
|
+
const wanted = searchOverride ?? "";
|
|
21468
|
+
if (overrideSearchSeen.current === wanted) return;
|
|
21469
|
+
overrideSearchSeen.current = wanted;
|
|
21470
|
+
setQuery((held) => held.search === wanted ? held : { ...held, search: wanted, page: 1 });
|
|
21471
|
+
}, [searchOverride]);
|
|
21441
21472
|
const reportQuery = address?.report;
|
|
21442
21473
|
(0, import_react113.useEffect)(() => {
|
|
21443
21474
|
if (!reportQuery) return;
|
|
@@ -21521,7 +21552,32 @@ function GridBody({
|
|
|
21521
21552
|
filter: readFilter ?? null,
|
|
21522
21553
|
version: records.data
|
|
21523
21554
|
});
|
|
21524
|
-
const
|
|
21555
|
+
const embeddedMore = embedded && storePaged;
|
|
21556
|
+
const [appendedRows, setAppendedRows] = (0, import_react113.useState)([]);
|
|
21557
|
+
const [appending, setAppending] = (0, import_react113.useState)(false);
|
|
21558
|
+
const askKey2 = JSON.stringify([tableId, searchTerm, pageSort, readFilter ?? null, viewId]);
|
|
21559
|
+
(0, import_react113.useEffect)(() => setAppendedRows([]), [askKey2]);
|
|
21560
|
+
const pageRows = (0, import_react113.useMemo)(() => {
|
|
21561
|
+
if (manual && !storePaged) return hand.rows ?? [];
|
|
21562
|
+
if (!embeddedMore || appendedRows.length === 0) return storeRows;
|
|
21563
|
+
const seen = new Set(storeRows.map((row) => row.id));
|
|
21564
|
+
return [...storeRows, ...appendedRows.filter((row) => !seen.has(row.id))];
|
|
21565
|
+
}, [manual, storePaged, hand.rows, storeRows, embeddedMore, appendedRows]);
|
|
21566
|
+
const showMoreRows = (0, import_react113.useCallback)(async () => {
|
|
21567
|
+
if (appending || !embeddedMore) return;
|
|
21568
|
+
setAppending(true);
|
|
21569
|
+
const asked3 = await client.listPage({
|
|
21570
|
+
table_id: tableId,
|
|
21571
|
+
...readFilter ? { filter: readFilter } : {},
|
|
21572
|
+
search: searchTerm.trim() === "" ? null : searchTerm.trim(),
|
|
21573
|
+
sort: pageSort,
|
|
21574
|
+
view_id: manual && pageSort.length === 0 ? viewId : null,
|
|
21575
|
+
limit: EMBEDDED_PAGE_SIZE,
|
|
21576
|
+
offset: pageRows.length
|
|
21577
|
+
});
|
|
21578
|
+
setAppending(false);
|
|
21579
|
+
if (asked3.ok) setAppendedRows((held) => [...held, ...asked3.data.rows]);
|
|
21580
|
+
}, [appending, embeddedMore, client, tableId, readFilter, searchTerm, pageSort, manual, viewId, pageRows.length]);
|
|
21525
21581
|
const added = useAddedRows({
|
|
21526
21582
|
tableId,
|
|
21527
21583
|
enabled: merged,
|
|
@@ -22701,6 +22757,21 @@ function GridBody({
|
|
|
22701
22757
|
const tableToolbar = (0, import_react113.useMemo)(
|
|
22702
22758
|
() => ({
|
|
22703
22759
|
search: !embedded,
|
|
22760
|
+
// EMBEDDED: Notion's magnifier — the design system's own search group, a button that
|
|
22761
|
+
// opens into a field. It is the same `query.search` the store's read asks.
|
|
22762
|
+
...embedded ? {
|
|
22763
|
+
customSearch: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
22764
|
+
import_design_system58.TapTargetSearchGroup,
|
|
22765
|
+
{
|
|
22766
|
+
placeholder: "Search",
|
|
22767
|
+
value: searchOverride ?? query.search,
|
|
22768
|
+
onValueChange: (term) => {
|
|
22769
|
+
setQuery((held) => ({ ...held, search: term, page: 1 }));
|
|
22770
|
+
onSearchChange?.(term);
|
|
22771
|
+
}
|
|
22772
|
+
}
|
|
22773
|
+
)
|
|
22774
|
+
} : {},
|
|
22704
22775
|
// The host (Spaces) has its own Properties menu: an embedded table draws no Columns button.
|
|
22705
22776
|
...embedded ? { columns: false } : {},
|
|
22706
22777
|
searchPlaceholder: "Search records",
|
|
@@ -22901,7 +22972,9 @@ function GridBody({
|
|
|
22901
22972
|
sheetExtras,
|
|
22902
22973
|
tableId,
|
|
22903
22974
|
noun,
|
|
22904
|
-
embedded
|
|
22975
|
+
embedded,
|
|
22976
|
+
searchOverride,
|
|
22977
|
+
onSearchChange
|
|
22905
22978
|
]
|
|
22906
22979
|
);
|
|
22907
22980
|
const labelOfField = (0, import_react113.useCallback)(
|
|
@@ -23107,7 +23180,7 @@ function GridBody({
|
|
|
23107
23180
|
pageSize,
|
|
23108
23181
|
query: tableQuery,
|
|
23109
23182
|
...valueFacets ? { facets: valueFacets, filterUi: VALUE_FILTER_UI } : {},
|
|
23110
|
-
...classicInCard ? { hidePagination: true } : {},
|
|
23183
|
+
...classicInCard || embeddedMore ? { hidePagination: true } : {},
|
|
23111
23184
|
...embedded ? { appearance: "embedded" } : {},
|
|
23112
23185
|
tableClassName: (0, import_design_system58.cn)(
|
|
23113
23186
|
!look.wrap && "[&_tbody_td]:max-w-[28rem] [&_tbody_td]:overflow-hidden [&_tbody_td]:text-ellipsis [&_tbody_td]:whitespace-nowrap! [&_tbody_td_*]:whitespace-nowrap!",
|
|
@@ -23212,7 +23285,15 @@ function GridBody({
|
|
|
23212
23285
|
onShowMore: () => setCardExtraRows((extra) => extra + pageSize)
|
|
23213
23286
|
}
|
|
23214
23287
|
) : null
|
|
23215
|
-
) :
|
|
23288
|
+
) : embeddedMore ? typeof records.data?.total === "number" && records.data.total > pageRows.length ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
23289
|
+
import_data_table10.MatrxTableCardShowMore,
|
|
23290
|
+
{
|
|
23291
|
+
shown: pageRows.length,
|
|
23292
|
+
total: records.data.total,
|
|
23293
|
+
busy: appending,
|
|
23294
|
+
onShowMore: () => void showMoreRows()
|
|
23295
|
+
}
|
|
23296
|
+
) : null : storePaged || embedded ? null : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
23216
23297
|
Pager,
|
|
23217
23298
|
{
|
|
23218
23299
|
page,
|
|
@@ -23371,6 +23452,8 @@ function useEntitySource(token, options = {}) {
|
|
|
23371
23452
|
const client = (0, import_react116.useRecordsClient)();
|
|
23372
23453
|
const limit = options.limit ?? 50;
|
|
23373
23454
|
const [tick, setTick] = (0, import_react115.useState)(0);
|
|
23455
|
+
const held = (0, import_react115.useRef)(0);
|
|
23456
|
+
const [loadingMore, setLoadingMore] = (0, import_react115.useState)(false);
|
|
23374
23457
|
const [state, setState] = (0, import_react115.useState)({
|
|
23375
23458
|
label: null,
|
|
23376
23459
|
columns: [],
|
|
@@ -23383,7 +23466,7 @@ function useEntitySource(token, options = {}) {
|
|
|
23383
23466
|
(0, import_react115.useEffect)(() => {
|
|
23384
23467
|
let cancelled = false;
|
|
23385
23468
|
const source = { kind: "entity", token };
|
|
23386
|
-
void Promise.all([client.drillDescribe({ source }), client.drillRows({ source, limit })]).then(
|
|
23469
|
+
void Promise.all([client.drillDescribe({ source }), client.drillRows({ source, limit: Math.max(limit, held.current) })]).then(
|
|
23387
23470
|
([def, page]) => {
|
|
23388
23471
|
if (cancelled) return;
|
|
23389
23472
|
if (!def.ok) return setState((s) => ({ ...s, loading: false, error: refusalSentence(def.error) || "This table could not be read." }));
|
|
@@ -23391,6 +23474,7 @@ function useEntitySource(token, options = {}) {
|
|
|
23391
23474
|
const api = def.data.api;
|
|
23392
23475
|
const shown4 = new Set(page.data.columns instanceof Array ? page.data.columns.filter((c) => typeof c === "string") : []);
|
|
23393
23476
|
const columns = (api?.columns ?? []).filter((c) => c.api_name !== "id" && (shown4.size === 0 || shown4.has(c.api_name) || shown4.has(c.lookup?.via ?? "")));
|
|
23477
|
+
held.current = (page.data.rows ?? []).length;
|
|
23394
23478
|
setState({
|
|
23395
23479
|
label: api?.label ?? def.data.label ?? token,
|
|
23396
23480
|
columns,
|
|
@@ -23434,7 +23518,22 @@ function useEntitySource(token, options = {}) {
|
|
|
23434
23518
|
},
|
|
23435
23519
|
[client, token]
|
|
23436
23520
|
);
|
|
23437
|
-
|
|
23521
|
+
const loadMore = (0, import_react115.useCallback)(async () => {
|
|
23522
|
+
if (loadingMore) return;
|
|
23523
|
+
setLoadingMore(true);
|
|
23524
|
+
const source = { kind: "entity", token };
|
|
23525
|
+
const next = await client.drillRows({ source, limit, offset: held.current });
|
|
23526
|
+
setLoadingMore(false);
|
|
23527
|
+
if (!next.ok) return;
|
|
23528
|
+
const more = next.data.rows ?? [];
|
|
23529
|
+
held.current += more.length;
|
|
23530
|
+
setState((s) => {
|
|
23531
|
+
const seen = new Set(s.rows.map((r) => r.id));
|
|
23532
|
+
return { ...s, rows: [...s.rows, ...more.filter((r) => !seen.has(r.id))] };
|
|
23533
|
+
});
|
|
23534
|
+
}, [client, token, limit, loadingMore]);
|
|
23535
|
+
const hasMore = !state.loading && state.total > state.rows.length;
|
|
23536
|
+
return { ...state, write, create, reload, loadMore, hasMore, loadingMore };
|
|
23438
23537
|
}
|
|
23439
23538
|
function entityValueText(column, v) {
|
|
23440
23539
|
if (v === null || v === void 0 || v === "") return "";
|
|
@@ -23464,7 +23563,7 @@ function entityTableColumns(columns) {
|
|
|
23464
23563
|
...c.type === "choice" && c.choices ? { filter: "select", filterOptions: c.choices.map((w) => ({ value: w, label: w })) } : {}
|
|
23465
23564
|
}));
|
|
23466
23565
|
}
|
|
23467
|
-
function EntityGrid({ entity, pageSize, drill }) {
|
|
23566
|
+
function EntityGrid({ entity, pageSize, drill, embedded }) {
|
|
23468
23567
|
const columns = (0, import_react115.useMemo)(() => entityTableColumns(entity.columns), [entity.columns]);
|
|
23469
23568
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
23470
23569
|
import_data_table11.MatrxDataTable,
|
|
@@ -23474,7 +23573,8 @@ function EntityGrid({ entity, pageSize, drill }) {
|
|
|
23474
23573
|
getRowId: (row) => String(row.id),
|
|
23475
23574
|
isLoading: entity.loading,
|
|
23476
23575
|
...pageSize ? { pageSize } : {},
|
|
23477
|
-
...drill ? { drill } : {}
|
|
23576
|
+
...drill ? { drill } : {},
|
|
23577
|
+
...embedded ? { appearance: "embedded", hidePagination: true } : {}
|
|
23478
23578
|
}
|
|
23479
23579
|
);
|
|
23480
23580
|
}
|
|
@@ -31527,10 +31627,12 @@ function ViewSwitcher({
|
|
|
31527
31627
|
footer,
|
|
31528
31628
|
embedded,
|
|
31529
31629
|
sortOverride,
|
|
31630
|
+
searchOverride,
|
|
31631
|
+
onSearchChange,
|
|
31530
31632
|
newRowLabel,
|
|
31531
31633
|
className
|
|
31532
31634
|
}) {
|
|
31533
|
-
const pageSize = pageSizeAsked ?? (embedded ?
|
|
31635
|
+
const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 200);
|
|
31534
31636
|
const toolbarSlot = useTableToolbarSlot();
|
|
31535
31637
|
const [layout, setLayout] = (0, import_react178.useState)(view.layout);
|
|
31536
31638
|
const hostLayouts = useRecordsUi().layouts ?? [];
|
|
@@ -31592,6 +31694,8 @@ function ViewSwitcher({
|
|
|
31592
31694
|
...footer ? { footer } : {},
|
|
31593
31695
|
...embedded ? { embedded } : {},
|
|
31594
31696
|
...sortOverride !== void 0 ? { sortOverride } : {},
|
|
31697
|
+
...searchOverride !== void 0 ? { searchOverride } : {},
|
|
31698
|
+
...onSearchChange ? { onSearchChange } : {},
|
|
31595
31699
|
...newRowLabel ? { newRowLabel } : {},
|
|
31596
31700
|
...filter ? { filter } : {},
|
|
31597
31701
|
...onClearFilter ? { onClearFilter } : {},
|
|
@@ -45899,22 +46003,22 @@ function RailFrame({
|
|
|
45899
46003
|
return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)("aside", { "data-rail-column": "", className: "w-[26rem] shrink-0 overflow-y-auto rounded-md border p-3", children });
|
|
45900
46004
|
}
|
|
45901
46005
|
function filterInWords(filter, fields) {
|
|
45902
|
-
const
|
|
46006
|
+
const nameOf2 = (key) => {
|
|
45903
46007
|
const field2 = fields.find((f) => f.key === key);
|
|
45904
46008
|
return field2 ? fieldName(field2) : (0, import_text_case17.humanizeIdentifier)(key);
|
|
45905
46009
|
};
|
|
45906
46010
|
const parts = Object.keys(filter).map((key) => {
|
|
45907
46011
|
const value = filter[key];
|
|
45908
|
-
if (value === null || value === void 0) return `${
|
|
46012
|
+
if (value === null || value === void 0) return `${nameOf2(key)} is not filled in`;
|
|
45909
46013
|
if (typeof value === "object") {
|
|
45910
46014
|
const from = (value.from ?? "").toString().trim();
|
|
45911
46015
|
const to = (value.to ?? "").toString().trim();
|
|
45912
|
-
if (from !== "" && to !== "") return `${
|
|
45913
|
-
if (from !== "") return `${
|
|
45914
|
-
if (to !== "") return `${
|
|
45915
|
-
return `${
|
|
46016
|
+
if (from !== "" && to !== "") return `${nameOf2(key)} from ${from} up to ${to}`;
|
|
46017
|
+
if (from !== "") return `${nameOf2(key)} from ${from} onwards`;
|
|
46018
|
+
if (to !== "") return `${nameOf2(key)} up to ${to}`;
|
|
46019
|
+
return `${nameOf2(key)} in a period nobody named`;
|
|
45916
46020
|
}
|
|
45917
|
-
return `${
|
|
46021
|
+
return `${nameOf2(key)} is ${String(value)}`;
|
|
45918
46022
|
});
|
|
45919
46023
|
if (parts.length === 0) return "";
|
|
45920
46024
|
if (parts.length === 1) return parts[0];
|
|
@@ -46114,6 +46218,8 @@ function TablePage({
|
|
|
46114
46218
|
tableId,
|
|
46115
46219
|
presentation: pagePresentation2 = "page",
|
|
46116
46220
|
newRowLabel,
|
|
46221
|
+
searchOverride,
|
|
46222
|
+
onSearchChange,
|
|
46117
46223
|
pageSize: pageSizeAsked,
|
|
46118
46224
|
seedViews,
|
|
46119
46225
|
onLeave,
|
|
@@ -46207,7 +46313,7 @@ function TablePage({
|
|
|
46207
46313
|
const face = tableOpening(view, hostLayouts.map((h) => h.id));
|
|
46208
46314
|
const designated = face.kind === "designated";
|
|
46209
46315
|
const embedded = pagePresentation2 === "embedded";
|
|
46210
|
-
const pageSize = pageSizeAsked ?? (embedded ?
|
|
46316
|
+
const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 100);
|
|
46211
46317
|
const chooserInline = !embedded && !designated && !phone && toolbarFold2 < 2;
|
|
46212
46318
|
const chooserCompact = !embedded && !designated && !phone && toolbarFold2 >= 2;
|
|
46213
46319
|
const controlsInSheet = phone && !designated;
|
|
@@ -46998,6 +47104,8 @@ function TablePage({
|
|
|
46998
47104
|
chooser: false,
|
|
46999
47105
|
...embedded ? { embedded } : {},
|
|
47000
47106
|
...newRowLabel ? { newRowLabel } : {},
|
|
47107
|
+
...searchOverride !== void 0 ? { searchOverride } : {},
|
|
47108
|
+
...onSearchChange ? { onSearchChange } : {},
|
|
47001
47109
|
footer,
|
|
47002
47110
|
openExport: () => setRail("export"),
|
|
47003
47111
|
view: {
|
|
@@ -47160,6 +47268,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
47160
47268
|
}
|
|
47161
47269
|
|
|
47162
47270
|
// src/entityViews.tsx
|
|
47271
|
+
var import_data_table22 = require("@ai-matrx/design-system/data-table");
|
|
47163
47272
|
var import_react267 = require("react");
|
|
47164
47273
|
var import_design_system138 = require("@ai-matrx/design-system");
|
|
47165
47274
|
var import_react268 = require("@ai-matrx/records/react");
|
|
@@ -47303,7 +47412,7 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
47303
47412
|
function EntityTablePage({
|
|
47304
47413
|
source,
|
|
47305
47414
|
presentation = "page",
|
|
47306
|
-
pageSize = 100,
|
|
47415
|
+
pageSize = presentation === "embedded" ? EMBEDDED_PAGE_SIZE : 100,
|
|
47307
47416
|
layout: opened = "grid",
|
|
47308
47417
|
onLayoutChange,
|
|
47309
47418
|
groupBy,
|
|
@@ -47387,7 +47496,18 @@ function EntityTablePage({
|
|
|
47387
47496
|
] })
|
|
47388
47497
|
] }) : null,
|
|
47389
47498
|
addRefused ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_design_system138.ErrorBox, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
|
|
47390
|
-
entity.error ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ (0, import_jsx_runtime153.
|
|
47499
|
+
entity.error ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(import_jsx_runtime153.Fragment, { children: [
|
|
47500
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
|
|
47501
|
+
presentation === "embedded" && entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47502
|
+
import_data_table22.MatrxTableCardShowMore,
|
|
47503
|
+
{
|
|
47504
|
+
shown: entity.rows.length,
|
|
47505
|
+
total: entity.total,
|
|
47506
|
+
busy: entity.loadingMore,
|
|
47507
|
+
onShowMore: () => void entity.loadMore()
|
|
47508
|
+
}
|
|
47509
|
+
) : null
|
|
47510
|
+
] })
|
|
47391
47511
|
] });
|
|
47392
47512
|
}
|
|
47393
47513
|
|