@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,1190 @@
|
|
|
1
|
-
import{S as t,i as e,a as n,b as i,f as r,s as a,e as l,d as o,n as s,g,y as d,j as c,o as h,J as m,a1 as f,T as u,l as p,t as x,k as y,K as b,v as w,Z as k}from"../../index-c33b3772.js";import{s as $,a as v}from"../../transform-15d69d5d.js";import{E as _}from"../../EventHandler-02058705.js";import{c as A,a as z}from"../../array-5b770a93.js";import{w as T,p as j,c as E,s as R,h as M,e as O,t as S,a as N,m as C,b as D,d as F,f as I,g as J,i as P}from"../../path-1b5da959.js";function q(t){return t.innerRadius}function B(t){return t.outerRadius}function H(t){return t.startAngle}function K(t){return t.endAngle}function L(t){return t&&t.padAngle}function V(t,e,n,i,r,a,l){var o=t-n,s=e-i,g=(l?a:-a)/N(o*o+s*s),d=g*s,c=-g*o,h=t+d,m=e+c,f=n+d,u=i+c,p=(h+f)/2,x=(m+u)/2,y=f-h,b=u-m,w=y*y+b*b,k=r-a,$=h*u-f*m,v=(b<0?-1:1)*N(P(0,k*k*w-$*$)),_=($*b-y*v)/w,A=(-$*y-b*v)/w,z=($*b+y*v)/w,T=(-$*y+b*v)/w,j=_-p,E=A-x,R=z-p,M=T-x;return j*j+E*E>R*R+M*M&&(_=z,A=T),{cx:_,cy:A,x01:-d,y01:-c,x11:_*(r/k-1),y11:A*(r/k-1)}}function X(){var t=q,e=B,n=A(0),i=null,r=H,a=K,l=L,o=null,s=T(g);function g(){var g,d,c=+t.apply(this,arguments),h=+e.apply(this,arguments),m=r.apply(this,arguments)-M,f=a.apply(this,arguments)-M,u=D(f-m),p=f>m;if(o||(o=g=s()),h<c&&(d=h,h=c,c=d),h>O)if(u>S-O)o.moveTo(h*E(m),h*R(m)),o.arc(0,0,h,m,f,!p),c>O&&(o.moveTo(c*E(f),c*R(f)),o.arc(0,0,c,f,m,p));else{var x,y,b=m,w=f,k=m,$=f,v=u,_=u,A=l.apply(this,arguments)/2,z=A>O&&(i?+i.apply(this,arguments):N(c*c+h*h)),T=C(D(h-c)/2,+n.apply(this,arguments)),P=T,q=T;if(z>O){var B=I(z/c*R(A)),H=I(z/h*R(A));(v-=2*B)>O?(k+=B*=p?1:-1,$-=B):(v=0,k=$=(m+f)/2),(_-=2*H)>O?(b+=H*=p?1:-1,w-=H):(_=0,b=w=(m+f)/2)}var K=h*E(b),L=h*R(b),X=c*E($),Y=c*R($);if(T>O){var Z,G=h*E(w),Q=h*R(w),U=c*E(k),W=c*R(k);if(u<j)if(Z=function(t,e,n,i,r,a,l,o){var s=n-t,g=i-e,d=l-r,c=o-a,h=c*s-d*g;if(!(h*h<O))return[t+(h=(d*(e-a)-c*(t-r))/h)*s,e+h*g]}(K,L,U,W,G,Q,X,Y)){var tt=K-Z[0],et=L-Z[1],nt=G-Z[0],it=Q-Z[1],rt=1/R(J((tt*nt+et*it)/(N(tt*tt+et*et)*N(nt*nt+it*it)))/2),at=N(Z[0]*Z[0]+Z[1]*Z[1]);P=C(T,(c-at)/(rt-1)),q=C(T,(h-at)/(rt+1))}else P=q=0}_>O?q>O?(x=V(U,W,K,L,h,q,p),y=V(G,Q,X,Y,h,q,p),o.moveTo(x.cx+x.x01,x.cy+x.y01),q<T?o.arc(x.cx,x.cy,q,F(x.y01,x.x01),F(y.y01,y.x01),!p):(o.arc(x.cx,x.cy,q,F(x.y01,x.x01),F(x.y11,x.x11),!p),o.arc(0,0,h,F(x.cy+x.y11,x.cx+x.x11),F(y.cy+y.y11,y.cx+y.x11),!p),o.arc(y.cx,y.cy,q,F(y.y11,y.x11),F(y.y01,y.x01),!p))):(o.moveTo(K,L),o.arc(0,0,h,b,w,!p)):o.moveTo(K,L),c>O&&v>O?P>O?(x=V(X,Y,G,Q,c,-P,p),y=V(K,L,U,W,c,-P,p),o.lineTo(x.cx+x.x01,x.cy+x.y01),P<T?o.arc(x.cx,x.cy,P,F(x.y01,x.x01),F(y.y01,y.x01),!p):(o.arc(x.cx,x.cy,P,F(x.y01,x.x01),F(x.y11,x.x11),!p),o.arc(0,0,c,F(x.cy+x.y11,x.cx+x.x11),F(y.cy+y.y11,y.cx+y.x11),p),o.arc(y.cx,y.cy,P,F(y.y11,y.x11),F(y.y01,y.x01),!p))):o.arc(0,0,c,$,k,p):o.lineTo(X,Y)}else o.moveTo(0,0);if(o.closePath(),g)return o=null,g+""||null}return g.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +a.apply(this,arguments))/2-j/2;return[E(i)*n,R(i)*n]},g.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:A(+e),g):t},g.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:A(+t),g):e},g.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:A(+t),g):n},g.padRadius=function(t){return arguments.length?(i=null==t?null:"function"==typeof t?t:A(+t),g):i},g.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:A(+t),g):r},g.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:A(+t),g):a},g.padAngle=function(t){return arguments.length?(l="function"==typeof t?t:A(+t),g):l},g.context=function(t){return arguments.length?(o=null==t?null:t,g):o},g}function Y(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function Z(t){return t}function G(t,e,n){const i=t.slice();return i[7]=e[n],i}function Q(t,e,n){const i=t.slice();return i[4]=e[n],i[33]=n,i}function U(t,e,n){const i=t.slice();return i[34]=e[n],i}function W(t){let e,n,r,a=t[34].split(t[1])[1]+"";return{c(){e=l("span"),n=x("("),r=x(a),g(e,"class","legend__text--light")},m(t,a){i(t,e,a),c(e,n),c(e,r)},p(t,e){67&e[0]&&a!==(a=t[34].split(t[1])[1]+"")&&y(r,a)},d(t){t&&h(e)}}}function tt(t){let e,n,r,a,s,d=t[34].split(t[1])[0]+"",m=t[34].split(t[1])[1],f=m&&W(t);return{c(){e=l("p"),n=x(d),r=o(),f&&f.c(),a=o(),g(e,"class",s=at(t[4].checked))},m(t,l){i(t,e,l),c(e,n),c(e,r),f&&f.m(e,null),c(e,a)},p(t,i){67&i[0]&&d!==(d=t[34].split(t[1])[0]+"")&&y(n,d),67&i[0]&&(m=t[34].split(t[1])[1]),m?f?f.p(t,i):(f=W(t),f.c(),f.m(e,a)):f&&(f.d(1),f=null),64&i[0]&&s!==(s=at(t[4].checked))&&g(e,"class",s)},d(t){t&&h(e),f&&f.d()}}}function et(t){let e,n,r,a,s,d,f,x,y,b=t[4].name.split(t[0]),w=[];for(let e=0;e<b.length;e+=1)w[e]=tt(U(t,b,e));function k(){return t[20](t[4])}return{c(){e=l("button"),n=u("svg"),r=u("rect"),s=o(),d=l("div");for(let t=0;t<w.length;t+=1)w[t].c();f=o(),g(r,"x","0"),g(r,"y","0"),g(r,"width","24"),g(r,"height","16"),g(r,"fill",a=t[12](t[4],t[33],t[10],t[9])),g(n,"class","legend__box"),g(e,"class","legend__item")},m(t,a){i(t,e,a),c(e,n),c(n,r),c(e,s),c(e,d);for(let t=0;t<w.length;t+=1)w[t]&&w[t].m(d,null);c(e,f),x||(y=p(e,"click",k),x=!0)},p(e,n){if(t=e,1600&n[0]&&a!==(a=t[12](t[4],t[33],t[10],t[9]))&&g(r,"fill",a),67&n[0]){let e;for(b=t[4].name.split(t[0]),e=0;e<b.length;e+=1){const i=U(t,b,e);w[e]?w[e].p(i,n):(w[e]=tt(i),w[e].c(),w[e].m(d,null))}for(;e<w.length;e+=1)w[e].d(1);w.length=b.length}},d(t){t&&h(e),m(w,t),x=!1,y()}}}function nt(t){let e,n,r=t[8].text+"";return{c(){e=l("div"),n=x(r),g(e,"class","chart__tooltip"),d(e,"left",t[8].left),d(e,"top",t[8].top)},m(t,r){i(t,e,r),c(e,n)},p(t,i){256&i[0]&&r!==(r=t[8].text+"")&&y(n,r),256&i[0]&&d(e,"left",t[8].left),256&i[0]&&d(e,"top",t[8].top)},d(t){t&&h(e)}}}function it(t){let e,n,r=t[7]+"";return{c(){e=new k(!1),n=b(),e.a=n},m(t,a){e.m(r,t,a),i(t,n,a)},p(t,n){1024&n[0]&&r!==(r=t[7]+"")&&e.p(r)},d(t){t&&h(n),t&&e.d()}}}function rt(t){let e,n,r,a,f,u,p=t[6],x=[];for(let e=0;e<p.length;e+=1)x[e]=et(Q(t,p,e));let y=t[8].show&&nt(t),b=t[10],w=[];for(let e=0;e<b.length;e+=1)w[e]=it(G(t,b,e));return{c(){e=l("div"),n=l("div");for(let t=0;t<x.length;t+=1)x[t].c();r=o(),y&&y.c(),f=o(),u=l("div");for(let t=0;t<w.length;t+=1)w[t].c();this.c=s,g(n,"class","legend"),g(e,"class",a="chart "+lt(t[3])),d(e,"background-color",t[2]),d(u,"height","0"),d(u,"width","0"),g(u,"class","pattern")},m(a,l){i(a,e,l),c(e,n);for(let t=0;t<x.length;t+=1)x[t]&&x[t].m(n,null);c(e,r),y&&y.m(e,null),t[21](e),i(a,f,l),i(a,u,l);for(let t=0;t<w.length;t+=1)w[t]&&w[t].m(u,null)},p(t,i){if(7747&i[0]){let e;for(p=t[6],e=0;e<p.length;e+=1){const r=Q(t,p,e);x[e]?x[e].p(r,i):(x[e]=et(r),x[e].c(),x[e].m(n,null))}for(;e<x.length;e+=1)x[e].d(1);x.length=p.length}if(t[8].show?y?y.p(t,i):(y=nt(t),y.c(),y.m(e,null)):y&&(y.d(1),y=null),8&i[0]&&a!==(a="chart "+lt(t[3]))&&g(e,"class",a),4&i[0]&&d(e,"background-color",t[2]),1024&i[0]){let e;for(b=t[10],e=0;e<b.length;e+=1){const n=G(t,b,e);w[e]?w[e].p(n,i):(w[e]=it(n),w[e].c(),w[e].m(u,null))}for(;e<w.length;e+=1)w[e].d(1);w.length=b.length}},i:s,o:s,d(n){n&&h(e),m(x,n),y&&y.d(),t[21](null),n&&h(f),n&&h(u),m(w,n)}}}function at(t){return"legend__text"+(t?" legend__text--not-selected":"")}function lt(t){switch(t){case"top":return"chart--top";case"right":default:return"chart--right";case"bottom":return"chart--bottom";case"left":return"chart--left"}}function ot(t,e,n){let i,r,a,l,o,s,{data:g=""}=e,{svgs:d}=e,{colors:c}=e,{title:h}=e,{legendseparator:m=","}=e,{legendseparatorcount:u="("}=e,{dimension:p=250}=e,{padangle:x=.05}=e,{backgroundcolor:y="#fff"}=e,{delay:b=500}=e,{legendposition:k="right"}=e,T=!1,j=new _,E={left:"0px",top:"0px",text:"",show:!1};const R=p/2,M=X().outerRadius(R-5).innerRadius(R-60).padAngle(x),O=function(){var t=Z,e=Y,n=null,i=A(0),r=A(S),a=A(0);function l(l){var o,s,g,d,c,h=(l=z(l)).length,m=0,f=new Array(h),u=new Array(h),p=+i.apply(this,arguments),x=Math.min(S,Math.max(-S,r.apply(this,arguments)-p)),y=Math.min(Math.abs(x)/h,a.apply(this,arguments)),b=y*(x<0?-1:1);for(o=0;o<h;++o)(c=u[f[o]=o]=+t(l[o],o,l))>0&&(m+=c);for(null!=e?f.sort((function(t,n){return e(u[t],u[n])})):null!=n&&f.sort((function(t,e){return n(l[t],l[e])})),o=0,g=m?(x-h*b)/m:0;o<h;++o,p=d)s=f[o],d=p+((c=u[s])>0?c*g:0)+b,u[s]={data:l[s],index:o,value:c,startAngle:p,endAngle:d,padAngle:y};return u}return l.value=function(e){return arguments.length?(t="function"==typeof e?e:A(+e),l):t},l.sortValues=function(t){return arguments.length?(e=t,n=null,l):e},l.sort=function(t){return arguments.length?(n=t,e=null,l):n},l.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:A(+t),l):i},l.endAngle=function(t){return arguments.length?(r="function"==typeof t?t:A(+t),l):r},l.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:A(+t),l):a},l}().sort(null).startAngle(1.1*Math.PI).endAngle(3.1*Math.PI).value((t=>t.total)),N=()=>i?i.filter((t=>!t.checked)).reduce(((t,e)=>t+e.total),0):[];function C(t){s.selectAll("path").data(O(t)).transition().duration(b).attr("stroke-width",((t,e)=>i[e].checked?"0px":"4px")).attrTween("d",(function(t){const e=v(this._current,t);return this._current=e(0),t=>M(e(t))||""})),s.selectAll("svg text").filter((function(){return/^[0-9]/.test($(this).text())})).text(String(N()))}function D(t){const e=s.selectAll("path").data().map(((e,r)=>{const a=e.data;if(a.name===t){n(6,i[r].checked=!i[r].checked,i);const t=0===a.total?i[r].total:0;return Object.assign(Object.assign({},a),{total:t})}return Object.assign({},a)}));C(e)}f((()=>n(19,T=!0)));return t.$$set=t=>{"data"in t&&n(4,g=t.data),"svgs"in t&&n(13,d=t.svgs),"colors"in t&&n(14,c=t.colors),"title"in t&&n(15,h=t.title),"legendseparator"in t&&n(0,m=t.legendseparator),"legendseparatorcount"in t&&n(1,u=t.legendseparatorcount),"dimension"in t&&n(16,p=t.dimension),"padangle"in t&&n(17,x=t.padangle),"backgroundcolor"in t&&n(2,y=t.backgroundcolor),"delay"in t&&n(18,b=t.delay),"legendposition"in t&&n(3,k=t.legendposition)},t.$$.update=()=>{16&t.$$.dirty[0]&&n(6,i=g?JSON.parse(g):[]),8192&t.$$.dirty[0]&&n(10,r=d?JSON.parse(d):[]),16384&t.$$.dirty[0]&&n(9,a=c?JSON.parse(c):["#605F9D","#D9F0F3","#EAEDEF","#0B96CC","#EA7315","#EA302D"]),64&t.$$.dirty[0]&&(l=i?i.filter((t=>!t.checked)).reduce(((t,e)=>t+e.total),0):[]),59e4&t.$$.dirty[0]&&g.length>0&&T&&(s?s.selectAll("path").remove():n(7,s=$(o).append("svg").attr("width",p).attr("height",p).append("g").attr("transform","translate("+p/2+","+p/2+")")),(()=>{const t=s.selectAll("path").data(O(i)).enter().append("path").attr("class","chart__arc").attr("title",(t=>t.data.name)).attr("stroke",(t=>`${a[t.index]}`)).attr("stroke-width","4px").style("fill",(t=>r.length>0?`url(#${t.data.patternId})`:(a.length,`${a[t.index]}`)));s.append("svg:text").attr("text-anchor","middle").attr("font-size","28").attr("fill","#333").text(String(l)),s.append("svg:text").attr("text-anchor","middle").attr("font-size","22").attr("fill","#333").attr("dy","1.5rem").text(h),t.transition().delay(((t,e)=>e*b)).duration(b).attrTween("d",(t=>{if(0===t.data.total)return()=>"";const e=v(t.startAngle+.1,t.endAngle);return n=>(t.endAngle=e(n),M(t)||"")})),t.on("mousemove",((t,e)=>{n(8,E={left:t.pageX+10+"px",top:t.pageY-25+"px",text:e.data.customTooltip?e.data.customTooltip:e.data.name,show:!0})})).on("mouseover",((t,e)=>{var n=s.selectAll(".chart__arc").filter((function(t){return t===e})),i=s.selectAll(".chart__arc").filter((function(t){return t!=e}));i.style("opacity",.7),n.style("transform","scale(1.02)")})).on("mouseout",((t,e)=>{var i=s.selectAll(".chart__arc").filter((function(t){return t===e})),r=s.selectAll(".chart__arc").filter((function(t){return t!=e}));r.style("opacity",1),i.style("transform","scale(1)"),n(8,E.show=!1,E)})).on("click",((t,e)=>{j.dispatch("donut-clicked",e)})),setTimeout((()=>{C(i)}),b*i.length)})())},[m,u,y,k,g,o,i,s,E,a,r,D,function(t,e,n,i){return n.length>0?`url(#${t.patternId})`:i.length>0?a[e]:void 0},d,c,h,p,x,b,T,t=>D(t.name),function(t){w[t?"unshift":"push"]((()=>{o=t,n(5,o)}))}]}class st extends t{constructor(t){super();const l=document.createElement("style");l.textContent='.mt-heading{font-family:"LeroyMerlin", sans-serif;font-weight:400;color:#000000;display:block;margin-bottom:2rem}.mt-heading--underline::after{content:"";display:block;height:0.25rem;background-color:#46a610}.mt-heading--line-primary-01-200::after,.mt-heading--line-lightest::after{background-color:#c5e39e}.mt-heading--line-primary-02-200::after{background-color:#cfd2d8}.mt-heading--line-primary-02-600::after{background-color:#494f60}.mt-heading--center{text-align:center}.mt-heading--center.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right{text-align:right}.mt-heading--right.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left{text-align:left}.mt-heading--left.mt-heading--underline::after{margin-left:0;margin-right:auto}.mt-heading--s{font-size:1.4375rem;line-height:1.3913043478}.mt-heading--s.mt-heading--underline::after{width:4rem;margin-top:1rem}.mt-heading--s.mt-heading--line-height-xs{line-height:1.0434782609}.mt-heading--m{font-size:1.75rem;line-height:1.2857142857}.mt-heading--m.mt-heading--underline::after{width:4.5rem;margin-top:1rem}.mt-heading--m.mt-heading--line-height-xs{line-height:1}.mt-heading--l{font-size:2.125rem;line-height:1.2941176471}.mt-heading--l.mt-heading--underline::after{width:5rem;margin-top:1.25rem}.mt-heading--l.mt-heading--line-height-xs{line-height:1.0588235294}.mt-heading--lightest{color:#ffffff}.mt-heading--light{font-weight:300}.mt-heading--semi-bold,.mt-heading--underline{font-weight:600}@media screen and (min-width: 680px){.mt-heading--center\\@from-m{text-align:center}.mt-heading--center\\@from-m.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right\\@from-m{text-align:right}.mt-heading--right\\@from-m.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left\\@from-m{text-align:left}.mt-heading--left\\@from-m.mt-heading--underline::after{margin-left:0;margin-right:auto}.mt-heading--s{font-size:1.75rem;line-height:1.2857142857}.mt-heading--s.mt-heading--underline::after{width:4.5rem;margin-top:1rem}.mt-heading--s.mt-heading--line-height-xs{line-height:1}.mt-heading--m{font-size:2.125rem;line-height:1.2941176471}.mt-heading--m.mt-heading--underline::after{width:5rem;margin-top:1.25rem}.mt-heading--m.mt-heading--line-height-xs{line-height:1.0588235294}.mt-heading--l{font-size:2.5625rem;line-height:1.3658536585}.mt-heading--l.mt-heading--underline::after{width:5.5rem;margin-top:1.5rem}.mt-heading--l.mt-heading--line-height-xs{line-height:0.9756097561}}@media screen and (min-width: 1024px){.mt-heading--center\\@from-l{text-align:center}.mt-heading--center\\@from-l.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right\\@from-l{text-align:right}.mt-heading--right\\@from-l.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left\\@from-l{text-align:left}.mt-heading--left\\@from-l.mt-heading--underline::after{margin-left:0;margin-right:auto}.mt-heading--s{font-size:2.125rem;line-height:1.2941176471}.mt-heading--s.mt-heading--underline::after{width:5rem;margin-top:1.25rem}.mt-heading--s.mt-heading--line-height-xs{line-height:1.0588235294}.mt-heading--m{font-size:2.5625rem;line-height:1.3658536585}.mt-heading--m.mt-heading--underline::after{width:5.5rem;margin-top:1.5rem}.mt-heading--m.mt-heading--line-height-xs{line-height:0.9756097561}.mt-heading--l{font-size:3.0625rem;line-height:1.387755102;margin-bottom:3.5rem}.mt-heading--l.mt-heading--underline::after{width:6rem;margin-top:2rem}.mt-heading--l.mt-heading--line-height-xs{line-height:0.9795918367}}@media screen and (min-width: 1280px){.mt-heading--center\\@from-xl{text-align:center}.mt-heading--center\\@from-xl.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right\\@from-xl{text-align:right}.mt-heading--right\\@from-xl.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left\\@from-xl{text-align:left}.mt-heading--left\\@from-xl.mt-heading--underline::after{margin-left:0;margin-right:auto}}@media screen and (min-width: 1920px){.mt-heading--center\\@from-xxl{text-align:center}.mt-heading--center\\@from-xxl.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right\\@from-xxl{text-align:right}.mt-heading--right\\@from-xxl.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left\\@from-xxl{text-align:left}.mt-heading--left\\@from-xxl.mt-heading--underline::after{margin-left:0;margin-right:auto}}.opaque{opacity:0.7}.chart{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;background-color:#ffffff;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.chart--top{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.chart--right{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.chart--bottom{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.chart--left{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.chart__tooltip{position:absolute;width:auto;height:auto;background-color:#4d4d4d;border-radius:4px;color:#ffffff;padding:0.5rem 1rem;text-align:center}.chart__arc{cursor:pointer;-webkit-transition:-webkit-transform 0.3s ease;transition:-webkit-transform 0.3s ease;-o-transition:transform 0.3s ease;transition:transform 0.3s ease;transition:transform 0.3s ease, -webkit-transform 0.3s ease}.legend{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;padding:0 1.5rem;height:100%;margin:0;color:#000000}.legend__title{padding:0.75rem;white-space:nowrap;margin:0}.legend__title--light{color:#808080}.legend__item{cursor:pointer;background:none;border:none;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;margin-left:0.75rem;margin-bottom:0.25rem;font-size:0.875rem}.legend__item:focus,.legend__item:hover{outline:0;text-decoration:underline}.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.75rem;height:16px;width:24px}.legend__text{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;white-space:nowrap;margin:0 0 0.25rem 0;padding:0}.legend__text--light{color:#808080}.legend__text--not-selected{text-decoration:line-through}.pattern{z-index:-1;position:absolute}',this.shadowRoot.appendChild(l),e(this,{target:this.shadowRoot,props:n(this.attributes),customElement:!0},ot,rt,a,{data:4,svgs:13,colors:14,title:15,legendseparator:0,legendseparatorcount:1,dimension:16,padangle:17,backgroundcolor:2,delay:18,legendposition:3},null,[-1,-1]),t&&(t.target&&i(t.target,this,t.anchor),t.props&&(this.$set(t.props),r()))}static get observedAttributes(){return["data","svgs","colors","title","legendseparator","legendseparatorcount","dimension","padangle","backgroundcolor","delay","legendposition"]}get data(){return this.$$.ctx[4]}set data(t){this.$$set({data:t}),r()}get svgs(){return this.$$.ctx[13]}set svgs(t){this.$$set({svgs:t}),r()}get colors(){return this.$$.ctx[14]}set colors(t){this.$$set({colors:t}),r()}get title(){return this.$$.ctx[15]}set title(t){this.$$set({title:t}),r()}get legendseparator(){return this.$$.ctx[0]}set legendseparator(t){this.$$set({legendseparator:t}),r()}get legendseparatorcount(){return this.$$.ctx[1]}set legendseparatorcount(t){this.$$set({legendseparatorcount:t}),r()}get dimension(){return this.$$.ctx[16]}set dimension(t){this.$$set({dimension:t}),r()}get padangle(){return this.$$.ctx[17]}set padangle(t){this.$$set({padangle:t}),r()}get backgroundcolor(){return this.$$.ctx[2]}set backgroundcolor(t){this.$$set({backgroundcolor:t}),r()}get delay(){return this.$$.ctx[18]}set delay(t){this.$$set({delay:t}),r()}get legendposition(){return this.$$.ctx[3]}set legendposition(t){this.$$set({legendposition:t}),r()}}customElements.define("m-donut",st);export{st 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, n as noop, g as attr, y as set_style, j as append, o as detach, J as destroy_each, a1 as onMount, T as svg_element, l as listen, t as text, k as set_data, K as empty, v as binding_callbacks, Z as HtmlTag } from '../../index-c33b3772.js';
|
|
2
|
+
import { s as select, a as interpolate } from '../../transform-15d69d5d.js';
|
|
3
|
+
import { E as EventHandler } from '../../EventHandler-02058705.js';
|
|
4
|
+
import { c as constant, a as array } from '../../array-5b770a93.js';
|
|
5
|
+
import { w as withPath, p as pi, c as cos, s as sin, h as halfPi, e as epsilon, t as tau, a as sqrt, m as min, b as abs, d as atan2, f as asin, g as acos, i as max } from '../../path-1b5da959.js';
|
|
6
|
+
|
|
7
|
+
function arcInnerRadius(d) {
|
|
8
|
+
return d.innerRadius;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function arcOuterRadius(d) {
|
|
12
|
+
return d.outerRadius;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function arcStartAngle(d) {
|
|
16
|
+
return d.startAngle;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function arcEndAngle(d) {
|
|
20
|
+
return d.endAngle;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function arcPadAngle(d) {
|
|
24
|
+
return d && d.padAngle; // Note: optional!
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
28
|
+
var x10 = x1 - x0, y10 = y1 - y0,
|
|
29
|
+
x32 = x3 - x2, y32 = y3 - y2,
|
|
30
|
+
t = y32 * x10 - x32 * y10;
|
|
31
|
+
if (t * t < epsilon) return;
|
|
32
|
+
t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
|
|
33
|
+
return [x0 + t * x10, y0 + t * y10];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Compute perpendicular offset line of length rc.
|
|
37
|
+
// http://mathworld.wolfram.com/Circle-LineIntersection.html
|
|
38
|
+
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
39
|
+
var x01 = x0 - x1,
|
|
40
|
+
y01 = y0 - y1,
|
|
41
|
+
lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01),
|
|
42
|
+
ox = lo * y01,
|
|
43
|
+
oy = -lo * x01,
|
|
44
|
+
x11 = x0 + ox,
|
|
45
|
+
y11 = y0 + oy,
|
|
46
|
+
x10 = x1 + ox,
|
|
47
|
+
y10 = y1 + oy,
|
|
48
|
+
x00 = (x11 + x10) / 2,
|
|
49
|
+
y00 = (y11 + y10) / 2,
|
|
50
|
+
dx = x10 - x11,
|
|
51
|
+
dy = y10 - y11,
|
|
52
|
+
d2 = dx * dx + dy * dy,
|
|
53
|
+
r = r1 - rc,
|
|
54
|
+
D = x11 * y10 - x10 * y11,
|
|
55
|
+
d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D * D)),
|
|
56
|
+
cx0 = (D * dy - dx * d) / d2,
|
|
57
|
+
cy0 = (-D * dx - dy * d) / d2,
|
|
58
|
+
cx1 = (D * dy + dx * d) / d2,
|
|
59
|
+
cy1 = (-D * dx + dy * d) / d2,
|
|
60
|
+
dx0 = cx0 - x00,
|
|
61
|
+
dy0 = cy0 - y00,
|
|
62
|
+
dx1 = cx1 - x00,
|
|
63
|
+
dy1 = cy1 - y00;
|
|
64
|
+
|
|
65
|
+
// Pick the closer of the two intersection points.
|
|
66
|
+
// TODO Is there a faster way to determine which intersection to use?
|
|
67
|
+
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
cx: cx0,
|
|
71
|
+
cy: cy0,
|
|
72
|
+
x01: -ox,
|
|
73
|
+
y01: -oy,
|
|
74
|
+
x11: cx0 * (r1 / r - 1),
|
|
75
|
+
y11: cy0 * (r1 / r - 1)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function d3Arc() {
|
|
80
|
+
var innerRadius = arcInnerRadius,
|
|
81
|
+
outerRadius = arcOuterRadius,
|
|
82
|
+
cornerRadius = constant(0),
|
|
83
|
+
padRadius = null,
|
|
84
|
+
startAngle = arcStartAngle,
|
|
85
|
+
endAngle = arcEndAngle,
|
|
86
|
+
padAngle = arcPadAngle,
|
|
87
|
+
context = null,
|
|
88
|
+
path = withPath(arc);
|
|
89
|
+
|
|
90
|
+
function arc() {
|
|
91
|
+
var buffer,
|
|
92
|
+
r,
|
|
93
|
+
r0 = +innerRadius.apply(this, arguments),
|
|
94
|
+
r1 = +outerRadius.apply(this, arguments),
|
|
95
|
+
a0 = startAngle.apply(this, arguments) - halfPi,
|
|
96
|
+
a1 = endAngle.apply(this, arguments) - halfPi,
|
|
97
|
+
da = abs(a1 - a0),
|
|
98
|
+
cw = a1 > a0;
|
|
99
|
+
|
|
100
|
+
if (!context) context = buffer = path();
|
|
101
|
+
|
|
102
|
+
// Ensure that the outer radius is always larger than the inner radius.
|
|
103
|
+
if (r1 < r0) r = r1, r1 = r0, r0 = r;
|
|
104
|
+
|
|
105
|
+
// Is it a point?
|
|
106
|
+
if (!(r1 > epsilon)) context.moveTo(0, 0);
|
|
107
|
+
|
|
108
|
+
// Or is it a circle or annulus?
|
|
109
|
+
else if (da > tau - epsilon) {
|
|
110
|
+
context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
|
111
|
+
context.arc(0, 0, r1, a0, a1, !cw);
|
|
112
|
+
if (r0 > epsilon) {
|
|
113
|
+
context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
|
114
|
+
context.arc(0, 0, r0, a1, a0, cw);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Or is it a circular or annular sector?
|
|
119
|
+
else {
|
|
120
|
+
var a01 = a0,
|
|
121
|
+
a11 = a1,
|
|
122
|
+
a00 = a0,
|
|
123
|
+
a10 = a1,
|
|
124
|
+
da0 = da,
|
|
125
|
+
da1 = da,
|
|
126
|
+
ap = padAngle.apply(this, arguments) / 2,
|
|
127
|
+
rp = (ap > epsilon) && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)),
|
|
128
|
+
rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)),
|
|
129
|
+
rc0 = rc,
|
|
130
|
+
rc1 = rc,
|
|
131
|
+
t0,
|
|
132
|
+
t1;
|
|
133
|
+
|
|
134
|
+
// Apply padding? Note that since r1 ≥ r0, da1 ≥ da0.
|
|
135
|
+
if (rp > epsilon) {
|
|
136
|
+
var p0 = asin(rp / r0 * sin(ap)),
|
|
137
|
+
p1 = asin(rp / r1 * sin(ap));
|
|
138
|
+
if ((da0 -= p0 * 2) > epsilon) p0 *= (cw ? 1 : -1), a00 += p0, a10 -= p0;
|
|
139
|
+
else da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
|
140
|
+
if ((da1 -= p1 * 2) > epsilon) p1 *= (cw ? 1 : -1), a01 += p1, a11 -= p1;
|
|
141
|
+
else da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var x01 = r1 * cos(a01),
|
|
145
|
+
y01 = r1 * sin(a01),
|
|
146
|
+
x10 = r0 * cos(a10),
|
|
147
|
+
y10 = r0 * sin(a10);
|
|
148
|
+
|
|
149
|
+
// Apply rounded corners?
|
|
150
|
+
if (rc > epsilon) {
|
|
151
|
+
var x11 = r1 * cos(a11),
|
|
152
|
+
y11 = r1 * sin(a11),
|
|
153
|
+
x00 = r0 * cos(a00),
|
|
154
|
+
y00 = r0 * sin(a00),
|
|
155
|
+
oc;
|
|
156
|
+
|
|
157
|
+
// Restrict the corner radius according to the sector angle. If this
|
|
158
|
+
// intersection fails, it’s probably because the arc is too small, so
|
|
159
|
+
// disable the corner radius entirely.
|
|
160
|
+
if (da < pi) {
|
|
161
|
+
if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
|
|
162
|
+
var ax = x01 - oc[0],
|
|
163
|
+
ay = y01 - oc[1],
|
|
164
|
+
bx = x11 - oc[0],
|
|
165
|
+
by = y11 - oc[1],
|
|
166
|
+
kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2),
|
|
167
|
+
lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
168
|
+
rc0 = min(rc, (r0 - lc) / (kc - 1));
|
|
169
|
+
rc1 = min(rc, (r1 - lc) / (kc + 1));
|
|
170
|
+
} else {
|
|
171
|
+
rc0 = rc1 = 0;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Is the sector collapsed to a line?
|
|
177
|
+
if (!(da1 > epsilon)) context.moveTo(x01, y01);
|
|
178
|
+
|
|
179
|
+
// Does the sector’s outer ring have rounded corners?
|
|
180
|
+
else if (rc1 > epsilon) {
|
|
181
|
+
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
|
182
|
+
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
|
183
|
+
|
|
184
|
+
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
185
|
+
|
|
186
|
+
// Have the corners merged?
|
|
187
|
+
if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
188
|
+
|
|
189
|
+
// Otherwise, draw the two corners and the ring.
|
|
190
|
+
else {
|
|
191
|
+
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
192
|
+
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
|
193
|
+
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Or is the outer ring just a circular arc?
|
|
198
|
+
else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
|
199
|
+
|
|
200
|
+
// Is there no inner ring, and it’s a circular sector?
|
|
201
|
+
// Or perhaps it’s an annular sector collapsed due to padding?
|
|
202
|
+
if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);
|
|
203
|
+
|
|
204
|
+
// Does the sector’s inner ring (or point) have rounded corners?
|
|
205
|
+
else if (rc0 > epsilon) {
|
|
206
|
+
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
|
207
|
+
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
|
208
|
+
|
|
209
|
+
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
210
|
+
|
|
211
|
+
// Have the corners merged?
|
|
212
|
+
if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
213
|
+
|
|
214
|
+
// Otherwise, draw the two corners and the ring.
|
|
215
|
+
else {
|
|
216
|
+
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
217
|
+
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
|
218
|
+
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// Or is the inner ring just a circular arc?
|
|
223
|
+
else context.arc(0, 0, r0, a10, a00, cw);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
context.closePath();
|
|
227
|
+
|
|
228
|
+
if (buffer) return context = null, buffer + "" || null;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
arc.centroid = function() {
|
|
232
|
+
var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2,
|
|
233
|
+
a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
|
|
234
|
+
return [cos(a) * r, sin(a) * r];
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
arc.innerRadius = function(_) {
|
|
238
|
+
return arguments.length ? (innerRadius = typeof _ === "function" ? _ : constant(+_), arc) : innerRadius;
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
arc.outerRadius = function(_) {
|
|
242
|
+
return arguments.length ? (outerRadius = typeof _ === "function" ? _ : constant(+_), arc) : outerRadius;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
arc.cornerRadius = function(_) {
|
|
246
|
+
return arguments.length ? (cornerRadius = typeof _ === "function" ? _ : constant(+_), arc) : cornerRadius;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
arc.padRadius = function(_) {
|
|
250
|
+
return arguments.length ? (padRadius = _ == null ? null : typeof _ === "function" ? _ : constant(+_), arc) : padRadius;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
arc.startAngle = function(_) {
|
|
254
|
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), arc) : startAngle;
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
arc.endAngle = function(_) {
|
|
258
|
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), arc) : endAngle;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
arc.padAngle = function(_) {
|
|
262
|
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), arc) : padAngle;
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
arc.context = function(_) {
|
|
266
|
+
return arguments.length ? ((context = _ == null ? null : _), arc) : context;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
return arc;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function descending(a, b) {
|
|
273
|
+
return b < a ? -1 : b > a ? 1 : b >= a ? 0 : NaN;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function identity(d) {
|
|
277
|
+
return d;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function d3Pie() {
|
|
281
|
+
var value = identity,
|
|
282
|
+
sortValues = descending,
|
|
283
|
+
sort = null,
|
|
284
|
+
startAngle = constant(0),
|
|
285
|
+
endAngle = constant(tau),
|
|
286
|
+
padAngle = constant(0);
|
|
287
|
+
|
|
288
|
+
function pie(data) {
|
|
289
|
+
var i,
|
|
290
|
+
n = (data = array(data)).length,
|
|
291
|
+
j,
|
|
292
|
+
k,
|
|
293
|
+
sum = 0,
|
|
294
|
+
index = new Array(n),
|
|
295
|
+
arcs = new Array(n),
|
|
296
|
+
a0 = +startAngle.apply(this, arguments),
|
|
297
|
+
da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)),
|
|
298
|
+
a1,
|
|
299
|
+
p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)),
|
|
300
|
+
pa = p * (da < 0 ? -1 : 1),
|
|
301
|
+
v;
|
|
302
|
+
|
|
303
|
+
for (i = 0; i < n; ++i) {
|
|
304
|
+
if ((v = arcs[index[i] = i] = +value(data[i], i, data)) > 0) {
|
|
305
|
+
sum += v;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// Optionally sort the arcs by previously-computed values or by data.
|
|
310
|
+
if (sortValues != null) index.sort(function(i, j) { return sortValues(arcs[i], arcs[j]); });
|
|
311
|
+
else if (sort != null) index.sort(function(i, j) { return sort(data[i], data[j]); });
|
|
312
|
+
|
|
313
|
+
// Compute the arcs! They are stored in the original data's order.
|
|
314
|
+
for (i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) {
|
|
315
|
+
j = index[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k : 0) + pa, arcs[j] = {
|
|
316
|
+
data: data[j],
|
|
317
|
+
index: i,
|
|
318
|
+
value: v,
|
|
319
|
+
startAngle: a0,
|
|
320
|
+
endAngle: a1,
|
|
321
|
+
padAngle: p
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return arcs;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
pie.value = function(_) {
|
|
329
|
+
return arguments.length ? (value = typeof _ === "function" ? _ : constant(+_), pie) : value;
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
pie.sortValues = function(_) {
|
|
333
|
+
return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
pie.sort = function(_) {
|
|
337
|
+
return arguments.length ? (sort = _, sortValues = null, pie) : sort;
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
pie.startAngle = function(_) {
|
|
341
|
+
return arguments.length ? (startAngle = typeof _ === "function" ? _ : constant(+_), pie) : startAngle;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
pie.endAngle = function(_) {
|
|
345
|
+
return arguments.length ? (endAngle = typeof _ === "function" ? _ : constant(+_), pie) : endAngle;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
pie.padAngle = function(_) {
|
|
349
|
+
return arguments.length ? (padAngle = typeof _ === "function" ? _ : constant(+_), pie) : padAngle;
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
return pie;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/* src/components/chart/Donut.svelte generated by Svelte v3.58.0 */
|
|
356
|
+
|
|
357
|
+
function get_each_context(ctx, list, i) {
|
|
358
|
+
const child_ctx = ctx.slice();
|
|
359
|
+
child_ctx[7] = list[i];
|
|
360
|
+
return child_ctx;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function get_each_context_1(ctx, list, i) {
|
|
364
|
+
const child_ctx = ctx.slice();
|
|
365
|
+
child_ctx[4] = list[i];
|
|
366
|
+
child_ctx[33] = i;
|
|
367
|
+
return child_ctx;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function get_each_context_2(ctx, list, i) {
|
|
371
|
+
const child_ctx = ctx.slice();
|
|
372
|
+
child_ctx[34] = list[i];
|
|
373
|
+
return child_ctx;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// (248:14) {#if name.split(legendseparatorcount)[1]}
|
|
377
|
+
function create_if_block_1(ctx) {
|
|
378
|
+
let span;
|
|
379
|
+
let t0;
|
|
380
|
+
let t1_value = /*name*/ ctx[34].split(/*legendseparatorcount*/ ctx[1])[1] + "";
|
|
381
|
+
let t1;
|
|
382
|
+
|
|
383
|
+
return {
|
|
384
|
+
c() {
|
|
385
|
+
span = element("span");
|
|
386
|
+
t0 = text("(");
|
|
387
|
+
t1 = text(t1_value);
|
|
388
|
+
attr(span, "class", "legend__text--light");
|
|
389
|
+
},
|
|
390
|
+
m(target, anchor) {
|
|
391
|
+
insert(target, span, anchor);
|
|
392
|
+
append(span, t0);
|
|
393
|
+
append(span, t1);
|
|
394
|
+
},
|
|
395
|
+
p(ctx, dirty) {
|
|
396
|
+
if (dirty[0] & /*parsedData, legendseparator, legendseparatorcount*/ 67 && t1_value !== (t1_value = /*name*/ ctx[34].split(/*legendseparatorcount*/ ctx[1])[1] + "")) set_data(t1, t1_value);
|
|
397
|
+
},
|
|
398
|
+
d(detaching) {
|
|
399
|
+
if (detaching) detach(span);
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// (245:10) {#each data.name.split(legendseparator) as name}
|
|
405
|
+
function create_each_block_2(ctx) {
|
|
406
|
+
let p;
|
|
407
|
+
let t0_value = /*name*/ ctx[34].split(/*legendseparatorcount*/ ctx[1])[0] + "";
|
|
408
|
+
let t0;
|
|
409
|
+
let t1;
|
|
410
|
+
let show_if = /*name*/ ctx[34].split(/*legendseparatorcount*/ ctx[1])[1];
|
|
411
|
+
let t2;
|
|
412
|
+
let p_class_value;
|
|
413
|
+
let if_block = show_if && create_if_block_1(ctx);
|
|
414
|
+
|
|
415
|
+
return {
|
|
416
|
+
c() {
|
|
417
|
+
p = element("p");
|
|
418
|
+
t0 = text(t0_value);
|
|
419
|
+
t1 = space();
|
|
420
|
+
if (if_block) if_block.c();
|
|
421
|
+
t2 = space();
|
|
422
|
+
attr(p, "class", p_class_value = getLegendTextClasses(/*data*/ ctx[4].checked));
|
|
423
|
+
},
|
|
424
|
+
m(target, anchor) {
|
|
425
|
+
insert(target, p, anchor);
|
|
426
|
+
append(p, t0);
|
|
427
|
+
append(p, t1);
|
|
428
|
+
if (if_block) if_block.m(p, null);
|
|
429
|
+
append(p, t2);
|
|
430
|
+
},
|
|
431
|
+
p(ctx, dirty) {
|
|
432
|
+
if (dirty[0] & /*parsedData, legendseparator, legendseparatorcount*/ 67 && t0_value !== (t0_value = /*name*/ ctx[34].split(/*legendseparatorcount*/ ctx[1])[0] + "")) set_data(t0, t0_value);
|
|
433
|
+
if (dirty[0] & /*parsedData, legendseparator, legendseparatorcount*/ 67) show_if = /*name*/ ctx[34].split(/*legendseparatorcount*/ ctx[1])[1];
|
|
434
|
+
|
|
435
|
+
if (show_if) {
|
|
436
|
+
if (if_block) {
|
|
437
|
+
if_block.p(ctx, dirty);
|
|
438
|
+
} else {
|
|
439
|
+
if_block = create_if_block_1(ctx);
|
|
440
|
+
if_block.c();
|
|
441
|
+
if_block.m(p, t2);
|
|
442
|
+
}
|
|
443
|
+
} else if (if_block) {
|
|
444
|
+
if_block.d(1);
|
|
445
|
+
if_block = null;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (dirty[0] & /*parsedData*/ 64 && p_class_value !== (p_class_value = getLegendTextClasses(/*data*/ ctx[4].checked))) {
|
|
449
|
+
attr(p, "class", p_class_value);
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
d(detaching) {
|
|
453
|
+
if (detaching) detach(p);
|
|
454
|
+
if (if_block) if_block.d();
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// (233:4) {#each parsedData as data, i}
|
|
460
|
+
function create_each_block_1(ctx) {
|
|
461
|
+
let button;
|
|
462
|
+
let svg_1;
|
|
463
|
+
let rect;
|
|
464
|
+
let rect_fill_value;
|
|
465
|
+
let t0;
|
|
466
|
+
let div;
|
|
467
|
+
let t1;
|
|
468
|
+
let mounted;
|
|
469
|
+
let dispose;
|
|
470
|
+
let each_value_2 = /*data*/ ctx[4].name.split(/*legendseparator*/ ctx[0]);
|
|
471
|
+
let each_blocks = [];
|
|
472
|
+
|
|
473
|
+
for (let i = 0; i < each_value_2.length; i += 1) {
|
|
474
|
+
each_blocks[i] = create_each_block_2(get_each_context_2(ctx, each_value_2, i));
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function click_handler() {
|
|
478
|
+
return /*click_handler*/ ctx[20](/*data*/ ctx[4]);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
return {
|
|
482
|
+
c() {
|
|
483
|
+
button = element("button");
|
|
484
|
+
svg_1 = svg_element("svg");
|
|
485
|
+
rect = svg_element("rect");
|
|
486
|
+
t0 = space();
|
|
487
|
+
div = element("div");
|
|
488
|
+
|
|
489
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
490
|
+
each_blocks[i].c();
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
t1 = space();
|
|
494
|
+
attr(rect, "x", "0");
|
|
495
|
+
attr(rect, "y", "0");
|
|
496
|
+
attr(rect, "width", "24");
|
|
497
|
+
attr(rect, "height", "16");
|
|
498
|
+
attr(rect, "fill", rect_fill_value = /*getFillColor*/ ctx[12](/*data*/ ctx[4], /*i*/ ctx[33], /*parsedSvgs*/ ctx[10], /*parsedColors*/ ctx[9]));
|
|
499
|
+
attr(svg_1, "class", "legend__box");
|
|
500
|
+
attr(button, "class", "legend__item");
|
|
501
|
+
},
|
|
502
|
+
m(target, anchor) {
|
|
503
|
+
insert(target, button, anchor);
|
|
504
|
+
append(button, svg_1);
|
|
505
|
+
append(svg_1, rect);
|
|
506
|
+
append(button, t0);
|
|
507
|
+
append(button, div);
|
|
508
|
+
|
|
509
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
510
|
+
if (each_blocks[i]) {
|
|
511
|
+
each_blocks[i].m(div, null);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
append(button, t1);
|
|
516
|
+
|
|
517
|
+
if (!mounted) {
|
|
518
|
+
dispose = listen(button, "click", click_handler);
|
|
519
|
+
mounted = true;
|
|
520
|
+
}
|
|
521
|
+
},
|
|
522
|
+
p(new_ctx, dirty) {
|
|
523
|
+
ctx = new_ctx;
|
|
524
|
+
|
|
525
|
+
if (dirty[0] & /*parsedData, parsedSvgs, parsedColors*/ 1600 && rect_fill_value !== (rect_fill_value = /*getFillColor*/ ctx[12](/*data*/ ctx[4], /*i*/ ctx[33], /*parsedSvgs*/ ctx[10], /*parsedColors*/ ctx[9]))) {
|
|
526
|
+
attr(rect, "fill", rect_fill_value);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (dirty[0] & /*parsedData, legendseparator, legendseparatorcount*/ 67) {
|
|
530
|
+
each_value_2 = /*data*/ ctx[4].name.split(/*legendseparator*/ ctx[0]);
|
|
531
|
+
let i;
|
|
532
|
+
|
|
533
|
+
for (i = 0; i < each_value_2.length; i += 1) {
|
|
534
|
+
const child_ctx = get_each_context_2(ctx, each_value_2, i);
|
|
535
|
+
|
|
536
|
+
if (each_blocks[i]) {
|
|
537
|
+
each_blocks[i].p(child_ctx, dirty);
|
|
538
|
+
} else {
|
|
539
|
+
each_blocks[i] = create_each_block_2(child_ctx);
|
|
540
|
+
each_blocks[i].c();
|
|
541
|
+
each_blocks[i].m(div, null);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
for (; i < each_blocks.length; i += 1) {
|
|
546
|
+
each_blocks[i].d(1);
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
each_blocks.length = each_value_2.length;
|
|
550
|
+
}
|
|
551
|
+
},
|
|
552
|
+
d(detaching) {
|
|
553
|
+
if (detaching) detach(button);
|
|
554
|
+
destroy_each(each_blocks, detaching);
|
|
555
|
+
mounted = false;
|
|
556
|
+
dispose();
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// (260:2) {#if tooltipData.show}
|
|
562
|
+
function create_if_block(ctx) {
|
|
563
|
+
let div;
|
|
564
|
+
let t_value = /*tooltipData*/ ctx[8].text + "";
|
|
565
|
+
let t;
|
|
566
|
+
|
|
567
|
+
return {
|
|
568
|
+
c() {
|
|
569
|
+
div = element("div");
|
|
570
|
+
t = text(t_value);
|
|
571
|
+
attr(div, "class", "chart__tooltip");
|
|
572
|
+
set_style(div, "left", /*tooltipData*/ ctx[8].left);
|
|
573
|
+
set_style(div, "top", /*tooltipData*/ ctx[8].top);
|
|
574
|
+
},
|
|
575
|
+
m(target, anchor) {
|
|
576
|
+
insert(target, div, anchor);
|
|
577
|
+
append(div, t);
|
|
578
|
+
},
|
|
579
|
+
p(ctx, dirty) {
|
|
580
|
+
if (dirty[0] & /*tooltipData*/ 256 && t_value !== (t_value = /*tooltipData*/ ctx[8].text + "")) set_data(t, t_value);
|
|
581
|
+
|
|
582
|
+
if (dirty[0] & /*tooltipData*/ 256) {
|
|
583
|
+
set_style(div, "left", /*tooltipData*/ ctx[8].left);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (dirty[0] & /*tooltipData*/ 256) {
|
|
587
|
+
set_style(div, "top", /*tooltipData*/ ctx[8].top);
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
d(detaching) {
|
|
591
|
+
if (detaching) detach(div);
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// (271:2) {#each parsedSvgs as svg}
|
|
597
|
+
function create_each_block(ctx) {
|
|
598
|
+
let html_tag;
|
|
599
|
+
let raw_value = /*svg*/ ctx[7] + "";
|
|
600
|
+
let html_anchor;
|
|
601
|
+
|
|
602
|
+
return {
|
|
603
|
+
c() {
|
|
604
|
+
html_tag = new HtmlTag(false);
|
|
605
|
+
html_anchor = empty();
|
|
606
|
+
html_tag.a = html_anchor;
|
|
607
|
+
},
|
|
608
|
+
m(target, anchor) {
|
|
609
|
+
html_tag.m(raw_value, target, anchor);
|
|
610
|
+
insert(target, html_anchor, anchor);
|
|
611
|
+
},
|
|
612
|
+
p(ctx, dirty) {
|
|
613
|
+
if (dirty[0] & /*parsedSvgs*/ 1024 && raw_value !== (raw_value = /*svg*/ ctx[7] + "")) html_tag.p(raw_value);
|
|
614
|
+
},
|
|
615
|
+
d(detaching) {
|
|
616
|
+
if (detaching) detach(html_anchor);
|
|
617
|
+
if (detaching) html_tag.d();
|
|
618
|
+
}
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
function create_fragment(ctx) {
|
|
623
|
+
let div1;
|
|
624
|
+
let div0;
|
|
625
|
+
let t0;
|
|
626
|
+
let div1_class_value;
|
|
627
|
+
let t1;
|
|
628
|
+
let div2;
|
|
629
|
+
let each_value_1 = /*parsedData*/ ctx[6];
|
|
630
|
+
let each_blocks_1 = [];
|
|
631
|
+
|
|
632
|
+
for (let i = 0; i < each_value_1.length; i += 1) {
|
|
633
|
+
each_blocks_1[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
let if_block = /*tooltipData*/ ctx[8].show && create_if_block(ctx);
|
|
637
|
+
let each_value = /*parsedSvgs*/ ctx[10];
|
|
638
|
+
let each_blocks = [];
|
|
639
|
+
|
|
640
|
+
for (let i = 0; i < each_value.length; i += 1) {
|
|
641
|
+
each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
return {
|
|
645
|
+
c() {
|
|
646
|
+
div1 = element("div");
|
|
647
|
+
div0 = element("div");
|
|
648
|
+
|
|
649
|
+
for (let i = 0; i < each_blocks_1.length; i += 1) {
|
|
650
|
+
each_blocks_1[i].c();
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
t0 = space();
|
|
654
|
+
if (if_block) if_block.c();
|
|
655
|
+
t1 = space();
|
|
656
|
+
div2 = element("div");
|
|
657
|
+
|
|
658
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
659
|
+
each_blocks[i].c();
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
this.c = noop;
|
|
663
|
+
attr(div0, "class", "legend");
|
|
664
|
+
attr(div1, "class", div1_class_value = "chart " + getLegendPosition(/*legendposition*/ ctx[3]));
|
|
665
|
+
set_style(div1, "background-color", /*backgroundcolor*/ ctx[2]);
|
|
666
|
+
set_style(div2, "height", "0");
|
|
667
|
+
set_style(div2, "width", "0");
|
|
668
|
+
attr(div2, "class", "pattern");
|
|
669
|
+
},
|
|
670
|
+
m(target, anchor) {
|
|
671
|
+
insert(target, div1, anchor);
|
|
672
|
+
append(div1, div0);
|
|
673
|
+
|
|
674
|
+
for (let i = 0; i < each_blocks_1.length; i += 1) {
|
|
675
|
+
if (each_blocks_1[i]) {
|
|
676
|
+
each_blocks_1[i].m(div0, null);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
append(div1, t0);
|
|
681
|
+
if (if_block) if_block.m(div1, null);
|
|
682
|
+
/*div1_binding*/ ctx[21](div1);
|
|
683
|
+
insert(target, t1, anchor);
|
|
684
|
+
insert(target, div2, anchor);
|
|
685
|
+
|
|
686
|
+
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
687
|
+
if (each_blocks[i]) {
|
|
688
|
+
each_blocks[i].m(div2, null);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
},
|
|
692
|
+
p(ctx, dirty) {
|
|
693
|
+
if (dirty[0] & /*filterChart, parsedData, legendseparator, legendseparatorcount, getFillColor, parsedSvgs, parsedColors*/ 7747) {
|
|
694
|
+
each_value_1 = /*parsedData*/ ctx[6];
|
|
695
|
+
let i;
|
|
696
|
+
|
|
697
|
+
for (i = 0; i < each_value_1.length; i += 1) {
|
|
698
|
+
const child_ctx = get_each_context_1(ctx, each_value_1, i);
|
|
699
|
+
|
|
700
|
+
if (each_blocks_1[i]) {
|
|
701
|
+
each_blocks_1[i].p(child_ctx, dirty);
|
|
702
|
+
} else {
|
|
703
|
+
each_blocks_1[i] = create_each_block_1(child_ctx);
|
|
704
|
+
each_blocks_1[i].c();
|
|
705
|
+
each_blocks_1[i].m(div0, null);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
for (; i < each_blocks_1.length; i += 1) {
|
|
710
|
+
each_blocks_1[i].d(1);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
each_blocks_1.length = each_value_1.length;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
if (/*tooltipData*/ ctx[8].show) {
|
|
717
|
+
if (if_block) {
|
|
718
|
+
if_block.p(ctx, dirty);
|
|
719
|
+
} else {
|
|
720
|
+
if_block = create_if_block(ctx);
|
|
721
|
+
if_block.c();
|
|
722
|
+
if_block.m(div1, null);
|
|
723
|
+
}
|
|
724
|
+
} else if (if_block) {
|
|
725
|
+
if_block.d(1);
|
|
726
|
+
if_block = null;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
if (dirty[0] & /*legendposition*/ 8 && div1_class_value !== (div1_class_value = "chart " + getLegendPosition(/*legendposition*/ ctx[3]))) {
|
|
730
|
+
attr(div1, "class", div1_class_value);
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
if (dirty[0] & /*backgroundcolor*/ 4) {
|
|
734
|
+
set_style(div1, "background-color", /*backgroundcolor*/ ctx[2]);
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
if (dirty[0] & /*parsedSvgs*/ 1024) {
|
|
738
|
+
each_value = /*parsedSvgs*/ ctx[10];
|
|
739
|
+
let i;
|
|
740
|
+
|
|
741
|
+
for (i = 0; i < each_value.length; i += 1) {
|
|
742
|
+
const child_ctx = get_each_context(ctx, each_value, i);
|
|
743
|
+
|
|
744
|
+
if (each_blocks[i]) {
|
|
745
|
+
each_blocks[i].p(child_ctx, dirty);
|
|
746
|
+
} else {
|
|
747
|
+
each_blocks[i] = create_each_block(child_ctx);
|
|
748
|
+
each_blocks[i].c();
|
|
749
|
+
each_blocks[i].m(div2, null);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
for (; i < each_blocks.length; i += 1) {
|
|
754
|
+
each_blocks[i].d(1);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
each_blocks.length = each_value.length;
|
|
758
|
+
}
|
|
759
|
+
},
|
|
760
|
+
i: noop,
|
|
761
|
+
o: noop,
|
|
762
|
+
d(detaching) {
|
|
763
|
+
if (detaching) detach(div1);
|
|
764
|
+
destroy_each(each_blocks_1, detaching);
|
|
765
|
+
if (if_block) if_block.d();
|
|
766
|
+
/*div1_binding*/ ctx[21](null);
|
|
767
|
+
if (detaching) detach(t1);
|
|
768
|
+
if (detaching) detach(div2);
|
|
769
|
+
destroy_each(each_blocks, detaching);
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
function getLegendTextClasses(checked) {
|
|
775
|
+
return `legend__text${checked ? ' legend__text--not-selected' : ''}`;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
function getLegendPosition(legendposition) {
|
|
779
|
+
switch (legendposition) {
|
|
780
|
+
case 'top':
|
|
781
|
+
return 'chart--top';
|
|
782
|
+
case 'right':
|
|
783
|
+
return 'chart--right';
|
|
784
|
+
case 'bottom':
|
|
785
|
+
return 'chart--bottom';
|
|
786
|
+
case 'left':
|
|
787
|
+
return 'chart--left';
|
|
788
|
+
default:
|
|
789
|
+
return 'chart--right';
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
function instance($$self, $$props, $$invalidate) {
|
|
794
|
+
let parsedData;
|
|
795
|
+
let parsedSvgs;
|
|
796
|
+
let parsedColors;
|
|
797
|
+
let count;
|
|
798
|
+
let { data = '' } = $$props;
|
|
799
|
+
let { svgs } = $$props;
|
|
800
|
+
let { colors } = $$props;
|
|
801
|
+
let { title } = $$props;
|
|
802
|
+
let { legendseparator = ',' } = $$props;
|
|
803
|
+
let { legendseparatorcount = '(' } = $$props;
|
|
804
|
+
let { dimension = 250 } = $$props;
|
|
805
|
+
let { padangle = 0.05 } = $$props;
|
|
806
|
+
let { backgroundcolor = '#fff' } = $$props;
|
|
807
|
+
let { delay = 500 } = $$props;
|
|
808
|
+
let { legendposition = 'right' } = $$props;
|
|
809
|
+
let chart;
|
|
810
|
+
let svg;
|
|
811
|
+
let hasMounted = false;
|
|
812
|
+
let eventHandler = new EventHandler();
|
|
813
|
+
|
|
814
|
+
let tooltipData = {
|
|
815
|
+
left: '0px',
|
|
816
|
+
top: '0px',
|
|
817
|
+
text: '',
|
|
818
|
+
show: false
|
|
819
|
+
};
|
|
820
|
+
|
|
821
|
+
const radius = dimension / 2;
|
|
822
|
+
const arc = d3Arc().outerRadius(radius - 5).innerRadius(radius - 60).padAngle(padangle);
|
|
823
|
+
const pie = d3Pie().sort(null).startAngle(1.1 * Math.PI).endAngle(3.1 * Math.PI).value(data => data.total);
|
|
824
|
+
|
|
825
|
+
const getTotal = () => {
|
|
826
|
+
return parsedData
|
|
827
|
+
? parsedData.filter(d => {
|
|
828
|
+
return !d.checked;
|
|
829
|
+
}).reduce((acc, item) => acc += item.total, 0)
|
|
830
|
+
: [];
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
const renderChart = () => {
|
|
834
|
+
const paths = svg.selectAll('path').data(pie(parsedData)).enter().append('path').attr('class', 'chart__arc').attr('title', d => d.data.name).attr('stroke', d => `${parsedColors[d.index]}`).attr('stroke-width', '4px').style('fill', d => {
|
|
835
|
+
if (parsedSvgs.length > 0) {
|
|
836
|
+
return `url(#${d.data.patternId})`;
|
|
837
|
+
} else if (parsedColors.length > 0) {
|
|
838
|
+
return `${parsedColors[d.index]}`;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
return `${parsedColors[d.index]}`;
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
svg.append('svg:text').attr('text-anchor', 'middle').attr('font-size', '28').attr('fill', '#333').text(String(count));
|
|
845
|
+
svg.append('svg:text').attr('text-anchor', 'middle').attr('font-size', '22').attr('fill', '#333').attr('dy', '1.5rem').text(title);
|
|
846
|
+
|
|
847
|
+
paths.transition().delay((_d, index) => index * delay).duration(delay).attrTween('d', d => {
|
|
848
|
+
if (d.data.total === 0) return () => '';
|
|
849
|
+
const i = interpolate(d.startAngle + 0.1, d.endAngle);
|
|
850
|
+
|
|
851
|
+
return t => {
|
|
852
|
+
d.endAngle = i(t);
|
|
853
|
+
return arc(d) || '';
|
|
854
|
+
};
|
|
855
|
+
});
|
|
856
|
+
|
|
857
|
+
paths.on('mousemove', (e, chartEvent) => {
|
|
858
|
+
$$invalidate(8, tooltipData = {
|
|
859
|
+
left: e.pageX + 10 + 'px',
|
|
860
|
+
top: e.pageY - 25 + 'px',
|
|
861
|
+
text: chartEvent.data.customTooltip
|
|
862
|
+
? chartEvent.data.customTooltip
|
|
863
|
+
: chartEvent.data.name,
|
|
864
|
+
show: true
|
|
865
|
+
});
|
|
866
|
+
}).on('mouseover', (_e, chartEvent) => {
|
|
867
|
+
var current = svg.selectAll('.chart__arc').filter(function (arc) {
|
|
868
|
+
return arc === chartEvent;
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
var others = svg.selectAll('.chart__arc').filter(function (arc) {
|
|
872
|
+
return arc != chartEvent;
|
|
873
|
+
});
|
|
874
|
+
|
|
875
|
+
others.style('opacity', 0.7);
|
|
876
|
+
current.style('transform', 'scale(1.02)');
|
|
877
|
+
}).on('mouseout', (_e, chartEvent) => {
|
|
878
|
+
var current = svg.selectAll('.chart__arc').filter(function (arc) {
|
|
879
|
+
return arc === chartEvent;
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
var others = svg.selectAll('.chart__arc').filter(function (arc) {
|
|
883
|
+
return arc != chartEvent;
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
others.style('opacity', 1);
|
|
887
|
+
current.style('transform', 'scale(1)');
|
|
888
|
+
$$invalidate(8, tooltipData.show = false, tooltipData);
|
|
889
|
+
}).on('click', (_e, chartEvent) => {
|
|
890
|
+
eventHandler.dispatch('donut-clicked', chartEvent);
|
|
891
|
+
});
|
|
892
|
+
|
|
893
|
+
setTimeout(
|
|
894
|
+
() => {
|
|
895
|
+
updateChart(parsedData);
|
|
896
|
+
},
|
|
897
|
+
delay * parsedData.length
|
|
898
|
+
);
|
|
899
|
+
};
|
|
900
|
+
|
|
901
|
+
function updateChart(data) {
|
|
902
|
+
svg.selectAll('path').data(pie(data)).transition().duration(delay).attr('stroke-width', (_d, i) => {
|
|
903
|
+
return parsedData[i].checked ? '0px' : '4px';
|
|
904
|
+
}).attrTween('d', function (d) {
|
|
905
|
+
const i = interpolate(this._current, d);
|
|
906
|
+
this._current = i(0);
|
|
907
|
+
return t => arc(i(t)) || '';
|
|
908
|
+
});
|
|
909
|
+
|
|
910
|
+
svg.selectAll('svg text').filter(function () {
|
|
911
|
+
return (/^[0-9]/).test(select(this).text());
|
|
912
|
+
}).text(String(getTotal()));
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
function filterChart(name) {
|
|
916
|
+
const updatedData = svg.selectAll('path').data().map((d, i) => {
|
|
917
|
+
const data = d.data;
|
|
918
|
+
|
|
919
|
+
if (data.name === name) {
|
|
920
|
+
$$invalidate(6, parsedData[i].checked = !parsedData[i].checked, parsedData);
|
|
921
|
+
const total = data.total === 0 ? parsedData[i].total : 0;
|
|
922
|
+
return Object.assign(Object.assign({}, data), { total });
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
return Object.assign({}, data);
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
updateChart(updatedData);
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
function getFillColor(data, index, svgs, colors) {
|
|
932
|
+
if (svgs.length > 0) {
|
|
933
|
+
return `url(#${data.patternId})`;
|
|
934
|
+
} else if (colors.length > 0) {
|
|
935
|
+
return parsedColors[index];
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
onMount(() => $$invalidate(19, hasMounted = true));
|
|
940
|
+
const click_handler = data => filterChart(data.name);
|
|
941
|
+
|
|
942
|
+
function div1_binding($$value) {
|
|
943
|
+
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
944
|
+
chart = $$value;
|
|
945
|
+
$$invalidate(5, chart);
|
|
946
|
+
});
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
$$self.$$set = $$props => {
|
|
950
|
+
if ('data' in $$props) $$invalidate(4, data = $$props.data);
|
|
951
|
+
if ('svgs' in $$props) $$invalidate(13, svgs = $$props.svgs);
|
|
952
|
+
if ('colors' in $$props) $$invalidate(14, colors = $$props.colors);
|
|
953
|
+
if ('title' in $$props) $$invalidate(15, title = $$props.title);
|
|
954
|
+
if ('legendseparator' in $$props) $$invalidate(0, legendseparator = $$props.legendseparator);
|
|
955
|
+
if ('legendseparatorcount' in $$props) $$invalidate(1, legendseparatorcount = $$props.legendseparatorcount);
|
|
956
|
+
if ('dimension' in $$props) $$invalidate(16, dimension = $$props.dimension);
|
|
957
|
+
if ('padangle' in $$props) $$invalidate(17, padangle = $$props.padangle);
|
|
958
|
+
if ('backgroundcolor' in $$props) $$invalidate(2, backgroundcolor = $$props.backgroundcolor);
|
|
959
|
+
if ('delay' in $$props) $$invalidate(18, delay = $$props.delay);
|
|
960
|
+
if ('legendposition' in $$props) $$invalidate(3, legendposition = $$props.legendposition);
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
$$self.$$.update = () => {
|
|
964
|
+
if ($$self.$$.dirty[0] & /*data*/ 16) {
|
|
965
|
+
$$invalidate(6, parsedData = data ? JSON.parse(data) : []);
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
if ($$self.$$.dirty[0] & /*svgs*/ 8192) {
|
|
969
|
+
$$invalidate(10, parsedSvgs = svgs ? JSON.parse(svgs) : []);
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
if ($$self.$$.dirty[0] & /*colors*/ 16384) {
|
|
973
|
+
$$invalidate(9, parsedColors = colors
|
|
974
|
+
? JSON.parse(colors)
|
|
975
|
+
: ['#605F9D', '#D9F0F3', '#EAEDEF', '#0B96CC', '#EA7315', '#EA302D']);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
if ($$self.$$.dirty[0] & /*parsedData*/ 64) {
|
|
979
|
+
count = parsedData
|
|
980
|
+
? parsedData.filter(d => {
|
|
981
|
+
return !d.checked;
|
|
982
|
+
}).reduce((acc, item) => acc += item.total, 0)
|
|
983
|
+
: [];
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
if ($$self.$$.dirty[0] & /*data, hasMounted, svg, chart, dimension*/ 590000) {
|
|
987
|
+
if (data.length > 0 && hasMounted) {
|
|
988
|
+
if (!svg) {
|
|
989
|
+
$$invalidate(7, svg = select(chart).append('svg').attr('width', dimension).attr('height', dimension).append('g').attr('transform', 'translate(' + dimension / 2 + ',' + dimension / 2 + ')'));
|
|
990
|
+
} else {
|
|
991
|
+
svg.selectAll('path').remove();
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
renderChart();
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
return [
|
|
1000
|
+
legendseparator,
|
|
1001
|
+
legendseparatorcount,
|
|
1002
|
+
backgroundcolor,
|
|
1003
|
+
legendposition,
|
|
1004
|
+
data,
|
|
1005
|
+
chart,
|
|
1006
|
+
parsedData,
|
|
1007
|
+
svg,
|
|
1008
|
+
tooltipData,
|
|
1009
|
+
parsedColors,
|
|
1010
|
+
parsedSvgs,
|
|
1011
|
+
filterChart,
|
|
1012
|
+
getFillColor,
|
|
1013
|
+
svgs,
|
|
1014
|
+
colors,
|
|
1015
|
+
title,
|
|
1016
|
+
dimension,
|
|
1017
|
+
padangle,
|
|
1018
|
+
delay,
|
|
1019
|
+
hasMounted,
|
|
1020
|
+
click_handler,
|
|
1021
|
+
div1_binding
|
|
1022
|
+
];
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
class Donut extends SvelteElement {
|
|
1026
|
+
constructor(options) {
|
|
1027
|
+
super();
|
|
1028
|
+
const style = document.createElement('style');
|
|
1029
|
+
style.textContent = `.mt-heading{font-family:"LeroyMerlin", sans-serif;font-weight:400;color:#000000;display:block;margin-bottom:2rem}.mt-heading--underline::after{content:"";display:block;height:0.25rem;background-color:#46a610}.mt-heading--line-primary-01-200::after,.mt-heading--line-lightest::after{background-color:#c5e39e}.mt-heading--line-primary-02-200::after{background-color:#cfd2d8}.mt-heading--line-primary-02-600::after{background-color:#494f60}.mt-heading--center{text-align:center}.mt-heading--center.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right{text-align:right}.mt-heading--right.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left{text-align:left}.mt-heading--left.mt-heading--underline::after{margin-left:0;margin-right:auto}.mt-heading--s{font-size:1.4375rem;line-height:1.3913043478}.mt-heading--s.mt-heading--underline::after{width:4rem;margin-top:1rem}.mt-heading--s.mt-heading--line-height-xs{line-height:1.0434782609}.mt-heading--m{font-size:1.75rem;line-height:1.2857142857}.mt-heading--m.mt-heading--underline::after{width:4.5rem;margin-top:1rem}.mt-heading--m.mt-heading--line-height-xs{line-height:1}.mt-heading--l{font-size:2.125rem;line-height:1.2941176471}.mt-heading--l.mt-heading--underline::after{width:5rem;margin-top:1.25rem}.mt-heading--l.mt-heading--line-height-xs{line-height:1.0588235294}.mt-heading--lightest{color:#ffffff}.mt-heading--light{font-weight:300}.mt-heading--semi-bold,.mt-heading--underline{font-weight:600}@media screen and (min-width: 680px){.mt-heading--center\\@from-m{text-align:center}.mt-heading--center\\@from-m.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right\\@from-m{text-align:right}.mt-heading--right\\@from-m.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left\\@from-m{text-align:left}.mt-heading--left\\@from-m.mt-heading--underline::after{margin-left:0;margin-right:auto}.mt-heading--s{font-size:1.75rem;line-height:1.2857142857}.mt-heading--s.mt-heading--underline::after{width:4.5rem;margin-top:1rem}.mt-heading--s.mt-heading--line-height-xs{line-height:1}.mt-heading--m{font-size:2.125rem;line-height:1.2941176471}.mt-heading--m.mt-heading--underline::after{width:5rem;margin-top:1.25rem}.mt-heading--m.mt-heading--line-height-xs{line-height:1.0588235294}.mt-heading--l{font-size:2.5625rem;line-height:1.3658536585}.mt-heading--l.mt-heading--underline::after{width:5.5rem;margin-top:1.5rem}.mt-heading--l.mt-heading--line-height-xs{line-height:0.9756097561}}@media screen and (min-width: 1024px){.mt-heading--center\\@from-l{text-align:center}.mt-heading--center\\@from-l.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right\\@from-l{text-align:right}.mt-heading--right\\@from-l.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left\\@from-l{text-align:left}.mt-heading--left\\@from-l.mt-heading--underline::after{margin-left:0;margin-right:auto}.mt-heading--s{font-size:2.125rem;line-height:1.2941176471}.mt-heading--s.mt-heading--underline::after{width:5rem;margin-top:1.25rem}.mt-heading--s.mt-heading--line-height-xs{line-height:1.0588235294}.mt-heading--m{font-size:2.5625rem;line-height:1.3658536585}.mt-heading--m.mt-heading--underline::after{width:5.5rem;margin-top:1.5rem}.mt-heading--m.mt-heading--line-height-xs{line-height:0.9756097561}.mt-heading--l{font-size:3.0625rem;line-height:1.387755102;margin-bottom:3.5rem}.mt-heading--l.mt-heading--underline::after{width:6rem;margin-top:2rem}.mt-heading--l.mt-heading--line-height-xs{line-height:0.9795918367}}@media screen and (min-width: 1280px){.mt-heading--center\\@from-xl{text-align:center}.mt-heading--center\\@from-xl.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right\\@from-xl{text-align:right}.mt-heading--right\\@from-xl.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left\\@from-xl{text-align:left}.mt-heading--left\\@from-xl.mt-heading--underline::after{margin-left:0;margin-right:auto}}@media screen and (min-width: 1920px){.mt-heading--center\\@from-xxl{text-align:center}.mt-heading--center\\@from-xxl.mt-heading--underline::after{margin-left:auto;margin-right:auto}.mt-heading--right\\@from-xxl{text-align:right}.mt-heading--right\\@from-xxl.mt-heading--underline::after{margin-left:auto;margin-right:0}.mt-heading--left\\@from-xxl{text-align:left}.mt-heading--left\\@from-xxl.mt-heading--underline::after{margin-left:0;margin-right:auto}}.opaque{opacity:0.7}.chart{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;background-color:#ffffff;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.chart--top{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.chart--right{-webkit-box-orient:horizontal;-webkit-box-direction:reverse;-ms-flex-direction:row-reverse;flex-direction:row-reverse}.chart--bottom{-webkit-box-orient:vertical;-webkit-box-direction:reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse}.chart--left{-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.chart__tooltip{position:absolute;width:auto;height:auto;background-color:#4d4d4d;border-radius:4px;color:#ffffff;padding:0.5rem 1rem;text-align:center}.chart__arc{cursor:pointer;-webkit-transition:-webkit-transform 0.3s ease;transition:-webkit-transform 0.3s ease;-o-transition:transform 0.3s ease;transition:transform 0.3s ease;transition:transform 0.3s ease, -webkit-transform 0.3s ease}.legend{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:start;-ms-flex-align:start;align-items:flex-start;padding:0 1.5rem;height:100%;margin:0;color:#000000}.legend__title{padding:0.75rem;white-space:nowrap;margin:0}.legend__title--light{color:#808080}.legend__item{cursor:pointer;background:none;border:none;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;margin-left:0.75rem;margin-bottom:0.25rem;font-size:0.875rem}.legend__item:focus,.legend__item:hover{outline:0;text-decoration:underline}.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.75rem;height:16px;width:24px}.legend__text{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;white-space:nowrap;margin:0 0 0.25rem 0;padding:0}.legend__text--light{color:#808080}.legend__text--not-selected{text-decoration:line-through}.pattern{z-index:-1;position:absolute}`;
|
|
1030
|
+
this.shadowRoot.appendChild(style);
|
|
1031
|
+
|
|
1032
|
+
init(
|
|
1033
|
+
this,
|
|
1034
|
+
{
|
|
1035
|
+
target: this.shadowRoot,
|
|
1036
|
+
props: attribute_to_object(this.attributes),
|
|
1037
|
+
customElement: true
|
|
1038
|
+
},
|
|
1039
|
+
instance,
|
|
1040
|
+
create_fragment,
|
|
1041
|
+
safe_not_equal,
|
|
1042
|
+
{
|
|
1043
|
+
data: 4,
|
|
1044
|
+
svgs: 13,
|
|
1045
|
+
colors: 14,
|
|
1046
|
+
title: 15,
|
|
1047
|
+
legendseparator: 0,
|
|
1048
|
+
legendseparatorcount: 1,
|
|
1049
|
+
dimension: 16,
|
|
1050
|
+
padangle: 17,
|
|
1051
|
+
backgroundcolor: 2,
|
|
1052
|
+
delay: 18,
|
|
1053
|
+
legendposition: 3
|
|
1054
|
+
},
|
|
1055
|
+
null,
|
|
1056
|
+
[-1, -1]
|
|
1057
|
+
);
|
|
1058
|
+
|
|
1059
|
+
if (options) {
|
|
1060
|
+
if (options.target) {
|
|
1061
|
+
insert(options.target, this, options.anchor);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
if (options.props) {
|
|
1065
|
+
this.$set(options.props);
|
|
1066
|
+
flush();
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
static get observedAttributes() {
|
|
1072
|
+
return [
|
|
1073
|
+
"data",
|
|
1074
|
+
"svgs",
|
|
1075
|
+
"colors",
|
|
1076
|
+
"title",
|
|
1077
|
+
"legendseparator",
|
|
1078
|
+
"legendseparatorcount",
|
|
1079
|
+
"dimension",
|
|
1080
|
+
"padangle",
|
|
1081
|
+
"backgroundcolor",
|
|
1082
|
+
"delay",
|
|
1083
|
+
"legendposition"
|
|
1084
|
+
];
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
get data() {
|
|
1088
|
+
return this.$$.ctx[4];
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
set data(data) {
|
|
1092
|
+
this.$$set({ data });
|
|
1093
|
+
flush();
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
get svgs() {
|
|
1097
|
+
return this.$$.ctx[13];
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
set svgs(svgs) {
|
|
1101
|
+
this.$$set({ svgs });
|
|
1102
|
+
flush();
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
get colors() {
|
|
1106
|
+
return this.$$.ctx[14];
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
set colors(colors) {
|
|
1110
|
+
this.$$set({ colors });
|
|
1111
|
+
flush();
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
get title() {
|
|
1115
|
+
return this.$$.ctx[15];
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
set title(title) {
|
|
1119
|
+
this.$$set({ title });
|
|
1120
|
+
flush();
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
get legendseparator() {
|
|
1124
|
+
return this.$$.ctx[0];
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
set legendseparator(legendseparator) {
|
|
1128
|
+
this.$$set({ legendseparator });
|
|
1129
|
+
flush();
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
get legendseparatorcount() {
|
|
1133
|
+
return this.$$.ctx[1];
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
set legendseparatorcount(legendseparatorcount) {
|
|
1137
|
+
this.$$set({ legendseparatorcount });
|
|
1138
|
+
flush();
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
get dimension() {
|
|
1142
|
+
return this.$$.ctx[16];
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
set dimension(dimension) {
|
|
1146
|
+
this.$$set({ dimension });
|
|
1147
|
+
flush();
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
get padangle() {
|
|
1151
|
+
return this.$$.ctx[17];
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
set padangle(padangle) {
|
|
1155
|
+
this.$$set({ padangle });
|
|
1156
|
+
flush();
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
get backgroundcolor() {
|
|
1160
|
+
return this.$$.ctx[2];
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
set backgroundcolor(backgroundcolor) {
|
|
1164
|
+
this.$$set({ backgroundcolor });
|
|
1165
|
+
flush();
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
get delay() {
|
|
1169
|
+
return this.$$.ctx[18];
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
set delay(delay) {
|
|
1173
|
+
this.$$set({ delay });
|
|
1174
|
+
flush();
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
get legendposition() {
|
|
1178
|
+
return this.$$.ctx[3];
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
set legendposition(legendposition) {
|
|
1182
|
+
this.$$set({ legendposition });
|
|
1183
|
+
flush();
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
customElements.define("m-donut", Donut);
|
|
1188
|
+
|
|
1189
|
+
export { Donut as default };
|
|
2
1190
|
//# sourceMappingURL=Donut.js.map
|