yh-hiprint 2.6.8 → 2.6.11

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.
@@ -999,11 +999,9 @@ onMounted(async () => {
999
999
  });
1000
1000
  </script>
1001
1001
  <style lang="scss">
1002
- @use './libs/css/hiprint.css';
1003
- @use './libs//css/print-lock.css';
1004
1002
  .hiprint-designer {
1005
1003
  width: calc(100% + 32px);
1006
- height: calc(100% - 30px);
1004
+ height: calc(100%);
1007
1005
  overflow: hidden;
1008
1006
  display: flex;
1009
1007
  flex-direction: column;
@@ -1141,13 +1139,20 @@ onMounted(async () => {
1141
1139
  }
1142
1140
  .hiprint-designer_title {
1143
1141
  padding: 0 10px;
1142
+ margin: 0;
1144
1143
  }
1145
1144
  #PrintElementOptionSetting {
1146
1145
  flex: 1;
1147
1146
  overflow: hidden;
1148
1147
  }
1149
1148
  .el-form {
1150
- padding: 10px;
1149
+ padding: 0 10px 10px;
1150
+ .el-form-item--small {
1151
+ margin-bottom: 5px;
1152
+ }
1153
+ .el-form-item__label {
1154
+ margin-bottom: 0;
1155
+ }
1151
1156
  .el-button {
1152
1157
  width: 100%;
1153
1158
  }
@@ -135,47 +135,27 @@ async function getData(query) {
135
135
  }
136
136
  }
137
137
 
138
- // 检查是否启用客户端打印
139
- const useClientPrint = localStorage.getItem('useClientPrint') === 'true';
140
-
141
- if (useClientPrint && hiprint.hiwebSocket.opened) {
142
- // 使用客户端打印
143
- loading.setText('正在连接打印客户端');
144
-
145
- // 获取打印机列表
146
- let printerList = hiprint.hiwebSocket.getPrinterList();
147
- if (!printerList || printerList.length === 0) {
148
- ElMessageBox.alert('未获取到打印机列表', '提示');
149
- return;
150
- }
151
-
152
- loading.close();
153
-
154
- // 显示打印机选择对话框
155
- showPrinterSelectionDialog(printerList, hiprintTemplate, list);
138
+ // 默认浏览器打印
139
+ let html = hiprintTemplate.getHtml(list);
140
+ if (opener && returnHtml && html[0]) {
141
+ opener.postMessage({
142
+ type: 'sendPrintHTML',
143
+ data: html[0].innerHTML,
144
+ });
145
+ ElMessageBox.alert('渲染完成!确认后返回系统').then(() => {
146
+ window.close();
147
+ });
156
148
  } else {
157
- // 默认浏览器打印
158
- let html = hiprintTemplate.getHtml(list);
159
- if (opener && returnHtml && html[0]) {
160
- opener.postMessage({
161
- type: 'sendPrintHTML',
162
- data: html[0].innerHTML,
163
- });
164
- ElMessageBox.alert('渲染完成!确认后返回系统').then(() => {
149
+ document.body.innerHTML = '';
150
+ document.body.appendChild(html[0]);
151
+ if (hasData) {
152
+ setTimeout(() => {
153
+ window.print();
154
+ }, 1000);
155
+ } else {
156
+ ElMessageBox.alert('数据源没有数据,打印将取消').then(() => {
165
157
  window.close();
166
158
  });
167
- } else {
168
- document.body.innerHTML = '';
169
- document.body.appendChild(html[0]);
170
- if (hasData) {
171
- setTimeout(() => {
172
- window.print();
173
- }, 1000);
174
- } else {
175
- ElMessageBox.alert('数据源没有数据,打印将取消').then(() => {
176
- window.close();
177
- });
178
- }
179
159
  }
180
160
  }
181
161
  success.value = false;
@@ -192,7 +172,4 @@ async function getData(query) {
192
172
  }
193
173
  }
194
174
  </script>
195
- <style lang="scss">
196
- @use './libs/css/hiprint.css';
197
- @use './libs//css/print-lock.css';
198
- </style>
175
+ <style lang="scss"></style>
@@ -1,16 +1,17 @@
1
- import {hiprint as h, defaultElementTypeProvider as p} from '../libs/hiprint.bundle.js';
1
+ import { hiprint as h, defaultElementTypeProvider as p } from '../libs/hiprint.bundle.js';
2
2
  // 调用浏览器打印js
3
3
  import '../libs/plugins/jquery.hiwprint.js';
4
4
  // 默认配置
5
5
  import '../libs/hiprint.config.js';
6
6
  // 样式
7
- import '../libs/css/hiprint.css';
8
- import {ref, computed, watch, reactive, nextTick} from 'vue';
7
+ import "../libs/css/hiprint.css";
8
+ import "../libs/css/print-lock.css";
9
+ import { ref, computed, watch, reactive, nextTick } from 'vue';
9
10
 
10
11
  export const hiprint = h;
11
12
  export const defaultElementTypeProvider = p;
12
13
 
13
- export function print(provider = defaultElementTypeProvider, template, ...args) {
14
+ export function print (provider = defaultElementTypeProvider, template, ...args) {
14
15
  hiprint.init({
15
16
  providers: [new provider()],
16
17
  });
@@ -21,7 +22,7 @@ export function print(provider = defaultElementTypeProvider, template, ...args)
21
22
  return hiprintTemplate;
22
23
  }
23
24
 
24
- export function print2(provider = defaultElementTypeProvider, template, ...args) {
25
+ export function print2 (provider = defaultElementTypeProvider, template, ...args) {
25
26
  hiprint.init({
26
27
  providers: [new provider()],
27
28
  });
@@ -32,7 +33,7 @@ export function print2(provider = defaultElementTypeProvider, template, ...args)
32
33
  return hiprintTemplate;
33
34
  }
34
35
 
35
- export function usePaper() {
36
+ export function usePaper () {
36
37
  const paperType = ref('A4');
37
38
  const paperTypeName = computed(() => {
38
39
  const paperTypeObj = paperTypesObj.find((item) => item.value === paperType.value);
@@ -46,12 +47,12 @@ export function usePaper() {
46
47
  const paperHeight = ref(296.6);
47
48
 
48
49
  const paperTypesObj = reactive([
49
- {label: 'A3', value: 'A3'},
50
- {label: 'A4', value: 'A4'},
51
- {label: 'A5', value: 'A5'},
52
- {label: 'B3', value: 'B3'},
53
- {label: 'B4', value: 'B4'},
54
- {label: 'B5', value: 'B5'},
50
+ { label: 'A3', value: 'A3' },
51
+ { label: 'A4', value: 'A4' },
52
+ { label: 'A5', value: 'A5' },
53
+ { label: 'B3', value: 'B3' },
54
+ { label: 'B4', value: 'B4' },
55
+ { label: 'B5', value: 'B5' },
55
56
  ]);
56
57
 
57
58
  const paperTypes = {
@@ -81,9 +82,9 @@ export function usePaper() {
81
82
  },
82
83
  };
83
84
 
84
- function setPaper(type, callback) {
85
+ function setPaper (type, callback) {
85
86
  if (type !== 'other') {
86
- let {width, height} = paperTypes[type];
87
+ let { width, height } = paperTypes[type];
87
88
  paperWidth.value = width;
88
89
  paperHeight.value = height;
89
90
  }
@@ -120,7 +121,7 @@ export function usePaper() {
120
121
  };
121
122
  }
122
123
 
123
- export function useScale(callback) {
124
+ export function useScale (callback) {
124
125
  const scaleValue = ref(1);
125
126
  const scalePercentage = computed(() => {
126
127
  return `${(scaleValue.value * 100).toFixed(0)}%`;
@@ -131,11 +132,11 @@ export function useScale(callback) {
131
132
  const canZoomOut = computed(() => {
132
133
  return scaleValue.value < 4;
133
134
  });
134
- function zoomIn() {
135
+ function zoomIn () {
135
136
  scaleValue.value = scaleValue.value - 0.1;
136
137
  callback();
137
138
  }
138
- function zoomOut() {
139
+ function zoomOut () {
139
140
  scaleValue.value = scaleValue.value + 0.1;
140
141
  callback();
141
142
  }
@@ -149,9 +150,9 @@ export function useScale(callback) {
149
150
  };
150
151
  }
151
152
 
152
- export function useDataSource(axios) {
153
+ export function useDataSource (axios) {
153
154
  const detailData = ref();
154
- function getDetail(id) {
155
+ function getDetail (id) {
155
156
  return axios
156
157
  .request({
157
158
  url: `/printTemplate/get/${id}`,
@@ -191,7 +192,7 @@ export function useDataSource(axios) {
191
192
  });
192
193
  const dataSourceForm = ref([]);
193
194
  const codeMapDataSource = ref({});
194
- function getDataSourceList() {
195
+ function getDataSourceList () {
195
196
  return axios
196
197
  .request({
197
198
  url: '/printTemplate/getDsList',
package/index.js CHANGED
@@ -1,13 +1,12 @@
1
1
  import './libs/jquery';
2
- import { ElDialog, ElSelect, ElOption, ElButton, ElMessageBox,ElLoading } from 'element-plus';
3
- import { createApp,createVNode } from 'vue';
2
+ import { ElDialog, ElSelect, ElOption, ElButton, ElMessageBox, ElLoading } from 'element-plus';
3
+ import { createApp, createVNode } from 'vue';
4
4
  export { hiprint, defaultElementTypeProvider, print, print2, usePaper, useScale, useDataSource } from './hooks/useHiprint';
5
5
  export { default as fontSize } from './font-size';
6
6
  export { default as scale } from './scale';
7
7
  export { default as zIndex } from './z-index';
8
8
  export { default as panel } from './panel';
9
9
  import { getPrintTemplate } from 'yh-hiprint/libs/index.js';
10
- import printCss from 'yh-hiprint/libs/css/print-lock.css?inline';
11
10
 
12
11
  export function guid () {
13
12
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (t) {
@@ -25,7 +24,7 @@ export function cLog (string, isError = false) {
25
24
  }
26
25
 
27
26
  const hiprintFun = async ({ code, params, data, isCustom, returnHtml }) => {
28
- if (electronBrowserAPI && electronBrowserAPI.print) {
27
+ if (window.electronBrowserAPI && window.electronBrowserAPI.print) {
29
28
  clientPrintHandler(code, params, data);
30
29
  } else {
31
30
  let height = document.documentElement.clientHeight;
@@ -251,15 +250,15 @@ const showPrinterSelectionDialog = (printerList, templateJson, templateData, tem
251
250
 
252
251
  // 添加事件监听器
253
252
  window.addEventListener('message', handlePrintResult);
254
-
253
+
255
254
  // 添加超时机制,防止监听器泄漏
256
255
  const timeoutId = setTimeout(() => {
257
256
  window.removeEventListener('message', handlePrintResult);
258
257
  loading.close();
259
258
  ElMessageBox.alert("打印超时", '提示');
260
259
  this.handleClose(false);
261
- }, 60*1000); // 30秒超时
262
-
260
+ }, 60 * 1000); // 30秒超时
261
+
263
262
  // 发送到客户端打印
264
263
  try {
265
264
  electronBrowserAPI.print(printOption);
@@ -1,4 +1,3 @@
1
- /* eslint-disable */
2
1
  /**
3
2
  * jQuery Hiprint 2.5.4
4
3
  *
@@ -34,7 +33,6 @@ import Nzh from 'nzh/dist/nzh.min.js';
34
33
  import { Canvg } from 'canvg';
35
34
  // 默认自定义拖拽列表
36
35
  import defaultTypeProvider from './etypes/default-etyps-provider';
37
- import printCss from './css/print-lock.css?inline';
38
36
 
39
37
  function _instanceof (left, right) {
40
38
  if (right != null && typeof Symbol !== 'undefined' && right[Symbol.hasInstance]) {
@@ -57,6 +55,8 @@ function _typeof (obj) {
57
55
  return _typeof(obj);
58
56
  }
59
57
 
58
+ window.autoConnect = false;
59
+
60
60
  var hiprint = (function (t) {
61
61
  var e = {};
62
62
 
@@ -2035,7 +2035,7 @@ var hiprint = (function (t) {
2035
2035
  })
2036
2036
  .forEach(function (t) {
2037
2037
  var n = hiprintJQuery('<td></td>');
2038
- t.id && n.attr('id', t.id), t.columnId && n.attr('column-id', t.columnId), (t.align || t.halign) && n.css('text-align', t.halign || t.align), t.vAlign && n.css('vertical-align', t.vAlign), t.colspan > 1 && n.attr('colspan', t.colspan), t.rowspan > 1 && n.attr('rowspan', t.rowspan), n.html(t.title), o[t.id] ? ((t.hasWidth = !0), (t.targetWidth = o[t.id]), n.attr('haswidth', 'haswidth'), n.css('width', o[t.id] + 'pt')) : (t.hasWidth = !1);
2038
+ t.id && n.attr('id', t.id), t.columnId && n.attr('column-id', t.columnId), (t.align || t.halign) && n.css('text-align', t.halign || t.align), t.colspan > 1 && n.attr('colspan', t.colspan), t.rowspan > 1 && n.attr('rowspan', t.rowspan), n.html(t.title), o[t.id] ? ((t.hasWidth = !0), (t.targetWidth = o[t.id]), n.attr('haswidth', 'haswidth'), n.css('width', o[t.id] + 'pt')) : (t.hasWidth = !1);
2039
2039
  var s = TableExcelHelper.getHeaderStyler(t);
2040
2040
  if (s) {
2041
2041
  var l = s(t);
@@ -2062,7 +2062,7 @@ var hiprint = (function (t) {
2062
2062
  var a = hiprintJQuery('<tfoot></tfoot>'),
2063
2063
  p = this.getFooterFormatter(n, i);
2064
2064
  var tst = this.tableSummaryTitle;
2065
- let tSumData = n.tableFooterRepeat == 'last' ? e : r;
2065
+ let tSumData = n.tableFooterScope == 'all' ? e : r;
2066
2066
  let idx = n.columns.length - 1;
2067
2067
  var rowColumns = this.rowColumns || n.columns[idx].columns;
2068
2068
  if (
@@ -5529,7 +5529,7 @@ var hiprint = (function (t) {
5529
5529
 
5530
5530
  return (
5531
5531
  (t.prototype.createTarget = function () {
5532
- return (this.target = hiprintJQuery(' <div class="hiprint-option-item">\n <div class="hiprint-option-item-label">\n 单元格上下对齐\n </div>\n <div class="hiprint-option-item-field">\n <select class="auto-submit">\n <option value="" >默认</option>\n <option value="top" >上</option>\n <option value="middle" >中</option>\n <option value="bottom" >居右</option>\n \n </select>\n </div>\n </div>')), this.target;
5532
+ return (this.target = hiprintJQuery(' <div class="hiprint-option-item">\n <div class="hiprint-option-item-label">\n 单元格上下对齐\n </div>\n <div class="hiprint-option-item-field">\n <select class="auto-submit">\n <option value="" >默认</option>\n <option value="top" >上</option>\n <option value="middle" >中</option>\n <option value="bottom" >下</option>\n \n </select>\n </div>\n </div>')), this.target;
5533
5533
  }),
5534
5534
  (t.prototype.getValue = function () {
5535
5535
  var t = this.target.find('select').val();
@@ -5718,6 +5718,28 @@ var hiprint = (function (t) {
5718
5718
  }),
5719
5719
  t
5720
5720
  );
5721
+ })(),
5722
+ tableFooterScope = (function () {
5723
+ function t () {
5724
+ this.name = 'tableFooterScope';
5725
+ }
5726
+
5727
+ return (
5728
+ (t.prototype.createTarget = function () {
5729
+ return (this.target = hiprintJQuery(' <div class="hiprint-option-item">\n <div class="hiprint-option-item-label">\n 聚合数据范围\n </div>\n <div class="hiprint-option-item-field">\n <select class="auto-submit">\n <option value="page" >当前页</option>\n <option value="all" >全部数据</option>\n </select>\n </div>\n </div>')), this.target;
5730
+ }),
5731
+ (t.prototype.getValue = function () {
5732
+ var t = this.target.find('select').val();
5733
+ return t ? t.toString() : 'page';
5734
+ }),
5735
+ (t.prototype.setValue = function (t) {
5736
+ this.target.find('select').val(t);
5737
+ }),
5738
+ (t.prototype.destroy = function () {
5739
+ this.target.remove();
5740
+ }),
5741
+ t
5742
+ );
5721
5743
  })();
5722
5744
 
5723
5745
  n.d(e, 'a', function () {
@@ -5742,8 +5764,9 @@ var hiprint = (function (t) {
5742
5764
  (t.getItem = function (e) {
5743
5765
  return t.init(), t.printElementOptionItems[e];
5744
5766
  }),
5745
- (t._printElementOptionItems = [new fontFamily(), new r(), new a(), new p(), new i(), new s(), new l(), new pt(), new u(), new d(), new c(), new h(), new f(), new g(), new m(), new d2(), new c2(), new v(), new y(), new b(), new E(), new qrCodeLevel(), new T(), new P(), new _(), new w(), new x(), new coordinate(), new widthHeight(), new C(), new imageFit(), new O(), new H(), new D(), new paperNumberContinue(), new watermarkOptions(), new I(), new R(), new pageBreak(), new M(), new M2(), new S(), new B(), new F(), new L(), new A(), new z(), new k(), new st(), new N(), new V(), new W(), new j(), new U(), new zIndex(), new K(), new G(), new q(), new X(), new Y(), new Q(), new J(), new Z(), new tt(), new et(), new nt(), new it(), new ot(), new textWrap(), new at(), new lt(), new ut(), new ith(), new dt(), new ct(), new ht(), new ft(), new gt(), new mt(), new rowcolumns(), new rowsColumnsMergeClean(), new groupFieldsFormatter(), new groupFormatter(), new groupFooterFormatter(), new vt(), new yt(), new bt(), new Tt(), new Et(), new Pt(), new stylerHeader(), new renderFormatter(), new _t(), new wt(), new maxRows(), new xt(), new tableColumnH(), new tableE(), new tableQRCodeLevel(), new tablept(), new tableSummaryTitle(), new tableSummaryText(), new tableSummaryColspan(), new tableSummary(), new tableSummaryAlign(), new tableSummaryNumFormat(), new upperCase()]),
5746
- t
5767
+ (t._printElementOptionItems = [new fontFamily(), new r(), new a(), new p(), new i(), new s(), new l(), new pt(), new u(), new d(), new c(), new h(), new f(), new g(), new m(), new d2(), new c2(), new v(), new y(), new b(), new E(), new qrCodeLevel(), new T(), new P(), new _(), new w(), new x(), new coordinate(), new widthHeight(), new C(), new imageFit(), new O(), new H(), new D(), new paperNumberContinue(), new watermarkOptions(), new I(), new R(), new pageBreak(), new M(), new M2(), new S(), new B(), new F(), new L(), new A(), new z(), new k(), new st(), new N(), new V(), new W(), new j(), new U(), new zIndex(), new K(), new G(), new q(), new X(), new Y(), new Q(), new J(), new Z(), new tt(), new et(), new nt(), new it(), new ot(), new textWrap(), new at(), new lt(), new ut(), new ith(), new dt(), new ct(), new ht(), new ft(), new gt(), new mt(), new rowcolumns(), new rowsColumnsMergeClean(), new groupFieldsFormatter(), new groupFormatter(), new groupFooterFormatter(), new vt(), new yt(), new bt(), new Tt(), new Et(), new Pt(), new stylerHeader(), new renderFormatter(), new _t(), new wt(), new maxRows(), new xt(), new tableColumnH(), new tableE(), new tableQRCodeLevel(), new tablept(), new tableSummaryTitle(), new tableSummaryText(), new tableSummaryColspan(), new tableSummary(), new tableSummaryAlign(), new tableSummaryNumFormat(), new upperCase(), new tableFooterScope()],
5768
+ t
5769
+ )
5747
5770
  );
5748
5771
  })();
5749
5772
  },
@@ -855,6 +855,10 @@
855
855
  name: 'tableFooterRepeat',
856
856
  hidden: false
857
857
  },
858
+ {
859
+ name: 'tableFooterScope',
860
+ hidden: false
861
+ },
858
862
  {
859
863
  name: 'autoCompletion',
860
864
  hidden: false
@@ -1119,6 +1123,10 @@
1119
1123
  name: 'tableFooterRepeat',
1120
1124
  hidden: false
1121
1125
  },
1126
+ {
1127
+ name: 'tableFooterScope',
1128
+ hidden: false
1129
+ },
1122
1130
  {
1123
1131
  name: 'footerFormatter',
1124
1132
  hidden: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yh-hiprint",
3
- "version": "2.6.8",
3
+ "version": "2.6.11",
4
4
  "description": "Hiprint for Vue3 by NoahLiu in ForceCon in Hunan Changesha",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",