@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/pickers.js
CHANGED
|
@@ -5795,13 +5795,20 @@ async function writeRecordPatches(client, tableId, patches) {
|
|
|
5795
5795
|
}
|
|
5796
5796
|
}
|
|
5797
5797
|
async function writePersonWords(client, tableId, rows, people, key, as) {
|
|
5798
|
-
const patches =
|
|
5798
|
+
const patches = personWordsPatches(rows, people, key, as);
|
|
5799
|
+
await writeRecordPatches(client, tableId, patches);
|
|
5800
|
+
return patches.length;
|
|
5801
|
+
}
|
|
5802
|
+
function personWordsWritten(rows, people, as) {
|
|
5803
|
+
const out = {};
|
|
5799
5804
|
for (const row of rows) {
|
|
5800
5805
|
const words = wordsFor(row.ids, people, as);
|
|
5801
|
-
if (words !== null)
|
|
5806
|
+
if (words !== null) out[row.recordId] = words;
|
|
5802
5807
|
}
|
|
5803
|
-
|
|
5804
|
-
|
|
5808
|
+
return out;
|
|
5809
|
+
}
|
|
5810
|
+
function personWordsPatches(rows, people, key, as) {
|
|
5811
|
+
return Object.entries(personWordsWritten(rows, people, as)).map(([recordId, words]) => ({ recordId, patch: { [key]: words } }));
|
|
5805
5812
|
}
|
|
5806
5813
|
|
|
5807
5814
|
// src/FieldRetype.tsx
|
|
@@ -5923,6 +5930,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5923
5930
|
setRefusal(null);
|
|
5924
5931
|
let holding;
|
|
5925
5932
|
let aside;
|
|
5933
|
+
let wordsWritten;
|
|
5926
5934
|
const offerUndo = (migration) => {
|
|
5927
5935
|
if (!migration || !notify?.reversible) return;
|
|
5928
5936
|
const wasPerson = person && read && (to.id === "text" || to.id === "email") ? read : null;
|
|
@@ -5931,7 +5939,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5931
5939
|
noun: "column",
|
|
5932
5940
|
subject: name,
|
|
5933
5941
|
undo: async () => {
|
|
5934
|
-
const back = await client.migrateUndo({ migration_id: migration });
|
|
5942
|
+
const back = await client.migrateUndo({ migration_id: migration, ...wordsWritten ? { written: wordsWritten } : {} });
|
|
5935
5943
|
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
5936
5944
|
if (wasPerson) {
|
|
5937
5945
|
await writeRecordPatches(
|
|
@@ -5971,6 +5979,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5971
5979
|
if (person && read && (to.id === "text" || to.id === "email")) {
|
|
5972
5980
|
const as = to.id === "email" ? "email" : "name";
|
|
5973
5981
|
try {
|
|
5982
|
+
wordsWritten = personWordsWritten(read.rows, read.people, as);
|
|
5974
5983
|
const written = await writePersonWords(client, tableId, read.rows, read.people, field.key, as);
|
|
5975
5984
|
holding = written;
|
|
5976
5985
|
aside = read.rows.length - written;
|