@ea-lab/reactive-json 1.0.0-alpha.0 → 1.0.0-alpha.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/View-D8TN1L2h.js +126 -0
- package/dist/component/action/HashChangeListener.js +7 -7
- package/dist/component/action/MessageListener.js +1 -1
- package/dist/component/action/Redirect.js +3 -3
- package/dist/component/action/SetAttributeValue.js +1 -1
- package/dist/component/action/ToggleAttributeValue.js +1 -1
- package/dist/component/action/UnsetAttribute.js +5 -5
- package/dist/component/action/UnsetAttributeValue.js +1 -1
- package/dist/component/dataMapping/simpleMapping.js +17 -17
- package/dist/component/element/debug/VariablesDebug/VariablesDebug.js +20 -19
- package/dist/component/element/html/FolderSortableTree.js +26 -24
- package/dist/component/element/html/FormatNumeral.js +23 -22
- package/dist/component/element/html/Html.js +5 -3
- package/dist/component/element/html/LabelFromValue.js +21 -19
- package/dist/component/element/html/PreformattedMarkup.js +9 -8
- package/dist/component/element/html/SortableTreeItemCollapseButton.js +4 -4
- package/dist/component/element/html/index.js +6 -7
- package/dist/component/element/index.js +20 -21
- package/dist/component/element/special/Count.js +9 -10
- package/dist/component/element/special/DataFilter.js +24 -23
- package/dist/component/element/special/DelayedActions.js +17 -16
- package/dist/component/element/special/Phantom.js +7 -6
- package/dist/component/element/special/ReactiveJsonBasicComponentWrapper.js +12 -9
- package/dist/component/element/special/ReactiveJsonSubroot.js +4 -3
- package/dist/component/element/special/Switch.js +26 -24
- package/dist/component/element/special/index.js +1 -1
- package/dist/component/index.js +57 -58
- package/dist/component/reaction/addData.js +14 -14
- package/dist/component/reaction/fetchData.js +1 -1
- package/dist/component/reaction/index.js +1 -1
- package/dist/component/reaction/moveData.js +6 -6
- package/dist/component/reaction/postMessage.js +5 -5
- package/dist/component/reaction/redirectNow.js +3 -3
- package/dist/component/reaction/removeData.js +6 -6
- package/dist/component/reaction/setClipboardData.js +6 -6
- package/dist/component/reaction/setData.js +8 -8
- package/dist/component/reaction/submitData.js +2 -2
- package/dist/component/reaction/utility/httpRequestCommon.js +2 -2
- package/dist/component/reaction/utility/index.js +1 -1
- package/dist/coreComponentsPlugin.js +1 -1
- package/dist/engine/Actions.js +161 -8
- package/dist/engine/ReactiveJsonRoot.js +5 -4
- package/dist/engine/TemplateSystem.js +117 -11
- package/dist/engine/View.js +3 -2
- package/dist/engine/index.js +43 -39
- package/dist/engine/utility/analyzeDataOverrideReferences.js +7 -7
- package/dist/engine/utility/formElementsCommon.js +11 -11
- package/dist/engine/utility/formatString.js +3 -3
- package/dist/engine/utility/index.js +9 -7
- package/dist/engine/utility/reactJsxHelpers.js +15 -0
- package/dist/{httpRequestCommon-BFntjNdS.js → httpRequestCommon-DUo2Oxgl.js} +1 -1
- package/dist/{index-Bzk15m61.js → index-B3RKTGQ2.js} +6 -7
- package/dist/{index-OhHUX6nj.js → index-BYLJtf9L.js} +46 -44
- package/dist/jsonpath-B9kE9k9e.js +3168 -0
- package/dist/main.js +105 -102
- package/package.json +1 -1
- package/dist/TemplateSystem-kQJEKjik.js +0 -3568
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsx as n, jsxs as x, Fragment as C } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as h, useRef as j } from "react";
|
|
3
|
+
import { ActionDependant as k } from "./engine/Actions.js";
|
|
4
|
+
import { GlobalDataContext as D } from "./engine/GlobalDataContext.js";
|
|
5
|
+
import { normalizeAttributesForReactJsx as A } from "./engine/utility/reactJsxHelpers.js";
|
|
6
|
+
import { TemplateContext as T } from "./engine/TemplateContext.js";
|
|
7
|
+
import H, { evaluateAttributes as R, evaluateTemplateValue as V, dataLocationToPath as O } from "./engine/TemplateSystem.js";
|
|
8
|
+
const y = ({ props: t, currentData: o, datafield: s, path: l }) => {
|
|
9
|
+
const d = h(D), b = h(T), r = j(null), c = `${t.tag}`, f = t.extra ?? {}, e = A(t.attributes), a = A(o.attributes);
|
|
10
|
+
for (const i of Object.keys(a)) {
|
|
11
|
+
if (i.charAt(0) === "+") {
|
|
12
|
+
const g = i.substring(1);
|
|
13
|
+
e[g] = (e[g] ?? "").length > 0 ? (
|
|
14
|
+
// Append using a space.
|
|
15
|
+
" " + a[i]
|
|
16
|
+
) : (
|
|
17
|
+
// Set directly.
|
|
18
|
+
a[i]
|
|
19
|
+
);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
e[i] = a[i];
|
|
23
|
+
}
|
|
24
|
+
const u = R({ attrs: e, globalDataContext: d, templateContext: b });
|
|
25
|
+
return /* @__PURE__ */ n(k, { ...t, attributesHolderRef: r, children: ((i) => i && [
|
|
26
|
+
"area",
|
|
27
|
+
"base",
|
|
28
|
+
"br",
|
|
29
|
+
"col",
|
|
30
|
+
"embed",
|
|
31
|
+
"hr",
|
|
32
|
+
"img",
|
|
33
|
+
"input",
|
|
34
|
+
"link",
|
|
35
|
+
"meta",
|
|
36
|
+
"param",
|
|
37
|
+
"source",
|
|
38
|
+
"track",
|
|
39
|
+
"wbr"
|
|
40
|
+
].indexOf(i) !== -1)(t.tag) ? /* @__PURE__ */ x(C, { children: [
|
|
41
|
+
/* @__PURE__ */ n(c, { ref: r, ...u }),
|
|
42
|
+
Object.keys(f).length ? /* @__PURE__ */ n(m, { props: f }) : ""
|
|
43
|
+
] }) : /* @__PURE__ */ x(C, { children: [
|
|
44
|
+
/* @__PURE__ */ n(c, { ref: r, ...u, children: t.content && /* @__PURE__ */ n(
|
|
45
|
+
m,
|
|
46
|
+
{
|
|
47
|
+
currentData: o.content ?? void 0,
|
|
48
|
+
datafield: "content",
|
|
49
|
+
path: l + ".content",
|
|
50
|
+
props: t.content
|
|
51
|
+
}
|
|
52
|
+
) }),
|
|
53
|
+
Object.keys(f).length ? /* @__PURE__ */ n(m, { props: f }) : ""
|
|
54
|
+
] }) });
|
|
55
|
+
};
|
|
56
|
+
function m({ props: t, currentData: o, datafield: s, path: l }) {
|
|
57
|
+
const d = h(D), b = h(T), r = d.plugins ?? {}, c = (r == null ? void 0 : r.element) ?? {};
|
|
58
|
+
if (!c)
|
|
59
|
+
return null;
|
|
60
|
+
const { element: f } = d;
|
|
61
|
+
if (o === void 0 && (o = ""), t != null && t.type) {
|
|
62
|
+
let e = c[t.type] ?? void 0;
|
|
63
|
+
return e === void 0 && (e = c.Html ?? y), (c.Html ?? y) === e && (t.tag = t.tag ?? t.type), /* @__PURE__ */ n(e, { path: l, props: t, currentData: o, datafield: s });
|
|
64
|
+
}
|
|
65
|
+
if (t != null && t.load) {
|
|
66
|
+
let e;
|
|
67
|
+
const a = (t == null ? void 0 : t.customDataLocation) ?? void 0, u = a ? (
|
|
68
|
+
// The data is located somewhere in the current data.
|
|
69
|
+
V({
|
|
70
|
+
globalDataContext: d,
|
|
71
|
+
templateContext: b,
|
|
72
|
+
valueToEvaluate: a
|
|
73
|
+
})
|
|
74
|
+
) : (
|
|
75
|
+
// The data is the current data.
|
|
76
|
+
o
|
|
77
|
+
), v = a ? O({
|
|
78
|
+
dataLocation: a,
|
|
79
|
+
currentPath: l,
|
|
80
|
+
globalDataContext: d,
|
|
81
|
+
templateContext: b
|
|
82
|
+
}) : l;
|
|
83
|
+
typeof t.load == "function" ? e = t.load(u) : e = f[t.load];
|
|
84
|
+
const { load: i, customDataLocation: g, ...L } = t;
|
|
85
|
+
return e = { ...e, ...L }, t.keepTemplateContext ? /* @__PURE__ */ n(
|
|
86
|
+
m,
|
|
87
|
+
{
|
|
88
|
+
currentData: u,
|
|
89
|
+
datafield: s,
|
|
90
|
+
path: v,
|
|
91
|
+
props: e
|
|
92
|
+
}
|
|
93
|
+
) : /* @__PURE__ */ n(T.Provider, { value: { templateData: u, templatePath: v }, children: /* @__PURE__ */ n(
|
|
94
|
+
m,
|
|
95
|
+
{
|
|
96
|
+
currentData: u,
|
|
97
|
+
datafield: s,
|
|
98
|
+
path: v,
|
|
99
|
+
props: e
|
|
100
|
+
}
|
|
101
|
+
) });
|
|
102
|
+
}
|
|
103
|
+
return Array.isArray(t) ? t.map((e, a) => /* @__PURE__ */ n(
|
|
104
|
+
m,
|
|
105
|
+
{
|
|
106
|
+
currentData: o[a] ?? void 0,
|
|
107
|
+
datafield: a,
|
|
108
|
+
path: l + "." + a,
|
|
109
|
+
props: e ?? void 0
|
|
110
|
+
},
|
|
111
|
+
l + "." + a
|
|
112
|
+
)) : typeof t == "object" ? Object.entries(t).map(([e, a]) => /* @__PURE__ */ n(
|
|
113
|
+
m,
|
|
114
|
+
{
|
|
115
|
+
currentData: o[e] ?? void 0,
|
|
116
|
+
datafield: e ?? void 0,
|
|
117
|
+
path: l + "." + e,
|
|
118
|
+
props: a
|
|
119
|
+
},
|
|
120
|
+
l + "." + e
|
|
121
|
+
)) : /* @__PURE__ */ n(H, { valueToEvaluate: o || (t ?? null) });
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
y as H,
|
|
125
|
+
m as V
|
|
126
|
+
};
|
|
@@ -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 {
|
|
7
|
-
const R = (
|
|
8
|
-
const e = h(x),
|
|
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:
|
|
11
|
+
globalDataContext: n,
|
|
12
12
|
templateContext: o,
|
|
13
13
|
valueToEvaluate: w
|
|
14
14
|
}), c = d({
|
|
15
|
-
globalDataContext:
|
|
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:
|
|
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,
|
|
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 {
|
|
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 {
|
|
5
|
-
const
|
|
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
|
-
|
|
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 {
|
|
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 {
|
|
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 {
|
|
4
|
+
import { evaluateTemplateValue as i } from "../../engine/TemplateSystem.js";
|
|
5
5
|
const C = (e) => {
|
|
6
|
-
const
|
|
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:
|
|
14
|
-
templateContext:
|
|
13
|
+
globalDataContext: n,
|
|
14
|
+
templateContext: a
|
|
15
15
|
})
|
|
16
16
|
);
|
|
17
17
|
t.current.removeAttribute(m);
|
|
18
|
-
}, [o,
|
|
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 {
|
|
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 {
|
|
2
|
-
function T({ config: h, globalDataContext:
|
|
3
|
-
const { stringMap: M = {}, onErrorMap: p } = h, { updateData: g } =
|
|
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 }) =>
|
|
9
|
-
})).filter(Boolean).forEach(
|
|
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(
|
|
17
|
+
})).filter(Boolean).forEach(u);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function u({ destinationPath: e, value: r, updateMode: t }) {
|
|
20
20
|
g(r, e, t);
|
|
21
21
|
}
|
|
22
|
-
function
|
|
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] :
|
|
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:
|
|
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
|
|
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:
|
|
55
|
+
globalDataContext: a,
|
|
56
56
|
templateContext: i
|
|
57
57
|
});
|
|
58
|
-
if (typeof
|
|
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
|
-
|
|
63
|
+
o
|
|
64
64
|
);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
try {
|
|
68
68
|
const d = t({ location: n });
|
|
69
69
|
return {
|
|
70
|
-
destinationPath:
|
|
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:
|
|
80
|
+
globalDataContext: a,
|
|
81
81
|
templateContext: i,
|
|
82
82
|
evaluationDepth: -1
|
|
83
83
|
});
|
|
84
84
|
return {
|
|
85
|
-
destinationPath:
|
|
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 {
|
|
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
|
|
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",
|
|
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:
|
|
27
|
-
path:
|
|
28
|
-
value:
|
|
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
|
-
},
|
|
34
|
-
const [
|
|
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 ===
|
|
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} ${
|
|
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
|
-
|
|
71
|
+
c && /* @__PURE__ */ a(x, { children: [
|
|
71
72
|
/* @__PURE__ */ e(
|
|
72
73
|
"button",
|
|
73
74
|
{
|
|
74
|
-
className: `${n.btn} ${i ===
|
|
75
|
-
onClick: () => _(
|
|
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 ===
|
|
83
|
-
onClick: () => _(
|
|
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:
|
|
94
|
+
children: c ? "Collapse" : "Expand"
|
|
94
95
|
}
|
|
95
96
|
),
|
|
96
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 {
|
|
6
|
-
import { GlobalDataContext as
|
|
5
|
+
import { ActionDependant as G } from "../../../engine/Actions.js";
|
|
6
|
+
import { GlobalDataContext as H } from "../../../engine/GlobalDataContext.js";
|
|
7
7
|
import { TemplateContext as V } from "../../../engine/TemplateContext.js";
|
|
8
|
+
import { evaluateTemplateValue as O } from "../../../engine/TemplateSystem.js";
|
|
9
|
+
import { V as W } from "../../../View-D8TN1L2h.js";
|
|
8
10
|
import { propsDataLocationToPathAndValue as q } from "../../../engine/utility/formElementsCommon.js";
|
|
9
11
|
function y(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
|
|
14
|
-
for (r = 0; r <
|
|
15
|
+
var s = t.length;
|
|
16
|
+
for (r = 0; r < s; r++) t[r] && (n = y(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 = "",
|
|
21
|
+
for (var t, r, n = 0, a = "", s = arguments.length; n < s; n++) (t = arguments[n]) && (r = y(t)) && (a && (a += " "), a += r);
|
|
20
22
|
return a;
|
|
21
23
|
}
|
|
22
|
-
const
|
|
24
|
+
const ae = ({ props: t, path: r, datafield: n }) => {
|
|
23
25
|
var P, T;
|
|
24
|
-
const a = A(
|
|
25
|
-
let { formData: i, formDataPath:
|
|
26
|
+
const a = A(H), s = A(V);
|
|
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:
|
|
33
|
+
templateContext: s
|
|
32
34
|
});
|
|
33
35
|
if (i === void 0)
|
|
34
36
|
return null;
|
|
35
|
-
const L = t.itemTemplate ?? null, c =
|
|
37
|
+
const L = t.itemTemplate ?? null, c = O({
|
|
36
38
|
valueToEvaluate: t.treeRootPath ?? void 0,
|
|
37
39
|
globalDataContext: a,
|
|
38
|
-
templateContext:
|
|
39
|
-
}), v = t.maxDepth, w = typeof c != "string" ? !0 : t.maxDepthIsAbsolute ?? !0,
|
|
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 =
|
|
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 =
|
|
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
|
-
|
|
52
|
+
C && (b = m, i = o, u = d, i = [i[I]]);
|
|
51
53
|
}
|
|
52
54
|
const F = (e) => {
|
|
53
|
-
let m = e, o =
|
|
55
|
+
let m = e, o = u;
|
|
54
56
|
if (f > 0) {
|
|
55
57
|
m = _.cloneDeep(m);
|
|
56
|
-
const d = (l,
|
|
58
|
+
const d = (l, p = 0) => {
|
|
57
59
|
var x;
|
|
58
|
-
|
|
59
|
-
d(D,
|
|
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 &&
|
|
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 =
|
|
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(
|
|
@@ -105,13 +107,13 @@ const ee = ({ props: t, path: r, datafield: n }) => {
|
|
|
105
107
|
templatePath: x,
|
|
106
108
|
sortableTreeData: D
|
|
107
109
|
},
|
|
108
|
-
children: /* @__PURE__ */ h(
|
|
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(
|
|
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
|
-
|
|
134
|
+
ae as FolderSortableTree
|
|
133
135
|
};
|