@mozaic-ds/web-components 0.7.0 → 0.9.0-beta
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 +1 -1
- package/public/ClickOutside-63071e7a.js +15 -1
- package/public/ClickOutside-63071e7a.js.map +1 -1
- package/public/DataTableDefaultAction.nested-c37a5d51.js +762 -0
- package/public/DataTableDefaultAction.nested-c37a5d51.js.map +1 -0
- package/public/DataTableUtilities-313a448d.js +386 -0
- package/public/DataTableUtilities-313a448d.js.map +1 -0
- package/public/EventForward-8492ff62.js +109 -1
- package/public/EventForward-8492ff62.js.map +1 -1
- package/public/EventHandler-02058705.js +15 -1
- package/public/EventHandler-02058705.js.map +1 -1
- package/public/adeo/{DataTableDefaultAction.nested-90536fe3.js → DataTableDefaultAction.nested-ac2e3dbe.js} +2 -2
- package/public/adeo/{DataTableDefaultAction.nested-90536fe3.js.map → DataTableDefaultAction.nested-ac2e3dbe.js.map} +1 -1
- package/public/adeo/DataTableUtilities-313a448d.js +2 -0
- package/public/adeo/DataTableUtilities-313a448d.js.map +1 -0
- package/public/adeo/bundle.js +5 -0
- package/public/adeo/components/barchart/BarChart.svelte +3 -4
- package/public/adeo/components/chart/BarChart.js +1 -1
- package/public/adeo/components/chart/BarChart.js.map +1 -1
- 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 +12 -0
- package/public/adeo/components/datatable/DataTableDefaultAction.nested.js +1 -1
- package/public/adeo/components/datatable/DataTableDefaultEdtion.nested.js +1 -1
- package/public/adeo/components/datatable/DataTableDefaultFilterTags.nested.js +1 -1
- package/public/adeo/components/datatable/DataTableFooter.nested.js +1 -1
- package/public/adeo/components/datatable/data.d.ts.map +1 -1
- package/public/adeo/components/datatable/datatable.types.d.ts +9 -2
- package/public/adeo/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/adeo/components/header/Header.js +1 -1
- package/public/adeo/components/header/Header.js.map +1 -1
- package/public/adeo/components/header/Header.svelte +2 -2
- package/public/adeo/components/kpi/Kpi.js +2 -0
- package/public/adeo/components/kpi/Kpi.js.map +1 -0
- package/public/adeo/components/kpi/Kpi.svelte +232 -0
- package/public/adeo/components/sidebar/Sidebar.js +1 -1
- package/public/adeo/components/sidebar/Sidebar.js.map +1 -1
- package/public/adeo/components/sidebar/Sidebar.svelte +1 -1
- package/public/adeo/icons-storybook.js +16 -0
- package/public/adeo/main.d.ts +1 -0
- package/public/adeo/main.d.ts.map +1 -1
- package/public/adeo/utilities/DataTableUtilities.d.ts.map +1 -1
- package/public/adeo/utilities/DataTableUtilities.ts +22 -2
- package/public/array-5b770a93.js +13 -1
- package/public/array-5b770a93.js.map +1 -1
- package/public/axis-fbc0f7b5.js +174 -1
- package/public/axis-fbc0f7b5.js.map +1 -1
- package/public/band-d7a07d2c.js +186 -1
- package/public/band-d7a07d2c.js.map +1 -1
- package/public/bricoman/{DataTableDefaultAction.nested-928e5e2d.js → DataTableDefaultAction.nested-bcc599d1.js} +2 -2
- package/public/bricoman/{DataTableDefaultAction.nested-928e5e2d.js.map → DataTableDefaultAction.nested-bcc599d1.js.map} +1 -1
- package/public/bricoman/DataTableUtilities-313a448d.js +2 -0
- package/public/bricoman/DataTableUtilities-313a448d.js.map +1 -0
- package/public/bricoman/bundle.js +5 -0
- package/public/bricoman/components/barchart/BarChart.svelte +3 -4
- package/public/bricoman/components/chart/BarChart.js +1 -1
- package/public/bricoman/components/chart/BarChart.js.map +1 -1
- 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 +12 -0
- package/public/bricoman/components/datatable/DataTableDefaultAction.nested.js +1 -1
- package/public/bricoman/components/datatable/DataTableDefaultEdtion.nested.js +1 -1
- package/public/bricoman/components/datatable/DataTableDefaultFilterTags.nested.js +1 -1
- package/public/bricoman/components/datatable/DataTableFooter.nested.js +1 -1
- package/public/bricoman/components/datatable/data.d.ts.map +1 -1
- package/public/bricoman/components/datatable/datatable.types.d.ts +9 -2
- package/public/bricoman/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/bricoman/components/header/Header.js +1 -1
- package/public/bricoman/components/header/Header.js.map +1 -1
- package/public/bricoman/components/header/Header.svelte +2 -2
- package/public/bricoman/components/kpi/Kpi.js +2 -0
- package/public/bricoman/components/kpi/Kpi.js.map +1 -0
- package/public/bricoman/components/kpi/Kpi.svelte +232 -0
- package/public/bricoman/components/sidebar/Sidebar.js +1 -1
- package/public/bricoman/components/sidebar/Sidebar.js.map +1 -1
- package/public/bricoman/components/sidebar/Sidebar.svelte +1 -1
- package/public/bricoman/icons-storybook.js +16 -0
- package/public/bricoman/main.d.ts +1 -0
- package/public/bricoman/main.d.ts.map +1 -1
- package/public/bricoman/utilities/DataTableUtilities.d.ts.map +1 -1
- package/public/bricoman/utilities/DataTableUtilities.ts +22 -2
- package/public/bundle.js +5 -0
- package/public/components/accordion/Accordion.js +365 -1
- package/public/components/accordion/Accordion.js.map +1 -1
- package/public/components/autocomplete/Autocomplete.js +1515 -1
- package/public/components/autocomplete/Autocomplete.js.map +1 -1
- package/public/components/badge/Badge.js +155 -1
- package/public/components/badge/Badge.js.map +1 -1
- package/public/components/badge/Badge.nested.js +101 -1
- package/public/components/badge/Badge.nested.js.map +1 -1
- package/public/components/barchart/BarChart.svelte +3 -4
- package/public/components/breadcrumb/Breadcrumb.js +372 -1
- package/public/components/breadcrumb/Breadcrumb.js.map +1 -1
- package/public/components/breadcrumb/Breadcrumb.nested.js +319 -1
- package/public/components/breadcrumb/Breadcrumb.nested.js.map +1 -1
- package/public/components/button/Button.js +1138 -1
- package/public/components/button/Button.js.map +1 -1
- package/public/components/card/Card.js +369 -1
- package/public/components/card/Card.js.map +1 -1
- package/public/components/chart/BarChart.js +583 -1
- package/public/components/chart/BarChart.js.map +1 -1
- package/public/components/chart/Donut.js +1189 -1
- package/public/components/chart/Donut.js.map +1 -1
- package/public/components/chart/GroupedBarChart.js +750 -1
- package/public/components/chart/GroupedBarChart.js.map +1 -1
- package/public/components/chart/LineChart.js +1731 -1
- package/public/components/chart/LineChart.js.map +1 -1
- package/public/components/chart/Radar.js +729 -1
- package/public/components/chart/Radar.js.map +1 -1
- package/public/components/chart/StackedBarChart.js +745 -1
- package/public/components/chart/StackedBarChart.js.map +1 -1
- package/public/components/checkbox/Checkbox.js +307 -1
- package/public/components/checkbox/Checkbox.js.map +1 -1
- package/public/components/checkboxgroup/checkboxGroup.js +404 -1
- package/public/components/checkboxgroup/checkboxGroup.js.map +1 -1
- package/public/components/datatable/DataTable.js +3098 -1
- package/public/components/datatable/DataTable.js.map +1 -1
- package/public/components/datatable/DataTable.svelte +12 -0
- package/public/components/datatable/DataTableDefaultAction.nested.js +4 -1
- package/public/components/datatable/DataTableDefaultAction.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultEdtion.nested.js +164 -1
- package/public/components/datatable/DataTableDefaultEdtion.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultFilterTags.nested.js +380 -1
- package/public/components/datatable/DataTableDefaultFilterTags.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultSelection.nested.js +424 -1
- package/public/components/datatable/DataTableDefaultSelection.nested.js.map +1 -1
- package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js +263 -1
- package/public/components/datatable/DataTableDefaultSelectionLabel.nested.js.map +1 -1
- package/public/components/datatable/DataTableFooter.nested.js +637 -1
- package/public/components/datatable/DataTableFooter.nested.js.map +1 -1
- package/public/components/datatable/data.d.ts.map +1 -1
- package/public/components/datatable/datatable.types.d.ts +9 -2
- package/public/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/components/dropdown/Dropdown.js +1426 -1
- package/public/components/dropdown/Dropdown.js.map +1 -1
- package/public/components/field/Field.js +375 -1
- package/public/components/field/Field.js.map +1 -1
- package/public/components/fileuploader/FileUploader.js +603 -1
- package/public/components/fileuploader/FileUploader.js.map +1 -1
- package/public/components/fileuploader/ResultFile.nested.js +344 -1
- package/public/components/fileuploader/ResultFile.nested.js.map +1 -1
- package/public/components/flag/Flag.js +174 -1
- package/public/components/flag/Flag.js.map +1 -1
- package/public/components/header/Header.js +918 -1
- package/public/components/header/Header.js.map +1 -1
- package/public/components/header/Header.svelte +2 -2
- package/public/components/hero/Hero.js +271 -1
- package/public/components/hero/Hero.js.map +1 -1
- package/public/components/kpi/Kpi.js +405 -0
- package/public/components/kpi/Kpi.js.map +1 -0
- package/public/components/kpi/Kpi.svelte +232 -0
- package/public/components/layer/Layer.js +471 -1
- package/public/components/layer/Layer.js.map +1 -1
- package/public/components/link/Link.js +380 -1
- package/public/components/link/Link.js.map +1 -1
- package/public/components/listbox/Listbox.js +595 -1
- package/public/components/listbox/Listbox.js.map +1 -1
- package/public/components/listbox/Listbox.nested.js +629 -1
- package/public/components/listbox/Listbox.nested.js.map +1 -1
- package/public/components/loader/Loader.js +246 -1
- package/public/components/loader/Loader.js.map +1 -1
- package/public/components/loader/Loader.nested.js +176 -1
- package/public/components/loader/Loader.nested.js.map +1 -1
- package/public/components/modal/Modal.js +395 -1
- package/public/components/modal/Modal.js.map +1 -1
- package/public/components/notification/Notification.js +458 -1
- package/public/components/notification/Notification.js.map +1 -1
- package/public/components/optionbutton/OptionButton.js +316 -1
- package/public/components/optionbutton/OptionButton.js.map +1 -1
- package/public/components/overlay/Overlay.js +104 -1
- package/public/components/overlay/Overlay.js.map +1 -1
- package/public/components/overlay/OverlayLoader.js +151 -1
- package/public/components/overlay/OverlayLoader.js.map +1 -1
- package/public/components/pagination/Pagination.js +613 -1
- package/public/components/pagination/Pagination.js.map +1 -1
- package/public/components/passwordinput/PasswordInput.js +291 -1
- package/public/components/passwordinput/PasswordInput.js.map +1 -1
- package/public/components/phonenumber/PhoneNumber.js +6894 -1
- package/public/components/phonenumber/PhoneNumber.js.map +1 -1
- package/public/components/price/Price.js +768 -1
- package/public/components/price/Price.js.map +1 -1
- package/public/components/progressbar/ProgressBar.js +278 -1
- package/public/components/progressbar/ProgressBar.js.map +1 -1
- package/public/components/quantityselector/QuantitySelector.js +397 -1
- package/public/components/quantityselector/QuantitySelector.js.map +1 -1
- package/public/components/radio/Radio.js +273 -1
- package/public/components/radio/Radio.js.map +1 -1
- package/public/components/radiogroup/RadioGroup.js +414 -1
- package/public/components/radiogroup/RadioGroup.js.map +1 -1
- package/public/components/ratings/StarsInput.js +292 -1
- package/public/components/ratings/StarsInput.js.map +1 -1
- package/public/components/ratings/StarsResult.js +246 -1
- package/public/components/ratings/StarsResult.js.map +1 -1
- package/public/components/select/Select.js +451 -1
- package/public/components/select/Select.js.map +1 -1
- package/public/components/sidebar/Sidebar.js +784 -1
- package/public/components/sidebar/Sidebar.js.map +1 -1
- package/public/components/sidebar/Sidebar.svelte +1 -1
- package/public/components/sidebar/sidebar-feature-group.nested.js +594 -1
- package/public/components/sidebar/sidebar-feature-group.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-feature.nested.js +402 -1
- package/public/components/sidebar/sidebar-feature.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-section.nested.js +394 -1
- package/public/components/sidebar/sidebar-section.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-segment.nested.js +200 -1
- package/public/components/sidebar/sidebar-segment.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-separator.nested.js +49 -1
- package/public/components/sidebar/sidebar-separator.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-sub-features.nested.js +312 -1
- package/public/components/sidebar/sidebar-sub-features.nested.js.map +1 -1
- package/public/components/sidebar/sidebar-user.nested.js +733 -1
- package/public/components/sidebar/sidebar-user.nested.js.map +1 -1
- package/public/components/stepper/Stepper.js +371 -1
- package/public/components/stepper/Stepper.js.map +1 -1
- package/public/components/tabs/Tabs.js +615 -1
- package/public/components/tabs/Tabs.js.map +1 -1
- package/public/components/tabs/Tabs.nested.js +472 -1
- package/public/components/tabs/Tabs.nested.js.map +1 -1
- package/public/components/tag/Tag.js +665 -1
- package/public/components/tag/Tag.js.map +1 -1
- package/public/components/tag/Tag.nested.js +554 -1
- package/public/components/tag/Tag.nested.js.map +1 -1
- package/public/components/taglist/TagList.js +475 -1
- package/public/components/taglist/TagList.js.map +1 -1
- package/public/components/textarea/Textarea.js +303 -1
- package/public/components/textarea/Textarea.js.map +1 -1
- package/public/components/textinput/Textinput.js +497 -1
- package/public/components/textinput/Textinput.js.map +1 -1
- package/public/components/textinput/Textinput.nested.js +320 -1
- package/public/components/textinput/Textinput.nested.js.map +1 -1
- package/public/components/toggle/Toggle.js +278 -1
- package/public/components/toggle/Toggle.js.map +1 -1
- package/public/components/tooltip/Tooltip.js +173 -1
- package/public/components/tooltip/Tooltip.js.map +1 -1
- package/public/icons-storybook.js +16 -0
- package/public/index-c33b3772.js +873 -1
- package/public/index-c33b3772.js.map +1 -1
- package/public/linear-f46d7e9e.js +700 -1
- package/public/linear-f46d7e9e.js.map +1 -1
- package/public/main.d.ts +1 -0
- package/public/main.d.ts.map +1 -1
- package/public/path-1b5da959.js +186 -1
- package/public/path-1b5da959.js.map +1 -1
- package/public/sidebar-service-275bf9ef.js +129 -1
- package/public/sidebar-service-275bf9ef.js.map +1 -1
- package/public/symbol-b05a6e2b.js +169 -1
- package/public/symbol-b05a6e2b.js.map +1 -1
- package/public/transform-15d69d5d.js +2743 -1
- package/public/transform-15d69d5d.js.map +1 -1
- package/public/utilities/DataTableUtilities.d.ts.map +1 -1
- package/public/utilities/DataTableUtilities.ts +22 -2
- package/public/utilities/EventForward.js +136 -1
- package/public/utilities/EventForward.js.map +1 -1
- package/public/utilities/EventHandler.js +36 -1
- package/public/utilities/EventHandler.js.map +1 -1
- package/public/utilities/components/datatable/data.d.ts.map +1 -1
- package/public/utilities/components/datatable/datatable.types.d.ts +9 -2
- package/public/utilities/components/datatable/datatable.types.d.ts.map +1 -1
- package/public/utilities/main.d.ts +1 -0
- package/public/utilities/main.d.ts.map +1 -1
- package/public/utilities/stories/datatable/DataTable.stories.d.ts.map +1 -1
- package/public/utilities/stories/header/Header.stories.d.ts.map +1 -1
- package/public/utilities/stories/kpi/kpi.stories.d.ts +7 -0
- package/public/utilities/stories/kpi/kpi.stories.d.ts.map +1 -0
- package/public/utilities/utilities/DataTableUtilities.d.ts.map +1 -1
- package/public/DataTableDefaultAction.nested-483f8bb0.js +0 -2
- package/public/DataTableDefaultAction.nested-483f8bb0.js.map +0 -1
- package/public/DataTableUtilities-60220c78.js +0 -2
- package/public/DataTableUtilities-60220c78.js.map +0 -1
- package/public/adeo/DataTableUtilities-60220c78.js +0 -2
- package/public/adeo/DataTableUtilities-60220c78.js.map +0 -1
- package/public/bricoman/DataTableUtilities-60220c78.js +0 -2
- package/public/bricoman/DataTableUtilities-60220c78.js.map +0 -1
|
@@ -1,2 +1,751 @@
|
|
|
1
|
-
import{S as t,i as e,a as r,b as i,f as a,s,e as o,d as l,T as n,n as c,y as g,g as h,o as m,J as d,a1 as f,t as u,j as p,k as x,K as b,v as $,Z as k}from"../../index-c33b3772.js";import{s as y}from"../../transform-15d69d5d.js";import{E as w}from"../../EventHandler-02058705.js";import{a as v,b as A,c as j}from"../../axis-fbc0f7b5.js";import{b as N}from"../../band-d7a07d2c.js";import{l as S}from"../../linear-f46d7e9e.js";function _(t,e,r){const i=t.slice();return i[6]=e[r],i}function E(t,e,r){const i=t.slice();return i[38]=e[r],i}function C(t){let e,r,a,s,c,g,d,f,b=t[38]+"";return{c(){e=o("div"),r=n("svg"),a=n("rect"),c=l(),g=o("span"),d=u(b),f=l(),h(a,"x","0"),h(a,"y","0"),h(a,"width","24"),h(a,"height","16"),h(a,"fill",s=t[7](t[38],t[1])),h(r,"class","legend__box"),h(g,"class","legend__title"),h(e,"class","legend__item")},m(t,s){i(t,e,s),p(e,r),p(r,a),p(e,c),p(e,g),p(g,d),p(e,f)},p(t,e){6&e[0]&&s!==(s=t[7](t[38],t[1]))&&h(a,"fill",s),4&e[0]&&b!==(b=t[38]+"")&&x(d,b)},d(t){t&&m(e)}}}function P(t){let e,r,a,s=t[4].text+"";return{c(){e=o("div"),r=u(s),h(e,"class","tooltip"),h(e,"style",a=`top: ${t[4].top}px; left: ${t[4].left}px; width: ${t[4].width}px;`)},m(t,a){i(t,e,a),p(e,r)},p(t,i){16&i[0]&&s!==(s=t[4].text+"")&&x(r,s),16&i[0]&&a!==(a=`top: ${t[4].top}px; left: ${t[4].left}px; width: ${t[4].width}px;`)&&h(e,"style",a)},d(t){t&&m(e)}}}function F(t){let e,r,a=t[6]+"";return{c(){e=new k(!1),r=b(),e.a=r},m(t,s){e.m(a,t,s),i(t,r,s)},p(t,r){32&r[0]&&a!==(a=t[6]+"")&&e.p(a)},d(t){t&&m(r),t&&e.d()}}}function O(t){let e,r,a,s,f,u,p,x,b=t[2],$=[];for(let e=0;e<b.length;e+=1)$[e]=C(E(t,b,e));let k=t[4].show&&P(t),y=t[5],w=[];for(let e=0;e<y.length;e+=1)w[e]=F(_(t,y,e));return{c(){e=o("div"),r=l(),a=o("div");for(let t=0;t<$.length;t+=1)$[t].c();s=l(),k&&k.c(),f=l(),u=o("div");for(let t=0;t<w.length;t+=1)w[t].c();p=l(),x=n("text"),this.c=c,g(e,"background-color",t[0]),h(a,"class","legend"),g(u,"height","0"),g(u,"width","0"),h(u,"class","pattern")},m(o,l){i(o,e,l),t[21](e),i(o,r,l),i(o,a,l);for(let t=0;t<$.length;t+=1)$[t]&&$[t].m(a,null);i(o,s,l),k&&k.m(o,l),i(o,f,l),i(o,u,l);for(let t=0;t<w.length;t+=1)w[t]&&w[t].m(u,null);i(o,p,l),i(o,x,l)},p(t,r){if(1&r[0]&&g(e,"background-color",t[0]),134&r[0]){let e;for(b=t[2],e=0;e<b.length;e+=1){const i=E(t,b,e);$[e]?$[e].p(i,r):($[e]=C(i),$[e].c(),$[e].m(a,null))}for(;e<$.length;e+=1)$[e].d(1);$.length=b.length}if(t[4].show?k?k.p(t,r):(k=P(t),k.c(),k.m(f.parentNode,f)):k&&(k.d(1),k=null),32&r[0]){let e;for(y=t[5],e=0;e<y.length;e+=1){const i=_(t,y,e);w[e]?w[e].p(i,r):(w[e]=F(i),w[e].c(),w[e].m(u,null))}for(;e<w.length;e+=1)w[e].d(1);w.length=y.length}},i:c,o:c,d(i){i&&m(e),t[21](null),i&&m(r),i&&m(a),d($,i),i&&m(s),k&&k.d(i),i&&m(f),i&&m(u),d(w,i),i&&m(p),i&&m(x)}}}function R(t){return t?JSON.parse(t):{top:10,right:40,bottom:20,left:60,xAxis:20}}function z(t,e,r){let i,a,s,o,l,n,c,g,{data:h=""}=e,{chartheight:m="300"}=e,{backgroundcolor:d="#fff"}=e,{leftscalemax:u=50}=e,{rightscalemax:p}=e,{color:x="#0B96CC"}=e,{ticknumbers:b=4}=e,{tickleftformat:k=(t=>`${Number(t)}`)}=e,{tickbottomformat:_=(t=>`${t}`)}=e,{tickrightformat:E=(t=>`${Number(t)}`)}=e,{svgs:C}=e,{margins:P}=e,F=!1,O={show:!1,text:"",top:0,left:0,width:0},z=new w,B=0,J=0;function q(){let t=y(c).style("width");return""!==t&&t||(t=""+window.innerWidth/2),parseInt(t)}function I(t){return l.map((e=>({key:e,value:t[e].value,scalePosition:t[e].scalePosition,color:t[e].color,customtooltip:t[e].customtooltip})))}function D(t){const e=p?t-(R(P).left+R(P).right):t-R(P).right,r=N().domain(a).range([0,e]).padding(.2),i=S().domain([0,u]).range([s,0]),o=S().domain([0,p]).range([s,0]),n=N().domain(l).range([0,r.bandwidth()]).padding(.05);return{x:r,yleft:i,yright:o,xSubgroup:n}}function H(t,e,a,o){g.append("g").selectAll("g").data(i).join("g").attr("transform",(e=>`translate(${String(t(e.group))}, 0)`)).attr("class","bar").selectAll("rect").data((t=>I(t))).join("rect").attr("x",(t=>e(t.key))).attr("y",(t=>"right"===t.scalePosition?o(0):a(0))).attr("width",e.bandwidth()).attr("height",(t=>s-("right"===t.scalePosition?o(0):a(0)))).style("fill",(t=>t.color||x)).style("cursor","pointer").on("mouseout",((t,e)=>{g.selectAll("rect").filter((function(t){return t!=e})).style("opacity",1),r(4,O.show=!1,O)})).on("mouseover",((t,e)=>{var i,a;g.selectAll("rect").filter((function(t){return t!=e})).style("opacity",.7);const{left:s,top:o,width:l}=null!==(a=null===(i=t.target.parentElement)||void 0===i?void 0:i.getBoundingClientRect())&&void 0!==a?a:{left:0,top:0,width:0};r(4,O={show:!0,text:e.customtooltip?`${e.customtooltip}`:`${e.key} - ${e.value}`,left:s,top:o-50,width:l})})).on("click",((t,e)=>{z.dispatch("bar-clicked",e)})),g.selectAll("rect").transition().duration(800).attr("y",(t=>"right"===t.scalePosition?o(+t.value):a(+t.value))).attr("height",(t=>s-("right"===t.scalePosition?o(+t.value):a(+t.value)))).delay(((t,e)=>100*e))}function K(t,e,r){g.select(".x-axis").call(v(t).tickFormat(_)),g.select(".y-left-axis").call(A(e).ticks(b).tickFormat(k)),p&&g.select(".y-right-axis").call(j(r).ticks(b).tickFormat(E)).attr("transform",`translate(${J-R(P).left-B},0)`);const i=p?J-R(P).left-B:J-B;g.selectAll(".y-left-axis .tick line").attr("stroke","#EEEDEA").attr("stroke-width","1px").attr("x2",i)}function L(){J=q();const{x:t,yleft:e,yright:i,xSubgroup:a}=D(J);r(6,g=y(c).append("svg").attr("width",J).attr("height",Number(s)+Number(R(P).top)+Number(R(P).bottom)+Number(R(P).xAxis)).attr("id","svg-chart").append("g").attr("transform",`translate(${R(P).left/2+R(P).right/2},${R(P).top})`)),g.append("g").attr("transform",`translate(0, ${Number(s)+Number(R(P).xAxis)})`).call(v(t)).attr("class","x-axis").attr("stroke-width","0"),g.append("g").call(A(e).ticks(b).tickFormat(k)).attr("class","y-left-axis").attr("stroke-width","0"),B=function(t){const{width:e}=c.getElementsByClassName(`y-${t}-axis`)[0].getBoundingClientRect();return e}("left"),p&&g.append("g").call(j(i).ticks(b).tickFormat(k)).attr("class","y-right-axis").attr("transform",`translate(${J-R(P).left-B},0)`).attr("stroke-width","0"),H(t,a,e,i)}function M(){var t;if(J=q(),n){const e=q();null===(t=c.querySelector("#svg-chart"))||void 0===t||t.setAttribute("width",`${e}px`);const{x:r,yleft:a,yright:s,xSubgroup:o}=D(e);K(r,a,s),g.selectAll(".bar").data(i).attr("transform",(t=>`translate(${String(r(t.group))}, 0)`)).selectAll("rect").data((t=>I(t))).attr("x",(t=>o(t.key))).attr("width",o.bandwidth())}}return f((()=>{new ResizeObserver(M).observe(c),r(20,F=!0)})),t.$$set=t=>{"data"in t&&r(8,h=t.data),"chartheight"in t&&r(9,m=t.chartheight),"backgroundcolor"in t&&r(0,d=t.backgroundcolor),"leftscalemax"in t&&r(10,u=t.leftscalemax),"rightscalemax"in t&&r(11,p=t.rightscalemax),"color"in t&&r(12,x=t.color),"ticknumbers"in t&&r(13,b=t.ticknumbers),"tickleftformat"in t&&r(14,k=t.tickleftformat),"tickbottomformat"in t&&r(15,_=t.tickbottomformat),"tickrightformat"in t&&r(16,E=t.tickrightformat),"svgs"in t&&r(17,C=t.svgs),"margins"in t&&r(18,P=t.margins)},t.$$.update=()=>{256&t.$$.dirty[0]&&r(1,i=h?JSON.parse(h):[]),2&t.$$.dirty[0]&&(a=i.map((t=>t.group))),2&t.$$.dirty[0]&&r(2,l=i[0]?Object.keys(i[0]).filter((t=>"group"!==t)):[]),512&t.$$.dirty[0]&&(s=parseInt(m,10)),131072&t.$$.dirty[0]&&r(5,o=C?JSON.parse(C):[]),1573120&t.$$.dirty[0]&&h.length>0&&F&&(n?h!==n&&(!function(){var t;null===(t=c.querySelector("#svg-chart"))||void 0===t||t.setAttribute("width",`${J}px`);const{x:e,yleft:r,yright:i,xSubgroup:a}=D(J);K(e,r,i),g.selectAll(".bar").remove(),H(e,a,r,i)}(),r(19,n=h)):(L(),r(19,n=h)))},[d,i,l,c,O,o,g,function(t,e){var r;return e.length>0?null===(r=e[0][t])||void 0===r?void 0:r.color:""},h,m,u,p,x,b,k,_,E,C,P,n,F,function(t){$[t?"unshift":"push"]((()=>{c=t,r(3,c)}))}]}class B extends t{constructor(t){super();const o=document.createElement("style");o.textContent='.legend{margin-top:1rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 1.5rem;height:100%;color:#000000;gap:1rem}.legend__item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:0.875rem;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.legend__title{white-space:nowrap;margin:0}.legend__box{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:0.25rem;height:16px;width:24px}.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:absolute}text{font-family:"LeroyMerlin", sans-serif;font-size:0.875rem;color:#4d4d4d}',this.shadowRoot.appendChild(o),e(this,{target:this.shadowRoot,props:r(this.attributes),customElement:!0},z,O,s,{data:8,chartheight:9,backgroundcolor:0,leftscalemax:10,rightscalemax:11,color:12,ticknumbers:13,tickleftformat:14,tickbottomformat:15,tickrightformat:16,svgs:17,margins:18},null,[-1,-1]),t&&(t.target&&i(t.target,this,t.anchor),t.props&&(this.$set(t.props),a()))}static get observedAttributes(){return["data","chartheight","backgroundcolor","leftscalemax","rightscalemax","color","ticknumbers","tickleftformat","tickbottomformat","tickrightformat","svgs","margins"]}get data(){return this.$$.ctx[8]}set data(t){this.$$set({data:t}),a()}get chartheight(){return this.$$.ctx[9]}set chartheight(t){this.$$set({chartheight:t}),a()}get backgroundcolor(){return this.$$.ctx[0]}set backgroundcolor(t){this.$$set({backgroundcolor:t}),a()}get leftscalemax(){return this.$$.ctx[10]}set leftscalemax(t){this.$$set({leftscalemax:t}),a()}get rightscalemax(){return this.$$.ctx[11]}set rightscalemax(t){this.$$set({rightscalemax:t}),a()}get color(){return this.$$.ctx[12]}set color(t){this.$$set({color:t}),a()}get ticknumbers(){return this.$$.ctx[13]}set ticknumbers(t){this.$$set({ticknumbers:t}),a()}get tickleftformat(){return this.$$.ctx[14]}set tickleftformat(t){this.$$set({tickleftformat:t}),a()}get tickbottomformat(){return this.$$.ctx[15]}set tickbottomformat(t){this.$$set({tickbottomformat:t}),a()}get tickrightformat(){return this.$$.ctx[16]}set tickrightformat(t){this.$$set({tickrightformat:t}),a()}get svgs(){return this.$$.ctx[17]}set svgs(t){this.$$set({svgs:t}),a()}get margins(){return this.$$.ctx[18]}set margins(t){this.$$set({margins:t}),a()}}export{B as default};
|
|
1
|
+
import { S as SvelteElement, i as init, a as attribute_to_object, b as insert, f as flush, s as safe_not_equal, e as element, d as space, T as svg_element, n as noop, y as set_style, g as attr, o as detach, J as destroy_each, a1 as onMount, t as text, j as append, k as set_data, K as empty, v as binding_callbacks, Z as HtmlTag } from '../../index-c33b3772.js';
|
|
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, c as axisRight } 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/GroupedBarChart.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[6] = list[i];
|
|
13
|
+
return child_ctx;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function get_each_context_1(ctx, list, i) {
|
|
17
|
+
const child_ctx = ctx.slice();
|
|
18
|
+
child_ctx[38] = list[i];
|
|
19
|
+
return child_ctx;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// (253:2) {#each subgroups as subgroup}
|
|
23
|
+
function create_each_block_1(ctx) {
|
|
24
|
+
let div;
|
|
25
|
+
let svg_1;
|
|
26
|
+
let rect;
|
|
27
|
+
let rect_fill_value;
|
|
28
|
+
let t0;
|
|
29
|
+
let span;
|
|
30
|
+
let t1_value = /*subgroup*/ ctx[38] + "";
|
|
31
|
+
let t1;
|
|
32
|
+
let t2;
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
c() {
|
|
36
|
+
div = element("div");
|
|
37
|
+
svg_1 = svg_element("svg");
|
|
38
|
+
rect = svg_element("rect");
|
|
39
|
+
t0 = space();
|
|
40
|
+
span = element("span");
|
|
41
|
+
t1 = text(t1_value);
|
|
42
|
+
t2 = space();
|
|
43
|
+
attr(rect, "x", "0");
|
|
44
|
+
attr(rect, "y", "0");
|
|
45
|
+
attr(rect, "width", "24");
|
|
46
|
+
attr(rect, "height", "16");
|
|
47
|
+
attr(rect, "fill", rect_fill_value = /*getLegendColor*/ ctx[7](/*subgroup*/ ctx[38], /*parsedData*/ ctx[1]));
|
|
48
|
+
attr(svg_1, "class", "legend__box");
|
|
49
|
+
attr(span, "class", "legend__title");
|
|
50
|
+
attr(div, "class", "legend__item");
|
|
51
|
+
},
|
|
52
|
+
m(target, anchor) {
|
|
53
|
+
insert(target, div, anchor);
|
|
54
|
+
append(div, svg_1);
|
|
55
|
+
append(svg_1, rect);
|
|
56
|
+
append(div, t0);
|
|
57
|
+
append(div, span);
|
|
58
|
+
append(span, t1);
|
|
59
|
+
append(div, t2);
|
|
60
|
+
},
|
|
61
|
+
p(ctx, dirty) {
|
|
62
|
+
if (dirty[0] & /*subgroups, parsedData*/ 6 && rect_fill_value !== (rect_fill_value = /*getLegendColor*/ ctx[7](/*subgroup*/ ctx[38], /*parsedData*/ ctx[1]))) {
|
|
63
|
+
attr(rect, "fill", rect_fill_value);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (dirty[0] & /*subgroups*/ 4 && t1_value !== (t1_value = /*subgroup*/ ctx[38] + "")) set_data(t1, t1_value);
|
|
67
|
+
},
|
|
68
|
+
d(detaching) {
|
|
69
|
+
if (detaching) detach(div);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// (269:0) {#if tooltipData.show}
|
|
75
|
+
function create_if_block(ctx) {
|
|
76
|
+
let div;
|
|
77
|
+
let t_value = /*tooltipData*/ ctx[4].text + "";
|
|
78
|
+
let t;
|
|
79
|
+
let div_style_value;
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
c() {
|
|
83
|
+
div = element("div");
|
|
84
|
+
t = text(t_value);
|
|
85
|
+
attr(div, "class", "tooltip");
|
|
86
|
+
attr(div, "style", div_style_value = `top: ${/*tooltipData*/ ctx[4].top}px; left: ${/*tooltipData*/ ctx[4].left}px; width: ${/*tooltipData*/ ctx[4].width}px;`);
|
|
87
|
+
},
|
|
88
|
+
m(target, anchor) {
|
|
89
|
+
insert(target, div, anchor);
|
|
90
|
+
append(div, t);
|
|
91
|
+
},
|
|
92
|
+
p(ctx, dirty) {
|
|
93
|
+
if (dirty[0] & /*tooltipData*/ 16 && t_value !== (t_value = /*tooltipData*/ ctx[4].text + "")) set_data(t, t_value);
|
|
94
|
+
|
|
95
|
+
if (dirty[0] & /*tooltipData*/ 16 && div_style_value !== (div_style_value = `top: ${/*tooltipData*/ ctx[4].top}px; left: ${/*tooltipData*/ ctx[4].left}px; width: ${/*tooltipData*/ ctx[4].width}px;`)) {
|
|
96
|
+
attr(div, "style", div_style_value);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
d(detaching) {
|
|
100
|
+
if (detaching) detach(div);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// (279:2) {#each parsedSvgs as svg}
|
|
106
|
+
function create_each_block(ctx) {
|
|
107
|
+
let html_tag;
|
|
108
|
+
let raw_value = /*svg*/ ctx[6] + "";
|
|
109
|
+
let html_anchor;
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
c() {
|
|
113
|
+
html_tag = new HtmlTag(false);
|
|
114
|
+
html_anchor = empty();
|
|
115
|
+
html_tag.a = html_anchor;
|
|
116
|
+
},
|
|
117
|
+
m(target, anchor) {
|
|
118
|
+
html_tag.m(raw_value, target, anchor);
|
|
119
|
+
insert(target, html_anchor, anchor);
|
|
120
|
+
},
|
|
121
|
+
p(ctx, dirty) {
|
|
122
|
+
if (dirty[0] & /*parsedSvgs*/ 32 && raw_value !== (raw_value = /*svg*/ ctx[6] + "")) html_tag.p(raw_value);
|
|
123
|
+
},
|
|
124
|
+
d(detaching) {
|
|
125
|
+
if (detaching) detach(html_anchor);
|
|
126
|
+
if (detaching) html_tag.d();
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function create_fragment(ctx) {
|
|
132
|
+
let div0;
|
|
133
|
+
let t0;
|
|
134
|
+
let div1;
|
|
135
|
+
let t1;
|
|
136
|
+
let t2;
|
|
137
|
+
let div2;
|
|
138
|
+
let t3;
|
|
139
|
+
let text_1;
|
|
140
|
+
let each_value_1 = /*subgroups*/ ctx[2];
|
|
141
|
+
let each_blocks_1 = [];
|
|
142
|
+
|
|
143
|
+
for (let i = 0; i < each_value_1.length; i += 1) {
|
|
144
|
+
each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
let if_block = /*tooltipData*/ ctx[4].show && create_if_block(ctx);
|
|
148
|
+
let each_value = /*parsedSvgs*/ ctx[5];
|
|
149
|
+
let each_blocks = [];
|
|
150
|
+
|
|
151
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
152
|
+
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
c() {
|
|
157
|
+
div0 = element("div");
|
|
158
|
+
t0 = space();
|
|
159
|
+
div1 = element("div");
|
|
160
|
+
|
|
161
|
+
for (let i = 0; i < each_blocks_1.length; i += 1) {
|
|
162
|
+
each_blocks_1[i].c();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
t1 = space();
|
|
166
|
+
if (if_block) if_block.c();
|
|
167
|
+
t2 = space();
|
|
168
|
+
div2 = element("div");
|
|
169
|
+
|
|
170
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
171
|
+
each_blocks[i].c();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
t3 = space();
|
|
175
|
+
text_1 = svg_element("text");
|
|
176
|
+
this.c = noop;
|
|
177
|
+
set_style(div0, "background-color", /*backgroundcolor*/ ctx[0]);
|
|
178
|
+
attr(div1, "class", "legend");
|
|
179
|
+
set_style(div2, "height", "0");
|
|
180
|
+
set_style(div2, "width", "0");
|
|
181
|
+
attr(div2, "class", "pattern");
|
|
182
|
+
},
|
|
183
|
+
m(target, anchor) {
|
|
184
|
+
insert(target, div0, anchor);
|
|
185
|
+
/*div0_binding*/ ctx[21](div0);
|
|
186
|
+
insert(target, t0, anchor);
|
|
187
|
+
insert(target, div1, anchor);
|
|
188
|
+
|
|
189
|
+
for (let i = 0; i < each_blocks_1.length; i += 1) {
|
|
190
|
+
if (each_blocks_1[i]) {
|
|
191
|
+
each_blocks_1[i].m(div1, null);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
insert(target, t1, anchor);
|
|
196
|
+
if (if_block) if_block.m(target, anchor);
|
|
197
|
+
insert(target, t2, anchor);
|
|
198
|
+
insert(target, div2, anchor);
|
|
199
|
+
|
|
200
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
201
|
+
if (each_blocks[i]) {
|
|
202
|
+
each_blocks[i].m(div2, null);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
insert(target, t3, anchor);
|
|
207
|
+
insert(target, text_1, anchor);
|
|
208
|
+
},
|
|
209
|
+
p(ctx, dirty) {
|
|
210
|
+
if (dirty[0] & /*backgroundcolor*/ 1) {
|
|
211
|
+
set_style(div0, "background-color", /*backgroundcolor*/ ctx[0]);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (dirty[0] & /*subgroups, getLegendColor, parsedData*/ 134) {
|
|
215
|
+
each_value_1 = /*subgroups*/ ctx[2];
|
|
216
|
+
let i;
|
|
217
|
+
|
|
218
|
+
for (i = 0; i < each_value_1.length; i += 1) {
|
|
219
|
+
const child_ctx = get_each_context_1(ctx, each_value_1, i);
|
|
220
|
+
|
|
221
|
+
if (each_blocks_1[i]) {
|
|
222
|
+
each_blocks_1[i].p(child_ctx, dirty);
|
|
223
|
+
} else {
|
|
224
|
+
each_blocks_1[i] = create_each_block_1(child_ctx);
|
|
225
|
+
each_blocks_1[i].c();
|
|
226
|
+
each_blocks_1[i].m(div1, null);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
for (; i < each_blocks_1.length; i += 1) {
|
|
231
|
+
each_blocks_1[i].d(1);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
each_blocks_1.length = each_value_1.length;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (/*tooltipData*/ ctx[4].show) {
|
|
238
|
+
if (if_block) {
|
|
239
|
+
if_block.p(ctx, dirty);
|
|
240
|
+
} else {
|
|
241
|
+
if_block = create_if_block(ctx);
|
|
242
|
+
if_block.c();
|
|
243
|
+
if_block.m(t2.parentNode, t2);
|
|
244
|
+
}
|
|
245
|
+
} else if (if_block) {
|
|
246
|
+
if_block.d(1);
|
|
247
|
+
if_block = null;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (dirty[0] & /*parsedSvgs*/ 32) {
|
|
251
|
+
each_value = /*parsedSvgs*/ ctx[5];
|
|
252
|
+
let i;
|
|
253
|
+
|
|
254
|
+
for (i = 0; i < each_value.length; i += 1) {
|
|
255
|
+
const child_ctx = get_each_context(ctx, each_value, i);
|
|
256
|
+
|
|
257
|
+
if (each_blocks[i]) {
|
|
258
|
+
each_blocks[i].p(child_ctx, dirty);
|
|
259
|
+
} else {
|
|
260
|
+
each_blocks[i] = create_each_block(child_ctx);
|
|
261
|
+
each_blocks[i].c();
|
|
262
|
+
each_blocks[i].m(div2, null);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
for (; i < each_blocks.length; i += 1) {
|
|
267
|
+
each_blocks[i].d(1);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
each_blocks.length = each_value.length;
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
i: noop,
|
|
274
|
+
o: noop,
|
|
275
|
+
d(detaching) {
|
|
276
|
+
if (detaching) detach(div0);
|
|
277
|
+
/*div0_binding*/ ctx[21](null);
|
|
278
|
+
if (detaching) detach(t0);
|
|
279
|
+
if (detaching) detach(div1);
|
|
280
|
+
destroy_each(each_blocks_1, detaching);
|
|
281
|
+
if (detaching) detach(t1);
|
|
282
|
+
if (if_block) if_block.d(detaching);
|
|
283
|
+
if (detaching) detach(t2);
|
|
284
|
+
if (detaching) detach(div2);
|
|
285
|
+
destroy_each(each_blocks, detaching);
|
|
286
|
+
if (detaching) detach(t3);
|
|
287
|
+
if (detaching) detach(text_1);
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function getParsedMargins(margins) {
|
|
293
|
+
if (margins) return JSON.parse(margins); else return {
|
|
294
|
+
top: 10,
|
|
295
|
+
right: 40,
|
|
296
|
+
bottom: 20,
|
|
297
|
+
left: 60,
|
|
298
|
+
xAxis: 20
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function instance($$self, $$props, $$invalidate) {
|
|
303
|
+
let parsedData;
|
|
304
|
+
let groups;
|
|
305
|
+
let height;
|
|
306
|
+
let parsedSvgs;
|
|
307
|
+
let { data = '' } = $$props;
|
|
308
|
+
let subgroups;
|
|
309
|
+
let { chartheight = '300' } = $$props;
|
|
310
|
+
let { backgroundcolor = '#fff' } = $$props;
|
|
311
|
+
let { leftscalemax = 50 } = $$props;
|
|
312
|
+
let { rightscalemax } = $$props;
|
|
313
|
+
let { color = '#0B96CC' } = $$props;
|
|
314
|
+
let { ticknumbers = 4 } = $$props;
|
|
315
|
+
let { tickleftformat = d => `${Number(d)}` } = $$props;
|
|
316
|
+
let { tickbottomformat = d => `${d}` } = $$props;
|
|
317
|
+
let { tickrightformat = d => `${Number(d)}` } = $$props;
|
|
318
|
+
let { svgs } = $$props;
|
|
319
|
+
let { margins } = $$props;
|
|
320
|
+
let _data;
|
|
321
|
+
let chart;
|
|
322
|
+
let svg;
|
|
323
|
+
let hasMounted = false;
|
|
324
|
+
|
|
325
|
+
let tooltipData = {
|
|
326
|
+
show: false,
|
|
327
|
+
text: '',
|
|
328
|
+
top: 0,
|
|
329
|
+
left: 0,
|
|
330
|
+
width: 0
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
let eventHandler = new EventHandler();
|
|
334
|
+
let leftScaleWidth = 0;
|
|
335
|
+
let width = 0;
|
|
336
|
+
|
|
337
|
+
function getChartWidth() {
|
|
338
|
+
let chartWidth = select(chart).style('width');
|
|
339
|
+
|
|
340
|
+
if (chartWidth === '' || !chartWidth) {
|
|
341
|
+
chartWidth = `${window.innerWidth / 2}`;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return parseInt(chartWidth);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
function getBarKeyValue(d) {
|
|
348
|
+
return subgroups.map(key => ({
|
|
349
|
+
key,
|
|
350
|
+
value: d[key].value,
|
|
351
|
+
scalePosition: d[key].scalePosition,
|
|
352
|
+
color: d[key].color,
|
|
353
|
+
customtooltip: d[key].customtooltip
|
|
354
|
+
}));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function getAxes(width) {
|
|
358
|
+
const xWidth = rightscalemax
|
|
359
|
+
? width - (getParsedMargins(margins).left + getParsedMargins(margins).right)
|
|
360
|
+
: width - getParsedMargins(margins).right;
|
|
361
|
+
|
|
362
|
+
const x = band().domain(groups).range([0, xWidth]).padding(0.2);
|
|
363
|
+
const yleft = linear().domain([0, leftscalemax]).range([height, 0]);
|
|
364
|
+
const yright = linear().domain([0, rightscalemax]).range([height, 0]);
|
|
365
|
+
const xSubgroup = band().domain(subgroups).range([0, x.bandwidth()]).padding(0.05);
|
|
366
|
+
return { x, yleft, yright, xSubgroup };
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function getAxisWidth(position) {
|
|
370
|
+
const { width } = chart.getElementsByClassName(`y-${position}-axis`)[0].getBoundingClientRect();
|
|
371
|
+
return width;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function addRectandles(x, xSubgroup, yleft, yright) {
|
|
375
|
+
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', d => d.scalePosition === 'right' ? yright(0) : yleft(0)).attr('width', xSubgroup.bandwidth()).attr('height', d => height - (d.scalePosition === 'right' ? yright(0) : yleft(0))).style('fill', d => d.color || color).style('cursor', 'pointer').on('mouseout', (_e, chartEvent) => {
|
|
376
|
+
const others = svg.selectAll('rect').filter(function (arc) {
|
|
377
|
+
return arc != chartEvent;
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
others.style('opacity', 1);
|
|
381
|
+
$$invalidate(4, tooltipData.show = false, tooltipData);
|
|
382
|
+
}).on('mouseover', (e, chartEvent) => {
|
|
383
|
+
var _a, _b;
|
|
384
|
+
|
|
385
|
+
const others = svg.selectAll('rect').filter(function (arc) {
|
|
386
|
+
return arc != chartEvent;
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
others.style('opacity', 0.7);
|
|
390
|
+
|
|
391
|
+
const { left, top, width } = (_b = (_a = e.target.parentElement) === null || _a === void 0
|
|
392
|
+
? void 0
|
|
393
|
+
: _a.getBoundingClientRect()) !== null && _b !== void 0
|
|
394
|
+
? _b
|
|
395
|
+
: { left: 0, top: 0, width: 0 };
|
|
396
|
+
|
|
397
|
+
$$invalidate(4, tooltipData = {
|
|
398
|
+
show: true,
|
|
399
|
+
text: chartEvent.customtooltip
|
|
400
|
+
? `${chartEvent.customtooltip}`
|
|
401
|
+
: `${chartEvent.key} - ${chartEvent.value}`,
|
|
402
|
+
left,
|
|
403
|
+
top: top - 50,
|
|
404
|
+
width
|
|
405
|
+
});
|
|
406
|
+
}).on('click', (_e, chartEvent) => {
|
|
407
|
+
eventHandler.dispatch('bar-clicked', chartEvent);
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
svg.selectAll('rect').transition().duration(800).attr('y', d => d.scalePosition === 'right'
|
|
411
|
+
? yright(+d.value)
|
|
412
|
+
: yleft(+d.value)).attr('height', d => height - (d.scalePosition === 'right'
|
|
413
|
+
? yright(+d.value)
|
|
414
|
+
: yleft(+d.value))).delay((_d, i) => i * 100);
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function updateAxes(x, yleft, yright) {
|
|
418
|
+
svg.select('.x-axis').call(axisBottom(x).tickFormat(tickbottomformat));
|
|
419
|
+
svg.select('.y-left-axis').call(axisLeft(yleft).ticks(ticknumbers).tickFormat(tickleftformat));
|
|
420
|
+
|
|
421
|
+
if (rightscalemax) {
|
|
422
|
+
svg.select('.y-right-axis').call(axisRight(yright).ticks(ticknumbers).tickFormat(tickrightformat)).attr('transform', `translate(${width - getParsedMargins(margins).left - leftScaleWidth},0)`);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
const x2 = rightscalemax
|
|
426
|
+
? width - getParsedMargins(margins).left - leftScaleWidth
|
|
427
|
+
: width - leftScaleWidth;
|
|
428
|
+
|
|
429
|
+
svg.selectAll('.y-left-axis .tick line').attr('stroke', '#EEEDEA').attr('stroke-width', '1px').attr('x2', x2);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function render() {
|
|
433
|
+
width = getChartWidth();
|
|
434
|
+
const { x, yleft, yright, xSubgroup } = getAxes(width);
|
|
435
|
+
$$invalidate(6, 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})`));
|
|
436
|
+
svg.append('g').attr('transform', `translate(0, ${Number(height) + Number(getParsedMargins(margins).xAxis)})`).call(axisBottom(x)).attr('class', 'x-axis').attr('stroke-width', '0');
|
|
437
|
+
svg.append('g').call(axisLeft(yleft).ticks(ticknumbers).tickFormat(tickleftformat)).attr('class', 'y-left-axis').attr('stroke-width', '0');
|
|
438
|
+
leftScaleWidth = getAxisWidth('left');
|
|
439
|
+
|
|
440
|
+
if (rightscalemax) {
|
|
441
|
+
svg.append('g').call(axisRight(yright).ticks(ticknumbers).tickFormat(tickleftformat)).attr('class', 'y-right-axis').attr('transform', `translate(${width - getParsedMargins(margins).left - leftScaleWidth},0)`).attr('stroke-width', '0');
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
addRectandles(x, xSubgroup, yleft, yright);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function update() {
|
|
448
|
+
var _a;
|
|
449
|
+
|
|
450
|
+
(_a = chart.querySelector('#svg-chart')) === null || _a === void 0
|
|
451
|
+
? void 0
|
|
452
|
+
: _a.setAttribute('width', `${width}px`);
|
|
453
|
+
|
|
454
|
+
const { x, yleft, yright, xSubgroup } = getAxes(width);
|
|
455
|
+
updateAxes(x, yleft, yright);
|
|
456
|
+
svg.selectAll('.bar').remove();
|
|
457
|
+
addRectandles(x, xSubgroup, yleft, yright);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function resize() {
|
|
461
|
+
var _a;
|
|
462
|
+
width = getChartWidth();
|
|
463
|
+
|
|
464
|
+
if (_data) {
|
|
465
|
+
const width = getChartWidth();
|
|
466
|
+
|
|
467
|
+
(_a = chart.querySelector('#svg-chart')) === null || _a === void 0
|
|
468
|
+
? void 0
|
|
469
|
+
: _a.setAttribute('width', `${width}px`);
|
|
470
|
+
|
|
471
|
+
const { x, yleft, yright, xSubgroup } = getAxes(width);
|
|
472
|
+
updateAxes(x, yleft, yright);
|
|
473
|
+
svg.selectAll('.bar').data(parsedData).attr('transform', d => `translate(${String(x(d.group))}, 0)`).selectAll('rect').data(d => getBarKeyValue(d)).attr('x', d => xSubgroup(d.key)).attr('width', xSubgroup.bandwidth());
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function getLegendColor(subgroup, parsedData) {
|
|
478
|
+
var _a;
|
|
479
|
+
|
|
480
|
+
if (parsedData.length > 0) return (_a = parsedData[0][subgroup]) === null || _a === void 0
|
|
481
|
+
? void 0
|
|
482
|
+
: _a.color;
|
|
483
|
+
|
|
484
|
+
return '';
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
onMount(() => {
|
|
488
|
+
const resizeObserver = new ResizeObserver(resize);
|
|
489
|
+
resizeObserver.observe(chart);
|
|
490
|
+
$$invalidate(20, hasMounted = true);
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
function div0_binding($$value) {
|
|
494
|
+
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
495
|
+
chart = $$value;
|
|
496
|
+
$$invalidate(3, chart);
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
$$self.$$set = $$props => {
|
|
501
|
+
if ('data' in $$props) $$invalidate(8, data = $$props.data);
|
|
502
|
+
if ('chartheight' in $$props) $$invalidate(9, chartheight = $$props.chartheight);
|
|
503
|
+
if ('backgroundcolor' in $$props) $$invalidate(0, backgroundcolor = $$props.backgroundcolor);
|
|
504
|
+
if ('leftscalemax' in $$props) $$invalidate(10, leftscalemax = $$props.leftscalemax);
|
|
505
|
+
if ('rightscalemax' in $$props) $$invalidate(11, rightscalemax = $$props.rightscalemax);
|
|
506
|
+
if ('color' in $$props) $$invalidate(12, color = $$props.color);
|
|
507
|
+
if ('ticknumbers' in $$props) $$invalidate(13, ticknumbers = $$props.ticknumbers);
|
|
508
|
+
if ('tickleftformat' in $$props) $$invalidate(14, tickleftformat = $$props.tickleftformat);
|
|
509
|
+
if ('tickbottomformat' in $$props) $$invalidate(15, tickbottomformat = $$props.tickbottomformat);
|
|
510
|
+
if ('tickrightformat' in $$props) $$invalidate(16, tickrightformat = $$props.tickrightformat);
|
|
511
|
+
if ('svgs' in $$props) $$invalidate(17, svgs = $$props.svgs);
|
|
512
|
+
if ('margins' in $$props) $$invalidate(18, margins = $$props.margins);
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
$$self.$$.update = () => {
|
|
516
|
+
if ($$self.$$.dirty[0] & /*data*/ 256) {
|
|
517
|
+
$$invalidate(1, parsedData = data ? JSON.parse(data) : []);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if ($$self.$$.dirty[0] & /*parsedData*/ 2) {
|
|
521
|
+
groups = parsedData.map(d => d.group);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if ($$self.$$.dirty[0] & /*parsedData*/ 2) {
|
|
525
|
+
$$invalidate(2, subgroups = parsedData[0]
|
|
526
|
+
? Object.keys(parsedData[0]).filter(d => d !== 'group')
|
|
527
|
+
: []);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
if ($$self.$$.dirty[0] & /*chartheight*/ 512) {
|
|
531
|
+
height = parseInt(chartheight, 10);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
if ($$self.$$.dirty[0] & /*svgs*/ 131072) {
|
|
535
|
+
$$invalidate(5, parsedSvgs = svgs ? JSON.parse(svgs) : []);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if ($$self.$$.dirty[0] & /*data, hasMounted, _data*/ 1573120) {
|
|
539
|
+
if (data.length > 0 && hasMounted) {
|
|
540
|
+
if (!_data) {
|
|
541
|
+
render();
|
|
542
|
+
$$invalidate(19, _data = data);
|
|
543
|
+
} else if (data !== _data) {
|
|
544
|
+
update();
|
|
545
|
+
$$invalidate(19, _data = data);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
return [
|
|
552
|
+
backgroundcolor,
|
|
553
|
+
parsedData,
|
|
554
|
+
subgroups,
|
|
555
|
+
chart,
|
|
556
|
+
tooltipData,
|
|
557
|
+
parsedSvgs,
|
|
558
|
+
svg,
|
|
559
|
+
getLegendColor,
|
|
560
|
+
data,
|
|
561
|
+
chartheight,
|
|
562
|
+
leftscalemax,
|
|
563
|
+
rightscalemax,
|
|
564
|
+
color,
|
|
565
|
+
ticknumbers,
|
|
566
|
+
tickleftformat,
|
|
567
|
+
tickbottomformat,
|
|
568
|
+
tickrightformat,
|
|
569
|
+
svgs,
|
|
570
|
+
margins,
|
|
571
|
+
_data,
|
|
572
|
+
hasMounted,
|
|
573
|
+
div0_binding
|
|
574
|
+
];
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
class GroupedBarChart extends SvelteElement {
|
|
578
|
+
constructor(options) {
|
|
579
|
+
super();
|
|
580
|
+
const style = document.createElement('style');
|
|
581
|
+
style.textContent = `.legend{margin-top:1rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:0 1.5rem;height:100%;color:#000000;gap:1rem}.legend__item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;font-size:0.875rem;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.legend__title{white-space:nowrap;margin:0}.legend__box{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;margin-right:0.25rem;height:16px;width:24px}.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:absolute}text{font-family:"LeroyMerlin", sans-serif;font-size:0.875rem;color:#4d4d4d}`;
|
|
582
|
+
this.shadowRoot.appendChild(style);
|
|
583
|
+
|
|
584
|
+
init(
|
|
585
|
+
this,
|
|
586
|
+
{
|
|
587
|
+
target: this.shadowRoot,
|
|
588
|
+
props: attribute_to_object(this.attributes),
|
|
589
|
+
customElement: true
|
|
590
|
+
},
|
|
591
|
+
instance,
|
|
592
|
+
create_fragment,
|
|
593
|
+
safe_not_equal,
|
|
594
|
+
{
|
|
595
|
+
data: 8,
|
|
596
|
+
chartheight: 9,
|
|
597
|
+
backgroundcolor: 0,
|
|
598
|
+
leftscalemax: 10,
|
|
599
|
+
rightscalemax: 11,
|
|
600
|
+
color: 12,
|
|
601
|
+
ticknumbers: 13,
|
|
602
|
+
tickleftformat: 14,
|
|
603
|
+
tickbottomformat: 15,
|
|
604
|
+
tickrightformat: 16,
|
|
605
|
+
svgs: 17,
|
|
606
|
+
margins: 18
|
|
607
|
+
},
|
|
608
|
+
null,
|
|
609
|
+
[-1, -1]
|
|
610
|
+
);
|
|
611
|
+
|
|
612
|
+
if (options) {
|
|
613
|
+
if (options.target) {
|
|
614
|
+
insert(options.target, this, options.anchor);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (options.props) {
|
|
618
|
+
this.$set(options.props);
|
|
619
|
+
flush();
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
static get observedAttributes() {
|
|
625
|
+
return [
|
|
626
|
+
"data",
|
|
627
|
+
"chartheight",
|
|
628
|
+
"backgroundcolor",
|
|
629
|
+
"leftscalemax",
|
|
630
|
+
"rightscalemax",
|
|
631
|
+
"color",
|
|
632
|
+
"ticknumbers",
|
|
633
|
+
"tickleftformat",
|
|
634
|
+
"tickbottomformat",
|
|
635
|
+
"tickrightformat",
|
|
636
|
+
"svgs",
|
|
637
|
+
"margins"
|
|
638
|
+
];
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
get data() {
|
|
642
|
+
return this.$$.ctx[8];
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
set data(data) {
|
|
646
|
+
this.$$set({ data });
|
|
647
|
+
flush();
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
get chartheight() {
|
|
651
|
+
return this.$$.ctx[9];
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
set chartheight(chartheight) {
|
|
655
|
+
this.$$set({ chartheight });
|
|
656
|
+
flush();
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
get backgroundcolor() {
|
|
660
|
+
return this.$$.ctx[0];
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
set backgroundcolor(backgroundcolor) {
|
|
664
|
+
this.$$set({ backgroundcolor });
|
|
665
|
+
flush();
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
get leftscalemax() {
|
|
669
|
+
return this.$$.ctx[10];
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
set leftscalemax(leftscalemax) {
|
|
673
|
+
this.$$set({ leftscalemax });
|
|
674
|
+
flush();
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
get rightscalemax() {
|
|
678
|
+
return this.$$.ctx[11];
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
set rightscalemax(rightscalemax) {
|
|
682
|
+
this.$$set({ rightscalemax });
|
|
683
|
+
flush();
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
get color() {
|
|
687
|
+
return this.$$.ctx[12];
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
set color(color) {
|
|
691
|
+
this.$$set({ color });
|
|
692
|
+
flush();
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
get ticknumbers() {
|
|
696
|
+
return this.$$.ctx[13];
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
set ticknumbers(ticknumbers) {
|
|
700
|
+
this.$$set({ ticknumbers });
|
|
701
|
+
flush();
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
get tickleftformat() {
|
|
705
|
+
return this.$$.ctx[14];
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
set tickleftformat(tickleftformat) {
|
|
709
|
+
this.$$set({ tickleftformat });
|
|
710
|
+
flush();
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
get tickbottomformat() {
|
|
714
|
+
return this.$$.ctx[15];
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
set tickbottomformat(tickbottomformat) {
|
|
718
|
+
this.$$set({ tickbottomformat });
|
|
719
|
+
flush();
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
get tickrightformat() {
|
|
723
|
+
return this.$$.ctx[16];
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
set tickrightformat(tickrightformat) {
|
|
727
|
+
this.$$set({ tickrightformat });
|
|
728
|
+
flush();
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
get svgs() {
|
|
732
|
+
return this.$$.ctx[17];
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
set svgs(svgs) {
|
|
736
|
+
this.$$set({ svgs });
|
|
737
|
+
flush();
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
get margins() {
|
|
741
|
+
return this.$$.ctx[18];
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
set margins(margins) {
|
|
745
|
+
this.$$set({ margins });
|
|
746
|
+
flush();
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export { GroupedBarChart as default };
|
|
2
751
|
//# sourceMappingURL=GroupedBarChart.js.map
|