@sbb-esta/lyne-elements-experimental 3.1.0 → 3.2.0
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/custom-elements.json +908 -567
- package/development/seat-reservation/common/mapper/icon-mapper.d.ts.map +1 -1
- package/development/seat-reservation/common/mapper/icon-mapper.js +1 -3
- package/development/seat-reservation/common/mapper/mapper.d.ts +4 -3
- package/development/seat-reservation/common/mapper/mapper.d.ts.map +1 -1
- package/development/seat-reservation/common/mapper/mapper.js +6 -4
- package/development/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts.map +1 -1
- package/development/seat-reservation/common/mapper/seat-reservation-sample-data.js +4989 -4
- package/development/seat-reservation/common/svgs.d.ts +0 -1
- package/development/seat-reservation/common/svgs.d.ts.map +1 -1
- package/development/seat-reservation/common/svgs.js +1 -3
- package/development/seat-reservation/common/translations/i18n.js +194 -194
- package/development/seat-reservation/common/types.d.ts +10 -0
- package/development/seat-reservation/common/types.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +38 -12
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +252 -122
- package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts +28 -13
- package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation/seat-reservation.component.js +481 -262
- package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +17 -10
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +1 -6
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +36 -18
- package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +3 -1
- package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +26 -4
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +86 -54
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts +1 -16
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +10 -164
- package/package.json +2 -2
- package/seat-reservation/common/mapper/icon-mapper.d.ts.map +1 -1
- package/seat-reservation/common/mapper/icon-mapper.js +0 -2
- package/seat-reservation/common/mapper/mapper.d.ts +4 -3
- package/seat-reservation/common/mapper/mapper.d.ts.map +1 -1
- package/seat-reservation/common/mapper/mapper.js +16 -14
- package/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts.map +1 -1
- package/seat-reservation/common/mapper/seat-reservation-sample-data.js +4988 -3
- package/seat-reservation/common/svgs.d.ts +0 -1
- package/seat-reservation/common/svgs.d.ts.map +1 -1
- package/seat-reservation/common/svgs.js +4 -11
- package/seat-reservation/common/translations/i18n.js +197 -197
- package/seat-reservation/common/types.d.ts +10 -0
- package/seat-reservation/common/types.d.ts.map +1 -1
- package/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +38 -12
- package/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -1
- package/seat-reservation/seat-reservation/seat-reservation-base-element.js +208 -134
- package/seat-reservation/seat-reservation/seat-reservation.component.d.ts +28 -13
- package/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
- package/seat-reservation/seat-reservation/seat-reservation.component.js +290 -298
- package/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +22 -22
- package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.d.ts.map +1 -1
- package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +0 -5
- package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +37 -37
- package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +3 -1
- package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -1
- package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +69 -58
- package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts.map +1 -1
- package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +28 -27
- package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts +1 -16
- package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -1
- package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +14 -101
|
@@ -1,36 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import { customElement as J, property as y } from "lit/decorators.js";
|
|
11
|
-
import { classMap as Y } from "lit/directives/class-map.js";
|
|
12
|
-
import { styleMap as Q } from "lit/directives/style-map.js";
|
|
13
|
-
import { getI18nSeatReservation as _ } from "../common.js";
|
|
14
|
-
import { SeatReservationBaseElement as Z } from "./seat-reservation-base-element.js";
|
|
1
|
+
import { __esDecorate as $, __runInitializers as x } from "tslib";
|
|
2
|
+
import { SbbLanguageController as A } from "@sbb-esta/lyne-elements/core/controllers.js";
|
|
3
|
+
import { css as S, isServer as y, html as b, nothing as v } from "lit";
|
|
4
|
+
import { customElement as R } from "lit/decorators.js";
|
|
5
|
+
import { classMap as k } from "lit/directives/class-map.js";
|
|
6
|
+
import { styleMap as g } from "lit/directives/style-map.js";
|
|
7
|
+
import { getI18nSeatReservation as n } from "../common.js";
|
|
8
|
+
import { SeatReservationBaseElement as E } from "./seat-reservation-base-element.js";
|
|
9
|
+
import "@sbb-esta/lyne-elements/button.js";
|
|
15
10
|
import "@sbb-esta/lyne-elements/screen-reader-only.js";
|
|
16
11
|
import "../seat-reservation-area.js";
|
|
17
12
|
import "../seat-reservation-graphic.js";
|
|
18
13
|
import "../seat-reservation-place-control.js";
|
|
19
14
|
import "../seat-reservation-navigation-coach.js";
|
|
20
15
|
import "../seat-reservation-scoped.js";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
import "@sbb-esta/lyne-elements/popover/popover.js";
|
|
17
|
+
const P = S`*,:before,:after{box-sizing:border-box}:host{--sbb-seat-reservation-grid-size: 16px;--sbb-seat-reservation-coach-height: 0;display:block;height:inherit}:host ::part(coach-floor){fill:var(--sbb-color-white)}@media (forced-colors: active){:host ::part(coach-floor){fill:transparent}}:host(:dir(rtl)) :not(.sbb-sr-place-ctrl--type-bicycle,.sbb-sr-place-ctrl--orientation-90,.sbb-sr-place-ctrl--orientation-270,.sbb-sr-place-ctrl--state-selected) ::part(coach-floor){rotate:180deg}[popover]:where(sbb-popover){margin:0;padding:0;border:none;width:auto;height:auto;background-color:transparent;color:inherit;pointer-events:none}.sbb-sr__container{display:flex;height:inherit}.sbb-sr__grid{display:grid;grid-template-columns:20% 1fr 20%;grid-template-rows:auto auto}.sbb-sr__grid .sbb-sr-navigation-first-grid,.sbb-sr__grid .sbb-sr-navigation-last-grid{grid-row-start:1;position:relative}.sbb-sr__grid .sbb-sr-navigation-first-grid{grid-column:1/2}.sbb-sr__grid .sbb-sr-navigation-last-grid{grid-column:3/4}.sbb-sr__grid .sbb-sr__component{display:flex;grid-column:1/4;grid-row:1/3}.sbb-sr__grid .sbb-sr-grid-inner{display:grid;grid-template-columns:20% 60% 20%;grid-template-rows:auto 1fr;grid-gap:0}.sbb-sr__grid .sbb-sr-grid-inner .nav-grid{grid-column:2/3;grid-row:1/2;display:inherit}.sbb-sr__grid .sbb-sr-grid-inner .coaches-grid{grid-column:1/4;grid-row:2/3;display:inherit}.sbb-sr__grid .sbb-sr-grid-inner .coaches-grid .sbb-sr__wrapper{overflow:hidden}.sbb-sr__navigation-control-button{position:absolute;z-index:10}.sbb-sr__navigation-control-button#first-tab-element{inset-inline-end:var(--sbb-spacing-fixed-2x)}.sbb-sr__navigation-control-button#last-tab-element{inset-inline-start:var(--sbb-spacing-fixed-2x)}.sbb-sr-navigation-wrapper{overflow:hidden;padding-block:0 var(--sbb-spacing-fixed-8x)}.sbb-sr-navigation{--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: var(--sbb-color-black-alpha-30);--sbb-scrollbar-color-hover: var(--sbb-color-black-alpha-60);--sbb-scrollbar-track-color: transparent;--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-sr-navigation::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr-navigation::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr-navigation::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-sr-navigation::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-sr-navigation::-webkit-scrollbar-button,.sbb-sr-navigation::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-sr-navigation{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-sr-navigation{--sbb-scrollbar-color: var(--sbb-color-white-alpha-0);display:flex;overflow:scroll hidden;position:relative}.sbb-sr-navigation__list-coaches{list-style:none;margin:0;padding:0;font-size:inherit;display:flex;flex-wrap:nowrap;gap:var(--sbb-spacing-fixed-1x);padding:.125rem}.sbb-sr__parent{--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: var(--sbb-color-black-alpha-30);--sbb-scrollbar-color-hover: var(--sbb-color-black-alpha-60);--sbb-scrollbar-track-color: transparent;--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-sr__parent::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr__parent::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr__parent::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-sr__parent::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-sr__parent::-webkit-scrollbar-button,.sbb-sr__parent::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-sr__parent{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-sr__parent{overflow-x:scroll;padding-block:var(--sbb-spacing-fixed-2x) var(--sbb-spacing-fixed-4x)}.sbb-sr__list-coaches{list-style:none;margin:0;padding:0;font-size:inherit;display:flex;gap:.25rem}.sbb-sr__item-coach{position:relative}.sbb-sr-popover{margin:0}.sbb-sr-coach-wrapper__table{outline:0}.sbb-sr.sbb-sr__grid--vertical{grid-template-columns:calc((var(--sbb-seat-reservation-coach-height) + 28) * var(--sbb-seat-reservation-one-px-rem)) 1fr;grid-template-rows:20% 60% 20%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-first-grid{grid-column:2/3;grid-row-start:1}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-first-grid #first-tab-element{position:absolute;inset-block-end:var(--sbb-spacing-fixed-4x);inset-inline-start:var(--sbb-spacing-fixed-8x);inset-inline-end:initial;rotate:90deg}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-last-grid{grid-column:2/3;grid-row:3/4}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-last-grid #last-tab-element{inset-block-start:var(--sbb-spacing-fixed-4x);inset-inline-start:var(--sbb-spacing-fixed-8x);rotate:90deg}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-wrapper{padding-block-end:initial;padding-inline-start:var(--sbb-spacing-fixed-8x)}.sbb-sr.sbb-sr__grid--vertical .sbb-sr__component{grid-column:1/3;grid-row:1/4}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner{grid-template-columns:calc((var(--sbb-seat-reservation-coach-height) + 28) * var(--sbb-seat-reservation-one-px-rem)) 1fr;grid-template-rows:20% 60% 20%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .nav-grid{grid-column:2/3;grid-row:2/3;height:100%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .nav-grid .sbb-sr-navigation{display:block;overflow:hidden scroll;height:100%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .nav-grid .sbb-sr-navigation .sbb-sr-navigation__list-coaches{flex-direction:column;padding:.125rem}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid{grid-column:1/2;grid-row:1/4;overflow:hidden;position:relative}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent{--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: var(--sbb-color-black-alpha-30);--sbb-scrollbar-color-hover: var(--sbb-color-black-alpha-60);--sbb-scrollbar-track-color: transparent;--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-button,.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent{overflow:hidden scroll;padding:0 var(--sbb-spacing-fixed-4x) 0 0;height:100%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent .sbb-sr__list-coaches{rotate:90deg;transform-origin:calc((var(--sbb-seat-reservation-coach-height) / 2 - 3) * var(--sbb-seat-reservation-one-px-rem)) calc((var(--sbb-seat-reservation-coach-height) / 2 - 3) * var(--sbb-seat-reservation-one-px-rem))}`;
|
|
18
|
+
let q = (() => {
|
|
19
|
+
var h;
|
|
20
|
+
let C = [R("sbb-seat-reservation")], u, m = [], d, f = E;
|
|
21
|
+
return h = class extends f {
|
|
26
22
|
constructor() {
|
|
27
|
-
super(...arguments)
|
|
28
|
-
x(this, g);
|
|
29
|
-
x(this, m);
|
|
30
|
-
x(this, f);
|
|
31
|
-
x(this, $);
|
|
32
|
-
x(this, C);
|
|
33
|
-
b(this, g, p(this, z, null)), b(this, m, (p(this, O), p(this, k, !0))), b(this, f, (p(this, D), p(this, I, !1))), b(this, $, (p(this, V), p(this, L, null))), b(this, C, (p(this, F), p(this, H, !1))), this._language = (p(this, W), new K(this)), this._notAreaElements = [
|
|
23
|
+
super(...arguments), this._language = new A(this), this._notAreaElements = [
|
|
34
24
|
"DRIVER_AREA_FULL",
|
|
35
25
|
"COACH_PASSAGE",
|
|
36
26
|
"COACH_WALL_NO_PASSAGE",
|
|
@@ -40,301 +30,309 @@ let me = (() => {
|
|
|
40
30
|
"COMPARTMENT_PASSAGE_LOW"
|
|
41
31
|
], this._notFixedRotatableAreaIcons = ["ENTRY_EXIT"];
|
|
42
32
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return R(this, g);
|
|
46
|
-
}
|
|
47
|
-
set seatReservation(e) {
|
|
48
|
-
b(this, g, e);
|
|
49
|
-
}
|
|
50
|
-
/** The seat reservation navigation can be toggled by this property */
|
|
51
|
-
get hasNavigation() {
|
|
52
|
-
return R(this, m);
|
|
53
|
-
}
|
|
54
|
-
set hasNavigation(e) {
|
|
55
|
-
b(this, m, e);
|
|
56
|
-
}
|
|
57
|
-
/** Controls the visual representation of seat reservation in a horizonal or vertical alignment */
|
|
58
|
-
get alignVertical() {
|
|
59
|
-
return R(this, f);
|
|
60
|
-
}
|
|
61
|
-
set alignVertical(e) {
|
|
62
|
-
b(this, f, e);
|
|
33
|
+
willUpdate(r) {
|
|
34
|
+
super.willUpdate(r), r.has("hasNavigation") && (this.hasNavigation ? this.shadowRoot?.querySelectorAll("table").forEach((s) => s.removeAttribute("tabindex")) : this.shadowRoot?.querySelectorAll("table").forEach((s) => s.setAttribute("tabindex", "0")));
|
|
63
35
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
set maxReservations(e) {
|
|
69
|
-
b(this, $, e);
|
|
70
|
-
}
|
|
71
|
-
/** Any click functionality is prevented */
|
|
72
|
-
get preventPlaceClick() {
|
|
73
|
-
return R(this, C);
|
|
74
|
-
}
|
|
75
|
-
set preventPlaceClick(e) {
|
|
76
|
-
b(this, C, e);
|
|
77
|
-
}
|
|
78
|
-
willUpdate(e) {
|
|
79
|
-
super.willUpdate(e), e.has("hasNavigation") && (this.hasNavigation ? this.shadowRoot?.querySelectorAll("table").forEach((t) => t.removeAttribute("tabindex")) : this.shadowRoot?.querySelectorAll("table").forEach((t) => t.setAttribute("tabindex", "0")));
|
|
80
|
-
}
|
|
81
|
-
firstUpdated(e) {
|
|
82
|
-
super.firstUpdated(e), this._componentSetup();
|
|
36
|
+
firstUpdated(r) {
|
|
37
|
+
super.firstUpdated(r), this.updateComplete.then(() => {
|
|
38
|
+
this.initNavigationSelectionByScrollEvent();
|
|
39
|
+
});
|
|
83
40
|
}
|
|
84
41
|
render() {
|
|
85
|
-
return this._initVehicleSeatReservationConstruction(), this._coachesHtmlTemplate || null;
|
|
42
|
+
return y || this._determineBaseFontSize(), this._initVehicleSeatReservationConstruction(), this._coachesHtmlTemplate || null;
|
|
86
43
|
}
|
|
87
|
-
|
|
88
|
-
|
|
44
|
+
_determineBaseFontSize() {
|
|
45
|
+
const s = 1 / parseInt(window.getComputedStyle(document.body).fontSize, 10);
|
|
46
|
+
this.style?.setProperty("--sbb-seat-reservation-one-px-rem", `${s + "rem"}`);
|
|
89
47
|
}
|
|
90
48
|
_initVehicleSeatReservationConstruction() {
|
|
91
|
-
const
|
|
92
|
-
this._coachesHtmlTemplate =
|
|
93
|
-
<div>
|
|
94
|
-
<sbb-
|
|
95
|
-
<
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
49
|
+
const r = JSON.parse(JSON.stringify(this.seatReservation?.coachItems)), s = this.alignVertical ? "sbb-sr__grid--vertical" : "";
|
|
50
|
+
this._coachesHtmlTemplate = b`
|
|
51
|
+
<div class="sbb-sr__container">
|
|
52
|
+
<div class="sbb-sr sbb-sr__grid ${s}">
|
|
53
|
+
<div class="sbb-sr-navigation-first-grid">
|
|
54
|
+
${this._renderNavigationControlButton("DIRECTION_LEFT")}
|
|
55
|
+
</div>
|
|
56
|
+
<div
|
|
57
|
+
class="sbb-sr__component"
|
|
58
|
+
@keydown=${(e) => this.handleKeyboardEvent(e)}
|
|
59
|
+
>
|
|
60
|
+
<div class="sbb-sr-grid-inner">
|
|
61
|
+
<div class="nav-grid">${this._renderNavigation()}</div>
|
|
62
|
+
<div class="coaches-grid">
|
|
63
|
+
<div class="sbb-sr__wrapper">
|
|
64
|
+
<div id="sbb-sr__parent-area" class="sbb-sr__parent" tabindex="-1">
|
|
65
|
+
<ul class="sbb-sr__list-coaches" role="presentation">
|
|
66
|
+
${this._renderCoaches(r)}
|
|
67
|
+
</ul>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
111
71
|
</div>
|
|
112
72
|
</div>
|
|
73
|
+
<div class="sbb-sr-navigation-last-grid">
|
|
74
|
+
${this._renderNavigationControlButton("DIRECTION_RIGHT")}
|
|
75
|
+
</div>
|
|
113
76
|
</div>
|
|
114
|
-
|
|
115
|
-
<sbb-screen-reader-only>
|
|
116
|
-
<input
|
|
117
|
-
id="last-tab-element"
|
|
118
|
-
role="contentinfo"
|
|
119
|
-
type="text"
|
|
120
|
-
aria-label="${_("SEAT_RESERVATION_END", this._language.current)}"
|
|
121
|
-
readonly
|
|
122
|
-
/>
|
|
123
|
-
</sbb-screen-reader-only>
|
|
124
77
|
</div>
|
|
125
78
|
`;
|
|
126
79
|
}
|
|
80
|
+
_renderNavigationControlButton(r) {
|
|
81
|
+
if (!this.hasNavigation)
|
|
82
|
+
return null;
|
|
83
|
+
const s = r == "DIRECTION_RIGHT" ? "last-tab-element" : "first-tab-element", e = r == "DIRECTION_RIGHT" ? "arrow-right-small" : "arrow-left-small", t = r == "DIRECTION_RIGHT" ? n("SEAT_RESERVATION_END", this._language.current) : n("SEAT_RESERVATION_BEGIN", this._language.current);
|
|
84
|
+
let i = !0;
|
|
85
|
+
return (r == "DIRECTION_LEFT" && this.selectedCoachIndex > 0 || r == "DIRECTION_RIGHT" && this.selectedCoachIndex < this.seatReservation.coachItems.length - 1) && (i = !1), b`<sbb-secondary-button
|
|
86
|
+
@click="${() => this.navigateByDirectionBtn(r)}"
|
|
87
|
+
id="${s}"
|
|
88
|
+
class="sbb-sr__navigation-control-button"
|
|
89
|
+
size="s"
|
|
90
|
+
icon-name="${e}"
|
|
91
|
+
type="button"
|
|
92
|
+
aria-label="${t}"
|
|
93
|
+
role="contentinfo"
|
|
94
|
+
.disabledInteractive="${i || v}"
|
|
95
|
+
></sbb-secondary-button>`;
|
|
96
|
+
}
|
|
127
97
|
_renderNavigation() {
|
|
128
|
-
return this.hasNavigation ?
|
|
129
|
-
<nav
|
|
98
|
+
return this.hasNavigation ? b`<div class="sbb-sr-navigation-wrapper">
|
|
99
|
+
<nav id="sbb-sr-navigation" class="sbb-sr-navigation">
|
|
130
100
|
<ul
|
|
101
|
+
id="sbb-sr__navigation-list-coaches"
|
|
131
102
|
class="sbb-sr-navigation__list-coaches"
|
|
132
|
-
aria-label="${
|
|
103
|
+
aria-label="${n("SEAT_RESERVATION_NAVIGATION", this._language.current)}"
|
|
133
104
|
>
|
|
134
|
-
${this.seatReservation?.coachItems.map((
|
|
105
|
+
${this.seatReservation?.coachItems.map((r, s) => {
|
|
106
|
+
const e = this.getAvailableFreePlacesNumFromCoach(s);
|
|
107
|
+
return b`<li>
|
|
135
108
|
<sbb-seat-reservation-navigation-coach
|
|
136
|
-
@selectcoach=${(
|
|
109
|
+
@selectcoach=${(t) => this._onSelectNavCoach(t)}
|
|
137
110
|
@focuscoach=${() => this._onFocusNavCoach()}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
.
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
111
|
+
class="${k({
|
|
112
|
+
"sbb-sr__navigation-coach--hover-scroll": this.hoveredScrollCoachIndex === s
|
|
113
|
+
})}"
|
|
114
|
+
index="${s}"
|
|
115
|
+
coach-id="${r.id}"
|
|
116
|
+
.freePlacesByType="${e}"
|
|
117
|
+
.selected=${this.selectedCoachIndex === s}
|
|
118
|
+
.focused=${this.focusedCoachIndex === s}
|
|
119
|
+
.propertyIds="${r.propertyIds}"
|
|
120
|
+
.travelClass="${r.travelClass}"
|
|
121
|
+
?driver-area="${!r.places?.length}"
|
|
122
|
+
?first="${s === 0}"
|
|
123
|
+
?last="${s === this.seatReservation?.coachItems.length - 1}"
|
|
147
124
|
?vertical="${this.alignVertical}"
|
|
148
125
|
>
|
|
149
126
|
</sbb-seat-reservation-navigation-coach>
|
|
150
|
-
</li
|
|
127
|
+
</li>`;
|
|
128
|
+
})}
|
|
151
129
|
</ul>
|
|
152
130
|
</nav>
|
|
153
|
-
|
|
131
|
+
</div>` : null;
|
|
154
132
|
}
|
|
155
133
|
/**
|
|
156
134
|
*
|
|
157
135
|
* @param coaches
|
|
158
136
|
* @returns
|
|
159
137
|
*/
|
|
160
|
-
_renderCoaches(
|
|
161
|
-
return
|
|
162
|
-
<li class="sbb-sr__item-coach">${this._renderCoachElement(
|
|
138
|
+
_renderCoaches(r) {
|
|
139
|
+
return r ? r.map((s, e) => b`
|
|
140
|
+
<li class="sbb-sr__item-coach">${this._renderCoachElement(s, e)}</li>
|
|
163
141
|
`) : null;
|
|
164
142
|
}
|
|
165
|
-
_renderCoachElement(
|
|
166
|
-
const
|
|
167
|
-
return
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
143
|
+
_renderCoachElement(r, s) {
|
|
144
|
+
const e = this.getCalculatedDimension(r.dimension), t = this._getDescriptionTableCoach(r, s);
|
|
145
|
+
return b`<sbb-seat-reservation-scoped
|
|
146
|
+
style=${g({
|
|
147
|
+
"--sbb-seat-reservation-scoped-width": e.w,
|
|
148
|
+
"--sbb-seat-reservation-scoped-height": e.h
|
|
149
|
+
})}
|
|
171
150
|
>
|
|
172
|
-
${this._getRenderedCoachBorders(
|
|
173
|
-
${this._getRenderedGraphicalElements(
|
|
174
|
-
${this._getRenderedServiceElements(
|
|
151
|
+
${this._getRenderedCoachBorders(r, s)}
|
|
152
|
+
${this._getRenderedGraphicalElements(r.graphicElements || [], r.dimension, s)}
|
|
153
|
+
${this._getRenderedServiceElements(s, r.serviceElements)}
|
|
154
|
+
|
|
175
155
|
<table
|
|
176
|
-
@focus=${() => this.onFocusTableCoachAndPreselectPlace(
|
|
177
|
-
id="sbb-sr-coach-${
|
|
156
|
+
@focus=${() => this.onFocusTableCoachAndPreselectPlace(s)}
|
|
157
|
+
id="sbb-sr-coach-${s}"
|
|
178
158
|
class="sbb-sr-coach-wrapper__table"
|
|
179
|
-
aria-describedby="sbb-sr-coach-caption-${
|
|
159
|
+
aria-describedby="sbb-sr-coach-caption-${s}"
|
|
180
160
|
>
|
|
181
|
-
<caption id="sbb-sr-coach-caption-${
|
|
182
|
-
<sbb-screen-reader-only>${
|
|
161
|
+
<caption id="sbb-sr-coach-caption-${s}" tabindex="-1">
|
|
162
|
+
<sbb-screen-reader-only>${t}</sbb-screen-reader-only>
|
|
183
163
|
</caption>
|
|
184
|
-
${this._getRenderedRowPlaces(
|
|
164
|
+
${this._getRenderedRowPlaces(r, s)}
|
|
185
165
|
</table>
|
|
186
166
|
</sbb-seat-reservation-scoped>`;
|
|
187
167
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
168
|
+
/**
|
|
169
|
+
* @returns Returns the border graphic (COACH_BORDER_MIDDLE) of a coach with calculated border gap and coach width,
|
|
170
|
+
* depending on whether the coach is with a driver area or without.
|
|
171
|
+
*/
|
|
172
|
+
_getRenderedCoachBorders(r, s) {
|
|
173
|
+
const i = r.graphicElements?.find((c) => c.icon === "DRIVER_AREA_FULL"), a = i ? r.dimension.w - i.dimension.w - 1 : r.dimension.w - 2, o = (r.dimension.h + this.coachBorderOffset * 2) * this.baseGridSize, l = s === 0 && i ? i?.dimension.w * this.baseGridSize : this.baseGridSize;
|
|
174
|
+
return b`
|
|
175
|
+
<sbb-seat-reservation-graphic
|
|
176
|
+
style=${g({
|
|
177
|
+
"--sbb-seat-reservation-graphic-width": a * this.baseGridSize,
|
|
178
|
+
"--sbb-seat-reservation-graphic-height": o,
|
|
179
|
+
"--sbb-seat-reservation-graphic-top": this.coachBorderPadding * -1,
|
|
180
|
+
"--sbb-seat-reservation-graphic-left": l,
|
|
181
|
+
"--sbb-seat-reservation-graphic-position": "absolute"
|
|
182
|
+
})}
|
|
183
|
+
name="COACH_BORDER_MIDDLE"
|
|
184
|
+
?stretch=${!0}
|
|
185
|
+
role="presentation"
|
|
186
|
+
></sbb-seat-reservation-graphic>
|
|
204
187
|
`;
|
|
205
188
|
}
|
|
206
|
-
_getRenderedRowPlaces(
|
|
207
|
-
if (!
|
|
189
|
+
_getRenderedRowPlaces(r, s) {
|
|
190
|
+
if (!r.places)
|
|
208
191
|
return null;
|
|
209
|
-
const
|
|
210
|
-
for (const
|
|
211
|
-
|
|
212
|
-
return Object.values(
|
|
213
|
-
<tr id="row-${
|
|
214
|
-
${this._getRenderedColumnPlaces(
|
|
192
|
+
const e = {};
|
|
193
|
+
for (const t of r.places)
|
|
194
|
+
e[t.position.y] ? e[t.position.y].push(t) : e[t.position.y] = [t];
|
|
195
|
+
return Object.values(e).map((t, i) => b`
|
|
196
|
+
<tr id="row-${s}-${t[0].position.y}" data-row-index=${i}>
|
|
197
|
+
${this._getRenderedColumnPlaces(t, s)}
|
|
215
198
|
</tr>
|
|
216
|
-
`).flatMap((
|
|
199
|
+
`).flatMap((t) => t);
|
|
217
200
|
}
|
|
218
|
-
_getRenderedColumnPlaces(
|
|
219
|
-
return
|
|
220
|
-
const
|
|
221
|
-
return
|
|
222
|
-
<
|
|
223
|
-
scoped-classes="graphical-element"
|
|
224
|
-
inset-block-start="${n.y}px"
|
|
225
|
-
inset-inline-start="${n.x}px"
|
|
226
|
-
width="${a.w}px"
|
|
227
|
-
height="${a.h}px"
|
|
228
|
-
z-index="${i.position.z}"
|
|
229
|
-
cell-id="cell-${t}-${i.position.y}-${s}"
|
|
230
|
-
>
|
|
201
|
+
_getRenderedColumnPlaces(r, s) {
|
|
202
|
+
return r.sort((e, t) => Number(e.position.x) - Number(t.position.x)), r?.map((e, t) => {
|
|
203
|
+
const i = this.getCalculatedDimension(e.dimension), a = this.getCalculatedPosition(e.position), o = this.alignVertical ? -90 : 0;
|
|
204
|
+
return b`
|
|
205
|
+
<td id="cell-${s}-${e.position.y}-${t}" class="graphical-element">
|
|
231
206
|
<sbb-seat-reservation-place-control
|
|
232
|
-
|
|
207
|
+
style=${g({
|
|
208
|
+
"--sbb-seat-reservation-place-control-width": i.w,
|
|
209
|
+
"--sbb-seat-reservation-place-control-height": i.h,
|
|
210
|
+
"--sbb-seat-reservation-place-control-top": a.y,
|
|
211
|
+
"--sbb-seat-reservation-place-control-left": a.x
|
|
212
|
+
})}
|
|
213
|
+
@selectplace=${(l) => this._onSelectPlace(l)}
|
|
233
214
|
exportparts="sbb-sr-place-part"
|
|
234
|
-
id="seat-reservation__place-button-${
|
|
215
|
+
id="seat-reservation__place-button-${s}-${e.number}"
|
|
235
216
|
class="seat-reservation-place-control"
|
|
236
|
-
data-cell-id="${
|
|
237
|
-
text=${
|
|
238
|
-
type=${
|
|
239
|
-
state=${
|
|
240
|
-
width=${
|
|
241
|
-
height=${
|
|
242
|
-
rotation=${
|
|
243
|
-
text-rotation=${
|
|
244
|
-
coach-index=${
|
|
245
|
-
.propertyIds=${
|
|
217
|
+
data-cell-id="${s}-${e.position.y}-${t}"
|
|
218
|
+
text=${e.number}
|
|
219
|
+
type=${e.type}
|
|
220
|
+
state=${e.state}
|
|
221
|
+
width=${e.dimension.w * this.baseGridSize}
|
|
222
|
+
height=${e.dimension.h * this.baseGridSize}
|
|
223
|
+
rotation=${e.rotation ?? v}
|
|
224
|
+
text-rotation=${o}
|
|
225
|
+
coach-index=${s}
|
|
226
|
+
.propertyIds=${e.propertyIds}
|
|
246
227
|
.preventClick=${this.preventPlaceClick}
|
|
247
228
|
></sbb-seat-reservation-place-control>
|
|
248
|
-
</
|
|
229
|
+
</td>
|
|
249
230
|
`;
|
|
250
231
|
});
|
|
251
232
|
}
|
|
252
|
-
_getRenderedGraphicalElements(
|
|
253
|
-
return
|
|
254
|
-
const
|
|
255
|
-
return this._notAreaElements.findIndex((
|
|
233
|
+
_getRenderedGraphicalElements(r, s, e) {
|
|
234
|
+
return r ? r?.map((t) => {
|
|
235
|
+
const i = t.icon ?? "", a = t.rotation || 0, o = this._notFixedRotatableAreaIcons.indexOf(t.icon) === -1, l = this.alignVertical && o ? a - 90 : a;
|
|
236
|
+
return this._notAreaElements.findIndex((c) => c === i) > -1 ? this._getRenderElementWithoutArea(t, a, s) : this._getRenderElementWithArea(t, l, s, e);
|
|
256
237
|
}) : null;
|
|
257
238
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
239
|
+
/**
|
|
240
|
+
* creates a rendered element with an area component
|
|
241
|
+
* @param graphicalElement
|
|
242
|
+
* @param rotation
|
|
243
|
+
* @param coachDimension
|
|
244
|
+
* @param coachIndex used to generate a unique id for the popover trigger
|
|
245
|
+
* @private
|
|
246
|
+
*/
|
|
247
|
+
_getRenderElementWithArea(r, s, e, t) {
|
|
248
|
+
const i = r.icon?.indexOf("TABLE") === -1, a = r.icon && i ? r.icon : null, o = a !== "ENTRY_EXIT", l = r.icon ? n(r.icon, this._language.current) : v, c = this.getCalculatedDimension(r.dimension, e, !0, o), p = this.getCalculatedPosition(r.position, r.dimension, e, !0), w = `popover-trigger-${t}-${p.x}-${p.y}`;
|
|
249
|
+
let _ = "free";
|
|
250
|
+
return r.position.y === this.coachBorderOffset * -1 ? _ = "upper-border" : r.position.y + r.dimension.h === e.h + this.coachBorderOffset && (_ = "lower-border"), b`
|
|
251
|
+
<sbb-seat-reservation-area
|
|
252
|
+
id="${w}"
|
|
253
|
+
style=${g({
|
|
254
|
+
"--sbb-seat-reservation-area-width": c.w,
|
|
255
|
+
"--sbb-seat-reservation-area-height": c.h,
|
|
256
|
+
"--sbb-seat-reservation-area-top": p.y,
|
|
257
|
+
"--sbb-seat-reservation-area-left": p.x
|
|
258
|
+
})}
|
|
259
|
+
mounting=${_}
|
|
260
|
+
background="dark"
|
|
261
|
+
aria-hidden="true"
|
|
269
262
|
>
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
"--sbb-reservation-
|
|
263
|
+
${a ? b`
|
|
264
|
+
<sbb-seat-reservation-graphic
|
|
265
|
+
style=${g({
|
|
266
|
+
"--sbb-seat-reservation--cursor-pointer": "pointer"
|
|
274
267
|
})}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
height=${this.baseGridSize}
|
|
286
|
-
role="img"
|
|
287
|
-
aria-hidden="true"
|
|
288
|
-
></sbb-seat-reservation-graphic>
|
|
289
|
-
` : A}
|
|
290
|
-
</sbb-seat-reservation-area>
|
|
291
|
-
</sbb-seat-reservation-scoped>
|
|
268
|
+
name=${a}
|
|
269
|
+
width=${this.baseGridSize}
|
|
270
|
+
height=${this.baseGridSize}
|
|
271
|
+
rotation=${s}
|
|
272
|
+
role="img"
|
|
273
|
+
aria-hidden="true"
|
|
274
|
+
></sbb-seat-reservation-graphic>
|
|
275
|
+
` : v}
|
|
276
|
+
</sbb-seat-reservation-area>
|
|
277
|
+
${this._popover(w, l)}
|
|
292
278
|
`;
|
|
293
279
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
>
|
|
280
|
+
/**
|
|
281
|
+
* Creates a popover for extra service information
|
|
282
|
+
* @param triggerId
|
|
283
|
+
* @param popoverContent
|
|
284
|
+
* @private
|
|
285
|
+
*/
|
|
286
|
+
_popover(r, s) {
|
|
287
|
+
return b`
|
|
288
|
+
<sbb-popover trigger="${r}">
|
|
289
|
+
<p class="sbb-text-s sbb-sr-popover">${s}</p>
|
|
290
|
+
</sbb-popover>
|
|
291
|
+
`;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* trigger to close all opened popovers (normally only one is opened at a time)
|
|
295
|
+
* @private
|
|
296
|
+
*/
|
|
297
|
+
_closePopover() {
|
|
298
|
+
this.shadowRoot?.querySelectorAll('sbb-popover[data-state="opened"]').forEach((r) => r.setAttribute("data-state", "closed"));
|
|
299
|
+
}
|
|
300
|
+
_getRenderElementWithoutArea(r, s, e) {
|
|
301
|
+
const t = this.getCalculatedDimension(r.dimension, e), i = this.getCalculatedPosition(r.position, r.dimension, e), a = r.icon && r.icon.indexOf("DRIVER_AREA") === -1 ? r.icon : r.icon?.concat("_", this.seatReservation.vehicleType);
|
|
302
|
+
return b` <sbb-seat-reservation-graphic
|
|
303
|
+
style=${g({
|
|
304
|
+
"--sbb-seat-reservation-graphic-width": t.w,
|
|
305
|
+
"--sbb-seat-reservation-graphic-height": t.h,
|
|
306
|
+
"--sbb-seat-reservation-graphic-top": i.y,
|
|
307
|
+
"--sbb-seat-reservation-graphic-left": i.x,
|
|
308
|
+
"--sbb-seat-reservation-graphic-position": "absolute"
|
|
309
|
+
})}
|
|
310
|
+
name=${a ?? v}
|
|
311
|
+
rotation=${s}
|
|
312
|
+
aria-hidden="true"
|
|
313
|
+
?stretch=${!0}
|
|
314
|
+
></sbb-seat-reservation-graphic>`;
|
|
315
|
+
}
|
|
316
|
+
_getRenderedServiceElements(r, s) {
|
|
317
|
+
return s ? s?.map((e) => {
|
|
318
|
+
const t = e.icon ? n(e.icon, this._language.current) : null, i = this.getCalculatedDimension(e.dimension), a = this.getCalculatedPosition(e.position), o = e.rotation || 0, l = this.alignVertical ? o - 90 : o, c = `popover-trigger-${r}-${a.x}-${a.y}`;
|
|
319
|
+
return b`
|
|
305
320
|
<sbb-seat-reservation-graphic
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
321
|
+
id="${c}"
|
|
322
|
+
style=${g({
|
|
323
|
+
"--sbb-seat-reservation-graphic-width": i.w,
|
|
324
|
+
"--sbb-seat-reservation-graphic-height": i.h,
|
|
325
|
+
"--sbb-seat-reservation-graphic-top": a.y,
|
|
326
|
+
"--sbb-seat-reservation-graphic-left": a.x,
|
|
327
|
+
"--sbb-seat-reservation-graphic-position": "absolute",
|
|
328
|
+
"--sbb-seat-reservation--cursor-pointer": "pointer"
|
|
329
|
+
})}
|
|
330
|
+
name=${e.icon ?? v}
|
|
331
|
+
.rotation=${l}
|
|
332
|
+
role="img"
|
|
310
333
|
aria-hidden="true"
|
|
311
|
-
?stretch=${!0}
|
|
312
334
|
></sbb-seat-reservation-graphic>
|
|
313
|
-
|
|
314
|
-
`;
|
|
315
|
-
}
|
|
316
|
-
_getRenderedServiceElements(e) {
|
|
317
|
-
return e ? e?.map((t) => {
|
|
318
|
-
const i = t.icon ? _(t.icon, this._language.current) : null, s = this.getCalculatedDimension(t.dimension), a = this.getCalculatedPosition(t.position), n = t.rotation || 0, h = this.alignVertical ? n - 90 : n;
|
|
319
|
-
return d`
|
|
320
|
-
<sbb-seat-reservation-scoped
|
|
321
|
-
scoped-classes="graphical-element"
|
|
322
|
-
inset-block-start="${a.y}px"
|
|
323
|
-
inset-inline-start="${a.x}px"
|
|
324
|
-
width="${s.w}px"
|
|
325
|
-
height="${s.h}px"
|
|
326
|
-
z-index="${t.position.z}"
|
|
327
|
-
>
|
|
328
|
-
<sbb-seat-reservation-graphic
|
|
329
|
-
name=${t.icon ?? A}
|
|
330
|
-
width=${t.dimension.w * this.baseGridSize}
|
|
331
|
-
height=${t.dimension.h * this.baseGridSize}
|
|
332
|
-
.rotation=${h}
|
|
333
|
-
role="img"
|
|
334
|
-
aria-hidden="true"
|
|
335
|
-
title=${i ?? A}
|
|
336
|
-
></sbb-seat-reservation-graphic>
|
|
337
|
-
</sbb-seat-reservation-scoped>
|
|
335
|
+
${this._popover(c, t)}
|
|
338
336
|
`;
|
|
339
337
|
}) : null;
|
|
340
338
|
}
|
|
@@ -343,53 +341,47 @@ let me = (() => {
|
|
|
343
341
|
* Each selection emits an array of all selected places
|
|
344
342
|
* @param selectPlaceEvent
|
|
345
343
|
*/
|
|
346
|
-
_onSelectPlace(
|
|
347
|
-
const
|
|
348
|
-
this.preventCoachScrollByPlaceClick = !0, this.isCoachGridFocusable = !1, this.preventPlaceClick || (this.updateSelectedSeatReservationPlaces(
|
|
344
|
+
_onSelectPlace(r) {
|
|
345
|
+
const s = r.detail;
|
|
346
|
+
this.preventCoachScrollByPlaceClick = !0, this.isCoachGridFocusable = !1, this.preventPlaceClick || (this.updateSelectedSeatReservationPlaces(s), this.updateCurrentSelectedPlaceInCoach(s));
|
|
349
347
|
}
|
|
350
|
-
_onSelectNavCoach(
|
|
351
|
-
const
|
|
352
|
-
this.isKeyboardNavigation = !1,
|
|
348
|
+
_onSelectNavCoach(r) {
|
|
349
|
+
const s = r.detail;
|
|
350
|
+
this.isKeyboardNavigation = !1, s !== null && s !== this.currSelectedCoachIndex ? (this.unfocusPlaceElement(), this.scrollToSelectedNavCoach(s)) : s === this.currSelectedCoachIndex && (this.updateCurrentSelectedCoach(), this.preselectPlaceInCoach()), this._closePopover();
|
|
353
351
|
}
|
|
354
352
|
_onFocusNavCoach() {
|
|
355
353
|
this.preventCoachScrollByPlaceClick ? this.focusPlaceElement(this.currSelectedPlace) : this.preselectPlaceInCoach(), this.isAutoScrolling = !1;
|
|
356
354
|
}
|
|
357
|
-
_getDescriptionTableCoach(
|
|
358
|
-
if (!
|
|
359
|
-
return
|
|
360
|
-
|
|
355
|
+
_getDescriptionTableCoach(r, s) {
|
|
356
|
+
if (!r.places?.length)
|
|
357
|
+
return n("COACH_BLOCKED_TABLE_CAPTION", this._language.current, [
|
|
358
|
+
r.id
|
|
361
359
|
]);
|
|
362
|
-
let
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
]),
|
|
360
|
+
let e;
|
|
361
|
+
const t = this._getTitleDescriptionListString(r.graphicElements), i = this._getTitleDescriptionListString(r.serviceElements);
|
|
362
|
+
if (e = n("COACH_TABLE_CAPTION", this._language.current, [
|
|
363
|
+
r.id
|
|
364
|
+
]), !this.hasNavigation) {
|
|
365
|
+
const a = this.getAvailableFreePlacesNumFromCoach(s), o = n("COACH_AVAILABLE_NUMBER_OF_PLACES", this._language.current, [a.seats, a.bicycles]);
|
|
366
|
+
e = e.concat(". ").concat(o).concat(". ");
|
|
367
|
+
}
|
|
368
|
+
return (t || i) && (e += ". " + n("COACH_AVAILABLE_SERVICES", this._language.current) + ": ", e += i + ", " + t + "."), e;
|
|
367
369
|
}
|
|
368
|
-
_getTitleDescriptionListString(
|
|
369
|
-
const
|
|
370
|
-
return
|
|
371
|
-
const
|
|
372
|
-
if (!
|
|
370
|
+
_getTitleDescriptionListString(r) {
|
|
371
|
+
const s = [];
|
|
372
|
+
return r?.map((e) => {
|
|
373
|
+
const t = e.icon;
|
|
374
|
+
if (!t)
|
|
373
375
|
return null;
|
|
374
|
-
const
|
|
375
|
-
return
|
|
376
|
-
}).filter((
|
|
376
|
+
const i = s.indexOf(t) > -1, a = n(e.icon, this._language.current), o = this._notFixedRotatableAreaIcons.indexOf(t) === -1 && this._notAreaElements.indexOf(t) === -1;
|
|
377
|
+
return i || s.push(e.icon), a && !i && o ? a : null;
|
|
378
|
+
}).filter((e) => !!e).join(", ");
|
|
377
379
|
}
|
|
378
|
-
},
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
} }, metadata: e }, z, O), S(c, null, E, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, i) => {
|
|
383
|
-
t.hasNavigation = i;
|
|
384
|
-
} }, metadata: e }, k, D), S(c, null, G, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, i) => {
|
|
385
|
-
t.alignVertical = i;
|
|
386
|
-
} }, metadata: e }, I, V), S(c, null, B, { kind: "accessor", name: "maxReservations", static: !1, private: !1, access: { has: (t) => "maxReservations" in t, get: (t) => t.maxReservations, set: (t, i) => {
|
|
387
|
-
t.maxReservations = i;
|
|
388
|
-
} }, metadata: e }, L, F), S(c, null, M, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, i) => {
|
|
389
|
-
t.preventPlaceClick = i;
|
|
390
|
-
} }, metadata: e }, H, W), S(null, o = { value: u }, r, { kind: "class", name: u.name, metadata: e }, null, l), u = o.value, e && Object.defineProperty(u, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
391
|
-
})(), c.styles = ee, p(u, l), u;
|
|
380
|
+
}, d = h, (() => {
|
|
381
|
+
const r = typeof Symbol == "function" && Symbol.metadata ? Object.create(f[Symbol.metadata] ?? null) : void 0;
|
|
382
|
+
$(null, u = { value: d }, C, { kind: "class", name: d.name, metadata: r }, null, m), d = u.value, r && Object.defineProperty(d, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r });
|
|
383
|
+
})(), h.styles = P, x(d, m), d;
|
|
392
384
|
})();
|
|
393
385
|
export {
|
|
394
|
-
|
|
386
|
+
q as SbbSeatReservationElement
|
|
395
387
|
};
|