@ai-matrx/records-ui 0.102.15 → 0.102.16
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 +580 -512
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -9
- package/dist/index.d.ts +18 -9
- package/dist/index.js +437 -369
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +57 -30
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +57 -30
- package/dist/pickers.js.map +1 -1
- package/dist/table-shape.cjs +2 -32
- package/dist/table-shape.cjs.map +1 -1
- package/dist/table-shape.d.cts +1 -1
- package/dist/table-shape.d.ts +1 -1
- package/dist/table-shape.js +2 -32
- package/dist/table-shape.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1134,12 +1134,12 @@ function PickOrAdd({
|
|
|
1134
1134
|
children,
|
|
1135
1135
|
chips,
|
|
1136
1136
|
multi,
|
|
1137
|
-
|
|
1137
|
+
onEscape
|
|
1138
1138
|
}) {
|
|
1139
1139
|
const addRow = add && !foot ? add : null;
|
|
1140
1140
|
const count = items.length + (addRow ? 1 : 0);
|
|
1141
|
-
const addAt = addRow ?
|
|
1142
|
-
const itemAt = (index) =>
|
|
1141
|
+
const addAt = addRow ? items.length : -1;
|
|
1142
|
+
const itemAt = (index) => index;
|
|
1143
1143
|
const removable = (chips ?? []).filter((c) => c.onRemove);
|
|
1144
1144
|
const keys = useListKeys({
|
|
1145
1145
|
count,
|
|
@@ -1153,7 +1153,7 @@ function PickOrAdd({
|
|
|
1153
1153
|
if (item && !item.disabled) onPick(item.id);
|
|
1154
1154
|
},
|
|
1155
1155
|
onNothing: onEnterWithNoMatch ?? (add && !add.disabled ? add.onAdd : void 0),
|
|
1156
|
-
onClose: () => onOpenChange(false),
|
|
1156
|
+
onClose: () => onEscape ? onEscape() : onOpenChange(false),
|
|
1157
1157
|
...multi ? { onFinish: () => onOpenChange(false) } : {},
|
|
1158
1158
|
...removable.length > 0 ? { onBackspaceEmpty: () => removable[removable.length - 1]?.onRemove?.() } : {},
|
|
1159
1159
|
searchEmpty: search === ""
|
|
@@ -1187,6 +1187,11 @@ function PickOrAdd({
|
|
|
1187
1187
|
onKeyDown: (event) => {
|
|
1188
1188
|
if (event.key !== "Tab") event.stopPropagation();
|
|
1189
1189
|
},
|
|
1190
|
+
onEscapeKeyDown: (event) => {
|
|
1191
|
+
if (!onEscape) return;
|
|
1192
|
+
event.preventDefault();
|
|
1193
|
+
onEscape();
|
|
1194
|
+
},
|
|
1190
1195
|
onCloseAutoFocus: (event) => {
|
|
1191
1196
|
if (anchored) event.preventDefault();
|
|
1192
1197
|
},
|
|
@@ -1208,7 +1213,6 @@ function PickOrAdd({
|
|
|
1208
1213
|
notice,
|
|
1209
1214
|
/* @__PURE__ */ jsxs5(ScrollArea, { className: "max-h-64", children: [
|
|
1210
1215
|
/* @__PURE__ */ jsxs5("div", { role: "listbox", "aria-label": triggerLabel, "aria-multiselectable": multi ? true : void 0, children: [
|
|
1211
|
-
addFirst ? addRowNode : null,
|
|
1212
1216
|
items.map((item, index) => /* @__PURE__ */ jsx6(
|
|
1213
1217
|
PickRow,
|
|
1214
1218
|
{
|
|
@@ -1220,13 +1224,13 @@ function PickOrAdd({
|
|
|
1220
1224
|
disabled: item.disabled,
|
|
1221
1225
|
attrs: item.attrs,
|
|
1222
1226
|
person: item.person,
|
|
1223
|
-
highlighted:
|
|
1227
|
+
highlighted: index === keys.highlight,
|
|
1224
1228
|
onPick: () => onPick(item.id),
|
|
1225
|
-
onPoint: () => keys.setHighlight(
|
|
1229
|
+
onPoint: () => keys.setHighlight(index)
|
|
1226
1230
|
},
|
|
1227
1231
|
item.id
|
|
1228
1232
|
)),
|
|
1229
|
-
|
|
1233
|
+
addRowNode
|
|
1230
1234
|
] }),
|
|
1231
1235
|
items.length === 0 && empty ? empty : null
|
|
1232
1236
|
] }),
|
|
@@ -1271,7 +1275,7 @@ async function personRecordForMember(client, personTableId, people, member) {
|
|
|
1271
1275
|
});
|
|
1272
1276
|
return written;
|
|
1273
1277
|
}
|
|
1274
|
-
function PersonPicker({ field: field2, value, onChange, disabled, id, className, autoOpen, onClose, initialSearch }) {
|
|
1278
|
+
function PersonPicker({ field: field2, value, onChange, disabled, id, className, autoOpen, onClose, onCancel, initialSearch }) {
|
|
1275
1279
|
const client = useOptionalRecordsClient();
|
|
1276
1280
|
const host = useRecordsUi();
|
|
1277
1281
|
const [members, setMembers] = useState4(null);
|
|
@@ -1385,6 +1389,7 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
|
|
|
1385
1389
|
/* @__PURE__ */ jsx7(
|
|
1386
1390
|
PickOrAdd,
|
|
1387
1391
|
{
|
|
1392
|
+
...anchored && onCancel ? { onEscape: onCancel } : {},
|
|
1388
1393
|
anchored,
|
|
1389
1394
|
multi: field2.multi,
|
|
1390
1395
|
triggerId: id,
|
|
@@ -2531,7 +2536,7 @@ function tellApart(rows, nameOf2) {
|
|
|
2531
2536
|
// src/RelationPicker.tsx
|
|
2532
2537
|
import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2533
2538
|
var NO_STORE_ON_THIS_SCREEN_REASON = "This question points at a record in somebody's own data, and a page answered without an account is never allowed to search that. Leave it blank \u2014 whoever receives your answer will fill it in.";
|
|
2534
|
-
function RelationPicker({ field: field2, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose }) {
|
|
2539
|
+
function RelationPicker({ field: field2, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose, onCancel }) {
|
|
2535
2540
|
const client = useOptionalRecordsClient2();
|
|
2536
2541
|
const [rows, setRows] = useState6(null);
|
|
2537
2542
|
const [words2, setWords] = useState6({});
|
|
@@ -2699,6 +2704,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
2699
2704
|
PickOrAdd,
|
|
2700
2705
|
{
|
|
2701
2706
|
anchored,
|
|
2707
|
+
...anchored && onCancel ? { onEscape: onCancel } : {},
|
|
2702
2708
|
multi: field2.multi,
|
|
2703
2709
|
chips: picked.map((recordId) => ({ id: recordId, label: titleOf(recordId), onRemove: () => toggle(recordId) })),
|
|
2704
2710
|
triggerId: id,
|
|
@@ -4271,7 +4277,7 @@ function ChoiceAskButtons({
|
|
|
4271
4277
|
onCancel,
|
|
4272
4278
|
busy
|
|
4273
4279
|
}) {
|
|
4274
|
-
return /* @__PURE__ */ jsxs17("span", { "data-records-choice-ask": "", role: "group", "aria-label": choiceAskSentence(field2, words2), className: "flex flex-col gap-1", children: [
|
|
4280
|
+
return /* @__PURE__ */ jsxs17("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field2, words2), className: "flex flex-col gap-1", children: [
|
|
4275
4281
|
/* @__PURE__ */ jsx19("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field2, words2) }),
|
|
4276
4282
|
/* @__PURE__ */ jsxs17("span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
4277
4283
|
/* @__PURE__ */ jsx19(Button8, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
|
|
@@ -4308,7 +4314,11 @@ function typingOpens(field2) {
|
|
|
4308
4314
|
var SHORT_REFUSAL = {
|
|
4309
4315
|
email: "Enter a valid email",
|
|
4310
4316
|
url: "Enter a valid link",
|
|
4311
|
-
phone: "Enter a valid phone number"
|
|
4317
|
+
phone: "Enter a valid phone number",
|
|
4318
|
+
time: "Enter a time, like 2:30 PM",
|
|
4319
|
+
date: "Enter a date",
|
|
4320
|
+
number: "Enter a number",
|
|
4321
|
+
value: "Not a valid value"
|
|
4312
4322
|
};
|
|
4313
4323
|
function judgeTyped(field2, text, choices, nudge) {
|
|
4314
4324
|
const trimmed = text.trim();
|
|
@@ -4317,7 +4327,7 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
4317
4327
|
if (trimmed === "") return { value: null };
|
|
4318
4328
|
if (format && format.id === "time") {
|
|
4319
4329
|
const read2 = readTypedTime2(trimmed);
|
|
4320
|
-
return read2.ok ? { value: read2.value } : { refusal: `${fieldName(field2)} holds a time of day, and ${read2.why}` };
|
|
4330
|
+
return read2.ok ? { value: read2.value } : { refusal: SHORT_REFUSAL.time, why: `${fieldName(field2)} holds a time of day, and ${read2.why}` };
|
|
4321
4331
|
}
|
|
4322
4332
|
if (kind === "select" || kind === "multi_select") {
|
|
4323
4333
|
if (!choices || nudge === null) return null;
|
|
@@ -4355,7 +4365,7 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
4355
4365
|
if (format && format.id === "rating") {
|
|
4356
4366
|
const n = Number(trimmed);
|
|
4357
4367
|
const max = format.options?.ratingMax ?? 5;
|
|
4358
|
-
return Number.isInteger(n) && n >= 0 && n <= max ? { value: n === 0 ? null : n } : { refusal: `${fieldName(field2)} is a rating from 1 to ${max}
|
|
4368
|
+
return Number.isInteger(n) && n >= 0 && n <= max ? { value: n === 0 ? null : n } : { refusal: `Enter 1 to ${max}`, why: `${fieldName(field2)} is a rating from 1 to ${max}.` };
|
|
4359
4369
|
}
|
|
4360
4370
|
if (kind === "phone" || format && format.id === "phone") {
|
|
4361
4371
|
const digits = trimmed.replace(/\D/g, "");
|
|
@@ -4364,7 +4374,11 @@ function judgeTyped(field2, text, choices, nudge) {
|
|
|
4364
4374
|
}
|
|
4365
4375
|
const showsAsPercent = Boolean(format && (format.id === "percent" || format.id === "progress"));
|
|
4366
4376
|
const read = coerceTypedAnswer(field2, text, { label: fieldName(field2), showsAsPercent });
|
|
4367
|
-
if ("refusal" in read)
|
|
4377
|
+
if ("refusal" in read) {
|
|
4378
|
+
if (kind === "email" || kind === "url") return { refusal: SHORT_REFUSAL[kind] };
|
|
4379
|
+
const short = kind === "datetime" ? SHORT_REFUSAL.date : kind === "number" || kind === "currency" || kind === "percent" || showsAsPercent ? SHORT_REFUSAL.number : read.refusal.length <= 32 ? read.refusal : SHORT_REFUSAL.value;
|
|
4380
|
+
return short === read.refusal ? { refusal: short } : { refusal: short, why: read.refusal };
|
|
4381
|
+
}
|
|
4368
4382
|
if (typeof read.value === "number" && format && (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction") {
|
|
4369
4383
|
return { value: Math.round(read.value / 100 * 1e9) / 1e9 };
|
|
4370
4384
|
}
|
|
@@ -4449,7 +4463,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
4449
4463
|
box,
|
|
4450
4464
|
/* @__PURE__ */ jsx19(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field2) })
|
|
4451
4465
|
] }) : box,
|
|
4452
|
-
judged === null ? /* @__PURE__ */ jsxs17("span", { className: "text-[10px] text-muted-foreground", children: [
|
|
4466
|
+
judged === null ? /* @__PURE__ */ jsxs17("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
|
|
4453
4467
|
"Reading ",
|
|
4454
4468
|
fieldName(field2),
|
|
4455
4469
|
"'s choices\u2026"
|
|
@@ -4469,10 +4483,19 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
4469
4483
|
},
|
|
4470
4484
|
onCancel: () => onCancel?.()
|
|
4471
4485
|
}
|
|
4472
|
-
) : "refusal" in judged ? /* @__PURE__ */ jsxs17("span", { className: "flex flex-col gap-1", children: [
|
|
4473
|
-
/* @__PURE__ */ jsx19(
|
|
4486
|
+
) : "refusal" in judged ? /* @__PURE__ */ jsxs17("span", { "data-records-cell-note": "", className: "flex flex-col gap-1", children: [
|
|
4487
|
+
/* @__PURE__ */ jsx19(
|
|
4488
|
+
"span",
|
|
4489
|
+
{
|
|
4490
|
+
"data-records-typed-refusal": "",
|
|
4491
|
+
role: "status",
|
|
4492
|
+
title: "why" in judged ? judged.why : void 0,
|
|
4493
|
+
className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400",
|
|
4494
|
+
children: judged.refusal
|
|
4495
|
+
}
|
|
4496
|
+
),
|
|
4474
4497
|
judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx19("span", { "data-records-choice-ask": "", children: /* @__PURE__ */ jsx19(Button8, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
|
|
4475
|
-
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs17("span", { "data-records-typed-reads-as": "", className: "text-[10px] text-muted-foreground", children: [
|
|
4498
|
+
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs17("span", { "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
|
|
4476
4499
|
isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field2)}. ` : null,
|
|
4477
4500
|
"Reads as",
|
|
4478
4501
|
" ",
|
|
@@ -4566,9 +4589,9 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
4566
4589
|
return /* @__PURE__ */ jsx19(CheckboxControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
4567
4590
|
case "select":
|
|
4568
4591
|
case "multi_select":
|
|
4569
|
-
return /* @__PURE__ */ jsx19(OptionControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, addsChoices, initialSearch, asForm });
|
|
4592
|
+
return /* @__PURE__ */ jsx19(OptionControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm });
|
|
4570
4593
|
case "member":
|
|
4571
|
-
return /* @__PURE__ */ jsx19(PersonPicker, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, initialSearch });
|
|
4594
|
+
return /* @__PURE__ */ jsx19(PersonPicker, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
4572
4595
|
case "entity_reference":
|
|
4573
4596
|
return /* @__PURE__ */ jsx19(EntityReferenceControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
4574
4597
|
case "attachment":
|
|
@@ -4577,7 +4600,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
4577
4600
|
}
|
|
4578
4601
|
return /* @__PURE__ */ jsx19(RelationPicker, { field: field2, value, onChange, disabled, id: inputId });
|
|
4579
4602
|
case "relation":
|
|
4580
|
-
return /* @__PURE__ */ jsx19(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose });
|
|
4603
|
+
return /* @__PURE__ */ jsx19(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel });
|
|
4581
4604
|
default:
|
|
4582
4605
|
if (typeof value === "boolean" || field2.config?.["kind"] === "boolean") {
|
|
4583
4606
|
return /* @__PURE__ */ jsx19(
|
|
@@ -4605,6 +4628,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
4605
4628
|
function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
4606
4629
|
const [text, setText] = useState16(() => openingText(field2, value));
|
|
4607
4630
|
const [refusal4, setRefusal] = useState16(null);
|
|
4631
|
+
const [why, setWhy] = useState16(void 0);
|
|
4608
4632
|
const sent = useRef11(value);
|
|
4609
4633
|
useEffect11(() => {
|
|
4610
4634
|
if (value === sent.current) return;
|
|
@@ -4622,6 +4646,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
4622
4646
|
onChange(judged.value);
|
|
4623
4647
|
} else if (judged && "refusal" in judged) {
|
|
4624
4648
|
setRefusal(judged.refusal);
|
|
4649
|
+
setWhy("why" in judged ? judged.why : void 0);
|
|
4625
4650
|
}
|
|
4626
4651
|
};
|
|
4627
4652
|
return /* @__PURE__ */ jsxs17("span", { className: "flex flex-col gap-0.5", children: [
|
|
@@ -4645,7 +4670,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
4645
4670
|
),
|
|
4646
4671
|
helper && !disabled ? /* @__PURE__ */ jsx19(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field2) }) : null
|
|
4647
4672
|
] }),
|
|
4648
|
-
refusal4 ? /* @__PURE__ */ jsx19("span", { "data-records-typed-refusal": "", role: "status", className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: refusal4 }) : null
|
|
4673
|
+
refusal4 ? /* @__PURE__ */ jsx19("span", { "data-records-typed-refusal": "", "data-records-cell-note": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: refusal4 }) : null
|
|
4649
4674
|
] });
|
|
4650
4675
|
}
|
|
4651
4676
|
function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
@@ -4715,8 +4740,9 @@ function JsonControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
4715
4740
|
}
|
|
4716
4741
|
),
|
|
4717
4742
|
broken ? (
|
|
4718
|
-
// The typed text is still in the box: the notice owns the two doors out.
|
|
4719
|
-
|
|
4743
|
+
// The typed text is still in the box: the notice owns the two doors out. In a grid cell it
|
|
4744
|
+
// floats over the table (`data-records-cell-note`), so the row never grows.
|
|
4745
|
+
/* @__PURE__ */ jsx19("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ jsx19(
|
|
4720
4746
|
RefusalNotice,
|
|
4721
4747
|
{
|
|
4722
4748
|
error: broken,
|
|
@@ -4726,7 +4752,7 @@ function JsonControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
4726
4752
|
setBroken(null);
|
|
4727
4753
|
}
|
|
4728
4754
|
}
|
|
4729
|
-
)
|
|
4755
|
+
) })
|
|
4730
4756
|
) : null
|
|
4731
4757
|
] });
|
|
4732
4758
|
}
|
|
@@ -4739,7 +4765,7 @@ function inTheStoresOrder(options) {
|
|
|
4739
4765
|
const made = (o) => String(o.created_at ?? "");
|
|
4740
4766
|
return [...options].sort((a, b) => position(a) - position(b) || made(a).localeCompare(made(b)));
|
|
4741
4767
|
}
|
|
4742
|
-
function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen, onClose, addsChoices, initialSearch, asForm }) {
|
|
4768
|
+
function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm }) {
|
|
4743
4769
|
const client = useOptionalRecordsClient7();
|
|
4744
4770
|
const [options, setOptions] = useState16(null);
|
|
4745
4771
|
const [refusal4, setRefusal] = useState16(null);
|
|
@@ -4807,6 +4833,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
4807
4833
|
id,
|
|
4808
4834
|
autoOpen,
|
|
4809
4835
|
onClose,
|
|
4836
|
+
onCancel,
|
|
4810
4837
|
initialSearch,
|
|
4811
4838
|
addsChoices,
|
|
4812
4839
|
allowOther: allowsOtherValues(field2),
|
|
@@ -4887,6 +4914,7 @@ function OpenChoicePicker({
|
|
|
4887
4914
|
addsChoices,
|
|
4888
4915
|
autoOpen,
|
|
4889
4916
|
onClose,
|
|
4917
|
+
onCancel,
|
|
4890
4918
|
initialSearch,
|
|
4891
4919
|
allowOther = true,
|
|
4892
4920
|
onChoicesChanged
|
|
@@ -4954,10 +4982,9 @@ function OpenChoicePicker({
|
|
|
4954
4982
|
});
|
|
4955
4983
|
};
|
|
4956
4984
|
const offList = q !== "" && decided.decision !== "chosen" && decided.decision !== "empty";
|
|
4957
|
-
const nothingMatches = q !== "" && visible.length === 0;
|
|
4958
4985
|
const foot = null;
|
|
4959
4986
|
const add = offList && (decided.decision === "ask" || decided.decision === "add") ? { label: `Create \u201C${q}\u201D`, onAdd: addTyped, disabled: adding } : offList && decided.decision === "keep_as_typed" ? { label: `Use \u201C${q}\u201D`, onAdd: () => choose(q) } : null;
|
|
4960
|
-
const listed =
|
|
4987
|
+
const listed = visible;
|
|
4961
4988
|
const pickedOptions = current.map((v) => options.find((o) => isTheChosen(o, v)));
|
|
4962
4989
|
const cellChips = pickedWords.map((word, i) => {
|
|
4963
4990
|
const chip = chipOf(pickedOptions[i], word);
|
|
@@ -4985,6 +5012,7 @@ function OpenChoicePicker({
|
|
|
4985
5012
|
PickOrAdd,
|
|
4986
5013
|
{
|
|
4987
5014
|
anchored,
|
|
5015
|
+
...anchored && onCancel ? { onEscape: onCancel } : {},
|
|
4988
5016
|
chips: headChips,
|
|
4989
5017
|
multi: field2.multi,
|
|
4990
5018
|
triggerLabel: `Pick for ${fieldName(field2)}`,
|
|
@@ -4996,7 +5024,6 @@ function OpenChoicePicker({
|
|
|
4996
5024
|
setSearch(next);
|
|
4997
5025
|
setAddRefused(null);
|
|
4998
5026
|
},
|
|
4999
|
-
addFirst: nothingMatches,
|
|
5000
5027
|
items: listed.map((option) => ({
|
|
5001
5028
|
id: option.id,
|
|
5002
5029
|
label: titleOf(option),
|
|
@@ -6599,8 +6626,9 @@ function cardWords(record, field2, labels) {
|
|
|
6599
6626
|
|
|
6600
6627
|
// src/gridEditing.tsx
|
|
6601
6628
|
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6602
|
-
var
|
|
6603
|
-
var
|
|
6629
|
+
var FLOATING_CELL_NOTE_CLASS = "[&_[data-records-cell-note]]:absolute [&_[data-records-cell-note]]:bottom-full [&_[data-records-cell-note]]:left-0 [&_[data-records-cell-note]]:z-[26] [&_[data-records-cell-note]]:mb-1 [&_[data-records-cell-note]]:w-max [&_[data-records-cell-note]]:max-w-[24rem] [&_[data-records-cell-note]]:rounded-md [&_[data-records-cell-note]]:border [&_[data-records-cell-note]]:bg-popover [&_[data-records-cell-note]]:px-1.5 [&_[data-records-cell-note]]:py-0.5 [&_[data-records-cell-note]]:shadow-md";
|
|
6630
|
+
var FLOATING_CELL_TRAY_CLASS = "absolute left-0 top-full z-[26] mt-1 flex w-max max-w-[24rem] flex-col items-start gap-1";
|
|
6631
|
+
var FLOATING_CELL_TRAY_PIECE_CLASS = "rounded-md border bg-popover px-1.5 py-0.5 shadow-md";
|
|
6604
6632
|
var NO_ROWS = [];
|
|
6605
6633
|
function asksWhoChanged(event) {
|
|
6606
6634
|
return event.altKey && event.shiftKey && !event.metaKey && !event.ctrlKey && (event.code === "KeyH" || event.key.toLowerCase() === "h");
|
|
@@ -7176,8 +7204,18 @@ function GridCell({
|
|
|
7176
7204
|
const onLinkClickCapture = (event) => {
|
|
7177
7205
|
const link = event.target instanceof Element ? event.target.closest("a[href]") : null;
|
|
7178
7206
|
if (!(link instanceof HTMLElement) || !event.currentTarget.contains(link) || event.detail === 0) return;
|
|
7207
|
+
if (event.metaKey || event.ctrlKey || event.shiftKey) {
|
|
7208
|
+
cancelSinglePress();
|
|
7209
|
+
event.stopPropagation();
|
|
7210
|
+
return;
|
|
7211
|
+
}
|
|
7179
7212
|
event.preventDefault();
|
|
7180
7213
|
const cellTakesIt = editable && (clickOpens || opensAsAList(field2, hostTakesFiles(ui)));
|
|
7214
|
+
if (cellTakesIt && event.detail === 1 && (clickOpens || wasActive.current)) {
|
|
7215
|
+
cancelSinglePress();
|
|
7216
|
+
openThisCell(event);
|
|
7217
|
+
return;
|
|
7218
|
+
}
|
|
7181
7219
|
if (event.detail === 1 && wasActive.current && !cellTakesIt) afterSinglePress(() => link.click());
|
|
7182
7220
|
else cancelSinglePress();
|
|
7183
7221
|
};
|
|
@@ -7186,32 +7224,46 @@ function GridCell({
|
|
|
7186
7224
|
const refusal4 = editing ? editing.refusalOf(row.id, field2.key) : null;
|
|
7187
7225
|
const editable = Boolean(editing) && canWrite && fieldIsEditable(field2);
|
|
7188
7226
|
if (open && editing) {
|
|
7189
|
-
return /* @__PURE__ */
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7227
|
+
return /* @__PURE__ */ jsxs23("span", { "data-records-open-cell": "", className: "relative block w-full min-w-0", children: [
|
|
7228
|
+
/* @__PURE__ */ jsx28("span", { "aria-hidden": "true", "data-records-cell-ghost": "", className: "pointer-events-none invisible block select-none truncate px-1 py-0.5", children: /* @__PURE__ */ jsx28(
|
|
7229
|
+
RecordValue,
|
|
7230
|
+
{
|
|
7231
|
+
inCell: true,
|
|
7232
|
+
field: field2,
|
|
7233
|
+
value: row.document?.[field2.key],
|
|
7234
|
+
document: row.document,
|
|
7235
|
+
recordId: row.id,
|
|
7236
|
+
withheld: withheldNoticeOf(row.hidden, field2.key),
|
|
7237
|
+
...format ? { format } : {}
|
|
7238
|
+
}
|
|
7239
|
+
) }),
|
|
7240
|
+
/* @__PURE__ */ jsx28(
|
|
7241
|
+
OpenCell,
|
|
7242
|
+
{
|
|
7243
|
+
field: field2,
|
|
7244
|
+
draft: editing.draft,
|
|
7245
|
+
initialSearch: editing.searchSeed,
|
|
7246
|
+
onType: editing.type,
|
|
7247
|
+
onCommit: (move, via) => editing.commit(move, via),
|
|
7248
|
+
onCancel: (via) => editing.cancel(via),
|
|
7249
|
+
below: (
|
|
7250
|
+
// KEPT EDITING: the refusal stays beside the value it is about, so the
|
|
7251
|
+
// person reads what to change while changing it. Keep editing is the
|
|
7252
|
+
// state they are in, so only Discard is offered. It is INSIDE the open
|
|
7253
|
+
// cell, so pressing Discard is not "focus left the cell" — which would
|
|
7254
|
+
// commit the refused value one more time on its way out.
|
|
7255
|
+
refusal4 && !refusal4.conflict ? /* @__PURE__ */ jsx28(
|
|
7256
|
+
RefusalNotice,
|
|
7257
|
+
{
|
|
7258
|
+
error: refusal4.error,
|
|
7259
|
+
className: "py-1.5 text-left",
|
|
7260
|
+
onDiscard: () => editing.discard(row.id, field2.key)
|
|
7261
|
+
}
|
|
7262
|
+
) : null
|
|
7263
|
+
)
|
|
7264
|
+
}
|
|
7265
|
+
)
|
|
7266
|
+
] });
|
|
7215
7267
|
}
|
|
7216
7268
|
if (editorKindFor(field2) === "checkbox") {
|
|
7217
7269
|
const answered = value === true || value === false;
|
|
@@ -7561,8 +7613,9 @@ function OpenCell({
|
|
|
7561
7613
|
"data-matrx-cell-editor": "",
|
|
7562
7614
|
tabIndex: -1,
|
|
7563
7615
|
className: cn19(
|
|
7564
|
-
|
|
7565
|
-
|
|
7616
|
+
// OVER the cell's ghost (see `data-records-open-cell`), never in the table's measuring.
|
|
7617
|
+
"absolute inset-x-0 top-1/2 z-[25] flex w-full min-w-0 max-w-full -translate-y-1/2 flex-col gap-1 outline-none",
|
|
7618
|
+
FLOATING_CELL_NOTE_CLASS,
|
|
7566
7619
|
// A field's own input is 36px (h-9); in a 35px row it grew the row 4px. In the cell it is
|
|
7567
7620
|
// the row action strip's 32px, so opening a cell never changes the row (STABLE-TABLES).
|
|
7568
7621
|
"[&_input:not([type=checkbox]):not([type=radio])]:h-8 [&_input:not([type=checkbox]):not([type=radio])]:py-0"
|
|
@@ -7621,11 +7674,13 @@ function OpenCell({
|
|
|
7621
7674
|
addsChoices: true
|
|
7622
7675
|
}
|
|
7623
7676
|
),
|
|
7624
|
-
|
|
7625
|
-
/* @__PURE__ */ jsx28(
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7677
|
+
/* @__PURE__ */ jsxs23("span", { "data-records-cell-tray": "", className: FLOATING_CELL_TRAY_CLASS, children: [
|
|
7678
|
+
picker || asksAboutAChoice(draft) ? null : blurCommits ? /* @__PURE__ */ jsx28("span", { className: cn19("pointer-events-none text-[10px] text-muted-foreground", FLOATING_CELL_TRAY_PIECE_CLASS), "data-records-editor-hint": "", children: multiline ? "\u23CE saves \xB7 \u21E7\u23CE new line \xB7 Esc cancels \xB7 Tab next" : "\u23CE saves \xB7 Esc cancels \xB7 Tab next" }) : /* @__PURE__ */ jsxs23("span", { className: cn19("flex items-center gap-1", FLOATING_CELL_TRAY_PIECE_CLASS), children: [
|
|
7679
|
+
/* @__PURE__ */ jsx28(Button10, { size: "sm", onClick: () => once(() => onCommit(null, "pick")), children: "Save" }),
|
|
7680
|
+
/* @__PURE__ */ jsx28(Button10, { size: "sm", variant: "ghost", onClick: () => once(() => onCancel("pick")), children: "Cancel" })
|
|
7681
|
+
] }),
|
|
7682
|
+
below ? /* @__PURE__ */ jsx28("span", { className: "block bg-popover shadow-md", children: below }) : null
|
|
7683
|
+
] })
|
|
7629
7684
|
]
|
|
7630
7685
|
}
|
|
7631
7686
|
);
|
|
@@ -10890,11 +10945,11 @@ function FieldEditor(props) {
|
|
|
10890
10945
|
Checkbox6,
|
|
10891
10946
|
{
|
|
10892
10947
|
checked: required,
|
|
10893
|
-
"aria-label": "
|
|
10948
|
+
"aria-label": "Required",
|
|
10894
10949
|
onCheckedChange: (v) => setRequired(v === true)
|
|
10895
10950
|
}
|
|
10896
10951
|
),
|
|
10897
|
-
"Every record has to have one"
|
|
10952
|
+
/* @__PURE__ */ jsx40("span", { title: "Every record has to have one", children: "Required" })
|
|
10898
10953
|
] }),
|
|
10899
10954
|
offersMany ? /* @__PURE__ */ jsxs35("label", { className: "flex items-center gap-1.5", children: [
|
|
10900
10955
|
/* @__PURE__ */ jsx40(
|
|
@@ -14504,7 +14559,7 @@ function useMergedGridControls(args) {
|
|
|
14504
14559
|
children: /* @__PURE__ */ jsxs47(DialogContent8, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", children: [
|
|
14505
14560
|
/* @__PURE__ */ jsxs47(DialogHeader8, { children: [
|
|
14506
14561
|
/* @__PURE__ */ jsx52(DialogTitle8, { children: dialog?.kind === "settings" ? `Column settings \xB7 ${fieldName(dialog.field)}` : dialog?.kind === "insert" && dialog.anchor ? `Add column ${dialog.side === "left" ? "left" : "right"} of ${fieldOf2(dialog.anchor) ? fieldName(fieldOf2(dialog.anchor)) : dialog.anchor}` : ADD_FIELD_OPEN_LABEL }),
|
|
14507
|
-
/* @__PURE__ */ jsx52(DialogDescription6, { className: "sr-only", children: "
|
|
14562
|
+
/* @__PURE__ */ jsx52(DialogDescription6, { className: "sr-only", children: "Name, type and look" })
|
|
14508
14563
|
] }),
|
|
14509
14564
|
dialog?.kind === "settings" ? /* @__PURE__ */ jsx52(
|
|
14510
14565
|
FieldEditor,
|
|
@@ -19022,6 +19077,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, className }) {
|
|
|
19022
19077
|
// src/tableShape.ts
|
|
19023
19078
|
import { codeSpanText as codeSpanText2, mapInlineCodeSpans } from "@ai-matrx/content-ir/source";
|
|
19024
19079
|
import { humanizeIdentifier as humanizeIdentifier9 } from "@ai-matrx/kit/text-case";
|
|
19080
|
+
import { parseDelimited as readDelimited } from "@ai-matrx/kit/delimited";
|
|
19025
19081
|
var FEWEST_LIST_ITEMS = 2;
|
|
19026
19082
|
var FEWEST_KEY_VALUE_PAIRS = 2;
|
|
19027
19083
|
var LONGEST_TEXT_READ = 2e6;
|
|
@@ -19199,38 +19255,7 @@ function shapeFromList(items, name, at) {
|
|
|
19199
19255
|
};
|
|
19200
19256
|
}
|
|
19201
19257
|
function parseDelimited(text, delimiter) {
|
|
19202
|
-
|
|
19203
|
-
let row = [];
|
|
19204
|
-
let cell2 = "";
|
|
19205
|
-
let quoted2 = false;
|
|
19206
|
-
for (let i = 0; i < text.length; i += 1) {
|
|
19207
|
-
const ch = text[i];
|
|
19208
|
-
if (quoted2) {
|
|
19209
|
-
if (ch === '"') {
|
|
19210
|
-
if (text[i + 1] === '"') {
|
|
19211
|
-
cell2 += '"';
|
|
19212
|
-
i += 1;
|
|
19213
|
-
} else quoted2 = false;
|
|
19214
|
-
} else cell2 += ch;
|
|
19215
|
-
continue;
|
|
19216
|
-
}
|
|
19217
|
-
if (ch === '"' && cell2.trim() === "") quoted2 = true;
|
|
19218
|
-
else if (ch === delimiter) {
|
|
19219
|
-
row.push(cell2);
|
|
19220
|
-
cell2 = "";
|
|
19221
|
-
} else if (ch === "\n" || ch === "\r") {
|
|
19222
|
-
if (ch === "\r" && text[i + 1] === "\n") i += 1;
|
|
19223
|
-
row.push(cell2);
|
|
19224
|
-
rows.push(row);
|
|
19225
|
-
row = [];
|
|
19226
|
-
cell2 = "";
|
|
19227
|
-
} else cell2 += ch;
|
|
19228
|
-
}
|
|
19229
|
-
if (cell2.length > 0 || row.length > 0) {
|
|
19230
|
-
row.push(cell2);
|
|
19231
|
-
rows.push(row);
|
|
19232
|
-
}
|
|
19233
|
-
return rows.filter((r) => r.some((c) => c.trim() !== ""));
|
|
19258
|
+
return readDelimited(text, { delimiter, skipEmptyLines: "greedy" }).data;
|
|
19234
19259
|
}
|
|
19235
19260
|
function delimitedShape(text, delimiter, fenced, at, name) {
|
|
19236
19261
|
const matrix = parseDelimited(text.trim(), delimiter);
|
|
@@ -23204,7 +23229,7 @@ function GridBody({
|
|
|
23204
23229
|
{
|
|
23205
23230
|
...fills ? { className: "min-h-0 flex-1" } : {},
|
|
23206
23231
|
frameHeight: fills ? "fill" : "content",
|
|
23207
|
-
loadingRows: fills ? "fill" :
|
|
23232
|
+
loadingRows: rememberedRowCount(rowMemoryKey, pageSize, fills ? "fill" : 5),
|
|
23208
23233
|
...!look.rowHeight ? { loadingRowHeight: RECORDS_GRID_ROW_PX } : {},
|
|
23209
23234
|
data: rows,
|
|
23210
23235
|
columns: tableColumns,
|
|
@@ -27182,7 +27207,7 @@ function SaveToTable({ source, shapeIndex = 0, onOpenTable, onSaved, onClose, cl
|
|
|
27182
27207
|
},
|
|
27183
27208
|
variant: "destructive",
|
|
27184
27209
|
title: `Move every row of \u201C${writable.find((t) => t.id === tableId)?.name ?? "this table"}\u201D to the archive?`,
|
|
27185
|
-
description: "
|
|
27210
|
+
description: "Restorable from Archived items",
|
|
27186
27211
|
confirmLabel: replacing ? "Archiving\u2026" : "Archive them",
|
|
27187
27212
|
cancelLabel: "Keep them",
|
|
27188
27213
|
busy: replacing,
|
|
@@ -28696,18 +28721,25 @@ function RecordFieldsInPlace({
|
|
|
28696
28721
|
const format = formatForField(field2);
|
|
28697
28722
|
return /* @__PURE__ */ jsxs85("div", { className: "contents", children: [
|
|
28698
28723
|
/* @__PURE__ */ jsx94("dt", { className: "flex items-baseline gap-1 truncate py-1 text-muted-foreground", children: renderLabel(field2) }),
|
|
28699
|
-
/* @__PURE__ */ jsx94(
|
|
28700
|
-
|
|
28724
|
+
/* @__PURE__ */ jsx94(
|
|
28725
|
+
"dd",
|
|
28701
28726
|
{
|
|
28702
|
-
|
|
28703
|
-
|
|
28704
|
-
|
|
28705
|
-
|
|
28706
|
-
|
|
28707
|
-
|
|
28708
|
-
|
|
28727
|
+
className: "min-w-0 rounded hover:bg-muted/50 [&_[data-matrx-cell-editor]_input:not([type=checkbox]):not([type=radio])]:!h-7",
|
|
28728
|
+
"data-records-in-place-field": field2.key,
|
|
28729
|
+
children: /* @__PURE__ */ jsx94(
|
|
28730
|
+
GridCell,
|
|
28731
|
+
{
|
|
28732
|
+
field: field2,
|
|
28733
|
+
row,
|
|
28734
|
+
editing: canWrite ? editing : null,
|
|
28735
|
+
canWrite,
|
|
28736
|
+
whyNot,
|
|
28737
|
+
clickOpens: true,
|
|
28738
|
+
...format ? { format } : {}
|
|
28739
|
+
}
|
|
28740
|
+
)
|
|
28709
28741
|
}
|
|
28710
|
-
)
|
|
28742
|
+
)
|
|
28711
28743
|
] }, field2.id);
|
|
28712
28744
|
}) }),
|
|
28713
28745
|
/* @__PURE__ */ jsx94(UndoNotice, { undo })
|
|
@@ -28904,7 +28936,7 @@ function AddBody({ tableId }) {
|
|
|
28904
28936
|
const made = await mutation.declare({ table_id: tableId, spec: { label: BODY_COLUMN_NAME, type: "rich_text" } });
|
|
28905
28937
|
if (made) tableShapeChanged10(tableId);
|
|
28906
28938
|
},
|
|
28907
|
-
children: "
|
|
28939
|
+
children: "Add notes"
|
|
28908
28940
|
}
|
|
28909
28941
|
),
|
|
28910
28942
|
mutation.error ? /* @__PURE__ */ jsx96(RefusalNotice, { error: mutation.error }) : null
|
|
@@ -29049,7 +29081,7 @@ function computedInPlainWords(row, field2) {
|
|
|
29049
29081
|
const shown4 = row.value === null || row.value === void 0 || row.value === "" ? "nothing" : field2 ? scalarText(field2, row.value) : String(row.value);
|
|
29050
29082
|
const when = new Date(row.computed_at);
|
|
29051
29083
|
const at = Number.isNaN(when.getTime()) ? "" : ` on ${when.toLocaleDateString()}`;
|
|
29052
|
-
return `${name}
|
|
29084
|
+
return `${name}: ${shown4}${at}`;
|
|
29053
29085
|
}
|
|
29054
29086
|
|
|
29055
29087
|
// src/systemTable.ts
|
|
@@ -29279,7 +29311,10 @@ async function keepLook(client, tableId, viewId, look) {
|
|
|
29279
29311
|
return client.viewLookSet({ table_id: tableId, view_id: viewId, look: doc && Object.keys(doc).length > 0 ? doc : null });
|
|
29280
29312
|
}
|
|
29281
29313
|
var LOOK_WORDS = {
|
|
29314
|
+
/** The reason, for a tooltip or a screen reader — never a line on the page (interface-text). */
|
|
29282
29315
|
yours: "You changed how this view looks. Only you see it.",
|
|
29316
|
+
/** The visible label for the same fact. */
|
|
29317
|
+
yoursLabel: "Only you see this",
|
|
29283
29318
|
saveToView: "Save to view",
|
|
29284
29319
|
saveAsNew: "Save as new view",
|
|
29285
29320
|
reset: "Reset to view",
|
|
@@ -39014,7 +39049,7 @@ function WebhooksPanel({ tableId, className }) {
|
|
|
39014
39049
|
if (!next && !busy) setStopping(null);
|
|
39015
39050
|
},
|
|
39016
39051
|
title: `Stop sending to ${stopping?.description ?? stopping?.target_url ?? "this address"}?`,
|
|
39017
|
-
description: "
|
|
39052
|
+
description: "Kept, switched off",
|
|
39018
39053
|
confirmLabel: "Switch off",
|
|
39019
39054
|
cancelLabel: "Keep sending",
|
|
39020
39055
|
busy,
|
|
@@ -41497,6 +41532,39 @@ function useLinkGroupNamer(block, tableId) {
|
|
|
41497
41532
|
}, [named, choices, labels]);
|
|
41498
41533
|
}
|
|
41499
41534
|
|
|
41535
|
+
// src/measureWords.ts
|
|
41536
|
+
import { useEffect as useEffect97, useState as useState111 } from "react";
|
|
41537
|
+
import { useOptionalRecordsClient as useOptionalRecordsClient13 } from "@ai-matrx/records/react";
|
|
41538
|
+
import { humanizeIdentifier as humanizeIdentifier18 } from "@ai-matrx/kit/text-case";
|
|
41539
|
+
var OP_WORD = { sum: "Total", avg: "Average", min: "Lowest", max: "Highest" };
|
|
41540
|
+
function measureWords(key, fields) {
|
|
41541
|
+
if (key === "count") return "How many";
|
|
41542
|
+
const at = key.indexOf("_");
|
|
41543
|
+
if (at < 0) return humanizeIdentifier18(key);
|
|
41544
|
+
const op2 = key.slice(0, at);
|
|
41545
|
+
const column = key.slice(at + 1);
|
|
41546
|
+
const field2 = fields?.find((f) => f.key === column);
|
|
41547
|
+
const name = field2 ? fieldName(field2) : humanizeIdentifier18(column);
|
|
41548
|
+
const word = OP_WORD[op2];
|
|
41549
|
+
return word ? `${word} ${name.charAt(0).toLowerCase()}${name.slice(1)}` : `${humanizeIdentifier18(op2)} ${name}`;
|
|
41550
|
+
}
|
|
41551
|
+
function useMeasureWords(key, tableId) {
|
|
41552
|
+
const client = useOptionalRecordsClient13();
|
|
41553
|
+
const [fields, setFields] = useState111(null);
|
|
41554
|
+
const needs = key !== "count";
|
|
41555
|
+
useEffect97(() => {
|
|
41556
|
+
if (!client || !tableId || !needs) return;
|
|
41557
|
+
let cancelled = false;
|
|
41558
|
+
void client.fields({ table_id: tableId }).then((result) => {
|
|
41559
|
+
if (!cancelled && result.ok) setFields(result.data);
|
|
41560
|
+
});
|
|
41561
|
+
return () => {
|
|
41562
|
+
cancelled = true;
|
|
41563
|
+
};
|
|
41564
|
+
}, [client, tableId, needs]);
|
|
41565
|
+
return measureWords(key, fields);
|
|
41566
|
+
}
|
|
41567
|
+
|
|
41500
41568
|
// src/ChartBlock.tsx
|
|
41501
41569
|
import { Fragment as Fragment52, jsx as jsx134, jsxs as jsxs124 } from "react/jsx-runtime";
|
|
41502
41570
|
var priorKey = (key) => `prior__${key}`;
|
|
@@ -41575,6 +41643,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
41575
41643
|
const series = compared ? [primary, priorKey(primary)] : [primary];
|
|
41576
41644
|
const target = kind === "stuck" ? null : block.target ?? null;
|
|
41577
41645
|
const named = useLinkGroupNamer(source ? NO_GROUPS : block, tableId);
|
|
41646
|
+
const measureName = useMeasureWords(primary, tableId);
|
|
41578
41647
|
const points = useMemo66(() => {
|
|
41579
41648
|
if (kind === "stuck") return [];
|
|
41580
41649
|
const rows = block.rows ?? [];
|
|
@@ -41602,7 +41671,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
41602
41671
|
const config = useMemo66(() => {
|
|
41603
41672
|
const out = {};
|
|
41604
41673
|
out[primary] = {
|
|
41605
|
-
label: windows ? windowName(windows.window, windows.period) :
|
|
41674
|
+
label: windows ? windowName(windows.window, windows.period) : measureName,
|
|
41606
41675
|
color: SERIES_COLORS[0]
|
|
41607
41676
|
};
|
|
41608
41677
|
if (windows) {
|
|
@@ -41615,7 +41684,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
41615
41684
|
out[point.label] ??= { label: point.label, color: SERIES_COLORS[index % SERIES_COLORS.length] };
|
|
41616
41685
|
});
|
|
41617
41686
|
return out;
|
|
41618
|
-
}, [primary, windows, points]);
|
|
41687
|
+
}, [primary, measureName, windows, points]);
|
|
41619
41688
|
const goal = target && typeof target.value === "number" ? {
|
|
41620
41689
|
value: typeof target.pace === "number" ? target.pace : block.bucket ? null : target.value,
|
|
41621
41690
|
label: typeof target.pace === "number" && target.per !== "bucket" ? `${target.label} pace` : target.label
|
|
@@ -41660,7 +41729,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
41660
41729
|
/* @__PURE__ */ jsx134("span", { children: pretty(block.totals.current) }),
|
|
41661
41730
|
/* @__PURE__ */ jsx134(Trend, { pct: block.totals.change_pct, aimingUp: !!target })
|
|
41662
41731
|
] }) : null,
|
|
41663
|
-
/* @__PURE__ */ jsx134("span", { className: "ml-auto shrink-0 text-muted-foreground", children: kind === "stuck" ? `${block.days ?? 14} days` :
|
|
41732
|
+
/* @__PURE__ */ jsx134("span", { className: "ml-auto shrink-0 text-muted-foreground", children: kind === "stuck" ? `${block.days ?? 14} days` : measureName })
|
|
41664
41733
|
] }),
|
|
41665
41734
|
block.compare_refused ? /* @__PURE__ */ jsx134("p", { className: "px-1 text-xs text-muted-foreground", children: block.compare_refused }) : null,
|
|
41666
41735
|
!block.refused && targetNote(target) ? /* @__PURE__ */ jsx134("p", { className: "px-1 text-xs text-muted-foreground", children: targetNote(target) }) : null,
|
|
@@ -41957,7 +42026,7 @@ function onlyWholeNumbers(rows) {
|
|
|
41957
42026
|
}
|
|
41958
42027
|
|
|
41959
42028
|
// src/DashboardCanvas.tsx
|
|
41960
|
-
import { useCallback as useCallback58, useEffect as
|
|
42029
|
+
import { useCallback as useCallback58, useEffect as useEffect99, useMemo as useMemo69, useState as useState114 } from "react";
|
|
41961
42030
|
import { useFields as useFields29, useRecordsClient as useRecordsClient85, useTable as useTable31 } from "@ai-matrx/records/react";
|
|
41962
42031
|
import {
|
|
41963
42032
|
BasicInput as BasicInput30,
|
|
@@ -42125,7 +42194,7 @@ function GridCell2({
|
|
|
42125
42194
|
}
|
|
42126
42195
|
|
|
42127
42196
|
// src/AddChart.tsx
|
|
42128
|
-
import { useMemo as useMemo68, useState as
|
|
42197
|
+
import { useMemo as useMemo68, useState as useState113 } from "react";
|
|
42129
42198
|
import { useFields as useFields28, useRecordsClient as useRecordsClient84 } from "@ai-matrx/records/react";
|
|
42130
42199
|
import {
|
|
42131
42200
|
Button as Button90,
|
|
@@ -42137,7 +42206,7 @@ import {
|
|
|
42137
42206
|
} from "@ai-matrx/design-system";
|
|
42138
42207
|
|
|
42139
42208
|
// src/TablePickers.tsx
|
|
42140
|
-
import { useEffect as
|
|
42209
|
+
import { useEffect as useEffect98, useMemo as useMemo67, useState as useState112 } from "react";
|
|
42141
42210
|
import { RecordsProvider as RecordsProvider2, useFields as useFields27, useRecords as useRecords7, useTable as useTable30 } from "@ai-matrx/records/react";
|
|
42142
42211
|
import { Button as Button89, CreatablePicker as CreatablePicker2 } from "@ai-matrx/design-system";
|
|
42143
42212
|
|
|
@@ -42255,8 +42324,8 @@ function readTablesAnywhere(dataSource) {
|
|
|
42255
42324
|
return read;
|
|
42256
42325
|
}
|
|
42257
42326
|
function useTablesAnywhere(dataSource) {
|
|
42258
|
-
const [state, setState] =
|
|
42259
|
-
|
|
42327
|
+
const [state, setState] = useState112({ loading: true, error: null, rows: [] });
|
|
42328
|
+
useEffect98(() => {
|
|
42260
42329
|
let live = true;
|
|
42261
42330
|
void readTablesAnywhere(dataSource).then((result) => {
|
|
42262
42331
|
if (live) setState(result);
|
|
@@ -42333,7 +42402,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
42333
42402
|
const all = useMemo67(() => fields.data ?? [], [fields.data]);
|
|
42334
42403
|
const byKey = useMemo67(() => new Map(all.map((f) => [f.key, f])), [all]);
|
|
42335
42404
|
const keys = Object.keys(value);
|
|
42336
|
-
const [adding, setAdding] =
|
|
42405
|
+
const [adding, setAdding] = useState112(false);
|
|
42337
42406
|
const optionsFor = (current) => all.filter((f) => f.key === current || !(f.key in value)).map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
42338
42407
|
const rename = (from, to) => {
|
|
42339
42408
|
if (from === to) return;
|
|
@@ -42489,7 +42558,7 @@ function chartSpecFrom(args) {
|
|
|
42489
42558
|
}
|
|
42490
42559
|
function AddChart({ subject, onAdd, onClose }) {
|
|
42491
42560
|
const client = useRecordsClient84();
|
|
42492
|
-
const [tableId, setTableId] =
|
|
42561
|
+
const [tableId, setTableId] = useState113(subject);
|
|
42493
42562
|
const fields = useFields28(tableId);
|
|
42494
42563
|
const all = useMemo68(() => onePerKey(fields.data ?? []), [fields.data]);
|
|
42495
42564
|
const labels = useRecordLabels(all);
|
|
@@ -42497,11 +42566,11 @@ function AddChart({ subject, onAdd, onClose }) {
|
|
|
42497
42566
|
const field2 = all.find((f) => f.key === key);
|
|
42498
42567
|
return field2 ? scalarText(field2, value, labels) : String(value);
|
|
42499
42568
|
};
|
|
42500
|
-
const [measureKey5, setMeasureKey] =
|
|
42501
|
-
const [splitKey, setSplitKey] =
|
|
42502
|
-
const [kind, setKind] =
|
|
42503
|
-
const [filter, setFilter] =
|
|
42504
|
-
const [saving, setSaving] =
|
|
42569
|
+
const [measureKey5, setMeasureKey] = useState113("count");
|
|
42570
|
+
const [splitKey, setSplitKey] = useState113("none");
|
|
42571
|
+
const [kind, setKind] = useState113("auto");
|
|
42572
|
+
const [filter, setFilter] = useState113({});
|
|
42573
|
+
const [saving, setSaving] = useState113(false);
|
|
42505
42574
|
const numbers = numberColumns(all);
|
|
42506
42575
|
const choices = offerableFields(all, "choice");
|
|
42507
42576
|
const dates = offerableFields(all, "date");
|
|
@@ -42648,20 +42717,20 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
42648
42717
|
const table = useTable31(tableId);
|
|
42649
42718
|
const rights = useTableRights(table.data);
|
|
42650
42719
|
const fields = useFields29(tableId);
|
|
42651
|
-
const [boards, setBoards] =
|
|
42652
|
-
const [pages, setPages] =
|
|
42653
|
-
const [error, setError] =
|
|
42654
|
-
const [activeId, setActiveId] =
|
|
42655
|
-
const [madeOnMount, setMadeOnMount] =
|
|
42656
|
-
const [askingToRemove, setAskingToRemove] =
|
|
42657
|
-
const [run, setRun] =
|
|
42658
|
-
const [running, setRunning] =
|
|
42659
|
-
const [question, setQuestion] =
|
|
42660
|
-
const [asking, setAsking] =
|
|
42661
|
-
const [scheduling, setScheduling] =
|
|
42662
|
-
const [arranging, setArranging] =
|
|
42663
|
-
const [adding, setAdding] =
|
|
42664
|
-
const [grain, setGrain] =
|
|
42720
|
+
const [boards, setBoards] = useState114(null);
|
|
42721
|
+
const [pages, setPages] = useState114([]);
|
|
42722
|
+
const [error, setError] = useState114(null);
|
|
42723
|
+
const [activeId, setActiveId] = useState114(activeDashboardId ?? null);
|
|
42724
|
+
const [madeOnMount, setMadeOnMount] = useState114("waiting");
|
|
42725
|
+
const [askingToRemove, setAskingToRemove] = useState114(null);
|
|
42726
|
+
const [run, setRun] = useState114(null);
|
|
42727
|
+
const [running, setRunning] = useState114(false);
|
|
42728
|
+
const [question, setQuestion] = useState114("");
|
|
42729
|
+
const [asking, setAsking] = useState114(false);
|
|
42730
|
+
const [scheduling, setScheduling] = useState114(false);
|
|
42731
|
+
const [arranging, setArranging] = useState114(false);
|
|
42732
|
+
const [adding, setAdding] = useState114(false);
|
|
42733
|
+
const [grain, setGrain] = useState114(null);
|
|
42665
42734
|
const runArgs = (dashboard_id) => ({
|
|
42666
42735
|
dashboard_id,
|
|
42667
42736
|
...filter ? { filter } : {},
|
|
@@ -42679,11 +42748,11 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
42679
42748
|
setBoards(read);
|
|
42680
42749
|
return read;
|
|
42681
42750
|
}, [client, tableId]);
|
|
42682
|
-
const [notKept, setNotKept] =
|
|
42683
|
-
|
|
42751
|
+
const [notKept, setNotKept] = useState114(null);
|
|
42752
|
+
useEffect99(() => {
|
|
42684
42753
|
void load();
|
|
42685
42754
|
}, [load]);
|
|
42686
|
-
|
|
42755
|
+
useEffect99(() => {
|
|
42687
42756
|
if (!boards || boards.length === 0) return;
|
|
42688
42757
|
if (createOnMount && madeOnMount !== "done") return;
|
|
42689
42758
|
const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
|
|
@@ -42691,7 +42760,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
42691
42760
|
}, [boards, activeDashboardId, madeOnMount]);
|
|
42692
42761
|
const board = useMemo69(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
|
|
42693
42762
|
const filterKey = JSON.stringify(filter ?? {});
|
|
42694
|
-
|
|
42763
|
+
useEffect99(() => {
|
|
42695
42764
|
if (!activeId) {
|
|
42696
42765
|
setRun(null);
|
|
42697
42766
|
return;
|
|
@@ -42761,7 +42830,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
42761
42830
|
]
|
|
42762
42831
|
);
|
|
42763
42832
|
}
|
|
42764
|
-
|
|
42833
|
+
useEffect99(() => {
|
|
42765
42834
|
if (!createOnMount || madeOnMount !== "waiting" || boards === null || !fields.data) return;
|
|
42766
42835
|
setMadeOnMount("making");
|
|
42767
42836
|
void create().then(() => setMadeOnMount("done"));
|
|
@@ -43206,10 +43275,10 @@ function TargetControl({
|
|
|
43206
43275
|
onChange
|
|
43207
43276
|
}) {
|
|
43208
43277
|
const saved = !block.target ? "none" : "field" in block.target && block.target.field ? "field" : "value";
|
|
43209
|
-
const [mode, setMode] =
|
|
43278
|
+
const [mode, setMode] = useState114(saved);
|
|
43210
43279
|
const savedValue = block.target && "value" in block.target && typeof block.target.value === "number" ? block.target.value : null;
|
|
43211
|
-
const [draft, setDraft] =
|
|
43212
|
-
|
|
43280
|
+
const [draft, setDraft] = useState114(savedValue === null ? "" : String(savedValue));
|
|
43281
|
+
useEffect99(() => {
|
|
43213
43282
|
setMode(saved);
|
|
43214
43283
|
setDraft(savedValue === null ? "" : String(savedValue));
|
|
43215
43284
|
}, [saved, savedValue]);
|
|
@@ -43277,7 +43346,7 @@ function TargetControl({
|
|
|
43277
43346
|
|
|
43278
43347
|
// src/QuestionPanel.tsx
|
|
43279
43348
|
import { copyText as copyText8 } from "@ai-matrx/kit/clipboard";
|
|
43280
|
-
import { useEffect as
|
|
43349
|
+
import { useEffect as useEffect100, useMemo as useMemo70, useRef as useRef54, useState as useState115 } from "react";
|
|
43281
43350
|
import { Badge as Badge23, BasicInput as BasicInput31, Button as Button92, Checkbox as Checkbox16, Label as Label23, Skeleton as Skeleton34, cn as cn84 } from "@ai-matrx/design-system";
|
|
43282
43351
|
import { useFields as useFields30, useRecordsClient as useRecordsClient86 } from "@ai-matrx/records/react";
|
|
43283
43352
|
|
|
@@ -43694,9 +43763,9 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
43694
43763
|
const fields = useFields30(tableId);
|
|
43695
43764
|
const all = useMemo70(() => fields.data ?? [], [fields.data]);
|
|
43696
43765
|
const me = client.config.actor?.user_id ?? null;
|
|
43697
|
-
const [hidden, setHidden] =
|
|
43698
|
-
const [related, setRelated] =
|
|
43699
|
-
|
|
43766
|
+
const [hidden, setHidden] = useState115(null);
|
|
43767
|
+
const [related, setRelated] = useState115({});
|
|
43768
|
+
useEffect100(() => {
|
|
43700
43769
|
if (all.length === 0) {
|
|
43701
43770
|
if (!fields.loading) setHidden(/* @__PURE__ */ new Set());
|
|
43702
43771
|
return;
|
|
@@ -43720,17 +43789,17 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
43720
43789
|
};
|
|
43721
43790
|
}, [client, tableId, all, fields.loading]);
|
|
43722
43791
|
const offered = useMemo70(() => hidden ? all.filter((f) => !hidden.has(f.key)) : [], [all, hidden]);
|
|
43723
|
-
const [saved, setSaved] =
|
|
43724
|
-
const [savedEpoch, setSavedEpoch] =
|
|
43725
|
-
const [current, setCurrent] =
|
|
43726
|
-
const [spec, setSpec] =
|
|
43727
|
-
const [name, setName] =
|
|
43728
|
-
const [shared, setShared] =
|
|
43729
|
-
const [saveError, setSaveError] =
|
|
43730
|
-
const [saving, setSaving] =
|
|
43731
|
-
const [linkMissed, setLinkMissed] =
|
|
43792
|
+
const [saved, setSaved] = useState115(null);
|
|
43793
|
+
const [savedEpoch, setSavedEpoch] = useState115(0);
|
|
43794
|
+
const [current, setCurrent] = useState115(null);
|
|
43795
|
+
const [spec, setSpec] = useState115(newQuestion);
|
|
43796
|
+
const [name, setName] = useState115("");
|
|
43797
|
+
const [shared, setShared] = useState115(true);
|
|
43798
|
+
const [saveError, setSaveError] = useState115(null);
|
|
43799
|
+
const [saving, setSaving] = useState115(false);
|
|
43800
|
+
const [linkMissed, setLinkMissed] = useState115(false);
|
|
43732
43801
|
const openedFromLink = useRef54(false);
|
|
43733
|
-
|
|
43802
|
+
useEffect100(() => {
|
|
43734
43803
|
let live = true;
|
|
43735
43804
|
void questionsOf(client, tableId).then((answer2) => {
|
|
43736
43805
|
if (!live) return;
|
|
@@ -43753,16 +43822,16 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
43753
43822
|
setShared(q ? q.shared : true);
|
|
43754
43823
|
setSaveError(null);
|
|
43755
43824
|
};
|
|
43756
|
-
|
|
43825
|
+
useEffect100(() => {
|
|
43757
43826
|
if (!draft) return;
|
|
43758
43827
|
open(null);
|
|
43759
43828
|
setSpec(draft);
|
|
43760
43829
|
}, [draft]);
|
|
43761
43830
|
const mine = !current || me !== null && current.createdBy === me;
|
|
43762
|
-
const [answer, setAnswer] =
|
|
43763
|
-
const [asking, setAsking] =
|
|
43831
|
+
const [answer, setAnswer] = useState115(null);
|
|
43832
|
+
const [asking, setAsking] = useState115(false);
|
|
43764
43833
|
const specKey = JSON.stringify(spec);
|
|
43765
|
-
|
|
43834
|
+
useEffect100(() => {
|
|
43766
43835
|
if (all.length === 0) return;
|
|
43767
43836
|
let live = true;
|
|
43768
43837
|
setAsking(true);
|
|
@@ -44204,7 +44273,7 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
44204
44273
|
}
|
|
44205
44274
|
|
|
44206
44275
|
// src/TableAsk.tsx
|
|
44207
|
-
import { useState as
|
|
44276
|
+
import { useState as useState116 } from "react";
|
|
44208
44277
|
import { BasicInput as BasicInput32, Button as Button93, Popover as Popover12, PopoverContent as PopoverContent12, PopoverTrigger as PopoverTrigger12, Skeleton as Skeleton35 } from "@ai-matrx/design-system";
|
|
44209
44278
|
import { optionLabel as optionLabel4 } from "@ai-matrx/records";
|
|
44210
44279
|
import { useFields as useFields31, useRecordsClient as useRecordsClient87 } from "@ai-matrx/records/react";
|
|
@@ -44427,9 +44496,9 @@ function TableAsk({ tableId, onOpenInQuestions }) {
|
|
|
44427
44496
|
const client = useRecordsClient87();
|
|
44428
44497
|
const fields = useFields31(tableId);
|
|
44429
44498
|
const all = fields.data ?? [];
|
|
44430
|
-
const [open, setOpen] =
|
|
44431
|
-
const [words2, setWords] =
|
|
44432
|
-
const [said, setSaid] =
|
|
44499
|
+
const [open, setOpen] = useState116(false);
|
|
44500
|
+
const [words2, setWords] = useState116("");
|
|
44501
|
+
const [said, setSaid] = useState116({ kind: "idle" });
|
|
44433
44502
|
const ask = async () => {
|
|
44434
44503
|
if (words2.trim() === "" || all.length === 0) return;
|
|
44435
44504
|
const choices = {};
|
|
@@ -44502,7 +44571,7 @@ function TableAsk({ tableId, onOpenInQuestions }) {
|
|
|
44502
44571
|
}
|
|
44503
44572
|
|
|
44504
44573
|
// src/PageScreen.tsx
|
|
44505
|
-
import { useCallback as useCallback59, useEffect as
|
|
44574
|
+
import { useCallback as useCallback59, useEffect as useEffect101, useMemo as useMemo71, useState as useState117 } from "react";
|
|
44506
44575
|
import {
|
|
44507
44576
|
useFields as useFields32,
|
|
44508
44577
|
useRecordPage as useRecordPage3,
|
|
@@ -44527,18 +44596,18 @@ function PageScreen({
|
|
|
44527
44596
|
const client = useRecordsClient88();
|
|
44528
44597
|
const host = useRecordsUi();
|
|
44529
44598
|
const organizationId = client.config.organizationId;
|
|
44530
|
-
const [page, setPage] =
|
|
44531
|
-
const [missing, setMissing] =
|
|
44532
|
-
const [error, setError] =
|
|
44533
|
-
const [level, setLevel] =
|
|
44534
|
-
const [editing, setEditing] =
|
|
44535
|
-
const [run, setRun] =
|
|
44536
|
-
const [saveError, setSaveError] =
|
|
44537
|
-
const [askingToArchive, setAskingToArchive] =
|
|
44538
|
-
const [selected, setSelected] =
|
|
44539
|
-
const [filterValues, setFilterValues] =
|
|
44540
|
-
const [mine, setMine] =
|
|
44541
|
-
const [making, setMaking] =
|
|
44599
|
+
const [page, setPage] = useState117(null);
|
|
44600
|
+
const [missing, setMissing] = useState117(false);
|
|
44601
|
+
const [error, setError] = useState117(null);
|
|
44602
|
+
const [level, setLevel] = useState117(null);
|
|
44603
|
+
const [editing, setEditing] = useState117(startEditing);
|
|
44604
|
+
const [run, setRun] = useState117(null);
|
|
44605
|
+
const [saveError, setSaveError] = useState117(null);
|
|
44606
|
+
const [askingToArchive, setAskingToArchive] = useState117(false);
|
|
44607
|
+
const [selected, setSelected] = useState117({});
|
|
44608
|
+
const [filterValues, setFilterValues] = useState117({});
|
|
44609
|
+
const [mine, setMine] = useState117({});
|
|
44610
|
+
const [making, setMaking] = useState117("waiting");
|
|
44542
44611
|
const id = page?.id ?? pageId ?? null;
|
|
44543
44612
|
const load = useCallback59(
|
|
44544
44613
|
async (want) => {
|
|
@@ -44559,7 +44628,7 @@ function PageScreen({
|
|
|
44559
44628
|
},
|
|
44560
44629
|
[client]
|
|
44561
44630
|
);
|
|
44562
|
-
|
|
44631
|
+
useEffect101(() => {
|
|
44563
44632
|
if (!newOnTable || pageId || making !== "waiting") return;
|
|
44564
44633
|
setMaking("making");
|
|
44565
44634
|
void client.dashboardDeclare({
|
|
@@ -44579,11 +44648,11 @@ function PageScreen({
|
|
|
44579
44648
|
onCreated?.(made.data);
|
|
44580
44649
|
});
|
|
44581
44650
|
}, [client, newOnTable, pageId, making, load, onCreated]);
|
|
44582
|
-
|
|
44651
|
+
useEffect101(() => {
|
|
44583
44652
|
if (!pageId) return;
|
|
44584
44653
|
void load(pageId);
|
|
44585
44654
|
}, [pageId, load]);
|
|
44586
|
-
|
|
44655
|
+
useEffect101(() => {
|
|
44587
44656
|
if (!id) return;
|
|
44588
44657
|
let live = true;
|
|
44589
44658
|
void client.myLevels({ ids: [id], subject: "record" }).then((answered) => {
|
|
@@ -44595,7 +44664,7 @@ function PageScreen({
|
|
|
44595
44664
|
}, [client, id]);
|
|
44596
44665
|
const canEdit = level !== null && EDIT_LEVELS.has(level);
|
|
44597
44666
|
const chartKey = page ? JSON.stringify(page.blocks.map((b) => b.id)) + page.version : "";
|
|
44598
|
-
|
|
44667
|
+
useEffect101(() => {
|
|
44599
44668
|
if (!page || page.blocks.length === 0) {
|
|
44600
44669
|
setRun(null);
|
|
44601
44670
|
return;
|
|
@@ -44840,8 +44909,8 @@ function AppletBlockView({ block }) {
|
|
|
44840
44909
|
}
|
|
44841
44910
|
function AppletPick({ value, onChange }) {
|
|
44842
44911
|
const host = useRecordsUi();
|
|
44843
|
-
const [options, setOptions] =
|
|
44844
|
-
|
|
44912
|
+
const [options, setOptions] = useState117(null);
|
|
44913
|
+
useEffect101(() => {
|
|
44845
44914
|
let live = true;
|
|
44846
44915
|
host.applets?.list().then((apps) => live && setOptions(apps.map((a) => ({ value: a.id, label: a.name })))).catch(() => live && setOptions([]));
|
|
44847
44916
|
return () => {
|
|
@@ -44877,8 +44946,8 @@ function ListBlockView({
|
|
|
44877
44946
|
const table = useTable32(block.table_id);
|
|
44878
44947
|
const fields = useFields32(block.table_id);
|
|
44879
44948
|
const all = useMemo71(() => onePerKey3(fields.data ?? []), [fields.data]);
|
|
44880
|
-
const [view, setView] =
|
|
44881
|
-
|
|
44949
|
+
const [view, setView] = useState117(block.view_id ? "reading" : null);
|
|
44950
|
+
useEffect101(() => {
|
|
44882
44951
|
if (!block.view_id) {
|
|
44883
44952
|
setView(null);
|
|
44884
44953
|
return;
|
|
@@ -44895,8 +44964,8 @@ function ListBlockView({
|
|
|
44895
44964
|
};
|
|
44896
44965
|
}, [client, block.table_id, block.view_id]);
|
|
44897
44966
|
const meField = block.me_field ? all.find((f) => f.key === block.me_field) : void 0;
|
|
44898
|
-
const [me, setMe] =
|
|
44899
|
-
|
|
44967
|
+
const [me, setMe] = useState117(null);
|
|
44968
|
+
useEffect101(() => {
|
|
44900
44969
|
if (!mine || !meField?.relation_target || !viewerUserId) {
|
|
44901
44970
|
setMe(null);
|
|
44902
44971
|
return;
|
|
@@ -44926,12 +44995,12 @@ function ListBlockView({
|
|
|
44926
44995
|
...sort.length > 0 ? { sort } : {}
|
|
44927
44996
|
});
|
|
44928
44997
|
const reload = page.reload;
|
|
44929
|
-
|
|
44998
|
+
useEffect101(() => onRecordChanged(() => reload()), [reload]);
|
|
44930
44999
|
const rows = nobodyIsMe ? [] : page.data?.rows ?? [];
|
|
44931
45000
|
const columns = block.columns && block.columns.length > 0 ? block.columns.map((k) => all.find((f) => f.key === k)).filter((f) => !!f) : [...all].sort((a, b) => (a.sort ?? 100) - (b.sort ?? 100)).slice(0, DEFAULT_COLUMNS);
|
|
44932
45001
|
const firstId = rows[0]?.id ?? null;
|
|
44933
45002
|
const stillThere = selected !== null && rows.some((r) => r.id === selected);
|
|
44934
|
-
|
|
45003
|
+
useEffect101(() => {
|
|
44935
45004
|
if (page.loading || waiting) return;
|
|
44936
45005
|
if (!stillThere) onSelect(firstId);
|
|
44937
45006
|
}, [firstId, stillThere, page.loading, waiting]);
|
|
@@ -44994,11 +45063,11 @@ function ActionButton2({ block, recordId }) {
|
|
|
44994
45063
|
const client = useRecordsClient88();
|
|
44995
45064
|
const actionsRead = useRowActions2(block.action_id ? block.table_id : null);
|
|
44996
45065
|
const action3 = !block.action_id ? null : actionsRead.data ? actionsRead.data.actions.find((a) => a.id === block.action_id) ?? null : actionsRead.loading ? "reading" : null;
|
|
44997
|
-
const [asking, setAsking] =
|
|
44998
|
-
const [running, setRunning] =
|
|
44999
|
-
const [done, setDone] =
|
|
45000
|
-
const [error, setError] =
|
|
45001
|
-
|
|
45066
|
+
const [asking, setAsking] = useState117(false);
|
|
45067
|
+
const [running, setRunning] = useState117(false);
|
|
45068
|
+
const [done, setDone] = useState117(null);
|
|
45069
|
+
const [error, setError] = useState117(null);
|
|
45070
|
+
useEffect101(() => {
|
|
45002
45071
|
setDone(null);
|
|
45003
45072
|
setError(null);
|
|
45004
45073
|
setAsking(false);
|
|
@@ -45037,9 +45106,9 @@ function ActionButton2({ block, recordId }) {
|
|
|
45037
45106
|
}
|
|
45038
45107
|
function FormBlockView({ block }) {
|
|
45039
45108
|
const client = useRecordsClient88();
|
|
45040
|
-
const [form, setForm] =
|
|
45041
|
-
const [sent, setSent] =
|
|
45042
|
-
|
|
45109
|
+
const [form, setForm] = useState117("reading");
|
|
45110
|
+
const [sent, setSent] = useState117(0);
|
|
45111
|
+
useEffect101(() => {
|
|
45043
45112
|
if (!block.form_id) {
|
|
45044
45113
|
setForm(null);
|
|
45045
45114
|
return;
|
|
@@ -45164,10 +45233,10 @@ function FieldPick({
|
|
|
45164
45233
|
}
|
|
45165
45234
|
function ListSettings({ block, onChange }) {
|
|
45166
45235
|
const client = useRecordsClient88();
|
|
45167
|
-
const [views, setViews] =
|
|
45236
|
+
const [views, setViews] = useState117([]);
|
|
45168
45237
|
const fields = useFields32(block.table_id);
|
|
45169
45238
|
const all = onePerKey3(fields.data ?? []);
|
|
45170
|
-
|
|
45239
|
+
useEffect101(() => {
|
|
45171
45240
|
let live = true;
|
|
45172
45241
|
void client.views({ table_id: block.table_id }).then((answered) => {
|
|
45173
45242
|
if (live) setViews(answered.ok ? answered.data : []);
|
|
@@ -45243,8 +45312,8 @@ function ActionPicker({ tableId, value, onChange }) {
|
|
|
45243
45312
|
}
|
|
45244
45313
|
function FormPicker({ tableId, value, onChange }) {
|
|
45245
45314
|
const client = useRecordsClient88();
|
|
45246
|
-
const [forms, setForms] =
|
|
45247
|
-
|
|
45315
|
+
const [forms, setForms] = useState117([]);
|
|
45316
|
+
useEffect101(() => {
|
|
45248
45317
|
let live = true;
|
|
45249
45318
|
void client.forms({ table_id: tableId }).then((answered) => {
|
|
45250
45319
|
if (live) setForms(answered.ok ? answered.data : []);
|
|
@@ -45290,7 +45359,7 @@ function onePerKey3(all) {
|
|
|
45290
45359
|
|
|
45291
45360
|
// src/FormsPanel.tsx
|
|
45292
45361
|
import { copyText as copyText9 } from "@ai-matrx/kit/clipboard";
|
|
45293
|
-
import { useCallback as useCallback60, useEffect as
|
|
45362
|
+
import { useCallback as useCallback60, useEffect as useEffect102, useState as useState118 } from "react";
|
|
45294
45363
|
import { useRecordsClient as useRecordsClient89, useTable as useTable33 } from "@ai-matrx/records/react";
|
|
45295
45364
|
import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
|
|
45296
45365
|
import { Badge as Badge24, Button as Button95, Skeleton as Skeleton37, cn as cn86 } from "@ai-matrx/design-system";
|
|
@@ -45307,15 +45376,15 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
45307
45376
|
const host = useRecordsUi();
|
|
45308
45377
|
const table = useTable33(tableId);
|
|
45309
45378
|
const rights = useTableRights(table.data);
|
|
45310
|
-
const [forms, setForms] =
|
|
45311
|
-
const [error, setError] =
|
|
45312
|
-
const [busy, setBusy] =
|
|
45313
|
-
const [copied, setCopied] =
|
|
45314
|
-
const [building, setBuilding] =
|
|
45315
|
-
const [archivedSaid, setArchivedSaid] =
|
|
45379
|
+
const [forms, setForms] = useState118(null);
|
|
45380
|
+
const [error, setError] = useState118(null);
|
|
45381
|
+
const [busy, setBusy] = useState118(null);
|
|
45382
|
+
const [copied, setCopied] = useState118(null);
|
|
45383
|
+
const [building, setBuilding] = useState118(false);
|
|
45384
|
+
const [archivedSaid, setArchivedSaid] = useState118(null);
|
|
45316
45385
|
const linked = activeFormId && forms !== null ? forms.find((f) => f.form_id === activeFormId) ?? null : null;
|
|
45317
45386
|
const linkedMissing = Boolean(activeFormId) && forms !== null && linked === null;
|
|
45318
|
-
|
|
45387
|
+
useEffect102(() => {
|
|
45319
45388
|
if (linked && rights.structure) setBuilding(true);
|
|
45320
45389
|
}, [linked, rights.structure]);
|
|
45321
45390
|
const load = useCallback60(async () => {
|
|
@@ -45328,7 +45397,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
45328
45397
|
setError(null);
|
|
45329
45398
|
setForms(answered.data);
|
|
45330
45399
|
}, [client, tableId]);
|
|
45331
|
-
|
|
45400
|
+
useEffect102(() => {
|
|
45332
45401
|
void load();
|
|
45333
45402
|
}, [load]);
|
|
45334
45403
|
const toggle = useCallback60(
|
|
@@ -45345,7 +45414,7 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
45345
45414
|
},
|
|
45346
45415
|
[client, load]
|
|
45347
45416
|
);
|
|
45348
|
-
const [shown4, setShown] =
|
|
45417
|
+
const [shown4, setShown] = useState118(null);
|
|
45349
45418
|
const copy = useCallback60(async (url, formId) => {
|
|
45350
45419
|
if (await copyText9(url)) {
|
|
45351
45420
|
setCopied(formId);
|
|
@@ -45473,12 +45542,12 @@ function FormsPanel({ tableId, activeFormId, className }) {
|
|
|
45473
45542
|
}
|
|
45474
45543
|
|
|
45475
45544
|
// src/CaptureSheet.tsx
|
|
45476
|
-
import { useCallback as useCallback62, useEffect as
|
|
45545
|
+
import { useCallback as useCallback62, useEffect as useEffect104, useRef as useRef56, useState as useState120 } from "react";
|
|
45477
45546
|
import { useFields as useFields33, useRecordsClient as useRecordsClient91, useTable as useTable34 } from "@ai-matrx/records/react";
|
|
45478
45547
|
import { Button as Button97, Input as Input8, Skeleton as Skeleton39, Textarea as Textarea7, cn as cn88 } from "@ai-matrx/design-system";
|
|
45479
45548
|
|
|
45480
45549
|
// src/CaptureRun.tsx
|
|
45481
|
-
import { useCallback as useCallback61, useEffect as
|
|
45550
|
+
import { useCallback as useCallback61, useEffect as useEffect103, useMemo as useMemo72, useRef as useRef55, useState as useState119 } from "react";
|
|
45482
45551
|
import {
|
|
45483
45552
|
coerceTypedAnswer as coerceTypedAnswer3,
|
|
45484
45553
|
coercionLabel,
|
|
@@ -45525,19 +45594,19 @@ function whereWeAre(timeoutMs = 4e3) {
|
|
|
45525
45594
|
function CaptureRun({ sheetId, face: given, className }) {
|
|
45526
45595
|
const client = useRecordsClient90();
|
|
45527
45596
|
const host = useRecordsUi();
|
|
45528
|
-
const [face, setFace] =
|
|
45529
|
-
const [loadFailed, setLoadFailed] =
|
|
45530
|
-
const [at, setAt] =
|
|
45531
|
-
const [answers, setAnswers] =
|
|
45532
|
-
const [files, setFiles] =
|
|
45533
|
-
const [missing, setMissing] =
|
|
45534
|
-
const [done, setDone] =
|
|
45535
|
-
const [counts, setCounts] =
|
|
45536
|
-
const [items, setItems] =
|
|
45537
|
-
const [lastSynced, setLastSynced] =
|
|
45538
|
-
const [sending, setSending] =
|
|
45597
|
+
const [face, setFace] = useState119(given);
|
|
45598
|
+
const [loadFailed, setLoadFailed] = useState119(null);
|
|
45599
|
+
const [at, setAt] = useState119(0);
|
|
45600
|
+
const [answers, setAnswers] = useState119({});
|
|
45601
|
+
const [files, setFiles] = useState119({});
|
|
45602
|
+
const [missing, setMissing] = useState119(null);
|
|
45603
|
+
const [done, setDone] = useState119(null);
|
|
45604
|
+
const [counts, setCounts] = useState119({ waiting: 0, sending: 0, refused: 0, landed: 0 });
|
|
45605
|
+
const [items, setItems] = useState119([]);
|
|
45606
|
+
const [lastSynced, setLastSynced] = useState119(null);
|
|
45607
|
+
const [sending, setSending] = useState119(false);
|
|
45539
45608
|
const queueRef = useRef55(null);
|
|
45540
|
-
|
|
45609
|
+
useEffect103(() => {
|
|
45541
45610
|
const q2 = openCaptureQueue({
|
|
45542
45611
|
onChange: (c, all) => {
|
|
45543
45612
|
setCounts(c);
|
|
@@ -45575,7 +45644,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
45575
45644
|
void q2.sync().then(() => void q2.lastSyncedAt().then(setLastSynced));
|
|
45576
45645
|
return () => q2.dispose();
|
|
45577
45646
|
}, [client, host]);
|
|
45578
|
-
|
|
45647
|
+
useEffect103(() => {
|
|
45579
45648
|
if (given !== void 0) return;
|
|
45580
45649
|
let cancelled = false;
|
|
45581
45650
|
void client.captureOpen({ sheet_id: sheetId }).then((res) => {
|
|
@@ -45907,15 +45976,15 @@ function AdHocCaptureSheet({
|
|
|
45907
45976
|
const host = useRecordsUi();
|
|
45908
45977
|
const table = useTable34(tableId);
|
|
45909
45978
|
const fields = useFields33(tableId);
|
|
45910
|
-
const [mode, setMode] =
|
|
45911
|
-
const [reading, setReading] =
|
|
45912
|
-
const [note, setNote] =
|
|
45913
|
-
const [fileId, setFileId] =
|
|
45914
|
-
const [pending, setPending] =
|
|
45915
|
-
const [saved, setSaved] =
|
|
45916
|
-
const [error, setError] =
|
|
45917
|
-
const [uploadError, setUploadError] =
|
|
45918
|
-
const [flushing, setFlushing] =
|
|
45979
|
+
const [mode, setMode] = useState120("reading");
|
|
45980
|
+
const [reading, setReading] = useState120("");
|
|
45981
|
+
const [note, setNote] = useState120("");
|
|
45982
|
+
const [fileId, setFileId] = useState120(null);
|
|
45983
|
+
const [pending, setPending] = useState120(null);
|
|
45984
|
+
const [saved, setSaved] = useState120([]);
|
|
45985
|
+
const [error, setError] = useState120(null);
|
|
45986
|
+
const [uploadError, setUploadError] = useState120(null);
|
|
45987
|
+
const [flushing, setFlushing] = useState120(false);
|
|
45919
45988
|
const queue = useRef56([]);
|
|
45920
45989
|
const keep = useCallback62(
|
|
45921
45990
|
async (next) => {
|
|
@@ -45925,7 +45994,7 @@ function AdHocCaptureSheet({
|
|
|
45925
45994
|
},
|
|
45926
45995
|
[host]
|
|
45927
45996
|
);
|
|
45928
|
-
|
|
45997
|
+
useEffect104(() => {
|
|
45929
45998
|
let cancelled = false;
|
|
45930
45999
|
void (async () => {
|
|
45931
46000
|
const held = host.captureQueue ? await host.captureQueue.load() : [];
|
|
@@ -46104,17 +46173,17 @@ function AdHocCaptureSheet({
|
|
|
46104
46173
|
}
|
|
46105
46174
|
|
|
46106
46175
|
// src/PortalShell.tsx
|
|
46107
|
-
import { useCallback as useCallback63, useEffect as
|
|
46176
|
+
import { useCallback as useCallback63, useEffect as useEffect105, useState as useState121 } from "react";
|
|
46108
46177
|
import { useRecordsClient as useRecordsClient92 } from "@ai-matrx/records/react";
|
|
46109
46178
|
import { Button as Button98, Skeleton as Skeleton40, cn as cn89 } from "@ai-matrx/design-system";
|
|
46110
46179
|
import { jsx as jsx146, jsxs as jsxs135 } from "react/jsx-runtime";
|
|
46111
46180
|
function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
46112
46181
|
const client = useRecordsClient92();
|
|
46113
|
-
const [card, setCard] =
|
|
46114
|
-
const [reach, setReach] =
|
|
46115
|
-
const [error, setError] =
|
|
46116
|
-
const [open, setOpen] =
|
|
46117
|
-
const [sending, setSending] =
|
|
46182
|
+
const [card, setCard] = useState121(null);
|
|
46183
|
+
const [reach, setReach] = useState121(null);
|
|
46184
|
+
const [error, setError] = useState121(null);
|
|
46185
|
+
const [open, setOpen] = useState121(null);
|
|
46186
|
+
const [sending, setSending] = useState121(false);
|
|
46118
46187
|
const load = useCallback63(async () => {
|
|
46119
46188
|
const who = await client.externalPrincipalCard();
|
|
46120
46189
|
if (!who.ok) {
|
|
@@ -46130,7 +46199,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
46130
46199
|
}
|
|
46131
46200
|
setReach(reached.data.map((row) => row.resource_id));
|
|
46132
46201
|
}, [client, resourceType]);
|
|
46133
|
-
|
|
46202
|
+
useEffect105(() => {
|
|
46134
46203
|
void load();
|
|
46135
46204
|
}, [load]);
|
|
46136
46205
|
if (error) {
|
|
@@ -46189,8 +46258,8 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
|
|
|
46189
46258
|
}
|
|
46190
46259
|
function PortalRow({ tableId, recordId }) {
|
|
46191
46260
|
const client = useRecordsClient92();
|
|
46192
|
-
const [title, setTitle] =
|
|
46193
|
-
|
|
46261
|
+
const [title, setTitle] = useState121(null);
|
|
46262
|
+
useEffect105(() => {
|
|
46194
46263
|
let cancelled = false;
|
|
46195
46264
|
void client.recordRead({ record_id: recordId }).then((answered) => {
|
|
46196
46265
|
if (cancelled) return;
|
|
@@ -46210,7 +46279,7 @@ function PortalRow({ tableId, recordId }) {
|
|
|
46210
46279
|
}
|
|
46211
46280
|
|
|
46212
46281
|
// src/PublicViewPage.tsx
|
|
46213
|
-
import { useCallback as useCallback64, useEffect as
|
|
46282
|
+
import { useCallback as useCallback64, useEffect as useEffect106, useState as useState122 } from "react";
|
|
46214
46283
|
import { useRecordsClient as useRecordsClient93 } from "@ai-matrx/records/react";
|
|
46215
46284
|
import { Skeleton as Skeleton41, cn as cn90 } from "@ai-matrx/design-system";
|
|
46216
46285
|
|
|
@@ -46228,12 +46297,12 @@ function publicReadOf(binding) {
|
|
|
46228
46297
|
import { jsx as jsx147, jsxs as jsxs136 } from "react/jsx-runtime";
|
|
46229
46298
|
function PublicViewPage({ slug, className }) {
|
|
46230
46299
|
const client = useRecordsClient93();
|
|
46231
|
-
const [binding, setBinding] =
|
|
46232
|
-
const [rows, setRows] =
|
|
46233
|
-
const [fields, setFields] =
|
|
46234
|
-
const [error, setError] =
|
|
46235
|
-
const [plan, setPlan] =
|
|
46236
|
-
const [gap, setGap] =
|
|
46300
|
+
const [binding, setBinding] = useState122(null);
|
|
46301
|
+
const [rows, setRows] = useState122(null);
|
|
46302
|
+
const [fields, setFields] = useState122(null);
|
|
46303
|
+
const [error, setError] = useState122(null);
|
|
46304
|
+
const [plan, setPlan] = useState122(null);
|
|
46305
|
+
const [gap, setGap] = useState122(null);
|
|
46237
46306
|
const load = useCallback64(async () => {
|
|
46238
46307
|
const notice = await client.worldPublishGapNotice();
|
|
46239
46308
|
if (notice.ok) setGap(notice.data);
|
|
@@ -46284,7 +46353,7 @@ function PublicViewPage({ slug, className }) {
|
|
|
46284
46353
|
}
|
|
46285
46354
|
setRows([{ id: chosen.recordId, document: read.data.document, level: "viewer", hidden: read.data.hidden }]);
|
|
46286
46355
|
}, [client, slug]);
|
|
46287
|
-
|
|
46356
|
+
useEffect106(() => {
|
|
46288
46357
|
void load();
|
|
46289
46358
|
}, [load]);
|
|
46290
46359
|
if (error) return /* @__PURE__ */ jsx147(RefusalNotice, { error, className });
|
|
@@ -46322,7 +46391,7 @@ function PublicRow({ row, fields }) {
|
|
|
46322
46391
|
|
|
46323
46392
|
// src/EmbedFrame.tsx
|
|
46324
46393
|
import { copyText as copyText10 } from "@ai-matrx/kit/clipboard";
|
|
46325
|
-
import { useCallback as useCallback65, useEffect as
|
|
46394
|
+
import { useCallback as useCallback65, useEffect as useEffect107, useState as useState123 } from "react";
|
|
46326
46395
|
import { useRecordsClient as useRecordsClient94 } from "@ai-matrx/records/react";
|
|
46327
46396
|
import { Button as Button99, Input as Input9, Skeleton as Skeleton42, Textarea as Textarea8, cn as cn91 } from "@ai-matrx/design-system";
|
|
46328
46397
|
import { useTable as useTable35 } from "@ai-matrx/records/react";
|
|
@@ -46339,11 +46408,11 @@ function EmbedFrame({
|
|
|
46339
46408
|
const host = useRecordsUi();
|
|
46340
46409
|
const table = useTable35(tableId);
|
|
46341
46410
|
const rights = useTableRights(table.data);
|
|
46342
|
-
const [origins, setOrigins] =
|
|
46343
|
-
const [secret, setSecret] =
|
|
46344
|
-
const [tokenId, setTokenId] =
|
|
46345
|
-
const [error, setError] =
|
|
46346
|
-
const [busy, setBusy] =
|
|
46411
|
+
const [origins, setOrigins] = useState123("");
|
|
46412
|
+
const [secret, setSecret] = useState123(null);
|
|
46413
|
+
const [tokenId, setTokenId] = useState123(null);
|
|
46414
|
+
const [error, setError] = useState123(null);
|
|
46415
|
+
const [busy, setBusy] = useState123(false);
|
|
46347
46416
|
const mode = formId ? "write" : "read";
|
|
46348
46417
|
const parsed = origins.split(/[\s,]+/).map((o) => o.trim()).filter((o) => o.length > 0);
|
|
46349
46418
|
const issue = useCallback65(async () => {
|
|
@@ -46430,12 +46499,12 @@ function EmbedFrame({
|
|
|
46430
46499
|
}
|
|
46431
46500
|
function useEmbedHandshake(args) {
|
|
46432
46501
|
const client = useRecordsClient94();
|
|
46433
|
-
const [binding, setBinding] =
|
|
46434
|
-
const [error, setError] =
|
|
46435
|
-
const [loading, setLoading] =
|
|
46502
|
+
const [binding, setBinding] = useState123(null);
|
|
46503
|
+
const [error, setError] = useState123(null);
|
|
46504
|
+
const [loading, setLoading] = useState123(true);
|
|
46436
46505
|
const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
|
|
46437
46506
|
const { secret, requiredMode } = args;
|
|
46438
|
-
|
|
46507
|
+
useEffect107(() => {
|
|
46439
46508
|
let cancelled = false;
|
|
46440
46509
|
setLoading(true);
|
|
46441
46510
|
setError(null);
|
|
@@ -46458,7 +46527,7 @@ function useEmbedHandshake(args) {
|
|
|
46458
46527
|
|
|
46459
46528
|
// src/TablePage.tsx
|
|
46460
46529
|
import { copyText as copyText12 } from "@ai-matrx/kit/clipboard";
|
|
46461
|
-
import { useCallback as useCallback67, useEffect as
|
|
46530
|
+
import { useCallback as useCallback67, useEffect as useEffect110, useMemo as useMemo76, useRef as useRef57, useState as useState130 } from "react";
|
|
46462
46531
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
46463
46532
|
import { useFields as useFields36, useRecordsClient as useRecordsClient96, useTable as useTable36 } from "@ai-matrx/records/react";
|
|
46464
46533
|
import {
|
|
@@ -46478,7 +46547,7 @@ import {
|
|
|
46478
46547
|
cn as cn94,
|
|
46479
46548
|
useIsMobile as useIsMobile2
|
|
46480
46549
|
} from "@ai-matrx/design-system";
|
|
46481
|
-
import { humanizeIdentifier as
|
|
46550
|
+
import { humanizeIdentifier as humanizeIdentifier19 } from "@ai-matrx/kit/text-case";
|
|
46482
46551
|
|
|
46483
46552
|
// src/viewShare.ts
|
|
46484
46553
|
import { exportCsv as exportCsv2 } from "@ai-matrx/records/core";
|
|
@@ -46522,13 +46591,13 @@ async function downloadViewCsv(args) {
|
|
|
46522
46591
|
}
|
|
46523
46592
|
|
|
46524
46593
|
// src/RecordPanel.tsx
|
|
46525
|
-
import { Fragment as Fragment61, useState as
|
|
46594
|
+
import { Fragment as Fragment61, useState as useState124 } from "react";
|
|
46526
46595
|
import { Button as Button100, Separator as Separator13 } from "@ai-matrx/design-system";
|
|
46527
46596
|
import { useFields as useFields34, useRecord as useRecord4 } from "@ai-matrx/records/react";
|
|
46528
46597
|
import { Fragment as Fragment62, jsx as jsx149, jsxs as jsxs138 } from "react/jsx-runtime";
|
|
46529
46598
|
function RecordPanel({ tableId, recordId, onClose, onAskAboutField, onPage = false }) {
|
|
46530
46599
|
const host = useRecordsUi();
|
|
46531
|
-
const [asking, setAsking] =
|
|
46600
|
+
const [asking, setAsking] = useState124(null);
|
|
46532
46601
|
return /* @__PURE__ */ jsxs138("div", { className: "space-y-3", "data-record-panel": recordId, children: [
|
|
46533
46602
|
/* @__PURE__ */ jsx149(Peek, { tableId, recordId, onPage, ...onClose ? { onClose } : {} }),
|
|
46534
46603
|
onPage ? /* @__PURE__ */ jsxs138(Fragment62, { children: [
|
|
@@ -46606,7 +46675,7 @@ function LinkedLists({ tableId, recordId }) {
|
|
|
46606
46675
|
}
|
|
46607
46676
|
function RecordAsk({ tableId, recordId }) {
|
|
46608
46677
|
const host = useRecordsUi();
|
|
46609
|
-
const [open, setOpen] =
|
|
46678
|
+
const [open, setOpen] = useState124(false);
|
|
46610
46679
|
if (!host.chat) return null;
|
|
46611
46680
|
return /* @__PURE__ */ jsxs138("section", { className: "flex min-w-0 flex-col gap-1.5", "data-record-ask": open ? "open" : "", children: [
|
|
46612
46681
|
/* @__PURE__ */ jsx149(Separator13, {}),
|
|
@@ -46615,7 +46684,7 @@ function RecordAsk({ tableId, recordId }) {
|
|
|
46615
46684
|
}
|
|
46616
46685
|
|
|
46617
46686
|
// src/breakDown.tsx
|
|
46618
|
-
import { useMemo as useMemo73, useState as
|
|
46687
|
+
import { useMemo as useMemo73, useState as useState125 } from "react";
|
|
46619
46688
|
import {
|
|
46620
46689
|
Button as Button101,
|
|
46621
46690
|
Dialog as Dialog14,
|
|
@@ -46655,7 +46724,7 @@ function BreakDownDialog({
|
|
|
46655
46724
|
const source = useMemo73(() => ({ kind: "table", id: tableId }), [tableId]);
|
|
46656
46725
|
const { def } = useDrillDefinition(open ? source : null);
|
|
46657
46726
|
const dimensions = useMemo73(() => drillDimensionsOf(def, NO_LABELS), [def]);
|
|
46658
|
-
const [picked, setPicked] =
|
|
46727
|
+
const [picked, setPicked] = useState125(null);
|
|
46659
46728
|
const key = picked ?? held?.field ?? dimensions[0]?.key ?? "";
|
|
46660
46729
|
return /* @__PURE__ */ jsx150(Dialog14, { open, onOpenChange, children: /* @__PURE__ */ jsxs139(DialogContent14, { "data-break-down": "", className: "max-w-sm", children: [
|
|
46661
46730
|
/* @__PURE__ */ jsx150(DialogHeader14, { children: /* @__PURE__ */ jsx150(DialogTitle14, { children: "Break down by" }) }),
|
|
@@ -46682,7 +46751,7 @@ function BreakDownDialog({
|
|
|
46682
46751
|
|
|
46683
46752
|
// src/TableReference.tsx
|
|
46684
46753
|
import { copyText as copyText11 } from "@ai-matrx/kit/clipboard";
|
|
46685
|
-
import { useCallback as useCallback66, useMemo as useMemo74, useState as
|
|
46754
|
+
import { useCallback as useCallback66, useMemo as useMemo74, useState as useState126 } from "react";
|
|
46686
46755
|
import { useContentTransferCapabilities as useContentTransferCapabilities2 } from "@ai-matrx/alchemy/react/workspace";
|
|
46687
46756
|
import { Button as Button102, Dialog as Dialog15, DialogContent as DialogContent15, DialogHeader as DialogHeader15, DialogTitle as DialogTitle15 } from "@ai-matrx/design-system";
|
|
46688
46757
|
import { jsx as jsx151, jsxs as jsxs140 } from "react/jsx-runtime";
|
|
@@ -46710,7 +46779,7 @@ function TableReferenceDialog({
|
|
|
46710
46779
|
}) {
|
|
46711
46780
|
const port = useContentTransferCapabilities2().reference;
|
|
46712
46781
|
const notify = useRecordsUi().notify;
|
|
46713
|
-
const [copied, setCopied] =
|
|
46782
|
+
const [copied, setCopied] = useState126(null);
|
|
46714
46783
|
const choices = useMemo74(
|
|
46715
46784
|
() => tableReferenceChoices(table.id, tableName(table)).filter((c) => port?.supports(c.reference)),
|
|
46716
46785
|
[table, port]
|
|
@@ -46738,7 +46807,7 @@ function TableReferenceDialog({
|
|
|
46738
46807
|
}
|
|
46739
46808
|
|
|
46740
46809
|
// src/TableDuplicate.tsx
|
|
46741
|
-
import { useState as
|
|
46810
|
+
import { useState as useState127 } from "react";
|
|
46742
46811
|
import { tableShapeChanged as tableShapeChanged12, useRecordsClient as useRecordsClient95 } from "@ai-matrx/records/react";
|
|
46743
46812
|
import { Button as Button103, Dialog as Dialog16, DialogContent as DialogContent16, DialogFooter as DialogFooter11, DialogHeader as DialogHeader16, DialogTitle as DialogTitle16, ErrorBox as ErrorBox8, Input as Input10, Switch as Switch5 } from "@ai-matrx/design-system";
|
|
46744
46813
|
import { Fragment as Fragment63, jsx as jsx152, jsxs as jsxs141 } from "react/jsx-runtime";
|
|
@@ -46753,9 +46822,9 @@ function duplicateProgressWords(p) {
|
|
|
46753
46822
|
function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated }) {
|
|
46754
46823
|
const client = useRecordsClient95();
|
|
46755
46824
|
const host = useRecordsUi();
|
|
46756
|
-
const [typed2, setTyped] =
|
|
46757
|
-
const [withRecords, setWithRecords] =
|
|
46758
|
-
const [phase, setPhase] =
|
|
46825
|
+
const [typed2, setTyped] = useState127(() => copyNameFor(name));
|
|
46826
|
+
const [withRecords, setWithRecords] = useState127(true);
|
|
46827
|
+
const [phase, setPhase] = useState127({ kind: "asking" });
|
|
46759
46828
|
const problem = tableNameProblem(typed2);
|
|
46760
46829
|
const copying = phase.kind === "copying";
|
|
46761
46830
|
const close = (next) => {
|
|
@@ -46840,7 +46909,7 @@ function TableDuplicateDialog({ tableId, name, open, onOpenChange, onDuplicated
|
|
|
46840
46909
|
}
|
|
46841
46910
|
|
|
46842
46911
|
// src/ViewFilter.tsx
|
|
46843
|
-
import { useEffect as
|
|
46912
|
+
import { useEffect as useEffect108, useMemo as useMemo75, useState as useState128 } from "react";
|
|
46844
46913
|
import { Button as Button104, Popover as Popover13, PopoverContent as PopoverContent13, PopoverTrigger as PopoverTrigger13 } from "@ai-matrx/design-system";
|
|
46845
46914
|
import { useFields as useFields35 } from "@ai-matrx/records/react";
|
|
46846
46915
|
import { jsx as jsx153, jsxs as jsxs142 } from "react/jsx-runtime";
|
|
@@ -46854,11 +46923,11 @@ function conditionCount(expr) {
|
|
|
46854
46923
|
}
|
|
46855
46924
|
function ViewFilter({ tableId, view, onApply, className }) {
|
|
46856
46925
|
const fields = useFields35(tableId);
|
|
46857
|
-
const [open, setOpen] =
|
|
46926
|
+
const [open, setOpen] = useState128(false);
|
|
46858
46927
|
const saved = view?.where ?? null;
|
|
46859
|
-
const [draft, setDraft] =
|
|
46928
|
+
const [draft, setDraft] = useState128(saved);
|
|
46860
46929
|
const savedKey = JSON.stringify(saved);
|
|
46861
|
-
|
|
46930
|
+
useEffect108(() => {
|
|
46862
46931
|
setDraft(saved);
|
|
46863
46932
|
}, [view?.id, savedKey]);
|
|
46864
46933
|
const conditionFields = useMemo75(
|
|
@@ -46906,7 +46975,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
46906
46975
|
ConditionGroup,
|
|
46907
46976
|
{
|
|
46908
46977
|
lead: "Show records where",
|
|
46909
|
-
emptyLabel: "
|
|
46978
|
+
emptyLabel: "Pick a field",
|
|
46910
46979
|
expr: draft,
|
|
46911
46980
|
fields: conditionFields,
|
|
46912
46981
|
onChange: setDraft
|
|
@@ -46942,8 +47011,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
46942
47011
|
/* @__PURE__ */ jsx153(Button104, { size: "sm", variant: "ghost", onClick: () => {
|
|
46943
47012
|
setDraft(saved);
|
|
46944
47013
|
setOpen(false);
|
|
46945
|
-
}, children: "Cancel" })
|
|
46946
|
-
changed ? /* @__PURE__ */ jsx153("span", { className: "text-muted-foreground", children: "Not applied yet." }) : null
|
|
47014
|
+
}, children: "Cancel" })
|
|
46947
47015
|
] })
|
|
46948
47016
|
]
|
|
46949
47017
|
}
|
|
@@ -47034,7 +47102,7 @@ function phoneTableActions(actions) {
|
|
|
47034
47102
|
}
|
|
47035
47103
|
|
|
47036
47104
|
// src/toolbarFit.ts
|
|
47037
|
-
import { useEffect as
|
|
47105
|
+
import { useEffect as useEffect109, useState as useState129 } from "react";
|
|
47038
47106
|
var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
|
|
47039
47107
|
var SLOT_MIN = 36;
|
|
47040
47108
|
function toolbarFold(input) {
|
|
@@ -47091,8 +47159,8 @@ function rowNeeds(row) {
|
|
|
47091
47159
|
return { needs: needs + gap * Math.max(0, pieces.length - 1), gap };
|
|
47092
47160
|
}
|
|
47093
47161
|
function useToolbarFit(row) {
|
|
47094
|
-
const [fold, setFold] =
|
|
47095
|
-
|
|
47162
|
+
const [fold, setFold] = useState129(0);
|
|
47163
|
+
useEffect109(() => {
|
|
47096
47164
|
if (!row) return;
|
|
47097
47165
|
const widths = {
|
|
47098
47166
|
look: { full: null, folded: null },
|
|
@@ -47176,8 +47244,8 @@ function clippedEnds(scrollLeft, clientWidth, scrollWidth) {
|
|
|
47176
47244
|
return start && end ? "both" : start ? "start" : end ? "end" : "none";
|
|
47177
47245
|
}
|
|
47178
47246
|
function useSlotScroll(slot) {
|
|
47179
|
-
const [ends, setEnds] =
|
|
47180
|
-
|
|
47247
|
+
const [ends, setEnds] = useState129("none");
|
|
47248
|
+
useEffect109(() => {
|
|
47181
47249
|
if (!slot) return;
|
|
47182
47250
|
let pending = 0;
|
|
47183
47251
|
const read = () => {
|
|
@@ -47260,7 +47328,7 @@ function RailFrame({
|
|
|
47260
47328
|
function filterInWords(filter, fields) {
|
|
47261
47329
|
const nameOf2 = (key) => {
|
|
47262
47330
|
const field2 = fields.find((f) => f.key === key);
|
|
47263
|
-
return field2 ? fieldName(field2) :
|
|
47331
|
+
return field2 ? fieldName(field2) : humanizeIdentifier19(key);
|
|
47264
47332
|
};
|
|
47265
47333
|
const parts = Object.keys(filter).map((key) => {
|
|
47266
47334
|
const value = filter[key];
|
|
@@ -47295,10 +47363,10 @@ function TableNotHere({
|
|
|
47295
47363
|
className
|
|
47296
47364
|
}) {
|
|
47297
47365
|
const client = useRecordsClient96();
|
|
47298
|
-
const [archived, setArchived] =
|
|
47299
|
-
const [restoring, setRestoring] =
|
|
47300
|
-
const [refusal4, setRefusal] =
|
|
47301
|
-
|
|
47366
|
+
const [archived, setArchived] = useState130({ phase: "asking" });
|
|
47367
|
+
const [restoring, setRestoring] = useState130(false);
|
|
47368
|
+
const [refusal4, setRefusal] = useState130(null);
|
|
47369
|
+
useEffect110(() => {
|
|
47302
47370
|
let alive = true;
|
|
47303
47371
|
void client.tableArchived({ table_id: tableId }).then((answered) => {
|
|
47304
47372
|
if (!alive) return;
|
|
@@ -47505,9 +47573,9 @@ function TablePage({
|
|
|
47505
47573
|
const askedInWords = filter ? filterInWords(filter, pageFields.data ?? []) : null;
|
|
47506
47574
|
const organizationId = useRecordsClient96().config.organizationId;
|
|
47507
47575
|
const publicReadOnly = usePublicReadOnly(client, organizationId, tableId, table.data, rights);
|
|
47508
|
-
const [view, setView] =
|
|
47509
|
-
const [looks, setLooks] =
|
|
47510
|
-
|
|
47576
|
+
const [view, setView] = useState130(null);
|
|
47577
|
+
const [looks, setLooks] = useState130(void 0);
|
|
47578
|
+
useEffect110(() => {
|
|
47511
47579
|
let live = true;
|
|
47512
47580
|
setLooks(void 0);
|
|
47513
47581
|
void readLooks(client, tableId).then((answered) => {
|
|
@@ -47520,7 +47588,7 @@ function TablePage({
|
|
|
47520
47588
|
}, [client, tableId]);
|
|
47521
47589
|
const look = view && looks ? looks[view.id] : void 0;
|
|
47522
47590
|
const shown4 = view ? applyLook(view, look) : null;
|
|
47523
|
-
const [viewsEpoch, setViewsEpoch] =
|
|
47591
|
+
const [viewsEpoch, setViewsEpoch] = useState130(0);
|
|
47524
47592
|
const opening = openingRail(activeRecordId, activeRail);
|
|
47525
47593
|
const recordsUi = useRecordsUi();
|
|
47526
47594
|
const hostLayouts = recordsUi.layouts ?? [];
|
|
@@ -47530,39 +47598,39 @@ function TablePage({
|
|
|
47530
47598
|
const questionsFromLink = questionsFromParam(activeView);
|
|
47531
47599
|
const openedByPackage = openingView(hostFromLink || savedFromLink || questionsFromLink ? null : activeView, activeDashboardId);
|
|
47532
47600
|
const opened = hostFromLink ? { ...openedByPackage, main: "records" } : questionsFromLink ? { ...openedByPackage, main: "questions" } : openedByPackage;
|
|
47533
|
-
const [hostLayout, setHostLayout] =
|
|
47534
|
-
const [views, setViews] =
|
|
47535
|
-
const [pickedViewId, setPickedViewId] =
|
|
47601
|
+
const [hostLayout, setHostLayout] = useState130(hostFromLink);
|
|
47602
|
+
const [views, setViews] = useState130(void 0);
|
|
47603
|
+
const [pickedViewId, setPickedViewId] = useState130(savedFromLink);
|
|
47536
47604
|
const viewSeen = useRef57(null);
|
|
47537
|
-
const [viewLinkMissed, setViewLinkMissed] =
|
|
47538
|
-
const [layoutChosen, setLayoutChosen] =
|
|
47605
|
+
const [viewLinkMissed, setViewLinkMissed] = useState130(false);
|
|
47606
|
+
const [layoutChosen, setLayoutChosen] = useState130(false);
|
|
47539
47607
|
const railAsked = typeof activeRail === "string" ? activeRail.trim() : "";
|
|
47540
47608
|
const railUnknown = railAsked !== "" && railFromParam(railAsked) === null ? railAsked : null;
|
|
47541
47609
|
const shareFromLink = railFromParam(activeRail) === "share";
|
|
47542
47610
|
const canShare = useCanShare();
|
|
47543
47611
|
const itemFor = (which) => railFromParam(activeRail) === which ? activeItemId ?? null : null;
|
|
47544
|
-
const [asking, setAsking] =
|
|
47545
|
-
const [layoutFromLink, setLayoutFromLink] =
|
|
47546
|
-
const [surface, setSurface] =
|
|
47612
|
+
const [asking, setAsking] = useState130(null);
|
|
47613
|
+
const [layoutFromLink, setLayoutFromLink] = useState130(opened.layout);
|
|
47614
|
+
const [surface, setSurface] = useState130({
|
|
47547
47615
|
main: opened.main,
|
|
47548
47616
|
rail: opening.rail
|
|
47549
47617
|
});
|
|
47550
47618
|
const { main, rail } = surface;
|
|
47551
|
-
const [questionDraft, setQuestionDraft] =
|
|
47619
|
+
const [questionDraft, setQuestionDraft] = useState130(null);
|
|
47552
47620
|
const setRail = (next) => setSurface((now) => ({ ...now, rail: next }));
|
|
47553
|
-
const [importEpoch, setImportEpoch] =
|
|
47554
|
-
const [openRecord, setOpenRecord] =
|
|
47621
|
+
const [importEpoch, setImportEpoch] = useState130(0);
|
|
47622
|
+
const [openRecord, setOpenRecord] = useState130(opening.record);
|
|
47555
47623
|
const phone = useIsMobile2();
|
|
47556
|
-
const [shareAsked, setShareAsked] =
|
|
47624
|
+
const [shareAsked, setShareAsked] = useState130(0);
|
|
47557
47625
|
const { open: renameOpen, setOpen: setRenameOpen, ask: askRename, menuContentProps: renameMenuProps } = useRenameFromMenu();
|
|
47558
|
-
const [archiveAsked, setArchiveAsked] =
|
|
47559
|
-
const [moveAsked, setMoveAsked] =
|
|
47560
|
-
const [duplicateOpen, setDuplicateOpen] =
|
|
47561
|
-
const [referenceOpen, setReferenceOpen] =
|
|
47562
|
-
const [breakDownOpen, setBreakDownOpen] =
|
|
47626
|
+
const [archiveAsked, setArchiveAsked] = useState130(0);
|
|
47627
|
+
const [moveAsked, setMoveAsked] = useState130(0);
|
|
47628
|
+
const [duplicateOpen, setDuplicateOpen] = useState130(false);
|
|
47629
|
+
const [referenceOpen, setReferenceOpen] = useState130(false);
|
|
47630
|
+
const [breakDownOpen, setBreakDownOpen] = useState130(false);
|
|
47563
47631
|
const canGetReference = useCanGetReference();
|
|
47564
|
-
const [toolbarSlot, setToolbarSlot] =
|
|
47565
|
-
const [toolbarRow, setToolbarRow] =
|
|
47632
|
+
const [toolbarSlot, setToolbarSlot] = useState130(null);
|
|
47633
|
+
const [toolbarRow, setToolbarRow] = useState130(null);
|
|
47566
47634
|
const toolbarFold2 = useToolbarFit(toolbarRow);
|
|
47567
47635
|
const slotClipped = useSlotScroll(toolbarSlot);
|
|
47568
47636
|
const face = tableOpening(view, hostLayouts.map((h) => h.id));
|
|
@@ -47573,7 +47641,7 @@ function TablePage({
|
|
|
47573
47641
|
const chooserCompact = !embedded && !designated && !phone && toolbarFold2 >= 2;
|
|
47574
47642
|
const controlsInSheet = phone && !designated;
|
|
47575
47643
|
const shareInMenu = phone || toolbarFold2 >= 4;
|
|
47576
|
-
|
|
47644
|
+
useEffect110(() => {
|
|
47577
47645
|
if (face.kind !== "designated") return;
|
|
47578
47646
|
if (hostFromLink || opened.layout || layoutChosen) return;
|
|
47579
47647
|
setHostLayout(face.hostLayout);
|
|
@@ -47606,7 +47674,7 @@ function TablePage({
|
|
|
47606
47674
|
const shownSignature = JSON.stringify(shownReport);
|
|
47607
47675
|
const reportRef = useRef57(onShownViewChange);
|
|
47608
47676
|
reportRef.current = onShownViewChange;
|
|
47609
|
-
|
|
47677
|
+
useEffect110(() => {
|
|
47610
47678
|
reportRef.current?.(JSON.parse(shownSignature));
|
|
47611
47679
|
}, [shownSignature]);
|
|
47612
47680
|
const pickLayout = (next) => {
|
|
@@ -47623,18 +47691,18 @@ function TablePage({
|
|
|
47623
47691
|
setSurface((now) => ({ ...now, main: "records" }));
|
|
47624
47692
|
onViewChanged?.(id);
|
|
47625
47693
|
};
|
|
47626
|
-
|
|
47694
|
+
useEffect110(() => {
|
|
47627
47695
|
if (!activeRecordId) return;
|
|
47628
47696
|
setOpenRecord(activeRecordId);
|
|
47629
47697
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
47630
47698
|
}, [activeRecordId]);
|
|
47631
|
-
|
|
47699
|
+
useEffect110(() => {
|
|
47632
47700
|
if (activeRecordId) return;
|
|
47633
47701
|
const named = railFromParam(activeRail);
|
|
47634
47702
|
if (named === null || named === "share") return;
|
|
47635
47703
|
setSurface((now) => ({ ...now, rail: named }));
|
|
47636
47704
|
}, [activeRail, activeRecordId]);
|
|
47637
|
-
|
|
47705
|
+
useEffect110(() => {
|
|
47638
47706
|
const host = hostLayoutFor(activeView);
|
|
47639
47707
|
if (host) {
|
|
47640
47708
|
setHostLayout(host);
|
|
@@ -47648,7 +47716,7 @@ function TablePage({
|
|
|
47648
47716
|
setLayoutFromLink(isLayout ? named : null);
|
|
47649
47717
|
setSurface((now) => ({ ...now, main: isLayout ? "records" : named }));
|
|
47650
47718
|
}, [activeView]);
|
|
47651
|
-
const [viewSaveRefused, setViewSaveRefused] =
|
|
47719
|
+
const [viewSaveRefused, setViewSaveRefused] = useState130(null);
|
|
47652
47720
|
const patchView = useCallback67(
|
|
47653
47721
|
async (asked3) => {
|
|
47654
47722
|
const current = view;
|
|
@@ -47666,8 +47734,8 @@ function TablePage({
|
|
|
47666
47734
|
[client, tableId, view, looks]
|
|
47667
47735
|
);
|
|
47668
47736
|
const arrival = useRef57(viewAddress ?? null);
|
|
47669
|
-
const [gridQuery, setGridQuery] =
|
|
47670
|
-
const [addressResetEpoch, setAddressResetEpoch] =
|
|
47737
|
+
const [gridQuery, setGridQuery] = useState130(null);
|
|
47738
|
+
const [addressResetEpoch, setAddressResetEpoch] = useState130(0);
|
|
47671
47739
|
const reportGrid = useCallback67((q) => {
|
|
47672
47740
|
const next = { sort: q.sort, filters: q.filters, search: q.search, page: q.page };
|
|
47673
47741
|
setGridQuery((held) => sameViewAddress(held, next) ? held : next);
|
|
@@ -47677,7 +47745,7 @@ function TablePage({
|
|
|
47677
47745
|
[reportGrid, addressResetEpoch]
|
|
47678
47746
|
);
|
|
47679
47747
|
const hiddenApplied = useRef57(false);
|
|
47680
|
-
|
|
47748
|
+
useEffect110(() => {
|
|
47681
47749
|
const hidden = arrival.current?.hidden;
|
|
47682
47750
|
if (hiddenApplied.current || !view || !looks || !hidden || hidden.length === 0) return;
|
|
47683
47751
|
hiddenApplied.current = true;
|
|
@@ -47700,7 +47768,7 @@ function TablePage({
|
|
|
47700
47768
|
const addressReportRef = useRef57(onViewAddressChange);
|
|
47701
47769
|
addressReportRef.current = onViewAddressChange;
|
|
47702
47770
|
const addressSent = useRef57(null);
|
|
47703
|
-
|
|
47771
|
+
useEffect110(() => {
|
|
47704
47772
|
if (!addressReady) return;
|
|
47705
47773
|
if (addressSent.current === null && addressSignature === JSON.stringify(viewAddressToParams(arrival.current))) {
|
|
47706
47774
|
addressSent.current = addressSignature;
|
|
@@ -47712,9 +47780,9 @@ function TablePage({
|
|
|
47712
47780
|
}, [addressReady, addressSignature]);
|
|
47713
47781
|
const queryShowing = !isViewAddressEmpty({ ...gridQuery ?? {}, hidden: [] });
|
|
47714
47782
|
const lookShowing = Boolean(view && looks && (lookDiffers(view, looks[view.id]) || queryShowing));
|
|
47715
|
-
const [lookRefused, setLookRefused] =
|
|
47716
|
-
const [namingLook, setNamingLook] =
|
|
47717
|
-
const [lookName, setLookName] =
|
|
47783
|
+
const [lookRefused, setLookRefused] = useState130(null);
|
|
47784
|
+
const [namingLook, setNamingLook] = useState130(false);
|
|
47785
|
+
const [lookName, setLookName] = useState130("");
|
|
47718
47786
|
const resetLook = async () => {
|
|
47719
47787
|
const current = view;
|
|
47720
47788
|
setAddressResetEpoch((n) => n + 1);
|
|
@@ -47773,7 +47841,7 @@ function TablePage({
|
|
|
47773
47841
|
setPickedViewId(written.data);
|
|
47774
47842
|
setViewsEpoch((n) => n + 1);
|
|
47775
47843
|
};
|
|
47776
|
-
const [designateRefused, setDesignateRefused] =
|
|
47844
|
+
const [designateRefused, setDesignateRefused] = useState130(null);
|
|
47777
47845
|
const opensAs = view?.isDefault ? openingLayoutOf(view) : null;
|
|
47778
47846
|
const canDesignate = Boolean(
|
|
47779
47847
|
rights.write && view && layoutShowing && layoutShowing !== opensAs && (storeKeepsLayout(layoutShowing) || hostLayouts.some((h) => h.id === layoutShowing))
|
|
@@ -47956,10 +48024,10 @@ function TablePage({
|
|
|
47956
48024
|
actionsRef.current = actions;
|
|
47957
48025
|
const onActionsRef = useRef57(onActions);
|
|
47958
48026
|
onActionsRef.current = onActions;
|
|
47959
|
-
|
|
48027
|
+
useEffect110(() => {
|
|
47960
48028
|
onActionsRef.current?.(actionsRef.current);
|
|
47961
48029
|
});
|
|
47962
|
-
|
|
48030
|
+
useEffect110(() => {
|
|
47963
48031
|
const onKey = (event) => {
|
|
47964
48032
|
const asked3 = objectActionForKey(actionsRef.current, event);
|
|
47965
48033
|
if (!asked3) return;
|
|
@@ -48188,7 +48256,7 @@ function TablePage({
|
|
|
48188
48256
|
] })
|
|
48189
48257
|
] }) }),
|
|
48190
48258
|
/* @__PURE__ */ jsxs144(DropdownMenuContent9, { align: "start", className: "w-60", "data-view-look-menu-content": "", children: [
|
|
48191
|
-
/* @__PURE__ */ jsx155(DropdownMenuLabel3, { className: "text-xs font-normal text-muted-foreground",
|
|
48259
|
+
/* @__PURE__ */ jsx155(DropdownMenuLabel3, { className: "text-xs font-normal text-muted-foreground", title: LOOK_WORDS.yours, children: LOOK_WORDS.yoursLabel }),
|
|
48192
48260
|
lookSavable ? /* @__PURE__ */ jsx155(DropdownMenuItem7, { onSelect: () => void saveLookToView(), "data-view-look-save": "", children: LOOK_WORDS.saveToView }) : null,
|
|
48193
48261
|
rights.write ? /* @__PURE__ */ jsx155(DropdownMenuItem7, { onSelect: () => setNamingLook(true), "data-view-look-save-new": "", children: LOOK_WORDS.saveAsNew }) : null,
|
|
48194
48262
|
/* @__PURE__ */ jsx155(DropdownMenuItem7, { onSelect: () => void resetLook(), "data-view-look-reset": "", children: LOOK_WORDS.reset })
|
|
@@ -48500,8 +48568,8 @@ var PUBLIC_READ_ONLY = "Public \xB7 read only";
|
|
|
48500
48568
|
function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
48501
48569
|
const readOnly = rights.known && rights.read && !rights.write;
|
|
48502
48570
|
const marked = table?.published_to_web;
|
|
48503
|
-
const [isPublic, setIsPublic] =
|
|
48504
|
-
|
|
48571
|
+
const [isPublic, setIsPublic] = useState130(false);
|
|
48572
|
+
useEffect110(() => {
|
|
48505
48573
|
if (!readOnly || !table) {
|
|
48506
48574
|
setIsPublic(false);
|
|
48507
48575
|
return;
|
|
@@ -48526,7 +48594,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
48526
48594
|
// src/entityViews.tsx
|
|
48527
48595
|
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
48528
48596
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
48529
|
-
import { useEffect as
|
|
48597
|
+
import { useEffect as useEffect111, useMemo as useMemo77, useState as useState131 } from "react";
|
|
48530
48598
|
import { Button as Button106, ErrorBox as ErrorBox9, Input as Input12, cn as cn95 } from "@ai-matrx/design-system";
|
|
48531
48599
|
import { useRecordsClient as useRecordsClient97 } from "@ai-matrx/records/react";
|
|
48532
48600
|
import { Fragment as Fragment65, jsx as jsx156, jsxs as jsxs145 } from "react/jsx-runtime";
|
|
@@ -48543,8 +48611,8 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
48543
48611
|
() => cardFields ? entity.columns.filter((c) => cardFields.includes(c.key)) : entity.columns.filter((c) => c !== title && c !== column && c.type !== "choice").slice(0, 2),
|
|
48544
48612
|
[cardFields, entity.columns, title, column]
|
|
48545
48613
|
);
|
|
48546
|
-
const [refused, setRefused] =
|
|
48547
|
-
const [over, setOver] =
|
|
48614
|
+
const [refused, setRefused] = useState131(null);
|
|
48615
|
+
const [over, setOver] = useState131(null);
|
|
48548
48616
|
if (entity.error) return /* @__PURE__ */ jsx156("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This board could not be read: ${entity.error}` });
|
|
48549
48617
|
if (!entity.loading && !column) {
|
|
48550
48618
|
return /* @__PURE__ */ jsx156("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `${entity.label ?? "This table"} has no choice column to make a board of.` });
|
|
@@ -48612,8 +48680,8 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
48612
48680
|
const client = useRecordsClient97();
|
|
48613
48681
|
const m = measure ?? { op: "count" };
|
|
48614
48682
|
const ask = JSON.stringify([source.token, by ?? null, m, where ?? null, organization ?? null]);
|
|
48615
|
-
const [block, setBlock] =
|
|
48616
|
-
|
|
48683
|
+
const [block, setBlock] = useState131(null);
|
|
48684
|
+
useEffect111(() => {
|
|
48617
48685
|
let cancelled = false;
|
|
48618
48686
|
const question = {
|
|
48619
48687
|
...by ? { by: [by] } : {},
|
|
@@ -48676,20 +48744,20 @@ function EntityTablePageBody({
|
|
|
48676
48744
|
actions,
|
|
48677
48745
|
className
|
|
48678
48746
|
}) {
|
|
48679
|
-
const [typed2, setTyped] =
|
|
48747
|
+
const [typed2, setTyped] = useState131("");
|
|
48680
48748
|
const term = searchOverride ?? typed2;
|
|
48681
48749
|
const entity = useEntityTable(source.token, { pageSize, search: term });
|
|
48682
|
-
const [layout, setLayout] =
|
|
48683
|
-
|
|
48750
|
+
const [layout, setLayout] = useState131(opened);
|
|
48751
|
+
useEffect111(() => setLayout(opened), [opened]);
|
|
48684
48752
|
const choose = (next) => {
|
|
48685
48753
|
setLayout(next);
|
|
48686
48754
|
onLayoutChange?.(next);
|
|
48687
48755
|
};
|
|
48688
48756
|
const boardable = entityChoiceColumns(entity.columns).length > 0;
|
|
48689
48757
|
const nameColumn = entityNameColumn(entity.columns);
|
|
48690
|
-
const [naming, setNaming] =
|
|
48691
|
-
const [adding, setAdding] =
|
|
48692
|
-
const [addRefused, setAddRefused] =
|
|
48758
|
+
const [naming, setNaming] = useState131(null);
|
|
48759
|
+
const [adding, setAdding] = useState131(false);
|
|
48760
|
+
const [addRefused, setAddRefused] = useState131(null);
|
|
48693
48761
|
const add = async () => {
|
|
48694
48762
|
const name = (naming ?? "").trim();
|
|
48695
48763
|
if (!name || !nameColumn || adding) return;
|
|
@@ -48701,7 +48769,7 @@ function EntityTablePageBody({
|
|
|
48701
48769
|
setNaming(null);
|
|
48702
48770
|
onOpenRecord?.(made.id);
|
|
48703
48771
|
};
|
|
48704
|
-
const [question, setQuestion] =
|
|
48772
|
+
const [question, setQuestion] = useState131(() => questionFromGrouping(void 0));
|
|
48705
48773
|
const { config: drill } = useDrill({
|
|
48706
48774
|
source,
|
|
48707
48775
|
question,
|
|
@@ -48804,7 +48872,7 @@ function TablePage2(props) {
|
|
|
48804
48872
|
}
|
|
48805
48873
|
|
|
48806
48874
|
// src/DataBindingPicker.tsx
|
|
48807
|
-
import { useEffect as
|
|
48875
|
+
import { useEffect as useEffect112, useMemo as useMemo78 } from "react";
|
|
48808
48876
|
import { isEntityReferenceConfig } from "@ai-matrx/records";
|
|
48809
48877
|
import { useFields as useFields37, useTable as useTable37 } from "@ai-matrx/records/react";
|
|
48810
48878
|
import { BasicInput as BasicInput34, Button as Button107, CreatablePicker as CreatablePicker3, cn as cn96 } from "@ai-matrx/design-system";
|
|
@@ -48900,7 +48968,7 @@ function BindingDetails({
|
|
|
48900
48968
|
const fields = useFields37(tableId);
|
|
48901
48969
|
const fieldList = useMemo78(() => fields.data ?? [], [fields.data]);
|
|
48902
48970
|
const shape = binding.semantic_type;
|
|
48903
|
-
|
|
48971
|
+
useEffect112(() => {
|
|
48904
48972
|
if (disabled || shape === "value" || binding.transform || fields.loading || fieldList.length === 0) return;
|
|
48905
48973
|
onChange({
|
|
48906
48974
|
...binding,
|
|
@@ -49122,7 +49190,7 @@ function RecordNameWords({ tableId, recordId }) {
|
|
|
49122
49190
|
}
|
|
49123
49191
|
|
|
49124
49192
|
// src/HeldChangeDecision.tsx
|
|
49125
|
-
import { useEffect as
|
|
49193
|
+
import { useEffect as useEffect113, useState as useState132 } from "react";
|
|
49126
49194
|
import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient98 } from "@ai-matrx/records/react";
|
|
49127
49195
|
import { Button as Button108 } from "@ai-matrx/design-system";
|
|
49128
49196
|
import { jsx as jsx160, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
@@ -49131,10 +49199,10 @@ function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, on
|
|
|
49131
49199
|
}
|
|
49132
49200
|
function Decision({ approvalId, onDecided }) {
|
|
49133
49201
|
const client = useRecordsClient98();
|
|
49134
|
-
const [may, setMay] =
|
|
49135
|
-
const [busy, setBusy] =
|
|
49136
|
-
const [error, setError] =
|
|
49137
|
-
|
|
49202
|
+
const [may, setMay] = useState132(null);
|
|
49203
|
+
const [busy, setBusy] = useState132(null);
|
|
49204
|
+
const [error, setError] = useState132(null);
|
|
49205
|
+
useEffect113(() => {
|
|
49138
49206
|
let live = true;
|
|
49139
49207
|
void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
|
|
49140
49208
|
if (!live) return;
|
|
@@ -49167,7 +49235,7 @@ function Decision({ approvalId, onDecided }) {
|
|
|
49167
49235
|
}
|
|
49168
49236
|
|
|
49169
49237
|
// src/TemplatePreview.tsx
|
|
49170
|
-
import { useEffect as
|
|
49238
|
+
import { useEffect as useEffect114, useMemo as useMemo79, useState as useState133 } from "react";
|
|
49171
49239
|
import { templatePreview } from "@ai-matrx/records/memory";
|
|
49172
49240
|
import { useRecordsClient as useRecordsClient99 } from "@ai-matrx/records/react";
|
|
49173
49241
|
import { jsx as jsx161, jsxs as jsxs149 } from "react/jsx-runtime";
|
|
@@ -49178,7 +49246,7 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
|
|
|
49178
49246
|
const preview = useTemplatePreview(spec, today);
|
|
49179
49247
|
const bound2 = useMemo79(() => ({ ...host, sayLevelNeeded: false }), [host]);
|
|
49180
49248
|
const first = preview.tables.find((t) => t.token === initialTable) ?? preview.tables[0];
|
|
49181
|
-
const [active, setActive] =
|
|
49249
|
+
const [active, setActive] = useState133(first?.id ?? null);
|
|
49182
49250
|
const table = preview.tables.find((t) => t.id === active) ?? first;
|
|
49183
49251
|
if (!table) return null;
|
|
49184
49252
|
return /* @__PURE__ */ jsxs149("div", { className: ["flex min-w-0 flex-col gap-3", className].filter(Boolean).join(" "), "data-template-preview": preview.tables.length, children: [
|
|
@@ -49216,9 +49284,9 @@ function TemplatePreview({ spec, today, initialTable, host, aside, booking, clas
|
|
|
49216
49284
|
}
|
|
49217
49285
|
function PreviewForms({ preview, booking }) {
|
|
49218
49286
|
const client = useRecordsClient99();
|
|
49219
|
-
const [forms, setForms] =
|
|
49220
|
-
const [pages, setPages] =
|
|
49221
|
-
|
|
49287
|
+
const [forms, setForms] = useState133(null);
|
|
49288
|
+
const [pages, setPages] = useState133([]);
|
|
49289
|
+
useEffect114(() => {
|
|
49222
49290
|
let gone = false;
|
|
49223
49291
|
void client.forms().then((answered) => {
|
|
49224
49292
|
if (!gone) setForms(answered.ok ? answered.data.map(formFromSummary) : []);
|