@worm-vue3-print/core 1.3.1 → 1.3.2
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/dist/browser/index.cjs +16 -11
- package/dist/browser/index.js +1 -1
- package/dist/{chunk-AKWV6SID.js → chunk-B2XJSF4V.js} +1 -1
- package/dist/{chunk-KFRPTLFV.js → chunk-BBSFBAWT.js} +16 -11
- package/dist/designer/index.js +2 -2
- package/dist/index.cjs +16 -11
- package/dist/index.d.cts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/browser/index.cjs
CHANGED
|
@@ -2268,10 +2268,9 @@ function tableDesignBottom(el) {
|
|
|
2268
2268
|
const opts = el.options ?? {};
|
|
2269
2269
|
const top = opts.top ?? 0;
|
|
2270
2270
|
const rows = opts.tableRows ?? [];
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
return top + (opts.height ?? 0);
|
|
2271
|
+
const rowSum = rows.reduce((s, r) => s + (r.height ?? 0), 0);
|
|
2272
|
+
const designHeight = Math.max(opts.height ?? 0, rowSum);
|
|
2273
|
+
return top + designHeight;
|
|
2275
2274
|
}
|
|
2276
2275
|
function buildFollowMap(sorted, excludedIds) {
|
|
2277
2276
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -2412,7 +2411,10 @@ function paginate(template, measuredElements) {
|
|
|
2412
2411
|
let isFirstPage = true;
|
|
2413
2412
|
let pageBroken = false;
|
|
2414
2413
|
function sectionTop(el) {
|
|
2415
|
-
return pageBroken ?
|
|
2414
|
+
return pageBroken ? pageCursorTop() : el.options?.top ?? 0;
|
|
2415
|
+
}
|
|
2416
|
+
function pageCursorTop() {
|
|
2417
|
+
return Math.max(0, fullPageHeight() - remaining);
|
|
2416
2418
|
}
|
|
2417
2419
|
function fullPageHeight() {
|
|
2418
2420
|
return isFirstPage ? contentHeight - overlayH - SAFETY_MARGIN : contentHeight - SAFETY_MARGIN;
|
|
@@ -2479,7 +2481,7 @@ function paginate(template, measuredElements) {
|
|
|
2479
2481
|
function paginateNonTable(el, measured, sortedList, idx) {
|
|
2480
2482
|
const elHeight = measured.get(el.id)?.measuredHeight ?? el.options?.height ?? 0;
|
|
2481
2483
|
if (elHeight <= remaining) {
|
|
2482
|
-
const top2 = pageBroken ?
|
|
2484
|
+
const top2 = pageBroken ? pageCursorTop() : el.options?.top ?? 0;
|
|
2483
2485
|
noteOverflow(top2 + elHeight);
|
|
2484
2486
|
currentPage.push({ elementId: el.id, type: "element", renderTop: sectionTop(el) });
|
|
2485
2487
|
remaining -= elHeight;
|
|
@@ -2498,8 +2500,9 @@ function paginate(template, measuredElements) {
|
|
|
2498
2500
|
}
|
|
2499
2501
|
return idx + 1;
|
|
2500
2502
|
}
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
+
finishPage();
|
|
2504
|
+
const top = pageBroken ? pageCursorTop() : el.options?.top ?? 0;
|
|
2505
|
+
if (top + elHeight > contentHeight) overflowOnCurrent = true;
|
|
2503
2506
|
currentPage.push({ elementId: el.id, type: "element", renderTop: sectionTop(el) });
|
|
2504
2507
|
remaining -= elHeight;
|
|
2505
2508
|
return idx + 1;
|
|
@@ -2515,7 +2518,7 @@ function paginate(template, measuredElements) {
|
|
|
2515
2518
|
}
|
|
2516
2519
|
const unitHeight = Math.max(maxBottom - minTop, 0);
|
|
2517
2520
|
const place = () => {
|
|
2518
|
-
const offset = pageBroken ? -minTop : 0;
|
|
2521
|
+
const offset = pageBroken ? pageCursorTop() - minTop : 0;
|
|
2519
2522
|
noteOverflow(minTop + offset + unitHeight);
|
|
2520
2523
|
for (const m of members) {
|
|
2521
2524
|
currentPage.push({
|
|
@@ -2589,6 +2592,7 @@ function paginate(template, measuredElements) {
|
|
|
2589
2592
|
const groups = buildRowGroups(bodyRows, rowCount);
|
|
2590
2593
|
let sliceStart = 0;
|
|
2591
2594
|
let firstSlice = true;
|
|
2595
|
+
let sliceTop = sectionTop(el);
|
|
2592
2596
|
for (const g of groups) {
|
|
2593
2597
|
const gh = bodyHeights.slice(g.start, g.end).reduce((s, h) => s + h, 0);
|
|
2594
2598
|
if (gh + subtotalH <= remaining) {
|
|
@@ -2603,12 +2607,13 @@ function paginate(template, measuredElements) {
|
|
|
2603
2607
|
endRow: g.start,
|
|
2604
2608
|
subtotal: subtotalH > 0,
|
|
2605
2609
|
...!firstSlice && repeatCount > 0 ? { repeatHeader: true } : {},
|
|
2606
|
-
renderTop:
|
|
2610
|
+
renderTop: sliceTop
|
|
2607
2611
|
});
|
|
2608
2612
|
firstSlice = false;
|
|
2609
2613
|
sliceStart = g.start;
|
|
2610
2614
|
}
|
|
2611
2615
|
finishPage();
|
|
2616
|
+
sliceTop = sectionTop(el);
|
|
2612
2617
|
if (!firstSlice) remaining -= repeatH;
|
|
2613
2618
|
remaining -= gh;
|
|
2614
2619
|
}
|
|
@@ -2620,7 +2625,7 @@ function paginate(template, measuredElements) {
|
|
|
2620
2625
|
endRow: rowCount,
|
|
2621
2626
|
subtotal: subtotalH > 0,
|
|
2622
2627
|
...!firstSlice && repeatCount > 0 ? { repeatHeader: true } : {},
|
|
2623
|
-
renderTop:
|
|
2628
|
+
renderTop: sliceTop
|
|
2624
2629
|
});
|
|
2625
2630
|
}
|
|
2626
2631
|
if (summaryH > 0) {
|
package/dist/browser/index.js
CHANGED
|
@@ -1754,10 +1754,9 @@ function tableDesignBottom(el) {
|
|
|
1754
1754
|
const opts = el.options ?? {};
|
|
1755
1755
|
const top = opts.top ?? 0;
|
|
1756
1756
|
const rows = opts.tableRows ?? [];
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
return top + (opts.height ?? 0);
|
|
1757
|
+
const rowSum = rows.reduce((s, r) => s + (r.height ?? 0), 0);
|
|
1758
|
+
const designHeight = Math.max(opts.height ?? 0, rowSum);
|
|
1759
|
+
return top + designHeight;
|
|
1761
1760
|
}
|
|
1762
1761
|
function buildFollowMap(sorted, excludedIds) {
|
|
1763
1762
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -1898,7 +1897,10 @@ function paginate(template, measuredElements) {
|
|
|
1898
1897
|
let isFirstPage = true;
|
|
1899
1898
|
let pageBroken = false;
|
|
1900
1899
|
function sectionTop(el) {
|
|
1901
|
-
return pageBroken ?
|
|
1900
|
+
return pageBroken ? pageCursorTop() : el.options?.top ?? 0;
|
|
1901
|
+
}
|
|
1902
|
+
function pageCursorTop() {
|
|
1903
|
+
return Math.max(0, fullPageHeight() - remaining);
|
|
1902
1904
|
}
|
|
1903
1905
|
function fullPageHeight() {
|
|
1904
1906
|
return isFirstPage ? contentHeight - overlayH - SAFETY_MARGIN : contentHeight - SAFETY_MARGIN;
|
|
@@ -1965,7 +1967,7 @@ function paginate(template, measuredElements) {
|
|
|
1965
1967
|
function paginateNonTable(el, measured, sortedList, idx) {
|
|
1966
1968
|
const elHeight = measured.get(el.id)?.measuredHeight ?? el.options?.height ?? 0;
|
|
1967
1969
|
if (elHeight <= remaining) {
|
|
1968
|
-
const top2 = pageBroken ?
|
|
1970
|
+
const top2 = pageBroken ? pageCursorTop() : el.options?.top ?? 0;
|
|
1969
1971
|
noteOverflow(top2 + elHeight);
|
|
1970
1972
|
currentPage.push({ elementId: el.id, type: "element", renderTop: sectionTop(el) });
|
|
1971
1973
|
remaining -= elHeight;
|
|
@@ -1984,8 +1986,9 @@ function paginate(template, measuredElements) {
|
|
|
1984
1986
|
}
|
|
1985
1987
|
return idx + 1;
|
|
1986
1988
|
}
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
+
finishPage();
|
|
1990
|
+
const top = pageBroken ? pageCursorTop() : el.options?.top ?? 0;
|
|
1991
|
+
if (top + elHeight > contentHeight) overflowOnCurrent = true;
|
|
1989
1992
|
currentPage.push({ elementId: el.id, type: "element", renderTop: sectionTop(el) });
|
|
1990
1993
|
remaining -= elHeight;
|
|
1991
1994
|
return idx + 1;
|
|
@@ -2001,7 +2004,7 @@ function paginate(template, measuredElements) {
|
|
|
2001
2004
|
}
|
|
2002
2005
|
const unitHeight = Math.max(maxBottom - minTop, 0);
|
|
2003
2006
|
const place = () => {
|
|
2004
|
-
const offset = pageBroken ? -minTop : 0;
|
|
2007
|
+
const offset = pageBroken ? pageCursorTop() - minTop : 0;
|
|
2005
2008
|
noteOverflow(minTop + offset + unitHeight);
|
|
2006
2009
|
for (const m of members) {
|
|
2007
2010
|
currentPage.push({
|
|
@@ -2075,6 +2078,7 @@ function paginate(template, measuredElements) {
|
|
|
2075
2078
|
const groups = buildRowGroups(bodyRows, rowCount);
|
|
2076
2079
|
let sliceStart = 0;
|
|
2077
2080
|
let firstSlice = true;
|
|
2081
|
+
let sliceTop = sectionTop(el);
|
|
2078
2082
|
for (const g of groups) {
|
|
2079
2083
|
const gh = bodyHeights.slice(g.start, g.end).reduce((s, h) => s + h, 0);
|
|
2080
2084
|
if (gh + subtotalH <= remaining) {
|
|
@@ -2089,12 +2093,13 @@ function paginate(template, measuredElements) {
|
|
|
2089
2093
|
endRow: g.start,
|
|
2090
2094
|
subtotal: subtotalH > 0,
|
|
2091
2095
|
...!firstSlice && repeatCount > 0 ? { repeatHeader: true } : {},
|
|
2092
|
-
renderTop:
|
|
2096
|
+
renderTop: sliceTop
|
|
2093
2097
|
});
|
|
2094
2098
|
firstSlice = false;
|
|
2095
2099
|
sliceStart = g.start;
|
|
2096
2100
|
}
|
|
2097
2101
|
finishPage();
|
|
2102
|
+
sliceTop = sectionTop(el);
|
|
2098
2103
|
if (!firstSlice) remaining -= repeatH;
|
|
2099
2104
|
remaining -= gh;
|
|
2100
2105
|
}
|
|
@@ -2106,7 +2111,7 @@ function paginate(template, measuredElements) {
|
|
|
2106
2111
|
endRow: rowCount,
|
|
2107
2112
|
subtotal: subtotalH > 0,
|
|
2108
2113
|
...!firstSlice && repeatCount > 0 ? { repeatHeader: true } : {},
|
|
2109
|
-
renderTop:
|
|
2114
|
+
renderTop: sliceTop
|
|
2110
2115
|
});
|
|
2111
2116
|
}
|
|
2112
2117
|
if (summaryH > 0) {
|
package/dist/designer/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TemplateEngine
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-B2XJSF4V.js";
|
|
4
4
|
import {
|
|
5
5
|
BARCODE_BAR_HEIGHT_MODULES,
|
|
6
6
|
BARCODE_MARGIN_BOTTOM_MODULES,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
subtractNumbers,
|
|
44
44
|
sum,
|
|
45
45
|
toUpperCaseAmount
|
|
46
|
-
} from "../chunk-
|
|
46
|
+
} from "../chunk-BBSFBAWT.js";
|
|
47
47
|
|
|
48
48
|
// src/designer/utils/scale.ts
|
|
49
49
|
var MIN_SCALE_PERCENT = 25;
|
package/dist/index.cjs
CHANGED
|
@@ -1893,10 +1893,9 @@ function tableDesignBottom(el) {
|
|
|
1893
1893
|
const opts = el.options ?? {};
|
|
1894
1894
|
const top = opts.top ?? 0;
|
|
1895
1895
|
const rows = opts.tableRows ?? [];
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
return top + (opts.height ?? 0);
|
|
1896
|
+
const rowSum = rows.reduce((s, r) => s + (r.height ?? 0), 0);
|
|
1897
|
+
const designHeight = Math.max(opts.height ?? 0, rowSum);
|
|
1898
|
+
return top + designHeight;
|
|
1900
1899
|
}
|
|
1901
1900
|
function buildFollowMap(sorted, excludedIds) {
|
|
1902
1901
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -2037,7 +2036,10 @@ function paginate(template, measuredElements) {
|
|
|
2037
2036
|
let isFirstPage = true;
|
|
2038
2037
|
let pageBroken = false;
|
|
2039
2038
|
function sectionTop(el) {
|
|
2040
|
-
return pageBroken ?
|
|
2039
|
+
return pageBroken ? pageCursorTop() : el.options?.top ?? 0;
|
|
2040
|
+
}
|
|
2041
|
+
function pageCursorTop() {
|
|
2042
|
+
return Math.max(0, fullPageHeight() - remaining);
|
|
2041
2043
|
}
|
|
2042
2044
|
function fullPageHeight() {
|
|
2043
2045
|
return isFirstPage ? contentHeight - overlayH - SAFETY_MARGIN : contentHeight - SAFETY_MARGIN;
|
|
@@ -2104,7 +2106,7 @@ function paginate(template, measuredElements) {
|
|
|
2104
2106
|
function paginateNonTable(el, measured, sortedList, idx) {
|
|
2105
2107
|
const elHeight = measured.get(el.id)?.measuredHeight ?? el.options?.height ?? 0;
|
|
2106
2108
|
if (elHeight <= remaining) {
|
|
2107
|
-
const top2 = pageBroken ?
|
|
2109
|
+
const top2 = pageBroken ? pageCursorTop() : el.options?.top ?? 0;
|
|
2108
2110
|
noteOverflow(top2 + elHeight);
|
|
2109
2111
|
currentPage.push({ elementId: el.id, type: "element", renderTop: sectionTop(el) });
|
|
2110
2112
|
remaining -= elHeight;
|
|
@@ -2123,8 +2125,9 @@ function paginate(template, measuredElements) {
|
|
|
2123
2125
|
}
|
|
2124
2126
|
return idx + 1;
|
|
2125
2127
|
}
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
+
finishPage();
|
|
2129
|
+
const top = pageBroken ? pageCursorTop() : el.options?.top ?? 0;
|
|
2130
|
+
if (top + elHeight > contentHeight) overflowOnCurrent = true;
|
|
2128
2131
|
currentPage.push({ elementId: el.id, type: "element", renderTop: sectionTop(el) });
|
|
2129
2132
|
remaining -= elHeight;
|
|
2130
2133
|
return idx + 1;
|
|
@@ -2140,7 +2143,7 @@ function paginate(template, measuredElements) {
|
|
|
2140
2143
|
}
|
|
2141
2144
|
const unitHeight = Math.max(maxBottom - minTop, 0);
|
|
2142
2145
|
const place = () => {
|
|
2143
|
-
const offset = pageBroken ? -minTop : 0;
|
|
2146
|
+
const offset = pageBroken ? pageCursorTop() - minTop : 0;
|
|
2144
2147
|
noteOverflow(minTop + offset + unitHeight);
|
|
2145
2148
|
for (const m of members) {
|
|
2146
2149
|
currentPage.push({
|
|
@@ -2214,6 +2217,7 @@ function paginate(template, measuredElements) {
|
|
|
2214
2217
|
const groups = buildRowGroups(bodyRows, rowCount);
|
|
2215
2218
|
let sliceStart = 0;
|
|
2216
2219
|
let firstSlice = true;
|
|
2220
|
+
let sliceTop = sectionTop(el);
|
|
2217
2221
|
for (const g of groups) {
|
|
2218
2222
|
const gh = bodyHeights.slice(g.start, g.end).reduce((s, h) => s + h, 0);
|
|
2219
2223
|
if (gh + subtotalH <= remaining) {
|
|
@@ -2228,12 +2232,13 @@ function paginate(template, measuredElements) {
|
|
|
2228
2232
|
endRow: g.start,
|
|
2229
2233
|
subtotal: subtotalH > 0,
|
|
2230
2234
|
...!firstSlice && repeatCount > 0 ? { repeatHeader: true } : {},
|
|
2231
|
-
renderTop:
|
|
2235
|
+
renderTop: sliceTop
|
|
2232
2236
|
});
|
|
2233
2237
|
firstSlice = false;
|
|
2234
2238
|
sliceStart = g.start;
|
|
2235
2239
|
}
|
|
2236
2240
|
finishPage();
|
|
2241
|
+
sliceTop = sectionTop(el);
|
|
2237
2242
|
if (!firstSlice) remaining -= repeatH;
|
|
2238
2243
|
remaining -= gh;
|
|
2239
2244
|
}
|
|
@@ -2245,7 +2250,7 @@ function paginate(template, measuredElements) {
|
|
|
2245
2250
|
endRow: rowCount,
|
|
2246
2251
|
subtotal: subtotalH > 0,
|
|
2247
2252
|
...!firstSlice && repeatCount > 0 ? { repeatHeader: true } : {},
|
|
2248
|
-
renderTop:
|
|
2253
|
+
renderTop: sliceTop
|
|
2249
2254
|
});
|
|
2250
2255
|
}
|
|
2251
2256
|
if (summaryH > 0) {
|
package/dist/index.d.cts
CHANGED
|
@@ -232,8 +232,11 @@ declare function elementPositionStyle(left: number, top: number, width: number,
|
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
234
|
* 表格设计底部(mm)= 设计 top + 设计高度。
|
|
235
|
-
*
|
|
236
|
-
*
|
|
235
|
+
* 设计高度取 max(options.height, tableRows 行高之和):
|
|
236
|
+
* - options.height 是设计器实测回写的渲染高度(用户在画布上所见并据此对齐下方元素的底部),
|
|
237
|
+
* 为相对布局偏移的忠实基准;
|
|
238
|
+
* - tableRows 行高之和是 min-height 语义下表格实际渲染的物理下界,
|
|
239
|
+
* 当 options.height 缺失或被低估时兜底,避免跟随元素偏移算成负值反向叠压表格。
|
|
237
240
|
*/
|
|
238
241
|
declare function tableDesignBottom(el: TemplateElement): number;
|
|
239
242
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -232,8 +232,11 @@ declare function elementPositionStyle(left: number, top: number, width: number,
|
|
|
232
232
|
|
|
233
233
|
/**
|
|
234
234
|
* 表格设计底部(mm)= 设计 top + 设计高度。
|
|
235
|
-
*
|
|
236
|
-
*
|
|
235
|
+
* 设计高度取 max(options.height, tableRows 行高之和):
|
|
236
|
+
* - options.height 是设计器实测回写的渲染高度(用户在画布上所见并据此对齐下方元素的底部),
|
|
237
|
+
* 为相对布局偏移的忠实基准;
|
|
238
|
+
* - tableRows 行高之和是 min-height 语义下表格实际渲染的物理下界,
|
|
239
|
+
* 当 options.height 缺失或被低估时兜底,避免跟随元素偏移算成负值反向叠压表格。
|
|
237
240
|
*/
|
|
238
241
|
declare function tableDesignBottom(el: TemplateElement): number;
|
|
239
242
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TemplateEngine
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B2XJSF4V.js";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_READINESS_MS,
|
|
6
6
|
DEFAULT_SHRINK_MIN_FONT_SIZE_PT,
|
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
tokenize,
|
|
122
122
|
validateTiling,
|
|
123
123
|
withTimeout
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-BBSFBAWT.js";
|
|
125
125
|
export {
|
|
126
126
|
DEFAULT_READINESS_MS,
|
|
127
127
|
DEFAULT_SHRINK_MIN_FONT_SIZE_PT,
|