@devgateway/dvz-ui-react 1.7.5 → 1.7.7
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/filtered-posts/index.js +1 -1
- package/dist/cjs/embeddable/posts-filter/CategoricalFilter.js +1 -1
- package/dist/cjs/embeddable/posts-filter/YearFilter.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/posts-pagination/index.js +1 -1
- package/dist/cjs/embeddable/reducers/data-api.js +1 -1
- package/dist/cjs/embeddable/reducers/data.js +1 -1
- package/dist/esm/embeddable/filtered-posts/index.js +100 -99
- package/dist/esm/embeddable/posts-filter/CategoricalFilter.js +35 -36
- package/dist/esm/embeddable/posts-filter/YearFilter.js +17 -16
- package/dist/esm/embeddable/posts-filter/index.js +82 -79
- package/dist/esm/embeddable/posts-filters-reset-button/index.js +9 -8
- package/dist/esm/embeddable/posts-pagination/index.js +38 -35
- package/dist/esm/embeddable/reducers/data-api.js +36 -38
- package/dist/esm/embeddable/reducers/data.js +103 -100
- package/dist/types/embeddable/posts-filter/CategoricalFilter.d.ts +1 -0
- package/dist/types/embeddable/posts-filter/index.d.ts +6 -3
- package/dist/types/embeddable/posts-filters-reset-button/index.d.ts +4 -2
- package/dist/types/embeddable/posts-pagination/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import
|
|
4
|
-
import { getYearRange as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as F } from "react";
|
|
3
|
+
import L from "./PostsFilterDropdown.js";
|
|
4
|
+
import { getYearRange as v } from "@devgateway/wp-react-lib";
|
|
5
|
+
const j = (o) => {
|
|
6
6
|
const {
|
|
7
7
|
group: r,
|
|
8
8
|
placeholder: s,
|
|
@@ -18,29 +18,30 @@ const k = (o) => {
|
|
|
18
18
|
alphabeticalSort: h,
|
|
19
19
|
ascOrder: g,
|
|
20
20
|
onChange: Y,
|
|
21
|
-
yearOptions:
|
|
21
|
+
yearOptions: A,
|
|
22
22
|
setYearOptions: y,
|
|
23
|
-
yearFilterLoading:
|
|
23
|
+
yearFilterLoading: B,
|
|
24
24
|
setYearFilterLoading: t,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
wpApiBase: O,
|
|
26
|
+
...S
|
|
27
|
+
} = o, w = async () => {
|
|
27
28
|
t(!0);
|
|
28
|
-
const b = (await
|
|
29
|
+
const b = (await v(O)).data.map((e) => ({
|
|
29
30
|
key: e,
|
|
30
31
|
value: e,
|
|
31
32
|
text: e.toString()
|
|
32
33
|
}));
|
|
33
34
|
return t(!1), b;
|
|
34
35
|
};
|
|
35
|
-
return
|
|
36
|
+
return F(() => {
|
|
36
37
|
(async () => {
|
|
37
|
-
const a = await
|
|
38
|
+
const a = await w();
|
|
38
39
|
y(a);
|
|
39
40
|
})();
|
|
40
|
-
}, []), /* @__PURE__ */
|
|
41
|
-
|
|
41
|
+
}, []), /* @__PURE__ */ x(
|
|
42
|
+
L,
|
|
42
43
|
{
|
|
43
|
-
...
|
|
44
|
+
...S,
|
|
44
45
|
group: r,
|
|
45
46
|
placeholder: s,
|
|
46
47
|
allLabel: n,
|
|
@@ -59,5 +60,5 @@ const k = (o) => {
|
|
|
59
60
|
);
|
|
60
61
|
};
|
|
61
62
|
export {
|
|
62
|
-
|
|
63
|
+
j as default
|
|
63
64
|
};
|
|
@@ -1,58 +1,59 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as h, useMemo as p, useEffect as
|
|
3
|
-
import { Container as
|
|
4
|
-
import { toBoolean as s, toNumber as
|
|
5
|
-
import { useAppDispatch as
|
|
6
|
-
import { useSelector as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import { jsxs as ce, jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import ye, { useState as h, useMemo as p, useEffect as L } from "react";
|
|
3
|
+
import { Container as ue } from "semantic-ui-react";
|
|
4
|
+
import { toBoolean as s, toNumber as pe } from "../../utils/data.js";
|
|
5
|
+
import { useAppDispatch as Fe } from "../../redux/hooks.js";
|
|
6
|
+
import { useSelector as de } from "react-redux";
|
|
7
|
+
import me from "./CategoricalFilter.js";
|
|
8
|
+
import ge from "./YearFilter.js";
|
|
9
|
+
import { injectIntl as fe, useIntl as Se } from "react-intl";
|
|
10
|
+
const he = (R) => {
|
|
10
11
|
const {
|
|
11
|
-
"data-alphabetical-sort":
|
|
12
|
-
"data-asc-order":
|
|
12
|
+
"data-alphabetical-sort": v,
|
|
13
|
+
"data-asc-order": D,
|
|
13
14
|
"data-group": c,
|
|
14
|
-
"data-placeholder":
|
|
15
|
-
"data-all-label":
|
|
15
|
+
"data-placeholder": C,
|
|
16
|
+
"data-all-label": T,
|
|
16
17
|
"data-none-label": b,
|
|
17
|
-
"data-use-single-column":
|
|
18
|
-
"data-enable-text-search":
|
|
18
|
+
"data-use-single-column": P,
|
|
19
|
+
"data-enable-text-search": z,
|
|
19
20
|
"data-filter-type": F,
|
|
20
|
-
"data-show-no-data-option":
|
|
21
|
-
"data-close-on-select":
|
|
22
|
-
"data-all-none-same-behaviour":
|
|
23
|
-
"data-auto-apply":
|
|
21
|
+
"data-show-no-data-option": j,
|
|
22
|
+
"data-close-on-select": J,
|
|
23
|
+
"data-all-none-same-behaviour": K,
|
|
24
|
+
"data-auto-apply": M,
|
|
24
25
|
"data-taxonomy": i,
|
|
25
26
|
"data-categories": d = "[]",
|
|
26
|
-
"data-is-country-filter":
|
|
27
|
-
"data-is-year-filter":
|
|
28
|
-
"data-type":
|
|
29
|
-
"data-sort-first-by":
|
|
30
|
-
"data-default-values":
|
|
31
|
-
"data-wordpress-source-type":
|
|
32
|
-
"data-wordpress-source":
|
|
27
|
+
"data-is-country-filter": U,
|
|
28
|
+
"data-is-year-filter": $,
|
|
29
|
+
"data-type": k,
|
|
30
|
+
"data-sort-first-by": x,
|
|
31
|
+
"data-default-values": q = "[]",
|
|
32
|
+
"data-wordpress-source-type": Ce,
|
|
33
|
+
"data-wordpress-source": O,
|
|
33
34
|
editing: G = !1
|
|
34
|
-
} =
|
|
35
|
+
} = R, u = Fe(), { locale: H } = Se(), e = de((t) => t.getIn(["data", "posts", c])) || {}, l = F === "multi-select", [N, be] = h(0), V = (t) => G ? t : decodeURIComponent(t);
|
|
35
36
|
let n = ((t) => {
|
|
36
37
|
try {
|
|
37
|
-
return JSON.parse(
|
|
38
|
+
return JSON.parse(V(t));
|
|
38
39
|
} catch (o) {
|
|
39
|
-
return console.warn("JSON parsing failed for value:", t, "- treating as plain string. Error:", o),
|
|
40
|
+
return console.warn("JSON parsing failed for value:", t, "- treating as plain string. Error:", o), V(t);
|
|
40
41
|
}
|
|
41
|
-
})(
|
|
42
|
+
})(q);
|
|
42
43
|
n || (n = []), typeof n == "string" && (n = n.split(",").map(Number)), typeof n == "number" && (n = [n]);
|
|
43
|
-
const
|
|
44
|
+
const Q = s(v), W = s(D), I = s(j), A = s(J), B = s(K), w = s(M), r = s(U), a = s($), Y = s(P), _ = s(z), m = x !== "none" ? pe(x) : null, [y, X] = h([]), [g, Z] = h(!1), f = (t, o) => o ? Array.isArray(t) ? t : t != null ? [t] : [] : t || void 0, ee = p(
|
|
44
45
|
() => f(e.countryFilter, l),
|
|
45
46
|
[e.countryFilter, l]
|
|
46
|
-
),
|
|
47
|
+
), te = p(
|
|
47
48
|
() => f(e.categoryFilter, l),
|
|
48
49
|
[e.categoryFilter, l]
|
|
49
|
-
),
|
|
50
|
+
), re = p(
|
|
50
51
|
() => a ? f(e.yearFilter, l) : void 0,
|
|
51
52
|
[e.yearFilter, l, a]
|
|
52
53
|
), S = p(
|
|
53
54
|
() => d ? d.split(",") : [],
|
|
54
55
|
[d]
|
|
55
|
-
),
|
|
56
|
+
), ae = (t) => {
|
|
56
57
|
u({
|
|
57
58
|
type: "SET_POSTS_FILTER",
|
|
58
59
|
group: c,
|
|
@@ -62,12 +63,12 @@ const Ae = (L) => {
|
|
|
62
63
|
isCountryFilter: r,
|
|
63
64
|
categoryFilter: e.categoryFilter,
|
|
64
65
|
countryFilter: e.countryFilter,
|
|
65
|
-
sortFirstBy:
|
|
66
|
+
sortFirstBy: m,
|
|
66
67
|
countryCategory: i,
|
|
67
68
|
categoryTaxonomy: i,
|
|
68
69
|
countryTaxonomy: i
|
|
69
70
|
});
|
|
70
|
-
},
|
|
71
|
+
}, oe = (t) => {
|
|
71
72
|
u({
|
|
72
73
|
type: "SET_POSTS_FILTER",
|
|
73
74
|
group: c,
|
|
@@ -75,35 +76,35 @@ const Ae = (L) => {
|
|
|
75
76
|
// Preserve both filters so they can work together
|
|
76
77
|
categoryFilter: r ? e.categoryFilter : t,
|
|
77
78
|
countryFilter: r ? t : e.countryFilter,
|
|
78
|
-
isYearFilter:
|
|
79
|
+
isYearFilter: e.isYearFilter,
|
|
79
80
|
yearFilter: e.yearFilter,
|
|
80
|
-
isCountryFilter:
|
|
81
|
-
sortFirstBy: r ?
|
|
81
|
+
isCountryFilter: e.isCountryFilter,
|
|
82
|
+
sortFirstBy: r ? m : e.sortFirstBy,
|
|
82
83
|
countryCategory: r ? i : e.countryCategory,
|
|
83
84
|
categoryCategory: r ? e.categoryCategory : t,
|
|
84
85
|
categoryTaxonomy: r ? e.categoryTaxonomy : i,
|
|
85
86
|
countryTaxonomy: r ? i : e.countryTaxonomy
|
|
86
87
|
});
|
|
87
88
|
};
|
|
88
|
-
return
|
|
89
|
-
const t = n.length > 0, o = l ? n : n[0],
|
|
89
|
+
return L(() => {
|
|
90
|
+
const t = n.length > 0, o = l ? n : n[0], le = r ? e.categoryFilter : t ? o : l ? S.map(Number) : e.categoryFilter, ne = r ? t ? o : l ? S.map(Number) : e.countryFilter : e.countryFilter, ie = a && l ? y.length > 0 ? y.map((se) => se.value) : [] : e.yearFilter;
|
|
90
91
|
u({
|
|
91
92
|
type: "SET_INITIAL_POSTS_FILTER",
|
|
92
93
|
group: c,
|
|
93
|
-
categoryFilter:
|
|
94
|
-
countryFilter:
|
|
94
|
+
categoryFilter: le,
|
|
95
|
+
countryFilter: ne,
|
|
95
96
|
isYearFilter: a,
|
|
96
97
|
isCountryFilter: r,
|
|
97
|
-
sortFirstBy:
|
|
98
|
-
yearFilter: a ?
|
|
98
|
+
sortFirstBy: m,
|
|
99
|
+
yearFilter: a ? ie : null,
|
|
99
100
|
categoryCategory: r ? null : e.categoryCategory,
|
|
100
101
|
categoryTaxonomy: r ? null : i,
|
|
101
102
|
countryCategory: r ? i : null,
|
|
102
103
|
countryTaxonomy: r ? i : null,
|
|
103
104
|
page: 1
|
|
104
105
|
});
|
|
105
|
-
}, []),
|
|
106
|
-
if (a && !
|
|
106
|
+
}, []), L(() => {
|
|
107
|
+
if (a && !g) {
|
|
107
108
|
const t = a && l ? y.length > 0 ? y.map((o) => o.value) : [] : e.yearFilter;
|
|
108
109
|
u({
|
|
109
110
|
type: "SET_INITIAL_POSTS_FILTER",
|
|
@@ -113,63 +114,65 @@ const Ae = (L) => {
|
|
|
113
114
|
yearFilter: a ? t : null
|
|
114
115
|
});
|
|
115
116
|
}
|
|
116
|
-
}, [
|
|
117
|
-
a && /* @__PURE__ */
|
|
118
|
-
|
|
117
|
+
}, [g]), /* @__PURE__ */ ce(ue, { fluid: !0, className: "filter post-filter", children: [
|
|
118
|
+
a && /* @__PURE__ */ E(
|
|
119
|
+
ge,
|
|
119
120
|
{
|
|
120
121
|
group: c,
|
|
121
|
-
placeholder:
|
|
122
|
-
allLabel:
|
|
122
|
+
placeholder: C,
|
|
123
|
+
allLabel: T,
|
|
123
124
|
noneLabel: b,
|
|
124
|
-
useSingleColumn:
|
|
125
|
-
enableTextSearch:
|
|
125
|
+
useSingleColumn: Y,
|
|
126
|
+
enableTextSearch: _,
|
|
126
127
|
filterType: F,
|
|
127
|
-
showNoDataOption:
|
|
128
|
+
showNoDataOption: I,
|
|
128
129
|
closeOnSelect: A,
|
|
129
130
|
allNoneSameBehaviour: B,
|
|
130
|
-
autoApply:
|
|
131
|
-
alphabeticalSort:
|
|
132
|
-
ascOrder:
|
|
131
|
+
autoApply: w,
|
|
132
|
+
alphabeticalSort: Q,
|
|
133
|
+
ascOrder: W,
|
|
133
134
|
options: y,
|
|
134
|
-
value:
|
|
135
|
+
value: re,
|
|
135
136
|
yearOptions: y,
|
|
136
|
-
setYearOptions:
|
|
137
|
-
yearFilterLoading:
|
|
138
|
-
setYearFilterLoading:
|
|
137
|
+
setYearOptions: X,
|
|
138
|
+
yearFilterLoading: g,
|
|
139
|
+
setYearFilterLoading: Z,
|
|
139
140
|
onChange: (t, o) => {
|
|
140
|
-
|
|
141
|
+
ae(o);
|
|
141
142
|
},
|
|
142
|
-
resetKey:
|
|
143
|
+
resetKey: N,
|
|
144
|
+
wpApiBase: O ?? void 0
|
|
143
145
|
}
|
|
144
146
|
),
|
|
145
|
-
!a && /* @__PURE__ */
|
|
146
|
-
|
|
147
|
+
!a && /* @__PURE__ */ E(
|
|
148
|
+
me,
|
|
147
149
|
{
|
|
148
150
|
group: c,
|
|
149
|
-
placeholder:
|
|
150
|
-
allLabel:
|
|
151
|
+
placeholder: C,
|
|
152
|
+
allLabel: T,
|
|
151
153
|
noneLabel: b,
|
|
152
|
-
useSingleColumn:
|
|
153
|
-
enableTextSearch:
|
|
154
|
+
useSingleColumn: Y,
|
|
155
|
+
enableTextSearch: _,
|
|
154
156
|
filterType: F,
|
|
155
|
-
showNoDataOption:
|
|
157
|
+
showNoDataOption: I,
|
|
156
158
|
closeOnSelect: A,
|
|
157
159
|
allNoneSameBehaviour: B,
|
|
158
|
-
autoApply:
|
|
160
|
+
autoApply: w,
|
|
159
161
|
taxonomy: i,
|
|
160
|
-
type:
|
|
161
|
-
value: r ?
|
|
162
|
+
type: k,
|
|
163
|
+
value: r ? ee : te,
|
|
162
164
|
onChange: (t, o) => {
|
|
163
|
-
|
|
165
|
+
oe(o);
|
|
164
166
|
},
|
|
165
167
|
categories: S,
|
|
166
|
-
resetKey:
|
|
167
|
-
wpApiBase:
|
|
168
|
+
resetKey: N,
|
|
169
|
+
wpApiBase: O ?? void 0,
|
|
170
|
+
locale: H
|
|
168
171
|
},
|
|
169
172
|
`cat-${c}`
|
|
170
173
|
)
|
|
171
174
|
] });
|
|
172
|
-
};
|
|
175
|
+
}, Ee = fe(ye.memo(he));
|
|
173
176
|
export {
|
|
174
|
-
|
|
177
|
+
Ee as default
|
|
175
178
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { jsxs as p, jsx as
|
|
1
|
+
import { jsxs as p, jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import d from "react";
|
|
3
|
-
import { useDispatch as u, useSelector as
|
|
3
|
+
import { useDispatch as u, useSelector as a } from "react-redux";
|
|
4
4
|
import { Container as m, Icon as f } from "semantic-ui-react";
|
|
5
5
|
import I from "lodash.isequal";
|
|
6
|
-
|
|
6
|
+
import { injectIntl as g } from "react-intl";
|
|
7
|
+
const F = (i) => {
|
|
7
8
|
const {
|
|
8
9
|
"data-group": s,
|
|
9
10
|
"data-reset-label": l = "Reset All Filters"
|
|
10
|
-
} = i, c = u(),
|
|
11
|
+
} = i, c = u(), o = a((r) => r.getIn(["data", "posts", s])), t = a((r) => r.getIn(["data", "posts", "initialFilters", s])), e = d.useMemo(() => o && t ? !I(o, t) : !1, [o, t]);
|
|
11
12
|
return /* @__PURE__ */ p(
|
|
12
13
|
m,
|
|
13
14
|
{
|
|
@@ -28,12 +29,12 @@ const R = (i) => {
|
|
|
28
29
|
});
|
|
29
30
|
},
|
|
30
31
|
children: [
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ n("span", { children: l }),
|
|
33
|
+
/* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(f, { disabled: !e, name: "undo alternate", className: "custom-undo-icon" }) })
|
|
33
34
|
]
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
|
-
};
|
|
37
|
+
}, T = g(F);
|
|
37
38
|
export {
|
|
38
|
-
|
|
39
|
+
T as default
|
|
39
40
|
};
|
|
@@ -1,61 +1,64 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useDispatch as
|
|
4
|
-
import { Container as
|
|
5
|
-
import { injectIntl as
|
|
6
|
-
const
|
|
1
|
+
import { jsx as r, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import y, { useState as g, useRef as R, useEffect as p } from "react";
|
|
3
|
+
import { useDispatch as E, useSelector as u } from "react-redux";
|
|
4
|
+
import { Container as S, Dropdown as T, Icon as m } from "semantic-ui-react";
|
|
5
|
+
import { injectIntl as j } from "react-intl";
|
|
6
|
+
const k = (f) => {
|
|
7
7
|
const {
|
|
8
|
-
"data-group": i
|
|
9
|
-
|
|
8
|
+
"data-group": i,
|
|
9
|
+
"data-page-label": h = "Page",
|
|
10
|
+
"data-of-label": P = "of"
|
|
11
|
+
} = f, b = E(), t = u((e) => e.getIn(["data", "postsPagination", i])), o = u((e) => e.getIn(["data", "posts", i])), s = t && (t != null && t.totalPages) ? t.totalPages : 1, [a, d] = g((o == null ? void 0 : o.page) ?? 1), [v, w] = g([]), C = R(null), I = () => {
|
|
10
12
|
const e = [];
|
|
11
|
-
for (let
|
|
12
|
-
e.push({ key:
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
if (e === a || e < 1 || e >
|
|
16
|
-
d(e),
|
|
13
|
+
for (let n = 1; n <= s; n++)
|
|
14
|
+
e.push({ key: n, text: n, value: n });
|
|
15
|
+
w(e);
|
|
16
|
+
}, c = (e) => {
|
|
17
|
+
if (e === a || e < 1 || e > s) return;
|
|
18
|
+
d(e), b({
|
|
17
19
|
type: "SET_POSTS_FILTER",
|
|
18
20
|
group: i,
|
|
19
|
-
...
|
|
21
|
+
...o,
|
|
20
22
|
page: e
|
|
21
23
|
});
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
24
|
-
const
|
|
25
|
-
window.scrollTo({ top:
|
|
24
|
+
const n = document.getElementById(`filtered-posts-${i}`);
|
|
25
|
+
if (n) {
|
|
26
|
+
const x = n.getBoundingClientRect().top + window.scrollY - 50;
|
|
27
|
+
window.scrollTo({ top: x, behavior: "smooth" });
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
return p(() => {
|
|
29
|
-
|
|
31
|
+
I();
|
|
30
32
|
}, [t]), p(() => {
|
|
31
|
-
const e = (
|
|
33
|
+
const e = (o == null ? void 0 : o.page) ?? 1;
|
|
32
34
|
e !== a && d(e);
|
|
33
|
-
}, [
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
/* @__PURE__ */ r("span", { children:
|
|
35
|
+
}, [o == null ? void 0 : o.page]), /* @__PURE__ */ r("div", { ref: C, children: /* @__PURE__ */ l(S, { fluid: !0, className: "posts-pagination", children: [
|
|
36
|
+
/* @__PURE__ */ l("div", { className: "posts-pagination-dropdown", children: [
|
|
37
|
+
/* @__PURE__ */ r("span", { children: h }),
|
|
36
38
|
/* @__PURE__ */ r(
|
|
37
|
-
|
|
39
|
+
T,
|
|
38
40
|
{
|
|
39
|
-
options:
|
|
41
|
+
options: v,
|
|
40
42
|
placeholder: "Select Item",
|
|
41
43
|
selection: !0,
|
|
42
44
|
compact: !0,
|
|
43
45
|
value: a,
|
|
44
|
-
onChange: (e,
|
|
46
|
+
onChange: (e, n) => c(Number(n.value))
|
|
45
47
|
}
|
|
46
48
|
),
|
|
47
|
-
/* @__PURE__ */ r("div", { children: /* @__PURE__ */
|
|
48
|
-
|
|
49
|
+
/* @__PURE__ */ r("div", { children: /* @__PURE__ */ l("span", { children: [
|
|
50
|
+
P,
|
|
51
|
+
" ",
|
|
49
52
|
t && (t == null ? void 0 : t.totalPages)
|
|
50
53
|
] }) })
|
|
51
54
|
] }),
|
|
52
|
-
/* @__PURE__ */
|
|
55
|
+
/* @__PURE__ */ l("div", { children: [
|
|
53
56
|
/* @__PURE__ */ r(
|
|
54
57
|
m,
|
|
55
58
|
{
|
|
56
59
|
size: "large",
|
|
57
60
|
style: { cursor: "pointer" },
|
|
58
|
-
onClick: () =>
|
|
61
|
+
onClick: () => c(a - 1),
|
|
59
62
|
name: "angle left",
|
|
60
63
|
disabled: a === 1
|
|
61
64
|
}
|
|
@@ -65,14 +68,14 @@ const T = (f) => {
|
|
|
65
68
|
{
|
|
66
69
|
size: "large",
|
|
67
70
|
style: { cursor: "pointer" },
|
|
68
|
-
onClick: () =>
|
|
71
|
+
onClick: () => c(a + 1),
|
|
69
72
|
name: "angle right",
|
|
70
|
-
disabled: a ===
|
|
73
|
+
disabled: a === s
|
|
71
74
|
}
|
|
72
75
|
)
|
|
73
76
|
] })
|
|
74
77
|
] }) });
|
|
75
|
-
},
|
|
78
|
+
}, D = j(y.memo(k));
|
|
76
79
|
export {
|
|
77
|
-
|
|
80
|
+
D as default
|
|
78
81
|
};
|
|
@@ -1,50 +1,48 @@
|
|
|
1
1
|
import { Config as C } from "../../conf/index.js";
|
|
2
2
|
import { get as O } from "../../api/commons.js";
|
|
3
|
-
function
|
|
4
|
-
return JSON.parse(JSON.stringify(
|
|
3
|
+
function d(t) {
|
|
4
|
+
return JSON.parse(JSON.stringify(t));
|
|
5
5
|
}
|
|
6
|
-
const u = process.env.VITE_REACT_APP_API_ROOT || C.REACT_APP_API_ROOT || null, T = typeof window < "u" ? window.location.origin : "",
|
|
7
|
-
function
|
|
8
|
-
return Object.keys(
|
|
6
|
+
const u = process.env.VITE_REACT_APP_API_ROOT || C.REACT_APP_API_ROOT || null, T = typeof window < "u" ? window.location.origin : "", h = {}, f = {}, E = 3 * 60 * 1e3;
|
|
7
|
+
function P(t) {
|
|
8
|
+
return Object.keys(t).map((e) => encodeURIComponent(e) + "=" + encodeURIComponent(t[e])).join("&");
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const n =
|
|
12
|
-
if (
|
|
13
|
-
return Promise.resolve(
|
|
14
|
-
if (
|
|
15
|
-
return
|
|
16
|
-
const
|
|
17
|
-
delete
|
|
10
|
+
function $(t, e = !1) {
|
|
11
|
+
const n = t, r = Date.now();
|
|
12
|
+
if (f[n] && r - f[n].timestamp < E)
|
|
13
|
+
return Promise.resolve(d(f[n].data));
|
|
14
|
+
if (h[n])
|
|
15
|
+
return h[n].then(d);
|
|
16
|
+
const p = O(t, {}, e).then((a) => (f[n] = { data: a, timestamp: Date.now() }, e ? { data: d(a), meta: f[n].meta } : d(a))).finally(() => {
|
|
17
|
+
delete h[n];
|
|
18
18
|
});
|
|
19
|
-
return
|
|
19
|
+
return h[n] = p, p;
|
|
20
20
|
}
|
|
21
|
-
const k = ({ app:
|
|
22
|
-
const n = `${u || T}/api/${
|
|
23
|
-
return
|
|
24
|
-
}, V = ({ app:
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
}, J = ({ source:
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
}, L = ({ postType:
|
|
31
|
-
const
|
|
32
|
-
console.log("Using API base:", S);
|
|
33
|
-
const U = `${S}/wp/v2/${e}`, r = new URLSearchParams(), P = /* @__PURE__ */ new Map(), A = (s, i) => {
|
|
21
|
+
const k = ({ app: t, params: e }) => {
|
|
22
|
+
const n = `${u || T}/api/${t}/categories${e ? "?" + P(e) : ""}`;
|
|
23
|
+
return $(n);
|
|
24
|
+
}, V = ({ app: t, type: e, params: n }) => {
|
|
25
|
+
const r = `${u || ""}/api/${t}/categories/${e}${n ? "?" + P(n) : ""}`;
|
|
26
|
+
return $(r);
|
|
27
|
+
}, J = ({ source: t, app: e, params: n }) => {
|
|
28
|
+
const r = `${u || T}/api/${e}/stats/${t}${n ? "?" + P(n) : ""}`;
|
|
29
|
+
return $(r);
|
|
30
|
+
}, L = ({ postType: t, taxonomy: e, category: n, taxonomyFilters: r, before: p, perPage: a, page: _, locale: y, after: S, ordering: R, orderingDirection: I, wpApiBase: l }) => {
|
|
31
|
+
const q = `${l != null && l !== "" ? l : C.REACT_APP_WP_API}/wp/v2/${t}`, o = new URLSearchParams(), g = /* @__PURE__ */ new Map(), m = (s, i) => {
|
|
34
32
|
if (!s || i == null) return;
|
|
35
|
-
const c =
|
|
36
|
-
Array.isArray(i) ? i.forEach((
|
|
37
|
-
|
|
38
|
-
}) : c.push(String(i)),
|
|
33
|
+
const c = g.get(s) || [];
|
|
34
|
+
Array.isArray(i) ? i.forEach((A) => {
|
|
35
|
+
A != null && c.push(String(A));
|
|
36
|
+
}) : c.push(String(i)), g.set(s, c);
|
|
39
37
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}),
|
|
38
|
+
r && r instanceof Map && r.forEach((s, i) => {
|
|
39
|
+
m(i, s);
|
|
40
|
+
}), e && n != null && !g.has(e) && m(e, n), g.forEach((s, i) => {
|
|
43
41
|
const c = Array.from(new Set(s));
|
|
44
|
-
c.length !== 0 &&
|
|
45
|
-
}),
|
|
46
|
-
const w =
|
|
47
|
-
return O(`${
|
|
42
|
+
c.length !== 0 && o.set(i, c.join(","));
|
|
43
|
+
}), p && o.append("before", p.toISOString()), a && o.append("per_page", a.toString()), o.append("page", _.toString()), o.append("lang", y), S && o.append("after", S.toISOString()), o.append("orderby", R), o.append("order", I);
|
|
44
|
+
const w = o.toString().replace(/%2C/g, ",");
|
|
45
|
+
return O(`${q}?${w}`, {
|
|
48
46
|
headers: {
|
|
49
47
|
"Content-Type": "application/json"
|
|
50
48
|
}
|