@sbb-esta/lyne-elements-experimental 2.11.2 → 3.0.0-next.1
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/core/datetime/date-helper.js +142 -142
- package/core/timetable/access-leg-helper.js +52 -49
- package/core/timetable/timetable-helper.js +8 -7
- package/custom-elements.json +8 -8
- package/development/core/datetime/date-helper.js +10 -10
- package/development/core/timetable/access-leg-helper.js +15 -12
- package/development/core/timetable/timetable-helper.js +7 -6
- package/development/{differenceInMinutes-D5Nj8Stc.js → differenceInMinutes-CHSyWiQs.js} +3 -3
- package/development/{format-BQfaa1ZT.js → format-D0-yhzi4.js} +26 -22
- package/development/{isValid-DvieCZVi.js → isValid-Bo4R7iA7.js} +3 -3
- package/development/journey-summary/journey-summary.component.d.ts +5 -3
- package/development/journey-summary/journey-summary.component.d.ts.map +1 -1
- package/development/journey-summary/journey-summary.component.js +9 -5
- package/development/pearl-chain/pearl-chain.component.d.ts +5 -3
- package/development/pearl-chain/pearl-chain.component.d.ts.map +1 -1
- package/development/pearl-chain/pearl-chain.component.js +43 -29
- package/development/pearl-chain-time/pearl-chain-time.component.d.ts +5 -3
- package/development/pearl-chain-time/pearl-chain-time.component.d.ts.map +1 -1
- package/development/pearl-chain-time/pearl-chain-time.component.js +10 -6
- package/development/pearl-chain-vertical/pearl-chain-vertical.component.js +1 -1
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +1 -1
- package/development/seat-reservation/common/mapper/icon-mapper.js +1 -1
- package/development/seat-reservation/common/mapper/mapper.js +16 -14
- package/development/seat-reservation/common/mapper/seat-reservation-sample-data.js +1 -1
- package/development/seat-reservation/common/svgs.js +1 -1
- package/development/seat-reservation/common/translations/i18n.js +3 -2
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +33 -22
- package/development/seat-reservation/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +7 -6
- package/development/seat-reservation/seat-reservation/seat-reservation.component.js +23 -16
- package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +1 -1
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +3 -2
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +8 -7
- package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +11 -7
- package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +3 -2
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +5 -4
- package/development/timetable-duration/timetable-duration.component.js +1 -1
- package/development/timetable-row/timetable-row.component.d.ts +5 -3
- package/development/timetable-row/timetable-row.component.d.ts.map +1 -1
- package/development/timetable-row/timetable-row.component.js +93 -59
- package/differenceInMinutes-BMqUZdhj.js +23 -0
- package/{format-lqeCzmzS.js → format-Dg8rkk7h.js} +442 -438
- package/isValid-DJ69OMZJ.js +45 -0
- package/journey-summary/journey-summary.component.d.ts +5 -3
- package/journey-summary/journey-summary.component.d.ts.map +1 -1
- package/journey-summary/journey-summary.component.js +8 -4
- package/package.json +2 -2
- package/pearl-chain/pearl-chain.component.d.ts +5 -3
- package/pearl-chain/pearl-chain.component.d.ts.map +1 -1
- package/pearl-chain/pearl-chain.component.js +99 -79
- package/pearl-chain-time/pearl-chain-time.component.d.ts +5 -3
- package/pearl-chain-time/pearl-chain-time.component.d.ts.map +1 -1
- package/pearl-chain-time/pearl-chain-time.component.js +49 -45
- package/seat-reservation/common/mapper/mapper.js +54 -50
- package/seat-reservation/common/translations/i18n.js +6 -5
- package/seat-reservation/seat-reservation/seat-reservation-base-element.js +115 -104
- package/seat-reservation/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +41 -40
- package/seat-reservation/seat-reservation/seat-reservation.component.js +87 -78
- package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +18 -15
- package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +59 -58
- package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +75 -71
- package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +13 -12
- package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +24 -23
- package/timetable-row/timetable-row.component.d.ts +5 -3
- package/timetable-row/timetable-row.component.d.ts.map +1 -1
- package/timetable-row/timetable-row.component.js +251 -208
- package/differenceInMinutes-CP_C5onR.js +0 -23
- package/isValid-Ceq2O0NQ.js +0 -45
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var te = (o) => {
|
|
2
|
+
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __runInitializers as
|
|
7
|
-
import { isArrowKeyOrPageKeysPressed as
|
|
8
|
-
import { forceType as
|
|
9
|
-
import { EventEmitter as
|
|
10
|
-
import { LitElement as
|
|
11
|
-
import { property as
|
|
12
|
-
import { mapPlaceInfosToPlaceSelection as
|
|
13
|
-
var
|
|
14
|
-
(function(
|
|
15
|
-
|
|
16
|
-
})(
|
|
17
|
-
let
|
|
18
|
-
var
|
|
19
|
-
let
|
|
20
|
-
return
|
|
4
|
+
var ie = (o, n, d) => n.has(o) || te("Cannot " + d);
|
|
5
|
+
var f = (o, n, d) => (ie(o, n, "read from private field"), d ? d.call(o) : n.get(o)), g = (o, n, d) => n.has(o) ? te("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(o) : n.set(o, d), r = (o, n, d, w) => (ie(o, n, "write to private field"), w ? w.call(o, d) : n.set(o, d), d);
|
|
6
|
+
import { __runInitializers as h, __esDecorate as v } from "tslib";
|
|
7
|
+
import { isArrowKeyOrPageKeysPressed as oe } from "@sbb-esta/lyne-elements/core/a11y.js";
|
|
8
|
+
import { forceType as E } from "@sbb-esta/lyne-elements/core/decorators.js";
|
|
9
|
+
import { EventEmitter as se } from "@sbb-esta/lyne-elements/core/eventing.js";
|
|
10
|
+
import { LitElement as re } from "lit";
|
|
11
|
+
import { property as x, state as ae } from "lit/decorators.js";
|
|
12
|
+
import { mapPlaceInfosToPlaceSelection as le, mapPlaceAndCoachToSeatReservationPlaceSelection as he, mapCoachInfosToCoachSelection as ne } from "../common/mapper.js";
|
|
13
|
+
var S;
|
|
14
|
+
(function(o) {
|
|
15
|
+
o.right = "right", o.left = "left";
|
|
16
|
+
})(S || (S = {}));
|
|
17
|
+
let be = (() => {
|
|
18
|
+
var p, b, P, I, m, _, y, R, A, l;
|
|
19
|
+
let o = re, n, d = [], w = [], k, T = [], z = [], B, G = [], V = [], F, O = [], D = [], W, K = [], L = [], H, U = [], X = [], q, M = [], j = [], $, J = [], Q = [], Y, Z = [], ee = [];
|
|
20
|
+
return l = class extends o {
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
g(this, p);
|
|
24
|
+
g(this, b);
|
|
25
|
+
g(this, P);
|
|
26
|
+
g(this, I);
|
|
27
|
+
g(this, m);
|
|
28
|
+
g(this, _);
|
|
29
|
+
g(this, y);
|
|
30
|
+
g(this, R);
|
|
31
|
+
g(this, A);
|
|
32
|
+
r(this, p, h(this, d, null)), r(this, b, (h(this, w), h(this, T, !0))), r(this, P, (h(this, z), h(this, G, !1))), r(this, I, (h(this, V), h(this, O, 16))), r(this, m, (h(this, D), h(this, K, null))), r(this, _, (h(this, L), h(this, U, null))), r(this, y, (h(this, X), h(this, M, !1))), r(this, R, (h(this, j), h(this, J, -1))), r(this, A, (h(this, Q), h(this, Z, -1))), this.selectedPlaces = (h(this, ee), new se(this, l.events.selectedPlaces)), this.selectedCoach = new se(this, l.events.selectedCoach), this.coachBorderPadding = 6, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.currScrollDirection = S.right, this.maxCalcCoachsWidth = 0, this.scrollCoachsAreaWidth = 0, this.triggerCoachPositionsCollection = [], this.firstTabElement = null, this.lastTabElement = null, this.coachScrollArea = null, this.currSelectedPlace = null, this.currSelectedPlaceElementId = null, this.currSelectedCoachIndex = -1, this.preventCoachScrollByPlaceClick = !1, this.selectedSeatReservationPlaces = [], this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.keyboardNavigationEvents = {
|
|
33
33
|
ArrowLeft: "ArrowLeft",
|
|
34
34
|
ArrowRight: "ArrowRight",
|
|
35
35
|
ArrowUp: "ArrowUp",
|
|
@@ -40,82 +40,84 @@ let Ce = (() => {
|
|
|
40
40
|
}
|
|
41
41
|
/** The seat reservation object which contains all coaches and places */
|
|
42
42
|
get seatReservation() {
|
|
43
|
-
return
|
|
43
|
+
return f(this, p);
|
|
44
44
|
}
|
|
45
45
|
set seatReservation(e) {
|
|
46
|
-
|
|
46
|
+
r(this, p, e);
|
|
47
47
|
}
|
|
48
48
|
/** The seat resvervation navigation can be toggled by this property */
|
|
49
49
|
get hasNavigation() {
|
|
50
|
-
return
|
|
50
|
+
return f(this, b);
|
|
51
51
|
}
|
|
52
52
|
set hasNavigation(e) {
|
|
53
|
-
|
|
53
|
+
r(this, b, e);
|
|
54
54
|
}
|
|
55
55
|
/** The seat reservation area is aligned vertically */
|
|
56
56
|
get alignVertical() {
|
|
57
|
-
return
|
|
57
|
+
return f(this, P);
|
|
58
58
|
}
|
|
59
59
|
set alignVertical(e) {
|
|
60
|
-
|
|
60
|
+
r(this, P, e);
|
|
61
61
|
}
|
|
62
62
|
/** The seat reservation area's base grid size */
|
|
63
63
|
get baseGridSize() {
|
|
64
|
-
return
|
|
64
|
+
return f(this, I);
|
|
65
65
|
}
|
|
66
66
|
set baseGridSize(e) {
|
|
67
|
-
|
|
67
|
+
r(this, I, e);
|
|
68
68
|
}
|
|
69
69
|
/** The seat reservation area's width */
|
|
70
70
|
get height() {
|
|
71
|
-
return
|
|
71
|
+
return f(this, m);
|
|
72
72
|
}
|
|
73
73
|
set height(e) {
|
|
74
|
-
|
|
74
|
+
r(this, m, e);
|
|
75
75
|
}
|
|
76
76
|
/** Maximal number of possible clickable seats */
|
|
77
77
|
get maxReservations() {
|
|
78
|
-
return
|
|
78
|
+
return f(this, _);
|
|
79
79
|
}
|
|
80
80
|
set maxReservations(e) {
|
|
81
|
-
|
|
81
|
+
r(this, _, e);
|
|
82
82
|
}
|
|
83
83
|
/** Any click functionality is prevented */
|
|
84
84
|
get preventPlaceClick() {
|
|
85
|
-
return
|
|
85
|
+
return f(this, y);
|
|
86
86
|
}
|
|
87
87
|
set preventPlaceClick(e) {
|
|
88
|
-
|
|
88
|
+
r(this, y, e);
|
|
89
89
|
}
|
|
90
90
|
get selectedCoachIndex() {
|
|
91
|
-
return
|
|
91
|
+
return f(this, R);
|
|
92
92
|
}
|
|
93
93
|
set selectedCoachIndex(e) {
|
|
94
|
-
|
|
94
|
+
r(this, R, e);
|
|
95
95
|
}
|
|
96
96
|
get focusedCoachIndex() {
|
|
97
|
-
return
|
|
97
|
+
return f(this, A);
|
|
98
98
|
}
|
|
99
99
|
set focusedCoachIndex(e) {
|
|
100
|
-
|
|
100
|
+
r(this, A, e);
|
|
101
101
|
}
|
|
102
102
|
willUpdate(e) {
|
|
103
|
-
|
|
103
|
+
var t, i;
|
|
104
|
+
super.willUpdate(e), e.has("seatReservation") && this._initSeatReservationPlaceSelection(), e.has("baseGridSize") && (this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, (t = this.style) == null || t.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.alignVertical && this._setVerticalAlignmentOffset()), 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, (i = this.style) == null || i.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.alignVertical && this._setVerticalAlignmentOffset()), e.has("alignVertical") && this.alignVertical && this._setVerticalAlignmentOffset();
|
|
104
105
|
}
|
|
105
106
|
/* Init scroll event handling for coach navigation */
|
|
106
107
|
initNavigationSelectionByScrollEvent() {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
var e, t, i;
|
|
109
|
+
if (this.firstTabElement = (e = this.shadowRoot) == null ? void 0 : e.getElementById("first-tab-element"), this.lastTabElement = (t = this.shadowRoot) == null ? void 0 : t.getElementById("last-tab-element"), this.coachScrollArea = (i = this.shadowRoot) == null ? void 0 : i.getElementById("sbb-sr__parent-area"), this.coachScrollArea) {
|
|
110
|
+
let s = 0;
|
|
111
|
+
this.scrollCoachsAreaWidth = this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = this.seatReservation.coachItems.map((c) => {
|
|
112
|
+
const C = s, u = this.getCalculatedDimension(c.dimension).w;
|
|
113
|
+
return s += u, {
|
|
114
|
+
start: C,
|
|
115
|
+
end: s,
|
|
116
|
+
width: u
|
|
115
117
|
};
|
|
116
|
-
}), this.maxCalcCoachsWidth =
|
|
117
|
-
const
|
|
118
|
-
this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex =
|
|
118
|
+
}), this.maxCalcCoachsWidth = s, this.coachScrollArea.addEventListener("scrollend", () => {
|
|
119
|
+
const c = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
|
|
120
|
+
this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = c : this.currSelectedCoachIndex = c < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : c, this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
|
|
119
121
|
}), this.alignVertical && this._setVerticalAlignmentOffset();
|
|
120
122
|
}
|
|
121
123
|
}
|
|
@@ -144,7 +146,7 @@ let Ce = (() => {
|
|
|
144
146
|
return;
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
|
-
if (this.currSelectedCoachIndex !== -1 &&
|
|
149
|
+
if (this.currSelectedCoachIndex !== -1 && oe(e))
|
|
148
150
|
switch (e.preventDefault(), t) {
|
|
149
151
|
case this.keyboardNavigationEvents.ArrowLeft:
|
|
150
152
|
{
|
|
@@ -195,7 +197,7 @@ let Ce = (() => {
|
|
|
195
197
|
* Sets the new ScrollDirection by the new given target coach index.
|
|
196
198
|
*/
|
|
197
199
|
_setScrollDirectionByCoachIndex() {
|
|
198
|
-
this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ?
|
|
200
|
+
this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? S.right : S.left;
|
|
199
201
|
}
|
|
200
202
|
/**
|
|
201
203
|
* Returns the scroll start or end position X from the selected coach.
|
|
@@ -205,16 +207,17 @@ let Ce = (() => {
|
|
|
205
207
|
*/
|
|
206
208
|
_getCoachScrollPositionX() {
|
|
207
209
|
const e = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];
|
|
208
|
-
return this.isKeyboardNavigation && this.currScrollDirection ===
|
|
210
|
+
return this.isKeyboardNavigation && this.currScrollDirection === S.left && e.width > this.scrollCoachsAreaWidth ? e.end - this.scrollCoachsAreaWidth : e.start;
|
|
209
211
|
}
|
|
210
212
|
/**
|
|
211
213
|
* Sets the focus on the HTML table (grid) caption element so that the heading is read out when using a ScreenReader.
|
|
212
214
|
*/
|
|
213
215
|
_setFocusToSelectedCoachGrid() {
|
|
216
|
+
var e;
|
|
214
217
|
if (this.isCoachGridFocusable) {
|
|
215
218
|
this.isCoachGridFocusable = !1;
|
|
216
|
-
const e = this.shadowRoot
|
|
217
|
-
|
|
219
|
+
const t = (e = this.shadowRoot) == null ? void 0 : e.querySelector("#sbb-sr-coach-caption-" + this.currSelectedCoachIndex);
|
|
220
|
+
t && t.focus();
|
|
218
221
|
}
|
|
219
222
|
}
|
|
220
223
|
/**
|
|
@@ -222,8 +225,8 @@ let Ce = (() => {
|
|
|
222
225
|
* @returns boolean
|
|
223
226
|
*/
|
|
224
227
|
_isScrollableToSelectedCoach() {
|
|
225
|
-
const e = this.coachScrollArea.scrollLeft, t = this.coachScrollArea.getBoundingClientRect().width, i = this.maxCalcCoachsWidth - t, s = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex],
|
|
226
|
-
return (e < i || e > s.start) && !
|
|
228
|
+
const e = this.coachScrollArea.scrollLeft, t = this.coachScrollArea.getBoundingClientRect().width, i = this.maxCalcCoachsWidth - t, s = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], c = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
|
|
229
|
+
return (e < i || e > s.start) && !c;
|
|
227
230
|
}
|
|
228
231
|
/**
|
|
229
232
|
* Returns the coach index which is currently visible in the scroll area
|
|
@@ -238,9 +241,10 @@ let Ce = (() => {
|
|
|
238
241
|
* @returns Place or null
|
|
239
242
|
*/
|
|
240
243
|
_getFirstPlaceInSelecedCoach() {
|
|
244
|
+
var c, C, u, N, a;
|
|
241
245
|
let e = null;
|
|
242
|
-
const t = this.seatReservation
|
|
243
|
-
return t && s && (e = t.places
|
|
246
|
+
const t = (c = this.seatReservation) == null ? void 0 : c.coachItems[this.currSelectedCoachIndex], i = "cell-" + this.currSelectedCoachIndex + "-0-0", s = ((N = (u = (C = this.shadowRoot) == null ? void 0 : C.querySelector("[cell-id='" + i + "']")) == null ? void 0 : u.querySelector("sbb-seat-reservation-place-control")) == null ? void 0 : N.getAttribute("text")) || null;
|
|
247
|
+
return t && s && (e = ((a = t.places) == null ? void 0 : a.find((ce) => ce.number === s)) || null), e;
|
|
244
248
|
}
|
|
245
249
|
/**
|
|
246
250
|
* To get the correct closest place of current pressed key and the current selected place,
|
|
@@ -249,13 +253,14 @@ let Ce = (() => {
|
|
|
249
253
|
* @returns Place or null
|
|
250
254
|
*/
|
|
251
255
|
_getClosestPlaceByKeyDirection(e) {
|
|
252
|
-
|
|
256
|
+
var s, c, C, u, N;
|
|
257
|
+
const t = (s = this.seatReservation) == null ? void 0 : s.coachItems[this.currSelectedCoachIndex];
|
|
253
258
|
let i = null;
|
|
254
259
|
if (t.places)
|
|
255
260
|
if (this.currSelectedPlaceElementId) {
|
|
256
261
|
if (this.currSelectedPlace)
|
|
257
|
-
for (const
|
|
258
|
-
e ?
|
|
262
|
+
for (const a of t.places)
|
|
263
|
+
e ? a.number !== ((u = this.currSelectedPlace) == null ? void 0 : u.number) && (e === this.keyboardNavigationEvents.ArrowRight && (a.position.y === this.currSelectedPlace.position.y || a.position.y === this.currSelectedPlace.position.y - 1) && a.position.x > this.currSelectedPlace.position.x && (!i || a.position.x < i.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (a.position.x === this.currSelectedPlace.position.x || a.position.x === this.currSelectedPlace.position.x + 1) && a.position.y > this.currSelectedPlace.position.y && (!i || a.position.y < i.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (a.position.y === this.currSelectedPlace.position.y || a.position.y === this.currSelectedPlace.position.y + 1) && a.position.x < this.currSelectedPlace.position.x && (!i || a.position.x > i.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (a.position.x === this.currSelectedPlace.position.x || a.position.x === this.currSelectedPlace.position.x - 1) && a.position.y < ((N = this.currSelectedPlace) == null ? void 0 : N.position.y) && (!i || a.position.y > i.position.y)) && (i = a) : (this.currScrollDirection === S.right && a.position.y === ((c = this.currSelectedPlace) == null ? void 0 : c.position.y) && (!i || a.position.x < i.position.x) || this.currScrollDirection === S.left && a.position.y === ((C = this.currSelectedPlace) == null ? void 0 : C.position.y) && (!i || a.position.x > i.position.x)) && (i = a);
|
|
259
264
|
} else
|
|
260
265
|
return this._getFirstPlaceInSelecedCoach();
|
|
261
266
|
return i;
|
|
@@ -279,8 +284,8 @@ let Ce = (() => {
|
|
|
279
284
|
}
|
|
280
285
|
getCalculatedPosition(e, t, i, s) {
|
|
281
286
|
if (i && t) {
|
|
282
|
-
const
|
|
283
|
-
e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h ===
|
|
287
|
+
const c = s ? i.h : i.h + this.coachBorderOffset;
|
|
288
|
+
e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === c && (e.y += this.coachBorderOffset);
|
|
284
289
|
}
|
|
285
290
|
return {
|
|
286
291
|
x: this.baseGridSize * e.x,
|
|
@@ -297,8 +302,8 @@ let Ce = (() => {
|
|
|
297
302
|
return;
|
|
298
303
|
}
|
|
299
304
|
if (this.hasNavigation) {
|
|
300
|
-
const s = this._getPlaceHtmlElement(),
|
|
301
|
-
e === "PREV_TAB" && this.selectedCoachIndex === t ?
|
|
305
|
+
const s = this._getPlaceHtmlElement(), c = s ? s.getAttribute("keyfocus") === "focus" : !1;
|
|
306
|
+
e === "PREV_TAB" && this.selectedCoachIndex === t ? c ? (this.focusedCoachIndex = t, this.unfocusPlaceElement()) : this.focusedCoachIndex = i : i !== this.currSelectedCoachIndex ? this.focusedCoachIndex = i : (this.focusedCoachIndex = -1, this.selectedCoachIndex = i, c ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
|
|
302
307
|
} else
|
|
303
308
|
this.scrollToSelectedNavCoach(i);
|
|
304
309
|
}
|
|
@@ -330,7 +335,8 @@ let Ce = (() => {
|
|
|
330
335
|
this.maxReservations && this.selectedSeatReservationPlaces.length > this.maxReservations && this._resetAllPlaceSelections(e), this.selectedPlaces.emit(this.selectedSeatReservationPlaces);
|
|
331
336
|
}
|
|
332
337
|
updateCurrentSelectedPlaceInCoach(e) {
|
|
333
|
-
|
|
338
|
+
var s;
|
|
339
|
+
const t = e.coachIndex, i = (s = this.seatReservation.coachItems[t].places) == null ? void 0 : s.find((c) => c.number == e.number);
|
|
334
340
|
i && (this.currSelectedCoachIndex = t, this.currSelectedPlace = i, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(i));
|
|
335
341
|
}
|
|
336
342
|
updateCurrentSelectedCoach() {
|
|
@@ -344,9 +350,10 @@ let Ce = (() => {
|
|
|
344
350
|
*/
|
|
345
351
|
_initSeatReservationPlaceSelection() {
|
|
346
352
|
this.seatReservation.coachItems.map((e, t) => {
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
353
|
+
var i, s;
|
|
354
|
+
(s = (i = e.places) == null ? void 0 : i.filter((c) => c.state === "SELECTED")) == null || s.forEach((c) => {
|
|
355
|
+
const C = le(c, t), u = this._getSeatReservationPlaceSelection(C);
|
|
356
|
+
u && this.selectedSeatReservationPlaces.push(u);
|
|
350
357
|
});
|
|
351
358
|
});
|
|
352
359
|
}
|
|
@@ -355,19 +362,21 @@ let Ce = (() => {
|
|
|
355
362
|
* @param currSelectedPlace
|
|
356
363
|
*/
|
|
357
364
|
_resetAllPlaceSelections(e) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
365
|
+
var t;
|
|
366
|
+
for (const i of this.selectedSeatReservationPlaces)
|
|
367
|
+
(!e || e.id !== i.id) && ((t = this.shadowRoot) == null ? void 0 : t.getElementById(i.id)).setAttribute("state", "FREE");
|
|
368
|
+
e ? this.selectedSeatReservationPlaces = this.selectedSeatReservationPlaces.filter((i) => i.id === e.id) : this.selectedSeatReservationPlaces = [];
|
|
361
369
|
}
|
|
362
370
|
_getSeatReservationPlaceSelection(e) {
|
|
363
|
-
|
|
364
|
-
|
|
371
|
+
var s;
|
|
372
|
+
const t = this.seatReservation.coachItems[e.coachIndex], i = (s = t.places) == null ? void 0 : s.find((c) => c.number === e.number);
|
|
373
|
+
return i ? he(i, t, e.coachIndex) : null;
|
|
365
374
|
}
|
|
366
375
|
_getSeatReservationCoachSelection(e) {
|
|
367
376
|
if (!this.seatReservation.coachItems[e])
|
|
368
377
|
return null;
|
|
369
378
|
const t = this.seatReservation.coachItems[e];
|
|
370
|
-
return
|
|
379
|
+
return ne(e, t);
|
|
371
380
|
}
|
|
372
381
|
_setCurrSelectedPlaceElementId(e) {
|
|
373
382
|
e ? this.currSelectedPlaceElementId = "seat-reservation__place-button-" + this.currSelectedCoachIndex + "-" + e.number : this.currSelectedPlaceElementId = null;
|
|
@@ -380,45 +389,47 @@ let Ce = (() => {
|
|
|
380
389
|
* @returns HTMLElement or null
|
|
381
390
|
*/
|
|
382
391
|
_getPlaceHtmlElement(e, t) {
|
|
392
|
+
var c;
|
|
383
393
|
const i = t || this.currSelectedCoachIndex, s = e ? "seat-reservation__place-button-" + i + "-" + e : this.currSelectedPlaceElementId;
|
|
384
|
-
return s && this.shadowRoot
|
|
394
|
+
return s && ((c = this.shadowRoot) == null ? void 0 : c.getElementById(s)) || null;
|
|
385
395
|
}
|
|
386
396
|
//Set the vertical offset
|
|
387
397
|
_setVerticalAlignmentOffset() {
|
|
388
398
|
setTimeout(() => {
|
|
389
|
-
|
|
399
|
+
var t, i;
|
|
400
|
+
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector(".sbb-sr__wrapper");
|
|
390
401
|
if (e) {
|
|
391
|
-
const
|
|
392
|
-
this.style
|
|
402
|
+
const s = e.getBoundingClientRect().width;
|
|
403
|
+
(i = this.style) == null || i.setProperty("--sbb-seat-reservation-vertical-offset", `${s}px`);
|
|
393
404
|
}
|
|
394
405
|
});
|
|
395
406
|
}
|
|
396
|
-
},
|
|
397
|
-
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
398
|
-
|
|
407
|
+
}, p = new WeakMap(), b = new WeakMap(), P = new WeakMap(), I = new WeakMap(), m = new WeakMap(), _ = new WeakMap(), y = new WeakMap(), R = new WeakMap(), A = new WeakMap(), (() => {
|
|
408
|
+
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(o[Symbol.metadata] ?? null) : void 0;
|
|
409
|
+
n = [x({ attribute: "seat-reservation", type: Object })], k = [E(), x({ attribute: "has-navigation", type: Boolean })], B = [E(), x({ attribute: "align-vertical", type: Boolean })], F = [E(), x({ attribute: "base-grid-size", type: Number })], W = [E(), x({ attribute: "height", type: Number })], H = [E(), x({ attribute: "max-reservations", type: Number })], q = [E(), x({ attribute: "prevent-place-click", type: Boolean })], $ = [ae()], Y = [ae()], v(l, null, n, { kind: "accessor", name: "seatReservation", static: !1, private: !1, access: { has: (t) => "seatReservation" in t, get: (t) => t.seatReservation, set: (t, i) => {
|
|
399
410
|
t.seatReservation = i;
|
|
400
|
-
} }, metadata: e },
|
|
411
|
+
} }, metadata: e }, d, w), v(l, null, k, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, i) => {
|
|
401
412
|
t.hasNavigation = i;
|
|
402
|
-
} }, metadata: e },
|
|
413
|
+
} }, metadata: e }, T, z), v(l, null, B, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, i) => {
|
|
403
414
|
t.alignVertical = i;
|
|
404
|
-
} }, metadata: e },
|
|
415
|
+
} }, metadata: e }, G, V), v(l, null, F, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, i) => {
|
|
405
416
|
t.baseGridSize = i;
|
|
406
|
-
} }, metadata: e },
|
|
417
|
+
} }, metadata: e }, O, D), v(l, null, W, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, i) => {
|
|
407
418
|
t.height = i;
|
|
408
|
-
} }, metadata: e },
|
|
419
|
+
} }, metadata: e }, K, L), v(l, null, H, { kind: "accessor", name: "maxReservations", static: !1, private: !1, access: { has: (t) => "maxReservations" in t, get: (t) => t.maxReservations, set: (t, i) => {
|
|
409
420
|
t.maxReservations = i;
|
|
410
|
-
} }, metadata: e },
|
|
421
|
+
} }, metadata: e }, U, X), v(l, null, q, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, i) => {
|
|
411
422
|
t.preventPlaceClick = i;
|
|
412
|
-
} }, metadata: e },
|
|
423
|
+
} }, metadata: e }, M, j), v(l, null, $, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, i) => {
|
|
413
424
|
t.selectedCoachIndex = i;
|
|
414
|
-
} }, metadata: e },
|
|
425
|
+
} }, metadata: e }, J, Q), v(l, null, Y, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, i) => {
|
|
415
426
|
t.focusedCoachIndex = i;
|
|
416
|
-
} }, metadata: e },
|
|
417
|
-
})(),
|
|
427
|
+
} }, metadata: e }, Z, ee), e && Object.defineProperty(l, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
428
|
+
})(), l.events = {
|
|
418
429
|
selectedPlaces: "selectedPlaces",
|
|
419
430
|
selectedCoach: "selectedCoach"
|
|
420
|
-
},
|
|
431
|
+
}, l;
|
|
421
432
|
})();
|
|
422
433
|
export {
|
|
423
|
-
|
|
434
|
+
be as SeatReservationBaseElement
|
|
424
435
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
1
|
+
var N = (s) => {
|
|
2
2
|
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var o = (s,
|
|
6
|
-
import { __esDecorate as _, __runInitializers as
|
|
4
|
+
var Q = (s, a, n) => a.has(s) || N("Cannot " + n);
|
|
5
|
+
var o = (s, a, n) => (Q(s, a, "read from private field"), n ? n.call(s) : a.get(s)), h = (s, a, n) => a.has(s) ? N("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(s) : a.set(s, n), d = (s, a, n, c) => (Q(s, a, "write to private field"), c ? c.call(s, n) : a.set(s, n), n);
|
|
6
|
+
import { __esDecorate as _, __runInitializers as r } from "tslib";
|
|
7
7
|
import { forceType as p } from "@sbb-esta/lyne-elements/core/decorators.js";
|
|
8
|
-
import { css as
|
|
9
|
-
import { customElement as
|
|
10
|
-
const
|
|
11
|
-
let
|
|
12
|
-
var I, u, m, g, z, f, S,
|
|
13
|
-
let s = [
|
|
14
|
-
return
|
|
8
|
+
import { css as W, LitElement as X, html as V } from "lit";
|
|
9
|
+
import { customElement as Y, property as b } from "lit/decorators.js";
|
|
10
|
+
const Z = W`*,:before,:after{box-sizing:border-box}:host{display:block}:host .coach-border,:host .coach-wrapper,:host .graphical-element{width:var(--sbb-seat-reservation-scoped-width);height:var(--sbb-seat-reservation-scoped-height);inset-block-start:var(--sbb-seat-reservation-scoped-inset-block-start);inset-inline-start:var(--sbb-seat-reservation-scoped-inset-inline-start);z-index:var(--sbb-seat-reservation-scoped-z-index)}:host .coach-border,:host .graphical-element ::slotted(*),:host .graphical-element{position:absolute}:host .coach-border{z-index:0}`;
|
|
11
|
+
let lt = (() => {
|
|
12
|
+
var I, u, m, g, z, f, S, l;
|
|
13
|
+
let s = [Y("sbb-seat-reservation-scoped")], a, n = [], c, v = X, x, k = [], y = [], w, B = [], C = [], $, E = [], D = [], j, O = [], T = [], U, L = [], P = [], R, q = [], A = [], F, G = [], H = [];
|
|
14
|
+
return l = class extends v {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
17
|
-
h(this, I,
|
|
18
|
-
h(this, u, (
|
|
19
|
-
h(this, m, (
|
|
20
|
-
h(this, g, (
|
|
21
|
-
h(this, z, (
|
|
22
|
-
h(this, f, (
|
|
23
|
-
h(this, S, (
|
|
24
|
-
|
|
17
|
+
h(this, I, r(this, k, ""));
|
|
18
|
+
h(this, u, (r(this, y), r(this, B, "")));
|
|
19
|
+
h(this, m, (r(this, C), r(this, E, "")));
|
|
20
|
+
h(this, g, (r(this, D), r(this, O, "")));
|
|
21
|
+
h(this, z, (r(this, T), r(this, L, "")));
|
|
22
|
+
h(this, f, (r(this, P), r(this, q, "")));
|
|
23
|
+
h(this, S, (r(this, A), r(this, G, "")));
|
|
24
|
+
r(this, H);
|
|
25
25
|
}
|
|
26
26
|
/** Inset block start in pixels (without unit) */
|
|
27
27
|
get insetBlockStart() {
|
|
@@ -73,34 +73,35 @@ let it = (() => {
|
|
|
73
73
|
d(this, S, e);
|
|
74
74
|
}
|
|
75
75
|
willUpdate(e) {
|
|
76
|
-
|
|
76
|
+
var t, i, J, K, M;
|
|
77
|
+
super.willUpdate(e), e.has("width") && ((t = this.style) == null || t.setProperty("--sbb-seat-reservation-scoped-width", `${this.width}`)), e.has("height") && ((i = this.style) == null || i.setProperty("--sbb-seat-reservation-scoped-height", `${this.height}`)), e.has("insetBlockStart") && ((J = this.style) == null || J.setProperty("--sbb-seat-reservation-scoped-inset-block-start", `${this.insetBlockStart}`)), e.has("insetInlineStart") && ((K = this.style) == null || K.setProperty("--sbb-seat-reservation-scoped-inset-inline-start", `${this.insetInlineStart}`)), e.has("zIndex") && ((M = this.style) == null || M.setProperty("--sbb-seat-reservation-scoped-z-index", `${this.zIndex}`));
|
|
77
78
|
}
|
|
78
79
|
render() {
|
|
79
|
-
return this.cellId ?
|
|
80
|
+
return this.cellId ? V`<td id="${this.cellId}" class="${this.scopedClasses}">
|
|
80
81
|
<slot></slot>
|
|
81
|
-
</td>` :
|
|
82
|
+
</td>` : V`<div class="${this.scopedClasses}">
|
|
82
83
|
<slot></slot>
|
|
83
84
|
</div>`;
|
|
84
85
|
}
|
|
85
|
-
}, I = new WeakMap(), u = new WeakMap(), m = new WeakMap(), g = new WeakMap(), z = new WeakMap(), f = new WeakMap(), S = new WeakMap(), c =
|
|
86
|
+
}, I = new WeakMap(), u = new WeakMap(), m = new WeakMap(), g = new WeakMap(), z = new WeakMap(), f = new WeakMap(), S = new WeakMap(), c = l, (() => {
|
|
86
87
|
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(v[Symbol.metadata] ?? null) : void 0;
|
|
87
|
-
x = [p(), b({ attribute: "inset-block-start" })], w = [p(), b({ attribute: "inset-inline-start" })], $ = [p(), b({ attribute: "width" })], j = [p(), b({ attribute: "height" })], U = [p(), b({ attribute: "z-index" })], R = [p(), b({ attribute: "cell-id" })], F = [p(), b({ attribute: "scoped-classes" })], _(
|
|
88
|
-
t.insetBlockStart =
|
|
89
|
-
} }, metadata: e }, k, y), _(
|
|
90
|
-
t.insetInlineStart =
|
|
91
|
-
} }, metadata: e }, B, C), _(
|
|
92
|
-
t.width =
|
|
93
|
-
} }, metadata: e }, E, D), _(
|
|
94
|
-
t.height =
|
|
95
|
-
} }, metadata: e }, O, T), _(
|
|
96
|
-
t.zIndex =
|
|
97
|
-
} }, metadata: e }, L, P), _(
|
|
98
|
-
t.cellId =
|
|
99
|
-
} }, metadata: e }, q, A), _(
|
|
100
|
-
t.scopedClasses =
|
|
101
|
-
} }, metadata: e }, G, H), _(null,
|
|
102
|
-
})(),
|
|
88
|
+
x = [p(), b({ attribute: "inset-block-start" })], w = [p(), b({ attribute: "inset-inline-start" })], $ = [p(), b({ attribute: "width" })], j = [p(), b({ attribute: "height" })], U = [p(), b({ attribute: "z-index" })], R = [p(), b({ attribute: "cell-id" })], F = [p(), b({ attribute: "scoped-classes" })], _(l, null, x, { kind: "accessor", name: "insetBlockStart", static: !1, private: !1, access: { has: (t) => "insetBlockStart" in t, get: (t) => t.insetBlockStart, set: (t, i) => {
|
|
89
|
+
t.insetBlockStart = i;
|
|
90
|
+
} }, metadata: e }, k, y), _(l, null, w, { kind: "accessor", name: "insetInlineStart", static: !1, private: !1, access: { has: (t) => "insetInlineStart" in t, get: (t) => t.insetInlineStart, set: (t, i) => {
|
|
91
|
+
t.insetInlineStart = i;
|
|
92
|
+
} }, metadata: e }, B, C), _(l, null, $, { kind: "accessor", name: "width", static: !1, private: !1, access: { has: (t) => "width" in t, get: (t) => t.width, set: (t, i) => {
|
|
93
|
+
t.width = i;
|
|
94
|
+
} }, metadata: e }, E, D), _(l, null, j, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, i) => {
|
|
95
|
+
t.height = i;
|
|
96
|
+
} }, metadata: e }, O, T), _(l, null, U, { kind: "accessor", name: "zIndex", static: !1, private: !1, access: { has: (t) => "zIndex" in t, get: (t) => t.zIndex, set: (t, i) => {
|
|
97
|
+
t.zIndex = i;
|
|
98
|
+
} }, metadata: e }, L, P), _(l, null, R, { kind: "accessor", name: "cellId", static: !1, private: !1, access: { has: (t) => "cellId" in t, get: (t) => t.cellId, set: (t, i) => {
|
|
99
|
+
t.cellId = i;
|
|
100
|
+
} }, metadata: e }, q, A), _(l, null, F, { kind: "accessor", name: "scopedClasses", static: !1, private: !1, access: { has: (t) => "scopedClasses" in t, get: (t) => t.scopedClasses, set: (t, i) => {
|
|
101
|
+
t.scopedClasses = i;
|
|
102
|
+
} }, metadata: e }, G, H), _(null, a = { value: c }, s, { kind: "class", name: c.name, metadata: e }, null, n), c = a.value, e && Object.defineProperty(c, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
103
|
+
})(), l.styles = Z, r(c, n), c;
|
|
103
104
|
})();
|
|
104
105
|
export {
|
|
105
|
-
|
|
106
|
+
lt as SbbSeatReservationScopedElement
|
|
106
107
|
};
|