@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.
3 lines (2 loc) • 6.52 kB
JavaScript
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime");require("react");const je=require("react-redux"),qe=require("../data/DataProvider.js"),Ve=require("../data/DataConsumer.js"),We=require("./map.js"),Ge=require("./MapDataFrame.js"),Ze=require("./MapCSVDataFrame.js"),He=[{label:"KENYA",value:"KEN",center:[35.8166634,.1],scale:2e3},{label:"Nigeria",value:"NGA",center:[7.491302,9.072264],scale:2e3},{label:"South Africa",value:"ZAF",center:[24.676997,-28.48322],scale:2e3},{label:"West Africa",value:"West Africa",center:[-7.293255,13.90572],scale:1500},{label:"Africa",value:"Africa",center:[13.134227,-11.523088],scale:550},{label:"Ethiopia",value:"ETH",center:[35.8166634,1.7],scale:2e3},{label:"Zambia",value:"ZMB",center:[26.459455,-14.668135],scale:2e3},{label:"Democratic Republic of the Congo",value:"DRC",center:[23.174338,-5.837475],scale:1250},{label:"World",value:"World",center:[0,20.050043],scale:150}],Je=n=>r.jsx(Ke,{...n}),Ke=n=>{var U;const{unique:m,editing:s,"data-filters":P="{}","data-app":d="csv","data-csv":k="","data-dimension1":E="","data-dimension2":M="","data-measures":u='["prevalenceSmokeAny"]',"data-height":O=600,width:j=960,"data-data-source-text":q="NIDS","data-data-source-label":V="Source","data-national-average-label":W="National Prevalence Avg","data-legend-title":G="Tobacco Prevalence Rate","data-legend-breaks":Z="[]","data-zoom-enabled":g=!1,"data-show-legend-labels":h=!1,"data-map-file":H,"data-mapping-field":J="zone","data-map-label-field":K="admin","data-has-multiple-measures":v="false",topoJSONField:_="collection","data-map-center":Y="NGA","data-map-label-show-value":y="false","data-show-tooltip":C="true","data-measure-selector-label":$="","data-value-format":Q="","data-show-overall-value":F="false","data-auto-generate-breaks":L="false","data-number-of-breaks":X=5,"data-scheme":ee="reds","data-show-no-data-label":w="false","data-group":S="default","data-map-symbols":ae="[]","data-tooltip-theme":te="map-tooltip-dark","data-label-font-size":oe=12,"data-label-font-weight":le="normal","data-label-font-color":re="#595959","data-legend-font-size":ne=12,"data-legend-font-weight":se="normal","data-custom-tooltips":de="[]","data-format-style":p="decimal","data-decimals":D="2","data-currency":ie="","data-tooltip-font-size":ce=14,"data-show-admin-unit-label":me="showAll","data-map-no-data-color":ue="#f8f8f8","data-map-boundary-color":pe="#000","data-map-focus-boundary-color":fe="#000","data-highlighted-location":be="","data-tooltip-format":ge=`{locationName} %({value},2)
{label}: %({value},2)`,"data-show-no-data-tooltip":I="false","data-map-container-bg-color":he="#fff","data-map-position":ve="{}","data-main-layer-id":ye="","data-enabled-layers":Ce,"data-point-label-color":Fe="#fff","data-point-label-format":Le="{locationName} %({value},2)","data-show-no-data-legend-item":N=!1,"data-highlighted-loc-label-format":we="{locationName} - Score: #({value},2)","data-enable-summary-view":Qe="false","data-map-type":x="DEFAULT","data-default-point-color":Se="#FFFF00","data-aggregation-formula":De="COUNT","data-zoom-level-to-show-points":Ie=2,"data-zoom-on-filter":T="false","data-zoom-on-filter-field":Ne="","data-no-data-text":xe="No Data","data-labels-exclusion-list":Te="","data-custom-measure-labels":ze="{}","data-show-shading-layer-labels":Re="ifUnitHasData","data-dvz-proxy-dataset-id":f,"data-recently-toggled-layer-id":Ae=null,intl:Xe,settings:ea}=n,Ue=e=>s?e:decodeURIComponent(e),o=e=>{try{if(e)return JSON.parse(Ue(e))}catch{console.error("error parsing value:"+e)}return null},Be=e=>{let t=o(e)||[];return t=t.map(a=>(a.min&&(a.min=parseFloat(a.min)),a.max&&(a.max=parseFloat(a.max)),a.color=decodeURIComponent(a.color),a)),t},Pe=e=>{const t=o(e)||[];let a={};return t&&t.forEach?t.forEach(c=>{c.value!=null&&c.value.filter(B=>B!=null&&B.toString().trim()!="").length>0&&(a[c.param]=c.value)}):a=t,a},ke={style:p==="compacted"?"decimal":p,notation:p==="compacted"?"compact":"standard",currency:ie,minimumFractionDigits:parseInt(D),maximumFractionDigits:parseInt(D)};let b=o(Ce)||[];b=b.map(e=>(e.bgColor=decodeURIComponent(e.bgColor),e.fontColor=decodeURIComponent(e.fontColor),e));const z=He.find(e=>e.value===Y),R=v==!0||v=="true";let l=[E,M].filter(e=>e!="none"&&e!=null).join("/");const i={unique:m,editing:s,source:`/${H}`,center:z.center,scale:z.scale,measures:u,legendTitle:G,height:O,width:j,topoJSONField:_,mappingField:J,dataSourceText:q,dataSourceLabel:V,nationalAverageLabel:W,legendBreaks:Be(Z),mapLabelField:K,zoomEnabled:g==!0||g=="true",showLegendLabels:h==!0||h=="true",multipleMeasures:R,app:d,mapLabelShowValue:y==!0||y=="true",showTooltip:C==!0||C=="true",showOverallValue:F==!0||F=="true",measureSelectorLabel:$,valueFormat:Q,autoGenerateBreaks:L==!0||L=="true",showNoDataLabel:w==!0||w=="true",numberOfBreaks:X,colorScheme:ee,group:S,symbols:o(ae)||[],tooltipTheme:te,labelFontSize:oe,labelFontColor:decodeURIComponent(re),labelFontWeight:le,legendFontSize:ne,legendFontWeight:se,customTooltips:o(de)||[],format:ke,tooltipFontSize:ce,showAdminUnitLabel:me,mapNoDataColor:decodeURIComponent(ue),mapBoundaryColor:decodeURIComponent(pe),mapFocusBoundaryColor:decodeURIComponent(fe),highlightedLocation:be,tooltipFormat:ge,showNoDataTooltip:I==!0||I=="true",fields:l.split("/"),mapContainerBgColor:decodeURIComponent(he),mapPosition:o(ve),mainLayerId:ye,enabledLayers:b,pointLabelColor:decodeURIComponent(Fe),pointLabelFormat:Le,showNoDataLegendItem:N==!0||N=="true",highlightedLocLabelFormat:we,mapType:x,defaultPointColor:decodeURIComponent(Se),zoomLevelToShowPoints:Ie,zoomOnFilter:T==!0||T=="true",zoomOnFilterField:Ne,noDataText:xe,labelsExclusionList:Te.split(",").map(e=>e.trim()),showShadingLayerLabels:Re,dvzProxyDatasetId:f,recentlyToggledLayerId:Ae};if(i.recentlyToggledLayerId){const e=i.enabledLayers.find(t=>String(t.id)===String(i.recentlyToggledLayerId));e&&(e!=null&&e.apiField)&&(l=(U=e.apiField)==null?void 0:U.toLowerCase())}const Ee=o(ze)||{},Me=d==="csv"?Ze.default:Ge.default,Oe=s?(o(u)||[]).join(","):u,A=Pe(P);return f&&(A.dvzProxyDatasetId=f),r.jsx(qe.default,{params:A,app:d,csv:decodeURIComponent(k),group:S,editing:s,store:[d,m,...l.split("/")],source:l,children:r.jsx(Ve.default,{children:r.jsx(Me,{measures:Oe,multipleMeasures:R,mapType:x,aggregationFormula:De,customMeasureLabels:Ee,source:l,children:r.jsx(We.default,{...i})})})})},_e=(n,m)=>({}),Ye={},$e=je.connect(_e,Ye)(Je);exports.default=$e;