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