@borurio-print/print-designer 1.0.13 → 1.0.14

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.
@@ -5,6 +5,8 @@ export interface DynamicTextContext {
5
5
  index: number;
6
6
  /** 本次打印数据数组的总长度。 */
7
7
  total: number;
8
+ /** 当前打印页对应的业务记录。 */
9
+ data?: Record<string, unknown>;
8
10
  /** 整个打印批次共用的时间,避免多页之间出现秒数差异。 */
9
11
  printTime: Date;
10
12
  }
@@ -56,8 +56,8 @@ export interface PrintResult {
56
56
  blob?: Blob;
57
57
  };
58
58
  }
59
- /** 业务字段目前允许在标签中使用的三种展示方式。 */
60
- export type FieldElementType = 'text' | 'textBox' | 'qrcode' | 'barcode';
59
+ /** 业务字段允许在标签中使用的初始展示方式。 */
60
+ export type FieldElementType = 'text' | 'textBox' | 'qrcode' | 'barcode' | 'pageNumber';
61
61
  /**
62
62
  * 由业务系统传给设计器的字段定义。
63
63
  *
@@ -68,6 +68,10 @@ export interface BusinessField {
68
68
  field: string;
69
69
  label: string;
70
70
  type: FieldElementType;
71
+ /** 页码字段未单独指定当前页路径时,默认使用 field。 */
72
+ currentPageField?: string;
73
+ /** type 为 pageNumber 时,从当前业务记录读取总页数的字段路径。 */
74
+ totalPageField?: string;
71
75
  }
72
76
  /** 左侧字段列表的分组;不同业务系统可以传入完全不同的分组和字段。 */
73
77
  export interface BusinessFieldGroup {
@@ -93,7 +97,7 @@ export interface PrintDesignerTheme {
93
97
  */
94
98
  export type DesignerElementType = 'text' | 'textBox' | 'rectangle' | 'horizontalLine' | 'verticalLine' | 'qrcode' | 'barcode' | 'image' | 'serialNumber' | 'pageNumber' | 'time' | 'table' | 'pdf';
95
99
  /** 右侧属性面板中可独立组合的属性编辑器标识。 */
96
- export type ElementPropertyKey = 'displayType' | 'content' | 'textHorizontalAlign' | 'textVerticalAlign' | 'textBoxFitMode' | 'textBoxOverflowMode' | 'lineHeight' | 'minFontSize' | 'imageSource' | 'x' | 'y' | 'width' | 'height' | 'fontSize' | 'fontWeight' | 'strokeWidth' | 'rotation' | 'timeMode' | 'includeTime' | 'fixedTime' | 'tableConfig' | 'pdfSource' | 'pdfCropMode' | 'pdfCropRatio';
100
+ export type ElementPropertyKey = 'displayType' | 'content' | 'textHorizontalAlign' | 'textVerticalAlign' | 'textBoxFitMode' | 'textBoxOverflowMode' | 'lineHeight' | 'minFontSize' | 'imageSource' | 'x' | 'y' | 'width' | 'height' | 'fontSize' | 'fontWeight' | 'strokeWidth' | 'rotation' | 'timeMode' | 'includeTime' | 'fixedTime' | 'pageNumberConfig' | 'tableConfig' | 'pdfSource' | 'pdfCropMode' | 'pdfCropRatio';
97
101
  /**
98
102
  * 单个属性编辑器的能力与数值约束。
99
103
  * 数值范围跟随组件类型配置,输入框和 SVG 控制点共用,避免两处规则不一致。
@@ -149,9 +153,21 @@ export interface DynamicTextBaseDesignerElement extends BaseDesignerElement {
149
153
  export interface SerialNumberDesignerElement extends DynamicTextBaseDesignerElement {
150
154
  type: 'serialNumber';
151
155
  }
152
- /** 页码在打印阶段根据数组下标和总长度生成“当前页/总页数”。 */
156
+ /** 页码既可使用整个打印任务的全局页码,也可从当前业务记录读取。 */
157
+ export type PageNumberMode = 'global' | 'field';
158
+ export interface PageNumberConfigValue {
159
+ mode: PageNumberMode;
160
+ currentField: string;
161
+ totalField: string;
162
+ }
153
163
  export interface PageNumberDesignerElement extends DynamicTextBaseDesignerElement {
154
164
  type: 'pageNumber';
165
+ /** 旧模板缺少时按全局页码处理。 */
166
+ pageNumberMode?: PageNumberMode;
167
+ /** 字段模式下,从当前业务记录读取当前页。支持点路径。 */
168
+ currentPageField?: string;
169
+ /** 字段模式下,从当前业务记录读取总页数。支持点路径。 */
170
+ totalPageField?: string;
155
171
  }
156
172
  export type TimeMode = 'realtime' | 'fixed';
157
173
  /** 时间可在打印时实时生成,也可保存用户选择的固定日期时间。 */
@@ -328,7 +344,7 @@ export interface ElementClipboardItem {
328
344
  element: DesignerElement;
329
345
  }
330
346
  /** 独立属性编辑器使用的统一值类型。 */
331
- export type ElementPropertyValue = string | number | boolean | TableConfigValue;
347
+ export type ElementPropertyValue = string | number | boolean | PageNumberConfigValue | TableConfigValue;
332
348
  /** SVG 选区八个缩放控制点的稳定标识。 */
333
349
  export type ResizeHandle = 'topLeft' | 'top' | 'topRight' | 'right' | 'bottomRight' | 'bottom' | 'bottomLeft' | 'left';
334
350
  /**