@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
@@ -2886,11 +2886,11 @@ const button_actions$1 = {
2886
2886
  select_printer: "Wähle Drucker"
2887
2887
  };
2888
2888
  const upload$1 = {
2889
- description: "Ziehe eine Datei hier in den Browser ",
2889
+ description: "Ziehe Dateien hier in den Browser ",
2890
2890
  meta_leading: "oder",
2891
- meta_select: "wähle eine Datei aus",
2891
+ meta_select: "wähle Dateien aus",
2892
2892
  meta_trailing: "um mit ezeep Blue zu drucken.",
2893
- selected_file: "Ausgewählte Datei:"
2893
+ selected_files: "Ausgewählte Dateien:"
2894
2894
  };
2895
2895
  const user_menu$1 = {
2896
2896
  theme: "Farbschema",
@@ -2969,11 +2969,11 @@ const button_actions = {
2969
2969
  select_printer: "Select Printer"
2970
2970
  };
2971
2971
  const upload = {
2972
- description: "Drop a file here into the browser ",
2972
+ description: "Drop files here into the browser ",
2973
2973
  meta_leading: "or",
2974
- meta_select: "select a file",
2974
+ meta_select: "select files",
2975
2975
  meta_trailing: "to print with ezeep Blue.",
2976
- selected_file: "Selected File:"
2976
+ selected_files: "Selected Files:"
2977
2977
  };
2978
2978
  const user_menu = {
2979
2979
  theme: "Color theme",
@@ -32567,6 +32567,7 @@ class PageBlobClient extends BlobClient {
32567
32567
 
32568
32568
  class EzpPrintService {
32569
32569
  constructor(redirectURI, clientID) {
32570
+ this.abortController = null;
32570
32571
  this.getPrintStatus = () => {
32571
32572
  return fetch(`https://${this.printingApi}/sfapi/Status/?id=${encodeURIComponent(printStore.state.jobID)}`, {
32572
32573
  headers: {
@@ -32655,6 +32656,7 @@ class EzpPrintService {
32655
32656
  });
32656
32657
  }
32657
32658
  printFileByUrl(accessToken, fileUrl, fileType, printerID, properties, filename, printAndDelete) {
32659
+ this.abortController = new AbortController();
32658
32660
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32659
32661
  method: 'POST',
32660
32662
  headers: {
@@ -32662,8 +32664,15 @@ class EzpPrintService {
32662
32664
  'Content-Type': 'application/json',
32663
32665
  },
32664
32666
  body: JSON.stringify(Object.assign(Object.assign(Object.assign({ fileurl: fileUrl, type: fileType, printerid: printerID }, (filename && { alias: filename })), (printAndDelete && { printanddelete: printAndDelete })), { properties })),
32667
+ signal: this.abortController.signal
32665
32668
  });
32666
32669
  }
32670
+ abortPrint() {
32671
+ if (this.abortController) {
32672
+ this.abortController.abort();
32673
+ this.abortController = null;
32674
+ }
32675
+ }
32667
32676
  printByFileID(accessToken, fileID, fileType, printerID, properties, filename, printAndDelete) {
32668
32677
  return fetch(`https://${this.printingApi}/sfapi/Print/`, {
32669
32678
  method: 'POST',
@@ -32757,7 +32766,6 @@ let EzpPrinterSelection = class {
32757
32766
  this.printCancel = createEvent(this, "printCancel", 7);
32758
32767
  this.printSubmit = createEvent(this, "printSubmit", 7);
32759
32768
  this.logout = createEvent(this, "logout", 7);
32760
- this.sasUri = '';
32761
32769
  this.fileExtension = '';
32762
32770
  this.duplexOptions = [
32763
32771
  {
@@ -32781,7 +32789,7 @@ let EzpPrinterSelection = class {
32781
32789
  {
32782
32790
  id: 2,
32783
32791
  title: i18next.t('printer_selection.color_grayscale'),
32784
- }
32792
+ },
32785
32793
  ];
32786
32794
  this.hidemenu = false;
32787
32795
  this.hideheader = false;
@@ -32808,14 +32816,14 @@ let EzpPrinterSelection = class {
32808
32816
  Paper: '',
32809
32817
  Orientation: '',
32810
32818
  Resolution: '',
32811
- Tray: ''
32819
+ Tray: '',
32812
32820
  },
32813
32821
  OrientationsSupported: [],
32814
32822
  PaperFormats: [],
32815
32823
  Resolutions: [],
32816
32824
  DuplexSupported: false,
32817
32825
  Color: false,
32818
- Trays: []
32826
+ Trays: [],
32819
32827
  };
32820
32828
  // needs to be initialised with empty strings
32821
32829
  this.selectedProperties = {
@@ -32833,6 +32841,11 @@ let EzpPrinterSelection = class {
32833
32841
  trayname: '',
32834
32842
  PageRanges: '',
32835
32843
  };
32844
+ this.currentFileIndex = 0;
32845
+ this.totalFiles = 0;
32846
+ this.failedFiles = [];
32847
+ this.successfulFiles = [];
32848
+ this.partialSuccess = false;
32836
32849
  /**
32837
32850
  *
32838
32851
  * Private methods
@@ -32840,6 +32853,9 @@ let EzpPrinterSelection = class {
32840
32853
  */
32841
32854
  /** Description... */
32842
32855
  this.handleCancel = () => {
32856
+ this.failedFiles = [];
32857
+ this.successfulFiles = [];
32858
+ this.partialSuccess = false;
32843
32859
  this.printCancel.emit();
32844
32860
  };
32845
32861
  this.validateData = (data) => {
@@ -32856,9 +32872,14 @@ let EzpPrinterSelection = class {
32856
32872
  this.handlePrint = async () => {
32857
32873
  this.printButton.blur();
32858
32874
  this.printProcessing = true;
32875
+ this.failedFiles = [];
32876
+ this.successfulFiles = [];
32877
+ this.partialSuccess = false;
32859
32878
  // we have to initialse this obj with empty strings to display the select component
32860
32879
  // but don't want to send any attributes with empty strings to the API
32861
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
32880
+ if (this.selectedPrinterConfig.Trays &&
32881
+ this.selectedPrinterConfig.Trays.length >= 0 &&
32882
+ this.selectedPrinterConfig.Trays[0] == null) {
32862
32883
  delete this.selectedProperties.trayname;
32863
32884
  delete this.selectedProperties.defaultSource;
32864
32885
  }
@@ -32918,8 +32939,8 @@ let EzpPrinterSelection = class {
32918
32939
  this.printProcessing = false;
32919
32940
  });
32920
32941
  }
32921
- if (this.file) {
32922
- await this.handleFiles(this.file, cleanPrintProperties);
32942
+ if (this.files && this.files.length > 0) {
32943
+ await this.handleFiles(this.files, cleanPrintProperties);
32923
32944
  }
32924
32945
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
32925
32946
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
@@ -32959,17 +32980,24 @@ let EzpPrinterSelection = class {
32959
32980
  if (event.detail === 'print-processing') {
32960
32981
  this.printStopped = true;
32961
32982
  this.printProcessing = false;
32983
+ // Abort the print request
32984
+ this.printService.abortPrint();
32962
32985
  }
32963
32986
  }
32964
32987
  listenStatusClose(event) {
32965
32988
  switch (event.detail) {
32966
32989
  case 'print-success':
32967
32990
  this.printSuccess = false;
32991
+ this.partialSuccess = false;
32992
+ this.failedFiles = [];
32993
+ this.successfulFiles = [];
32968
32994
  this.printCancel.emit();
32969
32995
  break;
32970
32996
  case 'print-failed':
32971
32997
  this.printProcessing = false;
32972
32998
  this.printFailed = false;
32999
+ this.failedFiles = [];
33000
+ this.successfulFiles = [];
32973
33001
  break;
32974
33002
  case 'no-printers':
32975
33003
  this.noPrinters = false;
@@ -33029,18 +33057,23 @@ let EzpPrinterSelection = class {
33029
33057
  .then((data) => {
33030
33058
  var _a, _b, _c, _d, _e, _f, _g;
33031
33059
  this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
33032
- this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33060
+ this.selectedProperties.color =
33061
+ ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
33033
33062
  this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33034
33063
  this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33035
- let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33064
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find((obj) => obj.Default === true);
33036
33065
  this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33037
33066
  this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33038
- let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33039
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33067
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find((obj) => obj.Default === true);
33068
+ if (this.selectedPrinterConfig.Trays &&
33069
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33070
+ this.selectedPrinterConfig.Trays[0] != null) {
33040
33071
  this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33041
33072
  this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33042
33073
  }
33043
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33074
+ if (this.selectedPrinterConfig.Trays &&
33075
+ this.selectedPrinterConfig.Trays.length >= 0 &&
33076
+ this.selectedPrinterConfig.Trays[0] == null) {
33044
33077
  delete this.selectedProperties.trayname;
33045
33078
  delete this.selectedProperties.defaultSource;
33046
33079
  }
@@ -33051,7 +33084,8 @@ let EzpPrinterSelection = class {
33051
33084
  // this.setDefaultPaperFormat()
33052
33085
  break;
33053
33086
  case 'color':
33054
- this.selectedProperties.color = eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
33087
+ this.selectedProperties.color =
33088
+ eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
33055
33089
  break;
33056
33090
  case 'orientation':
33057
33091
  this.selectedProperties.orientation = eventDetails.id;
@@ -33070,11 +33104,15 @@ let EzpPrinterSelection = class {
33070
33104
  this.selectedProperties.paperwidth = eventDetails.value;
33071
33105
  break;
33072
33106
  case 'tray':
33073
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33107
+ if (this.selectedPrinterConfig.Trays &&
33108
+ this.selectedPrinterConfig.Trays.length >= 0 &&
33109
+ this.selectedPrinterConfig.Trays[0] == null) {
33074
33110
  delete this.selectedProperties.trayname;
33075
33111
  delete this.selectedProperties.defaultSource;
33076
33112
  }
33077
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33113
+ if (this.selectedPrinterConfig.Trays &&
33114
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33115
+ this.selectedPrinterConfig.Trays[0] != null) {
33078
33116
  this.selectedProperties.trayname = eventDetails.title;
33079
33117
  this.selectedProperties.defaultSource = eventDetails.id;
33080
33118
  }
@@ -33084,9 +33122,9 @@ let EzpPrinterSelection = class {
33084
33122
  this.pageRangeInvalid = !validatePageRange(this.selectedProperties.PageRanges);
33085
33123
  break;
33086
33124
  case 'duplex':
33087
- if (eventDetails.title == i18next.t('printer_selection.duplex_none')
33088
- || eventDetails.title == i18next.t('printer_selection.duplex_long')
33089
- || eventDetails.title == i18next.t('printer_selection.duplex_short')) {
33125
+ if (eventDetails.title == i18next.t('printer_selection.duplex_none') ||
33126
+ eventDetails.title == i18next.t('printer_selection.duplex_long') ||
33127
+ eventDetails.title == i18next.t('printer_selection.duplex_short')) {
33090
33128
  this.selectedProperties.duplex = true;
33091
33129
  }
33092
33130
  else {
@@ -33097,59 +33135,107 @@ let EzpPrinterSelection = class {
33097
33135
  }
33098
33136
  this.setPaperid();
33099
33137
  }
33100
- async handleFiles(file, printPorperties) {
33138
+ async handleFiles(files, printPorperties) {
33139
+ this.totalFiles = files.length;
33140
+ this.currentFileIndex = 0;
33141
+ this.failedFiles = [];
33142
+ this.successfulFiles = [];
33143
+ // Process each file individually
33144
+ for (let i = 0; i < files.length; i++) {
33145
+ this.currentFileIndex = i;
33146
+ const file = files[i];
33147
+ try {
33148
+ await this.processSingleFile(file, printPorperties);
33149
+ this.successfulFiles.push(file.name);
33150
+ }
33151
+ catch (error) {
33152
+ console.error(`Error processing file ${file.name}:`, error);
33153
+ this.failedFiles.push(file.name);
33154
+ // Continue with the next file instead of stopping
33155
+ }
33156
+ }
33157
+ // Determine final status based on results
33158
+ if (this.failedFiles.length === 0) {
33159
+ // All files processed successfully
33160
+ this.printSuccess = true;
33161
+ this.partialSuccess = false;
33162
+ this.printProcessing = false;
33163
+ }
33164
+ else if (this.successfulFiles.length === 0) {
33165
+ // All files failed
33166
+ this.printFailed = true;
33167
+ this.partialSuccess = false;
33168
+ this.printProcessing = false;
33169
+ }
33170
+ else {
33171
+ // Some files succeeded, some failed - show partial success
33172
+ this.printSuccess = true;
33173
+ this.partialSuccess = true;
33174
+ this.printProcessing = false;
33175
+ }
33176
+ }
33177
+ async processSingleFile(file, printProperties) {
33101
33178
  this.preparingUpload = true;
33102
33179
  const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
33103
33180
  this.preparingUpload = false;
33104
- this.fileid = response.fileid;
33105
- this.sasUri = response.sasUri;
33106
- this.filetype = this.fileExtension;
33107
- let res;
33181
+ const fileid = response.fileid;
33182
+ const sasUri = response.sasUri;
33183
+ const filetype = this.getFileExtension(file.name);
33108
33184
  this.uploading = true;
33109
33185
  try {
33110
- res = await this.printService.uploadBlobFiles(this.sasUri, file);
33111
- }
33112
- catch (error) {
33113
- this.printProcessing = false;
33114
- this.printFailed = true;
33115
- }
33116
- this.uploading = false;
33117
- if (res._response.status === 201) {
33118
- this.printService
33119
- .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, printPorperties, this.filename)
33120
- .then((data) => {
33186
+ // Upload the file
33187
+ const res = await this.printService.uploadBlobFiles(sasUri, file);
33188
+ if (res._response.status === 201) {
33189
+ // Print the file
33190
+ const data = await this.printService.printByFileID(authStore.state.accessToken, fileid, filetype, this.selectedPrinter.id, printProperties, file.name);
33121
33191
  if (data.code === 804) {
33122
- this.printFailed = true;
33123
- this.printProcessing = false;
33192
+ throw new Error(`Print failed for file: ${file.name}`);
33124
33193
  }
33125
33194
  if (data.jobid) {
33126
33195
  printStore.state.jobID = data.jobid;
33127
- poll({
33128
- fn: this.printService.getPrintStatus,
33129
- validate: this.validateData,
33130
- interval: this.POLL_INTERVAL,
33131
- maxAttempts: this.MAX_POLL_ATTEMPTS,
33132
- }).catch((err) => {
33133
- console.log(err);
33134
- this.printFailed = true;
33135
- this.printProcessing = false;
33136
- });
33196
+ // Wait for this print job to complete before processing the next file
33197
+ await this.waitForPrintCompletion();
33137
33198
  }
33138
33199
  else {
33139
- this.printFailed = true;
33140
- this.printProcessing = false;
33200
+ throw new Error(`No job ID returned for file: ${file.name}`);
33141
33201
  }
33142
- })
33143
- .catch((error) => {
33144
- console.log(error);
33145
- this.printFailed = true;
33146
- this.printProcessing = false;
33147
- });
33202
+ }
33203
+ else {
33204
+ throw new Error(`Upload failed for file: ${file.name}`);
33205
+ }
33148
33206
  }
33149
- else {
33150
- this.printFailed = true;
33151
- this.printProcessing = false;
33207
+ catch (error) {
33208
+ this.uploading = false;
33209
+ throw error;
33152
33210
  }
33211
+ this.uploading = false;
33212
+ }
33213
+ async waitForPrintCompletion() {
33214
+ return new Promise((resolve, reject) => {
33215
+ const poll = async () => {
33216
+ try {
33217
+ const data = await this.printService.getPrintStatus();
33218
+ if (data.jobstatus === 0) {
33219
+ resolve();
33220
+ }
33221
+ else if (data.jobstatus === 1) {
33222
+ // Still processing, continue polling
33223
+ setTimeout(poll, this.POLL_INTERVAL);
33224
+ }
33225
+ else {
33226
+ reject(new Error('Print job failed'));
33227
+ }
33228
+ }
33229
+ catch (error) {
33230
+ reject(error);
33231
+ }
33232
+ };
33233
+ poll();
33234
+ });
33235
+ }
33236
+ getFileExtension(filename) {
33237
+ const extension = filename.split('.').pop();
33238
+ return extension ? extension.toLowerCase() : '';
33153
33239
  }
33154
33240
  setDefaultPaperFormat() {
33155
33241
  var _a, _b, _c, _d, _e;
@@ -33200,18 +33286,23 @@ let EzpPrinterSelection = class {
33200
33286
  .then((data) => {
33201
33287
  var _a, _b, _c, _d, _e, _f, _g;
33202
33288
  this.selectedPrinterConfig = data[0];
33203
- this.selectedProperties.color = ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == "color" ? true : false;
33289
+ this.selectedProperties.color =
33290
+ ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Color) == 'color' ? true : false;
33204
33291
  this.selectedProperties.orientation = (_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Orientation;
33205
33292
  this.selectedProperties.resolution = (_c = this.selectedPrinterConfig.Default) === null || _c === void 0 ? void 0 : _c.Resolution;
33206
- let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find(obj => obj.Default === true);
33293
+ let defaultPaper = (_d = this.selectedPrinterConfig.PaperFormats) === null || _d === void 0 ? void 0 : _d.find((obj) => obj.Default === true);
33207
33294
  this.selectedProperties.paper = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Name;
33208
33295
  this.selectedProperties.paperid = defaultPaper === null || defaultPaper === void 0 ? void 0 : defaultPaper.Id;
33209
- let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find(obj => obj.Default === true);
33210
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1 && this.selectedPrinterConfig.Trays[0] != null) {
33296
+ let defaultSource = (_e = this.selectedPrinterConfig.Trays) === null || _e === void 0 ? void 0 : _e.find((obj) => obj.Default === true);
33297
+ if (this.selectedPrinterConfig.Trays &&
33298
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33299
+ this.selectedPrinterConfig.Trays[0] != null) {
33211
33300
  this.selectedProperties.trayname = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Name;
33212
33301
  this.selectedProperties.defaultSource = defaultSource === null || defaultSource === void 0 ? void 0 : defaultSource.Index;
33213
33302
  }
33214
- if (this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 0 && this.selectedPrinterConfig.Trays[0] == null) {
33303
+ if (this.selectedPrinterConfig.Trays &&
33304
+ this.selectedPrinterConfig.Trays.length >= 0 &&
33305
+ this.selectedPrinterConfig.Trays[0] == null) {
33215
33306
  delete this.selectedProperties.trayname;
33216
33307
  delete this.selectedProperties.defaultSource;
33217
33308
  }
@@ -33233,10 +33324,12 @@ let EzpPrinterSelection = class {
33233
33324
  .then((printerConfig) => {
33234
33325
  this.printerConfig = printerConfig;
33235
33326
  });
33236
- if (this.file) {
33237
- await this.validateFileType(this.filename).then((valid) => {
33238
- this.notSupported = !valid ? true : false;
33239
- });
33327
+ if (this.files && this.files.length > 0) {
33328
+ // Validate all files
33329
+ const validationPromises = this.files.map((file) => this.validateFileType(file.name));
33330
+ const validationResults = await Promise.all(validationPromises);
33331
+ const allValid = validationResults.every((valid) => valid);
33332
+ this.notSupported = !allValid;
33240
33333
  }
33241
33334
  this.loading = false;
33242
33335
  }
@@ -33247,11 +33340,25 @@ let EzpPrinterSelection = class {
33247
33340
  */
33248
33341
  render() {
33249
33342
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
33250
- return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } }, h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.preparingUpload
33251
- ? i18next.t('printer_selection.prepare_upload')
33252
- : this.uploading
33253
- ? i18next.t('printer_selection.uploading')
33254
- : i18next.t('printer_selection.print_processing'), instance: "print-processing", cancel: true })) : this.selectedPrinter.is_queue && this.printSuccess ? (h("ezp-status", { icon: "checkmark-alt", description: i18next.t('printer_selection.pull_print_success'), instance: "print-success", close: true })) : this.printSuccess ? (h("ezp-status", { icon: "checkmark-alt", description: 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)), !this.hideheader && (h("div", { id: "header" }, h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }), h("ezp-label", { text: !this.notSupported ? this.filename : '', ellipsis: true }), !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))), h("div", { id: "body" }, h("div", { id: "printer" }, h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
33343
+ return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } }, h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.totalFiles > 1
33344
+ ? `${i18next.t('printer_selection.print_processing')} (${this.currentFileIndex + 1}/${this.totalFiles})`
33345
+ : this.preparingUpload
33346
+ ? i18next.t('printer_selection.prepare_upload')
33347
+ : this.uploading
33348
+ ? i18next.t('printer_selection.uploading')
33349
+ : 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
33350
+ ? this.failedFiles.length > 0
33351
+ ? `${i18next.t('printer_selection.pull_print_success')} (${this.successfulFiles.length}/${this.totalFiles} files)`
33352
+ : `${i18next.t('printer_selection.pull_print_success')} (${this.totalFiles} files)`
33353
+ : 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
33354
+ ? this.partialSuccess
33355
+ ? `${i18next.t('printer_selection.print_success')} (${this.successfulFiles.length}/${this.totalFiles} files) - ${this.failedFiles.length} failed`
33356
+ : `${i18next.t('printer_selection.print_success')} (${this.totalFiles} files)`
33357
+ : 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)), !this.hideheader && (h("div", { id: "header" }, h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }), h("ezp-label", { text: !this.notSupported
33358
+ ? this.files && this.files.length > 1
33359
+ ? `${this.files.length} files selected`
33360
+ : this.filename
33361
+ : '', ellipsis: true }), !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })))), h("div", { id: "body" }, h("div", { id: "printer" }, h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
33255
33362
  ? i18next.t('printer_selection.select_printer')
33256
33363
  : i18next.t('printer_selection.no_printers'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
33257
33364
  id: printer.id,
@@ -33263,27 +33370,29 @@ let EzpPrinterSelection = class {
33263
33370
  id: option.id,
33264
33371
  title: option.title,
33265
33372
  meta: '',
33266
- type: 'color'
33267
- })), preSelected: this.selectedPrinter.id
33268
- && ((_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Color) == "color"
33373
+ type: 'color',
33374
+ })), preSelected: this.selectedPrinter.id && ((_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Color) == 'color'
33269
33375
  ? i18next.t('printer_selection.color_color')
33270
33376
  : i18next.t('printer_selection.color_grayscale'), disabled: !this.selectedPrinterConfig.ColorSupported }), 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) => ({
33271
33377
  id: option.id,
33272
33378
  title: option.title,
33273
33379
  meta: '',
33274
33380
  type: 'duplex',
33275
- })), preSelected: this.selectedPrinter.id && ((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == "duplex_simplex"
33381
+ })), preSelected: this.selectedPrinter.id &&
33382
+ ((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == 'duplex_simplex'
33276
33383
  ? i18next.t('printer_selection.duplex_none')
33277
- : ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) == "duplex_vertical"
33384
+ : ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) == 'duplex_vertical'
33278
33385
  ? i18next.t('printer_selection.duplex_long')
33279
- : ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) == "duplex_horizontal"
33386
+ : ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) == 'duplex_horizontal'
33280
33387
  ? i18next.t('printer_selection.duplex_short')
33281
- : null, disabled: !this.selectedPrinterConfig.DuplexSupported }), 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) => ({
33282
- id: format.Id,
33283
- title: format.Name,
33284
- meta: `${format.XRes} x ${format.YRes}`,
33285
- type: 'format',
33286
- })), 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); }))
33388
+ : null, disabled: !this.selectedPrinterConfig.DuplexSupported }), 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 &&
33389
+ this.selectedPrinterConfig.PaperFormats.map((format) => ({
33390
+ id: format.Id,
33391
+ title: format.Name,
33392
+ meta: `${format.XRes} x ${format.YRes}`,
33393
+ type: 'format',
33394
+ })), preSelected: this.selectedPrinter.id &&
33395
+ ((_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); }))
33287
33396
  ? (_h = this.selectedPrinterConfig.Default) === null || _h === void 0 ? void 0 : _h.Paper
33288
33397
  : null, disabled: !(((_j = this.selectedPrinterConfig.PaperFormats) === null || _j === void 0 ? void 0 : _j.length) > 0) }), this.paperid == PAPER_ID ? (h(Fragment, null, h("ezp-input", { icon: "width", suffix: "mm", value: this.selectedProperties.paperwidth, eventType: "width", type: "number", label: i18next.t('printer_selection.width') }), h("ezp-input", { icon: "height", suffix: "mm", value: this.selectedProperties.paperlength, eventType: "length", type: "number", label: i18next.t('printer_selection.length') }))) : null, 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) => ({
33289
33398
  id: index + 1,
@@ -33295,14 +33404,20 @@ let EzpPrinterSelection = class {
33295
33404
  title: option,
33296
33405
  meta: '',
33297
33406
  type: 'quality',
33298
- })), preSelected: this.selectedPrinter.id && ((_l = this.selectedPrinterConfig.Resolutions) === null || _l === void 0 ? void 0 : _l.includes(this.selectedPrinterConfig.Default.Resolution))
33407
+ })), preSelected: this.selectedPrinter.id &&
33408
+ ((_l = this.selectedPrinterConfig.Resolutions) === null || _l === void 0 ? void 0 : _l.includes(this.selectedPrinterConfig.Default.Resolution))
33299
33409
  ? this.selectedPrinterConfig.Default.Resolution
33300
- : 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 ? (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) => ({
33301
- title: trays.Name,
33302
- id: trays.Index,
33303
- meta: '',
33304
- type: 'tray',
33305
- })), preSelected: this.selectedPrinter.id && ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33410
+ : null, disabled: !(((_m = this.selectedPrinterConfig.Resolutions) === null || _m === void 0 ? void 0 : _m.length) > 0) }), this.selectedPrinterConfig.Trays &&
33411
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33412
+ 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 &&
33413
+ this.selectedPrinterConfig.Trays.length >= 1 &&
33414
+ this.selectedPrinterConfig.Trays.map((trays) => ({
33415
+ title: trays.Name,
33416
+ id: trays.Index,
33417
+ meta: '',
33418
+ type: 'tray',
33419
+ })), preSelected: this.selectedPrinter.id &&
33420
+ ((_o = this.selectedPrinterConfig.Trays) === null || _o === void 0 ? void 0 : _o.find((el) => el.Name.includes(this.selectedPrinterConfig.Default.Tray)))
33306
33421
  ? this.selectedPrinterConfig.Default.Tray
33307
33422
  : null })) : null, 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') })), h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), 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 && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33308
33423
  }
@@ -33339,6 +33454,7 @@ let EzpPrinting = class {
33339
33454
  this.authOpen = false;
33340
33455
  this.onlyGetSasUri = false;
33341
33456
  this.noDocumentOpen = false;
33457
+ this.files = [];
33342
33458
  }
33343
33459
  /** Watchers */
33344
33460
  watchFileData(newValue, oldValue) {
@@ -33348,7 +33464,7 @@ let EzpPrinting = class {
33348
33464
  for (let i = 0; i < newValue.length; i++) {
33349
33465
  array[i] = newValue.charCodeAt(i);
33350
33466
  }
33351
- this.file = new File([array], this.filename);
33467
+ this.files = [new File([array], this.filename)];
33352
33468
  }
33353
33469
  }
33354
33470
  watchFilename(newValue, oldValue) {
@@ -33400,8 +33516,8 @@ let EzpPrinting = class {
33400
33516
  }
33401
33517
  }
33402
33518
  listenUploadFile(event) {
33403
- this.filename = event.detail[0].name;
33404
- this.file = event.detail[0];
33519
+ this.files = event.detail;
33520
+ this.filename = this.files.length > 0 ? this.files[0].name : '';
33405
33521
  this.open();
33406
33522
  }
33407
33523
  listenDialogClose(event) {
@@ -33532,7 +33648,7 @@ let EzpPrinting = class {
33532
33648
  render() {
33533
33649
  return (h(Host, { class: `${userStore.state.theme} ${userStore.state.appearance === 'system'
33534
33650
  ? this.systemAppearance
33535
- : userStore.state.appearance} ${this.seamless ? 'seamless' : ''}` }, 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() }))), 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, file: this.file, 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));
33651
+ : userStore.state.appearance} ${this.seamless ? 'seamless' : ''}` }, 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() }))), 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));
33536
33652
  }
33537
33653
  static get watchers() { return {
33538
33654
  "filedata": ["watchFileData"],
@@ -33880,7 +33996,7 @@ let EzpUpload = class {
33880
33996
  * States
33881
33997
  *
33882
33998
  */
33883
- this.filename = '';
33999
+ this.selectedFiles = [];
33884
34000
  this.dragging = false;
33885
34001
  /**
33886
34002
  *
@@ -33888,8 +34004,9 @@ let EzpUpload = class {
33888
34004
  *
33889
34005
  */
33890
34006
  this.handleInput = () => {
33891
- this.filename = this.input.files[0].name;
33892
- this.uploadFile.emit(this.input.files);
34007
+ const files = Array.from(this.input.files);
34008
+ this.selectedFiles = files;
34009
+ this.uploadFile.emit(files);
33893
34010
  };
33894
34011
  }
33895
34012
  /**
@@ -33912,12 +34029,13 @@ let EzpUpload = class {
33912
34029
  event.stopPropagation();
33913
34030
  event.preventDefault();
33914
34031
  this.dragging = false;
33915
- this.filename = event.dataTransfer.files[0].name;
33916
- this.uploadFile.emit(event.dataTransfer.files);
34032
+ const files = Array.from(event.dataTransfer.files);
34033
+ this.selectedFiles = files;
34034
+ this.uploadFile.emit(files);
33917
34035
  }
33918
34036
  listenPrintCancel() {
33919
34037
  this.form.reset();
33920
- this.filename = '';
34038
+ this.selectedFiles = [];
33921
34039
  }
33922
34040
  /**
33923
34041
  *
@@ -33925,7 +34043,7 @@ let EzpUpload = class {
33925
34043
  *
33926
34044
  */
33927
34045
  render() {
33928
- return (h(Host, { class: { dragging: this.dragging } }, h("form", { id: "form", ref: (form) => (this.form = form) }, h("div", { id: "header" }, h("ezp-icon", { name: "drag-drop", size: "huge", framed: true }), h("ezp-label", { weight: "strong", text: i18next.t('upload.description') }), h("div", { id: "meta" }, h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_leading') }), h("label", { htmlFor: "input", id: "select" }, h("ezp-label", { level: "tertiary", weight: "strong", text: i18next.t('upload.meta_select') })), h("input", { type: "file", name: "input", id: "input", ref: (input) => (this.input = input), onInput: this.handleInput }), h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_trailing') })), this.filename != '' && (h(Fragment, null, h("ezp-label", { level: "secondary", text: i18next.t('upload.selected_file') }), h("ezp-label", { level: "tertiary", text: this.filename })))))));
34046
+ return (h(Host, { class: { dragging: this.dragging } }, h("form", { id: "form", ref: (form) => (this.form = form) }, h("div", { id: "header" }, h("ezp-icon", { name: "drag-drop", size: "huge", framed: true }), h("ezp-label", { weight: "strong", text: i18next.t('upload.description') }), h("div", { id: "meta" }, h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_leading') }), h("label", { htmlFor: "input", id: "select" }, h("ezp-label", { level: "tertiary", weight: "strong", text: i18next.t('upload.meta_select') })), h("input", { type: "file", name: "input", id: "input", multiple: true, ref: (input) => (this.input = input), onInput: this.handleInput }), h("ezp-label", { level: "tertiary", text: i18next.t('upload.meta_trailing') })), this.selectedFiles.length > 0 && (h(Fragment, null, h("ezp-label", { level: "secondary", text: i18next.t('upload.selected_files') }), this.selectedFiles.map((file, index) => (h("ezp-label", { key: index, level: "tertiary", text: file.name })))))))));
33929
34047
  }
33930
34048
  };
33931
34049
  EzpUpload.style = ezpUploadCss;