@plitzi/sdk-elements 0.38.8 → 0.38.10
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 +157 -0
- package/dist/Component/ComponentHelper.mjs +22 -13
- package/dist/Element/hooks/useElementInternal.mjs +67 -59
- package/dist/elements/advanced/BlockHtml/index.mjs +3 -3
- package/dist/elements/advanced/BlockJsx/index.mjs +3 -3
- package/dist/elements/advanced/Custom/index.mjs +3 -3
- package/dist/elements/basic/Button/index.mjs +3 -3
- package/dist/elements/basic/Text/Settings.d.ts +2 -1
- package/dist/elements/basic/Text/Settings.mjs +16 -10
- package/dist/elements/basic/Text/Text.d.ts +3 -1
- package/dist/elements/basic/Text/Text.mjs +6 -5
- package/dist/elements/basic/Text/declaration.d.ts +1 -0
- package/dist/elements/basic/Text/index.d.ts +1 -0
- package/dist/elements/basic/ThemeToggle/ThemeToggle.mjs +13 -13
- package/dist/elements/declarations/index.d.ts +26 -17
- package/dist/elements/declarations/index.mjs +6 -6
- package/dist/elements/form/Form/Form.mjs +19 -19
- package/dist/elements/form/FormControl/FormControl.d.ts +1 -0
- package/dist/elements/form/FormControl/FormControl.mjs +10 -10
- package/dist/elements/form/FormControl/Settings.mjs +1 -1
- package/dist/elements/form/FormControl/declaration.d.ts +1 -1
- package/dist/elements/form/FormControl/declaration.mjs +3 -3
- package/dist/elements/form/FormControl/index.d.ts +1 -1
- package/dist/elements/internal/NotFound/index.mjs +3 -3
- package/dist/elements/internal/Page/Page.d.ts +5 -0
- package/dist/elements/internal/Page/Page.mjs +26 -25
- package/dist/elements/internal/Page/PageHead.d.ts +12 -0
- package/dist/elements/internal/Page/PageHead.mjs +29 -0
- package/dist/elements/internal/Page/declaration.d.ts +2 -0
- package/dist/elements/internal/Page/declaration.mjs +5 -0
- package/dist/elements/internal/Page/index.d.ts +2 -0
- package/dist/elements/provider/ApiContainer/ApiContainer.d.ts +7 -0
- package/dist/elements/provider/ApiContainer/ApiContainer.mjs +187 -187
- package/dist/elements/provider/ApiContainer/declaration.d.ts +11 -9
- package/dist/elements/provider/ApiContainer/declaration.mjs +2 -1
- package/dist/elements/provider/ApiContainer/index.d.ts +11 -9
- package/dist/elements/provider/Channel/Channel.mjs +15 -15
- package/dist/elements/provider/Channel/declaration.d.ts +1 -1
- package/dist/elements/provider/Channel/index.d.ts +1 -1
- package/dist/elements/structure/Carousel/Carousel.mjs +72 -72
- package/dist/elements/structure/Carousel/CarouselTrack/index.mjs +3 -3
- package/dist/elements/structure/Carousel/declaration.d.ts +1 -1
- package/dist/elements/structure/Carousel/index.d.ts +1 -1
- package/dist/elements/structure/Container/Container.mjs +8 -8
- package/dist/elements/structure/DialogContainer/DialogContainer.mjs +14 -14
- package/dist/elements/structure/DialogContainer/declaration.d.ts +1 -2
- package/dist/elements/structure/DialogContainer/declaration.mjs +1 -2
- package/dist/elements/structure/DialogContainer/index.d.ts +1 -2
- package/dist/elements/structure/List/List.d.ts +3 -1
- package/dist/elements/structure/List/List.mjs +3 -1
- package/dist/elements/structure/List/Settings.d.ts +2 -1
- package/dist/elements/structure/List/Settings.mjs +12 -5
- package/dist/elements/structure/List/declaration.d.ts +1 -0
- package/dist/elements/structure/List/index.d.ts +1 -0
- package/dist/elements/structure/List/modes/ListBasic.d.ts +3 -1
- package/dist/elements/structure/List/modes/ListBasic.mjs +2 -1
- package/dist/elements/structure/List/modes/ListControlled/ListControlled.d.ts +3 -1
- package/dist/elements/structure/List/modes/ListControlled/ListControlled.mjs +24 -23
- package/dist/elements/structure/ModalContainer/ModalContainer.mjs +16 -16
- package/dist/elements/structure/ModalContainer/declaration.d.ts +2 -3
- package/dist/elements/structure/ModalContainer/declaration.mjs +2 -3
- package/dist/elements/structure/ModalContainer/index.d.ts +2 -3
- package/dist/elements/structure/Pagination/Pagination.mjs +10 -10
- package/dist/index.d.ts +21 -17
- package/package.json +11 -7
|
@@ -1,235 +1,235 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "../../../Element/
|
|
3
|
-
import ee from "../../../Element/hooks/
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { isEmptyAnswer as
|
|
7
|
-
import { childrenWhile as
|
|
8
|
-
import
|
|
9
|
-
import { queryInputOf as
|
|
10
|
-
import { serverMock as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { use as
|
|
18
|
-
import
|
|
19
|
-
import { useCommonStore as
|
|
20
|
-
import { StoreProvider as
|
|
21
|
-
import { emptyObject as
|
|
22
|
-
import { jsx as
|
|
23
|
-
import { currentRscLocation as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import { QueryBuilderEvaluator as
|
|
28
|
-
import { useServerQuery as
|
|
1
|
+
import e from "./declaration.mjs";
|
|
2
|
+
import t from "../../../Element/hocs/withElement.mjs";
|
|
3
|
+
import ee from "../../../Element/hooks/useElement.mjs";
|
|
4
|
+
import te from "../../../Element/hooks/useRscData.mjs";
|
|
5
|
+
import { RootElement as ne } from "../../../Element/RootElement.mjs";
|
|
6
|
+
import { isEmptyAnswer as re } from "./helpers/isEmptyAnswer.mjs";
|
|
7
|
+
import { childrenWhile as ie } from "./helpers/loadingSlot.mjs";
|
|
8
|
+
import ae from "./helpers/providerOutcome.mjs";
|
|
9
|
+
import { queryInputOf as oe } from "./helpers/queryInput.mjs";
|
|
10
|
+
import { serverMock as se } from "./helpers/serverMock.mjs";
|
|
11
|
+
import ce from "./hooks/useApi.mjs";
|
|
12
|
+
import le from "./hooks/useAutoRefresh.mjs";
|
|
13
|
+
import ue from "./hooks/useInputRefresh.mjs";
|
|
14
|
+
import de from "./hooks/useProviderPagination.mjs";
|
|
15
|
+
import fe from "./hooks/useProviderWrite.mjs";
|
|
16
|
+
import pe from "../../../dataSource/pathFields.mjs";
|
|
17
|
+
import { use as me, useCallback as n, useEffect as he, useMemo as r, useRef as i } from "react";
|
|
18
|
+
import ge from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
19
|
+
import { useCommonStore as _e, useSdkStore as ve } from "@plitzi/sdk-shared/store";
|
|
20
|
+
import { StoreProvider as ye } from "@plitzi/nexus/react";
|
|
21
|
+
import { emptyObject as a } from "@plitzi/sdk-shared/helpers/utils";
|
|
22
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
23
|
+
import { currentRscLocation as be } from "@plitzi/sdk-shared/server/rsc/refreshRsc";
|
|
24
|
+
import xe from "clsx";
|
|
25
|
+
import Se from "@plitzi/sdk-shared/dataSource/helpers/getSourceName";
|
|
26
|
+
import Ce from "@plitzi/sdk-shared/dataSource/hooks/useRegisterSource";
|
|
27
|
+
import { QueryBuilderEvaluator as we } from "@plitzi/plitzi-ui/QueryBuilder";
|
|
28
|
+
import { useServerQuery as Te } from "@plitzi/sdk-shared/queries";
|
|
29
29
|
//#region src/elements/provider/ApiContainer/ApiContainer.tsx
|
|
30
|
-
var
|
|
31
|
-
let { id:
|
|
30
|
+
var s = ({ ref: t, className: s = "", children: c, query: l = "", method: u = "get", accessToken: d = "", when: f = a, headers: p = a, mockData: m = "{}", subType: Ee = "", credentials: De = "same-origin", singleRecord: h = !1, pagination: Oe = "none", pageParam: ke = "page", renderWhileLoading: Ae = !1, loadingSlot: g = "", cache: je = !1, staleTime: Me = 30, gcTime: Ne = 300, refreshSeconds: Pe = 0, connector: Fe = "", action: Ie = "", input: Le }) => {
|
|
31
|
+
let { id: _, visible: v, definition: { label: y = "Api Container", runtime: Re, items: ze } } = ee(), b = Re === "server", { loaded: x, stale: S, location: C, elementData: w, refreshing: Be, refresh: T, cancel: E } = te(), D = Se(e.sourceType, _), { settings: { previewMode: O }, contexts: { InteractionsContext: Ve } } = ge(), { interactionsManager: k } = me(Ve), [[A, j, He]] = ve([
|
|
32
32
|
"navigation.routeParams",
|
|
33
33
|
"navigation.queryParams",
|
|
34
34
|
"navigation.navigate"
|
|
35
|
-
]),
|
|
36
|
-
...
|
|
37
|
-
Authorization: `Bearer ${
|
|
38
|
-
} :
|
|
39
|
-
...
|
|
40
|
-
...
|
|
41
|
-
})) || !
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
]), Ue = r(() => d ? {
|
|
36
|
+
...p,
|
|
37
|
+
Authorization: `Bearer ${d}`
|
|
38
|
+
} : p, [p, d]), M = r(() => b || !v ? !1 : !!(O && l && (f === a || we(f, {
|
|
39
|
+
...A,
|
|
40
|
+
...j
|
|
41
|
+
})) || !O && (l || m && m !== "{}" && m !== a)), [
|
|
42
|
+
b,
|
|
43
|
+
v,
|
|
44
|
+
O,
|
|
45
|
+
l,
|
|
46
|
+
f,
|
|
47
|
+
A,
|
|
47
48
|
j,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
m
|
|
50
|
+
]), We = r(() => [_], [_]), { isLoading: Ge, isFetching: Ke, data: N, refetch: P, cancel: F, isSuccess: qe, isError: Je } = ce({
|
|
51
|
+
url: l,
|
|
52
|
+
method: u,
|
|
53
|
+
credentials: De,
|
|
54
|
+
mock: O ? void 0 : m,
|
|
55
|
+
customHeaders: Ue,
|
|
56
|
+
enabled: M,
|
|
57
|
+
cache: je,
|
|
58
|
+
staleTime: Me,
|
|
59
|
+
gcTime: Ne,
|
|
60
|
+
tags: We
|
|
61
|
+
}), I = b && !!C && C !== be(), L = b && x && !I && w === null, R = b && !Fe && !Ie, z = r(() => b ? w || (x ? a : se(m, R)) : N ?? a, [
|
|
62
|
+
b,
|
|
63
|
+
N,
|
|
64
|
+
w,
|
|
62
65
|
x,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
L
|
|
68
|
-
]), z = x ? F || ze : Ge, B = x ? F : We, V = a({}), Xe = r((e, t) => E(e, {
|
|
69
|
-
...V.current,
|
|
66
|
+
m,
|
|
67
|
+
R
|
|
68
|
+
]), B = b ? I || Be : Ke, V = b ? I : Ge, H = i({}), Ye = n((e, t) => T(e, {
|
|
69
|
+
...H.current,
|
|
70
70
|
...t
|
|
71
|
-
}), [
|
|
72
|
-
if (!
|
|
73
|
-
|
|
71
|
+
}), [T]), U = n(async (e) => {
|
|
72
|
+
if (!b) {
|
|
73
|
+
P();
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
await
|
|
76
|
+
await T([_], H.current, { fresh: e });
|
|
77
77
|
}, [
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
]),
|
|
83
|
-
|
|
84
|
-
id:
|
|
85
|
-
url:
|
|
86
|
-
enabled:
|
|
87
|
-
active:
|
|
88
|
-
refresh:
|
|
78
|
+
b,
|
|
79
|
+
P,
|
|
80
|
+
T,
|
|
81
|
+
_
|
|
82
|
+
]), W = n(() => U(!0), [U]), Xe = n(() => U(!1), [U]);
|
|
83
|
+
Te({
|
|
84
|
+
id: _,
|
|
85
|
+
url: R && l ? l : void 0,
|
|
86
|
+
enabled: b && x,
|
|
87
|
+
active: v,
|
|
88
|
+
refresh: W
|
|
89
89
|
});
|
|
90
|
-
let
|
|
91
|
-
let t =
|
|
92
|
-
t && (
|
|
93
|
-
}, [
|
|
94
|
-
if (
|
|
95
|
-
|
|
90
|
+
let G = n(async ({ input: e } = {}) => {
|
|
91
|
+
let t = oe(e);
|
|
92
|
+
t && (H.current = t), await W();
|
|
93
|
+
}, [W]), K = n(() => {
|
|
94
|
+
if (b) {
|
|
95
|
+
E();
|
|
96
96
|
return;
|
|
97
97
|
}
|
|
98
|
-
|
|
98
|
+
F();
|
|
99
99
|
}, [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
]), [
|
|
104
|
-
|
|
105
|
-
enabled:
|
|
106
|
-
input:
|
|
107
|
-
savedInput:
|
|
108
|
-
performQuery:
|
|
109
|
-
}),
|
|
110
|
-
seconds:
|
|
111
|
-
enabled:
|
|
112
|
-
refresh:
|
|
100
|
+
b,
|
|
101
|
+
E,
|
|
102
|
+
F
|
|
103
|
+
]), [Ze] = _e(`schema.flat.${_}.attributes.input`, { mode: "mount" });
|
|
104
|
+
ue({
|
|
105
|
+
enabled: b && x,
|
|
106
|
+
input: Le,
|
|
107
|
+
savedInput: Ze,
|
|
108
|
+
performQuery: G
|
|
109
|
+
}), le({
|
|
110
|
+
seconds: Pe,
|
|
111
|
+
enabled: v && (b ? x && !I : M),
|
|
112
|
+
refresh: Xe
|
|
113
113
|
});
|
|
114
|
-
let
|
|
115
|
-
elementId:
|
|
116
|
-
mode:
|
|
117
|
-
pageParam:
|
|
118
|
-
records:
|
|
119
|
-
page:
|
|
120
|
-
refresh:
|
|
121
|
-
navigate:
|
|
122
|
-
}), X =
|
|
123
|
-
serverMode:
|
|
124
|
-
isSuccess:
|
|
125
|
-
isError:
|
|
126
|
-
rscResolved:
|
|
127
|
-
rscPending:
|
|
128
|
-
elementData:
|
|
129
|
-
}), Z =
|
|
130
|
-
|
|
131
|
-
!
|
|
132
|
-
data:
|
|
114
|
+
let q = z, Qe = r(() => Array.isArray(q.records) ? q.records : [], [q.records]), { records: J, isLoadingMore: Y, goToPage: $e, loadMore: et } = de({
|
|
115
|
+
elementId: _,
|
|
116
|
+
mode: Oe,
|
|
117
|
+
pageParam: ke,
|
|
118
|
+
records: Qe,
|
|
119
|
+
page: q.pageInfo?.page ?? 1,
|
|
120
|
+
refresh: Ye,
|
|
121
|
+
navigate: He
|
|
122
|
+
}), X = ae({
|
|
123
|
+
serverMode: b,
|
|
124
|
+
isSuccess: qe,
|
|
125
|
+
isError: Je,
|
|
126
|
+
rscResolved: x,
|
|
127
|
+
rscPending: I,
|
|
128
|
+
elementData: w
|
|
129
|
+
}), Z = i(void 0);
|
|
130
|
+
he(() => {
|
|
131
|
+
!B && _ && X && (Z.current?.data !== z || Z.current.outcome !== X) && (Z.current = {
|
|
132
|
+
data: z,
|
|
133
133
|
outcome: X
|
|
134
|
-
},
|
|
135
|
-
url:
|
|
136
|
-
method:
|
|
137
|
-
...
|
|
134
|
+
}, k.interactionTrigger(_, X === "success" ? "onApiSuccess" : "onApiError", {
|
|
135
|
+
url: l,
|
|
136
|
+
method: u,
|
|
137
|
+
...z
|
|
138
138
|
}));
|
|
139
139
|
}, [
|
|
140
|
-
R,
|
|
141
|
-
v,
|
|
142
|
-
A,
|
|
143
140
|
z,
|
|
144
|
-
|
|
141
|
+
_,
|
|
142
|
+
k,
|
|
143
|
+
B,
|
|
144
|
+
u,
|
|
145
145
|
X,
|
|
146
|
-
|
|
146
|
+
l
|
|
147
147
|
]);
|
|
148
|
-
let Q =
|
|
149
|
-
...
|
|
150
|
-
...Array.isArray(
|
|
151
|
-
isLoading:
|
|
152
|
-
isEmpty:
|
|
153
|
-
hasError:
|
|
154
|
-
errorMessage:
|
|
155
|
-
isStale:
|
|
148
|
+
let Q = r(() => ({
|
|
149
|
+
...z,
|
|
150
|
+
...Array.isArray(q.records) ? { records: J } : a,
|
|
151
|
+
isLoading: B || Y,
|
|
152
|
+
isEmpty: re(q, J, h),
|
|
153
|
+
hasError: L,
|
|
154
|
+
errorMessage: L ? "The data provider could not be reached" : "",
|
|
155
|
+
isStale: b && S
|
|
156
156
|
}), [
|
|
157
|
-
R,
|
|
158
|
-
K.records,
|
|
159
|
-
K.record,
|
|
160
|
-
q,
|
|
161
157
|
z,
|
|
158
|
+
q.records,
|
|
159
|
+
q.record,
|
|
162
160
|
J,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
161
|
+
B,
|
|
162
|
+
Y,
|
|
163
|
+
h,
|
|
164
|
+
L,
|
|
165
|
+
b,
|
|
166
|
+
S
|
|
167
|
+
]), tt = n(() => pe(Q), [Q]);
|
|
168
|
+
Ce({
|
|
169
|
+
id: _,
|
|
170
|
+
source: D,
|
|
171
|
+
name: y || `API - ${_}`,
|
|
172
172
|
fields: tt
|
|
173
173
|
});
|
|
174
|
-
let { writeRecord: $ } =
|
|
175
|
-
elementId:
|
|
176
|
-
enabled:
|
|
177
|
-
onDone:
|
|
178
|
-
}), nt =
|
|
179
|
-
let
|
|
174
|
+
let { writeRecord: $ } = fe({
|
|
175
|
+
elementId: _,
|
|
176
|
+
enabled: b,
|
|
177
|
+
onDone: W
|
|
178
|
+
}), nt = r(() => {
|
|
179
|
+
let t = {
|
|
180
180
|
performQuery: {
|
|
181
|
-
...
|
|
182
|
-
title: `Perform Query ${
|
|
183
|
-
callback:
|
|
181
|
+
...e.callbacks.performQuery,
|
|
182
|
+
title: `Perform Query ${y}`,
|
|
183
|
+
callback: G
|
|
184
184
|
},
|
|
185
185
|
cancelQuery: {
|
|
186
|
-
...
|
|
187
|
-
title: `Cancel Query ${
|
|
188
|
-
callback:
|
|
186
|
+
...e.callbacks.cancelQuery,
|
|
187
|
+
title: `Cancel Query ${y}`,
|
|
188
|
+
callback: K
|
|
189
189
|
},
|
|
190
190
|
loadMore: {
|
|
191
|
-
...
|
|
192
|
-
title: `Load More ${
|
|
191
|
+
...e.callbacks.loadMore,
|
|
192
|
+
title: `Load More ${y}`,
|
|
193
193
|
callback: et
|
|
194
194
|
},
|
|
195
195
|
goToPage: {
|
|
196
|
-
...
|
|
197
|
-
title: `Go To Page ${
|
|
198
|
-
callback: ({ page: e }) =>
|
|
196
|
+
...e.callbacks.goToPage,
|
|
197
|
+
title: `Go To Page ${y}`,
|
|
198
|
+
callback: ({ page: e }) => $e(Number(e) || 1)
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
return
|
|
202
|
-
...
|
|
203
|
-
title: `Write Record ${
|
|
201
|
+
return b && (t.writeRecord = {
|
|
202
|
+
...e.callbacks.writeRecord,
|
|
203
|
+
title: `Write Record ${y}`,
|
|
204
204
|
callback: $
|
|
205
|
-
}),
|
|
205
|
+
}), t;
|
|
206
206
|
}, [
|
|
207
|
-
|
|
208
|
-
W,
|
|
207
|
+
y,
|
|
209
208
|
G,
|
|
209
|
+
K,
|
|
210
210
|
et,
|
|
211
|
-
|
|
212
|
-
|
|
211
|
+
$e,
|
|
212
|
+
b,
|
|
213
213
|
$
|
|
214
|
-
]), rt =
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
]), it =
|
|
220
|
-
return /* @__PURE__ */
|
|
221
|
-
ref:
|
|
222
|
-
tag: !
|
|
223
|
-
className:
|
|
224
|
-
interactionTriggers:
|
|
214
|
+
]), rt = r(() => g && O ? ie(c, g, V) : c, [
|
|
215
|
+
c,
|
|
216
|
+
V,
|
|
217
|
+
g,
|
|
218
|
+
O
|
|
219
|
+
]), it = r(() => D ? { runtime: { sources: { [D]: Q } } } : a, [Q, D]);
|
|
220
|
+
return /* @__PURE__ */ o(ne, {
|
|
221
|
+
ref: t,
|
|
222
|
+
tag: !O && !ze?.length ? "div" : Ee,
|
|
223
|
+
className: xe("plitzi-component__api-container", s),
|
|
224
|
+
interactionTriggers: e.triggers,
|
|
225
225
|
interactionCallbacks: nt,
|
|
226
|
-
children: (!
|
|
226
|
+
children: (!V || Ae || g) && /* @__PURE__ */ o(ye, {
|
|
227
227
|
inherit: "live",
|
|
228
|
-
name: `Api:${
|
|
228
|
+
name: `Api:${_}`,
|
|
229
229
|
value: it,
|
|
230
230
|
children: rt
|
|
231
231
|
})
|
|
232
232
|
});
|
|
233
|
-
},
|
|
233
|
+
}, c = t(s);
|
|
234
234
|
//#endregion
|
|
235
|
-
export {
|
|
235
|
+
export { s as ApiContainer, c as default };
|
|
@@ -11,6 +11,7 @@ declare const declaration: {
|
|
|
11
11
|
readonly pagination: readonly string[];
|
|
12
12
|
};
|
|
13
13
|
readonly sourceType: "apiContainer";
|
|
14
|
+
readonly serverTemplates: readonly ["notFound"];
|
|
14
15
|
readonly triggers: {
|
|
15
16
|
readonly onApiError: {
|
|
16
17
|
readonly action: "onApiError";
|
|
@@ -172,25 +173,26 @@ declare const declaration: {
|
|
|
172
173
|
method?: "get" | "post" | "put" | "delete" | "patch" | undefined;
|
|
173
174
|
resource?: string | undefined;
|
|
174
175
|
headers?: Record<string, string> | undefined;
|
|
176
|
+
notFound?: string | undefined;
|
|
175
177
|
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "" | undefined;
|
|
178
|
+
credentials?: RequestCredentials | undefined;
|
|
179
|
+
staleTime?: number | string | undefined;
|
|
180
|
+
gcTime?: number | string | undefined;
|
|
181
|
+
pageParam?: string | undefined;
|
|
176
182
|
query?: string | undefined;
|
|
177
183
|
accessToken?: string | undefined;
|
|
178
184
|
mockData?: (Record<string, unknown> | string) | undefined;
|
|
179
|
-
|
|
185
|
+
singleRecord?: boolean | undefined;
|
|
186
|
+
pagination?: import('./hooks/useProviderPagination').ProviderPagination | undefined;
|
|
187
|
+
renderWhileLoading?: boolean | undefined;
|
|
188
|
+
loadingSlot?: string | undefined;
|
|
189
|
+
refreshSeconds?: number | string | undefined;
|
|
180
190
|
connector?: string | undefined;
|
|
181
191
|
limit?: string | undefined;
|
|
182
|
-
singleRecord?: boolean | undefined;
|
|
183
192
|
filters?: {
|
|
184
193
|
field: string;
|
|
185
194
|
operator: string;
|
|
186
195
|
value: string;
|
|
187
196
|
}[] | undefined;
|
|
188
|
-
pagination?: import('./hooks/useProviderPagination').ProviderPagination | undefined;
|
|
189
|
-
pageParam?: string | undefined;
|
|
190
|
-
renderWhileLoading?: boolean | undefined;
|
|
191
|
-
loadingSlot?: string | undefined;
|
|
192
|
-
staleTime?: number | string | undefined;
|
|
193
|
-
gcTime?: number | string | undefined;
|
|
194
|
-
refreshSeconds?: number | string | undefined;
|
|
195
197
|
}>>;
|
|
196
198
|
export default declaration;
|
|
@@ -35,6 +35,7 @@ var n = e()({
|
|
|
35
35
|
])
|
|
36
36
|
},
|
|
37
37
|
sourceType: "apiContainer",
|
|
38
|
+
serverTemplates: ["notFound"],
|
|
38
39
|
triggers: {
|
|
39
40
|
onApiError: {
|
|
40
41
|
action: "onApiError",
|
|
@@ -141,7 +142,7 @@ var n = e()({
|
|
|
141
142
|
definition: {
|
|
142
143
|
label: "Api Container",
|
|
143
144
|
type: "apiContainer",
|
|
144
|
-
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, and `refreshSeconds` makes it ask again on its own every N seconds (either runtime; paused while the tab is hidden) — the way to keep a queue, feed or status board current without a plugin. 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.",
|
|
145
|
+
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, and `refreshSeconds` makes it ask again on its own every N seconds (either runtime; paused while the tab is hidden) — the way to keep a queue, feed or status board current without a plugin. A server provider (`runtime: \"server\"`) whose answer means the address shows nothing — a record not found — says so in `notFound`, a template against its answer (`{{ source.found == false }}`): the page is sent with status 404, rendered as written. 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.",
|
|
145
146
|
items: [],
|
|
146
147
|
bindings: {},
|
|
147
148
|
styleSelectors: { base: "" },
|
|
@@ -10,6 +10,7 @@ declare const ApiContainer: {
|
|
|
10
10
|
readonly pagination: readonly string[];
|
|
11
11
|
};
|
|
12
12
|
readonly sourceType: "apiContainer";
|
|
13
|
+
readonly serverTemplates: readonly ["notFound"];
|
|
13
14
|
readonly triggers: {
|
|
14
15
|
readonly onApiError: {
|
|
15
16
|
readonly action: "onApiError";
|
|
@@ -171,25 +172,26 @@ declare const ApiContainer: {
|
|
|
171
172
|
method?: "get" | "post" | "put" | "delete" | "patch" | undefined;
|
|
172
173
|
resource?: string | undefined;
|
|
173
174
|
headers?: Record<string, string> | undefined;
|
|
175
|
+
notFound?: string | undefined;
|
|
174
176
|
subType?: "div" | "header" | "footer" | "nav" | "main" | "section" | "article" | "aside" | "address" | "figure" | "" | undefined;
|
|
177
|
+
credentials?: RequestCredentials | undefined;
|
|
178
|
+
staleTime?: number | string | undefined;
|
|
179
|
+
gcTime?: number | string | undefined;
|
|
180
|
+
pageParam?: string | undefined;
|
|
175
181
|
query?: string | undefined;
|
|
176
182
|
accessToken?: string | undefined;
|
|
177
183
|
mockData?: (Record<string, unknown> | string) | undefined;
|
|
178
|
-
|
|
184
|
+
singleRecord?: boolean | undefined;
|
|
185
|
+
pagination?: import('./hooks/useProviderPagination').ProviderPagination | undefined;
|
|
186
|
+
renderWhileLoading?: boolean | undefined;
|
|
187
|
+
loadingSlot?: string | undefined;
|
|
188
|
+
refreshSeconds?: number | string | undefined;
|
|
179
189
|
connector?: string | undefined;
|
|
180
190
|
limit?: string | undefined;
|
|
181
|
-
singleRecord?: boolean | undefined;
|
|
182
191
|
filters?: {
|
|
183
192
|
field: string;
|
|
184
193
|
operator: string;
|
|
185
194
|
value: string;
|
|
186
195
|
}[] | undefined;
|
|
187
|
-
pagination?: import('./hooks/useProviderPagination').ProviderPagination | undefined;
|
|
188
|
-
pageParam?: string | undefined;
|
|
189
|
-
renderWhileLoading?: boolean | undefined;
|
|
190
|
-
loadingSlot?: string | undefined;
|
|
191
|
-
staleTime?: number | string | undefined;
|
|
192
|
-
gcTime?: number | string | undefined;
|
|
193
|
-
refreshSeconds?: number | string | undefined;
|
|
194
196
|
}>>;
|
|
195
197
|
export default ApiContainer;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import t from "../../../Element/
|
|
3
|
-
import
|
|
4
|
-
import r from "../../../
|
|
5
|
-
import i from "
|
|
1
|
+
import e from "./declaration.mjs";
|
|
2
|
+
import t from "../../../Element/hocs/withElement.mjs";
|
|
3
|
+
import n from "../../../Element/hooks/useElement.mjs";
|
|
4
|
+
import { RootElement as r } from "../../../Element/RootElement.mjs";
|
|
5
|
+
import i from "../../../dataSource/pathFields.mjs";
|
|
6
6
|
import a from "../../../realtime/useChannel.mjs";
|
|
7
7
|
import { use as o, useCallback as s, useMemo as c, useState as l } from "react";
|
|
8
8
|
import u from "@plitzi/sdk-shared/hooks/usePlitziServiceContext";
|
|
@@ -25,8 +25,8 @@ var b = (e) => {
|
|
|
25
25
|
y,
|
|
26
26
|
_,
|
|
27
27
|
v
|
|
28
|
-
]), S = ({ ref:
|
|
29
|
-
let { id: E, definition: { label: D = "Channel" } } =
|
|
28
|
+
]), S = ({ ref: t, className: _, children: v, topic: y = "", grant: S = "", presence: C, keep: w = 20, subType: T = "" }) => {
|
|
29
|
+
let { id: E, definition: { label: D = "Channel" } } = n(), { settings: { previewMode: O }, contexts: { InteractionsContext: k } } = u(), { interactionsManager: A } = o(k), j = Math.max(0, Number(w) || 0), [M, N] = l([]), P = s((e) => {
|
|
30
30
|
x.has(e.type) || (j > 0 && N((t) => [...t, e].slice(-j)), A.interactionTrigger(E, "onMessage", { ...e }));
|
|
31
31
|
}, [
|
|
32
32
|
E,
|
|
@@ -48,14 +48,14 @@ var b = (e) => {
|
|
|
48
48
|
onLeave: I
|
|
49
49
|
}), R = c(() => ({
|
|
50
50
|
publish: {
|
|
51
|
-
...
|
|
51
|
+
...e.callbacks.publish,
|
|
52
52
|
callback: ({ type: e, data: t }) => typeof e == "string" && e ? L.publish(e, b(t)) : Promise.resolve(!1)
|
|
53
53
|
},
|
|
54
54
|
setPresence: {
|
|
55
|
-
...
|
|
55
|
+
...e.callbacks.setPresence,
|
|
56
56
|
callback: ({ data: e }) => L.setPresence(b(e))
|
|
57
57
|
}
|
|
58
|
-
}), [L]), z = h(
|
|
58
|
+
}), [L]), z = h(e.sourceType, E), B = c(() => ({
|
|
59
59
|
connected: L.connected,
|
|
60
60
|
me: L.me ?? "",
|
|
61
61
|
members: L.members,
|
|
@@ -66,7 +66,7 @@ var b = (e) => {
|
|
|
66
66
|
L.me,
|
|
67
67
|
L.members,
|
|
68
68
|
M
|
|
69
|
-
]), V = s(() =>
|
|
69
|
+
]), V = s(() => i(B), [B]);
|
|
70
70
|
g({
|
|
71
71
|
id: E,
|
|
72
72
|
source: z,
|
|
@@ -74,11 +74,11 @@ var b = (e) => {
|
|
|
74
74
|
fields: V
|
|
75
75
|
});
|
|
76
76
|
let H = c(() => z ? { runtime: { sources: { [z]: B } } } : f, [B, z]);
|
|
77
|
-
return /* @__PURE__ */ p(
|
|
78
|
-
ref:
|
|
77
|
+
return /* @__PURE__ */ p(r, {
|
|
78
|
+
ref: t,
|
|
79
79
|
tag: T,
|
|
80
80
|
className: m("plitzi-component__channel", _),
|
|
81
|
-
interactionTriggers:
|
|
81
|
+
interactionTriggers: e.triggers,
|
|
82
82
|
interactionCallbacks: R,
|
|
83
83
|
children: /* @__PURE__ */ p(d, {
|
|
84
84
|
inherit: "live",
|
|
@@ -87,6 +87,6 @@ var b = (e) => {
|
|
|
87
87
|
children: v
|
|
88
88
|
})
|
|
89
89
|
});
|
|
90
|
-
}, C =
|
|
90
|
+
}, C = t(S);
|
|
91
91
|
//#endregion
|
|
92
92
|
export { S as Channel, C as default };
|
|
@@ -130,9 +130,9 @@ declare const declaration: {
|
|
|
130
130
|
};
|
|
131
131
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
132
132
|
subType?: "" | "div" | "section" | "aside" | "main" | undefined;
|
|
133
|
-
topic?: string | undefined;
|
|
134
133
|
grant?: string | undefined;
|
|
135
134
|
presence?: unknown;
|
|
135
|
+
topic?: string | undefined;
|
|
136
136
|
keep?: number | string | undefined;
|
|
137
137
|
}>>;
|
|
138
138
|
export default declaration;
|
|
@@ -129,9 +129,9 @@ declare const Channel: {
|
|
|
129
129
|
};
|
|
130
130
|
} & import('@plitzi/sdk-shared/authoring/declare').ElementAttributesBrand<Partial<{
|
|
131
131
|
subType?: "" | "div" | "section" | "aside" | "main" | undefined;
|
|
132
|
-
topic?: string | undefined;
|
|
133
132
|
grant?: string | undefined;
|
|
134
133
|
presence?: unknown;
|
|
134
|
+
topic?: string | undefined;
|
|
135
135
|
keep?: number | string | undefined;
|
|
136
136
|
}>>;
|
|
137
137
|
export default Channel;
|