@ai-matrx/records-ui 0.102.6 → 0.102.7
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 +6 -0
- package/dist/index.cjs +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +11 -4
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +11 -4
- package/dist/pickers.js.map +1 -1
- package/package.json +5 -5
package/dist/pickers.cjs
CHANGED
|
@@ -2530,12 +2530,19 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
|
|
|
2530
2530
|
" is a person field, but it does not say which Table the people are records of yet, so there is nothing to pick from. A table admin sets its target in the field editor."
|
|
2531
2531
|
] });
|
|
2532
2532
|
}
|
|
2533
|
+
const displayNameOf = (userId, recordName2) => {
|
|
2534
|
+
const member = userId ? (members ?? []).find((m) => m.userId === userId) : void 0;
|
|
2535
|
+
const own3 = (member?.name ?? "").trim();
|
|
2536
|
+
if (own3 !== "") return own3;
|
|
2537
|
+
const kept = (recordName2 ?? people.find((p) => p.userId === userId)?.name ?? "").trim();
|
|
2538
|
+
const email = (member?.email ?? "").trim();
|
|
2539
|
+
return kept !== "" && kept !== email ? kept : null;
|
|
2540
|
+
};
|
|
2533
2541
|
const nameOfRecord = (recordId) => {
|
|
2534
2542
|
const person = people.find((p) => p.id === recordId);
|
|
2535
2543
|
if (!person) return "Loading\u2026";
|
|
2536
|
-
if (person.name !== "") return person.name;
|
|
2537
2544
|
const member = (members ?? []).find((m) => m.userId === person.userId);
|
|
2538
|
-
return member ? memberName(member) : "A member with no name set";
|
|
2545
|
+
return displayNameOf(person.userId, person.name) ?? (member ? memberName(member) : person.name || "A member with no name set");
|
|
2539
2546
|
};
|
|
2540
2547
|
const pick = async (member) => {
|
|
2541
2548
|
setBusy(true);
|
|
@@ -2597,10 +2604,10 @@ function PersonPicker({ field, value, onChange, disabled, id, className, autoOpe
|
|
|
2597
2604
|
chips: picked.map((recordId) => ({ id: recordId, label: nameOfRecord(recordId), onRemove: () => drop(recordId) })),
|
|
2598
2605
|
items: visible.map((member) => ({
|
|
2599
2606
|
id: member.userId,
|
|
2600
|
-
label: memberName(member),
|
|
2607
|
+
label: displayNameOf(member.userId) ?? memberName(member),
|
|
2601
2608
|
// A name and an email with nothing between them read as one run-on string (verdict,
|
|
2602
2609
|
// 19 September). They are two facts, so they are drawn as two.
|
|
2603
|
-
detail: member.
|
|
2610
|
+
detail: displayNameOf(member.userId) !== null && member.email ? member.email : null,
|
|
2604
2611
|
picked: pickedUserIds.has(member.userId),
|
|
2605
2612
|
disabled: busy
|
|
2606
2613
|
})),
|