@carto/meridian-ds 1.3.2 → 1.3.3
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/CHANGELOG.md +4 -0
- package/dist/types/widgets/legend/LegendLayerTitle.d.ts +1 -3
- package/dist/types/widgets/legend/LegendLayerTitle.d.ts.map +1 -1
- package/dist/types/widgets/legend/legend-types/LegendIcon.d.ts.map +1 -1
- package/dist/widgets/index.cjs +1 -1
- package/dist/widgets/index.js +145 -160
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
## 1.0
|
|
6
6
|
|
|
7
|
+
### 1.3.3
|
|
8
|
+
|
|
9
|
+
- Update LegendLayerTitle to use Caption text variant [#121](https://github.com/CartoDB/meridian-ds/pull/121)
|
|
10
|
+
|
|
7
11
|
### 1.3.2
|
|
8
12
|
|
|
9
13
|
- Prevent LegendLayerTitle from being UPPERCASE [#118](https://github.com/CartoDB/meridian-ds/pull/118)
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { TypographyProps } from '../../components/atoms/Typography';
|
|
2
1
|
/** Renders the legend layer title with an optional tooltip if the title is detected to be too long. */
|
|
3
|
-
export default function LegendLayerTitle({ title, visible,
|
|
2
|
+
export default function LegendLayerTitle({ title, visible, }: {
|
|
4
3
|
title: string;
|
|
5
4
|
visible: boolean;
|
|
6
|
-
typographyProps?: TypographyProps;
|
|
7
5
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
6
|
//# sourceMappingURL=LegendLayerTitle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendLayerTitle.d.ts","sourceRoot":"","sources":["../../../../src/widgets/legend/LegendLayerTitle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LegendLayerTitle.d.ts","sourceRoot":"","sources":["../../../../src/widgets/legend/LegendLayerTitle.tsx"],"names":[],"mappings":"AAIA,uGAAuG;AACvG,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;CACjB,2CA+BA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendIcon.d.ts","sourceRoot":"","sources":["../../../../../src/widgets/legend/legend-types/LegendIcon.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAG9E,iBAAS,UAAU,CAAC,EAClB,MAAM,GACP,EAAE;IACD,MAAM,EAAE,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAC,GAAG,eAAe,CAAA;CAChE,
|
|
1
|
+
{"version":3,"file":"LegendIcon.d.ts","sourceRoot":"","sources":["../../../../../src/widgets/legend/legend-types/LegendIcon.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAA;AAG9E,iBAAS,UAAU,CAAC,EAClB,MAAM,GACP,EAAE;IACD,MAAM,EAAE,IAAI,CAAC,uBAAuB,EAAE,MAAM,CAAC,GAAG,eAAe,CAAA;CAChE,2CAmBA;AAED,eAAe,UAAU,CAAA"}
|
package/dist/widgets/index.cjs
CHANGED
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
<p style="${r}">${a.name}</p>
|
|
31
31
|
<p style="${s}">${String(l.marker)} ${c} (${g} %)</p>
|
|
32
32
|
`.trim()}const Or=e=>e,$r=()=>{},De=[],Rr="260px";function Fr({names:e=De,data:n=De,labels:i=De,colors:r=De,height:s=Rr,animation:l=!0,formatter:a=Or,tooltipFormatter:p=Nr,selectedCategories:c=[],onCategorySelected:g=$r,isLoading:h=!1}){const d=o.useTheme(),y=u.useRef(),f=u.useMemo(()=>n.map((b,S)=>Dr(b,r[S],i[S],d,c)),[n,r,i,d,c]),m=u.useMemo(()=>{const b=f.length>1;let S;p&&(S=E=>p(E,a,b));const k={trigger:"item",show:!0,backgroundColor:d.palette.black[90],textStyle:{color:d.palette.common.white},confine:!0,borderWidth:0,formatter:S},w={data:b?f.map((E,L)=>e[L]):(f[0]??[]).map(E=>E.name),selectedMode:!1,type:"scroll",left:j.SPACING,bottom:j.SPACING*-.5,itemGap:j.SPACING*3,icon:"circle",itemWidth:j.SPACING,itemHeight:j.SPACING,textStyle:{...d.typography.overline,color:d.palette.text.primary,fontWeight:400,lineHeight:1,verticalAlign:"bottom",padding:[0,0,0,j.SPACING*.5]},inactiveColor:d.palette.text.disabled,pageIcons:{horizontal:["path://M15.41 7.41 14 6 8 12 14 18 15.41 16.59 10.83 12z","path://M9 16.59 13.3265857 12 9 7.41 10.3319838 6 16 12 10.3319838 18z"]},pageIconSize:j.SPACING*1.5,pageIconColor:d.palette.text.secondary,pageIconInactiveColor:d.palette.text.disabled,pageTextStyle:{fontFamily:d.typography.overline.fontFamily,fontSize:j.SPACING*1.5,lineHeight:j.SPACING*1.75,fontWeight:400,color:d.palette.text.primary}},C={formatter:({name:E,percent:L})=>`{per|${a(L)}%}
|
|
33
|
-
{b|${E}}`,position:"center",rich:{b:{fontFamily:d.typography.overline.fontFamily,fontSize:j.SPACING*1.75,lineHeight:j.SPACING*1.75,fontWeight:400,color:d.palette.text.primary},per:{...d.typography.overline,fontSize:j.SPACING*3,lineHeight:j.SPACING*4.5,fontWeight:600,color:d.palette.text.primary}}},M=f.map((E,L)=>{var P;return{type:"pie",name:e[L],itemStyle:{color:(P=E[0])==null?void 0:P.color},animation:l,data:E.map(N=>({...N,itemStyle:{color:N.color}})),radius:L===0?["75%","90%"]:["56%","72%"],selectedOffset:0,hoverOffset:5,bottom:j.SPACING*2.5,avoidLabelOverlap:!0,label:{show:!1,...C},emphasis:{label:{show:!0,formatter:C.formatter,rich:C.rich}}}});return{grid:{left:0,top:0,right:0,bottom:0},tooltip:k,legend:w,series:M}},[d,e,l,f,a,p]),v={mouseover:(b,S)=>{f.length===1&&(b.seriesIndex!==0||b.dataIndex!==0)&&S.dispatchAction({type:"downplay",seriesIndex:0,dataIndex:0})},mouseout:(b,S)=>{f.length===1&&S.dispatchAction({type:"highlight",seriesIndex:0,dataIndex:0})},click:b=>{const k=f[b.seriesIndex][b.dataIndex].key,T=c.includes(k),w=new Set(c);T?w.delete(k):w.add(k);const C=f[0].length;let M=Array.from(w);M.length===C&&(M=[]),g(M)}};u.useEffect(()=>{y.current&&y.current.dispatchAction({type:f.length===1?"highlight":"downplay",seriesIndex:0,dataIndex:0})},[f]);function x(b){y.current=b}return f.length?h?t.jsx(Ft,{height:s}):t.jsx(ye,{onChartReady:x,notMerge:!0,option:m,onEvents:v,style:{maxHeight:s,width:"100%"}}):null}const Wr=()=>{};function nn({icon:e,hoverTooltip:n,clickTooltip:i,enabled:r,onEnabledChange:s=Wr,tooltipPlacement:l="bottom"}){const[a,p]=u.useState(!1),[c,g]=u.useState(r);u.useEffect(()=>{g(r)},[r]),u.useEffect(()=>{if(r){const d=y=>{y.key==="Escape"&&s&&s(!1)};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}}},[r,s]);const h=c?i:n;return t.jsx(o.ClickAwayListener,{onClickAway:()=>g(!1),children:t.jsx(o.Tooltip,{title:h,placement:l,open:a,onOpen:()=>p(!0),onClose:()=>{c||p(!1)},children:t.jsx(o.ToggleButton,{value:"selectedMode",selected:r,onClick:()=>s&&s(!r),children:e})})})}const _r=o.styled(o.IconButton,{shouldForwardProp:e=>e!=="isOpen"})(({isOpen:e,theme:n})=>({color:n.palette.text.secondary,width:n.spacing(3),transform:`rotate(${e?"180":"0"}deg)`,backgroundColor:e?n.palette.action.hover:void 0})),Gr=o.styled(o.MenuItem,{shouldForwardProp:e=>e!=="disabled"})(({disabled:e,theme:n})=>({...e&&{pointerEvents:"none",color:n.palette.text.disabled}})),zr=o.styled(o.MenuItem)(()=>({"&.Mui-disabled":{opacity:1}})),Hr=()=>{};function on({selectionModes:e,editModes:n,selectedMode:i,onSelectMode:r=Hr,enabled:s,tooltipPlacement:l="bottom",tooltipText:a="",menuHeaderText:p="",editDisabled:c}){const g=o.useTheme(),[h,d]=u.useState(null),y=!!h,f=k=>d(k.currentTarget),m=()=>d(null),v=k=>{r&&r(k),m()},x=!!e.length&&!!n.length,b=k=>n.some(T=>T.id===k.id);function S(k){return t.jsx(Gr,{selected:s&&i===k.id,onClick:()=>v(k.id),disabled:c&&b(k),children:t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[k.icon,t.jsx(o.Box,{ml:2,children:t.jsx(j.Typography,{variant:"body2",color:"inherit",children:o.capitalize(k.label)})})]})},k.id)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a,placement:l,children:t.jsx(_r,{id:"feature-selection-menu-button","aria-controls":"feature-selection-menu","aria-haspopup":"true","aria-expanded":y?"true":void 0,onClick:f,isOpen:y,children:t.jsx(ee.KeyboardArrowDown,{})})}),t.jsxs(o.Menu,{id:"feature-selection-menu",style:{zIndex:g.zIndex.tooltip+1},anchorEl:h,open:y,onClose:m,MenuListProps:{"aria-labelledby":"feature-selection-menu-button"},children:[p&&t.jsx(zr,{disabled:!0,children:t.jsx(j.Typography,{variant:"caption",color:"textSecondary",children:p})}),!!e.length&&e.map(S),x&&t.jsx(o.Divider,{sx:{margin:({spacing:k})=>k(1,0)}}),!!n.length&&n.map(S)]})]})}const Yr=o.styled(o.List)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(1.5),padding:e.spacing(.5),overflowX:"auto",maxWidth:"100%",scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}})),Vr=()=>{};function rn({features:e,onSelectGeometry:n=Vr,onDeleteGeometry:i,chipTooltip:r,disabledChipTooltip:s,size:l="medium",tooltipPlacement:a="bottom",chipLabel:p}){const c=Z.useIntl(),g=j.useImperativeIntl(c);function h(m){return m==="MultiPoint"?g.formatMessage({id:"c4r.widgets.featureSelection.point"}):m==="MultiLineString"?g.formatMessage({id:"c4r.widgets.featureSelection.lineString"}):m==="MultiPolygon"||m==="Polygon"||m==="GeometryCollection"?g.formatMessage({id:"c4r.widgets.featureSelection.polygon"}):m}function d(m,v){var b;const x=h(m.geometry.type);return p||((b=m.properties)==null?void 0:b.name)||`${x} ${v+1}`}const[y,f]=u.useState(!1);return t.jsx(o.Box,{sx:{overflowX:"auto"},children:t.jsx(Yr,{sx:{gap:l==="small"?.5:1},children:e.map((m,v)=>{var T,w;const x=(T=m.properties)==null?void 0:T.disabled,b=(w=m.properties)==null?void 0:w.invalid;let S=r;x&&(S=s||r),b&&(S=g.formatMessage({id:"c4r.widgets.featureSelection.invalid"})),y&&(S=g.formatMessage({id:"c4r.widgets.featureSelection.remove"}));let k="secondary";return x&&(k="default"),b&&(k="error"),t.jsx(o.ListItem,{disablePadding:!0,children:t.jsx(o.Tooltip,{disableHoverListener:x?!s:!r,title:S,placement:a,children:t.jsx(o.Chip,{size:l,label:d(m,v),color:k,onClick:()=>n(m),onDelete:i?()=>i(m):void 0,icon:b?t.jsx(ee.ErrorOutline,{color:"error"}):void 0,deleteIcon:t.jsx(ee.Cancel,{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1)})})})},v)})})})}const Ur=o.styled(o.Paper)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",maxHeight:e.spacing(5),padding:e.spacing(.5)})),qr=[];function Kr({selectionModes:e,editModes:n=qr,selectedMode:i,onSelectMode:r,enabled:s=!1,onEnabledChange:l,geometry:a,onSelectGeometry:p,onDeleteGeometry:c,tooltipPlacement:g="bottom",size:h="medium",chipLabel:d}){const y=Z.useIntl(),f=j.useImperativeIntl(y),m=u.useMemo(()=>e.map(T=>({...T,label:f.formatMessage({id:`c4r.widgets.featureSelection.${It(T.id)}`})})),[e,f]),v=u.useMemo(()=>n.map(T=>({...T,label:f.formatMessage({id:`c4r.widgets.featureSelection.${It(T.id)}`})})),[n,f]),x=u.useMemo(()=>{const w=[...m.map(C=>({...C,isEdit:!1})),...v.map(C=>({...C,isEdit:!0}))].find(C=>C.id===i);if(!w)throw new Error(`Selected mode "${i}" not supported`);return w},[v,m,i]),b=o.capitalize((x==null?void 0:x.label)||""),S=x!=null&&x.isEdit?b:f.formatMessage({id:"c4r.widgets.featureSelection.selectTool"},{label:b}),k=x!=null&&x.isEdit?f.formatMessage({id:"c4r.widgets.featureSelection.clickToEdit"}):f.formatMessage({id:"c4r.widgets.featureSelection.clickToCreate"});return t.jsxs(Ur,{children:[t.jsx(nn,{icon:x==null?void 0:x.icon,hoverTooltip:S,clickTooltip:k,enabled:s,onEnabledChange:l,tooltipPlacement:g}),t.jsx(on,{selectionModes:m,editModes:v,selectedMode:i,onSelectMode:r,enabled:s,tooltipPlacement:g,tooltipText:f.formatMessage({id:"c4r.widgets.featureSelection.selectMode"}),menuHeaderText:f.formatMessage({id:"c4r.widgets.featureSelection.chooseSelectionMode"}),editDisabled:!a}),!!a&&t.jsx(rn,{features:[a],onSelectGeometry:p,onDeleteGeometry:c,disabledChipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.applyMask"}),chipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.clearMask"}),tooltipPlacement:g,size:h,chipLabel:d})]})}function It(e){return e.charAt(0).toLowerCase()+e.slice(1)}const sn=240,Xr=o.styled(o.Paper,{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({width:n?"min-content":sn,background:e.palette.background.paper,maxHeight:"calc(100% - 120px)",display:"flex",flexDirection:"column"})),Zr=o.styled("header",{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(1),paddingLeft:e.spacing(2),borderBottom:n?void 0:`1px solid ${e.palette.divider}`})),Jr=o.styled("header")(({theme:e})=>({padding:e.spacing(1.5),paddingRight:e.spacing(2),gap:e.spacing(.5),display:"flex",justifyContent:"space-between",position:"sticky",zIndex:2,top:0,background:e.palette.background.paper})),Qr=o.styled("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",padding:e.spacing(1),minWidth:`calc(${sn}px - ${e.spacing(4)})`})),es=o.styled(o.TextField)(({theme:e})=>({display:"flex",width:e.spacing(7.5),flexShrink:0,"input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:0}})),ts=o.styled("ul",{shouldForwardProp:e=>e!=="opacity"})(({theme:e,opacity:n})=>({opacity:n,margin:0,padding:0,display:"flex",flexDirection:"column",gap:e.spacing(1)})),ln=o.styled("ul")(({theme:e})=>({margin:0,padding:0,paddingBottom:e.spacing(1),display:"flex",flexDirection:"column"})),ns=o.styled("li")(()=>({display:"flex",alignItems:"center"})),os=o.styled("div")(({theme:e})=>({marginRight:e.spacing(1.5),width:j.ICON_SIZE_MEDIUM,height:j.ICON_SIZE_MEDIUM,"& img":{margin:"auto",display:"block"}})),Tt=o.styled(o.Box,{shouldForwardProp:e=>e!=="width"})(({width:e,theme:n})=>({width:e,overflow:"auto",maxHeight:`calc(100% - ${n.spacing(1.5)})`})),is=o.styled("section")(({theme:e})=>({"&:not(:first-of-type)":{borderTop:`1px solid ${e.palette.divider}`}})),rs=o.styled("div")(()=>({flexGrow:1,flexShrink:1,minWidth:0}));function ss({menuRef:e,open:n,toggleOpen:i,opacity:r,onChange:s}){const l=Z.useIntl(),a=j.useImperativeIntl(l);function p(c){const g=parseInt(c.target.value||"0"),h=Math.min(Math.max(g,0),100);s(h/100)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a.formatMessage({id:"c4r.widgets.legend.opacity"}),children:t.jsx(o.IconButton,{size:"small",color:n?"primary":"default",onClick:()=>i(!n),children:t.jsx(Te.SwatchSquare,{})})}),t.jsx(o.Popover,{open:n,onClose:()=>i(!1),anchorEl:e.current,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{root:{sx:{transform:"translate(-12px, 36px)"}}},children:t.jsxs(Qr,{children:[t.jsx(o.Slider,{value:r*100,onChange:(c,g)=>s(g/100),min:0,max:100,step:1}),t.jsx(es,{size:"small",type:"number",value:Math.round(r*100),onChange:p,inputProps:{step:1,min:0,max:100,style:{appearance:"textfield"},"data-testid":"opacity-slider"},InputProps:{endAdornment:t.jsxs(o.InputAdornment,{position:"end",sx:{margin:0},children:[" ","%"]})}})]})})]})}function ot({title:e,visible:n,typographyProps:i}){const r=u.useRef(null),[s,l]=u.useState(!1);u.useLayoutEffect(()=>{if(n&&r.current){const{offsetWidth:p,scrollWidth:c}=r.current;l(p<c)}},[e,n]);const a=t.jsx(j.Typography,{ref:r,color:n?"textPrimary":"textSecondary",weight:"medium",component:"p",noWrap:!0,my:.25,textTransform:"none",...i,children:e});return s?t.jsx(o.Tooltip,{title:e,children:a}):a}var ce=(e=>(e.CATEGORY="category",e.ICON="icon",e.CONTINUOUS_RAMP="continuous_ramp",e.BINS="bins",e.PROPORTION="proportion",e))(ce||{});const qe=20;function an({legend:e}){const{labels:n=[],colors:i=[],isStrokeColor:r=!1,customMarkers:s,maskedMarkers:l=!0}=e,a=Me.getPalette(i,n.length),p=n.length>qe,c=Z.useIntl(),g=j.useImperativeIntl(c);return t.jsxs(t.Fragment,{children:[t.jsx(ln,{"data-testid":"categories-legend",children:n.slice(0,qe).map((h,d)=>t.jsx(ds,{label:String(h),color:a[d%a.length],icon:s&&Array.isArray(s)?s[d]:s,maskedIcon:l,isStrokeColor:r},`${h}${d}`))}),p&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",py:2,children:g.formatMessage({id:"c4r.widgets.legend.maxCategories"},{n:qe})})]})}const ls=({isMax:e,color:n,isStrokeColor:i,theme:r})=>({border:"2px solid transparent","&::after":{position:"absolute",display:e?"block":"none",content:'""',width:r.spacing(2),height:r.spacing(2),border:`2px solid ${r.palette.grey[900]}`,transform:"translate(-30%, -30%)",borderRadius:"50%",boxSizing:"content-box"},...i?{borderColor:n}:{backgroundColor:n}}),as=({icon:e,color:n,maskedIcon:i})=>({maskRepeat:"no-repeat",maskSize:"cover",backgroundRepeat:"no-repeat",backgroundSize:"cover",...i?{backgroundColor:n,maskImage:`url(${e})`,WebkitMaskImage:`url(${e})`}:{backgroundColor:"rgba(0,0,0,0)",backgroundImage:`url(${e})`}}),cs=o.styled(o.Box,{shouldForwardProp:e=>e!=="icon"&&e!=="maskedIcon"&&e!=="color"&&e!=="isStrokeColor"})(({icon:e,maskedIcon:n,color:i,isStrokeColor:r,theme:s})=>({whiteSpace:"nowrap",display:"block",width:s.spacing(1.5),height:s.spacing(1.5),flexShrink:"0",borderRadius:"50%",position:"relative",border:"2px solid transparent",...e?as({icon:e,color:i,maskedIcon:n}):ls({color:i,isStrokeColor:r,theme:s})}));function ds({label:e,isStrokeColor:n,color:i="#000",icon:r,maskedIcon:s}){return t.jsxs(o.Box,{component:"li",sx:{display:"flex",alignItems:"center"},children:[t.jsx(cs,{className:"marker",mr:1.5,component:"span",icon:r,maskedIcon:s,isStrokeColor:n,color:i}),t.jsx(ot,{title:e,visible:!0,typographyProps:{variant:"overline",my:.75}})]})}const Ne=6,We={0:12,1:9,2:6,3:3},us=o.styled(o.Box,{shouldForwardProp:e=>e!=="index"})(({index:e=0,theme:n})=>{const i=n.spacing(We[e]),r=n.spacing(We[e]);return{border:`solid 1px ${n.palette.divider}`,backgroundColor:n.palette.background.default,borderRadius:"50%",position:"absolute",right:0,bottom:0,width:i,height:r}}),ps=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",width:e(We[0]),height:e(We[0])})),gs=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",gap:e(1),alignItems:"stretch",justifyContent:"stretch",padding:e(2,0)})),hs=o.styled(o.Box)(()=>({display:"flex",flexDirection:"column",justifyContent:"space-around",gap:1,flexGrow:1,flexShrink:1}));function cn({legend:e}){const n=Z.useIntl(),i=j.useImperativeIntl(n),r=e.showMinMax??!0,{min:s,max:l,error:a}=fs(e),[p,c]=a?[0,0]:xs(s,l);return t.jsxs(gs,{"data-testid":"proportion-legend",children:[t.jsx(ps,{children:[...Array(4)].map((g,h)=>t.jsx(us,{index:h,component:"span"},h))}),t.jsx(hs,{children:a?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[r&&i.formatMessage({id:"c4r.widgets.legend.max"})+": ",n.formatNumber(l,{maximumSignificantDigits:Ne})]}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(c,{maximumSignificantDigits:Ne})}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(p,{maximumSignificantDigits:Ne})}),t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[r&&i.formatMessage({id:"c4r.widgets.legend.min"})+": ",n.formatNumber(s,{maximumSignificantDigits:Ne})]})]})})]})}function dn({labels:e}){let n=e==null?void 0:e[e.length-1],i=e==null?void 0:e[0];return Number.isFinite(i)||(i=parseInt(String(i),10)),Number.isFinite(n)||(n=parseInt(String(n),10)),[i,n]}function fs(e){let n=!1;const[i,r]=dn(e);return(Number.isNaN(i)||Number.isNaN(r))&&(n=!0),{min:i,max:r,error:n}}function xs(e,n){const i=(n-e)/3;return[e+i,n-i]}function un({legend:e}){const{labels:n=[],icons:i=[]}=e;return t.jsx(ln,{"data-testid":"icon-legend",children:n.map((r,s)=>t.jsxs(ns,{children:[t.jsx(os,{children:t.jsx("img",{src:i[s],alt:r,width:"auto",height:j.ICON_SIZE_MEDIUM})}),t.jsx(ot,{visible:!0,title:r,typographyProps:{variant:"overline",my:.75}})]},r))})}function ms(e){return typeof e[0]=="object"&&"label"in e[0]}function Qe({isContinuous:e=!1,legend:n}){const{labels:i=[],colors:r=[],showMinMax:s=!0}=n,l=Me.getPalette(r,!i.length||e?2:i.length+1),a=ms(i),p=a?i.map(({value:m})=>m):i,c=a?i.map(({label:m})=>m):i,[g,h]=dn({labels:p}),d=Number.isNaN(g)||Number.isNaN(h);let y=c[c.length-1],f=c[0];return!e&&s&&(f="< "+f,y="≥ "+y),t.jsx(o.Box,{py:2,"data-testid":"ramp-legend",children:d?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{display:"flex",pb:1,children:e?t.jsx(ys,{"data-testid":"step-continuous",palette:l}):t.jsx(js,{palette:l,labels:c,max:y,min:f})}),t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",children:[t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:f}),t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:y})]})]})})}const ys=o.styled(o.Box,{shouldForwardProp:e=>e!=="palette"})(({palette:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),borderRadius:n.spacing(.5),background:`linear-gradient(to right, ${e.join()})`})),vs=o.styled(o.Box,{shouldForwardProp:e=>e!=="color"})(({color:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),backgroundColor:e,"&:first-of-type":{borderRadius:n.spacing(.5,0,0,.5)},"&:last-of-type":{borderRadius:n.spacing(0,.5,.5,0)}}));function js({labels:e=[],palette:n=[],max:i,min:r}){const s=e.length?[r,...e]:[r,i];return t.jsx(t.Fragment,{children:s.map((l,a)=>{const p=a===0?r:a===s.length-1?i:`${l} - ${s[a+1]}`;return t.jsx(o.Tooltip,{title:p,children:t.jsx(vs,{"data-testid":"step-discontinuous",color:n[a]})},a)})})}const ws={[ce.CATEGORY]:an,[ce.PROPORTION]:cn,[ce.ICON]:un,[ce.BINS]:e=>t.jsx(Qe,{...e,isContinuous:!1}),[ce.CONTINUOUS_RAMP]:e=>t.jsx(Qe,{...e,isContinuous:!0})};function bs({legend:e}){const n=Z.useIntl(),i=j.useImperativeIntl(n);return e.select||!e.type?null:t.jsxs(j.Typography,{variant:"body2",color:"textSecondary",component:"p",children:[e.type," ",i.formatMessage({id:"c4r.widgets.legend.notSupported"}),"."]})}function Ss(e){return e.type===ce.PROPORTION?"c4r.widgets.legend.subtitles.proportion":e.type===ce.ICON||e.customMarkers?"c4r.widgets.legend.subtitles.icon":e.isStrokeColor?"c4r.widgets.legend.subtitles.strokeColor":"c4r.widgets.legend.subtitles.color"}function ks({layer:e,legend:n,customLegendTypes:i,onChangeSelection:r}){var h;const s=Z.useIntl(),l=j.useImperativeIntl(s),a=n.type,c=ws[a]??i[a]??bs,g=((h=n.select)==null?void 0:h.options)??[];return t.jsxs(o.Box,{component:"li","data-testid":"legend-layer-variable",px:2,children:[n.attr?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{gutterBottom:!0,variant:"overlineDelicate",color:"textSecondary",component:"p",children:l.formatMessage({id:Ss(n)})}),t.jsx(j.Typography,{variant:"caption",component:"p",children:n.attr})]}):null,n.select?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{variant:"caption",weight:"medium",component:"p",children:n.select.label}),t.jsx(o.Select,{"data-testid":"legend-layer-variable-select",name:"legend-select",value:n.select.value,renderValue:d=>{var y;return((y=g.find(f=>f.value===d))==null?void 0:y.label)??d},onChange:d=>r(d.target.value),MenuProps:{transformOrigin:{vertical:"bottom",horizontal:"left"},anchorOrigin:{vertical:"top",horizontal:"left"},PaperProps:{style:{maxHeight:240}}},children:g.map(d=>t.jsx(o.MenuItem,{value:d.value,children:t.jsx(o.ListItemText,{primary:d.label})},d.value))})]}):null,t.jsx(c,{layer:e,legend:n})]})}const Is={};function pn(e){return e?Array.isArray(e)?e.every(n=>pn(n)):!e.select&&!e.type:!0}function Mt({customLegendTypes:e=Is,layer:n,onChangeCollapsed:i,onChangeOpacity:r,onChangeVisibility:s,onChangeSelection:l,maxZoom:a=21,minZoom:p=0,currentZoom:c=0}){const g=Z.useIntl(),h=j.useImperativeIntl(g),d=u.useRef(null),[y,f]=u.useState(!1),m=n.id,v=n.title,x=n.visible??!0,b=n.switchable??!0,S=n.collapsed??!1,k=(n.collapsible??!0)&&!pn(n.legend),T=n.opacity??1,w=n.showOpacityControl??!0,C=x&&!S,M=C?t.jsx(ee.ExpandLess,{}):t.jsx(ee.ExpandMore,{}),D=(n==null?void 0:n.minZoom)!==void 0||(n==null?void 0:n.maxZoom)!==void 0,E=n.minZoom??p,L=n.maxZoom??a,P=D&&(E>p||L<a),N=c<E||c>L,V=Ts({intl:h,minZoom:p,maxZoom:a,layerMinZoom:E,layerMaxZoom:L}),_=n.helperText??(P?V:""),A=u.useMemo(()=>n.legend?Array.isArray(n.legend)?n.legend:[n.legend]:[],[n.legend]);return n.legend?t.jsxs(is,{"data-testid":"legend-layer","aria-label":v,children:[t.jsxs(Jr,{ref:d,children:[k&&t.jsx(o.IconButton,{size:"small","aria-label":h.formatMessage({id:S?"c4r.widgets.legend.expand":"c4r.widgets.legend.collapse"}),disabled:!x,onClick:()=>i({id:m,collapsed:!S}),children:M}),t.jsxs(rs,{children:[t.jsx(ot,{visible:x,title:v??""}),P&&t.jsx(o.Tooltip,{title:h.formatMessage({id:"c4r.widgets.legend.zoomLevelTooltip"}),children:t.jsxs(j.Typography,{color:x?"textPrimary":"textSecondary",variant:"caption",component:"p",children:[h.formatMessage({id:"c4r.widgets.legend.zoomLevel"})," ",n.minZoom," - ",n.maxZoom]})})]}),w&&x&&!S&&t.jsx(ss,{menuRef:d,open:y,toggleOpen:f,opacity:T,onChange:$=>r({id:m,opacity:$})}),b&&t.jsx(o.Tooltip,{title:h.formatMessage({id:x?"c4r.widgets.legend.hideLayer":"c4r.widgets.legend.showLayer"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>s({id:m,collapsed:x?S:!1,visible:!x}),children:x?t.jsx(ee.VisibilityOutlined,{}):t.jsx(ee.VisibilityOffOutlined,{})})})]}),t.jsxs(o.Collapse,{unmountOnExit:!0,timeout:100,in:C,children:[t.jsx(ts,{"data-testid":"legend-layer-variable-list",opacity:N?.5:1,children:A.map(($,I)=>t.jsx(ks,{legend:$,layer:n,customLegendTypes:e,onChangeSelection:O=>l({id:m,index:I,selection:O})},`${$.type}-${I}`))}),_&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",p:2,children:t.jsx("div",{dangerouslySetInnerHTML:{__html:_}})})]})]}):null}function Ts({intl:e,minZoom:n,maxZoom:i,layerMinZoom:r,layerMaxZoom:s}){const l=e.formatMessage({id:"c4r.widgets.legend.and"}),a=e.formatMessage({id:"c4r.widgets.legend.lowerThan"}),p=e.formatMessage({id:"c4r.widgets.legend.greaterThan"}),c=e.formatMessage({id:"c4r.widgets.legend.zoomNote"}),g=s<i?`${a} ${s}`:"",h=r>n?`${p} ${r}`:"",d=[g,h].filter(Boolean).join(` ${l} `);return d?`${c} ${d}`:""}const Ms={},Ie=()=>{},Cs=[];function As({customLegendTypes:e=Ms,layers:n=Cs,collapsed:i=!1,onChangeCollapsed:r=Ie,onChangeVisibility:s=Ie,onChangeOpacity:l=Ie,onChangeLegendRowCollapsed:a=Ie,onChangeSelection:p=Ie,title:c="Layers",maxZoom:g=20,minZoom:h=0,currentZoom:d,isMobile:y,sx:f}){const m=Z.useIntl(),v=j.useImperativeIntl(m),x=t.jsxs(Zr,{collapsed:i,children:[t.jsx(j.Typography,{variant:"caption",flexGrow:1,children:c}),t.jsx(o.Tooltip,{title:v.formatMessage({id:"c4r.widgets.legend.close"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>r(!0),children:t.jsx(ee.Close,{})})})]}),b=t.jsx(o.Tooltip,{title:v.formatMessage({id:"c4r.widgets.legend.open"}),children:t.jsx(o.IconButton,{"aria-label":c,onClick:()=>r(!1),children:t.jsx(ee.LayersOutlined,{})})});return t.jsx(Xr,{sx:f,elevation:3,collapsed:i||!!y,children:y?t.jsxs(t.Fragment,{children:[b,t.jsxs(o.Drawer,{anchor:"bottom",open:!i,onClose:()=>r(!0),children:[x,t.jsx(Tt,{children:n.map(S=>t.jsx(Mt,{layer:S,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},S.id))})]})]}):t.jsxs(t.Fragment,{children:[i?b:x,t.jsx(Tt,{width:i?0:void 0,children:t.jsx(o.Collapse,{unmountOnExit:!0,in:!i,timeout:500,children:n.map(S=>t.jsx(Mt,{layer:S,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},S.id))})})]})})}function Ct({color:e=void 0,children:n}){return n?t.jsx(o.Box,{mt:.5,children:t.jsx(j.Typography,{component:"div",variant:"caption",color:e??"inherit",style:{fontWeight:"normal"},children:n})}):t.jsx(o.Box,{mt:-1})}function Es({title:e="No data available",body:n="There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust the Map View.",severity:i=void 0,...r}){return i?t.jsx(bn.Alert,{title:e,severity:i,...r,children:t.jsx(Ct,{children:n})}):t.jsxs(o.Box,{...r,children:[e&&t.jsx(j.Typography,{variant:"body2",children:e}),t.jsx(Ct,{color:"textSecondary",children:n})]})}const Bs=o.styled(o.Box,{shouldForwardProp:e=>e!=="margin"})(({theme:e,margin:n})=>({margin:0,position:"relative",maxWidth:"100%",padding:n??e.spacing(2,2.5)})),Ps=o.styled(o.LinearProgress)(({theme:e})=>({position:"absolute",top:0,left:0,width:"100%",height:e.spacing(.25)})),Ls=o.styled(o.Grid,{shouldForwardProp:e=>e!=="expanded"})(({theme:e,expanded:n=!0})=>({display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",width:"100%",...n?{minHeight:e.spacing(3)}:{height:e.spacing(3)},padding:0})),Ds=o.styled(o.Button,{shouldForwardProp:e=>e!=="expandable"})(({theme:e,expandable:n=!0})=>({flex:1,padding:0,alignItems:"flex-start",justifyContent:"flex-start",height:"auto",minHeight:"auto",marginBottom:e.spacing(1),cursor:n?"pointer":"default","& .MuiButton-startIcon":{marginTop:"3px",marginRight:e.spacing(1)},"&:hover":{background:"none"}})),gn=({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:e.spacing(3),height:e.spacing(3),color:e.palette.text.secondary}),Ns=o.styled(ee.ExpandLess)(({theme:e})=>gn({theme:e})),Os=o.styled(ee.ExpandMore)(({theme:e})=>gn({theme:e})),$s=o.styled(o.Typography,{shouldForwardProp:e=>e!=="expanded"})(({expanded:e=!0})=>({wordBreak:"break-word",overflow:"hidden",...e&&{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},...!e&&{whiteSpace:"nowrap",textOverflow:"ellipsis"}})),Rs=o.styled(o.Grid)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),marginRight:e.spacing(-.5),marginLeft:e.spacing(1)})),At=o.styled(o.IconButton)(({theme:e})=>({color:e.palette.text.secondary})),Fs=o.styled(o.Menu)(({theme:e})=>({".MuiPaper-root":{marginTop:e.spacing(5),maxHeight:e.spacing(21),minWidth:e.spacing(16)}})),Et=[],Ws=t.jsx(ee.MoreVert,{});function _s({title:e,actions:n=Et,options:i=Et,optionsIcon:r=Ws,children:s,contentProps:l,disabled:a=!1,expandable:p=!0,expanded:c=!0,onExpandedChange:g,footer:h,headerItems:d,isLoading:y=!1,margin:f}){const m=u.createRef(),[v,x]=u.useState(!0),b=c!==void 0&&g!==void 0,S=p!==!1?b?c:v:!0,k=b?g:x,[T,w]=u.useState(null),C=!!T,M=()=>{p&&k(!S)},D=N=>w(N.currentTarget),E=()=>w(null);function L(N){N&&N(),E()}const P=N=>t.jsx(At,{"aria-label":N.label,onClick:N.action,size:"small",children:N.icon},N.id);return a?s?t.jsx(t.Fragment,{children:s}):null:t.jsxs(Bs,{margin:f,component:"section","aria-label":e,children:[y?t.jsx(Ps,{}):null,t.jsxs(Ls,{container:!0,expanded:c,children:[t.jsx(Ds,{expandable:p,startIcon:p&&t.jsx(o.Icon,{children:S?t.jsx(Ns,{}):t.jsx(Os,{})}),onClick:M,tabIndex:p?0:-1,children:t.jsx(o.Tooltip,{title:e,children:t.jsx($s,{expanded:c,align:"left",variant:"subtitle1",children:e})})}),t.jsxs(Rs,{item:!0,children:[d,n.length>0&&n.map(N=>N.tooltip?t.jsx(o.Tooltip,{title:N.tooltip.text,placement:N.tooltip.placement??"top",children:P(N)},N.id):P(N)),i.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(At,{"aria-label":"options","aria-controls":"options-menu","aria-haspopup":"true",onClick:D,size:"small",children:r}),t.jsx(Fs,{id:"options-menu",elevation:8,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:T,keepMounted:!0,open:C,onClose:E,children:i.map(N=>t.jsx(o.MenuItem,{selected:N.selected,onClick:()=>L(N.action),children:N.name},N.id))})]})]})]}),t.jsx(o.Collapse,{ref:m,in:S,timeout:"auto",unmountOnExit:!0,children:t.jsxs(o.Box,{...l,children:[t.jsx(o.Box,{pt:1,children:s}),h??t.jsx(o.Box,{children:h})]})})]})}exports.BarWidgetUI=Dn;exports.CategoryWidgetUI=Vn;exports.ComparativeCategoryWidgetUI=Sr;exports.ComparativeFormulaWidgetUI=Pr;exports.ComparativePieWidgetUI=Fr;exports.FeatureSelectionUIDropdown=on;exports.FeatureSelectionUIGeometryChips=rn;exports.FeatureSelectionUIToggleButton=nn;exports.FeatureSelectionWidgetUI=Kr;exports.FormulaWidgetUI=Xn;exports.GroupDateTypes=ae;exports.HistogramWidgetUI=ro;exports.LEGEND_TYPES=ce;exports.LegendCategories=an;exports.LegendIcon=un;exports.LegendProportion=cn;exports.LegendRamp=Qe;exports.LegendWidgetUI=As;exports.NoDataAlert=Es;exports.PieWidgetUI=Do;exports.RangeWidgetUI=Ho;exports.ScatterPlotWidgetUI=Qo;exports.TIME_SERIES_CHART_TYPES=Ge;exports.TableWidgetUI=di;exports.TimeSeriesProvider=Yt;exports.TimeSeriesWidgetUI=tr;exports.WrapperWidgetUI=_s;exports.useTimeSeriesContext=ze;exports.useTimeSeriesInteractivity=Vt;
|
|
33
|
+
{b|${E}}`,position:"center",rich:{b:{fontFamily:d.typography.overline.fontFamily,fontSize:j.SPACING*1.75,lineHeight:j.SPACING*1.75,fontWeight:400,color:d.palette.text.primary},per:{...d.typography.overline,fontSize:j.SPACING*3,lineHeight:j.SPACING*4.5,fontWeight:600,color:d.palette.text.primary}}},M=f.map((E,L)=>{var P;return{type:"pie",name:e[L],itemStyle:{color:(P=E[0])==null?void 0:P.color},animation:l,data:E.map(N=>({...N,itemStyle:{color:N.color}})),radius:L===0?["75%","90%"]:["56%","72%"],selectedOffset:0,hoverOffset:5,bottom:j.SPACING*2.5,avoidLabelOverlap:!0,label:{show:!1,...C},emphasis:{label:{show:!0,formatter:C.formatter,rich:C.rich}}}});return{grid:{left:0,top:0,right:0,bottom:0},tooltip:k,legend:w,series:M}},[d,e,l,f,a,p]),v={mouseover:(b,S)=>{f.length===1&&(b.seriesIndex!==0||b.dataIndex!==0)&&S.dispatchAction({type:"downplay",seriesIndex:0,dataIndex:0})},mouseout:(b,S)=>{f.length===1&&S.dispatchAction({type:"highlight",seriesIndex:0,dataIndex:0})},click:b=>{const k=f[b.seriesIndex][b.dataIndex].key,T=c.includes(k),w=new Set(c);T?w.delete(k):w.add(k);const C=f[0].length;let M=Array.from(w);M.length===C&&(M=[]),g(M)}};u.useEffect(()=>{y.current&&y.current.dispatchAction({type:f.length===1?"highlight":"downplay",seriesIndex:0,dataIndex:0})},[f]);function x(b){y.current=b}return f.length?h?t.jsx(Ft,{height:s}):t.jsx(ye,{onChartReady:x,notMerge:!0,option:m,onEvents:v,style:{maxHeight:s,width:"100%"}}):null}const Wr=()=>{};function nn({icon:e,hoverTooltip:n,clickTooltip:i,enabled:r,onEnabledChange:s=Wr,tooltipPlacement:l="bottom"}){const[a,p]=u.useState(!1),[c,g]=u.useState(r);u.useEffect(()=>{g(r)},[r]),u.useEffect(()=>{if(r){const d=y=>{y.key==="Escape"&&s&&s(!1)};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d)}}},[r,s]);const h=c?i:n;return t.jsx(o.ClickAwayListener,{onClickAway:()=>g(!1),children:t.jsx(o.Tooltip,{title:h,placement:l,open:a,onOpen:()=>p(!0),onClose:()=>{c||p(!1)},children:t.jsx(o.ToggleButton,{value:"selectedMode",selected:r,onClick:()=>s&&s(!r),children:e})})})}const _r=o.styled(o.IconButton,{shouldForwardProp:e=>e!=="isOpen"})(({isOpen:e,theme:n})=>({color:n.palette.text.secondary,width:n.spacing(3),transform:`rotate(${e?"180":"0"}deg)`,backgroundColor:e?n.palette.action.hover:void 0})),Gr=o.styled(o.MenuItem,{shouldForwardProp:e=>e!=="disabled"})(({disabled:e,theme:n})=>({...e&&{pointerEvents:"none",color:n.palette.text.disabled}})),zr=o.styled(o.MenuItem)(()=>({"&.Mui-disabled":{opacity:1}})),Hr=()=>{};function on({selectionModes:e,editModes:n,selectedMode:i,onSelectMode:r=Hr,enabled:s,tooltipPlacement:l="bottom",tooltipText:a="",menuHeaderText:p="",editDisabled:c}){const g=o.useTheme(),[h,d]=u.useState(null),y=!!h,f=k=>d(k.currentTarget),m=()=>d(null),v=k=>{r&&r(k),m()},x=!!e.length&&!!n.length,b=k=>n.some(T=>T.id===k.id);function S(k){return t.jsx(Gr,{selected:s&&i===k.id,onClick:()=>v(k.id),disabled:c&&b(k),children:t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[k.icon,t.jsx(o.Box,{ml:2,children:t.jsx(j.Typography,{variant:"body2",color:"inherit",children:o.capitalize(k.label)})})]})},k.id)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a,placement:l,children:t.jsx(_r,{id:"feature-selection-menu-button","aria-controls":"feature-selection-menu","aria-haspopup":"true","aria-expanded":y?"true":void 0,onClick:f,isOpen:y,children:t.jsx(ee.KeyboardArrowDown,{})})}),t.jsxs(o.Menu,{id:"feature-selection-menu",style:{zIndex:g.zIndex.tooltip+1},anchorEl:h,open:y,onClose:m,MenuListProps:{"aria-labelledby":"feature-selection-menu-button"},children:[p&&t.jsx(zr,{disabled:!0,children:t.jsx(j.Typography,{variant:"caption",color:"textSecondary",children:p})}),!!e.length&&e.map(S),x&&t.jsx(o.Divider,{sx:{margin:({spacing:k})=>k(1,0)}}),!!n.length&&n.map(S)]})]})}const Yr=o.styled(o.List)(({theme:e})=>({display:"flex",alignItems:"center",marginLeft:e.spacing(1.5),padding:e.spacing(.5),overflowX:"auto",maxWidth:"100%",scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}})),Vr=()=>{};function rn({features:e,onSelectGeometry:n=Vr,onDeleteGeometry:i,chipTooltip:r,disabledChipTooltip:s,size:l="medium",tooltipPlacement:a="bottom",chipLabel:p}){const c=Z.useIntl(),g=j.useImperativeIntl(c);function h(m){return m==="MultiPoint"?g.formatMessage({id:"c4r.widgets.featureSelection.point"}):m==="MultiLineString"?g.formatMessage({id:"c4r.widgets.featureSelection.lineString"}):m==="MultiPolygon"||m==="Polygon"||m==="GeometryCollection"?g.formatMessage({id:"c4r.widgets.featureSelection.polygon"}):m}function d(m,v){var b;const x=h(m.geometry.type);return p||((b=m.properties)==null?void 0:b.name)||`${x} ${v+1}`}const[y,f]=u.useState(!1);return t.jsx(o.Box,{sx:{overflowX:"auto"},children:t.jsx(Yr,{sx:{gap:l==="small"?.5:1},children:e.map((m,v)=>{var T,w;const x=(T=m.properties)==null?void 0:T.disabled,b=(w=m.properties)==null?void 0:w.invalid;let S=r;x&&(S=s||r),b&&(S=g.formatMessage({id:"c4r.widgets.featureSelection.invalid"})),y&&(S=g.formatMessage({id:"c4r.widgets.featureSelection.remove"}));let k="secondary";return x&&(k="default"),b&&(k="error"),t.jsx(o.ListItem,{disablePadding:!0,children:t.jsx(o.Tooltip,{disableHoverListener:x?!s:!r,title:S,placement:a,children:t.jsx(o.Chip,{size:l,label:d(m,v),color:k,onClick:()=>n(m),onDelete:i?()=>i(m):void 0,icon:b?t.jsx(ee.ErrorOutline,{color:"error"}):void 0,deleteIcon:t.jsx(ee.Cancel,{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1)})})})},v)})})})}const Ur=o.styled(o.Paper)(({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"space-between",maxHeight:e.spacing(5),padding:e.spacing(.5)})),qr=[];function Kr({selectionModes:e,editModes:n=qr,selectedMode:i,onSelectMode:r,enabled:s=!1,onEnabledChange:l,geometry:a,onSelectGeometry:p,onDeleteGeometry:c,tooltipPlacement:g="bottom",size:h="medium",chipLabel:d}){const y=Z.useIntl(),f=j.useImperativeIntl(y),m=u.useMemo(()=>e.map(T=>({...T,label:f.formatMessage({id:`c4r.widgets.featureSelection.${It(T.id)}`})})),[e,f]),v=u.useMemo(()=>n.map(T=>({...T,label:f.formatMessage({id:`c4r.widgets.featureSelection.${It(T.id)}`})})),[n,f]),x=u.useMemo(()=>{const w=[...m.map(C=>({...C,isEdit:!1})),...v.map(C=>({...C,isEdit:!0}))].find(C=>C.id===i);if(!w)throw new Error(`Selected mode "${i}" not supported`);return w},[v,m,i]),b=o.capitalize((x==null?void 0:x.label)||""),S=x!=null&&x.isEdit?b:f.formatMessage({id:"c4r.widgets.featureSelection.selectTool"},{label:b}),k=x!=null&&x.isEdit?f.formatMessage({id:"c4r.widgets.featureSelection.clickToEdit"}):f.formatMessage({id:"c4r.widgets.featureSelection.clickToCreate"});return t.jsxs(Ur,{children:[t.jsx(nn,{icon:x==null?void 0:x.icon,hoverTooltip:S,clickTooltip:k,enabled:s,onEnabledChange:l,tooltipPlacement:g}),t.jsx(on,{selectionModes:m,editModes:v,selectedMode:i,onSelectMode:r,enabled:s,tooltipPlacement:g,tooltipText:f.formatMessage({id:"c4r.widgets.featureSelection.selectMode"}),menuHeaderText:f.formatMessage({id:"c4r.widgets.featureSelection.chooseSelectionMode"}),editDisabled:!a}),!!a&&t.jsx(rn,{features:[a],onSelectGeometry:p,onDeleteGeometry:c,disabledChipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.applyMask"}),chipTooltip:f.formatMessage({id:"c4r.widgets.featureSelection.clearMask"}),tooltipPlacement:g,size:h,chipLabel:d})]})}function It(e){return e.charAt(0).toLowerCase()+e.slice(1)}const sn=240,Xr=o.styled(o.Paper,{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({width:n?"min-content":sn,background:e.palette.background.paper,maxHeight:"calc(100% - 120px)",display:"flex",flexDirection:"column"})),Zr=o.styled("header",{shouldForwardProp:e=>e!=="collapsed"})(({theme:e,collapsed:n})=>({display:"flex",alignItems:"center",justifyContent:"space-between",padding:e.spacing(1),paddingLeft:e.spacing(2),borderBottom:n?void 0:`1px solid ${e.palette.divider}`})),Jr=o.styled("header")(({theme:e})=>({padding:e.spacing(1.5),paddingRight:e.spacing(2),gap:e.spacing(.5),display:"flex",justifyContent:"space-between",position:"sticky",zIndex:2,top:0,background:e.palette.background.paper})),Qr=o.styled("div")(({theme:e})=>({display:"flex",gap:e.spacing(2),alignItems:"center",padding:e.spacing(1),minWidth:`calc(${sn}px - ${e.spacing(4)})`})),es=o.styled(o.TextField)(({theme:e})=>({display:"flex",width:e.spacing(7.5),flexShrink:0,"input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button":{WebkitAppearance:"none",margin:0}})),ts=o.styled("ul",{shouldForwardProp:e=>e!=="opacity"})(({theme:e,opacity:n})=>({opacity:n,margin:0,padding:0,display:"flex",flexDirection:"column",gap:e.spacing(1)})),ln=o.styled("ul")(({theme:e})=>({margin:0,padding:0,paddingBottom:e.spacing(1),display:"flex",flexDirection:"column"})),ns=o.styled("li")(()=>({display:"flex",alignItems:"center"})),os=o.styled("div")(({theme:e})=>({marginRight:e.spacing(1.5),width:j.ICON_SIZE_MEDIUM,height:j.ICON_SIZE_MEDIUM,"& img":{margin:"auto",display:"block"}})),Tt=o.styled(o.Box,{shouldForwardProp:e=>e!=="width"})(({width:e,theme:n})=>({width:e,overflow:"auto",maxHeight:`calc(100% - ${n.spacing(1.5)})`})),is=o.styled("section")(({theme:e})=>({"&:not(:first-of-type)":{borderTop:`1px solid ${e.palette.divider}`}})),rs=o.styled("div")(()=>({flexGrow:1,flexShrink:1,minWidth:0}));function ss({menuRef:e,open:n,toggleOpen:i,opacity:r,onChange:s}){const l=Z.useIntl(),a=j.useImperativeIntl(l);function p(c){const g=parseInt(c.target.value||"0"),h=Math.min(Math.max(g,0),100);s(h/100)}return t.jsxs(t.Fragment,{children:[t.jsx(o.Tooltip,{title:a.formatMessage({id:"c4r.widgets.legend.opacity"}),children:t.jsx(o.IconButton,{size:"small",color:n?"primary":"default",onClick:()=>i(!n),children:t.jsx(Te.SwatchSquare,{})})}),t.jsx(o.Popover,{open:n,onClose:()=>i(!1),anchorEl:e.current,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{root:{sx:{transform:"translate(-12px, 36px)"}}},children:t.jsxs(Qr,{children:[t.jsx(o.Slider,{value:r*100,onChange:(c,g)=>s(g/100),min:0,max:100,step:1}),t.jsx(es,{size:"small",type:"number",value:Math.round(r*100),onChange:p,inputProps:{step:1,min:0,max:100,style:{appearance:"textfield"},"data-testid":"opacity-slider"},InputProps:{endAdornment:t.jsxs(o.InputAdornment,{position:"end",sx:{margin:0},children:[" ","%"]})}})]})})]})}function ot({title:e,visible:n}){const i=u.useRef(null),[r,s]=u.useState(!1);u.useLayoutEffect(()=>{if(n&&i.current){const{offsetWidth:a,scrollWidth:p}=i.current;s(a<p)}},[e,n]);const l=t.jsx(j.Typography,{ref:i,color:n?"textPrimary":"textSecondary",variant:"caption",weight:"regular",component:"p",noWrap:!0,my:.25,textTransform:"none",children:e});return r?t.jsx(o.Tooltip,{title:e,children:l}):l}var ce=(e=>(e.CATEGORY="category",e.ICON="icon",e.CONTINUOUS_RAMP="continuous_ramp",e.BINS="bins",e.PROPORTION="proportion",e))(ce||{});const qe=20;function an({legend:e}){const{labels:n=[],colors:i=[],isStrokeColor:r=!1,customMarkers:s,maskedMarkers:l=!0}=e,a=Me.getPalette(i,n.length),p=n.length>qe,c=Z.useIntl(),g=j.useImperativeIntl(c);return t.jsxs(t.Fragment,{children:[t.jsx(ln,{"data-testid":"categories-legend",children:n.slice(0,qe).map((h,d)=>t.jsx(ds,{label:String(h),color:a[d%a.length],icon:s&&Array.isArray(s)?s[d]:s,maskedIcon:l,isStrokeColor:r},`${h}${d}`))}),p&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",py:2,children:g.formatMessage({id:"c4r.widgets.legend.maxCategories"},{n:qe})})]})}const ls=({isMax:e,color:n,isStrokeColor:i,theme:r})=>({border:"2px solid transparent","&::after":{position:"absolute",display:e?"block":"none",content:'""',width:r.spacing(2),height:r.spacing(2),border:`2px solid ${r.palette.grey[900]}`,transform:"translate(-30%, -30%)",borderRadius:"50%",boxSizing:"content-box"},...i?{borderColor:n}:{backgroundColor:n}}),as=({icon:e,color:n,maskedIcon:i})=>({maskRepeat:"no-repeat",maskSize:"cover",backgroundRepeat:"no-repeat",backgroundSize:"cover",...i?{backgroundColor:n,maskImage:`url(${e})`,WebkitMaskImage:`url(${e})`}:{backgroundColor:"rgba(0,0,0,0)",backgroundImage:`url(${e})`}}),cs=o.styled(o.Box,{shouldForwardProp:e=>e!=="icon"&&e!=="maskedIcon"&&e!=="color"&&e!=="isStrokeColor"})(({icon:e,maskedIcon:n,color:i,isStrokeColor:r,theme:s})=>({whiteSpace:"nowrap",display:"block",width:s.spacing(1.5),height:s.spacing(1.5),flexShrink:"0",borderRadius:"50%",position:"relative",border:"2px solid transparent",...e?as({icon:e,color:i,maskedIcon:n}):ls({color:i,isStrokeColor:r,theme:s})}));function ds({label:e,isStrokeColor:n,color:i="#000",icon:r,maskedIcon:s}){return t.jsxs(o.Box,{component:"li",sx:{display:"flex",alignItems:"center"},children:[t.jsx(cs,{className:"marker",mr:1.5,component:"span",icon:r,maskedIcon:s,isStrokeColor:n,color:i}),t.jsx(ot,{title:e,visible:!0})]})}const Ne=6,We={0:12,1:9,2:6,3:3},us=o.styled(o.Box,{shouldForwardProp:e=>e!=="index"})(({index:e=0,theme:n})=>{const i=n.spacing(We[e]),r=n.spacing(We[e]);return{border:`solid 1px ${n.palette.divider}`,backgroundColor:n.palette.background.default,borderRadius:"50%",position:"absolute",right:0,bottom:0,width:i,height:r}}),ps=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",justifyContent:"flex-end",flexShrink:0,position:"relative",width:e(We[0]),height:e(We[0])})),gs=o.styled(o.Box)(({theme:{spacing:e}})=>({display:"flex",gap:e(1),alignItems:"stretch",justifyContent:"stretch",padding:e(2,0)})),hs=o.styled(o.Box)(()=>({display:"flex",flexDirection:"column",justifyContent:"space-around",gap:1,flexGrow:1,flexShrink:1}));function cn({legend:e}){const n=Z.useIntl(),i=j.useImperativeIntl(n),r=e.showMinMax??!0,{min:s,max:l,error:a}=fs(e),[p,c]=a?[0,0]:xs(s,l);return t.jsxs(gs,{"data-testid":"proportion-legend",children:[t.jsx(ps,{children:[...Array(4)].map((g,h)=>t.jsx(us,{index:h,component:"span"},h))}),t.jsx(hs,{children:a?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[r&&i.formatMessage({id:"c4r.widgets.legend.max"})+": ",n.formatNumber(l,{maximumSignificantDigits:Ne})]}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(c,{maximumSignificantDigits:Ne})}),t.jsx(j.Typography,{variant:"overline",color:"textSecondary",children:n.formatNumber(p,{maximumSignificantDigits:Ne})}),t.jsxs(j.Typography,{variant:"overline",color:"textSecondary",children:[r&&i.formatMessage({id:"c4r.widgets.legend.min"})+": ",n.formatNumber(s,{maximumSignificantDigits:Ne})]})]})})]})}function dn({labels:e}){let n=e==null?void 0:e[e.length-1],i=e==null?void 0:e[0];return Number.isFinite(i)||(i=parseInt(String(i),10)),Number.isFinite(n)||(n=parseInt(String(n),10)),[i,n]}function fs(e){let n=!1;const[i,r]=dn(e);return(Number.isNaN(i)||Number.isNaN(r))&&(n=!0),{min:i,max:r,error:n}}function xs(e,n){const i=(n-e)/3;return[e+i,n-i]}function un({legend:e}){const{labels:n=[],icons:i=[]}=e;return t.jsx(ln,{"data-testid":"icon-legend",children:n.map((r,s)=>t.jsxs(ns,{children:[t.jsx(os,{children:t.jsx("img",{src:i[s],alt:r,width:"auto",height:j.ICON_SIZE_MEDIUM})}),t.jsx(ot,{visible:!0,title:r})]},r))})}function ms(e){return typeof e[0]=="object"&&"label"in e[0]}function Qe({isContinuous:e=!1,legend:n}){const{labels:i=[],colors:r=[],showMinMax:s=!0}=n,l=Me.getPalette(r,!i.length||e?2:i.length+1),a=ms(i),p=a?i.map(({value:m})=>m):i,c=a?i.map(({label:m})=>m):i,[g,h]=dn({labels:p}),d=Number.isNaN(g)||Number.isNaN(h);let y=c[c.length-1],f=c[0];return!e&&s&&(f="< "+f,y="≥ "+y),t.jsx(o.Box,{py:2,"data-testid":"ramp-legend",children:d?t.jsx(o.Box,{maxWidth:240,children:t.jsx(j.Typography,{variant:"overline",children:"You need to specify valid numbers for the labels property"})}):t.jsxs(t.Fragment,{children:[t.jsx(o.Box,{display:"flex",pb:1,children:e?t.jsx(ys,{"data-testid":"step-continuous",palette:l}):t.jsx(js,{palette:l,labels:c,max:y,min:f})}),t.jsxs(o.Box,{display:"flex",justifyContent:"space-between",children:[t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:f}),t.jsx(j.Typography,{variant:"overlineDelicate",color:"textSecondary",children:y})]})]})})}const ys=o.styled(o.Box,{shouldForwardProp:e=>e!=="palette"})(({palette:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),borderRadius:n.spacing(.5),background:`linear-gradient(to right, ${e.join()})`})),vs=o.styled(o.Box,{shouldForwardProp:e=>e!=="color"})(({color:e,theme:n})=>({display:"block",flexGrow:1,height:n.spacing(1),backgroundColor:e,"&:first-of-type":{borderRadius:n.spacing(.5,0,0,.5)},"&:last-of-type":{borderRadius:n.spacing(0,.5,.5,0)}}));function js({labels:e=[],palette:n=[],max:i,min:r}){const s=e.length?[r,...e]:[r,i];return t.jsx(t.Fragment,{children:s.map((l,a)=>{const p=a===0?r:a===s.length-1?i:`${l} - ${s[a+1]}`;return t.jsx(o.Tooltip,{title:p,children:t.jsx(vs,{"data-testid":"step-discontinuous",color:n[a]})},a)})})}const ws={[ce.CATEGORY]:an,[ce.PROPORTION]:cn,[ce.ICON]:un,[ce.BINS]:e=>t.jsx(Qe,{...e,isContinuous:!1}),[ce.CONTINUOUS_RAMP]:e=>t.jsx(Qe,{...e,isContinuous:!0})};function bs({legend:e}){const n=Z.useIntl(),i=j.useImperativeIntl(n);return e.select||!e.type?null:t.jsxs(j.Typography,{variant:"body2",color:"textSecondary",component:"p",children:[e.type," ",i.formatMessage({id:"c4r.widgets.legend.notSupported"}),"."]})}function Ss(e){return e.type===ce.PROPORTION?"c4r.widgets.legend.subtitles.proportion":e.type===ce.ICON||e.customMarkers?"c4r.widgets.legend.subtitles.icon":e.isStrokeColor?"c4r.widgets.legend.subtitles.strokeColor":"c4r.widgets.legend.subtitles.color"}function ks({layer:e,legend:n,customLegendTypes:i,onChangeSelection:r}){var h;const s=Z.useIntl(),l=j.useImperativeIntl(s),a=n.type,c=ws[a]??i[a]??bs,g=((h=n.select)==null?void 0:h.options)??[];return t.jsxs(o.Box,{component:"li","data-testid":"legend-layer-variable",px:2,children:[n.attr?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{gutterBottom:!0,variant:"overlineDelicate",color:"textSecondary",component:"p",children:l.formatMessage({id:Ss(n)})}),t.jsx(j.Typography,{variant:"caption",component:"p",children:n.attr})]}):null,n.select?t.jsxs(o.Box,{pb:1,children:[t.jsx(j.Typography,{variant:"caption",weight:"medium",component:"p",children:n.select.label}),t.jsx(o.Select,{"data-testid":"legend-layer-variable-select",name:"legend-select",value:n.select.value,renderValue:d=>{var y;return((y=g.find(f=>f.value===d))==null?void 0:y.label)??d},onChange:d=>r(d.target.value),MenuProps:{transformOrigin:{vertical:"bottom",horizontal:"left"},anchorOrigin:{vertical:"top",horizontal:"left"},PaperProps:{style:{maxHeight:240}}},children:g.map(d=>t.jsx(o.MenuItem,{value:d.value,children:t.jsx(o.ListItemText,{primary:d.label})},d.value))})]}):null,t.jsx(c,{layer:e,legend:n})]})}const Is={};function pn(e){return e?Array.isArray(e)?e.every(n=>pn(n)):!e.select&&!e.type:!0}function Mt({customLegendTypes:e=Is,layer:n,onChangeCollapsed:i,onChangeOpacity:r,onChangeVisibility:s,onChangeSelection:l,maxZoom:a=21,minZoom:p=0,currentZoom:c=0}){const g=Z.useIntl(),h=j.useImperativeIntl(g),d=u.useRef(null),[y,f]=u.useState(!1),m=n.id,v=n.title,x=n.visible??!0,b=n.switchable??!0,S=n.collapsed??!1,k=(n.collapsible??!0)&&!pn(n.legend),T=n.opacity??1,w=n.showOpacityControl??!0,C=x&&!S,M=C?t.jsx(ee.ExpandLess,{}):t.jsx(ee.ExpandMore,{}),D=(n==null?void 0:n.minZoom)!==void 0||(n==null?void 0:n.maxZoom)!==void 0,E=n.minZoom??p,L=n.maxZoom??a,P=D&&(E>p||L<a),N=c<E||c>L,V=Ts({intl:h,minZoom:p,maxZoom:a,layerMinZoom:E,layerMaxZoom:L}),_=n.helperText??(P?V:""),A=u.useMemo(()=>n.legend?Array.isArray(n.legend)?n.legend:[n.legend]:[],[n.legend]);return n.legend?t.jsxs(is,{"data-testid":"legend-layer","aria-label":v,children:[t.jsxs(Jr,{ref:d,children:[k&&t.jsx(o.IconButton,{size:"small","aria-label":h.formatMessage({id:S?"c4r.widgets.legend.expand":"c4r.widgets.legend.collapse"}),disabled:!x,onClick:()=>i({id:m,collapsed:!S}),children:M}),t.jsxs(rs,{children:[t.jsx(ot,{visible:x,title:v??""}),P&&t.jsx(o.Tooltip,{title:h.formatMessage({id:"c4r.widgets.legend.zoomLevelTooltip"}),children:t.jsxs(j.Typography,{color:x?"textPrimary":"textSecondary",variant:"caption",component:"p",children:[h.formatMessage({id:"c4r.widgets.legend.zoomLevel"})," ",n.minZoom," - ",n.maxZoom]})})]}),w&&x&&!S&&t.jsx(ss,{menuRef:d,open:y,toggleOpen:f,opacity:T,onChange:$=>r({id:m,opacity:$})}),b&&t.jsx(o.Tooltip,{title:h.formatMessage({id:x?"c4r.widgets.legend.hideLayer":"c4r.widgets.legend.showLayer"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>s({id:m,collapsed:x?S:!1,visible:!x}),children:x?t.jsx(ee.VisibilityOutlined,{}):t.jsx(ee.VisibilityOffOutlined,{})})})]}),t.jsxs(o.Collapse,{unmountOnExit:!0,timeout:100,in:C,children:[t.jsx(ts,{"data-testid":"legend-layer-variable-list",opacity:N?.5:1,children:A.map(($,I)=>t.jsx(ks,{legend:$,layer:n,customLegendTypes:e,onChangeSelection:O=>l({id:m,index:I,selection:O})},`${$.type}-${I}`))}),_&&t.jsx(j.Typography,{variant:"caption",color:"textSecondary",component:"div",p:2,children:t.jsx("div",{dangerouslySetInnerHTML:{__html:_}})})]})]}):null}function Ts({intl:e,minZoom:n,maxZoom:i,layerMinZoom:r,layerMaxZoom:s}){const l=e.formatMessage({id:"c4r.widgets.legend.and"}),a=e.formatMessage({id:"c4r.widgets.legend.lowerThan"}),p=e.formatMessage({id:"c4r.widgets.legend.greaterThan"}),c=e.formatMessage({id:"c4r.widgets.legend.zoomNote"}),g=s<i?`${a} ${s}`:"",h=r>n?`${p} ${r}`:"",d=[g,h].filter(Boolean).join(` ${l} `);return d?`${c} ${d}`:""}const Ms={},Ie=()=>{},Cs=[];function As({customLegendTypes:e=Ms,layers:n=Cs,collapsed:i=!1,onChangeCollapsed:r=Ie,onChangeVisibility:s=Ie,onChangeOpacity:l=Ie,onChangeLegendRowCollapsed:a=Ie,onChangeSelection:p=Ie,title:c="Layers",maxZoom:g=20,minZoom:h=0,currentZoom:d,isMobile:y,sx:f}){const m=Z.useIntl(),v=j.useImperativeIntl(m),x=t.jsxs(Zr,{collapsed:i,children:[t.jsx(j.Typography,{variant:"caption",flexGrow:1,children:c}),t.jsx(o.Tooltip,{title:v.formatMessage({id:"c4r.widgets.legend.close"}),children:t.jsx(o.IconButton,{size:"small",onClick:()=>r(!0),children:t.jsx(ee.Close,{})})})]}),b=t.jsx(o.Tooltip,{title:v.formatMessage({id:"c4r.widgets.legend.open"}),children:t.jsx(o.IconButton,{"aria-label":c,onClick:()=>r(!1),children:t.jsx(ee.LayersOutlined,{})})});return t.jsx(Xr,{sx:f,elevation:3,collapsed:i||!!y,children:y?t.jsxs(t.Fragment,{children:[b,t.jsxs(o.Drawer,{anchor:"bottom",open:!i,onClose:()=>r(!0),children:[x,t.jsx(Tt,{children:n.map(S=>t.jsx(Mt,{layer:S,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},S.id))})]})]}):t.jsxs(t.Fragment,{children:[i?b:x,t.jsx(Tt,{width:i?0:void 0,children:t.jsx(o.Collapse,{unmountOnExit:!0,in:!i,timeout:500,children:n.map(S=>t.jsx(Mt,{layer:S,onChangeCollapsed:a,onChangeOpacity:l,onChangeVisibility:s,onChangeSelection:p,maxZoom:g,minZoom:h,currentZoom:d,customLegendTypes:e},S.id))})})]})})}function Ct({color:e=void 0,children:n}){return n?t.jsx(o.Box,{mt:.5,children:t.jsx(j.Typography,{component:"div",variant:"caption",color:e??"inherit",style:{fontWeight:"normal"},children:n})}):t.jsx(o.Box,{mt:-1})}function Es({title:e="No data available",body:n="There are no results for the combination of filters applied to your data. Try tweaking your filters, or zoom and pan the map to adjust the Map View.",severity:i=void 0,...r}){return i?t.jsx(bn.Alert,{title:e,severity:i,...r,children:t.jsx(Ct,{children:n})}):t.jsxs(o.Box,{...r,children:[e&&t.jsx(j.Typography,{variant:"body2",children:e}),t.jsx(Ct,{color:"textSecondary",children:n})]})}const Bs=o.styled(o.Box,{shouldForwardProp:e=>e!=="margin"})(({theme:e,margin:n})=>({margin:0,position:"relative",maxWidth:"100%",padding:n??e.spacing(2,2.5)})),Ps=o.styled(o.LinearProgress)(({theme:e})=>({position:"absolute",top:0,left:0,width:"100%",height:e.spacing(.25)})),Ls=o.styled(o.Grid,{shouldForwardProp:e=>e!=="expanded"})(({theme:e,expanded:n=!0})=>({display:"flex",flexDirection:"row",alignItems:"flex-start",justifyContent:"space-between",width:"100%",...n?{minHeight:e.spacing(3)}:{height:e.spacing(3)},padding:0})),Ds=o.styled(o.Button,{shouldForwardProp:e=>e!=="expandable"})(({theme:e,expandable:n=!0})=>({flex:1,padding:0,alignItems:"flex-start",justifyContent:"flex-start",height:"auto",minHeight:"auto",marginBottom:e.spacing(1),cursor:n?"pointer":"default","& .MuiButton-startIcon":{marginTop:"3px",marginRight:e.spacing(1)},"&:hover":{background:"none"}})),gn=({theme:e})=>({display:"flex",alignItems:"center",justifyContent:"center",width:e.spacing(3),height:e.spacing(3),color:e.palette.text.secondary}),Ns=o.styled(ee.ExpandLess)(({theme:e})=>gn({theme:e})),Os=o.styled(ee.ExpandMore)(({theme:e})=>gn({theme:e})),$s=o.styled(o.Typography,{shouldForwardProp:e=>e!=="expanded"})(({expanded:e=!0})=>({wordBreak:"break-word",overflow:"hidden",...e&&{display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},...!e&&{whiteSpace:"nowrap",textOverflow:"ellipsis"}})),Rs=o.styled(o.Grid)(({theme:e})=>({display:"flex",alignItems:"center",gap:e.spacing(1),marginRight:e.spacing(-.5),marginLeft:e.spacing(1)})),At=o.styled(o.IconButton)(({theme:e})=>({color:e.palette.text.secondary})),Fs=o.styled(o.Menu)(({theme:e})=>({".MuiPaper-root":{marginTop:e.spacing(5),maxHeight:e.spacing(21),minWidth:e.spacing(16)}})),Et=[],Ws=t.jsx(ee.MoreVert,{});function _s({title:e,actions:n=Et,options:i=Et,optionsIcon:r=Ws,children:s,contentProps:l,disabled:a=!1,expandable:p=!0,expanded:c=!0,onExpandedChange:g,footer:h,headerItems:d,isLoading:y=!1,margin:f}){const m=u.createRef(),[v,x]=u.useState(!0),b=c!==void 0&&g!==void 0,S=p!==!1?b?c:v:!0,k=b?g:x,[T,w]=u.useState(null),C=!!T,M=()=>{p&&k(!S)},D=N=>w(N.currentTarget),E=()=>w(null);function L(N){N&&N(),E()}const P=N=>t.jsx(At,{"aria-label":N.label,onClick:N.action,size:"small",children:N.icon},N.id);return a?s?t.jsx(t.Fragment,{children:s}):null:t.jsxs(Bs,{margin:f,component:"section","aria-label":e,children:[y?t.jsx(Ps,{}):null,t.jsxs(Ls,{container:!0,expanded:c,children:[t.jsx(Ds,{expandable:p,startIcon:p&&t.jsx(o.Icon,{children:S?t.jsx(Ns,{}):t.jsx(Os,{})}),onClick:M,tabIndex:p?0:-1,children:t.jsx(o.Tooltip,{title:e,children:t.jsx($s,{expanded:c,align:"left",variant:"subtitle1",children:e})})}),t.jsxs(Rs,{item:!0,children:[d,n.length>0&&n.map(N=>N.tooltip?t.jsx(o.Tooltip,{title:N.tooltip.text,placement:N.tooltip.placement??"top",children:P(N)},N.id):P(N)),i.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(At,{"aria-label":"options","aria-controls":"options-menu","aria-haspopup":"true",onClick:D,size:"small",children:r}),t.jsx(Fs,{id:"options-menu",elevation:8,anchorOrigin:{vertical:"top",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},anchorEl:T,keepMounted:!0,open:C,onClose:E,children:i.map(N=>t.jsx(o.MenuItem,{selected:N.selected,onClick:()=>L(N.action),children:N.name},N.id))})]})]})]}),t.jsx(o.Collapse,{ref:m,in:S,timeout:"auto",unmountOnExit:!0,children:t.jsxs(o.Box,{...l,children:[t.jsx(o.Box,{pt:1,children:s}),h??t.jsx(o.Box,{children:h})]})})]})}exports.BarWidgetUI=Dn;exports.CategoryWidgetUI=Vn;exports.ComparativeCategoryWidgetUI=Sr;exports.ComparativeFormulaWidgetUI=Pr;exports.ComparativePieWidgetUI=Fr;exports.FeatureSelectionUIDropdown=on;exports.FeatureSelectionUIGeometryChips=rn;exports.FeatureSelectionUIToggleButton=nn;exports.FeatureSelectionWidgetUI=Kr;exports.FormulaWidgetUI=Xn;exports.GroupDateTypes=ae;exports.HistogramWidgetUI=ro;exports.LEGEND_TYPES=ce;exports.LegendCategories=an;exports.LegendIcon=un;exports.LegendProportion=cn;exports.LegendRamp=Qe;exports.LegendWidgetUI=As;exports.NoDataAlert=Es;exports.PieWidgetUI=Do;exports.RangeWidgetUI=Ho;exports.ScatterPlotWidgetUI=Qo;exports.TIME_SERIES_CHART_TYPES=Ge;exports.TableWidgetUI=di;exports.TimeSeriesProvider=Yt;exports.TimeSeriesWidgetUI=tr;exports.WrapperWidgetUI=_s;exports.useTimeSeriesContext=ze;exports.useTimeSeriesInteractivity=Vt;
|
package/dist/widgets/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsxs as v, Fragment as ie, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import Qn, { useMemo as F, useState as _, useEffect as U, useCallback as oe, useRef as re, createContext as ei, useContext as ti, useLayoutEffect as an, createRef as ni } from "react";
|
|
3
|
-
import { useTheme as le, styled as m, Box as S, Skeleton as H, Grid as ae, Link as ye, darken as yt, Button as
|
|
3
|
+
import { useTheme as le, styled as m, Box as S, Skeleton as H, Grid as ae, Link as ye, darken as yt, Button as $e, Divider as wt, TextField as ot, InputAdornment as vt, Checkbox as ln, Tooltip as ue, IconButton as fe, debounce as ii, Slider as xt, TableCell as bt, Table as sn, TableHead as cn, TableRow as Je, TableBody as dn, TableContainer as un, TableSortLabel as ri, TablePagination as oi, Menu as kt, MenuItem as Pe, SvgIcon as je, lighten as pn, Typography as De, ClickAwayListener as ai, ToggleButton as li, capitalize as gn, ListItem as si, Chip as ci, List as di, Paper as hn, Popover as ui, Select as pi, ListItemText as gi, Collapse as St, Drawer as hi, Icon as fi, LinearProgress as mi } from "@mui/material";
|
|
4
4
|
import { useIntl as se } from "react-intl";
|
|
5
5
|
import { t as yi, u as ce, T as z, S as B, B as Mt, a as wi, b as pt } from "../TablePaginationActions-BmvmVQd9.js";
|
|
6
6
|
import vi from "echarts-for-react";
|
|
7
7
|
import { FixedSizeList as xi } from "react-window";
|
|
8
8
|
import { S as Qe, a as bi } from "../SwatchSquare-DAne_6Gi.js";
|
|
9
9
|
import { ChevronLeft as ki, ChevronRight as Si, KeyboardArrowDown as Mi, ErrorOutline as Ii, Cancel as Ci, VisibilityOutlined as Ti, VisibilityOffOutlined as Ai, ExpandLess as fn, ExpandMore as mn, Close as Ei, LayersOutlined as Li, MoreVert as Di } from "@mui/icons-material";
|
|
10
|
-
import { A as
|
|
11
|
-
import { c as yn, a as
|
|
10
|
+
import { A as $i } from "../Alert-DbN79ENW.js";
|
|
11
|
+
import { c as yn, a as Pi, b as wn } from "../paletteUtils-BEwZhrLg.js";
|
|
12
12
|
function vn() {
|
|
13
13
|
let e = !1;
|
|
14
14
|
return window.PointerEvent && "maxTouchPoints" in navigator ? navigator.maxTouchPoints > 0 && (e = !0) : (window.matchMedia && window.matchMedia("(any-pointer:coarse)").matches || window.TouchEvent || "ontouchstart" in window) && (e = !0), e;
|
|
@@ -277,7 +277,7 @@ function ns(e) {
|
|
|
277
277
|
return y ? I = t.reduce((R, q) => (q.forEach(
|
|
278
278
|
(j, X) => R[X] = (R[X] ?? 0) + (j ?? Number.MIN_SAFE_INTEGER)
|
|
279
279
|
), R), []) : I = t.flat().map((R) => R ?? Number.MIN_SAFE_INTEGER), Math.max(...I);
|
|
280
|
-
}, [t, y]),
|
|
280
|
+
}, [t, y]), P = F(
|
|
281
281
|
() => ({
|
|
282
282
|
type: "value",
|
|
283
283
|
axisLabel: {
|
|
@@ -307,7 +307,7 @@ function ns(e) {
|
|
|
307
307
|
}
|
|
308
308
|
}),
|
|
309
309
|
[k, L, c]
|
|
310
|
-
),
|
|
310
|
+
), $ = F(
|
|
311
311
|
() => t.map((I, R) => ({
|
|
312
312
|
type: "bar",
|
|
313
313
|
name: r[R] ?? "",
|
|
@@ -359,8 +359,8 @@ function ns(e) {
|
|
|
359
359
|
color: u,
|
|
360
360
|
tooltip: A,
|
|
361
361
|
xAxis: O,
|
|
362
|
-
yAxis:
|
|
363
|
-
series:
|
|
362
|
+
yAxis: P,
|
|
363
|
+
series: $
|
|
364
364
|
}),
|
|
365
365
|
[
|
|
366
366
|
T,
|
|
@@ -368,8 +368,8 @@ function ns(e) {
|
|
|
368
368
|
u,
|
|
369
369
|
A,
|
|
370
370
|
O,
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
P,
|
|
372
|
+
$
|
|
373
373
|
]
|
|
374
374
|
), J = () => {
|
|
375
375
|
a && a([], []);
|
|
@@ -520,7 +520,7 @@ const kn = m(ae)(({ theme: e }) => ({
|
|
|
520
520
|
}
|
|
521
521
|
})), qi = m(S)(({ theme: e }) => ({
|
|
522
522
|
...e.typography.body2
|
|
523
|
-
})), Bt = m(
|
|
523
|
+
})), Bt = m($e)(({ theme: e }) => ({
|
|
524
524
|
position: "absolute",
|
|
525
525
|
left: "-999px",
|
|
526
526
|
top: "-1px",
|
|
@@ -614,7 +614,7 @@ function is({
|
|
|
614
614
|
}) {
|
|
615
615
|
const y = le(), [g, f] = _([]), [w, h] = _(1), [b, k] = _(!1), [M, C] = _(""), [x, A] = _([]), [T, O] = _(
|
|
616
616
|
[]
|
|
617
|
-
), [L,
|
|
617
|
+
), [L, P] = _([]), $ = re(null), W = re(), J = In(L), G = re([]), { showSkeleton: E } = ke(!!c), N = se(), I = ce(N);
|
|
618
618
|
function R(D) {
|
|
619
619
|
return g.reduce((Z, Q) => (D.includes(Q.name) && Z.push(Q.name), Z), []);
|
|
620
620
|
}
|
|
@@ -735,12 +735,12 @@ function is({
|
|
|
735
735
|
})),
|
|
736
736
|
end: g.map((D) => ({ ...D, value: D.value ?? 0 })),
|
|
737
737
|
duration: 500,
|
|
738
|
-
drawFrame: (D) =>
|
|
739
|
-
requestRef:
|
|
738
|
+
drawFrame: (D) => P(D),
|
|
739
|
+
requestRef: $
|
|
740
740
|
}), () => {
|
|
741
|
-
|
|
741
|
+
$.current && cancelAnimationFrame($.current);
|
|
742
742
|
};
|
|
743
|
-
|
|
743
|
+
P(g);
|
|
744
744
|
}, [s, g]), U(() => {
|
|
745
745
|
b && W.current && W.current.focus();
|
|
746
746
|
}, [b, W]);
|
|
@@ -749,8 +749,8 @@ function is({
|
|
|
749
749
|
onCategoryClick: Z
|
|
750
750
|
}) {
|
|
751
751
|
const Q = t(D.value ?? 0), [xe, Ye] = _(!1), be = re(null), lt = () => {
|
|
752
|
-
var
|
|
753
|
-
const st = (((
|
|
752
|
+
var $t, Pt;
|
|
753
|
+
const st = ((($t = be == null ? void 0 : be.current) == null ? void 0 : $t.scrollWidth) ?? 0) > (((Pt = be == null ? void 0 : be.current) == null ? void 0 : Pt.clientWidth) ?? 0);
|
|
754
754
|
Ye(st);
|
|
755
755
|
};
|
|
756
756
|
U(() => (lt(), window.addEventListener("resize", lt), () => {
|
|
@@ -920,7 +920,7 @@ function is({
|
|
|
920
920
|
] }) }),
|
|
921
921
|
b && /* @__PURE__ */ n(Bt, { size: "small", onClick: we, children: I.formatMessage({ id: "c4r.widgets.category.apply" }) }),
|
|
922
922
|
e.length > r && p ? b ? /* @__PURE__ */ n(S, { mt: 1.5, children: /* @__PURE__ */ n(
|
|
923
|
-
|
|
923
|
+
$e,
|
|
924
924
|
{
|
|
925
925
|
size: "small",
|
|
926
926
|
color: "primary",
|
|
@@ -929,7 +929,7 @@ function is({
|
|
|
929
929
|
children: I.formatMessage({ id: "c4r.widgets.category.cancel" })
|
|
930
930
|
}
|
|
931
931
|
) }) : /* @__PURE__ */ n(S, { mt: 1.5, children: /* @__PURE__ */ n(
|
|
932
|
-
|
|
932
|
+
$e,
|
|
933
933
|
{
|
|
934
934
|
size: "small",
|
|
935
935
|
color: "primary",
|
|
@@ -1144,7 +1144,7 @@ function os({
|
|
|
1144
1144
|
selectedBars: d,
|
|
1145
1145
|
onSelectedBarsChange: s,
|
|
1146
1146
|
echartsInstance: C
|
|
1147
|
-
}),
|
|
1147
|
+
}), P = F(
|
|
1148
1148
|
() => ({
|
|
1149
1149
|
show: u,
|
|
1150
1150
|
trigger: "item",
|
|
@@ -1163,7 +1163,7 @@ function os({
|
|
|
1163
1163
|
}
|
|
1164
1164
|
}),
|
|
1165
1165
|
[h, u, p, o, a]
|
|
1166
|
-
),
|
|
1166
|
+
), $ = F(
|
|
1167
1167
|
() => ({
|
|
1168
1168
|
min: i,
|
|
1169
1169
|
max: r,
|
|
@@ -1297,12 +1297,12 @@ function os({
|
|
|
1297
1297
|
bottom: B * 0.5,
|
|
1298
1298
|
containLabel: !0
|
|
1299
1299
|
},
|
|
1300
|
-
tooltip:
|
|
1301
|
-
xAxis:
|
|
1300
|
+
tooltip: P,
|
|
1301
|
+
xAxis: $,
|
|
1302
1302
|
yAxis: W,
|
|
1303
1303
|
series: [J]
|
|
1304
1304
|
}),
|
|
1305
|
-
[
|
|
1305
|
+
[P, $, W, J]
|
|
1306
1306
|
), E = d.reduce(
|
|
1307
1307
|
(I, R) => I += e[R] ?? 0,
|
|
1308
1308
|
0
|
|
@@ -1529,7 +1529,7 @@ const Er = m(S)(({ theme: e }) => ({
|
|
|
1529
1529
|
textOverflow: "ellipsis",
|
|
1530
1530
|
whiteSpace: "nowrap",
|
|
1531
1531
|
cursor: "pointer"
|
|
1532
|
-
})),
|
|
1532
|
+
})), $r = m(S)(({ theme: e }) => ({
|
|
1533
1533
|
display: "inline-block",
|
|
1534
1534
|
position: "absolute",
|
|
1535
1535
|
left: e.spacing(-2),
|
|
@@ -1538,7 +1538,7 @@ const Er = m(S)(({ theme: e }) => ({
|
|
|
1538
1538
|
zIndex: 1,
|
|
1539
1539
|
width: e.spacing(2.5),
|
|
1540
1540
|
background: `linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, ${e.palette.background.paper} 100%)`
|
|
1541
|
-
})),
|
|
1541
|
+
})), Pr = m(S)(({ theme: e }) => ({
|
|
1542
1542
|
position: "absolute",
|
|
1543
1543
|
padding: e.spacing(0.25, 1),
|
|
1544
1544
|
top: e.spacing(0),
|
|
@@ -1637,8 +1637,8 @@ function An({
|
|
|
1637
1637
|
})
|
|
1638
1638
|
}
|
|
1639
1639
|
),
|
|
1640
|
-
(o || l > 0) && /* @__PURE__ */ v(
|
|
1641
|
-
/* @__PURE__ */ n(
|
|
1640
|
+
(o || l > 0) && /* @__PURE__ */ v(Pr, { ref: y, children: [
|
|
1641
|
+
/* @__PURE__ */ n($r, {}),
|
|
1642
1642
|
/* @__PURE__ */ n(
|
|
1643
1643
|
ue,
|
|
1644
1644
|
{
|
|
@@ -1796,7 +1796,7 @@ function as({
|
|
|
1796
1796
|
}
|
|
1797
1797
|
},
|
|
1798
1798
|
[b, y, c]
|
|
1799
|
-
),
|
|
1799
|
+
), P = oe(
|
|
1800
1800
|
(G) => {
|
|
1801
1801
|
if (y) {
|
|
1802
1802
|
const E = [...c], N = E.indexOf(G);
|
|
@@ -1804,7 +1804,7 @@ function as({
|
|
|
1804
1804
|
}
|
|
1805
1805
|
},
|
|
1806
1806
|
[y, c]
|
|
1807
|
-
),
|
|
1807
|
+
), $ = {
|
|
1808
1808
|
...p && { click: L }
|
|
1809
1809
|
}, W = () => {
|
|
1810
1810
|
y == null || y([]);
|
|
@@ -1841,7 +1841,7 @@ function as({
|
|
|
1841
1841
|
Fr,
|
|
1842
1842
|
{
|
|
1843
1843
|
option: O,
|
|
1844
|
-
onEvents:
|
|
1844
|
+
onEvents: $,
|
|
1845
1845
|
lazyUpdate: !0,
|
|
1846
1846
|
style: { height: a, width: l }
|
|
1847
1847
|
}
|
|
@@ -1852,7 +1852,7 @@ function as({
|
|
|
1852
1852
|
{
|
|
1853
1853
|
series: b,
|
|
1854
1854
|
selectedCategories: c,
|
|
1855
|
-
onCategoryClick: y &&
|
|
1855
|
+
onCategoryClick: y && P
|
|
1856
1856
|
}
|
|
1857
1857
|
)
|
|
1858
1858
|
] });
|
|
@@ -2328,10 +2328,10 @@ function cs({
|
|
|
2328
2328
|
{ from: E, to: N, count: I }
|
|
2329
2329
|
);
|
|
2330
2330
|
}
|
|
2331
|
-
function
|
|
2331
|
+
function P(E) {
|
|
2332
2332
|
l(r === E && o === "asc" ? "desc" : "asc"), a(E);
|
|
2333
2333
|
}
|
|
2334
|
-
function
|
|
2334
|
+
function $(E, N) {
|
|
2335
2335
|
p(N);
|
|
2336
2336
|
}
|
|
2337
2337
|
function W(E) {
|
|
@@ -2362,7 +2362,7 @@ function cs({
|
|
|
2362
2362
|
sorting: i,
|
|
2363
2363
|
sortBy: r,
|
|
2364
2364
|
sortDirection: o,
|
|
2365
|
-
onSort:
|
|
2365
|
+
onSort: P
|
|
2366
2366
|
}
|
|
2367
2367
|
),
|
|
2368
2368
|
/* @__PURE__ */ n(
|
|
@@ -2389,7 +2389,7 @@ function cs({
|
|
|
2389
2389
|
count: s,
|
|
2390
2390
|
rowsPerPage: c,
|
|
2391
2391
|
page: u,
|
|
2392
|
-
onPageChange:
|
|
2392
|
+
onPageChange: $,
|
|
2393
2393
|
onRowsPerPageChange: W,
|
|
2394
2394
|
ActionsComponent: () => /* @__PURE__ */ n(
|
|
2395
2395
|
wi,
|
|
@@ -2397,7 +2397,7 @@ function cs({
|
|
|
2397
2397
|
count: s,
|
|
2398
2398
|
rowsPerPage: c,
|
|
2399
2399
|
page: u,
|
|
2400
|
-
onPageChange:
|
|
2400
|
+
onPageChange: $,
|
|
2401
2401
|
lastPageTooltip: C
|
|
2402
2402
|
}
|
|
2403
2403
|
)
|
|
@@ -2701,7 +2701,7 @@ function Eo({
|
|
|
2701
2701
|
return { start: i, end: r };
|
|
2702
2702
|
}
|
|
2703
2703
|
const me = () => {
|
|
2704
|
-
},
|
|
2704
|
+
}, $n = ei({
|
|
2705
2705
|
isPlaying: !1,
|
|
2706
2706
|
setIsPlaying: me,
|
|
2707
2707
|
isPaused: !1,
|
|
@@ -2714,7 +2714,7 @@ const me = () => {
|
|
|
2714
2714
|
intl: {}
|
|
2715
2715
|
});
|
|
2716
2716
|
function Et() {
|
|
2717
|
-
return ti(
|
|
2717
|
+
return ti($n);
|
|
2718
2718
|
}
|
|
2719
2719
|
function Lo({
|
|
2720
2720
|
children: e,
|
|
@@ -2748,7 +2748,7 @@ function Lo({
|
|
|
2748
2748
|
const M = l.map(Vt), C = g.map(Vt);
|
|
2749
2749
|
(M[0] !== C[0] || M[1] !== C[1]) && f(M);
|
|
2750
2750
|
}, l), /* @__PURE__ */ n(
|
|
2751
|
-
|
|
2751
|
+
$n.Provider,
|
|
2752
2752
|
{
|
|
2753
2753
|
value: {
|
|
2754
2754
|
isPlaying: !!u,
|
|
@@ -2784,8 +2784,8 @@ function Do({
|
|
|
2784
2784
|
const [L] = e.convertFromPixel(_e, [
|
|
2785
2785
|
O.offsetX,
|
|
2786
2786
|
O.offsetY
|
|
2787
|
-
]),
|
|
2788
|
-
u(
|
|
2787
|
+
]), P = nt(L, t);
|
|
2788
|
+
u(P !== void 0 ? [t[P].name] : []);
|
|
2789
2789
|
}
|
|
2790
2790
|
},
|
|
2791
2791
|
[t, e, u]
|
|
@@ -2808,31 +2808,31 @@ function Do({
|
|
|
2808
2808
|
r
|
|
2809
2809
|
]), U(() => {
|
|
2810
2810
|
function O(L) {
|
|
2811
|
-
var
|
|
2811
|
+
var P;
|
|
2812
2812
|
if (r) {
|
|
2813
|
-
if (((
|
|
2813
|
+
if (((P = L.target) == null ? void 0 : P.type) === "ec-line") {
|
|
2814
2814
|
y(!0), C("grabbing");
|
|
2815
2815
|
return;
|
|
2816
2816
|
}
|
|
2817
2817
|
if (s.length === 2) {
|
|
2818
|
-
const [
|
|
2818
|
+
const [$] = e.convertFromPixel(_e, [
|
|
2819
2819
|
L.offsetX,
|
|
2820
2820
|
L.offsetY
|
|
2821
2821
|
]);
|
|
2822
|
-
if (
|
|
2822
|
+
if ($ >= s[0] && $ <= s[1]) {
|
|
2823
2823
|
h(!0);
|
|
2824
|
-
const W =
|
|
2824
|
+
const W = $ - s[0];
|
|
2825
2825
|
k(W);
|
|
2826
2826
|
return;
|
|
2827
2827
|
}
|
|
2828
2828
|
}
|
|
2829
2829
|
if (e) {
|
|
2830
2830
|
f(!0);
|
|
2831
|
-
const [
|
|
2831
|
+
const [$] = e.convertFromPixel(_e, [
|
|
2832
2832
|
L.offsetX,
|
|
2833
2833
|
L.offsetY
|
|
2834
2834
|
]);
|
|
2835
|
-
qe =
|
|
2835
|
+
qe = $;
|
|
2836
2836
|
return;
|
|
2837
2837
|
}
|
|
2838
2838
|
}
|
|
@@ -2840,13 +2840,13 @@ function Do({
|
|
|
2840
2840
|
return Xe(M, "mousedown", O);
|
|
2841
2841
|
}, [M, e, s, C, r]), U(() => {
|
|
2842
2842
|
function O(L) {
|
|
2843
|
-
var
|
|
2844
|
-
if (((
|
|
2845
|
-
const [
|
|
2843
|
+
var P;
|
|
2844
|
+
if (((P = L == null ? void 0 : L.target) == null ? void 0 : P.type) === "polygon" && C("move"), c && e && (x(L), C("grabbing")), g && e) {
|
|
2845
|
+
const [$] = e.convertFromPixel(_e, [
|
|
2846
2846
|
L.offsetX,
|
|
2847
2847
|
L.offsetY
|
|
2848
2848
|
]);
|
|
2849
|
-
u(qe ===
|
|
2849
|
+
u(qe === $ ? [] : [qe, $]);
|
|
2850
2850
|
}
|
|
2851
2851
|
}
|
|
2852
2852
|
return Xe(M, "mousemove", O);
|
|
@@ -2861,12 +2861,12 @@ function Do({
|
|
|
2861
2861
|
]), U(() => {
|
|
2862
2862
|
function O(L) {
|
|
2863
2863
|
if (c && (y(!1), C("default")), g && (f(!1), qe = null, s.length === 1 && u([])), w && e) {
|
|
2864
|
-
const [
|
|
2864
|
+
const [P] = e.convertFromPixel(_e, [
|
|
2865
2865
|
L.offsetX,
|
|
2866
2866
|
L.offsetY
|
|
2867
|
-
]),
|
|
2867
|
+
]), $ = P - s[0];
|
|
2868
2868
|
if (b) {
|
|
2869
|
-
const W =
|
|
2869
|
+
const W = $ - b;
|
|
2870
2870
|
u([s[0] + W, s[1] + W]);
|
|
2871
2871
|
}
|
|
2872
2872
|
h(!1);
|
|
@@ -2887,16 +2887,16 @@ function Do({
|
|
|
2887
2887
|
!r && s.length && u([]);
|
|
2888
2888
|
}, [r, u, s.length]);
|
|
2889
2889
|
const A = F(() => {
|
|
2890
|
-
var
|
|
2890
|
+
var $;
|
|
2891
2891
|
if (s.length !== 1)
|
|
2892
2892
|
return;
|
|
2893
2893
|
const O = s[0], L = nt(O, t);
|
|
2894
2894
|
if (L === void 0)
|
|
2895
2895
|
return;
|
|
2896
|
-
const
|
|
2896
|
+
const P = ($ = t[L]) == null ? void 0 : $.name;
|
|
2897
2897
|
return (
|
|
2898
2898
|
// Cannot have markLine and markArea at the same time
|
|
2899
|
-
|
|
2899
|
+
P !== void 0 && {
|
|
2900
2900
|
symbol: ["none", "none"],
|
|
2901
2901
|
animationDuration: 100,
|
|
2902
2902
|
animationDurationUpdate: 150,
|
|
@@ -2911,7 +2911,7 @@ function Do({
|
|
|
2911
2911
|
show: !1
|
|
2912
2912
|
}
|
|
2913
2913
|
},
|
|
2914
|
-
xAxis:
|
|
2914
|
+
xAxis: P,
|
|
2915
2915
|
lineStyle: {
|
|
2916
2916
|
type: "solid",
|
|
2917
2917
|
color: o.palette.primary.main,
|
|
@@ -2941,7 +2941,7 @@ function Xe(e, t, i) {
|
|
|
2941
2941
|
Ut[t] && (e != null && e.handler) && e.off(t, i);
|
|
2942
2942
|
};
|
|
2943
2943
|
}
|
|
2944
|
-
const
|
|
2944
|
+
const Pn = B * 22, On = "100%", $o = 5, Po = 3, Oo = B * 20;
|
|
2945
2945
|
function Wo({
|
|
2946
2946
|
chartType: e,
|
|
2947
2947
|
formatter: t,
|
|
@@ -3044,9 +3044,9 @@ function Wo({
|
|
|
3044
3044
|
show: !1
|
|
3045
3045
|
},
|
|
3046
3046
|
splitNumber: i ?? (M !== void 0 ? Math.min(
|
|
3047
|
-
|
|
3047
|
+
Po,
|
|
3048
3048
|
Math.ceil(M / Oo)
|
|
3049
|
-
) :
|
|
3049
|
+
) : $o)
|
|
3050
3050
|
},
|
|
3051
3051
|
yAxis: {
|
|
3052
3052
|
type: "value",
|
|
@@ -3084,7 +3084,7 @@ function Wo({
|
|
|
3084
3084
|
data: a,
|
|
3085
3085
|
canSelectLines: !!g,
|
|
3086
3086
|
filterable: c
|
|
3087
|
-
}),
|
|
3087
|
+
}), P = F(
|
|
3088
3088
|
() => l.map(({ data: E, color: N, name: I }, R) => {
|
|
3089
3089
|
const q = y && y.length > 0, j = q && y.includes(I), X = !q || j ? N : w.palette.action.disabledBackground;
|
|
3090
3090
|
return {
|
|
@@ -3120,7 +3120,7 @@ function Wo({
|
|
|
3120
3120
|
y,
|
|
3121
3121
|
w
|
|
3122
3122
|
]
|
|
3123
|
-
),
|
|
3123
|
+
), $ = F(
|
|
3124
3124
|
() => ({
|
|
3125
3125
|
grid: {
|
|
3126
3126
|
left: B * (f === "dense" ? 2 : 3.5),
|
|
@@ -3131,11 +3131,11 @@ function Wo({
|
|
|
3131
3131
|
color: [w.palette.secondary.main],
|
|
3132
3132
|
tooltip: A,
|
|
3133
3133
|
...T,
|
|
3134
|
-
series:
|
|
3134
|
+
series: P
|
|
3135
3135
|
}),
|
|
3136
3136
|
[
|
|
3137
3137
|
T,
|
|
3138
|
-
|
|
3138
|
+
P,
|
|
3139
3139
|
f,
|
|
3140
3140
|
w.palette.secondary.main,
|
|
3141
3141
|
A
|
|
@@ -3163,7 +3163,7 @@ function Wo({
|
|
|
3163
3163
|
N.disconnect();
|
|
3164
3164
|
};
|
|
3165
3165
|
}, [h]);
|
|
3166
|
-
const G = u ? On : s ??
|
|
3166
|
+
const G = u ? On : s ?? Pn;
|
|
3167
3167
|
return an(() => {
|
|
3168
3168
|
var N;
|
|
3169
3169
|
const E = (N = h == null ? void 0 : h.getDom()) == null ? void 0 : N.parentElement;
|
|
@@ -3171,7 +3171,7 @@ function Wo({
|
|
|
3171
3171
|
}, [G, u, h]), /* @__PURE__ */ n(
|
|
3172
3172
|
We,
|
|
3173
3173
|
{
|
|
3174
|
-
option:
|
|
3174
|
+
option: $,
|
|
3175
3175
|
onEvents: J,
|
|
3176
3176
|
onChartReady: k,
|
|
3177
3177
|
style: { height: G }
|
|
@@ -3278,9 +3278,9 @@ function No({
|
|
|
3278
3278
|
open: !!i,
|
|
3279
3279
|
onClose: k,
|
|
3280
3280
|
children: [
|
|
3281
|
-
/* @__PURE__ */ n(
|
|
3281
|
+
/* @__PURE__ */ n(Pe, { disabled: !0, children: /* @__PURE__ */ n(z, { variant: "caption", color: "textSecondary", children: g.formatMessage({ id: "c4r.widgets.timeSeries.speed" }) }) }),
|
|
3282
3282
|
Fo.map((C) => /* @__PURE__ */ v(
|
|
3283
|
-
|
|
3283
|
+
Pe,
|
|
3284
3284
|
{
|
|
3285
3285
|
selected: C === o,
|
|
3286
3286
|
onClick: () => M(C),
|
|
@@ -3540,7 +3540,7 @@ const Jo = (e) => /* @__PURE__ */ n(je, { width: "720", height: "124", viewBox:
|
|
|
3540
3540
|
/* @__PURE__ */ n(S, { mt: 2, p: 0.5, children: /* @__PURE__ */ n(H, { width: 16, height: 16 }) }),
|
|
3541
3541
|
/* @__PURE__ */ n(S, { mt: 1, p: 0.5, children: /* @__PURE__ */ n(H, { width: 16, height: 16 }) })
|
|
3542
3542
|
] }),
|
|
3543
|
-
chart: /* @__PURE__ */ v(ea, { style: { height: e ? On : t ??
|
|
3543
|
+
chart: /* @__PURE__ */ v(ea, { style: { height: e ? On : t ?? Pn }, children: [
|
|
3544
3544
|
/* @__PURE__ */ n(ta, { flex: 0, children: /* @__PURE__ */ n(H, { width: 24, height: 8 }) }),
|
|
3545
3545
|
/* @__PURE__ */ n(na, { flex: 1, children: /* @__PURE__ */ n(Jo, { preserveAspectRatio: "none" }) }),
|
|
3546
3546
|
/* @__PURE__ */ v(ia, { flex: 0, children: [
|
|
@@ -3587,8 +3587,8 @@ function ds({
|
|
|
3587
3587
|
onPause: T,
|
|
3588
3588
|
onStop: O,
|
|
3589
3589
|
isLoading: L = !1,
|
|
3590
|
-
palette:
|
|
3591
|
-
showLegend:
|
|
3590
|
+
palette: P = Object.values(yn.qualitative.bold),
|
|
3591
|
+
showLegend: $,
|
|
3592
3592
|
yAxisType: W = "dense"
|
|
3593
3593
|
}) {
|
|
3594
3594
|
const J = re([]), G = se(), { showSkeleton: E } = ke(!!L), N = oe(
|
|
@@ -3614,7 +3614,7 @@ function ds({
|
|
|
3614
3614
|
fitHeight: p,
|
|
3615
3615
|
height: u,
|
|
3616
3616
|
showControls: c,
|
|
3617
|
-
showLegend:
|
|
3617
|
+
showLegend: $
|
|
3618
3618
|
}
|
|
3619
3619
|
) : /* @__PURE__ */ n(
|
|
3620
3620
|
Lo,
|
|
@@ -3644,8 +3644,8 @@ function ds({
|
|
|
3644
3644
|
showControls: c,
|
|
3645
3645
|
animation: y,
|
|
3646
3646
|
filterable: g,
|
|
3647
|
-
palette:
|
|
3648
|
-
showLegend:
|
|
3647
|
+
palette: P,
|
|
3648
|
+
showLegend: $,
|
|
3649
3649
|
selectedCategories: k,
|
|
3650
3650
|
timelinePosition: h,
|
|
3651
3651
|
onSelectedCategoriesChange: M,
|
|
@@ -3677,23 +3677,23 @@ function aa({
|
|
|
3677
3677
|
timelinePosition: k,
|
|
3678
3678
|
yAxisType: M = "dense"
|
|
3679
3679
|
}) {
|
|
3680
|
-
const C = le(), x = C.palette.secondary.main, { isPlaying: A, isPaused: T, timeWindow: O, stop: L, setTimeWindow:
|
|
3680
|
+
const C = le(), x = C.palette.secondary.main, { isPlaying: A, isPaused: T, timeWindow: O, stop: L, setTimeWindow: P, intl: $ } = Et();
|
|
3681
3681
|
U(() => {
|
|
3682
3682
|
if (k !== void 0) {
|
|
3683
3683
|
if (k < 0 || k >= e.length) return;
|
|
3684
3684
|
const Y = e[k].name;
|
|
3685
|
-
|
|
3685
|
+
P([Y]);
|
|
3686
3686
|
}
|
|
3687
3687
|
}, [k, e]), U(() => {
|
|
3688
3688
|
if (!e.length) return;
|
|
3689
3689
|
const Y = e[0].name, K = e[e.length - 1].name;
|
|
3690
|
-
(O[0] < Y || O[1] > K || O[1] < Y || O[1] > K) &&
|
|
3690
|
+
(O[0] < Y || O[1] > K || O[1] < Y || O[1] > K) && P([]);
|
|
3691
3691
|
}, [e]);
|
|
3692
3692
|
const W = F(() => {
|
|
3693
3693
|
const Y = {}, K = t ? t.map((de) => ({
|
|
3694
3694
|
name: de,
|
|
3695
3695
|
data: [],
|
|
3696
|
-
color:
|
|
3696
|
+
color: Pi(de, {
|
|
3697
3697
|
palette: f,
|
|
3698
3698
|
fallbackColor: x,
|
|
3699
3699
|
colorMapping: Y
|
|
@@ -3731,7 +3731,7 @@ function aa({
|
|
|
3731
3731
|
return Dn({ date: Y, stepSize: i, stepMultiplier: r });
|
|
3732
3732
|
}
|
|
3733
3733
|
}, [e, O, A, T, i, r]), G = F(() => A || T || O.length > 0 || (w == null ? void 0 : w.length) > 0, [T, A, w == null ? void 0 : w.length, O.length]), E = () => {
|
|
3734
|
-
L(),
|
|
3734
|
+
L(), P([]), h == null || h([]);
|
|
3735
3735
|
}, N = (Y) => {
|
|
3736
3736
|
Y.key === "Enter" && E();
|
|
3737
3737
|
}, I = oe(
|
|
@@ -3753,7 +3753,7 @@ function aa({
|
|
|
3753
3753
|
onKeyDown: N,
|
|
3754
3754
|
tabIndex: 0,
|
|
3755
3755
|
underline: "hover",
|
|
3756
|
-
children:
|
|
3756
|
+
children: $.formatMessage({ id: "c4r.widgets.timeSeries.clear" })
|
|
3757
3757
|
}
|
|
3758
3758
|
)
|
|
3759
3759
|
] });
|
|
@@ -4076,7 +4076,7 @@ function us({
|
|
|
4076
4076
|
tooltip: f = !0,
|
|
4077
4077
|
isLoading: w = !1
|
|
4078
4078
|
}) {
|
|
4079
|
-
const h = le(), [b, k] = _(!1), [M, C] = _(!1), [x, A] = _(p), [T, O] = _(""), L = se(),
|
|
4079
|
+
const h = le(), [b, k] = _(!1), [M, C] = _(!1), [x, A] = _(p), [T, O] = _(""), L = se(), P = ce(L), $ = F(() => {
|
|
4080
4080
|
const V = r.length ? r : [
|
|
4081
4081
|
h.palette.secondary.main,
|
|
4082
4082
|
h.palette.primary.main,
|
|
@@ -4092,27 +4092,27 @@ function us({
|
|
|
4092
4092
|
}, [t, r, i, h, p, a]), W = F(() => Math.max(
|
|
4093
4093
|
...t.map((V) => V.map((ee) => ee.value ?? 0)).flat()
|
|
4094
4094
|
), [t]), J = F(() => {
|
|
4095
|
-
if (o >=
|
|
4096
|
-
return
|
|
4097
|
-
const V =
|
|
4095
|
+
if (o >= $.length)
|
|
4096
|
+
return $;
|
|
4097
|
+
const V = $.slice(0, o), ee = $.slice(o), ne = [];
|
|
4098
4098
|
for (const Te of ee)
|
|
4099
4099
|
Te.data.forEach((Re, Ae) => {
|
|
4100
4100
|
ne[Ae] = ne[Ae] ?? 0, ne[Ae] += Re.value;
|
|
4101
4101
|
});
|
|
4102
4102
|
const pe = {
|
|
4103
4103
|
key: Oe,
|
|
4104
|
-
label: s ? "Others" : `Others (${
|
|
4104
|
+
label: s ? "Others" : `Others (${$.length - o})`,
|
|
4105
4105
|
data: ne.map((Te) => ({
|
|
4106
4106
|
value: Te,
|
|
4107
4107
|
color: h.palette.divider
|
|
4108
4108
|
}))
|
|
4109
4109
|
};
|
|
4110
4110
|
return [...V, pe];
|
|
4111
|
-
}, [
|
|
4111
|
+
}, [$, s, o, h.palette.divider]), G = F(() => $.filter((V) => p.includes(V.key)), [$, p]), E = F(() => T ? $.filter((V) => {
|
|
4112
4112
|
const ee = (V.key || "").toLowerCase(), ne = (V.label || "").toLowerCase(), pe = ee == null ? void 0 : ee.includes(T.toLowerCase()), Te = ne == null ? void 0 : ne.includes(T.toLowerCase());
|
|
4113
4113
|
return pe || Te;
|
|
4114
|
-
}) :
|
|
4115
|
-
if (
|
|
4114
|
+
}) : $, [$, T]), N = $.length - J.length + 1, I = s && !b && o < $.length;
|
|
4115
|
+
if ($.length === 0 || w)
|
|
4116
4116
|
return /* @__PURE__ */ n(Mn, {});
|
|
4117
4117
|
const R = b ? E : M ? G : J;
|
|
4118
4118
|
function q() {
|
|
@@ -4137,22 +4137,22 @@ function us({
|
|
|
4137
4137
|
const ee = p.includes(V), ne = new Set(p);
|
|
4138
4138
|
ee ? ne.delete(V) : ne.add(V);
|
|
4139
4139
|
let pe = Array.from(ne);
|
|
4140
|
-
pe.length ===
|
|
4140
|
+
pe.length === $.length && (pe = []), c(pe);
|
|
4141
4141
|
}
|
|
4142
4142
|
function we(V) {
|
|
4143
4143
|
const ee = x.includes(V), ne = new Set(x);
|
|
4144
4144
|
ee ? ne.delete(V) : ne.add(V);
|
|
4145
4145
|
let pe = Array.from(ne);
|
|
4146
|
-
pe.length ===
|
|
4146
|
+
pe.length === $.length && (pe = []), A(pe);
|
|
4147
4147
|
}
|
|
4148
4148
|
const ve = u ? b ? we : de : void 0;
|
|
4149
4149
|
return /* @__PURE__ */ v(la, { children: [
|
|
4150
4150
|
u ? /* @__PURE__ */ v(Xt, { center: !0, children: [
|
|
4151
|
-
/* @__PURE__ */ n(z, { variant: "caption", children: p.length > 0 ?
|
|
4151
|
+
/* @__PURE__ */ n(z, { variant: "caption", children: p.length > 0 ? P.formatMessage(
|
|
4152
4152
|
{ id: "c4r.widgets.category.selectedItems" },
|
|
4153
4153
|
{ items: p.length }
|
|
4154
|
-
) :
|
|
4155
|
-
/* @__PURE__ */ n(z, { variant: "caption", children: b ? /* @__PURE__ */ n(ye, { onClick: q, children:
|
|
4154
|
+
) : P.formatMessage({ id: "c4r.widgets.category.all" }) }),
|
|
4155
|
+
/* @__PURE__ */ n(z, { variant: "caption", children: b ? /* @__PURE__ */ n(ye, { onClick: q, children: P.formatMessage({ id: "c4r.widgets.category.apply" }) }) : M ? /* @__PURE__ */ n(ye, { onClick: j, children: P.formatMessage({
|
|
4156
4156
|
id: "c4r.widgets.category.unlock"
|
|
4157
4157
|
}) }) : p.length ? /* @__PURE__ */ v(
|
|
4158
4158
|
S,
|
|
@@ -4163,11 +4163,11 @@ function us({
|
|
|
4163
4163
|
gap: h.spacing(1)
|
|
4164
4164
|
},
|
|
4165
4165
|
children: [
|
|
4166
|
-
/* @__PURE__ */ n(ye, { onClick: te, children:
|
|
4166
|
+
/* @__PURE__ */ n(ye, { onClick: te, children: P.formatMessage({
|
|
4167
4167
|
id: "c4r.widgets.category.lock"
|
|
4168
4168
|
}) }),
|
|
4169
4169
|
/* @__PURE__ */ n(wt, { orientation: "vertical", flexItem: !0 }),
|
|
4170
|
-
/* @__PURE__ */ n(ye, { onClick: X, children:
|
|
4170
|
+
/* @__PURE__ */ n(ye, { onClick: X, children: P.formatMessage({
|
|
4171
4171
|
id: "c4r.widgets.category.clear"
|
|
4172
4172
|
}) })
|
|
4173
4173
|
]
|
|
@@ -4178,7 +4178,7 @@ function us({
|
|
|
4178
4178
|
ga,
|
|
4179
4179
|
{
|
|
4180
4180
|
size: "small",
|
|
4181
|
-
placeholder:
|
|
4181
|
+
placeholder: P.formatMessage({
|
|
4182
4182
|
id: "c4r.widgets.category.search"
|
|
4183
4183
|
}),
|
|
4184
4184
|
onChange: (V) => O(V.currentTarget.value),
|
|
@@ -4190,10 +4190,10 @@ function us({
|
|
|
4190
4190
|
) }) : null,
|
|
4191
4191
|
/* @__PURE__ */ v(sa, { children: [
|
|
4192
4192
|
R.length === 0 ? /* @__PURE__ */ v(ie, { children: [
|
|
4193
|
-
/* @__PURE__ */ n(z, { variant: "body2", children:
|
|
4193
|
+
/* @__PURE__ */ n(z, { variant: "body2", children: P.formatMessage({
|
|
4194
4194
|
id: "c4r.widgets.category.noResults"
|
|
4195
4195
|
}) }),
|
|
4196
|
-
/* @__PURE__ */ n(z, { variant: "caption", children:
|
|
4196
|
+
/* @__PURE__ */ n(z, { variant: "caption", children: P.formatMessage(
|
|
4197
4197
|
{ id: "c4r.widgets.category.noResultsMessage" },
|
|
4198
4198
|
{ searchValue: T }
|
|
4199
4199
|
) })
|
|
@@ -4216,19 +4216,19 @@ function us({
|
|
|
4216
4216
|
) }, V.key))
|
|
4217
4217
|
] }),
|
|
4218
4218
|
I ? /* @__PURE__ */ n(
|
|
4219
|
-
|
|
4219
|
+
$e,
|
|
4220
4220
|
{
|
|
4221
4221
|
size: "small",
|
|
4222
4222
|
color: "primary",
|
|
4223
4223
|
startIcon: /* @__PURE__ */ n(Qe, {}),
|
|
4224
4224
|
onClick: Y,
|
|
4225
|
-
children:
|
|
4225
|
+
children: P.formatMessage(
|
|
4226
4226
|
{ id: "c4r.widgets.category.searchInfo" },
|
|
4227
4227
|
{ elements: N }
|
|
4228
4228
|
)
|
|
4229
4229
|
}
|
|
4230
4230
|
) : null,
|
|
4231
|
-
b ? /* @__PURE__ */ n(
|
|
4231
|
+
b ? /* @__PURE__ */ n($e, { size: "small", color: "primary", onClick: K, children: P.formatMessage({ id: "c4r.widgets.category.cancel" }) }) : null,
|
|
4232
4232
|
/* @__PURE__ */ n(ca, { children: e.map((V, ee) => /* @__PURE__ */ v(Bn, { children: [
|
|
4233
4233
|
/* @__PURE__ */ n(_n, { color: (r == null ? void 0 : r[ee]) ?? h.palette.background.default }),
|
|
4234
4234
|
/* @__PURE__ */ n(z, { variant: "overline", children: V })
|
|
@@ -4256,7 +4256,7 @@ const Ea = m("div")(({ theme: e }) => ({
|
|
|
4256
4256
|
})), Da = m(z)(({ theme: e }) => ({
|
|
4257
4257
|
marginLeft: e.spacing(0.5)
|
|
4258
4258
|
}));
|
|
4259
|
-
function
|
|
4259
|
+
function $a({
|
|
4260
4260
|
row: e,
|
|
4261
4261
|
animated: t,
|
|
4262
4262
|
animationOptions: i,
|
|
@@ -4277,7 +4277,7 @@ function Pa({
|
|
|
4277
4277
|
d ? /* @__PURE__ */ n(S, { color: o.palette.text.secondary, children: /* @__PURE__ */ n(Da, { color: "inherit", component: "span", variant: "subtitle2", children: d }) }) : null
|
|
4278
4278
|
] });
|
|
4279
4279
|
}
|
|
4280
|
-
const
|
|
4280
|
+
const Pa = (e) => e, Zt = [], Oa = m("div")(({ theme: e }) => ({
|
|
4281
4281
|
"&:nth-of-type(n+2)": {
|
|
4282
4282
|
marginTop: e.spacing(2)
|
|
4283
4283
|
}
|
|
@@ -4287,13 +4287,13 @@ function ps({
|
|
|
4287
4287
|
colors: t = Zt,
|
|
4288
4288
|
animated: i = !0,
|
|
4289
4289
|
animationOptions: r,
|
|
4290
|
-
formatter: o =
|
|
4290
|
+
formatter: o = Pa,
|
|
4291
4291
|
isLoading: a = !1
|
|
4292
4292
|
}) {
|
|
4293
4293
|
const l = Wa(e, t);
|
|
4294
4294
|
return a ? /* @__PURE__ */ n(Cn, {}) : /* @__PURE__ */ n("div", { children: l.map((d, s) => /* @__PURE__ */ v(Oa, { children: [
|
|
4295
4295
|
/* @__PURE__ */ n(
|
|
4296
|
-
|
|
4296
|
+
$a,
|
|
4297
4297
|
{
|
|
4298
4298
|
row: d,
|
|
4299
4299
|
animated: i,
|
|
@@ -4369,7 +4369,7 @@ function gs({
|
|
|
4369
4369
|
borderWidth: 0,
|
|
4370
4370
|
formatter: k
|
|
4371
4371
|
}, x = {
|
|
4372
|
-
data: b ? g.map((L,
|
|
4372
|
+
data: b ? g.map((L, P) => e[P]) : (g[0] ?? []).map((L) => L.name),
|
|
4373
4373
|
selectedMode: !1,
|
|
4374
4374
|
type: "scroll",
|
|
4375
4375
|
left: B,
|
|
@@ -4404,7 +4404,7 @@ function gs({
|
|
|
4404
4404
|
color: c.palette.text.primary
|
|
4405
4405
|
}
|
|
4406
4406
|
}, A = {
|
|
4407
|
-
formatter: ({ name: L, percent:
|
|
4407
|
+
formatter: ({ name: L, percent: P }) => `{per|${l(P)}%}
|
|
4408
4408
|
{b|${L}}`,
|
|
4409
4409
|
position: "center",
|
|
4410
4410
|
rich: {
|
|
@@ -4423,17 +4423,17 @@ function gs({
|
|
|
4423
4423
|
color: c.palette.text.primary
|
|
4424
4424
|
}
|
|
4425
4425
|
}
|
|
4426
|
-
}, T = g.map((L,
|
|
4427
|
-
var
|
|
4426
|
+
}, T = g.map((L, P) => {
|
|
4427
|
+
var $;
|
|
4428
4428
|
return {
|
|
4429
4429
|
type: "pie",
|
|
4430
|
-
name: e[
|
|
4430
|
+
name: e[P],
|
|
4431
4431
|
itemStyle: {
|
|
4432
|
-
color: (
|
|
4432
|
+
color: ($ = L[0]) == null ? void 0 : $.color
|
|
4433
4433
|
},
|
|
4434
4434
|
animation: a,
|
|
4435
4435
|
data: L.map((W) => ({ ...W, itemStyle: { color: W.color } })),
|
|
4436
|
-
radius:
|
|
4436
|
+
radius: P === 0 ? ["75%", "90%"] : ["56%", "72%"],
|
|
4437
4437
|
selectedOffset: 0,
|
|
4438
4438
|
hoverOffset: 5,
|
|
4439
4439
|
bottom: B * 2.5,
|
|
@@ -4549,14 +4549,14 @@ const ja = m(fe, {
|
|
|
4549
4549
|
width: t.spacing(3),
|
|
4550
4550
|
transform: `rotate(${e ? "180" : "0"}deg)`,
|
|
4551
4551
|
backgroundColor: e ? t.palette.action.hover : void 0
|
|
4552
|
-
})), Ya = m(
|
|
4552
|
+
})), Ya = m(Pe, {
|
|
4553
4553
|
shouldForwardProp: (e) => e !== "disabled"
|
|
4554
4554
|
})(({ disabled: e, theme: t }) => ({
|
|
4555
4555
|
...e && {
|
|
4556
4556
|
pointerEvents: "none",
|
|
4557
4557
|
color: t.palette.text.disabled
|
|
4558
4558
|
}
|
|
4559
|
-
})), Va = m(
|
|
4559
|
+
})), Va = m(Pe)(() => ({
|
|
4560
4560
|
"&.Mui-disabled": {
|
|
4561
4561
|
opacity: 1
|
|
4562
4562
|
}
|
|
@@ -4977,31 +4977,30 @@ function cl({
|
|
|
4977
4977
|
}
|
|
4978
4978
|
function Lt({
|
|
4979
4979
|
title: e,
|
|
4980
|
-
visible: t
|
|
4981
|
-
typographyProps: i
|
|
4980
|
+
visible: t
|
|
4982
4981
|
}) {
|
|
4983
|
-
const
|
|
4982
|
+
const i = re(null), [r, o] = _(!1);
|
|
4984
4983
|
an(() => {
|
|
4985
|
-
if (t &&
|
|
4986
|
-
const { offsetWidth:
|
|
4987
|
-
|
|
4984
|
+
if (t && i.current) {
|
|
4985
|
+
const { offsetWidth: l, scrollWidth: d } = i.current;
|
|
4986
|
+
o(l < d);
|
|
4988
4987
|
}
|
|
4989
4988
|
}, [e, t]);
|
|
4990
|
-
const
|
|
4989
|
+
const a = /* @__PURE__ */ n(
|
|
4991
4990
|
z,
|
|
4992
4991
|
{
|
|
4993
|
-
ref:
|
|
4992
|
+
ref: i,
|
|
4994
4993
|
color: t ? "textPrimary" : "textSecondary",
|
|
4995
|
-
|
|
4994
|
+
variant: "caption",
|
|
4995
|
+
weight: "regular",
|
|
4996
4996
|
component: "p",
|
|
4997
4997
|
noWrap: !0,
|
|
4998
4998
|
my: 0.25,
|
|
4999
4999
|
textTransform: "none",
|
|
5000
|
-
...i,
|
|
5001
5000
|
children: e
|
|
5002
5001
|
}
|
|
5003
5002
|
);
|
|
5004
|
-
return
|
|
5003
|
+
return r ? /* @__PURE__ */ n(ue, { title: e, children: a }) : a;
|
|
5005
5004
|
}
|
|
5006
5005
|
var Ie = /* @__PURE__ */ ((e) => (e.CATEGORY = "category", e.ICON = "icon", e.CONTINUOUS_RAMP = "continuous_ramp", e.BINS = "bins", e.PROPORTION = "proportion", e))(Ie || {});
|
|
5007
5006
|
const ut = 20;
|
|
@@ -5115,14 +5114,7 @@ function hl({
|
|
|
5115
5114
|
color: i
|
|
5116
5115
|
}
|
|
5117
5116
|
),
|
|
5118
|
-
/* @__PURE__ */ n(
|
|
5119
|
-
Lt,
|
|
5120
|
-
{
|
|
5121
|
-
title: e,
|
|
5122
|
-
visible: !0,
|
|
5123
|
-
typographyProps: { variant: "overline", my: 0.75 }
|
|
5124
|
-
}
|
|
5125
|
-
)
|
|
5117
|
+
/* @__PURE__ */ n(Lt, { title: e, visible: !0 })
|
|
5126
5118
|
] });
|
|
5127
5119
|
}
|
|
5128
5120
|
const Ze = 6, rt = {
|
|
@@ -5227,14 +5219,7 @@ function kl({
|
|
|
5227
5219
|
height: pt
|
|
5228
5220
|
}
|
|
5229
5221
|
) }),
|
|
5230
|
-
/* @__PURE__ */ n(
|
|
5231
|
-
Lt,
|
|
5232
|
-
{
|
|
5233
|
-
visible: !0,
|
|
5234
|
-
title: r,
|
|
5235
|
-
typographyProps: { variant: "overline", my: 0.75 }
|
|
5236
|
-
}
|
|
5237
|
-
)
|
|
5222
|
+
/* @__PURE__ */ n(Lt, { visible: !0, title: r })
|
|
5238
5223
|
] }, r)) });
|
|
5239
5224
|
}
|
|
5240
5225
|
function Sl(e) {
|
|
@@ -5368,7 +5353,7 @@ function Ll({
|
|
|
5368
5353
|
}
|
|
5369
5354
|
}
|
|
5370
5355
|
},
|
|
5371
|
-
children: u.map((c) => /* @__PURE__ */ n(
|
|
5356
|
+
children: u.map((c) => /* @__PURE__ */ n(Pe, { value: c.value, children: /* @__PURE__ */ n(gi, { primary: c.label }) }, c.value))
|
|
5372
5357
|
}
|
|
5373
5358
|
)
|
|
5374
5359
|
] }) : null,
|
|
@@ -5390,13 +5375,13 @@ function tn({
|
|
|
5390
5375
|
minZoom: d = 0,
|
|
5391
5376
|
currentZoom: s = 0
|
|
5392
5377
|
}) {
|
|
5393
|
-
const u = se(), p = ce(u), c = re(null), [y, g] = _(!1), f = t.id, w = t.title, h = t.visible ?? !0, b = t.switchable ?? !0, k = t.collapsed ?? !1, M = (t.collapsible ?? !0) && !Vn(t.legend), C = t.opacity ?? 1, x = t.showOpacityControl ?? !0, A = h && !k, T = A ? /* @__PURE__ */ n(fn, {}) : /* @__PURE__ */ n(mn, {}), O = (t == null ? void 0 : t.minZoom) !== void 0 || (t == null ? void 0 : t.maxZoom) !== void 0, L = t.minZoom ?? d,
|
|
5378
|
+
const u = se(), p = ce(u), c = re(null), [y, g] = _(!1), f = t.id, w = t.title, h = t.visible ?? !0, b = t.switchable ?? !0, k = t.collapsed ?? !1, M = (t.collapsible ?? !0) && !Vn(t.legend), C = t.opacity ?? 1, x = t.showOpacityControl ?? !0, A = h && !k, T = A ? /* @__PURE__ */ n(fn, {}) : /* @__PURE__ */ n(mn, {}), O = (t == null ? void 0 : t.minZoom) !== void 0 || (t == null ? void 0 : t.maxZoom) !== void 0, L = t.minZoom ?? d, P = t.maxZoom ?? l, $ = O && (L > d || P < l), W = s < L || s > P, J = $l({
|
|
5394
5379
|
intl: p,
|
|
5395
5380
|
minZoom: d,
|
|
5396
5381
|
maxZoom: l,
|
|
5397
5382
|
layerMinZoom: L,
|
|
5398
|
-
layerMaxZoom:
|
|
5399
|
-
}), G = t.helperText ?? (
|
|
5383
|
+
layerMaxZoom: P
|
|
5384
|
+
}), G = t.helperText ?? ($ ? J : ""), E = F(() => t.legend ? Array.isArray(t.legend) ? t.legend : [t.legend] : [], [t.legend]);
|
|
5400
5385
|
return t.legend ? /* @__PURE__ */ v(ll, { "data-testid": "legend-layer", "aria-label": w, children: [
|
|
5401
5386
|
/* @__PURE__ */ v(tl, { ref: c, children: [
|
|
5402
5387
|
M && /* @__PURE__ */ n(
|
|
@@ -5413,7 +5398,7 @@ function tn({
|
|
|
5413
5398
|
),
|
|
5414
5399
|
/* @__PURE__ */ v(sl, { children: [
|
|
5415
5400
|
/* @__PURE__ */ n(Lt, { visible: h, title: w ?? "" }),
|
|
5416
|
-
|
|
5401
|
+
$ && /* @__PURE__ */ n(
|
|
5417
5402
|
ue,
|
|
5418
5403
|
{
|
|
5419
5404
|
title: p.formatMessage({
|
|
@@ -5501,7 +5486,7 @@ function tn({
|
|
|
5501
5486
|
] })
|
|
5502
5487
|
] }) : null;
|
|
5503
5488
|
}
|
|
5504
|
-
function
|
|
5489
|
+
function $l({
|
|
5505
5490
|
intl: e,
|
|
5506
5491
|
minZoom: t,
|
|
5507
5492
|
maxZoom: i,
|
|
@@ -5513,10 +5498,10 @@ function Pl({
|
|
|
5513
5498
|
}), s = e.formatMessage({ id: "c4r.widgets.legend.zoomNote" }), u = o < i ? `${l} ${o}` : "", p = r > t ? `${d} ${r}` : "", c = [u, p].filter(Boolean).join(` ${a} `);
|
|
5514
5499
|
return c ? `${s} ${c}` : "";
|
|
5515
5500
|
}
|
|
5516
|
-
const
|
|
5501
|
+
const Pl = {}, He = () => {
|
|
5517
5502
|
}, Ol = [];
|
|
5518
5503
|
function fs({
|
|
5519
|
-
customLegendTypes: e =
|
|
5504
|
+
customLegendTypes: e = Pl,
|
|
5520
5505
|
layers: t = Ol,
|
|
5521
5506
|
collapsed: i = !1,
|
|
5522
5507
|
onChangeCollapsed: r = He,
|
|
@@ -5615,7 +5600,7 @@ function ms({
|
|
|
5615
5600
|
severity: i = void 0,
|
|
5616
5601
|
...r
|
|
5617
5602
|
}) {
|
|
5618
|
-
return i ? /* @__PURE__ */ n(
|
|
5603
|
+
return i ? /* @__PURE__ */ n($i, { title: e, severity: i, ...r, children: /* @__PURE__ */ n(nn, { children: t }) }) : /* @__PURE__ */ v(S, { ...r, children: [
|
|
5619
5604
|
e && /* @__PURE__ */ n(z, { variant: "body2", children: e }),
|
|
5620
5605
|
/* @__PURE__ */ n(nn, { color: "textSecondary", children: t })
|
|
5621
5606
|
] });
|
|
@@ -5643,7 +5628,7 @@ const Wl = m(S, {
|
|
|
5643
5628
|
width: "100%",
|
|
5644
5629
|
...t ? { minHeight: e.spacing(3) } : { height: e.spacing(3) },
|
|
5645
5630
|
padding: 0
|
|
5646
|
-
})), Nl = m(
|
|
5631
|
+
})), Nl = m($e, {
|
|
5647
5632
|
shouldForwardProp: (e) => e !== "expandable"
|
|
5648
5633
|
})(({ theme: e, expandable: t = !0 }) => ({
|
|
5649
5634
|
flex: 1,
|
|
@@ -5716,10 +5701,10 @@ function ys({
|
|
|
5716
5701
|
const f = ni(), [w, h] = _(!0), b = s !== void 0 && u !== void 0, k = d !== !1 ? b ? s : w : !0, M = b ? u : h, [C, x] = _(null), A = !!C, T = () => {
|
|
5717
5702
|
d && M(!k);
|
|
5718
5703
|
}, O = (W) => x(W.currentTarget), L = () => x(null);
|
|
5719
|
-
function
|
|
5704
|
+
function P(W) {
|
|
5720
5705
|
W && W(), L();
|
|
5721
5706
|
}
|
|
5722
|
-
const
|
|
5707
|
+
const $ = (W) => /* @__PURE__ */ n(
|
|
5723
5708
|
rn,
|
|
5724
5709
|
{
|
|
5725
5710
|
"aria-label": W.label,
|
|
@@ -5749,10 +5734,10 @@ function ys({
|
|
|
5749
5734
|
{
|
|
5750
5735
|
title: W.tooltip.text,
|
|
5751
5736
|
placement: W.tooltip.placement ?? "top",
|
|
5752
|
-
children:
|
|
5737
|
+
children: $(W)
|
|
5753
5738
|
},
|
|
5754
5739
|
W.id
|
|
5755
|
-
) :
|
|
5740
|
+
) : $(W)),
|
|
5756
5741
|
i.length > 0 && /* @__PURE__ */ v(ie, { children: [
|
|
5757
5742
|
/* @__PURE__ */ n(
|
|
5758
5743
|
rn,
|
|
@@ -5783,10 +5768,10 @@ function ys({
|
|
|
5783
5768
|
open: A,
|
|
5784
5769
|
onClose: L,
|
|
5785
5770
|
children: i.map((W) => /* @__PURE__ */ n(
|
|
5786
|
-
|
|
5771
|
+
Pe,
|
|
5787
5772
|
{
|
|
5788
5773
|
selected: W.selected,
|
|
5789
|
-
onClick: () =>
|
|
5774
|
+
onClick: () => P(W.action),
|
|
5790
5775
|
children: W.name
|
|
5791
5776
|
},
|
|
5792
5777
|
W.id
|