vg-print 1.1.206 → 1.1.208

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/README.en.md CHANGED
@@ -182,6 +182,8 @@ const onSaveDirect = () => designer.value?.save()
182
182
  - `showImg: boolean` Show "Export Image" button, default `true`
183
183
  - `showPrint2: boolean` Show "Direct Print" button, default `true`
184
184
  - `showPrinterSelect: boolean` Show printer selector area, default `true`
185
+ - `dialogTitle: string` Modal title, default `打印预览`
186
+ - `showTitle: boolean` Show title in modal, default `true`
185
187
  - `modalShow: boolean` Modal visibility (supports `v-model:modalShow`)
186
188
  - `width: string | number` Modal width (default `'80%'`)
187
189
  - `defaultLang: string` Component i18n language (used when Standalone); supports `cn`, `en`, `de`, `es`, `fr`, `it`, `ja`, `ru`, `cn_tw`; default `cn`
@@ -206,6 +208,8 @@ const onSaveDirect = () => designer.value?.save()
206
208
  <el-button @click="openPreview">Show Preview</el-button>
207
209
  <Preview
208
210
  ref="previewRef"
211
+ :show-title="false"
212
+ dialog-title="自定义预览标题"
209
213
  v-model:modalShow="visible"
210
214
  default-lang="cn"
211
215
  :printerList="printers"
@@ -229,7 +233,48 @@ const data = { title: 'Report', name: 'DongDong' }
229
233
 
230
234
  const openPreview = () => {
231
235
  const tpl = createTemplate(tmplJson) // Or pass hiprint.PrintTemplate
232
- previewRef.value.show(tpl, data, '80%')
236
+ // vue2方式:
237
+ previewRef.value?.show(tpl, data, '80%')
238
+ // 或
239
+ previewRef.value?.show(tpl, data)
240
+ // 或
241
+ previewRef.value?.show(tpl, data, {
242
+ width: '80%',
243
+ dialogTitle: '自定义预览',
244
+ showTitle: false,
245
+ showPdf: false,
246
+ showImg: false,
247
+ showPrint2: false,
248
+ showPrinterSelect: false,
249
+ onClick: (type) => {
250
+ // 示例:点击导出 PDF 按钮
251
+ if (type === 'pdf') {
252
+ console.log('[Preview onClick] 导出 PDF')
253
+ return
254
+ }
255
+ console.log('[Preview onClick]', type)
256
+ },
257
+ onClose: () => {
258
+ // 示例:弹窗关闭
259
+ console.log('[Preview onClose] 弹窗已关闭')
260
+ },
261
+ onRender: () => {
262
+ // 示例:预览内容渲染完成
263
+ console.log('[Preview onRender] 预览内容渲染完成')
264
+ },
265
+ callBackOptions: {
266
+ statusCallback: (status) => {
267
+ // 示例:导出进度(PDF/图片)
268
+ if (status.type === 'pdf:progress' || status.type === 'image:progress') {
269
+ const cur = status?.payload?.cur ?? 0
270
+ const total = status?.payload?.total ?? 0
271
+ console.log('[Preview progress]', cur, total)
272
+ return
273
+ }
274
+ console.log('[Preview status]', status.type, status.message || '')
275
+ }
276
+ }
277
+ })
233
278
  }
234
279
  </script>
235
280
  ```
package/README.md CHANGED
@@ -257,6 +257,9 @@ const onSaveDirect = () => designer.value?.save()
257
257
  - `printData: object | array` 打印数据
258
258
  - `printerList: Array<{ name: string; label: string }>` 打印机列表
259
259
  - `selectedPrinter: string` 选中的打印机名称
260
+ - `dialogTitle: string` 弹窗标题,默认 `打印预览`
261
+ - `dialogTitleHtml: string` 弹窗标题 HTML 内容,默认 `''`(支持 `弹窗标题)
262
+ - `showTitle: boolean` 是否显示标题,默认 `true`
260
263
  - `showPdf: boolean` 是否显示“导出 PDF”按钮,默认 `true`
261
264
  - `showImg: boolean` 是否显示“导出图片”按钮,默认 `true`
262
265
  - `showPrint2: boolean` 是否显示“直接打印”按钮,默认 `true`
@@ -265,6 +268,13 @@ const onSaveDirect = () => designer.value?.save()
265
268
  - `width: string | number` 弹窗宽度(默认 `'80%'`)
266
269
  - `defaultLang: string` 组件内 i18n 语言(Standalone 时使用);支持 `cn`、`en`、`de`、`es`、`fr`、`it`、`ja`、`ru`、`cn_tw`;默认 `cn`
267
270
 
271
+ 预览头部标题使用
272
+ - 传纯文本(原有方式):
273
+ - dialogTitle: '预览单据'
274
+ - 传带标签 HTML:
275
+ - dialogTitleHtml: '<span class="my-title"><i>订单</i>预览</span>'
276
+ - 用插槽完全自定义(推荐,样式控制最灵活):
277
+ - <template #title="{ title, html }">...</template>
268
278
  ### 事件(Emits)
269
279
 
270
280
  - `update:modalShow` 双向绑定弹窗显隐
@@ -289,6 +299,13 @@ const onSaveDirect = () => designer.value?.save()
289
299
  ```ts
290
300
  type PreviewShowOptions = {
291
301
  width?: string | number
302
+ dialogTitle?: string
303
+ dialogTitleHtml?: string
304
+ showPdf?: boolean
305
+ showImg?: boolean
306
+ showPrint2?: boolean
307
+ showPrinterSelect?: boolean
308
+ showTitle?: boolean
292
309
  onClick?: (type: 'pdf' | 'img' | 'print' | 'print2' | 'close') => void
293
310
  onClose?: () => void
294
311
  onRender?: () => void
@@ -316,6 +333,8 @@ type PreviewShowOptions = {
316
333
  <el-button @click="openPreview">显示预览</el-button>
317
334
  <Preview
318
335
  ref="previewRef"
336
+ :show-title="false"
337
+ dialog-title="自定义预览标题"
319
338
  v-model:modalShow="visible"
320
339
  default-lang="cn"
321
340
  :printerList="printers"
@@ -351,6 +370,13 @@ const openPreview = () => {
351
370
  // 或
352
371
  previewRef.value?.show(tpl, data, {
353
372
  width: '80%',
373
+ dialogTitle: '自定义预览',
374
+ dialogTitleHtml: '<h2>自定义预览标题</h2>',
375
+ showTitle: false,
376
+ showPdf: false,
377
+ showImg: false,
378
+ showPrint2: false,
379
+ showPrinterSelect: false,
354
380
  onClick: (type) => {
355
381
  // 示例:点击导出 PDF 按钮
356
382
  if (type === 'pdf') {
@@ -1,4 +1,4 @@
1
- /*! @license DOMPurify 2.5.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.5.8/LICENSE */
1
+ /*! @license DOMPurify 2.5.9 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.5.9/LICENSE */
2
2
  function I(a) {
3
3
  "@babel/helpers - typeof";
4
4
  return I = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(n) {
@@ -150,7 +150,7 @@ function _t() {
150
150
  var a = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : mr(), n = function(e) {
151
151
  return _t(e);
152
152
  };
153
- if (n.version = "2.5.8", n.removed = [], !a || !a.document || a.document.nodeType !== 9)
153
+ if (n.version = "2.5.9", n.removed = [], !a || !a.document || a.document.nodeType !== 9)
154
154
  return n.isSupported = !1, n;
155
155
  var o = a.document, s = a.document, c = a.DocumentFragment, g = a.HTMLTemplateElement, y = a.Node, D = a.Element, x = a.NodeFilter, j = a.NamedNodeMap, ht = j === void 0 ? a.NamedNodeMap || a.MozNamedAttrMap : j, Et = a.HTMLFormElement, At = a.DOMParser, K = a.trustedTypes, Z = D.prototype, yt = ie(Z, "cloneNode"), gt = ie(Z, "nextSibling"), St = ie(Z, "childNodes"), fe = ie(Z, "parentNode");
156
156
  if (typeof g == "function") {
@@ -368,7 +368,7 @@ function _t() {
368
368
  H && (r = L(r, de, " "), r = L(r, Te, " "), r = L(r, ve, " "));
369
369
  var st = T(e.nodeName);
370
370
  if (it(st, u, r)) {
371
- if (Ve && (u === "id" || u === "name") && (ne(m, e), r = Ct + r), Ae && _(/((--!?|])>)|<\/(style|title)/i, r)) {
371
+ if (Ve && (u === "id" || u === "name") && (ne(m, e), r = Ct + r), Ae && _(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, r)) {
372
372
  ne(m, e);
373
373
  continue;
374
374
  }