@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,65 +1,65 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { Container as
|
|
4
|
-
import { PostProvider as
|
|
5
|
-
import { injectIntl as
|
|
6
|
-
import { connect as
|
|
7
|
-
import
|
|
8
|
-
import { useWindowDimensionsAndDevice as
|
|
9
|
-
const
|
|
10
|
-
|
|
1
|
+
import { jsx as e, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import y, { useState as v, useRef as G, useEffect as I } from "react";
|
|
3
|
+
import { Container as f, Accordion as p, Icon as V, Menu as T, Grid as w, Label as M, Button as W } from "semantic-ui-react";
|
|
4
|
+
import { PostProvider as q, PostConsumer as N, MediaProvider as P, MediaConsumer as k, PostIcon as L, PostLabel as S } from "@devgateway/wp-react-lib";
|
|
5
|
+
import { injectIntl as E } from "react-intl";
|
|
6
|
+
import { connect as z } from "react-redux";
|
|
7
|
+
import A from "../connected-templates/PostIntro.js";
|
|
8
|
+
import { useWindowDimensionsAndDevice as O } from "../../lib/hooks/window-dimensions.js";
|
|
9
|
+
const U = ({ posts: t, activeItem: a, setActive: i, showLabels: n }) => t ? t.map((l) => /* @__PURE__ */ e(
|
|
10
|
+
T.Item,
|
|
11
11
|
{
|
|
12
|
-
onClick: () => i(
|
|
13
|
-
className:
|
|
14
|
-
children: n ? /* @__PURE__ */ e(
|
|
12
|
+
onClick: () => i(l.slug),
|
|
13
|
+
className: l.slug === a ? "active" : "",
|
|
14
|
+
children: n ? /* @__PURE__ */ e(S, { post: l }) : /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: l.title.rendered } }) })
|
|
15
15
|
},
|
|
16
|
-
|
|
17
|
-
)) : null,
|
|
16
|
+
l.id
|
|
17
|
+
)) : null, Y = ({
|
|
18
18
|
posts: t,
|
|
19
|
-
activeItem:
|
|
19
|
+
activeItem: a,
|
|
20
20
|
setActive: i,
|
|
21
21
|
showIcons: n,
|
|
22
|
-
showLabels:
|
|
22
|
+
showLabels: l
|
|
23
23
|
}) => {
|
|
24
|
-
const
|
|
25
|
-
return t ? t.map((
|
|
26
|
-
var
|
|
27
|
-
return (
|
|
28
|
-
|
|
24
|
+
const o = t.length;
|
|
25
|
+
return t ? t.map((r) => {
|
|
26
|
+
var d, m;
|
|
27
|
+
return (d = r._embedded) != null && d["wp:featuredmedia"] && r._embedded["wp:featuredmedia"][0].source_url, /* @__PURE__ */ e(
|
|
28
|
+
w.Column,
|
|
29
29
|
{
|
|
30
|
-
className: (
|
|
31
|
-
children: /* @__PURE__ */
|
|
32
|
-
|
|
30
|
+
className: (r.slug === a ? "active" : "") + (n ? " has-icon" : ""),
|
|
31
|
+
children: /* @__PURE__ */ g(
|
|
32
|
+
W,
|
|
33
33
|
{
|
|
34
|
-
onClick: () => i(
|
|
35
|
-
className: `nav ${
|
|
34
|
+
onClick: () => i(r.slug),
|
|
35
|
+
className: `nav ${o === 1 ? "one" : ""}`,
|
|
36
36
|
children: [
|
|
37
37
|
n && /* @__PURE__ */ e(
|
|
38
|
-
|
|
38
|
+
P,
|
|
39
39
|
{
|
|
40
|
-
id: (
|
|
41
|
-
children: /* @__PURE__ */ e(
|
|
40
|
+
id: (m = r.meta_fields) != null && m.icon ? r.meta_fields.icon[0] : null,
|
|
41
|
+
children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(L, { className: "icon" }) })
|
|
42
42
|
}
|
|
43
43
|
),
|
|
44
|
-
|
|
44
|
+
l ? /* @__PURE__ */ e(S, { post: r }) : /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(
|
|
45
45
|
"span",
|
|
46
46
|
{
|
|
47
|
-
dangerouslySetInnerHTML: { __html:
|
|
47
|
+
dangerouslySetInnerHTML: { __html: r.title.rendered }
|
|
48
48
|
}
|
|
49
49
|
) })
|
|
50
50
|
]
|
|
51
51
|
}
|
|
52
52
|
)
|
|
53
53
|
},
|
|
54
|
-
|
|
54
|
+
r.id
|
|
55
55
|
);
|
|
56
56
|
}) : null;
|
|
57
|
-
},
|
|
57
|
+
}, $ = ({ posts: t, activeItem: a }) => (I(() => {
|
|
58
58
|
const i = document.querySelector(".ui.container.content-tab");
|
|
59
59
|
i && (i.scrollTop = 0);
|
|
60
|
-
}, [
|
|
60
|
+
}, [a]), t ? t.map((i) => {
|
|
61
61
|
let n = {};
|
|
62
|
-
return i.slug !==
|
|
62
|
+
return i.slug !== a ? n = {
|
|
63
63
|
position: "absolute",
|
|
64
64
|
left: "-3000px",
|
|
65
65
|
width: "auto",
|
|
@@ -70,91 +70,35 @@ const se = ({ posts: t, activeItem: s, setActive: i, showLabels: n }) => t ? t.m
|
|
|
70
70
|
visibility: "visible",
|
|
71
71
|
position: "relative",
|
|
72
72
|
width: "auto"
|
|
73
|
-
}, /* @__PURE__ */ e(
|
|
74
|
-
}) : null),
|
|
75
|
-
const [n,
|
|
76
|
-
t.findIndex((
|
|
77
|
-
), [
|
|
78
|
-
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
73
|
+
}, /* @__PURE__ */ e(A, { as: f, fluid: !0, post: i, style: n }, i.slug);
|
|
74
|
+
}) : null), J = ({ posts: t, activeItem: a, setActive: i }) => {
|
|
75
|
+
const [n, l] = v(
|
|
76
|
+
t.findIndex((s) => s.slug === a)
|
|
77
|
+
), [o, r] = v(null), d = G(null);
|
|
78
|
+
I(() => {
|
|
79
|
+
if (o) {
|
|
80
|
+
const s = o.getBoundingClientRect().top + window.scrollY;
|
|
81
81
|
window.scrollTo({
|
|
82
|
-
top:
|
|
82
|
+
top: s,
|
|
83
83
|
behavior: "smooth"
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
|
-
}, [
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}, [m, L] = p(v()), g = () => {
|
|
91
|
-
setTimeout(() => {
|
|
92
|
-
L(v()), A(window.innerWidth <= 1250);
|
|
93
|
-
}, 100);
|
|
94
|
-
}, P = (o) => {
|
|
95
|
-
setTimeout(() => {
|
|
96
|
-
var d;
|
|
97
|
-
const u = o.querySelectorAll(
|
|
98
|
-
".accordion .legends.container.has-standard-12-font-size.bottom, .legends.container.items-section"
|
|
99
|
-
);
|
|
100
|
-
if (u.length !== 0)
|
|
101
|
-
for (const a of u) {
|
|
102
|
-
const x = a.closest(".ui.fluid.container.content"), f = x ? x.querySelector(".data-source") : null;
|
|
103
|
-
if (!f || a.offsetParent === null || f.offsetParent === null || a.offsetHeight === 0 || f.offsetHeight === 0)
|
|
104
|
-
continue;
|
|
105
|
-
const I = f.getBoundingClientRect(), D = a.getBoundingClientRect(), X = window.getComputedStyle(f), H = window.getComputedStyle(a), Z = Number.parseFloat(X.marginTop) || 0, ee = Number.parseFloat(H.marginBottom) || 0, M = D.bottom + ee, W = I.top - Z;
|
|
106
|
-
if (M > W) {
|
|
107
|
-
const C = M - W;
|
|
108
|
-
f.style.marginTop = `${C + 20}px`;
|
|
109
|
-
}
|
|
110
|
-
const N = (d = a.closest(
|
|
111
|
-
".wp-block-column.is-layout-flow.wp-block-column-is-layout-flow"
|
|
112
|
-
)) == null ? void 0 : d.nextElementSibling;
|
|
113
|
-
if (N) {
|
|
114
|
-
const C = N.getBoundingClientRect(), k = window.getComputedStyle(N), $ = Number.parseFloat(k.marginTop) || 0, y = C.top - $;
|
|
115
|
-
if (M > y) {
|
|
116
|
-
const j = M - y;
|
|
117
|
-
N.style.marginTop = `${j + 20}px`;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
const R = a.closest(".chart.container");
|
|
121
|
-
if (R) {
|
|
122
|
-
const C = R.getBoundingClientRect(), k = window.getComputedStyle(R), $ = Number.parseFloat(k.marginBottom) || 0, y = C.bottom + $, j = Number.parseFloat(H.marginTop) || 0, O = D.top - j;
|
|
123
|
-
if (O < y) {
|
|
124
|
-
const te = y - O;
|
|
125
|
-
a.style.marginTop = `${te + 20}px`;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}, 10);
|
|
130
|
-
};
|
|
131
|
-
T(() => (window.screen.orientation && window.screen.orientation.addEventListener(
|
|
132
|
-
"change",
|
|
133
|
-
g
|
|
134
|
-
), window.addEventListener("resize", g), () => window.removeEventListener("resize", g)), []), T(() => {
|
|
135
|
-
let o;
|
|
136
|
-
const u = [];
|
|
137
|
-
return n !== -1 && (o = setTimeout(() => {
|
|
138
|
-
document.querySelectorAll(".accordion").forEach((a) => P(a));
|
|
139
|
-
}, 0)), () => {
|
|
140
|
-
clearTimeout(o), u.forEach((d) => d.disconnect());
|
|
141
|
-
};
|
|
142
|
-
}, [n, w, m]);
|
|
143
|
-
const B = (o, u) => {
|
|
144
|
-
const { index: d } = u, a = n === d ? -1 : d;
|
|
145
|
-
r(a), i(t[d].slug), a !== -1 && c(o.currentTarget);
|
|
86
|
+
}, [o]);
|
|
87
|
+
const m = (s, u) => {
|
|
88
|
+
const { index: c } = u, h = n === c ? -1 : c;
|
|
89
|
+
l(h), i(t[c].slug), h !== -1 && r(s.currentTarget);
|
|
146
90
|
};
|
|
147
|
-
return /* @__PURE__ */ e(
|
|
148
|
-
var
|
|
149
|
-
const
|
|
150
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ e(p, { fluid: !0, styled: !0, children: t.map((s, u) => {
|
|
92
|
+
var h;
|
|
93
|
+
const c = (h = s.meta_fields) != null && h.icon ? s.meta_fields.icon[0] : null;
|
|
94
|
+
return /* @__PURE__ */ g(y.Fragment, { children: [
|
|
151
95
|
/* @__PURE__ */ e(
|
|
152
|
-
|
|
96
|
+
p.Title,
|
|
153
97
|
{
|
|
154
98
|
active: n === u,
|
|
155
99
|
index: u,
|
|
156
|
-
onClick:
|
|
157
|
-
children: /* @__PURE__ */
|
|
100
|
+
onClick: m,
|
|
101
|
+
children: /* @__PURE__ */ g(
|
|
158
102
|
"div",
|
|
159
103
|
{
|
|
160
104
|
style: {
|
|
@@ -164,100 +108,100 @@ const se = ({ posts: t, activeItem: s, setActive: i, showLabels: n }) => t ? t.m
|
|
|
164
108
|
width: "100%"
|
|
165
109
|
},
|
|
166
110
|
children: [
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
|
|
111
|
+
/* @__PURE__ */ g("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
112
|
+
c && /* @__PURE__ */ e(P, { id: c, children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(L, { className: "icon" }) }) }),
|
|
169
113
|
/* @__PURE__ */ e(
|
|
170
114
|
"span",
|
|
171
115
|
{
|
|
172
|
-
dangerouslySetInnerHTML: { __html:
|
|
173
|
-
style: { marginLeft:
|
|
116
|
+
dangerouslySetInnerHTML: { __html: s.title.rendered },
|
|
117
|
+
style: { marginLeft: c ? "10px" : "0" }
|
|
174
118
|
}
|
|
175
119
|
)
|
|
176
120
|
] }),
|
|
177
|
-
/* @__PURE__ */ e(
|
|
121
|
+
/* @__PURE__ */ e(V, { name: "chevron down" })
|
|
178
122
|
]
|
|
179
123
|
}
|
|
180
124
|
)
|
|
181
125
|
}
|
|
182
126
|
),
|
|
183
127
|
/* @__PURE__ */ e(
|
|
184
|
-
|
|
128
|
+
p.Content,
|
|
185
129
|
{
|
|
186
130
|
className: "accordion-post-content",
|
|
187
131
|
active: n === u,
|
|
188
|
-
children: /* @__PURE__ */ e("div", { ref:
|
|
132
|
+
children: /* @__PURE__ */ e("div", { ref: d, children: /* @__PURE__ */ e(A, { post: s, as: f, fluid: !0 }) })
|
|
189
133
|
}
|
|
190
134
|
)
|
|
191
|
-
] },
|
|
135
|
+
] }, s.id);
|
|
192
136
|
}) });
|
|
193
|
-
},
|
|
194
|
-
const [n,
|
|
195
|
-
return
|
|
137
|
+
}, K = ({ posts: t, showLabels: a, height: i }) => {
|
|
138
|
+
const [n, l] = v(t ? t[0].slug : null);
|
|
139
|
+
return I(() => {
|
|
196
140
|
setTimeout(() => {
|
|
197
141
|
if (window.location.hash) {
|
|
198
|
-
const
|
|
199
|
-
|
|
142
|
+
const o = window.location.hash.substr(1), r = document.getElementById(o);
|
|
143
|
+
r && t.map((d) => d.slug).indexOf(o) > -1 && (l(o), r.scrollIntoView({ behavior: "auto", block: "start" }));
|
|
200
144
|
}
|
|
201
145
|
}, 0);
|
|
202
|
-
}, [t]), /* @__PURE__ */
|
|
203
|
-
t.map((
|
|
204
|
-
/* @__PURE__ */ e(
|
|
205
|
-
/* @__PURE__ */ e(
|
|
146
|
+
}, [t]), /* @__PURE__ */ g(y.Fragment, { children: [
|
|
147
|
+
t.map((o) => /* @__PURE__ */ e("anchor", { id: o.slug }, o.slug)),
|
|
148
|
+
/* @__PURE__ */ e(T, { className: "tabbed posts", text: !0, children: /* @__PURE__ */ e(U, { showLabels: a, posts: t, setActive: l, activeItem: n }) }),
|
|
149
|
+
/* @__PURE__ */ e(f, { className: "content-tab", style: { height: `${i}px` }, children: /* @__PURE__ */ e($, { posts: t, activeItem: n }) })
|
|
206
150
|
] });
|
|
207
|
-
},
|
|
208
|
-
const [
|
|
209
|
-
return /* @__PURE__ */ e(
|
|
210
|
-
/* @__PURE__ */ e(
|
|
211
|
-
/* @__PURE__ */ e(
|
|
151
|
+
}, Q = ({ posts: t, showLabels: a, showIcons: i, height: n }) => {
|
|
152
|
+
const [l, o] = v(t ? t[0].slug : null);
|
|
153
|
+
return /* @__PURE__ */ e(y.Fragment, { children: /* @__PURE__ */ g(w, { stackable: !0, className: "tabbed posts", columns: t.length, style: { height: n + "px" }, children: [
|
|
154
|
+
/* @__PURE__ */ e(Y, { showIcons: i, showLabels: a, posts: t, activeItem: l, setActive: o }),
|
|
155
|
+
/* @__PURE__ */ e(w.Row, { style: { height: `${n}px` }, children: /* @__PURE__ */ e(w.Column, { width: 16, className: "content", children: /* @__PURE__ */ e(f, { className: "content-tab", style: { height: `${n}px` }, children: /* @__PURE__ */ e($, { className: "content-tab", posts: t, activeItem: l }) }) }) })
|
|
212
156
|
] }) });
|
|
213
|
-
},
|
|
214
|
-
var
|
|
157
|
+
}, X = (t) => {
|
|
158
|
+
var _;
|
|
215
159
|
let {
|
|
216
|
-
"data-type":
|
|
160
|
+
"data-type": a,
|
|
217
161
|
"data-taxonomy": i,
|
|
218
162
|
"data-categories": n,
|
|
219
|
-
"data-items":
|
|
220
|
-
"data-theme":
|
|
221
|
-
"data-show-icons":
|
|
222
|
-
"data-use-scrolls":
|
|
223
|
-
"data-show-labels":
|
|
224
|
-
"data-height":
|
|
225
|
-
"data-preview-mode":
|
|
226
|
-
pageModuleProps:
|
|
227
|
-
parent:
|
|
228
|
-
editing:
|
|
229
|
-
unique:
|
|
163
|
+
"data-items": l,
|
|
164
|
+
"data-theme": o = "light",
|
|
165
|
+
"data-show-icons": r,
|
|
166
|
+
"data-use-scrolls": d,
|
|
167
|
+
"data-show-labels": m,
|
|
168
|
+
"data-height": s,
|
|
169
|
+
"data-preview-mode": u = "Desktop",
|
|
170
|
+
pageModuleProps: c,
|
|
171
|
+
parent: h,
|
|
172
|
+
editing: b,
|
|
173
|
+
unique: D
|
|
230
174
|
} = t;
|
|
231
|
-
|
|
232
|
-
const
|
|
233
|
-
return /* @__PURE__ */ e(
|
|
234
|
-
|
|
175
|
+
c != null && c.previewMode && (c != null && c.editing) && (u = c.previewMode, b = c.editing);
|
|
176
|
+
const R = t.intl.locale, x = d === "true", C = x ? s : void 0, { width: j } = O(), H = j <= 1024, B = u !== "Desktop" && b, F = H && !b;
|
|
177
|
+
return /* @__PURE__ */ e(f, { className: `viz tabbed posts ${b ? "editing" : ""} ${x ? "scrollable" : ""}`, fluid: !0, children: /* @__PURE__ */ e(
|
|
178
|
+
q,
|
|
235
179
|
{
|
|
236
|
-
locale:
|
|
237
|
-
type:
|
|
180
|
+
locale: R,
|
|
181
|
+
type: a,
|
|
238
182
|
taxonomy: i,
|
|
239
183
|
categories: n,
|
|
240
|
-
store: `tabbedposts_${
|
|
184
|
+
store: `tabbedposts_${h}_${D}`,
|
|
241
185
|
page: 1,
|
|
242
|
-
perPage:
|
|
243
|
-
children: /* @__PURE__ */ e(
|
|
244
|
-
} }) :
|
|
245
|
-
|
|
186
|
+
perPage: l,
|
|
187
|
+
children: /* @__PURE__ */ e(N, { children: /* @__PURE__ */ e(N, { children: F || B ? /* @__PURE__ */ e(J, { posts: l, activeItem: (_ = l[0]) == null ? void 0 : _.slug, setActive: () => {
|
|
188
|
+
} }) : o === "light" ? /* @__PURE__ */ e(K, { height: C, showLabels: m === "true" }) : /* @__PURE__ */ e(
|
|
189
|
+
Q,
|
|
246
190
|
{
|
|
247
|
-
height:
|
|
248
|
-
showLabels:
|
|
249
|
-
showIcons:
|
|
191
|
+
height: C,
|
|
192
|
+
showLabels: m === "true",
|
|
193
|
+
showIcons: r === "true"
|
|
250
194
|
}
|
|
251
195
|
) }) })
|
|
252
196
|
}
|
|
253
197
|
) });
|
|
254
|
-
},
|
|
198
|
+
}, Z = (t, a) => {
|
|
255
199
|
const i = t.getIn([
|
|
256
200
|
"data",
|
|
257
201
|
"pageModuleProps"
|
|
258
202
|
]), n = {};
|
|
259
203
|
return i && (n.pageModuleProps = i), n;
|
|
260
|
-
},
|
|
204
|
+
}, ee = {}, se = z(Z, ee)(E(X));
|
|
261
205
|
export {
|
|
262
|
-
|
|
206
|
+
se as default
|
|
263
207
|
};
|