@genispace/geniapp 0.5.0 → 0.5.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/dist/MultiPageRenderer-DftFCAIJ.js +550 -0
- package/dist/MultiPageRenderer-DftFCAIJ.js.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/layout.js +1 -1
- package/dist/components/runtime/GeniAppWorkbench.d.ts +3 -1
- package/dist/components/runtime/MultiPageRenderer.d.ts +11 -0
- package/dist/components/runtime/PageRenderer.d.ts +9 -0
- package/dist/components/standalone.js +6948 -6924
- package/dist/components.js +314 -305
- package/dist/components.js.map +1 -1
- package/package.json +1 -1
- package/dist/MultiPageRenderer-B4G9Oswj.js +0 -535
- package/dist/MultiPageRenderer-B4G9Oswj.js.map +0 -1
|
@@ -0,0 +1,550 @@
|
|
|
1
|
+
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useState as C, useEffect as I, useCallback as R, useMemo as B, useRef as D, useSyncExternalStore as K, useLayoutEffect as X, memo as U } from "react";
|
|
3
|
+
import { useNavigate as Q } from "react-router-dom";
|
|
4
|
+
import { useTranslation as L } from "react-i18next";
|
|
5
|
+
import { ChevronLeft as J, Rocket as Z, Eye as ee } from "lucide-react";
|
|
6
|
+
import { a5 as z, a6 as te, a0 as V, W as O, E as G, a7 as re, a8 as ne, a9 as ae, d as oe, aa as F, L as le, w as ie, ab as se, ac as ce, ad as de, ae as ue, af as me, i as pe, ag as he, ah as y, ai as ge, aj as fe, ak as be, al as xe, am as we, an as ve } from "./components/renderers/runtime-DX1LfmqO.js";
|
|
7
|
+
function ye() {
|
|
8
|
+
const [e, n] = C(z());
|
|
9
|
+
return I(() => te(() => {
|
|
10
|
+
n(z());
|
|
11
|
+
}), []), e;
|
|
12
|
+
}
|
|
13
|
+
function j(e) {
|
|
14
|
+
return !!e && e.type === "grid-24";
|
|
15
|
+
}
|
|
16
|
+
const _e = {}, ke = ({
|
|
17
|
+
components: e,
|
|
18
|
+
appConfig: n,
|
|
19
|
+
layoutConfig: r,
|
|
20
|
+
pageParams: m,
|
|
21
|
+
pageId: l,
|
|
22
|
+
tabId: a,
|
|
23
|
+
renderComponent: c
|
|
24
|
+
}) => {
|
|
25
|
+
const d = V(), s = O(), f = G(), { previewOnly: v } = se(), { t: i } = L("workbench"), p = Q(), N = ye(), _ = s && N && !!n?.subPageBackButton, M = R(() => {
|
|
26
|
+
const o = re();
|
|
27
|
+
o && p(ne(o), { replace: !0 });
|
|
28
|
+
}, [p]), k = _ ? /* @__PURE__ */ u(
|
|
29
|
+
"button",
|
|
30
|
+
{
|
|
31
|
+
type: "button",
|
|
32
|
+
onClick: M,
|
|
33
|
+
"aria-label": i("mobile.back", "Back"),
|
|
34
|
+
className: "flex w-fit items-center gap-1 text-sm text-indigo-600",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ t(J, { className: "h-4 w-4" }),
|
|
37
|
+
i("mobile.back", "Back")
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"__subpage_back__"
|
|
41
|
+
) : null, S = _ && e[0]?.type === "FilterPanel" && !!e[0]?.props?.sticky, P = R((o, h, g = "") => c ? c(o, h, {
|
|
42
|
+
appConfig: n,
|
|
43
|
+
pageParams: m,
|
|
44
|
+
pageId: l,
|
|
45
|
+
tabId: a,
|
|
46
|
+
keyPrefix: g
|
|
47
|
+
}) : /* @__PURE__ */ t(
|
|
48
|
+
ae,
|
|
49
|
+
{
|
|
50
|
+
component: o,
|
|
51
|
+
appConfig: n,
|
|
52
|
+
pageParams: m,
|
|
53
|
+
pageId: l,
|
|
54
|
+
tabId: a,
|
|
55
|
+
nestingLevel: 0
|
|
56
|
+
},
|
|
57
|
+
`${g}${o.id || o.type}-${h}`
|
|
58
|
+
), [n, m, l, c, a]), H = (o) => ({
|
|
59
|
+
top: "top",
|
|
60
|
+
bottom: "bottom",
|
|
61
|
+
"bottom-left": "bottom-left",
|
|
62
|
+
"bottom-center": "bottom-center",
|
|
63
|
+
"bottom-right": "bottom-right",
|
|
64
|
+
"bottom-second": "bottom-second",
|
|
65
|
+
left: "left",
|
|
66
|
+
"left-top": "left-top",
|
|
67
|
+
"left-center": "left-center",
|
|
68
|
+
"left-bottom": "left-bottom",
|
|
69
|
+
right: "right",
|
|
70
|
+
"right-top": "right-top",
|
|
71
|
+
"right-bottom": "right-bottom",
|
|
72
|
+
header: "header",
|
|
73
|
+
"middle-left": "middle-left",
|
|
74
|
+
"middle-center": "middle-center",
|
|
75
|
+
"middle-right": "middle-right",
|
|
76
|
+
middle: "middle"
|
|
77
|
+
})[o] || o, $ = B(() => {
|
|
78
|
+
if (!r || j(r) || !r.componentPositions)
|
|
79
|
+
return null;
|
|
80
|
+
const o = r, h = {
|
|
81
|
+
top: [],
|
|
82
|
+
bottom: [],
|
|
83
|
+
"bottom-left": [],
|
|
84
|
+
"bottom-center": [],
|
|
85
|
+
"bottom-right": [],
|
|
86
|
+
"bottom-second": [],
|
|
87
|
+
left: [],
|
|
88
|
+
"left-top": [],
|
|
89
|
+
"left-center": [],
|
|
90
|
+
"left-bottom": [],
|
|
91
|
+
right: [],
|
|
92
|
+
"right-top": [],
|
|
93
|
+
"right-bottom": [],
|
|
94
|
+
header: [],
|
|
95
|
+
"middle-left": [],
|
|
96
|
+
"middle-center": [],
|
|
97
|
+
"middle-right": [],
|
|
98
|
+
middle: []
|
|
99
|
+
}, g = [];
|
|
100
|
+
return e.forEach((b) => {
|
|
101
|
+
const x = o.componentPositions?.[b.id];
|
|
102
|
+
if (x?.area) {
|
|
103
|
+
const w = H(x.area);
|
|
104
|
+
h[w] ? h[w].push({ component: b, order: x.order || 0 }) : g.push({ component: b, order: 0 });
|
|
105
|
+
} else
|
|
106
|
+
g.push({ component: b, order: 0 });
|
|
107
|
+
}), Object.keys(h).forEach((b) => {
|
|
108
|
+
h[b].sort((x, w) => x.order - w.order);
|
|
109
|
+
}), h.top.push(...g), h;
|
|
110
|
+
}, [e, r]), W = R((o, h = "") => /* @__PURE__ */ t(
|
|
111
|
+
"div",
|
|
112
|
+
{
|
|
113
|
+
className: "w-full h-full flex flex-col",
|
|
114
|
+
style: { gap: d ? "0.75rem" : "1rem" },
|
|
115
|
+
children: o.map((g, b) => {
|
|
116
|
+
const x = g.component || g, T = r.componentPositions?.[x.id]?.span || x.props?.span || 1, q = T > 1 ? { gridColumn: `span ${T}` } : {};
|
|
117
|
+
return /* @__PURE__ */ t(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
style: q,
|
|
121
|
+
className: "w-full flex-shrink-0",
|
|
122
|
+
children: P(x, b, h)
|
|
123
|
+
},
|
|
124
|
+
`${h}${x.id || x.type}-${b}`
|
|
125
|
+
);
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
), [P, r, d]);
|
|
129
|
+
if (!e || e.length === 0)
|
|
130
|
+
return /* @__PURE__ */ t("div", { className: "flex min-h-[240px] items-center justify-center py-16", children: /* @__PURE__ */ t("p", { className: "text-sm text-muted-foreground", children: i("page_empty_hint", "This page has no content yet.") }) });
|
|
131
|
+
if (j(r) || !r || r.componentPositions, r && j(r))
|
|
132
|
+
return /* @__PURE__ */ t("div", { className: F("h-full w-full min-h-0", f && "flex flex-1 flex-col"), children: /* @__PURE__ */ t(
|
|
133
|
+
oe,
|
|
134
|
+
{
|
|
135
|
+
config: r,
|
|
136
|
+
components: e,
|
|
137
|
+
nestingLevel: 0,
|
|
138
|
+
appConfig: n,
|
|
139
|
+
pageParams: m,
|
|
140
|
+
pageId: l,
|
|
141
|
+
tabId: a,
|
|
142
|
+
forceMobileFlow: v,
|
|
143
|
+
mobileFlowInsert: k
|
|
144
|
+
}
|
|
145
|
+
) });
|
|
146
|
+
if (r && $) {
|
|
147
|
+
let o = "all-vertical";
|
|
148
|
+
r.preset && Object.keys(le).includes(r.preset) ? o = r.preset : o = {
|
|
149
|
+
"all-vertical": "all-vertical",
|
|
150
|
+
"top1-bottom2": "top1-bottom2",
|
|
151
|
+
"top1-bottom2-equal": "top1-bottom2-equal",
|
|
152
|
+
"left1-right2": "left1-right2",
|
|
153
|
+
"top1-bottom3": "top1-bottom3"
|
|
154
|
+
}[r.preset] || "all-vertical";
|
|
155
|
+
const h = ie(o);
|
|
156
|
+
if (d) {
|
|
157
|
+
const g = h.flatMap(
|
|
158
|
+
(b) => $?.[b] || []
|
|
159
|
+
);
|
|
160
|
+
return /* @__PURE__ */ t("div", { className: "mobile-flow-layout flex w-full flex-col gap-3", children: g.map((b, x) => {
|
|
161
|
+
const w = b.component || b, T = w?.type === "FilterPanel" && !!w?.props?.sticky;
|
|
162
|
+
return /* @__PURE__ */ t(
|
|
163
|
+
"div",
|
|
164
|
+
{
|
|
165
|
+
className: T ? "contents" : "w-full",
|
|
166
|
+
children: P(w, x, "mobile-")
|
|
167
|
+
},
|
|
168
|
+
`mobile-${w.id || w.type}-${x}`
|
|
169
|
+
);
|
|
170
|
+
}) });
|
|
171
|
+
}
|
|
172
|
+
return /* @__PURE__ */ t("div", { className: `layout-grid layout-${o} h-full w-full`, children: h.map((g) => {
|
|
173
|
+
const b = $?.[g] || [];
|
|
174
|
+
return b.length === 0 ? null : /* @__PURE__ */ t(
|
|
175
|
+
"div",
|
|
176
|
+
{
|
|
177
|
+
className: `layout-area-${g} min-h-0 min-w-0`,
|
|
178
|
+
children: W(b, `${g}-`)
|
|
179
|
+
},
|
|
180
|
+
g
|
|
181
|
+
);
|
|
182
|
+
}) });
|
|
183
|
+
}
|
|
184
|
+
const E = [];
|
|
185
|
+
for (let o = 0; o < e.length; o++) {
|
|
186
|
+
const h = e[o], g = e[o + 1];
|
|
187
|
+
if (h?.type === "Title" && g?.type === "Paragraph") {
|
|
188
|
+
E.push(
|
|
189
|
+
/* @__PURE__ */ u(
|
|
190
|
+
"div",
|
|
191
|
+
{
|
|
192
|
+
className: "space-y-1",
|
|
193
|
+
children: [
|
|
194
|
+
P(h, o, "fallback-"),
|
|
195
|
+
P(g, o + 1, "fallback-")
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
`fallback-header-${h.id || h.type}-${o}`
|
|
199
|
+
)
|
|
200
|
+
), o++;
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
E.push(P(h, o, "fallback-"));
|
|
204
|
+
}
|
|
205
|
+
const Y = _ ? S ? [E[0], k, ...E.slice(1)] : [k, ...E] : E;
|
|
206
|
+
return /* @__PURE__ */ t("div", { className: d ? "mobile-flow-layout space-y-3 w-full" : "space-y-4 w-full", children: Y });
|
|
207
|
+
}, Ne = (e) => {
|
|
208
|
+
const n = [], r = (m) => {
|
|
209
|
+
for (const l of m) {
|
|
210
|
+
if (l.type === "Container" && l.children) {
|
|
211
|
+
r(l.children);
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
if (l.type === "Tabs" && l.props?.items) {
|
|
215
|
+
for (const c of l.props.items)
|
|
216
|
+
c.children && r(c.children), c.components && r(c.components);
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if (l.type === "Card" && l.props?.content) {
|
|
220
|
+
r([l.props.content]);
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
l.props?.followPageRefresh === !0 && n.push(l.id);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
return r(e), n;
|
|
227
|
+
}, Pe = ({
|
|
228
|
+
pageConfig: e,
|
|
229
|
+
pageId: n,
|
|
230
|
+
isActive: r
|
|
231
|
+
}) => {
|
|
232
|
+
const m = D(null), l = D([]), a = R(() => e?.components ? Ne(e.components) : [], [e?.components]), c = R(() => {
|
|
233
|
+
const d = Date.now(), s = l.current;
|
|
234
|
+
if (typeof window < "u") {
|
|
235
|
+
const f = new CustomEvent("page-auto-refresh-trigger", {
|
|
236
|
+
detail: {
|
|
237
|
+
timestamp: d,
|
|
238
|
+
pageId: n,
|
|
239
|
+
componentIds: s,
|
|
240
|
+
source: "page-auto-refresh"
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
window.dispatchEvent(f);
|
|
244
|
+
}
|
|
245
|
+
}, [n]);
|
|
246
|
+
I(() => {
|
|
247
|
+
const d = e?.autoRefresh;
|
|
248
|
+
if (!r || !d?.enabled) {
|
|
249
|
+
m.current && (clearInterval(m.current), m.current = null);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const s = a();
|
|
253
|
+
if (l.current = s, s.length === 0)
|
|
254
|
+
return;
|
|
255
|
+
const f = d.interval * 1e3;
|
|
256
|
+
return m.current = setInterval(() => {
|
|
257
|
+
c();
|
|
258
|
+
}, f), c(), () => {
|
|
259
|
+
m.current && (clearInterval(m.current), m.current = null);
|
|
260
|
+
};
|
|
261
|
+
}, [e?.autoRefresh?.enabled, e?.autoRefresh?.interval, r, a, c]), I(() => {
|
|
262
|
+
if (m.current && e?.autoRefresh?.enabled) {
|
|
263
|
+
const d = a();
|
|
264
|
+
l.current = d;
|
|
265
|
+
}
|
|
266
|
+
}, [e?.components, e?.autoRefresh?.enabled, a]);
|
|
267
|
+
}, Ee = "1rem";
|
|
268
|
+
function Me() {
|
|
269
|
+
return K(
|
|
270
|
+
ce,
|
|
271
|
+
de,
|
|
272
|
+
() => 0
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
function Re(e) {
|
|
276
|
+
for (let n = e?.parentElement ?? null; n; n = n.parentElement) {
|
|
277
|
+
const { overflowY: r } = getComputedStyle(n);
|
|
278
|
+
if (r === "auto" || r === "scroll") return n;
|
|
279
|
+
}
|
|
280
|
+
return null;
|
|
281
|
+
}
|
|
282
|
+
function Ie() {
|
|
283
|
+
const { t: e } = L("workbench"), { isEditMode: n } = me(), [r, m] = C(!1), l = D(null), [a, c] = C(null);
|
|
284
|
+
return I(() => {
|
|
285
|
+
m(!1);
|
|
286
|
+
}, [n]), X(() => {
|
|
287
|
+
if (r) return;
|
|
288
|
+
const d = Re(l.current), s = () => {
|
|
289
|
+
const f = d ? d.getBoundingClientRect() : { top: 0, bottom: window.innerHeight }, v = document.querySelector(".workbench-bottom-tab-nav"), i = v ? v.getBoundingClientRect().top : Number.POSITIVE_INFINITY;
|
|
290
|
+
c(Math.max(0, Math.round(Math.min(f.bottom, i) - f.top)));
|
|
291
|
+
};
|
|
292
|
+
if (s(), d && typeof ResizeObserver < "u") {
|
|
293
|
+
const f = new ResizeObserver(s);
|
|
294
|
+
return f.observe(d), window.addEventListener("resize", s), () => {
|
|
295
|
+
f.disconnect(), window.removeEventListener("resize", s);
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
return window.addEventListener("resize", s), () => window.removeEventListener("resize", s);
|
|
299
|
+
}, [n, r]), r ? null : (
|
|
300
|
+
// z-40 clears the sticky FilterPanel (z-30) which shares the tab wrapper's stacking context.
|
|
301
|
+
/* @__PURE__ */ t("div", { ref: l, className: "absolute inset-0 z-40 bg-white/70 backdrop-blur-md dark:bg-neutral-900/70", children: /* @__PURE__ */ u(
|
|
302
|
+
"div",
|
|
303
|
+
{
|
|
304
|
+
className: "sticky top-0 flex max-h-full flex-col items-center justify-center gap-4 px-6",
|
|
305
|
+
style: { height: a != null ? `${a}px` : "100dvh" },
|
|
306
|
+
children: [
|
|
307
|
+
/* @__PURE__ */ t("span", { className: "flex size-14 items-center justify-center rounded-full bg-indigo-50 text-indigo-500 dark:bg-indigo-950/40 dark:text-indigo-300", children: /* @__PURE__ */ t(Z, { className: "h-6 w-6", strokeWidth: 1.6, "aria-hidden": "true" }) }),
|
|
308
|
+
/* @__PURE__ */ u("div", { className: "flex select-none flex-col items-center gap-1 text-center", children: [
|
|
309
|
+
/* @__PURE__ */ t("span", { className: "text-lg font-semibold tracking-tight text-slate-800 dark:text-neutral-100", children: e("coming_soon.title", "Coming Soon") }),
|
|
310
|
+
/* @__PURE__ */ t("span", { className: "text-sm leading-snug text-slate-500 dark:text-neutral-400", children: e("coming_soon.description", "This page is under construction — stay tuned.") })
|
|
311
|
+
] }),
|
|
312
|
+
/* @__PURE__ */ u(
|
|
313
|
+
ue,
|
|
314
|
+
{
|
|
315
|
+
variant: "outline",
|
|
316
|
+
size: "sm",
|
|
317
|
+
onClick: () => m(!0),
|
|
318
|
+
className: "mt-1 h-8 gap-1.5 rounded-full bg-white/80 px-3.5 text-xs font-medium text-slate-600 shadow-sm hover:bg-white dark:bg-neutral-800/80 dark:text-neutral-300 dark:hover:bg-neutral-800",
|
|
319
|
+
children: [
|
|
320
|
+
/* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5", "aria-hidden": "true" }),
|
|
321
|
+
e("coming_soon.preview", "Preview page")
|
|
322
|
+
]
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
]
|
|
326
|
+
}
|
|
327
|
+
) })
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
const Te = () => null, A = U(({ tab: e, appConfig: n, availableParameters: r, isEmpty: m, isTabActive: l = !0, renderPage: a }) => {
|
|
331
|
+
const { t: c } = L(["workbench", "common"]), d = e.pageConfig, s = fe(e.pageId, d) ?? d, f = V(), v = O(), i = G(), p = be(
|
|
332
|
+
`page-${e.pageId}`,
|
|
333
|
+
s.customStyles,
|
|
334
|
+
""
|
|
335
|
+
);
|
|
336
|
+
return /* @__PURE__ */ u(xe, { value: l, children: [
|
|
337
|
+
/* @__PURE__ */ t(
|
|
338
|
+
"div",
|
|
339
|
+
{
|
|
340
|
+
className: F(
|
|
341
|
+
"h-full w-full min-h-0 bg-neutral-50 dark:bg-neutral-900",
|
|
342
|
+
p.className,
|
|
343
|
+
i ? "flex flex-col overflow-hidden" : f ? "overflow-y-auto overflow-x-hidden overscroll-none mobile-no-scrollbar" : "overflow-auto custom-scrollbar pt-4"
|
|
344
|
+
),
|
|
345
|
+
style: p.style,
|
|
346
|
+
children: /* @__PURE__ */ u(
|
|
347
|
+
"div",
|
|
348
|
+
{
|
|
349
|
+
className: F(
|
|
350
|
+
i ? "flex min-h-0 flex-1 flex-col p-3 sm:p-4 md:p-5" : f ? "px-2 pt-2" : "px-4 pb-4"
|
|
351
|
+
),
|
|
352
|
+
style: !i && v ? { paddingBottom: Ee } : void 0,
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ u(
|
|
355
|
+
we,
|
|
356
|
+
{
|
|
357
|
+
tabId: e.id,
|
|
358
|
+
pageId: e.pageId,
|
|
359
|
+
initialParams: e.urlParams || {},
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ t(Te, {}),
|
|
362
|
+
/* @__PURE__ */ t(
|
|
363
|
+
ve,
|
|
364
|
+
{
|
|
365
|
+
pageConfig: s,
|
|
366
|
+
pageId: e.pageId,
|
|
367
|
+
tabId: e.id,
|
|
368
|
+
isTabActive: l,
|
|
369
|
+
availableParameters: r,
|
|
370
|
+
children: m ? /* @__PURE__ */ t("div", { className: "flex items-center justify-center min-h-[60vh]", children: /* @__PURE__ */ u("div", { className: "text-center max-w-md mx-auto", children: [
|
|
371
|
+
/* @__PURE__ */ t("div", { className: "inline-flex items-center justify-center p-4 bg-primary/10 rounded-full mb-4", children: y("layout-grid", "w-12 h-12 text-primary") }),
|
|
372
|
+
/* @__PURE__ */ t("h3", { className: "text-xl font-semibold text-neutral-900 dark:text-neutral-100 mb-2", children: c("multi_page_renderer.start_building", "Start Building Your Page") }),
|
|
373
|
+
/* @__PURE__ */ t("p", { className: "text-neutral-500 dark:text-neutral-400 mb-6", children: c("multi_page_renderer.start_building_description", "Drag components from the component library on the right to here to start building your page") }),
|
|
374
|
+
/* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-2 text-sm text-neutral-400 dark:text-neutral-500", children: [
|
|
375
|
+
y("arrow-right", "w-4 h-4"),
|
|
376
|
+
/* @__PURE__ */ t("span", { children: c("multi_page_renderer.drag_component_hint", "Drag components here") })
|
|
377
|
+
] })
|
|
378
|
+
] }) }) : a ? a({
|
|
379
|
+
pageId: e.pageId,
|
|
380
|
+
tabId: e.id,
|
|
381
|
+
pageConfig: s,
|
|
382
|
+
appConfig: n,
|
|
383
|
+
pageParams: e.urlParams || {}
|
|
384
|
+
}) : /* @__PURE__ */ t(
|
|
385
|
+
ke,
|
|
386
|
+
{
|
|
387
|
+
components: s.components || [],
|
|
388
|
+
appConfig: n,
|
|
389
|
+
layoutConfig: s.layout,
|
|
390
|
+
pageParams: e.urlParams,
|
|
391
|
+
pageId: e.pageId,
|
|
392
|
+
tabId: e.id
|
|
393
|
+
},
|
|
394
|
+
`layout-${e.id}`
|
|
395
|
+
)
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
n?.showPublishHistory && n?.publishHistoryPageKey && e.pageId !== n.publishHistoryPageKey && /* @__PURE__ */ t("div", { className: "mt-8 flex justify-center pb-2", children: /* @__PURE__ */ t(
|
|
402
|
+
"button",
|
|
403
|
+
{
|
|
404
|
+
type: "button",
|
|
405
|
+
className: "text-xs text-neutral-400 transition-colors hover:text-neutral-500 dark:text-neutral-600 dark:hover:text-neutral-500",
|
|
406
|
+
onClick: () => window.dispatchEvent(
|
|
407
|
+
new CustomEvent("workbench-open-tab", {
|
|
408
|
+
detail: {
|
|
409
|
+
pageId: n.publishHistoryPageKey,
|
|
410
|
+
navigationTitle: c("publish_history_nav", "Publish History"),
|
|
411
|
+
icon: "history",
|
|
412
|
+
urlParams: {}
|
|
413
|
+
}
|
|
414
|
+
})
|
|
415
|
+
),
|
|
416
|
+
children: c("view_publish_history", "View publish history")
|
|
417
|
+
}
|
|
418
|
+
) })
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
)
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
s?.comingSoon?.enabled && /* @__PURE__ */ t(Ie, {})
|
|
425
|
+
] });
|
|
426
|
+
});
|
|
427
|
+
A.displayName = "TabContent";
|
|
428
|
+
const De = ({
|
|
429
|
+
tabs: e,
|
|
430
|
+
activeTabId: n,
|
|
431
|
+
appConfig: r,
|
|
432
|
+
availableParameters: m = [],
|
|
433
|
+
renderPage: l
|
|
434
|
+
}) => {
|
|
435
|
+
const { t: a } = L(["workbench", "common"]), c = O(), d = Me(), s = B(() => {
|
|
436
|
+
if (e.length === 0) return null;
|
|
437
|
+
if (n && e.some((p) => p.id === n)) return n;
|
|
438
|
+
const i = e.find((p) => p.isActive);
|
|
439
|
+
return i ? i.id : e.length === 1 ? e[0].id : e[0]?.id ?? null;
|
|
440
|
+
}, [e, n]), f = B(() => e.map((i) => {
|
|
441
|
+
const p = i.id === s, N = !!i.hasError, _ = !!i.isLoading, M = N && !_, k = !!i.pageConfig && !_ && !N;
|
|
442
|
+
return { tab: i, isActive: p, hasError: N, isLoading: _, showError: M, showContent: k };
|
|
443
|
+
}), [e, s]), v = B(() => f.find((p) => p.isActive && p.showContent)?.tab ?? null, [f]);
|
|
444
|
+
return Pe({
|
|
445
|
+
pageConfig: v?.pageConfig ?? {
|
|
446
|
+
layout: pe([]),
|
|
447
|
+
components: []
|
|
448
|
+
},
|
|
449
|
+
pageId: v?.pageId ?? "",
|
|
450
|
+
isActive: !!v
|
|
451
|
+
}), I(() => {
|
|
452
|
+
if (!c || d === 0)
|
|
453
|
+
return;
|
|
454
|
+
const i = window.setTimeout(he, 280);
|
|
455
|
+
return () => window.clearTimeout(i);
|
|
456
|
+
}, [c, s, d]), !s || e.length === 0 ? /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-full w-full p-8 bg-gradient-to-br from-slate-50 to-blue-50 dark:from-neutral-900 dark:to-neutral-800", children: /* @__PURE__ */ u("div", { className: "max-w-4xl mx-auto text-center", children: [
|
|
457
|
+
/* @__PURE__ */ u("div", { className: "mb-8", children: [
|
|
458
|
+
/* @__PURE__ */ t("div", { className: "inline-flex items-center justify-center p-3 bg-primary/10 rounded-full mb-6", children: y("layout-grid", "w-8 h-8 text-primary") }),
|
|
459
|
+
/* @__PURE__ */ t("h1", { className: "text-4xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-primary to-blue-600 mb-4", children: a("multi_page_renderer.welcome_title", "Welcome to Workbench") }),
|
|
460
|
+
/* @__PURE__ */ t("p", { className: "text-lg text-neutral-600 dark:text-neutral-300 max-w-2xl mx-auto leading-relaxed", children: a("multi_page_renderer.welcome_description", "Quickly build enterprise applications through drag-and-drop visual interface, supporting rich component library, data binding, custom styles and real-time preview, making it easy to develop professional applications") })
|
|
461
|
+
] }),
|
|
462
|
+
/* @__PURE__ */ u("div", { className: "grid md:grid-cols-3 gap-6 mb-10", children: [
|
|
463
|
+
/* @__PURE__ */ u("div", { className: "bg-white dark:bg-neutral-800 rounded-lg p-6 shadow-sm border border-neutral-200 dark:border-neutral-700 hover:shadow-md transition-shadow", children: [
|
|
464
|
+
/* @__PURE__ */ t("div", { className: "p-3 rounded-lg bg-blue-500/10 w-fit mx-auto mb-4", children: y("layout-panel-top", "w-8 h-8 text-blue-500") }),
|
|
465
|
+
/* @__PURE__ */ t("h3", { className: "text-lg font-semibold mb-2 text-neutral-900 dark:text-neutral-100", children: a("multi_page_renderer.feature_visual_drag", "Visual Drag & Drop") }),
|
|
466
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-neutral-600 dark:text-neutral-400", children: a("multi_page_renderer.feature_visual_drag_description", "30+ component types including forms, tables, charts, containers, supporting custom styles and interactions") })
|
|
467
|
+
] }),
|
|
468
|
+
/* @__PURE__ */ u("div", { className: "bg-white dark:bg-neutral-800 rounded-lg p-6 shadow-sm border border-neutral-200 dark:border-neutral-700 hover:shadow-md transition-shadow", children: [
|
|
469
|
+
/* @__PURE__ */ t("div", { className: "p-3 rounded-lg bg-purple-500/10 w-fit mx-auto mb-4", children: y("database", "w-8 h-8 text-purple-500") }),
|
|
470
|
+
/* @__PURE__ */ t("h3", { className: "text-lg font-semibold mb-2 text-neutral-900 dark:text-neutral-100", children: a("multi_page_renderer.feature_data_binding", "Smart Data Binding") }),
|
|
471
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-neutral-600 dark:text-neutral-400", children: a("multi_page_renderer.feature_data_binding_description", "Seamlessly connect enterprise data sources, supporting real-time data display and business logic configuration") })
|
|
472
|
+
] }),
|
|
473
|
+
/* @__PURE__ */ u("div", { className: "bg-white dark:bg-neutral-800 rounded-lg p-6 shadow-sm border border-neutral-200 dark:border-neutral-700 hover:shadow-md transition-shadow", children: [
|
|
474
|
+
/* @__PURE__ */ t("div", { className: "p-3 rounded-lg bg-emerald-500/10 w-fit mx-auto mb-4", children: y("sparkles", "w-8 h-8 text-emerald-500") }),
|
|
475
|
+
/* @__PURE__ */ t("h3", { className: "text-lg font-semibold mb-2 text-neutral-900 dark:text-neutral-100", children: a("multi_page_renderer.feature_component_communication", "Component Communication") }),
|
|
476
|
+
/* @__PURE__ */ t("p", { className: "text-sm text-neutral-600 dark:text-neutral-400", children: a("multi_page_renderer.feature_component_communication_description", "Support parameter passing and event triggering, building complex business processes and user interactions") })
|
|
477
|
+
] })
|
|
478
|
+
] }),
|
|
479
|
+
/* @__PURE__ */ u("div", { className: "bg-white dark:bg-neutral-800 rounded-lg p-8 shadow-sm border border-neutral-200 dark:border-neutral-700", children: [
|
|
480
|
+
/* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-2 mb-4", children: [
|
|
481
|
+
y("arrow-right", "w-5 h-5 text-primary"),
|
|
482
|
+
/* @__PURE__ */ t("h3", { className: "text-xl font-semibold text-neutral-900 dark:text-neutral-100", children: a("multi_page_renderer.start_creating_title", "Start Creating Your First Page") })
|
|
483
|
+
] }),
|
|
484
|
+
/* @__PURE__ */ t("p", { className: "text-neutral-600 dark:text-neutral-400 mb-6", children: a("multi_page_renderer.start_creating_description", "Click the navigation menu to open a page, or create a new page configuration through edit mode") }),
|
|
485
|
+
/* @__PURE__ */ u("div", { className: "flex items-center justify-center gap-4", children: [
|
|
486
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 px-4 py-2 bg-primary/10 rounded-lg", children: [
|
|
487
|
+
y("mouse-pointer-click", "w-4 h-4 text-primary"),
|
|
488
|
+
/* @__PURE__ */ t("span", { className: "text-sm font-medium text-primary", children: a("multi_page_renderer.select_page", "Select Page") })
|
|
489
|
+
] }),
|
|
490
|
+
/* @__PURE__ */ t("span", { className: "text-neutral-400", children: a("multi_page_renderer.or", "or") }),
|
|
491
|
+
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 px-4 py-2 bg-primary/10 rounded-lg", children: [
|
|
492
|
+
y("edit", "w-4 h-4 text-primary"),
|
|
493
|
+
/* @__PURE__ */ t("span", { className: "text-sm font-medium text-primary", children: a("multi_page_renderer.enable_edit_mode", "Enable Edit Mode") })
|
|
494
|
+
] })
|
|
495
|
+
] })
|
|
496
|
+
] })
|
|
497
|
+
] }) }) : /* @__PURE__ */ t("div", { className: "h-full w-full overflow-hidden relative", children: f.map(({ tab: i, isActive: p, hasError: N, isLoading: _, showError: M, showContent: k }) => {
|
|
498
|
+
const S = d === 0 ? 8 : d * 24;
|
|
499
|
+
return /* @__PURE__ */ u(
|
|
500
|
+
"div",
|
|
501
|
+
{
|
|
502
|
+
className: "absolute inset-0 h-full w-full",
|
|
503
|
+
style: {
|
|
504
|
+
opacity: p ? 1 : 0,
|
|
505
|
+
zIndex: p ? 10 : 0,
|
|
506
|
+
pointerEvents: p ? "auto" : "none",
|
|
507
|
+
transform: p ? "translateX(0)" : `translateX(${S}px)`,
|
|
508
|
+
transition: c ? "opacity 0.24s ease, transform 0.24s ease" : "opacity 0.2s ease-in-out, transform 0.2s ease-in-out",
|
|
509
|
+
willChange: p ? "opacity, transform" : "auto"
|
|
510
|
+
},
|
|
511
|
+
"aria-hidden": !p,
|
|
512
|
+
children: [
|
|
513
|
+
_ ? /* @__PURE__ */ t("div", { className: "h-full overflow-hidden p-4", children: /* @__PURE__ */ t(ge, { preset: "dashboard" }) }) : null,
|
|
514
|
+
M ? /* @__PURE__ */ t("div", { className: "flex items-center justify-center h-full pt-4", children: /* @__PURE__ */ u("div", { className: "text-center max-w-md mx-auto p-6", children: [
|
|
515
|
+
y("alert-circle", "w-16 h-16 text-status-error mx-auto mb-4"),
|
|
516
|
+
/* @__PURE__ */ t("h3", { className: "text-lg font-semibold text-neutral-900 dark:text-neutral-100 mb-2", children: a("multi_page_renderer.page_load_failed", "Page Load Failed") }),
|
|
517
|
+
/* @__PURE__ */ t("p", { className: "text-red-600 dark:text-red-400 mb-4", children: typeof i.errorMessage == "string" ? i.errorMessage : a("multi_page_renderer.unknown_error", "Unknown error") }),
|
|
518
|
+
/* @__PURE__ */ t(
|
|
519
|
+
"button",
|
|
520
|
+
{
|
|
521
|
+
onClick: () => {
|
|
522
|
+
window.location.reload();
|
|
523
|
+
},
|
|
524
|
+
className: "btn btn-primary",
|
|
525
|
+
children: a("multi_page_renderer.reload", "Reload")
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
] }) }) : null,
|
|
529
|
+
k && /* @__PURE__ */ t(
|
|
530
|
+
A,
|
|
531
|
+
{
|
|
532
|
+
tab: i,
|
|
533
|
+
appConfig: r,
|
|
534
|
+
availableParameters: m,
|
|
535
|
+
isEmpty: !i.pageConfig?.components?.length,
|
|
536
|
+
isTabActive: p,
|
|
537
|
+
renderPage: l
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
]
|
|
541
|
+
},
|
|
542
|
+
i.id
|
|
543
|
+
);
|
|
544
|
+
}) });
|
|
545
|
+
};
|
|
546
|
+
export {
|
|
547
|
+
De as M,
|
|
548
|
+
ke as P
|
|
549
|
+
};
|
|
550
|
+
//# sourceMappingURL=MultiPageRenderer-DftFCAIJ.js.map
|