@ai-matrx/records-ui 0.116.83 → 0.116.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -2
- package/dist/{chunk-5DELD6DC.js → chunk-PDIM4BLZ.js} +983 -903
- package/dist/chunk-PDIM4BLZ.js.map +1 -0
- package/dist/index.cjs +8686 -8586
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -11
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +930 -849
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-5DELD6DC.js.map +0 -1
|
@@ -1699,21 +1699,21 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
|
|
|
1699
1699
|
}
|
|
1700
1700
|
|
|
1701
1701
|
// src/ChoiceListEditor.tsx
|
|
1702
|
-
import { useEffect as useEffect27, useRef as useRef20, useState as
|
|
1702
|
+
import { useEffect as useEffect27, useRef as useRef20, useState as useState39 } from "react";
|
|
1703
1703
|
import { optionLabel as optionLabel4, recordsUseSentence, rehomeSentence } from "@ai-matrx/records";
|
|
1704
|
-
import { useRecordsClient as
|
|
1704
|
+
import { useRecordsClient as useRecordsClient15 } from "@ai-matrx/records/react";
|
|
1705
1705
|
import {
|
|
1706
1706
|
BasicInput as BasicInput11,
|
|
1707
1707
|
Button as Button22,
|
|
1708
|
-
Label as
|
|
1708
|
+
Label as Label13,
|
|
1709
1709
|
Popover as Popover7,
|
|
1710
1710
|
PopoverContent as PopoverContent7,
|
|
1711
1711
|
PopoverTrigger as PopoverTrigger7,
|
|
1712
|
-
Select as
|
|
1713
|
-
SelectContent as
|
|
1714
|
-
SelectItem as
|
|
1715
|
-
SelectTrigger as
|
|
1716
|
-
SelectValue as
|
|
1712
|
+
Select as Select8,
|
|
1713
|
+
SelectContent as SelectContent8,
|
|
1714
|
+
SelectItem as SelectItem8,
|
|
1715
|
+
SelectTrigger as SelectTrigger8,
|
|
1716
|
+
SelectValue as SelectValue8,
|
|
1717
1717
|
cn as cn24
|
|
1718
1718
|
} from "@ai-matrx/design-system";
|
|
1719
1719
|
import { STYLE_COLORS as STYLE_COLORS3, STYLE_COLOR_LABELS as STYLE_COLOR_LABELS3, SWATCH_CLASS as SWATCH_CLASS3 } from "@ai-matrx/design-system/data-table";
|
|
@@ -1757,7 +1757,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
|
|
|
1757
1757
|
}
|
|
1758
1758
|
|
|
1759
1759
|
// src/editors.tsx
|
|
1760
|
-
import { useCallback as useCallback8, useEffect as useEffect26, useLayoutEffect as useLayoutEffect3, useRef as useRef19, useState as
|
|
1760
|
+
import { useCallback as useCallback8, useEffect as useEffect26, useLayoutEffect as useLayoutEffect3, useRef as useRef19, useState as useState38 } from "react";
|
|
1761
1761
|
import { isButtonField as isButtonField2, allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf2, decideTypedChoice, isTheChosen, optionKey as optionKey6, rankTypedMatches as rankTypedMatches4, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
|
|
1762
1762
|
import { useOptionalRecordsClient as useOptionalRecordsClient12 } from "@ai-matrx/records/react";
|
|
1763
1763
|
import {
|
|
@@ -1766,15 +1766,15 @@ import {
|
|
|
1766
1766
|
Badge as Badge7,
|
|
1767
1767
|
Button as Button21,
|
|
1768
1768
|
Checkbox as Checkbox7,
|
|
1769
|
-
Label as
|
|
1769
|
+
Label as Label12,
|
|
1770
1770
|
Popover as Popover6,
|
|
1771
1771
|
PopoverContent as PopoverContent6,
|
|
1772
1772
|
PopoverTrigger as PopoverTrigger6,
|
|
1773
|
-
Select as
|
|
1774
|
-
SelectContent as
|
|
1775
|
-
SelectItem as
|
|
1776
|
-
SelectTrigger as
|
|
1777
|
-
SelectValue as
|
|
1773
|
+
Select as Select7,
|
|
1774
|
+
SelectContent as SelectContent7,
|
|
1775
|
+
SelectItem as SelectItem7,
|
|
1776
|
+
SelectTrigger as SelectTrigger7,
|
|
1777
|
+
SelectValue as SelectValue7,
|
|
1778
1778
|
cn as cn23
|
|
1779
1779
|
} from "@ai-matrx/design-system";
|
|
1780
1780
|
|
|
@@ -2506,7 +2506,7 @@ function readableLink(raw) {
|
|
|
2506
2506
|
}
|
|
2507
2507
|
|
|
2508
2508
|
// src/buttonCell.tsx
|
|
2509
|
-
import { useContext as useContext4, useEffect as useEffect24, useRef as useRef16, useState as
|
|
2509
|
+
import { useContext as useContext4, useEffect as useEffect24, useRef as useRef16, useState as useState34 } from "react";
|
|
2510
2510
|
import { Button as Button20, Dialog as Dialog5, ErrorBox as ErrorBox2, DialogContent as DialogContent5, DialogDescription as DialogDescription3, DialogHeader as DialogHeader5, DialogTitle as DialogTitle5, Popover as Popover4, PopoverContent as PopoverContent4, PopoverTrigger as PopoverTrigger4, cn as cn21 } from "@ai-matrx/design-system";
|
|
2511
2511
|
import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, isStyleColor } from "@ai-matrx/design-system/data-table";
|
|
2512
2512
|
import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
|
|
@@ -2647,7 +2647,7 @@ function columnNameProblemLine(name, noun = "column") {
|
|
|
2647
2647
|
}
|
|
2648
2648
|
|
|
2649
2649
|
// src/FieldEditor.tsx
|
|
2650
|
-
import { useEffect as useEffect23, useMemo as useMemo15, useRef as useRef15, useState as
|
|
2650
|
+
import { useEffect as useEffect23, useMemo as useMemo15, useRef as useRef15, useState as useState33 } from "react";
|
|
2651
2651
|
import {
|
|
2652
2652
|
tableShapeChanged as tableShapeChanged3,
|
|
2653
2653
|
useEntityFieldMutation as useEntityFieldMutation2,
|
|
@@ -2656,7 +2656,7 @@ import {
|
|
|
2656
2656
|
useFieldMutation,
|
|
2657
2657
|
useFields as useFields5,
|
|
2658
2658
|
useRecords as useRecords2,
|
|
2659
|
-
useRecordsClient as
|
|
2659
|
+
useRecordsClient as useRecordsClient14,
|
|
2660
2660
|
useReverseColumns,
|
|
2661
2661
|
useTable as useTable3
|
|
2662
2662
|
} from "@ai-matrx/records/react";
|
|
@@ -2665,14 +2665,14 @@ import {
|
|
|
2665
2665
|
BasicInput as BasicInput8,
|
|
2666
2666
|
Button as Button19,
|
|
2667
2667
|
Checkbox as Checkbox6,
|
|
2668
|
-
Label as
|
|
2669
|
-
Select as
|
|
2670
|
-
SelectContent as
|
|
2668
|
+
Label as Label11,
|
|
2669
|
+
Select as Select6,
|
|
2670
|
+
SelectContent as SelectContent6,
|
|
2671
2671
|
SelectGroup,
|
|
2672
|
-
SelectItem as
|
|
2672
|
+
SelectItem as SelectItem6,
|
|
2673
2673
|
SelectLabel,
|
|
2674
|
-
SelectTrigger as
|
|
2675
|
-
SelectValue as
|
|
2674
|
+
SelectTrigger as SelectTrigger6,
|
|
2675
|
+
SelectValue as SelectValue6,
|
|
2676
2676
|
Separator as Separator3,
|
|
2677
2677
|
cn as cn20
|
|
2678
2678
|
} from "@ai-matrx/design-system";
|
|
@@ -6771,6 +6771,73 @@ function choiceLookForNewList(multi, rows) {
|
|
|
6771
6771
|
return choices.length === 0 ? null : { id: multi ? "multi_choice" : "choice", options: { choices } };
|
|
6772
6772
|
}
|
|
6773
6773
|
|
|
6774
|
+
// src/PickListLink.tsx
|
|
6775
|
+
import { useState as useState25 } from "react";
|
|
6776
|
+
import { useRecordsClient as useRecordsClient8 } from "@ai-matrx/records/react";
|
|
6777
|
+
import { Label as Label5, Select as Select4, SelectContent as SelectContent4, SelectItem as SelectItem4, SelectTrigger as SelectTrigger4, SelectValue as SelectValue4 } from "@ai-matrx/design-system";
|
|
6778
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
6779
|
+
var OWN_LIST = "__own__";
|
|
6780
|
+
function PickListLink({
|
|
6781
|
+
field: field2,
|
|
6782
|
+
value,
|
|
6783
|
+
onChange
|
|
6784
|
+
}) {
|
|
6785
|
+
const client = useRecordsClient8();
|
|
6786
|
+
const [lists, setLists] = useState25(null);
|
|
6787
|
+
const [refused, setRefused] = useState25(null);
|
|
6788
|
+
const [asked2, setAsked] = useState25(false);
|
|
6789
|
+
const current = field2.options_table_id ?? field2.config?.["options_table_id"] ?? null;
|
|
6790
|
+
const read = () => {
|
|
6791
|
+
if (asked2) return;
|
|
6792
|
+
setAsked(true);
|
|
6793
|
+
void client.pickListIndex({ organization_id: field2.organization_id ?? client.config.organizationId }).then(
|
|
6794
|
+
(got) => {
|
|
6795
|
+
if (!got.ok) {
|
|
6796
|
+
setRefused(refusalSentence(got.error));
|
|
6797
|
+
setAsked(false);
|
|
6798
|
+
return;
|
|
6799
|
+
}
|
|
6800
|
+
setLists(
|
|
6801
|
+
(got.data?.lists ?? []).map((l) => ({
|
|
6802
|
+
id: l.id,
|
|
6803
|
+
name: (l.list_name ?? "").trim() || "Untitled list",
|
|
6804
|
+
count: typeof l.item_count === "number" ? l.item_count : null
|
|
6805
|
+
}))
|
|
6806
|
+
);
|
|
6807
|
+
},
|
|
6808
|
+
(error) => {
|
|
6809
|
+
setRefused(refusalSentence({ message: error instanceof Error ? error.message : "The pick lists could not be read." }));
|
|
6810
|
+
setAsked(false);
|
|
6811
|
+
}
|
|
6812
|
+
);
|
|
6813
|
+
};
|
|
6814
|
+
const linked = lists?.some((l) => l.id === current) ?? null;
|
|
6815
|
+
const shown2 = value ?? (linked === false ? OWN_LIST : current ?? void 0);
|
|
6816
|
+
return /* @__PURE__ */ jsxs27("div", { className: "flex flex-col gap-1", "data-records-pick-list-link": "", children: [
|
|
6817
|
+
/* @__PURE__ */ jsx32(Label5, { className: "text-xs", children: "Choices come from" }),
|
|
6818
|
+
/* @__PURE__ */ jsxs27(
|
|
6819
|
+
Select4,
|
|
6820
|
+
{
|
|
6821
|
+
...shown2 !== void 0 ? { value: shown2 } : {},
|
|
6822
|
+
onValueChange: (next) => onChange(next === current || next === OWN_LIST && linked === false ? null : next),
|
|
6823
|
+
onOpenChange: (open) => {
|
|
6824
|
+
if (open) read();
|
|
6825
|
+
},
|
|
6826
|
+
children: [
|
|
6827
|
+
/* @__PURE__ */ jsx32(SelectTrigger4, { size: "sm", "aria-label": "Pick list for this column", children: /* @__PURE__ */ jsx32(SelectValue4, { placeholder: "This column only" }) }),
|
|
6828
|
+
/* @__PURE__ */ jsxs27(SelectContent4, { children: [
|
|
6829
|
+
/* @__PURE__ */ jsx32(SelectItem4, { value: OWN_LIST, children: "This column only" }),
|
|
6830
|
+
current && lists === null ? /* @__PURE__ */ jsx32(SelectItem4, { value: current, children: "Its current choices" }) : null,
|
|
6831
|
+
(lists ?? []).map((l) => /* @__PURE__ */ jsx32(SelectItem4, { value: l.id, children: l.count === null ? l.name : `${l.name} (${l.count})` }, l.id)),
|
|
6832
|
+
lists !== null && lists.length === 0 ? /* @__PURE__ */ jsx32("div", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: "No pick lists yet." }) : null
|
|
6833
|
+
] })
|
|
6834
|
+
]
|
|
6835
|
+
}
|
|
6836
|
+
),
|
|
6837
|
+
refused ? /* @__PURE__ */ jsx32("p", { className: "text-[11px] text-muted-foreground", role: "alert", children: refused }) : null
|
|
6838
|
+
] });
|
|
6839
|
+
}
|
|
6840
|
+
|
|
6774
6841
|
// src/NewerKindQuestions.tsx
|
|
6775
6842
|
import {
|
|
6776
6843
|
BARCODE_SYMBOLOGIES,
|
|
@@ -6778,8 +6845,8 @@ import {
|
|
|
6778
6845
|
STATUS_GROUP_WORDS as STATUS_GROUP_WORDS2,
|
|
6779
6846
|
statusGroupOf as statusGroupOf2
|
|
6780
6847
|
} from "@ai-matrx/records";
|
|
6781
|
-
import { Label as
|
|
6782
|
-
import { jsx as
|
|
6848
|
+
import { Label as Label6, Select as Select5, SelectContent as SelectContent5, SelectItem as SelectItem5, SelectTrigger as SelectTrigger5, SelectValue as SelectValue5 } from "@ai-matrx/design-system";
|
|
6849
|
+
import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6783
6850
|
var STATUS_STARTING_CHOICES = [
|
|
6784
6851
|
{ words: "Not started", group: "todo" },
|
|
6785
6852
|
{ words: "In progress", group: "in_progress" },
|
|
@@ -6808,13 +6875,13 @@ function StatusGroupsQuestion({
|
|
|
6808
6875
|
onGroup
|
|
6809
6876
|
}) {
|
|
6810
6877
|
if (rows.length === 0) return null;
|
|
6811
|
-
return /* @__PURE__ */
|
|
6812
|
-
/* @__PURE__ */
|
|
6813
|
-
rows.map((r) => /* @__PURE__ */
|
|
6814
|
-
/* @__PURE__ */
|
|
6815
|
-
/* @__PURE__ */
|
|
6816
|
-
/* @__PURE__ */
|
|
6817
|
-
/* @__PURE__ */
|
|
6878
|
+
return /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-1", "data-records-status-groups": "", children: [
|
|
6879
|
+
/* @__PURE__ */ jsx33(Label6, { className: "text-xs", children: "Groups" }),
|
|
6880
|
+
rows.map((r) => /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2", children: [
|
|
6881
|
+
/* @__PURE__ */ jsx33("span", { className: "min-w-0 flex-1 truncate text-sm", children: r.words }),
|
|
6882
|
+
/* @__PURE__ */ jsxs28(Select5, { value: r.group, onValueChange: (next) => onGroup(r.ref, next), children: [
|
|
6883
|
+
/* @__PURE__ */ jsx33(SelectTrigger5, { size: "sm", className: "w-36", "aria-label": `Group for ${r.words}`, children: /* @__PURE__ */ jsx33(SelectValue5, {}) }),
|
|
6884
|
+
/* @__PURE__ */ jsx33(SelectContent5, { children: STATUS_GROUPS.map((g) => /* @__PURE__ */ jsxs28(SelectItem5, { value: g, children: [
|
|
6818
6885
|
STATUS_GROUP_MARK[g],
|
|
6819
6886
|
" ",
|
|
6820
6887
|
STATUS_GROUP_WORDS2[g]
|
|
@@ -6824,11 +6891,11 @@ function StatusGroupsQuestion({
|
|
|
6824
6891
|
] });
|
|
6825
6892
|
}
|
|
6826
6893
|
function RatingMaxQuestion({ value, onChange }) {
|
|
6827
|
-
return /* @__PURE__ */
|
|
6828
|
-
/* @__PURE__ */
|
|
6829
|
-
/* @__PURE__ */
|
|
6830
|
-
/* @__PURE__ */
|
|
6831
|
-
/* @__PURE__ */
|
|
6894
|
+
return /* @__PURE__ */ jsxs28("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
6895
|
+
/* @__PURE__ */ jsx33(Label6, { className: "text-xs", children: "Out of" }),
|
|
6896
|
+
/* @__PURE__ */ jsxs28(Select5, { value: String(value), onValueChange: (next) => onChange(Number(next)), children: [
|
|
6897
|
+
/* @__PURE__ */ jsx33(SelectTrigger5, { size: "sm", "aria-label": "Out of", children: /* @__PURE__ */ jsx33(SelectValue5, {}) }),
|
|
6898
|
+
/* @__PURE__ */ jsx33(SelectContent5, { children: Array.from({ length: 10 }, (_, i) => i + 1).map((n) => /* @__PURE__ */ jsxs28(SelectItem5, { value: String(n), children: [
|
|
6832
6899
|
n,
|
|
6833
6900
|
" ",
|
|
6834
6901
|
n === 1 ? "star" : "stars"
|
|
@@ -6849,26 +6916,26 @@ var SYMBOLOGY_WORDS = {
|
|
|
6849
6916
|
pdf417: "PDF417"
|
|
6850
6917
|
};
|
|
6851
6918
|
function BarcodeSymbologyQuestion({ value, onChange }) {
|
|
6852
|
-
return /* @__PURE__ */
|
|
6853
|
-
/* @__PURE__ */
|
|
6854
|
-
/* @__PURE__ */
|
|
6855
|
-
/* @__PURE__ */
|
|
6856
|
-
/* @__PURE__ */
|
|
6857
|
-
/* @__PURE__ */
|
|
6858
|
-
BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */
|
|
6919
|
+
return /* @__PURE__ */ jsxs28("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
6920
|
+
/* @__PURE__ */ jsx33(Label6, { className: "text-xs", children: "Code type" }),
|
|
6921
|
+
/* @__PURE__ */ jsxs28(Select5, { value: value === "" ? "any" : value, onValueChange: (next) => onChange(next === "any" ? "" : next), children: [
|
|
6922
|
+
/* @__PURE__ */ jsx33(SelectTrigger5, { size: "sm", "aria-label": "Code type", children: /* @__PURE__ */ jsx33(SelectValue5, {}) }),
|
|
6923
|
+
/* @__PURE__ */ jsxs28(SelectContent5, { children: [
|
|
6924
|
+
/* @__PURE__ */ jsx33(SelectItem5, { value: "any", children: "Any code" }),
|
|
6925
|
+
BARCODE_SYMBOLOGIES.map((s) => /* @__PURE__ */ jsx33(SelectItem5, { value: s, children: SYMBOLOGY_WORDS[s] }, s))
|
|
6859
6926
|
] })
|
|
6860
6927
|
] })
|
|
6861
6928
|
] });
|
|
6862
6929
|
}
|
|
6863
6930
|
|
|
6864
6931
|
// src/FieldFormatPicker.tsx
|
|
6865
|
-
import { Label as
|
|
6932
|
+
import { Label as Label7 } from "@ai-matrx/design-system";
|
|
6866
6933
|
import {
|
|
6867
6934
|
FIELD_FORMAT_LIST,
|
|
6868
6935
|
getFieldFormat as getFieldFormat2,
|
|
6869
6936
|
groupedFormatsForBase
|
|
6870
6937
|
} from "@ai-matrx/design-system/field-formats";
|
|
6871
|
-
import { jsx as
|
|
6938
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6872
6939
|
var KIND_WORD = {
|
|
6873
6940
|
choice: "select",
|
|
6874
6941
|
multi_choice: "multi_select",
|
|
@@ -6991,13 +7058,13 @@ function FieldFormatPicker({
|
|
|
6991
7058
|
else merged[key] = next;
|
|
6992
7059
|
onValue({ ...value, format: Object.keys(merged).length > 0 ? { id: value.format.id, options: merged } : { id: value.format.id } });
|
|
6993
7060
|
};
|
|
6994
|
-
const option = (key, label, control) => optionKeys.includes(key) ? /* @__PURE__ */
|
|
7061
|
+
const option = (key, label, control) => optionKeys.includes(key) ? /* @__PURE__ */ jsxs29("label", { className: "flex min-w-[6rem] flex-col gap-0.5 text-[11px] text-muted-foreground", children: [
|
|
6995
7062
|
label,
|
|
6996
7063
|
control
|
|
6997
7064
|
] }, key) : null;
|
|
6998
|
-
return /* @__PURE__ */
|
|
6999
|
-
/* @__PURE__ */
|
|
7000
|
-
/* @__PURE__ */
|
|
7065
|
+
return /* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-1", "data-records-format-picker": "", children: [
|
|
7066
|
+
/* @__PURE__ */ jsx34(Label7, { className: "text-xs", htmlFor: `records-shows-as-${field2.id}`, children: "Shows as" }),
|
|
7067
|
+
/* @__PURE__ */ jsx34(
|
|
7001
7068
|
PickOne,
|
|
7002
7069
|
{
|
|
7003
7070
|
id: `records-shows-as-${field2.id}`,
|
|
@@ -7023,12 +7090,12 @@ function FieldFormatPicker({
|
|
|
7023
7090
|
]
|
|
7024
7091
|
}
|
|
7025
7092
|
),
|
|
7026
|
-
/* @__PURE__ */
|
|
7027
|
-
optionKeys.length > 0 ? /* @__PURE__ */
|
|
7093
|
+
/* @__PURE__ */ jsx34("p", { className: "text-[11px] text-muted-foreground", children: retypedTo ? `This changes what the column holds, to ${storesWord(retypedTo.def)}. Each value that can convert does; you are told before anything that cannot is lost.` : active ? active.description : "How every value in this column is written, wherever it appears." }),
|
|
7094
|
+
optionKeys.length > 0 ? /* @__PURE__ */ jsxs29("div", { className: "flex flex-wrap items-end gap-2", children: [
|
|
7028
7095
|
option(
|
|
7029
7096
|
"currency",
|
|
7030
7097
|
"Currency",
|
|
7031
|
-
/* @__PURE__ */
|
|
7098
|
+
/* @__PURE__ */ jsx34(
|
|
7032
7099
|
PickOne,
|
|
7033
7100
|
{
|
|
7034
7101
|
label: "Currency",
|
|
@@ -7043,7 +7110,7 @@ function FieldFormatPicker({
|
|
|
7043
7110
|
option(
|
|
7044
7111
|
"percentScale",
|
|
7045
7112
|
"Stored as",
|
|
7046
|
-
/* @__PURE__ */
|
|
7113
|
+
/* @__PURE__ */ jsx34(
|
|
7047
7114
|
PickOne,
|
|
7048
7115
|
{
|
|
7049
7116
|
label: "Stored as",
|
|
@@ -7061,7 +7128,7 @@ function FieldFormatPicker({
|
|
|
7061
7128
|
option(
|
|
7062
7129
|
"durationUnit",
|
|
7063
7130
|
"Unit",
|
|
7064
|
-
/* @__PURE__ */
|
|
7131
|
+
/* @__PURE__ */ jsx34(
|
|
7065
7132
|
PickOne,
|
|
7066
7133
|
{
|
|
7067
7134
|
label: "Unit",
|
|
@@ -7081,7 +7148,7 @@ function FieldFormatPicker({
|
|
|
7081
7148
|
option(
|
|
7082
7149
|
"precision",
|
|
7083
7150
|
"Decimals",
|
|
7084
|
-
/* @__PURE__ */
|
|
7151
|
+
/* @__PURE__ */ jsx34(
|
|
7085
7152
|
"input",
|
|
7086
7153
|
{
|
|
7087
7154
|
"data-records-format-option": "precision",
|
|
@@ -7098,7 +7165,7 @@ function FieldFormatPicker({
|
|
|
7098
7165
|
option(
|
|
7099
7166
|
"ratingMax",
|
|
7100
7167
|
"Out of",
|
|
7101
|
-
/* @__PURE__ */
|
|
7168
|
+
/* @__PURE__ */ jsx34(
|
|
7102
7169
|
"input",
|
|
7103
7170
|
{
|
|
7104
7171
|
"data-records-format-option": "ratingMax",
|
|
@@ -7114,7 +7181,7 @@ function FieldFormatPicker({
|
|
|
7114
7181
|
option(
|
|
7115
7182
|
"dateStyle",
|
|
7116
7183
|
"Style",
|
|
7117
|
-
/* @__PURE__ */
|
|
7184
|
+
/* @__PURE__ */ jsx34(
|
|
7118
7185
|
PickOne,
|
|
7119
7186
|
{
|
|
7120
7187
|
label: "Style",
|
|
@@ -7133,15 +7200,15 @@ function FieldFormatPicker({
|
|
|
7133
7200
|
option(
|
|
7134
7201
|
"prefix",
|
|
7135
7202
|
"Prefix",
|
|
7136
|
-
/* @__PURE__ */
|
|
7203
|
+
/* @__PURE__ */ jsx34("input", { "data-records-format-option": "prefix", className: BOX, value: options.prefix ?? "", onChange: (e) => setOption("prefix", e.target.value) })
|
|
7137
7204
|
),
|
|
7138
7205
|
option(
|
|
7139
7206
|
"suffix",
|
|
7140
7207
|
"Suffix",
|
|
7141
|
-
/* @__PURE__ */
|
|
7208
|
+
/* @__PURE__ */ jsx34("input", { "data-records-format-option": "suffix", className: BOX, placeholder: "e.g. kg", value: options.suffix ?? "", onChange: (e) => setOption("suffix", e.target.value) })
|
|
7142
7209
|
),
|
|
7143
|
-
optionKeys.includes("useGrouping") ? /* @__PURE__ */
|
|
7144
|
-
/* @__PURE__ */
|
|
7210
|
+
optionKeys.includes("useGrouping") ? /* @__PURE__ */ jsxs29("label", { className: "flex items-center gap-1.5 pb-1 text-[11px] text-muted-foreground", children: [
|
|
7211
|
+
/* @__PURE__ */ jsx34(
|
|
7145
7212
|
"input",
|
|
7146
7213
|
{
|
|
7147
7214
|
type: "checkbox",
|
|
@@ -7157,8 +7224,8 @@ function FieldFormatPicker({
|
|
|
7157
7224
|
}
|
|
7158
7225
|
|
|
7159
7226
|
// src/AlsoPointsAt.tsx
|
|
7160
|
-
import { Checkbox as Checkbox4, Label as
|
|
7161
|
-
import { jsx as
|
|
7227
|
+
import { Checkbox as Checkbox4, Label as Label8 } from "@ai-matrx/design-system";
|
|
7228
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7162
7229
|
function AlsoPointsAt({ own: own3, value, onChange }) {
|
|
7163
7230
|
const tables = usePickerTables();
|
|
7164
7231
|
const entries = tablePickerEntries(
|
|
@@ -7167,11 +7234,11 @@ function AlsoPointsAt({ own: own3, value, onChange }) {
|
|
|
7167
7234
|
).entries.filter((e) => e.id !== own3);
|
|
7168
7235
|
const unseen = tables.loading ? [] : value.filter((id) => !entries.some((e) => e.id === id));
|
|
7169
7236
|
const toggle = (id, on) => onChange(on ? [...value.filter((v) => v !== id), id] : value.filter((v) => v !== id));
|
|
7170
|
-
return /* @__PURE__ */
|
|
7171
|
-
/* @__PURE__ */
|
|
7172
|
-
tables.loading && entries.length === 0 ? /* @__PURE__ */
|
|
7173
|
-
entries.map((e) => /* @__PURE__ */
|
|
7174
|
-
/* @__PURE__ */
|
|
7237
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-1", "data-records-link-also-points-at": "", children: [
|
|
7238
|
+
/* @__PURE__ */ jsx35(Label8, { className: "text-xs", children: "Also points at" }),
|
|
7239
|
+
tables.loading && entries.length === 0 ? /* @__PURE__ */ jsx35("p", { className: "text-xs text-muted-foreground", children: "Reading tables\u2026" }) : entries.length === 0 && unseen.length === 0 ? /* @__PURE__ */ jsx35("p", { className: "text-xs text-muted-foreground", children: "No other tables yet." }) : /* @__PURE__ */ jsxs30("div", { className: "flex max-h-40 flex-col gap-1 overflow-y-auto", children: [
|
|
7240
|
+
entries.map((e) => /* @__PURE__ */ jsxs30("label", { className: "flex items-center gap-1.5 text-sm", children: [
|
|
7241
|
+
/* @__PURE__ */ jsx35(
|
|
7175
7242
|
Checkbox4,
|
|
7176
7243
|
{
|
|
7177
7244
|
checked: value.includes(e.id),
|
|
@@ -7180,11 +7247,11 @@ function AlsoPointsAt({ own: own3, value, onChange }) {
|
|
|
7180
7247
|
onCheckedChange: (v) => toggle(e.id, v === true)
|
|
7181
7248
|
}
|
|
7182
7249
|
),
|
|
7183
|
-
/* @__PURE__ */
|
|
7250
|
+
/* @__PURE__ */ jsx35("span", { className: "truncate", children: e.label })
|
|
7184
7251
|
] }, e.id)),
|
|
7185
|
-
unseen.map((id) => /* @__PURE__ */
|
|
7186
|
-
/* @__PURE__ */
|
|
7187
|
-
/* @__PURE__ */
|
|
7252
|
+
unseen.map((id) => /* @__PURE__ */ jsxs30("label", { className: "flex items-center gap-1.5 text-sm", children: [
|
|
7253
|
+
/* @__PURE__ */ jsx35(Checkbox4, { checked: true, "aria-label": "Also points at a table you cannot open", "data-records-also-target": id, onCheckedChange: (v) => toggle(id, v === true) }),
|
|
7254
|
+
/* @__PURE__ */ jsx35("span", { className: "truncate text-muted-foreground", children: "A table you cannot open" })
|
|
7188
7255
|
] }, id))
|
|
7189
7256
|
] })
|
|
7190
7257
|
] });
|
|
@@ -8206,8 +8273,8 @@ function nextFieldSort(fields) {
|
|
|
8206
8273
|
import { autonumberPrefixOf as autonumberPrefixOf3, buttonNeeds, buttonOf } from "@ai-matrx/records";
|
|
8207
8274
|
|
|
8208
8275
|
// src/ButtonSettings.tsx
|
|
8209
|
-
import { useEffect as useEffect18, useState as
|
|
8210
|
-
import { BasicInput as BasicInput7, Button as Button14, Label as
|
|
8276
|
+
import { useEffect as useEffect18, useState as useState27 } from "react";
|
|
8277
|
+
import { BasicInput as BasicInput7, Button as Button14, Label as Label10 } from "@ai-matrx/design-system";
|
|
8211
8278
|
import { STYLE_COLORS } from "@ai-matrx/design-system/data-table";
|
|
8212
8279
|
import { buttonUrlPlaceholders } from "@ai-matrx/records";
|
|
8213
8280
|
import { useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matrx/records/react";
|
|
@@ -8216,10 +8283,10 @@ import { useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matr
|
|
|
8216
8283
|
import { PORTAL_ACCENTS } from "@ai-matrx/records";
|
|
8217
8284
|
import { cn as cn16 } from "@ai-matrx/design-system";
|
|
8218
8285
|
import { STYLE_COLOR_LABELS, SWATCH_CLASS as SWATCH_CLASS2 } from "@ai-matrx/design-system/data-table";
|
|
8219
|
-
import { jsx as
|
|
8286
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8220
8287
|
function AccentSwatches({ value, onChange, options = PORTAL_ACCENTS, noneLabel = "App color" }) {
|
|
8221
|
-
return /* @__PURE__ */
|
|
8222
|
-
/* @__PURE__ */
|
|
8288
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Color", children: [
|
|
8289
|
+
/* @__PURE__ */ jsx36(
|
|
8223
8290
|
"button",
|
|
8224
8291
|
{
|
|
8225
8292
|
type: "button",
|
|
@@ -8233,7 +8300,7 @@ function AccentSwatches({ value, onChange, options = PORTAL_ACCENTS, noneLabel =
|
|
|
8233
8300
|
children: noneLabel
|
|
8234
8301
|
}
|
|
8235
8302
|
),
|
|
8236
|
-
options.map((c) => /* @__PURE__ */
|
|
8303
|
+
options.map((c) => /* @__PURE__ */ jsx36(
|
|
8237
8304
|
"button",
|
|
8238
8305
|
{
|
|
8239
8306
|
type: "button",
|
|
@@ -8250,10 +8317,10 @@ function AccentSwatches({ value, onChange, options = PORTAL_ACCENTS, noneLabel =
|
|
|
8250
8317
|
}
|
|
8251
8318
|
|
|
8252
8319
|
// src/AddRowSettings.tsx
|
|
8253
|
-
import { Label as
|
|
8320
|
+
import { Label as Label9 } from "@ai-matrx/design-system";
|
|
8254
8321
|
import { useFields as useFields3, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
|
|
8255
|
-
import { useEffect as useEffect17, useState as
|
|
8256
|
-
import { jsx as
|
|
8322
|
+
import { useEffect as useEffect17, useState as useState26 } from "react";
|
|
8323
|
+
import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8257
8324
|
var THIS_ROW = "@row";
|
|
8258
8325
|
var NOTHING = "";
|
|
8259
8326
|
function prefillWith(prefill, key, from) {
|
|
@@ -8269,7 +8336,7 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
8269
8336
|
const typed = (targetFields.data ?? []).filter((f) => f.type !== "formula" && typeof f.config?.["system"] !== "string");
|
|
8270
8337
|
const sources = [{ value: NOTHING, label: "Nothing" }, { value: THIS_ROW, label: "This row" }, ...fields.map((f) => ({ value: f.key, label: f.label }))];
|
|
8271
8338
|
const client = useOptionalRecordsClient9();
|
|
8272
|
-
const [templates, setTemplates] =
|
|
8339
|
+
const [templates, setTemplates] = useState26([]);
|
|
8273
8340
|
useEffect17(() => {
|
|
8274
8341
|
if (!client || !target) return;
|
|
8275
8342
|
let live = true;
|
|
@@ -8278,10 +8345,10 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
8278
8345
|
live = false;
|
|
8279
8346
|
};
|
|
8280
8347
|
}, [client, target]);
|
|
8281
|
-
return /* @__PURE__ */
|
|
8282
|
-
/* @__PURE__ */
|
|
8283
|
-
/* @__PURE__ */
|
|
8284
|
-
/* @__PURE__ */
|
|
8348
|
+
return /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-2", "data-records-button-add-row": "", children: [
|
|
8349
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-1", children: [
|
|
8350
|
+
/* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Adds to" }),
|
|
8351
|
+
/* @__PURE__ */ jsx37(
|
|
8285
8352
|
PickOne,
|
|
8286
8353
|
{
|
|
8287
8354
|
label: "Table the new row goes in",
|
|
@@ -8292,9 +8359,9 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
8292
8359
|
}
|
|
8293
8360
|
)
|
|
8294
8361
|
] }),
|
|
8295
|
-
templates.length || value.template_id ? /* @__PURE__ */
|
|
8296
|
-
/* @__PURE__ */
|
|
8297
|
-
/* @__PURE__ */
|
|
8362
|
+
templates.length || value.template_id ? /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-1", children: [
|
|
8363
|
+
/* @__PURE__ */ jsx37(Label9, { className: "text-xs", children: "Starts from" }),
|
|
8364
|
+
/* @__PURE__ */ jsx37(
|
|
8298
8365
|
PickOne,
|
|
8299
8366
|
{
|
|
8300
8367
|
label: "Row template the new row starts from",
|
|
@@ -8305,9 +8372,9 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
8305
8372
|
}
|
|
8306
8373
|
)
|
|
8307
8374
|
] }) : null,
|
|
8308
|
-
typed.length ? /* @__PURE__ */
|
|
8309
|
-
/* @__PURE__ */
|
|
8310
|
-
/* @__PURE__ */
|
|
8375
|
+
typed.length ? /* @__PURE__ */ jsx37("div", { className: "grid grid-cols-[auto_1fr] items-center gap-x-2 gap-y-1", children: typed.map((f) => /* @__PURE__ */ jsxs32("div", { className: "contents", children: [
|
|
8376
|
+
/* @__PURE__ */ jsx37("span", { className: "text-sm", children: f.label }),
|
|
8377
|
+
/* @__PURE__ */ jsx37(
|
|
8311
8378
|
PickOne,
|
|
8312
8379
|
{
|
|
8313
8380
|
label: `${f.label} starts with`,
|
|
@@ -8322,7 +8389,7 @@ function AddRowSettings({ value, onChange, tableId, fields }) {
|
|
|
8322
8389
|
}
|
|
8323
8390
|
|
|
8324
8391
|
// src/ButtonSettings.tsx
|
|
8325
|
-
import { jsx as
|
|
8392
|
+
import { jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8326
8393
|
var DOES_WORDS = {
|
|
8327
8394
|
none: "Nothing yet",
|
|
8328
8395
|
open_url: "Open a link",
|
|
@@ -8345,9 +8412,9 @@ function ButtonSettingsEditor({
|
|
|
8345
8412
|
fields
|
|
8346
8413
|
}) {
|
|
8347
8414
|
const client = useOptionalRecordsClient10();
|
|
8348
|
-
const [actions, setActions] =
|
|
8349
|
-
const [actionsRefused, setActionsRefused] =
|
|
8350
|
-
const [automations, setAutomations] =
|
|
8415
|
+
const [actions, setActions] = useState27(null);
|
|
8416
|
+
const [actionsRefused, setActionsRefused] = useState27(null);
|
|
8417
|
+
const [automations, setAutomations] = useState27(null);
|
|
8351
8418
|
useEffect18(() => {
|
|
8352
8419
|
if (!client || !tableId) return;
|
|
8353
8420
|
let live = true;
|
|
@@ -8369,15 +8436,15 @@ function ButtonSettingsEditor({
|
|
|
8369
8436
|
}, [client, tableId, value.do, actions, automations]);
|
|
8370
8437
|
const set = (patch) => onChange({ ...value, ...patch });
|
|
8371
8438
|
const columns = fields.filter((f) => !(f.type === "text" && f.format === "button"));
|
|
8372
|
-
return /* @__PURE__ */
|
|
8373
|
-
/* @__PURE__ */
|
|
8374
|
-
/* @__PURE__ */
|
|
8375
|
-
/* @__PURE__ */
|
|
8376
|
-
/* @__PURE__ */
|
|
8439
|
+
return /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-2 rounded-md border p-2", "data-records-button-settings": "", children: [
|
|
8440
|
+
/* @__PURE__ */ jsxs33("div", { className: "grid gap-2 sm:grid-cols-2", children: [
|
|
8441
|
+
/* @__PURE__ */ jsxs33("label", { className: "flex flex-col gap-1", children: [
|
|
8442
|
+
/* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Button label" }),
|
|
8443
|
+
/* @__PURE__ */ jsx38(BasicInput7, { className: "h-8 text-xs", value: value.label, "data-records-button-label": "", onChange: (e) => set({ label: e.target.value }) })
|
|
8377
8444
|
] }),
|
|
8378
|
-
/* @__PURE__ */
|
|
8379
|
-
/* @__PURE__ */
|
|
8380
|
-
/* @__PURE__ */
|
|
8445
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
|
|
8446
|
+
/* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Does" }),
|
|
8447
|
+
/* @__PURE__ */ jsx38(
|
|
8381
8448
|
PickOne,
|
|
8382
8449
|
{
|
|
8383
8450
|
label: "What a press does",
|
|
@@ -8389,9 +8456,9 @@ function ButtonSettingsEditor({
|
|
|
8389
8456
|
)
|
|
8390
8457
|
] })
|
|
8391
8458
|
] }),
|
|
8392
|
-
/* @__PURE__ */
|
|
8393
|
-
/* @__PURE__ */
|
|
8394
|
-
/* @__PURE__ */
|
|
8459
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
|
|
8460
|
+
/* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Color" }),
|
|
8461
|
+
/* @__PURE__ */ jsx38(
|
|
8395
8462
|
AccentSwatches,
|
|
8396
8463
|
{
|
|
8397
8464
|
value: value.color ?? "",
|
|
@@ -8401,10 +8468,10 @@ function ButtonSettingsEditor({
|
|
|
8401
8468
|
}
|
|
8402
8469
|
)
|
|
8403
8470
|
] }),
|
|
8404
|
-
value.do === "open_url" ? /* @__PURE__ */
|
|
8405
|
-
/* @__PURE__ */
|
|
8406
|
-
/* @__PURE__ */
|
|
8407
|
-
/* @__PURE__ */
|
|
8471
|
+
value.do === "open_url" ? /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
|
|
8472
|
+
/* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "Link" }),
|
|
8473
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex gap-1", children: [
|
|
8474
|
+
/* @__PURE__ */ jsx38(
|
|
8408
8475
|
BasicInput7,
|
|
8409
8476
|
{
|
|
8410
8477
|
className: "h-8 flex-1 font-mono text-xs",
|
|
@@ -8414,7 +8481,7 @@ function ButtonSettingsEditor({
|
|
|
8414
8481
|
onChange: (e) => set({ url: e.target.value })
|
|
8415
8482
|
}
|
|
8416
8483
|
),
|
|
8417
|
-
columns.length > 0 ? /* @__PURE__ */
|
|
8484
|
+
columns.length > 0 ? /* @__PURE__ */ jsx38(
|
|
8418
8485
|
PickOne,
|
|
8419
8486
|
{
|
|
8420
8487
|
label: "Add a column's value",
|
|
@@ -8427,11 +8494,11 @@ function ButtonSettingsEditor({
|
|
|
8427
8494
|
}
|
|
8428
8495
|
) : null
|
|
8429
8496
|
] }),
|
|
8430
|
-
value.url && buttonUrlPlaceholders(value.url).length > 0 ? /* @__PURE__ */
|
|
8497
|
+
value.url && buttonUrlPlaceholders(value.url).length > 0 ? /* @__PURE__ */ jsx38("p", { className: "truncate text-[11px] text-muted-foreground", "data-records-button-url-words": "", children: buttonUrlInWords(value.url, fields) }) : null
|
|
8431
8498
|
] }) : null,
|
|
8432
|
-
value.do === "add_row" ? /* @__PURE__ */
|
|
8433
|
-
value.do === "run_action" ? !tableId ? /* @__PURE__ */
|
|
8434
|
-
actions === null || actions.length > 0 ? /* @__PURE__ */
|
|
8499
|
+
value.do === "add_row" ? /* @__PURE__ */ jsx38(AddRowSettings, { value, onChange, tableId, fields }) : null,
|
|
8500
|
+
value.do === "run_action" ? !tableId ? /* @__PURE__ */ jsx38("p", { className: "text-xs text-muted-foreground", children: "Row actions belong to a table" }) : actionsRefused ? /* @__PURE__ */ jsx38(RefusalLine, { error: actionsRefused }) : /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-2", "data-records-button-action": "", children: [
|
|
8501
|
+
actions === null || actions.length > 0 ? /* @__PURE__ */ jsx38(
|
|
8435
8502
|
PickOne,
|
|
8436
8503
|
{
|
|
8437
8504
|
label: "Row action",
|
|
@@ -8442,7 +8509,7 @@ function ButtonSettingsEditor({
|
|
|
8442
8509
|
options: (actions ?? []).map((a) => ({ value: a.id, label: a.name }))
|
|
8443
8510
|
}
|
|
8444
8511
|
) : null,
|
|
8445
|
-
actions !== null ? /* @__PURE__ */
|
|
8512
|
+
actions !== null ? /* @__PURE__ */ jsx38(
|
|
8446
8513
|
NewRowAction,
|
|
8447
8514
|
{
|
|
8448
8515
|
tableId,
|
|
@@ -8456,7 +8523,7 @@ function ButtonSettingsEditor({
|
|
|
8456
8523
|
}
|
|
8457
8524
|
) : null
|
|
8458
8525
|
] }) : null,
|
|
8459
|
-
value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */
|
|
8526
|
+
value.do === "run_automation" ? automations && automations.length === 0 ? /* @__PURE__ */ jsx38("p", { className: "text-xs text-muted-foreground", children: "No automations yet. Add one in Table \u22EF \u2192 Automations." }) : /* @__PURE__ */ jsx38(
|
|
8460
8527
|
PickOne,
|
|
8461
8528
|
{
|
|
8462
8529
|
label: "Automation",
|
|
@@ -8483,11 +8550,11 @@ function NewRowAction({
|
|
|
8483
8550
|
}) {
|
|
8484
8551
|
const client = useOptionalRecordsClient10();
|
|
8485
8552
|
const settable = settableColumns(columns);
|
|
8486
|
-
const [fieldId, setFieldId] =
|
|
8487
|
-
const [setTo, setSetTo] =
|
|
8488
|
-
const [busy, setBusy] =
|
|
8489
|
-
const [refused, setRefused] =
|
|
8490
|
-
if (settable.length === 0) return /* @__PURE__ */
|
|
8553
|
+
const [fieldId, setFieldId] = useState27("");
|
|
8554
|
+
const [setTo, setSetTo] = useState27("");
|
|
8555
|
+
const [busy, setBusy] = useState27(false);
|
|
8556
|
+
const [refused, setRefused] = useState27(null);
|
|
8557
|
+
if (settable.length === 0) return /* @__PURE__ */ jsx38("p", { className: "text-xs text-muted-foreground", children: "No column to set" });
|
|
8491
8558
|
const make = async () => {
|
|
8492
8559
|
if (!client || fieldId === "") return;
|
|
8493
8560
|
setBusy(true);
|
|
@@ -8511,10 +8578,10 @@ function NewRowAction({
|
|
|
8511
8578
|
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." });
|
|
8512
8579
|
onMade(made.id, all);
|
|
8513
8580
|
};
|
|
8514
|
-
return /* @__PURE__ */
|
|
8515
|
-
/* @__PURE__ */
|
|
8516
|
-
/* @__PURE__ */
|
|
8517
|
-
/* @__PURE__ */
|
|
8581
|
+
return /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", "data-records-button-new-action": "", children: [
|
|
8582
|
+
/* @__PURE__ */ jsx38(Label10, { className: "text-xs", children: "New row action" }),
|
|
8583
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
8584
|
+
/* @__PURE__ */ jsx38(
|
|
8518
8585
|
PickOne,
|
|
8519
8586
|
{
|
|
8520
8587
|
label: "Column to set",
|
|
@@ -8526,10 +8593,10 @@ function NewRowAction({
|
|
|
8526
8593
|
options: settable.map((f) => ({ value: f.id, label: fieldName(f) }))
|
|
8527
8594
|
}
|
|
8528
8595
|
),
|
|
8529
|
-
/* @__PURE__ */
|
|
8530
|
-
/* @__PURE__ */
|
|
8596
|
+
/* @__PURE__ */ jsx38(BasicInput7, { 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) }),
|
|
8597
|
+
/* @__PURE__ */ jsx38(Button14, { type: "button", size: "sm", variant: "outline", disabled: busy || fieldId === "", "data-records-button-action-make": "", onClick: () => void make(), children: busy ? "Making\u2026" : "Make" })
|
|
8531
8598
|
] }),
|
|
8532
|
-
refused ? /* @__PURE__ */
|
|
8599
|
+
refused ? /* @__PURE__ */ jsx38(RefusalLine, { error: refused }) : null
|
|
8533
8600
|
] });
|
|
8534
8601
|
}
|
|
8535
8602
|
|
|
@@ -8537,18 +8604,18 @@ function NewRowAction({
|
|
|
8537
8604
|
import { EVERY_RECORD_TYPE, FIELD_SENSITIVITIES, CONTEXT_POLICIES, optionKey as optionKey5, ratingMaxOf, rulesWithTopStar, typesOfField as typesOfField2 } from "@ai-matrx/records";
|
|
8538
8605
|
|
|
8539
8606
|
// src/RecordTypes.tsx
|
|
8540
|
-
import { createContext as createContext4, useContext as useContext3, useEffect as useEffect22, useMemo as useMemo14, useState as
|
|
8607
|
+
import { createContext as createContext4, useContext as useContext3, useEffect as useEffect22, useMemo as useMemo14, useState as useState32 } from "react";
|
|
8541
8608
|
import { fieldAppliesToType, optionKey as optionKey4, optionLabel as optionLabel3, recordTypeOf as recordTypeOf2, typesOfField } from "@ai-matrx/records";
|
|
8542
|
-
import { useRecordsClient as
|
|
8609
|
+
import { useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react";
|
|
8543
8610
|
import { Button as Button18, Checkbox as Checkbox5, Dialog as Dialog4, DialogContent as DialogContent4, DialogDescription as DialogDescription2, DialogHeader as DialogHeader4, DialogTitle as DialogTitle4 } from "@ai-matrx/design-system";
|
|
8544
8611
|
|
|
8545
8612
|
// src/RecordForm.tsx
|
|
8546
|
-
import { useEffect as useEffect21, useMemo as useMemo13, useRef as useRef14, useState as
|
|
8613
|
+
import { useEffect as useEffect21, useMemo as useMemo13, useRef as useRef14, useState as useState31 } from "react";
|
|
8547
8614
|
import {
|
|
8548
8615
|
useFields as useFields4,
|
|
8549
8616
|
useRecord,
|
|
8550
8617
|
useRecordMutation,
|
|
8551
|
-
useRecordsClient as
|
|
8618
|
+
useRecordsClient as useRecordsClient12,
|
|
8552
8619
|
useTable as useTable2
|
|
8553
8620
|
} from "@ai-matrx/records/react";
|
|
8554
8621
|
import { recordTypeOf } from "@ai-matrx/records";
|
|
@@ -8557,24 +8624,24 @@ import { Button as Button17, Separator as Separator2, cn as cn19 } from "@ai-mat
|
|
|
8557
8624
|
import { humanizeIdentifier as humanizeIdentifier2 } from "@ai-matrx/kit/text-case";
|
|
8558
8625
|
|
|
8559
8626
|
// src/StandardRecordForm.tsx
|
|
8560
|
-
import { useState as
|
|
8561
|
-
import { useEntityRecord as useEntityRecord2, useRecordsClient as
|
|
8627
|
+
import { useState as useState30 } from "react";
|
|
8628
|
+
import { useEntityRecord as useEntityRecord2, useRecordsClient as useRecordsClient11 } from "@ai-matrx/records/react";
|
|
8562
8629
|
import { Input, Textarea, cn as cn18 } from "@ai-matrx/design-system";
|
|
8563
8630
|
|
|
8564
8631
|
// src/CustomFieldsSection.tsx
|
|
8565
|
-
import { useEffect as useEffect20, useMemo as useMemo12, useRef as useRef13, useState as
|
|
8632
|
+
import { useEffect as useEffect20, useMemo as useMemo12, useRef as useRef13, useState as useState29 } from "react";
|
|
8566
8633
|
import {
|
|
8567
8634
|
useEntityFieldMutation,
|
|
8568
8635
|
useEntityFieldRights,
|
|
8569
8636
|
useEntityRecord,
|
|
8570
|
-
useRecordsClient as
|
|
8637
|
+
useRecordsClient as useRecordsClient10
|
|
8571
8638
|
} from "@ai-matrx/records/react";
|
|
8572
8639
|
import { Button as Button16, Separator, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, cn as cn17 } from "@ai-matrx/design-system";
|
|
8573
8640
|
|
|
8574
8641
|
// src/gridColors.tsx
|
|
8575
|
-
import { useCallback as useCallback7, useEffect as useEffect19, useMemo as useMemo11, useState as
|
|
8642
|
+
import { useCallback as useCallback7, useEffect as useEffect19, useMemo as useMemo11, useState as useState28 } from "react";
|
|
8576
8643
|
import { optionKey as optionKey3, optionLabel as optionLabel2 } from "@ai-matrx/records";
|
|
8577
|
-
import { useRecordsClient as
|
|
8644
|
+
import { useRecordsClient as useRecordsClient9 } from "@ai-matrx/records/react";
|
|
8578
8645
|
import {
|
|
8579
8646
|
Button as Button15,
|
|
8580
8647
|
Dialog as Dialog3,
|
|
@@ -8592,7 +8659,7 @@ import {
|
|
|
8592
8659
|
STYLE_COLORS as STYLE_COLORS2,
|
|
8593
8660
|
STYLE_COLOR_LABELS as STYLE_COLOR_LABELS2
|
|
8594
8661
|
} from "@ai-matrx/design-system/data-table";
|
|
8595
|
-
import { jsx as
|
|
8662
|
+
import { jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8596
8663
|
function isChoiceField(field2) {
|
|
8597
8664
|
const kind = String(editorKindFor(field2));
|
|
8598
8665
|
return kind === "select" || kind === "multi_select";
|
|
@@ -8620,8 +8687,8 @@ function choiceKeysIn(style, fields) {
|
|
|
8620
8687
|
return fields.filter((f) => wanted.has(f.key) && isChoiceField(f)).map((f) => f.key);
|
|
8621
8688
|
}
|
|
8622
8689
|
function useChoiceOptions(fields, keys) {
|
|
8623
|
-
const client =
|
|
8624
|
-
const [index, setIndex] =
|
|
8690
|
+
const client = useRecordsClient9();
|
|
8691
|
+
const [index, setIndex] = useState28(() => /* @__PURE__ */ new Map());
|
|
8625
8692
|
const wantedKey = keys.join("\0");
|
|
8626
8693
|
const reads = useReadRefusal("field_options");
|
|
8627
8694
|
const [attempt, again] = useReadAgain();
|
|
@@ -8762,8 +8829,8 @@ function swatches(prefix, current, write) {
|
|
|
8762
8829
|
}
|
|
8763
8830
|
function useGridColors(args) {
|
|
8764
8831
|
const { enabled, tableId, fields, decorations, mayColor, whyNot, notify, view } = args;
|
|
8765
|
-
const client =
|
|
8766
|
-
const [rulesOpen, setRulesOpen] =
|
|
8832
|
+
const client = useRecordsClient9();
|
|
8833
|
+
const [rulesOpen, setRulesOpen] = useState28(null);
|
|
8767
8834
|
const dialogOptions = useChoiceOptions(fields, rulesOpen !== null ? fields.filter(isChoiceField).map((f) => f.key) : []);
|
|
8768
8835
|
const write = useCallback7(
|
|
8769
8836
|
async (path, value, said2) => {
|
|
@@ -8900,7 +8967,7 @@ function useGridColors(args) {
|
|
|
8900
8967
|
},
|
|
8901
8968
|
[enabled, decorations.data, refusal, write]
|
|
8902
8969
|
);
|
|
8903
|
-
const dialogs = enabled ? /* @__PURE__ */
|
|
8970
|
+
const dialogs = enabled ? /* @__PURE__ */ jsx39(
|
|
8904
8971
|
ColorRulesDialog,
|
|
8905
8972
|
{
|
|
8906
8973
|
open: rulesOpen !== null,
|
|
@@ -8927,12 +8994,12 @@ function useGridColors(args) {
|
|
|
8927
8994
|
) : null;
|
|
8928
8995
|
const colorable = fields.filter(colorableBy);
|
|
8929
8996
|
const byId = decorations.data?.color_by?.field ?? null;
|
|
8930
|
-
const sheet = enabled ? /* @__PURE__ */
|
|
8931
|
-
/* @__PURE__ */
|
|
8932
|
-
mayColor ? /* @__PURE__ */
|
|
8933
|
-
/* @__PURE__ */
|
|
8934
|
-
/* @__PURE__ */
|
|
8935
|
-
/* @__PURE__ */
|
|
8997
|
+
const sheet = enabled ? /* @__PURE__ */ jsxs34("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-colors": "", children: [
|
|
8998
|
+
/* @__PURE__ */ jsx39("span", { className: "text-xs font-medium text-muted-foreground", children: "Colors" }),
|
|
8999
|
+
mayColor ? /* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-2", children: [
|
|
9000
|
+
/* @__PURE__ */ jsxs34("label", { className: "flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground", children: [
|
|
9001
|
+
/* @__PURE__ */ jsx39("span", { className: "shrink-0", children: "Color rows by" }),
|
|
9002
|
+
/* @__PURE__ */ jsx39(
|
|
8936
9003
|
PickOne,
|
|
8937
9004
|
{
|
|
8938
9005
|
label: "Color rows by",
|
|
@@ -8946,8 +9013,8 @@ function useGridColors(args) {
|
|
|
8946
9013
|
}
|
|
8947
9014
|
)
|
|
8948
9015
|
] }),
|
|
8949
|
-
/* @__PURE__ */
|
|
8950
|
-
] }) : /* @__PURE__ */
|
|
9016
|
+
/* @__PURE__ */ jsx39(Button15, { type: "button", size: "sm", variant: "outline", className: "h-10 shrink-0", onClick: () => setRulesOpen(colorable[0]?.key ?? fields[0]?.key ?? ""), children: "Color rules\u2026" })
|
|
9017
|
+
] }) : /* @__PURE__ */ jsx39("p", { className: "text-xs text-muted-foreground", children: whyNot })
|
|
8951
9018
|
] }) : null;
|
|
8952
9019
|
return { headerItem, cellItem, cellsItem, rowItem, dialogs, sheet };
|
|
8953
9020
|
}
|
|
@@ -8965,9 +9032,9 @@ function ColorRulesDialog({
|
|
|
8965
9032
|
onSave,
|
|
8966
9033
|
viewRules
|
|
8967
9034
|
}) {
|
|
8968
|
-
const [drafts, setDrafts] =
|
|
8969
|
-
const [busy, setBusy] =
|
|
8970
|
-
const [scope, setScope] =
|
|
9035
|
+
const [drafts, setDrafts] = useState28(null);
|
|
9036
|
+
const [busy, setBusy] = useState28(false);
|
|
9037
|
+
const [scope, setScope] = useState28("table");
|
|
8971
9038
|
const keptTable = useMemo11(() => draftsFrom(decorations, fields), [decorations, fields]);
|
|
8972
9039
|
const held = scope === "view" && viewRules ? viewRules.drafts : keptTable;
|
|
8973
9040
|
const opsFor = (key) => {
|
|
@@ -8995,15 +9062,15 @@ function ColorRulesDialog({
|
|
|
8995
9062
|
onClose();
|
|
8996
9063
|
};
|
|
8997
9064
|
const first = startField ?? fields[0]?.key ?? "";
|
|
8998
|
-
return /* @__PURE__ */
|
|
8999
|
-
/* @__PURE__ */
|
|
9000
|
-
/* @__PURE__ */
|
|
9001
|
-
/* @__PURE__ */
|
|
9065
|
+
return /* @__PURE__ */ jsx39(Dialog3, { open, onOpenChange: (next) => !next ? close() : void 0, children: /* @__PURE__ */ jsxs34(DialogContent3, { className: "sm:max-w-2xl", "data-records-color-rules": "", children: [
|
|
9066
|
+
/* @__PURE__ */ jsxs34(DialogHeader3, { children: [
|
|
9067
|
+
/* @__PURE__ */ jsx39(DialogTitle3, { children: "Color rules" }),
|
|
9068
|
+
/* @__PURE__ */ jsx39(DialogDescription, { children: scope === "view" ? "The first rule a row matches wins. These rules belong to this view alone, and a date can be tested against today." : "The first rule a row matches wins. A rule tints the whole row, or only the cell it reads. Everyone who opens this table sees them." })
|
|
9002
9069
|
] }),
|
|
9003
|
-
/* @__PURE__ */
|
|
9004
|
-
viewRules ? /* @__PURE__ */
|
|
9005
|
-
/* @__PURE__ */
|
|
9006
|
-
/* @__PURE__ */
|
|
9070
|
+
/* @__PURE__ */ jsxs34("div", { className: "flex flex-col gap-2", children: [
|
|
9071
|
+
viewRules ? /* @__PURE__ */ jsxs34("div", { className: "flex items-center gap-1.5 text-xs", "data-records-color-rules-scope": "", children: [
|
|
9072
|
+
/* @__PURE__ */ jsx39("span", { className: "text-muted-foreground", children: "Keep them on" }),
|
|
9073
|
+
/* @__PURE__ */ jsx39(
|
|
9007
9074
|
PickOne,
|
|
9008
9075
|
{
|
|
9009
9076
|
label: "Where the rules are kept",
|
|
@@ -9020,10 +9087,10 @@ function ColorRulesDialog({
|
|
|
9020
9087
|
}
|
|
9021
9088
|
)
|
|
9022
9089
|
] }) : null,
|
|
9023
|
-
rows.length === 0 ? /* @__PURE__ */
|
|
9024
|
-
rows.map((rule, i) => /* @__PURE__ */
|
|
9025
|
-
/* @__PURE__ */
|
|
9026
|
-
/* @__PURE__ */
|
|
9090
|
+
rows.length === 0 ? /* @__PURE__ */ jsx39("p", { className: "text-xs text-muted-foreground", children: "No rules yet." }) : null,
|
|
9091
|
+
rows.map((rule, i) => /* @__PURE__ */ jsxs34("div", { className: "flex flex-wrap items-center gap-1.5 text-xs", "data-records-color-rule": "", children: [
|
|
9092
|
+
/* @__PURE__ */ jsx39("span", { className: "text-muted-foreground", children: i === 0 ? "When" : "Else when" }),
|
|
9093
|
+
/* @__PURE__ */ jsx39(
|
|
9027
9094
|
PickOne,
|
|
9028
9095
|
{
|
|
9029
9096
|
label: "Column",
|
|
@@ -9033,7 +9100,7 @@ function ColorRulesDialog({
|
|
|
9033
9100
|
options: fields.map((f) => ({ value: f.key, label: fieldName(f) }))
|
|
9034
9101
|
}
|
|
9035
9102
|
),
|
|
9036
|
-
/* @__PURE__ */
|
|
9103
|
+
/* @__PURE__ */ jsx39(
|
|
9037
9104
|
PickOne,
|
|
9038
9105
|
{
|
|
9039
9106
|
label: "Test",
|
|
@@ -9047,7 +9114,7 @@ function ColorRulesDialog({
|
|
|
9047
9114
|
}))
|
|
9048
9115
|
}
|
|
9049
9116
|
),
|
|
9050
|
-
OPS_WITH_VALUE.includes(rule.op) && choicesOf(rule.field) ? /* @__PURE__ */
|
|
9117
|
+
OPS_WITH_VALUE.includes(rule.op) && choicesOf(rule.field) ? /* @__PURE__ */ jsx39(
|
|
9051
9118
|
PickOne,
|
|
9052
9119
|
{
|
|
9053
9120
|
label: "Choice",
|
|
@@ -9058,7 +9125,7 @@ function ColorRulesDialog({
|
|
|
9058
9125
|
onChange: (picked) => set(i, { value: picked }),
|
|
9059
9126
|
options: choicesOf(rule.field).map((option) => ({ value: option.id, label: option.label }))
|
|
9060
9127
|
}
|
|
9061
|
-
) : OPS_WITH_VALUE.includes(rule.op) ? /* @__PURE__ */
|
|
9128
|
+
) : OPS_WITH_VALUE.includes(rule.op) ? /* @__PURE__ */ jsx39(
|
|
9062
9129
|
"input",
|
|
9063
9130
|
{
|
|
9064
9131
|
"aria-label": "Value",
|
|
@@ -9068,8 +9135,8 @@ function ColorRulesDialog({
|
|
|
9068
9135
|
onChange: (e) => set(i, { value: e.target.value })
|
|
9069
9136
|
}
|
|
9070
9137
|
) : null,
|
|
9071
|
-
/* @__PURE__ */
|
|
9072
|
-
/* @__PURE__ */
|
|
9138
|
+
/* @__PURE__ */ jsx39("span", { className: "text-muted-foreground", children: "tint" }),
|
|
9139
|
+
/* @__PURE__ */ jsx39(
|
|
9073
9140
|
PickOne,
|
|
9074
9141
|
{
|
|
9075
9142
|
label: "Tint",
|
|
@@ -9082,7 +9149,7 @@ function ColorRulesDialog({
|
|
|
9082
9149
|
]
|
|
9083
9150
|
}
|
|
9084
9151
|
),
|
|
9085
|
-
/* @__PURE__ */
|
|
9152
|
+
/* @__PURE__ */ jsx39(
|
|
9086
9153
|
PickOne,
|
|
9087
9154
|
{
|
|
9088
9155
|
label: "Color",
|
|
@@ -9093,9 +9160,9 @@ function ColorRulesDialog({
|
|
|
9093
9160
|
options: STYLE_COLORS2.map((c) => ({ value: c, label: STYLE_COLOR_LABELS2[c] }))
|
|
9094
9161
|
}
|
|
9095
9162
|
),
|
|
9096
|
-
/* @__PURE__ */
|
|
9163
|
+
/* @__PURE__ */ jsx39(Button15, { type: "button", size: "sm", variant: "ghost", onClick: () => setDrafts(rows.filter((_, j) => j !== i)), children: "Remove" })
|
|
9097
9164
|
] }, rule.id ?? `new-${i}`)),
|
|
9098
|
-
/* @__PURE__ */
|
|
9165
|
+
/* @__PURE__ */ jsx39("div", { children: /* @__PURE__ */ jsx39(
|
|
9099
9166
|
Button15,
|
|
9100
9167
|
{
|
|
9101
9168
|
type: "button",
|
|
@@ -9107,9 +9174,9 @@ function ColorRulesDialog({
|
|
|
9107
9174
|
}
|
|
9108
9175
|
) })
|
|
9109
9176
|
] }),
|
|
9110
|
-
/* @__PURE__ */
|
|
9111
|
-
/* @__PURE__ */
|
|
9112
|
-
/* @__PURE__ */
|
|
9177
|
+
/* @__PURE__ */ jsxs34(DialogFooter, { children: [
|
|
9178
|
+
/* @__PURE__ */ jsx39(Button15, { type: "button", size: "sm", variant: "ghost", onClick: close, children: "Cancel" }),
|
|
9179
|
+
/* @__PURE__ */ jsx39(
|
|
9113
9180
|
Button15,
|
|
9114
9181
|
{
|
|
9115
9182
|
type: "button",
|
|
@@ -9149,7 +9216,7 @@ var ADDABLE_TYPES = STANDARD_TABLE_FIELD_CHOICES.map((choice) => ({
|
|
|
9149
9216
|
}));
|
|
9150
9217
|
|
|
9151
9218
|
// src/CustomFieldsSection.tsx
|
|
9152
|
-
import { jsx as
|
|
9219
|
+
import { jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9153
9220
|
function isEmptyValue(value) {
|
|
9154
9221
|
return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
|
|
9155
9222
|
}
|
|
@@ -9255,19 +9322,19 @@ function CustomFieldsSection({
|
|
|
9255
9322
|
onMakeOwnTable,
|
|
9256
9323
|
entityLabel
|
|
9257
9324
|
}) {
|
|
9258
|
-
const client =
|
|
9325
|
+
const client = useRecordsClient10();
|
|
9259
9326
|
const read = useEntityRecord(entityToken, recordId);
|
|
9260
9327
|
const rights = useEntityFieldRights(entityToken);
|
|
9261
9328
|
const mutation = useEntityFieldMutation();
|
|
9262
|
-
const [editing, setEditing] =
|
|
9263
|
-
const [adding, setAdding] =
|
|
9264
|
-
const [savingValues, setSavingValues] =
|
|
9265
|
-
const [writeError, setWriteError] =
|
|
9266
|
-
const [draft, setDraft] =
|
|
9267
|
-
const [cellKey, setCellKey] =
|
|
9268
|
-
const [cellValue, setCellValue] =
|
|
9269
|
-
const [cellSaving, setCellSaving] =
|
|
9270
|
-
const [removing, setRemoving] =
|
|
9329
|
+
const [editing, setEditing] = useState29(false);
|
|
9330
|
+
const [adding, setAdding] = useState29(false);
|
|
9331
|
+
const [savingValues, setSavingValues] = useState29(false);
|
|
9332
|
+
const [writeError, setWriteError] = useState29(null);
|
|
9333
|
+
const [draft, setDraft] = useState29({});
|
|
9334
|
+
const [cellKey, setCellKey] = useState29(null);
|
|
9335
|
+
const [cellValue, setCellValue] = useState29(void 0);
|
|
9336
|
+
const [cellSaving, setCellSaving] = useState29(false);
|
|
9337
|
+
const [removing, setRemoving] = useState29(null);
|
|
9271
9338
|
const fields = useMemo12(() => read.data?.fields ?? [], [read.data]);
|
|
9272
9339
|
const saveCell = async (key) => {
|
|
9273
9340
|
if (cellSaving) return;
|
|
@@ -9383,16 +9450,16 @@ function CustomFieldsSection({
|
|
|
9383
9450
|
const refusedSentence = reason ?? "Only an owner or an admin can add a field here.";
|
|
9384
9451
|
const addRefused = (className2) => refused ? (
|
|
9385
9452
|
// Its own provider: the section mounts in hosts with and without an app-root one.
|
|
9386
|
-
/* @__PURE__ */
|
|
9387
|
-
/* @__PURE__ */
|
|
9388
|
-
/* @__PURE__ */
|
|
9389
|
-
/* @__PURE__ */
|
|
9453
|
+
/* @__PURE__ */ jsx40(TooltipProvider, { titleTooltips: false, children: /* @__PURE__ */ jsxs35(Tooltip, { children: [
|
|
9454
|
+
/* @__PURE__ */ jsx40(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs35("span", { tabIndex: 0, className: cn17("inline-flex", className2), "data-records-custom-fields-cannot-add": "", children: [
|
|
9455
|
+
/* @__PURE__ */ jsx40(Button16, { size: "sm", variant: "ghost", disabled: true, children: "Add field" }),
|
|
9456
|
+
/* @__PURE__ */ jsx40("span", { className: "sr-only", children: refusedSentence })
|
|
9390
9457
|
] }) }),
|
|
9391
|
-
/* @__PURE__ */
|
|
9458
|
+
/* @__PURE__ */ jsx40(TooltipContent, { className: "max-w-xs", children: refusedSentence })
|
|
9392
9459
|
] }) })
|
|
9393
9460
|
) : null;
|
|
9394
|
-
const cannotAdd = refused && onMakeOwnTable ? /* @__PURE__ */
|
|
9395
|
-
const editor = adding ? /* @__PURE__ */
|
|
9461
|
+
const cannotAdd = refused && onMakeOwnTable ? /* @__PURE__ */ jsx40("div", { className: "flex min-w-0 items-center justify-end", children: /* @__PURE__ */ jsx40(Button16, { size: "sm", variant: "ghost", onClick: onMakeOwnTable, children: "Make your own table" }) }) : null;
|
|
9462
|
+
const editor = adding ? /* @__PURE__ */ jsx40(
|
|
9396
9463
|
FieldEditor,
|
|
9397
9464
|
{
|
|
9398
9465
|
entityToken,
|
|
@@ -9404,24 +9471,24 @@ function CustomFieldsSection({
|
|
|
9404
9471
|
onCancel: () => setAdding(false)
|
|
9405
9472
|
}
|
|
9406
9473
|
) : null;
|
|
9407
|
-
if (read.error) return /* @__PURE__ */
|
|
9474
|
+
if (read.error) return /* @__PURE__ */ jsx40(RefusalLine, { error: read.error, className });
|
|
9408
9475
|
const values = read.data?.custom ?? {};
|
|
9409
9476
|
const empty = fields.length === 0;
|
|
9410
9477
|
if (empty && !adding) {
|
|
9411
|
-
return /* @__PURE__ */
|
|
9412
|
-
/* @__PURE__ */
|
|
9413
|
-
/* @__PURE__ */
|
|
9414
|
-
!read.loading ? /* @__PURE__ */
|
|
9415
|
-
mayAdd ? /* @__PURE__ */
|
|
9478
|
+
return /* @__PURE__ */ jsxs35("section", { className: cn17("flex min-w-0 flex-col gap-1 text-xs", className), children: [
|
|
9479
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
9480
|
+
/* @__PURE__ */ jsx40("h3", { className: "text-sm font-medium", children: title }),
|
|
9481
|
+
!read.loading ? /* @__PURE__ */ jsx40("span", { className: "text-muted-foreground", children: "None yet" }) : null,
|
|
9482
|
+
mayAdd ? /* @__PURE__ */ jsx40(Button16, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => setAdding(true), children: "Add field" }) : addRefused("ml-auto")
|
|
9416
9483
|
] }),
|
|
9417
9484
|
cannotAdd
|
|
9418
9485
|
] });
|
|
9419
9486
|
}
|
|
9420
|
-
return /* @__PURE__ */
|
|
9421
|
-
/* @__PURE__ */
|
|
9422
|
-
/* @__PURE__ */
|
|
9423
|
-
!empty ? /* @__PURE__ */
|
|
9424
|
-
fields.length > 0 ? /* @__PURE__ */
|
|
9487
|
+
return /* @__PURE__ */ jsxs35("section", { className: cn17("flex min-w-0 flex-col gap-2 text-xs", className), children: [
|
|
9488
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-2", children: [
|
|
9489
|
+
/* @__PURE__ */ jsx40("h3", { className: "text-sm font-medium", children: title }),
|
|
9490
|
+
!empty ? /* @__PURE__ */ jsx40("span", { className: "text-muted-foreground", children: fields.length }) : null,
|
|
9491
|
+
fields.length > 0 ? /* @__PURE__ */ jsx40(
|
|
9425
9492
|
Button16,
|
|
9426
9493
|
{
|
|
9427
9494
|
size: "sm",
|
|
@@ -9435,7 +9502,7 @@ function CustomFieldsSection({
|
|
|
9435
9502
|
children: editing ? "Cancel" : "Edit"
|
|
9436
9503
|
}
|
|
9437
9504
|
) : null,
|
|
9438
|
-
mayAdd && !editing && !adding ? /* @__PURE__ */
|
|
9505
|
+
mayAdd && !editing && !adding ? /* @__PURE__ */ jsx40(
|
|
9439
9506
|
Button16,
|
|
9440
9507
|
{
|
|
9441
9508
|
size: "sm",
|
|
@@ -9445,7 +9512,7 @@ function CustomFieldsSection({
|
|
|
9445
9512
|
children: "Add field"
|
|
9446
9513
|
}
|
|
9447
9514
|
) : !mayAdd && !editing ? addRefused(fields.length > 0 ? void 0 : "ml-auto") : null,
|
|
9448
|
-
editing ? /* @__PURE__ */
|
|
9515
|
+
editing ? /* @__PURE__ */ jsx40(
|
|
9449
9516
|
Button16,
|
|
9450
9517
|
{
|
|
9451
9518
|
size: "sm",
|
|
@@ -9467,18 +9534,18 @@ function CustomFieldsSection({
|
|
|
9467
9534
|
}
|
|
9468
9535
|
) : null
|
|
9469
9536
|
] }),
|
|
9470
|
-
/* @__PURE__ */
|
|
9471
|
-
writeError ? /* @__PURE__ */
|
|
9472
|
-
mutation.error ? /* @__PURE__ */
|
|
9537
|
+
/* @__PURE__ */ jsx40(Separator, {}),
|
|
9538
|
+
writeError ? /* @__PURE__ */ jsx40(RefusalLine, { error: writeError }) : null,
|
|
9539
|
+
mutation.error ? /* @__PURE__ */ jsx40(RefusalLine, { error: mutation.error }) : null,
|
|
9473
9540
|
cannotAdd,
|
|
9474
9541
|
editor,
|
|
9475
|
-
editing ? /* @__PURE__ */
|
|
9542
|
+
editing ? /* @__PURE__ */ jsx40("div", { className: "flex flex-col gap-3", children: fields.map((f) => {
|
|
9476
9543
|
const field2 = asField(f);
|
|
9477
9544
|
const id = `cf-${recordId}-${f.key}`;
|
|
9478
|
-
return /* @__PURE__ */
|
|
9479
|
-
/* @__PURE__ */
|
|
9480
|
-
/* @__PURE__ */
|
|
9481
|
-
mayAdd && removing !== f.id ? /* @__PURE__ */
|
|
9545
|
+
return /* @__PURE__ */ jsxs35("div", { className: "flex min-w-0 flex-col gap-1", children: [
|
|
9546
|
+
/* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-2", children: [
|
|
9547
|
+
/* @__PURE__ */ jsx40(FieldLabel, { field: field2, htmlFor: id }),
|
|
9548
|
+
mayAdd && removing !== f.id ? /* @__PURE__ */ jsx40(
|
|
9482
9549
|
Button16,
|
|
9483
9550
|
{
|
|
9484
9551
|
size: "sm",
|
|
@@ -9489,12 +9556,12 @@ function CustomFieldsSection({
|
|
|
9489
9556
|
}
|
|
9490
9557
|
) : null
|
|
9491
9558
|
] }),
|
|
9492
|
-
removing === f.id ? /* @__PURE__ */
|
|
9493
|
-
/* @__PURE__ */
|
|
9559
|
+
removing === f.id ? /* @__PURE__ */ jsxs35("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
9560
|
+
/* @__PURE__ */ jsxs35("span", { className: "text-destructive", children: [
|
|
9494
9561
|
archiveConfirmSentence(`the field \u201C${f.label}\u201D`),
|
|
9495
9562
|
" It is removed for everyone in this organization; its values stay in every record and come back with it."
|
|
9496
9563
|
] }),
|
|
9497
|
-
/* @__PURE__ */
|
|
9564
|
+
/* @__PURE__ */ jsx40(
|
|
9498
9565
|
Button16,
|
|
9499
9566
|
{
|
|
9500
9567
|
size: "sm",
|
|
@@ -9514,9 +9581,9 @@ function CustomFieldsSection({
|
|
|
9514
9581
|
children: "Remove it"
|
|
9515
9582
|
}
|
|
9516
9583
|
),
|
|
9517
|
-
/* @__PURE__ */
|
|
9584
|
+
/* @__PURE__ */ jsx40(Button16, { size: "sm", variant: "ghost", onClick: () => setRemoving(null), children: "Keep it" })
|
|
9518
9585
|
] }) : null,
|
|
9519
|
-
noticeOf(f) ? /* @__PURE__ */
|
|
9586
|
+
noticeOf(f) ? /* @__PURE__ */ jsx40(WithheldValue, { field: field2, notice: noticeOf(f) }) : /* @__PURE__ */ jsx40(
|
|
9520
9587
|
FieldControl,
|
|
9521
9588
|
{
|
|
9522
9589
|
id,
|
|
@@ -9527,9 +9594,9 @@ function CustomFieldsSection({
|
|
|
9527
9594
|
}
|
|
9528
9595
|
)
|
|
9529
9596
|
] }, f.id);
|
|
9530
|
-
}) }) : /* @__PURE__ */
|
|
9531
|
-
/* @__PURE__ */
|
|
9532
|
-
/* @__PURE__ */
|
|
9597
|
+
}) }) : /* @__PURE__ */ jsx40("dl", { className: "grid grid-cols-[minmax(6rem,12rem)_1fr] gap-x-3 gap-y-1.5", children: fields.map((f) => /* @__PURE__ */ jsxs35("div", { className: "contents", children: [
|
|
9598
|
+
/* @__PURE__ */ jsx40("dt", { className: "flex items-baseline gap-1 truncate text-muted-foreground", children: f.label }),
|
|
9599
|
+
/* @__PURE__ */ jsx40("dd", { className: "min-w-0", children: noticeOf(f) ? /* @__PURE__ */ jsx40(WithheldValue, { field: asField(f), notice: noticeOf(f) }) : cellKey === f.key ? /* @__PURE__ */ jsx40(
|
|
9533
9600
|
"div",
|
|
9534
9601
|
{
|
|
9535
9602
|
className: "min-w-0",
|
|
@@ -9550,7 +9617,7 @@ function CustomFieldsSection({
|
|
|
9550
9617
|
if (e.relatedTarget?.closest?.("[data-matrx-cell-editor], [role=listbox], [role=dialog]")) return;
|
|
9551
9618
|
void saveCell(f.key);
|
|
9552
9619
|
},
|
|
9553
|
-
children: /* @__PURE__ */
|
|
9620
|
+
children: /* @__PURE__ */ jsx40(
|
|
9554
9621
|
FieldControl,
|
|
9555
9622
|
{
|
|
9556
9623
|
id: `cf-${recordId}-${f.key}`,
|
|
@@ -9564,7 +9631,7 @@ function CustomFieldsSection({
|
|
|
9564
9631
|
}
|
|
9565
9632
|
)
|
|
9566
9633
|
}
|
|
9567
|
-
) : /* @__PURE__ */
|
|
9634
|
+
) : /* @__PURE__ */ jsx40(
|
|
9568
9635
|
"button",
|
|
9569
9636
|
{
|
|
9570
9637
|
type: "button",
|
|
@@ -9576,7 +9643,7 @@ function CustomFieldsSection({
|
|
|
9576
9643
|
setCellValue(values[f.key]);
|
|
9577
9644
|
setCellKey(f.key);
|
|
9578
9645
|
},
|
|
9579
|
-
children: isEmptyValue(values[f.key]) ? /* @__PURE__ */
|
|
9646
|
+
children: isEmptyValue(values[f.key]) ? /* @__PURE__ */ jsx40("span", { className: "text-muted-foreground", children: "\u2014" }) : /* @__PURE__ */ jsx40(CustomValue, { field: asField(f), value: values[f.key] })
|
|
9580
9647
|
}
|
|
9581
9648
|
) })
|
|
9582
9649
|
] }, f.id)) })
|
|
@@ -9584,7 +9651,7 @@ function CustomFieldsSection({
|
|
|
9584
9651
|
}
|
|
9585
9652
|
|
|
9586
9653
|
// src/StandardRecordForm.tsx
|
|
9587
|
-
import { jsx as
|
|
9654
|
+
import { jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
9588
9655
|
function standardTokenOf(token) {
|
|
9589
9656
|
return token.startsWith("entity:") ? token.slice("entity:".length) : token;
|
|
9590
9657
|
}
|
|
@@ -9593,12 +9660,12 @@ function isEmpty(value) {
|
|
|
9593
9660
|
}
|
|
9594
9661
|
function StandardRecordForm({ token, recordId, columns, onSaved, className, custom, children }) {
|
|
9595
9662
|
const entityToken = standardTokenOf(token);
|
|
9596
|
-
const client =
|
|
9663
|
+
const client = useRecordsClient11();
|
|
9597
9664
|
const read = useEntityRecord2(entityToken, recordId);
|
|
9598
|
-
const [cellKey, setCellKey] =
|
|
9599
|
-
const [cellValue, setCellValue] =
|
|
9600
|
-
const [saving, setSaving] =
|
|
9601
|
-
const [error, setError] =
|
|
9665
|
+
const [cellKey, setCellKey] = useState30(null);
|
|
9666
|
+
const [cellValue, setCellValue] = useState30("");
|
|
9667
|
+
const [saving, setSaving] = useState30(false);
|
|
9668
|
+
const [error, setError] = useState30(null);
|
|
9602
9669
|
const stored = read.data?.columns ?? {};
|
|
9603
9670
|
const open = (key) => {
|
|
9604
9671
|
setError(null);
|
|
@@ -9633,14 +9700,14 @@ function StandardRecordForm({ token, recordId, columns, onSaved, className, cust
|
|
|
9633
9700
|
read.reload();
|
|
9634
9701
|
onSaved?.(recordId);
|
|
9635
9702
|
};
|
|
9636
|
-
if (read.error) return /* @__PURE__ */
|
|
9637
|
-
return /* @__PURE__ */
|
|
9638
|
-
/* @__PURE__ */
|
|
9703
|
+
if (read.error) return /* @__PURE__ */ jsx41(RefusalLine, { error: read.error, className });
|
|
9704
|
+
return /* @__PURE__ */ jsxs36("div", { className: cn18("flex min-w-0 flex-col gap-2 text-xs", className), "data-records-standard-form": entityToken, children: [
|
|
9705
|
+
/* @__PURE__ */ jsx41("dl", { className: "grid grid-cols-[minmax(5rem,7rem)_1fr] gap-x-3 gap-y-1", children: columns.map((column) => {
|
|
9639
9706
|
const id = `std-${recordId}-${column.key}`;
|
|
9640
9707
|
const value = stored[column.key];
|
|
9641
|
-
return /* @__PURE__ */
|
|
9642
|
-
/* @__PURE__ */
|
|
9643
|
-
/* @__PURE__ */
|
|
9708
|
+
return /* @__PURE__ */ jsxs36("div", { className: "contents", children: [
|
|
9709
|
+
/* @__PURE__ */ jsx41("dt", { className: "truncate py-1 text-right text-muted-foreground", children: /* @__PURE__ */ jsx41("label", { htmlFor: id, children: column.label }) }),
|
|
9710
|
+
/* @__PURE__ */ jsx41("dd", { className: "min-w-0", children: cellKey === column.key ? column.multiline ? /* @__PURE__ */ jsx41(
|
|
9644
9711
|
Textarea,
|
|
9645
9712
|
{
|
|
9646
9713
|
id,
|
|
@@ -9658,7 +9725,7 @@ function StandardRecordForm({ token, recordId, columns, onSaved, className, cust
|
|
|
9658
9725
|
if (e.key === "Enter" && (e.metaKey || e.ctrlKey)) void save(column);
|
|
9659
9726
|
}
|
|
9660
9727
|
}
|
|
9661
|
-
) : /* @__PURE__ */
|
|
9728
|
+
) : /* @__PURE__ */ jsx41(
|
|
9662
9729
|
Input,
|
|
9663
9730
|
{
|
|
9664
9731
|
id,
|
|
@@ -9676,7 +9743,7 @@ function StandardRecordForm({ token, recordId, columns, onSaved, className, cust
|
|
|
9676
9743
|
if (e.key === "Enter") void save(column);
|
|
9677
9744
|
}
|
|
9678
9745
|
}
|
|
9679
|
-
) : /* @__PURE__ */
|
|
9746
|
+
) : /* @__PURE__ */ jsx41(
|
|
9680
9747
|
"button",
|
|
9681
9748
|
{
|
|
9682
9749
|
type: "button",
|
|
@@ -9686,23 +9753,23 @@ function StandardRecordForm({ token, recordId, columns, onSaved, className, cust
|
|
|
9686
9753
|
"aria-label": `Edit ${column.label}`,
|
|
9687
9754
|
"data-records-standard-value": column.key,
|
|
9688
9755
|
onClick: () => open(column.key),
|
|
9689
|
-
children: isEmpty(value) ? /* @__PURE__ */
|
|
9756
|
+
children: isEmpty(value) ? /* @__PURE__ */ jsx41("span", { className: "text-muted-foreground", children: "\u2014" }) : String(value)
|
|
9690
9757
|
}
|
|
9691
9758
|
) })
|
|
9692
9759
|
] }, column.key);
|
|
9693
9760
|
}) }),
|
|
9694
|
-
error ? /* @__PURE__ */
|
|
9761
|
+
error ? /* @__PURE__ */ jsx41(RefusalLine, { error }) : null,
|
|
9695
9762
|
children,
|
|
9696
|
-
/* @__PURE__ */
|
|
9763
|
+
/* @__PURE__ */ jsx41(CustomFieldsSection, { entityToken, recordId, ...custom ?? {} })
|
|
9697
9764
|
] });
|
|
9698
9765
|
}
|
|
9699
9766
|
|
|
9700
9767
|
// src/RecordForm.tsx
|
|
9701
|
-
import { jsx as
|
|
9768
|
+
import { jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9702
9769
|
function RecordForm(props) {
|
|
9703
9770
|
if (props.token) {
|
|
9704
9771
|
if (!props.recordId) {
|
|
9705
|
-
return /* @__PURE__ */
|
|
9772
|
+
return /* @__PURE__ */ jsx42(
|
|
9706
9773
|
RefusalNotice,
|
|
9707
9774
|
{
|
|
9708
9775
|
error: { code: "refused_by_rule", message: "A standard record is opened here, never created." },
|
|
@@ -9710,7 +9777,7 @@ function RecordForm(props) {
|
|
|
9710
9777
|
}
|
|
9711
9778
|
);
|
|
9712
9779
|
}
|
|
9713
|
-
return /* @__PURE__ */
|
|
9780
|
+
return /* @__PURE__ */ jsx42(
|
|
9714
9781
|
StandardRecordForm,
|
|
9715
9782
|
{
|
|
9716
9783
|
token: props.token,
|
|
@@ -9723,7 +9790,7 @@ function RecordForm(props) {
|
|
|
9723
9790
|
}
|
|
9724
9791
|
);
|
|
9725
9792
|
}
|
|
9726
|
-
return /* @__PURE__ */
|
|
9793
|
+
return /* @__PURE__ */ jsx42(CustomRecordForm, { ...props, tableId: props.tableId });
|
|
9727
9794
|
}
|
|
9728
9795
|
function CustomRecordForm({
|
|
9729
9796
|
tableId,
|
|
@@ -9736,15 +9803,15 @@ function CustomRecordForm({
|
|
|
9736
9803
|
focusFirstRequired
|
|
9737
9804
|
}) {
|
|
9738
9805
|
const host = useRecordsUi();
|
|
9739
|
-
const [draft, setDraft] =
|
|
9806
|
+
const [draft, setDraft] = useState31(() => recordId ? {} : { ...initial ?? {} });
|
|
9740
9807
|
const table = useTable2(tableId);
|
|
9741
9808
|
const typeInDraft = recordTypeOf(table.data, draft);
|
|
9742
9809
|
const typeNow = typeInDraft ?? recordType;
|
|
9743
9810
|
const fields = useFields4(tableId, typeNow);
|
|
9744
9811
|
const existing = useRecord(recordId ?? null);
|
|
9745
9812
|
const mutation = useRecordMutation();
|
|
9746
|
-
const client =
|
|
9747
|
-
const [edit, setEdit] =
|
|
9813
|
+
const client = useRecordsClient12();
|
|
9814
|
+
const [edit, setEdit] = useState31({
|
|
9748
9815
|
saving: false,
|
|
9749
9816
|
error: null,
|
|
9750
9817
|
conflict: null
|
|
@@ -9758,7 +9825,7 @@ function CustomRecordForm({
|
|
|
9758
9825
|
setEdit((e) => ({ ...e, conflict: null }));
|
|
9759
9826
|
}
|
|
9760
9827
|
};
|
|
9761
|
-
const [touched, setTouched] =
|
|
9828
|
+
const [touched, setTouched] = useState31(false);
|
|
9762
9829
|
const seededStarts = useRef14(false);
|
|
9763
9830
|
useEffect21(() => {
|
|
9764
9831
|
if (recordId || seededStarts.current || !fields.data) return;
|
|
@@ -9779,8 +9846,8 @@ function CustomRecordForm({
|
|
|
9779
9846
|
const t = setTimeout(() => globalThis.document?.getElementById(`field-${first.id}`)?.focus(), 0);
|
|
9780
9847
|
return () => clearTimeout(t);
|
|
9781
9848
|
}, [focusFirstRequired, recordId, fields.data]);
|
|
9782
|
-
const [changed, setChanged] =
|
|
9783
|
-
const [answered, setAnswered] =
|
|
9849
|
+
const [changed, setChanged] = useState31({});
|
|
9850
|
+
const [answered, setAnswered] = useState31(null);
|
|
9784
9851
|
const formRows = useMemo13(
|
|
9785
9852
|
() => existing.data ? [{ id: existing.data.record_id, document: existing.data.document, level: "", hidden: {} }] : [],
|
|
9786
9853
|
[existing.data]
|
|
@@ -9822,8 +9889,8 @@ function CustomRecordForm({
|
|
|
9822
9889
|
() => fields.data ? predictWriteRefusals({ fields: fields.data, document: document2, ...typeNow ? { recordType: typeNow } : {} }) : [],
|
|
9823
9890
|
[fields.data, document2, typeNow]
|
|
9824
9891
|
);
|
|
9825
|
-
if (fields.error) return /* @__PURE__ */
|
|
9826
|
-
if (existing.error) return /* @__PURE__ */
|
|
9892
|
+
if (fields.error) return /* @__PURE__ */ jsx42(RefusalNotice, { error: fields.error, onRetry: fields.reload, className });
|
|
9893
|
+
if (existing.error) return /* @__PURE__ */ jsx42(RefusalNotice, { error: existing.error, className });
|
|
9827
9894
|
const storeSaid = said2.error && said2.error !== answered ? said2.error : null;
|
|
9828
9895
|
const fieldProblems = predicted.filter((p) => p.field_key);
|
|
9829
9896
|
const problemsShown = (key) => touched || changed[key] ? fieldProblems.filter((p) => p.field_key === key) : [];
|
|
@@ -9888,7 +9955,7 @@ function CustomRecordForm({
|
|
|
9888
9955
|
onSaved?.(written);
|
|
9889
9956
|
}
|
|
9890
9957
|
};
|
|
9891
|
-
return /* @__PURE__ */
|
|
9958
|
+
return /* @__PURE__ */ jsxs37(
|
|
9892
9959
|
"form",
|
|
9893
9960
|
{
|
|
9894
9961
|
className: cn19("flex min-w-0 flex-col gap-3", className),
|
|
@@ -9897,7 +9964,7 @@ function CustomRecordForm({
|
|
|
9897
9964
|
void save();
|
|
9898
9965
|
},
|
|
9899
9966
|
children: [
|
|
9900
|
-
/* @__PURE__ */
|
|
9967
|
+
/* @__PURE__ */ jsx42("div", { className: "grid gap-3 sm:grid-cols-2", children: (fields.data ?? []).map((field2) => /* @__PURE__ */ jsx42(
|
|
9901
9968
|
FieldRow,
|
|
9902
9969
|
{
|
|
9903
9970
|
recordId,
|
|
@@ -9915,31 +9982,31 @@ function CustomRecordForm({
|
|
|
9915
9982
|
},
|
|
9916
9983
|
field2.id
|
|
9917
9984
|
)) }),
|
|
9918
|
-
touched ? predicted.filter((p) => !p.field_key).map((p) => /* @__PURE__ */
|
|
9985
|
+
touched ? predicted.filter((p) => !p.field_key).map((p) => /* @__PURE__ */ jsx42(
|
|
9919
9986
|
RefusalNotice,
|
|
9920
9987
|
{
|
|
9921
9988
|
error: { code: "refused_by_rule", message: p.message }
|
|
9922
9989
|
},
|
|
9923
9990
|
p.message
|
|
9924
9991
|
)) : null,
|
|
9925
|
-
storeSaid && !storeRefusalIsOnAField ? /* @__PURE__ */
|
|
9992
|
+
storeSaid && !storeRefusalIsOnAField ? /* @__PURE__ */ jsx42(
|
|
9926
9993
|
RefusalNotice,
|
|
9927
9994
|
{
|
|
9928
9995
|
error: storeSaid,
|
|
9929
9996
|
...said2.conflict ? {
|
|
9930
|
-
actions: /* @__PURE__ */
|
|
9997
|
+
actions: /* @__PURE__ */ jsxs37("div", { className: "mt-1 space-y-1", children: [
|
|
9931
9998
|
Object.entries(said2.conflict.contested_fields).map(([key, theirs]) => {
|
|
9932
9999
|
const column = (fields.data ?? []).find((f) => f.key === key);
|
|
9933
|
-
return /* @__PURE__ */
|
|
10000
|
+
return /* @__PURE__ */ jsxs37("p", { className: "text-[11px]", children: [
|
|
9934
10001
|
column ? fieldName(column) : humanizeIdentifier2(key),
|
|
9935
10002
|
": yours",
|
|
9936
10003
|
" ",
|
|
9937
|
-
/* @__PURE__ */
|
|
10004
|
+
/* @__PURE__ */ jsx42("strong", { children: asWords(draft[key]) }),
|
|
9938
10005
|
" \xB7 theirs ",
|
|
9939
|
-
/* @__PURE__ */
|
|
10006
|
+
/* @__PURE__ */ jsx42("strong", { children: asWords(theirs) })
|
|
9940
10007
|
] }, key);
|
|
9941
10008
|
}),
|
|
9942
|
-
/* @__PURE__ */
|
|
10009
|
+
/* @__PURE__ */ jsx42(
|
|
9943
10010
|
Button17,
|
|
9944
10011
|
{
|
|
9945
10012
|
type: "button",
|
|
@@ -9959,10 +10026,10 @@ function CustomRecordForm({
|
|
|
9959
10026
|
} : { onKeepEditing: () => keepEditing(), onDiscard: () => discard() }
|
|
9960
10027
|
}
|
|
9961
10028
|
) : null,
|
|
9962
|
-
/* @__PURE__ */
|
|
9963
|
-
/* @__PURE__ */
|
|
9964
|
-
/* @__PURE__ */
|
|
9965
|
-
onCancel ? /* @__PURE__ */
|
|
10029
|
+
/* @__PURE__ */ jsx42(Separator2, {}),
|
|
10030
|
+
/* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-2", children: [
|
|
10031
|
+
/* @__PURE__ */ jsx42(Button17, { type: "submit", size: "sm", disabled: said2.saving, children: said2.saving ? "Saving\u2026" : recordId ? "Save" : "Create" }),
|
|
10032
|
+
onCancel ? /* @__PURE__ */ jsx42(Button17, { type: "button", size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null
|
|
9966
10033
|
] })
|
|
9967
10034
|
]
|
|
9968
10035
|
}
|
|
@@ -9981,14 +10048,14 @@ function FieldRow({
|
|
|
9981
10048
|
const id = `field-${field2.id}`;
|
|
9982
10049
|
const storedWords = document2?.[field2.key];
|
|
9983
10050
|
const whole = typeof storedWords === "string" ? wholeValueOf3(document2, field2.key) : null;
|
|
9984
|
-
return /* @__PURE__ */
|
|
9985
|
-
/* @__PURE__ */
|
|
10051
|
+
return /* @__PURE__ */ jsxs37("div", { className: cn19("flex min-w-0 flex-col gap-1", whole && "sm:col-span-2"), children: [
|
|
10052
|
+
/* @__PURE__ */ jsx42(FieldLabel, { field: field2, htmlFor: id, children: /* @__PURE__ */ jsx42(ProvenanceBadge, { document: document2, fieldKey: field2.key }) }),
|
|
9986
10053
|
whole ? (
|
|
9987
10054
|
// A TEXT KEPT AS A FILE opens WHOLE, never as the 1000 characters its cell holds —
|
|
9988
10055
|
// saving those would cut the value (lane BIG-VALUES-WRITE).
|
|
9989
|
-
/* @__PURE__ */
|
|
9990
|
-
) : /* @__PURE__ */
|
|
9991
|
-
problems.map((problem, index) => /* @__PURE__ */
|
|
10056
|
+
/* @__PURE__ */ jsx42(WholeValueEditor, { field: field2, pointer: whole, words: String(storedWords ?? ""), value, onChange, id })
|
|
10057
|
+
) : /* @__PURE__ */ jsx42(FieldControl, { field: field2, value, onChange, id, recordId }),
|
|
10058
|
+
problems.map((problem, index) => /* @__PURE__ */ jsx42(
|
|
9992
10059
|
RefusalNotice,
|
|
9993
10060
|
{
|
|
9994
10061
|
error: { code: "refused_by_rule", message: problem.message },
|
|
@@ -10041,25 +10108,25 @@ async function columnsTheTypeStillNeeds(client, args) {
|
|
|
10041
10108
|
}
|
|
10042
10109
|
|
|
10043
10110
|
// src/RecordTypes.tsx
|
|
10044
|
-
import { Fragment as Fragment12, jsx as
|
|
10111
|
+
import { Fragment as Fragment12, jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
10045
10112
|
var TypeFieldContext = createContext4(null);
|
|
10046
10113
|
function TypeFieldScope({ table, children }) {
|
|
10047
|
-
return /* @__PURE__ */
|
|
10114
|
+
return /* @__PURE__ */ jsx43(TypeFieldContext.Provider, { value: table?.type_field ?? null, children });
|
|
10048
10115
|
}
|
|
10049
10116
|
function useTypeFieldKey() {
|
|
10050
10117
|
return useContext3(TypeFieldContext);
|
|
10051
10118
|
}
|
|
10052
10119
|
function NotApplicableGate({ field: field2, document: document2, children }) {
|
|
10053
10120
|
const typeKey = useTypeFieldKey();
|
|
10054
|
-
if (typesOfField(field2).length === 0) return /* @__PURE__ */
|
|
10121
|
+
if (typesOfField(field2).length === 0) return /* @__PURE__ */ jsx43(Fragment12, { children });
|
|
10055
10122
|
const recordType = recordTypeOf2({ type_field: typeKey }, document2);
|
|
10056
|
-
if (fieldAppliesToType(field2, recordType)) return /* @__PURE__ */
|
|
10123
|
+
if (fieldAppliesToType(field2, recordType)) return /* @__PURE__ */ jsx43(Fragment12, { children });
|
|
10057
10124
|
const why = notApplicableSentence(field2, recordType);
|
|
10058
|
-
return /* @__PURE__ */
|
|
10125
|
+
return /* @__PURE__ */ jsx43("span", { className: "block w-full truncate text-muted-foreground", title: why, "aria-label": why, "data-records-cell-not-applicable": field2.key, children: "\u2014" });
|
|
10059
10126
|
}
|
|
10060
10127
|
function useTypeChoices(typeField) {
|
|
10061
|
-
const client =
|
|
10062
|
-
const [choices, setChoices] =
|
|
10128
|
+
const client = useRecordsClient13();
|
|
10129
|
+
const [choices, setChoices] = useState32([]);
|
|
10063
10130
|
const id = typeField?.id ?? null;
|
|
10064
10131
|
useEffect22(() => {
|
|
10065
10132
|
if (!id) {
|
|
@@ -10089,9 +10156,9 @@ function RecordTypeSetting({
|
|
|
10089
10156
|
const now = table.type_field ?? "";
|
|
10090
10157
|
if (candidates.length === 0 && now === "") return null;
|
|
10091
10158
|
const options = [{ value: "", label: "None" }, ...candidates.map((f) => ({ value: f.key, label: fieldName(f) }))];
|
|
10092
|
-
return /* @__PURE__ */
|
|
10093
|
-
/* @__PURE__ */
|
|
10094
|
-
/* @__PURE__ */
|
|
10159
|
+
return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-1", "data-table-type-field-setting": "", children: [
|
|
10160
|
+
/* @__PURE__ */ jsx43("span", { className: "text-muted-foreground", children: "Record type" }),
|
|
10161
|
+
/* @__PURE__ */ jsx43(
|
|
10095
10162
|
PickOne,
|
|
10096
10163
|
{
|
|
10097
10164
|
value: now,
|
|
@@ -10116,10 +10183,10 @@ function AppliesToTypes({
|
|
|
10116
10183
|
const choices = useTypeChoices(typeField);
|
|
10117
10184
|
if (!typeField || choices.length === 0) return null;
|
|
10118
10185
|
const has = (key, label) => value.some((v) => fieldAppliesToType({ applies_to_types: [v] }, key) || fieldAppliesToType({ applies_to_types: [v] }, label));
|
|
10119
|
-
return /* @__PURE__ */
|
|
10120
|
-
/* @__PURE__ */
|
|
10121
|
-
/* @__PURE__ */
|
|
10122
|
-
/* @__PURE__ */
|
|
10186
|
+
return /* @__PURE__ */ jsxs38("div", { className: "flex flex-col gap-1", "data-records-field-applies-to": "", children: [
|
|
10187
|
+
/* @__PURE__ */ jsx43("span", { className: "text-muted-foreground", children: "Applies to" }),
|
|
10188
|
+
/* @__PURE__ */ jsx43("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1", children: choices.map((choice) => /* @__PURE__ */ jsxs38("label", { className: "flex items-center gap-1.5", children: [
|
|
10189
|
+
/* @__PURE__ */ jsx43(
|
|
10123
10190
|
Checkbox5,
|
|
10124
10191
|
{
|
|
10125
10192
|
checked: has(choice.key, choice.label),
|
|
@@ -10146,20 +10213,20 @@ function TypeChangeDialog({
|
|
|
10146
10213
|
onSaved
|
|
10147
10214
|
}) {
|
|
10148
10215
|
const initial = useMemo14(() => ({ [typeKey]: recordType }), [typeKey, recordType]);
|
|
10149
|
-
return /* @__PURE__ */
|
|
10150
|
-
/* @__PURE__ */
|
|
10151
|
-
/* @__PURE__ */
|
|
10216
|
+
return /* @__PURE__ */ jsx43(Dialog4, { open, onOpenChange, children: /* @__PURE__ */ jsxs38(DialogContent4, { className: "sm:max-w-md", "data-records-type-change": recordId, children: [
|
|
10217
|
+
/* @__PURE__ */ jsxs38(DialogHeader4, { children: [
|
|
10218
|
+
/* @__PURE__ */ jsxs38(DialogTitle4, { children: [
|
|
10152
10219
|
recordName2 ? `\u201C${recordName2}\u201D` : "This record",
|
|
10153
10220
|
" becomes ",
|
|
10154
10221
|
typeWords(recordType)
|
|
10155
10222
|
] }),
|
|
10156
|
-
/* @__PURE__ */
|
|
10223
|
+
/* @__PURE__ */ jsxs38(DialogDescription2, { children: [
|
|
10157
10224
|
"Fill in what ",
|
|
10158
10225
|
typeWords(recordType),
|
|
10159
10226
|
" needs, then save."
|
|
10160
10227
|
] })
|
|
10161
10228
|
] }),
|
|
10162
|
-
/* @__PURE__ */
|
|
10229
|
+
/* @__PURE__ */ jsx43(
|
|
10163
10230
|
RecordForm,
|
|
10164
10231
|
{
|
|
10165
10232
|
tableId,
|
|
@@ -10184,10 +10251,10 @@ function FillInForType({
|
|
|
10184
10251
|
recordType,
|
|
10185
10252
|
onSaved
|
|
10186
10253
|
}) {
|
|
10187
|
-
const [open, setOpen] =
|
|
10188
|
-
return /* @__PURE__ */
|
|
10189
|
-
/* @__PURE__ */
|
|
10190
|
-
open ? /* @__PURE__ */
|
|
10254
|
+
const [open, setOpen] = useState32(false);
|
|
10255
|
+
return /* @__PURE__ */ jsxs38(Fragment12, { children: [
|
|
10256
|
+
/* @__PURE__ */ jsx43(Button18, { size: "sm", variant: "outline", className: "h-6", "data-records-type-change-fill": "", onClick: () => setOpen(true), children: "Fill in\u2026" }),
|
|
10257
|
+
open ? /* @__PURE__ */ jsx43(
|
|
10191
10258
|
TypeChangeDialog,
|
|
10192
10259
|
{
|
|
10193
10260
|
tableId,
|
|
@@ -10204,7 +10271,7 @@ function FillInForType({
|
|
|
10204
10271
|
}
|
|
10205
10272
|
|
|
10206
10273
|
// src/FieldEditor.tsx
|
|
10207
|
-
import { Fragment as Fragment13, jsx as
|
|
10274
|
+
import { Fragment as Fragment13, jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
10208
10275
|
var RULE_KINDS = FIELD_RULE_KIND_VALUES.map((kind) => ({ kind, label: FIELD_RULE_KIND_LABEL[kind] }));
|
|
10209
10276
|
var SENSITIVITIES = FIELD_SENSITIVITIES.map((value) => ({ value, label: FIELD_SENSITIVITY_LABEL[value] }));
|
|
10210
10277
|
var AGENT_VISIBILITY = CONTEXT_POLICIES.map((value) => ({ value, label: CONTEXT_POLICY_LABEL[value] }));
|
|
@@ -10303,7 +10370,7 @@ function FieldEditor(props) {
|
|
|
10303
10370
|
const tableMutation = useFieldMutation();
|
|
10304
10371
|
const entityMutation = useEntityFieldMutation2();
|
|
10305
10372
|
const mutation = onEntity ? { saving: entityMutation.saving, error: entityMutation.error } : { saving: tableMutation.saving, error: tableMutation.error };
|
|
10306
|
-
const client =
|
|
10373
|
+
const client = useRecordsClient14();
|
|
10307
10374
|
const mayShape = onEntity ? entityRights.data?.may_declare === true : tableRights.structure;
|
|
10308
10375
|
const whyNot = onEntity ? entityRights.data?.reason ?? null : tableRights.why("structure");
|
|
10309
10376
|
const storeLabel = onEntity ? entityRights.data?.label ?? null : table.data?.name ?? null;
|
|
@@ -10313,52 +10380,52 @@ function FieldEditor(props) {
|
|
|
10313
10380
|
const copyOf = field2 ? void 0 : props.copyOf;
|
|
10314
10381
|
const start = field2 ?? copyOf;
|
|
10315
10382
|
const startAs = start ? void 0 : props.startAs;
|
|
10316
|
-
const [label, setLabel] =
|
|
10317
|
-
const [type, setType] =
|
|
10318
|
-
const [required, setRequired] =
|
|
10319
|
-
const [appliesTo, setAppliesTo] =
|
|
10320
|
-
const [multi, setMulti] =
|
|
10321
|
-
const [dated, setDated] =
|
|
10322
|
-
const [sensitivity, setSensitivity] =
|
|
10323
|
-
const [contextPolicy, setContextPolicy] =
|
|
10324
|
-
const [rules, setRules] =
|
|
10325
|
-
const [startsWith, setStartsWith] =
|
|
10326
|
-
const [ratingMax, setRatingMax] =
|
|
10383
|
+
const [label, setLabel] = useState33(field2?.label ?? (copyOf ? `${copyOf.label} (1)` : startAs?.label ?? ""));
|
|
10384
|
+
const [type, setType] = useState33(() => startAs ? startAs.type : startingType(start));
|
|
10385
|
+
const [required, setRequired] = useState33(start?.required ?? false);
|
|
10386
|
+
const [appliesTo, setAppliesTo] = useState33(() => typesOfField2(start ?? { applies_to_types: [] }));
|
|
10387
|
+
const [multi, setMulti] = useState33(start?.multi ?? false);
|
|
10388
|
+
const [dated, setDated] = useState33(start?.dated ?? false);
|
|
10389
|
+
const [sensitivity, setSensitivity] = useState33(String(start?.sensitivity ?? "internal"));
|
|
10390
|
+
const [contextPolicy, setContextPolicy] = useState33(String(start?.context_policy ?? "include"));
|
|
10391
|
+
const [rules, setRules] = useState33(start?.rules ?? []);
|
|
10392
|
+
const [startsWith, setStartsWith] = useState33(start?.default ?? null);
|
|
10393
|
+
const [ratingMax, setRatingMax] = useState33(() => start ? ratingMaxOf(start) : 5);
|
|
10327
10394
|
const savedRules = useMemo15(
|
|
10328
10395
|
() => field2 ? type === "rating" ? rulesWithTopStar(field2.rules ?? [], ratingMaxOf(field2)) : field2.rules ?? [] : [],
|
|
10329
10396
|
[field2, type]
|
|
10330
10397
|
);
|
|
10331
10398
|
const editedRules = useMemo15(() => type === "rating" ? rulesWithTopStar(rules, ratingMax) : rules, [type, rules, ratingMax]);
|
|
10332
|
-
const [statusGroups, setStatusGroups] =
|
|
10333
|
-
const [statusKeys, setStatusKeys] =
|
|
10334
|
-
const [symbology, setSymbology] =
|
|
10399
|
+
const [statusGroups, setStatusGroups] = useState33({});
|
|
10400
|
+
const [statusKeys, setStatusKeys] = useState33({});
|
|
10401
|
+
const [symbology, setSymbology] = useState33(String(start?.config?.["symbology"] ?? ""));
|
|
10335
10402
|
const descriptionStart = String(start?.config?.["description"] ?? "");
|
|
10336
|
-
const [description, setDescription] =
|
|
10403
|
+
const [description, setDescription] = useState33(descriptionStart);
|
|
10337
10404
|
const buttonStart = useMemo15(() => buttonOf(start) ?? { label: "" }, [start]);
|
|
10338
|
-
const [buttonSettings, setButtonSettings] =
|
|
10405
|
+
const [buttonSettings, setButtonSettings] = useState33(buttonStart);
|
|
10339
10406
|
const prefixStart = autonumberPrefixOf3(start);
|
|
10340
|
-
const [numberPrefix, setNumberPrefix] =
|
|
10407
|
+
const [numberPrefix, setNumberPrefix] = useState33(prefixStart);
|
|
10341
10408
|
const dependencyStart = start?.config?.["dependency"] === true;
|
|
10342
10409
|
const watchStart = useMemo15(() => watchedFieldsOf(start), [start]);
|
|
10343
|
-
const [watchFields, setWatchFields] =
|
|
10344
|
-
const [dependency, setDependency] =
|
|
10410
|
+
const [watchFields, setWatchFields] = useState33(watchStart);
|
|
10411
|
+
const [dependency, setDependency] = useState33(dependencyStart);
|
|
10345
10412
|
const limitViewStart = typeof start?.config?.["limit_to_view"] === "string" ? String(start.config["limit_to_view"]) : "";
|
|
10346
|
-
const [limitView, setLimitView] =
|
|
10413
|
+
const [limitView, setLimitView] = useState33(limitViewStart);
|
|
10347
10414
|
const bindingStart = start?.config?.["binding"] === "snapshot" ? "snapshot" : "live";
|
|
10348
|
-
const [binding, setBinding] =
|
|
10415
|
+
const [binding, setBinding] = useState33(bindingStart);
|
|
10349
10416
|
const carriesStart = start?.config?.["carries"] === true;
|
|
10350
|
-
const [carries, setCarries] =
|
|
10417
|
+
const [carries, setCarries] = useState33(carriesStart);
|
|
10351
10418
|
const carriesMaxStart = start?.config?.["carries_max"] === "editor" ? "editor" : "viewer";
|
|
10352
|
-
const [carriesMax, setCarriesMax] =
|
|
10419
|
+
const [carriesMax, setCarriesMax] = useState33(carriesMaxStart);
|
|
10353
10420
|
const loopsStart = start?.config?.["loops"] === true;
|
|
10354
|
-
const [loops, setLoops] =
|
|
10355
|
-
const [targetViews, setTargetViews] =
|
|
10421
|
+
const [loops, setLoops] = useState33(loopsStart);
|
|
10422
|
+
const [targetViews, setTargetViews] = useState33(null);
|
|
10356
10423
|
const alsoStart = useMemo15(() => {
|
|
10357
10424
|
const listed = start?.config?.["target_tables"];
|
|
10358
10425
|
const own3 = String(start?.relation_target ?? "");
|
|
10359
10426
|
return start?.config?.["target_mode"] === "several" && Array.isArray(listed) ? listed.map(String).filter((t) => t !== own3) : [];
|
|
10360
10427
|
}, [start]);
|
|
10361
|
-
const [alsoTargets, setAlsoTargets] =
|
|
10428
|
+
const [alsoTargets, setAlsoTargets] = useState33(alsoStart);
|
|
10362
10429
|
const limitTarget = field2?.type === "relation" && field2.relation_target && !onEntity ? String(field2.relation_target) : null;
|
|
10363
10430
|
useEffect23(() => {
|
|
10364
10431
|
if (!limitTarget) return;
|
|
@@ -10370,9 +10437,9 @@ function FieldEditor(props) {
|
|
|
10370
10437
|
live = false;
|
|
10371
10438
|
};
|
|
10372
10439
|
}, [client, limitTarget]);
|
|
10373
|
-
const [notifyStart, setNotifyStart] =
|
|
10374
|
-
const [notify, setNotify] =
|
|
10375
|
-
const [notifyReadError, setNotifyReadError] =
|
|
10440
|
+
const [notifyStart, setNotifyStart] = useState33(field2 ? null : false);
|
|
10441
|
+
const [notify, setNotify] = useState33(false);
|
|
10442
|
+
const [notifyReadError, setNotifyReadError] = useState33(null);
|
|
10376
10443
|
const personColumn = !onEntity && type === "member";
|
|
10377
10444
|
useEffect23(() => {
|
|
10378
10445
|
if (!field2 || onEntity || type !== "member") return;
|
|
@@ -10409,8 +10476,8 @@ function FieldEditor(props) {
|
|
|
10409
10476
|
if (field2 || type !== "select" && type !== "multi_select") return;
|
|
10410
10477
|
setNewChoices((rows) => rows.length > 0 ? rows : [newChoiceRow([])]);
|
|
10411
10478
|
}, [field2, type]);
|
|
10412
|
-
const [allowOther, setAllowOther] =
|
|
10413
|
-
const [newChoices, setNewChoices] =
|
|
10479
|
+
const [allowOther, setAllowOther] = useState33(start?.config?.["allow_other"] === true);
|
|
10480
|
+
const [newChoices, setNewChoices] = useState33([]);
|
|
10414
10481
|
const copyOfId = copyOf?.id ?? null;
|
|
10415
10482
|
useEffect23(() => {
|
|
10416
10483
|
if (!copyOf || !copyOfId) return;
|
|
@@ -10424,49 +10491,50 @@ function FieldEditor(props) {
|
|
|
10424
10491
|
live = false;
|
|
10425
10492
|
};
|
|
10426
10493
|
}, [client, copyOfId]);
|
|
10427
|
-
const [choiceList, setChoiceList] =
|
|
10428
|
-
const [
|
|
10429
|
-
const [
|
|
10430
|
-
const [
|
|
10431
|
-
const [
|
|
10432
|
-
const [
|
|
10433
|
-
const [
|
|
10434
|
-
const [
|
|
10435
|
-
const [
|
|
10436
|
-
const [
|
|
10494
|
+
const [choiceList, setChoiceList] = useState33(null);
|
|
10495
|
+
const [pickedList, setPickedList] = useState33(null);
|
|
10496
|
+
const [choiceListStart, setChoiceListStart] = useState33(null);
|
|
10497
|
+
const [rehome, setRehome] = useState33({});
|
|
10498
|
+
const [rehomed, setRehomed] = useState33(null);
|
|
10499
|
+
const [rehomeRefused, setRehomeRefused] = useState33(null);
|
|
10500
|
+
const [unit, setUnit] = useState33(start?.unit ?? "$");
|
|
10501
|
+
const [withTime, setWithTime] = useState33(String(start?.config?.["kind"] ?? "date") === "datetime");
|
|
10502
|
+
const [via, setVia] = useState33(String(start?.config?.["via"] ?? ""));
|
|
10503
|
+
const [pick, setPick] = useState33(String(start?.config?.["pick"] ?? ""));
|
|
10504
|
+
const [agg, setAgg] = useState33(
|
|
10437
10505
|
start?.config?.["agg"] ?? "count"
|
|
10438
10506
|
);
|
|
10439
|
-
const [of, setOf] =
|
|
10507
|
+
const [of, setOf] = useState33(String(start?.config?.["of"] ?? ""));
|
|
10440
10508
|
const savedRollupFilter = field2?.config?.["filter"] ?? null;
|
|
10441
|
-
const [rollupFilter, setRollupFilter] =
|
|
10509
|
+
const [rollupFilter, setRollupFilter] = useState33(
|
|
10442
10510
|
field2 ? savedRollupFilter : copyOf?.config?.["filter"] ?? null
|
|
10443
10511
|
);
|
|
10444
10512
|
const rollupFilterChanged = JSON.stringify(rollupFilter) !== JSON.stringify(savedRollupFilter);
|
|
10445
|
-
const [relationTarget, setRelationTarget] =
|
|
10446
|
-
const [showOnOther, setShowOnOther] =
|
|
10447
|
-
const [nestsSubItems, setNestsSubItems] =
|
|
10448
|
-
const [reverseRefused, setReverseRefused] =
|
|
10513
|
+
const [relationTarget, setRelationTarget] = useState33(String(start?.relation_target ?? ""));
|
|
10514
|
+
const [showOnOther, setShowOnOther] = useState33(true);
|
|
10515
|
+
const [nestsSubItems, setNestsSubItems] = useState33(false);
|
|
10516
|
+
const [reverseRefused, setReverseRefused] = useState33(null);
|
|
10449
10517
|
const otherTable = useTable3(!field2 && type === "relation" && relationTarget !== "" ? relationTarget : null);
|
|
10450
|
-
const [display, setDisplay] =
|
|
10451
|
-
const [formulaOp, setFormulaOp] =
|
|
10452
|
-
const [formulaFields, setFormulaFields] =
|
|
10453
|
-
const [formulaSeparator, setFormulaSeparator] =
|
|
10454
|
-
const [allowedTypes, setAllowedTypes] =
|
|
10518
|
+
const [display, setDisplay] = useState33(start?.display ?? null);
|
|
10519
|
+
const [formulaOp, setFormulaOp] = useState33(() => formulaOpOf(start));
|
|
10520
|
+
const [formulaFields, setFormulaFields] = useState33(() => formulaFieldIdsOf(start));
|
|
10521
|
+
const [formulaSeparator, setFormulaSeparator] = useState33(() => formulaSeparatorOf(start));
|
|
10522
|
+
const [allowedTypes, setAllowedTypes] = useState33(() => entityReferenceKindsOf(start));
|
|
10455
10523
|
const startingFormulaText = start ? formulaTextNow(String(start.config?.["formula_text"] ?? ""), start.config?.["expr"] ?? start.expr, fields.data) : "";
|
|
10456
|
-
const [formulaText, setFormulaText] =
|
|
10524
|
+
const [formulaText, setFormulaText] = useState33(startingFormulaText);
|
|
10457
10525
|
const shownFormula = useRef15(startingFormulaText);
|
|
10458
10526
|
useEffect23(() => {
|
|
10459
10527
|
if (shownFormula.current === startingFormulaText) return;
|
|
10460
10528
|
setFormulaText((typed) => typed === shownFormula.current ? startingFormulaText : typed);
|
|
10461
10529
|
shownFormula.current = startingFormulaText;
|
|
10462
10530
|
}, [startingFormulaText]);
|
|
10463
|
-
const [formulaWritten, setFormulaWritten] =
|
|
10464
|
-
const [formulaOk, setFormulaOk] =
|
|
10465
|
-
const [askingToRemove, setAskingToRemove] =
|
|
10466
|
-
const [attempted, setAttempted] =
|
|
10467
|
-
const [showsAs, setShowsAs] =
|
|
10468
|
-
const [backfillError, setBackfillError] =
|
|
10469
|
-
const [notLanded, setNotLanded] =
|
|
10531
|
+
const [formulaWritten, setFormulaWritten] = useState33(() => startingFormulaText.trim() !== "" || Boolean(field2) || startAs?.type === "formula");
|
|
10532
|
+
const [formulaOk, setFormulaOk] = useState33(null);
|
|
10533
|
+
const [askingToRemove, setAskingToRemove] = useState33(false);
|
|
10534
|
+
const [attempted, setAttempted] = useState33(false);
|
|
10535
|
+
const [showsAs, setShowsAs] = useState33(() => start ? startingChoice(start) : { format: null, retype: null });
|
|
10536
|
+
const [backfillError, setBackfillError] = useState33(null);
|
|
10537
|
+
const [notLanded, setNotLanded] = useState33(false);
|
|
10470
10538
|
const liveField = field2 ? fields.data?.find((f) => f.id === field2.id) ?? field2 : void 0;
|
|
10471
10539
|
const heldAs = liveField ? JSON.stringify([liveField.type, liveField.config?.["kind"] ?? null, liveField.format ?? null, liveField.multi ?? false, liveField.unit ?? null]) : "";
|
|
10472
10540
|
const seededAs = useRef15(heldAs);
|
|
@@ -10508,7 +10576,7 @@ function FieldEditor(props) {
|
|
|
10508
10576
|
const offersMany = multiApplies(type) && !isTitle;
|
|
10509
10577
|
if (!mayShape) {
|
|
10510
10578
|
if (onEntity && entityRights.loading) return null;
|
|
10511
|
-
return /* @__PURE__ */
|
|
10579
|
+
return /* @__PURE__ */ jsx44("p", { className: cn20("text-xs text-muted-foreground", className), children: props.tableLabel && storeLabel && whyNot ? whyNot.split(storeLabel).join(props.tableLabel) : whyNot });
|
|
10512
10580
|
}
|
|
10513
10581
|
const options = newChoices.map((r) => r.words.trim()).filter((word) => word !== "");
|
|
10514
10582
|
const shownStatusRows = type !== "status" ? [] : statusGroupRows(field2, editing ? choiceList ?? [] : newChoices, statusKeys, statusGroups);
|
|
@@ -10579,10 +10647,19 @@ function FieldEditor(props) {
|
|
|
10579
10647
|
// choice in place, plain words add one, a choice left out is retired. Sent only when the
|
|
10580
10648
|
// list is not what the store already holds.
|
|
10581
10649
|
...(() => {
|
|
10582
|
-
if (!chooses || !choiceList || !choiceListStart) return {};
|
|
10650
|
+
if (!chooses || !choiceList || !choiceListStart || pickedList !== null) return {};
|
|
10583
10651
|
const edited = choiceListPatch(choiceListStart, choiceList);
|
|
10584
10652
|
return edited ? { options: edited } : {};
|
|
10585
10653
|
})(),
|
|
10654
|
+
// L58: THE LINK TO A NAMED PICK LIST. A pick list is a Table of choices, so the link is
|
|
10655
|
+
// the column's `options_table_id`. Going back to a list of its own sends the words it shows
|
|
10656
|
+
// now with the column's kind: the store makes the column a table of its own for them.
|
|
10657
|
+
...(() => {
|
|
10658
|
+
if (!chooses || pickedList === null) return {};
|
|
10659
|
+
if (pickedList !== OWN_LIST) return { options_table_id: pickedList };
|
|
10660
|
+
const words = (choiceList ?? []).map((r) => r.words.trim()).filter((w) => w !== "");
|
|
10661
|
+
return { type, options_table_id: "", options: words };
|
|
10662
|
+
})(),
|
|
10586
10663
|
// REL-DISP. Which of the other record's columns this one shows. Sent for
|
|
10587
10664
|
// every relation column, `null` included, because `null` is how the door
|
|
10588
10665
|
// REMOVES a spec and the column goes back to the target table's own
|
|
@@ -10734,15 +10811,15 @@ function FieldEditor(props) {
|
|
|
10734
10811
|
if (gone) (onRemoved ?? onSaved)?.();
|
|
10735
10812
|
else setAskingToRemove(false);
|
|
10736
10813
|
};
|
|
10737
|
-
return /* @__PURE__ */
|
|
10738
|
-
/* @__PURE__ */
|
|
10739
|
-
/* @__PURE__ */
|
|
10740
|
-
/* @__PURE__ */
|
|
10814
|
+
return /* @__PURE__ */ jsxs39("div", { className: cn20("flex min-w-0 flex-col gap-3 text-xs", className), "data-records-field-editor": "", children: [
|
|
10815
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
10816
|
+
/* @__PURE__ */ jsx44("span", { className: "font-medium", children: field2 ? `Field \xB7 ${fieldName(field2)}` : "New field" }),
|
|
10817
|
+
/* @__PURE__ */ jsx44("span", { className: "ml-auto text-muted-foreground", children: tableLabel })
|
|
10741
10818
|
] }),
|
|
10742
|
-
/* @__PURE__ */
|
|
10743
|
-
/* @__PURE__ */
|
|
10744
|
-
/* @__PURE__ */
|
|
10745
|
-
/* @__PURE__ */
|
|
10819
|
+
/* @__PURE__ */ jsxs39("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
10820
|
+
/* @__PURE__ */ jsxs39("label", { className: "flex flex-col gap-1", children: [
|
|
10821
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "Name" }),
|
|
10822
|
+
/* @__PURE__ */ jsx44(
|
|
10746
10823
|
BasicInput8,
|
|
10747
10824
|
{
|
|
10748
10825
|
value: label,
|
|
@@ -10758,7 +10835,7 @@ function FieldEditor(props) {
|
|
|
10758
10835
|
...nameLine ? { "aria-invalid": true, "aria-describedby": "field-editor-name-taken" } : {}
|
|
10759
10836
|
}
|
|
10760
10837
|
),
|
|
10761
|
-
nameLine ? /* @__PURE__ */
|
|
10838
|
+
nameLine ? /* @__PURE__ */ jsx44(
|
|
10762
10839
|
"span",
|
|
10763
10840
|
{
|
|
10764
10841
|
id: "field-editor-name-taken",
|
|
@@ -10769,9 +10846,9 @@ function FieldEditor(props) {
|
|
|
10769
10846
|
}
|
|
10770
10847
|
) : null
|
|
10771
10848
|
] }),
|
|
10772
|
-
field2 ? /* @__PURE__ */
|
|
10773
|
-
/* @__PURE__ */
|
|
10774
|
-
/* @__PURE__ */
|
|
10849
|
+
field2 ? /* @__PURE__ */ jsxs39("label", { className: "flex flex-col gap-1 sm:col-span-2", children: [
|
|
10850
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "Help text" }),
|
|
10851
|
+
/* @__PURE__ */ jsx44(
|
|
10775
10852
|
BasicInput8,
|
|
10776
10853
|
{
|
|
10777
10854
|
value: description,
|
|
@@ -10782,29 +10859,29 @@ function FieldEditor(props) {
|
|
|
10782
10859
|
}
|
|
10783
10860
|
)
|
|
10784
10861
|
] }) : null,
|
|
10785
|
-
/* @__PURE__ */
|
|
10786
|
-
/* @__PURE__ */
|
|
10787
|
-
/* @__PURE__ */
|
|
10788
|
-
|
|
10862
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
10863
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "What it holds" }),
|
|
10864
|
+
/* @__PURE__ */ jsxs39(
|
|
10865
|
+
Select6,
|
|
10789
10866
|
{
|
|
10790
10867
|
value: type,
|
|
10791
10868
|
disabled: editing,
|
|
10792
10869
|
onValueChange: (next) => setType(next),
|
|
10793
10870
|
children: [
|
|
10794
|
-
/* @__PURE__ */
|
|
10795
|
-
/* @__PURE__ */
|
|
10796
|
-
/* @__PURE__ */
|
|
10797
|
-
FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */
|
|
10871
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", "aria-label": "What this field holds", ...choice?.explanation ? { title: choice.explanation } : {}, children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
10872
|
+
/* @__PURE__ */ jsx44(SelectContent6, { children: FIELD_TYPE_GROUPS.filter((group) => offered.some((c) => c.group === group)).map((group) => /* @__PURE__ */ jsxs39(SelectGroup, { children: [
|
|
10873
|
+
/* @__PURE__ */ jsx44(SelectLabel, { children: group }),
|
|
10874
|
+
FIELD_TYPE_CATALOGUE.filter((c) => c.group === group && (c.id === type || offered.includes(c))).map((c) => /* @__PURE__ */ jsx44(SelectItem6, { value: c.id, children: c.label }, c.id))
|
|
10798
10875
|
] }, group)) })
|
|
10799
10876
|
]
|
|
10800
10877
|
}
|
|
10801
10878
|
),
|
|
10802
|
-
editing && field2 ? /* @__PURE__ */
|
|
10879
|
+
editing && field2 ? /* @__PURE__ */ jsx44(FieldRetype, { field: liveField ?? field2, tableId }) : null
|
|
10803
10880
|
] })
|
|
10804
10881
|
] }),
|
|
10805
|
-
type === "formula" && others.length > 0 ? /* @__PURE__ */
|
|
10806
|
-
editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */
|
|
10807
|
-
/* @__PURE__ */
|
|
10882
|
+
type === "formula" && others.length > 0 ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-2", children: [
|
|
10883
|
+
editing ? startingFormulaText.trim() === "" ? /* @__PURE__ */ jsx44("p", { className: "text-[11px] text-muted-foreground", children: EDITING_A_WORKED_OUT_COLUMN }) : null : /* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-1", role: "group", "aria-label": "How to make this column", children: [
|
|
10884
|
+
/* @__PURE__ */ jsx44(
|
|
10808
10885
|
Button19,
|
|
10809
10886
|
{
|
|
10810
10887
|
type: "button",
|
|
@@ -10815,7 +10892,7 @@ function FieldEditor(props) {
|
|
|
10815
10892
|
children: "Pick the columns"
|
|
10816
10893
|
}
|
|
10817
10894
|
),
|
|
10818
|
-
/* @__PURE__ */
|
|
10895
|
+
/* @__PURE__ */ jsx44(
|
|
10819
10896
|
Button19,
|
|
10820
10897
|
{
|
|
10821
10898
|
type: "button",
|
|
@@ -10827,7 +10904,7 @@ function FieldEditor(props) {
|
|
|
10827
10904
|
}
|
|
10828
10905
|
)
|
|
10829
10906
|
] }),
|
|
10830
|
-
formulaWritten ? /* @__PURE__ */
|
|
10907
|
+
formulaWritten ? /* @__PURE__ */ jsx44(
|
|
10831
10908
|
FormulaTextEditor,
|
|
10832
10909
|
{
|
|
10833
10910
|
tableId,
|
|
@@ -10837,9 +10914,9 @@ function FieldEditor(props) {
|
|
|
10837
10914
|
columns: others
|
|
10838
10915
|
}
|
|
10839
10916
|
) : null
|
|
10840
|
-
] }) : editing && type === "formula" ? /* @__PURE__ */
|
|
10841
|
-
editing && field2 && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */
|
|
10842
|
-
!editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */
|
|
10917
|
+
] }) : editing && type === "formula" ? /* @__PURE__ */ jsx44("p", { className: "text-[11px] text-muted-foreground", children: "No other column to read." }) : null,
|
|
10918
|
+
editing && field2 && !onEntity && (type === "lookup" || type === "rollup") ? /* @__PURE__ */ jsx44(SourceArchivedNotice, { fieldId: field2.id, tableId }) : null,
|
|
10919
|
+
!editing && !(type === "formula" && formulaWritten) || type === "select" || type === "multi_select" || type === "status" || type === "rating" || type === "barcode" || type === "relation" || type === "entity_reference" ? /* @__PURE__ */ jsx44(
|
|
10843
10920
|
TypeQuestions,
|
|
10844
10921
|
{
|
|
10845
10922
|
type,
|
|
@@ -10869,21 +10946,24 @@ function FieldEditor(props) {
|
|
|
10869
10946
|
setFormulaSeparator,
|
|
10870
10947
|
relations: sourcesFor(type),
|
|
10871
10948
|
others,
|
|
10872
|
-
choiceList: editing && field2 ? /* @__PURE__ */
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
|
|
10883
|
-
|
|
10949
|
+
choiceList: editing && field2 ? /* @__PURE__ */ jsxs39(Fragment13, { children: [
|
|
10950
|
+
type === "select" || type === "multi_select" ? /* @__PURE__ */ jsx44(PickListLink, { field: field2, value: pickedList, onChange: setPickedList }) : null,
|
|
10951
|
+
pickedList !== null && pickedList !== OWN_LIST ? null : /* @__PURE__ */ jsx44(
|
|
10952
|
+
ChoiceListEditor,
|
|
10953
|
+
{
|
|
10954
|
+
field: field2,
|
|
10955
|
+
rows: choiceList,
|
|
10956
|
+
onRows: setChoiceList,
|
|
10957
|
+
onStart: setChoiceListStart,
|
|
10958
|
+
allowOther,
|
|
10959
|
+
rehome,
|
|
10960
|
+
onRehome: setRehome
|
|
10961
|
+
}
|
|
10962
|
+
)
|
|
10963
|
+
] }) : /* @__PURE__ */ jsx44(ChoiceListEditor, { isNew: true, rows: newChoices, onRows: setNewChoices }),
|
|
10884
10964
|
allowedTypes,
|
|
10885
10965
|
setAllowedTypes,
|
|
10886
|
-
newer: type === "rating" ? /* @__PURE__ */
|
|
10966
|
+
newer: type === "rating" ? /* @__PURE__ */ jsx44(
|
|
10887
10967
|
RatingMaxQuestion,
|
|
10888
10968
|
{
|
|
10889
10969
|
value: ratingMax,
|
|
@@ -10891,65 +10971,65 @@ function FieldEditor(props) {
|
|
|
10891
10971
|
setRatingMax(next);
|
|
10892
10972
|
}
|
|
10893
10973
|
}
|
|
10894
|
-
) : type === "status" ? /* @__PURE__ */
|
|
10974
|
+
) : type === "status" ? /* @__PURE__ */ jsx44(StatusGroupsQuestion, { rows: shownStatusRows, onGroup: (ref, next) => setStatusGroups({ ...statusGroups, [ref]: next }) }) : type === "barcode" ? /* @__PURE__ */ jsx44(BarcodeSymbologyQuestion, { value: symbology, onChange: setSymbology }) : null
|
|
10895
10975
|
}
|
|
10896
10976
|
) : null,
|
|
10897
|
-
type === "button" ? /* @__PURE__ */
|
|
10898
|
-
type === "modified_time" ? /* @__PURE__ */
|
|
10899
|
-
type === "autonumber" ? /* @__PURE__ */
|
|
10900
|
-
/* @__PURE__ */
|
|
10901
|
-
/* @__PURE__ */
|
|
10977
|
+
type === "button" ? /* @__PURE__ */ jsx44(ButtonSettingsEditor, { value: buttonSettings, onChange: setButtonSettings, tableId: onEntity ? null : tableId, fields: others }) : null,
|
|
10978
|
+
type === "modified_time" ? /* @__PURE__ */ jsx44(WatchFieldsPicker, { fields: others, value: watchFields, onChange: setWatchFields }) : null,
|
|
10979
|
+
type === "autonumber" ? /* @__PURE__ */ jsxs39("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
10980
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "Prefix" }),
|
|
10981
|
+
/* @__PURE__ */ jsx44(BasicInput8, { className: "h-8 text-xs", placeholder: "TASK-", maxLength: 16, "data-records-autonumber-prefix": "", value: numberPrefix, onChange: (e) => setNumberPrefix(e.target.value) })
|
|
10902
10982
|
] }) : null,
|
|
10903
|
-
editing && field2?.type === "relation" && field2.relation_target && field2.relation_target === field2.entity_definition_id ? /* @__PURE__ */
|
|
10904
|
-
/* @__PURE__ */
|
|
10905
|
-
/* @__PURE__ */
|
|
10983
|
+
editing && field2?.type === "relation" && field2.relation_target && field2.relation_target === field2.entity_definition_id ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5 text-sm", title: "A timeline draws a line to each record this one waits on", children: [
|
|
10984
|
+
/* @__PURE__ */ jsx44(Checkbox6, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
|
|
10985
|
+
/* @__PURE__ */ jsx44("span", { children: "Waits on the linked records" })
|
|
10906
10986
|
] }) : null,
|
|
10907
|
-
editing && limitTarget ? /* @__PURE__ */
|
|
10908
|
-
/* @__PURE__ */
|
|
10909
|
-
/* @__PURE__ */
|
|
10910
|
-
/* @__PURE__ */
|
|
10911
|
-
/* @__PURE__ */
|
|
10912
|
-
/* @__PURE__ */
|
|
10913
|
-
(targetViews ?? []).map((v) => /* @__PURE__ */
|
|
10914
|
-
limitView !== "" && targetViews !== null && !targetViews.some((v) => v.id === limitView) ? /* @__PURE__ */
|
|
10987
|
+
editing && limitTarget ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", "data-records-limit-to-view": "", children: [
|
|
10988
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "Choices come from" }),
|
|
10989
|
+
/* @__PURE__ */ jsxs39(Select6, { value: limitView === "" ? "__all" : limitView, onValueChange: (next) => setLimitView(next === "__all" ? "" : next), disabled: targetViews === null, children: [
|
|
10990
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", "aria-label": "Limit the choices to a view", children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
10991
|
+
/* @__PURE__ */ jsxs39(SelectContent6, { children: [
|
|
10992
|
+
/* @__PURE__ */ jsx44(SelectItem6, { value: "__all", children: "Every record" }),
|
|
10993
|
+
(targetViews ?? []).map((v) => /* @__PURE__ */ jsx44(SelectItem6, { value: v.id, children: v.name }, v.id)),
|
|
10994
|
+
limitView !== "" && targetViews !== null && !targetViews.some((v) => v.id === limitView) ? /* @__PURE__ */ jsx44(SelectItem6, { value: limitView, children: "A view that is gone" }) : null
|
|
10915
10995
|
] })
|
|
10916
10996
|
] })
|
|
10917
10997
|
] }) : null,
|
|
10918
|
-
editing && limitTarget ? /* @__PURE__ */
|
|
10919
|
-
editing && field2?.type === "relation" ? /* @__PURE__ */
|
|
10920
|
-
/* @__PURE__ */
|
|
10921
|
-
/* @__PURE__ */
|
|
10922
|
-
/* @__PURE__ */
|
|
10923
|
-
/* @__PURE__ */
|
|
10924
|
-
/* @__PURE__ */
|
|
10925
|
-
/* @__PURE__ */
|
|
10998
|
+
editing && limitTarget ? /* @__PURE__ */ jsx44(AlsoPointsAt, { own: limitTarget, value: alsoTargets, onChange: setAlsoTargets }) : null,
|
|
10999
|
+
editing && field2?.type === "relation" ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", "data-records-link-binding": "", children: [
|
|
11000
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "When a linked record changes" }),
|
|
11001
|
+
/* @__PURE__ */ jsxs39(Select6, { value: binding, onValueChange: (next) => setBinding(next === "snapshot" ? "snapshot" : "live"), children: [
|
|
11002
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", "aria-label": "When a linked record changes", children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
11003
|
+
/* @__PURE__ */ jsxs39(SelectContent6, { children: [
|
|
11004
|
+
/* @__PURE__ */ jsx44(SelectItem6, { value: "live", children: "Show its changes" }),
|
|
11005
|
+
/* @__PURE__ */ jsx44(SelectItem6, { value: "snapshot", children: "Keep it as it was when linked" })
|
|
10926
11006
|
] })
|
|
10927
11007
|
] })
|
|
10928
11008
|
] }) : null,
|
|
10929
|
-
editing && field2?.type === "relation" ? /* @__PURE__ */
|
|
10930
|
-
/* @__PURE__ */
|
|
10931
|
-
/* @__PURE__ */
|
|
10932
|
-
/* @__PURE__ */
|
|
11009
|
+
editing && field2?.type === "relation" ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1.5", "data-records-link-carries": "", children: [
|
|
11010
|
+
/* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5 text-sm", title: "Whoever can see a linked record can also see this one", children: [
|
|
11011
|
+
/* @__PURE__ */ jsx44(Checkbox6, { checked: carries, "aria-label": "Carries access", onCheckedChange: (v) => setCarries(v === true) }),
|
|
11012
|
+
/* @__PURE__ */ jsx44("span", { children: "Whoever sees a linked record sees this one" })
|
|
10933
11013
|
] }),
|
|
10934
|
-
carries ? /* @__PURE__ */
|
|
10935
|
-
/* @__PURE__ */
|
|
10936
|
-
/* @__PURE__ */
|
|
10937
|
-
/* @__PURE__ */
|
|
10938
|
-
/* @__PURE__ */
|
|
11014
|
+
carries ? /* @__PURE__ */ jsxs39(Select6, { value: carriesMax, onValueChange: (next) => setCarriesMax(next === "editor" ? "editor" : "viewer"), children: [
|
|
11015
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", "aria-label": "Carried access level", children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
11016
|
+
/* @__PURE__ */ jsxs39(SelectContent6, { children: [
|
|
11017
|
+
/* @__PURE__ */ jsx44(SelectItem6, { value: "viewer", children: "Up to view" }),
|
|
11018
|
+
/* @__PURE__ */ jsx44(SelectItem6, { value: "editor", children: "Up to edit" })
|
|
10939
11019
|
] })
|
|
10940
11020
|
] }) : null,
|
|
10941
|
-
field2.relation_target && field2.relation_target === field2.entity_definition_id ? /* @__PURE__ */
|
|
10942
|
-
/* @__PURE__ */
|
|
10943
|
-
/* @__PURE__ */
|
|
11021
|
+
field2.relation_target && field2.relation_target === field2.entity_definition_id ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5 text-sm", title: "Two records may point at each other along this link", children: [
|
|
11022
|
+
/* @__PURE__ */ jsx44(Checkbox6, { checked: loops, "aria-label": "Two records can link each other", onCheckedChange: (v) => setLoops(v === true) }),
|
|
11023
|
+
/* @__PURE__ */ jsx44("span", { children: "Two records can link each other" })
|
|
10944
11024
|
] }) : null,
|
|
10945
|
-
carries && loops ? /* @__PURE__ */
|
|
11025
|
+
carries && loops ? /* @__PURE__ */ jsxs39("p", { className: "text-xs text-muted-foreground", "data-records-loop-consequence": "", children: [
|
|
10946
11026
|
"Sharing one record shares the records it links to, and back again, ",
|
|
10947
11027
|
carriesMax === "editor" ? "up to edit" : "view only",
|
|
10948
11028
|
"."
|
|
10949
11029
|
] }) : null
|
|
10950
11030
|
] }) : null,
|
|
10951
|
-
personColumn ? /* @__PURE__ */
|
|
10952
|
-
/* @__PURE__ */
|
|
11031
|
+
personColumn ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5 text-sm", title: "Each person added to this column gets a notice", children: [
|
|
11032
|
+
/* @__PURE__ */ jsx44(
|
|
10953
11033
|
Checkbox6,
|
|
10954
11034
|
{
|
|
10955
11035
|
checked: notify,
|
|
@@ -10959,10 +11039,10 @@ function FieldEditor(props) {
|
|
|
10959
11039
|
onCheckedChange: (v) => setNotify(v === true)
|
|
10960
11040
|
}
|
|
10961
11041
|
),
|
|
10962
|
-
/* @__PURE__ */
|
|
11042
|
+
/* @__PURE__ */ jsx44("span", { children: "Notify people when they're added" })
|
|
10963
11043
|
] }) : null,
|
|
10964
|
-
notifyReadError ? /* @__PURE__ */
|
|
10965
|
-
type === "rollup" ? /* @__PURE__ */
|
|
11044
|
+
notifyReadError ? /* @__PURE__ */ jsx44(RefusalNotice, { error: notifyReadError }) : null,
|
|
11045
|
+
type === "rollup" ? /* @__PURE__ */ jsx44(
|
|
10966
11046
|
RollupFilterQuestion,
|
|
10967
11047
|
{
|
|
10968
11048
|
relation: totalSources.find((f) => f.key === via),
|
|
@@ -10972,11 +11052,11 @@ function FieldEditor(props) {
|
|
|
10972
11052
|
onChange: setRollupFilter
|
|
10973
11053
|
}
|
|
10974
11054
|
) : null,
|
|
10975
|
-
editing && field2 && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */
|
|
10976
|
-
offersAppliesTo ? /* @__PURE__ */
|
|
10977
|
-
/* @__PURE__ */
|
|
10978
|
-
/* @__PURE__ */
|
|
10979
|
-
/* @__PURE__ */
|
|
11055
|
+
editing && field2 && !(type === "select" || type === "multi_select" || type === "status" || type === "autonumber") ? /* @__PURE__ */ jsx44(FieldFormatPicker, { field: field2, value: showsAs, onValue: setShowsAs }) : null,
|
|
11056
|
+
offersAppliesTo ? /* @__PURE__ */ jsx44(AppliesToTypes, { typeField, value: appliesTo, onValue: setAppliesTo }) : null,
|
|
11057
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-4", children: [
|
|
11058
|
+
/* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5", children: [
|
|
11059
|
+
/* @__PURE__ */ jsx44(
|
|
10980
11060
|
Checkbox6,
|
|
10981
11061
|
{
|
|
10982
11062
|
checked: required,
|
|
@@ -10984,10 +11064,10 @@ function FieldEditor(props) {
|
|
|
10984
11064
|
onCheckedChange: (v) => setRequired(v === true)
|
|
10985
11065
|
}
|
|
10986
11066
|
),
|
|
10987
|
-
/* @__PURE__ */
|
|
11067
|
+
/* @__PURE__ */ jsx44("span", { title: "Every record has to have one", children: "Required" })
|
|
10988
11068
|
] }),
|
|
10989
|
-
offersMany ? /* @__PURE__ */
|
|
10990
|
-
/* @__PURE__ */
|
|
11069
|
+
offersMany ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5", children: [
|
|
11070
|
+
/* @__PURE__ */ jsx44(
|
|
10991
11071
|
Checkbox6,
|
|
10992
11072
|
{
|
|
10993
11073
|
checked: multi,
|
|
@@ -10997,8 +11077,8 @@ function FieldEditor(props) {
|
|
|
10997
11077
|
),
|
|
10998
11078
|
"Can hold more than one"
|
|
10999
11079
|
] }) : null,
|
|
11000
|
-
/* @__PURE__ */
|
|
11001
|
-
/* @__PURE__ */
|
|
11080
|
+
/* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5", children: [
|
|
11081
|
+
/* @__PURE__ */ jsx44(
|
|
11002
11082
|
Checkbox6,
|
|
11003
11083
|
{
|
|
11004
11084
|
checked: dated,
|
|
@@ -11008,8 +11088,8 @@ function FieldEditor(props) {
|
|
|
11008
11088
|
),
|
|
11009
11089
|
"Each value has its own date"
|
|
11010
11090
|
] }),
|
|
11011
|
-
!field2 && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */
|
|
11012
|
-
/* @__PURE__ */
|
|
11091
|
+
!field2 && type === "relation" && otherTable.data && otherTable.data.id !== tableId ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5", children: [
|
|
11092
|
+
/* @__PURE__ */ jsx44(
|
|
11013
11093
|
Checkbox6,
|
|
11014
11094
|
{
|
|
11015
11095
|
checked: showOnOther,
|
|
@@ -11021,12 +11101,12 @@ function FieldEditor(props) {
|
|
|
11021
11101
|
"Show on ",
|
|
11022
11102
|
otherTable.data.name ?? "the other table"
|
|
11023
11103
|
] }) : null,
|
|
11024
|
-
!field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */
|
|
11025
|
-
/* @__PURE__ */
|
|
11026
|
-
/* @__PURE__ */
|
|
11104
|
+
!field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5", title: "A timeline draws a line to each record this one waits on", children: [
|
|
11105
|
+
/* @__PURE__ */ jsx44(Checkbox6, { checked: dependency, "aria-label": "Waits on the linked records", "data-records-dependency": "", onCheckedChange: (v) => setDependency(v === true) }),
|
|
11106
|
+
/* @__PURE__ */ jsx44("span", { children: "Waits on the linked records" })
|
|
11027
11107
|
] }) : null,
|
|
11028
|
-
!field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */
|
|
11029
|
-
/* @__PURE__ */
|
|
11108
|
+
!field2 && type === "relation" && relationTarget === tableId ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5", children: [
|
|
11109
|
+
/* @__PURE__ */ jsx44(
|
|
11030
11110
|
Checkbox6,
|
|
11031
11111
|
{
|
|
11032
11112
|
checked: nestsSubItems,
|
|
@@ -11038,10 +11118,10 @@ function FieldEditor(props) {
|
|
|
11038
11118
|
"data-records-sub-items": ""
|
|
11039
11119
|
}
|
|
11040
11120
|
),
|
|
11041
|
-
/* @__PURE__ */
|
|
11121
|
+
/* @__PURE__ */ jsx44("span", { title: "Each record sits under the one this column names", children: "Sub-items" })
|
|
11042
11122
|
] }) : null,
|
|
11043
|
-
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */
|
|
11044
|
-
/* @__PURE__ */
|
|
11123
|
+
CHOICE_EDITOR_ADDS_WHAT_IS_TYPED && (type === "select" || type === "multi_select") ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5", children: [
|
|
11124
|
+
/* @__PURE__ */ jsx44(
|
|
11045
11125
|
Checkbox6,
|
|
11046
11126
|
{
|
|
11047
11127
|
checked: allowOther,
|
|
@@ -11052,10 +11132,10 @@ function FieldEditor(props) {
|
|
|
11052
11132
|
"A value that is not one of the choices is added to them"
|
|
11053
11133
|
] }) : null
|
|
11054
11134
|
] }),
|
|
11055
|
-
!editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */
|
|
11056
|
-
editing && field2 && takesADefault(liveField ?? field2) ? /* @__PURE__ */
|
|
11057
|
-
/* @__PURE__ */
|
|
11058
|
-
/* @__PURE__ */
|
|
11135
|
+
!editing && !onEntity && newColumnTakesADefault(type) ? /* @__PURE__ */ jsx44(NewColumnDefault, { type, choices: options, value: startsWith, onChange: setStartsWith }) : null,
|
|
11136
|
+
editing && field2 && takesADefault(liveField ?? field2) ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", "data-records-field-default": "", children: [
|
|
11137
|
+
/* @__PURE__ */ jsx44(Label11, { htmlFor: "records-field-default", className: "text-xs", children: DEFAULT_LABEL }),
|
|
11138
|
+
/* @__PURE__ */ jsx44(
|
|
11059
11139
|
FieldControl,
|
|
11060
11140
|
{
|
|
11061
11141
|
id: "records-field-default",
|
|
@@ -11065,28 +11145,28 @@ function FieldEditor(props) {
|
|
|
11065
11145
|
}
|
|
11066
11146
|
)
|
|
11067
11147
|
] }) : null,
|
|
11068
|
-
/* @__PURE__ */
|
|
11069
|
-
/* @__PURE__ */
|
|
11070
|
-
/* @__PURE__ */
|
|
11071
|
-
/* @__PURE__ */
|
|
11072
|
-
/* @__PURE__ */
|
|
11073
|
-
/* @__PURE__ */
|
|
11074
|
-
/* @__PURE__ */
|
|
11148
|
+
/* @__PURE__ */ jsx44(Separator3, {}),
|
|
11149
|
+
/* @__PURE__ */ jsxs39("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
11150
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11151
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "Who can see what is in it" }),
|
|
11152
|
+
/* @__PURE__ */ jsxs39(Select6, { value: sensitivity, onValueChange: setSensitivity, children: [
|
|
11153
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", "aria-label": "Who can see what is in it", children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
11154
|
+
/* @__PURE__ */ jsx44(SelectContent6, { children: sensitivities.map((row) => /* @__PURE__ */ jsx44(SelectItem6, { value: row.value, children: row.label }, row.value)) })
|
|
11075
11155
|
] })
|
|
11076
11156
|
] }),
|
|
11077
|
-
/* @__PURE__ */
|
|
11078
|
-
/* @__PURE__ */
|
|
11079
|
-
/* @__PURE__ */
|
|
11080
|
-
/* @__PURE__ */
|
|
11081
|
-
/* @__PURE__ */
|
|
11157
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11158
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "Can an assistant read it" }),
|
|
11159
|
+
/* @__PURE__ */ jsxs39(Select6, { value: contextPolicy, onValueChange: setContextPolicy, children: [
|
|
11160
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", "aria-label": "Can an assistant read it", children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
11161
|
+
/* @__PURE__ */ jsx44(SelectContent6, { children: AGENT_VISIBILITY.map((row) => /* @__PURE__ */ jsx44(SelectItem6, { value: row.value, children: row.label }, row.value)) })
|
|
11082
11162
|
] })
|
|
11083
11163
|
] })
|
|
11084
11164
|
] }),
|
|
11085
|
-
/* @__PURE__ */
|
|
11086
|
-
/* @__PURE__ */
|
|
11087
|
-
/* @__PURE__ */
|
|
11088
|
-
/* @__PURE__ */
|
|
11089
|
-
/* @__PURE__ */
|
|
11165
|
+
/* @__PURE__ */ jsx44(Separator3, {}),
|
|
11166
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-2", children: [
|
|
11167
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-2", children: [
|
|
11168
|
+
/* @__PURE__ */ jsx44("span", { className: "font-medium", children: "What counts as a good value" }),
|
|
11169
|
+
/* @__PURE__ */ jsx44(
|
|
11090
11170
|
Button19,
|
|
11091
11171
|
{
|
|
11092
11172
|
type: "button",
|
|
@@ -11098,8 +11178,8 @@ function FieldEditor(props) {
|
|
|
11098
11178
|
}
|
|
11099
11179
|
)
|
|
11100
11180
|
] }),
|
|
11101
|
-
canBeUnique(type, multi) || rules.some((r) => r.kind === "unique") ? /* @__PURE__ */
|
|
11102
|
-
/* @__PURE__ */
|
|
11181
|
+
canBeUnique(type, multi) || rules.some((r) => r.kind === "unique") ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5", "data-records-field-unique": "", children: [
|
|
11182
|
+
/* @__PURE__ */ jsx44(
|
|
11103
11183
|
Checkbox6,
|
|
11104
11184
|
{
|
|
11105
11185
|
checked: rules.some((r) => r.kind === "unique"),
|
|
@@ -11109,20 +11189,20 @@ function FieldEditor(props) {
|
|
|
11109
11189
|
),
|
|
11110
11190
|
UNIQUE_LABEL
|
|
11111
11191
|
] }) : null,
|
|
11112
|
-
rules.length === 0 ? /* @__PURE__ */
|
|
11113
|
-
rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */
|
|
11114
|
-
/* @__PURE__ */
|
|
11115
|
-
|
|
11192
|
+
rules.length === 0 ? /* @__PURE__ */ jsx44("p", { className: "text-muted-foreground", children: "No checks." }) : null,
|
|
11193
|
+
rules.map((rule, index) => rule.kind === "unique" ? null : /* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-1", children: [
|
|
11194
|
+
/* @__PURE__ */ jsxs39(
|
|
11195
|
+
Select6,
|
|
11116
11196
|
{
|
|
11117
11197
|
value: rule.kind,
|
|
11118
11198
|
onValueChange: (kind) => setRules(rules.map((r, i) => i === index ? { ...r, kind } : r)),
|
|
11119
11199
|
children: [
|
|
11120
|
-
/* @__PURE__ */
|
|
11121
|
-
/* @__PURE__ */
|
|
11200
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", className: "w-52", "aria-label": `Check ${index + 1}`, children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
11201
|
+
/* @__PURE__ */ jsx44(SelectContent6, { children: RULE_KINDS.map((row) => /* @__PURE__ */ jsx44(SelectItem6, { value: row.kind, children: row.label }, row.kind)) })
|
|
11122
11202
|
]
|
|
11123
11203
|
}
|
|
11124
11204
|
),
|
|
11125
|
-
rule.kind === "length" ? /* @__PURE__ */
|
|
11205
|
+
rule.kind === "length" ? /* @__PURE__ */ jsx44(
|
|
11126
11206
|
BasicInput8,
|
|
11127
11207
|
{
|
|
11128
11208
|
className: "h-8 w-24",
|
|
@@ -11133,7 +11213,7 @@ function FieldEditor(props) {
|
|
|
11133
11213
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? withNumber(r, "min", e.target.value) : r))
|
|
11134
11214
|
}
|
|
11135
11215
|
) : null,
|
|
11136
|
-
/* @__PURE__ */
|
|
11216
|
+
/* @__PURE__ */ jsx44(
|
|
11137
11217
|
BasicInput8,
|
|
11138
11218
|
{
|
|
11139
11219
|
className: "h-8",
|
|
@@ -11143,7 +11223,7 @@ function FieldEditor(props) {
|
|
|
11143
11223
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? { ...r, value: e.target.value } : r))
|
|
11144
11224
|
}
|
|
11145
11225
|
),
|
|
11146
|
-
rule.kind === "pattern" ? /* @__PURE__ */
|
|
11226
|
+
rule.kind === "pattern" ? /* @__PURE__ */ jsx44(
|
|
11147
11227
|
BasicInput8,
|
|
11148
11228
|
{
|
|
11149
11229
|
className: "h-8",
|
|
@@ -11153,7 +11233,7 @@ function FieldEditor(props) {
|
|
|
11153
11233
|
onChange: (e) => setRules(rules.map((r, i) => i === index ? withText(r, "example", e.target.value) : r))
|
|
11154
11234
|
}
|
|
11155
11235
|
) : null,
|
|
11156
|
-
/* @__PURE__ */
|
|
11236
|
+
/* @__PURE__ */ jsx44(
|
|
11157
11237
|
Button19,
|
|
11158
11238
|
{
|
|
11159
11239
|
type: "button",
|
|
@@ -11166,9 +11246,9 @@ function FieldEditor(props) {
|
|
|
11166
11246
|
)
|
|
11167
11247
|
] }, `${rule.kind}-${index}`))
|
|
11168
11248
|
] }),
|
|
11169
|
-
editing && field2 && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */
|
|
11170
|
-
mutation.error ? /* @__PURE__ */
|
|
11171
|
-
notLanded ? /* @__PURE__ */
|
|
11249
|
+
editing && field2 && !onEntity && rulesChanged(savedRules, editedRules) ? /* @__PURE__ */ jsx44(FieldRulePreview, { field: field2, tableId, rules: editedRules }) : null,
|
|
11250
|
+
mutation.error ? /* @__PURE__ */ jsx44(RefusalNotice, { error: mutation.error }) : null,
|
|
11251
|
+
notLanded ? /* @__PURE__ */ jsx44(
|
|
11172
11252
|
RefusalNotice,
|
|
11173
11253
|
{
|
|
11174
11254
|
error: (0, refusals_exports.refusal)(
|
|
@@ -11178,10 +11258,10 @@ function FieldEditor(props) {
|
|
|
11178
11258
|
)
|
|
11179
11259
|
}
|
|
11180
11260
|
) : null,
|
|
11181
|
-
rehomeRefused ? /* @__PURE__ */
|
|
11182
|
-
rehomed ? /* @__PURE__ */
|
|
11183
|
-
/* @__PURE__ */
|
|
11184
|
-
rehomed.undo ? /* @__PURE__ */
|
|
11261
|
+
rehomeRefused ? /* @__PURE__ */ jsx44(RefusalNotice, { error: rehomeRefused }) : null,
|
|
11262
|
+
rehomed ? /* @__PURE__ */ jsxs39("div", { "data-records-choice-rehomed": "", className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
11263
|
+
/* @__PURE__ */ jsx44("span", { children: rehomed.said }),
|
|
11264
|
+
rehomed.undo ? /* @__PURE__ */ jsx44(
|
|
11185
11265
|
Button19,
|
|
11186
11266
|
{
|
|
11187
11267
|
type: "button",
|
|
@@ -11206,18 +11286,18 @@ function FieldEditor(props) {
|
|
|
11206
11286
|
children: "Undo"
|
|
11207
11287
|
}
|
|
11208
11288
|
) : null,
|
|
11209
|
-
/* @__PURE__ */
|
|
11289
|
+
/* @__PURE__ */ jsx44(Button19, { type: "button", size: "sm", className: "h-6 px-2 text-xs", onClick: () => onSaved?.(), children: "Done" })
|
|
11210
11290
|
] }) : null,
|
|
11211
|
-
reverseRefused ? /* @__PURE__ */
|
|
11212
|
-
/* @__PURE__ */
|
|
11213
|
-
/* @__PURE__ */
|
|
11291
|
+
reverseRefused ? /* @__PURE__ */ jsxs39("div", { "data-records-reverse-field-refused": "", className: "flex flex-col gap-1", children: [
|
|
11292
|
+
/* @__PURE__ */ jsx44("p", { className: "text-[11px]", children: "The link is made. Its column on the other table was not:" }),
|
|
11293
|
+
/* @__PURE__ */ jsx44(RefusalNotice, { error: reverseRefused })
|
|
11214
11294
|
] }) : null,
|
|
11215
|
-
backfillError ? /* @__PURE__ */
|
|
11216
|
-
/* @__PURE__ */
|
|
11217
|
-
/* @__PURE__ */
|
|
11295
|
+
backfillError ? /* @__PURE__ */ jsxs39("div", { "data-records-autonumber-backfill-refused": "", className: "flex flex-col gap-1", children: [
|
|
11296
|
+
/* @__PURE__ */ jsx44("p", { className: "text-[11px]", children: "The column is made. The records already in the table were not numbered:" }),
|
|
11297
|
+
/* @__PURE__ */ jsx44(RefusalNotice, { error: backfillError })
|
|
11218
11298
|
] }) : null,
|
|
11219
|
-
/* @__PURE__ */
|
|
11220
|
-
/* @__PURE__ */
|
|
11299
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex min-w-0 flex-nowrap items-center gap-2", "data-field-editor-footer": "", children: [
|
|
11300
|
+
/* @__PURE__ */ jsx44(
|
|
11221
11301
|
Button19,
|
|
11222
11302
|
{
|
|
11223
11303
|
size: "sm",
|
|
@@ -11233,8 +11313,8 @@ function FieldEditor(props) {
|
|
|
11233
11313
|
children: mutation.saving ? "Saving\u2026" : field2 ? EDIT_FIELD_SAVE_LABEL : onEntity ? ADD_STANDARD_FIELD_SAVE_LABEL : ADD_FIELD_SAVE_LABEL
|
|
11234
11314
|
}
|
|
11235
11315
|
),
|
|
11236
|
-
onCancel ? /* @__PURE__ */
|
|
11237
|
-
/* @__PURE__ */
|
|
11316
|
+
onCancel ? /* @__PURE__ */ jsx44(Button19, { size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null,
|
|
11317
|
+
/* @__PURE__ */ jsx44(
|
|
11238
11318
|
"span",
|
|
11239
11319
|
{
|
|
11240
11320
|
id: "field-editor-missing",
|
|
@@ -11250,11 +11330,11 @@ function FieldEditor(props) {
|
|
|
11250
11330
|
footer is always as wide and as tall as its larger state: opening the confirm moved
|
|
11251
11331
|
the dialog card 0.2278 and closing it 0.1303. The consequence is the tooltip of
|
|
11252
11332
|
"Remove it" (interface-text: the slot holds a label, never a paragraph). */
|
|
11253
|
-
/* @__PURE__ */
|
|
11254
|
-
/* @__PURE__ */
|
|
11255
|
-
/* @__PURE__ */
|
|
11256
|
-
/* @__PURE__ */
|
|
11257
|
-
/* @__PURE__ */
|
|
11333
|
+
/* @__PURE__ */ jsxs39("div", { className: "ml-auto grid shrink-0 items-center", "data-field-editor-remove": askingToRemove ? "asking" : "idle", children: [
|
|
11334
|
+
/* @__PURE__ */ jsx44("div", { className: cn20("col-start-1 row-start-1 flex items-center justify-end gap-2", askingToRemove && "invisible"), "aria-hidden": askingToRemove || void 0, children: /* @__PURE__ */ jsx44(Button19, { size: "sm", variant: "outline", tabIndex: askingToRemove ? -1 : void 0, onClick: () => setAskingToRemove(true), children: "Remove this field" }) }),
|
|
11335
|
+
/* @__PURE__ */ jsxs39("div", { className: cn20("col-start-1 row-start-1 flex items-center justify-end gap-2", !askingToRemove && "invisible"), "aria-hidden": !askingToRemove || void 0, children: [
|
|
11336
|
+
/* @__PURE__ */ jsx44("span", { className: "whitespace-nowrap text-destructive", "data-field-editor-remove-ask": "", children: "Archive this field?" }),
|
|
11337
|
+
/* @__PURE__ */ jsx44(
|
|
11258
11338
|
Button19,
|
|
11259
11339
|
{
|
|
11260
11340
|
size: "sm",
|
|
@@ -11267,7 +11347,7 @@ function FieldEditor(props) {
|
|
|
11267
11347
|
children: "Remove it"
|
|
11268
11348
|
}
|
|
11269
11349
|
),
|
|
11270
|
-
/* @__PURE__ */
|
|
11350
|
+
/* @__PURE__ */ jsx44(Button19, { size: "sm", variant: "ghost", tabIndex: askingToRemove ? void 0 : -1, onClick: () => setAskingToRemove(false), children: "Keep it" })
|
|
11271
11351
|
] })
|
|
11272
11352
|
] })
|
|
11273
11353
|
) : null
|
|
@@ -11358,10 +11438,10 @@ function formulaSeparatorOf(field2) {
|
|
|
11358
11438
|
function TypeQuestions(props) {
|
|
11359
11439
|
const { type } = props;
|
|
11360
11440
|
if (type === "entity_reference") {
|
|
11361
|
-
return /* @__PURE__ */
|
|
11441
|
+
return /* @__PURE__ */ jsx44(EntityReferenceKindPicker, { value: props.allowedTypes, onChange: props.setAllowedTypes, locked: props.editing });
|
|
11362
11442
|
}
|
|
11363
11443
|
if (type === "relation") {
|
|
11364
|
-
return /* @__PURE__ */
|
|
11444
|
+
return /* @__PURE__ */ jsx44(
|
|
11365
11445
|
ReferenceBuilder,
|
|
11366
11446
|
{
|
|
11367
11447
|
tableId: props.tableId,
|
|
@@ -11374,20 +11454,20 @@ function TypeQuestions(props) {
|
|
|
11374
11454
|
}
|
|
11375
11455
|
);
|
|
11376
11456
|
}
|
|
11377
|
-
if (type === "rating" || type === "barcode") return /* @__PURE__ */
|
|
11457
|
+
if (type === "rating" || type === "barcode") return /* @__PURE__ */ jsx44(Fragment13, { children: props.newer });
|
|
11378
11458
|
if (type === "status") {
|
|
11379
|
-
return /* @__PURE__ */
|
|
11459
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-3", children: [
|
|
11380
11460
|
props.choiceList,
|
|
11381
11461
|
props.newer
|
|
11382
11462
|
] });
|
|
11383
11463
|
}
|
|
11384
11464
|
if (type === "select" || type === "multi_select") {
|
|
11385
|
-
return /* @__PURE__ */
|
|
11465
|
+
return /* @__PURE__ */ jsx44(Fragment13, { children: props.choiceList });
|
|
11386
11466
|
}
|
|
11387
11467
|
if (type === "currency") {
|
|
11388
|
-
return /* @__PURE__ */
|
|
11389
|
-
/* @__PURE__ */
|
|
11390
|
-
/* @__PURE__ */
|
|
11468
|
+
return /* @__PURE__ */ jsxs39("label", { className: "flex max-w-[16rem] flex-col gap-1", children: [
|
|
11469
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "The currency" }),
|
|
11470
|
+
/* @__PURE__ */ jsx44(
|
|
11391
11471
|
BasicInput8,
|
|
11392
11472
|
{
|
|
11393
11473
|
value: props.unit,
|
|
@@ -11399,8 +11479,8 @@ function TypeQuestions(props) {
|
|
|
11399
11479
|
] });
|
|
11400
11480
|
}
|
|
11401
11481
|
if (type === "datetime") {
|
|
11402
|
-
return /* @__PURE__ */
|
|
11403
|
-
/* @__PURE__ */
|
|
11482
|
+
return /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-1.5", children: [
|
|
11483
|
+
/* @__PURE__ */ jsx44(
|
|
11404
11484
|
Checkbox6,
|
|
11405
11485
|
{
|
|
11406
11486
|
checked: props.withTime,
|
|
@@ -11414,14 +11494,14 @@ function TypeQuestions(props) {
|
|
|
11414
11494
|
if (type === "lookup" || type === "rollup" || type === "count") {
|
|
11415
11495
|
const usable = props.relations;
|
|
11416
11496
|
if (usable.length === 0) {
|
|
11417
|
-
return /* @__PURE__ */
|
|
11418
|
-
}
|
|
11419
|
-
return /* @__PURE__ */
|
|
11420
|
-
/* @__PURE__ */
|
|
11421
|
-
/* @__PURE__ */
|
|
11422
|
-
/* @__PURE__ */
|
|
11423
|
-
/* @__PURE__ */
|
|
11424
|
-
/* @__PURE__ */
|
|
11497
|
+
return /* @__PURE__ */ jsx44("p", { className: "text-[11px] text-muted-foreground", children: "No link, Person or File column yet." });
|
|
11498
|
+
}
|
|
11499
|
+
return /* @__PURE__ */ jsxs39("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
11500
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11501
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: type !== "lookup" ? "Across the records in" : "Read it from" }),
|
|
11502
|
+
/* @__PURE__ */ jsxs39(Select6, { value: props.via, onValueChange: props.setVia, children: [
|
|
11503
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", "aria-label": type !== "lookup" ? "Across the records in" : "Read it from", children: /* @__PURE__ */ jsx44(SelectValue6, { placeholder: "Choose a column" }) }),
|
|
11504
|
+
/* @__PURE__ */ jsx44(SelectContent6, { children: usable.map((f) => /* @__PURE__ */ jsxs39(SelectItem6, { value: f.key, children: [
|
|
11425
11505
|
fieldName(f),
|
|
11426
11506
|
isBackLinkSource(f) ? BACK_LINK_SOURCE_SUFFIX : "",
|
|
11427
11507
|
sourceKindOf(f) === "person" ? " \u2014 a person" : sourceKindOf(f) === "file" ? " \u2014 a file" : "",
|
|
@@ -11429,7 +11509,7 @@ function TypeQuestions(props) {
|
|
|
11429
11509
|
] }, f.id)) })
|
|
11430
11510
|
] })
|
|
11431
11511
|
] }),
|
|
11432
|
-
type === "lookup" ? /* @__PURE__ */
|
|
11512
|
+
type === "lookup" ? /* @__PURE__ */ jsx44(
|
|
11433
11513
|
ValueOnTheOtherSide,
|
|
11434
11514
|
{
|
|
11435
11515
|
label: "The value to read",
|
|
@@ -11438,13 +11518,13 @@ function TypeQuestions(props) {
|
|
|
11438
11518
|
value: props.pick,
|
|
11439
11519
|
onChange: props.setPick
|
|
11440
11520
|
}
|
|
11441
|
-
) : type === "count" ? null : /* @__PURE__ */
|
|
11442
|
-
/* @__PURE__ */
|
|
11443
|
-
/* @__PURE__ */
|
|
11444
|
-
/* @__PURE__ */
|
|
11445
|
-
/* @__PURE__ */
|
|
11521
|
+
) : type === "count" ? null : /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11522
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "What to work out" }),
|
|
11523
|
+
/* @__PURE__ */ jsxs39(Select6, { value: props.agg, onValueChange: (v) => props.setAgg(v), children: [
|
|
11524
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", "aria-label": "What to work out", children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
11525
|
+
/* @__PURE__ */ jsx44(SelectContent6, { children: ROLLUP_OPERATIONS.map((row) => /* @__PURE__ */ jsx44(SelectItem6, { value: row.value, children: row.label }, row.value)) })
|
|
11446
11526
|
] }),
|
|
11447
|
-
props.agg !== "count" ? /* @__PURE__ */
|
|
11527
|
+
props.agg !== "count" ? /* @__PURE__ */ jsx44(
|
|
11448
11528
|
ValueOnTheOtherSide,
|
|
11449
11529
|
{
|
|
11450
11530
|
label: "Of which value",
|
|
@@ -11460,21 +11540,21 @@ function TypeQuestions(props) {
|
|
|
11460
11540
|
}
|
|
11461
11541
|
if (type === "formula") {
|
|
11462
11542
|
if (props.others.length === 0) {
|
|
11463
|
-
return /* @__PURE__ */
|
|
11464
|
-
}
|
|
11465
|
-
return /* @__PURE__ */
|
|
11466
|
-
/* @__PURE__ */
|
|
11467
|
-
/* @__PURE__ */
|
|
11468
|
-
/* @__PURE__ */
|
|
11469
|
-
/* @__PURE__ */
|
|
11470
|
-
/* @__PURE__ */
|
|
11543
|
+
return /* @__PURE__ */ jsx44("p", { className: "text-[11px] text-muted-foreground", children: "No other columns yet." });
|
|
11544
|
+
}
|
|
11545
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-2", children: [
|
|
11546
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11547
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "What to do" }),
|
|
11548
|
+
/* @__PURE__ */ jsxs39(Select6, { value: props.formulaOp, onValueChange: props.setFormulaOp, children: [
|
|
11549
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", className: "max-w-[18rem]", "aria-label": "What to do", children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
11550
|
+
/* @__PURE__ */ jsx44(SelectContent6, { children: FORMULA_OPERATIONS.map((row) => /* @__PURE__ */ jsx44(SelectItem6, { value: row.value, children: row.label }, row.value)) })
|
|
11471
11551
|
] })
|
|
11472
11552
|
] }),
|
|
11473
|
-
/* @__PURE__ */
|
|
11474
|
-
/* @__PURE__ */
|
|
11475
|
-
/* @__PURE__ */
|
|
11553
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11554
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: "Which columns" }),
|
|
11555
|
+
/* @__PURE__ */ jsx44("div", { className: "flex flex-wrap gap-1", children: props.others.map((f) => {
|
|
11476
11556
|
const picked = props.formulaFields.includes(f.id);
|
|
11477
|
-
return /* @__PURE__ */
|
|
11557
|
+
return /* @__PURE__ */ jsx44(
|
|
11478
11558
|
Button19,
|
|
11479
11559
|
{
|
|
11480
11560
|
type: "button",
|
|
@@ -11489,9 +11569,9 @@ function TypeQuestions(props) {
|
|
|
11489
11569
|
);
|
|
11490
11570
|
}) })
|
|
11491
11571
|
] }),
|
|
11492
|
-
props.formulaOp === "concat" ? /* @__PURE__ */
|
|
11493
|
-
/* @__PURE__ */
|
|
11494
|
-
/* @__PURE__ */
|
|
11572
|
+
props.formulaOp === "concat" ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11573
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", children: FORMULA_SEPARATOR_LABEL }),
|
|
11574
|
+
/* @__PURE__ */ jsx44(
|
|
11495
11575
|
BasicInput8,
|
|
11496
11576
|
{
|
|
11497
11577
|
value: props.formulaSeparator,
|
|
@@ -11552,15 +11632,15 @@ function RollupFilterQuestion({
|
|
|
11552
11632
|
lastFar.current = far;
|
|
11553
11633
|
}, [far, editing, onChange]);
|
|
11554
11634
|
if (!relation || !far) return null;
|
|
11555
|
-
return /* @__PURE__ */
|
|
11556
|
-
/* @__PURE__ */
|
|
11635
|
+
return /* @__PURE__ */ jsx44("div", { className: "flex flex-col gap-1", "data-records-rollup-filter": "", children: !conditionIsDrawable(value) ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-2 text-[11px]", children: [
|
|
11636
|
+
/* @__PURE__ */ jsxs39("span", { className: "text-muted-foreground", children: [
|
|
11557
11637
|
rollupFilterLead(agg),
|
|
11558
11638
|
" ",
|
|
11559
11639
|
conditionInWords(value, conditionFields),
|
|
11560
11640
|
"."
|
|
11561
11641
|
] }),
|
|
11562
|
-
/* @__PURE__ */
|
|
11563
|
-
] }) : /* @__PURE__ */
|
|
11642
|
+
/* @__PURE__ */ jsx44(Button19, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onChange(null), children: "Clear" })
|
|
11643
|
+
] }) : /* @__PURE__ */ jsx44(ChoiceListTermsContext.Provider, { value: true, children: /* @__PURE__ */ jsx44(
|
|
11564
11644
|
ConditionGroup,
|
|
11565
11645
|
{
|
|
11566
11646
|
lead: rollupFilterLead(agg),
|
|
@@ -11586,13 +11666,13 @@ function ValueOnTheOtherSide({
|
|
|
11586
11666
|
const carried = sample.data?.rows[0]?.document ?? null;
|
|
11587
11667
|
const offered = declared.length > 0 ? declared.map((f) => ({ key: f.key, name: fieldName(f) })) : Object.keys(carried ?? {}).map((key) => ({ key, name: humanizeIdentifier4(key) }));
|
|
11588
11668
|
const stillAsking = columns.loading || declared.length === 0 && sample.loading;
|
|
11589
|
-
const body = !relation ? /* @__PURE__ */
|
|
11590
|
-
/* @__PURE__ */
|
|
11591
|
-
/* @__PURE__ */
|
|
11669
|
+
const body = !relation ? /* @__PURE__ */ jsx44("p", { className: "text-[11px] text-muted-foreground", children: "Choose the column above first." }) : stillAsking ? /* @__PURE__ */ jsx44("p", { className: "text-[11px] text-muted-foreground", children: "Reading that table's columns\u2026" }) : offered.length === 0 ? /* @__PURE__ */ jsx44("p", { className: "text-[11px] text-muted-foreground", children: "No columns to read yet." }) : /* @__PURE__ */ jsxs39(Select6, { value, onValueChange: onChange, children: [
|
|
11670
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { size: "sm", "aria-label": label, children: /* @__PURE__ */ jsx44(SelectValue6, { placeholder: "Choose a column" }) }),
|
|
11671
|
+
/* @__PURE__ */ jsx44(SelectContent6, { children: offered.map((column) => /* @__PURE__ */ jsx44(SelectItem6, { value: column.key, children: column.name }, column.key)) })
|
|
11592
11672
|
] });
|
|
11593
|
-
if (compact) return /* @__PURE__ */
|
|
11594
|
-
return /* @__PURE__ */
|
|
11595
|
-
/* @__PURE__ */
|
|
11673
|
+
if (compact) return /* @__PURE__ */ jsx44("div", { className: "mt-1 flex flex-col gap-1", children: body });
|
|
11674
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", children: [
|
|
11675
|
+
/* @__PURE__ */ jsx44(Label11, { className: "text-xs", title: help, children: label }),
|
|
11596
11676
|
body
|
|
11597
11677
|
] });
|
|
11598
11678
|
}
|
|
@@ -11618,18 +11698,18 @@ function NewColumnDefault({
|
|
|
11618
11698
|
onChange
|
|
11619
11699
|
}) {
|
|
11620
11700
|
const none = "__none__";
|
|
11621
|
-
return /* @__PURE__ */
|
|
11622
|
-
/* @__PURE__ */
|
|
11623
|
-
type === "checkbox" ? /* @__PURE__ */
|
|
11624
|
-
/* @__PURE__ */
|
|
11625
|
-
/* @__PURE__ */
|
|
11626
|
-
] }) : type === "select" || type === "multi_select" || type === "status" ? /* @__PURE__ */
|
|
11627
|
-
/* @__PURE__ */
|
|
11628
|
-
/* @__PURE__ */
|
|
11629
|
-
/* @__PURE__ */
|
|
11630
|
-
choices.map((c) => /* @__PURE__ */
|
|
11701
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex flex-col gap-1", "data-records-field-default": "", "data-records-new-field-default": "", children: [
|
|
11702
|
+
/* @__PURE__ */ jsx44(Label11, { htmlFor: "records-new-field-default", className: "text-xs", children: DEFAULT_LABEL }),
|
|
11703
|
+
type === "checkbox" ? /* @__PURE__ */ jsxs39("label", { className: "flex items-center gap-2", children: [
|
|
11704
|
+
/* @__PURE__ */ jsx44(Checkbox6, { id: "records-new-field-default", "aria-label": DEFAULT_LABEL, checked: value === true, onCheckedChange: (on) => onChange(on === true ? true : null) }),
|
|
11705
|
+
/* @__PURE__ */ jsx44("span", { children: "Ticked" })
|
|
11706
|
+
] }) : type === "select" || type === "multi_select" || type === "status" ? /* @__PURE__ */ jsxs39(Select6, { value: typeof value === "string" && choices.includes(value) ? value : none, onValueChange: (v) => onChange(v === none ? null : v), children: [
|
|
11707
|
+
/* @__PURE__ */ jsx44(SelectTrigger6, { id: "records-new-field-default", size: "sm", "aria-label": DEFAULT_LABEL, children: /* @__PURE__ */ jsx44(SelectValue6, {}) }),
|
|
11708
|
+
/* @__PURE__ */ jsxs39(SelectContent6, { children: [
|
|
11709
|
+
/* @__PURE__ */ jsx44(SelectItem6, { value: none, children: "Nothing" }),
|
|
11710
|
+
choices.map((c) => /* @__PURE__ */ jsx44(SelectItem6, { value: c, children: c }, c))
|
|
11631
11711
|
] })
|
|
11632
|
-
] }) : /* @__PURE__ */
|
|
11712
|
+
] }) : /* @__PURE__ */ jsx44(
|
|
11633
11713
|
BasicInput8,
|
|
11634
11714
|
{
|
|
11635
11715
|
id: "records-new-field-default",
|
|
@@ -11644,7 +11724,7 @@ function NewColumnDefault({
|
|
|
11644
11724
|
// src/buttonCell.tsx
|
|
11645
11725
|
import { OutboundLink as OutboundLink7 } from "@ai-matrx/kit/outbound-react";
|
|
11646
11726
|
import { openOutbound as openOutbound2 } from "@ai-matrx/kit/outbound";
|
|
11647
|
-
import { Fragment as Fragment14, jsx as
|
|
11727
|
+
import { Fragment as Fragment14, jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
11648
11728
|
function buttonPressWords(label, pressed) {
|
|
11649
11729
|
if (pressed.do === "open_url") return `${label} opened ${readableLink(pressed.url)}`;
|
|
11650
11730
|
if (pressed.do === "add_row") return `${label}: a row was added.`;
|
|
@@ -11707,10 +11787,10 @@ var stop2 = (event) => event.stopPropagation();
|
|
|
11707
11787
|
function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
|
|
11708
11788
|
const client = useOptionalRecordsClient11();
|
|
11709
11789
|
const b = buttonOf2(field2);
|
|
11710
|
-
const [busy, setBusy] =
|
|
11711
|
-
const [said2, setSaid] =
|
|
11712
|
-
const [settingUp, setSettingUp] =
|
|
11713
|
-
const [opening, setOpening] =
|
|
11790
|
+
const [busy, setBusy] = useState34(false);
|
|
11791
|
+
const [said2, setSaid] = useState34(null);
|
|
11792
|
+
const [settingUp, setSettingUp] = useState34(false);
|
|
11793
|
+
const [opening, setOpening] = useState34(false);
|
|
11714
11794
|
const here = useContext4(OpenRecordHereContext);
|
|
11715
11795
|
const host = useRecordsUi();
|
|
11716
11796
|
const addsTo = useTable4(b?.do === "add_row" ? b.table_id ?? field2.entity_definition_id : null);
|
|
@@ -11719,9 +11799,9 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
|
|
|
11719
11799
|
if (!b) return null;
|
|
11720
11800
|
const color = isStyleColor(b.color) ? CHOICE_CHIP_CLASS[b.color] : NEUTRAL_CHIP_CLASS;
|
|
11721
11801
|
if (beforeSave) {
|
|
11722
|
-
return /* @__PURE__ */
|
|
11723
|
-
/* @__PURE__ */
|
|
11724
|
-
/* @__PURE__ */
|
|
11802
|
+
return /* @__PURE__ */ jsxs40("span", { className: "inline-flex min-w-0 items-center gap-2", "data-records-button-before-save": field2.key, children: [
|
|
11803
|
+
/* @__PURE__ */ jsx45(Button20, { type: "button", size: "xs", variant: "outline", disabled: true, "aria-describedby": `${field2.key}-before-save`, "data-records-button": field2.key, className: cn21("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color), children: /* @__PURE__ */ jsx45("span", { className: "truncate", children: b.label }) }),
|
|
11804
|
+
/* @__PURE__ */ jsx45("span", { id: `${field2.key}-before-save`, className: "whitespace-nowrap text-xs text-muted-foreground", children: "Save the record first" })
|
|
11725
11805
|
] });
|
|
11726
11806
|
}
|
|
11727
11807
|
const needs = buttonNeeds2(b);
|
|
@@ -11817,8 +11897,8 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
|
|
|
11817
11897
|
}
|
|
11818
11898
|
setSaid({ kind: "ran", says: words });
|
|
11819
11899
|
};
|
|
11820
|
-
return /* @__PURE__ */
|
|
11821
|
-
/* @__PURE__ */
|
|
11900
|
+
return /* @__PURE__ */ jsxs40(Fragment14, { children: [
|
|
11901
|
+
/* @__PURE__ */ jsxs40(
|
|
11822
11902
|
Popover4,
|
|
11823
11903
|
{
|
|
11824
11904
|
open: said2 !== null,
|
|
@@ -11829,7 +11909,7 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
|
|
|
11829
11909
|
setSaid(null);
|
|
11830
11910
|
},
|
|
11831
11911
|
children: [
|
|
11832
|
-
/* @__PURE__ */
|
|
11912
|
+
/* @__PURE__ */ jsx45(PopoverTrigger4, { asChild: true, children: /* @__PURE__ */ jsx45(
|
|
11833
11913
|
Button20,
|
|
11834
11914
|
{
|
|
11835
11915
|
type: "button",
|
|
@@ -11848,23 +11928,23 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
|
|
|
11848
11928
|
event.preventDefault();
|
|
11849
11929
|
void press();
|
|
11850
11930
|
},
|
|
11851
|
-
children: /* @__PURE__ */
|
|
11931
|
+
children: /* @__PURE__ */ jsx45("span", { className: cn21("truncate", (busy || opening) && "matrx-shimmer"), children: b.label })
|
|
11852
11932
|
}
|
|
11853
11933
|
) }),
|
|
11854
|
-
/* @__PURE__ */
|
|
11855
|
-
said2?.kind === "refused" ? /* @__PURE__ */
|
|
11856
|
-
said2?.kind === "waiting" ? /* @__PURE__ */
|
|
11857
|
-
said2?.kind === "failed" ? /* @__PURE__ */
|
|
11858
|
-
said2?.kind === "public" ? /* @__PURE__ */
|
|
11859
|
-
said2?.kind === "ran" ? /* @__PURE__ */
|
|
11860
|
-
said2.value ? /* @__PURE__ */
|
|
11934
|
+
/* @__PURE__ */ jsxs40(PopoverContent4, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop2, onPointerDown: stop2, "data-records-button-said": said2?.kind, children: [
|
|
11935
|
+
said2?.kind === "refused" ? /* @__PURE__ */ jsx45(RefusalLine, { error: said2.error }) : null,
|
|
11936
|
+
said2?.kind === "waiting" ? /* @__PURE__ */ jsx45("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
11937
|
+
said2?.kind === "failed" ? /* @__PURE__ */ jsx45(ErrorBox2, { as: "p", className: "break-words text-destructive", message: said2.says, origin: "records-ui/buttonCell", children: said2.says }) : null,
|
|
11938
|
+
said2?.kind === "public" ? /* @__PURE__ */ jsx45("p", { children: "Buttons run for signed-in people." }) : null,
|
|
11939
|
+
said2?.kind === "ran" ? /* @__PURE__ */ jsxs40("div", { className: "break-words", children: [
|
|
11940
|
+
said2.value ? /* @__PURE__ */ jsx45(StructuredValueView, { structured: said2.value, label: b.label }) : null,
|
|
11861
11941
|
said2.says,
|
|
11862
11942
|
" ",
|
|
11863
|
-
said2.link ? /* @__PURE__ */
|
|
11943
|
+
said2.link ? /* @__PURE__ */ jsx45(OutboundLink7, { href: said2.link, className: "text-primary underline", children: readableLink(said2.link) }) : null
|
|
11864
11944
|
] }) : null,
|
|
11865
|
-
said2?.kind === "needs" ? /* @__PURE__ */
|
|
11866
|
-
/* @__PURE__ */
|
|
11867
|
-
tableId ? /* @__PURE__ */
|
|
11945
|
+
said2?.kind === "needs" ? /* @__PURE__ */ jsxs40(Fragment14, { children: [
|
|
11946
|
+
/* @__PURE__ */ jsx45("p", { children: said2.says }),
|
|
11947
|
+
tableId ? /* @__PURE__ */ jsxs40(
|
|
11868
11948
|
Button20,
|
|
11869
11949
|
{
|
|
11870
11950
|
type: "button",
|
|
@@ -11885,20 +11965,20 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
|
|
|
11885
11965
|
]
|
|
11886
11966
|
}
|
|
11887
11967
|
),
|
|
11888
|
-
settingUp && tableId ? /* @__PURE__ */
|
|
11889
|
-
/* @__PURE__ */
|
|
11890
|
-
/* @__PURE__ */
|
|
11891
|
-
/* @__PURE__ */
|
|
11968
|
+
settingUp && tableId ? /* @__PURE__ */ jsx45(Dialog5, { open: true, onOpenChange: (open) => open ? null : setSettingUp(false), children: /* @__PURE__ */ jsxs40(DialogContent5, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", onClick: stop2, onPointerDown: stop2, children: [
|
|
11969
|
+
/* @__PURE__ */ jsxs40(DialogHeader5, { children: [
|
|
11970
|
+
/* @__PURE__ */ jsx45(DialogTitle5, { children: `Column settings \xB7 ${fieldName(field2)}` }),
|
|
11971
|
+
/* @__PURE__ */ jsx45(DialogDescription3, { className: "sr-only", children: "What the button does" })
|
|
11892
11972
|
] }),
|
|
11893
|
-
/* @__PURE__ */
|
|
11973
|
+
/* @__PURE__ */ jsx45(FieldEditor, { tableId, field: field2, onSaved: () => setSettingUp(false), onCancel: () => setSettingUp(false) })
|
|
11894
11974
|
] }) }) : null
|
|
11895
11975
|
] });
|
|
11896
11976
|
}
|
|
11897
11977
|
|
|
11898
11978
|
// src/FloatingRefusal.tsx
|
|
11899
|
-
import { useLayoutEffect as useLayoutEffect2, useRef as useRef17, useState as
|
|
11979
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef17, useState as useState35 } from "react";
|
|
11900
11980
|
import { createPortal } from "react-dom";
|
|
11901
|
-
import { Fragment as Fragment15, jsx as
|
|
11981
|
+
import { Fragment as Fragment15, jsx as jsx46, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
11902
11982
|
var GAP2 = 4;
|
|
11903
11983
|
function placeFor(anchor, note) {
|
|
11904
11984
|
const a = anchor.getBoundingClientRect();
|
|
@@ -11916,8 +11996,8 @@ function placeFor(anchor, note) {
|
|
|
11916
11996
|
function FloatingRefusal({ text, why }) {
|
|
11917
11997
|
const spot = useRef17(null);
|
|
11918
11998
|
const note = useRef17(null);
|
|
11919
|
-
const [style, setStyle] =
|
|
11920
|
-
const [floating, setFloating] =
|
|
11999
|
+
const [style, setStyle] = useState35(null);
|
|
12000
|
+
const [floating, setFloating] = useState35(false);
|
|
11921
12001
|
useLayoutEffect2(() => {
|
|
11922
12002
|
const here = spot.current;
|
|
11923
12003
|
if (!here) return;
|
|
@@ -11936,12 +12016,12 @@ function FloatingRefusal({ text, why }) {
|
|
|
11936
12016
|
};
|
|
11937
12017
|
}, [text]);
|
|
11938
12018
|
if (!floating) {
|
|
11939
|
-
return /* @__PURE__ */
|
|
12019
|
+
return /* @__PURE__ */ jsx46("span", { ref: spot, "data-records-typed-refusal": "", role: "status", title: why, className: "text-[11px] leading-snug text-amber-700 dark:text-amber-400", children: text });
|
|
11940
12020
|
}
|
|
11941
|
-
return /* @__PURE__ */
|
|
11942
|
-
/* @__PURE__ */
|
|
12021
|
+
return /* @__PURE__ */ jsxs41(Fragment15, { children: [
|
|
12022
|
+
/* @__PURE__ */ jsx46("span", { ref: spot, "data-records-refusal-anchor": "", hidden: true }),
|
|
11943
12023
|
typeof document === "undefined" ? null : createPortal(
|
|
11944
|
-
/* @__PURE__ */
|
|
12024
|
+
/* @__PURE__ */ jsx46(
|
|
11945
12025
|
"span",
|
|
11946
12026
|
{
|
|
11947
12027
|
ref: note,
|
|
@@ -11960,10 +12040,10 @@ function FloatingRefusal({ text, why }) {
|
|
|
11960
12040
|
}
|
|
11961
12041
|
|
|
11962
12042
|
// src/formatControls.tsx
|
|
11963
|
-
import { useEffect as useEffect25, useRef as useRef18, useState as
|
|
12043
|
+
import { useEffect as useEffect25, useRef as useRef18, useState as useState36 } from "react";
|
|
11964
12044
|
import { BasicInput as BasicInput9, BasicTextarea as BasicTextarea4 } from "@ai-matrx/design-system";
|
|
11965
12045
|
import { getFieldFormat as getFieldFormat3, parseFieldInput } from "@ai-matrx/design-system/field-formats";
|
|
11966
|
-
import { jsx as
|
|
12046
|
+
import { jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
11967
12047
|
var TYPED_NUMBERS = /* @__PURE__ */ new Set(["currency", "percent", "progress", "decimal", "duration", "file_size", "integer"]);
|
|
11968
12048
|
function scaled(format) {
|
|
11969
12049
|
return (format.id === "percent" || format.id === "progress") && format.options?.percentScale === "fraction";
|
|
@@ -11980,13 +12060,13 @@ function keptValue(format, raw) {
|
|
|
11980
12060
|
return parsed;
|
|
11981
12061
|
}
|
|
11982
12062
|
function NumberInFormat({ format, value, onChange, disabled, id }) {
|
|
11983
|
-
const [text, setText] =
|
|
12063
|
+
const [text, setText] = useState36(() => typedText(format, value));
|
|
11984
12064
|
const lastSent = useRef18(void 0);
|
|
11985
12065
|
useEffect25(() => {
|
|
11986
12066
|
if (value === lastSent.current) return;
|
|
11987
12067
|
setText(typedText(format, value));
|
|
11988
12068
|
}, [value, format]);
|
|
11989
|
-
return /* @__PURE__ */
|
|
12069
|
+
return /* @__PURE__ */ jsx47(
|
|
11990
12070
|
BasicInput9,
|
|
11991
12071
|
{
|
|
11992
12072
|
id,
|
|
@@ -12011,21 +12091,21 @@ function formatControl(args) {
|
|
|
12011
12091
|
const look = fieldLookFor(def.id);
|
|
12012
12092
|
if (look?.Editor) {
|
|
12013
12093
|
const Editor = look.Editor;
|
|
12014
|
-
return /* @__PURE__ */
|
|
12094
|
+
return /* @__PURE__ */ jsx47(Editor, { value, format, onChange, disabled, id, label });
|
|
12015
12095
|
}
|
|
12016
12096
|
const text = value === null || value === void 0 ? "" : String(value);
|
|
12017
12097
|
const commit = (raw) => onChange(raw === "" ? null : parseFieldInput(raw, format));
|
|
12018
12098
|
if (def.id === "rating") {
|
|
12019
|
-
return disabled ? /* @__PURE__ */
|
|
12099
|
+
return disabled ? /* @__PURE__ */ jsx47(RatingStars, { value, max: format.options?.ratingMax ?? 5, label }) : /* @__PURE__ */ jsx47("span", { id, className: "inline-flex", children: /* @__PURE__ */ jsx47(RatingStars, { value, max: format.options?.ratingMax ?? 5, label, onRate: (n) => onChange(n) }) });
|
|
12020
12100
|
}
|
|
12021
|
-
if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */
|
|
12101
|
+
if (TYPED_NUMBERS.has(def.id)) return /* @__PURE__ */ jsx47(NumberInFormat, { ...args });
|
|
12022
12102
|
switch (def.editor) {
|
|
12023
12103
|
// A TIME OF DAY is not this file's: `FieldControl` draws the typed box and its helper
|
|
12024
12104
|
// (`TypedWordsControl`), never the browser's time control (grids review 3, 2026-09-30).
|
|
12025
12105
|
case "email":
|
|
12026
12106
|
case "url":
|
|
12027
12107
|
case "tel":
|
|
12028
|
-
return /* @__PURE__ */
|
|
12108
|
+
return /* @__PURE__ */ jsx47(
|
|
12029
12109
|
BasicInput9,
|
|
12030
12110
|
{
|
|
12031
12111
|
id,
|
|
@@ -12038,8 +12118,8 @@ function formatControl(args) {
|
|
|
12038
12118
|
}
|
|
12039
12119
|
);
|
|
12040
12120
|
case "color":
|
|
12041
|
-
return /* @__PURE__ */
|
|
12042
|
-
/* @__PURE__ */
|
|
12121
|
+
return /* @__PURE__ */ jsxs42("span", { className: "flex items-center gap-2", children: [
|
|
12122
|
+
/* @__PURE__ */ jsx47(
|
|
12043
12123
|
BasicInput9,
|
|
12044
12124
|
{
|
|
12045
12125
|
id: `${id}-swatch`,
|
|
@@ -12051,20 +12131,20 @@ function formatControl(args) {
|
|
|
12051
12131
|
onChange: (e) => commit(e.target.value)
|
|
12052
12132
|
}
|
|
12053
12133
|
),
|
|
12054
|
-
/* @__PURE__ */
|
|
12134
|
+
/* @__PURE__ */ jsx47(BasicInput9, { id, value: text, placeholder: "#3b82f6", disabled, onChange: (e) => commit(e.target.value) })
|
|
12055
12135
|
] });
|
|
12056
12136
|
case "textarea":
|
|
12057
|
-
return /* @__PURE__ */
|
|
12137
|
+
return /* @__PURE__ */ jsx47(BasicTextarea4, { id, rows: 4, value: text, disabled, onChange: (e) => commit(e.target.value) });
|
|
12058
12138
|
default:
|
|
12059
12139
|
return null;
|
|
12060
12140
|
}
|
|
12061
12141
|
}
|
|
12062
12142
|
|
|
12063
12143
|
// src/typedDateHelper.tsx
|
|
12064
|
-
import { useState as
|
|
12144
|
+
import { useState as useState37 } from "react";
|
|
12065
12145
|
import { Popover as Popover5, PopoverContent as PopoverContent5, PopoverTrigger as PopoverTrigger5, cn as cn22 } from "@ai-matrx/design-system";
|
|
12066
12146
|
import { readTypedDate, readTypedTime, typedDateText, typedTimeText, wallPartsInZone } from "@ai-matrx/records";
|
|
12067
|
-
import { jsx as
|
|
12147
|
+
import { jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
12068
12148
|
var WEEK = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
12069
12149
|
var MONTHS = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
12070
12150
|
function pad(n) {
|
|
@@ -12093,15 +12173,15 @@ function wordsFor2(kind, day, time) {
|
|
|
12093
12173
|
}
|
|
12094
12174
|
var keepFocus = { onMouseDown: (e) => e.preventDefault(), tabIndex: -1 };
|
|
12095
12175
|
function CalendarGlyph() {
|
|
12096
|
-
return /* @__PURE__ */
|
|
12097
|
-
/* @__PURE__ */
|
|
12098
|
-
/* @__PURE__ */
|
|
12176
|
+
return /* @__PURE__ */ jsxs43("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
12177
|
+
/* @__PURE__ */ jsx48("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2" }),
|
|
12178
|
+
/* @__PURE__ */ jsx48("path", { d: "M16 2v4M8 2v4M3 10h18" })
|
|
12099
12179
|
] });
|
|
12100
12180
|
}
|
|
12101
12181
|
function ClockGlyph() {
|
|
12102
|
-
return /* @__PURE__ */
|
|
12103
|
-
/* @__PURE__ */
|
|
12104
|
-
/* @__PURE__ */
|
|
12182
|
+
return /* @__PURE__ */ jsxs43("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
12183
|
+
/* @__PURE__ */ jsx48("circle", { cx: "12", cy: "12", r: "10" }),
|
|
12184
|
+
/* @__PURE__ */ jsx48("path", { d: "M12 6v6l4 2" })
|
|
12105
12185
|
] });
|
|
12106
12186
|
}
|
|
12107
12187
|
function TypedDateHelper({
|
|
@@ -12112,12 +12192,12 @@ function TypedDateHelper({
|
|
|
12112
12192
|
onPicked,
|
|
12113
12193
|
startOpen = false
|
|
12114
12194
|
}) {
|
|
12115
|
-
const [open, setOpen] =
|
|
12195
|
+
const [open, setOpen] = useState37(startOpen);
|
|
12116
12196
|
const held = readBox(text, kind);
|
|
12117
12197
|
usePersonTimeZone();
|
|
12118
12198
|
const today = personWallNow();
|
|
12119
12199
|
const start = held.day ? new Date(Number(held.day.slice(0, 4)), Number(held.day.slice(5, 7)) - 1, 1) : new Date(today.getFullYear(), today.getMonth(), 1);
|
|
12120
|
-
const [month, setMonth] =
|
|
12200
|
+
const [month, setMonth] = useState37(null);
|
|
12121
12201
|
const shown2 = month ?? { y: start.getFullYear(), m: start.getMonth() };
|
|
12122
12202
|
const first = new Date(shown2.y, shown2.m, 1).getDay();
|
|
12123
12203
|
const days = new Date(shown2.y, shown2.m + 1, 0).getDate();
|
|
@@ -12142,8 +12222,8 @@ function TypedDateHelper({
|
|
|
12142
12222
|
const at = new Date(shown2.y, shown2.m + by, 1);
|
|
12143
12223
|
setMonth({ y: at.getFullYear(), m: at.getMonth() });
|
|
12144
12224
|
};
|
|
12145
|
-
return /* @__PURE__ */
|
|
12146
|
-
/* @__PURE__ */
|
|
12225
|
+
return /* @__PURE__ */ jsxs43(Popover5, { open, onOpenChange: setOpen, children: [
|
|
12226
|
+
/* @__PURE__ */ jsx48(PopoverTrigger5, { asChild: true, children: /* @__PURE__ */ jsx48(
|
|
12147
12227
|
"button",
|
|
12148
12228
|
{
|
|
12149
12229
|
type: "button",
|
|
@@ -12152,10 +12232,10 @@ function TypedDateHelper({
|
|
|
12152
12232
|
"aria-label": kind === "time" ? `Pick a time for ${label}` : `Pick a date for ${label}`,
|
|
12153
12233
|
title: kind === "time" ? "Pick a time" : "Pick a date",
|
|
12154
12234
|
className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted hover:text-foreground",
|
|
12155
|
-
children: kind === "time" ? /* @__PURE__ */
|
|
12235
|
+
children: kind === "time" ? /* @__PURE__ */ jsx48(ClockGlyph, {}) : /* @__PURE__ */ jsx48(CalendarGlyph, {})
|
|
12156
12236
|
}
|
|
12157
12237
|
) }),
|
|
12158
|
-
/* @__PURE__ */
|
|
12238
|
+
/* @__PURE__ */ jsx48(
|
|
12159
12239
|
PopoverContent5,
|
|
12160
12240
|
{
|
|
12161
12241
|
sizing: "content",
|
|
@@ -12165,23 +12245,23 @@ function TypedDateHelper({
|
|
|
12165
12245
|
"data-records-date-helper-panel": "",
|
|
12166
12246
|
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
12167
12247
|
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
12168
|
-
children: /* @__PURE__ */
|
|
12169
|
-
kind === "time" ? null : /* @__PURE__ */
|
|
12170
|
-
/* @__PURE__ */
|
|
12171
|
-
/* @__PURE__ */
|
|
12172
|
-
/* @__PURE__ */
|
|
12248
|
+
children: /* @__PURE__ */ jsxs43("div", { className: "flex gap-2", children: [
|
|
12249
|
+
kind === "time" ? null : /* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-1", role: "grid", "aria-label": `${MONTHS[shown2.m]} ${shown2.y}`, children: [
|
|
12250
|
+
/* @__PURE__ */ jsxs43("div", { className: "flex items-center justify-between text-xs font-medium", children: [
|
|
12251
|
+
/* @__PURE__ */ jsx48("button", { type: "button", ...keepFocus, "aria-label": "Previous month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(-1), children: "\u2039" }),
|
|
12252
|
+
/* @__PURE__ */ jsxs43("span", { children: [
|
|
12173
12253
|
MONTHS[shown2.m],
|
|
12174
12254
|
" ",
|
|
12175
12255
|
shown2.y
|
|
12176
12256
|
] }),
|
|
12177
|
-
/* @__PURE__ */
|
|
12257
|
+
/* @__PURE__ */ jsx48("button", { type: "button", ...keepFocus, "aria-label": "Next month", className: "rounded px-1.5 hover:bg-muted", onClick: () => turn(1), children: "\u203A" })
|
|
12178
12258
|
] }),
|
|
12179
|
-
/* @__PURE__ */
|
|
12180
|
-
WEEK.map((w) => /* @__PURE__ */
|
|
12259
|
+
/* @__PURE__ */ jsxs43("div", { className: "grid grid-cols-7 gap-0.5 text-center text-[11px]", children: [
|
|
12260
|
+
WEEK.map((w) => /* @__PURE__ */ jsx48("span", { className: "text-muted-foreground", children: w }, w)),
|
|
12181
12261
|
cells.map((d, i) => {
|
|
12182
|
-
if (d === null) return /* @__PURE__ */
|
|
12262
|
+
if (d === null) return /* @__PURE__ */ jsx48("span", {}, `blank-${i}`);
|
|
12183
12263
|
const key = `${shown2.y}-${pad(shown2.m + 1)}-${pad(d)}`;
|
|
12184
|
-
return /* @__PURE__ */
|
|
12264
|
+
return /* @__PURE__ */ jsx48(
|
|
12185
12265
|
"button",
|
|
12186
12266
|
{
|
|
12187
12267
|
type: "button",
|
|
@@ -12200,7 +12280,7 @@ function TypedDateHelper({
|
|
|
12200
12280
|
})
|
|
12201
12281
|
] })
|
|
12202
12282
|
] }),
|
|
12203
|
-
kind === "date" ? null : /* @__PURE__ */
|
|
12283
|
+
kind === "date" ? null : /* @__PURE__ */ jsx48("div", { className: "flex max-h-48 flex-col overflow-y-auto pr-1 text-[11px]", "aria-label": "Times", children: times.map((t) => /* @__PURE__ */ jsx48(
|
|
12204
12284
|
"button",
|
|
12205
12285
|
{
|
|
12206
12286
|
type: "button",
|
|
@@ -12222,7 +12302,7 @@ function TypedDateHelper({
|
|
|
12222
12302
|
}
|
|
12223
12303
|
|
|
12224
12304
|
// src/editors.tsx
|
|
12225
|
-
import { Fragment as Fragment16, jsx as
|
|
12305
|
+
import { Fragment as Fragment16, jsx as jsx49, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
12226
12306
|
var CHOICE_EDITOR_ADDS_WHAT_IS_TYPED = true;
|
|
12227
12307
|
function isChoiceAddition(value) {
|
|
12228
12308
|
return typeof value === "object" && value !== null && value.addingChoices === true;
|
|
@@ -12252,21 +12332,21 @@ function ChoiceAskButtons({
|
|
|
12252
12332
|
onCancel,
|
|
12253
12333
|
busy
|
|
12254
12334
|
}) {
|
|
12255
|
-
return /* @__PURE__ */
|
|
12256
|
-
/* @__PURE__ */
|
|
12257
|
-
/* @__PURE__ */
|
|
12258
|
-
/* @__PURE__ */
|
|
12259
|
-
keepOffered ? /* @__PURE__ */
|
|
12260
|
-
/* @__PURE__ */
|
|
12335
|
+
return /* @__PURE__ */ jsxs44("span", { "data-records-choice-ask": "", "data-records-cell-note": "", role: "group", "aria-label": choiceAskSentence(field2, words), className: "flex flex-col gap-1", children: [
|
|
12336
|
+
/* @__PURE__ */ jsx49("span", { className: "text-[11px] leading-snug", children: choiceAskSentence(field2, words) }),
|
|
12337
|
+
/* @__PURE__ */ jsxs44("span", { className: "flex flex-wrap items-center gap-1", children: [
|
|
12338
|
+
/* @__PURE__ */ jsx49(Button21, { type: "button", size: "sm", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onAdd, children: "Add" }),
|
|
12339
|
+
keepOffered ? /* @__PURE__ */ jsx49(Button21, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onKeep, children: "Keep as typed" }) : null,
|
|
12340
|
+
/* @__PURE__ */ jsx49(Button21, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", disabled: busy ?? false, onClick: onCancel, children: "Cancel" })
|
|
12261
12341
|
] })
|
|
12262
12342
|
] });
|
|
12263
12343
|
}
|
|
12264
12344
|
var FORMAT_BLIND_KINDS = /* @__PURE__ */ new Set(["formula", "lookup", "rollup", "json", "checkbox", "select", "multi_select", "member", "entity_reference", "relation", "attachment", "datetime"]);
|
|
12265
12345
|
function FieldLabel({ field: field2, htmlFor, children }) {
|
|
12266
|
-
return /* @__PURE__ */
|
|
12267
|
-
/* @__PURE__ */
|
|
12268
|
-
field2.required ? /* @__PURE__ */
|
|
12269
|
-
field2.unit && newerKindOf2(field2) !== "duration" ? /* @__PURE__ */
|
|
12346
|
+
return /* @__PURE__ */ jsxs44("div", { className: "flex items-baseline gap-1.5", children: [
|
|
12347
|
+
/* @__PURE__ */ jsx49(Label12, { htmlFor, className: "text-xs font-medium", children: fieldName(field2) }),
|
|
12348
|
+
field2.required ? /* @__PURE__ */ jsx49("span", { className: "text-xs text-destructive", children: "required" }) : null,
|
|
12349
|
+
field2.unit && newerKindOf2(field2) !== "duration" ? /* @__PURE__ */ jsx49("span", { className: "text-xs text-muted-foreground", children: field2.unit }) : null,
|
|
12270
12350
|
children
|
|
12271
12351
|
] });
|
|
12272
12352
|
}
|
|
@@ -12396,21 +12476,21 @@ function draftFromTyping(field2, seed) {
|
|
|
12396
12476
|
}
|
|
12397
12477
|
function ReadsAsNote({ typed, always, children }) {
|
|
12398
12478
|
const note = useRef19(null);
|
|
12399
|
-
const [repeats, setRepeats] =
|
|
12479
|
+
const [repeats, setRepeats] = useState38(false);
|
|
12400
12480
|
useLayoutEffect3(() => {
|
|
12401
12481
|
if (always) return;
|
|
12402
12482
|
const words = (t) => (t ?? "").replace(/^Reads as/, "").replace(/\s+/g, "").toLowerCase();
|
|
12403
12483
|
setRepeats(words(note.current?.textContent) === words(typed));
|
|
12404
12484
|
}, [typed, always]);
|
|
12405
12485
|
if (repeats) return null;
|
|
12406
|
-
return /* @__PURE__ */
|
|
12486
|
+
return /* @__PURE__ */ jsx49("span", { ref: note, "data-records-typed-reads-as": "", "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children });
|
|
12407
12487
|
}
|
|
12408
12488
|
function TypedTextControl({ field: field2, value, onChange, disabled, id, onCommit, onCancel }) {
|
|
12409
12489
|
const client = useOptionalRecordsClient12();
|
|
12410
12490
|
const kind = String(editorKindFor(field2));
|
|
12411
12491
|
const needsChoices = kind === "select" || kind === "multi_select";
|
|
12412
12492
|
const nudge = useChoiceNudge(needsChoices);
|
|
12413
|
-
const [choices, setChoices] =
|
|
12493
|
+
const [choices, setChoices] = useState38(null);
|
|
12414
12494
|
useEffect26(() => {
|
|
12415
12495
|
if (!needsChoices || !client) return;
|
|
12416
12496
|
let cancelled = false;
|
|
@@ -12433,7 +12513,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
12433
12513
|
judged: judgeTyped(field2, text, needsChoices ? choices : void 0, needsChoices ? nudge : void 0),
|
|
12434
12514
|
...value.openedAs !== void 0 ? { openedAs: value.openedAs } : {}
|
|
12435
12515
|
});
|
|
12436
|
-
const box = /* @__PURE__ */
|
|
12516
|
+
const box = /* @__PURE__ */ jsx49(
|
|
12437
12517
|
BasicInput10,
|
|
12438
12518
|
{
|
|
12439
12519
|
id,
|
|
@@ -12445,16 +12525,16 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
12445
12525
|
onChange: (e) => retype(e.target.value)
|
|
12446
12526
|
}
|
|
12447
12527
|
);
|
|
12448
|
-
return /* @__PURE__ */
|
|
12449
|
-
helper && !disabled ? /* @__PURE__ */
|
|
12528
|
+
return /* @__PURE__ */ jsxs44("span", { className: "flex flex-col gap-0.5", children: [
|
|
12529
|
+
helper && !disabled ? /* @__PURE__ */ jsxs44("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
12450
12530
|
box,
|
|
12451
|
-
/* @__PURE__ */
|
|
12531
|
+
/* @__PURE__ */ jsx49(TypedDateHelper, { kind: helper, text: value.text, onText: retype, label: fieldName(field2), onPicked: onCommit, startOpen: value.openedAs !== void 0 })
|
|
12452
12532
|
] }) : box,
|
|
12453
|
-
judged === null ? /* @__PURE__ */
|
|
12533
|
+
judged === null ? /* @__PURE__ */ jsxs44("span", { "data-records-cell-note": "", className: "text-[10px] text-muted-foreground", children: [
|
|
12454
12534
|
"Reading ",
|
|
12455
12535
|
fieldName(field2),
|
|
12456
12536
|
"'s choices\u2026"
|
|
12457
|
-
] }) : "ask" in judged ? /* @__PURE__ */
|
|
12537
|
+
] }) : "ask" in judged ? /* @__PURE__ */ jsx49(
|
|
12458
12538
|
ChoiceAskButtons,
|
|
12459
12539
|
{
|
|
12460
12540
|
field: field2,
|
|
@@ -12470,10 +12550,10 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
12470
12550
|
},
|
|
12471
12551
|
onCancel: () => onCancel?.()
|
|
12472
12552
|
}
|
|
12473
|
-
) : "refusal" in judged ? /* @__PURE__ */
|
|
12474
|
-
/* @__PURE__ */
|
|
12475
|
-
judged.cancelOnly && onCancel ? /* @__PURE__ */
|
|
12476
|
-
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */
|
|
12553
|
+
) : "refusal" in judged ? /* @__PURE__ */ jsxs44(Fragment16, { children: [
|
|
12554
|
+
/* @__PURE__ */ jsx49(FloatingRefusal, { text: judged.refusal, why: "why" in judged ? judged.why : void 0 }),
|
|
12555
|
+
judged.cancelOnly && onCancel ? /* @__PURE__ */ jsx49("span", { "data-records-cell-note": "", "data-records-choice-ask": "", children: /* @__PURE__ */ jsx49(Button21, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => onCancel(), children: "Cancel" }) }) : null
|
|
12556
|
+
] }) : judged.value === null || judged.value === void 0 ? null : /* @__PURE__ */ jsxs44(ReadsAsNote, { typed: value.text, always: isChoiceAddition(judged.value), children: [
|
|
12477
12557
|
isChoiceAddition(judged.value) ? `Adds ${quoted(judged.value.add)} to the choices for ${fieldName(field2)}. ` : null,
|
|
12478
12558
|
"Reads as",
|
|
12479
12559
|
" ",
|
|
@@ -12484,7 +12564,7 @@ function TypedTextControl({ field: field2, value, onChange, disabled, id, onComm
|
|
|
12484
12564
|
}).join(", ")
|
|
12485
12565
|
) : (() => {
|
|
12486
12566
|
const shown2 = format ?? (kind === "datetime" ? { id: carriesTimeOfDay(field2, judged.value) ? "datetime" : "date" } : void 0);
|
|
12487
|
-
return shown2 ? /* @__PURE__ */
|
|
12567
|
+
return shown2 ? /* @__PURE__ */ jsx49(FormattedValue, { value: judged.value, format: shown2 }) : String(judged.value);
|
|
12488
12568
|
})()
|
|
12489
12569
|
] }, value.text)
|
|
12490
12570
|
] });
|
|
@@ -12498,33 +12578,33 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12498
12578
|
const kind = editorKindFor(field2);
|
|
12499
12579
|
const inputId = id ?? `field-${field2.key}`;
|
|
12500
12580
|
const ownDetails = useOptionalRecordsClient12() === null;
|
|
12501
|
-
if (isTypedDraft(value)) return /* @__PURE__ */
|
|
12502
|
-
if (isSignatureField(field2)) return /* @__PURE__ */
|
|
12503
|
-
if (isButtonField2(field2)) return /* @__PURE__ */
|
|
12581
|
+
if (isTypedDraft(value)) return /* @__PURE__ */ jsx49(TypedTextControl, { field: field2, value, onChange, disabled, id: inputId, onCommit, onCancel });
|
|
12582
|
+
if (isSignatureField(field2)) return /* @__PURE__ */ jsx49(SignaturePad, { id: inputId, value, onChange, disabled });
|
|
12583
|
+
if (isButtonField2(field2)) return /* @__PURE__ */ jsx49(ButtonValue, { field: field2, recordId: recordId ?? null, beforeSave: !recordId });
|
|
12504
12584
|
const newerControl = newerKindControl({ field: field2, value, onChange, disabled, id: inputId });
|
|
12505
12585
|
if (newerControl !== void 0) return newerControl;
|
|
12506
12586
|
const format = formatForField(field2);
|
|
12507
|
-
if (format && format.id === "time") return /* @__PURE__ */
|
|
12587
|
+
if (format && format.id === "time") return /* @__PURE__ */ jsx49(TypedWordsControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
12508
12588
|
if (format && !FORMAT_BLIND_KINDS.has(String(kind))) {
|
|
12509
12589
|
const own3 = formatControl({ format, value, onChange, disabled, id: inputId, label: fieldName(field2), ownDetails });
|
|
12510
12590
|
if (own3) return own3;
|
|
12511
12591
|
}
|
|
12512
12592
|
if ((kind === "text" || kind === "long_text") && typeof value === "string" && /^\s*(?:\[|\{|```json)/.test(value)) {
|
|
12513
|
-
return /* @__PURE__ */
|
|
12593
|
+
return /* @__PURE__ */ jsx49(StructuredTextControl, { field: field2, value, onChange, disabled, id: inputId, rows: asForm ? 8 : 3 });
|
|
12514
12594
|
}
|
|
12515
12595
|
switch (kind) {
|
|
12516
12596
|
case "formula":
|
|
12517
12597
|
case "lookup":
|
|
12518
12598
|
case "rollup":
|
|
12519
|
-
return /* @__PURE__ */
|
|
12599
|
+
return /* @__PURE__ */ jsxs44("div", { id: inputId, className: "rounded border border-dashed px-2 py-1.5 text-xs text-muted-foreground", children: [
|
|
12520
12600
|
value === null || value === void 0 ? "\u2014" : String(value),
|
|
12521
|
-
/* @__PURE__ */
|
|
12601
|
+
/* @__PURE__ */ jsxs44("span", { className: "ml-2 italic", children: [
|
|
12522
12602
|
fieldName(field2),
|
|
12523
12603
|
" is calculated, so it cannot be typed in"
|
|
12524
12604
|
] })
|
|
12525
12605
|
] });
|
|
12526
12606
|
case "json":
|
|
12527
|
-
return /* @__PURE__ */
|
|
12607
|
+
return /* @__PURE__ */ jsx49(JsonControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
12528
12608
|
case "long_text":
|
|
12529
12609
|
if (host.textBox) {
|
|
12530
12610
|
return host.textBox({
|
|
@@ -12537,7 +12617,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12537
12617
|
disabled
|
|
12538
12618
|
});
|
|
12539
12619
|
}
|
|
12540
|
-
return /* @__PURE__ */
|
|
12620
|
+
return /* @__PURE__ */ jsx49(
|
|
12541
12621
|
BasicTextarea5,
|
|
12542
12622
|
{
|
|
12543
12623
|
id: inputId,
|
|
@@ -12550,7 +12630,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12550
12630
|
case "number":
|
|
12551
12631
|
case "currency":
|
|
12552
12632
|
case "percent":
|
|
12553
|
-
return /* @__PURE__ */
|
|
12633
|
+
return /* @__PURE__ */ jsx49(
|
|
12554
12634
|
BasicInput10,
|
|
12555
12635
|
{
|
|
12556
12636
|
id: inputId,
|
|
@@ -12563,11 +12643,11 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12563
12643
|
}
|
|
12564
12644
|
);
|
|
12565
12645
|
case "datetime":
|
|
12566
|
-
return /* @__PURE__ */
|
|
12646
|
+
return /* @__PURE__ */ jsx49(TypedWordsControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
12567
12647
|
case "email":
|
|
12568
12648
|
case "phone":
|
|
12569
12649
|
case "url":
|
|
12570
|
-
return /* @__PURE__ */
|
|
12650
|
+
return /* @__PURE__ */ jsx49(
|
|
12571
12651
|
BasicInput10,
|
|
12572
12652
|
{
|
|
12573
12653
|
id: inputId,
|
|
@@ -12580,24 +12660,24 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12580
12660
|
}
|
|
12581
12661
|
);
|
|
12582
12662
|
case "checkbox":
|
|
12583
|
-
return /* @__PURE__ */
|
|
12663
|
+
return /* @__PURE__ */ jsx49(CheckboxControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
12584
12664
|
case "select":
|
|
12585
12665
|
case "multi_select":
|
|
12586
|
-
return /* @__PURE__ */
|
|
12666
|
+
return /* @__PURE__ */ jsx49(OptionControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen });
|
|
12587
12667
|
case "member":
|
|
12588
|
-
return /* @__PURE__ */
|
|
12668
|
+
return /* @__PURE__ */ jsx49(PersonPicker, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
12589
12669
|
case "entity_reference":
|
|
12590
|
-
return /* @__PURE__ */
|
|
12670
|
+
return /* @__PURE__ */ jsx49(EntityReferenceControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
12591
12671
|
case "attachment":
|
|
12592
12672
|
if (hostTakesFiles(host)) {
|
|
12593
|
-
return /* @__PURE__ */
|
|
12673
|
+
return /* @__PURE__ */ jsx49(AttachmentControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
12594
12674
|
}
|
|
12595
|
-
return /* @__PURE__ */
|
|
12675
|
+
return /* @__PURE__ */ jsx49(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, excludeId: recordId });
|
|
12596
12676
|
case "relation":
|
|
12597
|
-
return /* @__PURE__ */
|
|
12677
|
+
return /* @__PURE__ */ jsx49(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
|
|
12598
12678
|
default:
|
|
12599
12679
|
if (typeof value === "boolean" || field2.config?.["kind"] === "boolean") {
|
|
12600
|
-
return /* @__PURE__ */
|
|
12680
|
+
return /* @__PURE__ */ jsx49(
|
|
12601
12681
|
Checkbox7,
|
|
12602
12682
|
{
|
|
12603
12683
|
id: inputId,
|
|
@@ -12607,7 +12687,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12607
12687
|
}
|
|
12608
12688
|
);
|
|
12609
12689
|
}
|
|
12610
|
-
return /* @__PURE__ */
|
|
12690
|
+
return /* @__PURE__ */ jsx49(
|
|
12611
12691
|
BasicInput10,
|
|
12612
12692
|
{
|
|
12613
12693
|
id: inputId,
|
|
@@ -12620,9 +12700,9 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12620
12700
|
}
|
|
12621
12701
|
}
|
|
12622
12702
|
function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
12623
|
-
const [text, setText] =
|
|
12624
|
-
const [refusal, setRefusal] =
|
|
12625
|
-
const [why, setWhy] =
|
|
12703
|
+
const [text, setText] = useState38(() => openingText(field2, value));
|
|
12704
|
+
const [refusal, setRefusal] = useState38(null);
|
|
12705
|
+
const [why, setWhy] = useState38(void 0);
|
|
12626
12706
|
const sent = useRef19(value);
|
|
12627
12707
|
useEffect26(() => {
|
|
12628
12708
|
if (value === sent.current) return;
|
|
@@ -12643,9 +12723,9 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
12643
12723
|
setWhy("why" in judged ? judged.why : void 0);
|
|
12644
12724
|
}
|
|
12645
12725
|
};
|
|
12646
|
-
return /* @__PURE__ */
|
|
12647
|
-
/* @__PURE__ */
|
|
12648
|
-
/* @__PURE__ */
|
|
12726
|
+
return /* @__PURE__ */ jsxs44("span", { className: "flex flex-col gap-0.5", children: [
|
|
12727
|
+
/* @__PURE__ */ jsxs44("span", { className: "flex min-w-0 items-center gap-0.5", children: [
|
|
12728
|
+
/* @__PURE__ */ jsx49(
|
|
12649
12729
|
BasicInput10,
|
|
12650
12730
|
{
|
|
12651
12731
|
id,
|
|
@@ -12662,9 +12742,9 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
12662
12742
|
}
|
|
12663
12743
|
}
|
|
12664
12744
|
),
|
|
12665
|
-
helper && !disabled ? /* @__PURE__ */
|
|
12745
|
+
helper && !disabled ? /* @__PURE__ */ jsx49(TypedDateHelper, { kind: helper, text, onText: retype, label: fieldName(field2) }) : null
|
|
12666
12746
|
] }),
|
|
12667
|
-
refusal ? /* @__PURE__ */
|
|
12747
|
+
refusal ? /* @__PURE__ */ jsx49(FloatingRefusal, { text: refusal, why }) : null
|
|
12668
12748
|
] });
|
|
12669
12749
|
}
|
|
12670
12750
|
function typedDatePlaceholder(helper) {
|
|
@@ -12675,8 +12755,8 @@ function typedDatePlaceholder(helper) {
|
|
|
12675
12755
|
}
|
|
12676
12756
|
function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
12677
12757
|
const unanswered = value === null || value === void 0;
|
|
12678
|
-
return /* @__PURE__ */
|
|
12679
|
-
/* @__PURE__ */
|
|
12758
|
+
return /* @__PURE__ */ jsxs44("div", { className: "flex items-center gap-2", children: [
|
|
12759
|
+
/* @__PURE__ */ jsx49(
|
|
12680
12760
|
Checkbox7,
|
|
12681
12761
|
{
|
|
12682
12762
|
id,
|
|
@@ -12686,9 +12766,9 @@ function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
12686
12766
|
onCheckedChange: (next) => onChange(next === true)
|
|
12687
12767
|
}
|
|
12688
12768
|
),
|
|
12689
|
-
unanswered ? /* @__PURE__ */
|
|
12690
|
-
/* @__PURE__ */
|
|
12691
|
-
field2.required ? null : /* @__PURE__ */
|
|
12769
|
+
unanswered ? /* @__PURE__ */ jsx49("span", { className: "text-xs italic text-muted-foreground", children: "not answered yet" }) : /* @__PURE__ */ jsxs44(Fragment16, { children: [
|
|
12770
|
+
/* @__PURE__ */ jsx49("span", { className: "text-xs text-muted-foreground", children: value === true ? "Yes" : "No" }),
|
|
12771
|
+
field2.required ? null : /* @__PURE__ */ jsx49(
|
|
12692
12772
|
Button21,
|
|
12693
12773
|
{
|
|
12694
12774
|
size: "sm",
|
|
@@ -12705,8 +12785,8 @@ function CheckboxControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
12705
12785
|
function StructuredTextControl({ field: field2, value, onChange, disabled, id, rows }) {
|
|
12706
12786
|
const text = typeof value === "string" ? value : "";
|
|
12707
12787
|
const reads = structuredOf(text) !== null;
|
|
12708
|
-
return /* @__PURE__ */
|
|
12709
|
-
/* @__PURE__ */
|
|
12788
|
+
return /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-1", "data-records-structured-editor": "", children: [
|
|
12789
|
+
/* @__PURE__ */ jsx49(
|
|
12710
12790
|
BasicTextarea5,
|
|
12711
12791
|
{
|
|
12712
12792
|
id,
|
|
@@ -12718,7 +12798,7 @@ function StructuredTextControl({ field: field2, value, onChange, disabled, id, r
|
|
|
12718
12798
|
onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
|
|
12719
12799
|
}
|
|
12720
12800
|
),
|
|
12721
|
-
/* @__PURE__ */
|
|
12801
|
+
/* @__PURE__ */ jsx49("span", { className: "flex h-6 items-center gap-2 text-xs", children: reads ? /* @__PURE__ */ jsx49(
|
|
12722
12802
|
Button21,
|
|
12723
12803
|
{
|
|
12724
12804
|
type: "button",
|
|
@@ -12730,15 +12810,15 @@ function StructuredTextControl({ field: field2, value, onChange, disabled, id, r
|
|
|
12730
12810
|
"data-records-structured-format": "",
|
|
12731
12811
|
children: "Format"
|
|
12732
12812
|
}
|
|
12733
|
-
) : /* @__PURE__ */
|
|
12813
|
+
) : /* @__PURE__ */ jsx49("span", { className: "text-amber-700 dark:text-amber-400", "data-records-structured-broken": "", children: "Not valid JSON \u2014 saves as plain text" }) })
|
|
12734
12814
|
] });
|
|
12735
12815
|
}
|
|
12736
12816
|
function JsonControl({ field: field2, value, onChange, disabled, id }) {
|
|
12737
12817
|
const initial = value === null || value === void 0 ? "" : typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
12738
|
-
const [text, setText] =
|
|
12739
|
-
const [broken, setBroken] =
|
|
12740
|
-
return /* @__PURE__ */
|
|
12741
|
-
/* @__PURE__ */
|
|
12818
|
+
const [text, setText] = useState38(initial);
|
|
12819
|
+
const [broken, setBroken] = useState38(null);
|
|
12820
|
+
return /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-1", children: [
|
|
12821
|
+
/* @__PURE__ */ jsx49(
|
|
12742
12822
|
BasicTextarea5,
|
|
12743
12823
|
{
|
|
12744
12824
|
id,
|
|
@@ -12773,7 +12853,7 @@ function JsonControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
12773
12853
|
broken ? (
|
|
12774
12854
|
// The typed text is still in the box: the notice owns the two doors out. In a grid cell it
|
|
12775
12855
|
// floats over the table (`data-records-cell-note`), so the row never grows.
|
|
12776
|
-
/* @__PURE__ */
|
|
12856
|
+
/* @__PURE__ */ jsx49("span", { "data-records-cell-note": "", className: "block", children: /* @__PURE__ */ jsx49(
|
|
12777
12857
|
RefusalNotice,
|
|
12778
12858
|
{
|
|
12779
12859
|
error: broken,
|
|
@@ -12798,9 +12878,9 @@ function inTheStoresOrder(options) {
|
|
|
12798
12878
|
}
|
|
12799
12879
|
function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen, onClose, onCancel, addsChoices, initialSearch, asForm, onChosen }) {
|
|
12800
12880
|
const client = useOptionalRecordsClient12();
|
|
12801
|
-
const [options, setOptions] =
|
|
12802
|
-
const [refusal, setRefusal] =
|
|
12803
|
-
const [reread, setReread] =
|
|
12881
|
+
const [options, setOptions] = useState38(null);
|
|
12882
|
+
const [refusal, setRefusal] = useState38(null);
|
|
12883
|
+
const [reread, setReread] = useState38(0);
|
|
12804
12884
|
useEffect26(() => {
|
|
12805
12885
|
if (!client) return;
|
|
12806
12886
|
let cancelled = false;
|
|
@@ -12815,11 +12895,11 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12815
12895
|
}, [client, field2.id, reread]);
|
|
12816
12896
|
const handed = publicChoicesOf(field2);
|
|
12817
12897
|
if (!client && handed.length > 0) {
|
|
12818
|
-
return /* @__PURE__ */
|
|
12898
|
+
return /* @__PURE__ */ jsx49(ChoiceAnswer, { field: field2, choices: handed, value, onChange, disabled, id, onChosen });
|
|
12819
12899
|
}
|
|
12820
12900
|
if (!client) {
|
|
12821
|
-
return /* @__PURE__ */
|
|
12822
|
-
/* @__PURE__ */
|
|
12901
|
+
return /* @__PURE__ */ jsxs44("div", { className: "flex flex-col gap-1", children: [
|
|
12902
|
+
/* @__PURE__ */ jsx49(
|
|
12823
12903
|
BasicInput10,
|
|
12824
12904
|
{
|
|
12825
12905
|
id,
|
|
@@ -12828,15 +12908,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12828
12908
|
onChange: (e) => onChange(e.target.value === "" ? null : e.target.value)
|
|
12829
12909
|
}
|
|
12830
12910
|
),
|
|
12831
|
-
/* @__PURE__ */
|
|
12911
|
+
/* @__PURE__ */ jsx49("p", { className: "text-xs text-muted-foreground", children: "This is normally picked from a list. A page answered without an account cannot read that list, so type your answer and whoever receives it will match it up." })
|
|
12832
12912
|
] });
|
|
12833
12913
|
}
|
|
12834
12914
|
if (refusal)
|
|
12835
|
-
return /* @__PURE__ */
|
|
12836
|
-
if (!options) return /* @__PURE__ */
|
|
12915
|
+
return /* @__PURE__ */ jsx49("div", { id, children: /* @__PURE__ */ jsx49(RefusalLine, { error: refusal }) });
|
|
12916
|
+
if (!options) return /* @__PURE__ */ jsx49("p", { id, className: "text-xs text-muted-foreground", children: "Reading this field's choices\u2026" });
|
|
12837
12917
|
if (asForm && options.length > 0) {
|
|
12838
12918
|
const titled = (option) => recordName(option.data, null, "Unnamed choice");
|
|
12839
|
-
return /* @__PURE__ */
|
|
12919
|
+
return /* @__PURE__ */ jsx49(
|
|
12840
12920
|
ChoiceAnswer,
|
|
12841
12921
|
{
|
|
12842
12922
|
field: field2,
|
|
@@ -12854,7 +12934,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12854
12934
|
);
|
|
12855
12935
|
}
|
|
12856
12936
|
const noChoicesYet = client && options.length === 0 && !disabled;
|
|
12857
|
-
const offerChoices = noChoicesYet ? /* @__PURE__ */
|
|
12937
|
+
const offerChoices = noChoicesYet ? /* @__PURE__ */ jsx49(
|
|
12858
12938
|
AddChoicesInline,
|
|
12859
12939
|
{
|
|
12860
12940
|
field: field2,
|
|
@@ -12865,9 +12945,9 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12865
12945
|
}
|
|
12866
12946
|
) : null;
|
|
12867
12947
|
if (CHOICE_EDITOR_ADDS_WHAT_IS_TYPED) {
|
|
12868
|
-
return /* @__PURE__ */
|
|
12948
|
+
return /* @__PURE__ */ jsxs44(Fragment16, { children: [
|
|
12869
12949
|
offerChoices,
|
|
12870
|
-
/* @__PURE__ */
|
|
12950
|
+
/* @__PURE__ */ jsx49(
|
|
12871
12951
|
OpenChoicePicker,
|
|
12872
12952
|
{
|
|
12873
12953
|
field: field2,
|
|
@@ -12891,13 +12971,13 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12891
12971
|
] });
|
|
12892
12972
|
}
|
|
12893
12973
|
if (options.length === 0) {
|
|
12894
|
-
return /* @__PURE__ */
|
|
12974
|
+
return /* @__PURE__ */ jsx49("p", { id, className: "text-xs text-muted-foreground", children: field2.options_table_id ? `${fieldName(field2)} takes its choices from a Table that has no records yet \u2014 add the choices there and they appear here.` : `${fieldName(field2)} does not name the Table its choices come from yet, so there is nothing to choose. A table admin sets it in the field editor.` });
|
|
12895
12975
|
}
|
|
12896
12976
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
12897
12977
|
if (field2.multi) {
|
|
12898
12978
|
const chosen = options.filter((option) => choiceValuesOf(value).some((v) => isTheChosen(option, v)));
|
|
12899
12979
|
const picked = new Set(chosen.map((option) => optionKey6(option)));
|
|
12900
|
-
const toggles = /* @__PURE__ */
|
|
12980
|
+
const toggles = /* @__PURE__ */ jsx49("div", { id: autoOpen ? void 0 : id, className: "flex flex-wrap gap-1", children: options.map((option) => /* @__PURE__ */ jsx49(
|
|
12901
12981
|
Button21,
|
|
12902
12982
|
{
|
|
12903
12983
|
type: "button",
|
|
@@ -12915,7 +12995,7 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12915
12995
|
option.id
|
|
12916
12996
|
)) });
|
|
12917
12997
|
if (!autoOpen) return toggles;
|
|
12918
|
-
return /* @__PURE__ */
|
|
12998
|
+
return /* @__PURE__ */ jsxs44(
|
|
12919
12999
|
Popover6,
|
|
12920
13000
|
{
|
|
12921
13001
|
defaultOpen: true,
|
|
@@ -12923,15 +13003,15 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12923
13003
|
if (!open) onClose?.();
|
|
12924
13004
|
},
|
|
12925
13005
|
children: [
|
|
12926
|
-
/* @__PURE__ */
|
|
12927
|
-
/* @__PURE__ */
|
|
13006
|
+
/* @__PURE__ */ jsx49(PopoverTrigger6, { asChild: true, children: /* @__PURE__ */ jsx49(Button21, { id, type: "button", size: "sm", variant: "outline", className: "h-6 max-w-full truncate", children: chosen.length === 0 ? "Choose" : chosen.map(titleOf).join(", ") }) }),
|
|
13007
|
+
/* @__PURE__ */ jsx49(PopoverContent6, { sizing: "content", className: "max-w-[20rem] p-2", align: "start", children: toggles })
|
|
12928
13008
|
]
|
|
12929
13009
|
}
|
|
12930
13010
|
);
|
|
12931
13011
|
}
|
|
12932
13012
|
const current = options.find((option) => isTheChosen(option, value));
|
|
12933
|
-
return /* @__PURE__ */
|
|
12934
|
-
|
|
13013
|
+
return /* @__PURE__ */ jsxs44(
|
|
13014
|
+
Select7,
|
|
12935
13015
|
{
|
|
12936
13016
|
value: current ? optionKey6(current) : "",
|
|
12937
13017
|
disabled: disabled ?? false,
|
|
@@ -12944,8 +13024,8 @@ function OptionControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
12944
13024
|
}
|
|
12945
13025
|
} : {},
|
|
12946
13026
|
children: [
|
|
12947
|
-
/* @__PURE__ */
|
|
12948
|
-
/* @__PURE__ */
|
|
13027
|
+
/* @__PURE__ */ jsx49(SelectTrigger7, { id, size: "sm", children: /* @__PURE__ */ jsx49(SelectValue7, { placeholder: "Choose" }) }),
|
|
13028
|
+
/* @__PURE__ */ jsx49(SelectContent7, { children: options.map((option) => /* @__PURE__ */ jsx49(SelectItem7, { value: optionKey6(option), children: titleOf(option) }, option.id)) })
|
|
12949
13029
|
]
|
|
12950
13030
|
}
|
|
12951
13031
|
);
|
|
@@ -12967,16 +13047,16 @@ function OpenChoicePicker({
|
|
|
12967
13047
|
}) {
|
|
12968
13048
|
const client = useOptionalRecordsClient12();
|
|
12969
13049
|
const nudge = useChoiceNudge();
|
|
12970
|
-
const [open, setOpenState] =
|
|
13050
|
+
const [open, setOpenState] = useState38(autoOpen === true);
|
|
12971
13051
|
const onCloseRef = useRef19(onClose);
|
|
12972
13052
|
onCloseRef.current = onClose;
|
|
12973
13053
|
const setOpen = useCallback8((next) => {
|
|
12974
13054
|
setOpenState(next);
|
|
12975
13055
|
if (!next) onCloseRef.current?.();
|
|
12976
13056
|
}, []);
|
|
12977
|
-
const [search, setSearch] =
|
|
12978
|
-
const [adding, setAdding] =
|
|
12979
|
-
const [addRefused, setAddRefused] =
|
|
13057
|
+
const [search, setSearch] = useState38(initialSearch ?? "");
|
|
13058
|
+
const [adding, setAdding] = useState38(false);
|
|
13059
|
+
const [addRefused, setAddRefused] = useState38(null);
|
|
12980
13060
|
const titleOf = (option) => recordName(option.data, null, "Unnamed choice");
|
|
12981
13061
|
const held = withoutAddition(value);
|
|
12982
13062
|
const current = choiceValuesOf(held.value);
|
|
@@ -13034,7 +13114,7 @@ function OpenChoicePicker({
|
|
|
13034
13114
|
const pickedOptions = current.map((v) => options.find((o) => isTheChosen(o, v)));
|
|
13035
13115
|
const cellChips = pickedWords.map((word, i) => {
|
|
13036
13116
|
const chip = chipOf(pickedOptions[i], word);
|
|
13037
|
-
return /* @__PURE__ */
|
|
13117
|
+
return /* @__PURE__ */ jsx49(Badge7, { variant: "outline", className: cn23("text-[11px]", chip.className), "data-records-choice-chip": "", children: word }, word);
|
|
13038
13118
|
});
|
|
13039
13119
|
const headChips = pickedWords.map((word, i) => {
|
|
13040
13120
|
const option = pickedOptions[i];
|
|
@@ -13049,12 +13129,12 @@ function OpenChoicePicker({
|
|
|
13049
13129
|
};
|
|
13050
13130
|
});
|
|
13051
13131
|
const anchored = autoOpen === true;
|
|
13052
|
-
return /* @__PURE__ */
|
|
13132
|
+
return /* @__PURE__ */ jsxs44("div", { id, className: "flex flex-wrap items-center gap-1", children: [
|
|
13053
13133
|
anchored || disabled ? null : cellChips,
|
|
13054
13134
|
disabled ? cellChips : (
|
|
13055
13135
|
// THE ONE "PICK OR ADD" BUILDER (PickOrAdd.tsx) — the relation picker draws the same one.
|
|
13056
13136
|
// In a grid cell it hangs from the cell's own chips; no button is drawn in the cell.
|
|
13057
|
-
/* @__PURE__ */
|
|
13137
|
+
/* @__PURE__ */ jsx49(
|
|
13058
13138
|
PickOrAdd,
|
|
13059
13139
|
{
|
|
13060
13140
|
anchored,
|
|
@@ -13080,14 +13160,14 @@ function OpenChoicePicker({
|
|
|
13080
13160
|
const option = options.find((o) => o.id === optionId);
|
|
13081
13161
|
if (option) choose(optionKey6(option));
|
|
13082
13162
|
},
|
|
13083
|
-
empty: q === "" ? /* @__PURE__ */
|
|
13163
|
+
empty: q === "" ? /* @__PURE__ */ jsx49("p", { className: "p-2 text-xs text-muted-foreground", children: "No choices yet \u2014 type one to add it." }) : null,
|
|
13084
13164
|
add,
|
|
13085
13165
|
foot,
|
|
13086
|
-
footNote: addRefused ? /* @__PURE__ */
|
|
13166
|
+
footNote: addRefused ? /* @__PURE__ */ jsx49(RefusalLine, { error: addRefused }) : offList && decided.decision === "not_a_choice" ? (
|
|
13087
13167
|
// never_add on a column that takes only its choices: said, never a silent nothing.
|
|
13088
|
-
/* @__PURE__ */
|
|
13089
|
-
/* @__PURE__ */
|
|
13090
|
-
autoOpen ? /* @__PURE__ */
|
|
13168
|
+
/* @__PURE__ */ jsxs44(Fragment16, { children: [
|
|
13169
|
+
/* @__PURE__ */ jsx49("p", { "data-records-typed-refusal": "", className: "p-2 text-xs text-muted-foreground", children: notAChoiceSentence(field2, [q]) }),
|
|
13170
|
+
autoOpen ? /* @__PURE__ */ jsx49("span", { "data-records-choice-ask": "", className: "px-2 pb-1", children: /* @__PURE__ */ jsx49(Button21, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-2 text-xs", onClick: () => setOpen(false), children: "Cancel" }) }) : null
|
|
13091
13171
|
] })
|
|
13092
13172
|
) : null,
|
|
13093
13173
|
children: anchored ? cellChips : null
|
|
@@ -13107,9 +13187,9 @@ function RecordChip({
|
|
|
13107
13187
|
// name. So it caps at its container and ends in an ellipsis with the whole name in
|
|
13108
13188
|
// its tooltip, rather than being cut mid-word by whatever box it landed in
|
|
13109
13189
|
// (lane FIX-14, 2026-09-22).
|
|
13110
|
-
/* @__PURE__ */
|
|
13111
|
-
/* @__PURE__ */
|
|
13112
|
-
onRemove ? /* @__PURE__ */
|
|
13190
|
+
/* @__PURE__ */ jsxs44(Badge7, { variant: "secondary", className: cn23("max-w-full gap-1 text-[11px]", className), title, children: [
|
|
13191
|
+
/* @__PURE__ */ jsx49("span", { className: "min-w-0 truncate", children: title }),
|
|
13192
|
+
onRemove ? /* @__PURE__ */ jsx49("button", { type: "button", onClick: onRemove, "aria-label": `Remove ${title}`, className: "shrink-0 opacity-60 hover:opacity-100", children: "\xD7" }) : null
|
|
13113
13193
|
] })
|
|
13114
13194
|
);
|
|
13115
13195
|
}
|
|
@@ -13133,7 +13213,7 @@ function ChoiceAnswer({
|
|
|
13133
13213
|
isChosen,
|
|
13134
13214
|
onChosen
|
|
13135
13215
|
}) {
|
|
13136
|
-
const [search, setSearch] =
|
|
13216
|
+
const [search, setSearch] = useState38("");
|
|
13137
13217
|
const held = field2.multi ? choiceValuesOf(value) : value === null || value === void 0 || value === "" ? [] : [value];
|
|
13138
13218
|
const on = (choice) => held.some((v) => isChosen ? isChosen(choice, v) : String(v) === choice.key || String(v) === choice.label);
|
|
13139
13219
|
const press = (choice) => {
|
|
@@ -13151,7 +13231,7 @@ function ChoiceAnswer({
|
|
|
13151
13231
|
const option = (choice) => {
|
|
13152
13232
|
const chosen = on(choice);
|
|
13153
13233
|
const letter = lettered ? CHOICE_LETTERS[choices.indexOf(choice)] : null;
|
|
13154
|
-
return /* @__PURE__ */
|
|
13234
|
+
return /* @__PURE__ */ jsxs44(
|
|
13155
13235
|
"button",
|
|
13156
13236
|
{
|
|
13157
13237
|
type: "button",
|
|
@@ -13167,7 +13247,7 @@ function ChoiceAnswer({
|
|
|
13167
13247
|
chosen ? "border-primary bg-primary/10" : "border-primary/30 bg-primary/[0.03] hover:bg-primary/10"
|
|
13168
13248
|
),
|
|
13169
13249
|
children: [
|
|
13170
|
-
letter ? /* @__PURE__ */
|
|
13250
|
+
letter ? /* @__PURE__ */ jsx49(
|
|
13171
13251
|
"kbd",
|
|
13172
13252
|
{
|
|
13173
13253
|
"aria-hidden": "true",
|
|
@@ -13178,8 +13258,8 @@ function ChoiceAnswer({
|
|
|
13178
13258
|
children: letter
|
|
13179
13259
|
}
|
|
13180
13260
|
) : null,
|
|
13181
|
-
/* @__PURE__ */
|
|
13182
|
-
chosen ? /* @__PURE__ */
|
|
13261
|
+
/* @__PURE__ */ jsx49("span", { className: "min-w-0 flex-1 break-words", children: choice.label }),
|
|
13262
|
+
chosen ? /* @__PURE__ */ jsx49("span", { "aria-hidden": "true", className: "shrink-0 text-primary", children: "\u2713" }) : null
|
|
13183
13263
|
]
|
|
13184
13264
|
},
|
|
13185
13265
|
choice.key
|
|
@@ -13212,12 +13292,12 @@ function ChoiceAnswer({
|
|
|
13212
13292
|
};
|
|
13213
13293
|
const group = { role: field2.multi ? "group" : "radiogroup", "aria-label": fieldName(field2), onKeyDown };
|
|
13214
13294
|
if (choices.length <= FORM_SEARCH_AFTER) {
|
|
13215
|
-
return /* @__PURE__ */
|
|
13295
|
+
return /* @__PURE__ */ jsx49("div", { id, className: "flex w-full flex-col gap-2", ...group, children: choices.map(option) });
|
|
13216
13296
|
}
|
|
13217
13297
|
const q = search.trim().toLowerCase();
|
|
13218
13298
|
const shown2 = q === "" ? choices : choices.filter((c) => c.label.toLowerCase().includes(q));
|
|
13219
|
-
return /* @__PURE__ */
|
|
13220
|
-
/* @__PURE__ */
|
|
13299
|
+
return /* @__PURE__ */ jsxs44("div", { id, className: "flex w-full flex-col gap-2", onKeyDown, children: [
|
|
13300
|
+
/* @__PURE__ */ jsx49(
|
|
13221
13301
|
BasicInput10,
|
|
13222
13302
|
{
|
|
13223
13303
|
value: search,
|
|
@@ -13228,15 +13308,15 @@ function ChoiceAnswer({
|
|
|
13228
13308
|
className: "h-11 text-base sm:h-9 sm:text-sm"
|
|
13229
13309
|
}
|
|
13230
13310
|
),
|
|
13231
|
-
/* @__PURE__ */
|
|
13311
|
+
/* @__PURE__ */ jsxs44("div", { className: "flex max-h-80 w-full flex-col gap-2 overflow-y-auto", role: group.role, "aria-label": group["aria-label"], children: [
|
|
13232
13312
|
shown2.map(option),
|
|
13233
|
-
shown2.length === 0 ? /* @__PURE__ */
|
|
13313
|
+
shown2.length === 0 ? /* @__PURE__ */ jsx49("p", { className: "text-xs text-muted-foreground", children: "No match" }) : null
|
|
13234
13314
|
] })
|
|
13235
13315
|
] });
|
|
13236
13316
|
}
|
|
13237
13317
|
|
|
13238
13318
|
// src/ChoiceListEditor.tsx
|
|
13239
|
-
import { Fragment as Fragment17, jsx as
|
|
13319
|
+
import { Fragment as Fragment17, jsx as jsx50, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
13240
13320
|
var rowSeed = 0;
|
|
13241
13321
|
var nextRow = () => `new-${rowSeed += 1}`;
|
|
13242
13322
|
function choiceRowsFrom(options, field2) {
|
|
@@ -13278,13 +13358,13 @@ function ChoiceListEditor({
|
|
|
13278
13358
|
rehome = {},
|
|
13279
13359
|
onRehome
|
|
13280
13360
|
}) {
|
|
13281
|
-
const client =
|
|
13282
|
-
const [refused, setRefused] =
|
|
13283
|
-
const [usage, setUsage] =
|
|
13284
|
-
const [asking, setAsking] =
|
|
13285
|
-
const [moveTo, setMoveTo] =
|
|
13361
|
+
const client = useRecordsClient15();
|
|
13362
|
+
const [refused, setRefused] = useState39(null);
|
|
13363
|
+
const [usage, setUsage] = useState39(null);
|
|
13364
|
+
const [asking, setAsking] = useState39(null);
|
|
13365
|
+
const [moveTo, setMoveTo] = useState39("");
|
|
13286
13366
|
const focusRow = useRef20(null);
|
|
13287
|
-
const [removed, setRemoved] =
|
|
13367
|
+
const [removed, setRemoved] = useState39({});
|
|
13288
13368
|
const fieldId = field2?.id ?? null;
|
|
13289
13369
|
useEffect27(() => {
|
|
13290
13370
|
if (rows !== null || !fieldId || !field2) return;
|
|
@@ -13317,12 +13397,12 @@ function ChoiceListEditor({
|
|
|
13317
13397
|
};
|
|
13318
13398
|
}, [client, fieldId, onRehome]);
|
|
13319
13399
|
if (refused) {
|
|
13320
|
-
return /* @__PURE__ */
|
|
13400
|
+
return /* @__PURE__ */ jsxs45("p", { className: "text-[11px] text-muted-foreground", "data-records-choice-list": "", children: [
|
|
13321
13401
|
"The choices could not be read, so they are left as they are: ",
|
|
13322
13402
|
refused
|
|
13323
13403
|
] });
|
|
13324
13404
|
}
|
|
13325
|
-
if (rows === null) return /* @__PURE__ */
|
|
13405
|
+
if (rows === null) return /* @__PURE__ */ jsx50("p", { className: "text-[11px] text-muted-foreground", children: "Reading this column\u2019s choices\u2026" });
|
|
13326
13406
|
const set = (index, words) => onRows(rows.map((r, i) => i === index ? { ...r, words } : r));
|
|
13327
13407
|
const paint = (index, color) => onRows(rows.map((r, i) => i === index ? { ...r, color } : r));
|
|
13328
13408
|
const addRow = () => {
|
|
@@ -13380,12 +13460,12 @@ function ChoiceListEditor({
|
|
|
13380
13460
|
};
|
|
13381
13461
|
const targets = rows.filter((r) => r.id && r.id !== asking?.id && r.words.trim() !== "");
|
|
13382
13462
|
const wordsOf = (id) => rows.find((r) => r.id === id)?.words.trim() ?? usage?.[id]?.words ?? "";
|
|
13383
|
-
return /* @__PURE__ */
|
|
13384
|
-
/* @__PURE__ */
|
|
13385
|
-
rows.length === 0 ? /* @__PURE__ */
|
|
13386
|
-
/* @__PURE__ */
|
|
13387
|
-
/* @__PURE__ */
|
|
13388
|
-
/* @__PURE__ */
|
|
13463
|
+
return /* @__PURE__ */ jsxs45("div", { className: "flex flex-col gap-1", "data-records-choice-list": "", children: [
|
|
13464
|
+
/* @__PURE__ */ jsx50(Label13, { className: "text-xs", children: "The choices" }),
|
|
13465
|
+
rows.length === 0 ? /* @__PURE__ */ jsx50("p", { className: "text-xs text-muted-foreground", "data-records-choice-list-empty": "", children: "No choices yet." }) : null,
|
|
13466
|
+
/* @__PURE__ */ jsx50("ul", { className: "flex flex-col gap-1", children: rows.map((r, i) => /* @__PURE__ */ jsxs45("li", { className: "flex items-center gap-1", "data-records-choice-row": "", children: [
|
|
13467
|
+
/* @__PURE__ */ jsx50(ChoiceSwatch, { words: r.words.trim() === "" ? `choice ${i + 1}` : r.words.trim(), color: r.color ?? null, onColor: (c) => paint(i, c) }),
|
|
13468
|
+
/* @__PURE__ */ jsx50(
|
|
13389
13469
|
BasicInput11,
|
|
13390
13470
|
{
|
|
13391
13471
|
value: r.words,
|
|
@@ -13401,13 +13481,13 @@ function ChoiceListEditor({
|
|
|
13401
13481
|
onKeyDown: enterAdds(i)
|
|
13402
13482
|
}
|
|
13403
13483
|
),
|
|
13404
|
-
/* @__PURE__ */
|
|
13405
|
-
/* @__PURE__ */
|
|
13406
|
-
/* @__PURE__ */
|
|
13484
|
+
/* @__PURE__ */ jsx50(Button22, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} up`, disabled: i === 0, onClick: () => move(i, -1), children: "\u2191" }),
|
|
13485
|
+
/* @__PURE__ */ jsx50(Button22, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Move ${named(r, i)} down`, disabled: i === rows.length - 1, onClick: () => move(i, 1), children: "\u2193" }),
|
|
13486
|
+
/* @__PURE__ */ jsx50(Button22, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-1.5 text-xs", "aria-label": `Remove ${named(r, i)}`, onClick: () => remove(i), children: "\xD7" })
|
|
13407
13487
|
] }, r.row)) }),
|
|
13408
13488
|
asking ? (
|
|
13409
13489
|
// THE QUESTION, Notion-style: where do the records that hold it go?
|
|
13410
|
-
/* @__PURE__ */
|
|
13490
|
+
/* @__PURE__ */ jsxs45(
|
|
13411
13491
|
"div",
|
|
13412
13492
|
{
|
|
13413
13493
|
role: "group",
|
|
@@ -13415,41 +13495,41 @@ function ChoiceListEditor({
|
|
|
13415
13495
|
"data-records-choice-removal-ask": "",
|
|
13416
13496
|
className: "flex flex-col gap-1 rounded border bg-muted/40 p-2",
|
|
13417
13497
|
children: [
|
|
13418
|
-
/* @__PURE__ */
|
|
13419
|
-
/* @__PURE__ */
|
|
13420
|
-
targets.length > 0 ? /* @__PURE__ */
|
|
13421
|
-
/* @__PURE__ */
|
|
13422
|
-
/* @__PURE__ */
|
|
13423
|
-
/* @__PURE__ */
|
|
13424
|
-
/* @__PURE__ */
|
|
13498
|
+
/* @__PURE__ */ jsx50("p", { className: "text-xs", children: recordsUseSentence(heldBy(asking), asking.words.trim()) }),
|
|
13499
|
+
/* @__PURE__ */ jsxs45("div", { className: "flex flex-wrap items-center gap-1", children: [
|
|
13500
|
+
targets.length > 0 ? /* @__PURE__ */ jsxs45(Fragment17, { children: [
|
|
13501
|
+
/* @__PURE__ */ jsx50(Button22, { type: "button", size: "sm", className: "h-7 px-2 text-xs", disabled: moveTo === "", onClick: () => answer({ then: "move", to: moveTo }), children: "Move them to" }),
|
|
13502
|
+
/* @__PURE__ */ jsxs45(Select8, { value: moveTo, onValueChange: setMoveTo, children: [
|
|
13503
|
+
/* @__PURE__ */ jsx50(SelectTrigger8, { size: "sm", className: "h-7 w-36 text-xs", "aria-label": "Another choice", children: /* @__PURE__ */ jsx50(SelectValue8, { placeholder: "Another choice" }) }),
|
|
13504
|
+
/* @__PURE__ */ jsx50(SelectContent8, { children: targets.map((r) => /* @__PURE__ */ jsx50(SelectItem8, { value: r.id, children: r.words.trim() }, r.id)) })
|
|
13425
13505
|
] })
|
|
13426
13506
|
] }) : null,
|
|
13427
|
-
allowOther ? /* @__PURE__ */
|
|
13428
|
-
/* @__PURE__ */
|
|
13429
|
-
/* @__PURE__ */
|
|
13507
|
+
allowOther ? /* @__PURE__ */ jsx50(Button22, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "keep" }), children: "Keep the words as other values" }) : null,
|
|
13508
|
+
/* @__PURE__ */ jsx50(Button22, { type: "button", size: "sm", variant: "outline", className: "h-7 px-2 text-xs", onClick: () => answer({ then: "clear" }), children: "Clear them" }),
|
|
13509
|
+
/* @__PURE__ */ jsx50(Button22, { type: "button", size: "sm", variant: "ghost", className: "h-7 px-2 text-xs", onClick: () => setAsking(null), children: "Cancel" })
|
|
13430
13510
|
] })
|
|
13431
13511
|
]
|
|
13432
13512
|
}
|
|
13433
13513
|
)
|
|
13434
13514
|
) : null,
|
|
13435
13515
|
Object.entries(rehome).map(
|
|
13436
|
-
([id, spec]) => removed[id] ? /* @__PURE__ */
|
|
13437
|
-
/* @__PURE__ */
|
|
13438
|
-
/* @__PURE__ */
|
|
13516
|
+
([id, spec]) => removed[id] ? /* @__PURE__ */ jsxs45("div", { className: "flex items-center justify-between gap-2 text-[11px] text-muted-foreground", "data-records-choice-rehome": "", children: [
|
|
13517
|
+
/* @__PURE__ */ jsx50("span", { children: rehomeSentence(usage?.[id]?.records ?? 0, removed[id].row.words.trim(), spec, spec.then === "move" ? wordsOf(spec.to) : void 0) }),
|
|
13518
|
+
/* @__PURE__ */ jsx50(Button22, { type: "button", size: "sm", variant: "ghost", className: "h-6 px-1.5 text-[11px]", onClick: () => putBack(id), children: "Put it back" })
|
|
13439
13519
|
] }, id) : null
|
|
13440
13520
|
),
|
|
13441
|
-
/* @__PURE__ */
|
|
13442
|
-
isNew ? null : /* @__PURE__ */
|
|
13521
|
+
/* @__PURE__ */ jsx50(Button22, { type: "button", size: "sm", variant: "outline", className: "h-7 self-start text-xs", onClick: addRow, children: "Add a choice" }),
|
|
13522
|
+
isNew ? null : /* @__PURE__ */ jsx50("p", { className: "text-[11px] text-muted-foreground", children: "Changing a choice\u2019s words changes them in every record that holds it. Removing a choice that records hold asks where those records go." })
|
|
13443
13523
|
] });
|
|
13444
13524
|
}
|
|
13445
13525
|
function ChoiceSwatch({ words, color, onColor }) {
|
|
13446
|
-
const [open, setOpen] =
|
|
13526
|
+
const [open, setOpen] = useState39(false);
|
|
13447
13527
|
const pick = (next) => {
|
|
13448
13528
|
onColor(next);
|
|
13449
13529
|
setOpen(false);
|
|
13450
13530
|
};
|
|
13451
|
-
return /* @__PURE__ */
|
|
13452
|
-
/* @__PURE__ */
|
|
13531
|
+
return /* @__PURE__ */ jsxs45(Popover7, { open, onOpenChange: setOpen, children: [
|
|
13532
|
+
/* @__PURE__ */ jsx50(PopoverTrigger7, { asChild: true, children: /* @__PURE__ */ jsx50(
|
|
13453
13533
|
"button",
|
|
13454
13534
|
{
|
|
13455
13535
|
type: "button",
|
|
@@ -13462,8 +13542,8 @@ function ChoiceSwatch({ words, color, onColor }) {
|
|
|
13462
13542
|
)
|
|
13463
13543
|
}
|
|
13464
13544
|
) }),
|
|
13465
|
-
/* @__PURE__ */
|
|
13466
|
-
/* @__PURE__ */
|
|
13545
|
+
/* @__PURE__ */ jsx50(PopoverContent7, { sizing: "content", align: "start", className: "p-2", children: /* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": `Color for ${words}`, children: [
|
|
13546
|
+
/* @__PURE__ */ jsx50(
|
|
13467
13547
|
"button",
|
|
13468
13548
|
{
|
|
13469
13549
|
type: "button",
|
|
@@ -13475,7 +13555,7 @@ function ChoiceSwatch({ words, color, onColor }) {
|
|
|
13475
13555
|
className: cn24("h-5 w-5 rounded-full border border-border bg-background", color === null && "ring-2 ring-ring ring-offset-1")
|
|
13476
13556
|
}
|
|
13477
13557
|
),
|
|
13478
|
-
STYLE_COLORS3.map((c) => /* @__PURE__ */
|
|
13558
|
+
STYLE_COLORS3.map((c) => /* @__PURE__ */ jsx50(
|
|
13479
13559
|
"button",
|
|
13480
13560
|
{
|
|
13481
13561
|
type: "button",
|
|
@@ -13583,7 +13663,7 @@ function PersonNamesBridge() {
|
|
|
13583
13663
|
}
|
|
13584
13664
|
|
|
13585
13665
|
// src/RecordsMount.tsx
|
|
13586
|
-
import { jsx as
|
|
13666
|
+
import { jsx as jsx51, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
13587
13667
|
var STORE_DECIDES_REASON = "This host offers exactly what this person may do, so a control they cannot use is never drawn in the first place.";
|
|
13588
13668
|
function storeDecidesRights(_table) {
|
|
13589
13669
|
return NO_RIGHTS;
|
|
@@ -13596,8 +13676,8 @@ function RecordsMount({
|
|
|
13596
13676
|
}) {
|
|
13597
13677
|
const bound2 = useShallowStableHost(host);
|
|
13598
13678
|
void letTheStoreDecideRights;
|
|
13599
|
-
return /* @__PURE__ */
|
|
13600
|
-
/* @__PURE__ */
|
|
13679
|
+
return /* @__PURE__ */ jsx51(RecordsProvider, { config, children: /* @__PURE__ */ jsx51(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsxs46(RecordLabelProvider, { children: [
|
|
13680
|
+
/* @__PURE__ */ jsx51(PersonNamesBridge, {}),
|
|
13601
13681
|
children
|
|
13602
13682
|
] }) }) });
|
|
13603
13683
|
}
|
|
@@ -13619,11 +13699,11 @@ function sameParts(a, b) {
|
|
|
13619
13699
|
}
|
|
13620
13700
|
|
|
13621
13701
|
// src/TablePickers.tsx
|
|
13622
|
-
import { useEffect as useEffect29, useMemo as useMemo16, useState as
|
|
13702
|
+
import { useEffect as useEffect29, useMemo as useMemo16, useState as useState40 } from "react";
|
|
13623
13703
|
import { RecordsProvider as RecordsProvider2, useFields as useFields6, useRecords as useRecords3, useTable as useTable5 } from "@ai-matrx/records/react";
|
|
13624
13704
|
import { Button as Button23, CreatablePicker, displayId } from "@ai-matrx/design-system";
|
|
13625
13705
|
import { momentZoneOptions as momentZoneOptions2 } from "@ai-matrx/design-system/field-formats";
|
|
13626
|
-
import { Fragment as Fragment18, jsx as
|
|
13706
|
+
import { Fragment as Fragment18, jsx as jsx52, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
13627
13707
|
var SHARED_FOR_MS = 5e3;
|
|
13628
13708
|
var sharedReads = /* @__PURE__ */ new WeakMap();
|
|
13629
13709
|
function readTablesAnywhere(dataSource) {
|
|
@@ -13655,7 +13735,7 @@ function readTablesAnywhere(dataSource) {
|
|
|
13655
13735
|
return read;
|
|
13656
13736
|
}
|
|
13657
13737
|
function useTablesAnywhere(dataSource) {
|
|
13658
|
-
const [state, setState] =
|
|
13738
|
+
const [state, setState] = useState40({ loading: true, error: null, rows: [] });
|
|
13659
13739
|
useEffect29(() => {
|
|
13660
13740
|
let live = true;
|
|
13661
13741
|
void readTablesAnywhere(dataSource).then((result) => {
|
|
@@ -13693,16 +13773,16 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
13693
13773
|
hint: t.organization_name,
|
|
13694
13774
|
keywords: t.organization_name,
|
|
13695
13775
|
...twin && second ? {
|
|
13696
|
-
render: /* @__PURE__ */
|
|
13697
|
-
/* @__PURE__ */
|
|
13698
|
-
/* @__PURE__ */
|
|
13776
|
+
render: /* @__PURE__ */ jsxs47("span", { className: "flex min-w-0 flex-col", children: [
|
|
13777
|
+
/* @__PURE__ */ jsx52("span", { className: "truncate", children: t.table_name }),
|
|
13778
|
+
/* @__PURE__ */ jsx52("span", { className: "truncate text-[11px] text-muted-foreground", children: second })
|
|
13699
13779
|
] })
|
|
13700
13780
|
} : {}
|
|
13701
13781
|
};
|
|
13702
13782
|
});
|
|
13703
13783
|
const missing = Boolean(value) && !list.loading && !list.error && !list.rows.some((t) => t.table_id === value);
|
|
13704
|
-
return /* @__PURE__ */
|
|
13705
|
-
/* @__PURE__ */
|
|
13784
|
+
return /* @__PURE__ */ jsxs47("div", { className: "flex flex-col gap-1", children: [
|
|
13785
|
+
/* @__PURE__ */ jsx52(
|
|
13706
13786
|
CreatablePicker,
|
|
13707
13787
|
{
|
|
13708
13788
|
value: value || null,
|
|
@@ -13716,24 +13796,24 @@ function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
|
13716
13796
|
ariaLabel: "Table"
|
|
13717
13797
|
}
|
|
13718
13798
|
),
|
|
13719
|
-
list.error && /* @__PURE__ */
|
|
13720
|
-
missing && /* @__PURE__ */
|
|
13799
|
+
list.error && /* @__PURE__ */ jsx52(RefusalLine, { error: (0, refusals_exports.refusal)("door", list.error, "Try again in a moment.") }),
|
|
13800
|
+
missing && /* @__PURE__ */ jsx52("p", { className: "text-[11px] text-destructive", children: "This table is archived or not shared with you." })
|
|
13721
13801
|
] });
|
|
13722
13802
|
}
|
|
13723
13803
|
function TableScope({ dataSource, userId, tableId, children, fallback = null, unavailable, tables }) {
|
|
13724
13804
|
const own3 = useTablesAnywhere(dataSource);
|
|
13725
13805
|
const list = tables ?? own3;
|
|
13726
13806
|
const organizationId = list.rows.find((t) => t.table_id === tableId)?.organization_id ?? null;
|
|
13727
|
-
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */
|
|
13728
|
-
if (!tableId || !organizationId) return /* @__PURE__ */
|
|
13729
|
-
return /* @__PURE__ */
|
|
13807
|
+
if (tableId && !organizationId && !list.loading) return /* @__PURE__ */ jsx52(Fragment18, { children: unavailable ?? fallback });
|
|
13808
|
+
if (!tableId || !organizationId) return /* @__PURE__ */ jsx52(Fragment18, { children: fallback });
|
|
13809
|
+
return /* @__PURE__ */ jsx52(RecordsProvider2, { config: { dataSource, actor: personActor(userId), organizationId }, children });
|
|
13730
13810
|
}
|
|
13731
13811
|
function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
13732
13812
|
const fields = useFields6(tableId);
|
|
13733
13813
|
const all = useMemo16(() => fields.data ?? [], [fields.data]);
|
|
13734
13814
|
const byKey = useMemo16(() => new Map(all.map((f) => [f.key, f])), [all]);
|
|
13735
13815
|
const keys = Object.keys(value);
|
|
13736
|
-
const [adding, setAdding] =
|
|
13816
|
+
const [adding, setAdding] = useState40(false);
|
|
13737
13817
|
const optionsFor = (current) => all.filter((f) => f.key === current || !(f.key in value)).map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
13738
13818
|
const rename = (from, to) => {
|
|
13739
13819
|
if (from === to) return;
|
|
@@ -13746,11 +13826,11 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
13746
13826
|
void _gone;
|
|
13747
13827
|
onChange(rest);
|
|
13748
13828
|
};
|
|
13749
|
-
return /* @__PURE__ */
|
|
13750
|
-
fields.error && /* @__PURE__ */
|
|
13829
|
+
return /* @__PURE__ */ jsxs47("div", { className: "flex flex-col gap-2", children: [
|
|
13830
|
+
fields.error && /* @__PURE__ */ jsx52(RefusalLine, { error: fields.error }),
|
|
13751
13831
|
keys.map((key) => {
|
|
13752
13832
|
const field2 = byKey.get(key);
|
|
13753
|
-
return /* @__PURE__ */
|
|
13833
|
+
return /* @__PURE__ */ jsx52(
|
|
13754
13834
|
ColumnValueRow,
|
|
13755
13835
|
{
|
|
13756
13836
|
columnKey: key,
|
|
@@ -13766,7 +13846,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
13766
13846
|
key
|
|
13767
13847
|
);
|
|
13768
13848
|
}),
|
|
13769
|
-
adding && /* @__PURE__ */
|
|
13849
|
+
adding && /* @__PURE__ */ jsx52(
|
|
13770
13850
|
ColumnValueRow,
|
|
13771
13851
|
{
|
|
13772
13852
|
columnKey: null,
|
|
@@ -13783,7 +13863,7 @@ function ColumnValuesEditor({ tableId, value, onChange, disabled, addLabel }) {
|
|
|
13783
13863
|
onRemove: () => setAdding(false)
|
|
13784
13864
|
}
|
|
13785
13865
|
),
|
|
13786
|
-
!disabled && !adding && keys.length < all.length && /* @__PURE__ */
|
|
13866
|
+
!disabled && !adding && keys.length < all.length && /* @__PURE__ */ jsx52(Button23, { type: "button", variant: "outline", size: "sm", className: "self-start", onClick: () => setAdding(true), children: addLabel })
|
|
13787
13867
|
] });
|
|
13788
13868
|
}
|
|
13789
13869
|
function ColumnValueRow({
|
|
@@ -13799,9 +13879,9 @@ function ColumnValueRow({
|
|
|
13799
13879
|
}) {
|
|
13800
13880
|
const orphan = columnKey !== null && !loading && field2 === void 0;
|
|
13801
13881
|
const shown2 = orphan ? [{ value: columnKey, label: columnKey, hint: "Not a column" }, ...options] : options;
|
|
13802
|
-
return /* @__PURE__ */
|
|
13803
|
-
/* @__PURE__ */
|
|
13804
|
-
/* @__PURE__ */
|
|
13882
|
+
return /* @__PURE__ */ jsxs47("div", { className: "flex flex-col gap-1 rounded-md border border-border/60 p-2", children: [
|
|
13883
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-2", children: [
|
|
13884
|
+
/* @__PURE__ */ jsx52("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx52(
|
|
13805
13885
|
CreatablePicker,
|
|
13806
13886
|
{
|
|
13807
13887
|
value: columnKey,
|
|
@@ -13815,9 +13895,9 @@ function ColumnValueRow({
|
|
|
13815
13895
|
ariaLabel: "Column"
|
|
13816
13896
|
}
|
|
13817
13897
|
) }),
|
|
13818
|
-
!disabled && /* @__PURE__ */
|
|
13898
|
+
!disabled && /* @__PURE__ */ jsx52(Button23, { type: "button", variant: "ghost", size: "sm", "aria-label": "Remove", onClick: onRemove, children: "\u2715" })
|
|
13819
13899
|
] }),
|
|
13820
|
-
field2 ? /* @__PURE__ */
|
|
13900
|
+
field2 ? /* @__PURE__ */ jsx52(FieldControl, { field: field2, value, onChange: onValue, disabled }) : orphan ? /* @__PURE__ */ jsx52("p", { className: "text-[11px] text-muted-foreground", children: value === null || value === void 0 ? "\u2014" : String(value) }) : null
|
|
13821
13901
|
] });
|
|
13822
13902
|
}
|
|
13823
13903
|
function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
@@ -13829,8 +13909,8 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
13829
13909
|
label: rowNameIn(table.data ?? null, row)
|
|
13830
13910
|
}));
|
|
13831
13911
|
const missing = Boolean(value) && !records.loading && !records.error && !rows.some((r) => r.id === value);
|
|
13832
|
-
return /* @__PURE__ */
|
|
13833
|
-
/* @__PURE__ */
|
|
13912
|
+
return /* @__PURE__ */ jsxs47("div", { className: "flex flex-col gap-1", children: [
|
|
13913
|
+
/* @__PURE__ */ jsx52(
|
|
13834
13914
|
CreatablePicker,
|
|
13835
13915
|
{
|
|
13836
13916
|
value: value || null,
|
|
@@ -13844,7 +13924,7 @@ function RecordPicker({ tableId, value, onChange, disabled }) {
|
|
|
13844
13924
|
ariaLabel: "Record"
|
|
13845
13925
|
}
|
|
13846
13926
|
),
|
|
13847
|
-
records.error && /* @__PURE__ */
|
|
13927
|
+
records.error && /* @__PURE__ */ jsx52(RefusalLine, { error: records.error })
|
|
13848
13928
|
] });
|
|
13849
13929
|
}
|
|
13850
13930
|
|
|
@@ -13853,7 +13933,7 @@ import { useEffect as useEffect30, useMemo as useMemo17 } from "react";
|
|
|
13853
13933
|
import { isEntityReferenceConfig } from "@ai-matrx/records";
|
|
13854
13934
|
import { useFields as useFields7, useTable as useTable6 } from "@ai-matrx/records/react";
|
|
13855
13935
|
import { BasicInput as BasicInput12, Button as Button24, CreatablePicker as CreatablePicker2, cn as cn25 } from "@ai-matrx/design-system";
|
|
13856
|
-
import { jsx as
|
|
13936
|
+
import { jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
13857
13937
|
var DATA_BINDING_SHAPES = [
|
|
13858
13938
|
{ value: "collection", label: "The whole table" },
|
|
13859
13939
|
{ value: "reference", label: "One record" },
|
|
@@ -13920,9 +14000,9 @@ function DataBindingPicker({ dataSource, userId, binding, onChange, disabled, de
|
|
|
13920
14000
|
...binding.semantic_type === "collection" && defaultRowLimit ? { limit: defaultRowLimit } : {}
|
|
13921
14001
|
});
|
|
13922
14002
|
};
|
|
13923
|
-
return /* @__PURE__ */
|
|
13924
|
-
/* @__PURE__ */
|
|
13925
|
-
/* @__PURE__ */
|
|
14003
|
+
return /* @__PURE__ */ jsxs48("div", { className: "flex flex-col gap-2", children: [
|
|
14004
|
+
/* @__PURE__ */ jsx53(TablePicker, { dataSource, value: tableId, onChange: selectTable, disabled: Boolean(disabled), tables }),
|
|
14005
|
+
/* @__PURE__ */ jsx53(TableScope, { dataSource, userId, tableId, tables, children: tableId && /* @__PURE__ */ jsx53(
|
|
13926
14006
|
BindingDetails,
|
|
13927
14007
|
{
|
|
13928
14008
|
tableId,
|
|
@@ -13986,8 +14066,8 @@ function BindingDetails({
|
|
|
13986
14066
|
const fieldOptions = fieldList.map((f) => ({ value: f.key, label: fieldName(f) }));
|
|
13987
14067
|
const template = binding.transform?.template ?? "";
|
|
13988
14068
|
const setTemplate = (next) => onChange({ ...binding, transform: { join: "\n", ...binding.transform, name: "list", template: next } });
|
|
13989
|
-
return /* @__PURE__ */
|
|
13990
|
-
/* @__PURE__ */
|
|
14069
|
+
return /* @__PURE__ */ jsxs48("div", { className: "flex flex-col gap-2", children: [
|
|
14070
|
+
/* @__PURE__ */ jsx53("div", { className: "flex flex-wrap gap-1", role: "radiogroup", "aria-label": "What to read", children: DATA_BINDING_SHAPES.map((s) => /* @__PURE__ */ jsx53(
|
|
13991
14071
|
Button24,
|
|
13992
14072
|
{
|
|
13993
14073
|
type: "button",
|
|
@@ -14001,7 +14081,7 @@ function BindingDetails({
|
|
|
14001
14081
|
},
|
|
14002
14082
|
s.value
|
|
14003
14083
|
)) }),
|
|
14004
|
-
shape !== "collection" && /* @__PURE__ */
|
|
14084
|
+
shape !== "collection" && /* @__PURE__ */ jsx53(
|
|
14005
14085
|
RecordPicker,
|
|
14006
14086
|
{
|
|
14007
14087
|
tableId,
|
|
@@ -14010,7 +14090,7 @@ function BindingDetails({
|
|
|
14010
14090
|
disabled: Boolean(disabled)
|
|
14011
14091
|
}
|
|
14012
14092
|
),
|
|
14013
|
-
shape === "value" && /* @__PURE__ */
|
|
14093
|
+
shape === "value" && /* @__PURE__ */ jsx53(
|
|
14014
14094
|
CreatablePicker2,
|
|
14015
14095
|
{
|
|
14016
14096
|
value: binding.field_key ?? null,
|
|
@@ -14024,8 +14104,8 @@ function BindingDetails({
|
|
|
14024
14104
|
ariaLabel: "Column"
|
|
14025
14105
|
}
|
|
14026
14106
|
),
|
|
14027
|
-
shape !== "value" && /* @__PURE__ */
|
|
14028
|
-
/* @__PURE__ */
|
|
14107
|
+
shape !== "value" && /* @__PURE__ */ jsxs48("div", { className: "flex flex-col gap-1", children: [
|
|
14108
|
+
/* @__PURE__ */ jsx53(
|
|
14029
14109
|
"textarea",
|
|
14030
14110
|
{
|
|
14031
14111
|
className: cn25(
|
|
@@ -14037,7 +14117,7 @@ function BindingDetails({
|
|
|
14037
14117
|
onChange: (e) => setTemplate(e.target.value)
|
|
14038
14118
|
}
|
|
14039
14119
|
),
|
|
14040
|
-
!disabled && /* @__PURE__ */
|
|
14120
|
+
!disabled && /* @__PURE__ */ jsx53("div", { className: "flex flex-wrap gap-1", children: fieldList.flatMap(bindingPlaceholdersFor).map((p) => /* @__PURE__ */ jsx53(
|
|
14041
14121
|
Button24,
|
|
14042
14122
|
{
|
|
14043
14123
|
type: "button",
|
|
@@ -14050,9 +14130,9 @@ function BindingDetails({
|
|
|
14050
14130
|
p.token
|
|
14051
14131
|
)) })
|
|
14052
14132
|
] }),
|
|
14053
|
-
shape === "collection" && /* @__PURE__ */
|
|
14133
|
+
shape === "collection" && /* @__PURE__ */ jsxs48("label", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
14054
14134
|
"Up to",
|
|
14055
|
-
/* @__PURE__ */
|
|
14135
|
+
/* @__PURE__ */ jsx53(
|
|
14056
14136
|
BasicInput12,
|
|
14057
14137
|
{
|
|
14058
14138
|
type: "number",
|
|
@@ -14069,9 +14149,9 @@ function BindingDetails({
|
|
|
14069
14149
|
),
|
|
14070
14150
|
"rows"
|
|
14071
14151
|
] }),
|
|
14072
|
-
/* @__PURE__ */
|
|
14073
|
-
/* @__PURE__ */
|
|
14074
|
-
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */
|
|
14152
|
+
/* @__PURE__ */ jsxs48("div", { className: "flex flex-wrap items-center gap-1", role: "radiogroup", "aria-label": "If nothing is found", children: [
|
|
14153
|
+
/* @__PURE__ */ jsx53("span", { className: "text-xs text-muted-foreground", children: "If nothing is found" }),
|
|
14154
|
+
DATA_BINDING_MISSING.map((m) => /* @__PURE__ */ jsx53(
|
|
14075
14155
|
Button24,
|
|
14076
14156
|
{
|
|
14077
14157
|
type: "button",
|
|
@@ -14091,13 +14171,13 @@ function BindingDetails({
|
|
|
14091
14171
|
|
|
14092
14172
|
// src/PickedSummaries.tsx
|
|
14093
14173
|
import { useFields as useFields8, useRecord as useRecord2, useTable as useTable7 } from "@ai-matrx/records/react";
|
|
14094
|
-
import { Fragment as Fragment19, jsx as
|
|
14174
|
+
import { Fragment as Fragment19, jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
14095
14175
|
function TableNameText({ dataSource, tableId }) {
|
|
14096
14176
|
const tables = useTablesAnywhere(dataSource);
|
|
14097
|
-
if (!tableId) return /* @__PURE__ */
|
|
14098
|
-
if (tables.loading) return /* @__PURE__ */
|
|
14099
|
-
if (tables.error) return /* @__PURE__ */
|
|
14100
|
-
return /* @__PURE__ */
|
|
14177
|
+
if (!tableId) return /* @__PURE__ */ jsx54(Fragment19, { children: "\u2014" });
|
|
14178
|
+
if (tables.loading) return /* @__PURE__ */ jsx54(Fragment19, { children: "\u2026" });
|
|
14179
|
+
if (tables.error) return /* @__PURE__ */ jsx54(Fragment19, { children: "Couldn't load the table's name" });
|
|
14180
|
+
return /* @__PURE__ */ jsx54(Fragment19, { children: tables.rows.find((t) => t.table_id === tableId)?.table_name ?? "\u2014" });
|
|
14101
14181
|
}
|
|
14102
14182
|
function ColumnValuesText({
|
|
14103
14183
|
dataSource,
|
|
@@ -14105,38 +14185,38 @@ function ColumnValuesText({
|
|
|
14105
14185
|
tableId,
|
|
14106
14186
|
value
|
|
14107
14187
|
}) {
|
|
14108
|
-
if (!tableId) return /* @__PURE__ */
|
|
14109
|
-
return /* @__PURE__ */
|
|
14188
|
+
if (!tableId) return /* @__PURE__ */ jsx54(Fragment19, { children: "\u2014" });
|
|
14189
|
+
return /* @__PURE__ */ jsx54(
|
|
14110
14190
|
TableScope,
|
|
14111
14191
|
{
|
|
14112
14192
|
dataSource,
|
|
14113
14193
|
userId,
|
|
14114
14194
|
tableId,
|
|
14115
|
-
fallback: /* @__PURE__ */
|
|
14116
|
-
unavailable: /* @__PURE__ */
|
|
14117
|
-
children: /* @__PURE__ */
|
|
14195
|
+
fallback: /* @__PURE__ */ jsx54(Fragment19, { children: "\u2026" }),
|
|
14196
|
+
unavailable: /* @__PURE__ */ jsx54(Fragment19, { children: "Couldn't load this table's columns" }),
|
|
14197
|
+
children: /* @__PURE__ */ jsx54(RecordLabelProvider, { children: /* @__PURE__ */ jsx54(ColumnValuesWords, { tableId, value }) })
|
|
14118
14198
|
}
|
|
14119
14199
|
);
|
|
14120
14200
|
}
|
|
14121
14201
|
function ColumnValuesWords({ tableId, value }) {
|
|
14122
14202
|
const fields = useFields8(tableId);
|
|
14123
14203
|
const labels = useRecordLabels(fields.data ?? void 0);
|
|
14124
|
-
if (fields.loading) return /* @__PURE__ */
|
|
14125
|
-
if (fields.error) return /* @__PURE__ */
|
|
14204
|
+
if (fields.loading) return /* @__PURE__ */ jsx54(Fragment19, { children: "\u2026" });
|
|
14205
|
+
if (fields.error) return /* @__PURE__ */ jsx54(Fragment19, { children: "Couldn't load this table's columns" });
|
|
14126
14206
|
const parts = [];
|
|
14127
14207
|
for (const [key, stored] of Object.entries(value)) {
|
|
14128
14208
|
if (key.startsWith("_")) continue;
|
|
14129
14209
|
const field2 = (fields.data ?? []).find((f) => f.key === key);
|
|
14130
|
-
if (parts.length) parts.push(/* @__PURE__ */
|
|
14210
|
+
if (parts.length) parts.push(/* @__PURE__ */ jsx54("span", { children: ", " }, `${key}-sep`));
|
|
14131
14211
|
parts.push(
|
|
14132
|
-
/* @__PURE__ */
|
|
14212
|
+
/* @__PURE__ */ jsxs49("span", { children: [
|
|
14133
14213
|
field2 ? fieldName(field2) : "A removed column",
|
|
14134
14214
|
" is ",
|
|
14135
14215
|
field2 ? renderValue(field2, stored, void 0, labels) : "\u2014"
|
|
14136
14216
|
] }, key)
|
|
14137
14217
|
);
|
|
14138
14218
|
}
|
|
14139
|
-
return parts.length ? /* @__PURE__ */
|
|
14219
|
+
return parts.length ? /* @__PURE__ */ jsx54(Fragment19, { children: parts }) : /* @__PURE__ */ jsx54(Fragment19, { children: "\u2014" });
|
|
14140
14220
|
}
|
|
14141
14221
|
function RecordNameText({
|
|
14142
14222
|
dataSource,
|
|
@@ -14144,45 +14224,45 @@ function RecordNameText({
|
|
|
14144
14224
|
tableId,
|
|
14145
14225
|
recordId
|
|
14146
14226
|
}) {
|
|
14147
|
-
if (!tableId || !recordId) return /* @__PURE__ */
|
|
14148
|
-
return /* @__PURE__ */
|
|
14227
|
+
if (!tableId || !recordId) return /* @__PURE__ */ jsx54(Fragment19, { children: "\u2014" });
|
|
14228
|
+
return /* @__PURE__ */ jsx54(
|
|
14149
14229
|
TableScope,
|
|
14150
14230
|
{
|
|
14151
14231
|
dataSource,
|
|
14152
14232
|
userId,
|
|
14153
14233
|
tableId,
|
|
14154
|
-
fallback: /* @__PURE__ */
|
|
14155
|
-
unavailable: /* @__PURE__ */
|
|
14156
|
-
children: /* @__PURE__ */
|
|
14234
|
+
fallback: /* @__PURE__ */ jsx54(Fragment19, { children: "\u2026" }),
|
|
14235
|
+
unavailable: /* @__PURE__ */ jsx54(Fragment19, { children: "Couldn't load this record" }),
|
|
14236
|
+
children: /* @__PURE__ */ jsx54(RecordNameWords, { tableId, recordId })
|
|
14157
14237
|
}
|
|
14158
14238
|
);
|
|
14159
14239
|
}
|
|
14160
14240
|
function RecordNameWords({ tableId, recordId }) {
|
|
14161
14241
|
const table = useTable7(tableId);
|
|
14162
14242
|
const record = useRecord2(recordId);
|
|
14163
|
-
if (record.loading || table.loading) return /* @__PURE__ */
|
|
14164
|
-
if (record.error) return /* @__PURE__ */
|
|
14165
|
-
if (!record.data) return /* @__PURE__ */
|
|
14166
|
-
return /* @__PURE__ */
|
|
14243
|
+
if (record.loading || table.loading) return /* @__PURE__ */ jsx54(Fragment19, { children: "\u2026" });
|
|
14244
|
+
if (record.error) return /* @__PURE__ */ jsx54(Fragment19, { children: "Couldn't load this record" });
|
|
14245
|
+
if (!record.data) return /* @__PURE__ */ jsx54(Fragment19, { children: "A record you cannot open" });
|
|
14246
|
+
return /* @__PURE__ */ jsx54(Fragment19, { children: recordName(record.data.document, table.data?.title_field ?? null) });
|
|
14167
14247
|
}
|
|
14168
14248
|
|
|
14169
14249
|
// src/HeldChangeDecision.tsx
|
|
14170
|
-
import { useEffect as useEffect31, useState as
|
|
14171
|
-
import { RecordsProvider as RecordsProvider3, useRecordsClient as
|
|
14250
|
+
import { useEffect as useEffect31, useState as useState41 } from "react";
|
|
14251
|
+
import { RecordsProvider as RecordsProvider3, useRecordsClient as useRecordsClient16 } from "@ai-matrx/records/react";
|
|
14172
14252
|
import { Button as Button25 } from "@ai-matrx/design-system";
|
|
14173
|
-
import { jsx as
|
|
14253
|
+
import { jsx as jsx55, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
14174
14254
|
function HeldChangeDecision({ dataSource, userId, organizationId, approvalId, onDecided, approveLabel }) {
|
|
14175
|
-
return /* @__PURE__ */
|
|
14255
|
+
return /* @__PURE__ */ jsx55(RecordsProvider3, { config: { dataSource, actor: personActor(userId), organizationId }, children: /* @__PURE__ */ jsx55(Decision, { approvalId, onDecided, approveLabel: approveLabel ?? "Approve" }) });
|
|
14176
14256
|
}
|
|
14177
14257
|
function Decision({
|
|
14178
14258
|
approvalId,
|
|
14179
14259
|
onDecided,
|
|
14180
14260
|
approveLabel
|
|
14181
14261
|
}) {
|
|
14182
|
-
const client =
|
|
14183
|
-
const [may, setMay] =
|
|
14184
|
-
const [busy, setBusy] =
|
|
14185
|
-
const [error, setError] =
|
|
14262
|
+
const client = useRecordsClient16();
|
|
14263
|
+
const [may, setMay] = useState41(null);
|
|
14264
|
+
const [busy, setBusy] = useState41(null);
|
|
14265
|
+
const [error, setError] = useState41(null);
|
|
14186
14266
|
useEffect31(() => {
|
|
14187
14267
|
let live = true;
|
|
14188
14268
|
void client.workApprovalMayDecide({ approval_id: approvalId }).then((res) => {
|
|
@@ -14205,13 +14285,13 @@ function Decision({
|
|
|
14205
14285
|
if (res.ok) onDecided(approve);
|
|
14206
14286
|
else setError(res.error);
|
|
14207
14287
|
};
|
|
14208
|
-
if (may === null) return /* @__PURE__ */
|
|
14209
|
-
return /* @__PURE__ */
|
|
14210
|
-
may ? /* @__PURE__ */
|
|
14211
|
-
/* @__PURE__ */
|
|
14212
|
-
/* @__PURE__ */
|
|
14213
|
-
] }) : !error && /* @__PURE__ */
|
|
14214
|
-
error ? /* @__PURE__ */
|
|
14288
|
+
if (may === null) return /* @__PURE__ */ jsx55("p", { className: "text-xs text-muted-foreground", children: "Checking who can decide\u2026" });
|
|
14289
|
+
return /* @__PURE__ */ jsxs50("div", { className: "flex flex-col gap-1.5", children: [
|
|
14290
|
+
may ? /* @__PURE__ */ jsxs50("div", { className: "flex gap-2", children: [
|
|
14291
|
+
/* @__PURE__ */ jsx55(Button25, { type: "button", size: "sm", disabled: busy !== null, onClick: () => void decide(true), children: busy === "approve" ? "Approving\u2026" : approveLabel }),
|
|
14292
|
+
/* @__PURE__ */ jsx55(Button25, { type: "button", size: "sm", variant: "outline", disabled: busy !== null, onClick: () => void decide(false), children: busy === "refuse" ? "Refusing\u2026" : "Refuse" })
|
|
14293
|
+
] }) : !error && /* @__PURE__ */ jsx55("p", { className: "text-xs text-muted-foreground", children: "An owner or admin of this organization decides this." }),
|
|
14294
|
+
error ? /* @__PURE__ */ jsx55(RefusalLine, { error }) : null
|
|
14215
14295
|
] });
|
|
14216
14296
|
}
|
|
14217
14297
|
|
|
@@ -14421,4 +14501,4 @@ export {
|
|
|
14421
14501
|
RecordNameText,
|
|
14422
14502
|
HeldChangeDecision
|
|
14423
14503
|
};
|
|
14424
|
-
//# sourceMappingURL=chunk-
|
|
14504
|
+
//# sourceMappingURL=chunk-PDIM4BLZ.js.map
|