yh-hiprint 2.2.8 → 2.2.10

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/index.js CHANGED
@@ -1,65 +1,65 @@
1
- export { hiprint, defaultElementTypeProvider, print, print2, usePaper, useScale, useDataSource } from "./hooks/useHiprint";
2
-
3
- export { default as jquery } from "jquery";
4
- export { default as fontSize } from "./font-size";
5
- export { default as scale } from "./scale";
6
- export { default as zIndex } from "./z-index";
7
- export { default as panel } from "./panel";
8
-
9
- export function cLog(string, isError = false) {
10
- if (isError) {
11
- console.error("%cyhHiprint:%c", "font-size: 16px;font-weight: bold;color: #00ffff", "font-size: 16px;font-weight: bold;color: #ccccc", string);
12
- } else {
13
- console.log("%cyhHiprint%c " + string, "font-size: 18px;font-weight: bold;color: #61AFEF", "font-size: 12px;color: #999");
14
- }
15
- }
16
-
17
- const hiprint = ({ code, params, data, isCustom }) => {
18
- let height = document.documentElement.clientHeight;
19
- let width = (document.documentElement.clientWidth - 1200) / 2;
20
- // 转换数组
21
- let paramData = params;
22
- if (!Array.isArray(params)) {
23
- paramData = [params];
24
- }
25
- let url = "/hiprint/#/preview?code=" + code;
26
- if (params) {
27
- url += `&params=${JSON.stringify(paramData)}`;
28
- }
29
- if (data) {
30
- url += `&data=${JSON.stringify(data)}`;
31
- }
32
- if (isCustom) {
33
- url += `&isCustom=${isCustom ? "1" : "0"}`;
34
- }
35
- let windowOpen = window.open(url, "hiprintWindow", `height=${height}, width=1200, top=20, left=${width}, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no`);
36
- };
37
- export default {
38
- install(app, { router, pinia, isAdmin }) {
39
- app.provide("$hiprint", hiprint);
40
- if (router) {
41
- router.addRoute("Index", {
42
- path: "hiprint/designer",
43
- name: "打印设计器",
44
- meta: {
45
- icon: "md-planet",
46
- title: "打印设计器",
47
- },
48
- component: () => import("yh-hiprint/HiprintDesigner.vue"),
49
- });
50
- router.addRoute({
51
- path: "/preview",
52
- name: "printView",
53
- meta: {
54
- icon: "md-planet",
55
- title: "printView",
56
- },
57
- component: () => import("yh-hiprint/hiprintPreview.vue"),
58
- });
59
- } else {
60
- if (!router) {
61
- cLog("没有传递 router 对象,所以无法将路由添加到应用中", true);
62
- }
63
- }
64
- },
65
- };
1
+ export { hiprint, defaultElementTypeProvider, print, print2, usePaper, useScale, useDataSource } from "./hooks/useHiprint";
2
+
3
+ export { default as jquery } from "jquery";
4
+ export { default as fontSize } from "./font-size";
5
+ export { default as scale } from "./scale";
6
+ export { default as zIndex } from "./z-index";
7
+ export { default as panel } from "./panel";
8
+
9
+ export function cLog(string, isError = false) {
10
+ if (isError) {
11
+ console.error("%cyhHiprint:%c", "font-size: 16px;font-weight: bold;color: #00ffff", "font-size: 16px;font-weight: bold;color: #ccccc", string);
12
+ } else {
13
+ console.log("%cyhHiprint%c " + string, "font-size: 18px;font-weight: bold;color: #61AFEF", "font-size: 12px;color: #999");
14
+ }
15
+ }
16
+
17
+ const hiprint = ({ code, params, data, isCustom }) => {
18
+ let height = document.documentElement.clientHeight;
19
+ let width = (document.documentElement.clientWidth - 1200) / 2;
20
+ // 转换数组
21
+ let paramData = params;
22
+ if (!Array.isArray(params)) {
23
+ paramData = [params];
24
+ }
25
+ let url = "/hiprint/#/preview?code=" + code;
26
+ if (params) {
27
+ url += `&params=${JSON.stringify(paramData)}`;
28
+ }
29
+ if (data) {
30
+ url += `&data=${JSON.stringify(data)}`;
31
+ }
32
+ if (isCustom) {
33
+ url += `&isCustom=${isCustom ? "1" : "0"}`;
34
+ }
35
+ let windowOpen = window.open(url, "hiprintWindow", `height=${height}, width=1200, top=20, left=${width}, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no`);
36
+ };
37
+ export default {
38
+ install(app, { router, pinia, isAdmin }) {
39
+ app.provide("$hiprint", hiprint);
40
+ if (router) {
41
+ router.addRoute("Index", {
42
+ path: "hiprint/designer",
43
+ name: "打印设计器",
44
+ meta: {
45
+ icon: "md-planet",
46
+ title: "打印设计器",
47
+ },
48
+ component: () => import("yh-hiprint/HiprintDesigner.vue"),
49
+ });
50
+ router.addRoute({
51
+ path: "/preview",
52
+ name: "printView",
53
+ meta: {
54
+ icon: "md-planet",
55
+ title: "printView",
56
+ },
57
+ component: () => import("yh-hiprint/hiprintPreview.vue"),
58
+ });
59
+ } else {
60
+ if (!router) {
61
+ cLog("没有传递 router 对象,所以无法将路由添加到应用中", true);
62
+ }
63
+ }
64
+ },
65
+ };