@ezeep/ezeep-js 1.0.165 → 1.0.169

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 (64) hide show
  1. package/dist/cjs/ezeep.cjs.js +2 -2
  2. package/dist/cjs/ezp-auth_14.cjs.entry.js +93 -84
  3. package/dist/cjs/{index-baa7689a.js → index-0b159f85.js} +6 -1
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/components/ezp-auth/ezp-auth.css +2 -2
  6. package/dist/collection/components/ezp-auth/ezp-auth.js +30 -4
  7. package/dist/collection/components/ezp-backdrop/ezp-backdrop.css +1 -1
  8. package/dist/collection/components/ezp-dialog/ezp-dialog.css +5 -5
  9. package/dist/collection/components/ezp-icon/ezp-icon.css +1 -1
  10. package/dist/collection/components/ezp-icon-button/ezp-icon-button.css +16 -16
  11. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.css +10 -9
  12. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +28 -47
  13. package/dist/collection/components/ezp-printing/ezp-printing.css +203 -133
  14. package/dist/collection/components/ezp-printing/ezp-printing.js +26 -9
  15. package/dist/collection/components/ezp-select/ezp-select.css +21 -21
  16. package/dist/collection/components/ezp-select/ezp-select.js +5 -4
  17. package/dist/collection/components/ezp-status/ezp-status.css +7 -7
  18. package/dist/collection/components/ezp-status/ezp-status.js +2 -3
  19. package/dist/collection/components/ezp-stepper/ezp-stepper.css +12 -12
  20. package/dist/collection/components/ezp-text-button/ezp-text-button.css +14 -14
  21. package/dist/collection/components/ezp-upload/ezp-upload.css +6 -6
  22. package/dist/collection/components/ezp-upload/ezp-upload.js +19 -9
  23. package/dist/collection/components/ezp-user-menu/ezp-user-menu.css +33 -29
  24. package/dist/collection/components/ezp-user-menu/ezp-user-menu.js +1 -1
  25. package/dist/custom-elements/index.js +95 -86
  26. package/dist/directives/proxies.ts +2 -2
  27. package/dist/esm/ezeep.js +2 -2
  28. package/dist/esm/ezp-auth_14.entry.js +93 -84
  29. package/dist/esm/{index-18d4bf15.js → index-13f75d28.js} +6 -1
  30. package/dist/esm/loader.js +2 -2
  31. package/dist/esm-es5/ezeep.js +1 -1
  32. package/dist/esm-es5/ezp-auth_14.entry.js +3 -3
  33. package/dist/esm-es5/index-13f75d28.js +1 -0
  34. package/dist/esm-es5/loader.js +1 -1
  35. package/dist/ezeep/ezeep.esm.js +1 -1
  36. package/dist/ezeep/ezeep.js +1 -1
  37. package/dist/ezeep/{p-3b6f9be6.entry.js → p-0ca9a8ac.entry.js} +2 -2
  38. package/dist/ezeep/p-16c7584d.system.js +1 -0
  39. package/dist/ezeep/p-17f25f95.js +1 -0
  40. package/{www/build/p-246f65df.system.entry.js → dist/ezeep/p-7acdedd4.system.entry.js} +3 -3
  41. package/dist/ezeep/p-c04b764e.system.js +1 -0
  42. package/dist/types/components/ezp-auth/ezp-auth.d.ts +1 -0
  43. package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +1 -0
  44. package/dist/types/components/ezp-printing/ezp-printing.d.ts +1 -0
  45. package/dist/types/components/ezp-upload/ezp-upload.d.ts +3 -6
  46. package/dist/types/components.d.ts +2 -0
  47. package/dist/types/shared/types.d.ts +3 -2
  48. package/package.json +3 -1
  49. package/www/build/ezeep.esm.js +1 -1
  50. package/www/build/ezeep.js +1 -1
  51. package/www/build/{p-3b6f9be6.entry.js → p-0ca9a8ac.entry.js} +2 -2
  52. package/www/build/p-16c7584d.system.js +1 -0
  53. package/www/build/p-17f25f95.js +1 -0
  54. package/{dist/ezeep/p-246f65df.system.entry.js → www/build/p-7acdedd4.system.entry.js} +3 -3
  55. package/www/build/p-c04b764e.system.js +1 -0
  56. package/www/data/locales/en.json +5 -2
  57. package/www/index.html +8 -1
  58. package/dist/esm-es5/index-18d4bf15.js +0 -1
  59. package/dist/ezeep/p-80d5c308.system.js +0 -1
  60. package/dist/ezeep/p-d9b69b53.js +0 -1
  61. package/dist/ezeep/p-f96ca6a7.system.js +0 -1
  62. package/www/build/p-80d5c308.system.js +0 -1
  63. package/www/build/p-d9b69b53.js +0 -1
  64. package/www/build/p-f96ca6a7.system.js +0 -1
@@ -51,7 +51,7 @@ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
51
51
  const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
52
52
  if (listeners) {
53
53
  listeners.map(([flags, name, method]) => {
54
- const target = elm;
54
+ const target = getHostListenerTarget(elm, flags) ;
55
55
  const handler = hostListenerProxy(hostRef, method);
56
56
  const opts = hostListenerOpts(flags);
57
57
  plt.ael(target, name, handler, opts);
@@ -75,6 +75,11 @@ const hostListenerProxy = (hostRef, methodName) => (ev) => {
75
75
  consoleError(e);
76
76
  }
77
77
  };
78
+ const getHostListenerTarget = (elm, flags) => {
79
+ if (flags & 4 /* TargetDocument */)
80
+ return doc;
81
+ return elm;
82
+ };
78
83
  // prettier-ignore
79
84
  const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
80
85
  const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-baa7689a.js');
5
+ const index = require('./index-0b159f85.js');
6
6
  const appGlobals = require('./app-globals-53afb196.js');
7
7
 
8
8
  /*
@@ -16,7 +16,7 @@ const defineCustomElements = (win, options) => {
16
16
  if (typeof window === 'undefined') return Promise.resolve();
17
17
  return patchEsm().then(() => {
18
18
  appGlobals.globalScripts();
19
- return index.bootstrapLazy([["ezp-auth_14.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"printOpen":[32],"authOpen":[32],"noDocumentOpen":[32],"systemAppearance":[32],"open":[64],"logOut":[64],"getSasUri":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"]]],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"file":[16],"hidemenu":[4],"loading":[32],"printProcessing":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"notSupported":[32],"noPrinters":[32],"userMenuOpen":[32],"printStopped":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32]},[[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"dragging":[32]},[[1,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}],[1,"ezp-user-menu",{"name":[1],"open":[1028]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]}],[1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]]]], options);
19
+ return index.bootstrapLazy([["ezp-auth_14.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"printOpen":[32],"authOpen":[32],"onlyGetSasUri":[32],"noDocumentOpen":[32],"systemAppearance":[32],"open":[64],"logOut":[64],"getSasUri":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"]]],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"file":[16],"hidemenu":[4],"loading":[32],"printProcessing":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"notSupported":[32],"noPrinters":[32],"userMenuOpen":[32],"printStopped":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32]},[[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"trigger":[1],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"filename":[32],"dragging":[32]},[[1,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"],[4,"printCancel","listenPrintCancel"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}],[1,"ezp-user-menu",{"name":[1],"open":[1028]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]}],[1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]]]], options);
20
20
  });
21
21
  };
22
22
 
@@ -4,7 +4,7 @@
4
4
  *
5
5
  */
6
6
  :host {
7
- --ezp-color-theme-solid: var(--ezp-color-cyan-solid);
8
- --ezp-color-theme-translucent: var(--ezp-color-cyan-translucent);
7
+ --ezp-theme-solid: var(--ezp-accent-cyan-solid);
8
+ --ezp-theme-translucent: var(--ezp-accent-cyan-translucent);
9
9
  display: block;
10
10
  }
@@ -1,4 +1,4 @@
1
- import { Component, Host, h, Prop, State, Event, Listen } from '@stencil/core';
1
+ import { Component, Host, h, Prop, State, Event, Listen, } from '@stencil/core';
2
2
  import { EzpAuthorizationService } from '../../services/auth';
3
3
  import authStore from '../../services/auth';
4
4
  import i18next from 'i18next';
@@ -17,6 +17,11 @@ export class EzpAuth {
17
17
  this.authCancel.emit();
18
18
  }
19
19
  openSignInWindow(url, name) {
20
+ if (authStore.state.isAuthorized) {
21
+ this.authCancel.emit();
22
+ this.authSuccess.emit();
23
+ return;
24
+ }
20
25
  // remove any existing event listeners
21
26
  window.removeEventListener('message', this.receiveMessage);
22
27
  // window features
@@ -31,6 +36,11 @@ export class EzpAuth {
31
36
  then we load it in the already opened secondary window and then
32
37
  we bring such window back on top/in front of its parent window. */
33
38
  this.oauthPopupWindow = window.open(url, name, windowFeatures);
39
+ if (!this.oauthPopupWindow ||
40
+ this.oauthPopupWindow.closed ||
41
+ typeof this.oauthPopupWindow.closed == 'undefined') {
42
+ alert('popup blocked');
43
+ }
34
44
  this.oauthPopupWindow.focus();
35
45
  }
36
46
  else {
@@ -58,13 +68,12 @@ export class EzpAuth {
58
68
  await this.auth.generateCodeChallenge(authStore.state.codeVerifier);
59
69
  this.auth.buildAuthURI();
60
70
  }
61
- if (this.hidelogin) {
71
+ if (this.hidelogin && this.trigger === 'button') {
62
72
  this.openSignInWindow(this.auth.authURI.toString(), 'ezeep Login');
63
73
  }
64
74
  }
65
75
  render() {
66
- return this.hidelogin ? (h("ezp-status", { description: i18next.t('login_dialog.action'), processing: true, cancel: true })) : (h(Host, null,
67
- h("ezp-dialog", { heading: i18next.t('login_dialog.heading'), description: i18next.t('login_dialog.description'), action: i18next.t('login_dialog.action'), iconName: "logo", iconSize: "huge", iconFramed: false, instance: "login" })));
76
+ return (h(Host, null, this.hidelogin && this.trigger === 'button' ? (h("ezp-status", { description: i18next.t('login_dialog.action'), processing: true, cancel: true })) : this.hidelogin && this.trigger === 'file' ? (h("ezp-text-button", { type: "button", level: "primary", onClick: () => this.openSignInWindow(this.auth.authURI.toString(), 'ezeep Login'), label: i18next.t('button_actions.select_printer') })) : (h("ezp-dialog", { heading: i18next.t('login_dialog.heading'), description: i18next.t('login_dialog.description'), action: i18next.t('login_dialog.action'), iconName: "logo", iconSize: "huge", iconFramed: false, instance: "login" }))));
68
77
  }
69
78
  static get is() { return "ezp-auth"; }
70
79
  static get encapsulation() { return "shadow"; }
@@ -125,6 +134,23 @@ export class EzpAuth {
125
134
  },
126
135
  "attribute": "hidelogin",
127
136
  "reflect": false
137
+ },
138
+ "trigger": {
139
+ "type": "string",
140
+ "mutable": false,
141
+ "complexType": {
142
+ "original": "string",
143
+ "resolved": "string",
144
+ "references": {}
145
+ },
146
+ "required": false,
147
+ "optional": false,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": ""
151
+ },
152
+ "attribute": "trigger",
153
+ "reflect": false
128
154
  }
129
155
  }; }
130
156
  static get states() { return {
@@ -5,7 +5,7 @@
5
5
  */
6
6
  :host {
7
7
  animation: var(--ezp-backdrop-animation-name, host-in) var(--ezp-duration-3) forwards var(--ezp-easing-out-quart);
8
- background: var(--ezp-color-overlay-primary);
8
+ background: var(--ezp-core-backdrop);
9
9
  border-radius: 6px;
10
10
  display: block;
11
11
  height: 100%;
@@ -1,7 +1,7 @@
1
1
  :host {
2
- --ezp-icon-fill: var(--ezp-color-theme-solid);
2
+ --ezp-icon-fill: var(--ezp-theme-solid);
3
3
  align-content: center;
4
- background: var(--ezp-color-overlay-primary);
4
+ background: var(--ezp-core-backdrop);
5
5
  display: grid;
6
6
  grid-template: auto/minmax(auto, 280px);
7
7
  height: 100%;
@@ -13,9 +13,9 @@
13
13
  }
14
14
 
15
15
  #box {
16
- background: var(--ezp-color-surface-tertiary);
16
+ background: var(--ezp-core-surface-tertiary);
17
17
  border-radius: 6px;
18
- box-shadow: var(--ezp-dialog-box-boxShadow, 0 0 0 1px var(--ezp-color-overlay-secondary));
18
+ box-shadow: var(--ezp-dialog-box-boxShadow, 0 0 0 1px var(--ezp-black-10));
19
19
  }
20
20
 
21
21
  #header {
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  #text {
37
- color: var(--ezp-color-foreground-primary);
37
+ color: var(--ezp-core-foreground-primary);
38
38
  display: flex;
39
39
  flex-direction: column;
40
40
  gap: var(--ezp-spacing-4);
@@ -15,7 +15,7 @@
15
15
  width: var(--ezp-icon-width, var(--ezp-icon-size));
16
16
  }
17
17
  :host(.framed) {
18
- --ezp-icon-background: var(--ezp-color-shade-primary);
18
+ --ezp-icon-background: var(--ezp-core-shade-primary);
19
19
  --ezp-icon-borderRadius: 50%;
20
20
  --ezp-icon-padding: var(--ezp-icon-frame);
21
21
  }
@@ -7,35 +7,35 @@
7
7
  display: block;
8
8
  }
9
9
  :host(.primary) {
10
- --ezp-iconButton-background-disabled: var(--ezp-color-shade-primary);
11
- --ezp-iconButton-background-init: var(--ezp-color-theme-solid);
12
- --ezp-iconButton-color-disabled: var(--ezp-color-foreground-tertiary);
13
- --ezp-iconButton-color-init: var(--ezp-color-on-theme);
10
+ --ezp-iconButton-background-disabled: var(--ezp-core-shade-primary);
11
+ --ezp-iconButton-background-init: var(--ezp-theme-solid);
12
+ --ezp-iconButton-color-disabled: var(--ezp-core-foreground-tertiary);
13
+ --ezp-iconButton-color-init: var(--ezp-white-100);
14
14
  --ezp-iconButton-opacity-active: 0.74;
15
15
  --ezp-iconButton-opacity-hover: 0.84;
16
16
  }
17
17
 
18
18
  :host(.secondary) {
19
- --ezp-iconButton-background-active: var(--ezp-color-shade-tertiary);
20
- --ezp-iconButton-background-disabled: var(--ezp-color-shade-primary);
21
- --ezp-iconButton-background-hover: var(--ezp-color-shade-secondary);
22
- --ezp-iconButton-background-init: var(--ezp-color-shade-primary);
23
- --ezp-iconButton-color-disabled: var(--ezp-color-foreground-tertiary);
24
- --ezp-iconButton-color-init: var(--ezp-color-theme-solid);
19
+ --ezp-iconButton-background-active: var(--ezp-core-shade-tertiary);
20
+ --ezp-iconButton-background-disabled: var(--ezp-core-shade-primary);
21
+ --ezp-iconButton-background-hover: var(--ezp-core-shade-secondary);
22
+ --ezp-iconButton-background-init: var(--ezp-core-shade-primary);
23
+ --ezp-iconButton-color-disabled: var(--ezp-core-foreground-tertiary);
24
+ --ezp-iconButton-color-init: var(--ezp-theme-solid);
25
25
  }
26
26
 
27
27
  :host(.tertiary) {
28
- --ezp-iconButton-background-active: var(--ezp-color-shade-secondary);
29
- --ezp-iconButton-background-hover: var(--ezp-color-shade-primary);
28
+ --ezp-iconButton-background-active: var(--ezp-core-shade-secondary);
29
+ --ezp-iconButton-background-hover: var(--ezp-core-shade-primary);
30
30
  --ezp-iconButton-background-init: transparent;
31
- --ezp-iconButton-color-disabled: var(--ezp-color-foreground-tertiary);
32
- --ezp-iconButton-color-init: var(--ezp-color-theme-solid);
31
+ --ezp-iconButton-color-disabled: var(--ezp-core-foreground-tertiary);
32
+ --ezp-iconButton-color-init: var(--ezp-theme-solid);
33
33
  }
34
34
 
35
35
  :host(.quaternary) {
36
36
  --ezp-iconButton-background-init: transparent;
37
- --ezp-iconButton-color-disabled: var(--ezp-color-foreground-tertiary);
38
- --ezp-iconButton-color-init: var(--ezp-color-theme-solid);
37
+ --ezp-iconButton-color-disabled: var(--ezp-core-foreground-tertiary);
38
+ --ezp-iconButton-color-init: var(--ezp-theme-solid);
39
39
  --ezp-iconButton-opacity-active: 0.58;
40
40
  --ezp-iconButton-opacity-hover: 0.74;
41
41
  }
@@ -30,30 +30,31 @@
30
30
  */
31
31
  :host {
32
32
  align-content: center;
33
- background: var(--ezp-color-overlay-primary);
33
+ background: var(--ezp-core-backdrop);
34
34
  display: grid;
35
- grid-template: auto/320px;
35
+ grid-template: auto/var(--ezp-printerSelection-width, 320px);
36
36
  height: 100vh;
37
37
  justify-content: center;
38
38
  left: 0;
39
39
  position: fixed;
40
40
  top: 0;
41
41
  width: 100vw;
42
+ z-index: 1;
42
43
  }
43
44
 
44
45
  #box {
45
- background: var(--ezp-color-surface-tertiary);
46
+ background: var(--ezp-core-surface-tertiary);
46
47
  border-radius: 6px;
47
- box-shadow: var(--ezp-printerSelection-box-boxShadow, 0 0 0 1px var(--ezp-color-overlay-secondary));
48
+ box-shadow: var(--ezp-printerSelection-box-boxShadow, 0 0 0 1px var(--ezp-black-10));
48
49
  position: relative;
49
50
  }
50
51
 
51
52
  #header {
52
53
  border-radius: 6px 6px 0 0;
53
- box-shadow: var(--ezp-printerSelection-header-boxShadowPosition, 0 1px 0 0) var(--ezp-color-outline);
54
- color: var(--ezp-color-foreground-primary);
54
+ box-shadow: var(--ezp-printerSelection-header-boxShadowPosition, 0 1px 0 0) var(--ezp-core-outline);
55
+ color: var(--ezp-core-foreground-primary);
55
56
  display: grid;
56
- grid-column-gap: var(--ezp-spacing-1);
57
+ grid-column-gap: var(--ezp-spacing-2);
57
58
  grid-template-columns: auto 1fr auto;
58
59
  padding: var(--ezp-spacing-4) var(--ezp-spacing-3) var(--ezp-spacing-4) var(--ezp-spacing-4);
59
60
  position: relative;
@@ -67,7 +68,7 @@
67
68
  }
68
69
 
69
70
  #body {
70
- background: var(--ezp-color-surface-secondary);
71
+ background: var(--ezp-core-surface-secondary);
71
72
  box-shadow: var(--ezp-printerSelection-body-boxShadow, none);
72
73
  display: flex;
73
74
  flex-direction: column;
@@ -77,7 +78,7 @@
77
78
 
78
79
  #footer {
79
80
  border-radius: 0 0 6px 6px;
80
- box-shadow: var(--ezp-printerSelection-footer-boxShadowPosition, 0 -1px 0 0) var(--ezp-color-outline);
81
+ box-shadow: var(--ezp-printerSelection-footer-boxShadowPosition, 0 -1px 0 0) var(--ezp-core-outline);
81
82
  display: grid;
82
83
  grid-column-gap: var(--ezp-spacing-2);
83
84
  grid-template-columns: repeat(2, 1fr);
@@ -50,11 +50,11 @@ export class EzpPrinterSelection {
50
50
  paper: '',
51
51
  paperid: '',
52
52
  color: false,
53
- duplex: false,
54
- duplexmode: '',
55
- orientation: '',
53
+ duplex: true,
54
+ duplexmode: 1,
55
+ orientation: 1,
56
56
  copies: '',
57
- resolution: '',
57
+ resolution: 0,
58
58
  };
59
59
  /**
60
60
  *
@@ -77,6 +77,7 @@ export class EzpPrinterSelection {
77
77
  this.MAX_POLL_ATTEMPTS = Infinity;
78
78
  /** Description... */
79
79
  this.handlePrint = async () => {
80
+ this.printButton.blur();
80
81
  this.printProcessing = true;
81
82
  // we have to initialse this obj with empty strings to display the select component
82
83
  // but don't want to send any attributes with empty strings to the API
@@ -203,7 +204,7 @@ export class EzpPrinterSelection {
203
204
  this.selectedPrinter = JSON.parse(localStorage.getItem('printer'));
204
205
  }
205
206
  else {
206
- this.selectedPrinter = { id: '', location: '', name: '' };
207
+ this.selectedPrinter = { id: '', location: '', name: '', is_queue: false };
207
208
  }
208
209
  }
209
210
  getUserInfo() {
@@ -218,6 +219,7 @@ export class EzpPrinterSelection {
218
219
  case 'printer':
219
220
  this.selectedPrinter.id = eventDetails.id;
220
221
  this.selectedPrinter.name = eventDetails.title;
222
+ this.selectedPrinter.is_queue = eventDetails.is_queue;
221
223
  await this.printService
222
224
  .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
223
225
  .then((data) => (this.selectedPrinterConfig = data[0]));
@@ -325,8 +327,10 @@ export class EzpPrinterSelection {
325
327
  else {
326
328
  format = 'A4';
327
329
  }
328
- this.selectedProperties.paper = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name.includes(format)).Name;
329
- this.selectedProperties.paperid = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name.includes(format)).Id;
330
+ if (this.selectedPrinterConfig.PaperFormats.find((el) => el.Name.includes(format))) {
331
+ this.selectedProperties.paper = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name.includes(format)).Name;
332
+ this.selectedProperties.paperid = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name.includes(format)).Id;
333
+ }
330
334
  }
331
335
  /**
332
336
  *
@@ -385,10 +389,10 @@ export class EzpPrinterSelection {
385
389
  ? i18next.t('printer_selection.prepare_upload')
386
390
  : this.uploading
387
391
  ? i18next.t('printer_selection.uploading')
388
- : 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)),
392
+ : 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.printSuccess && this.selectedPrinter.is_queue ? (h("ezp-status", { icon: "checkmark-alt", description: i18next.t('printer_selection.pull_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)),
389
393
  h("div", { id: "header" },
390
394
  h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }),
391
- h("ezp-label", { text: !this.notSupported ? this.filename : '' }),
395
+ h("ezp-label", { text: !this.notSupported ? this.filename : '', ellipsis: true }),
392
396
  !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu }))),
393
397
  h("div", { id: "body" },
394
398
  h("div", { id: "printer" },
@@ -397,13 +401,10 @@ export class EzpPrinterSelection {
397
401
  : i18next.t('printer_selection.no_printers'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
398
402
  id: printer.id,
399
403
  title: printer.name,
400
- meta: printer.location !== ''
401
- ? printer.location
402
- : '',
404
+ meta: printer.location !== '' ? printer.location : '',
403
405
  type: 'printer',
404
- })),
405
- // preSelected={this.selectedPrinter ? this.selectedPrinter.name : null}
406
- disabled: !(this.printers.length > 0) })),
406
+ is_queue: printer.is_queue,
407
+ })), preSelected: this.selectedPrinter.id ? this.selectedPrinter.name : null, disabled: !(this.printers.length > 0) })),
407
408
  h("div", { id: "options" },
408
409
  h("ezp-select", { label: i18next.t('printer_selection.color'), icon: "color", placeholder: i18next.t('printer_selection.select_color'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.Color
409
410
  ? [
@@ -427,61 +428,41 @@ export class EzpPrinterSelection {
427
428
  meta: '',
428
429
  type: 'color',
429
430
  },
430
- ],
431
- // preSelected={
432
- // this.selectedProperties.color
433
- // ? i18next.t('printer_selection.color_color')
434
- // : i18next.t('printer_selection.color_grayscale')
435
- // }
436
- disabled: !this.selectedPrinterConfig.Color }),
431
+ ], preSelected: this.selectedPrinter.id
432
+ ? this.selectedProperties.color
433
+ ? i18next.t('printer_selection.color_color')
434
+ : i18next.t('printer_selection.color_grayscale')
435
+ : null, disabled: !this.selectedPrinterConfig.Color }),
437
436
  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) => ({
438
437
  id: option.id,
439
438
  title: option.title,
440
439
  meta: '',
441
440
  type: 'duplex',
442
- })),
443
- // preSelected={
444
- // this.selectedProperties.duplex
445
- // ? this.duplexOptions.find(
446
- // (option) => option.id === this.selectedProperties.duplexmode
447
- // ).id
448
- // : null
449
- // }
450
- disabled: !this.selectedPrinterConfig.DuplexSupported }),
441
+ })), preSelected: this.selectedPrinter.id && this.selectedProperties.duplex
442
+ ? this.duplexOptions.find((option) => option.id === this.selectedProperties.duplexmode).id
443
+ : null, disabled: !this.selectedPrinterConfig.DuplexSupported }),
451
444
  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) => ({
452
445
  id: format.Id,
453
446
  title: format.Name,
454
447
  meta: `${format.XRes} x ${format.YRes}`,
455
448
  type: 'format',
456
- })),
457
- // preSelected={this.selectedProperties.paper ? this.selectedProperties.paper : null}
458
- disabled: !(this.selectedPrinterConfig.PaperFormats.length > 0) }),
449
+ })), preSelected: this.selectedPrinter.id ? this.selectedProperties.paper : null, disabled: !(this.selectedPrinterConfig.PaperFormats.length > 0) }),
459
450
  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) => ({
460
451
  id: index + 1,
461
452
  title: i18next.t(`printer_selection.orientation_${orientation}`),
462
453
  meta: '',
463
454
  type: 'orientation',
464
- })),
465
- // preSelected={
466
- // this.selectedProperties.orientation
467
- // ? this.selectedProperties.orientation
468
- // : null
469
- // }
470
- disabled: !(this.selectedPrinterConfig.OrientationsSupported.length > 0) }),
455
+ })), preSelected: this.selectedPrinter.id ? this.selectedProperties.orientation : null, disabled: !(this.selectedPrinterConfig.OrientationsSupported.length > 0) }),
471
456
  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) => ({
472
457
  id: index,
473
458
  title: option,
474
459
  meta: '',
475
460
  type: 'quality',
476
- })),
477
- // preSelected={
478
- // this.selectedProperties.resolution ? this.selectedProperties.resolution : null
479
- // }
480
- disabled: !(this.selectedPrinterConfig.Resolutions.length > 0) })),
461
+ })), preSelected: this.selectedPrinter.id ? this.selectedProperties.resolution : null, disabled: !(this.selectedPrinterConfig.Resolutions.length > 0) })),
481
462
  h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })),
482
463
  h("div", { id: "footer" },
483
464
  h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel') }),
484
- h("ezp-text-button", { disabled: this.selectedPrinter.id === '', type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })),
465
+ h("ezp-text-button", { disabled: this.selectedPrinter.id === '' || this.printProcessing, type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print'), ref: (button) => (this.printButton = button) })),
485
466
  !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
486
467
  }
487
468
  static get is() { return "ezp-printer-selection"; }