@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.
Files changed (93) hide show
  1. package/README.md +1 -3
  2. package/dist/View-D8TN1L2h.js +126 -0
  3. package/dist/assets/VariablesDebug.css +1 -4
  4. package/dist/assets/reset.css +4 -0
  5. package/dist/assets/usePagination.css +1 -0
  6. package/dist/component/action/HashChangeListener.js +29 -7
  7. package/dist/component/action/MessageListener.js +26 -8
  8. package/dist/component/action/ReactOnEvent.js +64 -8
  9. package/dist/component/action/Redirect.js +9 -5
  10. package/dist/component/action/SetAttributeValue.js +37 -5
  11. package/dist/component/action/ToggleAttributeValue.js +56 -5
  12. package/dist/component/action/UnsetAttribute.js +20 -5
  13. package/dist/component/action/UnsetAttributeValue.js +58 -5
  14. package/dist/component/action/index.js +19 -15
  15. package/dist/component/dataMapping/index.js +6 -3
  16. package/dist/component/dataMapping/simpleMapping.js +93 -2
  17. package/dist/component/element/debug/VariablesDebug/VariablesDebug.js +110 -12
  18. package/dist/component/element/debug/index.js +2 -2
  19. package/dist/component/element/html/FolderSortableTree.js +133 -7
  20. package/dist/component/element/html/FormatNumeral.js +58 -6
  21. package/dist/component/element/html/Html.js +5 -3
  22. package/dist/component/element/html/LabelFromValue.js +27 -6
  23. package/dist/component/element/html/PreformattedMarkup.js +51 -6
  24. package/dist/component/element/html/SortableTreeItemCollapseButton.js +10 -5
  25. package/dist/component/element/html/index.js +11 -10
  26. package/dist/component/element/index.js +34 -29
  27. package/dist/component/element/special/Count.js +23 -12
  28. package/dist/component/element/special/DataFilter.js +76 -6
  29. package/dist/component/element/special/DelayedActions.js +47 -7
  30. package/dist/component/element/special/Phantom.js +13 -3
  31. package/dist/component/element/special/ReactiveJsonBasicComponentWrapper.js +32 -0
  32. package/dist/component/element/special/ReactiveJsonSubroot.js +8 -5
  33. package/dist/component/element/special/Switch.js +80 -8
  34. package/dist/component/element/special/index.js +16 -10
  35. package/dist/component/hook/index.js +1 -1
  36. package/dist/component/hook/usePagination.js +172 -4
  37. package/dist/component/index.js +84 -62
  38. package/dist/component/reaction/addData.js +23 -3
  39. package/dist/component/reaction/fetchData.js +12 -2
  40. package/dist/component/reaction/index.js +34 -12
  41. package/dist/component/reaction/moveData.js +34 -2
  42. package/dist/component/reaction/postMessage.js +23 -2
  43. package/dist/component/reaction/redirectNow.js +6 -2
  44. package/dist/component/reaction/removeData.js +27 -2
  45. package/dist/component/reaction/setClipboardData.js +16 -2
  46. package/dist/component/reaction/setData.js +22 -3
  47. package/dist/component/reaction/submitData.js +25 -2
  48. package/dist/component/reaction/utility/httpRequestCommon.js +5 -4
  49. package/dist/component/reaction/utility/index.js +1 -1
  50. package/dist/coreComponentsPlugin.js +5 -2
  51. package/dist/dnd-kit-sortable-tree.esm-Cz1RJyIg.js +4135 -0
  52. package/dist/engine/Actions.js +161 -10
  53. package/dist/engine/ParsingDebugDisplay/ParsingDebugDisplay.js +692 -3
  54. package/dist/engine/ReactiveJsonRoot.js +10 -5
  55. package/dist/engine/TemplateSystem.js +117 -11
  56. package/dist/engine/View.js +3 -6
  57. package/dist/engine/index.js +45 -40
  58. package/dist/engine/utility/alterData.js +27 -2
  59. package/dist/engine/utility/analyzeDataOverrideReferences.js +41 -2
  60. package/dist/engine/utility/formElementsCommon.js +34 -0
  61. package/dist/engine/utility/formatString.js +19 -3
  62. package/dist/engine/utility/index.js +15 -12
  63. package/dist/engine/utility/parseRjBuild.js +23 -1002
  64. package/dist/engine/utility/reactJsxHelpers.js +15 -0
  65. package/dist/httpRequestCommon-DUo2Oxgl.js +1799 -0
  66. package/dist/index-B3RKTGQ2.js +18 -0
  67. package/dist/index-BA09SSaJ.js +26 -0
  68. package/dist/index-BYLJtf9L.js +462 -0
  69. package/dist/index-CACLSxWi.js +8 -0
  70. package/dist/index-NNBvIV0S.js +1873 -0
  71. package/dist/js-yaml-Bw0KO4XO.js +983 -0
  72. package/dist/jsonpath-B9kE9k9e.js +3168 -0
  73. package/dist/{alterData-CjaFWyAA.js → lodash-CYNxjS-I.js} +1348 -1368
  74. package/dist/main.js +127 -101
  75. package/package.json +4 -4
  76. package/dist/ParsingDebugDisplay-8f4yL4Jw.js +0 -696
  77. package/dist/VariablesDebug-1UzZWgD7.js +0 -17782
  78. package/dist/component/action/Popover.js +0 -6
  79. package/dist/component/action/Tooltip.js +0 -5
  80. package/dist/component/element/form/CheckBoxField.js +0 -8
  81. package/dist/component/element/form/DateField.js +0 -8
  82. package/dist/component/element/form/NumberField.js +0 -8
  83. package/dist/component/element/form/SelectField.js +0 -8
  84. package/dist/component/element/form/TextAreaField.js +0 -8
  85. package/dist/component/element/form/TextField.js +0 -8
  86. package/dist/component/element/form/formElementsCommon.js +0 -4
  87. package/dist/component/element/form/index.js +0 -10
  88. package/dist/component/element/html/AccordionItem.js +0 -6
  89. package/dist/component/element/html/Modal.js +0 -8
  90. package/dist/component/element/html/Tabs.js +0 -8
  91. package/dist/component/element/special/BootstrapElement.js +0 -5
  92. package/dist/engine/PaginationProvider.js +0 -30
  93. package/dist/usePagination-Bb6lefHG.js +0 -353
@@ -1,12 +1,163 @@
1
- import "react/jsx-runtime";
2
- import "react";
3
- import "./GlobalDataContext.js";
4
- import "./TemplateContext.js";
5
- import { Y as s, X as d } from "../VariablesDebug-1UzZWgD7.js";
6
- import "../component/action/Hide.js";
7
- import "../component/action/VisuallyHide.js";
8
- import "../alterData-CjaFWyAA.js";
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
- s as ActionDependant,
11
- d as isValid
161
+ k as ActionDependant,
162
+ m as isValid
12
163
  };