@devgateway/dvz-ui-react 1.7.15 → 1.8.0
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/LICENSE +180 -5
- package/README.md +1 -1
- package/dist/cjs/embeddable/chart/Bar.js +1 -1
- package/dist/cjs/embeddable/chart/index.js +1 -1
- package/dist/cjs/embeddable/posts-filter/CategoricalFilter.js +1 -1
- package/dist/cjs/embeddable/posts-filter/index.js +1 -1
- package/dist/cjs/embeddable/posts-filters-reset-button/index.js +1 -1
- package/dist/cjs/embeddable/tabbedposts/index.js +1 -1
- package/dist/cjs/embeddable/vertical-featuredtabs/index.js +2 -2
- package/dist/cjs/layout/Header.js +2 -2
- package/dist/esm/embeddable/chart/Bar.js +199 -191
- package/dist/esm/embeddable/chart/index.js +465 -453
- package/dist/esm/embeddable/posts-filter/CategoricalFilter.js +50 -48
- package/dist/esm/embeddable/posts-filter/index.js +83 -83
- package/dist/esm/embeddable/posts-filters-reset-button/index.js +29 -23
- package/dist/esm/embeddable/tabbedposts/index.js +109 -165
- package/dist/esm/embeddable/vertical-featuredtabs/index.js +193 -243
- package/dist/esm/layout/Header.js +116 -116
- package/dist/types/layout/Header.d.ts +2 -0
- package/package.json +6 -3
|
@@ -1,72 +1,74 @@
|
|
|
1
1
|
import { jsx as D } from "react/jsx-runtime";
|
|
2
2
|
import { useState as E, useEffect as F } from "react";
|
|
3
3
|
import L from "./PostsFilterDropdown.js";
|
|
4
|
-
import { Config as
|
|
5
|
-
const q = (
|
|
4
|
+
import { Config as k } from "../../conf/index.js";
|
|
5
|
+
const q = (c) => {
|
|
6
6
|
const {
|
|
7
|
-
taxonomy:
|
|
8
|
-
group:
|
|
7
|
+
taxonomy: n,
|
|
8
|
+
group: m,
|
|
9
9
|
placeholder: f,
|
|
10
|
-
allLabel:
|
|
11
|
-
noneLabel:
|
|
12
|
-
useSingleColumn:
|
|
13
|
-
enableTextSearch:
|
|
14
|
-
filterType:
|
|
15
|
-
showNoDataOption:
|
|
16
|
-
closeOnSelect:
|
|
17
|
-
allNoneSameBehaviour:
|
|
18
|
-
autoApply:
|
|
19
|
-
alphabeticalSort:
|
|
20
|
-
ascOrder:
|
|
21
|
-
type:
|
|
22
|
-
categories:
|
|
23
|
-
onChange:
|
|
10
|
+
allLabel: u,
|
|
11
|
+
noneLabel: g,
|
|
12
|
+
useSingleColumn: d,
|
|
13
|
+
enableTextSearch: y,
|
|
14
|
+
filterType: h,
|
|
15
|
+
showNoDataOption: x,
|
|
16
|
+
closeOnSelect: O,
|
|
17
|
+
allNoneSameBehaviour: P,
|
|
18
|
+
autoApply: b,
|
|
19
|
+
alphabeticalSort: A,
|
|
20
|
+
ascOrder: N,
|
|
21
|
+
type: S,
|
|
22
|
+
categories: s,
|
|
23
|
+
onChange: w,
|
|
24
24
|
wpApiBase: o,
|
|
25
|
-
locale:
|
|
26
|
-
...
|
|
27
|
-
} =
|
|
28
|
-
if (!
|
|
25
|
+
locale: r,
|
|
26
|
+
...B
|
|
27
|
+
} = c, [C, e] = E([]), T = async () => {
|
|
28
|
+
if (!n || n === "none") {
|
|
29
29
|
e([]);
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
32
|
+
const v = o != null && o !== "" ? o : k.REACT_APP_WP_API, _ = r ? `?lang=${r}` : "?lang=en", l = await (await fetch(v + "/wp/v2/" + n + _)).json();
|
|
33
|
+
if (l) {
|
|
34
|
+
const p = l.map((t) => ({
|
|
35
35
|
key: t.id,
|
|
36
36
|
value: t.id,
|
|
37
37
|
text: t.name
|
|
38
38
|
}));
|
|
39
|
-
if (
|
|
40
|
-
const t =
|
|
41
|
-
|
|
39
|
+
if (s) {
|
|
40
|
+
const t = s.map((a) => Number(a)).filter((a) => !Number.isNaN(a)), j = p.filter(
|
|
41
|
+
(a) => t.indexOf(Number(a.value)) > -1
|
|
42
|
+
);
|
|
43
|
+
e([]), e(j);
|
|
42
44
|
} else
|
|
43
|
-
e([]), e(
|
|
45
|
+
e([]), e(p);
|
|
44
46
|
}
|
|
45
47
|
};
|
|
46
48
|
return F(() => {
|
|
47
|
-
let
|
|
48
|
-
return
|
|
49
|
-
|
|
49
|
+
let i = !1;
|
|
50
|
+
return i || (e([]), T()), () => {
|
|
51
|
+
i = !0;
|
|
50
52
|
};
|
|
51
|
-
}, [
|
|
53
|
+
}, [S, n, s, o, r]), /* @__PURE__ */ D(
|
|
52
54
|
L,
|
|
53
55
|
{
|
|
54
|
-
...
|
|
55
|
-
group:
|
|
56
|
+
...B,
|
|
57
|
+
group: m,
|
|
56
58
|
placeholder: f,
|
|
57
|
-
allLabel:
|
|
58
|
-
noneLabel:
|
|
59
|
-
useSingleColumn:
|
|
60
|
-
enableTextSearch:
|
|
61
|
-
filterType:
|
|
62
|
-
showNoDataOption:
|
|
63
|
-
closeOnSelect:
|
|
64
|
-
allNoneSameBehaviour:
|
|
65
|
-
autoApply:
|
|
66
|
-
alphabeticalSort:
|
|
67
|
-
ascOrder:
|
|
68
|
-
options:
|
|
69
|
-
onChange:
|
|
59
|
+
allLabel: u,
|
|
60
|
+
noneLabel: g,
|
|
61
|
+
useSingleColumn: d,
|
|
62
|
+
enableTextSearch: y,
|
|
63
|
+
filterType: h,
|
|
64
|
+
showNoDataOption: x,
|
|
65
|
+
closeOnSelect: O,
|
|
66
|
+
allNoneSameBehaviour: P,
|
|
67
|
+
autoApply: b,
|
|
68
|
+
alphabeticalSort: A,
|
|
69
|
+
ascOrder: N,
|
|
70
|
+
options: C,
|
|
71
|
+
onChange: w
|
|
70
72
|
}
|
|
71
73
|
);
|
|
72
74
|
};
|
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { Container as
|
|
4
|
-
import { toBoolean as i, toNumber as
|
|
5
|
-
import { useAppDispatch as
|
|
6
|
-
import { useSelector as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { injectIntl as
|
|
10
|
-
const
|
|
1
|
+
import { jsxs as ue, jsx as D } from "react/jsx-runtime";
|
|
2
|
+
import pe, { useState as S, useMemo as p, useEffect as P } from "react";
|
|
3
|
+
import { Container as de } from "semantic-ui-react";
|
|
4
|
+
import { toBoolean as i, toNumber as Fe } from "../../utils/data.js";
|
|
5
|
+
import { useAppDispatch as me } from "../../redux/hooks.js";
|
|
6
|
+
import { useSelector as ge } from "react-redux";
|
|
7
|
+
import fe from "./CategoricalFilter.js";
|
|
8
|
+
import Se from "./YearFilter.js";
|
|
9
|
+
import { injectIntl as he, useIntl as Ce } from "react-intl";
|
|
10
|
+
const Te = (z) => {
|
|
11
11
|
const {
|
|
12
|
-
"data-alphabetical-sort":
|
|
13
|
-
"data-asc-order":
|
|
12
|
+
"data-alphabetical-sort": j,
|
|
13
|
+
"data-asc-order": J,
|
|
14
14
|
"data-group": s,
|
|
15
|
-
"data-placeholder":
|
|
16
|
-
"data-all-label":
|
|
17
|
-
"data-none-label":
|
|
18
|
-
"data-use-single-column":
|
|
19
|
-
"data-enable-text-search":
|
|
15
|
+
"data-placeholder": h,
|
|
16
|
+
"data-all-label": C,
|
|
17
|
+
"data-none-label": T,
|
|
18
|
+
"data-use-single-column": K,
|
|
19
|
+
"data-enable-text-search": M,
|
|
20
20
|
"data-filter-type": d,
|
|
21
|
-
"data-show-no-data-option":
|
|
22
|
-
"data-close-on-select":
|
|
23
|
-
"data-all-none-same-behaviour":
|
|
24
|
-
"data-auto-apply":
|
|
21
|
+
"data-show-no-data-option": U,
|
|
22
|
+
"data-close-on-select": $,
|
|
23
|
+
"data-all-none-same-behaviour": k,
|
|
24
|
+
"data-auto-apply": q,
|
|
25
25
|
"data-taxonomy": c,
|
|
26
26
|
"data-categories": F = "[]",
|
|
27
|
-
"data-is-country-filter":
|
|
28
|
-
"data-is-year-filter":
|
|
29
|
-
"data-type":
|
|
27
|
+
"data-is-country-filter": G,
|
|
28
|
+
"data-is-year-filter": H,
|
|
29
|
+
"data-type": Q,
|
|
30
30
|
"data-sort-first-by": O,
|
|
31
|
-
"data-default-values":
|
|
32
|
-
"data-wordpress-source-type":
|
|
33
|
-
"data-wordpress-source":
|
|
34
|
-
editing:
|
|
35
|
-
} =
|
|
31
|
+
"data-default-values": W = "[]",
|
|
32
|
+
"data-wordpress-source-type": Oe,
|
|
33
|
+
"data-wordpress-source": b,
|
|
34
|
+
editing: x = !1
|
|
35
|
+
} = z, u = me(), { locale: X } = Ce(), t = ge((e) => e.getIn(["data", "posts", s])) || {}, o = d === "multi-select", [V, xe] = S(0), N = (e) => x ? e : decodeURIComponent(e), A = (e) => {
|
|
36
36
|
try {
|
|
37
|
-
return JSON.parse(
|
|
37
|
+
return JSON.parse(N(e));
|
|
38
38
|
} catch (a) {
|
|
39
|
-
return console.warn("JSON parsing failed for value:", e, "- treating as plain string. Error:", a),
|
|
39
|
+
return console.warn("JSON parsing failed for value:", e, "- treating as plain string. Error:", a), N(e);
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
let l =
|
|
42
|
+
let l = A(W);
|
|
43
43
|
l || (l = []), typeof l == "string" && (l = l.split(",").map(Number)), typeof l == "number" && (l = [l]);
|
|
44
|
-
const
|
|
44
|
+
const Z = i(j), ee = i(J), I = i(U), B = i($), w = i(k), Y = i(q), r = i(G), n = i(H), _ = i(K), E = i(M), m = O !== "none" ? Fe(O) : null, [y, te] = S([]), [g, re] = S(!1), f = (e, a) => a ? Array.isArray(e) ? e : e != null ? [e] : [] : e || void 0, ae = p(
|
|
45
45
|
() => f(t.countryFilter, o),
|
|
46
46
|
[t.countryFilter, o]
|
|
47
|
-
),
|
|
47
|
+
), oe = p(
|
|
48
48
|
() => f(t.categoryFilter, o),
|
|
49
49
|
[t.categoryFilter, o]
|
|
50
|
-
),
|
|
50
|
+
), le = p(
|
|
51
51
|
() => n ? f(t.yearFilter, o) : void 0,
|
|
52
52
|
[t.yearFilter, o, n]
|
|
53
|
-
),
|
|
53
|
+
), L = p(() => {
|
|
54
54
|
if (!F) return [];
|
|
55
|
-
const e =
|
|
56
|
-
return Array.isArray(e) ? e : typeof e == "string" ? e.split(",").filter(
|
|
57
|
-
}, [F,
|
|
55
|
+
const e = A(F);
|
|
56
|
+
return Array.isArray(e) ? e : typeof e == "string" || typeof e == "number" ? e.toString().split(",").filter((a) => a.trim() !== "") : [];
|
|
57
|
+
}, [F, x]), ne = (e) => {
|
|
58
58
|
u({
|
|
59
59
|
type: "SET_POSTS_FILTER",
|
|
60
60
|
group: s,
|
|
@@ -66,7 +66,7 @@ const Ce = (D) => {
|
|
|
66
66
|
countryFilter: t.countryFilter,
|
|
67
67
|
sortFirstBy: m
|
|
68
68
|
});
|
|
69
|
-
},
|
|
69
|
+
}, ie = (e) => {
|
|
70
70
|
u({
|
|
71
71
|
type: "SET_POSTS_FILTER",
|
|
72
72
|
group: s,
|
|
@@ -84,24 +84,24 @@ const Ce = (D) => {
|
|
|
84
84
|
countryTaxonomy: r ? c : t.countryTaxonomy
|
|
85
85
|
});
|
|
86
86
|
};
|
|
87
|
-
return
|
|
88
|
-
const e = l.length > 0, a = o ? l : l[0],
|
|
87
|
+
return P(() => {
|
|
88
|
+
const e = l.length > 0, a = o ? l : l[0], R = L.map(Number), v = r ? t.categoryFilter : e ? a : o ? R : t.categoryFilter, se = r ? e ? a : o ? R : t.countryFilter : t.countryFilter, ce = n && o ? y.length > 0 ? y.map((ye) => ye.value) : [] : t.yearFilter;
|
|
89
89
|
u({
|
|
90
90
|
type: "SET_INITIAL_POSTS_FILTER",
|
|
91
91
|
group: s,
|
|
92
|
-
categoryFilter:
|
|
93
|
-
countryFilter:
|
|
92
|
+
categoryFilter: v,
|
|
93
|
+
countryFilter: se,
|
|
94
94
|
isYearFilter: n,
|
|
95
95
|
isCountryFilter: r,
|
|
96
96
|
sortFirstBy: m,
|
|
97
|
-
yearFilter: n ?
|
|
98
|
-
categoryCategory: r ? null :
|
|
97
|
+
yearFilter: n ? ce : null,
|
|
98
|
+
categoryCategory: r ? null : v,
|
|
99
99
|
categoryTaxonomy: r ? null : c,
|
|
100
100
|
countryCategory: r ? c : null,
|
|
101
101
|
countryTaxonomy: r ? c : null,
|
|
102
102
|
page: 1
|
|
103
103
|
});
|
|
104
|
-
}, []),
|
|
104
|
+
}, []), P(() => {
|
|
105
105
|
if (n && !g && o && y.length > 0) {
|
|
106
106
|
const e = y.map((a) => a.value);
|
|
107
107
|
u({
|
|
@@ -111,65 +111,65 @@ const Ce = (D) => {
|
|
|
111
111
|
yearFilter: e
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
}, [g]), /* @__PURE__ */
|
|
115
|
-
n && /* @__PURE__ */
|
|
116
|
-
|
|
114
|
+
}, [g]), /* @__PURE__ */ ue(de, { fluid: !0, className: "filter post-filter", children: [
|
|
115
|
+
n && /* @__PURE__ */ D(
|
|
116
|
+
Se,
|
|
117
117
|
{
|
|
118
118
|
group: s,
|
|
119
|
-
placeholder:
|
|
120
|
-
allLabel:
|
|
121
|
-
noneLabel:
|
|
122
|
-
useSingleColumn:
|
|
123
|
-
enableTextSearch:
|
|
119
|
+
placeholder: h,
|
|
120
|
+
allLabel: C,
|
|
121
|
+
noneLabel: T,
|
|
122
|
+
useSingleColumn: _,
|
|
123
|
+
enableTextSearch: E,
|
|
124
124
|
filterType: d,
|
|
125
125
|
showNoDataOption: I,
|
|
126
|
-
closeOnSelect:
|
|
127
|
-
allNoneSameBehaviour:
|
|
128
|
-
autoApply:
|
|
129
|
-
alphabeticalSort:
|
|
130
|
-
ascOrder:
|
|
126
|
+
closeOnSelect: B,
|
|
127
|
+
allNoneSameBehaviour: w,
|
|
128
|
+
autoApply: Y,
|
|
129
|
+
alphabeticalSort: Z,
|
|
130
|
+
ascOrder: ee,
|
|
131
131
|
options: y,
|
|
132
|
-
value:
|
|
132
|
+
value: le,
|
|
133
133
|
yearOptions: y,
|
|
134
|
-
setYearOptions:
|
|
134
|
+
setYearOptions: te,
|
|
135
135
|
yearFilterLoading: g,
|
|
136
|
-
setYearFilterLoading:
|
|
136
|
+
setYearFilterLoading: re,
|
|
137
137
|
onChange: (e, a) => {
|
|
138
|
-
|
|
138
|
+
ne(a);
|
|
139
139
|
},
|
|
140
140
|
resetKey: V,
|
|
141
|
-
wpApiBase:
|
|
141
|
+
wpApiBase: b ?? void 0
|
|
142
142
|
}
|
|
143
143
|
),
|
|
144
|
-
!n && /* @__PURE__ */
|
|
145
|
-
|
|
144
|
+
!n && /* @__PURE__ */ D(
|
|
145
|
+
fe,
|
|
146
146
|
{
|
|
147
147
|
group: s,
|
|
148
|
-
placeholder:
|
|
149
|
-
allLabel:
|
|
150
|
-
noneLabel:
|
|
151
|
-
useSingleColumn:
|
|
152
|
-
enableTextSearch:
|
|
148
|
+
placeholder: h,
|
|
149
|
+
allLabel: C,
|
|
150
|
+
noneLabel: T,
|
|
151
|
+
useSingleColumn: _,
|
|
152
|
+
enableTextSearch: E,
|
|
153
153
|
filterType: d,
|
|
154
154
|
showNoDataOption: I,
|
|
155
|
-
closeOnSelect:
|
|
156
|
-
allNoneSameBehaviour:
|
|
157
|
-
autoApply:
|
|
155
|
+
closeOnSelect: B,
|
|
156
|
+
allNoneSameBehaviour: w,
|
|
157
|
+
autoApply: Y,
|
|
158
158
|
taxonomy: c,
|
|
159
|
-
type:
|
|
160
|
-
value: r ?
|
|
159
|
+
type: Q,
|
|
160
|
+
value: r ? ae : oe,
|
|
161
161
|
onChange: (e, a) => {
|
|
162
|
-
|
|
162
|
+
ie(a);
|
|
163
163
|
},
|
|
164
|
-
categories:
|
|
164
|
+
categories: L,
|
|
165
165
|
resetKey: V,
|
|
166
|
-
wpApiBase:
|
|
167
|
-
locale:
|
|
166
|
+
wpApiBase: b ?? void 0,
|
|
167
|
+
locale: X
|
|
168
168
|
},
|
|
169
169
|
`cat-${s}`
|
|
170
170
|
)
|
|
171
171
|
] });
|
|
172
|
-
},
|
|
172
|
+
}, Re = he(pe.memo(Te));
|
|
173
173
|
export {
|
|
174
|
-
|
|
174
|
+
Re as default
|
|
175
175
|
};
|
|
@@ -1,40 +1,46 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useDispatch as
|
|
4
|
-
import { Container as
|
|
5
|
-
import
|
|
6
|
-
import { injectIntl as
|
|
7
|
-
const
|
|
1
|
+
import { jsxs as d, jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import f from "react";
|
|
3
|
+
import { useDispatch as m, useSelector as l } from "react-redux";
|
|
4
|
+
import { Container as u, Icon as g } from "semantic-ui-react";
|
|
5
|
+
import y from "lodash.isequal";
|
|
6
|
+
import { injectIntl as b } from "react-intl";
|
|
7
|
+
const a = (t) => t == null ? t : Array.isArray(t) ? [...t].map(a).sort((r, e) => {
|
|
8
|
+
const o = JSON.stringify(r), n = JSON.stringify(e);
|
|
9
|
+
return o < n ? -1 : o > n ? 1 : 0;
|
|
10
|
+
}) : typeof t == "object" ? Object.keys(t).sort().reduce((r, e) => (r[e] = a(t[e]), r), {}) : typeof t == "number" || typeof t == "string" ? String(t) : t, I = (t) => {
|
|
8
11
|
const {
|
|
9
|
-
"data-group":
|
|
10
|
-
"data-reset-label":
|
|
11
|
-
} =
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
"data-group": r,
|
|
13
|
+
"data-reset-label": e = "Reset All Filters"
|
|
14
|
+
} = t, o = m(), n = l((c) => c.getIn(["data", "posts", r])), i = l((c) => c.getIn(["data", "posts", "initialFilters", r])), s = f.useMemo(() => n && i ? !y(
|
|
15
|
+
a(n),
|
|
16
|
+
a(i)
|
|
17
|
+
) : !1, [n, i]);
|
|
18
|
+
return /* @__PURE__ */ d(
|
|
19
|
+
u,
|
|
14
20
|
{
|
|
15
21
|
fluid: !0,
|
|
16
22
|
style: {
|
|
17
|
-
pointerEvents:
|
|
18
|
-
cursor:
|
|
19
|
-
opacity:
|
|
23
|
+
pointerEvents: s ? "auto" : "none",
|
|
24
|
+
cursor: s ? "pointer" : "not-allowed",
|
|
25
|
+
opacity: s ? 1 : 0.5
|
|
20
26
|
},
|
|
21
|
-
className: `data-filters-reset ignore ${
|
|
27
|
+
className: `data-filters-reset ignore ${s ? "" : "disabled"}`,
|
|
22
28
|
onClick: () => {
|
|
23
|
-
|
|
29
|
+
o({
|
|
24
30
|
type: "SET_INITIAL_POSTS_FILTER",
|
|
25
|
-
group:
|
|
26
|
-
...
|
|
31
|
+
group: r,
|
|
32
|
+
...i,
|
|
27
33
|
reset: !0,
|
|
28
34
|
page: 1
|
|
29
35
|
});
|
|
30
36
|
},
|
|
31
37
|
children: [
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
/* @__PURE__ */
|
|
38
|
+
/* @__PURE__ */ p("span", { children: e }),
|
|
39
|
+
/* @__PURE__ */ p("span", { children: /* @__PURE__ */ p(g, { disabled: !s, name: "undo alternate", className: "custom-undo-icon" }) })
|
|
34
40
|
]
|
|
35
41
|
}
|
|
36
42
|
);
|
|
37
|
-
},
|
|
43
|
+
}, A = b(I);
|
|
38
44
|
export {
|
|
39
|
-
|
|
45
|
+
A as default
|
|
40
46
|
};
|