yh-hiprint 2.2.5 → 2.2.6
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/CHANGE.md +0 -0
- package/HiprintDesigner.vue +13 -5
- package/README.md +0 -0
- package/column-field.js +0 -0
- package/font-size.js +42 -42
- package/hiprint.js +0 -0
- package/hiprint.vue +0 -0
- package/hiprintPreview.vue +15 -1
- package/hooks/useHiprint.js +0 -0
- package/index.d.ts +0 -0
- package/index.js +0 -0
- package/libs/css/hiprint.css +996 -996
- package/libs/css/image/jquery.minicolors.png +0 -0
- package/libs/css/image/l_img.svg +0 -0
- package/libs/css/image/v_img.svg +0 -0
- package/libs/css/print-lock.css +339 -339
- package/libs/etypes/default-etyps-provider.js +157 -157
- package/libs/hiprint.bundle.js +0 -0
- package/libs/hiprint.config.js +1802 -1802
- package/libs/plugins/jquery.hiwprint.js +110 -110
- package/libs/plugins/qrcode.js +617 -617
- package/libs/plugins/watermark.js +199 -199
- package/package.json +1 -1
- package/panel.js +18 -18
- package/scale.js +42 -42
- package/z-index.js +0 -0
package/CHANGE.md
CHANGED
|
File without changes
|
package/HiprintDesigner.vue
CHANGED
|
@@ -265,24 +265,33 @@
|
|
|
265
265
|
</el-dialog>
|
|
266
266
|
</template>
|
|
267
267
|
<script setup lang="ts">
|
|
268
|
+
// @ts-nocheck
|
|
268
269
|
import { onMounted, ref, onActivated, onDeactivated, computed, watch } from "vue";
|
|
269
270
|
import { hiprint, defaultElementTypeProvider, fontSize, scale, zIndex, panel, usePaper, useScale, useDataSource, jquery as $ } from "yh-hiprint";
|
|
270
271
|
import { useRoute, onBeforeRouteUpdate } from "vue-router";
|
|
271
272
|
import { ElMessageBox, ElMessage } from "element-plus";
|
|
272
273
|
import axios from "@/libs/api.request";
|
|
273
274
|
|
|
275
|
+
interface HiprintTemplate {
|
|
276
|
+
setPaper: (width: number, height: number) => void;
|
|
277
|
+
zoom: (scale: number) => void;
|
|
278
|
+
getJson: () => any;
|
|
279
|
+
clear: () => void;
|
|
280
|
+
}
|
|
281
|
+
|
|
274
282
|
const route = useRoute();
|
|
283
|
+
const hiprintTemplate = ref<HiprintTemplate | null>(null);
|
|
284
|
+
|
|
275
285
|
const { paperType, paperWidth, paperHeight, setPaper } = usePaper();
|
|
276
286
|
function setPaperHandler(type) {
|
|
277
287
|
setPaper(type, () => {
|
|
278
|
-
hiprintTemplate.value
|
|
288
|
+
hiprintTemplate.value?.setPaper(paperWidth.value, paperHeight.value);
|
|
279
289
|
});
|
|
280
290
|
}
|
|
281
291
|
|
|
282
|
-
const hiprintTemplate = ref(null);
|
|
283
292
|
const canvasRef = ref();
|
|
284
293
|
const { scaleValue, scalePercentage, canZoomIn, canZoomOut, zoomIn, zoomOut } = useScale(() => {
|
|
285
|
-
hiprintTemplate.value
|
|
294
|
+
hiprintTemplate.value?.zoom(scaleValue.value);
|
|
286
295
|
canvasRef?.value.update();
|
|
287
296
|
});
|
|
288
297
|
|
|
@@ -327,7 +336,6 @@ async function previewPrint() {
|
|
|
327
336
|
previewShow.value = true;
|
|
328
337
|
} else {
|
|
329
338
|
ElMessage.warning({
|
|
330
|
-
title: "警告",
|
|
331
339
|
message: "模板配置不存在,请检查",
|
|
332
340
|
});
|
|
333
341
|
}
|
|
@@ -335,7 +343,7 @@ async function previewPrint() {
|
|
|
335
343
|
|
|
336
344
|
function saveConfig() {
|
|
337
345
|
let arr = [].concat(formCode.value);
|
|
338
|
-
let json = hiprintTemplate.value
|
|
346
|
+
let json = hiprintTemplate.value?.getJson();
|
|
339
347
|
json.panels[0].printElements.forEach((item) => {
|
|
340
348
|
if (item.printElementType.type === "table") {
|
|
341
349
|
arr.push(item.options.field);
|
package/README.md
CHANGED
|
File without changes
|
package/column-field.js
CHANGED
|
File without changes
|
package/font-size.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import $ from "jquery";
|
|
2
|
-
export default (function () {
|
|
3
|
-
function t() {
|
|
4
|
-
this.name = "fontSize"; // 重写的参数 key
|
|
5
|
-
}
|
|
6
|
-
// 涉及修改元素样式, 添加一个 css 方法
|
|
7
|
-
return (
|
|
8
|
-
(t.prototype.css = function (t, e) {
|
|
9
|
-
if (t && t.length) {
|
|
10
|
-
if (e) return t.css("font-size", e + "pt"), "font-size:" + e + "pt";
|
|
11
|
-
t[0].style.fontSize = "";
|
|
12
|
-
}
|
|
13
|
-
return null;
|
|
14
|
-
}),
|
|
15
|
-
// 创建 DOM
|
|
16
|
-
(t.prototype.createTarget = function () {
|
|
17
|
-
let list = [4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72];
|
|
18
|
-
let fontSizeList = '\n <option value="" >默认</option>';
|
|
19
|
-
list.forEach(function (e) {
|
|
20
|
-
fontSizeList += '\n <option value="' + e + '">' + e + "pt</option>";
|
|
21
|
-
});
|
|
22
|
-
this.target = $(' <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"> </select>\n </div>\n </div>');
|
|
23
|
-
this.target.find(".auto-submit").append($(fontSizeList));
|
|
24
|
-
return this.target;
|
|
25
|
-
}),
|
|
26
|
-
// 获取值
|
|
27
|
-
(t.prototype.getValue = function () {
|
|
28
|
-
var t = this.target.find("select").val();
|
|
29
|
-
if (t) return parseFloat(t.toString());
|
|
30
|
-
}),
|
|
31
|
-
// 设置值
|
|
32
|
-
(t.prototype.setValue = function (t) {
|
|
33
|
-
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('<option value="' + t + '" >' + t + "</option>"));
|
|
34
|
-
this.target.find("select").val(t);
|
|
35
|
-
}),
|
|
36
|
-
// 销毁 DOM
|
|
37
|
-
(t.prototype.destroy = function () {
|
|
38
|
-
this.target.remove();
|
|
39
|
-
}),
|
|
40
|
-
t
|
|
41
|
-
);
|
|
42
|
-
})();
|
|
1
|
+
import $ from "jquery";
|
|
2
|
+
export default (function () {
|
|
3
|
+
function t() {
|
|
4
|
+
this.name = "fontSize"; // 重写的参数 key
|
|
5
|
+
}
|
|
6
|
+
// 涉及修改元素样式, 添加一个 css 方法
|
|
7
|
+
return (
|
|
8
|
+
(t.prototype.css = function (t, e) {
|
|
9
|
+
if (t && t.length) {
|
|
10
|
+
if (e) return t.css("font-size", e + "pt"), "font-size:" + e + "pt";
|
|
11
|
+
t[0].style.fontSize = "";
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}),
|
|
15
|
+
// 创建 DOM
|
|
16
|
+
(t.prototype.createTarget = function () {
|
|
17
|
+
let list = [4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 22, 24, 26, 28, 36, 48, 72];
|
|
18
|
+
let fontSizeList = '\n <option value="" >默认</option>';
|
|
19
|
+
list.forEach(function (e) {
|
|
20
|
+
fontSizeList += '\n <option value="' + e + '">' + e + "pt</option>";
|
|
21
|
+
});
|
|
22
|
+
this.target = $(' <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"> </select>\n </div>\n </div>');
|
|
23
|
+
this.target.find(".auto-submit").append($(fontSizeList));
|
|
24
|
+
return this.target;
|
|
25
|
+
}),
|
|
26
|
+
// 获取值
|
|
27
|
+
(t.prototype.getValue = function () {
|
|
28
|
+
var t = this.target.find("select").val();
|
|
29
|
+
if (t) return parseFloat(t.toString());
|
|
30
|
+
}),
|
|
31
|
+
// 设置值
|
|
32
|
+
(t.prototype.setValue = function (t) {
|
|
33
|
+
t && (this.target.find('option[value="' + t + '"]').length || this.target.find("select").prepend('<option value="' + t + '" >' + t + "</option>"));
|
|
34
|
+
this.target.find("select").val(t);
|
|
35
|
+
}),
|
|
36
|
+
// 销毁 DOM
|
|
37
|
+
(t.prototype.destroy = function () {
|
|
38
|
+
this.target.remove();
|
|
39
|
+
}),
|
|
40
|
+
t
|
|
41
|
+
);
|
|
42
|
+
})();
|
package/hiprint.js
CHANGED
|
File without changes
|
package/hiprint.vue
CHANGED
|
File without changes
|
package/hiprintPreview.vue
CHANGED
|
@@ -17,8 +17,22 @@ import { useRoute } from "vue-router";
|
|
|
17
17
|
import axios from "@/libs/api.request.js";
|
|
18
18
|
import { hiprint } from "yh-hiprint";
|
|
19
19
|
|
|
20
|
+
function getQuery(){
|
|
21
|
+
let query = {}
|
|
22
|
+
try {
|
|
23
|
+
decodeURIComponent(location.hash).split("?")[1].split('&').forEach(str => {
|
|
24
|
+
let strArr = str.split("=");
|
|
25
|
+
query[strArr[0]] = strArr[1];
|
|
26
|
+
})
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error("hiprint Preview getQuery on error:",error);
|
|
29
|
+
}
|
|
30
|
+
return query
|
|
31
|
+
}
|
|
32
|
+
|
|
20
33
|
onMounted(() => {
|
|
21
|
-
let query =
|
|
34
|
+
let query = getQuery();
|
|
35
|
+
debugger;
|
|
22
36
|
if (query.code) {
|
|
23
37
|
sessionStorage.printQuery = JSON.stringify(query);
|
|
24
38
|
getData(query);
|
package/hooks/useHiprint.js
CHANGED
|
File without changes
|
package/index.d.ts
CHANGED
|
File without changes
|
package/index.js
CHANGED
|
File without changes
|