@ai-matrx/records-ui 0.113.26 → 0.113.28
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 +30 -0
- package/dist/index.cjs +19 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -2
- package/dist/index.d.ts +9 -2
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +9 -6
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +9 -6
- package/dist/pickers.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -3242,8 +3242,13 @@ interface RelationPickerProps {
|
|
|
3242
3242
|
onClose?: (() => void) | undefined;
|
|
3243
3243
|
/** Escape in a grid cell's list: the cell's cancel — nothing is written (`PickOrAdd.onEscape`). */
|
|
3244
3244
|
onCancel?: (() => void) | undefined;
|
|
3245
|
+
/**
|
|
3246
|
+
* THE RECORD BEING EDITED (walk 2026-10-08 D11): never offered in its own list — a row cannot be
|
|
3247
|
+
* blocked by, or the parent of, itself (the store refuses it too).
|
|
3248
|
+
*/
|
|
3249
|
+
excludeId?: string | undefined;
|
|
3245
3250
|
}
|
|
3246
|
-
declare function RelationPicker({ field, value, onChange, disabled, id, className, allowCreate, onPicked, autoOpen, onClose, onCancel }: RelationPickerProps): react.JSX.Element;
|
|
3251
|
+
declare function RelationPicker({ field, value, onChange, disabled, id, className, allowCreate, onPicked, autoOpen, onClose, onCancel, excludeId }: RelationPickerProps): react.JSX.Element;
|
|
3247
3252
|
|
|
3248
3253
|
interface PickOrAddItem {
|
|
3249
3254
|
id: string;
|
|
@@ -3451,6 +3456,8 @@ interface FieldEditorControlProps {
|
|
|
3451
3456
|
asForm?: boolean | undefined;
|
|
3452
3457
|
/** A FORM'S SINGLE CHOICE WAS PICKED (lane TYPEFORM-2): the runner may go on to the next question. */
|
|
3453
3458
|
onChosen?: (() => void) | undefined;
|
|
3459
|
+
/** The record whose value this is: a link picker never offers it (walk 2026-10-08 D11). */
|
|
3460
|
+
recordId?: string | undefined;
|
|
3454
3461
|
}
|
|
3455
3462
|
/** The label row every editor shares: one line, the label, the unit, the required mark. */
|
|
3456
3463
|
declare function FieldLabel({ field, htmlFor, children }: {
|
|
@@ -3458,7 +3465,7 @@ declare function FieldLabel({ field, htmlFor, children }: {
|
|
|
3458
3465
|
htmlFor: string;
|
|
3459
3466
|
children?: ReactNode;
|
|
3460
3467
|
}): react.JSX.Element;
|
|
3461
|
-
declare function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen }: FieldEditorControlProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null;
|
|
3468
|
+
declare function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen, recordId }: FieldEditorControlProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null;
|
|
3462
3469
|
/** The chip a picked record shows as — REC-2's "a record is a chip" in one place. */
|
|
3463
3470
|
declare function RecordChip({ title, onRemove, className, }: {
|
|
3464
3471
|
title: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -3242,8 +3242,13 @@ interface RelationPickerProps {
|
|
|
3242
3242
|
onClose?: (() => void) | undefined;
|
|
3243
3243
|
/** Escape in a grid cell's list: the cell's cancel — nothing is written (`PickOrAdd.onEscape`). */
|
|
3244
3244
|
onCancel?: (() => void) | undefined;
|
|
3245
|
+
/**
|
|
3246
|
+
* THE RECORD BEING EDITED (walk 2026-10-08 D11): never offered in its own list — a row cannot be
|
|
3247
|
+
* blocked by, or the parent of, itself (the store refuses it too).
|
|
3248
|
+
*/
|
|
3249
|
+
excludeId?: string | undefined;
|
|
3245
3250
|
}
|
|
3246
|
-
declare function RelationPicker({ field, value, onChange, disabled, id, className, allowCreate, onPicked, autoOpen, onClose, onCancel }: RelationPickerProps): react.JSX.Element;
|
|
3251
|
+
declare function RelationPicker({ field, value, onChange, disabled, id, className, allowCreate, onPicked, autoOpen, onClose, onCancel, excludeId }: RelationPickerProps): react.JSX.Element;
|
|
3247
3252
|
|
|
3248
3253
|
interface PickOrAddItem {
|
|
3249
3254
|
id: string;
|
|
@@ -3451,6 +3456,8 @@ interface FieldEditorControlProps {
|
|
|
3451
3456
|
asForm?: boolean | undefined;
|
|
3452
3457
|
/** A FORM'S SINGLE CHOICE WAS PICKED (lane TYPEFORM-2): the runner may go on to the next question. */
|
|
3453
3458
|
onChosen?: (() => void) | undefined;
|
|
3459
|
+
/** The record whose value this is: a link picker never offers it (walk 2026-10-08 D11). */
|
|
3460
|
+
recordId?: string | undefined;
|
|
3454
3461
|
}
|
|
3455
3462
|
/** The label row every editor shares: one line, the label, the unit, the required mark. */
|
|
3456
3463
|
declare function FieldLabel({ field, htmlFor, children }: {
|
|
@@ -3458,7 +3465,7 @@ declare function FieldLabel({ field, htmlFor, children }: {
|
|
|
3458
3465
|
htmlFor: string;
|
|
3459
3466
|
children?: ReactNode;
|
|
3460
3467
|
}): react.JSX.Element;
|
|
3461
|
-
declare function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen }: FieldEditorControlProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null;
|
|
3468
|
+
declare function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen, recordId }: FieldEditorControlProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | react.JSX.Element | null;
|
|
3462
3469
|
/** The chip a picked record shows as — REC-2's "a record is a chip" in one place. */
|
|
3463
3470
|
declare function RecordChip({ title, onRemove, className, }: {
|
|
3464
3471
|
title: string;
|
package/dist/index.js
CHANGED
|
@@ -4603,8 +4603,11 @@ function tellApart(rows, nameOf2) {
|
|
|
4603
4603
|
|
|
4604
4604
|
// src/RelationPicker.tsx
|
|
4605
4605
|
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4606
|
+
function withoutSelf(rows, selfId) {
|
|
4607
|
+
return selfId ? rows.filter((row) => row.id !== selfId) : rows;
|
|
4608
|
+
}
|
|
4606
4609
|
var NO_STORE_ON_THIS_SCREEN_REASON = "This question points at a record in somebody's own data, and a page answered without an account is never allowed to search that. Leave it blank \u2014 whoever receives your answer will fill it in.";
|
|
4607
|
-
function RelationPicker({ field: field2, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose, onCancel }) {
|
|
4610
|
+
function RelationPicker({ field: field2, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose, onCancel, excludeId }) {
|
|
4608
4611
|
const client = useOptionalRecordsClient3();
|
|
4609
4612
|
const [rows, setRows] = useState11(null);
|
|
4610
4613
|
const [words2, setWords] = useState11({});
|
|
@@ -4633,7 +4636,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
4633
4636
|
let cancelled = false;
|
|
4634
4637
|
void client.list({ table_id: target2, limit: 200 }).then((result) => {
|
|
4635
4638
|
if (cancelled) return;
|
|
4636
|
-
if (result.ok) setRows(result.data.rows);
|
|
4639
|
+
if (result.ok) setRows(withoutSelf(result.data.rows, excludeId));
|
|
4637
4640
|
else setRefusal(result.error);
|
|
4638
4641
|
});
|
|
4639
4642
|
return () => {
|
|
@@ -4743,7 +4746,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
4743
4746
|
}
|
|
4744
4747
|
const createdId = String(written.data);
|
|
4745
4748
|
const refreshed = await client.list({ table_id: tableId, limit: 200 });
|
|
4746
|
-
if (refreshed.ok) setRows(refreshed.data.rows);
|
|
4749
|
+
if (refreshed.ok) setRows(withoutSelf(refreshed.data.rows, excludeId));
|
|
4747
4750
|
setBusy(false);
|
|
4748
4751
|
setCreating(false);
|
|
4749
4752
|
setNewTitle("");
|
|
@@ -10920,7 +10923,7 @@ function isPersonsName(field2) {
|
|
|
10920
10923
|
const words2 = `${field2.key} ${field2.label ?? ""}`.toLowerCase();
|
|
10921
10924
|
return /(^|[\s_])(full[\s_]?)?name(\s|$)/.test(words2) && !/(therapist|doctor|physician|company|business|pet|room)/.test(words2);
|
|
10922
10925
|
}
|
|
10923
|
-
function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen }) {
|
|
10926
|
+
function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen, recordId }) {
|
|
10924
10927
|
const host = useRecordsUi();
|
|
10925
10928
|
const kind = editorKindFor(field2);
|
|
10926
10929
|
const inputId = id ?? `field-${field2.key}`;
|
|
@@ -11005,9 +11008,9 @@ function FieldControl({ field: field2, value, onChange, disabled, id, autoOpen,
|
|
|
11005
11008
|
if (hostTakesFiles(host)) {
|
|
11006
11009
|
return /* @__PURE__ */ jsx41(AttachmentControl, { field: field2, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
11007
11010
|
}
|
|
11008
|
-
return /* @__PURE__ */ jsx41(RelationPicker, { field: field2, value, onChange, disabled, id: inputId });
|
|
11011
|
+
return /* @__PURE__ */ jsx41(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, excludeId: recordId });
|
|
11009
11012
|
case "relation":
|
|
11010
|
-
return /* @__PURE__ */ jsx41(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel });
|
|
11013
|
+
return /* @__PURE__ */ jsx41(RelationPicker, { field: field2, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
|
|
11011
11014
|
default:
|
|
11012
11015
|
if (typeof value === "boolean" || field2.config?.["kind"] === "boolean") {
|
|
11013
11016
|
return /* @__PURE__ */ jsx41(
|
|
@@ -12415,6 +12418,7 @@ function GridCell({
|
|
|
12415
12418
|
OpenCell,
|
|
12416
12419
|
{
|
|
12417
12420
|
field: field2,
|
|
12421
|
+
recordId: row.id,
|
|
12418
12422
|
draft: editing.draft,
|
|
12419
12423
|
initialSearch: editing.searchSeed,
|
|
12420
12424
|
onType: editing.type,
|
|
@@ -12760,7 +12764,8 @@ function OpenCell({
|
|
|
12760
12764
|
onCommit,
|
|
12761
12765
|
onCancel,
|
|
12762
12766
|
below,
|
|
12763
|
-
initialSearch
|
|
12767
|
+
initialSearch,
|
|
12768
|
+
recordId
|
|
12764
12769
|
}) {
|
|
12765
12770
|
const multiline = takesANewline(field2);
|
|
12766
12771
|
const picker = opensAsAList(field2, hostTakesFiles(useRecordsUi()));
|
|
@@ -12883,7 +12888,8 @@ function OpenCell({
|
|
|
12883
12888
|
...picker && ahead ? { initialSearch: ahead } : {},
|
|
12884
12889
|
onCommit: () => once(() => onCommit(null, "pick")),
|
|
12885
12890
|
onCancel: () => once(() => onCancel("pick")),
|
|
12886
|
-
addsChoices: true
|
|
12891
|
+
addsChoices: true,
|
|
12892
|
+
recordId
|
|
12887
12893
|
}
|
|
12888
12894
|
),
|
|
12889
12895
|
/* @__PURE__ */ jsxs38("span", { "data-records-cell-tray": "", className: FLOATING_CELL_TRAY_CLASS, children: [
|
|
@@ -17399,6 +17405,7 @@ function CustomRecordForm({
|
|
|
17399
17405
|
/* @__PURE__ */ jsx60("div", { className: "grid gap-3 sm:grid-cols-2", children: (fields.data ?? []).map((field2) => /* @__PURE__ */ jsx60(
|
|
17400
17406
|
FieldRow,
|
|
17401
17407
|
{
|
|
17408
|
+
recordId,
|
|
17402
17409
|
field: field2,
|
|
17403
17410
|
value: draft[field2.key],
|
|
17404
17411
|
document: existing.data?.document,
|
|
@@ -17473,7 +17480,8 @@ function FieldRow({
|
|
|
17473
17480
|
problems,
|
|
17474
17481
|
onChange,
|
|
17475
17482
|
onKeepEditing,
|
|
17476
|
-
onDiscard
|
|
17483
|
+
onDiscard,
|
|
17484
|
+
recordId
|
|
17477
17485
|
}) {
|
|
17478
17486
|
const id = `field-${field2.id}`;
|
|
17479
17487
|
const storedWords = document2?.[field2.key];
|
|
@@ -17484,7 +17492,7 @@ function FieldRow({
|
|
|
17484
17492
|
// A TEXT KEPT AS A FILE opens WHOLE, never as the 1000 characters its cell holds —
|
|
17485
17493
|
// saving those would cut the value (lane BIG-VALUES-WRITE).
|
|
17486
17494
|
/* @__PURE__ */ jsx60(WholeValueEditor, { field: field2, pointer: whole, words: String(storedWords ?? ""), value, onChange, id })
|
|
17487
|
-
) : /* @__PURE__ */ jsx60(FieldControl, { field: field2, value, onChange, id }),
|
|
17495
|
+
) : /* @__PURE__ */ jsx60(FieldControl, { field: field2, value, onChange, id, recordId }),
|
|
17488
17496
|
problems.map((problem, index) => /* @__PURE__ */ jsx60(
|
|
17489
17497
|
RefusalNotice,
|
|
17490
17498
|
{
|
|
@@ -19259,7 +19267,7 @@ function ReverseLinksEditor({ tableId, recordId, column, autoOpen, onClose }) {
|
|
|
19259
19267
|
if (done.ok) read.reload();
|
|
19260
19268
|
};
|
|
19261
19269
|
return /* @__PURE__ */ jsxs59("span", { className: "flex min-w-0 flex-col gap-1", "data-records-reverse-editor": column.key, children: [
|
|
19262
|
-
/* @__PURE__ */ jsx64(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose }),
|
|
19270
|
+
/* @__PURE__ */ jsx64(RelationPicker, { field: field2, value: current, onChange: (next) => void write(next), autoOpen, onClose, excludeId: recordId }),
|
|
19263
19271
|
refused ? /* @__PURE__ */ jsx64(RefusalNotice, { error: refused }) : null
|
|
19264
19272
|
] });
|
|
19265
19273
|
}
|