@sbb-esta/lyne-elements-experimental 3.0.1 → 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 +3 -3
- 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,34 +1,40 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var ne = (o) => {
|
|
2
|
+
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var d = (
|
|
6
|
-
import { __runInitializers as
|
|
7
|
-
import { isArrowKeyOrPageKeysPressed as
|
|
8
|
-
import { forceType as
|
|
9
|
-
import { LitElement as
|
|
10
|
-
import { property as C, state as
|
|
11
|
-
import { mapPlaceInfosToPlaceSelection as
|
|
12
|
-
var
|
|
13
|
-
(function(
|
|
14
|
-
|
|
15
|
-
})(
|
|
16
|
-
let
|
|
17
|
-
var
|
|
18
|
-
let
|
|
19
|
-
return r = class extends
|
|
4
|
+
var de = (o, h, n) => h.has(o) || ne("Cannot " + n);
|
|
5
|
+
var d = (o, h, n) => (de(o, h, "read from private field"), n ? n.call(o) : h.get(o)), u = (o, h, n) => h.has(o) ? ne("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(o) : h.set(o, n), a = (o, h, n, N) => (de(o, h, "write to private field"), N ? N.call(o, n) : h.set(o, n), n);
|
|
6
|
+
import { __runInitializers as c, __esDecorate as g } from "tslib";
|
|
7
|
+
import { isArrowKeyOrPageKeysPressed as ue } from "@sbb-esta/lyne-elements/core/a11y.js";
|
|
8
|
+
import { forceType as f } from "@sbb-esta/lyne-elements/core/decorators.js";
|
|
9
|
+
import { LitElement as ge } from "lit";
|
|
10
|
+
import { property as C, state as T } from "lit/decorators.js";
|
|
11
|
+
import { mapPlaceInfosToPlaceSelection as Ce, mapPlaceAndCoachToSeatReservationPlaceSelection as fe, mapCoachInfosToCoachSelection as ve } from "../common/mapper.js";
|
|
12
|
+
var v;
|
|
13
|
+
(function(o) {
|
|
14
|
+
o.right = "right", o.left = "left";
|
|
15
|
+
})(v || (v = {}));
|
|
16
|
+
let Pe = (() => {
|
|
17
|
+
var S, x, p, I, b, _, m, y, P, A, R, E, r;
|
|
18
|
+
let o = ge, h, n = [], N = [], B, w = [], k = [], z, G = [], F = [], V, D = [], O = [], L, W = [], K = [], X, H = [], U = [], q, M = [], j = [], $, J = [], Q = [], Y, Z = [], ee = [], te, ie = [], se = [], ae, ce = [], oe = [], re, le = [], he = [];
|
|
19
|
+
return r = class extends o {
|
|
20
20
|
constructor() {
|
|
21
21
|
super(...arguments);
|
|
22
|
-
u(this, v);
|
|
23
22
|
u(this, S);
|
|
24
|
-
u(this, p);
|
|
25
23
|
u(this, x);
|
|
26
|
-
u(this,
|
|
24
|
+
u(this, p);
|
|
27
25
|
u(this, I);
|
|
28
|
-
u(this,
|
|
26
|
+
u(this, b);
|
|
29
27
|
u(this, _);
|
|
30
28
|
u(this, m);
|
|
31
|
-
|
|
29
|
+
u(this, y);
|
|
30
|
+
u(this, P);
|
|
31
|
+
u(this, A);
|
|
32
|
+
u(this, R);
|
|
33
|
+
u(this, E);
|
|
34
|
+
a(this, S, c(this, n, null)), a(this, x, (c(this, N), c(this, w, !0))), a(this, p, (c(this, k), c(this, G, !1))), a(this, I, (c(this, F), c(this, D, 16))), a(this, b, (c(this, O), c(this, W, null))), a(this, _, (c(this, K), c(this, H, -1))), a(this, m, (c(this, U), c(this, M, -1))), a(this, y, (c(this, j), c(this, J, !1))), a(this, P, (c(this, Q), c(this, Z, -1))), a(this, A, (c(this, ee), c(this, ie, -1))), a(this, R, (c(this, se), c(this, ce, -1))), a(this, E, (c(this, oe), c(this, le, -1))), this.coachBorderPadding = (c(this, he), 6), this.gapBetweenCoaches = 4, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.coachNavButtonDim = 0, this.currScrollDirection = v.right, this.maxCalcCoachsWidth = 0, this.scrollCoachsAreaWidth = 0, this.scrollNavigationAreaDim = 0, this.triggerCoachPositionsCollection = [], this.firstTabElement = null, this.lastTabElement = null, this.navigationScrollArea = null, this.coachScrollArea = null, this.currSelectedPlace = null, this.currSelectedPlaceElementId = null, this.currSelectedCoachIndex = -1, this.preventCoachScrollByPlaceClick = !1, this.selectedSeatReservationPlaces = {
|
|
35
|
+
seats: [],
|
|
36
|
+
bicycles: []
|
|
37
|
+
}, this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.keyboardNavigationEvents = {
|
|
32
38
|
ArrowLeft: "ArrowLeft",
|
|
33
39
|
ArrowRight: "ArrowRight",
|
|
34
40
|
ArrowUp: "ArrowUp",
|
|
@@ -39,83 +45,117 @@ let fe = (() => {
|
|
|
39
45
|
}
|
|
40
46
|
/** The seat reservation object which contains all coaches and places */
|
|
41
47
|
get seatReservation() {
|
|
42
|
-
return d(this,
|
|
48
|
+
return d(this, S);
|
|
43
49
|
}
|
|
44
50
|
set seatReservation(e) {
|
|
45
|
-
|
|
51
|
+
a(this, S, e);
|
|
46
52
|
}
|
|
47
53
|
/** The seat reservation navigation can be toggled by this property */
|
|
48
54
|
get hasNavigation() {
|
|
49
|
-
return d(this,
|
|
55
|
+
return d(this, x);
|
|
50
56
|
}
|
|
51
57
|
set hasNavigation(e) {
|
|
52
|
-
|
|
58
|
+
a(this, x, e);
|
|
53
59
|
}
|
|
54
60
|
/** The seat reservation area is aligned vertically */
|
|
55
61
|
get alignVertical() {
|
|
56
62
|
return d(this, p);
|
|
57
63
|
}
|
|
58
64
|
set alignVertical(e) {
|
|
59
|
-
|
|
65
|
+
a(this, p, e);
|
|
60
66
|
}
|
|
61
67
|
/** The seat reservation area's base grid size */
|
|
62
68
|
get baseGridSize() {
|
|
63
|
-
return d(this,
|
|
69
|
+
return d(this, I);
|
|
64
70
|
}
|
|
65
71
|
set baseGridSize(e) {
|
|
66
|
-
|
|
72
|
+
a(this, I, e);
|
|
67
73
|
}
|
|
68
74
|
/** The seat reservation area's width */
|
|
69
75
|
get height() {
|
|
70
76
|
return d(this, b);
|
|
71
77
|
}
|
|
72
78
|
set height(e) {
|
|
73
|
-
|
|
79
|
+
a(this, b, e);
|
|
74
80
|
}
|
|
75
81
|
/** Maximal number of possible clickable seats */
|
|
76
|
-
get
|
|
77
|
-
return d(this,
|
|
82
|
+
get maxSeatReservations() {
|
|
83
|
+
return d(this, _);
|
|
84
|
+
}
|
|
85
|
+
set maxSeatReservations(e) {
|
|
86
|
+
a(this, _, e);
|
|
87
|
+
}
|
|
88
|
+
/** Maximal number of possible clickable bicycle places */
|
|
89
|
+
get maxBicycleReservations() {
|
|
90
|
+
return d(this, m);
|
|
78
91
|
}
|
|
79
|
-
set
|
|
80
|
-
|
|
92
|
+
set maxBicycleReservations(e) {
|
|
93
|
+
a(this, m, e);
|
|
81
94
|
}
|
|
82
95
|
/** Any click functionality is prevented */
|
|
83
96
|
get preventPlaceClick() {
|
|
84
|
-
return d(this,
|
|
97
|
+
return d(this, y);
|
|
85
98
|
}
|
|
86
99
|
set preventPlaceClick(e) {
|
|
87
|
-
|
|
100
|
+
a(this, y, e);
|
|
101
|
+
}
|
|
102
|
+
get preselectCoachIndex() {
|
|
103
|
+
return d(this, P);
|
|
104
|
+
}
|
|
105
|
+
set preselectCoachIndex(e) {
|
|
106
|
+
a(this, P, e);
|
|
88
107
|
}
|
|
89
108
|
get selectedCoachIndex() {
|
|
90
|
-
return d(this,
|
|
109
|
+
return d(this, A);
|
|
91
110
|
}
|
|
92
111
|
set selectedCoachIndex(e) {
|
|
93
|
-
|
|
112
|
+
a(this, A, e);
|
|
94
113
|
}
|
|
95
114
|
get focusedCoachIndex() {
|
|
96
|
-
return d(this,
|
|
115
|
+
return d(this, R);
|
|
97
116
|
}
|
|
98
117
|
set focusedCoachIndex(e) {
|
|
99
|
-
|
|
118
|
+
a(this, R, e);
|
|
119
|
+
}
|
|
120
|
+
//Sets the hover style when scrolling to a coach
|
|
121
|
+
get hoveredScrollCoachIndex() {
|
|
122
|
+
return d(this, E);
|
|
123
|
+
}
|
|
124
|
+
set hoveredScrollCoachIndex(e) {
|
|
125
|
+
a(this, E, e);
|
|
100
126
|
}
|
|
101
127
|
willUpdate(e) {
|
|
102
|
-
super.willUpdate(e), e.has("seatReservation") && this._initSeatReservationPlaceSelection(), e.has("baseGridSize") && (this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.
|
|
128
|
+
super.willUpdate(e), e.has("seatReservation") && this._initSeatReservationPlaceSelection(), 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 && this.seatReservation.coachItems.length && (this.baseGridSize = this.height / this.seatReservation.coachItems[0].dimension.h, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent()), e.has("alignVertical") && this.alignVertical && this.initNavigationSelectionByScrollEvent(), e.has("preselectCoachIndex") && this.preselectCoachIndex && setTimeout(() => this.scrollToSelectedNavCoach(this.preselectCoachIndex), 1);
|
|
129
|
+
}
|
|
130
|
+
navigateByDirectionBtn(e) {
|
|
131
|
+
this.unfocusPlaceElement();
|
|
132
|
+
let t = this.currSelectedCoachIndex;
|
|
133
|
+
e == "DIRECTION_LEFT" && t > 0 ? t = this.currSelectedCoachIndex != -1 ? this.currSelectedCoachIndex - 1 : 0 : e == "DIRECTION_RIGHT" && t < this.seatReservation.coachItems.length - 1 && (t = this.currSelectedCoachIndex != -1 ? this.currSelectedCoachIndex + 1 : 0), this.scrollToSelectedNavCoach(t);
|
|
103
134
|
}
|
|
104
135
|
/* Init scroll event handling for coach navigation */
|
|
105
136
|
initNavigationSelectionByScrollEvent() {
|
|
106
|
-
if (this.
|
|
137
|
+
if (this.seatReservation.coachItems.length > 0) {
|
|
138
|
+
const e = (this.seatReservation.coachItems[0].dimension.h + this.coachBorderOffset * 2) * this.baseGridSize;
|
|
139
|
+
this.style?.setProperty("--sbb-seat-reservation-coach-height", `${e}`);
|
|
140
|
+
}
|
|
141
|
+
if (this.firstTabElement = this.shadowRoot?.querySelector("#first-tab-element"), this.lastTabElement = this.shadowRoot?.querySelector("#last-tab-element"), this.coachScrollArea = this.shadowRoot?.querySelector("#sbb-sr__parent-area"), this.navigationScrollArea = this.shadowRoot?.querySelector("#sbb-sr-navigation"), this.navigationScrollArea) {
|
|
142
|
+
this.scrollNavigationAreaDim = this.alignVertical ? this.navigationScrollArea.getBoundingClientRect().height : this.navigationScrollArea.getBoundingClientRect().width;
|
|
143
|
+
const t = this.navigationScrollArea.querySelector("ul > li")?.getBoundingClientRect();
|
|
144
|
+
this.coachNavButtonDim = this.alignVertical ? t?.height : t?.width;
|
|
145
|
+
}
|
|
146
|
+
if (this.coachScrollArea) {
|
|
107
147
|
let e = 0;
|
|
108
|
-
this.scrollCoachsAreaWidth = this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = this.seatReservation.coachItems.map((t) => {
|
|
148
|
+
this.scrollCoachsAreaWidth = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = this.seatReservation.coachItems.map((t) => {
|
|
109
149
|
const i = e, s = this.getCalculatedDimension(t.dimension).w;
|
|
110
|
-
return e += s, {
|
|
150
|
+
return e += s + this.gapBetweenCoaches, {
|
|
111
151
|
start: i,
|
|
112
152
|
end: e,
|
|
113
153
|
width: s
|
|
114
154
|
};
|
|
115
155
|
}), this.maxCalcCoachsWidth = e, this.coachScrollArea.addEventListener("scrollend", () => {
|
|
116
156
|
const t = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
|
|
117
|
-
this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = t : this.currSelectedCoachIndex = t < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : t, this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
|
|
118
|
-
})
|
|
157
|
+
this.currSelectedCoachIndex === -1 && (this.currSelectedCoachIndex = t), this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = t : this.currSelectedCoachIndex = t < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : t, this.isAutoScrolling || this._scrollToSelectedNavigationButton(t), this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
|
|
158
|
+
});
|
|
119
159
|
}
|
|
120
160
|
}
|
|
121
161
|
/**
|
|
@@ -143,7 +183,7 @@ let fe = (() => {
|
|
|
143
183
|
return;
|
|
144
184
|
}
|
|
145
185
|
}
|
|
146
|
-
if (this.currSelectedCoachIndex !== -1 &&
|
|
186
|
+
if (this.currSelectedCoachIndex !== -1 && ue(e))
|
|
147
187
|
switch (e.preventDefault(), t) {
|
|
148
188
|
case this.keyboardNavigationEvents.ArrowLeft:
|
|
149
189
|
{
|
|
@@ -184,27 +224,82 @@ let fe = (() => {
|
|
|
184
224
|
this.isAutoScrolling = !0, this.isCoachGridFocusable = !0, this.currSelectedCoachIndex = e, this._setScrollDirectionByCoachIndex();
|
|
185
225
|
const t = this._getCoachScrollPositionX();
|
|
186
226
|
(this.selectedCoachIndex !== -1 || this.currSelectedCoachIndex > 0) && this._isScrollableToSelectedCoach() ? this.coachScrollArea.scrollTo({
|
|
187
|
-
top: 0,
|
|
188
|
-
left: t,
|
|
227
|
+
top: this.alignVertical ? t : 0,
|
|
228
|
+
left: this.alignVertical ? 0 : t,
|
|
189
229
|
behavior: "smooth"
|
|
190
|
-
}) : this.updateCurrentSelectedCoach();
|
|
230
|
+
}) : this.updateCurrentSelectedCoach(), this._scrollToSelectedNavigationButton(e);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
focusPlaceElement(e, t) {
|
|
234
|
+
if (this.unfocusPlaceElement(), e) {
|
|
235
|
+
this.currSelectedPlace = e, t && (this.currSelectedCoachIndex = t), this._setCurrSelectedPlaceElementId(e);
|
|
236
|
+
const i = this._getPlaceHtmlElement();
|
|
237
|
+
i && i.setAttribute("keyfocus", "focus");
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
unfocusPlaceElement() {
|
|
241
|
+
const e = this._getPlaceHtmlElement();
|
|
242
|
+
e && (e.setAttribute("keyfocus", "unfocus"), this._setCurrSelectedPlaceElementId(null), this.currSelectedPlace = null);
|
|
243
|
+
}
|
|
244
|
+
getCalculatedDimension(e, t, i, s) {
|
|
245
|
+
return t && !i && (e.h += this.coachBorderOffset * 2), s && (e.h += this.coachBorderOffset), {
|
|
246
|
+
w: this.baseGridSize * e.w,
|
|
247
|
+
h: this.baseGridSize * e.h
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
getCalculatedPosition(e, t, i, s) {
|
|
251
|
+
if (i && t) {
|
|
252
|
+
const l = s ? i.h : i.h + this.coachBorderOffset;
|
|
253
|
+
e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === l && (e.y += this.coachBorderOffset);
|
|
191
254
|
}
|
|
255
|
+
return {
|
|
256
|
+
x: this.baseGridSize * e.x,
|
|
257
|
+
y: this.baseGridSize * e.y,
|
|
258
|
+
z: e.z
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Counts all available seats together depending on the seat type
|
|
263
|
+
*
|
|
264
|
+
* @param coachIndex
|
|
265
|
+
* @returns An Object with count of free seats and free bicycle places
|
|
266
|
+
*/
|
|
267
|
+
getAvailableFreePlacesNumFromCoach(e) {
|
|
268
|
+
const t = { seats: 0, bicycles: 0 }, i = this.seatReservation.coachItems[e].places?.reduce((s, l) => (l.state !== "FREE" || (l.type === "SEAT" ? s.seats++ : s.bicycles++), s), t);
|
|
269
|
+
return i || t;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Performs an automatic main navigation scroll to the specified selectedNavCoachIndex.
|
|
273
|
+
* Calculates the central scroll offset of the nav coach to be selected.
|
|
274
|
+
* @param selectedNavCoachIndex
|
|
275
|
+
*/
|
|
276
|
+
_scrollToSelectedNavigationButton(e) {
|
|
277
|
+
setTimeout(() => {
|
|
278
|
+
if (this.hoveredScrollCoachIndex = e, this.hasNavigation && this.navigationScrollArea) {
|
|
279
|
+
const t = this.scrollNavigationAreaDim / 2, s = e * this.coachNavButtonDim - t + this.coachNavButtonDim;
|
|
280
|
+
this.navigationScrollArea.scrollTo({
|
|
281
|
+
top: this.alignVertical ? s : 0,
|
|
282
|
+
left: this.alignVertical ? 0 : s,
|
|
283
|
+
behavior: "smooth"
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}, 10);
|
|
192
287
|
}
|
|
193
288
|
/**
|
|
194
289
|
* Sets the new ScrollDirection by the new given target coach index.
|
|
195
290
|
*/
|
|
196
291
|
_setScrollDirectionByCoachIndex() {
|
|
197
|
-
this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ?
|
|
292
|
+
this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? v.right : v.left;
|
|
198
293
|
}
|
|
199
294
|
/**
|
|
200
295
|
* Returns the scroll start or end position X from the selected coach.
|
|
201
|
-
* In case the user is
|
|
202
|
-
* then we return the end position of the coach to get
|
|
296
|
+
* In case the user is currently navigating through places by keyboard and goes to previous coach,
|
|
297
|
+
* then we return the end position of the coach to get the closest scroll position of the next focus place.
|
|
203
298
|
* @returns number
|
|
204
299
|
*/
|
|
205
300
|
_getCoachScrollPositionX() {
|
|
206
301
|
const e = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];
|
|
207
|
-
return this.isKeyboardNavigation && this.currScrollDirection ===
|
|
302
|
+
return this.isKeyboardNavigation && this.currScrollDirection === v.left && e.width > this.scrollCoachsAreaWidth ? e.end - this.scrollCoachsAreaWidth : e.start;
|
|
208
303
|
}
|
|
209
304
|
/**
|
|
210
305
|
* Sets the focus on the HTML table (grid) caption element so that the heading is read out when using a ScreenReader.
|
|
@@ -221,16 +316,16 @@ let fe = (() => {
|
|
|
221
316
|
* @returns boolean
|
|
222
317
|
*/
|
|
223
318
|
_isScrollableToSelectedCoach() {
|
|
224
|
-
const e = this.coachScrollArea.scrollLeft, t = this.coachScrollArea.getBoundingClientRect().width, i = this.maxCalcCoachsWidth - t, s = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex],
|
|
225
|
-
return (e < i || e > s.start) && !
|
|
319
|
+
const e = this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft, t = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, i = this.maxCalcCoachsWidth - t, s = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], l = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
|
|
320
|
+
return (e < i || e > s.start) && !l;
|
|
226
321
|
}
|
|
227
322
|
/**
|
|
228
323
|
* Returns the coach index which is currently visible in the scroll area
|
|
229
324
|
* @returns number
|
|
230
325
|
*/
|
|
231
326
|
_getCoachIndexByScrollTriggerPosition() {
|
|
232
|
-
const
|
|
233
|
-
return this.triggerCoachPositionsCollection.findIndex((
|
|
327
|
+
const t = (this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft) + this.scrollCoachsAreaWidth / 2;
|
|
328
|
+
return this.triggerCoachPositionsCollection.findIndex((i) => t >= i.start && t <= i.end);
|
|
234
329
|
}
|
|
235
330
|
/**
|
|
236
331
|
* Get the first place of current selected coach by table cell coordinate 0-0 id.
|
|
@@ -238,8 +333,8 @@ let fe = (() => {
|
|
|
238
333
|
*/
|
|
239
334
|
_getFirstPlaceInSelecedCoach() {
|
|
240
335
|
let e = null;
|
|
241
|
-
const t = this.seatReservation?.coachItems[this.currSelectedCoachIndex], i = "cell-" + this.currSelectedCoachIndex + "-0-0", s = this.shadowRoot?.querySelector("
|
|
242
|
-
return t && s && (e = t.places?.find((
|
|
336
|
+
const t = this.seatReservation?.coachItems[this.currSelectedCoachIndex], i = "cell-" + this.currSelectedCoachIndex + "-0-0", s = this.shadowRoot?.querySelector("#" + i)?.querySelector("sbb-seat-reservation-place-control")?.getAttribute("text") || null;
|
|
337
|
+
return t && s && (e = t.places?.find((l) => l.number === s) || null), e;
|
|
243
338
|
}
|
|
244
339
|
/**
|
|
245
340
|
* To get the correct closest place of current pressed key and the current selected place,
|
|
@@ -254,50 +349,29 @@ let fe = (() => {
|
|
|
254
349
|
if (this.currSelectedPlaceElementId) {
|
|
255
350
|
if (this.currSelectedPlace)
|
|
256
351
|
for (const s of t.places)
|
|
257
|
-
e ? s.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (s.position.y === this.currSelectedPlace.position.y || s.position.y === this.currSelectedPlace.position.y - 1) && s.position.x > this.currSelectedPlace.position.x && (!i || s.position.x < i.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (s.position.x === this.currSelectedPlace.position.x || s.position.x === this.currSelectedPlace.position.x + 1) && s.position.y > this.currSelectedPlace.position.y && (!i || s.position.y < i.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (s.position.y === this.currSelectedPlace.position.y || s.position.y === this.currSelectedPlace.position.y + 1) && s.position.x < this.currSelectedPlace.position.x && (!i || s.position.x > i.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (s.position.x === this.currSelectedPlace.position.x || s.position.x === this.currSelectedPlace.position.x - 1) && s.position.y < this.currSelectedPlace?.position.y && (!i || s.position.y > i.position.y)) && (i = s) : (this.currScrollDirection ===
|
|
352
|
+
e ? s.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (s.position.y === this.currSelectedPlace.position.y || s.position.y === this.currSelectedPlace.position.y - 1) && s.position.x > this.currSelectedPlace.position.x && (!i || s.position.x < i.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (s.position.x === this.currSelectedPlace.position.x || s.position.x === this.currSelectedPlace.position.x + 1) && s.position.y > this.currSelectedPlace.position.y && (!i || s.position.y < i.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (s.position.y === this.currSelectedPlace.position.y || s.position.y === this.currSelectedPlace.position.y + 1) && s.position.x < this.currSelectedPlace.position.x && (!i || s.position.x > i.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (s.position.x === this.currSelectedPlace.position.x || s.position.x === this.currSelectedPlace.position.x - 1) && s.position.y < this.currSelectedPlace?.position.y && (!i || s.position.y > i.position.y)) && (i = s) : (this.currScrollDirection === v.right && s.position.y === this.currSelectedPlace?.position.y && (!i || s.position.x < i.position.x) || this.currScrollDirection === v.left && s.position.y === this.currSelectedPlace?.position.y && (!i || s.position.x > i.position.x)) && (i = s);
|
|
258
353
|
} else
|
|
259
354
|
return this._getFirstPlaceInSelecedCoach();
|
|
260
355
|
return i;
|
|
261
356
|
}
|
|
262
|
-
|
|
263
|
-
if (this.unfocusPlaceElement(), e) {
|
|
264
|
-
this.currSelectedPlace = e, t && (this.currSelectedCoachIndex = t), this._setCurrSelectedPlaceElementId(e);
|
|
265
|
-
const i = this._getPlaceHtmlElement();
|
|
266
|
-
i && i.setAttribute("keyfocus", "focus");
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
unfocusPlaceElement() {
|
|
270
|
-
const e = this._getPlaceHtmlElement();
|
|
271
|
-
e && (e.setAttribute("keyfocus", "unfocus"), this._setCurrSelectedPlaceElementId(null), this.currSelectedPlace = null);
|
|
272
|
-
}
|
|
273
|
-
getCalculatedDimension(e, t, i, s) {
|
|
274
|
-
return t && !i && (e.h += this.coachBorderOffset * 2), s && (e.h += this.coachBorderOffset), {
|
|
275
|
-
w: this.baseGridSize * e.w,
|
|
276
|
-
h: this.baseGridSize * e.h
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
getCalculatedPosition(e, t, i, s) {
|
|
280
|
-
if (i && t) {
|
|
281
|
-
const n = s ? i.h : i.h + this.coachBorderOffset;
|
|
282
|
-
e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === n && (e.y += this.coachBorderOffset);
|
|
283
|
-
}
|
|
284
|
-
return {
|
|
285
|
-
x: this.baseGridSize * e.x,
|
|
286
|
-
y: this.baseGridSize * e.y,
|
|
287
|
-
z: e.z
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
// Handling for Tab navigation if an place is selected inside the coach.
|
|
357
|
+
// Handling for Tab navigation if a place is selected inside the coach.
|
|
291
358
|
// This controls the focused coach from the current selected coach.
|
|
292
359
|
_navigateCoachNavigationByKeyboard(e) {
|
|
293
360
|
const t = this.focusedCoachIndex === -1 ? this.currSelectedCoachIndex === -1 ? 0 : this.currSelectedCoachIndex : this.focusedCoachIndex, i = e === "NEXT_TAB" ? this.getNextAvailableCoachIndex(t) : this.getPrevAvailableCoachIndex(t);
|
|
294
361
|
if (t === i) {
|
|
295
|
-
this.unfocusPlaceElement(), this.
|
|
362
|
+
this.unfocusPlaceElement(), this.seatReservationWithoutNavigationHasFocus = !1, e === "NEXT_TAB" ? this.lastTabElement.focus() : this.firstTabElement.focus();
|
|
296
363
|
return;
|
|
297
364
|
}
|
|
298
365
|
if (this.hasNavigation) {
|
|
299
|
-
const s = this._getPlaceHtmlElement(),
|
|
300
|
-
e === "PREV_TAB" && this.selectedCoachIndex === t
|
|
366
|
+
const s = this._getPlaceHtmlElement(), l = s ? s.getAttribute("keyfocus") === "focus" : !1;
|
|
367
|
+
if (e === "PREV_TAB" && this.selectedCoachIndex === t)
|
|
368
|
+
if (l) {
|
|
369
|
+
this.focusedCoachIndex = t, this.unfocusPlaceElement();
|
|
370
|
+
return;
|
|
371
|
+
} else
|
|
372
|
+
this.focusedCoachIndex = i;
|
|
373
|
+
else i !== this.currSelectedCoachIndex ? this.focusedCoachIndex = i : (this.focusedCoachIndex = -1, this.selectedCoachIndex = i, l ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
|
|
374
|
+
this._scrollToSelectedNavigationButton(i);
|
|
301
375
|
} else
|
|
302
376
|
this.scrollToSelectedNavCoach(i);
|
|
303
377
|
}
|
|
@@ -321,17 +395,20 @@ let fe = (() => {
|
|
|
321
395
|
return t > 0 ? t - 1 : t;
|
|
322
396
|
}
|
|
323
397
|
updateSelectedSeatReservationPlaces(e) {
|
|
324
|
-
|
|
325
|
-
const t = this._getSeatReservationPlaceSelection(e);
|
|
326
|
-
t && this.selectedSeatReservationPlaces.push(t);
|
|
327
|
-
} else
|
|
328
|
-
this.selectedSeatReservationPlaces = this.selectedSeatReservationPlaces.filter((t) => t.id !== e.id);
|
|
329
|
-
this.maxReservations && this.selectedSeatReservationPlaces.length > this.maxReservations && this._resetAllPlaceSelections(e), this.dispatchEvent(new CustomEvent("selectedplaces", {
|
|
398
|
+
e.placeType === "SEAT" ? this.selectedSeatReservationPlaces.seats = this._updateSelectedSeatReservationPlaces(this.selectedSeatReservationPlaces.seats, this.maxSeatReservations, e) : this.selectedSeatReservationPlaces.bicycles = this._updateSelectedSeatReservationPlaces(this.selectedSeatReservationPlaces.bicycles, this.maxBicycleReservations, e), this.dispatchEvent(new CustomEvent("selectedplaces", {
|
|
330
399
|
bubbles: !0,
|
|
331
400
|
composed: !0,
|
|
332
401
|
detail: this.selectedSeatReservationPlaces
|
|
333
402
|
}));
|
|
334
403
|
}
|
|
404
|
+
_updateSelectedSeatReservationPlaces(e, t, i) {
|
|
405
|
+
if (i.state === "SELECTED") {
|
|
406
|
+
const s = this._getSeatReservationPlaceSelection(i);
|
|
407
|
+
s && e.push(s);
|
|
408
|
+
} else
|
|
409
|
+
e = e.filter((s) => s.id !== i.id);
|
|
410
|
+
return t > -1 && e.length > t && (t === 0 ? e = this._resetAllPlaceSelections(e) : e = this._resetAllPlaceSelections(e, i)), e;
|
|
411
|
+
}
|
|
335
412
|
updateCurrentSelectedPlaceInCoach(e) {
|
|
336
413
|
const t = e.coachIndex, i = this.seatReservation.coachItems[t].places?.find((s) => s.number == e.number);
|
|
337
414
|
i && (this.currSelectedCoachIndex = t, this.currSelectedPlace = i, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(i));
|
|
@@ -352,36 +429,37 @@ let fe = (() => {
|
|
|
352
429
|
_initSeatReservationPlaceSelection() {
|
|
353
430
|
this.seatReservation.coachItems.map((e, t) => {
|
|
354
431
|
e.places?.filter((i) => i.state === "SELECTED")?.forEach((i) => {
|
|
355
|
-
const s =
|
|
356
|
-
|
|
432
|
+
const s = Ce(i, t), l = this._getSeatReservationPlaceSelection(s);
|
|
433
|
+
l && (l.placeType === "SEAT" ? this.selectedSeatReservationPlaces.seats.push(l) : this.selectedSeatReservationPlaces.bicycles.push(l));
|
|
357
434
|
});
|
|
358
435
|
});
|
|
359
436
|
}
|
|
360
437
|
/**
|
|
361
438
|
* All selected places will be reset or the currentSelectedPlace was given, then we reset all except currentSelectedPlace
|
|
439
|
+
* @param reservationPlaceSelections
|
|
362
440
|
* @param currSelectedPlace
|
|
363
441
|
*/
|
|
364
|
-
_resetAllPlaceSelections(e) {
|
|
365
|
-
for (const
|
|
366
|
-
(!
|
|
367
|
-
|
|
442
|
+
_resetAllPlaceSelections(e, t) {
|
|
443
|
+
for (const i of e)
|
|
444
|
+
(!t || t.id !== i.id) && (this.shadowRoot?.getElementById(i.id)).setAttribute("state", "FREE");
|
|
445
|
+
return t ? e = e.filter((i) => i.id === t.id) : e = [], e;
|
|
368
446
|
}
|
|
369
447
|
_getSeatReservationPlaceSelection(e) {
|
|
370
448
|
const t = this.seatReservation.coachItems[e.coachIndex], i = t.places?.find((s) => s.number === e.number);
|
|
371
|
-
return i ?
|
|
449
|
+
return i ? fe(i, t, e.coachIndex) : null;
|
|
372
450
|
}
|
|
373
451
|
_getSeatReservationCoachSelection(e) {
|
|
374
452
|
if (!this.seatReservation.coachItems[e])
|
|
375
453
|
return null;
|
|
376
|
-
const t = this.seatReservation.coachItems[e];
|
|
377
|
-
return
|
|
454
|
+
const t = this.seatReservation.coachItems[e], i = this.getAvailableFreePlacesNumFromCoach(e);
|
|
455
|
+
return ve(e, t, i);
|
|
378
456
|
}
|
|
379
457
|
_setCurrSelectedPlaceElementId(e) {
|
|
380
458
|
e ? this.currSelectedPlaceElementId = "seat-reservation__place-button-" + this.currSelectedCoachIndex + "-" + e.number : this.currSelectedPlaceElementId = null;
|
|
381
459
|
}
|
|
382
460
|
/**
|
|
383
461
|
* Returns the current selected place HTML element by given placeNumber and coachIndex.
|
|
384
|
-
* If both
|
|
462
|
+
* If both doesn't exist, we try to return the place HTML element by the _currentSelectedPlaceElementId
|
|
385
463
|
* @param placeNumber optional as string
|
|
386
464
|
* @param coachIndex optional as string
|
|
387
465
|
* @returns HTMLElement or null
|
|
@@ -390,42 +468,38 @@ let fe = (() => {
|
|
|
390
468
|
const i = t || this.currSelectedCoachIndex, s = e ? "seat-reservation__place-button-" + i + "-" + e : this.currSelectedPlaceElementId;
|
|
391
469
|
return s && this.shadowRoot?.getElementById(s) || null;
|
|
392
470
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
const e = this.shadowRoot?.querySelector(".sbb-sr__wrapper");
|
|
397
|
-
if (e) {
|
|
398
|
-
const t = e.getBoundingClientRect().width;
|
|
399
|
-
this.style?.setProperty("--sbb-seat-reservation-vertical-offset", `${t}px`);
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
}, v = new WeakMap(), S = new WeakMap(), p = new WeakMap(), x = new WeakMap(), b = new WeakMap(), I = new WeakMap(), P = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), (() => {
|
|
404
|
-
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(a[Symbol.metadata] ?? null) : void 0;
|
|
405
|
-
l = [C({ attribute: "seat-reservation", type: Object })], E = [y(), C({ attribute: "has-navigation", type: Boolean })], N = [y(), C({ attribute: "align-vertical", type: Boolean })], z = [y(), C({ attribute: "base-grid-size", type: Number })], V = [y(), C({ attribute: "height", type: Number })], D = [y(), C({ attribute: "max-reservations", type: Number })], L = [y(), C({ attribute: "prevent-place-click", type: Boolean })], X = [Z()], j = [Z()], f(r, null, l, { kind: "accessor", name: "seatReservation", static: !1, private: !1, access: { has: (t) => "seatReservation" in t, get: (t) => t.seatReservation, set: (t, i) => {
|
|
471
|
+
}, S = new WeakMap(), x = new WeakMap(), p = new WeakMap(), I = new WeakMap(), b = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), y = new WeakMap(), P = new WeakMap(), A = new WeakMap(), R = new WeakMap(), E = new WeakMap(), (() => {
|
|
472
|
+
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(o[Symbol.metadata] ?? null) : void 0;
|
|
473
|
+
h = [C({ attribute: "seat-reservation", type: Object })], B = [f(), C({ attribute: "has-navigation", type: Boolean })], z = [f(), C({ attribute: "align-vertical", type: Boolean })], V = [f(), C({ attribute: "base-grid-size", type: Number })], L = [f(), C({ attribute: "height", type: Number })], X = [f(), C({ attribute: "max-seat-reservations", type: Number })], q = [f(), C({ attribute: "max-bicycle-reservations", type: Number })], $ = [f(), C({ attribute: "prevent-place-click", type: Boolean })], Y = [f(), C({ attribute: "preselect-coach-index", type: Number })], te = [T()], ae = [T()], re = [T()], g(r, null, h, { kind: "accessor", name: "seatReservation", static: !1, private: !1, access: { has: (t) => "seatReservation" in t, get: (t) => t.seatReservation, set: (t, i) => {
|
|
406
474
|
t.seatReservation = i;
|
|
407
|
-
} }, metadata: e },
|
|
475
|
+
} }, metadata: e }, n, N), g(r, null, B, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, i) => {
|
|
408
476
|
t.hasNavigation = i;
|
|
409
|
-
} }, metadata: e },
|
|
477
|
+
} }, metadata: e }, w, k), g(r, null, z, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, i) => {
|
|
410
478
|
t.alignVertical = i;
|
|
411
|
-
} }, metadata: e },
|
|
479
|
+
} }, metadata: e }, G, F), g(r, null, V, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, i) => {
|
|
412
480
|
t.baseGridSize = i;
|
|
413
|
-
} }, metadata: e },
|
|
481
|
+
} }, metadata: e }, D, O), g(r, null, L, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, i) => {
|
|
414
482
|
t.height = i;
|
|
415
|
-
} }, metadata: e },
|
|
416
|
-
t.
|
|
417
|
-
} }, metadata: e },
|
|
483
|
+
} }, metadata: e }, W, K), g(r, null, X, { kind: "accessor", name: "maxSeatReservations", static: !1, private: !1, access: { has: (t) => "maxSeatReservations" in t, get: (t) => t.maxSeatReservations, set: (t, i) => {
|
|
484
|
+
t.maxSeatReservations = i;
|
|
485
|
+
} }, metadata: e }, H, U), g(r, null, q, { kind: "accessor", name: "maxBicycleReservations", static: !1, private: !1, access: { has: (t) => "maxBicycleReservations" in t, get: (t) => t.maxBicycleReservations, set: (t, i) => {
|
|
486
|
+
t.maxBicycleReservations = i;
|
|
487
|
+
} }, metadata: e }, M, j), g(r, null, $, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, i) => {
|
|
418
488
|
t.preventPlaceClick = i;
|
|
419
|
-
} }, metadata: e },
|
|
489
|
+
} }, metadata: e }, J, Q), g(r, null, Y, { kind: "accessor", name: "preselectCoachIndex", static: !1, private: !1, access: { has: (t) => "preselectCoachIndex" in t, get: (t) => t.preselectCoachIndex, set: (t, i) => {
|
|
490
|
+
t.preselectCoachIndex = i;
|
|
491
|
+
} }, metadata: e }, Z, ee), g(r, null, te, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, i) => {
|
|
420
492
|
t.selectedCoachIndex = i;
|
|
421
|
-
} }, metadata: e },
|
|
493
|
+
} }, metadata: e }, ie, se), g(r, null, ae, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, i) => {
|
|
422
494
|
t.focusedCoachIndex = i;
|
|
423
|
-
} }, metadata: e },
|
|
495
|
+
} }, metadata: e }, ce, oe), g(r, null, re, { kind: "accessor", name: "hoveredScrollCoachIndex", static: !1, private: !1, access: { has: (t) => "hoveredScrollCoachIndex" in t, get: (t) => t.hoveredScrollCoachIndex, set: (t, i) => {
|
|
496
|
+
t.hoveredScrollCoachIndex = i;
|
|
497
|
+
} }, metadata: e }, le, he), e && Object.defineProperty(r, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
424
498
|
})(), r.events = {
|
|
425
499
|
selectedplaces: "selectedplaces",
|
|
426
500
|
selectedcoach: "selectedcoach"
|
|
427
501
|
}, r;
|
|
428
502
|
})();
|
|
429
503
|
export {
|
|
430
|
-
|
|
504
|
+
Pe as SeatReservationBaseElement
|
|
431
505
|
};
|
|
@@ -1,21 +1,11 @@
|
|
|
1
1
|
import { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
2
|
-
import { SeatReservation } from '../common.js';
|
|
3
2
|
import { SeatReservationBaseElement } from './seat-reservation-base-element.js';
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
4
|
+
* Main component for the seat reservation.
|
|
5
|
+
*
|
|
6
6
|
*/
|
|
7
7
|
export declare class SbbSeatReservationElement extends SeatReservationBaseElement {
|
|
8
8
|
static styles: CSSResultGroup;
|
|
9
|
-
/** The seat reservation object which contains all coaches and places */
|
|
10
|
-
accessor seatReservation: SeatReservation;
|
|
11
|
-
/** The seat reservation navigation can be toggled by this property */
|
|
12
|
-
accessor hasNavigation: boolean;
|
|
13
|
-
/** Controls the visual representation of seat reservation in a horizonal or vertical alignment */
|
|
14
|
-
accessor alignVertical: boolean;
|
|
15
|
-
/** Maximal number of possible clickable seats */
|
|
16
|
-
accessor maxReservations: number;
|
|
17
|
-
/** Any click functionality is prevented */
|
|
18
|
-
accessor preventPlaceClick: boolean;
|
|
19
9
|
private _language;
|
|
20
10
|
private _coachesHtmlTemplate?;
|
|
21
11
|
private _notAreaElements;
|
|
@@ -23,8 +13,9 @@ export declare class SbbSeatReservationElement extends SeatReservationBaseElemen
|
|
|
23
13
|
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
24
14
|
protected firstUpdated(changedProperties: PropertyValues<this>): void;
|
|
25
15
|
protected render(): TemplateResult | null;
|
|
26
|
-
private
|
|
16
|
+
private _determineBaseFontSize;
|
|
27
17
|
private _initVehicleSeatReservationConstruction;
|
|
18
|
+
private _renderNavigationControlButton;
|
|
28
19
|
private _renderNavigation;
|
|
29
20
|
/**
|
|
30
21
|
*
|
|
@@ -33,11 +24,35 @@ export declare class SbbSeatReservationElement extends SeatReservationBaseElemen
|
|
|
33
24
|
*/
|
|
34
25
|
private _renderCoaches;
|
|
35
26
|
private _renderCoachElement;
|
|
27
|
+
/**
|
|
28
|
+
* @returns Returns the border graphic (COACH_BORDER_MIDDLE) of a coach with calculated border gap and coach width,
|
|
29
|
+
* depending on whether the coach is with a driver area or without.
|
|
30
|
+
*/
|
|
36
31
|
private _getRenderedCoachBorders;
|
|
37
32
|
private _getRenderedRowPlaces;
|
|
38
33
|
private _getRenderedColumnPlaces;
|
|
39
34
|
private _getRenderedGraphicalElements;
|
|
35
|
+
/**
|
|
36
|
+
* creates a rendered element with an area component
|
|
37
|
+
* @param graphicalElement
|
|
38
|
+
* @param rotation
|
|
39
|
+
* @param coachDimension
|
|
40
|
+
* @param coachIndex used to generate a unique id for the popover trigger
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
40
43
|
private _getRenderElementWithArea;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a popover for extra service information
|
|
46
|
+
* @param triggerId
|
|
47
|
+
* @param popoverContent
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
private _popover;
|
|
51
|
+
/**
|
|
52
|
+
* trigger to close all opened popovers (normally only one is opened at a time)
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
private _closePopover;
|
|
41
56
|
private _getRenderElementWithoutArea;
|
|
42
57
|
private _getRenderedServiceElements;
|
|
43
58
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seat-reservation.component.d.ts","sourceRoot":"","sources":["../../../../src/elements-experimental/seat-reservation/seat-reservation/seat-reservation.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"seat-reservation.component.d.ts","sourceRoot":"","sources":["../../../../src/elements-experimental/seat-reservation/seat-reservation/seat-reservation.component.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAQ1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGhF,OAAO,mCAAmC,CAAC;AAC3C,OAAO,+CAA+C,CAAC;AACvD,OAAO,6BAA6B,CAAC;AACrC,OAAO,gCAAgC,CAAC;AACxC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,yCAAyC,CAAC;AACjD,OAAO,+BAA+B,CAAC;AACvC,OAAO,4CAA4C,CAAC;AAEpD;;;GAGG;AACH,qBAEM,yBAA0B,SAAQ,0BAA0B;IAChE,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,oBAAoB,CAAC,CAAiB;IAG9C,OAAO,CAAC,gBAAgB,CAQtB;IAGF,OAAO,CAAC,2BAA2B,CAAkB;cAElC,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;cAgBzD,YAAY,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;cAS3D,MAAM,IAAI,cAAc,GAAG,IAAI;IASlD,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,uCAAuC;IAkC/C,OAAO,CAAC,8BAA8B;IAmCtC,OAAO,CAAC,iBAAiB;IA2CzB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,mBAAmB;IAgC3B;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IA8BhC,OAAO,CAAC,qBAAqB;IA0B7B,OAAO,CAAC,wBAAwB;IA0ChC,OAAO,CAAC,6BAA6B;IAgCrC;;;;;;;OAOG;IACH,OAAO,CAAC,yBAAyB;IA0EjC;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAWhB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,4BAA4B;IAoCpC,OAAO,CAAC,2BAA2B;IAyCnC;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,iBAAiB;IAgBzB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,yBAAyB;IAkCjC,OAAO,CAAC,8BAA8B;CAyBvC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,sBAAsB,EAAE,yBAAyB,CAAC;KACnD;CACF"}
|