@ai-matrx/records-ui 0.115.87 → 0.115.89
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 +30 -1
- package/dist/index.cjs +51 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +52 -20
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +46 -14
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +47 -14
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records-ui
|
|
2
2
|
|
|
3
|
-
## 0.115.
|
|
3
|
+
## 0.115.89
|
|
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.88
|
|
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 4703c9c0bf 7560bf9edf -- apps/shared/records-ui/src`
|
|
13
|
+
|
|
14
|
+
Changed shipped source files (3):
|
|
15
|
+
- `apps/shared/records-ui/src/FieldRetype.tsx`
|
|
16
|
+
- `apps/shared/records-ui/src/TablePage.tsx`
|
|
17
|
+
- `apps/shared/records-ui/src/personRetype.ts`
|
|
18
|
+
|
|
19
|
+
## 0.115.87
|
|
20
|
+
|
|
21
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
22
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
23
|
+
Diff: `git diff 14f33fb01d 4703c9c0bf -- apps/shared/records-ui/src`
|
|
24
|
+
|
|
25
|
+
Changed shipped source files (1):
|
|
26
|
+
- `apps/shared/records-ui/src/FieldRetype.tsx`
|
|
27
|
+
|
|
28
|
+
## 0.115.86
|
|
29
|
+
|
|
30
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
31
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
32
|
+
Diff: `git diff 7b1d72070c 14f33fb01d -- apps/shared/records-ui/src`
|
|
33
|
+
|
|
34
|
+
Changed shipped source files (1):
|
|
35
|
+
- `apps/shared/records-ui/src/cellMarks.tsx`
|
|
36
|
+
|
|
8
37
|
## 0.115.85
|
|
9
38
|
|
|
10
39
|
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,43 @@ 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 = personWordsPatches(rows, people, key, as);
|
|
3291
|
+
await writeRecordPatches(client, tableId, patches);
|
|
3292
|
+
return patches.length;
|
|
3293
|
+
}
|
|
3294
|
+
function personWordsWritten(rows, people, as) {
|
|
3295
|
+
const out = {};
|
|
3265
3296
|
for (const row of rows) {
|
|
3266
3297
|
const words2 = wordsFor(row.ids, people, as);
|
|
3267
|
-
if (words2 !== null)
|
|
3298
|
+
if (words2 !== null) out[row.recordId] = words2;
|
|
3268
3299
|
}
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
}
|
|
3273
|
-
return changes.length;
|
|
3300
|
+
return out;
|
|
3301
|
+
}
|
|
3302
|
+
function personWordsPatches(rows, people, key, as) {
|
|
3303
|
+
return Object.entries(personWordsWritten(rows, people, as)).map(([recordId, words2]) => ({ recordId, patch: { [key]: words2 } }));
|
|
3274
3304
|
}
|
|
3275
3305
|
|
|
3276
3306
|
// src/FieldRetype.tsx
|
|
@@ -3392,6 +3422,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
3392
3422
|
setRefusal(null);
|
|
3393
3423
|
let holding;
|
|
3394
3424
|
let aside;
|
|
3425
|
+
let wordsWritten;
|
|
3395
3426
|
const offerUndo = (migration) => {
|
|
3396
3427
|
if (!migration || !notify?.reversible) return;
|
|
3397
3428
|
const wasPerson = person && read && (to.id === "text" || to.id === "email") ? read : null;
|
|
@@ -3400,14 +3431,14 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
3400
3431
|
noun: "column",
|
|
3401
3432
|
subject: name,
|
|
3402
3433
|
undo: async () => {
|
|
3403
|
-
const back = await client.migrateUndo({ migration_id: migration });
|
|
3434
|
+
const back = await client.migrateUndo({ migration_id: migration, ...wordsWritten ? { written: wordsWritten } : {} });
|
|
3404
3435
|
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
3405
3436
|
if (wasPerson) {
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3437
|
+
await writeRecordPatches(
|
|
3438
|
+
client,
|
|
3439
|
+
tableId,
|
|
3440
|
+
wasPerson.rows.map((r) => ({ recordId: r.recordId, patch: { [field2.key]: field2.multi ? r.ids : r.ids[0] ?? null } }))
|
|
3441
|
+
);
|
|
3411
3442
|
}
|
|
3412
3443
|
(0, import_react16.tableShapeChanged)(tableId);
|
|
3413
3444
|
onRetyped?.();
|
|
@@ -3440,6 +3471,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
3440
3471
|
if (person && read && (to.id === "text" || to.id === "email")) {
|
|
3441
3472
|
const as = to.id === "email" ? "email" : "name";
|
|
3442
3473
|
try {
|
|
3474
|
+
wordsWritten = personWordsWritten(read.rows, read.people, as);
|
|
3443
3475
|
const written = await writePersonWords(client, tableId, read.rows, read.people, field2.key, as);
|
|
3444
3476
|
holding = written;
|
|
3445
3477
|
aside = read.rows.length - written;
|
|
@@ -3951,10 +3983,6 @@ function groupsOf(options) {
|
|
|
3951
3983
|
return out;
|
|
3952
3984
|
}
|
|
3953
3985
|
|
|
3954
|
-
// src/recordVersions.ts
|
|
3955
|
-
var recordVersions_exports = {};
|
|
3956
|
-
__reExport(recordVersions_exports, require("@ai-matrx/records/versions"));
|
|
3957
|
-
|
|
3958
3986
|
// src/writeOnTheWinningVersion.ts
|
|
3959
3987
|
var writeOnTheWinningVersion_exports = {};
|
|
3960
3988
|
__reExport(writeOnTheWinningVersion_exports, require("@ai-matrx/records/versions"));
|
|
@@ -54476,7 +54504,11 @@ function TablePage({
|
|
|
54476
54504
|
setOpenRecord(activeRecordId);
|
|
54477
54505
|
setSurface((now) => ({ ...now, rail: "record" }));
|
|
54478
54506
|
}, [activeRecordId]);
|
|
54479
|
-
const [shownIds,
|
|
54507
|
+
const [shownIds, setShownIdsRaw] = (0, import_react318.useState)([]);
|
|
54508
|
+
const setShownIds = (0, import_react318.useCallback)(
|
|
54509
|
+
(next) => setShownIdsRaw((prev) => prev.length === next.length && prev.every((id, i) => id === next[i]) ? prev : next),
|
|
54510
|
+
[]
|
|
54511
|
+
);
|
|
54480
54512
|
const [recordExpanded, setRecordExpanded] = (0, import_react318.useState)(false);
|
|
54481
54513
|
const shownRecord = rail === "record" ? openRecord : null;
|
|
54482
54514
|
const reportedRecord = (0, import_react318.useRef)(activeRecordId ?? null);
|