@devgateway/dvz-ui-react 1.7.0 → 1.7.2
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/data/Line.js +1 -1
- package/dist/cjs/embeddable/chart/data/Utils.js +1 -1
- package/dist/cjs/layout/SearchControl.js +1 -1
- package/dist/cjs/layout/containers/SlugPostContainer.js +1 -1
- package/dist/esm/embeddable/chart/data/Line.js +27 -24
- package/dist/esm/embeddable/chart/data/Utils.js +3 -1
- package/dist/esm/layout/SearchControl.js +108 -118
- package/dist/esm/layout/containers/SlugPostContainer.js +8 -9
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const V=require("react/jsx-runtime"),C=require("react"),u=require("./Utils.js"),J=t=>{const{data:e,measures:l,swap:
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const V=require("react/jsx-runtime"),C=require("react"),u=require("./Utils.js"),J=t=>{const{data:e,measures:l,swap:h,dimensions:f,locale:m,customLabels:d}=t;let i={};const y=f.filter(g=>g!=""),A=new Set;if(y.length==0&&e){const g=u.measuresMap(e),O=new Set,M=new Set;let E=[],R;if(e.metadata&&e.metadata.measures){const r=e.metadata.measures.filter(n=>l.includes(n.value)).sort((n,c)=>n.position!=null&&c.position!=null&&n.position!=c.position?n.position-c.position:0);E=[],R="measure",O.add("measure");const b={};Object.keys(e).forEach(n=>{b[n]=e[n]}),r.forEach(n=>{const c={},L=d[n.value]||u.getTranslatedValue(g[n.value],m);debugger;c.type="measure",c.measureFieldName=n.value,c.measure=L,c[L]=e[n.value],c.variables=b,E.push(c),M.add(L),A.add(g[n.value])}),i={categories:O,indexBy:R,keys:Array.from(M),measuresMetadata:A,data:E}}}return i},K=t=>{const{data:e,measures:l,dimensions:h,overallLabel:f}=t;if(h.length==1&&e.children){if(!(e.children.filter(d=>d.value==f).length>0)){const d={};d.type=h[0],d.value=f,d.label=f,Object.keys(e).forEach(i=>{["children","metadata","type","value"].includes(i)||(d[i]=e[i])}),e.children=[d,...e.children]}}else h.length==2&&e.children&&e.children.forEach(m=>{if(!(m.children.filter(i=>i.value==f).length>0)){const i={};i.type=h[1],i.value=f,i.label=f,Object.keys(m).forEach(y=>{["children","metadata","type","value"].includes(y)||(i[y]=m[y])}),m.children=[i,...m.children]}});return e},_=t=>{var M,E,R;let e={};const{data:l,measures:h,swap:f,dimensions:m,includeOverall:d,locale:i,customLabels:y,colorBy:A,hiddenBars:g}=t,O=m.filter(r=>r!="");if(l.metadata.measures.filter(r=>h.includes(r.value)).sort((r,b)=>r.position!=null&&b.position!=null&&r.position!=b.position?r.position-b.position:0),d&&h.length==1&&K(t),O.length==0&&l)e=J(t);else if(l&&l.children&&l.children.length>0&&O.length>0){const r=u.measuresMap(l),b=u.typesMap(l),n=new Set,c=new Set,L=new Set,N=new Set,w=[],B=l.children[0].type,x=((R=(E=(M=l==null?void 0:l.metadata)==null?void 0:M.types)==null?void 0:E.find(o=>o.dimension==O[0]))==null?void 0:R.items)||[];t.sort=="alphabetically"?x.sort((o,S)=>u.alphaSort(t.sortReverse,i,o.value,S.value)):t.sort=="values"?x.sort((o,S)=>u.numericSort(t.sortReverse,o.value,S.value)):t.sort=="date"&&x.sort((o,S)=>u.dateSort(t.sortReverse,o.value,S.value)),h.forEach(o=>{const S={variables:{}};S.id=u.getTranslatedValue(r[o],i);debugger;S.label=y[o]||u.getTranslatedValue(r[o],i);const T=[];x.forEach(s=>{const a=l.children.find(v=>v.value===s.value);if(a){const v={};Object.keys(a).forEach(q=>{v[q]=a[q]}),v.value=a[o],v[a.type]=a.value.toString(),c.add(b[a.type]),T.push({x:a.value,y:a[o],variables:v}),S.data=T}}),w.push(S)});const k=Array.from(N);let F=(g==null?void 0:g.length)>0&&(w==null?void 0:w.length)>0?w.filter(o=>g.indexOf(o[B])==-1):w;e={metadata:l.metadata,indexBy:B,categories:n,dimensionsMetadata:c,measuresMetadata:L,keys:k,data:F}}return C.Children.map(t.children,r=>C.cloneElement(r,{options:e}))},P=t=>{var g,O,M,E,R,r,b;const{data:e,measures:l,includeOverall:h,dimensions:f,hiddenBars:m,colorBy:d,locale:i}=t,y=f.filter(n=>n!="");let A={};if(h&&K(t),y.length==0&&e)A=J(t);else if(e&&e.children&&e.children.length>0&&y.length>0){const n=u.measuresMap(e),c=u.typesMap(e),L=l[0],N=new Set,w=new Set,B=[],x=[],k=(g=e.children[0])==null?void 0:g.type,F=((E=(M=(O=e==null?void 0:e.metadata)==null?void 0:O.types)==null?void 0:M.find(s=>s.dimension==y[0]))==null?void 0:E.items)||[],o=((b=(r=(R=e==null?void 0:e.metadata)==null?void 0:R.types)==null?void 0:r.find(s=>s.dimension==y[1]))==null?void 0:b.items)||[];t.sortSecondDimension=="alphabetically"?o.sort((s,a)=>u.alphaSort(t.sortReverseSecondDimension,i,s.value,a.value)):t.sortSecondDimension=="date"&&o.sort((s,a)=>u.dateSort(t.sortReverseSecondDimension,s.value,a.value)),w.add(n[L]),o.forEach(s=>{const a={variables:{}};a.id=s.value,a.label=s.value;const v=[];F.forEach(q=>{const p=e.children.find(j=>j.value===q.value);N.add(c[p==null?void 0:p.type]);const D=p==null?void 0:p.children.find(j=>j.value===s.value);if(D){N.add(c[D==null?void 0:D.type]);const j={};Object.keys(D).forEach(I=>{j[I]=D[I]}),j.value=D[l[0]],j[p.type]=p.value.toString(),j[D.type]=D.value.toString(),v.push({x:p.value,y:D[l[0]],variables:j}),B.indexOf(p.value)==-1&&B.push(p.value)}}),a.data=v,x.push(a)}),x.forEach(s=>{B.forEach(a=>{s.data.find(v=>v.x==a)||s.data.push({x:a,y:null,variables:{}})})}),x.forEach(s=>{s.data.sort((a,v)=>t.sort=="alphabetically"?u.alphaSort(t.sortReverse,i,a.x,v.x):t.sort=="date"?u.dateSort(t.sortReverse,a.x,v.x):0)});const S=d=="id"?x:x.filter(s=>m.indexOf(s[k])==-1),T=[...B];A={metadata:e.metadata,dimensionsMetadata:N,measuresMetadata:w,indexBy:k,keys:d=="index"?T:T.filter(s=>m.indexOf(s)==-1),data:S}}return V.jsx(V.Fragment,{children:C.Children.map(t.children,n=>C.cloneElement(n,{options:A}))})},U=t=>{const{data:e,measures:l,dimensions:h}=t,f=JSON.parse(JSON.stringify(e));return h.length===1?V.jsx(_,{...t,data:f}):V.jsx(P,{...t,data:f})};exports.default=U;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=e=>e==null?void 0:e.map(t=>{const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=e=>e==null?void 0:e.map(t=>{const a=t.group.label;debugger;return t.label.includes(a)?t:{...t,label:`${t.label}`}}),l=e=>{const{metadata:r}=e||{},t={},a=u((r==null?void 0:r.measures)||[]);return r&&a.forEach(n=>{t[n.value]=n}),t},c=e=>{const{metadata:r}=e||{},t={};return r&&r.types.forEach(a=>{t[a.dimension]={dimension:a.dimension,category:a.category,items:a.items}}),t},p=(e,r)=>e?e.labels&&e.labels[r.toUpperCase()]?e.labels[r.toUpperCase()]:e.label?e.label:e.value:null,i=(e,r,t,a)=>new Intl.Collator(r,{caseFirst:"upper",numeric:!0,sensitivity:"variant"}).compare(e?a:t,e?t:a),m=(e,r,t)=>!isNaN(r)&&!isNaN(t)?e?Number(t)-Number(r):Number(r)-Number(t):0,o=e=>{const[r,t]=e.split(" "),n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(r),s=parseInt(t,10);return(n===-1||isNaN(s))&&console.error(`Invalid month/year format: ${e}`),new Date(s,n,1)},N=(e,r,t)=>{let a=Date.parse(r),n=Date.parse(t);return isNaN(a)&&(a=o(r)),isNaN(n)&&(n=o(t)),!isNaN(a)&&!isNaN(n)?e?n-a:a-n:0};exports.alphaSort=i;exports.dateSort=N;exports.getTranslatedValue=p;exports.measuresMap=l;exports.numericSort=m;exports.typesMap=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),h=require("react"),m=require("@devgateway/wp-react-lib"),M=require("./CustomSemanticSearch.js"),C=require("react-dom"),N=require("semantic-ui-react"),w=require("react-intl"),v=(s,r)=>{if(!s||!r)return s||"";const c=new RegExp(`(${r})`,"gi");return s.replace(c,"<strong>$1</strong>")},y=w.injectIntl(({ID:s,title:r,slug:c,parent_title:i,parent_slug:t,parent_link:n,extract:a,type:l,link:d,terms:j,subtype:f,bread_crumbs:u=[],metadata:o,intl:{locale:S},searchTerm:x})=>{let p=n?m.utils.replaceLink(n,S)+`#${c}`:m.utils.replaceLink(d,S);const g=o==null?void 0:o.redirect_url;p=g?g+`#${c}`:p;const R=v(String(r),x),I=v(a,x);return e.jsx("div",{className:"search-results-wrapper searching-results",style:{display:"flex",flexDirection:"column"},children:e.jsxs("div",{className:"has-standard-12-font-size",onClick:P=>document.location.href=p,children:[e.jsx("h5",{className:"breadcrumbs-search",dangerouslySetInnerHTML:{__html:u&&u.length>0?v(u.join(" / "),x):""}}),e.jsx("div",{className:"has-standard-14-font-size",children:e.jsx("h4",{className:"search-title",dangerouslySetInnerHTML:{__html:R}})}),e.jsx("div",{className:"search-content",dangerouslySetInnerHTML:{__html:m.utils.replaceHTMLinks(I,S)}})]})})}),E=({results:s,meta:r,perPage:c,intl:i,searchTerm:t})=>{const n=r?r["x-wp-total"]:0;return r&&r["x-wp-totalpages"],e.jsxs("div",{id:"float-results-container",children:[e.jsx("span",{className:"float-results-header",children:i.formatMessage({id:"search.results.summary",defaultMessage:"{count} of {total} Results"},{count:n<c?n:c,total:n})}),s.map(a=>e.jsx(y,{...a,searchTerm:t},a.ID))]})},_=({onSearch:s,perPage:r,loading:c,results:i,meta:t,intl:n,searchTerm:a})=>(t&&t["x-wp-total"],t&&t["x-wp-totalpages"],e.jsx("input",{placeholder:n.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),type:"text",className:"input search",name:"search",value:a,onChange:l=>{s(l.target.value)}})),L=({onSearch:s,onSetSelected:r,perPage:c,loading:i,results:t,meta:n,locale:a,intl:l,searchTerm:d,selected:j})=>{const[f,u]=h.useState(!1),o=h.useRef(null),S=()=>{u(!1)};h.useEffect(()=>{const p=document.createElement("div");p.setAttribute("id","float-input-container"),p.setAttribute("class","input container"),p.style.display="none";const g=document.getElementById("root");return g&&(g.appendChild(p),o.current=p),()=>{o.current&&o.current.parentNode&&o.current.parentNode.removeChild(o.current)}},[]),h.useEffect(()=>{o.current&&(o.current.style.display=f?"block":"none")},[f]);const x=()=>{u(!0)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{id:"ui-float-search",className:`ui float-search${f?" ui-float-search-active":""}`,onMouseOver:x,children:e.jsx(N.Icon,{name:"search",size:"small"})}),o.current&&C.createPortal(f?e.jsxs("div",{onMouseLeave:S,children:[e.jsx("div",{className:"float-search-container",children:e.jsx(_,{onSearch:s,perPage:c,loading:i,results:t,meta:n,intl:l,searchTerm:d})}),t&&t.length>0&&e.jsx(w.IntlProvider,{locale:a,children:e.jsx(E,{results:t,meta:n,perPage:c,intl:l,searchTerm:d})})]}):null,o.current)]})},b=({onSearch:s,perPage:r,loading:c,results:i,meta:t,intl:n})=>{const a=t?t["x-wp-total"]:0,l=t?t["x-wp-totalpages"]:0,[d,j]=h.useState("");h.useEffect(()=>{const u=setTimeout(()=>{s(d)},300);return()=>clearTimeout(u)},[d]);const f=u=>e.jsx(y,{...u,searchTerm:d});return e.jsx(M.default,{value:d,loading:c,placeholder:n.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),onResultSelect:(u,o)=>null,total:a,perPage:r,totalPages:l,onSearchChange:(u,o)=>{j(o.value)},resultRenderer:f,results:i,showNoResults:!1,intl:n,searchTerm:d})},q=w.injectIntl(s=>{const{intl:r,onSetSelected:c}=s,[i,t]=h.useState(""),[n,a]=h.useState(!1);return h.useEffect(()=>{const l=()=>{a(window.innerWidth<=1365)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),e.jsx(m.SearchProvider,{search:i,perPage:5,locale:r.locale,children:e.jsx(T,{...s,onSetSelected:c,setQuery:t,query:i,isSmallScreen:n,intl:r})})}),T=({onSetSelected:s,selected:r,setQuery:c,query:i,isSmallScreen:t,intl:n,...a})=>{const l=h.useContext(m.SearchContext);return a.settings.react_search_type==="floating"||t?e.jsx(L,{onSetSelected:s,selected:r,onSearch:c,perPage:5,intl:n,...a,...l,searchTerm:i}):e.jsx(b,{onSetSelected:s,onSearch:c,perPage:5,intl:n,...a,...l})};exports.default=q;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),j=require("react-router"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),j=require("react-router"),i=require("../ResponsiveContainer.js"),r=require("@devgateway/wp-react-lib"),g=({header:o,footer:s,posts:t}={})=>{const{lan:l,slug:n,parent:u,year:a,month:c,day:d}=j.useParams();if(t){const P=typeof t=="object"?[t]:t;return e.jsx(i.default,{header:o,footer:s,children:e.jsx(r.Post,{posts:P})})}return console.log("SlugPostContainer falling back to PostProvider"),e.jsx(r.PostProvider,{type:u,slug:n,store:n,locale:l,year:a,month:c,day:d,children:e.jsx(i.default,{header:o,footer:s,children:e.jsx(r.PostConsumer,{children:e.jsx(r.Post,{})})})})};exports.default=g;
|
|
@@ -4,9 +4,9 @@ import { measuresMap as q, typesMap as G, alphaSort as K, numericSort as U, date
|
|
|
4
4
|
const H = (t) => {
|
|
5
5
|
const { data: e, measures: l, swap: m, dimensions: u, locale: v, customLabels: d } = t;
|
|
6
6
|
let i = {};
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
const
|
|
7
|
+
const h = u.filter((y) => y != ""), A = /* @__PURE__ */ new Set();
|
|
8
|
+
if (h.length == 0 && e) {
|
|
9
|
+
const y = q(e), D = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Set();
|
|
10
10
|
let E = [], j;
|
|
11
11
|
if (e.metadata && e.metadata.measures) {
|
|
12
12
|
const r = e.metadata.measures.filter((a) => l.includes(a.value)).sort((a, c) => a.position != null && c.position != null && a.position != c.position ? a.position - c.position : 0);
|
|
@@ -15,8 +15,9 @@ const H = (t) => {
|
|
|
15
15
|
Object.keys(e).forEach((a) => {
|
|
16
16
|
S[a] = e[a];
|
|
17
17
|
}), r.forEach((a) => {
|
|
18
|
-
const c = {}, L = d[a.value] || V(
|
|
19
|
-
|
|
18
|
+
const c = {}, L = d[a.value] || V(y[a.value], v);
|
|
19
|
+
debugger;
|
|
20
|
+
c.type = "measure", c.measureFieldName = a.value, c.measure = L, c[L] = e[a.value], c.variables = S, E.push(c), R.add(L), A.add(y[a.value]);
|
|
20
21
|
}), i = {
|
|
21
22
|
categories: D,
|
|
22
23
|
indexBy: j,
|
|
@@ -39,8 +40,8 @@ const H = (t) => {
|
|
|
39
40
|
} else m.length == 2 && e.children && e.children.forEach((v) => {
|
|
40
41
|
if (!(v.children.filter((i) => i.value == u).length > 0)) {
|
|
41
42
|
const i = {};
|
|
42
|
-
i.type = m[1], i.value = u, i.label = u, Object.keys(v).forEach((
|
|
43
|
-
["children", "metadata", "type", "value"].includes(
|
|
43
|
+
i.type = m[1], i.value = u, i.label = u, Object.keys(v).forEach((h) => {
|
|
44
|
+
["children", "metadata", "type", "value"].includes(h) || (i[h] = v[h]);
|
|
44
45
|
}), v.children = [i, ...v.children];
|
|
45
46
|
}
|
|
46
47
|
});
|
|
@@ -55,23 +56,25 @@ const H = (t) => {
|
|
|
55
56
|
dimensions: v,
|
|
56
57
|
includeOverall: d,
|
|
57
58
|
locale: i,
|
|
58
|
-
customLabels:
|
|
59
|
+
customLabels: h,
|
|
59
60
|
colorBy: A,
|
|
60
|
-
hiddenBars:
|
|
61
|
+
hiddenBars: y
|
|
61
62
|
} = t, D = v.filter((r) => r != "");
|
|
62
63
|
if (l.metadata.measures.filter((r) => m.includes(r.value)).sort((r, S) => r.position != null && S.position != null && r.position != S.position ? r.position - S.position : 0), d && m.length == 1 && P(t), D.length == 0 && l)
|
|
63
64
|
e = H(t);
|
|
64
65
|
else if (l && l.children && l.children.length > 0 && D.length > 0) {
|
|
65
66
|
const r = q(l), S = G(l), a = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Set(), O = [], B = l.children[0].type, x = ((j = (E = (R = l == null ? void 0 : l.metadata) == null ? void 0 : R.types) == null ? void 0 : E.find((o) => o.dimension == D[0])) == null ? void 0 : j.items) || [];
|
|
66
67
|
t.sort == "alphabetically" ? x.sort(
|
|
67
|
-
(o,
|
|
68
|
+
(o, g) => K(t.sortReverse, i, o.value, g.value)
|
|
68
69
|
) : t.sort == "values" ? x.sort(
|
|
69
|
-
(o,
|
|
70
|
+
(o, g) => U(t.sortReverse, o.value, g.value)
|
|
70
71
|
) : t.sort == "date" && x.sort(
|
|
71
|
-
(o,
|
|
72
|
+
(o, g) => T(t.sortReverse, o.value, g.value)
|
|
72
73
|
), m.forEach((o) => {
|
|
73
|
-
const
|
|
74
|
-
|
|
74
|
+
const g = { variables: {} };
|
|
75
|
+
g.id = V(r[o], i);
|
|
76
|
+
debugger;
|
|
77
|
+
g.label = h[o] || V(r[o], i);
|
|
75
78
|
const N = [];
|
|
76
79
|
x.forEach((s) => {
|
|
77
80
|
const n = l.children.find((f) => f.value === s.value);
|
|
@@ -79,12 +82,12 @@ const H = (t) => {
|
|
|
79
82
|
const f = {};
|
|
80
83
|
Object.keys(n).forEach((C) => {
|
|
81
84
|
f[C] = n[C];
|
|
82
|
-
}), f.value = n[o], f[n.type] = n.value.toString(), c.add(S[n.type]), N.push({ x: n.value, y: n[o], variables: f }),
|
|
85
|
+
}), f.value = n[o], f[n.type] = n.value.toString(), c.add(S[n.type]), N.push({ x: n.value, y: n[o], variables: f }), g.data = N;
|
|
83
86
|
}
|
|
84
|
-
}), O.push(
|
|
87
|
+
}), O.push(g);
|
|
85
88
|
});
|
|
86
89
|
const k = Array.from(M);
|
|
87
|
-
let I = (
|
|
90
|
+
let I = (y == null ? void 0 : y.length) > 0 && (O == null ? void 0 : O.length) > 0 ? O.filter((o) => y.indexOf(o[B]) == -1) : O;
|
|
88
91
|
e = {
|
|
89
92
|
metadata: l.metadata,
|
|
90
93
|
indexBy: B,
|
|
@@ -100,7 +103,7 @@ const H = (t) => {
|
|
|
100
103
|
(r) => F.cloneElement(r, { options: e })
|
|
101
104
|
);
|
|
102
105
|
}, X = (t) => {
|
|
103
|
-
var
|
|
106
|
+
var y, D, R, E, j, r, S;
|
|
104
107
|
const {
|
|
105
108
|
data: e,
|
|
106
109
|
measures: l,
|
|
@@ -109,12 +112,12 @@ const H = (t) => {
|
|
|
109
112
|
hiddenBars: v,
|
|
110
113
|
colorBy: d,
|
|
111
114
|
locale: i
|
|
112
|
-
} = t,
|
|
115
|
+
} = t, h = u.filter((a) => a != "");
|
|
113
116
|
let A = {};
|
|
114
|
-
if (m && P(t),
|
|
117
|
+
if (m && P(t), h.length == 0 && e)
|
|
115
118
|
A = H(t);
|
|
116
|
-
else if (e && e.children && e.children.length > 0 &&
|
|
117
|
-
const a = q(e), c = G(e), L = l[0], M = /* @__PURE__ */ new Set(), O = /* @__PURE__ */ new Set(), B = [], x = [], k = (
|
|
119
|
+
else if (e && e.children && e.children.length > 0 && h.length > 0) {
|
|
120
|
+
const a = q(e), c = G(e), L = l[0], M = /* @__PURE__ */ new Set(), O = /* @__PURE__ */ new Set(), B = [], x = [], k = (y = e.children[0]) == null ? void 0 : y.type, I = ((E = (R = (D = e == null ? void 0 : e.metadata) == null ? void 0 : D.types) == null ? void 0 : R.find((s) => s.dimension == h[0])) == null ? void 0 : E.items) || [], o = ((S = (r = (j = e == null ? void 0 : e.metadata) == null ? void 0 : j.types) == null ? void 0 : r.find((s) => s.dimension == h[1])) == null ? void 0 : S.items) || [];
|
|
118
121
|
t.sortSecondDimension == "alphabetically" ? o.sort(
|
|
119
122
|
(s, n) => K(t.sortReverseSecondDimension, i, s.value, n.value)
|
|
120
123
|
) : t.sortSecondDimension == "date" && o.sort(
|
|
@@ -142,14 +145,14 @@ const H = (t) => {
|
|
|
142
145
|
}), x.forEach((s) => {
|
|
143
146
|
s.data.sort((n, f) => t.sort == "alphabetically" ? K(t.sortReverse, i, n.x, f.x) : t.sort == "date" ? T(t.sortReverse, n.x, f.x) : 0);
|
|
144
147
|
});
|
|
145
|
-
const
|
|
148
|
+
const g = d == "id" ? x : x.filter((s) => v.indexOf(s[k]) == -1), N = [...B];
|
|
146
149
|
A = {
|
|
147
150
|
metadata: e.metadata,
|
|
148
151
|
dimensionsMetadata: M,
|
|
149
152
|
measuresMetadata: O,
|
|
150
153
|
indexBy: k,
|
|
151
154
|
keys: d == "index" ? N : N.filter((s) => v.indexOf(s) == -1),
|
|
152
|
-
data:
|
|
155
|
+
data: g
|
|
153
156
|
};
|
|
154
157
|
}
|
|
155
158
|
return /* @__PURE__ */ J(Q, { children: F.Children.map(
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
const u = (e) => e == null ? void 0 : e.map((t) => {
|
|
2
2
|
const a = t.group.label;
|
|
3
|
+
debugger;
|
|
3
4
|
return t.label.includes(a) ? t : {
|
|
4
5
|
...t,
|
|
5
|
-
label: `${
|
|
6
|
+
//label: `${groupName} - ${item.label}`,
|
|
7
|
+
label: `${t.label}`
|
|
6
8
|
};
|
|
7
9
|
}), l = (e) => {
|
|
8
10
|
const { metadata: r } = e || {}, t = {}, a = u((r == null ? void 0 : r.measures) || []);
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { utils as x, SearchProvider as
|
|
4
|
-
import
|
|
5
|
-
import { createPortal as
|
|
1
|
+
import { jsx as t, jsxs as S, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useState as v, useEffect as w, useContext as _, useRef as E } from "react";
|
|
3
|
+
import { utils as x, SearchProvider as T, SearchContext as b } from "@devgateway/wp-react-lib";
|
|
4
|
+
import z from "./CustomSemanticSearch.js";
|
|
5
|
+
import { createPortal as P } from "react-dom";
|
|
6
6
|
import { Icon as F } from "semantic-ui-react";
|
|
7
|
-
import { injectIntl as
|
|
8
|
-
const
|
|
9
|
-
if (!
|
|
7
|
+
import { injectIntl as I, IntlProvider as $ } from "react-intl";
|
|
8
|
+
const C = (n, s) => {
|
|
9
|
+
if (!n || !s) return n || "";
|
|
10
10
|
const o = new RegExp(`(${s})`, "gi");
|
|
11
|
-
return
|
|
12
|
-
},
|
|
11
|
+
return n.replace(o, "<strong>$1</strong>");
|
|
12
|
+
}, N = I(
|
|
13
13
|
({
|
|
14
|
-
ID:
|
|
14
|
+
ID: n,
|
|
15
15
|
title: s,
|
|
16
16
|
slug: o,
|
|
17
17
|
parent_title: i,
|
|
18
18
|
parent_slug: e,
|
|
19
|
-
parent_link:
|
|
19
|
+
parent_link: r,
|
|
20
20
|
extract: a,
|
|
21
|
-
type:
|
|
22
|
-
link:
|
|
23
|
-
terms:
|
|
21
|
+
type: l,
|
|
22
|
+
link: d,
|
|
23
|
+
terms: y,
|
|
24
24
|
subtype: p,
|
|
25
|
-
bread_crumbs:
|
|
26
|
-
metadata:
|
|
27
|
-
intl: { locale:
|
|
25
|
+
bread_crumbs: u = [],
|
|
26
|
+
metadata: c,
|
|
27
|
+
intl: { locale: m },
|
|
28
28
|
searchTerm: g
|
|
29
29
|
// Added searchTerm prop
|
|
30
30
|
}) => {
|
|
31
|
-
let
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const
|
|
31
|
+
let h = r ? x.replaceLink(r, m) + `#${o}` : x.replaceLink(d, m);
|
|
32
|
+
const f = c == null ? void 0 : c.redirect_url;
|
|
33
|
+
h = f ? f + `#${o}` : h;
|
|
34
|
+
const M = C(String(s), g), R = C(a, g);
|
|
35
35
|
return /* @__PURE__ */ t(
|
|
36
36
|
"div",
|
|
37
37
|
{
|
|
38
38
|
className: "search-results-wrapper searching-results",
|
|
39
39
|
style: { display: "flex", flexDirection: "column" },
|
|
40
|
-
children: /* @__PURE__ */
|
|
40
|
+
children: /* @__PURE__ */ S(
|
|
41
41
|
"div",
|
|
42
42
|
{
|
|
43
43
|
className: "has-standard-12-font-size",
|
|
44
|
-
onClick: (
|
|
44
|
+
onClick: (q) => document.location.href = h,
|
|
45
45
|
children: [
|
|
46
46
|
/* @__PURE__ */ t(
|
|
47
47
|
"h5",
|
|
48
48
|
{
|
|
49
49
|
className: "breadcrumbs-search",
|
|
50
50
|
dangerouslySetInnerHTML: {
|
|
51
|
-
__html:
|
|
51
|
+
__html: u && u.length > 0 ? C(u.join(" / "), g) : ""
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
),
|
|
@@ -57,7 +57,7 @@ const I = (r, s) => {
|
|
|
57
57
|
{
|
|
58
58
|
className: "search-title",
|
|
59
59
|
dangerouslySetInnerHTML: {
|
|
60
|
-
__html:
|
|
60
|
+
__html: M
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
) }),
|
|
@@ -66,7 +66,7 @@ const I = (r, s) => {
|
|
|
66
66
|
{
|
|
67
67
|
className: "search-content",
|
|
68
68
|
dangerouslySetInnerHTML: {
|
|
69
|
-
__html: x.replaceHTMLinks(
|
|
69
|
+
__html: x.replaceHTMLinks(R, m)
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
)
|
|
@@ -76,193 +76,183 @@ const I = (r, s) => {
|
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
|
-
),
|
|
80
|
-
const
|
|
81
|
-
return s && s["x-wp-totalpages"], /* @__PURE__ */
|
|
79
|
+
), j = ({ results: n, meta: s, perPage: o, intl: i, searchTerm: e }) => {
|
|
80
|
+
const r = s ? s["x-wp-total"] : 0;
|
|
81
|
+
return s && s["x-wp-totalpages"], /* @__PURE__ */ S("div", { id: "float-results-container", children: [
|
|
82
82
|
/* @__PURE__ */ t("span", { className: "float-results-header", children: i.formatMessage(
|
|
83
83
|
{
|
|
84
84
|
id: "search.results.summary",
|
|
85
85
|
defaultMessage: "{count} of {total} Results"
|
|
86
86
|
},
|
|
87
|
-
{ count:
|
|
87
|
+
{ count: r < o ? r : o, total: r }
|
|
88
88
|
) }),
|
|
89
|
-
|
|
89
|
+
n.map((a) => /* @__PURE__ */ t(N, { ...a, searchTerm: e }, a.ID))
|
|
90
90
|
] });
|
|
91
|
-
},
|
|
92
|
-
onSearch:
|
|
91
|
+
}, k = ({
|
|
92
|
+
onSearch: n,
|
|
93
93
|
perPage: s,
|
|
94
94
|
loading: o,
|
|
95
95
|
results: i,
|
|
96
96
|
meta: e,
|
|
97
|
-
intl:
|
|
97
|
+
intl: r,
|
|
98
|
+
searchTerm: a
|
|
98
99
|
}) => (e && e["x-wp-total"], e && e["x-wp-totalpages"], /* @__PURE__ */ t(
|
|
99
100
|
"input",
|
|
100
101
|
{
|
|
101
|
-
placeholder:
|
|
102
|
+
placeholder: r.formatMessage({
|
|
102
103
|
id: "search.placeholder",
|
|
103
104
|
defaultMessage: "Search..."
|
|
104
105
|
}),
|
|
105
106
|
type: "text",
|
|
106
107
|
className: "input search",
|
|
107
108
|
name: "search",
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
value: a,
|
|
110
|
+
onChange: (l) => {
|
|
111
|
+
n(l.target.value);
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
|
-
)),
|
|
113
|
-
onSearch:
|
|
114
|
+
)), D = ({
|
|
115
|
+
onSearch: n,
|
|
114
116
|
onSetSelected: s,
|
|
115
117
|
perPage: o,
|
|
116
118
|
loading: i,
|
|
117
119
|
results: e,
|
|
118
|
-
meta:
|
|
120
|
+
meta: r,
|
|
119
121
|
locale: a,
|
|
120
|
-
intl:
|
|
121
|
-
searchTerm:
|
|
122
|
+
intl: l,
|
|
123
|
+
searchTerm: d,
|
|
122
124
|
// Added search from SearchConsumer
|
|
123
|
-
selected:
|
|
125
|
+
selected: y
|
|
124
126
|
// Added selected prop to track menu selection
|
|
125
127
|
}) => {
|
|
126
|
-
const [p,
|
|
127
|
-
|
|
128
|
-
}, g = () => {
|
|
129
|
-
const c = document.getElementsByClassName("has-child-items");
|
|
130
|
-
for (let u = 0; u < c.length; u++) {
|
|
131
|
-
const v = c[u].getElementsByTagName("span");
|
|
132
|
-
v.length > 0 && v[0].addEventListener("mouseover", f);
|
|
133
|
-
}
|
|
134
|
-
}, S = () => {
|
|
135
|
-
const c = document.getElementsByClassName("has-child-items");
|
|
136
|
-
for (let u = 0; u < c.length; u++) {
|
|
137
|
-
const v = c[u].getElementsByTagName("span");
|
|
138
|
-
v.length > 0 && v[0].removeEventListener("mouseover", f);
|
|
139
|
-
}
|
|
128
|
+
const [p, u] = v(!1), c = E(null), m = () => {
|
|
129
|
+
u(!1);
|
|
140
130
|
};
|
|
141
|
-
return
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
const
|
|
145
|
-
return
|
|
146
|
-
|
|
131
|
+
return w(() => {
|
|
132
|
+
const h = document.createElement("div");
|
|
133
|
+
h.setAttribute("id", "float-input-container"), h.setAttribute("class", "input container"), h.style.display = "none";
|
|
134
|
+
const f = document.getElementById("root");
|
|
135
|
+
return f && (f.appendChild(h), c.current = h), () => {
|
|
136
|
+
c.current && c.current.parentNode && c.current.parentNode.removeChild(c.current);
|
|
147
137
|
};
|
|
148
|
-
}, []),
|
|
149
|
-
|
|
150
|
-
}, [p]), /* @__PURE__ */
|
|
138
|
+
}, []), w(() => {
|
|
139
|
+
c.current && (c.current.style.display = p ? "block" : "none");
|
|
140
|
+
}, [p]), /* @__PURE__ */ S(L, { children: [
|
|
151
141
|
/* @__PURE__ */ t(
|
|
152
142
|
"div",
|
|
153
143
|
{
|
|
154
144
|
id: "ui-float-search",
|
|
155
|
-
className:
|
|
145
|
+
className: `ui float-search${p ? " ui-float-search-active" : ""}`,
|
|
156
146
|
onMouseOver: () => {
|
|
157
|
-
|
|
147
|
+
u(!0);
|
|
158
148
|
},
|
|
159
149
|
children: /* @__PURE__ */ t(F, { name: "search", size: "small" })
|
|
160
150
|
}
|
|
161
151
|
),
|
|
162
|
-
|
|
163
|
-
p ? /* @__PURE__ */
|
|
152
|
+
c.current && P(
|
|
153
|
+
p ? /* @__PURE__ */ S("div", { onMouseLeave: m, children: [
|
|
164
154
|
/* @__PURE__ */ t("div", { className: "float-search-container", children: /* @__PURE__ */ t(
|
|
165
|
-
|
|
155
|
+
k,
|
|
166
156
|
{
|
|
167
|
-
onSearch:
|
|
157
|
+
onSearch: n,
|
|
168
158
|
perPage: o,
|
|
169
159
|
loading: i,
|
|
170
160
|
results: e,
|
|
171
|
-
meta:
|
|
172
|
-
intl:
|
|
173
|
-
searchTerm:
|
|
161
|
+
meta: r,
|
|
162
|
+
intl: l,
|
|
163
|
+
searchTerm: d
|
|
174
164
|
}
|
|
175
165
|
) }),
|
|
176
|
-
e && e.length > 0 && /* @__PURE__ */ t(
|
|
177
|
-
|
|
166
|
+
e && e.length > 0 && /* @__PURE__ */ t($, { locale: a, children: /* @__PURE__ */ t(
|
|
167
|
+
j,
|
|
178
168
|
{
|
|
179
169
|
results: e,
|
|
180
|
-
meta:
|
|
170
|
+
meta: r,
|
|
181
171
|
perPage: o,
|
|
182
|
-
intl:
|
|
183
|
-
searchTerm:
|
|
172
|
+
intl: l,
|
|
173
|
+
searchTerm: d
|
|
184
174
|
}
|
|
185
175
|
) })
|
|
186
176
|
] }) : null,
|
|
187
|
-
|
|
177
|
+
c.current
|
|
188
178
|
)
|
|
189
179
|
] });
|
|
190
|
-
},
|
|
191
|
-
const a = e ? e["x-wp-total"] : 0,
|
|
192
|
-
|
|
193
|
-
const
|
|
194
|
-
|
|
180
|
+
}, H = ({ onSearch: n, perPage: s, loading: o, results: i, meta: e, intl: r }) => {
|
|
181
|
+
const a = e ? e["x-wp-total"] : 0, l = e ? e["x-wp-totalpages"] : 0, [d, y] = v("");
|
|
182
|
+
w(() => {
|
|
183
|
+
const u = setTimeout(() => {
|
|
184
|
+
n(d);
|
|
195
185
|
}, 300);
|
|
196
|
-
return () => clearTimeout(
|
|
197
|
-
}, [
|
|
198
|
-
const p = (
|
|
186
|
+
return () => clearTimeout(u);
|
|
187
|
+
}, [d]);
|
|
188
|
+
const p = (u) => /* @__PURE__ */ t(N, { ...u, searchTerm: d });
|
|
199
189
|
return /* @__PURE__ */ t(
|
|
200
|
-
|
|
190
|
+
z,
|
|
201
191
|
{
|
|
202
|
-
value:
|
|
192
|
+
value: d,
|
|
203
193
|
loading: o,
|
|
204
|
-
placeholder:
|
|
194
|
+
placeholder: r.formatMessage({
|
|
205
195
|
id: "search.placeholder",
|
|
206
196
|
defaultMessage: "Search..."
|
|
207
197
|
}),
|
|
208
|
-
onResultSelect: (
|
|
198
|
+
onResultSelect: (u, c) => null,
|
|
209
199
|
total: a,
|
|
210
200
|
perPage: s,
|
|
211
|
-
totalPages:
|
|
212
|
-
onSearchChange: (
|
|
213
|
-
|
|
201
|
+
totalPages: l,
|
|
202
|
+
onSearchChange: (u, c) => {
|
|
203
|
+
y(c.value);
|
|
214
204
|
},
|
|
215
205
|
resultRenderer: p,
|
|
216
206
|
results: i,
|
|
217
207
|
showNoResults: !1,
|
|
218
|
-
intl:
|
|
219
|
-
searchTerm:
|
|
208
|
+
intl: r,
|
|
209
|
+
searchTerm: d
|
|
220
210
|
}
|
|
221
211
|
);
|
|
222
|
-
},
|
|
223
|
-
const { intl: s, onSetSelected: o } =
|
|
224
|
-
return
|
|
225
|
-
const
|
|
212
|
+
}, U = I((n) => {
|
|
213
|
+
const { intl: s, onSetSelected: o } = n, [i, e] = v(""), [r, a] = v(!1);
|
|
214
|
+
return w(() => {
|
|
215
|
+
const l = () => {
|
|
226
216
|
a(window.innerWidth <= 1365);
|
|
227
217
|
};
|
|
228
|
-
return
|
|
229
|
-
}, []), /* @__PURE__ */ t(
|
|
218
|
+
return l(), window.addEventListener("resize", l), () => window.removeEventListener("resize", l);
|
|
219
|
+
}, []), /* @__PURE__ */ t(T, { search: i, perPage: 5, locale: s.locale, children: /* @__PURE__ */ t(
|
|
230
220
|
A,
|
|
231
221
|
{
|
|
232
|
-
...
|
|
222
|
+
...n,
|
|
233
223
|
onSetSelected: o,
|
|
234
224
|
setQuery: e,
|
|
235
225
|
query: i,
|
|
236
|
-
isSmallScreen:
|
|
226
|
+
isSmallScreen: r,
|
|
237
227
|
intl: s
|
|
238
228
|
}
|
|
239
229
|
) });
|
|
240
|
-
}), A = ({ onSetSelected:
|
|
241
|
-
const
|
|
230
|
+
}), A = ({ onSetSelected: n, selected: s, setQuery: o, query: i, isSmallScreen: e, intl: r, ...a }) => {
|
|
231
|
+
const l = _(b);
|
|
242
232
|
return a.settings.react_search_type === "floating" || e ? /* @__PURE__ */ t(
|
|
243
|
-
|
|
233
|
+
D,
|
|
244
234
|
{
|
|
245
|
-
onSetSelected:
|
|
235
|
+
onSetSelected: n,
|
|
246
236
|
selected: s,
|
|
247
237
|
onSearch: o,
|
|
248
238
|
perPage: 5,
|
|
249
|
-
intl:
|
|
239
|
+
intl: r,
|
|
250
240
|
...a,
|
|
251
|
-
...
|
|
241
|
+
...l,
|
|
252
242
|
searchTerm: i
|
|
253
243
|
}
|
|
254
244
|
) : /* @__PURE__ */ t(
|
|
255
|
-
|
|
245
|
+
H,
|
|
256
246
|
{
|
|
257
|
-
onSetSelected:
|
|
247
|
+
onSetSelected: n,
|
|
258
248
|
onSearch: o,
|
|
259
249
|
perPage: 5,
|
|
260
|
-
intl:
|
|
250
|
+
intl: r,
|
|
261
251
|
...a,
|
|
262
|
-
...
|
|
252
|
+
...l
|
|
263
253
|
}
|
|
264
254
|
);
|
|
265
255
|
};
|
|
266
256
|
export {
|
|
267
|
-
|
|
257
|
+
U as default
|
|
268
258
|
};
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useParams as P } from "react-router";
|
|
3
|
-
import
|
|
4
|
-
import { Post as
|
|
3
|
+
import s from "../ResponsiveContainer.js";
|
|
4
|
+
import { Post as i, PostProvider as u, PostConsumer as f } from "@devgateway/wp-react-lib";
|
|
5
5
|
const v = ({ header: e, footer: t, posts: r } = {}) => {
|
|
6
|
-
const { lan:
|
|
7
|
-
return r ? /* @__PURE__ */ o(
|
|
8
|
-
|
|
6
|
+
const { lan: l, slug: n, parent: a, year: c, month: d, day: m } = P();
|
|
7
|
+
return r ? /* @__PURE__ */ o(s, { header: e, footer: t, children: /* @__PURE__ */ o(i, { posts: typeof r == "object" ? [r] : r }) }) : (console.log("SlugPostContainer falling back to PostProvider"), /* @__PURE__ */ o(
|
|
8
|
+
u,
|
|
9
9
|
{
|
|
10
|
-
type:
|
|
10
|
+
type: a,
|
|
11
11
|
slug: n,
|
|
12
12
|
store: n,
|
|
13
|
-
locale:
|
|
14
|
-
type: s,
|
|
13
|
+
locale: l,
|
|
15
14
|
year: c,
|
|
16
15
|
month: d,
|
|
17
16
|
day: m,
|
|
18
|
-
children: /* @__PURE__ */ o(
|
|
17
|
+
children: /* @__PURE__ */ o(s, { header: e, footer: t, children: /* @__PURE__ */ o(f, { children: /* @__PURE__ */ o(i, {}) }) })
|
|
19
18
|
}
|
|
20
19
|
));
|
|
21
20
|
};
|