yh-hiprint 2.5.3 → 3.0.0
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/HiprintDesigner.vue +21 -197
- package/config.json +399 -0
- package/doc.md +265 -0
- package/hooks/useHipirntCanvas.ts +3 -0
- package/hooks/{useHiprint.js → useHiprint.ts} +92 -41
- package/{index.js → index.ts} +67 -21
- package/libs/hiprint.bundle.js +1 -2
- package/libs/previewHiprint.ts +55 -0
- package/package.json +3 -13
- package/store/defaultPrintElement.ts +152 -0
- package/store/useHiprintStore.ts +75 -0
- package/types.ts +756 -0
- package/index.d.ts +0 -377
package/index.d.ts
DELETED
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
declare module 'yh-hiprint';
|
|
2
|
-
|
|
3
|
-
/** JQuery 简化dom操作的库 */
|
|
4
|
-
export declare const jquery: JQuery;
|
|
5
|
-
|
|
6
|
-
/** hiprint 字体大小配置 */
|
|
7
|
-
export declare const fontSize;
|
|
8
|
-
/** hiprint 缩放配置 */
|
|
9
|
-
export declare const scale;
|
|
10
|
-
/** hiprint 层级配置 */
|
|
11
|
-
export declare const zIndex;
|
|
12
|
-
/** hiprint 侧边栏配置 */
|
|
13
|
-
export declare const panel;
|
|
14
|
-
|
|
15
|
-
export declare const defaultElementTypeProvider: (options: any) => {
|
|
16
|
-
addElementTypes: (context) => void;
|
|
17
|
-
};
|
|
18
|
-
export declare const print;
|
|
19
|
-
export declare const print2;
|
|
20
|
-
export declare const usePaper;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 打印组件的缩放
|
|
24
|
-
* @param callback 每次缩放后都会执行的回调函数
|
|
25
|
-
*/
|
|
26
|
-
export declare const useScale: (callback: () => void) => {
|
|
27
|
-
/** 当前缩放值 */
|
|
28
|
-
scaleValue: Ref<number>;
|
|
29
|
-
/** 当前百分比展示字符串 */
|
|
30
|
-
scalePercentage: ComputedRef<string>;
|
|
31
|
-
/** 当前是否能缩小 */
|
|
32
|
-
canZoomIn: ComputedRef<boolean>;
|
|
33
|
-
/** 当前是否能放大 */
|
|
34
|
-
canZoomOut: ComputedRef<boolean>;
|
|
35
|
-
/** 缩小 */
|
|
36
|
-
zoomIn: () => void;
|
|
37
|
-
/** 放大 */
|
|
38
|
-
zoomOut: () => void;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 打印组件数据源
|
|
43
|
-
* @param axios 系统中的请求实体 `src/libs/api.request.js`
|
|
44
|
-
*/
|
|
45
|
-
export declare const useDataSource: (axios) => {
|
|
46
|
-
detailData: Ref<any>;
|
|
47
|
-
getDetail: (id) => void;
|
|
48
|
-
listCode: Ref<any[]>;
|
|
49
|
-
dataSourceList: Ref<any[]>;
|
|
50
|
-
listColumns: ComputedRef<string[]>;
|
|
51
|
-
formCode: Ref<any[]>;
|
|
52
|
-
formColumns: ComputedRef<string[]>;
|
|
53
|
-
dataSourceForm: Ref<any[]>;
|
|
54
|
-
codeMapDataSource: Ref<any>;
|
|
55
|
-
getDataSourceList: () => void;
|
|
56
|
-
dataSource: Ref<string[]>;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export declare interface HiprintOption {
|
|
60
|
-
code: string;
|
|
61
|
-
params: Object;
|
|
62
|
-
data: Record<string, any> | Record<string, any>[];
|
|
63
|
-
isCustom: boolean;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
//#region Hiprint 类型文件
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
/** 打印元素唯一标识 */
|
|
70
|
-
type Tid = string;
|
|
71
|
-
|
|
72
|
-
export interface Field {
|
|
73
|
-
field: string;
|
|
74
|
-
text: string;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface TextPrintElementType {
|
|
78
|
-
printElementType: {
|
|
79
|
-
tid: Tid;
|
|
80
|
-
title: string;
|
|
81
|
-
field: string;
|
|
82
|
-
data: string;
|
|
83
|
-
formatter: (title,value,options,templateData,target) => string;
|
|
84
|
-
styler: (value,options,target,templateData,) => CSSStyleDeclaration;
|
|
85
|
-
onRendered: (target,options,paperTarget) => void;
|
|
86
|
-
fields: Field[],
|
|
87
|
-
},
|
|
88
|
-
options: {
|
|
89
|
-
/**
|
|
90
|
-
* 标题
|
|
91
|
-
* field 存在则
|
|
92
|
-
*/
|
|
93
|
-
title: string;
|
|
94
|
-
/** 字段名称,从数据源获取数据的属性名称 */
|
|
95
|
-
field: string;
|
|
96
|
-
/** 测试数据 设计时使用 */
|
|
97
|
-
testData: string;
|
|
98
|
-
/** 字体名称 */
|
|
99
|
-
fontFamily: string;
|
|
100
|
-
/** 字体大小 */
|
|
101
|
-
fontSize: string;
|
|
102
|
-
/** 字体粗细 */
|
|
103
|
-
fontWeight: string;
|
|
104
|
-
/** 字体间距 */
|
|
105
|
-
letterSpacing: number;
|
|
106
|
-
/** 字体颜色 */
|
|
107
|
-
color: string;
|
|
108
|
-
/** 文本描述 */
|
|
109
|
-
textDecoration: string;
|
|
110
|
-
/** 文字水平对齐 */
|
|
111
|
-
textAlign: 'left'|'center'|'right';
|
|
112
|
-
/** 行高 数字带单位 例如 18pt */
|
|
113
|
-
lineHeight: string;
|
|
114
|
-
/**
|
|
115
|
-
* 文本类型
|
|
116
|
-
* text - 纯文本
|
|
117
|
-
* barcode - 条形码
|
|
118
|
-
* qrcode - 二维码
|
|
119
|
-
*/
|
|
120
|
-
textType: 'text' | 'barcode' | 'qrcode';
|
|
121
|
-
/** 条形码格式 */
|
|
122
|
-
barcodeMode: string;
|
|
123
|
-
/** 因此标题 */
|
|
124
|
-
hideTitle: boolean;
|
|
125
|
-
/**
|
|
126
|
-
* 页眉/页脚/固定定位等元素显示规则
|
|
127
|
-
* first - 首页显示
|
|
128
|
-
* odd - 奇数页显示
|
|
129
|
-
*/
|
|
130
|
-
showInPage: 'first' | 'odd' | 'even' | 'last';
|
|
131
|
-
/** 固定定位 */
|
|
132
|
-
fixed: boolean;
|
|
133
|
-
/** 打印设计时拖拽方向 */
|
|
134
|
-
axis: 'v' | 'h';
|
|
135
|
-
/** 旋转角度 */
|
|
136
|
-
transform: number;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface ImagePrintElementType {
|
|
141
|
-
printElementType: {
|
|
142
|
-
tid: string;
|
|
143
|
-
field: string;
|
|
144
|
-
data: string;
|
|
145
|
-
formatter: () => void;
|
|
146
|
-
styler: () => void;
|
|
147
|
-
onRendered: () => void;
|
|
148
|
-
fields: Field[];
|
|
149
|
-
},
|
|
150
|
-
options: {
|
|
151
|
-
title: string;
|
|
152
|
-
field: string;
|
|
153
|
-
src: string;
|
|
154
|
-
showInPage: string;
|
|
155
|
-
fixed: boolean;
|
|
156
|
-
axis: string;
|
|
157
|
-
transform: number;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export interface HlinePrintElementType {
|
|
162
|
-
printElementType: {
|
|
163
|
-
tid: string;
|
|
164
|
-
onRendered: () => void;
|
|
165
|
-
},
|
|
166
|
-
options: {
|
|
167
|
-
borderColor: string;
|
|
168
|
-
borderWidth: string;
|
|
169
|
-
showInPage: string;
|
|
170
|
-
fixed: boolean;
|
|
171
|
-
axis: string;
|
|
172
|
-
transform: number;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
export interface VlinePrintElementType {
|
|
176
|
-
printElementType: {
|
|
177
|
-
tid: string;
|
|
178
|
-
onRendered: () => void;
|
|
179
|
-
},
|
|
180
|
-
options: {
|
|
181
|
-
borderColor: string;
|
|
182
|
-
borderWidth: string;
|
|
183
|
-
showInPage: string;
|
|
184
|
-
fixed: boolean;
|
|
185
|
-
axis: string;
|
|
186
|
-
transform: number;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
export interface RectPrintElementType {
|
|
190
|
-
printElementType: {
|
|
191
|
-
tid: string;
|
|
192
|
-
onRendered: () => void;
|
|
193
|
-
},
|
|
194
|
-
options: {
|
|
195
|
-
borderColor: string;
|
|
196
|
-
borderWidth: string;
|
|
197
|
-
showInPage: string;
|
|
198
|
-
fixed: boolean;
|
|
199
|
-
axis: string;
|
|
200
|
-
transform: number;
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
export interface OvalPrintElementType {
|
|
204
|
-
printElementType: {
|
|
205
|
-
tid: string;
|
|
206
|
-
onRendered: () => void;
|
|
207
|
-
},
|
|
208
|
-
options: {
|
|
209
|
-
borderColor: string;
|
|
210
|
-
borderWidth: string;
|
|
211
|
-
showInPage: string;
|
|
212
|
-
fixed: boolean;
|
|
213
|
-
axis: string;
|
|
214
|
-
transform: number;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
export interface HlinePrintElementType {
|
|
218
|
-
printElementType: {
|
|
219
|
-
tid: string;
|
|
220
|
-
onRendered: () => void;
|
|
221
|
-
},
|
|
222
|
-
options: {
|
|
223
|
-
borderColor: string;
|
|
224
|
-
borderWidth: string;
|
|
225
|
-
showInPage: string;
|
|
226
|
-
fixed: boolean;
|
|
227
|
-
axis: string;
|
|
228
|
-
transform: number;
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
export interface TableColumn {
|
|
233
|
-
width: number;
|
|
234
|
-
title: string;
|
|
235
|
-
field: string;
|
|
236
|
-
fixed: boolean;
|
|
237
|
-
rowspan: number;
|
|
238
|
-
colspan: number;
|
|
239
|
-
align: string;
|
|
240
|
-
halign: string;
|
|
241
|
-
formater: () => void;
|
|
242
|
-
styler: () => void;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
export interface TablePrintElementType {
|
|
246
|
-
printElementType: {
|
|
247
|
-
tid: string;
|
|
248
|
-
title: string;
|
|
249
|
-
field: string;
|
|
250
|
-
columns: TableColumn[]
|
|
251
|
-
styler: () => void;
|
|
252
|
-
rowStyler: () => void;
|
|
253
|
-
formatter: () => void;
|
|
254
|
-
groupFields: any[];
|
|
255
|
-
groupFormatter: () => void;
|
|
256
|
-
fotterFormatter: () => void;
|
|
257
|
-
gridColumnsFooterFormatter: () => void;
|
|
258
|
-
groupFooterFormatter: () => void;
|
|
259
|
-
onRendered: () => void;
|
|
260
|
-
fields: Field[];
|
|
261
|
-
},
|
|
262
|
-
options: {
|
|
263
|
-
field: string;
|
|
264
|
-
fontFamily: string;
|
|
265
|
-
fontSize: number;
|
|
266
|
-
lineHeight: number;
|
|
267
|
-
textAlign: 'left'|'center'|'right';
|
|
268
|
-
tableBorder: 'noBorder' | 'border';
|
|
269
|
-
tableHeaderBorder: 'noBorder'|'border'|'topBorder'|'bottomBorder'|'topBottomBorder';
|
|
270
|
-
tableHeaderCellBorder: 'noBorder'|'border';
|
|
271
|
-
tableHeaderRowHeight: number;
|
|
272
|
-
tableHeaderBackground: string;
|
|
273
|
-
tableHeaderFontSize: number;
|
|
274
|
-
tableHeaderFontWeight: string;
|
|
275
|
-
tableBodyCellBorder: string;
|
|
276
|
-
tableBodyRowBorder: string;
|
|
277
|
-
tableBodyRowHeight: number;
|
|
278
|
-
axis: 'v' | 'h';
|
|
279
|
-
lHeight: number;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
export interface LongTextPrintElementType {
|
|
283
|
-
printElementType: {
|
|
284
|
-
tid: string;
|
|
285
|
-
title: string;
|
|
286
|
-
field: string;
|
|
287
|
-
data: string;
|
|
288
|
-
formatter: () => void;
|
|
289
|
-
styler: () => void;
|
|
290
|
-
onRendered: () => void;
|
|
291
|
-
fields: Field[];
|
|
292
|
-
},
|
|
293
|
-
options: {
|
|
294
|
-
title: string;
|
|
295
|
-
field: string;
|
|
296
|
-
testData: string;
|
|
297
|
-
fontFamily: string;
|
|
298
|
-
fontSize: number;
|
|
299
|
-
fontWeight: string;
|
|
300
|
-
letterSpacing: number;
|
|
301
|
-
color: string;
|
|
302
|
-
textDecoration: string;
|
|
303
|
-
textAlign: string;
|
|
304
|
-
lineHeight: number;
|
|
305
|
-
hideTitle: boolean;
|
|
306
|
-
longTextIndent: number;
|
|
307
|
-
showInPage: string;
|
|
308
|
-
fixed: boolean;
|
|
309
|
-
leftSpaceRemoved: boolean;
|
|
310
|
-
axis: string;
|
|
311
|
-
lHeight: number;
|
|
312
|
-
transform: number;
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
export interface HTMLPrintElementType {
|
|
316
|
-
printElementType: {
|
|
317
|
-
tid: string;
|
|
318
|
-
title: string;
|
|
319
|
-
field: string;
|
|
320
|
-
data: string;
|
|
321
|
-
formatter: () => void;
|
|
322
|
-
styler: () => void;
|
|
323
|
-
onRendered: () => void;
|
|
324
|
-
},
|
|
325
|
-
options: {
|
|
326
|
-
title: string;
|
|
327
|
-
field: string;
|
|
328
|
-
testData: string;
|
|
329
|
-
fontFamily: string;
|
|
330
|
-
showInPage: string;
|
|
331
|
-
fixed: boolean;
|
|
332
|
-
axis: string;
|
|
333
|
-
transform: number;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/** Hiprint 打印面板对象 */
|
|
338
|
-
export interface PrintPanel {
|
|
339
|
-
addPrintText: (options?) => void;
|
|
340
|
-
addPrintLongText: () => void;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
/** Hprint 打印面板创建配置对象 */
|
|
344
|
-
export interface PrintPanelOptions {
|
|
345
|
-
/** 宽度 */
|
|
346
|
-
width: number;
|
|
347
|
-
/** 高度 */
|
|
348
|
-
height: number;
|
|
349
|
-
/** 页脚高度 */
|
|
350
|
-
paperFotter: number;
|
|
351
|
-
/** 页眉高度 */
|
|
352
|
-
paperHeader: number;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
export interface PrintTemplateData {
|
|
356
|
-
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
export interface PrintTemplateOptions {
|
|
360
|
-
template: PrintTemplateData
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
export interface PrintTemplate {
|
|
364
|
-
addPrintPanel:(options:PrintPanelOptions) => void;
|
|
365
|
-
design: () => void;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
export declare const hiprint = {
|
|
369
|
-
/** 初始化 Hiprint */
|
|
370
|
-
init:() => viod,
|
|
371
|
-
/** 创建打印模板对象 */
|
|
372
|
-
PrintTemplate: {
|
|
373
|
-
new (options: PrintTemplateOptions): PrintTemplate;
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
//#endregion
|