@devgateway/dvz-ui-react 1.6.2 → 1.6.4
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/dist/cjs/embeddable/chart/Tooltip.js +1 -1
- package/dist/cjs/embeddable/common/ChartTooltip.js +1 -1
- package/dist/cjs/embeddable/download/index.js +1 -1
- package/dist/cjs/embeddable/filter/index.js +1 -1
- package/dist/cjs/embeddable/filtered-posts/index.js +1 -1
- package/dist/cjs/embeddable/posts-filter/CategoricalFilter.js +1 -1
- package/dist/cjs/embeddable/posts-filter/PostsFilterDropdown.js +1 -1
- package/dist/cjs/embeddable/posts-filter/YearFilter.js +1 -1
- package/dist/cjs/embeddable/reducers/data.js +1 -1
- package/dist/esm/embeddable/chart/Tooltip.js +45 -40
- package/dist/esm/embeddable/common/ChartTooltip.js +10 -10
- package/dist/esm/embeddable/download/index.js +1 -1
- package/dist/esm/embeddable/filter/index.js +1 -1
- package/dist/esm/embeddable/filtered-posts/index.js +18 -18
- package/dist/esm/embeddable/posts-filter/CategoricalFilter.js +26 -25
- package/dist/esm/embeddable/posts-filter/PostsFilterDropdown.js +37 -34
- package/dist/esm/embeddable/posts-filter/YearFilter.js +31 -28
- package/dist/esm/embeddable/reducers/data.js +78 -78
- package/dist/types/dvz-ui/src/embeddable/reducers/post-reducer.d.ts +157 -23
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime");require("react");const h=require("react-markdown"),j=require("remark-gfm"),v=require("rehype-raw"),p=require("string-template"),_=/(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi,q=/(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi,N=/(\+?\#C)[\(]([A-z0-9,.,-]+)\)/gi,m=(n,e,o,s,r,g)=>{if(!r||!r.formatNumber)return e;let t,a=e;for(;(t=n.exec(e))!==null;){const u=t[2],c=t[1],x=((f,y=2)=>r.formatNumber(s?f/100:f,{maximumFractionDigits:y,...o,signDisplay:c&&c.startsWith("+")?"never":"auto"})).apply(void 0,u.split(","));a=a.replaceAll(t[0],x)}return a},d=(n,e,o,s)=>{if(!n||!e)return"";e.field&&e[`_${e.field}`]&&(e._value=e[`_${e.field}`]),!e.field&&e.category&&(e.field=e.category);let r=s?p(n,e):p(n,e).replace(/(?:\r\n|\r|\n)/g,"<br>");return r=m(_,r,{style:"percent"},!0,o),r=m(q,r,{style:"decimal"},!1,o),r=m(N,r,{notation:"compact"},!1,o),r},F=({tooltip:n,d:e,intl:o,tooltipEnableMarkdown:s})=>{if(!e||!n)return i.jsx("div",{});const r=e.datum||e.point||e,{color:g,data:t}=r||{},a=e.value||(e.datum?e.datum.value:null)||(e.point?e.point.data.y:null);if(t){let u;t.variables?u=typeof t.variables[e.id]=="object"?t.variables[e.id]:t.variables:u=t;const c={field:e.point?e.point.serieId:e.id||"",...u,value:a};t.measureFieldName&&t.variables&&(c.populationValue=t.variables[t.measureFieldName+"Population"]);const l=d(n,c,o,s);return l?s?i.jsx("div",{className:"chart tooltip",children:i.jsx(h,{children:l,remarkPlugins:[j],rehypePlugins:[v]})}):i.jsx("div",{className:"chart tooltip",children:i.jsx("div",{dangerouslySetInnerHTML:{__html:l}})}):i.jsx("div",{})}else return i.jsx("div",{})};exports.default=F;exports.formatContent=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime");require("react");const h=require("react-markdown"),x=require("remark-gfm"),y=require("rehype-raw"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime");require("react");const h=require("react-markdown"),x=require("remark-gfm"),y=require("rehype-raw"),d=require("string-template"),j=/(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi,b=/(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi,q=/(\+?\#C)[\(]([A-z0-9,.,-]+)\)/gi,m=(n,e,a,s,t,r)=>{let o,i=e;for(;(o=n.exec(e))!==null;){const u=o[2],l=o[1],v=((p,g=2)=>t.formatNumber(s?p/100:p,{maximumFractionDigits:g,...a,signDisplay:l&&l.startsWith("+")?"never":"auto"})).apply(void 0,u.split(","));i=i.replaceAll(o[0],v)}return i},f=(n,e,a,s)=>{let t=s?d(n,e):d(n,e).replace(/(?:\r\n|\r|\n)/g,"<br>");return t=m(j,t,{style:"percent"},!0,a),t=m(b,t,{style:"decimal"},!1,a),t=m(q,t,{notation:"compact"},!1,a),t},F=({tooltip:n,d:e,intl:a,tooltipEnableMarkdown:s})=>{const{color:t,data:r}=e.datum||e.point||e,o=e.value||(e.datum?e.datum.value:null)||(e.point?e.point.data.y:null);if(r){const i=r.variables?r.variables[e.id]||r.variables:r,u={field:e.point?e.point.serieId:e.id,...i,value:o};r.measureFieldName&&(u.populationValue=r.variables[r.measureFieldName+"Population"]);const l=f(n,u,a,s);return s?c.jsx("div",{className:"chart tooltip",children:c.jsx(h,{children:l,remarkPlugins:[x],rehypePlugins:[y]})}):c.jsx("div",{className:"chart tooltip",children:c.jsx("div",{dangerouslySetInnerHTML:{__html:l}})})}else return c.jsx("div",{})};exports.default=F;exports.formatContent=f;
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
${d||u?"has-formats":""}
|
|
3
3
|
${s||c!=null&&c.editing?"editing":""}
|
|
4
4
|
${d&&u?"multi-format":""}
|
|
5
|
-
${d&&!u||!d&&u?"single-format":""}`,fluid:!0,children:t.jsxs(z,{ref:r,children:[t.jsxs(o.Grid,{stackable:!0,reversed:"mobile",className:"download-header",children:[!s&&w==="true"&&t.jsx(o.Grid.Column,{width:12,children:t.jsx(G.PostContent,{parentUnique:i.unique,post:{content:{rendered:decodeURIComponent(J)}}})}),t.jsx(o.Grid.Column,{className:s?"editing ignore":"ignore",width:s||w!=="true"?16:4,textAlign:"right",children:t.jsxs("div",{className:"wrapper",children:[t.jsxs(o.Button,{className:"download",onClick:()=>j(p),children:[R," ",p==="PNG"?"PNG":"JPG"]}),t.jsx(o.Dropdown,{className:"download","data-tooltip":decodeURIComponent(A),trigger:u
|
|
5
|
+
${d&&!u||!d&&u?"single-format":""}`,fluid:!0,children:t.jsxs(z,{ref:r,children:[t.jsxs(o.Grid,{stackable:!0,reversed:"mobile",className:"download-header",children:[!s&&w==="true"&&t.jsx(o.Grid.Column,{width:12,children:t.jsx(G.PostContent,{parentUnique:i.unique,post:{content:{rendered:decodeURIComponent(J)}}})}),t.jsx(o.Grid.Column,{className:s?"editing ignore":"ignore",width:s||w!=="true"?16:4,textAlign:"right",children:t.jsxs("div",{className:"wrapper",children:[t.jsxs(o.Button,{className:"download",onClick:()=>j(p),children:[R," ",p==="PNG"?"PNG":"JPG"]}),t.jsx(o.Dropdown,{className:"download","data-tooltip":decodeURIComponent(A),trigger:u||d?t.jsx(o.Icon,{name:"download",className:"download-icon"}):null,children:t.jsxs(o.Dropdown.Menu,{children:[S,d===!0&&t.jsxs(o.Dropdown.Item,{onClick:()=>{g("PNG"),j("PNG")},children:[t.jsx("input",{type:"radio",value:"PNG",checked:p==="PNG",onChange:C}),t.jsx("label",{children:T})]}),u===!0&&t.jsxs(o.Dropdown.Item,{onClick:()=>{g("JPG"),j("JPG")},children:[t.jsx("input",{type:"radio",value:"JPG",checked:p==="JPG",onChange:C}),t.jsx("label",{children:q})]})]})})]})})]}),!s&&t.jsx(o.Container,{fluid:!0,className:`download area ${s||c!=null&&c.editing?"editing":""}`,children:t.jsx(G.PostContent,{parentUnique:i.unique,post:{content:{rendered:h}}})})]})})},_=i=>{const r=i.getIn(["data","pageModuleProps"]),h={};return r&&(h.pageModuleProps=r),h},B={},O=W.connect(_,B)(H);exports.default=O;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),b=require("react"),a=require("semantic-ui-react"),G=require("../data/CategoriesConsumer.js"),z=require("../data/CategoriesProvider.js"),P=require("react-redux"),H=require("../reducers/data.js"),K=require("react-intl"),Y=require("@devgateway/wp-react-lib"),W="multi-select",A="single-select",Q="NO_DATA",X="DEFAULT_VALUE_INPUT",Z="LOWEST_VALUE",ee="HIGHEST_VALUE",T=t=>t instanceof Boolean?t:t=="true",te=(t,c)=>t?t.sort((r,i)=>r.position-i.position).map(r=>{const i=c&&r.labels&&r.labels[c.toUpperCase()]?r.labels[c.toUpperCase()]:r.value;return{key:r.id,value:r.id,text:i,icon:r.value.toLocaleLowerCase(),position:r.position?r.position:r.value}}):[],ne=t=>decodeURIComponent(t),J=t=>{if(!t||t=="")return null;try{return JSON.parse(ne(t))}catch(c){throw new Error("error parsing value:"+c)}},V=(t,c)=>{const{app:r,group:i,param:o}=c;return{current:t.getIn(["data","filters",r,i,o])}},$={onInit:H.setInitialFilters,onChange:H.setFilter},M=t=>{const{isRange:c,options:r,alphabeticalSort:i,ascOrder:o}=t;T(i)?r.sort(function(f,d){const l=f.text?f.text.toLowerCase():"",g=d.text?d.text.toLowerCase():"";return T(o)?l<g?-1:l>g?1:0:l<g?1:l>g?-1:0}):r.sort(function(f,d){return T(o)?f.position-d.position:d.position-f.position});const h={...t,options:r};return c?e.jsx(le,{...h}):e.jsx(re,{...h})},re=P.connect(V,$)(t=>{const{allLabel:c,noneLabel:r,placeholder:i,options:o,app:h,group:f,param:d,current:l,onChange:g,onInit:u,useSingleColumn:v,enableTextSearch:m,filterType:S,defaultValues:L,showNoDataOption:I,defaultValueCriteria:x,allNoneSameBehaviour:p,closeOnSelect:w,hiddenFilters:F,autoApply:N}=t,[R,k]=b.useState(""),_=n=>{let s=[];S!=A&&!w&&l&&l.indexOf(n)>-1?s=l.filter(C=>C!==n):S!=A&&l&&!w?s=[...l,n]:s=[n],g({app:h,group:f,param:d,value:s,autoApply:N}),w&&E.current&&E.current.close()},q=n=>{const s=o.filter(C=>m&&j&&j.trim().length>0&&C.text?C.text.toLowerCase().includes(j.toLowerCase()):!0);g({app:h,group:f,param:d,value:s.map(C=>C.value),autoApply:N}),w&&E.current&&E.current.close()},U=()=>{const n=o.filter(s=>m&&j&&j.trim().length>0&&s.text?s.text.toLowerCase().includes(j.toLowerCase()):!0);g({app:h,group:f,param:d,value:p?n.map(s=>s.value):[],autoApply:N}),w&&E.current&&E.current.close()},O=n=>{D(n)};b.useEffect(()=>{if(!l){const n=o.map(s=>s.value);if(S==W||S=="")u({app:h,group:f,param:d,value:n});else if(h=="csv"){let s=[];x===X?s=L?L.split(","):[]:x==Z?s=n.length>0?[n[0]]:[]:x==ee&&(s=n.length>0?[n[n.length-1]]:[]),u({app:h,group:f,param:d,value:s})}else u({app:h,group:f,param:d,value:[n[0]]})}},[]);const B=()=>{if(S==A){const n=l&&l[0]?o.filter(s=>s.value==l[0])[0]:null;return`${i} ${n?n.text:""}`}else return`${i} (${l?l.filter(n=>n==Number.MIN_SAFE_INTEGER?!1:F&&F.length>0?F.indexOf(n)==-1:!0).length:0}/${o.filter(n=>F&&F.length>0?F.indexOf(n.id)==-1:!0).length}) `},E=b.useRef(null),[j,D]=b.useState("");return e.jsx(a.Dropdown,{ref:E,fluid:!0,text:B(),scrolling:!1,button:!0,icon:"angle down ignore",multiple:!0,search:!0,floating:!1,className:`${l&&l.length>0?"applied ":""}`,children:e.jsxs(a.Dropdown.Menu,{children:[S!=A&&e.jsxs(e.Fragment,{children:[e.jsx(a.Segment,{children:e.jsxs(a.Dropdown.Item,{children:[e.jsx(a.Label,{basic:!0,onClick:q,children:c})," ","|"," ",e.jsx(a.Label,{basic:!0,onClick:U,children:r})]})}),m&&e.jsxs(e.Fragment,{children:[e.jsx(a.Container,{children:e.jsx(a.Dropdown.Item,{children:e.jsx("div",{className:"ui action input",children:e.jsxs(a.Input,{placeholder:"Search...",children:[e.jsx("input",{className:"filter-search",value:j,onChange:n=>{O(n.target.value)}}),e.jsx(a.Icon,{name:"remove",link:!0,className:"clear-icon ignore",onClick:n=>{O("")}})]})})})}),e.jsx(a.Divider,{})]})]}),e.jsx("br",{}),e.jsx(a.Container,{className:v?"dropdown-single-column":"",children:o.filter(n=>m&&j&&j.trim().length>0&&n.text?n.text.toLowerCase().includes(j.toLowerCase()):!0).map(({value:n,text:s},C)=>e.jsxs(a.Dropdown.Item,{className:v?"dropdown-item-single-column":"",children:[S==A&&e.jsx(a.Radio,{checked:!!(l&&l.indexOf(n)>-1),onChange:y=>_(n),label:s}),S==W&&e.jsx(a.Checkbox,{checked:!!(l&&l.indexOf(n)>-1&&!(o.length==l.length&&p)),onChange:y=>_(n),label:s})]},C))})]})})}),le=P.connect(V,$)(({placeholder:t,startLabel:c,endLabel:r,options:i,onChange:o,app:h,group:f,param:d,current:l,autoApply:g})=>{const[u,v]=b.useState(i[0].position),[m,S]=b.useState(i[i.length-1].position);b.useEffect(()=>{const I=i.filter(x=>(x.position>u||x.position===u)&&(x.position<m||x.position===m)).map(x=>x.value);o({app:h,group:f,param:d,value:I,autoApply:g})},[u,m]);const L=b.useRef(null);return e.jsx(a.Dropdown,{ref:L,fluid:!0,text:`${t} (${l?l.filter(I=>I!=Number.MIN_SAFE_INTEGER).length:0}/${i.length})`,scrolling:!1,button:!0,multiple:!0,search:!0,floating:!1,icon:"angle down ignore",className:`${l&&l.length>0?"applied ":""} range`,children:e.jsxs(a.Dropdown.Menu,{children:[e.jsx(a.Segment,{children:e.jsxs(a.Dropdown.Item,{children:[" ",e.jsx(a.Label,{basic:!0,children:c})]})}),e.jsx(a.Container,{children:i.map(({value:I,text:x,position:p})=>e.jsx(a.Dropdown.Item,{children:e.jsx(a.Radio,{disabled:p>m,checked:u===p,onChange:w=>v(p),label:x})}))}),e.jsx(a.Segment,{children:e.jsxs(a.Dropdown.Item,{children:[" ",e.jsx(a.Label,{basic:!0,children:r})]})}),e.jsx(a.Container,{children:i.map(({value:I,text:x,position:p})=>e.jsx(a.Dropdown.Item,{children:e.jsx(a.Radio,{disabled:p<u,checked:m===p,onChange:w=>S(p),label:x})}))})]})})}),ae=t=>{const{data:c,type:r,showNoDataOption:i}=t,o=c.filter(u=>u.type===r)[0],h=o?o.items.filter(u=>!i&&u.code==Q?!1:t.hiddenFilters&&t.hiddenFilters.length>0?t.hiddenFilters.indexOf(u.id)==-1:!0):[],f=h?te(h,t.locale):[],d=c.find(u=>u.type="FilterDefinition"),l=d?d.items.find(u=>u.fieldType==r):null,g=l?l.value:"Filter";return e.jsx(a.Container,{fluid:!0,className:"filter",children:e.jsx(M,{...t,options:f,placeholder:t.placeholder?t.placeholder:g})})},se=P.connect(V,$)(t=>{let c=0;const r=[{key:"Yes",value:!0,text:"Yes",position:c++},{key:"No",value:!1,text:"No",position:c++}];return e.jsx(a.Container,{fluid:!0,className:"filter",children:e.jsx(M,{options:r,...t})})}),ie=t=>{const{csvValue:c}=t;let r=0;const i=c.split(",").map(o=>({key:o,value:o,text:o,icon:o.toLocaleLowerCase(),position:r++}));return e.jsx(a.Container,{fluid:!0,className:"filter",children:e.jsx(M,{options:i,...t,children:" "})})},oe=t=>e.jsx(Y.SettingProvider,{locale:t.intl.locale,changeUUID:t.unique,children:e.jsx(Y.SettingsConsumer,{children:e.jsx(ce,{...t})})}),ce=({unique:t,"data-group":c,"data-app":r,"data-dvz-proxy-dataset-id":i,"data-param":o,"data-icon":h,"data-type":f,"data-place-holder":d,"data-is-range":l="false","data-all-label":g,"data-none-label":u,"data-start-label":v,"data-end-label":m,"data-csv-value":S,"data-filters":L="[]","data-use-single-column":I="false","data-enable-text-search":x="false","data-filter-type":p,"data-default-values":w,"data-show-no-data-option":F="true","data-default-value-criteria":N="DEFAULT_VALUE_INPUT","data-hidden-filters":R="[]","data-all-none-same-behaviour":k="false","data-close-on-select":_="false","data-alphabetical-sort":q="true","data-asc-order":U="true","data-auto-apply":O="true",settings:B,intl:E})=>{const j={},D=L?J(L):{};D&&D.forEach&&D.forEach(C=>{C.value!=null&&C.value.filter(y=>y!=null&&y.toString().trim()!="").length>0&&(j[C.param]=C.value)}),i&&(j.dvzProxyDatasetId=i);const n=R?J(R):[];let s;return p==null||p==""?s=l==="true"?"range":"multi-select":s=p,r==="csv"?e.jsx(ie,{allLabel:g,noneLabel:u,isRange:l==="true",csvValue:S,app:r,group:c,icon:h,placeholder:d,startLabel:v,endLabel:m,param:o,ascOrder:U,useSingleColumn:I==="true",enableTextSearch:x==="true",filterType:s,defaultValues:w,defaultValueCriteria:N,allNoneSameBehaviour:k==="true",closeOnSelect:_==="true",locale:E.locale}):r?e.jsx(z.default,{dvzProxyDatasetId:i,params:j,app:r,uniqueStorage:D.length>0?t:null,hiddenFilters:n||[],children:e.jsx(G.default,{children:e.jsxs(a.Container,{fluid:!0,children:[f==="Boolean"&&e.jsx(se,{startLabel:v,endLabel:m,allLabel:g,noneLabel:u,isRange:T(l),app:r,group:c,icon:h,placeholder:d,param:o,filterType:s,defaultValues:w,locale:E.locale}),f!=="Boolean"&&e.jsx(G.default,{type:f,children:e.jsx(ae,{startLabel:v,endLabel:m,allLabel:g,noneLabel:u,isRange:T(l),app:r,group:c,icon:h,placeholder:d,param:o,alphabeticalSort:q,ascOrder:U,useSingleColumn:T(I),enableTextSearch:T(x),showNoDataOption:T(F),filterType:s,defaultValues:w,defaultValueCriteria:N,hiddenFilters:n||[],allNoneSameBehaviour:k=="true",autoApply:T(O),closeOnSelect:T(_),locale:E.locale})})]})})}):null},ue=K.injectIntl(oe);exports.default=ue;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),b=require("react"),a=require("semantic-ui-react"),G=require("../data/CategoriesConsumer.js"),z=require("../data/CategoriesProvider.js"),P=require("react-redux"),H=require("../reducers/data.js"),K=require("react-intl"),Y=require("@devgateway/wp-react-lib"),W="multi-select",A="single-select",Q="NO_DATA",X="DEFAULT_VALUE_INPUT",Z="LOWEST_VALUE",ee="HIGHEST_VALUE",T=t=>t instanceof Boolean?t:t=="true",te=(t,c)=>t?t.sort((r,i)=>r.position-i.position).map(r=>{const i=c&&r.labels&&r.labels[c.toUpperCase()]?r.labels[c.toUpperCase()]:r.value;return{key:r.id,value:r.id,text:i,icon:r.value.toLocaleLowerCase(),position:r.position?r.position:r.value}}):[],ne=t=>decodeURIComponent(t),J=t=>{if(!t||t=="")return null;try{return JSON.parse(ne(t))}catch(c){throw new Error("error parsing value:"+c)}},V=(t,c)=>{const{app:r,group:i,param:o}=c;return{current:t.getIn(["data","filters",r,i,o])}},$={onInit:H.setInitialFilters,onChange:H.setFilter},M=t=>{const{isRange:c,options:r,alphabeticalSort:i,ascOrder:o}=t;T(i)?r.sort(function(f,d){const l=f.text?f.text.toLowerCase():"",g=d.text?d.text.toLowerCase():"";return T(o)?l<g?-1:l>g?1:0:l<g?1:l>g?-1:0}):r.sort(function(f,d){return T(o)?f.position-d.position:d.position-f.position});const h={...t,options:r};return c?e.jsx(le,{...h}):e.jsx(re,{...h})},re=P.connect(V,$)(t=>{const{allLabel:c,noneLabel:r,placeholder:i,options:o,app:h,group:f,param:d,current:l,onChange:g,onInit:u,useSingleColumn:v,enableTextSearch:m,filterType:S,defaultValues:L,showNoDataOption:I,defaultValueCriteria:x,allNoneSameBehaviour:p,closeOnSelect:w,hiddenFilters:F,autoApply:N}=t,[R,k]=b.useState(""),_=n=>{let s=[];S!=A&&!w&&l&&l.indexOf(n)>-1?s=l.filter(C=>C!==n):S!=A&&l&&!w?s=[...l,n]:s=[n],g({app:h,group:f,param:d,value:s,autoApply:N}),w&&E.current&&E.current.close()},q=n=>{const s=o.filter(C=>m&&j&&j.trim().length>0&&C.text?C.text.toLowerCase().includes(j.toLowerCase()):!0);g({app:h,group:f,param:d,value:s.map(C=>C.value),autoApply:N}),w&&E.current&&E.current.close()},U=()=>{const n=o.filter(s=>m&&j&&j.trim().length>0&&s.text?s.text.toLowerCase().includes(j.toLowerCase()):!0);g({app:h,group:f,param:d,value:p?n.map(s=>s.value):[],autoApply:N}),w&&E.current&&E.current.close()},O=n=>{D(n)};b.useEffect(()=>{if(!l){const n=o.map(s=>s.value);if(S==W||S=="")u({app:h,group:f,param:d,value:n});else if(h=="csv"){let s=[];x===X?s=L?L.split(","):[]:x==Z?s=n.length>0?[n[0]]:[]:x==ee&&(s=n.length>0?[n[n.length-1]]:[]),u({app:h,group:f,param:d,value:s})}else u({app:h,group:f,param:d,value:[n[0]],autoApply:N})}},[]);const B=()=>{if(S==A){const n=l&&l[0]?o.filter(s=>s.value==l[0])[0]:null;return`${i} ${n?n.text:""}`}else return`${i} (${l?l.filter(n=>n==Number.MIN_SAFE_INTEGER?!1:F&&F.length>0?F.indexOf(n)==-1:!0).length:0}/${o.filter(n=>F&&F.length>0?F.indexOf(n.id)==-1:!0).length}) `},E=b.useRef(null),[j,D]=b.useState("");return e.jsx(a.Dropdown,{ref:E,fluid:!0,text:B(),scrolling:!1,button:!0,icon:"angle down ignore",multiple:!0,search:!0,floating:!1,className:`${l&&l.length>0?"applied ":""}`,children:e.jsxs(a.Dropdown.Menu,{children:[S!=A&&e.jsxs(e.Fragment,{children:[e.jsx(a.Segment,{children:e.jsxs(a.Dropdown.Item,{children:[e.jsx(a.Label,{basic:!0,onClick:q,children:c})," ","|"," ",e.jsx(a.Label,{basic:!0,onClick:U,children:r})]})}),m&&e.jsxs(e.Fragment,{children:[e.jsx(a.Container,{children:e.jsx(a.Dropdown.Item,{children:e.jsx("div",{className:"ui action input",children:e.jsxs(a.Input,{placeholder:"Search...",children:[e.jsx("input",{className:"filter-search",value:j,onChange:n=>{O(n.target.value)}}),e.jsx(a.Icon,{name:"remove",link:!0,className:"clear-icon ignore",onClick:n=>{O("")}})]})})})}),e.jsx(a.Divider,{})]})]}),e.jsx("br",{}),e.jsx(a.Container,{className:v?"dropdown-single-column":"",children:o.filter(n=>m&&j&&j.trim().length>0&&n.text?n.text.toLowerCase().includes(j.toLowerCase()):!0).map(({value:n,text:s},C)=>e.jsxs(a.Dropdown.Item,{className:v?"dropdown-item-single-column":"",children:[S==A&&e.jsx(a.Radio,{checked:!!(l&&l.indexOf(n)>-1),onChange:y=>_(n),label:s}),S==W&&e.jsx(a.Checkbox,{checked:!!(l&&l.indexOf(n)>-1&&!(o.length==l.length&&p)),onChange:y=>_(n),label:s})]},C))})]})})}),le=P.connect(V,$)(({placeholder:t,startLabel:c,endLabel:r,options:i,onChange:o,app:h,group:f,param:d,current:l,autoApply:g})=>{const[u,v]=b.useState(i[0].position),[m,S]=b.useState(i[i.length-1].position);b.useEffect(()=>{const I=i.filter(x=>(x.position>u||x.position===u)&&(x.position<m||x.position===m)).map(x=>x.value);o({app:h,group:f,param:d,value:I,autoApply:g})},[u,m]);const L=b.useRef(null);return e.jsx(a.Dropdown,{ref:L,fluid:!0,text:`${t} (${l?l.filter(I=>I!=Number.MIN_SAFE_INTEGER).length:0}/${i.length})`,scrolling:!1,button:!0,multiple:!0,search:!0,floating:!1,icon:"angle down ignore",className:`${l&&l.length>0?"applied ":""} range`,children:e.jsxs(a.Dropdown.Menu,{children:[e.jsx(a.Segment,{children:e.jsxs(a.Dropdown.Item,{children:[" ",e.jsx(a.Label,{basic:!0,children:c})]})}),e.jsx(a.Container,{children:i.map(({value:I,text:x,position:p})=>e.jsx(a.Dropdown.Item,{children:e.jsx(a.Radio,{disabled:p>m,checked:u===p,onChange:w=>v(p),label:x})}))}),e.jsx(a.Segment,{children:e.jsxs(a.Dropdown.Item,{children:[" ",e.jsx(a.Label,{basic:!0,children:r})]})}),e.jsx(a.Container,{children:i.map(({value:I,text:x,position:p})=>e.jsx(a.Dropdown.Item,{children:e.jsx(a.Radio,{disabled:p<u,checked:m===p,onChange:w=>S(p),label:x})}))})]})})}),ae=t=>{const{data:c,type:r,showNoDataOption:i}=t,o=c.filter(u=>u.type===r)[0],h=o?o.items.filter(u=>!i&&u.code==Q?!1:t.hiddenFilters&&t.hiddenFilters.length>0?t.hiddenFilters.indexOf(u.id)==-1:!0):[],f=h?te(h,t.locale):[],d=c.find(u=>u.type="FilterDefinition"),l=d?d.items.find(u=>u.fieldType==r):null,g=l?l.value:"Filter";return e.jsx(a.Container,{fluid:!0,className:"filter",children:e.jsx(M,{...t,options:f,placeholder:t.placeholder?t.placeholder:g})})},se=P.connect(V,$)(t=>{let c=0;const r=[{key:"Yes",value:!0,text:"Yes",position:c++},{key:"No",value:!1,text:"No",position:c++}];return e.jsx(a.Container,{fluid:!0,className:"filter",children:e.jsx(M,{options:r,...t})})}),ie=t=>{const{csvValue:c}=t;let r=0;const i=c.split(",").map(o=>({key:o,value:o,text:o,icon:o.toLocaleLowerCase(),position:r++}));return e.jsx(a.Container,{fluid:!0,className:"filter",children:e.jsx(M,{options:i,...t,children:" "})})},oe=t=>e.jsx(Y.SettingProvider,{locale:t.intl.locale,changeUUID:t.unique,children:e.jsx(Y.SettingsConsumer,{children:e.jsx(ce,{...t})})}),ce=({unique:t,"data-group":c,"data-app":r,"data-dvz-proxy-dataset-id":i,"data-param":o,"data-icon":h,"data-type":f,"data-place-holder":d,"data-is-range":l="false","data-all-label":g,"data-none-label":u,"data-start-label":v,"data-end-label":m,"data-csv-value":S,"data-filters":L="[]","data-use-single-column":I="false","data-enable-text-search":x="false","data-filter-type":p,"data-default-values":w,"data-show-no-data-option":F="true","data-default-value-criteria":N="DEFAULT_VALUE_INPUT","data-hidden-filters":R="[]","data-all-none-same-behaviour":k="false","data-close-on-select":_="false","data-alphabetical-sort":q="true","data-asc-order":U="true","data-auto-apply":O="true",settings:B,intl:E})=>{const j={},D=L?J(L):{};D&&D.forEach&&D.forEach(C=>{C.value!=null&&C.value.filter(y=>y!=null&&y.toString().trim()!="").length>0&&(j[C.param]=C.value)}),i&&(j.dvzProxyDatasetId=i);const n=R?J(R):[];let s;return p==null||p==""?s=l==="true"?"range":"multi-select":s=p,r==="csv"?e.jsx(ie,{allLabel:g,noneLabel:u,isRange:l==="true",csvValue:S,app:r,group:c,icon:h,placeholder:d,startLabel:v,endLabel:m,param:o,ascOrder:U,useSingleColumn:I==="true",enableTextSearch:x==="true",filterType:s,defaultValues:w,defaultValueCriteria:N,allNoneSameBehaviour:k==="true",closeOnSelect:_==="true",locale:E.locale}):r?e.jsx(z.default,{dvzProxyDatasetId:i,params:j,app:r,uniqueStorage:D.length>0?t:null,hiddenFilters:n||[],children:e.jsx(G.default,{children:e.jsxs(a.Container,{fluid:!0,children:[f==="Boolean"&&e.jsx(se,{startLabel:v,endLabel:m,allLabel:g,noneLabel:u,isRange:T(l),app:r,group:c,icon:h,placeholder:d,param:o,filterType:s,defaultValues:w,locale:E.locale}),f!=="Boolean"&&e.jsx(G.default,{type:f,children:e.jsx(ae,{startLabel:v,endLabel:m,allLabel:g,noneLabel:u,isRange:T(l),app:r,group:c,icon:h,placeholder:d,param:o,alphabeticalSort:q,ascOrder:U,useSingleColumn:T(I),enableTextSearch:T(x),showNoDataOption:T(F),filterType:s,defaultValues:w,defaultValueCriteria:N,hiddenFilters:n||[],allNoneSameBehaviour:k=="true",autoApply:T(O),closeOnSelect:T(_),locale:E.locale})})]})})}):null},ue=K.injectIntl(oe);exports.default=ue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),T=require("react"),f=require("semantic-ui-react"),Q=require("../connected-templates/PostIntro.js"),X=require("react-intl"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),T=require("react"),f=require("semantic-ui-react"),Q=require("../connected-templates/PostIntro.js"),X=require("react-intl"),G=require("./utils.js"),Z=require("./NoData.js"),Y=require("react-redux"),$=require("../reducers/data-api.js"),tt=require("react-router"),M=require("../../utils/data.js"),et=D=>{const{posts:u,numberOfColumns:E,sortFirstBy:c,countryCategory:l,postWidth:x,postHeight:A}=D,g=[];if(l&&c&&c!=="none"){const d=u.filter(p=>p[l].includes(Number(c))),b=u.filter(p=>!p[l].includes(Number(c)));g.push(...d),g.push(...b)}else g.push(...u);return i.jsx(f.Grid,{className:"filtered-posts",columns:E,children:i.jsx(f.GridRow,{children:g.map(d=>i.jsx(f.Grid.Column,{children:i.jsx("div",{className:"filtered-posts-column",style:{width:x,height:A,overflow:"hidden"},children:i.jsx(Q.default,{style:{width:"100%",height:"100%",overflow:"hidden",margin:0,padding:0},as:f.Container,fluid:!0,post:d},d.id)})},d.id))})})},rt=D=>{const{"data-group":u,"data-number-of-columns":E,"data-type":c,"data-taxonomy":l,"data-categories":x,"data-height":A,"data-post-width":g,"data-post-height":d,"data-number-of-items-per-page":b,"data-enable-sorting":p,"data-sort-first-by":j,"data-sorting-taxonomy":w,editing:V}=D,B=Y.useDispatch(),{locale:z}=tt.useParams(),[q,N]=T.useState(!1),I=Y.useSelector(t=>t).getIn(["data","posts",u]),[P,F]=T.useState([]),H=M.toBoolean(p)&&j!=="none"?M.toNumber(j):null,m=I??{yearFilter:null,categoryFilter:null,countryFilter:null,page:1,countryTaxonomy:null,categoryTaxonomy:null},S=t=>{if(t==null)return{values:[],isExplicitNone:!1};const e=Array.isArray(t)?t:[t],a=e.some(r=>Number(r)===Number.MIN_SAFE_INTEGER);return{values:e.map(r=>Number(r)).filter(r=>Number.isFinite(r)&&r!==Number.MIN_SAFE_INTEGER),isExplicitNone:a}},W=t=>{if(!t||t.length===0)return null;const e=Array.from(new Set(t)).sort((v,C)=>v-C);if(e.length===0)return null;const a=e[0],o=e[e.length-1],r=G.getStartDateAndEndDateFromYear(a),n=G.getStartDateAndEndDateFromYear(o);return!(r!=null&&r.startDate)||!(n!=null&&n.endDate)?null:{startDate:r.startDate,endDate:n.endDate}},J=()=>{const t=S(m.yearFilter),e=t.isExplicitNone?null:W(t.values),a=m.countryFilter??null,o=m.categoryFilter??null,r=m.categoryTaxonomy||(l&&l!=="none"?l:null),n=m.countryTaxonomy||null;return{before:(e==null?void 0:e.endDate)||null,after:(e==null?void 0:e.startDate)||null,categoryFilter:o,categoryTaxonomy:r,countryFilter:a,countryTaxonomy:n}},O=t=>V?t:decodeURIComponent(t),L=t=>{try{return JSON.parse(O(t))}catch(e){return console.warn("JSON parsing failed for value:",t,"- treating as plain string. Error:",e),O(t)}},U=()=>{const t=L(x);return t?typeof t=="string"?t.split(",").map(Number):typeof t=="number"?[t]:t:[]},k=(t,e,a)=>{if(a)return null;if(t.length===0)return e.length>0?e:null;if(e.length===0)return t;const o=new Set(t),r=e.filter(n=>o.has(n));return r.length>0?r:null},K=async()=>{N(!0);const t=J(),e=S(U()).values,a=S(t.categoryFilter),o=k(e,a.values,a.isExplicitNone),r=S(t.countryFilter);if(a.isExplicitNone){F([]),N(!1);return}if(r.isExplicitNone){F([]),N(!1);return}const n=new Map;t.categoryTaxonomy&&o&&o.length>0&&n.set(t.categoryTaxonomy,o),t.countryTaxonomy&&r.values.length>0&&n.set(t.countryTaxonomy,r.values);const v=o?o.join(","):void 0,C={after:t.after,before:t.before,perPage:Number(b||10),page:m.page||1,locale:z||"en",postType:c,taxonomy:t.categoryTaxonomy||void 0,category:v||void 0,taxonomyFilters:n,ordering:"date",orderingDirection:"desc"};await $.getCustomPosts(C).then(s=>{if(s){let h=null,y=null;if(s&&typeof s=="object"&&"data"in s?(h=s.data,y=s.meta):(Array.isArray(s),h=s),F(Array.isArray(h)?h:[]),y){const R=y["x-wp-totalpages"]?y["x-wp-totalpages"]:1,_=y["x-wp-total"]?y["x-wp-total"]:0;R&&_&&B({type:"SET_POSTS_PAGINATION",group:u,totalPages:Number(R),totalItems:Number(_)})}}else F([])}).finally(()=>{N(!1)})};return T.useEffect(()=>{(async()=>await K())()},[I,c,l,b,x,w]),i.jsx(f.Container,{fluid:!0,children:q?i.jsx(f.Loader,{active:!0,inline:"centered"}):!q&&P&&P.length>0?i.jsx(et,{posts:P,postWidth:Number(g),postHeight:Number(d),numberOfColumns:Number(E),sortFirstBy:H,countryCategory:w}):i.jsx(Z.default,{noDataMsg:"No posts found",group:u})})},ot=X.injectIntl(T.memo(rt));exports.default=ot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const j=require("react/jsx-runtime"),i=require("react"),q=require("./PostsFilterDropdown.js"),A=require("../../conf/index.js"),R=l=>{const{taxonomy:o,group:u,placeholder:c,allLabel:p,noneLabel:f,useSingleColumn:d,enableTextSearch:g,filterType:y,showNoDataOption:S,closeOnSelect:m,allNoneSameBehaviour:x,autoApply:O,alphabeticalSort:P,ascOrder:h,type:T,categories:n,onChange:b,...v}=l,[w,e]=i.useState([]),C=async()=>{if(!o||o==="none"){e([]);return}const a=await(await fetch(A.Config.REACT_APP_WP_API+"/wp/v2/"+o)).json();if(a){const r=a.map(t=>({key:t.id,value:t.id,text:t.name}));if(n){const t=r.filter(_=>n.indexOf(_.value.toString())>-1);e([]),e(t)}else e([]),e(r)}};return i.useEffect(()=>{let s=!1;return s||(e([]),C()),()=>{s=!0}},[T,o,n]),j.jsx(q.default,{...v,group:u,placeholder:c,allLabel:p,noneLabel:f,useSingleColumn:d,enableTextSearch:g,filterType:y,showNoDataOption:S,closeOnSelect:m,allNoneSameBehaviour:x,autoApply:O,alphabeticalSort:P,ascOrder:h,options:w,onChange:b})};exports.default=R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),m=require("react"),l=require("semantic-ui-react"),T="multi-select",
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),m=require("react"),l=require("semantic-ui-react"),T="multi-select",p="single-select",j=Number.MIN_SAFE_INTEGER,x=v=>v==null?null:String(v),Y=v=>{const{allLabel:k,noneLabel:O,placeholder:E,options:r,current:N,onChange:s,useSingleColumn:_,enableTextSearch:S,filterType:u,allNoneSameBehaviour:A,hiddenFilters:h,value:o,closeOnSelect:C=!0,noneFunction:R,alphabeticalSort:z,ascOrder:H,...V}=v,d=u===T,I=Array.isArray(o)?o:N||[],f=(Array.isArray(I)?I.some(e=>e===j):!1)?I.filter(e=>e!==j):I,[a,$]=m.useState(""),F=(e,t)=>{if(u===T){const i=x(t),c=Array.isArray(f)?[...f]:[];let y=c.some(P=>x(P)===i)?c.filter(P=>x(P)!==i):[...c,t];return!A&&y.length===0&&(y=[j]),s&&s(e,y)}if(u===p)return s&&s(e,t);C&&g.current&&g.current.close()},K=()=>{const e=(r||[]).filter(t=>{var i;return S&&a&&a.trim().length>0&&t.text?(i=t.text)==null?void 0:i.toString().toLowerCase().includes(a.toLowerCase()):!0}).map(t=>t.value);d&&s&&s({},e),!d&&C&&g.current&&g.current.close()},U=e=>{if(R){R(e);return}else{if(!r)return[];const t=r.filter(i=>{var c;return S&&a&&a.trim().length>0&&i.text?(c=i.text)==null?void 0:c.toString().toLowerCase().includes(a==null?void 0:a.toString().toLowerCase()):!0});if(d&&s){const i=A?t.map(c=>c.value):[j];s({},i)}!d&&C&&g.current&&g.current.close()}},D=e=>{$(e)},b=m.useRef(!1);m.useEffect(()=>{if(!(!d||b.current)&&r&&r.length>0)if(!(Array.isArray(f)?f.length>0:!!f)&&s){b.current=!0;const t=r.map(i=>i.value);s({},t)}else b.current=!0},[d,r]),m.useEffect(()=>{if(d&&r&&r.length>0&&s){const e=r.map(t=>t.value);s({},e)}},[d]);const q=m.useMemo(()=>{if(u==p){const e=o?r==null?void 0:r.filter(t=>t.value==o)[0]:null;return e?`${E?E+" ":""}${e.text}`:""}else{const e=f?f.filter(i=>i==Number.MIN_SAFE_INTEGER?!1:h&&h.length>0?h.indexOf(i)==-1:!0).length:0,t=(r==null?void 0:r.filter(i=>h&&h.length>0?h.indexOf(i.id)==-1:!0).length)||0;return`${E} (${e}/${t})`}},[r,f,u]),g=m.useRef(null),M=q,L=typeof M=="string"?M:"",G=L&&L.length>0?L:E||"",w=m.useRef(void 0);m.useEffect(()=>{u===p&&w.current===void 0&&o!==void 0&&(w.current=o)},[u,o]);const B=u===p?o!=null&&o!==w.current:N&&N.length>0;return n.jsx(l.Dropdown,{...V,ref:g,fluid:!0,text:G,scrolling:!1,button:!0,icon:"angle down",multiple:d,search:!0,floating:!1,value:o,closeOnChange:C,...d?{renderLabel:()=>null}:{},className:`multiple ${B?"applied ":""}`,children:n.jsxs(l.Dropdown.Menu,{children:[u!=p&&n.jsxs(n.Fragment,{children:[n.jsx(l.Segment,{children:n.jsxs(l.Dropdown.Item,{children:[n.jsx(l.Label,{basic:!0,onClick:K,children:k})," ","|"," ",n.jsx(l.Label,{basic:!0,onClick:U,children:O})]})}),S&&n.jsxs(n.Fragment,{children:[n.jsx(l.Container,{children:n.jsx(l.Dropdown.Item,{children:n.jsx("div",{className:"ui action input",children:n.jsxs("div",{className:"ui input",children:[n.jsx("input",{className:"filter-search",value:a,placeholder:"Search...",onChange:e=>{e&&e.nativeEvent&&e.nativeEvent.stopImmediatePropagation&&e.nativeEvent.stopImmediatePropagation(),D(e.target.value)},onKeyDown:e=>{e&&e.nativeEvent&&e.nativeEvent.stopImmediatePropagation&&e.nativeEvent.stopImmediatePropagation()},onKeyUp:e=>{e&&e.nativeEvent&&e.nativeEvent.stopImmediatePropagation&&e.nativeEvent.stopImmediatePropagation()},onKeyPress:e=>{e&&e.nativeEvent&&e.nativeEvent.stopImmediatePropagation&&e.nativeEvent.stopImmediatePropagation()},onMouseDown:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation()},onFocus:e=>{e.stopPropagation()},type:"text",autoComplete:"off"}),n.jsx(l.Icon,{name:"remove",link:!0,className:"clear-icon ignore",onClick:e=>{D("")}})]})})})}),n.jsx(l.Divider,{})]})]}),n.jsx("br",{}),n.jsx(l.Container,{className:_?"dropdown-single-column":"",children:r==null?void 0:r.filter(e=>{var t;return S&&a&&a.trim().length>0&&e.text?(t=e.text)==null?void 0:t.toString().toLowerCase().includes(a.toLowerCase()):!0}).map(({value:e,text:t},i)=>n.jsxs(l.Dropdown.Item,{className:_?"dropdown-item-single-column":"",children:[u===p&&n.jsx(l.Radio,{checked:o==e,onChange:c=>{F(c,e)},label:t}),u===T&&n.jsx(l.Checkbox,{checked:f&&f.some(c=>x(c)===x(e)),onChange:()=>F(null,e),label:t})]},i))})]})})};exports.default=Y;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const D=require("react/jsx-runtime"),L=require("react"),q=require("./PostsFilterDropdown.js"),v=require("@devgateway/wp-react-lib"),x=o=>{const{group:r,placeholder:s,allLabel:n,noneLabel:l,useSingleColumn:c,enableTextSearch:i,filterType:u,showNoDataOption:p,closeOnSelect:d,allNoneSameBehaviour:f,autoApply:g,alphabeticalSort:h,ascOrder:S,onChange:b,yearOptions:F,setYearOptions:y,yearFilterLoading:R,setYearFilterLoading:t,...O}=o,Y=async()=>{t(!0);const w=(await v.getYearRange()).data.map(e=>({key:e,value:e,text:e.toString()}));return t(!1),w};return L.useEffect(()=>{(async()=>{const a=await Y();y(a)})()},[]),D.jsx(q.default,{...O,group:r,placeholder:s,allLabel:n,noneLabel:l,useSingleColumn:c,enableTextSearch:i,filterType:u,showNoDataOption:p,closeOnSelect:d,allNoneSameBehaviour:f,autoApply:g,alphabeticalSort:h,ascOrder:S,onChange:b})};exports.default=x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const _=require("./data-api.js"),w=require("immutable"),v=require("papaparse");function G(r){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const e in r)if(e!=="default"){const s=Object.getOwnPropertyDescriptor(r,e);Object.defineProperty(n,e,s.get?s:{enumerable:!0,get:()=>r[e]})}}return n.default=r,Object.freeze(n)}const d=G(w),O="LOAD_DATA",T="LOAD_DATA_DONE",F="LOAD_DATA_ERROR",P="LOAD_CATEGORIES",D="LOAD_CATEGORIES_DONE",R="LOAD_CATEGORIES_ERROR",m="SET_PAGE_MODULE_PROPS",A="SET_FILTER",L="SET_INITIAL_FILTER",j="SET_POSTS_FILTER",h="SET_INITIAL_POSTS_FILTER",q="SET_POSTS_PAGINATION",C="SET_APPLY",N="CLEAN_FILTER",U=d.Map({mode:"info"}),M="SET_MEASURES",b="CLEAN_MEASURES",z=({app:r,group:n})=>(e,s)=>{e({type:b,app:r,group:n})},B=({app:r,group:n,mGroup:e})=>(s,t)=>{const o=Object.keys(e.measures).filter(l=>e.measures[l].selected),a={...e};a[r]={measures:{}},o.forEach(l=>{a[r].measures[l]={...e.measures[l]}}),a[r].format=e.format,s({type:M,app:r,group:n,measure:a})},J=({app:r,group:n,param:e,value:s,autoApply:t})=>(o,a)=>{o({type:A,app:r,group:n,param:e,value:s,autoApply:t})},V=({app:r,group:n})=>(e,s)=>{e({type:N,app:r,group:n});const o=s().getIn(["data","filters","initial",r,n]);if(o){const a=o.entrySeq?o.entrySeq().toArray():Object.entries(o);for(const[l,i]of a)e({type:A,app:r,group:n,param:l,value:i,autoApply:!0})}},Y=({app:r,group:n})=>(e,s)=>{e({type:C,app:r,group:n})},H=({app:r,group:n,param:e,value:s})=>(t,o)=>{t({type:L,app:r,group:n,param:e,value:s})},K=r=>(n,e)=>{const{app:s,params:t,dvzProxyDatasetId:o,uniqueStorage:a}=r;n({type:P,params:t,app:s,uniqueStorage:a,dvzProxyDatasetId:o}),_.getCategories({app:s,params:t}).then(l=>(l.appliedFilters=t,n({type:D,app:s,data:l,uniqueStorage:a,dvzProxyDatasetId:o}))).catch(l=>n({type:R,app:s,uniqueStorage:a,error:l,dvzProxyDatasetId:o}))},Q=({app:r,group:n,csv:e,store:s,params:t})=>(o,a)=>{const l=a().get("data").getIn(["filters",r,n]);l?t={...t,...l.toJS()}:t=t||{};const i=v.parse(e,{header:!0,dynamicTyping:!0}),c=i.data.filter(I=>{let g=!1;return Object.keys(t).forEach(y=>{const S=t[y];if(I[y]){const f=I[y].toString().trim().toLowerCase();g=S.filter(p=>p&&p.toString().trim().toLowerCase()==f).length==0}}),!g}),u={...i,data:c,appliedFilters:t};o({type:T,app:r,group:n,store:s,data:{count:u.data.length,itemsSize:u.data.length,...u}})},W=({app:r,group:n,source:e,store:s,params:t})=>(o,a)=>{let l=a().get("data").getIn(["filters",r,n]);t&&Object.keys(t).forEach(c=>{if(l&&l.has(c)){let u=t[c],g=l.get(c).filter(y=>u.indexOf(y)>-1);l=l.set(c,g)}}),l&&(t={...t,...l.toJS()}),o({type:O,app:r,group:n,params:t,store:s}),_.getData({app:r,source:e,params:t}).then(i=>(i.appliedFilters=t,o({type:T,app:r,group:n,store:s,data:i,params:t}))).catch(i=>o({type:F,app:r,group:n,store:s,error:i}))},X=({data:r})=>(n,e)=>{n({type:m,data:r})},Z=(r=U,n)=>{switch(n.type){case O:{const{store:e,app:s,group:t,params:o}=n,a=Date.now();return r.deleteIn([...e,"error"]).setIn([...e,"loading"],!0).setIn([...e,"time"],a).setIn([...e,"presetFilter"],o)}case F:{const{error:e,store:s,app:t,group:o}=n;return r.setIn([...s,"loading"],!1).setIn([...s,"error"],e).setIn(["filters-settings",t,o,"apply"],null)}case T:{const{data:e,app:s,group:t,store:o}=n;return r.setIn([...o,"loading"],!1).deleteIn([...o,"error"]).setIn([...o,"data"],e).setIn(["filters-settings",s,t,"apply"],null)}case m:{const{data:e}=n;return r.setIn(["pageModuleProps"],e)}case P:{const{data:e,app:s,uniqueStorage:t,dvzProxyDatasetId:o}=n,a=["categories",s];return t&&a.push(t),o&&a.push(o),r.setIn([...a,"loading"],!0).deleteIn([...a,"error"])}case D:{const{data:e,app:s,uniqueStorage:t,dvzProxyDatasetId:o}=n,a=["categories",s];return o&&a.push(o),t&&a.push(t),r.setIn([...a,"loading"],!1).setIn([...a,"items"],d.fromJS(e))}case R:{const{data:e,app:s,uniqueStorage:t,dvzProxyDatasetId:o}=n,a=["categories",s];return t&&a.push(t),o&&a.push(o),r.setIn([...a,"loading"],!1).setIn([...a,"error"],e)}case C:{const{app:e,group:s}=n;return r.setIn(["filters-settings",e,s,"apply"],new Date().getTime())}case A:{const e=Date.now(),{app:s,group:t,param:o,value:a,autoApply:l}=n;return r.setIn(["filters-settings",s,t,"autoApply"],l).setIn(["filters",s,t,o],a.length===0?[Number.MIN_SAFE_INTEGER]:a).setIn(["filters-settings",s,t,"apply"],null).setIn(["filters-settings",s,t,"lastUserFilterChange"],e)}case L:{const e=Date.now(),{app:s,group:t,param:o,value:a,autoApply:l}=n;return console.log(o),r.setIn(["filters-settings",s,t,"autoApply"],l).setIn(["filters","initial",s,t,o],a.length===0?[Number.MIN_SAFE_INTEGER]:a).setIn(["filters",s,t,o],a.length===0?[Number.MIN_SAFE_INTEGER]:a).setIn(["filters-settings",s,t,"lastInitialFilterChange"],e).setIn(["filters-settings",s,t,"lastUserFilterChange"],e)}case N:{const{app:e,group:s}=n,t=r.getIn(["filters","initial",e,s]);return r.setIn(["filters",e,s],t)}case h:{const{group:e,sortFirstBy:s,categoryCategory:t,countryCategory:o,categoryTaxonomy:a,countryTaxonomy:l,categoryFilter:i,countryFilter:c,yearFilter:u}=n,I=Number(s),g={yearFilter:u,categoryFilter:i,categoryTaxonomy:a,categoryCategory:t,countryCategory:o,countryFilter:c,countryTaxonomy:l,page:1,itemsPerPage:void 0,sortFirstBy:I,postTaxonomy:null,postCategory:null,postType:null};return r.setIn(["posts",e],g).setIn(["posts","initialFilters",e],g)}case j:{const{group:e,yearFilter:s,categoryFilter:t,countryFilter:o,page:a,itemsPerPage:l,sortFirstBy:i,countryCategory:c,categoryCategory:u,taxonomy:I,categoryTaxonomy:g,countryTaxonomy:y}=n,S=r.getIn(["posts",e])||{},f={yearFilter:s,categoryFilter:t,countryFilter:o,page:a,itemsPerPage:l,sortFirstBy:i,countryCategory:c,categoryCategory:u!==void 0?u:S.categoryCategory,taxonomy:I,categoryTaxonomy:g!==void 0?g:S.categoryTaxonomy,countryTaxonomy:y!==void 0?y:S.countryTaxonomy};let p=r.setIn(["posts",e],f);const E=r.getIn(["posts","initialFilters",e]);if((!E||E&&E.yearFilter===null&&E.categoryFilter===null&&E.countryFilter===null&&E.categoryCategory===null)&&(Array.isArray(t)&&t.length>0||Array.isArray(o)&&o.length>0||Array.isArray(s)&&s.length>0)){const x={...f};p=p.setIn(["posts","initialFilters",e],x)}return p}case q:{const{group:e,totalPages:s,totalItems:t}=n;return r.setIn(["postsPagination",e],{totalPages:s,totalItems:t})}case M:{const{app:e,group:s,measure:t}=n;return r.setIn(["measures",e,s],t)}case b:{const{app:e,group:s,measure:t}=n;return r.deleteIn(["measures",e,s])}default:return r}},$=({group:r,dispatch:n,initialFilters:e})=>{n({type:h,group:r,...e,reset:!0,page:1})};exports.applyFilter=Y;exports.cleanFilter=V;exports.cleanMeasures=z;exports.clearPostsFilter=$;exports.default=Z;exports.getCategories=K;exports.getData=W;exports.setData=Q;exports.setFilter=J;exports.setInitialFilters=H;exports.setMeasures=B;exports.setPageModuleProps=X;
|
|
@@ -1,55 +1,60 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import h from "react-markdown";
|
|
4
|
+
import v from "remark-gfm";
|
|
5
5
|
import x from "rehype-raw";
|
|
6
6
|
import f from "string-template";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
const N = /(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi, F = /(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi, _ = /(\+?\#C)[\(]([A-z0-9,.,-]+)\)/gi, u = (o, e, n, a, r, d) => {
|
|
8
|
+
if (!r || !r.formatNumber)
|
|
9
|
+
return e;
|
|
10
|
+
let t, m = e;
|
|
11
|
+
for (; (t = o.exec(e)) !== null; ) {
|
|
12
|
+
const l = t[2], c = t[1], g = ((p, y = 2) => r.formatNumber(a ? p / 100 : p, {
|
|
13
|
+
maximumFractionDigits: y,
|
|
14
|
+
...n,
|
|
15
|
+
signDisplay: c && c.startsWith("+") ? "never" : "auto"
|
|
16
|
+
})).apply(void 0, l.split(","));
|
|
17
|
+
m = m.replaceAll(t[0], g);
|
|
16
18
|
}
|
|
17
|
-
return
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
return m;
|
|
20
|
+
}, A = (o, e, n, a) => {
|
|
21
|
+
if (!o || !e)
|
|
22
|
+
return "";
|
|
23
|
+
e.field && e[`_${e.field}`] && (e._value = e[`_${e.field}`]), !e.field && e.category && (e.field = e.category);
|
|
24
|
+
let r = a ? f(o, e) : f(o, e).replace(/(?:\r\n|\r|\n)/g, "<br>");
|
|
25
|
+
return r = u(N, r, { style: "percent" }, !0, n), r = u(F, r, { style: "decimal" }, !1, n), r = u(
|
|
22
26
|
_,
|
|
23
|
-
|
|
27
|
+
r,
|
|
24
28
|
{ notation: "compact" },
|
|
25
29
|
!1,
|
|
26
|
-
|
|
27
|
-
),
|
|
28
|
-
}, D = ({ tooltip:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
n
|
|
31
|
+
), r;
|
|
32
|
+
}, D = ({ tooltip: o, d: e, intl: n, tooltipEnableMarkdown: a }) => {
|
|
33
|
+
if (!e || !o)
|
|
34
|
+
return /* @__PURE__ */ i("div", {});
|
|
35
|
+
const r = e.datum || e.point || e, { color: d, data: t } = r || {}, m = e.value || (e.datum ? e.datum.value : null) || (e.point ? e.point.data.y : null);
|
|
36
|
+
if (t) {
|
|
37
|
+
let l;
|
|
38
|
+
t.variables ? l = typeof t.variables[e.id] == "object" ? t.variables[e.id] : t.variables : l = t;
|
|
39
|
+
const c = {
|
|
40
|
+
field: e.point ? e.point.serieId : e.id || "",
|
|
41
|
+
...l,
|
|
42
|
+
value: m
|
|
37
43
|
};
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
return a ? /* @__PURE__ */
|
|
41
|
-
|
|
44
|
+
t.measureFieldName && t.variables && (c.populationValue = t.variables[t.measureFieldName + "Population"]);
|
|
45
|
+
const s = A(o, c, n, a);
|
|
46
|
+
return s ? a ? /* @__PURE__ */ i("div", { className: "chart tooltip", children: /* @__PURE__ */ i(
|
|
47
|
+
h,
|
|
42
48
|
{
|
|
43
|
-
children:
|
|
44
|
-
remarkPlugins: [
|
|
45
|
-
rehypePlugins: [x]
|
|
46
|
-
className: "chart tooltip"
|
|
49
|
+
children: s,
|
|
50
|
+
remarkPlugins: [v],
|
|
51
|
+
rehypePlugins: [x]
|
|
47
52
|
}
|
|
48
|
-
) : /* @__PURE__ */
|
|
53
|
+
) }) : /* @__PURE__ */ i("div", { className: "chart tooltip", children: /* @__PURE__ */ i("div", { dangerouslySetInnerHTML: { __html: s } }) }) : /* @__PURE__ */ i("div", {});
|
|
49
54
|
} else
|
|
50
|
-
return /* @__PURE__ */
|
|
55
|
+
return /* @__PURE__ */ i("div", {});
|
|
51
56
|
};
|
|
52
57
|
export {
|
|
53
58
|
D as default,
|
|
54
|
-
|
|
59
|
+
A as formatContent
|
|
55
60
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import h from "react-markdown";
|
|
4
|
+
import g from "remark-gfm";
|
|
5
5
|
import y from "rehype-raw";
|
|
6
6
|
import f from "string-template";
|
|
7
7
|
const x = /(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi, F = /(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi, N = /(\+?\#C)[\(]([A-z0-9,.,-]+)\)/gi, p = (o, t, a, n, e, r) => {
|
|
8
8
|
let i, s = t;
|
|
9
9
|
for (; (i = o.exec(t)) !== null; ) {
|
|
10
|
-
const
|
|
10
|
+
const c = i[2], l = i[1], v = ((u, d = 2) => e.formatNumber(n ? u / 100 : u, {
|
|
11
11
|
maximumFractionDigits: d,
|
|
12
12
|
...a,
|
|
13
13
|
signDisplay: l && l.startsWith("+") ? "never" : "auto"
|
|
14
|
-
})).apply(void 0,
|
|
14
|
+
})).apply(void 0, c.split(","));
|
|
15
15
|
s = s.replaceAll(i[0], v);
|
|
16
16
|
}
|
|
17
17
|
return s;
|
|
@@ -21,12 +21,12 @@ const x = /(\+?\%)[\(]([A-z0-9,.,-]+)\)/gi, F = /(\+?\#)[\(]([A-z0-9,.,-]+)\)/gi
|
|
|
21
21
|
}, E = ({ tooltip: o, d: t, intl: a, tooltipEnableMarkdown: n }) => {
|
|
22
22
|
const { color: e, data: r } = t.datum || t.point || t, i = t.value || (t.datum ? t.datum.value : null) || (t.point ? t.point.data.y : null);
|
|
23
23
|
if (r) {
|
|
24
|
-
const s = r.variables ? r.variables[t.id] || r.variables : r,
|
|
25
|
-
r.measureFieldName && (
|
|
26
|
-
const l = b(o,
|
|
27
|
-
return n ? /* @__PURE__ */
|
|
24
|
+
const s = r.variables ? r.variables[t.id] || r.variables : r, c = { field: t.point ? t.point.serieId : t.id, ...s, value: i };
|
|
25
|
+
r.measureFieldName && (c.populationValue = r.variables[r.measureFieldName + "Population"]);
|
|
26
|
+
const l = b(o, c, a, n);
|
|
27
|
+
return n ? /* @__PURE__ */ m("div", { className: "chart tooltip", children: /* @__PURE__ */ m(h, { children: l, remarkPlugins: [g], rehypePlugins: [y] }) }) : /* @__PURE__ */ m("div", { className: "chart tooltip", children: /* @__PURE__ */ m("div", { dangerouslySetInnerHTML: { __html: l } }) });
|
|
28
28
|
} else
|
|
29
|
-
return /* @__PURE__ */
|
|
29
|
+
return /* @__PURE__ */ m("div", {});
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
32
|
E as default,
|
|
@@ -100,7 +100,7 @@ const X = H.forwardRef((r, a) => /* @__PURE__ */ t("div", { ref: a, children: r.
|
|
|
100
100
|
{
|
|
101
101
|
className: "download",
|
|
102
102
|
"data-tooltip": decodeURIComponent(A),
|
|
103
|
-
trigger: u
|
|
103
|
+
trigger: u || d ? /* @__PURE__ */ t(Q, { name: "download", className: "download-icon" }) : null,
|
|
104
104
|
children: /* @__PURE__ */ c(g.Menu, { children: [
|
|
105
105
|
q,
|
|
106
106
|
d === !0 && /* @__PURE__ */ c(g.Item, { onClick: () => {
|
|
@@ -100,7 +100,7 @@ const Q = "multi-select", O = "single-select", de = "NO_DATA", fe = "DEFAULT_VAL
|
|
|
100
100
|
let a = [];
|
|
101
101
|
h === fe ? a = _ ? _.split(",") : [] : h == he ? a = r.length > 0 ? [r[0]] : [] : h == me && (a = r.length > 0 ? [r[r.length - 1]] : []), c({ app: f, group: d, param: u, value: a });
|
|
102
102
|
} else
|
|
103
|
-
c({ app: f, group: d, param: u, value: [r[0]] });
|
|
103
|
+
c({ app: f, group: d, param: u, value: [r[0]], autoApply: A });
|
|
104
104
|
}
|
|
105
105
|
}, []);
|
|
106
106
|
const J = () => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import K, { useState as
|
|
3
|
-
import { Container as
|
|
2
|
+
import K, { useState as V, useEffect as Q } from "react";
|
|
3
|
+
import { Container as R, Loader as X, Grid as Y, GridRow as Z } from "semantic-ui-react";
|
|
4
4
|
import $ from "../connected-templates/PostIntro.js";
|
|
5
5
|
import { injectIntl as tt } from "react-intl";
|
|
6
|
-
import { getStartDateAndEndDateFromYear as
|
|
6
|
+
import { getStartDateAndEndDateFromYear as B } from "./utils.js";
|
|
7
7
|
import et from "./NoData.js";
|
|
8
8
|
import { useDispatch as ot, useSelector as rt } from "react-redux";
|
|
9
9
|
import { getCustomPosts as nt } from "../reducers/data-api.js";
|
|
@@ -16,7 +16,7 @@ const lt = (T) => {
|
|
|
16
16
|
f.push(...m), f.push(...N);
|
|
17
17
|
} else
|
|
18
18
|
f.push(...u);
|
|
19
|
-
return /* @__PURE__ */ i(
|
|
19
|
+
return /* @__PURE__ */ i(Y, { className: "filtered-posts", columns: E, children: /* @__PURE__ */ i(Z, { children: f.map((m) => /* @__PURE__ */ i(Y.Column, { children: /* @__PURE__ */ i("div", { className: "filtered-posts-column", style: { width: h, height: D, overflow: "hidden" }, children: /* @__PURE__ */ i(
|
|
20
20
|
$,
|
|
21
21
|
{
|
|
22
22
|
style: {
|
|
@@ -26,7 +26,7 @@ const lt = (T) => {
|
|
|
26
26
|
margin: 0,
|
|
27
27
|
padding: 0
|
|
28
28
|
},
|
|
29
|
-
as:
|
|
29
|
+
as: R,
|
|
30
30
|
fluid: !0,
|
|
31
31
|
post: m
|
|
32
32
|
},
|
|
@@ -46,8 +46,8 @@ const lt = (T) => {
|
|
|
46
46
|
"data-enable-sorting": y,
|
|
47
47
|
"data-sort-first-by": v,
|
|
48
48
|
"data-sorting-taxonomy": w,
|
|
49
|
-
editing:
|
|
50
|
-
} = T,
|
|
49
|
+
editing: j
|
|
50
|
+
} = T, z = ot(), { locale: M } = at(), [A, b] = V(!1), I = rt((t) => t).getIn(["data", "posts", u]), [P, x] = V([]), H = it(y) && v !== "none" ? st(v) : null, g = I ?? {
|
|
51
51
|
yearFilter: null,
|
|
52
52
|
categoryFilter: null,
|
|
53
53
|
countryFilter: null,
|
|
@@ -70,7 +70,7 @@ const lt = (T) => {
|
|
|
70
70
|
const e = Array.from(new Set(t)).sort((S, C) => S - C);
|
|
71
71
|
if (e.length === 0)
|
|
72
72
|
return null;
|
|
73
|
-
const a = e[0], r = e[e.length - 1], o =
|
|
73
|
+
const a = e[0], r = e[e.length - 1], o = B(a), n = B(r);
|
|
74
74
|
return !(o != null && o.startDate) || !(n != null && n.endDate) ? null : {
|
|
75
75
|
startDate: o.startDate,
|
|
76
76
|
endDate: n.endDate
|
|
@@ -85,11 +85,11 @@ const lt = (T) => {
|
|
|
85
85
|
countryFilter: a,
|
|
86
86
|
countryTaxonomy: n
|
|
87
87
|
};
|
|
88
|
-
},
|
|
88
|
+
}, O = (t) => j ? t : decodeURIComponent(t), L = (t) => {
|
|
89
89
|
try {
|
|
90
|
-
return JSON.parse(
|
|
90
|
+
return JSON.parse(O(t));
|
|
91
91
|
} catch (e) {
|
|
92
|
-
return console.warn("JSON parsing failed for value:", t, "- treating as plain string. Error:", e),
|
|
92
|
+
return console.warn("JSON parsing failed for value:", t, "- treating as plain string. Error:", e), O(t);
|
|
93
93
|
}
|
|
94
94
|
}, q = () => {
|
|
95
95
|
const t = L(h);
|
|
@@ -122,7 +122,7 @@ const lt = (T) => {
|
|
|
122
122
|
before: t.before,
|
|
123
123
|
perPage: Number(N || 10),
|
|
124
124
|
page: g.page || 1,
|
|
125
|
-
locale:
|
|
125
|
+
locale: M || "en",
|
|
126
126
|
postType: c,
|
|
127
127
|
taxonomy: t.categoryTaxonomy || void 0,
|
|
128
128
|
category: S || void 0,
|
|
@@ -134,12 +134,12 @@ const lt = (T) => {
|
|
|
134
134
|
if (s) {
|
|
135
135
|
let p = null, d = null;
|
|
136
136
|
if (s && typeof s == "object" && "data" in s ? (p = s.data, d = s.meta) : (Array.isArray(s), p = s), x(Array.isArray(p) ? p : []), d) {
|
|
137
|
-
const
|
|
138
|
-
|
|
137
|
+
const _ = d["x-wp-totalpages"] ? d["x-wp-totalpages"] : 1, G = d["x-wp-total"] ? d["x-wp-total"] : 0;
|
|
138
|
+
_ && G && z({
|
|
139
139
|
type: "SET_POSTS_PAGINATION",
|
|
140
140
|
group: u,
|
|
141
|
-
totalPages: Number(
|
|
142
|
-
totalItems: Number(
|
|
141
|
+
totalPages: Number(_),
|
|
142
|
+
totalItems: Number(G)
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
} else
|
|
@@ -150,14 +150,14 @@ const lt = (T) => {
|
|
|
150
150
|
};
|
|
151
151
|
return Q(() => {
|
|
152
152
|
(async () => await k())();
|
|
153
|
-
}, [I, c, l, N, h,
|
|
153
|
+
}, [I, c, l, N, h, w]), /* @__PURE__ */ i(R, { fluid: !0, children: A ? /* @__PURE__ */ i(X, { active: !0, inline: "centered" }) : !A && P && P.length > 0 ? /* @__PURE__ */ i(
|
|
154
154
|
lt,
|
|
155
155
|
{
|
|
156
156
|
posts: P,
|
|
157
157
|
postWidth: Number(f),
|
|
158
158
|
postHeight: Number(m),
|
|
159
159
|
numberOfColumns: Number(E),
|
|
160
|
-
sortFirstBy:
|
|
160
|
+
sortFirstBy: H,
|
|
161
161
|
countryCategory: w
|
|
162
162
|
}
|
|
163
163
|
) : /* @__PURE__ */ i(et, { noDataMsg: "No posts found", group: u }) });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { Config as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useEffect as j } from "react";
|
|
3
|
+
import B from "./PostsFilterDropdown.js";
|
|
4
|
+
import { Config as D } from "../../conf/index.js";
|
|
5
|
+
const k = (i) => {
|
|
6
6
|
const {
|
|
7
|
-
taxonomy:
|
|
7
|
+
taxonomy: t,
|
|
8
8
|
group: l,
|
|
9
9
|
placeholder: p,
|
|
10
10
|
allLabel: c,
|
|
@@ -20,35 +20,36 @@ const N = (r) => {
|
|
|
20
20
|
ascOrder: h,
|
|
21
21
|
type: P,
|
|
22
22
|
categories: n,
|
|
23
|
-
onChange: T
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
onChange: T,
|
|
24
|
+
...w
|
|
25
|
+
} = i, [C, e] = _([]), b = async () => {
|
|
26
|
+
if (!t || t === "none") {
|
|
26
27
|
e([]);
|
|
27
28
|
return;
|
|
28
29
|
}
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
key:
|
|
33
|
-
value:
|
|
34
|
-
text:
|
|
30
|
+
const r = await (await fetch(D.REACT_APP_WP_API + "/wp/v2/" + t)).json();
|
|
31
|
+
if (r) {
|
|
32
|
+
const s = r.map((o) => ({
|
|
33
|
+
key: o.id,
|
|
34
|
+
value: o.id,
|
|
35
|
+
text: o.name
|
|
35
36
|
}));
|
|
36
37
|
if (n) {
|
|
37
|
-
const
|
|
38
|
-
e([]), e(
|
|
38
|
+
const o = s.filter((v) => n.indexOf(v.value.toString()) > -1);
|
|
39
|
+
e([]), e(o);
|
|
39
40
|
} else
|
|
40
|
-
e([]), e(
|
|
41
|
+
e([]), e(s);
|
|
41
42
|
}
|
|
42
43
|
};
|
|
43
|
-
return
|
|
44
|
+
return j(() => {
|
|
44
45
|
let a = !1;
|
|
45
|
-
return a || (e([]),
|
|
46
|
+
return a || (e([]), b()), () => {
|
|
46
47
|
a = !0;
|
|
47
48
|
};
|
|
48
|
-
}, [P,
|
|
49
|
-
|
|
49
|
+
}, [P, t, n]), /* @__PURE__ */ A(
|
|
50
|
+
B,
|
|
50
51
|
{
|
|
51
|
-
...
|
|
52
|
+
...w,
|
|
52
53
|
group: l,
|
|
53
54
|
placeholder: p,
|
|
54
55
|
allLabel: c,
|
|
@@ -62,11 +63,11 @@ const N = (r) => {
|
|
|
62
63
|
autoApply: O,
|
|
63
64
|
alphabeticalSort: S,
|
|
64
65
|
ascOrder: h,
|
|
65
|
-
options:
|
|
66
|
+
options: C,
|
|
66
67
|
onChange: T
|
|
67
68
|
}
|
|
68
69
|
);
|
|
69
70
|
};
|
|
70
71
|
export {
|
|
71
|
-
|
|
72
|
+
k as default
|
|
72
73
|
};
|