@ezeep/ezeep-js 1.0.235 → 1.0.238
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/dist/cjs/ezeep.cjs.js +1 -1
- package/dist/cjs/ezp-auth_15.cjs.entry.js +225 -107
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +206 -95
- package/dist/collection/components/ezp-printing/ezp-printing.js +6 -5
- package/dist/collection/components/ezp-upload/ezp-upload.js +13 -11
- package/dist/collection/services/print.js +9 -0
- package/dist/custom-elements/index.js +228 -110
- package/dist/directives/proxies.ts +2 -2
- package/dist/esm/ezeep.js +1 -1
- package/dist/esm/ezp-auth_15.entry.js +225 -107
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/ezeep.js +1 -1
- package/dist/esm-es5/ezp-auth_15.entry.js +3 -3
- package/dist/esm-es5/loader.js +1 -1
- package/dist/ezeep/ezeep.esm.js +1 -1
- package/dist/ezeep/{p-9e3d9e95.entry.js → p-0aba6822.entry.js} +2 -2
- package/dist/ezeep/p-84bd195a.system.js +1 -1
- package/dist/ezeep/{p-d89d8671.system.entry.js → p-dba5d7b7.system.entry.js} +3 -3
- package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +10 -3
- package/dist/types/components/ezp-printing/ezp-printing.d.ts +1 -1
- package/dist/types/components/ezp-upload/ezp-upload.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/dist/types/services/print.d.ts +2 -0
- package/package.json +1 -1
- package/www/build/ezeep.esm.js +1 -1
- package/www/build/{p-9e3d9e95.entry.js → p-0aba6822.entry.js} +2 -2
- package/www/build/p-84bd195a.system.js +1 -1
- package/www/build/{p-d89d8671.system.entry.js → p-dba5d7b7.system.entry.js} +3 -3
- package/www/data/locales/de.json +3 -3
- package/www/data/locales/en.json +3 -3
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -16,7 +16,7 @@ const defineCustomElements = (win, options) => {
|
|
|
16
16
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
17
17
|
return patchEsm().then(() => {
|
|
18
18
|
appGlobals.globalScripts();
|
|
19
|
-
return index.bootstrapLazy([["ezp-auth_15.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"hideheader":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"code":[1],"filedata":[1],"seamless":[4],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"
|
|
19
|
+
return index.bootstrapLazy([["ezp-auth_15.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"hideheader":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"code":[1],"filedata":[1],"seamless":[4],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"files":[32],"open":[64],"logOut":[64],"getSasUri":[64],"getAuthUri":[64],"checkAuth":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"],[0,"logout","listenLogout"]]],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"files":[16],"hidemenu":[4],"hideheader":[4],"seamless":[4],"loading":[32],"printProcessing":[32],"pageRangeInvalid":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"notSupported":[32],"noPrinters":[32],"userMenuOpen":[32],"printStopped":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32],"paperid":[32],"currentFileIndex":[32],"totalFiles":[32],"failedFiles":[32],"successfulFiles":[32],"partialSuccess":[32]},[[0,"inputValueChanged","listenInputValueChanged"],[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"trigger":[1],"code":[1],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"selectedFiles":[32],"dragging":[32]},[[1,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"],[4,"printCancel","listenPrintCancel"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}],[1,"ezp-user-menu",{"name":[1],"open":[1028]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]}],[1,"ezp-input",{"label":[1],"value":[1032],"type":[1],"icon":[1],"suffix":[513],"eventType":[1,"event-type"],"placeholder":[1],"focused":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]}],[1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]]]], options);
|
|
20
20
|
});
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -7,7 +7,6 @@ import { managePaperDimensions, poll, removeEmptyStrings } from '../../utils/uti
|
|
|
7
7
|
import { PAPER_ID, validatePageRange, formatPageRange } from '../../utils/utils';
|
|
8
8
|
export class EzpPrinterSelection {
|
|
9
9
|
constructor() {
|
|
10
|
-
this.sasUri = '';
|
|
11
10
|
this.fileExtension = '';
|
|
12
11
|
this.duplexOptions = [
|
|
13
12
|
{
|
|
@@ -31,7 +30,7 @@ export class EzpPrinterSelection {
|
|
|
31
30
|
{
|
|
32
31
|
id: 2,
|
|
33
32
|
title: i18next.t('printer_selection.color_grayscale'),
|
|
34
|
-
}
|
|
33
|
+
},
|
|
35
34
|
];
|
|
36
35
|
this.hidemenu = false;
|
|
37
36
|
this.hideheader = false;
|
|
@@ -58,14 +57,14 @@ export class EzpPrinterSelection {
|
|
|
58
57
|
Paper: '',
|
|
59
58
|
Orientation: '',
|
|
60
59
|
Resolution: '',
|
|
61
|
-
Tray: ''
|
|
60
|
+
Tray: '',
|
|
62
61
|
},
|
|
63
62
|
OrientationsSupported: [],
|
|
64
63
|
PaperFormats: [],
|
|
65
64
|
Resolutions: [],
|
|
66
65
|
DuplexSupported: false,
|
|
67
66
|
Color: false,
|
|
68
|
-
Trays: []
|
|
67
|
+
Trays: [],
|
|
69
68
|
};
|
|
70
69
|
// needs to be initialised with empty strings
|
|
71
70
|
this.selectedProperties = {
|
|
@@ -83,6 +82,11 @@ export class EzpPrinterSelection {
|
|
|
83
82
|
trayname: '',
|
|
84
83
|
PageRanges: '',
|
|
85
84
|
};
|
|
85
|
+
this.currentFileIndex = 0;
|
|
86
|
+
this.totalFiles = 0;
|
|
87
|
+
this.failedFiles = [];
|
|
88
|
+
this.successfulFiles = [];
|
|
89
|
+
this.partialSuccess = false;
|
|
86
90
|
/**
|
|
87
91
|
*
|
|
88
92
|
* Private methods
|
|
@@ -90,6 +94,9 @@ export class EzpPrinterSelection {
|
|
|
90
94
|
*/
|
|
91
95
|
/** Description... */
|
|
92
96
|
this.handleCancel = () => {
|
|
97
|
+
this.failedFiles = [];
|
|
98
|
+
this.successfulFiles = [];
|
|
99
|
+
this.partialSuccess = false;
|
|
93
100
|
this.printCancel.emit();
|
|
94
101
|
};
|
|
95
102
|
this.validateData = (data) => {
|
|
@@ -106,9 +113,14 @@ export class EzpPrinterSelection {
|
|
|
106
113
|
this.handlePrint = async () => {
|
|
107
114
|
this.printButton.blur();
|
|
108
115
|
this.printProcessing = true;
|
|
116
|
+
this.failedFiles = [];
|
|
117
|
+
this.successfulFiles = [];
|
|
118
|
+
this.partialSuccess = false;
|
|
109
119
|
// we have to initialse this obj with empty strings to display the select component
|
|
110
120
|
// but don't want to send any attributes with empty strings to the API
|
|
111
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
121
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
122
|
+
this.selectedPrinterConfig.Trays.length >= 0 &&
|
|
123
|
+
this.selectedPrinterConfig.Trays[0] == null) {
|
|
112
124
|
delete this.selectedProperties.trayname;
|
|
113
125
|
delete this.selectedProperties.defaultSource;
|
|
114
126
|
}
|
|
@@ -168,8 +180,8 @@ export class EzpPrinterSelection {
|
|
|
168
180
|
this.printProcessing = false;
|
|
169
181
|
});
|
|
170
182
|
}
|
|
171
|
-
if (this.
|
|
172
|
-
await this.handleFiles(this.
|
|
183
|
+
if (this.files && this.files.length > 0) {
|
|
184
|
+
await this.handleFiles(this.files, cleanPrintProperties);
|
|
173
185
|
}
|
|
174
186
|
localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
|
|
175
187
|
localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
|
|
@@ -209,17 +221,24 @@ export class EzpPrinterSelection {
|
|
|
209
221
|
if (event.detail === 'print-processing') {
|
|
210
222
|
this.printStopped = true;
|
|
211
223
|
this.printProcessing = false;
|
|
224
|
+
// Abort the print request
|
|
225
|
+
this.printService.abortPrint();
|
|
212
226
|
}
|
|
213
227
|
}
|
|
214
228
|
listenStatusClose(event) {
|
|
215
229
|
switch (event.detail) {
|
|
216
230
|
case 'print-success':
|
|
217
231
|
this.printSuccess = false;
|
|
232
|
+
this.partialSuccess = false;
|
|
233
|
+
this.failedFiles = [];
|
|
234
|
+
this.successfulFiles = [];
|
|
218
235
|
this.printCancel.emit();
|
|
219
236
|
break;
|
|
220
237
|
case 'print-failed':
|
|
221
238
|
this.printProcessing = false;
|
|
222
239
|
this.printFailed = false;
|
|
240
|
+
this.failedFiles = [];
|
|
241
|
+
this.successfulFiles = [];
|
|
223
242
|
break;
|
|
224
243
|
case 'no-printers':
|
|
225
244
|
this.noPrinters = false;
|
|
@@ -279,18 +298,23 @@ export class EzpPrinterSelection {
|
|
|
279
298
|
.then((data) => {
|
|
280
299
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
281
300
|
this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
|
|
282
|
-
this.selectedProperties.color =
|
|
301
|
+
this.selectedProperties.color =
|
|
302
|
+
((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
|
|
283
303
|
this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
|
|
284
304
|
this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
|
|
285
|
-
let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
|
|
305
|
+
let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find((obj) => obj.Default === true);
|
|
286
306
|
this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
|
|
287
307
|
this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
|
|
288
|
-
let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
|
|
289
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
308
|
+
let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find((obj) => obj.Default === true);
|
|
309
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
310
|
+
this.selectedPrinterConfig.Trays.length >= 1 &&
|
|
311
|
+
this.selectedPrinterConfig.Trays[0] != null) {
|
|
290
312
|
this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
|
|
291
313
|
this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
|
|
292
314
|
}
|
|
293
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
315
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
316
|
+
this.selectedPrinterConfig.Trays.length >= 0 &&
|
|
317
|
+
this.selectedPrinterConfig.Trays[0] == null) {
|
|
294
318
|
delete this.selectedProperties.trayname;
|
|
295
319
|
delete this.selectedProperties.defaultSource;
|
|
296
320
|
}
|
|
@@ -301,7 +325,8 @@ export class EzpPrinterSelection {
|
|
|
301
325
|
// this.setDefaultPaperFormat()
|
|
302
326
|
break;
|
|
303
327
|
case 'color':
|
|
304
|
-
this.selectedProperties.color =
|
|
328
|
+
this.selectedProperties.color =
|
|
329
|
+
eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
|
|
305
330
|
break;
|
|
306
331
|
case 'orientation':
|
|
307
332
|
this.selectedProperties.orientation = eventDetails.id;
|
|
@@ -320,11 +345,15 @@ export class EzpPrinterSelection {
|
|
|
320
345
|
this.selectedProperties.paperwidth = eventDetails.value;
|
|
321
346
|
break;
|
|
322
347
|
case 'tray':
|
|
323
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
348
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
349
|
+
this.selectedPrinterConfig.Trays.length >= 0 &&
|
|
350
|
+
this.selectedPrinterConfig.Trays[0] == null) {
|
|
324
351
|
delete this.selectedProperties.trayname;
|
|
325
352
|
delete this.selectedProperties.defaultSource;
|
|
326
353
|
}
|
|
327
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
354
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
355
|
+
this.selectedPrinterConfig.Trays.length >= 1 &&
|
|
356
|
+
this.selectedPrinterConfig.Trays[0] != null) {
|
|
328
357
|
this.selectedProperties.trayname = eventDetails.title;
|
|
329
358
|
this.selectedProperties.defaultSource = eventDetails.id;
|
|
330
359
|
}
|
|
@@ -334,9 +363,9 @@ export class EzpPrinterSelection {
|
|
|
334
363
|
this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
|
|
335
364
|
break;
|
|
336
365
|
case 'duplex':
|
|
337
|
-
if (eventDetails.title == i18next.t('printer_selection.duplex_none')
|
|
338
|
-
|
|
339
|
-
|
|
366
|
+
if (eventDetails.title == i18next.t('printer_selection.duplex_none') ||
|
|
367
|
+
eventDetails.title == i18next.t('printer_selection.duplex_long') ||
|
|
368
|
+
eventDetails.title == i18next.t('printer_selection.duplex_short')) {
|
|
340
369
|
this.selectedProperties.duplex = true;
|
|
341
370
|
}
|
|
342
371
|
else {
|
|
@@ -349,59 +378,107 @@ export class EzpPrinterSelection {
|
|
|
349
378
|
}
|
|
350
379
|
this.setPaperid();
|
|
351
380
|
}
|
|
352
|
-
async handleFiles(
|
|
381
|
+
async handleFiles(files, printPorperties) {
|
|
382
|
+
this.totalFiles = files.length;
|
|
383
|
+
this.currentFileIndex = 0;
|
|
384
|
+
this.failedFiles = [];
|
|
385
|
+
this.successfulFiles = [];
|
|
386
|
+
// Process each file individually
|
|
387
|
+
for (let i = 0; i < files.length; i++) {
|
|
388
|
+
this.currentFileIndex = i;
|
|
389
|
+
const file = files[i];
|
|
390
|
+
try {
|
|
391
|
+
await this.processSingleFile(file, printPorperties);
|
|
392
|
+
this.successfulFiles.push(file.name);
|
|
393
|
+
}
|
|
394
|
+
catch (error) {
|
|
395
|
+
console.error(`Error processing file ${file.name}:`, error);
|
|
396
|
+
this.failedFiles.push(file.name);
|
|
397
|
+
// Continue with the next file instead of stopping
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
// Determine final status based on results
|
|
401
|
+
if (this.failedFiles.length === 0) {
|
|
402
|
+
// All files processed successfully
|
|
403
|
+
this.printSuccess = true;
|
|
404
|
+
this.partialSuccess = false;
|
|
405
|
+
this.printProcessing = false;
|
|
406
|
+
}
|
|
407
|
+
else if (this.successfulFiles.length === 0) {
|
|
408
|
+
// All files failed
|
|
409
|
+
this.printFailed = true;
|
|
410
|
+
this.partialSuccess = false;
|
|
411
|
+
this.printProcessing = false;
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
// Some files succeeded, some failed - show partial success
|
|
415
|
+
this.printSuccess = true;
|
|
416
|
+
this.partialSuccess = true;
|
|
417
|
+
this.printProcessing = false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
async processSingleFile(file, printProperties) {
|
|
353
421
|
this.preparingUpload = true;
|
|
354
422
|
const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
|
|
355
423
|
this.preparingUpload = false;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
let res;
|
|
424
|
+
const fileid = response.fileid;
|
|
425
|
+
const sasUri = response.sasUri;
|
|
426
|
+
const filetype = this.getFileExtension(file.name);
|
|
360
427
|
this.uploading = true;
|
|
361
428
|
try {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
}
|
|
368
|
-
this.uploading = false;
|
|
369
|
-
if (res._response.status === 201) {
|
|
370
|
-
this.printService
|
|
371
|
-
.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, printPorperties, this.filename)
|
|
372
|
-
.then((data) => {
|
|
429
|
+
// Upload the file
|
|
430
|
+
const res = await this.printService.uploadBlobFiles(sasUri, file);
|
|
431
|
+
if (res._response.status === 201) {
|
|
432
|
+
// Print the file
|
|
433
|
+
const data = await this.printService.printByFileID(authStore.state.accessToken, fileid, filetype, this.selectedPrinter.id, printProperties, file.name);
|
|
373
434
|
if (data.code === 804) {
|
|
374
|
-
|
|
375
|
-
this.printProcessing = false;
|
|
435
|
+
throw new Error(`Print failed for file: ${file.name}`);
|
|
376
436
|
}
|
|
377
437
|
if (data.jobid) {
|
|
378
438
|
printStore.state.jobID = data.jobid;
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
validate: this.validateData,
|
|
382
|
-
interval: this.POLL_INTERVAL,
|
|
383
|
-
maxAttempts: this.MAX_POLL_ATTEMPTS,
|
|
384
|
-
}).catch((err) => {
|
|
385
|
-
console.log(err);
|
|
386
|
-
this.printFailed = true;
|
|
387
|
-
this.printProcessing = false;
|
|
388
|
-
});
|
|
439
|
+
// Wait for this print job to complete before processing the next file
|
|
440
|
+
await this.waitForPrintCompletion();
|
|
389
441
|
}
|
|
390
442
|
else {
|
|
391
|
-
|
|
392
|
-
this.printProcessing = false;
|
|
443
|
+
throw new Error(`No job ID returned for file: ${file.name}`);
|
|
393
444
|
}
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
this.printProcessing = false;
|
|
399
|
-
});
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
throw new Error(`Upload failed for file: ${file.name}`);
|
|
448
|
+
}
|
|
400
449
|
}
|
|
401
|
-
|
|
402
|
-
this.
|
|
403
|
-
|
|
450
|
+
catch (error) {
|
|
451
|
+
this.uploading = false;
|
|
452
|
+
throw error;
|
|
404
453
|
}
|
|
454
|
+
this.uploading = false;
|
|
455
|
+
}
|
|
456
|
+
async waitForPrintCompletion() {
|
|
457
|
+
return new Promise((resolve, reject) => {
|
|
458
|
+
const poll = async () => {
|
|
459
|
+
try {
|
|
460
|
+
const data = await this.printService.getPrintStatus();
|
|
461
|
+
if (data.jobstatus === 0) {
|
|
462
|
+
resolve();
|
|
463
|
+
}
|
|
464
|
+
else if (data.jobstatus === 1) {
|
|
465
|
+
// Still processing, continue polling
|
|
466
|
+
setTimeout(poll, this.POLL_INTERVAL);
|
|
467
|
+
}
|
|
468
|
+
else {
|
|
469
|
+
reject(new Error('Print job failed'));
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
catch (error) {
|
|
473
|
+
reject(error);
|
|
474
|
+
}
|
|
475
|
+
};
|
|
476
|
+
poll();
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
getFileExtension(filename) {
|
|
480
|
+
const extension = filename.split('.').pop();
|
|
481
|
+
return extension ? extension.toLowerCase() : '';
|
|
405
482
|
}
|
|
406
483
|
setDefaultPaperFormat() {
|
|
407
484
|
var _a, _b, _c, _d, _e;
|
|
@@ -452,18 +529,23 @@ export class EzpPrinterSelection {
|
|
|
452
529
|
.then((data) => {
|
|
453
530
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
454
531
|
this.selectedPrinterConfig = data[0];
|
|
455
|
-
this.selectedProperties.color =
|
|
532
|
+
this.selectedProperties.color =
|
|
533
|
+
((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
|
|
456
534
|
this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
|
|
457
535
|
this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
|
|
458
|
-
let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
|
|
536
|
+
let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find((obj) => obj.Default === true);
|
|
459
537
|
this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
|
|
460
538
|
this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
|
|
461
|
-
let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
|
|
462
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
539
|
+
let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find((obj) => obj.Default === true);
|
|
540
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
541
|
+
this.selectedPrinterConfig.Trays.length >= 1 &&
|
|
542
|
+
this.selectedPrinterConfig.Trays[0] != null) {
|
|
463
543
|
this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
|
|
464
544
|
this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
|
|
465
545
|
}
|
|
466
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
546
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
547
|
+
this.selectedPrinterConfig.Trays.length >= 0 &&
|
|
548
|
+
this.selectedPrinterConfig.Trays[0] == null) {
|
|
467
549
|
delete this.selectedProperties.trayname;
|
|
468
550
|
delete this.selectedProperties.defaultSource;
|
|
469
551
|
}
|
|
@@ -485,10 +567,12 @@ export class EzpPrinterSelection {
|
|
|
485
567
|
.then((printerConfig) => {
|
|
486
568
|
this.printerConfig = printerConfig;
|
|
487
569
|
});
|
|
488
|
-
if (this.
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
570
|
+
if (this.files && this.files.length > 0) {
|
|
571
|
+
// Validate all files
|
|
572
|
+
const validationPromises = this.files.map((file) => this.validateFileType(file.name));
|
|
573
|
+
const validationResults = await Promise.all(validationPromises);
|
|
574
|
+
const allValid = validationResults.every((valid) => valid);
|
|
575
|
+
this.notSupported = !allValid;
|
|
492
576
|
}
|
|
493
577
|
this.loading = false;
|
|
494
578
|
}
|
|
@@ -501,14 +585,28 @@ export class EzpPrinterSelection {
|
|
|
501
585
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
502
586
|
return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } },
|
|
503
587
|
h("div", { id: "box", "data-backdrop-surface": true },
|
|
504
|
-
!this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.
|
|
505
|
-
? i18next.t('printer_selection.
|
|
506
|
-
: this.
|
|
507
|
-
? i18next.t('printer_selection.
|
|
508
|
-
:
|
|
588
|
+
!this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.totalFiles > 1
|
|
589
|
+
? `${i18next.t('printer_selection.print_processing')} (${this.currentFileIndex + 1}/${this.totalFiles})`
|
|
590
|
+
: this.preparingUpload
|
|
591
|
+
? i18next.t('printer_selection.prepare_upload')
|
|
592
|
+
: this.uploading
|
|
593
|
+
? i18next.t('printer_selection.uploading')
|
|
594
|
+
: i18next.t('printer_selection.print_processing'), instance: "print-processing", cancel: true })) : this.selectedPrinter.is_queue && this.printSuccess ? (h("ezp-status", { icon: "checkmark-alt", description: this.totalFiles > 1
|
|
595
|
+
? this.failedFiles.length > 0
|
|
596
|
+
? `${i18next.t('printer_selection.pull_print_success')} (${this.successfulFiles.length}/${this.totalFiles} files)`
|
|
597
|
+
: `${i18next.t('printer_selection.pull_print_success')} (${this.totalFiles} files)`
|
|
598
|
+
: i18next.t('printer_selection.pull_print_success'), instance: "print-success", close: true })) : this.printSuccess ? (h("ezp-status", { icon: this.partialSuccess ? 'exclamation-mark' : 'checkmark-alt', description: this.totalFiles > 1
|
|
599
|
+
? this.partialSuccess
|
|
600
|
+
? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} files) - ${this.failedFiles.length} failed`
|
|
601
|
+
: `${i18next.t('printer_selection.print_success')} (${this.totalFiles} files)`
|
|
602
|
+
: i18next.t('printer_selection.print_success'), instance: "print-success", close: true })) : this.printFailed ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_failed'), instance: "print-failed", close: true, retry: true })) : this.notSupported ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.not_supported'), instance: "not-supported", retry: true })) : this.noPrinters ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.no_printers'), instance: "no-printers", close: true })) : null)),
|
|
509
603
|
!this.hideheader && (h("div", { id: "header" },
|
|
510
604
|
h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }),
|
|
511
|
-
h("ezp-label", { text: !this.notSupported
|
|
605
|
+
h("ezp-label", { text: !this.notSupported
|
|
606
|
+
? this.files && this.files.length > 1
|
|
607
|
+
? `${this.files.length} files selected`
|
|
608
|
+
: this.filename
|
|
609
|
+
: '', ellipsis: true }),
|
|
512
610
|
!this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))),
|
|
513
611
|
h("div", { id: "body" },
|
|
514
612
|
h("div", { id: "printer" },
|
|
@@ -526,9 +624,8 @@ export class EzpPrinterSelection {
|
|
|
526
624
|
id: option.id,
|
|
527
625
|
title: option.title,
|
|
528
626
|
meta: '',
|
|
529
|
-
type: 'color'
|
|
530
|
-
})), preSelected: this.selectedPrinter.id
|
|
531
|
-
&& ((_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Color) == "color"
|
|
627
|
+
type: 'color',
|
|
628
|
+
})), preSelected: this.selectedPrinter.id && ((_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Color) == 'color'
|
|
532
629
|
? i18next.t('printer_selection.color_color')
|
|
533
630
|
: i18next.t('printer_selection.color_grayscale'), disabled: !this.selectedPrinterConfig.ColorSupported }),
|
|
534
631
|
h("ezp-select", { label: i18next.t('printer_selection.duplex'), icon: "duplex", placeholder: i18next.t('printer_selection.select_duplex'), toggleFlow: "horizontal", options: (_c = this.duplexOptions) === null || _c === void 0 ? void 0 : _c.map((option) => ({
|
|
@@ -536,19 +633,22 @@ export class EzpPrinterSelection {
|
|
|
536
633
|
title: option.title,
|
|
537
634
|
meta: '',
|
|
538
635
|
type: 'duplex',
|
|
539
|
-
})), preSelected: this.selectedPrinter.id &&
|
|
636
|
+
})), preSelected: this.selectedPrinter.id &&
|
|
637
|
+
((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == 'duplex_simplex'
|
|
540
638
|
? i18next.t('printer_selection.duplex_none')
|
|
541
|
-
: ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) ==
|
|
639
|
+
: ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) == 'duplex_vertical'
|
|
542
640
|
? i18next.t('printer_selection.duplex_long')
|
|
543
|
-
: ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) ==
|
|
641
|
+
: ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) == 'duplex_horizontal'
|
|
544
642
|
? i18next.t('printer_selection.duplex_short')
|
|
545
643
|
: null, disabled: !this.selectedPrinterConfig.DuplexSupported }),
|
|
546
|
-
h("ezp-select", { label: i18next.t('printer_selection.size'), icon: "size", placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.PaperFormats &&
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
644
|
+
h("ezp-select", { label: i18next.t('printer_selection.size'), icon: "size", placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.PaperFormats &&
|
|
645
|
+
this.selectedPrinterConfig.PaperFormats.map((format) => ({
|
|
646
|
+
id: format.Id,
|
|
647
|
+
title: format.Name,
|
|
648
|
+
meta: `${format.XRes} x ${format.YRes}`,
|
|
649
|
+
type: 'format',
|
|
650
|
+
})), preSelected: this.selectedPrinter.id &&
|
|
651
|
+
((_g = this.selectedPrinterConfig.PaperFormats) === null || _g === void 0 ? void 0 : _g.find((el) => { var _a; return el.Name.includes((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Paper); }))
|
|
552
652
|
? (_h = this.selectedPrinterConfig.Default) === null || _h === void 0 ? void 0 : _h.Paper
|
|
553
653
|
: null, disabled: !(((_j = this.selectedPrinterConfig.PaperFormats) === null || _j === void 0 ? void 0 : _j.length) > 0) }),
|
|
554
654
|
this.paperid == PAPER_ID ? (h(Fragment, null,
|
|
@@ -565,15 +665,21 @@ export class EzpPrinterSelection {
|
|
|
565
665
|
title: option,
|
|
566
666
|
meta: '',
|
|
567
667
|
type: 'quality',
|
|
568
|
-
})), preSelected: this.selectedPrinter.id &&
|
|
668
|
+
})), preSelected: this.selectedPrinter.id &&
|
|
669
|
+
((_l = this.selectedPrinterConfig.Resolutions) === null || _l === void 0 ? void 0 : _l.includes(this.selectedPrinterConfig.Default.Resolution))
|
|
569
670
|
? this.selectedPrinterConfig.Default.Resolution
|
|
570
671
|
: null, disabled: !(((_m = this.selectedPrinterConfig.Resolutions) === null || _m === void 0 ? void 0 : _m.length) > 0) }),
|
|
571
|
-
this.selectedPrinterConfig.Trays &&
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
672
|
+
this.selectedPrinterConfig.Trays &&
|
|
673
|
+
this.selectedPrinterConfig.Trays.length >= 1 &&
|
|
674
|
+
this.selectedPrinterConfig.Trays[0] != null ? (h("ezp-select", { label: i18next.t('printer_selection.trays'), icon: "trays", placeholder: i18next.t('printer_selection.select_trays'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.Trays &&
|
|
675
|
+
this.selectedPrinterConfig.Trays.length >= 1 &&
|
|
676
|
+
this.selectedPrinterConfig.Trays.map((trays) => ({
|
|
677
|
+
title: trays.Name,
|
|
678
|
+
id: trays.Index,
|
|
679
|
+
meta: '',
|
|
680
|
+
type: 'tray',
|
|
681
|
+
})), preSelected: this.selectedPrinter.id &&
|
|
682
|
+
((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
|
|
577
683
|
? this.selectedPrinterConfig.Default.Tray
|
|
578
684
|
: null })) : null,
|
|
579
685
|
h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') })),
|
|
@@ -694,12 +800,12 @@ export class EzpPrinterSelection {
|
|
|
694
800
|
"attribute": "fileid",
|
|
695
801
|
"reflect": false
|
|
696
802
|
},
|
|
697
|
-
"
|
|
803
|
+
"files": {
|
|
698
804
|
"type": "unknown",
|
|
699
805
|
"mutable": false,
|
|
700
806
|
"complexType": {
|
|
701
|
-
"original": "File",
|
|
702
|
-
"resolved": "File",
|
|
807
|
+
"original": "File[]",
|
|
808
|
+
"resolved": "File[]",
|
|
703
809
|
"references": {
|
|
704
810
|
"File": {
|
|
705
811
|
"location": "global"
|
|
@@ -785,7 +891,12 @@ export class EzpPrinterSelection {
|
|
|
785
891
|
"printerConfig": {},
|
|
786
892
|
"selectedPrinterConfig": {},
|
|
787
893
|
"selectedProperties": {},
|
|
788
|
-
"paperid": {}
|
|
894
|
+
"paperid": {},
|
|
895
|
+
"currentFileIndex": {},
|
|
896
|
+
"totalFiles": {},
|
|
897
|
+
"failedFiles": {},
|
|
898
|
+
"successfulFiles": {},
|
|
899
|
+
"partialSuccess": {}
|
|
789
900
|
}; }
|
|
790
901
|
static get events() { return [{
|
|
791
902
|
"method": "printCancel",
|
|
@@ -24,6 +24,7 @@ export class EzpPrinting {
|
|
|
24
24
|
this.authOpen = false;
|
|
25
25
|
this.onlyGetSasUri = false;
|
|
26
26
|
this.noDocumentOpen = false;
|
|
27
|
+
this.files = [];
|
|
27
28
|
}
|
|
28
29
|
/** Watchers */
|
|
29
30
|
watchFileData(newValue, oldValue) {
|
|
@@ -33,7 +34,7 @@ export class EzpPrinting {
|
|
|
33
34
|
for (let i = 0; i < newValue.length; i++) {
|
|
34
35
|
array[i] = newValue.charCodeAt(i);
|
|
35
36
|
}
|
|
36
|
-
this.
|
|
37
|
+
this.files = [new File([array], this.filename)];
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
watchFilename(newValue, oldValue) {
|
|
@@ -85,8 +86,8 @@ export class EzpPrinting {
|
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
listenUploadFile(event) {
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
89
|
+
this.files = event.detail;
|
|
90
|
+
this.filename = this.files.length > 0 ? this.files[0].name : '';
|
|
90
91
|
this.open();
|
|
91
92
|
}
|
|
92
93
|
listenDialogClose(event) {
|
|
@@ -219,7 +220,7 @@ export class EzpPrinting {
|
|
|
219
220
|
? this.systemAppearance
|
|
220
221
|
: userStore.state.appearance} ${this.seamless ? 'seamless' : ''}` },
|
|
221
222
|
this.trigger === 'custom' ? (h("slot", null)) : this.trigger === 'file' ? (h("ezp-upload", null)) : (this.trigger === 'button' && (h("ezp-icon-button", { id: "print-trigger", icon: "printer", slot: "trigger", type: "button", onClick: () => this.open() }))),
|
|
222
|
-
this.authOpen ? (h("ezp-auth", { clientID: this.clientid, redirectURI: this.redirecturi, hidelogin: this.hidelogin, trigger: this.trigger, code: this.code })) : this.printOpen ? (h("ezp-printer-selection", { clientID: this.clientid, redirectURI: this.redirecturi, filename: this.filename, fileurl: this.fileurl, filetype: this.filetype, fileid: this.fileid,
|
|
223
|
+
this.authOpen ? (h("ezp-auth", { clientID: this.clientid, redirectURI: this.redirecturi, hidelogin: this.hidelogin, trigger: this.trigger, code: this.code })) : this.printOpen ? (h("ezp-printer-selection", { clientID: this.clientid, redirectURI: this.redirecturi, filename: this.filename, fileurl: this.fileurl, filetype: this.filetype, fileid: this.fileid, files: this.files, hidemenu: this.hidemenu, hideheader: this.hideheader, seamless: this.seamless })) : this.noDocumentOpen ? (h("ezp-dialog", { heading: i18next.t('no_document_dialog.heading'), description: i18next.t('no_document_dialog.description'), action: i18next.t('no_document_dialog.action'), iconName: "question-mark", instance: "no-document-selected" })) : null));
|
|
223
224
|
}
|
|
224
225
|
static get is() { return "ezp-printing"; }
|
|
225
226
|
static get encapsulation() { return "shadow"; }
|
|
@@ -582,7 +583,7 @@ export class EzpPrinting {
|
|
|
582
583
|
"onlyGetSasUri": {},
|
|
583
584
|
"noDocumentOpen": {},
|
|
584
585
|
"systemAppearance": {},
|
|
585
|
-
"
|
|
586
|
+
"files": {}
|
|
586
587
|
}; }
|
|
587
588
|
static get events() { return [{
|
|
588
589
|
"method": "printFinished",
|