@plitzi/sdk-elements 0.36.1 → 0.37.0
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 +80 -0
- package/dist/Element/ElementParentContext.d.ts +13 -0
- package/dist/Element/ElementParentContext.mjs +6 -0
- package/dist/Element/LayoutBody.d.ts +21 -0
- package/dist/Element/LayoutBody.mjs +24 -0
- package/dist/Element/hocs/withElement.mjs +104 -87
- package/dist/Element/hooks/useElementDataSource.mjs +1 -1
- package/dist/Element/hooks/useElementInternal.mjs +24 -24
- package/dist/Element/hooks/useInternalItems.mjs +42 -39
- package/dist/Element/hooks/useLayoutChain.d.ts +10 -0
- package/dist/Element/hooks/useLayoutChain.mjs +20 -0
- package/dist/Element/hooks/useRootElementInteractions.mjs +45 -44
- package/dist/dataSource/GlobalSources.mjs +60 -59
- package/dist/dataSource/pathFields.d.ts +7 -0
- package/dist/dataSource/pathFields.mjs +8 -0
- package/dist/elements/advanced/Custom/declaration.d.ts +7 -9
- package/dist/elements/advanced/Custom/index.d.ts +1 -7
- package/dist/elements/advanced/Reference/Reference.mjs +93 -89
- package/dist/elements/advanced/Reference/declaration.d.ts +1 -1
- package/dist/elements/advanced/Reference/index.d.ts +1 -1
- package/dist/elements/basic/Button/Button.d.ts +9 -1
- package/dist/elements/basic/Button/Button.mjs +19 -20
- package/dist/elements/basic/Button/Settings.d.ts +2 -1
- package/dist/elements/basic/Button/Settings.mjs +13 -6
- package/dist/elements/basic/Button/declaration.d.ts +1 -0
- package/dist/elements/basic/Button/index.d.ts +1 -0
- package/dist/elements/declarations/index.d.ts +6 -9
- package/dist/elements/form/FormControl/declaration.d.ts +2 -0
- package/dist/elements/internal/LayoutContainer/LayoutContainer.d.ts +6 -0
- package/dist/elements/internal/LayoutContainer/LayoutContainer.mjs +31 -23
- package/dist/elements/internal/LayoutContainer/Settings.d.ts +4 -1
- package/dist/elements/internal/LayoutContainer/Settings.mjs +78 -64
- package/dist/elements/internal/LayoutContainer/declaration.d.ts +2 -0
- package/dist/elements/internal/LayoutContainer/index.d.ts +2 -0
- package/dist/elements/internal/LayoutPicker/LayoutPicker.d.ts +10 -0
- package/dist/elements/internal/LayoutPicker/LayoutPicker.mjs +35 -0
- package/dist/elements/internal/LayoutPicker/index.d.ts +3 -0
- package/dist/elements/internal/LayoutPicker/index.mjs +5 -0
- package/dist/elements/internal/Page/Page.mjs +49 -48
- package/dist/elements/internal/Page/Settings.mjs +101 -119
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +58 -66
- package/dist/elements/provider/ApiContainer/declaration.mjs +1 -1
- package/dist/elements/provider/ApiContainer/hooks/useApi.d.ts +8 -0
- package/dist/elements/provider/ApiContainer/hooks/useApi.mjs +52 -48
- package/dist/elements/structure/Container/Container.d.ts +1 -1
- package/dist/elements/structure/Container/Settings.d.ts +1 -1
- package/dist/elements/structure/Container/Settings.mjs +4 -0
- package/dist/elements/structure/Container/declaration.d.ts +1 -1
- package/dist/elements/structure/Container/index.d.ts +1 -1
- package/dist/elements/structure/DialogContainer/DialogContainer.mjs +17 -25
- package/dist/elements/structure/ModalContainer/ModalContainer.mjs +15 -23
- package/dist/index.d.ts +6 -9
- package/package.json +38 -10
|
@@ -1,61 +1,62 @@
|
|
|
1
1
|
import e from "../../../Element/hocs/withElement.mjs";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { RootElement as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
2
|
+
import ee from "../../../Element/hooks/useElement.mjs";
|
|
3
|
+
import te from "../../../Element/hooks/useRscData.mjs";
|
|
4
|
+
import { RootElement as t } from "../../../Element/RootElement.mjs";
|
|
5
|
+
import ne from "./declaration.mjs";
|
|
6
|
+
import re from "./hooks/useApi.mjs";
|
|
7
|
+
import ie from "./hooks/useProviderPagination.mjs";
|
|
8
|
+
import ae from "./hooks/useProviderWrite.mjs";
|
|
9
|
+
import oe from "../../../dataSource/pathFields.mjs";
|
|
10
|
+
import { use as se, useCallback as n, useEffect as ce, useMemo as r } from "react";
|
|
11
|
+
import le from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
12
|
+
import { useSdkStore as i } from "@plitzi/sdk-shared/store";
|
|
13
|
+
import { StoreProvider as a } from "@plitzi/nexus/react";
|
|
14
|
+
import { emptyObject as o } from "@plitzi/sdk-shared/helpers/utils";
|
|
14
15
|
import { jsx as s } from "react/jsx-runtime";
|
|
15
16
|
import { currentRscLocation as c } from "@plitzi/sdk-shared/server/rsc/refreshRsc";
|
|
16
17
|
import l from "clsx";
|
|
17
18
|
import u from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
|
|
18
|
-
import
|
|
19
|
-
import { QueryBuilderEvaluator as
|
|
19
|
+
import ue from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
20
|
+
import { QueryBuilderEvaluator as de } from "@plitzi/plitzi-ui/QueryBuilder";
|
|
20
21
|
//#region src/elements/provider/ApiContainer/ApiContainer.tsx
|
|
21
|
-
var
|
|
22
|
-
let { id: C, visible: w, definition: { label: T = "Api Container", runtime: _e, items: ve } } =
|
|
22
|
+
var d = ({ ref: e, className: d = "", children: f, query: p = "", method: m = "get", accessToken: h = "", when: g = o, headers: _ = o, mockData: v = "{}", subType: y = "", credentials: fe = "same-origin", singleRecord: b = !1, pagination: x = "none", pageParam: pe = "page", renderWhileLoading: me = !1, cache: S = !1, staleTime: he = 30, gcTime: ge = 300 }) => {
|
|
23
|
+
let { id: C, visible: w, definition: { label: T = "Api Container", runtime: _e, items: ve } } = ee(), E = _e === "server", { loaded: D, stale: O, location: k, elementData: A, refresh: j } = te(), M = u(ne.sourceType, C), { settings: { previewMode: N }, contexts: { InteractionsContext: P } } = le(), { interactionsManager: F } = se(P), [[I, L, ye]] = i([
|
|
23
24
|
"navigation.routeParams",
|
|
24
25
|
"navigation.queryParams",
|
|
25
26
|
"navigation.navigate"
|
|
26
|
-
]), be =
|
|
27
|
-
...
|
|
28
|
-
Authorization: `Bearer ${
|
|
29
|
-
} :
|
|
27
|
+
]), be = r(() => h ? {
|
|
28
|
+
..._,
|
|
29
|
+
Authorization: `Bearer ${h}`
|
|
30
|
+
} : _, [_, h]), xe = r(() => E || !w ? !1 : !!(N && p && (g === o || de(g, {
|
|
30
31
|
...I,
|
|
31
32
|
...L
|
|
32
|
-
})) || !N && (
|
|
33
|
+
})) || !N && (p || v && v !== "{}" && v !== o)), [
|
|
33
34
|
E,
|
|
34
35
|
w,
|
|
35
36
|
N,
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
p,
|
|
38
|
+
g,
|
|
38
39
|
I,
|
|
39
40
|
L,
|
|
40
|
-
|
|
41
|
-
]), Se =
|
|
42
|
-
url:
|
|
43
|
-
method:
|
|
41
|
+
v
|
|
42
|
+
]), Se = r(() => [C], [C]), { isLoading: Ce, isFetching: we, data: R, refetch: z, isSuccess: B, isError: V } = re({
|
|
43
|
+
url: p,
|
|
44
|
+
method: m,
|
|
44
45
|
credentials: fe,
|
|
45
|
-
mock: N ? void 0 :
|
|
46
|
+
mock: N ? void 0 : v,
|
|
46
47
|
customHeaders: be,
|
|
47
48
|
enabled: xe,
|
|
48
|
-
cache:
|
|
49
|
+
cache: S,
|
|
49
50
|
staleTime: he,
|
|
50
51
|
gcTime: ge,
|
|
51
52
|
tags: Se
|
|
52
|
-
}), H = E && !!k && k !== c(), U = E && D && !H && A === null, W =
|
|
53
|
+
}), H = E && !!k && k !== c(), U = E && D && !H && A === null, W = r(() => {
|
|
53
54
|
if (!E) return R ?? o;
|
|
54
55
|
if (A) return A;
|
|
55
56
|
if (D) return o;
|
|
56
|
-
if (typeof
|
|
57
|
+
if (typeof v != "string") return v;
|
|
57
58
|
try {
|
|
58
|
-
return JSON.parse(
|
|
59
|
+
return JSON.parse(v || "{}");
|
|
59
60
|
} catch {
|
|
60
61
|
return o;
|
|
61
62
|
}
|
|
@@ -64,8 +65,8 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
|
|
|
64
65
|
R,
|
|
65
66
|
A,
|
|
66
67
|
D,
|
|
67
|
-
|
|
68
|
-
]), G = E ? H : we, Te = E ? H : Ce, K =
|
|
68
|
+
v
|
|
69
|
+
]), G = E ? H : we, Te = E ? H : Ce, K = n(async () => {
|
|
69
70
|
if (!E) {
|
|
70
71
|
z();
|
|
71
72
|
return;
|
|
@@ -76,23 +77,23 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
|
|
|
76
77
|
z,
|
|
77
78
|
j,
|
|
78
79
|
C
|
|
79
|
-
]), q = W, Ee =
|
|
80
|
+
]), q = W, Ee = r(() => Array.isArray(q.records) ? q.records : [], [q.records]), { records: J, isLoadingMore: Y, goToPage: X, loadMore: Z } = ie({
|
|
80
81
|
elementId: C,
|
|
81
82
|
mode: x,
|
|
82
|
-
pageParam:
|
|
83
|
+
pageParam: pe,
|
|
83
84
|
records: Ee,
|
|
84
85
|
page: q.pageInfo?.page ?? 1,
|
|
85
86
|
refresh: j,
|
|
86
87
|
navigate: ye
|
|
87
88
|
});
|
|
88
|
-
|
|
89
|
+
ce(() => {
|
|
89
90
|
!G && C && (B ? F.interactionTrigger(C, "onApiSuccess", {
|
|
90
|
-
url:
|
|
91
|
-
method:
|
|
91
|
+
url: p,
|
|
92
|
+
method: m,
|
|
92
93
|
...W
|
|
93
94
|
}) : V && F.interactionTrigger(C, "onApiError", {
|
|
94
|
-
url:
|
|
95
|
-
method:
|
|
95
|
+
url: p,
|
|
96
|
+
method: m,
|
|
96
97
|
...W
|
|
97
98
|
}));
|
|
98
99
|
}, [
|
|
@@ -102,10 +103,10 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
|
|
|
102
103
|
V,
|
|
103
104
|
G,
|
|
104
105
|
B,
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
m,
|
|
107
|
+
p
|
|
107
108
|
]);
|
|
108
|
-
let Q =
|
|
109
|
+
let Q = r(() => ({
|
|
109
110
|
...W,
|
|
110
111
|
...Array.isArray(q.records) ? { records: J } : o,
|
|
111
112
|
isLoading: G || Y,
|
|
@@ -124,27 +125,18 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
|
|
|
124
125
|
U,
|
|
125
126
|
E,
|
|
126
127
|
O
|
|
127
|
-
]), De =
|
|
128
|
-
|
|
129
|
-
return n.length > 1 ? [...e, {
|
|
130
|
-
path: t,
|
|
131
|
-
name: n.slice(n.length - 2).join(" ")
|
|
132
|
-
}] : [...e, {
|
|
133
|
-
path: t,
|
|
134
|
-
name: n[n.length - 1]
|
|
135
|
-
}];
|
|
136
|
-
}, []), [Q]);
|
|
137
|
-
d({
|
|
128
|
+
]), De = n(() => oe(Q), [Q]);
|
|
129
|
+
ue({
|
|
138
130
|
id: C,
|
|
139
131
|
source: M,
|
|
140
132
|
name: T || `API - ${C}`,
|
|
141
133
|
fields: De
|
|
142
134
|
});
|
|
143
|
-
let { writeRecord: $ } =
|
|
135
|
+
let { writeRecord: $ } = ae({
|
|
144
136
|
elementId: C,
|
|
145
137
|
enabled: E,
|
|
146
138
|
onDone: K
|
|
147
|
-
}), Oe =
|
|
139
|
+
}), Oe = r(() => {
|
|
148
140
|
let e = {
|
|
149
141
|
performQuery: {
|
|
150
142
|
action: "performQuery",
|
|
@@ -201,7 +193,7 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
|
|
|
201
193
|
X,
|
|
202
194
|
E,
|
|
203
195
|
$
|
|
204
|
-
]), ke =
|
|
196
|
+
]), ke = r(() => ({
|
|
205
197
|
onApiError: {
|
|
206
198
|
action: "onApiError",
|
|
207
199
|
title: "On Api Error",
|
|
@@ -226,20 +218,20 @@ var f = ({ ref: e, className: f = "", children: p, query: m = "", method: h = "g
|
|
|
226
218
|
data: ""
|
|
227
219
|
}
|
|
228
220
|
}
|
|
229
|
-
}), []), Ae =
|
|
230
|
-
return /* @__PURE__ */ s(
|
|
221
|
+
}), []), Ae = r(() => M ? { runtime: { sources: { [M]: Q } } } : o, [Q, M]);
|
|
222
|
+
return /* @__PURE__ */ s(t, {
|
|
231
223
|
ref: e,
|
|
232
|
-
tag: !N && !ve?.length ? "div" :
|
|
233
|
-
className: l("plitzi-component__api-container",
|
|
224
|
+
tag: !N && !ve?.length ? "div" : y,
|
|
225
|
+
className: l("plitzi-component__api-container", d),
|
|
234
226
|
interactionTriggers: ke,
|
|
235
227
|
interactionCallbacks: Oe,
|
|
236
|
-
children: (!Te ||
|
|
228
|
+
children: (!Te || me) && /* @__PURE__ */ s(a, {
|
|
237
229
|
inherit: "live",
|
|
238
230
|
name: `Api:${C}`,
|
|
239
231
|
value: Ae,
|
|
240
|
-
children:
|
|
232
|
+
children: f
|
|
241
233
|
})
|
|
242
234
|
});
|
|
243
|
-
},
|
|
235
|
+
}, f = e(d);
|
|
244
236
|
//#endregion
|
|
245
|
-
export {
|
|
237
|
+
export { d as ApiContainer, f as default };
|
|
@@ -26,7 +26,7 @@ var t = e()({
|
|
|
26
26
|
definition: {
|
|
27
27
|
label: "Api Container",
|
|
28
28
|
type: "apiContainer",
|
|
29
|
-
description: "Fetches data from a backend HTTP API (its `query`/`method`/`credentials`) and exposes the response as a data source ITS DESCENDANTS bind to (source `apiContainer_<id>.data`; only elements inside it can consume it). This is how you get backend data into the frontend. Its `mockData` prop is builder-only sample data — the published runtime fetches the real `query`, so always set a real query for production. With `cache: true` a browser request is kept for `staleTime` seconds (default 30) and shared with every provider asking the same thing; it is off unless set. A flow refreshes it with `performQuery` or the global `invalidateQueries` step.",
|
|
29
|
+
description: "Fetches data from a backend HTTP API (its `query`/`method`/`credentials`) and exposes the response as a data source ITS DESCENDANTS bind to (source `apiContainer_<id>.data`; only elements inside it can consume it). This is how you get backend data into the frontend. Its `mockData` prop is builder-only sample data — the published runtime fetches the real `query`, so always set a real query for production. With `cache: true` a browser request is kept for `staleTime` seconds (default 30) and shared with every provider asking the same thing; it is off unless set. A flow refreshes it with `performQuery` or the global `invalidateQueries` step. Its `subType` (container tag) is empty by default, and then it renders NO element of its own: its children lay out directly in its parent, and any class, variant or style binding on it applies to nothing. To style the provider itself give it a tag (`subType: \"div\"`, `section`, …); otherwise style its parent or a child.",
|
|
30
30
|
items: [],
|
|
31
31
|
bindings: {},
|
|
32
32
|
styleSelectors: { base: "" },
|
|
@@ -39,6 +39,14 @@ declare const useApi: ({ url, method, mock, customHeaders, enabled, credentials,
|
|
|
39
39
|
isFetching: boolean;
|
|
40
40
|
data: ApiResponse | undefined;
|
|
41
41
|
refetch: () => void;
|
|
42
|
+
/**
|
|
43
|
+
* Whether THIS question has been answered — not whether an answer is on screen.
|
|
44
|
+
*
|
|
45
|
+
* The last answer is kept visible while the URL is unaskable, so nothing flickers; reporting it as this URL's
|
|
46
|
+
* success is a different claim and a wrong one. It fired `onApiSuccess` again on the way out of a page — the
|
|
47
|
+
* URL is one of the trigger's dependencies — and the flow behind it set the workspace id from a route param
|
|
48
|
+
* the page had already lost, which emptied it.
|
|
49
|
+
*/
|
|
42
50
|
isSuccess: boolean;
|
|
43
51
|
isError: boolean;
|
|
44
52
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { useCallback as e, useId as t, useMemo as n } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { hasValidToken as r } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
3
|
+
import { emptyObject as i } from "@plitzi/sdk-shared/helpers/utils";
|
|
4
|
+
import { authFailureFromResponse as a, reportAuthFailure as o } from "@plitzi/sdk-shared/auth";
|
|
5
|
+
import { requestKey as s, useQuery as c } from "@plitzi/sdk-shared/queries";
|
|
5
6
|
//#region src/elements/provider/ApiContainer/hooks/useApi.ts
|
|
6
|
-
var
|
|
7
|
+
var l = 30, u = 300, d = (e) => !!e && e !== "{}" && e !== i, f = (e) => {
|
|
7
8
|
if (typeof e != "string") return {
|
|
8
9
|
status: 200,
|
|
9
10
|
data: e
|
|
@@ -19,22 +20,23 @@ var c = 30, l = 300, u = (e) => !!e && e !== "{}" && e !== r, d = (e) => {
|
|
|
19
20
|
data: e.message
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
},
|
|
23
|
+
}, p = async (e, t, n, r, i) => {
|
|
23
24
|
if (!e) return {
|
|
24
25
|
status: 400,
|
|
25
26
|
data: "URL is required"
|
|
26
27
|
};
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
let
|
|
28
|
+
let s = new Headers(r);
|
|
29
|
+
s.has("Content-Type") || s.set("Content-Type", "application/json");
|
|
30
|
+
let c = {
|
|
30
31
|
method: t,
|
|
31
32
|
credentials: n,
|
|
32
|
-
headers:
|
|
33
|
+
headers: s,
|
|
34
|
+
signal: i
|
|
33
35
|
};
|
|
34
|
-
t !== "get" && (
|
|
36
|
+
t !== "get" && (c.body = "{}");
|
|
35
37
|
try {
|
|
36
|
-
let t = await fetch(e,
|
|
37
|
-
return r &&
|
|
38
|
+
let t = await fetch(e, c), n = await t.json(), r = a(t.status, n);
|
|
39
|
+
return r && o({
|
|
38
40
|
reason: r,
|
|
39
41
|
url: e
|
|
40
42
|
}), {
|
|
@@ -42,57 +44,59 @@ var c = 30, l = 300, u = (e) => !!e && e !== "{}" && e !== r, d = (e) => {
|
|
|
42
44
|
data: n
|
|
43
45
|
};
|
|
44
46
|
} catch (e) {
|
|
47
|
+
if (i.aborted) throw e;
|
|
45
48
|
return console.error(e.message), {
|
|
46
49
|
status: 500,
|
|
47
50
|
data: e.message
|
|
48
51
|
};
|
|
49
52
|
}
|
|
50
|
-
},
|
|
53
|
+
}, m = (e) => e.status < 400, h = (e, t) => {
|
|
51
54
|
let n = typeof e == "number" ? e : Number(e);
|
|
52
55
|
return (Number.isFinite(n) && n >= 0 ? n : t) * 1e3;
|
|
53
|
-
},
|
|
54
|
-
let
|
|
55
|
-
if (
|
|
56
|
-
let e =
|
|
57
|
-
method:
|
|
58
|
-
url:
|
|
59
|
-
credentials:
|
|
60
|
-
headers:
|
|
56
|
+
}, g = ({ url: a = "", method: o = "get", mock: l, customHeaders: u = i, enabled: g = !0, credentials: _ = "same-origin", cache: v = !1, staleTime: y = 30, gcTime: b = 300, tags: x }) => {
|
|
57
|
+
let S = d(l), C = t(), w = !S && (!a || r(a)), T = n(() => {
|
|
58
|
+
if (S || w) return;
|
|
59
|
+
let e = s({
|
|
60
|
+
method: o,
|
|
61
|
+
url: a,
|
|
62
|
+
credentials: _,
|
|
63
|
+
headers: u
|
|
61
64
|
});
|
|
62
|
-
return
|
|
65
|
+
return v ? e : `${e}#${C}`;
|
|
63
66
|
}, [
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
S,
|
|
68
|
+
w,
|
|
66
69
|
a,
|
|
67
|
-
|
|
68
|
-
l,
|
|
70
|
+
o,
|
|
69
71
|
_,
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
u,
|
|
73
|
+
v,
|
|
74
|
+
C
|
|
75
|
+
]), E = e((e) => p(a, o, _, u, e), [
|
|
73
76
|
a,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
o,
|
|
78
|
+
_,
|
|
79
|
+
u
|
|
80
|
+
]), D = c({
|
|
81
|
+
key: T,
|
|
78
82
|
meta: {
|
|
79
|
-
url:
|
|
80
|
-
tags:
|
|
83
|
+
url: a,
|
|
84
|
+
tags: x
|
|
81
85
|
},
|
|
82
|
-
fetcher:
|
|
83
|
-
enabled:
|
|
84
|
-
staleTime:
|
|
85
|
-
gcTime:
|
|
86
|
-
isCacheable:
|
|
87
|
-
}),
|
|
86
|
+
fetcher: E,
|
|
87
|
+
enabled: g,
|
|
88
|
+
staleTime: v ? h(y, 30) : 0,
|
|
89
|
+
gcTime: v ? h(b, 300) : 0,
|
|
90
|
+
isCacheable: m
|
|
91
|
+
}), O = n(() => S ? f(l) : void 0, [S, l]), k = g && O ? O : D.data, A = !O && D.isFetching;
|
|
88
92
|
return {
|
|
89
|
-
isLoading:
|
|
90
|
-
isFetching:
|
|
91
|
-
data:
|
|
92
|
-
refetch:
|
|
93
|
-
isSuccess: !
|
|
94
|
-
isError: !
|
|
93
|
+
isLoading: A && k === void 0,
|
|
94
|
+
isFetching: A,
|
|
95
|
+
data: k,
|
|
96
|
+
refetch: D.refetch,
|
|
97
|
+
isSuccess: !w && !A && !!k && k.status < 400,
|
|
98
|
+
isError: !w && !A && !!k && k.status >= 400
|
|
95
99
|
};
|
|
96
100
|
};
|
|
97
101
|
//#endregion
|
|
98
|
-
export {
|
|
102
|
+
export { u as DEFAULT_GC_TIME, l as DEFAULT_STALE_TIME, g as default };
|
|
@@ -2,7 +2,7 @@ import { ReactNode, RefObject } from 'react';
|
|
|
2
2
|
export type ContainerProps = {
|
|
3
3
|
ref?: RefObject<HTMLElement>;
|
|
4
4
|
className?: string;
|
|
5
|
-
subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd';
|
|
5
|
+
subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd' | 'li';
|
|
6
6
|
children?: ReactNode;
|
|
7
7
|
};
|
|
8
8
|
declare const Container: ({ ref, className, subType, children }: ContainerProps) => import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type SettingsProps = {
|
|
2
|
-
subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd';
|
|
2
|
+
subType?: 'div' | 'header' | 'footer' | 'nav' | 'main' | 'section' | 'article' | 'aside' | 'address' | 'figure' | 'dl' | 'dt' | 'dd' | 'li';
|
|
3
3
|
onUpdate?: (key: string, value: string | boolean | number) => void;
|
|
4
4
|
};
|
|
5
5
|
declare const Settings: ({ subType, onUpdate }: SettingsProps) => import("react").JSX.Element;
|
|
@@ -52,6 +52,6 @@ declare const declaration: {
|
|
|
52
52
|
readonly settings: {};
|
|
53
53
|
};
|
|
54
54
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
55
|
-
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | undefined;
|
|
55
|
+
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | undefined;
|
|
56
56
|
}>>;
|
|
57
57
|
export default declaration;
|
|
@@ -51,6 +51,6 @@ declare const Container: {
|
|
|
51
51
|
readonly settings: {};
|
|
52
52
|
};
|
|
53
53
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
54
|
-
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | undefined;
|
|
54
|
+
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "dl" | "dt" | "dd" | "li" | undefined;
|
|
55
55
|
}>>;
|
|
56
56
|
export default Container;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import e from "../../../Element/hocs/withElement.mjs";
|
|
2
2
|
import t from "../../../Element/hooks/useElement.mjs";
|
|
3
3
|
import { RootElement as n } from "../../../Element/RootElement.mjs";
|
|
4
|
-
import r from "
|
|
5
|
-
import
|
|
6
|
-
import l from "
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
4
|
+
import r from "../../../dataSource/pathFields.mjs";
|
|
5
|
+
import i from "./declaration.mjs";
|
|
6
|
+
import { use as a, useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
7
|
+
import u from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
8
|
+
import { StoreProvider as d } from "@plitzi/nexus/react";
|
|
9
|
+
import { emptyObject as f } from "@plitzi/sdk-shared/helpers/utils";
|
|
9
10
|
import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
10
11
|
import h from "clsx";
|
|
11
12
|
import g from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
|
|
12
13
|
import _ from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
13
14
|
//#region src/elements/structure/DialogContainer/DialogContainer.tsx
|
|
14
15
|
var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Header", acceptButtonLabel: x = "Accept", acceptButtonLabelLoading: S = "Loading...", rejectButtonLabel: C = "Cancel", autoHideAfterClick: w = !0 }) => {
|
|
15
|
-
let { id: T, setElementState: E, definition: { styleSelectors: D, label: O = "Dialog" }, elementState: k } = t(), A = g(
|
|
16
|
+
let { id: T, setElementState: E, definition: { styleSelectors: D, label: O = "Dialog" }, elementState: k } = t(), A = g(i.sourceType, T), { contexts: { InteractionsContext: j } } = u(), { interactionsManager: M } = a(j), [N, P] = l({}), [F, I] = l(!1), L = o((e) => {
|
|
16
17
|
let { metadata: t } = e;
|
|
17
18
|
if (t && typeof t == "object") P(t);
|
|
18
19
|
else if (typeof t == "string") try {
|
|
@@ -25,7 +26,7 @@ var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Head
|
|
|
25
26
|
...e,
|
|
26
27
|
visibility: !0
|
|
27
28
|
}));
|
|
28
|
-
}, [E, P]), R =
|
|
29
|
+
}, [E, P]), R = o(() => {
|
|
29
30
|
M.interactionTrigger(T, "onDialogClose", { metadata: N }), P({}), E((e) => ({
|
|
30
31
|
...e,
|
|
31
32
|
visibility: !1
|
|
@@ -36,7 +37,7 @@ var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Head
|
|
|
36
37
|
P,
|
|
37
38
|
N,
|
|
38
39
|
T
|
|
39
|
-
]), z =
|
|
40
|
+
]), z = o(() => {
|
|
40
41
|
w && (M.interactionTrigger(T, "onDialogClose", { metadata: N }), P({}), E((e) => ({
|
|
41
42
|
...e,
|
|
42
43
|
visibility: !1
|
|
@@ -48,7 +49,7 @@ var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Head
|
|
|
48
49
|
P,
|
|
49
50
|
N,
|
|
50
51
|
T
|
|
51
|
-
]), B =
|
|
52
|
+
]), B = o(async () => {
|
|
52
53
|
I(!0), await M.interactionTrigger(T, "onDialogAccept", { metadata: N }), I(!1), E((e) => ({
|
|
53
54
|
...e,
|
|
54
55
|
visibility: !1
|
|
@@ -58,7 +59,7 @@ var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Head
|
|
|
58
59
|
T,
|
|
59
60
|
N,
|
|
60
61
|
E
|
|
61
|
-
]), V =
|
|
62
|
+
]), V = o(async () => {
|
|
62
63
|
I(!0), await M.interactionTrigger(T, "onDialogReject", { metadata: N }), I(!1), E((e) => ({
|
|
63
64
|
...e,
|
|
64
65
|
visibility: !1
|
|
@@ -68,7 +69,7 @@ var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Head
|
|
|
68
69
|
T,
|
|
69
70
|
N,
|
|
70
71
|
E
|
|
71
|
-
]), H =
|
|
72
|
+
]), H = c(() => ({
|
|
72
73
|
onDialogAccept: {
|
|
73
74
|
action: "onDialogAccept",
|
|
74
75
|
title: "On Dialog Accept",
|
|
@@ -109,7 +110,7 @@ var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Head
|
|
|
109
110
|
} },
|
|
110
111
|
preview: { metadata: "" }
|
|
111
112
|
}
|
|
112
|
-
}), []), U =
|
|
113
|
+
}), []), U = c(() => ({
|
|
113
114
|
openDialog: {
|
|
114
115
|
action: "openDialog",
|
|
115
116
|
title: `Open ${O}`,
|
|
@@ -134,7 +135,7 @@ var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Head
|
|
|
134
135
|
L,
|
|
135
136
|
O
|
|
136
137
|
]);
|
|
137
|
-
|
|
138
|
+
s(() => {
|
|
138
139
|
k.visibility !== !1 && M.interactionTrigger(T, "onDialogOpen", { metadata: N });
|
|
139
140
|
}, [
|
|
140
141
|
T,
|
|
@@ -142,23 +143,14 @@ var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Head
|
|
|
142
143
|
N,
|
|
143
144
|
k.visibility
|
|
144
145
|
]);
|
|
145
|
-
let W =
|
|
146
|
-
let n = t.split(".");
|
|
147
|
-
return n.length > 1 ? [...e, {
|
|
148
|
-
path: t,
|
|
149
|
-
name: n.slice(n.length - 2).join(" ")
|
|
150
|
-
}] : [...e, {
|
|
151
|
-
path: t,
|
|
152
|
-
name: n[n.length - 1]
|
|
153
|
-
}];
|
|
154
|
-
}, []) : [], [N]);
|
|
146
|
+
let W = o(() => r(N), [N]);
|
|
155
147
|
_({
|
|
156
148
|
id: T,
|
|
157
149
|
source: A,
|
|
158
150
|
name: O || `Dialog - ${T}`,
|
|
159
151
|
fields: W
|
|
160
152
|
});
|
|
161
|
-
let G =
|
|
153
|
+
let G = c(() => A ? { runtime: { sources: { [A]: N } } } : f, [A, N]);
|
|
162
154
|
return /* @__PURE__ */ m(n, {
|
|
163
155
|
ref: e,
|
|
164
156
|
className: h("plitzi-component__dialog-container", v),
|
|
@@ -183,7 +175,7 @@ var v = ({ ref: e, className: v = "", children: y, headerLabel: b = "Dialog Head
|
|
|
183
175
|
}),
|
|
184
176
|
/* @__PURE__ */ p("div", {
|
|
185
177
|
className: h("dialog-container__body", D.body),
|
|
186
|
-
children: /* @__PURE__ */ p(
|
|
178
|
+
children: /* @__PURE__ */ p(d, {
|
|
187
179
|
inherit: "live",
|
|
188
180
|
name: `Dialog:${T}`,
|
|
189
181
|
value: G,
|