@ea-lab/reactive-json 1.0.0-alpha.0 → 1.0.0-alpha.2

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.
Files changed (56) hide show
  1. package/dist/component/action/HashChangeListener.js +7 -7
  2. package/dist/component/action/MessageListener.js +1 -1
  3. package/dist/component/action/Redirect.js +3 -3
  4. package/dist/component/action/SetAttributeValue.js +1 -1
  5. package/dist/component/action/ToggleAttributeValue.js +1 -1
  6. package/dist/component/action/UnsetAttribute.js +5 -5
  7. package/dist/component/action/UnsetAttributeValue.js +1 -1
  8. package/dist/component/dataMapping/simpleMapping.js +17 -17
  9. package/dist/component/element/debug/VariablesDebug/VariablesDebug.js +20 -19
  10. package/dist/component/element/html/FolderSortableTree.js +29 -27
  11. package/dist/component/element/html/FormatNumeral.js +23 -22
  12. package/dist/component/element/html/Html.js +57 -7
  13. package/dist/component/element/html/LabelFromValue.js +20 -18
  14. package/dist/component/element/html/PreformattedMarkup.js +9 -8
  15. package/dist/component/element/html/SortableTreeItemCollapseButton.js +4 -4
  16. package/dist/component/element/html/index.js +6 -7
  17. package/dist/component/element/index.js +26 -27
  18. package/dist/component/element/special/Count.js +9 -10
  19. package/dist/component/element/special/DataFilter.js +24 -23
  20. package/dist/component/element/special/DelayedActions.js +17 -16
  21. package/dist/component/element/special/Phantom.js +7 -6
  22. package/dist/component/element/special/ReactiveJsonBasicComponentWrapper.js +12 -9
  23. package/dist/component/element/special/ReactiveJsonSubroot.js +4 -3
  24. package/dist/component/element/special/Switch.js +34 -32
  25. package/dist/component/element/special/index.js +1 -1
  26. package/dist/component/index.js +59 -60
  27. package/dist/component/reaction/addData.js +14 -14
  28. package/dist/component/reaction/fetchData.js +1 -1
  29. package/dist/component/reaction/index.js +1 -1
  30. package/dist/component/reaction/moveData.js +6 -6
  31. package/dist/component/reaction/postMessage.js +5 -5
  32. package/dist/component/reaction/redirectNow.js +3 -3
  33. package/dist/component/reaction/removeData.js +6 -6
  34. package/dist/component/reaction/setClipboardData.js +6 -6
  35. package/dist/component/reaction/setData.js +8 -8
  36. package/dist/component/reaction/submitData.js +2 -2
  37. package/dist/component/reaction/utility/httpRequestCommon.js +2 -2
  38. package/dist/component/reaction/utility/index.js +1 -1
  39. package/dist/coreComponentsPlugin.js +1 -1
  40. package/dist/engine/Actions.js +161 -8
  41. package/dist/engine/ReactiveJsonRoot.js +5 -4
  42. package/dist/engine/TemplateSystem.js +117 -11
  43. package/dist/engine/View.js +74 -6
  44. package/dist/engine/index.js +43 -39
  45. package/dist/engine/utility/analyzeDataOverrideReferences.js +7 -7
  46. package/dist/engine/utility/formElementsCommon.js +11 -11
  47. package/dist/engine/utility/formatString.js +3 -3
  48. package/dist/engine/utility/index.js +9 -7
  49. package/dist/engine/utility/reactJsxHelpers.js +15 -0
  50. package/dist/{httpRequestCommon-BFntjNdS.js → httpRequestCommon-DUo2Oxgl.js} +1 -1
  51. package/dist/{index-Bzk15m61.js → index-BNvY8PkY.js} +6 -7
  52. package/dist/{index-OhHUX6nj.js → index-CBEHeXej.js} +64 -61
  53. package/dist/jsonpath-B9kE9k9e.js +3168 -0
  54. package/dist/main.js +110 -106
  55. package/package.json +1 -1
  56. package/dist/TemplateSystem-kQJEKjik.js +0 -3568
@@ -3,28 +3,28 @@ import { useContext as h, useEffect as E } from "react";
3
3
  import { EventDispatcherContext as x } from "../../engine/EventDispatcherContext.js";
4
4
  import { GlobalDataContext as L } from "../../engine/GlobalDataContext.js";
5
5
  import { TemplateContext as T } from "../../engine/TemplateContext.js";
6
- import { b as d } from "../../TemplateSystem-kQJEKjik.js";
7
- const R = (n) => {
8
- const e = h(x), a = h(L), o = h(T), s = a.plugins ?? {}, f = (s == null ? void 0 : s.reaction) ?? {}, t = (n == null ? void 0 : n.actionProps) ?? void 0;
6
+ import { evaluateTemplateValueCollection as d } from "../../engine/TemplateSystem.js";
7
+ const R = (a) => {
8
+ const e = h(x), n = h(L), o = h(T), s = n.plugins ?? {}, f = (s == null ? void 0 : s.reaction) ?? {}, t = (a == null ? void 0 : a.actionProps) ?? void 0;
9
9
  return E(() => {
10
10
  const v = t ?? void 0, r = (t == null ? void 0 : t.what) ?? void 0, w = (t == null ? void 0 : t.whenHashIs) ?? void 0, g = (t == null ? void 0 : t.whenHashWas) ?? void 0, i = d({
11
- globalDataContext: a,
11
+ globalDataContext: n,
12
12
  templateContext: o,
13
13
  valueToEvaluate: w
14
14
  }), c = d({
15
- globalDataContext: a,
15
+ globalDataContext: n,
16
16
  templateContext: o,
17
17
  valueToEvaluate: g
18
18
  }), m = (l) => {
19
19
  if (typeof i == "string" && new URL(l.newUrl).hash !== i || typeof c == "string" && new URL(l.oldUrl).hash !== c)
20
20
  return;
21
21
  const u = r && (f[r] ?? void 0);
22
- u && u({ args: v, event: l, globalDataContext: a, templateContext: o });
22
+ u && u({ args: v, event: l, globalDataContext: n, templateContext: o });
23
23
  };
24
24
  return e == null || e.addEventListener("hashchange", m), () => {
25
25
  e == null || e.removeEventListener("hashchange", m);
26
26
  };
27
- }, [e, a, t, o]), /* @__PURE__ */ C(H, { children: n.children });
27
+ }, [e, n, t, o]), /* @__PURE__ */ C(H, { children: a.children });
28
28
  };
29
29
  export {
30
30
  R as HashChangeListener
@@ -4,7 +4,7 @@ import { useContext as r, useEffect as x } from "react";
4
4
  import { EventDispatcherContext as C } from "../../engine/EventDispatcherContext.js";
5
5
  import { GlobalDataContext as h } from "../../engine/GlobalDataContext.js";
6
6
  import { TemplateContext as M } from "../../engine/TemplateContext.js";
7
- import { b as T } from "../../TemplateSystem-kQJEKjik.js";
7
+ import { evaluateTemplateValueCollection as T } from "../../engine/TemplateSystem.js";
8
8
  const G = (e) => {
9
9
  const o = r(C), n = r(h), a = r(M), s = n.plugins ?? {}, d = (s == null ? void 0 : s.reaction) ?? {}, t = (e == null ? void 0 : e.actionProps) ?? void 0;
10
10
  return x(() => {
@@ -1,11 +1,11 @@
1
1
  import { useContext as o } from "react";
2
2
  import { GlobalDataContext as n } from "../../engine/GlobalDataContext.js";
3
3
  import { TemplateContext as l } from "../../engine/TemplateContext.js";
4
- import { a as m } from "../../TemplateSystem-kQJEKjik.js";
5
- const f = (e) => {
4
+ import { evaluateTemplateValue as m } from "../../engine/TemplateSystem.js";
5
+ const s = (e) => {
6
6
  const a = o(n), r = o(l), { to: t } = e.actionProps;
7
7
  !t || typeof t != "string" || (window.location.href = m({ valueToEvaluate: t, globalDataContext: a, templateContext: r }));
8
8
  };
9
9
  export {
10
- f as Redirect
10
+ s as Redirect
11
11
  };
@@ -1,7 +1,7 @@
1
1
  import { useContext as f, useEffect as V } from "react";
2
2
  import { GlobalDataContext as d } from "../../engine/GlobalDataContext.js";
3
3
  import { TemplateContext as x } from "../../engine/TemplateContext.js";
4
- import { a as b } from "../../TemplateSystem-kQJEKjik.js";
4
+ import { evaluateTemplateValue as b } from "../../engine/TemplateSystem.js";
5
5
  const T = (a) => {
6
6
  const l = f(d), c = f(x), { attributesHolderRef: t } = a, { name: e, mode: s = "append", value: n, preventDuplicateValues: i = !0, separator: o = " " } = a.actionProps;
7
7
  return V(() => {
@@ -1,7 +1,7 @@
1
1
  import { useContext as y, useEffect as E } from "react";
2
2
  import { GlobalDataContext as D } from "../../engine/GlobalDataContext.js";
3
3
  import { TemplateContext as O } from "../../engine/TemplateContext.js";
4
- import { a as P } from "../../TemplateSystem-kQJEKjik.js";
4
+ import { evaluateTemplateValue as P } from "../../engine/TemplateSystem.js";
5
5
  const q = (i) => {
6
6
  const x = y(D), b = y(O), { attributesHolderRef: l } = i, { name: o, value: m, separator: u = " ", keepAttributeWhenEmpty: V = !1 } = i.actionProps || {};
7
7
  return E(() => {
@@ -1,21 +1,21 @@
1
1
  import { useContext as r, useEffect as l } from "react";
2
2
  import { GlobalDataContext as c } from "../../engine/GlobalDataContext.js";
3
3
  import { TemplateContext as u } from "../../engine/TemplateContext.js";
4
- import { a as i } from "../../TemplateSystem-kQJEKjik.js";
4
+ import { evaluateTemplateValue as i } from "../../engine/TemplateSystem.js";
5
5
  const C = (e) => {
6
- const a = r(c), n = r(u), { attributesHolderRef: t } = e, { name: o } = e.actionProps || {};
6
+ const n = r(c), a = r(u), { attributesHolderRef: t } = e, { name: o } = e.actionProps || {};
7
7
  return l(() => {
8
8
  if (!(t != null && t.current) || !o)
9
9
  return;
10
10
  const m = String(
11
11
  i({
12
12
  valueToEvaluate: o,
13
- globalDataContext: a,
14
- templateContext: n
13
+ globalDataContext: n,
14
+ templateContext: a
15
15
  })
16
16
  );
17
17
  t.current.removeAttribute(m);
18
- }, [o, a.data, n, t]), e.children;
18
+ }, [o, n.data, a, t]), e.children;
19
19
  };
20
20
  export {
21
21
  C as UnsetAttribute
@@ -1,7 +1,7 @@
1
1
  import { useContext as p, useEffect as g } from "react";
2
2
  import { GlobalDataContext as E } from "../../engine/GlobalDataContext.js";
3
3
  import { TemplateContext as N } from "../../engine/TemplateContext.js";
4
- import { a as A } from "../../TemplateSystem-kQJEKjik.js";
4
+ import { evaluateTemplateValue as A } from "../../engine/TemplateSystem.js";
5
5
  const I = (a) => {
6
6
  const l = p(E), s = p(N), { attributesHolderRef: r } = a, { name: n, value: i, separator: c = " ", unsetAllOccurrences: C, unsetCount: f } = a.actionProps || {};
7
7
  return g(() => {
@@ -1,12 +1,12 @@
1
- import { d as V, b as v } from "../../TemplateSystem-kQJEKjik.js";
2
- function T({ config: h, globalDataContext: o, templateContext: i, responseData: m }) {
3
- const { stringMap: M = {}, onErrorMap: p } = h, { updateData: g } = o;
1
+ import { dataLocationToPath as V, evaluateTemplateValueCollection as v } from "../../engine/TemplateSystem.js";
2
+ function T({ config: h, globalDataContext: a, templateContext: i, responseData: m }) {
3
+ const { stringMap: M = {}, onErrorMap: p } = h, { updateData: g } = a;
4
4
  try {
5
5
  Object.entries(M).map(([r, t]) => l({
6
6
  destinationDataLocation: r,
7
7
  mappingConfig: t,
8
- sourceDataRetriever: ({ location: n }) => u({ location: n, data: m })
9
- })).filter(Boolean).forEach(s);
8
+ sourceDataRetriever: ({ location: n }) => s({ location: n, data: m })
9
+ })).filter(Boolean).forEach(u);
10
10
  } catch (e) {
11
11
  if (!p)
12
12
  throw e;
@@ -14,12 +14,12 @@ function T({ config: h, globalDataContext: o, templateContext: i, responseData:
14
14
  destinationDataLocation: t,
15
15
  mappingConfig: n,
16
16
  sourceDataRetriever: w
17
- })).filter(Boolean).forEach(s);
17
+ })).filter(Boolean).forEach(u);
18
18
  }
19
- function s({ destinationPath: e, value: r, updateMode: t }) {
19
+ function u({ destinationPath: e, value: r, updateMode: t }) {
20
20
  g(r, e, t);
21
21
  }
22
- function u({ location: e, data: r }) {
22
+ function s({ location: e, data: r }) {
23
23
  if (typeof r != "object")
24
24
  throw new Error("simpleMapping: Could not find location in response data: " + e + ".");
25
25
  if (!e || e === "")
@@ -27,7 +27,7 @@ function T({ config: h, globalDataContext: o, templateContext: i, responseData:
27
27
  const t = e.split(".")[0];
28
28
  if (t in r) {
29
29
  const n = e.split(".").slice(1).join(".");
30
- return n === "" ? r[t] : u({ location: n, data: r[t] });
30
+ return n === "" ? r[t] : s({ location: n, data: r[t] });
31
31
  }
32
32
  throw new Error(
33
33
  "simpleMapping: Could not find location in response data: " + e + " (location not found in data)."
@@ -36,7 +36,7 @@ function T({ config: h, globalDataContext: o, templateContext: i, responseData:
36
36
  function w({ location: e }) {
37
37
  return v({
38
38
  valueToEvaluate: e,
39
- globalDataContext: o,
39
+ globalDataContext: a,
40
40
  templateContext: i,
41
41
  evaluationDepth: -1
42
42
  });
@@ -48,26 +48,26 @@ function T({ config: h, globalDataContext: o, templateContext: i, responseData:
48
48
  console.warn("simpleMapping: 'value' is missing for", e);
49
49
  return;
50
50
  }
51
- const a = V({
51
+ const o = V({
52
52
  dataLocation: e,
53
53
  // TODO: This is incorrect because simpleMapping could be called from a fetchData reaction that is not located at the root of the data.
54
54
  currentPath: "data",
55
- globalDataContext: o,
55
+ globalDataContext: a,
56
56
  templateContext: i
57
57
  });
58
- if (typeof a != "string" || !a.startsWith("data")) {
58
+ if (typeof o != "string" || !o.startsWith("data")) {
59
59
  console.warn(
60
60
  "simpleMapping: the given destination path is invalid:",
61
61
  e,
62
62
  "->",
63
- a
63
+ o
64
64
  );
65
65
  return;
66
66
  }
67
67
  try {
68
68
  const d = t({ location: n });
69
69
  return {
70
- destinationPath: a,
70
+ destinationPath: o,
71
71
  value: d,
72
72
  updateMode: f
73
73
  };
@@ -77,12 +77,12 @@ function T({ config: h, globalDataContext: o, templateContext: i, responseData:
77
77
  if (c !== void 0) {
78
78
  const y = v({
79
79
  valueToEvaluate: c,
80
- globalDataContext: o,
80
+ globalDataContext: a,
81
81
  templateContext: i,
82
82
  evaluationDepth: -1
83
83
  });
84
84
  return {
85
- destinationPath: a,
85
+ destinationPath: o,
86
86
  value: y,
87
87
  updateMode: f
88
88
  };
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as a, Fragment as x } from "react/jsx-runtime";
2
2
  import { useState as p, useContext as B, useRef as g, useEffect as q, useMemo as m } from "react";
3
3
  import { r as E } from "../../../../dnd-kit-sortable-tree.esm-Cz1RJyIg.js";
4
- import { A as L } from "../../../../TemplateSystem-kQJEKjik.js";
4
+ import { ActionDependant as L } from "../../../../engine/Actions.js";
5
5
  import "../../../../engine/EventDispatcherContext.js";
6
6
  import "../../../../engine/EventDispatcherProvider.js";
7
7
  import "../../../../engine/GlobalDataContext.js";
@@ -9,29 +9,30 @@ import "../../../../engine/PaginationContext.js";
9
9
  import "../../../../lodash-CYNxjS-I.js";
10
10
  import { TemplateContext as $ } from "../../../../engine/TemplateContext.js";
11
11
  import "../../../../index-NNBvIV0S.js";
12
+ import "../../../../jsonpath-B9kE9k9e.js";
12
13
  import "../../../../js-yaml-Bw0KO4XO.js";
13
14
  import "../../../../engine/ParsingDebugDisplay/ParsingDebugDisplay.js";
14
- import { DebugMode as c } from "./DebugMode.enum.js";
15
+ import { DebugMode as r } from "./DebugMode.enum.js";
15
16
  import R from "./ModeDisplay/DebugList/DebugList.js";
16
17
  import D from "./ModeDisplay/DebugJson/DebugJson.js";
17
18
  import '../../../../assets/reset.css';import '../../../../assets/VariablesDebug.css';/* empty css */
18
19
  import { flattenObject as J } from "./utils.js";
19
- const O = "_debugRoot_1ny7q_1", j = "_container_1ny7q_16", k = "_expanded_1ny7q_34", T = "_header_1ny7q_39", I = "_actions_1ny7q_45", P = "_btn_1ny7q_50", A = "_active_1ny7q_58", M = "_path_1ny7q_62", w = "_value_1ny7q_66", H = "_copyBtn_1ny7q_70", V = "_copyBtnSuccess_1ny7q_74", F = "_copyBtnError_1ny7q_78", W = "_info_1ny7q_82", n = {
20
+ const O = "_debugRoot_1ny7q_1", j = "_container_1ny7q_16", k = "_expanded_1ny7q_34", T = "_header_1ny7q_39", I = "_actions_1ny7q_45", P = "_btn_1ny7q_50", M = "_active_1ny7q_58", w = "_path_1ny7q_62", A = "_value_1ny7q_66", H = "_copyBtn_1ny7q_70", V = "_copyBtnSuccess_1ny7q_74", F = "_copyBtnError_1ny7q_78", W = "_info_1ny7q_82", n = {
20
21
  debugRoot: O,
21
22
  container: j,
22
23
  expanded: k,
23
24
  header: T,
24
25
  actions: I,
25
26
  btn: P,
26
- active: A,
27
- path: M,
28
- value: w,
27
+ active: M,
28
+ path: w,
29
+ value: A,
29
30
  copyBtn: H,
30
31
  copyBtnSuccess: V,
31
32
  copyBtnError: F,
32
33
  info: W
33
- }, dt = ({ props: v }) => {
34
- const [r, u] = p(!1), [i, _] = p(c.LIST), o = B($), d = g(null), [y, S] = p(null), f = g(null);
34
+ }, pt = ({ props: v }) => {
35
+ const [c, u] = p(!1), [i, _] = p(r.LIST), o = B($), d = g(null), [y, S] = p(null), f = g(null);
35
36
  q(() => {
36
37
  if (typeof document > "u") return;
37
38
  let t = document.getElementById("rj-debug-root");
@@ -41,7 +42,7 @@ const O = "_debugRoot_1ny7q_1", j = "_container_1ny7q_16", k = "_expanded_1ny7q_
41
42
  const t = d.current;
42
43
  try {
43
44
  if (await navigator.clipboard.writeText(
44
- i === c.JSON ? b : h.map((s) => `${s.path}: ${JSON.stringify(s.value)}`).join(`
45
+ i === r.JSON ? b : h.map((s) => `${s.path}: ${JSON.stringify(s.value)}`).join(`
45
46
  `)
46
47
  ), !t) return;
47
48
  t.classList.add(n.copyBtnSuccess), t.textContent = "Copied!", setTimeout(() => {
@@ -56,7 +57,7 @@ const O = "_debugRoot_1ny7q_1", j = "_container_1ny7q_16", k = "_expanded_1ny7q_
56
57
  }, N = /* @__PURE__ */ e(L, { ...v, attributesHolderRef: f, children: /* @__PURE__ */ a(
57
58
  "div",
58
59
  {
59
- className: `${n.container} ${r ? n.expanded : ""}`,
60
+ className: `${n.container} ${c ? n.expanded : ""}`,
60
61
  onClick: () => u((t) => !t),
61
62
  role: "button",
62
63
  ref: f,
@@ -67,20 +68,20 @@ const O = "_debugRoot_1ny7q_1", j = "_container_1ny7q_16", k = "_expanded_1ny7q_
67
68
  /* @__PURE__ */ e("code", { children: o.templatePath })
68
69
  ] }),
69
70
  /* @__PURE__ */ a("div", { className: n.actions, onClick: (t) => t.stopPropagation(), children: [
70
- r && /* @__PURE__ */ a(x, { children: [
71
+ c && /* @__PURE__ */ a(x, { children: [
71
72
  /* @__PURE__ */ e(
72
73
  "button",
73
74
  {
74
- className: `${n.btn} ${i === c.LIST ? n.active : ""}`,
75
- onClick: () => _(c.LIST),
75
+ className: `${n.btn} ${i === r.LIST ? n.active : ""}`,
76
+ onClick: () => _(r.LIST),
76
77
  children: "List"
77
78
  }
78
79
  ),
79
80
  /* @__PURE__ */ e(
80
81
  "button",
81
82
  {
82
- className: `${n.btn} ${i === c.JSON ? n.active : ""}`,
83
- onClick: () => _(c.JSON),
83
+ className: `${n.btn} ${i === r.JSON ? n.active : ""}`,
84
+ onClick: () => _(r.JSON),
84
85
  children: "JSON"
85
86
  }
86
87
  )
@@ -90,10 +91,10 @@ const O = "_debugRoot_1ny7q_1", j = "_container_1ny7q_16", k = "_expanded_1ny7q_
90
91
  {
91
92
  className: n.btn,
92
93
  onClick: () => u((t) => !t),
93
- children: r ? "Collapse" : "Expand"
94
+ children: c ? "Collapse" : "Expand"
94
95
  }
95
96
  ),
96
- r && /* @__PURE__ */ e(
97
+ c && /* @__PURE__ */ e(
97
98
  "button",
98
99
  {
99
100
  className: `${n.btn} ${n.copyBtn}`,
@@ -104,12 +105,12 @@ const O = "_debugRoot_1ny7q_1", j = "_container_1ny7q_16", k = "_expanded_1ny7q_
104
105
  )
105
106
  ] })
106
107
  ] }),
107
- r && /* @__PURE__ */ e("div", { className: n.info, onClick: (t) => t.stopPropagation(), children: i === c.JSON ? /* @__PURE__ */ e(D, { jsonString: b }) : /* @__PURE__ */ e(R, { flatRows: h }) })
108
+ c && /* @__PURE__ */ e("div", { className: n.info, onClick: (t) => t.stopPropagation(), children: i === r.JSON ? /* @__PURE__ */ e(D, { jsonString: b }) : /* @__PURE__ */ e(R, { flatRows: h }) })
108
109
  ]
109
110
  }
110
111
  ) });
111
112
  return y ? E.createPortal(N, y) : null;
112
113
  };
113
114
  export {
114
- dt as VariablesDebug
115
+ pt as VariablesDebug
115
116
  };
@@ -2,75 +2,77 @@ import { jsx as h } from "react/jsx-runtime";
2
2
  import { F as k, S as B } from "../../../dnd-kit-sortable-tree.esm-Cz1RJyIg.js";
3
3
  import { l as _ } from "../../../lodash-CYNxjS-I.js";
4
4
  import { useContext as A, forwardRef as R } from "react";
5
- import { a as G, V as H, A as O } from "../../../TemplateSystem-kQJEKjik.js";
6
- import { GlobalDataContext as W } from "../../../engine/GlobalDataContext.js";
7
- import { TemplateContext as V } from "../../../engine/TemplateContext.js";
5
+ import { ActionDependant as G } from "../../../engine/Actions.js";
6
+ import { GlobalDataContext as H } from "../../../engine/GlobalDataContext.js";
7
+ import { TemplateContext as y } from "../../../engine/TemplateContext.js";
8
+ import { evaluateTemplateValue as O } from "../../../engine/TemplateSystem.js";
9
+ import { View as W } from "../../../engine/View.js";
8
10
  import { propsDataLocationToPathAndValue as q } from "../../../engine/utility/formElementsCommon.js";
9
- function y(t) {
11
+ function V(t) {
10
12
  var r, n, a = "";
11
13
  if (typeof t == "string" || typeof t == "number") a += t;
12
14
  else if (typeof t == "object") if (Array.isArray(t)) {
13
- var u = t.length;
14
- for (r = 0; r < u; r++) t[r] && (n = y(t[r])) && (a && (a += " "), a += n);
15
+ var s = t.length;
16
+ for (r = 0; r < s; r++) t[r] && (n = V(t[r])) && (a && (a += " "), a += n);
15
17
  } else for (n in t) t[n] && (a && (a += " "), a += n);
16
18
  return a;
17
19
  }
18
20
  function z() {
19
- for (var t, r, n = 0, a = "", u = arguments.length; n < u; n++) (t = arguments[n]) && (r = y(t)) && (a && (a += " "), a += r);
21
+ for (var t, r, n = 0, a = "", s = arguments.length; n < s; n++) (t = arguments[n]) && (r = V(t)) && (a && (a += " "), a += r);
20
22
  return a;
21
23
  }
22
- const ee = ({ props: t, path: r, datafield: n }) => {
24
+ const ae = ({ props: t, path: r, datafield: n }) => {
23
25
  var P, T;
24
- const a = A(W), u = A(V);
25
- let { formData: i, formDataPath: s } = q({
26
+ const a = A(H), s = A(y);
27
+ let { formData: i, formDataPath: u } = q({
26
28
  currentPath: r,
27
29
  datafield: n,
28
30
  dataLocation: t.dataLocation,
29
31
  defaultValue: t.defaultFieldValue,
30
32
  globalDataContext: a,
31
- templateContext: u
33
+ templateContext: s
32
34
  });
33
35
  if (i === void 0)
34
36
  return null;
35
- const L = t.itemTemplate ?? null, c = G({
37
+ const L = t.itemTemplate ?? null, c = O({
36
38
  valueToEvaluate: t.treeRootPath ?? void 0,
37
39
  globalDataContext: a,
38
- templateContext: u
39
- }), v = t.maxDepth, w = typeof c != "string" ? !0 : t.maxDepthIsAbsolute ?? !0, p = t.keepBaseItem ?? !1;
40
+ templateContext: s
41
+ }), v = t.maxDepth, w = typeof c != "string" ? !0 : t.maxDepthIsAbsolute ?? !0, C = t.keepBaseItem ?? !1;
40
42
  let f = 0, b = null, I;
41
43
  if (typeof c == "string" && c.length > 0) {
42
44
  const e = c.split(".");
43
- let m = b, o = i, d = s;
45
+ let m = b, o = i, d = u;
44
46
  for (; e.length > 0; ) {
45
47
  const l = Number.parseInt(e.shift());
46
- if (Number.isNaN(l) || (m = (i == null ? void 0 : i.id) ?? null, o = i, d = s, I = l, b = (P = i[l]) == null ? void 0 : P.id, i = ((T = i[l]) == null ? void 0 : T.children) ?? void 0, s = s + "." + l + ".children", i === void 0))
48
+ if (Number.isNaN(l) || (m = (i == null ? void 0 : i.id) ?? null, o = i, d = u, I = l, b = (P = i[l]) == null ? void 0 : P.id, i = ((T = i[l]) == null ? void 0 : T.children) ?? void 0, u = u + "." + l + ".children", i === void 0))
47
49
  return null;
48
50
  ++f;
49
51
  }
50
- p && (b = m, i = o, s = d, i = [i[I]]);
52
+ C && (b = m, i = o, u = d, i = [i[I]]);
51
53
  }
52
54
  const F = (e) => {
53
- let m = e, o = s;
55
+ let m = e, o = u;
54
56
  if (f > 0) {
55
57
  m = _.cloneDeep(m);
56
- const d = (l, C = 0) => {
58
+ const d = (l, p = 0) => {
57
59
  var x;
58
- C === 0 && (l.parentId = b), l.depth += f, (x = l.children) == null || x.forEach((D) => {
59
- d(D, C + 1);
60
+ p === 0 && (l.parentId = b), l.depth += f, (x = l.children) == null || x.forEach((D) => {
61
+ d(D, p + 1);
60
62
  });
61
63
  };
62
64
  m.forEach((l) => {
63
65
  d(l, 0);
64
66
  });
65
67
  }
66
- c !== void 0 && p && (m = e[0], o = s + "." + I), a.updateData(m, o);
68
+ c !== void 0 && C && (m = e[0], o = u + "." + I), a.updateData(m, o);
67
69
  }, N = R((e, m) => {
68
70
  const o = e.item.value ?? {}, d = [];
69
71
  let l = e.item;
70
72
  for (d.push(l.index); l.parent; )
71
73
  d.push("children"), l = l.parent, d.push(l.index);
72
74
  d.reverse();
73
- const x = s + "." + d.join(".") + ".value";
75
+ const x = u + "." + d.join(".") + ".value";
74
76
  o._treeItemDepth = e.item.depth, o._treeItemIndex = e.item.index, o._treeItemIndex1 = e.item.index + 1;
75
77
  const D = {};
76
78
  return D._treeAddCollapseButton = () => !!e.onCollapse && !!e.childCount && /* @__PURE__ */ h(
@@ -98,20 +100,20 @@ const ee = ({ props: t, path: r, datafield: n }) => {
98
100
  "data-htmlbuilder-tree-item-is-last": e.isLast,
99
101
  ref: m,
100
102
  children: /* @__PURE__ */ h(
101
- V.Provider,
103
+ y.Provider,
102
104
  {
103
105
  value: {
104
106
  templateData: o,
105
107
  templatePath: x,
106
108
  sortableTreeData: D
107
109
  },
108
- children: /* @__PURE__ */ h(H, { props: L, currentData: o })
110
+ children: /* @__PURE__ */ h(W, { props: L, currentData: o })
109
111
  }
110
112
  )
111
113
  }
112
114
  );
113
115
  }), j = _.cloneDeep(i), E = t.sortableTreeOptions ?? {};
114
- return /* @__PURE__ */ h(O, { ...t, children: /* @__PURE__ */ h(
116
+ return /* @__PURE__ */ h(G, { ...t, children: /* @__PURE__ */ h(
115
117
  B,
116
118
  {
117
119
  ...E,
@@ -129,5 +131,5 @@ function J(t) {
129
131
  return r.reverse().join(" ");
130
132
  }
131
133
  export {
132
- ee as FolderSortableTree
134
+ ae as FolderSortableTree
133
135
  };
@@ -1,43 +1,44 @@
1
- import { jsx as u, Fragment as m } from "react/jsx-runtime";
1
+ import { jsx as u, Fragment as s } from "react/jsx-runtime";
2
2
  import { useContext as f } from "react";
3
- import { a as c, A as d } from "../../../TemplateSystem-kQJEKjik.js";
4
- import { GlobalDataContext as v } from "../../../engine/GlobalDataContext.js";
5
- import { TemplateContext as C } from "../../../engine/TemplateContext.js";
6
- const T = ({ props: t }) => {
7
- const r = f(v), l = f(C);
8
- let a = !1, e, o;
3
+ import { ActionDependant as d } from "../../../engine/Actions.js";
4
+ import { GlobalDataContext as p } from "../../../engine/GlobalDataContext.js";
5
+ import { TemplateContext as v } from "../../../engine/TemplateContext.js";
6
+ import { evaluateTemplateValue as c } from "../../../engine/TemplateSystem.js";
7
+ const h = ({ props: t }) => {
8
+ const r = f(p), l = f(v);
9
+ let o = !1, e, a;
9
10
  if (t.content !== void 0 && (e = c({ valueToEvaluate: t.content, globalDataContext: r, templateContext: l })), e == null || e === "")
10
11
  return null;
11
- switch (t.format !== void 0 && (o = c({ valueToEvaluate: t.format, globalDataContext: r, templateContext: l })), o) {
12
+ switch (t.format !== void 0 && (a = c({ valueToEvaluate: t.format, globalDataContext: r, templateContext: l })), a) {
12
13
  case "roman-upper":
13
- a = s(e);
14
+ o = m(e);
14
15
  break;
15
16
  case "roman-lower":
16
- a = s(e, !0);
17
+ o = m(e, !0);
17
18
  break;
18
19
  case "latin-upper":
19
- a = n(e);
20
+ o = n(e);
20
21
  break;
21
22
  case "latin-lower":
22
- a = n(e, !0);
23
+ o = n(e, !0);
23
24
  break;
24
25
  default:
25
- a = e;
26
+ o = e;
26
27
  break;
27
28
  }
28
- return /* @__PURE__ */ u(d, { ...t, children: /* @__PURE__ */ u(m, { children: a !== !1 && a }) });
29
+ return /* @__PURE__ */ u(d, { ...t, children: /* @__PURE__ */ u(s, { children: o !== !1 && o }) });
29
30
  };
30
31
  function n(t, r = !1) {
31
32
  if (t < 1)
32
33
  return !1;
33
- let l = t % 26, a = t / 26 | 0, e = l ? String.fromCharCode(64 + l) : (--a, "Z");
34
- const o = a ? n(a) + e : e;
35
- return r ? o.toLowerCase() : o;
34
+ let l = t % 26, o = t / 26 | 0, e = l ? String.fromCharCode(64 + l) : (--o, "Z");
35
+ const a = o ? n(o) + e : e;
36
+ return r ? a.toLowerCase() : a;
36
37
  }
37
- function s(t, r = !1) {
38
+ function m(t, r = !1) {
38
39
  if (t < 1)
39
40
  return !1;
40
- const a = [
41
+ const o = [
41
42
  ["M", 1e3],
42
43
  ["CM", 900],
43
44
  ["D", 500],
@@ -51,9 +52,9 @@ function s(t, r = !1) {
51
52
  ["V", 5],
52
53
  ["IV", 4],
53
54
  ["I", 1]
54
- ].reduce((e, [o, i]) => (e += o.repeat(Math.floor(t / i)), t = t % i, e), "");
55
- return r ? a.toLowerCase() : a;
55
+ ].reduce((e, [a, i]) => (e += a.repeat(Math.floor(t / i)), t = t % i, e), "");
56
+ return r ? o.toLowerCase() : o;
56
57
  }
57
58
  export {
58
- T as FormatNumeral
59
+ h as FormatNumeral
59
60
  };
@@ -1,9 +1,59 @@
1
- import "react/jsx-runtime";
2
- import { H as a, n as e } from "../../../TemplateSystem-kQJEKjik.js";
3
- import "react";
4
- import "../../../engine/GlobalDataContext.js";
5
- import "../../../engine/TemplateContext.js";
1
+ import { jsx as o, jsxs as d, Fragment as u } from "react/jsx-runtime";
2
+ import { useContext as b, useRef as A } from "react";
3
+ import { ActionDependant as C } from "../../../engine/Actions.js";
4
+ import { GlobalDataContext as T } from "../../../engine/GlobalDataContext.js";
5
+ import { normalizeAttributesForReactJsx as g } from "../../../engine/utility/reactJsxHelpers.js";
6
+ import { TemplateContext as j } from "../../../engine/TemplateContext.js";
7
+ import { evaluateAttributes as k } from "../../../engine/TemplateSystem.js";
8
+ import { View as c } from "../../../engine/View.js";
9
+ const N = ({ props: e, currentData: m, datafield: v, path: x }) => {
10
+ const h = b(T), p = b(j), i = A(null), l = `${e.tag}`, r = e.extra ?? {}, n = g(e.attributes), a = g(m.attributes);
11
+ for (const t of Object.keys(a)) {
12
+ if (t.charAt(0) === "+") {
13
+ const s = t.substring(1);
14
+ n[s] = (n[s] ?? "").length > 0 ? (
15
+ // Append using a space.
16
+ " " + a[t]
17
+ ) : (
18
+ // Set directly.
19
+ a[t]
20
+ );
21
+ continue;
22
+ }
23
+ n[t] = a[t];
24
+ }
25
+ const f = k({ attrs: n, globalDataContext: h, templateContext: p });
26
+ return /* @__PURE__ */ o(C, { ...e, attributesHolderRef: i, children: ((t) => t && [
27
+ "area",
28
+ "base",
29
+ "br",
30
+ "col",
31
+ "embed",
32
+ "hr",
33
+ "img",
34
+ "input",
35
+ "link",
36
+ "meta",
37
+ "param",
38
+ "source",
39
+ "track",
40
+ "wbr"
41
+ ].indexOf(t) !== -1)(e.tag) ? /* @__PURE__ */ d(u, { children: [
42
+ /* @__PURE__ */ o(l, { ref: i, ...f }),
43
+ Object.keys(r).length ? /* @__PURE__ */ o(c, { props: r }) : ""
44
+ ] }) : /* @__PURE__ */ d(u, { children: [
45
+ /* @__PURE__ */ o(l, { ref: i, ...f, children: e.content && /* @__PURE__ */ o(
46
+ c,
47
+ {
48
+ currentData: m.content ?? void 0,
49
+ datafield: "content",
50
+ path: x + ".content",
51
+ props: e.content
52
+ }
53
+ ) }),
54
+ Object.keys(r).length ? /* @__PURE__ */ o(c, { props: r }) : ""
55
+ ] }) });
56
+ };
6
57
  export {
7
- a as Html,
8
- e as normalizeAttributesForReactJsx
58
+ N as Html
9
59
  };