@plitzi/sdk-elements 0.36.1 → 0.36.2
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 +14 -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/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/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/declarations/index.d.ts +3 -1
- 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/DialogContainer/DialogContainer.mjs +17 -25
- package/dist/elements/structure/ModalContainer/ModalContainer.mjs +15 -23
- package/dist/index.d.ts +3 -1
- package/package.json +38 -10
|
@@ -1,228 +1,210 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import l from "@plitzi/
|
|
7
|
-
import u from "@plitzi/plitzi-ui/
|
|
8
|
-
import d from "@plitzi/plitzi-ui/
|
|
9
|
-
import f from "@plitzi/plitzi-ui/
|
|
10
|
-
import p from "@plitzi/plitzi-ui/
|
|
11
|
-
import m from "@plitzi/plitzi-ui/
|
|
1
|
+
import e from "../LayoutPicker/index.mjs";
|
|
2
|
+
import { useCallback as t, useMemo as n } from "react";
|
|
3
|
+
import { useCommonStore as r } from "@plitzi/sdk-shared/store";
|
|
4
|
+
import { get as i, pick as a } from "@plitzi/plitzi-ui/helpers";
|
|
5
|
+
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
import { getPageFullPath as l } from "@plitzi/sdk-navigation/NavigationHelper";
|
|
7
|
+
import u from "@plitzi/plitzi-ui/Alert";
|
|
8
|
+
import d from "@plitzi/plitzi-ui/Checkbox";
|
|
9
|
+
import f from "@plitzi/plitzi-ui/Input";
|
|
10
|
+
import p from "@plitzi/plitzi-ui/TextArea";
|
|
11
|
+
import m from "@plitzi/plitzi-ui/Select";
|
|
12
|
+
import h from "@plitzi/plitzi-ui/Select2";
|
|
12
13
|
//#region src/elements/internal/Page/Settings.tsx
|
|
13
|
-
var
|
|
14
|
-
let [[
|
|
14
|
+
var g = ({ id: g = "", seoEnabled: _ = !1, enabled: v = !0, name: y = "", folder: b = "", seoPageTitle: x = "Title", seoPageDescription: S = "Description", slug: C = "", layout: w = "", layoutContainer: T = "", accessLevel: E = "", unauthorizedBehaviour: D = "", unauthorizedPageRedirect: O = "", onUpdate: k }) => {
|
|
15
|
+
let [[A, j, M]] = r([
|
|
15
16
|
"schema.flat",
|
|
16
17
|
"schema.pages",
|
|
17
18
|
"schema.pageFolders"
|
|
18
|
-
]),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
]),
|
|
23
|
-
|
|
24
|
-
let t =
|
|
25
|
-
(!
|
|
19
|
+
]), N = n(() => Object.values(a(A, j.filter((e) => e !== g))), [
|
|
20
|
+
A,
|
|
21
|
+
g,
|
|
22
|
+
j
|
|
23
|
+
]), P = t((e) => (t) => k?.(e, t), [k]), F = t((e) => {
|
|
24
|
+
k?.("name", e);
|
|
25
|
+
let t = y.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9]+)/gi, "");
|
|
26
|
+
(!C || C === t) && k?.("slug", e.replaceAll(" ", "-").toLowerCase().replaceAll(/([^a-z0-9-]+)/gi, ""));
|
|
26
27
|
}, [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
]),
|
|
28
|
+
k,
|
|
29
|
+
C,
|
|
30
|
+
y
|
|
31
|
+
]), I = t((e) => {
|
|
31
32
|
if (/^[a-zA-Z0-9:*/_-]+$/gim.test(e) || !e) {
|
|
32
33
|
let t = e.replaceAll("//", "/");
|
|
33
|
-
|
|
34
|
+
k?.("slug", t);
|
|
34
35
|
}
|
|
35
|
-
}, [
|
|
36
|
-
|
|
37
|
-
}, [
|
|
38
|
-
O?.("accessLevel", e), O?.("unauthorizedBehaviour", ""), O?.("unauthorizedPageRedirect", "");
|
|
39
|
-
}, [O]), B = e((e) => O?.("seoEnabled", e.target.checked), [O]), V = e((e) => O?.("enabled", e.target.checked), [O]), H = e((e) => O?.("folder", e?.value ?? ""), [O]), U = t(() => [{
|
|
36
|
+
}, [k]), L = t((e) => {
|
|
37
|
+
k?.("accessLevel", e), k?.("unauthorizedBehaviour", ""), k?.("unauthorizedPageRedirect", "");
|
|
38
|
+
}, [k]), R = t((e) => k?.("seoEnabled", e.target.checked), [k]), z = t((e) => k?.("enabled", e.target.checked), [k]), B = t((e) => k?.("folder", e?.value ?? ""), [k]), V = n(() => [{
|
|
40
39
|
value: "",
|
|
41
40
|
label: "None"
|
|
42
|
-
}, ...
|
|
41
|
+
}, ...M.map(({ id: e, name: t }) => ({
|
|
43
42
|
value: e,
|
|
44
43
|
label: t
|
|
45
|
-
}))], [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
}))], [M]), H = n(() => l(A, M, g, !0), [
|
|
45
|
+
A,
|
|
46
|
+
M,
|
|
47
|
+
g
|
|
49
48
|
]);
|
|
50
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ c("div", {
|
|
51
50
|
className: "flex flex-col gap-4 py-2",
|
|
52
51
|
children: [
|
|
53
|
-
!
|
|
52
|
+
!v && /* @__PURE__ */ s(u, {
|
|
54
53
|
intent: "info",
|
|
55
54
|
size: "xs",
|
|
56
55
|
solid: !1,
|
|
57
|
-
children: /* @__PURE__ */
|
|
56
|
+
children: /* @__PURE__ */ s("span", {
|
|
58
57
|
className: "text-xs",
|
|
59
58
|
children: "When this option is disable, this page wont be accesible"
|
|
60
59
|
})
|
|
61
60
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ s(d, {
|
|
63
62
|
label: " Page Enabled",
|
|
64
|
-
checked:
|
|
65
|
-
onChange:
|
|
63
|
+
checked: v,
|
|
64
|
+
onChange: z,
|
|
66
65
|
size: "xs"
|
|
67
66
|
}),
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
value:
|
|
67
|
+
/* @__PURE__ */ s(f, {
|
|
68
|
+
value: y,
|
|
70
69
|
label: "Page Name",
|
|
71
|
-
onChange:
|
|
70
|
+
onChange: F,
|
|
72
71
|
size: "xs"
|
|
73
72
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
73
|
+
/* @__PURE__ */ s(u, {
|
|
75
74
|
intent: "info",
|
|
76
75
|
size: "xs",
|
|
77
76
|
solid: !1,
|
|
78
|
-
children: /* @__PURE__ */
|
|
77
|
+
children: /* @__PURE__ */ s("span", {
|
|
79
78
|
className: "text-xs",
|
|
80
79
|
children: "Slug is a combination of letters, numbers and _ - : / *"
|
|
81
80
|
})
|
|
82
81
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ c("div", {
|
|
84
83
|
className: "flex flex-col",
|
|
85
|
-
children: [/* @__PURE__ */
|
|
86
|
-
value:
|
|
87
|
-
onChange:
|
|
84
|
+
children: [/* @__PURE__ */ s(f, {
|
|
85
|
+
value: C,
|
|
86
|
+
onChange: I,
|
|
88
87
|
label: "Slug / Path",
|
|
89
88
|
className: { inputContainer: "rounded-none rounded-tl rounded-tr" },
|
|
90
89
|
size: "xs"
|
|
91
|
-
}), /* @__PURE__ */
|
|
90
|
+
}), /* @__PURE__ */ c("div", {
|
|
92
91
|
className: "truncate rounded-b border-x border-b border-gray-200 px-1 py-0.5 text-xs",
|
|
93
|
-
title:
|
|
94
|
-
children: ["Full Path: ", /* @__PURE__ */
|
|
92
|
+
title: H,
|
|
93
|
+
children: ["Full Path: ", /* @__PURE__ */ s("span", {
|
|
95
94
|
className: "font-bold",
|
|
96
|
-
children:
|
|
95
|
+
children: H
|
|
97
96
|
})]
|
|
98
97
|
})]
|
|
99
98
|
}),
|
|
100
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ s(h, {
|
|
101
100
|
label: "Folder",
|
|
102
|
-
value:
|
|
103
|
-
options:
|
|
101
|
+
value: b,
|
|
102
|
+
options: V,
|
|
104
103
|
placeholder: "None",
|
|
105
|
-
onChange:
|
|
104
|
+
onChange: B,
|
|
106
105
|
size: "xs"
|
|
107
106
|
}),
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
onChange: R,
|
|
113
|
-
size: "xs",
|
|
114
|
-
children: M.map(({ id: e, definition: { label: t } }) => /* @__PURE__ */ o("option", {
|
|
115
|
-
value: e,
|
|
116
|
-
children: t
|
|
117
|
-
}, e))
|
|
118
|
-
}),
|
|
119
|
-
C && /* @__PURE__ */ o(p, {
|
|
120
|
-
value: w,
|
|
121
|
-
placeholder: "None",
|
|
122
|
-
label: "Layout Container Body",
|
|
123
|
-
onChange: F("layoutContainer"),
|
|
124
|
-
size: "xs",
|
|
125
|
-
children: N.map(({ id: e, definition: { label: t } }) => /* @__PURE__ */ o("option", {
|
|
126
|
-
value: e,
|
|
127
|
-
children: t
|
|
128
|
-
}, e))
|
|
107
|
+
/* @__PURE__ */ s(e, {
|
|
108
|
+
layout: w,
|
|
109
|
+
layoutContainer: T,
|
|
110
|
+
onUpdate: k
|
|
129
111
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
value:
|
|
112
|
+
/* @__PURE__ */ c(m, {
|
|
113
|
+
value: E,
|
|
132
114
|
label: "Restrict Access",
|
|
133
|
-
onChange:
|
|
115
|
+
onChange: L,
|
|
134
116
|
placeholder: "None",
|
|
135
117
|
size: "xs",
|
|
136
|
-
children: [/* @__PURE__ */
|
|
118
|
+
children: [/* @__PURE__ */ s("option", {
|
|
137
119
|
value: "public",
|
|
138
120
|
children: "Public"
|
|
139
|
-
}), /* @__PURE__ */
|
|
121
|
+
}), /* @__PURE__ */ s("option", {
|
|
140
122
|
value: "authenticated",
|
|
141
123
|
children: "Authenticated"
|
|
142
124
|
})]
|
|
143
125
|
}),
|
|
144
|
-
|
|
126
|
+
E === "" && /* @__PURE__ */ s(u, {
|
|
145
127
|
intent: "info",
|
|
146
128
|
solid: !1,
|
|
147
129
|
size: "xs",
|
|
148
|
-
children: /* @__PURE__ */
|
|
130
|
+
children: /* @__PURE__ */ s("span", {
|
|
149
131
|
className: "text-xs",
|
|
150
132
|
children: "Anyone on the internet can access this page"
|
|
151
133
|
})
|
|
152
134
|
}),
|
|
153
|
-
|
|
135
|
+
E === "public" && /* @__PURE__ */ s(u, {
|
|
154
136
|
intent: "info",
|
|
155
137
|
solid: !1,
|
|
156
138
|
size: "xs",
|
|
157
|
-
children: /* @__PURE__ */
|
|
139
|
+
children: /* @__PURE__ */ s("span", {
|
|
158
140
|
className: "text-xs",
|
|
159
141
|
children: "Only Guest can access this page"
|
|
160
142
|
})
|
|
161
143
|
}),
|
|
162
|
-
|
|
144
|
+
E !== "" && /* @__PURE__ */ s(m, {
|
|
163
145
|
label: "Unauthorized Behaviour",
|
|
164
|
-
value:
|
|
165
|
-
onChange:
|
|
146
|
+
value: D,
|
|
147
|
+
onChange: P("unauthorizedBehaviour"),
|
|
166
148
|
placeholder: "None",
|
|
167
149
|
size: "xs",
|
|
168
|
-
children: /* @__PURE__ */
|
|
150
|
+
children: /* @__PURE__ */ s("option", {
|
|
169
151
|
value: "redirect",
|
|
170
152
|
children: "Redirect"
|
|
171
153
|
})
|
|
172
154
|
}),
|
|
173
|
-
|
|
174
|
-
value:
|
|
155
|
+
D === "redirect" && /* @__PURE__ */ s(m, {
|
|
156
|
+
value: O,
|
|
175
157
|
label: "Redirect Page",
|
|
176
|
-
onChange:
|
|
158
|
+
onChange: P("unauthorizedPageRedirect"),
|
|
177
159
|
placeholder: "None",
|
|
178
160
|
size: "xs",
|
|
179
|
-
children:
|
|
161
|
+
children: N.map((e) => /* @__PURE__ */ s("option", {
|
|
180
162
|
value: e.id,
|
|
181
|
-
children:
|
|
163
|
+
children: i(e, "attributes.name")
|
|
182
164
|
}, e.id))
|
|
183
165
|
}),
|
|
184
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ s(d, {
|
|
185
167
|
label: " SEO Enabled",
|
|
186
|
-
checked:
|
|
187
|
-
onChange:
|
|
168
|
+
checked: _,
|
|
169
|
+
onChange: R,
|
|
188
170
|
size: "xs"
|
|
189
171
|
}),
|
|
190
|
-
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
value:
|
|
172
|
+
_ && /* @__PURE__ */ c(o, { children: [
|
|
173
|
+
/* @__PURE__ */ s(f, {
|
|
174
|
+
value: x,
|
|
193
175
|
label: "SEO Title",
|
|
194
|
-
onChange:
|
|
176
|
+
onChange: P("seoPageTitle"),
|
|
195
177
|
size: "xs"
|
|
196
178
|
}),
|
|
197
|
-
/* @__PURE__ */
|
|
179
|
+
/* @__PURE__ */ s(p, {
|
|
198
180
|
label: "SEO Description",
|
|
199
|
-
value:
|
|
200
|
-
onChange:
|
|
181
|
+
value: S,
|
|
182
|
+
onChange: P("seoPageDescription"),
|
|
201
183
|
rows: 3,
|
|
202
184
|
size: "xs"
|
|
203
185
|
}),
|
|
204
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ c("div", {
|
|
205
187
|
className: "flex flex-col",
|
|
206
188
|
children: [
|
|
207
|
-
/* @__PURE__ */
|
|
189
|
+
/* @__PURE__ */ s("p", {
|
|
208
190
|
className: "mb-4 text-xs",
|
|
209
191
|
children: "Specify this page's title and description. You can see how they'll look in search engine results pages (SERPs) in the preview below."
|
|
210
192
|
}),
|
|
211
|
-
/* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ s("label", { children: "Search Result Preview" }),
|
|
194
|
+
/* @__PURE__ */ c("div", {
|
|
213
195
|
className: "rounded border border-gray-300 px-2 py-1",
|
|
214
196
|
children: [
|
|
215
|
-
/* @__PURE__ */
|
|
197
|
+
/* @__PURE__ */ s("div", {
|
|
216
198
|
className: "mb-1 pt-1 text-xl text-[#1a0dab]",
|
|
217
|
-
children: /* @__PURE__ */
|
|
199
|
+
children: /* @__PURE__ */ s("label", { children: x })
|
|
218
200
|
}),
|
|
219
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ s("div", {
|
|
220
202
|
className: "text-sm text-[#006621]",
|
|
221
|
-
children: /* @__PURE__ */
|
|
203
|
+
children: /* @__PURE__ */ s("span", { children: "www.url.com" })
|
|
222
204
|
}),
|
|
223
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ s("div", {
|
|
224
206
|
className: "settings-seo__description mb-1 pt-1 text-sm",
|
|
225
|
-
children: `${
|
|
207
|
+
children: `${S.slice(0, 160)}...`
|
|
226
208
|
})
|
|
227
209
|
]
|
|
228
210
|
})
|
|
@@ -233,4 +215,4 @@ var h = ({ id: h = "", seoEnabled: g = !1, enabled: _ = !0, name: v = "", folder
|
|
|
233
215
|
});
|
|
234
216
|
};
|
|
235
217
|
//#endregion
|
|
236
|
-
export {
|
|
218
|
+
export { g as default };
|
|
@@ -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
|
};
|