@devgateway/dvz-ui-react 1.7.10 → 1.7.12

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),c=require("react"),r=require("@devgateway/wp-react-lib"),a=require("semantic-ui-react"),L=e=>{const d=e.as?e.as:a.Container,u=["post","pageNumber","visibility","intl","as"],t={};return Object.keys(e).filter(s=>s).forEach(s=>{u.indexOf(s)==-1&&(t[s]=e[s])}),n.jsx(d,{...t,children:e.children})},S=e=>{const[d,u]=c.useState(!1);c.useEffect(()=>{e.onLoad&&e.onLoad()},[]);const{post:t,pageNumber:s,showTitle:g,showContent:x,showIntro:j,showDate:w,showLoading:C,as:P,locale:h,messages:b,preview:v}=e;if(t){const o=t.content?t.content.rendered.split("<!--more-->"):[],y=o.length>1?o[0]:null,i=o.length>1?o[1]:o[0],m=i?i.split("<!--nextpage-->"):"";let l="";return s!=null&&m.length>0?l=m[s]:l=i,n.jsx(r.EmbeddedGateway,{parentUnique:e.parentUnique,messages:b,parent:v?t.parent:t.id,children:n.jsxs(L,{className:"entry-content",...e,children:[n.jsx("div",{}),w&&n.jsx(a.Container,{fluid:!0,className:"date",children:t.date.toLocaleString()}),g&&n.jsx("span",{id:t.slug,className:"title",dangerouslySetInnerHTML:{__html:t.title.rendered}},"title"),j&&n.jsx(a.Container,{fluid:!0,className:"excerpt",dangerouslySetInnerHTML:{__html:r.utils.removePatternBrackets(r.dvizTranslate(y,h))}},"intro"),x&&n.jsx(a.Container,{fluid:!0,className:"content ",dangerouslySetInnerHTML:{__html:r.utils.removePatternBrackets(r.dvizTranslate(l,h))}},"content")]})})}else return C?"Loading":!1},f=e=>n.jsx(c.Suspense,{children:n.jsx(S,{...e,showContent:!0})});exports.FilteredPostContent=f;exports.default=f;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),r=require("./FilteredPostsContent.js"),o=e=>t.jsx(r.FilteredPostContent,{...e,showIntro:!0});exports.default=o;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),g=require("react"),p=require("semantic-ui-react"),st=require("../connected-templates/PostIntro.js"),z=require("react-intl"),B=require("./utils.js"),at=require("./NoData.js"),H=require("react-redux"),it=require("../reducers/data-api.js"),V=require("../../utils/data.js"),lt=w=>{const{posts:l,numberOfColumns:C,sortFirstBy:u,countryCategory:c,postWidth:N,postHeight:I}=w,f=[];if(c&&u&&u!=="none"){const d=l.filter(h=>h[c].includes(Number(u))),v=l.filter(h=>!h[c].includes(Number(u)));f.push(...d),f.push(...v)}else f.push(...l);return n.jsx(p.Grid,{className:"filtered-posts",columns:C,children:n.jsx(p.GridRow,{children:f.map(d=>n.jsx(p.Grid.Column,{children:n.jsx("div",{className:"filtered-posts-column",style:{width:N,height:I,overflow:"hidden"},children:n.jsx(st.default,{style:{width:"100%",height:"100%",overflow:"hidden",margin:0,padding:0},as:p.Container,fluid:!0,post:d},d.id)})},d.id))})})},ut=w=>{const{"data-group":l,"data-number-of-columns":C,"data-type":u,"data-taxonomy":c,"data-categories":N="[]","data-height":I,"data-post-width":f,"data-post-height":d,"data-number-of-items-per-page":v,"data-enable-sorting":h,"data-sort-first-by":q,"data-sorting-taxonomy":R,"data-wordpress-source-type":dt,"data-wordpress-source":W,"data-no-data-msg":J,"data-clear-filter-msg":L,editing:U}=w,$=H.useDispatch(),{locale:k}=z.useIntl(),[O,S]=g.useState(!1),D=g.useRef(0),_=H.useSelector(t=>t).getIn(["data","posts",l]),[E,F]=g.useState([]),j=g.useRef(null),[P,M]=g.useState(void 0),K=V.toBoolean(h)&&q!=="none"?V.toNumber(q):null,y=_??{yearFilter:null,categoryFilter:null,countryFilter:null,page:1,countryTaxonomy:null,categoryTaxonomy:null},T=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}},Q=t=>{if(!t||t.length===0)return null;const e=Array.from(new Set(t)).sort((x,A)=>x-A);if(e.length===0)return null;const a=e[0],s=e[e.length-1],r=B.getStartDateAndEndDateFromYear(a),o=B.getStartDateAndEndDateFromYear(s);return!(r!=null&&r.startDate)||!(o!=null&&o.endDate)?null:{startDate:r.startDate,endDate:o.endDate}},X=()=>{const t=T(y.yearFilter),e=t.isExplicitNone?null:Q(t.values),a=y.countryFilter??null,s=y.categoryFilter??null,r=y.categoryTaxonomy||(c&&c!=="none"?c:null),o=y.countryTaxonomy||null;return{before:(e==null?void 0:e.endDate)||null,after:(e==null?void 0:e.startDate)||null,categoryFilter:s,categoryTaxonomy:r,countryFilter:a,countryTaxonomy:o}},G=t=>U?t:decodeURIComponent(t),Z=t=>{try{return JSON.parse(G(t))}catch(e){return console.warn("JSON parsing failed for value:",t,"- treating as plain string. Error:",e),G(t)}},tt=()=>{const t=Z(N);return t?typeof t=="string"?t.split(",").map(Number):typeof t=="number"?[t]:t:[]},et=(t,e,a)=>{if(a)return null;if(t.length===0)return e.length>0?e:null;if(e.length===0)return t;const s=new Set(t),r=e.filter(o=>s.has(o));return r.length>0?r:null},rt=async()=>{const t=++D.current;j.current&&M(j.current.offsetHeight),S(!0);const e=X(),a=T(tt()).values,s=T(e.categoryFilter),r=et(a,s.values,s.isExplicitNone),o=T(e.countryFilter);if(s.isExplicitNone){F([]),S(!1);return}if(o.isExplicitNone){F([]),S(!1);return}const x=new Map;e.categoryTaxonomy&&r&&r.length>0&&x.set(e.categoryTaxonomy,r),e.countryTaxonomy&&o.values.length>0&&x.set(e.countryTaxonomy,o.values);const A=r?r.join(","):void 0,ot={after:e.after,before:e.before,perPage:Number(v||10),page:y.page||1,locale:k||"en",postType:u,taxonomy:e.categoryTaxonomy||void 0,category:A||void 0,taxonomyFilters:x,ordering:"date",orderingDirection:"desc",wpApiBase:W??void 0};await it.getCustomPosts(ot).then(i=>{if(t===D.current)if(i){let b=null,m=null;if(i&&typeof i=="object"&&"data"in i?(b=i.data,m=i.meta):(Array.isArray(i),b=i),F(Array.isArray(b)?b:[]),m){const Y=m["x-wp-totalpages"]?m["x-wp-totalpages"]:1,nt=m["x-wp-total"]?m["x-wp-total"]:0;Y&&$({type:"SET_POSTS_PAGINATION",group:l,totalPages:Number(Y),totalItems:Number(nt)})}}else F([])}).finally(()=>{t===D.current&&(S(!1),M(void 0))})};return g.useEffect(()=>{u&&(async()=>await rt())()},[_,u,c,v,N,R]),n.jsx("div",{ref:j,id:`filtered-posts-${l}`,style:P!==void 0?{minHeight:P,border:"1px solid #e0e0e0",borderRadius:"4px"}:void 0,children:n.jsx(p.Container,{fluid:!0,children:O?n.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:P??"100%"},children:n.jsx(p.Loader,{active:!0,inline:"centered"})}):!O&&E&&E.length>0?n.jsx(lt,{posts:E,postWidth:Number(f),postHeight:Number(d),numberOfColumns:Number(C),sortFirstBy:K,countryCategory:R}):n.jsx(at.default,{noDataMsg:J,clearFilterMsg:L,group:l})})})},ct=z.injectIntl(g.memo(ut));exports.default=ct;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),g=require("react"),f=require("semantic-ui-react"),at=require("../connected-templates/PostIntro.js"),it=require("./FilteredPostsIntro.js"),W=require("react-intl"),H=require("./utils.js"),lt=require("./NoData.js"),V=require("react-redux"),ut=require("../reducers/data-api.js"),z=require("../../utils/data.js"),ct=x=>{const{posts:u,numberOfColumns:T,sortFirstBy:c,countryCategory:d,postWidth:S,postHeight:q}=x,y=[];if(d&&c&&c!=="none"){const s=u.filter(m=>m[d].includes(Number(c))),j=u.filter(m=>!m[d].includes(Number(c)));y.push(...s),y.push(...j)}else y.push(...u);const C=x.wordpressSourceType==="internal"||!x.wordpressSourceType;return o.jsx(f.Grid,{className:"filtered-posts",columns:T,children:o.jsx(f.GridRow,{children:y.map(s=>o.jsx(f.Grid.Column,{children:o.jsx("div",{className:"filtered-posts-column",style:{width:S,height:q,overflow:"hidden"},children:C?o.jsx(at.default,{style:{width:"100%",height:"100%",overflow:"hidden",margin:0,padding:0},as:f.Container,fluid:!0,post:s},s.id):o.jsx(it.default,{style:{width:"100%",height:"100%",overflow:"hidden",margin:0,padding:0},as:f.Container,fluid:!0,post:s},s.id)})},s.id))})})},dt=x=>{const{"data-group":u,"data-number-of-columns":T,"data-type":c,"data-taxonomy":d,"data-categories":S="[]","data-height":q,"data-post-width":y,"data-post-height":C,"data-number-of-items-per-page":s,"data-enable-sorting":j,"data-sort-first-by":m,"data-sorting-taxonomy":R,"data-wordpress-source-type":J,"data-wordpress-source":O,"data-no-data-msg":L,"data-clear-filter-msg":U,editing:$}=x,k=V.useDispatch(),{locale:K}=W.useIntl(),[_,v]=g.useState(!1),D=g.useRef(0),M=V.useSelector(t=>t).getIn(["data","posts",u]),[E,F]=g.useState([]),P=g.useRef(null),[A,G]=g.useState(void 0),Q=z.toBoolean(j)&&m!=="none"?z.toNumber(m):null,p=M??{yearFilter:null,categoryFilter:null,countryFilter:null,page:1,countryTaxonomy:null,categoryTaxonomy:null},w=t=>{if(t==null)return{values:[],isExplicitNone:!1};const e=Array.isArray(t)?t:[t],i=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:i}},X=t=>{if(!t||t.length===0)return null;const e=Array.from(new Set(t)).sort((b,I)=>b-I);if(e.length===0)return null;const i=e[0],a=e[e.length-1],r=H.getStartDateAndEndDateFromYear(i),n=H.getStartDateAndEndDateFromYear(a);return!(r!=null&&r.startDate)||!(n!=null&&n.endDate)?null:{startDate:r.startDate,endDate:n.endDate}},Z=()=>{const t=w(p.yearFilter),e=t.isExplicitNone?null:X(t.values),i=p.countryFilter??null,a=p.categoryFilter??null,r=p.categoryTaxonomy||(d&&d!=="none"?d:null),n=p.countryTaxonomy||null;return{before:(e==null?void 0:e.endDate)||null,after:(e==null?void 0:e.startDate)||null,categoryFilter:a,categoryTaxonomy:r,countryFilter:i,countryTaxonomy:n}},Y=t=>$?t:decodeURIComponent(t),tt=t=>{try{return JSON.parse(Y(t))}catch(e){return console.warn("JSON parsing failed for value:",t,"- treating as plain string. Error:",e),Y(t)}},et=()=>{const t=tt(S);return t?typeof t=="string"?t.split(",").map(Number):typeof t=="number"?[t]:t:[]},rt=(t,e,i)=>{if(i)return null;if(t.length===0)return e.length>0?e:null;if(e.length===0)return t;const a=new Set(t),r=e.filter(n=>a.has(n));return r.length>0?r:null},nt=async()=>{const t=++D.current;P.current&&G(P.current.offsetHeight),v(!0);const e=Z(),i=w(et()).values,a=w(e.categoryFilter),r=rt(i,a.values,a.isExplicitNone),n=w(e.countryFilter);if(a.isExplicitNone){F([]),v(!1);return}if(n.isExplicitNone){F([]),v(!1);return}const b=new Map;e.categoryTaxonomy&&r&&r.length>0&&b.set(e.categoryTaxonomy,r),e.countryTaxonomy&&n.values.length>0&&b.set(e.countryTaxonomy,n.values);const I=r?r.join(","):void 0,ot={after:e.after,before:e.before,perPage:Number(s||10),page:p.page||1,locale:K||"en",postType:c,taxonomy:e.categoryTaxonomy||void 0,category:I||void 0,taxonomyFilters:b,ordering:"date",orderingDirection:"desc",wpApiBase:O??void 0};await ut.getCustomPosts(ot).then(l=>{if(t===D.current)if(l){let N=null,h=null;if(l&&typeof l=="object"&&"data"in l?(N=l.data,h=l.meta):(Array.isArray(l),N=l),F(Array.isArray(N)?N:[]),h){const B=h["x-wp-totalpages"]?h["x-wp-totalpages"]:1,st=h["x-wp-total"]?h["x-wp-total"]:0;B&&k({type:"SET_POSTS_PAGINATION",group:u,totalPages:Number(B),totalItems:Number(st)})}}else F([])}).finally(()=>{t===D.current&&(v(!1),G(void 0))})};return g.useEffect(()=>{c&&(async()=>await nt())()},[M,c,d,s,S,R]),o.jsx("div",{ref:P,id:`filtered-posts-${u}`,style:A!==void 0?{minHeight:A,border:"1px solid #e0e0e0",borderRadius:"4px"}:void 0,children:o.jsx(f.Container,{fluid:!0,children:_?o.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:A??"100%"},children:o.jsx(f.Loader,{active:!0,inline:"centered"})}):!_&&E&&E.length>0?o.jsx(ct,{posts:E,postWidth:Number(y),postHeight:Number(C),numberOfColumns:Number(T),sortFirstBy:Q,countryCategory:R,wordpressSourceType:J,wordpressSource:O}):o.jsx(lt.default,{noDataMsg:L,clearFilterMsg:U,group:u})})})},gt=W.injectIntl(g.memo(dt));exports.default=gt;
@@ -0,0 +1,76 @@
1
+ import { jsx as n, jsxs as S } from "react/jsx-runtime";
2
+ import m, { Suspense as v } from "react";
3
+ import { EmbeddedGateway as x, utils as h, dvizTranslate as f } from "@devgateway/wp-react-lib";
4
+ import { Container as r } from "semantic-ui-react";
5
+ const E = (e) => {
6
+ const i = e.as ? e.as : r, c = ["post", "pageNumber", "visibility", "intl", "as"], t = {};
7
+ return Object.keys(e).filter((o) => o).forEach((o) => {
8
+ c.indexOf(o) == -1 && (t[o] = e[o]);
9
+ }), /* @__PURE__ */ n(i, { ...t, children: e.children });
10
+ }, P = (e) => {
11
+ const [i, c] = m.useState(!1);
12
+ m.useEffect(() => {
13
+ e.onLoad && e.onLoad();
14
+ }, []);
15
+ const {
16
+ post: t,
17
+ pageNumber: o,
18
+ showTitle: g,
19
+ showContent: w,
20
+ showIntro: b,
21
+ showDate: p,
22
+ showLoading: y,
23
+ as: _,
24
+ locale: d,
25
+ messages: C,
26
+ preview: L
27
+ } = e;
28
+ if (t) {
29
+ const s = t.content ? t.content.rendered.split("<!--more-->") : [], N = s.length > 1 ? s[0] : null, a = s.length > 1 ? s[1] : s[0], u = a ? a.split("<!--nextpage-->") : "";
30
+ let l = "";
31
+ return o != null && u.length > 0 ? l = u[o] : l = a, /* @__PURE__ */ n(
32
+ x,
33
+ {
34
+ parentUnique: e.parentUnique,
35
+ messages: C,
36
+ parent: L ? t.parent : t.id,
37
+ children: /* @__PURE__ */ S(E, { className: "entry-content", ...e, children: [
38
+ /* @__PURE__ */ n("div", {}),
39
+ p && /* @__PURE__ */ n(r, { fluid: !0, className: "date", children: t.date.toLocaleString() }),
40
+ g && /* @__PURE__ */ n(
41
+ "span",
42
+ {
43
+ id: t.slug,
44
+ className: "title",
45
+ dangerouslySetInnerHTML: { __html: t.title.rendered }
46
+ },
47
+ "title"
48
+ ),
49
+ b && /* @__PURE__ */ n(
50
+ r,
51
+ {
52
+ fluid: !0,
53
+ className: "excerpt",
54
+ dangerouslySetInnerHTML: { __html: h.removePatternBrackets(f(N, d)) }
55
+ },
56
+ "intro"
57
+ ),
58
+ w && /* @__PURE__ */ n(
59
+ r,
60
+ {
61
+ fluid: !0,
62
+ className: "content ",
63
+ dangerouslySetInnerHTML: { __html: h.removePatternBrackets(f(l, d)) }
64
+ },
65
+ "content"
66
+ )
67
+ ] })
68
+ }
69
+ );
70
+ } else
71
+ return y ? "Loading" : !1;
72
+ }, H = (e) => /* @__PURE__ */ n(v, { children: /* @__PURE__ */ n(P, { ...e, showContent: !0 }) });
73
+ export {
74
+ H as FilteredPostContent,
75
+ H as default
76
+ };
@@ -0,0 +1,6 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { FilteredPostContent as r } from "./FilteredPostsContent.js";
3
+ const s = (t) => /* @__PURE__ */ o(r, { ...t, showIntro: !0 });
4
+ export {
5
+ s as default
6
+ };
@@ -1,22 +1,24 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
- import nt, { useState as A, useRef as V, useEffect as at } from "react";
3
- import { Container as z, Loader as st, Grid as Y, GridRow as it } from "semantic-ui-react";
4
- import lt from "../connected-templates/PostIntro.js";
5
- import { injectIntl as ct, useIntl as ut } from "react-intl";
6
- import { getStartDateAndEndDateFromYear as j } from "./utils.js";
7
- import dt from "./NoData.js";
8
- import { useDispatch as mt, useSelector as ft } from "react-redux";
9
- import { getCustomPosts as gt } from "../reducers/data-api.js";
10
- import { toNumber as yt, toBoolean as pt } from "../../utils/data.js";
11
- const ht = (S) => {
12
- const { posts: l, numberOfColumns: T, sortFirstBy: c, countryCategory: u, postWidth: b, postHeight: I } = S, m = [];
13
- if (u && c && c !== "none") {
14
- const d = l.filter((y) => y[u].includes(Number(c))), x = l.filter((y) => !y[u].includes(Number(c)));
15
- m.push(...d), m.push(...x);
2
+ import at, { useState as A, useRef as j, useEffect as st } from "react";
3
+ import { Container as R, Loader as it, Grid as z, GridRow as lt } from "semantic-ui-react";
4
+ import ut from "../connected-templates/PostIntro.js";
5
+ import ct from "./FilteredPostsIntro.js";
6
+ import { injectIntl as dt, useIntl as mt } from "react-intl";
7
+ import { getStartDateAndEndDateFromYear as q } from "./utils.js";
8
+ import ft from "./NoData.js";
9
+ import { useDispatch as gt, useSelector as yt } from "react-redux";
10
+ import { getCustomPosts as pt } from "../reducers/data-api.js";
11
+ import { toNumber as ht, toBoolean as bt } from "../../utils/data.js";
12
+ const xt = (p) => {
13
+ const { posts: u, numberOfColumns: w, sortFirstBy: c, countryCategory: d, postWidth: x, postHeight: O } = p, m = [];
14
+ if (d && c && c !== "none") {
15
+ const a = u.filter((f) => f[d].includes(Number(c))), T = u.filter((f) => !f[d].includes(Number(c)));
16
+ m.push(...a), m.push(...T);
16
17
  } else
17
- m.push(...l);
18
- return /* @__PURE__ */ n(Y, { className: "filtered-posts", columns: T, children: /* @__PURE__ */ n(it, { children: m.map((d) => /* @__PURE__ */ n(Y.Column, { children: /* @__PURE__ */ n("div", { className: "filtered-posts-column", style: { width: b, height: I, overflow: "hidden" }, children: /* @__PURE__ */ n(
19
- lt,
18
+ m.push(...u);
19
+ const S = p.wordpressSourceType === "internal" || !p.wordpressSourceType;
20
+ return /* @__PURE__ */ n(z, { className: "filtered-posts", columns: w, children: /* @__PURE__ */ n(lt, { children: m.map((a) => /* @__PURE__ */ n(z.Column, { children: /* @__PURE__ */ n("div", { className: "filtered-posts-column", style: { width: x, height: O, overflow: "hidden" }, children: S ? /* @__PURE__ */ n(
21
+ ut,
20
22
  {
21
23
  style: {
22
24
  width: "100%",
@@ -25,32 +27,47 @@ const ht = (S) => {
25
27
  margin: 0,
26
28
  padding: 0
27
29
  },
28
- as: z,
30
+ as: R,
29
31
  fluid: !0,
30
- post: d
32
+ post: a
31
33
  },
32
- d.id
33
- ) }) }, d.id)) }) });
34
- }, bt = (S) => {
34
+ a.id
35
+ ) : /* @__PURE__ */ n(
36
+ ct,
37
+ {
38
+ style: {
39
+ width: "100%",
40
+ height: "100%",
41
+ overflow: "hidden",
42
+ margin: 0,
43
+ padding: 0
44
+ },
45
+ as: R,
46
+ fluid: !0,
47
+ post: a
48
+ },
49
+ a.id
50
+ ) }) }, a.id)) }) });
51
+ }, Nt = (p) => {
35
52
  const {
36
- "data-group": l,
37
- "data-number-of-columns": T,
53
+ "data-group": u,
54
+ "data-number-of-columns": w,
38
55
  "data-type": c,
39
- "data-taxonomy": u,
40
- "data-categories": b = "[]",
41
- "data-height": I,
56
+ "data-taxonomy": d,
57
+ "data-categories": x = "[]",
58
+ "data-height": O,
42
59
  "data-post-width": m,
43
- "data-post-height": d,
44
- "data-number-of-items-per-page": x,
45
- "data-enable-sorting": y,
46
- "data-sort-first-by": R,
47
- "data-sorting-taxonomy": O,
48
- "data-wordpress-source-type": xt,
49
- "data-wordpress-source": q,
50
- "data-no-data-msg": W,
51
- "data-clear-filter-msg": J,
52
- editing: L
53
- } = S, U = mt(), { locale: $ } = ut(), [_, N] = A(!1), w = V(0), B = ft((t) => t).getIn(["data", "posts", l]), [C, v] = A([]), E = V(null), [D, G] = A(void 0), k = pt(y) && R !== "none" ? yt(R) : null, f = B ?? {
60
+ "data-post-height": S,
61
+ "data-number-of-items-per-page": a,
62
+ "data-enable-sorting": T,
63
+ "data-sort-first-by": f,
64
+ "data-sorting-taxonomy": _,
65
+ "data-wordpress-source-type": W,
66
+ "data-wordpress-source": B,
67
+ "data-no-data-msg": J,
68
+ "data-clear-filter-msg": L,
69
+ editing: U
70
+ } = p, $ = gt(), { locale: k } = mt(), [G, N] = A(!1), C = j(0), H = yt((t) => t).getIn(["data", "posts", u]), [E, v] = A([]), P = j(null), [D, M] = A(void 0), K = bt(T) && f !== "none" ? ht(f) : null, g = H ?? {
54
71
  yearFilter: null,
55
72
  categoryFilter: null,
56
73
  countryFilter: null,
@@ -60,58 +77,58 @@ const ht = (S) => {
60
77
  }, F = (t) => {
61
78
  if (t == null)
62
79
  return { values: [], isExplicitNone: !1 };
63
- const e = Array.isArray(t) ? t : [t], s = e.some(
80
+ const e = Array.isArray(t) ? t : [t], i = e.some(
64
81
  (r) => Number(r) === Number.MIN_SAFE_INTEGER
65
82
  );
66
83
  return {
67
84
  values: e.map((r) => Number(r)).filter((r) => Number.isFinite(r) && r !== Number.MIN_SAFE_INTEGER),
68
- isExplicitNone: s
85
+ isExplicitNone: i
69
86
  };
70
- }, K = (t) => {
87
+ }, Q = (t) => {
71
88
  if (!t || t.length === 0)
72
89
  return null;
73
- const e = Array.from(new Set(t)).sort((p, P) => p - P);
90
+ const e = Array.from(new Set(t)).sort((h, I) => h - I);
74
91
  if (e.length === 0)
75
92
  return null;
76
- const s = e[0], a = e[e.length - 1], r = j(s), o = j(a);
93
+ const i = e[0], s = e[e.length - 1], r = q(i), o = q(s);
77
94
  return !(r != null && r.startDate) || !(o != null && o.endDate) ? null : {
78
95
  startDate: r.startDate,
79
96
  endDate: o.endDate
80
97
  };
81
- }, Q = () => {
82
- const t = F(f.yearFilter), e = t.isExplicitNone ? null : K(t.values), s = f.countryFilter ?? null, a = f.categoryFilter ?? null, r = f.categoryTaxonomy || (u && u !== "none" ? u : null), o = f.countryTaxonomy || null;
98
+ }, X = () => {
99
+ const t = F(g.yearFilter), e = t.isExplicitNone ? null : Q(t.values), i = g.countryFilter ?? null, s = g.categoryFilter ?? null, r = g.categoryTaxonomy || (d && d !== "none" ? d : null), o = g.countryTaxonomy || null;
83
100
  return {
84
101
  before: (e == null ? void 0 : e.endDate) || null,
85
102
  after: (e == null ? void 0 : e.startDate) || null,
86
- categoryFilter: a,
103
+ categoryFilter: s,
87
104
  categoryTaxonomy: r,
88
- countryFilter: s,
105
+ countryFilter: i,
89
106
  countryTaxonomy: o
90
107
  };
91
- }, H = (t) => L ? t : decodeURIComponent(t), X = (t) => {
108
+ }, V = (t) => U ? t : decodeURIComponent(t), Z = (t) => {
92
109
  try {
93
- return JSON.parse(H(t));
110
+ return JSON.parse(V(t));
94
111
  } catch (e) {
95
- return console.warn("JSON parsing failed for value:", t, "- treating as plain string. Error:", e), H(t);
112
+ return console.warn("JSON parsing failed for value:", t, "- treating as plain string. Error:", e), V(t);
96
113
  }
97
- }, Z = () => {
98
- const t = X(b);
114
+ }, tt = () => {
115
+ const t = Z(x);
99
116
  return t ? typeof t == "string" ? t.split(",").map(Number) : typeof t == "number" ? [t] : t : [];
100
- }, tt = (t, e, s) => {
101
- if (s) return null;
117
+ }, et = (t, e, i) => {
118
+ if (i) return null;
102
119
  if (t.length === 0) return e.length > 0 ? e : null;
103
120
  if (e.length === 0) return t;
104
- const a = new Set(t), r = e.filter((o) => a.has(o));
121
+ const s = new Set(t), r = e.filter((o) => s.has(o));
105
122
  return r.length > 0 ? r : null;
106
- }, et = async () => {
107
- const t = ++w.current;
108
- E.current && G(E.current.offsetHeight), N(!0);
109
- const e = Q(), s = F(Z()).values, a = F(e.categoryFilter), r = tt(
110
- s,
111
- a.values,
112
- a.isExplicitNone
123
+ }, rt = async () => {
124
+ const t = ++C.current;
125
+ P.current && M(P.current.offsetHeight), N(!0);
126
+ const e = X(), i = F(tt()).values, s = F(e.categoryFilter), r = et(
127
+ i,
128
+ s.values,
129
+ s.isExplicitNone
113
130
  ), o = F(e.countryFilter);
114
- if (a.isExplicitNone) {
131
+ if (s.isExplicitNone) {
115
132
  v([]), N(!1);
116
133
  return;
117
134
  }
@@ -119,55 +136,57 @@ const ht = (S) => {
119
136
  v([]), N(!1);
120
137
  return;
121
138
  }
122
- const p = /* @__PURE__ */ new Map();
123
- e.categoryTaxonomy && r && r.length > 0 && p.set(e.categoryTaxonomy, r), e.countryTaxonomy && o.values.length > 0 && p.set(e.countryTaxonomy, o.values);
124
- const P = r ? r.join(",") : void 0, rt = {
139
+ const h = /* @__PURE__ */ new Map();
140
+ e.categoryTaxonomy && r && r.length > 0 && h.set(e.categoryTaxonomy, r), e.countryTaxonomy && o.values.length > 0 && h.set(e.countryTaxonomy, o.values);
141
+ const I = r ? r.join(",") : void 0, ot = {
125
142
  after: e.after,
126
143
  before: e.before,
127
- perPage: Number(x || 10),
128
- page: f.page || 1,
129
- locale: $ || "en",
144
+ perPage: Number(a || 10),
145
+ page: g.page || 1,
146
+ locale: k || "en",
130
147
  postType: c,
131
148
  taxonomy: e.categoryTaxonomy || void 0,
132
- category: P || void 0,
133
- taxonomyFilters: p,
149
+ category: I || void 0,
150
+ taxonomyFilters: h,
134
151
  ordering: "date",
135
152
  orderingDirection: "desc",
136
- wpApiBase: q ?? void 0
153
+ wpApiBase: B ?? void 0
137
154
  };
138
- await gt(rt).then((i) => {
139
- if (t === w.current)
140
- if (i) {
141
- let h = null, g = null;
142
- if (i && typeof i == "object" && "data" in i ? (h = i.data, g = i.meta) : (Array.isArray(i), h = i), v(Array.isArray(h) ? h : []), g) {
143
- const M = g["x-wp-totalpages"] ? g["x-wp-totalpages"] : 1, ot = g["x-wp-total"] ? g["x-wp-total"] : 0;
144
- M && U({
155
+ await pt(ot).then((l) => {
156
+ if (t === C.current)
157
+ if (l) {
158
+ let b = null, y = null;
159
+ if (l && typeof l == "object" && "data" in l ? (b = l.data, y = l.meta) : (Array.isArray(l), b = l), v(Array.isArray(b) ? b : []), y) {
160
+ const Y = y["x-wp-totalpages"] ? y["x-wp-totalpages"] : 1, nt = y["x-wp-total"] ? y["x-wp-total"] : 0;
161
+ Y && $({
145
162
  type: "SET_POSTS_PAGINATION",
146
- group: l,
147
- totalPages: Number(M),
148
- totalItems: Number(ot)
163
+ group: u,
164
+ totalPages: Number(Y),
165
+ totalItems: Number(nt)
149
166
  });
150
167
  }
151
168
  } else
152
169
  v([]);
153
170
  }).finally(() => {
154
- t === w.current && (N(!1), G(void 0));
171
+ t === C.current && (N(!1), M(void 0));
155
172
  });
156
173
  };
157
- return at(() => {
158
- c && (async () => await et())();
159
- }, [B, c, u, x, b, O]), /* @__PURE__ */ n("div", { ref: E, id: `filtered-posts-${l}`, style: D !== void 0 ? { minHeight: D, border: "1px solid #e0e0e0", borderRadius: "4px" } : void 0, children: /* @__PURE__ */ n(z, { fluid: !0, children: _ ? /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: D ?? "100%" }, children: /* @__PURE__ */ n(st, { active: !0, inline: "centered" }) }) : !_ && C && C.length > 0 ? /* @__PURE__ */ n(
160
- ht,
174
+ return st(() => {
175
+ c && (async () => await rt())();
176
+ }, [H, c, d, a, x, _]), /* @__PURE__ */ n("div", { ref: P, id: `filtered-posts-${u}`, style: D !== void 0 ? { minHeight: D, border: "1px solid #e0e0e0", borderRadius: "4px" } : void 0, children: /* @__PURE__ */ n(R, { fluid: !0, children: G ? /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: D ?? "100%" }, children: /* @__PURE__ */ n(it, { active: !0, inline: "centered" }) }) : !G && E && E.length > 0 ? /* @__PURE__ */ n(
177
+ xt,
161
178
  {
162
- posts: C,
179
+ posts: E,
163
180
  postWidth: Number(m),
164
- postHeight: Number(d),
165
- numberOfColumns: Number(T),
166
- sortFirstBy: k,
167
- countryCategory: O
181
+ postHeight: Number(S),
182
+ numberOfColumns: Number(w),
183
+ sortFirstBy: K,
184
+ countryCategory: _,
185
+ wordpressSourceType: W,
186
+ wordpressSource: B
168
187
  }
169
- ) : /* @__PURE__ */ n(dt, { noDataMsg: W, clearFilterMsg: J, group: l }) }) });
170
- }, It = ct(nt.memo(bt));
188
+ ) : /* @__PURE__ */ n(ft, { noDataMsg: J, clearFilterMsg: L, group: u }) }) });
189
+ }, Ot = dt(at.memo(Nt));
171
190
  export {
172
- It as default
191
+ Ot as default
173
192
  };
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ export declare const FilteredPostContent: (props: any) => React.JSX.Element;
3
+ export default FilteredPostContent;
@@ -0,0 +1,3 @@
1
+ import { default as React } from 'react';
2
+ declare const FilteredPostIntro: (props: any) => React.JSX.Element;
3
+ export default FilteredPostIntro;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.7.10",
3
+ "version": "1.7.12",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -122,7 +122,7 @@
122
122
  "vite-plugin-env-compatible": "^2.0.1",
123
123
  "vite-plugin-eslint": "^1.8.1",
124
124
  "vite-tsconfig-paths": "^5.1.4",
125
- "@devgateway/wp-react-lib": "0.6.1"
125
+ "@devgateway/wp-react-lib": "0.6.2"
126
126
  },
127
127
  "peerDependencies": {
128
128
  "react": "^18.3.1",