@ai-matrx/records-ui 0.113.16 → 0.113.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.cjs +151 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +723 -603
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +109 -14
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +149 -54
- package/dist/pickers.js.map +1 -1
- package/package.json +3 -3
package/dist/pickers.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// src/TablePickers.tsx
|
|
4
4
|
import { useEffect as useEffect21, useMemo as useMemo12, useState as useState29 } from "react";
|
|
5
5
|
import { RecordsProvider as RecordsProvider2, useFields as useFields3, useRecords as useRecords3, useTable as useTable2 } from "@ai-matrx/records/react";
|
|
6
|
-
import { Button as
|
|
6
|
+
import { Button as Button17, CreatablePicker } from "@ai-matrx/design-system";
|
|
7
7
|
|
|
8
8
|
// src/askOnce.ts
|
|
9
9
|
import { onTableStructureChanged } from "@ai-matrx/records/core";
|
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
BasicInput as BasicInput11,
|
|
73
73
|
BasicTextarea as BasicTextarea4,
|
|
74
74
|
Badge as Badge6,
|
|
75
|
-
Button as
|
|
75
|
+
Button as Button16,
|
|
76
76
|
Checkbox as Checkbox5,
|
|
77
77
|
Label as Label9,
|
|
78
78
|
Popover as Popover5,
|
|
@@ -1578,9 +1578,9 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
1578
1578
|
|
|
1579
1579
|
// src/buttonCell.tsx
|
|
1580
1580
|
import { useState as useState22 } from "react";
|
|
1581
|
-
import { Button as
|
|
1581
|
+
import { Button as Button15, Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, Popover as Popover3, PopoverContent as PopoverContent3, PopoverTrigger as PopoverTrigger3, cn as cn20 } from "@ai-matrx/design-system";
|
|
1582
1582
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2, NEUTRAL_CHIP_CLASS as NEUTRAL_CHIP_CLASS2, isStyleColor as isStyleColor2 } from "@ai-matrx/design-system/data-table";
|
|
1583
|
-
import { buttonNeeds, buttonOf as buttonOf2 } from "@ai-matrx/records";
|
|
1583
|
+
import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
|
|
1584
1584
|
import { useOptionalRecordsClient as useOptionalRecordsClient7 } from "@ai-matrx/records/react";
|
|
1585
1585
|
|
|
1586
1586
|
// src/columnName.ts
|
|
@@ -1612,7 +1612,7 @@ import {
|
|
|
1612
1612
|
import { announceRecordChanged } from "@ai-matrx/records/core";
|
|
1613
1613
|
import {
|
|
1614
1614
|
BasicInput as BasicInput9,
|
|
1615
|
-
Button as
|
|
1615
|
+
Button as Button14,
|
|
1616
1616
|
Checkbox as Checkbox4,
|
|
1617
1617
|
Label as Label8,
|
|
1618
1618
|
Select as Select6,
|
|
@@ -5681,11 +5681,11 @@ function nextFieldSort(fields) {
|
|
|
5681
5681
|
}
|
|
5682
5682
|
|
|
5683
5683
|
// src/FieldEditor.tsx
|
|
5684
|
-
import { autonumberPrefixOf as autonumberPrefixOf3, buttonOf } from "@ai-matrx/records";
|
|
5684
|
+
import { autonumberPrefixOf as autonumberPrefixOf3, buttonNeeds, buttonOf } from "@ai-matrx/records";
|
|
5685
5685
|
|
|
5686
5686
|
// src/ButtonSettings.tsx
|
|
5687
5687
|
import { useEffect as useEffect15, useState as useState20 } from "react";
|
|
5688
|
-
import { BasicInput as BasicInput8, Label as Label7 } from "@ai-matrx/design-system";
|
|
5688
|
+
import { BasicInput as BasicInput8, Button as Button13, Label as Label7 } from "@ai-matrx/design-system";
|
|
5689
5689
|
import { STYLE_COLORS as STYLE_COLORS3 } from "@ai-matrx/design-system/data-table";
|
|
5690
5690
|
import { buttonUrlPlaceholders } from "@ai-matrx/records";
|
|
5691
5691
|
import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
|
|
@@ -5751,13 +5751,16 @@ function ButtonSettingsEditor({
|
|
|
5751
5751
|
}) {
|
|
5752
5752
|
const client = useOptionalRecordsClient6();
|
|
5753
5753
|
const [actions, setActions] = useState20(null);
|
|
5754
|
+
const [actionsRefused, setActionsRefused] = useState20(null);
|
|
5754
5755
|
const [automations, setAutomations] = useState20(null);
|
|
5755
5756
|
useEffect15(() => {
|
|
5756
5757
|
if (!client || !tableId) return;
|
|
5757
5758
|
let live = true;
|
|
5758
5759
|
if (value.do === "run_action" && actions === null) {
|
|
5759
5760
|
void client.rowActions({ table_id: tableId }).then((got) => {
|
|
5760
|
-
if (live)
|
|
5761
|
+
if (!live) return;
|
|
5762
|
+
if (!got.ok) return setActionsRefused(got.error);
|
|
5763
|
+
setActions((got.data?.actions ?? []).filter((a) => a.id));
|
|
5761
5764
|
});
|
|
5762
5765
|
}
|
|
5763
5766
|
if (value.do === "run_automation" && automations === null) {
|
|
@@ -5831,16 +5834,32 @@ function ButtonSettingsEditor({
|
|
|
5831
5834
|
] }),
|
|
5832
5835
|
value.url && buttonUrlPlaceholders(value.url).length > 0 ? /* @__PURE__ */ jsx29("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
|
|
5833
5836
|
] }) : null,
|
|
5834
|
-
value.do === "run_action" ?
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5837
|
+
value.do === "run_action" ? !tableId ? /* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ jsx29(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
|
|
5838
|
+
actions === null || actions.length > 0 ? /* @__PURE__ */ jsx29(
|
|
5839
|
+
PickOne,
|
|
5840
|
+
{
|
|
5841
|
+
label: "Row action",
|
|
5842
|
+
value: value.action_id ?? "",
|
|
5843
|
+
placeholder: actions ? "Choose a row action" : "Reading row actions\u2026",
|
|
5844
|
+
attrs: { "data-records-button-action-pick": "" },
|
|
5845
|
+
onChange: (id) => set({ action_id: id }),
|
|
5846
|
+
options: (actions ?? []).map((a) => ({ value: a.id, label: a.name }))
|
|
5847
|
+
}
|
|
5848
|
+
) : null,
|
|
5849
|
+
actions !== null ? /* @__PURE__ */ jsx29(
|
|
5850
|
+
NewRowAction,
|
|
5851
|
+
{
|
|
5852
|
+
tableId,
|
|
5853
|
+
label: value.label,
|
|
5854
|
+
actions,
|
|
5855
|
+
columns,
|
|
5856
|
+
onMade: (made, all) => {
|
|
5857
|
+
setActions(all);
|
|
5858
|
+
set({ action_id: made });
|
|
5859
|
+
}
|
|
5860
|
+
}
|
|
5861
|
+
) : null
|
|
5862
|
+
] }) : null,
|
|
5844
5863
|
value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: "No automations yet. Add one in Table settings." }) : /* @__PURE__ */ jsx29(
|
|
5845
5864
|
PickOne,
|
|
5846
5865
|
{
|
|
@@ -5853,6 +5872,70 @@ function ButtonSettingsEditor({
|
|
|
5853
5872
|
) : null
|
|
5854
5873
|
] });
|
|
5855
5874
|
}
|
|
5875
|
+
function settableColumns(columns) {
|
|
5876
|
+
return columns.filter((f) => {
|
|
5877
|
+
const kind = editorKindFor(f);
|
|
5878
|
+
return f.type !== "formula" && kind !== "formula" && kind !== "lookup" && kind !== "rollup" && !(f.type === "text" && f.format === "button");
|
|
5879
|
+
});
|
|
5880
|
+
}
|
|
5881
|
+
function NewRowAction({
|
|
5882
|
+
tableId,
|
|
5883
|
+
label,
|
|
5884
|
+
actions,
|
|
5885
|
+
columns,
|
|
5886
|
+
onMade
|
|
5887
|
+
}) {
|
|
5888
|
+
const client = useOptionalRecordsClient6();
|
|
5889
|
+
const settable = settableColumns(columns);
|
|
5890
|
+
const [fieldId, setFieldId] = useState20("");
|
|
5891
|
+
const [setTo, setSetTo] = useState20("");
|
|
5892
|
+
const [busy, setBusy] = useState20(false);
|
|
5893
|
+
const [refused, setRefused] = useState20(null);
|
|
5894
|
+
if (settable.length === 0) return /* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: "No column to set" });
|
|
5895
|
+
const make = async () => {
|
|
5896
|
+
if (!client || fieldId === "") return;
|
|
5897
|
+
setBusy(true);
|
|
5898
|
+
setRefused(null);
|
|
5899
|
+
const name = label.trim() || "Set fields";
|
|
5900
|
+
const kept = actions.map((a) => ({ ...a.id ? { id: a.id } : {}, name: a.name, kind: a.kind ?? "update", ...a.color !== void 0 ? { color: a.color } : {}, ...a.icon ? { icon: a.icon } : {}, ...a.confirm !== void 0 ? { confirm: a.confirm } : {}, ...a.steps ? { steps: a.steps } : {}, ...a.prompt ? { prompt: a.prompt } : {} }));
|
|
5901
|
+
const declared = await client.actionDeclare({
|
|
5902
|
+
table_id: tableId,
|
|
5903
|
+
actions: [...kept, { name, kind: "update", confirm: false, steps: [setTo === "" ? { field: fieldId, set: "clear" } : { field: fieldId, set: "value", value: setTo }] }]
|
|
5904
|
+
});
|
|
5905
|
+
if (!declared.ok) {
|
|
5906
|
+
setBusy(false);
|
|
5907
|
+
return setRefused(declared.error);
|
|
5908
|
+
}
|
|
5909
|
+
const reread = await client.rowActions({ table_id: tableId });
|
|
5910
|
+
setBusy(false);
|
|
5911
|
+
if (!reread.ok) return setRefused(reread.error);
|
|
5912
|
+
const all = (reread.data?.actions ?? []).filter((a) => a.id);
|
|
5913
|
+
const before = new Set(actions.map((a) => a.id));
|
|
5914
|
+
const made = all.find((a) => !before.has(a.id) && a.name === name) ?? all.find((a) => !before.has(a.id));
|
|
5915
|
+
if (!made?.id) return setRefused({ code: "internal", message: "The row action was saved but could not be read back.", hint: "Reopen this column's settings and pick it from the list." });
|
|
5916
|
+
onMade(made.id, all);
|
|
5917
|
+
};
|
|
5918
|
+
return /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1", "data-records-button-new-action": "", children: [
|
|
5919
|
+
/* @__PURE__ */ jsx29(Label7, { className: "text-xs", children: "New row action" }),
|
|
5920
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
5921
|
+
/* @__PURE__ */ jsx29(
|
|
5922
|
+
PickOne,
|
|
5923
|
+
{
|
|
5924
|
+
label: "Column to set",
|
|
5925
|
+
className: "h-8 w-40 text-xs",
|
|
5926
|
+
value: fieldId,
|
|
5927
|
+
placeholder: "Column",
|
|
5928
|
+
attrs: { "data-records-button-action-field": "" },
|
|
5929
|
+
onChange: setFieldId,
|
|
5930
|
+
options: settable.map((f) => ({ value: f.id, label: fieldName(f) }))
|
|
5931
|
+
}
|
|
5932
|
+
),
|
|
5933
|
+
/* @__PURE__ */ jsx29(BasicInput8, { className: "h-8 w-32 text-xs", placeholder: "Value", "aria-label": "Value", "data-records-button-action-value": "", value: setTo, onChange: (e) => setSetTo(e.target.value) }),
|
|
5934
|
+
/* @__PURE__ */ jsx29(Button13, { type: "button", size: "sm", variant: "outline", disabled: busy || fieldId === "", "data-records-button-action-make": "", onClick: () => void make(), children: busy ? "Making\u2026" : "Make" })
|
|
5935
|
+
] }),
|
|
5936
|
+
refused ? /* @__PURE__ */ jsx29(RefusalLine, { error: refused }) : null
|
|
5937
|
+
] });
|
|
5938
|
+
}
|
|
5856
5939
|
|
|
5857
5940
|
// src/FieldEditor.tsx
|
|
5858
5941
|
import { FIELD_SENSITIVITIES, CONTEXT_POLICIES, DECLARABLE_FIELD_KINDS as DECLARABLE_FIELD_KINDS2, optionKey as optionKey3, ratingMaxOf as ratingMaxOf2, rulesWithTopStar } from "@ai-matrx/records";
|
|
@@ -6105,9 +6188,10 @@ function FieldEditor(props) {
|
|
|
6105
6188
|
const noun = onEntity ? "field" : "column";
|
|
6106
6189
|
const nameTaken = columnNameTakenBy(label, others.map(fieldName));
|
|
6107
6190
|
const listsChoices = type === "select" || type === "multi_select" || type === "status";
|
|
6108
|
-
const
|
|
6191
|
+
const buttonMissing = type === "button" && buttonSettings.do ? buttonNeeds(buttonSettings) : null;
|
|
6192
|
+
const missing = buttonMissing ?? (editing ? formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(choiceList) : null) : formulaMissing ?? (listsChoices ? whatTheChoiceListIsMissing(newChoices) : null) ?? (type === "formula" && formulaWritten ? null : whatIsMissing(
|
|
6109
6193
|
type === "count" ? { type: "rollup", label, options, via, pick, agg: "count", of, relations: totalSources, formulaFields, relationTarget, allowedTypes, noun } : { type, label, options, via, pick, agg, of, relations: sourcesFor(type), formulaFields, relationTarget, allowedTypes, noun }
|
|
6110
|
-
));
|
|
6194
|
+
)));
|
|
6111
6195
|
const missingShown = missing && (attempted || formulaMissing) ? missing : null;
|
|
6112
6196
|
const removeConsequence = field ? `${archiveConfirmSentence(`the field \u201C${fieldName(field)}\u201D`)} Its values stay in every record and come back with it.${linkReaders.length > 0 ? ` ${readersSentence(linkReaders.length, farTable.data?.name ?? null)}` : ""}` : "";
|
|
6113
6197
|
const save = async () => {
|
|
@@ -6258,6 +6342,13 @@ function FieldEditor(props) {
|
|
|
6258
6342
|
}
|
|
6259
6343
|
}
|
|
6260
6344
|
setBackfillError(null);
|
|
6345
|
+
if (type === "relation" && relationTarget === tableId && dependency && !onEntity) {
|
|
6346
|
+
const marked = await client.fieldUpdate({ field_id: written, patch: { dependency: true } });
|
|
6347
|
+
if (!marked.ok) {
|
|
6348
|
+
setBackfillError(marked.error);
|
|
6349
|
+
return;
|
|
6350
|
+
}
|
|
6351
|
+
}
|
|
6261
6352
|
if (type === "relation" && showOnOther && otherTable.data && otherTable.data.id !== tableId) {
|
|
6262
6353
|
const made = await client.relationReverseField({ field_id: written });
|
|
6263
6354
|
if (!made.ok) {
|
|
@@ -6324,7 +6415,7 @@ function FieldEditor(props) {
|
|
|
6324
6415
|
type === "formula" && others.length > 0 ? /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-2", children: [
|
|
6325
6416
|
editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */ jsx30("p", { className: "text-[11px] text-muted-foreground", children: EDITING_A_WORKED_OUT_COLUMN }) : null : /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How to make this column", children: [
|
|
6326
6417
|
/* @__PURE__ */ jsx30(
|
|
6327
|
-
|
|
6418
|
+
Button14,
|
|
6328
6419
|
{
|
|
6329
6420
|
type: "button",
|
|
6330
6421
|
size: "sm",
|
|
@@ -6335,7 +6426,7 @@ function FieldEditor(props) {
|
|
|
6335
6426
|
}
|
|
6336
6427
|
),
|
|
6337
6428
|
/* @__PURE__ */ jsx30(
|
|
6338
|
-
|
|
6429
|
+
Button14,
|
|
6339
6430
|
{
|
|
6340
6431
|
type: "button",
|
|
6341
6432
|
size: "sm",
|
|
@@ -6432,7 +6523,7 @@ function FieldEditor(props) {
|
|
|
6432
6523
|
onChange: setRollupFilter
|
|
6433
6524
|
}
|
|
6434
6525
|
) : null,
|
|
6435
|
-
editing && field && !(type === "select" || type === "multi_select" || type === "status") ? /* @__PURE__ */ jsx30(FieldFormatPicker, { field, value: showsAs, onValue: setShowsAs }) : null,
|
|
6526
|
+
editing && field && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */ jsx30(FieldFormatPicker, { field, value: showsAs, onValue: setShowsAs }) : null,
|
|
6436
6527
|
/* @__PURE__ */ jsxs28("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
6437
6528
|
/* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-1.5", children: [
|
|
6438
6529
|
/* @__PURE__ */ jsx30(
|
|
@@ -6480,6 +6571,10 @@ function FieldEditor(props) {
|
|
|
6480
6571
|
"Show on ",
|
|
6481
6572
|
otherTable.data.name ?? "the other table"
|
|
6482
6573
|
] }) : null,
|
|
6574
|
+
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-1.5", title: "A timeline draws a line to each record this one waits on", children: [
|
|
6575
|
+
/* @__PURE__ */ jsx30(Checkbox4, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
|
|
6576
|
+
/* @__PURE__ */ jsx30("span", { children: "Waits on the linked records" })
|
|
6577
|
+
] }) : null,
|
|
6483
6578
|
!field && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ jsxs28("label", { className: "flex items-center gap-1.5", children: [
|
|
6484
6579
|
/* @__PURE__ */ jsx30(
|
|
6485
6580
|
Checkbox4,
|
|
@@ -6541,7 +6636,7 @@ function FieldEditor(props) {
|
|
|
6541
6636
|
/* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2", children: [
|
|
6542
6637
|
/* @__PURE__ */ jsx30("span", { className: "font-medium", children: "What counts as a good value" }),
|
|
6543
6638
|
/* @__PURE__ */ jsx30(
|
|
6544
|
-
|
|
6639
|
+
Button14,
|
|
6545
6640
|
{
|
|
6546
6641
|
type: "button",
|
|
6547
6642
|
size: "sm",
|
|
@@ -6608,7 +6703,7 @@ function FieldEditor(props) {
|
|
|
6608
6703
|
}
|
|
6609
6704
|
) : null,
|
|
6610
6705
|
/* @__PURE__ */ jsx30(
|
|
6611
|
-
|
|
6706
|
+
Button14,
|
|
6612
6707
|
{
|
|
6613
6708
|
type: "button",
|
|
6614
6709
|
size: "sm",
|
|
@@ -6636,7 +6731,7 @@ function FieldEditor(props) {
|
|
|
6636
6731
|
rehomed ? /* @__PURE__ */ jsxs28("div", { "data-records-choice-rehomed": "", className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
6637
6732
|
/* @__PURE__ */ jsx30("span", { children: rehomed.said }),
|
|
6638
6733
|
rehomed.undo ? /* @__PURE__ */ jsx30(
|
|
6639
|
-
|
|
6734
|
+
Button14,
|
|
6640
6735
|
{
|
|
6641
6736
|
type: "button",
|
|
6642
6737
|
size: "sm",
|
|
@@ -6660,7 +6755,7 @@ function FieldEditor(props) {
|
|
|
6660
6755
|
children: "Undo"
|
|
6661
6756
|
}
|
|
6662
6757
|
) : null,
|
|
6663
|
-
/* @__PURE__ */ jsx30(
|
|
6758
|
+
/* @__PURE__ */ jsx30(Button14, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
|
|
6664
6759
|
] }) : null,
|
|
6665
6760
|
reverseRefused ? /* @__PURE__ */ jsxs28("div", { "data-records-reverse-field-refused": "", className: "flex flex-col gap-1", children: [
|
|
6666
6761
|
/* @__PURE__ */ jsx30("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
|
|
@@ -6672,7 +6767,7 @@ function FieldEditor(props) {
|
|
|
6672
6767
|
] }) : null,
|
|
6673
6768
|
/* @__PURE__ */ jsxs28("div", { className: "flex min-w-0 flex-nowrap items-center gap-2", "data-field-editor-footer": "", children: [
|
|
6674
6769
|
/* @__PURE__ */ jsx30(
|
|
6675
|
-
|
|
6770
|
+
Button14,
|
|
6676
6771
|
{
|
|
6677
6772
|
size: "sm",
|
|
6678
6773
|
disabled: mutation.saving || Boolean(formulaMissing),
|
|
@@ -6687,7 +6782,7 @@ function FieldEditor(props) {
|
|
|
6687
6782
|
children: mutation.saving ? "Saving\u2026" : field ? EDIT_FIELD_SAVE_LABEL : onEntity ? ADD_STANDARD_FIELD_SAVE_LABEL : ADD_FIELD_SAVE_LABEL
|
|
6688
6783
|
}
|
|
6689
6784
|
),
|
|
6690
|
-
onCancel ? /* @__PURE__ */ jsx30(
|
|
6785
|
+
onCancel ? /* @__PURE__ */ jsx30(Button14, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
|
|
6691
6786
|
/* @__PURE__ */ jsx30(
|
|
6692
6787
|
"span",
|
|
6693
6788
|
{
|
|
@@ -6705,11 +6800,11 @@ function FieldEditor(props) {
|
|
|
6705
6800
|
the dialog card 0.2278 and closing it 0.1303. The consequence is the tooltip of
|
|
6706
6801
|
"Remove it" (interface-text: the slot holds a label, never a paragraph). */
|
|
6707
6802
|
/* @__PURE__ */ jsxs28("div", { className: "ml-auto grid shrink-0 items-center", "data-field-editor-remove": askingToRemove ? "asking" : "idle", children: [
|
|
6708
|
-
/* @__PURE__ */ jsx30("div", { className: cn19("col-start-1 row-start-1 flex items-center justify-end gap-2", askingToRemove && "invisible"), "aria-hidden": askingToRemove || void 0, children: /* @__PURE__ */ jsx30(
|
|
6803
|
+
/* @__PURE__ */ jsx30("div", { className: cn19("col-start-1 row-start-1 flex items-center justify-end gap-2", askingToRemove && "invisible"), "aria-hidden": askingToRemove || void 0, children: /* @__PURE__ */ jsx30(Button14, { size: "sm", variant: "outline", tabIndex: askingToRemove ? -1 : void 0, onClick: () => setAskingToRemove(true), children: "Remove this field" }) }),
|
|
6709
6804
|
/* @__PURE__ */ jsxs28("div", { className: cn19("col-start-1 row-start-1 flex items-center justify-end gap-2", !askingToRemove && "invisible"), "aria-hidden": !askingToRemove || void 0, children: [
|
|
6710
6805
|
/* @__PURE__ */ jsx30("span", { className: "whitespace-nowrap text-destructive", "data-field-editor-remove-ask": "", children: "Archive this field?" }),
|
|
6711
6806
|
/* @__PURE__ */ jsx30(
|
|
6712
|
-
|
|
6807
|
+
Button14,
|
|
6713
6808
|
{
|
|
6714
6809
|
size: "sm",
|
|
6715
6810
|
variant: "destructive",
|
|
@@ -6721,7 +6816,7 @@ function FieldEditor(props) {
|
|
|
6721
6816
|
children: "Remove it"
|
|
6722
6817
|
}
|
|
6723
6818
|
),
|
|
6724
|
-
/* @__PURE__ */ jsx30(
|
|
6819
|
+
/* @__PURE__ */ jsx30(Button14, { size: "sm", variant: "ghost", tabIndex: askingToRemove ? void 0 : -1, onClick: () => setAskingToRemove(false), children: "Keep it" })
|
|
6725
6820
|
] })
|
|
6726
6821
|
] })
|
|
6727
6822
|
) : null
|
|
@@ -6929,7 +7024,7 @@ function TypeQuestions(props) {
|
|
|
6929
7024
|
/* @__PURE__ */ jsx30("div", { className: "flex flex-wrap gap-1", children: props.others.map((f) => {
|
|
6930
7025
|
const picked = props.formulaFields.includes(f.id);
|
|
6931
7026
|
return /* @__PURE__ */ jsx30(
|
|
6932
|
-
|
|
7027
|
+
Button14,
|
|
6933
7028
|
{
|
|
6934
7029
|
type: "button",
|
|
6935
7030
|
size: "sm",
|
|
@@ -7013,7 +7108,7 @@ function RollupFilterQuestion({
|
|
|
7013
7108
|
conditionInWords(value, conditionFields),
|
|
7014
7109
|
"."
|
|
7015
7110
|
] }),
|
|
7016
|
-
/* @__PURE__ */ jsx30(
|
|
7111
|
+
/* @__PURE__ */ jsx30(Button14, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onChange(null), children: "Clear" })
|
|
7017
7112
|
] }) : /* @__PURE__ */ jsx30(
|
|
7018
7113
|
ConditionGroup,
|
|
7019
7114
|
{
|
|
@@ -7086,7 +7181,7 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
7086
7181
|
const [settingUp, setSettingUp] = useState22(false);
|
|
7087
7182
|
if (!b) return null;
|
|
7088
7183
|
const color = isStyleColor2(b.color) ? CHOICE_CHIP_CLASS2[b.color] : NEUTRAL_CHIP_CLASS2;
|
|
7089
|
-
const needs =
|
|
7184
|
+
const needs = buttonNeeds2(b);
|
|
7090
7185
|
const tableId = field.entity_definition_id;
|
|
7091
7186
|
const press = async () => {
|
|
7092
7187
|
if (!client || !recordId) return setSaid({ kind: "public" });
|
|
@@ -7105,7 +7200,7 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
7105
7200
|
return /* @__PURE__ */ jsxs29(Fragment10, { children: [
|
|
7106
7201
|
/* @__PURE__ */ jsxs29(Popover3, { open: said2 !== null, onOpenChange: (open) => open ? null : setSaid(null), children: [
|
|
7107
7202
|
/* @__PURE__ */ jsx31(PopoverTrigger3, { asChild: true, children: /* @__PURE__ */ jsx31(
|
|
7108
|
-
|
|
7203
|
+
Button15,
|
|
7109
7204
|
{
|
|
7110
7205
|
type: "button",
|
|
7111
7206
|
size: "xs",
|
|
@@ -7136,7 +7231,7 @@ function ButtonValue({ field, recordId, inCell }) {
|
|
|
7136
7231
|
said2?.kind === "needs" ? /* @__PURE__ */ jsxs29(Fragment10, { children: [
|
|
7137
7232
|
/* @__PURE__ */ jsx31("p", { children: said2.says }),
|
|
7138
7233
|
tableId ? /* @__PURE__ */ jsxs29(
|
|
7139
|
-
|
|
7234
|
+
Button15,
|
|
7140
7235
|
{
|
|
7141
7236
|
type: "button",
|
|
7142
7237
|
size: "sm",
|
|
@@ -7737,9 +7832,9 @@ function ChoiceAskButtons({
|
|
|
7737
7832
|
return /* @__PURE__ */ jsxs34("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field, words), className: "flex flex-col gap-1", children: [
|
|
7738
7833
|
/* @__PURE__ */ jsx36("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field, words) }),
|
|
7739
7834
|
/* @__PURE__ */ jsxs34("span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
7740
|
-
/* @__PURE__ */ jsx36(
|
|
7741
|
-
keepOffered ? /* @__PURE__ */ jsx36(
|
|
7742
|
-
/* @__PURE__ */ jsx36(
|
|
7835
|
+
/* @__PURE__ */ jsx36(Button16, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
|
|
7836
|
+
keepOffered ? /* @__PURE__ */ jsx36(Button16, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
|
|
7837
|
+
/* @__PURE__ */ jsx36(Button16, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
|
|
7743
7838
|
] })
|
|
7744
7839
|
] });
|
|
7745
7840
|
}
|
|
@@ -7917,7 +8012,7 @@ function TypedTextControl({ field, value, onChange, disabled, id, onCommit, onCa
|
|
|
7917
8012
|
}
|
|
7918
8013
|
) : "refusal" in judged ? /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
7919
8014
|
/* @__PURE__ */ jsx36(FloatingRefusal, { text: judged.refusal, why: "why" in judged ? judged.why : void 0 }),
|
|
7920
|
-
judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx36("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ jsx36(
|
|
8015
|
+
judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx36("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ jsx36(Button16, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
|
|
7921
8016
|
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs34(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
|
|
7922
8017
|
isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field)}. ` : null,
|
|
7923
8018
|
"Reads as",
|
|
@@ -8120,7 +8215,7 @@ function CheckboxControl({ field, value, onChange, disabled, id }) {
|
|
|
8120
8215
|
unanswered ? /* @__PURE__ */ jsx36("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
8121
8216
|
/* @__PURE__ */ jsx36("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
|
|
8122
8217
|
field.required ? null : /* @__PURE__ */ jsx36(
|
|
8123
|
-
|
|
8218
|
+
Button16,
|
|
8124
8219
|
{
|
|
8125
8220
|
size: "sm",
|
|
8126
8221
|
variant: "ghost",
|
|
@@ -8284,7 +8379,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
8284
8379
|
const chosen = options.filter((option) => choiceValuesOf(value).some((v) => isTheChosen(option, v)));
|
|
8285
8380
|
const picked = new Set(chosen.map((option) => optionKey4(option)));
|
|
8286
8381
|
const toggles = /* @__PURE__ */ jsx36("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ jsx36(
|
|
8287
|
-
|
|
8382
|
+
Button16,
|
|
8288
8383
|
{
|
|
8289
8384
|
type: "button",
|
|
8290
8385
|
size: "sm",
|
|
@@ -8309,7 +8404,7 @@ function OptionControl({ field, value, onChange, disabled, id, autoOpen, onClose
|
|
|
8309
8404
|
if (!open) onClose?.();
|
|
8310
8405
|
},
|
|
8311
8406
|
children: [
|
|
8312
|
-
/* @__PURE__ */ jsx36(PopoverTrigger5, { asChild: true, children: /* @__PURE__ */ jsx36(
|
|
8407
|
+
/* @__PURE__ */ jsx36(PopoverTrigger5, { asChild: true, children: /* @__PURE__ */ jsx36(Button16, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
|
|
8313
8408
|
/* @__PURE__ */ jsx36(PopoverContent5, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
|
|
8314
8409
|
]
|
|
8315
8410
|
}
|
|
@@ -8473,7 +8568,7 @@ function OpenChoicePicker({
|
|
|
8473
8568
|
// never_add on a column that takes only its choices: said, never a silent nothing.
|
|
8474
8569
|
/* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
8475
8570
|
/* @__PURE__ */ jsx36("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field, [q]) }),
|
|
8476
|
-
autoOpen ? /* @__PURE__ */ jsx36("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx36(
|
|
8571
|
+
autoOpen ? /* @__PURE__ */ jsx36("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx36(Button16, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
|
|
8477
8572
|
] })
|
|
8478
8573
|
) : null,
|
|
8479
8574
|
children: anchored ? cellChips : null
|
|
@@ -8790,7 +8885,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
8790
8885
|
onRemove: () => setAdding(false)
|
|
8791
8886
|
}
|
|
8792
8887
|
),
|
|
8793
|
-
!disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx38(
|
|
8888
|
+
!disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx38(Button17, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
|
|
8794
8889
|
] });
|
|
8795
8890
|
}
|
|
8796
8891
|
function ColumnValueRow({
|
|
@@ -8822,7 +8917,7 @@ function ColumnValueRow({
|
|
|
8822
8917
|
ariaLabel: "Column"
|
|
8823
8918
|
}
|
|
8824
8919
|
) }),
|
|
8825
|
-
!disabled && /* @__PURE__ */ jsx38(
|
|
8920
|
+
!disabled && /* @__PURE__ */ jsx38(Button17, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
|
|
8826
8921
|
] }),
|
|
8827
8922
|
field ? /* @__PURE__ */ jsx38(FieldControl, { field, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx38("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
|
|
8828
8923
|
] });
|
|
@@ -8859,7 +8954,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
8859
8954
|
import { useEffect as useEffect22, useMemo as useMemo13 } from "react";
|
|
8860
8955
|
import { isEntityReferenceConfig } from "@ai-matrx/records";
|
|
8861
8956
|
import { useFields as useFields4, useTable as useTable3 } from "@ai-matrx/records/react";
|
|
8862
|
-
import { BasicInput as BasicInput12, Button as
|
|
8957
|
+
import { BasicInput as BasicInput12, Button as Button18, CreatablePicker as CreatablePicker2, cn as cn24 } from "@ai-matrx/design-system";
|
|
8863
8958
|
import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
8864
8959
|
var DATA_BINDING_SHAPES = [
|
|
8865
8960
|
{ value: "collection", label: "The whole table" },
|
|
@@ -8995,7 +9090,7 @@ function BindingDetails({
|
|
|
8995
9090
|
const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
|
|
8996
9091
|
return /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-2", children: [
|
|
8997
9092
|
/* @__PURE__ */ jsx39("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx39(
|
|
8998
|
-
|
|
9093
|
+
Button18,
|
|
8999
9094
|
{
|
|
9000
9095
|
type: "button",
|
|
9001
9096
|
size: "sm",
|
|
@@ -9045,7 +9140,7 @@ function BindingDetails({
|
|
|
9045
9140
|
}
|
|
9046
9141
|
),
|
|
9047
9142
|
!disabled && /* @__PURE__ */ jsx39("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx39(
|
|
9048
|
-
|
|
9143
|
+
Button18,
|
|
9049
9144
|
{
|
|
9050
9145
|
type: "button",
|
|
9051
9146
|
size: "sm",
|
|
@@ -9079,7 +9174,7 @@ function BindingDetails({
|
|
|
9079
9174
|
/* @__PURE__ */ jsxs36("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
|
|
9080
9175
|
/* @__PURE__ */ jsx39("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
|
|
9081
9176
|
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx39(
|
|
9082
|
-
|
|
9177
|
+
Button18,
|
|
9083
9178
|
{
|
|
9084
9179
|
type: "button",
|
|
9085
9180
|
size: "sm",
|
|
@@ -9176,7 +9271,7 @@ function RecordNameWords({ tableId, recordId }) {
|
|
|
9176
9271
|
// src/HeldChangeDecision.tsx
|
|
9177
9272
|
import { useEffect as useEffect23, useState as useState30 } from "react";
|
|
9178
9273
|
import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient10 } from "@ai-matrx/records/react";
|
|
9179
|
-
import { Button as
|
|
9274
|
+
import { Button as Button19 } from "@ai-matrx/design-system";
|
|
9180
9275
|
import { jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9181
9276
|
function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided }) {
|
|
9182
9277
|
return /* @__PURE__ */ jsx41(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx41(Decision, { approvalId, onDecided }) });
|
|
@@ -9211,8 +9306,8 @@ function Decision({ approvalId, onDecided }) {
|
|
|
9211
9306
|
if (may === null) return /* @__PURE__ */ jsx41("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
|
|
9212
9307
|
return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-1.5", children: [
|
|
9213
9308
|
may ? /* @__PURE__ */ jsxs38("div", { className: "flex gap-2", children: [
|
|
9214
|
-
/* @__PURE__ */ jsx41(
|
|
9215
|
-
/* @__PURE__ */ jsx41(
|
|
9309
|
+
/* @__PURE__ */ jsx41(Button19, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : "Approve" }),
|
|
9310
|
+
/* @__PURE__ */ jsx41(Button19, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
|
|
9216
9311
|
] }) : !error && /* @__PURE__ */ jsx41("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
|
|
9217
9312
|
error ? /* @__PURE__ */ jsx41(RefusalLine, { error }) : null
|
|
9218
9313
|
] });
|