@ezeep/ezeep-js 1.0.140 → 1.0.144

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 (163) hide show
  1. package/dist/cjs/ezeep.cjs.js +2 -2
  2. package/dist/cjs/ezp-auth_14.cjs.entry.js +33754 -0
  3. package/dist/cjs/{index-a93095ed.js → index-62fc857c.js} +7 -0
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +3 -1
  6. package/dist/collection/components/ezp-auth/ezp-auth.css +3 -77
  7. package/dist/collection/components/ezp-auth/ezp-auth.js +26 -20
  8. package/dist/collection/components/ezp-backdrop/ezp-backdrop.css +3 -3
  9. package/dist/collection/components/ezp-dialog/ezp-dialog.css +48 -0
  10. package/dist/collection/components/ezp-dialog/ezp-dialog.js +220 -0
  11. package/dist/collection/components/ezp-icon/assets/glyph-account.svg +2 -2
  12. package/dist/collection/components/ezp-icon/assets/glyph-checkmark-alt.svg +3 -0
  13. package/dist/collection/components/ezp-icon/assets/glyph-checkmark.svg +2 -2
  14. package/dist/collection/components/ezp-icon/assets/glyph-close.svg +2 -2
  15. package/dist/collection/components/ezp-icon/assets/glyph-color.svg +2 -2
  16. package/dist/collection/components/ezp-icon/assets/glyph-copies.svg +2 -2
  17. package/dist/collection/components/ezp-icon/assets/glyph-dark.svg +2 -2
  18. package/dist/collection/components/ezp-icon/assets/glyph-drag-drop.svg +3 -0
  19. package/dist/collection/components/ezp-icon/assets/glyph-duplex.svg +2 -2
  20. package/dist/collection/components/ezp-icon/assets/glyph-exclamation-mark.svg +3 -0
  21. package/dist/collection/components/ezp-icon/assets/glyph-expand.svg +2 -2
  22. package/dist/collection/components/ezp-icon/assets/glyph-help.svg +2 -2
  23. package/dist/collection/components/ezp-icon/assets/glyph-light.svg +2 -2
  24. package/dist/collection/components/ezp-icon/assets/glyph-logo.svg +3 -0
  25. package/dist/collection/components/ezp-icon/assets/glyph-logout.svg +2 -2
  26. package/dist/collection/components/ezp-icon/assets/glyph-menu.svg +2 -2
  27. package/dist/collection/components/ezp-icon/assets/glyph-minus.svg +2 -2
  28. package/dist/collection/components/ezp-icon/assets/glyph-orientation.svg +2 -2
  29. package/dist/collection/components/ezp-icon/assets/glyph-plus.svg +2 -2
  30. package/dist/collection/components/ezp-icon/assets/glyph-printer.svg +2 -2
  31. package/dist/collection/components/ezp-icon/assets/glyph-quality.svg +2 -2
  32. package/dist/collection/components/ezp-icon/assets/glyph-question-mark.svg +3 -0
  33. package/dist/collection/components/ezp-icon/assets/glyph-size.svg +2 -2
  34. package/dist/collection/components/ezp-icon/assets/glyph-system.svg +2 -2
  35. package/dist/collection/components/ezp-icon/ezp-icon.css +25 -9
  36. package/dist/collection/components/ezp-icon/ezp-icon.js +23 -3
  37. package/dist/collection/components/ezp-icon-button/ezp-icon-button.css +43 -34
  38. package/dist/collection/components/ezp-icon-button/ezp-icon-button.js +1 -1
  39. package/dist/collection/components/ezp-label/ezp-label.css +32 -32
  40. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.css +21 -27
  41. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +284 -90
  42. package/dist/collection/components/ezp-printing/ezp-printing.css +175 -273
  43. package/dist/collection/components/ezp-printing/ezp-printing.js +111 -13
  44. package/dist/collection/components/ezp-select/ezp-select.css +98 -151
  45. package/dist/collection/components/ezp-select/ezp-select.js +51 -20
  46. package/dist/collection/components/ezp-status/ezp-status.css +111 -0
  47. package/dist/collection/components/ezp-status/ezp-status.js +236 -0
  48. package/dist/collection/components/ezp-stepper/ezp-stepper.css +21 -21
  49. package/dist/collection/components/ezp-stepper/ezp-stepper.js +1 -1
  50. package/dist/collection/components/ezp-text-button/ezp-text-button.css +44 -34
  51. package/dist/collection/components/ezp-text-button/ezp-text-button.js +22 -2
  52. package/dist/collection/components/ezp-upload/ezp-upload.css +67 -0
  53. package/dist/collection/components/ezp-upload/ezp-upload.js +121 -0
  54. package/dist/collection/components/ezp-user-menu/ezp-user-menu.css +75 -71
  55. package/dist/collection/components/ezp-user-menu/ezp-user-menu.js +12 -9
  56. package/dist/collection/services/print.js +50 -10
  57. package/dist/custom-elements/index.d.ts +18 -6
  58. package/dist/custom-elements/index.js +29059 -378
  59. package/dist/directives/proxies.ts +81 -25
  60. package/dist/esm/ezeep.js +2 -2
  61. package/dist/esm/ezp-auth_14.entry.js +33737 -0
  62. package/dist/esm/{index-9ecf6ae0.js → index-265d8cca.js} +7 -1
  63. package/dist/esm/loader.js +2 -2
  64. package/dist/esm-es5/ezeep.js +1 -1
  65. package/dist/esm-es5/ezp-auth_14.entry.js +21 -0
  66. package/dist/esm-es5/{index-9ecf6ae0.js → index-265d8cca.js} +1 -1
  67. package/dist/esm-es5/loader.js +1 -1
  68. package/dist/ezeep/assets/glyph-account.svg +2 -2
  69. package/dist/ezeep/assets/glyph-checkmark-alt.svg +3 -0
  70. package/dist/ezeep/assets/glyph-checkmark.svg +2 -2
  71. package/dist/ezeep/assets/glyph-close.svg +2 -2
  72. package/dist/ezeep/assets/glyph-color.svg +2 -2
  73. package/dist/ezeep/assets/glyph-copies.svg +2 -2
  74. package/dist/ezeep/assets/glyph-dark.svg +2 -2
  75. package/dist/ezeep/assets/glyph-drag-drop.svg +3 -0
  76. package/dist/ezeep/assets/glyph-duplex.svg +2 -2
  77. package/dist/ezeep/assets/glyph-exclamation-mark.svg +3 -0
  78. package/dist/ezeep/assets/glyph-expand.svg +2 -2
  79. package/dist/ezeep/assets/glyph-help.svg +2 -2
  80. package/dist/ezeep/assets/glyph-light.svg +2 -2
  81. package/dist/ezeep/assets/glyph-logo.svg +3 -0
  82. package/dist/ezeep/assets/glyph-logout.svg +2 -2
  83. package/dist/ezeep/assets/glyph-menu.svg +2 -2
  84. package/dist/ezeep/assets/glyph-minus.svg +2 -2
  85. package/dist/ezeep/assets/glyph-orientation.svg +2 -2
  86. package/dist/ezeep/assets/glyph-plus.svg +2 -2
  87. package/dist/ezeep/assets/glyph-printer.svg +2 -2
  88. package/dist/ezeep/assets/glyph-quality.svg +2 -2
  89. package/dist/ezeep/assets/glyph-question-mark.svg +3 -0
  90. package/dist/ezeep/assets/glyph-size.svg +2 -2
  91. package/dist/ezeep/assets/glyph-system.svg +2 -2
  92. package/dist/ezeep/ezeep.esm.js +1 -1
  93. package/dist/ezeep/ezeep.js +1 -1
  94. package/dist/ezeep/p-740e246f.entry.js +15 -0
  95. package/dist/ezeep/p-98ec6965.system.js +1 -0
  96. package/dist/ezeep/p-b481a50b.system.entry.js +21 -0
  97. package/dist/ezeep/p-f3065800.js +1 -0
  98. package/dist/ezeep/p-f89804ee.system.js +1 -0
  99. package/dist/types/components/ezp-auth/ezp-auth.d.ts +3 -2
  100. package/dist/types/components/ezp-dialog/ezp-dialog.d.ts +42 -0
  101. package/dist/types/components/ezp-icon/ezp-icon.d.ts +2 -0
  102. package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +19 -1
  103. package/dist/types/components/ezp-printing/ezp-printing.d.ts +10 -3
  104. package/dist/types/components/ezp-select/ezp-select.d.ts +4 -0
  105. package/dist/types/components/ezp-status/ezp-status.d.ts +44 -0
  106. package/dist/types/components/ezp-text-button/ezp-text-button.d.ts +2 -0
  107. package/dist/types/components/ezp-upload/ezp-upload.d.ts +43 -0
  108. package/dist/types/components.d.ts +126 -21
  109. package/dist/types/services/print.d.ts +7 -2
  110. package/dist/types/shared/types.d.ts +15 -3
  111. package/package.json +12 -2
  112. package/readme.md +54 -18
  113. package/www/build/assets/glyph-account.svg +2 -2
  114. package/www/build/assets/glyph-checkmark-alt.svg +3 -0
  115. package/www/build/assets/glyph-checkmark.svg +2 -2
  116. package/www/build/assets/glyph-close.svg +2 -2
  117. package/www/build/assets/glyph-color.svg +2 -2
  118. package/www/build/assets/glyph-copies.svg +2 -2
  119. package/www/build/assets/glyph-dark.svg +2 -2
  120. package/www/build/assets/glyph-drag-drop.svg +3 -0
  121. package/www/build/assets/glyph-duplex.svg +2 -2
  122. package/www/build/assets/glyph-exclamation-mark.svg +3 -0
  123. package/www/build/assets/glyph-expand.svg +2 -2
  124. package/www/build/assets/glyph-help.svg +2 -2
  125. package/www/build/assets/glyph-light.svg +2 -2
  126. package/www/build/assets/glyph-logo.svg +3 -0
  127. package/www/build/assets/glyph-logout.svg +2 -2
  128. package/www/build/assets/glyph-menu.svg +2 -2
  129. package/www/build/assets/glyph-minus.svg +2 -2
  130. package/www/build/assets/glyph-orientation.svg +2 -2
  131. package/www/build/assets/glyph-plus.svg +2 -2
  132. package/www/build/assets/glyph-printer.svg +2 -2
  133. package/www/build/assets/glyph-quality.svg +2 -2
  134. package/www/build/assets/glyph-question-mark.svg +3 -0
  135. package/www/build/assets/glyph-size.svg +2 -2
  136. package/www/build/assets/glyph-system.svg +2 -2
  137. package/www/build/ezeep.esm.js +1 -1
  138. package/www/build/ezeep.js +1 -1
  139. package/www/build/p-740e246f.entry.js +15 -0
  140. package/www/build/p-98ec6965.system.js +1 -0
  141. package/www/build/p-b481a50b.system.entry.js +21 -0
  142. package/www/build/p-f3065800.js +1 -0
  143. package/www/build/p-f89804ee.system.js +1 -0
  144. package/www/data/file-types.json +68 -0
  145. package/www/data/locales/de.json +61 -30
  146. package/www/data/locales/en.json +61 -30
  147. package/www/index.html +27 -7
  148. package/dist/cjs/ezp-auth_12.cjs.entry.js +0 -5079
  149. package/dist/collection/components/ezp-progress/ezp-progress.css +0 -110
  150. package/dist/collection/components/ezp-progress/ezp-progress.js +0 -53
  151. package/dist/esm/ezp-auth_12.entry.js +0 -5064
  152. package/dist/esm-es5/ezp-auth_12.entry.js +0 -1
  153. package/dist/ezeep/p-0711b970.entry.js +0 -1
  154. package/dist/ezeep/p-c488ee3f.system.js +0 -1
  155. package/dist/ezeep/p-e8c8adc1.system.entry.js +0 -1
  156. package/dist/ezeep/p-eb3b8dbd.system.js +0 -1
  157. package/dist/ezeep/p-ff843eb4.js +0 -1
  158. package/dist/types/components/ezp-progress/ezp-progress.d.ts +0 -15
  159. package/www/build/p-0711b970.entry.js +0 -1
  160. package/www/build/p-c488ee3f.system.js +0 -1
  161. package/www/build/p-e8c8adc1.system.entry.js +0 -1
  162. package/www/build/p-eb3b8dbd.system.js +0 -1
  163. package/www/build/p-ff843eb4.js +0 -1
@@ -1,4 +1,4 @@
1
- import { Component, Host, Listen, Event, State, h, Prop } from '@stencil/core';
1
+ import { Component, Host, Listen, Event, State, h, Prop, Fragment, } from '@stencil/core';
2
2
  import i18next from 'i18next';
3
3
  import authStore from '../../services/auth';
4
4
  import printStore, { EzpPrintService } from '../../services/print';
@@ -7,6 +7,8 @@ import { initi18n, poll, removeEmptyStrings } from '../../utils/utils';
7
7
  import options from '../../data/options.json';
8
8
  export class EzpPrinterSelection {
9
9
  constructor() {
10
+ this.sasUri = '';
11
+ this.fileExtension = '';
10
12
  this.duplexOptions = [
11
13
  {
12
14
  id: 1,
@@ -21,6 +23,7 @@ export class EzpPrinterSelection {
21
23
  title: 'Short edge binding',
22
24
  },
23
25
  ];
26
+ this.hidemenu = false;
24
27
  /**
25
28
  *
26
29
  * States
@@ -28,9 +31,22 @@ export class EzpPrinterSelection {
28
31
  */
29
32
  this.loading = true;
30
33
  this.options = options;
31
- this.printInProgress = false;
34
+ this.printProcessing = false;
35
+ this.uploading = false;
36
+ this.preparingUpload = false;
37
+ this.printSuccess = false;
38
+ this.printFailed = false;
39
+ this.notSupported = false;
40
+ this.noPrinters = false;
32
41
  this.userMenuOpen = false;
33
- this.selectedPrinter = { id: '', location: '', name: '' };
42
+ this.printStopped = false;
43
+ this.selectedPrinterConfig = {
44
+ OrientationsSupported: [],
45
+ PaperFormats: [],
46
+ Resolutions: [],
47
+ DuplexSupported: false,
48
+ Color: false,
49
+ };
34
50
  // needs to be initialised with empty strings
35
51
  this.selectedProperties = {
36
52
  paper: '',
@@ -61,20 +77,21 @@ export class EzpPrinterSelection {
61
77
  this.handleCancel = () => {
62
78
  this.printCancel.emit();
63
79
  };
80
+ this.validateData = (data) => {
81
+ if (data.jobstatus === 0) {
82
+ this.printSuccess = true;
83
+ this.printProcessing = false;
84
+ return true;
85
+ }
86
+ return false;
87
+ };
88
+ this.POLL_INTERVAL = 2000;
64
89
  /** Description... */
65
- this.handlePrint = () => {
66
- const validateData = (data) => {
67
- if (data.jobstatus === 0) {
68
- this.printInProgress = false;
69
- return true;
70
- }
71
- return false;
72
- };
73
- const POLL_INTERVAL = 2000;
74
- this.printInProgress = true;
90
+ this.handlePrint = async () => {
91
+ this.printProcessing = true;
75
92
  // we have to initialse this obj with empty strings to display the select component
76
93
  // but don't want to send any attributes with empty strings to the API
77
- removeEmptyStrings(this.selectedProperties);
94
+ this.selectedProperties = removeEmptyStrings(this.selectedProperties);
78
95
  // put it in store for further use
79
96
  printStore.state.fileUrl = this.fileurl;
80
97
  printStore.state.fileID = this.fileid;
@@ -87,8 +104,8 @@ export class EzpPrinterSelection {
87
104
  .printFileByUrl(authStore.state.accessToken, this.fileurl, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
88
105
  .then((response) => {
89
106
  if (response.status === 412) {
90
- response.json().then(data => this.fileid = data.fileid);
91
- this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename).finally(() => this.printInProgress = false);
107
+ response.json().then((data) => (this.fileid = data.fileid));
108
+ this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename);
92
109
  }
93
110
  else {
94
111
  return response.json();
@@ -99,60 +116,38 @@ export class EzpPrinterSelection {
99
116
  printStore.state.jobID = data.jobid;
100
117
  poll({
101
118
  fn: this.printService.getPrintStatus,
102
- validate: validateData,
103
- interval: POLL_INTERVAL,
119
+ validate: this.validateData,
120
+ interval: this.POLL_INTERVAL,
104
121
  maxAttempts: 10,
105
- })
106
- .then(data)
107
- .catch((err) => {
122
+ }).catch((err) => {
108
123
  console.warn(err);
109
- this.printInProgress = false;
110
124
  });
111
125
  }
112
126
  else {
113
- this.printInProgress = false;
127
+ this.printFailed = true;
114
128
  }
115
129
  })
116
- .catch(error => {
130
+ .catch((error) => {
117
131
  console.log(error);
118
- this.printInProgress = false;
132
+ this.printFailed = true;
119
133
  });
120
134
  }
121
- else if (this.fileid) {
122
- this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
123
- .then((response) => response.json())
124
- .then((data) => {
125
- if (data.jobid) {
126
- printStore.state.jobID = data.jobid;
127
- poll({
128
- fn: this.printService.getPrintStatus,
129
- validate: validateData,
130
- interval: POLL_INTERVAL,
131
- maxAttempts: 10,
132
- })
133
- .then(data)
134
- .catch((err) => {
135
- console.warn(err);
136
- this.printInProgress = false;
137
- });
138
- }
139
- else {
140
- this.printInProgress = false;
141
- }
142
- })
143
- .catch(error => {
144
- console.log(error);
145
- this.printInProgress = false;
146
- });
135
+ if (this.file) {
136
+ await this.handleFiles(this.file);
147
137
  }
148
138
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
149
139
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
150
140
  localStorage.setItem('previouslySelectedProperties', JSON.stringify(this.previouslySelectedProperties));
151
- // this.printSubmit.emit()
141
+ this.printStopped = false;
152
142
  };
153
143
  this.handleUserMenu = () => {
154
144
  this.userMenuOpen = true;
155
145
  };
146
+ this.validateFileType = async (name) => {
147
+ const extension = name.split('.').pop();
148
+ this.fileExtension = extension;
149
+ return printStore.state.supportedFileExtensions.includes(`${extension}`);
150
+ };
156
151
  }
157
152
  /**
158
153
  *
@@ -171,6 +166,39 @@ export class EzpPrinterSelection {
171
166
  listenLogout() {
172
167
  this.printCancel.emit();
173
168
  }
169
+ listenStatusCancel(event) {
170
+ if (event.detail === 'print-processing') {
171
+ this.printStopped = true;
172
+ this.printProcessing = false;
173
+ }
174
+ }
175
+ listenStatusClose(event) {
176
+ switch (event.detail) {
177
+ case 'print-success':
178
+ this.printSuccess = false;
179
+ this.printCancel.emit();
180
+ break;
181
+ case 'print-failed':
182
+ this.printProcessing = false;
183
+ this.printFailed = false;
184
+ break;
185
+ case 'no-printers':
186
+ this.noPrinters = false;
187
+ break;
188
+ }
189
+ }
190
+ listenStatusRetry(event) {
191
+ switch (event.detail) {
192
+ case 'not-supported':
193
+ this.printCancel.emit();
194
+ break;
195
+ case 'print-failed':
196
+ this.printFailed = false;
197
+ this.printProcessing = false;
198
+ this.handlePrint();
199
+ break;
200
+ }
201
+ }
174
202
  getPropertiesFromLocalStorage() {
175
203
  if (localStorage.getItem('properties')) {
176
204
  this.selectedProperties = JSON.parse(localStorage.getItem('properties'));
@@ -197,9 +225,9 @@ export class EzpPrinterSelection {
197
225
  case 'printer':
198
226
  this.selectedPrinter.id = eventDetails.id;
199
227
  this.selectedPrinter.name = eventDetails.title;
200
- await this.printService.getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id).then(data => this.selectedPrinterConfig = data[0]);
201
- console.log('selected printer config:');
202
- console.log(this.selectedPrinterConfig);
228
+ await this.printService
229
+ .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
230
+ .then((data) => (this.selectedPrinterConfig = data[0]));
203
231
  break;
204
232
  case 'color':
205
233
  this.selectedProperties.color = !!eventDetails.id;
@@ -233,6 +261,52 @@ export class EzpPrinterSelection {
233
261
  break;
234
262
  }
235
263
  }
264
+ async handleFiles(file) {
265
+ this.preparingUpload = true;
266
+ const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
267
+ this.preparingUpload = false;
268
+ this.fileid = response.fileid;
269
+ this.sasUri = response.sasUri;
270
+ this.filetype = this.fileExtension;
271
+ let res;
272
+ this.uploading = true;
273
+ try {
274
+ res = await this.printService.uploadBlobFiles(this.sasUri, file);
275
+ }
276
+ catch (error) {
277
+ this.printProcessing = false;
278
+ this.printFailed = true;
279
+ }
280
+ this.uploading = false;
281
+ if (res._response.status === 201) {
282
+ this.printService
283
+ .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
284
+ .then((data) => {
285
+ if (data.jobid) {
286
+ printStore.state.jobID = data.jobid;
287
+ poll({
288
+ fn: this.printService.getPrintStatus,
289
+ validate: this.validateData,
290
+ interval: this.POLL_INTERVAL,
291
+ maxAttempts: 10,
292
+ }).catch((err) => {
293
+ console.log(err);
294
+ this.printFailed = true;
295
+ });
296
+ }
297
+ else {
298
+ this.printFailed = true;
299
+ }
300
+ })
301
+ .catch((error) => {
302
+ console.log(error);
303
+ this.printFailed = true;
304
+ });
305
+ }
306
+ else {
307
+ this.printFailed = true;
308
+ }
309
+ }
236
310
  /**
237
311
  *
238
312
  * Lifecycle methods
@@ -240,22 +314,36 @@ export class EzpPrinterSelection {
240
314
  */
241
315
  /** Description... */
242
316
  async componentWillLoad() {
317
+ console.log(navigator.language);
318
+ console.log(this.hidemenu);
243
319
  initi18n();
244
320
  this.loading = true;
245
321
  this.getPropertiesFromLocalStorage();
246
322
  this.getUserInfo();
247
323
  this.printService = new EzpPrintService(this.redirectURI, this.clientID);
324
+ await (await this.printService.getConfig(authStore.state.accessToken))
325
+ .json()
326
+ .then((response) => {
327
+ printStore.state.supportedFileExtensions = response.System.FILEEXT;
328
+ });
248
329
  await this.printService
249
330
  .getPrinterList(authStore.state.accessToken)
250
331
  .then((printers) => {
251
332
  this.printers = printers;
333
+ if (!(this.printers.length > 0)) {
334
+ this.noPrinters = true;
335
+ }
252
336
  });
253
337
  await this.printService
254
338
  .getAllPrinterProperties(authStore.state.accessToken)
255
339
  .then((printerConfig) => {
256
340
  this.printerConfig = printerConfig;
257
- console.log(this.printerConfig);
258
341
  });
342
+ if (this.file) {
343
+ await this.validateFileType(this.filename).then((valid) => {
344
+ this.notSupported = !valid ? true : false;
345
+ });
346
+ }
259
347
  this.loading = false;
260
348
  }
261
349
  /**
@@ -264,23 +352,29 @@ export class EzpPrinterSelection {
264
352
  *
265
353
  */
266
354
  render() {
267
- return this.loading ? (h("ezp-progress", { status: i18next.t('printer_selection.loading') })) : (h(Host, { exportparts: "test: hello" },
268
- this.printInProgress ? (h("ezp-progress", { status: i18next.t('printer_selection.print_in_progress') })) : null,
269
- h("div", { id: "container", "data-backdrop-surface": true },
355
+ return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, null,
356
+ h("div", { id: "box", "data-backdrop-surface": true },
357
+ !this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.preparingUpload
358
+ ? i18next.t('printer_selection.prepare_upload')
359
+ : this.uploading
360
+ ? i18next.t('printer_selection.uploading')
361
+ : i18next.t('printer_selection.print_processing'), instance: "print-processing", cancel: 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)),
270
362
  h("div", { id: "header" },
271
- h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + ':' }),
272
- h("ezp-label", { text: this.filename }),
273
- h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })),
274
- h("div", { id: "content" },
363
+ h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }),
364
+ h("ezp-label", { text: !this.notSupported ? this.filename : '' }),
365
+ !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu }))),
366
+ h("div", { id: "body" },
275
367
  h("div", { id: "printer" },
276
- h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: i18next.t('printer_selection.select_printer'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
368
+ h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
369
+ ? i18next.t('printer_selection.select_printer')
370
+ : i18next.t('printer_selection.no_printers'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
277
371
  id: printer.id,
278
372
  title: printer.name,
279
373
  meta: printer.location !== ''
280
374
  ? printer.location
281
375
  : i18next.t('printer_selection.unknown_location'),
282
376
  type: 'printer',
283
- })), preSelected: this.selectedPrinter.name })),
377
+ })), preSelected: this.selectedPrinter ? this.selectedPrinter.name : null, disabled: !(this.printers.length > 0) })),
284
378
  h("div", { id: "options" },
285
379
  h("ezp-select", { label: i18next.t('printer_selection.color'), icon: "color", placeholder: i18next.t('printer_selection.select_color'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.Color
286
380
  ? [
@@ -304,40 +398,78 @@ export class EzpPrinterSelection {
304
398
  meta: '',
305
399
  type: 'color',
306
400
  },
307
- ], preSelected: this.previouslySelectedProperties.color }),
308
- 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) => ({
309
- id: index,
310
- title: i18next.t(`printer_selection.orientation_${orientation}`),
401
+ ],
402
+ // preSelected={
403
+ // this.previouslySelectedProperties.color
404
+ // ? this.previouslySelectedProperties.color
405
+ // : this.selectedPrinterConfig.Color
406
+ // ? i18next.t('printer_selection.color_grayscale')
407
+ // : null
408
+ // }
409
+ disabled: !this.selectedPrinterConfig.Color }),
410
+ h("ezp-select", { label: i18next.t('printer_selection.duplex'), icon: "duplex", placeholder: i18next.t('printer_selection.select_duplex'), toggleFlow: "horizontal", options: this.duplexOptions.map((option) => ({
411
+ id: option.id,
412
+ title: option.title,
311
413
  meta: '',
312
- type: 'orientation',
313
- })), preSelected: this.previouslySelectedProperties.orientation }),
414
+ type: 'duplex',
415
+ })),
416
+ // preSelected={
417
+ // this.previouslySelectedProperties.duplex
418
+ // ? this.previouslySelectedProperties.duplex
419
+ // : this.selectedPrinterConfig.DuplexSupported
420
+ // ? 'None'
421
+ // : null
422
+ // }
423
+ disabled: !this.selectedPrinterConfig.DuplexSupported }),
314
424
  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.map((format) => ({
315
425
  id: format.Id,
316
426
  title: format.Name,
317
427
  meta: `${format.XRes} x ${format.YRes}`,
318
428
  type: 'format',
319
- })), preSelected: this.previouslySelectedProperties.paper }),
320
- h("ezp-select", { label: i18next.t('printer_selection.quality'), icon: "quality", toggleFlow: "horizontal", options: this.selectedPrinterConfig.Resolutions.map((option, index) => ({
429
+ })),
430
+ // preSelected={
431
+ // this.previouslySelectedProperties.paper
432
+ // ? this.previouslySelectedProperties.paper
433
+ // : this.selectedPrinterConfig.PaperFormats.length > 0
434
+ // ? this.selectedPrinterConfig.PaperFormats[0].Name
435
+ // : null
436
+ // }
437
+ disabled: !(this.selectedPrinterConfig.PaperFormats.length > 0) }),
438
+ 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) => ({
439
+ id: index,
440
+ title: i18next.t(`printer_selection.orientation_${orientation}`),
441
+ meta: '',
442
+ type: 'orientation',
443
+ })),
444
+ // preSelected={
445
+ // this.previouslySelectedProperties.orientation
446
+ // ? this.previouslySelectedProperties.orientation
447
+ // : this.selectedPrinterConfig.OrientationsSupported.length > 0
448
+ // ? i18next.t(
449
+ // `printer_selection.orientation_${this.selectedPrinterConfig.OrientationsSupported[0]}`
450
+ // )
451
+ // : null
452
+ // }
453
+ disabled: !(this.selectedPrinterConfig.OrientationsSupported.length > 0) }),
454
+ h("ezp-select", { label: i18next.t('printer_selection.quality'), icon: "quality", placeholder: i18next.t('printer_selection.select_quality'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.Resolutions.map((option, index) => ({
321
455
  id: index,
322
456
  title: option,
323
457
  meta: '',
324
458
  type: 'quality',
325
- })), preSelected: !this.previouslySelectedProperties.resolution
326
- ? this.selectedPrinterConfig.Resolutions[0]
327
- : this.previouslySelectedProperties.resolution }),
328
- this.selectedPrinterConfig.DuplexSupported ? (h("ezp-select", { label: i18next.t('printer_selection.duplex'), icon: "duplex", toggleFlow: "horizontal", options: this.duplexOptions.map((option) => ({
329
- id: option.id,
330
- title: option.title,
331
- meta: '',
332
- type: 'duplex',
333
- })), preSelected: !this.previouslySelectedProperties.duplex
334
- ? 'None'
335
- : this.previouslySelectedProperties.duplexmode })) : null),
459
+ })),
460
+ // preSelected={
461
+ // this.previouslySelectedProperties.resolution
462
+ // ? this.previouslySelectedProperties.resolution
463
+ // : this.selectedPrinterConfig.Resolutions.length > 0
464
+ // ? this.selectedPrinterConfig.Resolutions[0]
465
+ // : null
466
+ // }
467
+ disabled: !(this.selectedPrinterConfig.Resolutions.length > 0) })),
336
468
  h("ezp-stepper", { label: "Copies", max: 10, icon: "copies" })),
337
469
  h("div", { id: "footer" },
338
470
  h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel') }),
339
- h("ezp-text-button", { type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })),
340
- h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
471
+ h("ezp-text-button", { disabled: this.selectedPrinter.id === '', type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })),
472
+ !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
341
473
  }
342
474
  static get is() { return "ezp-printer-selection"; }
343
475
  static get encapsulation() { return "shadow"; }
@@ -384,7 +516,7 @@ export class EzpPrinterSelection {
384
516
  },
385
517
  "filename": {
386
518
  "type": "string",
387
- "mutable": false,
519
+ "mutable": true,
388
520
  "complexType": {
389
521
  "original": "string",
390
522
  "resolved": "string",
@@ -418,7 +550,7 @@ export class EzpPrinterSelection {
418
550
  },
419
551
  "filetype": {
420
552
  "type": "string",
421
- "mutable": false,
553
+ "mutable": true,
422
554
  "complexType": {
423
555
  "original": "string",
424
556
  "resolved": "string",
@@ -435,7 +567,7 @@ export class EzpPrinterSelection {
435
567
  },
436
568
  "fileid": {
437
569
  "type": "string",
438
- "mutable": false,
570
+ "mutable": true,
439
571
  "complexType": {
440
572
  "original": "string",
441
573
  "resolved": "string",
@@ -449,13 +581,57 @@ export class EzpPrinterSelection {
449
581
  },
450
582
  "attribute": "fileid",
451
583
  "reflect": false
584
+ },
585
+ "file": {
586
+ "type": "unknown",
587
+ "mutable": false,
588
+ "complexType": {
589
+ "original": "File",
590
+ "resolved": "File",
591
+ "references": {
592
+ "File": {
593
+ "location": "global"
594
+ }
595
+ }
596
+ },
597
+ "required": false,
598
+ "optional": false,
599
+ "docs": {
600
+ "tags": [],
601
+ "text": ""
602
+ }
603
+ },
604
+ "hidemenu": {
605
+ "type": "boolean",
606
+ "mutable": false,
607
+ "complexType": {
608
+ "original": "boolean",
609
+ "resolved": "boolean",
610
+ "references": {}
611
+ },
612
+ "required": false,
613
+ "optional": false,
614
+ "docs": {
615
+ "tags": [],
616
+ "text": ""
617
+ },
618
+ "attribute": "hidemenu",
619
+ "reflect": false,
620
+ "defaultValue": "false"
452
621
  }
453
622
  }; }
454
623
  static get states() { return {
455
624
  "loading": {},
456
625
  "options": {},
457
- "printInProgress": {},
626
+ "printProcessing": {},
627
+ "uploading": {},
628
+ "preparingUpload": {},
629
+ "printSuccess": {},
630
+ "printFailed": {},
631
+ "notSupported": {},
632
+ "noPrinters": {},
458
633
  "userMenuOpen": {},
634
+ "printStopped": {},
459
635
  "userName": {},
460
636
  "printers": {},
461
637
  "selectedPrinter": {},
@@ -527,5 +703,23 @@ export class EzpPrinterSelection {
527
703
  "target": undefined,
528
704
  "capture": false,
529
705
  "passive": false
706
+ }, {
707
+ "name": "statusCancel",
708
+ "method": "listenStatusCancel",
709
+ "target": undefined,
710
+ "capture": false,
711
+ "passive": false
712
+ }, {
713
+ "name": "statusClose",
714
+ "method": "listenStatusClose",
715
+ "target": undefined,
716
+ "capture": false,
717
+ "passive": false
718
+ }, {
719
+ "name": "statusRetry",
720
+ "method": "listenStatusRetry",
721
+ "target": undefined,
722
+ "capture": false,
723
+ "passive": false
530
724
  }]; }
531
725
  }