@mozaic-ds/web-components 0.5.0 → 0.6.1
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/package.json +3 -3
- package/public/ClickOutside-63071e7a.js +1 -15
- package/public/ClickOutside-63071e7a.js.map +1 -1
- package/public/DataTableDefaultAction.nested-4da4dc44.js +1 -759
- package/public/DataTableDefaultAction.nested-4da4dc44.js.map +1 -1
- package/public/DataTableUtilities-60220c78.js +1 -370
- package/public/DataTableUtilities-60220c78.js.map +1 -1
- package/public/EventForward-8492ff62.js +1 -109
- package/public/EventForward-8492ff62.js.map +1 -1
- package/public/EventHandler-02058705.js +1 -15
- package/public/EventHandler-02058705.js.map +1 -1
- package/public/adeo/components/checkbox/Checkbox.js +1 -1
- package/public/adeo/components/checkbox/Checkbox.js.map +1 -1
- package/public/adeo/components/checkbox/Checkbox.svelte +2 -2
- package/public/adeo/components/datatable/DataTable.js +1 -1
- package/public/adeo/components/datatable/DataTable.js.map +1 -1
- package/public/adeo/components/datatable/DataTable.svelte +18 -18
- package/public/adeo/components/fileuploader/FileUploader.js +1 -1
- package/public/adeo/components/fileuploader/FileUploader.js.map +1 -1
- package/public/adeo/components/fileuploader/FileUploader.svelte +8 -5
- package/public/adeo/components/fileuploader/ResultFile.nested.js +1 -1
- package/public/adeo/components/fileuploader/ResultFile.nested.js.map +1 -1
- package/public/adeo/components/layer/Layer.js +1 -1
- package/public/adeo/components/layer/Layer.js.map +1 -1
- package/public/adeo/components/layer/Layer.svelte +2 -1
- package/public/adeo/components/link/Link.js +1 -1
- package/public/adeo/components/link/Link.js.map +1 -1
- package/public/adeo/components/link/Link.svelte +1 -1
- package/public/adeo/components/phonenumber/PhoneNumber.js +1 -1
- package/public/adeo/components/phonenumber/PhoneNumber.js.map +1 -1
- package/public/adeo/components/phonenumber/PhoneNumber.svelte +72 -9
- package/public/adeo/components/quantityselector/QuantitySelector.js +1 -1
- package/public/adeo/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/adeo/components/quantityselector/QuantitySelector.svelte +6 -3
- package/public/adeo/components/resultfile/ResultFile.nested.svelte +1 -1
- package/public/array-5b770a93.js +1 -13
- package/public/array-5b770a93.js.map +1 -1
- package/public/axis-fbc0f7b5.js +1 -174
- package/public/axis-fbc0f7b5.js.map +1 -1
- package/public/band-d7a07d2c.js +1 -186
- package/public/band-d7a07d2c.js.map +1 -1
- package/public/bricoman/components/chart/Donut.js +1 -1
- package/public/bricoman/components/checkbox/Checkbox.js +1 -1
- package/public/bricoman/components/checkbox/Checkbox.js.map +1 -1
- package/public/bricoman/components/checkbox/Checkbox.svelte +2 -2
- package/public/bricoman/components/datatable/DataTable.js +1 -1
- package/public/bricoman/components/datatable/DataTable.js.map +1 -1
- package/public/bricoman/components/datatable/DataTable.svelte +18 -18
- package/public/bricoman/components/fileuploader/FileUploader.js +1 -1
- package/public/bricoman/components/fileuploader/FileUploader.js.map +1 -1
- package/public/bricoman/components/fileuploader/FileUploader.svelte +8 -5
- package/public/bricoman/components/fileuploader/ResultFile.nested.js +1 -1
- package/public/bricoman/components/fileuploader/ResultFile.nested.js.map +1 -1
- package/public/bricoman/components/header/Header.js +1 -1
- package/public/bricoman/components/hero/Hero.js +1 -1
- package/public/bricoman/components/layer/Layer.js +1 -1
- package/public/bricoman/components/layer/Layer.js.map +1 -1
- package/public/bricoman/components/layer/Layer.svelte +2 -1
- package/public/bricoman/components/link/Link.js +1 -1
- package/public/bricoman/components/link/Link.js.map +1 -1
- package/public/bricoman/components/link/Link.svelte +1 -1
- package/public/bricoman/components/listbox/Listbox.js +1 -1
- package/public/bricoman/components/listbox/Listbox.nested.js +1 -1
- package/public/bricoman/components/phonenumber/PhoneNumber.js +1 -1
- package/public/bricoman/components/phonenumber/PhoneNumber.js.map +1 -1
- package/public/bricoman/components/phonenumber/PhoneNumber.svelte +72 -9
- package/public/bricoman/components/price/Price.js +1 -1
- package/public/bricoman/components/quantityselector/QuantitySelector.js +1 -1
- package/public/bricoman/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/bricoman/components/quantityselector/QuantitySelector.svelte +6 -3
- package/public/bricoman/components/resultfile/ResultFile.nested.svelte +1 -1
- package/public/components/accordion/Accordion.js +1 -365
- package/public/components/accordion/Accordion.js.map +1 -1
- package/public/components/autocomplete/Autocomplete.js +1 -1515
- package/public/components/autocomplete/Autocomplete.js.map +1 -1
- package/public/components/badge/Badge.js +1 -155
- package/public/components/badge/Badge.js.map +1 -1
- package/public/components/badge/Badge.nested.js +1 -101
- package/public/components/badge/Badge.nested.js.map +1 -1
- package/public/components/breadcrumb/Breadcrumb.js +1 -372
- package/public/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/public/components/breadcrumb/Breadcrumb.nested.js +1 -319
- package/public/components/breadcrumb/Breadcrumb.nested.js.map +1 -1
- package/public/components/button/Button.js +1 -1138
- package/public/components/button/Button.js.map +1 -1
- package/public/components/card/Card.js +1 -369
- package/public/components/card/Card.js.map +1 -1
- package/public/components/chart/BarChart.js +1 -582
- package/public/components/chart/BarChart.js.map +1 -1
- package/public/components/chart/Donut.js +1 -1189
- package/public/components/chart/Donut.js.map +1 -1
- package/public/components/chart/GroupedBarChart.js +1 -750
- package/public/components/chart/GroupedBarChart.js.map +1 -1
- package/public/components/chart/LineChart.js +1 -1731
- package/public/components/chart/LineChart.js.map +1 -1
- package/public/components/chart/Radar.js +1 -729
- package/public/components/chart/Radar.js.map +1 -1
- package/public/components/chart/StackedBarChart.js +1 -745
- package/public/components/chart/StackedBarChart.js.map +1 -1
- package/public/components/checkbox/Checkbox.js +1 -307
- package/public/components/checkbox/Checkbox.js.map +1 -1
- package/public/components/checkbox/Checkbox.svelte +2 -2
- package/public/components/checkboxgroup/checkboxGroup.js +1 -404
- package/public/components/checkboxgroup/checkboxGroup.js.map +1 -1
- package/public/components/datatable/DataTable.js +1 -3064
- package/public/components/datatable/DataTable.js.map +1 -1
- package/public/components/datatable/DataTable.svelte +18 -18
- package/public/components/datatable/DataTableDefaultAction.nested.js +1 -4
- package/public/components/datatable/DataTableDefaultAction.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultEdtion.nested.js +1 -164
- package/public/components/datatable/DataTableDefaultEdtion.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultFilterTags.nested.js +1 -380
- package/public/components/datatable/DataTableDefaultFilterTags.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultSelection.nested.js +1 -424
- package/public/components/datatable/DataTableDefaultSelection.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js +1 -263
- package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js.map +1 -1
- package/public/components/datatable/DataTableFooter.nested.js +1 -637
- package/public/components/datatable/DataTableFooter.nested.js.map +1 -1
- package/public/components/dropdown/Dropdown.js +1 -1426
- package/public/components/dropdown/Dropdown.js.map +1 -1
- package/public/components/field/Field.js +1 -375
- package/public/components/field/Field.js.map +1 -1
- package/public/components/fileuploader/FileUploader.js +1 -555
- package/public/components/fileuploader/FileUploader.js.map +1 -1
- package/public/components/fileuploader/FileUploader.svelte +8 -5
- package/public/components/fileuploader/ResultFile.nested.js +1 -265
- package/public/components/fileuploader/ResultFile.nested.js.map +1 -1
- package/public/components/flag/Flag.js +1 -174
- package/public/components/flag/Flag.js.map +1 -1
- package/public/components/header/Header.js +1 -903
- package/public/components/header/Header.js.map +1 -1
- package/public/components/hero/Hero.js +1 -271
- package/public/components/hero/Hero.js.map +1 -1
- package/public/components/layer/Layer.js +1 -453
- package/public/components/layer/Layer.js.map +1 -1
- package/public/components/layer/Layer.svelte +2 -1
- package/public/components/link/Link.js +1 -380
- package/public/components/link/Link.js.map +1 -1
- package/public/components/link/Link.svelte +1 -1
- package/public/components/listbox/Listbox.js +1 -595
- package/public/components/listbox/Listbox.js.map +1 -1
- package/public/components/listbox/Listbox.nested.js +1 -629
- package/public/components/listbox/Listbox.nested.js.map +1 -1
- package/public/components/loader/Loader.js +1 -246
- package/public/components/loader/Loader.js.map +1 -1
- package/public/components/loader/Loader.nested.js +1 -176
- package/public/components/loader/Loader.nested.js.map +1 -1
- package/public/components/modal/Modal.js +1 -395
- package/public/components/modal/Modal.js.map +1 -1
- package/public/components/notification/Notification.js +1 -458
- package/public/components/notification/Notification.js.map +1 -1
- package/public/components/optionbutton/OptionButton.js +1 -316
- package/public/components/optionbutton/OptionButton.js.map +1 -1
- package/public/components/overlay/Overlay.js +1 -104
- package/public/components/overlay/Overlay.js.map +1 -1
- package/public/components/overlay/OverlayLoader.js +1 -151
- package/public/components/overlay/OverlayLoader.js.map +1 -1
- package/public/components/pagination/Pagination.js +1 -613
- package/public/components/pagination/Pagination.js.map +1 -1
- package/public/components/passwordinput/PasswordInput.js +1 -291
- package/public/components/passwordinput/PasswordInput.js.map +1 -1
- package/public/components/phonenumber/PhoneNumber.js +1 -6894
- package/public/components/phonenumber/PhoneNumber.js.map +1 -1
- package/public/components/price/Price.js +1 -768
- package/public/components/price/Price.js.map +1 -1
- package/public/components/progressbar/ProgressBar.js +1 -278
- package/public/components/progressbar/ProgressBar.js.map +1 -1
- package/public/components/quantityselector/QuantitySelector.js +1 -333
- package/public/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/components/quantityselector/QuantitySelector.svelte +6 -3
- package/public/components/radio/Radio.js +1 -273
- package/public/components/radio/Radio.js.map +1 -1
- package/public/components/radiogroup/RadioGroup.js +1 -414
- package/public/components/radiogroup/RadioGroup.js.map +1 -1
- package/public/components/ratings/StarsInput.js +1 -292
- package/public/components/ratings/StarsInput.js.map +1 -1
- package/public/components/ratings/StarsResult.js +1 -246
- package/public/components/ratings/StarsResult.js.map +1 -1
- package/public/components/resultfile/ResultFile.nested.svelte +1 -1
- package/public/components/select/Select.js +1 -451
- package/public/components/select/Select.js.map +1 -1
- package/public/components/sidebar/Sidebar.js +1 -784
- package/public/components/sidebar/Sidebar.js.map +1 -1
- package/public/components/sidebar/sidebar-feature-group.nested.js +1 -594
- package/public/components/sidebar/sidebar-feature-group.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-feature.nested.js +1 -402
- package/public/components/sidebar/sidebar-feature.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-section.nested.js +1 -394
- package/public/components/sidebar/sidebar-section.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-segment.nested.js +1 -200
- package/public/components/sidebar/sidebar-segment.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-separator.nested.js +1 -49
- package/public/components/sidebar/sidebar-separator.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-sub-features.nested.js +1 -312
- package/public/components/sidebar/sidebar-sub-features.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-user.nested.js +1 -733
- package/public/components/sidebar/sidebar-user.nested.js.map +1 -1
- package/public/components/stepper/Stepper.js +1 -371
- package/public/components/stepper/Stepper.js.map +1 -1
- package/public/components/tabs/Tabs.js +1 -615
- package/public/components/tabs/Tabs.js.map +1 -1
- package/public/components/tabs/Tabs.nested.js +1 -472
- package/public/components/tabs/Tabs.nested.js.map +1 -1
- package/public/components/tag/Tag.js +1 -665
- package/public/components/tag/Tag.js.map +1 -1
- package/public/components/tag/Tag.nested.js +1 -554
- package/public/components/tag/Tag.nested.js.map +1 -1
- package/public/components/taglist/TagList.js +1 -475
- package/public/components/taglist/TagList.js.map +1 -1
- package/public/components/textarea/Textarea.js +1 -303
- package/public/components/textarea/Textarea.js.map +1 -1
- package/public/components/textinput/Textinput.js +1 -497
- package/public/components/textinput/Textinput.js.map +1 -1
- package/public/components/textinput/Textinput.nested.js +1 -320
- package/public/components/textinput/Textinput.nested.js.map +1 -1
- package/public/components/toggle/Toggle.js +1 -278
- package/public/components/toggle/Toggle.js.map +1 -1
- package/public/components/tooltip/Tooltip.js +1 -173
- package/public/components/tooltip/Tooltip.js.map +1 -1
- package/public/index-c33b3772.js +1 -873
- package/public/index-c33b3772.js.map +1 -1
- package/public/linear-f46d7e9e.js +1 -700
- package/public/linear-f46d7e9e.js.map +1 -1
- package/public/path-1b5da959.js +1 -186
- package/public/path-1b5da959.js.map +1 -1
- package/public/sidebar-service-275bf9ef.js +1 -129
- package/public/sidebar-service-275bf9ef.js.map +1 -1
- package/public/symbol-b05a6e2b.js +1 -169
- package/public/symbol-b05a6e2b.js.map +1 -1
- package/public/transform-15d69d5d.js +1 -2743
- package/public/transform-15d69d5d.js.map +1 -1
- package/public/utilities/stories/fileuploader/FileUploader.stories.d.ts.map +1 -1
- package/public/utilities/stories/quantityselector/QuantitySelector.stories.d.ts.map +1 -1
|
@@ -1,583 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { s as select } from '../../transform-15d69d5d.js';
|
|
3
|
-
import { E as EventHandler } from '../../EventHandler-02058705.js';
|
|
4
|
-
import { a as axisBottom, b as axisLeft } from '../../axis-fbc0f7b5.js';
|
|
5
|
-
import { b as band } from '../../band-d7a07d2c.js';
|
|
6
|
-
import { l as linear } from '../../linear-f46d7e9e.js';
|
|
7
|
-
|
|
8
|
-
/* src/components/chart/BarChart.svelte generated by Svelte v3.58.0 */
|
|
9
|
-
|
|
10
|
-
function get_each_context(ctx, list, i) {
|
|
11
|
-
const child_ctx = ctx.slice();
|
|
12
|
-
child_ctx[4] = list[i];
|
|
13
|
-
return child_ctx;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// (215:0) {#if tooltipData.show}
|
|
17
|
-
function create_if_block(ctx) {
|
|
18
|
-
let div;
|
|
19
|
-
let t_value = /*tooltipData*/ ctx[2].text + "";
|
|
20
|
-
let t;
|
|
21
|
-
let div_style_value;
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
c() {
|
|
25
|
-
div = element("div");
|
|
26
|
-
t = text(t_value);
|
|
27
|
-
attr(div, "class", "tooltip");
|
|
28
|
-
attr(div, "style", div_style_value = `top: ${/*tooltipData*/ ctx[2].top}px; left: ${/*tooltipData*/ ctx[2].left}px; width: ${/*tooltipData*/ ctx[2].width}px;`);
|
|
29
|
-
},
|
|
30
|
-
m(target, anchor) {
|
|
31
|
-
insert(target, div, anchor);
|
|
32
|
-
append(div, t);
|
|
33
|
-
},
|
|
34
|
-
p(ctx, dirty) {
|
|
35
|
-
if (dirty[0] & /*tooltipData*/ 4 && t_value !== (t_value = /*tooltipData*/ ctx[2].text + "")) set_data(t, t_value);
|
|
36
|
-
|
|
37
|
-
if (dirty[0] & /*tooltipData*/ 4 && div_style_value !== (div_style_value = `top: ${/*tooltipData*/ ctx[2].top}px; left: ${/*tooltipData*/ ctx[2].left}px; width: ${/*tooltipData*/ ctx[2].width}px;`)) {
|
|
38
|
-
attr(div, "style", div_style_value);
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
d(detaching) {
|
|
42
|
-
if (detaching) detach(div);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// (225:2) {#each parsedSvgs as svg}
|
|
48
|
-
function create_each_block(ctx) {
|
|
49
|
-
let html_tag;
|
|
50
|
-
let raw_value = /*svg*/ ctx[4] + "";
|
|
51
|
-
let html_anchor;
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
c() {
|
|
55
|
-
html_tag = new HtmlTag(false);
|
|
56
|
-
html_anchor = empty();
|
|
57
|
-
html_tag.a = html_anchor;
|
|
58
|
-
},
|
|
59
|
-
m(target, anchor) {
|
|
60
|
-
html_tag.m(raw_value, target, anchor);
|
|
61
|
-
insert(target, html_anchor, anchor);
|
|
62
|
-
},
|
|
63
|
-
p(ctx, dirty) {
|
|
64
|
-
if (dirty[0] & /*parsedSvgs*/ 8 && raw_value !== (raw_value = /*svg*/ ctx[4] + "")) html_tag.p(raw_value);
|
|
65
|
-
},
|
|
66
|
-
d(detaching) {
|
|
67
|
-
if (detaching) detach(html_anchor);
|
|
68
|
-
if (detaching) html_tag.d();
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function create_fragment(ctx) {
|
|
74
|
-
let div0;
|
|
75
|
-
let t0;
|
|
76
|
-
let t1;
|
|
77
|
-
let div1;
|
|
78
|
-
let t2;
|
|
79
|
-
let text_1;
|
|
80
|
-
let if_block = /*tooltipData*/ ctx[2].show && create_if_block(ctx);
|
|
81
|
-
let each_value = /*parsedSvgs*/ ctx[3];
|
|
82
|
-
let each_blocks = [];
|
|
83
|
-
|
|
84
|
-
for (let i = 0; i < each_value.length; i += 1) {
|
|
85
|
-
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return {
|
|
89
|
-
c() {
|
|
90
|
-
div0 = element("div");
|
|
91
|
-
t0 = space();
|
|
92
|
-
if (if_block) if_block.c();
|
|
93
|
-
t1 = space();
|
|
94
|
-
div1 = element("div");
|
|
95
|
-
|
|
96
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
97
|
-
each_blocks[i].c();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
t2 = space();
|
|
101
|
-
text_1 = svg_element("text");
|
|
102
|
-
this.c = noop;
|
|
103
|
-
set_style(div0, "background-color", /*backgroundcolor*/ ctx[0]);
|
|
104
|
-
set_style(div1, "height", "0");
|
|
105
|
-
set_style(div1, "width", "0");
|
|
106
|
-
attr(div1, "class", "pattern");
|
|
107
|
-
},
|
|
108
|
-
m(target, anchor) {
|
|
109
|
-
insert(target, div0, anchor);
|
|
110
|
-
/*div0_binding*/ ctx[18](div0);
|
|
111
|
-
insert(target, t0, anchor);
|
|
112
|
-
if (if_block) if_block.m(target, anchor);
|
|
113
|
-
insert(target, t1, anchor);
|
|
114
|
-
insert(target, div1, anchor);
|
|
115
|
-
|
|
116
|
-
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
117
|
-
if (each_blocks[i]) {
|
|
118
|
-
each_blocks[i].m(div1, null);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
insert(target, t2, anchor);
|
|
123
|
-
insert(target, text_1, anchor);
|
|
124
|
-
},
|
|
125
|
-
p(ctx, dirty) {
|
|
126
|
-
if (dirty[0] & /*backgroundcolor*/ 1) {
|
|
127
|
-
set_style(div0, "background-color", /*backgroundcolor*/ ctx[0]);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (/*tooltipData*/ ctx[2].show) {
|
|
131
|
-
if (if_block) {
|
|
132
|
-
if_block.p(ctx, dirty);
|
|
133
|
-
} else {
|
|
134
|
-
if_block = create_if_block(ctx);
|
|
135
|
-
if_block.c();
|
|
136
|
-
if_block.m(t1.parentNode, t1);
|
|
137
|
-
}
|
|
138
|
-
} else if (if_block) {
|
|
139
|
-
if_block.d(1);
|
|
140
|
-
if_block = null;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (dirty[0] & /*parsedSvgs*/ 8) {
|
|
144
|
-
each_value = /*parsedSvgs*/ ctx[3];
|
|
145
|
-
let i;
|
|
146
|
-
|
|
147
|
-
for (i = 0; i < each_value.length; i += 1) {
|
|
148
|
-
const child_ctx = get_each_context(ctx, each_value, i);
|
|
149
|
-
|
|
150
|
-
if (each_blocks[i]) {
|
|
151
|
-
each_blocks[i].p(child_ctx, dirty);
|
|
152
|
-
} else {
|
|
153
|
-
each_blocks[i] = create_each_block(child_ctx);
|
|
154
|
-
each_blocks[i].c();
|
|
155
|
-
each_blocks[i].m(div1, null);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
for (; i < each_blocks.length; i += 1) {
|
|
160
|
-
each_blocks[i].d(1);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
each_blocks.length = each_value.length;
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
i: noop,
|
|
167
|
-
o: noop,
|
|
168
|
-
d(detaching) {
|
|
169
|
-
if (detaching) detach(div0);
|
|
170
|
-
/*div0_binding*/ ctx[18](null);
|
|
171
|
-
if (detaching) detach(t0);
|
|
172
|
-
if (if_block) if_block.d(detaching);
|
|
173
|
-
if (detaching) detach(t1);
|
|
174
|
-
if (detaching) detach(div1);
|
|
175
|
-
destroy_each(each_blocks, detaching);
|
|
176
|
-
if (detaching) detach(t2);
|
|
177
|
-
if (detaching) detach(text_1);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
function getParsedMargins(margins) {
|
|
183
|
-
if (margins) return JSON.parse(margins); else return {
|
|
184
|
-
top: 10,
|
|
185
|
-
right: 40,
|
|
186
|
-
bottom: 20,
|
|
187
|
-
left: 60,
|
|
188
|
-
xAxis: 20
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function instance($$self, $$props, $$invalidate) {
|
|
193
|
-
let groups;
|
|
194
|
-
let height;
|
|
195
|
-
let parsedSvgs;
|
|
196
|
-
let { data = '' } = $$props;
|
|
197
|
-
let parsedData;
|
|
198
|
-
let subgroups;
|
|
199
|
-
let { chartheight = '300' } = $$props;
|
|
200
|
-
let { backgroundcolor = '#fff' } = $$props;
|
|
201
|
-
let { scalemax = 50 } = $$props;
|
|
202
|
-
let { scalemin = 0 } = $$props;
|
|
203
|
-
let { color = '#0B96CC' } = $$props;
|
|
204
|
-
let { ticknumbers = 4 } = $$props;
|
|
205
|
-
let { tickleftformat } = $$props;
|
|
206
|
-
tickleftformat = d => `${d}`;
|
|
207
|
-
let { tickbottomformat = d => `${d}` } = $$props;
|
|
208
|
-
let { svgs } = $$props;
|
|
209
|
-
let { margins } = $$props;
|
|
210
|
-
let _data;
|
|
211
|
-
let chart;
|
|
212
|
-
let svg;
|
|
213
|
-
let hasMounted = false;
|
|
214
|
-
|
|
215
|
-
let tooltipData = {
|
|
216
|
-
show: false,
|
|
217
|
-
text: '',
|
|
218
|
-
top: 0,
|
|
219
|
-
left: 0,
|
|
220
|
-
width: 0
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
let eventHandler = new EventHandler();
|
|
224
|
-
|
|
225
|
-
function getChartWidth() {
|
|
226
|
-
let chartWidth = select(chart).style('width');
|
|
227
|
-
|
|
228
|
-
if (chartWidth === '' || !chartWidth) {
|
|
229
|
-
chartWidth = `${window.innerWidth / 2}`;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return parseInt(chartWidth);
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function getBarKeyValue(d) {
|
|
236
|
-
return subgroups.map(key => ({
|
|
237
|
-
key,
|
|
238
|
-
value: d[key].value,
|
|
239
|
-
customtooltip: d[key].customtooltip
|
|
240
|
-
}));
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function getAxes(width) {
|
|
244
|
-
const x = band().domain(groups).range([
|
|
245
|
-
0,
|
|
246
|
-
width - (getParsedMargins(margins).left / 2 + getParsedMargins(margins).right / 2)
|
|
247
|
-
]).padding(0.2);
|
|
248
|
-
|
|
249
|
-
const y = linear().domain([scalemin, scalemax]).range([height, 0]);
|
|
250
|
-
const xSubgroup = band().domain(subgroups).range([0, x.bandwidth()]).padding(0.05);
|
|
251
|
-
return { x, y, xSubgroup };
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function addRectandles(x, xSubgroup, y) {
|
|
255
|
-
svg.append('g').selectAll('g').data(parsedData).join('g').attr('transform', d => `translate(${String(x(d.group))}, 0)`).attr('class', 'bar').selectAll('rect').data(d => getBarKeyValue(d)).join('rect').attr('x', d => xSubgroup(d.key)).attr('y', () => y(0)).attr('width', xSubgroup.bandwidth()).attr('height', () => height - y(0)).style('fill', () => color).style('cursor', 'pointer').on('mouseout', (_e, chartEvent) => {
|
|
256
|
-
const others = svg.selectAll('rect').filter(function (arc) {
|
|
257
|
-
return arc != chartEvent;
|
|
258
|
-
});
|
|
259
|
-
|
|
260
|
-
others.style('opacity', 1);
|
|
261
|
-
$$invalidate(2, tooltipData.show = false, tooltipData);
|
|
262
|
-
}).on('mouseover', (e, chartEvent) => {
|
|
263
|
-
const others = svg.selectAll('rect').filter(function (arc) {
|
|
264
|
-
return arc != chartEvent;
|
|
265
|
-
});
|
|
266
|
-
|
|
267
|
-
others.style('opacity', 0.7);
|
|
268
|
-
const { left, top, width } = e.target.getBoundingClientRect();
|
|
269
|
-
|
|
270
|
-
$$invalidate(2, tooltipData = {
|
|
271
|
-
show: true,
|
|
272
|
-
text: chartEvent.customtooltip
|
|
273
|
-
? `${chartEvent.customtooltip}`
|
|
274
|
-
: `${chartEvent.key} - ${chartEvent.value}`,
|
|
275
|
-
left,
|
|
276
|
-
top: top - 50,
|
|
277
|
-
width
|
|
278
|
-
});
|
|
279
|
-
}).on('click', (_e, chartEvent) => {
|
|
280
|
-
eventHandler.dispatch('bar-clicked', chartEvent);
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
svg.selectAll('rect').transition().duration(800).attr('y', d => +d.value < 0 ? y(0) : y(+d.value)).attr('height', d => +d.value < 0
|
|
284
|
-
? y(+d.value) - y(0)
|
|
285
|
-
: height - y(+d.value + Number(scalemin))).delay((_d, i) => i * 100);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function updateAxes(x, y) {
|
|
289
|
-
svg.select('.x-axis').call(axisBottom(x).tickFormat(tickbottomformat));
|
|
290
|
-
svg.select('.y-axis').call(axisLeft(y).ticks(ticknumbers).tickFormat(tickleftformat));
|
|
291
|
-
const width = getChartWidth();
|
|
292
|
-
svg.selectAll('.y-axis .tick line').attr('stroke', '#EEEDEA').attr('stroke-width', '1px').attr('x2', width);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
function render() {
|
|
296
|
-
const width = getChartWidth();
|
|
297
|
-
const { x, y, xSubgroup } = getAxes(width);
|
|
298
|
-
$$invalidate(4, svg = select(chart).append('svg').attr('width', width).attr('height', Number(height) + Number(getParsedMargins(margins).top) + Number(getParsedMargins(margins).bottom) + Number(getParsedMargins(margins).xAxis)).attr('id', 'svg-chart').append('g').attr('transform', `translate(${getParsedMargins(margins).left / 2 + getParsedMargins(margins).right / 2},${getParsedMargins(margins).top})`));
|
|
299
|
-
svg.append('g').attr('transform', `translate(0, ${Number(height) + Number(getParsedMargins(margins).xAxis)})`).call(axisBottom(x)).attr('class', 'x-axis').attr('stroke-width', '0');
|
|
300
|
-
svg.append('g').call(axisLeft(y).ticks(ticknumbers).tickFormat(tickleftformat)).attr('class', 'y-axis').attr('stroke-width', '0');
|
|
301
|
-
addRectandles(x, xSubgroup, y);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function update() {
|
|
305
|
-
var _a;
|
|
306
|
-
const width = getChartWidth();
|
|
307
|
-
|
|
308
|
-
(_a = chart.querySelector('#svg-chart')) === null || _a === void 0
|
|
309
|
-
? void 0
|
|
310
|
-
: _a.setAttribute('width', `${width}px`);
|
|
311
|
-
|
|
312
|
-
const { x, y, xSubgroup } = getAxes(width);
|
|
313
|
-
updateAxes(x, y);
|
|
314
|
-
svg.selectAll('.bar').remove();
|
|
315
|
-
addRectandles(x, xSubgroup, y);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function resize() {
|
|
319
|
-
var _a;
|
|
320
|
-
|
|
321
|
-
if (_data) {
|
|
322
|
-
const width = getChartWidth();
|
|
323
|
-
|
|
324
|
-
(_a = chart.querySelector('#svg-chart')) === null || _a === void 0
|
|
325
|
-
? void 0
|
|
326
|
-
: _a.setAttribute('width', `${width}px`);
|
|
327
|
-
|
|
328
|
-
const { x, y, xSubgroup } = getAxes(width);
|
|
329
|
-
updateAxes(x, y);
|
|
330
|
-
svg.selectAll('.bar').data(parsedData).attr('transform', d => `translate(${Number(x(d.group))}, 0)`).selectAll('rect').data(d => getBarKeyValue(d)).attr('x', d => xSubgroup(d.key)).attr('width', xSubgroup.bandwidth());
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
onMount(() => {
|
|
335
|
-
const resizeObserver = new ResizeObserver(resize);
|
|
336
|
-
resizeObserver.observe(chart);
|
|
337
|
-
$$invalidate(17, hasMounted = true);
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
function div0_binding($$value) {
|
|
341
|
-
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
342
|
-
chart = $$value;
|
|
343
|
-
$$invalidate(1, chart);
|
|
344
|
-
});
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
$$self.$$set = $$props => {
|
|
348
|
-
if ('data' in $$props) $$invalidate(6, data = $$props.data);
|
|
349
|
-
if ('chartheight' in $$props) $$invalidate(7, chartheight = $$props.chartheight);
|
|
350
|
-
if ('backgroundcolor' in $$props) $$invalidate(0, backgroundcolor = $$props.backgroundcolor);
|
|
351
|
-
if ('scalemax' in $$props) $$invalidate(8, scalemax = $$props.scalemax);
|
|
352
|
-
if ('scalemin' in $$props) $$invalidate(9, scalemin = $$props.scalemin);
|
|
353
|
-
if ('color' in $$props) $$invalidate(10, color = $$props.color);
|
|
354
|
-
if ('ticknumbers' in $$props) $$invalidate(11, ticknumbers = $$props.ticknumbers);
|
|
355
|
-
if ('tickleftformat' in $$props) $$invalidate(5, tickleftformat = $$props.tickleftformat);
|
|
356
|
-
if ('tickbottomformat' in $$props) $$invalidate(12, tickbottomformat = $$props.tickbottomformat);
|
|
357
|
-
if ('svgs' in $$props) $$invalidate(13, svgs = $$props.svgs);
|
|
358
|
-
if ('margins' in $$props) $$invalidate(14, margins = $$props.margins);
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
$$self.$$.update = () => {
|
|
362
|
-
if ($$self.$$.dirty[0] & /*data*/ 64) {
|
|
363
|
-
$$invalidate(15, parsedData = data ? JSON.parse(data) : []);
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
if ($$self.$$.dirty[0] & /*parsedData*/ 32768) {
|
|
367
|
-
groups = parsedData.map(d => d.group);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
if ($$self.$$.dirty[0] & /*parsedData*/ 32768) {
|
|
371
|
-
subgroups = parsedData[0]
|
|
372
|
-
? Object.keys(parsedData[0]).filter(d => d !== 'group')
|
|
373
|
-
: [];
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
if ($$self.$$.dirty[0] & /*chartheight*/ 128) {
|
|
377
|
-
height = parseInt(chartheight, 10);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
if ($$self.$$.dirty[0] & /*svgs*/ 8192) {
|
|
381
|
-
$$invalidate(3, parsedSvgs = svgs ? JSON.parse(svgs) : []);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
if ($$self.$$.dirty[0] & /*data, hasMounted, _data*/ 196672) {
|
|
385
|
-
if (data.length > 0 && hasMounted) {
|
|
386
|
-
if (!_data) {
|
|
387
|
-
render();
|
|
388
|
-
$$invalidate(16, _data = data);
|
|
389
|
-
} else if (data !== _data) {
|
|
390
|
-
update();
|
|
391
|
-
$$invalidate(16, _data = data);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
};
|
|
396
|
-
|
|
397
|
-
return [
|
|
398
|
-
backgroundcolor,
|
|
399
|
-
chart,
|
|
400
|
-
tooltipData,
|
|
401
|
-
parsedSvgs,
|
|
402
|
-
svg,
|
|
403
|
-
tickleftformat,
|
|
404
|
-
data,
|
|
405
|
-
chartheight,
|
|
406
|
-
scalemax,
|
|
407
|
-
scalemin,
|
|
408
|
-
color,
|
|
409
|
-
ticknumbers,
|
|
410
|
-
tickbottomformat,
|
|
411
|
-
svgs,
|
|
412
|
-
margins,
|
|
413
|
-
parsedData,
|
|
414
|
-
_data,
|
|
415
|
-
hasMounted,
|
|
416
|
-
div0_binding
|
|
417
|
-
];
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
class BarChart extends SvelteElement {
|
|
421
|
-
constructor(options) {
|
|
422
|
-
super();
|
|
423
|
-
const style = document.createElement('style');
|
|
424
|
-
style.textContent = `.tooltip{height:auto;background-color:#4d4d4d;border-radius:4px;color:#ffffff;text-align:center;padding:0.5rem 0;position:absolute}.pattern{z-index:-1;position:relative}text{font-family:"LeroyMerlin", sans-serif;font-size:0.875rem;color:#4d4d4d}`;
|
|
425
|
-
this.shadowRoot.appendChild(style);
|
|
426
|
-
|
|
427
|
-
init(
|
|
428
|
-
this,
|
|
429
|
-
{
|
|
430
|
-
target: this.shadowRoot,
|
|
431
|
-
props: attribute_to_object(this.attributes),
|
|
432
|
-
customElement: true
|
|
433
|
-
},
|
|
434
|
-
instance,
|
|
435
|
-
create_fragment,
|
|
436
|
-
safe_not_equal,
|
|
437
|
-
{
|
|
438
|
-
data: 6,
|
|
439
|
-
chartheight: 7,
|
|
440
|
-
backgroundcolor: 0,
|
|
441
|
-
scalemax: 8,
|
|
442
|
-
scalemin: 9,
|
|
443
|
-
color: 10,
|
|
444
|
-
ticknumbers: 11,
|
|
445
|
-
tickleftformat: 5,
|
|
446
|
-
tickbottomformat: 12,
|
|
447
|
-
svgs: 13,
|
|
448
|
-
margins: 14
|
|
449
|
-
},
|
|
450
|
-
null,
|
|
451
|
-
[-1, -1]
|
|
452
|
-
);
|
|
453
|
-
|
|
454
|
-
if (options) {
|
|
455
|
-
if (options.target) {
|
|
456
|
-
insert(options.target, this, options.anchor);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
if (options.props) {
|
|
460
|
-
this.$set(options.props);
|
|
461
|
-
flush();
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
static get observedAttributes() {
|
|
467
|
-
return [
|
|
468
|
-
"data",
|
|
469
|
-
"chartheight",
|
|
470
|
-
"backgroundcolor",
|
|
471
|
-
"scalemax",
|
|
472
|
-
"scalemin",
|
|
473
|
-
"color",
|
|
474
|
-
"ticknumbers",
|
|
475
|
-
"tickleftformat",
|
|
476
|
-
"tickbottomformat",
|
|
477
|
-
"svgs",
|
|
478
|
-
"margins"
|
|
479
|
-
];
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
get data() {
|
|
483
|
-
return this.$$.ctx[6];
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
set data(data) {
|
|
487
|
-
this.$$set({ data });
|
|
488
|
-
flush();
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
get chartheight() {
|
|
492
|
-
return this.$$.ctx[7];
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
set chartheight(chartheight) {
|
|
496
|
-
this.$$set({ chartheight });
|
|
497
|
-
flush();
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
get backgroundcolor() {
|
|
501
|
-
return this.$$.ctx[0];
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
set backgroundcolor(backgroundcolor) {
|
|
505
|
-
this.$$set({ backgroundcolor });
|
|
506
|
-
flush();
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
get scalemax() {
|
|
510
|
-
return this.$$.ctx[8];
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
set scalemax(scalemax) {
|
|
514
|
-
this.$$set({ scalemax });
|
|
515
|
-
flush();
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
get scalemin() {
|
|
519
|
-
return this.$$.ctx[9];
|
|
520
|
-
}
|
|
521
|
-
|
|
522
|
-
set scalemin(scalemin) {
|
|
523
|
-
this.$$set({ scalemin });
|
|
524
|
-
flush();
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
get color() {
|
|
528
|
-
return this.$$.ctx[10];
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
set color(color) {
|
|
532
|
-
this.$$set({ color });
|
|
533
|
-
flush();
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
get ticknumbers() {
|
|
537
|
-
return this.$$.ctx[11];
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
set ticknumbers(ticknumbers) {
|
|
541
|
-
this.$$set({ ticknumbers });
|
|
542
|
-
flush();
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
get tickleftformat() {
|
|
546
|
-
return this.$$.ctx[5];
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
set tickleftformat(tickleftformat) {
|
|
550
|
-
this.$$set({ tickleftformat });
|
|
551
|
-
flush();
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
get tickbottomformat() {
|
|
555
|
-
return this.$$.ctx[12];
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
set tickbottomformat(tickbottomformat) {
|
|
559
|
-
this.$$set({ tickbottomformat });
|
|
560
|
-
flush();
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
get svgs() {
|
|
564
|
-
return this.$$.ctx[13];
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
set svgs(svgs) {
|
|
568
|
-
this.$$set({ svgs });
|
|
569
|
-
flush();
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
get margins() {
|
|
573
|
-
return this.$$.ctx[14];
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
set margins(margins) {
|
|
577
|
-
this.$$set({ margins });
|
|
578
|
-
flush();
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
export { BarChart as default };
|
|
1
|
+
import{S as t,i as e,a as r,b as s,f as a,s as o,e as i,d as n,T as c,n as l,y as u,g as d,o as m,J as h,a1 as g,t as f,j as p,k as $,K as x,v as b,Z as k}from"../../index-c33b3772.js";import{s as y}from"../../transform-15d69d5d.js";import{E as v}from"../../EventHandler-02058705.js";import{a as w,b as A}from"../../axis-fbc0f7b5.js";import{b as N}from"../../band-d7a07d2c.js";import{l as S}from"../../linear-f46d7e9e.js";function j(t,e,r){const s=t.slice();return s[4]=e[r],s}function E(t){let e,r,a,o=t[2].text+"";return{c(){e=i("div"),r=f(o),d(e,"class","tooltip"),d(e,"style",a=`top: ${t[2].top}px; left: ${t[2].left}px; width: ${t[2].width}px;`)},m(t,a){s(t,e,a),p(e,r)},p(t,s){4&s[0]&&o!==(o=t[2].text+"")&&$(r,o),4&s[0]&&a!==(a=`top: ${t[2].top}px; left: ${t[2].left}px; width: ${t[2].width}px;`)&&d(e,"style",a)},d(t){t&&m(e)}}}function C(t){let e,r,a=t[4]+"";return{c(){e=new k(!1),r=x(),e.a=r},m(t,o){e.m(a,t,o),s(t,r,o)},p(t,r){8&r[0]&&a!==(a=t[4]+"")&&e.p(a)},d(t){t&&m(r),t&&e.d()}}}function O(t){let e,r,a,o,g,f,p=t[2].show&&E(t),$=t[3],x=[];for(let e=0;e<$.length;e+=1)x[e]=C(j(t,$,e));return{c(){e=i("div"),r=n(),p&&p.c(),a=n(),o=i("div");for(let t=0;t<x.length;t+=1)x[t].c();g=n(),f=c("text"),this.c=l,u(e,"background-color",t[0]),u(o,"height","0"),u(o,"width","0"),d(o,"class","pattern")},m(i,n){s(i,e,n),t[18](e),s(i,r,n),p&&p.m(i,n),s(i,a,n),s(i,o,n);for(let t=0;t<x.length;t+=1)x[t]&&x[t].m(o,null);s(i,g,n),s(i,f,n)},p(t,r){if(1&r[0]&&u(e,"background-color",t[0]),t[2].show?p?p.p(t,r):(p=E(t),p.c(),p.m(a.parentNode,a)):p&&(p.d(1),p=null),8&r[0]){let e;for($=t[3],e=0;e<$.length;e+=1){const s=j(t,$,e);x[e]?x[e].p(s,r):(x[e]=C(s),x[e].c(),x[e].m(o,null))}for(;e<x.length;e+=1)x[e].d(1);x.length=$.length}},i:l,o:l,d(s){s&&m(e),t[18](null),s&&m(r),p&&p.d(s),s&&m(a),s&&m(o),h(x,s),s&&m(g),s&&m(f)}}}function J(t){return t?JSON.parse(t):{top:10,right:40,bottom:20,left:60,xAxis:20}}function R(t,e,r){let s,a,o,i,n,{data:c=""}=e,{chartheight:l="300"}=e,{backgroundcolor:u="#fff"}=e,{scalemax:d=50}=e,{scalemin:m=0}=e,{color:h="#0B96CC"}=e,{ticknumbers:f=4}=e,{tickleftformat:p}=e;p=t=>`${t}`;let $,x,k,{tickbottomformat:j=(t=>`${t}`)}=e,{svgs:E}=e,{margins:C}=e,O=!1,R={show:!1,text:"",top:0,left:0,width:0},z=new v;function F(){let t=y(x).style("width");return""!==t&&t||(t=""+window.innerWidth/2),parseInt(t)}function q(t){return n.map((e=>({key:e,value:t[e].value,customtooltip:t[e].customtooltip})))}function B(t){const e=N().domain(s).range([0,t-(J(C).left/2+J(C).right/2)]).padding(.2),r=S().domain([m,d]).range([a,0]),o=N().domain(n).range([0,e.bandwidth()]).padding(.05);return{x:e,y:r,xSubgroup:o}}function I(t,e,s){k.append("g").selectAll("g").data(i).join("g").attr("transform",(e=>`translate(${String(t(e.group))}, 0)`)).attr("class","bar").selectAll("rect").data((t=>q(t))).join("rect").attr("x",(t=>e(t.key))).attr("y",(()=>s(0))).attr("width",e.bandwidth()).attr("height",(()=>a-s(0))).style("fill",(()=>h)).style("cursor","pointer").on("mouseout",((t,e)=>{k.selectAll("rect").filter((function(t){return t!=e})).style("opacity",1),r(2,R.show=!1,R)})).on("mouseover",((t,e)=>{k.selectAll("rect").filter((function(t){return t!=e})).style("opacity",.7);const{left:s,top:a,width:o}=t.target.getBoundingClientRect();r(2,R={show:!0,text:e.customtooltip?`${e.customtooltip}`:`${e.key} - ${e.value}`,left:s,top:a-50,width:o})})).on("click",((t,e)=>{z.dispatch("bar-clicked",e)})),k.selectAll("rect").transition().duration(800).attr("y",(t=>+t.value<0?s(0):s(+t.value))).attr("height",(t=>+t.value<0?s(+t.value)-s(0):a-s(+t.value+Number(m)))).delay(((t,e)=>100*e))}function D(t,e){k.select(".x-axis").call(w(t).tickFormat(j)),k.select(".y-axis").call(A(e).ticks(f).tickFormat(p));const r=F();k.selectAll(".y-axis .tick line").attr("stroke","#EEEDEA").attr("stroke-width","1px").attr("x2",r)}function H(){var t;if($){const e=F();null===(t=x.querySelector("#svg-chart"))||void 0===t||t.setAttribute("width",`${e}px`);const{x:r,y:s,xSubgroup:a}=B(e);D(r,s),k.selectAll(".bar").data(i).attr("transform",(t=>`translate(${Number(r(t.group))}, 0)`)).selectAll("rect").data((t=>q(t))).attr("x",(t=>a(t.key))).attr("width",a.bandwidth())}}return g((()=>{new ResizeObserver(H).observe(x),r(17,O=!0)})),t.$$set=t=>{"data"in t&&r(6,c=t.data),"chartheight"in t&&r(7,l=t.chartheight),"backgroundcolor"in t&&r(0,u=t.backgroundcolor),"scalemax"in t&&r(8,d=t.scalemax),"scalemin"in t&&r(9,m=t.scalemin),"color"in t&&r(10,h=t.color),"ticknumbers"in t&&r(11,f=t.ticknumbers),"tickleftformat"in t&&r(5,p=t.tickleftformat),"tickbottomformat"in t&&r(12,j=t.tickbottomformat),"svgs"in t&&r(13,E=t.svgs),"margins"in t&&r(14,C=t.margins)},t.$$.update=()=>{64&t.$$.dirty[0]&&r(15,i=c?JSON.parse(c):[]),32768&t.$$.dirty[0]&&(s=i.map((t=>t.group))),32768&t.$$.dirty[0]&&(n=i[0]?Object.keys(i[0]).filter((t=>"group"!==t)):[]),128&t.$$.dirty[0]&&(a=parseInt(l,10)),8192&t.$$.dirty[0]&&r(3,o=E?JSON.parse(E):[]),196672&t.$$.dirty[0]&&c.length>0&&O&&($?c!==$&&(!function(){var t;const e=F();null===(t=x.querySelector("#svg-chart"))||void 0===t||t.setAttribute("width",`${e}px`);const{x:r,y:s,xSubgroup:a}=B(e);D(r,s),k.selectAll(".bar").remove(),I(r,a,s)}(),r(16,$=c)):(!function(){const t=F(),{x:e,y:s,xSubgroup:o}=B(t);r(4,k=y(x).append("svg").attr("width",t).attr("height",Number(a)+Number(J(C).top)+Number(J(C).bottom)+Number(J(C).xAxis)).attr("id","svg-chart").append("g").attr("transform",`translate(${J(C).left/2+J(C).right/2},${J(C).top})`)),k.append("g").attr("transform",`translate(0, ${Number(a)+Number(J(C).xAxis)})`).call(w(e)).attr("class","x-axis").attr("stroke-width","0"),k.append("g").call(A(s).ticks(f).tickFormat(p)).attr("class","y-axis").attr("stroke-width","0"),I(e,o,s)}(),r(16,$=c)))},[u,x,R,o,k,p,c,l,d,m,h,f,j,E,C,i,$,O,function(t){b[t?"unshift":"push"]((()=>{x=t,r(1,x)}))}]}class z extends t{constructor(t){super();const i=document.createElement("style");i.textContent='.tooltip{height:auto;background-color:#4d4d4d;border-radius:4px;color:#ffffff;text-align:center;padding:0.5rem 0;position:absolute}.pattern{z-index:-1;position:relative}text{font-family:"LeroyMerlin", sans-serif;font-size:0.875rem;color:#4d4d4d}',this.shadowRoot.appendChild(i),e(this,{target:this.shadowRoot,props:r(this.attributes),customElement:!0},R,O,o,{data:6,chartheight:7,backgroundcolor:0,scalemax:8,scalemin:9,color:10,ticknumbers:11,tickleftformat:5,tickbottomformat:12,svgs:13,margins:14},null,[-1,-1]),t&&(t.target&&s(t.target,this,t.anchor),t.props&&(this.$set(t.props),a()))}static get observedAttributes(){return["data","chartheight","backgroundcolor","scalemax","scalemin","color","ticknumbers","tickleftformat","tickbottomformat","svgs","margins"]}get data(){return this.$$.ctx[6]}set data(t){this.$$set({data:t}),a()}get chartheight(){return this.$$.ctx[7]}set chartheight(t){this.$$set({chartheight:t}),a()}get backgroundcolor(){return this.$$.ctx[0]}set backgroundcolor(t){this.$$set({backgroundcolor:t}),a()}get scalemax(){return this.$$.ctx[8]}set scalemax(t){this.$$set({scalemax:t}),a()}get scalemin(){return this.$$.ctx[9]}set scalemin(t){this.$$set({scalemin:t}),a()}get color(){return this.$$.ctx[10]}set color(t){this.$$set({color:t}),a()}get ticknumbers(){return this.$$.ctx[11]}set ticknumbers(t){this.$$set({ticknumbers:t}),a()}get tickleftformat(){return this.$$.ctx[5]}set tickleftformat(t){this.$$set({tickleftformat:t}),a()}get tickbottomformat(){return this.$$.ctx[12]}set tickbottomformat(t){this.$$set({tickbottomformat:t}),a()}get svgs(){return this.$$.ctx[13]}set svgs(t){this.$$set({svgs:t}),a()}get margins(){return this.$$.ctx[14]}set margins(t){this.$$set({margins:t}),a()}}export{z as default};
|
|
583
2
|
//# sourceMappingURL=BarChart.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarChart.js","sources":["../../../src/components/chart/BarChart.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n import {\n select,\n scaleBand,\n scaleLinear,\n axisBottom,\n axisLeft,\n Selection,\n ScaleBand,\n ScaleLinear,\n } from 'd3';\n import { onMount } from 'svelte';\n import type { BarData, BarKeyValue, BarMargin } from './bar-chart.types';\n import { EventHandler } from '../../utilities/EventHandler';\n\n export let data = '';\n let parsedData: BarData[];\n let subgroups: string[];\n $: parsedData = data ? (JSON.parse(data) as BarData[]) : [];\n $: groups = parsedData.map((d: BarData) => d.group);\n $: subgroups = parsedData[0]\n ? Object.keys(parsedData[0]).filter((d: string) => d !== 'group')\n : [];\n\n export let chartheight = '300';\n $: height = parseInt(chartheight, 10);\n\n export let backgroundcolor = '#fff';\n export let scalemax = 50;\n export let scalemin = 0;\n export let color = '#0B96CC';\n export let ticknumbers = 4;\n export let tickleftformat: (d: number, i: number) => string;\n tickleftformat = (d) => `${d}`;\n export let tickbottomformat: (d: number, i: number) => string = (d) => `${d}`;\n\n export let svgs: string;\n $: parsedSvgs = svgs ? (JSON.parse(svgs) as SVGElement[]) : [];\n\n export let margins: string;\n\n let _data: string;\n let chart: HTMLDivElement;\n let svg: Selection<SVGGElement, any, any, any>;\n let hasMounted = false;\n let tooltipData = { show: false, text: '', top: 0, left: 0, width: 0 };\n let eventHandler = new EventHandler();\n\n $: if (data.length > 0 && hasMounted) {\n if (!_data) {\n render();\n _data = data;\n } else if (data !== _data) {\n update();\n _data = data;\n }\n }\n\n function getParsedMargins(margins: string): BarMargin {\n if (margins) return JSON.parse(margins) as BarMargin;\n else\n return {\n top: 10,\n right: 40,\n bottom: 20,\n left: 60,\n xAxis: 20,\n } as BarMargin;\n }\n\n function getChartWidth() {\n let chartWidth = select(chart).style('width');\n if (chartWidth === '' || !chartWidth) {\n chartWidth = `${window.innerWidth / 2}`;\n }\n return parseInt(chartWidth);\n }\n\n function getBarKeyValue(d: BarData): BarKeyValue[] {\n return subgroups.map((key) => ({\n key: key,\n value: d[key].value,\n customtooltip: d[key].customtooltip,\n }));\n }\n\n function getAxes(width: number) {\n const x = scaleBand()\n .domain(groups)\n .range([\n 0,\n width -\n (getParsedMargins(margins).left / 2 +\n getParsedMargins(margins).right / 2),\n ])\n .padding(0.2);\n const y = scaleLinear().domain([scalemin, scalemax]).range([height, 0]);\n const xSubgroup = scaleBand()\n .domain(subgroups)\n .range([0, x.bandwidth()])\n .padding(0.05);\n return { x, y, xSubgroup };\n }\n\n function addRectandles(\n x: ScaleBand<string>,\n xSubgroup: ScaleBand<string>,\n y: ScaleLinear<number, number, never>,\n ) {\n svg\n .append('g')\n .selectAll('g')\n .data(parsedData)\n .join('g')\n .attr('transform', (d) => `translate(${String(x(d.group))}, 0)`)\n .attr('class', 'bar')\n .selectAll('rect')\n .data((d) => getBarKeyValue(d))\n .join('rect')\n .attr('x', (d) => xSubgroup(d.key)!)\n .attr('y', () => y(0))\n .attr('width', xSubgroup.bandwidth())\n .attr('height', () => height - y(0))\n .style('fill', () => color)\n .style('cursor', 'pointer')\n .on('mouseout', (_e: MouseEvent, chartEvent: BarKeyValue) => {\n const others = svg.selectAll('rect').filter(function (arc) {\n return arc != chartEvent;\n });\n others.style('opacity', 1);\n tooltipData.show = false;\n })\n .on('mouseover', (e: MouseEvent, chartEvent: BarKeyValue) => {\n const others = svg.selectAll('rect').filter(function (arc) {\n return arc != chartEvent;\n });\n others.style('opacity', 0.7);\n const { left, top, width } = (\n e.target as HTMLElement\n ).getBoundingClientRect();\n tooltipData = {\n show: true,\n text: chartEvent.customtooltip\n ? `${chartEvent.customtooltip}`\n : `${chartEvent.key} - ${chartEvent.value}`,\n left: left,\n top: top - 50,\n width,\n };\n })\n .on('click', (_e: MouseEvent, chartEvent: BarKeyValue) => {\n eventHandler.dispatch('bar-clicked', chartEvent);\n });\n\n svg\n .selectAll<SVGElement, BarKeyValue>('rect')\n .transition()\n .duration(800)\n .attr('y', (d) => (+d.value < 0 ? y(0) : y(+d.value)))\n .attr('height', (d) =>\n +d.value < 0\n ? y(+d.value) - y(0)\n : height - y(+d.value + Number(scalemin)),\n )\n .delay((_d, i) => i * 100);\n }\n\n function updateAxes(\n x: ScaleBand<string>,\n y: ScaleLinear<number, number, never>,\n ) {\n svg\n .select('.x-axis')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n .call((axisBottom(x) as any).tickFormat(tickbottomformat));\n svg\n .select('.y-axis')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n .call((axisLeft(y) as any).ticks(ticknumbers).tickFormat(tickleftformat));\n\n const width = getChartWidth();\n svg\n .selectAll('.y-axis .tick line')\n .attr('stroke', '#EEEDEA')\n .attr('stroke-width', '1px')\n .attr('x2', width);\n }\n\n function render() {\n const width = getChartWidth();\n const { x, y, xSubgroup } = getAxes(width);\n\n svg = select<HTMLElement, any>(chart)\n .append('svg')\n .attr('width', width)\n .attr(\n 'height',\n Number(height) +\n Number(getParsedMargins(margins).top) +\n Number(getParsedMargins(margins).bottom) +\n Number(getParsedMargins(margins).xAxis),\n )\n .attr('id', 'svg-chart')\n .append('g')\n .attr(\n 'transform',\n `translate(${\n getParsedMargins(margins).left / 2 +\n getParsedMargins(margins).right / 2\n },${getParsedMargins(margins).top})`,\n );\n\n svg\n .append('g')\n .attr(\n 'transform',\n `translate(0, ${\n Number(height) + Number(getParsedMargins(margins).xAxis)\n })`,\n )\n .call(axisBottom(x))\n .attr('class', 'x-axis')\n .attr('stroke-width', '0');\n\n svg\n .append('g')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n .call((axisLeft(y) as any).ticks(ticknumbers).tickFormat(tickleftformat))\n .attr('class', 'y-axis')\n .attr('stroke-width', '0');\n\n addRectandles(x, xSubgroup, y);\n }\n\n function update() {\n const width = getChartWidth();\n chart.querySelector('#svg-chart')?.setAttribute('width', `${width}px`);\n\n const { x, y, xSubgroup } = getAxes(width);\n updateAxes(x, y);\n svg.selectAll('.bar').remove();\n addRectandles(x, xSubgroup, y);\n }\n\n function resize() {\n if (_data) {\n const width = getChartWidth();\n chart.querySelector('#svg-chart')?.setAttribute('width', `${width}px`);\n\n const { x, y, xSubgroup } = getAxes(width);\n updateAxes(x, y);\n\n svg\n .selectAll('.bar')\n .data(parsedData)\n .attr('transform', (d) => `translate(${Number(x(d.group))}, 0)`)\n .selectAll<SVGElement, BarKeyValue>('rect')\n .data((d) => getBarKeyValue(d))\n .attr('x', (d) => xSubgroup(d.key)!)\n .attr('width', xSubgroup.bandwidth());\n }\n }\n\n onMount(() => {\n const resizeObserver = new ResizeObserver(resize);\n resizeObserver.observe(chart);\n hasMounted = true;\n });\n</script>\n\n<div bind:this={chart} style=\"background-color: {backgroundcolor};\" />\n\n{#if tooltipData.show}\n <div\n class=\"tooltip\"\n style={`top: ${tooltipData.top}px; left: ${tooltipData.left}px; width: ${tooltipData.width}px;`}\n >\n {tooltipData.text}\n </div>\n{/if}\n\n<div style=\"height: 0; width: 0;\" class=\"pattern\">\n {#each parsedSvgs as svg}\n {@html svg}\n {/each}\n</div>\n<text />\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/_all-settings';\n\n .tooltip {\n height: auto;\n background-color: $color-grey-700;\n border-radius: 4px;\n color: $color-grey-000;\n text-align: center;\n padding: magic-unit-rem(0.5) 0;\n position: absolute;\n }\n\n .pattern {\n z-index: -1;\n position: relative;\n }\n\n text {\n font-family: 'LeroyMerlin', sans-serif;\n font-size: $size-font-04;\n color: $color-grey-700;\n }\n</style>\n"],"names":["scaleBand","scaleLinear"],"mappings":";;;;;;;;;;;;;;;;;;AAuRK,CAAA,IAAA,OAAA,mBAAA,GAAW,IAAC,IAAI,GAAA,EAAA,CAAA;;;;;;;;;gEAFF,GAAW,CAAA,CAAA,CAAA,CAAC,GAAG,CAAa,UAAA,kBAAA,GAAW,IAAC,IAAI,CAAA,WAAA,kBAAc,GAAW,CAAA,CAAA,CAAA,CAAC,KAAK,CAAA,GAAA,CAAA,CAAA,CAAA;;;GAF5F,MAKK,CAAA,MAAA,EAAA,GAAA,EAAA,MAAA,CAAA,CAAA;;;;AADF,GAAA,IAAA,KAAA,CAAA,CAAA,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"BarChart.js","sources":["../../../src/components/chart/BarChart.svelte"],"sourcesContent":["<svelte:options tag={null} />\n\n<script lang=\"ts\">\n import {\n select,\n scaleBand,\n scaleLinear,\n axisBottom,\n axisLeft,\n Selection,\n ScaleBand,\n ScaleLinear,\n } from 'd3';\n import { onMount } from 'svelte';\n import type { BarData, BarKeyValue, BarMargin } from './bar-chart.types';\n import { EventHandler } from '../../utilities/EventHandler';\n\n export let data = '';\n let parsedData: BarData[];\n let subgroups: string[];\n $: parsedData = data ? (JSON.parse(data) as BarData[]) : [];\n $: groups = parsedData.map((d: BarData) => d.group);\n $: subgroups = parsedData[0]\n ? Object.keys(parsedData[0]).filter((d: string) => d !== 'group')\n : [];\n\n export let chartheight = '300';\n $: height = parseInt(chartheight, 10);\n\n export let backgroundcolor = '#fff';\n export let scalemax = 50;\n export let scalemin = 0;\n export let color = '#0B96CC';\n export let ticknumbers = 4;\n export let tickleftformat: (d: number, i: number) => string;\n tickleftformat = (d) => `${d}`;\n export let tickbottomformat: (d: number, i: number) => string = (d) => `${d}`;\n\n export let svgs: string;\n $: parsedSvgs = svgs ? (JSON.parse(svgs) as SVGElement[]) : [];\n\n export let margins: string;\n\n let _data: string;\n let chart: HTMLDivElement;\n let svg: Selection<SVGGElement, any, any, any>;\n let hasMounted = false;\n let tooltipData = { show: false, text: '', top: 0, left: 0, width: 0 };\n let eventHandler = new EventHandler();\n\n $: if (data.length > 0 && hasMounted) {\n if (!_data) {\n render();\n _data = data;\n } else if (data !== _data) {\n update();\n _data = data;\n }\n }\n\n function getParsedMargins(margins: string): BarMargin {\n if (margins) return JSON.parse(margins) as BarMargin;\n else\n return {\n top: 10,\n right: 40,\n bottom: 20,\n left: 60,\n xAxis: 20,\n } as BarMargin;\n }\n\n function getChartWidth() {\n let chartWidth = select(chart).style('width');\n if (chartWidth === '' || !chartWidth) {\n chartWidth = `${window.innerWidth / 2}`;\n }\n return parseInt(chartWidth);\n }\n\n function getBarKeyValue(d: BarData): BarKeyValue[] {\n return subgroups.map((key) => ({\n key: key,\n value: d[key].value,\n customtooltip: d[key].customtooltip,\n }));\n }\n\n function getAxes(width: number) {\n const x = scaleBand()\n .domain(groups)\n .range([\n 0,\n width -\n (getParsedMargins(margins).left / 2 +\n getParsedMargins(margins).right / 2),\n ])\n .padding(0.2);\n const y = scaleLinear().domain([scalemin, scalemax]).range([height, 0]);\n const xSubgroup = scaleBand()\n .domain(subgroups)\n .range([0, x.bandwidth()])\n .padding(0.05);\n return { x, y, xSubgroup };\n }\n\n function addRectandles(\n x: ScaleBand<string>,\n xSubgroup: ScaleBand<string>,\n y: ScaleLinear<number, number, never>,\n ) {\n svg\n .append('g')\n .selectAll('g')\n .data(parsedData)\n .join('g')\n .attr('transform', (d) => `translate(${String(x(d.group))}, 0)`)\n .attr('class', 'bar')\n .selectAll('rect')\n .data((d) => getBarKeyValue(d))\n .join('rect')\n .attr('x', (d) => xSubgroup(d.key)!)\n .attr('y', () => y(0))\n .attr('width', xSubgroup.bandwidth())\n .attr('height', () => height - y(0))\n .style('fill', () => color)\n .style('cursor', 'pointer')\n .on('mouseout', (_e: MouseEvent, chartEvent: BarKeyValue) => {\n const others = svg.selectAll('rect').filter(function (arc) {\n return arc != chartEvent;\n });\n others.style('opacity', 1);\n tooltipData.show = false;\n })\n .on('mouseover', (e: MouseEvent, chartEvent: BarKeyValue) => {\n const others = svg.selectAll('rect').filter(function (arc) {\n return arc != chartEvent;\n });\n others.style('opacity', 0.7);\n const { left, top, width } = (\n e.target as HTMLElement\n ).getBoundingClientRect();\n tooltipData = {\n show: true,\n text: chartEvent.customtooltip\n ? `${chartEvent.customtooltip}`\n : `${chartEvent.key} - ${chartEvent.value}`,\n left: left,\n top: top - 50,\n width,\n };\n })\n .on('click', (_e: MouseEvent, chartEvent: BarKeyValue) => {\n eventHandler.dispatch('bar-clicked', chartEvent);\n });\n\n svg\n .selectAll<SVGElement, BarKeyValue>('rect')\n .transition()\n .duration(800)\n .attr('y', (d) => (+d.value < 0 ? y(0) : y(+d.value)))\n .attr('height', (d) =>\n +d.value < 0\n ? y(+d.value) - y(0)\n : height - y(+d.value + Number(scalemin)),\n )\n .delay((_d, i) => i * 100);\n }\n\n function updateAxes(\n x: ScaleBand<string>,\n y: ScaleLinear<number, number, never>,\n ) {\n svg\n .select('.x-axis')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n .call((axisBottom(x) as any).tickFormat(tickbottomformat));\n svg\n .select('.y-axis')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n .call((axisLeft(y) as any).ticks(ticknumbers).tickFormat(tickleftformat));\n\n const width = getChartWidth();\n svg\n .selectAll('.y-axis .tick line')\n .attr('stroke', '#EEEDEA')\n .attr('stroke-width', '1px')\n .attr('x2', width);\n }\n\n function render() {\n const width = getChartWidth();\n const { x, y, xSubgroup } = getAxes(width);\n\n svg = select<HTMLElement, any>(chart)\n .append('svg')\n .attr('width', width)\n .attr(\n 'height',\n Number(height) +\n Number(getParsedMargins(margins).top) +\n Number(getParsedMargins(margins).bottom) +\n Number(getParsedMargins(margins).xAxis),\n )\n .attr('id', 'svg-chart')\n .append('g')\n .attr(\n 'transform',\n `translate(${\n getParsedMargins(margins).left / 2 +\n getParsedMargins(margins).right / 2\n },${getParsedMargins(margins).top})`,\n );\n\n svg\n .append('g')\n .attr(\n 'transform',\n `translate(0, ${\n Number(height) + Number(getParsedMargins(margins).xAxis)\n })`,\n )\n .call(axisBottom(x))\n .attr('class', 'x-axis')\n .attr('stroke-width', '0');\n\n svg\n .append('g')\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n .call((axisLeft(y) as any).ticks(ticknumbers).tickFormat(tickleftformat))\n .attr('class', 'y-axis')\n .attr('stroke-width', '0');\n\n addRectandles(x, xSubgroup, y);\n }\n\n function update() {\n const width = getChartWidth();\n chart.querySelector('#svg-chart')?.setAttribute('width', `${width}px`);\n\n const { x, y, xSubgroup } = getAxes(width);\n updateAxes(x, y);\n svg.selectAll('.bar').remove();\n addRectandles(x, xSubgroup, y);\n }\n\n function resize() {\n if (_data) {\n const width = getChartWidth();\n chart.querySelector('#svg-chart')?.setAttribute('width', `${width}px`);\n\n const { x, y, xSubgroup } = getAxes(width);\n updateAxes(x, y);\n\n svg\n .selectAll('.bar')\n .data(parsedData)\n .attr('transform', (d) => `translate(${Number(x(d.group))}, 0)`)\n .selectAll<SVGElement, BarKeyValue>('rect')\n .data((d) => getBarKeyValue(d))\n .attr('x', (d) => xSubgroup(d.key)!)\n .attr('width', xSubgroup.bandwidth());\n }\n }\n\n onMount(() => {\n const resizeObserver = new ResizeObserver(resize);\n resizeObserver.observe(chart);\n hasMounted = true;\n });\n</script>\n\n<div bind:this={chart} style=\"background-color: {backgroundcolor};\" />\n\n{#if tooltipData.show}\n <div\n class=\"tooltip\"\n style={`top: ${tooltipData.top}px; left: ${tooltipData.left}px; width: ${tooltipData.width}px;`}\n >\n {tooltipData.text}\n </div>\n{/if}\n\n<div style=\"height: 0; width: 0;\" class=\"pattern\">\n {#each parsedSvgs as svg}\n {@html svg}\n {/each}\n</div>\n<text />\n\n<style lang=\"scss\">\n @import '@mozaic-ds/styles/settings-tools/_all-settings';\n\n .tooltip {\n height: auto;\n background-color: $color-grey-700;\n border-radius: 4px;\n color: $color-grey-000;\n text-align: center;\n padding: magic-unit-rem(0.5) 0;\n position: absolute;\n }\n\n .pattern {\n z-index: -1;\n position: relative;\n }\n\n text {\n font-family: 'LeroyMerlin', sans-serif;\n font-size: $size-font-04;\n color: $color-grey-700;\n }\n</style>\n"],"names":["t_value","ctx","text","top","left","width","insert","target","div","anchor","dirty","set_data","t","html_tag","p","raw_value","if_block","show","create_if_block","length","i","div0","div1","text_1","getParsedMargins","margins","JSON","parse","right","bottom","xAxis","parsedData","subgroups","data","$$props","chartheight","backgroundcolor","scalemax","scalemin","color","ticknumbers","tickleftformat","d","_data","chart","svg","tickbottomformat","svgs","hasMounted","tooltipData","eventHandler","EventHandler","getChartWidth","chartWidth","select","style","window","innerWidth","parseInt","getBarKeyValue","map","key","value","customtooltip","getAxes","x","scaleBand","domain","groups","range","padding","y","scaleLinear","height","xSubgroup","bandwidth","addRectandles","append","selectAll","join","attr","String","group","on","_e","chartEvent","filter","arc","e","getBoundingClientRect","dispatch","transition","duration","Number","delay","_d","updateAxes","call","axisBottom","tickFormat","axisLeft","ticks","resize","_a","querySelector","setAttribute","onMount","ResizeObserver","observe","$$invalidate","Object","keys","parsedSvgs","remove","update","render","$$value"],"mappings":"qfAuRKA,EAAAC,KAAYC,KAAI,6EAFFD,EAAW,GAACE,gBAAgBF,KAAYG,kBAAkBH,EAAW,GAACI,oBAFvFC,EAKKC,EAAAC,EAAAC,kBADF,EAAAC,EAAA,IAAAV,KAAAA,EAAAC,KAAYC,KAAI,KAAAS,EAAAC,EAAAZ,0BAFFC,EAAW,GAACE,gBAAgBF,KAAYG,kBAAkBH,EAAW,GAACI,oEAQ9EJ,EAAG,GAAA,yFAAHA,EAAG,GAAA,KAAAY,EAAAC,EAAAC,0DAXTC,EAAAf,KAAYgB,MAAIC,EAAAjB,KAUZA,EAAU,wBAAfkB,OAAIC,GAAA,gKAZyCnB,EAAe,sEAAhEK,EAAqEC,EAAAc,EAAAZ,0CAWrEH,EAIKC,EAAAe,EAAAb,6DACLH,EAAOC,EAAAgB,EAAAd,6CAhB0CR,EAAe,IAE3DA,KAAYgB,0FAURhB,EAAU,WAAfkB,OAAIC,GAAA,EAAA,iHAAJD,qGAhOO,SAAAK,EAAiBC,GACpB,OAAAA,EAAgBC,KAAKC,MAAMF,GAAO,CAGlCtB,IAAK,GACLyB,MAAO,GACPC,OAAQ,GACRzB,KAAM,GACN0B,MAAO,gCAlDT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