@ai-matrx/records-ui 0.115.85 → 0.115.87

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,10 +1,31 @@
1
1
  # Changelog — @ai-matrx/records-ui
2
2
 
3
- ## 0.115.85
3
+ ## 0.115.87
4
4
 
5
5
  UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
6
6
  Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
7
7
 
8
+ ## 0.115.85
9
+
10
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
11
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
12
+ Diff: `git diff 35c2117c58 7b1d72070c -- apps/shared/records-ui/src`
13
+
14
+ Changed shipped source files (16):
15
+ - `apps/shared/records-ui/src/AsOfReading.tsx`
16
+ - `apps/shared/records-ui/src/CommentThread.tsx`
17
+ - `apps/shared/records-ui/src/FieldHistoryPanel.tsx`
18
+ - `apps/shared/records-ui/src/FieldRetype.tsx`
19
+ - `apps/shared/records-ui/src/HistoryPanel.tsx`
20
+ - `apps/shared/records-ui/src/Peek.tsx`
21
+ - `apps/shared/records-ui/src/PersonNamesBridge.tsx`
22
+ - `apps/shared/records-ui/src/RecordsMount.tsx`
23
+ - `apps/shared/records-ui/src/RetiredValues.tsx`
24
+ - `apps/shared/records-ui/src/ValueAlternates.tsx`
25
+ - `apps/shared/records-ui/src/host.tsx`
26
+ - `apps/shared/records-ui/src/memberNames.ts`
27
+ - ...and 4 more
28
+
8
29
  ## 0.115.84
9
30
 
10
31
  SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
package/dist/index.cjs CHANGED
@@ -3392,6 +3392,28 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
3392
3392
  setRefusal(null);
3393
3393
  let holding;
3394
3394
  let aside;
3395
+ const offerUndo = (migration) => {
3396
+ if (!migration || !notify?.reversible) return;
3397
+ const wasPerson = person && read && (to.id === "text" || to.id === "email") ? read : null;
3398
+ notify.reversible({
3399
+ verb: "change",
3400
+ noun: "column",
3401
+ subject: name,
3402
+ undo: async () => {
3403
+ const back = await client.migrateUndo({ migration_id: migration });
3404
+ if (!back.ok) throw new Error(refusalSentence(back.error));
3405
+ if (wasPerson) {
3406
+ const changes = wasPerson.rows.map((r) => ({ op: "update", record_id: r.recordId, patch: { [field2.key]: field2.multi ? r.ids : r.ids[0] ?? null } }));
3407
+ for (let i = 0; i < changes.length; i += 100) {
3408
+ const put = await client.recordChangeMany({ table_id: tableId, changes: changes.slice(i, i + 100) });
3409
+ if (!put.ok) throw new Error(refusalSentence(put.error));
3410
+ }
3411
+ }
3412
+ (0, import_react16.tableShapeChanged)(tableId);
3413
+ onRetyped?.();
3414
+ }
3415
+ });
3416
+ };
3395
3417
  if (to.via !== "behaviour") {
3396
3418
  const done = await client.fieldUpdate({ field_id: field2.id, patch: { parity_type: to.parity } });
3397
3419
  setBusy(false);
@@ -3401,6 +3423,9 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
3401
3423
  }
3402
3424
  holding = preview?.converts ?? 0;
3403
3425
  aside = preview?.keptAside ?? 0;
3426
+ const recorded = await client.migrations({ target_id: field2.id, limit: 1 });
3427
+ const newest = recorded.ok ? recorded.data[0] : void 0;
3428
+ if (newest && !newest.undone_at) offerUndo(newest.id);
3404
3429
  } else {
3405
3430
  const done = await client.migrateRetype({ field_id: field2.id, to: to.behaviour });
3406
3431
  setBusy(false);
@@ -3410,27 +3435,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
3410
3435
  }
3411
3436
  holding = done.data.records_still_holding_a_value ?? 0;
3412
3437
  aside = done.data.values_in_retired_for_this_field ?? 0;
3413
- const migration = done.data.migration_id;
3414
- if (migration && notify?.reversible) {
3415
- notify.reversible({
3416
- verb: "change",
3417
- noun: "column",
3418
- subject: name,
3419
- undo: async () => {
3420
- const back = await client.migrateUndo({ migration_id: migration });
3421
- if (!back.ok) throw new Error(refusalSentence(back.error));
3422
- if (person && read && (to.id === "text" || to.id === "email")) {
3423
- const changes = read.rows.map((r) => ({ op: "update", record_id: r.recordId, patch: { [field2.key]: field2.multi ? r.ids : r.ids[0] ?? null } }));
3424
- for (let i = 0; i < changes.length; i += 100) {
3425
- const put = await client.recordChangeMany({ table_id: tableId, changes: changes.slice(i, i + 100) });
3426
- if (!put.ok) throw new Error(refusalSentence(put.error));
3427
- }
3428
- }
3429
- (0, import_react16.tableShapeChanged)(tableId);
3430
- onRetyped?.();
3431
- }
3432
- });
3433
- }
3438
+ offerUndo(done.data.migration_id);
3434
3439
  }
3435
3440
  if (person && read && (to.id === "text" || to.id === "email")) {
3436
3441
  const as = to.id === "email" ? "email" : "name";
@@ -7899,13 +7904,31 @@ function keptAsideReason(field2, entry) {
7899
7904
  }
7900
7905
  function KeptAsideValue({ field: field2, entry, shown: shown5 }) {
7901
7906
  const why = keptAsideReason(field2, entry);
7907
+ const open = useRecordsUi().openPerson;
7908
+ const person = (Array.isArray(entry.value) ? entry.value : [entry.value]).find(isUserId);
7909
+ const opens = open && typeof person === "string";
7902
7910
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
7903
7911
  "span",
7904
7912
  {
7905
7913
  "data-records-kept-aside": field2.key,
7906
7914
  title: why,
7907
7915
  "aria-label": `${shown5}. ${why}`,
7908
- className: "cursor-help rounded-sm bg-amber-500/10 px-0.5 text-amber-700 dark:text-amber-300",
7916
+ className: `${opens ? "cursor-pointer underline-offset-2 hover:underline" : "cursor-help"} rounded-sm bg-amber-500/10 px-0.5 text-amber-700 dark:text-amber-300`,
7917
+ ...opens ? {
7918
+ role: "button",
7919
+ tabIndex: 0,
7920
+ onClick: (e) => {
7921
+ e.stopPropagation();
7922
+ void openStoredPerson(person, open);
7923
+ },
7924
+ onKeyDown: (e) => {
7925
+ if (e.key === "Enter" || e.key === " ") {
7926
+ e.preventDefault();
7927
+ e.stopPropagation();
7928
+ void openStoredPerson(person, open);
7929
+ }
7930
+ }
7931
+ } : {},
7909
7932
  children: shown5
7910
7933
  }
7911
7934
  );