@devgateway/dvz-ui-react 1.8.3 → 1.8.5
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),d=require("react"),o=require("semantic-ui-react"),l=require("@devgateway/wp-react-lib"),R=require("../connected-templates/PostIntro.js"),I=require("../connected-templates/PostContent.js"),L=require("react-intl"),k=j=>{const{posts:u,showIcons:w,showContentToggle:i,contentToggleHPosition:b,locale:T,readMoreLabel:h,readLessLabel:P}=j,[s,y]=d.useState({}),a=d.useRef({}),c=(e,n="Read More")=>e&&e.trim()!==""?e:n;d.useEffect(()=>{window.setTimeout(()=>{if(window.location.hash){const e=document.getElementById(window.location.hash.substr(1));e&&e.scrollIntoView({behavior:"auto",block:"start"})}},0)},[u]);const g=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1?n[1]:n[0]},m=e=>{const n=s[e]||!1,r=n?c(P,"Read less"):c(h,"Read more");return t.jsx("div",{children:t.jsx("div",{style:{display:"flex",justifyContent:b<33?"flex-start":b<66?"center":"flex-end"},children:t.jsx("a",{className:"link",onClick:()=>{var f;n&&a.current[e]&&((f=a.current[e])==null||f.scrollIntoView({behavior:"smooth",block:"start"}),a.current[e].scrollTop=0),y({...s,[e]:!n})},children:r})})})},x=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[],r=n.length>1?n[0]:null;return r?r.trim():null},C=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1&&n[1].trim().length>0};return t.jsx(o.Container,{fluid:!0,className:"inline list",children:u&&u.map(e=>t.jsxs(o.Grid,{children:[w&&t.jsxs(o.Grid.Column,{textAlign:"center",width:1,children:[t.jsx("a",{id:e.slug}),t.jsx(l.MediaProvider,{id:e.meta_fields&&e.meta_fields.icon?e.meta_fields.icon[0]:null,children:t.jsx(l.MediaConsumer,{children:t.jsx(l.PostIcon,{as:o.Label})})})]}),t.jsx(o.Grid.Column,{width:w?15:16,children:t.jsxs("div",{ref:n=>{a.current[e.slug]=n},children:[x(e)&&t.jsx(R.default,{as:o.Container,fluid:!0,post:e}),!x(e)&&t.jsx(I.default,{post:{content:{rendered:g(e)}},style:{clear:"both",display:"block"}}),C(e)&&t.jsxs(o.Container,{children:[i&&t.jsxs(t.Fragment,{children:[!s[e.slug]&&m(e.slug),t.jsx(I.default,{post:{content:{rendered:g(e)}},style:{clear:"both",display:s[e.slug]?"block":"none"}}),s[e.slug]&&m(e.slug)]}),!i&&t.jsx("a",{href:l.utils.replaceLink(e.link,T),className:"link",children:c(h)})]})]})})]}))})},v=j=>{const[u,w]=d.useState(Math.random()*99998+1),{locale:i}=L.useIntl(),{"data-width":b,"data-height":T,"data-type":h,"data-taxonomy":P,"data-categories":s,"data-items":y,"data-color":a,"data-show-post-icons":c,"data-show-content-toggle":g,"data-content-toggle-h-position":m,"data-read-more-label":x,"data-read-less-label":C,parent:e,editing:n,component:r,unique:f}=j;return t.jsx(o.Container,{fluid:!0,children:t.jsx(l.PostProvider,{type:h,locale:i,taxonomy:P,categories:s,store:"inline_list_"+e+"_"+f,page:1,perPage:y,children:t.jsx(l.PostConsumer,{children:t.jsx(k,{locale:i??"en",showIcons:c==="true",showContentToggle:g==="true",contentToggleHPosition:parseInt(m||"50",10),readMoreLabel:x,readLessLabel:C})})})})},q=L.injectIntl(d.memo(v));exports.default=q;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import R, { useState as
|
|
3
|
-
import { Container as
|
|
4
|
-
import { PostProvider as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
const
|
|
9
|
-
const { posts: c, showIcons:
|
|
10
|
-
|
|
1
|
+
import { jsx as o, jsxs as a, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import R, { useState as k, useRef as v, useEffect as M } from "react";
|
|
3
|
+
import { Container as f, Grid as C, Label as _ } from "semantic-ui-react";
|
|
4
|
+
import { PostProvider as j, PostConsumer as S, MediaProvider as B, MediaConsumer as H, PostIcon as N, utils as E } from "@devgateway/wp-react-lib";
|
|
5
|
+
import V from "../connected-templates/PostIntro.js";
|
|
6
|
+
import x from "../connected-templates/PostContent.js";
|
|
7
|
+
import { injectIntl as q, useIntl as A } from "react-intl";
|
|
8
|
+
const F = (w) => {
|
|
9
|
+
const { posts: c, showIcons: b, showContentToggle: s, contentToggleHPosition: P, locale: I, readMoreLabel: d, readLessLabel: y } = w, [n, p] = k({}), l = v({}), i = (t, e = "Read More") => t && t.trim() !== "" ? t : e;
|
|
10
|
+
M(() => {
|
|
11
11
|
window.setTimeout(
|
|
12
12
|
() => {
|
|
13
13
|
if (window.location.hash) {
|
|
@@ -22,45 +22,48 @@ const q = (f) => {
|
|
|
22
22
|
const e = t.content ? t.content.rendered.split("<!--more-->") : [];
|
|
23
23
|
return e.length > 1 ? e[1] : e[0];
|
|
24
24
|
}, m = (t) => {
|
|
25
|
-
const e = n[t] || !1, r = e ?
|
|
25
|
+
const e = n[t] || !1, r = e ? i(y, "Read less") : i(d, "Read more");
|
|
26
26
|
return /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("div", { style: {
|
|
27
27
|
display: "flex",
|
|
28
28
|
justifyContent: P < 33 ? "flex-start" : P < 66 ? "center" : "flex-end"
|
|
29
29
|
}, children: /* @__PURE__ */ o("a", { className: "link", onClick: () => {
|
|
30
|
-
|
|
30
|
+
var u;
|
|
31
|
+
e && l.current[t] && ((u = l.current[t]) == null || u.scrollIntoView({ behavior: "smooth", block: "start" }), l.current[t].scrollTop = 0), p({ ...n, [t]: !e });
|
|
31
32
|
}, children: r }) }) });
|
|
32
33
|
}, g = (t) => {
|
|
33
34
|
const e = t.content ? t.content.rendered.split("<!--more-->") : [], r = e.length > 1 ? e[0] : null;
|
|
34
35
|
return r ? r.trim() : null;
|
|
35
|
-
},
|
|
36
|
+
}, T = (t) => {
|
|
36
37
|
const e = t.content ? t.content.rendered.split("<!--more-->") : [];
|
|
37
38
|
return e.length > 1 && e[1].trim().length > 0;
|
|
38
39
|
};
|
|
39
|
-
return /* @__PURE__ */ o(
|
|
40
|
-
|
|
40
|
+
return /* @__PURE__ */ o(f, { fluid: !0, className: "inline list", children: c && c.map((t) => /* @__PURE__ */ a(C, { children: [
|
|
41
|
+
b && /* @__PURE__ */ a(C.Column, { textAlign: "center", width: 1, children: [
|
|
41
42
|
/* @__PURE__ */ o("a", { id: t.slug }),
|
|
42
43
|
/* @__PURE__ */ o(
|
|
43
|
-
|
|
44
|
+
B,
|
|
44
45
|
{
|
|
45
46
|
id: t.meta_fields && t.meta_fields.icon ? t.meta_fields.icon[0] : null,
|
|
46
|
-
children: /* @__PURE__ */ o(
|
|
47
|
+
children: /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o(N, { as: _ }) })
|
|
47
48
|
}
|
|
48
49
|
)
|
|
49
50
|
] }),
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
|
|
51
|
+
/* @__PURE__ */ o(C.Column, { width: b ? 15 : 16, children: /* @__PURE__ */ a("div", { ref: (e) => {
|
|
52
|
+
l.current[t.slug] = e;
|
|
53
|
+
}, children: [
|
|
54
|
+
g(t) && /* @__PURE__ */ o(V, { as: f, fluid: !0, post: t }),
|
|
52
55
|
!g(t) && /* @__PURE__ */ o(
|
|
53
|
-
|
|
56
|
+
x,
|
|
54
57
|
{
|
|
55
58
|
post: { content: { rendered: h(t) } },
|
|
56
59
|
style: { clear: "both", display: "block" }
|
|
57
60
|
}
|
|
58
61
|
),
|
|
59
|
-
|
|
60
|
-
s && /* @__PURE__ */
|
|
62
|
+
T(t) && /* @__PURE__ */ a(f, { children: [
|
|
63
|
+
s && /* @__PURE__ */ a(L, { children: [
|
|
61
64
|
!n[t.slug] && m(t.slug),
|
|
62
65
|
/* @__PURE__ */ o(
|
|
63
|
-
|
|
66
|
+
x,
|
|
64
67
|
{
|
|
65
68
|
post: { content: { rendered: h(t) } },
|
|
66
69
|
style: {
|
|
@@ -71,54 +74,54 @@ const q = (f) => {
|
|
|
71
74
|
),
|
|
72
75
|
n[t.slug] && m(t.slug)
|
|
73
76
|
] }),
|
|
74
|
-
!s && /* @__PURE__ */ o("a", { href:
|
|
77
|
+
!s && /* @__PURE__ */ o("a", { href: E.replaceLink(t.link, I), className: "link", children: i(d) })
|
|
75
78
|
] })
|
|
76
|
-
] })
|
|
79
|
+
] }) })
|
|
77
80
|
] })) });
|
|
78
|
-
},
|
|
79
|
-
const [c,
|
|
81
|
+
}, G = (w) => {
|
|
82
|
+
const [c, b] = k(Math.random() * 99998 + 1), { locale: s } = A(), {
|
|
80
83
|
"data-width": P,
|
|
81
|
-
"data-height":
|
|
84
|
+
"data-height": I,
|
|
82
85
|
"data-type": d,
|
|
83
|
-
"data-taxonomy":
|
|
86
|
+
"data-taxonomy": y,
|
|
84
87
|
"data-categories": n,
|
|
85
88
|
"data-items": p,
|
|
86
89
|
"data-color": l,
|
|
87
|
-
"data-show-post-icons":
|
|
90
|
+
"data-show-post-icons": i,
|
|
88
91
|
"data-show-content-toggle": h,
|
|
89
92
|
"data-content-toggle-h-position": m,
|
|
90
93
|
//horizontal position
|
|
91
94
|
"data-read-more-label": g,
|
|
92
|
-
"data-read-less-label":
|
|
95
|
+
"data-read-less-label": T,
|
|
93
96
|
parent: t,
|
|
94
97
|
editing: e,
|
|
95
98
|
component: r,
|
|
96
|
-
unique:
|
|
97
|
-
} =
|
|
98
|
-
return /* @__PURE__ */ o(
|
|
99
|
-
|
|
99
|
+
unique: u
|
|
100
|
+
} = w;
|
|
101
|
+
return /* @__PURE__ */ o(f, { fluid: !0, children: /* @__PURE__ */ o(
|
|
102
|
+
j,
|
|
100
103
|
{
|
|
101
104
|
type: d,
|
|
102
105
|
locale: s,
|
|
103
|
-
taxonomy:
|
|
106
|
+
taxonomy: y,
|
|
104
107
|
categories: n,
|
|
105
|
-
store: "inline_list_" + t + "_" +
|
|
108
|
+
store: "inline_list_" + t + "_" + u,
|
|
106
109
|
page: 1,
|
|
107
110
|
perPage: p,
|
|
108
111
|
children: /* @__PURE__ */ o(S, { children: /* @__PURE__ */ o(
|
|
109
|
-
|
|
112
|
+
F,
|
|
110
113
|
{
|
|
111
114
|
locale: s ?? "en",
|
|
112
|
-
showIcons:
|
|
115
|
+
showIcons: i === "true",
|
|
113
116
|
showContentToggle: h === "true",
|
|
114
117
|
contentToggleHPosition: parseInt(m || "50", 10),
|
|
115
118
|
readMoreLabel: g,
|
|
116
|
-
readLessLabel:
|
|
119
|
+
readLessLabel: T
|
|
117
120
|
}
|
|
118
121
|
) })
|
|
119
122
|
}
|
|
120
123
|
) });
|
|
121
|
-
};
|
|
124
|
+
}, W = q(R.memo(G));
|
|
122
125
|
export {
|
|
123
|
-
|
|
126
|
+
W as default
|
|
124
127
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
2
|
+
import { WrappedComponentProps } from 'react-intl';
|
|
3
|
+
interface InlineListProps extends WrappedComponentProps {
|
|
3
4
|
"data-width"?: string;
|
|
4
5
|
"data-height"?: string;
|
|
5
6
|
"data-type"?: string;
|
|
@@ -17,5 +18,7 @@ interface InlineListProps {
|
|
|
17
18
|
component?: string;
|
|
18
19
|
unique?: string;
|
|
19
20
|
}
|
|
20
|
-
declare const
|
|
21
|
-
|
|
21
|
+
declare const _default: React.FC<import('react-intl').WithIntlProps<InlineListProps>> & {
|
|
22
|
+
WrappedComponent: React.ComponentType<InlineListProps>;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|