@worm-vue3-print/core 1.3.5 → 1.3.7

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.
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * @worm-vue3-print/core v1.3.5
3
- * Copyright (c) 2026 Worm Base AI
4
- * SPDX-FileCopyrightText: 2026 Worm Base AI
2
+ * @worm-vue3-print/core v1.3.7
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
5
  * SPDX-License-Identifier: MIT
6
6
  */
7
- import { E as ElementBorderSide, b as ElementOptions, c as TemplateData, d as TableRow, e as TableCellBorder, f as TableCell, g as TableRowType, h as ElementType, i as RuntimeElement, j as ElementZone, k as PrintBusinessField, B as BindingDescriptor, l as ElementRect, A as AdsorbResult, m as ResizePoint } from '../driver-CFm0C_yX.js';
8
- export { n as AlignLine, o as DesignBackground, p as ElementBorderEdge, q as ElementFieldBinding, r as MultiPageTemplateData, s as PaginationConfig, t as PaperSize, u as PrintElementData, v as PrintElementTypeMeta, w as TableCellBorders, x as TableCellType, y as TablePaginationConfig, z as TableSelection, F as TemplateElement, G as TextAlign, H as TextFit, U as UploadDesignBackgroundFn, I as UploadImageFn, V as VerticalAlign, W as WatermarkOptions } from '../driver-CFm0C_yX.js';
9
- export { C as CellFitRowKind, D as DEFAULT_SHRINK_MIN_FONT_SIZE_PT, F as FitFontSize, M as MIN_SHRINK_FONT_SIZE_PT, c as cellFitCapMm, a as cellFitKey, b as cellFitWidthMm, f as floorFontSize, p as parseCellFitKey, r as resolveCellTextFit, d as resolveElementTextFit, e as resolveShrinkMinFontSize, g as roundFontSize } from '../ports-Bdst9MWJ.js';
7
+ import { E as ElementBorderSide, b as ElementOptions, c as TemplateData, d as TableRow, e as TableCellBorder, f as TableCell, g as TableRowType, h as ElementType, i as RuntimeElement, j as ElementZone, k as PrintBusinessField, B as BindingDescriptor, l as ElementRect, A as AdsorbResult, m as ResizePoint } from '../driver-Dzr2Aikx.js';
8
+ export { n as AlignLine, o as DesignBackground, p as ElementBorderEdge, q as ElementFieldBinding, r as MultiPageTemplateData, s as PaginationConfig, t as PaperSize, u as PrintElementData, v as PrintElementTypeMeta, w as TableCellBorders, x as TableCellType, y as TablePaginationConfig, z as TableSelection, F as TemplateElement, G as TextAlign, H as TextFit, U as UploadDesignBackgroundFn, I as UploadImageFn, V as VerticalAlign, W as WatermarkOptions } from '../driver-Dzr2Aikx.js';
9
+ export { C as CellFitRowKind, D as DEFAULT_SHRINK_MIN_FONT_SIZE_PT, F as FitFontSize, M as MIN_SHRINK_FONT_SIZE_PT, c as cellFitCapMm, a as cellFitKey, b as cellFitWidthMm, f as floorFontSize, p as parseCellFitKey, r as resolveCellTextFit, d as resolveElementTextFit, e as resolveShrinkMinFontSize, g as roundFontSize } from '../ports-B8MFq_Yo.js';
10
10
  import { TemplateEngine, formatMoney, ifFn, addNumbers, subtractNumbers, multiplyNumbers, divideNumbers, round, roundUp, roundDown, roundHalfEven, formatDate, toUpperCaseAmount } from '../index.js';
11
11
 
12
12
  /** 1 英寸 = 25.4mm */
@@ -111,6 +111,40 @@ declare function nextWheelScale(percent: number, direction: 1 | -1, factor?: num
111
111
  /** 计算适应窗口的缩放百分比,允许小于交互缩放下限,保证整版纸张可见 */
112
112
  declare function computeFitScale(containerW: number, containerH: number, paperW: number, paperH: number, ratio?: number): number;
113
113
 
114
+ /**
115
+ * 顶部工具栏自适应收纳的纯计算部分:给定可用宽与各收纳单元的自然宽度,
116
+ * 按收纳优先级链得出哪些单元应移入「更多」下拉。
117
+ *
118
+ * 放在框架无关内核而非某个 UI 包:canvas 与 common 两套设计器宿主必须同链同序,
119
+ * 复制两份会出现「同一宽度下收起的分组不同」。
120
+ */
121
+ interface OverflowUnitInput {
122
+ /** 单元标识,同时作为「更多」面板内落位容器的 key */
123
+ id: string;
124
+ /** 收纳优先级:数值小者先被收进「更多」 */
125
+ order: number;
126
+ /** 实测自然宽度(px);<=0 表示尚未上报 */
127
+ width: number;
128
+ }
129
+ interface ToolbarOverflowInput {
130
+ /** 工具栏可用内容宽(px) */
131
+ available: number;
132
+ /** 常驻不外收单元的合计宽(含其分隔) */
133
+ pinned: number;
134
+ /** 「更多」触发钮宽度,仅在确有收纳时计入 */
135
+ moreTriggerWidth: number;
136
+ /** flex 子项间距,与工具栏的 gap 同源 */
137
+ gap?: number;
138
+ units: OverflowUnitInput[];
139
+ }
140
+ interface ToolbarOverflowResult {
141
+ /** 收纳顺序(优先级链从先到后) */
142
+ movedIds: string[];
143
+ /** 收纳用尽仍放不下,需由样式兜底 */
144
+ overflowRemains: boolean;
145
+ }
146
+ declare function resolveToolbarOverflow(input: ToolbarOverflowInput): ToolbarOverflowResult;
147
+
114
148
  declare function normalizeTemplateUnits(data: TemplateData): TemplateData;
115
149
 
116
150
  /** 标签纸分组名(PAPER_PRESETS.group):该组纸型默认取消页眉、页脚与页边距 */
@@ -290,6 +324,8 @@ declare const PRESET_COLORS: readonly ["#000000", "#333333", "#666666", "#999999
290
324
  interface PropertyItem {
291
325
  key: string;
292
326
  keywords: string[];
327
+ /** 字段说明文案:挂在标签后的帮助图标上(悬浮/点击显示),元素台与单元格台、canvas 与 common 共用同一份 */
328
+ tip?: string;
293
329
  }
294
330
  interface PropertyGroupDef {
295
331
  group: string;
@@ -298,6 +334,8 @@ interface PropertyGroupDef {
298
334
  }
299
335
  declare const PROPERTY_REGISTRY: PropertyGroupDef[];
300
336
  /** 正向包含匹配:任一关键词包含搜索词即命中;空搜索恒命中 */
337
+ /** 按表单项 key 取说明文案(帮助图标 tip 的内容);未登记说明时返回空串 */
338
+ declare function propertyTip(key: string): string;
301
339
  declare function matchKeywords(search: string, keywords: string[]): boolean;
302
340
  /** 计算命中的分组与表单项 key 集合 */
303
341
  declare function searchProperties(search: string): {
@@ -484,4 +522,4 @@ declare function useBindingDisplay(): {
484
522
  getBindingDisplayState: (element: any) => BindingDisplayState;
485
523
  };
486
524
 
487
- export { type AdsorbConfig, AdsorbResult, type AlignMode, BARCODE_BAR_HEIGHT_MODULES, BARCODE_MARGIN_BOTTOM_MODULES, BARCODE_MODULE_WIDTH_MM, BARCODE_QUIET_ZONE_MODULES, BARCODE_TEXT_FONT_SIZE_MODULES, type BarcodeSize, type BarcodeSizeInput, BindingDescriptor, type BorderPreset, type CellRect, DEFAULT_DEMO_DATA, ELEMENT_BINDING_REGISTRY, ELEMENT_BORDER_SIDES, EXTENDED_FUNCTIONS, type ElementBorderCss, ElementBorderSide, type ElementBordersCss, ElementOptions, ElementRect, ElementType, ElementZone, FIT_SCALE_MIN_PERCENT, type FieldGroup, GHOST_BORDER_CSS, type KeyboardHandlers, LABEL_PAPER_GROUP, MIN_COL_WIDTH_MM, MIN_SCALE_PERCENT, MM_PER_INCH, type ManualGuides, PAPER_PRESETS, PRESET_COLORS, PROPERTY_REGISTRY, type PaperPreset, PrintBusinessField, type PropertyGroupDef, type PropertyItem, RESIZE_POINTS, RULER_THICKNESS, type ResizeOptions, ResizePoint, type ResizeRect, type RulerTick, RuntimeElement, TableCell, TableCellBorder, TableRow, TableRowType, TemplateData, ZONE_ALLOWED_TYPES, type ZoneRectPt, acceptsElementBorder, applyBorderPreset, barcodeAvailableBoxMm, barcodePreferredModuleWidthMm, barcodeUnitsPerModule, buildRulerTicks, calcResizeRect, canMergeReason, chooseMajorStepMM, clampResizedColumnWidth, clampScalePercent, clampToZone, computeAdsorb, computeFitScale, createCell, createDefaultOptions, createDefaultTable, createFieldElement, createRuntimeElement, deleteCol, deleteRow, engine, evaluateTemplate, filterGroups, finalizeElementZone, findMainCell, generateGroupId, generateId, getDemoData, getElementBindings, getPaperDimensions, getPaperSizeMM, getSpanRect, getTableCellBindings, getZoneRects, groupFields, insertCol, insertRow, isContinuousPaperSize, isLabelPaperSize, labelPaperDefaults, matchKeywords, mergeCells, minorStepMM, mmToPx, nextWheelScale, normalizeSelection, normalizeTemplateUnits, ptToMm, pxToMm, resolveBarcodeDesignValue, resolveBarcodeSize, resolveCellBorderCss, resolveElementBorder, resolveTextBinding, safeEval, searchProperties, setHeaderRepeat, setRowType, splitCells, syncTableElementSize, useAlign, useBindingDisplay, useGroup, useKeyboard, useResize, zoneFromPaperPoint };
525
+ export { type AdsorbConfig, AdsorbResult, type AlignMode, BARCODE_BAR_HEIGHT_MODULES, BARCODE_MARGIN_BOTTOM_MODULES, BARCODE_MODULE_WIDTH_MM, BARCODE_QUIET_ZONE_MODULES, BARCODE_TEXT_FONT_SIZE_MODULES, type BarcodeSize, type BarcodeSizeInput, BindingDescriptor, type BorderPreset, type CellRect, DEFAULT_DEMO_DATA, ELEMENT_BINDING_REGISTRY, ELEMENT_BORDER_SIDES, EXTENDED_FUNCTIONS, type ElementBorderCss, ElementBorderSide, type ElementBordersCss, ElementOptions, ElementRect, ElementType, ElementZone, FIT_SCALE_MIN_PERCENT, type FieldGroup, GHOST_BORDER_CSS, type KeyboardHandlers, LABEL_PAPER_GROUP, MIN_COL_WIDTH_MM, MIN_SCALE_PERCENT, MM_PER_INCH, type ManualGuides, type OverflowUnitInput, PAPER_PRESETS, PRESET_COLORS, PROPERTY_REGISTRY, type PaperPreset, PrintBusinessField, type PropertyGroupDef, type PropertyItem, RESIZE_POINTS, RULER_THICKNESS, type ResizeOptions, ResizePoint, type ResizeRect, type RulerTick, RuntimeElement, TableCell, TableCellBorder, TableRow, TableRowType, TemplateData, type ToolbarOverflowInput, type ToolbarOverflowResult, ZONE_ALLOWED_TYPES, type ZoneRectPt, acceptsElementBorder, applyBorderPreset, barcodeAvailableBoxMm, barcodePreferredModuleWidthMm, barcodeUnitsPerModule, buildRulerTicks, calcResizeRect, canMergeReason, chooseMajorStepMM, clampResizedColumnWidth, clampScalePercent, clampToZone, computeAdsorb, computeFitScale, createCell, createDefaultOptions, createDefaultTable, createFieldElement, createRuntimeElement, deleteCol, deleteRow, engine, evaluateTemplate, filterGroups, finalizeElementZone, findMainCell, generateGroupId, generateId, getDemoData, getElementBindings, getPaperDimensions, getPaperSizeMM, getSpanRect, getTableCellBindings, getZoneRects, groupFields, insertCol, insertRow, isContinuousPaperSize, isLabelPaperSize, labelPaperDefaults, matchKeywords, mergeCells, minorStepMM, mmToPx, nextWheelScale, normalizeSelection, normalizeTemplateUnits, propertyTip, ptToMm, pxToMm, resolveBarcodeDesignValue, resolveBarcodeSize, resolveCellBorderCss, resolveElementBorder, resolveTextBinding, resolveToolbarOverflow, safeEval, searchProperties, setHeaderRepeat, setRowType, splitCells, syncTableElementSize, useAlign, useBindingDisplay, useGroup, useKeyboard, useResize, zoneFromPaperPoint };
@@ -1,12 +1,12 @@
1
1
  /*!
2
- * @worm-vue3-print/core v1.3.5
3
- * Copyright (c) 2026 Worm Base AI
4
- * SPDX-FileCopyrightText: 2026 Worm Base AI
2
+ * @worm-vue3-print/core v1.3.7
3
+ * Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
4
+ * SPDX-FileCopyrightText: 2026 worm <liu_long_qqcom@qq.com>
5
5
  * SPDX-License-Identifier: MIT
6
6
  */
7
7
  import {
8
8
  TemplateEngine
9
- } from "../chunk-GHASCGL6.js";
9
+ } from "../chunk-WLGEOVFK.js";
10
10
  import {
11
11
  BARCODE_BAR_HEIGHT_MODULES,
12
12
  BARCODE_MARGIN_BOTTOM_MODULES,
@@ -52,7 +52,7 @@ import {
52
52
  subtractNumbers,
53
53
  sum,
54
54
  toUpperCaseAmount
55
- } from "../chunk-ZCA33XA6.js";
55
+ } from "../chunk-TCI5XQKI.js";
56
56
 
57
57
  // src/designer/utils/scale.ts
58
58
  var MIN_SCALE_PERCENT = 25;
@@ -71,6 +71,27 @@ function computeFitScale(containerW, containerH, paperW, paperH, ratio = 0.9) {
71
71
  return Math.max(FIT_SCALE_MIN_PERCENT, pct);
72
72
  }
73
73
 
74
+ // src/designer/utils/toolbar-overflow.ts
75
+ var DEFAULT_GAP = 2;
76
+ function resolveToolbarOverflow(input) {
77
+ const gap = input.gap ?? DEFAULT_GAP;
78
+ const chain = [...input.units].sort((a, b) => a.order - b.order);
79
+ if (input.available <= 0) return { movedIds: [], overflowRemains: false };
80
+ if (chain.some((u) => u.width <= 0)) return { movedIds: [], overflowRemains: false };
81
+ const fits = (moved2) => {
82
+ const inline = chain.filter((u) => !moved2.has(u.id));
83
+ const used = input.pinned + inline.reduce((sum2, u) => sum2 + u.width + gap, 0) + (moved2.size > 0 ? input.moreTriggerWidth + gap : 0);
84
+ return used <= input.available;
85
+ };
86
+ if (fits(/* @__PURE__ */ new Set())) return { movedIds: [], overflowRemains: false };
87
+ const moved = /* @__PURE__ */ new Set();
88
+ for (const unit of chain) {
89
+ moved.add(unit.id);
90
+ if (fits(moved)) return { movedIds: [...moved], overflowRemains: false };
91
+ }
92
+ return { movedIds: [...moved], overflowRemains: true };
93
+ }
94
+
74
95
  // src/designer/utils/migrate.ts
75
96
  var PT_KEYS = ["left", "top", "width", "height"];
76
97
  function convertElement(el) {
@@ -777,7 +798,22 @@ var PROPERTY_REGISTRY = [
777
798
  { key: "ap-letter-spacing", keywords: ["\u5B57\u95F4\u8DDD", "letterspacing"] },
778
799
  { key: "ap-text-fit", keywords: ["\u6EA2\u51FA", "\u6EA2\u51FA\u663E\u793A", "\u622A\u65AD", "\u81EA\u52A8\u7F29\u5C0F", "\u81EA\u9002\u5E94\u884C\u9AD8", "textfit", "overflow"] },
779
800
  { key: "ap-shrink-min", keywords: ["\u6700\u5C0F\u5B57\u53F7", "\u7F29\u653E\u4E0B\u9650", "shrinkminfontsize"] },
780
- { key: "ap-word-wrap", keywords: ["\u81EA\u52A8\u6362\u884C", "\u4E0D\u6362\u884C", "wordwrap"] }
801
+ { key: "ap-word-wrap", keywords: ["\u81EA\u52A8\u6362\u884C", "\u4E0D\u6362\u884C", "wordwrap"] },
802
+ {
803
+ key: "ap-long-text-indent",
804
+ keywords: ["\u9996\u884C\u7F29\u8FDB", "\u7F29\u8FDB", "indent", "longtextindent", "\u4E24\u5B57\u7B26", "\u6BB5\u9996"],
805
+ tip: "\u957F\u6587\u672C\u6BCF\u6BB5\u9996\u884C\u7A7A\u51FA\u7684\u5BBD\u5EA6\uFF0C\u5355\u4F4D\u300C\u5B57\u7B26\u300D\uFF1A\u586B 2 \u5373\u7F29\u8FDB\u4E24\u4E2A\u6C49\u5B57\u5BBD\uFF08\u4E2D\u6587\u6392\u7248\u60EF\u4F8B\uFF09\uFF0C\u6309 em \u843D\u7EB8\u2014\u2014\u5B57\u53F7\u88AB\u300C\u81EA\u52A8\u7F29\u5C0F\u300D\u538B\u5C0F\u65F6\u7F29\u8FDB\u540C\u6B65\u53D8\u7A84\u3002\u4EC5\u957F\u6587\u672C\u5143\u7D20\u751F\u6548\uFF0C\u5199\u5728\u666E\u901A\u6587\u672C\u4E0A\u4E0D\u751F\u6548"
806
+ },
807
+ {
808
+ key: "ap-img-fit",
809
+ keywords: ["\u7F29\u653E\u6A21\u5F0F", "\u62C9\u4F38", "\u7B49\u6BD4", "fit", "contain", "cover", "\u586B\u5145", "\u88C1\u526A"],
810
+ tip: "\u56FE\u7247\u5728\u5143\u7D20\u6846\u5185\u7684\u7F29\u653E\u65B9\u5F0F\uFF1A\u5305\u542B\uFF1D\u5B8C\u6574\u663E\u793A\u53EF\u80FD\u7559\u767D\uFF1B\u8986\u76D6\uFF1D\u94FA\u6EE1\u6846\u53EF\u80FD\u88C1\u8FB9\uFF1B\u62C9\u4F38\uFF1D\u586B\u6EE1\u6846\u4F1A\u53D8\u5F62\uFF1B\u539F\u59CB\u5C3A\u5BF8/\u7F29\u5C0F\u4E0D\u653E\u5927\u3002\u753B\u5E03\u4E0E\u4E09\u6761\u51FA\u7EB8\u94FE\u8DEF\u540C\u4E00\u53E3\u5F84\uFF08\u7F3A\u7701\u5305\u542B\uFF09"
811
+ },
812
+ {
813
+ key: "ap-img-object-position",
814
+ keywords: ["\u88C1\u526A\u951A\u70B9", "\u951A\u70B9", "objectposition", "object-position", "\u5BF9\u9F50\u70B9", "\u4E0A\u79FB", "\u5934\u9876"],
815
+ tip: "\u88C1\u526A\u65F6\u4FDD\u7559\u6846\u5185\u7684\u54EA\u4E00\u90E8\u5206\uFF0CCSS object-position \u503C\u539F\u6837\u751F\u6548\uFF08\u5982 center 20% \u8BA9\u753B\u9762\u4E0A\u79FB\u3001\u4FDD\u4F4F\u8BC1\u4EF6\u7167\u5934\u9876\uFF09\uFF1B\u53EA\u5728\u53D1\u751F\u88C1\u5207\u65F6\u53EF\u89C1\uFF0C\u7F3A\u7701\u6309 50% 50% \u5C45\u4E2D\u3002\u542B\u5206\u53F7\u3001\u5F15\u53F7\u3001url() \u7684\u503C\u4F1A\u88AB\u6574\u6761\u4E22\u5F03"
816
+ }
781
817
  ]
782
818
  },
783
819
  {
@@ -790,6 +826,11 @@ var PROPERTY_REGISTRY = [
790
826
  { key: "cd-show-text", keywords: ["\u663E\u793A\u6587\u672C", "\u6761\u7801\u6587\u672C", "\u663E\u793A\u6570\u5B57"] },
791
827
  { key: "cd-font-size", keywords: ["\u6761\u7801\u5B57\u53F7", "\u6587\u672C\u5B57\u53F7"] },
792
828
  { key: "cd-ec-level", keywords: ["\u7EA0\u9519\u7EA7\u522B", "\u5BB9\u9519", "qrcodelevel"] },
829
+ {
830
+ key: "cd-quiet-zone",
831
+ keywords: ["\u9759\u533A", "\u9759\u533A\u5BBD\u5EA6", "\u767D\u8FB9", "\u7A7A\u767D\u8FB9", "\u7559\u767D", "\u94FA\u6EE1", "quietzone"],
832
+ tip: "\u4E8C\u7EF4\u7801\u56DB\u5468\u7559\u51FA\u7684\u7A7A\u767D\u683C\u6570\uFF1A0 \u5373\u4E0D\u7559\u767D\u8FB9\u3001\u7801\u9762\u7B49\u6BD4\u94FA\u6EE1\u5143\u7D20\u6846\uFF08\u6B64\u65F6\u9760\u6846\u5916\u7684\u767D\u7EB8\u5145\u5F53\u9759\u533A\uFF09\uFF1B\u6570\u503C\u8D8A\u5927\u767D\u8FB9\u8D8A\u5BBD\u3001\u7801\u9762\u5728\u6846\u5185\u8D8A\u5C0F\uFF08\u7F3A\u7701 0\uFF0C\u9700 ISO/IEC 18004 \u63A8\u8350\u9759\u533A\u65F6\u586B 4\uFF09"
833
+ },
793
834
  { key: "cd-fit", keywords: ["\u7F29\u653E\u6A21\u5F0F", "\u62C9\u4F38", "\u7B49\u6BD4", "fit", "contain", "cover"] },
794
835
  { key: "cd-max-width", keywords: ["\u6700\u5927\u5BBD\u5EA6", "\u6700\u5927\u5BBD", "maxwidth"] },
795
836
  { key: "cd-max-height", keywords: ["\u6700\u5927\u9AD8\u5EA6", "\u6700\u5927\u9AD8", "maxheight"] }
@@ -844,6 +885,13 @@ var PROPERTY_REGISTRY = [
844
885
  ]
845
886
  }
846
887
  ];
888
+ function propertyTip(key) {
889
+ for (const group of PROPERTY_REGISTRY) {
890
+ const hit = group.items.find((item) => item.key === key);
891
+ if (hit) return hit.tip ?? "";
892
+ }
893
+ return "";
894
+ }
847
895
  function matchKeywords(search, keywords) {
848
896
  const s = search.trim().toLowerCase();
849
897
  if (!s) {
@@ -1729,6 +1777,7 @@ export {
1729
1777
  normalizeSelection,
1730
1778
  normalizeTemplateUnits,
1731
1779
  parseCellFitKey,
1780
+ propertyTip,
1732
1781
  ptToMm,
1733
1782
  pxToMm,
1734
1783
  resolveBarcodeDesignValue,
@@ -1739,6 +1788,7 @@ export {
1739
1788
  resolveElementTextFit,
1740
1789
  resolveShrinkMinFontSize,
1741
1790
  resolveTextBinding,
1791
+ resolveToolbarOverflow,
1742
1792
  roundFontSize,
1743
1793
  safeEval,
1744
1794
  searchProperties,