@devgateway/dvz-ui-react
Version:
A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.
2 lines (1 loc) • 2.16 kB
JavaScript
"use strict";const e=require("react/jsx-runtime"),u=require("react");class p extends u.Component{constructor(l){super(l)}formatNumber(l){const{intl:i,format:n}=this.props;return i.formatNumber(n.style==="percent"?l/100:l,{style:n.style,notation:n.notation,maximumFractionDigits:n.maximumFractionDigits,minimuFractionDigits:0,currency:n.currency})}render(){const{filteredBreaks:l,formattedLegendTitle:i,showLegendLabels:n,symbols:m,legendFontSize:o,legendFontWeight:d,autoGenerateBreaks:t,intl:N,numberFormat:j,mapNoDataColor:x,showNoDataLegendItem:c,noDataText:h}=this.props,a={fontSize:o+"px",fontWeight:d};return e.jsxs("div",{className:"legend-container",children:[e.jsxs("div",{className:"legend-title-container",children:[e.jsx("span",{className:"legend-title",children:l&&l.length>0?i:""}),l.length>0&&e.jsx("span",{className:"vertical-spacer",children:"|"})]}),e.jsx("div",{className:"legend",children:e.jsxs("ul",{className:"legend-items-container",children:[l&&l.map((s,r)=>e.jsxs("li",{className:"legend-item",children:[e.jsx("span",{className:"symbol",style:{backgroundColor:s.color}}),n&&!t&&e.jsx("span",{className:"legend-label",style:a,children:s.label}),(!n||t)&&s.min!=null&&s.max!=null&&e.jsxs("span",{className:"legend-label",style:a,children:[this.formatNumber(s.min)," -"," ",this.formatNumber(s.max)]}),(!n||t)&&s.min==null&&s.max!=null&&e.jsxs("span",{className:"legend-label",style:a,children:[" ","< ",this.formatNumber(s.max)]}),(!n||t)&&s.min!=null&&s.max==null&&e.jsxs("span",{className:"legend-label",style:a,children:[" ","> ",this.formatNumber(s.min)," "]})]},"lg"+r)),console.log("showNoDataLegendItem",c),c&&e.jsxs("li",{className:"legend-item",children:[e.jsx("span",{className:"symbol",style:{backgroundColor:x}}),e.jsx("span",{className:"legend-label",style:a,children:h})]}),m&&m.map((s,r)=>e.jsxs("li",{className:"legend-item",children:[e.jsx("span",{className:"vertical-spacer",children:"|"}),s.image&&e.jsx("img",{style:{width:"40px",height:"40px",marginTop:"-8px",marginRight:"-4px"},src:"/"+s.image}),e.jsx("span",{className:"legend-label",style:a,children:s.label?s.label:""})]},"k"+r))]})})]})}}module.exports=p;