@progress/kendo-react-chart-wizard 8.3.0-develop.1 → 8.3.0-develop.10
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/ChartWizard.js +1 -1
- package/ChartWizard.mjs +550 -521
- package/SeriesGrid.js +1 -1
- package/SeriesGrid.mjs +20 -20
- package/chart-wizard-state.js +1 -1
- package/chart-wizard-state.mjs +117 -101
- package/dist/cdn/js/kendo-react-chart-wizard.js +1 -1
- package/grid-integration/get-grid-selected-rows.js +1 -1
- package/grid-integration/get-grid-selected-rows.mjs +18 -16
- package/index.d.mts +17 -1
- package/index.d.ts +17 -1
- package/messages.js +1 -1
- package/messages.mjs +196 -196
- package/package.json +15 -15
package/SeriesGrid.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),D=require("@progress/kendo-react-buttons"),o=require("@progress/kendo-react-grid"),I=require("@progress/kendo-react-intl"),x=require("@progress/kendo-svg-icons"),d=require("./SeriesGridCells.js"),s=require("./messages.js"),u="inEdit",b=e=>{const[r,m]=n.useState(null),g=t=>{if(r===t)return;const a=e.data.slice(),i=a.findIndex(c=>c===r),l=a.findIndex(c=>c===t);a.splice(i,1),a.splice(l,0,r||a[0]),e.onChange.call(void 0,a)},C=t=>{m(t)},v=()=>{const t=e.initialData.find(a=>!e.data.find(i=>i.id===a.id));t&&e.onChange.call(void 0,[...e.data,t])},f=(t,a)=>{const i=e.data.map(l=>({...l,[u]:l.id===t.id?a:void 0}));e.onChange.call(void 0,i)},E=()=>{const t=e.data.map(a=>({...a,[u]:void 0}));e.onChange.call(void 0,t)},S=t=>{const a=t.field||"",i=e.data.map(l=>l.id===t.dataItem.id?{...l,[a]:t.value}:l);e.onChange.call(void 0,i)},h=t=>{const a=e.data.filter(i=>i.id!==t);e.onChange.call(void 0,a)};return n.createElement(d.RemoveSeriesContext.Provider,{value:{onRemove:h,count:e.data.length}},n.createElement(d.ReorderContext.Provider,{value:{reorder:g,dragStart:C}},n.createElement(d.SeriesEditContext.Provider,{value:{enterEdit:f,exitEdit:E}},n.createElement(o.Grid,{className:"k-series-grid",style:{width:"100%"},size:"medium",data:e.data,dataItemKey:"id",onItemChange:S,scrollable:"none",editField:u,cells:{headerCell:d.SeriesHeaderCell,data:d.SeriesDataCell,edit:{text:d.SeriesDataEditCell,boolean:d.SeriesDataEditCell,numeric:d.SeriesDataEditCell,date:d.SeriesDataEditCell}}},n.createElement(o.GridToolbar,null,n.createElement(D.Button,{type:"button",className:"k-toolbar-button",fillMode:"flat",onClick:v,disabled:e.data.length===e.initialData.length,svgIcon:x.plusIcon,icon:"plus"},I.useLocalization().toLanguageString(s.configurationSeriesAdd,s.messages[s.configurationSeriesAdd]))),n.createElement(o.GridColumn,{field:"reorder",width:"40px",editable:!1}),n.createElement(o.GridColumn,{field:"name",title:"Name"}),n.createElement(o.GridColumn,{field:"delete",width:"40px",editable:!1})))))};exports.SeriesGrid=b;
|
package/SeriesGrid.mjs
CHANGED
|
@@ -6,41 +6,41 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
import
|
|
9
|
+
import n from "react";
|
|
10
10
|
import { Button as D } from "@progress/kendo-react-buttons";
|
|
11
11
|
import { Grid as I, GridToolbar as S, GridColumn as c } from "@progress/kendo-react-grid";
|
|
12
12
|
import { useLocalization as b } from "@progress/kendo-react-intl";
|
|
13
13
|
import { plusIcon as w } from "@progress/kendo-svg-icons";
|
|
14
14
|
import { RemoveSeriesContext as A, ReorderContext as G, SeriesEditContext as R, SeriesHeaderCell as k, SeriesDataCell as y, SeriesDataEditCell as l } from "./SeriesGridCells.mjs";
|
|
15
|
-
import {
|
|
15
|
+
import { configurationSeriesAdd as s, messages as L } from "./messages.mjs";
|
|
16
16
|
const m = "inEdit", H = (e) => {
|
|
17
|
-
const [o, f] =
|
|
17
|
+
const [o, f] = n.useState(null), u = (t) => {
|
|
18
18
|
if (o === t)
|
|
19
19
|
return;
|
|
20
|
-
const a = e.data.slice(),
|
|
21
|
-
a.splice(
|
|
20
|
+
const a = e.data.slice(), i = a.findIndex((r) => r === o), d = a.findIndex((r) => r === t);
|
|
21
|
+
a.splice(i, 1), a.splice(d, 0, o || a[0]), e.onChange.call(void 0, a);
|
|
22
22
|
}, g = (t) => {
|
|
23
23
|
f(t);
|
|
24
24
|
}, v = () => {
|
|
25
|
-
const t = e.initialData.find((a) => !e.data.find((
|
|
25
|
+
const t = e.initialData.find((a) => !e.data.find((i) => i.id === a.id));
|
|
26
26
|
t && e.onChange.call(void 0, [...e.data, t]);
|
|
27
27
|
}, C = (t, a) => {
|
|
28
|
-
const
|
|
28
|
+
const i = e.data.map((d) => ({
|
|
29
29
|
...d,
|
|
30
30
|
[m]: d.id === t.id ? a : void 0
|
|
31
31
|
}));
|
|
32
|
-
e.onChange.call(void 0,
|
|
33
|
-
},
|
|
32
|
+
e.onChange.call(void 0, i);
|
|
33
|
+
}, E = () => {
|
|
34
34
|
const t = e.data.map((a) => ({ ...a, [m]: void 0 }));
|
|
35
35
|
e.onChange.call(void 0, t);
|
|
36
|
-
},
|
|
37
|
-
const a = t.field || "",
|
|
38
|
-
e.onChange.call(void 0,
|
|
36
|
+
}, h = (t) => {
|
|
37
|
+
const a = t.field || "", i = e.data.map((d) => d.id === t.dataItem.id ? { ...d, [a]: t.value } : d);
|
|
38
|
+
e.onChange.call(void 0, i);
|
|
39
39
|
}, x = (t) => {
|
|
40
|
-
const a = e.data.filter((
|
|
40
|
+
const a = e.data.filter((i) => i.id !== t);
|
|
41
41
|
e.onChange.call(void 0, a);
|
|
42
42
|
};
|
|
43
|
-
return /* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ n.createElement(A.Provider, { value: { onRemove: x, count: e.data.length } }, /* @__PURE__ */ n.createElement(G.Provider, { value: { reorder: u, dragStart: g } }, /* @__PURE__ */ n.createElement(R.Provider, { value: { enterEdit: C, exitEdit: E } }, /* @__PURE__ */ n.createElement(
|
|
44
44
|
I,
|
|
45
45
|
{
|
|
46
46
|
className: "k-series-grid",
|
|
@@ -48,7 +48,7 @@ const m = "inEdit", H = (e) => {
|
|
|
48
48
|
size: "medium",
|
|
49
49
|
data: e.data,
|
|
50
50
|
dataItemKey: "id",
|
|
51
|
-
onItemChange:
|
|
51
|
+
onItemChange: h,
|
|
52
52
|
scrollable: "none",
|
|
53
53
|
editField: m,
|
|
54
54
|
cells: {
|
|
@@ -62,7 +62,7 @@ const m = "inEdit", H = (e) => {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ n.createElement(S, null, /* @__PURE__ */ n.createElement(
|
|
66
66
|
D,
|
|
67
67
|
{
|
|
68
68
|
type: "button",
|
|
@@ -73,11 +73,11 @@ const m = "inEdit", H = (e) => {
|
|
|
73
73
|
svgIcon: w,
|
|
74
74
|
icon: "plus"
|
|
75
75
|
},
|
|
76
|
-
b().toLanguageString(s,
|
|
76
|
+
b().toLanguageString(s, L[s])
|
|
77
77
|
)),
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ n.createElement(c, { field: "reorder", width: "40px", editable: !1 }),
|
|
79
|
+
/* @__PURE__ */ n.createElement(c, { field: "name", title: "Name" }),
|
|
80
|
+
/* @__PURE__ */ n.createElement(c, { field: "delete", width: "40px", editable: !1 })
|
|
81
81
|
))));
|
|
82
82
|
};
|
|
83
83
|
export {
|
package/chart-wizard-state.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
* Licensed under commercial license. See LICENSE.md in the package root for more information
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var _=(t=>(t[t.seriesType=0]="seriesType",t[t.stacked=1]="stacked",t[t.categoryAxisX=2]="categoryAxisX",t[t.valueAxisY=3]="valueAxisY",t[t.seriesChange=4]="seriesChange",t[t.areaMarginLeft=5]="areaMarginLeft",t[t.areaMarginRight=6]="areaMarginRight",t[t.areaMarginTop=7]="areaMarginTop",t[t.areaMarginBottom=8]="areaMarginBottom",t[t.areaBackground=9]="areaBackground",t[t.titleText=10]="titleText",t[t.titleFontName=11]="titleFontName",t[t.titleFontSize=12]="titleFontSize",t[t.titleColor=13]="titleColor",t[t.subtitleText=14]="subtitleText",t[t.subtitleFontName=15]="subtitleFontName",t[t.subtitleFontSize=16]="subtitleFontSize",t[t.subtitleColor=17]="subtitleColor",t[t.seriesColor=18]="seriesColor",t[t.seriesLabel=19]="seriesLabel",t[t.legendVisible=20]="legendVisible",t[t.legendFontName=21]="legendFontName",t[t.legendFontSize=22]="legendFontSize",t[t.legendColor=23]="legendColor",t[t.legendPosition=24]="legendPosition",t[t.categoryAxisTitleText=25]="categoryAxisTitleText",t[t.categoryAxisTitleFontName=26]="categoryAxisTitleFontName",t[t.categoryAxisTitleFontSize=27]="categoryAxisTitleFontSize",t[t.categoryAxisTitleColor=28]="categoryAxisTitleColor",t[t.categoryAxisLabelsFontName=29]="categoryAxisLabelsFontName",t[t.categoryAxisLabelsFontSize=30]="categoryAxisLabelsFontSize",t[t.categoryAxisLabelsColor=31]="categoryAxisLabelsColor",t[t.categoryAxisLabelsRotation=32]="categoryAxisLabelsRotation",t[t.categoryAxisReverseOrder=33]="categoryAxisReverseOrder",t[t.valueAxisTitleText=34]="valueAxisTitleText",t[t.valueAxisTitleFontName=35]="valueAxisTitleFontName",t[t.valueAxisTitleFontSize=36]="valueAxisTitleFontSize",t[t.valueAxisTitleColor=37]="valueAxisTitleColor",t[t.valueAxisLabelsFormat=38]="valueAxisLabelsFormat",t[t.valueAxisLabelsFontName=39]="valueAxisLabelsFontName",t[t.valueAxisLabelsFontSize=40]="valueAxisLabelsFontSize",t[t.valueAxisLabelsColor=41]="valueAxisLabelsColor",t[t.valueAxisLabelsRotation=42]="valueAxisLabelsRotation",t))(_||{});const d=[{text:"16",value:"16px"},{text:"20",value:"20px"},{text:"24",value:"24px"},{text:"48",value:"48px"},{text:"60",value:"60px"},{text:"96",value:"96px"}],v=[{text:"Arial",value:"Arial, Helvetica, sans-serif",style:{fontFamily:"Arial, Helvetica, sans-serif"}},{text:"Courier New",value:"'Courier New', Courier, monospace",style:{fontFamily:"'Courier New', Courier, monospace"}},{text:"Georgia",value:"Georgia, serif",style:{fontFamily:"Georgia, serif"}},{text:"Impact",value:"Impact, Charcoal, sans-serif",style:{fontFamily:"Impact, Charcoal, sans-serif"}},{text:"Lucida Console",value:"'Lucida Console', Monaco, monospace",style:{fontFamily:"'Lucida Console', Monaco, monospace"}},{text:"Tahoma",value:"Tahoma, Geneva, sans-serif",style:{fontFamily:"Tahoma, Geneva, sans-serif"}},{text:"Times New Roman",value:"'Times New Roman', Times,serif",style:{fontFamily:"'Times New Roman', Times,serif"}},{text:"Trebuchet MS",value:"'Trebuchet MS', Helvetica, sans-serif",style:{fontFamily:"'Trebuchet MS', Helvetica, sans-serif"}},{text:"Verdana",value:"Verdana, Geneva, sans-serif",style:{fontFamily:"Verdana, Geneva, sans-serif"}}],ne="column",ue="bar",T="line",W="pie",ee="scatter",ce=[ne,ue,T,ee],ge={type:T,width:0},S=t=>t&&ce.includes(t),L=["string","date","number"],N=["number"],te={bar:[{axisType:"category",types:L},{axisType:"value",types:N}],column:[{axisType:"category",types:L},{axisType:"value",types:N}],line:[{axisType:"category",types:L},{axisType:"value",types:N}],pie:[{axisType:"category",types:L},{axisType:"value",types:N,count:1}],scatter:[{axisType:"category",types:L},{axisType:"value",types:N}]},ae=(t,l)=>`${l||""} ${t||""}`.trim(),R=t=>{const l=(t||"").indexOf(" "),a=t==null?void 0:t.substring(0,l),e=t==null?void 0:t.substring(l+1);return{size:a,name:e}},h=(t,l,a)=>{const{size:e}=R(a);return t?ae(t,e||l):""},C=(t,l,a)=>{const{name:e}=R(a);return t?ae(e||l,t):""},re=(t,l)=>{const a=[],e=t[0].slice();l.types.forEach(n=>{e.forEach((c,o)=>{typeof c.value===n&&a.push(o)})});const g=a.findIndex(n=>{const c=t.map(o=>o[n].value);return new Set(c).size===c.length});return Math.max(g,0)},le=(t,l)=>{const a=[],e=t[0].slice();return l.forEach(g=>{g.types.forEach(n=>{e.forEach((c,o)=>{typeof c.value===n&&a.push(o)})})}),a},se=()=>structuredClone({columns:[],data:[],series:[],initialSeries:[],categoryAxis:[],valueAxis:[{labels:{visible:!0}}],area:{margin:{left:void 0,right:void 0,top:void 0,bottom:void 0}},stack:!1}),ie=(t,l,a)=>{const e=se();e.seriesType=l,e.data=t;const g=te[l];if(!g)return e;const n=t[0].slice();e.columns=t[0].map(s=>String(s.field));const c=g.find(s=>s.axisType==="category");let o=-1;c&&(o=a!=null&&a.categoryAxis?e.columns.indexOf(a==null?void 0:a.categoryAxis):re(t,c));const m=g.filter(s=>s.axisType==="value");let u=le(t,m);u.includes(o)&&(u=u.filter(s=>s!==o));const b=[];u.forEach(s=>{const x=n[s],y=[];t.forEach(F=>{y.push(F[s].value)}),b.push({name:x.field,type:l,data:y,stack:!1,labels:{visible:!1},...l===ee?ge:{}})});const f=o>-1?t.map(s=>String(s[o].value)):[];return b.length&&(e.series=b.map((s,x)=>({...s,id:x})),e.initialSeries=structuredClone(e.series)),f.length&&(e.categoryAxis=[{categories:f,labels:{visible:!0,rotation:"auto"}}],e.categoryField=e.columns[o]),e.legend={visible:!0},e.title={text:void 0},e.subtitle={text:void 0},e},M=(t,l,a)=>{const e=se();e.seriesType=l,e.data=t;const g=te[l];if(!g)return e;const n=t[0].map(s=>s.field),c=g.find(s=>s.axisType==="category");let o=-1;c&&(o=a!=null&&a.categoryAxis?n.indexOf(a==null?void 0:a.categoryAxis):re(t,c));const m=g.filter(s=>s.axisType==="value");let u=[];a!=null&&a.valueAxis?u=[n.indexOf(a.valueAxis)]:u=le(t,m),u.includes(o)&&u.length>1&&(u=u.filter(s=>s!==o)),typeof m[0].count=="number"&&(u=u.slice(0,m[0].count));const b=o>-1?t.map(s=>String(s[o].value)):[],f=[];return t.forEach(s=>{const x={};u.forEach(y=>{const F=s[y];x[F.field]=F.value,x[s[o].field]=s[o].value}),f.push(x)}),e.columns=n,e.categoryAxis=[{categories:b,title:{text:""}}],e.series=[{id:0,data:f,type:l,name:n[o],labels:{visible:!0},categoryField:n[o],field:n[u[0]]}],e.categoryField=n[o],e.valueField=n[u[0]],e.initialSeries=structuredClone(e.series),e},Z=t=>t!=null,xe=(t,l,a)=>{const e=A(t,(a==null?void 0:a.seriesType)||l);return typeof(a==null?void 0:a.stack)!="undefined"?oe(e,1,a.stack):e},A=(t,l)=>(S(l)?ie:M)(t,l),z=(t,l)=>{if(l.legend=t.legend,l.area=t.area,l.title=t.title,l.subtitle=t.subtitle,l.series.length===t.series.length)for(let a=0;a<l.series.length;a++)l.series[a].color=t.series[a].color,l.series[a].labels=t.series[a].labels;return t.series.every(a=>{var e;return(e=a.labels)==null?void 0:e.visible})&&S(l.seriesType)&&S(t.seriesType)&&l.series.forEach(a=>{a.labels=a.labels||{},a.labels.visible=!0}),l},oe=(t,l,a)=>{var g,n,c,o,m,u,b,f,s,x,y,F,I,k,E,D,V,G,O,B,H,p,P,w,X,Y,$,j,q,J,K,Q,U;const e={...t};switch(l){case 0:return A(e.data,a);case 1:return e.series=e.series.map(r=>({...r,stack:a})),e;case 2:{if(e.seriesType&&S(e.seriesType)){const r=ie(e.data,e.seriesType,{categoryAxis:a});return z(e,r)}else if(e.seriesType===W){const r=M(e.data,e.seriesType,{categoryAxis:a});return z(e,r)}return e}case 3:{if(e.seriesType===W){const r=M(e.data,e.seriesType,{categoryAxis:e.categoryField,valueAxis:a});return z(e,r)}return e}case 4:return e.series=a,e;case 5:return e.area={...e.area,margin:{...((g=e.area)==null?void 0:g.margin)||{},left:a}},e;case 6:return e.area={...e.area,margin:{...((n=e.area)==null?void 0:n.margin)||{},right:a}},e;case 7:return e.area={...e.area,margin:{...((c=e.area)==null?void 0:c.margin)||{},top:a}},e;case 8:return e.area={...e.area,margin:{...((o=e.area)==null?void 0:o.margin)||{},bottom:a}},e;case 9:return e.area={...e.area,background:a},e;case 10:return e.title={...e.title,text:a},e;case 11:return e.title={...e.title,font:h(a,d[0].value,(m=e.title)==null?void 0:m.font)},e;case 12:return e.title={...e.title,font:C(a,v[0].value,(u=e.title)==null?void 0:u.font)},e;case 13:return e.title={...e.title,color:a},e;case 14:return e.subtitle={...e.subtitle,text:a},e;case 15:return e.subtitle={...e.subtitle,font:h(a,d[0].value,(b=e.subtitle)==null?void 0:b.font)},e;case 16:return e.subtitle={...e.subtitle,font:C(a,v[0].value,(f=e.subtitle)==null?void 0:f.font)},e;case 17:return e.subtitle={...e.subtitle,color:a},e;case 18:return e.series=e.series.map(r=>({...r,color:a.seriesName===r.name?a.color:r.color})),e;case 19:return e.series=e.series.map(r=>a.all||a.seriesName===r.name?{...r,labels:{visible:a.visible}}:r),e;case 20:return e.legend={...e.legend,visible:a},e;case 21:return e.legend={...e.legend,labels:{...(s=e.legend)==null?void 0:s.labels,font:h(a,d[0].value,(y=(x=e.legend)==null?void 0:x.labels)==null?void 0:y.font)}},e;case 22:return e.legend={...e.legend,labels:{...(F=e.legend)==null?void 0:F.labels,font:C(a,v[0].value,(k=(I=e.legend)==null?void 0:I.labels)==null?void 0:k.font)}},e;case 23:return e.legend={...e.legend,labels:{...(E=e.legend)==null?void 0:E.labels,color:a}},e;case 24:return e.legend={...e.legend,position:a},e;case 25:return e.categoryAxis=(D=e.categoryAxis)==null?void 0:D.map(r=>({...r,title:{...r.title,text:a}})),e;case 26:return e.categoryAxis=(V=e.categoryAxis)==null?void 0:V.map(r=>{var i;return{...r,title:{...r.title,font:h(a,d[0].value,(i=r.title)==null?void 0:i.font)}}}),e;case 27:return e.categoryAxis=(G=e.categoryAxis)==null?void 0:G.map(r=>{var i;return{...r,title:{...r.title,font:C(a,v[0].value,(i=r.title)==null?void 0:i.font)}}}),e;case 28:return e.categoryAxis=(O=e.categoryAxis)==null?void 0:O.map(r=>({...r,title:{...r.title,color:a}})),e;case 29:return e.categoryAxis=(B=e.categoryAxis)==null?void 0:B.map(r=>{var i;return{...r,labels:{...r.labels,font:h(a,d[0].value,(i=r.labels)==null?void 0:i.font)}}}),e;case 30:return e.categoryAxis=(H=e.categoryAxis)==null?void 0:H.map(r=>{var i;return{...r,labels:{...r.labels,font:C(a,v[0].value,(i=r.labels)==null?void 0:i.font)}}}),e;case 31:return e.categoryAxis=(p=e.categoryAxis)==null?void 0:p.map(r=>({...r,labels:{...r.labels,color:a}})),e;case 32:{const r=Z(a)?a:"auto";return e.categoryAxis=(P=e.categoryAxis)==null?void 0:P.map(i=>({...i,labels:{...i.labels,rotation:r}})),e}case 33:return e.categoryAxis=(w=e.categoryAxis)==null?void 0:w.map(r=>({...r,reverse:a})),e;case 34:return!e.valueAxis||e.valueAxis.length===0?e.valueAxis=[{title:{text:a}}]:e.valueAxis=(X=e.valueAxis)==null?void 0:X.map(r=>({...r,title:{...r.title,text:a}})),e;case 35:return e.valueAxis=(Y=e.valueAxis)==null?void 0:Y.map(r=>{var i;return{...r,title:{...r.title,font:h(a,d[0].value,(i=r.title)==null?void 0:i.font)}}}),e;case 36:return e.valueAxis=($=e.valueAxis)==null?void 0:$.map(r=>{var i;return{...r,title:{...r.title,font:C(a,v[0].value,(i=r.title)==null?void 0:i.font)}}}),e;case 37:return e.valueAxis=(j=e.valueAxis)==null?void 0:j.map(r=>({...r,title:{...r.title,color:a}})),e;case 38:return e.valueAxis=(q=e.valueAxis)==null?void 0:q.map(r=>({...r,labels:{...r.labels,format:a}})),e;case 39:return e.valueAxis=(J=e.valueAxis)==null?void 0:J.map(r=>{var i;return{...r,labels:{...r.labels,font:h(a,d[0].value,(i=r.labels)==null?void 0:i.font)}}}),e;case 40:return e.valueAxis=(K=e.valueAxis)==null?void 0:K.map(r=>{var i;return{...r,labels:{...r.labels,font:C(a,v[0].value,(i=r.labels)==null?void 0:i.font)}}}),e;case 41:return e.valueAxis=(Q=e.valueAxis)==null?void 0:Q.map(r=>({...r,labels:{...r.labels,color:a}})),e;case 42:{const r=Z(a)?a:"auto";return e.valueAxis=(U=e.valueAxis)==null?void 0:U.map(i=>({...i,labels:{...i.labels,rotation:r}})),e}default:return e}};exports.ActionTypes=_;exports.createInitialState=xe;exports.createState=A;exports.fontNames=v;exports.fontSizes=d;exports.isCategorical=S;exports.mergeStates=z;exports.parseFont=R;exports.updateState=oe;
|
|
8
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var _=(t=>(t[t.seriesType=0]="seriesType",t[t.stacked=1]="stacked",t[t.categoryAxisX=2]="categoryAxisX",t[t.valueAxisY=3]="valueAxisY",t[t.seriesChange=4]="seriesChange",t[t.areaMarginLeft=5]="areaMarginLeft",t[t.areaMarginRight=6]="areaMarginRight",t[t.areaMarginTop=7]="areaMarginTop",t[t.areaMarginBottom=8]="areaMarginBottom",t[t.areaBackground=9]="areaBackground",t[t.titleText=10]="titleText",t[t.titleFontName=11]="titleFontName",t[t.titleFontSize=12]="titleFontSize",t[t.titleColor=13]="titleColor",t[t.subtitleText=14]="subtitleText",t[t.subtitleFontName=15]="subtitleFontName",t[t.subtitleFontSize=16]="subtitleFontSize",t[t.subtitleColor=17]="subtitleColor",t[t.seriesColor=18]="seriesColor",t[t.seriesLabel=19]="seriesLabel",t[t.legendVisible=20]="legendVisible",t[t.legendFontName=21]="legendFontName",t[t.legendFontSize=22]="legendFontSize",t[t.legendColor=23]="legendColor",t[t.legendPosition=24]="legendPosition",t[t.categoryAxisTitleText=25]="categoryAxisTitleText",t[t.categoryAxisTitleFontName=26]="categoryAxisTitleFontName",t[t.categoryAxisTitleFontSize=27]="categoryAxisTitleFontSize",t[t.categoryAxisTitleColor=28]="categoryAxisTitleColor",t[t.categoryAxisLabelsFontName=29]="categoryAxisLabelsFontName",t[t.categoryAxisLabelsFontSize=30]="categoryAxisLabelsFontSize",t[t.categoryAxisLabelsColor=31]="categoryAxisLabelsColor",t[t.categoryAxisLabelsRotation=32]="categoryAxisLabelsRotation",t[t.categoryAxisReverseOrder=33]="categoryAxisReverseOrder",t[t.valueAxisTitleText=34]="valueAxisTitleText",t[t.valueAxisTitleFontName=35]="valueAxisTitleFontName",t[t.valueAxisTitleFontSize=36]="valueAxisTitleFontSize",t[t.valueAxisTitleColor=37]="valueAxisTitleColor",t[t.valueAxisLabelsFormat=38]="valueAxisLabelsFormat",t[t.valueAxisLabelsFontName=39]="valueAxisLabelsFontName",t[t.valueAxisLabelsFontSize=40]="valueAxisLabelsFontSize",t[t.valueAxisLabelsColor=41]="valueAxisLabelsColor",t[t.valueAxisLabelsRotation=42]="valueAxisLabelsRotation",t))(_||{});const f=[{text:"8",value:"8px"},{text:"10",value:"10px"},{text:"12",value:"12px"},{text:"14",value:"14px"},{text:"16",value:"16px"},{text:"20",value:"20px"},{text:"24",value:"24px"},{text:"48",value:"48px"},{text:"60",value:"60px"},{text:"96",value:"96px"}],d=[{text:"Arial",value:"Arial, Helvetica, sans-serif",style:{fontFamily:"Arial, Helvetica, sans-serif"}},{text:"Courier New",value:"'Courier New', Courier, monospace",style:{fontFamily:"'Courier New', Courier, monospace"}},{text:"Georgia",value:"Georgia, serif",style:{fontFamily:"Georgia, serif"}},{text:"Impact",value:"Impact, Charcoal, sans-serif",style:{fontFamily:"Impact, Charcoal, sans-serif"}},{text:"Lucida Console",value:"'Lucida Console', Monaco, monospace",style:{fontFamily:"'Lucida Console', Monaco, monospace"}},{text:"Tahoma",value:"Tahoma, Geneva, sans-serif",style:{fontFamily:"Tahoma, Geneva, sans-serif"}},{text:"Times New Roman",value:"'Times New Roman', Times,serif",style:{fontFamily:"'Times New Roman', Times,serif"}},{text:"Trebuchet MS",value:"'Trebuchet MS', Helvetica, sans-serif",style:{fontFamily:"'Trebuchet MS', Helvetica, sans-serif"}},{text:"Verdana",value:"Verdana, Geneva, sans-serif",style:{fontFamily:"Verdana, Geneva, sans-serif"}}],ue="column",ce="bar",T="line",Z="pie",ee="scatter",ge=[ue,ce,T,ee],xe={type:T,width:0},S=t=>t&&ge.includes(t),L=["string","date","number"],N=["number"],te={bar:[{axisType:"category",types:L},{axisType:"value",types:N}],column:[{axisType:"category",types:L},{axisType:"value",types:N}],line:[{axisType:"category",types:L},{axisType:"value",types:N}],pie:[{axisType:"category",types:L},{axisType:"value",types:N,count:1}],scatter:[{axisType:"category",types:L},{axisType:"value",types:N}]},ae=(t,l)=>`${l||""} ${t||""}`.trim(),A=t=>{const l=(t||"").indexOf(" "),a=t==null?void 0:t.substring(0,l),e=t==null?void 0:t.substring(l+1);return{size:a,name:e}},h=(t,l,a)=>{const{size:e}=A(a);return t?ae(t,e||l):""},C=(t,l,a)=>{const{name:e}=A(a);return t?ae(e||l,t):""},z=t=>t!=null,re=t=>{const l=structuredClone(t[0]);return l.forEach((a,e)=>{if(!z(a.value))for(let c=0;c<t.length;c++){const n=t[c][e].value;if(z(n)){a.value=n;break}}}),l},le=(t,l)=>{const a=[],e=re(t);l.types.forEach(n=>{e.forEach((g,o)=>{typeof g.value===n&&a.push(o)})});const c=a.findIndex(n=>{const g=t.map(o=>o[n].value);return new Set(g).size===g.length});return Math.max(c,0)},se=(t,l)=>{const a=[],e=re(t);return l.forEach(c=>{c.types.forEach(n=>{e.forEach((g,o)=>{typeof g.value===n&&a.push(o)})})}),a},ie=()=>structuredClone({columns:[],data:[],series:[],initialSeries:[],categoryAxis:[],valueAxis:[{labels:{visible:!0}}],area:{margin:{left:void 0,right:void 0,top:void 0,bottom:void 0}},stack:!1}),oe=(t,l,a)=>{const e=ie();e.seriesType=l,e.data=t;const c=te[l];if(!c)return e;const n=t[0].slice();e.columns=t[0].map(s=>String(s.field));const g=c.find(s=>s.axisType==="category");let o=-1;g&&(o=a!=null&&a.categoryAxis?e.columns.indexOf(a==null?void 0:a.categoryAxis):le(t,g));const m=c.filter(s=>s.axisType==="value");let u=se(t,m);u.includes(o)&&(u.length>1?u=u.filter(s=>s!==o):o=-1);const b=[];u.forEach(s=>{const x=n[s],y=[];t.forEach(F=>{y.push(F[s].value)}),b.push({name:x.field,type:l,data:y,stack:!1,labels:{visible:!1},...l===ee?xe:{}})});const v=o>-1?t.map(s=>String(z(s[o].value)?s[o].value:" ")):[];return b.length&&(e.series=b.map((s,x)=>({...s,id:x})),e.initialSeries=structuredClone(e.series)),e.categoryAxis=[{categories:v,labels:{visible:!0,rotation:"auto"}}],e.categoryField=e.columns[o],e.legend={visible:!0},e.title={text:void 0},e.subtitle={text:void 0},e},R=(t,l,a)=>{const e=ie();e.seriesType=l,e.data=t;const c=te[l];if(!c)return e;const n=t[0].map(s=>s.field),g=c.find(s=>s.axisType==="category");let o=-1;g&&(o=a!=null&&a.categoryAxis?n.indexOf(a==null?void 0:a.categoryAxis):le(t,g));const m=c.filter(s=>s.axisType==="value");let u=[];a!=null&&a.valueAxis?u=[n.indexOf(a.valueAxis)]:u=se(t,m),u.includes(o)&&u.length>1&&(u=u.filter(s=>s!==o)),typeof m[0].count=="number"&&(u=u.slice(0,m[0].count));const b=o>-1?t.map(s=>String(s[o].value)):[],v=[];return t.forEach(s=>{const x={};u.forEach(y=>{const F=s[y];x[F.field]=F.value||0,x[s[o].field]=s[o].value||" "}),v.push(x)}),e.columns=n,e.categoryAxis=[{categories:b,title:{text:""}}],e.series=[{id:0,data:v,type:l,name:n[o],labels:{visible:!0},categoryField:n[o],field:n[u[0]]}],e.categoryField=n[o],e.valueField=n[u[0]],e.initialSeries=structuredClone(e.series),e},me=(t,l,a)=>{const e=I(t,(a==null?void 0:a.seriesType)||l);return typeof(a==null?void 0:a.stack)!="undefined"?ne(e,1,a.stack):e},I=(t,l)=>(S(l)?oe:R)(t,l),M=(t,l)=>{if(l.legend=t.legend,l.area=t.area,l.title=t.title,l.subtitle=t.subtitle,l.series.length===t.series.length)for(let a=0;a<l.series.length;a++)l.series[a].color=t.series[a].color,l.series[a].labels=t.series[a].labels;return t.series.every(a=>{var e;return(e=a.labels)==null?void 0:e.visible})&&S(l.seriesType)&&S(t.seriesType)&&l.series.forEach(a=>{a.labels=a.labels||{},a.labels.visible=!0}),l},ne=(t,l,a)=>{var c,n,g,o,m,u,b,v,s,x,y,F,k,E,p,V,D,G,O,B,H,P,w,X,Y,$,j,W,q,J,K,Q,U;const e={...t};switch(l){case 0:return I(e.data,a);case 1:return e.series=e.series.map(r=>({...r,stack:a})),e;case 2:{if(e.seriesType&&S(e.seriesType)){const r=oe(e.data,e.seriesType,{categoryAxis:a});return M(e,r)}else if(e.seriesType===Z){const r=R(e.data,e.seriesType,{categoryAxis:a});return M(e,r)}return e}case 3:{if(e.seriesType===Z){const r=R(e.data,e.seriesType,{categoryAxis:e.categoryField,valueAxis:a});return M(e,r)}return e}case 4:return e.series=a,e;case 5:return e.area={...e.area,margin:{...((c=e.area)==null?void 0:c.margin)||{},left:a}},e;case 6:return e.area={...e.area,margin:{...((n=e.area)==null?void 0:n.margin)||{},right:a}},e;case 7:return e.area={...e.area,margin:{...((g=e.area)==null?void 0:g.margin)||{},top:a}},e;case 8:return e.area={...e.area,margin:{...((o=e.area)==null?void 0:o.margin)||{},bottom:a}},e;case 9:return e.area={...e.area,background:a},e;case 10:return e.title={...e.title,text:a},e;case 11:return e.title={...e.title,font:h(a,f[0].value,(m=e.title)==null?void 0:m.font)},e;case 12:return e.title={...e.title,font:C(a,d[0].value,(u=e.title)==null?void 0:u.font)},e;case 13:return e.title={...e.title,color:a},e;case 14:return e.subtitle={...e.subtitle,text:a},e;case 15:return e.subtitle={...e.subtitle,font:h(a,f[0].value,(b=e.subtitle)==null?void 0:b.font)},e;case 16:return e.subtitle={...e.subtitle,font:C(a,d[0].value,(v=e.subtitle)==null?void 0:v.font)},e;case 17:return e.subtitle={...e.subtitle,color:a},e;case 18:return e.series=e.series.map(r=>({...r,color:a.seriesName===r.name?a.color:r.color})),e;case 19:return e.series=e.series.map(r=>a.all||a.seriesName===r.name?{...r,labels:{visible:a.visible}}:r),e;case 20:return e.legend={...e.legend,visible:a},e;case 21:return e.legend={...e.legend,labels:{...(s=e.legend)==null?void 0:s.labels,font:h(a,f[0].value,(y=(x=e.legend)==null?void 0:x.labels)==null?void 0:y.font)}},e;case 22:return e.legend={...e.legend,labels:{...(F=e.legend)==null?void 0:F.labels,font:C(a,d[0].value,(E=(k=e.legend)==null?void 0:k.labels)==null?void 0:E.font)}},e;case 23:return e.legend={...e.legend,labels:{...(p=e.legend)==null?void 0:p.labels,color:a}},e;case 24:return e.legend={...e.legend,position:a},e;case 25:return e.categoryAxis=(V=e.categoryAxis)==null?void 0:V.map(r=>({...r,title:{...r.title,text:a}})),e;case 26:return e.categoryAxis=(D=e.categoryAxis)==null?void 0:D.map(r=>{var i;return{...r,title:{...r.title,font:h(a,f[0].value,(i=r.title)==null?void 0:i.font)}}}),e;case 27:return e.categoryAxis=(G=e.categoryAxis)==null?void 0:G.map(r=>{var i;return{...r,title:{...r.title,font:C(a,d[0].value,(i=r.title)==null?void 0:i.font)}}}),e;case 28:return e.categoryAxis=(O=e.categoryAxis)==null?void 0:O.map(r=>({...r,title:{...r.title,color:a}})),e;case 29:return e.categoryAxis=(B=e.categoryAxis)==null?void 0:B.map(r=>{var i;return{...r,labels:{...r.labels,font:h(a,f[0].value,(i=r.labels)==null?void 0:i.font)}}}),e;case 30:return e.categoryAxis=(H=e.categoryAxis)==null?void 0:H.map(r=>{var i;return{...r,labels:{...r.labels,font:C(a,d[0].value,(i=r.labels)==null?void 0:i.font)}}}),e;case 31:return e.categoryAxis=(P=e.categoryAxis)==null?void 0:P.map(r=>({...r,labels:{...r.labels,color:a}})),e;case 32:{const r=z(a)?a:"auto";return e.categoryAxis=(w=e.categoryAxis)==null?void 0:w.map(i=>({...i,labels:{...i.labels,rotation:r}})),e}case 33:return e.categoryAxis=(X=e.categoryAxis)==null?void 0:X.map(r=>({...r,reverse:a})),e;case 34:return!e.valueAxis||e.valueAxis.length===0?e.valueAxis=[{title:{text:a}}]:e.valueAxis=(Y=e.valueAxis)==null?void 0:Y.map(r=>({...r,title:{...r.title,text:a}})),e;case 35:return e.valueAxis=($=e.valueAxis)==null?void 0:$.map(r=>{var i;return{...r,title:{...r.title,font:h(a,f[0].value,(i=r.title)==null?void 0:i.font)}}}),e;case 36:return e.valueAxis=(j=e.valueAxis)==null?void 0:j.map(r=>{var i;return{...r,title:{...r.title,font:C(a,d[0].value,(i=r.title)==null?void 0:i.font)}}}),e;case 37:return e.valueAxis=(W=e.valueAxis)==null?void 0:W.map(r=>({...r,title:{...r.title,color:a}})),e;case 38:return e.valueAxis=(q=e.valueAxis)==null?void 0:q.map(r=>({...r,labels:{...r.labels,format:a}})),e;case 39:return e.valueAxis=(J=e.valueAxis)==null?void 0:J.map(r=>{var i;return{...r,labels:{...r.labels,font:h(a,f[0].value,(i=r.labels)==null?void 0:i.font)}}}),e;case 40:return e.valueAxis=(K=e.valueAxis)==null?void 0:K.map(r=>{var i;return{...r,labels:{...r.labels,font:C(a,d[0].value,(i=r.labels)==null?void 0:i.font)}}}),e;case 41:return e.valueAxis=(Q=e.valueAxis)==null?void 0:Q.map(r=>({...r,labels:{...r.labels,color:a}})),e;case 42:{const r=z(a)?a:"auto";return e.valueAxis=(U=e.valueAxis)==null?void 0:U.map(i=>({...i,labels:{...i.labels,rotation:r}})),e}default:return e}};exports.ActionTypes=_;exports.createInitialState=me;exports.createState=I;exports.fontNames=d;exports.fontSizes=f;exports.isCategorical=S;exports.mergeStates=M;exports.parseFont=A;exports.updateState=ne;
|
package/chart-wizard-state.mjs
CHANGED
|
@@ -6,15 +6,19 @@
|
|
|
6
6
|
*-------------------------------------------------------------------------------------------
|
|
7
7
|
*/
|
|
8
8
|
"use client";
|
|
9
|
-
var
|
|
10
|
-
const
|
|
9
|
+
var oe = /* @__PURE__ */ ((t) => (t[t.seriesType = 0] = "seriesType", t[t.stacked = 1] = "stacked", t[t.categoryAxisX = 2] = "categoryAxisX", t[t.valueAxisY = 3] = "valueAxisY", t[t.seriesChange = 4] = "seriesChange", t[t.areaMarginLeft = 5] = "areaMarginLeft", t[t.areaMarginRight = 6] = "areaMarginRight", t[t.areaMarginTop = 7] = "areaMarginTop", t[t.areaMarginBottom = 8] = "areaMarginBottom", t[t.areaBackground = 9] = "areaBackground", t[t.titleText = 10] = "titleText", t[t.titleFontName = 11] = "titleFontName", t[t.titleFontSize = 12] = "titleFontSize", t[t.titleColor = 13] = "titleColor", t[t.subtitleText = 14] = "subtitleText", t[t.subtitleFontName = 15] = "subtitleFontName", t[t.subtitleFontSize = 16] = "subtitleFontSize", t[t.subtitleColor = 17] = "subtitleColor", t[t.seriesColor = 18] = "seriesColor", t[t.seriesLabel = 19] = "seriesLabel", t[t.legendVisible = 20] = "legendVisible", t[t.legendFontName = 21] = "legendFontName", t[t.legendFontSize = 22] = "legendFontSize", t[t.legendColor = 23] = "legendColor", t[t.legendPosition = 24] = "legendPosition", t[t.categoryAxisTitleText = 25] = "categoryAxisTitleText", t[t.categoryAxisTitleFontName = 26] = "categoryAxisTitleFontName", t[t.categoryAxisTitleFontSize = 27] = "categoryAxisTitleFontSize", t[t.categoryAxisTitleColor = 28] = "categoryAxisTitleColor", t[t.categoryAxisLabelsFontName = 29] = "categoryAxisLabelsFontName", t[t.categoryAxisLabelsFontSize = 30] = "categoryAxisLabelsFontSize", t[t.categoryAxisLabelsColor = 31] = "categoryAxisLabelsColor", t[t.categoryAxisLabelsRotation = 32] = "categoryAxisLabelsRotation", t[t.categoryAxisReverseOrder = 33] = "categoryAxisReverseOrder", t[t.valueAxisTitleText = 34] = "valueAxisTitleText", t[t.valueAxisTitleFontName = 35] = "valueAxisTitleFontName", t[t.valueAxisTitleFontSize = 36] = "valueAxisTitleFontSize", t[t.valueAxisTitleColor = 37] = "valueAxisTitleColor", t[t.valueAxisLabelsFormat = 38] = "valueAxisLabelsFormat", t[t.valueAxisLabelsFontName = 39] = "valueAxisLabelsFontName", t[t.valueAxisLabelsFontSize = 40] = "valueAxisLabelsFontSize", t[t.valueAxisLabelsColor = 41] = "valueAxisLabelsColor", t[t.valueAxisLabelsRotation = 42] = "valueAxisLabelsRotation", t))(oe || {});
|
|
10
|
+
const h = [
|
|
11
|
+
{ text: "8", value: "8px" },
|
|
12
|
+
{ text: "10", value: "10px" },
|
|
13
|
+
{ text: "12", value: "12px" },
|
|
14
|
+
{ text: "14", value: "14px" },
|
|
11
15
|
{ text: "16", value: "16px" },
|
|
12
16
|
{ text: "20", value: "20px" },
|
|
13
17
|
{ text: "24", value: "24px" },
|
|
14
18
|
{ text: "48", value: "48px" },
|
|
15
19
|
{ text: "60", value: "60px" },
|
|
16
20
|
{ text: "96", value: "96px" }
|
|
17
|
-
],
|
|
21
|
+
], F = [
|
|
18
22
|
{
|
|
19
23
|
text: "Arial",
|
|
20
24
|
value: "Arial, Helvetica, sans-serif",
|
|
@@ -60,10 +64,10 @@ const F = [
|
|
|
60
64
|
value: "Verdana, Geneva, sans-serif",
|
|
61
65
|
style: { fontFamily: "Verdana, Geneva, sans-serif" }
|
|
62
66
|
}
|
|
63
|
-
],
|
|
64
|
-
type:
|
|
67
|
+
], ne = "column", ue = "bar", U = "line", Q = "pie", Z = "scatter", ce = [ne, ue, U, Z], ge = {
|
|
68
|
+
type: U,
|
|
65
69
|
width: 0
|
|
66
|
-
},
|
|
70
|
+
}, S = (t) => t && ce.includes(t), L = ["string", "date", "number"], N = ["number"], _ = {
|
|
67
71
|
bar: [
|
|
68
72
|
{ axisType: "category", types: L },
|
|
69
73
|
{ axisType: "value", types: N }
|
|
@@ -87,34 +91,46 @@ const F = [
|
|
|
87
91
|
}, T = (t, l) => `${l || ""} ${t || ""}`.trim(), ee = (t) => {
|
|
88
92
|
const l = (t || "").indexOf(" "), a = t == null ? void 0 : t.substring(0, l), e = t == null ? void 0 : t.substring(l + 1);
|
|
89
93
|
return { size: a, name: e };
|
|
90
|
-
},
|
|
94
|
+
}, y = (t, l, a) => {
|
|
91
95
|
const { size: e } = ee(a);
|
|
92
96
|
return t ? T(t, e || l) : "";
|
|
93
97
|
}, C = (t, l, a) => {
|
|
94
98
|
const { name: e } = ee(a);
|
|
95
99
|
return t ? T(e || l, t) : "";
|
|
96
|
-
},
|
|
97
|
-
const
|
|
100
|
+
}, z = (t) => t != null, te = (t) => {
|
|
101
|
+
const l = structuredClone(t[0]);
|
|
102
|
+
return l.forEach((a, e) => {
|
|
103
|
+
if (!z(a.value))
|
|
104
|
+
for (let c = 0; c < t.length; c++) {
|
|
105
|
+
const n = t[c][e].value;
|
|
106
|
+
if (z(n)) {
|
|
107
|
+
a.value = n;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}), l;
|
|
112
|
+
}, ae = (t, l) => {
|
|
113
|
+
const a = [], e = te(t);
|
|
98
114
|
l.types.forEach((n) => {
|
|
99
|
-
e.forEach((
|
|
100
|
-
typeof
|
|
115
|
+
e.forEach((g, o) => {
|
|
116
|
+
typeof g.value === n && a.push(o);
|
|
101
117
|
});
|
|
102
118
|
});
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
return new Set(
|
|
119
|
+
const c = a.findIndex((n) => {
|
|
120
|
+
const g = t.map((o) => o[n].value);
|
|
121
|
+
return new Set(g).size === g.length;
|
|
106
122
|
});
|
|
107
|
-
return Math.max(
|
|
108
|
-
},
|
|
109
|
-
const a = [], e = t
|
|
110
|
-
return l.forEach((
|
|
111
|
-
|
|
112
|
-
e.forEach((
|
|
113
|
-
typeof
|
|
123
|
+
return Math.max(c, 0);
|
|
124
|
+
}, re = (t, l) => {
|
|
125
|
+
const a = [], e = te(t);
|
|
126
|
+
return l.forEach((c) => {
|
|
127
|
+
c.types.forEach((n) => {
|
|
128
|
+
e.forEach((g, o) => {
|
|
129
|
+
typeof g.value === n && a.push(o);
|
|
114
130
|
});
|
|
115
131
|
});
|
|
116
132
|
}), a;
|
|
117
|
-
},
|
|
133
|
+
}, le = () => structuredClone({
|
|
118
134
|
columns: [],
|
|
119
135
|
data: [],
|
|
120
136
|
series: [],
|
|
@@ -125,56 +141,56 @@ const F = [
|
|
|
125
141
|
margin: { left: void 0, right: void 0, top: void 0, bottom: void 0 }
|
|
126
142
|
},
|
|
127
143
|
stack: !1
|
|
128
|
-
}),
|
|
129
|
-
const e =
|
|
144
|
+
}), se = (t, l, a) => {
|
|
145
|
+
const e = le();
|
|
130
146
|
e.seriesType = l, e.data = t;
|
|
131
|
-
const
|
|
132
|
-
if (!
|
|
147
|
+
const c = _[l];
|
|
148
|
+
if (!c)
|
|
133
149
|
return e;
|
|
134
150
|
const n = t[0].slice();
|
|
135
151
|
e.columns = t[0].map((s) => String(s.field));
|
|
136
|
-
const
|
|
152
|
+
const g = c.find((s) => s.axisType === "category");
|
|
137
153
|
let o = -1;
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
let u =
|
|
141
|
-
u.includes(o) && (u = u.filter((s) => s !== o));
|
|
142
|
-
const
|
|
154
|
+
g && (o = a != null && a.categoryAxis ? e.columns.indexOf(a == null ? void 0 : a.categoryAxis) : ae(t, g));
|
|
155
|
+
const b = c.filter((s) => s.axisType === "value");
|
|
156
|
+
let u = re(t, b);
|
|
157
|
+
u.includes(o) && (u.length > 1 ? u = u.filter((s) => s !== o) : o = -1);
|
|
158
|
+
const m = [];
|
|
143
159
|
u.forEach((s) => {
|
|
144
|
-
const x = n[s],
|
|
145
|
-
t.forEach((
|
|
146
|
-
|
|
147
|
-
}),
|
|
160
|
+
const x = n[s], v = [];
|
|
161
|
+
t.forEach((d) => {
|
|
162
|
+
v.push(d[s].value);
|
|
163
|
+
}), m.push({
|
|
148
164
|
name: x.field,
|
|
149
165
|
type: l,
|
|
150
|
-
data:
|
|
166
|
+
data: v,
|
|
151
167
|
stack: !1,
|
|
152
168
|
labels: { visible: !1 },
|
|
153
|
-
...l === Z ?
|
|
169
|
+
...l === Z ? ge : {}
|
|
154
170
|
});
|
|
155
171
|
});
|
|
156
|
-
const f = o > -1 ? t.map((s) => String(s[o].value)) : [];
|
|
157
|
-
return
|
|
158
|
-
},
|
|
159
|
-
const e =
|
|
172
|
+
const f = o > -1 ? t.map((s) => String(z(s[o].value) ? s[o].value : " ")) : [];
|
|
173
|
+
return m.length && (e.series = m.map((s, x) => ({ ...s, id: x })), e.initialSeries = structuredClone(e.series)), e.categoryAxis = [{ categories: f, labels: { visible: !0, rotation: "auto" } }], e.categoryField = e.columns[o], e.legend = { visible: !0 }, e.title = { text: void 0 }, e.subtitle = { text: void 0 }, e;
|
|
174
|
+
}, M = (t, l, a) => {
|
|
175
|
+
const e = le();
|
|
160
176
|
e.seriesType = l, e.data = t;
|
|
161
|
-
const
|
|
162
|
-
if (!
|
|
177
|
+
const c = _[l];
|
|
178
|
+
if (!c)
|
|
163
179
|
return e;
|
|
164
|
-
const n = t[0].map((s) => s.field),
|
|
180
|
+
const n = t[0].map((s) => s.field), g = c.find((s) => s.axisType === "category");
|
|
165
181
|
let o = -1;
|
|
166
|
-
|
|
167
|
-
const
|
|
182
|
+
g && (o = a != null && a.categoryAxis ? n.indexOf(a == null ? void 0 : a.categoryAxis) : ae(t, g));
|
|
183
|
+
const b = c.filter((s) => s.axisType === "value");
|
|
168
184
|
let u = [];
|
|
169
|
-
a != null && a.valueAxis ? u = [n.indexOf(a.valueAxis)] : u =
|
|
170
|
-
const
|
|
185
|
+
a != null && a.valueAxis ? u = [n.indexOf(a.valueAxis)] : u = re(t, b), u.includes(o) && u.length > 1 && (u = u.filter((s) => s !== o)), typeof b[0].count == "number" && (u = u.slice(0, b[0].count));
|
|
186
|
+
const m = o > -1 ? t.map((s) => String(s[o].value)) : [], f = [];
|
|
171
187
|
return t.forEach((s) => {
|
|
172
188
|
const x = {};
|
|
173
|
-
u.forEach((
|
|
174
|
-
const
|
|
175
|
-
x[
|
|
189
|
+
u.forEach((v) => {
|
|
190
|
+
const d = s[v];
|
|
191
|
+
x[d.field] = d.value || 0, x[s[o].field] = s[o].value || " ";
|
|
176
192
|
}), f.push(x);
|
|
177
|
-
}), e.columns = n, e.categoryAxis = [{ categories:
|
|
193
|
+
}), e.columns = n, e.categoryAxis = [{ categories: m, title: { text: "" } }], e.series = [{
|
|
178
194
|
id: 0,
|
|
179
195
|
data: f,
|
|
180
196
|
type: l,
|
|
@@ -183,52 +199,52 @@ const F = [
|
|
|
183
199
|
categoryField: n[o],
|
|
184
200
|
field: n[u[0]]
|
|
185
201
|
}], e.categoryField = n[o], e.valueField = n[u[0]], e.initialSeries = structuredClone(e.series), e;
|
|
186
|
-
},
|
|
187
|
-
const e =
|
|
188
|
-
return typeof (a == null ? void 0 : a.stack) != "undefined" ?
|
|
189
|
-
},
|
|
202
|
+
}, be = (t, l, a) => {
|
|
203
|
+
const e = ie(t, (a == null ? void 0 : a.seriesType) || l);
|
|
204
|
+
return typeof (a == null ? void 0 : a.stack) != "undefined" ? xe(e, 1, a.stack) : e;
|
|
205
|
+
}, ie = (t, l) => (S(l) ? se : M)(t, l), R = (t, l) => {
|
|
190
206
|
if (l.legend = t.legend, l.area = t.area, l.title = t.title, l.subtitle = t.subtitle, l.series.length === t.series.length)
|
|
191
207
|
for (let a = 0; a < l.series.length; a++)
|
|
192
208
|
l.series[a].color = t.series[a].color, l.series[a].labels = t.series[a].labels;
|
|
193
209
|
return t.series.every((a) => {
|
|
194
210
|
var e;
|
|
195
211
|
return (e = a.labels) == null ? void 0 : e.visible;
|
|
196
|
-
}) &&
|
|
212
|
+
}) && S(l.seriesType) && S(t.seriesType) && l.series.forEach((a) => {
|
|
197
213
|
a.labels = a.labels || {}, a.labels.visible = !0;
|
|
198
214
|
}), l;
|
|
199
|
-
},
|
|
200
|
-
var
|
|
215
|
+
}, xe = (t, l, a) => {
|
|
216
|
+
var c, n, g, o, b, u, m, f, s, x, v, d, A, I, k, E, V, D, G, p, O, B, H, w, P, X, Y, $, W, j, q, J, K;
|
|
201
217
|
const e = { ...t };
|
|
202
218
|
switch (l) {
|
|
203
219
|
case 0:
|
|
204
|
-
return
|
|
220
|
+
return ie(e.data, a);
|
|
205
221
|
case 1:
|
|
206
222
|
return e.series = e.series.map((r) => ({ ...r, stack: a })), e;
|
|
207
223
|
case 2: {
|
|
208
|
-
if (e.seriesType &&
|
|
209
|
-
const r =
|
|
210
|
-
return
|
|
224
|
+
if (e.seriesType && S(e.seriesType)) {
|
|
225
|
+
const r = se(e.data, e.seriesType, { categoryAxis: a });
|
|
226
|
+
return R(e, r);
|
|
211
227
|
} else if (e.seriesType === Q) {
|
|
212
|
-
const r =
|
|
213
|
-
return
|
|
228
|
+
const r = M(e.data, e.seriesType, { categoryAxis: a });
|
|
229
|
+
return R(e, r);
|
|
214
230
|
}
|
|
215
231
|
return e;
|
|
216
232
|
}
|
|
217
233
|
case 3: {
|
|
218
234
|
if (e.seriesType === Q) {
|
|
219
|
-
const r =
|
|
220
|
-
return
|
|
235
|
+
const r = M(e.data, e.seriesType, { categoryAxis: e.categoryField, valueAxis: a });
|
|
236
|
+
return R(e, r);
|
|
221
237
|
}
|
|
222
238
|
return e;
|
|
223
239
|
}
|
|
224
240
|
case 4:
|
|
225
241
|
return e.series = a, e;
|
|
226
242
|
case 5:
|
|
227
|
-
return e.area = { ...e.area, margin: { ...((
|
|
243
|
+
return e.area = { ...e.area, margin: { ...((c = e.area) == null ? void 0 : c.margin) || {}, left: a } }, e;
|
|
228
244
|
case 6:
|
|
229
245
|
return e.area = { ...e.area, margin: { ...((n = e.area) == null ? void 0 : n.margin) || {}, right: a } }, e;
|
|
230
246
|
case 7:
|
|
231
|
-
return e.area = { ...e.area, margin: { ...((
|
|
247
|
+
return e.area = { ...e.area, margin: { ...((g = e.area) == null ? void 0 : g.margin) || {}, top: a } }, e;
|
|
232
248
|
case 8:
|
|
233
249
|
return e.area = { ...e.area, margin: { ...((o = e.area) == null ? void 0 : o.margin) || {}, bottom: a } }, e;
|
|
234
250
|
case 9:
|
|
@@ -236,17 +252,17 @@ const F = [
|
|
|
236
252
|
case 10:
|
|
237
253
|
return e.title = { ...e.title, text: a }, e;
|
|
238
254
|
case 11:
|
|
239
|
-
return e.title = { ...e.title, font:
|
|
255
|
+
return e.title = { ...e.title, font: y(a, h[0].value, (b = e.title) == null ? void 0 : b.font) }, e;
|
|
240
256
|
case 12:
|
|
241
|
-
return e.title = { ...e.title, font: C(a,
|
|
257
|
+
return e.title = { ...e.title, font: C(a, F[0].value, (u = e.title) == null ? void 0 : u.font) }, e;
|
|
242
258
|
case 13:
|
|
243
259
|
return e.title = { ...e.title, color: a }, e;
|
|
244
260
|
case 14:
|
|
245
261
|
return e.subtitle = { ...e.subtitle, text: a }, e;
|
|
246
262
|
case 15:
|
|
247
|
-
return e.subtitle = { ...e.subtitle, font:
|
|
263
|
+
return e.subtitle = { ...e.subtitle, font: y(a, h[0].value, (m = e.subtitle) == null ? void 0 : m.font) }, e;
|
|
248
264
|
case 16:
|
|
249
|
-
return e.subtitle = { ...e.subtitle, font: C(a,
|
|
265
|
+
return e.subtitle = { ...e.subtitle, font: C(a, F[0].value, (f = e.subtitle) == null ? void 0 : f.font) }, e;
|
|
250
266
|
case 17:
|
|
251
267
|
return e.subtitle = { ...e.subtitle, color: a }, e;
|
|
252
268
|
case 18:
|
|
@@ -256,41 +272,41 @@ const F = [
|
|
|
256
272
|
case 20:
|
|
257
273
|
return e.legend = { ...e.legend, visible: a }, e;
|
|
258
274
|
case 21:
|
|
259
|
-
return e.legend = { ...e.legend, labels: { ...(s = e.legend) == null ? void 0 : s.labels, font:
|
|
275
|
+
return e.legend = { ...e.legend, labels: { ...(s = e.legend) == null ? void 0 : s.labels, font: y(a, h[0].value, (v = (x = e.legend) == null ? void 0 : x.labels) == null ? void 0 : v.font) } }, e;
|
|
260
276
|
case 22:
|
|
261
|
-
return e.legend = { ...e.legend, labels: { ...(
|
|
277
|
+
return e.legend = { ...e.legend, labels: { ...(d = e.legend) == null ? void 0 : d.labels, font: C(a, F[0].value, (I = (A = e.legend) == null ? void 0 : A.labels) == null ? void 0 : I.font) } }, e;
|
|
262
278
|
case 23:
|
|
263
|
-
return e.legend = { ...e.legend, labels: { ...(
|
|
279
|
+
return e.legend = { ...e.legend, labels: { ...(k = e.legend) == null ? void 0 : k.labels, color: a } }, e;
|
|
264
280
|
case 24:
|
|
265
281
|
return e.legend = { ...e.legend, position: a }, e;
|
|
266
282
|
case 25:
|
|
267
|
-
return e.categoryAxis = (
|
|
283
|
+
return e.categoryAxis = (E = e.categoryAxis) == null ? void 0 : E.map((r) => ({ ...r, title: { ...r.title, text: a } })), e;
|
|
268
284
|
case 26:
|
|
269
|
-
return e.categoryAxis = (
|
|
285
|
+
return e.categoryAxis = (V = e.categoryAxis) == null ? void 0 : V.map((r) => {
|
|
270
286
|
var i;
|
|
271
|
-
return { ...r, title: { ...r.title, font:
|
|
287
|
+
return { ...r, title: { ...r.title, font: y(a, h[0].value, (i = r.title) == null ? void 0 : i.font) } };
|
|
272
288
|
}), e;
|
|
273
289
|
case 27:
|
|
274
290
|
return e.categoryAxis = (D = e.categoryAxis) == null ? void 0 : D.map((r) => {
|
|
275
291
|
var i;
|
|
276
|
-
return { ...r, title: { ...r.title, font: C(a,
|
|
292
|
+
return { ...r, title: { ...r.title, font: C(a, F[0].value, (i = r.title) == null ? void 0 : i.font) } };
|
|
277
293
|
}), e;
|
|
278
294
|
case 28:
|
|
279
|
-
return e.categoryAxis = (
|
|
295
|
+
return e.categoryAxis = (G = e.categoryAxis) == null ? void 0 : G.map((r) => ({ ...r, title: { ...r.title, color: a } })), e;
|
|
280
296
|
case 29:
|
|
281
|
-
return e.categoryAxis = (
|
|
297
|
+
return e.categoryAxis = (p = e.categoryAxis) == null ? void 0 : p.map((r) => {
|
|
282
298
|
var i;
|
|
283
|
-
return { ...r, labels: { ...r.labels, font:
|
|
299
|
+
return { ...r, labels: { ...r.labels, font: y(a, h[0].value, (i = r.labels) == null ? void 0 : i.font) } };
|
|
284
300
|
}), e;
|
|
285
301
|
case 30:
|
|
286
302
|
return e.categoryAxis = (O = e.categoryAxis) == null ? void 0 : O.map((r) => {
|
|
287
303
|
var i;
|
|
288
|
-
return { ...r, labels: { ...r.labels, font: C(a,
|
|
304
|
+
return { ...r, labels: { ...r.labels, font: C(a, F[0].value, (i = r.labels) == null ? void 0 : i.font) } };
|
|
289
305
|
}), e;
|
|
290
306
|
case 31:
|
|
291
307
|
return e.categoryAxis = (B = e.categoryAxis) == null ? void 0 : B.map((r) => ({ ...r, labels: { ...r.labels, color: a } })), e;
|
|
292
308
|
case 32: {
|
|
293
|
-
const r =
|
|
309
|
+
const r = z(a) ? a : "auto";
|
|
294
310
|
return e.categoryAxis = (H = e.categoryAxis) == null ? void 0 : H.map((i) => ({ ...i, labels: { ...i.labels, rotation: r } })), e;
|
|
295
311
|
}
|
|
296
312
|
case 33:
|
|
@@ -300,31 +316,31 @@ const F = [
|
|
|
300
316
|
case 35:
|
|
301
317
|
return e.valueAxis = (X = e.valueAxis) == null ? void 0 : X.map((r) => {
|
|
302
318
|
var i;
|
|
303
|
-
return { ...r, title: { ...r.title, font:
|
|
319
|
+
return { ...r, title: { ...r.title, font: y(a, h[0].value, (i = r.title) == null ? void 0 : i.font) } };
|
|
304
320
|
}), e;
|
|
305
321
|
case 36:
|
|
306
322
|
return e.valueAxis = (Y = e.valueAxis) == null ? void 0 : Y.map((r) => {
|
|
307
323
|
var i;
|
|
308
|
-
return { ...r, title: { ...r.title, font: C(a,
|
|
324
|
+
return { ...r, title: { ...r.title, font: C(a, F[0].value, (i = r.title) == null ? void 0 : i.font) } };
|
|
309
325
|
}), e;
|
|
310
326
|
case 37:
|
|
311
327
|
return e.valueAxis = ($ = e.valueAxis) == null ? void 0 : $.map((r) => ({ ...r, title: { ...r.title, color: a } })), e;
|
|
312
328
|
case 38:
|
|
313
|
-
return e.valueAxis = (
|
|
329
|
+
return e.valueAxis = (W = e.valueAxis) == null ? void 0 : W.map((r) => ({ ...r, labels: { ...r.labels, format: a } })), e;
|
|
314
330
|
case 39:
|
|
315
|
-
return e.valueAxis = (
|
|
331
|
+
return e.valueAxis = (j = e.valueAxis) == null ? void 0 : j.map((r) => {
|
|
316
332
|
var i;
|
|
317
|
-
return { ...r, labels: { ...r.labels, font:
|
|
333
|
+
return { ...r, labels: { ...r.labels, font: y(a, h[0].value, (i = r.labels) == null ? void 0 : i.font) } };
|
|
318
334
|
}), e;
|
|
319
335
|
case 40:
|
|
320
336
|
return e.valueAxis = (q = e.valueAxis) == null ? void 0 : q.map((r) => {
|
|
321
337
|
var i;
|
|
322
|
-
return { ...r, labels: { ...r.labels, font: C(a,
|
|
338
|
+
return { ...r, labels: { ...r.labels, font: C(a, F[0].value, (i = r.labels) == null ? void 0 : i.font) } };
|
|
323
339
|
}), e;
|
|
324
340
|
case 41:
|
|
325
341
|
return e.valueAxis = (J = e.valueAxis) == null ? void 0 : J.map((r) => ({ ...r, labels: { ...r.labels, color: a } })), e;
|
|
326
342
|
case 42: {
|
|
327
|
-
const r =
|
|
343
|
+
const r = z(a) ? a : "auto";
|
|
328
344
|
return e.valueAxis = (K = e.valueAxis) == null ? void 0 : K.map((i) => ({ ...i, labels: { ...i.labels, rotation: r } })), e;
|
|
329
345
|
}
|
|
330
346
|
default:
|
|
@@ -332,13 +348,13 @@ const F = [
|
|
|
332
348
|
}
|
|
333
349
|
};
|
|
334
350
|
export {
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
351
|
+
oe as ActionTypes,
|
|
352
|
+
be as createInitialState,
|
|
353
|
+
ie as createState,
|
|
354
|
+
F as fontNames,
|
|
355
|
+
h as fontSizes,
|
|
356
|
+
S as isCategorical,
|
|
357
|
+
R as mergeStates,
|
|
342
358
|
ee as parseFont,
|
|
343
|
-
|
|
359
|
+
xe as updateState
|
|
344
360
|
};
|