@nickaux/form-configurator 1.1.244 → 1.1.245

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.
@@ -119738,19 +119738,36 @@ class TypeJson extends TypeDefault {
119738
119738
  "onChange",
119739
119739
  "initComponent"
119740
119740
  ]);
119741
- const [b, S] = useState(
119742
- typeof h() == "string" ? JSON.parse(h()) : ["object", "array"].includes(typeof h()) ? h() : {}
119743
- );
119741
+ const [b, S] = useState(() => {
119742
+ const k = h();
119743
+ if (typeof k == "string") {
119744
+ const F = k.trim();
119745
+ if (F === "")
119746
+ return {};
119747
+ try {
119748
+ return JSON.parse(F);
119749
+ } catch (N) {
119750
+ return {};
119751
+ }
119752
+ }
119753
+ return ["object", "array"].includes(typeof k) ? k : {};
119754
+ });
119744
119755
  useRef$1(!1);
119745
119756
  const I = (k, F, { contentErrors: N, patchResult: q }) => {
119746
119757
  try {
119747
119758
  if (k.json)
119748
119759
  g && g(k.json);
119749
119760
  else if (k.text) {
119750
- const Y = JSON.parse(k.text);
119751
- g && g(Y);
119761
+ const Y = k.text.trim();
119762
+ if (Y === "") {
119763
+ g && g({});
119764
+ return;
119765
+ }
119766
+ const X = JSON.parse(Y);
119767
+ g && g(X);
119752
119768
  }
119753
119769
  } catch (Y) {
119770
+ g && g({});
119754
119771
  }
119755
119772
  }, O = (!p.displayLabel || p.displayLabel !== "notDisplay") && p.label ? /* @__PURE__ */ jsx$2("label", { children: p.label }) : "";
119756
119773
  return this.userAllow === "read-only" ? /* @__PURE__ */ jsx$2("p", { children: b }) : /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nickaux/form-configurator",
3
- "version": "1.1.244",
3
+ "version": "1.1.245",
4
4
  "description": "A React form manager",
5
5
  "type": "module",
6
6
  "main": "dist/FormConfigurator.cjs.js",