@sbb-esta/lyne-elements-experimental 4.6.0 → 4.7.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/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.js +6 -6
- package/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +12 -12
- package/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +11 -11
- package/core/styles/core.scss +13 -0
- package/core/styles/lean-theme.scss +3 -0
- package/core/styles/off-brand-theme.scss +3 -0
- package/core/styles/safety-theme.scss +3 -0
- package/core/styles/standard-theme.scss +3 -0
- package/core/styles/theme.scss +5 -0
- package/core.css +13 -0
- package/custom-elements.json +404 -209
- package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.js +3 -2
- package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +2 -15
- package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +2 -14
- package/development/pearl-chain/pearl-chain.component.js +9 -8
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +9 -8
- package/development/seat-reservation/common/mapper/icon-mapper.d.ts.map +1 -1
- package/development/seat-reservation/common/mapper/icon-mapper.js +2 -1
- package/development/seat-reservation/common/mapper/mapper.js +6 -4
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-bus.d.ts +69 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-bus.d.ts.map +1 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-bus.js +559 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-decks.d.ts +123 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-decks.d.ts.map +1 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-decks.js +972 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-giruno.d.ts +114 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-giruno.d.ts.map +1 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-giruno.js +20368 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-others.d.ts +85 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-others.d.ts.map +1 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-others.js +1739 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-train.d.ts +69 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-train.d.ts.map +1 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-train.js +9783 -0
- package/development/seat-reservation/common/svgs.js +7 -7
- package/development/seat-reservation/common/translations/i18n.d.ts.map +1 -1
- package/development/seat-reservation/common/translations/i18n.js +32 -1
- package/development/seat-reservation/common/types.d.ts +8 -3
- package/development/seat-reservation/common/types.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +13 -3
- 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 +68 -15
- package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts +1 -0
- package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation/seat-reservation.component.js +64 -29
- package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +4 -15
- 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 +75 -155
- package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts +2 -0
- package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +21 -5
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts +7 -1
- 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 +154 -9
- package/off-brand-theme.css +13 -0
- package/package.json +18 -2
- package/pearl-chain/pearl-chain.component.js +1 -1
- package/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +15 -15
- package/safety-theme.css +13 -0
- package/seat-reservation/common/mapper/icon-mapper.js +1 -0
- package/seat-reservation/common/mapper/mapper.js +25 -23
- package/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-bus.js +558 -0
- package/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-decks.js +970 -0
- package/seat-reservation/common/mapper/{seat-reservation-sample-data.js → sample-data/seat-reservation-sample-data-giruno.js} +3 -11304
- package/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-others.js +1738 -0
- package/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-train.js +9782 -0
- package/seat-reservation/common/svgs.js +51 -51
- package/seat-reservation/common/translations/i18n.js +31 -0
- package/seat-reservation/seat-reservation/seat-reservation-base-element.js +128 -88
- package/seat-reservation/seat-reservation/seat-reservation.component.js +137 -125
- package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +141 -186
- package/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +54 -44
- package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +106 -71
- package/standard-theme.css +13 -0
- package/development/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts +0 -372
- package/development/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts.map +0 -1
- package/development/seat-reservation/common/mapper/seat-reservation-sample-data.js +0 -31673
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var ye = (h) => {
|
|
2
|
+
throw TypeError(h);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __esDecorate as
|
|
7
|
-
import { isArrowKeyOrPageKeysPressed as
|
|
4
|
+
var be = (h, d, f) => d.has(h) || ye("Cannot " + f);
|
|
5
|
+
var u = (h, d, f) => (be(h, d, "read from private field"), f ? f.call(h) : d.get(h)), g = (h, d, f) => d.has(h) ? ye("Cannot add the same private member more than once") : d instanceof WeakSet ? d.add(h) : d.set(h, f), r = (h, d, f, B) => (be(h, d, "write to private field"), B ? B.call(h, f) : d.set(h, f), f);
|
|
6
|
+
import { __esDecorate as v, __runInitializers as n } from "tslib";
|
|
7
|
+
import { isArrowKeyOrPageKeysPressed as Pe } from "@sbb-esta/lyne-elements/core/a11y.js";
|
|
8
8
|
import { forceType as S } from "@sbb-esta/lyne-elements/core/decorators.js";
|
|
9
|
-
import { LitElement as
|
|
10
|
-
import { property as C, state as
|
|
11
|
-
import { mapIconToSvg as
|
|
9
|
+
import { LitElement as Ee, isServer as Re } from "lit";
|
|
10
|
+
import { property as C, state as z, eventOptions as Ne } from "lit/decorators.js";
|
|
11
|
+
import { mapIconToSvg as Ae, mapPlaceInfosToPlaceSelection as ke, mapPlaceAndCoachToSeatReservationPlaceSelection as De, mapCoachInfosToCoachSelection as Te } from "../common/mapper.js";
|
|
12
12
|
var I;
|
|
13
|
-
(function(
|
|
14
|
-
|
|
13
|
+
(function(h) {
|
|
14
|
+
h.right = "right", h.left = "left";
|
|
15
15
|
})(I || (I = {}));
|
|
16
|
-
const
|
|
16
|
+
const we = 3, Be = [
|
|
17
17
|
"sa-vo",
|
|
18
18
|
"sa-rs",
|
|
19
19
|
"sa-abteilkinderwagen",
|
|
@@ -22,25 +22,27 @@ const Pe = 3, Ae = [
|
|
|
22
22
|
"sa-bz",
|
|
23
23
|
"sa-rz"
|
|
24
24
|
];
|
|
25
|
-
let
|
|
26
|
-
var x, p, _, m, y, b, P, A,
|
|
27
|
-
let
|
|
28
|
-
return
|
|
25
|
+
let Me = (() => {
|
|
26
|
+
var x, p, _, m, y, b, P, A, E, R, N, k, D, T, l;
|
|
27
|
+
let h = Ee, d = [], f, B = [], O = [], V, F = [], G = [], L, W = [], H = [], M, K = [], X = [], U, q = [], $ = [], j, Y = [], J = [], Q, Z = [], ee = [], te, se = [], ie = [], ae, ce = [], oe = [], re, ne = [], le = [], he, de = [], ue = [], ge, ve = [], fe = [], Ce, Se = [], Ie = [], xe, pe = [], _e = [], me;
|
|
28
|
+
return l = class extends h {
|
|
29
29
|
constructor() {
|
|
30
30
|
super();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
g(this, x);
|
|
32
|
+
g(this, p);
|
|
33
|
+
g(this, _);
|
|
34
|
+
g(this, m);
|
|
35
|
+
g(this, y);
|
|
36
|
+
g(this, b);
|
|
37
|
+
g(this, P);
|
|
38
|
+
g(this, A);
|
|
39
|
+
g(this, E);
|
|
40
|
+
g(this, R);
|
|
41
|
+
g(this, N);
|
|
42
|
+
g(this, k);
|
|
43
|
+
g(this, D);
|
|
44
|
+
g(this, T);
|
|
45
|
+
r(this, x, (n(this, d), n(this, B, null))), r(this, p, (n(this, O), n(this, F, "NONE"))), r(this, _, (n(this, G), n(this, W, !0))), r(this, m, (n(this, H), n(this, K, !1))), r(this, y, (n(this, X), n(this, q, 16))), r(this, b, (n(this, $), n(this, Y, null))), r(this, P, (n(this, J), n(this, Z, -1))), r(this, A, (n(this, ee), n(this, se, -1))), r(this, E, (n(this, ie), n(this, ce, !1))), r(this, R, (n(this, oe), n(this, ne, -1))), r(this, N, (n(this, le), n(this, de, !1))), r(this, k, (n(this, ue), n(this, ve, -1))), r(this, D, (n(this, fe), n(this, Se, -1))), r(this, T, (n(this, Ie), n(this, pe, -1))), this.coachBorderPadding = (n(this, _e), 6), this.gapBetweenCoaches = 4, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.gapBetweenCoachDecks = 48, this.coachNavButtonDim = 0, this.coachItemDetailsElements = [], this.currScrollDirection = I.right, this.maxCalcCoachesWidth = 0, this.scrollCoachesAreaWidth = 0, this.scrollNavigationAreaDim = 0, this.triggerCoachPositionsCollection = [], this.navigationScrollArea = null, this.coachScrollArea = null, this.currSelectedPlace = null, this.currSelectedPlaceElementId = null, this.currSelectedCoachIndex = -1, this.currSelectedDeckIndex = 0, this.preventCoachScrollByPlaceClick = !1, this.selectedSeatReservationPlaces = {
|
|
44
46
|
seats: [],
|
|
45
47
|
bicycles: []
|
|
46
48
|
}, this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.hasMultipleDecks = !1, this.hasSeatReservationNativeFocus = !1, this.keyboardNavigationEvents = {
|
|
@@ -52,6 +54,7 @@ let ze = (() => {
|
|
|
52
54
|
Enter: "Enter"
|
|
53
55
|
}, this.notAreaElements = [
|
|
54
56
|
"DRIVER_AREA",
|
|
57
|
+
"DRIVER_AREA_NO_VERTICAL_WALL",
|
|
55
58
|
"COACH_PASSAGE",
|
|
56
59
|
"COACH_WALL_NO_PASSAGE",
|
|
57
60
|
"COMPARTMENT_PASSAGE",
|
|
@@ -64,91 +67,105 @@ let ze = (() => {
|
|
|
64
67
|
const t = e?.map(function(s) {
|
|
65
68
|
return {
|
|
66
69
|
pId: s,
|
|
67
|
-
svgName:
|
|
70
|
+
svgName: Ae[s]?.svgName ? Ae[s]?.svgName : ""
|
|
68
71
|
};
|
|
69
|
-
}).filter((s) =>
|
|
72
|
+
}).filter((s) => Be.indexOf(s.svgName) !== -1).filter((s, i, a) => a.map((o) => o.svgName).indexOf(s.svgName) === i).map((s) => s.pId).slice(0, we);
|
|
70
73
|
return t || [];
|
|
71
74
|
}, this.addEventListener("blur", () => this._onLeaveSeatReservationComponent());
|
|
72
75
|
}
|
|
73
76
|
/** The seat reservations array contains all coaches and places */
|
|
74
77
|
get seatReservations() {
|
|
75
|
-
return
|
|
78
|
+
return u(this, x);
|
|
76
79
|
}
|
|
77
80
|
set seatReservations(e) {
|
|
78
81
|
r(this, x, e);
|
|
79
82
|
}
|
|
83
|
+
/** Displays an arrow showing what direction does train drive*/
|
|
84
|
+
get travelDirection() {
|
|
85
|
+
return u(this, p);
|
|
86
|
+
}
|
|
87
|
+
set travelDirection(e) {
|
|
88
|
+
r(this, p, e);
|
|
89
|
+
}
|
|
80
90
|
/** The seat reservation navigation can be toggled by this property */
|
|
81
91
|
get hasNavigation() {
|
|
82
|
-
return
|
|
92
|
+
return u(this, _);
|
|
83
93
|
}
|
|
84
94
|
set hasNavigation(e) {
|
|
85
|
-
r(this,
|
|
95
|
+
r(this, _, e);
|
|
86
96
|
}
|
|
87
97
|
/** The seat reservation area is aligned vertically */
|
|
88
98
|
get alignVertical() {
|
|
89
|
-
return
|
|
99
|
+
return u(this, m);
|
|
90
100
|
}
|
|
91
101
|
set alignVertical(e) {
|
|
92
|
-
r(this,
|
|
102
|
+
r(this, m, e);
|
|
93
103
|
}
|
|
94
104
|
/** The seat reservation area's base grid size */
|
|
95
105
|
get baseGridSize() {
|
|
96
|
-
return
|
|
106
|
+
return u(this, y);
|
|
97
107
|
}
|
|
98
108
|
set baseGridSize(e) {
|
|
99
|
-
r(this,
|
|
109
|
+
r(this, y, e);
|
|
100
110
|
}
|
|
101
111
|
/** The seat reservation area's width */
|
|
102
112
|
get height() {
|
|
103
|
-
return
|
|
113
|
+
return u(this, b);
|
|
104
114
|
}
|
|
105
115
|
set height(e) {
|
|
106
|
-
r(this,
|
|
116
|
+
r(this, b, e);
|
|
107
117
|
}
|
|
108
118
|
/** Maximal number of possible clickable seats */
|
|
109
119
|
get maxSeatReservations() {
|
|
110
|
-
return
|
|
120
|
+
return u(this, P);
|
|
111
121
|
}
|
|
112
122
|
set maxSeatReservations(e) {
|
|
113
|
-
r(this,
|
|
123
|
+
r(this, P, e);
|
|
114
124
|
}
|
|
115
125
|
/** Maximal number of possible clickable bicycle places */
|
|
116
126
|
get maxBicycleReservations() {
|
|
117
|
-
return
|
|
127
|
+
return u(this, A);
|
|
118
128
|
}
|
|
119
129
|
set maxBicycleReservations(e) {
|
|
120
|
-
r(this,
|
|
130
|
+
r(this, A, e);
|
|
121
131
|
}
|
|
122
132
|
/** Any click functionality is prevented */
|
|
123
133
|
get preventPlaceClick() {
|
|
124
|
-
return
|
|
134
|
+
return u(this, E);
|
|
125
135
|
}
|
|
126
136
|
set preventPlaceClick(e) {
|
|
127
|
-
r(this,
|
|
137
|
+
r(this, E, e);
|
|
128
138
|
}
|
|
129
139
|
get preselectCoachIndex() {
|
|
130
|
-
return
|
|
140
|
+
return u(this, R);
|
|
131
141
|
}
|
|
132
142
|
set preselectCoachIndex(e) {
|
|
143
|
+
r(this, R, e);
|
|
144
|
+
}
|
|
145
|
+
/** The seat reservation title information at place-controls, navigation-coaches and navigation-services can be toggled by this property */
|
|
146
|
+
get showTitleInfo() {
|
|
147
|
+
return u(this, N);
|
|
148
|
+
}
|
|
149
|
+
set showTitleInfo(e) {
|
|
133
150
|
r(this, N, e);
|
|
134
151
|
}
|
|
135
152
|
get selectedCoachIndex() {
|
|
136
|
-
return
|
|
153
|
+
return u(this, k);
|
|
137
154
|
}
|
|
138
155
|
set selectedCoachIndex(e) {
|
|
139
|
-
r(this,
|
|
156
|
+
r(this, k, e);
|
|
140
157
|
}
|
|
141
158
|
get focusedCoachIndex() {
|
|
142
|
-
return
|
|
159
|
+
return u(this, D);
|
|
143
160
|
}
|
|
144
161
|
set focusedCoachIndex(e) {
|
|
145
|
-
r(this,
|
|
162
|
+
r(this, D, e);
|
|
146
163
|
}
|
|
147
164
|
get hoveredCoachIndex() {
|
|
148
|
-
return
|
|
165
|
+
return u(this, T);
|
|
149
166
|
}
|
|
150
167
|
set hoveredCoachIndex(e) {
|
|
151
|
-
r(this,
|
|
168
|
+
r(this, T, e);
|
|
152
169
|
}
|
|
153
170
|
willUpdate(e) {
|
|
154
171
|
if (super.willUpdate(e), e.has("seatReservations") && (this.hasMultipleDecks = this.seatReservations?.length > 1, this._initPrepareSeatReservationData(), this._prepareCoachWidthAndGapCalculations(), this._initSeatReservationPlaceSelection(), this.initNavigationSelectionByScrollEvent()), e.has("baseGridSize") && (this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent()), e.has("height") && this.height) {
|
|
@@ -167,7 +184,7 @@ let ze = (() => {
|
|
|
167
184
|
* in order to avoid recurring iteration processes in rendering.
|
|
168
185
|
*/
|
|
169
186
|
_initPrepareSeatReservationData() {
|
|
170
|
-
this._determineBaseFontSize(), this.hasMultipleDecks && this._initEmptyCoachDeckOffsets(), this.
|
|
187
|
+
this._determineBaseFontSize(), this.hasMultipleDecks && this._initEmptyCoachDeckOffsets(), this._prepareCoachItemDetailsData();
|
|
171
188
|
}
|
|
172
189
|
/** Init scroll event handling for coach navigation */
|
|
173
190
|
initNavigationSelectionByScrollEvent() {
|
|
@@ -188,7 +205,7 @@ let ze = (() => {
|
|
|
188
205
|
if (this.coachScrollArea && e) {
|
|
189
206
|
let t = 0;
|
|
190
207
|
this.scrollCoachesAreaWidth = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = e.coachItems.map((s) => {
|
|
191
|
-
const i = t, a = this.getCalculatedDimension(s.dimension).w, o = this.overHangingElementInformation.find((
|
|
208
|
+
const i = t, a = this.getCalculatedDimension(s.dimension).w, o = this.overHangingElementInformation.find((w) => w.coachId === s.id), c = o?.overhangingPlaces || o?.overhangingGraphicAreas;
|
|
192
209
|
return t += a + (c ? 2 * this.gapBetweenCoaches : this.gapBetweenCoaches), {
|
|
193
210
|
start: i,
|
|
194
211
|
end: t,
|
|
@@ -225,12 +242,12 @@ let ze = (() => {
|
|
|
225
242
|
this._handleTabKeyNavigation(e, "navigation", t);
|
|
226
243
|
return;
|
|
227
244
|
}
|
|
228
|
-
|
|
245
|
+
Pe(e) && this.keyboardSeatmapEventHandling(e);
|
|
229
246
|
}
|
|
230
247
|
/** General TAB Key Event handling for tab navigation inside the coach navigation area and the seatmap area */
|
|
231
248
|
_handleTabKeyNavigation(e, t, s) {
|
|
232
249
|
const i = e.key, a = e.shiftKey;
|
|
233
|
-
i === this.keyboardNavigationEvents.Tab && (t == "navigation" ? (s == this.currSelectedCoachIndex ? !this.currSelectedPlace || !a || this.
|
|
250
|
+
i === this.keyboardNavigationEvents.Tab && (t == "navigation" ? (s == this.currSelectedCoachIndex ? !this.currSelectedPlace || !a || this.coachItemDetailsElements[s].isDriverArea || this.focusedCoachIndex == -1 ? this.focusedCoachIndex = s : a && this.currSelectedPlace && (this.focusedCoachIndex = -1, this.focusPlaceElement(this.currSelectedPlace)) : this.focusedCoachIndex = s, this._scrollToSelectedNavigationButton(s)) : t == "seatmap" && (e.preventDefault(), a ? this._navigateCoachNavigationByKeyboard("PREV_TAB") : this._navigateCoachNavigationByKeyboard("NEXT_TAB")));
|
|
234
251
|
}
|
|
235
252
|
/**
|
|
236
253
|
* Initialisation of Keyboard Seatmap event handling to navigation between each places inside a selected coach by using [arrow] keys.
|
|
@@ -238,14 +255,14 @@ let ze = (() => {
|
|
|
238
255
|
*/
|
|
239
256
|
keyboardSeatmapEventHandling(e) {
|
|
240
257
|
const t = e.key === this.keyboardNavigationEvents.Tab, s = e.shiftKey && t;
|
|
241
|
-
if (!this.hasNavigation && this.currSelectedCoachIndex === 0 && s || this.currSelectedCoachIndex === this.
|
|
258
|
+
if (!this.hasNavigation && this.currSelectedCoachIndex === 0 && s || this.currSelectedCoachIndex === this.coachItemDetailsElements.length - 1 && t)
|
|
242
259
|
return;
|
|
243
260
|
const i = e.key;
|
|
244
261
|
if (this.preventCoachScrollByPlaceClick = !1, !this.hasSeatReservationNativeFocus && (t || s) && (this.hasSeatReservationNativeFocus = !0), t) {
|
|
245
262
|
this._handleTabKeyNavigation(e, "seatmap");
|
|
246
263
|
return;
|
|
247
264
|
}
|
|
248
|
-
if (this.currSelectedCoachIndex !== -1 &&
|
|
265
|
+
if (this.currSelectedCoachIndex !== -1 && Pe(e))
|
|
249
266
|
switch (e.preventDefault(), i) {
|
|
250
267
|
case this.keyboardNavigationEvents.ArrowLeft:
|
|
251
268
|
{
|
|
@@ -283,7 +300,7 @@ let ze = (() => {
|
|
|
283
300
|
this._isRunningInitPreselectCoachIndex = !1;
|
|
284
301
|
return;
|
|
285
302
|
}
|
|
286
|
-
if (this.
|
|
303
|
+
if (this.coachItemDetailsElements[this.currSelectedCoachIndex] && this.coachItemDetailsElements[this.currSelectedCoachIndex].isDriverArea) {
|
|
287
304
|
this._setFocusToSelectedCoachGrid();
|
|
288
305
|
return;
|
|
289
306
|
}
|
|
@@ -474,7 +491,7 @@ let ze = (() => {
|
|
|
474
491
|
this.focusedCoachIndex = t, this.unfocusPlaceElement();
|
|
475
492
|
return;
|
|
476
493
|
} else t === 0 ? this._refocusCurrentFocusedNavCoach(t) : this.focusedCoachIndex = s;
|
|
477
|
-
else s !== this.currSelectedCoachIndex ? this.focusedCoachIndex = s : e === "NEXT_TAB" && s === this.
|
|
494
|
+
else s !== this.currSelectedCoachIndex ? this.focusedCoachIndex = s : e === "NEXT_TAB" && s === this.coachItemDetailsElements.length - 1 ? this._refocusCurrentFocusedNavCoach(t) : (this.focusedCoachIndex = -1, this.selectedCoachIndex = s, a ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
|
|
478
495
|
this._scrollToSelectedNavigationButton(s);
|
|
479
496
|
} else
|
|
480
497
|
this.scrollToSelectedNavCoach(s);
|
|
@@ -583,8 +600,8 @@ let ze = (() => {
|
|
|
583
600
|
_initSeatReservationPlaceSelection() {
|
|
584
601
|
this.selectedSeatReservationPlaces.seats = [], this.selectedSeatReservationPlaces.bicycles = [], this.seatReservations?.forEach((e, t) => e.coachItems.map((s, i) => {
|
|
585
602
|
s.places?.filter((a) => a.state === "SELECTED")?.forEach((a) => {
|
|
586
|
-
const o = this.getPlaceElementId(t, i, a.number), c =
|
|
587
|
-
|
|
603
|
+
const o = this.getPlaceElementId(t, i, a.number), c = ke(a, o, e.deckCoachIndex, i), w = this._getSeatReservationPlaceSelection(c, t);
|
|
604
|
+
w && (w.placeType === "SEAT" ? this.selectedSeatReservationPlaces.seats.push(w) : this.selectedSeatReservationPlaces.bicycles.push(w));
|
|
588
605
|
});
|
|
589
606
|
}));
|
|
590
607
|
}
|
|
@@ -605,13 +622,13 @@ let ze = (() => {
|
|
|
605
622
|
if (t === null)
|
|
606
623
|
return null;
|
|
607
624
|
const s = this.seatReservations[t].coachItems[e.coachIndex], i = s.places?.find((a) => a.number === e.number);
|
|
608
|
-
return i ?
|
|
625
|
+
return i ? De(i, s, e.id, e.deckIndex, e.coachIndex) : null;
|
|
609
626
|
}
|
|
610
627
|
_getSeatReservationSelectedCoach(e) {
|
|
611
628
|
if (!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])
|
|
612
629
|
return null;
|
|
613
630
|
const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e], s = this.getAvailableFreePlacesNumFromCoach(t.places);
|
|
614
|
-
return
|
|
631
|
+
return Te(e, t, s);
|
|
615
632
|
}
|
|
616
633
|
_setCurrSelectedPlaceElementId(e) {
|
|
617
634
|
this.currSelectedPlaceElementId = e ? this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number) : null;
|
|
@@ -621,7 +638,7 @@ let ze = (() => {
|
|
|
621
638
|
* to be determined in order to correctly calculate CSS values with rem
|
|
622
639
|
* */
|
|
623
640
|
_determineBaseFontSize() {
|
|
624
|
-
if (!
|
|
641
|
+
if (!Re) {
|
|
625
642
|
const t = 1 / parseInt(window.getComputedStyle(document.body).fontSize, 10);
|
|
626
643
|
this.style?.setProperty("--sbb-seat-reservation-one-px-rem", `${t + "rem"}`);
|
|
627
644
|
}
|
|
@@ -634,20 +651,21 @@ let ze = (() => {
|
|
|
634
651
|
* - class (first, second, any)
|
|
635
652
|
* - whether there is a driver area left or right
|
|
636
653
|
* */
|
|
637
|
-
|
|
654
|
+
_prepareCoachItemDetailsData() {
|
|
638
655
|
if (this.seatReservations) {
|
|
639
656
|
const e = this.seatReservations[this.seatReservations.length - 1].coachItems;
|
|
640
|
-
this.
|
|
657
|
+
this.coachItemDetailsElements = [], e.forEach((t, s) => {
|
|
641
658
|
const i = [], a = [], o = [];
|
|
642
659
|
this.seatReservations.map((c) => c.coachItems[s]).forEach((c) => {
|
|
643
660
|
i.push(...c.travelClass), a.push(...c.propertyIds ? c.propertyIds : []), o.push(...c.places ? c.places : []);
|
|
644
|
-
}), this.
|
|
661
|
+
}), this.coachItemDetailsElements.push({
|
|
645
662
|
id: t.id,
|
|
646
663
|
travelClass: this._prepareTravelClassNavigation(i),
|
|
647
664
|
propertyIds: this._prepareServiceIconsNavigation(a),
|
|
648
665
|
isDriverArea: t.places ? t.places.length === 0 : !0,
|
|
649
666
|
driverAreaSide: this._prepareDriverAreaSideNavigation(t),
|
|
650
|
-
freePlaces: this.getAvailableFreePlacesNumFromCoach(o)
|
|
667
|
+
freePlaces: this.getAvailableFreePlacesNumFromCoach(o),
|
|
668
|
+
driverAreaElements: this._setDriverAreasElements(t)
|
|
651
669
|
});
|
|
652
670
|
});
|
|
653
671
|
}
|
|
@@ -726,6 +744,24 @@ let ze = (() => {
|
|
|
726
744
|
_isOverhangingElementsPresent(e, t) {
|
|
727
745
|
return t?.some((s) => s.position.x === 0 || s.position.x + s.dimension.w >= e) ?? !1;
|
|
728
746
|
}
|
|
747
|
+
/**
|
|
748
|
+
* collect information about the driverAreas for one coach
|
|
749
|
+
* @param coachItem
|
|
750
|
+
* @private
|
|
751
|
+
*/
|
|
752
|
+
_setDriverAreasElements(e) {
|
|
753
|
+
if (e) {
|
|
754
|
+
const t = e.graphicElements?.find((i) => i.icon === "DRIVER_AREA"), s = e.type === "LOCOMOTIVE_COACH" ? e.graphicElements?.find((i) => i.icon === "DRIVER_AREA_NO_VERTICAL_WALL") : void 0;
|
|
755
|
+
return {
|
|
756
|
+
driverArea: t,
|
|
757
|
+
driverAreaNoVerticalWall: s
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
return {
|
|
761
|
+
driverArea: void 0,
|
|
762
|
+
driverAreaNoVerticalWall: void 0
|
|
763
|
+
};
|
|
764
|
+
}
|
|
729
765
|
/**
|
|
730
766
|
* Is called when the SeatReservation loses focus, what happens when the user tabs out or clicks somewhere else.
|
|
731
767
|
* Then we reset the focused elements.
|
|
@@ -733,38 +769,42 @@ let ze = (() => {
|
|
|
733
769
|
_onLeaveSeatReservationComponent() {
|
|
734
770
|
this.hasNavigation && (this.focusedCoachIndex = -1), this.unfocusPlaceElement();
|
|
735
771
|
}
|
|
736
|
-
}, x = new WeakMap(), p = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), y = new WeakMap(), b = new WeakMap(), P = new WeakMap(), A = new WeakMap(),
|
|
737
|
-
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
738
|
-
|
|
772
|
+
}, x = new WeakMap(), p = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), y = new WeakMap(), b = new WeakMap(), P = new WeakMap(), A = new WeakMap(), E = new WeakMap(), R = new WeakMap(), N = new WeakMap(), k = new WeakMap(), D = new WeakMap(), T = new WeakMap(), (() => {
|
|
773
|
+
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(h[Symbol.metadata] ?? null) : void 0;
|
|
774
|
+
f = [C({ attribute: "seat-reservations", type: Array })], V = [C({ attribute: "travel-direction", type: String })], L = [S(), C({ attribute: "has-navigation", type: Boolean })], M = [S(), C({ attribute: "align-vertical", type: Boolean, reflect: !0, useDefault: !0 })], U = [S(), C({ attribute: "base-grid-size", type: Number })], j = [S(), C({ attribute: "height", type: Number })], Q = [S(), C({ attribute: "max-seat-reservations", type: Number })], te = [S(), C({ attribute: "max-bicycle-reservations", type: Number })], ae = [S(), C({ attribute: "prevent-place-click", type: Boolean })], re = [S(), C({ attribute: "preselect-coach-index", type: Number })], he = [S(), C({ attribute: "show-title-info", type: Boolean })], ge = [z()], Ce = [z()], xe = [z()], me = [Ne({ passive: !0 })], v(l, null, f, { kind: "accessor", name: "seatReservations", static: !1, private: !1, access: { has: (t) => "seatReservations" in t, get: (t) => t.seatReservations, set: (t, s) => {
|
|
739
775
|
t.seatReservations = s;
|
|
740
|
-
} }, metadata: e },
|
|
776
|
+
} }, metadata: e }, B, O), v(l, null, V, { kind: "accessor", name: "travelDirection", static: !1, private: !1, access: { has: (t) => "travelDirection" in t, get: (t) => t.travelDirection, set: (t, s) => {
|
|
777
|
+
t.travelDirection = s;
|
|
778
|
+
} }, metadata: e }, F, G), v(l, null, L, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, s) => {
|
|
741
779
|
t.hasNavigation = s;
|
|
742
|
-
} }, metadata: e },
|
|
780
|
+
} }, metadata: e }, W, H), v(l, null, M, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, s) => {
|
|
743
781
|
t.alignVertical = s;
|
|
744
|
-
} }, metadata: e },
|
|
782
|
+
} }, metadata: e }, K, X), v(l, null, U, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, s) => {
|
|
745
783
|
t.baseGridSize = s;
|
|
746
|
-
} }, metadata: e },
|
|
784
|
+
} }, metadata: e }, q, $), v(l, null, j, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, s) => {
|
|
747
785
|
t.height = s;
|
|
748
|
-
} }, metadata: e },
|
|
786
|
+
} }, metadata: e }, Y, J), v(l, null, Q, { kind: "accessor", name: "maxSeatReservations", static: !1, private: !1, access: { has: (t) => "maxSeatReservations" in t, get: (t) => t.maxSeatReservations, set: (t, s) => {
|
|
749
787
|
t.maxSeatReservations = s;
|
|
750
|
-
} }, metadata: e },
|
|
788
|
+
} }, metadata: e }, Z, ee), v(l, null, te, { kind: "accessor", name: "maxBicycleReservations", static: !1, private: !1, access: { has: (t) => "maxBicycleReservations" in t, get: (t) => t.maxBicycleReservations, set: (t, s) => {
|
|
751
789
|
t.maxBicycleReservations = s;
|
|
752
|
-
} }, metadata: e },
|
|
790
|
+
} }, metadata: e }, se, ie), v(l, null, ae, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, s) => {
|
|
753
791
|
t.preventPlaceClick = s;
|
|
754
|
-
} }, metadata: e },
|
|
792
|
+
} }, metadata: e }, ce, oe), v(l, null, re, { kind: "accessor", name: "preselectCoachIndex", static: !1, private: !1, access: { has: (t) => "preselectCoachIndex" in t, get: (t) => t.preselectCoachIndex, set: (t, s) => {
|
|
755
793
|
t.preselectCoachIndex = s;
|
|
756
|
-
} }, metadata: e },
|
|
794
|
+
} }, metadata: e }, ne, le), v(l, null, he, { kind: "accessor", name: "showTitleInfo", static: !1, private: !1, access: { has: (t) => "showTitleInfo" in t, get: (t) => t.showTitleInfo, set: (t, s) => {
|
|
795
|
+
t.showTitleInfo = s;
|
|
796
|
+
} }, metadata: e }, de, ue), v(l, null, ge, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, s) => {
|
|
757
797
|
t.selectedCoachIndex = s;
|
|
758
|
-
} }, metadata: e },
|
|
798
|
+
} }, metadata: e }, ve, fe), v(l, null, Ce, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, s) => {
|
|
759
799
|
t.focusedCoachIndex = s;
|
|
760
|
-
} }, metadata: e },
|
|
800
|
+
} }, metadata: e }, Se, Ie), v(l, null, xe, { kind: "accessor", name: "hoveredCoachIndex", static: !1, private: !1, access: { has: (t) => "hoveredCoachIndex" in t, get: (t) => t.hoveredCoachIndex, set: (t, s) => {
|
|
761
801
|
t.hoveredCoachIndex = s;
|
|
762
|
-
} }, metadata: e },
|
|
763
|
-
})(),
|
|
802
|
+
} }, metadata: e }, pe, _e), v(l, null, me, { kind: "method", name: "coachAreaScrollend", static: !1, private: !1, access: { has: (t) => "coachAreaScrollend" in t, get: (t) => t.coachAreaScrollend }, metadata: e }, null, d), e && Object.defineProperty(l, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
803
|
+
})(), l.events = {
|
|
764
804
|
selectedplaces: "selectedplaces",
|
|
765
805
|
selectedcoach: "selectedcoach"
|
|
766
|
-
},
|
|
806
|
+
}, l;
|
|
767
807
|
})();
|
|
768
808
|
export {
|
|
769
|
-
|
|
809
|
+
Me as SeatReservationBaseElement
|
|
770
810
|
};
|