@worm-vue3-print/core 1.2.2 → 1.3.1
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/README.md +24 -7
- package/dist/browser/index.cjs +2338 -340
- package/dist/browser/index.d.cts +79 -6
- package/dist/browser/index.d.ts +79 -6
- package/dist/browser/index.js +283 -128
- package/dist/{chunk-HLCZHPUF.js → chunk-AKWV6SID.js} +1 -1
- package/dist/chunk-KFRPTLFV.js +3819 -0
- package/dist/client/index.cjs +381 -0
- package/dist/client/index.d.cts +241 -0
- package/dist/client/index.d.ts +241 -0
- package/dist/client/index.js +346 -0
- package/dist/designer/index.cjs +429 -22
- package/dist/designer/index.d.cts +100 -289
- package/dist/designer/index.d.ts +100 -289
- package/dist/designer/index.js +147 -26
- package/dist/dom-executor.iife.global.js +8 -0
- package/dist/driver-Dn_YAzO5.d.cts +935 -0
- package/dist/driver-Dn_YAzO5.d.ts +935 -0
- package/dist/index.cjs +2226 -163
- package/dist/index.d.cts +374 -6
- package/dist/index.d.ts +374 -6
- package/dist/index.js +180 -4
- package/dist/node/index.cjs +41 -0
- package/dist/node/index.d.cts +6 -0
- package/dist/node/index.d.ts +6 -0
- package/dist/node/index.js +10 -0
- package/dist/ports-BvwlA_km.d.ts +102 -0
- package/dist/ports-Cf5sjwls.d.cts +102 -0
- package/package.json +13 -2
- package/dist/chunk-JZIVNXZ7.js +0 -1777
- package/dist/types-BGBAbQD5.d.cts +0 -184
- package/dist/types-BGBAbQD5.d.ts +0 -184
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
type PaperSize = 'A4' | 'A3' | 'A5' | 'Letter' | 'Legal' | 'CUSTOM';
|
|
2
|
-
/** 纸张尺寸映射(mm) */
|
|
3
|
-
declare const PAPER_DIMENSIONS: Record<PaperSize, {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
}>;
|
|
7
|
-
interface TemplateData {
|
|
8
|
-
paperSize: PaperSize;
|
|
9
|
-
orientation: 'portrait' | 'landscape';
|
|
10
|
-
/** 自定义纸张宽度(mm),仅 paperSize='CUSTOM' 时生效 */
|
|
11
|
-
customWidth?: number;
|
|
12
|
-
/** 自定义纸张高度(mm),仅 paperSize='CUSTOM' 时生效 */
|
|
13
|
-
customHeight?: number;
|
|
14
|
-
/** 页面(纸张)背景色;未设置时默认白色 */
|
|
15
|
-
pageBackground?: string;
|
|
16
|
-
margins: {
|
|
17
|
-
top: number;
|
|
18
|
-
right: number;
|
|
19
|
-
bottom: number;
|
|
20
|
-
left: number;
|
|
21
|
-
};
|
|
22
|
-
header: {
|
|
23
|
-
height: number;
|
|
24
|
-
elements: TemplateElement[];
|
|
25
|
-
};
|
|
26
|
-
footer: {
|
|
27
|
-
height: number;
|
|
28
|
-
elements: TemplateElement[];
|
|
29
|
-
};
|
|
30
|
-
firstPageOverlay: {
|
|
31
|
-
height: number;
|
|
32
|
-
elements: TemplateElement[];
|
|
33
|
-
};
|
|
34
|
-
elements: TemplateElement[];
|
|
35
|
-
}
|
|
36
|
-
/** 元素分页属性(非表格元素) */
|
|
37
|
-
interface PaginationConfig {
|
|
38
|
-
pageable: boolean;
|
|
39
|
-
keepWithNext: boolean;
|
|
40
|
-
}
|
|
41
|
-
/** 表格分页配置 */
|
|
42
|
-
interface TablePaginationConfig {
|
|
43
|
-
enabled: boolean;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 模板元素 — print-render 侧的简化视图。
|
|
47
|
-
* 兼容前端 PrintElementData 的 options 嵌套结构,
|
|
48
|
-
* 同时提供扁平访问器方便分页引擎使用。
|
|
49
|
-
*/
|
|
50
|
-
interface TemplateElement {
|
|
51
|
-
id: string;
|
|
52
|
-
type: string;
|
|
53
|
-
/** 元素选项(与前端 ElementOptions 对齐) */
|
|
54
|
-
options: Record<string, any>;
|
|
55
|
-
/** 元素类型元数据(与前端 PrintElementTypeMeta 对齐) */
|
|
56
|
-
printElementType?: {
|
|
57
|
-
type: string;
|
|
58
|
-
title?: string;
|
|
59
|
-
[key: string]: any;
|
|
60
|
-
};
|
|
61
|
-
/** 分页属性(非表格元素) */
|
|
62
|
-
pagination?: PaginationConfig;
|
|
63
|
-
/** 表格分页配置(表格元素) */
|
|
64
|
-
tablePagination?: TablePaginationConfig;
|
|
65
|
-
}
|
|
66
|
-
type RenderRowType = 'header' | 'data' | 'summary' | 'subtotal' | 'static';
|
|
67
|
-
interface RenderCellBorder {
|
|
68
|
-
width: number;
|
|
69
|
-
style: string;
|
|
70
|
-
color: string;
|
|
71
|
-
}
|
|
72
|
-
interface RenderCellBorders {
|
|
73
|
-
top?: RenderCellBorder;
|
|
74
|
-
right?: RenderCellBorder;
|
|
75
|
-
bottom?: RenderCellBorder;
|
|
76
|
-
left?: RenderCellBorder;
|
|
77
|
-
}
|
|
78
|
-
/** 绑定后的单元格:content 已是最终文本(小计行 content 为占位值,真实值按每页数据渲染时求值) */
|
|
79
|
-
interface RenderCell {
|
|
80
|
-
content: string;
|
|
81
|
-
/** 小计行专用:单元格原始 formatter 表达式,渲染阶段以当前页数据行上下文求值 */
|
|
82
|
-
rawFormatter?: string;
|
|
83
|
-
/** 内容类型:text(默认)/ barcode / qrcode / image,非 text 时 content 为码值或图片 URL */
|
|
84
|
-
cellType?: string;
|
|
85
|
-
/** 条形码码制(jsbarcode 格式名),仅 cellType='barcode' 时生效 */
|
|
86
|
-
barcodeType?: string;
|
|
87
|
-
/** 二维码纠错级别 L/M/Q/H,仅 cellType='qrcode' 时生效 */
|
|
88
|
-
qrCodeLevel?: string;
|
|
89
|
-
/** 条形码下方是否显示文本,仅 cellType='barcode' 时生效 */
|
|
90
|
-
showBarcodeText?: boolean;
|
|
91
|
-
/** 图片缩放模式,仅 cellType='image' 时生效 */
|
|
92
|
-
fit?: string;
|
|
93
|
-
/** 图片最大宽度(mm),仅 cellType='image' 时生效 */
|
|
94
|
-
maxWidth?: number;
|
|
95
|
-
/** 图片最大高度(mm),仅 cellType='image' 时生效 */
|
|
96
|
-
maxHeight?: number;
|
|
97
|
-
rowspan: number;
|
|
98
|
-
colspan: number;
|
|
99
|
-
merged: boolean;
|
|
100
|
-
align?: string;
|
|
101
|
-
valign?: string;
|
|
102
|
-
fontSize?: number;
|
|
103
|
-
fontWeight?: string;
|
|
104
|
-
color?: string;
|
|
105
|
-
backgroundColor?: string;
|
|
106
|
-
borders?: RenderCellBorders;
|
|
107
|
-
padding?: number;
|
|
108
|
-
wordWrap?: boolean;
|
|
109
|
-
}
|
|
110
|
-
/** 绑定后的渲染行,存入 options._renderRows */
|
|
111
|
-
interface RenderRow {
|
|
112
|
-
type: RenderRowType;
|
|
113
|
-
height: number;
|
|
114
|
-
cells: RenderCell[];
|
|
115
|
-
}
|
|
116
|
-
interface CodeRenderOptions {
|
|
117
|
-
/** 条形码码制(jsbarcode 格式名),仅 barcode 类型使用 */
|
|
118
|
-
barcodeType?: string;
|
|
119
|
-
/** 二维码纠错级别 L/M/Q/H,仅 qrcode 类型使用 */
|
|
120
|
-
qrCodeLevel?: string;
|
|
121
|
-
/** 条形码下方是否显示文本 */
|
|
122
|
-
showText?: boolean;
|
|
123
|
-
/** 条码模块宽度倍率 */
|
|
124
|
-
barWidth?: number;
|
|
125
|
-
/** 条码下方文本字号(pt) */
|
|
126
|
-
fontSize?: number;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* 码值 → SVG 字符串渲染器。
|
|
130
|
-
* 服务端由 print-render 用 bwip-js 实现;浏览器由 print-canvas 用 jsbarcode/qrcode 实现。
|
|
131
|
-
* 码值非法时抛出异常,由调用方降级为文本占位。
|
|
132
|
-
*/
|
|
133
|
-
interface CodeRenderer {
|
|
134
|
-
render(value: string, cellType: 'barcode' | 'qrcode', opts?: CodeRenderOptions): string;
|
|
135
|
-
}
|
|
136
|
-
interface RenderRequest {
|
|
137
|
-
templateJson: TemplateData;
|
|
138
|
-
printData?: Record<string, any>;
|
|
139
|
-
/** 服务端对外访问 base URL,用于把 /docfiles/... 等相对路径图片拼接为完整地址 */
|
|
140
|
-
baseUrl?: string;
|
|
141
|
-
}
|
|
142
|
-
interface MeasuredElement {
|
|
143
|
-
id: string;
|
|
144
|
-
measuredHeight: number;
|
|
145
|
-
/** 表格每行实际高度(mm),仅表格元素有值 */
|
|
146
|
-
measuredRowHeights?: number[];
|
|
147
|
-
/** 重复表头段实际高度(mm)= 前 _repeatHeaderCount 个渲染行高之和,仅表格元素有值 */
|
|
148
|
-
repeatHeaderHeight?: number;
|
|
149
|
-
}
|
|
150
|
-
interface PageLayout {
|
|
151
|
-
pageIndex: number;
|
|
152
|
-
sections: PageSection[];
|
|
153
|
-
}
|
|
154
|
-
interface PageSection {
|
|
155
|
-
elementId: string;
|
|
156
|
-
type: 'element' | 'table-slice' | 'flow-group';
|
|
157
|
-
/** table-slice 专用:渲染行起始索引(含表头行) */
|
|
158
|
-
startRow?: number;
|
|
159
|
-
/** table-slice 专用:渲染行结束索引(不含) */
|
|
160
|
-
endRow?: number;
|
|
161
|
-
/** table-slice 专用:非首片时在切片前重复表头段 */
|
|
162
|
-
repeatHeader?: boolean;
|
|
163
|
-
/** table-slice 专用:本片末尾是否渲染小计行(当前页数据小计,每页重复) */
|
|
164
|
-
subtotal?: boolean;
|
|
165
|
-
/** table-slice 专用:本片末尾是否渲染整表汇总行(总计,仅最后一页) */
|
|
166
|
-
summary?: boolean;
|
|
167
|
-
/** 本节在本页内容区内的实际 top(mm)。发生换页后的内容为 0;缺省回退元素设计 top */
|
|
168
|
-
renderTop?: number;
|
|
169
|
-
/**
|
|
170
|
-
* flow-group 专用:相对容器在本页的实际 top(mm),覆盖元素设计 top。
|
|
171
|
-
* 同页时 = 表格设计 top(容器顶部对齐表格 slice 顶部);
|
|
172
|
-
* 跟随区整体移页时 = 新页内容区顶部(0)。
|
|
173
|
-
*/
|
|
174
|
-
groupTop?: number;
|
|
175
|
-
/** flow-group 专用:跟随区成员元素 id(容器内按文档流渲染) */
|
|
176
|
-
followElementIds?: string[];
|
|
177
|
-
}
|
|
178
|
-
/** 获取纸张物理尺寸(考虑方向) */
|
|
179
|
-
declare function getPaperDimensions(template: TemplateData): {
|
|
180
|
-
width: number;
|
|
181
|
-
height: number;
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export { type CodeRenderer as C, type MeasuredElement as M, type PageLayout as P, type RenderCell as R, type TemplateData as T, type TemplateElement as a, type CodeRenderOptions as b, PAPER_DIMENSIONS as c, type PageSection as d, type PaperSize as e, type RenderRequest as f, type RenderRow as g, getPaperDimensions as h };
|
package/dist/types-BGBAbQD5.d.ts
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
type PaperSize = 'A4' | 'A3' | 'A5' | 'Letter' | 'Legal' | 'CUSTOM';
|
|
2
|
-
/** 纸张尺寸映射(mm) */
|
|
3
|
-
declare const PAPER_DIMENSIONS: Record<PaperSize, {
|
|
4
|
-
width: number;
|
|
5
|
-
height: number;
|
|
6
|
-
}>;
|
|
7
|
-
interface TemplateData {
|
|
8
|
-
paperSize: PaperSize;
|
|
9
|
-
orientation: 'portrait' | 'landscape';
|
|
10
|
-
/** 自定义纸张宽度(mm),仅 paperSize='CUSTOM' 时生效 */
|
|
11
|
-
customWidth?: number;
|
|
12
|
-
/** 自定义纸张高度(mm),仅 paperSize='CUSTOM' 时生效 */
|
|
13
|
-
customHeight?: number;
|
|
14
|
-
/** 页面(纸张)背景色;未设置时默认白色 */
|
|
15
|
-
pageBackground?: string;
|
|
16
|
-
margins: {
|
|
17
|
-
top: number;
|
|
18
|
-
right: number;
|
|
19
|
-
bottom: number;
|
|
20
|
-
left: number;
|
|
21
|
-
};
|
|
22
|
-
header: {
|
|
23
|
-
height: number;
|
|
24
|
-
elements: TemplateElement[];
|
|
25
|
-
};
|
|
26
|
-
footer: {
|
|
27
|
-
height: number;
|
|
28
|
-
elements: TemplateElement[];
|
|
29
|
-
};
|
|
30
|
-
firstPageOverlay: {
|
|
31
|
-
height: number;
|
|
32
|
-
elements: TemplateElement[];
|
|
33
|
-
};
|
|
34
|
-
elements: TemplateElement[];
|
|
35
|
-
}
|
|
36
|
-
/** 元素分页属性(非表格元素) */
|
|
37
|
-
interface PaginationConfig {
|
|
38
|
-
pageable: boolean;
|
|
39
|
-
keepWithNext: boolean;
|
|
40
|
-
}
|
|
41
|
-
/** 表格分页配置 */
|
|
42
|
-
interface TablePaginationConfig {
|
|
43
|
-
enabled: boolean;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* 模板元素 — print-render 侧的简化视图。
|
|
47
|
-
* 兼容前端 PrintElementData 的 options 嵌套结构,
|
|
48
|
-
* 同时提供扁平访问器方便分页引擎使用。
|
|
49
|
-
*/
|
|
50
|
-
interface TemplateElement {
|
|
51
|
-
id: string;
|
|
52
|
-
type: string;
|
|
53
|
-
/** 元素选项(与前端 ElementOptions 对齐) */
|
|
54
|
-
options: Record<string, any>;
|
|
55
|
-
/** 元素类型元数据(与前端 PrintElementTypeMeta 对齐) */
|
|
56
|
-
printElementType?: {
|
|
57
|
-
type: string;
|
|
58
|
-
title?: string;
|
|
59
|
-
[key: string]: any;
|
|
60
|
-
};
|
|
61
|
-
/** 分页属性(非表格元素) */
|
|
62
|
-
pagination?: PaginationConfig;
|
|
63
|
-
/** 表格分页配置(表格元素) */
|
|
64
|
-
tablePagination?: TablePaginationConfig;
|
|
65
|
-
}
|
|
66
|
-
type RenderRowType = 'header' | 'data' | 'summary' | 'subtotal' | 'static';
|
|
67
|
-
interface RenderCellBorder {
|
|
68
|
-
width: number;
|
|
69
|
-
style: string;
|
|
70
|
-
color: string;
|
|
71
|
-
}
|
|
72
|
-
interface RenderCellBorders {
|
|
73
|
-
top?: RenderCellBorder;
|
|
74
|
-
right?: RenderCellBorder;
|
|
75
|
-
bottom?: RenderCellBorder;
|
|
76
|
-
left?: RenderCellBorder;
|
|
77
|
-
}
|
|
78
|
-
/** 绑定后的单元格:content 已是最终文本(小计行 content 为占位值,真实值按每页数据渲染时求值) */
|
|
79
|
-
interface RenderCell {
|
|
80
|
-
content: string;
|
|
81
|
-
/** 小计行专用:单元格原始 formatter 表达式,渲染阶段以当前页数据行上下文求值 */
|
|
82
|
-
rawFormatter?: string;
|
|
83
|
-
/** 内容类型:text(默认)/ barcode / qrcode / image,非 text 时 content 为码值或图片 URL */
|
|
84
|
-
cellType?: string;
|
|
85
|
-
/** 条形码码制(jsbarcode 格式名),仅 cellType='barcode' 时生效 */
|
|
86
|
-
barcodeType?: string;
|
|
87
|
-
/** 二维码纠错级别 L/M/Q/H,仅 cellType='qrcode' 时生效 */
|
|
88
|
-
qrCodeLevel?: string;
|
|
89
|
-
/** 条形码下方是否显示文本,仅 cellType='barcode' 时生效 */
|
|
90
|
-
showBarcodeText?: boolean;
|
|
91
|
-
/** 图片缩放模式,仅 cellType='image' 时生效 */
|
|
92
|
-
fit?: string;
|
|
93
|
-
/** 图片最大宽度(mm),仅 cellType='image' 时生效 */
|
|
94
|
-
maxWidth?: number;
|
|
95
|
-
/** 图片最大高度(mm),仅 cellType='image' 时生效 */
|
|
96
|
-
maxHeight?: number;
|
|
97
|
-
rowspan: number;
|
|
98
|
-
colspan: number;
|
|
99
|
-
merged: boolean;
|
|
100
|
-
align?: string;
|
|
101
|
-
valign?: string;
|
|
102
|
-
fontSize?: number;
|
|
103
|
-
fontWeight?: string;
|
|
104
|
-
color?: string;
|
|
105
|
-
backgroundColor?: string;
|
|
106
|
-
borders?: RenderCellBorders;
|
|
107
|
-
padding?: number;
|
|
108
|
-
wordWrap?: boolean;
|
|
109
|
-
}
|
|
110
|
-
/** 绑定后的渲染行,存入 options._renderRows */
|
|
111
|
-
interface RenderRow {
|
|
112
|
-
type: RenderRowType;
|
|
113
|
-
height: number;
|
|
114
|
-
cells: RenderCell[];
|
|
115
|
-
}
|
|
116
|
-
interface CodeRenderOptions {
|
|
117
|
-
/** 条形码码制(jsbarcode 格式名),仅 barcode 类型使用 */
|
|
118
|
-
barcodeType?: string;
|
|
119
|
-
/** 二维码纠错级别 L/M/Q/H,仅 qrcode 类型使用 */
|
|
120
|
-
qrCodeLevel?: string;
|
|
121
|
-
/** 条形码下方是否显示文本 */
|
|
122
|
-
showText?: boolean;
|
|
123
|
-
/** 条码模块宽度倍率 */
|
|
124
|
-
barWidth?: number;
|
|
125
|
-
/** 条码下方文本字号(pt) */
|
|
126
|
-
fontSize?: number;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* 码值 → SVG 字符串渲染器。
|
|
130
|
-
* 服务端由 print-render 用 bwip-js 实现;浏览器由 print-canvas 用 jsbarcode/qrcode 实现。
|
|
131
|
-
* 码值非法时抛出异常,由调用方降级为文本占位。
|
|
132
|
-
*/
|
|
133
|
-
interface CodeRenderer {
|
|
134
|
-
render(value: string, cellType: 'barcode' | 'qrcode', opts?: CodeRenderOptions): string;
|
|
135
|
-
}
|
|
136
|
-
interface RenderRequest {
|
|
137
|
-
templateJson: TemplateData;
|
|
138
|
-
printData?: Record<string, any>;
|
|
139
|
-
/** 服务端对外访问 base URL,用于把 /docfiles/... 等相对路径图片拼接为完整地址 */
|
|
140
|
-
baseUrl?: string;
|
|
141
|
-
}
|
|
142
|
-
interface MeasuredElement {
|
|
143
|
-
id: string;
|
|
144
|
-
measuredHeight: number;
|
|
145
|
-
/** 表格每行实际高度(mm),仅表格元素有值 */
|
|
146
|
-
measuredRowHeights?: number[];
|
|
147
|
-
/** 重复表头段实际高度(mm)= 前 _repeatHeaderCount 个渲染行高之和,仅表格元素有值 */
|
|
148
|
-
repeatHeaderHeight?: number;
|
|
149
|
-
}
|
|
150
|
-
interface PageLayout {
|
|
151
|
-
pageIndex: number;
|
|
152
|
-
sections: PageSection[];
|
|
153
|
-
}
|
|
154
|
-
interface PageSection {
|
|
155
|
-
elementId: string;
|
|
156
|
-
type: 'element' | 'table-slice' | 'flow-group';
|
|
157
|
-
/** table-slice 专用:渲染行起始索引(含表头行) */
|
|
158
|
-
startRow?: number;
|
|
159
|
-
/** table-slice 专用:渲染行结束索引(不含) */
|
|
160
|
-
endRow?: number;
|
|
161
|
-
/** table-slice 专用:非首片时在切片前重复表头段 */
|
|
162
|
-
repeatHeader?: boolean;
|
|
163
|
-
/** table-slice 专用:本片末尾是否渲染小计行(当前页数据小计,每页重复) */
|
|
164
|
-
subtotal?: boolean;
|
|
165
|
-
/** table-slice 专用:本片末尾是否渲染整表汇总行(总计,仅最后一页) */
|
|
166
|
-
summary?: boolean;
|
|
167
|
-
/** 本节在本页内容区内的实际 top(mm)。发生换页后的内容为 0;缺省回退元素设计 top */
|
|
168
|
-
renderTop?: number;
|
|
169
|
-
/**
|
|
170
|
-
* flow-group 专用:相对容器在本页的实际 top(mm),覆盖元素设计 top。
|
|
171
|
-
* 同页时 = 表格设计 top(容器顶部对齐表格 slice 顶部);
|
|
172
|
-
* 跟随区整体移页时 = 新页内容区顶部(0)。
|
|
173
|
-
*/
|
|
174
|
-
groupTop?: number;
|
|
175
|
-
/** flow-group 专用:跟随区成员元素 id(容器内按文档流渲染) */
|
|
176
|
-
followElementIds?: string[];
|
|
177
|
-
}
|
|
178
|
-
/** 获取纸张物理尺寸(考虑方向) */
|
|
179
|
-
declare function getPaperDimensions(template: TemplateData): {
|
|
180
|
-
width: number;
|
|
181
|
-
height: number;
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
export { type CodeRenderer as C, type MeasuredElement as M, type PageLayout as P, type RenderCell as R, type TemplateData as T, type TemplateElement as a, type CodeRenderOptions as b, PAPER_DIMENSIONS as c, type PageSection as d, type PaperSize as e, type RenderRequest as f, type RenderRow as g, getPaperDimensions as h };
|