yh-hiprint 2.6.13 → 2.6.15

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/config.json ADDED
@@ -0,0 +1,399 @@
1
+ {
2
+ "panels": [
3
+ {
4
+ "index": 0,
5
+ "name": 1,
6
+ "height": 297,
7
+ "width": 210,
8
+ "paperHeader": 7.5,
9
+ "paperFooter": 780,
10
+ "printElements": [
11
+ {
12
+ "options": {
13
+ "left": 20,
14
+ "top": 20,
15
+ "height": 9.75,
16
+ "width": 120,
17
+ "transform": 12,
18
+ "title": "文本",
19
+ "right": 139.9921875,
20
+ "bottom": 29.7421875,
21
+ "vCenter": 79.9921875,
22
+ "hCenter": 24.8671875,
23
+ "field": "1212",
24
+ "testData": "1212",
25
+ "coordinateSync": false,
26
+ "widthHeightSync": false,
27
+ "dataType": "datetime",
28
+ "format": "M/d",
29
+ "fontFamily": "Microsoft YaHei",
30
+ "fontSize": 4,
31
+ "fontWeight": "lighter",
32
+ "letterSpacing": 0.75,
33
+ "color": "#915c5c",
34
+ "backgroundColor": "#9e7272",
35
+ "textDecoration": "underline",
36
+ "textAlign": "center",
37
+ "textContentVerticalAlign": "middle",
38
+ "textContentWrap": "nowrap",
39
+ "lineHeight": 11.25,
40
+ "scale": 1,
41
+ "zIndex": 2,
42
+ "borderLeft": "solid",
43
+ "borderTop": "solid",
44
+ "borderRight": "solid",
45
+ "borderBottom": "solid",
46
+ "borderWidth": "0.75",
47
+ "borderColor": "#8f7b7b",
48
+ "contentPaddingLeft": 0.75,
49
+ "contentPaddingTop": 0.75,
50
+ "contentPaddingRight": 0.75,
51
+ "contentPaddingBottom": 0.75,
52
+ "barcodeMode": "CODE128A",
53
+ "qrCodeLevel": 1,
54
+ "pageBreak": true,
55
+ "showInPage": "first",
56
+ "unShowInPage": "first",
57
+ "axis": "h",
58
+ "upperCase": "0",
59
+ "formatter": "function(title,value,options.templateData.target){}\n",
60
+ "styler": "function(value,options.target.templateData){}"
61
+ },
62
+ "printElementType": {
63
+ "title": "文本",
64
+ "type": "text"
65
+ }
66
+ },
67
+ {
68
+ "options": {
69
+ "left": 20,
70
+ "top": 52.5,
71
+ "height": 9.75,
72
+ "width": 120,
73
+ "hideTitle": true,
74
+ "title": "值(文本)",
75
+ "right": 142.5,
76
+ "bottom": 63,
77
+ "vCenter": 82.5,
78
+ "hCenter": 58.125
79
+ },
80
+ "printElementType": {
81
+ "title": "值(文本)",
82
+ "type": "text"
83
+ }
84
+ },
85
+ {
86
+ "options": {
87
+ "left": 22.5,
88
+ "top": 85,
89
+ "height": 79.5,
90
+ "width": 61.5,
91
+ "right": 85.2421875,
92
+ "bottom": 165.24609375,
93
+ "vCenter": 54.4921875,
94
+ "hCenter": 125.49609375
95
+ },
96
+ "printElementType": {
97
+ "title": "图片",
98
+ "type": "image"
99
+ }
100
+ },
101
+ {
102
+ "options": {
103
+ "left": 22.5,
104
+ "top": 190,
105
+ "height": 42,
106
+ "width": 550,
107
+ "title": "长文"
108
+ },
109
+ "printElementType": {
110
+ "title": "长文",
111
+ "type": "longText"
112
+ }
113
+ },
114
+ {
115
+ "options": {
116
+ "left": 22.5,
117
+ "top": 240,
118
+ "height": 39,
119
+ "width": 550,
120
+ "field": "",
121
+ "columns": [
122
+ [
123
+ {
124
+ "width": 275,
125
+ "title": "阿恃多伐底",
126
+ "field": "",
127
+ "checked": true,
128
+ "columnId": "asdf",
129
+ "fixed": false,
130
+ "rowspan": 1,
131
+ "colspan": 1
132
+ },
133
+ {
134
+ "width": 275,
135
+ "title": "啊啊啊啊",
136
+ "field": "",
137
+ "checked": true,
138
+ "columnId": "asdf",
139
+ "fixed": false,
140
+ "rowspan": 1,
141
+ "colspan": 1
142
+ }
143
+ ],
144
+ [
145
+ {
146
+ "width": 257.85949999999997,
147
+ "checked": true,
148
+ "fixed": false,
149
+ "rowspan": 1,
150
+ "colspan": 1
151
+ },
152
+ {
153
+ "width": 292.14050000000003,
154
+ "checked": true,
155
+ "fixed": false,
156
+ "rowspan": 1,
157
+ "colspan": 1
158
+ }
159
+ ]
160
+ ]
161
+ },
162
+ "printElementType": {
163
+ "title": "表格",
164
+ "type": "table",
165
+ "editable": true,
166
+ "columnDisplayEditable": true,
167
+ "columnDisplayIndexEditable": true,
168
+ "columnTitleEditable": true,
169
+ "columnResizable": true,
170
+ "columnAlignEditable": true,
171
+ "isEnableEditField": true,
172
+ "isEnableContextMenu": true,
173
+ "isEnableInsertRow": true,
174
+ "isEnableDeleteRow": true,
175
+ "isEnableInsertColumn": true,
176
+ "isEnableDeleteColumn": true,
177
+ "isEnableMergeCell": true
178
+ }
179
+ },
180
+ {
181
+ "options": {
182
+ "left": 22.5,
183
+ "top": 272.5,
184
+ "height": 4,
185
+ "width": 550,
186
+ "field": "",
187
+ "coordinateSync": false,
188
+ "widthHeightSync": false,
189
+ "columns": [
190
+ [
191
+ {
192
+ "width": 250.82074999999998,
193
+ "title": "啊啊啊啊",
194
+ "checked": true,
195
+ "fixed": false,
196
+ "rowspan": 1,
197
+ "colspan": 1
198
+ },
199
+ {
200
+ "width": 299.17925,
201
+ "title": "啊啊啊啊",
202
+ "checked": true,
203
+ "fixed": false,
204
+ "rowspan": 1,
205
+ "colspan": 1
206
+ }
207
+ ]
208
+ ]
209
+ },
210
+ "printElementType": {
211
+ "title": "空白表格",
212
+ "type": "table",
213
+ "editable": true,
214
+ "columnDisplayEditable": true,
215
+ "columnDisplayIndexEditable": true,
216
+ "columnTitleEditable": true,
217
+ "columnResizable": true,
218
+ "columnAlignEditable": true,
219
+ "isEnableEditField": true,
220
+ "isEnableContextMenu": true,
221
+ "isEnableInsertRow": true,
222
+ "isEnableDeleteRow": true,
223
+ "isEnableInsertColumn": true,
224
+ "isEnableDeleteColumn": true,
225
+ "isEnableMergeCell": true
226
+ }
227
+ },
228
+ {
229
+ "options": {
230
+ "left": 22.5,
231
+ "top": 305,
232
+ "height": 90,
233
+ "width": 90,
234
+ "formatter": "function (data, options) {\n return '<div></div>';\n }",
235
+ "right": 114,
236
+ "bottom": 395.49609375,
237
+ "vCenter": 69,
238
+ "hCenter": 350.49609375
239
+ },
240
+ "printElementType": {
241
+ "title": "html",
242
+ "type": "html"
243
+ }
244
+ },
245
+ {
246
+ "options": {
247
+ "left": 30,
248
+ "top": 417.5,
249
+ "height": 9.75,
250
+ "width": 120,
251
+ "title": "自定义文本",
252
+ "right": 148.9921875,
253
+ "bottom": 426.24609375,
254
+ "vCenter": 88.9921875,
255
+ "hCenter": 421.37109375
256
+ },
257
+ "printElementType": {
258
+ "title": "自定义文本",
259
+ "type": "text"
260
+ }
261
+ },
262
+ {
263
+ "options": {
264
+ "left": 30,
265
+ "top": 462.5,
266
+ "height": 32,
267
+ "width": 120,
268
+ "field": "barcode",
269
+ "testData": "lkforntend",
270
+ "fontSize": 12,
271
+ "lineHeight": 18,
272
+ "textType": "barcode",
273
+ "title": "条形码"
274
+ },
275
+ "printElementType": {
276
+ "title": "条形码",
277
+ "type": "text"
278
+ }
279
+ },
280
+ {
281
+ "options": {
282
+ "left": 40,
283
+ "top": 552.5,
284
+ "height": 50,
285
+ "width": 50,
286
+ "testData": "力控元海-技术中心-前端",
287
+ "field": "qrcode",
288
+ "textType": "qrcode",
289
+ "title": "二维码"
290
+ },
291
+ "printElementType": {
292
+ "title": "二维码",
293
+ "type": "text"
294
+ }
295
+ },
296
+ {
297
+ "options": {
298
+ "left": 40,
299
+ "top": 645,
300
+ "height": 9,
301
+ "width": 90,
302
+ "right": 131.7421875,
303
+ "bottom": 654.4921875,
304
+ "vCenter": 86.7421875,
305
+ "hCenter": 649.9921875,
306
+ "coordinateSync": false,
307
+ "widthHeightSync": false,
308
+ "borderWidth": "2.25",
309
+ "borderStyle": "solid",
310
+ "borderColor": "#000000"
311
+ },
312
+ "printElementType": {
313
+ "title": "横线",
314
+ "type": "hline"
315
+ }
316
+ },
317
+ {
318
+ "options": {
319
+ "left": 215,
320
+ "top": 677.5,
321
+ "height": 90,
322
+ "width": 90,
323
+ "right": 303.99609375,
324
+ "bottom": 766.74609375,
325
+ "vCenter": 258.99609375,
326
+ "hCenter": 721.74609375,
327
+ "coordinateSync": false,
328
+ "widthHeightSync": false,
329
+ "borderWidth": "1.5",
330
+ "borderStyle": "solid",
331
+ "borderColor": "#000000"
332
+ },
333
+ "printElementType": {
334
+ "title": "矩形",
335
+ "type": "rect"
336
+ }
337
+ },
338
+ {
339
+ "options": {
340
+ "left": 122.5,
341
+ "top": 687.5,
342
+ "height": 90,
343
+ "width": 9,
344
+ "coordinateSync": false,
345
+ "widthHeightSync": false,
346
+ "borderWidth": "1.5",
347
+ "borderStyle": "solid",
348
+ "borderColor": "#000000"
349
+ },
350
+ "printElementType": {
351
+ "title": "竖线",
352
+ "type": "vline"
353
+ }
354
+ },
355
+ {
356
+ "options": {
357
+ "left": 382.5,
358
+ "top": 690,
359
+ "height": 90,
360
+ "width": 90,
361
+ "coordinateSync": false,
362
+ "widthHeightSync": false,
363
+ "borderWidth": "0.75",
364
+ "borderStyle": "solid",
365
+ "borderColor": "#000000"
366
+ },
367
+ "printElementType": {
368
+ "title": "椭圆",
369
+ "type": "oval"
370
+ }
371
+ }
372
+ ],
373
+ "paperNumberLeft": 565,
374
+ "paperNumberTop": 45,
375
+ "paperNumberContinue": false,
376
+ "paperNumberFormat": "1",
377
+ "panelPaperRule": "odd",
378
+ "panelPageRule": "none",
379
+ "firstPaperFooter": 1,
380
+ "evenPaperFooter": 1,
381
+ "oddPaperFooter": 1,
382
+ "lastPaperFooter": 1,
383
+ "topOffset": 1,
384
+ "fontFamily": "Microsoft YaHei",
385
+ "leftOffset": 1,
386
+ "orient": 1,
387
+ "watermarkOptions": {
388
+ "content": "阿恃多伐底",
389
+ "rotate": 25,
390
+ "timestamp": true,
391
+ "format": "YYYY-MM-DD HH:mm",
392
+ "fillStyle": "rgba(184, 184, 184, 0.3)",
393
+ "fontSize": "14px",
394
+ "width": 200,
395
+ "height": 200
396
+ }
397
+ }
398
+ ]
399
+ }
package/doc.md ADDED
@@ -0,0 +1,265 @@
1
+ # 面板对象
2
+
3
+ ```js
4
+ var panel = hiprintTemplate.addPrintPanel({ width: 100, height: 130, paperFooter: 340, paperHeader: 10 });
5
+ ```
6
+
7
+ #### options
8
+ | 名称 | 类型 | 描述 |
9
+ | --- | --- | --- |
10
+ | width | number | `毫米` 打印纸质宽度 |
11
+ | height | number | `毫米` 打印纸质高度 |
12
+ | paperHeader | number | `pt磅 1in = 2.54cm = 25.4 mm = 72pt = 6pc` 页眉线(缺省值=0) |
13
+ | paperFooter | number | `pt磅 1in = 2.54cm = 25.4 mm = 72pt = 6pc` 页尾线(缺省值=纸张底部) |
14
+ | paperFooter | number | `pt磅 1in = 2.54cm = 25.4 mm = 72pt = 6pc` 页尾线(缺省值=纸张底部) |
15
+ | paperNumberDisabled | boolean | 禁用页码(缺省值=false) 打印设计 双击页码则切换状态 |
16
+ | paperNumberFormat | string | 页码格式(缺省值paperNo-paperCount) |
17
+ | panelPaperRule | string | 面板打印纸张规则 <br>odd:打印纸张保持奇数 <br>even:打印纸张保持偶数 |
18
+ | firstPaperFooter | number | 首页页尾线位置 |
19
+ | evenPaperFooter | number | 偶数页页尾线位置 |
20
+ | oddPaperFooter | number | 奇数页页尾线位置 |
21
+ | lastPaperFooter | number | 尾页页尾线位置 |
22
+ | leftOffset | number | 打印左偏移量 <br>template.print(data,{leftOffset:-1}) 将覆盖面板的左偏移 <br>template.getHtml(data,{leftOffset:-1}) 将覆盖面板的左偏移 |
23
+ | topOffset | number | 打印顶部偏移量 <br>template.print(data,{topOffset:-1}) 将覆盖面板的顶部偏移 <br>template.getHtml(data,{topOffset:-1}) 将覆盖面板的顶部偏移 |
24
+
25
+ # 文本
26
+ 普通文本分为3种类型:`文本类型`、`条形码类型`、`二维码类型`。
27
+ ```js
28
+ panel.addPrintText({ options: { width: 140, height: 15, top: 20, left: 20, title: 'hiprint插件手动添加text', textAlign: 'center' } });
29
+ ```
30
+
31
+ #### printElementType
32
+ | 名称 | 类型 | 描述 | 默认值 |
33
+ | --- | --- | --- | --- |
34
+ | tid | string | 元素类型的标识 | |
35
+ | title | string | 用户托拽列表中显示的名称 | |
36
+ | field | string | 打印元素类型所对应的数据Josn的Key | |
37
+ | data | string | 打印设置时,显示的默认值 | |
38
+ | formatter | function | 文本元素格式化函数,需要五个参数: <br>title:标题。 <br>value:值。 <br>options:打印元素的选项值。 <br>templateData:模板数据。 <br>target:文本控件dom。 <br>formatter:function(title,value,options,templateData,target){ return value=='1'?'测试':value; } | |
39
+ | styler | function | 文本元素的样式函数,返回样式对象来自定义该 文本元素的样式,例如 {'background':'red'} 。该函数需要四个参数: <br>value:字段的值。 <br>options:打印元素的选项值。 <br>target:文本控件dom。 <br>templateData:模板数据。 <br>styler:function(value,options,target,templateData){ return {color:'red'} } | |
40
+ | onRendered | function | 元素渲染完成事件,该函数需要三个参数: <br>target:元素jq dom。 <br>options:打印元素的选项值。 <br>paperTarget:打印所在纸张的ja dom | |
41
+ | fields | 数组 | 元素的字段数据源\[{field:'' ,text:'' }\] <br>fields存在 元素字段则显示为下拉框显示 <br>fields 不存在 元素字段则为输入框显示 <br>优先级高于 模板全局设置数据源 | |
42
+
43
+ #### options
44
+ | 名称 | 类型 | 描述 | 默认值 |
45
+ | --- | --- | --- | --- |
46
+ | title | string | 标题或内容,field 存在:title为标题,打印结果为 `title:data` , field 不存在:title为内容,打印结果为 `title` | |
47
+ | field | string | 字段名称 | |
48
+ | testData | string | 测试数据,打印设计时 作为data,预览或打印时被真实数据替换 | |
49
+ | fontFamily | string | 字体 | 宋体 |
50
+ | fontSize | number | 字体大小 | 9pt |
51
+ | fontWeight | string | 字体粗细 | |
52
+ | letterSpacing | number | 字间距 | |
53
+ | color | number | 字体颜色 | |
54
+ | textDecoration | string | 文本描述 | |
55
+ | textAlign | string | 对齐 left center right | |
56
+ | lineHeight | number | 行高 | 9.75pt |
57
+ | textType | string | 文本类型 text barcode(条形码) qrcode(二维码) | text |
58
+ | barcodeMode | string | 条形码格式 | |
59
+ | hideTitle | boolean | 隐藏标题 | false |
60
+ | showInPage | string | 显示规则`仅页眉页尾元素或位置固定固定有效` <br>first:首页显示 <br>odd:奇数页显示 <br>even:偶数页显示 <br>last:尾页显示 | |
61
+ | fixed | bool | 位置固定 每页打印到指定位置 <br>位置固定的元素脱离正常的打印流,让不在页眉页脚范围内的元素拥有每页输出的特性。 <br>与面板指定页页尾线设置功能 相互协作 可以设置指定页 不同的页尾信息展示。 | |
62
+ | axis | string | 打印设计时拖拽方向 axis v:竖向 h:横向。需在design方法中显示开启,template.design('#designDiv',{ axisEnabled:true }) | |
63
+ | transform | number | 旋转角度 | |
64
+
65
+ # 图片
66
+ #### printElementType
67
+ | 名称 | 类型 | 描述 | 默认值 |
68
+ | --- | --- | --- | --- |
69
+ | tid | string | 元素类型的标识 | |
70
+ | field | string | 打印元素类型所对应的数据Josn的Key | |
71
+ | data | string | 打印设置时,显示的默认值 | |
72
+ | formatter | function | 文本元素格式化函数,需要三个参数: <br>value:值。 <br>options:打印元素的选项值。 <br>templateData:模板数据。 | |
73
+ | styler | function | 文本元素的样式函数,返回样式对象来自定义该 文本元素的样式,例如 {'background':'red'} 。该函数需要四个参数: <br>value:字段的值。 <br>options:打印元素的选项值。 <br>target:控件dom。 <br>templateData:模板数据。 | |
74
+ | onRendered | function | 元素渲染完成事件,该函数需要三个参数: <br>target:元素jq dom。 <br>options:打印元素的选项值。 <br>paperTarget:打印所在纸张的jq dom | |
75
+ | fields | 数组 | 元素的字段数据源\[{field:'' ,text:'' }\] <br>fields存在 元素字段则显示为下拉框显示 <br>fields 不存在 元素字段则为输入框显示 <br>优先级高于 模板全局设置数据源 | |
76
+
77
+ #### options
78
+ | 名称 | 类型 | 描述 | 默认值 |
79
+ | --- | --- | --- | --- |
80
+ | title | string | 标题或内容,field 存在:title为标题,打印结果为 `title:data` , field 不存在:title为内容,打印结果为 `title` | |
81
+ | field | string | 字段名称 | |
82
+ | src | string | field不存在的情况下,显示src的内容 | |
83
+ | showInPage | string | 显示规则`仅页眉页尾元素或位置固定固定有效` <br>first:首页显示 <br>odd:奇数页显示 <br>even:偶数页显示 <br>last:尾页显示 | |
84
+ | fixed | bool | 位置固定 每页打印到指定位置 <br>位置固定的元素脱离正常的打印流,让不在页眉页脚范围内的元素拥有每页输出的特性。 <br>与面板指定页页尾线设置功能 相互协作 可以设置指定页 不同的页尾信息展示。 | |
85
+ | axis | string | 打印设计时拖拽方向 axis v:竖向 h:横向。需在design方法中显示开启,template.design('#designDiv',{ axisEnabled:true }) | |
86
+ | transform | number | 旋转角度 | |
87
+
88
+ # 横线
89
+ ```js
90
+ panel.addPrintHline({ options: { width: 135, top: 30, left: 20,borderColor:'',borderWidth:0.75 } });
91
+ ```
92
+ #### printElementType
93
+ | 名称 | 类型 | 描述 | 默认值 |
94
+ | --- | --- | --- | --- |
95
+ | tid | string | 元素类型的标识 | |
96
+ | onRendered | function | 元素渲染完成事件,该函数需要三个参数: <br>target:元素jq dom。 <br>options:打印元素的选项值。 <br>paperTarget:打印所在纸张的jq dom | |
97
+
98
+ #### options
99
+ | 名称 | 类型 | 描述 | 默认值 |
100
+ | --- | --- | --- | --- |
101
+ | borderColor(可空) | string | 边框颜色 | |
102
+ | borderWidth(可空) | string | 边框大小 | |
103
+ | showInPage | string | 显示规则`仅页眉页尾元素或位置固定固定有效` <br>first:首页显示 <br>odd:奇数页显示 <br>even:偶数页显示 <br>last:尾页显示 | |
104
+ | fixed | bool | 位置固定 每页打印到指定位置 <br>位置固定的元素脱离正常的打印流,让不在页眉页脚范围内的元素拥有每页输出的特性。 <br>与面板指定页页尾线设置功能 相互协作 可以设置指定页 不同的页尾信息展示。 | |
105
+ | axis | string | 打印设计时拖拽方向 axis v:竖向 h:横向。需在design方法中显示开启,template.design('#designDiv',{ axisEnabled:true }) | |
106
+ | transform | number | 旋转角度 | |
107
+
108
+ # 竖线
109
+ ```js
110
+ panel.addPrintVline({ options: { height: 35, top: 230, left: 20,borderColor:'',borderWidth:0.75 } });
111
+ ```
112
+
113
+ #### printElementType
114
+ | 名称 | 类型 | 描述 | 默认值 |
115
+ | --- | --- | --- | --- |
116
+ | tid | string | 元素类型的标识 | |
117
+ | onRendered | function | 元素渲染完成事件,该函数需要三个参数: <br>target:元素jq dom。 <br>options:打印元素的选项值。 <br>paperTarget:打印所在纸张的ja dom | |
118
+
119
+ #### options
120
+ | 名称 | 类型 | 描述 | 默认值 |
121
+ | --- | --- | --- | --- |
122
+ | borderColor(可空) | string | 边框颜色 | |
123
+ | borderWidth(可空) | string | 边框大小 | |
124
+ | showInPage | string | 显示规则`仅页眉页尾元素或位置固定固定有效` <br>first:首页显示 <br>odd:奇数页显示 <br>even:偶数页显示 <br>last:尾页显示 | |
125
+ | fixed | bool | 位置固定 每页打印到指定位置 | |
126
+ | transform | number | 旋转角度 | |
127
+
128
+ # 矩形
129
+ ```js
130
+ panel.addPrintRect({ options: { width: 135, height:135,top: 30, left: 20,borderColor:'',borderWidth:0.75 } });
131
+ ```
132
+
133
+ #### printElementType
134
+ | 名称 | 类型 | 描述 | 默认值 |
135
+ | --- | --- | --- | --- |
136
+ | tid | string | 元素类型的标识 | |
137
+ | onRendered | function | 元素渲染完成事件,该函数需要三个参数: <br>target:元素jq dom。 <br>options:打印元素的选项值。 <br>paperTarget:打印所在纸张的ja dom | |
138
+
139
+ #### options
140
+ | 名称 | 类型 | 描述 | 默认值 |
141
+ | --- | --- | --- | --- |
142
+ | borderColor(可空) | string | 边框颜色 | |
143
+ | borderWidth(可空) | string | 边框大小 | |
144
+ | showInPage | string | 显示规则`仅页眉页尾元素或位置固定固定有效` <br>first:首页显示 <br>odd:奇数页显示 <br>even:偶数页显示 <br>last:尾页显示 | |
145
+ | fixed | bool | 位置固定 每页打印到指定位置 <br>位置固定的元素脱离正常的打印流,让不在页眉页脚范围内的元素拥有每页输出的特性。 <br>与面板指定页页尾线设置功能 相互协作 可以设置指定页 不同的页尾信息展示。 | |
146
+ | axis | string | 打印设计时拖拽方向 axis v:竖向 h:横向。需在design方法中显示开启,template.design('#designDiv',{ axisEnabled:true }) | |
147
+ | transform | number | 旋转角度 | |
148
+
149
+ # 椭圆
150
+ ```js
151
+ panel.addPrintOval({ options: { width: 135, height:135,top: 30, left: 20,borderColor:'',borderWidth:0.75 } });
152
+ ```
153
+
154
+ #### printElementType
155
+ | 名称 | 类型 | 描述 | 默认值 |
156
+ | --- | --- | --- | --- |
157
+ | tid | string | 元素类型的标识 | |
158
+ | onRendered | function | 元素渲染完成事件,该函数需要三个参数: <br>target:元素jq dom。 <br>options:打印元素的选项值。 <br>paperTarget:打印所在纸张的ja dom | |
159
+
160
+ #### options
161
+ | 名称 | 类型 | 描述 | 默认值 |
162
+ | --- | --- | --- | --- |
163
+ | borderColor(可空) | string | 边框颜色 | |
164
+ | borderWidth(可空) | string | 边框大小 | |
165
+ | showInPage | string | 显示规则`仅页眉页尾元素或位置固定固定有效` <br>first:首页显示 <br>odd:奇数页显示 <br>even:偶数页显示 <br>last:尾页显示 | |
166
+ | fixed | bool | 位置固定 每页打印到指定位置 <br>位置固定的元素脱离正常的打印流,让不在页眉页脚范围内的元素拥有每页输出的特性。 <br>与面板指定页页尾线设置功能 相互协作 可以设置指定页 不同的页尾信息展示。 | |
167
+ | axis | string | 打印设计时拖拽方向 axis v:竖向 h:横向。需在design方法中显示开启,template.design('#designDiv',{ axisEnabled:true }) | |
168
+ | transform | number | 旋转角度 | |
169
+
170
+ # 表格
171
+
172
+ #### printElementType
173
+ | 名称 | 类型 | 描述 | 默认值 |
174
+ | --- | --- | --- | --- |
175
+ | tid | string | 元素类型的标识 | |
176
+ | title | string | 用户托拽列表中显示的名称 | |
177
+ | field | string | 字段名称 | |
178
+ | styler | function | 表格样式函数,返回样式对象来自定义该 表格元素的样式,例如 {'background':'red'} 。该函数需要二个参数: <br>value:字段的值。 <br>options:打印元素的选项值。 | |
179
+ | rowStyler | function | 表格列样式函数,返回样式对象来自定义该 tr元素的样式,例如 {'background':'red'} 。该函数需要二个参数: <br>value:字段的值。 <br>options:打印元素的选项值。 | |
180
+ | `columns` | array<array\> | 表格的列(column)的配置对象,更多细节请参见列(column)属性。\[\[{},{}\]\[{},{}\]\] //多行表头 | |
181
+ | formatter | function | 该函数需要一个参数:data | 返回表格的html 字符串 |
182
+ | groupFields | array | 表格的数据的分组字段,该字段为数组,可以根据多列进行分组。 | |
183
+ | groupFormatter | function | 分组头格式化函数,定义分组显示信息,当groupFields数组长度为1是默认显示为字段值。该函数需要二个参数: <br>groupData:分组信息。 <br>options:打印元素的选项值。 | |
184
+ | footerFormatter | function | 表格脚格式化函数,定义分组尾部显示信息,可以放置写统计信息。。该函数需要四个参数: <br>options:打印元素的选项值。 <br>rows <br>data <br>currentPageGridRowsData:当前页数据 | |
185
+ | gridColumnsFooterFormatter | function | 多组表格脚格式化函数,定义分组尾部显示信息,可以放置写统计信息。。该函数需要四个参数: <br>options:打印元素的选项值。 <br>rows <br>data <br>currentPageRowsData:当前页数据 | |
186
+ | groupFooterFormatter | function | 分组脚格式化函数,定义分组尾部显示信息,可以放置写统计信息。。该函数需要二个参数: <br>groupData:分组信息。 <br>options:打印元素的选项值。 | |
187
+ | onRendered | function | 元素渲染完成事件,该函数需要三个参数: <br>target:元素jq dom。 <br>options:打印元素的选项值。 <br>paperTarget:打印所在纸张的ja dom | |
188
+ | fields | 数组 | 元素的字段数据源\[{field:'' ,text:'' }\] <br>fields存在 元素字段则显示为下拉框显示 <br>fields 不存在 元素字段则为输入框显示 <br>优先级高于 模板全局设置数据源 | |
189
+
190
+ ###### `columns`列属性
191
+ | 名称 | 类型 | 描述 | 默认值 |
192
+ | --- | --- | --- | --- |
193
+ | width | number | 此宽度只是相对值 实际渲染会等比换算 | 100 |
194
+ | title | string | 列标题 | |
195
+ | field | string | 列所对应的数据字段 | |
196
+ | fixed | boolean | 宽度锁定,渲染时不进行等比换算 | false |
197
+ | rowspan | number | 指示一个单元格占据多少行。 | |
198
+ | colspan | number | 指示一个单元格占据多少列。 | |
199
+ | align | string | 指示如何对齐该列的数据,可以用 'left'、'right'、'center'。 | |
200
+ | halign | string | 指示如何对齐该列的头部,可能的值:'left'、'right'、'center'。如果没有分配值,则头部对齐方式将与通过 'align' 属性定义的数据对齐方式一致 | |
201
+ | formatter | function | 单元格的格式化函数,需要四个参数: <br>value:字段的值。 <br>row:行的记录数据。 <br>index:行的索引。 <br>options:打印元素的选项值 | |
202
+ | styler | function | 单元格的样式函数,需要四个参数: <br>value:字段的值。 <br>row:行的记录数据。 <br>index:行的索引。 <br>options:打印元素的选项值 | |
203
+
204
+ #### options
205
+ | 名称 | 类型 | 描述 | 默认值 |
206
+ | --- | --- | --- | --- |
207
+ | field | string | 字段名称 | |
208
+ | fontFamily | string | 字体 | 宋体 |
209
+ | fontSize | number | 字体大小 | 9pt |
210
+ | lineHeight | number | 行高 | 9.75pt |
211
+ | textAlign | string | 对齐 left center right | |
212
+ | tableBorder | string | 表格边框noBorder或border | |
213
+ | tableHeaderBorder | string | 表头边框noBorder或border或topBorder或bottomBorder或topBottomBorder | |
214
+ | tableHeaderCellBorder | string | 表头单元格边框noBorder或border | |
215
+ | tableHeaderRowHeight | number | 表头高度pt | |
216
+ | tableHeaderBackground | string | 表头颜色 | |
217
+ | tableHeaderFontSize | number | 表头字体大小 | |
218
+ | tableHeaderFontWeight | string | 表头字体粗细 | |
219
+ | tableBodyCellBorder | string | 表体单元格边框noBorder或borde | |
220
+ | tableBodyRowBorder | string | 表头边框noBorder或border或topBorder或bottomBorder或topBottomBorder | |
221
+ | tableBodyRowHeight | number | 标题行高度 | |
222
+ | axis | string | 打印设计时拖拽方向 axis v:竖向 h:横向。需在design方法中显示开启,template.design('#designDiv',{ axisEnabled:true }) | |
223
+ | lHeight | number | 当长文本或表格数据过少或为空,元素高度将是他们占用的实际高度,下方元素保持原有间距。可以设置元素lHeight属性(number)来设置元素显示的最小高度。 | |
224
+
225
+
226
+ # 长文本
227
+ 长文本和文本的区别,长文本随着文本数据的长度变大,打印高度不断变高,高度过高则自动分页,长文本下方元素同步下移和长文本保持设定好的边距,文本类型:定高定宽,打印区域不变。不会对其他打印元素造成影响。
228
+ ```js
229
+ panel.addPrintLongText({ options: { width: 140, height: 15, top: 20, left: 20, title: 'hiprint插件手动添加text', textAlign: 'center' } });
230
+ ```
231
+
232
+ #### printElementType
233
+ | 名称 | 类型 | 描述 | 默认值 |
234
+ | --- | --- | --- | --- |
235
+ | tid | string | 元素类型的标识 | |
236
+ | title | string | 用户托拽列表中显示的名称 | |
237
+ | field | string | 打印元素类型所对应的数据Josn的Key | |
238
+ | data | string | 打印设置时,显示的默认值 | |
239
+ | formatter | function | 文本元素格式化函数,需要四个参数: <br>title:标题。 <br>value:值。 <br>options:打印元素的选项值。 <br>templateData:模板数据。 | |
240
+ | styler | function | 文本元素的样式函数,返回样式对象来自定义该 文本元素的样式,例如 {'background':'red'} 。该函数需要四个参数: <br>value:字段的值。 <br>options:打印元素的选项值。 <br>target:长文本控件dom。 <br>templateData:模板数据。 | |
241
+ | onRendered | function | 元素渲染完成事件,该函数需要三个参数: <br>target:元素jq dom。 <br>options:打印元素的选项值。 <br>paperTarget:打印所在纸张的ja dom | |
242
+ | fields | 数组 | 元素的字段数据源\[{field:'' ,text:'' }\] <br>fields存在 元素字段则显示为下拉框显示 <br>fields 不存在 元素字段则为输入框显示 <br>优先级高于 模板全局设置数据源 | |
243
+
244
+ #### options
245
+ | 名称 | 类型 | 描述 | 默认值 |
246
+ | --- | --- | --- | --- |
247
+ | title | string | 标题或内容,field 存在:title为标题,打印结果为 `title:data` , field 不存在:title为内容,打印结果为 `title` | |
248
+ | field | string | 字段名称 | |
249
+ | testData | string | 测试数据,打印设计时 作为data,预览或打印时被真实数据替换 | |
250
+ | fontFamily | string | 字体 | 宋体 |
251
+ | fontSize | number | 字体大小 | 9pt |
252
+ | fontWeight | string | 字体粗细 | |
253
+ | letterSpacing | number | 字间距 | |
254
+ | color | number | 字体颜色 | |
255
+ | textDecoration | string | 文本描述 | |
256
+ | textAlign | string | 对齐 left center right | |
257
+ | lineHeight | number | 行高 | 9.75pt |
258
+ | hideTitle | boolean | 隐藏标题 | false |
259
+ | longTextIndent | number | 每行缩进 | |
260
+ | showInPage | string | 显示规则`仅页眉页尾元素或位置固定固定有效` <br>first:首页显示 <br>odd:奇数页显示 <br>even:偶数页显示 <br>last:尾页显示 | |
261
+ | fixed | bool | 位置固定 每页打印到指定位置 <br>位置固定的元素脱离正常的打印流,让不在页眉页脚范围内的元素拥有每页输出的特性。 <br>与面板指定页页尾线设置功能 相互协作 可以设置指定页 不同的页尾信息展示。 | |
262
+ | leftSpaceRemoved | boolean | 移除段落左侧空白符 | true |
263
+ | axis | string | 打印设计时拖拽方向 axis v:竖向 h:横向。需在design方法中显示开启,template.design('#designDiv',{ axisEnabled:true }) | |
264
+ | lHeight | number | 当长文本或表格数据过少或为空,元素高度将是他们占用的实际高度,下方元素保持原有间距。可以设置元素lHeight属性(number)来设置元素显示的最小高度。 | |
265
+ | transform | number | 旋转角度 | |