@shaonq/hiprint 0.2.0 → 0.2.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/dist/index.d.ts +38 -12
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ interface HiprintInitOptions extends Record<string, any> {
|
|
|
113
113
|
fontSize?: number; // 默认字体大小
|
|
114
114
|
debug?: boolean; // 是否启用调试模式
|
|
115
115
|
fields?: FieldOption[]; // 自定义字段源(下拉框选项)
|
|
116
|
-
orient?:
|
|
116
|
+
orient?: 'portrait' | 'landscape'; // 纸张方向,默认 'portrait'
|
|
117
117
|
watermarkOptions?: WatermarkOptions; // 水印配置
|
|
118
118
|
paperList?: PaperData[]; // 自定义纸张配置列表
|
|
119
119
|
providers: Record<string, any>[];
|
|
@@ -249,7 +249,7 @@ export declare class PrintTemplate {
|
|
|
249
249
|
* 获取当前纸张方向。
|
|
250
250
|
* @returns 'portrait' 或 'landscape'。
|
|
251
251
|
*/
|
|
252
|
-
getOrient():
|
|
252
|
+
getOrient(): 'portrait' | 'landscape';
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
255
|
* 缩放视图(如 1.5 表示 150%)。
|
|
@@ -310,7 +310,7 @@ export declare class PrintTemplate {
|
|
|
310
310
|
* 对齐多个选中元素。
|
|
311
311
|
* @param align 对齐方式(left/center/right/top/middle/bottom)。
|
|
312
312
|
*/
|
|
313
|
-
setElsAlign(align:
|
|
313
|
+
setElsAlign(align: 'left' | 'vertical' | 'right' | 'top' | 'horizontal' | 'bottom' | 'distributeHor' | 'distributeVer'): void;
|
|
314
314
|
|
|
315
315
|
/**
|
|
316
316
|
* 设置多个选中元素之间的间距(像素)。
|
|
@@ -422,30 +422,56 @@ interface PrintTemplateHistoryItem {
|
|
|
422
422
|
data: any; // 历史状态数据
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
|
|
425
|
+
type Print2Options = {
|
|
426
|
+
/**
|
|
427
|
+
* 左上角偏移量
|
|
428
|
+
* @default 0
|
|
429
|
+
*/
|
|
430
|
+
leftOffset?: number;
|
|
431
|
+
/**
|
|
432
|
+
* 上边偏移量
|
|
433
|
+
* @default 0
|
|
434
|
+
*/
|
|
435
|
+
topOffset?: number;
|
|
436
|
+
/**
|
|
437
|
+
* 是否在偶数页对称显示页码(适应双面打印要求页码位置一致)
|
|
438
|
+
* @default false
|
|
439
|
+
*/
|
|
440
|
+
paperNumberToggleInEven?: boolean;
|
|
441
|
+
/**
|
|
442
|
+
* 指定打印机名称
|
|
443
|
+
*/
|
|
444
|
+
printer?: string;
|
|
445
|
+
/**
|
|
446
|
+
* 文件名称
|
|
447
|
+
*/
|
|
448
|
+
title?: string;
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
/**
|
|
426
452
|
* 使用 hiprint 打印多个模板
|
|
427
453
|
* @param {Array} res - 打印数据数组,每个元素包含模板和数据
|
|
428
454
|
* @param {Object} [res[].template] - 可选的 JSON 字符串模板,如果不存在则使用默认模板
|
|
429
|
-
* @param {Object} res[].data - 打印数据
|
|
430
|
-
* @param {boolean} [
|
|
455
|
+
* @param {Object} res[].data - 打印数据
|
|
456
|
+
* @param {boolean|Print2Options} [isPrint2=false] - 是否委托直接打印或打印选项,默认为 false
|
|
431
457
|
* @returns {void}
|
|
432
458
|
*/
|
|
433
|
-
export function hiprintPrintMulti(res: { template?: string; data
|
|
459
|
+
export function hiprintPrintMulti(res: { template?: string; data: Obj }[], isPrint2?: boolean | Print2Options): void;
|
|
434
460
|
|
|
435
|
-
|
|
461
|
+
/**
|
|
436
462
|
* 使用 hiprint 打印模板
|
|
437
463
|
* @param {Object} res - 打印数据对象,包含模板和数据
|
|
438
464
|
* @param {string} res.template - JSON 字符串模板
|
|
439
465
|
* @param {Object} res.data - 打印数据
|
|
440
|
-
* @param {boolean} [isPrint=true] - 是否直接打印,默认为 true
|
|
441
|
-
* @param {boolean} [
|
|
466
|
+
* @param {boolean} [isPrint=true] - 是否直接打印,默认为 true,为 false 返回html内容
|
|
467
|
+
* @param {boolean|Print2Options} [isPrint2=false] - 是否委托直接打印或打印选项,默认为 false
|
|
442
468
|
* @returns {string|undefined} 如果 isPrint 为 false,则返回 HTML 字符串,否则返回 undefined
|
|
443
469
|
*/
|
|
444
|
-
export function hiprintPrint(res: { template
|
|
470
|
+
export function hiprintPrint(res: { template: string; data: Obj }, isPrint?: boolean, isPrint2?: boolean | Print2Options): string | void;
|
|
445
471
|
|
|
446
472
|
export interface Hinnn {
|
|
447
473
|
paperList: {
|
|
448
|
-
[K in
|
|
474
|
+
[K in 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'A7' | 'A8' | 'B1' | 'B2' | 'B3' | 'B4' | 'B5' | 'B6' | 'B7' | 'B8']: { width: number; height: number };
|
|
449
475
|
};
|
|
450
476
|
event: {
|
|
451
477
|
on(eventName: string, callback: (...args: any[]) => void): void;
|