@ai-matrx/records-ui 0.115.86 → 0.115.87
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 +26 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -21
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +26 -21
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +26 -21
- package/dist/pickers.js.map +1 -1
- package/package.json +4 -4
package/dist/pickers.cjs
CHANGED
|
@@ -5835,6 +5835,28 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5835
5835
|
setRefusal(null);
|
|
5836
5836
|
let holding;
|
|
5837
5837
|
let aside;
|
|
5838
|
+
const offerUndo = (migration) => {
|
|
5839
|
+
if (!migration || !notify?.reversible) return;
|
|
5840
|
+
const wasPerson = person && read && (to.id === "text" || to.id === "email") ? read : null;
|
|
5841
|
+
notify.reversible({
|
|
5842
|
+
verb: "change",
|
|
5843
|
+
noun: "column",
|
|
5844
|
+
subject: name,
|
|
5845
|
+
undo: async () => {
|
|
5846
|
+
const back = await client.migrateUndo({ migration_id: migration });
|
|
5847
|
+
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
5848
|
+
if (wasPerson) {
|
|
5849
|
+
const changes = wasPerson.rows.map((r) => ({ op: "update", record_id: r.recordId, patch: { [field.key]: field.multi ? r.ids : r.ids[0] ?? null } }));
|
|
5850
|
+
for (let i = 0; i < changes.length; i += 100) {
|
|
5851
|
+
const put = await client.recordChangeMany({ table_id: tableId, changes: changes.slice(i, i + 100) });
|
|
5852
|
+
if (!put.ok) throw new Error(refusalSentence(put.error));
|
|
5853
|
+
}
|
|
5854
|
+
}
|
|
5855
|
+
(0, import_react44.tableShapeChanged)(tableId);
|
|
5856
|
+
onRetyped?.();
|
|
5857
|
+
}
|
|
5858
|
+
});
|
|
5859
|
+
};
|
|
5838
5860
|
if (to.via !== "behaviour") {
|
|
5839
5861
|
const done = await client.fieldUpdate({ field_id: field.id, patch: { parity_type: to.parity } });
|
|
5840
5862
|
setBusy(false);
|
|
@@ -5844,6 +5866,9 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5844
5866
|
}
|
|
5845
5867
|
holding = preview?.converts ?? 0;
|
|
5846
5868
|
aside = preview?.keptAside ?? 0;
|
|
5869
|
+
const recorded = await client.migrations({ target_id: field.id, limit: 1 });
|
|
5870
|
+
const newest = recorded.ok ? recorded.data[0] : void 0;
|
|
5871
|
+
if (newest && !newest.undone_at) offerUndo(newest.id);
|
|
5847
5872
|
} else {
|
|
5848
5873
|
const done = await client.migrateRetype({ field_id: field.id, to: to.behaviour });
|
|
5849
5874
|
setBusy(false);
|
|
@@ -5853,27 +5878,7 @@ function FieldRetype({ field, tableId, onRetyped }) {
|
|
|
5853
5878
|
}
|
|
5854
5879
|
holding = done.data.records_still_holding_a_value ?? 0;
|
|
5855
5880
|
aside = done.data.values_in_retired_for_this_field ?? 0;
|
|
5856
|
-
|
|
5857
|
-
if (migration && notify?.reversible) {
|
|
5858
|
-
notify.reversible({
|
|
5859
|
-
verb: "change",
|
|
5860
|
-
noun: "column",
|
|
5861
|
-
subject: name,
|
|
5862
|
-
undo: async () => {
|
|
5863
|
-
const back = await client.migrateUndo({ migration_id: migration });
|
|
5864
|
-
if (!back.ok) throw new Error(refusalSentence(back.error));
|
|
5865
|
-
if (person && read && (to.id === "text" || to.id === "email")) {
|
|
5866
|
-
const changes = read.rows.map((r) => ({ op: "update", record_id: r.recordId, patch: { [field.key]: field.multi ? r.ids : r.ids[0] ?? null } }));
|
|
5867
|
-
for (let i = 0; i < changes.length; i += 100) {
|
|
5868
|
-
const put = await client.recordChangeMany({ table_id: tableId, changes: changes.slice(i, i + 100) });
|
|
5869
|
-
if (!put.ok) throw new Error(refusalSentence(put.error));
|
|
5870
|
-
}
|
|
5871
|
-
}
|
|
5872
|
-
(0, import_react44.tableShapeChanged)(tableId);
|
|
5873
|
-
onRetyped?.();
|
|
5874
|
-
}
|
|
5875
|
-
});
|
|
5876
|
-
}
|
|
5881
|
+
offerUndo(done.data.migration_id);
|
|
5877
5882
|
}
|
|
5878
5883
|
if (person && read && (to.id === "text" || to.id === "email")) {
|
|
5879
5884
|
const as = to.id === "email" ? "email" : "name";
|