@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/pickers.js
CHANGED
|
@@ -1309,8 +1309,11 @@ function tellApart(rows, nameOf2) {
|
|
|
1309
1309
|
|
|
1310
1310
|
// src/RelationPicker.tsx
|
|
1311
1311
|
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1312
|
+
function withoutSelf(rows, selfId) {
|
|
1313
|
+
return selfId ? rows.filter((row) => row.id !== selfId) : rows;
|
|
1314
|
+
}
|
|
1312
1315
|
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.";
|
|
1313
|
-
function RelationPicker({ field, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose, onCancel }) {
|
|
1316
|
+
function RelationPicker({ field, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose, onCancel, excludeId }) {
|
|
1314
1317
|
const client = useOptionalRecordsClient();
|
|
1315
1318
|
const [rows, setRows] = useState3(null);
|
|
1316
1319
|
const [words, setWords] = useState3({});
|
|
@@ -1339,7 +1342,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
1339
1342
|
let cancelled = false;
|
|
1340
1343
|
void client.list({ table_id: target2, limit: 200 }).then((result) => {
|
|
1341
1344
|
if (cancelled) return;
|
|
1342
|
-
if (result.ok) setRows(result.data.rows);
|
|
1345
|
+
if (result.ok) setRows(withoutSelf(result.data.rows, excludeId));
|
|
1343
1346
|
else setRefusal(result.error);
|
|
1344
1347
|
});
|
|
1345
1348
|
return () => {
|
|
@@ -1449,7 +1452,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
1449
1452
|
}
|
|
1450
1453
|
const createdId = String(written.data);
|
|
1451
1454
|
const refreshed = await client.list({ table_id: tableId, limit: 200 });
|
|
1452
|
-
if (refreshed.ok) setRows(refreshed.data.rows);
|
|
1455
|
+
if (refreshed.ok) setRows(withoutSelf(refreshed.data.rows, excludeId));
|
|
1453
1456
|
setBusy(false);
|
|
1454
1457
|
setCreating(false);
|
|
1455
1458
|
setNewTitle("");
|
|
@@ -8033,7 +8036,7 @@ function isPersonsName(field) {
|
|
|
8033
8036
|
const words = `${field.key} ${field.label ?? ""}`.toLowerCase();
|
|
8034
8037
|
return /(^|[\s_])(full[\s_]?)?name(\s|$)/.test(words) && !/(therapist|doctor|physician|company|business|pet|room)/.test(words);
|
|
8035
8038
|
}
|
|
8036
|
-
function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen }) {
|
|
8039
|
+
function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen, recordId }) {
|
|
8037
8040
|
const host = useRecordsUi();
|
|
8038
8041
|
const kind = editorKindFor(field);
|
|
8039
8042
|
const inputId = id ?? `field-${field.key}`;
|
|
@@ -8118,9 +8121,9 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
8118
8121
|
if (hostTakesFiles(host)) {
|
|
8119
8122
|
return /* @__PURE__ */ jsx36(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
8120
8123
|
}
|
|
8121
|
-
return /* @__PURE__ */ jsx36(RelationPicker, { field, value, onChange, disabled, id: inputId });
|
|
8124
|
+
return /* @__PURE__ */ jsx36(RelationPicker, { field, value, onChange, disabled, id: inputId, excludeId: recordId });
|
|
8122
8125
|
case "relation":
|
|
8123
|
-
return /* @__PURE__ */ jsx36(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel });
|
|
8126
|
+
return /* @__PURE__ */ jsx36(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
|
|
8124
8127
|
default:
|
|
8125
8128
|
if (typeof value === "boolean" || field.config?.["kind"] === "boolean") {
|
|
8126
8129
|
return /* @__PURE__ */ jsx36(
|