@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.cjs
CHANGED
|
@@ -5730,13 +5730,20 @@ async function writeRecordPatches(client, tableId, patches) {
|
|
|
5730
5730
|
}
|
|
5731
5731
|
}
|
|
5732
5732
|
async function writePersonWords(client, tableId, rows, people, key, as) {
|
|
5733
|
-
const patches =
|
|
5733
|
+
const patches = personWordsPatches(rows, people, key, as);
|
|
5734
|
+
await writeRecordPatches(client, tableId, patches);
|
|
5735
|
+
return patches.length;
|
|
5736
|
+
}
|
|
5737
|
+
function personWordsWritten(rows, people, as) {
|
|
5738
|
+
const out = {};
|
|
5734
5739
|
for (const row of rows) {
|
|
5735
5740
|
const words = wordsFor(row.ids, people, as);
|
|
5736
|
-
if (words !== null)
|
|
5741
|
+
if (words !== null) out[row.recordId] = words;
|
|
5737
5742
|
}
|
|
5738
|
-
|
|
5739
|
-
|
|
5743
|
+
return out;
|
|
5744
|
+
}
|
|
5745
|
+
function personWordsPatches(rows, people, key, as) {
|
|
5746
|
+
return Object.entries(personWordsWritten(rows, people, as)).map(([recordId, words]) => ({ recordId, patch: { [key]: words } }));
|
|
5740
5747
|
}
|
|
5741
5748
|
|
|
5742
5749
|
// src/FieldRetype.tsx
|
|
@@ -5858,6 +5865,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5858
5865
|
setRefusal(null);
|
|
5859
5866
|
let holding;
|
|
5860
5867
|
let aside;
|
|
5868
|
+
let wordsWritten;
|
|
5861
5869
|
const offerUndo = (migration) => {
|
|
5862
5870
|
if (!migration || !notify?.reversible) return;
|
|
5863
5871
|
const wasPerson = person && read && (to.id === "text" || to.id === "email") ? read : null;
|
|
@@ -5866,7 +5874,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5866
5874
|
noun: "column",
|
|
5867
5875
|
subject: name,
|
|
5868
5876
|
undo: async () => {
|
|
5869
|
-
const back = await client.migrateUndo({ migration_id: migration });
|
|
5877
|
+
const back = await client.migrateUndo({ migration_id: migration, ...wordsWritten ? { written: wordsWritten } : {} });
|
|
5870
5878
|
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
5871
5879
|
if (wasPerson) {
|
|
5872
5880
|
await writeRecordPatches(
|
|
@@ -5906,6 +5914,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5906
5914
|
if (person && read && (to.id === "text" || to.id === "email")) {
|
|
5907
5915
|
const as = to.id === "email" ? "email" : "name";
|
|
5908
5916
|
try {
|
|
5917
|
+
wordsWritten = personWordsWritten(read.rows, read.people, as);
|
|
5909
5918
|
const written = await writePersonWords(client, tableId, read.rows, read.people, field.key, as);
|
|
5910
5919
|
holding = written;
|
|
5911
5920
|
aside = read.rows.length - written;
|