@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
+ ## 0.102.7
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/records-ui/v0.102.6..npm/records-ui/v0.102.7 -- apps/shared/records-ui`).
7
+ No source changes intended and no consumer action required.
8
+
3
9
  ## 0.102.6
4
10
 
5
11
  Automatic changed-only republish (docs/metadata drift since the last tag — see
package/dist/index.cjs CHANGED
@@ -5534,12 +5534,19 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
5534
5534
  " 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."
5535
5535
  ] });
5536
5536
  }
5537
+ const displayNameOf = (userId, recordName2) => {
5538
+ const member = userId ? (members ?? []).find((m) => m.userId === userId) : void 0;
5539
+ const own3 = (member?.name ?? "").trim();
5540
+ if (own3 !== "") return own3;
5541
+ const kept = (recordName2 ?? people.find((p) => p.userId === userId)?.name ?? "").trim();
5542
+ const email = (member?.email ?? "").trim();
5543
+ return kept !== "" && kept !== email ? kept : null;
5544
+ };
5537
5545
  const nameOfRecord = (recordId) => {
5538
5546
  const person = people.find((p) => p.id === recordId);
5539
5547
  if (!person) return "Loading\u2026";
5540
- if (person.name !== "") return person.name;
5541
5548
  const member = (members ?? []).find((m) => m.userId === person.userId);
5542
- return member ? memberName(member) : "A member with no name set";
5549
+ return displayNameOf(person.userId, person.name) ?? (member ? memberName(member) : person.name || "A member with no name set");
5543
5550
  };
5544
5551
  const pick = async (member) => {
5545
5552
  setBusy(true);
@@ -5601,10 +5608,10 @@ function PersonPicker({ field: field2, value, onChange, disabled, id, className,
5601
5608
  chips: picked.map((recordId) => ({ id: recordId, label: nameOfRecord(recordId), onRemove: () => drop(recordId) })),
5602
5609
  items: visible.map((member) => ({
5603
5610
  id: member.userId,
5604
- label: memberName(member),
5611
+ label: displayNameOf(member.userId) ?? memberName(member),
5605
5612
  // A name and an email with nothing between them read as one run-on string (verdict,
5606
5613
  // 19 September). They are two facts, so they are drawn as two.
5607
- detail: member.email && member.email !== memberName(member) ? member.email : null,
5614
+ detail: displayNameOf(member.userId) !== null && member.email ? member.email : null,
5608
5615
  picked: pickedUserIds.has(member.userId),
5609
5616
  disabled: busy
5610
5617
  })),