@designsystem-se/af 35.3.1 → 35.4.1-beta.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/components/digi-bar-chart.js +126 -111
- package/components/digi-chart-line.js +1 -1
- package/components/digi-code-block.js +1 -1
- package/components/digi-code-example.js +1 -1
- package/components/digi-info-card.js +1 -1
- package/components/digi-link-button.js +3 -1
- package/components/p-472bc7d3.js +129 -0
- package/custom-elements.json +6 -2
- package/dist/cjs/digi-arbetsformedlingen.cjs.js +1 -1
- package/dist/cjs/{digi-button_24.cjs.entry.js → digi-bar-chart_27.cjs.entry.js} +1611 -47
- package/dist/cjs/digi-calendar-datepicker.cjs.entry.js +2 -2
- package/dist/cjs/digi-chart-line.cjs.entry.js +1 -1
- package/dist/cjs/digi-code-block_3.cjs.entry.js +3 -3
- package/dist/cjs/digi-dialog.cjs.entry.js +2 -2
- package/dist/cjs/digi-footer.cjs.entry.js +2 -2
- package/dist/cjs/digi-form-error-list.cjs.entry.js +2 -2
- package/dist/cjs/digi-form-receipt.cjs.entry.js +2 -2
- package/dist/cjs/digi-form-select-filter.cjs.entry.js +2 -2
- package/dist/cjs/digi-info-card.cjs.entry.js +1 -1
- package/dist/cjs/digi-link-button.cjs.entry.js +2 -1
- package/dist/cjs/digi-navigation-pagination.cjs.entry.js +2 -2
- package/dist/cjs/digi-notification-alert.cjs.entry.js +2 -2
- package/dist/cjs/digi-notification-error-page.cjs.entry.js +2 -2
- package/dist/cjs/digi-tools-feedback.cjs.entry.js +2 -2
- package/dist/cjs/digi-typography-heading-jumbo.cjs.entry.js +38 -0
- package/dist/cjs/digi-typography-preamble.cjs.entry.js +20 -0
- package/dist/cjs/index-7a477838.js +10 -14
- package/dist/cjs/index.cjs.js +20 -20
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/typography-heading-jumbo-variation.enum-8677e099.js +17 -0
- package/dist/cjs/{typography-variation.enum-9f56fd50.js → typography-variation.enum-8fd8bed4.js} +6 -16
- package/dist/collection/components/_chart/bar-chart/bar-chart.css +13 -19
- package/dist/collection/components/_chart/bar-chart/bar-chart.js +125 -110
- package/dist/collection/components/_chart/chart-line/chart-line.css +19 -23
- package/dist/collection/components/_code/code-block/code-block.css +2 -2
- package/dist/collection/components/_info-card/info-card/info-card.js +5 -5
- package/dist/collection/components/_link/link-button/link-button.js +24 -1
- package/dist/digi-arbetsformedlingen/digi-arbetsformedlingen.esm.js +1 -1
- package/dist/digi-arbetsformedlingen/index.esm.js +1 -1
- package/dist/digi-arbetsformedlingen/p-044b32d7.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/{p-e2330d9c.entry.js → p-1241d74a.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/{p-e54f5b28.entry.js → p-222a2b41.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/p-37377041.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-3ae60edc.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-431baa4e.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/{p-0d35dc92.entry.js → p-56ca6c5c.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/{p-6559910e.entry.js → p-58f76475.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/{p-092d0e3e.entry.js → p-5a08f170.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/p-5aae7437.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/{p-c04b06a2.entry.js → p-5ac3d7a9.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/{p-e0db40e9.entry.js → p-69010d14.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/{p-f1a6524e.entry.js → p-83b3f053.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/p-86eddf30.js +1 -0
- package/dist/digi-arbetsformedlingen/p-9f03b573.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/p-a884ccf8.entry.js +1 -0
- package/dist/digi-arbetsformedlingen/{p-01f5f243.entry.js → p-c4cf1215.entry.js} +1 -1
- package/dist/digi-arbetsformedlingen/p-d1886fff.js +1 -0
- package/dist/digi-arbetsformedlingen/{p-5c7acd45.entry.js → p-e3bdf65a.entry.js} +1 -1
- package/dist/esm/digi-arbetsformedlingen.js +1 -1
- package/dist/esm/{digi-button_24.entry.js → digi-bar-chart_27.entry.js} +1608 -47
- package/dist/esm/digi-calendar-datepicker.entry.js +2 -2
- package/dist/esm/digi-chart-line.entry.js +1 -1
- package/dist/esm/digi-code-block_3.entry.js +3 -3
- package/dist/esm/digi-dialog.entry.js +2 -2
- package/dist/esm/digi-footer.entry.js +2 -2
- package/dist/esm/digi-form-error-list.entry.js +2 -2
- package/dist/esm/digi-form-receipt.entry.js +2 -2
- package/dist/esm/digi-form-select-filter.entry.js +2 -2
- package/dist/esm/digi-info-card.entry.js +1 -1
- package/dist/esm/digi-link-button.entry.js +2 -1
- package/dist/esm/digi-navigation-pagination.entry.js +2 -2
- package/dist/esm/digi-notification-alert.entry.js +2 -2
- package/dist/esm/digi-notification-error-page.entry.js +2 -2
- package/dist/esm/digi-tools-feedback.entry.js +2 -2
- package/dist/esm/digi-typography-heading-jumbo.entry.js +34 -0
- package/dist/esm/digi-typography-preamble.entry.js +16 -0
- package/dist/esm/index-148a7577.js +10 -14
- package/dist/esm/index.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/typography-heading-jumbo-variation.enum-eb737f1b.js +17 -0
- package/dist/esm/{typography-variation.enum-8ba40d15.js → typography-variation.enum-531cdf64.js} +7 -17
- package/dist/types/components/_chart/bar-chart/bar-chart.d.ts +9 -0
- package/dist/types/components/_info-card/info-card/info-card.d.ts +4 -4
- package/dist/types/components/_link/link-button/link-button.d.ts +5 -0
- package/dist/types/components.d.ts +18 -8
- package/hydrate/index.js +132 -115
- package/hydrate/index.mjs +132 -115
- package/package.json +1 -1
- package/components/p-2bc16106.js +0 -129
- package/dist/cjs/bar-chart-variation.enum-a4e866b6.js +0 -7
- package/dist/cjs/digi-bar-chart.cjs.entry.js +0 -1510
- package/dist/cjs/digi-icon-caret-down_2.cjs.entry.js +0 -53
- package/dist/cjs/digi-icon-chart_2.cjs.entry.js +0 -53
- package/dist/digi-arbetsformedlingen/p-0c271457.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-2422b0d1.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-54a797ed.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-a5c6e42e.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-b22f09f1.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-bd6e0b22.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-c1606b8a.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-d2d0856f.js +0 -1
- package/dist/digi-arbetsformedlingen/p-d8b9b535.entry.js +0 -1
- package/dist/digi-arbetsformedlingen/p-dcdffb3c.js +0 -1
- package/dist/esm/bar-chart-variation.enum-97c0b47f.js +0 -7
- package/dist/esm/digi-bar-chart.entry.js +0 -1506
- package/dist/esm/digi-icon-caret-down_2.entry.js +0 -48
- package/dist/esm/digi-icon-chart_2.entry.js +0 -48
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-7a477838.js');
|
|
6
|
+
const linear = require('./linear-86314cb2.js');
|
|
7
|
+
const text = require('./text-3157012b.js');
|
|
6
8
|
const randomIdGenerator_util = require('./randomIdGenerator.util-e7f4b6de.js');
|
|
9
|
+
const typographyVariation_enum = require('./typography-variation.enum-8fd8bed4.js');
|
|
7
10
|
const codeExampleVariation_enum = require('./code-example-variation.enum-1611825e.js');
|
|
8
11
|
const formInputSearchVariation_enum = require('./form-input-search-variation.enum-e0e025b1.js');
|
|
9
12
|
const buttonVariation_enum = require('./button-variation.enum-bc521499.js');
|
|
10
13
|
require('./badge-notification-shape.enum-ff802554.js');
|
|
11
|
-
const typographyVariation_enum = require('./typography-variation.enum-9f56fd50.js');
|
|
12
14
|
require('./badge-status-variation.enum-0a5adc21.js');
|
|
13
15
|
require('./calendar-week-view-heading-level.enum-fd0c841b.js');
|
|
14
|
-
require('./bar-chart-variation.enum-a4e866b6.js');
|
|
15
16
|
require('./code-variation.enum-c4a4e6fd.js');
|
|
16
17
|
require('./expandable-accordion-header-level.enum-45483252.js');
|
|
17
18
|
require('./expandable-faq-item-variation.enum-89427195.js');
|
|
@@ -46,12 +47,1527 @@ require('./tag-size.enum-387c516c.js');
|
|
|
46
47
|
require('./tools-feedback-banner-type.enum-de373ba0.js');
|
|
47
48
|
require('./tools-feedback-rating-variation.enum-2f71e84d.js');
|
|
48
49
|
require('./tools-theme-provider.brand.enum-bc855272.js');
|
|
50
|
+
require('./typography-heading-jumbo-variation.enum-8677e099.js');
|
|
49
51
|
require('./typography-meta-variation.enum-13ac3538.js');
|
|
50
52
|
require('./typography-time-variation.enum-bce1d87e.js');
|
|
51
53
|
const utilBreakpointObserverBreakpoints_enum = require('./util-breakpoint-observer-breakpoints.enum-e96d3a84.js');
|
|
52
54
|
const logger_util = require('./logger.util-fdafc086.js');
|
|
53
55
|
const keyboardHandler_util = require('./keyboardHandler.util-d8600adb.js');
|
|
54
56
|
|
|
57
|
+
function band() {
|
|
58
|
+
var scale = linear.ordinal().unknown(undefined),
|
|
59
|
+
domain = scale.domain,
|
|
60
|
+
ordinalRange = scale.range,
|
|
61
|
+
r0 = 0,
|
|
62
|
+
r1 = 1,
|
|
63
|
+
step,
|
|
64
|
+
bandwidth,
|
|
65
|
+
round = false,
|
|
66
|
+
paddingInner = 0,
|
|
67
|
+
paddingOuter = 0,
|
|
68
|
+
align = 0.5;
|
|
69
|
+
|
|
70
|
+
delete scale.unknown;
|
|
71
|
+
|
|
72
|
+
function rescale() {
|
|
73
|
+
var n = domain().length,
|
|
74
|
+
reverse = r1 < r0,
|
|
75
|
+
start = reverse ? r1 : r0,
|
|
76
|
+
stop = reverse ? r0 : r1;
|
|
77
|
+
step = (stop - start) / Math.max(1, n - paddingInner + paddingOuter * 2);
|
|
78
|
+
if (round) step = Math.floor(step);
|
|
79
|
+
start += (stop - start - step * (n - paddingInner)) * align;
|
|
80
|
+
bandwidth = step * (1 - paddingInner);
|
|
81
|
+
if (round) start = Math.round(start), bandwidth = Math.round(bandwidth);
|
|
82
|
+
var values = linear.range(n).map(function(i) { return start + step * i; });
|
|
83
|
+
return ordinalRange(reverse ? values.reverse() : values);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
scale.domain = function(_) {
|
|
87
|
+
return arguments.length ? (domain(_), rescale()) : domain();
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
scale.range = function(_) {
|
|
91
|
+
return arguments.length ? ([r0, r1] = _, r0 = +r0, r1 = +r1, rescale()) : [r0, r1];
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
scale.rangeRound = function(_) {
|
|
95
|
+
return [r0, r1] = _, r0 = +r0, r1 = +r1, round = true, rescale();
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
scale.bandwidth = function() {
|
|
99
|
+
return bandwidth;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
scale.step = function() {
|
|
103
|
+
return step;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
scale.round = function(_) {
|
|
107
|
+
return arguments.length ? (round = !!_, rescale()) : round;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
scale.padding = function(_) {
|
|
111
|
+
return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_), rescale()) : paddingInner;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
scale.paddingInner = function(_) {
|
|
115
|
+
return arguments.length ? (paddingInner = Math.min(1, _), rescale()) : paddingInner;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
scale.paddingOuter = function(_) {
|
|
119
|
+
return arguments.length ? (paddingOuter = +_, rescale()) : paddingOuter;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
scale.align = function(_) {
|
|
123
|
+
return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
scale.copy = function() {
|
|
127
|
+
return band(domain(), [r0, r1])
|
|
128
|
+
.round(round)
|
|
129
|
+
.paddingInner(paddingInner)
|
|
130
|
+
.paddingOuter(paddingOuter)
|
|
131
|
+
.align(align);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
return linear.initRange.apply(rescale(), arguments);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const barChartCss = ".sc-digi-bar-chart-h .digi-bar-chart.sc-digi-bar-chart{font-family:var(--digi--global--typography--font-family--default)}.sc-digi-bar-chart-h .topWrapper.sc-digi-bar-chart,.sc-digi-bar-chart-h .chartTitle.sc-digi-bar-chart .digi-typography.sc-digi-bar-chart{display:flex;flex-direction:column;gap:0.75rem}.sc-digi-bar-chart-h .topWrapper.sc-digi-bar-chart{margin-bottom:0.75rem}.sc-digi-bar-chart-h .chartTitle.sc-digi-bar-chart{--MARGIN--HEADING-2:0;--MARGIN--HEADING-3:0;--MARGIN--HEADING-4:0;--MARGIN--HEADING-5:0;--MARGIN--HEADING-6:0}.sc-digi-bar-chart-h .buttonWrapper.sc-digi-bar-chart{--digi--button--padding--medium:4px 4px 0.8125rem 0}.sc-digi-bar-chart-h .chartTooltip.sc-digi-bar-chart{box-sizing:border-box;position:absolute;background-color:rgba(250, 250, 250, 0.98);color:black;padding:5px 10px;padding-right:5px;border-radius:4px;display:flex;flex-direction:row;align-items:flex-start;box-shadow:rgba(60, 64, 67, 0.4) 0px 1px 2px 0px, rgba(60, 64, 67, 0.2) 0px 2px 6px 2px;font-size:0.875rem;display:none}.sc-digi-bar-chart-h .close.sc-digi-bar-chart{--digi--icon--color:black;cursor:pointer;margin-top:-5px}.sc-digi-bar-chart-h .legend.sc-digi-bar-chart::-webkit-scrollbar,.sc-digi-bar-chart-h .table.sc-digi-bar-chart::-webkit-scrollbar{height:10px;width:10px}.sc-digi-bar-chart-h .legend.sc-digi-bar-chart::-webkit-scrollbar-track,.sc-digi-bar-chart-h .table.sc-digi-bar-chart::-webkit-scrollbar-track{background:whitesmoke;border-radius:4px}.sc-digi-bar-chart-h .legend.sc-digi-bar-chart::-webkit-scrollbar-thumb,.sc-digi-bar-chart-h .table.sc-digi-bar-chart::-webkit-scrollbar-thumb{background-color:lightgray;border-radius:4px;border:0}.sc-digi-bar-chart-h .scChartStatus.sc-digi-bar-chart{border:0;clip:rect(1px, 1px, 1px, 1px);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sc-digi-bar-chart-h .table.sc-digi-bar-chart{display:none;overflow-y:scroll;height:fit-content;border-radius:4px;padding:0.25rem;background:linear-gradient(white 30%, rgba(255, 255, 255, 0)) center top, linear-gradient(rgba(255, 255, 255, 0), white 70%) center bottom, radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)) center top, radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0)) center bottom;background-repeat:no-repeat;background-size:100% 40px, 100% 40px, 100% 14px, 100% 14px;background-attachment:local, local, scroll, scroll}";
|
|
138
|
+
const DigiBarChartStyle0 = barChartCss;
|
|
139
|
+
|
|
140
|
+
const barChart = class {
|
|
141
|
+
constructor(hostRef) {
|
|
142
|
+
index.registerInstance(this, hostRef);
|
|
143
|
+
// States
|
|
144
|
+
this._loading = false;
|
|
145
|
+
this._placeholderTicks = ['0', '1', '2', '3', '4', '5', '6', '7'];
|
|
146
|
+
// Width of data at each tick, if we have two data series that have values att same tick, this will be 2 for example. defaults to 1;
|
|
147
|
+
this.dataWidth = 1;
|
|
148
|
+
this.barGap = 0;
|
|
149
|
+
this._dims = {};
|
|
150
|
+
this._margin = {
|
|
151
|
+
bottom: 0,
|
|
152
|
+
top: 6,
|
|
153
|
+
left: 5,
|
|
154
|
+
right: 15,
|
|
155
|
+
ellipsis: false
|
|
156
|
+
};
|
|
157
|
+
this.tickPadding = 8;
|
|
158
|
+
this.yTickSize = 0;
|
|
159
|
+
this.xTickSize = 5;
|
|
160
|
+
// Width of the largets X-tick-value
|
|
161
|
+
this._tickWidth = 1;
|
|
162
|
+
// Transition
|
|
163
|
+
this.defaultDuration = 400;
|
|
164
|
+
// Text and formats
|
|
165
|
+
this.fontSize = '0.875rem';
|
|
166
|
+
this.colorPalettes = ['--digi--color--background--brand-primary', '--digi--color--infographic--brand--primary', '--digi--color--background--sentiment--beta--primary', '--digi--color--text--interactive--visited', '--digi--color--icon--validation--error'];
|
|
167
|
+
// Observer for watching size changes when in line chart mode
|
|
168
|
+
this.barChartObserver = new ResizeObserver((entries) => {
|
|
169
|
+
entries.forEach(() => {
|
|
170
|
+
if (this._loading)
|
|
171
|
+
return this.loadingResize();
|
|
172
|
+
this.resize();
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
// Observer for watching size changes when in table mode
|
|
176
|
+
this.tableObserver = new ResizeObserver((entries) => {
|
|
177
|
+
entries.forEach(() => {
|
|
178
|
+
linear.select(this._legendDiv).style('width', this._dims.width + 'px');
|
|
179
|
+
this.resizeTable();
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
// Resizing chart while loading
|
|
183
|
+
this.loadingResize = () => {
|
|
184
|
+
const newHeight = this.setDims();
|
|
185
|
+
this.setMargins(true);
|
|
186
|
+
this._svg.attr('width', this._dims.width).attr('height', this._dims.height);
|
|
187
|
+
this._barChartContainer.attr('transform', `translate(${this._margin.left + this.tickPadding + this.yTickSize},0)`);
|
|
188
|
+
this._margin.right =
|
|
189
|
+
this.getTextSize(this._xScale.domain()[1].toLocaleString()) / 2 +
|
|
190
|
+
this.yTickSize +
|
|
191
|
+
this.tickPadding;
|
|
192
|
+
// If there is a new height
|
|
193
|
+
if (newHeight) {
|
|
194
|
+
// Update y-axis with potentially new height (might want to do a check here)
|
|
195
|
+
this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
196
|
+
? this._yScale.range([
|
|
197
|
+
this._margin.top,
|
|
198
|
+
this._dims.height - this._margin.bottom
|
|
199
|
+
])
|
|
200
|
+
: this._yScale.range([
|
|
201
|
+
this._dims.height - this._margin.bottom,
|
|
202
|
+
this._margin.top
|
|
203
|
+
]);
|
|
204
|
+
this._xAxisHandle.attr('transform', `translate(0,${this._dims.height - this._margin.bottom})`);
|
|
205
|
+
}
|
|
206
|
+
// Update x-axis with new width
|
|
207
|
+
this._xScale.range([
|
|
208
|
+
0,
|
|
209
|
+
this._dims.width - this._margin.right - this._margin.left
|
|
210
|
+
]);
|
|
211
|
+
this._barSelection
|
|
212
|
+
.attr('x', this.xFunction)
|
|
213
|
+
.attr('width', this.widthFunction);
|
|
214
|
+
this.setValueTicks();
|
|
215
|
+
};
|
|
216
|
+
// Adding click listener for tool tip text
|
|
217
|
+
this.setTickInteraction = () => {
|
|
218
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal) {
|
|
219
|
+
this._yAxisHandle
|
|
220
|
+
.selectAll('text')
|
|
221
|
+
.style('cursor', 'pointer')
|
|
222
|
+
.on('click', this.openTooltip)
|
|
223
|
+
.on('mouseenter', this.hover)
|
|
224
|
+
.on('mouseleave', this.hoverOut);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
this._xAxisHandle
|
|
228
|
+
.selectAll('text')
|
|
229
|
+
.style('cursor', 'pointer')
|
|
230
|
+
.on('click', this.openTooltip)
|
|
231
|
+
.on('mouseenter', this.hover)
|
|
232
|
+
.on('mouseleave', this.hoverOut);
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
// Setting Y-scale
|
|
236
|
+
this.setYScale = (empty) => {
|
|
237
|
+
var _a, _b, _c;
|
|
238
|
+
if (this.afVariation == typographyVariation_enum.BarChartVariation.Horizontal) {
|
|
239
|
+
this._yScale = band(empty
|
|
240
|
+
? ['0', '1', '2', '3', '4', '5', '6', '7']
|
|
241
|
+
: this._chartData.data.xValueNames, [this._margin.top, this._dims.height - this._margin.bottom])
|
|
242
|
+
.paddingOuter(0.1)
|
|
243
|
+
.paddingInner(0.1);
|
|
244
|
+
this._yAxis = linear.axisLeft(this._yScale);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
this._yScale = linear.linear()
|
|
248
|
+
.domain(empty ? [0, 10] : [this._minVal, this._maxVal])
|
|
249
|
+
.nice(((_b = (_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.numberOfReferenceLines)
|
|
250
|
+
? (_c = this._chartData) === null || _c === void 0 ? void 0 : _c.meta.numberOfReferenceLines
|
|
251
|
+
: 3);
|
|
252
|
+
this._yScale.range([
|
|
253
|
+
this._dims.height - this._margin.bottom,
|
|
254
|
+
this._margin.top
|
|
255
|
+
]);
|
|
256
|
+
this._yAxis = linear.axisLeft(this._yScale);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
// Setting X-Scale
|
|
260
|
+
this.setXScale = (empty) => {
|
|
261
|
+
// Horizontal
|
|
262
|
+
if (this.afVariation == typographyVariation_enum.BarChartVariation.Horizontal) {
|
|
263
|
+
this._xScale = linear.linear()
|
|
264
|
+
.domain(empty ? [0, 10] : [this._minVal, this._maxVal])
|
|
265
|
+
.nice(3);
|
|
266
|
+
this._margin.right =
|
|
267
|
+
this.getTextSize(this._xScale.domain()[1].toLocaleString()) / 2 +
|
|
268
|
+
this.yTickSize +
|
|
269
|
+
this.tickPadding;
|
|
270
|
+
this._xScale.range([
|
|
271
|
+
0,
|
|
272
|
+
this._dims.width - this._margin.right - this._margin.left
|
|
273
|
+
]);
|
|
274
|
+
// Initializing actual axis
|
|
275
|
+
this._xAxis = linear.axisBottom(this._xScale);
|
|
276
|
+
this._tickWidth = this.getLargestText(this._xScale.ticks().map((tick) => tick.toLocaleString()));
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
// Vertical
|
|
280
|
+
this._xScale = band()
|
|
281
|
+
.domain(empty ? this._placeholderTicks : this._chartData.data.xValueNames)
|
|
282
|
+
.range([0, this._dims.width - this._margin.right - this._margin.left])
|
|
283
|
+
.paddingOuter(0.1)
|
|
284
|
+
.paddingInner(0.1);
|
|
285
|
+
this._xAxis = linear.axisBottom(this._xScale);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
// Stores all tick text sizes in an indexable array
|
|
289
|
+
this.tickSizes = () => {
|
|
290
|
+
// Initializing tick size array
|
|
291
|
+
this._namedTickSizes = [];
|
|
292
|
+
this._ellipsisSize = this.getTextSize('...');
|
|
293
|
+
if (this._chartData && this._chartData.data) {
|
|
294
|
+
for (let i = 0; i < this._chartData.data.xValueNames.length; i++) {
|
|
295
|
+
this._namedTickSizes.push(Math.ceil(this.getTextSize(this._chartData.data.xValueNames[i])));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
this.updateBars = (fromLoading) => {
|
|
300
|
+
this._barChartContainer
|
|
301
|
+
.selectAll('.barGroup')
|
|
302
|
+
.data(this.mappedData)
|
|
303
|
+
.join((enter) => {
|
|
304
|
+
var _a, _b;
|
|
305
|
+
const tempSelection = enter
|
|
306
|
+
.append('g')
|
|
307
|
+
.attr('class', 'barGroup')
|
|
308
|
+
.attr('id', (d) => 'barGroup' + d.key.replace(/[^A-Z0-9]+/gi, '_'));
|
|
309
|
+
tempSelection
|
|
310
|
+
.append('rect')
|
|
311
|
+
.attr('class', 'bar')
|
|
312
|
+
.style('cursor', 'pointer')
|
|
313
|
+
.attr('ry', 4)
|
|
314
|
+
.attr('rx', 4)
|
|
315
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
316
|
+
? this._yScale(d.key)
|
|
317
|
+
: this._dims.height - this._margin.bottom)
|
|
318
|
+
.attr('x', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
319
|
+
? 2
|
|
320
|
+
: this._xScale(d.key))
|
|
321
|
+
.attr('width', () => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
322
|
+
? 0
|
|
323
|
+
: this._xScale.bandwidth())
|
|
324
|
+
.attr('height', () => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
325
|
+
? this._yScale.bandwidth()
|
|
326
|
+
: 0)
|
|
327
|
+
.on('mouseenter', this.hover)
|
|
328
|
+
.on('mouseleave', this.hoverOut)
|
|
329
|
+
.on('click', this.openTooltip)
|
|
330
|
+
.transition()
|
|
331
|
+
.duration(this.defaultDuration)
|
|
332
|
+
.ease(linear.polyInOut)
|
|
333
|
+
.attr('width', this.widthFunction)
|
|
334
|
+
.attr('y', this.yFunction)
|
|
335
|
+
.attr('height', this.heightFunction)
|
|
336
|
+
.attr('fill', '#00005a');
|
|
337
|
+
if (!((_b = (_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.valueLabels))
|
|
338
|
+
return tempSelection;
|
|
339
|
+
tempSelection
|
|
340
|
+
.append('text')
|
|
341
|
+
.text((d) => d.value.toLocaleString())
|
|
342
|
+
.attr('class', 'barText')
|
|
343
|
+
.attr('font-size', this.fontSize)
|
|
344
|
+
.attr('font-weight', '600')
|
|
345
|
+
.attr('text-anchor', 'end')
|
|
346
|
+
.style('pointer-events', 'none')
|
|
347
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
348
|
+
? this._yScale(d.key) + this._yScale.bandwidth() / 2
|
|
349
|
+
: this._dims.height - this._margin.bottom)
|
|
350
|
+
.attr('x', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
351
|
+
? 2
|
|
352
|
+
: this._xScale(d.key) + this._xScale.bandwidth() / 2)
|
|
353
|
+
.transition()
|
|
354
|
+
.duration(this.defaultDuration)
|
|
355
|
+
.ease(linear.polyInOut)
|
|
356
|
+
.attr('font-size', this.fontSize)
|
|
357
|
+
.attr('font-weight', '600')
|
|
358
|
+
.attr('x', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
359
|
+
? this._xScale(d.value)
|
|
360
|
+
: this._xScale(d.key) + this._xScale.bandwidth() / 2)
|
|
361
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
362
|
+
? this._yScale(d.key) + this._yScale.bandwidth() / 2
|
|
363
|
+
: this._yScale(d.value))
|
|
364
|
+
.attr('text-anchor', (d) => {
|
|
365
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Vertical)
|
|
366
|
+
return 'middle';
|
|
367
|
+
return this._xScale(d.value) < d.len + this.tickPadding * 2
|
|
368
|
+
? 'start'
|
|
369
|
+
: 'end';
|
|
370
|
+
})
|
|
371
|
+
.attr('dx', (d) => {
|
|
372
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal)
|
|
373
|
+
return this._xScale(d.value) < d.len + this.tickPadding * 2
|
|
374
|
+
? this.tickPadding
|
|
375
|
+
: -this.tickPadding;
|
|
376
|
+
return 0;
|
|
377
|
+
})
|
|
378
|
+
.attr('fill', (d) => {
|
|
379
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Vertical)
|
|
380
|
+
return 'black';
|
|
381
|
+
return this._xScale(d.value) < d.len + this.tickPadding * 2
|
|
382
|
+
? 'black'
|
|
383
|
+
: 'white';
|
|
384
|
+
})
|
|
385
|
+
.attr('dy', () => this.afVariation == typographyVariation_enum.BarChartVariation.Horizontal
|
|
386
|
+
? '0.35em'
|
|
387
|
+
: '-0.25em')
|
|
388
|
+
.style('pointer-events', 'none')
|
|
389
|
+
.attrTween('text', (d, i, nodelist) => {
|
|
390
|
+
const oldnum = parseFloat(nodelist[i].textContent.replace(/\s/g, ''))
|
|
391
|
+
? parseFloat(nodelist[i].textContent.replace(/\s/g, ''))
|
|
392
|
+
: 0;
|
|
393
|
+
const interpolatedValue = linear.interpolate(oldnum, d.value);
|
|
394
|
+
return (t) => (nodelist[i].textContent = parseInt(interpolatedValue(t)).toLocaleString(undefined, this._numberFormat));
|
|
395
|
+
});
|
|
396
|
+
return tempSelection;
|
|
397
|
+
}, (update) => {
|
|
398
|
+
// Update ids to bars
|
|
399
|
+
update.attr('id', (d) => 'barGroup' + d.key.replace(/[^A-Z0-9]+/gi, '_'));
|
|
400
|
+
// Mouse interaction to updated loading bars
|
|
401
|
+
if (fromLoading) {
|
|
402
|
+
update
|
|
403
|
+
.select('rect')
|
|
404
|
+
.on('mouseenter', this.hover)
|
|
405
|
+
.on('mouseleave', this.hoverOut)
|
|
406
|
+
.on('click', this.openTooltip)
|
|
407
|
+
.attr('x', this.xFunction)
|
|
408
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
409
|
+
? this._yScale(d.key)
|
|
410
|
+
: this._dims.height - this._margin.bottom)
|
|
411
|
+
.attr('width', this.widthFunction)
|
|
412
|
+
.attr('height', () => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
413
|
+
? this._yScale.bandwidth()
|
|
414
|
+
: 0)
|
|
415
|
+
.attr('fill', '#00005a')
|
|
416
|
+
.transition()
|
|
417
|
+
.duration(this.defaultDuration)
|
|
418
|
+
.ease(linear.polyInOut)
|
|
419
|
+
.attr('y', this.yFunction)
|
|
420
|
+
.attr('height', this.heightFunction)
|
|
421
|
+
.on('end', () => this.barChartObserver.observe(this._chartDiv)); // Reset barchartObserver
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
update
|
|
425
|
+
.select('rect')
|
|
426
|
+
.transition()
|
|
427
|
+
.duration(this.defaultDuration)
|
|
428
|
+
.ease(linear.polyInOut)
|
|
429
|
+
.attr('x', this.xFunction)
|
|
430
|
+
.attr('y', this.yFunction)
|
|
431
|
+
.attr('width', this.widthFunction)
|
|
432
|
+
.attr('height', this.heightFunction)
|
|
433
|
+
.attr('fill', '#00005a');
|
|
434
|
+
}
|
|
435
|
+
return update
|
|
436
|
+
.select('text')
|
|
437
|
+
.style('display', () => { var _a, _b; return ((_b = (_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.valueLabels) ? null : 'none'; })
|
|
438
|
+
.transition()
|
|
439
|
+
.duration(this.defaultDuration)
|
|
440
|
+
.ease(linear.polyInOut)
|
|
441
|
+
.attr('font-size', this.fontSize)
|
|
442
|
+
.attr('font-weight', '600')
|
|
443
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
444
|
+
? this._yScale(d.key) + this._yScale.bandwidth() / 2
|
|
445
|
+
: this._yScale(d.value))
|
|
446
|
+
.attr('x', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
447
|
+
? this._xScale(d.value)
|
|
448
|
+
: this._xScale(d.key) + this._xScale.bandwidth() / 2)
|
|
449
|
+
.attr('text-anchor', (d) => {
|
|
450
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Vertical)
|
|
451
|
+
return 'middle';
|
|
452
|
+
return this._xScale(d.value) < d.len + this.tickPadding * 2
|
|
453
|
+
? 'start'
|
|
454
|
+
: 'end';
|
|
455
|
+
})
|
|
456
|
+
.attr('dx', (d) => {
|
|
457
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal)
|
|
458
|
+
return this._xScale(d.value) < d.len + this.tickPadding * 2
|
|
459
|
+
? this.tickPadding
|
|
460
|
+
: -this.tickPadding;
|
|
461
|
+
return 0;
|
|
462
|
+
})
|
|
463
|
+
.attr('fill', (d) => {
|
|
464
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Vertical)
|
|
465
|
+
return 'black';
|
|
466
|
+
return this._xScale(d.value) < d.len + this.tickPadding * 2
|
|
467
|
+
? 'black'
|
|
468
|
+
: 'white';
|
|
469
|
+
})
|
|
470
|
+
.attr('dy', () => this.afVariation == typographyVariation_enum.BarChartVariation.Horizontal
|
|
471
|
+
? '0.35em'
|
|
472
|
+
: '-0.25em')
|
|
473
|
+
.style('pointer-events', 'none')
|
|
474
|
+
.attrTween('text', (d, i, nodelist) => {
|
|
475
|
+
const oldnum = parseFloat(nodelist[i].textContent.replace(/\s/g, ''))
|
|
476
|
+
? parseFloat(nodelist[i].textContent.replace(/\s/g, ''))
|
|
477
|
+
: 0;
|
|
478
|
+
const interpolatedValue = linear.interpolate(oldnum, d.value);
|
|
479
|
+
return (t) => (nodelist[i].textContent = parseInt(interpolatedValue(t)).toLocaleString(undefined, this._numberFormat));
|
|
480
|
+
});
|
|
481
|
+
}, (exit) => exit.remove());
|
|
482
|
+
this._barSelection = this._barChartContainer.selectAll('rect');
|
|
483
|
+
this._textSelection = this._barChartContainer.selectAll('.barText');
|
|
484
|
+
};
|
|
485
|
+
// Setting position of text according to bar size
|
|
486
|
+
this.adjustBarText = () => {
|
|
487
|
+
var _a, _b;
|
|
488
|
+
if (!((_b = (_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.valueLabels))
|
|
489
|
+
return;
|
|
490
|
+
this._textSelection
|
|
491
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
492
|
+
? this._yScale(d.key) + this._yScale.bandwidth() / 2
|
|
493
|
+
: this._yScale(d.value))
|
|
494
|
+
.attr('x', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
495
|
+
? this._xScale(d.value)
|
|
496
|
+
: this._xScale(d.key) + this._xScale.bandwidth() / 2)
|
|
497
|
+
.attr('dx', (d) => {
|
|
498
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal)
|
|
499
|
+
return this._xScale(d.value) < d.len + this.tickPadding * 2
|
|
500
|
+
? this.tickPadding
|
|
501
|
+
: -this.tickPadding;
|
|
502
|
+
return 0;
|
|
503
|
+
})
|
|
504
|
+
.attr('fill', (d) => {
|
|
505
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Vertical)
|
|
506
|
+
return 'black';
|
|
507
|
+
return this._xScale(d.value) < d.len + this.tickPadding * 2
|
|
508
|
+
? 'black'
|
|
509
|
+
: 'white';
|
|
510
|
+
})
|
|
511
|
+
.attr('text-anchor', (d) => {
|
|
512
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Vertical)
|
|
513
|
+
return 'middle';
|
|
514
|
+
return this._xScale(d.value) < d.len + this.tickPadding * 2
|
|
515
|
+
? 'start'
|
|
516
|
+
: 'end';
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
this.reshapeData = () => {
|
|
520
|
+
const toReturn = [];
|
|
521
|
+
if (this._loading) {
|
|
522
|
+
this._placeholderTicks.forEach((key) => {
|
|
523
|
+
const tick = { key: key, series: [] };
|
|
524
|
+
tick.series.push({
|
|
525
|
+
key: key,
|
|
526
|
+
serie: '',
|
|
527
|
+
value: Math.floor(Math.random() * (9 - 2 + 1) + 2),
|
|
528
|
+
len: 0
|
|
529
|
+
});
|
|
530
|
+
toReturn.push(tick);
|
|
531
|
+
});
|
|
532
|
+
return toReturn;
|
|
533
|
+
}
|
|
534
|
+
this._chartData.data.xValueNames.forEach((key, index) => {
|
|
535
|
+
const tick = { key: key, series: [] };
|
|
536
|
+
this._chartData.data.series.forEach((serie) => {
|
|
537
|
+
if (serie.yValues[index]) {
|
|
538
|
+
tick.series.push({
|
|
539
|
+
key: key,
|
|
540
|
+
serie: serie.title,
|
|
541
|
+
value: serie.yValues[index],
|
|
542
|
+
len: serie.yValues[index] ? this.getTextSize(serie.yValues[index].toLocaleString()) : 0
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
toReturn.push(tick);
|
|
547
|
+
});
|
|
548
|
+
return toReturn;
|
|
549
|
+
};
|
|
550
|
+
this.adjustBarSize = () => {
|
|
551
|
+
this._barSelection.selectAll('.bar')
|
|
552
|
+
.attr('x', this.xFunction)
|
|
553
|
+
.attr('y', this.yFunction)
|
|
554
|
+
.attr('width', this.widthFunction)
|
|
555
|
+
.attr('height', this.heightFunction);
|
|
556
|
+
};
|
|
557
|
+
// Handling x positioning of bars
|
|
558
|
+
this.xFunction = (d, i) => {
|
|
559
|
+
return this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
560
|
+
? (d.value > 0 ? this._xScale(0) : this._xScale(d.value))
|
|
561
|
+
: this._xScale(d.key) + ((this._xScale.bandwidth() / this.dataWidth) * i + (this.barGap * i));
|
|
562
|
+
};
|
|
563
|
+
// Handling y positioning of bars
|
|
564
|
+
this.yFunction = (d, i) => {
|
|
565
|
+
if (!d.value)
|
|
566
|
+
return 0;
|
|
567
|
+
return this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
568
|
+
? this._yScale(d.key) + ((this._yScale.bandwidth() / this.dataWidth) * i + (this.barGap * i))
|
|
569
|
+
: (d.value < 0 ? this._yScale(0) : this._yScale(d.value));
|
|
570
|
+
};
|
|
571
|
+
// Handling height for bars
|
|
572
|
+
this.heightFunction = (d) => {
|
|
573
|
+
if (!d.value)
|
|
574
|
+
return 0;
|
|
575
|
+
return this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
576
|
+
? this._yScale.bandwidth() / this.dataWidth - (this.barGap)
|
|
577
|
+
: (d.value < 0 ? this._yScale(d.value) - this._yScale(0) : this._yScale(0) - this._yScale(d.value));
|
|
578
|
+
};
|
|
579
|
+
// Handling width for bars
|
|
580
|
+
this.widthFunction = (d) => {
|
|
581
|
+
return this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
582
|
+
? Math.abs(this._xScale(0) - this._xScale(d.value))
|
|
583
|
+
: this._xScale.bandwidth() / this.dataWidth - (this.barGap);
|
|
584
|
+
};
|
|
585
|
+
// Resize table
|
|
586
|
+
this.resizeTable = () => {
|
|
587
|
+
this.setDims();
|
|
588
|
+
this.setTableDimensions();
|
|
589
|
+
};
|
|
590
|
+
// Setting dimension variable
|
|
591
|
+
this.setDims = (onlyHeight = false) => {
|
|
592
|
+
// Get title dimensions
|
|
593
|
+
const tempTitle = linear.select(this._titleDiv).node().getBoundingClientRect(), tempLegend = linear.select(this._legendDiv).node().getBoundingClientRect();
|
|
594
|
+
const prevHeight = this._dims.height;
|
|
595
|
+
if (!onlyHeight)
|
|
596
|
+
this._dims = linear.select(this._chartDiv).node().getBoundingClientRect();
|
|
597
|
+
this._dims.height =
|
|
598
|
+
this._maxHeight - tempLegend.height - tempTitle.height - 1.75 * this._rem;
|
|
599
|
+
return prevHeight != this._dims.height;
|
|
600
|
+
};
|
|
601
|
+
// Setting margins given text size
|
|
602
|
+
this.setMargins = (fromLoading) => {
|
|
603
|
+
var _a;
|
|
604
|
+
this._pixelSize =
|
|
605
|
+
Number(window
|
|
606
|
+
.getComputedStyle(document.body)
|
|
607
|
+
.getPropertyValue('font-size')
|
|
608
|
+
.match(/\d+/)[0]) * Number(this.fontSize.replace(/[^\d.]|\.(?=.*\.)/g, ''));
|
|
609
|
+
// Getting the longest word, assuming it will also be the widest in terms of pixels
|
|
610
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal) {
|
|
611
|
+
const left = ((_a = this._chartData) === null || _a === void 0 ? void 0 : _a.data) &&
|
|
612
|
+
this.getLargestText(this._chartData.data.xValueNames)
|
|
613
|
+
? this.getLargestText(this._chartData.data.xValueNames)
|
|
614
|
+
: 0;
|
|
615
|
+
this._margin.left = left;
|
|
616
|
+
}
|
|
617
|
+
else
|
|
618
|
+
this._margin.left = this.getLargestText(fromLoading
|
|
619
|
+
? ['0', '10']
|
|
620
|
+
: [
|
|
621
|
+
this._minVal ? this._tempScale[0].toLocaleString() : '0',
|
|
622
|
+
this._maxVal ? this._tempScale[1].toLocaleString() : '10'
|
|
623
|
+
]);
|
|
624
|
+
if (this._margin.left > this._dims.width / 4) {
|
|
625
|
+
this._margin.left = Math.floor(this._dims.width / 4);
|
|
626
|
+
this._margin.ellipsis = true;
|
|
627
|
+
}
|
|
628
|
+
else
|
|
629
|
+
this._margin.ellipsis = false;
|
|
630
|
+
this._margin.bottom = this._pixelSize + this.tickPadding + this.xTickSize;
|
|
631
|
+
};
|
|
632
|
+
// Adjusting y-ticks
|
|
633
|
+
this.setNamedTicks = (transition = false) => {
|
|
634
|
+
if (this.afVariation == typographyVariation_enum.BarChartVariation.Horizontal) {
|
|
635
|
+
if (!transition) {
|
|
636
|
+
this._yAxisHandle
|
|
637
|
+
.style('font-size', this.fontSize)
|
|
638
|
+
.style('font-family', 'Open Sans')
|
|
639
|
+
.call(this._yAxis
|
|
640
|
+
.tickPadding(this.tickPadding)
|
|
641
|
+
.tickSize(this.yTickSize)
|
|
642
|
+
.tickSizeOuter(0)
|
|
643
|
+
.tickFormat((d, i) => {
|
|
644
|
+
if (!this._margin.ellipsis)
|
|
645
|
+
return d.toLocaleString();
|
|
646
|
+
// Adding ellipsis to text
|
|
647
|
+
const size = this._namedTickSizes[i] + this.tickPadding + this.yTickSize;
|
|
648
|
+
const mSize = this._margin.left;
|
|
649
|
+
if (size < mSize)
|
|
650
|
+
return d.toLocaleString();
|
|
651
|
+
const newSize = this.getTextSize(d.slice(0, Math.max(Math.floor((mSize / (size + this._ellipsisSize)) * d.length), 3)) + '...');
|
|
652
|
+
let adjustment = 0;
|
|
653
|
+
if (newSize > mSize) {
|
|
654
|
+
adjustment = Math.ceil((newSize - mSize) / (size / d.length));
|
|
655
|
+
}
|
|
656
|
+
// Slicing the text up, saving atleast 3 characters
|
|
657
|
+
return (d
|
|
658
|
+
.slice(0, Math.max(Math.floor((mSize / (size + this._ellipsisSize)) * d.length) - adjustment, 3))
|
|
659
|
+
.trim() + '...');
|
|
660
|
+
}));
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
this._yAxisHandle
|
|
664
|
+
.style('font-size', this.fontSize)
|
|
665
|
+
.style('font-family', 'Open Sans')
|
|
666
|
+
.transition()
|
|
667
|
+
.duration(this.defaultDuration)
|
|
668
|
+
.call(this._yAxis
|
|
669
|
+
.tickPadding(this.tickPadding)
|
|
670
|
+
.tickSize(this.yTickSize)
|
|
671
|
+
.tickSizeOuter(0)
|
|
672
|
+
.tickFormat((d, i) => {
|
|
673
|
+
if (!this._margin.ellipsis)
|
|
674
|
+
return d;
|
|
675
|
+
// Adding ellipsis to text
|
|
676
|
+
const size = this._namedTickSizes[i] + this.tickPadding + this.yTickSize;
|
|
677
|
+
const mSize = this._margin.left;
|
|
678
|
+
if (size < mSize)
|
|
679
|
+
return d;
|
|
680
|
+
const newSize = this.getTextSize(d
|
|
681
|
+
.slice(0, Math.max(Math.floor((mSize / (size + this._ellipsisSize)) * d.length), 3))
|
|
682
|
+
.trim() + '...');
|
|
683
|
+
let adjustment = 0;
|
|
684
|
+
if (newSize > mSize) {
|
|
685
|
+
adjustment = Math.ceil((newSize - mSize) / (size / d.length));
|
|
686
|
+
}
|
|
687
|
+
// Slicing the text up, saving atleast 3 characters
|
|
688
|
+
return (d
|
|
689
|
+
.slice(0, Math.max(Math.floor((mSize / (size + this._ellipsisSize)) * d.length) - adjustment, 3))
|
|
690
|
+
.trim() + '...');
|
|
691
|
+
}));
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
else {
|
|
695
|
+
//Calculating every n:th text to show
|
|
696
|
+
let nTh = Math.round(this._chartData.data.xValues.length /
|
|
697
|
+
((this._dims.width - this._margin.left - this._margin.right) / 90 - 1));
|
|
698
|
+
if (Math.floor(this._chartData.data.xValues.length / nTh) < 4) {
|
|
699
|
+
nTh = Math.round(this._chartData.data.xValues.length / 4);
|
|
700
|
+
}
|
|
701
|
+
const allowedWidth = (this._dims.width - this._margin.left - this._margin.right) /
|
|
702
|
+
Math.floor(this._chartData.data.xValues.length / nTh + 1);
|
|
703
|
+
if (!transition) {
|
|
704
|
+
this._xAxisHandle
|
|
705
|
+
.style('font-size', this.fontSize)
|
|
706
|
+
.style('font-family', 'Open Sans')
|
|
707
|
+
.call(this._xAxis
|
|
708
|
+
.tickValues(this._xScale.domain().filter((...[, i]) => {
|
|
709
|
+
if (i == 0)
|
|
710
|
+
return true;
|
|
711
|
+
else {
|
|
712
|
+
return i % nTh == 0;
|
|
713
|
+
}
|
|
714
|
+
}))
|
|
715
|
+
.tickPadding(this.tickPadding)
|
|
716
|
+
.tickSize(this.xTickSize)
|
|
717
|
+
.tickSizeOuter(0)
|
|
718
|
+
.tickFormat((d, i) => {
|
|
719
|
+
const index = i * nTh;
|
|
720
|
+
if (this._namedTickSizes[index] < allowedWidth)
|
|
721
|
+
return d;
|
|
722
|
+
return (d.slice(0, Math.max(Math.floor((allowedWidth /
|
|
723
|
+
(this._namedTickSizes[index] +
|
|
724
|
+
this._ellipsisSize +
|
|
725
|
+
5)) *
|
|
726
|
+
d.length), 3)) + '...');
|
|
727
|
+
}));
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
this._xAxisHandle
|
|
731
|
+
.style('font-size', this.fontSize)
|
|
732
|
+
.style('font-family', 'Open Sans')
|
|
733
|
+
.transition()
|
|
734
|
+
.duration(this.defaultDuration)
|
|
735
|
+
.call(this._xAxis
|
|
736
|
+
.tickValues(this._xScale.domain().filter((...[, i]) => {
|
|
737
|
+
if (i == 0)
|
|
738
|
+
return true;
|
|
739
|
+
else {
|
|
740
|
+
return i % nTh == 0;
|
|
741
|
+
}
|
|
742
|
+
}))
|
|
743
|
+
.tickPadding(this.tickPadding)
|
|
744
|
+
.tickSize(this.xTickSize)
|
|
745
|
+
.tickSizeOuter(0)
|
|
746
|
+
.tickFormat((d, i) => {
|
|
747
|
+
const index = i * nTh;
|
|
748
|
+
if (this._namedTickSizes[index] < allowedWidth)
|
|
749
|
+
return d;
|
|
750
|
+
return (d.slice(0, Math.max(Math.floor((allowedWidth /
|
|
751
|
+
(this._namedTickSizes[index] +
|
|
752
|
+
this._ellipsisSize +
|
|
753
|
+
5)) *
|
|
754
|
+
d.length), 3)) + '...');
|
|
755
|
+
}));
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
};
|
|
759
|
+
// Positioning the ticks of the value bearing axis
|
|
760
|
+
this.setValueTicks = (transition = false) => {
|
|
761
|
+
var _a, _b;
|
|
762
|
+
if (((_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) && ((_b = this._chartData) === null || _b === void 0 ? void 0 : _b.meta.hideXAxis)) {
|
|
763
|
+
this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
764
|
+
? this._xAxisHandle.attr('display', 'none')
|
|
765
|
+
: this._yAxisHandle.attr('display', 'none');
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
let toCall, tickSize, handle;
|
|
769
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal) {
|
|
770
|
+
this._xAxisHandle.attr('display', null);
|
|
771
|
+
toCall = this._xAxis;
|
|
772
|
+
tickSize = -(this._dims.height - this._margin.top - this._margin.bottom);
|
|
773
|
+
handle = this._xAxisHandle;
|
|
774
|
+
}
|
|
775
|
+
else {
|
|
776
|
+
this._yAxisHandle.attr('display', null);
|
|
777
|
+
toCall = this._yAxis;
|
|
778
|
+
tickSize = -(this._dims.width - this._margin.left - this._margin.right);
|
|
779
|
+
handle = this._yAxisHandle;
|
|
780
|
+
}
|
|
781
|
+
// Computing the amount of ticks to show
|
|
782
|
+
const ticks = Math.min(Math.floor((this._dims.width - this._margin.left - this._margin.right) /
|
|
783
|
+
(this._tickWidth + this.xTickSize)) - 2, this.afVariation == typographyVariation_enum.BarChartVariation.Horizontal
|
|
784
|
+
? this._xScale.ticks().length
|
|
785
|
+
: this._yScale.ticks().length);
|
|
786
|
+
if (!transition) {
|
|
787
|
+
handle
|
|
788
|
+
.style('font-size', this.fontSize)
|
|
789
|
+
.style('font-family', 'Open Sans')
|
|
790
|
+
.call(toCall
|
|
791
|
+
.ticks(this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
792
|
+
? Math.max(2, Math.min(ticks, 9))
|
|
793
|
+
: 5) // Clamping value between 2 and 10
|
|
794
|
+
.tickPadding(this.tickPadding)
|
|
795
|
+
.tickSize(tickSize)
|
|
796
|
+
.tickSizeOuter(0)
|
|
797
|
+
.tickFormat((d) => d.toLocaleString()));
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
handle
|
|
801
|
+
.style('font-size', this.fontSize)
|
|
802
|
+
.style('font-family', 'Open Sans')
|
|
803
|
+
.transition('newScale')
|
|
804
|
+
.duration(this.defaultDuration)
|
|
805
|
+
.call(toCall
|
|
806
|
+
.ticks(this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
807
|
+
? Math.max(2, Math.min(ticks, 9))
|
|
808
|
+
: 5) // Clamping value between 2 and 10
|
|
809
|
+
.tickPadding(this.tickPadding)
|
|
810
|
+
.tickSize(tickSize)
|
|
811
|
+
.tickSizeOuter(0)
|
|
812
|
+
.tickFormat((d) => d.toLocaleString()));
|
|
813
|
+
}
|
|
814
|
+
handle.selectAll('line').attr('stroke', 'lightgray');
|
|
815
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Vertical)
|
|
816
|
+
this._yAxisHandle.select('.domain').attr('display', 'none');
|
|
817
|
+
};
|
|
818
|
+
// Highlight bar
|
|
819
|
+
this.hover = (event) => {
|
|
820
|
+
linear.select(event.target)
|
|
821
|
+
.transition('hover')
|
|
822
|
+
.duration(20)
|
|
823
|
+
.attr('fill', (d) => event.target.tagName === 'rect'
|
|
824
|
+
? `hsl(from ${this.colorFunction(d.serie)} h s calc(l + 10))`
|
|
825
|
+
: 'var(--digi--color--background--interactive--hover--tertiary)');
|
|
826
|
+
};
|
|
827
|
+
// Removing highlight from bar
|
|
828
|
+
this.hoverOut = (event) => {
|
|
829
|
+
linear.select(event.target)
|
|
830
|
+
.transition('hover')
|
|
831
|
+
.duration(this.defaultDuration)
|
|
832
|
+
.attr('fill', (d) => event.target.tagName === 'rect' ? this.colorFunction(d.serie) : '#333333');
|
|
833
|
+
};
|
|
834
|
+
this.openTooltip = (...[, d]) => {
|
|
835
|
+
// If type is string, the user has clicked on a y-axis tick
|
|
836
|
+
if (typeof d === 'string') {
|
|
837
|
+
this._tooltipData = this._barChartContainer
|
|
838
|
+
.select(`#barGroup${d.replace(/[^A-Z0-9]+/gi, '_')}`)
|
|
839
|
+
.datum();
|
|
840
|
+
}
|
|
841
|
+
else
|
|
842
|
+
this._tooltipData = d;
|
|
843
|
+
const tooltipBody = this._tooltip.select('.tooltipBody');
|
|
844
|
+
tooltipBody
|
|
845
|
+
.select(this._tooltipHeading)
|
|
846
|
+
.style('margin', '0 0.75rem 0 0 ')
|
|
847
|
+
.style('font-weight', 500)
|
|
848
|
+
.html(this._tooltipData.key);
|
|
849
|
+
tooltipBody
|
|
850
|
+
.selectAll('div')
|
|
851
|
+
.data([this._tooltipData])
|
|
852
|
+
.join('div')
|
|
853
|
+
.style('display', 'flex')
|
|
854
|
+
.style('flex-direction', 'row')
|
|
855
|
+
.style('flex-wrap', 'nowrap')
|
|
856
|
+
.style('white-space', 'nowrap')
|
|
857
|
+
.style('justify-content', 'space-between')
|
|
858
|
+
.html((d) => d.value.toLocaleString());
|
|
859
|
+
this._tooltip.style('display', 'flex');
|
|
860
|
+
this.positionTooltip(this._tooltipData);
|
|
861
|
+
};
|
|
862
|
+
this.closeTooltip = () => {
|
|
863
|
+
this._tooltip.style('display', 'none');
|
|
864
|
+
};
|
|
865
|
+
// Positions tooltip in horizontal mode
|
|
866
|
+
this.positionTooltip = (data) => {
|
|
867
|
+
const width = this._tooltip.node().getBoundingClientRect().width;
|
|
868
|
+
const height = this._tooltip.node().getBoundingClientRect().height + 8;
|
|
869
|
+
const diff = this._xScale(data.value) / 2 - width / 2;
|
|
870
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal) {
|
|
871
|
+
this._tooltip
|
|
872
|
+
.style('transform', `translate(${this._margin.left + this.tickPadding + Math.max(diff, -4)}px, ${this._yScale(data.key) + this._yScale.bandwidth() + this._yScale.paddingInner() * this._yScale.bandwidth()}px )`)
|
|
873
|
+
.style('max-width', this._xScale.range()[1] + 'px');
|
|
874
|
+
this._tooltip
|
|
875
|
+
.select('digi-icon-caret-up')
|
|
876
|
+
.style('position', 'absolute')
|
|
877
|
+
.style('--digi--icon--color', 'white')
|
|
878
|
+
.style('top', '-11px')
|
|
879
|
+
.style('left', '0')
|
|
880
|
+
.style('transform', `translate(${diff > 0 ? width / 2 - 10 : this._xScale(data.value) / 2}px,0)`);
|
|
881
|
+
}
|
|
882
|
+
else {
|
|
883
|
+
this._tooltip
|
|
884
|
+
.style('transform', `translate(${this._margin.left + this.tickPadding + this._xScale(data.key) + this._xScale.bandwidth() / 2 - width / 2}px, ${this._yScale(data.value) - height}px )`)
|
|
885
|
+
.style('max-width', this._xScale.range()[1] + 'px');
|
|
886
|
+
this._tooltip
|
|
887
|
+
.select('digi-icon-caret-down')
|
|
888
|
+
.style('position', 'absolute')
|
|
889
|
+
.style('--digi--icon--color', 'white')
|
|
890
|
+
.style('left', '0')
|
|
891
|
+
.style('bottom', '-11px')
|
|
892
|
+
.style('transform', `translate(${width / 2 - 6}px,0)`);
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
// Once texts has fully loaded, we can recompute some sizes
|
|
896
|
+
this.recomputeTextSize = () => {
|
|
897
|
+
var _a, _b;
|
|
898
|
+
if (this.afVariation == typographyVariation_enum.BarChartVariation.Horizontal)
|
|
899
|
+
this._tickWidth = this.getLargestText(this._xScale.ticks().map((tick) => tick.toLocaleString()));
|
|
900
|
+
this.tickSizes();
|
|
901
|
+
this._barChartContainer.selectAll('.barGroup').data(this.mappedData);
|
|
902
|
+
if ((_b = (_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.valueLabels)
|
|
903
|
+
this._textSelection.remove();
|
|
904
|
+
this.initBarText();
|
|
905
|
+
};
|
|
906
|
+
// Removes resize observer for chart and inits table
|
|
907
|
+
this.activateTable = (event) => {
|
|
908
|
+
this.closeTooltip();
|
|
909
|
+
this.barChartObserver.disconnect();
|
|
910
|
+
this.tableObserver.observe(this._chartDiv);
|
|
911
|
+
this._status.innerHTML = '<p>Visas som tabell</p>';
|
|
912
|
+
linear.select(this._host).select('.tableButton').style('display', 'none');
|
|
913
|
+
linear.select(this._host).select('.chartButton').style('display', null);
|
|
914
|
+
event.target.nextSibling.lastChild.focus();
|
|
915
|
+
const duration = 150;
|
|
916
|
+
this._svg
|
|
917
|
+
.attr('opacity', 1)
|
|
918
|
+
.transition('fadeout')
|
|
919
|
+
.duration(duration)
|
|
920
|
+
.attr('opacity', 0)
|
|
921
|
+
.on('end', () => {
|
|
922
|
+
this._svg.remove();
|
|
923
|
+
this._legendDiv.style['display'] = 'none';
|
|
924
|
+
this._tableDiv.style['display'] = 'block';
|
|
925
|
+
this.setTableContent();
|
|
926
|
+
this.setTableDimensions();
|
|
927
|
+
linear.select(this._tableDiv)
|
|
928
|
+
.style('opacity', 0)
|
|
929
|
+
.transition('fadein')
|
|
930
|
+
.duration(duration)
|
|
931
|
+
.style('opacity', 1);
|
|
932
|
+
});
|
|
933
|
+
linear.select(this._legendDiv)
|
|
934
|
+
.style('opacity', 1)
|
|
935
|
+
.transition('fadeout')
|
|
936
|
+
.duration(duration)
|
|
937
|
+
.style('opacity', 0);
|
|
938
|
+
};
|
|
939
|
+
// Removes observer and calls init functions for line chart
|
|
940
|
+
this.reInitChart = (event) => {
|
|
941
|
+
this.tableObserver.disconnect();
|
|
942
|
+
this._status.innerHTML = '<p>Visas som diagram</p>';
|
|
943
|
+
linear.select(this._host).select('.tableButton').style('display', null);
|
|
944
|
+
linear.select(this._host).select('.chartButton').style('display', 'none');
|
|
945
|
+
event.target.previousSibling.lastChild.focus();
|
|
946
|
+
const table = linear.select(this._tableDiv);
|
|
947
|
+
table
|
|
948
|
+
.style('opacity', 1)
|
|
949
|
+
.transition()
|
|
950
|
+
.duration(150)
|
|
951
|
+
.style('opacity', 0)
|
|
952
|
+
.on('end', () => {
|
|
953
|
+
table.style('display', 'none');
|
|
954
|
+
this.initChain();
|
|
955
|
+
this._svg
|
|
956
|
+
.attr('opacity', 0)
|
|
957
|
+
.transition()
|
|
958
|
+
.duration(150)
|
|
959
|
+
.attr('opacity', 1);
|
|
960
|
+
});
|
|
961
|
+
};
|
|
962
|
+
this.afVariation = typographyVariation_enum.BarChartVariation.Vertical;
|
|
963
|
+
this.afHeadingLevel = 'h3';
|
|
964
|
+
this.afId = randomIdGenerator_util.randomIdGenerator('tooltip');
|
|
965
|
+
this.afChartData = undefined;
|
|
966
|
+
}
|
|
967
|
+
afChartDataUpdate(data) {
|
|
968
|
+
if (typeof data != 'string')
|
|
969
|
+
this._chartData = data;
|
|
970
|
+
else
|
|
971
|
+
this._chartData = JSON.parse(data);
|
|
972
|
+
this.mappedData = this.reshapeData();
|
|
973
|
+
// checking for width of each tick
|
|
974
|
+
this.mappedData.forEach((elem) => {
|
|
975
|
+
if (elem.series.length > this.dataWidth)
|
|
976
|
+
this.dataWidth = elem.series.length;
|
|
977
|
+
});
|
|
978
|
+
if (this.dataWidth > 1)
|
|
979
|
+
this.barGap = 1;
|
|
980
|
+
}
|
|
981
|
+
initSvg() {
|
|
982
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
983
|
+
// Fetch number formatting
|
|
984
|
+
this._numberFormat = {
|
|
985
|
+
maximumSignificantDigits: (_c = (_b = (_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.labelProperties) === null || _c === void 0 ? void 0 : _c.significantDigits,
|
|
986
|
+
notation: ((_f = (_e = (_d = this._chartData) === null || _d === void 0 ? void 0 : _d.meta) === null || _e === void 0 ? void 0 : _e.labelProperties) === null || _f === void 0 ? void 0 : _f.shortHand)
|
|
987
|
+
? 'compact'
|
|
988
|
+
: 'standard'
|
|
989
|
+
};
|
|
990
|
+
linear.select(this._chartDiv).select('svg').remove();
|
|
991
|
+
this._maxHeight = (_g = linear.select(this._host)
|
|
992
|
+
.node()
|
|
993
|
+
.parentNode) === null || _g === void 0 ? void 0 : _g.getBoundingClientRect().height;
|
|
994
|
+
this.barChartObserver.observe(this._chartDiv);
|
|
995
|
+
// Getting rem-size
|
|
996
|
+
this._rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
997
|
+
this.setMinMax();
|
|
998
|
+
this.setDims();
|
|
999
|
+
this.setMargins();
|
|
1000
|
+
// Appending svg
|
|
1001
|
+
this._svg = linear.select(this._chartDiv)
|
|
1002
|
+
.append('svg')
|
|
1003
|
+
.attr('aria-hidden', true)
|
|
1004
|
+
.attr('role', 'img')
|
|
1005
|
+
.attr('aria-label', this._chartData && this._chartData.title
|
|
1006
|
+
? 'Stapeldiagram om ' + this._chartData.title.toLowerCase()
|
|
1007
|
+
: 'Stapeldiagram');
|
|
1008
|
+
this._svg.attr('width', this._dims.width).attr('height', this._dims.height);
|
|
1009
|
+
}
|
|
1010
|
+
initToolTip() {
|
|
1011
|
+
// Getting handle for tooltip
|
|
1012
|
+
this._tooltip = linear.select('#' + this.afId);
|
|
1013
|
+
this._tooltip.select('.close').on('click', this.closeTooltip);
|
|
1014
|
+
this._tooltipHeading =
|
|
1015
|
+
'h' + (parseInt(this.afHeadingLevel.replace(/\D/g, '')) + 1); // increment heading level by one
|
|
1016
|
+
// Add heading placeholder for heading
|
|
1017
|
+
this._tooltip
|
|
1018
|
+
.selectAll('.tooltipBody')
|
|
1019
|
+
.append(this._tooltipHeading)
|
|
1020
|
+
.attr('class', 'tooltipHeading') // Adding class to try to dodge global css classes
|
|
1021
|
+
.style('font-size', '1rem')
|
|
1022
|
+
.style('margin', '0 0.75rem')
|
|
1023
|
+
.style('font-weight', '500');
|
|
1024
|
+
}
|
|
1025
|
+
initEmpty() {
|
|
1026
|
+
linear.select(this._chartDiv).select('svg').remove();
|
|
1027
|
+
this._maxHeight = linear.select(this._host)
|
|
1028
|
+
.node()
|
|
1029
|
+
.parentNode.getBoundingClientRect().height;
|
|
1030
|
+
this.barChartObserver.observe(this._chartDiv);
|
|
1031
|
+
// Getting rem-size
|
|
1032
|
+
this._rem = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
1033
|
+
//this.setMinMax();
|
|
1034
|
+
this.setDims();
|
|
1035
|
+
this.setMargins();
|
|
1036
|
+
// Appending svg
|
|
1037
|
+
this._svg = linear.select(this._chartDiv)
|
|
1038
|
+
.append('svg')
|
|
1039
|
+
.attr('aria-hidden', true)
|
|
1040
|
+
.attr('role', 'img')
|
|
1041
|
+
.attr('aria-label', this._chartData && this._chartData.title
|
|
1042
|
+
? 'Stapeldiagram om ' + this._chartData.title.toLowerCase()
|
|
1043
|
+
: 'Stapeldiagram');
|
|
1044
|
+
this._svg.attr('width', this._dims.width).attr('height', this._dims.height);
|
|
1045
|
+
// Hide unusable components
|
|
1046
|
+
linear.select(this._titleDiv)
|
|
1047
|
+
.select(this.afHeadingLevel)
|
|
1048
|
+
.html(`${text._t.loading}...`);
|
|
1049
|
+
this.initYAxis(true);
|
|
1050
|
+
this.initXAxis(true);
|
|
1051
|
+
this.loadingState(true);
|
|
1052
|
+
}
|
|
1053
|
+
loadingState(empty) {
|
|
1054
|
+
this._loading = true;
|
|
1055
|
+
// close potentially open tooltip
|
|
1056
|
+
if (this._tooltip)
|
|
1057
|
+
this.closeTooltip();
|
|
1058
|
+
linear.select(this._host).select('.tableButton').style('display', 'none');
|
|
1059
|
+
const newHeight = this.setDims();
|
|
1060
|
+
this.transitionTitle();
|
|
1061
|
+
this._xAxisHandle.selectAll('.tick').remove();
|
|
1062
|
+
this._xAxisHandle.select('path').remove();
|
|
1063
|
+
this._svg
|
|
1064
|
+
.transition()
|
|
1065
|
+
.duration(400)
|
|
1066
|
+
.attr('width', this._dims.width)
|
|
1067
|
+
.attr('height', this._dims.height)
|
|
1068
|
+
.attr('aria-label', this._chartData && this._chartData.title
|
|
1069
|
+
? 'Stapeldiagram om ' + this._chartData.title.toLowerCase()
|
|
1070
|
+
: 'Stapeldiagram');
|
|
1071
|
+
this.setMargins(true);
|
|
1072
|
+
linear.select(this._titleDiv)
|
|
1073
|
+
.select(this.afHeadingLevel)
|
|
1074
|
+
.html(`${text._t.loading}...`);
|
|
1075
|
+
// Waiting with observing for changes until transition to regular bars is complete
|
|
1076
|
+
this._barChartContainer
|
|
1077
|
+
.transition('position')
|
|
1078
|
+
.duration(this.defaultDuration)
|
|
1079
|
+
.ease(linear.polyInOut)
|
|
1080
|
+
.attr('transform', `translate(${this._margin.left + this.tickPadding + this.yTickSize},0)`);
|
|
1081
|
+
// If there is a new height
|
|
1082
|
+
if (newHeight) {
|
|
1083
|
+
// Update y-axis with potentially new height (might want to do a check here)
|
|
1084
|
+
this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
1085
|
+
? this._yScale.range([
|
|
1086
|
+
this._margin.top,
|
|
1087
|
+
this._dims.height - this._margin.bottom
|
|
1088
|
+
])
|
|
1089
|
+
: this._yScale.range([
|
|
1090
|
+
this._dims.height - this._margin.bottom,
|
|
1091
|
+
this._margin.top
|
|
1092
|
+
]);
|
|
1093
|
+
this._xAxisHandle.attr('transform', `translate(0,${this._dims.height - this._margin.bottom})`);
|
|
1094
|
+
}
|
|
1095
|
+
const animateBars = () => {
|
|
1096
|
+
this._barChartContainer.selectAll('.barGroup').remove();
|
|
1097
|
+
this._barSelection = this._barChartContainer
|
|
1098
|
+
.selectAll('barGroup')
|
|
1099
|
+
.data(this.mappedData)
|
|
1100
|
+
.join('g')
|
|
1101
|
+
.attr('class', 'barGroup')
|
|
1102
|
+
.attr('id', (d) => 'barGroup' + d.key.replace(/[^A-Z0-9]+/gi, '_'))
|
|
1103
|
+
.append('rect')
|
|
1104
|
+
.attr('class', 'bar')
|
|
1105
|
+
.style('cursor', 'pointer');
|
|
1106
|
+
this._barSelection
|
|
1107
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
1108
|
+
? this._yScale(d.key)
|
|
1109
|
+
: this._dims.height - this._margin.bottom)
|
|
1110
|
+
.attr('x', this.xFunction)
|
|
1111
|
+
.attr('ry', 4)
|
|
1112
|
+
.attr('rx', 4)
|
|
1113
|
+
.attr('width', this.widthFunction)
|
|
1114
|
+
.attr('height', () => 0)
|
|
1115
|
+
.attr('fill', 'gray')
|
|
1116
|
+
.transition()
|
|
1117
|
+
.duration(400)
|
|
1118
|
+
.delay((...[, i]) => i * 150)
|
|
1119
|
+
.attr('y', this.yFunction)
|
|
1120
|
+
.attr('height', this.heightFunction);
|
|
1121
|
+
this._barSelection
|
|
1122
|
+
.transition()
|
|
1123
|
+
.duration(400)
|
|
1124
|
+
.ease(linear.linear$1)
|
|
1125
|
+
.delay((...[, i]) => i * 150 + 400)
|
|
1126
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
1127
|
+
? this._yScale(d.key)
|
|
1128
|
+
: this._dims.height - this._margin.bottom)
|
|
1129
|
+
.attr('height', () => 0)
|
|
1130
|
+
.on('end', (...[, i]) => {
|
|
1131
|
+
if (i === this._placeholderTicks.length - 1)
|
|
1132
|
+
animateBars();
|
|
1133
|
+
});
|
|
1134
|
+
};
|
|
1135
|
+
const flattenBars = () => {
|
|
1136
|
+
this._barChartContainer
|
|
1137
|
+
.selectAll('rect')
|
|
1138
|
+
.transition()
|
|
1139
|
+
.duration(200)
|
|
1140
|
+
.ease(linear.linear$1)
|
|
1141
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
1142
|
+
? this._yScale(d.key)
|
|
1143
|
+
: this._dims.height - this._margin.bottom)
|
|
1144
|
+
.attr('height', () => 0)
|
|
1145
|
+
.on('end', (...[, i]) => {
|
|
1146
|
+
if (i != 0)
|
|
1147
|
+
return;
|
|
1148
|
+
this.setYScale(true);
|
|
1149
|
+
this.setValueTicks();
|
|
1150
|
+
this.setXScale(true);
|
|
1151
|
+
this.barChartObserver.observe(this._chartDiv);
|
|
1152
|
+
animateBars();
|
|
1153
|
+
});
|
|
1154
|
+
};
|
|
1155
|
+
if (empty)
|
|
1156
|
+
animateBars();
|
|
1157
|
+
else
|
|
1158
|
+
flattenBars();
|
|
1159
|
+
}
|
|
1160
|
+
transitionTitle() {
|
|
1161
|
+
const height = linear.select(this._titleDiv).style('height');
|
|
1162
|
+
linear.select(this._titleDiv)
|
|
1163
|
+
.style('height', this._prevHeight)
|
|
1164
|
+
.transition('adjust')
|
|
1165
|
+
.duration(400)
|
|
1166
|
+
.style('height', height)
|
|
1167
|
+
.on('end', () => linear.select(this._titleDiv).style('height', null));
|
|
1168
|
+
}
|
|
1169
|
+
initYAxis(empty) {
|
|
1170
|
+
this.setYScale(empty);
|
|
1171
|
+
this._barChartContainer = this._svg
|
|
1172
|
+
.append('g')
|
|
1173
|
+
.attr('transform', `translate(${this._margin.left + this.tickPadding + this.yTickSize},0)`);
|
|
1174
|
+
this._yAxisHandle = this._barChartContainer.append('g');
|
|
1175
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal) {
|
|
1176
|
+
this.tickSizes();
|
|
1177
|
+
this.setNamedTicks();
|
|
1178
|
+
this.setTickInteraction();
|
|
1179
|
+
}
|
|
1180
|
+
else
|
|
1181
|
+
this.setValueTicks();
|
|
1182
|
+
}
|
|
1183
|
+
// Sets the largest and smallest value from series 0, Should only be used when not loading
|
|
1184
|
+
setMinMax() {
|
|
1185
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1186
|
+
const max = linear.max((_a = this._chartData) === null || _a === void 0 ? void 0 : _a.data.series[0].yValues)
|
|
1187
|
+
? linear.max((_b = this._chartData) === null || _b === void 0 ? void 0 : _b.data.series[0].yValues)
|
|
1188
|
+
: 0;
|
|
1189
|
+
const min = linear.min([0, linear.min((_c = this._chartData) === null || _c === void 0 ? void 0 : _c.data.series[0].yValues)])
|
|
1190
|
+
? linear.min([0, linear.min((_d = this._chartData) === null || _d === void 0 ? void 0 : _d.data.series[0].yValues)])
|
|
1191
|
+
: 0;
|
|
1192
|
+
this._maxVal = max;
|
|
1193
|
+
this._minVal = min;
|
|
1194
|
+
this._tempScale = linear.linear()
|
|
1195
|
+
.domain([this._minVal, this._maxVal])
|
|
1196
|
+
.nice(((_f = (_e = this._chartData) === null || _e === void 0 ? void 0 : _e.meta) === null || _f === void 0 ? void 0 : _f.numberOfReferenceLines)
|
|
1197
|
+
? (_g = this._chartData) === null || _g === void 0 ? void 0 : _g.meta.numberOfReferenceLines
|
|
1198
|
+
: 3)
|
|
1199
|
+
.domain();
|
|
1200
|
+
}
|
|
1201
|
+
// Setting up x-axis, getting margin.right in this function
|
|
1202
|
+
initXAxis(empty) {
|
|
1203
|
+
this.setXScale(empty);
|
|
1204
|
+
this._xAxisHandle = this._barChartContainer
|
|
1205
|
+
.append('g')
|
|
1206
|
+
.attr('transform', `translate(0,${this._dims.height - this._margin.bottom})`);
|
|
1207
|
+
if (this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal) {
|
|
1208
|
+
this.setValueTicks();
|
|
1209
|
+
// Removing first tick, because it aligns with y-axis domain
|
|
1210
|
+
//this._xAxisHandle.select('.tick').select('line').remove();
|
|
1211
|
+
}
|
|
1212
|
+
else {
|
|
1213
|
+
if (!empty) {
|
|
1214
|
+
this.tickSizes();
|
|
1215
|
+
this.setNamedTicks();
|
|
1216
|
+
this.setTickInteraction();
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
// Initializing bars, can only handle one series of bars for now
|
|
1221
|
+
initBars() {
|
|
1222
|
+
this._barSelection = this._barChartContainer
|
|
1223
|
+
.selectAll('barGroup')
|
|
1224
|
+
.data(this.mappedData)
|
|
1225
|
+
.join('g')
|
|
1226
|
+
.attr('class', 'barGroup')
|
|
1227
|
+
.attr('id', (d) => {
|
|
1228
|
+
return 'barGroup' + d.key.replace(/[^A-Z0-9]+/gi, '_');
|
|
1229
|
+
});
|
|
1230
|
+
this._barSelection.selectAll('.barGroup')
|
|
1231
|
+
.data((d) => {
|
|
1232
|
+
return d.series;
|
|
1233
|
+
})
|
|
1234
|
+
.join('rect')
|
|
1235
|
+
.attr('class', 'bar')
|
|
1236
|
+
.style('cursor', 'pointer')
|
|
1237
|
+
.attr('x', this.xFunction)
|
|
1238
|
+
.attr('y', this.yFunction)
|
|
1239
|
+
.attr('ry', 4)
|
|
1240
|
+
.attr('rx', 4)
|
|
1241
|
+
.attr('width', this.widthFunction)
|
|
1242
|
+
.attr('height', this.heightFunction)
|
|
1243
|
+
.attr('fill', (d) => this.colorFunction(d.serie))
|
|
1244
|
+
.on('mouseenter', this.hover)
|
|
1245
|
+
.on('mouseleave', this.hoverOut)
|
|
1246
|
+
.on('click', this.openTooltip);
|
|
1247
|
+
}
|
|
1248
|
+
initBarText() {
|
|
1249
|
+
var _a, _b;
|
|
1250
|
+
if (!((_b = (_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.valueLabels))
|
|
1251
|
+
return;
|
|
1252
|
+
this._textSelection = this._barChartContainer
|
|
1253
|
+
.selectAll('.barGroup')
|
|
1254
|
+
.append('text');
|
|
1255
|
+
this._textSelection
|
|
1256
|
+
.text((d) => {
|
|
1257
|
+
return d.value ? d.value.toLocaleString(undefined, this._numberFormat) : undefined;
|
|
1258
|
+
})
|
|
1259
|
+
.attr('class', 'barText')
|
|
1260
|
+
.attr('font-size', this.fontSize)
|
|
1261
|
+
.attr('font-weight', '600')
|
|
1262
|
+
.attr('text-anchor', 'end')
|
|
1263
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
1264
|
+
? this._yScale(d.key) + this._yScale.bandwidth() / 2
|
|
1265
|
+
: this._yScale(d.value))
|
|
1266
|
+
.attr('x', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
1267
|
+
? this._xScale(d)
|
|
1268
|
+
: this._xScale(d.key) + this._xScale.bandwidth())
|
|
1269
|
+
.attr('dy', () => this.afVariation == typographyVariation_enum.BarChartVariation.Horizontal ? '0.35em' : '-0.25em')
|
|
1270
|
+
.style('pointer-events', 'none')
|
|
1271
|
+
.style('display', () => { var _a, _b; return ((_b = (_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.valueLabels) ? null : 'none'; });
|
|
1272
|
+
this.adjustBarText();
|
|
1273
|
+
}
|
|
1274
|
+
initChain() {
|
|
1275
|
+
this.initSvg();
|
|
1276
|
+
this.initToolTip();
|
|
1277
|
+
this.initYAxis();
|
|
1278
|
+
this.initXAxis();
|
|
1279
|
+
this.initBars();
|
|
1280
|
+
this.initBarText();
|
|
1281
|
+
}
|
|
1282
|
+
async updateChain() {
|
|
1283
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1284
|
+
// Fetch number formatting
|
|
1285
|
+
this._numberFormat = {
|
|
1286
|
+
maximumSignificantDigits: (_c = (_b = (_a = this._chartData) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.labelProperties) === null || _c === void 0 ? void 0 : _c.significantDigits,
|
|
1287
|
+
notation: ((_f = (_e = (_d = this._chartData) === null || _d === void 0 ? void 0 : _d.meta) === null || _e === void 0 ? void 0 : _e.labelProperties) === null || _f === void 0 ? void 0 : _f.shortHand)
|
|
1288
|
+
? 'compact'
|
|
1289
|
+
: 'standard'
|
|
1290
|
+
};
|
|
1291
|
+
if (this._tooltip)
|
|
1292
|
+
this.closeTooltip();
|
|
1293
|
+
// Check whether we are in table mode or not
|
|
1294
|
+
if (this._tableDiv.style['display'] == 'block') {
|
|
1295
|
+
if (!this._chartData.title) {
|
|
1296
|
+
linear.select(this._titleDiv)
|
|
1297
|
+
.select(this.afHeadingLevel)
|
|
1298
|
+
.html(`${text._t.loading}...`);
|
|
1299
|
+
}
|
|
1300
|
+
else {
|
|
1301
|
+
this.setTableContent();
|
|
1302
|
+
this.setTableDimensions();
|
|
1303
|
+
}
|
|
1304
|
+
this.transitionTitle();
|
|
1305
|
+
}
|
|
1306
|
+
else {
|
|
1307
|
+
// displaying legend again
|
|
1308
|
+
if (this._loading) {
|
|
1309
|
+
linear.select(this._host).select('.tableButton').style('display', null);
|
|
1310
|
+
linear.select(this._legendDiv).style('display', null);
|
|
1311
|
+
this.initToolTip();
|
|
1312
|
+
}
|
|
1313
|
+
// Disconnect resize observer while adjusting things
|
|
1314
|
+
this.barChartObserver.disconnect();
|
|
1315
|
+
this.setMinMax();
|
|
1316
|
+
const newHeight = this.setDims();
|
|
1317
|
+
this.transitionTitle();
|
|
1318
|
+
this._svg
|
|
1319
|
+
.transition()
|
|
1320
|
+
.duration(400)
|
|
1321
|
+
.attr('width', this._dims.width)
|
|
1322
|
+
.attr('height', this._dims.height)
|
|
1323
|
+
.attr('aria-label', this._chartData && this._chartData.title
|
|
1324
|
+
? 'Stapeldiagram om ' + this._chartData.title.toLowerCase()
|
|
1325
|
+
: 'Stapeldiagram');
|
|
1326
|
+
this.setMargins();
|
|
1327
|
+
// Waiting with observing for changes until transition to regular bars is complete
|
|
1328
|
+
this._barChartContainer
|
|
1329
|
+
.transition('position')
|
|
1330
|
+
.duration(this.defaultDuration)
|
|
1331
|
+
.ease(linear.polyInOut)
|
|
1332
|
+
.attr('transform', `translate(${this._margin.left + this.tickPadding + this.yTickSize},0)`);
|
|
1333
|
+
if (!this._loading)
|
|
1334
|
+
this._barChartContainer.on('end', () => this.barChartObserver.observe(this._chartDiv));
|
|
1335
|
+
// If there is a new height
|
|
1336
|
+
if (newHeight) {
|
|
1337
|
+
// Update y-axis with potentially new height (might want to do a check here)
|
|
1338
|
+
this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
1339
|
+
? this._yScale.range([
|
|
1340
|
+
this._margin.top,
|
|
1341
|
+
this._dims.height - this._margin.bottom
|
|
1342
|
+
])
|
|
1343
|
+
: this._yScale.range([
|
|
1344
|
+
this._dims.height - this._margin.bottom,
|
|
1345
|
+
this._margin.top
|
|
1346
|
+
]);
|
|
1347
|
+
this._xAxisHandle.attr('transform', `translate(0,${this._dims.height - this._margin.bottom})`);
|
|
1348
|
+
}
|
|
1349
|
+
this.tickSizes();
|
|
1350
|
+
this.setYScale();
|
|
1351
|
+
this.setXScale();
|
|
1352
|
+
this.setTickInteraction();
|
|
1353
|
+
this._tickWidth = this.getLargestText(this.afVariation == typographyVariation_enum.BarChartVariation.Horizontal
|
|
1354
|
+
? this._xScale.ticks().map((tick) => tick.toLocaleString())
|
|
1355
|
+
: this._yScale.ticks().map((tick) => tick.toLocaleString()));
|
|
1356
|
+
this.setValueTicks(true);
|
|
1357
|
+
if (this._loading) {
|
|
1358
|
+
linear.select(this._legendDiv)
|
|
1359
|
+
.style('opacity', 0)
|
|
1360
|
+
.transition()
|
|
1361
|
+
.duration(400)
|
|
1362
|
+
.ease(linear.polyInOut)
|
|
1363
|
+
.style('opacity', 1);
|
|
1364
|
+
this._margin.right =
|
|
1365
|
+
this.getTextSize(this._xScale.domain()[1].toLocaleString()) / 2 +
|
|
1366
|
+
this.yTickSize +
|
|
1367
|
+
this.tickPadding;
|
|
1368
|
+
// Update x-axis with new width
|
|
1369
|
+
this._xScale.range([
|
|
1370
|
+
0,
|
|
1371
|
+
this._dims.width - this._margin.right - this._margin.left
|
|
1372
|
+
]);
|
|
1373
|
+
this.setNamedTicks(true);
|
|
1374
|
+
// Stop animation
|
|
1375
|
+
this._barSelection.selectAll('.barGroup').on('end', null);
|
|
1376
|
+
this._loading = false;
|
|
1377
|
+
this._barSelection
|
|
1378
|
+
.transition()
|
|
1379
|
+
.duration(this.defaultDuration)
|
|
1380
|
+
.attr('y', (d) => this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
1381
|
+
? this._yScale(d.key)
|
|
1382
|
+
: this._dims.height - this._margin.bottom)
|
|
1383
|
+
.attr('height', () => 0)
|
|
1384
|
+
.on('end', (...[, i]) => i === this._placeholderTicks.length - 1
|
|
1385
|
+
? this.updateBars(true)
|
|
1386
|
+
: null);
|
|
1387
|
+
this.setTickInteraction();
|
|
1388
|
+
}
|
|
1389
|
+
else {
|
|
1390
|
+
this.setNamedTicks(true);
|
|
1391
|
+
// Removing first tick, because it aligns with y-axis domain
|
|
1392
|
+
this.updateBars();
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
// Getting correct color given index or name of data serie
|
|
1397
|
+
colorFunction(input) {
|
|
1398
|
+
if (typeof input === 'number')
|
|
1399
|
+
return `var(${this.colorPalettes[input]})`;
|
|
1400
|
+
else {
|
|
1401
|
+
const index = this._chartData.data.series.findIndex((serie) => serie.title === input);
|
|
1402
|
+
if (index > 0)
|
|
1403
|
+
return `var(${this.colorPalettes[index]})`;
|
|
1404
|
+
else
|
|
1405
|
+
return `var(${this.colorPalettes[0]})`;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
// Resizing bar chart
|
|
1409
|
+
resize() {
|
|
1410
|
+
var _a;
|
|
1411
|
+
const newHeight = this.setDims();
|
|
1412
|
+
this.setMargins();
|
|
1413
|
+
(_a = this._svg) === null || _a === void 0 ? void 0 : _a.attr('width', this._dims.width).attr('height', this._dims.height);
|
|
1414
|
+
this._barChartContainer.attr('transform', `translate(${this._margin.left + this.tickPadding + this.yTickSize},0)`);
|
|
1415
|
+
this._margin.right =
|
|
1416
|
+
this.getTextSize(this._xScale.domain()[1].toLocaleString()) / 2 +
|
|
1417
|
+
this.yTickSize +
|
|
1418
|
+
this.tickPadding;
|
|
1419
|
+
// If there is a new height
|
|
1420
|
+
if (newHeight) {
|
|
1421
|
+
// Update y-axis with potentially new height (might want to do a check here)
|
|
1422
|
+
this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal
|
|
1423
|
+
? this._yScale.range([
|
|
1424
|
+
this._margin.top,
|
|
1425
|
+
this._dims.height - this._margin.bottom
|
|
1426
|
+
])
|
|
1427
|
+
: this._yScale.range([
|
|
1428
|
+
this._dims.height - this._margin.bottom,
|
|
1429
|
+
this._margin.top
|
|
1430
|
+
]);
|
|
1431
|
+
this._xAxisHandle.attr('transform', `translate(0,${this._dims.height - this._margin.bottom})`);
|
|
1432
|
+
}
|
|
1433
|
+
// Update x-axis with new width
|
|
1434
|
+
this._xScale.range([
|
|
1435
|
+
0,
|
|
1436
|
+
this._dims.width - this._margin.right - this._margin.left
|
|
1437
|
+
]);
|
|
1438
|
+
this.setNamedTicks();
|
|
1439
|
+
this.setValueTicks();
|
|
1440
|
+
this.adjustBarSize();
|
|
1441
|
+
this.adjustBarText();
|
|
1442
|
+
if (this._tooltipData)
|
|
1443
|
+
this.positionTooltip(this._tooltipData);
|
|
1444
|
+
}
|
|
1445
|
+
// Returns the longest text from an array of strings
|
|
1446
|
+
getLargestText(array) {
|
|
1447
|
+
let width = 0;
|
|
1448
|
+
array.forEach((elem) => {
|
|
1449
|
+
const temp = this.getTextSize(elem);
|
|
1450
|
+
if (temp > width) {
|
|
1451
|
+
width = temp;
|
|
1452
|
+
}
|
|
1453
|
+
});
|
|
1454
|
+
return width;
|
|
1455
|
+
}
|
|
1456
|
+
componentWillLoad() {
|
|
1457
|
+
this.afChartDataUpdate(this.afChartData);
|
|
1458
|
+
}
|
|
1459
|
+
componentDidLoad() {
|
|
1460
|
+
if (!this._chartData || Object.keys(this._chartData).length === 0) {
|
|
1461
|
+
this._loading = true;
|
|
1462
|
+
return this.initEmpty();
|
|
1463
|
+
}
|
|
1464
|
+
this.initChain();
|
|
1465
|
+
document.fonts.ready.then(() => {
|
|
1466
|
+
this.recomputeTextSize();
|
|
1467
|
+
this.setNamedTicks();
|
|
1468
|
+
this._barChartContainer.attr('transform', `translate(${this._margin.left + this.tickPadding + this.yTickSize},0)`);
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
disconnectedCallback() {
|
|
1472
|
+
this.barChartObserver.disconnect();
|
|
1473
|
+
}
|
|
1474
|
+
componentWillUpdate() {
|
|
1475
|
+
this._prevHeight = linear.select(this._titleDiv).style('height');
|
|
1476
|
+
}
|
|
1477
|
+
componentDidUpdate() {
|
|
1478
|
+
if (this._tableDiv.style['display'] != 'block' &&
|
|
1479
|
+
Object.keys(this._chartData).length === 0) {
|
|
1480
|
+
// Disconnect old barchartobserver while doing resizing
|
|
1481
|
+
this.barChartObserver.disconnect();
|
|
1482
|
+
return this.loadingState();
|
|
1483
|
+
}
|
|
1484
|
+
this.updateChain();
|
|
1485
|
+
}
|
|
1486
|
+
// Not currently used
|
|
1487
|
+
/*get cssModifiers() {
|
|
1488
|
+
return {
|
|
1489
|
+
'digi-bar-chart--vertical': this.afVariation == 'vertical',
|
|
1490
|
+
'digi-bar-chart--horizontal': this.afVariation == 'horizontal'
|
|
1491
|
+
};
|
|
1492
|
+
}*/
|
|
1493
|
+
// Returns pixelwidth of text given the current fontSize (costly function using .each)
|
|
1494
|
+
getTextSize(text) {
|
|
1495
|
+
const textWidth = [];
|
|
1496
|
+
const svg = linear.select(this._chartDiv).append('svg');
|
|
1497
|
+
svg
|
|
1498
|
+
.selectAll('dummyText')
|
|
1499
|
+
.data([text])
|
|
1500
|
+
.join('text')
|
|
1501
|
+
.attr('font-size', this.fontSize) // <- using 1rem here whereas default is 0.875rem
|
|
1502
|
+
.text((d) => d)
|
|
1503
|
+
.each((...[, i, nodelist]) => {
|
|
1504
|
+
const thisWidth = nodelist[i].getComputedTextLength();
|
|
1505
|
+
textWidth.push(thisWidth);
|
|
1506
|
+
nodelist[i].remove();
|
|
1507
|
+
});
|
|
1508
|
+
svg.remove().exit();
|
|
1509
|
+
return textWidth[0];
|
|
1510
|
+
}
|
|
1511
|
+
// Setting table content from this._chartData
|
|
1512
|
+
setTableContent() {
|
|
1513
|
+
this._tableDiv.innerHTML = `<digi-table af-size="small" af-variation="primary"> <table><caption>${this._chartData.title}</caption><thead><tr>${this.headings()}</tr></thead><tbody>${this.tableBody()}</tbody></table></digi-table>`;
|
|
1514
|
+
}
|
|
1515
|
+
setTableDimensions() {
|
|
1516
|
+
const table = linear.select(this._tableDiv);
|
|
1517
|
+
table
|
|
1518
|
+
// The last value is for compensating the padding set on the table element, changing padding in css, will need change in these two lines
|
|
1519
|
+
.style('height', this._dims.height + 'px');
|
|
1520
|
+
table.style('width', this._dims.width - this._rem * 0.65 + 'px');
|
|
1521
|
+
}
|
|
1522
|
+
// Extracting all headings from data and returning a string with <th>-elements with headings
|
|
1523
|
+
headings() {
|
|
1524
|
+
let headingsString = `<th scope="col">${this._chartData.x}</th>`;
|
|
1525
|
+
this._chartData.data.series.forEach((elem) => {
|
|
1526
|
+
headingsString = headingsString.concat(`<th scope="col">${elem.title}</th>`);
|
|
1527
|
+
});
|
|
1528
|
+
return headingsString;
|
|
1529
|
+
}
|
|
1530
|
+
// Building the table body
|
|
1531
|
+
tableBody() {
|
|
1532
|
+
let body = '';
|
|
1533
|
+
if (this._chartData && this._chartData.data) {
|
|
1534
|
+
const loopable = this._chartData.data.xValueNames
|
|
1535
|
+
? this._chartData.data.xValueNames
|
|
1536
|
+
: this._chartData.data.xValues;
|
|
1537
|
+
loopable.forEach((elem, index) => {
|
|
1538
|
+
let cells = '';
|
|
1539
|
+
this._chartData.data.series.forEach((serie) => {
|
|
1540
|
+
cells = cells.concat(`<td>${serie.yValues[index] != null ? serie.yValues[index].toLocaleString() : '-'}</td>`);
|
|
1541
|
+
});
|
|
1542
|
+
body = body.concat(`<tr><th scope='row'>${elem}${cells}</th></tr>`);
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
return body;
|
|
1546
|
+
}
|
|
1547
|
+
render() {
|
|
1548
|
+
var _a, _b, _c, _d, _e;
|
|
1549
|
+
// Setting header
|
|
1550
|
+
let heading = '';
|
|
1551
|
+
if (this._chartData) {
|
|
1552
|
+
if (!this._chartData.subTitle)
|
|
1553
|
+
heading = `<${this.afHeadingLevel}>${this._chartData.title}</${this.afHeadingLevel}>`;
|
|
1554
|
+
else {
|
|
1555
|
+
if (!this._chartData.infoText)
|
|
1556
|
+
heading = `<${this.afHeadingLevel}>${this._chartData.title}</${this.afHeadingLevel}><p>${this._chartData.subTitle}</p>`;
|
|
1557
|
+
else
|
|
1558
|
+
heading = `<${this.afHeadingLevel}>${this._chartData.title}</${this.afHeadingLevel}><p>${(_a = this._chartData) === null || _a === void 0 ? void 0 : _a.subTitle}
|
|
1559
|
+
<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></p>`;
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
return (index.h(index.Host, { key: 'a1e4aaa788766d54c691e95b7e70932b0e7d2b05', ref: (el) => (this._host = el) }, index.h("div", { key: '2fac926d196acaa20ab5f438968e3c98c08dd104', class: "topWrapper", ref: (el) => (this._titleDiv = el) }, index.h("digi-typography", { key: '16d8cbd0f03a2a2d24d3366ab1b3eaed797dd361', class: "chartTitle", innerHTML: heading }), index.h("digi-button", { key: '22a93add4a7f1ea3965ce496f2b5cbf488b01314', class: "buttonWrapper tableButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.activateTable, afAriaLabel: `Visa tabell ${((_b = this._chartData) === null || _b === void 0 ? void 0 : _b.title) ? (_c = this._chartData) === null || _c === void 0 ? void 0 : _c.title.toLowerCase() : ''}` }, index.h("digi-icon-table", { key: '152938d206dc00e2fb88b52d332960cbeda2c045', slot: "icon" }), "Visa tabell"), index.h("digi-button", { key: '66db213ee1c4cb169c7c257853a15a468bf2a83e', style: { display: 'none' }, class: "buttonWrapper chartButton", "af-size": "medium", "af-variation": "function", "af-full-width": "false", onAfOnClick: this.reInitChart, afAriaLabel: `Visa diagram ${((_d = this._chartData) === null || _d === void 0 ? void 0 : _d.title) ? (_e = this._chartData) === null || _e === void 0 ? void 0 : _e.title.toLowerCase() : ''}` }, index.h("digi-icon-chart", { key: 'ac4b8adad6ace97f50591cd39b8b0082d067f069', slot: "icon" }), "Visa diagram"), index.h("div", { key: 'b28e00a40b5c1a2919146ec4815f23a14fdfac50', class: "scChartStatus", role: "status", ref: (el) => (this._status = el) })), index.h("div", { key: '63f80744faa1d4b3d7d62bece3b5c446eda3ae7b', class: "chartTooltip", id: this.afId }, index.h("div", { key: '8c9fa9388b9bfc071c4a594275159eb36a8ec43b', class: "tooltipBody" }), index.h("digi-icon-x", { key: '252d12a937e5276381fa40ec3bb4e77c259da9c1', class: "close" }), this.afVariation === typographyVariation_enum.BarChartVariation.Horizontal ? (index.h("digi-icon-caret-up", null)) : (index.h("digi-icon-caret-down", null))), index.h("div", { key: '9b70433c310882bd0a06784ca1fa21c5b2dd9e52', ref: (el) => (this._chartDiv = el) }, " "), index.h("div", { key: '459e38448e29eea1fa7a10de7f3f1f06b6404eab', class: "legend", ref: (el) => (this._legendDiv = el) }), index.h("div", { key: 'cc655054cb3c3688c75060ebbdf6c3f8ea4ad712', class: "table", ref: (el) => (this._tableDiv = el) }, ' ')));
|
|
1563
|
+
}
|
|
1564
|
+
get hostElement() { return index.getElement(this); }
|
|
1565
|
+
static get watchers() { return {
|
|
1566
|
+
"afChartData": ["afChartDataUpdate"]
|
|
1567
|
+
}; }
|
|
1568
|
+
};
|
|
1569
|
+
barChart.style = DigiBarChartStyle0;
|
|
1570
|
+
|
|
55
1571
|
const buttonCss = ".sc-digi-button-h{--digi--button--color--background--primary--default:var(--digi--color--background--interactive--default--primary);--digi--button--color--background--primary--hover:var(--digi--color--background--interactive--hover--primary);--digi--button--color--background--primary--focus:var(--digi--color--background--interactive--hover--primary);--digi--button--color--background--primary--active:var(--digi--color--background--interactive--hover--primary);--digi--button--color--background--secondary--default:var(--digi--color--background--interactive--default--secondary);--digi--button--color--background--secondary--hover:var(--digi--color--background--interactive--hover--secondary);--digi--button--color--background--secondary--focus:var(--digi--color--background--interactive--hover--secondary);--digi--button--color--background--secondary--active:var(--digi--color--background--interactive--hover--secondary);--digi--button--color--background--function--default:transparent;--digi--button--color--background--function--hover:transparent;--digi--button--color--background--function--focus:transparent;--digi--button--color--background--function--active:transparent;--digi--button--color--text--primary--default:var(--digi--color--text--interactive--secondary);--digi--button--color--text--primary--hover:var(--digi--color--text--interactive--secondary);--digi--button--color--text--primary--focus:var(--digi--color--text--interactive--secondary);--digi--button--color--text--primary--active:var(--digi--color--text--interactive--secondary);--digi--button--color--text--secondary--default:var(--digi--color--text--interactive--brand-primary);--digi--button--color--text--secondary--hover:var(--digi--color--text--interactive--brand-primary);--digi--button--color--text--secondary--focus:var(--digi--color--text--interactive--brand-primary);--digi--button--color--text--secondary--active:var(--digi--color--text--interactive--brand-primary);--digi--button--color--text--function--default:var(--digi--color--text--interactive--primary);--digi--button--color--text--function--hover:var(--digi--color--text--interactive--primary);--digi--button--color--text--function--focus:var(--digi--color--text--interactive--primary);--digi--button--color--text--function--active:var(--digi--color--text--interactive--primary);--digi--button--color--border--primary--default:var(--digi--color--background--interactive--default--primary);--digi--button--color--border--primary--hover:var(--digi--color--background--interactive--hover--primary);--digi--button--color--border--primary--focus:var(--digi--color--background--interactive--default--primary);--digi--button--color--border--primary--active:var(--digi--color--background--interactive--default--primary);--digi--button--color--border--secondary--default:var(--digi--color--border--interactive--default--primary);--digi--button--color--border--secondary--hover:var(--digi--color--border--interactive--hover--secondary);--digi--button--color--border--secondary--focus:var(--digi--color--border--interactive--default--primary);--digi--button--color--border--secondary--active:var(--digi--color--border--interactive--default--primary);--digi--button--color--border--function--default:initial;--digi--button--color--border--function--hover:initial;--digi--button--color--border--function--focus:initial;--digi--button--color--border--function--active:initial;--digi--button--color--icon--primary--default:var(--digi--color--icon--secondary);--digi--button--color--icon--primary--hover:var(--digi--color--icon--secondary);--digi--button--color--icon--primary--focus:var(--digi--color--icon--secondary);--digi--button--color--icon--primary--active:var(--digi--color--icon--secondary);--digi--button--color--icon--secondary--default:var(--digi--color--icon--brand-primary);--digi--button--color--icon--secondary--hover:var(--digi--color--icon--brand-primary);--digi--button--color--icon--secondary--focus:var(--digi--color--icon--brand-primary);--digi--button--color--icon--secondary--active:var(--digi--color--icon--brand-primary);--digi--button--color--icon--function--default:var(--digi--color--icon--cta);--digi--button--color--icon--function--hover:var(--digi--color--icon--cta);--digi--button--color--icon--function--focus:var(--digi--color--icon--cta);--digi--button--color--icon--function--active:var(--digi--color--icon--cta);--digi--button--border-width--primary--default:var(--digi--border-width--primary);--digi--button--border-width--primary--hover:var(--digi--border-width--primary);--digi--button--border-width--secondary--default:var(--digi--border-width--primary);--digi--button--border-width--secondary--hover:var(--digi--border-width--primary);--digi--button--border-width--function--default:initial;--digi--button--border-width--function--hover:initial;--digi--button--border-style--primary--default:var(--digi--border-style--primary);--digi--button--border-style--primary--hover:var(--digi--border-style--primary);--digi--button--border-style--primary--focus:var(--digi--border-style--primary);--digi--button--border-style--primary--active:var(--digi--border-style--primary);--digi--button--border-style--secondary--default:var(--digi--border-style--primary);--digi--button--border-style--secondary--hover:var(--digi--border-style--primary);--digi--button--border-style--secondary--focus:var(--digi--border-style--primary);--digi--button--border-style--secondary--active:var(--digi--border-style--primary);--digi--button--border-style--function--default:var(--digi--border-style--secondary);--digi--button--border-style--function--hover:var(--digi--border-style--secondary);--digi--button--border-style--function--focus:var(--digi--border-style--secondary);--digi--button--border-style--function--active:var(--digi--border-style--secondary);--digi--button--border-radius--primary--default:var(--digi--border-radius--secondary);--digi--button--border-radius--primary--hover:var(--digi--border-radius--secondary);--digi--button--border-radius--primary--focus:var(--digi--border-radius--secondary);--digi--button--border-radius--primary--active:var(--digi--border-radius--secondary);--digi--button--border-radius--secondary--default:var(--digi--border-radius--secondary);--digi--button--border-radius--secondary--hover:var(--digi--border-radius--secondary);--digi--button--border-radius--secondary--focus:var(--digi--border-radius--secondary);--digi--button--border-radius--secondary--active:var(--digi--border-radius--secondary);--digi--button--border-radius--function--default:initial;--digi--button--border-radius--function--hover:initial;--digi--button--border-radius--function--focus:initial;--digi--button--border-radius--function--active:initial;--digi--button--padding--small:var(--digi--gutter--button-block-small) var(--digi--gutter--button-inline-small);--digi--button--padding--medium:var(--digi--gutter--button-block-medium) var(--digi--gutter--button-inline-medium);--digi--button--font-size--small:var(--digi--global--typography--font-size--interaction-small);--digi--button--font-size--medium:var(--digi--global--typography--font-size--interaction-medium);--digi--button--font-family:var(--digi--global--typography--font-family--default);--digi--button--font-weight--default:var(--digi--typography--button--font-weight--desktop);--digi--button--font-weight--function:var(--digi--typography--label--font-weight--desktop);--digi--button--width:initial;--digi--button--display:initial;--digi--button--justify-content--default:initial;--digi--button--justify-content--full-width:center;--digi--button--align-items:center;--digi--button--text-align--default:initial;--digi--button--text-align--full-width:center;--digi--button--outline--default:initial;--digi--button--outline--focus:initial;--digi--button--cursor:pointer;--digi--button--icon--spacing:var(--digi--gutter--large);--digi--button--min-height--small:unset}.sc-digi-button-h .digi-button.sc-digi-button{font-family:var(--digi--button--font-family);background:var(--COLOR--BACKGROUND--DEFAULT);color:var(--COLOR--TEXT--DEFAULT);padding:var(--PADDING);border-radius:var(--BORDER-RADIUS--DEFAULT);border-width:var(--BORDER-WIDTH--DEFAULT);border-style:var(--BORDER-STYLE--DEFAULT);border-color:var(--COLOR--BORDER--DEFAULT);font-weight:var(--FONT-WEIGHT);font-size:var(--FONT-SIZE);outline:var(--digi--button--outline--default);text-align:var(--digi--button--text-align--default);width:var(--digi--button--width);display:var(--digi--button--display);justify-content:var(--digi--button--justify-content--default);cursor:var(--digi--button--cursor);min-height:var(--MIN-HEIGHT);align-items:var(--digi--button--align-items);white-space:nowrap}.sc-digi-button-h .digi-button--variation-primary.sc-digi-button{--COLOR--BACKGROUND--DEFAULT:var(--digi--button--color--background--primary--default);--COLOR--BACKGROUND--HOVER:var(--digi--button--color--background--primary--hover);--COLOR--BACKGROUND--FOCUS:var(--digi--button--color--background--primary--focus);--COLOR--BACKGROUND--ACTIVE:var(--digi--button--color--background--primary--active);--COLOR--TEXT--DEFAULT:var(--digi--button--color--text--primary--default);--COLOR--TEXT--HOVER:var(--digi--button--color--text--primary--hover);--COLOR--TEXT--FOCUS:var(--digi--button--color--text--primary--focus);--COLOR--TEXT--ACTIVE:var(--digi--button--color--text--primary--active);--COLOR--ICON--DEFAULT:var(--digi--button--color--icon--primary--default);--COLOR--ICON--HOVER:var(--digi--button--color--icon--primary--hover);--COLOR--ICON--FOCUS:var(--digi--button--color--icon--primary--focus);--COLOR--ICON--ACTIVE:var(--digi--button--color--icon--primary--active);--COLOR--BORDER--DEFAULT:var(--digi--button--color--border--primary--default);--COLOR--BORDER--HOVER:var(--digi--button--color--border--primary--hover);--COLOR--BORDER--FOCUS:var(--digi--button--color--border--primary--focus);--COLOR--BORDER--ACTIVE:var(--digi--button--color--border--primary--active);--BORDER-RADIUS--DEFAULT:var(--digi--button--border-radius--primary--default);--BORDER-RADIUS--HOVER:var(--digi--button--border-radius--primary--hover);--BORDER-RADIUS--FOCUS:var(--digi--button--border-radius--primary--focus);--BORDER-RADIUS--ACTIVE:var(--digi--button--border-radius--primary--active);--BORDER-WIDTH--DEFAULT:var(--digi--button--border-width--primary--default);--BORDER-WIDTH--HOVER:var(--digi--button--border-width--primary--hover);--BORDER-WIDTH--FOCUS:var(--digi--button--border-width--primary--focus);--BORDER-WIDTH--ACTIVE:var(--digi--button--border-width--primary--active);--BORDER-STYLE--DEFAULT:var(--digi--button--border-style--primary--default);--BORDER-STYLE--HOVER:var(--digi--button--border-style--primary--hover);--BORDER-STYLE--FOCUS:var(--digi--button--border-style--primary--focus);--BORDER-STYLE--ACTIVE:var(--digi--button--border-style--primary--active);--FONT-WEIGHT:var(--digi--button--font-weight--default)}.sc-digi-button-h .digi-button--variation-secondary.sc-digi-button{--COLOR--BACKGROUND--DEFAULT:var(--digi--button--color--background--secondary--default);--COLOR--BACKGROUND--HOVER:var(--digi--button--color--background--secondary--hover);--COLOR--BACKGROUND--FOCUS:var(--digi--button--color--background--secondary--focus);--COLOR--BACKGROUND--ACTIVE:var(--digi--button--color--background--secondary--active);--COLOR--TEXT--DEFAULT:var(--digi--button--color--text--secondary--default);--COLOR--TEXT--HOVER:var(--digi--button--color--text--secondary--hover);--COLOR--TEXT--FOCUS:var(--digi--button--color--text--secondary--focus);--COLOR--TEXT--ACTIVE:var(--digi--button--color--text--secondary--active);--COLOR--ICON--DEFAULT:var(--digi--button--color--icon--secondary--default);--COLOR--ICON--HOVER:var(--digi--button--color--icon--secondary--hover);--COLOR--ICON--FOCUS:var(--digi--button--color--icon--secondary--focus);--COLOR--ICON--ACTIVE:var(--digi--button--color--icon--secondary--active);--COLOR--BORDER--DEFAULT:var(--digi--button--color--border--secondary--default);--COLOR--BORDER--HOVER:var(--digi--button--color--border--secondary--hover);--COLOR--BORDER--FOCUS:var(--digi--button--color--border--secondary--focus);--COLOR--BORDER--ACTIVE:var(--digi--button--color--border--secondary--active);--BORDER-RADIUS--DEFAULT:var(--digi--button--border-radius--secondary--default);--BORDER-RADIUS--HOVER:var(--digi--button--border-radius--secondary--hover);--BORDER-RADIUS--FOCUS:var(--digi--button--border-radius--secondary--focus);--BORDER-RADIUS--ACTIVE:var(--digi--button--border-radius--secondary--active);--BORDER-WIDTH--DEFAULT:var(--digi--button--border-width--secondary--default);--BORDER-WIDTH--HOVER:var(--digi--button--border-width--secondary--hover);--BORDER-WIDTH--FOCUS:var(--digi--button--border-width--secondary--focus);--BORDER-WIDTH--ACTIVE:var(--digi--button--border-width--secondary--active);--BORDER-STYLE--DEFAULT:var(--digi--button--border-style--secondary--default);--BORDER-STYLE--HOVER:var(--digi--button--border-style--secondary--hover);--BORDER-STYLE--FOCUS:var(--digi--button--border-style--secondary--focus);--BORDER-STYLE--ACTIVE:var(--digi--button--border-style--secondary--active);--FONT-WEIGHT:var(--digi--button--font-weight--default)}.sc-digi-button-h .digi-button--variation-function.sc-digi-button{--COLOR--BACKGROUND--DEFAULT:var(--digi--button--color--background--function--default);--COLOR--BACKGROUND--HOVER:var(--digi--button--color--background--function--hover);--COLOR--BACKGROUND--FOCUS:var(--digi--button--color--background--function--focus);--COLOR--BACKGROUND--ACTIVE:var(--digi--button--color--background--function--active);--COLOR--TEXT--DEFAULT:var(--digi--button--color--text--function--default);--COLOR--TEXT--HOVER:var(--digi--button--color--text--function--hover);--COLOR--TEXT--FOCUS:var(--digi--button--color--text--function--focus);--COLOR--TEXT--ACTIVE:var(--digi--button--color--text--function--active);--COLOR--ICON--DEFAULT:var(--digi--button--color--icon--function--default);--COLOR--ICON--HOVER:var(--digi--button--color--icon--function--hover);--COLOR--ICON--FOCUS:var(--digi--button--color--icon--function--focus);--COLOR--ICON--ACTIVE:var(--digi--button--color--icon--function--active);--COLOR--BORDER--DEFAULT:var(--digi--button--color--border--function--default);--COLOR--BORDER--HOVER:var(--digi--button--color--border--function--hover);--COLOR--BORDER--FOCUS:var(--digi--button--color--border--function--focus);--COLOR--BORDER--ACTIVE:var(--digi--button--color--border--function--active);--BORDER-RADIUS--DEFAULT:var(--digi--button--border-radius--function--default);--BORDER-RADIUS--HOVER:var(--digi--button--border-radius--function--hover);--BORDER-RADIUS--FOCUS:var(--digi--button--border-radius--function--focus);--BORDER-RADIUS--ACTIVE:var(--digi--button--border-radius--function--active);--BORDER-WIDTH--DEFAULT:var(--digi--button--border-width--function--default);--BORDER-WIDTH--HOVER:var(--digi--button--border-width--function--hover);--BORDER-WIDTH--FOCUS:var(--digi--button--border-width--function--focus);--BORDER-WIDTH--ACTIVE:var(--digi--button--border-width--function--active);--BORDER-STYLE--DEFAULT:var(--digi--button--border-style--function--default);--BORDER-STYLE--HOVER:var(--digi--button--border-style--function--hover);--BORDER-STYLE--FOCUS:var(--digi--button--border-style--function--focus);--BORDER-STYLE--ACTIVE:var(--digi--button--border-style--function--active);--FONT-WEIGHT:var(--digi--button--font-weight--function)}.sc-digi-button-h .digi-button--variation-function.sc-digi-button:hover,.sc-digi-button-h .digi-button--variation-function.sc-digi-button:focus{text-decoration:underline}.sc-digi-button-h .digi-button--size-small.sc-digi-button{--FONT-SIZE:var(--digi--button--font-size--small);--PADDING:var(--digi--button--padding--small);--MIN-HEIGHT:var(--digi--button--min-height--small)}.sc-digi-button-h .digi-button--size-medium.sc-digi-button{--FONT-SIZE:var(--digi--button--font-size--medium);--PADDING:var(--digi--button--padding--medium);--MIN-HEIGHT:var(--digi--button--min-height--small)}.sc-digi-button-h .digi-button.sc-digi-button-s>[slot^=icon],.sc-digi-button-h .digi-button .sc-digi-button-s>[slot^=icon]{--digi--icon--height:1em;--digi--icon--width:1em;--digi--icon--color:var(--COLOR--ICON--DEFAULT);min-height:0}@media (any-hover: hover){.sc-digi-button-h .digi-button.sc-digi-button:hover{background:var(--COLOR--BACKGROUND--HOVER);border-radius:var(--BORDER-RADIUS--HOVER);border-width:var(--BORDER-WIDTH--HOVER);border-style:var(--BORDER-STYLE--HOVER);border-color:var(--COLOR--BORDER--HOVER);color:var(--COLOR--TEXT--HOVER)}.sc-digi-button-h .digi-button:hover.sc-digi-button-s>[slot^=icon],.sc-digi-button-h .digi-button:hover .sc-digi-button-s>[slot^=icon]{--digi--icon--color:var(--COLOR--ICON--HOVER)}}.sc-digi-button-h .digi-button.sc-digi-button:focus-visible{background:var(--COLOR--BACKGROUND--FOCUS);color:var(--COLOR--TEXT--FOCUS);border-style:var(--BORDER-STYLE--FOCUS);border-color:var(--COLOR--BORDER--FOCUS);outline:2px solid black;outline-offset:2px;box-shadow:0px 0px 0px 5px white}.sc-digi-button-h .digi-button:focus-visible.sc-digi-button-s>[slot^=icon],.sc-digi-button-h .digi-button:focus-visible .sc-digi-button-s>[slot^=icon]{--digi--icon--color:var(--COLOR--ICON--FOCUS)}.sc-digi-button-h .digi-button.sc-digi-button:active{background:var(--COLOR--BACKGROUND--ACTIVE);color:var(--COLOR--TEXT--ACTIVE)}.sc-digi-button-h .digi-button:active.sc-digi-button-s>[slot^=icon],.sc-digi-button-h .digi-button:active .sc-digi-button-s>[slot^=icon]{--digi--icon--color:var(--COLOR--ICON--ACTIVE)}.sc-digi-button-h .digi-button--icon.sc-digi-button,.sc-digi-button-h .digi-button--icon-secondary.sc-digi-button{--digi--button--display:flex;align-items:center;justify-content:var(--digi--button--justify-content--default);gap:var(--digi--button--icon--spacing)}.sc-digi-button-h .digi-button--full-width.sc-digi-button{--digi--button--width:100%;--digi--button--text-align--default:var(--digi--button--text-align--full-width);--digi--button--justify-content--default:var(--digi--button--justify-content--full-width)}";
|
|
56
1572
|
const DigiButtonStyle0 = buttonCss;
|
|
57
1573
|
|
|
@@ -622,6 +2138,72 @@ const IconBellFilled = class {
|
|
|
622
2138
|
};
|
|
623
2139
|
IconBellFilled.style = DigiIconBellFilledStyle0;
|
|
624
2140
|
|
|
2141
|
+
const iconCaretDownCss = ".sc-digi-icon-caret-down-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-caret-down-h svg.sc-digi-icon-caret-down{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}";
|
|
2142
|
+
const DigiIconCaretDownStyle0 = iconCaretDownCss;
|
|
2143
|
+
|
|
2144
|
+
const IconCaretDown = class {
|
|
2145
|
+
constructor(hostRef) {
|
|
2146
|
+
index.registerInstance(this, hostRef);
|
|
2147
|
+
this.afTitle = undefined;
|
|
2148
|
+
this.afDesc = undefined;
|
|
2149
|
+
this.afSvgAriaHidden = true;
|
|
2150
|
+
this.afSvgAriaLabelledby = undefined;
|
|
2151
|
+
this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
|
|
2152
|
+
}
|
|
2153
|
+
render() {
|
|
2154
|
+
return (index.h("svg", { key: '076122c58ff6050a1e284cfe4459c526e5b6bb94', class: "digi-icon-caret-down", width: "12", height: "6", viewBox: "0 0 12 6", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
|
|
2155
|
+
? this.afSvgAriaLabelledby
|
|
2156
|
+
: this.afTitle
|
|
2157
|
+
? this.titleId
|
|
2158
|
+
: undefined, xmlns: "http://www.w3.org/2000/svg" }, this.afTitle && index.h("title", { key: 'c11d1fbca067166db12a18b35fa9d36c7131e34e', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: 'eec49821572ad40f84afcee5650877c8338d3812' }, this.afDesc), index.h("path", { key: 'e4473f7f7152ff2263f80768dadc5ad6ac330a6c', class: "digi-icon-caret-down__shape", d: "M11.777.198A.608.608 0 0112 .667c0 .18-.074.336-.223.468l-5.25 4.667A.768.768 0 016 6a.768.768 0 01-.527-.198L.223 1.135A.608.608 0 010 .667C0 .487.074.33.223.197A.768.768 0 01.75 0h10.5c.203 0 .379.066.527.198z", fill: "currentColor", "fill-rule": "evenodd" })));
|
|
2159
|
+
}
|
|
2160
|
+
};
|
|
2161
|
+
IconCaretDown.style = DigiIconCaretDownStyle0;
|
|
2162
|
+
|
|
2163
|
+
const iconCaretUpCss = ".sc-digi-icon-caret-up-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-caret-up-h svg.sc-digi-icon-caret-up{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}";
|
|
2164
|
+
const DigiIconCaretUpStyle0 = iconCaretUpCss;
|
|
2165
|
+
|
|
2166
|
+
const IconCaretUp = class {
|
|
2167
|
+
constructor(hostRef) {
|
|
2168
|
+
index.registerInstance(this, hostRef);
|
|
2169
|
+
this.afTitle = undefined;
|
|
2170
|
+
this.afDesc = undefined;
|
|
2171
|
+
this.afSvgAriaHidden = true;
|
|
2172
|
+
this.afSvgAriaLabelledby = undefined;
|
|
2173
|
+
this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
|
|
2174
|
+
}
|
|
2175
|
+
render() {
|
|
2176
|
+
return (index.h("svg", { key: 'e9ace2c9103fdaf105f3b827d963f37c7a0da692', class: "digi-icon-caret-up", width: "12", height: "7", viewBox: "0 0 12 7", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
|
|
2177
|
+
? this.afSvgAriaLabelledby
|
|
2178
|
+
: this.afTitle
|
|
2179
|
+
? this.titleId
|
|
2180
|
+
: undefined, xmlns: "http://www.w3.org/2000/svg" }, this.afTitle && index.h("title", { key: '06f4956a61d900ac2ecd6f3d7e73364e084286c6', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: 'bb69acfc464160dc580771ad56724b5cda76f6f3' }, this.afDesc), index.h("path", { key: '918ba79b8ef4a7ad38da77411b12c2a4a074d977', class: "digi-icon-caret-up__shape", d: "M11.777 5.65A.608.608 0 0112 6.12c0 .18-.074.337-.223.469a.768.768 0 01-.527.198H.75a.768.768 0 01-.527-.198A.608.608 0 010 6.119c0-.18.074-.337.223-.469L5.473.984A.768.768 0 016 .786c.203 0 .379.066.527.198l5.25 4.666z", fill: "currentColor", "fill-rule": "evenodd" })));
|
|
2181
|
+
}
|
|
2182
|
+
};
|
|
2183
|
+
IconCaretUp.style = DigiIconCaretUpStyle0;
|
|
2184
|
+
|
|
2185
|
+
const iconChartCss = ".sc-digi-icon-chart-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-chart-h svg.sc-digi-icon-chart{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}";
|
|
2186
|
+
const DigiIconChartStyle0 = iconChartCss;
|
|
2187
|
+
|
|
2188
|
+
const IconChart = class {
|
|
2189
|
+
constructor(hostRef) {
|
|
2190
|
+
index.registerInstance(this, hostRef);
|
|
2191
|
+
this.afTitle = undefined;
|
|
2192
|
+
this.afDesc = undefined;
|
|
2193
|
+
this.afSvgAriaHidden = true;
|
|
2194
|
+
this.afSvgAriaLabelledby = undefined;
|
|
2195
|
+
this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
|
|
2196
|
+
}
|
|
2197
|
+
render() {
|
|
2198
|
+
return (index.h("svg", { key: '6607ae220e7df0da4e33d6e26989b0a081c9b36c', width: "56", height: "62", viewBox: "0 0 56 62", version: "1.1", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
|
|
2199
|
+
? this.afSvgAriaLabelledby
|
|
2200
|
+
: this.afTitle
|
|
2201
|
+
? this.titleId
|
|
2202
|
+
: undefined }, index.h("title", { key: 'a5a9ef19879689bc5d73b96a8e4d5e3e3648d6a5' }, "Chart"), this.afTitle && index.h("title", { key: 'e6e5af46d4d34bb3b0dcdc2c8704d483a9ed46c9', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: '6ff565844d5a595fd83767019670556bc453544a' }, this.afDesc), index.h("defs", { key: 'a1e2c022806ba193089e6f0d9f5af8767a7d228c' }, index.h("polygon", { key: '2b0d108004fc3f5aabbcf9336cfc570a9c1f0bb3', id: "path-1", points: "19.8389256 11.2318841 34.4403749 11.2318841 34.4403749 42.2318841 19.8389256 42.2318841" }), index.h("polygon", { key: '5399f0ed9826b3b6d9d456dbb642e1a1567d092e', id: "path-3", points: "-0.846460828 -19.7681159 53.908974 -19.7681159 53.908974 -0.393115942 -0.846460828 -0.393115942" })), index.h("g", { key: 'ed893c950447790359d41eb049fa27d3072e4550', id: "Ikonguide", stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd" }, index.h("g", { key: '4b5f626b6fd84c24288d4ca2282bb4f77cc66f09', transform: "translate(-1012.000000, -804.000000)", id: "Chart" }, index.h("g", { key: 'd80584e04fc9647d5f3754c3c0f110d8159ae81a', transform: "translate(1013.063248, 823.768116)" }, index.h("g", { key: '865b38e62f958368b9b0c8bee661f8ad65d937d5', id: "Group", transform: "translate(-0.000000, 0.000000)" }, index.h("path", { key: 'de78d7a368a954e05a35f86279ebe64dd7e6bb5f', d: "M11.2871933,17.0724638 L3.19179715,17.0724638 C1.47642907,17.0724638 0.0891563449,18.5157634 0.0891563449,20.3004089 L0,39.003939 C0,40.7885845 1.38727273,42.2318841 3.1026408,42.2318841 L11.1980369,42.2318841 C12.913405,42.2318841 14.3006777,40.7885845 14.3006777,39.003939 L14.3898341,20.3004089 C14.3898341,18.5157634 12.9989951,17.0724638 11.2871933,17.0724638", id: "Fill-1", fill: "currentColor" }), index.h("path", { key: '9becb04f53bc8e2204057bcc91011748e91d7f49', d: "M31.292107,11.2318841 L23.077661,11.2318841 C21.3370669,11.2318841 19.9293931,12.6247 19.9293931,14.3469222 L19.8389256,39.1168459 C19.8389256,40.8354877 21.2465994,42.2318841 22.9871935,42.2318841 L31.2016396,42.2318841 C32.9422337,42.2318841 34.3499075,40.8354877 34.3499075,39.1168459 L34.4403749,14.3469222 C34.4403749,12.6247 33.0290824,11.2318841 31.292107,11.2318841", id: "Fill-3", fill: "currentColor" }), index.h("path", { key: '630d629de95cab01e5c6c12fcdf6db1370cfbcbb', d: "M51.0899571,0 L43.0444095,0 C41.339604,0 39.9608736,1.42791855 39.9608736,3.19354534 L39.7836589,39.0420095 C39.7836589,40.8039655 41.1659336,42.2318841 42.8671948,42.2318841 L50.9162867,42.2318841 C52.6175479,42.2318841 53.9962783,40.8039655 53.9962783,39.0420095 L54.173493,3.19354534 C54.173493,1.42791855 52.7912183,0 51.0899571,0", id: "Fill-6", fill: "currentColor" }), index.h("polygon", { key: 'f4840f517fa75e69552904a8a745af9685f8ef48', id: "path-1", points: "19.8389256 11.2318841 34.4403749 11.2318841 34.4403749 42.2318841 19.8389256 42.2318841" }), index.h("g", { key: '0c3ddc574e29a0933b9927ccbbccaf7896346181', id: "Clip-4" }), index.h("polygon", { key: '6003bdc26f9a47f8907ad2483067eb97fa47125a', id: "path-3", points: "-0.846460828 -19.7681159 53.908974 -19.7681159 53.908974 -0.393115942 -0.846460828 -0.393115942" }), index.h("g", { key: '58b7a6de68a0a2e9b513434c02ef2ceb9746f708', id: "Clip-9" }), index.h("path", { key: '17cc4e34e2e1c2d4065d65665c2cd2de4d1cac7c', d: "M2.64246183,-0.393115942 L24.287738,-0.393115942 C24.783165,-0.393115942 25.2716142,-0.501190406 25.7216852,-0.713736852 L51.853716,-12.8829215 C53.6086441,-13.6970825 54.3936517,-15.8297519 53.5981773,-17.6454029 C52.8027029,-19.4610539 50.7372607,-20.2680099 48.9858215,-19.4466439 L23.5376196,-7.59808021 L2.64246183,-7.59808021 C0.716576525,-7.59808021 -0.846460828,-5.98777069 -0.846460828,-3.99559807 C-0.846460828,-2.00342546 0.716576525,-0.393115942 2.64246183,-0.393115942", id: "Fill-8", fill: "currentColor", mask: "url(#mask-4)" })))))));
|
|
2203
|
+
}
|
|
2204
|
+
};
|
|
2205
|
+
IconChart.style = DigiIconChartStyle0;
|
|
2206
|
+
|
|
625
2207
|
const iconMinusCss = ".sc-digi-icon-minus-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-minus-h svg.sc-digi-icon-minus{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}";
|
|
626
2208
|
const DigiIconMinusStyle0 = iconMinusCss;
|
|
627
2209
|
|
|
@@ -666,6 +2248,28 @@ const IconPlus = class {
|
|
|
666
2248
|
};
|
|
667
2249
|
IconPlus.style = DigiIconPlusStyle0;
|
|
668
2250
|
|
|
2251
|
+
const iconTableCss = ".sc-digi-icon-table-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-table-h svg.sc-digi-icon-table{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}";
|
|
2252
|
+
const DigiIconTableStyle0 = iconTableCss;
|
|
2253
|
+
|
|
2254
|
+
const IconTable = class {
|
|
2255
|
+
constructor(hostRef) {
|
|
2256
|
+
index.registerInstance(this, hostRef);
|
|
2257
|
+
this.afTitle = undefined;
|
|
2258
|
+
this.afDesc = undefined;
|
|
2259
|
+
this.afSvgAriaHidden = true;
|
|
2260
|
+
this.afSvgAriaLabelledby = undefined;
|
|
2261
|
+
this.titleId = randomIdGenerator_util.randomIdGenerator('icontitle');
|
|
2262
|
+
}
|
|
2263
|
+
render() {
|
|
2264
|
+
return (index.h("svg", { key: '2b15475968f010d4d9b38757d76310a0da35f9aa', class: "digi-icon-table", width: "62px", height: "62px", viewBox: "0 0 62 62", "aria-hidden": this.afSvgAriaHidden ? 'true' : 'false', "aria-labelledby": this.afSvgAriaLabelledby
|
|
2265
|
+
? this.afSvgAriaLabelledby
|
|
2266
|
+
: this.afTitle
|
|
2267
|
+
? this.titleId
|
|
2268
|
+
: undefined, xmlns: "http://www.w3.org/2000/svg", fill: "currentColor" }, this.afTitle && index.h("title", { key: '4d6f0e438a5e0815b93ae7d3c78108bfec3f5f06', id: this.titleId }, this.afTitle), this.afDesc && index.h("desc", { key: 'e61d74161f5c064226f0024eee36d8873f79fe20' }, this.afDesc), index.h("defs", { key: '0cec891b39f0d976d433b03cbb67827bfe5b079b' }, index.h("polygon", { key: '519dc3fcc3c88f79639f4de0ff9cfa4ad859c377', points: "0 62 62 62 62 0 0 0" })), index.h("g", { key: '71db465acf6cb6e9584f681d734582875a92b78f', stroke: "none", "stroke-width": "1", fill: "none", "fill-rule": "evenodd" }, index.h("g", { key: '33b2c9ac1ec24ea5c99e473e803376b84fa8a697', transform: "translate(-302, -975)" }, index.h("g", { key: '84aad1a7cbfb1e00b9fe6d09d6f391c6d9e3a253', transform: "translate(302, 975)" }, index.h("polygon", { key: 'fdaea81b52a89b1569ab4fe419bfce0bf63149cc', fill: "currentColor", points: "29.6502083 9.05264249 32.3497917 9.05264249 32.3497917 6.36704663 29.6502083 6.36704663" }), index.h("g", { key: 'c702ec7d878464f96670a7bf5c648ae03046432f' }, index.h("path", { key: 'fdf06acb2a51a798edd82c8fe4ddb05e89ffd72a', d: "M35.3073208,0 L26.6931958,0 C24.7918625,0 23.2496125,1.53297409 23.2496125,3.42574093 L23.2496125,11.9939482 C23.2496125,13.886715 24.7918625,15.4196891 26.6931958,15.4196891 L35.3073208,15.4196891 C37.2086542,15.4196891 38.7496125,13.886715 38.7496125,11.9939482 L38.7496125,3.42574093 C38.7496125,1.53297409 37.2086542,0 35.3073208,0", fill: "currentColor" }), index.h("polygon", { key: 'f32aeb62af7d6f2f555cdb6400b15acab99a526f', fill: "currentColor", points: "6.40020833 9.05264249 9.09979167 9.05264249 9.09979167 6.36704663 6.40020833 6.36704663" }), index.h("path", { key: 'b719764d7969126f69e5ffe8d66c6604f3678666', d: "M12.0573208,0 L3.44319583,0 C1.5418625,0 -0.0003875,1.53297409 -0.0003875,3.42574093 L-0.0003875,11.9939482 C-0.0003875,13.886715 1.5418625,15.4196891 3.44319583,15.4196891 L12.0573208,15.4196891 C13.9586542,15.4196891 15.4996125,13.886715 15.4996125,11.9939482 L15.4996125,3.42574093 C15.4996125,1.53297409 13.9586542,0 12.0573208,0", fill: "currentColor" }), index.h("polygon", { key: 'f478c28306a90a3a20ec5d165ae61c528144f5cf', fill: "currentColor", points: "52.9002083 9.05264249 55.5997917 9.05264249 55.5997917 6.36704663 52.9002083 6.36704663" }), index.h("path", { key: '32ecd42b5a7bac68784083a536a13eb8432142d6', d: "M58.5573208,0 L49.9431958,0 C48.0418625,0 46.4996125,1.53297409 46.4996125,3.42574093 L46.4996125,11.9939482 C46.4996125,13.886715 48.0418625,15.4196891 49.9431958,15.4196891 L58.5573208,15.4196891 C60.4586542,15.4196891 61.9996125,13.886715 61.9996125,11.9939482 L61.9996125,3.42574093 C61.9996125,1.53297409 60.4586542,0 58.5573208,0", fill: "currentColor" }), index.h("polygon", { key: '4adc770bd26975b7f26853960784938d22aa22de', fill: "currentColor", points: "29.6502083 55.6329534 32.3497917 55.6329534 32.3497917 52.9473575 29.6502083 52.9473575" }), index.h("path", { key: '0fea261e3e830db49452ea4f8c1d51de61baa3e5', d: "M35.3073208,46.5803109 L26.6931958,46.5803109 C24.7918625,46.5803109 23.2496125,48.113285 23.2496125,50.0060518 L23.2496125,58.5742591 C23.2496125,60.4670259 24.7918625,62 26.6931958,62 L35.3073208,62 C37.2086542,62 38.7496125,60.4670259 38.7496125,58.5742591 L38.7496125,50.0060518 C38.7496125,48.113285 37.2086542,46.5803109 35.3073208,46.5803109", fill: "currentColor" }), index.h("polygon", { key: 'aefe51986871cdcca194a2aab635c2d10a4b0df9', fill: "currentColor", points: "6.40020833 55.6329534 9.09979167 55.6329534 9.09979167 52.9473575 6.40020833 52.9473575" }), index.h("path", { key: 'b301aca5e4016a8f2576ccf4d35d820042297d3b', d: "M12.0573208,46.5803109 L3.44319583,46.5803109 C1.5418625,46.5803109 -0.0003875,48.113285 -0.0003875,50.0060518 L-0.0003875,58.5742591 C-0.0003875,60.4670259 1.5418625,62 3.44319583,62 L12.0573208,62 C13.9586542,62 15.4996125,60.4670259 15.4996125,58.5742591 L15.4996125,50.0060518 C15.4996125,48.113285 13.9586542,46.5803109 12.0573208,46.5803109", fill: "currentColor" }), index.h("polygon", { key: 'f7c37e92ce4923c69f18f9ee7bfcf024f6edca68', fill: "currentColor", points: "52.9002083 55.6329534 55.5997917 55.6329534 55.5997917 52.9473575 52.9002083 52.9473575" }), index.h("path", { key: '92b5ade4dcfee263d5c6705f0e61d497de95b127', d: "M58.5573208,46.5803109 L49.9431958,46.5803109 C48.0418625,46.5803109 46.4996125,48.113285 46.4996125,50.0060518 L46.4996125,58.5742591 C46.4996125,60.4670259 48.0418625,62 49.9431958,62 L58.5573208,62 C60.4586542,62 61.9996125,60.4670259 61.9996125,58.5742591 L61.9996125,50.0060518 C61.9996125,48.113285 60.4586542,46.5803109 58.5573208,46.5803109", fill: "currentColor" }), index.h("polygon", { key: '18efdfef14982ce32fa049ed6f4291547d69d57f', fill: "currentColor", points: "29.6502083 32.3427979 32.3497917 32.3427979 32.3497917 29.6572021 29.6502083 29.6572021" }), index.h("path", { key: 'd9650db05e8113d593266abd6b6ca24ec3d47c53', d: "M35.3073208,23.2901554 L26.6931958,23.2901554 C24.7918625,23.2901554 23.2496125,24.8231295 23.2496125,26.7158964 L23.2496125,35.2841036 C23.2496125,37.1768705 24.7918625,38.7098446 26.6931958,38.7098446 L35.3073208,38.7098446 C37.2086542,38.7098446 38.7496125,37.1768705 38.7496125,35.2841036 L38.7496125,26.7158964 C38.7496125,24.8231295 37.2086542,23.2901554 35.3073208,23.2901554", fill: "currentColor" }), index.h("polygon", { key: 'a867951d8eb353eb1e0b71914d90c835a7a09062', fill: "currentColor", points: "6.40020833 32.3427979 9.09979167 32.3427979 9.09979167 29.6572021 6.40020833 29.6572021" }), index.h("path", { key: 'e8bbdaf46e54616c09c59183e1d54a6a47d17532', d: "M12.0573208,23.2901554 L3.44319583,23.2901554 C1.5418625,23.2901554 -0.0003875,24.8231295 -0.0003875,26.7158964 L-0.0003875,35.2841036 C-0.0003875,37.1768705 1.5418625,38.7098446 3.44319583,38.7098446 L12.0573208,38.7098446 C13.9586542,38.7098446 15.4996125,37.1768705 15.4996125,35.2841036 L15.4996125,26.7158964 C15.4996125,24.8231295 13.9586542,23.2901554 12.0573208,23.2901554", fill: "currentColor" }), index.h("polygon", { key: 'e726b28b6c68eef9436a978b653e04815248c269', fill: "currentColor", points: "52.9002083 32.3427979 55.5997917 32.3427979 55.5997917 29.6572021 52.9002083 29.6572021" }), index.h("path", { key: '3664a2121e9bbf427652fa17e81c7f5e3f34f422', d: "M58.5573208,23.2901554 L49.9431958,23.2901554 C48.0418625,23.2901554 46.4996125,24.8231295 46.4996125,26.7158964 L46.4996125,35.2841036 C46.4996125,37.1768705 48.0418625,38.7098446 49.9431958,38.7098446 L58.5573208,38.7098446 C60.4586542,38.7098446 61.9996125,37.1768705 61.9996125,35.2841036 L61.9996125,26.7158964 C61.9996125,24.8231295 60.4586542,23.2901554 58.5573208,23.2901554", fill: "currentColor" })))))));
|
|
2269
|
+
}
|
|
2270
|
+
};
|
|
2271
|
+
IconTable.style = DigiIconTableStyle0;
|
|
2272
|
+
|
|
669
2273
|
const iconXCss = ".sc-digi-icon-x-h{--digi--icon--color:var(--digi--color--icon--primary);--digi--icon--width:initial;--digi--icon--height:auto;display:flex;min-height:1.4em;align-items:center}.sc-digi-icon-x-h svg.sc-digi-icon-x{color:var(--digi--icon--color);max-width:var(--digi--icon--width);max-height:var(--digi--icon--height);width:var(--digi--icon--width, auto);height:var(--digi--icon--height, auto)}";
|
|
670
2274
|
const DigiIconXStyle0 = iconXCss;
|
|
671
2275
|
|
|
@@ -1290,49 +2894,6 @@ const Typography = class {
|
|
|
1290
2894
|
};
|
|
1291
2895
|
Typography.style = DigiTypographyStyle0;
|
|
1292
2896
|
|
|
1293
|
-
const typographyHeadingJumboCss = ".sc-digi-typography-heading-jumbo-h{display:block}.sc-digi-typography-heading-jumbo-h .digi-typography-heading-jumbo.sc-digi-typography-heading-jumbo{font-size:var(--digi--typography--heading-jumbo--font-size--desktop);font-family:var(--digi--global--typography--font-family--default);color:var(--digi--color--text--primary);font-weight:var(--digi--typography--heading-jumbo--font-weight--desktop)}@media (min-width: 61.9375rem){.sc-digi-typography-heading-jumbo-h .digi-typography-heading-jumbo.sc-digi-typography-heading-jumbo{font-size:var(--digi--typography--heading-jumbo--font-size--desktop-large)}}.sc-digi-typography-heading-jumbo-h .digi-typography-heading-jumbo--secondary.sc-digi-typography-heading-jumbo{color:var(--digi--grayscale--0)}.sc-digi-typography-heading-jumbo-h .digi-typography-heading-jumbo.sc-digi-typography-heading-jumbo::after{content:\"\";width:11.875rem;height:0.4375rem;background:var(--digi--color--border--accent--primary);display:block;margin-top:var(--digi--padding--small)}@media (min-width: 61.9375rem){.sc-digi-typography-heading-jumbo-h .digi-typography-heading-jumbo.sc-digi-typography-heading-jumbo::after{width:13.75rem;margin-top:var(--digi--margin--h2-large);height:0.625rem}}.sc-digi-typography-heading-jumbo-h .digi-typography-heading-jumbo--secondary.sc-digi-typography-heading-jumbo::after{background:var(--digi--color--border--accent--secondary)}digi-typography .sc-digi-typography-heading-jumbo-h .digi-typography-heading-jumbo.sc-digi-typography-heading-jumbo{margin-bottom:var(--digi--margin--medium)}";
|
|
1294
|
-
const DigiTypographyHeadingJumboStyle0 = typographyHeadingJumboCss;
|
|
1295
|
-
|
|
1296
|
-
const TypographyHeadingJumbo = class {
|
|
1297
|
-
constructor(hostRef) {
|
|
1298
|
-
index.registerInstance(this, hostRef);
|
|
1299
|
-
this.afText = '';
|
|
1300
|
-
this.afVariation = undefined;
|
|
1301
|
-
this.afLevel = typographyVariation_enum.TypographyHeadingJumboLevel.H1;
|
|
1302
|
-
this.afLang = 'sv';
|
|
1303
|
-
}
|
|
1304
|
-
/**
|
|
1305
|
-
* Lyssnar på om fokus sätts på custom-elementet och propagerar ner det till själva rubrik-elementet.
|
|
1306
|
-
* @en Listens for when focus is set on the custom element and propagates it down to the actual heading element.
|
|
1307
|
-
*/
|
|
1308
|
-
focusOnHeading() {
|
|
1309
|
-
this.headingElement.focus();
|
|
1310
|
-
}
|
|
1311
|
-
get cssModifiers() {
|
|
1312
|
-
return {
|
|
1313
|
-
'digi-typography-heading-jumbo--primary': this.afVariation === typographyVariation_enum.TypographyHeadingJumboVariation.PRIMARY,
|
|
1314
|
-
'digi-typography-heading-jumbo--secondary': this.afVariation === typographyVariation_enum.TypographyHeadingJumboVariation.SECONDARY
|
|
1315
|
-
};
|
|
1316
|
-
}
|
|
1317
|
-
render() {
|
|
1318
|
-
return (index.h(this.afLevel, { key: '3e7dd74258d680d423a0d3f0ebd7cdd4eaa312ff', ref: (el) => (this.headingElement = el), class: Object.assign({ 'digi-typography-heading-jumbo': true }, this.cssModifiers), lang: this.afLang, tabindex: -1 }, this.afText));
|
|
1319
|
-
}
|
|
1320
|
-
};
|
|
1321
|
-
TypographyHeadingJumbo.style = DigiTypographyHeadingJumboStyle0;
|
|
1322
|
-
|
|
1323
|
-
const typographyPreambleCss = ".sc-digi-typography-preamble-h .digi-typography-preamble.sc-digi-typography-preamble{font-family:var(--digi--global--typography--font-family--default);font-size:var(--digi--typography--preamble--font-size--mobile);font-weight:var(--digi--typography--preamble--font-weight--desktop);line-height:var(--digi--typography--preamble--line-height--mobile);color:var(--digi--color--text--primary);max-width:var(--digi--paragraph-width--medium)}@media (min-width: 61.9375rem){.sc-digi-typography-preamble-h .digi-typography-preamble.sc-digi-typography-preamble{font-size:var(--digi--typography--preamble--font-size--desktop);line-height:var(--digi--typography--preamble--line-height--desktop)}}";
|
|
1324
|
-
const DigiTypographyPreambleStyle0 = typographyPreambleCss;
|
|
1325
|
-
|
|
1326
|
-
const TypographyPreamble = class {
|
|
1327
|
-
constructor(hostRef) {
|
|
1328
|
-
index.registerInstance(this, hostRef);
|
|
1329
|
-
}
|
|
1330
|
-
render() {
|
|
1331
|
-
return (index.h("p", { key: '0b6395ace6b7679213689fa37fd41c5e8c4f5b30', class: "digi-typography-preamble" }, index.h("slot", { key: 'cc20315940fae3c5fe81ff0d8fc76d545e3de817' })));
|
|
1332
|
-
}
|
|
1333
|
-
};
|
|
1334
|
-
TypographyPreamble.style = DigiTypographyPreambleStyle0;
|
|
1335
|
-
|
|
1336
2897
|
const utilBreakpointObserverCss = ".sc-digi-util-breakpoint-observer-h .digi-util-breakpoint-observer.sc-digi-util-breakpoint-observer{--SMALL:small;--MEDIUM:medium;--LARGE:large;--XLARGE:xlarge}.sc-digi-util-breakpoint-observer-h .digi-util-breakpoint-observer__observer.sc-digi-util-breakpoint-observer{--digi--util-breakpoint-observer--breakpoint:var(--SMALL);border:0;clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap;pointer-events:none;transition:transform 0.01s;transform:rotate(0deg)}@media (min-width: 48rem){.sc-digi-util-breakpoint-observer-h .digi-util-breakpoint-observer__observer.sc-digi-util-breakpoint-observer{--digi--util-breakpoint-observer--breakpoint:var(--MEDIUM);transform:rotate(10deg)}}@media (min-width: 61.9375rem){.sc-digi-util-breakpoint-observer-h .digi-util-breakpoint-observer__observer.sc-digi-util-breakpoint-observer{--digi--util-breakpoint-observer--breakpoint:var(--LARGE);transform:rotate(20deg)}}@media (min-width: 75rem){.sc-digi-util-breakpoint-observer-h .digi-util-breakpoint-observer__observer.sc-digi-util-breakpoint-observer{--digi--util-breakpoint-observer--breakpoint:var(--XLARGE);transform:rotate(30deg)}}";
|
|
1337
2898
|
const DigiUtilBreakpointObserverStyle0 = utilBreakpointObserverCss;
|
|
1338
2899
|
|
|
@@ -1514,6 +3075,7 @@ const UtilKeydownHandler = class {
|
|
|
1514
3075
|
}
|
|
1515
3076
|
};
|
|
1516
3077
|
|
|
3078
|
+
exports.digi_bar_chart = barChart;
|
|
1517
3079
|
exports.digi_button = Button;
|
|
1518
3080
|
exports.digi_header = Header;
|
|
1519
3081
|
exports.digi_header_avatar = NavigationAvatar;
|
|
@@ -1522,8 +3084,12 @@ exports.digi_header_navigation_item = HeaderNavigationItem;
|
|
|
1522
3084
|
exports.digi_header_notification = HeaderNotification;
|
|
1523
3085
|
exports.digi_icon_bars = IconBars;
|
|
1524
3086
|
exports.digi_icon_bell_filled = IconBellFilled;
|
|
3087
|
+
exports.digi_icon_caret_down = IconCaretDown;
|
|
3088
|
+
exports.digi_icon_caret_up = IconCaretUp;
|
|
3089
|
+
exports.digi_icon_chart = IconChart;
|
|
1525
3090
|
exports.digi_icon_minus = IconMinus;
|
|
1526
3091
|
exports.digi_icon_plus = IconPlus;
|
|
3092
|
+
exports.digi_icon_table = IconTable;
|
|
1527
3093
|
exports.digi_icon_x = IconX;
|
|
1528
3094
|
exports.digi_layout_block = LayoutBlock;
|
|
1529
3095
|
exports.digi_layout_container = LayoutContainer;
|
|
@@ -1533,8 +3099,6 @@ exports.digi_navigation_vertical_menu = NavigationVerticalMenu;
|
|
|
1533
3099
|
exports.digi_navigation_vertical_menu_item = NavigationVerticalMenuItem;
|
|
1534
3100
|
exports.digi_title_logo = TitleLogo;
|
|
1535
3101
|
exports.digi_typography = Typography;
|
|
1536
|
-
exports.digi_typography_heading_jumbo = TypographyHeadingJumbo;
|
|
1537
|
-
exports.digi_typography_preamble = TypographyPreamble;
|
|
1538
3102
|
exports.digi_util_breakpoint_observer = UtilBreakpointObserver;
|
|
1539
3103
|
exports.digi_util_intersection_observer = UtilIntersectionObserver;
|
|
1540
3104
|
exports.digi_util_keydown_handler = UtilKeydownHandler;
|