@devgateway/dvz-ui-react 1.9.9 → 1.9.10

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const K=require("react"),ee=x=>{var P,j;const{data:l,measures:D,customMeasureLabels:h,children:W,source:B,extraDimension:A,allDimensions:C}=x;console.log("MapDataFrame props:",x);const T=(B||"").split("/").filter(Boolean),y=T.length>0?T[0]:null,i={locationsData:[],nationalData:{},measureLabelMap:{}};l.metadata&&l.metadata.measures&&Array.isArray(l.metadata.measures),l.children&&l.children[0]&&l.children[0].children;const L=l.metadata||{},q=["value","count","type","children","label","measure"],O=C&&C.length>0?C:L.types||[],b={};O.forEach(e=>{const n=e.category||e.type;n&&(b[n]=e.items||[])});const w=(e,n)=>{const a=b[e];if(!a)return null;const t=n!=null?String(n):n;return a.find(r=>{const o=r.value!=null?String(r.value):r.value,c=r.id!=null?String(r.id):r.id,s=r.code!=null?String(r.code):r.code;return o===t||c===t||s===t})||null},f=(e,n)=>{const a=w(e,n);return a?a.value??a.label??a.id??a.code??n:n},J=(e={})=>{const n={};return Object.keys(e).forEach(a=>{const t=e[a];t!=null&&(Array.isArray(t)?n[a]=t.map(r=>f(a,r)).join(" ,"):n[a]=f(a,t))}),n},$=e=>{const n=b[e]||[];return n.length===1?f(e,n[0].value??n[0].id??n[0].code):null},d=e=>e!=null&&e!=="",R=e=>{if(e)return d(e.value)?e.value:d(e.id)?e.id:e.code},V=e=>e==null?"":String(e).trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),v=(e,n)=>{if(!e)return;const a=V(n),t=e[n];if(t!=null&&t!=="")return t;const r=Object.keys(e);for(let o=0;o<r.length;o++){const c=r[o];if(V(c)===a){const s=e[c];if(s!=null&&s!=="")return s}}},G=(e,n)=>{const a=[y,"country",e.type].filter(Boolean),t=[v(n,"country"),v(e,"country"),y?v(n,y):void 0,y?v(e,y):void 0,e.label,e.value].filter(r=>d(r));for(let r=0;r<a.length;r++){const o=a[r],c=b[o]||[];if(c.length)for(let s=0;s<t.length;s++){const g=t[s],U=V(g),N=c.findIndex(k=>{const m=R(k);return V(m)===U});if(N>=0)return N}}return-1},H=(e,n,a)=>{const t=G(n,a);if(t<0)return;const r=b[e]||[];if(!r.length||t>=r.length)return;const o=R(r[t]);if(d(o))return f(e,o)},Q=(e,n,a)=>{const t=v(a,e);if(d(t))return t;if(d(S[e]))return S[e];const r=v(n,e);if(d(r))return r;const o=H(e,n,a);if(d(o))return o;const c=$(e);if(d(c))return c;const s=n.value;return w(e,s)?f(e,s):""},E=l.appliedFilters||{};if(A){const e=E[A]?E[A][0]:void 0;f(A,e)}const S=J(E),X=e=>{const n={};return Object.keys(e).forEach(a=>{q.includes(a)||(n[a]=e[a])}),e.type&&e.value!==void 0&&(n[e.type]=f(e.type,e.value)),n},F=e=>{let n=X(e);return e.children&&Array.isArray(e.children)&&e.children.forEach(a=>{n={...n,...F(a)}}),n},_=(e,n)=>{if(!(!e.children||!Array.isArray(e.children)))return e.children.map(a=>({...a,label:a.value,value:a[n],variables:F(a),children:_(a,n)}))};L.measures&&L.measures.forEach(e=>{h&&h[e.value]&&h[e.value].hasCustomLabel&&h[e.value].customLabel?i.measureLabelMap[e.value]=h[e.value].customLabel:i.measureLabelMap[e.value]=e.label});const z=(((P=l==null?void 0:l.metadata)==null?void 0:P.measures)||[]).map(e=>e==null?void 0:e.value).filter(Boolean),u=(()=>{if(Array.isArray(D))return D.map(e=>(""+e).trim()).filter(Boolean);if(typeof D=="string"){const e=D.trim();if(!e||e==="[]")return z;if(e.startsWith("[")&&e.endsWith("]"))try{const n=JSON.parse(e);if(Array.isArray(n))return n.map(a=>(""+a).trim()).filter(Boolean)}catch{}return e.split(",").map(n=>n.trim()).filter(Boolean)}return z})(),M=((j=l==null?void 0:l.metadata)==null?void 0:j.types)||[],Y=(B||"").split("/")[0],Z=M.find(e=>e.dimension===Y)||M[0],I=(e,n)=>{var o;if(typeof(e==null?void 0:e.value)=="string")return e.value;const t=M.find(c=>c.dimension===(e==null?void 0:e.type))||Z,r=(o=t==null?void 0:t.items)==null?void 0:o[n];return(r==null?void 0:r.value)||(r==null?void 0:r.code)||(e==null?void 0:e.label)||(e==null?void 0:e.value)},p=(e,n)=>{if(e&&Object.prototype.hasOwnProperty.call(e,n))return e[n];if(n==="value")return e==null?void 0:e.value};if(l&&l.children){l.children.forEach((n,a)=>{const t=I(n,a);u.forEach(r=>{const o={...F(n),...S};O.forEach(s=>{const g=s.category||s.type;g&&(o[g]=Q(g,n,o))});const c={...n,label:t,value:p(n,r),measure:r,variables:o};c.variables.selectedDataFrameTooltipValue=p(n,r),n.children&&(c.children=[],n.children.forEach(s=>{c.children.push({...s,label:s.value,value:p(s,r)})})),c.children=_(n,r),i.locationsData.push(c)})}),i.measures=u.length>1?u:null;const e=u.length>0?u[0]:null;i.nationalData.value=e?p(l,e):null}else if(l&&u.length>0){const e=typeof l.value=="string"&&l.value||l.label||l.type||"total";u.forEach(n=>{const a=p(l,n);a!==void 0&&i.locationsData.push({label:e,value:a,measure:n})}),i.measures=u.length>1?u:null,i.nationalData.value=p(l,u[0])}return K.Children.map(W,e=>K.cloneElement(e,{transformedData:{...i,types:M}}))};exports.default=ee;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const q=require("react"),re=F=>{var N,K;const{data:o,measures:D,customMeasureLabels:y,children:J,source:x,extraDimension:f,allDimensions:C}=F;console.log("MapDataFrame props:",F);const B=(x||"").split("/").filter(Boolean),b=B.length>0?B[0]:null,d={locationsData:[],nationalData:{},measureLabelMap:{}};o.metadata&&o.metadata.measures&&Array.isArray(o.metadata.measures),o.children&&o.children[0]&&o.children[0].children;const E=o.metadata||{},$=["value","count","type","children","label","measure"],T=C&&C.length>0?C:E.types||[],V={};T.forEach(e=>{const n=e.category||e.type;n&&(V[n]=e.items||[])});const O=(e,n)=>{const r=V[e];if(!r)return null;const t=n!=null?String(n):n;return r.find(a=>{const l=a.value!=null?String(a.value):a.value,i=a.id!=null?String(a.id):a.id,s=a.code!=null?String(a.code):a.code;return l===t||i===t||s===t})||null},v=(e,n)=>{const r=O(e,n);return r?r.value??r.label??r.id??r.code??n:n},G=(e={})=>{const n={};return Object.keys(e).forEach(r=>{const t=e[r];t!=null&&(Array.isArray(t)?n[r]=t.map(a=>v(r,a)).join(" ,"):n[r]=v(r,t))}),n},H=e=>{const n=V[e]||[];return n.length===1?v(e,n[0].value??n[0].id??n[0].code):null},c=e=>e!=null&&e!=="",w=e=>{if(e)return c(e.value)?e.value:c(e.id)?e.id:e.code},A=e=>e==null?"":String(e).trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),p=(e,n)=>{if(!e)return;const r=A(n),t=e[n];if(t!=null&&t!=="")return t;const a=Object.keys(e);for(let l=0;l<a.length;l++){const i=a[l];if(A(i)===r){const s=e[i];if(s!=null&&s!=="")return s}}},Q=e=>Array.isArray(e)?e.length>0?e[0]:void 0:e,X=(e,n)=>{const r=[b,"country",e.type].filter(Boolean),t=[p(n,"country"),p(e,"country"),b?p(n,b):void 0,b?p(e,b):void 0,e.label,e.value].filter(a=>c(a));for(let a=0;a<r.length;a++){const l=r[a],i=V[l]||[];if(i.length)for(let s=0;s<t.length;s++){const h=t[s],m=A(h),W=i.findIndex(ee=>{const ne=w(ee);return A(ne)===m});if(W>=0)return W}}return-1},Y=(e,n,r)=>{const t=X(n,r);if(t<0)return;const a=V[e]||[];if(!a.length||t>=a.length)return;const l=w(a[t]);if(c(l))return v(e,l)},R=(e,n,r)=>{const t=p(r,e);if(c(t))return t;if(c(L[e]))return L[e];const a=p(n,e);if(c(a))return a;const l=Y(e,n,r);if(c(l))return l;const i=H(e);if(c(i))return i;const s=n.value;return O(e,s)?v(e,s):""},_=o.appliedFilters||{};let z="";if(f){const e=p(_,f),n=Q(e);z=v(f,n)||""}const L=G(_),Z=e=>{const n={};return Object.keys(e).forEach(r=>{$.includes(r)||(n[r]=e[r])}),e.type&&e.value!==void 0&&(n[e.type]=v(e.type,e.value)),n},S=e=>{let n=Z(e);return e.children&&Array.isArray(e.children)&&e.children.forEach(r=>{n={...n,...S(r)}}),n},P=(e,n)=>{if(!(!e.children||!Array.isArray(e.children)))return e.children.map(r=>({...r,label:r.value,value:r[n],variables:S(r),children:P(r,n)}))};E.measures&&E.measures.forEach(e=>{y&&y[e.value]&&y[e.value].hasCustomLabel&&y[e.value].customLabel?d.measureLabelMap[e.value]=y[e.value].customLabel:d.measureLabelMap[e.value]=e.label});const j=(((N=o==null?void 0:o.metadata)==null?void 0:N.measures)||[]).map(e=>e==null?void 0:e.value).filter(Boolean),u=(()=>{if(Array.isArray(D))return D.map(e=>(""+e).trim()).filter(Boolean);if(typeof D=="string"){const e=D.trim();if(!e||e==="[]")return j;if(e.startsWith("[")&&e.endsWith("]"))try{const n=JSON.parse(e);if(Array.isArray(n))return n.map(r=>(""+r).trim()).filter(Boolean)}catch{}return e.split(",").map(n=>n.trim()).filter(Boolean)}return j})(),M=((K=o==null?void 0:o.metadata)==null?void 0:K.types)||[],I=(x||"").split("/")[0],U=M.find(e=>e.dimension===I)||M[0],k=(e,n)=>{var l;if(typeof(e==null?void 0:e.value)=="string")return e.value;const t=M.find(i=>i.dimension===(e==null?void 0:e.type))||U,a=(l=t==null?void 0:t.items)==null?void 0:l[n];return(a==null?void 0:a.value)||(a==null?void 0:a.code)||(e==null?void 0:e.label)||(e==null?void 0:e.value)},g=(e,n)=>{if(e&&Object.prototype.hasOwnProperty.call(e,n))return e[n];if(n==="value")return e==null?void 0:e.value};if(o&&o.children){o.children.forEach((n,r)=>{const t=k(n,r);u.forEach(a=>{const l={...S(n),...L};if(T.forEach(s=>{const h=s.category||s.type;h&&(l[h]=R(h,n,l))}),f){const s=R(f,n,l);l[f]=c(s)?s:z,l.dimension3=l[f],l.additionalDimension=l[f]}const i={...n,label:t,value:g(n,a),measure:a,variables:l};i.variables.selectedDataFrameTooltipValue=g(n,a),n.children&&(i.children=[],n.children.forEach(s=>{i.children.push({...s,label:s.value,value:g(s,a)})})),i.children=P(n,a),d.locationsData.push(i)})}),d.measures=u.length>1?u:null;const e=u.length>0?u[0]:null;d.nationalData.value=e?g(o,e):null}else if(o&&u.length>0){const e=typeof o.value=="string"&&o.value||o.label||o.type||"total";u.forEach(n=>{const r=g(o,n);r!==void 0&&d.locationsData.push({label:e,value:r,measure:n})}),d.measures=u.length>1?u:null,d.nationalData.value=g(o,u[0])}return q.Children.map(J,e=>q.cloneElement(e,{transformedData:{...d,types:M}}))};exports.default=re;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),k=require("react"),C=require("react-redux"),Ke=require("../data/DataProvider.js"),_e=require("../data/DataConsumer.js"),Ye=require("../reducers/data.js"),$e=require("./map.js"),Qe=require("./MapDataFrame.js"),Xe=require("./MapCSVDataFrame.js"),ea=[{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}],aa=n=>i.jsx(ta,{...n}),ta=n=>{var E;const{unique:u,editing:d,"data-filters":q="{}","data-app":o="csv","data-csv":O="","data-dimension1":j="","data-dimension2":W="","data-dimension3":p="","data-measures":f="[]","data-height":V=600,width:G=960,"data-data-source-text":J="","data-data-source-label":Z="Source","data-national-average-label":H="National Average","data-legend-title":K="Legend Title","data-legend-breaks":_="[]","data-zoom-enabled":v=!1,"data-show-legend-labels":y=!1,"data-map-file":Y,"data-mapping-field":$="zone","data-map-label-field":Q="admin","data-has-multiple-measures":F="false",topoJSONField:X="collection","data-map-center":ee="NGA","data-map-label-show-value":L="false","data-show-tooltip":w="true","data-measure-selector-label":ae="","data-value-format":te="","data-show-overall-value":S="false","data-auto-generate-breaks":D="false","data-number-of-breaks":oe=5,"data-scheme":le="reds","data-show-no-data-label":I="false","data-group":x="default","data-map-symbols":re="[]","data-tooltip-theme":ne="map-tooltip-dark","data-label-font-size":se=12,"data-label-font-weight":ie="normal","data-label-font-color":de="#595959","data-legend-font-size":ce=12,"data-legend-font-weight":me="normal","data-custom-tooltips":ue="[]","data-format-style":g="decimal","data-decimals":N="2","data-currency":pe="","data-tooltip-font-size":fe=14,"data-show-admin-unit-label":ge="showAll","data-map-no-data-color":be="#f8f8f8","data-map-boundary-color":he="#000","data-map-focus-boundary-color":Ce="#000","data-highlighted-location":ve="","data-tooltip-format":ye=`{locationName} %({value},2)
2
- {label}: %({value},2)`,"data-show-no-data-tooltip":T="false","data-map-container-bg-color":Fe="#fff","data-map-position":Le="{}","data-main-layer-id":we="","data-enabled-layers":Se,"data-point-label-color":De="#fff","data-point-label-format":Ie="{locationName} %({value},2)","data-show-no-data-legend-item":z=!1,"data-highlighted-loc-label-format":xe="{locationName} - Score: #({value},2)","data-enable-summary-view":na="false","data-map-type":R="DEFAULT","data-default-point-color":Ne="#FFFF00","data-aggregation-formula":Te="COUNT","data-zoom-level-to-show-points":ze=2,"data-zoom-on-filter":U="false","data-zoom-on-filter-field":Re="","data-no-data-text":Ue="No Data","data-labels-exclusion-list":Ae="","data-custom-measure-labels":Be="{}","data-show-shading-layer-labels":Me="ifUnitHasData","data-dvz-proxy-dataset-id":r,"data-recently-toggled-layer-id":Ee=null,intl:sa,settings:ia}=n;console.log("MapWrapper props",n);const Pe=e=>d?e:decodeURIComponent(e),l=e=>{try{if(e)return JSON.parse(Pe(e))}catch{console.error("error parsing value:"+e)}return null},ke=e=>{let t=l(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},qe=e=>{const t=l(e)||[];let a={};return t&&t.forEach?t.forEach(m=>{m.value!=null&&m.value.filter(P=>P!=null&&P.toString().trim()!="").length>0&&(a[m.param]=m.value)}):a=t,a},Oe={style:g==="compacted"?"decimal":g,notation:g==="compacted"?"compact":"standard",currency:pe,minimumFractionDigits:parseInt(N),maximumFractionDigits:parseInt(N)};let b=l(Se)||[];b=b.map(e=>(e.bgColor=decodeURIComponent(e.bgColor),e.fontColor=decodeURIComponent(e.fontColor),e));const A=ea.find(e=>e.value===ee),B=F==!0||F=="true";let s=[j,W].filter(e=>e!=="none"&&e!==null).join("/");const je=p&&p!=="none"?p:null,c={unique:u,editing:d,source:`/${Y}`,center:A.center,scale:A.scale,measures:f,legendTitle:K,height:V,width:G,topoJSONField:X,mappingField:$,dataSourceText:J,dataSourceLabel:Z,nationalAverageLabel:H,legendBreaks:ke(_),mapLabelField:Q,zoomEnabled:v==!0||v=="true",showLegendLabels:y==!0||y=="true",multipleMeasures:B,app:o,mapLabelShowValue:L==!0||L=="true",showTooltip:w==!0||w=="true",showOverallValue:S==!0||S=="true",measureSelectorLabel:ae,valueFormat:te,autoGenerateBreaks:D==!0||D=="true",showNoDataLabel:I==!0||I=="true",numberOfBreaks:oe,colorScheme:le,group:x,symbols:l(re)||[],tooltipTheme:ne,labelFontSize:se,labelFontColor:decodeURIComponent(de),labelFontWeight:ie,legendFontSize:ce,legendFontWeight:me,customTooltips:l(ue)||[],format:Oe,tooltipFontSize:fe,showAdminUnitLabel:ge,mapNoDataColor:decodeURIComponent(be),mapBoundaryColor:decodeURIComponent(he),mapFocusBoundaryColor:decodeURIComponent(Ce),highlightedLocation:ve,tooltipFormat:ye,showNoDataTooltip:T==!0||T=="true",fields:s.split("/"),mapContainerBgColor:decodeURIComponent(Fe),mapPosition:l(Le),mainLayerId:we,enabledLayers:b,pointLabelColor:decodeURIComponent(De),pointLabelFormat:Ie,showNoDataLegendItem:z==!0||z=="true",highlightedLocLabelFormat:xe,mapType:R,defaultPointColor:decodeURIComponent(Ne),zoomLevelToShowPoints:ze,zoomOnFilter:U==!0||U=="true",zoomOnFilterField:Re,noDataText:Ue,labelsExclusionList:Ae.split(",").map(e=>e.trim()),showShadingLayerLabels:Me,dvzProxyDatasetId:r,recentlyToggledLayerId:Ee};if(c.recentlyToggledLayerId){const e=c.enabledLayers.find(t=>String(t.id)===String(c.recentlyToggledLayerId));e&&(e!=null&&e.apiField)&&(s=(E=e.apiField)==null?void 0:E.toLowerCase())}const We=l(Be)||{},Ve=o==="csv"?Xe.default:Qe.default,Ge=d?(l(f)||[]).join(","):f,M=qe(q);r&&(M.dvzProxyDatasetId=r);const Je=C.useDispatch(),Ze=["data","categories",o,...r?[r]:[],"items"],h=C.useSelector(e=>e.getIn(Ze)),He=k.useMemo(()=>h?h.toJS():[],[h]);return k.useEffect(()=>{o&&o!=="csv"&&Je(Ye.getCategories({app:o,dvzProxyDatasetId:r}))},[o,r]),i.jsx(Ke.default,{params:M,app:o,csv:decodeURIComponent(O),group:x,editing:d,store:[o,u,...s.split("/")],source:s,children:i.jsx(_e.default,{children:i.jsx(Ve,{measures:Ge,multipleMeasures:B,mapType:R,aggregationFormula:Te,customMeasureLabels:We,source:s,extraDimension:je,allDimensions:He,children:i.jsx($e.default,{...c})})})})},oa=(n,u)=>{},la={},ra=C.connect(oa,la)(aa);exports.default=ra;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("react/jsx-runtime"),j=require("react"),y=require("react-redux"),ea=require("../data/DataProvider.js"),aa=require("../data/DataConsumer.js"),ta=require("../reducers/data.js"),oa=require("./map.js"),la=require("./MapDataFrame.js"),ra=require("./MapCSVDataFrame.js"),na=[{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}],sa=s=>u.jsx(ia,{...s}),ia=s=>{var k;const{unique:f,editing:m,"data-filters":W="{}","data-app":o="csv","data-csv":_="","data-dimension1":G="","data-dimension2":J="","data-dimension3":g="","data-extra-tooltip-columns":Z="[]","data-measures":h="[]","data-height":H=600,width:K=960,"data-data-source-text":$="","data-data-source-label":Y="Source","data-national-average-label":Q="National Average","data-legend-title":X="Legend Title","data-legend-breaks":ee="[]","data-zoom-enabled":L=!1,"data-show-legend-labels":w=!1,"data-map-file":ae,"data-mapping-field":te="zone","data-map-label-field":oe="admin","data-has-multiple-measures":F="false",topoJSONField:le="collection","data-map-center":re="NGA","data-map-label-show-value":S="false","data-show-tooltip":x="true","data-measure-selector-label":ne="","data-value-format":se="","data-show-overall-value":D="false","data-auto-generate-breaks":I="false","data-number-of-breaks":ie=5,"data-scheme":de="reds","data-show-no-data-label":N="false","data-group":T="default","data-map-symbols":ce="[]","data-tooltip-theme":ue="map-tooltip-dark","data-label-font-size":me=12,"data-label-font-weight":pe="normal","data-label-font-color":fe="#595959","data-legend-font-size":ge=12,"data-legend-font-weight":he="normal","data-custom-tooltips":be="[]","data-format-style":b="decimal","data-decimals":z="2","data-currency":ve="","data-tooltip-font-size":Ce=14,"data-show-admin-unit-label":ye="showAll","data-map-no-data-color":Le="#f8f8f8","data-map-boundary-color":we="#000","data-map-focus-boundary-color":Fe="#000","data-highlighted-location":Se="","data-tooltip-format":xe=`{locationName} %({value},2)
2
+ {label}: %({value},2)`,"data-show-no-data-tooltip":A="false","data-map-container-bg-color":De="#fff","data-map-position":Ie="{}","data-main-layer-id":Ne="","data-enabled-layers":Te,"data-point-label-color":ze="#fff","data-point-label-format":Ae="{locationName} %({value},2)","data-show-no-data-legend-item":R=!1,"data-highlighted-loc-label-format":Re="{locationName} - Score: #({value},2)","data-enable-summary-view":ma="false","data-map-type":B="DEFAULT","data-default-point-color":Be="#FFFF00","data-aggregation-formula":Ue="COUNT","data-zoom-level-to-show-points":Pe=2,"data-zoom-on-filter":U="false","data-zoom-on-filter-field":Me="","data-no-data-text":Ee="No Data","data-labels-exclusion-list":Ve="","data-custom-measure-labels":ke="{}","data-show-shading-layer-labels":qe="ifUnitHasData","data-dvz-proxy-dataset-id":n,"data-recently-toggled-layer-id":Oe=null,intl:pa,settings:fa}=s;console.log("MapWrapper props",s);const je=e=>m?e:decodeURIComponent(e),P=e=>e==null?"":String(e).trim().toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,""),We=(e,a)=>{if(!e||!a)return;if(Object.prototype.hasOwnProperty.call(e,a))return e[a];const t=P(a),r=Object.keys(e).find(q=>P(q)===t);return r?e[r]:void 0},l=e=>{try{if(e)return JSON.parse(je(e))}catch{console.error("error parsing value:"+e)}return null},_e=e=>{let a=l(e)||[];return a=a.map(t=>(t.min&&(t.min=parseFloat(t.min)),t.max&&(t.max=parseFloat(t.max)),t.color=decodeURIComponent(t.color),t)),a},Ge=e=>{const a=l(e)||[];let t={};return a&&a.forEach?a.forEach(r=>{(Array.isArray(r.value)?r.value:[r.value]).filter(O=>O!=null&&O.toString().trim()!="").length>0&&(t[r.param]=r.value)}):t=a,t},Je={style:b==="compacted"?"decimal":b,notation:b==="compacted"?"compact":"standard",currency:ve,minimumFractionDigits:parseInt(z),maximumFractionDigits:parseInt(z)};let v=l(Te)||[];v=v.map(e=>(e.bgColor=decodeURIComponent(e.bgColor),e.fontColor=decodeURIComponent(e.fontColor),e));const M=na.find(e=>e.value===re),E=F==!0||F=="true";let i=[G,J].filter(e=>e!=="none"&&e!==null).join("/");const d=g&&g!=="none"?g:null,p={unique:f,editing:m,source:`/${ae}`,center:M.center,scale:M.scale,measures:h,legendTitle:X,height:H,width:K,topoJSONField:le,mappingField:te,dataSourceText:$,dataSourceLabel:Y,nationalAverageLabel:Q,legendBreaks:_e(ee),mapLabelField:oe,zoomEnabled:L==!0||L=="true",showLegendLabels:w==!0||w=="true",multipleMeasures:E,app:o,mapLabelShowValue:S==!0||S=="true",showTooltip:x==!0||x=="true",showOverallValue:D==!0||D=="true",measureSelectorLabel:ne,valueFormat:se,autoGenerateBreaks:I==!0||I=="true",showNoDataLabel:N==!0||N=="true",numberOfBreaks:ie,colorScheme:de,group:T,symbols:l(ce)||[],tooltipTheme:ue,labelFontSize:me,labelFontColor:decodeURIComponent(fe),labelFontWeight:pe,legendFontSize:ge,legendFontWeight:he,customTooltips:l(be)||[],format:Je,tooltipFontSize:Ce,showAdminUnitLabel:ye,mapNoDataColor:decodeURIComponent(Le),mapBoundaryColor:decodeURIComponent(we),mapFocusBoundaryColor:decodeURIComponent(Fe),highlightedLocation:Se,tooltipFormat:xe,showNoDataTooltip:A==!0||A=="true",fields:i.split("/"),mapContainerBgColor:decodeURIComponent(De),mapPosition:l(Ie),mainLayerId:Ne,enabledLayers:v,pointLabelColor:decodeURIComponent(ze),pointLabelFormat:Ae,showNoDataLegendItem:R==!0||R=="true",highlightedLocLabelFormat:Re,mapType:B,defaultPointColor:decodeURIComponent(Be),zoomLevelToShowPoints:Pe,zoomOnFilter:U==!0||U=="true",zoomOnFilterField:Me,noDataText:Ee,labelsExclusionList:Ve.split(",").map(e=>e.trim()),showShadingLayerLabels:qe,dvzProxyDatasetId:n,recentlyToggledLayerId:Oe};if(p.recentlyToggledLayerId){const e=p.enabledLayers.find(a=>String(a.id)===String(p.recentlyToggledLayerId));e&&(e!=null&&e.apiField)&&(i=(k=e.apiField)==null?void 0:k.toLowerCase())}const Ze=l(ke)||{},He=o==="csv"?ra.default:la.default,Ke=m?(l(h)||[]).join(","):h,c=Ge(W);if(d){const e=We(c,d);e!=null&&e!==""&&(c[d]=e)}const $e=(l(Z)||[]).filter(e=>e&&e!=="none"),V=Array.from(new Set([d,...$e].filter(Boolean)));V.length>0&&(c.includeColumns=V.join(",")),n&&(c.dvzProxyDatasetId=n);const Ye=y.useDispatch(),Qe=["data","categories",o,...n?[n]:[],"items"],C=y.useSelector(e=>e.getIn(Qe)),Xe=j.useMemo(()=>C?C.toJS():[],[C]);return j.useEffect(()=>{o&&o!=="csv"&&Ye(ta.getCategories({app:o,dvzProxyDatasetId:n}))},[o,n]),u.jsx(ea.default,{params:c,app:o,csv:decodeURIComponent(_),group:T,editing:m,store:[o,f,...i.split("/")],source:i,children:u.jsx(aa.default,{children:u.jsx(He,{measures:Ke,multipleMeasures:E,mapType:B,aggregationFormula:Ue,customMeasureLabels:Ze,source:i,extraDimension:d,allDimensions:Xe,children:u.jsx(oa.default,{...p})})})})},da=(s,f)=>{},ca={},ua=y.connect(da,ca)(sa);exports.default=ua;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),l=require("semantic-ui-react"),h=require("@devgateway/wp-react-lib"),N=require("react-intl"),S=require("react-redux"),y=require("../connected-templates/PostIntro.js"),L=require("../../lib/hooks/window-dimensions.js"),q=require("../utils/parseUtils.js"),A=({posts:t,activeItem:a,setActive:i,showLabels:n})=>t?t.map(s=>e.jsx(l.Menu.Item,{onClick:()=>i(s.slug),className:s.slug===a?"active":"",children:n?e.jsx(h.PostLabel,{post:s}):e.jsx(l.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s.title.rendered}})})},s.id)):null,k=({posts:t,activeItem:a,setActive:i,showIcons:n,showLabels:s})=>{const r=t.length;return t?t.map(o=>{var m,g;return(m=o._embedded)!=null&&m["wp:featuredmedia"]&&o._embedded["wp:featuredmedia"][0].source_url,e.jsx(l.Grid.Column,{className:(o.slug===a?"active":"")+(n?" has-icon":""),children:e.jsxs(l.Button,{onClick:()=>i(o.slug),className:`nav ${r===1?"one":""}`,children:[n&&e.jsx(h.MediaProvider,{id:(g=o.meta_fields)!=null&&g.icon?o.meta_fields.icon[0]:null,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),s?e.jsx(h.PostLabel,{post:o}):e.jsx(l.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:o.title.rendered}})})]})},o.id)}):null},I=({posts:t,activeItem:a})=>(u.useEffect(()=>{const i=document.querySelector(".ui.container.content-tab");i&&(i.scrollTop=0)},[a]),t?t.map(i=>{let n={};return i.slug!==a?n={position:"absolute",left:"-3000px",width:"auto",height:"0px",overflow:"hidden",visibility:"hidden"}:n={visibility:"visible",position:"relative",width:"auto"},e.jsx(y.default,{as:l.Container,fluid:!0,post:i,style:n},i.slug)}):null),R=({posts:t,activeItem:a,setActive:i})=>{const[n,s]=u.useState(t.findIndex(d=>d.slug===a)),[r,o]=u.useState(null),m=u.useRef(null);u.useEffect(()=>{if(r){const d=r.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:d,behavior:"smooth"})}},[r]);const g=(d,x)=>{const{index:c}=x,j=n===c?-1:c;s(j),i(t[c].slug),j!==-1&&o(d.currentTarget)};return e.jsx(l.Accordion,{fluid:!0,styled:!0,children:t.map((d,x)=>{var j;const c=(j=d.meta_fields)!=null&&j.icon?d.meta_fields.icon[0]:null;return e.jsxs(u.Fragment,{children:[e.jsx(l.Accordion.Title,{active:n===x,index:x,onClick:g,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c&&e.jsx(h.MediaProvider,{id:c,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),e.jsx("span",{dangerouslySetInnerHTML:{__html:d.title.rendered},style:{marginLeft:c?"10px":"0"}})]}),e.jsx(l.Icon,{name:"chevron down"})]})}),e.jsx(l.Accordion.Content,{className:"accordion-post-content",active:n===x,children:e.jsx("div",{ref:m,children:e.jsx(y.default,{post:d,as:l.Container,fluid:!0})})})]},d.id)})})},$=({posts:t,showLabels:a,height:i})=>{const[n,s]=u.useState(t?t[0].slug:null);return u.useEffect(()=>{setTimeout(()=>{if(window.location.hash){const r=window.location.hash.substr(1),o=document.getElementById(r);o&&t.map(m=>m.slug).indexOf(r)>-1&&(s(r),o.scrollIntoView({behavior:"auto",block:"start"}))}},0)},[t]),e.jsxs(u.Fragment,{children:[t.map(r=>e.jsx("anchor",{id:r.slug},r.slug)),e.jsx(l.Menu,{className:"tabbed posts",text:!0,children:e.jsx(A,{showLabels:a,posts:t,setActive:s,activeItem:n})}),e.jsx(l.Container,{className:"content-tab",style:{height:`${i}px`},children:e.jsx(I,{posts:t,activeItem:n})})]})},D=({posts:t,showLabels:a,showIcons:i,height:n})=>{const[s,r]=u.useState(t?t[0].slug:null);return e.jsx(u.Fragment,{children:e.jsxs(l.Grid,{stackable:!0,className:"tabbed posts",columns:t.length,style:{height:n+"px"},children:[e.jsx(k,{showIcons:i,showLabels:a,posts:t,activeItem:s,setActive:r}),e.jsx(l.Grid.Row,{style:{height:`${n}px`},children:e.jsx(l.Grid.Column,{width:16,className:"content",children:e.jsx(l.Container,{className:"content-tab",style:{height:`${n}px`},children:e.jsx(I,{className:"content-tab",posts:t,activeItem:s})})})})]})})},G=t=>{var v;let{"data-type":a,"data-taxonomy":i,"data-categories":n,"data-items":s,"data-theme":r="light","data-show-icons":o,"data-use-scrolls":m,"data-show-labels":g,"data-height":d,"data-preview-mode":x="Desktop",pageModuleProps:c,parent:j,editing:b,unique:C}=t;c!=null&&c.previewMode&&(c!=null&&c.editing)&&(x=c.previewMode,b=c.editing);const p=t.intl.locale,f=m==="true",w=f?d:void 0,{width:M}=L.useWindowDimensionsAndDevice(),_=M<=1024,P=x!=="Desktop"&&b,T=_&&!b;return e.jsx(l.Container,{className:`viz tabbed posts ${b?"editing":""} ${f?"scrollable":""}`,fluid:!0,children:e.jsx(h.PostProvider,{locale:p,type:a,taxonomy:i,categories:q.parse(n,b),store:`tabbedposts_${j}_${C}`,page:1,perPage:s,children:e.jsx(h.PostConsumer,{children:e.jsx(h.PostConsumer,{children:T||P?e.jsx(R,{posts:s,activeItem:(v=s[0])==null?void 0:v.slug,setActive:()=>{}}):r==="light"?e.jsx($,{height:w,showLabels:g==="true"}):e.jsx(D,{height:w,showLabels:g==="true",showIcons:o==="true"})})})})})},E=(t,a)=>{const i=t.getIn(["data","pageModuleProps"]),n={};return i&&(n.pageModuleProps=i),n},H={},B=S.connect(E,H)(N.injectIntl(G));exports.default=B;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),l=require("semantic-ui-react"),h=require("@devgateway/wp-react-lib"),S=require("react-intl"),A=require("react-redux"),y=require("../connected-templates/PostIntro.js"),L=require("../../lib/hooks/window-dimensions.js"),q=({posts:t,activeItem:c,setActive:i,showLabels:n})=>t?t.map(s=>e.jsx(l.Menu.Item,{onClick:()=>i(s.slug),className:s.slug===c?"active":"",children:n?e.jsx(h.PostLabel,{post:s}):e.jsx(l.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s.title.rendered}})})},s.id)):null,k=({posts:t,activeItem:c,setActive:i,showIcons:n,showLabels:s})=>{const r=t.length;return t?t.map(o=>{var m,g;return(m=o._embedded)!=null&&m["wp:featuredmedia"]&&o._embedded["wp:featuredmedia"][0].source_url,e.jsx(l.Grid.Column,{className:(o.slug===c?"active":"")+(n?" has-icon":""),children:e.jsxs(l.Button,{onClick:()=>i(o.slug),className:`nav ${r===1?"one":""}`,children:[n&&e.jsx(h.MediaProvider,{id:(g=o.meta_fields)!=null&&g.icon?o.meta_fields.icon[0]:null,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),s?e.jsx(h.PostLabel,{post:o}):e.jsx(l.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:o.title.rendered}})})]})},o.id)}):null},C=({posts:t,activeItem:c})=>(u.useEffect(()=>{const i=document.querySelector(".ui.container.content-tab");i&&(i.scrollTop=0)},[c]),t?t.map(i=>{let n={};return i.slug!==c?n={position:"absolute",left:"-3000px",width:"auto",height:"0px",overflow:"hidden",visibility:"hidden"}:n={visibility:"visible",position:"relative",width:"auto"},e.jsx(y.default,{as:l.Container,fluid:!0,post:i,style:n},i.slug)}):null),R=({posts:t,activeItem:c,setActive:i})=>{const[n,s]=u.useState(t.findIndex(d=>d.slug===c)),[r,o]=u.useState(null),m=u.useRef(null);u.useEffect(()=>{if(r){const d=r.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:d,behavior:"smooth"})}},[r]);const g=(d,x)=>{const{index:a}=x,j=n===a?-1:a;s(j),i(t[a].slug),j!==-1&&o(d.currentTarget)};return e.jsx(l.Accordion,{fluid:!0,styled:!0,children:t.map((d,x)=>{var j;const a=(j=d.meta_fields)!=null&&j.icon?d.meta_fields.icon[0]:null;return e.jsxs(u.Fragment,{children:[e.jsx(l.Accordion.Title,{active:n===x,index:x,onClick:g,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[a&&e.jsx(h.MediaProvider,{id:a,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),e.jsx("span",{dangerouslySetInnerHTML:{__html:d.title.rendered},style:{marginLeft:a?"10px":"0"}})]}),e.jsx(l.Icon,{name:"chevron down"})]})}),e.jsx(l.Accordion.Content,{className:"accordion-post-content",active:n===x,children:e.jsx("div",{ref:m,children:e.jsx(y.default,{post:d,as:l.Container,fluid:!0})})})]},d.id)})})},$=({posts:t,showLabels:c,height:i})=>{const[n,s]=u.useState(t?t[0].slug:null);return u.useEffect(()=>{setTimeout(()=>{if(window.location.hash){const r=window.location.hash.substr(1),o=document.getElementById(r);o&&t.map(m=>m.slug).indexOf(r)>-1&&(s(r),o.scrollIntoView({behavior:"auto",block:"start"}))}},0)},[t]),e.jsxs(u.Fragment,{children:[t.map(r=>e.jsx("anchor",{id:r.slug},r.slug)),e.jsx(l.Menu,{className:"tabbed posts",text:!0,children:e.jsx(q,{showLabels:c,posts:t,setActive:s,activeItem:n})}),e.jsx(l.Container,{className:"content-tab",style:{height:`${i}px`},children:e.jsx(C,{posts:t,activeItem:n})})]})},D=({posts:t,showLabels:c,showIcons:i,height:n})=>{const[s,r]=u.useState(t?t[0].slug:null);return e.jsx(u.Fragment,{children:e.jsxs(l.Grid,{stackable:!0,className:"tabbed posts",columns:t.length,style:{height:n+"px"},children:[e.jsx(k,{showIcons:i,showLabels:c,posts:t,activeItem:s,setActive:r}),e.jsx(l.Grid.Row,{style:{height:`${n}px`},children:e.jsx(l.Grid.Column,{width:16,className:"content",children:e.jsx(l.Container,{className:"content-tab",style:{height:`${n}px`},children:e.jsx(C,{className:"content-tab",posts:t,activeItem:s})})})})]})})},G=t=>{var v;let{"data-type":c,"data-taxonomy":i,"data-categories":n,"data-items":s,"data-theme":r="light","data-show-icons":o,"data-use-scrolls":m,"data-show-labels":g,"data-height":d,"data-preview-mode":x="Desktop",pageModuleProps:a,parent:j,editing:b,unique:I}=t;a!=null&&a.previewMode&&(a!=null&&a.editing)&&(x=a.previewMode,b=a.editing);const p=t.intl.locale,M=Array.isArray(n)?n.join(","):n,f=m==="true",w=f?d:void 0,{width:_}=L.useWindowDimensionsAndDevice(),P=_<=1024,T=x!=="Desktop"&&b,N=P&&!b;return e.jsx(l.Container,{className:`viz tabbed posts ${b?"editing":""} ${f?"scrollable":""}`,fluid:!0,children:e.jsx(h.PostProvider,{locale:p,type:c,taxonomy:i,categories:M,store:`tabbedposts_${j}_${I}`,page:1,perPage:s,children:e.jsx(h.PostConsumer,{children:e.jsx(h.PostConsumer,{children:N||T?e.jsx(R,{posts:s,activeItem:(v=s[0])==null?void 0:v.slug,setActive:()=>{}}):r==="light"?e.jsx($,{height:w,showLabels:g==="true"}):e.jsx(D,{height:w,showLabels:g==="true",showIcons:o==="true"})})})})})},E=(t,c)=>{const i=t.getIn(["data","pageModuleProps"]),n={};return i&&(n.pageModuleProps=i),n},H={},B=A.connect(E,H)(S.injectIntl(G));exports.default=B;
@@ -1,146 +1,147 @@
1
- import K from "react";
2
- const ae = (S) => {
3
- var P, _;
4
- const { data: l, measures: D, customMeasureLabels: h, children: W, source: B, extraDimension: A, allDimensions: C } = S;
5
- console.log("MapDataFrame props:", S);
6
- const T = (B || "").split("/").filter(Boolean), y = T.length > 0 ? T[0] : null, u = {
1
+ import J from "react";
2
+ const te = (F) => {
3
+ var j, K;
4
+ const { data: o, measures: D, customMeasureLabels: y, children: $, source: S, extraDimension: f, allDimensions: C } = F;
5
+ console.log("MapDataFrame props:", F);
6
+ const B = (S || "").split("/").filter(Boolean), b = B.length > 0 ? B[0] : null, d = {
7
7
  locationsData: [],
8
8
  nationalData: {},
9
9
  measureLabelMap: {}
10
10
  };
11
- l.metadata && l.metadata.measures && Array.isArray(l.metadata.measures), l.children && l.children[0] && l.children[0].children;
12
- const L = l.metadata || {}, J = ["value", "count", "type", "children", "label", "measure"], O = C && C.length > 0 ? C : L.types || [], b = {};
13
- O.forEach((e) => {
11
+ o.metadata && o.metadata.measures && Array.isArray(o.metadata.measures), o.children && o.children[0] && o.children[0].children;
12
+ const E = o.metadata || {}, q = ["value", "count", "type", "children", "label", "measure"], T = C && C.length > 0 ? C : E.types || [], V = {};
13
+ T.forEach((e) => {
14
14
  const n = e.category || e.type;
15
- n && (b[n] = e.items || []);
15
+ n && (V[n] = e.items || []);
16
16
  });
17
- const w = (e, n) => {
18
- const a = b[e];
17
+ const O = (e, n) => {
18
+ const a = V[e];
19
19
  if (!a)
20
20
  return null;
21
21
  const t = n != null ? String(n) : n;
22
22
  return a.find((r) => {
23
- const o = r.value != null ? String(r.value) : r.value, c = r.id != null ? String(r.id) : r.id, s = r.code != null ? String(r.code) : r.code;
24
- return o === t || c === t || s === t;
23
+ const l = r.value != null ? String(r.value) : r.value, i = r.id != null ? String(r.id) : r.id, s = r.code != null ? String(r.code) : r.code;
24
+ return l === t || i === t || s === t;
25
25
  }) || null;
26
- }, f = (e, n) => {
27
- const a = w(e, n);
26
+ }, p = (e, n) => {
27
+ const a = O(e, n);
28
28
  return a ? a.value ?? a.label ?? a.id ?? a.code ?? n : n;
29
- }, $ = (e = {}) => {
29
+ }, G = (e = {}) => {
30
30
  const n = {};
31
31
  return Object.keys(e).forEach((a) => {
32
32
  const t = e[a];
33
- t != null && (Array.isArray(t) ? n[a] = t.map((r) => f(a, r)).join(" ,") : n[a] = f(a, t));
33
+ t != null && (Array.isArray(t) ? n[a] = t.map((r) => p(a, r)).join(" ,") : n[a] = p(a, t));
34
34
  }), n;
35
- }, q = (e) => {
36
- const n = b[e] || [];
37
- return n.length === 1 ? f(e, n[0].value ?? n[0].id ?? n[0].code) : null;
38
- }, d = (e) => e != null && e !== "", R = (e) => {
35
+ }, H = (e) => {
36
+ const n = V[e] || [];
37
+ return n.length === 1 ? p(e, n[0].value ?? n[0].id ?? n[0].code) : null;
38
+ }, c = (e) => e != null && e !== "", w = (e) => {
39
39
  if (e)
40
- return d(e.value) ? e.value : d(e.id) ? e.id : e.code;
41
- }, V = (e) => e == null ? "" : String(e).trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, ""), p = (e, n) => {
40
+ return c(e.value) ? e.value : c(e.id) ? e.id : e.code;
41
+ }, A = (e) => e == null ? "" : String(e).trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, ""), v = (e, n) => {
42
42
  if (!e)
43
43
  return;
44
- const a = V(n), t = e[n];
44
+ const a = A(n), t = e[n];
45
45
  if (t != null && t !== "")
46
46
  return t;
47
47
  const r = Object.keys(e);
48
- for (let o = 0; o < r.length; o++) {
49
- const c = r[o];
50
- if (V(c) === a) {
51
- const s = e[c];
48
+ for (let l = 0; l < r.length; l++) {
49
+ const i = r[l];
50
+ if (A(i) === a) {
51
+ const s = e[i];
52
52
  if (s != null && s !== "")
53
53
  return s;
54
54
  }
55
55
  }
56
- }, G = (e, n) => {
56
+ }, Q = (e) => Array.isArray(e) ? e.length > 0 ? e[0] : void 0 : e, X = (e, n) => {
57
57
  const a = [
58
- y,
58
+ b,
59
59
  "country",
60
60
  e.type
61
61
  ].filter(Boolean), t = [
62
- p(n, "country"),
63
- p(e, "country"),
64
- y ? p(n, y) : void 0,
65
- y ? p(e, y) : void 0,
62
+ v(n, "country"),
63
+ v(e, "country"),
64
+ b ? v(n, b) : void 0,
65
+ b ? v(e, b) : void 0,
66
66
  e.label,
67
67
  e.value
68
- ].filter((r) => d(r));
68
+ ].filter((r) => c(r));
69
69
  for (let r = 0; r < a.length; r++) {
70
- const o = a[r], c = b[o] || [];
71
- if (c.length)
70
+ const l = a[r], i = V[l] || [];
71
+ if (i.length)
72
72
  for (let s = 0; s < t.length; s++) {
73
- const g = t[s], U = V(g), j = c.findIndex((k) => {
74
- const m = R(k);
75
- return V(m) === U;
73
+ const h = t[s], k = A(h), W = i.findIndex((ee) => {
74
+ const ne = w(ee);
75
+ return A(ne) === k;
76
76
  });
77
- if (j >= 0)
78
- return j;
77
+ if (W >= 0)
78
+ return W;
79
79
  }
80
80
  }
81
81
  return -1;
82
- }, H = (e, n, a) => {
83
- const t = G(n, a);
82
+ }, Y = (e, n, a) => {
83
+ const t = X(n, a);
84
84
  if (t < 0)
85
85
  return;
86
- const r = b[e] || [];
86
+ const r = V[e] || [];
87
87
  if (!r.length || t >= r.length)
88
88
  return;
89
- const o = R(r[t]);
90
- if (d(o))
91
- return f(e, o);
92
- }, Q = (e, n, a) => {
93
- const t = p(a, e);
94
- if (d(t))
89
+ const l = w(r[t]);
90
+ if (c(l))
91
+ return p(e, l);
92
+ }, R = (e, n, a) => {
93
+ const t = v(a, e);
94
+ if (c(t))
95
95
  return t;
96
- if (d(x[e]))
97
- return x[e];
98
- const r = p(n, e);
99
- if (d(r))
96
+ if (c(L[e]))
97
+ return L[e];
98
+ const r = v(n, e);
99
+ if (c(r))
100
100
  return r;
101
- const o = H(e, n, a);
102
- if (d(o))
103
- return o;
104
- const c = q(e);
105
- if (d(c))
106
- return c;
101
+ const l = Y(e, n, a);
102
+ if (c(l))
103
+ return l;
104
+ const i = H(e);
105
+ if (c(i))
106
+ return i;
107
107
  const s = n.value;
108
- return w(e, s) ? f(e, s) : "";
109
- }, E = l.appliedFilters || {};
110
- if (A) {
111
- const e = E[A] ? E[A][0] : void 0;
112
- f(A, e);
108
+ return O(e, s) ? p(e, s) : "";
109
+ }, z = o.appliedFilters || {};
110
+ let N = "";
111
+ if (f) {
112
+ const e = v(z, f), n = Q(e);
113
+ N = p(f, n) || "";
113
114
  }
114
- const x = $(E), X = (e) => {
115
+ const L = G(z), Z = (e) => {
115
116
  const n = {};
116
117
  return Object.keys(e).forEach((a) => {
117
- J.includes(a) || (n[a] = e[a]);
118
- }), e.type && e.value !== void 0 && (n[e.type] = f(e.type, e.value)), n;
119
- }, F = (e) => {
120
- let n = X(e);
118
+ q.includes(a) || (n[a] = e[a]);
119
+ }), e.type && e.value !== void 0 && (n[e.type] = p(e.type, e.value)), n;
120
+ }, x = (e) => {
121
+ let n = Z(e);
121
122
  return e.children && Array.isArray(e.children) && e.children.forEach((a) => {
122
- n = { ...n, ...F(a) };
123
+ n = { ...n, ...x(a) };
123
124
  }), n;
124
- }, z = (e, n) => {
125
+ }, P = (e, n) => {
125
126
  if (!(!e.children || !Array.isArray(e.children)))
126
127
  return e.children.map((a) => ({
127
128
  ...a,
128
129
  label: a.value,
129
130
  value: a[n],
130
- variables: F(a),
131
- children: z(a, n)
131
+ variables: x(a),
132
+ children: P(a, n)
132
133
  }));
133
134
  };
134
- L.measures && L.measures.forEach((e) => {
135
- h && h[e.value] && h[e.value].hasCustomLabel && h[e.value].customLabel ? u.measureLabelMap[e.value] = h[e.value].customLabel : u.measureLabelMap[e.value] = e.label;
135
+ E.measures && E.measures.forEach((e) => {
136
+ y && y[e.value] && y[e.value].hasCustomLabel && y[e.value].customLabel ? d.measureLabelMap[e.value] = y[e.value].customLabel : d.measureLabelMap[e.value] = e.label;
136
137
  });
137
- const N = (((P = l == null ? void 0 : l.metadata) == null ? void 0 : P.measures) || []).map((e) => e == null ? void 0 : e.value).filter(Boolean), i = (() => {
138
+ const _ = (((j = o == null ? void 0 : o.metadata) == null ? void 0 : j.measures) || []).map((e) => e == null ? void 0 : e.value).filter(Boolean), u = (() => {
138
139
  if (Array.isArray(D))
139
140
  return D.map((e) => ("" + e).trim()).filter(Boolean);
140
141
  if (typeof D == "string") {
141
142
  const e = D.trim();
142
143
  if (!e || e === "[]")
143
- return N;
144
+ return _;
144
145
  if (e.startsWith("[") && e.endsWith("]"))
145
146
  try {
146
147
  const n = JSON.parse(e);
@@ -150,62 +151,65 @@ const ae = (S) => {
150
151
  }
151
152
  return e.split(",").map((n) => n.trim()).filter(Boolean);
152
153
  }
153
- return N;
154
- })(), M = ((_ = l == null ? void 0 : l.metadata) == null ? void 0 : _.types) || [], Y = (B || "").split("/")[0], Z = M.find((e) => e.dimension === Y) || M[0], I = (e, n) => {
155
- var o;
154
+ return _;
155
+ })(), M = ((K = o == null ? void 0 : o.metadata) == null ? void 0 : K.types) || [], m = (S || "").split("/")[0], I = M.find((e) => e.dimension === m) || M[0], U = (e, n) => {
156
+ var l;
156
157
  if (typeof (e == null ? void 0 : e.value) == "string")
157
158
  return e.value;
158
- const t = M.find((c) => c.dimension === (e == null ? void 0 : e.type)) || Z, r = (o = t == null ? void 0 : t.items) == null ? void 0 : o[n];
159
+ const t = M.find((i) => i.dimension === (e == null ? void 0 : e.type)) || I, r = (l = t == null ? void 0 : t.items) == null ? void 0 : l[n];
159
160
  return (r == null ? void 0 : r.value) || (r == null ? void 0 : r.code) || (e == null ? void 0 : e.label) || (e == null ? void 0 : e.value);
160
- }, v = (e, n) => {
161
+ }, g = (e, n) => {
161
162
  if (e && Object.prototype.hasOwnProperty.call(e, n))
162
163
  return e[n];
163
164
  if (n === "value")
164
165
  return e == null ? void 0 : e.value;
165
166
  };
166
- if (l && l.children) {
167
- l.children.forEach((n, a) => {
168
- const t = I(n, a);
169
- i.forEach((r) => {
170
- const o = {
171
- ...F(n),
167
+ if (o && o.children) {
168
+ o.children.forEach((n, a) => {
169
+ const t = U(n, a);
170
+ u.forEach((r) => {
171
+ const l = {
172
+ ...x(n),
172
173
  // Dynamic fields for both formats, including nested dimensions
173
- ...x
174
+ ...L
174
175
  };
175
- O.forEach((s) => {
176
- const g = s.category || s.type;
177
- g && (o[g] = Q(g, n, o));
178
- });
179
- const c = {
176
+ if (T.forEach((s) => {
177
+ const h = s.category || s.type;
178
+ h && (l[h] = R(h, n, l));
179
+ }), f) {
180
+ const s = R(f, n, l);
181
+ l[f] = c(s) ? s : N, l.dimension3 = l[f], l.additionalDimension = l[f];
182
+ }
183
+ const i = {
180
184
  ...n,
181
185
  label: t,
182
- value: v(n, r),
186
+ value: g(n, r),
183
187
  measure: r,
184
- variables: o
188
+ variables: l
185
189
  };
186
- c.variables.selectedDataFrameTooltipValue = v(n, r), n.children && (c.children = [], n.children.forEach((s) => {
187
- c.children.push({ ...s, label: s.value, value: v(s, r) });
188
- })), c.children = z(n, r), u.locationsData.push(c);
190
+ i.variables.selectedDataFrameTooltipValue = g(n, r), n.children && (i.children = [], n.children.forEach((s) => {
191
+ i.children.push({ ...s, label: s.value, value: g(s, r) });
192
+ })), i.children = P(n, r), d.locationsData.push(i);
189
193
  });
190
- }), u.measures = i.length > 1 ? i : null;
191
- const e = i.length > 0 ? i[0] : null;
192
- u.nationalData.value = e ? v(l, e) : null;
193
- } else if (l && i.length > 0) {
194
- const e = typeof l.value == "string" && l.value || l.label || l.type || "total";
195
- i.forEach((n) => {
196
- const a = v(l, n);
197
- a !== void 0 && u.locationsData.push({
194
+ }), d.measures = u.length > 1 ? u : null;
195
+ const e = u.length > 0 ? u[0] : null;
196
+ d.nationalData.value = e ? g(o, e) : null;
197
+ } else if (o && u.length > 0) {
198
+ const e = typeof o.value == "string" && o.value || o.label || o.type || "total";
199
+ u.forEach((n) => {
200
+ const a = g(o, n);
201
+ a !== void 0 && d.locationsData.push({
198
202
  label: e,
199
203
  value: a,
200
204
  measure: n
201
205
  });
202
- }), u.measures = i.length > 1 ? i : null, u.nationalData.value = v(l, i[0]);
206
+ }), d.measures = u.length > 1 ? u : null, d.nationalData.value = g(o, u[0]);
203
207
  }
204
- return K.Children.map(W, (e) => K.cloneElement(e, { transformedData: {
205
- ...u,
208
+ return J.Children.map($, (e) => J.cloneElement(e, { transformedData: {
209
+ ...d,
206
210
  types: M
207
211
  } }));
208
212
  };
209
213
  export {
210
- ae as default
214
+ te as default
211
215
  };
@@ -1,13 +1,13 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useMemo as He, useEffect as Ke } from "react";
3
- import { connect as qe, useDispatch as Ye, useSelector as $e } from "react-redux";
4
- import Qe from "../data/DataProvider.js";
5
- import Xe from "../data/DataConsumer.js";
6
- import { getCategories as _e } from "../reducers/data.js";
7
- import ea from "./map.js";
8
- import aa from "./MapDataFrame.js";
9
- import ta from "./MapCSVDataFrame.js";
10
- const oa = [
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import { useMemo as Qe, useEffect as Xe } from "react";
3
+ import { connect as ea, useDispatch as aa, useSelector as oa } from "react-redux";
4
+ import ta from "../data/DataProvider.js";
5
+ import la from "../data/DataConsumer.js";
6
+ import { getCategories as ra } from "../reducers/data.js";
7
+ import na from "./map.js";
8
+ import sa from "./MapDataFrame.js";
9
+ import ia from "./MapCSVDataFrame.js";
10
+ const da = [
11
11
  { label: "KENYA", value: "KEN", center: [35.8166634, 0.1], scale: 2e3 },
12
12
  { label: "Nigeria", value: "NGA", center: [7.491302, 9.072264], scale: 2e3 },
13
13
  { label: "South Africa", value: "ZAF", center: [24.676997, -28.48322], scale: 2e3 },
@@ -17,222 +17,235 @@ const oa = [
17
17
  { label: "Zambia", value: "ZMB", center: [26.459455, -14.668135], scale: 2e3 },
18
18
  { label: "Democratic Republic of the Congo", value: "DRC", center: [23.174338, -5.837475], scale: 1250 },
19
19
  { label: "World", value: "World", center: [0, 20.050043], scale: 150 }
20
- ], la = (n) => /* @__PURE__ */ i(ra, { ...n }), ra = (n) => {
21
- var E;
20
+ ], ma = (s) => /* @__PURE__ */ c(ca, { ...s }), ca = (s) => {
21
+ var V;
22
22
  const {
23
- unique: u,
24
- editing: d,
25
- "data-filters": P = "{}",
26
- "data-app": o = "csv",
27
- "data-csv": k = "",
28
- "data-dimension1": O = "",
29
- "data-dimension2": W = "",
30
- "data-dimension3": p = "",
31
- "data-measures": f = "[]",
32
- "data-height": V = 600,
33
- width: G = 960,
34
- "data-data-source-text": j = "",
35
- "data-data-source-label": J = "Source",
36
- "data-national-average-label": Z = "National Average",
37
- "data-legend-title": H = "Legend Title",
38
- "data-legend-breaks": K = "[]",
39
- "data-zoom-enabled": C = !1,
40
- "data-show-legend-labels": y = !1,
41
- "data-map-file": q,
42
- "data-mapping-field": Y = "zone",
43
- "data-map-label-field": $ = "admin",
44
- "data-has-multiple-measures": v = "false",
45
- topoJSONField: Q = "collection",
46
- "data-map-center": X = "NGA",
23
+ unique: f,
24
+ editing: u,
25
+ "data-filters": W = "{}",
26
+ "data-app": t = "csv",
27
+ "data-csv": G = "",
28
+ "data-dimension1": J = "",
29
+ "data-dimension2": Z = "",
30
+ "data-dimension3": g = "",
31
+ "data-extra-tooltip-columns": _ = "[]",
32
+ "data-measures": h = "[]",
33
+ "data-height": j = 600,
34
+ width: H = 960,
35
+ "data-data-source-text": K = "",
36
+ "data-data-source-label": $ = "Source",
37
+ "data-national-average-label": q = "National Average",
38
+ "data-legend-title": Y = "Legend Title",
39
+ "data-legend-breaks": Q = "[]",
40
+ "data-zoom-enabled": y = !1,
41
+ "data-show-legend-labels": L = !1,
42
+ "data-map-file": X,
43
+ "data-mapping-field": ee = "zone",
44
+ "data-map-label-field": ae = "admin",
45
+ "data-has-multiple-measures": w = "false",
46
+ topoJSONField: oe = "collection",
47
+ "data-map-center": te = "NGA",
47
48
  //country
48
49
  "data-map-label-show-value": F = "false",
49
- "data-show-tooltip": L = "true",
50
- "data-measure-selector-label": _ = "",
51
- "data-value-format": ee = "",
52
- "data-show-overall-value": w = "false",
53
- "data-auto-generate-breaks": D = "false",
54
- "data-number-of-breaks": ae = 5,
55
- "data-scheme": te = "reds",
56
- "data-show-no-data-label": S = "false",
57
- "data-group": I = "default",
58
- "data-map-symbols": oe = "[]",
59
- "data-tooltip-theme": le = "map-tooltip-dark",
60
- "data-label-font-size": re = 12,
61
- "data-label-font-weight": ne = "normal",
62
- "data-label-font-color": se = "#595959",
63
- "data-legend-font-size": ie = 12,
64
- "data-legend-font-weight": de = "normal",
65
- "data-custom-tooltips": me = "[]",
66
- "data-format-style": g = "decimal",
67
- "data-decimals": N = "2",
68
- "data-currency": ce = "",
69
- "data-tooltip-font-size": ue = 14,
70
- "data-show-admin-unit-label": pe = "showAll",
71
- "data-map-no-data-color": fe = "#f8f8f8",
72
- "data-map-boundary-color": ge = "#000",
73
- "data-map-focus-boundary-color": he = "#000",
74
- "data-highlighted-location": be = "",
75
- "data-tooltip-format": Ce = `{locationName} %({value},2)
50
+ "data-show-tooltip": S = "true",
51
+ "data-measure-selector-label": le = "",
52
+ "data-value-format": re = "",
53
+ "data-show-overall-value": D = "false",
54
+ "data-auto-generate-breaks": I = "false",
55
+ "data-number-of-breaks": ne = 5,
56
+ "data-scheme": se = "reds",
57
+ "data-show-no-data-label": N = "false",
58
+ "data-group": z = "default",
59
+ "data-map-symbols": ie = "[]",
60
+ "data-tooltip-theme": de = "map-tooltip-dark",
61
+ "data-label-font-size": me = 12,
62
+ "data-label-font-weight": ce = "normal",
63
+ "data-label-font-color": ue = "#595959",
64
+ "data-legend-font-size": pe = 12,
65
+ "data-legend-font-weight": fe = "normal",
66
+ "data-custom-tooltips": ge = "[]",
67
+ "data-format-style": b = "decimal",
68
+ "data-decimals": T = "2",
69
+ "data-currency": he = "",
70
+ "data-tooltip-font-size": be = 14,
71
+ "data-show-admin-unit-label": Ce = "showAll",
72
+ "data-map-no-data-color": ve = "#f8f8f8",
73
+ "data-map-boundary-color": ye = "#000",
74
+ "data-map-focus-boundary-color": Le = "#000",
75
+ "data-highlighted-location": we = "",
76
+ "data-tooltip-format": Fe = `{locationName} %({value},2)
76
77
  {label}: %({value},2)`,
77
- "data-show-no-data-tooltip": z = "false",
78
- "data-map-container-bg-color": ye = "#fff",
79
- "data-map-position": ve = "{}",
80
- "data-main-layer-id": Fe = "",
81
- "data-enabled-layers": Le,
82
- "data-point-label-color": we = "#fff",
83
- "data-point-label-format": De = "{locationName} %({value},2)",
84
- "data-show-no-data-legend-item": T = !1,
85
- "data-highlighted-loc-label-format": Se = "{locationName} - Score: #({value},2)",
86
- "data-enable-summary-view": ia = "false",
87
- "data-map-type": x = "DEFAULT",
88
- "data-default-point-color": Ie = "#FFFF00",
89
- "data-aggregation-formula": Ne = "COUNT",
90
- "data-zoom-level-to-show-points": ze = 2,
78
+ "data-show-no-data-tooltip": x = "false",
79
+ "data-map-container-bg-color": Se = "#fff",
80
+ "data-map-position": De = "{}",
81
+ "data-main-layer-id": Ie = "",
82
+ "data-enabled-layers": Ne,
83
+ "data-point-label-color": ze = "#fff",
84
+ "data-point-label-format": Te = "{locationName} %({value},2)",
85
+ "data-show-no-data-legend-item": A = !1,
86
+ "data-highlighted-loc-label-format": xe = "{locationName} - Score: #({value},2)",
87
+ "data-enable-summary-view": fa = "false",
88
+ "data-map-type": B = "DEFAULT",
89
+ "data-default-point-color": Ae = "#FFFF00",
90
+ "data-aggregation-formula": Be = "COUNT",
91
+ "data-zoom-level-to-show-points": Ue = 2,
91
92
  "data-zoom-on-filter": U = "false",
92
- "data-zoom-on-filter-field": Te = "",
93
- "data-no-data-text": xe = "No Data",
94
- "data-labels-exclusion-list": Ue = "",
95
- "data-custom-measure-labels": Ae = "{}",
96
- "data-show-shading-layer-labels": Be = "ifUnitHasData",
97
- "data-dvz-proxy-dataset-id": r,
98
- "data-recently-toggled-layer-id": Re = null,
99
- intl: da,
100
- settings: ma
101
- } = n;
102
- console.log("MapWrapper props", n);
103
- const Ee = (e) => d ? e : decodeURIComponent(e), l = (e) => {
93
+ "data-zoom-on-filter-field": Pe = "",
94
+ "data-no-data-text": Re = "No Data",
95
+ "data-labels-exclusion-list": Ee = "",
96
+ "data-custom-measure-labels": Me = "{}",
97
+ "data-show-shading-layer-labels": Ve = "ifUnitHasData",
98
+ "data-dvz-proxy-dataset-id": n,
99
+ "data-recently-toggled-layer-id": ke = null,
100
+ intl: ga,
101
+ settings: ha
102
+ } = s;
103
+ console.log("MapWrapper props", s);
104
+ const Oe = (e) => u ? e : decodeURIComponent(e), P = (e) => e == null ? "" : String(e).trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, ""), We = (e, a) => {
105
+ if (!e || !a)
106
+ return;
107
+ if (Object.prototype.hasOwnProperty.call(e, a))
108
+ return e[a];
109
+ const o = P(a), r = Object.keys(e).find((k) => P(k) === o);
110
+ return r ? e[r] : void 0;
111
+ }, l = (e) => {
104
112
  try {
105
113
  if (e)
106
- return JSON.parse(Ee(e));
114
+ return JSON.parse(Oe(e));
107
115
  } catch {
108
116
  console.error("error parsing value:" + e);
109
117
  }
110
118
  return null;
111
- }, Me = (e) => {
112
- let t = l(e) || [];
113
- 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;
114
- }, Pe = (e) => {
115
- const t = l(e) || [];
116
- let a = {};
117
- return t && t.forEach ? t.forEach((c) => {
118
- c.value != null && c.value.filter((M) => M != null && M.toString().trim() != "").length > 0 && (a[c.param] = c.value);
119
- }) : a = t, a;
120
- }, ke = {
121
- style: g === "compacted" ? "decimal" : g,
122
- notation: g === "compacted" ? "compact" : "standard",
123
- currency: ce,
124
- minimumFractionDigits: parseInt(N),
125
- maximumFractionDigits: parseInt(N)
119
+ }, Ge = (e) => {
120
+ let a = l(e) || [];
121
+ return a = a.map((o) => (o.min && (o.min = parseFloat(o.min)), o.max && (o.max = parseFloat(o.max)), o.color = decodeURIComponent(o.color), o)), a;
122
+ }, Je = (e) => {
123
+ const a = l(e) || [];
124
+ let o = {};
125
+ return a && a.forEach ? a.forEach((r) => {
126
+ (Array.isArray(r.value) ? r.value : [r.value]).filter((O) => O != null && O.toString().trim() != "").length > 0 && (o[r.param] = r.value);
127
+ }) : o = a, o;
128
+ }, Ze = {
129
+ style: b === "compacted" ? "decimal" : b,
130
+ notation: b === "compacted" ? "compact" : "standard",
131
+ currency: he,
132
+ minimumFractionDigits: parseInt(T),
133
+ maximumFractionDigits: parseInt(T)
126
134
  };
127
- let h = l(Le) || [];
128
- h = h.map((e) => (e.bgColor = decodeURIComponent(e.bgColor), e.fontColor = decodeURIComponent(e.fontColor), e));
129
- const A = oa.find((e) => e.value === X), B = v == !0 || v == "true";
130
- let s = [O, W].filter((e) => e !== "none" && e !== null).join("/");
131
- const Oe = p && p !== "none" ? p : null, m = {
132
- unique: u,
133
- editing: d,
134
- source: `/${q}`,
135
- center: A.center,
136
- scale: A.scale,
137
- measures: f,
138
- legendTitle: H,
139
- height: V,
140
- width: G,
141
- topoJSONField: Q,
142
- mappingField: Y,
143
- dataSourceText: j,
144
- dataSourceLabel: J,
145
- nationalAverageLabel: Z,
146
- legendBreaks: Me(K),
147
- mapLabelField: $,
148
- zoomEnabled: C == !0 || C == "true",
149
- showLegendLabels: y == !0 || y == "true",
150
- multipleMeasures: B,
151
- app: o,
135
+ let C = l(Ne) || [];
136
+ C = C.map((e) => (e.bgColor = decodeURIComponent(e.bgColor), e.fontColor = decodeURIComponent(e.fontColor), e));
137
+ const R = da.find((e) => e.value === te), E = w == !0 || w == "true";
138
+ let i = [J, Z].filter((e) => e !== "none" && e !== null).join("/");
139
+ const d = g && g !== "none" ? g : null, p = {
140
+ unique: f,
141
+ editing: u,
142
+ source: `/${X}`,
143
+ center: R.center,
144
+ scale: R.scale,
145
+ measures: h,
146
+ legendTitle: Y,
147
+ height: j,
148
+ width: H,
149
+ topoJSONField: oe,
150
+ mappingField: ee,
151
+ dataSourceText: K,
152
+ dataSourceLabel: $,
153
+ nationalAverageLabel: q,
154
+ legendBreaks: Ge(Q),
155
+ mapLabelField: ae,
156
+ zoomEnabled: y == !0 || y == "true",
157
+ showLegendLabels: L == !0 || L == "true",
158
+ multipleMeasures: E,
159
+ app: t,
152
160
  mapLabelShowValue: F == !0 || F == "true",
153
- showTooltip: L == !0 || L == "true",
154
- showOverallValue: w == !0 || w == "true",
155
- measureSelectorLabel: _,
156
- valueFormat: ee,
157
- autoGenerateBreaks: D == !0 || D == "true",
158
- showNoDataLabel: S == !0 || S == "true",
159
- numberOfBreaks: ae,
160
- colorScheme: te,
161
- group: I,
162
- symbols: l(oe) || [],
163
- tooltipTheme: le,
164
- labelFontSize: re,
165
- labelFontColor: decodeURIComponent(se),
166
- labelFontWeight: ne,
167
- legendFontSize: ie,
168
- legendFontWeight: de,
169
- customTooltips: l(me) || [],
170
- format: ke,
171
- tooltipFontSize: ue,
172
- showAdminUnitLabel: pe,
173
- mapNoDataColor: decodeURIComponent(fe),
174
- mapBoundaryColor: decodeURIComponent(ge),
175
- mapFocusBoundaryColor: decodeURIComponent(he),
176
- highlightedLocation: be,
177
- tooltipFormat: Ce,
178
- showNoDataTooltip: z == !0 || z == "true",
179
- fields: s.split("/"),
180
- mapContainerBgColor: decodeURIComponent(ye),
181
- mapPosition: l(ve),
182
- mainLayerId: Fe,
183
- enabledLayers: h,
184
- pointLabelColor: decodeURIComponent(we),
185
- pointLabelFormat: De,
186
- showNoDataLegendItem: T == !0 || T == "true",
187
- highlightedLocLabelFormat: Se,
188
- mapType: x,
189
- defaultPointColor: decodeURIComponent(Ie),
190
- zoomLevelToShowPoints: ze,
161
+ showTooltip: S == !0 || S == "true",
162
+ showOverallValue: D == !0 || D == "true",
163
+ measureSelectorLabel: le,
164
+ valueFormat: re,
165
+ autoGenerateBreaks: I == !0 || I == "true",
166
+ showNoDataLabel: N == !0 || N == "true",
167
+ numberOfBreaks: ne,
168
+ colorScheme: se,
169
+ group: z,
170
+ symbols: l(ie) || [],
171
+ tooltipTheme: de,
172
+ labelFontSize: me,
173
+ labelFontColor: decodeURIComponent(ue),
174
+ labelFontWeight: ce,
175
+ legendFontSize: pe,
176
+ legendFontWeight: fe,
177
+ customTooltips: l(ge) || [],
178
+ format: Ze,
179
+ tooltipFontSize: be,
180
+ showAdminUnitLabel: Ce,
181
+ mapNoDataColor: decodeURIComponent(ve),
182
+ mapBoundaryColor: decodeURIComponent(ye),
183
+ mapFocusBoundaryColor: decodeURIComponent(Le),
184
+ highlightedLocation: we,
185
+ tooltipFormat: Fe,
186
+ showNoDataTooltip: x == !0 || x == "true",
187
+ fields: i.split("/"),
188
+ mapContainerBgColor: decodeURIComponent(Se),
189
+ mapPosition: l(De),
190
+ mainLayerId: Ie,
191
+ enabledLayers: C,
192
+ pointLabelColor: decodeURIComponent(ze),
193
+ pointLabelFormat: Te,
194
+ showNoDataLegendItem: A == !0 || A == "true",
195
+ highlightedLocLabelFormat: xe,
196
+ mapType: B,
197
+ defaultPointColor: decodeURIComponent(Ae),
198
+ zoomLevelToShowPoints: Ue,
191
199
  zoomOnFilter: U == !0 || U == "true",
192
- zoomOnFilterField: Te,
193
- noDataText: xe,
194
- labelsExclusionList: Ue.split(",").map((e) => e.trim()),
195
- showShadingLayerLabels: Be,
196
- dvzProxyDatasetId: r,
197
- recentlyToggledLayerId: Re
200
+ zoomOnFilterField: Pe,
201
+ noDataText: Re,
202
+ labelsExclusionList: Ee.split(",").map((e) => e.trim()),
203
+ showShadingLayerLabels: Ve,
204
+ dvzProxyDatasetId: n,
205
+ recentlyToggledLayerId: ke
198
206
  };
199
- if (m.recentlyToggledLayerId) {
200
- const e = m.enabledLayers.find((t) => String(t.id) === String(m.recentlyToggledLayerId));
201
- e && (e != null && e.apiField) && (s = (E = e.apiField) == null ? void 0 : E.toLowerCase());
207
+ if (p.recentlyToggledLayerId) {
208
+ const e = p.enabledLayers.find((a) => String(a.id) === String(p.recentlyToggledLayerId));
209
+ e && (e != null && e.apiField) && (i = (V = e.apiField) == null ? void 0 : V.toLowerCase());
202
210
  }
203
- const We = l(Ae) || {}, Ve = o === "csv" ? ta : aa, Ge = d ? (l(f) || []).join(",") : f, R = Pe(P);
204
- r && (R.dvzProxyDatasetId = r);
205
- const je = Ye(), Je = ["data", "categories", o, ...r ? [r] : [], "items"], b = $e((e) => e.getIn(Je)), Ze = He(() => b ? b.toJS() : [], [b]);
206
- return Ke(() => {
207
- o && o !== "csv" && je(_e({ app: o, dvzProxyDatasetId: r }));
208
- }, [o, r]), /* @__PURE__ */ i(
209
- Qe,
211
+ const _e = l(Me) || {}, je = t === "csv" ? ia : sa, He = u ? (l(h) || []).join(",") : h, m = Je(W);
212
+ if (d) {
213
+ const e = We(m, d);
214
+ e != null && e !== "" && (m[d] = e);
215
+ }
216
+ const Ke = (l(_) || []).filter((e) => e && e !== "none"), M = Array.from(new Set([d, ...Ke].filter(Boolean)));
217
+ M.length > 0 && (m.includeColumns = M.join(",")), n && (m.dvzProxyDatasetId = n);
218
+ const $e = aa(), qe = ["data", "categories", t, ...n ? [n] : [], "items"], v = oa((e) => e.getIn(qe)), Ye = Qe(() => v ? v.toJS() : [], [v]);
219
+ return Xe(() => {
220
+ t && t !== "csv" && $e(ra({ app: t, dvzProxyDatasetId: n }));
221
+ }, [t, n]), /* @__PURE__ */ c(
222
+ ta,
210
223
  {
211
- params: R,
212
- app: o,
213
- csv: decodeURIComponent(k),
214
- group: I,
215
- editing: d,
216
- store: [o, u, ...s.split("/")],
217
- source: s,
218
- children: /* @__PURE__ */ i(Xe, { children: /* @__PURE__ */ i(
219
- Ve,
224
+ params: m,
225
+ app: t,
226
+ csv: decodeURIComponent(G),
227
+ group: z,
228
+ editing: u,
229
+ store: [t, f, ...i.split("/")],
230
+ source: i,
231
+ children: /* @__PURE__ */ c(la, { children: /* @__PURE__ */ c(
232
+ je,
220
233
  {
221
- measures: Ge,
222
- multipleMeasures: B,
223
- mapType: x,
224
- aggregationFormula: Ne,
225
- customMeasureLabels: We,
226
- source: s,
227
- extraDimension: Oe,
228
- allDimensions: Ze,
229
- children: /* @__PURE__ */ i(ea, { ...m })
234
+ measures: He,
235
+ multipleMeasures: E,
236
+ mapType: B,
237
+ aggregationFormula: Be,
238
+ customMeasureLabels: _e,
239
+ source: i,
240
+ extraDimension: d,
241
+ allDimensions: Ye,
242
+ children: /* @__PURE__ */ c(na, { ...p })
230
243
  }
231
244
  ) })
232
245
  }
233
246
  );
234
- }, na = (n, u) => {
235
- }, sa = {}, Fa = qe(na, sa)(la);
247
+ }, ua = (s, f) => {
248
+ }, pa = {}, za = ea(ua, pa)(ma);
236
249
  export {
237
- Fa as default
250
+ za as default
238
251
  };
@@ -1,18 +1,17 @@
1
1
  import { jsx as e, jsxs as g } from "react/jsx-runtime";
2
- import y, { useState as v, useRef as G, useEffect as I } from "react";
3
- import { Container as b, Accordion as p, Icon as V, Menu as T, Grid as w, Label as M, Button as W } from "semantic-ui-react";
4
- import { PostProvider as q, PostConsumer as N, MediaProvider as P, MediaConsumer as k, PostIcon as L, PostLabel as S } from "@devgateway/wp-react-lib";
2
+ import y, { useState as v, useRef as V, useEffect as I } from "react";
3
+ import { Container as f, Accordion as p, Icon as W, Menu as T, Grid as w, Label as M, Button as q } from "semantic-ui-react";
4
+ import { PostProvider as z, PostConsumer as N, MediaProvider as P, MediaConsumer as A, PostIcon as k, PostLabel as L } from "@devgateway/wp-react-lib";
5
5
  import { injectIntl as E } from "react-intl";
6
- import { connect as z } from "react-redux";
7
- import A from "../connected-templates/PostIntro.js";
8
- import { useWindowDimensionsAndDevice as O } from "../../lib/hooks/window-dimensions.js";
9
- import { parse as U } from "../utils/parseUtils.js";
6
+ import { connect as O } from "react-redux";
7
+ import S from "../connected-templates/PostIntro.js";
8
+ import { useWindowDimensionsAndDevice as U } from "../../lib/hooks/window-dimensions.js";
10
9
  const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.map((l) => /* @__PURE__ */ e(
11
10
  T.Item,
12
11
  {
13
12
  onClick: () => i(l.slug),
14
13
  className: l.slug === c ? "active" : "",
15
- children: n ? /* @__PURE__ */ e(S, { post: l }) : /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: l.title.rendered } }) })
14
+ children: n ? /* @__PURE__ */ e(L, { post: l }) : /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: l.title.rendered } }) })
16
15
  },
17
16
  l.id
18
17
  )) : null, J = ({
@@ -30,7 +29,7 @@ const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.ma
30
29
  {
31
30
  className: (r.slug === c ? "active" : "") + (n ? " has-icon" : ""),
32
31
  children: /* @__PURE__ */ g(
33
- W,
32
+ q,
34
33
  {
35
34
  onClick: () => i(r.slug),
36
35
  className: `nav ${o === 1 ? "one" : ""}`,
@@ -39,10 +38,10 @@ const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.ma
39
38
  P,
40
39
  {
41
40
  id: (m = r.meta_fields) != null && m.icon ? r.meta_fields.icon[0] : null,
42
- children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(L, { className: "icon" }) })
41
+ children: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(k, { className: "icon" }) })
43
42
  }
44
43
  ),
45
- l ? /* @__PURE__ */ e(S, { post: r }) : /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(
44
+ l ? /* @__PURE__ */ e(L, { post: r }) : /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(
46
45
  "span",
47
46
  {
48
47
  dangerouslySetInnerHTML: { __html: r.title.rendered }
@@ -71,11 +70,11 @@ const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.ma
71
70
  visibility: "visible",
72
71
  position: "relative",
73
72
  width: "auto"
74
- }, /* @__PURE__ */ e(A, { as: b, fluid: !0, post: i, style: n }, i.slug);
73
+ }, /* @__PURE__ */ e(S, { as: f, fluid: !0, post: i, style: n }, i.slug);
75
74
  }) : null), K = ({ posts: t, activeItem: c, setActive: i }) => {
76
75
  const [n, l] = v(
77
76
  t.findIndex((s) => s.slug === c)
78
- ), [o, r] = v(null), d = G(null);
77
+ ), [o, r] = v(null), d = V(null);
79
78
  I(() => {
80
79
  if (o) {
81
80
  const s = o.getBoundingClientRect().top + window.scrollY;
@@ -110,7 +109,7 @@ const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.ma
110
109
  },
111
110
  children: [
112
111
  /* @__PURE__ */ g("div", { style: { display: "flex", alignItems: "center" }, children: [
113
- a && /* @__PURE__ */ e(P, { id: a, children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(L, { className: "icon" }) }) }),
112
+ a && /* @__PURE__ */ e(P, { id: a, children: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(k, { className: "icon" }) }) }),
114
113
  /* @__PURE__ */ e(
115
114
  "span",
116
115
  {
@@ -119,7 +118,7 @@ const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.ma
119
118
  }
120
119
  )
121
120
  ] }),
122
- /* @__PURE__ */ e(V, { name: "chevron down" })
121
+ /* @__PURE__ */ e(W, { name: "chevron down" })
123
122
  ]
124
123
  }
125
124
  )
@@ -130,7 +129,7 @@ const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.ma
130
129
  {
131
130
  className: "accordion-post-content",
132
131
  active: n === u,
133
- children: /* @__PURE__ */ e("div", { ref: d, children: /* @__PURE__ */ e(A, { post: s, as: b, fluid: !0 }) })
132
+ children: /* @__PURE__ */ e("div", { ref: d, children: /* @__PURE__ */ e(S, { post: s, as: f, fluid: !0 }) })
134
133
  }
135
134
  )
136
135
  ] }, s.id);
@@ -147,13 +146,13 @@ const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.ma
147
146
  }, [t]), /* @__PURE__ */ g(y.Fragment, { children: [
148
147
  t.map((o) => /* @__PURE__ */ e("anchor", { id: o.slug }, o.slug)),
149
148
  /* @__PURE__ */ e(T, { className: "tabbed posts", text: !0, children: /* @__PURE__ */ e(Y, { showLabels: c, posts: t, setActive: l, activeItem: n }) }),
150
- /* @__PURE__ */ e(b, { className: "content-tab", style: { height: `${i}px` }, children: /* @__PURE__ */ e($, { posts: t, activeItem: n }) })
149
+ /* @__PURE__ */ e(f, { className: "content-tab", style: { height: `${i}px` }, children: /* @__PURE__ */ e($, { posts: t, activeItem: n }) })
151
150
  ] });
152
151
  }, X = ({ posts: t, showLabels: c, showIcons: i, height: n }) => {
153
152
  const [l, o] = v(t ? t[0].slug : null);
154
153
  return /* @__PURE__ */ e(y.Fragment, { children: /* @__PURE__ */ g(w, { stackable: !0, className: "tabbed posts", columns: t.length, style: { height: n + "px" }, children: [
155
154
  /* @__PURE__ */ e(J, { showIcons: i, showLabels: c, posts: t, activeItem: l, setActive: o }),
156
- /* @__PURE__ */ e(w.Row, { style: { height: `${n}px` }, children: /* @__PURE__ */ e(w.Column, { width: 16, className: "content", children: /* @__PURE__ */ e(b, { className: "content-tab", style: { height: `${n}px` }, children: /* @__PURE__ */ e($, { className: "content-tab", posts: t, activeItem: l }) }) }) })
155
+ /* @__PURE__ */ e(w.Row, { style: { height: `${n}px` }, children: /* @__PURE__ */ e(w.Column, { width: 16, className: "content", children: /* @__PURE__ */ e(f, { className: "content-tab", style: { height: `${n}px` }, children: /* @__PURE__ */ e($, { className: "content-tab", posts: t, activeItem: l }) }) }) })
157
156
  ] }) });
158
157
  }, Z = (t) => {
159
158
  var _;
@@ -170,22 +169,22 @@ const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.ma
170
169
  "data-preview-mode": u = "Desktop",
171
170
  pageModuleProps: a,
172
171
  parent: h,
173
- editing: f,
174
- unique: D
172
+ editing: b,
173
+ unique: j
175
174
  } = t;
176
- a != null && a.previewMode && (a != null && a.editing) && (u = a.previewMode, f = a.editing);
177
- const R = t.intl.locale, x = d === "true", C = x ? s : void 0, { width: j } = O(), H = j <= 1024, B = u !== "Desktop" && f, F = H && !f;
178
- return /* @__PURE__ */ e(b, { className: `viz tabbed posts ${f ? "editing" : ""} ${x ? "scrollable" : ""}`, fluid: !0, children: /* @__PURE__ */ e(
179
- q,
175
+ a != null && a.previewMode && (a != null && a.editing) && (u = a.previewMode, b = a.editing);
176
+ const D = t.intl.locale, R = Array.isArray(n) ? n.join(",") : n, x = d === "true", C = x ? s : void 0, { width: H } = U(), B = H <= 1024, F = u !== "Desktop" && b, G = B && !b;
177
+ return /* @__PURE__ */ e(f, { className: `viz tabbed posts ${b ? "editing" : ""} ${x ? "scrollable" : ""}`, fluid: !0, children: /* @__PURE__ */ e(
178
+ z,
180
179
  {
181
- locale: R,
180
+ locale: D,
182
181
  type: c,
183
182
  taxonomy: i,
184
- categories: U(n, f),
185
- store: `tabbedposts_${h}_${D}`,
183
+ categories: R,
184
+ store: `tabbedposts_${h}_${j}`,
186
185
  page: 1,
187
186
  perPage: l,
188
- children: /* @__PURE__ */ e(N, { children: /* @__PURE__ */ e(N, { children: F || B ? /* @__PURE__ */ e(K, { posts: l, activeItem: (_ = l[0]) == null ? void 0 : _.slug, setActive: () => {
187
+ children: /* @__PURE__ */ e(N, { children: /* @__PURE__ */ e(N, { children: G || F ? /* @__PURE__ */ e(K, { posts: l, activeItem: (_ = l[0]) == null ? void 0 : _.slug, setActive: () => {
189
188
  } }) : o === "light" ? /* @__PURE__ */ e(Q, { height: C, showLabels: m === "true" }) : /* @__PURE__ */ e(
190
189
  X,
191
190
  {
@@ -202,7 +201,7 @@ const Y = ({ posts: t, activeItem: c, setActive: i, showLabels: n }) => t ? t.ma
202
201
  "pageModuleProps"
203
202
  ]), n = {};
204
203
  return i && (n.pageModuleProps = i), n;
205
- }, te = {}, ue = z(ee, te)(E(Z));
204
+ }, te = {}, de = O(ee, te)(E(Z));
206
205
  export {
207
- ue as default
206
+ de as default
208
207
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.9.9",
3
+ "version": "1.9.10",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",