@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
|
@@ -7,32 +7,30 @@ import a from "./inputs/Input.mjs";
|
|
|
7
7
|
import o from "./inputs/Select.mjs";
|
|
8
8
|
import s from "./inputs/Textarea.mjs";
|
|
9
9
|
import c from "../../../Element/hocs/withElement.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
10
|
+
import { useEffect as l } from "react";
|
|
11
|
+
import u from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
12
|
+
import { createStoreHook as d } from "@plitzi/nexus/createStore";
|
|
12
13
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
13
14
|
import m from "clsx";
|
|
14
15
|
import h from "@plitzi/sdk-shared/elements/hooks/useElement";
|
|
15
16
|
var g = c(n(({ ref: n, className: c = "", subType: g = "text", name: _ = "", label: v = "Label", placeholder: y = "", autoComplete: b = !0, disabled: x = !1, options: S = [], required: C = !0, readOnly: w = !1, value: T = "", error: E = "", handleChange: D, handleValidate: O }) => {
|
|
16
|
-
let { id: k, rootId: A, definition: { styleSelectors: j } } = h(), { settings: { previewMode: M }
|
|
17
|
-
|
|
18
|
-
mode: "read"
|
|
19
|
-
});
|
|
20
|
-
if (!F && !M) return /* @__PURE__ */ f(e, {
|
|
17
|
+
let { id: k, rootId: A, definition: { styleSelectors: j } } = h(), { settings: { previewMode: M } } = u(), { useStore: N } = d(), [P] = N("runtime.sources.form");
|
|
18
|
+
if (!P && !M) return /* @__PURE__ */ f(e, {
|
|
21
19
|
ref: n,
|
|
22
20
|
className: m("plitzi-component__form-input", { "form-input--out-of-context": !M }, c),
|
|
23
21
|
children: /* @__PURE__ */ f("div", { children: "Form Input Only Works inside Form element" })
|
|
24
22
|
});
|
|
25
|
-
if (!
|
|
26
|
-
let { registerField:
|
|
27
|
-
return
|
|
23
|
+
if (!P && M) return null;
|
|
24
|
+
let { registerField: F, unregisterField: I } = P, L = ["checkbox", "switch"].includes(g);
|
|
25
|
+
return l(() => (F && F({
|
|
28
26
|
name: _,
|
|
29
27
|
path: _
|
|
30
28
|
}), () => {
|
|
31
|
-
|
|
29
|
+
I && I(_);
|
|
32
30
|
}), [
|
|
33
31
|
_,
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
F,
|
|
33
|
+
I
|
|
36
34
|
]), /* @__PURE__ */ p(e, {
|
|
37
35
|
ref: n,
|
|
38
36
|
className: m("plitzi-component__form-control", {
|
|
@@ -40,7 +38,7 @@ var g = c(n(({ ref: n, className: c = "", subType: g = "text", name: _ = "", lab
|
|
|
40
38
|
[`plitzi-component__form-control-${g}`]: g
|
|
41
39
|
}, c),
|
|
42
40
|
children: [
|
|
43
|
-
!
|
|
41
|
+
!L && v && /* @__PURE__ */ f(t, {
|
|
44
42
|
targetInput: `${A}_${k}`,
|
|
45
43
|
previewMode: M,
|
|
46
44
|
className: j.label,
|
|
@@ -48,7 +46,7 @@ var g = c(n(({ ref: n, className: c = "", subType: g = "text", name: _ = "", lab
|
|
|
48
46
|
required: C,
|
|
49
47
|
children: v
|
|
50
48
|
}),
|
|
51
|
-
|
|
49
|
+
L && v && /* @__PURE__ */ p(t, {
|
|
52
50
|
targetInput: `${A}_${k}`,
|
|
53
51
|
previewMode: M,
|
|
54
52
|
className: j.label,
|
|
@@ -1,67 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { get as
|
|
1
|
+
import { useCallback as e, useEffect as t, useMemo as n } from "react";
|
|
2
|
+
import r from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
3
|
+
import { get as i } from "@plitzi/plitzi-ui/helpers";
|
|
4
|
+
import { createStoreHook as a } from "@plitzi/nexus/createStore";
|
|
4
5
|
import { getDisplayName as o } from "@plitzi/sdk-shared/helpers/utils";
|
|
5
6
|
import { jsx as s } from "react/jsx-runtime";
|
|
6
|
-
import c from "@plitzi/sdk-shared/elements/hooks/useElement";
|
|
7
7
|
//#region src/elements/form/FormControl/hocs/withFieldValue.tsx
|
|
8
|
-
var
|
|
9
|
-
let
|
|
10
|
-
let {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
let { setFieldValue: x, setFieldError: S, errors: C, values: w } = b, T = r(() => a(w, f, m), [
|
|
16
|
-
w,
|
|
17
|
-
f,
|
|
18
|
-
m
|
|
19
|
-
]), E = r(() => !_ && g ? "This is an error message" : C[f], [
|
|
20
|
-
_,
|
|
21
|
-
g,
|
|
22
|
-
C,
|
|
8
|
+
var c = (c) => {
|
|
9
|
+
let l = (o) => {
|
|
10
|
+
let { ref: l, name: u = "", subType: d = "text", defaultValue: f = "", required: p = !0, previewError: m = !1 } = o, { settings: { previewMode: h } } = r(), { useStore: g } = a(), [_] = g("runtime.sources.form");
|
|
11
|
+
if (!_) return /* @__PURE__ */ s(c, { ...o });
|
|
12
|
+
let { setFieldValue: v, setFieldError: y, errors: b, values: x } = _, S = n(() => i(x, u, f), [
|
|
13
|
+
x,
|
|
14
|
+
u,
|
|
23
15
|
f
|
|
16
|
+
]), C = n(() => !h && m ? "This is an error message" : b[u], [
|
|
17
|
+
h,
|
|
18
|
+
m,
|
|
19
|
+
b,
|
|
20
|
+
u
|
|
24
21
|
]);
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
t(() => {
|
|
23
|
+
f && S && u && v(u, S);
|
|
27
24
|
}, [
|
|
28
|
-
m,
|
|
29
25
|
f,
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
u,
|
|
27
|
+
v,
|
|
28
|
+
S
|
|
32
29
|
]);
|
|
33
|
-
let
|
|
34
|
-
e.target.type === "radio" || e.target.type === "checkbox" ||
|
|
30
|
+
let w = e((e) => {
|
|
31
|
+
e.target.type === "radio" || e.target.type === "checkbox" || d === "switch" ? v(u, e.target.checked) : v(u, e.target.value);
|
|
35
32
|
}, [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
]),
|
|
40
|
-
!
|
|
33
|
+
v,
|
|
34
|
+
u,
|
|
35
|
+
d
|
|
36
|
+
]), T = e(() => {
|
|
37
|
+
!S && p ? y(u, "This field is required") : C === "This field is required" && y(u, "");
|
|
41
38
|
}, [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
S,
|
|
40
|
+
C,
|
|
41
|
+
u,
|
|
42
|
+
p,
|
|
43
|
+
y
|
|
47
44
|
]);
|
|
48
|
-
return
|
|
45
|
+
return n(() => /* @__PURE__ */ s(c, {
|
|
49
46
|
...o,
|
|
50
|
-
ref:
|
|
51
|
-
value:
|
|
52
|
-
error:
|
|
53
|
-
handleChange:
|
|
54
|
-
handleValidate:
|
|
47
|
+
ref: l,
|
|
48
|
+
value: S,
|
|
49
|
+
error: C,
|
|
50
|
+
handleChange: w,
|
|
51
|
+
handleValidate: T
|
|
55
52
|
}), [
|
|
56
53
|
o,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
l,
|
|
55
|
+
C,
|
|
56
|
+
S,
|
|
57
|
+
w,
|
|
58
|
+
T
|
|
62
59
|
]);
|
|
63
60
|
};
|
|
64
|
-
return
|
|
61
|
+
return l.displayName = `withFieldValue(${o(c)})`, l;
|
|
65
62
|
};
|
|
66
63
|
//#endregion
|
|
67
|
-
export {
|
|
64
|
+
export { c as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback as e, useMemo as t } from "react";
|
|
2
|
-
import { createStoreHook as n } from "@plitzi/
|
|
2
|
+
import { createStoreHook as n } from "@plitzi/nexus/createStore";
|
|
3
3
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
4
|
import a from "@plitzi/plitzi-ui/Select";
|
|
5
5
|
import o from "@plitzi/plitzi-ui/Select2";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback as e, useMemo as t } from "react";
|
|
2
2
|
import { get as n, pick as r } from "@plitzi/plitzi-ui/helpers";
|
|
3
|
-
import { createStoreHook as i } from "@plitzi/
|
|
3
|
+
import { createStoreHook as i } from "@plitzi/nexus/createStore";
|
|
4
4
|
import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
5
5
|
import { getPageFullPath as c } from "@plitzi/sdk-navigation/NavigationHelper";
|
|
6
6
|
import l from "@plitzi/plitzi-ui/Alert";
|
|
@@ -9,69 +9,71 @@ import { emptyObject as u, getPathsFromObeject as d } from "@plitzi/sdk-shared/h
|
|
|
9
9
|
import { jsx as f } from "react/jsx-runtime";
|
|
10
10
|
import p from "clsx";
|
|
11
11
|
import m from "@plitzi/sdk-shared/elements/hooks/useElement";
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import h from "@plitzi/nexus/StoreProvider";
|
|
13
|
+
import g from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
14
|
+
import { QueryBuilderEvaluator as _ } from "@plitzi/plitzi-ui/QueryBuilder";
|
|
15
|
+
var v = n(({ ref: n, className: v = "", children: y, query: b = "", method: x = "get", accessToken: S = "", when: C = u, headers: w = u, mockData: T = "{}", subType: E = "div", credentials: D = "same-origin" }) => {
|
|
16
|
+
let { id: O, definition: { label: k = "Api Container" } } = m(), { settings: { previewMode: A, debugMode: j }, contexts: { NavigationContext: M, InteractionsContext: N } } = s(), { interactionsManager: P } = r(N), { routeParams: F, queryParams: I } = r(M), L = o(() => {
|
|
17
|
+
if (!b) return "";
|
|
16
18
|
try {
|
|
17
19
|
let e = {
|
|
18
20
|
...I,
|
|
19
21
|
...F
|
|
20
22
|
};
|
|
21
|
-
|
|
23
|
+
j && [...b.matchAll(/{{([ ]+|)(?<token>[a-zA-Z0-9-_:*/]+)([ ]+|)}}/gim)].forEach(({ groups: t }) => {
|
|
22
24
|
let n = t?.token.trim();
|
|
23
25
|
(!n || !c(e, n)) && console.log(`Token ${n} is required`);
|
|
24
26
|
});
|
|
25
|
-
let t = l(
|
|
26
|
-
return typeof t == "string" ? t :
|
|
27
|
+
let t = l(b, e, !0);
|
|
28
|
+
return typeof t == "string" ? t : b;
|
|
27
29
|
} catch (e) {
|
|
28
30
|
console.error(e.message);
|
|
29
31
|
}
|
|
30
32
|
return "";
|
|
31
33
|
}, [
|
|
32
|
-
|
|
34
|
+
b,
|
|
33
35
|
I,
|
|
34
36
|
F,
|
|
35
|
-
|
|
36
|
-
]), R = o(() =>
|
|
37
|
-
...
|
|
38
|
-
Authorization: `Bearer ${
|
|
39
|
-
} :
|
|
37
|
+
j
|
|
38
|
+
]), R = o(() => S ? {
|
|
39
|
+
...w,
|
|
40
|
+
Authorization: `Bearer ${S}`
|
|
41
|
+
} : w, [w, S]), z = o(() => !!(A && L && (C === u || _(C, {
|
|
40
42
|
...F,
|
|
41
43
|
...I
|
|
42
|
-
})) || !
|
|
43
|
-
|
|
44
|
+
})) || !A && (L || T && T !== "{}" && T !== u)), [
|
|
45
|
+
A,
|
|
44
46
|
L,
|
|
45
|
-
|
|
47
|
+
C,
|
|
46
48
|
F,
|
|
47
49
|
I,
|
|
48
|
-
|
|
50
|
+
T
|
|
49
51
|
]), { isLoading: B, data: V, refetch: H, isSuccess: U, isError: W } = t({
|
|
50
52
|
url: L,
|
|
51
|
-
method:
|
|
52
|
-
credentials:
|
|
53
|
-
mock:
|
|
53
|
+
method: x,
|
|
54
|
+
credentials: D,
|
|
55
|
+
mock: A ? void 0 : T,
|
|
54
56
|
customHeaders: R,
|
|
55
57
|
enabled: z
|
|
56
58
|
});
|
|
57
59
|
a(() => {
|
|
58
|
-
B || (U ?
|
|
60
|
+
B || (U ? P.interactionTrigger(O, "onApiSuccess", {
|
|
59
61
|
url: L,
|
|
60
|
-
method:
|
|
62
|
+
method: x,
|
|
61
63
|
...V
|
|
62
|
-
}) : W &&
|
|
64
|
+
}) : W && P.interactionTrigger(O, "onApiError", {
|
|
63
65
|
url: L,
|
|
64
|
-
method:
|
|
66
|
+
method: x,
|
|
65
67
|
...V
|
|
66
68
|
}));
|
|
67
69
|
}, [
|
|
68
70
|
V,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
O,
|
|
72
|
+
P,
|
|
71
73
|
W,
|
|
72
74
|
B,
|
|
73
75
|
U,
|
|
74
|
-
|
|
76
|
+
x,
|
|
75
77
|
L
|
|
76
78
|
]);
|
|
77
79
|
let G = i(() => d(V).reduce((e, t) => {
|
|
@@ -83,20 +85,21 @@ var g = n(({ ref: n, className: g = "", children: _, query: v = "", method: y =
|
|
|
83
85
|
path: t,
|
|
84
86
|
name: n[n.length - 1]
|
|
85
87
|
}];
|
|
86
|
-
}, []), [V])
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
name:
|
|
88
|
+
}, []), [V]);
|
|
89
|
+
g({
|
|
90
|
+
id: O,
|
|
91
|
+
source: `apiContainer_${O}`,
|
|
92
|
+
name: k || `API - ${O}`,
|
|
91
93
|
fields: G
|
|
92
|
-
})
|
|
94
|
+
});
|
|
95
|
+
let K = o(() => ({ performQuery: {
|
|
93
96
|
action: "performQuery",
|
|
94
|
-
title: `Perform Query ${
|
|
97
|
+
title: `Perform Query ${k}`,
|
|
95
98
|
type: "callback",
|
|
96
99
|
callback: H,
|
|
97
100
|
preview: {},
|
|
98
101
|
params: {}
|
|
99
|
-
} }), [
|
|
102
|
+
} }), [k, H]), q = o(() => ({
|
|
100
103
|
onApiError: {
|
|
101
104
|
action: "onApiError",
|
|
102
105
|
title: "On Api Error",
|
|
@@ -124,15 +127,16 @@ var g = n(({ ref: n, className: g = "", children: _, query: v = "", method: y =
|
|
|
124
127
|
}), []);
|
|
125
128
|
return /* @__PURE__ */ f(e, {
|
|
126
129
|
ref: n,
|
|
127
|
-
tag:
|
|
128
|
-
className: p("plitzi-component__api-container",
|
|
129
|
-
interactionTriggers:
|
|
130
|
-
interactionCallbacks:
|
|
131
|
-
children: /* @__PURE__ */ f(
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
tag: E,
|
|
131
|
+
className: p("plitzi-component__api-container", v),
|
|
132
|
+
interactionTriggers: q,
|
|
133
|
+
interactionCallbacks: K,
|
|
134
|
+
children: /* @__PURE__ */ f(h, {
|
|
135
|
+
inherit: "live",
|
|
136
|
+
value: { runtime: { sources: { [`apiContainer_${O}`]: V } } },
|
|
137
|
+
children: !B && y
|
|
134
138
|
})
|
|
135
139
|
});
|
|
136
140
|
});
|
|
137
141
|
//#endregion
|
|
138
|
-
export {
|
|
142
|
+
export { v as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { use as e, useCallback as t, useMemo as n, useState as r } from "react";
|
|
2
2
|
import { get as i } from "@plitzi/plitzi-ui/helpers";
|
|
3
|
-
import { createStoreHook as a } from "@plitzi/
|
|
3
|
+
import { createStoreHook as a } from "@plitzi/nexus/createStore";
|
|
4
4
|
import { emptyObject as o } from "@plitzi/sdk-shared/helpers/utils";
|
|
5
5
|
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
import u from "@plitzi/plitzi-ui/QueryBuilder";
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import e from "../../../Element/RootElement.mjs";
|
|
2
2
|
import t from "./hooks/useCollectionContext.mjs";
|
|
3
3
|
import n from "../../../Element/hocs/withElement.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { jsx as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
import { useCallback as r, useMemo as i } from "react";
|
|
5
|
+
import a from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import c from "clsx";
|
|
8
|
+
import l from "@plitzi/sdk-shared/elements/hooks/useElement";
|
|
9
|
+
import u from "@plitzi/nexus/StoreProvider";
|
|
10
|
+
import d from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
11
|
+
var f = n(({ ref: n, className: f = "", source: p = "", children: m, limit: h = "10", query: g, singleRecord: _ = !1 }) => {
|
|
12
|
+
let { id: v, definition: { label: y = "Collection Container" } } = l(), { settings: { previewMode: b } } = a(), { loading: x, collection: S, fetch: C } = t({
|
|
13
|
+
source: p,
|
|
14
|
+
limit: h,
|
|
15
|
+
query: g,
|
|
16
|
+
singleRecord: _,
|
|
17
|
+
previewMode: b
|
|
18
|
+
}), w = r(() => {
|
|
17
19
|
let e = [];
|
|
18
|
-
return S ? (
|
|
20
|
+
return S ? (_ || e.push({
|
|
19
21
|
path: "records",
|
|
20
22
|
name: "Records"
|
|
21
23
|
}), e.push({
|
|
@@ -30,32 +32,34 @@ var d = n(({ ref: n, className: d = "", source: f = "", children: p, limit: m =
|
|
|
30
32
|
name: `Record Field - ${t.name}`
|
|
31
33
|
});
|
|
32
34
|
}), e) : [];
|
|
33
|
-
}, [S,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
name:
|
|
38
|
-
fields:
|
|
39
|
-
})
|
|
35
|
+
}, [S, _]);
|
|
36
|
+
d({
|
|
37
|
+
id: v,
|
|
38
|
+
source: `collectionContainer_${v}`,
|
|
39
|
+
name: y || `Collection - ${S?.name || v}`,
|
|
40
|
+
fields: w
|
|
41
|
+
});
|
|
42
|
+
let T = i(() => ({ performQuery: {
|
|
40
43
|
action: "performQuery",
|
|
41
|
-
title: `Refresh ${
|
|
44
|
+
title: `Refresh ${y}`,
|
|
42
45
|
type: "callback",
|
|
43
46
|
callback: C,
|
|
44
47
|
preview: {},
|
|
45
48
|
params: {}
|
|
46
|
-
} }), [C,
|
|
47
|
-
if (!(!S &&
|
|
49
|
+
} }), [C, y]);
|
|
50
|
+
if (!(!S && b)) return /* @__PURE__ */ s(e, {
|
|
48
51
|
ref: n,
|
|
49
|
-
interactionCallbacks:
|
|
50
|
-
className:
|
|
51
|
-
children: [!S && /* @__PURE__ */
|
|
52
|
+
interactionCallbacks: T,
|
|
53
|
+
className: c("plitzi-component__collection-container", f, { "collection-container--context-empty": !S }),
|
|
54
|
+
children: [!S && /* @__PURE__ */ o("div", {
|
|
52
55
|
className: "collection-container__message",
|
|
53
56
|
children: "Source Not Selected"
|
|
54
|
-
}), S && !x && /* @__PURE__ */
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
}), S && !x && /* @__PURE__ */ o(u, {
|
|
58
|
+
inherit: "live",
|
|
59
|
+
value: { runtime: { sources: { [`collectionContainer_${v}`]: S } } },
|
|
60
|
+
children: m
|
|
57
61
|
})]
|
|
58
62
|
});
|
|
59
63
|
});
|
|
60
64
|
//#endregion
|
|
61
|
-
export {
|
|
65
|
+
export { f as default };
|
|
@@ -6,8 +6,10 @@ import { getPathsFromObeject as c } from "@plitzi/sdk-shared/helpers/utils";
|
|
|
6
6
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
7
|
import d from "clsx";
|
|
8
8
|
import f from "@plitzi/sdk-shared/elements/hooks/useElement";
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import p from "@plitzi/nexus/StoreProvider";
|
|
10
|
+
import m from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
11
|
+
var h = t(({ ref: t, className: h = "", children: g, headerLabel: _ = "Dialog Header", acceptButtonLabel: v = "Accept", acceptButtonLabelLoading: y = "Loading...", rejectButtonLabel: b = "Cancel", autoHideAfterClick: x = !0 }) => {
|
|
12
|
+
let { id: S, setElementState: C, definition: { styleSelectors: w, label: T = "Dialog" }, elementState: E } = f(), { contexts: { InteractionsContext: D } } = s(), { interactionsManager: O } = n(D), [k, A] = o({}), [j, M] = o(!1), N = r((e) => {
|
|
11
13
|
let { metadata: t } = e;
|
|
12
14
|
if (t && typeof t == "object") A(t);
|
|
13
15
|
else if (typeof t == "string") try {
|
|
@@ -16,54 +18,54 @@ var p = t(({ ref: t, className: p = "", children: m, headerLabel: h = "Dialog He
|
|
|
16
18
|
A({ content: t });
|
|
17
19
|
}
|
|
18
20
|
else A(typeof t == "boolean" || typeof t == "number" ? { content: t } : {});
|
|
19
|
-
|
|
21
|
+
C((e) => ({
|
|
20
22
|
...e,
|
|
21
23
|
visibility: !0
|
|
22
24
|
}));
|
|
23
|
-
}, [
|
|
24
|
-
|
|
25
|
+
}, [C, A]), P = r(() => {
|
|
26
|
+
O.interactionTrigger(S, "onDialogClose", { metadata: k }), A({}), C((e) => ({
|
|
25
27
|
...e,
|
|
26
28
|
visibility: !1
|
|
27
29
|
}));
|
|
28
30
|
}, [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
O,
|
|
32
|
+
C,
|
|
31
33
|
A,
|
|
32
34
|
k,
|
|
33
|
-
|
|
35
|
+
S
|
|
34
36
|
]), F = r(() => {
|
|
35
|
-
|
|
37
|
+
x && (O.interactionTrigger(S, "onDialogClose", { metadata: k }), A({}), C((e) => ({
|
|
36
38
|
...e,
|
|
37
39
|
visibility: !1
|
|
38
40
|
})));
|
|
39
41
|
}, [
|
|
40
|
-
|
|
41
|
-
y,
|
|
42
|
+
O,
|
|
42
43
|
x,
|
|
44
|
+
C,
|
|
43
45
|
A,
|
|
44
46
|
k,
|
|
45
|
-
|
|
47
|
+
S
|
|
46
48
|
]);
|
|
47
49
|
r(async () => {
|
|
48
|
-
M(!0), await
|
|
50
|
+
M(!0), await O.interactionTrigger(S, "onDialogAccept", { metadata: k }), M(!1), C((e) => ({
|
|
49
51
|
...e,
|
|
50
52
|
visibility: !1
|
|
51
53
|
}));
|
|
52
54
|
}, [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
O,
|
|
56
|
+
S,
|
|
55
57
|
k,
|
|
56
|
-
|
|
58
|
+
C
|
|
57
59
|
]), r(async () => {
|
|
58
|
-
M(!0), await
|
|
60
|
+
M(!0), await O.interactionTrigger(S, "onDialogReject", { metadata: k }), M(!1), C((e) => ({
|
|
59
61
|
...e,
|
|
60
62
|
visibility: !1
|
|
61
63
|
}));
|
|
62
64
|
}, [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
O,
|
|
66
|
+
S,
|
|
65
67
|
k,
|
|
66
|
-
|
|
68
|
+
C
|
|
67
69
|
]);
|
|
68
70
|
let I = a(() => ({
|
|
69
71
|
onDialogAccept: {
|
|
@@ -109,7 +111,7 @@ var p = t(({ ref: t, className: p = "", children: m, headerLabel: h = "Dialog He
|
|
|
109
111
|
}), []), L = a(() => ({
|
|
110
112
|
openDialog: {
|
|
111
113
|
action: "openDialog",
|
|
112
|
-
title: `Open ${
|
|
114
|
+
title: `Open ${T}`,
|
|
113
115
|
type: "callback",
|
|
114
116
|
callback: N,
|
|
115
117
|
params: { metadata: {
|
|
@@ -120,7 +122,7 @@ var p = t(({ ref: t, className: p = "", children: m, headerLabel: h = "Dialog He
|
|
|
120
122
|
},
|
|
121
123
|
closeDialog: {
|
|
122
124
|
action: "closeDialog",
|
|
123
|
-
title: `Close ${
|
|
125
|
+
title: `Close ${T}`,
|
|
124
126
|
type: "callback",
|
|
125
127
|
callback: P,
|
|
126
128
|
preview: {},
|
|
@@ -129,15 +131,15 @@ var p = t(({ ref: t, className: p = "", children: m, headerLabel: h = "Dialog He
|
|
|
129
131
|
}), [
|
|
130
132
|
P,
|
|
131
133
|
N,
|
|
132
|
-
|
|
134
|
+
T
|
|
133
135
|
]);
|
|
134
136
|
i(() => {
|
|
135
|
-
|
|
137
|
+
E.visibility !== !1 && O.interactionTrigger(S, "onDialogOpen", { metadata: k });
|
|
136
138
|
}, [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
+
S,
|
|
140
|
+
O,
|
|
139
141
|
k,
|
|
140
|
-
|
|
142
|
+
E.visibility
|
|
141
143
|
]);
|
|
142
144
|
let R = r(() => typeof k == "object" ? c(k).reduce((e, t) => {
|
|
143
145
|
let n = t.split(".");
|
|
@@ -148,29 +150,28 @@ var p = t(({ ref: t, className: p = "", children: m, headerLabel: h = "Dialog He
|
|
|
148
150
|
path: t,
|
|
149
151
|
name: n[n.length - 1]
|
|
150
152
|
}];
|
|
151
|
-
}, []) : [], [k])
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
name:
|
|
153
|
+
}, []) : [], [k]);
|
|
154
|
+
return m({
|
|
155
|
+
id: S,
|
|
156
|
+
source: `dialogContainer_${S}`,
|
|
157
|
+
name: T || `Dialog - ${S}`,
|
|
156
158
|
fields: R
|
|
157
|
-
})
|
|
158
|
-
return /* @__PURE__ */ u(e, {
|
|
159
|
+
}), /* @__PURE__ */ u(e, {
|
|
159
160
|
ref: t,
|
|
160
|
-
className: d("plitzi-component__dialog-container",
|
|
161
|
+
className: d("plitzi-component__dialog-container", h),
|
|
161
162
|
interactionTriggers: I,
|
|
162
163
|
interactionCallbacks: L,
|
|
163
164
|
children: [/* @__PURE__ */ l("div", {
|
|
164
|
-
className: d("dialog-container__background",
|
|
165
|
+
className: d("dialog-container__background", w.backgroundContainer),
|
|
165
166
|
onClick: F
|
|
166
167
|
}), /* @__PURE__ */ u("div", {
|
|
167
|
-
className: d("dialog-container__root",
|
|
168
|
+
className: d("dialog-container__root", w.rootContainer),
|
|
168
169
|
children: [
|
|
169
170
|
/* @__PURE__ */ u("div", {
|
|
170
|
-
className: d("dialog-container__header",
|
|
171
|
+
className: d("dialog-container__header", w.headerContainer),
|
|
171
172
|
children: [/* @__PURE__ */ l("div", {
|
|
172
|
-
className: d("dialog-container__header__title",
|
|
173
|
-
children:
|
|
173
|
+
className: d("dialog-container__header__title", w.headerTitle),
|
|
174
|
+
children: _ || "Dialog Header"
|
|
174
175
|
}), /* @__PURE__ */ l("i", {
|
|
175
176
|
className: "fa-solid fa-xmark",
|
|
176
177
|
title: "Close",
|
|
@@ -178,27 +179,28 @@ var p = t(({ ref: t, className: p = "", children: m, headerLabel: h = "Dialog He
|
|
|
178
179
|
})]
|
|
179
180
|
}),
|
|
180
181
|
/* @__PURE__ */ l("div", {
|
|
181
|
-
className: d("dialog-container__body",
|
|
182
|
-
children: /* @__PURE__ */ l(
|
|
183
|
-
|
|
184
|
-
|
|
182
|
+
className: d("dialog-container__body", w.body),
|
|
183
|
+
children: /* @__PURE__ */ l(p, {
|
|
184
|
+
inherit: "live",
|
|
185
|
+
value: { runtime: { sources: { [`dialogContainer_${S}`]: k } } },
|
|
186
|
+
children: g
|
|
185
187
|
})
|
|
186
188
|
}),
|
|
187
189
|
/* @__PURE__ */ u("div", {
|
|
188
|
-
className: d("dialog-container__footer",
|
|
190
|
+
className: d("dialog-container__footer", w.footerContainer),
|
|
189
191
|
children: [/* @__PURE__ */ u("button", {
|
|
190
|
-
className: d("footer__button button--accept",
|
|
192
|
+
className: d("footer__button button--accept", w.acceptButton),
|
|
191
193
|
onClick: void 0,
|
|
192
194
|
disabled: j,
|
|
193
195
|
children: [j && /* @__PURE__ */ u("div", {
|
|
194
196
|
className: "button--accept__container",
|
|
195
|
-
children: [/* @__PURE__ */ l("i", { className: "fa-solid fa-rotate fa-spin" }),
|
|
196
|
-
}), !j &&
|
|
197
|
+
children: [/* @__PURE__ */ l("i", { className: "fa-solid fa-rotate fa-spin" }), y]
|
|
198
|
+
}), !j && v]
|
|
197
199
|
}), /* @__PURE__ */ l("button", {
|
|
198
|
-
className: d("footer__button button--cancel",
|
|
200
|
+
className: d("footer__button button--cancel", w.cancelButton),
|
|
199
201
|
onClick: void 0,
|
|
200
202
|
disabled: j,
|
|
201
|
-
children:
|
|
203
|
+
children: b
|
|
202
204
|
})]
|
|
203
205
|
})
|
|
204
206
|
]
|
|
@@ -206,4 +208,4 @@ var p = t(({ ref: t, className: p = "", children: m, headerLabel: h = "Dialog He
|
|
|
206
208
|
});
|
|
207
209
|
});
|
|
208
210
|
//#endregion
|
|
209
|
-
export {
|
|
211
|
+
export { h as default };
|