@devgateway/dvz-ui-react 1.9.13 → 1.9.14

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 e=require("react/jsx-runtime"),r=require("react"),u=require("react-router"),m=require("semantic-ui-react"),w=require("@devgateway/wp-react-lib"),f=require("../embeddable/index.js"),P=()=>{const d=u.useParams(),[p]=u.useSearchParams(),[o]=r.useState(()=>f.getComponentByNameIgnoreCase(d.name??"")),[n,l]=r.useState(()=>Object.fromEntries(p.entries())),i=r.useRef(n);i.current=n;const a=r.useCallback(g=>{const t=g.data;if(t.messageType&&t.messageType==="component-attributes"){const c={...i.current};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]}),l(c)}},[]);return r.useEffect(()=>(window.addEventListener("message",a,!1),window.parent&&window.parent.postMessage({type:"componentReady",value:!0},"*"),window.top&&window.top.postMessage({type:"componentReady",value:!0},"*"),()=>{window.removeEventListener("message",a)}),[a]),e.jsx("div",{children:e.jsx(m.Container,{fluid:!0,className:"editing",children:o?e.jsx(o,{...n,editing:!0}):e.jsx(m.Segment.Group,{color:"red",textAlign:"center",children:e.jsx("h1",{children:"Wrong Component Name"})})})})},j=()=>e.jsx(w.SettingsConsumer,{children:e.jsx(P,{})});exports.default=j;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),s=require("react"),u=require("react-router"),m=require("semantic-ui-react"),w=require("@devgateway/wp-react-lib"),f=require("../embeddable/index.js"),P=()=>{const d=u.useParams(),[p]=u.useSearchParams(),[o]=s.useState(()=>f.getComponentByNameIgnoreCase(d.name??"")),[n,l]=s.useState(()=>Object.fromEntries(p.entries())),i=s.useRef(n);i.current=n;const a=s.useCallback(g=>{const e=g.data;if(e.messageType&&e.messageType==="component-attributes"){const c={...i.current};Object.keys(e).forEach(r=>{c["data-"+r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()]=typeof e[r]=="object"?Array.isArray(e[r])?e[r].join(","):JSON.stringify(e[r]):e[r]}),l(c)}},[]);return s.useEffect(()=>(window.addEventListener("message",a,!1),window.parent&&window.parent.postMessage({type:"componentReady",value:!0},"*"),window.top&&window.top.postMessage({type:"componentReady",value:!0},"*"),()=>{window.removeEventListener("message",a)}),[a]),t.jsx("div",{children:t.jsx(m.Container,{fluid:!0,className:"editing",children:o?t.jsx(o,{...n,editing:!0}):t.jsx(m.Segment.Group,{color:"red",textAlign:"center",children:t.jsx("h1",{children:"Wrong Component Name"})})})})},j=()=>t.jsx(w.SettingsConsumer,{children:t.jsx(P,{})});exports.default=j;
@@ -1,4 +1,4 @@
1
- import { jsx as e } from "react/jsx-runtime";
1
+ import { jsx as r } from "react/jsx-runtime";
2
2
  import { useState as i, useRef as f, useCallback as g, useEffect as l } from "react";
3
3
  import { useParams as w, useSearchParams as P } from "react-router";
4
4
  import { Container as y, Segment as C } from "semantic-ui-react";
@@ -10,18 +10,18 @@ const b = () => {
10
10
  ), s = f(o);
11
11
  s.current = o;
12
12
  const n = g((u) => {
13
- const t = u.data;
14
- if (t.messageType && t.messageType === "component-attributes") {
13
+ const e = u.data;
14
+ if (e.messageType && e.messageType === "component-attributes") {
15
15
  const m = { ...s.current };
16
- Object.keys(t).forEach((r) => {
17
- m["data-" + r.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()] = typeof t[r] == "object" ? JSON.stringify(t[r]) : t[r];
16
+ Object.keys(e).forEach((t) => {
17
+ m["data-" + t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()] = typeof e[t] == "object" ? Array.isArray(e[t]) ? e[t].join(",") : JSON.stringify(e[t]) : e[t];
18
18
  }), d(m);
19
19
  }
20
20
  }, []);
21
21
  return l(() => (window.addEventListener("message", n, !1), window.parent && window.parent.postMessage({ type: "componentReady", value: !0 }, "*"), window.top && window.top.postMessage({ type: "componentReady", value: !0 }, "*"), () => {
22
22
  window.removeEventListener("message", n);
23
- }), [n]), /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(y, { fluid: !0, className: "editing", children: a ? /* @__PURE__ */ e(a, { ...o, editing: !0 }) : /* @__PURE__ */ e(C.Group, { color: "red", textAlign: "center", children: /* @__PURE__ */ e("h1", { children: "Wrong Component Name" }) }) }) });
24
- }, L = () => /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(b, {}) });
23
+ }), [n]), /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(y, { fluid: !0, className: "editing", children: a ? /* @__PURE__ */ r(a, { ...o, editing: !0 }) : /* @__PURE__ */ r(C.Group, { color: "red", textAlign: "center", children: /* @__PURE__ */ r("h1", { children: "Wrong Component Name" }) }) }) });
24
+ }, x = () => /* @__PURE__ */ r(h, { children: /* @__PURE__ */ r(b, {}) });
25
25
  export {
26
- L as default
26
+ x as default
27
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.9.13",
3
+ "version": "1.9.14",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",