@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.
Files changed (31) hide show
  1. package/dist/cjs/ezeep.cjs.js +1 -1
  2. package/dist/cjs/ezp-auth_15.cjs.entry.js +225 -107
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +206 -95
  5. package/dist/collection/components/ezp-printing/ezp-printing.js +6 -5
  6. package/dist/collection/components/ezp-upload/ezp-upload.js +13 -11
  7. package/dist/collection/services/print.js +9 -0
  8. package/dist/custom-elements/index.js +228 -110
  9. package/dist/directives/proxies.ts +2 -2
  10. package/dist/esm/ezeep.js +1 -1
  11. package/dist/esm/ezp-auth_15.entry.js +225 -107
  12. package/dist/esm/loader.js +1 -1
  13. package/dist/esm-es5/ezeep.js +1 -1
  14. package/dist/esm-es5/ezp-auth_15.entry.js +3 -3
  15. package/dist/esm-es5/loader.js +1 -1
  16. package/dist/ezeep/ezeep.esm.js +1 -1
  17. package/dist/ezeep/{p-9e3d9e95.entry.js → p-0aba6822.entry.js} +2 -2
  18. package/dist/ezeep/p-84bd195a.system.js +1 -1
  19. package/dist/ezeep/{p-d89d8671.system.entry.js → p-dba5d7b7.system.entry.js} +3 -3
  20. package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +10 -3
  21. package/dist/types/components/ezp-printing/ezp-printing.d.ts +1 -1
  22. package/dist/types/components/ezp-upload/ezp-upload.d.ts +1 -1
  23. package/dist/types/components.d.ts +2 -2
  24. package/dist/types/services/print.d.ts +2 -0
  25. package/package.json +1 -1
  26. package/www/build/ezeep.esm.js +1 -1
  27. package/www/build/{p-9e3d9e95.entry.js → p-0aba6822.entry.js} +2 -2
  28. package/www/build/p-84bd195a.system.js +1 -1
  29. package/www/build/{p-d89d8671.system.entry.js → p-dba5d7b7.system.entry.js} +3 -3
  30. package/www/data/locales/de.json +3 -3
  31. package/www/data/locales/en.json +3 -3
@@ -2890,11 +2890,11 @@ const button_actions$1 = {
2890
2890
  select_printer: "Wähle Drucker"
2891
2891
  };
2892
2892
  const upload$1 = {
2893
- description: "Ziehe eine Datei hier in den Browser ",
2893
+ description: "Ziehe Dateien hier in den Browser ",
2894
2894
  meta_leading: "oder",
2895
- meta_select: "wähle eine Datei aus",
2895
+ meta_select: "wähle Dateien aus",
2896
2896
  meta_trailing: "um mit ezeep Blue zu drucken.",
2897
- selected_file: "Ausgewählte Datei:"
2897
+ selected_files: "Ausgewählte Dateien:"
2898
2898
  };
2899
2899
  const user_menu$1 = {
2900
2900
  theme: "Farbschema",
@@ -2973,11 +2973,11 @@ const button_actions = {
2973
2973
  select_printer: "Select Printer"
2974
2974
  };
2975
2975
  const upload = {
2976
- description: "Drop a file here into the browser ",
2976
+ description: "Drop files here into the browser ",
2977
2977
  meta_leading: "or",
2978
- meta_select: "select a file",
2978
+ meta_select: "select files",
2979
2979
  meta_trailing: "to print with ezeep Blue.",
2980
- selected_file: "Selected File:"
2980
+ selected_files: "Selected Files:"
2981
2981
  };
2982
2982
  const user_menu = {
2983
2983
  theme: "Color theme",
@@ -32571,6 +32571,7 @@ class PageBlobClient extends BlobClient {
32571
32571
 
32572
32572
  class EzpPrintService {
32573
32573
  constructor(redirectURI, clientID) {
32574
+ this.abortController = null;
32574
32575
  this.getPrintStatus = () => {
32575
32576
  return fetch(`https://${this.printingApi}/sfapi/Status/?id=${encodeURIComponent(printStore.state.jobID)}`, {
32576
32577
  headers: {
@@ -32659,6 +32660,7 @@ class EzpPrintService {
32659
32660
  });
32660
32661
  }
32661
32662
  printFileByUrl(accessToken, fileUrl, fileType, printerID, properties, filename, printAndDelete) {
32663
+ this.abortController = new AbortController();
32662
32664
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32663
32665
  method: 'POST',
32664
32666
  headers: {
@@ -32666,8 +32668,15 @@ class EzpPrintService {
32666
32668
  'Content-Type': 'application/json',
32667
32669
  },
32668
32670
  body: JSON.stringify(Object.assign(Object.assign(Object.assign({ fileurl: fileUrl, type: fileType, printerid: printerID }, (filename && { alias: filename })), (printAndDelete && { printanddelete: printAndDelete })), { properties })),
32671
+ signal: this.abortController.signal
32669
32672
  });
32670
32673
  }
32674
+ abortPrint() {
32675
+ if (this.abortController) {
32676
+ this.abortController.abort();
32677
+ this.abortController = null;
32678
+ }
32679
+ }
32671
32680
  printByFileID(accessToken, fileID, fileType, printerID, properties, filename, printAndDelete) {
32672
32681
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32673
32682
  method: 'POST',
@@ -32761,7 +32770,6 @@ let EzpPrinterSelection = class {
32761
32770
  this.printCancel = index.createEvent(this, "printCancel", 7);
32762
32771
  this.printSubmit = index.createEvent(this, "printSubmit", 7);
32763
32772
  this.logout = index.createEvent(this, "logout", 7);
32764
- this.sasUri = '';
32765
32773
  this.fileExtension = '';
32766
32774
  this.duplexOptions = [
32767
32775
  {
@@ -32785,7 +32793,7 @@ let EzpPrinterSelection = class {
32785
32793
  {
32786
32794
  id: 2,
32787
32795
  title: i18next.t('printer_selection.color_grayscale'),
32788
- }
32796
+ },
32789
32797
  ];
32790
32798
  this.hidemenu = false;
32791
32799
  this.hideheader = false;
@@ -32812,14 +32820,14 @@ let EzpPrinterSelection = class {
32812
32820
  Paper: '',
32813
32821
  Orientation: '',
32814
32822
  Resolution: '',
32815
- Tray: ''
32823
+ Tray: '',
32816
32824
  },
32817
32825
  OrientationsSupported: [],
32818
32826
  PaperFormats: [],
32819
32827
  Resolutions: [],
32820
32828
  DuplexSupported: false,
32821
32829
  Color: false,
32822
- Trays: []
32830
+ Trays: [],
32823
32831
  };
32824
32832
  // needs to be initialised with empty strings
32825
32833
  this.selectedProperties = {
@@ -32837,6 +32845,11 @@ let EzpPrinterSelection = class {
32837
32845
  trayname: '',
32838
32846
  PageRanges: '',
32839
32847
  };
32848
+ this.currentFileIndex = 0;
32849
+ this.totalFiles = 0;
32850
+ this.failedFiles = [];
32851
+ this.successfulFiles = [];
32852
+ this.partialSuccess = false;
32840
32853
  /**
32841
32854
  *
32842
32855
  * Private methods
@@ -32844,6 +32857,9 @@ let EzpPrinterSelection = class {
32844
32857
  */
32845
32858
  /** Description... */
32846
32859
  this.handleCancel = () => {
32860
+ this.failedFiles = [];
32861
+ this.successfulFiles = [];
32862
+ this.partialSuccess = false;
32847
32863
  this.printCancel.emit();
32848
32864
  };
32849
32865
  this.validateData = (data) => {
@@ -32860,9 +32876,14 @@ let EzpPrinterSelection = class {
32860
32876
  this.handlePrint = async () => {
32861
32877
  this.printButton.blur();
32862
32878
  this.printProcessing = true;
32879
+ this.failedFiles = [];
32880
+ this.successfulFiles = [];
32881
+ this.partialSuccess = false;
32863
32882
  // we have to initialse this obj with empty strings to display the select component
32864
32883
  // but don't want to send any attributes with empty strings to the API
32865
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
32884
+ if (this.selectedPrinterConfig.Trays &&
32885
+ this.selectedPrinterConfig.Trays.length >= 0 &&
32886
+ this.selectedPrinterConfig.Trays[0] == null) {
32866
32887
  delete this.selectedProperties.trayname;
32867
32888
  delete this.selectedProperties.defaultSource;
32868
32889
  }
@@ -32922,8 +32943,8 @@ let EzpPrinterSelection = class {
32922
32943
  this.printProcessing = false;
32923
32944
  });
32924
32945
  }
32925
- if (this.file) {
32926
- await this.handleFiles(this.file, cleanPrintProperties);
32946
+ if (this.files && this.files.length > 0) {
32947
+ await this.handleFiles(this.files, cleanPrintProperties);
32927
32948
  }
32928
32949
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
32929
32950
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
@@ -32963,17 +32984,24 @@ let EzpPrinterSelection = class {
32963
32984
  if (event.detail === 'print-processing') {
32964
32985
  this.printStopped = true;
32965
32986
  this.printProcessing = false;
32987
+ // Abort the print request
32988
+ this.printService.abortPrint();
32966
32989
  }
32967
32990
  }
32968
32991
  listenStatusClose(event) {
32969
32992
  switch (event.detail) {
32970
32993
  case 'print-success':
32971
32994
  this.printSuccess = false;
32995
+ this.partialSuccess = false;
32996
+ this.failedFiles = [];
32997
+ this.successfulFiles = [];
32972
32998
  this.printCancel.emit();
32973
32999
  break;
32974
33000
  case 'print-failed':
32975
33001
  this.printProcessing = false;
32976
33002
  this.printFailed = false;
33003
+ this.failedFiles = [];
33004
+ this.successfulFiles = [];
32977
33005
  break;
32978
33006
  case 'no-printers':
32979
33007
  this.noPrinters = false;
@@ -33033,18 +33061,23 @@ let EzpPrinterSelection = class {
33033
33061
  .then((data) => {
33034
33062
  var _a, _b, _c, _d, _e, _f, _g;
33035
33063
  this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
33036
- this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33064
+ this.selectedProperties.color =
33065
+ ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
33037
33066
  this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33038
33067
  this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33039
- let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33068
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find((obj) => obj.Default === true);
33040
33069
  this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33041
33070
  this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33042
- let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33043
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33071
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find((obj) => obj.Default === true);
33072
+ if (this.selectedPrinterConfig.Trays &&
33073
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33074
+ this.selectedPrinterConfig.Trays[0] != null) {
33044
33075
  this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33045
33076
  this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33046
33077
  }
33047
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33078
+ if (this.selectedPrinterConfig.Trays &&
33079
+ this.selectedPrinterConfig.Trays.length >= 0 &&
33080
+ this.selectedPrinterConfig.Trays[0] == null) {
33048
33081
  delete this.selectedProperties.trayname;
33049
33082
  delete this.selectedProperties.defaultSource;
33050
33083
  }
@@ -33055,7 +33088,8 @@ let EzpPrinterSelection = class {
33055
33088
  // this.setDefaultPaperFormat()
33056
33089
  break;
33057
33090
  case 'color':
33058
- this.selectedProperties.color = eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
33091
+ this.selectedProperties.color =
33092
+ eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
33059
33093
  break;
33060
33094
  case 'orientation':
33061
33095
  this.selectedProperties.orientation = eventDetails.id;
@@ -33074,11 +33108,15 @@ let EzpPrinterSelection = class {
33074
33108
  this.selectedProperties.paperwidth = eventDetails.value;
33075
33109
  break;
33076
33110
  case 'tray':
33077
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33111
+ if (this.selectedPrinterConfig.Trays &&
33112
+ this.selectedPrinterConfig.Trays.length >= 0 &&
33113
+ this.selectedPrinterConfig.Trays[0] == null) {
33078
33114
  delete this.selectedProperties.trayname;
33079
33115
  delete this.selectedProperties.defaultSource;
33080
33116
  }
33081
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33117
+ if (this.selectedPrinterConfig.Trays &&
33118
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33119
+ this.selectedPrinterConfig.Trays[0] != null) {
33082
33120
  this.selectedProperties.trayname = eventDetails.title;
33083
33121
  this.selectedProperties.defaultSource = eventDetails.id;
33084
33122
  }
@@ -33088,9 +33126,9 @@ let EzpPrinterSelection = class {
33088
33126
  this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
33089
33127
  break;
33090
33128
  case 'duplex':
33091
- if (eventDetails.title == i18next.t('printer_selection.duplex_none')
33092
- || eventDetails.title == i18next.t('printer_selection.duplex_long')
33093
- || eventDetails.title == i18next.t('printer_selection.duplex_short')) {
33129
+ if (eventDetails.title == i18next.t('printer_selection.duplex_none') ||
33130
+ eventDetails.title == i18next.t('printer_selection.duplex_long') ||
33131
+ eventDetails.title == i18next.t('printer_selection.duplex_short')) {
33094
33132
  this.selectedProperties.duplex = true;
33095
33133
  }
33096
33134
  else {
@@ -33101,59 +33139,107 @@ let EzpPrinterSelection = class {
33101
33139
  }
33102
33140
  this.setPaperid();
33103
33141
  }
33104
- async handleFiles(file, printPorperties) {
33142
+ async handleFiles(files, printPorperties) {
33143
+ this.totalFiles = files.length;
33144
+ this.currentFileIndex = 0;
33145
+ this.failedFiles = [];
33146
+ this.successfulFiles = [];
33147
+ // Process each file individually
33148
+ for (let i = 0; i < files.length; i++) {
33149
+ this.currentFileIndex = i;
33150
+ const file = files[i];
33151
+ try {
33152
+ await this.processSingleFile(file, printPorperties);
33153
+ this.successfulFiles.push(file.name);
33154
+ }
33155
+ catch (error) {
33156
+ console.error(`Error processing file ${file.name}:`, error);
33157
+ this.failedFiles.push(file.name);
33158
+ // Continue with the next file instead of stopping
33159
+ }
33160
+ }
33161
+ // Determine final status based on results
33162
+ if (this.failedFiles.length === 0) {
33163
+ // All files processed successfully
33164
+ this.printSuccess = true;
33165
+ this.partialSuccess = false;
33166
+ this.printProcessing = false;
33167
+ }
33168
+ else if (this.successfulFiles.length === 0) {
33169
+ // All files failed
33170
+ this.printFailed = true;
33171
+ this.partialSuccess = false;
33172
+ this.printProcessing = false;
33173
+ }
33174
+ else {
33175
+ // Some files succeeded, some failed - show partial success
33176
+ this.printSuccess = true;
33177
+ this.partialSuccess = true;
33178
+ this.printProcessing = false;
33179
+ }
33180
+ }
33181
+ async processSingleFile(file, printProperties) {
33105
33182
  this.preparingUpload = true;
33106
33183
  const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
33107
33184
  this.preparingUpload = false;
33108
- this.fileid = response.fileid;
33109
- this.sasUri = response.sasUri;
33110
- this.filetype = this.fileExtension;
33111
- let res;
33185
+ const fileid = response.fileid;
33186
+ const sasUri = response.sasUri;
33187
+ const filetype = this.getFileExtension(file.name);
33112
33188
  this.uploading = true;
33113
33189
  try {
33114
- res = await this.printService.uploadBlobFiles(this.sasUri, file);
33115
- }
33116
- catch (error) {
33117
- this.printProcessing = false;
33118
- this.printFailed = true;
33119
- }
33120
- this.uploading = false;
33121
- if (res._response.status === 201) {
33122
- this.printService
33123
- .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, printPorperties, this.filename)
33124
- .then((data) => {
33190
+ // Upload the file
33191
+ const res = await this.printService.uploadBlobFiles(sasUri, file);
33192
+ if (res._response.status === 201) {
33193
+ // Print the file
33194
+ const data = await this.printService.printByFileID(authStore.state.accessToken, fileid, filetype, this.selectedPrinter.id, printProperties, file.name);
33125
33195
  if (data.code === 804) {
33126
- this.printFailed = true;
33127
- this.printProcessing = false;
33196
+ throw new Error(`Print failed for file: ${file.name}`);
33128
33197
  }
33129
33198
  if (data.jobid) {
33130
33199
  printStore.state.jobID = data.jobid;
33131
- poll({
33132
- fn: this.printService.getPrintStatus,
33133
- validate: this.validateData,
33134
- interval: this.POLL_INTERVAL,
33135
- maxAttempts: this.MAX_POLL_ATTEMPTS,
33136
- }).catch((err) => {
33137
- console.log(err);
33138
- this.printFailed = true;
33139
- this.printProcessing = false;
33140
- });
33200
+ // Wait for this print job to complete before processing the next file
33201
+ await this.waitForPrintCompletion();
33141
33202
  }
33142
33203
  else {
33143
- this.printFailed = true;
33144
- this.printProcessing = false;
33204
+ throw new Error(`No job ID returned for file: ${file.name}`);
33145
33205
  }
33146
- })
33147
- .catch((error) => {
33148
- console.log(error);
33149
- this.printFailed = true;
33150
- this.printProcessing = false;
33151
- });
33206
+ }
33207
+ else {
33208
+ throw new Error(`Upload failed for file: ${file.name}`);
33209
+ }
33152
33210
  }
33153
- else {
33154
- this.printFailed = true;
33155
- this.printProcessing = false;
33211
+ catch (error) {
33212
+ this.uploading = false;
33213
+ throw error;
33156
33214
  }
33215
+ this.uploading = false;
33216
+ }
33217
+ async waitForPrintCompletion() {
33218
+ return new Promise((resolve, reject) => {
33219
+ const poll = async () => {
33220
+ try {
33221
+ const data = await this.printService.getPrintStatus();
33222
+ if (data.jobstatus === 0) {
33223
+ resolve();
33224
+ }
33225
+ else if (data.jobstatus === 1) {
33226
+ // Still processing, continue polling
33227
+ setTimeout(poll, this.POLL_INTERVAL);
33228
+ }
33229
+ else {
33230
+ reject(new Error('Print job failed'));
33231
+ }
33232
+ }
33233
+ catch (error) {
33234
+ reject(error);
33235
+ }
33236
+ };
33237
+ poll();
33238
+ });
33239
+ }
33240
+ getFileExtension(filename) {
33241
+ const extension = filename.split('.').pop();
33242
+ return extension ? extension.toLowerCase() : '';
33157
33243
  }
33158
33244
  setDefaultPaperFormat() {
33159
33245
  var _a, _b, _c, _d, _e;
@@ -33204,18 +33290,23 @@ let EzpPrinterSelection = class {
33204
33290
  .then((data) => {
33205
33291
  var _a, _b, _c, _d, _e, _f, _g;
33206
33292
  this.selectedPrinterConfig = data[0];
33207
- this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33293
+ this.selectedProperties.color =
33294
+ ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
33208
33295
  this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33209
33296
  this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33210
- let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33297
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find((obj) => obj.Default === true);
33211
33298
  this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33212
33299
  this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33213
- let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33214
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33300
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find((obj) => obj.Default === true);
33301
+ if (this.selectedPrinterConfig.Trays &&
33302
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33303
+ this.selectedPrinterConfig.Trays[0] != null) {
33215
33304
  this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33216
33305
  this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33217
33306
  }
33218
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33307
+ if (this.selectedPrinterConfig.Trays &&
33308
+ this.selectedPrinterConfig.Trays.length >= 0 &&
33309
+ this.selectedPrinterConfig.Trays[0] == null) {
33219
33310
  delete this.selectedProperties.trayname;
33220
33311
  delete this.selectedProperties.defaultSource;
33221
33312
  }
@@ -33237,10 +33328,12 @@ let EzpPrinterSelection = class {
33237
33328
  .then((printerConfig) => {
33238
33329
  this.printerConfig = printerConfig;
33239
33330
  });
33240
- if (this.file) {
33241
- await this.validateFileType(this.filename).then((valid) => {
33242
- this.notSupported = !valid ? true : false;
33243
- });
33331
+ if (this.files && this.files.length > 0) {
33332
+ // Validate all files
33333
+ const validationPromises = this.files.map((file) => this.validateFileType(file.name));
33334
+ const validationResults = await Promise.all(validationPromises);
33335
+ const allValid = validationResults.every((valid) => valid);
33336
+ this.notSupported = !allValid;
33244
33337
  }
33245
33338
  this.loading = false;
33246
33339
  }
@@ -33251,11 +33344,25 @@ let EzpPrinterSelection = class {
33251
33344
  */
33252
33345
  render() {
33253
33346
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
33254
- return this.loading ? (index.h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (index.h(index.Host, { class: { seamless: this.seamless } }, index.h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && (index.h(index.Fragment, null, this.printProcessing ? (index.h("ezp-status", { processing: true, description: this.preparingUpload
33255
- ? i18next.t('printer_selection.prepare_upload')
33256
- : this.uploading
33257
- ? i18next.t('printer_selection.uploading')
33258
- : i18next.t('printer_selection.print_processing'), instance: "print-processing", cancel: true })) : this.selectedPrinter.is_queue && this.printSuccess ? (index.h("ezp-status", { icon: "checkmark-alt", description: i18next.t('printer_selection.pull_print_success'), instance: "print-success", close: true })) : this.printSuccess ? (index.h("ezp-status", { icon: "checkmark-alt", description: i18next.t('printer_selection.print_success'), instance: "print-success", close: true })) : this.printFailed ? (index.h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_failed'), instance: "print-failed", close: true, retry: true })) : this.notSupported ? (index.h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.not_supported'), instance: "not-supported", retry: true })) : this.noPrinters ? (index.h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.no_printers'), instance: "no-printers", close: true })) : null)), !this.hideheader && (index.h("div", { id: "header" }, index.h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }), index.h("ezp-label", { text: !this.notSupported ? this.filename : '', ellipsis: true }), !this.hidemenu && (index.h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))), index.h("div", { id: "body" }, index.h("div", { id: "printer" }, index.h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
33347
+ return this.loading ? (index.h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (index.h(index.Host, { class: { seamless: this.seamless } }, index.h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && (index.h(index.Fragment, null, this.printProcessing ? (index.h("ezp-status", { processing: true, description: this.totalFiles > 1
33348
+ ? `${i18next.t('printer_selection.print_processing')} (${this.currentFileIndex + 1}/${this.totalFiles})`
33349
+ : this.preparingUpload
33350
+ ? i18next.t('printer_selection.prepare_upload')
33351
+ : this.uploading
33352
+ ? i18next.t('printer_selection.uploading')
33353
+ : i18next.t('printer_selection.print_processing'), instance: "print-processing", cancel: true })) : this.selectedPrinter.is_queue && this.printSuccess ? (index.h("ezp-status", { icon: "checkmark-alt", description: this.totalFiles > 1
33354
+ ? this.failedFiles.length > 0
33355
+ ? `${i18next.t('printer_selection.pull_print_success')} (${this.successfulFiles.length}/${this.totalFiles} files)`
33356
+ : `${i18next.t('printer_selection.pull_print_success')} (${this.totalFiles} files)`
33357
+ : i18next.t('printer_selection.pull_print_success'), instance: "print-success", close: true })) : this.printSuccess ? (index.h("ezp-status", { icon: this.partialSuccess ? 'exclamation-mark' : 'checkmark-alt', description: this.totalFiles > 1
33358
+ ? this.partialSuccess
33359
+ ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} files) - ${this.failedFiles.length} failed`
33360
+ : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} files)`
33361
+ : i18next.t('printer_selection.print_success'), instance: "print-success", close: true })) : this.printFailed ? (index.h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_failed'), instance: "print-failed", close: true, retry: true })) : this.notSupported ? (index.h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.not_supported'), instance: "not-supported", retry: true })) : this.noPrinters ? (index.h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.no_printers'), instance: "no-printers", close: true })) : null)), !this.hideheader && (index.h("div", { id: "header" }, index.h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }), index.h("ezp-label", { text: !this.notSupported
33362
+ ? this.files && this.files.length > 1
33363
+ ? `${this.files.length} files selected`
33364
+ : this.filename
33365
+ : '', ellipsis: true }), !this.hidemenu && (index.h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))), index.h("div", { id: "body" }, index.h("div", { id: "printer" }, index.h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
33259
33366
  ? i18next.t('printer_selection.select_printer')
33260
33367
  : i18next.t('printer_selection.no_printers'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
33261
33368
  id: printer.id,
@@ -33267,27 +33374,29 @@ let EzpPrinterSelection = class {
33267
33374
  id: option.id,
33268
33375
  title: option.title,
33269
33376
  meta: '',
33270
- type: 'color'
33271
- })), preSelected: this.selectedPrinter.id
33272
- && ((_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Color) == "color"
33377
+ type: 'color',
33378
+ })), preSelected: this.selectedPrinter.id && ((_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Color) == 'color'
33273
33379
  ? i18next.t('printer_selection.color_color')
33274
33380
  : i18next.t('printer_selection.color_grayscale'), disabled: !this.selectedPrinterConfig.ColorSupported }), index.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) => ({
33275
33381
  id: option.id,
33276
33382
  title: option.title,
33277
33383
  meta: '',
33278
33384
  type: 'duplex',
33279
- })), preSelected: this.selectedPrinter.id && ((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == "duplex_simplex"
33385
+ })), preSelected: this.selectedPrinter.id &&
33386
+ ((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == 'duplex_simplex'
33280
33387
  ? i18next.t('printer_selection.duplex_none')
33281
- : ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) == "duplex_vertical"
33388
+ : ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) == 'duplex_vertical'
33282
33389
  ? i18next.t('printer_selection.duplex_long')
33283
- : ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) == "duplex_horizontal"
33390
+ : ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) == 'duplex_horizontal'
33284
33391
  ? i18next.t('printer_selection.duplex_short')
33285
- : null, disabled: !this.selectedPrinterConfig.DuplexSupported }), index.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 && this.selectedPrinterConfig.PaperFormats.map((format) => ({
33286
- id: format.Id,
33287
- title: format.Name,
33288
- meta: `${format.XRes} x ${format.YRes}`,
33289
- type: 'format',
33290
- })), preSelected: this.selectedPrinter.id && ((_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); }))
33392
+ : null, disabled: !this.selectedPrinterConfig.DuplexSupported }), index.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 &&
33393
+ this.selectedPrinterConfig.PaperFormats.map((format) => ({
33394
+ id: format.Id,
33395
+ title: format.Name,
33396
+ meta: `${format.XRes} x ${format.YRes}`,
33397
+ type: 'format',
33398
+ })), preSelected: this.selectedPrinter.id &&
33399
+ ((_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); }))
33291
33400
  ? (_h = this.selectedPrinterConfig.Default) === null || _h === void 0 ? void 0 : _h.Paper
33292
33401
  : null, disabled: !(((_j = this.selectedPrinterConfig.PaperFormats) === null || _j === void 0 ? void 0 : _j.length) > 0) }), this.paperid == PAPER_ID ? (index.h(index.Fragment, null, index.h("ezp-input", { icon: "width", suffix: "mm", value: this.selectedProperties.paperwidth, eventType: "width", type: "number", label: i18next.t('printer_selection.width') }), index.h("ezp-input", { icon: "height", suffix: "mm", value: this.selectedProperties.paperlength, eventType: "length", type: "number", label: i18next.t('printer_selection.length') }))) : null, index.h("ezp-select", { label: i18next.t('printer_selection.orientation'), icon: "orientation", placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.OrientationsSupported.map((orientation, index) => ({
33293
33402
  id: index + 1,
@@ -33299,14 +33408,20 @@ let EzpPrinterSelection = class {
33299
33408
  title: option,
33300
33409
  meta: '',
33301
33410
  type: 'quality',
33302
- })), preSelected: this.selectedPrinter.id && ((_l = this.selectedPrinterConfig.Resolutions) === null || _l === void 0 ? void 0 : _l.includes(this.selectedPrinterConfig.Default.Resolution))
33411
+ })), preSelected: this.selectedPrinter.id &&
33412
+ ((_l = this.selectedPrinterConfig.Resolutions) === null || _l === void 0 ? void 0 : _l.includes(this.selectedPrinterConfig.Default.Resolution))
33303
33413
  ? this.selectedPrinterConfig.Default.Resolution
33304
- : null, disabled: !(((_m = this.selectedPrinterConfig.Resolutions) === null || _m === void 0 ? void 0 : _m.length) > 0) }), this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null ? (index.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 && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays.map((trays) => ({
33305
- title: trays.Name,
33306
- id: trays.Index,
33307
- meta: '',
33308
- type: 'tray',
33309
- })), preSelected: this.selectedPrinter.id && ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33414
+ : null, disabled: !(((_m = this.selectedPrinterConfig.Resolutions) === null || _m === void 0 ? void 0 : _m.length) > 0) }), this.selectedPrinterConfig.Trays &&
33415
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33416
+ this.selectedPrinterConfig.Trays[0] != null ? (index.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 &&
33417
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33418
+ this.selectedPrinterConfig.Trays.map((trays) => ({
33419
+ title: trays.Name,
33420
+ id: trays.Index,
33421
+ meta: '',
33422
+ type: 'tray',
33423
+ })), preSelected: this.selectedPrinter.id &&
33424
+ ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33310
33425
  ? this.selectedPrinterConfig.Default.Tray
33311
33426
  : null })) : null, index.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') })), index.h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })), index.h("div", { id: "footer" }, index.h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), index.h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button), class: "action", id: "print" })), !this.hidemenu && index.h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33312
33427
  }
@@ -33343,6 +33458,7 @@ let EzpPrinting = class {
33343
33458
  this.authOpen = false;
33344
33459
  this.onlyGetSasUri = false;
33345
33460
  this.noDocumentOpen = false;
33461
+ this.files = [];
33346
33462
  }
33347
33463
  /** Watchers */
33348
33464
  watchFileData(newValue, oldValue) {
@@ -33352,7 +33468,7 @@ let EzpPrinting = class {
33352
33468
  for (let i = 0; i < newValue.length; i++) {
33353
33469
  array[i] = newValue.charCodeAt(i);
33354
33470
  }
33355
- this.file = new File([array], this.filename);
33471
+ this.files = [new File([array], this.filename)];
33356
33472
  }
33357
33473
  }
33358
33474
  watchFilename(newValue, oldValue) {
@@ -33404,8 +33520,8 @@ let EzpPrinting = class {
33404
33520
  }
33405
33521
  }
33406
33522
  listenUploadFile(event) {
33407
- this.filename = event.detail[0].name;
33408
- this.file = event.detail[0];
33523
+ this.files = event.detail;
33524
+ this.filename = this.files.length > 0 ? this.files[0].name : '';
33409
33525
  this.open();
33410
33526
  }
33411
33527
  listenDialogClose(event) {
@@ -33536,7 +33652,7 @@ let EzpPrinting = class {
33536
33652
  render() {
33537
33653
  return (index.h(index.Host, { class: `${userStore.state.theme} ${userStore.state.appearance === 'system'
33538
33654
  ? this.systemAppearance
33539
- : userStore.state.appearance} ${this.seamless ? 'seamless' : ''}` }, this.trigger === 'custom' ? (index.h("slot", null)) : this.trigger === 'file' ? (index.h("ezp-upload", null)) : (this.trigger === 'button' && (index.h("ezp-icon-button", { id: "print-trigger", icon: "printer", slot: "trigger", type: "button", onClick: () => this.open() }))), this.authOpen ? (index.h("ezp-auth", { clientID: this.clientid, redirectURI: this.redirecturi, hidelogin: this.hidelogin, trigger: this.trigger, code: this.code })) : this.printOpen ? (index.h("ezp-printer-selection", { clientID: this.clientid, redirectURI: this.redirecturi, filename: this.filename, fileurl: this.fileurl, filetype: this.filetype, fileid: this.fileid, file: this.file, hidemenu: this.hidemenu, hideheader: this.hideheader, seamless: this.seamless })) : this.noDocumentOpen ? (index.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));
33655
+ : userStore.state.appearance} ${this.seamless ? 'seamless' : ''}` }, this.trigger === 'custom' ? (index.h("slot", null)) : this.trigger === 'file' ? (index.h("ezp-upload", null)) : (this.trigger === 'button' && (index.h("ezp-icon-button", { id: "print-trigger", icon: "printer", slot: "trigger", type: "button", onClick: () => this.open() }))), this.authOpen ? (index.h("ezp-auth", { clientID: this.clientid, redirectURI: this.redirecturi, hidelogin: this.hidelogin, trigger: this.trigger, code: this.code })) : this.printOpen ? (index.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 ? (index.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));
33540
33656
  }
33541
33657
  static get watchers() { return {
33542
33658
  "filedata": ["watchFileData"],
@@ -33884,7 +34000,7 @@ let EzpUpload = class {
33884
34000
  * States
33885
34001
  *
33886
34002
  */
33887
- this.filename = '';
34003
+ this.selectedFiles = [];
33888
34004
  this.dragging = false;
33889
34005
  /**
33890
34006
  *
@@ -33892,8 +34008,9 @@ let EzpUpload = class {
33892
34008
  *
33893
34009
  */
33894
34010
  this.handleInput = () => {
33895
- this.filename = this.input.files[0].name;
33896
- this.uploadFile.emit(this.input.files);
34011
+ const files = Array.from(this.input.files);
34012
+ this.selectedFiles = files;
34013
+ this.uploadFile.emit(files);
33897
34014
  };
33898
34015
  }
33899
34016
  /**
@@ -33916,12 +34033,13 @@ let EzpUpload = class {
33916
34033
  event.stopPropagation();
33917
34034
  event.preventDefault();
33918
34035
  this.dragging = false;
33919
- this.filename = event.dataTransfer.files[0].name;
33920
- this.uploadFile.emit(event.dataTransfer.files);
34036
+ const files = Array.from(event.dataTransfer.files);
34037
+ this.selectedFiles = files;
34038
+ this.uploadFile.emit(files);
33921
34039
  }
33922
34040
  listenPrintCancel() {
33923
34041
  this.form.reset();
33924
- this.filename = '';
34042
+ this.selectedFiles = [];
33925
34043
  }
33926
34044
  /**
33927
34045
  *
@@ -33929,7 +34047,7 @@ let EzpUpload = class {
33929
34047
  *
33930
34048
  */
33931
34049
  render() {
33932
- return (index.h(index.Host, { class: { dragging: this.dragging } }, index.h("form", { id: "form", ref: (form) => (this.form = form) }, index.h("div", { id: "header" }, index.h("ezp-icon", { name: "drag-drop", size: "huge", framed: true }), index.h("ezp-label", { weight: "strong", text: i18next.t('upload.description') }), index.h("div", { id: "meta" }, index.h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_leading') }), index.h("label", { htmlFor: "input", id: "select" }, index.h("ezp-label", { level: "tertiary", weight: "strong", text: i18next.t('upload.meta_select') })), index.h("input", { type: "file", name: "input", id: "input", ref: (input) => (this.input = input), onInput: this.handleInput }), index.h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_trailing') })), this.filename != '' && (index.h(index.Fragment, null, index.h("ezp-label", { level: "secondary", text: i18next.t('upload.selected_file') }), index.h("ezp-label", { level: "tertiary", text: this.filename })))))));
34050
+ return (index.h(index.Host, { class: { dragging: this.dragging } }, index.h("form", { id: "form", ref: (form) => (this.form = form) }, index.h("div", { id: "header" }, index.h("ezp-icon", { name: "drag-drop", size: "huge", framed: true }), index.h("ezp-label", { weight: "strong", text: i18next.t('upload.description') }), index.h("div", { id: "meta" }, index.h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_leading') }), index.h("label", { htmlFor: "input", id: "select" }, index.h("ezp-label", { level: "tertiary", weight: "strong", text: i18next.t('upload.meta_select') })), index.h("input", { type: "file", name: "input", id: "input", multiple: true, ref: (input) => (this.input = input), onInput: this.handleInput }), index.h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_trailing') })), this.selectedFiles.length > 0 && (index.h(index.Fragment, null, index.h("ezp-label", { level: "secondary", text: i18next.t('upload.selected_files') }), this.selectedFiles.map((file, index$1) => (index.h("ezp-label", { key: index$1, level: "tertiary", text: file.name })))))))));
33933
34051
  }
33934
34052
  };
33935
34053
  EzpUpload.style = ezpUploadCss;