@devgateway/dvz-ui-react 1.7.2 → 1.7.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/index.js +1 -1
- package/dist/cjs/embeddable/filtered-posts/index.js +1 -1
- package/dist/cjs/embeddable/posts-pagination/index.js +1 -1
- package/dist/cjs/embeddable/reducers/data.js +1 -1
- package/dist/esm/embeddable/chart/index.js +414 -414
- package/dist/esm/embeddable/filtered-posts/index.js +76 -76
- package/dist/esm/embeddable/posts-pagination/index.js +41 -35
- package/dist/esm/embeddable/reducers/data.js +108 -96
- package/package.json +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { Container as
|
|
4
|
-
import
|
|
5
|
-
import { injectIntl as
|
|
6
|
-
import { getStartDateAndEndDateFromYear as
|
|
7
|
-
import
|
|
8
|
-
import { useDispatch as
|
|
9
|
-
import { getCustomPosts as
|
|
10
|
-
import { useParams as
|
|
11
|
-
import { toNumber as
|
|
12
|
-
const
|
|
13
|
-
const { posts:
|
|
14
|
-
if (
|
|
15
|
-
const m =
|
|
16
|
-
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import X, { useState as w, useRef as Z, useEffect as tt } from "react";
|
|
3
|
+
import { Container as B, Loader as et, Grid as Y, GridRow as ot } from "semantic-ui-react";
|
|
4
|
+
import rt from "../connected-templates/PostIntro.js";
|
|
5
|
+
import { injectIntl as nt } from "react-intl";
|
|
6
|
+
import { getStartDateAndEndDateFromYear as j } from "./utils.js";
|
|
7
|
+
import at from "./NoData.js";
|
|
8
|
+
import { useDispatch as st, useSelector as it } from "react-redux";
|
|
9
|
+
import { getCustomPosts as lt } from "../reducers/data-api.js";
|
|
10
|
+
import { useParams as ut } from "react-router";
|
|
11
|
+
import { toNumber as ct, toBoolean as mt } from "../../utils/data.js";
|
|
12
|
+
const dt = (F) => {
|
|
13
|
+
const { posts: l, numberOfColumns: T, sortFirstBy: c, countryCategory: u, postWidth: h, postHeight: A } = F, d = [];
|
|
14
|
+
if (u && c && c !== "none") {
|
|
15
|
+
const m = l.filter((y) => y[u].includes(Number(c))), b = l.filter((y) => !y[u].includes(Number(c)));
|
|
16
|
+
d.push(...m), d.push(...b);
|
|
17
17
|
} else
|
|
18
|
-
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
|
|
18
|
+
d.push(...l);
|
|
19
|
+
return /* @__PURE__ */ s(Y, { className: "filtered-posts", columns: T, children: /* @__PURE__ */ s(ot, { children: d.map((m) => /* @__PURE__ */ s(Y.Column, { children: /* @__PURE__ */ s("div", { className: "filtered-posts-column", style: { width: h, height: A, overflow: "hidden" }, children: /* @__PURE__ */ s(
|
|
20
|
+
rt,
|
|
21
21
|
{
|
|
22
22
|
style: {
|
|
23
23
|
width: "100%",
|
|
@@ -26,35 +26,35 @@ const lt = (T) => {
|
|
|
26
26
|
margin: 0,
|
|
27
27
|
padding: 0
|
|
28
28
|
},
|
|
29
|
-
as:
|
|
29
|
+
as: B,
|
|
30
30
|
fluid: !0,
|
|
31
31
|
post: m
|
|
32
32
|
},
|
|
33
33
|
m.id
|
|
34
34
|
) }) }, m.id)) }) });
|
|
35
|
-
},
|
|
35
|
+
}, ft = (F) => {
|
|
36
36
|
const {
|
|
37
|
-
"data-group":
|
|
38
|
-
"data-number-of-columns":
|
|
37
|
+
"data-group": l,
|
|
38
|
+
"data-number-of-columns": T,
|
|
39
39
|
"data-type": c,
|
|
40
|
-
"data-taxonomy":
|
|
40
|
+
"data-taxonomy": u,
|
|
41
41
|
"data-categories": h,
|
|
42
|
-
"data-height":
|
|
43
|
-
"data-post-width":
|
|
42
|
+
"data-height": A,
|
|
43
|
+
"data-post-width": d,
|
|
44
44
|
"data-post-height": m,
|
|
45
|
-
"data-number-of-items-per-page":
|
|
45
|
+
"data-number-of-items-per-page": b,
|
|
46
46
|
"data-enable-sorting": y,
|
|
47
|
-
"data-sort-first-by":
|
|
48
|
-
"data-sorting-taxonomy":
|
|
49
|
-
editing:
|
|
50
|
-
} =
|
|
47
|
+
"data-sort-first-by": I,
|
|
48
|
+
"data-sorting-taxonomy": O,
|
|
49
|
+
editing: M
|
|
50
|
+
} = F, z = st(), { locale: W } = ut(), [R, x] = w(!1), _ = it((t) => t).getIn(["data", "posts", l]), [C, N] = w([]), E = Z(null), [P, G] = w(void 0), J = mt(y) && I !== "none" ? ct(I) : null, f = _ ?? {
|
|
51
51
|
yearFilter: null,
|
|
52
52
|
categoryFilter: null,
|
|
53
53
|
countryFilter: null,
|
|
54
54
|
page: 1,
|
|
55
55
|
countryTaxonomy: null,
|
|
56
56
|
categoryTaxonomy: null
|
|
57
|
-
},
|
|
57
|
+
}, v = (t) => {
|
|
58
58
|
if (t == null)
|
|
59
59
|
return { values: [], isExplicitNone: !1 };
|
|
60
60
|
const e = Array.isArray(t) ? t : [t], a = e.some(
|
|
@@ -64,19 +64,19 @@ const lt = (T) => {
|
|
|
64
64
|
values: e.map((o) => Number(o)).filter((o) => Number.isFinite(o) && o !== Number.MIN_SAFE_INTEGER),
|
|
65
65
|
isExplicitNone: a
|
|
66
66
|
};
|
|
67
|
-
},
|
|
67
|
+
}, L = (t) => {
|
|
68
68
|
if (!t || t.length === 0)
|
|
69
69
|
return null;
|
|
70
|
-
const e = Array.from(new Set(t)).sort((S,
|
|
70
|
+
const e = Array.from(new Set(t)).sort((S, D) => S - D);
|
|
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 = j(a), n = j(r);
|
|
74
74
|
return !(o != null && o.startDate) || !(n != null && n.endDate) ? null : {
|
|
75
75
|
startDate: o.startDate,
|
|
76
76
|
endDate: n.endDate
|
|
77
77
|
};
|
|
78
|
-
},
|
|
79
|
-
const t =
|
|
78
|
+
}, q = () => {
|
|
79
|
+
const t = v(f.yearFilter), e = t.isExplicitNone ? null : L(t.values), a = f.countryFilter ?? null, r = f.categoryFilter ?? null, o = f.categoryTaxonomy || (u && u !== "none" ? u : null), n = f.countryTaxonomy || null;
|
|
80
80
|
return {
|
|
81
81
|
before: (e == null ? void 0 : e.endDate) || null,
|
|
82
82
|
after: (e == null ? void 0 : e.startDate) || null,
|
|
@@ -85,44 +85,44 @@ const lt = (T) => {
|
|
|
85
85
|
countryFilter: a,
|
|
86
86
|
countryTaxonomy: n
|
|
87
87
|
};
|
|
88
|
-
},
|
|
88
|
+
}, H = (t) => M ? t : decodeURIComponent(t), U = (t) => {
|
|
89
89
|
try {
|
|
90
|
-
return JSON.parse(
|
|
90
|
+
return JSON.parse(H(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), H(t);
|
|
93
93
|
}
|
|
94
|
-
},
|
|
95
|
-
const t =
|
|
94
|
+
}, $ = () => {
|
|
95
|
+
const t = U(h);
|
|
96
96
|
return t ? typeof t == "string" ? t.split(",").map(Number) : typeof t == "number" ? [t] : t : [];
|
|
97
|
-
},
|
|
97
|
+
}, k = (t, e, a) => {
|
|
98
98
|
if (a) return null;
|
|
99
99
|
if (t.length === 0) return e.length > 0 ? e : null;
|
|
100
100
|
if (e.length === 0) return t;
|
|
101
101
|
const r = new Set(t), o = e.filter((n) => r.has(n));
|
|
102
102
|
return o.length > 0 ? o : null;
|
|
103
|
-
},
|
|
104
|
-
|
|
105
|
-
const t =
|
|
103
|
+
}, K = async () => {
|
|
104
|
+
E.current && G(E.current.offsetHeight), x(!0);
|
|
105
|
+
const t = q(), e = v($()).values, a = v(t.categoryFilter), r = k(
|
|
106
106
|
e,
|
|
107
107
|
a.values,
|
|
108
108
|
a.isExplicitNone
|
|
109
|
-
), o =
|
|
109
|
+
), o = v(t.countryFilter);
|
|
110
110
|
if (a.isExplicitNone) {
|
|
111
|
-
|
|
111
|
+
N([]), x(!1);
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
if (o.isExplicitNone) {
|
|
115
|
-
|
|
115
|
+
N([]), x(!1);
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
const n = /* @__PURE__ */ new Map();
|
|
119
119
|
t.categoryTaxonomy && r && r.length > 0 && n.set(t.categoryTaxonomy, r), t.countryTaxonomy && o.values.length > 0 && n.set(t.countryTaxonomy, o.values);
|
|
120
|
-
const S = r ? r.join(",") : void 0,
|
|
120
|
+
const S = r ? r.join(",") : void 0, D = {
|
|
121
121
|
after: t.after,
|
|
122
122
|
before: t.before,
|
|
123
|
-
perPage: Number(
|
|
124
|
-
page:
|
|
125
|
-
locale:
|
|
123
|
+
perPage: Number(b || 10),
|
|
124
|
+
page: f.page || 1,
|
|
125
|
+
locale: W || "en",
|
|
126
126
|
postType: c,
|
|
127
127
|
taxonomy: t.categoryTaxonomy || void 0,
|
|
128
128
|
category: S || void 0,
|
|
@@ -130,38 +130,38 @@ const lt = (T) => {
|
|
|
130
130
|
ordering: "date",
|
|
131
131
|
orderingDirection: "desc"
|
|
132
132
|
};
|
|
133
|
-
await
|
|
134
|
-
if (
|
|
135
|
-
let p = null,
|
|
136
|
-
if (
|
|
137
|
-
const
|
|
138
|
-
|
|
133
|
+
await lt(D).then((i) => {
|
|
134
|
+
if (i) {
|
|
135
|
+
let p = null, g = null;
|
|
136
|
+
if (i && typeof i == "object" && "data" in i ? (p = i.data, g = i.meta) : (Array.isArray(i), p = i), N(Array.isArray(p) ? p : []), g) {
|
|
137
|
+
const V = g["x-wp-totalpages"] ? g["x-wp-totalpages"] : 1, Q = g["x-wp-total"] ? g["x-wp-total"] : 0;
|
|
138
|
+
V && z({
|
|
139
139
|
type: "SET_POSTS_PAGINATION",
|
|
140
|
-
group:
|
|
141
|
-
totalPages: Number(
|
|
142
|
-
totalItems: Number(
|
|
140
|
+
group: l,
|
|
141
|
+
totalPages: Number(V),
|
|
142
|
+
totalItems: Number(Q)
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
} else
|
|
146
|
-
|
|
146
|
+
N([]);
|
|
147
147
|
}).finally(() => {
|
|
148
|
-
|
|
148
|
+
x(!1), G(void 0);
|
|
149
149
|
});
|
|
150
150
|
};
|
|
151
|
-
return
|
|
152
|
-
(async () => await
|
|
153
|
-
}, [
|
|
154
|
-
|
|
151
|
+
return tt(() => {
|
|
152
|
+
(async () => await K())();
|
|
153
|
+
}, [_, c, u, b, h, O]), /* @__PURE__ */ s("div", { ref: E, id: `filtered-posts-${l}`, style: P !== void 0 ? { minHeight: P, border: "1px solid #e0e0e0", borderRadius: "4px" } : void 0, children: /* @__PURE__ */ s(B, { fluid: !0, children: R ? /* @__PURE__ */ s("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: P ?? "100%" }, children: /* @__PURE__ */ s(et, { active: !0, inline: "centered" }) }) : !R && C && C.length > 0 ? /* @__PURE__ */ s(
|
|
154
|
+
dt,
|
|
155
155
|
{
|
|
156
|
-
posts:
|
|
157
|
-
postWidth: Number(
|
|
156
|
+
posts: C,
|
|
157
|
+
postWidth: Number(d),
|
|
158
158
|
postHeight: Number(m),
|
|
159
|
-
numberOfColumns: Number(
|
|
160
|
-
sortFirstBy:
|
|
161
|
-
countryCategory:
|
|
159
|
+
numberOfColumns: Number(T),
|
|
160
|
+
sortFirstBy: J,
|
|
161
|
+
countryCategory: O
|
|
162
162
|
}
|
|
163
|
-
) : /* @__PURE__ */
|
|
164
|
-
},
|
|
163
|
+
) : /* @__PURE__ */ s(at, { noDataMsg: "No posts found", group: l }) }) });
|
|
164
|
+
}, Pt = nt(X.memo(ft));
|
|
165
165
|
export {
|
|
166
|
-
|
|
166
|
+
Pt as default
|
|
167
167
|
};
|
|
@@ -1,72 +1,78 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { useDispatch as
|
|
4
|
-
import { Container as
|
|
5
|
-
import { injectIntl as
|
|
6
|
-
const
|
|
1
|
+
import { jsx as r, jsxs as s } from "react/jsx-runtime";
|
|
2
|
+
import x, { useState as g, useRef as y, useEffect as p } from "react";
|
|
3
|
+
import { useDispatch as R, useSelector as u } from "react-redux";
|
|
4
|
+
import { Container as b, Dropdown as E, Icon as m } from "semantic-ui-react";
|
|
5
|
+
import { injectIntl as S } from "react-intl";
|
|
6
|
+
const T = (f) => {
|
|
7
7
|
const {
|
|
8
|
-
"data-group":
|
|
9
|
-
} = f, h =
|
|
8
|
+
"data-group": i
|
|
9
|
+
} = f, h = R(), t = u((e) => e.getIn(["data", "postsPagination", i])), n = u((e) => e.getIn(["data", "posts", i])), c = t && (t != null && t.totalPages) ? t.totalPages : 1, [a, d] = g((n == null ? void 0 : n.page) ?? 1), [P, v] = g([]), w = y(null), C = () => {
|
|
10
10
|
const e = [];
|
|
11
|
-
for (let
|
|
12
|
-
e.push({ key:
|
|
11
|
+
for (let o = 1; o <= c; o++)
|
|
12
|
+
e.push({ key: o, text: o, value: o });
|
|
13
13
|
v(e);
|
|
14
14
|
}, l = (e) => {
|
|
15
|
-
e
|
|
15
|
+
if (e === a || e < 1 || e > c) return;
|
|
16
|
+
d(e), h({
|
|
16
17
|
type: "SET_POSTS_FILTER",
|
|
17
|
-
group:
|
|
18
|
-
...
|
|
18
|
+
group: i,
|
|
19
|
+
...n,
|
|
19
20
|
page: e
|
|
20
|
-
})
|
|
21
|
+
});
|
|
22
|
+
const o = document.getElementById(`filtered-posts-${i}`);
|
|
23
|
+
if (o) {
|
|
24
|
+
const I = o.getBoundingClientRect().top + window.scrollY - 50;
|
|
25
|
+
window.scrollTo({ top: I, behavior: "smooth" });
|
|
26
|
+
}
|
|
21
27
|
};
|
|
22
|
-
return
|
|
28
|
+
return p(() => {
|
|
23
29
|
C();
|
|
24
|
-
}, [
|
|
25
|
-
const e = (
|
|
26
|
-
e !==
|
|
27
|
-
}, [
|
|
28
|
-
/* @__PURE__ */
|
|
30
|
+
}, [t]), p(() => {
|
|
31
|
+
const e = (n == null ? void 0 : n.page) ?? 1;
|
|
32
|
+
e !== a && d(e);
|
|
33
|
+
}, [n == null ? void 0 : n.page]), /* @__PURE__ */ r("div", { ref: w, children: /* @__PURE__ */ s(b, { fluid: !0, className: "posts-pagination", children: [
|
|
34
|
+
/* @__PURE__ */ s("div", { className: "posts-pagination-dropdown", children: [
|
|
29
35
|
/* @__PURE__ */ r("span", { children: "Page" }),
|
|
30
36
|
/* @__PURE__ */ r(
|
|
31
|
-
|
|
37
|
+
E,
|
|
32
38
|
{
|
|
33
39
|
options: P,
|
|
34
40
|
placeholder: "Select Item",
|
|
35
41
|
selection: !0,
|
|
36
42
|
compact: !0,
|
|
37
|
-
value:
|
|
38
|
-
onChange: (e,
|
|
43
|
+
value: a,
|
|
44
|
+
onChange: (e, o) => l(Number(o.value))
|
|
39
45
|
}
|
|
40
46
|
),
|
|
41
|
-
/* @__PURE__ */ r("div", { children: /* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ s("span", { children: [
|
|
42
48
|
"of ",
|
|
43
|
-
|
|
49
|
+
t && (t == null ? void 0 : t.totalPages)
|
|
44
50
|
] }) })
|
|
45
51
|
] }),
|
|
46
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ s("div", { children: [
|
|
47
53
|
/* @__PURE__ */ r(
|
|
48
|
-
|
|
54
|
+
m,
|
|
49
55
|
{
|
|
50
56
|
size: "large",
|
|
51
57
|
style: { cursor: "pointer" },
|
|
52
|
-
onClick: () => l(
|
|
58
|
+
onClick: () => l(a - 1),
|
|
53
59
|
name: "angle left",
|
|
54
|
-
disabled:
|
|
60
|
+
disabled: a === 1
|
|
55
61
|
}
|
|
56
62
|
),
|
|
57
63
|
/* @__PURE__ */ r(
|
|
58
|
-
|
|
64
|
+
m,
|
|
59
65
|
{
|
|
60
66
|
size: "large",
|
|
61
67
|
style: { cursor: "pointer" },
|
|
62
|
-
onClick: () => l(
|
|
68
|
+
onClick: () => l(a + 1),
|
|
63
69
|
name: "angle right",
|
|
64
|
-
disabled:
|
|
70
|
+
disabled: a === c
|
|
65
71
|
}
|
|
66
72
|
)
|
|
67
73
|
] })
|
|
68
|
-
] });
|
|
69
|
-
},
|
|
74
|
+
] }) });
|
|
75
|
+
}, B = S(x.memo(T));
|
|
70
76
|
export {
|
|
71
|
-
|
|
77
|
+
B as default
|
|
72
78
|
};
|