@sbb-esta/lyne-elements-experimental-dev 0.0.0 → 4.5.1-dev.1771849274
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/README.md +55 -0
- package/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.js +86 -0
- package/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.js +54 -0
- package/autocomplete-grid/autocomplete-grid-button.js +4 -0
- package/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.js +25 -0
- package/autocomplete-grid/autocomplete-grid-cell.js +4 -0
- package/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.js +29 -0
- package/autocomplete-grid/autocomplete-grid-optgroup.js +4 -0
- package/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +41 -0
- package/autocomplete-grid/autocomplete-grid-option.js +5 -0
- package/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +28 -0
- package/autocomplete-grid/autocomplete-grid-row.js +4 -0
- package/autocomplete-grid/autocomplete-grid.js +4 -0
- package/autocomplete-grid.js +15 -0
- package/core/datetime/date-helper.js +191 -0
- package/core/datetime.js +5 -0
- package/core/timetable/access-leg-helper.js +91 -0
- package/core/timetable/timetable-helper.js +12 -0
- package/core/timetable/timetable-properties.js +1 -0
- package/core/timetable.js +8 -0
- package/custom-elements.json +8211 -0
- package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.d.ts +39 -0
- package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.js +141 -0
- package/development/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.d.ts +31 -0
- package/development/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.js +82 -0
- package/development/autocomplete-grid/autocomplete-grid-button.d.ts +5 -0
- package/development/autocomplete-grid/autocomplete-grid-button.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-button.js +5 -0
- package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.d.ts +19 -0
- package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.js +40 -0
- package/development/autocomplete-grid/autocomplete-grid-cell.d.ts +5 -0
- package/development/autocomplete-grid/autocomplete-grid-cell.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-cell.js +5 -0
- package/development/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.d.ts +19 -0
- package/development/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.js +40 -0
- package/development/autocomplete-grid/autocomplete-grid-optgroup.d.ts +5 -0
- package/development/autocomplete-grid/autocomplete-grid-optgroup.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-optgroup.js +5 -0
- package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.d.ts +26 -0
- package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +134 -0
- package/development/autocomplete-grid/autocomplete-grid-option.d.ts +5 -0
- package/development/autocomplete-grid/autocomplete-grid-option.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-option.js +6 -0
- package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.d.ts +20 -0
- package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +115 -0
- package/development/autocomplete-grid/autocomplete-grid-row.d.ts +5 -0
- package/development/autocomplete-grid/autocomplete-grid-row.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid-row.js +5 -0
- package/development/autocomplete-grid/autocomplete-grid.d.ts +5 -0
- package/development/autocomplete-grid/autocomplete-grid.d.ts.map +1 -0
- package/development/autocomplete-grid/autocomplete-grid.js +5 -0
- package/development/autocomplete-grid.d.ts +10 -0
- package/development/autocomplete-grid.d.ts.map +1 -0
- package/development/autocomplete-grid.js +16 -0
- package/development/core/datetime/date-helper.d.ts +27 -0
- package/development/core/datetime/date-helper.d.ts.map +1 -0
- package/development/core/datetime/date-helper.js +285 -0
- package/development/core/datetime.d.ts +5 -0
- package/development/core/datetime.d.ts.map +1 -0
- package/development/core/datetime.js +6 -0
- package/development/core/timetable/access-leg-helper.d.ts +26 -0
- package/development/core/timetable/access-leg-helper.d.ts.map +1 -0
- package/development/core/timetable/access-leg-helper.js +125 -0
- package/development/core/timetable/timetable-helper.d.ts +12 -0
- package/development/core/timetable/timetable-helper.d.ts.map +1 -0
- package/development/core/timetable/timetable-helper.js +20 -0
- package/development/core/timetable/timetable-properties.d.ts +308 -0
- package/development/core/timetable/timetable-properties.d.ts.map +1 -0
- package/development/core/timetable/timetable-properties.js +2 -0
- package/development/core/timetable.d.ts +7 -0
- package/development/core/timetable.d.ts.map +1 -0
- package/development/core/timetable.js +9 -0
- package/development/differenceInMinutes-B0dawX-5.js +26 -0
- package/development/format-BMkeaqaF.js +1433 -0
- package/development/isValid-BYRch7pV.js +53 -0
- package/development/journey-summary/journey-summary.component.d.ts +65 -0
- package/development/journey-summary/journey-summary.component.d.ts.map +1 -0
- package/development/journey-summary/journey-summary.component.js +294 -0
- package/development/journey-summary.d.ts +5 -0
- package/development/journey-summary.d.ts.map +1 -0
- package/development/journey-summary.js +5 -0
- package/development/pearl-chain/pearl-chain.component.d.ts +42 -0
- package/development/pearl-chain/pearl-chain.component.d.ts.map +1 -0
- package/development/pearl-chain/pearl-chain.component.js +639 -0
- package/development/pearl-chain-time/pearl-chain-time.component.d.ts +47 -0
- package/development/pearl-chain-time/pearl-chain-time.component.d.ts.map +1 -0
- package/development/pearl-chain-time/pearl-chain-time.component.js +312 -0
- package/development/pearl-chain-time.d.ts +5 -0
- package/development/pearl-chain-time.d.ts.map +1 -0
- package/development/pearl-chain-time.js +5 -0
- package/development/pearl-chain-vertical/pearl-chain-vertical.component.d.ts +16 -0
- package/development/pearl-chain-vertical/pearl-chain-vertical.component.d.ts.map +1 -0
- package/development/pearl-chain-vertical/pearl-chain-vertical.component.js +40 -0
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.d.ts +34 -0
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.d.ts.map +1 -0
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +398 -0
- package/development/pearl-chain-vertical-item.d.ts +5 -0
- package/development/pearl-chain-vertical-item.d.ts.map +1 -0
- package/development/pearl-chain-vertical-item.js +5 -0
- package/development/pearl-chain-vertical.d.ts +5 -0
- package/development/pearl-chain-vertical.d.ts.map +1 -0
- package/development/pearl-chain-vertical.js +5 -0
- package/development/pearl-chain.d.ts +5 -0
- package/development/pearl-chain.d.ts.map +1 -0
- package/development/pearl-chain.js +5 -0
- package/development/seat-reservation/common/mapper/icon-mapper.d.ts +106 -0
- package/development/seat-reservation/common/mapper/icon-mapper.d.ts.map +1 -0
- package/development/seat-reservation/common/mapper/icon-mapper.js +72 -0
- package/development/seat-reservation/common/mapper/mapper.d.ts +34 -0
- package/development/seat-reservation/common/mapper/mapper.d.ts.map +1 -0
- package/development/seat-reservation/common/mapper/mapper.js +129 -0
- package/development/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts +372 -0
- package/development/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts.map +1 -0
- package/development/seat-reservation/common/mapper/seat-reservation-sample-data.js +31673 -0
- package/development/seat-reservation/common/mapper.d.ts +3 -0
- package/development/seat-reservation/common/mapper.d.ts.map +1 -0
- package/development/seat-reservation/common/mapper.js +10 -0
- package/development/seat-reservation/common/svgs.d.ts +24 -0
- package/development/seat-reservation/common/svgs.d.ts.map +1 -0
- package/development/seat-reservation/common/svgs.js +46 -0
- package/development/seat-reservation/common/translations/i18n.d.ts +28 -0
- package/development/seat-reservation/common/translations/i18n.d.ts.map +1 -0
- package/development/seat-reservation/common/translations/i18n.js +871 -0
- package/development/seat-reservation/common/translations.d.ts +2 -0
- package/development/seat-reservation/common/translations.d.ts.map +1 -0
- package/development/seat-reservation/common/translations.js +5 -0
- package/development/seat-reservation/common/types.d.ts +97 -0
- package/development/seat-reservation/common/types.d.ts.map +1 -0
- package/development/seat-reservation/common/types.js +2 -0
- package/development/seat-reservation/common.d.ts +8 -0
- package/development/seat-reservation/common.d.ts.map +1 -0
- package/development/seat-reservation/common.js +14 -0
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +273 -0
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +1171 -0
- package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts +75 -0
- package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation/seat-reservation.component.js +832 -0
- package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.d.ts +18 -0
- package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +112 -0
- package/development/seat-reservation/seat-reservation-area.d.ts +5 -0
- package/development/seat-reservation/seat-reservation-area.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-area.js +5 -0
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.d.ts +9 -0
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +303 -0
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.d.ts +20 -0
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +167 -0
- package/development/seat-reservation/seat-reservation-graphic.d.ts +5 -0
- package/development/seat-reservation/seat-reservation-graphic.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-graphic.js +5 -0
- package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +65 -0
- 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-coach/seat-reservation-navigation-coach.component.js +798 -0
- package/development/seat-reservation/seat-reservation-navigation-coach.d.ts +5 -0
- package/development/seat-reservation/seat-reservation-navigation-coach.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-navigation-coach.js +5 -0
- package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts +21 -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 +120 -0
- package/development/seat-reservation/seat-reservation-navigation-services.d.ts +5 -0
- package/development/seat-reservation/seat-reservation-navigation-services.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-navigation-services.js +5 -0
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts +42 -0
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +462 -0
- package/development/seat-reservation/seat-reservation-place-control.d.ts +5 -0
- package/development/seat-reservation/seat-reservation-place-control.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-place-control.js +5 -0
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts +14 -0
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +34 -0
- package/development/seat-reservation/seat-reservation-scoped.d.ts +5 -0
- package/development/seat-reservation/seat-reservation-scoped.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation-scoped.js +5 -0
- package/development/seat-reservation/seat-reservation.d.ts +6 -0
- package/development/seat-reservation/seat-reservation.d.ts.map +1 -0
- package/development/seat-reservation/seat-reservation.js +7 -0
- package/development/seat-reservation.d.ts +12 -0
- package/development/seat-reservation.d.ts.map +1 -0
- package/development/seat-reservation.js +30 -0
- package/development/timetable-duration/timetable-duration.component.d.ts +22 -0
- package/development/timetable-duration/timetable-duration.component.d.ts.map +1 -0
- package/development/timetable-duration/timetable-duration.component.js +114 -0
- package/development/timetable-duration.d.ts +5 -0
- package/development/timetable-duration.d.ts.map +1 -0
- package/development/timetable-duration.js +5 -0
- package/development/timetable-row/timetable-row.component.d.ts +87 -0
- package/development/timetable-row/timetable-row.component.d.ts.map +1 -0
- package/development/timetable-row/timetable-row.component.js +787 -0
- package/development/timetable-row.d.ts +5 -0
- package/development/timetable-row.d.ts.map +1 -0
- package/development/timetable-row.js +12 -0
- package/development/toDate-BWb6Z1JD.js +24 -0
- package/differenceInMinutes-COvvdYsJ.js +23 -0
- package/format-CmKROkbc.js +1186 -0
- package/index.d.ts +44 -0
- package/index.js +43 -0
- package/isValid-m3_OsPaB.js +45 -0
- package/journey-summary/journey-summary.component.js +193 -0
- package/journey-summary.js +4 -0
- package/package.json +161 -1
- package/pearl-chain/pearl-chain.component.js +164 -0
- package/pearl-chain-time/pearl-chain-time.component.js +156 -0
- package/pearl-chain-time.js +4 -0
- package/pearl-chain-vertical/pearl-chain-vertical.component.js +24 -0
- package/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +76 -0
- package/pearl-chain-vertical-item.js +4 -0
- package/pearl-chain-vertical.js +4 -0
- package/pearl-chain.js +4 -0
- package/seat-reservation/common/mapper/icon-mapper.js +71 -0
- package/seat-reservation/common/mapper/mapper.js +89 -0
- package/seat-reservation/common/mapper/seat-reservation-sample-data.js +31668 -0
- package/seat-reservation/common/mapper.js +9 -0
- package/seat-reservation/common/svgs.js +243 -0
- package/seat-reservation/common/translations/i18n.js +861 -0
- package/seat-reservation/common/translations.js +4 -0
- package/seat-reservation/common/types.js +1 -0
- package/seat-reservation/common.js +13 -0
- package/seat-reservation/seat-reservation/seat-reservation-base-element.js +756 -0
- package/seat-reservation/seat-reservation/seat-reservation.component.js +410 -0
- package/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +50 -0
- package/seat-reservation/seat-reservation-area.js +4 -0
- package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +292 -0
- package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +73 -0
- package/seat-reservation/seat-reservation-graphic.js +4 -0
- package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +277 -0
- package/seat-reservation/seat-reservation-navigation-coach.js +4 -0
- package/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +73 -0
- package/seat-reservation/seat-reservation-navigation-services.js +4 -0
- package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +167 -0
- package/seat-reservation/seat-reservation-place-control.js +4 -0
- package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +20 -0
- package/seat-reservation/seat-reservation-scoped.js +4 -0
- package/seat-reservation/seat-reservation.js +6 -0
- package/seat-reservation.js +29 -0
- package/timetable-duration/timetable-duration.component.js +56 -0
- package/timetable-duration.js +4 -0
- package/timetable-row/timetable-row.component.js +426 -0
- package/timetable-row.js +11 -0
- package/toDate-Bw2KTWeq.js +15 -0
|
@@ -0,0 +1,756 @@
|
|
|
1
|
+
var fe = (l) => {
|
|
2
|
+
throw TypeError(l);
|
|
3
|
+
};
|
|
4
|
+
var Ce = (l, d, u) => d.has(l) || fe("Cannot " + u);
|
|
5
|
+
var g = (l, d, u) => (Ce(l, d, "read from private field"), u ? u.call(l) : d.get(l)), v = (l, d, u) => d.has(l) ? fe("Cannot add the same private member more than once") : d instanceof WeakSet ? d.add(l) : d.set(l, u), r = (l, d, u, T) => (Ce(l, d, "write to private field"), T ? T.call(l, u) : d.set(l, u), u);
|
|
6
|
+
import { __runInitializers as n, __esDecorate as f } from "tslib";
|
|
7
|
+
import { isArrowKeyOrPageKeysPressed as Se } from "@sbb-esta/lyne-elements/core/a11y.js";
|
|
8
|
+
import { forceType as S } from "@sbb-esta/lyne-elements/core/decorators.js";
|
|
9
|
+
import { LitElement as xe, isServer as pe } from "lit";
|
|
10
|
+
import { property as C, state as w, eventOptions as _e } from "lit/decorators.js";
|
|
11
|
+
import { mapIconToSvg as Ie, mapPlaceInfosToPlaceSelection as me, mapPlaceAndCoachToSeatReservationPlaceSelection as ye, mapCoachInfosToCoachSelection as be } from "../common/mapper.js";
|
|
12
|
+
var I;
|
|
13
|
+
(function(l) {
|
|
14
|
+
l.right = "right", l.left = "left";
|
|
15
|
+
})(I || (I = {}));
|
|
16
|
+
const Pe = 3, Ae = [
|
|
17
|
+
"sa-vo",
|
|
18
|
+
"sa-rs",
|
|
19
|
+
"sa-abteilkinderwagen",
|
|
20
|
+
"sa-wr",
|
|
21
|
+
"sa-fa",
|
|
22
|
+
"sa-bz",
|
|
23
|
+
"sa-rz"
|
|
24
|
+
];
|
|
25
|
+
let ze = (() => {
|
|
26
|
+
var x, p, _, m, y, b, P, A, E, R, N, k, h;
|
|
27
|
+
let l = xe, d = [], u, T = [], B = [], z, G = [], O = [], F, V = [], L = [], W, H = [], K = [], M, X = [], U = [], q, $ = [], j = [], Y, J = [], Q = [], Z, ee = [], te = [], se, ie = [], ae = [], ce, oe = [], re = [], ne, le = [], he = [], de, ue = [], ge = [], ve;
|
|
28
|
+
return h = class extends l {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
v(this, x);
|
|
32
|
+
v(this, p);
|
|
33
|
+
v(this, _);
|
|
34
|
+
v(this, m);
|
|
35
|
+
v(this, y);
|
|
36
|
+
v(this, b);
|
|
37
|
+
v(this, P);
|
|
38
|
+
v(this, A);
|
|
39
|
+
v(this, E);
|
|
40
|
+
v(this, R);
|
|
41
|
+
v(this, N);
|
|
42
|
+
v(this, k);
|
|
43
|
+
r(this, x, (n(this, d), n(this, T, null))), r(this, p, (n(this, B), n(this, G, !0))), r(this, _, (n(this, O), n(this, V, !1))), r(this, m, (n(this, L), n(this, H, 16))), r(this, y, (n(this, K), n(this, X, null))), r(this, b, (n(this, U), n(this, $, -1))), r(this, P, (n(this, j), n(this, J, -1))), r(this, A, (n(this, Q), n(this, ee, !1))), r(this, E, (n(this, te), n(this, ie, -1))), r(this, R, (n(this, ae), n(this, oe, -1))), r(this, N, (n(this, re), n(this, le, -1))), r(this, k, (n(this, he), n(this, ue, -1))), this.coachBorderPadding = (n(this, ge), 6), this.gapBetweenCoaches = 4, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.gapBetweenCoachDecks = 48, this.coachNavButtonDim = 0, this.coachNavData = [], this.currScrollDirection = I.right, this.maxCalcCoachesWidth = 0, this.scrollCoachesAreaWidth = 0, this.scrollNavigationAreaDim = 0, this.triggerCoachPositionsCollection = [], this.navigationScrollArea = null, this.coachScrollArea = null, this.currSelectedPlace = null, this.currSelectedPlaceElementId = null, this.currSelectedCoachIndex = -1, this.currSelectedDeckIndex = 0, this.preventCoachScrollByPlaceClick = !1, this.selectedSeatReservationPlaces = {
|
|
44
|
+
seats: [],
|
|
45
|
+
bicycles: []
|
|
46
|
+
}, this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.hasMultipleDecks = !1, this.hasSeatReservationNativeFocus = !1, this.keyboardNavigationEvents = {
|
|
47
|
+
ArrowLeft: "ArrowLeft",
|
|
48
|
+
ArrowRight: "ArrowRight",
|
|
49
|
+
ArrowUp: "ArrowUp",
|
|
50
|
+
ArrowDown: "ArrowDown",
|
|
51
|
+
Tab: "Tab",
|
|
52
|
+
Enter: "Enter"
|
|
53
|
+
}, this.notAreaElements = [
|
|
54
|
+
"DRIVER_AREA",
|
|
55
|
+
"COACH_PASSAGE",
|
|
56
|
+
"COACH_WALL_NO_PASSAGE",
|
|
57
|
+
"COMPARTMENT_PASSAGE",
|
|
58
|
+
"COMPARTMENT_PASSAGE_HIGH",
|
|
59
|
+
"COMPARTMENT_PASSAGE_MIDDLE",
|
|
60
|
+
"COMPARTMENT_PASSAGE_LOW"
|
|
61
|
+
], this.overHangingElementInformation = [], this._isRunningInitPreselectCoachIndex = !1, this._lastStartScrollPos = -1, this._prepareServiceIconsNavigation = (e) => {
|
|
62
|
+
if (!e)
|
|
63
|
+
return [];
|
|
64
|
+
const t = e?.map(function(s) {
|
|
65
|
+
return {
|
|
66
|
+
pId: s,
|
|
67
|
+
svgName: Ie[s]?.svgName ? Ie[s]?.svgName : ""
|
|
68
|
+
};
|
|
69
|
+
}).filter((s) => Ae.indexOf(s.svgName) !== -1).filter((s, i, a) => a.map((o) => o.svgName).indexOf(s.svgName) === i).map((s) => s.pId).slice(0, Pe);
|
|
70
|
+
return t || [];
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** The seat reservations array contains all coaches and places */
|
|
74
|
+
get seatReservations() {
|
|
75
|
+
return g(this, x);
|
|
76
|
+
}
|
|
77
|
+
set seatReservations(e) {
|
|
78
|
+
r(this, x, e);
|
|
79
|
+
}
|
|
80
|
+
/** The seat reservation navigation can be toggled by this property */
|
|
81
|
+
get hasNavigation() {
|
|
82
|
+
return g(this, p);
|
|
83
|
+
}
|
|
84
|
+
set hasNavigation(e) {
|
|
85
|
+
r(this, p, e);
|
|
86
|
+
}
|
|
87
|
+
/** The seat reservation area is aligned vertically */
|
|
88
|
+
get alignVertical() {
|
|
89
|
+
return g(this, _);
|
|
90
|
+
}
|
|
91
|
+
set alignVertical(e) {
|
|
92
|
+
r(this, _, e);
|
|
93
|
+
}
|
|
94
|
+
/** The seat reservation area's base grid size */
|
|
95
|
+
get baseGridSize() {
|
|
96
|
+
return g(this, m);
|
|
97
|
+
}
|
|
98
|
+
set baseGridSize(e) {
|
|
99
|
+
r(this, m, e);
|
|
100
|
+
}
|
|
101
|
+
/** The seat reservation area's width */
|
|
102
|
+
get height() {
|
|
103
|
+
return g(this, y);
|
|
104
|
+
}
|
|
105
|
+
set height(e) {
|
|
106
|
+
r(this, y, e);
|
|
107
|
+
}
|
|
108
|
+
/** Maximal number of possible clickable seats */
|
|
109
|
+
get maxSeatReservations() {
|
|
110
|
+
return g(this, b);
|
|
111
|
+
}
|
|
112
|
+
set maxSeatReservations(e) {
|
|
113
|
+
r(this, b, e);
|
|
114
|
+
}
|
|
115
|
+
/** Maximal number of possible clickable bicycle places */
|
|
116
|
+
get maxBicycleReservations() {
|
|
117
|
+
return g(this, P);
|
|
118
|
+
}
|
|
119
|
+
set maxBicycleReservations(e) {
|
|
120
|
+
r(this, P, e);
|
|
121
|
+
}
|
|
122
|
+
/** Any click functionality is prevented */
|
|
123
|
+
get preventPlaceClick() {
|
|
124
|
+
return g(this, A);
|
|
125
|
+
}
|
|
126
|
+
set preventPlaceClick(e) {
|
|
127
|
+
r(this, A, e);
|
|
128
|
+
}
|
|
129
|
+
get preselectCoachIndex() {
|
|
130
|
+
return g(this, E);
|
|
131
|
+
}
|
|
132
|
+
set preselectCoachIndex(e) {
|
|
133
|
+
r(this, E, e);
|
|
134
|
+
}
|
|
135
|
+
get selectedCoachIndex() {
|
|
136
|
+
return g(this, R);
|
|
137
|
+
}
|
|
138
|
+
set selectedCoachIndex(e) {
|
|
139
|
+
r(this, R, e);
|
|
140
|
+
}
|
|
141
|
+
get focusedCoachIndex() {
|
|
142
|
+
return g(this, N);
|
|
143
|
+
}
|
|
144
|
+
set focusedCoachIndex(e) {
|
|
145
|
+
r(this, N, e);
|
|
146
|
+
}
|
|
147
|
+
get hoveredCoachIndex() {
|
|
148
|
+
return g(this, k);
|
|
149
|
+
}
|
|
150
|
+
set hoveredCoachIndex(e) {
|
|
151
|
+
r(this, k, e);
|
|
152
|
+
}
|
|
153
|
+
willUpdate(e) {
|
|
154
|
+
if (super.willUpdate(e), e.has("seatReservations") && (this.hasMultipleDecks = this.seatReservations?.length > 1, this._initPrepareSeatReservationData(), this._prepareCoachWidthAndGapCalculations(), this._initSeatReservationPlaceSelection(), this.initNavigationSelectionByScrollEvent()), e.has("baseGridSize") && (this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent()), e.has("height") && this.height) {
|
|
155
|
+
const t = this.seatReservations[this.currSelectedDeckIndex] || null;
|
|
156
|
+
t?.coachItems.length && (this.baseGridSize = this.height / t.coachItems[0].dimension.h, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this.initNavigationSelectionByScrollEvent());
|
|
157
|
+
}
|
|
158
|
+
e.has("alignVertical") && this.alignVertical && this.initNavigationSelectionByScrollEvent(), e.has("preselectCoachIndex") && (this._isRunningInitPreselectCoachIndex = !0, setTimeout(() => this.scrollToSelectedNavCoach(this.preselectCoachIndex), 1));
|
|
159
|
+
}
|
|
160
|
+
navigateByDirectionBtn(e) {
|
|
161
|
+
this.unfocusPlaceElement();
|
|
162
|
+
let t = this.currSelectedCoachIndex;
|
|
163
|
+
e == "DIRECTION_LEFT" && t > 0 ? t = this.currSelectedCoachIndex != -1 ? this.currSelectedCoachIndex - 1 : 0 : e == "DIRECTION_RIGHT" && t < this.seatReservations[this.currSelectedDeckIndex]?.coachItems.length - 1 && (t = this.currSelectedCoachIndex != -1 ? this.currSelectedCoachIndex + 1 : 0), this.scrollToSelectedNavCoach(t);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Data can be prepared once for the entire component
|
|
167
|
+
* in order to avoid recurring iteration processes in rendering.
|
|
168
|
+
*/
|
|
169
|
+
_initPrepareSeatReservationData() {
|
|
170
|
+
this._determineBaseFontSize(), this.hasMultipleDecks && this._initEmptyCoachDeckOffsets(), this._prepareNavigationCoachData();
|
|
171
|
+
}
|
|
172
|
+
/** Init scroll event handling for coach navigation */
|
|
173
|
+
initNavigationSelectionByScrollEvent() {
|
|
174
|
+
this.coachScrollArea = this.shadowRoot?.querySelector("#sbb-sr__wrapper-scrollarea"), this.navigationScrollArea = this.shadowRoot?.querySelector("#sbb-sr__navigation-list-coaches");
|
|
175
|
+
const e = this.seatReservations ? this.seatReservations[this.currSelectedDeckIndex] : null;
|
|
176
|
+
if (e && e.coachItems.length > 0) {
|
|
177
|
+
const t = e.coachItems[0].dimension.h * this.baseGridSize + this.coachBorderPadding, s = (this.seatReservations.length - 1) * this.gapBetweenCoachDecks;
|
|
178
|
+
this.style?.setProperty("--sbb-seat-reservation-height", `${t * this.seatReservations.length + s}`), this.style?.setProperty("--sbb-seat-reservation-decks", `${this.seatReservations.length}`);
|
|
179
|
+
}
|
|
180
|
+
if (this.navigationScrollArea) {
|
|
181
|
+
this.scrollNavigationAreaDim = this.alignVertical ? this.navigationScrollArea.getBoundingClientRect().height : this.navigationScrollArea.getBoundingClientRect().width;
|
|
182
|
+
const t = this.navigationScrollArea.querySelector("ul > li");
|
|
183
|
+
if (t) {
|
|
184
|
+
const s = t?.getBoundingClientRect();
|
|
185
|
+
this.coachNavButtonDim = this.alignVertical ? s.height : s.width;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (this.coachScrollArea && e) {
|
|
189
|
+
let t = 0;
|
|
190
|
+
this.scrollCoachesAreaWidth = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = e.coachItems.map((s) => {
|
|
191
|
+
const i = t, a = this.getCalculatedDimension(s.dimension).w, o = this.overHangingElementInformation.find((D) => D.coachId === s.id), c = o?.overhangingPlaces || o?.overhangingGraphicAreas;
|
|
192
|
+
return t += a + (c ? 2 * this.gapBetweenCoaches : this.gapBetweenCoaches), {
|
|
193
|
+
start: i,
|
|
194
|
+
end: t,
|
|
195
|
+
width: a
|
|
196
|
+
};
|
|
197
|
+
}), this.maxCalcCoachesWidth = t;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Scroll event handler managed the end of scrolling inside the coach scroll area.
|
|
202
|
+
* Timeout event handling to check if the scrolling has been completed.
|
|
203
|
+
* It is required because the Safari browser does not handle scrollend event,
|
|
204
|
+
* and we therefore imitate this event -> scrollend.
|
|
205
|
+
*/
|
|
206
|
+
coachAreaScrollend() {
|
|
207
|
+
this._scrollTimeout && clearTimeout(this._scrollTimeout), this._scrollTimeout = setTimeout(() => this._handleCoachAreaScrollendEvent(), 150);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* If no navigation exists (property setting -> hasNavigation) and a table coach gets the focus,
|
|
211
|
+
* the first place in the coach must be automatically preselected to control the place navigation via keyboard
|
|
212
|
+
*
|
|
213
|
+
* @param focusCoachIndex
|
|
214
|
+
*/
|
|
215
|
+
onFocusTableCoachAndPreselectPlace(e) {
|
|
216
|
+
!this.seatReservationWithoutNavigationHasFocus && !this.hasNavigation && (this.seatReservationWithoutNavigationHasFocus = !0, this.currSelectedCoachIndex = e === 0 ? this.getNextAvailableCoachIndex(-1) : this.getPrevAvailableCoachIndex(e), this.preselectPlaceInCoach());
|
|
217
|
+
}
|
|
218
|
+
/** Will be triggered by focus navigation direction */
|
|
219
|
+
onFocusNavDirectionButton() {
|
|
220
|
+
this.focusedCoachIndex = -1;
|
|
221
|
+
}
|
|
222
|
+
/** TAB Key Event handling for Coach Navigation */
|
|
223
|
+
onKeyNavigationNavCoachButton(e, t) {
|
|
224
|
+
if (e.key === this.keyboardNavigationEvents.Tab) {
|
|
225
|
+
this._handleTabKeyNavigation(e, "navigation", t);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
Se(e) && this.keyboardSeatmapEventHandling(e);
|
|
229
|
+
}
|
|
230
|
+
/** General TAB Key Event handling for tab navigation inside the coach navigation area and the seatmap area */
|
|
231
|
+
_handleTabKeyNavigation(e, t, s) {
|
|
232
|
+
const i = e.key, a = e.shiftKey;
|
|
233
|
+
i === this.keyboardNavigationEvents.Tab && (t == "navigation" ? (s == this.currSelectedCoachIndex ? !this.currSelectedPlace || !a || this.coachNavData[s].isDriverArea || this.focusedCoachIndex == -1 ? this.focusedCoachIndex = s : a && this.currSelectedPlace && (this.focusedCoachIndex = -1, this.focusPlaceElement(this.currSelectedPlace)) : this.focusedCoachIndex = s, this._scrollToSelectedNavigationButton(s)) : t == "seatmap" && (e.preventDefault(), a ? this._navigateCoachNavigationByKeyboard("PREV_TAB") : this._navigateCoachNavigationByKeyboard("NEXT_TAB")));
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Initialisation of Keyboard Seatmap event handling to navigation between each places inside a selected coach by using [arrow] keys.
|
|
237
|
+
* With the [TAB] key the user navigation goes to the next coach navigation element and the currently selected place is automatically reset.
|
|
238
|
+
*/
|
|
239
|
+
keyboardSeatmapEventHandling(e) {
|
|
240
|
+
const t = e.key;
|
|
241
|
+
if (this.preventCoachScrollByPlaceClick = !1, !this.hasSeatReservationNativeFocus && (e.shiftKey && t === this.keyboardNavigationEvents.Tab || t === this.keyboardNavigationEvents.Tab) && (this.hasSeatReservationNativeFocus = !0), t == this.keyboardNavigationEvents.Tab) {
|
|
242
|
+
this._handleTabKeyNavigation(e, "seatmap");
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (this.currSelectedCoachIndex !== -1 && Se(e))
|
|
246
|
+
switch (e.preventDefault(), t) {
|
|
247
|
+
case this.keyboardNavigationEvents.ArrowLeft:
|
|
248
|
+
{
|
|
249
|
+
const s = this.alignVertical ? this.keyboardNavigationEvents.ArrowDown : t;
|
|
250
|
+
this._navigateToPlaceByKeyboard(s);
|
|
251
|
+
}
|
|
252
|
+
break;
|
|
253
|
+
case this.keyboardNavigationEvents.ArrowRight:
|
|
254
|
+
{
|
|
255
|
+
const s = this.alignVertical ? this.keyboardNavigationEvents.ArrowUp : t;
|
|
256
|
+
this._navigateToPlaceByKeyboard(s);
|
|
257
|
+
}
|
|
258
|
+
break;
|
|
259
|
+
case this.keyboardNavigationEvents.ArrowUp:
|
|
260
|
+
{
|
|
261
|
+
const s = this.alignVertical ? this.keyboardNavigationEvents.ArrowLeft : t;
|
|
262
|
+
this._navigateToPlaceByKeyboard(s);
|
|
263
|
+
}
|
|
264
|
+
break;
|
|
265
|
+
case this.keyboardNavigationEvents.ArrowDown:
|
|
266
|
+
{
|
|
267
|
+
const s = this.alignVertical ? this.keyboardNavigationEvents.ArrowRight : t;
|
|
268
|
+
this._navigateToPlaceByKeyboard(s);
|
|
269
|
+
}
|
|
270
|
+
break;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Selects a place inside the coach if navigated via keyboard,
|
|
275
|
+
* otherwise the coach grid is selected (necessary for ScreenReader)
|
|
276
|
+
*/
|
|
277
|
+
preselectPlaceInCoach() {
|
|
278
|
+
if (this.isAutoScrolling) {
|
|
279
|
+
if (this._isRunningInitPreselectCoachIndex) {
|
|
280
|
+
this._isRunningInitPreselectCoachIndex = !1;
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
if (this.coachNavData[this.currSelectedCoachIndex] && this.coachNavData[this.currSelectedCoachIndex].isDriverArea) {
|
|
284
|
+
this._setFocusToSelectedCoachGrid();
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (this.isKeyboardNavigation && this.isAutoScrolling) {
|
|
288
|
+
const e = this._getClosestPlaceByKeyDirection();
|
|
289
|
+
e ? (this.unfocusPlaceElement(), this.focusPlaceElement(e), this.focusedCoachIndex = -1) : this._setFocusToSelectedCoachGrid();
|
|
290
|
+
} else
|
|
291
|
+
this.unfocusPlaceElement(), this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
scrollToSelectedNavCoach(e) {
|
|
295
|
+
if (this._isValidCoachIndex(e) && e !== this.currSelectedCoachIndex) {
|
|
296
|
+
this.hoveredCoachIndex = e, this.isAutoScrolling = !0, this.isCoachGridFocusable = !0, this.currSelectedCoachIndex = e, this.currSelectedDeckIndex = this._getExistingCoachDeckIndex(), this._setScrollDirectionByCoachIndex();
|
|
297
|
+
const t = this._getCoachScrollPositionX();
|
|
298
|
+
(this.selectedCoachIndex !== -1 || this.currSelectedCoachIndex > 0) && this._isScrollableToSelectedCoach() ? (this._lastStartScrollPos = this.coachScrollArea.scrollLeft, this.coachScrollArea.scrollTo({
|
|
299
|
+
top: this.alignVertical ? t : 0,
|
|
300
|
+
left: this.alignVertical ? 0 : t,
|
|
301
|
+
behavior: "smooth"
|
|
302
|
+
})) : this.updateCurrentSelectedCoach(), this._scrollToSelectedNavigationButton(e);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
focusPlaceElement(e) {
|
|
306
|
+
if (this.unfocusPlaceElement(), e) {
|
|
307
|
+
this.currSelectedPlace = e, this._setCurrSelectedPlaceElementId(e);
|
|
308
|
+
const t = this._getPlaceHtmlElement();
|
|
309
|
+
if (t) {
|
|
310
|
+
t.setAttribute("keyfocus", "focus");
|
|
311
|
+
const s = setTimeout(() => {
|
|
312
|
+
const i = this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number);
|
|
313
|
+
this._scrollPlaceIntoNearestViewport(i), clearTimeout(s);
|
|
314
|
+
}, 0);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
unfocusPlaceElement() {
|
|
319
|
+
const e = this._getPlaceHtmlElement();
|
|
320
|
+
e && (e.setAttribute("keyfocus", "unfocus"), this._setCurrSelectedPlaceElementId(null), this.currSelectedPlace = null);
|
|
321
|
+
}
|
|
322
|
+
getCalculatedDimension(e, t, s, i) {
|
|
323
|
+
return t && !s && (e.h += this.coachBorderOffset * 2), i && (e.h += this.coachBorderOffset), {
|
|
324
|
+
w: this.baseGridSize * e.w,
|
|
325
|
+
h: this.baseGridSize * e.h
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
getCalculatedPosition(e, t, s, i) {
|
|
329
|
+
if (s && t) {
|
|
330
|
+
const a = i ? s.h : s.h + this.coachBorderOffset;
|
|
331
|
+
e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === a && (e.y += this.coachBorderOffset);
|
|
332
|
+
}
|
|
333
|
+
return {
|
|
334
|
+
x: this.baseGridSize * e.x,
|
|
335
|
+
y: this.baseGridSize * e.y,
|
|
336
|
+
z: e.z
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* detects if a (graphical) element is on the border with its position (upper or lower border).
|
|
341
|
+
* @param baseElement
|
|
342
|
+
* @param coachDimension
|
|
343
|
+
* @protected
|
|
344
|
+
*/
|
|
345
|
+
isElementDirectlyOnBorder(e, t) {
|
|
346
|
+
return e.position.y === 0 || e.position.y + e.dimension.h === t.h;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Counts all available seats together depending on the seat type
|
|
350
|
+
*
|
|
351
|
+
* @param places
|
|
352
|
+
* @returns An Object with count of free seats and free bicycle places
|
|
353
|
+
*/
|
|
354
|
+
getAvailableFreePlacesNumFromCoach(e) {
|
|
355
|
+
const t = { seats: 0, bicycles: 0 }, s = e?.reduce((i, a) => (a.state !== "FREE" || (a.type === "SEAT" ? i.seats++ : i.bicycles++), i), t);
|
|
356
|
+
return s || t;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* At the end of a scroll Event from the coach scrollable area,
|
|
360
|
+
* the reached coach is marked as selected
|
|
361
|
+
*/
|
|
362
|
+
_handleCoachAreaScrollendEvent() {
|
|
363
|
+
const e = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
|
|
364
|
+
if (this.preventCoachScrollByPlaceClick) {
|
|
365
|
+
Math.abs(this._lastStartScrollPos - this.coachScrollArea.scrollLeft) > this.baseGridSize * 2 && (this.selectedCoachIndex = e), this.preventCoachScrollByPlaceClick = !1;
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
this._lastStartScrollPos = this.coachScrollArea.scrollLeft, this.hoveredCoachIndex = -1, this.currSelectedCoachIndex === -1 && (this.currSelectedCoachIndex = e), this._isScrollableToSelectedCoach() ? this.currSelectedCoachIndex = e : this.currSelectedCoachIndex = e < this.currSelectedCoachIndex ? this.currSelectedCoachIndex : e, this.isAutoScrolling || this._scrollToSelectedNavigationButton(e), this.preventCoachScrollByPlaceClick = !1, this.updateCurrentSelectedCoach(), this.hasNavigation || (this.preselectPlaceInCoach(), this.isAutoScrolling = !1);
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Performs an automatic main navigation scroll to the specified selectedNavCoachIndex.
|
|
372
|
+
* Calculates the central scroll offset of the nav coach to be selected.
|
|
373
|
+
* @param selectedNavCoachIndex
|
|
374
|
+
*/
|
|
375
|
+
_scrollToSelectedNavigationButton(e) {
|
|
376
|
+
setTimeout(() => {
|
|
377
|
+
if (this.hasNavigation && this.navigationScrollArea) {
|
|
378
|
+
const t = this.scrollNavigationAreaDim / 2, i = e * this.coachNavButtonDim - t + this.coachNavButtonDim;
|
|
379
|
+
this.navigationScrollArea.scrollTo({
|
|
380
|
+
top: this.alignVertical ? i : 0,
|
|
381
|
+
left: this.alignVertical ? 0 : i,
|
|
382
|
+
behavior: "smooth"
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}, 10);
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Sets the new ScrollDirection by the new given target coach index.
|
|
389
|
+
*/
|
|
390
|
+
_setScrollDirectionByCoachIndex() {
|
|
391
|
+
this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? I.right : I.left;
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Returns the scroll start or end position X from the selected coach.
|
|
395
|
+
* In case the user is currently navigating through places by keyboard and goes to previous coach,
|
|
396
|
+
* then we return the end position of the coach to get the closest scroll position of the next focus place.
|
|
397
|
+
* @returns number
|
|
398
|
+
*/
|
|
399
|
+
_getCoachScrollPositionX() {
|
|
400
|
+
const e = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];
|
|
401
|
+
return this.isKeyboardNavigation && this.currScrollDirection === I.left && e.width > this.scrollCoachesAreaWidth ? e.end - this.scrollCoachesAreaWidth : e.start;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Sets the focus on the HTML table (grid) caption element so that the heading is read out when using a ScreenReader.
|
|
405
|
+
*/
|
|
406
|
+
_setFocusToSelectedCoachGrid() {
|
|
407
|
+
if (this.isCoachGridFocusable && this.hasSeatReservationNativeFocus) {
|
|
408
|
+
this.isCoachGridFocusable = !1;
|
|
409
|
+
const e = this.shadowRoot?.querySelector("#sbb-sr-coach-caption-" + this.currSelectedCoachIndex);
|
|
410
|
+
e && e.focus();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Returns whether the current scrolled position can be used to scroll to the selected wagon
|
|
415
|
+
* @returns boolean
|
|
416
|
+
*/
|
|
417
|
+
_isScrollableToSelectedCoach() {
|
|
418
|
+
const e = this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft, t = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, s = this.maxCalcCoachesWidth - t, i = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], a = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
|
|
419
|
+
return (e < s || e > i.start) && !a;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Returns the coach index which is currently visible in the scroll area
|
|
423
|
+
* @returns number
|
|
424
|
+
*/
|
|
425
|
+
_getCoachIndexByScrollTriggerPosition() {
|
|
426
|
+
const t = (this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft) + this.scrollCoachesAreaWidth / 2;
|
|
427
|
+
return this.triggerCoachPositionsCollection.findIndex((s) => t >= s.start && t <= s.end);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Get the first place of current selected coach by table cell coordinate 0-0 id.
|
|
431
|
+
* @returns Place or null
|
|
432
|
+
*/
|
|
433
|
+
_getFirstPlaceInSelectedCoach() {
|
|
434
|
+
let e = null;
|
|
435
|
+
const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex], s = "cell-" + this.currSelectedDeckIndex + "-" + this.currSelectedCoachIndex + "-0-0", i = this.shadowRoot?.querySelector("#" + s)?.querySelector("sbb-seat-reservation-place-control")?.getAttribute("text") || null;
|
|
436
|
+
return t && i && (e = t.places?.find((a) => a.number === i) || null), e;
|
|
437
|
+
}
|
|
438
|
+
_getSwitchedCoachDeckIndexByKeyNavigation(e, t) {
|
|
439
|
+
return !this.currSelectedPlace || e === this.keyboardNavigationEvents.ArrowRight || e === this.keyboardNavigationEvents.ArrowLeft ? null : e === this.keyboardNavigationEvents.ArrowDown && this.currSelectedPlace.position.y + 2 === t.dimension.h && this.seatReservations[this.currSelectedDeckIndex + 1] ? this.currSelectedDeckIndex + 1 : e === this.keyboardNavigationEvents.ArrowUp && this.currSelectedPlace.position.y === 0 && this.seatReservations[this.currSelectedDeckIndex - 1] ? this.currSelectedDeckIndex - 1 : null;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* To get the correct closest place of current pressed key and the current selected place,
|
|
443
|
+
* we have to investigate the coordinates of each place to find the closest place of the currSelectedPlaceElementId.
|
|
444
|
+
* @param pressedKey
|
|
445
|
+
* @returns Place or null
|
|
446
|
+
*/
|
|
447
|
+
_getClosestPlaceByKeyDirection(e) {
|
|
448
|
+
const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex];
|
|
449
|
+
let s = null, i = t.places, a = null;
|
|
450
|
+
if (i)
|
|
451
|
+
if (this.currSelectedPlaceElementId) {
|
|
452
|
+
if (this.currSelectedPlace) {
|
|
453
|
+
const o = { ...this.currSelectedPlace.position };
|
|
454
|
+
e && (a = this._getSwitchedCoachDeckIndexByKeyNavigation(e, t), a !== null && (i = this.seatReservations[a].coachItems[this.currSelectedCoachIndex].places || [], o.y = a < this.currSelectedDeckIndex ? t.dimension.h : -1));
|
|
455
|
+
for (const c of i)
|
|
456
|
+
e ? c.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (c.position.y === o.y || c.position.y === o.y - 1) && c.position.x > o.x && (!s || c.position.x < s.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (c.position.x === o.x || c.position.x === o.x + 1) && c.position.y > o.y && (!s || c.position.y < s.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (c.position.y === o.y || c.position.y === o.y + 1) && c.position.x < o.x && (!s || c.position.x > s.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (c.position.x === o.x || c.position.x === o.x - 1) && c.position.y < o.y && (!s || c.position.y > s.position.y)) && (s = c) : (this.currScrollDirection === I.right && c.position.y === o.y && (!s || c.position.x < s.position.x) || this.currScrollDirection === I.left && c.position.y === o.y && (!s || c.position.x > s.position.x)) && (s = c);
|
|
457
|
+
a !== null && s && (this.currSelectedDeckIndex = a);
|
|
458
|
+
}
|
|
459
|
+
} else
|
|
460
|
+
return this._getFirstPlaceInSelectedCoach();
|
|
461
|
+
return s;
|
|
462
|
+
}
|
|
463
|
+
// Handling for Tab navigation if a place is selected inside the coach.
|
|
464
|
+
// This controls the focused coach from the current selected coach.
|
|
465
|
+
_navigateCoachNavigationByKeyboard(e) {
|
|
466
|
+
const t = this.focusedCoachIndex === -1 ? this.currSelectedCoachIndex === -1 ? 0 : this.currSelectedCoachIndex : this.focusedCoachIndex, s = e === "NEXT_TAB" ? this.getNextAvailableCoachIndex(t) : this.getPrevAvailableCoachIndex(t);
|
|
467
|
+
if (this.hasNavigation) {
|
|
468
|
+
const i = this._getPlaceHtmlElement(), a = i ? i.getAttribute("keyfocus") === "focus" : !1;
|
|
469
|
+
if (e === "PREV_TAB" && this.selectedCoachIndex === t)
|
|
470
|
+
if (a || this.currSelectedPlace !== null) {
|
|
471
|
+
this.focusedCoachIndex = t, this.unfocusPlaceElement();
|
|
472
|
+
return;
|
|
473
|
+
} else t == 0 ? (this.unfocusPlaceElement(), this.currSelectedPlace = null, this.focusedCoachIndex = -1, (this.shadowRoot?.getElementById("sbb-sr-navigation__wrapper-button-direction--left")).focus()) : this.focusedCoachIndex = s;
|
|
474
|
+
else s !== this.currSelectedCoachIndex ? this.focusedCoachIndex = s : e === "NEXT_TAB" && s === this.coachNavData.length - 1 ? (this.unfocusPlaceElement(), this.focusedCoachIndex = -1, (this.shadowRoot?.getElementById("sbb-sr-navigation__wrapper-button-direction--right")).focus()) : (this.focusedCoachIndex = -1, this.selectedCoachIndex = s, a ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid()));
|
|
475
|
+
this._scrollToSelectedNavigationButton(s);
|
|
476
|
+
} else
|
|
477
|
+
this.scrollToSelectedNavCoach(s);
|
|
478
|
+
}
|
|
479
|
+
_navigateToPlaceByKeyboard(e) {
|
|
480
|
+
if (this.isKeyboardNavigation = !0, this.focusedCoachIndex !== -1 && (this.focusedCoachIndex = -1), !this.preventPlaceClick) {
|
|
481
|
+
const t = this._getClosestPlaceByKeyDirection(e);
|
|
482
|
+
if (t)
|
|
483
|
+
this.focusPlaceElement(t);
|
|
484
|
+
else if (e === this.keyboardNavigationEvents.ArrowRight || e === this.keyboardNavigationEvents.ArrowLeft || this.alignVertical && (e === this.keyboardNavigationEvents.ArrowUp || e === this.keyboardNavigationEvents.ArrowDown)) {
|
|
485
|
+
const s = e === this.keyboardNavigationEvents.ArrowRight ? this.getNextAvailableCoachIndex() : this.getPrevAvailableCoachIndex();
|
|
486
|
+
this.scrollToSelectedNavCoach(s);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
getNextAvailableCoachIndex(e) {
|
|
491
|
+
const t = e ?? this.currSelectedCoachIndex;
|
|
492
|
+
return t < this.seatReservations[this.currSelectedDeckIndex].coachItems.length - 1 ? t + 1 : t;
|
|
493
|
+
}
|
|
494
|
+
getPrevAvailableCoachIndex(e) {
|
|
495
|
+
const t = e ?? this.currSelectedCoachIndex;
|
|
496
|
+
return t > 0 ? t - 1 : t;
|
|
497
|
+
}
|
|
498
|
+
updateSelectedSeatReservationPlaces(e) {
|
|
499
|
+
const t = e.placeType === "SEAT" ? "seats" : "bicycles", s = e.placeType === "SEAT" ? this.maxSeatReservations : this.maxBicycleReservations, i = this.selectedSeatReservationPlaces[t];
|
|
500
|
+
this.selectedSeatReservationPlaces[t] = this._updateSelectedSeatReservationPlaces(i, s, e), this.dispatchEvent(new CustomEvent("selectedplaces", {
|
|
501
|
+
bubbles: !0,
|
|
502
|
+
composed: !0,
|
|
503
|
+
detail: this.selectedSeatReservationPlaces
|
|
504
|
+
}));
|
|
505
|
+
}
|
|
506
|
+
_updateSelectedSeatReservationPlaces(e, t, s) {
|
|
507
|
+
if (s.state === "SELECTED") {
|
|
508
|
+
const i = this._getDeckIndexByPlaceId(s.id), a = this._getSeatReservationPlaceSelection(s, i);
|
|
509
|
+
a && e.push(a);
|
|
510
|
+
} else
|
|
511
|
+
e = e.filter((i) => i.id !== s.id);
|
|
512
|
+
if (t > -1 && e.length > t) {
|
|
513
|
+
const i = t > 0 ? s : void 0;
|
|
514
|
+
e = this._resetAllPlaceSelections(e, i);
|
|
515
|
+
}
|
|
516
|
+
return e;
|
|
517
|
+
}
|
|
518
|
+
updateCurrentSelectedPlaceInCoach(e) {
|
|
519
|
+
const t = this._getDeckIndexByPlaceId(e.id), s = e.coachIndex;
|
|
520
|
+
if (t === null)
|
|
521
|
+
return;
|
|
522
|
+
const i = this.seatReservations[t].coachItems[s].places?.find((o) => o.number == e.number);
|
|
523
|
+
if (!i)
|
|
524
|
+
return;
|
|
525
|
+
this.currSelectedDeckIndex = t, this.currSelectedCoachIndex = s, this.currSelectedPlace = i, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(i);
|
|
526
|
+
const a = setTimeout(() => {
|
|
527
|
+
this._scrollPlaceIntoNearestViewport(e.id), clearTimeout(a);
|
|
528
|
+
}, 0);
|
|
529
|
+
}
|
|
530
|
+
updateCurrentSelectedCoach() {
|
|
531
|
+
if (this.currSelectedCoachIndex == this.selectedCoachIndex)
|
|
532
|
+
return;
|
|
533
|
+
this.focusedCoachIndex != -1 && (this.focusedCoachIndex = this.currSelectedCoachIndex), this.selectedCoachIndex = this.currSelectedCoachIndex;
|
|
534
|
+
const e = this._getSeatReservationSelectedCoach(this.selectedCoachIndex);
|
|
535
|
+
e && this.dispatchEvent(new CustomEvent("selectedcoach", {
|
|
536
|
+
bubbles: !0,
|
|
537
|
+
composed: !0,
|
|
538
|
+
detail: e
|
|
539
|
+
}));
|
|
540
|
+
}
|
|
541
|
+
getPlaceElementId(e, t, s) {
|
|
542
|
+
return "seat-reservation__place-button-" + e + "-" + t + "-" + s;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* In the case of coach layouts with different decks,
|
|
546
|
+
* it is necessary to extend the offset with empty coaches
|
|
547
|
+
* in order to create a stable vehicle layout.
|
|
548
|
+
*
|
|
549
|
+
* [ooo]-[ooo]-[ooo]
|
|
550
|
+
* [ooo]-[ooo]-[ooo]-[ooo]-[ooo]
|
|
551
|
+
*/
|
|
552
|
+
_initEmptyCoachDeckOffsets() {
|
|
553
|
+
const e = Array(this.seatReservations.length - 1).fill(0);
|
|
554
|
+
this.seatReservations[this.seatReservations.length - 1].coachItems.forEach((s) => {
|
|
555
|
+
for (let i = 0; i < this.seatReservations.length - 1; i++) {
|
|
556
|
+
const a = this.seatReservations[i].coachItems[e[i]];
|
|
557
|
+
if (s.id != a?.id) {
|
|
558
|
+
const o = {
|
|
559
|
+
...s,
|
|
560
|
+
places: void 0,
|
|
561
|
+
propertyIds: void 0,
|
|
562
|
+
graphicElements: void 0,
|
|
563
|
+
serviceElements: void 0,
|
|
564
|
+
travelClass: []
|
|
565
|
+
};
|
|
566
|
+
this.seatReservations[i].coachItems.splice(e[i], 0, o);
|
|
567
|
+
}
|
|
568
|
+
e[i]++;
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Initialization of SeatReservationPlaceSelection Array based on the transferred places
|
|
574
|
+
* that have the state SELECTED within the seatReservation object
|
|
575
|
+
*/
|
|
576
|
+
_initSeatReservationPlaceSelection() {
|
|
577
|
+
this.selectedSeatReservationPlaces.seats = [], this.selectedSeatReservationPlaces.bicycles = [], this.seatReservations?.forEach((e, t) => e.coachItems.map((s, i) => {
|
|
578
|
+
s.places?.filter((a) => a.state === "SELECTED")?.forEach((a) => {
|
|
579
|
+
const o = this.getPlaceElementId(t, i, a.number), c = me(a, o, e.deckCoachIndex, i), D = this._getSeatReservationPlaceSelection(c, t);
|
|
580
|
+
D && (D.placeType === "SEAT" ? this.selectedSeatReservationPlaces.seats.push(D) : this.selectedSeatReservationPlaces.bicycles.push(D));
|
|
581
|
+
});
|
|
582
|
+
}));
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* All selected places will be reset or the currentSelectedPlace was given, then we reset all except currentSelectedPlace
|
|
586
|
+
* @param reservationPlaceSelections
|
|
587
|
+
* @param currSelectedPlace
|
|
588
|
+
*/
|
|
589
|
+
_resetAllPlaceSelections(e, t) {
|
|
590
|
+
for (const s of e)
|
|
591
|
+
if (!t || t.id !== s.id) {
|
|
592
|
+
const i = this.shadowRoot?.getElementById(s.id);
|
|
593
|
+
i && i.setAttribute("state", "FREE");
|
|
594
|
+
}
|
|
595
|
+
return t ? e = e.filter((s) => s.id === t.id) : e = [], e;
|
|
596
|
+
}
|
|
597
|
+
_getSeatReservationPlaceSelection(e, t) {
|
|
598
|
+
if (t === null)
|
|
599
|
+
return null;
|
|
600
|
+
const s = this.seatReservations[t].coachItems[e.coachIndex], i = s.places?.find((a) => a.number === e.number);
|
|
601
|
+
return i ? ye(i, s, e.id, e.deckIndex, e.coachIndex) : null;
|
|
602
|
+
}
|
|
603
|
+
_getSeatReservationSelectedCoach(e) {
|
|
604
|
+
if (!this.seatReservations[this.currSelectedDeckIndex].coachItems[e])
|
|
605
|
+
return null;
|
|
606
|
+
const t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e], s = this.getAvailableFreePlacesNumFromCoach(t.places);
|
|
607
|
+
return be(e, t, s);
|
|
608
|
+
}
|
|
609
|
+
_setCurrSelectedPlaceElementId(e) {
|
|
610
|
+
this.currSelectedPlaceElementId = e ? this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number) : null;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Preparation of the used documents font-size which needs
|
|
614
|
+
* to be determined in order to correctly calculate CSS values with rem
|
|
615
|
+
* */
|
|
616
|
+
_determineBaseFontSize() {
|
|
617
|
+
if (!pe) {
|
|
618
|
+
const t = 1 / parseInt(window.getComputedStyle(document.body).fontSize, 10);
|
|
619
|
+
this.style?.setProperty("--sbb-seat-reservation-one-px-rem", `${t + "rem"}`);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Prepares data for displaying navigation area.
|
|
624
|
+
* Calculates the values which are not going to change during use of a component:
|
|
625
|
+
* - coach id
|
|
626
|
+
* - list of service icons
|
|
627
|
+
* - class (first, second, any)
|
|
628
|
+
* - whether there is a driver area left or right
|
|
629
|
+
* */
|
|
630
|
+
_prepareNavigationCoachData() {
|
|
631
|
+
if (this.seatReservations) {
|
|
632
|
+
const e = this.seatReservations[this.seatReservations.length - 1].coachItems;
|
|
633
|
+
this.coachNavData = [], e.forEach((t, s) => {
|
|
634
|
+
const i = [], a = [], o = [];
|
|
635
|
+
this.seatReservations.map((c) => c.coachItems[s]).forEach((c) => {
|
|
636
|
+
i.push(...c.travelClass), a.push(...c.propertyIds ? c.propertyIds : []), o.push(...c.places ? c.places : []);
|
|
637
|
+
}), this.coachNavData.push({
|
|
638
|
+
id: t.id,
|
|
639
|
+
travelClass: this._prepareTravelClassNavigation(i),
|
|
640
|
+
propertyIds: this._prepareServiceIconsNavigation(a),
|
|
641
|
+
isDriverArea: t.places ? t.places.length === 0 : !0,
|
|
642
|
+
driverAreaSide: this._prepareDriverAreaSideNavigation(t),
|
|
643
|
+
freePlaces: this.getAvailableFreePlacesNumFromCoach(o)
|
|
644
|
+
});
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
_prepareTravelClassNavigation(e) {
|
|
649
|
+
return e.indexOf("FIRST") !== -1 ? "FIRST" : e.indexOf("SECOND") !== -1 ? "SECOND" : "ANY_CLASS";
|
|
650
|
+
}
|
|
651
|
+
_prepareDriverAreaSideNavigation(e) {
|
|
652
|
+
const t = e.graphicElements?.filter((s) => s.icon === "DRIVER_AREA");
|
|
653
|
+
if (t && t.length > 0) {
|
|
654
|
+
const s = t.find((a) => a.position.x === 0) || !1, i = t.find((a) => a.position.x > 0) || !1;
|
|
655
|
+
return {
|
|
656
|
+
left: !!s,
|
|
657
|
+
right: !!i
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
_prepareCoachWidthAndGapCalculations() {
|
|
662
|
+
this.seatReservations && this.seatReservations[this.seatReservations.length - 1]?.coachItems?.forEach((t) => {
|
|
663
|
+
const s = this._isOverhangingElementsPresent(t.dimension.w, t.places), i = t.graphicElements?.filter((o) => o.icon && !this.notAreaElements.includes(o.icon)), a = this._isOverhangingElementsPresent(t.dimension.w, i);
|
|
664
|
+
this.overHangingElementInformation.push({
|
|
665
|
+
coachId: t.id,
|
|
666
|
+
overhangingPlaces: s,
|
|
667
|
+
overhangingGraphicAreas: a
|
|
668
|
+
});
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Returns the current selected place HTML element by currSelectedPlaceElementId.
|
|
673
|
+
* @returns HTMLElement or null
|
|
674
|
+
*/
|
|
675
|
+
_getPlaceHtmlElement() {
|
|
676
|
+
return this.currSelectedPlaceElementId && this.shadowRoot?.getElementById(this.currSelectedPlaceElementId) || null;
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Returns the extracted coach deck index from place id
|
|
680
|
+
* @returns number
|
|
681
|
+
*/
|
|
682
|
+
_getDeckIndexByPlaceId(e) {
|
|
683
|
+
const t = this.shadowRoot?.querySelector("#" + e)?.getAttribute("data-deck-index");
|
|
684
|
+
return t && !isNaN(+t) ? +t : null;
|
|
685
|
+
}
|
|
686
|
+
_isValidCoachIndex(e) {
|
|
687
|
+
return e >= 0 && e <= this.seatReservations[this.seatReservations.length - 1].coachItems.length;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Returns existing coach deck index depending on the selected coach.
|
|
691
|
+
* This method is necessary to get an available coach deck index during keyboard navigation, which can vary between coaches with different decks.
|
|
692
|
+
* For example, when navigating from a coach with two decks to a coach with one deck.
|
|
693
|
+
*
|
|
694
|
+
* [ooo]-[ooo]-[ooo]
|
|
695
|
+
* [ooo]-[ooo]-[ooo]-[ooo]-[ooo]
|
|
696
|
+
*
|
|
697
|
+
* @returns number
|
|
698
|
+
*/
|
|
699
|
+
_getExistingCoachDeckIndex() {
|
|
700
|
+
if (this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex].places !== void 0)
|
|
701
|
+
return this.currSelectedDeckIndex;
|
|
702
|
+
const e = this.seatReservations.findIndex((t) => t.coachItems[this.currSelectedCoachIndex].places !== void 0);
|
|
703
|
+
return this.currSelectedDeckIndex >= e ? this.currSelectedDeckIndex : e;
|
|
704
|
+
}
|
|
705
|
+
/**
|
|
706
|
+
* If a selected place is slightly hidden by the overflow scroll content and is still clicked,
|
|
707
|
+
* the method tries to scroll the selected place into the nearest viewport, so that it is completely visible.
|
|
708
|
+
*
|
|
709
|
+
* @param placeId
|
|
710
|
+
*/
|
|
711
|
+
_scrollPlaceIntoNearestViewport(e) {
|
|
712
|
+
this.shadowRoot?.getElementById(e)?.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
|
|
713
|
+
}
|
|
714
|
+
/**
|
|
715
|
+
* checks if any places or graphical elements (e.g. toilet area, etc.) are overhanging the coach borders
|
|
716
|
+
* @param coachItemWidth
|
|
717
|
+
* @param elements
|
|
718
|
+
*/
|
|
719
|
+
_isOverhangingElementsPresent(e, t) {
|
|
720
|
+
return t?.some((s) => s.position.x === 0 || s.position.x + s.dimension.w >= e) ?? !1;
|
|
721
|
+
}
|
|
722
|
+
}, x = new WeakMap(), p = new WeakMap(), _ = new WeakMap(), m = new WeakMap(), y = new WeakMap(), b = new WeakMap(), P = new WeakMap(), A = new WeakMap(), E = new WeakMap(), R = new WeakMap(), N = new WeakMap(), k = new WeakMap(), (() => {
|
|
723
|
+
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(l[Symbol.metadata] ?? null) : void 0;
|
|
724
|
+
u = [C({ attribute: "seat-reservations", type: Array })], z = [S(), C({ attribute: "has-navigation", type: Boolean })], F = [S(), C({ attribute: "align-vertical", type: Boolean, reflect: !0, useDefault: !0 })], W = [S(), C({ attribute: "base-grid-size", type: Number })], M = [S(), C({ attribute: "height", type: Number })], q = [S(), C({ attribute: "max-seat-reservations", type: Number })], Y = [S(), C({ attribute: "max-bicycle-reservations", type: Number })], Z = [S(), C({ attribute: "prevent-place-click", type: Boolean })], se = [S(), C({ attribute: "preselect-coach-index", type: Number })], ce = [w()], ne = [w()], de = [w()], ve = [_e({ passive: !0 })], f(h, null, u, { kind: "accessor", name: "seatReservations", static: !1, private: !1, access: { has: (t) => "seatReservations" in t, get: (t) => t.seatReservations, set: (t, s) => {
|
|
725
|
+
t.seatReservations = s;
|
|
726
|
+
} }, metadata: e }, T, B), f(h, null, z, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, s) => {
|
|
727
|
+
t.hasNavigation = s;
|
|
728
|
+
} }, metadata: e }, G, O), f(h, null, F, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, s) => {
|
|
729
|
+
t.alignVertical = s;
|
|
730
|
+
} }, metadata: e }, V, L), f(h, null, W, { kind: "accessor", name: "baseGridSize", static: !1, private: !1, access: { has: (t) => "baseGridSize" in t, get: (t) => t.baseGridSize, set: (t, s) => {
|
|
731
|
+
t.baseGridSize = s;
|
|
732
|
+
} }, metadata: e }, H, K), f(h, null, M, { kind: "accessor", name: "height", static: !1, private: !1, access: { has: (t) => "height" in t, get: (t) => t.height, set: (t, s) => {
|
|
733
|
+
t.height = s;
|
|
734
|
+
} }, metadata: e }, X, U), f(h, null, q, { kind: "accessor", name: "maxSeatReservations", static: !1, private: !1, access: { has: (t) => "maxSeatReservations" in t, get: (t) => t.maxSeatReservations, set: (t, s) => {
|
|
735
|
+
t.maxSeatReservations = s;
|
|
736
|
+
} }, metadata: e }, $, j), f(h, null, Y, { kind: "accessor", name: "maxBicycleReservations", static: !1, private: !1, access: { has: (t) => "maxBicycleReservations" in t, get: (t) => t.maxBicycleReservations, set: (t, s) => {
|
|
737
|
+
t.maxBicycleReservations = s;
|
|
738
|
+
} }, metadata: e }, J, Q), f(h, null, Z, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, s) => {
|
|
739
|
+
t.preventPlaceClick = s;
|
|
740
|
+
} }, metadata: e }, ee, te), f(h, null, se, { kind: "accessor", name: "preselectCoachIndex", static: !1, private: !1, access: { has: (t) => "preselectCoachIndex" in t, get: (t) => t.preselectCoachIndex, set: (t, s) => {
|
|
741
|
+
t.preselectCoachIndex = s;
|
|
742
|
+
} }, metadata: e }, ie, ae), f(h, null, ce, { kind: "accessor", name: "selectedCoachIndex", static: !1, private: !1, access: { has: (t) => "selectedCoachIndex" in t, get: (t) => t.selectedCoachIndex, set: (t, s) => {
|
|
743
|
+
t.selectedCoachIndex = s;
|
|
744
|
+
} }, metadata: e }, oe, re), f(h, null, ne, { kind: "accessor", name: "focusedCoachIndex", static: !1, private: !1, access: { has: (t) => "focusedCoachIndex" in t, get: (t) => t.focusedCoachIndex, set: (t, s) => {
|
|
745
|
+
t.focusedCoachIndex = s;
|
|
746
|
+
} }, metadata: e }, le, he), f(h, null, de, { kind: "accessor", name: "hoveredCoachIndex", static: !1, private: !1, access: { has: (t) => "hoveredCoachIndex" in t, get: (t) => t.hoveredCoachIndex, set: (t, s) => {
|
|
747
|
+
t.hoveredCoachIndex = s;
|
|
748
|
+
} }, metadata: e }, ue, ge), f(h, null, ve, { kind: "method", name: "coachAreaScrollend", static: !1, private: !1, access: { has: (t) => "coachAreaScrollend" in t, get: (t) => t.coachAreaScrollend }, metadata: e }, null, d), e && Object.defineProperty(h, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
749
|
+
})(), h.events = {
|
|
750
|
+
selectedplaces: "selectedplaces",
|
|
751
|
+
selectedcoach: "selectedcoach"
|
|
752
|
+
}, h;
|
|
753
|
+
})();
|
|
754
|
+
export {
|
|
755
|
+
ze as SeatReservationBaseElement
|
|
756
|
+
};
|