@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/dist/index.js
CHANGED
|
@@ -5179,6 +5179,7 @@ var EMBEDDED_TABLE_CLASS = [
|
|
|
5179
5179
|
"[&_thead_th:last-child]:border-r-0"
|
|
5180
5180
|
].join(" ");
|
|
5181
5181
|
var EMBEDDED_PLAIN_FOOTER_CLASS = "[&_tfoot]:bg-transparent [&_tfoot]:border-t-0";
|
|
5182
|
+
var EMBEDDED_PAGE_SIZE = 50;
|
|
5182
5183
|
|
|
5183
5184
|
// src/enumLabels.ts
|
|
5184
5185
|
function exhaustiveValuesOf() {
|
|
@@ -13318,7 +13319,7 @@ function backLinkSentence(column, readers = [], tableName2 = null) {
|
|
|
13318
13319
|
}
|
|
13319
13320
|
|
|
13320
13321
|
// src/Grid.tsx
|
|
13321
|
-
import { Button as Button42, ConfirmDialog as ConfirmDialog5, cn as cn34, useIsMobile } from "@ai-matrx/design-system";
|
|
13322
|
+
import { Button as Button42, ConfirmDialog as ConfirmDialog5, TapTargetSearchGroup, cn as cn34, useIsMobile } from "@ai-matrx/design-system";
|
|
13322
13323
|
|
|
13323
13324
|
// src/gridAddRow.tsx
|
|
13324
13325
|
import { useCallback as useCallback16, useEffect as useEffect34, useMemo as useMemo22, useRef as useRef23, useState as useState43 } from "react";
|
|
@@ -21099,7 +21100,9 @@ function GridBody({
|
|
|
21099
21100
|
onAskWhoChanged,
|
|
21100
21101
|
embedded = false,
|
|
21101
21102
|
newRowLabel,
|
|
21102
|
-
sortOverride
|
|
21103
|
+
sortOverride,
|
|
21104
|
+
searchOverride,
|
|
21105
|
+
onSearchChange
|
|
21103
21106
|
}) {
|
|
21104
21107
|
const toolbarSlot = useTableToolbarSlot();
|
|
21105
21108
|
const tableCard = useMatrxTableCard();
|
|
@@ -21176,6 +21179,14 @@ function GridBody({
|
|
|
21176
21179
|
page: 1
|
|
21177
21180
|
}));
|
|
21178
21181
|
}, [overrideKey]);
|
|
21182
|
+
const overrideSearchSeen = useRef29(void 0);
|
|
21183
|
+
useEffect47(() => {
|
|
21184
|
+
if (searchOverride === void 0) return;
|
|
21185
|
+
const wanted = searchOverride ?? "";
|
|
21186
|
+
if (overrideSearchSeen.current === wanted) return;
|
|
21187
|
+
overrideSearchSeen.current = wanted;
|
|
21188
|
+
setQuery((held) => held.search === wanted ? held : { ...held, search: wanted, page: 1 });
|
|
21189
|
+
}, [searchOverride]);
|
|
21179
21190
|
const reportQuery = address?.report;
|
|
21180
21191
|
useEffect47(() => {
|
|
21181
21192
|
if (!reportQuery) return;
|
|
@@ -21259,7 +21270,32 @@ function GridBody({
|
|
|
21259
21270
|
filter: readFilter ?? null,
|
|
21260
21271
|
version: records.data
|
|
21261
21272
|
});
|
|
21262
|
-
const
|
|
21273
|
+
const embeddedMore = embedded && storePaged;
|
|
21274
|
+
const [appendedRows, setAppendedRows] = useState59([]);
|
|
21275
|
+
const [appending, setAppending] = useState59(false);
|
|
21276
|
+
const askKey2 = JSON.stringify([tableId, searchTerm, pageSort, readFilter ?? null, viewId]);
|
|
21277
|
+
useEffect47(() => setAppendedRows([]), [askKey2]);
|
|
21278
|
+
const pageRows = useMemo35(() => {
|
|
21279
|
+
if (manual && !storePaged) return hand.rows ?? [];
|
|
21280
|
+
if (!embeddedMore || appendedRows.length === 0) return storeRows;
|
|
21281
|
+
const seen = new Set(storeRows.map((row) => row.id));
|
|
21282
|
+
return [...storeRows, ...appendedRows.filter((row) => !seen.has(row.id))];
|
|
21283
|
+
}, [manual, storePaged, hand.rows, storeRows, embeddedMore, appendedRows]);
|
|
21284
|
+
const showMoreRows = useCallback25(async () => {
|
|
21285
|
+
if (appending || !embeddedMore) return;
|
|
21286
|
+
setAppending(true);
|
|
21287
|
+
const asked3 = await client.listPage({
|
|
21288
|
+
table_id: tableId,
|
|
21289
|
+
...readFilter ? { filter: readFilter } : {},
|
|
21290
|
+
search: searchTerm.trim() === "" ? null : searchTerm.trim(),
|
|
21291
|
+
sort: pageSort,
|
|
21292
|
+
view_id: manual && pageSort.length === 0 ? viewId : null,
|
|
21293
|
+
limit: EMBEDDED_PAGE_SIZE,
|
|
21294
|
+
offset: pageRows.length
|
|
21295
|
+
});
|
|
21296
|
+
setAppending(false);
|
|
21297
|
+
if (asked3.ok) setAppendedRows((held) => [...held, ...asked3.data.rows]);
|
|
21298
|
+
}, [appending, embeddedMore, client, tableId, readFilter, searchTerm, pageSort, manual, viewId, pageRows.length]);
|
|
21263
21299
|
const added = useAddedRows({
|
|
21264
21300
|
tableId,
|
|
21265
21301
|
enabled: merged,
|
|
@@ -22439,6 +22475,21 @@ function GridBody({
|
|
|
22439
22475
|
const tableToolbar = useMemo35(
|
|
22440
22476
|
() => ({
|
|
22441
22477
|
search: !embedded,
|
|
22478
|
+
// EMBEDDED: Notion's magnifier — the design system's own search group, a button that
|
|
22479
|
+
// opens into a field. It is the same `query.search` the store's read asks.
|
|
22480
|
+
...embedded ? {
|
|
22481
|
+
customSearch: /* @__PURE__ */ jsx68(
|
|
22482
|
+
TapTargetSearchGroup,
|
|
22483
|
+
{
|
|
22484
|
+
placeholder: "Search",
|
|
22485
|
+
value: searchOverride ?? query.search,
|
|
22486
|
+
onValueChange: (term) => {
|
|
22487
|
+
setQuery((held) => ({ ...held, search: term, page: 1 }));
|
|
22488
|
+
onSearchChange?.(term);
|
|
22489
|
+
}
|
|
22490
|
+
}
|
|
22491
|
+
)
|
|
22492
|
+
} : {},
|
|
22442
22493
|
// The host (Spaces) has its own Properties menu: an embedded table draws no Columns button.
|
|
22443
22494
|
...embedded ? { columns: false } : {},
|
|
22444
22495
|
searchPlaceholder: "Search records",
|
|
@@ -22639,7 +22690,9 @@ function GridBody({
|
|
|
22639
22690
|
sheetExtras,
|
|
22640
22691
|
tableId,
|
|
22641
22692
|
noun,
|
|
22642
|
-
embedded
|
|
22693
|
+
embedded,
|
|
22694
|
+
searchOverride,
|
|
22695
|
+
onSearchChange
|
|
22643
22696
|
]
|
|
22644
22697
|
);
|
|
22645
22698
|
const labelOfField = useCallback25(
|
|
@@ -22845,7 +22898,7 @@ function GridBody({
|
|
|
22845
22898
|
pageSize,
|
|
22846
22899
|
query: tableQuery,
|
|
22847
22900
|
...valueFacets ? { facets: valueFacets, filterUi: VALUE_FILTER_UI } : {},
|
|
22848
|
-
...classicInCard ? { hidePagination: true } : {},
|
|
22901
|
+
...classicInCard || embeddedMore ? { hidePagination: true } : {},
|
|
22849
22902
|
...embedded ? { appearance: "embedded" } : {},
|
|
22850
22903
|
tableClassName: cn34(
|
|
22851
22904
|
!look.wrap && "[&_tbody_td]:max-w-[28rem] [&_tbody_td]:overflow-hidden [&_tbody_td]:text-ellipsis [&_tbody_td]:whitespace-nowrap! [&_tbody_td_*]:whitespace-nowrap!",
|
|
@@ -22950,7 +23003,15 @@ function GridBody({
|
|
|
22950
23003
|
onShowMore: () => setCardExtraRows((extra) => extra + pageSize)
|
|
22951
23004
|
}
|
|
22952
23005
|
) : null
|
|
22953
|
-
) :
|
|
23006
|
+
) : embeddedMore ? typeof records.data?.total === "number" && records.data.total > pageRows.length ? /* @__PURE__ */ jsx68(
|
|
23007
|
+
MatrxTableCardShowMore,
|
|
23008
|
+
{
|
|
23009
|
+
shown: pageRows.length,
|
|
23010
|
+
total: records.data.total,
|
|
23011
|
+
busy: appending,
|
|
23012
|
+
onShowMore: () => void showMoreRows()
|
|
23013
|
+
}
|
|
23014
|
+
) : null : storePaged || embedded ? null : /* @__PURE__ */ jsx68(
|
|
22954
23015
|
Pager,
|
|
22955
23016
|
{
|
|
22956
23017
|
page,
|
|
@@ -23101,14 +23162,18 @@ import { MatrxTableCard, MatrxTableCardEmpty, TABLE_CARD_DEFAULT_INITIAL_ROWS }
|
|
|
23101
23162
|
import { useFields as useFields9, useOptionalRecordsClient as useOptionalRecordsClient9, useTable as useTable7 } from "@ai-matrx/records/react";
|
|
23102
23163
|
|
|
23103
23164
|
// src/entitySource.tsx
|
|
23104
|
-
import { useCallback as useCallback26, useEffect as useEffect48, useMemo as useMemo36, useState as useState60 } from "react";
|
|
23165
|
+
import { useCallback as useCallback26, useEffect as useEffect48, useMemo as useMemo36, useRef as useRef30, useState as useState60 } from "react";
|
|
23105
23166
|
import { MatrxDataTable as MatrxDataTable2 } from "@ai-matrx/design-system/data-table";
|
|
23106
23167
|
import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
|
|
23107
23168
|
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
23108
23169
|
function useEntitySource(token, options = {}) {
|
|
23109
23170
|
const client = useRecordsClient38();
|
|
23110
23171
|
const limit = options.limit ?? 50;
|
|
23172
|
+
const search = (options.search ?? "").trim();
|
|
23111
23173
|
const [tick, setTick] = useState60(0);
|
|
23174
|
+
const held = useRef30(0);
|
|
23175
|
+
const askedSearch = useRef30("");
|
|
23176
|
+
const [loadingMore, setLoadingMore] = useState60(false);
|
|
23112
23177
|
const [state, setState] = useState60({
|
|
23113
23178
|
label: null,
|
|
23114
23179
|
columns: [],
|
|
@@ -23120,8 +23185,12 @@ function useEntitySource(token, options = {}) {
|
|
|
23120
23185
|
});
|
|
23121
23186
|
useEffect48(() => {
|
|
23122
23187
|
let cancelled = false;
|
|
23188
|
+
if (askedSearch.current !== search) {
|
|
23189
|
+
askedSearch.current = search;
|
|
23190
|
+
held.current = 0;
|
|
23191
|
+
}
|
|
23123
23192
|
const source = { kind: "entity", token };
|
|
23124
|
-
void Promise.all([client.drillDescribe({ source }), client.drillRows({ source, limit })]).then(
|
|
23193
|
+
void Promise.all([client.drillDescribe({ source }), client.drillRows({ source, limit: Math.max(limit, held.current), ...search ? { search } : {} })]).then(
|
|
23125
23194
|
([def, page]) => {
|
|
23126
23195
|
if (cancelled) return;
|
|
23127
23196
|
if (!def.ok) return setState((s) => ({ ...s, loading: false, error: refusalSentence(def.error) || "This table could not be read." }));
|
|
@@ -23129,6 +23198,7 @@ function useEntitySource(token, options = {}) {
|
|
|
23129
23198
|
const api = def.data.api;
|
|
23130
23199
|
const shown4 = new Set(page.data.columns instanceof Array ? page.data.columns.filter((c) => typeof c === "string") : []);
|
|
23131
23200
|
const columns = (api?.columns ?? []).filter((c) => c.api_name !== "id" && (shown4.size === 0 || shown4.has(c.api_name) || shown4.has(c.lookup?.via ?? "")));
|
|
23201
|
+
held.current = (page.data.rows ?? []).length;
|
|
23132
23202
|
setState({
|
|
23133
23203
|
label: api?.label ?? def.data.label ?? token,
|
|
23134
23204
|
columns,
|
|
@@ -23146,7 +23216,7 @@ function useEntitySource(token, options = {}) {
|
|
|
23146
23216
|
return () => {
|
|
23147
23217
|
cancelled = true;
|
|
23148
23218
|
};
|
|
23149
|
-
}, [client, token, limit, tick]);
|
|
23219
|
+
}, [client, token, limit, tick, search]);
|
|
23150
23220
|
const reload = useCallback26(() => setTick((t) => t + 1), []);
|
|
23151
23221
|
const write = useCallback26(
|
|
23152
23222
|
async (rowId, apiName, value) => {
|
|
@@ -23172,7 +23242,22 @@ function useEntitySource(token, options = {}) {
|
|
|
23172
23242
|
},
|
|
23173
23243
|
[client, token]
|
|
23174
23244
|
);
|
|
23175
|
-
|
|
23245
|
+
const loadMore = useCallback26(async () => {
|
|
23246
|
+
if (loadingMore) return;
|
|
23247
|
+
setLoadingMore(true);
|
|
23248
|
+
const source = { kind: "entity", token };
|
|
23249
|
+
const next = await client.drillRows({ source, limit, offset: held.current, ...search ? { search } : {} });
|
|
23250
|
+
setLoadingMore(false);
|
|
23251
|
+
if (!next.ok) return;
|
|
23252
|
+
const more = next.data.rows ?? [];
|
|
23253
|
+
held.current += more.length;
|
|
23254
|
+
setState((s) => {
|
|
23255
|
+
const seen = new Set(s.rows.map((r) => r.id));
|
|
23256
|
+
return { ...s, rows: [...s.rows, ...more.filter((r) => !seen.has(r.id))] };
|
|
23257
|
+
});
|
|
23258
|
+
}, [client, token, limit, loadingMore, search]);
|
|
23259
|
+
const hasMore = !state.loading && state.total > state.rows.length;
|
|
23260
|
+
return { ...state, write, create, reload, loadMore, hasMore, loadingMore };
|
|
23176
23261
|
}
|
|
23177
23262
|
function entityValueText(column, v) {
|
|
23178
23263
|
if (v === null || v === void 0 || v === "") return "";
|
|
@@ -23202,7 +23287,7 @@ function entityTableColumns(columns) {
|
|
|
23202
23287
|
...c.type === "choice" && c.choices ? { filter: "select", filterOptions: c.choices.map((w) => ({ value: w, label: w })) } : {}
|
|
23203
23288
|
}));
|
|
23204
23289
|
}
|
|
23205
|
-
function EntityGrid({ entity, pageSize, drill }) {
|
|
23290
|
+
function EntityGrid({ entity, pageSize, drill, embedded }) {
|
|
23206
23291
|
const columns = useMemo36(() => entityTableColumns(entity.columns), [entity.columns]);
|
|
23207
23292
|
return /* @__PURE__ */ jsx69(
|
|
23208
23293
|
MatrxDataTable2,
|
|
@@ -23212,7 +23297,8 @@ function EntityGrid({ entity, pageSize, drill }) {
|
|
|
23212
23297
|
getRowId: (row) => String(row.id),
|
|
23213
23298
|
isLoading: entity.loading,
|
|
23214
23299
|
...pageSize ? { pageSize } : {},
|
|
23215
|
-
...drill ? { drill } : {}
|
|
23300
|
+
...drill ? { drill } : {},
|
|
23301
|
+
...embedded ? { appearance: "embedded", hidePagination: true } : {}
|
|
23216
23302
|
}
|
|
23217
23303
|
);
|
|
23218
23304
|
}
|
|
@@ -23807,7 +23893,7 @@ import { Badge as Badge11, Button as Button48, Skeleton as Skeleton5, cn as cn39
|
|
|
23807
23893
|
|
|
23808
23894
|
// src/BookingBuilder.tsx
|
|
23809
23895
|
import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
|
|
23810
|
-
import { useCallback as useCallback28, useEffect as useEffect51, useMemo as useMemo38, useRef as
|
|
23896
|
+
import { useCallback as useCallback28, useEffect as useEffect51, useMemo as useMemo38, useRef as useRef31, useState as useState63 } from "react";
|
|
23811
23897
|
import { useFields as useFields11, useRecordsClient as useRecordsClient41, useTable as useTable9 } from "@ai-matrx/records/react";
|
|
23812
23898
|
import { formatDurationMinutes } from "@ai-matrx/kit/format";
|
|
23813
23899
|
import {
|
|
@@ -23944,7 +24030,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
23944
24030
|
const [confirmation, setConfirmation] = useState63("");
|
|
23945
24031
|
const [offer, setOffer] = useState63(null);
|
|
23946
24032
|
const [formId, setFormId] = useState63(bookingId ?? null);
|
|
23947
|
-
const madeRef =
|
|
24033
|
+
const madeRef = useRef31(null);
|
|
23948
24034
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
23949
24035
|
const askable = useMemo38(
|
|
23950
24036
|
() => askableFields(fields.data ?? [], STORE_ANSWERS_THESE),
|
|
@@ -24014,7 +24100,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
24014
24100
|
}),
|
|
24015
24101
|
[timezone, minutes, buffer, lead, perDay, days, windows]
|
|
24016
24102
|
);
|
|
24017
|
-
const startedAsking =
|
|
24103
|
+
const startedAsking = useRef31(false);
|
|
24018
24104
|
useEffect51(() => {
|
|
24019
24105
|
if (startedAsking.current || !loaded || existing || formId || !fields.data) return;
|
|
24020
24106
|
startedAsking.current = true;
|
|
@@ -26354,7 +26440,7 @@ function Clause({
|
|
|
26354
26440
|
}
|
|
26355
26441
|
|
|
26356
26442
|
// src/TableRename.tsx
|
|
26357
|
-
import { useCallback as useCallback33, useEffect as useEffect57, useRef as
|
|
26443
|
+
import { useCallback as useCallback33, useEffect as useEffect57, useRef as useRef32, useState as useState70 } from "react";
|
|
26358
26444
|
import { tableShapeChanged as tableShapeChanged6, useRecordsClient as useRecordsClient48 } from "@ai-matrx/records/react";
|
|
26359
26445
|
import {
|
|
26360
26446
|
Button as Button53,
|
|
@@ -26376,7 +26462,7 @@ function tableNameProblem(typed2) {
|
|
|
26376
26462
|
}
|
|
26377
26463
|
function useRenameFromMenu() {
|
|
26378
26464
|
const [open, setOpen] = useState70(false);
|
|
26379
|
-
const asked3 =
|
|
26465
|
+
const asked3 = useRef32(false);
|
|
26380
26466
|
const ask = useCallback33(() => {
|
|
26381
26467
|
asked3.current = true;
|
|
26382
26468
|
window.setTimeout(() => setOpen(true), 0);
|
|
@@ -26402,8 +26488,8 @@ function TableRenameDialog({
|
|
|
26402
26488
|
const [typed2, setTyped] = useState70(name);
|
|
26403
26489
|
const [busy, setBusy] = useState70(false);
|
|
26404
26490
|
const [refused, setRefused] = useState70(null);
|
|
26405
|
-
const box =
|
|
26406
|
-
const openedAt =
|
|
26491
|
+
const box = useRef32(null);
|
|
26492
|
+
const openedAt = useRef32(null);
|
|
26407
26493
|
useEffect57(() => {
|
|
26408
26494
|
if (!open) return;
|
|
26409
26495
|
openedAt.current = readTableVersionNow(client, tableId);
|
|
@@ -26495,7 +26581,7 @@ function TableRenameDialog({
|
|
|
26495
26581
|
}
|
|
26496
26582
|
|
|
26497
26583
|
// src/TableSettings.tsx
|
|
26498
|
-
import { useEffect as useEffect62, useRef as
|
|
26584
|
+
import { useEffect as useEffect62, useRef as useRef33, useState as useState76 } from "react";
|
|
26499
26585
|
|
|
26500
26586
|
// src/ArchiveDeliberately.tsx
|
|
26501
26587
|
import { useState as useState71 } from "react";
|
|
@@ -27140,8 +27226,8 @@ function TableSettings({
|
|
|
27140
27226
|
live = false;
|
|
27141
27227
|
};
|
|
27142
27228
|
}, [tableId]);
|
|
27143
|
-
const askToArchiveRef =
|
|
27144
|
-
const archiveAskedSeen =
|
|
27229
|
+
const askToArchiveRef = useRef33(null);
|
|
27230
|
+
const archiveAskedSeen = useRef33(0);
|
|
27145
27231
|
const panelReady = Boolean(table.data && fields.data && rights.structure);
|
|
27146
27232
|
useEffect62(() => {
|
|
27147
27233
|
const ask = askToArchiveRef.current;
|
|
@@ -27547,7 +27633,7 @@ function ShareForSomebodyElse({
|
|
|
27547
27633
|
}
|
|
27548
27634
|
|
|
27549
27635
|
// src/RecordBody.tsx
|
|
27550
|
-
import { useEffect as useEffect65, useRef as
|
|
27636
|
+
import { useEffect as useEffect65, useRef as useRef34, useState as useState79 } from "react";
|
|
27551
27637
|
import { Button as Button60, cn as cn46 } from "@ai-matrx/design-system";
|
|
27552
27638
|
import { newerKindOf as newerKindOf5 } from "@ai-matrx/records";
|
|
27553
27639
|
import { tableShapeChanged as tableShapeChanged10, useFieldMutation as useFieldMutation5, useFields as useFields14, useRecord as useRecord2, useRecordsClient as useRecordsClient55, useTable as useTable12 } from "@ai-matrx/records/react";
|
|
@@ -27584,9 +27670,9 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
|
|
|
27584
27670
|
const raw = record.data?.document?.[field2.key];
|
|
27585
27671
|
const stored = typeof raw === "string" ? raw : "";
|
|
27586
27672
|
const [saving, setSaving] = useState79({ phase: "idle" });
|
|
27587
|
-
const lastSaved =
|
|
27588
|
-
const waiting =
|
|
27589
|
-
const timer =
|
|
27673
|
+
const lastSaved = useRef34(null);
|
|
27674
|
+
const waiting = useRef34(null);
|
|
27675
|
+
const timer = useRef34(null);
|
|
27590
27676
|
if (lastSaved.current === null && record.data) lastSaved.current = stored;
|
|
27591
27677
|
const write = async () => {
|
|
27592
27678
|
if (timer.current) clearTimeout(timer.current);
|
|
@@ -27607,7 +27693,7 @@ function BodyEditor({ tableId, recordId, field: field2 }) {
|
|
|
27607
27693
|
setSaving({ phase: "refused", error: answered.error });
|
|
27608
27694
|
}
|
|
27609
27695
|
};
|
|
27610
|
-
const writeRef =
|
|
27696
|
+
const writeRef = useRef34(write);
|
|
27611
27697
|
writeRef.current = write;
|
|
27612
27698
|
useEffect65(
|
|
27613
27699
|
() => () => {
|
|
@@ -28026,7 +28112,7 @@ import {
|
|
|
28026
28112
|
import { formatCount as formatCount3 } from "@ai-matrx/kit/format";
|
|
28027
28113
|
|
|
28028
28114
|
// src/Pipeline.tsx
|
|
28029
|
-
import { useCallback as useCallback36, useEffect as useEffect67, useMemo as useMemo47, useRef as
|
|
28115
|
+
import { useCallback as useCallback36, useEffect as useEffect67, useMemo as useMemo47, useRef as useRef35, useState as useState83 } from "react";
|
|
28030
28116
|
import {
|
|
28031
28117
|
mayDrag,
|
|
28032
28118
|
useFields as useFields17,
|
|
@@ -28377,9 +28463,9 @@ function PipelineBoard({
|
|
|
28377
28463
|
const [waiting, setWaiting] = useState83(/* @__PURE__ */ new Map());
|
|
28378
28464
|
const [dragging, setDragging] = useState83(null);
|
|
28379
28465
|
const [over, setOver] = useState83(null);
|
|
28380
|
-
const alive =
|
|
28466
|
+
const alive = useRef35(true);
|
|
28381
28467
|
const [selected, setSelected] = useState83(/* @__PURE__ */ new Set());
|
|
28382
|
-
const anchor =
|
|
28468
|
+
const anchor = useRef35(null);
|
|
28383
28469
|
const [batch, setBatch] = useState83(/* @__PURE__ */ new Map());
|
|
28384
28470
|
const [batchSaid, setBatchSaid] = useState83(null);
|
|
28385
28471
|
const [batchError, setBatchError] = useState83(null);
|
|
@@ -28413,7 +28499,7 @@ function PipelineBoard({
|
|
|
28413
28499
|
void reload();
|
|
28414
28500
|
}, [reload]);
|
|
28415
28501
|
const versions = useRecordVersions(client, rows, (r) => mayDrag(r.level));
|
|
28416
|
-
const versionsRef =
|
|
28502
|
+
const versionsRef = useRef35(versions);
|
|
28417
28503
|
versionsRef.current = versions;
|
|
28418
28504
|
const drawnVersion = (id) => versionsRef.current.seen(id);
|
|
28419
28505
|
const stageKey = definition?.stage_field ?? null;
|
|
@@ -29002,13 +29088,13 @@ function batchSentence(moved, waiting, notMoved, label) {
|
|
|
29002
29088
|
}
|
|
29003
29089
|
|
|
29004
29090
|
// src/CalendarView.tsx
|
|
29005
|
-
import { useEffect as useEffect69, useMemo as useMemo50, useRef as
|
|
29091
|
+
import { useEffect as useEffect69, useMemo as useMemo50, useRef as useRef37, useState as useState85 } from "react";
|
|
29006
29092
|
import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
|
|
29007
29093
|
import { Button as Button64, Select as Select13, SelectContent as SelectContent13, SelectItem as SelectItem13, SelectTrigger as SelectTrigger13, SelectValue as SelectValue13, cn as cn50 } from "@ai-matrx/design-system";
|
|
29008
29094
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2 } from "@ai-matrx/design-system/data-table";
|
|
29009
29095
|
|
|
29010
29096
|
// src/recordMoves.tsx
|
|
29011
|
-
import { useCallback as useCallback37, useEffect as useEffect68, useMemo as useMemo48, useRef as
|
|
29097
|
+
import { useCallback as useCallback37, useEffect as useEffect68, useMemo as useMemo48, useRef as useRef36, useState as useState84 } from "react";
|
|
29012
29098
|
import { useRecordsClient as useRecordsClient60 } from "@ai-matrx/records/react";
|
|
29013
29099
|
import { Button as Button63 } from "@ai-matrx/design-system";
|
|
29014
29100
|
import { Fragment as Fragment36, jsx as jsx98, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
@@ -29087,7 +29173,7 @@ function useRecordMoves({
|
|
|
29087
29173
|
[client, undo, onMoved]
|
|
29088
29174
|
);
|
|
29089
29175
|
const offering = Boolean(undo.notice);
|
|
29090
|
-
const undoRef =
|
|
29176
|
+
const undoRef = useRef36(undo);
|
|
29091
29177
|
undoRef.current = undo;
|
|
29092
29178
|
useEffect68(() => {
|
|
29093
29179
|
if (!offering || typeof document === "undefined") return;
|
|
@@ -29527,7 +29613,7 @@ function CalendarView({
|
|
|
29527
29613
|
}, [rows, dateField.key, endField?.key, placedOver, defaultMinutes]);
|
|
29528
29614
|
const titleOf = (row) => cardWords(row, titleField, labels).text;
|
|
29529
29615
|
const rowById = (id) => rows.find((r) => r.id === id);
|
|
29530
|
-
const frame =
|
|
29616
|
+
const frame = useRef37(null);
|
|
29531
29617
|
const [focusOn, setFocusOn] = useState85(null);
|
|
29532
29618
|
useEffect69(() => {
|
|
29533
29619
|
if (!focusOn) return;
|
|
@@ -29576,7 +29662,7 @@ function CalendarView({
|
|
|
29576
29662
|
const made = await moves.create({ tableId, data, label: `New record on ${where}` });
|
|
29577
29663
|
if (made) onOpenRecord?.(made);
|
|
29578
29664
|
};
|
|
29579
|
-
const grabOffset =
|
|
29665
|
+
const grabOffset = useRef37(0);
|
|
29580
29666
|
const [resizing, setResizing] = useState85(null);
|
|
29581
29667
|
const [ghost, setGhost] = useState85(null);
|
|
29582
29668
|
useEffect69(() => {
|
|
@@ -30125,7 +30211,7 @@ function WeekHours({
|
|
|
30125
30211
|
render,
|
|
30126
30212
|
overlay
|
|
30127
30213
|
}) {
|
|
30128
|
-
const frame =
|
|
30214
|
+
const frame = useRef37(null);
|
|
30129
30215
|
useEffect69(() => {
|
|
30130
30216
|
if (frame.current) frame.current.scrollTop = 7 * HOUR_PX;
|
|
30131
30217
|
}, []);
|
|
@@ -30172,7 +30258,7 @@ function weekHeading(first) {
|
|
|
30172
30258
|
}
|
|
30173
30259
|
|
|
30174
30260
|
// src/TimelineView.tsx
|
|
30175
|
-
import { useEffect as useEffect70, useMemo as useMemo51, useRef as
|
|
30261
|
+
import { useEffect as useEffect70, useMemo as useMemo51, useRef as useRef38, useState as useState86 } from "react";
|
|
30176
30262
|
import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
|
|
30177
30263
|
import { Button as Button65, Select as Select14, SelectContent as SelectContent14, SelectItem as SelectItem14, SelectTrigger as SelectTrigger14, SelectValue as SelectValue14, cn as cn51 } from "@ai-matrx/design-system";
|
|
30178
30264
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS3 } from "@ai-matrx/design-system/data-table";
|
|
@@ -30425,10 +30511,10 @@ function TimelineView({
|
|
|
30425
30511
|
const width = days * px;
|
|
30426
30512
|
const scale = useMemo51(() => scaleOf(from, days, zoom), [from, days, zoom]);
|
|
30427
30513
|
const xOf = (day) => daysBetween(from, day) * px;
|
|
30428
|
-
const scroller =
|
|
30514
|
+
const scroller = useRef38(null);
|
|
30429
30515
|
const grouped = Boolean(groupField);
|
|
30430
30516
|
const [scrollX, setScrollX] = useState86(0);
|
|
30431
|
-
const frame =
|
|
30517
|
+
const frame = useRef38(null);
|
|
30432
30518
|
const onScroll = () => {
|
|
30433
30519
|
if (frame.current !== null) return;
|
|
30434
30520
|
frame.current = requestAnimationFrame(() => {
|
|
@@ -31356,10 +31442,12 @@ function ViewSwitcher({
|
|
|
31356
31442
|
footer,
|
|
31357
31443
|
embedded,
|
|
31358
31444
|
sortOverride,
|
|
31445
|
+
searchOverride,
|
|
31446
|
+
onSearchChange,
|
|
31359
31447
|
newRowLabel,
|
|
31360
31448
|
className
|
|
31361
31449
|
}) {
|
|
31362
|
-
const pageSize = pageSizeAsked ?? (embedded ?
|
|
31450
|
+
const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 200);
|
|
31363
31451
|
const toolbarSlot = useTableToolbarSlot();
|
|
31364
31452
|
const [layout, setLayout] = useState89(view.layout);
|
|
31365
31453
|
const hostLayouts = useRecordsUi().layouts ?? [];
|
|
@@ -31421,6 +31509,8 @@ function ViewSwitcher({
|
|
|
31421
31509
|
...footer ? { footer } : {},
|
|
31422
31510
|
...embedded ? { embedded } : {},
|
|
31423
31511
|
...sortOverride !== void 0 ? { sortOverride } : {},
|
|
31512
|
+
...searchOverride !== void 0 ? { searchOverride } : {},
|
|
31513
|
+
...onSearchChange ? { onSearchChange } : {},
|
|
31424
31514
|
...newRowLabel ? { newRowLabel } : {},
|
|
31425
31515
|
...filter ? { filter } : {},
|
|
31426
31516
|
...onClearFilter ? { onClearFilter } : {},
|
|
@@ -32683,9 +32773,9 @@ import { useRecordsClient as useRecordsClient65 } from "@ai-matrx/records/react"
|
|
|
32683
32773
|
import { Badge as Badge14, Button as Button70, Input as Input6, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11, Skeleton as Skeleton14, cn as cn56 } from "@ai-matrx/design-system";
|
|
32684
32774
|
|
|
32685
32775
|
// src/seedOnce.ts
|
|
32686
|
-
import { useCallback as useCallback40, useRef as
|
|
32776
|
+
import { useCallback as useCallback40, useRef as useRef39 } from "react";
|
|
32687
32777
|
function useSeedGuard() {
|
|
32688
|
-
const claimed =
|
|
32778
|
+
const claimed = useRef39(/* @__PURE__ */ new Set());
|
|
32689
32779
|
return useCallback40((name) => {
|
|
32690
32780
|
if (claimed.current.has(name)) return false;
|
|
32691
32781
|
claimed.current.add(name);
|
|
@@ -33003,7 +33093,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
33003
33093
|
}
|
|
33004
33094
|
|
|
33005
33095
|
// src/ProposalRow.tsx
|
|
33006
|
-
import { useEffect as useEffect77, useRef as
|
|
33096
|
+
import { useEffect as useEffect77, useRef as useRef40, useState as useState93 } from "react";
|
|
33007
33097
|
import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
|
|
33008
33098
|
import { Badge as Badge15, Button as Button71, cn as cn57 } from "@ai-matrx/design-system";
|
|
33009
33099
|
import { jsx as jsx109, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
@@ -33021,7 +33111,7 @@ function ProposalRow({
|
|
|
33021
33111
|
const [settled, setSettled] = useState93(outcome ?? null);
|
|
33022
33112
|
const [busy, setBusy] = useState93(false);
|
|
33023
33113
|
const [confirming, setConfirming] = useState93(false);
|
|
33024
|
-
const drawnVersion =
|
|
33114
|
+
const drawnVersion = useRef40(null);
|
|
33025
33115
|
const needsVersion = change.act === "update" && Boolean(change.record) && change.version === void 0 && !onApply && !settled;
|
|
33026
33116
|
useEffect77(() => {
|
|
33027
33117
|
if (needsVersion && change.record && !drawnVersion.current) drawnVersion.current = readVersionNow(client, change.record);
|
|
@@ -33111,7 +33201,7 @@ function ProposalRow({
|
|
|
33111
33201
|
}
|
|
33112
33202
|
|
|
33113
33203
|
// src/ActionInbox.tsx
|
|
33114
|
-
import { useCallback as useCallback43, useEffect as useEffect79, useMemo as useMemo55, useRef as
|
|
33204
|
+
import { useCallback as useCallback43, useEffect as useEffect79, useMemo as useMemo55, useRef as useRef41, useState as useState95 } from "react";
|
|
33115
33205
|
import { useRecordsClient as useRecordsClient68 } from "@ai-matrx/records/react";
|
|
33116
33206
|
import { Badge as Badge17, Button as Button73, Checkbox as Checkbox11, Skeleton as Skeleton16, cn as cn59 } from "@ai-matrx/design-system";
|
|
33117
33207
|
import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
|
|
@@ -34016,9 +34106,9 @@ function ActionInbox({
|
|
|
34016
34106
|
const [outcome, setOutcome] = useState95({});
|
|
34017
34107
|
const [busy, setBusy] = useState95(null);
|
|
34018
34108
|
const [cursor, setCursor] = useState95(0);
|
|
34019
|
-
const listRef =
|
|
34109
|
+
const listRef = useRef41(null);
|
|
34020
34110
|
const [selected, setSelected] = useState95(/* @__PURE__ */ new Set());
|
|
34021
|
-
const anchor =
|
|
34111
|
+
const anchor = useRef41(null);
|
|
34022
34112
|
const [deciding, setDeciding] = useState95(false);
|
|
34023
34113
|
const [batchSaid, setBatchSaid] = useState95(null);
|
|
34024
34114
|
const [view, setView] = useState95("inbox");
|
|
@@ -34082,9 +34172,9 @@ function ActionInbox({
|
|
|
34082
34172
|
[client, load]
|
|
34083
34173
|
);
|
|
34084
34174
|
const [held, setHeld] = useState95({});
|
|
34085
|
-
const holds2 =
|
|
34086
|
-
const lastHold =
|
|
34087
|
-
const holdSeq =
|
|
34175
|
+
const holds2 = useRef41(/* @__PURE__ */ new Map());
|
|
34176
|
+
const lastHold = useRef41(null);
|
|
34177
|
+
const holdSeq = useRef41(0);
|
|
34088
34178
|
const [, tick] = useState95(0);
|
|
34089
34179
|
useEffect79(() => {
|
|
34090
34180
|
if (Object.keys(held).length === 0) return;
|
|
@@ -34141,7 +34231,7 @@ function ActionInbox({
|
|
|
34141
34231
|
flush();
|
|
34142
34232
|
};
|
|
34143
34233
|
}, []);
|
|
34144
|
-
const resumed =
|
|
34234
|
+
const resumed = useRef41(false);
|
|
34145
34235
|
useEffect79(() => {
|
|
34146
34236
|
if (resumed.current || items === null || view !== "inbox") return;
|
|
34147
34237
|
resumed.current = true;
|
|
@@ -34762,7 +34852,7 @@ function ActionInbox({
|
|
|
34762
34852
|
}
|
|
34763
34853
|
|
|
34764
34854
|
// src/HistoryPanel.tsx
|
|
34765
|
-
import { useCallback as useCallback44, useEffect as useEffect80, useRef as
|
|
34855
|
+
import { useCallback as useCallback44, useEffect as useEffect80, useRef as useRef42, useState as useState96 } from "react";
|
|
34766
34856
|
import {
|
|
34767
34857
|
useFields as useFields20,
|
|
34768
34858
|
useRecordChangeRevision,
|
|
@@ -34782,9 +34872,9 @@ function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
|
|
|
34782
34872
|
const [error, setError] = useState96(null);
|
|
34783
34873
|
const [open, setOpen] = useState96(null);
|
|
34784
34874
|
const [pending, setPending] = useState96({ phase: "idle" });
|
|
34785
|
-
const seenAtPreview =
|
|
34875
|
+
const seenAtPreview = useRef42(null);
|
|
34786
34876
|
const [said, setSaid] = useState96(null);
|
|
34787
|
-
const listRef =
|
|
34877
|
+
const listRef = useRef42(null);
|
|
34788
34878
|
const changed = useRecordChangeRevision(recordId);
|
|
34789
34879
|
const load = useCallback44(async () => {
|
|
34790
34880
|
const answered = await client.recordHistory({ record_id: recordId });
|
|
@@ -35077,7 +35167,7 @@ function say(value, field2) {
|
|
|
35077
35167
|
}
|
|
35078
35168
|
|
|
35079
35169
|
// src/CommentThread.tsx
|
|
35080
|
-
import { useCallback as useCallback45, useEffect as useEffect81, useMemo as useMemo56, useRef as
|
|
35170
|
+
import { useCallback as useCallback45, useEffect as useEffect81, useMemo as useMemo56, useRef as useRef43, useState as useState97 } from "react";
|
|
35081
35171
|
import {
|
|
35082
35172
|
useFields as useFields21,
|
|
35083
35173
|
useRecordsClient as useRecordsClient70,
|
|
@@ -35101,7 +35191,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
35101
35191
|
const [people, setPeople] = useState97([]);
|
|
35102
35192
|
const [mentionQuery, setMentionQuery] = useState97(null);
|
|
35103
35193
|
const [picked, setPicked] = useState97([]);
|
|
35104
|
-
const box =
|
|
35194
|
+
const box = useRef43(null);
|
|
35105
35195
|
const load = useCallback45(async () => {
|
|
35106
35196
|
const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
|
|
35107
35197
|
if (!answered.ok) {
|
|
@@ -35321,7 +35411,7 @@ function Line({
|
|
|
35321
35411
|
}
|
|
35322
35412
|
|
|
35323
35413
|
// src/FieldHistoryPanel.tsx
|
|
35324
|
-
import { useCallback as useCallback46, useEffect as useEffect82, useRef as
|
|
35414
|
+
import { useCallback as useCallback46, useEffect as useEffect82, useRef as useRef44, useState as useState98 } from "react";
|
|
35325
35415
|
import {
|
|
35326
35416
|
useFields as useFields22,
|
|
35327
35417
|
useRecordsClient as useRecordsClient71,
|
|
@@ -35345,7 +35435,7 @@ function FieldHistoryPanel({
|
|
|
35345
35435
|
const [rows, setRows] = useState98(null);
|
|
35346
35436
|
const [error, setError] = useState98(null);
|
|
35347
35437
|
const [pending, setPending] = useState98({ phase: "idle" });
|
|
35348
|
-
const seenAtPreview =
|
|
35438
|
+
const seenAtPreview = useRef44(null);
|
|
35349
35439
|
const [said, setSaid] = useState98(null);
|
|
35350
35440
|
const load = useCallback46(async () => {
|
|
35351
35441
|
const answered = await client.fieldHistory(
|
|
@@ -35593,7 +35683,7 @@ function submissionStamp(args) {
|
|
|
35593
35683
|
}
|
|
35594
35684
|
|
|
35595
35685
|
// src/PortalBuilder.tsx
|
|
35596
|
-
import { useCallback as useCallback47, useEffect as useEffect83, useMemo as useMemo57, useRef as
|
|
35686
|
+
import { useCallback as useCallback47, useEffect as useEffect83, useMemo as useMemo57, useRef as useRef45, useState as useState99 } from "react";
|
|
35597
35687
|
import { useRecordsClient as useRecordsClient72, useTables as useTables4 } from "@ai-matrx/records/react";
|
|
35598
35688
|
import { BasicInput as BasicInput23, Button as Button77, Checkbox as Checkbox12, Label as Label18, Separator as Separator10, Skeleton as Skeleton20, cn as cn63 } from "@ai-matrx/design-system";
|
|
35599
35689
|
import { Fragment as Fragment44, jsx as jsx115, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
@@ -35683,7 +35773,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
35683
35773
|
if (on) void loadFields(t.id);
|
|
35684
35774
|
}
|
|
35685
35775
|
const [linking, setLinking] = useState99(null);
|
|
35686
|
-
const linkingNow =
|
|
35776
|
+
const linkingNow = useRef45(null);
|
|
35687
35777
|
async function addLinkBack(id) {
|
|
35688
35778
|
const clients = (tables.data ?? []).find((t) => t.id === clientTableId);
|
|
35689
35779
|
if (!clientTableId || !clients) return;
|
|
@@ -35710,7 +35800,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
35710
35800
|
linkingNow.current = null;
|
|
35711
35801
|
setLinking(null);
|
|
35712
35802
|
}
|
|
35713
|
-
const autoLinked =
|
|
35803
|
+
const autoLinked = useRef45(/* @__PURE__ */ new Set());
|
|
35714
35804
|
useEffect83(() => {
|
|
35715
35805
|
if (linking !== null || !clientTableId) return;
|
|
35716
35806
|
for (const e of Object.values(exposures)) {
|
|
@@ -37931,7 +38021,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
37931
38021
|
|
|
37932
38022
|
// src/FormBuilder.tsx
|
|
37933
38023
|
import { ErrorBox as ErrorBox7 } from "@ai-matrx/design-system";
|
|
37934
|
-
import { useCallback as useCallback54, useEffect as useEffect91, useMemo as useMemo62, useRef as
|
|
38024
|
+
import { useCallback as useCallback54, useEffect as useEffect91, useMemo as useMemo62, useRef as useRef47, useState as useState107 } from "react";
|
|
37935
38025
|
import { useFields as useFields24, useRecordsClient as useRecordsClient79, useTable as useTable26 } from "@ai-matrx/records/react";
|
|
37936
38026
|
import { publicFormPath } from "@ai-matrx/records";
|
|
37937
38027
|
import {
|
|
@@ -37945,7 +38035,7 @@ import {
|
|
|
37945
38035
|
} from "@ai-matrx/design-system";
|
|
37946
38036
|
|
|
37947
38037
|
// src/FormRunner.tsx
|
|
37948
|
-
import { useCallback as useCallback52, useEffect as useEffect89, useMemo as useMemo61, useRef as
|
|
38038
|
+
import { useCallback as useCallback52, useEffect as useEffect89, useMemo as useMemo61, useRef as useRef46, useState as useState105 } from "react";
|
|
37949
38039
|
import { useFields as useFields23, useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
|
|
37950
38040
|
import { Button as Button83, Progress, Skeleton as Skeleton25, cn as cn72 } from "@ai-matrx/design-system";
|
|
37951
38041
|
import { humanizeIdentifier as humanizeIdentifier16 } from "@ai-matrx/kit/text-case";
|
|
@@ -38046,8 +38136,8 @@ function FormStage({
|
|
|
38046
38136
|
const [writing, setWriting] = useState105(false);
|
|
38047
38137
|
const [done, setDone] = useState105(null);
|
|
38048
38138
|
const [hidden, setHidden] = useState105({});
|
|
38049
|
-
const decoy =
|
|
38050
|
-
const stage =
|
|
38139
|
+
const decoy = useRef46("");
|
|
38140
|
+
const stage = useRef46(null);
|
|
38051
38141
|
const questions = useMemo61(() => {
|
|
38052
38142
|
const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
|
|
38053
38143
|
return (form.questions ?? []).map((q) => {
|
|
@@ -38108,13 +38198,13 @@ function FormStage({
|
|
|
38108
38198
|
};
|
|
38109
38199
|
}, [whichAsked, questions, answers]);
|
|
38110
38200
|
const live = questions.filter((q) => !hidden[q.key]);
|
|
38111
|
-
const told =
|
|
38201
|
+
const told = useRef46(answers);
|
|
38112
38202
|
useEffect89(() => {
|
|
38113
38203
|
if (told.current === answers) return;
|
|
38114
38204
|
told.current = answers;
|
|
38115
38205
|
onAnswersChange?.(answers);
|
|
38116
38206
|
}, [answers, onAnswersChange]);
|
|
38117
|
-
const resumeAt =
|
|
38207
|
+
const resumeAt = useRef46(
|
|
38118
38208
|
resumed && initialAnswers && Object.keys(initialAnswers).length > 0 ? questions.find((q) => {
|
|
38119
38209
|
const v = initialAnswers[q.key];
|
|
38120
38210
|
return v === void 0 || v === null || v === "";
|
|
@@ -38707,7 +38797,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
38707
38797
|
const [lookUnread, setLookUnread] = useState107(null);
|
|
38708
38798
|
const [restoredAt, setRestoredAt] = useState107(null);
|
|
38709
38799
|
const [adding, setAdding] = useState107(false);
|
|
38710
|
-
const keysBeforeAdd =
|
|
38800
|
+
const keysBeforeAdd = useRef47(null);
|
|
38711
38801
|
const [makeOnMount, setMakeOnMount] = useState107("waiting");
|
|
38712
38802
|
const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
|
|
38713
38803
|
const load = useCallback54(async () => {
|
|
@@ -39526,13 +39616,13 @@ function bucketWindow2(groupKey, value) {
|
|
|
39526
39616
|
import {
|
|
39527
39617
|
useEffect as useEffect92,
|
|
39528
39618
|
useId as useId3,
|
|
39529
|
-
useRef as
|
|
39619
|
+
useRef as useRef48,
|
|
39530
39620
|
useState as useState108
|
|
39531
39621
|
} from "react";
|
|
39532
39622
|
import { cn as cn75 } from "@ai-matrx/design-system";
|
|
39533
39623
|
import { jsx as jsx127, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
39534
39624
|
function useMeasuredWidth(fallback = 480) {
|
|
39535
|
-
const ref =
|
|
39625
|
+
const ref = useRef48(null);
|
|
39536
39626
|
const [width, setWidth] = useState108(fallback);
|
|
39537
39627
|
useEffect92(() => {
|
|
39538
39628
|
const node = ref.current;
|
|
@@ -39820,7 +39910,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
|
|
|
39820
39910
|
}
|
|
39821
39911
|
|
|
39822
39912
|
// src/DocRender.tsx
|
|
39823
|
-
import { useCallback as useCallback56, useEffect as useEffect94, useRef as
|
|
39913
|
+
import { useCallback as useCallback56, useEffect as useEffect94, useRef as useRef49, useState as useState110 } from "react";
|
|
39824
39914
|
import { useRecordsClient as useRecordsClient81 } from "@ai-matrx/records/react";
|
|
39825
39915
|
import { Button as Button87, Skeleton as Skeleton29, cn as cn77 } from "@ai-matrx/design-system";
|
|
39826
39916
|
import { jsx as jsx129, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
@@ -39831,7 +39921,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
39831
39921
|
const [showing, setShowing] = useState110(null);
|
|
39832
39922
|
const [error, setError] = useState110(null);
|
|
39833
39923
|
const [busy, setBusy] = useState110(null);
|
|
39834
|
-
const paper =
|
|
39924
|
+
const paper = useRef49(null);
|
|
39835
39925
|
const load = useCallback56(async () => {
|
|
39836
39926
|
const [body, held] = await Promise.all([
|
|
39837
39927
|
client.docRenderBody({ template_id: templateId, record_id: recordId }),
|
|
@@ -40802,7 +40892,7 @@ import { RecordsProvider as RecordsProvider2, useFields as useFields27, useRecor
|
|
|
40802
40892
|
import { Button as Button89, CreatablePicker as CreatablePicker2 } from "@ai-matrx/design-system";
|
|
40803
40893
|
|
|
40804
40894
|
// src/RecordsMount.tsx
|
|
40805
|
-
import { useRef as
|
|
40895
|
+
import { useRef as useRef50 } from "react";
|
|
40806
40896
|
import { RecordsProvider } from "@ai-matrx/records/react";
|
|
40807
40897
|
import { jsx as jsx133 } from "react/jsx-runtime";
|
|
40808
40898
|
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.";
|
|
@@ -40820,7 +40910,7 @@ function RecordsMount({
|
|
|
40820
40910
|
return /* @__PURE__ */ jsx133(RecordsProvider, { config, children: /* @__PURE__ */ jsx133(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsx133(RecordLabelProvider, { children }) }) });
|
|
40821
40911
|
}
|
|
40822
40912
|
function useShallowStableHost(host) {
|
|
40823
|
-
const held =
|
|
40913
|
+
const held = useRef50(null);
|
|
40824
40914
|
const next = host ?? {};
|
|
40825
40915
|
const previous = held.current;
|
|
40826
40916
|
if (previous !== null && sameParts(previous, next)) return previous;
|
|
@@ -41914,7 +42004,7 @@ function TargetControl({
|
|
|
41914
42004
|
}
|
|
41915
42005
|
|
|
41916
42006
|
// src/QuestionPanel.tsx
|
|
41917
|
-
import { useEffect as useEffect99, useMemo as useMemo68, useRef as
|
|
42007
|
+
import { useEffect as useEffect99, useMemo as useMemo68, useRef as useRef51, useState as useState116 } from "react";
|
|
41918
42008
|
import { Badge as Badge23, BasicInput as BasicInput32, Button as Button92, Checkbox as Checkbox16, Label as Label23, Skeleton as Skeleton32, cn as cn82 } from "@ai-matrx/design-system";
|
|
41919
42009
|
import { useFields as useFields30, useRecordsClient as useRecordsClient85 } from "@ai-matrx/records/react";
|
|
41920
42010
|
|
|
@@ -42366,7 +42456,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
42366
42456
|
const [saveError, setSaveError] = useState116(null);
|
|
42367
42457
|
const [saving, setSaving] = useState116(false);
|
|
42368
42458
|
const [linkMissed, setLinkMissed] = useState116(false);
|
|
42369
|
-
const openedFromLink =
|
|
42459
|
+
const openedFromLink = useRef51(false);
|
|
42370
42460
|
useEffect99(() => {
|
|
42371
42461
|
let live = true;
|
|
42372
42462
|
void questionsOf(client, tableId).then((answer2) => {
|
|
@@ -44110,12 +44200,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
44110
44200
|
}
|
|
44111
44201
|
|
|
44112
44202
|
// src/CaptureSheet.tsx
|
|
44113
|
-
import { useCallback as useCallback62, useEffect as useEffect103, useRef as
|
|
44203
|
+
import { useCallback as useCallback62, useEffect as useEffect103, useRef as useRef53, useState as useState121 } from "react";
|
|
44114
44204
|
import { useFields as useFields33, useRecordsClient as useRecordsClient90, useTable as useTable33 } from "@ai-matrx/records/react";
|
|
44115
44205
|
import { Button as Button97, Input as Input8, Skeleton as Skeleton37, Textarea as Textarea7, cn as cn86 } from "@ai-matrx/design-system";
|
|
44116
44206
|
|
|
44117
44207
|
// src/CaptureRun.tsx
|
|
44118
|
-
import { useCallback as useCallback61, useEffect as useEffect102, useMemo as useMemo70, useRef as
|
|
44208
|
+
import { useCallback as useCallback61, useEffect as useEffect102, useMemo as useMemo70, useRef as useRef52, useState as useState120 } from "react";
|
|
44119
44209
|
import {
|
|
44120
44210
|
coerceTypedAnswer as coerceTypedAnswer3,
|
|
44121
44211
|
coercionLabel,
|
|
@@ -44173,7 +44263,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
44173
44263
|
const [items, setItems] = useState120([]);
|
|
44174
44264
|
const [lastSynced, setLastSynced] = useState120(null);
|
|
44175
44265
|
const [sending, setSending] = useState120(false);
|
|
44176
|
-
const queueRef =
|
|
44266
|
+
const queueRef = useRef52(null);
|
|
44177
44267
|
useEffect102(() => {
|
|
44178
44268
|
const q2 = openCaptureQueue({
|
|
44179
44269
|
onChange: (c, all) => {
|
|
@@ -44553,7 +44643,7 @@ function AdHocCaptureSheet({
|
|
|
44553
44643
|
const [error, setError] = useState121(null);
|
|
44554
44644
|
const [uploadError, setUploadError] = useState121(null);
|
|
44555
44645
|
const [flushing, setFlushing] = useState121(false);
|
|
44556
|
-
const queue =
|
|
44646
|
+
const queue = useRef53([]);
|
|
44557
44647
|
const keep = useCallback62(
|
|
44558
44648
|
async (next) => {
|
|
44559
44649
|
queue.current = next;
|
|
@@ -45093,7 +45183,7 @@ function useEmbedHandshake(args) {
|
|
|
45093
45183
|
}
|
|
45094
45184
|
|
|
45095
45185
|
// src/TablePage.tsx
|
|
45096
|
-
import { useCallback as useCallback67, useEffect as useEffect109, useMemo as useMemo74, useRef as
|
|
45186
|
+
import { useCallback as useCallback67, useEffect as useEffect109, useMemo as useMemo74, useRef as useRef54, useState as useState131 } from "react";
|
|
45097
45187
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
45098
45188
|
import { useFields as useFields36, useRecordsClient as useRecordsClient95, useTable as useTable35 } from "@ai-matrx/records/react";
|
|
45099
45189
|
import {
|
|
@@ -46067,6 +46157,8 @@ function TablePage({
|
|
|
46067
46157
|
tableId,
|
|
46068
46158
|
presentation: pagePresentation2 = "page",
|
|
46069
46159
|
newRowLabel,
|
|
46160
|
+
searchOverride,
|
|
46161
|
+
onSearchChange,
|
|
46070
46162
|
pageSize: pageSizeAsked,
|
|
46071
46163
|
seedViews,
|
|
46072
46164
|
onLeave,
|
|
@@ -46125,7 +46217,7 @@ function TablePage({
|
|
|
46125
46217
|
const [hostLayout, setHostLayout] = useState131(hostFromLink);
|
|
46126
46218
|
const [views, setViews] = useState131(void 0);
|
|
46127
46219
|
const [pickedViewId, setPickedViewId] = useState131(savedFromLink);
|
|
46128
|
-
const viewSeen =
|
|
46220
|
+
const viewSeen = useRef54(null);
|
|
46129
46221
|
const [viewLinkMissed, setViewLinkMissed] = useState131(false);
|
|
46130
46222
|
const [layoutChosen, setLayoutChosen] = useState131(false);
|
|
46131
46223
|
const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
|
|
@@ -46160,7 +46252,7 @@ function TablePage({
|
|
|
46160
46252
|
const face = tableOpening(view, hostLayouts.map((h) => h.id));
|
|
46161
46253
|
const designated = face.kind === "designated";
|
|
46162
46254
|
const embedded = pagePresentation2 === "embedded";
|
|
46163
|
-
const pageSize = pageSizeAsked ?? (embedded ?
|
|
46255
|
+
const pageSize = pageSizeAsked ?? (embedded ? EMBEDDED_PAGE_SIZE : 100);
|
|
46164
46256
|
const chooserInline = !embedded && !designated && !phone && toolbarFold2 < 2;
|
|
46165
46257
|
const chooserCompact = !embedded && !designated && !phone && toolbarFold2 >= 2;
|
|
46166
46258
|
const controlsInSheet = phone && !designated;
|
|
@@ -46196,7 +46288,7 @@ function TablePage({
|
|
|
46196
46288
|
lookDiffers: view ? lookDiffers(view, look) : false
|
|
46197
46289
|
};
|
|
46198
46290
|
const shownSignature = JSON.stringify(shownReport);
|
|
46199
|
-
const reportRef =
|
|
46291
|
+
const reportRef = useRef54(onShownViewChange);
|
|
46200
46292
|
reportRef.current = onShownViewChange;
|
|
46201
46293
|
useEffect109(() => {
|
|
46202
46294
|
reportRef.current?.(JSON.parse(shownSignature));
|
|
@@ -46257,7 +46349,7 @@ function TablePage({
|
|
|
46257
46349
|
},
|
|
46258
46350
|
[client, tableId, view, looks]
|
|
46259
46351
|
);
|
|
46260
|
-
const arrival =
|
|
46352
|
+
const arrival = useRef54(viewAddress ?? null);
|
|
46261
46353
|
const [gridQuery, setGridQuery] = useState131(null);
|
|
46262
46354
|
const [addressResetEpoch, setAddressResetEpoch] = useState131(0);
|
|
46263
46355
|
const reportGrid = useCallback67((q) => {
|
|
@@ -46268,7 +46360,7 @@ function TablePage({
|
|
|
46268
46360
|
() => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
|
|
46269
46361
|
[reportGrid, addressResetEpoch]
|
|
46270
46362
|
);
|
|
46271
|
-
const hiddenApplied =
|
|
46363
|
+
const hiddenApplied = useRef54(false);
|
|
46272
46364
|
useEffect109(() => {
|
|
46273
46365
|
const hidden = arrival.current?.hidden;
|
|
46274
46366
|
if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
|
|
@@ -46289,9 +46381,9 @@ function TablePage({
|
|
|
46289
46381
|
const gridPending = !isViewAddressEmpty({ ...arrival.current ?? {}, hidden: [] });
|
|
46290
46382
|
const addressReady = Boolean(view && looks) && (gridQuery !== null || !gridPending);
|
|
46291
46383
|
const addressSignature = JSON.stringify(viewAddressToParams(addressNow));
|
|
46292
|
-
const addressReportRef =
|
|
46384
|
+
const addressReportRef = useRef54(onViewAddressChange);
|
|
46293
46385
|
addressReportRef.current = onViewAddressChange;
|
|
46294
|
-
const addressSent =
|
|
46386
|
+
const addressSent = useRef54(null);
|
|
46295
46387
|
useEffect109(() => {
|
|
46296
46388
|
if (!addressReady) return;
|
|
46297
46389
|
if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
|
|
@@ -46546,9 +46638,9 @@ function TablePage({
|
|
|
46546
46638
|
}
|
|
46547
46639
|
});
|
|
46548
46640
|
const openedEntry = ACTION_PRESS.find((entry) => entry.press.main !== void 0 && entry.press.main === main) ?? ACTION_PRESS.find((entry) => entry.press.rail !== void 0 && entry.press.rail === rail) ?? null;
|
|
46549
|
-
const actionsRef =
|
|
46641
|
+
const actionsRef = useRef54(actions);
|
|
46550
46642
|
actionsRef.current = actions;
|
|
46551
|
-
const onActionsRef =
|
|
46643
|
+
const onActionsRef = useRef54(onActions);
|
|
46552
46644
|
onActionsRef.current = onActions;
|
|
46553
46645
|
useEffect109(() => {
|
|
46554
46646
|
onActionsRef.current?.(actionsRef.current);
|
|
@@ -46951,6 +47043,8 @@ function TablePage({
|
|
|
46951
47043
|
chooser: false,
|
|
46952
47044
|
...embedded ? { embedded } : {},
|
|
46953
47045
|
...newRowLabel ? { newRowLabel } : {},
|
|
47046
|
+
...searchOverride !== void 0 ? { searchOverride } : {},
|
|
47047
|
+
...onSearchChange ? { onSearchChange } : {},
|
|
46954
47048
|
footer,
|
|
46955
47049
|
openExport: () => setRail("export"),
|
|
46956
47050
|
view: {
|
|
@@ -47113,6 +47207,8 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
47113
47207
|
}
|
|
47114
47208
|
|
|
47115
47209
|
// src/entityViews.tsx
|
|
47210
|
+
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
47211
|
+
import { MatrxTableCardShowMore as MatrxTableCardShowMore2 } from "@ai-matrx/design-system/data-table";
|
|
47116
47212
|
import { useEffect as useEffect110, useMemo as useMemo75, useState as useState132 } from "react";
|
|
47117
47213
|
import { Button as Button106, ErrorBox as ErrorBox9, Input as Input12, cn as cn93 } from "@ai-matrx/design-system";
|
|
47118
47214
|
import { useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
|
|
@@ -47256,7 +47352,9 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
47256
47352
|
function EntityTablePage({
|
|
47257
47353
|
source,
|
|
47258
47354
|
presentation = "page",
|
|
47259
|
-
|
|
47355
|
+
searchOverride,
|
|
47356
|
+
onSearchChange,
|
|
47357
|
+
pageSize = presentation === "embedded" ? EMBEDDED_PAGE_SIZE : 100,
|
|
47260
47358
|
layout: opened = "grid",
|
|
47261
47359
|
onLayoutChange,
|
|
47262
47360
|
groupBy,
|
|
@@ -47264,7 +47362,9 @@ function EntityTablePage({
|
|
|
47264
47362
|
actions,
|
|
47265
47363
|
className
|
|
47266
47364
|
}) {
|
|
47267
|
-
const
|
|
47365
|
+
const [typed2, setTyped] = useState132("");
|
|
47366
|
+
const term = searchOverride ?? typed2;
|
|
47367
|
+
const entity = useEntitySource(source.token, { limit: pageSize, search: term });
|
|
47268
47368
|
const [layout, setLayout] = useState132(opened);
|
|
47269
47369
|
useEffect110(() => setLayout(opened), [opened]);
|
|
47270
47370
|
const choose = (next) => {
|
|
@@ -47340,7 +47440,29 @@ function EntityTablePage({
|
|
|
47340
47440
|
] })
|
|
47341
47441
|
] }) : null,
|
|
47342
47442
|
addRefused ? /* @__PURE__ */ jsx153(ErrorBox9, { 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,
|
|
47343
|
-
entity.error ? /* @__PURE__ */ jsx153("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx153(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */
|
|
47443
|
+
entity.error ? /* @__PURE__ */ jsx153("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx153(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsxs141(Fragment62, { children: [
|
|
47444
|
+
presentation === "embedded" ? /* @__PURE__ */ jsx153("div", { className: "flex min-w-0 items-center justify-end", "data-records-entity-search": "", children: /* @__PURE__ */ jsx153(TooltipProvider, { children: /* @__PURE__ */ jsx153(
|
|
47445
|
+
TapTargetSearchGroup2,
|
|
47446
|
+
{
|
|
47447
|
+
placeholder: "Search",
|
|
47448
|
+
value: term,
|
|
47449
|
+
onValueChange: (next) => {
|
|
47450
|
+
setTyped(next);
|
|
47451
|
+
onSearchChange?.(next);
|
|
47452
|
+
}
|
|
47453
|
+
}
|
|
47454
|
+
) }) }) : null,
|
|
47455
|
+
/* @__PURE__ */ jsx153(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
|
|
47456
|
+
presentation === "embedded" && entity.hasMore ? /* @__PURE__ */ jsx153(
|
|
47457
|
+
MatrxTableCardShowMore2,
|
|
47458
|
+
{
|
|
47459
|
+
shown: entity.rows.length,
|
|
47460
|
+
total: entity.total,
|
|
47461
|
+
busy: entity.loadingMore,
|
|
47462
|
+
onShowMore: () => void entity.loadMore()
|
|
47463
|
+
}
|
|
47464
|
+
) : null
|
|
47465
|
+
] })
|
|
47344
47466
|
] });
|
|
47345
47467
|
}
|
|
47346
47468
|
|
|
@@ -47356,6 +47478,8 @@ function TablePage2(props) {
|
|
|
47356
47478
|
source,
|
|
47357
47479
|
...rest.presentation ? { presentation: rest.presentation } : {},
|
|
47358
47480
|
...rest.pageSize ? { pageSize: rest.pageSize } : {},
|
|
47481
|
+
...rest.searchOverride !== void 0 ? { searchOverride: rest.searchOverride } : {},
|
|
47482
|
+
...rest.onSearchChange ? { onSearchChange: rest.onSearchChange } : {},
|
|
47359
47483
|
...layout ? { layout } : {},
|
|
47360
47484
|
...onLayoutChange ? { onLayoutChange } : {},
|
|
47361
47485
|
...groupBy ? { groupBy } : {},
|