@ezeep/ezeep-js 1.0.294 → 1.0.306
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/ezeep.cjs.js +1 -1
- package/dist/cjs/{ezp-auth_15.cjs.entry.js → ezp-auth_16.cjs.entry.js} +674 -110
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/ezp-file-name/ezp-file-name.css +98 -0
- package/dist/collection/components/ezp-file-name/ezp-file-name.js +411 -0
- package/dist/collection/components/ezp-icon/ezp-icon.js +1 -1
- package/dist/collection/components/ezp-icon-button/ezp-icon-button.js +1 -1
- package/dist/collection/components/ezp-input/ezp-input.js +1 -1
- package/dist/collection/components/ezp-label/ezp-label.js +39 -1
- package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.css +31 -3
- package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +243 -90
- package/dist/collection/components/ezp-printing/ezp-printing.js +20 -2
- package/dist/collection/components/ezp-select/ezp-select.js +1 -1
- package/dist/collection/components/ezp-status/ezp-status.js +2 -2
- package/dist/collection/components/ezp-stepper/ezp-stepper.js +1 -1
- package/dist/collection/components/ezp-text-button/ezp-text-button.js +1 -1
- package/dist/collection/components/ezp-upload/ezp-upload.css +26 -1
- package/dist/collection/components/ezp-upload/ezp-upload.js +14 -3
- package/dist/collection/components/ezp-user-menu/ezp-user-menu.js +1 -1
- package/dist/collection/shared/storage.js +39 -9
- package/dist/collection/types/shared/types.d.ts +2 -0
- package/dist/collection/utils/printer.js +75 -1
- package/dist/collection/utils/utils.js +29 -0
- package/dist/components/auth.js +1 -1
- package/dist/components/ezp-file-name.d.ts +11 -0
- package/dist/components/ezp-file-name.js +1 -0
- package/dist/components/ezp-file-name2.js +1 -0
- 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-label2.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-menu2.js +1 -1
- package/dist/components/utils.js +1 -1
- package/dist/directives/proxies.ts +38 -4
- package/dist/esm/ezeep.js +1 -1
- package/dist/esm/{ezp-auth_15.entry.js → ezp-auth_16.entry.js} +674 -111
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/ezeep.js +1 -1
- package/dist/esm-es5/{ezp-auth_15.entry.js → ezp-auth_16.entry.js} +2 -2
- package/dist/esm-es5/loader.js +1 -1
- package/dist/ezeep/ezeep.esm.js +1 -1
- package/dist/ezeep/p-646c1d42.entry.js +1 -0
- package/dist/ezeep/p-8e2d88a9.system.entry.js +7 -0
- package/dist/ezeep/p-DCznw2Ee.system.js +1 -1
- package/dist/ezeep/types/shared/types.d.ts +2 -0
- package/dist/types/components/ezp-file-name/ezp-file-name.d.ts +125 -0
- package/dist/types/components/ezp-label/ezp-label.d.ts +10 -0
- package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +48 -2
- package/dist/types/components/ezp-printing/ezp-printing.d.ts +9 -2
- package/dist/types/components/ezp-upload/ezp-upload.d.ts +4 -0
- package/dist/types/components.d.ts +82 -3
- package/dist/types/shared/storage.d.ts +18 -4
- package/dist/types/shared/types.d.ts +2 -0
- package/dist/types/utils/printer.d.ts +18 -0
- package/dist/types/utils/utils.d.ts +20 -1
- package/package.json +1 -1
- package/www/build/ezeep.esm.js +1 -1
- package/www/build/p-646c1d42.entry.js +1 -0
- package/www/build/p-70951744.js +1 -0
- package/www/build/p-8e2d88a9.system.entry.js +7 -0
- package/www/build/p-DCznw2Ee.system.js +1 -1
- package/www/index.html +1 -1
- package/dist/ezeep/p-3ab5a223.entry.js +0 -1
- package/dist/ezeep/p-fe700ca4.system.entry.js +0 -7
- package/www/build/p-3ab5a223.entry.js +0 -1
- package/www/build/p-65242d5e.js +0 -1
- package/www/build/p-fe700ca4.system.entry.js +0 -7
|
@@ -132,23 +132,51 @@
|
|
|
132
132
|
* Files card
|
|
133
133
|
*
|
|
134
134
|
*/
|
|
135
|
+
/* One row is as tall as the file name in it: `ezp-label`'s secondary line height. */
|
|
136
|
+
/* Room inside the scroller for a focused name's outline (2px offset + the ring),
|
|
137
|
+
which it would otherwise clip. Taken back out of the card's padding. */
|
|
135
138
|
#files-card {
|
|
136
139
|
background: var(--ezp-core-surface-secondary);
|
|
137
140
|
border-radius: 12px;
|
|
141
|
+
padding: var(--ezp-spacing-3) var(--ezp-spacing-4);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* Anchors the file names' tooltips, so they can span the row. It sits outside
|
|
145
|
+
the scrolling list on purpose: a scroll container clips the absolutely
|
|
146
|
+
positioned boxes anchored inside it, but not those anchored beyond it. The
|
|
147
|
+
names measure where their row is when the tooltip opens (`anchor="parent"`). */
|
|
148
|
+
#files {
|
|
149
|
+
position: relative;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Scrolls on its own, so a long selection doesn't make the dialog taller.
|
|
153
|
+
The card's padding stays outside it, and so do its corners. Half of a fifth
|
|
154
|
+
row shows at the bottom, which tells the list goes on. `max-height` rather
|
|
155
|
+
than `height`, so a short list looks the same as before. The inset padding
|
|
156
|
+
comes on top of `max-height` (content box), so it isn't counted in it. */
|
|
157
|
+
#files-list {
|
|
138
158
|
display: flex;
|
|
139
159
|
flex-direction: column;
|
|
140
160
|
gap: var(--ezp-spacing-2);
|
|
141
|
-
|
|
161
|
+
margin: calc(-1 * 4px);
|
|
162
|
+
max-height: var(--ezp-printerSelection-filesList-maxHeight, calc(4.5 * 20px + 4 * var(--ezp-spacing-2)));
|
|
163
|
+
/* Long names are truncated by `ezp-file-name`; nothing scrolls sideways. */
|
|
164
|
+
overflow-x: hidden;
|
|
165
|
+
overflow-y: auto;
|
|
166
|
+
padding: 4px;
|
|
167
|
+
scrollbar-width: thin;
|
|
142
168
|
}
|
|
143
169
|
|
|
144
170
|
.file-row {
|
|
145
171
|
align-items: center;
|
|
146
172
|
display: flex;
|
|
173
|
+
flex-shrink: 0;
|
|
147
174
|
gap: var(--ezp-spacing-3);
|
|
175
|
+
min-height: 20px;
|
|
148
176
|
min-width: 0;
|
|
149
177
|
}
|
|
150
|
-
.file-row ezp-
|
|
151
|
-
|
|
178
|
+
.file-row ezp-file-name {
|
|
179
|
+
flex: 0 1 auto;
|
|
152
180
|
}
|
|
153
181
|
|
|
154
182
|
.file-row-icon {
|
|
@@ -3,9 +3,9 @@ import i18next from "i18next";
|
|
|
3
3
|
import authStore from "../../services/auth";
|
|
4
4
|
import printStore, { EzpPrintService } from "../../services/print";
|
|
5
5
|
import userStore, { EzpUserService } from "../../services/user";
|
|
6
|
-
import { managePaperDimensions, poll, removeEmptyStrings, subscribeToLanguageChange } from "../../utils/utils";
|
|
7
|
-
import { PAPER_ID, validatePageRange, formatPageRange } from "../../utils/utils";
|
|
8
|
-
import {
|
|
6
|
+
import { managePaperDimensions, poll, removeEmptyStrings, subscribeToLanguageChange, } from "../../utils/utils";
|
|
7
|
+
import { PAPER_ID, firstVisibleChild, validatePageRange, formatPageRange, } from "../../utils/utils";
|
|
8
|
+
import { applySavedProperties, classifyJobStatus, hasTrays, hasNoTrays, pickRememberedProperties, } from "../../utils/printer";
|
|
9
9
|
import { uploadAndPrintFile } from "../../services/print-job";
|
|
10
10
|
import { storage } from "../../shared/storage";
|
|
11
11
|
import { HUB_DRIVER_ERROR_CODES, PRINT_REJECTED_CODE, FILE_EXPIRED_STATUS, POLL_INTERVAL_MS, MAX_POLL_ATTEMPTS, HUB_TIMEOUT_MS, } from "../../shared/constants";
|
|
@@ -56,6 +56,13 @@ export class EzpPrinterSelection {
|
|
|
56
56
|
this.hubDriverError = false;
|
|
57
57
|
this.userMenuOpen = false;
|
|
58
58
|
this.printStopped = false;
|
|
59
|
+
/** First row of the file list that is at least partly in view. Its tooltip
|
|
60
|
+
* opens downwards, as there is no list left above it to cover. */
|
|
61
|
+
this.firstVisibleFile = 0;
|
|
62
|
+
/** Starts empty so the dialog can still render if the list never arrives. */
|
|
63
|
+
this.printers = [];
|
|
64
|
+
/** Starts empty so the dialog renders even if the list never loads. */
|
|
65
|
+
this.selectedPrinter = { id: '', location: '', name: '', is_queue: false };
|
|
59
66
|
this.selectedPrinterConfig = {
|
|
60
67
|
Default: {
|
|
61
68
|
Color: '',
|
|
@@ -88,6 +95,8 @@ export class EzpPrinterSelection {
|
|
|
88
95
|
trayname: '',
|
|
89
96
|
PageRanges: '',
|
|
90
97
|
};
|
|
98
|
+
/** True while a printer's capabilities are being fetched. */
|
|
99
|
+
this.loadingPrinterConfig = false;
|
|
91
100
|
this.currentFileIndex = 0;
|
|
92
101
|
this.totalFiles = 0;
|
|
93
102
|
this.failedFiles = [];
|
|
@@ -104,7 +113,7 @@ export class EzpPrinterSelection {
|
|
|
104
113
|
this.successfulFiles = [];
|
|
105
114
|
this.partialSuccess = false;
|
|
106
115
|
this.hubDriverError = false;
|
|
107
|
-
this.
|
|
116
|
+
this.printDismiss.emit();
|
|
108
117
|
};
|
|
109
118
|
/** Poll `validate` callback: maps a job status to component state, returns `true` to stop polling. */
|
|
110
119
|
this.validateData = (data) => {
|
|
@@ -278,13 +287,18 @@ export class EzpPrinterSelection {
|
|
|
278
287
|
if (hubTimeout)
|
|
279
288
|
clearTimeout(hubTimeout);
|
|
280
289
|
}
|
|
281
|
-
|
|
282
|
-
storage.setPrinter(this.selectedPrinter);
|
|
290
|
+
this.rememberSelection();
|
|
283
291
|
this.printStopped = false;
|
|
284
292
|
};
|
|
285
293
|
this.handleUserMenu = () => {
|
|
286
294
|
this.userMenuOpen = true;
|
|
287
295
|
};
|
|
296
|
+
this.handleFilesScroll = (event) => {
|
|
297
|
+
const first = firstVisibleChild(event.currentTarget);
|
|
298
|
+
// Scroll fires every frame; only a change of row is worth a render.
|
|
299
|
+
if (first >= 0 && first !== this.firstVisibleFile)
|
|
300
|
+
this.firstVisibleFile = first;
|
|
301
|
+
};
|
|
288
302
|
this.validateFileType = async (name) => {
|
|
289
303
|
var _a;
|
|
290
304
|
const extension = (_a = name.split('.').pop()) !== null && _a !== void 0 ? _a : '';
|
|
@@ -372,24 +386,45 @@ export class EzpPrinterSelection {
|
|
|
372
386
|
break;
|
|
373
387
|
}
|
|
374
388
|
}
|
|
375
|
-
/** Print needs a printer, no job in flight and
|
|
389
|
+
/** Print needs a printer with its capabilities in hand, no job in flight and
|
|
390
|
+
* a valid page range. The config matters: between picking a printer and its
|
|
391
|
+
* properties arriving, the selection is set but the properties still hold
|
|
392
|
+
* blank defaults, and printing then saves those as that printer's settings. */
|
|
376
393
|
get printDisabled() {
|
|
377
|
-
return this.selectedPrinter.id === '' ||
|
|
394
|
+
return (this.selectedPrinter.id === '' ||
|
|
395
|
+
this.loadingPrinterConfig ||
|
|
396
|
+
this.printProcessing ||
|
|
397
|
+
this.pageRangeInvalid);
|
|
378
398
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
399
|
+
/** Keep this printer and its settings for the next print. Stored per printer,
|
|
400
|
+
* so each one keeps its own and no setting follows the user to a printer
|
|
401
|
+
* that cannot do it. */
|
|
402
|
+
rememberSelection() {
|
|
403
|
+
if (!this.selectedPrinter.id)
|
|
404
|
+
return;
|
|
405
|
+
storage.setPrinterSettings(this.selectedPrinter.id, pickRememberedProperties(this.selectedProperties));
|
|
406
|
+
storage.setPrinter(this.selectedPrinter);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Decide which printer the dialog opens on: the one last printed to, or the
|
|
410
|
+
* user's only printer when there is nothing to choose between. Its settings
|
|
411
|
+
* follow once its config is in, since they can only be validated against the
|
|
412
|
+
* printer's capabilities.
|
|
413
|
+
*/
|
|
414
|
+
selectInitialPrinter() {
|
|
415
|
+
var _a, _b;
|
|
384
416
|
const savedPrinter = storage.getPrinter();
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
417
|
+
const savedIsAvailable = (_a = this.printers) === null || _a === void 0 ? void 0 : _a.some((printer) => printer.id === (savedPrinter === null || savedPrinter === void 0 ? void 0 : savedPrinter.id));
|
|
418
|
+
// A printer the user no longer has must not stay preselected.
|
|
419
|
+
if (savedPrinter && !savedIsAvailable)
|
|
420
|
+
storage.clearSavedPrinter();
|
|
421
|
+
if (savedPrinter && savedIsAvailable) {
|
|
422
|
+
this.selectedPrinter = savedPrinter;
|
|
423
|
+
}
|
|
424
|
+
else if (((_b = this.printers) === null || _b === void 0 ? void 0 : _b.length) === 1) {
|
|
425
|
+
// Nothing to pick between: opening a dropdown with one entry in it is
|
|
426
|
+
// busywork, so start on it.
|
|
427
|
+
this.selectedPrinter = this.printers[0];
|
|
393
428
|
}
|
|
394
429
|
else {
|
|
395
430
|
this.selectedPrinter = { id: '', location: '', name: '', is_queue: false };
|
|
@@ -408,17 +443,22 @@ export class EzpPrinterSelection {
|
|
|
408
443
|
}
|
|
409
444
|
async setSelectedProperties(eventDetails) {
|
|
410
445
|
switch (eventDetails.type) {
|
|
411
|
-
case 'printer':
|
|
412
|
-
this.
|
|
413
|
-
this.selectedPrinter
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
.
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
446
|
+
case 'printer': {
|
|
447
|
+
const picked = this.printers.find((printer) => printer.id === eventDetails.id);
|
|
448
|
+
this.selectedPrinter = picked !== null && picked !== void 0 ? picked : {
|
|
449
|
+
id: eventDetails.id,
|
|
450
|
+
name: eventDetails.title,
|
|
451
|
+
location: '',
|
|
452
|
+
is_queue: eventDetails.is_queue,
|
|
453
|
+
};
|
|
454
|
+
// Same guard as the initial load. Without it a failed fetch left the
|
|
455
|
+
// printer selected while the config still described the *previous*
|
|
456
|
+
// one: Print stayed enabled, the job went out with settings nothing
|
|
457
|
+
// had checked against this printer, and those settings were then
|
|
458
|
+
// saved under its id and restored on later opens.
|
|
459
|
+
await this.loadSelectedPrinterConfig();
|
|
421
460
|
break;
|
|
461
|
+
}
|
|
422
462
|
case 'color':
|
|
423
463
|
this.selectedProperties.color =
|
|
424
464
|
eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
|
|
@@ -485,6 +525,55 @@ export class EzpPrinterSelection {
|
|
|
485
525
|
onJobId: (jobId) => (printStore.state.jobID = jobId),
|
|
486
526
|
});
|
|
487
527
|
}
|
|
528
|
+
/**
|
|
529
|
+
* What a dropdown should show: the current selection — restored from the last
|
|
530
|
+
* print, or just made by the user — and otherwise the printer's own default.
|
|
531
|
+
*
|
|
532
|
+
* The fallbacks matter because a config may describe its default only by name
|
|
533
|
+
* (`Default.Duplex`, `Default.Paper`, `Default.Tray`) without flagging the
|
|
534
|
+
* matching entry, which is all these dropdowns had to go on before settings
|
|
535
|
+
* were remembered.
|
|
536
|
+
*/
|
|
537
|
+
duplexPreSelection() {
|
|
538
|
+
var _a;
|
|
539
|
+
if (!this.selectedPrinter.id)
|
|
540
|
+
return null;
|
|
541
|
+
const mode = Number(this.selectedProperties.duplexmode);
|
|
542
|
+
if (mode)
|
|
543
|
+
return mode;
|
|
544
|
+
switch ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Duplex) {
|
|
545
|
+
case 'duplex_simplex':
|
|
546
|
+
return i18next.t('printer_selection.duplex_none');
|
|
547
|
+
case 'duplex_vertical':
|
|
548
|
+
return i18next.t('printer_selection.duplex_long');
|
|
549
|
+
case 'duplex_horizontal':
|
|
550
|
+
return i18next.t('printer_selection.duplex_short');
|
|
551
|
+
default:
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
paperPreSelection() {
|
|
556
|
+
var _a, _b;
|
|
557
|
+
if (!this.selectedPrinter.id)
|
|
558
|
+
return null;
|
|
559
|
+
if (this.selectedProperties.paper)
|
|
560
|
+
return this.selectedProperties.paper;
|
|
561
|
+
const name = (_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Paper;
|
|
562
|
+
return name && ((_b = this.selectedPrinterConfig.PaperFormats) === null || _b === void 0 ? void 0 : _b.some((el) => el.Name.includes(name)))
|
|
563
|
+
? name
|
|
564
|
+
: null;
|
|
565
|
+
}
|
|
566
|
+
trayPreSelection() {
|
|
567
|
+
var _a, _b;
|
|
568
|
+
if (!this.selectedPrinter.id)
|
|
569
|
+
return null;
|
|
570
|
+
if (this.selectedProperties.trayname)
|
|
571
|
+
return this.selectedProperties.trayname;
|
|
572
|
+
const name = (_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Tray;
|
|
573
|
+
return name && ((_b = this.selectedPrinterConfig.Trays) === null || _b === void 0 ? void 0 : _b.some((el) => el === null || el === void 0 ? void 0 : el.Name.includes(name)))
|
|
574
|
+
? name
|
|
575
|
+
: null;
|
|
576
|
+
}
|
|
488
577
|
setDefaultPaperFormat() {
|
|
489
578
|
var _a, _b, _c, _d, _e;
|
|
490
579
|
let format;
|
|
@@ -553,46 +642,105 @@ export class EzpPrinterSelection {
|
|
|
553
642
|
this.unsubscribeLanguage = subscribeToLanguageChange(this);
|
|
554
643
|
this.printService = new EzpPrintService(this.redirectURI, this.clientID);
|
|
555
644
|
this.printService.registerFetchInterceptor();
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
.
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
645
|
+
try {
|
|
646
|
+
// A missing display name must not stop the user from printing.
|
|
647
|
+
await this.getUserInfo().catch(() => undefined);
|
|
648
|
+
let printersLoaded = false;
|
|
649
|
+
try {
|
|
650
|
+
const printers = await this.printService.getPrinterList(authStore.state.accessToken);
|
|
651
|
+
// A failed request still resolves: the API answers with a `{code,
|
|
652
|
+
// message}` body, which would survive `?? []` and break on `.some`.
|
|
653
|
+
if (!Array.isArray(printers))
|
|
654
|
+
throw new Error('Unexpected printer list payload');
|
|
655
|
+
this.printers = printers;
|
|
656
|
+
printersLoaded = true;
|
|
657
|
+
}
|
|
658
|
+
catch (_a) {
|
|
659
|
+
this.printers = [];
|
|
660
|
+
}
|
|
661
|
+
if (!printersLoaded) {
|
|
662
|
+
// Nothing is known about this user's printers, so the saved printer is
|
|
663
|
+
// left untouched: treating it as gone would clear it from storage and
|
|
664
|
+
// lose the settings that are only reachable through it.
|
|
562
665
|
this.noPrinters = true;
|
|
563
666
|
}
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
this.
|
|
572
|
-
|
|
573
|
-
|
|
667
|
+
else {
|
|
668
|
+
if (this.printers.length === 0) {
|
|
669
|
+
this.noPrinters = true;
|
|
670
|
+
}
|
|
671
|
+
this.selectInitialPrinter();
|
|
672
|
+
// A printer carried over from a previous print, or the only one the
|
|
673
|
+
// user has, needs its config before its properties can be offered.
|
|
674
|
+
if (this.selectedPrinter.id != '') {
|
|
675
|
+
await this.loadSelectedPrinterConfig();
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
let supportedExtensionsLoaded = false;
|
|
679
|
+
try {
|
|
680
|
+
const response = await (await this.printService.getConfig(authStore.state.accessToken)).json();
|
|
681
|
+
printStore.state.supportedFileExtensions = response.System.FILEEXT;
|
|
682
|
+
supportedExtensionsLoaded = true;
|
|
683
|
+
}
|
|
684
|
+
catch (_b) {
|
|
685
|
+
// Handled below: without the list, nothing can be validated against it.
|
|
686
|
+
}
|
|
687
|
+
try {
|
|
688
|
+
await this.printService
|
|
689
|
+
.getAllPrinterProperties(authStore.state.accessToken)
|
|
690
|
+
.then((printerConfig) => {
|
|
691
|
+
this.printerConfig = printerConfig;
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
catch (_c) {
|
|
695
|
+
// Only used to describe other printers; the dialog works without it.
|
|
696
|
+
}
|
|
697
|
+
// Skipped when the list never arrived: every file would compare as
|
|
698
|
+
// unsupported and the user would be told their document cannot be
|
|
699
|
+
// printed when nothing is actually wrong with it.
|
|
700
|
+
if (supportedExtensionsLoaded && this.files && this.files.length > 0) {
|
|
701
|
+
// Validate all files
|
|
702
|
+
const validationPromises = this.files.map((file) => this.validateFileType(file.name));
|
|
703
|
+
const validationResults = await Promise.all(validationPromises);
|
|
704
|
+
const allValid = validationResults.every((valid) => valid);
|
|
705
|
+
this.notSupported = !allValid;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
finally {
|
|
709
|
+
// Whatever failed above, the dialog has to become usable: the loading
|
|
710
|
+
// status carries no close button, so throwing out of here would strand
|
|
711
|
+
// the user on "Loading My Printers…" with no way back.
|
|
712
|
+
this.loading = false;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Fetch the selected printer's capabilities and restore its saved settings.
|
|
717
|
+
*
|
|
718
|
+
* A failure drops the selection rather than keeping a printer the dialog
|
|
719
|
+
* cannot describe: the options would stay disabled while Print stayed
|
|
720
|
+
* enabled, so the job would go out with properties nothing has verified.
|
|
721
|
+
* With no selection the user picks from the list, which fetches again.
|
|
722
|
+
*/
|
|
723
|
+
async loadSelectedPrinterConfig() {
|
|
724
|
+
this.loadingPrinterConfig = true;
|
|
725
|
+
try {
|
|
726
|
+
const data = await this.printService.getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id);
|
|
727
|
+
// An empty list or an error body leaves nothing to configure from.
|
|
728
|
+
const config = data === null || data === void 0 ? void 0 : data[0];
|
|
729
|
+
if (!config)
|
|
730
|
+
throw new Error('No properties returned for the selected printer');
|
|
731
|
+
this.selectedPrinterConfig = config;
|
|
732
|
+
applySavedProperties(config, storage.getPrinterSettings(this.selectedPrinter.id), this.selectedProperties);
|
|
733
|
+
this.setPaperid();
|
|
574
734
|
if (this.selectedProperties.paper === '') {
|
|
575
735
|
this.setDefaultPaperFormat();
|
|
576
736
|
}
|
|
577
737
|
}
|
|
578
|
-
|
|
579
|
-
.
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
await this.printService
|
|
584
|
-
.getAllPrinterProperties(authStore.state.accessToken)
|
|
585
|
-
.then((printerConfig) => {
|
|
586
|
-
this.printerConfig = printerConfig;
|
|
587
|
-
});
|
|
588
|
-
if (this.files && this.files.length > 0) {
|
|
589
|
-
// Validate all files
|
|
590
|
-
const validationPromises = this.files.map((file) => this.validateFileType(file.name));
|
|
591
|
-
const validationResults = await Promise.all(validationPromises);
|
|
592
|
-
const allValid = validationResults.every((valid) => valid);
|
|
593
|
-
this.notSupported = !allValid;
|
|
738
|
+
catch (_a) {
|
|
739
|
+
this.selectedPrinter = { id: '', location: '', name: '', is_queue: false };
|
|
740
|
+
}
|
|
741
|
+
finally {
|
|
742
|
+
this.loadingPrinterConfig = false;
|
|
594
743
|
}
|
|
595
|
-
this.loading = false;
|
|
596
744
|
}
|
|
597
745
|
disconnectedCallback() {
|
|
598
746
|
var _a;
|
|
@@ -678,14 +826,14 @@ export class EzpPrinterSelection {
|
|
|
678
826
|
return null;
|
|
679
827
|
}
|
|
680
828
|
render() {
|
|
681
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k
|
|
829
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
682
830
|
const fileNames = this.files && this.files.length > 0
|
|
683
831
|
? this.files.map((file) => file.name)
|
|
684
832
|
: this.filename
|
|
685
833
|
? [this.filename]
|
|
686
834
|
: [];
|
|
687
835
|
const fileCount = fileNames.length;
|
|
688
|
-
return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } }, h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && this.renderStatus(), !this.hideheader && (h("div", { id: "header" }, h("div", { id: "title" }, h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') }), !this.notSupported && fileCount > 0 && (h("span", { id: "files-badge" }, i18next.t('printer_selection.file_count', { count: fileCount })))), h("div", { id: "header-actions" }, !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })), h("ezp-icon-button", { level: "tertiary", icon: "close", id: "close", type: "button", onClick: this.handleCancel })))), h("div", { id: "body" }, !this.notSupported && fileNames.length > 0 && (h("div", { id: "files-card" }, fileNames.map((name, index) => (h("div", { class: "file-row", key: index }, h("ezp-icon", { name: "file", class: "file-row-icon" }), h("ezp-
|
|
836
|
+
return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } }, h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && this.renderStatus(), !this.hideheader && (h("div", { id: "header" }, h("div", { id: "title" }, h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') }), !this.notSupported && fileCount > 0 && (h("span", { id: "files-badge" }, i18next.t('printer_selection.file_count', { count: fileCount })))), h("div", { id: "header-actions" }, !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })), h("ezp-icon-button", { level: "tertiary", icon: "close", id: "close", type: "button", onClick: this.handleCancel })))), h("div", { id: "body" }, !this.notSupported && fileNames.length > 0 && (h("div", { id: "files-card" }, h("div", { id: "files" }, h("div", { id: "files-list", onScroll: this.handleFilesScroll }, fileNames.map((name, index) => (h("div", { class: "file-row", key: index }, h("ezp-icon", { name: "file", class: "file-row-icon" }), h("ezp-file-name", { name: name, anchor: "parent", placement: index === this.firstVisibleFile ? 'bottom' : 'top' })))))))), h("ezp-label", { id: "printer-caption", level: "tertiary", weight: "heavy", text: i18next.t('printer_selection.printer') }), h("div", { id: "printer-card" }, h("ezp-select", { id: "printer", label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
|
|
689
837
|
? i18next.t('printer_selection.select_printer')
|
|
690
838
|
: i18next.t('printer_selection.no_printers'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
|
|
691
839
|
id: printer.id,
|
|
@@ -698,43 +846,34 @@ export class EzpPrinterSelection {
|
|
|
698
846
|
title: option.title,
|
|
699
847
|
meta: '',
|
|
700
848
|
type: 'color',
|
|
701
|
-
})), preSelected: this.selectedPrinter.id
|
|
702
|
-
?
|
|
703
|
-
|
|
849
|
+
})), preSelected: this.selectedPrinter.id
|
|
850
|
+
? this.selectedProperties.color
|
|
851
|
+
? i18next.t('printer_selection.color_color')
|
|
852
|
+
: i18next.t('printer_selection.color_grayscale')
|
|
853
|
+
: null, disabled: !this.selectedPrinterConfig.ColorSupported }), h("ezp-select", { label: i18next.t('printer_selection.duplex'), placeholder: i18next.t('printer_selection.select_duplex'), toggleFlow: "horizontal", options: (_b = this.duplexOptions) === null || _b === void 0 ? void 0 : _b.map((option) => ({
|
|
704
854
|
id: option.id,
|
|
705
855
|
title: option.title,
|
|
706
856
|
meta: '',
|
|
707
857
|
type: 'duplex',
|
|
708
|
-
})), preSelected: this.
|
|
709
|
-
((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == 'duplex_simplex'
|
|
710
|
-
? i18next.t('printer_selection.duplex_none')
|
|
711
|
-
: ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) == 'duplex_vertical'
|
|
712
|
-
? i18next.t('printer_selection.duplex_long')
|
|
713
|
-
: ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) == 'duplex_horizontal'
|
|
714
|
-
? i18next.t('printer_selection.duplex_short')
|
|
715
|
-
: null, disabled: !this.selectedPrinterConfig.DuplexSupported }), h("ezp-select", { label: i18next.t('printer_selection.size'), placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.PaperFormats &&
|
|
858
|
+
})), preSelected: this.duplexPreSelection(), disabled: !this.selectedPrinterConfig.DuplexSupported }), h("ezp-select", { label: i18next.t('printer_selection.size'), placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.PaperFormats &&
|
|
716
859
|
this.selectedPrinterConfig.PaperFormats.map((format) => ({
|
|
717
860
|
id: format.Id,
|
|
718
861
|
title: format.Name,
|
|
719
862
|
meta: `${format.XRes} x ${format.YRes}`,
|
|
720
863
|
type: 'format',
|
|
721
|
-
})), preSelected: this.
|
|
722
|
-
((_g = this.selectedPrinterConfig.PaperFormats) === null || _g === void 0 ? void 0 : _g.find((el) => { var _a; return el.Name.includes((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Paper); }))
|
|
723
|
-
? (_h = this.selectedPrinterConfig.Default) === null || _h === void 0 ? void 0 : _h.Paper
|
|
724
|
-
: null, disabled: !(((_k = (_j = this.selectedPrinterConfig.PaperFormats) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0) > 0) }), this.paperid == PAPER_ID ? (h(Fragment, null, h("ezp-input", { suffix: "mm", value: this.selectedProperties.paperwidth, eventType: "width", type: "number", label: i18next.t('printer_selection.width') }), h("ezp-input", { suffix: "mm", value: this.selectedProperties.paperlength, eventType: "length", type: "number", label: i18next.t('printer_selection.length') }))) : null, h("ezp-select", { label: i18next.t('printer_selection.orientation'), placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: (_l = this.selectedPrinterConfig.OrientationsSupported) === null || _l === void 0 ? void 0 : _l.map((orientation, index) => ({
|
|
864
|
+
})), preSelected: this.paperPreSelection(), disabled: !(((_d = (_c = this.selectedPrinterConfig.PaperFormats) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0) }), this.paperid == PAPER_ID ? (h(Fragment, null, h("ezp-input", { suffix: "mm", value: this.selectedProperties.paperwidth, eventType: "width", type: "number", label: i18next.t('printer_selection.width') }), h("ezp-input", { suffix: "mm", value: this.selectedProperties.paperlength, eventType: "length", type: "number", label: i18next.t('printer_selection.length') }))) : null, h("ezp-select", { label: i18next.t('printer_selection.orientation'), placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: (_e = this.selectedPrinterConfig.OrientationsSupported) === null || _e === void 0 ? void 0 : _e.map((orientation, index) => ({
|
|
725
865
|
id: index + 1,
|
|
726
866
|
title: i18next.t(`printer_selection.orientation_${orientation}`),
|
|
727
867
|
meta: '',
|
|
728
868
|
type: 'orientation',
|
|
729
|
-
})), preSelected: this.selectedPrinter.id ? this.selectedProperties.orientation : null, disabled: !(((
|
|
869
|
+
})), preSelected: this.selectedPrinter.id ? this.selectedProperties.orientation : null, disabled: !(((_g = (_f = this.selectedPrinterConfig.OrientationsSupported) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0) > 0) }), h("ezp-select", { label: i18next.t('printer_selection.quality'), placeholder: i18next.t('printer_selection.select_quality'), toggleFlow: "horizontal", options: (_h = this.selectedPrinterConfig.Resolutions) === null || _h === void 0 ? void 0 : _h.map((option, index) => ({
|
|
730
870
|
id: index,
|
|
731
871
|
title: option,
|
|
732
872
|
meta: '',
|
|
733
873
|
type: 'quality',
|
|
734
|
-
})), preSelected: this.selectedPrinter.id
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
: null, disabled: !(((_u = (_t = this.selectedPrinterConfig.Resolutions) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0) > 0) }), this.selectedPrinterConfig.Trays &&
|
|
874
|
+
})), preSelected: this.selectedPrinter.id
|
|
875
|
+
? this.selectedProperties.resolution || null
|
|
876
|
+
: null, disabled: !(((_k = (_j = this.selectedPrinterConfig.Resolutions) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0) > 0) }), this.selectedPrinterConfig.Trays &&
|
|
738
877
|
this.selectedPrinterConfig.Trays.length >= 1 &&
|
|
739
878
|
this.selectedPrinterConfig.Trays[0] != null ? (h("ezp-select", { label: i18next.t('printer_selection.trays'), placeholder: i18next.t('printer_selection.select_trays'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1
|
|
740
879
|
? this.selectedPrinterConfig.Trays.map((trays) => ({
|
|
@@ -743,10 +882,7 @@ export class EzpPrinterSelection {
|
|
|
743
882
|
meta: '',
|
|
744
883
|
type: 'tray',
|
|
745
884
|
}))
|
|
746
|
-
: undefined, preSelected: this.
|
|
747
|
-
((_v = this.selectedPrinterConfig.Trays) === null || _v === void 0 ? void 0 : _v.find((el) => { var _a; return el.Name.includes((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Tray); }))
|
|
748
|
-
? (_w = this.selectedPrinterConfig.Default) === null || _w === void 0 ? void 0 : _w.Tray
|
|
749
|
-
: null })) : null, h("ezp-input", { suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') }))), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), h("button", { id: "print", type: "button", disabled: this.printDisabled, onClick: this.handlePrint, ref: (button) => (this.printButton = button) }, h("ezp-icon", { name: "printer" }), h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') }))), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
|
|
885
|
+
: undefined, preSelected: this.trayPreSelection() })) : null, h("ezp-input", { suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') }))), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), h("button", { id: "print", type: "button", disabled: this.printDisabled, onClick: this.handlePrint, ref: (button) => (this.printButton = button) }, h("ezp-icon", { name: "printer" }), h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') }))), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
|
|
750
886
|
}
|
|
751
887
|
static get is() { return "ezp-printer-selection"; }
|
|
752
888
|
static get encapsulation() { return "shadow"; }
|
|
@@ -974,12 +1110,14 @@ export class EzpPrinterSelection {
|
|
|
974
1110
|
"hubDriverError": {},
|
|
975
1111
|
"userMenuOpen": {},
|
|
976
1112
|
"printStopped": {},
|
|
1113
|
+
"firstVisibleFile": {},
|
|
977
1114
|
"userName": {},
|
|
978
1115
|
"printers": {},
|
|
979
1116
|
"selectedPrinter": {},
|
|
980
1117
|
"printerConfig": {},
|
|
981
1118
|
"selectedPrinterConfig": {},
|
|
982
1119
|
"selectedProperties": {},
|
|
1120
|
+
"loadingPrinterConfig": {},
|
|
983
1121
|
"paperid": {},
|
|
984
1122
|
"currentFileIndex": {},
|
|
985
1123
|
"totalFiles": {},
|
|
@@ -1009,6 +1147,21 @@ export class EzpPrinterSelection {
|
|
|
1009
1147
|
}
|
|
1010
1148
|
}
|
|
1011
1149
|
}
|
|
1150
|
+
}, {
|
|
1151
|
+
"method": "printDismiss",
|
|
1152
|
+
"name": "printDismiss",
|
|
1153
|
+
"bubbles": true,
|
|
1154
|
+
"cancelable": true,
|
|
1155
|
+
"composed": true,
|
|
1156
|
+
"docs": {
|
|
1157
|
+
"tags": [],
|
|
1158
|
+
"text": "Cancel or close on this dialog: the user backs out of the print options\nonly. Unlike `printCancel`, it leaves the selected files alone, so the\nhost can return to the step they were chosen on."
|
|
1159
|
+
},
|
|
1160
|
+
"complexType": {
|
|
1161
|
+
"original": "void",
|
|
1162
|
+
"resolved": "void",
|
|
1163
|
+
"references": {}
|
|
1164
|
+
}
|
|
1012
1165
|
}, {
|
|
1013
1166
|
"method": "printSubmit",
|
|
1014
1167
|
"name": "printSubmit",
|
|
@@ -74,6 +74,18 @@ export class EzpPrinting {
|
|
|
74
74
|
document.dispatchEvent(printCancelEvent);
|
|
75
75
|
this.printFinished.emit();
|
|
76
76
|
}
|
|
77
|
+
/** Cancel or close on the print options card. With an upload step to go
|
|
78
|
+
* back to, only the card closes: the files picked there stay picked, and
|
|
79
|
+
* removing them is the upload card's "Clear files". Without one there is
|
|
80
|
+
* nothing left to show, so it ends the flow like `printCancel`. */
|
|
81
|
+
listenPrintDismiss() {
|
|
82
|
+
if (this.trigger === 'file') {
|
|
83
|
+
this.printOpen = false;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.listenPrintCancel();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
77
89
|
/** Description... */
|
|
78
90
|
listenPrintSubmit() {
|
|
79
91
|
this.printOpen = false;
|
|
@@ -341,7 +353,7 @@ export class EzpPrinting {
|
|
|
341
353
|
*
|
|
342
354
|
*/
|
|
343
355
|
render() {
|
|
344
|
-
return (h(Host, { key: '
|
|
356
|
+
return (h(Host, { key: '1b33fdafac04c08cdd11412202a537f66131caef', class: `${userStore.state.theme} ${userStore.state.appearance === 'system'
|
|
345
357
|
? this.systemAppearance
|
|
346
358
|
: 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));
|
|
347
359
|
}
|
|
@@ -769,7 +781,7 @@ export class EzpPrinting {
|
|
|
769
781
|
"composed": true,
|
|
770
782
|
"docs": {
|
|
771
783
|
"tags": [],
|
|
772
|
-
"text": "Fired when the print flow reaches an end state and the host may dismiss the\ncomponent: a print job was submitted, or the user cancelled on the upload\ncard, the sign-in dialog (with files pending) or the print options card.
|
|
784
|
+
"text": "Fired when the print flow reaches an end state and the host may dismiss the\ncomponent: a print job was submitted, or the user cancelled on the upload\ncard, the sign-in dialog (with files pending) or the print options card. A\ncancel on the print options card returns to the upload card when there is\none (`trigger=\"file\"`), so it doesn't end the flow there. It does not mean\na job was printed \u2014 check for that on the print API side."
|
|
773
785
|
},
|
|
774
786
|
"complexType": {
|
|
775
787
|
"original": "void",
|
|
@@ -910,6 +922,12 @@ export class EzpPrinting {
|
|
|
910
922
|
"target": undefined,
|
|
911
923
|
"capture": false,
|
|
912
924
|
"passive": false
|
|
925
|
+
}, {
|
|
926
|
+
"name": "printDismiss",
|
|
927
|
+
"method": "listenPrintDismiss",
|
|
928
|
+
"target": undefined,
|
|
929
|
+
"capture": false,
|
|
930
|
+
"passive": false
|
|
913
931
|
}, {
|
|
914
932
|
"name": "printSubmit",
|
|
915
933
|
"method": "listenPrintSubmit",
|
|
@@ -209,7 +209,7 @@ export class EzpSelect {
|
|
|
209
209
|
this.disabled ? 'disabled' : '',
|
|
210
210
|
];
|
|
211
211
|
const labelLevel = this.toggleFlow === 'horizontal' ? 'secondary' : 'tertiary';
|
|
212
|
-
return (h(Host, { key: '
|
|
212
|
+
return (h(Host, { key: '7dd328df209e8906917c97b8002bdcd9e2fafa0b', class: hostClasses.join(' ') }, h("div", { key: '522bbbfea1ef111af7bd7317cc6054138eca020d', id: "wrap" }, h("div", { key: 'd1c2c06a33f629d589e2247342467ebbd7283d1b', 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: 'c60d6dd802424b2502d1b9c9066732ef02909779', id: "label", noWrap: true, level: labelLevel, text: this.label }), h("ezp-label", { key: 'c92c91c848aec5b6ff386f32beb41bdaf4407613', 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: '7c653c97c7da8471e7db51c1ba04718842a9991b', id: "accessory", name: "expand" })), h("div", { key: '5c1aeeb45f4cbf1c4e26653312d6cc0a7e7084ce', 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
213
|
var _a, _b;
|
|
214
214
|
if (option.title !== '') {
|
|
215
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)));
|
|
@@ -46,9 +46,9 @@ export class EzpStatus {
|
|
|
46
46
|
return (
|
|
47
47
|
// Live region so screen readers announce status changes (loading,
|
|
48
48
|
// processing, success, error) as they render.
|
|
49
|
-
h(Host, { key: '
|
|
49
|
+
h(Host, { key: 'db32e5667bf9438a6d3d80807519ad2c158549ff', role: "status", "aria-live": "polite" }, h("div", { key: '815ecfbd3b272f206764ca852b8d865d7bc3cb8d', 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("div", { id: "icon" }, h("div", { id: "icon-inner" }, h("ezp-icon", { name: this.icon })))) : null, h("ezp-label", { key: '385d4fbbd7ed1b7a4aa2334d6d2145c2f5207508', id: "description", weight: "heavy", text: this.description }), this.subtext && (h("ezp-label", { key: 'c6a243dd4ddc428f3e34021430d6b935f0a9e1a6', id: "subtext", level: "secondary", text: this.subtext })), (this.cancel || this.close || this.retry) && (h("div", { key: '0dfc5f86b6366b3631ac74c15e9d467a884feb52', id: "footer" }, this.cancel && (h("ezp-text-button", { key: 'a89289163ac7d630d35e887deead462c6dc29af4', class: "action secondary", level: "secondary", onClick: this.handleCancel, label: typeof this.cancel === 'string'
|
|
50
50
|
? this.cancel
|
|
51
|
-
: 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: 'd2e3814f2a81ce03f4e0f4bbcf7cc734ade37aa9', class: `action ${this.retry ? 'secondary' : 'primary'}`, level: this.retry ? 'secondary' : 'primary', onClick: this.handleClose, label: typeof this.close === 'string' ? this.close : i18next.t('button_actions.close') })), this.retry && (h("ezp-text-button", { key: '6e53e77afc6c3954435b08c6daaa65dd829ce9ad', class: "action primary", level: "primary", onClick: this.handleRetry, label: typeof this.retry === 'string' ? this.retry : i18next.t('button_actions.retry') })))))));
|
|
52
52
|
}
|
|
53
53
|
static get is() { return "ezp-status"; }
|
|
54
54
|
static get encapsulation() { return "shadow"; }
|