@sbb-esta/lyne-elements-experimental 5.0.2 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete-grid.js +1 -10
- package/autocomplete-grid.pure.js +12 -7
- package/core.js +31 -5
- package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.d.ts +0 -1
- package/development/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.d.ts +4 -5
- package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.d.ts +1 -2
- package/development/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.d.ts +2 -3
- package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.d.ts +1 -2
- package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.d.ts +1 -2
- package/development/autocomplete-grid.d.ts +0 -1
- package/development/autocomplete-grid.js +5 -10
- package/development/autocomplete-grid.pure.d.ts +0 -1
- package/development/autocomplete-grid.pure.js +328 -7
- package/development/core/datetime/date-helper.d.ts +0 -1
- package/development/core/timetable/access-leg-helper.d.ts +3 -3
- package/development/core/timetable/timetable-helper.d.ts +1 -2
- package/development/core/timetable/timetable-properties.d.ts +2 -1
- package/development/core.d.ts +0 -1
- package/development/core.js +1195 -5
- package/development/journey-summary/journey-summary.component.d.ts +3 -4
- package/development/journey-summary.d.ts +0 -1
- package/development/journey-summary.js +5 -5
- package/development/journey-summary.pure.d.ts +0 -1
- package/development/journey-summary.pure.js +2605 -2
- package/development/pearl-chain/pearl-chain.component.d.ts +2 -3
- package/development/pearl-chain-time/pearl-chain-time.component.d.ts +3 -4
- package/development/pearl-chain-time.d.ts +0 -1
- package/development/pearl-chain-time.js +5 -5
- package/development/pearl-chain-time.pure.d.ts +0 -1
- package/development/pearl-chain-time.pure.js +2582 -2
- package/development/pearl-chain-vertical/pearl-chain-vertical.component.d.ts +1 -2
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.d.ts +1 -2
- package/development/pearl-chain-vertical-item.d.ts +0 -1
- package/development/pearl-chain-vertical-item.js +5 -5
- package/development/pearl-chain-vertical-item.pure.d.ts +0 -1
- package/development/pearl-chain-vertical-item.pure.js +132 -2
- package/development/pearl-chain-vertical.d.ts +0 -1
- package/development/pearl-chain-vertical.js +5 -5
- package/development/pearl-chain-vertical.pure.d.ts +0 -1
- package/development/pearl-chain-vertical.pure.js +31 -2
- package/development/pearl-chain.d.ts +0 -1
- package/development/pearl-chain.js +5 -5
- package/development/pearl-chain.pure.d.ts +0 -1
- package/development/pearl-chain.pure.js +619 -2
- package/development/seat-reservation/common/mapper/icon-mapper.d.ts +0 -1
- package/development/seat-reservation/common/mapper/mapper.d.ts +1 -2
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-bus.private.d.ts +68 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-decks.private.d.ts +122 -0
- package/development/seat-reservation/common/mapper/sample-data/seat-reservation-sample-data-train.private.d.ts +68 -0
- package/development/seat-reservation/common/mapper.d.ts +0 -1
- package/development/seat-reservation/common/svgs.d.ts +20 -21
- package/development/seat-reservation/common/translations/i18n.d.ts +0 -1
- package/development/seat-reservation/common/translations.d.ts +0 -1
- package/development/seat-reservation/common/types.d.ts +0 -1
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +2 -3
- package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts +2 -3
- package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.d.ts +1 -2
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.d.ts +2 -3
- package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +3 -4
- package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts +2 -3
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts +3 -4
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts +1 -2
- package/development/seat-reservation.d.ts +0 -1
- package/development/seat-reservation.js +5 -16
- package/development/seat-reservation.pure.d.ts +0 -1
- package/development/seat-reservation.pure.js +16019 -14
- package/development/timetable-duration/timetable-duration.component.d.ts +1 -2
- package/development/timetable-duration.d.ts +0 -1
- package/development/timetable-duration.js +5 -5
- package/development/timetable-duration.pure.d.ts +0 -1
- package/development/timetable-duration.pure.js +97 -2
- package/development/timetable-row/timetable-row.component.d.ts +3 -4
- package/development/timetable-row.d.ts +0 -1
- package/development/timetable-row.js +5 -5
- package/development/timetable-row.pure.d.ts +0 -1
- package/development/timetable-row.pure.js +3005 -2
- package/journey-summary.js +1 -6
- package/journey-summary.pure.js +55 -2
- package/package.json +3 -4
- package/pearl-chain-time.js +1 -6
- package/pearl-chain-time.pure.js +28 -2
- package/pearl-chain-vertical-item.js +1 -6
- package/pearl-chain-vertical-item.pure.js +26 -2
- package/pearl-chain-vertical.js +1 -6
- package/pearl-chain-vertical.pure.js +6 -2
- package/pearl-chain.js +1 -6
- package/pearl-chain.pure.js +27 -2
- package/seat-reservation.js +1 -16
- package/seat-reservation.pure.js +468 -14
- package/timetable-duration.js +1 -6
- package/timetable-duration.pure.js +9 -2
- package/timetable-row.js +1 -6
- package/timetable-row.pure.js +113 -2
- package/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.js +0 -65
- package/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.js +0 -44
- package/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.js +0 -2
- package/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.js +0 -21
- package/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +0 -2
- package/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +0 -2
- package/autocomplete-grid-cell.component-79IjA__I.js +0 -23
- package/autocomplete-grid-option.component-DUFBhQwI.js +0 -35
- package/autocomplete-grid-row.component-B3U15Rwa.js +0 -26
- package/core/datetime/date-helper.js +0 -2
- package/core/timetable/access-leg-helper.js +0 -96
- package/core/timetable/timetable-helper.js +0 -10
- package/core/timetable/timetable-properties.js +0 -0
- package/date-helper-DNzMLcyb.js +0 -185
- package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.d.ts.map +0 -1
- package/development/autocomplete-grid/autocomplete-grid/autocomplete-grid.component.js +0 -118
- package/development/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.d.ts.map +0 -1
- package/development/autocomplete-grid/autocomplete-grid-button/autocomplete-grid-button.component.js +0 -69
- package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.d.ts.map +0 -1
- package/development/autocomplete-grid/autocomplete-grid-cell/autocomplete-grid-cell.component.js +0 -2
- package/development/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.d.ts.map +0 -1
- package/development/autocomplete-grid/autocomplete-grid-optgroup/autocomplete-grid-optgroup.component.js +0 -30
- package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.d.ts.map +0 -1
- package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +0 -2
- package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.d.ts.map +0 -1
- package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +0 -2
- package/development/autocomplete-grid-cell.component-BbdELDro.js +0 -33
- package/development/autocomplete-grid-option.component-C7WuqRit.js +0 -57
- package/development/autocomplete-grid-row.component-DoXbOsQM.js +0 -38
- package/development/autocomplete-grid.d.ts.map +0 -1
- package/development/autocomplete-grid.pure.d.ts.map +0 -1
- package/development/core/datetime/date-helper.d.ts.map +0 -1
- package/development/core/datetime/date-helper.js +0 -2
- package/development/core/timetable/access-leg-helper.d.ts.map +0 -1
- package/development/core/timetable/access-leg-helper.js +0 -147
- package/development/core/timetable/timetable-helper.d.ts.map +0 -1
- package/development/core/timetable/timetable-helper.js +0 -19
- package/development/core/timetable/timetable-properties.d.ts.map +0 -1
- package/development/core/timetable/timetable-properties.js +0 -0
- package/development/core.d.ts.map +0 -1
- package/development/date-helper-BcTDWVeP.js +0 -539
- package/development/differenceInMinutes-CxAbGYQ3.js +0 -110
- package/development/format-Cx3zmmaF.js +0 -1848
- package/development/isValid-40Olgzo1.js +0 -178
- package/development/journey-summary/journey-summary.component.d.ts.map +0 -1
- package/development/journey-summary/journey-summary.component.js +0 -2
- package/development/journey-summary.component-BsC7wBIn.js +0 -341
- package/development/journey-summary.d.ts.map +0 -1
- package/development/journey-summary.pure.d.ts.map +0 -1
- package/development/mapper-BrZOqqfe.js +0 -11454
- package/development/pearl-chain/pearl-chain.component.d.ts.map +0 -1
- package/development/pearl-chain/pearl-chain.component.js +0 -2
- package/development/pearl-chain-time/pearl-chain-time.component.d.ts.map +0 -1
- package/development/pearl-chain-time/pearl-chain-time.component.js +0 -2
- package/development/pearl-chain-time.component-C-CuC1ke.js +0 -317
- package/development/pearl-chain-time.d.ts.map +0 -1
- package/development/pearl-chain-time.pure.d.ts.map +0 -1
- package/development/pearl-chain-vertical/pearl-chain-vertical.component.d.ts.map +0 -1
- package/development/pearl-chain-vertical/pearl-chain-vertical.component.js +0 -2
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.d.ts.map +0 -1
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +0 -2
- package/development/pearl-chain-vertical-item.component-CLu9QrqJ.js +0 -131
- package/development/pearl-chain-vertical-item.d.ts.map +0 -1
- package/development/pearl-chain-vertical-item.pure.d.ts.map +0 -1
- package/development/pearl-chain-vertical.component-DbPz5k_R.js +0 -30
- package/development/pearl-chain-vertical.d.ts.map +0 -1
- package/development/pearl-chain-vertical.pure.d.ts.map +0 -1
- package/development/pearl-chain.component-10OsJZIX.js +0 -318
- package/development/pearl-chain.d.ts.map +0 -1
- package/development/pearl-chain.pure.d.ts.map +0 -1
- package/development/seat-reservation/common/mapper/icon-mapper.d.ts.map +0 -1
- package/development/seat-reservation/common/mapper/icon-mapper.js +0 -170
- package/development/seat-reservation/common/mapper/mapper.d.ts.map +0 -1
- package/development/seat-reservation/common/mapper/mapper.js +0 -2
- package/development/seat-reservation/common/mapper.d.ts.map +0 -1
- package/development/seat-reservation/common/mapper.js +0 -3
- package/development/seat-reservation/common/svgs.d.ts.map +0 -1
- package/development/seat-reservation/common/svgs.js +0 -2
- package/development/seat-reservation/common/translations/i18n.d.ts.map +0 -1
- package/development/seat-reservation/common/translations/i18n.js +0 -1120
- package/development/seat-reservation/common/translations.d.ts.map +0 -1
- package/development/seat-reservation/common/translations.js +0 -2
- package/development/seat-reservation/common/types.d.ts.map +0 -1
- package/development/seat-reservation/common/types.js +0 -0
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +0 -1476
- package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation/seat-reservation.component.js +0 -2
- package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +0 -2
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +0 -2
- package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +0 -2
- package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +0 -2
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +0 -2
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +0 -1
- package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +0 -2
- package/development/seat-reservation-area.component-DPhQJFid.js +0 -94
- package/development/seat-reservation-graphic.component-0LYsmerm.js +0 -129
- package/development/seat-reservation-navigation-coach.component-B97jKD7Y.js +0 -438
- package/development/seat-reservation-navigation-services.component-Cx0Is97w.js +0 -159
- package/development/seat-reservation-place-control.component-DaL1g8WH.js +0 -431
- package/development/seat-reservation-scoped.component-BHbORVsR.js +0 -24
- package/development/seat-reservation.component-DI9pSlzt.js +0 -473
- package/development/seat-reservation.d.ts.map +0 -1
- package/development/seat-reservation.pure.d.ts.map +0 -1
- package/development/svgs-Dj-RKmRs.js +0 -28
- package/development/timetable-duration/timetable-duration.component.d.ts.map +0 -1
- package/development/timetable-duration/timetable-duration.component.js +0 -2
- package/development/timetable-duration.component-Chk5D4Is.js +0 -96
- package/development/timetable-duration.d.ts.map +0 -1
- package/development/timetable-duration.pure.d.ts.map +0 -1
- package/development/timetable-row/timetable-row.component.d.ts.map +0 -1
- package/development/timetable-row/timetable-row.component.js +0 -2
- package/development/timetable-row.component-nzrQzxL6.js +0 -736
- package/development/timetable-row.d.ts.map +0 -1
- package/development/timetable-row.pure.d.ts.map +0 -1
- package/development/toDate-CDWut5fS.js +0 -150
- package/differenceInMinutes-BAZ-Fham.js +0 -27
- package/format-DjgG1QPc.js +0 -1103
- package/isValid-CXnsFZVu.js +0 -36
- package/journey-summary/journey-summary.component.js +0 -2
- package/journey-summary.component-DNoO3OCf.js +0 -265
- package/mapper-Dcou8VEf.js +0 -11382
- package/pearl-chain/pearl-chain.component.js +0 -2
- package/pearl-chain-time/pearl-chain-time.component.js +0 -2
- package/pearl-chain-time.component-BuvA6IE1.js +0 -237
- package/pearl-chain-vertical/pearl-chain-vertical.component.js +0 -2
- package/pearl-chain-vertical-item/pearl-chain-vertical-item.component.js +0 -2
- package/pearl-chain-vertical-item.component-QZ4s8Jbv.js +0 -106
- package/pearl-chain-vertical.component-Dc3vaHsQ.js +0 -20
- package/pearl-chain.component-DtGXXkY6.js +0 -190
- package/seat-reservation/common/mapper/icon-mapper.js +0 -72
- package/seat-reservation/common/mapper/mapper.js +0 -2
- package/seat-reservation/common/mapper.js +0 -3
- package/seat-reservation/common/svgs.js +0 -2
- package/seat-reservation/common/translations/i18n.js +0 -1085
- package/seat-reservation/common/translations.js +0 -2
- package/seat-reservation/common/types.js +0 -0
- package/seat-reservation/seat-reservation/seat-reservation-base-element.js +0 -926
- package/seat-reservation/seat-reservation/seat-reservation.component.js +0 -2
- package/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +0 -2
- package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +0 -2
- package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +0 -2
- package/seat-reservation/seat-reservation-navigation-services/seat-reservation-navigation-services.component.js +0 -2
- package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +0 -2
- package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +0 -2
- package/seat-reservation-area.component-G9lHb7S8.js +0 -73
- package/seat-reservation-graphic.component-BXFcQDxY.js +0 -102
- package/seat-reservation-navigation-coach.component-BXy8EkJe.js +0 -338
- package/seat-reservation-navigation-services.component-49XmV9rv.js +0 -124
- package/seat-reservation-place-control.component-DToIW328.js +0 -317
- package/seat-reservation-scoped.component-D8dAmrP7.js +0 -16
- package/seat-reservation.component--0XnrCkk.js +0 -372
- package/svgs-D4fuYTHV.js +0 -26
- package/timetable-duration/timetable-duration.component.js +0 -2
- package/timetable-duration.component-iMCvh1zr.js +0 -61
- package/timetable-row/timetable-row.component.js +0 -2
- package/timetable-row.component-mNKmhRmP.js +0 -566
- package/toDate-BhNUyM4s.js +0 -16
|
@@ -1,926 +0,0 @@
|
|
|
1
|
-
import { SbbElement as e, forceType as t, isArrowKeyOrPageKeysPressed as n } from "@sbb-esta/lyne-elements/core.js";
|
|
2
|
-
import { isServer as r } from "lit";
|
|
3
|
-
import { __esDecorate as i, __runInitializers as a } from "tslib";
|
|
4
|
-
import { eventOptions as o, property as s, state as c } from "lit/decorators.js";
|
|
5
|
-
import { mapCoachInfosToCoachSelection as l, mapIconToSvg as u, mapPlaceAndCoachToSeatReservationPlaceSelection as ee, mapPlaceInfosToPlaceSelection as te } from "../common/mapper.js";
|
|
6
|
-
//#region src/elements-experimental/seat-reservation/seat-reservation/seat-reservation-base-element.ts
|
|
7
|
-
var d;
|
|
8
|
-
(function(e) {
|
|
9
|
-
e.right = "right", e.left = "left";
|
|
10
|
-
})(d ||= {});
|
|
11
|
-
var ne = 3, re = [
|
|
12
|
-
"sa-vo",
|
|
13
|
-
"sa-rs",
|
|
14
|
-
"sa-abteilkinderwagen",
|
|
15
|
-
"sa-wr",
|
|
16
|
-
"sa-fa",
|
|
17
|
-
"sa-bz",
|
|
18
|
-
"sa-rz"
|
|
19
|
-
], f = class extends Event {
|
|
20
|
-
get detail() {
|
|
21
|
-
return this._detail;
|
|
22
|
-
}
|
|
23
|
-
constructor(e) {
|
|
24
|
-
super("selectedplaces", {
|
|
25
|
-
bubbles: !0,
|
|
26
|
-
composed: !0
|
|
27
|
-
}), this._detail = e;
|
|
28
|
-
}
|
|
29
|
-
}, p = class extends Event {
|
|
30
|
-
get detail() {
|
|
31
|
-
return this._detail;
|
|
32
|
-
}
|
|
33
|
-
constructor(e) {
|
|
34
|
-
super("selectedcoach", {
|
|
35
|
-
bubbles: !0,
|
|
36
|
-
composed: !0
|
|
37
|
-
}), this._detail = e;
|
|
38
|
-
}
|
|
39
|
-
}, m = (() => {
|
|
40
|
-
let m = e, h = [], g, _ = [], v = [], y, b = [], x = [], S, C = [], w = [], T, E = [], D = [], O, k = [], A = [], j, ie = [], M = [], N, P = [], F = [], I, L = [], R = [], z, B = [], V = [], H, U = [], W = [], G, K = [], q = [], J, Y = [], X = [], Z, Q = [], $ = [], ae, oe = [], se = [], ce;
|
|
41
|
-
return class extends m {
|
|
42
|
-
static {
|
|
43
|
-
let e = typeof Symbol == "function" && Symbol.metadata ? Object.create(m[Symbol.metadata] ?? null) : void 0;
|
|
44
|
-
g = [s({
|
|
45
|
-
attribute: "seat-reservations",
|
|
46
|
-
type: Array
|
|
47
|
-
})], y = [s({
|
|
48
|
-
attribute: "travel-direction",
|
|
49
|
-
type: String
|
|
50
|
-
})], S = [t(), s({
|
|
51
|
-
attribute: "has-navigation",
|
|
52
|
-
type: Boolean
|
|
53
|
-
})], T = [t(), s({
|
|
54
|
-
attribute: "align-vertical",
|
|
55
|
-
type: Boolean,
|
|
56
|
-
reflect: !0,
|
|
57
|
-
useDefault: !0
|
|
58
|
-
})], O = [t(), s({
|
|
59
|
-
attribute: "base-grid-size",
|
|
60
|
-
type: Number
|
|
61
|
-
})], j = [t(), s({
|
|
62
|
-
attribute: "height",
|
|
63
|
-
type: Number
|
|
64
|
-
})], N = [t(), s({
|
|
65
|
-
attribute: "max-seat-reservations",
|
|
66
|
-
type: Number
|
|
67
|
-
})], I = [t(), s({
|
|
68
|
-
attribute: "max-bicycle-reservations",
|
|
69
|
-
type: Number
|
|
70
|
-
})], z = [t(), s({
|
|
71
|
-
attribute: "prevent-place-click",
|
|
72
|
-
type: Boolean
|
|
73
|
-
})], H = [t(), s({
|
|
74
|
-
attribute: "preselect-coach-index",
|
|
75
|
-
type: Number
|
|
76
|
-
})], G = [t(), s({
|
|
77
|
-
attribute: "show-title-info",
|
|
78
|
-
type: Boolean
|
|
79
|
-
})], J = [c()], Z = [c()], ae = [c()], ce = [o({ passive: !0 })], i(this, null, g, {
|
|
80
|
-
kind: "accessor",
|
|
81
|
-
name: "seatReservations",
|
|
82
|
-
static: !1,
|
|
83
|
-
private: !1,
|
|
84
|
-
access: {
|
|
85
|
-
has: (e) => "seatReservations" in e,
|
|
86
|
-
get: (e) => e.seatReservations,
|
|
87
|
-
set: (e, t) => {
|
|
88
|
-
e.seatReservations = t;
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
metadata: e
|
|
92
|
-
}, _, v), i(this, null, y, {
|
|
93
|
-
kind: "accessor",
|
|
94
|
-
name: "travelDirection",
|
|
95
|
-
static: !1,
|
|
96
|
-
private: !1,
|
|
97
|
-
access: {
|
|
98
|
-
has: (e) => "travelDirection" in e,
|
|
99
|
-
get: (e) => e.travelDirection,
|
|
100
|
-
set: (e, t) => {
|
|
101
|
-
e.travelDirection = t;
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
metadata: e
|
|
105
|
-
}, b, x), i(this, null, S, {
|
|
106
|
-
kind: "accessor",
|
|
107
|
-
name: "hasNavigation",
|
|
108
|
-
static: !1,
|
|
109
|
-
private: !1,
|
|
110
|
-
access: {
|
|
111
|
-
has: (e) => "hasNavigation" in e,
|
|
112
|
-
get: (e) => e.hasNavigation,
|
|
113
|
-
set: (e, t) => {
|
|
114
|
-
e.hasNavigation = t;
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
metadata: e
|
|
118
|
-
}, C, w), i(this, null, T, {
|
|
119
|
-
kind: "accessor",
|
|
120
|
-
name: "alignVertical",
|
|
121
|
-
static: !1,
|
|
122
|
-
private: !1,
|
|
123
|
-
access: {
|
|
124
|
-
has: (e) => "alignVertical" in e,
|
|
125
|
-
get: (e) => e.alignVertical,
|
|
126
|
-
set: (e, t) => {
|
|
127
|
-
e.alignVertical = t;
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
metadata: e
|
|
131
|
-
}, E, D), i(this, null, O, {
|
|
132
|
-
kind: "accessor",
|
|
133
|
-
name: "baseGridSize",
|
|
134
|
-
static: !1,
|
|
135
|
-
private: !1,
|
|
136
|
-
access: {
|
|
137
|
-
has: (e) => "baseGridSize" in e,
|
|
138
|
-
get: (e) => e.baseGridSize,
|
|
139
|
-
set: (e, t) => {
|
|
140
|
-
e.baseGridSize = t;
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
metadata: e
|
|
144
|
-
}, k, A), i(this, null, j, {
|
|
145
|
-
kind: "accessor",
|
|
146
|
-
name: "height",
|
|
147
|
-
static: !1,
|
|
148
|
-
private: !1,
|
|
149
|
-
access: {
|
|
150
|
-
has: (e) => "height" in e,
|
|
151
|
-
get: (e) => e.height,
|
|
152
|
-
set: (e, t) => {
|
|
153
|
-
e.height = t;
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
metadata: e
|
|
157
|
-
}, ie, M), i(this, null, N, {
|
|
158
|
-
kind: "accessor",
|
|
159
|
-
name: "maxSeatReservations",
|
|
160
|
-
static: !1,
|
|
161
|
-
private: !1,
|
|
162
|
-
access: {
|
|
163
|
-
has: (e) => "maxSeatReservations" in e,
|
|
164
|
-
get: (e) => e.maxSeatReservations,
|
|
165
|
-
set: (e, t) => {
|
|
166
|
-
e.maxSeatReservations = t;
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
metadata: e
|
|
170
|
-
}, P, F), i(this, null, I, {
|
|
171
|
-
kind: "accessor",
|
|
172
|
-
name: "maxBicycleReservations",
|
|
173
|
-
static: !1,
|
|
174
|
-
private: !1,
|
|
175
|
-
access: {
|
|
176
|
-
has: (e) => "maxBicycleReservations" in e,
|
|
177
|
-
get: (e) => e.maxBicycleReservations,
|
|
178
|
-
set: (e, t) => {
|
|
179
|
-
e.maxBicycleReservations = t;
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
metadata: e
|
|
183
|
-
}, L, R), i(this, null, z, {
|
|
184
|
-
kind: "accessor",
|
|
185
|
-
name: "preventPlaceClick",
|
|
186
|
-
static: !1,
|
|
187
|
-
private: !1,
|
|
188
|
-
access: {
|
|
189
|
-
has: (e) => "preventPlaceClick" in e,
|
|
190
|
-
get: (e) => e.preventPlaceClick,
|
|
191
|
-
set: (e, t) => {
|
|
192
|
-
e.preventPlaceClick = t;
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
metadata: e
|
|
196
|
-
}, B, V), i(this, null, H, {
|
|
197
|
-
kind: "accessor",
|
|
198
|
-
name: "preselectCoachIndex",
|
|
199
|
-
static: !1,
|
|
200
|
-
private: !1,
|
|
201
|
-
access: {
|
|
202
|
-
has: (e) => "preselectCoachIndex" in e,
|
|
203
|
-
get: (e) => e.preselectCoachIndex,
|
|
204
|
-
set: (e, t) => {
|
|
205
|
-
e.preselectCoachIndex = t;
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
metadata: e
|
|
209
|
-
}, U, W), i(this, null, G, {
|
|
210
|
-
kind: "accessor",
|
|
211
|
-
name: "showTitleInfo",
|
|
212
|
-
static: !1,
|
|
213
|
-
private: !1,
|
|
214
|
-
access: {
|
|
215
|
-
has: (e) => "showTitleInfo" in e,
|
|
216
|
-
get: (e) => e.showTitleInfo,
|
|
217
|
-
set: (e, t) => {
|
|
218
|
-
e.showTitleInfo = t;
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
metadata: e
|
|
222
|
-
}, K, q), i(this, null, J, {
|
|
223
|
-
kind: "accessor",
|
|
224
|
-
name: "selectedCoachIndex",
|
|
225
|
-
static: !1,
|
|
226
|
-
private: !1,
|
|
227
|
-
access: {
|
|
228
|
-
has: (e) => "selectedCoachIndex" in e,
|
|
229
|
-
get: (e) => e.selectedCoachIndex,
|
|
230
|
-
set: (e, t) => {
|
|
231
|
-
e.selectedCoachIndex = t;
|
|
232
|
-
}
|
|
233
|
-
},
|
|
234
|
-
metadata: e
|
|
235
|
-
}, Y, X), i(this, null, Z, {
|
|
236
|
-
kind: "accessor",
|
|
237
|
-
name: "focusedCoachIndex",
|
|
238
|
-
static: !1,
|
|
239
|
-
private: !1,
|
|
240
|
-
access: {
|
|
241
|
-
has: (e) => "focusedCoachIndex" in e,
|
|
242
|
-
get: (e) => e.focusedCoachIndex,
|
|
243
|
-
set: (e, t) => {
|
|
244
|
-
e.focusedCoachIndex = t;
|
|
245
|
-
}
|
|
246
|
-
},
|
|
247
|
-
metadata: e
|
|
248
|
-
}, Q, $), i(this, null, ae, {
|
|
249
|
-
kind: "accessor",
|
|
250
|
-
name: "hoveredCoachIndex",
|
|
251
|
-
static: !1,
|
|
252
|
-
private: !1,
|
|
253
|
-
access: {
|
|
254
|
-
has: (e) => "hoveredCoachIndex" in e,
|
|
255
|
-
get: (e) => e.hoveredCoachIndex,
|
|
256
|
-
set: (e, t) => {
|
|
257
|
-
e.hoveredCoachIndex = t;
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
metadata: e
|
|
261
|
-
}, oe, se), i(this, null, ce, {
|
|
262
|
-
kind: "method",
|
|
263
|
-
name: "coachAreaScrollend",
|
|
264
|
-
static: !1,
|
|
265
|
-
private: !1,
|
|
266
|
-
access: {
|
|
267
|
-
has: (e) => "coachAreaScrollend" in e,
|
|
268
|
-
get: (e) => e.coachAreaScrollend
|
|
269
|
-
},
|
|
270
|
-
metadata: e
|
|
271
|
-
}, null, h), e && Object.defineProperty(this, Symbol.metadata, {
|
|
272
|
-
enumerable: !0,
|
|
273
|
-
configurable: !0,
|
|
274
|
-
writable: !0,
|
|
275
|
-
value: e
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
static {
|
|
279
|
-
this.events = {
|
|
280
|
-
selectedplaces: "selectedplaces",
|
|
281
|
-
selectedcoach: "selectedcoach"
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
#e;
|
|
285
|
-
get seatReservations() {
|
|
286
|
-
return this.#e;
|
|
287
|
-
}
|
|
288
|
-
set seatReservations(e) {
|
|
289
|
-
this.#e = e;
|
|
290
|
-
}
|
|
291
|
-
#t;
|
|
292
|
-
get travelDirection() {
|
|
293
|
-
return this.#t;
|
|
294
|
-
}
|
|
295
|
-
set travelDirection(e) {
|
|
296
|
-
this.#t = e;
|
|
297
|
-
}
|
|
298
|
-
#n;
|
|
299
|
-
get hasNavigation() {
|
|
300
|
-
return this.#n;
|
|
301
|
-
}
|
|
302
|
-
set hasNavigation(e) {
|
|
303
|
-
this.#n = e;
|
|
304
|
-
}
|
|
305
|
-
#r;
|
|
306
|
-
get alignVertical() {
|
|
307
|
-
return this.#r;
|
|
308
|
-
}
|
|
309
|
-
set alignVertical(e) {
|
|
310
|
-
this.#r = e;
|
|
311
|
-
}
|
|
312
|
-
#i;
|
|
313
|
-
get baseGridSize() {
|
|
314
|
-
return this.#i;
|
|
315
|
-
}
|
|
316
|
-
set baseGridSize(e) {
|
|
317
|
-
this.#i = e;
|
|
318
|
-
}
|
|
319
|
-
#a;
|
|
320
|
-
get height() {
|
|
321
|
-
return this.#a;
|
|
322
|
-
}
|
|
323
|
-
set height(e) {
|
|
324
|
-
this.#a = e;
|
|
325
|
-
}
|
|
326
|
-
#o;
|
|
327
|
-
get maxSeatReservations() {
|
|
328
|
-
return this.#o;
|
|
329
|
-
}
|
|
330
|
-
set maxSeatReservations(e) {
|
|
331
|
-
this.#o = e;
|
|
332
|
-
}
|
|
333
|
-
#s;
|
|
334
|
-
get maxBicycleReservations() {
|
|
335
|
-
return this.#s;
|
|
336
|
-
}
|
|
337
|
-
set maxBicycleReservations(e) {
|
|
338
|
-
this.#s = e;
|
|
339
|
-
}
|
|
340
|
-
#c;
|
|
341
|
-
get preventPlaceClick() {
|
|
342
|
-
return this.#c;
|
|
343
|
-
}
|
|
344
|
-
set preventPlaceClick(e) {
|
|
345
|
-
this.#c = e;
|
|
346
|
-
}
|
|
347
|
-
#l;
|
|
348
|
-
get preselectCoachIndex() {
|
|
349
|
-
return this.#l;
|
|
350
|
-
}
|
|
351
|
-
set preselectCoachIndex(e) {
|
|
352
|
-
this.#l = e;
|
|
353
|
-
}
|
|
354
|
-
#u;
|
|
355
|
-
get showTitleInfo() {
|
|
356
|
-
return this.#u;
|
|
357
|
-
}
|
|
358
|
-
set showTitleInfo(e) {
|
|
359
|
-
this.#u = e;
|
|
360
|
-
}
|
|
361
|
-
#d;
|
|
362
|
-
get selectedCoachIndex() {
|
|
363
|
-
return this.#d;
|
|
364
|
-
}
|
|
365
|
-
set selectedCoachIndex(e) {
|
|
366
|
-
this.#d = e;
|
|
367
|
-
}
|
|
368
|
-
#f;
|
|
369
|
-
get focusedCoachIndex() {
|
|
370
|
-
return this.#f;
|
|
371
|
-
}
|
|
372
|
-
set focusedCoachIndex(e) {
|
|
373
|
-
this.#f = e;
|
|
374
|
-
}
|
|
375
|
-
#p;
|
|
376
|
-
get hoveredCoachIndex() {
|
|
377
|
-
return this.#p;
|
|
378
|
-
}
|
|
379
|
-
set hoveredCoachIndex(e) {
|
|
380
|
-
this.#p = e;
|
|
381
|
-
}
|
|
382
|
-
constructor() {
|
|
383
|
-
super(), this.#e = (a(this, h), a(this, _, null)), this.#t = (a(this, v), a(this, b, "NONE")), this.#n = (a(this, x), a(this, C, !0)), this.#r = (a(this, w), a(this, E, !1)), this.#i = (a(this, D), a(this, k, 16)), this.#a = (a(this, A), a(this, ie, null)), this.#o = (a(this, M), a(this, P, -1)), this.#s = (a(this, F), a(this, L, -1)), this.#c = (a(this, R), a(this, B, !1)), this.#l = (a(this, V), a(this, U, -1)), this.#u = (a(this, W), a(this, K, !1)), this.#d = (a(this, q), a(this, Y, -1)), this.#f = (a(this, X), a(this, Q, -1)), this.#p = (a(this, $), a(this, oe, -1)), this.coachBorderPadding = (a(this, se), 6), this.gapBetweenCoaches = 4, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.gapBetweenCoachDecks = 48, this.coachNavButtonDim = 0, this.globalAreaIconDim = {
|
|
384
|
-
w: 2,
|
|
385
|
-
h: 2
|
|
386
|
-
}, this.globalAreaIconPadding = .8, this.coachItemDetailsElements = [], this.currScrollDirection = d.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 = {
|
|
387
|
-
seats: [],
|
|
388
|
-
bicycles: []
|
|
389
|
-
}, this.seatReservationWithoutNavigationHasFocus = !1, this.isCoachGridFocusable = !1, this.isAutoScrolling = !1, this.isKeyboardNavigation = !1, this.hasMultipleDecks = !1, this.hasSeatReservationNativeFocus = !1, this.keyboardNavigationEvents = {
|
|
390
|
-
ArrowLeft: "ArrowLeft",
|
|
391
|
-
ArrowRight: "ArrowRight",
|
|
392
|
-
ArrowUp: "ArrowUp",
|
|
393
|
-
ArrowDown: "ArrowDown",
|
|
394
|
-
Tab: "Tab",
|
|
395
|
-
Enter: "Enter"
|
|
396
|
-
}, this.seatReservationStructure = { decks: [] }, this.notFixedRotatableAreaIcons = ["ENTRY_EXIT"], this.notAreaElements = [
|
|
397
|
-
"DRIVER_AREA",
|
|
398
|
-
"DRIVER_AREA_NO_VERTICAL_WALL",
|
|
399
|
-
"COACH_PASSAGE",
|
|
400
|
-
"COACH_WALL_NO_PASSAGE",
|
|
401
|
-
"COMPARTMENT_PASSAGE",
|
|
402
|
-
"COMPARTMENT_PASSAGE_HIGH",
|
|
403
|
-
"COMPARTMENT_PASSAGE_MIDDLE",
|
|
404
|
-
"COMPARTMENT_PASSAGE_LOW",
|
|
405
|
-
"COMPARTMENT_WALL"
|
|
406
|
-
], this.middleBorderDockingElements = [
|
|
407
|
-
"DRIVER_AREA",
|
|
408
|
-
"DRIVER_AREA_NO_VERTICAL_WALL",
|
|
409
|
-
"COACH_PASSAGE",
|
|
410
|
-
"COACH_WALL_NO_PASSAGE"
|
|
411
|
-
], this._isRunningInitPreselectCoachIndex = !1, this._lastStartScrollPos = -1, this._prepareServiceIconsNavigation = (e) => e && e?.map(function(e) {
|
|
412
|
-
return {
|
|
413
|
-
pId: e,
|
|
414
|
-
svgName: u[e]?.svgName ? u[e]?.svgName : ""
|
|
415
|
-
};
|
|
416
|
-
}).filter((e) => re.indexOf(e.svgName) !== -1).filter((e, t, n) => n.map((e) => e.svgName).indexOf(e.svgName) === t).map((e) => e.pId).slice(0, ne) || [], this.addEventListener("blur", () => this._onLeaveSeatReservationComponent());
|
|
417
|
-
}
|
|
418
|
-
willUpdate(e) {
|
|
419
|
-
if (super.willUpdate(e), e.has("seatReservations") && (this.hasMultipleDecks = this.seatReservations?.length > 1, this._initPrepareSeatReservationData(), 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._initPrepareSeatReservationData(), this.initNavigationSelectionByScrollEvent()), e.has("height") && this.height) {
|
|
420
|
-
let e = this.seatReservations[this.currSelectedDeckIndex] || null;
|
|
421
|
-
e?.coachItems.length && (this.baseGridSize = this.height / e.coachItems[0].dimension.h, this.coachBorderOffset = this.coachBorderPadding / this.baseGridSize, this.style?.setProperty("--sbb-seat-reservation-grid-size", `${this.baseGridSize}px`), this._initPrepareSeatReservationData(), this.initNavigationSelectionByScrollEvent());
|
|
422
|
-
}
|
|
423
|
-
e.has("alignVertical") && (this._initPrepareSeatReservationData(), this.initNavigationSelectionByScrollEvent()), e.has("preselectCoachIndex") && (this._isRunningInitPreselectCoachIndex = !0, setTimeout(() => this.scrollToSelectedNavCoach(this.preselectCoachIndex), 1));
|
|
424
|
-
}
|
|
425
|
-
navigateByDirectionBtn(e) {
|
|
426
|
-
this.unfocusPlaceElement();
|
|
427
|
-
let t = this.currSelectedCoachIndex;
|
|
428
|
-
e == "DIRECTION_LEFT" && t > 0 ? t = this.currSelectedCoachIndex == -1 ? 0 : this.currSelectedCoachIndex - 1 : e == "DIRECTION_RIGHT" && t < this.seatReservations[this.currSelectedDeckIndex]?.coachItems.length - 1 && (t = this.currSelectedCoachIndex == -1 ? 0 : this.currSelectedCoachIndex + 1), this.scrollToSelectedNavCoach(t);
|
|
429
|
-
}
|
|
430
|
-
_initPrepareSeatReservationData() {
|
|
431
|
-
this._determineBaseFontSize(), this.hasMultipleDecks && this._initEmptyCoachDeckOffsets(), this._prepareCoachItemDetailsData(), this._prepareSeatReservationStructureInformation(), this._prepareOptimizeAreaIconDimensionByMedian();
|
|
432
|
-
}
|
|
433
|
-
initNavigationSelectionByScrollEvent() {
|
|
434
|
-
this.coachScrollArea = this.shadowRoot?.querySelector("#sbb-sr__wrapper-scrollarea"), this.navigationScrollArea = this.shadowRoot?.querySelector("#sbb-sr__navigation-list-coaches");
|
|
435
|
-
let e = this.seatReservations ? this.seatReservations[this.currSelectedDeckIndex] : null;
|
|
436
|
-
if (e && e.coachItems.length > 0) {
|
|
437
|
-
let t = e.coachItems[0].dimension.h * this.baseGridSize + this.coachBorderPadding, n = (this.seatReservations.length - 1) * this.gapBetweenCoachDecks;
|
|
438
|
-
this.style?.setProperty("--sbb-seat-reservation-height", `${t * this.seatReservations.length + n}`), this.style?.setProperty("--sbb-seat-reservation-decks", `${this.seatReservations.length}`);
|
|
439
|
-
}
|
|
440
|
-
if (this.navigationScrollArea) {
|
|
441
|
-
this.scrollNavigationAreaDim = this.alignVertical ? this.navigationScrollArea.getBoundingClientRect().height : this.navigationScrollArea.getBoundingClientRect().width;
|
|
442
|
-
let e = this.navigationScrollArea.querySelector("ul > li");
|
|
443
|
-
if (e) {
|
|
444
|
-
let t = e?.getBoundingClientRect();
|
|
445
|
-
this.coachNavButtonDim = this.alignVertical ? t.height : t.width;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
if (this.coachScrollArea && e) {
|
|
449
|
-
let t = 0;
|
|
450
|
-
this.scrollCoachesAreaWidth = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, this.triggerCoachPositionsCollection = e.coachItems.map((e, n) => {
|
|
451
|
-
let r = this.seatReservationStructure.decks[this.currSelectedDeckIndex].deckCoaches[n], i = t;
|
|
452
|
-
return t += r.width + (r.hasOverhangingElements ? 2 * this.gapBetweenCoaches : this.gapBetweenCoaches), {
|
|
453
|
-
start: i,
|
|
454
|
-
end: t,
|
|
455
|
-
width: r.width
|
|
456
|
-
};
|
|
457
|
-
}), this.maxCalcCoachesWidth = t - this.gapBetweenCoaches;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
coachAreaScrollend() {
|
|
461
|
-
this._scrollTimeout && clearTimeout(this._scrollTimeout), this._scrollTimeout = setTimeout(() => this._handleCoachAreaScrollendEvent(), 150);
|
|
462
|
-
}
|
|
463
|
-
onFocusTableCoachAndPreselectPlace(e) {
|
|
464
|
-
!this.seatReservationWithoutNavigationHasFocus && !this.hasNavigation && (this.seatReservationWithoutNavigationHasFocus = !0, this.currSelectedCoachIndex = e === 0 ? this.getNextAvailableCoachIndex(-1) : this.getPrevAvailableCoachIndex(e), this.preselectPlaceInCoach());
|
|
465
|
-
}
|
|
466
|
-
onFocusNavDirectionButton() {
|
|
467
|
-
this.focusedCoachIndex = -1;
|
|
468
|
-
}
|
|
469
|
-
onKeyNavigationNavCoachButton(e, t) {
|
|
470
|
-
if (e.key === this.keyboardNavigationEvents.Tab) {
|
|
471
|
-
this._handleTabKeyNavigation(e, "navigation", t);
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
n(e) && this.keyboardSeatmapEventHandling(e);
|
|
475
|
-
}
|
|
476
|
-
_handleTabKeyNavigation(e, t, n) {
|
|
477
|
-
let r = e.key, i = e.shiftKey;
|
|
478
|
-
r === this.keyboardNavigationEvents.Tab && (t == "navigation" ? (n == this.currSelectedCoachIndex ? !this.currSelectedPlace || !i || this.coachItemDetailsElements[n].isDriverArea || this.focusedCoachIndex == -1 ? this.focusedCoachIndex = n : i && this.currSelectedPlace && (this.focusedCoachIndex = -1, this.focusPlaceElement(this.currSelectedPlace)) : this.focusedCoachIndex = n, this._scrollToSelectedNavigationButton(n)) : t == "seatmap" && (e.preventDefault(), i ? this._navigateCoachNavigationByKeyboard("PREV_TAB") : this._navigateCoachNavigationByKeyboard("NEXT_TAB")));
|
|
479
|
-
}
|
|
480
|
-
keyboardSeatmapEventHandling(e) {
|
|
481
|
-
let t = e.key === this.keyboardNavigationEvents.Tab, r = e.shiftKey && t;
|
|
482
|
-
if (!this.hasNavigation && this.currSelectedCoachIndex === 0 && r || this.currSelectedCoachIndex === this.coachItemDetailsElements.length - 1 && t) return;
|
|
483
|
-
let i = e.key;
|
|
484
|
-
if (this.preventCoachScrollByPlaceClick = !1, !this.hasSeatReservationNativeFocus && (t || r) && (this.hasSeatReservationNativeFocus = !0), t) {
|
|
485
|
-
this._handleTabKeyNavigation(e, "seatmap");
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
if (this.currSelectedCoachIndex !== -1 && n(e)) switch (e.preventDefault(), i) {
|
|
489
|
-
case this.keyboardNavigationEvents.ArrowLeft:
|
|
490
|
-
{
|
|
491
|
-
let e = this.alignVertical ? this.keyboardNavigationEvents.ArrowDown : i;
|
|
492
|
-
this._navigateToPlaceByKeyboard(e);
|
|
493
|
-
}
|
|
494
|
-
break;
|
|
495
|
-
case this.keyboardNavigationEvents.ArrowRight:
|
|
496
|
-
{
|
|
497
|
-
let e = this.alignVertical ? this.keyboardNavigationEvents.ArrowUp : i;
|
|
498
|
-
this._navigateToPlaceByKeyboard(e);
|
|
499
|
-
}
|
|
500
|
-
break;
|
|
501
|
-
case this.keyboardNavigationEvents.ArrowUp:
|
|
502
|
-
{
|
|
503
|
-
let e = this.alignVertical ? this.keyboardNavigationEvents.ArrowLeft : i;
|
|
504
|
-
this._navigateToPlaceByKeyboard(e);
|
|
505
|
-
}
|
|
506
|
-
break;
|
|
507
|
-
case this.keyboardNavigationEvents.ArrowDown:
|
|
508
|
-
{
|
|
509
|
-
let e = this.alignVertical ? this.keyboardNavigationEvents.ArrowRight : i;
|
|
510
|
-
this._navigateToPlaceByKeyboard(e);
|
|
511
|
-
}
|
|
512
|
-
break;
|
|
513
|
-
default: break;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
preselectPlaceInCoach() {
|
|
517
|
-
if (this.isAutoScrolling) {
|
|
518
|
-
if (this._isRunningInitPreselectCoachIndex) {
|
|
519
|
-
this._isRunningInitPreselectCoachIndex = !1;
|
|
520
|
-
return;
|
|
521
|
-
}
|
|
522
|
-
if (this.coachItemDetailsElements[this.currSelectedCoachIndex] && this.coachItemDetailsElements[this.currSelectedCoachIndex].isDriverArea) {
|
|
523
|
-
this._setFocusToSelectedCoachGrid();
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
if (this.isKeyboardNavigation && this.isAutoScrolling) {
|
|
527
|
-
let e = this._getClosestPlaceByKeyDirection();
|
|
528
|
-
e ? (this.unfocusPlaceElement(), this.focusPlaceElement(e), this.focusedCoachIndex = -1) : this._setFocusToSelectedCoachGrid();
|
|
529
|
-
} else this.unfocusPlaceElement(), this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid();
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
scrollToSelectedNavCoach(e) {
|
|
533
|
-
if (this._isValidCoachIndex(e) && e !== this.currSelectedCoachIndex) {
|
|
534
|
-
this.hoveredCoachIndex = e, this.isAutoScrolling = !0, this.isCoachGridFocusable = !0, this.currSelectedCoachIndex = e, this.currSelectedDeckIndex = this._getExistingCoachDeckIndex(), this._setScrollDirectionByCoachIndex();
|
|
535
|
-
let t = this._getCoachScrollPositionX();
|
|
536
|
-
(this.selectedCoachIndex !== -1 || this.currSelectedCoachIndex > 0) && this._isScrollableToSelectedCoach() ? (this._lastStartScrollPos = this.coachScrollArea.scrollLeft, this.coachScrollArea.scrollTo({
|
|
537
|
-
top: this.alignVertical ? t : 0,
|
|
538
|
-
left: this.alignVertical ? 0 : t,
|
|
539
|
-
behavior: "smooth"
|
|
540
|
-
})) : this.updateCurrentSelectedCoach(), this._scrollToSelectedNavigationButton(e);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
focusPlaceElement(e) {
|
|
544
|
-
if (this.unfocusPlaceElement(), e) {
|
|
545
|
-
this.currSelectedPlace = e, this._setCurrSelectedPlaceElementId(e);
|
|
546
|
-
let t = this._getPlaceHtmlElement();
|
|
547
|
-
if (t) {
|
|
548
|
-
t.setAttribute("keyfocus", "focus");
|
|
549
|
-
let n = setTimeout(() => {
|
|
550
|
-
let t = this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number);
|
|
551
|
-
this._scrollPlaceIntoNearestViewport(t), clearTimeout(n);
|
|
552
|
-
}, 0);
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
unfocusPlaceElement() {
|
|
557
|
-
let e = this._getPlaceHtmlElement();
|
|
558
|
-
e && (e.setAttribute("keyfocus", "unfocus"), this._setCurrSelectedPlaceElementId(null), this.currSelectedPlace = null);
|
|
559
|
-
}
|
|
560
|
-
getCalculatedDimension(e, t, n, r) {
|
|
561
|
-
return t && !n && (e.h += this.coachBorderOffset * 2), r && (e.h += this.coachBorderOffset), {
|
|
562
|
-
w: Math.round(this.baseGridSize * e.w),
|
|
563
|
-
h: Math.round(this.baseGridSize * e.h)
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
getCalculatedPosition(e, t, n, r) {
|
|
567
|
-
if (n && t) {
|
|
568
|
-
let i = r ? n.h : n.h + this.coachBorderOffset;
|
|
569
|
-
e.y === 0 ? e.y -= this.coachBorderOffset : e.y + t.h === i && (e.y += this.coachBorderOffset);
|
|
570
|
-
}
|
|
571
|
-
return {
|
|
572
|
-
x: Math.round(this.baseGridSize * e.x),
|
|
573
|
-
y: Math.round(this.baseGridSize * e.y),
|
|
574
|
-
z: e.z
|
|
575
|
-
};
|
|
576
|
-
}
|
|
577
|
-
isElementDirectlyOnBorder(e, t) {
|
|
578
|
-
return e.position.y === 0 || e.position.y + e.dimension.h === t.h;
|
|
579
|
-
}
|
|
580
|
-
getAvailableFreePlacesNumFromCoach(e) {
|
|
581
|
-
let t = {
|
|
582
|
-
seats: 0,
|
|
583
|
-
bicycles: 0
|
|
584
|
-
};
|
|
585
|
-
return e?.reduce((e, t) => (t.state === "FREE" && (t.type === "SEAT" ? e.seats++ : e.bicycles++), e), t) || t;
|
|
586
|
-
}
|
|
587
|
-
_handleCoachAreaScrollendEvent() {
|
|
588
|
-
let e = this.isAutoScrolling ? this.currSelectedCoachIndex : this._getCoachIndexByScrollTriggerPosition();
|
|
589
|
-
if (this.preventCoachScrollByPlaceClick) {
|
|
590
|
-
Math.abs(this._lastStartScrollPos - this.coachScrollArea.scrollLeft) > this.baseGridSize * 2 && (this.selectedCoachIndex = e), this.preventCoachScrollByPlaceClick = !1;
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
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);
|
|
594
|
-
}
|
|
595
|
-
_scrollToSelectedNavigationButton(e) {
|
|
596
|
-
setTimeout(() => {
|
|
597
|
-
if (this.hasNavigation && this.navigationScrollArea) {
|
|
598
|
-
let t = this.scrollNavigationAreaDim / 2, n = e * this.coachNavButtonDim - t + this.coachNavButtonDim;
|
|
599
|
-
this.navigationScrollArea.scrollTo({
|
|
600
|
-
top: this.alignVertical ? n : 0,
|
|
601
|
-
left: this.alignVertical ? 0 : n,
|
|
602
|
-
behavior: "smooth"
|
|
603
|
-
});
|
|
604
|
-
}
|
|
605
|
-
}, 10);
|
|
606
|
-
}
|
|
607
|
-
_setScrollDirectionByCoachIndex() {
|
|
608
|
-
this.currScrollDirection = this.currSelectedCoachIndex > this.selectedCoachIndex ? d.right : d.left;
|
|
609
|
-
}
|
|
610
|
-
_getCoachScrollPositionX() {
|
|
611
|
-
let e = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex];
|
|
612
|
-
return this.isKeyboardNavigation && this.currScrollDirection === d.left && e.width > this.scrollCoachesAreaWidth ? e.end - this.scrollCoachesAreaWidth : e.start;
|
|
613
|
-
}
|
|
614
|
-
_setFocusToSelectedCoachGrid() {
|
|
615
|
-
if (this.isCoachGridFocusable && this.hasSeatReservationNativeFocus) {
|
|
616
|
-
this.isCoachGridFocusable = !1;
|
|
617
|
-
let e = this.shadowRoot?.querySelector("#sbb-sr-coach-caption-" + this.currSelectedCoachIndex);
|
|
618
|
-
e && e.focus();
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
_isScrollableToSelectedCoach() {
|
|
622
|
-
let e = this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft, t = this.alignVertical ? this.coachScrollArea.getBoundingClientRect().height : this.coachScrollArea.getBoundingClientRect().width, n = this.maxCalcCoachesWidth - t, r = this.triggerCoachPositionsCollection[this.currSelectedCoachIndex], i = e === this.triggerCoachPositionsCollection[this.currSelectedCoachIndex].start;
|
|
623
|
-
return (e < n || e > r.start) && !i;
|
|
624
|
-
}
|
|
625
|
-
_getCoachIndexByScrollTriggerPosition() {
|
|
626
|
-
let e = (this.alignVertical ? this.coachScrollArea.scrollTop : this.coachScrollArea.scrollLeft) + this.scrollCoachesAreaWidth / 2;
|
|
627
|
-
return this.triggerCoachPositionsCollection.findIndex((t) => e >= t.start && e <= t.end);
|
|
628
|
-
}
|
|
629
|
-
_getFirstPlaceInSelectedCoach() {
|
|
630
|
-
let e = null, t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex], n = "cell-" + this.currSelectedDeckIndex + "-" + this.currSelectedCoachIndex + "-0-0", r = this.shadowRoot?.querySelector("#" + n)?.querySelector("sbb-seat-reservation-place-control")?.getAttribute("text") || null;
|
|
631
|
-
return t && r && (e = t.places?.find((e) => e.number === r) || null), e;
|
|
632
|
-
}
|
|
633
|
-
_getSwitchedCoachDeckIndexByKeyNavigation(e, t) {
|
|
634
|
-
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;
|
|
635
|
-
}
|
|
636
|
-
_getClosestPlaceByKeyDirection(e) {
|
|
637
|
-
let t = this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex], n = null, r = t.places, i = null;
|
|
638
|
-
if (r) {
|
|
639
|
-
if (!this.currSelectedPlaceElementId) return this._getFirstPlaceInSelectedCoach();
|
|
640
|
-
if (this.currSelectedPlace) {
|
|
641
|
-
let a = { ...this.currSelectedPlace.position };
|
|
642
|
-
e && (i = this._getSwitchedCoachDeckIndexByKeyNavigation(e, t), i !== null && (r = this.seatReservations[i].coachItems[this.currSelectedCoachIndex].places || [], a.y = i < this.currSelectedDeckIndex ? t.dimension.h : -1));
|
|
643
|
-
for (let t of r) e ? t.number !== this.currSelectedPlace?.number && (e === this.keyboardNavigationEvents.ArrowRight && (t.position.y === a.y || t.position.y === a.y - 1) && t.position.x > a.x && (!n || t.position.x < n.position.x) || e === this.keyboardNavigationEvents.ArrowDown && (t.position.x === a.x || t.position.x === a.x + 1) && t.position.y > a.y && (!n || t.position.y < n.position.y) || e === this.keyboardNavigationEvents.ArrowLeft && (t.position.y === a.y || t.position.y === a.y + 1) && t.position.x < a.x && (!n || t.position.x > n.position.x) || e === this.keyboardNavigationEvents.ArrowUp && (t.position.x === a.x || t.position.x === a.x - 1) && t.position.y < a.y && (!n || t.position.y > n.position.y)) && (n = t) : (this.currScrollDirection === d.right && t.position.y === a.y && (!n || t.position.x < n.position.x) || this.currScrollDirection === d.left && t.position.y === a.y && (!n || t.position.x > n.position.x)) && (n = t);
|
|
644
|
-
i !== null && n && (this.currSelectedDeckIndex = i);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
return n;
|
|
648
|
-
}
|
|
649
|
-
_navigateCoachNavigationByKeyboard(e) {
|
|
650
|
-
let t = this.focusedCoachIndex === -1 ? this.currSelectedCoachIndex === -1 ? 0 : this.currSelectedCoachIndex : this.focusedCoachIndex, n = e === "NEXT_TAB" ? this.getNextAvailableCoachIndex(t) : this.getPrevAvailableCoachIndex(t);
|
|
651
|
-
if (this.hasNavigation) {
|
|
652
|
-
let r = this._getPlaceHtmlElement(), i = r ? r.getAttribute("keyfocus") === "focus" : !1;
|
|
653
|
-
if (e === "PREV_TAB" && this.selectedCoachIndex === t) if (i || this.currSelectedPlace !== null) {
|
|
654
|
-
this.focusedCoachIndex = t, this.unfocusPlaceElement();
|
|
655
|
-
return;
|
|
656
|
-
} else t === 0 ? this._refocusCurrentFocusedNavCoach(t) : this.focusedCoachIndex = n;
|
|
657
|
-
else n === this.currSelectedCoachIndex ? e === "NEXT_TAB" && n === this.coachItemDetailsElements.length - 1 ? this._refocusCurrentFocusedNavCoach(t) : (this.focusedCoachIndex = -1, this.selectedCoachIndex = n, i ? this.focusPlaceElement(this.currSelectedPlace) : (this.isCoachGridFocusable = !0, this._setFocusToSelectedCoachGrid())) : this.focusedCoachIndex = n;
|
|
658
|
-
this._scrollToSelectedNavigationButton(n);
|
|
659
|
-
} else this.scrollToSelectedNavCoach(n);
|
|
660
|
-
}
|
|
661
|
-
_refocusCurrentFocusedNavCoach(e) {
|
|
662
|
-
this.focusedCoachIndex = -1, setTimeout(() => this.focusedCoachIndex = e, 0);
|
|
663
|
-
}
|
|
664
|
-
_navigateToPlaceByKeyboard(e) {
|
|
665
|
-
if (this.isKeyboardNavigation = !0, this.focusedCoachIndex !== -1 && (this.focusedCoachIndex = -1), !this.preventPlaceClick) {
|
|
666
|
-
let t = this._getClosestPlaceByKeyDirection(e);
|
|
667
|
-
if (t) this.focusPlaceElement(t);
|
|
668
|
-
else if (e === this.keyboardNavigationEvents.ArrowRight || e === this.keyboardNavigationEvents.ArrowLeft || this.alignVertical && (e === this.keyboardNavigationEvents.ArrowUp || e === this.keyboardNavigationEvents.ArrowDown)) {
|
|
669
|
-
let t = e === this.keyboardNavigationEvents.ArrowRight ? this.getNextAvailableCoachIndex() : this.getPrevAvailableCoachIndex();
|
|
670
|
-
this.scrollToSelectedNavCoach(t);
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
getNextAvailableCoachIndex(e) {
|
|
675
|
-
let t = e ?? this.currSelectedCoachIndex;
|
|
676
|
-
return t < this.seatReservations[this.currSelectedDeckIndex].coachItems.length - 1 ? t + 1 : t;
|
|
677
|
-
}
|
|
678
|
-
getPrevAvailableCoachIndex(e) {
|
|
679
|
-
let t = e ?? this.currSelectedCoachIndex;
|
|
680
|
-
return t > 0 ? t - 1 : t;
|
|
681
|
-
}
|
|
682
|
-
updateSelectedSeatReservationPlaces(e) {
|
|
683
|
-
let t = e.placeType === "SEAT" ? "seats" : "bicycles", n = e.placeType === "SEAT" ? this.maxSeatReservations : this.maxBicycleReservations, r = this.selectedSeatReservationPlaces[t];
|
|
684
|
-
this.selectedSeatReservationPlaces[t] = this._updateSelectedSeatReservationPlaces(r, n, e);
|
|
685
|
-
let i = this.selectedSeatReservationPlaces;
|
|
686
|
-
this.dispatchEvent(new f(i));
|
|
687
|
-
}
|
|
688
|
-
_updateSelectedSeatReservationPlaces(e, t, n) {
|
|
689
|
-
if (n.state === "SELECTED") {
|
|
690
|
-
let t = this._getDeckIndexByPlaceId(n.id), r = this._getSeatReservationPlaceSelection(n, t);
|
|
691
|
-
r && e.push(r);
|
|
692
|
-
} else e = e.filter((e) => e.id !== n.id);
|
|
693
|
-
if (t > -1 && e.length > t) {
|
|
694
|
-
let r = t > 0 ? n : void 0;
|
|
695
|
-
e = this._resetAllPlaceSelections(e, r);
|
|
696
|
-
}
|
|
697
|
-
return e;
|
|
698
|
-
}
|
|
699
|
-
updateCurrentSelectedPlaceInCoach(e) {
|
|
700
|
-
let t = this._getDeckIndexByPlaceId(e.id), n = e.coachIndex;
|
|
701
|
-
if (t === null) return;
|
|
702
|
-
let r = this.seatReservations[t].coachItems[n].places?.find((t) => t.number == e.number);
|
|
703
|
-
if (!r) return;
|
|
704
|
-
this.currSelectedDeckIndex = t, this.currSelectedCoachIndex = n, this.currSelectedPlace = r, this.currSelectedCoachIndex !== this.selectedCoachIndex && this.updateCurrentSelectedCoach(), this._setCurrSelectedPlaceElementId(r);
|
|
705
|
-
let i = setTimeout(() => {
|
|
706
|
-
this._scrollPlaceIntoNearestViewport(e.id), clearTimeout(i);
|
|
707
|
-
}, 0);
|
|
708
|
-
}
|
|
709
|
-
updateCurrentSelectedCoach() {
|
|
710
|
-
if (this.currSelectedCoachIndex == this.selectedCoachIndex) return;
|
|
711
|
-
this.focusedCoachIndex != -1 && (this.focusedCoachIndex = this.currSelectedCoachIndex), this.selectedCoachIndex = this.currSelectedCoachIndex;
|
|
712
|
-
let e = this._getSeatReservationSelectedCoach(this.selectedCoachIndex);
|
|
713
|
-
e && this.dispatchEvent(new p(e));
|
|
714
|
-
}
|
|
715
|
-
getPlaceElementId(e, t, n) {
|
|
716
|
-
return "seat-reservation__place-button-" + e + "-" + t + "-" + n;
|
|
717
|
-
}
|
|
718
|
-
_initEmptyCoachDeckOffsets() {
|
|
719
|
-
let e = Array(this.seatReservations.length - 1).fill(0);
|
|
720
|
-
this.seatReservations[this.seatReservations.length - 1].coachItems.forEach((t) => {
|
|
721
|
-
for (let n = 0; n < this.seatReservations.length - 1; n++) {
|
|
722
|
-
let r = this.seatReservations[n].coachItems[e[n]];
|
|
723
|
-
if (t.id != r?.id) {
|
|
724
|
-
let r = {
|
|
725
|
-
...t,
|
|
726
|
-
places: void 0,
|
|
727
|
-
propertyIds: void 0,
|
|
728
|
-
graphicElements: void 0,
|
|
729
|
-
serviceElements: void 0,
|
|
730
|
-
travelClass: []
|
|
731
|
-
};
|
|
732
|
-
this.seatReservations[n].coachItems.splice(e[n], 0, r);
|
|
733
|
-
}
|
|
734
|
-
e[n]++;
|
|
735
|
-
}
|
|
736
|
-
});
|
|
737
|
-
}
|
|
738
|
-
_initSeatReservationPlaceSelection() {
|
|
739
|
-
this.selectedSeatReservationPlaces.seats = [], this.selectedSeatReservationPlaces.bicycles = [], this.seatReservations?.forEach((e, t) => e.coachItems.map((n, r) => {
|
|
740
|
-
n.places?.filter((e) => e.state === "SELECTED")?.forEach((n) => {
|
|
741
|
-
let i = te(n, this.getPlaceElementId(t, r, n.number), e.deckCoachIndex, r), a = this._getSeatReservationPlaceSelection(i, t);
|
|
742
|
-
a && (a.placeType === "SEAT" ? this.selectedSeatReservationPlaces.seats.push(a) : this.selectedSeatReservationPlaces.bicycles.push(a));
|
|
743
|
-
});
|
|
744
|
-
}));
|
|
745
|
-
}
|
|
746
|
-
_resetAllPlaceSelections(e, t) {
|
|
747
|
-
for (let n of e) if (!t || t.id !== n.id) {
|
|
748
|
-
let e = this.shadowRoot?.getElementById(n.id);
|
|
749
|
-
e && e.setAttribute("state", "FREE");
|
|
750
|
-
}
|
|
751
|
-
return e = t ? e.filter((e) => e.id === t.id) : [], e;
|
|
752
|
-
}
|
|
753
|
-
_getSeatReservationPlaceSelection(e, t) {
|
|
754
|
-
if (t === null) return null;
|
|
755
|
-
let n = this.seatReservations[t].coachItems[e.coachIndex], r = n.places?.find((t) => t.number === e.number);
|
|
756
|
-
return r ? ee(r, n, e.id, e.deckIndex, e.coachIndex) : null;
|
|
757
|
-
}
|
|
758
|
-
_getSeatReservationSelectedCoach(e) {
|
|
759
|
-
if (!this.seatReservations[this.currSelectedDeckIndex].coachItems[e]) return null;
|
|
760
|
-
let t = this.seatReservations[this.currSelectedDeckIndex].coachItems[e];
|
|
761
|
-
return l(e, t, this.getAvailableFreePlacesNumFromCoach(t.places));
|
|
762
|
-
}
|
|
763
|
-
_setCurrSelectedPlaceElementId(e) {
|
|
764
|
-
this.currSelectedPlaceElementId = e ? this.getPlaceElementId(this.currSelectedDeckIndex, this.currSelectedCoachIndex, e.number) : null;
|
|
765
|
-
}
|
|
766
|
-
_determineBaseFontSize() {
|
|
767
|
-
if (!r) {
|
|
768
|
-
let e = 1 / parseInt(window.getComputedStyle(document.body).fontSize, 10);
|
|
769
|
-
this.style?.setProperty("--sbb-seat-reservation-one-px-rem", `${e + "rem"}`);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
_prepareCoachItemDetailsData() {
|
|
773
|
-
if (this.seatReservations) {
|
|
774
|
-
let e = this.seatReservations[this.seatReservations.length - 1].coachItems;
|
|
775
|
-
this.coachItemDetailsElements = [], e.forEach((e, t) => {
|
|
776
|
-
let n = [], r = [], i = [];
|
|
777
|
-
this.seatReservations.map((e) => e.coachItems[t]).forEach((e) => {
|
|
778
|
-
n.push(...e.travelClass), r.push(...e.propertyIds ? e.propertyIds : []), i.push(...e.places ? e.places : []);
|
|
779
|
-
}), this.coachItemDetailsElements.push({
|
|
780
|
-
id: e.id,
|
|
781
|
-
travelClass: this._prepareTravelClassNavigation(n),
|
|
782
|
-
propertyIds: this._prepareServiceIconsNavigation(r),
|
|
783
|
-
isDriverArea: e.places ? e.places.length === 0 : !0,
|
|
784
|
-
isLocomotive: this._isLocomotive(e),
|
|
785
|
-
driverAreaSide: this._prepareDriverAreaSideNavigation(e),
|
|
786
|
-
freePlaces: this.getAvailableFreePlacesNumFromCoach(i)
|
|
787
|
-
});
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
_prepareOptimizeAreaIconDimensionByMedian() {
|
|
792
|
-
if (this.seatReservations) {
|
|
793
|
-
let e = [];
|
|
794
|
-
if (this.seatReservations.forEach((t) => t.coachItems.forEach((t) => t.serviceElements?.forEach((t) => e.push(t.dimension)))), e.length) {
|
|
795
|
-
e.sort((e, t) => {
|
|
796
|
-
if (e && t) {
|
|
797
|
-
let n = e.w + e.h, r = t.w + t.h;
|
|
798
|
-
return n > r ? 1 : n < r ? -1 : 0;
|
|
799
|
-
}
|
|
800
|
-
return 0;
|
|
801
|
-
});
|
|
802
|
-
let t = e[Math.floor(e.length / 2)];
|
|
803
|
-
this.globalAreaIconDim = this.getCalculatedDimension(t);
|
|
804
|
-
} else {
|
|
805
|
-
let e = this.seatReservations.flatMap((e) => e.coachItems.map((e) => e.dimension.h)).reduce((e, t) => Math.max(e, t), 0), t = Math.floor(e * .2);
|
|
806
|
-
this.globalAreaIconDim = this.getCalculatedDimension({
|
|
807
|
-
w: t,
|
|
808
|
-
h: t
|
|
809
|
-
});
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
_prepareTravelClassNavigation(e) {
|
|
814
|
-
return e.indexOf("FIRST") === -1 ? e.indexOf("SECOND") === -1 ? "ANY_CLASS" : "SECOND" : "FIRST";
|
|
815
|
-
}
|
|
816
|
-
_prepareDriverAreaSideNavigation(e) {
|
|
817
|
-
let t = e.graphicElements?.filter((e) => e.icon === "DRIVER_AREA");
|
|
818
|
-
if (t && t.length > 0) {
|
|
819
|
-
let e = t.find((e) => e.position.x === 0) || !1, n = t.find((e) => e.position.x > 0) || !1;
|
|
820
|
-
return {
|
|
821
|
-
left: !!e,
|
|
822
|
-
right: !!n
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
_prepareSeatReservationStructureInformation() {
|
|
827
|
-
this.seatReservations && (this.seatReservationStructure = { decks: [] }, this.seatReservations.forEach((e, t) => {
|
|
828
|
-
let n = {
|
|
829
|
-
deckIndex: t,
|
|
830
|
-
deckCoaches: []
|
|
831
|
-
};
|
|
832
|
-
e?.coachItems?.forEach((e) => {
|
|
833
|
-
let t = (e.graphicElements?.filter((e) => e.icon && !this.notAreaElements.includes(e.icon)))?.concat(e.serviceElements || []).concat(e.places || []) || [], r = this._isOverhangingElementsPresent(e.dimension.w, t), i = e.graphicElements?.filter((e) => !this.notAreaElements.includes(e.icon)).map((t) => this._getCalculatedDimensionPositionElement(t, e.dimension, !0)), a = e.graphicElements?.filter((e) => this.notAreaElements.includes(e.icon)).map((t) => this._getCalculatedDimensionPositionElement(t, e.dimension, !1)), o = e.serviceElements?.map((t) => this._getCalculatedDimensionPositionElement(t, e.dimension, !0)), s = this._getCalculatedMiddleBorderElement(e), c = this.getCalculatedDimension({ ...e.dimension }), l = {
|
|
834
|
-
width: c.w,
|
|
835
|
-
height: c.h,
|
|
836
|
-
otherElements: a || [],
|
|
837
|
-
serviceElements: o || [],
|
|
838
|
-
areaElements: i || [],
|
|
839
|
-
borderMiddleElement: s,
|
|
840
|
-
hasOverhangingElements: r
|
|
841
|
-
};
|
|
842
|
-
n.deckCoaches.push(l);
|
|
843
|
-
}), this.seatReservationStructure.decks.push(n);
|
|
844
|
-
}));
|
|
845
|
-
}
|
|
846
|
-
_getCalculatedMiddleBorderElement(e) {
|
|
847
|
-
let t = (e.dimension.h + this.coachBorderOffset * 2) * this.baseGridSize, n = 0, r = e.dimension.w;
|
|
848
|
-
if (e.graphicElements) {
|
|
849
|
-
let t = this._getFirstLastDockingElements(e.graphicElements);
|
|
850
|
-
if (t?.length == 2) {
|
|
851
|
-
let i = t[0], a = t[1], o = i.position.x == 0 ? a.dimension.w : i.dimension.w;
|
|
852
|
-
n = i.position.x == 0 ? i.dimension.w : a.dimension.w, r = e.dimension.w - o - n;
|
|
853
|
-
} else if (t?.length == 1) {
|
|
854
|
-
let i = t[0];
|
|
855
|
-
i.position.x === 0 ? (n = i.dimension.w, r = e.dimension.w - i.dimension.w) : i.position.x !== 0 && (r = e.dimension.w - i.dimension.w);
|
|
856
|
-
}
|
|
857
|
-
}
|
|
858
|
-
let i = this.coachBorderPadding * -1;
|
|
859
|
-
return {
|
|
860
|
-
position: {
|
|
861
|
-
x: Math.floor(n * this.baseGridSize) - 1,
|
|
862
|
-
y: i,
|
|
863
|
-
z: 0
|
|
864
|
-
},
|
|
865
|
-
dimension: {
|
|
866
|
-
w: Math.floor(r * this.baseGridSize) + 2,
|
|
867
|
-
h: t
|
|
868
|
-
}
|
|
869
|
-
};
|
|
870
|
-
}
|
|
871
|
-
_getFirstLastDockingElements(e) {
|
|
872
|
-
let t = (e.filter((e) => this.middleBorderDockingElements.includes(e.icon)) || []).sort((e, t) => {
|
|
873
|
-
let n = e.position.x, r = t.position.x;
|
|
874
|
-
return n > r ? 1 : n < r ? -1 : 0;
|
|
875
|
-
});
|
|
876
|
-
return t.filter((e, n) => n == 0 || n == t.length - 1);
|
|
877
|
-
}
|
|
878
|
-
_getCalculatedDimensionPositionElement(e, t, n) {
|
|
879
|
-
let r = { ...e.dimension }, i = { ...e.position }, a = e.rotation || 0, o = this.notAreaElements.concat(this.notFixedRotatableAreaIcons).indexOf(e.icon) === -1, s = this.alignVertical && o ? a - 90 : a, c = null;
|
|
880
|
-
if (n) {
|
|
881
|
-
let n = e.icon?.indexOf("TABLE") === -1, a = e.icon && n ? e.icon : null, o = this.isElementDirectlyOnBorder(e, t) && a !== "ENTRY_EXIT";
|
|
882
|
-
e.position.y === 0 ? (c = "upper-border", i.y -= this.coachBorderOffset - this.coachBorderOffset / 3) : e.position.y + e.dimension.h === t.h && (c = "lower-border", o || (i.y += this.coachBorderOffset - this.coachBorderOffset / 3)), o && (r.h += this.coachBorderOffset - this.coachBorderOffset / 3);
|
|
883
|
-
} else e.position.y === 0 && (i.y -= this.coachBorderOffset), t.h === e.position.y + e.dimension.h && (r.h += this.coachBorderOffset * 2);
|
|
884
|
-
return r.w = Math.floor(r.w * this.baseGridSize), r.h = Math.floor(r.h * this.baseGridSize), i.x = Math.floor(i.x * this.baseGridSize), i.y = Math.floor(i.y * this.baseGridSize), {
|
|
885
|
-
icon: e.icon && e.icon.endsWith("DRIVER_AREA") ? e.icon?.concat("_", this.seatReservations[this.currSelectedDeckIndex].vehicleType) : e.icon,
|
|
886
|
-
rotation: s,
|
|
887
|
-
dimension: r,
|
|
888
|
-
position: i,
|
|
889
|
-
mounting: c
|
|
890
|
-
};
|
|
891
|
-
}
|
|
892
|
-
_getPlaceHtmlElement() {
|
|
893
|
-
return this.currSelectedPlaceElementId && this.shadowRoot?.getElementById(this.currSelectedPlaceElementId) || null;
|
|
894
|
-
}
|
|
895
|
-
_getDeckIndexByPlaceId(e) {
|
|
896
|
-
let t = this.shadowRoot?.querySelector("#" + e)?.getAttribute("data-deck-index");
|
|
897
|
-
return t && !isNaN(+t) ? +t : null;
|
|
898
|
-
}
|
|
899
|
-
_isValidCoachIndex(e) {
|
|
900
|
-
return e >= 0 && e <= this.seatReservations[this.seatReservations.length - 1].coachItems.length;
|
|
901
|
-
}
|
|
902
|
-
_getExistingCoachDeckIndex() {
|
|
903
|
-
if (this.seatReservations[this.currSelectedDeckIndex].coachItems[this.currSelectedCoachIndex].places !== void 0) return this.currSelectedDeckIndex;
|
|
904
|
-
let e = this.seatReservations.findIndex((e) => e.coachItems[this.currSelectedCoachIndex].places !== void 0);
|
|
905
|
-
return this.currSelectedDeckIndex >= e ? this.currSelectedDeckIndex : e;
|
|
906
|
-
}
|
|
907
|
-
_scrollPlaceIntoNearestViewport(e) {
|
|
908
|
-
this.shadowRoot?.getElementById(e)?.scrollIntoView({
|
|
909
|
-
behavior: "smooth",
|
|
910
|
-
block: "nearest",
|
|
911
|
-
inline: "nearest"
|
|
912
|
-
});
|
|
913
|
-
}
|
|
914
|
-
_isOverhangingElementsPresent(e, t) {
|
|
915
|
-
return t?.some((t) => t.position.x === 0 || t.position.x + t.dimension.w >= e) ?? !1;
|
|
916
|
-
}
|
|
917
|
-
_isLocomotive(e) {
|
|
918
|
-
return e?.graphicElements?.find((e) => e.icon === "DRIVER_AREA_NO_VERTICAL_WALL") !== void 0;
|
|
919
|
-
}
|
|
920
|
-
_onLeaveSeatReservationComponent() {
|
|
921
|
-
this.hasNavigation && (this.focusedCoachIndex = -1), this.unfocusPlaceElement();
|
|
922
|
-
}
|
|
923
|
-
};
|
|
924
|
-
})();
|
|
925
|
-
//#endregion
|
|
926
|
-
export { p as SbbSeatReservationSelectedCoachEvent, f as SbbSeatReservationSelectedPlacesEvent, m as SeatReservationBaseElement };
|