@plitzi/sdk-elements 0.30.19 → 0.31.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/CHANGELOG.md +38 -3
- package/dist/Element/RootElement.mjs +45 -46
- package/dist/Element/hooks/useElementDataSource.d.ts +2 -4
- package/dist/Element/hooks/useElementDataSource.mjs +13 -10
- package/dist/Element/hooks/useElementInternal.d.ts +19 -2
- package/dist/Element/hooks/useElementInternal.mjs +29 -30
- package/dist/Element/hooks/useInternalItems.mjs +1 -1
- package/dist/dataSource/GlobalSources.d.ts +7 -0
- package/dist/dataSource/GlobalSources.mjs +135 -0
- package/dist/dataSource/getBindingsDetails.d.ts +10 -0
- package/dist/dataSource/getBindingsDetails.mjs +49 -0
- package/dist/dataSource/getSourcesByElementId.d.ts +3 -0
- package/dist/dataSource/getSourcesByElementId.mjs +12 -0
- package/dist/dataSource/index.d.ts +4 -0
- package/dist/dataSource/index.mjs +5 -0
- package/dist/dataSource/utility/arrayMap.d.ts +6 -0
- package/dist/dataSource/utility/arrayMap.mjs +28 -0
- package/dist/dataSource/utility/capitalize.d.ts +3 -0
- package/dist/dataSource/utility/capitalize.mjs +11 -0
- package/dist/dataSource/utility/dateConverter.d.ts +3 -0
- package/dist/dataSource/utility/dateConverter.mjs +60 -0
- package/dist/dataSource/utility/index.d.ts +7 -0
- package/dist/dataSource/utility/index.mjs +22 -0
- package/dist/dataSource/utility/staticValue.d.ts +3 -0
- package/dist/dataSource/utility/staticValue.mjs +47 -0
- package/dist/dataSource/utility/stringToArray.d.ts +3 -0
- package/dist/dataSource/utility/stringToArray.mjs +20 -0
- package/dist/dataSource/utility/styleSelector.d.ts +3 -0
- package/dist/dataSource/utility/styleSelector.mjs +42 -0
- package/dist/dataSource/utility/twigTemplate.d.ts +3 -0
- package/dist/dataSource/utility/twigTemplate.mjs +26 -0
- package/dist/elements/advanced/Reference/Reference.mjs +2 -2
- package/dist/elements/advanced/Reference/Settings.mjs +1 -1
- package/dist/elements/basic/Link/Link.mjs +4 -4
- package/dist/elements/basic/Link/Settings.mjs +1 -1
- package/dist/elements/form/Form/Form.mjs +70 -66
- package/dist/elements/form/FormControl/FormControl.mjs +13 -15
- package/dist/elements/form/FormControl/hocs/withFieldValue.mjs +46 -49
- package/dist/elements/internal/LayoutContainer/Settings.mjs +1 -1
- package/dist/elements/internal/Page/Settings.mjs +1 -1
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +47 -43
- package/dist/elements/provider/ApiContainer/Settings.mjs +1 -1
- package/dist/elements/provider/CollectionContainer/CollectionContainer.mjs +35 -31
- package/dist/elements/structure/DialogContainer/DialogContainer.mjs +53 -51
- package/dist/elements/structure/List/modes/ListControlled/ListControlled.mjs +32 -30
- package/dist/elements/structure/List/modes/ListControlled/ListControlledItem.d.ts +2 -2
- package/dist/elements/structure/List/modes/ListControlled/ListControlledItem.mjs +24 -22
- package/dist/elements/structure/ModalContainer/ModalContainer.mjs +41 -39
- package/package.json +95 -13
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { get as e, set as t } from "@plitzi/plitzi-ui/helpers";
|
|
2
|
+
var n = {
|
|
3
|
+
action: "arrayMap",
|
|
4
|
+
title: "Array Map",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: { keys: {
|
|
7
|
+
defaultValue: "[{\"from\": \"\", \"to\": \"\"}]",
|
|
8
|
+
type: "textarea"
|
|
9
|
+
} },
|
|
10
|
+
preview: { sourceParsed: "" },
|
|
11
|
+
callback: (n, r) => {
|
|
12
|
+
let { keys: i } = r;
|
|
13
|
+
if (!Array.isArray(n)) return n;
|
|
14
|
+
try {
|
|
15
|
+
typeof i == "string" && (i = JSON.parse(i));
|
|
16
|
+
} catch {
|
|
17
|
+
return n;
|
|
18
|
+
}
|
|
19
|
+
return n.map((n) => {
|
|
20
|
+
let r = {};
|
|
21
|
+
return i.forEach((i) => {
|
|
22
|
+
typeof i == "object" && i.from && i.to && t(r, i.to, e(n, i.from, ""));
|
|
23
|
+
}), r;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { n as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { capitalize as e } from "@plitzi/plitzi-ui/helpers";
|
|
2
|
+
var t = {
|
|
3
|
+
action: "capitalize",
|
|
4
|
+
title: "Capitalize",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: {},
|
|
7
|
+
preview: { content: "" },
|
|
8
|
+
callback: (t) => typeof t == "string" ? e(t) : t
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as default };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { formatDate as e, formatDateUTC as t, formatFromNow as n, parseDate as r } from "@plitzi/sdk-shared";
|
|
2
|
+
var i = {
|
|
3
|
+
action: "dateConverter",
|
|
4
|
+
title: "Date Converter",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: {
|
|
7
|
+
format: {
|
|
8
|
+
defaultValue: "dd/MM/yyyy",
|
|
9
|
+
type: "text"
|
|
10
|
+
},
|
|
11
|
+
asAge: {
|
|
12
|
+
defaultValue: !1,
|
|
13
|
+
type: "checkbox"
|
|
14
|
+
},
|
|
15
|
+
isUnix: {
|
|
16
|
+
defaultValue: !0,
|
|
17
|
+
type: "checkbox"
|
|
18
|
+
},
|
|
19
|
+
isUtc: {
|
|
20
|
+
defaultValue: !1,
|
|
21
|
+
type: "checkbox"
|
|
22
|
+
},
|
|
23
|
+
locale: {
|
|
24
|
+
defaultValue: "en",
|
|
25
|
+
type: "select",
|
|
26
|
+
options: [
|
|
27
|
+
{
|
|
28
|
+
label: "en",
|
|
29
|
+
value: "en"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
label: "es",
|
|
33
|
+
value: "es"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "pt",
|
|
37
|
+
value: "pt"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
preview: {
|
|
43
|
+
format: "",
|
|
44
|
+
asAge: "",
|
|
45
|
+
isUnix: "",
|
|
46
|
+
isUtc: "",
|
|
47
|
+
locale: ""
|
|
48
|
+
},
|
|
49
|
+
callback: (i, { format: a = "dd/MM/yyyy", asAge: o = !1, isUnix: s = !0, isUtc: c = !1, locale: l = "en" }) => {
|
|
50
|
+
if (typeof i != "string" && typeof i != "number") return i;
|
|
51
|
+
try {
|
|
52
|
+
let u = r(s ? Number(i) : i);
|
|
53
|
+
return isNaN(u.getTime()) ? i : o ? n(u, l, { addSuffix: !0 }) : c ? t(u, a, l) : e(u, a, l);
|
|
54
|
+
} catch {
|
|
55
|
+
return i;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { i as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import e from "./arrayMap.mjs";
|
|
2
|
+
import t from "./capitalize.mjs";
|
|
3
|
+
import n from "./dateConverter.mjs";
|
|
4
|
+
import r from "./staticValue.mjs";
|
|
5
|
+
import i from "./stringToArray.mjs";
|
|
6
|
+
import a from "./styleSelector.mjs";
|
|
7
|
+
import o from "./twigTemplate.mjs";
|
|
8
|
+
//#region src/dataSource/utility/index.ts
|
|
9
|
+
var s = {
|
|
10
|
+
twigTemplate: o,
|
|
11
|
+
dateConverter: n,
|
|
12
|
+
staticValue: r,
|
|
13
|
+
capitalize: t,
|
|
14
|
+
arrayMap: e,
|
|
15
|
+
stringToArray: i,
|
|
16
|
+
styleSelector: a
|
|
17
|
+
}, c = Object.values(s).map(({ title: e, action: t }) => ({
|
|
18
|
+
label: e,
|
|
19
|
+
value: t
|
|
20
|
+
}));
|
|
21
|
+
//#endregion
|
|
22
|
+
export { s as default, c as utilityOptions };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
action: "staticValue",
|
|
3
|
+
title: "Static Value",
|
|
4
|
+
type: "utility",
|
|
5
|
+
params: {
|
|
6
|
+
valueType: {
|
|
7
|
+
label: "Value Type",
|
|
8
|
+
defaultValue: "text",
|
|
9
|
+
type: "select",
|
|
10
|
+
options: [
|
|
11
|
+
{
|
|
12
|
+
label: "Text",
|
|
13
|
+
value: "text"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "Long Text",
|
|
17
|
+
value: "textarea"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: "Boolean",
|
|
21
|
+
value: "select"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
value: {
|
|
26
|
+
defaultValue: "",
|
|
27
|
+
type: ({ valueType: e }) => e,
|
|
28
|
+
options: [{
|
|
29
|
+
label: "True",
|
|
30
|
+
value: "true"
|
|
31
|
+
}, {
|
|
32
|
+
label: "False",
|
|
33
|
+
value: "false"
|
|
34
|
+
}]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
preview: {
|
|
38
|
+
valueType: "",
|
|
39
|
+
value: ""
|
|
40
|
+
},
|
|
41
|
+
callback: (e, t) => {
|
|
42
|
+
let { valueType: n, value: r } = t;
|
|
43
|
+
return n === "select" ? r === "true" : r;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { e as default };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var e = {
|
|
2
|
+
action: "stringToArray",
|
|
3
|
+
title: "Text to List",
|
|
4
|
+
type: "utility",
|
|
5
|
+
params: { separator: {
|
|
6
|
+
label: "Separator",
|
|
7
|
+
defaultValue: ",",
|
|
8
|
+
type: "text"
|
|
9
|
+
} },
|
|
10
|
+
preview: {
|
|
11
|
+
valueType: "",
|
|
12
|
+
value: ""
|
|
13
|
+
},
|
|
14
|
+
callback: (e, t) => {
|
|
15
|
+
let { separator: n } = t;
|
|
16
|
+
return console.log(e, t), typeof e == "string" ? e.split(n).map((e) => e.trim()) : e;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { e as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { get as e } from "@plitzi/plitzi-ui/helpers";
|
|
2
|
+
var t = {
|
|
3
|
+
action: "styleSelector",
|
|
4
|
+
title: "Style Selector",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: {
|
|
7
|
+
originalSelector: {
|
|
8
|
+
label: "Original Selector",
|
|
9
|
+
description: "This will append the original selector (require append option enabled)",
|
|
10
|
+
defaultValue: !1,
|
|
11
|
+
disabled: ({ append: e }) => !e,
|
|
12
|
+
type: "checkbox"
|
|
13
|
+
},
|
|
14
|
+
append: {
|
|
15
|
+
label: "Append Selector",
|
|
16
|
+
defaultValue: !1,
|
|
17
|
+
type: "checkbox"
|
|
18
|
+
},
|
|
19
|
+
selector: {
|
|
20
|
+
label: "Selector",
|
|
21
|
+
defaultValue: "",
|
|
22
|
+
type: "select",
|
|
23
|
+
options: []
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
preview: {
|
|
27
|
+
append: "",
|
|
28
|
+
originalSelector: "",
|
|
29
|
+
selector: ""
|
|
30
|
+
},
|
|
31
|
+
callback: (t, n, r, i = {}) => {
|
|
32
|
+
let { originalSelector: a, append: o, selector: s } = n, c = [];
|
|
33
|
+
if (o && !a && i.sourceTo) c.push(i.sourceTo, s);
|
|
34
|
+
else if (a && o) {
|
|
35
|
+
let t = e(r, "definition.styleSelectors.base", "");
|
|
36
|
+
t ? c.push(t, s) : c.push(s);
|
|
37
|
+
}
|
|
38
|
+
return c.length ? c.length === 1 ? c[0] : c.join(" ") : "";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
//#endregion
|
|
42
|
+
export { t as default };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { processTwig as e } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
2
|
+
var t = {
|
|
3
|
+
action: "twigTemplate",
|
|
4
|
+
title: "Twig Template",
|
|
5
|
+
type: "utility",
|
|
6
|
+
params: { template: {
|
|
7
|
+
label: "Template",
|
|
8
|
+
defaultValue: "Tokens {{source}} from the value selected to bind previously, {{sourceTo}} is your original value, other tokens via autocomplete",
|
|
9
|
+
type: "codemirror-text"
|
|
10
|
+
} },
|
|
11
|
+
preview: { template: "" },
|
|
12
|
+
callback: (t, n, r, i = {}) => {
|
|
13
|
+
let { template: a } = n, o = t;
|
|
14
|
+
try {
|
|
15
|
+
o = e(a, {
|
|
16
|
+
source: t,
|
|
17
|
+
...i
|
|
18
|
+
});
|
|
19
|
+
} catch {
|
|
20
|
+
o = t;
|
|
21
|
+
}
|
|
22
|
+
return o;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { t as default };
|
|
@@ -4,11 +4,11 @@ import n from "../../../Element/hocs/withElement.mjs";
|
|
|
4
4
|
import { use as r, useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
|
|
5
5
|
import l from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
6
6
|
import { get as u } from "@plitzi/plitzi-ui/helpers";
|
|
7
|
-
import { createStoreHook as d } from "@plitzi/
|
|
7
|
+
import { createStoreHook as d } from "@plitzi/nexus/createStore";
|
|
8
8
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
9
9
|
import m from "clsx";
|
|
10
10
|
import h from "@plitzi/sdk-shared/elements/hooks/useElement";
|
|
11
|
-
import g from "@plitzi/
|
|
11
|
+
import g from "@plitzi/nexus/StoreProvider";
|
|
12
12
|
var _ = n(({ ref: n, children: _, className: v = "", referenceType: y = "element", referenceId: b = "", referenceContainer: x = "" }) => {
|
|
13
13
|
let { id: S, definition: { rootId: C, styleSelectors: w } } = h(), { settings: { previewMode: T, environment: E }, contexts: { SegmentsContext: D } } = l(), { useStore: O } = d(), [[k, A]] = O(["schema", "segments"]), { segmentGet: j } = r(D), M = s(k);
|
|
14
14
|
M.current = k;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { use as e, useCallback as t, useMemo as n } from "react";
|
|
2
2
|
import r from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
3
3
|
import { get as i } from "@plitzi/plitzi-ui/helpers";
|
|
4
|
-
import { createStoreHook as a } from "@plitzi/
|
|
4
|
+
import { createStoreHook as a } from "@plitzi/nexus/createStore";
|
|
5
5
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
6
|
import c from "@plitzi/plitzi-ui/Select2";
|
|
7
7
|
//#region src/elements/advanced/Reference/Settings.tsx
|
|
@@ -2,19 +2,19 @@ import e from "../../../Element/RootElement.mjs";
|
|
|
2
2
|
import t from "../../../Element/hocs/withElement.mjs";
|
|
3
3
|
import { use as n, useMemo as r } from "react";
|
|
4
4
|
import i from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { createStoreHook as a } from "@plitzi/nexus/createStore";
|
|
6
|
+
import { processTwig as o } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
7
7
|
import { jsx as s } from "react/jsx-runtime";
|
|
8
8
|
import c from "clsx";
|
|
9
9
|
import l from "@plitzi/sdk-shared/elements/hooks/useElement";
|
|
10
10
|
import { getPageFullPath as u } from "@plitzi/sdk-navigation/NavigationHelper";
|
|
11
11
|
var d = t(({ ref: t, children: d, className: f = "", href: p = "#", target: m = "self", mode: h = "page" }) => {
|
|
12
|
-
let { style: g } = l(), { settings: { previewMode: _ }, contexts: { NavigationContext: v } } = i(), { navigate: y, routeParams: b, queryParams: x } = n(v), { useStore: S } =
|
|
12
|
+
let { style: g } = l(), { settings: { previewMode: _ }, contexts: { NavigationContext: v } } = i(), { navigate: y, routeParams: b, queryParams: x } = n(v), { useStore: S } = a(), [[C, w]] = S(["pageDefinitions", "schema.pageFolders"]), T = r(() => {
|
|
13
13
|
if (h === "external") return p;
|
|
14
14
|
let e = `/${p}`.replaceAll(/[/]+/gim, "/");
|
|
15
15
|
if (h === "internal") {
|
|
16
16
|
try {
|
|
17
|
-
let t =
|
|
17
|
+
let t = o(e, {
|
|
18
18
|
...x,
|
|
19
19
|
...b
|
|
20
20
|
}, !0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { use as e, useCallback as t, useEffect as n, useMemo as r } from "react";
|
|
2
2
|
import i from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
3
3
|
import { get as a, pick as o } from "@plitzi/plitzi-ui/helpers";
|
|
4
|
-
import { createStoreHook as s } from "@plitzi/
|
|
4
|
+
import { createStoreHook as s } from "@plitzi/nexus/createStore";
|
|
5
5
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
import { getPageFullPath as u } from "@plitzi/sdk-navigation/NavigationHelper";
|
|
7
7
|
import d from "@plitzi/plitzi-ui/Input";
|
|
@@ -8,21 +8,23 @@ import { jsx as u } from "react/jsx-runtime";
|
|
|
8
8
|
import d from "clsx";
|
|
9
9
|
import f from "@plitzi/sdk-shared/elements/hooks/useElement";
|
|
10
10
|
import { produce as p } from "immer";
|
|
11
|
+
import m from "@plitzi/nexus/StoreProvider";
|
|
12
|
+
import h from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
11
13
|
//#region src/elements/form/Form/Form.tsx
|
|
12
|
-
var
|
|
13
|
-
let [
|
|
14
|
+
var g = ({ ref: t, className: g = "", children: _, method: v = "get", actionUrl: y = "", managedByInteractions: b = !1, errors: x = l, values: S = l }) => {
|
|
15
|
+
let [C, w] = a({}), { id: T, definition: { label: E = "Form" }, setElementState: D } = f(), { settings: { previewMode: O }, contexts: { InteractionsContext: k } } = o(), { interactionsManager: A } = n(k), j = r((e) => w((t) => ({
|
|
14
16
|
...t,
|
|
15
17
|
[e.name]: e
|
|
16
|
-
})), [
|
|
17
|
-
|
|
18
|
+
})), [w]), M = r((e) => !e || !C[e] ? C : s(C, e), [C]), N = r((e) => {
|
|
19
|
+
w((t) => p(t, (t) => {
|
|
18
20
|
t[e] && delete t[e];
|
|
19
|
-
})), e &&
|
|
21
|
+
})), e && D((t) => ({
|
|
20
22
|
...t,
|
|
21
23
|
values: c(t, `values.${e}`),
|
|
22
24
|
errors: c(t, `errors.${e}`)
|
|
23
25
|
}));
|
|
24
|
-
}, [
|
|
25
|
-
e && (t === null && (t = ""),
|
|
26
|
+
}, [D]), P = r((e, t = "") => {
|
|
27
|
+
e && (t === null && (t = ""), D((n) => n.errors && n.errors[e] ? {
|
|
26
28
|
...n,
|
|
27
29
|
values: {
|
|
28
30
|
...n.values,
|
|
@@ -36,8 +38,8 @@ var m = ({ ref: t, className: m = "", children: h, method: g = "get", actionUrl:
|
|
|
36
38
|
[e]: t
|
|
37
39
|
}
|
|
38
40
|
}));
|
|
39
|
-
}, [
|
|
40
|
-
e &&
|
|
41
|
+
}, [D]), F = r((e, t) => {
|
|
42
|
+
e && D((n) => !t && !s(n, `errors.${e}`) ? n : !t && n.errors && n.errors[e] ? {
|
|
41
43
|
...n,
|
|
42
44
|
errors: c(n, [`errors.${e}`])
|
|
43
45
|
} : {
|
|
@@ -47,7 +49,7 @@ var m = ({ ref: t, className: m = "", children: h, method: g = "get", actionUrl:
|
|
|
47
49
|
[e]: t
|
|
48
50
|
}
|
|
49
51
|
});
|
|
50
|
-
}, [
|
|
52
|
+
}, [D]), I = r(() => Object.values(C).filter((e) => !!e.name).reduce((e, t) => [
|
|
51
53
|
...e,
|
|
52
54
|
{
|
|
53
55
|
path: `fields.${t.name}.id`,
|
|
@@ -61,99 +63,100 @@ var m = ({ ref: t, className: m = "", children: h, method: g = "get", actionUrl:
|
|
|
61
63
|
path: `errors.${t.name}`,
|
|
62
64
|
name: `${t.name} Error Message`
|
|
63
65
|
}
|
|
64
|
-
], []), [
|
|
65
|
-
fields:
|
|
66
|
-
errors:
|
|
67
|
-
values:
|
|
66
|
+
], []), [C]), L = i(() => ({
|
|
67
|
+
fields: C,
|
|
68
|
+
errors: x,
|
|
69
|
+
values: S,
|
|
68
70
|
registerField: j,
|
|
69
71
|
unregisterField: N,
|
|
70
72
|
getField: M,
|
|
71
73
|
setFieldValue: P,
|
|
72
74
|
setFieldError: F
|
|
73
75
|
}), [
|
|
76
|
+
C,
|
|
74
77
|
x,
|
|
75
|
-
|
|
76
|
-
b,
|
|
78
|
+
S,
|
|
77
79
|
j,
|
|
78
80
|
N,
|
|
79
81
|
M,
|
|
80
82
|
P,
|
|
81
83
|
F
|
|
82
|
-
])
|
|
83
|
-
|
|
84
|
+
]);
|
|
85
|
+
h({
|
|
86
|
+
id: T,
|
|
84
87
|
source: "form",
|
|
85
|
-
|
|
86
|
-
name: w || `Form - ${C}`,
|
|
88
|
+
name: E || `Form - ${T}`,
|
|
87
89
|
fields: I
|
|
88
|
-
})
|
|
90
|
+
});
|
|
91
|
+
let R = i(() => ({ onSubmit: {
|
|
89
92
|
action: "onSubmit",
|
|
90
93
|
title: "On Form Submit",
|
|
91
94
|
type: "trigger",
|
|
92
95
|
params: {},
|
|
93
96
|
preview: {
|
|
94
|
-
values: Object.values(
|
|
97
|
+
values: Object.values(C).reduce((e, t) => ({
|
|
95
98
|
...e,
|
|
96
99
|
[t.name]: ""
|
|
97
100
|
}), {}),
|
|
98
101
|
actionUrl: "",
|
|
99
102
|
method: ""
|
|
100
103
|
}
|
|
101
|
-
} }), [
|
|
102
|
-
if (
|
|
104
|
+
} }), [C]), z = r((e) => {
|
|
105
|
+
if (D((e) => ({
|
|
103
106
|
...e,
|
|
104
107
|
errors: {}
|
|
105
|
-
})), !
|
|
106
|
-
let t = Object.values(
|
|
108
|
+
})), !b || (e.stopPropagation(), e.preventDefault(), !O)) return;
|
|
109
|
+
let t = Object.values(C).reduce((e, { name: t }) => ({
|
|
107
110
|
...e,
|
|
108
|
-
[t]:
|
|
111
|
+
[t]: S[t]
|
|
109
112
|
}), {});
|
|
110
|
-
A.interactionTrigger(
|
|
113
|
+
A.interactionTrigger(T, "onSubmit", {
|
|
111
114
|
values: t,
|
|
112
|
-
actionUrl:
|
|
113
|
-
method:
|
|
115
|
+
actionUrl: y,
|
|
116
|
+
method: v
|
|
114
117
|
});
|
|
115
118
|
}, [
|
|
119
|
+
D,
|
|
120
|
+
b,
|
|
121
|
+
O,
|
|
122
|
+
C,
|
|
123
|
+
A,
|
|
116
124
|
T,
|
|
125
|
+
y,
|
|
117
126
|
v,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
C,
|
|
122
|
-
_,
|
|
123
|
-
g,
|
|
124
|
-
b
|
|
125
|
-
]), V = r((e) => {
|
|
126
|
-
v && (e instanceof Event && (e.stopPropagation(), e.preventDefault()), T((e) => ({
|
|
127
|
+
S
|
|
128
|
+
]), B = r((e) => {
|
|
129
|
+
b && (e instanceof Event && (e.stopPropagation(), e.preventDefault()), D((e) => ({
|
|
127
130
|
...e,
|
|
128
131
|
values: {},
|
|
129
132
|
errors: {}
|
|
130
133
|
})));
|
|
131
|
-
}, [
|
|
134
|
+
}, [D, b]), V = r((e) => {
|
|
132
135
|
let { name: t, value: n } = e;
|
|
133
136
|
P(t, n);
|
|
134
|
-
}, [P]),
|
|
137
|
+
}, [P]), H = r((e) => {
|
|
135
138
|
let { name: t, error: n } = e;
|
|
136
139
|
F(t, n);
|
|
137
|
-
}, [F]),
|
|
140
|
+
}, [F]), U = i(() => ({
|
|
138
141
|
performReset: {
|
|
139
142
|
action: "performReset",
|
|
140
|
-
title: `Reset ${
|
|
143
|
+
title: `Reset ${E}`,
|
|
141
144
|
type: "callback",
|
|
142
|
-
callback:
|
|
145
|
+
callback: B,
|
|
143
146
|
params: {}
|
|
144
147
|
},
|
|
145
148
|
setFieldValue: {
|
|
146
149
|
action: "setFieldValue",
|
|
147
|
-
title: `Set Field Value ${
|
|
150
|
+
title: `Set Field Value ${E}`,
|
|
148
151
|
type: "callback",
|
|
149
|
-
callback:
|
|
152
|
+
callback: V,
|
|
150
153
|
preview: {},
|
|
151
154
|
params: {
|
|
152
155
|
name: {
|
|
153
156
|
label: "Field Name",
|
|
154
157
|
defaultValue: void 0,
|
|
155
158
|
type: "select",
|
|
156
|
-
options: Object.values(
|
|
159
|
+
options: Object.values(C).map((e) => ({
|
|
157
160
|
value: e.name,
|
|
158
161
|
label: e.name
|
|
159
162
|
}))
|
|
@@ -166,16 +169,16 @@ var m = ({ ref: t, className: m = "", children: h, method: g = "get", actionUrl:
|
|
|
166
169
|
},
|
|
167
170
|
setFieldError: {
|
|
168
171
|
action: "setFieldError",
|
|
169
|
-
title: `Set Field Error ${
|
|
172
|
+
title: `Set Field Error ${E}`,
|
|
170
173
|
type: "callback",
|
|
171
|
-
callback:
|
|
174
|
+
callback: H,
|
|
172
175
|
preview: {},
|
|
173
176
|
params: {
|
|
174
177
|
name: {
|
|
175
178
|
label: "Field Name",
|
|
176
179
|
defaultValue: void 0,
|
|
177
180
|
type: "select",
|
|
178
|
-
options: Object.values(
|
|
181
|
+
options: Object.values(C).map((e) => ({
|
|
179
182
|
value: e.name,
|
|
180
183
|
label: e.name
|
|
181
184
|
}))
|
|
@@ -187,27 +190,28 @@ var m = ({ ref: t, className: m = "", children: h, method: g = "get", actionUrl:
|
|
|
187
190
|
}
|
|
188
191
|
}
|
|
189
192
|
}), [
|
|
190
|
-
|
|
193
|
+
E,
|
|
194
|
+
B,
|
|
191
195
|
V,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
U
|
|
196
|
+
C,
|
|
197
|
+
H
|
|
195
198
|
]);
|
|
196
199
|
return /* @__PURE__ */ u(e, {
|
|
197
200
|
tag: "form",
|
|
198
201
|
ref: t,
|
|
199
|
-
method:
|
|
200
|
-
className: d("plitzi-component__form",
|
|
201
|
-
interactionTriggers:
|
|
202
|
-
interactionCallbacks:
|
|
203
|
-
onSubmit:
|
|
204
|
-
onReset:
|
|
205
|
-
action:
|
|
206
|
-
children: /* @__PURE__ */ u(
|
|
207
|
-
|
|
208
|
-
|
|
202
|
+
method: v,
|
|
203
|
+
className: d("plitzi-component__form", g),
|
|
204
|
+
interactionTriggers: R,
|
|
205
|
+
interactionCallbacks: U,
|
|
206
|
+
onSubmit: z,
|
|
207
|
+
onReset: B,
|
|
208
|
+
action: y,
|
|
209
|
+
children: /* @__PURE__ */ u(m, {
|
|
210
|
+
inherit: "live",
|
|
211
|
+
value: { runtime: { sources: { form: L } } },
|
|
212
|
+
children: _
|
|
209
213
|
})
|
|
210
214
|
});
|
|
211
|
-
},
|
|
215
|
+
}, _ = t(g);
|
|
212
216
|
//#endregion
|
|
213
|
-
export {
|
|
217
|
+
export { g as Form, _ as default };
|