@ai-matrx/records-ui 0.116.61 → 0.116.63
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 +22 -1
- package/dist/{chunk-2YK72GHL.js → chunk-X2WDIQIR.js} +123 -45
- package/dist/chunk-X2WDIQIR.js.map +1 -0
- package/dist/index.cjs +133 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +53 -13
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +40 -5
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-2YK72GHL.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -40,11 +40,32 @@
|
|
|
40
40
|
- Tests: `vitest.setup.ts` gives jsdom a no-op `performance.mark` / `measure`.
|
|
41
41
|
- **New subpath `@ai-matrx/records-ui/data-source`:** `recordsDataSource`, `personActor` and the who-changed words (`whenWords`, `actorWords`, `actorBadge`, `lastChangeSentence`, `SOMEBODY`, `THE_SYSTEM`) alone. `/helpers` also carries the field-type words, the colour resolver and the table builders, which read `@ai-matrx/records/core`; this entry reaches `@ai-matrx/kit` only, and shares the one data-source cache with `/helpers` and the root. Additive. Consumer action: a shell-reachable service that only binds its supabase client or says when imports from `/data-source`.
|
|
42
42
|
|
|
43
|
-
## 0.116.
|
|
43
|
+
## 0.116.63
|
|
44
44
|
|
|
45
45
|
UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
|
|
46
46
|
Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
|
|
47
47
|
|
|
48
|
+
## 0.116.62
|
|
49
|
+
|
|
50
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
51
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
52
|
+
Diff: `git diff 2c86ae638c 5245b516bd -- apps/shared/records-ui/src`
|
|
53
|
+
|
|
54
|
+
Changed shipped source files (4):
|
|
55
|
+
- `apps/shared/records-ui/src/EntityReferenceControl.tsx`
|
|
56
|
+
- `apps/shared/records-ui/src/FieldRulePreview.tsx`
|
|
57
|
+
- `apps/shared/records-ui/src/editors.tsx`
|
|
58
|
+
- `apps/shared/records-ui/src/gridEditing.tsx`
|
|
59
|
+
|
|
60
|
+
## 0.116.61
|
|
61
|
+
|
|
62
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
63
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
64
|
+
Diff: `git diff bf61b7f493 2c86ae638c -- apps/shared/records-ui/src`
|
|
65
|
+
|
|
66
|
+
Changed shipped source files (1):
|
|
67
|
+
- `apps/shared/records-ui/src/Grid.tsx`
|
|
68
|
+
|
|
48
69
|
## 0.116.60
|
|
49
70
|
|
|
50
71
|
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
recordName,
|
|
42
42
|
recordNameIn,
|
|
43
43
|
recordVersions_exports,
|
|
44
|
+
refusalForAPerson,
|
|
44
45
|
refusalIsMissingInput,
|
|
45
46
|
refusalSentence,
|
|
46
47
|
refusals_exports,
|
|
@@ -2036,7 +2037,7 @@ function ReferenceBuilder({
|
|
|
2036
2037
|
}
|
|
2037
2038
|
|
|
2038
2039
|
// src/ChoiceListEditor.tsx
|
|
2039
|
-
import { useEffect as useEffect23, useRef as
|
|
2040
|
+
import { useEffect as useEffect23, useRef as useRef19, useState as useState33 } from "react";
|
|
2040
2041
|
import { optionLabel as optionLabel2, recordsUseSentence, rehomeSentence } from "@ai-matrx/records";
|
|
2041
2042
|
import { useRecordsClient as useRecordsClient9 } from "@ai-matrx/records/react";
|
|
2042
2043
|
import {
|
|
@@ -2094,7 +2095,7 @@ function AddChoicesInline({ field: field2, onAdded, disabled = false }) {
|
|
|
2094
2095
|
}
|
|
2095
2096
|
|
|
2096
2097
|
// src/editors.tsx
|
|
2097
|
-
import { useCallback as
|
|
2098
|
+
import { useCallback as useCallback7, useEffect as useEffect22, useLayoutEffect as useLayoutEffect3, useRef as useRef18, useState as useState32 } from "react";
|
|
2098
2099
|
import { isButtonField as isButtonField2, allowsOtherValues, choiceValuesOf, coerceTypedAnswer, newerKindOf as newerKindOf2, decideTypedChoice, isTheChosen, optionKey as optionKey4, rankTypedMatches as rankTypedMatches4, readTypedTime as readTypedTime2, typedDateText as typedDateText2, typedTimeText as typedTimeText2 } from "@ai-matrx/records";
|
|
2099
2100
|
import { useOptionalRecordsClient as useOptionalRecordsClient12 } from "@ai-matrx/records/react";
|
|
2100
2101
|
import {
|
|
@@ -2767,7 +2768,7 @@ function readableLink(raw) {
|
|
|
2767
2768
|
}
|
|
2768
2769
|
|
|
2769
2770
|
// src/buttonCell.tsx
|
|
2770
|
-
import { useContext as useContext3, useEffect as useEffect20, useRef as
|
|
2771
|
+
import { useContext as useContext3, useEffect as useEffect20, useRef as useRef15, useState as useState28 } from "react";
|
|
2771
2772
|
import { Button as Button16, Dialog as Dialog3, ErrorBox as ErrorBox2, DialogContent as DialogContent3, DialogDescription, DialogHeader as DialogHeader3, DialogTitle as DialogTitle3, Popover as Popover4, PopoverContent as PopoverContent4, PopoverTrigger as PopoverTrigger4, cn as cn18 } from "@ai-matrx/design-system";
|
|
2772
2773
|
import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, isStyleColor } from "@ai-matrx/design-system/data-table";
|
|
2773
2774
|
import { buttonNeeds as buttonNeeds2, buttonOf as buttonOf2 } from "@ai-matrx/records";
|
|
@@ -2908,7 +2909,7 @@ function columnNameProblemLine(name, noun = "column") {
|
|
|
2908
2909
|
}
|
|
2909
2910
|
|
|
2910
2911
|
// src/FieldEditor.tsx
|
|
2911
|
-
import { useEffect as useEffect19, useMemo as useMemo10, useRef as
|
|
2912
|
+
import { useEffect as useEffect19, useMemo as useMemo10, useRef as useRef14, useState as useState27 } from "react";
|
|
2912
2913
|
import {
|
|
2913
2914
|
tableShapeChanged as tableShapeChanged3,
|
|
2914
2915
|
useEntityFieldMutation,
|
|
@@ -3264,7 +3265,7 @@ function EntityReferenceKindPicker({ value, onChange, locked = false, className
|
|
|
3264
3265
|
}
|
|
3265
3266
|
|
|
3266
3267
|
// src/SourceArchivedNotice.tsx
|
|
3267
|
-
import { useCallback as
|
|
3268
|
+
import { useCallback as useCallback6, useEffect as useEffect13, useState as useState21 } from "react";
|
|
3268
3269
|
import { Button as Button11 } from "@ai-matrx/design-system";
|
|
3269
3270
|
import { tableShapeChanged, useRecordsClient as useRecordsClient5 } from "@ai-matrx/records/react";
|
|
3270
3271
|
|
|
@@ -3279,7 +3280,7 @@ import { formatFieldValue as formatFieldValue3 } from "@ai-matrx/design-system/f
|
|
|
3279
3280
|
import { Badge as Badge6, cn as cn15 } from "@ai-matrx/design-system";
|
|
3280
3281
|
|
|
3281
3282
|
// src/EntityReferenceControl.tsx
|
|
3282
|
-
import { useMemo as useMemo7, useState as useState13 } from "react";
|
|
3283
|
+
import { useCallback as useCallback4, useMemo as useMemo7, useRef as useRef8, useState as useState13 } from "react";
|
|
3283
3284
|
import { entityRefsOf, entityRefsToWrite } from "@ai-matrx/records";
|
|
3284
3285
|
import { useEntityReferenceKinds as useEntityReferenceKinds2, useEntityReferenceSearch, useEntityReferenceWords, useOptionalRecordsClient as useOptionalRecordsClient5 } from "@ai-matrx/records/react";
|
|
3285
3286
|
import { Badge as Badge2, Button as Button7, cn as cn9 } from "@ai-matrx/design-system";
|
|
@@ -3315,6 +3316,15 @@ function WithWords(props) {
|
|
|
3315
3316
|
{
|
|
3316
3317
|
field: props.field,
|
|
3317
3318
|
refs: withKnown,
|
|
3319
|
+
autoOpen: props.autoOpen,
|
|
3320
|
+
onClose: props.onClose,
|
|
3321
|
+
onCancel: props.onCancel,
|
|
3322
|
+
initialSearch: props.initialSearch,
|
|
3323
|
+
onTakeOff: (ref) => {
|
|
3324
|
+
const rest = withKnown.filter((x) => !(x.token === ref.token && x.id === ref.id));
|
|
3325
|
+
props.onChange(entityRefsToWrite(rest, Boolean(props.field.multi)));
|
|
3326
|
+
},
|
|
3327
|
+
labelOf: (r) => r.label ?? words?.data?.find((w) => w.token === r.token && w.id === r.id)?.label ?? WITHHELD_ENTITY_LABEL,
|
|
3318
3328
|
onPick: (picked) => {
|
|
3319
3329
|
setKnown((k) => [...k.filter((x) => !(x.token === picked.token && x.id === picked.id)), picked]);
|
|
3320
3330
|
const multi = Boolean(props.field.multi);
|
|
@@ -3323,18 +3333,32 @@ function WithWords(props) {
|
|
|
3323
3333
|
}
|
|
3324
3334
|
}
|
|
3325
3335
|
);
|
|
3336
|
+
if (props.autoOpen && !props.disabled) return /* @__PURE__ */ jsx17("div", { id: props.id, className: cn9("flex min-w-0 max-w-full flex-wrap items-center gap-1", props.className), children: picker });
|
|
3326
3337
|
return /* @__PURE__ */ jsx17(Chips, { ...props, value: withKnown, words, picker });
|
|
3327
3338
|
}
|
|
3328
3339
|
function EntityReferencePicker({
|
|
3329
3340
|
field: field2,
|
|
3330
3341
|
refs,
|
|
3331
|
-
onPick
|
|
3342
|
+
onPick,
|
|
3343
|
+
autoOpen,
|
|
3344
|
+
onClose,
|
|
3345
|
+
onCancel,
|
|
3346
|
+
initialSearch,
|
|
3347
|
+
onTakeOff,
|
|
3348
|
+
labelOf
|
|
3332
3349
|
}) {
|
|
3333
3350
|
const allowed = allowedKindsOf(field2);
|
|
3334
3351
|
const kinds = useEntityReferenceKinds2();
|
|
3335
3352
|
const labelOfKind = (token) => kinds.data?.find((k) => k.token === token)?.label ?? token.replace(/_/g, " ");
|
|
3336
|
-
const [open,
|
|
3337
|
-
const
|
|
3353
|
+
const [open, setOpenState] = useState13(autoOpen === true);
|
|
3354
|
+
const onCloseRef = useRef8(onClose);
|
|
3355
|
+
onCloseRef.current = onClose;
|
|
3356
|
+
const setOpen = useCallback4((next) => {
|
|
3357
|
+
setOpenState(next);
|
|
3358
|
+
if (!next) onCloseRef.current?.();
|
|
3359
|
+
}, []);
|
|
3360
|
+
const anchored = autoOpen === true;
|
|
3361
|
+
const [search, setSearch] = useState13(initialSearch ?? "");
|
|
3338
3362
|
const [only, setOnly] = useState13(null);
|
|
3339
3363
|
const tokens = only ? [only] : allowed;
|
|
3340
3364
|
const found = useEntityReferenceSearch(tokens, search, open);
|
|
@@ -3377,6 +3401,10 @@ function EntityReferencePicker({
|
|
|
3377
3401
|
return /* @__PURE__ */ jsx17(
|
|
3378
3402
|
PickOrAdd,
|
|
3379
3403
|
{
|
|
3404
|
+
anchored,
|
|
3405
|
+
...anchored && onCancel ? { onEscape: onCancel } : {},
|
|
3406
|
+
multi,
|
|
3407
|
+
...anchored ? { chips: refs.map((r) => ({ id: `${r.token}:${r.id}`, label: labelOf(r), onRemove: () => onTakeOff(r) })) } : {},
|
|
3380
3408
|
triggerLabel: `Pick for ${field2.label}`,
|
|
3381
3409
|
triggerText: refs.length > 0 && !multi ? "Change" : "Pick",
|
|
3382
3410
|
open,
|
|
@@ -3547,14 +3575,14 @@ function WholeValueEditor({
|
|
|
3547
3575
|
import { formatPhone as formatPhone2 } from "@ai-matrx/design-system/field-formats";
|
|
3548
3576
|
|
|
3549
3577
|
// src/formattedValue.tsx
|
|
3550
|
-
import { useRef as
|
|
3578
|
+
import { useRef as useRef10 } from "react";
|
|
3551
3579
|
import { FormattedCell } from "@ai-matrx/design-system/data-table";
|
|
3552
3580
|
import { formatFieldValue as formatFieldValue2, formatPhone, getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
3553
3581
|
import { cn as cn10 } from "@ai-matrx/design-system";
|
|
3554
3582
|
import { OutboundLink as OutboundLink3 } from "@ai-matrx/kit/outbound-react";
|
|
3555
3583
|
|
|
3556
3584
|
// src/LinkPreviewCard.tsx
|
|
3557
|
-
import { useEffect as useEffect10, useRef as
|
|
3585
|
+
import { useEffect as useEffect10, useRef as useRef9, useState as useState15 } from "react";
|
|
3558
3586
|
import { HoverCard, HoverCardContent, HoverCardTrigger, SiteIcon } from "@ai-matrx/design-system";
|
|
3559
3587
|
import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3560
3588
|
var answers = /* @__PURE__ */ new Map();
|
|
@@ -3562,7 +3590,7 @@ function LinkPreviewCard({ url, children }) {
|
|
|
3562
3590
|
const port = useRecordsUi().linkPreview;
|
|
3563
3591
|
const [preview, setPreview] = useState15(void 0);
|
|
3564
3592
|
const [open, setOpen] = useState15(false);
|
|
3565
|
-
const timer =
|
|
3593
|
+
const timer = useRef9(null);
|
|
3566
3594
|
useEffect10(() => () => void (timer.current && clearTimeout(timer.current)), []);
|
|
3567
3595
|
if (!port) return /* @__PURE__ */ jsx19(Fragment9, { children });
|
|
3568
3596
|
const ask = () => {
|
|
@@ -3620,7 +3648,7 @@ function RatingStars({
|
|
|
3620
3648
|
label,
|
|
3621
3649
|
selectFirst
|
|
3622
3650
|
}) {
|
|
3623
|
-
const armed =
|
|
3651
|
+
const armed = useRef10(true);
|
|
3624
3652
|
const score = numberOf3(value) ?? 0;
|
|
3625
3653
|
const shown2 = Math.round(score);
|
|
3626
3654
|
const said2 = `${shown2} out of ${max}`;
|
|
@@ -3755,7 +3783,7 @@ function linkChipText(raw) {
|
|
|
3755
3783
|
}
|
|
3756
3784
|
|
|
3757
3785
|
// src/gridAttachments.tsx
|
|
3758
|
-
import { useEffect as useEffect11, useRef as
|
|
3786
|
+
import { useEffect as useEffect11, useRef as useRef11, useState as useState16 } from "react";
|
|
3759
3787
|
import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
|
|
3760
3788
|
import { Badge as Badge3, Button as Button8, cn as cn11, Dialog, DialogContent, DialogHeader, DialogTitle } from "@ai-matrx/design-system";
|
|
3761
3789
|
import { OutboundLink as OutboundLink4 } from "@ai-matrx/kit/outbound-react";
|
|
@@ -4006,7 +4034,7 @@ function AttachmentControl({
|
|
|
4006
4034
|
const host = useRecordsUi();
|
|
4007
4035
|
const [busy, setBusy] = useState16(false);
|
|
4008
4036
|
const [why, setWhy] = useState16(null);
|
|
4009
|
-
const latest =
|
|
4037
|
+
const latest = useRef11(value);
|
|
4010
4038
|
latest.current = value;
|
|
4011
4039
|
const multiple = Boolean(field2.multi);
|
|
4012
4040
|
const pick = async () => {
|
|
@@ -4027,7 +4055,7 @@ function AttachmentControl({
|
|
|
4027
4055
|
setBusy(false);
|
|
4028
4056
|
onClose?.();
|
|
4029
4057
|
};
|
|
4030
|
-
const opened =
|
|
4058
|
+
const opened = useRef11(false);
|
|
4031
4059
|
useEffect11(() => {
|
|
4032
4060
|
if (!autoOpen || opened.current || !host.pickFiles) return;
|
|
4033
4061
|
opened.current = true;
|
|
@@ -4176,7 +4204,7 @@ function KindValueCell({
|
|
|
4176
4204
|
}
|
|
4177
4205
|
|
|
4178
4206
|
// src/ClampedChips.tsx
|
|
4179
|
-
import { useCallback as
|
|
4207
|
+
import { useCallback as useCallback5, useLayoutEffect, useRef as useRef12, useState as useState17 } from "react";
|
|
4180
4208
|
import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2, cn as cn13 } from "@ai-matrx/design-system";
|
|
4181
4209
|
import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
4182
4210
|
var GAP = 4;
|
|
@@ -4188,12 +4216,12 @@ function ClampedChips({
|
|
|
4188
4216
|
className,
|
|
4189
4217
|
dataAttr
|
|
4190
4218
|
}) {
|
|
4191
|
-
const box =
|
|
4219
|
+
const box = useRef12(null);
|
|
4192
4220
|
const [fit, setFit] = useState17(null);
|
|
4193
4221
|
const [measuring, setMeasuring] = useState17(true);
|
|
4194
4222
|
const count = items.length;
|
|
4195
4223
|
const stands = Math.max(total ?? count, count);
|
|
4196
|
-
const measure =
|
|
4224
|
+
const measure = useCallback5(() => {
|
|
4197
4225
|
const el = box.current;
|
|
4198
4226
|
if (!el) return;
|
|
4199
4227
|
const lines = el.closest("[data-matrx-cell-lines]")?.getAttribute("data-matrx-cell-lines");
|
|
@@ -5439,7 +5467,7 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
5439
5467
|
const [state, setState] = useState21(null);
|
|
5440
5468
|
const [busy, setBusy] = useState21(false);
|
|
5441
5469
|
const [refused, setRefused] = useState21(null);
|
|
5442
|
-
const read =
|
|
5470
|
+
const read = useCallback6(async () => {
|
|
5443
5471
|
const answer = await client.fieldSourceArchived({ field_id: fieldId });
|
|
5444
5472
|
if (answer.ok) setState(answer.data);
|
|
5445
5473
|
else setRefused(answer.error);
|
|
@@ -6458,7 +6486,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
6458
6486
|
}
|
|
6459
6487
|
|
|
6460
6488
|
// src/FieldRulePreview.tsx
|
|
6461
|
-
import { useEffect as useEffect16, useMemo as useMemo9, useRef as
|
|
6489
|
+
import { useEffect as useEffect16, useMemo as useMemo9, useRef as useRef13, useState as useState24 } from "react";
|
|
6462
6490
|
import { previewRuleChange } from "@ai-matrx/records";
|
|
6463
6491
|
import { useRecordsClient as useRecordsClient7 } from "@ai-matrx/records/react";
|
|
6464
6492
|
import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
@@ -6482,7 +6510,7 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
|
|
|
6482
6510
|
const [preview, setPreview] = useState24(null);
|
|
6483
6511
|
const [refusal, setRefusal] = useState24(null);
|
|
6484
6512
|
const key = useMemo9(() => ruleWords(rules), [rules]);
|
|
6485
|
-
const latest =
|
|
6513
|
+
const latest = useRef13(rules);
|
|
6486
6514
|
latest.current = rules;
|
|
6487
6515
|
const name = fieldName(field2);
|
|
6488
6516
|
useEffect16(() => {
|
|
@@ -6493,7 +6521,14 @@ function FieldRulePreview({ field: field2, tableId, rules }) {
|
|
|
6493
6521
|
void client.recordAggregate({ table_id: tableId, groupBy: [field2.key], measures: [{ op: "count" }], limit: PREVIEW_GROUPS }).then((answer) => {
|
|
6494
6522
|
if (cancelled) return;
|
|
6495
6523
|
if (!answer.ok) {
|
|
6496
|
-
setRefusal(
|
|
6524
|
+
setRefusal(
|
|
6525
|
+
answer.error.code === "unreachable" ? (0, refusals_exports.refusal)(
|
|
6526
|
+
"unreachable",
|
|
6527
|
+
`${name}'s values could not be counted.`,
|
|
6528
|
+
"The check still applies when you save.",
|
|
6529
|
+
refusalForAPerson(answer.error).forEngineers
|
|
6530
|
+
) : answer.error
|
|
6531
|
+
);
|
|
6497
6532
|
return;
|
|
6498
6533
|
}
|
|
6499
6534
|
const numbers = holdsNumbers(field2);
|
|
@@ -7034,17 +7069,39 @@ import { holdsNumbers as holdsNumbers2 } from "@ai-matrx/records/first-page";
|
|
|
7034
7069
|
import { holdsNumbers as holdsNumbers3, pageSortFor, sortAsFor } from "@ai-matrx/records/first-page";
|
|
7035
7070
|
import { containsPattern } from "@ai-matrx/records/data";
|
|
7036
7071
|
function sortRefusal(f) {
|
|
7072
|
+
if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so rows cannot be sorted by it.`;
|
|
7037
7073
|
if (!computedOnRead(f)) return null;
|
|
7038
7074
|
return `${fieldName(f)} is worked out each time it is read, so the whole table cannot be sorted by it. Sort by a column it is worked out from.`;
|
|
7039
7075
|
}
|
|
7040
7076
|
function sortAndFilterRefusal(f) {
|
|
7041
7077
|
if (sortRefusal(f) === null) return null;
|
|
7078
|
+
if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so it can be neither sorted nor filtered.`;
|
|
7042
7079
|
return `${fieldName(f)} is worked out each time it is read, so it can be neither sorted nor filtered. Use a column it is worked out from.`;
|
|
7043
7080
|
}
|
|
7044
7081
|
function filterRefusal(f) {
|
|
7082
|
+
if (isWithheld(f)) return `${fieldName(f)} is withheld from you, so rows cannot be filtered by it.`;
|
|
7045
7083
|
if (!computedOnRead(f)) return null;
|
|
7046
7084
|
return `${fieldName(f)} is worked out each time it is read, so the whole table cannot be filtered by it. Filter by a column it is worked out from.`;
|
|
7047
7085
|
}
|
|
7086
|
+
var isWithheld = (f) => f.withheld === true;
|
|
7087
|
+
function withheldKeysOf(rows) {
|
|
7088
|
+
const out = /* @__PURE__ */ new Set();
|
|
7089
|
+
const [first, ...rest] = rows;
|
|
7090
|
+
if (!first?.hidden) return out;
|
|
7091
|
+
for (const key of Object.keys(first.hidden)) {
|
|
7092
|
+
const note = first.hidden[key];
|
|
7093
|
+
if (note && typeof note === "object" && rest.every((row) => row.hidden?.[key] && typeof row.hidden[key] === "object")) out.add(key);
|
|
7094
|
+
}
|
|
7095
|
+
return out;
|
|
7096
|
+
}
|
|
7097
|
+
function markWithheld(fields, keys) {
|
|
7098
|
+
if (keys.size === 0) return fields;
|
|
7099
|
+
return fields.map((f) => keys.has(f.key) ? { ...f, withheld: true } : f);
|
|
7100
|
+
}
|
|
7101
|
+
function skipWhenWithheld(filter) {
|
|
7102
|
+
if (!filter || !isRuleFilter(filter)) return filter;
|
|
7103
|
+
return { op: "and", args: [filter], skip_withheld: true };
|
|
7104
|
+
}
|
|
7048
7105
|
function computedOnRead(f) {
|
|
7049
7106
|
const kind = String(editorKindFor(f));
|
|
7050
7107
|
return (f.type === "formula" || kind === "formula" || kind === "lookup" || kind === "rollup") && String(f.compute_on ?? "read") === "read";
|
|
@@ -7287,6 +7344,9 @@ function toRows(fields, records, labels) {
|
|
|
7287
7344
|
});
|
|
7288
7345
|
}
|
|
7289
7346
|
|
|
7347
|
+
// src/gridLook.ts
|
|
7348
|
+
import { SHEET_CELL_SUFFIX } from "@ai-matrx/kit/transfer-json";
|
|
7349
|
+
|
|
7290
7350
|
// src/tableJson.ts
|
|
7291
7351
|
import { exportCellText } from "@ai-matrx/records/core";
|
|
7292
7352
|
import { toDelimited } from "@ai-matrx/kit/delimited";
|
|
@@ -7507,10 +7567,25 @@ function gridCopyConfig(args) {
|
|
|
7507
7567
|
return {
|
|
7508
7568
|
// THE TOOLBAR'S OWN "Download" (CSV, TSV, Excel, Copy as table) writes the rows through the same
|
|
7509
7569
|
// words the rail writes (`fileExport.ts`): the value as the grid SHOWS it, a date in her zone.
|
|
7510
|
-
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7570
|
+
// A NUMBER OR A DATE IS A REAL SHEET CELL in the Excel workbook, as in the rail's: the hidden twin of its column carries
|
|
7571
|
+
// the typed cell (`SHEET_CELL_SUFFIX`); every text format reads the visible column, the words the grid shows.
|
|
7572
|
+
sheetColumns: () => [
|
|
7573
|
+
...fields.map((field2) => ({ id: field2.key, label: fieldName(field2) })),
|
|
7574
|
+
...fields.map((field2) => ({ id: field2.key + SHEET_CELL_SUFFIX, label: fieldName(field2) }))
|
|
7575
|
+
],
|
|
7576
|
+
sheetRows: () => {
|
|
7577
|
+
const exported = toRows([...fields], viewRows(), labels);
|
|
7578
|
+
return displayRows(exported).map(
|
|
7579
|
+
(row, at) => Object.fromEntries([
|
|
7580
|
+
...fields.map((field2) => [field2.key, row[field2.key]?.value ?? null]),
|
|
7581
|
+
...fields.map((field2) => {
|
|
7582
|
+
const cell = exported[at]?.[field2.key];
|
|
7583
|
+
const typed = cell && !cell.absent_reason ? cell.typed : void 0;
|
|
7584
|
+
return [field2.key + SHEET_CELL_SUFFIX, typed ? { t: typed.t, v: typed.v, ...typed.z ? { z: typed.z } : {} } : null];
|
|
7585
|
+
})
|
|
7586
|
+
])
|
|
7587
|
+
);
|
|
7588
|
+
},
|
|
7514
7589
|
items: [
|
|
7515
7590
|
{ id: "csv-row-ids", label: "CSV with row IDs", build: () => ({ content: exportCsvWithRowIds(fields, stored(visible), ids(visible)), extension: "csv", mime: "text/csv;charset=utf-8", filename: `${tableName2} with row IDs` }) },
|
|
7516
7591
|
{ id: "table-json", label: "JSON with row IDs", build: () => ({ content: exportJson(fields, stored(visible), ids(visible)), extension: "json", mime: "application/json;charset=utf-8", filename: tableName2 }) },
|
|
@@ -8517,7 +8592,7 @@ function FieldEditor(props) {
|
|
|
8517
8592
|
const [allowedTypes, setAllowedTypes] = useState27(() => entityReferenceKindsOf(start));
|
|
8518
8593
|
const startingFormulaText = start ? formulaTextNow(String(start.config?.["formula_text"] ?? ""), start.config?.["expr"] ?? start.expr, fields.data) : "";
|
|
8519
8594
|
const [formulaText, setFormulaText] = useState27(startingFormulaText);
|
|
8520
|
-
const shownFormula =
|
|
8595
|
+
const shownFormula = useRef14(startingFormulaText);
|
|
8521
8596
|
useEffect19(() => {
|
|
8522
8597
|
if (shownFormula.current === startingFormulaText) return;
|
|
8523
8598
|
setFormulaText((typed) => typed === shownFormula.current ? startingFormulaText : typed);
|
|
@@ -8532,7 +8607,7 @@ function FieldEditor(props) {
|
|
|
8532
8607
|
const [notLanded, setNotLanded] = useState27(false);
|
|
8533
8608
|
const liveField = field2 ? fields.data?.find((f) => f.id === field2.id) ?? field2 : void 0;
|
|
8534
8609
|
const heldAs = liveField ? JSON.stringify([liveField.type, liveField.config?.["kind"] ?? null, liveField.format ?? null, liveField.multi ?? false, liveField.unit ?? null]) : "";
|
|
8535
|
-
const seededAs =
|
|
8610
|
+
const seededAs = useRef14(heldAs);
|
|
8536
8611
|
useEffect19(() => {
|
|
8537
8612
|
if (!liveField || seededAs.current === heldAs) return;
|
|
8538
8613
|
seededAs.current = heldAs;
|
|
@@ -9552,7 +9627,7 @@ function RollupFilterQuestion({
|
|
|
9552
9627
|
() => (farFields.data ?? []).filter((f) => f.type !== "formula").map((f) => ({ id: f.id, key: f.key, label: fieldName(f), field: f })),
|
|
9553
9628
|
[farFields.data]
|
|
9554
9629
|
);
|
|
9555
|
-
const lastFar =
|
|
9630
|
+
const lastFar = useRef14(far);
|
|
9556
9631
|
useEffect19(() => {
|
|
9557
9632
|
if (lastFar.current !== null && far !== lastFar.current && !editing) onChange(null);
|
|
9558
9633
|
lastFar.current = far;
|
|
@@ -9720,7 +9795,7 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
|
|
|
9720
9795
|
const here = useContext3(OpenRecordHereContext);
|
|
9721
9796
|
const host = useRecordsUi();
|
|
9722
9797
|
const addsTo = useTable3(b?.do === "add_row" ? b.table_id ?? field2.entity_definition_id : null);
|
|
9723
|
-
const waitingOn =
|
|
9798
|
+
const waitingOn = useRef15(0);
|
|
9724
9799
|
useEffect20(() => () => void (waitingOn.current += 1), []);
|
|
9725
9800
|
if (!b) return null;
|
|
9726
9801
|
const color = isStyleColor(b.color) ? CHOICE_CHIP_CLASS[b.color] : NEUTRAL_CHIP_CLASS;
|
|
@@ -9902,7 +9977,7 @@ function ButtonValue({ field: field2, recordId, inCell, beforeSave }) {
|
|
|
9902
9977
|
}
|
|
9903
9978
|
|
|
9904
9979
|
// src/FloatingRefusal.tsx
|
|
9905
|
-
import { useLayoutEffect as useLayoutEffect2, useRef as
|
|
9980
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef16, useState as useState29 } from "react";
|
|
9906
9981
|
import { createPortal } from "react-dom";
|
|
9907
9982
|
import { Fragment as Fragment14, jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
9908
9983
|
var GAP2 = 4;
|
|
@@ -9920,8 +9995,8 @@ function placeFor(anchor, note) {
|
|
|
9920
9995
|
return { position: "fixed", top: a.top + (a.height - height) / 2, left: Math.max(a.left, a.right - width - 8) };
|
|
9921
9996
|
}
|
|
9922
9997
|
function FloatingRefusal({ text, why }) {
|
|
9923
|
-
const spot =
|
|
9924
|
-
const note =
|
|
9998
|
+
const spot = useRef16(null);
|
|
9999
|
+
const note = useRef16(null);
|
|
9925
10000
|
const [style, setStyle] = useState29(null);
|
|
9926
10001
|
const [floating, setFloating] = useState29(false);
|
|
9927
10002
|
useLayoutEffect2(() => {
|
|
@@ -9966,7 +10041,7 @@ function FloatingRefusal({ text, why }) {
|
|
|
9966
10041
|
}
|
|
9967
10042
|
|
|
9968
10043
|
// src/formatControls.tsx
|
|
9969
|
-
import { useEffect as useEffect21, useRef as
|
|
10044
|
+
import { useEffect as useEffect21, useRef as useRef17, useState as useState30 } from "react";
|
|
9970
10045
|
import { BasicInput as BasicInput9, BasicTextarea as BasicTextarea4 } from "@ai-matrx/design-system";
|
|
9971
10046
|
import { getFieldFormat as getFieldFormat3, parseFieldInput } from "@ai-matrx/design-system/field-formats";
|
|
9972
10047
|
import { jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
@@ -9987,7 +10062,7 @@ function keptValue(format, raw) {
|
|
|
9987
10062
|
}
|
|
9988
10063
|
function NumberInFormat({ format, value, onChange, disabled, id }) {
|
|
9989
10064
|
const [text, setText] = useState30(() => typedText(format, value));
|
|
9990
|
-
const lastSent =
|
|
10065
|
+
const lastSent = useRef17(void 0);
|
|
9991
10066
|
useEffect21(() => {
|
|
9992
10067
|
if (value === lastSent.current) return;
|
|
9993
10068
|
setText(typedText(format, value));
|
|
@@ -10401,7 +10476,7 @@ function draftFromTyping(field2, seed) {
|
|
|
10401
10476
|
return { typedDraft: true, text: seed, judged: judgeTyped(field2, seed) };
|
|
10402
10477
|
}
|
|
10403
10478
|
function ReadsAsNote({ typed, always, children }) {
|
|
10404
|
-
const note =
|
|
10479
|
+
const note = useRef18(null);
|
|
10405
10480
|
const [repeats, setRepeats] = useState32(false);
|
|
10406
10481
|
useLayoutEffect3(() => {
|
|
10407
10482
|
if (always) return;
|
|
@@ -10593,7 +10668,7 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
10593
10668
|
case "member":
|
|
10594
10669
|
return /* @__PURE__ */ jsx42(PersonPicker, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
10595
10670
|
case "entity_reference":
|
|
10596
|
-
return /* @__PURE__ */ jsx42(EntityReferenceControl, { field: field2, value, onChange, disabled, id: inputId });
|
|
10671
|
+
return /* @__PURE__ */ jsx42(EntityReferenceControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose, onCancel, initialSearch });
|
|
10597
10672
|
case "attachment":
|
|
10598
10673
|
if (hostTakesFiles(host)) {
|
|
10599
10674
|
return /* @__PURE__ */ jsx42(AttachmentControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
@@ -10629,7 +10704,7 @@ function TypedWordsControl({ field: field2, value, onChange, disabled, id }) {
|
|
|
10629
10704
|
const [text, setText] = useState32(() => openingText(field2, value));
|
|
10630
10705
|
const [refusal, setRefusal] = useState32(null);
|
|
10631
10706
|
const [why, setWhy] = useState32(void 0);
|
|
10632
|
-
const sent =
|
|
10707
|
+
const sent = useRef18(value);
|
|
10633
10708
|
useEffect22(() => {
|
|
10634
10709
|
if (value === sent.current) return;
|
|
10635
10710
|
sent.current = value;
|
|
@@ -10974,9 +11049,9 @@ function OpenChoicePicker({
|
|
|
10974
11049
|
const client = useOptionalRecordsClient12();
|
|
10975
11050
|
const nudge = useChoiceNudge();
|
|
10976
11051
|
const [open, setOpenState] = useState32(autoOpen === true);
|
|
10977
|
-
const onCloseRef =
|
|
11052
|
+
const onCloseRef = useRef18(onClose);
|
|
10978
11053
|
onCloseRef.current = onClose;
|
|
10979
|
-
const setOpen =
|
|
11054
|
+
const setOpen = useCallback7((next) => {
|
|
10980
11055
|
setOpenState(next);
|
|
10981
11056
|
if (!next) onCloseRef.current?.();
|
|
10982
11057
|
}, []);
|
|
@@ -11289,7 +11364,7 @@ function ChoiceListEditor({
|
|
|
11289
11364
|
const [usage, setUsage] = useState33(null);
|
|
11290
11365
|
const [asking, setAsking] = useState33(null);
|
|
11291
11366
|
const [moveTo, setMoveTo] = useState33("");
|
|
11292
|
-
const focusRow =
|
|
11367
|
+
const focusRow = useRef19(null);
|
|
11293
11368
|
const [removed, setRemoved] = useState33({});
|
|
11294
11369
|
const fieldId = field2?.id ?? null;
|
|
11295
11370
|
useEffect23(() => {
|
|
@@ -11551,7 +11626,7 @@ async function hasSession(getSession) {
|
|
|
11551
11626
|
}
|
|
11552
11627
|
|
|
11553
11628
|
// src/RecordsMount.tsx
|
|
11554
|
-
import { useRef as
|
|
11629
|
+
import { useRef as useRef20 } from "react";
|
|
11555
11630
|
import { RecordsProvider } from "@ai-matrx/records/react";
|
|
11556
11631
|
|
|
11557
11632
|
// src/PersonNamesBridge.tsx
|
|
@@ -11598,7 +11673,7 @@ function RecordsMount({
|
|
|
11598
11673
|
] }) }) });
|
|
11599
11674
|
}
|
|
11600
11675
|
function useShallowStableHost(host) {
|
|
11601
|
-
const held =
|
|
11676
|
+
const held = useRef20(null);
|
|
11602
11677
|
const next = host ?? {};
|
|
11603
11678
|
const previous = held.current;
|
|
11604
11679
|
if (previous !== null && sameParts(previous, next)) return previous;
|
|
@@ -12217,6 +12292,9 @@ export {
|
|
|
12217
12292
|
sortRefusal,
|
|
12218
12293
|
sortAndFilterRefusal,
|
|
12219
12294
|
filterRefusal,
|
|
12295
|
+
withheldKeysOf,
|
|
12296
|
+
markWithheld,
|
|
12297
|
+
skipWhenWithheld,
|
|
12220
12298
|
storeQuestion,
|
|
12221
12299
|
inColumnWords,
|
|
12222
12300
|
holdsNumbers3 as holdsNumbers,
|
|
@@ -12395,4 +12473,4 @@ export {
|
|
|
12395
12473
|
RecordNameText,
|
|
12396
12474
|
HeldChangeDecision
|
|
12397
12475
|
};
|
|
12398
|
-
//# sourceMappingURL=chunk-
|
|
12476
|
+
//# sourceMappingURL=chunk-X2WDIQIR.js.map
|