@devgateway/dvz-ui-react 1.2.1 → 1.3.1
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/big-number-trend/index.js +1 -1
- package/dist/cjs/layout/Favicon.js +1 -0
- package/dist/cjs/layout/Layout.js +1 -0
- package/dist/cjs/layout/Loading.js +1 -0
- package/dist/cjs/layout/PreviewComponent.js +1 -0
- package/dist/cjs/layout/index.js +1 -1
- package/dist/esm/embeddable/big-number-trend/index.js +36 -36
- package/dist/esm/layout/Favicon.js +23 -0
- package/dist/esm/layout/Layout.js +45 -0
- package/dist/esm/layout/Loading.js +6 -0
- package/dist/esm/layout/PreviewComponent.js +30 -0
- package/dist/esm/layout/index.js +16 -8
- package/dist/types/layout/Favicon.d.ts +4 -0
- package/dist/types/layout/Layout.d.ts +3 -0
- package/dist/types/layout/Loading.d.ts +3 -0
- package/dist/types/layout/PreviewComponent.d.ts +3 -0
- package/dist/types/layout/index.d.ts +4 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),T=require("react"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),T=require("react"),V=require("semantic-ui-react"),_=require("../data/DataProvider.js"),A=require("../data/DataConsumer.js");require("@devgateway/wp-react-lib");const H=require("react-redux"),J=require("../utils/common.js"),$=require("string-template"),k=g=>{const{editing:c=!1,unique:h,intl:m,childContent:f,"data-csv":d="","data-dvz-proxy-dataset-id":x,"data-no-data-message":U="No data matches your selection","data-view-mode":b="info","data-height":v,"data-app":y,"data-measures":D="{}","data-format":C="{}","data-group":F,"data-filters":z="[]","data-text-color":e="#000000","data-big-number-font-size":i=20,"data-label-font-size":n=20,"data-percent-font-size":u=20,"data-label":p="","data-dimension1":o,"data-show-percentage-change":S="false","data-wait-for-filters":j="false","data-no-data-text":N="-"}=g,q=m.locale,I=T.useRef(null),s=r=>c?r:decodeURIComponent(r),l=r=>{try{return JSON.parse(s(r))}catch{console.error("error parsing value:"+r)}return null},t=l(C),O=t?{style:t.style==="compacted"?"decimal":t.style,notation:t.style==="compacted"?"compact":"standard",currency:t.currency,minimumFractionDigits:parseInt(t.minimumFractionDigits),maximumFractionDigits:parseInt(t.maximumFractionDigits)}:{notation:"standard",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2},[Q,W]=T.useState(b),E=c?v-80:v-40,w={},R=l(z)||{};R&&R.forEach&&R.forEach(r=>{r.value!=null&&r.value.filter(M=>M!=null&&M.toString().trim()!="").length>0&&(w[r.param]=r.value)}),x&&(w.dvzProxyDatasetId=x);const P=[];return o!="none"&&P.push(o),a.jsx("div",{ref:I,children:a.jsx(V.Container,{className:"chart container big-number-trend-container",style:{height:v+"px"},fluid:!0,children:a.jsx(_.default,{style:{height:`${E}px`},params:w,app:y,group:F,csv:d,editing:c,waitForFilters:j==="true",store:[y,h,...P],source:P.join("/"),children:a.jsx(A.default,{children:a.jsx(B,{editing:c,locale:q,intl:m,app:y,format:O,dimension1:o,measure:l(D)[0]||null,label:p,bigNumberFontSize:i,textColor:e,labelFontSize:n,percentFontSize:u,showPercentageChange:S=="true"||S==!0,noDataText:N})})})})})},B=g=>{const{editing:c,app:h,measure:m,dimension1:f,data:d,format:x,label:U,textColor:b,bigNumberFontSize:v,percentFontSize:y,labelFontSize:D,showPercentageChange:C,intl:F,noDataText:z}=g;let e=[],i,n;if(h=="csv"){const{data:s,meta:{fields:l}}=d;i=l[0],n=l[1],e=d.data.map(t=>({value:t[i],[n]:t[n],[i]:t[i]}))}else e=!d.children||d.children.length==0?[]:d.children,n=m,i=f,e=e.map(s=>({value:s.value,[n]:s[n],[i]:s.value}));let u=null,p=null,o,S,j;e.length>0&&(e=e.sort((s,l)=>J.alphaSort(!1,F.locale,s.value,l.value)),u=e[e.length-1][n],e.length>1&&(p=e[e.length-2][n]),j=F.formatNumber(x.style==="percent"?u/100:u,{...x}),p&&(o=(u-p)/p,S=F.formatNumber(o,{style:"percent",minimumFractionDigits:2,maximumFractionDigits:2}))),u==null&&(j=z);const N={color:decodeURIComponent(b),fontSize:v+"px"},q={color:decodeURIComponent(b),fontSize:y+"px"},I={color:decodeURIComponent(b),fontSize:D+"px"};return a.jsxs("div",{className:"trend",children:[a.jsx("div",{className:"label",style:I,children:$(U,e[e.length-1])}),a.jsxs("div",{className:"number-and-icon",children:[a.jsx("span",{className:"number",style:N,children:j}),o&&a.jsx("div",{className:o>0?"icon trend up":"icon trend down"})]}),C&&o&&a.jsx("div",{className:"percentage",style:q,children:S})]})},G=(g,c)=>{const{"data-app":h,"data-group":m}=c,f=g.getIn(["data","measures",h,m]);return f?{injectedMeasures:f}:{}},K={},L=H.connect(G,K)(k);exports.default=L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),o=require("react"),c=require("../conf/index.js");function s(){const[n,i]=o.useState(null);if(!n){const r=c.Config.REACT_APP_WP_API;fetch(r).then(e=>e.json()).then(e=>{e&&e.site_icon_url&&i(e.site_icon_url)}).catch(e=>{console.error("Failed to fetch favicon:",e)})}return t.jsx(t.Fragment,{children:n&&t.jsxs(t.Fragment,{children:[t.jsx("link",{rel:"icon",href:n}),t.jsx("link",{rel:"apple-touch-icon",href:n}),t.jsx("link",{rel:"shortcut",href:n})]})})}const l=o.memo(s);exports.default=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),r=require("react-router"),g=require("../embeddable/index.js"),l=require("react-intl"),s=require("@devgateway/wp-react-lib"),p=require("react-redux");require("semantic-ui-react");require("../utils/AppMedia.js");require("./Footer.js");require("./Header.js");const q=require("./Customizer.js");require("./Favicon.js");const f=require("../conf/index.js"),h=require("../translations/en.json.js"),x=require("../translations/fr.json.js"),j=require("../translations/af.json.js"),v=require("../lib/react-intl-redux/index.js");require("immutable");const i=require("../redux/store.js"),c={en:h,fr:x,am:j},w=l.injectIntl(o=>(document.title=o.settings.description,e.jsx(e.Fragment,{}))),C=()=>{const o=r.useParams(),d=r.useLocation(),n=f.Config.DEFAULT_LOCALE;console.log("defaultLocale",n);const t=o.lan,m=d.pathname;return console.log("pathParams",o),u.useEffect(()=>{process.env.NODE_ENV==="development"&&(console.log("----------.env-----------"),console.log(process.env),console.log("----------.env-----------")),window&&window.setTimeout(()=>{if(window&&window.location.hash){const a=document.getElementById(window.location.hash.substring(1));a&&a.scrollIntoView({behavior:"auto",block:"start"})}},2e3)},[]),u.useEffect(()=>{i.store.dispatch(v.updateIntl({locale:t,formats:{},messages:c[t??"en"]}))},[t]),t?Object.keys(c).includes(t)?e.jsx(p.Provider,{store:i.store,children:e.jsx(l.IntlProvider,{locale:t,messages:c[t],children:e.jsx(s.AppContextProvider,{getComponent:g.getComponentByNameIgnoreCase,store:i.store,locale:t,children:e.jsx(s.SettingProvider,{locale:t,changeUUID:null,children:e.jsxs(s.SettingsConsumer,{children:[e.jsx(q.CustomizerWrapper,{children:e.jsx(w,{})}),e.jsx(r.Outlet,{})]})})})},t)}):e.jsx(r.Navigate,{to:`/${n}${m}`,replace:!0}):e.jsx(r.Navigate,{to:n,replace:!0})};exports.default=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),r=require("semantic-ui-react"),t=()=>e.jsx(r.Segment,{className:"h-screen w-screen",children:e.jsx(r.Dimmer,{active:!0,inverted:!0,children:e.jsx(r.Loader,{size:"large",active:!0,inline:"centered",inverted:!0})})});exports.default=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),r=require("react"),o=require("react-router"),u=require("semantic-ui-react"),g=require("@devgateway/wp-react-lib"),w=require("../embeddable/index.js"),f=()=>{const m=o.useParams();o.useLocation();const[a]=r.useState(()=>w.getComponentByNameIgnoreCase(m.name??""));let[n,d]=o.useSearchParams();const i=l=>{console.log("-------------------------------reading message ----------------------------------------");const t=l.data;if(t.messageType&&t.messageType=="component-attributes"){const c={...n};Object.keys(t).forEach(s=>{c["data-"+s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()]=typeof t[s]=="object"?JSON.stringify(t[s]):t[s]}),d(c)}};r.useEffect(()=>(window.addEventListener("message",i,!1),window.parent&&window.parent.postMessage({type:"componentReady",value:!0},"*"),window.top&&window.top.postMessage({type:"componentReady",value:!0},"*"),()=>{window.removeEventListener("message",i)}),[]);const p=r.useMemo(()=>Object.fromEntries(n.entries()),[n]);return e.jsx("div",{children:e.jsx(u.Container,{fluid:!0,className:"editing",children:a?e.jsx(a,{...p,editing:!0}):e.jsx(u.Segment.Group,{color:"red",textAlign:"center",children:e.jsx("h1",{children:"Wrong Component Name"})})})})},j=()=>e.jsx(g.SettingsConsumer,{children:e.jsx(f,{})});exports.default=j;
|
package/dist/cjs/layout/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ResponsiveContainer.js"),r=require("./ScrollTop.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./ResponsiveContainer.js"),r=require("./ScrollTop.js"),o=require("./containers/PreviewPageContainer.js"),t=require("./containers/PreviewTypeContainer.js"),n=require("./containers/SlugContainer.js"),i=require("./containers/SlugPostContainer.js"),u=require("./Customizer.js"),a=require("./Layout.js"),l=require("./PreviewComponent.js"),s=require("./Favicon.js"),c=require("./Loading.js");exports.default=e.default;exports.ScrollToTop=r.default;exports.PreviewPageContainer=o.default;exports.PreviewTypeContainer=t.default;exports.SlugContainer=n.default;exports.SlugPostContainer=i.default;exports.CustomizerWrapper=u.CustomizerWrapper;exports.RootLayout=a.default;exports.PreviewComponent=l.default;exports.Favicon=s.default;exports.Loading=c.default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as o, jsxs as E } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as q, useState as A } from "react";
|
|
3
3
|
import { Container as H } from "semantic-ui-react";
|
|
4
4
|
import J from "../data/DataProvider.js";
|
|
5
5
|
import $ from "../data/DataConsumer.js";
|
|
@@ -10,14 +10,14 @@ import G from "string-template";
|
|
|
10
10
|
const K = (f) => {
|
|
11
11
|
const {
|
|
12
12
|
editing: c = !1,
|
|
13
|
-
unique:
|
|
13
|
+
unique: h,
|
|
14
14
|
intl: u,
|
|
15
|
-
childContent:
|
|
15
|
+
childContent: g,
|
|
16
16
|
"data-csv": m = "",
|
|
17
17
|
"data-dvz-proxy-dataset-id": b,
|
|
18
18
|
"data-no-data-message": T = "No data matches your selection",
|
|
19
|
-
"data-view-mode":
|
|
20
|
-
"data-height":
|
|
19
|
+
"data-view-mode": F = "info",
|
|
20
|
+
"data-height": v,
|
|
21
21
|
"data-app": x,
|
|
22
22
|
"data-measures": C = "{}",
|
|
23
23
|
"data-format": z = "{}",
|
|
@@ -31,15 +31,15 @@ const K = (f) => {
|
|
|
31
31
|
"data-dimension1": r,
|
|
32
32
|
"data-show-percentage-change": S = "false",
|
|
33
33
|
"data-wait-for-filters": D = "false",
|
|
34
|
-
"data-no-data-text":
|
|
35
|
-
} = f,
|
|
34
|
+
"data-no-data-text": I = "-"
|
|
35
|
+
} = f, w = u.locale, j = q(null), s = (n) => c ? n : decodeURIComponent(n), l = (n) => {
|
|
36
36
|
try {
|
|
37
37
|
return JSON.parse(s(n));
|
|
38
38
|
} catch {
|
|
39
39
|
console.error("error parsing value:" + n);
|
|
40
40
|
}
|
|
41
41
|
return null;
|
|
42
|
-
}, t = l(z),
|
|
42
|
+
}, t = l(z), O = t ? {
|
|
43
43
|
style: t.style === "compacted" ? "decimal" : t.style,
|
|
44
44
|
notation: t.style === "compacted" ? "compact" : "standard",
|
|
45
45
|
currency: t.currency,
|
|
@@ -50,31 +50,31 @@ const K = (f) => {
|
|
|
50
50
|
currency: "USD",
|
|
51
51
|
minimumFractionDigits: 2,
|
|
52
52
|
maximumFractionDigits: 2
|
|
53
|
-
}, [X, Y] =
|
|
53
|
+
}, [X, Y] = A(F), V = c ? v - 80 : v - 40, P = {}, M = l(N) || {};
|
|
54
54
|
M && M.forEach && M.forEach((n) => {
|
|
55
55
|
n.value != null && n.value.filter((U) => U != null && U.toString().trim() != "").length > 0 && (P[n.param] = n.value);
|
|
56
56
|
}), b && (P.dvzProxyDatasetId = b);
|
|
57
57
|
const R = [];
|
|
58
|
-
return r != "none" && R.push(r), /* @__PURE__ */ o("div", { ref: j, children: /* @__PURE__ */ o(H, { className: "chart container big-number-trend-container", style: { height:
|
|
58
|
+
return r != "none" && R.push(r), /* @__PURE__ */ o("div", { ref: j, children: /* @__PURE__ */ o(H, { className: "chart container big-number-trend-container", style: { height: v + "px" }, fluid: !0, children: /* @__PURE__ */ o(
|
|
59
59
|
J,
|
|
60
60
|
{
|
|
61
|
-
style: { height: `${
|
|
61
|
+
style: { height: `${V}px` },
|
|
62
62
|
params: P,
|
|
63
63
|
app: x,
|
|
64
64
|
group: y,
|
|
65
65
|
csv: m,
|
|
66
66
|
editing: c,
|
|
67
67
|
waitForFilters: D === "true",
|
|
68
|
-
store: [x,
|
|
68
|
+
store: [x, h, ...R],
|
|
69
69
|
source: R.join("/"),
|
|
70
70
|
children: /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(
|
|
71
71
|
L,
|
|
72
72
|
{
|
|
73
73
|
editing: c,
|
|
74
|
-
locale:
|
|
74
|
+
locale: w,
|
|
75
75
|
intl: u,
|
|
76
76
|
app: x,
|
|
77
|
-
format:
|
|
77
|
+
format: O,
|
|
78
78
|
dimension1: r,
|
|
79
79
|
measure: l(C)[0] || null,
|
|
80
80
|
label: p,
|
|
@@ -83,7 +83,7 @@ const K = (f) => {
|
|
|
83
83
|
labelFontSize: a,
|
|
84
84
|
percentFontSize: d,
|
|
85
85
|
showPercentageChange: S == "true" || S == !0,
|
|
86
|
-
noDataText:
|
|
86
|
+
noDataText: I
|
|
87
87
|
}
|
|
88
88
|
) })
|
|
89
89
|
}
|
|
@@ -91,14 +91,14 @@ const K = (f) => {
|
|
|
91
91
|
}, L = (f) => {
|
|
92
92
|
const {
|
|
93
93
|
editing: c,
|
|
94
|
-
app:
|
|
94
|
+
app: h,
|
|
95
95
|
measure: u,
|
|
96
|
-
dimension1:
|
|
96
|
+
dimension1: g,
|
|
97
97
|
data: m,
|
|
98
98
|
format: b,
|
|
99
99
|
label: T,
|
|
100
|
-
textColor:
|
|
101
|
-
bigNumberFontSize:
|
|
100
|
+
textColor: F,
|
|
101
|
+
bigNumberFontSize: v,
|
|
102
102
|
percentFontSize: x,
|
|
103
103
|
labelFontSize: C,
|
|
104
104
|
showPercentageChange: z,
|
|
@@ -106,7 +106,7 @@ const K = (f) => {
|
|
|
106
106
|
noDataText: N
|
|
107
107
|
} = f;
|
|
108
108
|
let e = [], i, a;
|
|
109
|
-
if (
|
|
109
|
+
if (h == "csv") {
|
|
110
110
|
const { data: s, meta: { fields: l } } = m;
|
|
111
111
|
i = l[0], a = l[1], e = m.data.map((t) => ({
|
|
112
112
|
value: t[i],
|
|
@@ -114,35 +114,35 @@ const K = (f) => {
|
|
|
114
114
|
[i]: t[i]
|
|
115
115
|
}));
|
|
116
116
|
} else
|
|
117
|
-
e = !m.children || m.children.length == 0 ? [] : m.children, a = u, i =
|
|
117
|
+
e = !m.children || m.children.length == 0 ? [] : m.children, a = u, i = g, e = e.map((s) => ({
|
|
118
118
|
value: s.value,
|
|
119
119
|
[a]: s[a],
|
|
120
120
|
[i]: s.value
|
|
121
121
|
}));
|
|
122
122
|
let d = null, p = null, r, S, D;
|
|
123
123
|
e.length > 0 && (e = e.sort((s, l) => B(!1, y.locale, s.value, l.value)), d = e[e.length - 1][a], e.length > 1 && (p = e[e.length - 2][a]), D = y.formatNumber(b.style === "percent" ? d / 100 : d, { ...b }), p && (r = (d - p) / p, S = y.formatNumber(r, { style: "percent", minimumFractionDigits: 2, maximumFractionDigits: 2 }))), d == null && (D = N);
|
|
124
|
-
const
|
|
125
|
-
color: decodeURIComponent(
|
|
126
|
-
fontSize:
|
|
127
|
-
},
|
|
128
|
-
color: decodeURIComponent(
|
|
124
|
+
const I = {
|
|
125
|
+
color: decodeURIComponent(F),
|
|
126
|
+
fontSize: v + "px"
|
|
127
|
+
}, w = {
|
|
128
|
+
color: decodeURIComponent(F),
|
|
129
129
|
fontSize: x + "px"
|
|
130
130
|
}, j = {
|
|
131
|
-
color: decodeURIComponent(
|
|
131
|
+
color: decodeURIComponent(F),
|
|
132
132
|
fontSize: C + "px"
|
|
133
133
|
};
|
|
134
|
-
return /* @__PURE__ */
|
|
134
|
+
return /* @__PURE__ */ E("div", { className: "trend", children: [
|
|
135
135
|
/* @__PURE__ */ o("div", { className: "label", style: j, children: G(T, e[e.length - 1]) }),
|
|
136
|
-
/* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */ o("span", { className: "number", style:
|
|
138
|
-
r && /* @__PURE__ */ o("
|
|
136
|
+
/* @__PURE__ */ E("div", { className: "number-and-icon", children: [
|
|
137
|
+
/* @__PURE__ */ o("span", { className: "number", style: I, children: D }),
|
|
138
|
+
r && /* @__PURE__ */ o("div", { className: r > 0 ? "icon trend up" : "icon trend down" })
|
|
139
139
|
] }),
|
|
140
|
-
z && r && /* @__PURE__ */ o("div", { className: "percentage", style:
|
|
140
|
+
z && r && /* @__PURE__ */ o("div", { className: "percentage", style: w, children: S })
|
|
141
141
|
] });
|
|
142
142
|
}, Q = (f, c) => {
|
|
143
|
-
const { "data-app":
|
|
144
|
-
return
|
|
145
|
-
injectedMeasures:
|
|
143
|
+
const { "data-app": h, "data-group": u } = c, g = f.getIn(["data", "measures", h, u]);
|
|
144
|
+
return g ? {
|
|
145
|
+
injectedMeasures: g
|
|
146
146
|
} : {};
|
|
147
147
|
}, W = {}, se = k(Q, W)(K);
|
|
148
148
|
export {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as t, Fragment as i, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import l, { useState as s } from "react";
|
|
3
|
+
import { Config as f } from "../conf/index.js";
|
|
4
|
+
function h() {
|
|
5
|
+
const [e, n] = s(null);
|
|
6
|
+
if (!e) {
|
|
7
|
+
const r = f.REACT_APP_WP_API;
|
|
8
|
+
fetch(r).then((o) => o.json()).then((o) => {
|
|
9
|
+
o && o.site_icon_url && n(o.site_icon_url);
|
|
10
|
+
}).catch((o) => {
|
|
11
|
+
console.error("Failed to fetch favicon:", o);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return /* @__PURE__ */ t(i, { children: e && /* @__PURE__ */ c(i, { children: [
|
|
15
|
+
/* @__PURE__ */ t("link", { rel: "icon", href: e }),
|
|
16
|
+
/* @__PURE__ */ t("link", { rel: "apple-touch-icon", href: e }),
|
|
17
|
+
/* @__PURE__ */ t("link", { rel: "shortcut", href: e })
|
|
18
|
+
] }) });
|
|
19
|
+
}
|
|
20
|
+
const _ = l.memo(h);
|
|
21
|
+
export {
|
|
22
|
+
_ as default
|
|
23
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as e, Fragment as p, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as m } from "react";
|
|
3
|
+
import { useParams as d, useLocation as u, Navigate as a, Outlet as g } from "react-router";
|
|
4
|
+
import { getComponentByNameIgnoreCase as h } from "../embeddable/index.js";
|
|
5
|
+
import { injectIntl as v, IntlProvider as w } from "react-intl";
|
|
6
|
+
import { AppContextProvider as C, SettingProvider as I, SettingsConsumer as L } from "@devgateway/wp-react-lib";
|
|
7
|
+
import { Provider as P } from "react-redux";
|
|
8
|
+
import "semantic-ui-react";
|
|
9
|
+
import "../utils/AppMedia.js";
|
|
10
|
+
import "./Footer.js";
|
|
11
|
+
import "./Header.js";
|
|
12
|
+
import { CustomizerWrapper as E } from "./Customizer.js";
|
|
13
|
+
import "./Favicon.js";
|
|
14
|
+
import { Config as j } from "../conf/index.js";
|
|
15
|
+
import * as b from "../translations/en.json.js";
|
|
16
|
+
import * as x from "../translations/fr.json.js";
|
|
17
|
+
import * as y from "../translations/af.json.js";
|
|
18
|
+
import { updateIntl as N } from "../lib/react-intl-redux/index.js";
|
|
19
|
+
import "immutable";
|
|
20
|
+
import { store as n } from "../redux/store.js";
|
|
21
|
+
const i = {
|
|
22
|
+
en: b,
|
|
23
|
+
fr: x,
|
|
24
|
+
am: y
|
|
25
|
+
}, O = v((t) => (document.title = t.settings.description, /* @__PURE__ */ e(p, {}))), J = () => {
|
|
26
|
+
const t = d(), l = u(), r = j.DEFAULT_LOCALE;
|
|
27
|
+
console.log("defaultLocale", r);
|
|
28
|
+
const o = t.lan, c = l.pathname;
|
|
29
|
+
return console.log("pathParams", t), m(() => {
|
|
30
|
+
process.env.NODE_ENV === "development" && (console.log("----------.env-----------"), console.log(process.env), console.log("----------.env-----------")), window && window.setTimeout(() => {
|
|
31
|
+
if (window && window.location.hash) {
|
|
32
|
+
const s = document.getElementById(window.location.hash.substring(1));
|
|
33
|
+
s && s.scrollIntoView({ behavior: "auto", block: "start" });
|
|
34
|
+
}
|
|
35
|
+
}, 2e3);
|
|
36
|
+
}, []), m(() => {
|
|
37
|
+
n.dispatch(N({ locale: o, formats: {}, messages: i[o ?? "en"] }));
|
|
38
|
+
}, [o]), o ? Object.keys(i).includes(o) ? /* @__PURE__ */ e(P, { store: n, children: /* @__PURE__ */ e(w, { locale: o, messages: i[o], children: /* @__PURE__ */ e(C, { getComponent: h, store: n, locale: o, children: /* @__PURE__ */ e(I, { locale: o, changeUUID: null, children: /* @__PURE__ */ f(L, { children: [
|
|
39
|
+
/* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(O, {}) }),
|
|
40
|
+
/* @__PURE__ */ e(g, {})
|
|
41
|
+
] }) }) }) }, o) }) : /* @__PURE__ */ e(a, { to: `/${r}${c}`, replace: !0 }) : /* @__PURE__ */ e(a, { to: r, replace: !0 });
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
J as default
|
|
45
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Segment as r, Dimmer as t, Loader as i } from "semantic-ui-react";
|
|
3
|
+
const c = () => /* @__PURE__ */ e(r, { className: "h-screen w-screen", children: /* @__PURE__ */ e(t, { active: !0, inverted: !0, children: /* @__PURE__ */ e(i, { size: "large", active: !0, inline: "centered", inverted: !0 }) }) });
|
|
4
|
+
export {
|
|
5
|
+
c as default
|
|
6
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import d, { useState as u, useEffect as g } from "react";
|
|
3
|
+
import { useParams as f, useLocation as l, useSearchParams as w } from "react-router";
|
|
4
|
+
import { Container as y, Segment as P } from "semantic-ui-react";
|
|
5
|
+
import { SettingsConsumer as C } from "@devgateway/wp-react-lib";
|
|
6
|
+
import { getComponentByNameIgnoreCase as h } from "../embeddable/index.js";
|
|
7
|
+
const v = () => {
|
|
8
|
+
const m = f();
|
|
9
|
+
l();
|
|
10
|
+
const [n] = u(() => h(m.name ?? ""));
|
|
11
|
+
let [r, i] = w();
|
|
12
|
+
const a = (c) => {
|
|
13
|
+
console.log("-------------------------------reading message ----------------------------------------");
|
|
14
|
+
const t = c.data;
|
|
15
|
+
if (t.messageType && t.messageType == "component-attributes") {
|
|
16
|
+
const s = { ...r };
|
|
17
|
+
Object.keys(t).forEach((o) => {
|
|
18
|
+
s["data-" + o.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()] = typeof t[o] == "object" ? JSON.stringify(t[o]) : t[o];
|
|
19
|
+
}), i(s);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
g(() => (window.addEventListener("message", a, !1), window.parent && window.parent.postMessage({ type: "componentReady", value: !0 }, "*"), window.top && window.top.postMessage({ type: "componentReady", value: !0 }, "*"), () => {
|
|
23
|
+
window.removeEventListener("message", a);
|
|
24
|
+
}), []);
|
|
25
|
+
const p = d.useMemo(() => Object.fromEntries(r.entries()), [r]);
|
|
26
|
+
return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(y, { fluid: !0, className: "editing", children: n ? /* @__PURE__ */ e(n, { ...p, editing: !0 }) : /* @__PURE__ */ e(P.Group, { color: "red", textAlign: "center", children: /* @__PURE__ */ e("h1", { children: "Wrong Component Name" }) }) }) });
|
|
27
|
+
}, N = () => /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(v, {}) });
|
|
28
|
+
export {
|
|
29
|
+
N as default
|
|
30
|
+
};
|
package/dist/esm/layout/index.js
CHANGED
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from "./ResponsiveContainer.js";
|
|
2
2
|
import { default as a } from "./ScrollTop.js";
|
|
3
3
|
import { default as p } from "./containers/PreviewPageContainer.js";
|
|
4
|
-
import { default as
|
|
4
|
+
import { default as l } from "./containers/PreviewTypeContainer.js";
|
|
5
5
|
import { default as s } from "./containers/SlugContainer.js";
|
|
6
|
-
import { default as
|
|
7
|
-
import { CustomizerWrapper as
|
|
6
|
+
import { default as i } from "./containers/SlugPostContainer.js";
|
|
7
|
+
import { CustomizerWrapper as x } from "./Customizer.js";
|
|
8
|
+
import { default as v } from "./Layout.js";
|
|
9
|
+
import { default as g } from "./PreviewComponent.js";
|
|
10
|
+
import { default as S } from "./Favicon.js";
|
|
11
|
+
import { default as c } from "./Loading.js";
|
|
8
12
|
export {
|
|
9
|
-
|
|
13
|
+
x as CustomizerWrapper,
|
|
14
|
+
S as Favicon,
|
|
15
|
+
c as Loading,
|
|
16
|
+
g as PreviewComponent,
|
|
10
17
|
p as PreviewPageContainer,
|
|
11
|
-
|
|
18
|
+
l as PreviewTypeContainer,
|
|
19
|
+
v as RootLayout,
|
|
12
20
|
a as ScrollToTop,
|
|
13
21
|
s as SlugContainer,
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
i as SlugPostContainer,
|
|
23
|
+
e as default
|
|
16
24
|
};
|
|
@@ -4,3 +4,7 @@ export * from './containers';
|
|
|
4
4
|
export * from './Customizer';
|
|
5
5
|
export default ResponsiveContainer;
|
|
6
6
|
export { ScrollToTop };
|
|
7
|
+
export { default as RootLayout } from './Layout';
|
|
8
|
+
export { default as PreviewComponent } from './PreviewComponent';
|
|
9
|
+
export { default as Favicon } from './Favicon';
|
|
10
|
+
export { default as Loading } from './Loading';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devgateway/dvz-ui-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"string-template": "^1.0.0",
|
|
81
81
|
"topojson-client": "^3.1.0",
|
|
82
82
|
"uuid": "^11.1.0",
|
|
83
|
-
"@devgateway/wp-react-lib": "0.4.
|
|
83
|
+
"@devgateway/wp-react-lib": "0.4.4"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@eslint/js": "^9.26.0",
|