gm-printer 10.41.7 → 10.41.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-printer",
3
- "version": "10.41.7",
3
+ "version": "10.41.9",
4
4
  "description": "diy printer",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -447,9 +447,30 @@ class PrinterStore {
447
447
  )
448
448
  break
449
449
  }
450
- // 行无法拆分(普通长文本列)或拆分失败时,强制推进 end 防止死循环
450
+ // 行无法拆分(普通长文本列)或拆分失败
451
451
  if (end === begin) {
452
- end = end + 1
452
+ // 新一页可容纳的 table 高度(页高 - 页眉页脚)
453
+ const fullPageAccomodateTableHeight = roundHeight(
454
+ pageHeight - allPagesHaveThisHeight
455
+ )
456
+ // 整页都放不下的超高行(如超长异常描述文本):只能保留在当前页(裁切不可避免),强制推进 end 防死循环
457
+ // 此时 currentTableHeight = allTableHaveThisHeight + rowHeight(本行已累加)
458
+ if (currentTableHeight > fullPageAccomodateTableHeight) {
459
+ end = end + 1
460
+ } else {
461
+ // 当前页剩余空间放不下、但整页放得下:
462
+ // 先结束当前页(不包含本行),本行挪到新页重试,避免被 overflow:hidden 裁切
463
+ if (page.length > 0) {
464
+ pages.push(page)
465
+ page = []
466
+ }
467
+ begin = end
468
+ pageAccomodateTableHeight = fullPageAccomodateTableHeight
469
+ currentTableHeight = allTableHaveThisHeight
470
+ currentPageHeight = currentPageMinimumHeight
471
+ // 不推进 end,重置高度后在新页重试当前行
472
+ continue
473
+ }
453
474
  }
454
475
  // 第一条极端会有问题
455
476
  if (end !== 0) {