@ezeep/ezeep-js 1.0.237 → 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 +214 -107
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +204 -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/custom-elements/index.js +217 -110
- package/dist/directives/proxies.ts +2 -2
- package/dist/esm/ezeep.js +1 -1
- package/dist/esm/ezp-auth_15.entry.js +214 -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-7b589922.entry.js → p-0aba6822.entry.js} +2 -2
- package/dist/ezeep/p-84bd195a.system.js +1 -1
- package/dist/ezeep/{p-62b9b554.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/package.json +1 -1
- package/www/build/ezeep.esm.js +1 -1
- package/www/build/{p-7b589922.entry.js → p-0aba6822.entry.js} +2 -2
- package/www/build/p-84bd195a.system.js +1 -1
- package/www/build/{p-62b9b554.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));
|
|
@@ -217,11 +229,16 @@ export class EzpPrinterSelection {
|
|
|
217
229
|
switch (event.detail) {
|
|
218
230
|
case 'print-success':
|
|
219
231
|
this.printSuccess = false;
|
|
232
|
+
this.partialSuccess = false;
|
|
233
|
+
this.failedFiles = [];
|
|
234
|
+
this.successfulFiles = [];
|
|
220
235
|
this.printCancel.emit();
|
|
221
236
|
break;
|
|
222
237
|
case 'print-failed':
|
|
223
238
|
this.printProcessing = false;
|
|
224
239
|
this.printFailed = false;
|
|
240
|
+
this.failedFiles = [];
|
|
241
|
+
this.successfulFiles = [];
|
|
225
242
|
break;
|
|
226
243
|
case 'no-printers':
|
|
227
244
|
this.noPrinters = false;
|
|
@@ -281,18 +298,23 @@ export class EzpPrinterSelection {
|
|
|
281
298
|
.then((data) => {
|
|
282
299
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
283
300
|
this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
|
|
284
|
-
this.selectedProperties.color =
|
|
301
|
+
this.selectedProperties.color =
|
|
302
|
+
((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
|
|
285
303
|
this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
|
|
286
304
|
this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
|
|
287
|
-
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);
|
|
288
306
|
this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
|
|
289
307
|
this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
|
|
290
|
-
let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
|
|
291
|
-
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) {
|
|
292
312
|
this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
|
|
293
313
|
this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
|
|
294
314
|
}
|
|
295
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
315
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
316
|
+
this.selectedPrinterConfig.Trays.length >= 0 &&
|
|
317
|
+
this.selectedPrinterConfig.Trays[0] == null) {
|
|
296
318
|
delete this.selectedProperties.trayname;
|
|
297
319
|
delete this.selectedProperties.defaultSource;
|
|
298
320
|
}
|
|
@@ -303,7 +325,8 @@ export class EzpPrinterSelection {
|
|
|
303
325
|
// this.setDefaultPaperFormat()
|
|
304
326
|
break;
|
|
305
327
|
case 'color':
|
|
306
|
-
this.selectedProperties.color =
|
|
328
|
+
this.selectedProperties.color =
|
|
329
|
+
eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
|
|
307
330
|
break;
|
|
308
331
|
case 'orientation':
|
|
309
332
|
this.selectedProperties.orientation = eventDetails.id;
|
|
@@ -322,11 +345,15 @@ export class EzpPrinterSelection {
|
|
|
322
345
|
this.selectedProperties.paperwidth = eventDetails.value;
|
|
323
346
|
break;
|
|
324
347
|
case 'tray':
|
|
325
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
348
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
349
|
+
this.selectedPrinterConfig.Trays.length >= 0 &&
|
|
350
|
+
this.selectedPrinterConfig.Trays[0] == null) {
|
|
326
351
|
delete this.selectedProperties.trayname;
|
|
327
352
|
delete this.selectedProperties.defaultSource;
|
|
328
353
|
}
|
|
329
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
354
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
355
|
+
this.selectedPrinterConfig.Trays.length >= 1 &&
|
|
356
|
+
this.selectedPrinterConfig.Trays[0] != null) {
|
|
330
357
|
this.selectedProperties.trayname = eventDetails.title;
|
|
331
358
|
this.selectedProperties.defaultSource = eventDetails.id;
|
|
332
359
|
}
|
|
@@ -336,9 +363,9 @@ export class EzpPrinterSelection {
|
|
|
336
363
|
this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
|
|
337
364
|
break;
|
|
338
365
|
case 'duplex':
|
|
339
|
-
if (eventDetails.title == i18next.t('printer_selection.duplex_none')
|
|
340
|
-
|
|
341
|
-
|
|
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')) {
|
|
342
369
|
this.selectedProperties.duplex = true;
|
|
343
370
|
}
|
|
344
371
|
else {
|
|
@@ -351,59 +378,107 @@ export class EzpPrinterSelection {
|
|
|
351
378
|
}
|
|
352
379
|
this.setPaperid();
|
|
353
380
|
}
|
|
354
|
-
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) {
|
|
355
421
|
this.preparingUpload = true;
|
|
356
422
|
const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
|
|
357
423
|
this.preparingUpload = false;
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
let res;
|
|
424
|
+
const fileid = response.fileid;
|
|
425
|
+
const sasUri = response.sasUri;
|
|
426
|
+
const filetype = this.getFileExtension(file.name);
|
|
362
427
|
this.uploading = true;
|
|
363
428
|
try {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
this.uploading = false;
|
|
371
|
-
if (res._response.status === 201) {
|
|
372
|
-
this.printService
|
|
373
|
-
.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, printPorperties, this.filename)
|
|
374
|
-
.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);
|
|
375
434
|
if (data.code === 804) {
|
|
376
|
-
|
|
377
|
-
this.printProcessing = false;
|
|
435
|
+
throw new Error(`Print failed for file: ${file.name}`);
|
|
378
436
|
}
|
|
379
437
|
if (data.jobid) {
|
|
380
438
|
printStore.state.jobID = data.jobid;
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
validate: this.validateData,
|
|
384
|
-
interval: this.POLL_INTERVAL,
|
|
385
|
-
maxAttempts: this.MAX_POLL_ATTEMPTS,
|
|
386
|
-
}).catch((err) => {
|
|
387
|
-
console.log(err);
|
|
388
|
-
this.printFailed = true;
|
|
389
|
-
this.printProcessing = false;
|
|
390
|
-
});
|
|
439
|
+
// Wait for this print job to complete before processing the next file
|
|
440
|
+
await this.waitForPrintCompletion();
|
|
391
441
|
}
|
|
392
442
|
else {
|
|
393
|
-
|
|
394
|
-
this.printProcessing = false;
|
|
443
|
+
throw new Error(`No job ID returned for file: ${file.name}`);
|
|
395
444
|
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
this.printProcessing = false;
|
|
401
|
-
});
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
throw new Error(`Upload failed for file: ${file.name}`);
|
|
448
|
+
}
|
|
402
449
|
}
|
|
403
|
-
|
|
404
|
-
this.
|
|
405
|
-
|
|
450
|
+
catch (error) {
|
|
451
|
+
this.uploading = false;
|
|
452
|
+
throw error;
|
|
406
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() : '';
|
|
407
482
|
}
|
|
408
483
|
setDefaultPaperFormat() {
|
|
409
484
|
var _a, _b, _c, _d, _e;
|
|
@@ -454,18 +529,23 @@ export class EzpPrinterSelection {
|
|
|
454
529
|
.then((data) => {
|
|
455
530
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
456
531
|
this.selectedPrinterConfig = data[0];
|
|
457
|
-
this.selectedProperties.color =
|
|
532
|
+
this.selectedProperties.color =
|
|
533
|
+
((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
|
|
458
534
|
this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
|
|
459
535
|
this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
|
|
460
|
-
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);
|
|
461
537
|
this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
|
|
462
538
|
this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
|
|
463
|
-
let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
|
|
464
|
-
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) {
|
|
465
543
|
this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
|
|
466
544
|
this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
|
|
467
545
|
}
|
|
468
|
-
if (this.selectedPrinterConfig.Trays &&
|
|
546
|
+
if (this.selectedPrinterConfig.Trays &&
|
|
547
|
+
this.selectedPrinterConfig.Trays.length >= 0 &&
|
|
548
|
+
this.selectedPrinterConfig.Trays[0] == null) {
|
|
469
549
|
delete this.selectedProperties.trayname;
|
|
470
550
|
delete this.selectedProperties.defaultSource;
|
|
471
551
|
}
|
|
@@ -487,10 +567,12 @@ export class EzpPrinterSelection {
|
|
|
487
567
|
.then((printerConfig) => {
|
|
488
568
|
this.printerConfig = printerConfig;
|
|
489
569
|
});
|
|
490
|
-
if (this.
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
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;
|
|
494
576
|
}
|
|
495
577
|
this.loading = false;
|
|
496
578
|
}
|
|
@@ -503,14 +585,28 @@ export class EzpPrinterSelection {
|
|
|
503
585
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
504
586
|
return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } },
|
|
505
587
|
h("div", { id: "box", "data-backdrop-surface": true },
|
|
506
|
-
!this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.
|
|
507
|
-
? i18next.t('printer_selection.
|
|
508
|
-
: this.
|
|
509
|
-
? i18next.t('printer_selection.
|
|
510
|
-
:
|
|
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)),
|
|
511
603
|
!this.hideheader && (h("div", { id: "header" },
|
|
512
604
|
h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }),
|
|
513
|
-
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 }),
|
|
514
610
|
!this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))),
|
|
515
611
|
h("div", { id: "body" },
|
|
516
612
|
h("div", { id: "printer" },
|
|
@@ -528,9 +624,8 @@ export class EzpPrinterSelection {
|
|
|
528
624
|
id: option.id,
|
|
529
625
|
title: option.title,
|
|
530
626
|
meta: '',
|
|
531
|
-
type: 'color'
|
|
532
|
-
})), preSelected: this.selectedPrinter.id
|
|
533
|
-
&& ((_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'
|
|
534
629
|
? i18next.t('printer_selection.color_color')
|
|
535
630
|
: i18next.t('printer_selection.color_grayscale'), disabled: !this.selectedPrinterConfig.ColorSupported }),
|
|
536
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) => ({
|
|
@@ -538,19 +633,22 @@ export class EzpPrinterSelection {
|
|
|
538
633
|
title: option.title,
|
|
539
634
|
meta: '',
|
|
540
635
|
type: 'duplex',
|
|
541
|
-
})), preSelected: this.selectedPrinter.id &&
|
|
636
|
+
})), preSelected: this.selectedPrinter.id &&
|
|
637
|
+
((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == 'duplex_simplex'
|
|
542
638
|
? i18next.t('printer_selection.duplex_none')
|
|
543
|
-
: ((_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'
|
|
544
640
|
? i18next.t('printer_selection.duplex_long')
|
|
545
|
-
: ((_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'
|
|
546
642
|
? i18next.t('printer_selection.duplex_short')
|
|
547
643
|
: null, disabled: !this.selectedPrinterConfig.DuplexSupported }),
|
|
548
|
-
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 &&
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
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); }))
|
|
554
652
|
? (_h = this.selectedPrinterConfig.Default) === null || _h === void 0 ? void 0 : _h.Paper
|
|
555
653
|
: null, disabled: !(((_j = this.selectedPrinterConfig.PaperFormats) === null || _j === void 0 ? void 0 : _j.length) > 0) }),
|
|
556
654
|
this.paperid == PAPER_ID ? (h(Fragment, null,
|
|
@@ -567,15 +665,21 @@ export class EzpPrinterSelection {
|
|
|
567
665
|
title: option,
|
|
568
666
|
meta: '',
|
|
569
667
|
type: 'quality',
|
|
570
|
-
})), 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))
|
|
571
670
|
? this.selectedPrinterConfig.Default.Resolution
|
|
572
671
|
: null, disabled: !(((_m = this.selectedPrinterConfig.Resolutions) === null || _m === void 0 ? void 0 : _m.length) > 0) }),
|
|
573
|
-
this.selectedPrinterConfig.Trays &&
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
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)))
|
|
579
683
|
? this.selectedPrinterConfig.Default.Tray
|
|
580
684
|
: null })) : null,
|
|
581
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') })),
|
|
@@ -696,12 +800,12 @@ export class EzpPrinterSelection {
|
|
|
696
800
|
"attribute": "fileid",
|
|
697
801
|
"reflect": false
|
|
698
802
|
},
|
|
699
|
-
"
|
|
803
|
+
"files": {
|
|
700
804
|
"type": "unknown",
|
|
701
805
|
"mutable": false,
|
|
702
806
|
"complexType": {
|
|
703
|
-
"original": "File",
|
|
704
|
-
"resolved": "File",
|
|
807
|
+
"original": "File[]",
|
|
808
|
+
"resolved": "File[]",
|
|
705
809
|
"references": {
|
|
706
810
|
"File": {
|
|
707
811
|
"location": "global"
|
|
@@ -787,7 +891,12 @@ export class EzpPrinterSelection {
|
|
|
787
891
|
"printerConfig": {},
|
|
788
892
|
"selectedPrinterConfig": {},
|
|
789
893
|
"selectedProperties": {},
|
|
790
|
-
"paperid": {}
|
|
894
|
+
"paperid": {},
|
|
895
|
+
"currentFileIndex": {},
|
|
896
|
+
"totalFiles": {},
|
|
897
|
+
"failedFiles": {},
|
|
898
|
+
"successfulFiles": {},
|
|
899
|
+
"partialSuccess": {}
|
|
791
900
|
}; }
|
|
792
901
|
static get events() { return [{
|
|
793
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",
|
|
@@ -7,7 +7,7 @@ export class EzpUpload {
|
|
|
7
7
|
* States
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
|
-
this.
|
|
10
|
+
this.selectedFiles = [];
|
|
11
11
|
this.dragging = false;
|
|
12
12
|
/**
|
|
13
13
|
*
|
|
@@ -15,8 +15,9 @@ export class EzpUpload {
|
|
|
15
15
|
*
|
|
16
16
|
*/
|
|
17
17
|
this.handleInput = () => {
|
|
18
|
-
|
|
19
|
-
this.
|
|
18
|
+
const files = Array.from(this.input.files);
|
|
19
|
+
this.selectedFiles = files;
|
|
20
|
+
this.uploadFile.emit(files);
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
/**
|
|
@@ -39,12 +40,13 @@ export class EzpUpload {
|
|
|
39
40
|
event.stopPropagation();
|
|
40
41
|
event.preventDefault();
|
|
41
42
|
this.dragging = false;
|
|
42
|
-
|
|
43
|
-
this.
|
|
43
|
+
const files = Array.from(event.dataTransfer.files);
|
|
44
|
+
this.selectedFiles = files;
|
|
45
|
+
this.uploadFile.emit(files);
|
|
44
46
|
}
|
|
45
47
|
listenPrintCancel() {
|
|
46
48
|
this.form.reset();
|
|
47
|
-
this.
|
|
49
|
+
this.selectedFiles = [];
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
50
52
|
*
|
|
@@ -61,11 +63,11 @@ export class EzpUpload {
|
|
|
61
63
|
h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_leading') }),
|
|
62
64
|
h("label", { htmlFor: "input", id: "select" },
|
|
63
65
|
h("ezp-label", { level: "tertiary", weight: "strong", text: i18next.t('upload.meta_select') })),
|
|
64
|
-
h("input", { type: "file", name: "input", id: "input", ref: (input) => (this.input = input), onInput: this.handleInput }),
|
|
66
|
+
h("input", { type: "file", name: "input", id: "input", multiple: true, ref: (input) => (this.input = input), onInput: this.handleInput }),
|
|
65
67
|
h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_trailing') })),
|
|
66
|
-
this.
|
|
67
|
-
h("ezp-label", { level: "secondary", text: i18next.t('upload.
|
|
68
|
-
h("ezp-label", { level: "tertiary", text:
|
|
68
|
+
this.selectedFiles.length > 0 && (h(Fragment, null,
|
|
69
|
+
h("ezp-label", { level: "secondary", text: i18next.t('upload.selected_files') }),
|
|
70
|
+
this.selectedFiles.map((file, index) => (h("ezp-label", { key: index, level: "tertiary", text: file.name })))))))));
|
|
69
71
|
}
|
|
70
72
|
static get is() { return "ezp-upload"; }
|
|
71
73
|
static get encapsulation() { return "shadow"; }
|
|
@@ -76,7 +78,7 @@ export class EzpUpload {
|
|
|
76
78
|
"$": ["ezp-upload.css"]
|
|
77
79
|
}; }
|
|
78
80
|
static get states() { return {
|
|
79
|
-
"
|
|
81
|
+
"selectedFiles": {},
|
|
80
82
|
"dragging": {}
|
|
81
83
|
}; }
|
|
82
84
|
static get events() { return [{
|