@worm-vue3-print/core 1.3.9 → 1.3.10
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 +281 -44
- package/dist/browser/index.d.cts +3 -3
- package/dist/browser/index.d.ts +3 -3
- package/dist/browser/index.js +33 -30
- package/dist/{chunk-QBFZ25CV.js → chunk-4ZEP2HSH.js} +2 -2
- package/dist/{chunk-BRGDUOUB.js → chunk-7FXIWNYK.js} +367 -19
- package/dist/client/index.cjs +1 -1
- package/dist/client/index.d.cts +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/designer/index.cjs +719 -19
- package/dist/designer/index.d.cts +357 -9
- package/dist/designer/index.d.ts +357 -9
- package/dist/designer/index.js +458 -8
- package/dist/dom-executor.iife.global.js +7 -7
- package/dist/{driver-hJxBl2_n.d.cts → driver-DW3mxuRF.d.cts} +87 -5
- package/dist/{driver-hJxBl2_n.d.ts → driver-DW3mxuRF.d.ts} +87 -5
- package/dist/index.cjs +242 -8
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +15 -3
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.d.cts +2 -2
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +1 -1
- package/dist/{ports-B-Jb2XwT.d.cts → ports-Brn5xcLD.d.ts} +2 -2
- package/dist/{ports-CJ0SUYFt.d.ts → ports-DJ7_blE7.d.cts} +2 -2
- package/package.json +1 -1
package/dist/designer/index.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @worm-vue3-print/core v1.3.
|
|
2
|
+
* @worm-vue3-print/core v1.3.10
|
|
3
3
|
* Copyright (c) 2026 worm <liu_long_qqcom@qq.com>
|
|
4
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-
|
|
9
|
+
} from "../chunk-4ZEP2HSH.js";
|
|
10
10
|
import {
|
|
11
11
|
BARCODE_BAR_HEIGHT_MODULES,
|
|
12
12
|
BARCODE_MARGIN_BOTTOM_MODULES,
|
|
13
|
+
BARCODE_MIN_MODULE_WIDTH_MM,
|
|
13
14
|
BARCODE_MODULE_WIDTH_MM,
|
|
14
15
|
BARCODE_QUIET_ZONE_MODULES,
|
|
15
16
|
BARCODE_TEXT_FONT_SIZE_MODULES,
|
|
@@ -17,14 +18,25 @@ import {
|
|
|
17
18
|
CROP_SCALE_MIN,
|
|
18
19
|
DEFAULT_SHRINK_MIN_FONT_SIZE_PT,
|
|
19
20
|
ELEMENT_BORDER_SIDES,
|
|
21
|
+
FLOW_MAX_COLUMNS,
|
|
22
|
+
FLOW_MAX_GAP_X_MM,
|
|
23
|
+
FLOW_MAX_ROW_HEIGHT_MM,
|
|
24
|
+
FLOW_MIN_COLUMNS,
|
|
25
|
+
FLOW_MIN_GAP_X_MM,
|
|
26
|
+
FLOW_MIN_ROW_HEIGHT_MM,
|
|
20
27
|
MIN_SHRINK_FONT_SIZE_PT,
|
|
21
28
|
MM_PER_INCH,
|
|
29
|
+
QR_DEFAULT_QUIET_MODULES,
|
|
22
30
|
acceptsElementBorder,
|
|
23
31
|
addNumbers,
|
|
24
32
|
avg,
|
|
25
33
|
barcodeAvailableBoxMm,
|
|
34
|
+
barcodeBarHeightModules,
|
|
35
|
+
barcodeBarWidthRecommendText,
|
|
26
36
|
barcodePreferredModuleWidthMm,
|
|
37
|
+
barcodeQuietZoneModules,
|
|
27
38
|
barcodeUnitsPerModule,
|
|
39
|
+
barcodeWidthBoundModuleWidthMm,
|
|
28
40
|
cellFitCapMm,
|
|
29
41
|
cellFitKey,
|
|
30
42
|
cellFitWidthMm,
|
|
@@ -32,11 +44,18 @@ import {
|
|
|
32
44
|
count,
|
|
33
45
|
cropScalePct,
|
|
34
46
|
cropStyleDeclarations,
|
|
47
|
+
detectFlowListKey,
|
|
35
48
|
divideNumbers,
|
|
49
|
+
estimateTextWidthMm,
|
|
36
50
|
floorFontSize,
|
|
51
|
+
flowColumnWidthMm,
|
|
52
|
+
flowGridStyle,
|
|
53
|
+
flowSpanWidthMm,
|
|
37
54
|
formatDate,
|
|
38
55
|
formatMoney,
|
|
39
56
|
ifFn,
|
|
57
|
+
layoutBarcodeSize,
|
|
58
|
+
layoutFlowList,
|
|
40
59
|
max,
|
|
41
60
|
min,
|
|
42
61
|
mmToPx,
|
|
@@ -44,10 +63,15 @@ import {
|
|
|
44
63
|
parseCellFitKey,
|
|
45
64
|
ptToMm,
|
|
46
65
|
pxToMm,
|
|
66
|
+
recommendBarcodeBarWidth,
|
|
47
67
|
resolveBarcodeSize,
|
|
48
68
|
resolveCellTextFit,
|
|
49
69
|
resolveElementBorder,
|
|
50
70
|
resolveElementTextFit,
|
|
71
|
+
resolveFlowColumns,
|
|
72
|
+
resolveFlowGapX,
|
|
73
|
+
resolveFlowMaxSpan,
|
|
74
|
+
resolveFlowRowHeight,
|
|
51
75
|
resolveShrinkMinFontSize,
|
|
52
76
|
round,
|
|
53
77
|
roundDown,
|
|
@@ -55,10 +79,12 @@ import {
|
|
|
55
79
|
roundHalfEven,
|
|
56
80
|
roundUp,
|
|
57
81
|
sanitizeObjectPosition,
|
|
82
|
+
spanForText,
|
|
58
83
|
subtractNumbers,
|
|
84
|
+
suggestFlowColumns,
|
|
59
85
|
sum,
|
|
60
86
|
toUpperCaseAmount
|
|
61
|
-
} from "../chunk-
|
|
87
|
+
} from "../chunk-7FXIWNYK.js";
|
|
62
88
|
|
|
63
89
|
// src/designer/utils/scale.ts
|
|
64
90
|
var MIN_SCALE_PERCENT = 25;
|
|
@@ -576,6 +602,54 @@ function applyBorderPreset(rows, rect, preset, border) {
|
|
|
576
602
|
}
|
|
577
603
|
}
|
|
578
604
|
}
|
|
605
|
+
var CELL_BORDER_APPLY_HINT = "\u7EBF\u578B / \u5BBD\u5EA6 / \u989C\u8272\u662F\u5F85\u5E94\u7528\u89C4\u683C\uFF1A\u9009\u4E2D\u683C\u5DF2\u6709\u7684\u8FB9\u6846\u89C4\u683C\u4E00\u81F4\u65F6\u4F1A\u586B\u8FDB\u8FD9\u4E09\u884C\uFF1B\u56DB\u8FB9\u4E0D\u4E00\u81F4\u7684\u9879\u663E\u793A\u300C\u6DF7\u5408\u300D\uFF0C\u4E00\u6761\u8FB9\u90FD\u6CA1\u6709\u65F6\u663E\u793A\u300C\u65E0 / 0\u300D\u3002\u6539\u5B8C\u70B9\u300C\u5168\u90E8 / \u5916\u4FA7 / \u5185\u90E8\u300D\u6216\u52FE\u9009\u4E0A\u3001\u4E0B\u3001\u5DE6\u3001\u53F3\u67D0\u6761\u8FB9\u624D\u4F1A\u5199\u5165\u9009\u4E2D\u7684\u5355\u5143\u683C\uFF1B\u300C\u65E0\u300D\u662F\u6E05\u9664\u8FB9\u6846";
|
|
606
|
+
var CELL_BORDER_APPLY_HINT_MULTI = "\u591A\u9009\u65F6\u4E0D\u56DE\u663E\u5355\u683C\u8FB9\u6846\uFF1A\u7EBF\u578B / \u5BBD\u5EA6 / \u989C\u8272\u6309\u5F53\u524D\u8BBE\u7F6E\u4F5C\u4E3A\u6279\u5199\u89C4\u683C\uFF0C\u70B9\u300C\u5168\u90E8 / \u5916\u4FA7 / \u5185\u90E8\u300D\u6216\u52FE\u9009\u67D0\u6761\u8FB9\u540E\u5199\u5165\u6240\u6709\u9009\u4E2D\u683C\uFF1B\u300C\u65E0\u300D\u662F\u6E05\u9664\u8FB9\u6846";
|
|
607
|
+
var CELL_BORDER_APPLY_HINT_MIXED = "\u5F53\u524D\u5355\u5143\u683C\u56DB\u8FB9\u8FB9\u6846\u89C4\u683C\u4E0D\u4E00\u81F4\uFF1A\u5E26\u300C\u6DF7\u5408\u300D\u7684\u9879\u4E0D\u8C0E\u62A5\uFF0C\u672A\u6539\u9879\u5728\u70B9\u300C\u5168\u90E8 / \u5916\u4FA7 / \u5185\u90E8\u300D\u6216\u52FE\u9009\u5355\u8FB9\u65F6\u6309\u7F3A\u7701\u6863\uFF08\u5B9E\u7EBF 0.75pt\uFF09\u5199\u5165\uFF0C\u6539\u4EFB\u4E00\u9879\u5373\u6309\u8BE5\u503C\u6279\u5199";
|
|
608
|
+
function setCellBorderEdge(cell, side, border) {
|
|
609
|
+
const nb = { ...cell.borders ?? {} };
|
|
610
|
+
if (border) nb[side] = { ...border };
|
|
611
|
+
else delete nb[side];
|
|
612
|
+
cell.borders = nb.top || nb.right || nb.bottom || nb.left ? nb : void 0;
|
|
613
|
+
}
|
|
614
|
+
function collectWritableCells(rows, rect) {
|
|
615
|
+
const out = [];
|
|
616
|
+
for (let r = rect.r1; r <= rect.r2; r++) {
|
|
617
|
+
for (let c = rect.c1; c <= rect.c2; c++) {
|
|
618
|
+
const cell = rows[r]?.cells[c];
|
|
619
|
+
if (cell && !cell.merged) out.push(cell);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
return out;
|
|
623
|
+
}
|
|
624
|
+
function resolveCellGroupMode(rows, rect) {
|
|
625
|
+
const count2 = collectWritableCells(rows, rect).length;
|
|
626
|
+
return { mode: count2 > 1 ? "multi" : "single", count: count2 };
|
|
627
|
+
}
|
|
628
|
+
function resolveSharedCellType(rows, rect) {
|
|
629
|
+
const cells = collectWritableCells(rows, rect);
|
|
630
|
+
if (!cells.length) return null;
|
|
631
|
+
const first = cells[0].cellType ?? "text";
|
|
632
|
+
return cells.every((c) => (c.cellType ?? "text") === first) ? first : null;
|
|
633
|
+
}
|
|
634
|
+
function resolveCellBorderDisplay(rows, rect) {
|
|
635
|
+
const edges = [];
|
|
636
|
+
for (const cell of collectWritableCells(rows, rect)) {
|
|
637
|
+
for (const side of ["top", "right", "bottom", "left"]) {
|
|
638
|
+
const b = cell.borders?.[side];
|
|
639
|
+
if (b) edges.push(b);
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
const pick = (get) => {
|
|
643
|
+
if (!edges.length) return void 0;
|
|
644
|
+
const first = get(edges[0]);
|
|
645
|
+
return edges.every((b) => get(b) === first) ? first : "mixed";
|
|
646
|
+
};
|
|
647
|
+
return {
|
|
648
|
+
width: pick((b) => b.width),
|
|
649
|
+
style: pick((b) => b.style),
|
|
650
|
+
color: pick((b) => b.color)
|
|
651
|
+
};
|
|
652
|
+
}
|
|
579
653
|
var GHOST_BORDER_CSS = "1px dashed rgba(0,0,0,0.18)";
|
|
580
654
|
function resolveCellBorderCss(b, opts = {}) {
|
|
581
655
|
if (b && b.style !== "none") return `${b.width}pt ${b.style} ${b.color}`;
|
|
@@ -596,12 +670,245 @@ function clampResizedColumnWidth(colWidths, index, targetMm, maxTableWidth) {
|
|
|
596
670
|
return Math.min(Math.max(rounded, MIN_COL_WIDTH_MM), cap);
|
|
597
671
|
}
|
|
598
672
|
|
|
673
|
+
// src/designer/utils/element-border-edit.ts
|
|
674
|
+
var ELEMENT_BORDER_FALLBACK_WIDTH = 0.75;
|
|
675
|
+
var ELEMENT_BORDER_APPLY_HINT = "\u7EBF\u578B / \u5BBD\u5EA6 / \u989C\u8272\u5373\u65F6\u751F\u6548\uFF0C\u8FD9\u4E09\u884C\u663E\u793A\u7684\u5C31\u662F\u5F53\u524D\u751F\u6548\u89C4\u683C\uFF1A\u5DF2\u6709\u8FB9\u6846\u65F6\u4EFB\u6539\u4E00\u884C\u90FD\u4F1A\u6309\u65B0\u89C4\u683C\u94FA\u6EE1\u56DB\u8FB9\u5E76\u6E05\u6389\u5355\u8FB9\u8986\u76D6\uFF1B\u4E0A\u3001\u4E0B\u3001\u5DE6\u3001\u53F3\u53EA\u7ED9\u9009\u4E2D\u7684\u8FB9\u52A0\u6846\uFF0C\u64A4\u6389\u4E00\u8FB9\u4F1A\u628A\u5B83\u5176\u4F59\u4E09\u8FB9\u843D\u6210\u5355\u8FB9\uFF1B\u300C\u65E0\u300D\u6E05\u9664\u8FB9\u6846\uFF0C\u300C\u5185\u90E8\u300D\u4EC5\u8868\u683C\u5355\u5143\u683C\u53EF\u7528";
|
|
676
|
+
var BORDER_EDGE_SIDES = ["top", "right", "bottom", "left"];
|
|
677
|
+
function resolveBorderEdgeStates(borders) {
|
|
678
|
+
const out = {};
|
|
679
|
+
for (const side of BORDER_EDGE_SIDES) {
|
|
680
|
+
const flags = borders.map((b) => !!b?.[side]);
|
|
681
|
+
out[side] = flags.length > 0 && flags.every(Boolean) ? "on" : flags.some(Boolean) ? "mixed" : "off";
|
|
682
|
+
}
|
|
683
|
+
return out;
|
|
684
|
+
}
|
|
685
|
+
var BORDER_LINE_STYLES = [
|
|
686
|
+
{ value: "none", label: "\u65E0" },
|
|
687
|
+
{ value: "solid", label: "\u5B9E\u7EBF" },
|
|
688
|
+
{ value: "dashed", label: "\u865A\u7EBF" },
|
|
689
|
+
{ value: "dotted", label: "\u70B9\u7EBF" },
|
|
690
|
+
{ value: "double", label: "\u53CC\u7EBF" }
|
|
691
|
+
];
|
|
692
|
+
var VALID_BORDER_STYLES = /* @__PURE__ */ new Set(["solid", "dashed", "dotted", "double"]);
|
|
693
|
+
var NO_STYLE = "none";
|
|
694
|
+
function elementBorderEdgeVisible(opts, side) {
|
|
695
|
+
const edge = opts.borders?.[side];
|
|
696
|
+
if (edge && edge.style !== NO_STYLE && typeof edge.width === "number" && Number.isFinite(edge.width) && edge.width > 0) return true;
|
|
697
|
+
const w = opts.borderWidth;
|
|
698
|
+
return opts.borderStyle !== NO_STYLE && typeof w === "number" && Number.isFinite(w) && w > 0;
|
|
699
|
+
}
|
|
700
|
+
function elementVisibleBorders(opts) {
|
|
701
|
+
const out = {};
|
|
702
|
+
for (const side of BORDER_EDGE_SIDES) {
|
|
703
|
+
if (elementBorderEdgeVisible(opts, side)) out[side] = opts.borders?.[side] ?? { width: opts.borderWidth };
|
|
704
|
+
}
|
|
705
|
+
return out;
|
|
706
|
+
}
|
|
707
|
+
function resolveElementBorderSpec(opts) {
|
|
708
|
+
const w = opts.borderWidth;
|
|
709
|
+
const width = typeof w === "number" && Number.isFinite(w) && w > 0 ? w : ELEMENT_BORDER_FALLBACK_WIDTH;
|
|
710
|
+
return { width, style: opts.borderStyle || "solid", color: opts.borderColor || "#333333" };
|
|
711
|
+
}
|
|
712
|
+
function applyElementBorderPreset(opts, preset, spec) {
|
|
713
|
+
if (preset === "inner") return;
|
|
714
|
+
opts.borders = void 0;
|
|
715
|
+
if (preset === "none") {
|
|
716
|
+
opts.borderWidth = 0;
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
opts.borderWidth = spec.width;
|
|
720
|
+
opts.borderStyle = spec.style;
|
|
721
|
+
opts.borderColor = spec.color;
|
|
722
|
+
}
|
|
723
|
+
function hasVisibleElementBorder(opts) {
|
|
724
|
+
return BORDER_EDGE_SIDES.some((s) => elementBorderEdgeVisible(opts, s));
|
|
725
|
+
}
|
|
726
|
+
function pickField(edges, key) {
|
|
727
|
+
if (!edges.length) return void 0;
|
|
728
|
+
const first = edges[0]?.[key];
|
|
729
|
+
return edges.every((e) => e[key] === first) ? first : "mixed";
|
|
730
|
+
}
|
|
731
|
+
function normalizeEdge(edge) {
|
|
732
|
+
if (!edge) return void 0;
|
|
733
|
+
const style = typeof edge.style === "string" && VALID_BORDER_STYLES.has(edge.style) ? edge.style : "solid";
|
|
734
|
+
return { width: edge.width, style: edge.style === void 0 ? void 0 : style, color: edge.color };
|
|
735
|
+
}
|
|
736
|
+
function displayOfVisibleEdges(opts) {
|
|
737
|
+
const visible = BORDER_EDGE_SIDES.map((s) => opts.borders?.[s]).filter((e) => typeof e?.width === "number" && Number.isFinite(e.width) && e.width > 0).map((e) => normalizeEdge(e));
|
|
738
|
+
if (!visible.length) return void 0;
|
|
739
|
+
const style = pickField(visible, "style");
|
|
740
|
+
return {
|
|
741
|
+
width: pickField(visible, "width"),
|
|
742
|
+
style: style === void 0 ? "solid" : style,
|
|
743
|
+
color: pickField(visible, "color")
|
|
744
|
+
};
|
|
745
|
+
}
|
|
746
|
+
function resolveElementBorderDisplay(opts) {
|
|
747
|
+
const w = opts.borderWidth;
|
|
748
|
+
const declared = typeof w === "number" && Number.isFinite(w);
|
|
749
|
+
const fromEdges = displayOfVisibleEdges(opts);
|
|
750
|
+
const allVisible = declared && w > 0;
|
|
751
|
+
if (fromEdges && !allVisible) return fromEdges;
|
|
752
|
+
const style = allVisible ? opts.borderStyle || "solid" : NO_STYLE;
|
|
753
|
+
if (declared) return { width: w, style, color: opts.borderColor };
|
|
754
|
+
return { width: void 0, style, color: void 0 };
|
|
755
|
+
}
|
|
756
|
+
function effectiveElementBorderSpec(opts) {
|
|
757
|
+
const d = resolveElementBorderDisplay(opts);
|
|
758
|
+
return {
|
|
759
|
+
width: typeof d.width === "number" && d.width > 0 ? d.width : ELEMENT_BORDER_FALLBACK_WIDTH,
|
|
760
|
+
// 「无」不是可复制的线型:勾一条边要出线,落到实线
|
|
761
|
+
style: typeof d.style === "string" && d.style !== NO_STYLE ? d.style : "solid",
|
|
762
|
+
color: typeof d.color === "string" ? d.color : "#333333"
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
function applyElementBorderAll(opts, spec) {
|
|
766
|
+
opts.borderWidth = spec.width;
|
|
767
|
+
opts.borderStyle = spec.style;
|
|
768
|
+
opts.borderColor = spec.color;
|
|
769
|
+
opts.borders = void 0;
|
|
770
|
+
}
|
|
771
|
+
function setElementBorderField(opts, key, value) {
|
|
772
|
+
if (key === "borderStyle" && value === NO_STYLE) {
|
|
773
|
+
const hadBorder = hasVisibleElementBorder(opts);
|
|
774
|
+
opts.borderStyle = NO_STYLE;
|
|
775
|
+
if (hadBorder) {
|
|
776
|
+
opts.borderWidth = 0;
|
|
777
|
+
opts.borders = void 0;
|
|
778
|
+
}
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
if (!hasVisibleElementBorder(opts)) {
|
|
782
|
+
if (key === "borderStyle") {
|
|
783
|
+
opts.borderStyle = value;
|
|
784
|
+
opts.borderWidth = ELEMENT_BORDER_FALLBACK_WIDTH;
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
Object.assign(opts, { [key]: value });
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
if (key === "borderWidth" && (typeof value !== "number" || !(value > 0))) {
|
|
791
|
+
opts.borderWidth = typeof value === "number" && value < 0 ? 0 : value;
|
|
792
|
+
opts.borders = void 0;
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
applyElementBorderAll(opts, resolveElementBorderSpec({ ...opts, [key]: value }));
|
|
796
|
+
}
|
|
797
|
+
function setElementBorderEdgeVisible(opts, side, visible, spec) {
|
|
798
|
+
if (visible === elementBorderEdgeVisible(opts, side)) return;
|
|
799
|
+
if (!visible) {
|
|
800
|
+
const allWidth = opts.borderWidth;
|
|
801
|
+
if (typeof allWidth !== "number" || !(allWidth > 0)) {
|
|
802
|
+
setElementBorderEdge(opts, side, null);
|
|
803
|
+
return;
|
|
804
|
+
}
|
|
805
|
+
const next = {};
|
|
806
|
+
for (const s of BORDER_EDGE_SIDES) {
|
|
807
|
+
if (s === side) continue;
|
|
808
|
+
const own = opts.borders?.[s];
|
|
809
|
+
next[s] = {
|
|
810
|
+
width: own?.width ?? allWidth,
|
|
811
|
+
...own?.style !== void 0 ? { style: own.style } : opts.borderStyle !== void 0 ? { style: opts.borderStyle } : {},
|
|
812
|
+
...own?.color !== void 0 ? { color: own.color } : opts.borderColor !== void 0 ? { color: opts.borderColor } : {}
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
opts.borders = next;
|
|
816
|
+
opts.borderWidth = 0;
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
setElementBorderEdge(opts, side, spec ?? effectiveElementBorderSpec(opts));
|
|
820
|
+
}
|
|
821
|
+
function setElementBorderEdge(opts, side, spec) {
|
|
822
|
+
const nb = { ...opts.borders ?? {} };
|
|
823
|
+
if (spec) nb[side] = { width: spec.width, style: spec.style, color: spec.color };
|
|
824
|
+
else delete nb[side];
|
|
825
|
+
opts.borders = nb;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
// src/designer/utils/preview-zoom.ts
|
|
829
|
+
var MM_TO_PX = 96 / 25.4;
|
|
830
|
+
var ZOOM_MIN = 1;
|
|
831
|
+
var ZOOM_MAX = 8;
|
|
832
|
+
var FALLBACK_PAPER_WIDTH_MM = 210;
|
|
833
|
+
function collectDpi(node, out) {
|
|
834
|
+
if (!node || typeof node !== "object") return;
|
|
835
|
+
if (Array.isArray(node)) {
|
|
836
|
+
for (const item of node) collectDpi(item, out);
|
|
837
|
+
return;
|
|
838
|
+
}
|
|
839
|
+
const record = node;
|
|
840
|
+
if (typeof record.printerDpi === "number" && record.printerDpi > 0) out.add(record.printerDpi);
|
|
841
|
+
for (const key of Object.keys(record)) {
|
|
842
|
+
if (key === "printerDpi") continue;
|
|
843
|
+
const value = record[key];
|
|
844
|
+
if (value && typeof value === "object") collectDpi(value, out);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
function resolvePrinterDpi(templateJson) {
|
|
848
|
+
if (!templateJson) return null;
|
|
849
|
+
const found = /* @__PURE__ */ new Set();
|
|
850
|
+
collectDpi(templateJson, found);
|
|
851
|
+
return found.size ? Math.max(...found) : null;
|
|
852
|
+
}
|
|
853
|
+
function paperWidthPx(templateJson) {
|
|
854
|
+
const page = templateJson?.pages?.[0] ?? templateJson;
|
|
855
|
+
if (!page) return FALLBACK_PAPER_WIDTH_MM * MM_TO_PX;
|
|
856
|
+
return getPaperDimensions(page).width * MM_TO_PX;
|
|
857
|
+
}
|
|
858
|
+
function fitZoom(containerPx, paperPx) {
|
|
859
|
+
if (containerPx <= 0 || paperPx <= 0) return ZOOM_MIN;
|
|
860
|
+
return Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, Math.floor(containerPx / paperPx)));
|
|
861
|
+
}
|
|
862
|
+
function zoomPresets(dpi, containerPx, paperPx) {
|
|
863
|
+
const list = [];
|
|
864
|
+
if (dpi) {
|
|
865
|
+
list.push({
|
|
866
|
+
key: "dots",
|
|
867
|
+
value: dpi / 96,
|
|
868
|
+
label: `\u70B9\u9635 ${dpi}dpi`,
|
|
869
|
+
tip: `1 \u5C4F\u5E55\u50CF\u7D20 = 1 \u4E2A\u6253\u5370\u70B9\uFF08${dpi}dpi \xF7 96dpi\uFF09\u3002\u6761\u4E0E\u95F4\u9699\u6309\u7EB8\u9762\u9010\u70B9\u663E\u793A\uFF0C\u4E0D\u4F1A\u5728\u5C4F\u5E55\u4E0A\u7CCA\u6210\u4E00\u7247`
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
list.push(
|
|
873
|
+
{ key: "fit", value: fitZoom(containerPx, paperPx), label: "\u9002\u914D", tip: "\u6309\u5BB9\u5668\u5BBD\u653E\u5927\u5230\u653E\u5F97\u4E0B\u6574\u9875\u7684\u6700\u5927\u6574\u6570\u500D" },
|
|
874
|
+
{ key: "100", value: 1, label: "100%", tip: "\u6309 CSS \u771F\u5B9E\u5C3A\u5BF8\u663E\u793A\uFF081mm = 3.78 \u5C4F\u5E55\u50CF\u7D20\uFF09\uFF0C\u70ED\u654F\u70B9\u8DDD\u5728\u6B64\u6863\u4E0D\u53EF\u5206\u8FA8" },
|
|
875
|
+
{ key: "200", value: 2, label: "200%", tip: "\u6574\u6570\u500D\u653E\u5927\uFF0C\u907F\u514D\u975E\u6574\u6570\u7F29\u653E\u5E26\u6765\u7684\u534A\u50CF\u7D20\u8FB9" },
|
|
876
|
+
{ key: "400", value: 4, label: "400%", tip: "\u6574\u6570\u500D\u653E\u5927\uFF0C\u907F\u514D\u975E\u6574\u6570\u7F29\u653E\u5E26\u6765\u7684\u534A\u50CF\u7D20\u8FB9" }
|
|
877
|
+
);
|
|
878
|
+
return list;
|
|
879
|
+
}
|
|
880
|
+
function defaultZoomKey(dpi) {
|
|
881
|
+
return dpi ? "dots" : "fit";
|
|
882
|
+
}
|
|
883
|
+
var PREVIEW_ZOOM_GUARD_ID = "print-preview-zoom-guard";
|
|
884
|
+
function applyPreviewViewZoom(doc, zoom) {
|
|
885
|
+
if (!doc?.documentElement) return;
|
|
886
|
+
let guard = doc.getElementById(PREVIEW_ZOOM_GUARD_ID);
|
|
887
|
+
if (!guard) {
|
|
888
|
+
guard = doc.createElement("style");
|
|
889
|
+
guard.id = PREVIEW_ZOOM_GUARD_ID;
|
|
890
|
+
(doc.head ?? doc.documentElement).appendChild(guard);
|
|
891
|
+
}
|
|
892
|
+
guard.textContent = `html{zoom:${zoom}}@media print{html{zoom:1 !important}}`;
|
|
893
|
+
}
|
|
894
|
+
function resolveZoomKey(presets, currentKey, dpi) {
|
|
895
|
+
return presets.some((p) => p.key === currentKey) ? currentKey : defaultZoomKey(dpi);
|
|
896
|
+
}
|
|
897
|
+
function zoomValueOf(presets, key) {
|
|
898
|
+
return presets.find((p) => p.key === key)?.value ?? 1;
|
|
899
|
+
}
|
|
900
|
+
|
|
599
901
|
// src/designer/utils/element-factory.ts
|
|
600
902
|
function generateId() {
|
|
601
903
|
return `el-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
602
904
|
}
|
|
603
905
|
function createDefaultOptions(type) {
|
|
604
|
-
const base = {
|
|
906
|
+
const base = {
|
|
907
|
+
left: 7,
|
|
908
|
+
top: 17.6,
|
|
909
|
+
width: 42.3,
|
|
910
|
+
height: 7.1
|
|
911
|
+
};
|
|
605
912
|
switch (type) {
|
|
606
913
|
case "text":
|
|
607
914
|
return { ...base, formatter: "\u6587\u672C", fontSize: 12, textAlign: "left", height: 5.3 };
|
|
@@ -628,6 +935,19 @@ function createDefaultOptions(type) {
|
|
|
628
935
|
tablePagination: { enabled: true }
|
|
629
936
|
};
|
|
630
937
|
}
|
|
938
|
+
case "flowList":
|
|
939
|
+
return {
|
|
940
|
+
...base,
|
|
941
|
+
width: 141.1,
|
|
942
|
+
height: 21.2,
|
|
943
|
+
fontSize: 12,
|
|
944
|
+
formatter: "{name} {spec}",
|
|
945
|
+
flowColumns: 4,
|
|
946
|
+
flowRowHeight: 8,
|
|
947
|
+
flowGapX: 4,
|
|
948
|
+
flowAutoSpan: false,
|
|
949
|
+
flowMaxSpan: 2
|
|
950
|
+
};
|
|
631
951
|
case "hline":
|
|
632
952
|
return { ...base, width: 70.6, height: 1.8, borderWidth: 0.75 };
|
|
633
953
|
case "vline":
|
|
@@ -652,6 +972,7 @@ function createRuntimeElement(type, options) {
|
|
|
652
972
|
image: { title: "\u56FE\u7247" },
|
|
653
973
|
longText: { title: "\u957F\u6587" },
|
|
654
974
|
table: { title: "\u8868\u683C" },
|
|
975
|
+
flowList: { title: "\u6D41\u5F0F\u5217\u8868" },
|
|
655
976
|
hline: { title: "\u6A2A\u7EBF" },
|
|
656
977
|
vline: { title: "\u7AD6\u7EBF" },
|
|
657
978
|
rect: { title: "\u77E9\u5F62" },
|
|
@@ -812,7 +1133,7 @@ var PROPERTY_REGISTRY = [
|
|
|
812
1133
|
{ key: "ap-line-height", keywords: ["\u884C\u9AD8", "lineheight"] },
|
|
813
1134
|
{ key: "ap-letter-spacing", keywords: ["\u5B57\u95F4\u8DDD", "letterspacing"] },
|
|
814
1135
|
{ key: "ap-text-fit", keywords: ["\u6EA2\u51FA", "\u6EA2\u51FA\u663E\u793A", "\u622A\u65AD", "\u81EA\u52A8\u7F29\u5C0F", "\u81EA\u9002\u5E94\u884C\u9AD8", "textfit", "overflow"] },
|
|
815
|
-
{ key: "ap-shrink-min", keywords: ["\u6700\u5C0F\u5B57\u53F7", "\u7F29\u653E\u4E0B\u9650", "shrinkminfontsize"] },
|
|
1136
|
+
{ key: "ap-shrink-min", keywords: ["\u6700\u5C0F\u5B57\u53F7", "\u7F29\u653E\u4E0B\u9650", "shrinkminfontsize"], default: DEFAULT_SHRINK_MIN_FONT_SIZE_PT, defaultUnit: "pt" },
|
|
816
1137
|
{ key: "ap-word-wrap", keywords: ["\u81EA\u52A8\u6362\u884C", "\u4E0D\u6362\u884C", "wordwrap"] },
|
|
817
1138
|
{
|
|
818
1139
|
key: "ap-long-text-indent",
|
|
@@ -832,10 +1153,43 @@ var PROPERTY_REGISTRY = [
|
|
|
832
1153
|
{
|
|
833
1154
|
key: "ap-img-fit-scale",
|
|
834
1155
|
keywords: ["\u653E\u5927\u6BD4\u4F8B", "\u526A\u88C1\u653E\u5927", "\u653E\u5927\u500D\u6570", "\u53D6\u666F", "\u88C1\u5207\u8303\u56F4", "fitscale", "zoom"],
|
|
1156
|
+
default: CROP_SCALE_MIN,
|
|
1157
|
+
defaultUnit: "%",
|
|
835
1158
|
tip: "\u526A\u88C1\u653E\u5927\uFF1A\u7B49\u6BD4\u94FA\u6EE1\u4E4B\u540E\u628A\u753B\u9762\u518D\u63A8\u5927\u8FD9\u4E48\u591A\uFF0C\u4E24\u8F74\u624D\u771F\u7684\u5404\u591A\u51FA\u4E00\u6761\u8FB9\u53EF\u88C1\u2014\u2014\u56FE\u4E0E\u6846\u540C\u6BD4\u4F8B\u65F6\u4E0D\u653E\u5927\u5C31\u4EC0\u4E48\u90FD\u88C1\u4E0D\u6389\u3002100\uFF1D\u4E0D\u653E\u5927\uFF08\u7F3A\u7701\uFF09\uFF0C\u4E0A\u9650 400\uFF1B\u8D85\u51FA\u6846\u7684\u90E8\u5206\u7531\u5143\u7D20\u6846\u88C1\u6389\u3002\u951A\u70B9\u9009\u4E2D\u7684\u90A3\u4E00\u70B9\u65E2\u662F\u53D6\u4F4D\u7684\u9489\u4F4F\u70B9\u3001\u4E5F\u662F\u653E\u5927\u7684\u4E2D\u5FC3\uFF0C\u4E24\u8005\u5171\u7528\u540C\u4E00\u4E2A\u503C\u3002\u4EC5\u300C\u526A\u88C1\u300D\u6863\u751F\u6548\uFF0C\u5176\u4F59\u7F29\u653E\u6A21\u5F0F\u4E0D\u51FA\u672C\u884C"
|
|
836
1159
|
}
|
|
837
1160
|
]
|
|
838
1161
|
},
|
|
1162
|
+
{
|
|
1163
|
+
group: "flow-list",
|
|
1164
|
+
groupLabel: "\u6D41\u5F0F\u5217\u8868",
|
|
1165
|
+
items: [
|
|
1166
|
+
{
|
|
1167
|
+
key: "fl-columns",
|
|
1168
|
+
keywords: ["\u6BCF\u884C\u5217\u6570", "\u5217\u6570", "\u680F\u6570", "\u51E0\u5217", "flowcolumns"],
|
|
1169
|
+
tip: "\u4E00\u884C\u6392\u51E0\u4E2A\u5355\u5143\uFF0C\u5FC5\u987B\u7531\u4F60\u6307\u5B9A\u2014\u2014\u4E0D\u968F\u5185\u5BB9\u81EA\u52A8\u7B97\u5217\u6570\u3002\u586B\u7684\u5217\u6570\u4E58\u5355\u5143\u5BBD\u653E\u4E0D\u4E0B\u5143\u7D20\u6846\u65F6\u53EA\u7ED9\u63D0\u793A\u3001\u4E0D\u6539\u4F60\u7684\u6570\uFF0C\u51FA\u7EB8\u6309\u4F60\u586B\u7684\u6392"
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
key: "fl-row-height",
|
|
1173
|
+
keywords: ["\u884C\u9AD8", "\u6BCF\u884C\u9AD8\u5EA6", "\u5355\u5143\u9AD8\u5EA6", "flowrowheight"],
|
|
1174
|
+
tip: "\u6BCF\u4E2A\u5355\u5143\u884C\u7684\u6700\u4F4E\u9AD8\u5EA6\uFF08\u6BEB\u7C73\uFF09\uFF0C\u4E0E\u8868\u683C\u884C\u9AD8\u540C\u4E00\u53E3\u5F84\uFF1A\u5185\u5BB9\u6BD4\u5B83\u9AD8\u65F6\u8FD9\u4E00\u884C\u4F1A\u6491\u9AD8\uFF0C\u4E0D\u4F1A\u88C1\u5B57"
|
|
1175
|
+
},
|
|
1176
|
+
{
|
|
1177
|
+
key: "fl-gap-x",
|
|
1178
|
+
keywords: ["\u5355\u5143\u95F4\u8DDD", "\u6A2A\u5411\u95F4\u8DDD", "\u683C\u95F4\u8DDD", "\u5217\u95F4\u8DDD", "flowgapx"],
|
|
1179
|
+
tip: "\u76F8\u90BB\u5355\u5143\u4E4B\u95F4\u7684\u6A2A\u5411\u7559\u767D\uFF08\u6BEB\u7C73\uFF09\uFF1B\u7EB5\u5411\u4E0D\u7559\u7F1D\uFF0C\u884C\u4E0E\u884C\u7684\u8DDD\u79BB\u7531\u884C\u9AD8\u627F\u62C5"
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
key: "fl-auto-span",
|
|
1183
|
+
keywords: ["\u81EA\u9002\u5E94", "\u8DE8\u5217", "\u5185\u5BB9\u8FC7\u957F", "\u5360\u4E24\u5217", "\u81EA\u52A8\u6362\u884C", "flowsautspan", "flowautospan"],
|
|
1184
|
+
tip: "\u5355\u5143\u5185\u5BB9\u6BD4\u4E00\u5217\u8FD8\u5BBD\u65F6\uFF0C\u8BA9\u5B83\u5360\u6389\u4E24\u4E2A\u6216\u66F4\u591A\u5217\u4F4D\uFF1B\u5F53\u524D\u884C\u5269\u4E0D\u591F\u653E\u5C31\u628A\u6574\u4E2A\u5355\u5143\u632A\u5230\u4E0B\u4E00\u884C\u884C\u9996\uFF08\u7EDD\u4E0D\u628A\u8BCD\u5207\u4E24\u534A\uFF09\u3002\u9ED8\u8BA4\u5173\u2014\u2014\u5F00\u7740\u65F6\u51FA\u7EB8\u680F\u6570\u7531\u5B57\u53F7\u4E0E\u6846\u5BBD\u51B3\u5B9A"
|
|
1185
|
+
},
|
|
1186
|
+
{
|
|
1187
|
+
key: "fl-max-span",
|
|
1188
|
+
keywords: ["\u6700\u591A\u8DE8\u51E0\u5217", "\u8DE8\u5217\u4E0A\u9650", "flowmaxspan"],
|
|
1189
|
+
tip: "\u8DE8\u5217\u7684\u5217\u6570\u4E0A\u9650\uFF0C\u6700\u5927\u53EA\u80FD\u7B49\u4E8E\u300C\u6BCF\u884C\u5217\u6570\u300D\uFF1A\u628A\u6BCF\u884C\u5217\u6570\u6539\u5C0F\u65F6\uFF0C\u8FD9\u91CC\u4F1A\u88AB\u4E00\u5E76\u9876\u56DE\u53BB"
|
|
1190
|
+
}
|
|
1191
|
+
]
|
|
1192
|
+
},
|
|
839
1193
|
{
|
|
840
1194
|
group: "code",
|
|
841
1195
|
groupLabel: "\u6761\u7801\u8BBE\u7F6E",
|
|
@@ -843,12 +1197,28 @@ var PROPERTY_REGISTRY = [
|
|
|
843
1197
|
{ key: "cd-type", keywords: ["\u7801\u5236", "\u6761\u7801\u7C7B\u578B", "\u6761\u5F62\u7801\u7C7B\u578B", "barcodetype", "code128", "ean13", "code39", "itf14"] },
|
|
844
1198
|
{ key: "cd-dpi", keywords: ["\u6253\u5370\u673A\u5206\u8FA8\u7387", "dpi", "\u6253\u5370\u70B9", "\u70B9\u9635\u5BF9\u9F50", "203", "300"] },
|
|
845
1199
|
{ key: "cd-bar-width", keywords: ["\u6761\u5BBD", "\u6761\u7C97\u7EC6", "barwidth", "\u6A21\u5757\u5BBD"] },
|
|
1200
|
+
{
|
|
1201
|
+
key: "cd-bar-quiet-zone",
|
|
1202
|
+
keywords: ["\u6761\u7801\u9759\u533A", "\u6761\u7801\u767D\u8FB9", "\u6761\u5F62\u7801\u7559\u767D", "\u6761\u7801\u7A7A\u767D\u8FB9", "barquietzone"],
|
|
1203
|
+
default: BARCODE_QUIET_ZONE_MODULES,
|
|
1204
|
+
defaultUnit: "\u6A21\u5757",
|
|
1205
|
+
tip: "\u6761\u5F62\u7801\u5DE6\u53F3\u4E24\u7AEF\u7684\u7A7A\u767D\u683C\u6570\uFF081 \u683C = 1 \u6761\u5BBD\uFF09\uFF1A\u7F3A\u7701 10\uFF0C\u6B63\u662F\u4E00\u7EF4\u7801\u7801\u5236\u8981\u6C42\u7684\u4E0B\u9650\uFF1B\u6570\u503C\u8D8A\u5C0F\u767D\u8FB9\u8D8A\u7A84\u3001\u540C\u6837\u7684\u6846\u5185\u6761\u8D8A\u7C97\uFF08\u53EF\u653E\u5927\uFF09\u3002\u586B 0 \u5373\u4E0D\u7559\u767D\u8FB9\uFF0C\u4F46\u9759\u533A\u53C2\u4E0E\u300C\u6761\u2192\u7A7A\u2192\u6761\u300D\u8DF3\u53D8\uFF0C\u7D27\u90BB\u6587\u5B57\u6216\u8868\u683C\u7EBF\u65F6\u53EF\u80FD\u626B\u4E0D\u51FA\uFF0C\u9700\u5B9E\u6253\u9A8C\u8BC1"
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
key: "cd-bar-height",
|
|
1209
|
+
keywords: ["\u6761\u9AD8", "\u6761\u7801\u9AD8\u5EA6", "\u6761\u533A\u9AD8\u5EA6", "\u6761\u7801\u591A\u9AD8", "barheight"],
|
|
1210
|
+
default: BARCODE_BAR_HEIGHT_MODULES,
|
|
1211
|
+
defaultUnit: "\u6A21\u5757",
|
|
1212
|
+
tip: "\u9ED1\u767D\u6761\u672C\u4F53\u7684\u76EE\u6807\u9AD8\u5EA6\uFF08mm\uFF0C\u4E0D\u542B\u4E0B\u65B9\u6587\u5B57\uFF09\uFF1A\u6298\u7B97\u7C92\u5EA6\u5C31\u662F\u6BCF\u6A21\u5757\u7269\u7406\u5BBD\uFF0C\u6240\u4EE5\u53EA\u80FD\u7CBE\u786E\u5230\u5B83\u7684\u6574\u6570\u500D\u3002\u6761\u5BBD\u4F18\u5148\u2014\u2014\u53EF\u7528\u6846\u9AD8\u88C5\u4E0D\u4E0B\u65F6\u671F\u671B\u6761\u9AD8\u8BA9\u4F4D\uFF0C\u7EDD\u4E0D\u628A\u6761\u5BBD\u6324\u7A84\uFF08\u70ED\u654F\u51FA\u7EB8\u6E05\u6670\u5EA6\u9760\u6761\u5BBD\uFF09\u3002\u4E0E\u300C\u6700\u5927\u9AD8\u5EA6\u300D\u5206\u5DE5\u4E0D\u540C\uFF1A\u90A3\u6761\u9650\u7684\u662F\u6574\u56FE\uFF08\u542B\u6587\u5B57\uFF09\u7684\u4E0A\u9650"
|
|
1213
|
+
},
|
|
846
1214
|
{ key: "cd-show-text", keywords: ["\u663E\u793A\u6587\u672C", "\u6761\u7801\u6587\u672C", "\u663E\u793A\u6570\u5B57"] },
|
|
847
|
-
{ key: "cd-font-size", keywords: ["\u6761\u7801\u5B57\u53F7", "\u6587\u672C\u5B57\u53F7"] },
|
|
1215
|
+
{ key: "cd-font-size", keywords: ["\u6761\u7801\u5B57\u53F7", "\u6587\u672C\u5B57\u53F7"], default: BARCODE_TEXT_FONT_SIZE_MODULES, defaultUnit: "\u6A21\u5757" },
|
|
848
1216
|
{ key: "cd-ec-level", keywords: ["\u7EA0\u9519\u7EA7\u522B", "\u5BB9\u9519", "qrcodelevel"] },
|
|
849
1217
|
{
|
|
850
1218
|
key: "cd-quiet-zone",
|
|
851
1219
|
keywords: ["\u9759\u533A", "\u9759\u533A\u5BBD\u5EA6", "\u767D\u8FB9", "\u7A7A\u767D\u8FB9", "\u7559\u767D", "\u94FA\u6EE1", "quietzone"],
|
|
1220
|
+
default: QR_DEFAULT_QUIET_MODULES,
|
|
1221
|
+
defaultUnit: "\u6A21\u5757",
|
|
852
1222
|
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"
|
|
853
1223
|
},
|
|
854
1224
|
{ key: "cd-fit", keywords: ["\u7F29\u653E\u6A21\u5F0F", "\u62C9\u4F38", "\u7B49\u6BD4", "fit", "contain", "cover"] },
|
|
@@ -872,6 +1242,7 @@ var PROPERTY_REGISTRY = [
|
|
|
872
1242
|
group: "border-bg",
|
|
873
1243
|
groupLabel: "\u8FB9\u6846\u4E0E\u80CC\u666F",
|
|
874
1244
|
items: [
|
|
1245
|
+
{ key: "bb-border-style", keywords: ["\u7EBF\u578B", "\u8FB9\u6846\u7EBF\u578B", "\u5B9E\u7EBF", "\u865A\u7EBF", "\u70B9\u7EBF", "\u53CC\u7EBF", "borderstyle"] },
|
|
875
1246
|
{ key: "bb-border-width", keywords: ["\u8FB9\u6846\u5BBD\u5EA6", "border"] },
|
|
876
1247
|
{ key: "bb-border-color", keywords: ["\u8FB9\u6846\u989C\u8272"] },
|
|
877
1248
|
{ key: "bb-bg-color", keywords: ["\u80CC\u666F\u8272", "background"] }
|
|
@@ -933,6 +1304,14 @@ function searchProperties(search) {
|
|
|
933
1304
|
}
|
|
934
1305
|
return { groups, itemKeys };
|
|
935
1306
|
}
|
|
1307
|
+
function propertyDefault(key) {
|
|
1308
|
+
for (const g of PROPERTY_REGISTRY) {
|
|
1309
|
+
for (const item of g.items) {
|
|
1310
|
+
if (item.key === key && item.default !== void 0) return { value: item.default, unit: item.defaultUnit };
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
return void 0;
|
|
1314
|
+
}
|
|
936
1315
|
|
|
937
1316
|
// src/designer/utils/engine.ts
|
|
938
1317
|
var engine = new TemplateEngine();
|
|
@@ -1311,7 +1690,16 @@ var ELEMENT_BINDING_REGISTRY = {
|
|
|
1311
1690
|
image: [
|
|
1312
1691
|
{ targetPath: "options.src", label: "\u5185\u5BB9", dataSource: "main", placeholder: "\u8F93\u5165\u56FE\u7247\u8DEF\u5F84\uFF0C\u652F\u6301 /docfiles/... \u76F8\u5BF9\u8DEF\u5F84\u3001\u7EDD\u5BF9 URL \u6216 {\u5B57\u6BB5} \u8868\u8FBE\u5F0F" }
|
|
1313
1692
|
],
|
|
1314
|
-
table: []
|
|
1693
|
+
table: [],
|
|
1694
|
+
// 流式列表的单元模板是一条完整表达式:列表路径写在里面({drugs.name}),不再单独配数据源
|
|
1695
|
+
flowList: [
|
|
1696
|
+
{
|
|
1697
|
+
targetPath: "options.formatter",
|
|
1698
|
+
label: "\u5355\u5143\u6A21\u677F",
|
|
1699
|
+
dataSource: "main",
|
|
1700
|
+
placeholder: "{drugs.name} {drugs.spec}"
|
|
1701
|
+
}
|
|
1702
|
+
]
|
|
1315
1703
|
};
|
|
1316
1704
|
function getTableCellBindings(rowType, rowIndex, cellIndex, listField) {
|
|
1317
1705
|
if (rowType === "data") {
|
|
@@ -1887,9 +2275,15 @@ function useBindingDisplay() {
|
|
|
1887
2275
|
export {
|
|
1888
2276
|
BARCODE_BAR_HEIGHT_MODULES,
|
|
1889
2277
|
BARCODE_MARGIN_BOTTOM_MODULES,
|
|
2278
|
+
BARCODE_MIN_MODULE_WIDTH_MM,
|
|
1890
2279
|
BARCODE_MODULE_WIDTH_MM,
|
|
1891
2280
|
BARCODE_QUIET_ZONE_MODULES,
|
|
1892
2281
|
BARCODE_TEXT_FONT_SIZE_MODULES,
|
|
2282
|
+
BORDER_EDGE_SIDES,
|
|
2283
|
+
BORDER_LINE_STYLES,
|
|
2284
|
+
CELL_BORDER_APPLY_HINT,
|
|
2285
|
+
CELL_BORDER_APPLY_HINT_MIXED,
|
|
2286
|
+
CELL_BORDER_APPLY_HINT_MULTI,
|
|
1893
2287
|
CROP_AXIS_OPTIONS,
|
|
1894
2288
|
CROP_GRID_OPTIONS,
|
|
1895
2289
|
CROP_SAMPLE_IMAGE,
|
|
@@ -1897,12 +2291,21 @@ export {
|
|
|
1897
2291
|
CROP_SCALE_LABEL,
|
|
1898
2292
|
CROP_SCALE_MAX,
|
|
1899
2293
|
CROP_SCALE_MIN,
|
|
2294
|
+
DEFAULT_BORDER,
|
|
1900
2295
|
DEFAULT_DEMO_DATA,
|
|
1901
2296
|
DEFAULT_SHRINK_MIN_FONT_SIZE_PT,
|
|
1902
2297
|
ELEMENT_BINDING_REGISTRY,
|
|
2298
|
+
ELEMENT_BORDER_APPLY_HINT,
|
|
2299
|
+
ELEMENT_BORDER_FALLBACK_WIDTH,
|
|
1903
2300
|
ELEMENT_BORDER_SIDES,
|
|
1904
2301
|
EXTENDED_FUNCTIONS,
|
|
1905
2302
|
FIT_SCALE_MIN_PERCENT,
|
|
2303
|
+
FLOW_MAX_COLUMNS,
|
|
2304
|
+
FLOW_MAX_GAP_X_MM,
|
|
2305
|
+
FLOW_MAX_ROW_HEIGHT_MM,
|
|
2306
|
+
FLOW_MIN_COLUMNS,
|
|
2307
|
+
FLOW_MIN_GAP_X_MM,
|
|
2308
|
+
FLOW_MIN_ROW_HEIGHT_MM,
|
|
1906
2309
|
GHOST_BORDER_CSS,
|
|
1907
2310
|
IMAGE_FIT_OPTIONS,
|
|
1908
2311
|
LABEL_PAPER_GROUP,
|
|
@@ -1910,17 +2313,28 @@ export {
|
|
|
1910
2313
|
MIN_SCALE_PERCENT,
|
|
1911
2314
|
MIN_SHRINK_FONT_SIZE_PT,
|
|
1912
2315
|
MM_PER_INCH,
|
|
2316
|
+
MM_TO_PX,
|
|
1913
2317
|
PAPER_PRESETS,
|
|
1914
2318
|
PRESET_COLORS,
|
|
2319
|
+
PREVIEW_ZOOM_GUARD_ID,
|
|
1915
2320
|
PROPERTY_REGISTRY,
|
|
2321
|
+
QR_DEFAULT_QUIET_MODULES,
|
|
1916
2322
|
RESIZE_POINTS,
|
|
1917
2323
|
RULER_THICKNESS,
|
|
1918
2324
|
ZONE_ALLOWED_TYPES,
|
|
2325
|
+
ZOOM_MAX,
|
|
2326
|
+
ZOOM_MIN,
|
|
1919
2327
|
acceptsElementBorder,
|
|
1920
2328
|
applyBorderPreset,
|
|
2329
|
+
applyElementBorderPreset,
|
|
2330
|
+
applyPreviewViewZoom,
|
|
1921
2331
|
barcodeAvailableBoxMm,
|
|
2332
|
+
barcodeBarHeightModules,
|
|
2333
|
+
barcodeBarWidthRecommendText,
|
|
1922
2334
|
barcodePreferredModuleWidthMm,
|
|
2335
|
+
barcodeQuietZoneModules,
|
|
1923
2336
|
barcodeUnitsPerModule,
|
|
2337
|
+
barcodeWidthBoundModuleWidthMm,
|
|
1924
2338
|
buildCropAnchor,
|
|
1925
2339
|
buildRulerTicks,
|
|
1926
2340
|
calcResizeRect,
|
|
@@ -1933,6 +2347,7 @@ export {
|
|
|
1933
2347
|
clampResizedColumnWidth,
|
|
1934
2348
|
clampScalePercent,
|
|
1935
2349
|
clampToZone,
|
|
2350
|
+
collectWritableCells,
|
|
1936
2351
|
computeAdsorb,
|
|
1937
2352
|
computeFitScale,
|
|
1938
2353
|
createCell,
|
|
@@ -1947,14 +2362,24 @@ export {
|
|
|
1947
2362
|
cropScalePct,
|
|
1948
2363
|
cropStyleDeclarations,
|
|
1949
2364
|
cropWindow,
|
|
2365
|
+
defaultZoomKey,
|
|
1950
2366
|
deleteCol,
|
|
1951
2367
|
deleteRow,
|
|
2368
|
+
detectFlowListKey,
|
|
2369
|
+
effectiveElementBorderSpec,
|
|
2370
|
+
elementBorderEdgeVisible,
|
|
2371
|
+
elementVisibleBorders,
|
|
1952
2372
|
engine,
|
|
2373
|
+
estimateTextWidthMm,
|
|
1953
2374
|
evaluateTemplate,
|
|
1954
2375
|
filterGroups,
|
|
1955
2376
|
finalizeElementZone,
|
|
1956
2377
|
findMainCell,
|
|
2378
|
+
fitZoom,
|
|
1957
2379
|
floorFontSize,
|
|
2380
|
+
flowColumnWidthMm,
|
|
2381
|
+
flowGridStyle,
|
|
2382
|
+
flowSpanWidthMm,
|
|
1958
2383
|
generateGroupId,
|
|
1959
2384
|
generateId,
|
|
1960
2385
|
getDemoData,
|
|
@@ -1970,6 +2395,8 @@ export {
|
|
|
1970
2395
|
isContinuousPaperSize,
|
|
1971
2396
|
isLabelPaperSize,
|
|
1972
2397
|
labelPaperDefaults,
|
|
2398
|
+
layoutBarcodeSize,
|
|
2399
|
+
layoutFlowList,
|
|
1973
2400
|
matchKeywords,
|
|
1974
2401
|
mergeCells,
|
|
1975
2402
|
minorStepMM,
|
|
@@ -1977,36 +2404,59 @@ export {
|
|
|
1977
2404
|
nextWheelScale,
|
|
1978
2405
|
normalizeSelection,
|
|
1979
2406
|
normalizeTemplateUnits,
|
|
2407
|
+
paperWidthPx,
|
|
1980
2408
|
parseCellFitKey,
|
|
1981
2409
|
parseCropAnchor,
|
|
2410
|
+
propertyDefault,
|
|
1982
2411
|
propertyTip,
|
|
1983
2412
|
ptToMm,
|
|
1984
2413
|
pxToMm,
|
|
2414
|
+
recommendBarcodeBarWidth,
|
|
1985
2415
|
resolveBarcodeDesignValue,
|
|
1986
2416
|
resolveBarcodeSize,
|
|
2417
|
+
resolveBorderEdgeStates,
|
|
1987
2418
|
resolveCellBorderCss,
|
|
2419
|
+
resolveCellBorderDisplay,
|
|
2420
|
+
resolveCellGroupMode,
|
|
1988
2421
|
resolveCellTextFit,
|
|
1989
2422
|
resolveCropPreview,
|
|
1990
2423
|
resolveCropTravel,
|
|
1991
2424
|
resolveDesignImageSrc,
|
|
1992
2425
|
resolveElementBorder,
|
|
2426
|
+
resolveElementBorderDisplay,
|
|
2427
|
+
resolveElementBorderSpec,
|
|
1993
2428
|
resolveElementTextFit,
|
|
2429
|
+
resolveFlowColumns,
|
|
2430
|
+
resolveFlowGapX,
|
|
2431
|
+
resolveFlowMaxSpan,
|
|
2432
|
+
resolveFlowRowHeight,
|
|
1994
2433
|
resolveOverlayPlacement,
|
|
2434
|
+
resolvePrinterDpi,
|
|
2435
|
+
resolveSharedCellType,
|
|
1995
2436
|
resolveShrinkMinFontSize,
|
|
1996
2437
|
resolveTextBinding,
|
|
1997
2438
|
resolveToolbarOverflow,
|
|
2439
|
+
resolveZoomKey,
|
|
1998
2440
|
roundFontSize,
|
|
1999
2441
|
safeEval,
|
|
2000
2442
|
sanitizeObjectPosition,
|
|
2001
2443
|
searchProperties,
|
|
2444
|
+
setCellBorderEdge,
|
|
2445
|
+
setElementBorderEdge,
|
|
2446
|
+
setElementBorderEdgeVisible,
|
|
2447
|
+
setElementBorderField,
|
|
2002
2448
|
setHeaderRepeat,
|
|
2003
2449
|
setRowType,
|
|
2450
|
+
spanForText,
|
|
2004
2451
|
splitCells,
|
|
2452
|
+
suggestFlowColumns,
|
|
2005
2453
|
syncTableElementSize,
|
|
2006
2454
|
useAlign,
|
|
2007
2455
|
useBindingDisplay,
|
|
2008
2456
|
useGroup,
|
|
2009
2457
|
useKeyboard,
|
|
2010
2458
|
useResize,
|
|
2011
|
-
zoneFromPaperPoint
|
|
2459
|
+
zoneFromPaperPoint,
|
|
2460
|
+
zoomPresets,
|
|
2461
|
+
zoomValueOf
|
|
2012
2462
|
};
|