@ezeep/ezeep-js 1.0.272 → 1.0.277
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.
- package/dist/cjs/{app-globals-D7ISNeUi.js → app-globals-L_3XPZxT.js} +7 -1
- package/dist/cjs/ezeep.cjs.js +4 -4
- package/dist/cjs/ezp-auth_15.cjs.entry.js +7240 -3678
- package/dist/cjs/{index-dv_gozsq.js → index-DM5v_sge.js} +3 -2
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ezp-auth/ezp-auth.css +1 -1
- package/dist/collection/components/ezp-auth/ezp-auth.js +56 -15
- package/dist/collection/components/ezp-backdrop/ezp-backdrop.js +5 -5
- package/dist/collection/components/ezp-dialog/ezp-dialog.js +85 -13
- package/dist/collection/components/ezp-icon/ezp-icon.js +7 -2
- package/dist/collection/components/ezp-icon-button/ezp-icon-button.js +4 -1
- package/dist/collection/components/ezp-input/ezp-input.css +9 -12
- package/dist/collection/components/ezp-input/ezp-input.js +15 -13
- package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +207 -323
- package/dist/collection/components/ezp-printing/ezp-printing.css +9 -9
- package/dist/collection/components/ezp-printing/ezp-printing.js +107 -35
- package/dist/collection/components/ezp-select/ezp-select.css +2 -2
- package/dist/collection/components/ezp-select/ezp-select.js +92 -13
- package/dist/collection/components/ezp-status/ezp-status.js +23 -13
- package/dist/collection/components/ezp-stepper/ezp-stepper.js +13 -6
- package/dist/collection/components/ezp-text-button/ezp-text-button.js +1 -1
- package/dist/collection/components/ezp-upload/ezp-upload.css +9 -9
- package/dist/collection/components/ezp-upload/ezp-upload.js +26 -8
- package/dist/collection/components/ezp-user-menu/ezp-user-menu.css +2 -1
- package/dist/collection/components/ezp-user-menu/ezp-user-menu.js +15 -15
- package/dist/collection/services/auth.js +37 -36
- package/dist/collection/services/http.js +11 -0
- package/dist/collection/services/print-job.js +72 -0
- package/dist/collection/services/print.js +21 -69
- package/dist/collection/services/user.js +2 -9
- package/dist/collection/shared/constants.js +55 -0
- package/dist/collection/shared/global.js +7 -1
- package/dist/collection/shared/storage.js +71 -0
- package/dist/collection/types/shared/types.d.ts +40 -9
- package/dist/collection/utils/printer.js +68 -0
- package/dist/collection/utils/utils.js +24 -9
- package/dist/components/auth.js +1 -1
- package/dist/components/ezp-auth2.js +1 -1
- package/dist/components/ezp-backdrop2.js +1 -1
- package/dist/components/ezp-dialog2.js +1 -1
- package/dist/components/ezp-icon-button2.js +1 -1
- package/dist/components/ezp-icon2.js +1 -1
- package/dist/components/ezp-input2.js +1 -1
- package/dist/components/ezp-printer-selection2.js +1 -1
- package/dist/components/ezp-printing.js +1 -1
- package/dist/components/ezp-select2.js +1 -1
- package/dist/components/ezp-status2.js +1 -1
- package/dist/components/ezp-stepper2.js +1 -1
- package/dist/components/ezp-text-button2.js +1 -1
- package/dist/components/ezp-upload2.js +1 -1
- package/dist/components/ezp-user-menu.js +1 -1
- package/dist/components/ezp-user-menu2.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/utils.js +1 -0
- package/dist/directives/proxies.ts +65 -42
- package/dist/esm/{app-globals-CpP67t2l.js → app-globals-C0WTlb31.js} +7 -1
- package/dist/esm/ezeep.js +5 -5
- package/dist/esm/ezp-auth_15.entry.js +7240 -3678
- package/dist/esm/{index-BTfWEHH9.js → index-BButrLnB.js} +3 -3
- package/dist/esm/loader.js +4 -4
- package/dist/esm-es5/{app-globals-CpP67t2l.js → app-globals-C0WTlb31.js} +1 -1
- package/dist/esm-es5/ezeep.js +1 -1
- package/dist/esm-es5/ezp-auth_15.entry.js +2 -2
- package/dist/esm-es5/{index-BTfWEHH9.js → index-BButrLnB.js} +3 -3
- package/dist/esm-es5/loader.js +1 -1
- package/dist/ezeep/ezeep.esm.js +1 -1
- package/dist/ezeep/ezeep.js +1 -1
- package/dist/ezeep/p-644e48a0.system.entry.js +7 -0
- package/dist/ezeep/{p-BTfWEHH9.js → p-BButrLnB.js} +2 -2
- package/dist/ezeep/{p-CpP67t2l.js → p-C0WTlb31.js} +1 -1
- package/{www/build/p-DhXN1yGM.system.js → dist/ezeep/p-CYpousxy.system.js} +2 -2
- package/dist/ezeep/{p-5ok9OZMg.system.js → p-D4aCr1OK.system.js} +1 -1
- package/dist/ezeep/{p-CfQRcOh8.system.js → p-DCznw2Ee.system.js} +1 -1
- package/dist/ezeep/p-ebd2beda.entry.js +1 -0
- package/dist/ezeep/types/shared/types.d.ts +40 -9
- package/dist/types/components/ezp-auth/ezp-auth.d.ts +8 -5
- package/dist/types/components/ezp-backdrop/ezp-backdrop.d.ts +2 -2
- package/dist/types/components/ezp-dialog/ezp-dialog.d.ts +14 -3
- package/dist/types/components/ezp-input/ezp-input.d.ts +17 -14
- package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +23 -7
- package/dist/types/components/ezp-printing/ezp-printing.d.ts +25 -2
- package/dist/types/components/ezp-select/ezp-select.d.ts +10 -4
- package/dist/types/components/ezp-status/ezp-status.d.ts +6 -4
- package/dist/types/components/ezp-stepper/ezp-stepper.d.ts +1 -1
- package/dist/types/components/ezp-upload/ezp-upload.d.ts +4 -1
- package/dist/types/components/ezp-user-menu/ezp-user-menu.d.ts +5 -2
- package/dist/types/components.d.ts +38 -38
- package/dist/types/services/auth.d.ts +10 -0
- package/dist/types/services/http.d.ts +4 -0
- package/dist/types/services/print-job.d.ts +48 -0
- package/dist/types/services/print.d.ts +10 -9
- package/dist/types/services/user.d.ts +13 -2
- package/dist/types/shared/constants.d.ts +51 -0
- package/dist/types/shared/storage.d.ts +24 -0
- package/dist/types/shared/types.d.ts +40 -9
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/dist/types/utils/printer.d.ts +22 -0
- package/dist/types/utils/utils.d.ts +22 -10
- package/package.json +30 -18
- package/readme.md +1 -0
- package/www/build/ezeep.esm.js +1 -1
- package/www/build/ezeep.js +1 -1
- package/www/build/p-644e48a0.system.entry.js +7 -0
- package/www/build/{p-BTfWEHH9.js → p-BButrLnB.js} +2 -2
- package/www/build/{p-CpP67t2l.js → p-C0WTlb31.js} +1 -1
- package/{dist/ezeep/p-DhXN1yGM.system.js → www/build/p-CYpousxy.system.js} +2 -2
- package/www/build/{p-5ok9OZMg.system.js → p-D4aCr1OK.system.js} +1 -1
- package/www/build/{p-CfQRcOh8.system.js → p-DCznw2Ee.system.js} +1 -1
- package/www/build/p-c7252f1c.js +1 -0
- package/www/build/p-ebd2beda.entry.js +1 -0
- package/www/data/locales/de.json +1 -0
- package/www/data/locales/en.json +1 -0
- package/www/index.html +2 -5
- package/dist/components/i18next.js +0 -1
- package/dist/ezeep/p-2177b8f4.system.entry.js +0 -7
- package/dist/ezeep/p-de8f6583.entry.js +0 -1
- package/www/build/p-2177b8f4.system.entry.js +0 -7
- package/www/build/p-256870db.js +0 -1
- package/www/build/p-de8f6583.entry.js +0 -1
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
*
|
|
60
60
|
*/
|
|
61
61
|
:host {
|
|
62
|
+
box-sizing: border-box;
|
|
62
63
|
font-family: "Inter", sans-serif;
|
|
63
64
|
font-feature-settings: "calt", "liga", "ss03", "zero", "cv05", "cv10";
|
|
64
65
|
font-kerning: normal;
|
|
@@ -68,7 +69,6 @@
|
|
|
68
69
|
-webkit-tap-highlight-color: transparent;
|
|
69
70
|
text-rendering: optimizeLegibility;
|
|
70
71
|
-webkit-text-size-adjust: none;
|
|
71
|
-
box-sizing: border-box;
|
|
72
72
|
--ezp-duration-1: 0.1s;
|
|
73
73
|
--ezp-duration-2: 0.16s;
|
|
74
74
|
--ezp-duration-3: 0.26s;
|
|
@@ -234,10 +234,10 @@
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
:host(.dark) {
|
|
237
|
-
--ezp-dialog-box-boxShadow:
|
|
238
|
-
0 0 0 1px var(--ezp-black-60);
|
|
239
|
-
--ezp-printerSelection-body-boxShadow:
|
|
240
|
-
inset -1px 0 0 0 var(--ezp-core-outline);
|
|
237
|
+
--ezp-dialog-box-boxShadow:
|
|
238
|
+
inset 0 0 0 1px var(--ezp-core-outline), 0 0 0 1px var(--ezp-black-60);
|
|
239
|
+
--ezp-printerSelection-body-boxShadow:
|
|
240
|
+
inset 1px 0 0 0 var(--ezp-core-outline), inset -1px 0 0 0 var(--ezp-core-outline);
|
|
241
241
|
--ezp-printerSelection-box-boxShadow: 0 0 0 1px var(--ezp-black-60);
|
|
242
242
|
--ezp-printerSelection-footer-boxShadowPosition: inset 0 0 0 1px;
|
|
243
243
|
--ezp-printerSelection-header-boxShadowPosition: inset 0 0 0 1px;
|
|
@@ -245,11 +245,11 @@
|
|
|
245
245
|
--ezp-select-wrap-boxShadowPositionLeft: inset 1px 0 0 0;
|
|
246
246
|
--ezp-select-wrap-boxShadowPositionRight: inset -1px 0 0 0;
|
|
247
247
|
--ezp-select-wrap-boxShadowPositionTop: inset 0 1px 0 0;
|
|
248
|
-
--ezp-status-box-boxShadow:
|
|
249
|
-
0 0 0 1px var(--ezp-black-60);
|
|
248
|
+
--ezp-status-box-boxShadow:
|
|
249
|
+
inset 0 0 0 1px var(--ezp-core-outline), 0 0 0 1px var(--ezp-black-60);
|
|
250
250
|
--ezp-stepper-boxShadowPosition: inset 0 0 0 1px;
|
|
251
|
-
--ezp-userMenu-boxShadow:
|
|
252
|
-
0 0 0 1px var(--ezp-black-60);
|
|
251
|
+
--ezp-userMenu-boxShadow:
|
|
252
|
+
inset 0 0 0 1px var(--ezp-core-outline), 0 0 0 1px var(--ezp-black-60);
|
|
253
253
|
--ezp-userMenu-header-boxShadowPosition: inset 0 -1px 0 0;
|
|
254
254
|
--ezp-userMenu-links-boxShadowPosition: inset 0 -1px 0 0;
|
|
255
255
|
--ezp-userMenu-theme-boxShadowPosition: inset 0 -1px 0 0;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Host, h, } from "@stencil/core";
|
|
2
2
|
import authStore, { EzpAuthorizationService, sendCodeToParentWindow } from "../../services/auth";
|
|
3
3
|
import printStore, { EzpPrintService } from "../../services/print";
|
|
4
|
-
import userStore from "../../services/user";
|
|
4
|
+
import userStore, { EzpUserService } from "../../services/user";
|
|
5
5
|
import config from "../../shared/config.json";
|
|
6
6
|
import i18next from "i18next";
|
|
7
|
-
import { initi18n } from "../../utils/utils";
|
|
7
|
+
import { initi18n, subscribeToLanguageChange } from "../../utils/utils";
|
|
8
|
+
import { storage } from "../../shared/storage";
|
|
9
|
+
import { TOKEN_REFRESH_INTERVAL_S } from "../../shared/constants";
|
|
8
10
|
export class EzpPrinting {
|
|
9
11
|
constructor() {
|
|
10
12
|
this.filename = '';
|
|
@@ -28,9 +30,8 @@ export class EzpPrinting {
|
|
|
28
30
|
}
|
|
29
31
|
/** Watchers */
|
|
30
32
|
watchFileData(newValue, oldValue) {
|
|
31
|
-
console.log(newValue);
|
|
32
33
|
if (newValue !== oldValue && newValue.length > 0) {
|
|
33
|
-
|
|
34
|
+
const array = new Uint8Array(newValue.length);
|
|
34
35
|
for (let i = 0; i < newValue.length; i++) {
|
|
35
36
|
array[i] = newValue.charCodeAt(i);
|
|
36
37
|
}
|
|
@@ -50,6 +51,8 @@ export class EzpPrinting {
|
|
|
50
51
|
watchLanguage(newValue, oldValue) {
|
|
51
52
|
if (newValue !== oldValue && newValue.length > 0) {
|
|
52
53
|
this.language = newValue;
|
|
54
|
+
// Apply the new language so any dialog opened afterwards is translated.
|
|
55
|
+
i18next.changeLanguage(newValue);
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
58
|
/**
|
|
@@ -95,7 +98,10 @@ export class EzpPrinting {
|
|
|
95
98
|
document.dispatchEvent(printCancelEvent);
|
|
96
99
|
this.checkAuth();
|
|
97
100
|
}
|
|
98
|
-
listenAuthSuccess() {
|
|
101
|
+
async listenAuthSuccess() {
|
|
102
|
+
// Adopt the user's account language before opening the dialog so it renders
|
|
103
|
+
// in the right language (and picks up a language change made in the host app).
|
|
104
|
+
await this.syncPreferredLanguage();
|
|
99
105
|
if (this.onlyGetSasUri) {
|
|
100
106
|
this.printOpen = false;
|
|
101
107
|
this.onlyGetSasUri = false;
|
|
@@ -137,24 +143,49 @@ export class EzpPrinting {
|
|
|
137
143
|
}
|
|
138
144
|
async logOut() {
|
|
139
145
|
this.auth.revokeRefreshToken();
|
|
140
|
-
|
|
141
|
-
localStorage.removeItem('refreshToken');
|
|
142
|
-
localStorage.removeItem('access_token');
|
|
143
|
-
localStorage.removeItem('printer');
|
|
144
|
-
localStorage.removeItem('isAuthorized');
|
|
146
|
+
storage.clearSession();
|
|
145
147
|
this.printOpen = false;
|
|
146
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Make sure an access token is available before a token-dependent call. The
|
|
151
|
+
* token is in-memory only, so after a reload it must be refreshed from the
|
|
152
|
+
* persisted refresh token first. Returns a shared in-flight promise so
|
|
153
|
+
* concurrent callers don't fire duplicate refreshes, and swallows a transient
|
|
154
|
+
* failure (the caller then falls through to the unauthorized path; the
|
|
155
|
+
* periodic refresh and next checkAuth retry).
|
|
156
|
+
*/
|
|
157
|
+
ensureAccessToken() {
|
|
158
|
+
if (authStore.state.accessToken !== '' || authStore.state.refreshToken === '' || !this.auth) {
|
|
159
|
+
return Promise.resolve();
|
|
160
|
+
}
|
|
161
|
+
if (!this.refreshInFlight) {
|
|
162
|
+
this.refreshInFlight = this.auth
|
|
163
|
+
.refreshTokens()
|
|
164
|
+
.catch(() => {
|
|
165
|
+
// Transient token-endpoint failure — leave the token empty.
|
|
166
|
+
})
|
|
167
|
+
.finally(() => {
|
|
168
|
+
this.refreshInFlight = undefined;
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return this.refreshInFlight;
|
|
172
|
+
}
|
|
147
173
|
async getSasUri() {
|
|
148
174
|
this.onlyGetSasUri = true;
|
|
175
|
+
// Wait for a reload-time token refresh to settle so we don't call the API
|
|
176
|
+
// with an empty bearer (which would spuriously open the login dialog).
|
|
177
|
+
await this.ensureAccessToken();
|
|
149
178
|
const printService = new EzpPrintService(this.redirecturi, this.clientid);
|
|
150
|
-
|
|
179
|
+
const response = await printService
|
|
180
|
+
.prepareFileUpload(authStore.state.accessToken)
|
|
181
|
+
.catch(() => {
|
|
151
182
|
this.open();
|
|
152
183
|
return null;
|
|
153
184
|
});
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
185
|
+
// Keep the original public signature (Promise<string>) for backward
|
|
186
|
+
// compatibility. On the prepare-failure path this resolves to undefined at
|
|
187
|
+
// runtime, exactly as it always has.
|
|
188
|
+
return response ? response.sasUri : undefined;
|
|
158
189
|
}
|
|
159
190
|
async getAuthUri() {
|
|
160
191
|
this.auth.generateCodeVerifier();
|
|
@@ -165,20 +196,23 @@ export class EzpPrinting {
|
|
|
165
196
|
async setAuthRefreshToken(refreshToken) {
|
|
166
197
|
// Store the refresh token in the same way as the component does in self-managed auth
|
|
167
198
|
authStore.state.refreshToken = refreshToken;
|
|
168
|
-
|
|
199
|
+
storage.setRefreshToken(refreshToken);
|
|
169
200
|
// Use the refresh token to obtain a valid access token
|
|
170
201
|
// This ensures the user doesn't see the login dialog
|
|
171
202
|
await this.auth.refreshTokens();
|
|
172
203
|
}
|
|
173
204
|
async checkAuth() {
|
|
205
|
+
// Constructing the print service also loads any persisted refresh token.
|
|
174
206
|
const printService = new EzpPrintService(this.redirecturi, this.clientid);
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
207
|
+
// The access token is kept in memory only (never written to localStorage),
|
|
208
|
+
// to limit XSS exposure. If it's missing — e.g. after a page reload — obtain
|
|
209
|
+
// a fresh one from the persisted refresh token so the user stays signed in.
|
|
210
|
+
// A transient refresh failure is swallowed here so checkAuth still completes
|
|
211
|
+
// and reports unauthorized (rather than rejecting); getConfig below then
|
|
212
|
+
// runs and the periodic refresh retries.
|
|
213
|
+
await this.ensureAccessToken();
|
|
214
|
+
if (storage.hasIsAuthorized()) {
|
|
215
|
+
authStore.state.isAuthorized = storage.getIsAuthorized();
|
|
182
216
|
}
|
|
183
217
|
await printService
|
|
184
218
|
.getConfig(authStore.state.accessToken)
|
|
@@ -194,7 +228,7 @@ export class EzpPrinting {
|
|
|
194
228
|
.catch(() => {
|
|
195
229
|
authStore.state.isAuthorized = false;
|
|
196
230
|
});
|
|
197
|
-
|
|
231
|
+
storage.setIsAuthorized(authStore.state.isAuthorized);
|
|
198
232
|
return authStore.state.isAuthorized;
|
|
199
233
|
}
|
|
200
234
|
/**
|
|
@@ -212,25 +246,29 @@ export class EzpPrinting {
|
|
|
212
246
|
return url.host;
|
|
213
247
|
}
|
|
214
248
|
}
|
|
215
|
-
catch (
|
|
216
|
-
// If URL parsing fails, return the original value
|
|
217
|
-
console.warn('Failed to parse URL:', hostUrl, e);
|
|
249
|
+
catch (_a) {
|
|
250
|
+
// If URL parsing fails, fall through and return the original value.
|
|
218
251
|
}
|
|
219
252
|
// Return as-is if it's already just a hostname
|
|
220
253
|
return hostUrl;
|
|
221
254
|
}
|
|
222
255
|
refreshTokensPeriodically(seconds) {
|
|
223
256
|
const authService = new EzpAuthorizationService(this.redirecturi, this.clientid);
|
|
224
|
-
setInterval(() => {
|
|
257
|
+
this.tokenRefreshInterval = setInterval(() => {
|
|
225
258
|
authService.refreshTokens();
|
|
226
259
|
}, seconds * 1000);
|
|
227
260
|
}
|
|
261
|
+
connectedCallback() {
|
|
262
|
+
this.unsubscribeLanguage = subscribeToLanguageChange(this);
|
|
263
|
+
}
|
|
228
264
|
async componentWillLoad() {
|
|
229
265
|
const systemAppearanceDark = window.matchMedia('(prefers-color-scheme: dark)');
|
|
230
266
|
this.systemAppearance = systemAppearanceDark.matches ? 'dark' : 'light';
|
|
231
|
-
|
|
267
|
+
this.systemAppearanceQuery = systemAppearanceDark;
|
|
268
|
+
this.systemAppearanceListener = (event) => {
|
|
232
269
|
this.systemAppearance = event.matches ? 'dark' : 'light';
|
|
233
|
-
}
|
|
270
|
+
};
|
|
271
|
+
systemAppearanceDark.addEventListener('change', this.systemAppearanceListener);
|
|
234
272
|
authStore.state.redirectUri = this.redirecturi;
|
|
235
273
|
userStore.state.theme = this.theme;
|
|
236
274
|
userStore.state.appearance = this.appearance;
|
|
@@ -249,10 +287,44 @@ export class EzpPrinting {
|
|
|
249
287
|
this.auth = new EzpAuthorizationService(this.redirecturi, this.clientid);
|
|
250
288
|
sendCodeToParentWindow();
|
|
251
289
|
initi18n(this.language);
|
|
252
|
-
this.checkAuth();
|
|
290
|
+
this.checkAuth().then(() => this.syncPreferredLanguage());
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Adopt the signed-in user's account language (`preferred_language` from
|
|
294
|
+
* /v1/users/me) so the print UI matches the language chosen in the host app.
|
|
295
|
+
* An explicit `language` prop always wins. Requires an access token, so it
|
|
296
|
+
* runs after auth. Best-effort: on any failure the current language is kept.
|
|
297
|
+
*/
|
|
298
|
+
async syncPreferredLanguage() {
|
|
299
|
+
if (this.language)
|
|
300
|
+
return;
|
|
301
|
+
if (!authStore.state.accessToken)
|
|
302
|
+
return;
|
|
303
|
+
try {
|
|
304
|
+
const user = await new EzpUserService().getUserInfo();
|
|
305
|
+
const lang = user === null || user === void 0 ? void 0 : user.preferred_language;
|
|
306
|
+
if (lang && lang !== i18next.language) {
|
|
307
|
+
await i18next.changeLanguage(lang);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
catch (_a) {
|
|
311
|
+
// Language sync is best-effort; keep the current language on failure.
|
|
312
|
+
}
|
|
253
313
|
}
|
|
254
314
|
componentDidLoad() {
|
|
255
|
-
this.refreshTokensPeriodically(
|
|
315
|
+
this.refreshTokensPeriodically(TOKEN_REFRESH_INTERVAL_S);
|
|
316
|
+
}
|
|
317
|
+
disconnectedCallback() {
|
|
318
|
+
var _a;
|
|
319
|
+
// Stop the periodic token refresh and the colour-scheme listener so they
|
|
320
|
+
// don't leak (and keep firing) after the component is removed.
|
|
321
|
+
if (this.tokenRefreshInterval) {
|
|
322
|
+
clearInterval(this.tokenRefreshInterval);
|
|
323
|
+
}
|
|
324
|
+
if (this.systemAppearanceQuery && this.systemAppearanceListener) {
|
|
325
|
+
this.systemAppearanceQuery.removeEventListener('change', this.systemAppearanceListener);
|
|
326
|
+
}
|
|
327
|
+
(_a = this.unsubscribeLanguage) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
256
328
|
}
|
|
257
329
|
/**
|
|
258
330
|
*
|
|
@@ -260,7 +332,7 @@ export class EzpPrinting {
|
|
|
260
332
|
*
|
|
261
333
|
*/
|
|
262
334
|
render() {
|
|
263
|
-
return (h(Host, { key: '
|
|
335
|
+
return (h(Host, { key: 'be2b1eab0c9aeb2b026f94c66c760d4c1e3d946a', class: `${userStore.state.theme} ${userStore.state.appearance === 'system'
|
|
264
336
|
? this.systemAppearance
|
|
265
337
|
: userStore.state.appearance} ${this.seamless ? 'seamless' : ''}` }, this.trigger === 'custom' ? (h("slot", null)) : this.trigger === 'file' ? (h("ezp-upload", null)) : (this.trigger === 'button' && (h("ezp-icon-button", { id: "print-trigger", icon: "printer", slot: "trigger", type: "button", onClick: () => this.open() }))), this.authOpen ? (h("ezp-auth", { clientID: this.clientid, redirectURI: this.redirecturi, hidelogin: this.hidelogin, trigger: this.trigger, code: this.code })) : this.printOpen ? (h("ezp-printer-selection", { clientID: this.clientid, redirectURI: this.redirecturi, filename: this.filename, fileurl: this.fileurl, filetype: this.filetype, fileid: this.fileid, files: this.files, hidemenu: this.hidemenu, hideheader: this.hideheader, seamless: this.seamless })) : this.noDocumentOpen ? (h("ezp-dialog", { heading: i18next.t('no_document_dialog.heading'), description: i18next.t('no_document_dialog.description'), action: i18next.t('no_document_dialog.action'), iconName: "question-mark", instance: "no-document-selected" })) : null));
|
|
266
338
|
}
|
|
@@ -691,8 +763,8 @@ export class EzpPrinting {
|
|
|
691
763
|
"text": "Events"
|
|
692
764
|
},
|
|
693
765
|
"complexType": {
|
|
694
|
-
"original": "
|
|
695
|
-
"resolved": "
|
|
766
|
+
"original": "void",
|
|
767
|
+
"resolved": "void",
|
|
696
768
|
"references": {}
|
|
697
769
|
}
|
|
698
770
|
}];
|
|
@@ -167,8 +167,8 @@
|
|
|
167
167
|
.option.is-selected {
|
|
168
168
|
--ezp-select-indicator-opacity: 1;
|
|
169
169
|
--ezp-select-indicator-transform: translateX(0);
|
|
170
|
-
--ezp-select-indicator-transition:
|
|
171
|
-
|
|
170
|
+
--ezp-select-indicator-transition:
|
|
171
|
+
opacity var(--ezp-select-duration) var(--ezp-easing-out-quart),
|
|
172
172
|
transform var(--ezp-select-duration) var(--ezp-easing-out-quart), visibility 0s 0s;
|
|
173
173
|
--ezp-select-indicator-visibility: visible;
|
|
174
174
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
/**
|
|
3
|
+
* The "nothing selected" sentinel. Its empty `title` makes the toggle fall back
|
|
4
|
+
* to the placeholder (see render). Used as the initial state and to reset the
|
|
5
|
+
* selection when the current `preSelected` value has no matching option.
|
|
6
|
+
*/
|
|
7
|
+
const EMPTY_SELECTION = { id: false, title: '', meta: '' };
|
|
2
8
|
export class EzpSelect {
|
|
3
9
|
constructor() {
|
|
4
10
|
this.backdrop = document.createElement('ezp-backdrop');
|
|
@@ -28,7 +34,7 @@ export class EzpSelect {
|
|
|
28
34
|
/** Description... */
|
|
29
35
|
this.expanded = false;
|
|
30
36
|
/** Description... */
|
|
31
|
-
this.selected =
|
|
37
|
+
this.selected = EMPTY_SELECTION;
|
|
32
38
|
/**
|
|
33
39
|
*
|
|
34
40
|
* Private methods
|
|
@@ -48,6 +54,7 @@ export class EzpSelect {
|
|
|
48
54
|
this.select = (id) => {
|
|
49
55
|
var _a;
|
|
50
56
|
const delay = ((_a = this.selected) === null || _a === void 0 ? void 0 : _a.id) === id ? 0 : this.duration * 1000;
|
|
57
|
+
// The id always comes from an existing option, so a match is guaranteed.
|
|
51
58
|
this.selected = this.options.find((option) => option.id === id);
|
|
52
59
|
this.selectSelection.emit(this.selected);
|
|
53
60
|
window.setTimeout(() => {
|
|
@@ -56,11 +63,67 @@ export class EzpSelect {
|
|
|
56
63
|
};
|
|
57
64
|
this.preSelect = () => {
|
|
58
65
|
var _a;
|
|
59
|
-
|
|
66
|
+
const match = (_a = this.options) === null || _a === void 0 ? void 0 : _a.find((option) => typeof this.preSelected === 'number'
|
|
60
67
|
? option.id === this.preSelected
|
|
61
68
|
: typeof this.preSelected === 'string'
|
|
62
69
|
? option.title === this.preSelected
|
|
63
70
|
: null);
|
|
71
|
+
// Reset to the placeholder when the current printer has no matching option,
|
|
72
|
+
// rather than leaving the previous printer's (now-invalid) label showing.
|
|
73
|
+
this.selected = match !== null && match !== void 0 ? match : EMPTY_SELECTION;
|
|
74
|
+
};
|
|
75
|
+
// Open the list on Enter/Space/ArrowDown (moving focus to the first option);
|
|
76
|
+
// close it on Escape.
|
|
77
|
+
this.handleToggleKeydown = (event) => {
|
|
78
|
+
if (this.disabled)
|
|
79
|
+
return;
|
|
80
|
+
if (event.key === 'Enter' || event.key === ' ' || event.key === 'ArrowDown') {
|
|
81
|
+
event.preventDefault();
|
|
82
|
+
if (!this.expanded) {
|
|
83
|
+
this.toggle();
|
|
84
|
+
// Focus the first option once the expanded list has rendered.
|
|
85
|
+
window.setTimeout(() => this.focusOption(0), 0);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else if (event.key === 'Escape' && this.expanded) {
|
|
89
|
+
this.toggle();
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
// Full listbox keyboard support: arrows/Home/End roam the options, Enter/Space
|
|
93
|
+
// selects, Escape closes and returns focus to the toggle.
|
|
94
|
+
this.handleOptionKeydown = (event, id) => {
|
|
95
|
+
var _a;
|
|
96
|
+
const options = this.getOptionElements();
|
|
97
|
+
const current = options.indexOf(event.currentTarget);
|
|
98
|
+
switch (event.key) {
|
|
99
|
+
case 'Enter':
|
|
100
|
+
case ' ':
|
|
101
|
+
event.preventDefault();
|
|
102
|
+
this.select(id);
|
|
103
|
+
break;
|
|
104
|
+
case 'ArrowDown':
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
this.focusOption(current + 1);
|
|
107
|
+
break;
|
|
108
|
+
case 'ArrowUp':
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
this.focusOption(current - 1);
|
|
111
|
+
break;
|
|
112
|
+
case 'Home':
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
this.focusOption(0);
|
|
115
|
+
break;
|
|
116
|
+
case 'End':
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
this.focusOption(options.length - 1);
|
|
119
|
+
break;
|
|
120
|
+
case 'Escape':
|
|
121
|
+
if (this.expanded) {
|
|
122
|
+
this.toggle();
|
|
123
|
+
(_a = this.toggleEl) === null || _a === void 0 ? void 0 : _a.focus();
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
64
127
|
};
|
|
65
128
|
}
|
|
66
129
|
/**
|
|
@@ -91,6 +154,15 @@ export class EzpSelect {
|
|
|
91
154
|
preSelectedChanged() {
|
|
92
155
|
this.preSelect();
|
|
93
156
|
}
|
|
157
|
+
getOptionElements() {
|
|
158
|
+
return this.list ? Array.from(this.list.querySelectorAll('[role="option"]')) : [];
|
|
159
|
+
}
|
|
160
|
+
/** Move focus onto the option at `index` (clamped to the list bounds). */
|
|
161
|
+
focusOption(index) {
|
|
162
|
+
const options = this.getOptionElements();
|
|
163
|
+
const target = options[Math.max(0, Math.min(index, options.length - 1))];
|
|
164
|
+
target === null || target === void 0 ? void 0 : target.focus();
|
|
165
|
+
}
|
|
94
166
|
/**
|
|
95
167
|
*
|
|
96
168
|
* Lifecycle methods
|
|
@@ -137,10 +209,10 @@ export class EzpSelect {
|
|
|
137
209
|
this.disabled ? 'disabled' : '',
|
|
138
210
|
];
|
|
139
211
|
const labelLevel = this.toggleFlow === 'horizontal' ? 'secondary' : 'tertiary';
|
|
140
|
-
return (h(Host, { key: '
|
|
141
|
-
var _a;
|
|
212
|
+
return (h(Host, { key: 'feebc96701d65827e984b1d75d9ef96974ae6df3', class: hostClasses.join(' ') }, h("div", { key: 'ef9d6ac76f626f74d0dfc0cff7e1747afae0df1b', id: "wrap" }, h("div", { key: '3a18e8c059d93be76f72b0244133b7dbddba5d0d', id: "toggle", role: "combobox", "aria-haspopup": "listbox", "aria-controls": "list", "aria-expanded": this.expanded ? 'true' : 'false', "aria-label": this.label, "aria-disabled": this.disabled ? 'true' : 'false', tabindex: this.disabled ? -1 : 0, ref: (el) => (this.toggleEl = el), onClick: () => !this.disabled && this.toggle(), onKeyDown: this.handleToggleKeydown }, this.icon ? h("ezp-icon", { id: "icon", name: this.icon }) : null, h("ezp-label", { key: 'fda5f7c7f33343634df401890b1c580369273568', id: "label", noWrap: true, level: labelLevel, text: this.label }), h("ezp-label", { key: '2cad104bb14338efaf165c7edff5a7226b9f8a8c', id: "value", ellipsis: true, text: ((_a = this.selected) === null || _a === void 0 ? void 0 : _a.title) !== '' ? (_b = this.selected) === null || _b === void 0 ? void 0 : _b.title : this.placeholder }), h("ezp-icon", { key: 'e4e3a59e2ee36ee9d07232ca03e540b4e7dad6ba', id: "accessory", name: "expand" })), h("div", { key: '3f3c5bc0202985d4f64ba9df828c877df1240f6f', id: "list", role: "listbox", "aria-label": this.label, ref: (element) => (this.list = element) }, (_c = this.options) === null || _c === void 0 ? void 0 : _c.map((option) => {
|
|
213
|
+
var _a, _b;
|
|
142
214
|
if (option.title !== '') {
|
|
143
|
-
return (h("div", { class: `option ${option.id === ((_a = this.selected) === null || _a === void 0 ? void 0 : _a.id) ? 'is-selected' : ''} ${option.meta !== '' ? 'has-meta' : ''} `, onClick: () => this.select(option.id) }, h("ezp-icon", { name: "checkmark", class: "indicator" }), h("div", { class: "details" }, h("ezp-label", { class: "title", ellipsis: true, text: option.title }), option.meta !== '' ? (h("ezp-label", { level: "tertiary", class: "meta", text: option.meta, ellipsis: true })) : null)));
|
|
215
|
+
return (h("div", { class: `option ${option.id === ((_a = this.selected) === null || _a === void 0 ? void 0 : _a.id) ? 'is-selected' : ''} ${option.meta !== '' ? 'has-meta' : ''} `, role: "option", "aria-selected": option.id === ((_b = this.selected) === null || _b === void 0 ? void 0 : _b.id) ? 'true' : 'false', tabindex: this.expanded ? 0 : -1, onClick: () => this.select(option.id), onKeyDown: (event) => this.handleOptionKeydown(event, option.id) }, h("ezp-icon", { name: "checkmark", class: "indicator" }), h("div", { class: "details" }, h("ezp-label", { class: "title", ellipsis: true, text: option.title }), option.meta !== '' ? (h("ezp-label", { level: "tertiary", class: "meta", text: option.meta, ellipsis: true })) : null)));
|
|
144
216
|
}
|
|
145
217
|
})))));
|
|
146
218
|
}
|
|
@@ -278,15 +350,15 @@ export class EzpSelect {
|
|
|
278
350
|
"type": "any",
|
|
279
351
|
"mutable": false,
|
|
280
352
|
"complexType": {
|
|
281
|
-
"original": "
|
|
282
|
-
"resolved": "
|
|
353
|
+
"original": "string | number | null",
|
|
354
|
+
"resolved": "null | number | string",
|
|
283
355
|
"references": {}
|
|
284
356
|
},
|
|
285
357
|
"required": false,
|
|
286
358
|
"optional": false,
|
|
287
359
|
"docs": {
|
|
288
360
|
"tags": [],
|
|
289
|
-
"text": "
|
|
361
|
+
"text": "The currently-selected option, matched by title (string) or id (number)."
|
|
290
362
|
},
|
|
291
363
|
"getter": false,
|
|
292
364
|
"setter": false,
|
|
@@ -360,8 +432,8 @@ export class EzpSelect {
|
|
|
360
432
|
"text": "\nEvents"
|
|
361
433
|
},
|
|
362
434
|
"complexType": {
|
|
363
|
-
"original": "
|
|
364
|
-
"resolved": "
|
|
435
|
+
"original": "boolean",
|
|
436
|
+
"resolved": "boolean",
|
|
365
437
|
"references": {}
|
|
366
438
|
}
|
|
367
439
|
}, {
|
|
@@ -375,9 +447,16 @@ export class EzpSelect {
|
|
|
375
447
|
"text": ""
|
|
376
448
|
},
|
|
377
449
|
"complexType": {
|
|
378
|
-
"original": "
|
|
379
|
-
"resolved": "
|
|
380
|
-
"references": {
|
|
450
|
+
"original": "SelectOptionType",
|
|
451
|
+
"resolved": "{ id: string | number | boolean; title: string; meta: string; type?: string | undefined; }",
|
|
452
|
+
"references": {
|
|
453
|
+
"SelectOptionType": {
|
|
454
|
+
"location": "import",
|
|
455
|
+
"path": "../../shared/types",
|
|
456
|
+
"id": "src/shared/types.d.ts::SelectOptionType",
|
|
457
|
+
"referenceLocation": "SelectOptionType"
|
|
458
|
+
}
|
|
459
|
+
}
|
|
381
460
|
}
|
|
382
461
|
}];
|
|
383
462
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { subscribeToLanguageChange } from "../../utils/utils";
|
|
2
3
|
import i18next from "i18next";
|
|
3
4
|
export class EzpStatus {
|
|
4
5
|
constructor() {
|
|
@@ -29,16 +30,25 @@ export class EzpStatus {
|
|
|
29
30
|
* Lifecycle methods
|
|
30
31
|
*
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
connectedCallback() {
|
|
34
|
+
this.unsubscribeLanguage = subscribeToLanguageChange(this);
|
|
35
|
+
}
|
|
36
|
+
disconnectedCallback() {
|
|
37
|
+
var _a;
|
|
38
|
+
(_a = this.unsubscribeLanguage) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
39
|
+
}
|
|
33
40
|
/**
|
|
34
41
|
*
|
|
35
42
|
* Render method
|
|
36
43
|
*
|
|
37
44
|
*/
|
|
38
45
|
render() {
|
|
39
|
-
return (
|
|
46
|
+
return (
|
|
47
|
+
// Live region so screen readers announce status changes (loading,
|
|
48
|
+
// processing, success, error) as they render.
|
|
49
|
+
h(Host, { key: 'b5c9846f02fb4d1ecfb4e858979771707f43da7b', role: "status", "aria-live": "polite" }, h("div", { key: '565dc8d7c33de18e84b9e2fc08509fa930f25b6b', id: "box" }, this.processing ? (h("svg", { id: "indicator", viewBox: "0 0 42 42", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true" }, h("circle", { id: "track", cx: "21", cy: "21", r: "18" }), h("circle", { id: "value", cx: "21", cy: "21", r: "18" }))) : this.icon ? (h("ezp-icon", { name: this.icon, framed: true })) : null, h("ezp-label", { key: '2e0a465a7ab43caf42ddbe0bcf8939411334fe75', id: "description", level: "tertiary", weight: "strong", text: this.description }), (this.cancel || this.close || this.retry) && (h("div", { key: '47c159c24325fc2b8617dfeb70a322e3fb21d1c2', id: "footer" }, this.cancel && (h("ezp-text-button", { key: '50cadac96eede3676ff7b223e2974f4f621246a3', level: "secondary", small: true, onClick: this.handleCancel, label: typeof this.cancel === 'string'
|
|
40
50
|
? this.cancel
|
|
41
|
-
: i18next.t('button_actions.cancel') })), this.close && (h("ezp-text-button", { key: '
|
|
51
|
+
: i18next.t('button_actions.cancel') })), this.close && (h("ezp-text-button", { key: '36efc776e9c90117fd3c99544cdd3fc2e170466c', level: this.retry ? 'secondary' : 'primary', small: true, onClick: this.handleClose, label: typeof this.close === 'string' ? this.close : i18next.t('button_actions.close') })), this.retry && (h("ezp-text-button", { key: '04c60353ca77b16772edb67a38ef5cdf06e4f407', level: "primary", small: true, onClick: this.handleRetry, label: typeof this.retry === 'string' ? this.retry : i18next.t('button_actions.retry') })))))));
|
|
42
52
|
}
|
|
43
53
|
static get is() { return "ezp-status"; }
|
|
44
54
|
static get encapsulation() { return "shadow"; }
|
|
@@ -118,7 +128,7 @@ export class EzpStatus {
|
|
|
118
128
|
"mutable": false,
|
|
119
129
|
"complexType": {
|
|
120
130
|
"original": "IconNameTypes",
|
|
121
|
-
"resolved": "\"account\" | \"checkmark\" | \"checkmark-alt\" | \"close\" | \"color\" | \"copies\" | \"dark\" | \"drag-drop\" | \"duplex\" | \"exclamation-mark\" | \"expand\" | \"height\" | \"help\" | \"light\" | \"logo\" | \"logout\" | \"menu\" | \"minus\" | \"orientation\" | \"paper_range\" | \"plus\" | \"printer\" | \"quality\" | \"question-mark\" | \"size\" | \"system\" | \"trays\" | \"width\"",
|
|
131
|
+
"resolved": "\"account\" | \"checkmark\" | \"checkmark-alt\" | \"close\" | \"color\" | \"copies\" | \"dark\" | \"drag-drop\" | \"duplex\" | \"exclamation-mark\" | \"expand\" | \"height\" | \"help\" | \"light\" | \"logo\" | \"logout\" | \"menu\" | \"minus\" | \"orientation\" | \"paper_range\" | \"plus\" | \"printer\" | \"quality\" | \"question-mark\" | \"size\" | \"system\" | \"trays\" | \"width\" | undefined",
|
|
122
132
|
"references": {
|
|
123
133
|
"IconNameTypes": {
|
|
124
134
|
"location": "import",
|
|
@@ -144,7 +154,7 @@ export class EzpStatus {
|
|
|
144
154
|
"mutable": false,
|
|
145
155
|
"complexType": {
|
|
146
156
|
"original": "string | boolean",
|
|
147
|
-
"resolved": "boolean | string",
|
|
157
|
+
"resolved": "boolean | string | undefined",
|
|
148
158
|
"references": {}
|
|
149
159
|
},
|
|
150
160
|
"required": false,
|
|
@@ -163,7 +173,7 @@ export class EzpStatus {
|
|
|
163
173
|
"mutable": false,
|
|
164
174
|
"complexType": {
|
|
165
175
|
"original": "string | boolean",
|
|
166
|
-
"resolved": "boolean | string",
|
|
176
|
+
"resolved": "boolean | string | undefined",
|
|
167
177
|
"references": {}
|
|
168
178
|
},
|
|
169
179
|
"required": false,
|
|
@@ -182,7 +192,7 @@ export class EzpStatus {
|
|
|
182
192
|
"mutable": false,
|
|
183
193
|
"complexType": {
|
|
184
194
|
"original": "string | boolean",
|
|
185
|
-
"resolved": "boolean | string",
|
|
195
|
+
"resolved": "boolean | string | undefined",
|
|
186
196
|
"references": {}
|
|
187
197
|
},
|
|
188
198
|
"required": false,
|
|
@@ -210,8 +220,8 @@ export class EzpStatus {
|
|
|
210
220
|
"text": "\nEvents"
|
|
211
221
|
},
|
|
212
222
|
"complexType": {
|
|
213
|
-
"original": "
|
|
214
|
-
"resolved": "
|
|
223
|
+
"original": "string",
|
|
224
|
+
"resolved": "string",
|
|
215
225
|
"references": {}
|
|
216
226
|
}
|
|
217
227
|
}, {
|
|
@@ -225,8 +235,8 @@ export class EzpStatus {
|
|
|
225
235
|
"text": ""
|
|
226
236
|
},
|
|
227
237
|
"complexType": {
|
|
228
|
-
"original": "
|
|
229
|
-
"resolved": "
|
|
238
|
+
"original": "string",
|
|
239
|
+
"resolved": "string",
|
|
230
240
|
"references": {}
|
|
231
241
|
}
|
|
232
242
|
}, {
|
|
@@ -240,8 +250,8 @@ export class EzpStatus {
|
|
|
240
250
|
"text": ""
|
|
241
251
|
},
|
|
242
252
|
"complexType": {
|
|
243
|
-
"original": "
|
|
244
|
-
"resolved": "
|
|
253
|
+
"original": "string",
|
|
254
|
+
"resolved": "string",
|
|
245
255
|
"references": {}
|
|
246
256
|
}
|
|
247
257
|
}];
|