@ea-lab/reactive-json 0.7.1 → 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/README.md +1 -3
- package/dist/View-D8TN1L2h.js +126 -0
- package/dist/assets/VariablesDebug.css +1 -4
- package/dist/assets/reset.css +4 -0
- package/dist/assets/usePagination.css +1 -0
- package/dist/component/action/HashChangeListener.js +29 -7
- package/dist/component/action/MessageListener.js +26 -8
- package/dist/component/action/ReactOnEvent.js +64 -8
- package/dist/component/action/Redirect.js +9 -5
- package/dist/component/action/SetAttributeValue.js +37 -5
- package/dist/component/action/ToggleAttributeValue.js +56 -5
- package/dist/component/action/UnsetAttribute.js +20 -5
- package/dist/component/action/UnsetAttributeValue.js +58 -5
- package/dist/component/action/index.js +19 -15
- package/dist/component/dataMapping/index.js +6 -3
- package/dist/component/dataMapping/simpleMapping.js +93 -2
- package/dist/component/element/debug/VariablesDebug/VariablesDebug.js +110 -12
- package/dist/component/element/debug/index.js +2 -2
- package/dist/component/element/html/FolderSortableTree.js +133 -7
- package/dist/component/element/html/FormatNumeral.js +58 -6
- package/dist/component/element/html/Html.js +5 -3
- package/dist/component/element/html/LabelFromValue.js +27 -6
- package/dist/component/element/html/PreformattedMarkup.js +51 -6
- package/dist/component/element/html/SortableTreeItemCollapseButton.js +10 -5
- package/dist/component/element/html/index.js +11 -10
- package/dist/component/element/index.js +34 -29
- package/dist/component/element/special/Count.js +23 -12
- package/dist/component/element/special/DataFilter.js +76 -6
- package/dist/component/element/special/DelayedActions.js +47 -7
- package/dist/component/element/special/Phantom.js +13 -3
- package/dist/component/element/special/ReactiveJsonBasicComponentWrapper.js +32 -0
- package/dist/component/element/special/ReactiveJsonSubroot.js +8 -5
- package/dist/component/element/special/Switch.js +80 -8
- package/dist/component/element/special/index.js +16 -10
- package/dist/component/hook/index.js +1 -1
- package/dist/component/hook/usePagination.js +172 -4
- package/dist/component/index.js +84 -62
- package/dist/component/reaction/addData.js +23 -3
- package/dist/component/reaction/fetchData.js +12 -2
- package/dist/component/reaction/index.js +34 -12
- package/dist/component/reaction/moveData.js +34 -2
- package/dist/component/reaction/postMessage.js +23 -2
- package/dist/component/reaction/redirectNow.js +6 -2
- package/dist/component/reaction/removeData.js +27 -2
- package/dist/component/reaction/setClipboardData.js +16 -2
- package/dist/component/reaction/setData.js +22 -3
- package/dist/component/reaction/submitData.js +25 -2
- package/dist/component/reaction/utility/httpRequestCommon.js +5 -4
- package/dist/component/reaction/utility/index.js +1 -1
- package/dist/coreComponentsPlugin.js +5 -2
- package/dist/dnd-kit-sortable-tree.esm-Cz1RJyIg.js +4135 -0
- package/dist/engine/Actions.js +161 -10
- package/dist/engine/ParsingDebugDisplay/ParsingDebugDisplay.js +692 -3
- package/dist/engine/ReactiveJsonRoot.js +10 -5
- package/dist/engine/TemplateSystem.js +117 -11
- package/dist/engine/View.js +3 -6
- package/dist/engine/index.js +45 -40
- package/dist/engine/utility/alterData.js +27 -2
- package/dist/engine/utility/analyzeDataOverrideReferences.js +41 -2
- package/dist/engine/utility/formElementsCommon.js +34 -0
- package/dist/engine/utility/formatString.js +19 -3
- package/dist/engine/utility/index.js +15 -12
- package/dist/engine/utility/parseRjBuild.js +23 -1002
- package/dist/engine/utility/reactJsxHelpers.js +15 -0
- package/dist/httpRequestCommon-DUo2Oxgl.js +1799 -0
- package/dist/index-B3RKTGQ2.js +18 -0
- package/dist/index-BA09SSaJ.js +26 -0
- package/dist/index-BYLJtf9L.js +462 -0
- package/dist/index-CACLSxWi.js +8 -0
- package/dist/index-NNBvIV0S.js +1873 -0
- package/dist/js-yaml-Bw0KO4XO.js +983 -0
- package/dist/jsonpath-B9kE9k9e.js +3168 -0
- package/dist/{alterData-CjaFWyAA.js → lodash-CYNxjS-I.js} +1348 -1368
- package/dist/main.js +127 -101
- package/package.json +4 -4
- package/dist/ParsingDebugDisplay-8f4yL4Jw.js +0 -696
- package/dist/VariablesDebug-1UzZWgD7.js +0 -17782
- package/dist/component/action/Popover.js +0 -6
- package/dist/component/action/Tooltip.js +0 -5
- package/dist/component/element/form/CheckBoxField.js +0 -8
- package/dist/component/element/form/DateField.js +0 -8
- package/dist/component/element/form/NumberField.js +0 -8
- package/dist/component/element/form/SelectField.js +0 -8
- package/dist/component/element/form/TextAreaField.js +0 -8
- package/dist/component/element/form/TextField.js +0 -8
- package/dist/component/element/form/formElementsCommon.js +0 -4
- package/dist/component/element/form/index.js +0 -10
- package/dist/component/element/html/AccordionItem.js +0 -6
- package/dist/component/element/html/Modal.js +0 -8
- package/dist/component/element/html/Tabs.js +0 -8
- package/dist/component/element/special/BootstrapElement.js +0 -5
- package/dist/engine/PaginationProvider.js +0 -30
- package/dist/usePagination-Bb6lefHG.js +0 -353
package/dist/engine/Actions.js
CHANGED
|
@@ -1,12 +1,163 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "
|
|
3
|
-
import "
|
|
4
|
-
import "
|
|
5
|
-
import {
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
|
|
1
|
+
import { jsx as v } from "react/jsx-runtime";
|
|
2
|
+
import { J as g } from "../jsonpath-B9kE9k9e.js";
|
|
3
|
+
import { l as O } from "../lodash-CYNxjS-I.js";
|
|
4
|
+
import { useContext as C } from "react";
|
|
5
|
+
import { GlobalDataContext as A } from "./GlobalDataContext.js";
|
|
6
|
+
import { TemplateContext as x } from "./TemplateContext.js";
|
|
7
|
+
import { isTemplateValue as b, evaluateTemplateValue as D } from "./TemplateSystem.js";
|
|
8
|
+
const P = (e) => e && e.charAt(0).toUpperCase() + e.slice(1), m = (e, c, u) => {
|
|
9
|
+
const { globalDataContext: h, templateContext: l } = c;
|
|
10
|
+
if (Array.isArray(e.andConditions))
|
|
11
|
+
return e.andConditions.reduce((t, s) => t && m(s, c, u), !0);
|
|
12
|
+
if (Array.isArray(e.orConditions)) {
|
|
13
|
+
const t = e.orConditions;
|
|
14
|
+
for (const s of t)
|
|
15
|
+
if (m(s, c, u))
|
|
16
|
+
return !0;
|
|
17
|
+
return !1;
|
|
18
|
+
}
|
|
19
|
+
if (e.when !== void 0 && !b(e.when))
|
|
20
|
+
return !1;
|
|
21
|
+
const f = (t) => D({
|
|
22
|
+
globalDataContext: h,
|
|
23
|
+
templateContext: l,
|
|
24
|
+
valueToEvaluate: t
|
|
25
|
+
});
|
|
26
|
+
let r;
|
|
27
|
+
if (e.when === void 0 && e.hasOwnProperty("whenDataCountOf")) {
|
|
28
|
+
let t;
|
|
29
|
+
switch (e.inContext) {
|
|
30
|
+
case "root":
|
|
31
|
+
t = h.getRootContext().templateData;
|
|
32
|
+
break;
|
|
33
|
+
case "template":
|
|
34
|
+
t = l.templateData;
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
t = h.templateData;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
r = g.query(t, e.whenDataCountOf).length;
|
|
41
|
+
} else
|
|
42
|
+
r = (() => {
|
|
43
|
+
if (u) {
|
|
44
|
+
for (const [t, s] of u)
|
|
45
|
+
if (e.hasOwnProperty(t))
|
|
46
|
+
return s({
|
|
47
|
+
condition: e,
|
|
48
|
+
templateContexts: c,
|
|
49
|
+
evaluateAgainstTemplates: (a) => f(a)
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return f(e.when);
|
|
53
|
+
})();
|
|
54
|
+
if (e.hasOwnProperty("isEmpty") || e.hasOwnProperty("isNotEmpty")) {
|
|
55
|
+
const t = (s) => e.hasOwnProperty("isEmpty") ? e.isEmpty === "not" ? !s : s : !s;
|
|
56
|
+
if (r === null)
|
|
57
|
+
return t(!0);
|
|
58
|
+
switch (typeof r) {
|
|
59
|
+
case "undefined":
|
|
60
|
+
return t(!0);
|
|
61
|
+
case "string":
|
|
62
|
+
return t(r.length === 0);
|
|
63
|
+
case "object":
|
|
64
|
+
return t(Object.keys(r).length === 0);
|
|
65
|
+
default:
|
|
66
|
+
return t(!r);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const n = e.compareAsDates;
|
|
70
|
+
if (e.hasOwnProperty("isNot"))
|
|
71
|
+
return o(n, r) !== o(n, f(e.isNot));
|
|
72
|
+
if (e.hasOwnProperty("is"))
|
|
73
|
+
return o(n, r) === o(n, f(e.is));
|
|
74
|
+
if (e.hasOwnProperty("containsNot") || e.hasOwnProperty("contains")) {
|
|
75
|
+
const t = e.hasOwnProperty("containsNot"), s = t ? e.containsNot : e.contains, a = o(n, f(s));
|
|
76
|
+
if (typeof r == "string") {
|
|
77
|
+
if (typeof a != "string")
|
|
78
|
+
return t;
|
|
79
|
+
const i = r.toLowerCase().indexOf(a.toLowerCase()) !== -1;
|
|
80
|
+
return t ? !i : i;
|
|
81
|
+
} else
|
|
82
|
+
for (const i of Object.values(r))
|
|
83
|
+
if (O.isEqual(o(n, i), a))
|
|
84
|
+
return !t;
|
|
85
|
+
return t;
|
|
86
|
+
}
|
|
87
|
+
if (e.hasOwnProperty("containedByNot") || e.hasOwnProperty("containedBy")) {
|
|
88
|
+
const t = e.hasOwnProperty("containedByNot"), s = t ? e.containedByNot : e.containedBy, a = o(n, f(s));
|
|
89
|
+
if (typeof r == "string") {
|
|
90
|
+
if (typeof a != "string")
|
|
91
|
+
return t;
|
|
92
|
+
const i = a.toLowerCase().indexOf(r.toLowerCase()) !== -1;
|
|
93
|
+
return t ? !i : i;
|
|
94
|
+
} else
|
|
95
|
+
for (const i of Object.values(a))
|
|
96
|
+
if (O.isEqual(o(n, i), r))
|
|
97
|
+
return !t;
|
|
98
|
+
return t;
|
|
99
|
+
}
|
|
100
|
+
return e.hasOwnProperty(">") ? o(n, r) > o(n, f(e[">"])) : e.hasOwnProperty(">=") ? o(n, r) >= o(n, f(e[">="])) : e.hasOwnProperty("<") ? o(n, r) < o(n, f(e["<"])) : e.hasOwnProperty("<=") ? o(n, r) <= o(n, f(e["<="])) : !0;
|
|
101
|
+
}, E = (e, c) => {
|
|
102
|
+
const u = [];
|
|
103
|
+
let h = !1;
|
|
104
|
+
const l = {};
|
|
105
|
+
if (!Array.isArray(e))
|
|
106
|
+
return u;
|
|
107
|
+
const { globalDataContext: f } = c, r = f.plugins ?? {}, n = (r == null ? void 0 : r.action) ?? {}, t = (r == null ? void 0 : r.reaction) ?? {};
|
|
108
|
+
if (!n)
|
|
109
|
+
return u;
|
|
110
|
+
for (const [s, a] of e.entries()) {
|
|
111
|
+
const i = (a == null ? void 0 : a.what) ?? void 0;
|
|
112
|
+
if (!i)
|
|
113
|
+
continue;
|
|
114
|
+
let y = n[i] ?? void 0, w = t[i] ?? void 0;
|
|
115
|
+
if (!y && !w && (y = n[P(i)]), !y) {
|
|
116
|
+
if (!w || a.on === void 0 || !m(a, c))
|
|
117
|
+
continue;
|
|
118
|
+
if (a.on === "message") {
|
|
119
|
+
if (!n.MessageListener)
|
|
120
|
+
continue;
|
|
121
|
+
u.push({ ActionComponent: n.MessageListener, actionProps: a, actionIndex: s });
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (a.on === "hashchange") {
|
|
125
|
+
if (!n.HashChangeListener)
|
|
126
|
+
continue;
|
|
127
|
+
u.push({ ActionComponent: n.HashChangeListener, actionProps: a, actionIndex: s });
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
h = !0;
|
|
131
|
+
const p = "on" + P(a.on);
|
|
132
|
+
Array.isArray(l[p]) || (l[p] = []), l[p].push(a);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
m(a, c) && u.push({ ActionComponent: y, actionProps: a, actionIndex: s });
|
|
136
|
+
}
|
|
137
|
+
if (h) {
|
|
138
|
+
if (!n.ReactOnEvent)
|
|
139
|
+
return u;
|
|
140
|
+
u.push({
|
|
141
|
+
ActionComponent: n.ReactOnEvent,
|
|
142
|
+
actionProps: l,
|
|
143
|
+
actionIndex: "_reactOnEvent"
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
return u;
|
|
147
|
+
}, o = (e, c) => e ? new Date(c) : c, k = (e) => {
|
|
148
|
+
const c = C(A), u = C(x);
|
|
149
|
+
return e ? E((e == null ? void 0 : e.actions) ?? [], { globalDataContext: c, templateContext: u }).reverse().reduce((l, { ActionComponent: f, actionProps: r, actionIndex: n }) => /* @__PURE__ */ v(
|
|
150
|
+
f,
|
|
151
|
+
{
|
|
152
|
+
componentProps: e,
|
|
153
|
+
actionProps: r,
|
|
154
|
+
actionIndex: n,
|
|
155
|
+
attributesHolderRef: e.attributesHolderRef,
|
|
156
|
+
children: l
|
|
157
|
+
}
|
|
158
|
+
), (e == null ? void 0 : e.children) ?? null) : null;
|
|
159
|
+
};
|
|
9
160
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
161
|
+
k as ActionDependant,
|
|
162
|
+
m as isValid
|
|
12
163
|
};
|