@ai-matrx/records-ui 0.115.89 → 0.115.90
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 +1 -1
- package/dist/index.cjs +19 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +19 -1
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +19 -1
- package/dist/pickers.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -2681,6 +2681,23 @@ function personWordsWritten(rows, people, as) {
|
|
|
2681
2681
|
function personWordsPatches(rows, people, key, as) {
|
|
2682
2682
|
return Object.entries(personWordsWritten(rows, people, as)).map(([recordId, words2]) => ({ recordId, patch: { [key]: words2 } }));
|
|
2683
2683
|
}
|
|
2684
|
+
async function forgetWrittenWords(client, tableId, key, written) {
|
|
2685
|
+
const patches = [];
|
|
2686
|
+
for (let offset = 0; offset < CEILING; offset += PAGE) {
|
|
2687
|
+
const page = await client.list({ table_id: tableId, limit: PAGE, offset });
|
|
2688
|
+
if (!page.ok) throw new Error(refusalSentence(page.error));
|
|
2689
|
+
for (const row of page.data.rows) {
|
|
2690
|
+
const word = written[row.id];
|
|
2691
|
+
const kept = (row.document ?? {})["_retired"];
|
|
2692
|
+
if (word === void 0 || !Array.isArray(kept)) continue;
|
|
2693
|
+
const rest = kept.filter((e) => !(e?.key === key && e?.value === word));
|
|
2694
|
+
if (rest.length !== kept.length) patches.push({ recordId: row.id, patch: { _retired: rest } });
|
|
2695
|
+
}
|
|
2696
|
+
if (page.data.rows.length < PAGE) break;
|
|
2697
|
+
}
|
|
2698
|
+
await writeRecordPatches(client, tableId, patches);
|
|
2699
|
+
return patches.length;
|
|
2700
|
+
}
|
|
2684
2701
|
|
|
2685
2702
|
// src/FieldRetype.tsx
|
|
2686
2703
|
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
@@ -2810,7 +2827,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
2810
2827
|
noun: "column",
|
|
2811
2828
|
subject: name,
|
|
2812
2829
|
undo: async () => {
|
|
2813
|
-
const back = await client.migrateUndo({ migration_id: migration
|
|
2830
|
+
const back = await client.migrateUndo({ migration_id: migration });
|
|
2814
2831
|
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
2815
2832
|
if (wasPerson) {
|
|
2816
2833
|
await writeRecordPatches(
|
|
@@ -2818,6 +2835,7 @@ function FieldRetype({ field: field2, tableId, onRetyped }) {
|
|
|
2818
2835
|
tableId,
|
|
2819
2836
|
wasPerson.rows.map((r) => ({ recordId: r.recordId, patch: { [field2.key]: field2.multi ? r.ids : r.ids[0] ?? null } }))
|
|
2820
2837
|
);
|
|
2838
|
+
if (wordsWritten) await forgetWrittenWords(client, tableId, field2.key, wordsWritten);
|
|
2821
2839
|
}
|
|
2822
2840
|
tableShapeChanged(tableId);
|
|
2823
2841
|
onRetyped?.();
|