feat(est): save print settings to ESTX

This commit is contained in:
2026-11-06 22:45:11 +09:00
parent c4c3be0a7c
commit 0880665f28
6 changed files with 117 additions and 5 deletions
+21 -2
View File
@@ -123,7 +123,10 @@ const EstReport = (() => {
const original = new Map(
(EstApp.state.project.printCatalog || []).map((row) => [row.Index, row]),
);
catalog = defaults.map((row) => ({ ...row, ...original.get(row.Index) }));
catalog = defaults.map((row) => ({
...row,
...original.get(row.Index),
}));
const table = EstApp.state.project.tables[EstApp.state.view];
const s = setting(),
{ esc } = EstApp;
@@ -174,7 +177,11 @@ const EstReport = (() => {
EstApp.change(() => {
const next = { ...setting(), [key]: value };
if (key === "form") {
const original = catalog.find((row) => String(row.Index) === value);
const found = catalog.find((row) => String(row.Index) === value);
const original = found && {
...found,
...EstApp.state.project.nativePrintChanges?.[value],
};
if (original) {
next.rowsPerPage = Math.max(
1,
@@ -188,6 +195,18 @@ const EstReport = (() => {
EstApp.state.project.documents ||= {};
EstApp.state.project.documents[next.form] = value;
}
if (
["margin", "rowsPerPage"].includes(key) &&
next.form !== "current" &&
EstApp.state.project.printCatalog?.some((row) => String(row.Index) === next.form)
) {
EstApp.state.project.nativePrintChanges ||= {};
const changes = (EstApp.state.project.nativePrintChanges[next.form] ||= {});
if (key === "margin")
for (const side of ["PrintTop", "PrintBottom", "PrintLeft", "PrintRight"])
changes[side] = value;
else changes.PrintLineCount = value;
}
if (key === "form") next.notes = EstApp.state.project.documents?.[value] || "";
EstApp.state.project.printSettings = next;
}, false);