@ai-matrx/records-ui 0.115.86 → 0.115.88
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 +19 -1
- package/dist/index.cjs +62 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +63 -35
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +57 -29
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +58 -29
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records-ui
|
|
2
2
|
|
|
3
|
-
## 0.115.
|
|
3
|
+
## 0.115.88
|
|
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.87
|
|
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 14f33fb01d 4703c9c0bf -- apps/shared/records-ui/src`
|
|
13
|
+
|
|
14
|
+
Changed shipped source files (1):
|
|
15
|
+
- `apps/shared/records-ui/src/FieldRetype.tsx`
|
|
16
|
+
|
|
17
|
+
## 0.115.86
|
|
18
|
+
|
|
19
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
20
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
21
|
+
Diff: `git diff 7b1d72070c 14f33fb01d -- apps/shared/records-ui/src`
|
|
22
|
+
|
|
23
|
+
Changed shipped source files (1):
|
|
24
|
+
- `apps/shared/records-ui/src/cellMarks.tsx`
|
|
25
|
+
|
|
8
26
|
## 0.115.85
|
|
9
27
|
|
|
10
28
|
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
package/dist/index.cjs
CHANGED
|
@@ -3212,6 +3212,10 @@ function useKeptPeople(value, roster) {
|
|
|
3212
3212
|
return people;
|
|
3213
3213
|
}
|
|
3214
3214
|
|
|
3215
|
+
// src/recordVersions.ts
|
|
3216
|
+
var recordVersions_exports = {};
|
|
3217
|
+
__reExport(recordVersions_exports, require("@ai-matrx/records/versions"));
|
|
3218
|
+
|
|
3215
3219
|
// src/personRetype.ts
|
|
3216
3220
|
var PAGE = 500;
|
|
3217
3221
|
var CEILING = 2e4;
|
|
@@ -3222,7 +3226,7 @@ async function readPersonColumn(client, tableId, key) {
|
|
|
3222
3226
|
const out = [];
|
|
3223
3227
|
for (let offset = 0; offset < CEILING; offset += PAGE) {
|
|
3224
3228
|
const page = await client.list({ table_id: tableId, limit: PAGE, offset });
|
|
3225
|
-
if (!page.ok) throw new Error(page.error
|
|
3229
|
+
if (!page.ok) throw new Error(refusalSentence(page.error));
|
|
3226
3230
|
for (const row of page.data.rows) {
|
|
3227
3231
|
const doc = row.document ?? {};
|
|
3228
3232
|
let ids = idsIn(doc[key]);
|
|
@@ -3260,17 +3264,36 @@ function previewPersonWords(rows, people, as) {
|
|
|
3260
3264
|
}
|
|
3261
3265
|
return { converts, keptAside, examples, partial: false };
|
|
3262
3266
|
}
|
|
3267
|
+
async function versionsNow(client, ids) {
|
|
3268
|
+
const out = /* @__PURE__ */ new Map();
|
|
3269
|
+
for (let i = 0; i < ids.length; i += 200) {
|
|
3270
|
+
const got = await client.recordHeaders({ ids: ids.slice(i, i + 200) });
|
|
3271
|
+
if (!got.ok) throw new Error(refusalSentence(got.error));
|
|
3272
|
+
for (const h of got.data ?? []) if (typeof h.version === "number") out.set(h.id, h.version);
|
|
3273
|
+
}
|
|
3274
|
+
return out;
|
|
3275
|
+
}
|
|
3276
|
+
async function writeRecordPatches(client, tableId, patches) {
|
|
3277
|
+
const versions = await versionsNow(client, patches.map((p) => p.recordId));
|
|
3278
|
+
for (let i = 0; i < patches.length; i += 100) {
|
|
3279
|
+
const changes = patches.slice(i, i + 100).map((p) => ({
|
|
3280
|
+
op: "update",
|
|
3281
|
+
record_id: p.recordId,
|
|
3282
|
+
patch: p.patch,
|
|
3283
|
+
expected_version: versions.get(p.recordId) ?? null
|
|
3284
|
+
}));
|
|
3285
|
+
const done = await (0, recordVersions_exports.changeRecordsAt)(client, { table_id: tableId, changes });
|
|
3286
|
+
if (!done.ok) throw new Error(refusalSentence(done.error));
|
|
3287
|
+
}
|
|
3288
|
+
}
|
|
3263
3289
|
async function writePersonWords(client, tableId, rows, people, key, as) {
|
|
3264
|
-
const
|
|
3290
|
+
const patches = [];
|
|
3265
3291
|
for (const row of rows) {
|
|
3266
3292
|
const words2 = wordsFor(row.ids, people, as);
|
|
3267
|
-
if (words2 !== null)
|
|
3268
|
-
}
|
|
3269
|
-
for (let i = 0; i < changes.length; i += 100) {
|
|
3270
|
-
const done = await client.recordChangeMany({ table_id: tableId, changes: changes.slice(i, i + 100) });
|
|
3271
|
-
if (!done.ok) throw new Error(done.error.message ?? "The words could not be written");
|
|
3293
|
+
if (words2 !== null) patches.push({ recordId: row.recordId, patch: { [key]: words2 } });
|
|
3272
3294
|
}
|
|
3273
|
-
|
|
3295
|
+
await writeRecordPatches(client, tableId, patches);
|
|
3296
|
+
return patches.length;
|
|
3274
3297
|
}
|
|
3275
3298
|
|
|
3276
3299
|
// src/FieldRetype.tsx
|
|
@@ -3392,6 +3415,28 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
3392
3415
|
setRefusal(null);
|
|
3393
3416
|
let holding;
|
|
3394
3417
|
let aside;
|
|
3418
|
+
const offerUndo = (migration) => {
|
|
3419
|
+
if (!migration || !notify?.reversible) return;
|
|
3420
|
+
const wasPerson = person && read && (to.id === "text" || to.id === "email") ? read : null;
|
|
3421
|
+
notify.reversible({
|
|
3422
|
+
verb: "change",
|
|
3423
|
+
noun: "column",
|
|
3424
|
+
subject: name,
|
|
3425
|
+
undo: async () => {
|
|
3426
|
+
const back = await client.migrateUndo({ migration_id: migration });
|
|
3427
|
+
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
3428
|
+
if (wasPerson) {
|
|
3429
|
+
await writeRecordPatches(
|
|
3430
|
+
client,
|
|
3431
|
+
tableId,
|
|
3432
|
+
wasPerson.rows.map((r) => ({ recordId: r.recordId, patch: { [field2.key]: field2.multi ? r.ids : r.ids[0] ?? null } }))
|
|
3433
|
+
);
|
|
3434
|
+
}
|
|
3435
|
+
(0, import_react16.tableShapeChanged)(tableId);
|
|
3436
|
+
onRetyped?.();
|
|
3437
|
+
}
|
|
3438
|
+
});
|
|
3439
|
+
};
|
|
3395
3440
|
if (to.via !== "behaviour") {
|
|
3396
3441
|
const done = await client.fieldUpdate({ field_id: field2.id, patch: { parity_type: to.parity } });
|
|
3397
3442
|
setBusy(false);
|
|
@@ -3401,6 +3446,9 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
3401
3446
|
}
|
|
3402
3447
|
holding = preview?.converts ?? 0;
|
|
3403
3448
|
aside = preview?.keptAside ?? 0;
|
|
3449
|
+
const recorded = await client.migrations({ target_id: field2.id, limit: 1 });
|
|
3450
|
+
const newest = recorded.ok ? recorded.data[0] : void 0;
|
|
3451
|
+
if (newest && !newest.undone_at) offerUndo(newest.id);
|
|
3404
3452
|
} else {
|
|
3405
3453
|
const done = await client.migrateRetype({ field_id: field2.id, to: to.behaviour });
|
|
3406
3454
|
setBusy(false);
|
|
@@ -3410,27 +3458,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
3410
3458
|
}
|
|
3411
3459
|
holding = done.data.records_still_holding_a_value ?? 0;
|
|
3412
3460
|
aside = done.data.values_in_retired_for_this_field ?? 0;
|
|
3413
|
-
|
|
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
|
-
}
|
|
3461
|
+
offerUndo(done.data.migration_id);
|
|
3434
3462
|
}
|
|
3435
3463
|
if (person && read && (to.id === "text" || to.id === "email")) {
|
|
3436
3464
|
const as = to.id === "email" ? "email" : "name";
|
|
@@ -3946,10 +3974,6 @@ function groupsOf(options) {
|
|
|
3946
3974
|
return out;
|
|
3947
3975
|
}
|
|
3948
3976
|
|
|
3949
|
-
// src/recordVersions.ts
|
|
3950
|
-
var recordVersions_exports = {};
|
|
3951
|
-
__reExport(recordVersions_exports, require("@ai-matrx/records/versions"));
|
|
3952
|
-
|
|
3953
3977
|
// src/writeOnTheWinningVersion.ts
|
|
3954
3978
|
var writeOnTheWinningVersion_exports = {};
|
|
3955
3979
|
__reExport(writeOnTheWinningVersion_exports, require("@ai-matrx/records/versions"));
|
|
@@ -54471,7 +54495,11 @@ function TablePage({
|
|
|
54471
54495
|
setOpenRecord(activeRecordId);
|
|
54472
54496
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
54473
54497
|
}, [activeRecordId]);
|
|
54474
|
-
const [shownIds,
|
|
54498
|
+
const [shownIds, setShownIdsRaw] = (0, import_react318.useState)([]);
|
|
54499
|
+
const setShownIds = (0, import_react318.useCallback)(
|
|
54500
|
+
(next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
|
|
54501
|
+
[]
|
|
54502
|
+
);
|
|
54475
54503
|
const [recordExpanded, setRecordExpanded] = (0, import_react318.useState)(false);
|
|
54476
54504
|
const shownRecord = rail === "record" ? openRecord : null;
|
|
54477
54505
|
const reportedRecord = (0, import_react318.useRef)(activeRecordId ?? null);
|