orion-design 0.1.31 → 0.1.32
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -5
- package/dist/Throne/index.js +14 -30
- package/dist/Throne/index.js.map +1 -1
- package/dist/components/Button/index.js +33 -40
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Flex/index.js +89 -122
- package/dist/components/Flex/index.js.map +1 -1
- package/dist/components/Form/Form.js +2 -2
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.js +2 -2
- package/dist/components/Form/LovInput/LovInput.js.map +1 -1
- package/dist/components/Form/LovInput/hooks/useLov.js +5 -5
- package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -1
- package/dist/components/Form/LovInput/index.js +4 -4
- package/dist/components/Form/hooks/FormItemValidateTrigger.js +2 -2
- package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -1
- package/dist/components/Form/hooks/index.js +68 -127
- package/dist/components/Form/hooks/index.js.map +1 -1
- package/dist/components/Form/index.js +656 -836
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Form/utils/index.js +18 -30
- package/dist/components/Form/utils/index.js.map +1 -1
- package/dist/components/LovTable/LovPagetable.vue.d.ts +492 -0
- package/dist/components/LovTable/index.d.ts +246 -0
- package/dist/components/LovTable/index.js +106 -179
- package/dist/components/LovTable/index.js.map +1 -1
- package/dist/components/Modal/index.js +56 -111
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/types.d.ts +1 -1
- package/dist/components/Modal/types.js +3 -4
- package/dist/components/Modal/types.js.map +1 -1
- package/dist/components/Modal/useModal.js +5 -5
- package/dist/components/Modal/useModal.js.map +1 -1
- package/dist/components/Pagetable/Pagetable.d.ts +92 -1
- package/dist/components/Pagetable/columns/PagetableColumnButtongroup.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnDate.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnLink.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnMultiselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnNumber.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnSingleselect.d.ts +13 -0
- package/dist/components/Pagetable/columns/PagetableColumnString.d.ts +13 -0
- package/dist/components/Pagetable/hooks/useColumns.js +85 -88
- package/dist/components/Pagetable/hooks/useColumns.js.map +1 -1
- package/dist/components/Pagetable/index.d.ts +155 -0
- package/dist/components/Pagetable/index.js +596 -683
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +54 -92
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/hooks/useColumns.js +74 -82
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -1
- package/dist/components/Querytable/index.js +469 -579
- package/dist/components/Querytable/index.js.map +1 -1
- package/dist/components/Querytable/utils/index.js +54 -92
- package/dist/components/Querytable/utils/index.js.map +1 -1
- package/dist/components/RichTextEditor/index.js +74 -100
- package/dist/components/RichTextEditor/index.js.map +1 -1
- package/dist/components/Tabs/constants.js +2 -2
- package/dist/components/Tabs/constants.js.map +1 -1
- package/dist/components/Tabs/index.js +358 -603
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Tabs/tab-bar.js +6 -6
- package/dist/components/Tabs/tab-bar.js.map +1 -1
- package/dist/components/Tabs/tab-pane.js +3 -3
- package/dist/components/Tabs/tab-pane.js.map +1 -1
- package/dist/components/_constants/aria.js +2 -2
- package/dist/components/_constants/aria.js.map +1 -1
- package/dist/components/_constants/event.js +4 -6
- package/dist/components/_constants/event.js.map +1 -1
- package/dist/components/_constants/index.js +6 -6
- package/dist/components/_hooks/index.js +7 -7
- package/dist/components/_hooks/use-namespace/index.js +39 -74
- package/dist/components/_hooks/use-namespace/index.js.map +1 -1
- package/dist/components/_hooks/use-ordered-children/index.js +19 -29
- package/dist/components/_hooks/use-ordered-children/index.js.map +1 -1
- package/dist/components/_util/arrays.js +5 -9
- package/dist/components/_util/arrays.js.map +1 -1
- package/dist/components/_util/browser.js +6 -6
- package/dist/components/_util/browser.js.map +1 -1
- package/dist/components/_util/classNames.js +17 -22
- package/dist/components/_util/classNames.js.map +1 -1
- package/dist/components/_util/dom/aria.js +39 -74
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js +8 -9
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js +7 -14
- package/dist/components/_util/dom/event.js.map +1 -1
- package/dist/components/_util/dom/index.js +36 -36
- package/dist/components/_util/dom/position.js +25 -49
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js +61 -103
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js +50 -65
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js +4 -8
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js +11 -12
- package/dist/components/_util/error.js.map +1 -1
- package/dist/components/_util/functions.js +3 -3
- package/dist/components/_util/i18n.js +2 -2
- package/dist/components/_util/i18n.js.map +1 -1
- package/dist/components/_util/index.js +137 -137
- package/dist/components/_util/isValid.js +2 -4
- package/dist/components/_util/isValid.js.map +1 -1
- package/dist/components/_util/objects.js +14 -18
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/props-util/index.js +20 -46
- package/dist/components/_util/props-util/index.js.map +1 -1
- package/dist/components/_util/props-util/initDefaultProps.js +10 -18
- package/dist/components/_util/props-util/initDefaultProps.js.map +1 -1
- package/dist/components/_util/raf.js +4 -5
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js +3 -4
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js +8 -9
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js +10 -16
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/type.js +38 -41
- package/dist/components/_util/type.js.map +1 -1
- package/dist/components/_util/types.js +22 -41
- package/dist/components/_util/types.js.map +1 -1
- package/dist/components/_util/typescript.js +2 -2
- package/dist/components/_util/typescript.js.map +1 -1
- package/dist/components/_util/util.js +43 -85
- package/dist/components/_util/util.js.map +1 -1
- package/dist/components/_util/vue/global-node.js +15 -27
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js +25 -29
- package/dist/components/_util/vue/icon.js.map +1 -1
- package/dist/components/_util/vue/index.js +41 -41
- package/dist/components/_util/vue/install.js +18 -35
- package/dist/components/_util/vue/install.js.map +1 -1
- package/dist/components/_util/vue/props/index.js +6 -6
- package/dist/components/_util/vue/props/runtime.js +30 -46
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js +6 -12
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js +3 -5
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js +4 -5
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js +54 -100
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/_util/vue-types/index.js +220 -231
- package/dist/components/_util/vue-types/index.js.map +1 -1
- package/dist/components/components.js +20 -20
- package/dist/components/index.js +35 -38
- package/dist/components/index.js.map +1 -1
- package/dist/error/OrionError.js +4 -8
- package/dist/error/OrionError.js.map +1 -1
- package/dist/index.css +1 -797
- package/dist/index.js +36 -36
- package/dist/print/LodopFuncs.js +43 -101
- package/dist/print/LodopFuncs.js.map +1 -1
- package/dist/print/index.js +108 -200
- package/dist/print/index.js.map +1 -1
- package/dist/request/ErrorHandlerChain.js +14 -17
- package/dist/request/ErrorHandlerChain.js.map +1 -1
- package/dist/request/RequestFilterChain.js +13 -16
- package/dist/request/RequestFilterChain.js.map +1 -1
- package/dist/request/ResponseParserChain.js +14 -17
- package/dist/request/ResponseParserChain.js.map +1 -1
- package/dist/request/disivion/DateSerializer.js +22 -47
- package/dist/request/disivion/DateSerializer.js.map +1 -1
- package/dist/request/disivion/DivisionErrorHandler.js +25 -40
- package/dist/request/disivion/DivisionErrorHandler.js.map +1 -1
- package/dist/request/disivion/DivisionResponseParser.js +10 -16
- package/dist/request/disivion/DivisionResponseParser.js.map +1 -1
- package/dist/request/disivion/index.js +201 -305
- package/dist/request/disivion/index.js.map +1 -1
- package/dist/request/error/BizExceptionResponseError.js +5 -11
- package/dist/request/error/BizExceptionResponseError.js.map +1 -1
- package/dist/request/error/ExceptionResponseError.js +5 -11
- package/dist/request/error/ExceptionResponseError.js.map +1 -1
- package/dist/request/error/ResponseError.js +4 -9
- package/dist/request/error/ResponseError.js.map +1 -1
- package/dist/request/error/SessionExceptionResponseError.js +5 -11
- package/dist/request/error/SessionExceptionResponseError.js.map +1 -1
- package/dist/request/index.js +11 -11
- package/dist/utils/DateUtil.js +33 -48
- package/dist/utils/DateUtil.js.map +1 -1
- package/dist/utils/NumberUtil.js +6 -6
- package/dist/utils/NumberUtil.js.map +1 -1
- package/dist/utils/cloneDeep.js +2 -2
- package/dist/utils/delay.js +3 -3
- package/dist/utils/delay.js.map +1 -1
- package/dist/utils/functions.js +3 -3
- package/dist/utils/index.js +12 -12
- package/dist/utils/md5.js +93 -191
- package/dist/utils/md5.js.map +1 -1
- package/dist/utils/uuid.js +25 -35
- package/dist/utils/uuid.js.map +1 -1
- package/dist/version/index.js +2 -2
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +2 -2
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
- package/dist/_commonjsHelpers-DWwsNxpa.js +0 -9
- package/dist/_commonjsHelpers-DWwsNxpa.js.map +0 -1
- package/dist/components-B3d9m_tn.js +0 -27
- package/dist/components-B3d9m_tn.js.map +0 -1
- package/dist/functions-BeMkokbY.js +0 -63
- package/dist/functions-BeMkokbY.js.map +0 -1
- package/dist/index-BOKLZnqH.js +0 -54
- package/dist/index-BOKLZnqH.js.map +0 -1
- package/dist/index-D1m0KTpK.js +0 -69
- package/dist/index-D1m0KTpK.js.map +0 -1
- package/dist/index-DR5ZP7mD.js +0 -160
- package/dist/index-DR5ZP7mD.js.map +0 -1
- package/dist/index-DkwIULcN.js +0 -200
- package/dist/index-DkwIULcN.js.map +0 -1
package/dist/print/index.js
CHANGED
@@ -1,218 +1,126 @@
|
|
1
|
-
import
|
2
|
-
import { getLodop } from "./LodopFuncs.js";
|
3
|
-
function
|
4
|
-
const
|
5
|
-
return new Promise((
|
6
|
-
|
1
|
+
import d from "../error/OrionError.js";
|
2
|
+
import { getLodop as c } from "./LodopFuncs.js";
|
3
|
+
function R() {
|
4
|
+
const _ = c();
|
5
|
+
return new Promise((e) => {
|
6
|
+
e(_);
|
7
7
|
});
|
8
8
|
}
|
9
|
-
function
|
10
|
-
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
content: LODOP.GET_PRINTER_NAME(i)
|
9
|
+
function g() {
|
10
|
+
R();
|
11
|
+
const _ = [], e = LODOP.GET_PRINTER_COUNT();
|
12
|
+
for (let t = 0; t < e; t++)
|
13
|
+
_.push({
|
14
|
+
value: t,
|
15
|
+
content: LODOP.GET_PRINTER_NAME(t)
|
17
16
|
});
|
18
|
-
|
19
|
-
return printers;
|
17
|
+
return _;
|
20
18
|
}
|
21
|
-
function
|
22
|
-
|
23
|
-
const
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
content: prname
|
19
|
+
function h() {
|
20
|
+
R();
|
21
|
+
const _ = [], e = LODOP.GET_PRINTER_COUNT();
|
22
|
+
for (let t = 0; t < e; t++) {
|
23
|
+
const i = LODOP.GET_PRINTER_NAME(t);
|
24
|
+
_.push({
|
25
|
+
value: i,
|
26
|
+
content: i
|
30
27
|
});
|
31
28
|
}
|
32
|
-
return
|
29
|
+
return _;
|
33
30
|
}
|
34
|
-
async function
|
35
|
-
|
36
|
-
return LODOP2.GET_PRINTER_NAME(-1);
|
31
|
+
async function l() {
|
32
|
+
return (await R()).GET_PRINTER_NAME(-1);
|
37
33
|
}
|
38
|
-
async function
|
39
|
-
if (!
|
40
|
-
throw new
|
41
|
-
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
let
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
let
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
let
|
56
|
-
|
57
|
-
|
58
|
-
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
}
|
63
|
-
let print_duplex = 0;
|
64
|
-
if (print_para.print_duplex) {
|
65
|
-
print_duplex = print_para.print_duplex;
|
66
|
-
}
|
67
|
-
let print_defaultsource = 0;
|
68
|
-
if (print_para.print_defaultsource) {
|
69
|
-
print_defaultsource = print_para.print_defaultsource;
|
70
|
-
}
|
71
|
-
LODOP2.PRINT_INIT("");
|
72
|
-
if (print_para.print_mode_map) {
|
73
|
-
Object.keys(print_para.print_mode_map).map((item) => {
|
74
|
-
LODOP2.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
|
75
|
-
});
|
76
|
-
}
|
77
|
-
LODOP2.SET_PRINT_MODE("PRINT_DUPLEX", print_duplex ? print_duplex : 0);
|
78
|
-
LODOP2.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", print_defaultsource ? print_defaultsource : 0);
|
79
|
-
LODOP2.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
|
80
|
-
LODOP2.ADD_PRINT_PDF(0, 0, "100%", "100%", new URL(pdfurl, import.meta.url));
|
81
|
-
LODOP2.SET_SHOW_MODE("HIDE_PAPER_BOARD", true);
|
82
|
-
LODOP2.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, "预览查看.开始打印");
|
83
|
-
LODOP2.SET_PRINT_MODE("CATCH_PRINT_STATUS", true);
|
84
|
-
return new Promise((resolve) => {
|
85
|
-
LODOP2.On_Return = function(TaskID, Value) {
|
86
|
-
resolve(Value);
|
87
|
-
};
|
88
|
-
LODOP2.PREVIEW();
|
34
|
+
async function s(_) {
|
35
|
+
if (!_)
|
36
|
+
throw new d("打印异常:入参为空,请检查");
|
37
|
+
const { pdfurl: e, print_para: t = {} } = _;
|
38
|
+
if (!e)
|
39
|
+
throw new d("打印异常:未知的文件地址[" + e + "],无法进行打印");
|
40
|
+
const i = await R();
|
41
|
+
let P = 0;
|
42
|
+
t.page_width != 0 && typeof t.page_width < "u" && (P = t.page_width);
|
43
|
+
let f = 0;
|
44
|
+
t.page_height != 0 && typeof t.page_height < "u" && (f = t.page_height);
|
45
|
+
let u = "";
|
46
|
+
t.page_type && (u = t.page_type);
|
47
|
+
let T = 1;
|
48
|
+
t.direction && (T = t.direction);
|
49
|
+
let o = 0;
|
50
|
+
t.print_duplex && (o = t.print_duplex);
|
51
|
+
let n = 0;
|
52
|
+
return t.print_defaultsource && (n = t.print_defaultsource), i.PRINT_INIT(""), t.print_mode_map && Object.keys(t.print_mode_map).map((E) => {
|
53
|
+
i.SET_PRINT_MODE(E, t.print_mode_map[E]);
|
54
|
+
}), i.SET_PRINT_MODE("PRINT_DUPLEX", o || 0), i.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", n || 0), i.SET_PRINT_PAGESIZE(T, P, f, u), i.ADD_PRINT_PDF(0, 0, "100%", "100%", new URL(e, import.meta.url)), i.SET_SHOW_MODE("HIDE_PAPER_BOARD", !0), i.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, "预览查看.开始打印"), i.SET_PRINT_MODE("CATCH_PRINT_STATUS", !0), new Promise((E) => {
|
55
|
+
i.On_Return = function(I, N) {
|
56
|
+
E(N);
|
57
|
+
}, i.PREVIEW();
|
89
58
|
});
|
90
59
|
}
|
91
|
-
async function
|
92
|
-
if (!
|
93
|
-
throw new
|
94
|
-
}
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
}
|
99
|
-
if (printer) {
|
100
|
-
return await printWithCertainPrinter(pdfurl, print_para, printer);
|
101
|
-
} else {
|
102
|
-
return await printNeedSelectPrinter(pdfurl, print_para);
|
103
|
-
}
|
60
|
+
async function w(_) {
|
61
|
+
if (!_)
|
62
|
+
throw new d("打印异常:入参为空,请检查");
|
63
|
+
const { pdfurl: e, print_para: t = {}, printer: i } = _;
|
64
|
+
if (!e)
|
65
|
+
throw new d("打印异常:未知的文件地址[" + e + "],无法进行打印");
|
66
|
+
return i ? await O(e, t, i) : await r(e, t);
|
104
67
|
}
|
105
|
-
async function
|
106
|
-
if (!
|
107
|
-
throw new
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
let
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
let
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
let
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
if (print_para.print_duplex) {
|
130
|
-
print_duplex = print_para.print_duplex;
|
131
|
-
}
|
132
|
-
let print_defaultsource = 0;
|
133
|
-
if (print_para.print_defaultsource) {
|
134
|
-
print_defaultsource = print_para.print_defaultsource;
|
135
|
-
}
|
136
|
-
const LODOP2 = await lodopInit();
|
137
|
-
LODOP2.PRINT_INIT("");
|
138
|
-
if (pr_name === -1) {
|
139
|
-
LODOP2.SET_PRINTER_INDEXA(LODOP2.GET_PRINTER_NAME(-1));
|
140
|
-
} else {
|
141
|
-
LODOP2.SET_PRINTER_INDEXA(pr_name);
|
142
|
-
}
|
143
|
-
LODOP2.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
|
144
|
-
if (print_para.print_mode_map) {
|
145
|
-
Object.keys(print_para.print_mode_map).map((item) => {
|
146
|
-
LODOP2.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
|
147
|
-
});
|
148
|
-
}
|
149
|
-
LODOP2.SET_PRINT_MODE("PRINT_DUPLEX", print_duplex ? print_duplex : 0);
|
150
|
-
LODOP2.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", print_defaultsource ? print_defaultsource : 0);
|
151
|
-
LODOP2.ADD_PRINT_PDF(0, 0, "100%", "100%", new URL(pdfurl, import.meta.url));
|
152
|
-
LODOP2.SET_PRINT_MODE("CATCH_PRINT_STATUS", true);
|
153
|
-
return new Promise((resolve) => {
|
154
|
-
LODOP2.On_Return = function(TaskID, Value) {
|
155
|
-
resolve(Value);
|
156
|
-
};
|
157
|
-
LODOP2.PRINT();
|
68
|
+
async function O(_, e = {}, t) {
|
69
|
+
if (!_)
|
70
|
+
throw new d("打印异常:未知的文件地址[" + _ + "],无法进行打印");
|
71
|
+
if (!t)
|
72
|
+
throw new d("打印异常:未设置打印机,无法进行打印");
|
73
|
+
let i = 0;
|
74
|
+
e.page_width != 0 && typeof e.page_width < "u" && (i = e.page_width);
|
75
|
+
let P = 0;
|
76
|
+
e.page_height != 0 && typeof e.page_height < "u" && (P = e.page_height);
|
77
|
+
let f = "";
|
78
|
+
e.page_type && (f = e.page_type);
|
79
|
+
let u = 1;
|
80
|
+
e.direction && (u = e.direction);
|
81
|
+
let T = 0;
|
82
|
+
e.print_duplex && (T = e.print_duplex);
|
83
|
+
let o = 0;
|
84
|
+
e.print_defaultsource && (o = e.print_defaultsource);
|
85
|
+
const n = await R();
|
86
|
+
return n.PRINT_INIT(""), t === -1 ? n.SET_PRINTER_INDEXA(n.GET_PRINTER_NAME(-1)) : n.SET_PRINTER_INDEXA(t), n.SET_PRINT_PAGESIZE(u, i, P, f), e.print_mode_map && Object.keys(e.print_mode_map).map((E) => {
|
87
|
+
n.SET_PRINT_MODE(E, e.print_mode_map[E]);
|
88
|
+
}), n.SET_PRINT_MODE("PRINT_DUPLEX", T || 0), n.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", o || 0), n.ADD_PRINT_PDF(0, 0, "100%", "100%", new URL(_, import.meta.url)), n.SET_PRINT_MODE("CATCH_PRINT_STATUS", !0), new Promise((E) => {
|
89
|
+
n.On_Return = function(I, N) {
|
90
|
+
E(N);
|
91
|
+
}, n.PRINT();
|
158
92
|
});
|
159
93
|
}
|
160
|
-
async function
|
161
|
-
if (
|
162
|
-
throw new
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
let print_duplex = 0;
|
182
|
-
if (print_para.print_duplex) {
|
183
|
-
print_duplex = print_para.print_duplex;
|
184
|
-
}
|
185
|
-
let print_defaultsource = 0;
|
186
|
-
if (print_para.print_defaultsource) {
|
187
|
-
print_defaultsource = print_para.print_defaultsource;
|
188
|
-
}
|
189
|
-
LODOP2.PRINT_INIT("");
|
190
|
-
if (print_para.print_mode_map) {
|
191
|
-
Object.keys(print_para.print_mode_map).map((item) => {
|
192
|
-
LODOP2.SET_PRINT_MODE(item, print_para.print_mode_map[item]);
|
193
|
-
});
|
194
|
-
}
|
195
|
-
LODOP2.SET_PRINT_MODE("PRINT_DUPLEX", print_duplex ? print_duplex : 0);
|
196
|
-
LODOP2.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", print_defaultsource ? print_defaultsource : 0);
|
197
|
-
LODOP2.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type);
|
198
|
-
LODOP2.ADD_PRINT_PDF(0, 0, "100%", "100%", url);
|
199
|
-
LODOP2.SET_SHOW_MODE("HIDE_PAPER_BOARD", true);
|
200
|
-
LODOP2.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, "预览查看.开始打印");
|
201
|
-
LODOP2.SET_PRINT_MODE("CATCH_PRINT_STATUS", true);
|
202
|
-
return new Promise((resolve) => {
|
203
|
-
LODOP2.On_Return = function(TaskID, Value) {
|
204
|
-
resolve(Value);
|
205
|
-
};
|
206
|
-
LODOP2.PRINTA();
|
94
|
+
async function r(_, e = {}) {
|
95
|
+
if (_ === null || _ === "" || typeof _ > "u")
|
96
|
+
throw new d("打印异常:未知的文件地址[" + _ + "],无法进行打印");
|
97
|
+
const t = await R();
|
98
|
+
let i = 0;
|
99
|
+
e.page_width != 0 && typeof e.page_width < "u" && (i = e.page_width);
|
100
|
+
let P = 0;
|
101
|
+
e.page_height != 0 && typeof e.page_height < "u" && (P = e.page_height);
|
102
|
+
let f = "";
|
103
|
+
e.page_type && (f = e.page_type);
|
104
|
+
let u = 1;
|
105
|
+
e.direction && (u = e.direction);
|
106
|
+
let T = 0;
|
107
|
+
e.print_duplex && (T = e.print_duplex);
|
108
|
+
let o = 0;
|
109
|
+
return e.print_defaultsource && (o = e.print_defaultsource), t.PRINT_INIT(""), e.print_mode_map && Object.keys(e.print_mode_map).map((n) => {
|
110
|
+
t.SET_PRINT_MODE(n, e.print_mode_map[n]);
|
111
|
+
}), t.SET_PRINT_MODE("PRINT_DUPLEX", T || 0), t.SET_PRINT_MODE("PRINT_DEFAULTSOURCE", o || 0), t.SET_PRINT_PAGESIZE(u, i, P, f), t.ADD_PRINT_PDF(0, 0, "100%", "100%", _), t.SET_SHOW_MODE("HIDE_PAPER_BOARD", !0), t.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, "预览查看.开始打印"), t.SET_PRINT_MODE("CATCH_PRINT_STATUS", !0), new Promise((n) => {
|
112
|
+
t.On_Return = function(E, I) {
|
113
|
+
n(I);
|
114
|
+
}, t.PRINTA();
|
207
115
|
});
|
208
116
|
}
|
209
117
|
export {
|
210
|
-
getDefaultPrinter,
|
211
|
-
getPrinterList,
|
212
|
-
getPrinterNameList,
|
213
|
-
lodopInit,
|
214
|
-
preview,
|
215
|
-
print,
|
216
|
-
printNeedSelectPrinter
|
118
|
+
l as getDefaultPrinter,
|
119
|
+
g as getPrinterList,
|
120
|
+
h as getPrinterNameList,
|
121
|
+
R as lodopInit,
|
122
|
+
s as preview,
|
123
|
+
w as print,
|
124
|
+
r as printNeedSelectPrinter
|
217
125
|
};
|
218
126
|
//# sourceMappingURL=index.js.map
|
package/dist/print/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/print/index.ts"],"sourcesContent":["// @ts-nocheck\r\nimport OrionError from '../error/OrionError'\r\nimport { getLodop } from './LodopFuncs'\r\n\r\nexport function lodopInit() {\r\n // 获取lodop\r\n const LODOP = getLodop()\r\n\r\n return new Promise((resolve) => {\r\n resolve(LODOP)\r\n })\r\n}\r\n\r\n// 获取打印机列表\r\nexport function getPrinterList() {\r\n lodopInit()\r\n const printers = []\r\n const count = LODOP.GET_PRINTER_COUNT()\r\n for (let i = 0; i < count; i++) {\r\n printers.push({\r\n value: i,\r\n content: LODOP.GET_PRINTER_NAME(i),\r\n })\r\n }\r\n\r\n return printers\r\n}\r\n\r\n// 获取打印机名称列表\r\nexport function getPrinterNameList() {\r\n lodopInit()\r\n const printers = []\r\n const count = LODOP.GET_PRINTER_COUNT()\r\n for (let i = 0; i < count; i++) {\r\n const prname = LODOP.GET_PRINTER_NAME(i)\r\n printers.push({\r\n value: prname,\r\n content: prname,\r\n })\r\n }\r\n\r\n return printers\r\n}\r\n\r\n//////////////////////////////////// 接口\r\n\r\n// 获取默认打印机名称\r\nexport async function getDefaultPrinter() {\r\n const LODOP = await lodopInit()\r\n return LODOP.GET_PRINTER_NAME(-1) // 获取默认打印机名称(-1是指定默认打印机)\r\n}\r\n\r\nexport interface PrintParaI {\r\n direction?: 1 | 2 | 3 | 0 // 1纵向;2横向;3纵向,高度自适应;0方向不定\r\n page_width?: number // 纸张宽度,默认为0\r\n page_height?: number // 纸张高度,默认为0\r\n page_type?: string // 纸张类型\r\n print_duplex?: 0 | 1 | 2 | 3 // 双面打印,默认为0 0-不控制 1-不双面 2-双面(长边装订) 3-小册子双面(短边装订_长边水平)\r\n print_defaultsource?: 0 | 1 | 4 | 7 // 双面打印方式,默认为0 1-纸盒 4-手动 7-自动 0-不控制\r\n print_mode_map?: {\r\n // 扩展接口,打印第三方文件时可能需要调优,参数可参考lodop官方文档的LODOP.SET_PRINT_MODE方法\r\n PRINT_PAGE_PERCENT: string // 指定整页缩放打印的比例 格式为Full-Width | Full-Height | Full-Page | “Width:XX%;Height:XX%”\r\n }\r\n}\r\n\r\n// 无打印模板,预览打印\r\nexport async function preview(params: { pdfurl: string; print_para?: PrintParaI }) {\r\n if (!params) {\r\n throw new OrionError('打印异常:入参为空,请检查')\r\n }\r\n\r\n const { pdfurl, print_para = {} } = params\r\n\r\n if (!pdfurl) {\r\n throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印')\r\n }\r\n\r\n const LODOP = await lodopInit()\r\n\r\n //获取传入的打印参数\r\n let page_width = 0\r\n if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {\r\n page_width = print_para.page_width\r\n }\r\n let page_height = 0\r\n if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {\r\n page_height = print_para.page_height\r\n }\r\n let page_type = ''\r\n if (print_para.page_type) {\r\n page_type = print_para.page_type\r\n }\r\n let direction = 1\r\n if (print_para.direction) {\r\n direction = print_para.direction\r\n }\r\n let print_duplex = 0\r\n if (print_para.print_duplex) {\r\n print_duplex = print_para.print_duplex\r\n }\r\n let print_defaultsource = 0\r\n if (print_para.print_defaultsource) {\r\n print_defaultsource = print_para.print_defaultsource\r\n }\r\n\r\n // 历史问题,防止重复打印的问题\r\n LODOP.PRINT_INIT('')\r\n\r\n if (print_para.print_mode_map) {\r\n Object.keys(print_para.print_mode_map).map((item) => {\r\n LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item])\r\n })\r\n }\r\n LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0)\r\n LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0)\r\n LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type)\r\n LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url))\r\n LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true) // 移除预览的线条\r\n LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印') // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名\r\n LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true) //返回打印机状态\r\n\r\n return new Promise((resolve) => {\r\n LODOP.On_Return = function (TaskID, Value) {\r\n resolve(Value)\r\n }\r\n LODOP.PREVIEW()\r\n })\r\n}\r\n\r\nexport async function print(params: { pdfurl: string; print_para?: PrintParaI; printer?: string | -1 }) {\r\n if (!params) {\r\n throw new OrionError('打印异常:入参为空,请检查')\r\n }\r\n\r\n const { pdfurl, print_para = {}, printer } = params\r\n\r\n if (!pdfurl) {\r\n throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印')\r\n }\r\n\r\n if (printer) {\r\n return await printWithCertainPrinter(pdfurl, print_para, printer)\r\n } else {\r\n // 没设置打印机\r\n return await printNeedSelectPrinter(pdfurl, print_para)\r\n }\r\n}\r\n\r\nasync function printWithCertainPrinter(pdfurl: string, print_para: PrintParaI = {}, pr_name: string | -1) {\r\n if (!pdfurl) {\r\n throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印')\r\n }\r\n if (!pr_name) {\r\n throw new OrionError('打印异常:未设置打印机,无法进行打印')\r\n }\r\n\r\n //获取传入的打印参数\r\n let page_width = 0\r\n if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {\r\n page_width = print_para.page_width\r\n }\r\n let page_height = 0\r\n if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {\r\n page_height = print_para.page_height\r\n }\r\n let page_type = ''\r\n if (print_para.page_type) {\r\n page_type = print_para.page_type\r\n }\r\n let direction = 1\r\n if (print_para.direction) {\r\n direction = print_para.direction\r\n }\r\n let print_duplex = 0\r\n if (print_para.print_duplex) {\r\n print_duplex = print_para.print_duplex\r\n }\r\n let print_defaultsource = 0\r\n if (print_para.print_defaultsource) {\r\n print_defaultsource = print_para.print_defaultsource\r\n }\r\n\r\n const LODOP = await lodopInit()\r\n // 指定打印设备(打印机)\r\n LODOP.PRINT_INIT('')\r\n // 设置了打印机\r\n if (pr_name === -1) {\r\n LODOP.SET_PRINTER_INDEXA(LODOP.GET_PRINTER_NAME(-1))\r\n } else {\r\n LODOP.SET_PRINTER_INDEXA(pr_name)\r\n }\r\n LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type)\r\n if (print_para.print_mode_map) {\r\n Object.keys(print_para.print_mode_map).map((item) => {\r\n LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item])\r\n })\r\n }\r\n LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0)\r\n LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0)\r\n LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url))\r\n LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true) //返回打印机状态\r\n\r\n return new Promise((resolve) => {\r\n LODOP.On_Return = function (TaskID, Value) {\r\n resolve(Value)\r\n }\r\n LODOP.PRINT()\r\n })\r\n}\r\n\r\n// 无打印模板,直接打印,需要选择打印机\r\nexport async function printNeedSelectPrinter(url: string, print_para: PrintParaI = {}) {\r\n if (url === null || url === '' || typeof url === 'undefined') {\r\n throw new OrionError('打印异常:未知的文件地址[' + url + '],无法进行打印')\r\n }\r\n\r\n const LODOP = await lodopInit()\r\n\r\n //获取传入的打印参数\r\n let page_width = 0\r\n if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {\r\n page_width = print_para.page_width\r\n }\r\n let page_height = 0\r\n if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {\r\n page_height = print_para.page_height\r\n }\r\n let page_type = ''\r\n if (print_para.page_type) {\r\n page_type = print_para.page_type\r\n }\r\n let direction = 1\r\n if (print_para.direction) {\r\n direction = print_para.direction\r\n }\r\n let print_duplex = 0\r\n if (print_para.print_duplex) {\r\n print_duplex = print_para.print_duplex\r\n }\r\n let print_defaultsource = 0\r\n if (print_para.print_defaultsource) {\r\n print_defaultsource = print_para.print_defaultsource\r\n }\r\n\r\n // 历史问题,防止重复打印的问题\r\n LODOP.PRINT_INIT('')\r\n\r\n if (print_para.print_mode_map) {\r\n Object.keys(print_para.print_mode_map).map((item) => {\r\n LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item])\r\n })\r\n }\r\n\r\n LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0)\r\n LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0)\r\n LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type)\r\n LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', url)\r\n LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true) // 移除预览的线条\r\n LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印') // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名\r\n\r\n //返回打印机状态\r\n LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)\r\n\r\n return new Promise((resolve) => {\r\n LODOP.On_Return = function (TaskID, Value) {\r\n resolve(Value)\r\n }\r\n LODOP.PRINTA()\r\n })\r\n}\r\n"],"names":["LODOP"],"mappings":";;AAIO,SAAS,YAAY;AAE1B,QAAMA,SAAQ;AAEP,SAAA,IAAI,QAAQ,CAAC,YAAY;AAC9B,YAAQA,MAAK;AAAA,EAAA,CACd;AACH;AAGO,SAAS,iBAAiB;AACrB;AACV,QAAM,WAAW,CAAA;AACX,QAAA,QAAQ,MAAM;AACpB,WAAS,IAAI,GAAG,IAAI,OAAO,KAAK;AAC9B,aAAS,KAAK;AAAA,MACZ,OAAO;AAAA,MACP,SAAS,MAAM,iBAAiB,CAAC;AAAA,IAAA,CAClC;AAAA,EACH;AAEO,SAAA;AACT;AAGO,SAAS,qBAAqB;AACzB;AACV,QAAM,WAAW,CAAA;AACX,QAAA,QAAQ,MA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sources":["../../src/print/index.ts"],"sourcesContent":["// @ts-nocheck\r\nimport OrionError from '../error/OrionError'\r\nimport { getLodop } from './LodopFuncs'\r\n\r\nexport function lodopInit() {\r\n // 获取lodop\r\n const LODOP = getLodop()\r\n\r\n return new Promise((resolve) => {\r\n resolve(LODOP)\r\n })\r\n}\r\n\r\n// 获取打印机列表\r\nexport function getPrinterList() {\r\n lodopInit()\r\n const printers = []\r\n const count = LODOP.GET_PRINTER_COUNT()\r\n for (let i = 0; i < count; i++) {\r\n printers.push({\r\n value: i,\r\n content: LODOP.GET_PRINTER_NAME(i),\r\n })\r\n }\r\n\r\n return printers\r\n}\r\n\r\n// 获取打印机名称列表\r\nexport function getPrinterNameList() {\r\n lodopInit()\r\n const printers = []\r\n const count = LODOP.GET_PRINTER_COUNT()\r\n for (let i = 0; i < count; i++) {\r\n const prname = LODOP.GET_PRINTER_NAME(i)\r\n printers.push({\r\n value: prname,\r\n content: prname,\r\n })\r\n }\r\n\r\n return printers\r\n}\r\n\r\n//////////////////////////////////// 接口\r\n\r\n// 获取默认打印机名称\r\nexport async function getDefaultPrinter() {\r\n const LODOP = await lodopInit()\r\n return LODOP.GET_PRINTER_NAME(-1) // 获取默认打印机名称(-1是指定默认打印机)\r\n}\r\n\r\nexport interface PrintParaI {\r\n direction?: 1 | 2 | 3 | 0 // 1纵向;2横向;3纵向,高度自适应;0方向不定\r\n page_width?: number // 纸张宽度,默认为0\r\n page_height?: number // 纸张高度,默认为0\r\n page_type?: string // 纸张类型\r\n print_duplex?: 0 | 1 | 2 | 3 // 双面打印,默认为0 0-不控制 1-不双面 2-双面(长边装订) 3-小册子双面(短边装订_长边水平)\r\n print_defaultsource?: 0 | 1 | 4 | 7 // 双面打印方式,默认为0 1-纸盒 4-手动 7-自动 0-不控制\r\n print_mode_map?: {\r\n // 扩展接口,打印第三方文件时可能需要调优,参数可参考lodop官方文档的LODOP.SET_PRINT_MODE方法\r\n PRINT_PAGE_PERCENT: string // 指定整页缩放打印的比例 格式为Full-Width | Full-Height | Full-Page | “Width:XX%;Height:XX%”\r\n }\r\n}\r\n\r\n// 无打印模板,预览打印\r\nexport async function preview(params: { pdfurl: string; print_para?: PrintParaI }) {\r\n if (!params) {\r\n throw new OrionError('打印异常:入参为空,请检查')\r\n }\r\n\r\n const { pdfurl, print_para = {} } = params\r\n\r\n if (!pdfurl) {\r\n throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印')\r\n }\r\n\r\n const LODOP = await lodopInit()\r\n\r\n //获取传入的打印参数\r\n let page_width = 0\r\n if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {\r\n page_width = print_para.page_width\r\n }\r\n let page_height = 0\r\n if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {\r\n page_height = print_para.page_height\r\n }\r\n let page_type = ''\r\n if (print_para.page_type) {\r\n page_type = print_para.page_type\r\n }\r\n let direction = 1\r\n if (print_para.direction) {\r\n direction = print_para.direction\r\n }\r\n let print_duplex = 0\r\n if (print_para.print_duplex) {\r\n print_duplex = print_para.print_duplex\r\n }\r\n let print_defaultsource = 0\r\n if (print_para.print_defaultsource) {\r\n print_defaultsource = print_para.print_defaultsource\r\n }\r\n\r\n // 历史问题,防止重复打印的问题\r\n LODOP.PRINT_INIT('')\r\n\r\n if (print_para.print_mode_map) {\r\n Object.keys(print_para.print_mode_map).map((item) => {\r\n LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item])\r\n })\r\n }\r\n LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0)\r\n LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0)\r\n LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type)\r\n LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url))\r\n LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true) // 移除预览的线条\r\n LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印') // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名\r\n LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true) //返回打印机状态\r\n\r\n return new Promise((resolve) => {\r\n LODOP.On_Return = function (TaskID, Value) {\r\n resolve(Value)\r\n }\r\n LODOP.PREVIEW()\r\n })\r\n}\r\n\r\nexport async function print(params: { pdfurl: string; print_para?: PrintParaI; printer?: string | -1 }) {\r\n if (!params) {\r\n throw new OrionError('打印异常:入参为空,请检查')\r\n }\r\n\r\n const { pdfurl, print_para = {}, printer } = params\r\n\r\n if (!pdfurl) {\r\n throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印')\r\n }\r\n\r\n if (printer) {\r\n return await printWithCertainPrinter(pdfurl, print_para, printer)\r\n } else {\r\n // 没设置打印机\r\n return await printNeedSelectPrinter(pdfurl, print_para)\r\n }\r\n}\r\n\r\nasync function printWithCertainPrinter(pdfurl: string, print_para: PrintParaI = {}, pr_name: string | -1) {\r\n if (!pdfurl) {\r\n throw new OrionError('打印异常:未知的文件地址[' + pdfurl + '],无法进行打印')\r\n }\r\n if (!pr_name) {\r\n throw new OrionError('打印异常:未设置打印机,无法进行打印')\r\n }\r\n\r\n //获取传入的打印参数\r\n let page_width = 0\r\n if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {\r\n page_width = print_para.page_width\r\n }\r\n let page_height = 0\r\n if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {\r\n page_height = print_para.page_height\r\n }\r\n let page_type = ''\r\n if (print_para.page_type) {\r\n page_type = print_para.page_type\r\n }\r\n let direction = 1\r\n if (print_para.direction) {\r\n direction = print_para.direction\r\n }\r\n let print_duplex = 0\r\n if (print_para.print_duplex) {\r\n print_duplex = print_para.print_duplex\r\n }\r\n let print_defaultsource = 0\r\n if (print_para.print_defaultsource) {\r\n print_defaultsource = print_para.print_defaultsource\r\n }\r\n\r\n const LODOP = await lodopInit()\r\n // 指定打印设备(打印机)\r\n LODOP.PRINT_INIT('')\r\n // 设置了打印机\r\n if (pr_name === -1) {\r\n LODOP.SET_PRINTER_INDEXA(LODOP.GET_PRINTER_NAME(-1))\r\n } else {\r\n LODOP.SET_PRINTER_INDEXA(pr_name)\r\n }\r\n LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type)\r\n if (print_para.print_mode_map) {\r\n Object.keys(print_para.print_mode_map).map((item) => {\r\n LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item])\r\n })\r\n }\r\n LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0)\r\n LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0)\r\n LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', new URL(pdfurl, import.meta.url))\r\n LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true) //返回打印机状态\r\n\r\n return new Promise((resolve) => {\r\n LODOP.On_Return = function (TaskID, Value) {\r\n resolve(Value)\r\n }\r\n LODOP.PRINT()\r\n })\r\n}\r\n\r\n// 无打印模板,直接打印,需要选择打印机\r\nexport async function printNeedSelectPrinter(url: string, print_para: PrintParaI = {}) {\r\n if (url === null || url === '' || typeof url === 'undefined') {\r\n throw new OrionError('打印异常:未知的文件地址[' + url + '],无法进行打印')\r\n }\r\n\r\n const LODOP = await lodopInit()\r\n\r\n //获取传入的打印参数\r\n let page_width = 0\r\n if (print_para.page_width != 0 && typeof print_para.page_width != 'undefined') {\r\n page_width = print_para.page_width\r\n }\r\n let page_height = 0\r\n if (print_para.page_height != 0 && typeof print_para.page_height != 'undefined') {\r\n page_height = print_para.page_height\r\n }\r\n let page_type = ''\r\n if (print_para.page_type) {\r\n page_type = print_para.page_type\r\n }\r\n let direction = 1\r\n if (print_para.direction) {\r\n direction = print_para.direction\r\n }\r\n let print_duplex = 0\r\n if (print_para.print_duplex) {\r\n print_duplex = print_para.print_duplex\r\n }\r\n let print_defaultsource = 0\r\n if (print_para.print_defaultsource) {\r\n print_defaultsource = print_para.print_defaultsource\r\n }\r\n\r\n // 历史问题,防止重复打印的问题\r\n LODOP.PRINT_INIT('')\r\n\r\n if (print_para.print_mode_map) {\r\n Object.keys(print_para.print_mode_map).map((item) => {\r\n LODOP.SET_PRINT_MODE(item, print_para.print_mode_map[item])\r\n })\r\n }\r\n\r\n LODOP.SET_PRINT_MODE('PRINT_DUPLEX', print_duplex ? print_duplex : 0)\r\n LODOP.SET_PRINT_MODE('PRINT_DEFAULTSOURCE', print_defaultsource ? print_defaultsource : 0)\r\n LODOP.SET_PRINT_PAGESIZE(direction, page_width, page_height, page_type)\r\n LODOP.ADD_PRINT_PDF(0, 0, '100%', '100%', url)\r\n LODOP.SET_SHOW_MODE('HIDE_PAPER_BOARD', true) // 移除预览的线条\r\n LODOP.SET_PREVIEW_WINDOW(0, 0, 0, 0, 0, '预览查看.开始打印') // 适高,工具条,弹出选择打印机,窗口宽,窗口高,窗口名\r\n\r\n //返回打印机状态\r\n LODOP.SET_PRINT_MODE('CATCH_PRINT_STATUS', true)\r\n\r\n return new Promise((resolve) => {\r\n LODOP.On_Return = function (TaskID, Value) {\r\n resolve(Value)\r\n }\r\n LODOP.PRINTA()\r\n })\r\n}\r\n"],"names":["lodopInit","LODOP","getLodop","resolve","getPrinterList","printers","count","i","getPrinterNameList","prname","getDefaultPrinter","preview","params","OrionError","pdfurl","print_para","page_width","page_height","page_type","direction","print_duplex","print_defaultsource","item","TaskID","Value","print","printer","printWithCertainPrinter","printNeedSelectPrinter","pr_name","url"],"mappings":";;AAIO,SAASA,IAAY;AAE1B,QAAMC,IAAQC;AAEP,SAAA,IAAI,QAAQ,CAACC,MAAY;AAC9B,IAAAA,EAAQF,CAAK;AAAA,EAAA,CACd;AACH;AAGO,SAASG,IAAiB;AACrB,EAAAJ;AACV,QAAMK,IAAW,CAAA,GACXC,IAAQ,MAAM;AACpB,WAASC,IAAI,GAAGA,IAAID,GAAOC;AACzB,IAAAF,EA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0, configurable: !0, writable: !0, value: s }) : h[n] = s;
|
3
|
+
var t = (h, n, s) => a(h, typeof n != "symbol" ? n + "" : n, s);
|
4
|
+
class r {
|
5
|
+
constructor(n) {
|
6
|
+
t(this, "handlers");
|
7
|
+
t(this, "index");
|
8
|
+
this.handlers = n || [], this.index = 0;
|
10
9
|
}
|
11
|
-
async handle(
|
12
|
-
if (this.index == this.handlers.length)
|
13
|
-
throw
|
14
|
-
|
15
|
-
|
16
|
-
this.index++;
|
17
|
-
return await handler.handle(error, chain);
|
10
|
+
async handle(n, s) {
|
11
|
+
if (this.index == this.handlers.length)
|
12
|
+
throw n;
|
13
|
+
const e = this.handlers[this.index];
|
14
|
+
return this.index++, await e.handle(n, s);
|
18
15
|
}
|
19
16
|
}
|
20
17
|
export {
|
21
|
-
|
18
|
+
r as default
|
22
19
|
};
|
23
20
|
//# sourceMappingURL=ErrorHandlerChain.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ErrorHandlerChain.js","sources":["../../src/request/ErrorHandlerChain.ts"],"sourcesContent":["export interface ErrorHandler<T = Error> {\r\n handle: (error: T, chain: ErrorHandlerChain) => void\r\n}\r\n\r\nexport default class ErrorHandlerChain<T = Error> {\r\n private handlers: Array<ErrorHandler<T>>\r\n private index: number\r\n\r\n constructor(handlers: Array<ErrorHandler<T>>) {\r\n this.handlers = handlers ? handlers : []\r\n this.index = 0\r\n }\r\n\r\n async handle(error: T, chain: ErrorHandlerChain) {\r\n if (this.index == this.handlers.length) {\r\n throw error\r\n }\r\n\r\n const handler = this.handlers[this.index]\r\n\r\n this.index++\r\n\r\n return await handler.handle(error, chain)\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAIA,
|
1
|
+
{"version":3,"file":"ErrorHandlerChain.js","sources":["../../src/request/ErrorHandlerChain.ts"],"sourcesContent":["export interface ErrorHandler<T = Error> {\r\n handle: (error: T, chain: ErrorHandlerChain) => void\r\n}\r\n\r\nexport default class ErrorHandlerChain<T = Error> {\r\n private handlers: Array<ErrorHandler<T>>\r\n private index: number\r\n\r\n constructor(handlers: Array<ErrorHandler<T>>) {\r\n this.handlers = handlers ? handlers : []\r\n this.index = 0\r\n }\r\n\r\n async handle(error: T, chain: ErrorHandlerChain) {\r\n if (this.index == this.handlers.length) {\r\n throw error\r\n }\r\n\r\n const handler = this.handlers[this.index]\r\n\r\n this.index++\r\n\r\n return await handler.handle(error, chain)\r\n }\r\n}\r\n"],"names":["ErrorHandlerChain","handlers","__publicField","error","chain","handler"],"mappings":";;;AAIA,MAAqBA,EAA6B;AAAA,EAIhD,YAAYC,GAAkC;AAHtC,IAAAC,EAAA;AACA,IAAAA,EAAA;AAGD,SAAA,WAAWD,KAAsB,CAAA,GACtC,KAAK,QAAQ;AAAA,EACf;AAAA,EAEA,MAAM,OAAOE,GAAUC,GAA0B;AAC/C,QAAI,KAAK,SAAS,KAAK,SAAS;AACxB,YAAAD;AAGR,UAAME,IAAU,KAAK,SAAS,KAAK,KAAK;AAEnC,gBAAA,SAEE,MAAMA,EAAQ,OAAOF,GAAOC,CAAK;AAAA,EAC1C;AACF;"}
|
@@ -1,23 +1,20 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var
|
4
|
-
class
|
5
|
-
constructor(
|
6
|
-
|
7
|
-
|
8
|
-
this.filters =
|
9
|
-
this.index = 0;
|
1
|
+
var l = Object.defineProperty;
|
2
|
+
var n = (i, t, e) => t in i ? l(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
3
|
+
var s = (i, t, e) => n(i, typeof t != "symbol" ? t + "" : t, e);
|
4
|
+
class d {
|
5
|
+
constructor(t) {
|
6
|
+
s(this, "filters");
|
7
|
+
s(this, "index");
|
8
|
+
this.filters = t || [], this.index = 0;
|
10
9
|
}
|
11
|
-
doFilter(
|
12
|
-
if (this.index == this.filters.length)
|
10
|
+
doFilter(t, e) {
|
11
|
+
if (this.index == this.filters.length)
|
13
12
|
return;
|
14
|
-
|
15
|
-
|
16
|
-
this.index++;
|
17
|
-
filter.doFilter(request, chain);
|
13
|
+
const r = this.filters[this.index];
|
14
|
+
this.index++, r.doFilter(t, e);
|
18
15
|
}
|
19
16
|
}
|
20
17
|
export {
|
21
|
-
|
18
|
+
d as default
|
22
19
|
};
|
23
20
|
//# sourceMappingURL=RequestFilterChain.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RequestFilterChain.js","sources":["../../src/request/RequestFilterChain.ts"],"sourcesContent":["import type { AxiosRequestConfig } from 'axios'\r\n\r\nexport interface RequestFilter<T = AxiosRequestConfig> {\r\n doFilter(request: T, chain: RequestFilterChain): void\r\n}\r\n\r\nexport default class RequestFilterChain<T = AxiosRequestConfig> {\r\n private filters: Array<RequestFilter<T>>\r\n private index: number\r\n\r\n constructor(filters: Array<RequestFilter<T>>) {\r\n this.filters = filters ? filters : []\r\n this.index = 0\r\n }\r\n\r\n doFilter(request: T, chain: RequestFilterChain) {\r\n if (this.index == this.filters.length) {\r\n return\r\n }\r\n\r\n const filter = this.filters[this.index]\r\n\r\n this.index++\r\n\r\n filter.doFilter(request, chain)\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAMA,
|
1
|
+
{"version":3,"file":"RequestFilterChain.js","sources":["../../src/request/RequestFilterChain.ts"],"sourcesContent":["import type { AxiosRequestConfig } from 'axios'\r\n\r\nexport interface RequestFilter<T = AxiosRequestConfig> {\r\n doFilter(request: T, chain: RequestFilterChain): void\r\n}\r\n\r\nexport default class RequestFilterChain<T = AxiosRequestConfig> {\r\n private filters: Array<RequestFilter<T>>\r\n private index: number\r\n\r\n constructor(filters: Array<RequestFilter<T>>) {\r\n this.filters = filters ? filters : []\r\n this.index = 0\r\n }\r\n\r\n doFilter(request: T, chain: RequestFilterChain) {\r\n if (this.index == this.filters.length) {\r\n return\r\n }\r\n\r\n const filter = this.filters[this.index]\r\n\r\n this.index++\r\n\r\n filter.doFilter(request, chain)\r\n }\r\n}\r\n"],"names":["RequestFilterChain","filters","__publicField","request","chain","filter"],"mappings":";;;AAMA,MAAqBA,EAA2C;AAAA,EAI9D,YAAYC,GAAkC;AAHtC,IAAAC,EAAA;AACA,IAAAA,EAAA;AAGD,SAAA,UAAUD,KAAoB,CAAA,GACnC,KAAK,QAAQ;AAAA,EACf;AAAA,EAEA,SAASE,GAAYC,GAA2B;AAC9C,QAAI,KAAK,SAAS,KAAK,QAAQ;AAC7B;AAGF,UAAMC,IAAS,KAAK,QAAQ,KAAK,KAAK;AAEjC,SAAA,SAEEA,EAAA,SAASF,GAASC,CAAK;AAAA,EAChC;AACF;"}
|
@@ -1,23 +1,20 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var
|
4
|
-
class
|
5
|
-
constructor(
|
6
|
-
|
7
|
-
|
8
|
-
this.parsers =
|
9
|
-
this.index = 0;
|
1
|
+
var a = Object.defineProperty;
|
2
|
+
var n = (r, s, e) => s in r ? a(r, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[s] = e;
|
3
|
+
var t = (r, s, e) => n(r, typeof s != "symbol" ? s + "" : s, e);
|
4
|
+
class d {
|
5
|
+
constructor(s) {
|
6
|
+
t(this, "parsers");
|
7
|
+
t(this, "index");
|
8
|
+
this.parsers = s || [], this.index = 0;
|
10
9
|
}
|
11
|
-
doParse(
|
12
|
-
if (this.index == this.parsers.length)
|
13
|
-
return
|
14
|
-
|
15
|
-
|
16
|
-
this.index++;
|
17
|
-
return parser.parse(response, chain);
|
10
|
+
doParse(s, e) {
|
11
|
+
if (this.index == this.parsers.length)
|
12
|
+
return s;
|
13
|
+
const i = this.parsers[this.index];
|
14
|
+
return this.index++, i.parse(s, e);
|
18
15
|
}
|
19
16
|
}
|
20
17
|
export {
|
21
|
-
|
18
|
+
d as default
|
22
19
|
};
|
23
20
|
//# sourceMappingURL=ResponseParserChain.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ResponseParserChain.js","sources":["../../src/request/ResponseParserChain.ts"],"sourcesContent":["import type { AxiosResponse } from 'axios'\r\n\r\nexport interface ResponseParser<T = AxiosResponse> {\r\n parse(response: T, chain: ResponseParserChain): T\r\n}\r\n\r\nexport default class ResponseParserChain<T = AxiosResponse> {\r\n private parsers: Array<ResponseParser<T>>\r\n private index: number\r\n\r\n constructor(parsers: Array<ResponseParser<T>>) {\r\n this.parsers = parsers ? parsers : []\r\n this.index = 0\r\n }\r\n\r\n doParse(response: T, chain: ResponseParserChain) {\r\n if (this.index == this.parsers.length) {\r\n return response\r\n }\r\n\r\n const parser = this.parsers[this.index]\r\n\r\n this.index++\r\n\r\n return parser.parse(response, chain)\r\n }\r\n}\r\n"],"names":[],"mappings":";;;AAMA,
|
1
|
+
{"version":3,"file":"ResponseParserChain.js","sources":["../../src/request/ResponseParserChain.ts"],"sourcesContent":["import type { AxiosResponse } from 'axios'\r\n\r\nexport interface ResponseParser<T = AxiosResponse> {\r\n parse(response: T, chain: ResponseParserChain): T\r\n}\r\n\r\nexport default class ResponseParserChain<T = AxiosResponse> {\r\n private parsers: Array<ResponseParser<T>>\r\n private index: number\r\n\r\n constructor(parsers: Array<ResponseParser<T>>) {\r\n this.parsers = parsers ? parsers : []\r\n this.index = 0\r\n }\r\n\r\n doParse(response: T, chain: ResponseParserChain) {\r\n if (this.index == this.parsers.length) {\r\n return response\r\n }\r\n\r\n const parser = this.parsers[this.index]\r\n\r\n this.index++\r\n\r\n return parser.parse(response, chain)\r\n }\r\n}\r\n"],"names":["ResponseParserChain","parsers","__publicField","response","chain","parser"],"mappings":";;;AAMA,MAAqBA,EAAuC;AAAA,EAI1D,YAAYC,GAAmC;AAHvC,IAAAC,EAAA;AACA,IAAAA,EAAA;AAGD,SAAA,UAAUD,KAAoB,CAAA,GACnC,KAAK,QAAQ;AAAA,EACf;AAAA,EAEA,QAAQE,GAAaC,GAA4B;AAC/C,QAAI,KAAK,SAAS,KAAK,QAAQ;AACtB,aAAAD;AAGT,UAAME,IAAS,KAAK,QAAQ,KAAK,KAAK;AAEjC,gBAAA,SAEEA,EAAO,MAAMF,GAAUC,CAAK;AAAA,EACrC;AACF;"}
|
@@ -1,56 +1,31 @@
|
|
1
|
-
var
|
2
|
-
var
|
3
|
-
var
|
4
|
-
import
|
5
|
-
class
|
6
|
-
constructor(
|
7
|
-
|
8
|
-
this.format =
|
1
|
+
var y = Object.defineProperty;
|
2
|
+
var A = (f, s, i) => s in f ? y(f, s, { enumerable: !0, configurable: !0, writable: !0, value: i }) : f[s] = i;
|
3
|
+
var m = (f, s, i) => A(f, typeof s != "symbol" ? s + "" : s, i);
|
4
|
+
import o from "dayjs";
|
5
|
+
class b {
|
6
|
+
constructor(s = "YYYY-MM-DD HH:mm:ss.SSS") {
|
7
|
+
m(this, "format");
|
8
|
+
this.format = s;
|
9
9
|
}
|
10
|
-
serialize(
|
11
|
-
const
|
12
|
-
function
|
13
|
-
const
|
14
|
-
Object.keys(
|
15
|
-
const
|
16
|
-
|
17
|
-
|
18
|
-
} else if (value && value instanceof Object && !Array.isArray(value)) {
|
19
|
-
result[key] = objTransfer(value);
|
20
|
-
} else if (value && Array.isArray(value)) {
|
21
|
-
result[key] = arrayTransfer(value);
|
22
|
-
} else {
|
23
|
-
result[key] = value;
|
24
|
-
}
|
25
|
-
});
|
26
|
-
return result;
|
10
|
+
serialize(s) {
|
11
|
+
const i = this.format;
|
12
|
+
function n(e) {
|
13
|
+
const r = {};
|
14
|
+
return Object.keys(e).forEach((a) => {
|
15
|
+
const t = e[a];
|
16
|
+
t instanceof Date || o.isDayjs(t) ? r[a] = o(t).format(i) : t && t instanceof Object && !Array.isArray(t) ? r[a] = n(t) : t && Array.isArray(t) ? r[a] = c(t) : r[a] = t;
|
17
|
+
}), r;
|
27
18
|
}
|
28
|
-
function
|
29
|
-
return
|
30
|
-
if (value instanceof Date || dayjs.isDayjs(value)) {
|
31
|
-
return dayjs(value).format(format);
|
32
|
-
} else if (value && value instanceof Object && !Array.isArray(value)) {
|
33
|
-
return objTransfer(value);
|
34
|
-
} else if (value && Array.isArray(value)) {
|
35
|
-
return arrayTransfer(value);
|
36
|
-
} else {
|
37
|
-
return value;
|
38
|
-
}
|
39
|
-
});
|
19
|
+
function c(e) {
|
20
|
+
return e.map((r) => r instanceof Date || o.isDayjs(r) ? o(r).format(i) : r && r instanceof Object && !Array.isArray(r) ? n(r) : r && Array.isArray(r) ? c(r) : r);
|
40
21
|
}
|
41
|
-
Object.keys(
|
42
|
-
const
|
43
|
-
|
44
|
-
data[key] = dayjs(value).format(this.format);
|
45
|
-
} else if (value && typeof value == "object" && !Array.isArray(value)) {
|
46
|
-
data[key] = objTransfer(value);
|
47
|
-
} else if (value && Array.isArray(value)) {
|
48
|
-
data[key] = arrayTransfer(value);
|
49
|
-
}
|
22
|
+
Object.keys(s).forEach((e) => {
|
23
|
+
const r = s[e];
|
24
|
+
r instanceof Date || o.isDayjs(r) ? s[e] = o(r).format(this.format) : r && typeof r == "object" && !Array.isArray(r) ? s[e] = n(r) : r && Array.isArray(r) && (s[e] = c(r));
|
50
25
|
});
|
51
26
|
}
|
52
27
|
}
|
53
28
|
export {
|
54
|
-
|
29
|
+
b as default
|
55
30
|
};
|
56
31
|
//# sourceMappingURL=DateSerializer.js.map
|