monobill-mintui 0.6.616 → 0.6.619
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/dist/components/alert/browser.js +1 -1
- package/dist/components/alert/index.cjs +1 -1
- package/dist/components/alert/index.js +1 -1
- package/dist/components/chart/browser.js +110 -99
- package/dist/components/chart/index.cjs +3 -3
- package/dist/components/chart/index.js +110 -99
- package/dist/components/chunks/{modal-VN2fwehS.js → modal-9S-FF3_o.js} +1 -1
- package/dist/components/chunks/{modal-DZDugqmr.js → modal-D7KKb4f9.js} +1 -1
- package/dist/components/chunks/{text-BHkEs8U5.js → text-Bmfl6CxJ.js} +1 -1
- package/dist/components/chunks/{text-BmHZbBMo.js → text-Cpl5ljSe.js} +1 -1
- package/dist/components/confirm-action/browser.js +2 -2
- package/dist/components/confirm-action/index.cjs +1 -1
- package/dist/components/confirm-action/index.js +2 -2
- package/dist/components/modal/browser.js +1 -1
- package/dist/components/modal/index.cjs +1 -1
- package/dist/components/modal/index.js +1 -1
- package/dist/components/off-canvas/browser.js +1 -1
- package/dist/components/off-canvas/index.cjs +1 -1
- package/dist/components/off-canvas/index.js +1 -1
- package/dist/components/side-navigation/browser.js +1 -1
- package/dist/components/side-navigation/index.cjs +1 -1
- package/dist/components/side-navigation/index.js +1 -1
- package/dist/components/text/browser.js +1 -1
- package/dist/components/text/index.cjs +1 -1
- package/dist/components/text/index.js +1 -1
- package/dist/components/time-picker/browser.js +1 -1
- package/dist/components/time-picker/index.cjs +1 -1
- package/dist/components/time-picker/index.js +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.css +5 -5
- package/dist/index.js +112 -101
- package/dist/input.css +1 -1
- package/dist/link.css +1 -1
- package/dist/modal.css +1 -1
- package/dist/navigation.css +1 -1
- package/dist/text.css +1 -1
- package/package.json +1 -1
|
@@ -18,7 +18,7 @@ import { a as e } from "../chunks/icon-B01tq_aJ.js";
|
|
|
18
18
|
import { t } from "../chunks/register-element-BFYmIynH.js";
|
|
19
19
|
import "../chunks/icon-DNWs0suS.js";
|
|
20
20
|
import "../chunks/close-y8q0rMSE.js";
|
|
21
|
-
import "../chunks/text-
|
|
21
|
+
import "../chunks/text-Bmfl6CxJ.js";
|
|
22
22
|
e({
|
|
23
23
|
name: "info",
|
|
24
24
|
viewBox: "0 0 24 24",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`../chunks/icon-BcsWL4kZ.js`),t=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/icon-uMo_iGkX.js`),require(`../chunks/close-Bg0kqvrY.js`),require(`../chunks/text-
|
|
1
|
+
const e=require(`../chunks/icon-BcsWL4kZ.js`),t=require(`../chunks/register-element-tCL_F1YI.js`);require(`../chunks/icon-uMo_iGkX.js`),require(`../chunks/close-Bg0kqvrY.js`),require(`../chunks/text-Cpl5ljSe.js`),e.a({name:`info`,viewBox:`0 0 24 24`,path:`M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),e.a({name:`success`,viewBox:`0 0 24 24`,path:`M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`}),e.a({name:`warning`,viewBox:`0 0 24 24`,path:`M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z`,strokeLinecap:`round`,strokeLinejoin:`round`}),e.a({name:`error`,viewBox:`0 0 24 24`,path:`M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z`,strokeLinecap:`round`,strokeLinejoin:`round`});var n=class extends HTMLElement{static get observedAttributes(){return[`heading`,`dismissable`,`tone`]}constructor(){super(),this._headingElement=null,this._iconElement=null,this._dismissButton=null,this._headerWrapper=null,this._bodyWrapper=null,this._dismissHandler=null,this._rendering=!1,this._childObserver=null,this._normalizingChildren=!1}connectedCallback(){this.render()}disconnectedCallback(){this._childObserver?.disconnect(),this._dismissButton?.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}get heading(){return this.getAttribute(`heading`)??``}set heading(e){this.setAttribute(`heading`,String(e??``))}get tone(){return this.getTone()}set tone(e){this.setAttribute(`tone`,e)}get dismissable(){return this.isDismissable()}set dismissable(e){this.setAttribute(`dismissable`,String(!!e))}get dismissible(){return this.dismissable}set dismissible(e){this.dismissable=e}cleanupDismissListener(){this._dismissButton&&this._dismissHandler&&this._dismissButton.removeEventListener(`click`,this._dismissHandler),this._dismissHandler=null}attributeChangedCallback(e,t,n){t!==n&&this.render()}getHeading(){return this.getAttribute(`heading`)||``}getTone(){let e=this.getAttribute(`tone`);return e===`info`||e===`success`||e===`warning`||e===`danger`?e:`info`}isDismissable(){return this.getAttribute(`dismissable`)===`true`}getIconName(){switch(this.getTone()){case`info`:return`info`;case`success`:return`success`;case`warning`:return`warning`;case`danger`:return`error`;default:return`info`}}getAriaLive(){return this.getTone()===`danger`?`assertive`:`polite`}render(){if(!(this._rendering||!this.isConnected)){this._rendering=!0;try{this.renderContent()}finally{this._rendering=!1}}}renderContent(){this._childObserver?.disconnect();let e=this.getTone(),t=this.getHeading(),n=this.isDismissable(),r=this.getAriaLive();this.setAttribute(`role`,e===`danger`?`alert`:`status`),this.setAttribute(`aria-live`,r),e===`danger`?this.setAttribute(`aria-atomic`,`true`):this.removeAttribute(`aria-atomic`);let i=[];for(this._bodyWrapper?Array.from(this._bodyWrapper.childNodes).forEach(e=>{i.push(e)}):Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&e!==this._iconElement&&e!==this._headingElement&&e!==this._dismissButton&&i.push(e)}),this.cleanupDismissListener();this.firstChild;)this.removeChild(this.firstChild);if(this._headerWrapper=null,this._bodyWrapper=null,this._iconElement=null,this._headingElement=null,this._dismissButton=null,this._headerWrapper=document.createElement(`div`),this._headerWrapper.className=`mint-alert-header`,this._iconElement=document.createElement(`mint-icon`),this._iconElement.setAttribute(`name`,this.getIconName()),this._iconElement.className=`mint-alert-icon`,this._headerWrapper.appendChild(this._iconElement),this._headingElement=document.createElement(`mint-text`),this._headingElement.className=`mint-alert-heading`,this._headingElement.textContent=t||``,this._headerWrapper.appendChild(this._headingElement),n){this._dismissButton=document.createElement(`button`),this._dismissButton.className=`mint-alert-dismiss`,this._dismissButton.setAttribute(`aria-label`,`Dismiss alert`),this._dismissButton.setAttribute(`type`,`button`);let e=document.createElement(`mint-icon`);e.setAttribute(`name`,`close`),e.className=`mint-alert-close-icon`,this._dismissButton.appendChild(e),this._dismissHandler=e=>{e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent(`dismissed`,{bubbles:!0,composed:!0})),this.remove()},this._dismissButton.addEventListener(`click`,this._dismissHandler),this._headerWrapper.appendChild(this._dismissButton)}this._bodyWrapper=document.createElement(`div`),this._bodyWrapper.className=`mint-alert-body`,i.forEach(e=>{this._bodyWrapper.appendChild(e)}),this.appendChild(this._headerWrapper),this.appendChild(this._bodyWrapper),this._childObserver||=new MutationObserver(()=>this.normalizeConsumerChildren()),this._childObserver.observe(this,{childList:!0})}normalizeConsumerChildren(){if(!(this._normalizingChildren||!this._bodyWrapper)){this._normalizingChildren=!0;try{Array.from(this.childNodes).forEach(e=>{e!==this._headerWrapper&&e!==this._bodyWrapper&&this._bodyWrapper.appendChild(e)})}finally{this._normalizingChildren=!1}}}};customElements.get(`mint-alert`)||t.t(`mint-alert`,n),module.exports=n;
|
|
@@ -6,7 +6,7 @@ import { a as e } from "../chunks/icon-B01tq_aJ.js";
|
|
|
6
6
|
import { t } from "../chunks/register-element-BFYmIynH.js";
|
|
7
7
|
import "../chunks/icon-DNWs0suS.js";
|
|
8
8
|
import "../chunks/close-y8q0rMSE.js";
|
|
9
|
-
import "../chunks/text-
|
|
9
|
+
import "../chunks/text-Bmfl6CxJ.js";
|
|
10
10
|
e({
|
|
11
11
|
name: "info",
|
|
12
12
|
viewBox: "0 0 24 24",
|
|
@@ -358,12 +358,14 @@ var t = class e extends HTMLElement {
|
|
|
358
358
|
let e = document.createElement("canvas").getContext("2d");
|
|
359
359
|
if (!e) return 60;
|
|
360
360
|
e.font = "12px system-ui, -apple-system, sans-serif";
|
|
361
|
-
let t = this._showLegend ? Math.max(this._legendHeight, 60) : 0, n = this._height - t, r = Math.floor(n / 35), i = Math.min(5, r), a =
|
|
361
|
+
let t = this._showLegend ? Math.max(this._legendHeight, 60) : 0, n = this._height - t, r = Math.floor(n / 35), i = Math.max(1, Math.min(5, r)), a = this._getYRange();
|
|
362
|
+
if (this._hasOnlyZeroValues()) return Math.ceil(e.measureText(this._formatYAxisValue(0)).width) + 20;
|
|
363
|
+
let o = 0;
|
|
362
364
|
for (let t = 0; t <= i; t++) {
|
|
363
|
-
let n =
|
|
364
|
-
|
|
365
|
+
let n = a.max - (a.max - a.min) / i * t, r = this._formatYAxisValue(n), s = e.measureText(r);
|
|
366
|
+
o = Math.max(o, s.width);
|
|
365
367
|
}
|
|
366
|
-
return Math.ceil(
|
|
368
|
+
return Math.ceil(o) + 20;
|
|
367
369
|
}
|
|
368
370
|
_getChartBounds() {
|
|
369
371
|
let e = this._calculateMaxYAxisLabelWidth(), t = `${this._width}-${this._height}-${this._showGrid}-${this._showLegend}-${this._legendHeight}-${e}-${this._rotatedLabelHeight}`;
|
|
@@ -398,6 +400,10 @@ var t = class e extends HTMLElement {
|
|
|
398
400
|
this._isDatasetVisible(t, n) && e.push(...t.data);
|
|
399
401
|
}), e;
|
|
400
402
|
}
|
|
403
|
+
_hasOnlyZeroValues() {
|
|
404
|
+
let e = this._getAllDataPoints();
|
|
405
|
+
return e.length > 0 && e.every((e) => e.y === 0);
|
|
406
|
+
}
|
|
401
407
|
_getXValues() {
|
|
402
408
|
if (!this._chartData) return [];
|
|
403
409
|
let e = JSON.stringify(this._chartData.labels) + JSON.stringify(this._chartData.datasets.map((e) => e.data.map((e) => e.x)));
|
|
@@ -766,7 +772,7 @@ var t = class e extends HTMLElement {
|
|
|
766
772
|
}
|
|
767
773
|
_scaleY(e, t) {
|
|
768
774
|
let n = this._getYRange();
|
|
769
|
-
if (n.max === n.min) return t.y + t.height / 2;
|
|
775
|
+
if (n.max === n.min) return n.min === 0 ? t.y + t.height : t.y + t.height / 2;
|
|
770
776
|
let r = (e - n.min) / (n.max - n.min);
|
|
771
777
|
return t.y + t.height - r * t.height;
|
|
772
778
|
}
|
|
@@ -813,116 +819,117 @@ var t = class e extends HTMLElement {
|
|
|
813
819
|
}
|
|
814
820
|
}
|
|
815
821
|
_renderGrid(e) {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
o
|
|
823
|
-
|
|
824
|
-
|
|
822
|
+
let t = this._chartType !== "pie" && this._hasOnlyZeroValues();
|
|
823
|
+
if (!this._svg || !this._showGrid && !t) return;
|
|
824
|
+
let n = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
825
|
+
n.setAttribute("class", "chart-grid");
|
|
826
|
+
let r = this._getYRange(), i = Math.floor(e.height / 35), a = t ? 0 : Math.max(1, Math.min(5, i));
|
|
827
|
+
for (let i = 0; i <= a; i++) {
|
|
828
|
+
let o = t ? e.y + e.height : e.y + e.height / a * i, s = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
829
|
+
if (s.setAttribute("x1", e.x.toString()), s.setAttribute("y1", o.toString()), s.setAttribute("x2", (e.x + e.width).toString()), s.setAttribute("y2", o.toString()), s.setAttribute("stroke", t ? "#9ca3af" : "#e5e7eb"), s.setAttribute("stroke-width", "1"), t || s.setAttribute("stroke-dasharray", "2,2"), document.documentElement.classList.contains("dark") && s.setAttribute("stroke", "#374151"), n.appendChild(s), t && !this._showGrid) continue;
|
|
830
|
+
let c = t ? 0 : r.max - (r.max - r.min) / a * i, l = document.createElementNS("http://www.w3.org/2000/svg", "text"), u = o + 4;
|
|
831
|
+
i === 0 && (u = o + 12), l.setAttribute("x", "5"), l.setAttribute("y", u.toString()), l.setAttribute("text-anchor", "start"), l.setAttribute("fill", "#6b7280"), l.setAttribute("font-size", "12"), l.textContent = this._formatYAxisValue(c), document.documentElement.classList.contains("dark") && l.setAttribute("fill", "#9ca3af"), n.appendChild(l);
|
|
825
832
|
}
|
|
826
|
-
let
|
|
827
|
-
if (
|
|
828
|
-
this._svg.appendChild(
|
|
833
|
+
let o = this._getXValues();
|
|
834
|
+
if (o.length === 0) {
|
|
835
|
+
this._svg.appendChild(n);
|
|
829
836
|
return;
|
|
830
837
|
}
|
|
831
|
-
let
|
|
832
|
-
|
|
833
|
-
let n =
|
|
834
|
-
|
|
838
|
+
let s = this._chartType === "bar", c = [];
|
|
839
|
+
o.forEach((t) => {
|
|
840
|
+
let n = s ? this._scaleXForBarChart(t, e) : this._scaleX(t, e);
|
|
841
|
+
c.push(n);
|
|
835
842
|
});
|
|
836
|
-
let
|
|
837
|
-
if (
|
|
838
|
-
|
|
843
|
+
let l = document.createElement("canvas").getContext("2d"), u = !1, d = Array(o.length).fill(!0);
|
|
844
|
+
if (l && o.length > 1) {
|
|
845
|
+
l.font = "12px system-ui, -apple-system, sans-serif";
|
|
839
846
|
let e = [];
|
|
840
|
-
|
|
841
|
-
let n = this._formatXAxisValue(t), r =
|
|
847
|
+
o.forEach((t) => {
|
|
848
|
+
let n = this._formatXAxisValue(t), r = l.measureText(n);
|
|
842
849
|
e.push(r.width);
|
|
843
850
|
});
|
|
844
851
|
let t = !0;
|
|
845
|
-
for (let n = 1; n <
|
|
846
|
-
let r =
|
|
852
|
+
for (let n = 1; n < o.length; n++) {
|
|
853
|
+
let r = c[n] - c[n - 1], i = e[n - 1] / 2 + e[n] / 2 + 10;
|
|
847
854
|
if (r < Math.max(i, 80)) {
|
|
848
855
|
t = !1;
|
|
849
856
|
break;
|
|
850
857
|
}
|
|
851
858
|
}
|
|
852
859
|
if (!t) {
|
|
853
|
-
|
|
860
|
+
u = !0;
|
|
854
861
|
let t = 12 * 1.2;
|
|
855
862
|
if (this._rotatedLabelHeight === 0) {
|
|
856
863
|
let n = (Math.max(...e) + t) * .707;
|
|
857
864
|
this._rotatedLabelHeight = Math.ceil(n) + 10;
|
|
858
865
|
}
|
|
859
866
|
let n = t * 1.5, r = !0;
|
|
860
|
-
for (let e = 1; e <
|
|
867
|
+
for (let e = 1; e < o.length; e++) if (c[e] - c[e - 1] < n) {
|
|
861
868
|
r = !1;
|
|
862
869
|
break;
|
|
863
870
|
}
|
|
864
871
|
if (!r) {
|
|
865
872
|
let e = n;
|
|
866
|
-
|
|
873
|
+
d = Array(o.length).fill(!1);
|
|
867
874
|
let t = -Infinity;
|
|
868
|
-
|
|
869
|
-
for (let n = 1; n <
|
|
870
|
-
let r =
|
|
871
|
-
r - t >= e && (
|
|
875
|
+
o.length > 0 && (d[0] = !0, t = c[0]);
|
|
876
|
+
for (let n = 1; n < o.length - 1; n++) {
|
|
877
|
+
let r = c[n];
|
|
878
|
+
r - t >= e && (d[n] = !0, t = r);
|
|
872
879
|
}
|
|
873
|
-
if (
|
|
874
|
-
let n =
|
|
875
|
-
if (n - t >= e)
|
|
880
|
+
if (o.length > 1) {
|
|
881
|
+
let n = c[o.length - 1];
|
|
882
|
+
if (n - t >= e) d[o.length - 1] = !0;
|
|
876
883
|
else {
|
|
877
884
|
for (; n - t < e;) {
|
|
878
885
|
let e = !1;
|
|
879
|
-
for (let n =
|
|
880
|
-
if (
|
|
881
|
-
for (let r = n - 1; r >= 0; r--) if (
|
|
882
|
-
t =
|
|
886
|
+
for (let n = o.length - 2; n >= 0; n--) if (d[n]) {
|
|
887
|
+
if (d[n] = !1, n > 0) {
|
|
888
|
+
for (let r = n - 1; r >= 0; r--) if (d[r]) {
|
|
889
|
+
t = c[r], e = !0;
|
|
883
890
|
break;
|
|
884
891
|
}
|
|
885
|
-
e || (t =
|
|
886
|
-
} else t =
|
|
892
|
+
e || (t = c[0]);
|
|
893
|
+
} else t = c[0];
|
|
887
894
|
e = !0;
|
|
888
895
|
break;
|
|
889
896
|
}
|
|
890
897
|
if (!e) break;
|
|
891
898
|
}
|
|
892
|
-
n - t >= e && (
|
|
899
|
+
n - t >= e && (d[o.length - 1] = !0);
|
|
893
900
|
}
|
|
894
901
|
}
|
|
895
902
|
}
|
|
896
903
|
}
|
|
897
|
-
} else
|
|
898
|
-
|
|
899
|
-
if (
|
|
900
|
-
let i =
|
|
901
|
-
|
|
902
|
-
let
|
|
903
|
-
if (!
|
|
904
|
+
} else d = Array(o.length).fill(!1), o.length > 0 && (d[0] = !0), o.length > 1 && (d[o.length - 1] = !0), this._rotatedLabelHeight = 0;
|
|
905
|
+
u || (this._rotatedLabelHeight = 0), o.forEach((t, r) => {
|
|
906
|
+
if (d[r]) {
|
|
907
|
+
let i = c[r], a = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
|
908
|
+
a.setAttribute("x1", i.toString()), a.setAttribute("y1", e.y.toString()), a.setAttribute("x2", i.toString()), a.setAttribute("y2", (e.y + e.height).toString()), a.setAttribute("stroke", "#e5e7eb"), a.setAttribute("stroke-width", "1"), a.setAttribute("stroke-dasharray", "2,2"), document.documentElement.classList.contains("dark") && a.setAttribute("stroke", "#374151"), n.appendChild(a);
|
|
909
|
+
let s = document.createElementNS("http://www.w3.org/2000/svg", "text"), l = i, d = "middle";
|
|
910
|
+
if (!u) {
|
|
904
911
|
if (r === 0) {
|
|
905
912
|
let t = e.x;
|
|
906
|
-
|
|
907
|
-
} else if (r ===
|
|
913
|
+
l = Math.max(i, t), d = "start";
|
|
914
|
+
} else if (r === o.length - 1) {
|
|
908
915
|
let t = e.x + e.width;
|
|
909
|
-
|
|
916
|
+
l = Math.min(i, t), d = "end";
|
|
910
917
|
}
|
|
911
|
-
} else if (d = "end", r ===
|
|
912
|
-
let
|
|
913
|
-
if (
|
|
914
|
-
|
|
915
|
-
let r = this._formatXAxisValue(
|
|
916
|
-
|
|
918
|
+
} else if (d = "end", r === o.length - 1) {
|
|
919
|
+
let n = document.createElement("canvas").getContext("2d");
|
|
920
|
+
if (n) {
|
|
921
|
+
n.font = "12px system-ui, -apple-system, sans-serif";
|
|
922
|
+
let r = this._formatXAxisValue(t), a = n.measureText(r).width * .707, o = e.x + e.width + 100;
|
|
923
|
+
l = Math.min(i, o - a);
|
|
917
924
|
}
|
|
918
925
|
}
|
|
919
|
-
|
|
926
|
+
s.setAttribute("x", l.toString());
|
|
920
927
|
let f = (this._rotatedLabelHeight > 0 ? 30 : 20) + this._rotatedLabelHeight + 12, p = f;
|
|
921
928
|
this._showLegend && (p = f + 20 + Math.max(this._legendHeight, 60));
|
|
922
|
-
let m = (this._height - e.y - e.height) / p, h = (
|
|
923
|
-
|
|
929
|
+
let m = (this._height - e.y - e.height) / p, h = (u ? 30 : 20) * m, g = e.y + e.height + h;
|
|
930
|
+
s.setAttribute("y", g.toString()), s.setAttribute("text-anchor", d), s.setAttribute("fill", "#6b7280"), s.setAttribute("font-size", "12"), u && s.setAttribute("transform", `rotate(-45 ${l} ${g})`), s.textContent = this._formatXAxisValue(t), document.documentElement.classList.contains("dark") && s.setAttribute("fill", "#9ca3af"), n.appendChild(s);
|
|
924
931
|
}
|
|
925
|
-
}), this._svg.appendChild(
|
|
932
|
+
}), this._svg.appendChild(n);
|
|
926
933
|
}
|
|
927
934
|
_buildMonotoneXLinePathD(e) {
|
|
928
935
|
let t = (e) => e < 0 ? -1 : 1, n = (e, n, r, i, a, o) => {
|
|
@@ -991,26 +998,26 @@ var t = class e extends HTMLElement {
|
|
|
991
998
|
}
|
|
992
999
|
_renderLineChart() {
|
|
993
1000
|
if (!this._svg || !this._chartData) return;
|
|
994
|
-
let e = this._getChartBounds();
|
|
1001
|
+
let e = this._getChartBounds(), t = this._hasOnlyZeroValues();
|
|
995
1002
|
this._renderGrid(e);
|
|
996
|
-
let
|
|
997
|
-
|
|
998
|
-
let
|
|
999
|
-
this._chartData.datasets.forEach((
|
|
1000
|
-
if (!this._isDatasetVisible(
|
|
1001
|
-
let
|
|
1003
|
+
let n = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1004
|
+
n.setAttribute("class", "chart-data");
|
|
1005
|
+
let r = document.createDocumentFragment();
|
|
1006
|
+
this._chartData.datasets.forEach((n, i) => {
|
|
1007
|
+
if (!this._isDatasetVisible(n, i)) return;
|
|
1008
|
+
let a = this._getDatasetColor(n, i), o = document.createElementNS("http://www.w3.org/2000/svg", "path"), s = n.data.map((t) => ({
|
|
1002
1009
|
x: this._scaleX(t.x, e),
|
|
1003
1010
|
y: this._scaleY(t.y, e)
|
|
1004
1011
|
}));
|
|
1005
|
-
|
|
1006
|
-
let o = document.createElementNS("http://www.w3.org/2000/svg", "circle"), s = this._scaleX(
|
|
1007
|
-
o.setAttribute("cx", s.toString()), o.setAttribute("cy", c.toString()), o.setAttribute("r", "4"), o.setAttribute("fill",
|
|
1012
|
+
s.length !== 0 && (t || (o.setAttribute("d", this._buildSmoothLinePathD(s)), o.setAttribute("fill", "none"), o.setAttribute("stroke", a), o.setAttribute("stroke-width", "2"), o.setAttribute("stroke-linecap", "round"), o.setAttribute("stroke-linejoin", "round"), r.appendChild(o)), n.data.forEach((t) => {
|
|
1013
|
+
let o = document.createElementNS("http://www.w3.org/2000/svg", "circle"), s = this._scaleX(t.x, e), c = this._scaleY(t.y, e);
|
|
1014
|
+
o.setAttribute("cx", s.toString()), o.setAttribute("cy", c.toString()), o.setAttribute("r", "4"), o.setAttribute("fill", a);
|
|
1008
1015
|
let l = document.documentElement.classList.contains("dark");
|
|
1009
|
-
o.setAttribute("stroke", l ? "#1f2937" : "#fff"), o.setAttribute("stroke-width", "2"), o.setAttribute("class", "chart-point"), o.setAttribute("data-dataset",
|
|
1010
|
-
let u = String(
|
|
1011
|
-
this._plotPoints.has(u) || this._plotPoints.set(u, []), this._plotPoints.get(u).push(o),
|
|
1016
|
+
o.setAttribute("stroke", l ? "#1f2937" : "#fff"), o.setAttribute("stroke-width", "2"), o.setAttribute("class", "chart-point"), o.setAttribute("data-dataset", i.toString()), o.setAttribute("data-x", String(t.x)), o.setAttribute("data-y", t.y.toString()), o.setAttribute("data-name", n.name), o.style.opacity = "0", o.style.pointerEvents = "none";
|
|
1017
|
+
let u = String(t.x);
|
|
1018
|
+
this._plotPoints.has(u) || this._plotPoints.set(u, []), this._plotPoints.get(u).push(o), r.appendChild(o);
|
|
1012
1019
|
}));
|
|
1013
|
-
}),
|
|
1020
|
+
}), n.appendChild(r), this._svg.appendChild(n);
|
|
1014
1021
|
}
|
|
1015
1022
|
_scaleXForBarChart(e, t) {
|
|
1016
1023
|
let n = this._getXValues();
|
|
@@ -1063,30 +1070,34 @@ var t = class e extends HTMLElement {
|
|
|
1063
1070
|
}
|
|
1064
1071
|
_renderAreaChart() {
|
|
1065
1072
|
if (!this._svg || !this._chartData) return;
|
|
1066
|
-
let e = this._getChartBounds();
|
|
1073
|
+
let e = this._getChartBounds(), t = this._hasOnlyZeroValues();
|
|
1067
1074
|
this._renderGrid(e);
|
|
1068
|
-
let
|
|
1069
|
-
|
|
1070
|
-
let
|
|
1071
|
-
this._chartData.datasets.forEach((
|
|
1072
|
-
if (!this._isDatasetVisible(
|
|
1073
|
-
let
|
|
1075
|
+
let n = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
1076
|
+
n.setAttribute("class", "chart-data");
|
|
1077
|
+
let r = document.createDocumentFragment();
|
|
1078
|
+
this._chartData.datasets.forEach((n, i) => {
|
|
1079
|
+
if (!this._isDatasetVisible(n, i)) return;
|
|
1080
|
+
let a = this._getDatasetColor(n, i), o = n.data.map((t) => ({
|
|
1074
1081
|
x: this._scaleX(t.x, e),
|
|
1075
1082
|
y: this._scaleY(t.y, e)
|
|
1076
1083
|
}));
|
|
1077
|
-
if (
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1084
|
+
if (o.length !== 0) {
|
|
1085
|
+
if (!t) {
|
|
1086
|
+
let t = e.y + e.height, n = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1087
|
+
n.setAttribute("d", this._buildAreaFillPathD(o, t)), n.setAttribute("fill", a), n.setAttribute("fill-opacity", "0.3"), r.appendChild(n);
|
|
1088
|
+
let i = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
1089
|
+
i.setAttribute("d", this._buildSmoothLinePathD(o)), i.setAttribute("fill", "none"), i.setAttribute("stroke", a), i.setAttribute("stroke-width", "2"), i.setAttribute("stroke-linecap", "round"), i.setAttribute("stroke-linejoin", "round"), r.appendChild(i);
|
|
1090
|
+
}
|
|
1091
|
+
n.data.forEach((t) => {
|
|
1092
|
+
let o = document.createElementNS("http://www.w3.org/2000/svg", "circle"), s = this._scaleX(t.x, e), c = this._scaleY(t.y, e);
|
|
1093
|
+
o.setAttribute("cx", s.toString()), o.setAttribute("cy", c.toString()), o.setAttribute("r", "4"), o.setAttribute("fill", a);
|
|
1094
|
+
let l = document.documentElement.classList.contains("dark");
|
|
1095
|
+
o.setAttribute("stroke", l ? "#1f2937" : "#fff"), o.setAttribute("stroke-width", "2"), o.setAttribute("class", "chart-point"), o.setAttribute("data-dataset", i.toString()), o.setAttribute("data-x", String(t.x)), o.setAttribute("data-y", t.y.toString()), o.setAttribute("data-name", n.name), o.style.opacity = "0", o.style.pointerEvents = "none";
|
|
1096
|
+
let u = String(t.x);
|
|
1097
|
+
this._plotPoints.has(u) || this._plotPoints.set(u, []), this._plotPoints.get(u).push(o), r.appendChild(o);
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
}), n.appendChild(r), this._svg.appendChild(n);
|
|
1090
1101
|
}
|
|
1091
1102
|
_renderPieChart() {
|
|
1092
1103
|
if (!this._svg || !this._chartData) return;
|