@designsystem-se/af 39.2.1 → 39.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/digi-bar-chart.js +67 -17
- package/components/digi-calendar-datepicker.js +1 -1
- package/components/digi-calendar-week-view.js +51 -6
- package/components/digi-calendar.js +1 -1
- package/components/digi-chart-line.js +57 -14
- package/components/digi-navigation-vertical-menu.js +27 -13
- package/components/digi-tablist.js +36 -13
- package/components/{p-CrUxQ9d0.js → p-C5A2t93y.js} +1 -1
- package/dist/cjs/{calendar-week-view-heading-level.enum-NEkm5SUq.js → calendar-week-view-heading-level.enum-BI2f9bbk.js} +7 -0
- package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
- package/dist/cjs/{digi-button_5.cjs.entry.js → digi-badge-notification_8.cjs.entry.js} +436 -7
- package/dist/cjs/digi-bar-chart.cjs.entry.js +67 -17
- package/dist/cjs/digi-calendar-datepicker.cjs.entry.js +1 -2
- package/dist/cjs/digi-calendar_2.cjs.entry.js +1 -1
- package/dist/cjs/digi-chart-line.cjs.entry.js +57 -14
- package/dist/cjs/digi-code-block_3.cjs.entry.js +1 -2
- package/dist/cjs/digi-dialog.cjs.entry.js +1 -2
- package/dist/cjs/digi-footer.cjs.entry.js +1 -2
- package/dist/cjs/digi-form-error-list.cjs.entry.js +1 -2
- package/dist/cjs/digi-form-receipt.cjs.entry.js +1 -2
- package/dist/cjs/digi-form-select-filter.cjs.entry.js +1 -2
- package/dist/cjs/digi-header-navigation.cjs.entry.js +1 -2
- package/dist/cjs/digi-header.cjs.entry.js +1 -2
- package/dist/cjs/digi-navigation-pagination.cjs.entry.js +1 -2
- package/dist/cjs/digi-navigation-vertical-menu.cjs.entry.js +27 -13
- package/dist/cjs/digi-notification-alert.cjs.entry.js +1 -2
- package/dist/cjs/digi-notification-error-page.cjs.entry.js +1 -2
- package/dist/cjs/digi-title-logo.cjs.entry.js +1 -2
- package/dist/cjs/digi-tools-feedback.cjs.entry.js +1 -2
- package/dist/cjs/index-Cn1hHaSy.js +2 -14
- package/dist/cjs/index.cjs.js +6 -7
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/_calendar/calendar/calendar.css +5 -6
- package/dist/collection/components/_calendar/week-view/calendar-week-view.js +53 -8
- package/dist/collection/components/_chart/bar-chart/bar-chart.css +1 -1
- package/dist/collection/components/_chart/bar-chart/bar-chart.js +66 -16
- package/dist/collection/components/_chart/chart-line/chart-line.js +57 -14
- package/dist/collection/components/_navigation/navigation-tablist/navigation-tablist.js +36 -13
- package/dist/collection/components/_navigation/navigation-vertical-menu/navigation-vertical-menu.js +27 -13
- package/dist/collection/design-tokens/components/_logo.variables.scss +2 -0
- package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
- package/dist/digi-arbetsformedlingen/index.esm.js +1 -1
- package/dist/digi-arbetsformedlingen/p-0f7e995a.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-26f6a310.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-3b42582a.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-4384644b.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-47513f97.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-569c628c.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-668d38d9.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-66f34ca5.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-6cb1c6ea.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-6e256f0c.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-71a8478d.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-9df345c4.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-BBOpiDGx.js +1 -0
- package/dist/digi-arbetsformedlingen/p-a1deddb1.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-beebbc90.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/{p-ee58a938.entry.js → p-c7ade486.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/p-d065e751.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-d150094c.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-df8efa59.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-e2b0b070.entry.js +1 -0
- package/dist/esm/{calendar-week-view-heading-level.enum-DH_-wpLB.js → calendar-week-view-heading-level.enum-BBOpiDGx.js} +8 -1
- package/dist/esm/digi-arbetsformedlingen.js +1 -1
- package/dist/esm/{digi-button_5.entry.js → digi-badge-notification_8.entry.js} +435 -9
- package/dist/esm/digi-bar-chart.entry.js +67 -17
- package/dist/esm/digi-calendar-datepicker.entry.js +1 -2
- package/dist/esm/digi-calendar_2.entry.js +1 -1
- package/dist/esm/digi-chart-line.entry.js +57 -14
- package/dist/esm/digi-code-block_3.entry.js +1 -2
- package/dist/esm/digi-dialog.entry.js +1 -2
- package/dist/esm/digi-footer.entry.js +1 -2
- package/dist/esm/digi-form-error-list.entry.js +1 -2
- package/dist/esm/digi-form-receipt.entry.js +1 -2
- package/dist/esm/digi-form-select-filter.entry.js +1 -2
- package/dist/esm/digi-header-navigation.entry.js +1 -2
- package/dist/esm/digi-header.entry.js +1 -2
- package/dist/esm/digi-navigation-pagination.entry.js +1 -2
- package/dist/esm/digi-navigation-vertical-menu.entry.js +27 -13
- package/dist/esm/digi-notification-alert.entry.js +1 -2
- package/dist/esm/digi-notification-error-page.entry.js +1 -2
- package/dist/esm/digi-title-logo.entry.js +1 -2
- package/dist/esm/digi-tools-feedback.entry.js +1 -2
- package/dist/esm/index-BnKuq1L7.js +2 -14
- package/dist/esm/index.js +1 -2
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/_calendar/week-view/calendar-week-view.d.ts +4 -2
- package/dist/types/components/_chart/bar-chart/bar-chart.d.ts +4 -2
- package/dist/types/components/_chart/chart-line/chart-line.d.ts +3 -1
- package/dist/types/components/_navigation/navigation-tablist/navigation-tablist.d.ts +4 -2
- package/dist/types/components/_navigation/navigation-vertical-menu/navigation-vertical-menu.d.ts +7 -2
- package/dist/types/components.d.ts +3 -3
- package/hydrate/index.js +236 -64
- package/hydrate/index.mjs +236 -64
- package/package.json +1 -1
- package/dist/cjs/badge-notification-shape.enum-CEyEo2G5.js +0 -8
- package/dist/cjs/digi-badge-notification.cjs.entry.js +0 -65
- package/dist/cjs/digi-tablist-panel.cjs.entry.js +0 -20
- package/dist/cjs/digi-tablist.cjs.entry.js +0 -289
- package/dist/digi-arbetsformedlingen/p-0394e694.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-09b52191.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-0c88f210.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-151248bf.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-26099889.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-52a27991.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-5ee5766d.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-626c1bf5.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-674a7a94.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-6c1fd994.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-7682ad6f.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-7f180ce2.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-88bec555.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-CKoZU0-H.js +0 -1
- package/dist/digi-arbetsformedlingen/p-DH_-wpLB.js +0 -1
- package/dist/digi-arbetsformedlingen/p-a556608d.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-b3410fbd.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-e002ceb8.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-e6ee5a17.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-ec6dd177.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-eee1b91f.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-fea63204.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-ff73fa2f.entry.js +0 -1
- package/dist/esm/badge-notification-shape.enum-CKoZU0-H.js +0 -8
- package/dist/esm/digi-badge-notification.entry.js +0 -63
- package/dist/esm/digi-tablist-panel.entry.js +0 -18
- package/dist/esm/digi-tablist.entry.js +0 -287
|
@@ -97,17 +97,13 @@ License: none (public domain)
|
|
|
97
97
|
border-radius: 4px 0 0 0;
|
|
98
98
|
}
|
|
99
99
|
:host .digi-calendar__header--month-step .digi-calendar__month-select-button:focus-visible:not(.digi-calendar__date--not-selectable), :host .digi-calendar__header--month-step .digi-calendar__month-select-button:active:not(.digi-calendar__date--not-selectable) {
|
|
100
|
-
--digi--calendar--header--button--background: var(
|
|
101
|
-
--digi--calendar--header--button--background--hover
|
|
102
|
-
);
|
|
100
|
+
--digi--calendar--header--button--background: var(--digi--calendar--header--button--background--hover);
|
|
103
101
|
text-decoration: underline;
|
|
104
102
|
cursor: pointer;
|
|
105
103
|
}
|
|
106
104
|
@media (any-hover: hover) {
|
|
107
105
|
:host .digi-calendar__header--month-step .digi-calendar__month-select-button:hover:not(.digi-calendar__date--not-selectable) {
|
|
108
|
-
--digi--calendar--header--button--background: var(
|
|
109
|
-
--digi--calendar--header--button--background--hover
|
|
110
|
-
);
|
|
106
|
+
--digi--calendar--header--button--background: var(--digi--calendar--header--button--background--hover);
|
|
111
107
|
text-decoration: underline;
|
|
112
108
|
cursor: pointer;
|
|
113
109
|
}
|
|
@@ -124,6 +120,9 @@ License: none (public domain)
|
|
|
124
120
|
table-layout: fixed;
|
|
125
121
|
margin-bottom: var(--digi--margin--medium);
|
|
126
122
|
}
|
|
123
|
+
:host .digi-calendar__table th {
|
|
124
|
+
text-align: center;
|
|
125
|
+
}
|
|
127
126
|
:host .digi-calendar__table-header-week {
|
|
128
127
|
font-style: italic;
|
|
129
128
|
padding: var(--digi--calendar--table-header--padding);
|
|
@@ -3,6 +3,7 @@ import { h } from "@stencil/core";
|
|
|
3
3
|
import { format, getISOWeek, addDays, subDays, setDay } from "date-fns";
|
|
4
4
|
import svlocale from "date-fns/locale/sv";
|
|
5
5
|
import { randomIdGenerator } from "../../../global/utils/randomIdGenerator";
|
|
6
|
+
import { logger } from "../../../global/utils/logger";
|
|
6
7
|
import { ButtonVariation } from "../../_button/button/button-variation.enum";
|
|
7
8
|
import { CalendarWeekViewHeadingLevel } from "./calendar-week-view-heading-level.enum";
|
|
8
9
|
/**
|
|
@@ -51,7 +52,30 @@ export class CalendarWeekView {
|
|
|
51
52
|
this.weekDays = [...newDates];
|
|
52
53
|
}
|
|
53
54
|
afDatesUpdate() {
|
|
54
|
-
|
|
55
|
+
// Angular/React can connect the element before afDates is set.
|
|
56
|
+
if (this.afDates == null || this.afDates === '') {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const hadDates = this.dates.length > 0;
|
|
60
|
+
let dateList;
|
|
61
|
+
try {
|
|
62
|
+
if (Array.isArray(this.afDates)) {
|
|
63
|
+
dateList = [...this.afDates];
|
|
64
|
+
}
|
|
65
|
+
else if (typeof this.afDates === 'string') {
|
|
66
|
+
dateList = JSON.parse(this.afDates);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
catch (_a) {
|
|
73
|
+
logger.warn(`Invalid JSON in "af-dates" attribute`, this.hostElement);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!Array.isArray(dateList)) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
55
79
|
this.dates = [
|
|
56
80
|
...dateList.sort((a, b) => {
|
|
57
81
|
const c = new Date(a);
|
|
@@ -59,6 +83,9 @@ export class CalendarWeekView {
|
|
|
59
83
|
return this.getTime(c) - this.getTime(d);
|
|
60
84
|
})
|
|
61
85
|
];
|
|
86
|
+
if (!hadDates && this.dates.length > 0) {
|
|
87
|
+
this.initDates();
|
|
88
|
+
}
|
|
62
89
|
}
|
|
63
90
|
/**
|
|
64
91
|
* Kan användas för att manuellt sätta om det aktiva datumet. Formatet måste vara 'yyyy-MM-dd'.
|
|
@@ -82,6 +109,9 @@ export class CalendarWeekView {
|
|
|
82
109
|
this.afOnWeekChange.emit('next');
|
|
83
110
|
}
|
|
84
111
|
initDates() {
|
|
112
|
+
if (this.dates.length === 0) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
85
115
|
this.minDate = new Date(this.dates[0]);
|
|
86
116
|
this.maxDate = new Date(this.dates[this.dates.length - 1]);
|
|
87
117
|
this.selectedDate = format(new Date(this.dates[0]), 'yyyy-MM-dd', {
|
|
@@ -93,9 +123,23 @@ export class CalendarWeekView {
|
|
|
93
123
|
}
|
|
94
124
|
componentWillLoad() {
|
|
95
125
|
this.afDatesUpdate();
|
|
96
|
-
|
|
126
|
+
// Angular attaches the host first and binds `[afDates]` on the next frame
|
|
127
|
+
// (Stencil 4.36+). @Watch skips that first assignment, so if dates are not
|
|
128
|
+
// here yet, wait one frame. React/vanilla that already set the prop skip
|
|
129
|
+
// the delay.
|
|
130
|
+
if (this.dates.length === 0) {
|
|
131
|
+
return new Promise((resolve) => {
|
|
132
|
+
requestAnimationFrame(() => {
|
|
133
|
+
this.afDatesUpdate();
|
|
134
|
+
resolve();
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
}
|
|
97
138
|
}
|
|
98
139
|
componentDidLoad() {
|
|
140
|
+
if (this.dates.length === 0) {
|
|
141
|
+
this.afDatesUpdate();
|
|
142
|
+
}
|
|
99
143
|
this.afOnReady.emit();
|
|
100
144
|
}
|
|
101
145
|
get prevWeekText() {
|
|
@@ -119,7 +163,7 @@ export class CalendarWeekView {
|
|
|
119
163
|
format(new Date(lastDate), 'MMMM yyyy', { locale: svlocale });
|
|
120
164
|
}
|
|
121
165
|
render() {
|
|
122
|
-
return (h("div", { key: '
|
|
166
|
+
return (h("div", { key: '44d49828a7f43a1f3943aaf0af4139f402844bf0', class: "digi-calendar-week-view" }, h("nav", { key: '44ba98a7c433077c2c11c55b150a5cc2f1d38ac2', class: "digi-calendar-week-view__timepicker" }, h("div", { key: '160ce73dc293abd69193c2b1750c9fd7400b8804', class: "digi-calendar-week-view__dates" }, h("div", { key: '2d60245978d9c7615f3ff5ec7b9d8d628e16f843', class: "digi-calendar-week-view__flex" }, h("digi-typography", { key: '23a1c94d0575061951f67f46782144de52e5e662' }, h(this.afHeadingLevel, { key: 'a183705a035f4d3d57ced74920221f40bbe6019f', role: "status", class: "digi-calendar-week-view__heading" }, h("span", { key: '147910745991716f3557491c6e6aa702f479e8c7', class: "digi-calendar-week-view__month" }, this.currentMonth), h("span", { key: '0d91367cd6066a2b35349edd0ff93e20b5326f04', class: "digi-calendar-week-view__week" }, ' ', "v.", this.currentWeek))), h("ul", { key: 'fdff670cf241e05920e19e0ce6e601b62ae9a3f0', class: "digi-calendar-week-view__date-list" }, this.weekDays.map((dateItem) => {
|
|
123
167
|
const date = format(new Date(dateItem), 'd', {
|
|
124
168
|
locale: svlocale
|
|
125
169
|
});
|
|
@@ -139,15 +183,15 @@ export class CalendarWeekView {
|
|
|
139
183
|
} }, day), h("span", { class: "digi-calendar-week-view__date-button-date" }, date), h("span", { "aria-hidden": "true", class: {
|
|
140
184
|
'digi-calendar-week-view__date-button-circle': dateItem === this.todaysDate
|
|
141
185
|
} })))));
|
|
142
|
-
})))), h("digi-button", { key: '
|
|
186
|
+
})))), h("digi-button", { key: 'dbae5227d0316a5a67febc7de83b1c4c5cfc1044', onClick: () => this.prevWeek(), class: {
|
|
143
187
|
'digi-calendar-week-view__week-button digi-calendar-week-view__week-button--previous': true,
|
|
144
188
|
'digi-calendar-week-view__week-button--keep-left': this.currentWeek == getISOWeek(this.maxDate),
|
|
145
189
|
'digi-calendar-week-view__week-button--hidden': !(this.currentWeek > getISOWeek(this.minDate))
|
|
146
|
-
}, "af-variation": "secondary" }, h("digi-icon-chevron-left", { key: '
|
|
190
|
+
}, "af-variation": "secondary" }, h("digi-icon-chevron-left", { key: '65d0f656a0d35911d39f9b8e9ade224be54d4371', slot: "icon" }), this.prevWeekText), h("digi-button", { key: '68d9b3d6c929d0185f412add980a542b3c86fbb2', onClick: () => this.nextWeek(), class: {
|
|
147
191
|
'digi-calendar-week-view__week-button digi-calendar-week-view__week-button--next': true,
|
|
148
192
|
'digi-calendar-week-view__week-button--keep-right': this.currentWeek == getISOWeek(this.minDate),
|
|
149
193
|
'digi-calendar-week-view__week-button--hidden': !(this.currentWeek < getISOWeek(this.maxDate))
|
|
150
|
-
}, "af-variation": "secondary" }, h("digi-icon-chevron-right", { key: '
|
|
194
|
+
}, "af-variation": "secondary" }, h("digi-icon-chevron-right", { key: 'a9e688f815a5053aa709cfeb9359131f73df21c0', slot: "icon-secondary" }), this.nextWeekText)), h("div", { key: '7d1073f6cd1982fda2ce7dcb60532c94bd1d0634', role: "status", "aria-live": "assertive", class: "digi-calendar-week-view__result", id: `${this.afId}-result` }, h("digi-typography", { key: 'db7ce0ca80485df1e4ae67200f2cd90cc80938d5' }, h("slot", { key: 'f08f447ae89612dfcea56c638024220bc29e7914' })))));
|
|
151
195
|
}
|
|
152
196
|
static get is() { return "digi-calendar-week-view"; }
|
|
153
197
|
static get encapsulation() { return "scoped"; }
|
|
@@ -205,8 +249,8 @@ export class CalendarWeekView {
|
|
|
205
249
|
"type": "string",
|
|
206
250
|
"mutable": true,
|
|
207
251
|
"complexType": {
|
|
208
|
-
"original": "string",
|
|
209
|
-
"resolved": "string",
|
|
252
|
+
"original": "string | string[]",
|
|
253
|
+
"resolved": "string | string[]",
|
|
210
254
|
"references": {}
|
|
211
255
|
},
|
|
212
256
|
"required": false,
|
|
@@ -373,6 +417,7 @@ export class CalendarWeekView {
|
|
|
373
417
|
}
|
|
374
418
|
};
|
|
375
419
|
}
|
|
420
|
+
static get elementRef() { return "hostElement"; }
|
|
376
421
|
static get watchers() {
|
|
377
422
|
return [{
|
|
378
423
|
"propName": "selectedDate",
|
|
@@ -3,6 +3,7 @@ import { h, Host } from "@stencil/core";
|
|
|
3
3
|
import * as d3 from "d3";
|
|
4
4
|
import { _t } from "../../../text";
|
|
5
5
|
import { randomIdGenerator } from "../../../global/utils/randomIdGenerator";
|
|
6
|
+
import { logger } from "../../../global/utils/logger";
|
|
6
7
|
import { BarChartVariation } from "./bar-chart-variation.enum";
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
@@ -177,6 +178,8 @@ export class barChart {
|
|
|
177
178
|
};
|
|
178
179
|
// Resizing chart while loading
|
|
179
180
|
this.loadingResize = () => {
|
|
181
|
+
if (!this.barSelection || !this.xScale)
|
|
182
|
+
return;
|
|
180
183
|
const newHeight = this.setDims();
|
|
181
184
|
this.barChartContainer.attr('transform', `translate(${this.margin.left + this.tickPadding + this.yTickSize},0)`);
|
|
182
185
|
this.margin.right =
|
|
@@ -442,6 +445,8 @@ export class barChart {
|
|
|
442
445
|
return toReturn;
|
|
443
446
|
};
|
|
444
447
|
this.adjustBarSize = () => {
|
|
448
|
+
if (!this.barSelection)
|
|
449
|
+
return;
|
|
445
450
|
this.barSelection
|
|
446
451
|
.selectAll('.bar')
|
|
447
452
|
.attr('x', this.xFunction)
|
|
@@ -874,13 +879,13 @@ export class barChart {
|
|
|
874
879
|
this.initBarText();
|
|
875
880
|
};
|
|
876
881
|
// Removes resize observer for chart and inits table
|
|
877
|
-
this.activateTable = (
|
|
882
|
+
this.activateTable = () => {
|
|
878
883
|
this.closeTooltip();
|
|
879
884
|
this.barChartObserver.disconnect();
|
|
880
885
|
this.status.innerHTML = '<p>Visas som tabell</p>';
|
|
881
886
|
d3.select(this.host).select('.tableButton').style('display', 'none');
|
|
882
887
|
d3.select(this.host).select('.chartButton').style('display', null);
|
|
883
|
-
|
|
888
|
+
this.focusHostButton('.chartButton');
|
|
884
889
|
const duration = 150;
|
|
885
890
|
this.svg
|
|
886
891
|
.attr('opacity', 1)
|
|
@@ -911,11 +916,11 @@ export class barChart {
|
|
|
911
916
|
.style('opacity', 0);
|
|
912
917
|
};
|
|
913
918
|
// Removes observer and calls init functions for line chart
|
|
914
|
-
this.reInitChart = (
|
|
919
|
+
this.reInitChart = () => {
|
|
915
920
|
this.status.innerHTML = '<p>Visas som diagram</p>';
|
|
916
921
|
d3.select(this.host).select('.tableButton').style('display', null);
|
|
917
922
|
d3.select(this.host).select('.chartButton').style('display', 'none');
|
|
918
|
-
|
|
923
|
+
this.focusHostButton('.tableButton');
|
|
919
924
|
const table = d3.select(this.tableDiv);
|
|
920
925
|
const duration = 150;
|
|
921
926
|
table
|
|
@@ -941,14 +946,33 @@ export class barChart {
|
|
|
941
946
|
});
|
|
942
947
|
};
|
|
943
948
|
}
|
|
944
|
-
afChartDataUpdate(
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
949
|
+
afChartDataUpdate() {
|
|
950
|
+
const data = this.afChartData;
|
|
951
|
+
// Angular/React can connect the element before afChartData is set.
|
|
952
|
+
if (data == null || data === '') {
|
|
953
|
+
this.mappedData = this.reshapeData();
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
try {
|
|
957
|
+
let parsed;
|
|
958
|
+
if (typeof data === 'string') {
|
|
959
|
+
parsed = JSON.parse(data);
|
|
960
|
+
}
|
|
961
|
+
else if (typeof data === 'object') {
|
|
962
|
+
parsed = data;
|
|
963
|
+
}
|
|
964
|
+
else {
|
|
965
|
+
this.mappedData = this.reshapeData();
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
if (parsed && Object.keys(parsed).length > 0) {
|
|
969
|
+
this.chartData = parsed;
|
|
970
|
+
this.series = this.chartData.data.series.map((serie) => serie.title);
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
catch (_a) {
|
|
974
|
+
logger.warn(`Invalid JSON in "af-chart-data" attribute`, this.hostElement);
|
|
975
|
+
return;
|
|
952
976
|
}
|
|
953
977
|
this.mappedData = this.reshapeData();
|
|
954
978
|
// checking for width of each tick
|
|
@@ -959,6 +983,17 @@ export class barChart {
|
|
|
959
983
|
if (this.dataWidth > 1)
|
|
960
984
|
this.barGap = 1;
|
|
961
985
|
}
|
|
986
|
+
hasChartData() {
|
|
987
|
+
return !!this.chartData && Object.keys(this.chartData).length > 0;
|
|
988
|
+
}
|
|
989
|
+
focusHostButton(selector) {
|
|
990
|
+
var _a, _b;
|
|
991
|
+
const host = this.host;
|
|
992
|
+
const button = (_b = (_a = host === null || host === void 0 ? void 0 : host.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.querySelector('button')) !== null && _b !== void 0 ? _b : host === null || host === void 0 ? void 0 : host.querySelector(selector);
|
|
993
|
+
if (button && typeof button.focus === 'function') {
|
|
994
|
+
button.focus();
|
|
995
|
+
}
|
|
996
|
+
}
|
|
962
997
|
initSvg() {
|
|
963
998
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
964
999
|
// Fetch number formatting
|
|
@@ -1526,10 +1561,25 @@ export class barChart {
|
|
|
1526
1561
|
Math.min(255, Math.max(0, parseInt(color, 16) + amount)).toString(16)).substr(-2)));
|
|
1527
1562
|
}
|
|
1528
1563
|
componentWillLoad() {
|
|
1529
|
-
this.afChartDataUpdate(
|
|
1564
|
+
this.afChartDataUpdate();
|
|
1565
|
+
// Angular attaches the host first and binds `[afChartData]` on the next
|
|
1566
|
+
// frame (Stencil 4.36+). @Watch skips that first assignment, so if chart
|
|
1567
|
+
// data is not here yet, wait one frame. React/vanilla that already set
|
|
1568
|
+
// the prop skip the delay.
|
|
1569
|
+
if (!this.hasChartData()) {
|
|
1570
|
+
return new Promise((resolve) => {
|
|
1571
|
+
requestAnimationFrame(() => {
|
|
1572
|
+
this.afChartDataUpdate();
|
|
1573
|
+
resolve();
|
|
1574
|
+
});
|
|
1575
|
+
});
|
|
1576
|
+
}
|
|
1530
1577
|
}
|
|
1531
1578
|
componentDidLoad() {
|
|
1532
|
-
if (!this.
|
|
1579
|
+
if (!this.hasChartData()) {
|
|
1580
|
+
this.afChartDataUpdate();
|
|
1581
|
+
}
|
|
1582
|
+
if (!this.hasChartData()) {
|
|
1533
1583
|
this.loading = true;
|
|
1534
1584
|
return this.initEmpty();
|
|
1535
1585
|
}
|
|
@@ -1548,7 +1598,7 @@ export class barChart {
|
|
|
1548
1598
|
}
|
|
1549
1599
|
componentDidUpdate() {
|
|
1550
1600
|
if (this.tableDiv.style['display'] != 'block' &&
|
|
1551
|
-
|
|
1601
|
+
!this.hasChartData()) {
|
|
1552
1602
|
// Disconnect old barchartobserver while doing resizing
|
|
1553
1603
|
this.barChartObserver.disconnect();
|
|
1554
1604
|
return this.loadingState();
|
|
@@ -1628,7 +1678,7 @@ export class barChart {
|
|
|
1628
1678
|
if (this.chartData.infoText)
|
|
1629
1679
|
heading = `${heading}<span style="display:block;margin-top:0.25rem;font-size:0.875rem;color:var(--digi--global--color--neutral--grayscale--darkest-3)">${this.chartData.infoText}</span>`;
|
|
1630
1680
|
}
|
|
1631
|
-
return (h(Host, { key: '
|
|
1681
|
+
return (h(Host, { key: '003845ddc03e2027721d5e75c82816faae5bde63', ref: (el) => (this.host = el) }, h("svg", { key: '054049009c8618211f9009961d238992c3d03c0e', xmlns: "http://www.w3.org/2000/svg", width: "0", height: "0" }, h("defs", { key: '16f32628ffd79e24b66e749666eccd6ae283a5b8' }, h("pattern", { key: '8aa5e0923086f740eeb02d71690ed16086205b0a', id: "prognosis", patternUnits: "userSpaceOnUse", width: "8", height: "8", patternTransform: "rotate(45)" }, h("rect", { key: '237569e79095a4a7c084aa91fd637dfbe385ca8b', width: "8", height: "8", fill: "white" }), h("line", { key: '6edeac6a60cef51561c8fd803b2e277b19b740bf', x1: "0", y: "0", x2: "0", y2: "12", stroke: this.evalColorVar(this.colorPalettes[0]), "stroke-width": "8" })), h("pattern", { key: 'bd40402b6fd33d50fc4dca709380108fe054f74c', id: "prognosisInactive", patternUnits: "userSpaceOnUse", width: "8", height: "8", patternTransform: "rotate(45)" }, h("rect", { key: 'a5dcf48112b024982f3410bc51eb05002c8c8dcc', width: "8", height: "8", fill: "white" }), h("line", { key: 'b76b6ae15b8a0ee9c37c28bf3f66613c9df1e9b8', x1: "0", y: "0", x2: "0", y2: "12", stroke: this.evalColorVar('--digi--color--background--secondary-accent'), "stroke-width": "8" })), h("pattern", { key: 'ef4782b914f2599424d5f3e6715cb69c4f0e4728', id: "prognosisHighlight", patternUnits: "userSpaceOnUse", width: "8", height: "8", patternTransform: "rotate(45)" }, h("rect", { key: '6501ba8a46f53b6c3309486d0795d348a8ec1fff', width: "8", height: "8", fill: "white" }), h("line", { key: 'b184212878587e1e15ebf40a472333851270b287', x1: "0", y: "0", x2: "0", y2: "12", stroke: this.adjustColor(this.colorFunction(0), 50), "stroke-width": "8" })))), h("div", { key: '02b5c9c63c327995f9603ffc84ab0455137ff43d', class: "topWrapper", ref: (el) => (this.titleDiv = el) }, h("digi-typography", { key: 'd8944066ab1a86ed71af7de4a018ef422cea75e9', class: "chartTitle", innerHTML: heading }), h("digi-button", { key: '6bc1e5870432720980fc8dad25abc5f2cb474daf', class: "buttonWrapper tableButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.activateTable, afAriaLabel: `Visa tabell ${((_a = this.chartData) === null || _a === void 0 ? void 0 : _a.title) ? (_b = this.chartData) === null || _b === void 0 ? void 0 : _b.title.toLowerCase() : ''}` }, h("digi-icon-table", { key: '5a8b44b3a201b4866b89fc4328ff0b46ac47c6e1', slot: "icon" }), "Visa tabell"), h("digi-button", { key: 'cd0d60a025d5fa0e62cb5f6a322cf3f97c0bd02e', style: { display: 'none' }, class: "buttonWrapper chartButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.reInitChart, afAriaLabel: `Visa diagram ${((_c = this.chartData) === null || _c === void 0 ? void 0 : _c.title) ? (_d = this.chartData) === null || _d === void 0 ? void 0 : _d.title.toLowerCase() : ''}` }, h("digi-icon-chart", { key: '8f4e4f1bdabffd7ffd1532453b534a823ef65006', slot: "icon" }), "Visa diagram"), h("div", { key: '22535e8bfb69f96152e61295019d463cb69b70c3', class: "scChartStatus", role: "status", ref: (el) => (this.status = el) })), h("div", { key: '55e25140585469497ec501cd133cfc710bb88b43', class: "svgWrap", ref: (el) => (this.chartDiv = el) }, h("div", { key: '4d8cd2eb832770f94fdff5eec2f084e4ba5c96b8', class: "chartTooltip", id: this.afId }, h("div", { key: 'b805b20b746ce940ae5c20ef34898c3409cffecd', class: "tooltipHead" }, h("digi-icon-x", { key: 'c162d2b1e6e7aafddf0ac194705b436a5b02b392', class: "tooltipClose" })), h("div", { key: 'cdc876d4c88f50c7d95c22f4d0f683c2a5564235', class: "tooltipBody" }), this.afVariation === BarChartVariation.Horizontal ? (h("digi-icon-caret-up", { class: "caret" })) : (h("digi-icon-caret-down", { class: "caret" })))), h("div", { key: '8cb986f7466fdb42f6dc840c1371b25978ae4c66', class: "legendWrap", ref: (el) => (this.legendDiv = el) }, h("div", { key: '6761a567c03c8ade4206fb89cf9e7bd792c36e71', class: "legend" })), h("div", { key: 'ac251b6078602f9319447cfaa6444f0129e46c0f', class: "table", ref: (el) => (this.tableDiv = el) }, ' ')));
|
|
1632
1682
|
}
|
|
1633
1683
|
static get is() { return "digi-bar-chart"; }
|
|
1634
1684
|
static get encapsulation() { return "scoped"; }
|
|
@@ -3,6 +3,7 @@ import { _t } from "../../../text";
|
|
|
3
3
|
import { h } from "@stencil/core";
|
|
4
4
|
import * as d3 from "d3";
|
|
5
5
|
import { randomIdGenerator } from "../../../global/utils/randomIdGenerator";
|
|
6
|
+
import { logger } from "../../../global/utils/logger";
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
8
9
|
* @enums myEnum - chart-line-myEnum.enum.ts
|
|
@@ -891,14 +892,14 @@ export class ChartLine {
|
|
|
891
892
|
});
|
|
892
893
|
};
|
|
893
894
|
// Removes resize observer for chart and inits table
|
|
894
|
-
this.activateTable = (
|
|
895
|
+
this.activateTable = () => {
|
|
895
896
|
this.closeTooltip();
|
|
896
897
|
this.lineChartObserver.disconnect();
|
|
897
898
|
this.tableObserver.observe(this._chartDiv);
|
|
898
899
|
this._status.innerHTML = '<p>Visas som tabell</p>';
|
|
899
900
|
d3.select(this._host).select('.tableButton').style('display', 'none');
|
|
900
901
|
d3.select(this._host).select('.chartButton').style('display', null);
|
|
901
|
-
|
|
902
|
+
this.focusHostButton('.chartButton');
|
|
902
903
|
const duration = 150;
|
|
903
904
|
this._svg
|
|
904
905
|
.attr('opacity', 1)
|
|
@@ -929,12 +930,12 @@ export class ChartLine {
|
|
|
929
930
|
this.setTableDimensions();
|
|
930
931
|
};
|
|
931
932
|
// Removes observer and calls init functions for line chart
|
|
932
|
-
this.reInitChart = (
|
|
933
|
+
this.reInitChart = () => {
|
|
933
934
|
this.tableObserver.disconnect();
|
|
934
935
|
this._status.innerHTML = '<p>Visas som diagram</p>';
|
|
935
936
|
d3.select(this._host).select('.tableButton').style('display', null);
|
|
936
937
|
d3.select(this._host).select('.chartButton').style('display', 'none');
|
|
937
|
-
|
|
938
|
+
this.focusHostButton('.tableButton');
|
|
938
939
|
const table = d3.select(this._tableDiv);
|
|
939
940
|
table
|
|
940
941
|
.style('opacity', 1)
|
|
@@ -961,15 +962,40 @@ export class ChartLine {
|
|
|
961
962
|
}
|
|
962
963
|
afChartDataUpdate() {
|
|
963
964
|
const data = this.afChartData;
|
|
964
|
-
|
|
965
|
-
|
|
965
|
+
// Angular/React can connect the element before afChartData is set.
|
|
966
|
+
if (data == null || data === '') {
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
try {
|
|
970
|
+
if (typeof data === 'object') {
|
|
971
|
+
this._chartData = Object.assign({}, data);
|
|
972
|
+
}
|
|
973
|
+
else if (typeof data === 'string') {
|
|
974
|
+
this._chartData = JSON.parse(data);
|
|
975
|
+
}
|
|
976
|
+
else {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
catch (_a) {
|
|
981
|
+
logger.warn(`Invalid JSON in "af-chart-data" attribute`, this.element);
|
|
966
982
|
return;
|
|
967
983
|
}
|
|
968
|
-
this._chartData = JSON.parse(data);
|
|
969
984
|
// Making deep copy of this
|
|
970
985
|
if (this._chartData.data)
|
|
971
986
|
this._coreSeries = JSON.parse(JSON.stringify(this._chartData.data.series));
|
|
972
987
|
}
|
|
988
|
+
hasChartData() {
|
|
989
|
+
return !!this._chartData && Object.keys(this._chartData).length > 0;
|
|
990
|
+
}
|
|
991
|
+
focusHostButton(selector) {
|
|
992
|
+
var _a, _b;
|
|
993
|
+
const host = this._host;
|
|
994
|
+
const button = (_b = (_a = host === null || host === void 0 ? void 0 : host.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.querySelector('button')) !== null && _b !== void 0 ? _b : host === null || host === void 0 ? void 0 : host.querySelector(selector);
|
|
995
|
+
if (button && typeof button.focus === 'function') {
|
|
996
|
+
button.focus();
|
|
997
|
+
}
|
|
998
|
+
}
|
|
973
999
|
initSvg() {
|
|
974
1000
|
this.margin.bottom =
|
|
975
1001
|
Number(window
|
|
@@ -1439,9 +1465,24 @@ export class ChartLine {
|
|
|
1439
1465
|
}
|
|
1440
1466
|
componentWillLoad() {
|
|
1441
1467
|
this.afChartDataUpdate();
|
|
1468
|
+
// Angular attaches the host first and binds `[afChartData]` on the next
|
|
1469
|
+
// frame (Stencil 4.36+). @Watch skips that first assignment, so if chart
|
|
1470
|
+
// data is not here yet, wait one frame. React/vanilla that already set
|
|
1471
|
+
// the prop skip the delay.
|
|
1472
|
+
if (!this.hasChartData()) {
|
|
1473
|
+
return new Promise((resolve) => {
|
|
1474
|
+
requestAnimationFrame(() => {
|
|
1475
|
+
this.afChartDataUpdate();
|
|
1476
|
+
resolve();
|
|
1477
|
+
});
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1442
1480
|
}
|
|
1443
1481
|
componentDidLoad() {
|
|
1444
|
-
if (
|
|
1482
|
+
if (!this.hasChartData()) {
|
|
1483
|
+
this.afChartDataUpdate();
|
|
1484
|
+
}
|
|
1485
|
+
if (!this.hasChartData())
|
|
1445
1486
|
return this.initEmpty();
|
|
1446
1487
|
// clearing selection
|
|
1447
1488
|
this._selectedLines = [];
|
|
@@ -1457,7 +1498,7 @@ export class ChartLine {
|
|
|
1457
1498
|
this._prevHeight = d3.select(this._titleDiv).style('height');
|
|
1458
1499
|
}
|
|
1459
1500
|
componentDidUpdate() {
|
|
1460
|
-
if (
|
|
1501
|
+
if (!this.hasChartData())
|
|
1461
1502
|
return this.loadingState();
|
|
1462
1503
|
// clearing selection
|
|
1463
1504
|
this._selectedLines = [];
|
|
@@ -1614,11 +1655,13 @@ export class ChartLine {
|
|
|
1614
1655
|
}
|
|
1615
1656
|
render() {
|
|
1616
1657
|
let heading = '';
|
|
1617
|
-
if (
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1658
|
+
if (this._chartData) {
|
|
1659
|
+
if (!this._chartData.subTitle)
|
|
1660
|
+
heading = `<${this.afHeadingLevel}>${this._chartData.title}</${this.afHeadingLevel}>`;
|
|
1661
|
+
else
|
|
1662
|
+
heading = `<${this.afHeadingLevel}>${this._chartData.title}</${this.afHeadingLevel}><p>${this._chartData.subTitle}</p>`;
|
|
1663
|
+
}
|
|
1664
|
+
return (h("host", { key: '93603df9b78fcce8b5735b4a874f879cf7b2326e', ref: (el) => (this._host = el) }, h("div", { key: '094a790864b72bbb9a802b461db06ce312c627c8', class: "topWrapper", ref: (el) => (this._titleDiv = el) }, h("digi-typography", { key: '5f4bd51fdfef816b0e127d1177c60f8310952173', class: "chartTitle", innerHTML: heading }), h("digi-button", { key: '8ae72950c5cf052ed71c2ba4e91b254b8d36cfd0', class: "buttonWrapper tableButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.activateTable, afAriaLabel: `Visa tabell ${this._chartData.title ? this._chartData.title.toLowerCase() : ''}` }, h("digi-icon-table", { key: '750f1b621eb0a1a54ec810aa63624237bd98f9ea', slot: "icon" }), "Visa tabell"), h("digi-button", { key: '1cf33daaaa8adf9c5352286d6172d7c258098c29', style: { display: 'none' }, class: "buttonWrapper chartButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.reInitChart, afAriaLabel: `Visa diagram ${this._chartData.title ? this._chartData.title.toLowerCase() : ''}` }, h("digi-icon-chart", { key: '9dce5df1a96d4b818597854f7ee238fefda2c686', slot: "icon" }), "Visa diagram"), h("div", { key: '204f5824b2f34b3a1a1401ed4434e1fcb16a2549', class: "scChartStatus", role: "status", ref: (el) => (this._status = el) })), h("div", { key: 'b164f59f1c741db5493af57510eab2987cabefc6', class: "chartTooltip", id: this.afId }, h("div", { key: 'e84bf8a85a745977006d50f296d1afee2ee35698', class: "tooltipHead" }, h("digi-icon-x", { key: '77bcd0342c828dbcbe020a9ffefe4ae6f3086572', class: "close" }), ' '), h("div", { key: '330f69a58082f72b528095ef49a2371fc8b0d8e5', class: "tooltipBody" })), h("div", { key: '62eb27ac8f184476d50332344711ca381e8adf59', class: "chart", ref: (el) => (this._chartDiv = el) }), h("div", { key: 'ad70790d3a2fd5851c4351e41f2436a34169a819', class: "legend", ref: (el) => (this._legendDiv = el) }), h("div", { key: '30d4791a9b808555f03d1830aaec0221c1bc3b37', class: "table", ref: (el) => (this._tableDiv = el) }, ' ')));
|
|
1622
1665
|
}
|
|
1623
1666
|
static get is() { return "digi-chart-line"; }
|
|
1624
1667
|
static get encapsulation() { return "scoped"; }
|
|
@@ -98,14 +98,10 @@ export class NavigationTablist {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
syncPanels() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const panel = panels[i];
|
|
106
|
-
const showPanel = panel.tab === this.tabs[this.activeTab].id;
|
|
107
|
-
panel.isVisible = showPanel;
|
|
108
|
-
}
|
|
101
|
+
var _a;
|
|
102
|
+
const activeId = (_a = this.tabs[this.activeTab]) === null || _a === void 0 ? void 0 : _a.id;
|
|
103
|
+
for (const panel of this.getSlottedPanels()) {
|
|
104
|
+
panel.isVisible = panel.tab === activeId;
|
|
109
105
|
}
|
|
110
106
|
}
|
|
111
107
|
handleTabPropChange(tabId) {
|
|
@@ -136,6 +132,11 @@ export class NavigationTablist {
|
|
|
136
132
|
this.windowTab = tabIdx;
|
|
137
133
|
}
|
|
138
134
|
setupTabs(tabs) {
|
|
135
|
+
// Angular/React can connect the element before afTabs is set.
|
|
136
|
+
if (tabs == null || tabs === '') {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const hadTabs = this.tabs.length > 0;
|
|
139
140
|
if (typeof tabs === 'string') {
|
|
140
141
|
this.tabs = JSON.parse(tabs);
|
|
141
142
|
}
|
|
@@ -145,6 +146,13 @@ export class NavigationTablist {
|
|
|
145
146
|
else {
|
|
146
147
|
throw new Error('Invalid format or no tabs supplied');
|
|
147
148
|
}
|
|
149
|
+
if (!hadTabs) {
|
|
150
|
+
this.setupInitialTab();
|
|
151
|
+
}
|
|
152
|
+
this.syncPanels();
|
|
153
|
+
}
|
|
154
|
+
getSlottedPanels() {
|
|
155
|
+
return Array.from(this.hostElement.querySelectorAll('digi-tablist-panel')).filter((panel) => panel.closest('digi-tablist') === this.hostElement);
|
|
148
156
|
}
|
|
149
157
|
setActiveTabById(id) {
|
|
150
158
|
const tabIdx = this.tabs.findIndex((tab) => tab.id === id);
|
|
@@ -212,9 +220,23 @@ export class NavigationTablist {
|
|
|
212
220
|
componentWillLoad() {
|
|
213
221
|
this.setupTabs(this.afTabs);
|
|
214
222
|
this.setupInitialTab();
|
|
223
|
+
// Angular attaches the host first and binds `[afTabs]` on the next frame
|
|
224
|
+
// (Stencil 4.36+). @Watch skips that first assignment, so if tabs are not
|
|
225
|
+
// here yet, wait one frame. React/vanilla that already set the prop skip
|
|
226
|
+
// the delay.
|
|
227
|
+
if (this.tabs.length === 0) {
|
|
228
|
+
return new Promise((resolve) => {
|
|
229
|
+
requestAnimationFrame(() => {
|
|
230
|
+
this.setupTabs(this.afTabs);
|
|
231
|
+
this.setupInitialTab();
|
|
232
|
+
resolve();
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
}
|
|
215
236
|
}
|
|
216
237
|
componentDidLoad() {
|
|
217
238
|
var _a, _b, _c;
|
|
239
|
+
this.setupTabs(this.afTabs);
|
|
218
240
|
// Also listen to window resize for viewport zoom changes
|
|
219
241
|
if (window) {
|
|
220
242
|
window.addEventListener('resize', this.handleResize, { passive: true });
|
|
@@ -236,14 +258,14 @@ export class NavigationTablist {
|
|
|
236
258
|
cancelAnimationFrame(this._requestAnimationFrame);
|
|
237
259
|
}
|
|
238
260
|
render() {
|
|
239
|
-
return (h(Host, { key: '
|
|
261
|
+
return (h(Host, { key: 'b2d71ff4b3f2c2fa22feffbc298360c1b3202b1d' }, h("div", { key: 'df48ffc9fdabfca380675c7232af5fef80c445b9', class: {
|
|
240
262
|
'digi-tablist': true,
|
|
241
263
|
'digi-tablist--overflow-scroll': this.afOverflowMode === OverflowMode.Scroll,
|
|
242
264
|
'digi-tablist--overflow-controls': this.afOverflowMode === OverflowMode.Controls
|
|
243
|
-
} }, h("div", { key: '
|
|
265
|
+
} }, h("div", { key: '797f70a00aa1e3dd8a3b54d43808b9515259723c', class: "control-wrapper", style: {
|
|
244
266
|
left: '0',
|
|
245
267
|
visibility: this.showPrev ? 'visible' : 'hidden'
|
|
246
|
-
} }, h("button", { key: '
|
|
268
|
+
} }, h("button", { key: '415237740bc65dd5cfdb0e57eb44307c9d838670', tabIndex: -1, type: "button", "aria-hidden": "true", class: { 'tab-control-button': true }, onClick: () => this.handleTabControl(Direction.Previous) }, h("digi-icon-chevron-left", { key: '59f2d43ba38c7d4ebdd85a575b2e89c0fec62381' }))), h("div", { key: '01602338cbd7a63f48cdcf541629e76bac46dd4c', role: "tablist", ref: (ref) => (this.tablistRef = ref), "aria-labelledby": this.afAriaLabelledby, "aria-label": this.afAriaLabel }, this.tabs.map((tab) => {
|
|
247
269
|
const focusable = tab.id === this.tabs[this.selectedTab].id;
|
|
248
270
|
const isActive = tab.id === this.tabs[this.activeTab].id;
|
|
249
271
|
const Icon = `digi-icon-${tab.icon}`;
|
|
@@ -252,10 +274,10 @@ export class NavigationTablist {
|
|
|
252
274
|
'digi-tab': true,
|
|
253
275
|
'is-active': isActive
|
|
254
276
|
}, id: `tab-${tab.id}`, role: "tab", type: "button", tabindex: focusable ? '0' : '-1', "aria-label": tab.ariaLabel, "aria-selected": isActive.toString(), "aria-controls": `tabpanel-${tab.id}`, onClick: () => this.handleTabChange(tab) }, h("div", { class: "content-wrapper" }, h("span", { class: "tablist-content" }, tab.icon && h(Icon, { "aria-hidden": "true" }), h("span", { class: "title", "data-text": tab.title }, tab.title), tab.badgeValue && (h("digi-badge-notification", { afValue: badgeValue, "aria-hidden": "true" }))), h("div", { class: "indicator" }))));
|
|
255
|
-
})), h("div", { key: '
|
|
277
|
+
})), h("div", { key: 'db28ea61c349d7aaf057e84b607c4f851b3f6712', class: "control-wrapper", style: {
|
|
256
278
|
right: '0',
|
|
257
279
|
visibility: this.showNext ? 'visible' : 'hidden'
|
|
258
|
-
} }, h("button", { key: '
|
|
280
|
+
} }, h("button", { key: '83513f2d64cc0578155d305f21dfb1ca4a412cc6', tabIndex: -1, type: "button", "aria-hidden": "true", class: { 'tab-control-button': true }, onClick: () => this.handleTabControl(Direction.Next) }, h("digi-icon-chevron-right", { key: '9263e864c21ea5358f301214fbadda6ed7d3c74a' })))), h("div", { key: '205efbbb3aab40f51f9f85f8d74a4026970c7144', role: "presentation" }, h("slot", { key: 'e753d718f852072745f5c2a49f6189fb62f3645b', onSlotchange: () => this.syncPanels() }))));
|
|
259
281
|
}
|
|
260
282
|
static get is() { return "digi-tablist"; }
|
|
261
283
|
static get encapsulation() { return "scoped"; }
|
|
@@ -485,6 +507,7 @@ export class NavigationTablist {
|
|
|
485
507
|
}
|
|
486
508
|
}];
|
|
487
509
|
}
|
|
510
|
+
static get elementRef() { return "hostElement"; }
|
|
488
511
|
static get watchers() {
|
|
489
512
|
return [{
|
|
490
513
|
"propName": "activeTab",
|