@ai-matrx/records-ui 0.110.12 → 0.111.0
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 +6 -0
- package/dist/index.cjs +196 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +140 -46
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -12439,6 +12439,9 @@ function FieldEditor(props) {
|
|
|
12439
12439
|
);
|
|
12440
12440
|
const rollupFilterChanged = JSON.stringify(rollupFilter) !== JSON.stringify(savedRollupFilter);
|
|
12441
12441
|
const [relationTarget, setRelationTarget] = useState33(String(start?.relation_target ?? ""));
|
|
12442
|
+
const [showOnOther, setShowOnOther] = useState33(true);
|
|
12443
|
+
const [reverseRefused, setReverseRefused] = useState33(null);
|
|
12444
|
+
const otherTable = useTable(!field2 && type === "relation" && relationTarget !== "" ? relationTarget : null);
|
|
12442
12445
|
const [display, setDisplay] = useState33(start?.display ?? null);
|
|
12443
12446
|
const [formulaOp, setFormulaOp] = useState33(() => formulaOpOf(start));
|
|
12444
12447
|
const [formulaFields, setFormulaFields] = useState33(() => formulaFieldIdsOf(start));
|
|
@@ -12650,6 +12653,15 @@ function FieldEditor(props) {
|
|
|
12650
12653
|
}
|
|
12651
12654
|
}
|
|
12652
12655
|
setBackfillError(null);
|
|
12656
|
+
if (type === "relation" && showOnOther && otherTable.data && otherTable.data.id !== tableId) {
|
|
12657
|
+
const made = await client.relationReverseField({ field_id: written });
|
|
12658
|
+
if (!made.ok) {
|
|
12659
|
+
setReverseRefused(made.error);
|
|
12660
|
+
return;
|
|
12661
|
+
}
|
|
12662
|
+
tableShapeChanged4(relationTarget);
|
|
12663
|
+
}
|
|
12664
|
+
setReverseRefused(null);
|
|
12653
12665
|
onSaved?.();
|
|
12654
12666
|
};
|
|
12655
12667
|
const remove = async () => {
|
|
@@ -12841,6 +12853,19 @@ function FieldEditor(props) {
|
|
|
12841
12853
|
),
|
|
12842
12854
|
"Each value has its own date"
|
|
12843
12855
|
] }),
|
|
12856
|
+
!field2 && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ jsxs37("label", { className: "flex items-center gap-1.5", children: [
|
|
12857
|
+
/* @__PURE__ */ jsx42(
|
|
12858
|
+
Checkbox6,
|
|
12859
|
+
{
|
|
12860
|
+
checked: showOnOther,
|
|
12861
|
+
"aria-label": `Show on ${otherTable.data.name ?? "the other table"}`,
|
|
12862
|
+
onCheckedChange: (v) => setShowOnOther(v === true),
|
|
12863
|
+
"data-records-show-on-other": ""
|
|
12864
|
+
}
|
|
12865
|
+
),
|
|
12866
|
+
"Show on ",
|
|
12867
|
+
otherTable.data.name ?? "the other table"
|
|
12868
|
+
] }) : null,
|
|
12844
12869
|
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ jsxs37("label", { className: "flex items-center gap-1.5", children: [
|
|
12845
12870
|
/* @__PURE__ */ jsx42(
|
|
12846
12871
|
Checkbox6,
|
|
@@ -13008,6 +13033,10 @@ function FieldEditor(props) {
|
|
|
13008
13033
|
) : null,
|
|
13009
13034
|
/* @__PURE__ */ jsx42(Button18, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
|
|
13010
13035
|
] }) : null,
|
|
13036
|
+
reverseRefused ? /* @__PURE__ */ jsxs37("div", { "data-records-reverse-field-refused": "", className: "flex flex-col gap-1", children: [
|
|
13037
|
+
/* @__PURE__ */ jsx42("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
|
|
13038
|
+
/* @__PURE__ */ jsx42(RefusalNotice, { error: reverseRefused })
|
|
13039
|
+
] }) : null,
|
|
13011
13040
|
backfillError ? /* @__PURE__ */ jsxs37("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
|
|
13012
13041
|
/* @__PURE__ */ jsx42("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
|
|
13013
13042
|
/* @__PURE__ */ jsx42(RefusalNotice, { error: backfillError })
|
|
@@ -19216,8 +19245,9 @@ function withTypeMark(field2, header) {
|
|
|
19216
19245
|
|
|
19217
19246
|
// src/ReverseColumns.tsx
|
|
19218
19247
|
import { useCallback as useCallback21, useEffect as useEffect43, useMemo as useMemo28, useRef as useRef30, useState as useState52, useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
19219
|
-
import {
|
|
19220
|
-
import {
|
|
19248
|
+
import { isReverseField } from "@ai-matrx/records";
|
|
19249
|
+
import { useFields as useFields6, useOptionalRecordsClient as useOptionalRecordsClient9, useReverseColumns as useReverseColumns3, useReverseLinks, useTable as useTable4 } from "@ai-matrx/records/react";
|
|
19250
|
+
import { Button as Button35, Dialog as Dialog10, DialogContent as DialogContent10, DialogHeader as DialogHeader10, DialogTitle as DialogTitle10, Popover as Popover7, PopoverContent as PopoverContent7, PopoverTrigger as PopoverTrigger7, Separator as Separator4, Skeleton as Skeleton5, cn as cn33 } from "@ai-matrx/design-system";
|
|
19221
19251
|
import { Fragment as Fragment18, jsx as jsx61, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
19222
19252
|
function reverseColumnId(column) {
|
|
19223
19253
|
return `${REVERSE_COLUMN_PREFIX}${column.key}`;
|
|
@@ -19340,7 +19370,71 @@ function ReverseCell({ held, column, rowId, tableId }) {
|
|
|
19340
19370
|
const readReading = () => held.reading;
|
|
19341
19371
|
const answer = useSyncExternalStore3(subscribe, readAnswer, readAnswer);
|
|
19342
19372
|
const reading = useSyncExternalStore3(subscribe, readReading, readReading);
|
|
19343
|
-
|
|
19373
|
+
const chips = /* @__PURE__ */ jsx61(ReverseLinkChips, { column, answer, loading: reading, clamp: { tableId, recordId: rowId } });
|
|
19374
|
+
if (column.read_only) return chips;
|
|
19375
|
+
return /* @__PURE__ */ jsxs56("span", { className: "flex min-w-0 items-start gap-1", children: [
|
|
19376
|
+
/* @__PURE__ */ jsx61("span", { className: "min-w-0 flex-1", children: chips }),
|
|
19377
|
+
/* @__PURE__ */ jsx61(ReverseLinksEditPopover, { tableId, recordId: rowId, column })
|
|
19378
|
+
] });
|
|
19379
|
+
}
|
|
19380
|
+
function useReverseField(tableId, column) {
|
|
19381
|
+
const client = useOptionalRecordsClient9();
|
|
19382
|
+
const [field2, setField] = useState52(null);
|
|
19383
|
+
useEffect43(() => {
|
|
19384
|
+
if (column.read_only || !client) return;
|
|
19385
|
+
let live = true;
|
|
19386
|
+
void client.fields({ table_id: tableId, withReverse: true }).then((read) => {
|
|
19387
|
+
if (live && read.ok) setField(read.data.find((f) => f.key === column.key && isReverseField(f)) ?? null);
|
|
19388
|
+
});
|
|
19389
|
+
return () => {
|
|
19390
|
+
live = false;
|
|
19391
|
+
};
|
|
19392
|
+
}, [client, tableId, column.key, column.read_only]);
|
|
19393
|
+
return field2;
|
|
19394
|
+
}
|
|
19395
|
+
function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
|
|
19396
|
+
const client = useOptionalRecordsClient9();
|
|
19397
|
+
const field2 = useReverseField(tableId, column);
|
|
19398
|
+
const ids = useMemo28(() => [recordId], [recordId]);
|
|
19399
|
+
const one = useMemo28(() => [column], [column]);
|
|
19400
|
+
const read = useReverseLinks(tableId, one, ids, REVERSE_LINKS_EDIT_MAX);
|
|
19401
|
+
const answer = read.data?.[column.key]?.[recordId];
|
|
19402
|
+
const [refused, setRefused] = useState52(null);
|
|
19403
|
+
if (read.error) return /* @__PURE__ */ jsx61(RefusalNotice, { error: read.error });
|
|
19404
|
+
if (!field2 || !answer || !client) return /* @__PURE__ */ jsx61(Skeleton5, { className: "h-7 w-40", "data-records-reverse-editor-loading": "" });
|
|
19405
|
+
const current = answer.links.map((l) => l.id);
|
|
19406
|
+
const write = async (next) => {
|
|
19407
|
+
const want = (Array.isArray(next) ? next : next ? [next] : []).map(String);
|
|
19408
|
+
const add = want.filter((id) => !current.includes(id));
|
|
19409
|
+
const remove = current.filter((id) => !want.includes(id));
|
|
19410
|
+
if (add.length === 0 && remove.length === 0) return;
|
|
19411
|
+
const done = await client.relationReverseSet({ record_id: recordId, field_id: field2.id, add, remove });
|
|
19412
|
+
setRefused(done.ok ? null : done.error);
|
|
19413
|
+
if (done.ok) read.reload();
|
|
19414
|
+
};
|
|
19415
|
+
return /* @__PURE__ */ jsxs56("span", { className: "flex min-w-0 flex-col gap-1", "data-records-reverse-editor": column.key, children: [
|
|
19416
|
+
/* @__PURE__ */ jsx61(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose }),
|
|
19417
|
+
refused ? /* @__PURE__ */ jsx61(RefusalNotice, { error: refused }) : null
|
|
19418
|
+
] });
|
|
19419
|
+
}
|
|
19420
|
+
var REVERSE_LINKS_EDIT_MAX = 50;
|
|
19421
|
+
function ReverseLinksEditPopover({ tableId, recordId, column }) {
|
|
19422
|
+
const [open, setOpen] = useState52(false);
|
|
19423
|
+
return /* @__PURE__ */ jsxs56(Popover7, { open, onOpenChange: setOpen, children: [
|
|
19424
|
+
/* @__PURE__ */ jsx61(PopoverTrigger7, { asChild: true, children: /* @__PURE__ */ jsx61(
|
|
19425
|
+
Button35,
|
|
19426
|
+
{
|
|
19427
|
+
size: "sm",
|
|
19428
|
+
variant: "ghost",
|
|
19429
|
+
className: "h-5 w-5 shrink-0 p-0 text-muted-foreground",
|
|
19430
|
+
"aria-label": `Link ${column.source_table_name}`,
|
|
19431
|
+
title: `Link ${column.source_table_name}`,
|
|
19432
|
+
"data-records-reverse-edit": column.key,
|
|
19433
|
+
children: "+"
|
|
19434
|
+
}
|
|
19435
|
+
) }),
|
|
19436
|
+
/* @__PURE__ */ jsx61(PopoverContent7, { sizing: "content", align: "start", className: "w-80 p-2", children: open ? /* @__PURE__ */ jsx61(ReverseLinksEditor, { tableId, recordId, column }) : null })
|
|
19437
|
+
] });
|
|
19344
19438
|
}
|
|
19345
19439
|
var EMPTY_COLUMNS = [];
|
|
19346
19440
|
function ReverseLinksSections({ tableId, recordId }) {
|
|
@@ -19366,7 +19460,7 @@ function ReverseLinksSection({ tableId, recordId, column }) {
|
|
|
19366
19460
|
answer && answer.total > 0 ? /* @__PURE__ */ jsx61("span", { className: "text-[11px] text-muted-foreground", children: answer.total }) : null,
|
|
19367
19461
|
/* @__PURE__ */ jsx61(AddLinkedButton, { column, onAdd: () => setAdding(true) })
|
|
19368
19462
|
] }),
|
|
19369
|
-
first.error ? /* @__PURE__ */ jsx61(RefusalNotice, { error: first.error }) : /* @__PURE__ */ jsx61(ReverseLinkChips, { column, answer, loading: first.loading }),
|
|
19463
|
+
first.error ? /* @__PURE__ */ jsx61(RefusalNotice, { error: first.error }) : column.read_only ? /* @__PURE__ */ jsx61(ReverseLinkChips, { column, answer, loading: first.loading }) : /* @__PURE__ */ jsx61(ReverseLinksEditor, { tableId, recordId, column }),
|
|
19370
19464
|
answer && answer.total > answer.links.length && answer.links.length < 50 ? /* @__PURE__ */ jsxs56(Button35, { size: "sm", variant: "ghost", className: "self-start px-1 text-[11px]", onClick: () => setShown((n) => n + REVERSE_PANEL_PAGE), children: [
|
|
19371
19465
|
"Show ",
|
|
19372
19466
|
Math.min(REVERSE_PANEL_PAGE, answer.total - answer.links.length),
|
|
@@ -23282,7 +23376,7 @@ function BulkActions({
|
|
|
23282
23376
|
import { useEffect as useEffect51, useMemo as useMemo35, useRef as useRef36, useState as useState60 } from "react";
|
|
23283
23377
|
import { useRecordsClient as useRecordsClient38 } from "@ai-matrx/records/react";
|
|
23284
23378
|
import { stableFilterKey as stableFilterKey2 } from "@ai-matrx/records";
|
|
23285
|
-
import { Button as Button41, ConfirmDialog as ConfirmDialog4, Popover as
|
|
23379
|
+
import { Button as Button41, ConfirmDialog as ConfirmDialog4, Popover as Popover8, PopoverContent as PopoverContent8, PopoverTrigger as PopoverTrigger8, cn as cn35 } from "@ai-matrx/design-system";
|
|
23286
23380
|
import { jsx as jsx71, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
23287
23381
|
function sortArrow(direction) {
|
|
23288
23382
|
return direction === "asc" ? "\u2191" : "\u2193";
|
|
@@ -23308,8 +23402,8 @@ function SortGlyph() {
|
|
|
23308
23402
|
}
|
|
23309
23403
|
function SortStateControl({ label, line, attention = false, actions = [], mode }) {
|
|
23310
23404
|
const [open, setOpen] = useState60(false);
|
|
23311
|
-
return /* @__PURE__ */ jsxs64(
|
|
23312
|
-
/* @__PURE__ */ jsx71(
|
|
23405
|
+
return /* @__PURE__ */ jsxs64(Popover8, { open, onOpenChange: setOpen, children: [
|
|
23406
|
+
/* @__PURE__ */ jsx71(PopoverTrigger8, { asChild: true, children: /* @__PURE__ */ jsxs64(
|
|
23313
23407
|
Button41,
|
|
23314
23408
|
{
|
|
23315
23409
|
size: "sm",
|
|
@@ -23332,7 +23426,7 @@ function SortStateControl({ label, line, attention = false, actions = [], mode }
|
|
|
23332
23426
|
]
|
|
23333
23427
|
}
|
|
23334
23428
|
) }),
|
|
23335
|
-
/* @__PURE__ */ jsxs64(
|
|
23429
|
+
/* @__PURE__ */ jsxs64(PopoverContent8, { sizing: "content", align: "start", className: "w-72 p-2", "data-sort-state": "", children: [
|
|
23336
23430
|
/* @__PURE__ */ jsx71("p", { className: "px-1 pb-2 text-xs text-foreground", children: line }),
|
|
23337
23431
|
actions.length > 0 ? /* @__PURE__ */ jsx71("div", { className: "flex flex-wrap justify-end gap-1", children: actions.map((action3) => /* @__PURE__ */ jsx71(
|
|
23338
23432
|
Button41,
|
|
@@ -25769,7 +25863,7 @@ function sortIgnoredOf(answer) {
|
|
|
25769
25863
|
// src/RecordsTableCard.tsx
|
|
25770
25864
|
import { MatrxTableCard, MatrxTableCardEmpty, MatrxTableCardShowMore as MatrxTableCardShowMore2, TABLE_CARD_DEFAULT_INITIAL_ROWS } from "@ai-matrx/design-system/data-table";
|
|
25771
25865
|
import { Button as Button43 } from "@ai-matrx/design-system";
|
|
25772
|
-
import { useFields as useFields9, useOptionalRecordsClient as
|
|
25866
|
+
import { useFields as useFields9, useOptionalRecordsClient as useOptionalRecordsClient10, useTable as useTable7 } from "@ai-matrx/records/react";
|
|
25773
25867
|
|
|
25774
25868
|
// src/entityTable.tsx
|
|
25775
25869
|
import { useId as useId2, useMemo as useMemo38 } from "react";
|
|
@@ -26003,7 +26097,7 @@ function EntityGrid({
|
|
|
26003
26097
|
// src/RecordsTableCard.tsx
|
|
26004
26098
|
import { Fragment as Fragment27, jsx as jsx74, jsxs as jsxs66 } from "react/jsx-runtime";
|
|
26005
26099
|
function RecordsTableCard(props) {
|
|
26006
|
-
const client =
|
|
26100
|
+
const client = useOptionalRecordsClient10();
|
|
26007
26101
|
if (!client) {
|
|
26008
26102
|
return /* @__PURE__ */ jsx74(MatrxTableCard, { title: "Table", ...props.className ? { className: props.className } : {}, children: /* @__PURE__ */ jsx74(MatrxTableCardEmpty, { message: "This table cannot be shown here: the page has no connection to the data store." }) });
|
|
26009
26103
|
}
|
|
@@ -27884,7 +27978,7 @@ function nextInWords(page) {
|
|
|
27884
27978
|
import { useEffect as useEffect58, useState as useState68 } from "react";
|
|
27885
27979
|
import { moveConsequence } from "@ai-matrx/records";
|
|
27886
27980
|
import { useRecordsClient as useRecordsClient46 } from "@ai-matrx/records/react";
|
|
27887
|
-
import { Button as Button50, ErrorBox as ErrorBox4, Popover as
|
|
27981
|
+
import { Button as Button50, ErrorBox as ErrorBox4, Popover as Popover9, PopoverContent as PopoverContent9, PopoverTrigger as PopoverTrigger9 } from "@ai-matrx/design-system";
|
|
27888
27982
|
import { jsx as jsx84, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
27889
27983
|
function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "header", openAsked = 0 }) {
|
|
27890
27984
|
const client = useRecordsClient46();
|
|
@@ -27945,7 +28039,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
27945
28039
|
onMoved?.(moved.data.to);
|
|
27946
28040
|
}
|
|
27947
28041
|
return /* @__PURE__ */ jsxs75(
|
|
27948
|
-
|
|
28042
|
+
Popover9,
|
|
27949
28043
|
{
|
|
27950
28044
|
open,
|
|
27951
28045
|
onOpenChange: (next) => {
|
|
@@ -27957,7 +28051,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
27957
28051
|
setOpen(next);
|
|
27958
28052
|
},
|
|
27959
28053
|
children: [
|
|
27960
|
-
/* @__PURE__ */ jsx84(
|
|
28054
|
+
/* @__PURE__ */ jsx84(PopoverTrigger9, { asChild: true, children: variant === "anchor" ? /* @__PURE__ */ jsx84("span", { "aria-hidden": true, className: "pointer-events-none inline-block h-0 w-0", "data-where-it-lives-anchor": tableId }) : /* @__PURE__ */ jsxs75(
|
|
27961
28055
|
"button",
|
|
27962
28056
|
{
|
|
27963
28057
|
type: "button",
|
|
@@ -27976,7 +28070,7 @@ function WhereItLives({ tableId, knownOrganizationName, onMoved, variant = "head
|
|
|
27976
28070
|
}
|
|
27977
28071
|
) }),
|
|
27978
28072
|
/* @__PURE__ */ jsx84(
|
|
27979
|
-
|
|
28073
|
+
PopoverContent9,
|
|
27980
28074
|
{
|
|
27981
28075
|
align: "start",
|
|
27982
28076
|
className: "w-80 p-3 text-xs",
|
|
@@ -30282,7 +30376,7 @@ function RecordFieldsInPlace({
|
|
|
30282
30376
|
// src/ShareControl.tsx
|
|
30283
30377
|
import { copyText as copyText4 } from "@ai-matrx/kit/clipboard";
|
|
30284
30378
|
import { useEffect as useEffect67, useState as useState79 } from "react";
|
|
30285
|
-
import { Button as Button59, Popover as
|
|
30379
|
+
import { Button as Button59, Popover as Popover10, PopoverContent as PopoverContent10, PopoverTrigger as PopoverTrigger10 } from "@ai-matrx/design-system";
|
|
30286
30380
|
import { Fragment as Fragment35, jsx as jsx96, jsxs as jsxs87 } from "react/jsx-runtime";
|
|
30287
30381
|
function useCanShare() {
|
|
30288
30382
|
return typeof useRecordsUi().share === "function";
|
|
@@ -30349,9 +30443,9 @@ function ShareForSomebodyElse({
|
|
|
30349
30443
|
setCopied("no");
|
|
30350
30444
|
}
|
|
30351
30445
|
};
|
|
30352
|
-
return /* @__PURE__ */ jsxs87(
|
|
30353
|
-
/* @__PURE__ */ jsx96(
|
|
30354
|
-
/* @__PURE__ */ jsxs87(
|
|
30446
|
+
return /* @__PURE__ */ jsxs87(Popover10, { onOpenChange: (open) => open ? null : setCopied(null), children: [
|
|
30447
|
+
/* @__PURE__ */ jsx96(PopoverTrigger10, { asChild: true, children: /* @__PURE__ */ jsx96(Button59, { size, variant, className, title: kind === "table" ? "Who can share this table" : "Who can share this record", "data-share-for-somebody-else": "", children: "Share" }) }),
|
|
30448
|
+
/* @__PURE__ */ jsxs87(PopoverContent10, { align: "end", className: "w-72 space-y-2 p-3 text-sm", children: [
|
|
30355
30449
|
/* @__PURE__ */ jsx96("p", { children: whyNot }),
|
|
30356
30450
|
/* @__PURE__ */ jsxs87("p", { className: "text-xs text-muted-foreground", children: [
|
|
30357
30451
|
"The link opens this ",
|
|
@@ -33791,7 +33885,7 @@ function ViewNeeds({ layout, tableId, fields, onMade, className }) {
|
|
|
33791
33885
|
|
|
33792
33886
|
// src/GalleryCover.tsx
|
|
33793
33887
|
import { useEffect as useEffect76, useState as useState89 } from "react";
|
|
33794
|
-
import { useOptionalRecordsClient as
|
|
33888
|
+
import { useOptionalRecordsClient as useOptionalRecordsClient11 } from "@ai-matrx/records/react";
|
|
33795
33889
|
import { Fragment as Fragment43, jsx as jsx107 } from "react/jsx-runtime";
|
|
33796
33890
|
function isImageAddress(value) {
|
|
33797
33891
|
return typeof value === "string" && /^(https?:\/\/|\/|data:image\/)/i.test(value.trim());
|
|
@@ -33809,7 +33903,7 @@ function GalleryCover({ field: field2, value }) {
|
|
|
33809
33903
|
return null;
|
|
33810
33904
|
}
|
|
33811
33905
|
function FileCover({ recordId }) {
|
|
33812
|
-
const client =
|
|
33906
|
+
const client = useOptionalRecordsClient11();
|
|
33813
33907
|
const host = useRecordsUi();
|
|
33814
33908
|
const [read, setRead] = useState89(null);
|
|
33815
33909
|
useEffect76(() => {
|
|
@@ -35483,7 +35577,7 @@ function ArchivedPortals({
|
|
|
35483
35577
|
// src/ViewBar.tsx
|
|
35484
35578
|
import { useCallback as useCallback43, useEffect as useEffect80, useRef as useRef49, useState as useState93 } from "react";
|
|
35485
35579
|
import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
|
|
35486
|
-
import { Badge as Badge14, Button as Button70, Input as Input6, Popover as
|
|
35580
|
+
import { Badge as Badge14, Button as Button70, Input as Input6, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11, Skeleton as Skeleton15, cn as cn58 } from "@ai-matrx/design-system";
|
|
35487
35581
|
|
|
35488
35582
|
// src/seedOnce.ts
|
|
35489
35583
|
import { useCallback as useCallback42, useRef as useRef48 } from "react";
|
|
@@ -35688,8 +35782,8 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
35688
35782
|
if (error) return /* @__PURE__ */ jsx112(RefusalNotice, { error, className, actions: /* @__PURE__ */ jsx112(Button70, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" }) });
|
|
35689
35783
|
if (views === null) return /* @__PURE__ */ jsx112(Skeleton15, { className: cn58("h-8 w-28 shrink-0", className) });
|
|
35690
35784
|
const current = views.find((v) => v.id === active) ?? null;
|
|
35691
|
-
return /* @__PURE__ */ jsxs102(
|
|
35692
|
-
/* @__PURE__ */ jsx112(
|
|
35785
|
+
return /* @__PURE__ */ jsxs102(Popover11, { open, onOpenChange: setOpen, children: [
|
|
35786
|
+
/* @__PURE__ */ jsx112(PopoverTrigger11, { asChild: true, children: /* @__PURE__ */ jsxs102(
|
|
35693
35787
|
Button70,
|
|
35694
35788
|
{
|
|
35695
35789
|
size: "sm",
|
|
@@ -35703,7 +35797,7 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, settings, onViews,
|
|
|
35703
35797
|
]
|
|
35704
35798
|
}
|
|
35705
35799
|
) }),
|
|
35706
|
-
/* @__PURE__ */ jsxs102(
|
|
35800
|
+
/* @__PURE__ */ jsxs102(PopoverContent11, { sizing: "content", align: "start", className: "w-64 p-1", "data-view-picker-content": "", children: [
|
|
35707
35801
|
/* @__PURE__ */ jsxs102("div", { role: "group", "aria-label": "Saved views", className: "flex max-h-[50dvh] flex-col overflow-y-auto", children: [
|
|
35708
35802
|
views.map((view) => /* @__PURE__ */ jsxs102(
|
|
35709
35803
|
"button",
|
|
@@ -38563,7 +38657,7 @@ function submissionStamp(args) {
|
|
|
38563
38657
|
|
|
38564
38658
|
// src/FormResultsPanel.tsx
|
|
38565
38659
|
import { useEffect as useEffect90, useMemo as useMemo62, useState as useState103 } from "react";
|
|
38566
|
-
import { useFields as useFields23, useOptionalRecordsClient as
|
|
38660
|
+
import { useFields as useFields23, useOptionalRecordsClient as useOptionalRecordsClient14 } from "@ai-matrx/records/react";
|
|
38567
38661
|
import { Button as Button77, Skeleton as Skeleton21, cn as cn67 } from "@ai-matrx/design-system";
|
|
38568
38662
|
|
|
38569
38663
|
// src/ChartBlock.tsx
|
|
@@ -38592,7 +38686,7 @@ import { formatCount as formatCount5 } from "@ai-matrx/kit/format";
|
|
|
38592
38686
|
|
|
38593
38687
|
// src/linkWords.ts
|
|
38594
38688
|
import { useEffect as useEffect87, useMemo as useMemo60, useState as useState100 } from "react";
|
|
38595
|
-
import { useOptionalRecordsClient as
|
|
38689
|
+
import { useOptionalRecordsClient as useOptionalRecordsClient12 } from "@ai-matrx/records/react";
|
|
38596
38690
|
|
|
38597
38691
|
// src/charts.ts
|
|
38598
38692
|
var CHART_KIND_LABEL = {
|
|
@@ -38802,7 +38896,7 @@ function bucketWindow2(groupKey, value) {
|
|
|
38802
38896
|
|
|
38803
38897
|
// src/linkWords.ts
|
|
38804
38898
|
function useLinkGroupNamer(block, tableId) {
|
|
38805
|
-
const client =
|
|
38899
|
+
const client = useOptionalRecordsClient12();
|
|
38806
38900
|
const groupBy = block.kind === "stuck" ? [] : block.group_by ?? [];
|
|
38807
38901
|
const rows = block.kind === "stuck" ? [] : block.rows ?? [];
|
|
38808
38902
|
const ask = JSON.stringify([tableId, groupBy, rows.map((r) => r.groups ?? null)]);
|
|
@@ -38853,7 +38947,7 @@ function useLinkGroupNamer(block, tableId) {
|
|
|
38853
38947
|
|
|
38854
38948
|
// src/measureWords.ts
|
|
38855
38949
|
import { useEffect as useEffect88, useState as useState101 } from "react";
|
|
38856
|
-
import { useOptionalRecordsClient as
|
|
38950
|
+
import { useOptionalRecordsClient as useOptionalRecordsClient13 } from "@ai-matrx/records/react";
|
|
38857
38951
|
import { humanizeIdentifier as humanizeIdentifier17 } from "@ai-matrx/kit/text-case";
|
|
38858
38952
|
var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
|
|
38859
38953
|
function measureWords(key, fields) {
|
|
@@ -38868,7 +38962,7 @@ function measureWords(key, fields) {
|
|
|
38868
38962
|
return word ? `${word} ${name.charAt(0).toLowerCase()}${name.slice(1)}` : `${humanizeIdentifier17(op2)} ${name}`;
|
|
38869
38963
|
}
|
|
38870
38964
|
function useMeasureWords(key, tableId) {
|
|
38871
|
-
const client =
|
|
38965
|
+
const client = useOptionalRecordsClient13();
|
|
38872
38966
|
const [fields, setFields] = useState101(null);
|
|
38873
38967
|
const needs = key !== "count";
|
|
38874
38968
|
useEffect88(() => {
|
|
@@ -39523,7 +39617,7 @@ function answersBlock(question, title) {
|
|
|
39523
39617
|
};
|
|
39524
39618
|
}
|
|
39525
39619
|
function FormResultsPanel({ form, className }) {
|
|
39526
|
-
const client =
|
|
39620
|
+
const client = useOptionalRecordsClient14();
|
|
39527
39621
|
const fields = useFields23(form.subject);
|
|
39528
39622
|
const [results, setResults] = useState103(null);
|
|
39529
39623
|
const [error, setError] = useState103(null);
|
|
@@ -42235,7 +42329,7 @@ function EmbedSnippets({ url, label }) {
|
|
|
42235
42329
|
|
|
42236
42330
|
// src/FormRunner.tsx
|
|
42237
42331
|
import { useCallback as useCallback54, useEffect as useEffect97, useMemo as useMemo67, useRef as useRef57, useState as useState111 } from "react";
|
|
42238
|
-
import { useFields as useFields24, useOptionalRecordsClient as
|
|
42332
|
+
import { useFields as useFields24, useOptionalRecordsClient as useOptionalRecordsClient15 } from "@ai-matrx/records/react";
|
|
42239
42333
|
import { Button as Button85, Label as Label22, Progress, Skeleton as Skeleton27, cn as cn77, formThemeClasses } from "@ai-matrx/design-system";
|
|
42240
42334
|
import { humanizeIdentifier as humanizeIdentifier18 } from "@ai-matrx/kit/text-case";
|
|
42241
42335
|
import { Fragment as Fragment53, jsx as jsx132, jsxs as jsxs122 } from "react/jsx-runtime";
|
|
@@ -42249,7 +42343,7 @@ function FormRunner(props) {
|
|
|
42249
42343
|
return /* @__PURE__ */ jsx132(ConnectedFormRunner, { ...props });
|
|
42250
42344
|
}
|
|
42251
42345
|
function ConnectedFormRunner(props) {
|
|
42252
|
-
const client =
|
|
42346
|
+
const client = useOptionalRecordsClient15();
|
|
42253
42347
|
const fields = useFields24(props.form.subject);
|
|
42254
42348
|
const { form, className } = props;
|
|
42255
42349
|
const submit = useCallback54(
|
|
@@ -44633,9 +44727,9 @@ import { useFields as useFields30, useRecordsClient as useRecordsClient86, useTa
|
|
|
44633
44727
|
import {
|
|
44634
44728
|
BasicInput as BasicInput31,
|
|
44635
44729
|
Button as Button93,
|
|
44636
|
-
Popover as
|
|
44637
|
-
PopoverContent as
|
|
44638
|
-
PopoverTrigger as
|
|
44730
|
+
Popover as Popover12,
|
|
44731
|
+
PopoverContent as PopoverContent12,
|
|
44732
|
+
PopoverTrigger as PopoverTrigger12,
|
|
44639
44733
|
Select as Select18,
|
|
44640
44734
|
SelectContent as SelectContent18,
|
|
44641
44735
|
SelectItem as SelectItem18,
|
|
@@ -45659,8 +45753,8 @@ function BlockSettingsMenu({
|
|
|
45659
45753
|
title,
|
|
45660
45754
|
onChange
|
|
45661
45755
|
}) {
|
|
45662
|
-
return /* @__PURE__ */ jsxs131(
|
|
45663
|
-
/* @__PURE__ */ jsx142(
|
|
45756
|
+
return /* @__PURE__ */ jsxs131(Popover12, { children: [
|
|
45757
|
+
/* @__PURE__ */ jsx142(PopoverTrigger12, { asChild: true, children: /* @__PURE__ */ jsx142(
|
|
45664
45758
|
Button93,
|
|
45665
45759
|
{
|
|
45666
45760
|
type: "button",
|
|
@@ -45673,7 +45767,7 @@ function BlockSettingsMenu({
|
|
|
45673
45767
|
children: /* @__PURE__ */ jsx142("span", { "aria-hidden": true, className: "text-sm leading-none", children: "\u22EF" })
|
|
45674
45768
|
}
|
|
45675
45769
|
) }),
|
|
45676
|
-
/* @__PURE__ */ jsx142(
|
|
45770
|
+
/* @__PURE__ */ jsx142(PopoverContent12, { align: "end", width: "lg", padding: "sm", "data-dashboard-block-settings": "", children: /* @__PURE__ */ jsx142(BlockSettings, { spec, title, onChange }) })
|
|
45677
45771
|
] });
|
|
45678
45772
|
}
|
|
45679
45773
|
function BlockSettings({
|
|
@@ -46878,7 +46972,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
46878
46972
|
|
|
46879
46973
|
// src/TableAsk.tsx
|
|
46880
46974
|
import { useState as useState121 } from "react";
|
|
46881
|
-
import { BasicInput as BasicInput33, Button as Button95, Popover as
|
|
46975
|
+
import { BasicInput as BasicInput33, Button as Button95, Popover as Popover13, PopoverContent as PopoverContent13, PopoverTrigger as PopoverTrigger13, Skeleton as Skeleton35 } from "@ai-matrx/design-system";
|
|
46882
46976
|
import { optionLabel as optionLabel4 } from "@ai-matrx/records";
|
|
46883
46977
|
import { useFields as useFields32, useRecordsClient as useRecordsClient88 } from "@ai-matrx/records/react";
|
|
46884
46978
|
|
|
@@ -47118,9 +47212,9 @@ function TableAsk({ tableId, onOpenInQuestions }) {
|
|
|
47118
47212
|
const answered = await askQuestion(client, tableId, read.spec, all);
|
|
47119
47213
|
setSaid(answered.ok ? { kind: "answer", reads: read.reads, spec: read.spec, answer: answered.data } : { kind: "refused", error: answered.error });
|
|
47120
47214
|
};
|
|
47121
|
-
return /* @__PURE__ */ jsxs133(
|
|
47122
|
-
/* @__PURE__ */ jsx144(
|
|
47123
|
-
/* @__PURE__ */ jsxs133(
|
|
47215
|
+
return /* @__PURE__ */ jsxs133(Popover13, { open, onOpenChange: setOpen, children: [
|
|
47216
|
+
/* @__PURE__ */ jsx144(PopoverTrigger13, { asChild: true, children: /* @__PURE__ */ jsx144(Button95, { size: "sm", variant: "ghost", title: "Ask this table", "data-table-ask": "", children: "Ask" }) }),
|
|
47217
|
+
/* @__PURE__ */ jsxs133(PopoverContent13, { align: "end", className: "flex w-96 max-w-[calc(100vw-2rem)] flex-col gap-2 p-2 text-xs", "data-table-ask-panel": "", children: [
|
|
47124
47218
|
/* @__PURE__ */ jsxs133(
|
|
47125
47219
|
"form",
|
|
47126
47220
|
{
|
|
@@ -49515,7 +49609,7 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
49515
49609
|
|
|
49516
49610
|
// src/ViewFilter.tsx
|
|
49517
49611
|
import { useEffect as useEffect113, useMemo as useMemo77, useState as useState133 } from "react";
|
|
49518
|
-
import { Button as Button106, Popover as
|
|
49612
|
+
import { Button as Button106, Popover as Popover14, PopoverContent as PopoverContent14, PopoverTrigger as PopoverTrigger14 } from "@ai-matrx/design-system";
|
|
49519
49613
|
import { useFields as useFields36 } from "@ai-matrx/records/react";
|
|
49520
49614
|
import { jsx as jsx156, jsxs as jsxs145 } from "react/jsx-runtime";
|
|
49521
49615
|
function conditionCount(expr) {
|
|
@@ -49546,7 +49640,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
49546
49640
|
// THE BUILDER FLOATS OVER THE TABLE (STABLE-TABLES; Notion's filter popover): drawn inside the
|
|
49547
49641
|
// toolbar row it grew the row and pushed the whole table down (0.13 + 0.13 layout shift).
|
|
49548
49642
|
/* @__PURE__ */ jsxs145(
|
|
49549
|
-
|
|
49643
|
+
Popover14,
|
|
49550
49644
|
{
|
|
49551
49645
|
open,
|
|
49552
49646
|
onOpenChange: (next) => {
|
|
@@ -49554,7 +49648,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
49554
49648
|
setOpen(next);
|
|
49555
49649
|
},
|
|
49556
49650
|
children: [
|
|
49557
|
-
/* @__PURE__ */ jsx156(
|
|
49651
|
+
/* @__PURE__ */ jsx156(PopoverTrigger14, { asChild: true, children: /* @__PURE__ */ jsx156(
|
|
49558
49652
|
Button106,
|
|
49559
49653
|
{
|
|
49560
49654
|
size: "sm",
|
|
@@ -49566,7 +49660,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
49566
49660
|
children: count > 0 ? `Filter \xB7 ${count}` : "Filter"
|
|
49567
49661
|
}
|
|
49568
49662
|
) }),
|
|
49569
|
-
/* @__PURE__ */ jsx156(
|
|
49663
|
+
/* @__PURE__ */ jsx156(PopoverContent14, { sizing: "content", align: "start", className: "w-auto max-w-[min(42rem,calc(100vw-2rem))] p-2", children: /* @__PURE__ */ jsxs145(
|
|
49570
49664
|
"div",
|
|
49571
49665
|
{
|
|
49572
49666
|
className: "flex flex-col gap-2 text-xs",
|