@ai-matrx/records-ui 0.93.11 → 0.93.12
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 -1
- package/dist/index.cjs +37 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +37 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records-ui
|
|
2
2
|
|
|
3
|
-
## 0.93.
|
|
3
|
+
## 0.93.12
|
|
4
4
|
### Unreleased
|
|
5
|
+
### page-pass shared fix (2026-09-27): the agent door shows each field's value and can set values
|
|
6
|
+
|
|
7
|
+
- `CustomFieldsAgentState.fields[].value` (this record's current value) and `mayFill`; the door gains `checkValues` / `setValues` (one `custom.entity_value_write`, fields named by key or label). New exports `CustomFieldValuesRequest`, `CustomFieldSetResult`. An agent on a template page could neither see nor set the custom fields shown on it.
|
|
8
|
+
|
|
9
|
+
## 0.93.11
|
|
10
|
+
|
|
5
11
|
### page-pass shared fix (2026-09-27): a custom field can be archived where it was added
|
|
6
12
|
|
|
7
13
|
- **`CustomFieldsSection` → Edit → "Remove field"** (for whoever may add one): an inline confirm names the consequence (removed for everyone in the organization; values stay in every record and come back with it), then `custom.entity_field_retire` archives it (soft delete). Adding had no undo anywhere in the UI. Proof: `custom-fields-empty-select-and-agent-door.test.tsx`, red on the previous component.
|
package/dist/index.cjs
CHANGED
|
@@ -13880,9 +13880,9 @@ function CustomFieldsSection({
|
|
|
13880
13880
|
const [removing, setRemoving] = (0, import_react71.useState)(null);
|
|
13881
13881
|
const fields = (0, import_react71.useMemo)(() => read.data?.fields ?? [], [read.data]);
|
|
13882
13882
|
const mayAdd = rights.data?.may_declare === true;
|
|
13883
|
-
const live = (0, import_react71.useRef)({ fields, rights: rights.data, loading: rights.loading, reload: read.reload });
|
|
13883
|
+
const live = (0, import_react71.useRef)({ fields, rights: rights.data, loading: rights.loading, reload: read.reload, values: read.data?.custom ?? {} });
|
|
13884
13884
|
(0, import_react71.useEffect)(() => {
|
|
13885
|
-
live.current = { fields, rights: rights.data, loading: rights.loading, reload: read.reload };
|
|
13885
|
+
live.current = { fields, rights: rights.data, loading: rights.loading, reload: read.reload, values: read.data?.custom ?? {} };
|
|
13886
13886
|
});
|
|
13887
13887
|
(0, import_react71.useEffect)(() => {
|
|
13888
13888
|
if (!agentDoor) return;
|
|
@@ -13894,7 +13894,8 @@ function CustomFieldsSection({
|
|
|
13894
13894
|
entityLabel: now.rights?.label ?? null,
|
|
13895
13895
|
mayAdd: now.rights ? now.rights.may_declare === true : now.loading ? null : false,
|
|
13896
13896
|
refusal: now.rights && !now.rights.may_declare ? now.rights.reason ?? null : null,
|
|
13897
|
-
fields: now.fields.map((f) => ({ key: f.key, label: f.label, type: f.type })),
|
|
13897
|
+
fields: now.fields.map((f) => ({ key: f.key, label: f.label, type: f.type, value: now.values[f.key] })),
|
|
13898
|
+
mayFill: now.rights ? now.rights.may_fill_in !== false : now.loading ? null : false,
|
|
13898
13899
|
types: ADDABLE_TYPES
|
|
13899
13900
|
};
|
|
13900
13901
|
};
|
|
@@ -13926,7 +13927,39 @@ function CustomFieldsSection({
|
|
|
13926
13927
|
}
|
|
13927
13928
|
return { ok: true, field_id: declared2.data, label, type };
|
|
13928
13929
|
};
|
|
13929
|
-
|
|
13930
|
+
const resolveKeys = (values2) => {
|
|
13931
|
+
const now = live.current;
|
|
13932
|
+
const problems = [];
|
|
13933
|
+
const patch = {};
|
|
13934
|
+
const written2 = [];
|
|
13935
|
+
const entries = values2 && typeof values2 === "object" && !Array.isArray(values2) ? Object.entries(values2) : [];
|
|
13936
|
+
if (entries.length === 0) problems.push("Name at least one field and its value.");
|
|
13937
|
+
for (const [name, value] of entries) {
|
|
13938
|
+
const want = name.trim().toLowerCase();
|
|
13939
|
+
const field2 = now.fields.find((f) => f.key.toLowerCase() === want || f.label.trim().toLowerCase() === want);
|
|
13940
|
+
if (!field2) {
|
|
13941
|
+
problems.push(`There is no custom field "${name}". Fields: ${now.fields.map((f) => f.label).join(", ") || "none yet"}.`);
|
|
13942
|
+
continue;
|
|
13943
|
+
}
|
|
13944
|
+
patch[field2.key] = value;
|
|
13945
|
+
written2.push({ key: field2.key, label: field2.label, value });
|
|
13946
|
+
}
|
|
13947
|
+
if (now.rights && now.rights.may_fill_in === false) problems.push("This person may not fill in custom fields on this record.");
|
|
13948
|
+
return { problems, patch, written: written2 };
|
|
13949
|
+
};
|
|
13950
|
+
const checkValues = (values2) => resolveKeys(values2).problems;
|
|
13951
|
+
const setValues = async (values2) => {
|
|
13952
|
+
const { problems, patch, written: written2 } = resolveKeys(values2);
|
|
13953
|
+
if (problems.length > 0) return { ok: false, message: problems.join(" ") };
|
|
13954
|
+
const result = await client.entityValueWrite({ token: entityToken, record_id: recordId, patch });
|
|
13955
|
+
if (!result.ok) {
|
|
13956
|
+
const hint = hintForAPerson(result.error.hint);
|
|
13957
|
+
return { ok: false, message: hint ? `${result.error.message} ${hint}` : result.error.message };
|
|
13958
|
+
}
|
|
13959
|
+
live.current.reload();
|
|
13960
|
+
return { ok: true, written: written2 };
|
|
13961
|
+
};
|
|
13962
|
+
return agentDoor({ entityToken, recordId, state, check, addField, checkValues, setValues });
|
|
13930
13963
|
}, [agentDoor, client, entityToken, recordId]);
|
|
13931
13964
|
if (!read.loading && !read.error && fields.length === 0 && !mayAdd) return null;
|
|
13932
13965
|
if (read.error) return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(RefusalLine, { error: read.error, className });
|