UNPKG

@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.25 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),h=require("react");class g extends h.Component{constructor(l){super(l)}formatNumber(l){const{intl:i,format:a}=this.props;return i.formatNumber(a.style==="percent"?l/100:l,{style:a.style,notation:a.notation,maximumFractionDigits:a.maximumFractionDigits,minimuFractionDigits:0,currency:a.currency})}render(){const{filteredBreaks:l,formattedLegendTitle:i,showLegendLabels:a,symbols:m,legendFontSize:o,legendFontWeight:d,autoGenerateBreaks:n,intl:N,numberFormat:b,mapNoDataColor:u,showNoDataLegendItem:c,noDataText:x}=this.props,t={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}}),a&&!n&&e.jsx("span",{className:"legend-label",style:t,children:s.label}),(!a||n)&&s.min!=null&&s.max!=null&&e.jsxs("span",{className:"legend-label",style:t,children:[this.formatNumber(s.min)," -"," ",this.formatNumber(s.max)]}),(!a||n)&&s.min==null&&s.max!=null&&e.jsxs("span",{className:"legend-label",style:t,children:[" ","< ",this.formatNumber(s.max)]}),(!a||n)&&s.min!=null&&s.max==null&&e.jsxs("span",{className:"legend-label",style:t,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:u}}),e.jsx("span",{className:"legend-label",style:t,children:x})]}),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:t,children:s.label?s.label:""})]},"k"+r))]})})]})}}exports.default=g;