@ai-matrx/records-ui 0.115.88 → 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 +12 -1
- package/dist/index.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +14 -5
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +14 -5
- package/dist/pickers.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -2666,13 +2666,20 @@ async function writeRecordPatches(client, tableId, patches) {
|
|
|
2666
2666
|
}
|
|
2667
2667
|
}
|
|
2668
2668
|
async function writePersonWords(client, tableId, rows, people, key, as) {
|
|
2669
|
-
const patches =
|
|
2669
|
+
const patches = personWordsPatches(rows, people, key, as);
|
|
2670
|
+
await writeRecordPatches(client, tableId, patches);
|
|
2671
|
+
return patches.length;
|
|
2672
|
+
}
|
|
2673
|
+
function personWordsWritten(rows, people, as) {
|
|
2674
|
+
const out = {};
|
|
2670
2675
|
for (const row of rows) {
|
|
2671
2676
|
const words2 = wordsFor(row.ids, people, as);
|
|
2672
|
-
if (words2 !== null)
|
|
2677
|
+
if (words2 !== null) out[row.recordId] = words2;
|
|
2673
2678
|
}
|
|
2674
|
-
|
|
2675
|
-
|
|
2679
|
+
return out;
|
|
2680
|
+
}
|
|
2681
|
+
function personWordsPatches(rows, people, key, as) {
|
|
2682
|
+
return Object.entries(personWordsWritten(rows, people, as)).map(([recordId, words2]) => ({ recordId, patch: { [key]: words2 } }));
|
|
2676
2683
|
}
|
|
2677
2684
|
|
|
2678
2685
|
// src/FieldRetype.tsx
|
|
@@ -2794,6 +2801,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
2794
2801
|
setRefusal(null);
|
|
2795
2802
|
let holding;
|
|
2796
2803
|
let aside;
|
|
2804
|
+
let wordsWritten;
|
|
2797
2805
|
const offerUndo = (migration) => {
|
|
2798
2806
|
if (!migration || !notify?.reversible) return;
|
|
2799
2807
|
const wasPerson = person && read && (to.id === "text" || to.id === "email") ? read : null;
|
|
@@ -2802,7 +2810,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
2802
2810
|
noun: "column",
|
|
2803
2811
|
subject: name,
|
|
2804
2812
|
undo: async () => {
|
|
2805
|
-
const back = await client.migrateUndo({ migration_id: migration });
|
|
2813
|
+
const back = await client.migrateUndo({ migration_id: migration, ...wordsWritten ? { written: wordsWritten } : {} });
|
|
2806
2814
|
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
2807
2815
|
if (wasPerson) {
|
|
2808
2816
|
await writeRecordPatches(
|
|
@@ -2842,6 +2850,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
2842
2850
|
if (person && read && (to.id === "text" || to.id === "email")) {
|
|
2843
2851
|
const as = to.id === "email" ? "email" : "name";
|
|
2844
2852
|
try {
|
|
2853
|
+
wordsWritten = personWordsWritten(read.rows, read.people, as);
|
|
2845
2854
|
const written = await writePersonWords(client, tableId, read.rows, read.people, field2.key, as);
|
|
2846
2855
|
holding = written;
|
|
2847
2856
|
aside = read.rows.length - written;
|