@ai-matrx/records-ui 0.93.2 → 0.93.3
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 +7 -0
- package/dist/index.cjs +276 -204
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +189 -117
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1325,6 +1325,13 @@ interface GridEditing {
|
|
|
1325
1325
|
rowError: RecordsError | null;
|
|
1326
1326
|
clearRowError: () => void;
|
|
1327
1327
|
busy: boolean;
|
|
1328
|
+
/**
|
|
1329
|
+
* EVERYTHING THIS SESSION HOLDS THAT CHANGES HOW ONE ROW DRAWS (lane RENDER-AUDIT, 2026-09-26):
|
|
1330
|
+
* the open cell and what is typed in it, an optimistic value, a save in flight, a refusal. The
|
|
1331
|
+
* grid hands it to the data table as `rowVersion`, so a keystroke, a save or a refusal redraws
|
|
1332
|
+
* the ONE row it belongs to and no other.
|
|
1333
|
+
*/
|
|
1334
|
+
rowSignature: (rowId: Uuid$1) => readonly unknown[];
|
|
1328
1335
|
}
|
|
1329
1336
|
interface Options {
|
|
1330
1337
|
tableId: Uuid$1;
|
|
@@ -4054,11 +4061,6 @@ interface RecordsMountProps {
|
|
|
4054
4061
|
children: ReactNode;
|
|
4055
4062
|
}
|
|
4056
4063
|
declare function RecordsMount({ config, host, letTheStoreDecideRights, children, }: RecordsMountProps): react.JSX.Element;
|
|
4057
|
-
/**
|
|
4058
|
-
* The actor a signed-in person is. `user` is the store's own word (the closed
|
|
4059
|
-
* ACTOR_VOCABULARY is `user` · `agent` · `system`), and AGT-N-4 means an agent
|
|
4060
|
-
* acting for this person carries exactly this authority and no other.
|
|
4061
|
-
*/
|
|
4062
4064
|
declare function personActor(userId: Uuid$1 | null | undefined): RecordsActor;
|
|
4063
4065
|
/**
|
|
4064
4066
|
* A supabase-js client AS this package's data seam.
|
package/dist/index.d.ts
CHANGED
|
@@ -1325,6 +1325,13 @@ interface GridEditing {
|
|
|
1325
1325
|
rowError: RecordsError | null;
|
|
1326
1326
|
clearRowError: () => void;
|
|
1327
1327
|
busy: boolean;
|
|
1328
|
+
/**
|
|
1329
|
+
* EVERYTHING THIS SESSION HOLDS THAT CHANGES HOW ONE ROW DRAWS (lane RENDER-AUDIT, 2026-09-26):
|
|
1330
|
+
* the open cell and what is typed in it, an optimistic value, a save in flight, a refusal. The
|
|
1331
|
+
* grid hands it to the data table as `rowVersion`, so a keystroke, a save or a refusal redraws
|
|
1332
|
+
* the ONE row it belongs to and no other.
|
|
1333
|
+
*/
|
|
1334
|
+
rowSignature: (rowId: Uuid$1) => readonly unknown[];
|
|
1328
1335
|
}
|
|
1329
1336
|
interface Options {
|
|
1330
1337
|
tableId: Uuid$1;
|
|
@@ -4054,11 +4061,6 @@ interface RecordsMountProps {
|
|
|
4054
4061
|
children: ReactNode;
|
|
4055
4062
|
}
|
|
4056
4063
|
declare function RecordsMount({ config, host, letTheStoreDecideRights, children, }: RecordsMountProps): react.JSX.Element;
|
|
4057
|
-
/**
|
|
4058
|
-
* The actor a signed-in person is. `user` is the store's own word (the closed
|
|
4059
|
-
* ACTOR_VOCABULARY is `user` · `agent` · `system`), and AGT-N-4 means an agent
|
|
4060
|
-
* acting for this person carries exactly this authority and no other.
|
|
4061
|
-
*/
|
|
4062
4064
|
declare function personActor(userId: Uuid$1 | null | undefined): RecordsActor;
|
|
4063
4065
|
/**
|
|
4064
4066
|
* A supabase-js client AS this package's data seam.
|
package/dist/index.js
CHANGED
|
@@ -4012,7 +4012,20 @@ function useGridEditing({ tableId, fields, rows, reload, canWrite, mayWriteRow,
|
|
|
4012
4012
|
}
|
|
4013
4013
|
return null;
|
|
4014
4014
|
}, [client, tableId, reload, order]);
|
|
4015
|
+
const rowSignature = useCallback5(
|
|
4016
|
+
(rowId) => {
|
|
4017
|
+
const out = [];
|
|
4018
|
+
if (editing?.rowId === rowId) out.push("open", editing.key, draft);
|
|
4019
|
+
const prefix = `${rowId}::`;
|
|
4020
|
+
for (const id in optimistic) if (id.startsWith(prefix)) out.push("held", id, optimistic[id]);
|
|
4021
|
+
for (const id in saving) if (id.startsWith(prefix)) out.push("saving", id);
|
|
4022
|
+
for (const id in refusals) if (id.startsWith(prefix)) out.push("refused", id, refusals[id]);
|
|
4023
|
+
return out;
|
|
4024
|
+
},
|
|
4025
|
+
[editing, draft, optimistic, saving, refusals]
|
|
4026
|
+
);
|
|
4015
4027
|
return {
|
|
4028
|
+
rowSignature,
|
|
4016
4029
|
valueFor,
|
|
4017
4030
|
editing,
|
|
4018
4031
|
draft,
|
|
@@ -7936,11 +7949,12 @@ function placePinnedRows(pageRows, pinned, anchors) {
|
|
|
7936
7949
|
}
|
|
7937
7950
|
function withAddRowCells(columns, line) {
|
|
7938
7951
|
if (line === null) return columns;
|
|
7952
|
+
const draw = () => typeof line === "function" ? line() : line;
|
|
7939
7953
|
return columns.map((column, index) => {
|
|
7940
7954
|
const own2 = column.cell;
|
|
7941
7955
|
return {
|
|
7942
7956
|
...column,
|
|
7943
|
-
cell: (row, rowIndex) => row.id === ADD_ROW_ID ? index === 0 ?
|
|
7957
|
+
cell: (row, rowIndex) => row.id === ADD_ROW_ID ? index === 0 ? draw() : null : own2 ? own2(row, rowIndex) : null
|
|
7944
7958
|
};
|
|
7945
7959
|
});
|
|
7946
7960
|
}
|
|
@@ -7963,6 +7977,7 @@ function AddRowLine({ onAdd, busy }) {
|
|
|
7963
7977
|
}
|
|
7964
7978
|
);
|
|
7965
7979
|
}
|
|
7980
|
+
var drawNothing = () => null;
|
|
7966
7981
|
function addColumnColumn(onAdd) {
|
|
7967
7982
|
return {
|
|
7968
7983
|
id: ADD_COLUMN_ID,
|
|
@@ -7982,7 +7997,8 @@ function addColumnColumn(onAdd) {
|
|
|
7982
7997
|
children: "+"
|
|
7983
7998
|
}
|
|
7984
7999
|
),
|
|
7985
|
-
|
|
8000
|
+
// ONE function for the life of the module: a body cell that draws nothing never changes.
|
|
8001
|
+
cell: drawNothing,
|
|
7986
8002
|
sortable: false,
|
|
7987
8003
|
filter: false,
|
|
7988
8004
|
hideable: false,
|
|
@@ -10615,6 +10631,8 @@ function HandOrderDialog({
|
|
|
10615
10631
|
import { Fragment as Fragment15, jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
10616
10632
|
var NO_COLUMNS_YET = "This table has no columns yet";
|
|
10617
10633
|
var NO_COLUMNS_WHY = "A column is what a record holds \u2014 a name, a date, an amount, a person. Add the first one and the grid appears with it; everything else on this page works the moment it exists.";
|
|
10634
|
+
var NO_SUMMARIES = Object.freeze({});
|
|
10635
|
+
var rowIdOf = (row) => row.id;
|
|
10618
10636
|
function Grid({
|
|
10619
10637
|
tableId,
|
|
10620
10638
|
pageSize = 50,
|
|
@@ -10764,6 +10782,15 @@ function Grid({
|
|
|
10764
10782
|
onEnded: (exit, from, how) => sheetController.current?.endEdit(exit, { rowId: from.rowId, columnId: from.key }, how)
|
|
10765
10783
|
} : {}
|
|
10766
10784
|
});
|
|
10785
|
+
const editingNow = useRef14(editing);
|
|
10786
|
+
editingNow.current = editing;
|
|
10787
|
+
const editingHandle = useMemo22(
|
|
10788
|
+
() => new Proxy({}, {
|
|
10789
|
+
get: (_target, key) => editingNow.current[key]
|
|
10790
|
+
}),
|
|
10791
|
+
[]
|
|
10792
|
+
);
|
|
10793
|
+
const rowVersion = useCallback16((row) => editingNow.current.rowSignature(row.id), []);
|
|
10767
10794
|
const undo = useGridUndo({ tableId, reload: records.reload, forget: editing.forget });
|
|
10768
10795
|
pushWritten.current = (write) => {
|
|
10769
10796
|
const field2 = (fields.data ?? []).find((f) => f.key === write.key);
|
|
@@ -10834,7 +10861,7 @@ function Grid({
|
|
|
10834
10861
|
const [selectedIds, setSelectedIds] = useState31([]);
|
|
10835
10862
|
const offerSelection = canWrite && (merged || tableActions.runnable.length > 0);
|
|
10836
10863
|
const [reordering, setReordering] = useState31(false);
|
|
10837
|
-
const chosenSummaries = localSummaries ?? presentation.summaries ??
|
|
10864
|
+
const chosenSummaries = localSummaries ?? presentation.summaries ?? NO_SUMMARIES;
|
|
10838
10865
|
const summaries = useColumnSummaries({ tableId, chosen: chosenSummaries, filter: question.filter, version: records.data });
|
|
10839
10866
|
const [duplicated, setDuplicated] = useState31(null);
|
|
10840
10867
|
const duplicate = useCallback16(
|
|
@@ -11283,7 +11310,7 @@ function Grid({
|
|
|
11283
11310
|
() => ordered.map(
|
|
11284
11311
|
(field2) => columnForField(
|
|
11285
11312
|
field2,
|
|
11286
|
-
canWrite ?
|
|
11313
|
+
canWrite ? editingHandle : null,
|
|
11287
11314
|
mayWriteRow,
|
|
11288
11315
|
whyNotRow,
|
|
11289
11316
|
{
|
|
@@ -11302,7 +11329,7 @@ function Grid({
|
|
|
11302
11329
|
[
|
|
11303
11330
|
ordered,
|
|
11304
11331
|
canWrite,
|
|
11305
|
-
|
|
11332
|
+
editingHandle,
|
|
11306
11333
|
mayWriteRow,
|
|
11307
11334
|
whyNotRow,
|
|
11308
11335
|
presentation.formats,
|
|
@@ -11314,9 +11341,34 @@ function Grid({
|
|
|
11314
11341
|
pinCell
|
|
11315
11342
|
]
|
|
11316
11343
|
);
|
|
11317
|
-
const
|
|
11318
|
-
() =>
|
|
11319
|
-
|
|
11344
|
+
const footerNow = useRef14({
|
|
11345
|
+
summaryCell: () => null,
|
|
11346
|
+
addLine: () => null
|
|
11347
|
+
});
|
|
11348
|
+
footerNow.current = {
|
|
11349
|
+
summaryCell: (columnId) => {
|
|
11350
|
+
const field2 = ordered.find((f) => f.key === columnId);
|
|
11351
|
+
if (!field2) return null;
|
|
11352
|
+
return /* @__PURE__ */ jsx42(
|
|
11353
|
+
SummaryCell,
|
|
11354
|
+
{
|
|
11355
|
+
field: field2,
|
|
11356
|
+
firstColumn: ordered[0]?.key === columnId,
|
|
11357
|
+
chosen: chosenSummaries[columnId],
|
|
11358
|
+
value: summaries.values[columnId],
|
|
11359
|
+
rowCount: summaries.rowCount,
|
|
11360
|
+
summaries,
|
|
11361
|
+
onChoose: (op2) => chooseSummary(columnId, op2)
|
|
11362
|
+
}
|
|
11363
|
+
);
|
|
11364
|
+
},
|
|
11365
|
+
addLine: () => /* @__PURE__ */ jsx42(AddRowLine, { onAdd: () => void addRowHere(), busy: added.busy })
|
|
11366
|
+
};
|
|
11367
|
+
const addColumnNow = useRef14(controls.addColumn);
|
|
11368
|
+
addColumnNow.current = controls.addColumn;
|
|
11369
|
+
const bodyColumns = useMemo22(
|
|
11370
|
+
() => withAddRowCells(
|
|
11371
|
+
withSummaryCells(
|
|
11320
11372
|
// THE ONE WAY A ROW OPENS ITS RECORD (VERIFIER-17): an Open control on the first cell,
|
|
11321
11373
|
// and Space on any cell. Absent when the host cannot open a record.
|
|
11322
11374
|
withOpenRecord(
|
|
@@ -11326,26 +11378,111 @@ function Grid({
|
|
|
11326
11378
|
// The merged grid's handle sits at the START of the row, where Airtable's expand sits.
|
|
11327
11379
|
merged ? "start" : "end"
|
|
11328
11380
|
),
|
|
11329
|
-
(columnId) =>
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11381
|
+
(columnId) => footerNow.current.summaryCell(columnId)
|
|
11382
|
+
),
|
|
11383
|
+
mayAddRow ? () => footerNow.current.addLine() : null
|
|
11384
|
+
),
|
|
11385
|
+
[fieldColumns, onOpenRecord, table.data, merged, mayAddRow]
|
|
11386
|
+
);
|
|
11387
|
+
const isRowSelectable = useCallback16((row) => row.id !== SUMMARY_ROW.id && mayWriteRow(row.id), [mayWriteRow]);
|
|
11388
|
+
const copyConfig = useMemo22(
|
|
11389
|
+
() => table.data ? gridCopyConfig({
|
|
11390
|
+
tableId,
|
|
11391
|
+
tableName: tableName(table.data),
|
|
11392
|
+
fields: ordered,
|
|
11393
|
+
rowLabel: (row) => recordNameIn(table.data, row.document ?? {})
|
|
11394
|
+
}) : null,
|
|
11395
|
+
[tableId, table.data, ordered]
|
|
11396
|
+
);
|
|
11397
|
+
const tableStyleProp = useMemo22(
|
|
11398
|
+
() => tableStyleIsEmpty2(paint.style) ? null : {
|
|
11399
|
+
style: paint.style,
|
|
11400
|
+
// A choice is read as its OPTION (`paintByOption`): the rule, the value and the
|
|
11401
|
+
// colour a column keeps for it all name the same option, however it is stored.
|
|
11402
|
+
documentOf: (row) => paint.documentOf(row.document ?? {}),
|
|
11403
|
+
// A value its column keeps a colour for wears THAT colour (`choiceLooks.ts`);
|
|
11404
|
+
// any other value still paints from its word.
|
|
11405
|
+
choiceColorFor: paint.choiceColorFor
|
|
11406
|
+
},
|
|
11407
|
+
[paint]
|
|
11408
|
+
);
|
|
11409
|
+
const rowActionsNow = useRef14({ runner, handToAgent, host, table: table.data, duplicate });
|
|
11410
|
+
rowActionsNow.current = { runner, handToAgent, host, table: table.data, duplicate };
|
|
11411
|
+
const offersRowActions = canWrite || Boolean(host.talkToRecord) || Boolean(host.runAgentAction && tableActions.agent.length > 0);
|
|
11412
|
+
const hasTalk = Boolean(host.talkToRecord);
|
|
11413
|
+
const hasAgent = Boolean(host.runAgentAction);
|
|
11414
|
+
const rowActions = useCallback16(
|
|
11415
|
+
(row) => /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
11416
|
+
canWrite && mayWriteRow(row.id) ? tableActions.runnable.map((action) => /* @__PURE__ */ jsx42(
|
|
11417
|
+
ActionButton,
|
|
11418
|
+
{
|
|
11419
|
+
action,
|
|
11420
|
+
busy: runner.busy === action.id,
|
|
11421
|
+
onPress: () => rowActionsNow.current.runner.press(action, [row.id])
|
|
11422
|
+
},
|
|
11423
|
+
action.id
|
|
11424
|
+
)) : null,
|
|
11425
|
+
host.runAgentAction ? tableActions.agent.map((action) => /* @__PURE__ */ jsx42(
|
|
11426
|
+
ActionButton,
|
|
11427
|
+
{
|
|
11428
|
+
action,
|
|
11429
|
+
busy: false,
|
|
11430
|
+
onPress: () => rowActionsNow.current.handToAgent(action, row)
|
|
11431
|
+
},
|
|
11432
|
+
action.id
|
|
11433
|
+
)) : null,
|
|
11434
|
+
host.talkToRecord ? /* @__PURE__ */ jsx42(
|
|
11435
|
+
Button27,
|
|
11436
|
+
{
|
|
11437
|
+
size: "sm",
|
|
11438
|
+
variant: "ghost",
|
|
11439
|
+
onClick: () => rowActionsNow.current.host.talkToRecord?.({
|
|
11440
|
+
tableId,
|
|
11441
|
+
recordId: row.id,
|
|
11442
|
+
// ONE NAMING CALL (`names.ts`), not this file's own join
|
|
11443
|
+
// of a Table's title column to a document.
|
|
11444
|
+
title: recordNameIn(
|
|
11445
|
+
rowActionsNow.current.table,
|
|
11446
|
+
row.document ?? {}
|
|
11447
|
+
)
|
|
11448
|
+
}),
|
|
11449
|
+
children: "Talk"
|
|
11450
|
+
}
|
|
11451
|
+
) : null,
|
|
11452
|
+
Boolean(editable) && rights.write ? /* @__PURE__ */ jsx42(
|
|
11453
|
+
Button27,
|
|
11454
|
+
{
|
|
11455
|
+
size: "sm",
|
|
11456
|
+
variant: "ghost",
|
|
11457
|
+
"data-records-duplicate": row.id,
|
|
11458
|
+
title: "Duplicate this record",
|
|
11459
|
+
onClick: (event) => {
|
|
11460
|
+
event.stopPropagation();
|
|
11461
|
+
void rowActionsNow.current.duplicate(row);
|
|
11462
|
+
},
|
|
11463
|
+
children: "Duplicate"
|
|
11464
|
+
}
|
|
11465
|
+
) : null,
|
|
11466
|
+
canWrite && mayWriteRow(row.id) ? /* @__PURE__ */ jsx42(
|
|
11467
|
+
Button27,
|
|
11468
|
+
{
|
|
11469
|
+
size: "sm",
|
|
11470
|
+
variant: "ghost",
|
|
11471
|
+
title: "Delete this record",
|
|
11472
|
+
onClick: () => setDeleting(row),
|
|
11473
|
+
children: "Delete"
|
|
11344
11474
|
}
|
|
11345
|
-
)
|
|
11346
|
-
|
|
11475
|
+
) : null
|
|
11476
|
+
] }),
|
|
11477
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- `hasTalk`/`hasAgent` stand for the host ports the JSX reads; handlers run through `rowActionsNow`.
|
|
11478
|
+
[canWrite, mayWriteRow, tableActions.runnable, tableActions.agent, runner.busy, hasTalk, hasAgent, editable, rights.write]
|
|
11479
|
+
);
|
|
11480
|
+
const columns = useMemo22(
|
|
11481
|
+
() => {
|
|
11482
|
+
const drawn = withHeaderMenus(bodyColumns, controls.headerMenuFor, controls.filterFor);
|
|
11483
|
+
return merged && rights.structure && editable ? [...drawn, addColumnColumn(() => addColumnNow.current())] : drawn;
|
|
11347
11484
|
},
|
|
11348
|
-
[
|
|
11485
|
+
[bodyColumns, controls.headerMenuFor, controls.filterFor, merged, rights.structure, editable]
|
|
11349
11486
|
);
|
|
11350
11487
|
const [localColumns, setLocalColumns] = useState31(
|
|
11351
11488
|
null
|
|
@@ -11579,7 +11716,8 @@ function Grid({
|
|
|
11579
11716
|
...fills ? { className: "min-h-0 flex-1" } : {},
|
|
11580
11717
|
data: rows,
|
|
11581
11718
|
columns,
|
|
11582
|
-
getRowId:
|
|
11719
|
+
getRowId: rowIdOf,
|
|
11720
|
+
rowVersion,
|
|
11583
11721
|
isLoading: nothingToShowYet,
|
|
11584
11722
|
isFetching: refreshing,
|
|
11585
11723
|
density: host.density ?? "condensed",
|
|
@@ -11605,20 +11743,13 @@ function Grid({
|
|
|
11605
11743
|
];
|
|
11606
11744
|
return footerRows.length > 0 ? { footerRows } : {};
|
|
11607
11745
|
})(),
|
|
11608
|
-
...
|
|
11609
|
-
copy: gridCopyConfig({
|
|
11610
|
-
tableId,
|
|
11611
|
-
tableName: tableName(table.data),
|
|
11612
|
-
fields: ordered,
|
|
11613
|
-
rowLabel: (row) => recordNameIn(table.data, row.document ?? {})
|
|
11614
|
-
})
|
|
11615
|
-
} : {},
|
|
11746
|
+
...copyConfig ? { copy: copyConfig } : {},
|
|
11616
11747
|
...offerSelection ? {
|
|
11617
11748
|
selection: {
|
|
11618
11749
|
selectedIds,
|
|
11619
11750
|
onSelectedIdsChange: setSelectedIds,
|
|
11620
11751
|
noun,
|
|
11621
|
-
isRowSelectable
|
|
11752
|
+
isRowSelectable,
|
|
11622
11753
|
actions: (_selected, ids) => /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
11623
11754
|
merged ? /* @__PURE__ */ jsx42(
|
|
11624
11755
|
BulkActions,
|
|
@@ -11714,85 +11845,9 @@ function Grid({
|
|
|
11714
11845
|
noun: "record",
|
|
11715
11846
|
...typeof records.data?.total === "number" ? { total: records.data.total } : {}
|
|
11716
11847
|
},
|
|
11717
|
-
|
|
11718
|
-
tableStyle: {
|
|
11719
|
-
style: paint.style,
|
|
11720
|
-
// A choice is read as its OPTION (`paintByOption`): the rule, the value and the
|
|
11721
|
-
// colour a column keeps for it all name the same option, however it is stored.
|
|
11722
|
-
documentOf: (row) => paint.documentOf(row.document ?? {}),
|
|
11723
|
-
// A value its column keeps a colour for wears THAT colour (`choiceLooks.ts`);
|
|
11724
|
-
// any other value still paints from its word.
|
|
11725
|
-
choiceColorFor: paint.choiceColorFor
|
|
11726
|
-
}
|
|
11727
|
-
} : {},
|
|
11848
|
+
...tableStyleProp ? { tableStyle: tableStyleProp } : {},
|
|
11728
11849
|
...onOpenRecord ? { onRowOpen: (row) => onOpenRecord(row.id) } : {},
|
|
11729
|
-
...
|
|
11730
|
-
// ABSENT, NEVER DEAD: a row this person may not delete carries no
|
|
11731
|
-
// Delete at all, rather than one that refuses when pressed — and a
|
|
11732
|
-
// deployment with no chat surface bound carries no Talk.
|
|
11733
|
-
rowActions: (row) => /* @__PURE__ */ jsxs36(Fragment15, { children: [
|
|
11734
|
-
canWrite && mayWriteRow(row.id) ? tableActions.runnable.map((action) => /* @__PURE__ */ jsx42(
|
|
11735
|
-
ActionButton,
|
|
11736
|
-
{
|
|
11737
|
-
action,
|
|
11738
|
-
busy: runner.busy === action.id,
|
|
11739
|
-
onPress: () => runner.press(action, [row.id])
|
|
11740
|
-
},
|
|
11741
|
-
action.id
|
|
11742
|
-
)) : null,
|
|
11743
|
-
host.runAgentAction ? tableActions.agent.map((action) => /* @__PURE__ */ jsx42(
|
|
11744
|
-
ActionButton,
|
|
11745
|
-
{
|
|
11746
|
-
action,
|
|
11747
|
-
busy: false,
|
|
11748
|
-
onPress: () => handToAgent(action, row)
|
|
11749
|
-
},
|
|
11750
|
-
action.id
|
|
11751
|
-
)) : null,
|
|
11752
|
-
host.talkToRecord ? /* @__PURE__ */ jsx42(
|
|
11753
|
-
Button27,
|
|
11754
|
-
{
|
|
11755
|
-
size: "sm",
|
|
11756
|
-
variant: "ghost",
|
|
11757
|
-
onClick: () => host.talkToRecord?.({
|
|
11758
|
-
tableId,
|
|
11759
|
-
recordId: row.id,
|
|
11760
|
-
// ONE NAMING CALL (`names.ts`), not this file's own join
|
|
11761
|
-
// of a Table's title column to a document.
|
|
11762
|
-
title: recordNameIn(
|
|
11763
|
-
table.data,
|
|
11764
|
-
row.document ?? {}
|
|
11765
|
-
)
|
|
11766
|
-
}),
|
|
11767
|
-
children: "Talk"
|
|
11768
|
-
}
|
|
11769
|
-
) : null,
|
|
11770
|
-
Boolean(editable) && rights.write ? /* @__PURE__ */ jsx42(
|
|
11771
|
-
Button27,
|
|
11772
|
-
{
|
|
11773
|
-
size: "sm",
|
|
11774
|
-
variant: "ghost",
|
|
11775
|
-
"data-records-duplicate": row.id,
|
|
11776
|
-
title: "Duplicate this record",
|
|
11777
|
-
onClick: (event) => {
|
|
11778
|
-
event.stopPropagation();
|
|
11779
|
-
void duplicate(row);
|
|
11780
|
-
},
|
|
11781
|
-
children: "Duplicate"
|
|
11782
|
-
}
|
|
11783
|
-
) : null,
|
|
11784
|
-
canWrite && mayWriteRow(row.id) ? /* @__PURE__ */ jsx42(
|
|
11785
|
-
Button27,
|
|
11786
|
-
{
|
|
11787
|
-
size: "sm",
|
|
11788
|
-
variant: "ghost",
|
|
11789
|
-
title: "Delete this record",
|
|
11790
|
-
onClick: () => setDeleting(row),
|
|
11791
|
-
children: "Delete"
|
|
11792
|
-
}
|
|
11793
|
-
) : null
|
|
11794
|
-
] })
|
|
11795
|
-
} : {},
|
|
11850
|
+
...offersRowActions ? { rowActions } : {},
|
|
11796
11851
|
emptyState: emptyWords({
|
|
11797
11852
|
error: records.error,
|
|
11798
11853
|
asked: questionIsAsked({ search: query.search, columnFilters: query.columnFilters, filter }),
|
|
@@ -26424,6 +26479,7 @@ function useEmbedHandshake(args) {
|
|
|
26424
26479
|
}
|
|
26425
26480
|
|
|
26426
26481
|
// src/RecordsMount.tsx
|
|
26482
|
+
import { useRef as useRef26 } from "react";
|
|
26427
26483
|
import { RecordsProvider } from "@ai-matrx/records/react";
|
|
26428
26484
|
import { jsx as jsx91 } from "react/jsx-runtime";
|
|
26429
26485
|
var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
|
|
@@ -26436,10 +26492,26 @@ function RecordsMount({
|
|
|
26436
26492
|
letTheStoreDecideRights,
|
|
26437
26493
|
children
|
|
26438
26494
|
}) {
|
|
26439
|
-
const bound =
|
|
26495
|
+
const bound = useShallowStableHost(host);
|
|
26440
26496
|
void letTheStoreDecideRights;
|
|
26441
26497
|
return /* @__PURE__ */ jsx91(RecordsProvider, { config, children: /* @__PURE__ */ jsx91(RecordsUiProvider, { value: bound, children: /* @__PURE__ */ jsx91(RecordLabelProvider, { children }) }) });
|
|
26442
26498
|
}
|
|
26499
|
+
function useShallowStableHost(host) {
|
|
26500
|
+
const held = useRef26(null);
|
|
26501
|
+
const next = host ?? {};
|
|
26502
|
+
const previous = held.current;
|
|
26503
|
+
if (previous !== null && sameParts(previous, next)) return previous;
|
|
26504
|
+
const bound = { ...next };
|
|
26505
|
+
held.current = bound;
|
|
26506
|
+
return bound;
|
|
26507
|
+
}
|
|
26508
|
+
function sameParts(a, b) {
|
|
26509
|
+
const aKeys = Object.keys(a);
|
|
26510
|
+
const bKeys = Object.keys(b);
|
|
26511
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
26512
|
+
for (const key of aKeys) if (a[key] !== b[key]) return false;
|
|
26513
|
+
return true;
|
|
26514
|
+
}
|
|
26443
26515
|
function personActor(userId) {
|
|
26444
26516
|
return userId ? { actor: "user", user_id: userId } : { actor: "user" };
|
|
26445
26517
|
}
|
|
@@ -27042,7 +27114,7 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, classNa
|
|
|
27042
27114
|
}
|
|
27043
27115
|
|
|
27044
27116
|
// src/TablePage.tsx
|
|
27045
|
-
import { useCallback as useCallback51, useEffect as useEffect72, useRef as
|
|
27117
|
+
import { useCallback as useCallback51, useEffect as useEffect72, useRef as useRef27, useState as useState84 } from "react";
|
|
27046
27118
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
27047
27119
|
import { useFields as useFields26, useRecordsClient as useRecordsClient64, useTable as useTable24 } from "@ai-matrx/records/react";
|
|
27048
27120
|
import {
|
|
@@ -27684,7 +27756,7 @@ function TablePage({
|
|
|
27684
27756
|
lookDiffers: view ? lookDiffers(view, look) : false
|
|
27685
27757
|
};
|
|
27686
27758
|
const shownSignature = JSON.stringify(shownReport);
|
|
27687
|
-
const reportRef =
|
|
27759
|
+
const reportRef = useRef27(onShownViewChange);
|
|
27688
27760
|
reportRef.current = onShownViewChange;
|
|
27689
27761
|
useEffect72(() => {
|
|
27690
27762
|
reportRef.current?.(JSON.parse(shownSignature));
|