@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
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "react";
|
|
3
|
-
import "../../../engine/GlobalDataContext.js";
|
|
4
|
-
import "../../../engine/TemplateContext.js";
|
|
5
|
-
import "../../../
|
|
6
|
-
import "
|
|
7
|
-
import "../../../
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { J as x } from "../../../jsonpath-B9kE9k9e.js";
|
|
2
|
+
import { useContext as t } from "react";
|
|
3
|
+
import { GlobalDataContext as a } from "../../../engine/GlobalDataContext.js";
|
|
4
|
+
import { TemplateContext as r } from "../../../engine/TemplateContext.js";
|
|
5
|
+
import "../../../lodash-CYNxjS-I.js";
|
|
6
|
+
import { maybeFormatString as C } from "../../../engine/utility/formatString.js";
|
|
7
|
+
import "../../../js-yaml-Bw0KO4XO.js";
|
|
8
|
+
const j = ({ props: l }) => {
|
|
9
|
+
const s = t(a), m = t(r), { context: e = "global", jsonPathPattern: o } = l, n = t(e === "template" ? r : a);
|
|
10
|
+
if (!o)
|
|
11
|
+
return null;
|
|
12
|
+
const c = C(
|
|
13
|
+
{
|
|
14
|
+
templateContexts: {
|
|
15
|
+
globalDataContext: s,
|
|
16
|
+
templateContext: m
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
o
|
|
20
|
+
), p = e === "root" ? n.getRootContext().templateData : n.templateData;
|
|
21
|
+
return x.query(p, c).length;
|
|
22
|
+
};
|
|
12
23
|
export {
|
|
13
|
-
|
|
24
|
+
j as Count
|
|
14
25
|
};
|
|
@@ -1,8 +1,78 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import {
|
|
4
|
-
import "../../../engine/GlobalDataContext.js";
|
|
5
|
-
import "../../../engine/TemplateContext.js";
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as b } from "react";
|
|
3
|
+
import { isValid as P } from "../../../engine/Actions.js";
|
|
4
|
+
import { GlobalDataContext as D } from "../../../engine/GlobalDataContext.js";
|
|
5
|
+
import { TemplateContext as x } from "../../../engine/TemplateContext.js";
|
|
6
|
+
import { V as v } from "../../../View-D8TN1L2h.js";
|
|
7
|
+
const W = (t) => {
|
|
8
|
+
var u, f;
|
|
9
|
+
const o = b(D), e = b(x), n = { globalDataContext: o, templateContext: e }, { contextToFilter: l = "global", filters: y = [] } = t.props, s = (p) => {
|
|
10
|
+
if (!p)
|
|
11
|
+
return !0;
|
|
12
|
+
for (const r of y) {
|
|
13
|
+
const m = (r == null ? void 0 : r.subjectsWithProperty) ?? void 0;
|
|
14
|
+
if (!m || !p.hasOwnProperty(m))
|
|
15
|
+
continue;
|
|
16
|
+
if (!P(r, n, /* @__PURE__ */ new Map([
|
|
17
|
+
[
|
|
18
|
+
"whenFilterableData",
|
|
19
|
+
({ condition: C }) => {
|
|
20
|
+
const w = C.whenFilterableData.split(".");
|
|
21
|
+
let i = p;
|
|
22
|
+
for (const h of w) {
|
|
23
|
+
const d = parseInt(h);
|
|
24
|
+
if (i = i[isNaN(d) ? h : d], i === void 0)
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
return i;
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
])))
|
|
31
|
+
return !1;
|
|
32
|
+
}
|
|
33
|
+
return !0;
|
|
34
|
+
};
|
|
35
|
+
switch (l) {
|
|
36
|
+
case "template":
|
|
37
|
+
return e.templateData = c(e.templateData, s), e.templatePath = t.path, /* @__PURE__ */ a(x.Provider, { value: e, children: /* @__PURE__ */ a(
|
|
38
|
+
v,
|
|
39
|
+
{
|
|
40
|
+
props: t.props.content,
|
|
41
|
+
path: t.path + ".content",
|
|
42
|
+
datafield: "content",
|
|
43
|
+
currentData: ((u = t.currentData) == null ? void 0 : u.content) ?? void 0
|
|
44
|
+
}
|
|
45
|
+
) });
|
|
46
|
+
case "global":
|
|
47
|
+
default:
|
|
48
|
+
return o.templateData = c(o.templateData, s), /* @__PURE__ */ a(D.Provider, { value: o, children: /* @__PURE__ */ a(
|
|
49
|
+
v,
|
|
50
|
+
{
|
|
51
|
+
props: t.props.content,
|
|
52
|
+
path: t.path + ".content",
|
|
53
|
+
datafield: "content",
|
|
54
|
+
currentData: ((f = t.currentData) == null ? void 0 : f.content) ?? void 0
|
|
55
|
+
}
|
|
56
|
+
) });
|
|
57
|
+
}
|
|
58
|
+
}, c = (t, o) => {
|
|
59
|
+
if (Array.isArray(t)) {
|
|
60
|
+
const e = {};
|
|
61
|
+
return t.forEach((n, l) => {
|
|
62
|
+
o(n) && (e[l] = c(n, o));
|
|
63
|
+
}), e;
|
|
64
|
+
} else if (typeof t == "object" && t !== null) {
|
|
65
|
+
const e = {};
|
|
66
|
+
for (const n in t)
|
|
67
|
+
if (t.hasOwnProperty(n)) {
|
|
68
|
+
if (!o(t[n]))
|
|
69
|
+
continue;
|
|
70
|
+
e[n] = c(t[n], o);
|
|
71
|
+
}
|
|
72
|
+
return e;
|
|
73
|
+
} else
|
|
74
|
+
return t;
|
|
75
|
+
};
|
|
6
76
|
export {
|
|
7
|
-
|
|
77
|
+
W as DataFilter
|
|
8
78
|
};
|
|
@@ -1,9 +1,49 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import "../../../engine/
|
|
4
|
-
import "../../../engine/
|
|
5
|
-
import "
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as m, useEffect as x } from "react";
|
|
3
|
+
import { ActionDependant as v, isValid as A } from "../../../engine/Actions.js";
|
|
4
|
+
import { GlobalDataContext as F } from "../../../engine/GlobalDataContext.js";
|
|
5
|
+
import { TemplateContext as h } from "../../../engine/TemplateContext.js";
|
|
6
|
+
import { V as y } from "../../../View-D8TN1L2h.js";
|
|
7
|
+
const V = ({ props: t, currentData: e, path: i }) => {
|
|
8
|
+
const c = m(F), n = m(h), a = Array.isArray(t.delayedActions) ? t.delayedActions : [], o = { globalDataContext: c, templateContext: n };
|
|
9
|
+
return x(() => {
|
|
10
|
+
if (!t.interval)
|
|
11
|
+
return;
|
|
12
|
+
const r = setInterval(() => {
|
|
13
|
+
const l = g(a, o);
|
|
14
|
+
for (let u = 0; u < l.length; ++u) {
|
|
15
|
+
const s = l[u];
|
|
16
|
+
if (!s)
|
|
17
|
+
continue;
|
|
18
|
+
const f = s.what && (reactionFunctions[s.what] ?? null);
|
|
19
|
+
f && f({ args: s, globalDataContext: c, templateContext: n });
|
|
20
|
+
}
|
|
21
|
+
t.once && clearInterval(r);
|
|
22
|
+
}, t.interval);
|
|
23
|
+
return () => clearInterval(r);
|
|
24
|
+
}, [c, n]), /* @__PURE__ */ d(v, { ...t, children: t.content && /* @__PURE__ */ d(
|
|
25
|
+
y,
|
|
26
|
+
{
|
|
27
|
+
props: t.content,
|
|
28
|
+
currentData: (e == null ? void 0 : e.content) ?? void 0,
|
|
29
|
+
datafield: "content",
|
|
30
|
+
path: i + ".content"
|
|
31
|
+
}
|
|
32
|
+
) });
|
|
33
|
+
}, g = (t, e) => {
|
|
34
|
+
const i = [];
|
|
35
|
+
if (!Array.isArray(t))
|
|
36
|
+
return i;
|
|
37
|
+
const { globalDataContext: c } = e, n = c.plugins ?? {}, a = (n == null ? void 0 : n.reaction) ?? {};
|
|
38
|
+
if (!a)
|
|
39
|
+
return i;
|
|
40
|
+
for (const [, o] of t.entries()) {
|
|
41
|
+
const r = (o == null ? void 0 : o.what) ?? void 0;
|
|
42
|
+
!r || !(a[r] ?? void 0) || A(o, e) && i.push(o);
|
|
43
|
+
}
|
|
44
|
+
return i;
|
|
45
|
+
};
|
|
6
46
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
47
|
+
V as DelayedActions,
|
|
48
|
+
g as getReactionFunctionsToExecute
|
|
9
49
|
};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { ActionDependant as i } from "../../../engine/Actions.js";
|
|
3
|
+
import { V as m } from "../../../View-D8TN1L2h.js";
|
|
4
|
+
const p = ({ props: o, currentData: t, path: e }) => /* @__PURE__ */ n(i, { ...o, children: o.content && /* @__PURE__ */ n(
|
|
5
|
+
m,
|
|
6
|
+
{
|
|
7
|
+
props: o.content,
|
|
8
|
+
currentData: (t == null ? void 0 : t.content) ?? void 0,
|
|
9
|
+
datafield: "content",
|
|
10
|
+
path: e + ".content"
|
|
11
|
+
}
|
|
12
|
+
) });
|
|
3
13
|
export {
|
|
4
|
-
|
|
14
|
+
p as Phantom
|
|
5
15
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { ActionDependant as m } from "../../../engine/Actions.js";
|
|
3
|
+
import "../../../engine/EventDispatcherContext.js";
|
|
4
|
+
import "../../../engine/EventDispatcherProvider.js";
|
|
5
|
+
import "../../../engine/GlobalDataContext.js";
|
|
6
|
+
import "../../../engine/PaginationContext.js";
|
|
7
|
+
import "../../../lodash-CYNxjS-I.js";
|
|
8
|
+
import "react";
|
|
9
|
+
import "../../../dnd-kit-sortable-tree.esm-Cz1RJyIg.js";
|
|
10
|
+
import "../../../engine/TemplateContext.js";
|
|
11
|
+
import { useEvaluatedAttributes as p } from "../../../engine/TemplateSystem.js";
|
|
12
|
+
import '../../../assets/reset.css';/* empty css */
|
|
13
|
+
import { V as a } from "../../../View-D8TN1L2h.js";
|
|
14
|
+
import "../../../index-NNBvIV0S.js";
|
|
15
|
+
import "../../../jsonpath-B9kE9k9e.js";
|
|
16
|
+
import "../../../js-yaml-Bw0KO4XO.js";
|
|
17
|
+
import "../../../engine/ParsingDebugDisplay/ParsingDebugDisplay.js";
|
|
18
|
+
function R({ props: t, currentData: i, path: e, reactComponent: o }) {
|
|
19
|
+
const n = p(t.attributes);
|
|
20
|
+
return o ? /* @__PURE__ */ r(m, { ...t, children: /* @__PURE__ */ r(o, { ...n, children: t.content && /* @__PURE__ */ r(
|
|
21
|
+
a,
|
|
22
|
+
{
|
|
23
|
+
currentData: i.content ?? void 0,
|
|
24
|
+
datafield: "content",
|
|
25
|
+
path: e + ".content",
|
|
26
|
+
props: t.content
|
|
27
|
+
}
|
|
28
|
+
) }) }) : null;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
R as ReactiveJsonBasicComponentWrapper
|
|
32
|
+
};
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import "../../../engine/Actions.js";
|
|
3
3
|
import "../../../engine/EventDispatcherContext.js";
|
|
4
4
|
import "../../../engine/EventDispatcherProvider.js";
|
|
5
5
|
import "../../../engine/GlobalDataContext.js";
|
|
6
6
|
import "../../../engine/PaginationContext.js";
|
|
7
|
-
import "
|
|
7
|
+
import { R as u } from "../../../index-BYLJtf9L.js";
|
|
8
8
|
import "../../../engine/TemplateContext.js";
|
|
9
|
-
import "../../../
|
|
10
|
-
import "../../../
|
|
9
|
+
import "../../../engine/TemplateSystem.js";
|
|
10
|
+
import "../../../lodash-CYNxjS-I.js";
|
|
11
|
+
import "../../../engine/utility/analyzeDataOverrideReferences.js";
|
|
12
|
+
import "../../../js-yaml-Bw0KO4XO.js";
|
|
13
|
+
import "react";
|
|
11
14
|
export {
|
|
12
|
-
|
|
15
|
+
u as ReactiveJsonSubroot
|
|
13
16
|
};
|
|
@@ -1,10 +1,82 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import {
|
|
4
|
-
import "../../../engine/GlobalDataContext.js";
|
|
5
|
-
import "../../../engine/PaginationContext.js";
|
|
6
|
-
import "../../../engine/TemplateContext.js";
|
|
7
|
-
import "../../../
|
|
1
|
+
import { jsx as a, jsxs as y, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as T, createElement as A } from "react";
|
|
3
|
+
import { ActionDependant as L } from "../../../engine/Actions.js";
|
|
4
|
+
import { GlobalDataContext as k } from "../../../engine/GlobalDataContext.js";
|
|
5
|
+
import { PaginationContext as z } from "../../../engine/PaginationContext.js";
|
|
6
|
+
import { TemplateContext as B } from "../../../engine/TemplateContext.js";
|
|
7
|
+
import { evaluateTemplateValue as F, isTemplateValue as G, dataLocationToPath as K, evaluateAttributes as R } from "../../../engine/TemplateSystem.js";
|
|
8
|
+
import { V as x } from "../../../View-D8TN1L2h.js";
|
|
9
|
+
import { usePagination as q } from "../../hook/usePagination.js";
|
|
10
|
+
const _ = ({ props: t, currentData: e, path: f }) => {
|
|
11
|
+
const m = T(k), i = T(B), g = (t == null ? void 0 : t.cardinality) ?? -1, V = (t == null ? void 0 : t.options) ?? [], h = (t == null ? void 0 : t.singleOption) ?? void 0, C = !!h, l = (t == null ? void 0 : t.content) ?? null, P = l && F({
|
|
12
|
+
globalDataContext: m,
|
|
13
|
+
templateContext: i,
|
|
14
|
+
valueToEvaluate: l
|
|
15
|
+
}), u = Object.entries(typeof P == "object" ? P : e).map(([I, n]) => {
|
|
16
|
+
const o = I;
|
|
17
|
+
if (g >= 1 && o >= g || !n || typeof n != "object")
|
|
18
|
+
return null;
|
|
19
|
+
let c, b, d;
|
|
20
|
+
if (C)
|
|
21
|
+
b = n, d = h;
|
|
22
|
+
else {
|
|
23
|
+
if (c = Object.keys(n)[0] ?? void 0, c === void 0)
|
|
24
|
+
return null;
|
|
25
|
+
b = Object.values(n)[0] ?? void 0, d = V[c] ?? void 0;
|
|
26
|
+
}
|
|
27
|
+
if (d === void 0)
|
|
28
|
+
return null;
|
|
29
|
+
let S = (G(l) && K({
|
|
30
|
+
dataLocation: l,
|
|
31
|
+
currentPath: i.templatePath,
|
|
32
|
+
globalDataContext: m,
|
|
33
|
+
templateContext: i
|
|
34
|
+
}) || f) + "." + o;
|
|
35
|
+
return C || (S += "." + c), /* @__PURE__ */ a(
|
|
36
|
+
x,
|
|
37
|
+
{
|
|
38
|
+
currentData: b,
|
|
39
|
+
datafield: o,
|
|
40
|
+
path: S,
|
|
41
|
+
props: d
|
|
42
|
+
},
|
|
43
|
+
o
|
|
44
|
+
);
|
|
45
|
+
}), v = q({
|
|
46
|
+
dataToPaginate: u,
|
|
47
|
+
...(t == null ? void 0 : t.paginationProps) ?? {}
|
|
48
|
+
}), j = t != null && t.paginated ? u.slice(v.firstShownItemIndex, v.maxShownItemIndexExcluded) : u, w = t != null && t.contentWrapper ? A(
|
|
49
|
+
t.contentWrapper.tag ?? "div",
|
|
50
|
+
R({
|
|
51
|
+
attrs: t.contentWrapper.attributes ?? {},
|
|
52
|
+
globalDataContext: m,
|
|
53
|
+
options: { normalizeBeforeEvaluation: !0 },
|
|
54
|
+
templateContext: i
|
|
55
|
+
}),
|
|
56
|
+
j
|
|
57
|
+
) : j, O = /* @__PURE__ */ y(W, { children: [
|
|
58
|
+
(t == null ? void 0 : t.before) && /* @__PURE__ */ a(
|
|
59
|
+
x,
|
|
60
|
+
{
|
|
61
|
+
currentData: (e == null ? void 0 : e.before) ?? void 0,
|
|
62
|
+
path: f + ".before",
|
|
63
|
+
datafield: "before",
|
|
64
|
+
props: t == null ? void 0 : t.before
|
|
65
|
+
}
|
|
66
|
+
),
|
|
67
|
+
w,
|
|
68
|
+
(t == null ? void 0 : t.after) && /* @__PURE__ */ a(
|
|
69
|
+
x,
|
|
70
|
+
{
|
|
71
|
+
currentData: (e == null ? void 0 : e.after) ?? void 0,
|
|
72
|
+
path: f + ".after",
|
|
73
|
+
datafield: "after",
|
|
74
|
+
props: t == null ? void 0 : t.after
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
] });
|
|
78
|
+
return /* @__PURE__ */ a(L, { ...t, children: t != null && t.paginated ? /* @__PURE__ */ a(z.Provider, { value: { pagination: v }, children: O }) : O });
|
|
79
|
+
};
|
|
8
80
|
export {
|
|
9
|
-
|
|
81
|
+
_ as Switch
|
|
10
82
|
};
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Count as e } from "./Count.js";
|
|
2
|
+
import { DataFilter as a } from "./DataFilter.js";
|
|
3
|
+
import { DelayedActions as p, getReactionFunctionsToExecute as m } from "./DelayedActions.js";
|
|
4
|
+
import { PageControls as c } from "./PageControls.js";
|
|
5
|
+
import { Phantom as i } from "./Phantom.js";
|
|
6
|
+
import { ReactiveJsonBasicComponentWrapper as u } from "./ReactiveJsonBasicComponentWrapper.js";
|
|
7
|
+
import { R as l } from "../../../index-BYLJtf9L.js";
|
|
8
|
+
import { Switch as g } from "./Switch.js";
|
|
3
9
|
export {
|
|
4
|
-
a as BootstrapElement,
|
|
5
10
|
e as Count,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
a as DataFilter,
|
|
12
|
+
p as DelayedActions,
|
|
13
|
+
c as PageControls,
|
|
14
|
+
i as Phantom,
|
|
15
|
+
u as ReactiveJsonBasicComponentWrapper,
|
|
16
|
+
l as ReactiveJsonSubroot,
|
|
17
|
+
g as Switch,
|
|
18
|
+
m as getReactionFunctionsToExecute
|
|
13
19
|
};
|
|
@@ -1,6 +1,174 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "react";
|
|
3
|
-
import {
|
|
1
|
+
import { jsx as t, jsxs as A } from "react/jsx-runtime";
|
|
2
|
+
import { useContext as w, useState as y } from "react";
|
|
3
|
+
import { GlobalDataContext as j } from "../../engine/GlobalDataContext.js";
|
|
4
|
+
import '../../assets/usePagination.css';const V = "_paginationContainer_1uiid_1", $ = "_paginationFirst_1uiid_11", S = "_paginationPrev_1uiid_12", q = "_paginationItem_1uiid_13", z = "_paginationNext_1uiid_14", H = "_paginationLast_1uiid_15", J = "_active_1uiid_71", K = "_paginationEllipsis_1uiid_83", r = {
|
|
5
|
+
paginationContainer: V,
|
|
6
|
+
paginationFirst: $,
|
|
7
|
+
paginationPrev: S,
|
|
8
|
+
paginationItem: q,
|
|
9
|
+
paginationNext: z,
|
|
10
|
+
paginationLast: H,
|
|
11
|
+
active: J,
|
|
12
|
+
paginationEllipsis: K
|
|
13
|
+
}, ti = ({
|
|
14
|
+
customComponents: i = {},
|
|
15
|
+
containerProps: n = {},
|
|
16
|
+
dataToPaginate: e = [],
|
|
17
|
+
forcePaginationDisplay: o = !1,
|
|
18
|
+
itemProps: u = {},
|
|
19
|
+
maxPageButtonsCount: c = 5,
|
|
20
|
+
pageMaxItemCount: p = 10
|
|
21
|
+
}) => {
|
|
22
|
+
var x;
|
|
23
|
+
const d = w(j), l = ((x = d == null ? void 0 : d.plugins) == null ? void 0 : x.pagination) ?? {}, E = i.Container ?? l.Container ?? O, F = i.First ?? l.First ?? Q, I = i.Prev ?? l.Prev ?? R, L = i.Item ?? l.Item ?? U, v = i.Ellipsis ?? l.Ellipsis ?? W, D = i.Next ?? l.Next ?? X, k = i.Last ?? l.Last ?? Y, [s, g] = y(0), f = Math.floor(c / 2), P = s * p, N = P + p, m = (a) => Math.ceil(a.length / p);
|
|
24
|
+
return {
|
|
25
|
+
firstShownItemIndex: P,
|
|
26
|
+
getPageCountForContent: m,
|
|
27
|
+
maxShownItemIndexExcluded: N,
|
|
28
|
+
PageControls: () => {
|
|
29
|
+
const a = m(e);
|
|
30
|
+
return !o && a <= 1 ? null : /* @__PURE__ */ A(E, { ...n, children: [
|
|
31
|
+
/* @__PURE__ */ t(
|
|
32
|
+
F,
|
|
33
|
+
{
|
|
34
|
+
disabled: s <= 0,
|
|
35
|
+
onClick: () => {
|
|
36
|
+
g(0);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ t(
|
|
41
|
+
I,
|
|
42
|
+
{
|
|
43
|
+
disabled: s <= 0,
|
|
44
|
+
onClick: () => {
|
|
45
|
+
g(s - 1);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
Math.min(s - f, a - c) > 0 ? /* @__PURE__ */ t(v, { disabled: !0 }) : null,
|
|
50
|
+
(() => {
|
|
51
|
+
const C = [];
|
|
52
|
+
let _ = Math.min(
|
|
53
|
+
Math.max(0, a - c),
|
|
54
|
+
Math.max(0, s - f)
|
|
55
|
+
), b = c;
|
|
56
|
+
const M = (h, G) => {
|
|
57
|
+
C.push(
|
|
58
|
+
/* @__PURE__ */ t(
|
|
59
|
+
L,
|
|
60
|
+
{
|
|
61
|
+
active: s === h,
|
|
62
|
+
onClick: () => {
|
|
63
|
+
g(h);
|
|
64
|
+
},
|
|
65
|
+
...u,
|
|
66
|
+
children: h + 1
|
|
67
|
+
},
|
|
68
|
+
c - G
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
};
|
|
72
|
+
for (; b && (M(_, b), ++_, --b, !(_ >= a)); )
|
|
73
|
+
;
|
|
74
|
+
return C;
|
|
75
|
+
})(),
|
|
76
|
+
a > Math.max(f, s) + Math.ceil(c / 2) ? /* @__PURE__ */ t(v, { disabled: !0 }) : null,
|
|
77
|
+
/* @__PURE__ */ t(
|
|
78
|
+
D,
|
|
79
|
+
{
|
|
80
|
+
disabled: s + 1 >= a,
|
|
81
|
+
onClick: () => {
|
|
82
|
+
g(s + 1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ t(
|
|
87
|
+
k,
|
|
88
|
+
{
|
|
89
|
+
disabled: s + 1 >= a,
|
|
90
|
+
onClick: () => {
|
|
91
|
+
g(a - 1);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
] });
|
|
96
|
+
},
|
|
97
|
+
pageMaxItemCount: p,
|
|
98
|
+
sliceVisibleContent: (a) => Array.isArray(a) ? a.slice(P, N) : a
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
function O({ children: i, ...n }) {
|
|
102
|
+
return /* @__PURE__ */ t("nav", { "aria-label": "Pagination", ...n, children: /* @__PURE__ */ t("div", { className: r.paginationContainer, children: i }) });
|
|
103
|
+
}
|
|
104
|
+
function Q({ disabled: i, onClick: n, children: e, ...o }) {
|
|
105
|
+
return /* @__PURE__ */ t(
|
|
106
|
+
"button",
|
|
107
|
+
{
|
|
108
|
+
disabled: i,
|
|
109
|
+
onClick: n,
|
|
110
|
+
className: r.paginationFirst,
|
|
111
|
+
"aria-label": "Go to first page",
|
|
112
|
+
...o,
|
|
113
|
+
children: e ?? "«"
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
function R({ disabled: i, onClick: n, children: e, ...o }) {
|
|
118
|
+
return /* @__PURE__ */ t(
|
|
119
|
+
"button",
|
|
120
|
+
{
|
|
121
|
+
disabled: i,
|
|
122
|
+
onClick: n,
|
|
123
|
+
className: r.paginationPrev,
|
|
124
|
+
"aria-label": "Go to previous page",
|
|
125
|
+
...o,
|
|
126
|
+
children: e ?? "‹"
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function U({ active: i, disabled: n, onClick: e, children: o, ...u }) {
|
|
131
|
+
return /* @__PURE__ */ t(
|
|
132
|
+
"button",
|
|
133
|
+
{
|
|
134
|
+
disabled: n,
|
|
135
|
+
onClick: e,
|
|
136
|
+
"aria-current": i ? "page" : void 0,
|
|
137
|
+
className: `${r.paginationItem} ${i ? r.active : ""}`,
|
|
138
|
+
...u,
|
|
139
|
+
children: o
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
function W({ children: i, ...n }) {
|
|
144
|
+
return /* @__PURE__ */ t("span", { className: r.paginationEllipsis, ...n, children: i ?? "…" });
|
|
145
|
+
}
|
|
146
|
+
function X({ disabled: i, onClick: n, children: e, ...o }) {
|
|
147
|
+
return /* @__PURE__ */ t(
|
|
148
|
+
"button",
|
|
149
|
+
{
|
|
150
|
+
disabled: i,
|
|
151
|
+
onClick: n,
|
|
152
|
+
className: r.paginationNext,
|
|
153
|
+
"aria-label": "Go to next page",
|
|
154
|
+
...o,
|
|
155
|
+
children: e ?? "›"
|
|
156
|
+
}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
function Y({ disabled: i, onClick: n, children: e, ...o }) {
|
|
160
|
+
return /* @__PURE__ */ t(
|
|
161
|
+
"button",
|
|
162
|
+
{
|
|
163
|
+
disabled: i,
|
|
164
|
+
onClick: n,
|
|
165
|
+
className: r.paginationLast,
|
|
166
|
+
"aria-label": "Go to last page",
|
|
167
|
+
...o,
|
|
168
|
+
children: e ?? "»"
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
}
|
|
4
172
|
export {
|
|
5
|
-
|
|
173
|
+
ti as usePagination
|
|
6
174
|
};
|