@ai-matrx/records-ui 0.101.33 → 0.101.35
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 +12 -0
- package/dist/index.cjs +161 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -3
- package/dist/index.d.ts +35 -3
- package/dist/index.js +218 -94
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records-ui
|
|
2
2
|
|
|
3
|
+
## 0.101.35
|
|
4
|
+
|
|
5
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
6
|
+
`git diff npm/records-ui/v0.101.34..npm/records-ui/v0.101.35 -- apps/shared/records-ui`).
|
|
7
|
+
No source changes intended and no consumer action required.
|
|
8
|
+
|
|
9
|
+
## 0.101.34
|
|
10
|
+
|
|
11
|
+
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
|
12
|
+
`git diff npm/records-ui/v0.101.33..npm/records-ui/v0.101.34 -- apps/shared/records-ui`).
|
|
13
|
+
No source changes intended and no consumer action required.
|
|
14
|
+
|
|
3
15
|
## 0.101.33
|
|
4
16
|
|
|
5
17
|
Automatic changed-only republish (docs/metadata drift since the last tag — see
|
package/dist/index.cjs
CHANGED
|
@@ -5699,6 +5699,7 @@ var EMBEDDED_TABLE_CLASS = [
|
|
|
5699
5699
|
"[&_thead_th:last-child]:border-r-0"
|
|
5700
5700
|
].join(" ");
|
|
5701
5701
|
var EMBEDDED_PLAIN_FOOTER_CLASS = "[&_tfoot]:bg-transparent [&_tfoot]:border-t-0";
|
|
5702
|
+
var EMBEDDED_PAGE_SIZE = 50;
|
|
5702
5703
|
|
|
5703
5704
|
// src/enumLabels.ts
|
|
5704
5705
|
function exhaustiveValuesOf() {
|
|
@@ -21381,7 +21382,9 @@ function GridBody({
|
|
|
21381
21382
|
onAskWhoChanged,
|
|
21382
21383
|
embedded = false,
|
|
21383
21384
|
newRowLabel,
|
|
21384
|
-
sortOverride
|
|
21385
|
+
sortOverride,
|
|
21386
|
+
searchOverride,
|
|
21387
|
+
onSearchChange
|
|
21385
21388
|
}) {
|
|
21386
21389
|
const toolbarSlot = useTableToolbarSlot();
|
|
21387
21390
|
const tableCard = (0, import_data_table10.useMatrxTableCard)();
|
|
@@ -21458,6 +21461,14 @@ function GridBody({
|
|
|
21458
21461
|
page: 1
|
|
21459
21462
|
}));
|
|
21460
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]);
|
|
21461
21472
|
const reportQuery = address?.report;
|
|
21462
21473
|
(0, import_react113.useEffect)(() => {
|
|
21463
21474
|
if (!reportQuery) return;
|
|
@@ -21541,7 +21552,32 @@ function GridBody({
|
|
|
21541
21552
|
filter: readFilter ?? null,
|
|
21542
21553
|
version: records.data
|
|
21543
21554
|
});
|
|
21544
|
-
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]);
|
|
21545
21581
|
const added = useAddedRows({
|
|
21546
21582
|
tableId,
|
|
21547
21583
|
enabled: merged,
|
|
@@ -22721,6 +22757,21 @@ function GridBody({
|
|
|
22721
22757
|
const tableToolbar = (0, import_react113.useMemo)(
|
|
22722
22758
|
() => ({
|
|
22723
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
|
+
} : {},
|
|
22724
22775
|
// The host (Spaces) has its own Properties menu: an embedded table draws no Columns button.
|
|
22725
22776
|
...embedded ? { columns: false } : {},
|
|
22726
22777
|
searchPlaceholder: "Search records",
|
|
@@ -22921,7 +22972,9 @@ function GridBody({
|
|
|
22921
22972
|
sheetExtras,
|
|
22922
22973
|
tableId,
|
|
22923
22974
|
noun,
|
|
22924
|
-
embedded
|
|
22975
|
+
embedded,
|
|
22976
|
+
searchOverride,
|
|
22977
|
+
onSearchChange
|
|
22925
22978
|
]
|
|
22926
22979
|
);
|
|
22927
22980
|
const labelOfField = (0, import_react113.useCallback)(
|
|
@@ -23127,7 +23180,7 @@ function GridBody({
|
|
|
23127
23180
|
pageSize,
|
|
23128
23181
|
query: tableQuery,
|
|
23129
23182
|
...valueFacets ? { facets: valueFacets, filterUi: VALUE_FILTER_UI } : {},
|
|
23130
|
-
...classicInCard ? { hidePagination: true } : {},
|
|
23183
|
+
...classicInCard || embeddedMore ? { hidePagination: true } : {},
|
|
23131
23184
|
...embedded ? { appearance: "embedded" } : {},
|
|
23132
23185
|
tableClassName: (0, import_design_system58.cn)(
|
|
23133
23186
|
!look.wrap && "[&_tbody_td]:max-w-[28rem] [&_tbody_td]:overflow-hidden [&_tbody_td]:text-ellipsis [&_tbody_td]:whitespace-nowrap! [&_tbody_td_*]:whitespace-nowrap!",
|
|
@@ -23232,7 +23285,15 @@ function GridBody({
|
|
|
23232
23285
|
onShowMore: () => setCardExtraRows((extra) => extra + pageSize)
|
|
23233
23286
|
}
|
|
23234
23287
|
) : null
|
|
23235
|
-
) :
|
|
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)(
|
|
23236
23297
|
Pager,
|
|
23237
23298
|
{
|
|
23238
23299
|
page,
|
|
@@ -23390,7 +23451,11 @@ var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
|
23390
23451
|
function useEntitySource(token, options = {}) {
|
|
23391
23452
|
const client = (0, import_react116.useRecordsClient)();
|
|
23392
23453
|
const limit = options.limit ?? 50;
|
|
23454
|
+
const search = (options.search ?? "").trim();
|
|
23393
23455
|
const [tick, setTick] = (0, import_react115.useState)(0);
|
|
23456
|
+
const held = (0, import_react115.useRef)(0);
|
|
23457
|
+
const askedSearch = (0, import_react115.useRef)("");
|
|
23458
|
+
const [loadingMore, setLoadingMore] = (0, import_react115.useState)(false);
|
|
23394
23459
|
const [state, setState] = (0, import_react115.useState)({
|
|
23395
23460
|
label: null,
|
|
23396
23461
|
columns: [],
|
|
@@ -23402,8 +23467,12 @@ function useEntitySource(token, options = {}) {
|
|
|
23402
23467
|
});
|
|
23403
23468
|
(0, import_react115.useEffect)(() => {
|
|
23404
23469
|
let cancelled = false;
|
|
23470
|
+
if (askedSearch.current !== search) {
|
|
23471
|
+
askedSearch.current = search;
|
|
23472
|
+
held.current = 0;
|
|
23473
|
+
}
|
|
23405
23474
|
const source = { kind: "entity", token };
|
|
23406
|
-
void Promise.all([client.drillDescribe({ source }), client.drillRows({ source, limit })]).then(
|
|
23475
|
+
void Promise.all([client.drillDescribe({ source }), client.drillRows({ source, limit: Math.max(limit, held.current), ...search ? { search } : {} })]).then(
|
|
23407
23476
|
([def, page]) => {
|
|
23408
23477
|
if (cancelled) return;
|
|
23409
23478
|
if (!def.ok) return setState((s) => ({ ...s, loading: false, error: refusalSentence(def.error) || "This table could not be read." }));
|
|
@@ -23411,6 +23480,7 @@ function useEntitySource(token, options = {}) {
|
|
|
23411
23480
|
const api = def.data.api;
|
|
23412
23481
|
const shown4 = new Set(page.data.columns instanceof Array ? page.data.columns.filter((c) => typeof c === "string") : []);
|
|
23413
23482
|
const columns = (api?.columns ?? []).filter((c) => c.api_name !== "id" && (shown4.size === 0 || shown4.has(c.api_name) || shown4.has(c.lookup?.via ?? "")));
|
|
23483
|
+
held.current = (page.data.rows ?? []).length;
|
|
23414
23484
|
setState({
|
|
23415
23485
|
label: api?.label ?? def.data.label ?? token,
|
|
23416
23486
|
columns,
|
|
@@ -23428,7 +23498,7 @@ function useEntitySource(token, options = {}) {
|
|
|
23428
23498
|
return () => {
|
|
23429
23499
|
cancelled = true;
|
|
23430
23500
|
};
|
|
23431
|
-
}, [client, token, limit, tick]);
|
|
23501
|
+
}, [client, token, limit, tick, search]);
|
|
23432
23502
|
const reload = (0, import_react115.useCallback)(() => setTick((t) => t + 1), []);
|
|
23433
23503
|
const write = (0, import_react115.useCallback)(
|
|
23434
23504
|
async (rowId, apiName, value) => {
|
|
@@ -23454,7 +23524,22 @@ function useEntitySource(token, options = {}) {
|
|
|
23454
23524
|
},
|
|
23455
23525
|
[client, token]
|
|
23456
23526
|
);
|
|
23457
|
-
|
|
23527
|
+
const loadMore = (0, import_react115.useCallback)(async () => {
|
|
23528
|
+
if (loadingMore) return;
|
|
23529
|
+
setLoadingMore(true);
|
|
23530
|
+
const source = { kind: "entity", token };
|
|
23531
|
+
const next = await client.drillRows({ source, limit, offset: held.current, ...search ? { search } : {} });
|
|
23532
|
+
setLoadingMore(false);
|
|
23533
|
+
if (!next.ok) return;
|
|
23534
|
+
const more = next.data.rows ?? [];
|
|
23535
|
+
held.current += more.length;
|
|
23536
|
+
setState((s) => {
|
|
23537
|
+
const seen = new Set(s.rows.map((r) => r.id));
|
|
23538
|
+
return { ...s, rows: [...s.rows, ...more.filter((r) => !seen.has(r.id))] };
|
|
23539
|
+
});
|
|
23540
|
+
}, [client, token, limit, loadingMore, search]);
|
|
23541
|
+
const hasMore = !state.loading && state.total > state.rows.length;
|
|
23542
|
+
return { ...state, write, create, reload, loadMore, hasMore, loadingMore };
|
|
23458
23543
|
}
|
|
23459
23544
|
function entityValueText(column, v) {
|
|
23460
23545
|
if (v === null || v === void 0 || v === "") return "";
|
|
@@ -23484,7 +23569,7 @@ function entityTableColumns(columns) {
|
|
|
23484
23569
|
...c.type === "choice" && c.choices ? { filter: "select", filterOptions: c.choices.map((w) => ({ value: w, label: w })) } : {}
|
|
23485
23570
|
}));
|
|
23486
23571
|
}
|
|
23487
|
-
function EntityGrid({ entity, pageSize, drill }) {
|
|
23572
|
+
function EntityGrid({ entity, pageSize, drill, embedded }) {
|
|
23488
23573
|
const columns = (0, import_react115.useMemo)(() => entityTableColumns(entity.columns), [entity.columns]);
|
|
23489
23574
|
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
23490
23575
|
import_data_table11.MatrxDataTable,
|
|
@@ -23494,7 +23579,8 @@ function EntityGrid({ entity, pageSize, drill }) {
|
|
|
23494
23579
|
getRowId: (row) => String(row.id),
|
|
23495
23580
|
isLoading: entity.loading,
|
|
23496
23581
|
...pageSize ? { pageSize } : {},
|
|
23497
|
-
...drill ? { drill } : {}
|
|
23582
|
+
...drill ? { drill } : {},
|
|
23583
|
+
...embedded ? { appearance: "embedded", hidePagination: true } : {}
|
|
23498
23584
|
}
|
|
23499
23585
|
);
|
|
23500
23586
|
}
|
|
@@ -31547,10 +31633,12 @@ function ViewSwitcher({
|
|
|
31547
31633
|
footer,
|
|
31548
31634
|
embedded,
|
|
31549
31635
|
sortOverride,
|
|
31636
|
+
searchOverride,
|
|
31637
|
+
onSearchChange,
|
|
31550
31638
|
newRowLabel,
|
|
31551
31639
|
className
|
|
31552
31640
|
}) {
|
|
31553
|
-
const pageSize = pageSizeAsked ?? (embedded ?
|
|
31641
|
+
const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 200);
|
|
31554
31642
|
const toolbarSlot = useTableToolbarSlot();
|
|
31555
31643
|
const [layout, setLayout] = (0, import_react178.useState)(view.layout);
|
|
31556
31644
|
const hostLayouts = useRecordsUi().layouts ?? [];
|
|
@@ -31612,6 +31700,8 @@ function ViewSwitcher({
|
|
|
31612
31700
|
...footer ? { footer } : {},
|
|
31613
31701
|
...embedded ? { embedded } : {},
|
|
31614
31702
|
...sortOverride !== void 0 ? { sortOverride } : {},
|
|
31703
|
+
...searchOverride !== void 0 ? { searchOverride } : {},
|
|
31704
|
+
...onSearchChange ? { onSearchChange } : {},
|
|
31615
31705
|
...newRowLabel ? { newRowLabel } : {},
|
|
31616
31706
|
...filter ? { filter } : {},
|
|
31617
31707
|
...onClearFilter ? { onClearFilter } : {},
|
|
@@ -46134,6 +46224,8 @@ function TablePage({
|
|
|
46134
46224
|
tableId,
|
|
46135
46225
|
presentation: pagePresentation2 = "page",
|
|
46136
46226
|
newRowLabel,
|
|
46227
|
+
searchOverride,
|
|
46228
|
+
onSearchChange,
|
|
46137
46229
|
pageSize: pageSizeAsked,
|
|
46138
46230
|
seedViews,
|
|
46139
46231
|
onLeave,
|
|
@@ -46227,7 +46319,7 @@ function TablePage({
|
|
|
46227
46319
|
const face = tableOpening(view, hostLayouts.map((h) => h.id));
|
|
46228
46320
|
const designated = face.kind === "designated";
|
|
46229
46321
|
const embedded = pagePresentation2 === "embedded";
|
|
46230
|
-
const pageSize = pageSizeAsked ?? (embedded ?
|
|
46322
|
+
const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 100);
|
|
46231
46323
|
const chooserInline = !embedded && !designated && !phone && toolbarFold2 < 2;
|
|
46232
46324
|
const chooserCompact = !embedded && !designated && !phone && toolbarFold2 >= 2;
|
|
46233
46325
|
const controlsInSheet = phone && !designated;
|
|
@@ -47018,6 +47110,8 @@ function TablePage({
|
|
|
47018
47110
|
chooser: false,
|
|
47019
47111
|
...embedded ? { embedded } : {},
|
|
47020
47112
|
...newRowLabel ? { newRowLabel } : {},
|
|
47113
|
+
...searchOverride !== void 0 ? { searchOverride } : {},
|
|
47114
|
+
...onSearchChange ? { onSearchChange } : {},
|
|
47021
47115
|
footer,
|
|
47022
47116
|
openExport: () => setRail("export"),
|
|
47023
47117
|
view: {
|
|
@@ -47180,8 +47274,10 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
47180
47274
|
}
|
|
47181
47275
|
|
|
47182
47276
|
// src/entityViews.tsx
|
|
47183
|
-
var import_react267 = require("react");
|
|
47184
47277
|
var import_design_system138 = require("@ai-matrx/design-system");
|
|
47278
|
+
var import_data_table22 = require("@ai-matrx/design-system/data-table");
|
|
47279
|
+
var import_react267 = require("react");
|
|
47280
|
+
var import_design_system139 = require("@ai-matrx/design-system");
|
|
47185
47281
|
var import_react268 = require("@ai-matrx/records/react");
|
|
47186
47282
|
var import_jsx_runtime153 = require("react/jsx-runtime");
|
|
47187
47283
|
var entityTitleColumn = entityNameColumn;
|
|
@@ -47225,14 +47321,14 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
47225
47321
|
setMoving(null);
|
|
47226
47322
|
if (says) setRefused({ to, says });
|
|
47227
47323
|
};
|
|
47228
|
-
return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: (0,
|
|
47324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: (0, import_design_system139.cn)("flex min-h-40 gap-2 overflow-x-auto pb-1", className), "data-records-entity-board": column.api_name, children: lanes.map((lane) => {
|
|
47229
47325
|
const cards = rowsOf3(lane.key);
|
|
47230
47326
|
if (lane.key === "" && cards.length === 0) return null;
|
|
47231
47327
|
return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
|
|
47232
47328
|
"section",
|
|
47233
47329
|
{
|
|
47234
47330
|
"aria-label": lane.label,
|
|
47235
|
-
className: (0,
|
|
47331
|
+
className: (0, import_design_system139.cn)("flex w-60 shrink-0 flex-col gap-1.5 rounded-md bg-muted/40 p-1.5", over === lane.key && "ring-1 ring-ring"),
|
|
47236
47332
|
onDragOver: writable && lane.key ? (e) => {
|
|
47237
47333
|
e.preventDefault();
|
|
47238
47334
|
setOver(lane.key);
|
|
@@ -47244,7 +47340,7 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
47244
47340
|
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "truncate font-medium", children: lane.label }),
|
|
47245
47341
|
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "tabular-nums text-muted-foreground", children: cards.length })
|
|
47246
47342
|
] }),
|
|
47247
|
-
refused && refused.to === lane.key ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47343
|
+
refused && refused.to === lane.key ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_design_system139.ErrorBox, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: refused.says, operation: "Move a card", origin: "records-ui/entityViews" }) : null,
|
|
47248
47344
|
cards.map((row) => /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(
|
|
47249
47345
|
"article",
|
|
47250
47346
|
{
|
|
@@ -47253,7 +47349,7 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
47253
47349
|
e.dataTransfer.setData("text/x-entity-row", row.id);
|
|
47254
47350
|
e.dataTransfer.effectAllowed = "move";
|
|
47255
47351
|
},
|
|
47256
|
-
className: (0,
|
|
47352
|
+
className: (0, import_design_system139.cn)("flex flex-col gap-0.5 rounded border bg-card px-2 py-1.5 text-xs shadow-sm", writable && "cursor-grab", moving?.id === row.id && "opacity-60"),
|
|
47257
47353
|
"data-records-entity-card": row.id,
|
|
47258
47354
|
children: [
|
|
47259
47355
|
onOpenRecord ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row.id), children: shown3(title ? row[title.api_name] : row.id) || "Untitled" }) : /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "truncate font-medium", children: shown3(title ? row[title.api_name] : row.id) || "Untitled" }),
|
|
@@ -47306,7 +47402,7 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
47306
47402
|
};
|
|
47307
47403
|
}, [client, ask, kind, title]);
|
|
47308
47404
|
if (!block) {
|
|
47309
|
-
return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: (0,
|
|
47405
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: (0, import_design_system139.cn)("min-h-24 animate-pulse rounded bg-muted/40", className), "aria-busy": "true" });
|
|
47310
47406
|
}
|
|
47311
47407
|
return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47312
47408
|
ChartBlock,
|
|
@@ -47323,7 +47419,9 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
47323
47419
|
function EntityTablePage({
|
|
47324
47420
|
source,
|
|
47325
47421
|
presentation = "page",
|
|
47326
|
-
|
|
47422
|
+
searchOverride,
|
|
47423
|
+
onSearchChange,
|
|
47424
|
+
pageSize = presentation === "embedded" ? EMBEDDED_PAGE_SIZE : 100,
|
|
47327
47425
|
layout: opened = "grid",
|
|
47328
47426
|
onLayoutChange,
|
|
47329
47427
|
groupBy,
|
|
@@ -47331,7 +47429,9 @@ function EntityTablePage({
|
|
|
47331
47429
|
actions,
|
|
47332
47430
|
className
|
|
47333
47431
|
}) {
|
|
47334
|
-
const
|
|
47432
|
+
const [typed2, setTyped] = (0, import_react267.useState)("");
|
|
47433
|
+
const term = searchOverride ?? typed2;
|
|
47434
|
+
const entity = useEntitySource(source.token, { limit: pageSize, search: term });
|
|
47335
47435
|
const [layout, setLayout] = (0, import_react267.useState)(opened);
|
|
47336
47436
|
(0, import_react267.useEffect)(() => setLayout(opened), [opened]);
|
|
47337
47437
|
const choose = (next) => {
|
|
@@ -47363,21 +47463,21 @@ function EntityTablePage({
|
|
|
47363
47463
|
rowNoun: (entity.label ?? "record").toLowerCase(),
|
|
47364
47464
|
enabled: layout === "grid"
|
|
47365
47465
|
});
|
|
47366
|
-
return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: (0,
|
|
47466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: (0, import_design_system139.cn)("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
|
|
47367
47467
|
presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
47368
47468
|
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
|
|
47369
47469
|
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading ? "" : entity.total.toLocaleString() }) : null,
|
|
47370
47470
|
/* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
47371
47471
|
boardable ? /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(import_jsx_runtime153.Fragment, { children: [
|
|
47372
|
-
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47373
|
-
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47472
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_design_system139.Button, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
|
|
47473
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_design_system139.Button, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
|
|
47374
47474
|
] }) : null,
|
|
47375
|
-
entity.creatable && naming === null ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47475
|
+
entity.creatable && naming === null ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_design_system139.Button, { size: "sm", variant: "ghost", onClick: () => {
|
|
47376
47476
|
setAddRefused(null);
|
|
47377
47477
|
setNaming("");
|
|
47378
47478
|
}, children: "New page" }) : null,
|
|
47379
47479
|
entity.creatable && naming !== null ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47380
|
-
|
|
47480
|
+
import_design_system139.Input,
|
|
47381
47481
|
{
|
|
47382
47482
|
autoFocus: true,
|
|
47383
47483
|
"data-records-entity-new": source.token,
|
|
@@ -47406,8 +47506,30 @@ function EntityTablePage({
|
|
|
47406
47506
|
actions
|
|
47407
47507
|
] })
|
|
47408
47508
|
] }) : null,
|
|
47409
|
-
addRefused ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47410
|
-
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.
|
|
47509
|
+
addRefused ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_design_system139.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,
|
|
47510
|
+
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: [
|
|
47511
|
+
presentation === "embedded" ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(import_design_system138.TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47512
|
+
import_design_system138.TapTargetSearchGroup,
|
|
47513
|
+
{
|
|
47514
|
+
placeholder: "Search",
|
|
47515
|
+
value: term,
|
|
47516
|
+
onValueChange: (next) => {
|
|
47517
|
+
setTyped(next);
|
|
47518
|
+
onSearchChange?.(next);
|
|
47519
|
+
}
|
|
47520
|
+
}
|
|
47521
|
+
) }) }) : null,
|
|
47522
|
+
/* @__PURE__ */ (0, import_jsx_runtime153.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
|
|
47523
|
+
presentation === "embedded" && entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
|
|
47524
|
+
import_data_table22.MatrxTableCardShowMore,
|
|
47525
|
+
{
|
|
47526
|
+
shown: entity.rows.length,
|
|
47527
|
+
total: entity.total,
|
|
47528
|
+
busy: entity.loadingMore,
|
|
47529
|
+
onShowMore: () => void entity.loadMore()
|
|
47530
|
+
}
|
|
47531
|
+
) : null
|
|
47532
|
+
] })
|
|
47411
47533
|
] });
|
|
47412
47534
|
}
|
|
47413
47535
|
|
|
@@ -47423,6 +47545,8 @@ function TablePage2(props) {
|
|
|
47423
47545
|
source,
|
|
47424
47546
|
...rest.presentation ? { presentation: rest.presentation } : {},
|
|
47425
47547
|
...rest.pageSize ? { pageSize: rest.pageSize } : {},
|
|
47548
|
+
...rest.searchOverride !== void 0 ? { searchOverride: rest.searchOverride } : {},
|
|
47549
|
+
...rest.onSearchChange ? { onSearchChange: rest.onSearchChange } : {},
|
|
47426
47550
|
...layout ? { layout } : {},
|
|
47427
47551
|
...onLayoutChange ? { onLayoutChange } : {},
|
|
47428
47552
|
...groupBy ? { groupBy } : {},
|
|
@@ -47436,7 +47560,7 @@ function TablePage2(props) {
|
|
|
47436
47560
|
var import_react269 = require("react");
|
|
47437
47561
|
var import_records62 = require("@ai-matrx/records");
|
|
47438
47562
|
var import_react270 = require("@ai-matrx/records/react");
|
|
47439
|
-
var
|
|
47563
|
+
var import_design_system140 = require("@ai-matrx/design-system");
|
|
47440
47564
|
var import_jsx_runtime155 = require("react/jsx-runtime");
|
|
47441
47565
|
var DATA_BINDING_SHAPES = [
|
|
47442
47566
|
{ value: "collection", label: "The whole table" },
|
|
@@ -47572,7 +47696,7 @@ function BindingDetails({
|
|
|
47572
47696
|
const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
|
|
47573
47697
|
return /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
47574
47698
|
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
47575
|
-
|
|
47699
|
+
import_design_system140.Button,
|
|
47576
47700
|
{
|
|
47577
47701
|
type: "button",
|
|
47578
47702
|
size: "sm",
|
|
@@ -47595,7 +47719,7 @@ function BindingDetails({
|
|
|
47595
47719
|
}
|
|
47596
47720
|
),
|
|
47597
47721
|
shape === "value" && /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
47598
|
-
|
|
47722
|
+
import_design_system140.CreatablePicker,
|
|
47599
47723
|
{
|
|
47600
47724
|
value: binding.field_key ?? null,
|
|
47601
47725
|
options: fieldOptions,
|
|
@@ -47612,7 +47736,7 @@ function BindingDetails({
|
|
|
47612
47736
|
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
47613
47737
|
"textarea",
|
|
47614
47738
|
{
|
|
47615
|
-
className: (0,
|
|
47739
|
+
className: (0, import_design_system140.cn)(
|
|
47616
47740
|
"min-h-[3.5rem] w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs"
|
|
47617
47741
|
),
|
|
47618
47742
|
"aria-label": "Each row reads as",
|
|
@@ -47622,7 +47746,7 @@ function BindingDetails({
|
|
|
47622
47746
|
}
|
|
47623
47747
|
),
|
|
47624
47748
|
!disabled && /* @__PURE__ */ (0, import_jsx_runtime155.jsx)("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
47625
|
-
|
|
47749
|
+
import_design_system140.Button,
|
|
47626
47750
|
{
|
|
47627
47751
|
type: "button",
|
|
47628
47752
|
size: "sm",
|
|
@@ -47637,7 +47761,7 @@ function BindingDetails({
|
|
|
47637
47761
|
shape === "collection" && /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
47638
47762
|
"Up to",
|
|
47639
47763
|
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
47640
|
-
|
|
47764
|
+
import_design_system140.BasicInput,
|
|
47641
47765
|
{
|
|
47642
47766
|
type: "number",
|
|
47643
47767
|
min: 1,
|
|
@@ -47656,7 +47780,7 @@ function BindingDetails({
|
|
|
47656
47780
|
/* @__PURE__ */ (0, import_jsx_runtime155.jsxs)("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
|
|
47657
47781
|
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
|
|
47658
47782
|
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
47659
|
-
|
|
47783
|
+
import_design_system140.Button,
|
|
47660
47784
|
{
|
|
47661
47785
|
type: "button",
|
|
47662
47786
|
size: "sm",
|
|
@@ -47753,7 +47877,7 @@ function RecordNameWords({ tableId, recordId }) {
|
|
|
47753
47877
|
// src/HeldChangeDecision.tsx
|
|
47754
47878
|
var import_react272 = require("react");
|
|
47755
47879
|
var import_react273 = require("@ai-matrx/records/react");
|
|
47756
|
-
var
|
|
47880
|
+
var import_design_system141 = require("@ai-matrx/design-system");
|
|
47757
47881
|
var import_jsx_runtime157 = require("react/jsx-runtime");
|
|
47758
47882
|
function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided }) {
|
|
47759
47883
|
return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(import_react273.RecordsProvider, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(Decision, { approvalId, onDecided }) });
|
|
@@ -47788,8 +47912,8 @@ function Decision({ approvalId, onDecided }) {
|
|
|
47788
47912
|
if (may === null) return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
|
|
47789
47913
|
return /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
47790
47914
|
may ? /* @__PURE__ */ (0, import_jsx_runtime157.jsxs)("div", { className: "flex gap-2", children: [
|
|
47791
|
-
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
47792
|
-
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(
|
|
47915
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(import_design_system141.Button, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
|
|
47916
|
+
/* @__PURE__ */ (0, import_jsx_runtime157.jsx)(import_design_system141.Button, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
|
|
47793
47917
|
] }) : !error && /* @__PURE__ */ (0, import_jsx_runtime157.jsx)("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
|
|
47794
47918
|
error ? /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(RefusalLine, { error }) : null
|
|
47795
47919
|
] });
|