sbwb-ds 2.3.2 → 2.3.4
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/sbwb-ds.js +37 -36
- package/dist/sbwb-ds.umd.cjs +1 -3
- package/dist/src/presentation/components/molecules/ChartRadar/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/presentation/components/atoms/Select/styles.ts +0 -1
- package/src/presentation/components/atoms/Tooltip/styles.ts +0 -1
- package/src/presentation/components/molecules/ChartRadar/ChartRadar.stories.tsx +26 -0
- package/src/presentation/components/molecules/ChartRadar/index.tsx +26 -20
package/dist/sbwb-ds.js
CHANGED
|
@@ -3607,7 +3607,6 @@ const j = Pe`
|
|
|
3607
3607
|
`};
|
|
3608
3608
|
`, U2e = X.div`
|
|
3609
3609
|
${j}
|
|
3610
|
-
position: relative;
|
|
3611
3610
|
width: ${({ wrapperWidth: e }) => e ?? "fit-content"};
|
|
3612
3611
|
height: ${({ wrapperHeight: e }) => e ?? "fit-content"};
|
|
3613
3612
|
|
|
@@ -6456,7 +6455,6 @@ const z3e = X.div`
|
|
|
6456
6455
|
display: flex;
|
|
6457
6456
|
flex: 1 1 0%;
|
|
6458
6457
|
flex-wrap: wrap;
|
|
6459
|
-
position: relative;
|
|
6460
6458
|
overflow: hidden;
|
|
6461
6459
|
min-height: 1em;
|
|
6462
6460
|
box-sizing: border-box;
|
|
@@ -82989,34 +82987,36 @@ const GFe = X.div`
|
|
|
82989
82987
|
animation: c = !0,
|
|
82990
82988
|
chartRenderer: u = "svg",
|
|
82991
82989
|
radius: d = i ? 155 : 140,
|
|
82992
|
-
|
|
82993
|
-
|
|
82994
|
-
|
|
82995
|
-
|
|
82996
|
-
|
|
82997
|
-
|
|
82990
|
+
showLegend: f = !0,
|
|
82991
|
+
customOption: h,
|
|
82992
|
+
radarColors: p,
|
|
82993
|
+
fontAxisSize: v = i ? 14 : 12,
|
|
82994
|
+
symbolSize: g = 12,
|
|
82995
|
+
legendBottom: m = i ? "350px" : "10px",
|
|
82996
|
+
legendLeft: y = i ? "500px" : "0"
|
|
82998
82997
|
}) => {
|
|
82999
|
-
|
|
82998
|
+
var H;
|
|
82999
|
+
const b = rt(null), x = rt(null), S = [
|
|
83000
83000
|
w.colors.auxiliariesColors.colorAuxOneDark,
|
|
83001
83001
|
w.colors.auxiliariesColors.colorAuxThreeLight,
|
|
83002
83002
|
w.colors.auxiliariesColors.colorAuxOneLight,
|
|
83003
83003
|
w.colors.auxiliariesColors.colorAuxTwoLight
|
|
83004
|
-
],
|
|
83004
|
+
], M = p && p.length > 0 ? p : S;
|
|
83005
83005
|
Ot(() => {
|
|
83006
|
-
if (
|
|
83007
|
-
const
|
|
83006
|
+
if (b.current && !x.current) {
|
|
83007
|
+
const D = $x(b.current, null, {
|
|
83008
83008
|
renderer: u,
|
|
83009
83009
|
width: o,
|
|
83010
83010
|
height: l
|
|
83011
|
-
}),
|
|
83011
|
+
}), T = {
|
|
83012
83012
|
tooltip: {
|
|
83013
83013
|
trigger: "item",
|
|
83014
|
-
formatter: function(
|
|
83014
|
+
formatter: function(N) {
|
|
83015
83015
|
return gge(
|
|
83016
83016
|
/* @__PURE__ */ $(
|
|
83017
83017
|
JFe,
|
|
83018
83018
|
{
|
|
83019
|
-
params:
|
|
83019
|
+
params: N,
|
|
83020
83020
|
radarIndicator: a
|
|
83021
83021
|
}
|
|
83022
83022
|
)
|
|
@@ -83033,7 +83033,7 @@ const GFe = X.div`
|
|
|
83033
83033
|
indicator: a,
|
|
83034
83034
|
axisName: {
|
|
83035
83035
|
color: w.colors.neutralColors.colorNeutralCloudy,
|
|
83036
|
-
fontSize:
|
|
83036
|
+
fontSize: v,
|
|
83037
83037
|
fontFamily: w.fonts.fontFamily.fontFamilyPrimary,
|
|
83038
83038
|
padding: [2, 2]
|
|
83039
83039
|
},
|
|
@@ -83062,8 +83062,8 @@ const GFe = X.div`
|
|
|
83062
83062
|
width: 2
|
|
83063
83063
|
},
|
|
83064
83064
|
data: t,
|
|
83065
|
-
symbolSize:
|
|
83066
|
-
color:
|
|
83065
|
+
symbolSize: g,
|
|
83066
|
+
color: M
|
|
83067
83067
|
},
|
|
83068
83068
|
{
|
|
83069
83069
|
name: "Max Points",
|
|
@@ -83082,20 +83082,20 @@ const GFe = X.div`
|
|
|
83082
83082
|
},
|
|
83083
83083
|
data: [
|
|
83084
83084
|
{
|
|
83085
|
-
value: a.map((
|
|
83085
|
+
value: a.map((N) => N.max),
|
|
83086
83086
|
name: "Max Point"
|
|
83087
83087
|
}
|
|
83088
83088
|
]
|
|
83089
83089
|
}
|
|
83090
83090
|
]
|
|
83091
|
-
},
|
|
83092
|
-
return
|
|
83093
|
-
|
|
83091
|
+
}, R = h ? { ...T, ...h } : T;
|
|
83092
|
+
return D.setOption(R), x.current = D, () => {
|
|
83093
|
+
x.current && (x.current.dispose(), x.current = null);
|
|
83094
83094
|
};
|
|
83095
83095
|
}
|
|
83096
83096
|
}, [
|
|
83097
83097
|
t,
|
|
83098
|
-
|
|
83098
|
+
h,
|
|
83099
83099
|
r,
|
|
83100
83100
|
a,
|
|
83101
83101
|
c,
|
|
@@ -83103,35 +83103,36 @@ const GFe = X.div`
|
|
|
83103
83103
|
u,
|
|
83104
83104
|
o,
|
|
83105
83105
|
l,
|
|
83106
|
-
|
|
83106
|
+
M
|
|
83107
83107
|
]);
|
|
83108
|
-
const
|
|
83109
|
-
|
|
83108
|
+
const L = (D) => {
|
|
83109
|
+
x.current && (x.current.dispatchAction({
|
|
83110
83110
|
type: "downplay",
|
|
83111
|
-
seriesName:
|
|
83112
|
-
}),
|
|
83111
|
+
seriesName: D
|
|
83112
|
+
}), x.current.dispatchAction({
|
|
83113
83113
|
type: "legendToggleSelect",
|
|
83114
|
-
name:
|
|
83114
|
+
name: D
|
|
83115
83115
|
}));
|
|
83116
83116
|
};
|
|
83117
|
-
return /* @__PURE__ */ $(GFe, { id: e, showDetails: n, ref:
|
|
83117
|
+
return /* @__PURE__ */ $(GFe, { id: e, showDetails: n, ref: b, children: !f || // @ts-ignore
|
|
83118
|
+
!((H = h == null ? void 0 : h.legend) != null && H.show) && /* @__PURE__ */ $(
|
|
83118
83119
|
UFe,
|
|
83119
83120
|
{
|
|
83120
83121
|
expanded: i,
|
|
83121
|
-
bottom:
|
|
83122
|
-
left:
|
|
83122
|
+
bottom: m,
|
|
83123
|
+
left: y,
|
|
83123
83124
|
children: /* @__PURE__ */ $(
|
|
83124
83125
|
Kz,
|
|
83125
83126
|
{
|
|
83126
|
-
legendData: t.map((
|
|
83127
|
-
myChart:
|
|
83128
|
-
lineColors:
|
|
83127
|
+
legendData: t.map((D) => ({ name: D.name })).filter((D) => D.name !== "Max Point"),
|
|
83128
|
+
myChart: x.current,
|
|
83129
|
+
lineColors: M,
|
|
83129
83130
|
scrollDirection: i ? "vertical" : "horizontal",
|
|
83130
83131
|
maxRows: i ? void 0 : 3,
|
|
83131
83132
|
maxColumns: i ? 1 : void 0,
|
|
83132
83133
|
width: "100%",
|
|
83133
83134
|
height: "auto",
|
|
83134
|
-
onClickLegend:
|
|
83135
|
+
onClickLegend: L,
|
|
83135
83136
|
...s
|
|
83136
83137
|
}
|
|
83137
83138
|
)
|
package/dist/sbwb-ds.umd.cjs
CHANGED
|
@@ -313,7 +313,6 @@ See https://s-c.sh/2BAXzed for more info.`),window["__styled-components-init__"]
|
|
|
313
313
|
`};
|
|
314
314
|
`,fG=X.div`
|
|
315
315
|
${j}
|
|
316
|
-
position: relative;
|
|
317
316
|
width: ${({wrapperWidth:e})=>e??"fit-content"};
|
|
318
317
|
height: ${({wrapperHeight:e})=>e??"fit-content"};
|
|
319
318
|
|
|
@@ -1501,7 +1500,6 @@ See https://s-c.sh/2BAXzed for more info.`),window["__styled-components-init__"]
|
|
|
1501
1500
|
display: flex;
|
|
1502
1501
|
flex: 1 1 0%;
|
|
1503
1502
|
flex-wrap: wrap;
|
|
1504
|
-
position: relative;
|
|
1505
1503
|
overflow: hidden;
|
|
1506
1504
|
min-height: 1em;
|
|
1507
1505
|
box-sizing: border-box;
|
|
@@ -5961,7 +5959,7 @@ echarts.use([`+F+"]);":"Unknown series "+P))}return}if(d==="tooltip"){if(S){proc
|
|
|
5961
5959
|
height: 8px;
|
|
5962
5960
|
background-color: ${({color:e})=>e};
|
|
5963
5961
|
border-radius: 50%;
|
|
5964
|
-
`,jz=({legendData:e,lineColors:t=[w.colors.auxiliariesColors.colorAuxOneDark,w.colors.auxiliariesColors.colorAuxOneLight,w.colors.auxiliariesColors.colorAuxTwoDark,w.colors.auxiliariesColors.colorAuxTwoLight,w.colors.auxiliariesColors.colorAuxThreeDark,w.colors.auxiliariesColors.colorAuxThreeLight,w.colors.auxiliariesColors.colorAuxFourDark,w.colors.auxiliariesColors.colorAuxFourLight,w.colors.auxiliariesColors.colorAuxFiveDark,w.colors.auxiliariesColors.colorAuxFiveLight],myChart:r,scrollDirection:n="horizontal",maxRows:a=3,maxColumns:i=1,width:o,height:l,onClickLegend:s,...c})=>{const[u,d]=oe.useState(e.reduce((h,p)=>({...h,[p.name]:!0}),{})),f=oe.useCallback((h,p)=>{s(h),d(g=>({...g,[h]:!g[h]}))},[s]);return R(RMe,{scrollDirection:n,maxRows:a,maxColumns:i,width:o,height:l,...c,children:e.map((h,p)=>{const g=u[h.name];return _e(FMe,{style:{opacity:g?1:.5},onClick:()=>f(h.name,p),children:[R(OMe,{color:g?t[p]||"#000":"#d3d3d3"}),R(NMe,{scrollDirection:n,style:{color:g?"#000":"#d3d3d3"},children:h.name})]},h.name)})})},BMe=({id:e,data:t,seriesName:r,showDetails:n=!0,radarIndicator:a,expanded:i=!1,chartWidth:o,chartHeight:l,legendProps:s,animation:c=!0,chartRenderer:u="svg",radius:d=i?155:140,
|
|
5962
|
+
`,jz=({legendData:e,lineColors:t=[w.colors.auxiliariesColors.colorAuxOneDark,w.colors.auxiliariesColors.colorAuxOneLight,w.colors.auxiliariesColors.colorAuxTwoDark,w.colors.auxiliariesColors.colorAuxTwoLight,w.colors.auxiliariesColors.colorAuxThreeDark,w.colors.auxiliariesColors.colorAuxThreeLight,w.colors.auxiliariesColors.colorAuxFourDark,w.colors.auxiliariesColors.colorAuxFourLight,w.colors.auxiliariesColors.colorAuxFiveDark,w.colors.auxiliariesColors.colorAuxFiveLight],myChart:r,scrollDirection:n="horizontal",maxRows:a=3,maxColumns:i=1,width:o,height:l,onClickLegend:s,...c})=>{const[u,d]=oe.useState(e.reduce((h,p)=>({...h,[p.name]:!0}),{})),f=oe.useCallback((h,p)=>{s(h),d(g=>({...g,[h]:!g[h]}))},[s]);return R(RMe,{scrollDirection:n,maxRows:a,maxColumns:i,width:o,height:l,...c,children:e.map((h,p)=>{const g=u[h.name];return _e(FMe,{style:{opacity:g?1:.5},onClick:()=>f(h.name,p),children:[R(OMe,{color:g?t[p]||"#000":"#d3d3d3"}),R(NMe,{scrollDirection:n,style:{color:g?"#000":"#d3d3d3"},children:h.name})]},h.name)})})},BMe=({id:e,data:t,seriesName:r,showDetails:n=!0,radarIndicator:a,expanded:i=!1,chartWidth:o,chartHeight:l,legendProps:s,animation:c=!0,chartRenderer:u="svg",radius:d=i?155:140,showLegend:f=!0,customOption:h,radarColors:p,fontAxisSize:g=i?14:12,symbolSize:C=12,legendBottom:m=i?"350px":"10px",legendLeft:y=i?"500px":"0"})=>{var D;const S=oe.useRef(null),b=oe.useRef(null),x=[w.colors.auxiliariesColors.colorAuxOneDark,w.colors.auxiliariesColors.colorAuxThreeLight,w.colors.auxiliariesColors.colorAuxOneLight,w.colors.auxiliariesColors.colorAuxTwoLight],_=p&&p.length>0?p:x;oe.useEffect(()=>{if(S.current&&!b.current){const H=Dy(S.current,null,{renderer:u,width:o,height:l}),T={tooltip:{trigger:"item",formatter:function(F){return J2e(R(PMe,{params:F,radarIndicator:a}))},borderColor:w.colors.neutralColors.colorNeutralLighest},legend:{show:!1},radar:{radius:d,indicator:a,axisName:{color:w.colors.neutralColors.colorNeutralCloudy,fontSize:g,fontFamily:w.fonts.fontFamily.fontFamilyPrimary,padding:[2,2]},splitLine:{lineStyle:{color:w.colors.neutralColors.colorNeutralCleanest}},axisLine:{lineStyle:{color:w.colors.neutralColors.colorNeutralCleanest}},shape:"polygon",splitArea:{show:!1},center:i?["38%","60%"]:["50%","50%"]},series:[{name:r,type:"radar",animation:c,lineStyle:{width:2},data:t,symbolSize:C,color:_},{name:"Max Points",type:"radar",tooltip:{show:!1},lineStyle:{width:0,opacity:0},symbol:"rect",symbolSize:8,itemStyle:{color:w.colors.neutralColors.colorNeutralSnow,borderColor:w.colors.neutralColors.colorNeutralCloudy,borderWidth:1,opacity:1},data:[{value:a.map(F=>F.max),name:"Max Point"}]}]},P=h?{...T,...h}:T;return H.setOption(P),b.current=H,()=>{b.current&&(b.current.dispose(),b.current=null)}}},[t,h,r,a,c,d,u,o,l,_]);const L=H=>{b.current&&(b.current.dispatchAction({type:"downplay",seriesName:H}),b.current.dispatchAction({type:"legendToggleSelect",name:H}))};return R(kMe,{id:e,showDetails:n,ref:S,children:!f||!((D=h==null?void 0:h.legend)!=null&&D.show)&&R(VMe,{expanded:i,bottom:m,left:y,children:R(jz,{legendData:t.map(H=>({name:H.name})).filter(H=>H.name!=="Max Point"),myChart:b.current,lineColors:_,scrollDirection:i?"vertical":"horizontal",maxRows:i?void 0:3,maxColumns:i?1:void 0,width:"100%",height:"auto",onClickLegend:L,...s})})})},ZMe=X.div`
|
|
5965
5963
|
${j}
|
|
5966
5964
|
position: relative;
|
|
5967
5965
|
width: 100%;
|
package/package.json
CHANGED
|
@@ -9,7 +9,6 @@ interface TooltipWrapperProps {
|
|
|
9
9
|
|
|
10
10
|
export const TooltipWrapper = styled.div<TooltipWrapperProps>`
|
|
11
11
|
${resetStyles}
|
|
12
|
-
position: relative;
|
|
13
12
|
width: ${({ wrapperWidth }) => wrapperWidth ?? 'fit-content'};
|
|
14
13
|
height: ${({ wrapperHeight }) => wrapperHeight ?? 'fit-content'};
|
|
15
14
|
|
|
@@ -169,6 +169,32 @@ const Template = (args) => {
|
|
|
169
169
|
expanded={expanded}
|
|
170
170
|
expandButton={() => setExpanded(!expanded)}
|
|
171
171
|
key={expanded ? 'expanded' : 'collapsed'}
|
|
172
|
+
// customOption={{
|
|
173
|
+
// legend: {
|
|
174
|
+
// show: true,
|
|
175
|
+
// icon: 'circle',
|
|
176
|
+
// data: data
|
|
177
|
+
// .map((item) => item.name)
|
|
178
|
+
// .filter((name) => name !== 'Max Point'),
|
|
179
|
+
// itemGap: 20,
|
|
180
|
+
// itemHeight: 8,
|
|
181
|
+
// itemWidth: 8,
|
|
182
|
+
// formatter: function (name) {
|
|
183
|
+
// return ' ' + name + ' ';
|
|
184
|
+
// },
|
|
185
|
+
// textStyle: {
|
|
186
|
+
// fontFamily: sg.fonts.fontFamily.fontFamilyPrimary,
|
|
187
|
+
// fontSize: 12,
|
|
188
|
+
// fontWeight: 400,
|
|
189
|
+
// lineHeight: 14,
|
|
190
|
+
// color: sg.colors.neutralColors.colorNeutralCloudy,
|
|
191
|
+
// },
|
|
192
|
+
// orient: 'vertical',
|
|
193
|
+
// bottom: 15,
|
|
194
|
+
// left: 0,
|
|
195
|
+
// height: 60,
|
|
196
|
+
// },
|
|
197
|
+
// }}
|
|
172
198
|
/>
|
|
173
199
|
|
|
174
200
|
<ChartInfo>
|
|
@@ -25,6 +25,7 @@ export interface ChartRadarElementProps {
|
|
|
25
25
|
legendBottom?: string;
|
|
26
26
|
legendLeft?: string;
|
|
27
27
|
legendProps?: ChartLegendsProps;
|
|
28
|
+
showLegend?: boolean;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export interface Indicator {
|
|
@@ -52,6 +53,7 @@ const RadarChart: React.FC<ChartRadarElementProps> = ({
|
|
|
52
53
|
animation = true,
|
|
53
54
|
chartRenderer = 'svg',
|
|
54
55
|
radius = expanded ? 155 : 140,
|
|
56
|
+
showLegend = true,
|
|
55
57
|
customOption,
|
|
56
58
|
radarColors,
|
|
57
59
|
fontAxisSize = expanded ? 14 : 12,
|
|
@@ -200,26 +202,30 @@ const RadarChart: React.FC<ChartRadarElementProps> = ({
|
|
|
200
202
|
|
|
201
203
|
return (
|
|
202
204
|
<C.RadarChart id={id} showDetails={showDetails} ref={chartRef}>
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
205
|
+
{!showLegend ||
|
|
206
|
+
// @ts-ignore
|
|
207
|
+
(!customOption?.legend?.show && (
|
|
208
|
+
<C.LegendsWrapper
|
|
209
|
+
expanded={expanded}
|
|
210
|
+
bottom={legendBottom}
|
|
211
|
+
left={legendLeft}
|
|
212
|
+
>
|
|
213
|
+
<ChartLegends
|
|
214
|
+
legendData={data
|
|
215
|
+
.map((item) => ({ name: item.name }))
|
|
216
|
+
.filter((item) => item.name !== 'Max Point')}
|
|
217
|
+
myChart={myChartRef.current}
|
|
218
|
+
lineColors={colors}
|
|
219
|
+
scrollDirection={expanded ? 'vertical' : 'horizontal'}
|
|
220
|
+
maxRows={expanded ? undefined : 3}
|
|
221
|
+
maxColumns={expanded ? 1 : undefined}
|
|
222
|
+
width="100%"
|
|
223
|
+
height="auto"
|
|
224
|
+
onClickLegend={dispatch}
|
|
225
|
+
{...legendProps}
|
|
226
|
+
/>
|
|
227
|
+
</C.LegendsWrapper>
|
|
228
|
+
))}
|
|
223
229
|
</C.RadarChart>
|
|
224
230
|
);
|
|
225
231
|
};
|