@ezeep/ezeep-js 1.0.139 → 1.0.143

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 +33750 -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 +336 -75
  42. package/dist/collection/components/ezp-printing/ezp-printing.css +175 -273
  43. package/dist/collection/components/ezp-printing/ezp-printing.js +126 -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 +65 -9
  57. package/dist/custom-elements/index.d.ts +18 -6
  58. package/dist/custom-elements/index.js +29107 -361
  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 +33733 -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-6d99f6f4.system.entry.js +21 -0
  95. package/dist/ezeep/p-972c2256.entry.js +15 -0
  96. package/dist/ezeep/p-98ec6965.system.js +1 -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 +22 -2
  103. package/dist/types/components/ezp-printing/ezp-printing.d.ts +11 -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 +130 -21
  109. package/dist/types/services/print.d.ts +14 -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-6d99f6f4.system.entry.js +21 -0
  140. package/www/build/p-972c2256.entry.js +15 -0
  141. package/www/build/p-98ec6965.system.js +1 -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 -5010
  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 -4995
  152. package/dist/esm-es5/ezp-auth_12.entry.js +0 -1
  153. package/dist/ezeep/p-1922e5fe.system.entry.js +0 -1
  154. package/dist/ezeep/p-649f6d96.entry.js +0 -1
  155. package/dist/ezeep/p-c488ee3f.system.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-1922e5fe.system.entry.js +0 -1
  160. package/www/build/p-649f6d96.entry.js +0 -1
  161. package/www/build/p-c488ee3f.system.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,
@@ -28,14 +30,27 @@ export class EzpPrinterSelection {
28
30
  */
29
31
  this.loading = true;
30
32
  this.options = options;
31
- this.printInProgress = false;
33
+ this.printProcessing = false;
34
+ this.uploading = false;
35
+ this.preparingUpload = false;
36
+ this.printSuccess = false;
37
+ this.printFailed = false;
38
+ this.notSupported = false;
39
+ this.noPrinters = false;
32
40
  this.userMenuOpen = false;
33
- this.selectedPrinter = { id: '', location: '', name: '' };
41
+ this.printStopped = false;
42
+ this.selectedPrinterConfig = {
43
+ OrientationsSupported: [],
44
+ PaperFormats: [],
45
+ Resolutions: [],
46
+ DuplexSupported: false,
47
+ Color: false,
48
+ };
34
49
  // needs to be initialised with empty strings
35
50
  this.selectedProperties = {
36
51
  paper: '',
37
52
  paperid: '',
38
- color: '',
53
+ color: false,
39
54
  duplex: false,
40
55
  duplexmode: '',
41
56
  orientation: '',
@@ -45,7 +60,7 @@ export class EzpPrinterSelection {
45
60
  this.previouslySelectedProperties = {
46
61
  paper: '',
47
62
  paperid: '',
48
- color: '',
63
+ color: false,
49
64
  duplex: false,
50
65
  duplexmode: '',
51
66
  orientation: '',
@@ -61,49 +76,77 @@ export class EzpPrinterSelection {
61
76
  this.handleCancel = () => {
62
77
  this.printCancel.emit();
63
78
  };
79
+ this.validateData = (data) => {
80
+ if (data.jobstatus === 0) {
81
+ this.printSuccess = true;
82
+ this.printProcessing = false;
83
+ return true;
84
+ }
85
+ return false;
86
+ };
87
+ this.POLL_INTERVAL = 2000;
64
88
  /** Description... */
65
- this.handlePrint = () => {
66
- this.printInProgress = true;
67
- this.printService
68
- .printFileByUrl(authStore.state.accessToken, this.fileurl, this.filetype, this.selectedPrinter.id,
89
+ this.handlePrint = async () => {
90
+ this.printProcessing = true;
69
91
  // we have to initialse this obj with empty strings to display the select component
70
92
  // but don't want to send any attributes with empty strings to the API
71
- removeEmptyStrings(this.selectedProperties), this.filename)
72
- .then((data) => {
73
- if (data.jobid) {
74
- printStore.state.jobID = data.jobid;
75
- const POLL_INTERVAL = 2000;
76
- const validateData = (data) => {
77
- if (data.jobstatus === 0) {
78
- this.printInProgress = false;
79
- return true;
80
- }
81
- return false;
82
- };
83
- poll({
84
- fn: this.printService.getPrintStatus,
85
- validate: validateData,
86
- interval: POLL_INTERVAL,
87
- maxAttempts: 10,
88
- })
89
- .then(data)
90
- .catch((err) => {
91
- console.warn(err);
92
- this.printInProgress = false;
93
- });
94
- }
95
- else {
96
- this.printInProgress = false;
97
- }
98
- });
93
+ this.selectedProperties = removeEmptyStrings(this.selectedProperties);
94
+ // put it in store for further use
95
+ printStore.state.fileUrl = this.fileurl;
96
+ printStore.state.fileID = this.fileid;
97
+ printStore.state.fileType = this.filetype;
98
+ printStore.state.printerID = this.selectedPrinter.id;
99
+ printStore.state.printerProperties = this.selectedProperties;
100
+ printStore.state.fileName = this.filename;
101
+ if (this.fileurl) {
102
+ this.printService
103
+ .printFileByUrl(authStore.state.accessToken, this.fileurl, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
104
+ .then((response) => {
105
+ if (response.status === 412) {
106
+ response.json().then((data) => (this.fileid = data.fileid));
107
+ this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename);
108
+ }
109
+ else {
110
+ return response.json();
111
+ }
112
+ })
113
+ .then((data) => {
114
+ if (data.jobid) {
115
+ printStore.state.jobID = data.jobid;
116
+ poll({
117
+ fn: this.printService.getPrintStatus,
118
+ validate: this.validateData,
119
+ interval: this.POLL_INTERVAL,
120
+ maxAttempts: 10,
121
+ }).catch((err) => {
122
+ console.warn(err);
123
+ });
124
+ }
125
+ else {
126
+ this.printFailed = true;
127
+ }
128
+ })
129
+ .catch((error) => {
130
+ console.log(error);
131
+ this.printFailed = true;
132
+ });
133
+ }
134
+ if (this.file) {
135
+ await this.handleFiles(this.file);
136
+ }
99
137
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
100
138
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
101
139
  localStorage.setItem('previouslySelectedProperties', JSON.stringify(this.previouslySelectedProperties));
102
- // this.printSubmit.emit()
140
+ this.printStopped = false;
103
141
  };
104
142
  this.handleUserMenu = () => {
105
143
  this.userMenuOpen = true;
106
144
  };
145
+ this.validateFileType = async (name) => {
146
+ const extension = name.split('.').pop();
147
+ this.fileExtension = extension;
148
+ return printStore.state.supportedFileExtensions.includes(`${extension}`);
149
+ };
107
150
  }
108
151
  /**
109
152
  *
@@ -122,6 +165,39 @@ export class EzpPrinterSelection {
122
165
  listenLogout() {
123
166
  this.printCancel.emit();
124
167
  }
168
+ listenStatusCancel(event) {
169
+ if (event.detail === 'print-processing') {
170
+ this.printStopped = true;
171
+ this.printProcessing = false;
172
+ }
173
+ }
174
+ listenStatusClose(event) {
175
+ switch (event.detail) {
176
+ case 'print-success':
177
+ this.printSuccess = false;
178
+ this.printCancel.emit();
179
+ break;
180
+ case 'print-failed':
181
+ this.printProcessing = false;
182
+ this.printFailed = false;
183
+ break;
184
+ case 'no-printers':
185
+ this.noPrinters = false;
186
+ break;
187
+ }
188
+ }
189
+ listenStatusRetry(event) {
190
+ switch (event.detail) {
191
+ case 'not-supported':
192
+ this.printCancel.emit();
193
+ break;
194
+ case 'print-failed':
195
+ this.printFailed = false;
196
+ this.printProcessing = false;
197
+ this.handlePrint();
198
+ break;
199
+ }
200
+ }
125
201
  getPropertiesFromLocalStorage() {
126
202
  if (localStorage.getItem('properties')) {
127
203
  this.selectedProperties = JSON.parse(localStorage.getItem('properties'));
@@ -143,11 +219,14 @@ export class EzpPrinterSelection {
143
219
  this.userName = userStore.state.user.display_name;
144
220
  });
145
221
  }
146
- setSelectedProperties(eventDetails) {
222
+ async setSelectedProperties(eventDetails) {
147
223
  switch (eventDetails.type) {
148
224
  case 'printer':
149
225
  this.selectedPrinter.id = eventDetails.id;
150
226
  this.selectedPrinter.name = eventDetails.title;
227
+ await this.printService
228
+ .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
229
+ .then((data) => (this.selectedPrinterConfig = data[0]));
151
230
  break;
152
231
  case 'color':
153
232
  this.selectedProperties.color = !!eventDetails.id;
@@ -181,6 +260,52 @@ export class EzpPrinterSelection {
181
260
  break;
182
261
  }
183
262
  }
263
+ async handleFiles(file) {
264
+ this.preparingUpload = true;
265
+ const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
266
+ this.preparingUpload = false;
267
+ this.fileid = response.fileid;
268
+ this.sasUri = response.sasUri;
269
+ this.filetype = this.fileExtension;
270
+ let res;
271
+ this.uploading = true;
272
+ try {
273
+ res = await this.printService.uploadBlobFiles(this.sasUri, file);
274
+ }
275
+ catch (error) {
276
+ this.printProcessing = false;
277
+ this.printFailed = true;
278
+ }
279
+ this.uploading = false;
280
+ if (res._response.status === 201) {
281
+ this.printService
282
+ .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
283
+ .then((data) => {
284
+ if (data.jobid) {
285
+ printStore.state.jobID = data.jobid;
286
+ poll({
287
+ fn: this.printService.getPrintStatus,
288
+ validate: this.validateData,
289
+ interval: this.POLL_INTERVAL,
290
+ maxAttempts: 10,
291
+ }).catch((err) => {
292
+ console.log(err);
293
+ this.printFailed = true;
294
+ });
295
+ }
296
+ else {
297
+ this.printFailed = true;
298
+ }
299
+ })
300
+ .catch((error) => {
301
+ console.log(error);
302
+ this.printFailed = true;
303
+ });
304
+ }
305
+ else {
306
+ this.printFailed = true;
307
+ }
308
+ }
184
309
  /**
185
310
  *
186
311
  * Lifecycle methods
@@ -193,16 +318,29 @@ export class EzpPrinterSelection {
193
318
  this.getPropertiesFromLocalStorage();
194
319
  this.getUserInfo();
195
320
  this.printService = new EzpPrintService(this.redirectURI, this.clientID);
321
+ await (await this.printService.getConfig(authStore.state.accessToken))
322
+ .json()
323
+ .then((response) => {
324
+ printStore.state.supportedFileExtensions = response.System.FILEEXT;
325
+ });
196
326
  await this.printService
197
327
  .getPrinterList(authStore.state.accessToken)
198
328
  .then((printers) => {
199
329
  this.printers = printers;
330
+ if (!(this.printers.length > 0)) {
331
+ this.noPrinters = true;
332
+ }
200
333
  });
201
334
  await this.printService
202
335
  .getAllPrinterProperties(authStore.state.accessToken)
203
336
  .then((printerConfig) => {
204
- this.printerConfig = printerConfig[0];
337
+ this.printerConfig = printerConfig;
205
338
  });
339
+ if (this.file) {
340
+ await this.validateFileType(this.filename).then((valid) => {
341
+ this.notSupported = !valid ? true : false;
342
+ });
343
+ }
206
344
  this.loading = false;
207
345
  }
208
346
  /**
@@ -211,25 +349,31 @@ export class EzpPrinterSelection {
211
349
  *
212
350
  */
213
351
  render() {
214
- return this.loading ? (h("ezp-progress", { status: i18next.t('printer_selection.loading') })) : (h(Host, { exportparts: "test: hello" },
215
- this.printInProgress ? (h("ezp-progress", { status: i18next.t('printer_selection.print_in_progress') })) : null,
216
- h("div", { id: "container", "data-backdrop-surface": true },
352
+ return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, null,
353
+ h("div", { id: "box", "data-backdrop-surface": true },
354
+ !this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.preparingUpload
355
+ ? i18next.t('printer_selection.prepare_upload')
356
+ : this.uploading
357
+ ? i18next.t('printer_selection.uploading')
358
+ : 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)),
217
359
  h("div", { id: "header" },
218
- h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + ':' }),
219
- h("ezp-label", { text: this.filename }),
220
- h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })),
221
- h("div", { id: "content" },
360
+ h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }),
361
+ h("ezp-label", { text: !this.notSupported ? this.filename : '' }),
362
+ this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu }))),
363
+ h("div", { id: "body" },
222
364
  h("div", { id: "printer" },
223
- 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) => ({
365
+ h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
366
+ ? i18next.t('printer_selection.select_printer')
367
+ : i18next.t('printer_selection.no_printers'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
224
368
  id: printer.id,
225
369
  title: printer.name,
226
370
  meta: printer.location !== ''
227
371
  ? printer.location
228
372
  : i18next.t('printer_selection.unknown_location'),
229
373
  type: 'printer',
230
- })), preSelected: this.selectedPrinter.name })),
374
+ })), preSelected: this.selectedPrinter ? this.selectedPrinter.name : null, disabled: !(this.printers.length > 0) })),
231
375
  h("div", { id: "options" },
232
- h("ezp-select", { label: i18next.t('printer_selection.color'), icon: "color", placeholder: i18next.t('printer_selection.select_color'), toggleFlow: "horizontal", options: this.printerConfig.Color
376
+ h("ezp-select", { label: i18next.t('printer_selection.color'), icon: "color", placeholder: i18next.t('printer_selection.select_color'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.Color
233
377
  ? [
234
378
  {
235
379
  id: 1,
@@ -251,40 +395,78 @@ export class EzpPrinterSelection {
251
395
  meta: '',
252
396
  type: 'color',
253
397
  },
254
- ], preSelected: this.previouslySelectedProperties.color }),
255
- h("ezp-select", { label: i18next.t('printer_selection.orientation'), icon: "orientation", placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: this.printerConfig.OrientationsSupported.map((orientation, index) => ({
256
- id: index,
257
- title: i18next.t(`printer_selection.orientation_${orientation}`),
398
+ ],
399
+ // preSelected={
400
+ // this.previouslySelectedProperties.color
401
+ // ? this.previouslySelectedProperties.color
402
+ // : this.selectedPrinterConfig.Color
403
+ // ? i18next.t('printer_selection.color_grayscale')
404
+ // : null
405
+ // }
406
+ disabled: !this.selectedPrinterConfig.Color }),
407
+ 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) => ({
408
+ id: option.id,
409
+ title: option.title,
258
410
  meta: '',
259
- type: 'orientation',
260
- })), preSelected: this.previouslySelectedProperties.orientation }),
261
- h("ezp-select", { label: i18next.t('printer_selection.size'), icon: "size", placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.printerConfig.PaperFormats.map((format) => ({
411
+ type: 'duplex',
412
+ })),
413
+ // preSelected={
414
+ // this.previouslySelectedProperties.duplex
415
+ // ? this.previouslySelectedProperties.duplex
416
+ // : this.selectedPrinterConfig.DuplexSupported
417
+ // ? 'None'
418
+ // : null
419
+ // }
420
+ disabled: !this.selectedPrinterConfig.DuplexSupported }),
421
+ 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) => ({
262
422
  id: format.Id,
263
423
  title: format.Name,
264
424
  meta: `${format.XRes} x ${format.YRes}`,
265
425
  type: 'format',
266
- })), preSelected: this.previouslySelectedProperties.paper }),
267
- h("ezp-select", { label: i18next.t('printer_selection.quality'), icon: "quality", toggleFlow: "horizontal", options: this.printerConfig.Resolutions.map((option, index) => ({
426
+ })),
427
+ // preSelected={
428
+ // this.previouslySelectedProperties.paper
429
+ // ? this.previouslySelectedProperties.paper
430
+ // : this.selectedPrinterConfig.PaperFormats.length > 0
431
+ // ? this.selectedPrinterConfig.PaperFormats[0].Name
432
+ // : null
433
+ // }
434
+ disabled: !(this.selectedPrinterConfig.PaperFormats.length > 0) }),
435
+ 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) => ({
436
+ id: index,
437
+ title: i18next.t(`printer_selection.orientation_${orientation}`),
438
+ meta: '',
439
+ type: 'orientation',
440
+ })),
441
+ // preSelected={
442
+ // this.previouslySelectedProperties.orientation
443
+ // ? this.previouslySelectedProperties.orientation
444
+ // : this.selectedPrinterConfig.OrientationsSupported.length > 0
445
+ // ? i18next.t(
446
+ // `printer_selection.orientation_${this.selectedPrinterConfig.OrientationsSupported[0]}`
447
+ // )
448
+ // : null
449
+ // }
450
+ disabled: !(this.selectedPrinterConfig.OrientationsSupported.length > 0) }),
451
+ 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) => ({
268
452
  id: index,
269
453
  title: option,
270
454
  meta: '',
271
455
  type: 'quality',
272
- })), preSelected: !this.previouslySelectedProperties.resolution
273
- ? this.printerConfig.Resolutions[0]
274
- : this.previouslySelectedProperties.resolution }),
275
- this.printerConfig.DuplexSupported ? (h("ezp-select", { label: i18next.t('printer_selection.duplex'), icon: "duplex", toggleFlow: "horizontal", options: this.duplexOptions.map((option) => ({
276
- id: option.id,
277
- title: option.title,
278
- meta: '',
279
- type: 'duplex',
280
- })), preSelected: !this.previouslySelectedProperties.duplex
281
- ? 'None'
282
- : this.previouslySelectedProperties.duplexmode })) : null),
456
+ })),
457
+ // preSelected={
458
+ // this.previouslySelectedProperties.resolution
459
+ // ? this.previouslySelectedProperties.resolution
460
+ // : this.selectedPrinterConfig.Resolutions.length > 0
461
+ // ? this.selectedPrinterConfig.Resolutions[0]
462
+ // : null
463
+ // }
464
+ disabled: !(this.selectedPrinterConfig.Resolutions.length > 0) })),
283
465
  h("ezp-stepper", { label: "Copies", max: 10, icon: "copies" })),
284
466
  h("div", { id: "footer" },
285
467
  h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel') }),
286
- h("ezp-text-button", { type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })),
287
- h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
468
+ h("ezp-text-button", { disabled: this.selectedPrinter.id === '', type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })),
469
+ this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
288
470
  }
289
471
  static get is() { return "ezp-printer-selection"; }
290
472
  static get encapsulation() { return "shadow"; }
@@ -331,7 +513,7 @@ export class EzpPrinterSelection {
331
513
  },
332
514
  "filename": {
333
515
  "type": "string",
334
- "mutable": false,
516
+ "mutable": true,
335
517
  "complexType": {
336
518
  "original": "string",
337
519
  "resolved": "string",
@@ -365,7 +547,7 @@ export class EzpPrinterSelection {
365
547
  },
366
548
  "filetype": {
367
549
  "type": "string",
368
- "mutable": false,
550
+ "mutable": true,
369
551
  "complexType": {
370
552
  "original": "string",
371
553
  "resolved": "string",
@@ -379,17 +561,78 @@ export class EzpPrinterSelection {
379
561
  },
380
562
  "attribute": "filetype",
381
563
  "reflect": false
564
+ },
565
+ "fileid": {
566
+ "type": "string",
567
+ "mutable": true,
568
+ "complexType": {
569
+ "original": "string",
570
+ "resolved": "string",
571
+ "references": {}
572
+ },
573
+ "required": false,
574
+ "optional": false,
575
+ "docs": {
576
+ "tags": [],
577
+ "text": ""
578
+ },
579
+ "attribute": "fileid",
580
+ "reflect": false
581
+ },
582
+ "file": {
583
+ "type": "unknown",
584
+ "mutable": false,
585
+ "complexType": {
586
+ "original": "File",
587
+ "resolved": "File",
588
+ "references": {
589
+ "File": {
590
+ "location": "global"
591
+ }
592
+ }
593
+ },
594
+ "required": false,
595
+ "optional": false,
596
+ "docs": {
597
+ "tags": [],
598
+ "text": ""
599
+ }
600
+ },
601
+ "hidemenu": {
602
+ "type": "boolean",
603
+ "mutable": false,
604
+ "complexType": {
605
+ "original": "boolean",
606
+ "resolved": "boolean",
607
+ "references": {}
608
+ },
609
+ "required": false,
610
+ "optional": false,
611
+ "docs": {
612
+ "tags": [],
613
+ "text": ""
614
+ },
615
+ "attribute": "hidemenu",
616
+ "reflect": false
382
617
  }
383
618
  }; }
384
619
  static get states() { return {
385
620
  "loading": {},
386
621
  "options": {},
387
- "printInProgress": {},
622
+ "printProcessing": {},
623
+ "uploading": {},
624
+ "preparingUpload": {},
625
+ "printSuccess": {},
626
+ "printFailed": {},
627
+ "notSupported": {},
628
+ "noPrinters": {},
388
629
  "userMenuOpen": {},
630
+ "printStopped": {},
389
631
  "userName": {},
390
632
  "printers": {},
391
633
  "selectedPrinter": {},
392
634
  "printerConfig": {},
635
+ "selectedPrinterConfig": {},
393
636
  "selectedProperties": {},
394
637
  "previouslySelectedProperties": {}
395
638
  }; }
@@ -456,5 +699,23 @@ export class EzpPrinterSelection {
456
699
  "target": undefined,
457
700
  "capture": false,
458
701
  "passive": false
702
+ }, {
703
+ "name": "statusCancel",
704
+ "method": "listenStatusCancel",
705
+ "target": undefined,
706
+ "capture": false,
707
+ "passive": false
708
+ }, {
709
+ "name": "statusClose",
710
+ "method": "listenStatusClose",
711
+ "target": undefined,
712
+ "capture": false,
713
+ "passive": false
714
+ }, {
715
+ "name": "statusRetry",
716
+ "method": "listenStatusRetry",
717
+ "target": undefined,
718
+ "capture": false,
719
+ "passive": false
459
720
  }]; }
460
721
  }