@borurio-print/print-designer 1.0.5 → 1.0.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.
- package/dist-lib/PrintDesigner.vue.d.ts +7 -5
- package/dist-lib/core/theme.d.ts +6 -0
- package/dist-lib/core/types.d.ts +37 -6
- package/dist-lib/{index-DvKk7a_X.js → index-xVWXpr2y.js} +5249 -5077
- package/dist-lib/index.d.ts +6 -4
- package/dist-lib/{index.es-BsnJetMo.js → index.es-CdwbXPc1.js} +2 -2
- package/dist-lib/index.js +1 -1
- package/dist-lib/locales/en-US.d.ts +1 -0
- package/dist-lib/locales/zh-CN.d.ts +1 -0
- package/dist-lib/{pdfGenerator-CEaS2amn.js → pdfGenerator-DtOG2_jR.js} +1 -1
- package/dist-lib/style.css +1 -1
- package/dist-lib/views/print-designer/components/ElementPropertiesPanel.vue.d.ts +5 -1
- package/dist-lib/views/print-designer/components/SvgElementsRenderer.vue.d.ts +3 -0
- package/dist-lib/views/print-designer/components/TemplateCanvas.vue.d.ts +2 -2
- package/dist-lib/views/print-designer/components/WorkspaceToolbar.vue.d.ts +0 -1
- package/package.json +2 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import type { BusinessFieldGroup, PrintResult, PrintTemplate } from '@/core/types';
|
|
1
|
+
import type { BusinessFieldGroup, PrintRequest, PrintResult, PrintTemplate, PrintDesignerTheme } from '@/core/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
3
|
/**
|
|
4
4
|
* 由业务系统提供的可打印字段目录。
|
|
5
5
|
* 设计器只保存字段路径和用户最终选择的展示类型,不感知 WMS、OMS 业务含义。
|
|
6
6
|
*/
|
|
7
7
|
fieldGroups?: readonly BusinessFieldGroup[];
|
|
8
|
+
/** 当前设计器实例使用的主色主题。 */
|
|
9
|
+
theme?: PrintDesignerTheme;
|
|
8
10
|
};
|
|
9
11
|
declare function getTemplate(): PrintTemplate;
|
|
10
12
|
declare function loadTemplate(template: PrintTemplate): void;
|
|
11
|
-
/**
|
|
12
|
-
declare function generatePdf(
|
|
13
|
-
/**
|
|
14
|
-
declare function previewPdf(
|
|
13
|
+
/** 供业务系统生成 PDF,结果统一通过 print-result 事件通知。 */
|
|
14
|
+
declare function generatePdf(request: PrintRequest): Promise<void>;
|
|
15
|
+
/** 供业务系统打开 PDF 预览,结果统一通过 print-result 事件通知。 */
|
|
16
|
+
declare function previewPdf(request: PrintRequest): Promise<void>;
|
|
15
17
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
16
18
|
getTemplate: typeof getTemplate;
|
|
17
19
|
loadTemplate: typeof loadTemplate;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ComputedRef, type CSSProperties, type InjectionKey } from 'vue';
|
|
2
|
+
import type { PrintDesignerTheme } from './types';
|
|
3
|
+
export type PrintDesignerThemeStyle = CSSProperties & Record<`--bpd-${string}`, string>;
|
|
4
|
+
export declare const printDesignerThemeStyleKey: InjectionKey<ComputedRef<PrintDesignerThemeStyle>>;
|
|
5
|
+
export declare function createPrintDesignerThemeStyle(theme?: PrintDesignerTheme): PrintDesignerThemeStyle;
|
|
6
|
+
export declare function usePrintDesignerThemeStyle(): ComputedRef<PrintDesignerThemeStyle>;
|
package/dist-lib/core/types.d.ts
CHANGED
|
@@ -36,13 +36,25 @@ export interface PrintRenderPage {
|
|
|
36
36
|
data?: Record<string, unknown>;
|
|
37
37
|
tableData: Record<string, TableRuntimeData>;
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
39
|
+
/** 业务系统发起一次 PDF 生成或预览的请求。 */
|
|
40
|
+
export interface PrintRequest<T = unknown> {
|
|
41
|
+
/** 由调用方生成,用于将异步结果与请求一一对应。 */
|
|
42
|
+
requestId: string;
|
|
43
|
+
data: T;
|
|
44
|
+
/** 只有显式需要获取 PDF 文件时才设置为 true。 */
|
|
45
|
+
returnBlob?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** 设计器完成 PDF 生成或预览后通过 print-result 通知的结果。 */
|
|
40
48
|
export interface PrintResult {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
requestId: string;
|
|
50
|
+
result: 'success' | 'failed';
|
|
51
|
+
/** 成功固定为 ok,失败时为可展示的错误信息。 */
|
|
52
|
+
message: string;
|
|
53
|
+
data?: {
|
|
54
|
+
pageCount: number;
|
|
55
|
+
/** 只在请求中指定 returnBlob: true 时返回。 */
|
|
56
|
+
blob?: Blob;
|
|
57
|
+
};
|
|
46
58
|
}
|
|
47
59
|
/** 业务字段目前允许在标签中使用的三种展示方式。 */
|
|
48
60
|
export type FieldElementType = 'text' | 'textBox' | 'qrcode' | 'barcode';
|
|
@@ -62,6 +74,17 @@ export interface BusinessFieldGroup {
|
|
|
62
74
|
label: string;
|
|
63
75
|
fields: readonly BusinessField[];
|
|
64
76
|
}
|
|
77
|
+
/** 业务系统可为每个设计器实例单独配置的主色主题。 */
|
|
78
|
+
export interface PrintDesignerTheme {
|
|
79
|
+
/** 主色;未传入衍生色时,设计器会自动生成对应的明暗色阶。 */
|
|
80
|
+
primaryColor?: string;
|
|
81
|
+
primaryLight3?: string;
|
|
82
|
+
primaryLight5?: string;
|
|
83
|
+
primaryLight7?: string;
|
|
84
|
+
primaryLight8?: string;
|
|
85
|
+
primaryLight9?: string;
|
|
86
|
+
primaryDark2?: string;
|
|
87
|
+
}
|
|
65
88
|
/**
|
|
66
89
|
* 设计器支持的组件类型。
|
|
67
90
|
*
|
|
@@ -84,6 +107,10 @@ export interface ElementPropertyConfig {
|
|
|
84
107
|
/** 属性是否适用于元素当前状态,例如固定时间只在“固定”模式下展示。 */
|
|
85
108
|
visibleWhen?: (element: DesignerElement) => boolean;
|
|
86
109
|
}
|
|
110
|
+
/** 元素相对标签画布持续生效的水平对齐规则。 */
|
|
111
|
+
export type CanvasHorizontalAlign = 'left' | 'center' | 'right';
|
|
112
|
+
/** 元素相对标签画布持续生效的垂直对齐规则。 */
|
|
113
|
+
export type CanvasVerticalAlign = 'top' | 'center' | 'bottom';
|
|
87
114
|
/**
|
|
88
115
|
* 所有可编辑元素共用的布局数据。
|
|
89
116
|
* 坐标和尺寸统一使用毫米,rotation 统一使用角度,避免保存屏幕像素后
|
|
@@ -98,6 +125,10 @@ export interface BaseDesignerElement {
|
|
|
98
125
|
heightMm: number;
|
|
99
126
|
rotation: number;
|
|
100
127
|
zIndex: number;
|
|
128
|
+
/** 缺少时沿用模板保存的 xMm,不做运行时重排。 */
|
|
129
|
+
canvasHorizontalAlign?: CanvasHorizontalAlign;
|
|
130
|
+
/** 缺少时沿用模板保存的 yMm,不做运行时重排。 */
|
|
131
|
+
canvasVerticalAlign?: CanvasVerticalAlign;
|
|
101
132
|
}
|
|
102
133
|
/** 普通文字元素独有的排版属性。 */
|
|
103
134
|
export interface TextDesignerElement extends BaseDesignerElement {
|