@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.cjs
CHANGED
|
@@ -1315,8 +1315,11 @@ var import_jsx_runtime5 = (
|
|
|
1315
1315
|
// `FieldLabel`, so the sentence does not say it a second time.
|
|
1316
1316
|
require("react/jsx-runtime")
|
|
1317
1317
|
);
|
|
1318
|
+
function withoutSelf(rows, selfId) {
|
|
1319
|
+
return selfId ? rows.filter((row) => row.id !== selfId) : rows;
|
|
1320
|
+
}
|
|
1318
1321
|
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.";
|
|
1319
|
-
function RelationPicker({ field, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose, onCancel }) {
|
|
1322
|
+
function RelationPicker({ field, value, onChange, disabled, id, className, allowCreate = true, onPicked, autoOpen, onClose, onCancel, excludeId }) {
|
|
1320
1323
|
const client = (0, import_react4.useOptionalRecordsClient)();
|
|
1321
1324
|
const [rows, setRows] = (0, import_react3.useState)(null);
|
|
1322
1325
|
const [words, setWords] = (0, import_react3.useState)({});
|
|
@@ -1345,7 +1348,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
1345
1348
|
let cancelled = false;
|
|
1346
1349
|
void client.list({ table_id: target2, limit: 200 }).then((result) => {
|
|
1347
1350
|
if (cancelled) return;
|
|
1348
|
-
if (result.ok) setRows(result.data.rows);
|
|
1351
|
+
if (result.ok) setRows(withoutSelf(result.data.rows, excludeId));
|
|
1349
1352
|
else setRefusal(result.error);
|
|
1350
1353
|
});
|
|
1351
1354
|
return () => {
|
|
@@ -1451,7 +1454,7 @@ function RelationPicker({ field, value, onChange, disabled, id, className, allow
|
|
|
1451
1454
|
}
|
|
1452
1455
|
const createdId = String(written.data);
|
|
1453
1456
|
const refreshed = await client.list({ table_id: tableId, limit: 200 });
|
|
1454
|
-
if (refreshed.ok) setRows(refreshed.data.rows);
|
|
1457
|
+
if (refreshed.ok) setRows(withoutSelf(refreshed.data.rows, excludeId));
|
|
1455
1458
|
setBusy(false);
|
|
1456
1459
|
setCreating(false);
|
|
1457
1460
|
setNewTitle("");
|
|
@@ -7968,7 +7971,7 @@ function isPersonsName(field) {
|
|
|
7968
7971
|
const words = `${field.key} ${field.label ?? ""}`.toLowerCase();
|
|
7969
7972
|
return /(^|[\s_])(full[\s_]?)?name(\s|$)/.test(words) && !/(therapist|doctor|physician|company|business|pet|room)/.test(words);
|
|
7970
7973
|
}
|
|
7971
|
-
function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen }) {
|
|
7974
|
+
function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose, onCommit, onCancel, addsChoices, initialSearch, asForm, onChosen, recordId }) {
|
|
7972
7975
|
const host = useRecordsUi();
|
|
7973
7976
|
const kind = editorKindFor(field);
|
|
7974
7977
|
const inputId = id ?? `field-${field.key}`;
|
|
@@ -8053,9 +8056,9 @@ function FieldControl({ field, value, onChange, disabled, id, autoOpen, onClose,
|
|
|
8053
8056
|
if (hostTakesFiles(host)) {
|
|
8054
8057
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AttachmentControl, { field, value, onChange, disabled, id: inputId, autoOpen, onClose });
|
|
8055
8058
|
}
|
|
8056
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId });
|
|
8059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, excludeId: recordId });
|
|
8057
8060
|
case "relation":
|
|
8058
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel });
|
|
8061
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RelationPicker, { field, value, onChange, disabled, id: inputId, onPicked: onCommit, autoOpen, onClose, onCancel, excludeId: recordId });
|
|
8059
8062
|
default:
|
|
8060
8063
|
if (typeof value === "boolean" || field.config?.["kind"] === "boolean") {
|
|
8061
8064
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|