@sbb-esta/lyne-elements-experimental 4.5.1 → 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 +470 -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 +20 -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 +97 -31
- 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 +65 -30
- 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 +157 -103
- package/seat-reservation/seat-reservation/seat-reservation.component.js +138 -126
- 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 {
|
|
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, E, R, N, k,
|
|
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
|
-
super(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
30
|
+
super();
|
|
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) {
|
|
133
|
-
r(this,
|
|
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) {
|
|
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,13 +205,13 @@ 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,
|
|
195
212
|
width: a
|
|
196
213
|
};
|
|
197
|
-
}), this.maxCalcCoachesWidth = t;
|
|
214
|
+
}), this.maxCalcCoachesWidth = t - this.gapBetweenCoaches;
|
|
198
215
|
}
|
|
199
216
|
}
|
|
200
217
|
/**
|
|
@@ -225,47 +242,50 @@ 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.
|
|
237
254
|
* With the [TAB] key the user navigation goes to the next coach navigation element and the currently selected place is automatically reset.
|
|
238
255
|
*/
|
|
239
256
|
keyboardSeatmapEventHandling(e) {
|
|
240
|
-
const t = e.key;
|
|
241
|
-
if (this.
|
|
257
|
+
const t = e.key === this.keyboardNavigationEvents.Tab, s = e.shiftKey && t;
|
|
258
|
+
if (!this.hasNavigation && this.currSelectedCoachIndex === 0 && s || this.currSelectedCoachIndex === this.coachItemDetailsElements.length - 1 && t)
|
|
259
|
+
return;
|
|
260
|
+
const i = e.key;
|
|
261
|
+
if (this.preventCoachScrollByPlaceClick = !1, !this.hasSeatReservationNativeFocus && (t || s) && (this.hasSeatReservationNativeFocus = !0), t) {
|
|
242
262
|
this._handleTabKeyNavigation(e, "seatmap");
|
|
243
263
|
return;
|
|
244
264
|
}
|
|
245
|
-
if (this.currSelectedCoachIndex !== -1 &&
|
|
246
|
-
switch (e.preventDefault(),
|
|
265
|
+
if (this.currSelectedCoachIndex !== -1 && Pe(e))
|
|
266
|
+
switch (e.preventDefault(), i) {
|
|
247
267
|
case this.keyboardNavigationEvents.ArrowLeft:
|
|
248
268
|
{
|
|
249
|
-
const
|
|
250
|
-
this._navigateToPlaceByKeyboard(
|
|
269
|
+
const a = this.alignVertical ? this.keyboardNavigationEvents.ArrowDown : i;
|
|
270
|
+
this._navigateToPlaceByKeyboard(a);
|
|
251
271
|
}
|
|
252
272
|
break;
|
|
253
273
|
case this.keyboardNavigationEvents.ArrowRight:
|
|
254
274
|
{
|
|
255
|
-
const
|
|
256
|
-
this._navigateToPlaceByKeyboard(
|
|
275
|
+
const a = this.alignVertical ? this.keyboardNavigationEvents.ArrowUp : i;
|
|
276
|
+
this._navigateToPlaceByKeyboard(a);
|
|
257
277
|
}
|
|
258
278
|
break;
|
|
259
279
|
case this.keyboardNavigationEvents.ArrowUp:
|
|
260
280
|
{
|
|
261
|
-
const
|
|
262
|
-
this._navigateToPlaceByKeyboard(
|
|
281
|
+
const a = this.alignVertical ? this.keyboardNavigationEvents.ArrowLeft : i;
|
|
282
|
+
this._navigateToPlaceByKeyboard(a);
|
|
263
283
|
}
|
|
264
284
|
break;
|
|
265
285
|
case this.keyboardNavigationEvents.ArrowDown:
|
|
266
286
|
{
|
|
267
|
-
const
|
|
268
|
-
this._navigateToPlaceByKeyboard(
|
|
287
|
+
const a = this.alignVertical ? this.keyboardNavigationEvents.ArrowRight : i;
|
|
288
|
+
this._navigateToPlaceByKeyboard(a);
|
|
269
289
|
}
|
|
270
290
|
break;
|
|
271
291
|
}
|
|
@@ -280,7 +300,7 @@ let ze = (() => {
|
|
|
280
300
|
this._isRunningInitPreselectCoachIndex = !1;
|
|
281
301
|
return;
|
|
282
302
|
}
|
|
283
|
-
if (this.
|
|
303
|
+
if (this.coachItemDetailsElements[this.currSelectedCoachIndex] && this.coachItemDetailsElements[this.currSelectedCoachIndex].isDriverArea) {
|
|
284
304
|
this._setFocusToSelectedCoachGrid();
|
|
285
305
|
return;
|
|
286
306
|
}
|
|
@@ -470,12 +490,16 @@ let ze = (() => {
|
|
|
470
490
|
if (a || this.currSelectedPlace !== null) {
|
|
471
491
|
this.focusedCoachIndex = t, this.unfocusPlaceElement();
|
|
472
492
|
return;
|
|
473
|
-
} else t
|
|
474
|
-
else s !== this.currSelectedCoachIndex ? this.focusedCoachIndex = s : e === "NEXT_TAB" && s === this.
|
|
493
|
+
} else t === 0 ? this._refocusCurrentFocusedNavCoach(t) : this.focusedCoachIndex = s;
|
|
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()));
|
|
475
495
|
this._scrollToSelectedNavigationButton(s);
|
|
476
496
|
} else
|
|
477
497
|
this.scrollToSelectedNavCoach(s);
|
|
478
498
|
}
|
|
499
|
+
// Refocused the current focused (visual) nav coach to get the native focus back to the navigation
|
|
500
|
+
_refocusCurrentFocusedNavCoach(e) {
|
|
501
|
+
this.focusedCoachIndex = -1, setTimeout(() => this.focusedCoachIndex = e, 0);
|
|
502
|
+
}
|
|
479
503
|
_navigateToPlaceByKeyboard(e) {
|
|
480
504
|
if (this.isKeyboardNavigation = !0, this.focusedCoachIndex !== -1 && (this.focusedCoachIndex = -1), !this.preventPlaceClick) {
|
|
481
505
|
const t = this._getClosestPlaceByKeyDirection(e);
|
|
@@ -576,8 +600,8 @@ let ze = (() => {
|
|
|
576
600
|
_initSeatReservationPlaceSelection() {
|
|
577
601
|
this.selectedSeatReservationPlaces.seats = [], this.selectedSeatReservationPlaces.bicycles = [], this.seatReservations?.forEach((e, t) => e.coachItems.map((s, i) => {
|
|
578
602
|
s.places?.filter((a) => a.state === "SELECTED")?.forEach((a) => {
|
|
579
|
-
const o = this.getPlaceElementId(t, i, a.number), c =
|
|
580
|
-
|
|
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));
|
|
581
605
|
});
|
|
582
606
|
}));
|
|
583
607
|
}
|
|
@@ -598,13 +622,13 @@ let ze = (() => {
|
|
|
598
622
|
if (t === null)
|
|
599
623
|
return null;
|
|
600
624
|
const s = this.seatReservations[t].coachItems[e.coachIndex], i = s.places?.find((a) => a.number === e.number);
|
|
601
|
-
return i ?
|
|
625
|
+
return i ? De(i, s, e.id, e.deckIndex, e.coachIndex) : null;
|
|
602
626
|
}
|
|
603
627
|
_getSeatReservationSelectedCoach(e) {
|
|
604
628
|
if (!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])
|
|
605
629
|
return null;
|
|
606
630
|
const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e], s = this.getAvailableFreePlacesNumFromCoach(t.places);
|
|
607
|
-
return
|
|
631
|
+
return Te(e, t, s);
|
|
608
632
|
}
|
|
609
633
|
_setCurrSelectedPlaceElementId(e) {
|
|
610
634
|
this.currSelectedPlaceElementId = e ? this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number) : null;
|
|
@@ -614,7 +638,7 @@ let ze = (() => {
|
|
|
614
638
|
* to be determined in order to correctly calculate CSS values with rem
|
|
615
639
|
* */
|
|
616
640
|
_determineBaseFontSize() {
|
|
617
|
-
if (!
|
|
641
|
+
if (!Re) {
|
|
618
642
|
const t = 1 / parseInt(window.getComputedStyle(document.body).fontSize, 10);
|
|
619
643
|
this.style?.setProperty("--sbb-seat-reservation-one-px-rem", `${t + "rem"}`);
|
|
620
644
|
}
|
|
@@ -627,20 +651,21 @@ let ze = (() => {
|
|
|
627
651
|
* - class (first, second, any)
|
|
628
652
|
* - whether there is a driver area left or right
|
|
629
653
|
* */
|
|
630
|
-
|
|
654
|
+
_prepareCoachItemDetailsData() {
|
|
631
655
|
if (this.seatReservations) {
|
|
632
656
|
const e = this.seatReservations[this.seatReservations.length - 1].coachItems;
|
|
633
|
-
this.
|
|
657
|
+
this.coachItemDetailsElements = [], e.forEach((t, s) => {
|
|
634
658
|
const i = [], a = [], o = [];
|
|
635
659
|
this.seatReservations.map((c) => c.coachItems[s]).forEach((c) => {
|
|
636
660
|
i.push(...c.travelClass), a.push(...c.propertyIds ? c.propertyIds : []), o.push(...c.places ? c.places : []);
|
|
637
|
-
}), this.
|
|
661
|
+
}), this.coachItemDetailsElements.push({
|
|
638
662
|
id: t.id,
|
|
639
663
|
travelClass: this._prepareTravelClassNavigation(i),
|
|
640
664
|
propertyIds: this._prepareServiceIconsNavigation(a),
|
|
641
665
|
isDriverArea: t.places ? t.places.length === 0 : !0,
|
|
642
666
|
driverAreaSide: this._prepareDriverAreaSideNavigation(t),
|
|
643
|
-
freePlaces: this.getAvailableFreePlacesNumFromCoach(o)
|
|
667
|
+
freePlaces: this.getAvailableFreePlacesNumFromCoach(o),
|
|
668
|
+
driverAreaElements: this._setDriverAreasElements(t)
|
|
644
669
|
});
|
|
645
670
|
});
|
|
646
671
|
}
|
|
@@ -719,38 +744,67 @@ let ze = (() => {
|
|
|
719
744
|
_isOverhangingElementsPresent(e, t) {
|
|
720
745
|
return t?.some((s) => s.position.x === 0 || s.position.x + s.dimension.w >= e) ?? !1;
|
|
721
746
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
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
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Is called when the SeatReservation loses focus, what happens when the user tabs out or clicks somewhere else.
|
|
767
|
+
* Then we reset the focused elements.
|
|
768
|
+
*/
|
|
769
|
+
_onLeaveSeatReservationComponent() {
|
|
770
|
+
this.hasNavigation && (this.focusedCoachIndex = -1), this.unfocusPlaceElement();
|
|
771
|
+
}
|
|
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) => {
|
|
725
775
|
t.seatReservations = s;
|
|
726
|
-
} }, 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) => {
|
|
727
779
|
t.hasNavigation = s;
|
|
728
|
-
} }, 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) => {
|
|
729
781
|
t.alignVertical = s;
|
|
730
|
-
} }, 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) => {
|
|
731
783
|
t.baseGridSize = s;
|
|
732
|
-
} }, 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) => {
|
|
733
785
|
t.height = s;
|
|
734
|
-
} }, 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) => {
|
|
735
787
|
t.maxSeatReservations = s;
|
|
736
|
-
} }, 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) => {
|
|
737
789
|
t.maxBicycleReservations = s;
|
|
738
|
-
} }, 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) => {
|
|
739
791
|
t.preventPlaceClick = s;
|
|
740
|
-
} }, 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) => {
|
|
741
793
|
t.preselectCoachIndex = s;
|
|
742
|
-
} }, 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) => {
|
|
743
797
|
t.selectedCoachIndex = s;
|
|
744
|
-
} }, 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) => {
|
|
745
799
|
t.focusedCoachIndex = s;
|
|
746
|
-
} }, 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) => {
|
|
747
801
|
t.hoveredCoachIndex = s;
|
|
748
|
-
} }, metadata: e },
|
|
749
|
-
})(),
|
|
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 = {
|
|
750
804
|
selectedplaces: "selectedplaces",
|
|
751
805
|
selectedcoach: "selectedcoach"
|
|
752
|
-
},
|
|
806
|
+
}, l;
|
|
753
807
|
})();
|
|
754
808
|
export {
|
|
755
|
-
|
|
809
|
+
Me as SeatReservationBaseElement
|
|
756
810
|
};
|