@sbb-esta/lyne-elements-experimental 2.11.1 → 2.11.3
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/custom-elements.json +852 -867
- 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.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +22 -33
- package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation/seat-reservation.component.js +18 -25
- 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}/seat-reservation-navigation-coach.component.d.ts +1 -1
- package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -0
- package/development/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-coach → seat-reservation-navigation-coach}/seat-reservation-navigation-coach.component.js +8 -12
- package/development/seat-reservation/seat-reservation-navigation-coach.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +123 -0
- package/development/seat-reservation/seat-reservation-navigation-services.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +4 -5
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -0
- package/development/seat-reservation/{seat-reservation/seat-reservation-scoped → seat-reservation-scoped}/seat-reservation-scoped.component.js +6 -7
- package/{seat-reservation → development}/seat-reservation/seat-reservation-scoped.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation.d.ts +0 -1
- package/development/seat-reservation/seat-reservation.d.ts.map +1 -1
- package/development/seat-reservation/seat-reservation.js +1 -3
- package/development/seat-reservation.d.ts +3 -1
- package/development/seat-reservation.d.ts.map +1 -1
- package/development/seat-reservation.js +3 -3
- 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/index.d.ts +3 -3
- package/index.js +3 -3
- package/isValid-Ceq2O0NQ.js +45 -0
- package/journey-summary/journey-summary.component.js +3 -4
- package/package.json +14 -19
- 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.d.ts.map +1 -1
- package/seat-reservation/seat-reservation/seat-reservation-base-element.js +104 -115
- package/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
- package/seat-reservation/seat-reservation/seat-reservation.component.js +80 -89
- 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}/seat-reservation-navigation-coach.component.d.ts +1 -1
- package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -0
- package/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-coach → seat-reservation-navigation-coach}/seat-reservation-navigation-coach.component.js +71 -75
- package/seat-reservation/seat-reservation-navigation-coach.d.ts.map +1 -0
- package/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts.map +1 -0
- package/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-services → seat-reservation-navigation-services}/seat-reservation-navigation-services.component.js +14 -15
- package/seat-reservation/seat-reservation-navigation-services.d.ts.map +1 -0
- package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +23 -24
- package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -0
- package/seat-reservation/{seat-reservation/seat-reservation-scoped → seat-reservation-scoped}/seat-reservation-scoped.component.js +40 -41
- package/seat-reservation/seat-reservation-scoped.d.ts.map +1 -0
- package/seat-reservation/seat-reservation.d.ts +0 -1
- package/seat-reservation/seat-reservation.d.ts.map +1 -1
- package/seat-reservation/seat-reservation.js +0 -2
- package/seat-reservation.d.ts +3 -1
- package/seat-reservation.d.ts.map +1 -1
- package/seat-reservation.js +12 -12
- package/timetable-row/timetable-row.component.js +207 -247
- package/development/seat-reservation/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation/seat-reservation-scoped.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +0 -123
- package/development/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-navigation.d.ts +0 -6
- package/development/seat-reservation/seat-reservation-navigation.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-navigation.js +0 -7
- package/differenceInMinutes-BMqUZdhj.js +0 -23
- package/isValid-DJ69OMZJ.js +0 -45
- package/seat-reservation/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +0 -1
- package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +0 -1
- package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-coach.d.ts.map +0 -1
- package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts.map +0 -1
- package/seat-reservation/seat-reservation-navigation/seat-reservation-navigation-services.d.ts.map +0 -1
- package/seat-reservation/seat-reservation-navigation.d.ts +0 -6
- package/seat-reservation/seat-reservation-navigation.d.ts.map +0 -1
- package/seat-reservation/seat-reservation-navigation.js +0 -6
- /package/development/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-coach.d.ts → seat-reservation-navigation-coach.d.ts} +0 -0
- /package/development/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-coach.js → seat-reservation-navigation-coach.js} +0 -0
- /package/development/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-services → seat-reservation-navigation-services}/seat-reservation-navigation-services.component.d.ts +0 -0
- /package/development/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-services.d.ts → seat-reservation-navigation-services.d.ts} +0 -0
- /package/development/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-services.js → seat-reservation-navigation-services.js} +0 -0
- /package/development/seat-reservation/{seat-reservation/seat-reservation-scoped → seat-reservation-scoped}/seat-reservation-scoped.component.d.ts +0 -0
- /package/development/seat-reservation/{seat-reservation/seat-reservation-scoped.d.ts → seat-reservation-scoped.d.ts} +0 -0
- /package/development/seat-reservation/{seat-reservation/seat-reservation-scoped.js → seat-reservation-scoped.js} +0 -0
- /package/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-coach.d.ts → seat-reservation-navigation-coach.d.ts} +0 -0
- /package/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-coach.js → seat-reservation-navigation-coach.js} +0 -0
- /package/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-services → seat-reservation-navigation-services}/seat-reservation-navigation-services.component.d.ts +0 -0
- /package/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-services.d.ts → seat-reservation-navigation-services.d.ts} +0 -0
- /package/seat-reservation/{seat-reservation-navigation/seat-reservation-navigation-services.js → seat-reservation-navigation-services.js} +0 -0
- /package/seat-reservation/{seat-reservation/seat-reservation-scoped → seat-reservation-scoped}/seat-reservation-scoped.component.d.ts +0 -0
- /package/seat-reservation/{seat-reservation/seat-reservation-scoped.d.ts → seat-reservation-scoped.d.ts} +0 -0
- /package/seat-reservation/{seat-reservation/seat-reservation-scoped.js → seat-reservation-scoped.js} +0 -0
|
@@ -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
|
};
|
|
@@ -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":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAM1E,OAAO,KAAK,EAMV,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGhF,OAAO,+CAA+C,CAAC;AACvD,OAAO,6BAA6B,CAAC;AACrC,OAAO,gCAAgC,CAAC;AACxC,OAAO,sCAAsC,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"seat-reservation.component.d.ts","sourceRoot":"","sources":["../../../../src/elements-experimental/seat-reservation/seat-reservation/seat-reservation.component.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAM1E,OAAO,KAAK,EAMV,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAGhF,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;AAEvC;;;;;GAKG;AACH,qBAEM,yBAA0B,SAAQ,0BAA0B;IAChE,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD,wEAAwE;IACxE,SACyB,eAAe,EAAE,eAAe,CAAS;IAElE,sEAAsE;IACtE,SAEyB,aAAa,EAAE,OAAO,CAAQ;IAEvD,kGAAkG;IAClG,SAEyB,aAAa,EAAE,OAAO,CAAS;IAExD,iDAAiD;IACjD,SAEyB,eAAe,EAAE,MAAM,CAAS;IAEzD,2CAA2C;IAC3C,SAEyB,iBAAiB,EAAE,OAAO,CAAS;IAE5D,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,oBAAoB,CAAC,CAAiB;IAE9C,OAAO,CAAC,gBAAgB,CAQtB;IAEF,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;cAK3D,MAAM,IAAI,cAAc,GAAG,IAAI;IAKlD,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,uCAAuC;IAwC/C,OAAO,CAAC,iBAAiB;IAqCzB;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,mBAAmB;IA0B3B,OAAO,CAAC,wBAAwB;IA+BhC,OAAO,CAAC,qBAAqB;IA0B7B,OAAO,CAAC,wBAAwB;IA2ChC,OAAO,CAAC,6BAA6B;IA0BrC,OAAO,CAAC,yBAAyB;IA2EjC,OAAO,CAAC,4BAA4B;IA0CpC,OAAO,CAAC,2BAA2B;IAyCnC;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,iBAAiB;IAazB,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,yBAAyB;IAuBjC,OAAO,CAAC,8BAA8B;CAyBvC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,sBAAsB,EAAE,yBAAyB,CAAC;KACnD;CACF"}
|