@object-ui/plugin-designer 17.3.0 → 17.6.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 +548 -0
- package/README.md +1 -12
- package/dist/DashboardEditor.d.ts.map +1 -1
- package/dist/MetadataFieldsPage.d.ts.map +1 -1
- package/dist/hooks/useDesignerTranslation.d.ts +15 -0
- package/dist/hooks/useDesignerTranslation.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +521 -453
- package/dist/index.umd.cjs +2 -2
- package/dist/pages/DashboardDesignPage.d.ts.map +1 -1
- package/package.json +14 -14
- package/dist/__tests__/__mocks__/plugin-form.d.ts +0 -4
- package/dist/__tests__/__mocks__/plugin-form.d.ts.map +0 -1
- package/dist/__tests__/__mocks__/plugin-grid.d.ts +0 -3
- package/dist/__tests__/__mocks__/plugin-grid.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { ComponentRegistry as e, ValueDataSource as t } from "@object-ui/core";
|
|
2
2
|
import n, { createContext as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
3
|
-
import { AlertTriangle as u, ArrowLeft as d, AtSign as f, BarChart3 as p, Calendar as m, Check as h, ChevronDown as g, ChevronLeft as _, ChevronRight as v, ChevronUp as y, Clipboard as b, Clock as x, Code as S, Columns3 as C, Copy as w, Database as T, Diamond as E, Download as D, Eye as O, EyeOff as k, FileText as A, FolderOpen as j, GitBranch as M, Globe as N, Grid3X3 as P, GripVertical as F, Hash as I, History as L, Image as R, ImageIcon as z, Layers as ee, Layout as B, LayoutDashboard as te,
|
|
3
|
+
import { AlertTriangle as u, ArrowLeft as d, AtSign as f, BarChart3 as p, Calendar as m, Check as h, ChevronDown as g, ChevronLeft as _, ChevronRight as v, ChevronUp as y, Clipboard as b, Clock as x, Code as S, Columns3 as C, Copy as w, Database as T, Diamond as E, Download as D, Eye as O, EyeOff as k, FileText as A, FolderOpen as j, GitBranch as M, Globe as N, Grid3X3 as P, GripVertical as F, Hash as I, History as L, Image as R, ImageIcon as z, Layers as ee, Layout as B, LayoutDashboard as te, LayoutTemplate as ne, LineChart as re, Link as ie, Link2 as ae, ListOrdered as oe, Lock as V, Map as se, MapPin as ce, Maximize2 as le, Minus as ue, Moon as de, MousePointerClick as H, Palette as fe, PanelLeft as pe, PanelLeftClose as me, PanelRightClose as he, PanelRightOpen as ge, Pencil as U, Phone as W, PieChart as _e, Play as ve, Plus as ye, Puzzle as be, Redo2 as xe, RotateCcw as Se, Search as Ce, SlidersHorizontal as we, Square as Te, Star as Ee, Sun as De, Table2 as Oe, ToggleLeft as ke, Trash2 as Ae, TrendingUp as je, Type as Me, Undo2 as Ne, Upload as Pe, User as Fe, Users as Ie, X as Le, ZoomIn as Re, ZoomOut as ze } from "lucide-react";
|
|
4
4
|
import { clsx as G } from "clsx";
|
|
5
5
|
import { twMerge as K } from "tailwind-merge";
|
|
6
6
|
import { Fragment as q, jsx as J, jsxs as Y } from "react/jsx-runtime";
|
|
7
|
-
import { DESIGNER_FIELD_TYPES as
|
|
8
|
-
import {
|
|
9
|
-
import { createSafeTranslation as qe } from "@object-ui/i18n";
|
|
10
|
-
import { ObjectGrid as
|
|
11
|
-
import { DrawerForm as
|
|
12
|
-
import { useNavigate as
|
|
13
|
-
import { toast as
|
|
14
|
-
import { MetadataClient as
|
|
7
|
+
import { DESIGNER_FIELD_TYPES as Be, isValidAppName as Ve, liftLegacyDashboardFilterDefaults as He, wizardDraftToAppSchema as Ue } from "@object-ui/types";
|
|
8
|
+
import { resolveKeyedI18nLabel as We, useAdapter as Ge, useMetadata as Ke } from "@object-ui/react";
|
|
9
|
+
import { createSafeTranslation as qe, pickLocalized as Je, setLocalized as Ye } from "@object-ui/i18n";
|
|
10
|
+
import { ObjectGrid as Xe } from "@object-ui/plugin-grid";
|
|
11
|
+
import { DrawerForm as Ze, ModalForm as Qe } from "@object-ui/plugin-form";
|
|
12
|
+
import { useNavigate as $e, useParams as et } from "react-router-dom";
|
|
13
|
+
import { toast as tt } from "sonner";
|
|
14
|
+
import { MetadataClient as nt } from "@object-ui/data-objectstack";
|
|
15
15
|
//#region src/hooks/useUndoRedo.ts
|
|
16
|
-
function
|
|
16
|
+
function rt(e) {
|
|
17
17
|
return e || (typeof window < "u" && window.sessionStorage ? window.sessionStorage : null);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
20
|
-
let { maxHistory: n = 50, persistKey: r, storage: a } = t, s =
|
|
19
|
+
function it(e, t = {}) {
|
|
20
|
+
let { maxHistory: n = 50, persistKey: r, storage: a } = t, s = rt(a), u = (() => {
|
|
21
21
|
if (!r || !s) return null;
|
|
22
22
|
try {
|
|
23
23
|
let e = s.getItem(r);
|
|
@@ -93,7 +93,7 @@ function nt(e, t = {}) {
|
|
|
93
93
|
}
|
|
94
94
|
//#endregion
|
|
95
95
|
//#region src/hooks/useConfirmDialog.ts
|
|
96
|
-
function
|
|
96
|
+
function at() {
|
|
97
97
|
let [e, t] = l(!1), [n, r] = l(""), [a, o] = l(""), s = c(null);
|
|
98
98
|
return {
|
|
99
99
|
isOpen: e,
|
|
@@ -112,7 +112,7 @@ function rt() {
|
|
|
112
112
|
}
|
|
113
113
|
//#endregion
|
|
114
114
|
//#region src/hooks/useMultiSelect.ts
|
|
115
|
-
function
|
|
115
|
+
function ot() {
|
|
116
116
|
let [e, t] = l(/* @__PURE__ */ new Set());
|
|
117
117
|
return {
|
|
118
118
|
selectedIds: e,
|
|
@@ -137,7 +137,7 @@ function it() {
|
|
|
137
137
|
}
|
|
138
138
|
//#endregion
|
|
139
139
|
//#region src/hooks/useClipboard.ts
|
|
140
|
-
function
|
|
140
|
+
function st() {
|
|
141
141
|
let [e, t] = l(null);
|
|
142
142
|
return {
|
|
143
143
|
clipboard: e,
|
|
@@ -150,7 +150,7 @@ function at() {
|
|
|
150
150
|
}
|
|
151
151
|
//#endregion
|
|
152
152
|
//#region src/hooks/useCanvasPanZoom.ts
|
|
153
|
-
function
|
|
153
|
+
function ct(e = {}) {
|
|
154
154
|
let { minZoom: t = .25, maxZoom: n = 3, zoomStep: r = .1, initialZoom: a = 1 } = e, [o, s] = l(a), [u, d] = l({
|
|
155
155
|
x: 0,
|
|
156
156
|
y: 0
|
|
@@ -207,10 +207,10 @@ function ot(e = {}) {
|
|
|
207
207
|
}
|
|
208
208
|
//#endregion
|
|
209
209
|
//#region src/components/ConfirmDialog.tsx
|
|
210
|
-
function
|
|
210
|
+
function lt(...e) {
|
|
211
211
|
return K(G(e));
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function ut({ isOpen: e, title: t, message: n, confirmLabel: r = "Delete", cancelLabel: i = "Cancel", destructive: a = !0, onConfirm: s, onCancel: l }) {
|
|
214
214
|
let d = c(null);
|
|
215
215
|
return o(() => {
|
|
216
216
|
let t = d.current;
|
|
@@ -243,12 +243,14 @@ function ct({ isOpen: e, title: t, message: n, confirmLabel: r = "Delete", cance
|
|
|
243
243
|
/* @__PURE__ */ Y("div", {
|
|
244
244
|
className: "flex justify-end gap-2",
|
|
245
245
|
children: [/* @__PURE__ */ J("button", {
|
|
246
|
+
type: "button",
|
|
246
247
|
onClick: l,
|
|
247
248
|
className: "px-4 py-2 text-sm rounded-md border hover:bg-accent",
|
|
248
249
|
children: i
|
|
249
250
|
}), /* @__PURE__ */ J("button", {
|
|
251
|
+
type: "button",
|
|
250
252
|
onClick: s,
|
|
251
|
-
className:
|
|
253
|
+
className: lt("px-4 py-2 text-sm rounded-md font-medium", a ? "bg-destructive text-destructive-foreground hover:bg-destructive/90" : "bg-primary text-primary-foreground hover:bg-primary/90"),
|
|
252
254
|
autoFocus: !0,
|
|
253
255
|
children: r
|
|
254
256
|
})]
|
|
@@ -259,10 +261,10 @@ function ct({ isOpen: e, title: t, message: n, confirmLabel: r = "Delete", cance
|
|
|
259
261
|
}
|
|
260
262
|
//#endregion
|
|
261
263
|
//#region src/components/PropertyEditor.tsx
|
|
262
|
-
function
|
|
264
|
+
function dt(...e) {
|
|
263
265
|
return K(G(e));
|
|
264
266
|
}
|
|
265
|
-
function
|
|
267
|
+
function ft({ title: e = "Properties", fields: t, onChange: n, className: r }) {
|
|
266
268
|
let [a, o] = l(/* @__PURE__ */ new Set()), s = i((e) => {
|
|
267
269
|
o((t) => {
|
|
268
270
|
let n = new Set(t);
|
|
@@ -273,7 +275,7 @@ function ut({ title: e = "Properties", fields: t, onChange: n, className: r }) {
|
|
|
273
275
|
return e[n] || (e[n] = []), e[n].push(t), e;
|
|
274
276
|
}, {});
|
|
275
277
|
return /* @__PURE__ */ Y("div", {
|
|
276
|
-
className:
|
|
278
|
+
className: dt("flex flex-col", r),
|
|
277
279
|
role: "region",
|
|
278
280
|
"aria-label": e,
|
|
279
281
|
children: [/* @__PURE__ */ J("div", {
|
|
@@ -284,12 +286,13 @@ function ut({ title: e = "Properties", fields: t, onChange: n, className: r }) {
|
|
|
284
286
|
children: [Object.entries(c).map(([e, t]) => /* @__PURE__ */ Y("div", {
|
|
285
287
|
className: "border-b last:border-b-0",
|
|
286
288
|
children: [/* @__PURE__ */ Y("button", {
|
|
289
|
+
type: "button",
|
|
287
290
|
onClick: () => s(e),
|
|
288
291
|
className: "w-full flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50",
|
|
289
292
|
children: [a.has(e) ? /* @__PURE__ */ J(v, { className: "h-3 w-3" }) : /* @__PURE__ */ J(g, { className: "h-3 w-3" }), e]
|
|
290
293
|
}), !a.has(e) && /* @__PURE__ */ J("div", {
|
|
291
294
|
className: "px-3 pb-2 space-y-2",
|
|
292
|
-
children: t.map((e) => /* @__PURE__ */ J(
|
|
295
|
+
children: t.map((e) => /* @__PURE__ */ J(pt, {
|
|
293
296
|
field: e,
|
|
294
297
|
onChange: n
|
|
295
298
|
}, e.name))
|
|
@@ -301,7 +304,7 @@ function ut({ title: e = "Properties", fields: t, onChange: n, className: r }) {
|
|
|
301
304
|
})]
|
|
302
305
|
});
|
|
303
306
|
}
|
|
304
|
-
function
|
|
307
|
+
function pt({ field: e, onChange: t }) {
|
|
305
308
|
let n = (n) => {
|
|
306
309
|
t(e.name, n);
|
|
307
310
|
};
|
|
@@ -372,13 +375,13 @@ function dt({ field: e, onChange: t }) {
|
|
|
372
375
|
}
|
|
373
376
|
//#endregion
|
|
374
377
|
//#region src/components/Minimap.tsx
|
|
375
|
-
function
|
|
378
|
+
function mt(...e) {
|
|
376
379
|
return K(G(e));
|
|
377
380
|
}
|
|
378
|
-
function
|
|
381
|
+
function ht({ items: e, canvasWidth: t, canvasHeight: n, position: r = "bottom-right", size: i = 150, className: a }) {
|
|
379
382
|
let o = Math.min(i / t, i / n), s = t * o, c = n * o;
|
|
380
383
|
return /* @__PURE__ */ J("div", {
|
|
381
|
-
className:
|
|
384
|
+
className: mt("absolute border rounded bg-background/90 shadow-sm overflow-hidden", {
|
|
382
385
|
"top-left": "top-2 left-2",
|
|
383
386
|
"top-right": "top-2 right-2",
|
|
384
387
|
"bottom-left": "bottom-2 left-2",
|
|
@@ -408,12 +411,12 @@ function pt({ items: e, canvasWidth: t, canvasHeight: n, position: r = "bottom-r
|
|
|
408
411
|
}
|
|
409
412
|
//#endregion
|
|
410
413
|
//#region src/CollaborationProvider.tsx
|
|
411
|
-
function
|
|
414
|
+
function gt(...e) {
|
|
412
415
|
return K(G(e));
|
|
413
416
|
}
|
|
414
|
-
var
|
|
415
|
-
|
|
416
|
-
function
|
|
417
|
+
var _t = r(null);
|
|
418
|
+
_t.displayName = "CollaborationContext";
|
|
419
|
+
function vt({ config: e, user: t, onOperation: n, onPresenceChange: r, children: a }) {
|
|
417
420
|
let u = c(null), [d, f] = l([]), [p, m] = l("disconnected"), h = c(0), g = c(null);
|
|
418
421
|
o(() => {
|
|
419
422
|
if (!e.enabled || !t || !e.serverUrl || !(typeof WebSocket < "u")) return;
|
|
@@ -463,7 +466,7 @@ function gt({ config: e, user: t, onOperation: n, onPresenceChange: r, children:
|
|
|
463
466
|
userId: t.id,
|
|
464
467
|
userName: t.name,
|
|
465
468
|
avatar: t.avatar,
|
|
466
|
-
color:
|
|
469
|
+
color: xt(t.id),
|
|
467
470
|
status: "active",
|
|
468
471
|
lastActivity: (/* @__PURE__ */ new Date()).toISOString()
|
|
469
472
|
}, ...d], [
|
|
@@ -502,16 +505,16 @@ function gt({ config: e, user: t, onOperation: n, onPresenceChange: r, children:
|
|
|
502
505
|
t?.id,
|
|
503
506
|
p
|
|
504
507
|
]);
|
|
505
|
-
return /* @__PURE__ */ J(
|
|
508
|
+
return /* @__PURE__ */ J(_t.Provider, {
|
|
506
509
|
value: b,
|
|
507
510
|
children: a
|
|
508
511
|
});
|
|
509
512
|
}
|
|
510
|
-
function
|
|
511
|
-
return a(
|
|
513
|
+
function yt() {
|
|
514
|
+
return a(_t);
|
|
512
515
|
}
|
|
513
|
-
function
|
|
514
|
-
let t = a(
|
|
516
|
+
function bt({ className: e }) {
|
|
517
|
+
let t = a(_t);
|
|
515
518
|
if (!t) return null;
|
|
516
519
|
let { connectionState: n, users: r } = t, i = {
|
|
517
520
|
connected: {
|
|
@@ -532,7 +535,7 @@ function vt({ className: e }) {
|
|
|
532
535
|
}
|
|
533
536
|
}, { color: o, label: s } = i[n] ?? i.disconnected;
|
|
534
537
|
return /* @__PURE__ */ Y("div", {
|
|
535
|
-
className:
|
|
538
|
+
className: gt("flex items-center gap-2 text-xs", e),
|
|
536
539
|
role: "status",
|
|
537
540
|
"aria-live": "polite",
|
|
538
541
|
"aria-label": `Collaboration: ${s}`,
|
|
@@ -550,7 +553,7 @@ function vt({ className: e }) {
|
|
|
550
553
|
]
|
|
551
554
|
});
|
|
552
555
|
}
|
|
553
|
-
function
|
|
556
|
+
function xt(e) {
|
|
554
557
|
let t = [
|
|
555
558
|
"#3b82f6",
|
|
556
559
|
"#ef4444",
|
|
@@ -577,19 +580,19 @@ function yt(e) {
|
|
|
577
580
|
function X(...e) {
|
|
578
581
|
return K(G(e));
|
|
579
582
|
}
|
|
580
|
-
function
|
|
583
|
+
function St({ canvas: e = {
|
|
581
584
|
width: 1200,
|
|
582
585
|
height: 800,
|
|
583
586
|
gridSize: 8,
|
|
584
587
|
showGrid: !0,
|
|
585
588
|
snapToGrid: !0
|
|
586
|
-
}, components: t = [], palette: n =
|
|
587
|
-
let h =
|
|
589
|
+
}, components: t = [], palette: n = Ct, showComponentTree: r = !0, undoRedo: a = !0, propertyEditor: u = !0, readOnly: d = !1, showMinimap: f = !1, onChange: p, className: m }) {
|
|
590
|
+
let h = it(t), g = h.current, _ = i((e) => {
|
|
588
591
|
h.push(e), p?.(e);
|
|
589
|
-
}, [h, p]), v =
|
|
592
|
+
}, [h, p]), v = ct({ initialZoom: e.zoom ?? 1 }), { zoom: y } = v, x = ot(), S = s(() => {
|
|
590
593
|
let e = Array.from(x.selectedIds);
|
|
591
594
|
return e.length > 0 ? e[0] : null;
|
|
592
|
-
}, [x.selectedIds]), C = s(() => g.find((e) => e.id === S), [g, S]), T =
|
|
595
|
+
}, [x.selectedIds]), C = s(() => g.find((e) => e.id === S), [g, S]), T = st(), E = at(), D = yt(), k = i((e) => {
|
|
593
596
|
D && D.sendOperation({
|
|
594
597
|
...e,
|
|
595
598
|
userId: D.currentUserId ?? ""
|
|
@@ -707,7 +710,7 @@ function bt({ canvas: e = {
|
|
|
707
710
|
x,
|
|
708
711
|
g,
|
|
709
712
|
T
|
|
710
|
-
]),
|
|
713
|
+
]), ae = i(() => {
|
|
711
714
|
if (d) return;
|
|
712
715
|
let e = T.paste();
|
|
713
716
|
if (!e || e.length === 0) return;
|
|
@@ -734,15 +737,15 @@ function bt({ canvas: e = {
|
|
|
734
737
|
_,
|
|
735
738
|
x,
|
|
736
739
|
k
|
|
737
|
-
]),
|
|
740
|
+
]), oe = i((e, t) => {
|
|
738
741
|
d || (L.current = {
|
|
739
742
|
id: t.id,
|
|
740
743
|
startX: e.clientX,
|
|
741
744
|
startY: e.clientY
|
|
742
745
|
}, e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t.id));
|
|
743
|
-
}, [d]),
|
|
746
|
+
}, [d]), V = i((e) => {
|
|
744
747
|
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
745
|
-
}, []),
|
|
748
|
+
}, []), ce = i((e) => {
|
|
746
749
|
e.preventDefault();
|
|
747
750
|
let t = L.current;
|
|
748
751
|
if (!t || d) return;
|
|
@@ -766,7 +769,7 @@ function bt({ canvas: e = {
|
|
|
766
769
|
_,
|
|
767
770
|
z,
|
|
768
771
|
k
|
|
769
|
-
]),
|
|
772
|
+
]), de = s(() => C ? [
|
|
770
773
|
{
|
|
771
774
|
name: "label",
|
|
772
775
|
label: "Label",
|
|
@@ -802,7 +805,7 @@ function bt({ canvas: e = {
|
|
|
802
805
|
value: C.position.height,
|
|
803
806
|
group: "Size"
|
|
804
807
|
}
|
|
805
|
-
] : [], [C]),
|
|
808
|
+
] : [], [C]), H = s(() => g.map((e) => ({
|
|
806
809
|
id: e.id,
|
|
807
810
|
x: e.position.x,
|
|
808
811
|
y: e.position.y,
|
|
@@ -841,7 +844,7 @@ function bt({ canvas: e = {
|
|
|
841
844
|
return;
|
|
842
845
|
}
|
|
843
846
|
if (n && e.key === "v" && !d) {
|
|
844
|
-
e.preventDefault(),
|
|
847
|
+
e.preventDefault(), ae();
|
|
845
848
|
return;
|
|
846
849
|
}
|
|
847
850
|
if (n && e.key === "a") {
|
|
@@ -858,7 +861,7 @@ function bt({ canvas: e = {
|
|
|
858
861
|
d,
|
|
859
862
|
h,
|
|
860
863
|
ie,
|
|
861
|
-
|
|
864
|
+
ae,
|
|
862
865
|
g
|
|
863
866
|
]), /* @__PURE__ */ Y("div", {
|
|
864
867
|
ref: R,
|
|
@@ -880,9 +883,10 @@ function bt({ canvas: e = {
|
|
|
880
883
|
className: "text-xs font-medium text-muted-foreground px-2 py-1 uppercase",
|
|
881
884
|
children: e.label
|
|
882
885
|
}), e.items.map((e) => /* @__PURE__ */ Y("button", {
|
|
886
|
+
type: "button",
|
|
883
887
|
onClick: () => B(e.type, e.label),
|
|
884
888
|
className: "w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-accent text-left",
|
|
885
|
-
children: [/* @__PURE__ */ J(
|
|
889
|
+
children: [/* @__PURE__ */ J(ye, { className: "h-3 w-3" }), e.label]
|
|
886
890
|
}, e.type))]
|
|
887
891
|
}, e.name))
|
|
888
892
|
})] })
|
|
@@ -895,34 +899,38 @@ function bt({ canvas: e = {
|
|
|
895
899
|
"aria-label": "Designer toolbar",
|
|
896
900
|
children: [
|
|
897
901
|
!d && /* @__PURE__ */ J("button", {
|
|
902
|
+
type: "button",
|
|
898
903
|
className: "p-1.5 rounded hover:bg-accent",
|
|
899
904
|
title: A ? "Collapse palette" : "Expand palette",
|
|
900
905
|
"aria-label": A ? "Collapse palette" : "Expand palette",
|
|
901
906
|
onClick: () => j((e) => !e),
|
|
902
|
-
children: /* @__PURE__ */ J(
|
|
907
|
+
children: /* @__PURE__ */ J(me, { className: X("h-4 w-4", !A && "rotate-180") })
|
|
903
908
|
}),
|
|
904
909
|
a && !d && /* @__PURE__ */ Y(q, { children: [
|
|
905
910
|
/* @__PURE__ */ J("div", { className: "w-px h-5 bg-border mx-1" }),
|
|
906
911
|
/* @__PURE__ */ J("button", {
|
|
912
|
+
type: "button",
|
|
907
913
|
className: X("p-1.5 rounded hover:bg-accent", !h.canUndo && "opacity-40 pointer-events-none"),
|
|
908
914
|
title: "Undo (Ctrl+Z)",
|
|
909
915
|
"aria-label": "Undo",
|
|
910
916
|
disabled: !h.canUndo,
|
|
911
917
|
onClick: () => h.undo(),
|
|
912
|
-
children: /* @__PURE__ */ J(
|
|
918
|
+
children: /* @__PURE__ */ J(Ne, { className: "h-4 w-4" })
|
|
913
919
|
}),
|
|
914
920
|
/* @__PURE__ */ J("button", {
|
|
921
|
+
type: "button",
|
|
915
922
|
className: X("p-1.5 rounded hover:bg-accent", !h.canRedo && "opacity-40 pointer-events-none"),
|
|
916
923
|
title: "Redo (Ctrl+Shift+Z)",
|
|
917
924
|
"aria-label": "Redo",
|
|
918
925
|
disabled: !h.canRedo,
|
|
919
926
|
onClick: () => h.redo(),
|
|
920
|
-
children: /* @__PURE__ */ J(
|
|
927
|
+
children: /* @__PURE__ */ J(xe, { className: "h-4 w-4" })
|
|
921
928
|
}),
|
|
922
929
|
/* @__PURE__ */ J("div", { className: "w-px h-5 bg-border mx-1" })
|
|
923
930
|
] }),
|
|
924
931
|
!d && /* @__PURE__ */ Y(q, { children: [
|
|
925
932
|
/* @__PURE__ */ J("button", {
|
|
933
|
+
type: "button",
|
|
926
934
|
className: X("p-1.5 rounded hover:bg-accent", x.count === 0 && "opacity-40 pointer-events-none"),
|
|
927
935
|
title: "Copy (Ctrl+C)",
|
|
928
936
|
"aria-label": "Copy",
|
|
@@ -931,30 +939,34 @@ function bt({ canvas: e = {
|
|
|
931
939
|
children: /* @__PURE__ */ J(w, { className: "h-4 w-4" })
|
|
932
940
|
}),
|
|
933
941
|
/* @__PURE__ */ J("button", {
|
|
942
|
+
type: "button",
|
|
934
943
|
className: X("p-1.5 rounded hover:bg-accent", !T.hasContent && "opacity-40 pointer-events-none"),
|
|
935
944
|
title: "Paste (Ctrl+V)",
|
|
936
945
|
"aria-label": "Paste",
|
|
937
946
|
disabled: !T.hasContent,
|
|
938
|
-
onClick:
|
|
947
|
+
onClick: ae,
|
|
939
948
|
children: /* @__PURE__ */ J(b, { className: "h-4 w-4" })
|
|
940
949
|
}),
|
|
941
950
|
/* @__PURE__ */ J("div", { className: "w-px h-5 bg-border mx-1" })
|
|
942
951
|
] }),
|
|
943
952
|
!d && /* @__PURE__ */ J("button", {
|
|
953
|
+
type: "button",
|
|
944
954
|
className: X("p-1.5 rounded hover:bg-accent", x.count === 0 && "opacity-40 pointer-events-none"),
|
|
945
955
|
title: "Delete selected",
|
|
946
956
|
"aria-label": "Delete selected",
|
|
947
957
|
disabled: x.count === 0,
|
|
948
958
|
onClick: ne,
|
|
949
|
-
children: /* @__PURE__ */ J(
|
|
959
|
+
children: /* @__PURE__ */ J(Ae, { className: "h-4 w-4" })
|
|
950
960
|
}),
|
|
951
961
|
/* @__PURE__ */ J("button", {
|
|
962
|
+
type: "button",
|
|
952
963
|
className: "p-1.5 rounded hover:bg-accent",
|
|
953
964
|
title: "Preview",
|
|
954
965
|
"aria-label": "Preview",
|
|
955
966
|
children: /* @__PURE__ */ J(O, { className: "h-4 w-4" })
|
|
956
967
|
}),
|
|
957
968
|
/* @__PURE__ */ J("button", {
|
|
969
|
+
type: "button",
|
|
958
970
|
className: X("p-1.5 rounded hover:bg-accent", P && "bg-accent"),
|
|
959
971
|
title: "Toggle minimap",
|
|
960
972
|
"aria-label": "Toggle minimap",
|
|
@@ -966,6 +978,7 @@ function bt({ canvas: e = {
|
|
|
966
978
|
className: "flex items-center gap-1",
|
|
967
979
|
children: [
|
|
968
980
|
/* @__PURE__ */ J("button", {
|
|
981
|
+
type: "button",
|
|
969
982
|
className: "p-1 rounded hover:bg-accent text-xs",
|
|
970
983
|
"aria-label": "Zoom out",
|
|
971
984
|
onClick: v.zoomOut,
|
|
@@ -976,12 +989,14 @@ function bt({ canvas: e = {
|
|
|
976
989
|
children: [Math.round(y * 100), "%"]
|
|
977
990
|
}),
|
|
978
991
|
/* @__PURE__ */ J("button", {
|
|
992
|
+
type: "button",
|
|
979
993
|
className: "p-1 rounded hover:bg-accent text-xs",
|
|
980
994
|
"aria-label": "Zoom in",
|
|
981
995
|
onClick: v.zoomIn,
|
|
982
|
-
children: /* @__PURE__ */ J(
|
|
996
|
+
children: /* @__PURE__ */ J(ye, { className: "h-3 w-3" })
|
|
983
997
|
}),
|
|
984
998
|
/* @__PURE__ */ J("button", {
|
|
999
|
+
type: "button",
|
|
985
1000
|
className: "p-1 rounded hover:bg-accent text-xs",
|
|
986
1001
|
"aria-label": "Reset zoom",
|
|
987
1002
|
onClick: v.resetZoom,
|
|
@@ -990,11 +1005,12 @@ function bt({ canvas: e = {
|
|
|
990
1005
|
]
|
|
991
1006
|
}),
|
|
992
1007
|
r && /* @__PURE__ */ J("button", {
|
|
1008
|
+
type: "button",
|
|
993
1009
|
className: "p-1.5 rounded hover:bg-accent",
|
|
994
1010
|
title: M ? "Collapse panel" : "Expand panel",
|
|
995
1011
|
"aria-label": M ? "Collapse panel" : "Expand panel",
|
|
996
1012
|
onClick: () => N((e) => !e),
|
|
997
|
-
children: /* @__PURE__ */ J(
|
|
1013
|
+
children: /* @__PURE__ */ J(he, { className: X("h-4 w-4", !M && "rotate-180") })
|
|
998
1014
|
})
|
|
999
1015
|
]
|
|
1000
1016
|
}), /* @__PURE__ */ J("div", {
|
|
@@ -1003,8 +1019,8 @@ function bt({ canvas: e = {
|
|
|
1003
1019
|
"aria-label": "Design canvas",
|
|
1004
1020
|
onWheel: v.handleWheel,
|
|
1005
1021
|
onMouseDown: v.startPan,
|
|
1006
|
-
onDragOver:
|
|
1007
|
-
onDrop:
|
|
1022
|
+
onDragOver: V,
|
|
1023
|
+
onDrop: ce,
|
|
1008
1024
|
children: /* @__PURE__ */ Y("div", {
|
|
1009
1025
|
className: "relative bg-background border rounded shadow-sm mx-auto",
|
|
1010
1026
|
style: {
|
|
@@ -1018,7 +1034,7 @@ function bt({ canvas: e = {
|
|
|
1018
1034
|
let t = x.isSelected(e.id);
|
|
1019
1035
|
return /* @__PURE__ */ Y("div", {
|
|
1020
1036
|
draggable: !d,
|
|
1021
|
-
onDragStart: (t) =>
|
|
1037
|
+
onDragStart: (t) => oe(t, e),
|
|
1022
1038
|
className: X("absolute border rounded cursor-move select-none transition-shadow", t ? "border-primary ring-2 ring-primary/20 shadow-md" : "border-border hover:border-primary/50"),
|
|
1023
1039
|
style: {
|
|
1024
1040
|
left: e.position.x * y,
|
|
@@ -1036,12 +1052,13 @@ function bt({ canvas: e = {
|
|
|
1036
1052
|
children: e.label ?? e.type
|
|
1037
1053
|
}),
|
|
1038
1054
|
!d && /* @__PURE__ */ J("button", {
|
|
1055
|
+
type: "button",
|
|
1039
1056
|
onClick: (t) => {
|
|
1040
1057
|
t.stopPropagation(), te(e.id);
|
|
1041
1058
|
},
|
|
1042
1059
|
className: "ml-auto p-0.5 rounded hover:bg-destructive/10",
|
|
1043
1060
|
"aria-label": `Delete ${e.label ?? e.type}`,
|
|
1044
|
-
children: /* @__PURE__ */ J(
|
|
1061
|
+
children: /* @__PURE__ */ J(Ae, { className: "h-3 w-3 text-destructive" })
|
|
1045
1062
|
})
|
|
1046
1063
|
]
|
|
1047
1064
|
}), /* @__PURE__ */ J("div", {
|
|
@@ -1049,8 +1066,8 @@ function bt({ canvas: e = {
|
|
|
1049
1066
|
children: e.type
|
|
1050
1067
|
})]
|
|
1051
1068
|
}, e.id);
|
|
1052
|
-
}), P && /* @__PURE__ */ J(
|
|
1053
|
-
items:
|
|
1069
|
+
}), P && /* @__PURE__ */ J(ht, {
|
|
1070
|
+
items: H,
|
|
1054
1071
|
canvasWidth: e.width,
|
|
1055
1072
|
canvasHeight: e.height
|
|
1056
1073
|
})]
|
|
@@ -1072,6 +1089,7 @@ function bt({ canvas: e = {
|
|
|
1072
1089
|
className: "text-xs text-muted-foreground text-center py-4",
|
|
1073
1090
|
children: "No components added yet. Click a component in the palette to add it to the canvas."
|
|
1074
1091
|
}) : g.map((e) => /* @__PURE__ */ J("button", {
|
|
1092
|
+
type: "button",
|
|
1075
1093
|
onClick: (t) => x.toggle(e.id, t.shiftKey),
|
|
1076
1094
|
className: X("w-full flex items-center gap-2 px-2 py-1.5 text-sm rounded text-left", x.isSelected(e.id) ? "bg-accent" : "hover:bg-accent/50"),
|
|
1077
1095
|
children: /* @__PURE__ */ J("span", {
|
|
@@ -1082,9 +1100,9 @@ function bt({ canvas: e = {
|
|
|
1082
1100
|
}),
|
|
1083
1101
|
u && C ? /* @__PURE__ */ J("div", {
|
|
1084
1102
|
className: "border-t",
|
|
1085
|
-
children: /* @__PURE__ */ J(
|
|
1103
|
+
children: /* @__PURE__ */ J(ft, {
|
|
1086
1104
|
title: `Properties – ${C.label ?? C.type}`,
|
|
1087
|
-
fields:
|
|
1105
|
+
fields: de,
|
|
1088
1106
|
onChange: re
|
|
1089
1107
|
})
|
|
1090
1108
|
}) : C && /* @__PURE__ */ Y("div", {
|
|
@@ -1116,7 +1134,7 @@ function bt({ canvas: e = {
|
|
|
1116
1134
|
})
|
|
1117
1135
|
] })
|
|
1118
1136
|
}),
|
|
1119
|
-
/* @__PURE__ */ J(
|
|
1137
|
+
/* @__PURE__ */ J(ut, {
|
|
1120
1138
|
isOpen: E.isOpen,
|
|
1121
1139
|
title: E.title,
|
|
1122
1140
|
message: E.message,
|
|
@@ -1126,7 +1144,7 @@ function bt({ canvas: e = {
|
|
|
1126
1144
|
]
|
|
1127
1145
|
});
|
|
1128
1146
|
}
|
|
1129
|
-
var
|
|
1147
|
+
var Ct = [
|
|
1130
1148
|
{
|
|
1131
1149
|
name: "layout",
|
|
1132
1150
|
label: "Layout",
|
|
@@ -1260,15 +1278,15 @@ var xt = [
|
|
|
1260
1278
|
];
|
|
1261
1279
|
//#endregion
|
|
1262
1280
|
//#region src/hooks/useDesignerHistory.ts
|
|
1263
|
-
function
|
|
1264
|
-
return
|
|
1281
|
+
function wt(e, t = {}) {
|
|
1282
|
+
return it(e, t);
|
|
1265
1283
|
}
|
|
1266
1284
|
//#endregion
|
|
1267
1285
|
//#region src/DataModelDesigner.tsx
|
|
1268
|
-
function
|
|
1286
|
+
function Tt(...e) {
|
|
1269
1287
|
return K(G(e));
|
|
1270
1288
|
}
|
|
1271
|
-
var
|
|
1289
|
+
var Et = [
|
|
1272
1290
|
"text",
|
|
1273
1291
|
"number",
|
|
1274
1292
|
"boolean",
|
|
@@ -1292,7 +1310,7 @@ var wt = [
|
|
|
1292
1310
|
"formula",
|
|
1293
1311
|
"autonumber"
|
|
1294
1312
|
];
|
|
1295
|
-
function
|
|
1313
|
+
function Dt(e, t = 4, n = 280, r = 250, i = 50, a = 50) {
|
|
1296
1314
|
return e.map((e, o) => ({
|
|
1297
1315
|
...e,
|
|
1298
1316
|
position: {
|
|
@@ -1301,12 +1319,12 @@ function Tt(e, t = 4, n = 280, r = 250, i = 50, a = 50) {
|
|
|
1301
1319
|
}
|
|
1302
1320
|
}));
|
|
1303
1321
|
}
|
|
1304
|
-
function
|
|
1322
|
+
function Ot({ entities: e = [], relationships: t = [], canvas: n = {
|
|
1305
1323
|
width: 1200,
|
|
1306
1324
|
height: 800,
|
|
1307
1325
|
showGrid: !0
|
|
1308
1326
|
}, showRelationshipLabels: r = !0, readOnly: a = !1, onEntitiesChange: s, onRelationshipsChange: u, className: d }) {
|
|
1309
|
-
let f = c(null), p =
|
|
1327
|
+
let f = c(null), p = wt({
|
|
1310
1328
|
entities: e,
|
|
1311
1329
|
relationships: t
|
|
1312
1330
|
}, { maxHistory: 50 }), { entities: m, relationships: h } = p.current, _ = i((e) => {
|
|
@@ -1315,11 +1333,11 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1315
1333
|
p,
|
|
1316
1334
|
s,
|
|
1317
1335
|
u
|
|
1318
|
-
]), y =
|
|
1336
|
+
]), y = at(), x = ot(), S = x.count > 0 ? Array.from(x.selectedIds)[0] : null, C = st(), E = ct({
|
|
1319
1337
|
minZoom: .25,
|
|
1320
1338
|
maxZoom: 3,
|
|
1321
1339
|
zoomStep: .1
|
|
1322
|
-
}), D =
|
|
1340
|
+
}), D = yt(), [O, k] = l(!0), [A, j] = l(!0), [M, N] = l(null), [F, I] = l(""), [L, R] = l(null), [z, ee] = l(""), B = c(null), te = i(() => {
|
|
1323
1341
|
if (a) return;
|
|
1324
1342
|
let e = p.current, t = {
|
|
1325
1343
|
id: `entity-${Date.now()}`,
|
|
@@ -1406,7 +1424,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1406
1424
|
]), ie = i(() => {
|
|
1407
1425
|
if (a) return;
|
|
1408
1426
|
let e = p.current, t = {
|
|
1409
|
-
entities:
|
|
1427
|
+
entities: Dt(e.entities),
|
|
1410
1428
|
relationships: e.relationships
|
|
1411
1429
|
};
|
|
1412
1430
|
_(t);
|
|
@@ -1414,14 +1432,14 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1414
1432
|
a,
|
|
1415
1433
|
p,
|
|
1416
1434
|
_
|
|
1417
|
-
]),
|
|
1435
|
+
]), oe = i(() => {
|
|
1418
1436
|
let e = m.filter((e) => x.isSelected(e.id));
|
|
1419
1437
|
e.length > 0 && C.copy(e);
|
|
1420
1438
|
}, [
|
|
1421
1439
|
m,
|
|
1422
1440
|
x,
|
|
1423
1441
|
C
|
|
1424
|
-
]),
|
|
1442
|
+
]), V = i(() => {
|
|
1425
1443
|
if (a) return;
|
|
1426
1444
|
let e = C.paste();
|
|
1427
1445
|
if (!e || e.length === 0) return;
|
|
@@ -1445,7 +1463,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1445
1463
|
p,
|
|
1446
1464
|
_,
|
|
1447
1465
|
x
|
|
1448
|
-
]),
|
|
1466
|
+
]), se = i((e) => {
|
|
1449
1467
|
if (a) return;
|
|
1450
1468
|
let t = p.current, n = {
|
|
1451
1469
|
entities: t.entities.map((t) => {
|
|
@@ -1467,12 +1485,12 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1467
1485
|
a,
|
|
1468
1486
|
p,
|
|
1469
1487
|
_
|
|
1470
|
-
]),
|
|
1488
|
+
]), ce = i((e, t, n) => {
|
|
1471
1489
|
a || (N({
|
|
1472
1490
|
entityId: e,
|
|
1473
1491
|
fieldIndex: t
|
|
1474
1492
|
}), I(n));
|
|
1475
|
-
}, [a]),
|
|
1493
|
+
}, [a]), le = i(() => {
|
|
1476
1494
|
if (!M) return;
|
|
1477
1495
|
let e = F.trim();
|
|
1478
1496
|
if (e === "") {
|
|
@@ -1499,11 +1517,11 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1499
1517
|
F,
|
|
1500
1518
|
p,
|
|
1501
1519
|
_
|
|
1502
|
-
]),
|
|
1520
|
+
]), ue = i(() => {
|
|
1503
1521
|
N(null);
|
|
1504
|
-
}, []),
|
|
1522
|
+
}, []), de = i((e, t) => {
|
|
1505
1523
|
a || (R(e), ee(t));
|
|
1506
|
-
}, [a]),
|
|
1524
|
+
}, [a]), H = i(() => {
|
|
1507
1525
|
if (!L) return;
|
|
1508
1526
|
let e = z.trim();
|
|
1509
1527
|
if (e === "") {
|
|
@@ -1651,13 +1669,13 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1651
1669
|
let t = e.target.tagName;
|
|
1652
1670
|
if (t === "INPUT" || t === "TEXTAREA" || t === "SELECT") return;
|
|
1653
1671
|
let n = e.ctrlKey || e.metaKey;
|
|
1654
|
-
n && e.key === "z" ? (e.preventDefault(), p.undo()) : n && (e.key === "y" || e.shiftKey && e.key === "Z") ? (e.preventDefault(), p.redo()) : n && e.key === "c" ? (e.preventDefault(),
|
|
1672
|
+
n && e.key === "z" ? (e.preventDefault(), p.undo()) : n && (e.key === "y" || e.shiftKey && e.key === "Z") ? (e.preventDefault(), p.redo()) : n && e.key === "c" ? (e.preventDefault(), oe()) : n && e.key === "v" ? (e.preventDefault(), V()) : (e.key === "Delete" || e.key === "Backspace") && x.count > 0 ? (e.preventDefault(), re()) : e.key === "Escape" && (x.clearSelection(), N(null), R(null));
|
|
1655
1673
|
};
|
|
1656
1674
|
return e.addEventListener("keydown", t), () => e.removeEventListener("keydown", t);
|
|
1657
1675
|
}, [
|
|
1658
1676
|
p,
|
|
1677
|
+
oe,
|
|
1659
1678
|
V,
|
|
1660
|
-
H,
|
|
1661
1679
|
re,
|
|
1662
1680
|
x
|
|
1663
1681
|
]);
|
|
@@ -1673,7 +1691,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1673
1691
|
return /* @__PURE__ */ Y("div", {
|
|
1674
1692
|
ref: f,
|
|
1675
1693
|
tabIndex: 0,
|
|
1676
|
-
className:
|
|
1694
|
+
className: Tt("flex h-full w-full border rounded-lg overflow-hidden bg-background", d),
|
|
1677
1695
|
children: [
|
|
1678
1696
|
/* @__PURE__ */ Y("div", {
|
|
1679
1697
|
className: "flex flex-col flex-1 min-w-0",
|
|
@@ -1690,62 +1708,69 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1690
1708
|
/* @__PURE__ */ Y("div", {
|
|
1691
1709
|
className: "flex items-center gap-1 ml-2 border-l pl-2",
|
|
1692
1710
|
children: [/* @__PURE__ */ J("button", {
|
|
1711
|
+
type: "button",
|
|
1693
1712
|
onClick: () => p.undo(),
|
|
1694
1713
|
disabled: !p.canUndo,
|
|
1695
1714
|
"aria-label": "Undo",
|
|
1696
1715
|
title: "Undo (Ctrl+Z)",
|
|
1697
1716
|
className: "p-1 rounded hover:bg-accent disabled:opacity-40",
|
|
1698
|
-
children: /* @__PURE__ */ J(
|
|
1717
|
+
children: /* @__PURE__ */ J(Ne, { className: "h-3.5 w-3.5" })
|
|
1699
1718
|
}), /* @__PURE__ */ J("button", {
|
|
1719
|
+
type: "button",
|
|
1700
1720
|
onClick: () => p.redo(),
|
|
1701
1721
|
disabled: !p.canRedo,
|
|
1702
1722
|
"aria-label": "Redo",
|
|
1703
1723
|
title: "Redo (Ctrl+Y)",
|
|
1704
1724
|
className: "p-1 rounded hover:bg-accent disabled:opacity-40",
|
|
1705
|
-
children: /* @__PURE__ */ J(
|
|
1725
|
+
children: /* @__PURE__ */ J(xe, { className: "h-3.5 w-3.5" })
|
|
1706
1726
|
})]
|
|
1707
1727
|
}),
|
|
1708
1728
|
/* @__PURE__ */ Y("div", {
|
|
1709
1729
|
className: "flex items-center gap-1 border-l pl-2",
|
|
1710
1730
|
children: [
|
|
1711
1731
|
/* @__PURE__ */ J("button", {
|
|
1732
|
+
type: "button",
|
|
1712
1733
|
onClick: E.zoomOut,
|
|
1713
1734
|
"aria-label": "Zoom Out",
|
|
1714
1735
|
title: "Zoom Out",
|
|
1715
1736
|
className: "p-1 rounded hover:bg-accent",
|
|
1716
|
-
children: /* @__PURE__ */ J(
|
|
1737
|
+
children: /* @__PURE__ */ J(ze, { className: "h-3.5 w-3.5" })
|
|
1717
1738
|
}),
|
|
1718
1739
|
/* @__PURE__ */ Y("span", {
|
|
1719
1740
|
className: "text-xs tabular-nums w-10 text-center",
|
|
1720
1741
|
children: [Math.round(E.zoom * 100), "%"]
|
|
1721
1742
|
}),
|
|
1722
1743
|
/* @__PURE__ */ J("button", {
|
|
1744
|
+
type: "button",
|
|
1723
1745
|
onClick: E.zoomIn,
|
|
1724
1746
|
"aria-label": "Zoom In",
|
|
1725
1747
|
title: "Zoom In",
|
|
1726
1748
|
className: "p-1 rounded hover:bg-accent",
|
|
1727
|
-
children: /* @__PURE__ */ J(
|
|
1749
|
+
children: /* @__PURE__ */ J(Re, { className: "h-3.5 w-3.5" })
|
|
1728
1750
|
}),
|
|
1729
1751
|
/* @__PURE__ */ J("button", {
|
|
1752
|
+
type: "button",
|
|
1730
1753
|
onClick: E.resetZoom,
|
|
1731
1754
|
"aria-label": "Reset Zoom",
|
|
1732
1755
|
title: "Reset Zoom",
|
|
1733
1756
|
className: "p-1 rounded hover:bg-accent",
|
|
1734
|
-
children: /* @__PURE__ */ J(
|
|
1757
|
+
children: /* @__PURE__ */ J(Se, { className: "h-3 w-3" })
|
|
1735
1758
|
})
|
|
1736
1759
|
]
|
|
1737
1760
|
}),
|
|
1738
1761
|
!a && /* @__PURE__ */ Y("div", {
|
|
1739
1762
|
className: "flex items-center gap-1 border-l pl-2",
|
|
1740
1763
|
children: [/* @__PURE__ */ J("button", {
|
|
1741
|
-
|
|
1764
|
+
type: "button",
|
|
1765
|
+
onClick: oe,
|
|
1742
1766
|
disabled: x.count === 0,
|
|
1743
1767
|
"aria-label": "Copy",
|
|
1744
1768
|
title: "Copy (Ctrl+C)",
|
|
1745
1769
|
className: "p-1 rounded hover:bg-accent disabled:opacity-40",
|
|
1746
1770
|
children: /* @__PURE__ */ J(w, { className: "h-3.5 w-3.5" })
|
|
1747
1771
|
}), /* @__PURE__ */ J("button", {
|
|
1748
|
-
|
|
1772
|
+
type: "button",
|
|
1773
|
+
onClick: V,
|
|
1749
1774
|
disabled: !C.hasContent,
|
|
1750
1775
|
"aria-label": "Paste",
|
|
1751
1776
|
title: "Paste (Ctrl+V)",
|
|
@@ -1754,6 +1779,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1754
1779
|
})]
|
|
1755
1780
|
}),
|
|
1756
1781
|
!a && /* @__PURE__ */ Y("button", {
|
|
1782
|
+
type: "button",
|
|
1757
1783
|
onClick: ie,
|
|
1758
1784
|
"aria-label": "Auto Layout",
|
|
1759
1785
|
title: "Auto Layout",
|
|
@@ -1765,7 +1791,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1765
1791
|
className: "flex items-center gap-1 text-xs text-muted-foreground",
|
|
1766
1792
|
role: "status",
|
|
1767
1793
|
"aria-label": "Collaboration active",
|
|
1768
|
-
children: [/* @__PURE__ */ J(
|
|
1794
|
+
children: [/* @__PURE__ */ J(Ie, { className: "h-3 w-3" }), /* @__PURE__ */ Y("span", { children: [
|
|
1769
1795
|
D.users.length,
|
|
1770
1796
|
" user",
|
|
1771
1797
|
D.users.length === 1 ? "" : "s"
|
|
@@ -1776,11 +1802,13 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1776
1802
|
children: [x.count, " selected"]
|
|
1777
1803
|
}),
|
|
1778
1804
|
!a && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y("button", {
|
|
1805
|
+
type: "button",
|
|
1779
1806
|
onClick: te,
|
|
1780
1807
|
"aria-label": "Add Entity",
|
|
1781
1808
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded bg-primary text-primary-foreground hover:bg-primary/90",
|
|
1782
|
-
children: [/* @__PURE__ */ J(
|
|
1809
|
+
children: [/* @__PURE__ */ J(ye, { className: "h-3 w-3" }), " Add Entity"]
|
|
1783
1810
|
}), /* @__PURE__ */ Y("button", {
|
|
1811
|
+
type: "button",
|
|
1784
1812
|
"aria-label": "Add Relationship",
|
|
1785
1813
|
title: "Add Relationship (coming soon)",
|
|
1786
1814
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
@@ -1837,7 +1865,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1837
1865
|
"aria-label": e.label,
|
|
1838
1866
|
draggable: !a,
|
|
1839
1867
|
onDragStart: (t) => me(t, e.id),
|
|
1840
|
-
className:
|
|
1868
|
+
className: Tt("absolute rounded-lg border-2 bg-background shadow-sm w-60 select-none cursor-grab active:cursor-grabbing", x.isSelected(e.id) ? "border-primary ring-2 ring-primary/20" : "border-border hover:border-primary/50"),
|
|
1841
1869
|
style: {
|
|
1842
1870
|
left: e.position.x,
|
|
1843
1871
|
top: e.position.y
|
|
@@ -1853,9 +1881,9 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1853
1881
|
type: "text",
|
|
1854
1882
|
value: z,
|
|
1855
1883
|
onChange: (e) => ee(e.target.value),
|
|
1856
|
-
onBlur:
|
|
1884
|
+
onBlur: H,
|
|
1857
1885
|
onKeyDown: (e) => {
|
|
1858
|
-
e.key === "Enter" &&
|
|
1886
|
+
e.key === "Enter" && H(), e.key === "Escape" && fe();
|
|
1859
1887
|
},
|
|
1860
1888
|
className: "text-sm font-medium px-1 py-0 border rounded bg-background w-32 focus:outline-none focus:ring-1 focus:ring-primary",
|
|
1861
1889
|
autoFocus: !0,
|
|
@@ -1864,19 +1892,20 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1864
1892
|
}) : /* @__PURE__ */ J("span", {
|
|
1865
1893
|
className: "truncate cursor-text",
|
|
1866
1894
|
onDoubleClick: (t) => {
|
|
1867
|
-
t.stopPropagation(),
|
|
1895
|
+
t.stopPropagation(), de(e.id, e.label);
|
|
1868
1896
|
},
|
|
1869
1897
|
title: "Double-click to edit label",
|
|
1870
1898
|
"data-testid": `entity-label-${e.id}`,
|
|
1871
1899
|
children: e.label
|
|
1872
1900
|
}),
|
|
1873
1901
|
!a && /* @__PURE__ */ J("button", {
|
|
1902
|
+
type: "button",
|
|
1874
1903
|
onClick: (t) => {
|
|
1875
1904
|
t.stopPropagation(), ne(e.id);
|
|
1876
1905
|
},
|
|
1877
1906
|
"aria-label": `Delete ${e.label}`,
|
|
1878
1907
|
className: "ml-auto p-0.5 rounded hover:bg-destructive/20",
|
|
1879
|
-
children: /* @__PURE__ */ J(
|
|
1908
|
+
children: /* @__PURE__ */ J(Ae, { className: "h-3 w-3 text-destructive" })
|
|
1880
1909
|
})
|
|
1881
1910
|
]
|
|
1882
1911
|
}),
|
|
@@ -1889,17 +1918,17 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1889
1918
|
type: "text",
|
|
1890
1919
|
value: F,
|
|
1891
1920
|
onChange: (e) => I(e.target.value),
|
|
1892
|
-
onBlur:
|
|
1921
|
+
onBlur: le,
|
|
1893
1922
|
onKeyDown: (e) => {
|
|
1894
|
-
e.key === "Enter" &&
|
|
1923
|
+
e.key === "Enter" && le(), e.key === "Escape" && ue();
|
|
1895
1924
|
},
|
|
1896
1925
|
className: "font-mono text-xs px-1 py-0 border rounded bg-background w-24 focus:outline-none focus:ring-1 focus:ring-primary",
|
|
1897
1926
|
autoFocus: !0,
|
|
1898
1927
|
onClick: (e) => e.stopPropagation()
|
|
1899
1928
|
}) : /* @__PURE__ */ Y("span", {
|
|
1900
|
-
className:
|
|
1929
|
+
className: Tt("font-mono cursor-text", t.primaryKey && "font-bold text-primary"),
|
|
1901
1930
|
onClick: (r) => {
|
|
1902
|
-
r.stopPropagation(),
|
|
1931
|
+
r.stopPropagation(), ce(e.id, n, t.name);
|
|
1903
1932
|
},
|
|
1904
1933
|
title: "Click to edit field name",
|
|
1905
1934
|
children: [t.primaryKey && /* @__PURE__ */ J("span", {
|
|
@@ -1918,7 +1947,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1918
1947
|
onClick: (e) => e.stopPropagation(),
|
|
1919
1948
|
className: "text-xs text-muted-foreground ml-auto bg-transparent border-none focus:ring-1 focus:ring-primary rounded cursor-pointer p-0",
|
|
1920
1949
|
"data-testid": `field-type-${e.id}-${n}`,
|
|
1921
|
-
children:
|
|
1950
|
+
children: Et.map((e) => /* @__PURE__ */ J("option", {
|
|
1922
1951
|
value: e,
|
|
1923
1952
|
children: e
|
|
1924
1953
|
}, e))
|
|
@@ -1933,18 +1962,19 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1933
1962
|
!a && /* @__PURE__ */ J("div", {
|
|
1934
1963
|
className: "px-3 py-1 border-t",
|
|
1935
1964
|
children: /* @__PURE__ */ Y("button", {
|
|
1965
|
+
type: "button",
|
|
1936
1966
|
onClick: (t) => {
|
|
1937
|
-
t.stopPropagation(),
|
|
1967
|
+
t.stopPropagation(), se(e.id);
|
|
1938
1968
|
},
|
|
1939
1969
|
"aria-label": `Add field to ${e.label}`,
|
|
1940
1970
|
className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground w-full py-0.5",
|
|
1941
|
-
children: [/* @__PURE__ */ J(
|
|
1971
|
+
children: [/* @__PURE__ */ J(ye, { className: "h-3 w-3" }), " Add Field"]
|
|
1942
1972
|
})
|
|
1943
1973
|
})
|
|
1944
1974
|
]
|
|
1945
1975
|
}, e.id))
|
|
1946
1976
|
]
|
|
1947
|
-
}), A && m.length > 0 && /* @__PURE__ */ J(
|
|
1977
|
+
}), A && m.length > 0 && /* @__PURE__ */ J(ht, {
|
|
1948
1978
|
items: ve,
|
|
1949
1979
|
canvasWidth: n.width,
|
|
1950
1980
|
canvasHeight: n.height,
|
|
@@ -1958,6 +1988,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1958
1988
|
children: [/* @__PURE__ */ Y("div", {
|
|
1959
1989
|
className: "flex flex-col flex-1 min-h-0",
|
|
1960
1990
|
children: [/* @__PURE__ */ Y("button", {
|
|
1991
|
+
type: "button",
|
|
1961
1992
|
onClick: () => k((e) => !e),
|
|
1962
1993
|
className: "flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50 border-b",
|
|
1963
1994
|
"aria-expanded": O,
|
|
@@ -1966,7 +1997,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1966
1997
|
}), O && /* @__PURE__ */ J("div", {
|
|
1967
1998
|
id: "property-editor-panel",
|
|
1968
1999
|
className: "flex-1 overflow-y-auto",
|
|
1969
|
-
children: /* @__PURE__ */ J(
|
|
2000
|
+
children: /* @__PURE__ */ J(ft, {
|
|
1970
2001
|
title: U ? U.label : "Properties",
|
|
1971
2002
|
fields: W,
|
|
1972
2003
|
onChange: _e
|
|
@@ -1975,6 +2006,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1975
2006
|
}), /* @__PURE__ */ J("div", {
|
|
1976
2007
|
className: "border-t",
|
|
1977
2008
|
children: /* @__PURE__ */ Y("button", {
|
|
2009
|
+
type: "button",
|
|
1978
2010
|
onClick: () => j((e) => !e),
|
|
1979
2011
|
className: "flex items-center gap-1 px-3 py-2 text-xs font-medium text-muted-foreground hover:bg-accent/50 w-full",
|
|
1980
2012
|
"aria-expanded": A,
|
|
@@ -1982,7 +2014,7 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1982
2014
|
})
|
|
1983
2015
|
})]
|
|
1984
2016
|
}),
|
|
1985
|
-
/* @__PURE__ */ J(
|
|
2017
|
+
/* @__PURE__ */ J(ut, {
|
|
1986
2018
|
isOpen: y.isOpen,
|
|
1987
2019
|
title: y.title,
|
|
1988
2020
|
message: y.message,
|
|
@@ -1995,11 +2027,11 @@ function Et({ entities: e = [], relationships: t = [], canvas: n = {
|
|
|
1995
2027
|
}
|
|
1996
2028
|
//#endregion
|
|
1997
2029
|
//#region src/ProcessDesigner.tsx
|
|
1998
|
-
function
|
|
2030
|
+
function kt(...e) {
|
|
1999
2031
|
return K(G(e));
|
|
2000
2032
|
}
|
|
2001
|
-
var
|
|
2002
|
-
function
|
|
2033
|
+
var At = 120, jt = 50;
|
|
2034
|
+
function Mt(e, t) {
|
|
2003
2035
|
if (e.length === 0) return e;
|
|
2004
2036
|
let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
|
|
2005
2037
|
for (let t of e) n.set(t.id, 0), r.set(t.id, []);
|
|
@@ -2027,12 +2059,12 @@ function At(e, t) {
|
|
|
2027
2059
|
position: c.get(e.id) ?? e.position
|
|
2028
2060
|
}));
|
|
2029
2061
|
}
|
|
2030
|
-
function
|
|
2062
|
+
function Nt({ processName: e = "New Process", nodes: t = [], edges: n = [], lanes: r, canvas: a = {
|
|
2031
2063
|
width: 1400,
|
|
2032
2064
|
height: 800,
|
|
2033
2065
|
showGrid: !0
|
|
2034
2066
|
}, showMinimap: u = !0, showToolbar: d = !0, readOnly: f = !1, onNodesChange: p, onEdgesChange: m, className: h }) {
|
|
2035
|
-
let g =
|
|
2067
|
+
let g = it({
|
|
2036
2068
|
nodes: t,
|
|
2037
2069
|
edges: n
|
|
2038
2070
|
}, { maxHistory: 50 }), _ = g.current.nodes, v = g.current.edges, y = i((e, t) => {
|
|
@@ -2044,14 +2076,14 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2044
2076
|
g,
|
|
2045
2077
|
p,
|
|
2046
2078
|
m
|
|
2047
|
-
]), x =
|
|
2079
|
+
]), x = at(), S = ot(), C = st(), T = ct({ initialZoom: 1 }), D = yt(), [O, k] = l(null), [A, j] = l(!1), [N, P] = l(null), [F, I] = l(null), [L, R] = l(!0), [z, ee] = l(null), [te, ne] = l({
|
|
2048
2080
|
x: 0,
|
|
2049
2081
|
y: 0
|
|
2050
|
-
}), re = c(null),
|
|
2051
|
-
|
|
2052
|
-
|
|
2082
|
+
}), re = c(null), ae = c(p), oe = c(m);
|
|
2083
|
+
ae.current = p, oe.current = m, o(() => {
|
|
2084
|
+
ae.current?.(_), oe.current?.(v);
|
|
2053
2085
|
}, [g.current]);
|
|
2054
|
-
let
|
|
2086
|
+
let V = i((e, t) => {
|
|
2055
2087
|
if (f) return;
|
|
2056
2088
|
let n = {
|
|
2057
2089
|
id: `node-${Date.now()}`,
|
|
@@ -2075,7 +2107,7 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2075
2107
|
y,
|
|
2076
2108
|
S,
|
|
2077
2109
|
D
|
|
2078
|
-
]),
|
|
2110
|
+
]), se = i(async (e) => {
|
|
2079
2111
|
if (f) return;
|
|
2080
2112
|
let t = _.find((t) => t.id === e);
|
|
2081
2113
|
if (!await x.confirm("Delete Node", `Are you sure you want to delete "${t?.label ?? e}"? This will also remove all connected edges.`)) return;
|
|
@@ -2095,7 +2127,7 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2095
2127
|
x,
|
|
2096
2128
|
S,
|
|
2097
2129
|
D
|
|
2098
|
-
]),
|
|
2130
|
+
]), ce = i(async () => {
|
|
2099
2131
|
if (f || S.count === 0 || !await x.confirm("Delete Selected Nodes", `Are you sure you want to delete ${S.count} selected node(s) and their connected edges?`)) return;
|
|
2100
2132
|
let e = S.selectedIds, t = _.filter((t) => !e.has(t.id)), n = v.filter((t) => !e.has(t.source) && !e.has(t.target));
|
|
2101
2133
|
y(t, n), k(null), S.clearSelection();
|
|
@@ -2106,7 +2138,7 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2106
2138
|
y,
|
|
2107
2139
|
x,
|
|
2108
2140
|
S
|
|
2109
|
-
]),
|
|
2141
|
+
]), le = i(() => {
|
|
2110
2142
|
let e = S.count > 0 ? S.selectedIds : O ? /* @__PURE__ */ new Set([O]) : /* @__PURE__ */ new Set();
|
|
2111
2143
|
if (e.size === 0) return;
|
|
2112
2144
|
let t = _.filter((t) => e.has(t.id));
|
|
@@ -2116,7 +2148,7 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2116
2148
|
O,
|
|
2117
2149
|
S,
|
|
2118
2150
|
C
|
|
2119
|
-
]),
|
|
2151
|
+
]), ue = i(() => {
|
|
2120
2152
|
if (f) return;
|
|
2121
2153
|
let e = C.paste();
|
|
2122
2154
|
if (!e || e.length === 0) return;
|
|
@@ -2136,9 +2168,9 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2136
2168
|
C,
|
|
2137
2169
|
y,
|
|
2138
2170
|
S
|
|
2139
|
-
]),
|
|
2171
|
+
]), de = i(() => {
|
|
2140
2172
|
j((e) => !e || (P(null), !1));
|
|
2141
|
-
}, []),
|
|
2173
|
+
}, []), H = i((e) => {
|
|
2142
2174
|
if (!A) return !1;
|
|
2143
2175
|
if (!N) return P(e), !0;
|
|
2144
2176
|
if (N === e) return !0;
|
|
@@ -2165,7 +2197,7 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2165
2197
|
D
|
|
2166
2198
|
]), fe = i(() => {
|
|
2167
2199
|
if (f || _.length === 0) return;
|
|
2168
|
-
let e =
|
|
2200
|
+
let e = Mt(_, v);
|
|
2169
2201
|
y(e, v);
|
|
2170
2202
|
}, [
|
|
2171
2203
|
_,
|
|
@@ -2199,7 +2231,7 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2199
2231
|
T.zoom,
|
|
2200
2232
|
T.panOffset,
|
|
2201
2233
|
y
|
|
2202
|
-
]),
|
|
2234
|
+
]), U = i((e) => {
|
|
2203
2235
|
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
2204
2236
|
}, []), W = s(() => _.find((e) => e.id === O) ?? null, [_, O]), _e = s(() => W ? [
|
|
2205
2237
|
{
|
|
@@ -2257,7 +2289,7 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2257
2289
|
value: W.description ?? "",
|
|
2258
2290
|
group: "General"
|
|
2259
2291
|
}
|
|
2260
|
-
] : [], [W]),
|
|
2292
|
+
] : [], [W]), ye = i((e, t) => {
|
|
2261
2293
|
if (f || !O) return;
|
|
2262
2294
|
let n = _.map((n) => n.id === O ? {
|
|
2263
2295
|
...n,
|
|
@@ -2283,12 +2315,12 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2283
2315
|
case "script-task": return "rounded bg-purple-100 border-purple-500 text-purple-700";
|
|
2284
2316
|
default: return "rounded bg-gray-100 border-gray-500 text-gray-700";
|
|
2285
2317
|
}
|
|
2286
|
-
},
|
|
2318
|
+
}, Ce = s(() => _.map((e) => ({
|
|
2287
2319
|
id: e.id,
|
|
2288
2320
|
x: e.position.x,
|
|
2289
2321
|
y: e.position.y,
|
|
2290
|
-
width:
|
|
2291
|
-
height:
|
|
2322
|
+
width: At,
|
|
2323
|
+
height: jt,
|
|
2292
2324
|
selected: S.isSelected(e.id) || e.id === O
|
|
2293
2325
|
})), [
|
|
2294
2326
|
_,
|
|
@@ -2311,15 +2343,15 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2311
2343
|
return;
|
|
2312
2344
|
}
|
|
2313
2345
|
if (n && e.key === "c") {
|
|
2314
|
-
e.preventDefault(),
|
|
2346
|
+
e.preventDefault(), le();
|
|
2315
2347
|
return;
|
|
2316
2348
|
}
|
|
2317
2349
|
if (n && e.key === "v") {
|
|
2318
|
-
e.preventDefault(),
|
|
2350
|
+
e.preventDefault(), ue();
|
|
2319
2351
|
return;
|
|
2320
2352
|
}
|
|
2321
2353
|
if (e.key === "Delete" || e.key === "Backspace") {
|
|
2322
|
-
S.count > 0 ? (e.preventDefault(),
|
|
2354
|
+
S.count > 0 ? (e.preventDefault(), ce()) : O && (e.preventDefault(), se(O));
|
|
2323
2355
|
return;
|
|
2324
2356
|
}
|
|
2325
2357
|
if (e.key === "Escape") {
|
|
@@ -2333,10 +2365,10 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2333
2365
|
A,
|
|
2334
2366
|
S,
|
|
2335
2367
|
g,
|
|
2336
|
-
ce,
|
|
2337
2368
|
le,
|
|
2338
|
-
|
|
2339
|
-
se
|
|
2369
|
+
ue,
|
|
2370
|
+
se,
|
|
2371
|
+
ce
|
|
2340
2372
|
]);
|
|
2341
2373
|
let we = i((e) => {
|
|
2342
2374
|
e.target === e.currentTarget && (k(null), S.clearSelection(), A && (j(!1), P(null)));
|
|
@@ -2344,9 +2376,9 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2344
2376
|
return /* @__PURE__ */ Y("div", {
|
|
2345
2377
|
ref: re,
|
|
2346
2378
|
tabIndex: 0,
|
|
2347
|
-
className:
|
|
2379
|
+
className: kt("flex flex-col h-full w-full border rounded-lg overflow-hidden bg-background", h),
|
|
2348
2380
|
children: [
|
|
2349
|
-
/* @__PURE__ */ J(
|
|
2381
|
+
/* @__PURE__ */ J(ut, {
|
|
2350
2382
|
isOpen: x.isOpen,
|
|
2351
2383
|
title: x.title,
|
|
2352
2384
|
message: x.message,
|
|
@@ -2381,24 +2413,27 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2381
2413
|
className: "flex items-center gap-1",
|
|
2382
2414
|
children: [
|
|
2383
2415
|
/* @__PURE__ */ J("button", {
|
|
2416
|
+
type: "button",
|
|
2384
2417
|
onClick: () => g.undo(),
|
|
2385
2418
|
disabled: !g.canUndo,
|
|
2386
2419
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40",
|
|
2387
2420
|
title: "Undo (Ctrl+Z)",
|
|
2388
2421
|
"aria-label": "Undo",
|
|
2389
|
-
children: /* @__PURE__ */ J(
|
|
2422
|
+
children: /* @__PURE__ */ J(Ne, { className: "h-3 w-3" })
|
|
2390
2423
|
}),
|
|
2391
2424
|
/* @__PURE__ */ J("button", {
|
|
2425
|
+
type: "button",
|
|
2392
2426
|
onClick: () => g.redo(),
|
|
2393
2427
|
disabled: !g.canRedo,
|
|
2394
2428
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40",
|
|
2395
2429
|
title: "Redo (Ctrl+Y)",
|
|
2396
2430
|
"aria-label": "Redo",
|
|
2397
|
-
children: /* @__PURE__ */ J(
|
|
2431
|
+
children: /* @__PURE__ */ J(xe, { className: "h-3 w-3" })
|
|
2398
2432
|
}),
|
|
2399
2433
|
/* @__PURE__ */ J("div", { className: "w-px h-4 bg-border mx-1" }),
|
|
2400
2434
|
/* @__PURE__ */ J("button", {
|
|
2401
|
-
|
|
2435
|
+
type: "button",
|
|
2436
|
+
onClick: le,
|
|
2402
2437
|
disabled: S.count === 0 && !O,
|
|
2403
2438
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40",
|
|
2404
2439
|
title: "Copy (Ctrl+C)",
|
|
@@ -2406,7 +2441,8 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2406
2441
|
children: /* @__PURE__ */ J(w, { className: "h-3 w-3" })
|
|
2407
2442
|
}),
|
|
2408
2443
|
/* @__PURE__ */ J("button", {
|
|
2409
|
-
|
|
2444
|
+
type: "button",
|
|
2445
|
+
onClick: ue,
|
|
2410
2446
|
disabled: !C.hasContent,
|
|
2411
2447
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent disabled:opacity-40",
|
|
2412
2448
|
title: "Paste (Ctrl+V)",
|
|
@@ -2415,14 +2451,16 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2415
2451
|
}),
|
|
2416
2452
|
/* @__PURE__ */ J("div", { className: "w-px h-4 bg-border mx-1" }),
|
|
2417
2453
|
/* @__PURE__ */ Y("button", {
|
|
2418
|
-
|
|
2419
|
-
|
|
2454
|
+
type: "button",
|
|
2455
|
+
onClick: de,
|
|
2456
|
+
className: kt("flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent", A && "bg-primary text-primary-foreground"),
|
|
2420
2457
|
title: "Connect nodes",
|
|
2421
2458
|
"aria-label": "Connect nodes",
|
|
2422
2459
|
"aria-pressed": A,
|
|
2423
|
-
children: [/* @__PURE__ */ J(
|
|
2460
|
+
children: [/* @__PURE__ */ J(ie, { className: "h-3 w-3" }), " Connect"]
|
|
2424
2461
|
}),
|
|
2425
2462
|
/* @__PURE__ */ Y("button", {
|
|
2463
|
+
type: "button",
|
|
2426
2464
|
onClick: fe,
|
|
2427
2465
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",
|
|
2428
2466
|
title: "Auto layout",
|
|
@@ -2431,11 +2469,12 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2431
2469
|
}),
|
|
2432
2470
|
/* @__PURE__ */ J("div", { className: "w-px h-4 bg-border mx-1" }),
|
|
2433
2471
|
/* @__PURE__ */ J("button", {
|
|
2472
|
+
type: "button",
|
|
2434
2473
|
onClick: T.zoomIn,
|
|
2435
2474
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",
|
|
2436
2475
|
title: "Zoom in",
|
|
2437
2476
|
"aria-label": "Zoom in",
|
|
2438
|
-
children: /* @__PURE__ */ J(
|
|
2477
|
+
children: /* @__PURE__ */ J(Re, { className: "h-3 w-3" })
|
|
2439
2478
|
}),
|
|
2440
2479
|
/* @__PURE__ */ Y("span", {
|
|
2441
2480
|
className: "text-xs tabular-nums min-w-[3ch] text-center",
|
|
@@ -2443,56 +2482,63 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2443
2482
|
children: [Math.round(T.zoom * 100), "%"]
|
|
2444
2483
|
}),
|
|
2445
2484
|
/* @__PURE__ */ J("button", {
|
|
2485
|
+
type: "button",
|
|
2446
2486
|
onClick: T.zoomOut,
|
|
2447
2487
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",
|
|
2448
2488
|
title: "Zoom out",
|
|
2449
2489
|
"aria-label": "Zoom out",
|
|
2450
|
-
children: /* @__PURE__ */ J(
|
|
2490
|
+
children: /* @__PURE__ */ J(ze, { className: "h-3 w-3" })
|
|
2451
2491
|
}),
|
|
2452
2492
|
/* @__PURE__ */ J("button", {
|
|
2493
|
+
type: "button",
|
|
2453
2494
|
onClick: T.resetZoom,
|
|
2454
2495
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",
|
|
2455
2496
|
title: "Reset zoom",
|
|
2456
2497
|
"aria-label": "Reset zoom",
|
|
2457
|
-
children: /* @__PURE__ */ J(
|
|
2498
|
+
children: /* @__PURE__ */ J(Se, { className: "h-3 w-3" })
|
|
2458
2499
|
}),
|
|
2459
2500
|
/* @__PURE__ */ J("div", { className: "w-px h-4 bg-border mx-1" }),
|
|
2460
2501
|
/* @__PURE__ */ Y("button", {
|
|
2461
|
-
|
|
2502
|
+
type: "button",
|
|
2503
|
+
onClick: () => V("start-event", "Start"),
|
|
2462
2504
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",
|
|
2463
2505
|
title: "Add Start Event",
|
|
2464
2506
|
"aria-label": "Add Start Event",
|
|
2465
|
-
children: [/* @__PURE__ */ J(
|
|
2507
|
+
children: [/* @__PURE__ */ J(ve, { className: "h-3 w-3 text-green-600" }), " Start"]
|
|
2466
2508
|
}),
|
|
2467
2509
|
/* @__PURE__ */ Y("button", {
|
|
2468
|
-
|
|
2510
|
+
type: "button",
|
|
2511
|
+
onClick: () => V("user-task", "User Task"),
|
|
2469
2512
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",
|
|
2470
2513
|
title: "Add User Task",
|
|
2471
2514
|
"aria-label": "Add User Task",
|
|
2472
|
-
children: [/* @__PURE__ */ J(
|
|
2515
|
+
children: [/* @__PURE__ */ J(Te, { className: "h-3 w-3 text-blue-600" }), " Task"]
|
|
2473
2516
|
}),
|
|
2474
2517
|
/* @__PURE__ */ Y("button", {
|
|
2475
|
-
|
|
2518
|
+
type: "button",
|
|
2519
|
+
onClick: () => V("exclusive-gateway", "Decision"),
|
|
2476
2520
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",
|
|
2477
2521
|
title: "Add Gateway",
|
|
2478
2522
|
"aria-label": "Add Gateway",
|
|
2479
2523
|
children: [/* @__PURE__ */ J(E, { className: "h-3 w-3 text-yellow-600" }), " Gateway"]
|
|
2480
2524
|
}),
|
|
2481
2525
|
/* @__PURE__ */ Y("button", {
|
|
2482
|
-
|
|
2526
|
+
type: "button",
|
|
2527
|
+
onClick: () => V("end-event", "End"),
|
|
2483
2528
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",
|
|
2484
2529
|
title: "Add End Event",
|
|
2485
2530
|
"aria-label": "Add End Event",
|
|
2486
|
-
children: [/* @__PURE__ */ J(
|
|
2531
|
+
children: [/* @__PURE__ */ J(Te, { className: "h-3 w-3 text-red-600" }), " End"]
|
|
2487
2532
|
}),
|
|
2488
2533
|
/* @__PURE__ */ J("div", { className: "w-px h-4 bg-border mx-1" }),
|
|
2489
2534
|
/* @__PURE__ */ J("button", {
|
|
2535
|
+
type: "button",
|
|
2490
2536
|
onClick: () => R((e) => !e),
|
|
2491
2537
|
className: "flex items-center gap-1 px-2 py-1 text-xs rounded hover:bg-accent",
|
|
2492
2538
|
title: L ? "Hide properties" : "Show properties",
|
|
2493
2539
|
"aria-label": L ? "Hide property panel" : "Show property panel",
|
|
2494
2540
|
"aria-expanded": L,
|
|
2495
|
-
children: J(L ?
|
|
2541
|
+
children: J(L ? he : ge, { className: "h-3 w-3" })
|
|
2496
2542
|
})
|
|
2497
2543
|
]
|
|
2498
2544
|
})
|
|
@@ -2517,7 +2563,7 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2517
2563
|
},
|
|
2518
2564
|
onClick: we,
|
|
2519
2565
|
onDrop: me,
|
|
2520
|
-
onDragOver:
|
|
2566
|
+
onDragOver: U,
|
|
2521
2567
|
children: [
|
|
2522
2568
|
/* @__PURE__ */ Y("svg", {
|
|
2523
2569
|
className: "absolute inset-0 pointer-events-none",
|
|
@@ -2537,10 +2583,10 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2537
2583
|
}) }), v.map((e) => {
|
|
2538
2584
|
let t = _.find((t) => t.id === e.source), n = _.find((t) => t.id === e.target);
|
|
2539
2585
|
if (!t || !n) return null;
|
|
2540
|
-
t.position.x +
|
|
2541
|
-
let r = t.position.y +
|
|
2542
|
-
n.position.x +
|
|
2543
|
-
let i = n.position.y +
|
|
2586
|
+
t.position.x + At / 2;
|
|
2587
|
+
let r = t.position.y + jt / 2;
|
|
2588
|
+
n.position.x + At / 2;
|
|
2589
|
+
let i = n.position.y + jt / 2, a = t.position.x + At, o = r, s = n.position.x, c = i, l = `M ${a} ${o} Q ${(a + s) / 2} ${o}, ${(a + s) / 2} ${(o + c) / 2} T ${s} ${c}`;
|
|
2544
2590
|
return /* @__PURE__ */ Y("g", { children: [/* @__PURE__ */ J("path", {
|
|
2545
2591
|
d: l,
|
|
2546
2592
|
fill: "none",
|
|
@@ -2575,13 +2621,13 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2575
2621
|
onMouseEnter: () => I(e.id),
|
|
2576
2622
|
onMouseLeave: () => I(null),
|
|
2577
2623
|
onClick: (t) => {
|
|
2578
|
-
|
|
2624
|
+
H(e.id) || (t.shiftKey ? S.toggle(e.id, !0) : (k(e.id), S.selectOne(e.id)));
|
|
2579
2625
|
},
|
|
2580
2626
|
children: [
|
|
2581
2627
|
/* @__PURE__ */ J("div", {
|
|
2582
|
-
className:
|
|
2628
|
+
className: kt("flex items-center justify-center border-2 min-w-[120px] min-h-[50px] px-3 py-2 transition-shadow", be(e.type), t && "ring-2 ring-primary shadow-md", n && "ring-2 ring-blue-400 shadow-lg", A && !n && "cursor-crosshair"),
|
|
2583
2629
|
children: /* @__PURE__ */ J("span", {
|
|
2584
|
-
className:
|
|
2630
|
+
className: kt("text-xs font-medium", (e.type === "exclusive-gateway" || e.type === "parallel-gateway" || e.type === "inclusive-gateway" || e.type === "event-based-gateway") && "-rotate-45"),
|
|
2585
2631
|
children: e.label
|
|
2586
2632
|
})
|
|
2587
2633
|
}),
|
|
@@ -2590,60 +2636,61 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2590
2636
|
className: "absolute w-3 h-3 rounded-full bg-blue-500 border-2 border-white shadow cursor-crosshair",
|
|
2591
2637
|
style: {
|
|
2592
2638
|
left: -6,
|
|
2593
|
-
top:
|
|
2639
|
+
top: jt / 2 - 6
|
|
2594
2640
|
},
|
|
2595
2641
|
title: "Input port",
|
|
2596
2642
|
onClick: (t) => {
|
|
2597
|
-
t.stopPropagation(),
|
|
2643
|
+
t.stopPropagation(), H(e.id);
|
|
2598
2644
|
}
|
|
2599
2645
|
}),
|
|
2600
2646
|
/* @__PURE__ */ J("div", {
|
|
2601
2647
|
className: "absolute w-3 h-3 rounded-full bg-blue-500 border-2 border-white shadow cursor-crosshair",
|
|
2602
2648
|
style: {
|
|
2603
2649
|
right: -6,
|
|
2604
|
-
top:
|
|
2650
|
+
top: jt / 2 - 6
|
|
2605
2651
|
},
|
|
2606
2652
|
title: "Output port",
|
|
2607
2653
|
onClick: (t) => {
|
|
2608
|
-
t.stopPropagation(), A ?
|
|
2654
|
+
t.stopPropagation(), A ? H(e.id) : (j(!0), P(e.id));
|
|
2609
2655
|
}
|
|
2610
2656
|
}),
|
|
2611
2657
|
/* @__PURE__ */ J("div", {
|
|
2612
2658
|
className: "absolute w-3 h-3 rounded-full bg-blue-400 border-2 border-white shadow cursor-crosshair",
|
|
2613
2659
|
style: {
|
|
2614
|
-
left:
|
|
2660
|
+
left: At / 2 - 6,
|
|
2615
2661
|
top: -6
|
|
2616
2662
|
},
|
|
2617
2663
|
title: "Port",
|
|
2618
2664
|
onClick: (t) => {
|
|
2619
|
-
t.stopPropagation(),
|
|
2665
|
+
t.stopPropagation(), H(e.id);
|
|
2620
2666
|
}
|
|
2621
2667
|
}),
|
|
2622
2668
|
/* @__PURE__ */ J("div", {
|
|
2623
2669
|
className: "absolute w-3 h-3 rounded-full bg-blue-400 border-2 border-white shadow cursor-crosshair",
|
|
2624
2670
|
style: {
|
|
2625
|
-
left:
|
|
2671
|
+
left: At / 2 - 6,
|
|
2626
2672
|
bottom: -6
|
|
2627
2673
|
},
|
|
2628
2674
|
title: "Port",
|
|
2629
2675
|
onClick: (t) => {
|
|
2630
|
-
t.stopPropagation(),
|
|
2676
|
+
t.stopPropagation(), H(e.id);
|
|
2631
2677
|
}
|
|
2632
2678
|
})
|
|
2633
2679
|
] }),
|
|
2634
2680
|
!f && t && !A && /* @__PURE__ */ J("button", {
|
|
2681
|
+
type: "button",
|
|
2635
2682
|
onClick: (t) => {
|
|
2636
|
-
t.stopPropagation(),
|
|
2683
|
+
t.stopPropagation(), se(e.id);
|
|
2637
2684
|
},
|
|
2638
2685
|
className: "absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow",
|
|
2639
2686
|
"aria-label": "Delete node",
|
|
2640
|
-
children: /* @__PURE__ */ J(
|
|
2687
|
+
children: /* @__PURE__ */ J(Ae, { className: "h-3 w-3" })
|
|
2641
2688
|
})
|
|
2642
2689
|
]
|
|
2643
2690
|
}, e.id);
|
|
2644
2691
|
}),
|
|
2645
|
-
u && _.length > 0 && /* @__PURE__ */ J(
|
|
2646
|
-
items:
|
|
2692
|
+
u && _.length > 0 && /* @__PURE__ */ J(ht, {
|
|
2693
|
+
items: Ce,
|
|
2647
2694
|
canvasWidth: a.width ?? 1400,
|
|
2648
2695
|
canvasHeight: a.height ?? 800,
|
|
2649
2696
|
position: "bottom-right"
|
|
@@ -2654,10 +2701,10 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2654
2701
|
className: "w-64 border-l bg-background overflow-y-auto shrink-0",
|
|
2655
2702
|
role: "complementary",
|
|
2656
2703
|
"aria-label": "Property panel",
|
|
2657
|
-
children: /* @__PURE__ */ J(
|
|
2704
|
+
children: /* @__PURE__ */ J(ft, {
|
|
2658
2705
|
title: W ? `Properties: ${W.label}` : "Properties",
|
|
2659
2706
|
fields: _e,
|
|
2660
|
-
onChange:
|
|
2707
|
+
onChange: ye
|
|
2661
2708
|
})
|
|
2662
2709
|
})]
|
|
2663
2710
|
})
|
|
@@ -2666,7 +2713,7 @@ function jt({ processName: e = "New Process", nodes: t = [], edges: n = [], lane
|
|
|
2666
2713
|
}
|
|
2667
2714
|
//#endregion
|
|
2668
2715
|
//#region src/ReportDesigner.tsx
|
|
2669
|
-
function
|
|
2716
|
+
function Pt(...e) {
|
|
2670
2717
|
return K(G(e));
|
|
2671
2718
|
}
|
|
2672
2719
|
var Z = {
|
|
@@ -2719,7 +2766,7 @@ var Z = {
|
|
|
2719
2766
|
groupSize: "Size",
|
|
2720
2767
|
groupContent: "Content",
|
|
2721
2768
|
groupGeneral: "General"
|
|
2722
|
-
},
|
|
2769
|
+
}, Ft = {
|
|
2723
2770
|
A4: {
|
|
2724
2771
|
width: 595,
|
|
2725
2772
|
height: 842
|
|
@@ -2740,7 +2787,7 @@ var Z = {
|
|
|
2740
2787
|
width: 792,
|
|
2741
2788
|
height: 1224
|
|
2742
2789
|
}
|
|
2743
|
-
},
|
|
2790
|
+
}, It = [
|
|
2744
2791
|
{
|
|
2745
2792
|
type: "header",
|
|
2746
2793
|
height: 80,
|
|
@@ -2758,23 +2805,23 @@ var Z = {
|
|
|
2758
2805
|
elements: []
|
|
2759
2806
|
}
|
|
2760
2807
|
];
|
|
2761
|
-
function
|
|
2808
|
+
function Lt({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4", orientation: r = "portrait", margins: a = {
|
|
2762
2809
|
top: 40,
|
|
2763
2810
|
right: 40,
|
|
2764
2811
|
bottom: 40,
|
|
2765
2812
|
left: 40
|
|
2766
2813
|
}, sections: u = [], showToolbar: d = !0, showPropertyPanel: f = !0, readOnly: m = !1, onSectionsChange: h, className: g }) {
|
|
2767
|
-
let _ =
|
|
2814
|
+
let _ = it(u.length > 0 ? u : It), v = _.current, y = i((e) => {
|
|
2768
2815
|
_.push(e), h?.(e);
|
|
2769
|
-
}, [_, h]), x =
|
|
2816
|
+
}, [_, h]), x = ot(), S = s(() => {
|
|
2770
2817
|
let e = Array.from(x.selectedIds);
|
|
2771
2818
|
return e.length > 0 ? e[0] : null;
|
|
2772
|
-
}, [x.selectedIds]), C =
|
|
2819
|
+
}, [x.selectedIds]), C = st(), T = at(), E = yt(), D = i((e) => {
|
|
2773
2820
|
E && E.sendOperation({
|
|
2774
2821
|
...e,
|
|
2775
2822
|
userId: E.currentUserId ?? ""
|
|
2776
2823
|
});
|
|
2777
|
-
}, [E]), [O, k] = l(!0), j = c(null), M = c(null), N =
|
|
2824
|
+
}, [E]), [O, k] = l(!0), j = c(null), M = c(null), N = Ft[n], P = r === "landscape" ? N.height : N.width, F = r === "landscape" ? N.width : N.height, I = (e) => {
|
|
2778
2825
|
switch (e) {
|
|
2779
2826
|
case "header": return Z.sectionHeader;
|
|
2780
2827
|
case "page-header": return Z.sectionPageHeader;
|
|
@@ -2946,9 +2993,9 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
2946
2993
|
startX: e.clientX,
|
|
2947
2994
|
startY: e.clientY
|
|
2948
2995
|
}, e.dataTransfer.effectAllowed = "move", e.dataTransfer.setData("text/plain", t.id));
|
|
2949
|
-
}, [m]),
|
|
2996
|
+
}, [m]), ae = i((e) => {
|
|
2950
2997
|
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
2951
|
-
}, []),
|
|
2998
|
+
}, []), oe = i((e, t) => {
|
|
2952
2999
|
e.preventDefault();
|
|
2953
3000
|
let n = j.current;
|
|
2954
3001
|
if (!n || m) return;
|
|
@@ -3000,7 +3047,7 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3000
3047
|
v,
|
|
3001
3048
|
y,
|
|
3002
3049
|
D
|
|
3003
|
-
]),
|
|
3050
|
+
]), V = s(() => {
|
|
3004
3051
|
if (!L) return [];
|
|
3005
3052
|
let e = [
|
|
3006
3053
|
{
|
|
@@ -3100,7 +3147,7 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3100
3147
|
]), /* @__PURE__ */ Y("div", {
|
|
3101
3148
|
ref: M,
|
|
3102
3149
|
tabIndex: 0,
|
|
3103
|
-
className:
|
|
3150
|
+
className: Pt("flex h-full w-full border rounded-lg overflow-hidden bg-background", g),
|
|
3104
3151
|
children: [
|
|
3105
3152
|
/* @__PURE__ */ Y("div", {
|
|
3106
3153
|
className: "flex-1 flex flex-col min-w-0",
|
|
@@ -3125,26 +3172,29 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3125
3172
|
!m && /* @__PURE__ */ Y(q, { children: [
|
|
3126
3173
|
/* @__PURE__ */ J("div", { className: "w-px h-5 bg-border mx-1" }),
|
|
3127
3174
|
/* @__PURE__ */ J("button", {
|
|
3128
|
-
|
|
3175
|
+
type: "button",
|
|
3176
|
+
className: Pt("p-1.5 rounded hover:bg-accent", !_.canUndo && "opacity-40 pointer-events-none"),
|
|
3129
3177
|
title: Z.undoShortcut,
|
|
3130
3178
|
"aria-label": Z.undo,
|
|
3131
3179
|
disabled: !_.canUndo,
|
|
3132
3180
|
onClick: () => _.undo(),
|
|
3133
|
-
children: /* @__PURE__ */ J(
|
|
3181
|
+
children: /* @__PURE__ */ J(Ne, { className: "h-4 w-4" })
|
|
3134
3182
|
}),
|
|
3135
3183
|
/* @__PURE__ */ J("button", {
|
|
3136
|
-
|
|
3184
|
+
type: "button",
|
|
3185
|
+
className: Pt("p-1.5 rounded hover:bg-accent", !_.canRedo && "opacity-40 pointer-events-none"),
|
|
3137
3186
|
title: Z.redoShortcut,
|
|
3138
3187
|
"aria-label": Z.redo,
|
|
3139
3188
|
disabled: !_.canRedo,
|
|
3140
3189
|
onClick: () => _.redo(),
|
|
3141
|
-
children: /* @__PURE__ */ J(
|
|
3190
|
+
children: /* @__PURE__ */ J(xe, { className: "h-4 w-4" })
|
|
3142
3191
|
}),
|
|
3143
3192
|
/* @__PURE__ */ J("div", { className: "w-px h-5 bg-border mx-1" })
|
|
3144
3193
|
] }),
|
|
3145
3194
|
!m && /* @__PURE__ */ Y(q, { children: [
|
|
3146
3195
|
/* @__PURE__ */ J("button", {
|
|
3147
|
-
|
|
3196
|
+
type: "button",
|
|
3197
|
+
className: Pt("p-1.5 rounded hover:bg-accent", x.count === 0 && "opacity-40 pointer-events-none"),
|
|
3148
3198
|
title: Z.copyShortcut,
|
|
3149
3199
|
"aria-label": Z.copy,
|
|
3150
3200
|
disabled: x.count === 0,
|
|
@@ -3152,7 +3202,8 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3152
3202
|
children: /* @__PURE__ */ J(w, { className: "h-4 w-4" })
|
|
3153
3203
|
}),
|
|
3154
3204
|
/* @__PURE__ */ J("button", {
|
|
3155
|
-
|
|
3205
|
+
type: "button",
|
|
3206
|
+
className: Pt("p-1.5 rounded hover:bg-accent", !C.hasContent && "opacity-40 pointer-events-none"),
|
|
3156
3207
|
title: Z.pasteShortcut,
|
|
3157
3208
|
"aria-label": Z.paste,
|
|
3158
3209
|
disabled: !C.hasContent,
|
|
@@ -3162,12 +3213,13 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3162
3213
|
/* @__PURE__ */ J("div", { className: "w-px h-5 bg-border mx-1" })
|
|
3163
3214
|
] }),
|
|
3164
3215
|
!m && /* @__PURE__ */ J("button", {
|
|
3165
|
-
|
|
3216
|
+
type: "button",
|
|
3217
|
+
className: Pt("p-1.5 rounded hover:bg-accent", x.count === 0 && "opacity-40 pointer-events-none"),
|
|
3166
3218
|
title: Z.deleteSelected,
|
|
3167
3219
|
"aria-label": Z.deleteSelected,
|
|
3168
3220
|
disabled: x.count === 0,
|
|
3169
3221
|
onClick: B,
|
|
3170
|
-
children: /* @__PURE__ */ J(
|
|
3222
|
+
children: /* @__PURE__ */ J(Ae, { className: "h-4 w-4" })
|
|
3171
3223
|
}),
|
|
3172
3224
|
/* @__PURE__ */ J("div", { className: "flex-1" }),
|
|
3173
3225
|
E?.isConnected && /* @__PURE__ */ Y("span", {
|
|
@@ -3187,11 +3239,12 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3187
3239
|
]
|
|
3188
3240
|
}),
|
|
3189
3241
|
f && /* @__PURE__ */ J("button", {
|
|
3242
|
+
type: "button",
|
|
3190
3243
|
className: "p-1.5 rounded hover:bg-accent",
|
|
3191
3244
|
title: O ? Z.collapsePanel : Z.expandPanel,
|
|
3192
3245
|
"aria-label": O ? Z.collapsePanel : Z.expandPanel,
|
|
3193
3246
|
onClick: () => k((e) => !e),
|
|
3194
|
-
children: /* @__PURE__ */ J(
|
|
3247
|
+
children: /* @__PURE__ */ J(he, { className: Pt("h-4 w-4", !O && "rotate-180") })
|
|
3195
3248
|
})
|
|
3196
3249
|
]
|
|
3197
3250
|
}), /* @__PURE__ */ J("div", {
|
|
@@ -3207,8 +3260,8 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3207
3260
|
children: v.map((e, t) => /* @__PURE__ */ Y("div", {
|
|
3208
3261
|
className: "relative border-b border-dashed border-gray-300",
|
|
3209
3262
|
style: { minHeight: e.height },
|
|
3210
|
-
onDragOver:
|
|
3211
|
-
onDrop: (e) =>
|
|
3263
|
+
onDragOver: ae,
|
|
3264
|
+
onDrop: (e) => oe(e, t),
|
|
3212
3265
|
children: [
|
|
3213
3266
|
/* @__PURE__ */ Y("div", {
|
|
3214
3267
|
className: "absolute left-0 top-0 px-2 py-0.5 bg-muted text-xs text-muted-foreground border-r border-b rounded-br",
|
|
@@ -3218,20 +3271,23 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3218
3271
|
className: "absolute right-1 top-0 flex items-center gap-0.5",
|
|
3219
3272
|
children: [
|
|
3220
3273
|
/* @__PURE__ */ J("button", {
|
|
3274
|
+
type: "button",
|
|
3221
3275
|
onClick: () => R(t, "text"),
|
|
3222
3276
|
className: "p-0.5 rounded hover:bg-accent",
|
|
3223
3277
|
title: Z.addText,
|
|
3224
3278
|
"aria-label": Z.addText,
|
|
3225
|
-
children: /* @__PURE__ */ J(
|
|
3279
|
+
children: /* @__PURE__ */ J(Me, { className: "h-3 w-3" })
|
|
3226
3280
|
}),
|
|
3227
3281
|
/* @__PURE__ */ J("button", {
|
|
3282
|
+
type: "button",
|
|
3228
3283
|
onClick: () => R(t, "field"),
|
|
3229
3284
|
className: "p-0.5 rounded hover:bg-accent",
|
|
3230
3285
|
title: Z.addField,
|
|
3231
3286
|
"aria-label": Z.addField,
|
|
3232
|
-
children: /* @__PURE__ */ J(
|
|
3287
|
+
children: /* @__PURE__ */ J(ye, { className: "h-3 w-3" })
|
|
3233
3288
|
}),
|
|
3234
3289
|
/* @__PURE__ */ J("button", {
|
|
3290
|
+
type: "button",
|
|
3235
3291
|
onClick: () => R(t, "image"),
|
|
3236
3292
|
className: "p-0.5 rounded hover:bg-accent",
|
|
3237
3293
|
title: Z.addImage,
|
|
@@ -3239,6 +3295,7 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3239
3295
|
children: /* @__PURE__ */ J(z, { className: "h-3 w-3" })
|
|
3240
3296
|
}),
|
|
3241
3297
|
/* @__PURE__ */ J("button", {
|
|
3298
|
+
type: "button",
|
|
3242
3299
|
onClick: () => R(t, "chart"),
|
|
3243
3300
|
className: "p-0.5 rounded hover:bg-accent",
|
|
3244
3301
|
title: Z.addChart,
|
|
@@ -3246,11 +3303,12 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3246
3303
|
children: /* @__PURE__ */ J(p, { className: "h-3 w-3" })
|
|
3247
3304
|
}),
|
|
3248
3305
|
/* @__PURE__ */ J("button", {
|
|
3306
|
+
type: "button",
|
|
3249
3307
|
onClick: () => R(t, "table"),
|
|
3250
3308
|
className: "p-0.5 rounded hover:bg-accent",
|
|
3251
3309
|
title: Z.addTable,
|
|
3252
3310
|
"aria-label": Z.addTable,
|
|
3253
|
-
children: /* @__PURE__ */ J(
|
|
3311
|
+
children: /* @__PURE__ */ J(Oe, { className: "h-3 w-3" })
|
|
3254
3312
|
})
|
|
3255
3313
|
]
|
|
3256
3314
|
}),
|
|
@@ -3268,7 +3326,7 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3268
3326
|
return /* @__PURE__ */ Y("div", {
|
|
3269
3327
|
draggable: !m,
|
|
3270
3328
|
onDragStart: (n) => ie(n, e, t),
|
|
3271
|
-
className:
|
|
3329
|
+
className: Pt("absolute border rounded px-2 py-1 text-xs cursor-pointer", n ? "border-primary ring-1 ring-primary/30 bg-primary/5" : "border-dashed border-gray-400 hover:border-primary/50"),
|
|
3272
3330
|
style: {
|
|
3273
3331
|
left: e.position.x,
|
|
3274
3332
|
top: (typeof e.position.y == "number" ? e.position.y : 0) + 24,
|
|
@@ -3286,12 +3344,13 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3286
3344
|
e.type === "table" && Z.elementTable
|
|
3287
3345
|
]
|
|
3288
3346
|
}), !m && n && /* @__PURE__ */ J("button", {
|
|
3347
|
+
type: "button",
|
|
3289
3348
|
onClick: (t) => {
|
|
3290
3349
|
t.stopPropagation(), ee(e.id);
|
|
3291
3350
|
},
|
|
3292
3351
|
className: "absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow",
|
|
3293
3352
|
"aria-label": Z.deleteElement,
|
|
3294
|
-
children: /* @__PURE__ */ J(
|
|
3353
|
+
children: /* @__PURE__ */ J(Ae, { className: "h-2.5 w-2.5" })
|
|
3295
3354
|
})]
|
|
3296
3355
|
}, e.id);
|
|
3297
3356
|
})]
|
|
@@ -3304,10 +3363,10 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3304
3363
|
f && /* @__PURE__ */ J("div", {
|
|
3305
3364
|
role: "region",
|
|
3306
3365
|
"aria-label": Z.propertiesPanel,
|
|
3307
|
-
className:
|
|
3308
|
-
children: O && (S && L ? /* @__PURE__ */ J(
|
|
3366
|
+
className: Pt("border-l bg-muted/30 flex flex-col transition-[width] duration-200", O ? "w-56" : "w-0 overflow-hidden"),
|
|
3367
|
+
children: O && (S && L ? /* @__PURE__ */ J(ft, {
|
|
3309
3368
|
title: `${Z.properties} – ${L.type}`,
|
|
3310
|
-
fields:
|
|
3369
|
+
fields: V,
|
|
3311
3370
|
onChange: te
|
|
3312
3371
|
}) : /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("div", {
|
|
3313
3372
|
className: "p-3 border-b font-medium text-sm",
|
|
@@ -3320,7 +3379,7 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3320
3379
|
})
|
|
3321
3380
|
})] }))
|
|
3322
3381
|
}),
|
|
3323
|
-
/* @__PURE__ */ J(
|
|
3382
|
+
/* @__PURE__ */ J(ut, {
|
|
3324
3383
|
isOpen: T.isOpen,
|
|
3325
3384
|
title: T.title,
|
|
3326
3385
|
message: T.message,
|
|
@@ -3330,7 +3389,9 @@ function Ft({ reportName: e = Z.untitledReport, objectName: t, pageSize: n = "A4
|
|
|
3330
3389
|
]
|
|
3331
3390
|
});
|
|
3332
3391
|
}
|
|
3333
|
-
|
|
3392
|
+
//#endregion
|
|
3393
|
+
//#region src/hooks/useDesignerTranslation.ts
|
|
3394
|
+
var Rt = {
|
|
3334
3395
|
"appDesigner.basicInfo": "Basic Info",
|
|
3335
3396
|
"appDesigner.objects": "Objects",
|
|
3336
3397
|
"appDesigner.navigation": "Navigation",
|
|
@@ -3415,6 +3476,9 @@ var It = qe({
|
|
|
3415
3476
|
"appDesigner.widgetHeight": "Height",
|
|
3416
3477
|
"appDesigner.dashboardPreview": "Dashboard Preview",
|
|
3417
3478
|
"appDesigner.noWidgetsPreview": "No widgets to preview",
|
|
3479
|
+
"appDesigner.widgetProperties": "Widget Properties",
|
|
3480
|
+
"appDesigner.addWidget": "Add Widget",
|
|
3481
|
+
"appDesigner.modeEdit": "Edit",
|
|
3418
3482
|
"appDesigner.pageCanvasEditor": "Page Canvas Editor",
|
|
3419
3483
|
"appDesigner.emptyPage": "Empty page. Click a button above to add a component.",
|
|
3420
3484
|
"appDesigner.pagePreview": "Page Preview",
|
|
@@ -3467,7 +3531,6 @@ var It = qe({
|
|
|
3467
3531
|
"appDesigner.fieldDesigner.unique": "Unique",
|
|
3468
3532
|
"appDesigner.fieldDesigner.readOnly": "Read Only",
|
|
3469
3533
|
"appDesigner.fieldDesigner.hidden": "Hidden",
|
|
3470
|
-
"appDesigner.fieldDesigner.indexed": "Indexed",
|
|
3471
3534
|
"appDesigner.fieldDesigner.externalId": "External ID",
|
|
3472
3535
|
"appDesigner.fieldDesigner.trackHistory": "Track History",
|
|
3473
3536
|
"appDesigner.fieldDesigner.defaultValue": "Default Value",
|
|
@@ -3491,14 +3554,15 @@ var It = qe({
|
|
|
3491
3554
|
"appDesigner.fieldDesigner.typeCategory.choice": "Choice",
|
|
3492
3555
|
"appDesigner.fieldDesigner.typeCategory.relation": "Relation",
|
|
3493
3556
|
"appDesigner.fieldDesigner.typeCategory.advanced": "Advanced",
|
|
3494
|
-
"common.edit": "Edit"
|
|
3495
|
-
|
|
3557
|
+
"common.edit": "Edit",
|
|
3558
|
+
"common.delete": "Delete"
|
|
3559
|
+
}, zt = qe(Rt, "appDesigner.basicInfo");
|
|
3496
3560
|
//#endregion
|
|
3497
3561
|
//#region src/AppCreationWizard.tsx
|
|
3498
3562
|
function Q(...e) {
|
|
3499
3563
|
return K(G(e));
|
|
3500
3564
|
}
|
|
3501
|
-
var
|
|
3565
|
+
var Bt = {
|
|
3502
3566
|
name: "",
|
|
3503
3567
|
title: "",
|
|
3504
3568
|
description: "",
|
|
@@ -3513,7 +3577,7 @@ var Lt = {
|
|
|
3513
3577
|
favicon: ""
|
|
3514
3578
|
}
|
|
3515
3579
|
};
|
|
3516
|
-
function
|
|
3580
|
+
function Vt(e) {
|
|
3517
3581
|
return e.filter((e) => e.selected).map((e) => ({
|
|
3518
3582
|
id: e.name,
|
|
3519
3583
|
type: "object",
|
|
@@ -3522,11 +3586,11 @@ function Rt(e) {
|
|
|
3522
3586
|
objectName: e.name
|
|
3523
3587
|
}));
|
|
3524
3588
|
}
|
|
3525
|
-
var
|
|
3526
|
-
function
|
|
3527
|
-
return
|
|
3589
|
+
var Ht = 0;
|
|
3590
|
+
function Ut(e) {
|
|
3591
|
+
return Ht += 1, `${e}_${Date.now()}_${Ht}`;
|
|
3528
3592
|
}
|
|
3529
|
-
function
|
|
3593
|
+
function Wt({ steps: e, currentIndex: t, onStepClick: r }) {
|
|
3530
3594
|
return /* @__PURE__ */ J("nav", {
|
|
3531
3595
|
className: "flex items-center justify-center gap-0 px-4 py-6",
|
|
3532
3596
|
children: e.map((e, i) => {
|
|
@@ -3547,8 +3611,8 @@ function Vt({ steps: e, currentIndex: t, onStepClick: r }) {
|
|
|
3547
3611
|
})
|
|
3548
3612
|
});
|
|
3549
3613
|
}
|
|
3550
|
-
function
|
|
3551
|
-
let a = e.name.length > 0 && !
|
|
3614
|
+
function Gt({ draft: e, templates: t, readOnly: n, onChange: r, t: i }) {
|
|
3615
|
+
let a = e.name.length > 0 && !Ve(e.name);
|
|
3552
3616
|
return /* @__PURE__ */ Y("div", {
|
|
3553
3617
|
"data-testid": "wizard-step-basic-content",
|
|
3554
3618
|
className: "mx-auto max-w-lg space-y-5",
|
|
@@ -3672,7 +3736,7 @@ function Ht({ draft: e, templates: t, readOnly: n, onChange: r, t: i }) {
|
|
|
3672
3736
|
{
|
|
3673
3737
|
value: "sidebar",
|
|
3674
3738
|
labelKey: "appDesigner.layoutSidebar",
|
|
3675
|
-
Icon:
|
|
3739
|
+
Icon: pe
|
|
3676
3740
|
},
|
|
3677
3741
|
{
|
|
3678
3742
|
value: "header",
|
|
@@ -3682,7 +3746,7 @@ function Ht({ draft: e, templates: t, readOnly: n, onChange: r, t: i }) {
|
|
|
3682
3746
|
{
|
|
3683
3747
|
value: "empty",
|
|
3684
3748
|
labelKey: "appDesigner.layoutEmpty",
|
|
3685
|
-
Icon:
|
|
3749
|
+
Icon: ne
|
|
3686
3750
|
}
|
|
3687
3751
|
].map(({ value: t, labelKey: a, Icon: o }) => /* @__PURE__ */ Y("label", {
|
|
3688
3752
|
"data-testid": `app-layout-${t}`,
|
|
@@ -3709,7 +3773,7 @@ function Ht({ draft: e, templates: t, readOnly: n, onChange: r, t: i }) {
|
|
|
3709
3773
|
]
|
|
3710
3774
|
});
|
|
3711
3775
|
}
|
|
3712
|
-
function
|
|
3776
|
+
function Kt({ objects: e, readOnly: t, onToggle: n, onToggleAll: r, search: i, onSearchChange: a, t: o }) {
|
|
3713
3777
|
let c = s(() => {
|
|
3714
3778
|
if (!i) return e;
|
|
3715
3779
|
let t = i.toLowerCase();
|
|
@@ -3722,7 +3786,7 @@ function Ut({ objects: e, readOnly: t, onToggle: n, onToggleAll: r, search: i, o
|
|
|
3722
3786
|
className: "flex items-center gap-3",
|
|
3723
3787
|
children: [/* @__PURE__ */ Y("div", {
|
|
3724
3788
|
className: "relative flex-1",
|
|
3725
|
-
children: [/* @__PURE__ */ J(
|
|
3789
|
+
children: [/* @__PURE__ */ J(Ce, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-gray-400" }), /* @__PURE__ */ J("input", {
|
|
3726
3790
|
"data-testid": "object-search",
|
|
3727
3791
|
type: "text",
|
|
3728
3792
|
value: i,
|
|
@@ -3772,7 +3836,7 @@ function Ut({ objects: e, readOnly: t, onToggle: n, onToggleAll: r, search: i, o
|
|
|
3772
3836
|
})]
|
|
3773
3837
|
});
|
|
3774
3838
|
}
|
|
3775
|
-
var
|
|
3839
|
+
var qt = {
|
|
3776
3840
|
object: "bg-green-100 text-green-700",
|
|
3777
3841
|
group: "bg-purple-100 text-purple-700",
|
|
3778
3842
|
url: "bg-sky-100 text-sky-700",
|
|
@@ -3782,7 +3846,7 @@ var Wt = {
|
|
|
3782
3846
|
report: "bg-rose-100 text-rose-700",
|
|
3783
3847
|
action: "bg-orange-100 text-orange-700"
|
|
3784
3848
|
};
|
|
3785
|
-
function
|
|
3849
|
+
function Jt({ items: e, readOnly: t, onAdd: n, onRemove: r, onReorder: i, t: a }) {
|
|
3786
3850
|
return /* @__PURE__ */ Y("div", {
|
|
3787
3851
|
"data-testid": "wizard-step-navigation-content",
|
|
3788
3852
|
className: "mx-auto max-w-lg space-y-4",
|
|
@@ -3803,7 +3867,7 @@ function Gt({ items: e, readOnly: t, onAdd: n, onRemove: r, onReorder: i, t: a }
|
|
|
3803
3867
|
onClick: () => n("url"),
|
|
3804
3868
|
disabled: t,
|
|
3805
3869
|
className: "inline-flex items-center gap-1.5 rounded-md border border-gray-300 px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",
|
|
3806
|
-
children: [/* @__PURE__ */ J(
|
|
3870
|
+
children: [/* @__PURE__ */ J(ie, { className: "h-3.5 w-3.5" }), a("appDesigner.addUrl")]
|
|
3807
3871
|
}),
|
|
3808
3872
|
/* @__PURE__ */ Y("button", {
|
|
3809
3873
|
type: "button",
|
|
@@ -3832,7 +3896,7 @@ function Gt({ items: e, readOnly: t, onAdd: n, onRemove: r, onReorder: i, t: a }
|
|
|
3832
3896
|
children: n.type === "separator" ? a("appDesigner.separatorLabel") : We(n.label)
|
|
3833
3897
|
}),
|
|
3834
3898
|
/* @__PURE__ */ J("span", {
|
|
3835
|
-
className: Q("rounded-full px-2 py-0.5 text-[10px] font-medium",
|
|
3899
|
+
className: Q("rounded-full px-2 py-0.5 text-[10px] font-medium", qt[n.type] ?? "bg-gray-100 text-gray-600"),
|
|
3836
3900
|
children: n.type
|
|
3837
3901
|
}),
|
|
3838
3902
|
/* @__PURE__ */ Y("div", {
|
|
@@ -3860,7 +3924,7 @@ function Gt({ items: e, readOnly: t, onAdd: n, onRemove: r, onReorder: i, t: a }
|
|
|
3860
3924
|
disabled: t,
|
|
3861
3925
|
className: "rounded p-0.5 text-gray-400 transition-colors hover:text-red-500 disabled:opacity-30",
|
|
3862
3926
|
"aria-label": "Remove",
|
|
3863
|
-
children: /* @__PURE__ */ J(
|
|
3927
|
+
children: /* @__PURE__ */ J(Ae, { className: "h-3.5 w-3.5" })
|
|
3864
3928
|
})
|
|
3865
3929
|
]
|
|
3866
3930
|
})
|
|
@@ -3869,7 +3933,7 @@ function Gt({ items: e, readOnly: t, onAdd: n, onRemove: r, onReorder: i, t: a }
|
|
|
3869
3933
|
})]
|
|
3870
3934
|
});
|
|
3871
3935
|
}
|
|
3872
|
-
function
|
|
3936
|
+
function Yt({ branding: e, title: t, readOnly: n, onChange: r, t: i }) {
|
|
3873
3937
|
return /* @__PURE__ */ Y("div", {
|
|
3874
3938
|
"data-testid": "wizard-step-branding-content",
|
|
3875
3939
|
className: "mx-auto max-w-lg space-y-5",
|
|
@@ -3902,7 +3966,7 @@ function Kt({ branding: e, title: t, readOnly: n, onChange: r, t: i }) {
|
|
|
3902
3966
|
children: i("appDesigner.primaryColor")
|
|
3903
3967
|
}), /* @__PURE__ */ Y("div", {
|
|
3904
3968
|
className: "relative",
|
|
3905
|
-
children: [/* @__PURE__ */ J(
|
|
3969
|
+
children: [/* @__PURE__ */ J(fe, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-gray-400" }), /* @__PURE__ */ J("input", {
|
|
3906
3970
|
id: "branding-color",
|
|
3907
3971
|
"data-testid": "branding-color-input",
|
|
3908
3972
|
type: "text",
|
|
@@ -3983,9 +4047,9 @@ function Kt({ branding: e, title: t, readOnly: n, onChange: r, t: i }) {
|
|
|
3983
4047
|
]
|
|
3984
4048
|
});
|
|
3985
4049
|
}
|
|
3986
|
-
function
|
|
3987
|
-
let { t: d } =
|
|
3988
|
-
...
|
|
4050
|
+
function Xt({ availableObjects: e = [], templates: t = [], initialDraft: n, onComplete: r, onCancel: a, onSaveDraft: o, readOnly: c = !1, className: u }) {
|
|
4051
|
+
let { t: d } = zt(), f = at(), [p, m] = l(0), [g, y] = l(""), [b, x] = l(() => ({
|
|
4052
|
+
...Bt,
|
|
3989
4053
|
objects: e.map((e) => ({ ...e })),
|
|
3990
4054
|
...n
|
|
3991
4055
|
})), S = s(() => [
|
|
@@ -4013,7 +4077,7 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4013
4077
|
description: d("appDesigner.stepBrandingDesc"),
|
|
4014
4078
|
icon: "Palette"
|
|
4015
4079
|
}
|
|
4016
|
-
], [d]), C = p === 0, w = p === S.length - 1, T = s(() => b.name.length > 0 &&
|
|
4080
|
+
], [d]), C = p === 0, w = p === S.length - 1, T = s(() => b.name.length > 0 && Ve(b.name) && b.title.trim().length > 0, [b.name, b.title]), E = s(() => p !== 0 || T, [p, T]), D = i((e) => {
|
|
4017
4081
|
x((t) => ({
|
|
4018
4082
|
...t,
|
|
4019
4083
|
...e
|
|
@@ -4044,7 +4108,7 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4044
4108
|
}));
|
|
4045
4109
|
}, []), j = i((e) => {
|
|
4046
4110
|
let t = {
|
|
4047
|
-
id:
|
|
4111
|
+
id: Ut(e),
|
|
4048
4112
|
type: e,
|
|
4049
4113
|
label: e === "separator" ? "" : e === "group" ? "New Group" : "New Link",
|
|
4050
4114
|
...e === "group" ? { children: [] } : {},
|
|
@@ -4072,7 +4136,7 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4072
4136
|
}, []), P = i(() => {
|
|
4073
4137
|
w || (p === 1 && x((e) => ({
|
|
4074
4138
|
...e,
|
|
4075
|
-
navigation:
|
|
4139
|
+
navigation: Vt(e.objects)
|
|
4076
4140
|
})), m((e) => e + 1));
|
|
4077
4141
|
}, [p, w]), F = i(() => {
|
|
4078
4142
|
C || m((e) => e - 1);
|
|
@@ -4091,7 +4155,7 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4091
4155
|
}, [b, o]), z = i((e) => {
|
|
4092
4156
|
e <= p ? m(e) : e === p + 1 && E && (p === 1 && e === 2 && x((e) => ({
|
|
4093
4157
|
...e,
|
|
4094
|
-
navigation:
|
|
4158
|
+
navigation: Vt(e.objects)
|
|
4095
4159
|
})), m(e));
|
|
4096
4160
|
}, [p, E]);
|
|
4097
4161
|
return /* @__PURE__ */ Y("div", {
|
|
@@ -4115,7 +4179,7 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4115
4179
|
onClick: f.onCancel,
|
|
4116
4180
|
className: "rounded p-1 text-gray-400 hover:text-gray-600",
|
|
4117
4181
|
"aria-label": d("common.close"),
|
|
4118
|
-
children: /* @__PURE__ */ J(
|
|
4182
|
+
children: /* @__PURE__ */ J(Le, { className: "h-4 w-4" })
|
|
4119
4183
|
})]
|
|
4120
4184
|
}),
|
|
4121
4185
|
/* @__PURE__ */ J("p", {
|
|
@@ -4143,7 +4207,7 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4143
4207
|
}),
|
|
4144
4208
|
/* @__PURE__ */ J("div", {
|
|
4145
4209
|
className: "border-b border-gray-100",
|
|
4146
|
-
children: /* @__PURE__ */ J(
|
|
4210
|
+
children: /* @__PURE__ */ J(Wt, {
|
|
4147
4211
|
steps: S,
|
|
4148
4212
|
currentIndex: p,
|
|
4149
4213
|
onStepClick: z
|
|
@@ -4152,14 +4216,14 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4152
4216
|
/* @__PURE__ */ Y("div", {
|
|
4153
4217
|
className: "flex-1 overflow-y-auto p-6",
|
|
4154
4218
|
children: [
|
|
4155
|
-
p === 0 && /* @__PURE__ */ J(
|
|
4219
|
+
p === 0 && /* @__PURE__ */ J(Gt, {
|
|
4156
4220
|
draft: b,
|
|
4157
4221
|
templates: t,
|
|
4158
4222
|
readOnly: c,
|
|
4159
4223
|
onChange: D,
|
|
4160
4224
|
t: d
|
|
4161
4225
|
}),
|
|
4162
|
-
p === 1 && /* @__PURE__ */ J(
|
|
4226
|
+
p === 1 && /* @__PURE__ */ J(Kt, {
|
|
4163
4227
|
objects: b.objects,
|
|
4164
4228
|
readOnly: c,
|
|
4165
4229
|
onToggle: k,
|
|
@@ -4168,7 +4232,7 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4168
4232
|
onSearchChange: y,
|
|
4169
4233
|
t: d
|
|
4170
4234
|
}),
|
|
4171
|
-
p === 2 && /* @__PURE__ */ J(
|
|
4235
|
+
p === 2 && /* @__PURE__ */ J(Jt, {
|
|
4172
4236
|
items: b.navigation,
|
|
4173
4237
|
readOnly: c,
|
|
4174
4238
|
onAdd: j,
|
|
@@ -4176,7 +4240,7 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4176
4240
|
onReorder: N,
|
|
4177
4241
|
t: d
|
|
4178
4242
|
}),
|
|
4179
|
-
p === 3 && /* @__PURE__ */ J(
|
|
4243
|
+
p === 3 && /* @__PURE__ */ J(Yt, {
|
|
4180
4244
|
branding: b.branding,
|
|
4181
4245
|
title: b.title,
|
|
4182
4246
|
readOnly: c,
|
|
@@ -4235,14 +4299,14 @@ function qt({ availableObjects: e = [], templates: t = [], initialDraft: n, onCo
|
|
|
4235
4299
|
}
|
|
4236
4300
|
//#endregion
|
|
4237
4301
|
//#region src/NavigationDesigner.tsx
|
|
4238
|
-
function
|
|
4302
|
+
function Zt(...e) {
|
|
4239
4303
|
return K(G(e));
|
|
4240
4304
|
}
|
|
4241
|
-
var
|
|
4242
|
-
function
|
|
4243
|
-
return
|
|
4305
|
+
var Qt = 0;
|
|
4306
|
+
function $t(e) {
|
|
4307
|
+
return Qt += 1, `${e}_${Date.now()}_${Qt}`;
|
|
4244
4308
|
}
|
|
4245
|
-
var
|
|
4309
|
+
var en = {
|
|
4246
4310
|
object: {
|
|
4247
4311
|
labelKey: "appDesigner.navTypeObject",
|
|
4248
4312
|
color: "bg-green-100 text-green-700",
|
|
@@ -4266,12 +4330,12 @@ var Zt = {
|
|
|
4266
4330
|
url: {
|
|
4267
4331
|
labelKey: "appDesigner.navTypeUrl",
|
|
4268
4332
|
color: "bg-sky-100 text-sky-700",
|
|
4269
|
-
Icon:
|
|
4333
|
+
Icon: ie
|
|
4270
4334
|
},
|
|
4271
4335
|
component: {
|
|
4272
4336
|
labelKey: "appDesigner.navTypeComponent",
|
|
4273
4337
|
color: "bg-indigo-100 text-indigo-700",
|
|
4274
|
-
Icon:
|
|
4338
|
+
Icon: be
|
|
4275
4339
|
},
|
|
4276
4340
|
group: {
|
|
4277
4341
|
labelKey: "appDesigner.navTypeGroup",
|
|
@@ -4286,9 +4350,9 @@ var Zt = {
|
|
|
4286
4350
|
action: {
|
|
4287
4351
|
labelKey: "appDesigner.navTypeAction",
|
|
4288
4352
|
color: "bg-orange-100 text-orange-700",
|
|
4289
|
-
Icon:
|
|
4353
|
+
Icon: H
|
|
4290
4354
|
}
|
|
4291
|
-
},
|
|
4355
|
+
}, tn = [
|
|
4292
4356
|
{
|
|
4293
4357
|
type: "object",
|
|
4294
4358
|
labelKey: "appDesigner.navObjectPage"
|
|
@@ -4318,8 +4382,8 @@ var Zt = {
|
|
|
4318
4382
|
labelKey: "appDesigner.navSeparator"
|
|
4319
4383
|
}
|
|
4320
4384
|
];
|
|
4321
|
-
function
|
|
4322
|
-
let [_, b] = l(!1), [x, S] = l(We(e.label) ?? ""), [C, w] = l(!1), [T, E] = l(e.icon || ""), D =
|
|
4385
|
+
function nn({ item: e, depth: t, index: n, total: r, readOnly: i, onRemove: a, onMoveUp: o, onMoveDown: s, onToggleExpand: c, onUpdateLabel: u, onUpdateIcon: d, onToggleVisible: f, onAddChild: p, expandedIds: m, t: h }) {
|
|
4386
|
+
let [_, b] = l(!1), [x, S] = l(We(e.label) ?? ""), [C, w] = l(!1), [T, E] = l(e.icon || ""), D = en[e.type];
|
|
4323
4387
|
e.type === "group" && e.children && e.children.length;
|
|
4324
4388
|
let A = m.has(e.id), j = e.visible === !1, M = () => {
|
|
4325
4389
|
x.trim() ? u(e.id, x.trim()) : S(We(e.label) ?? ""), b(!1);
|
|
@@ -4328,7 +4392,7 @@ function $t({ item: e, depth: t, index: n, total: r, readOnly: i, onRemove: a, o
|
|
|
4328
4392
|
};
|
|
4329
4393
|
return /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ Y("li", {
|
|
4330
4394
|
"data-testid": `nav-designer-item-${e.id}`,
|
|
4331
|
-
className:
|
|
4395
|
+
className: Zt("flex items-center gap-2 rounded-md border border-gray-200 bg-white px-2 py-1.5 transition-colors hover:bg-gray-50", j && "opacity-50"),
|
|
4332
4396
|
style: { marginLeft: t * 20 },
|
|
4333
4397
|
children: [
|
|
4334
4398
|
/* @__PURE__ */ J(F, { className: "h-3.5 w-3.5 shrink-0 cursor-grab text-gray-300" }),
|
|
@@ -4361,7 +4425,7 @@ function $t({ item: e, depth: t, index: n, total: r, readOnly: i, onRemove: a, o
|
|
|
4361
4425
|
className: "rounded p-0.5 text-gray-300 hover:text-blue-500",
|
|
4362
4426
|
"aria-label": h("appDesigner.navEditIcon"),
|
|
4363
4427
|
"data-testid": `nav-designer-edit-icon-${e.id}`,
|
|
4364
|
-
children: /* @__PURE__ */ J(
|
|
4428
|
+
children: /* @__PURE__ */ J(U, { className: "h-2.5 w-2.5" })
|
|
4365
4429
|
})]
|
|
4366
4430
|
}),
|
|
4367
4431
|
e.type === "separator" ? /* @__PURE__ */ J("span", {
|
|
@@ -4378,14 +4442,14 @@ function $t({ item: e, depth: t, index: n, total: r, readOnly: i, onRemove: a, o
|
|
|
4378
4442
|
autoFocus: !0,
|
|
4379
4443
|
className: "flex-1 rounded border border-blue-300 px-1.5 py-0.5 text-sm outline-none focus:ring-1 focus:ring-blue-400"
|
|
4380
4444
|
}) : /* @__PURE__ */ J("span", {
|
|
4381
|
-
className:
|
|
4445
|
+
className: Zt("flex-1 truncate text-sm text-gray-800", !i && "cursor-text"),
|
|
4382
4446
|
onDoubleClick: () => {
|
|
4383
4447
|
!i && e.type !== "separator" && (S(We(e.label) ?? ""), b(!0));
|
|
4384
4448
|
},
|
|
4385
4449
|
children: We(e.label)
|
|
4386
4450
|
}),
|
|
4387
4451
|
/* @__PURE__ */ J("span", {
|
|
4388
|
-
className:
|
|
4452
|
+
className: Zt("rounded-full px-2 py-0.5 text-[10px] font-medium", D.color),
|
|
4389
4453
|
children: h(D.labelKey)
|
|
4390
4454
|
}),
|
|
4391
4455
|
j && /* @__PURE__ */ J("span", {
|
|
@@ -4407,7 +4471,7 @@ function $t({ item: e, depth: t, index: n, total: r, readOnly: i, onRemove: a, o
|
|
|
4407
4471
|
className: "rounded p-0.5 text-gray-400 hover:text-blue-500",
|
|
4408
4472
|
"aria-label": h("appDesigner.navAddChild"),
|
|
4409
4473
|
"data-testid": `nav-designer-add-child-${e.id}`,
|
|
4410
|
-
children: /* @__PURE__ */ J(
|
|
4474
|
+
children: /* @__PURE__ */ J(ye, { className: "h-3.5 w-3.5" })
|
|
4411
4475
|
}),
|
|
4412
4476
|
/* @__PURE__ */ J("button", {
|
|
4413
4477
|
type: "button",
|
|
@@ -4432,10 +4496,10 @@ function $t({ item: e, depth: t, index: n, total: r, readOnly: i, onRemove: a, o
|
|
|
4432
4496
|
className: "rounded p-0.5 text-gray-400 hover:text-red-500 disabled:opacity-30",
|
|
4433
4497
|
"aria-label": h("appDesigner.navRemove"),
|
|
4434
4498
|
"data-testid": `nav-designer-remove-${e.id}`,
|
|
4435
|
-
children: /* @__PURE__ */ J(
|
|
4499
|
+
children: /* @__PURE__ */ J(Ae, { className: "h-3.5 w-3.5" })
|
|
4436
4500
|
})
|
|
4437
4501
|
]
|
|
4438
|
-
}), e.type === "group" && A && e.children && /* @__PURE__ */ J(q, { children: e.children.map((n, r) => /* @__PURE__ */ J(
|
|
4502
|
+
}), e.type === "group" && A && e.children && /* @__PURE__ */ J(q, { children: e.children.map((n, r) => /* @__PURE__ */ J(nn, {
|
|
4439
4503
|
item: n,
|
|
4440
4504
|
depth: t + 1,
|
|
4441
4505
|
index: r,
|
|
@@ -4453,7 +4517,7 @@ function $t({ item: e, depth: t, index: n, total: r, readOnly: i, onRemove: a, o
|
|
|
4453
4517
|
t: h
|
|
4454
4518
|
}, n.id)) })] });
|
|
4455
4519
|
}
|
|
4456
|
-
function
|
|
4520
|
+
function rn({ items: e, t }) {
|
|
4457
4521
|
return /* @__PURE__ */ Y("div", {
|
|
4458
4522
|
"data-testid": "nav-designer-preview",
|
|
4459
4523
|
className: "w-56 shrink-0 rounded-lg border border-gray-200 bg-gray-50 p-3",
|
|
@@ -4465,15 +4529,15 @@ function en({ items: e, t }) {
|
|
|
4465
4529
|
children: t("appDesigner.navNoPreviewItems")
|
|
4466
4530
|
}) : /* @__PURE__ */ J("ul", {
|
|
4467
4531
|
className: "space-y-0.5",
|
|
4468
|
-
children: e.map((e) => /* @__PURE__ */ J(
|
|
4532
|
+
children: e.map((e) => /* @__PURE__ */ J(an, {
|
|
4469
4533
|
item: e,
|
|
4470
4534
|
depth: 0
|
|
4471
4535
|
}, e.id))
|
|
4472
4536
|
})]
|
|
4473
4537
|
});
|
|
4474
4538
|
}
|
|
4475
|
-
function
|
|
4476
|
-
let n =
|
|
4539
|
+
function an({ item: e, depth: t }) {
|
|
4540
|
+
let n = en[e.type];
|
|
4477
4541
|
return e.type === "separator" ? /* @__PURE__ */ J("li", {
|
|
4478
4542
|
className: "my-1 border-t border-gray-200",
|
|
4479
4543
|
style: { marginLeft: t * 12 }
|
|
@@ -4484,13 +4548,13 @@ function tn({ item: e, depth: t }) {
|
|
|
4484
4548
|
className: "truncate",
|
|
4485
4549
|
children: We(e.label)
|
|
4486
4550
|
})]
|
|
4487
|
-
}), e.type === "group" && e.children?.map((e) => /* @__PURE__ */ J(
|
|
4551
|
+
}), e.type === "group" && e.children?.map((e) => /* @__PURE__ */ J(an, {
|
|
4488
4552
|
item: e,
|
|
4489
4553
|
depth: t + 1
|
|
4490
4554
|
}, e.id))] });
|
|
4491
4555
|
}
|
|
4492
|
-
function
|
|
4493
|
-
let { t: u } =
|
|
4556
|
+
function on({ items: e, onChange: t, readOnly: n = !1, showPreview: r = !0, className: a, onExport: o, onImport: s }) {
|
|
4557
|
+
let { t: u } = zt(), d = c(null), [f, p] = l(() => new Set(e.filter((e) => e.type === "group").map((e) => e.id))), m = i((n) => {
|
|
4494
4558
|
function r(e) {
|
|
4495
4559
|
return e.filter((e) => e.id !== n).map((e) => e.children ? {
|
|
4496
4560
|
...e,
|
|
@@ -4550,9 +4614,9 @@ function nn({ items: e, onChange: t, readOnly: n = !1, showPreview: r = !0, clas
|
|
|
4550
4614
|
t(r(e));
|
|
4551
4615
|
}, [e, t]), y = i((n, r) => {
|
|
4552
4616
|
let i = {
|
|
4553
|
-
id:
|
|
4617
|
+
id: $t(r),
|
|
4554
4618
|
type: r,
|
|
4555
|
-
label: r === "separator" ? "" : `New ${u(
|
|
4619
|
+
label: r === "separator" ? "" : `New ${u(en[r].labelKey)}`,
|
|
4556
4620
|
...r === "group" ? { children: [] } : {},
|
|
4557
4621
|
...r === "url" ? { url: "" } : {}
|
|
4558
4622
|
};
|
|
@@ -4568,9 +4632,9 @@ function nn({ items: e, onChange: t, readOnly: n = !1, showPreview: r = !0, clas
|
|
|
4568
4632
|
t(a(e)), p((e) => new Set(e).add(n));
|
|
4569
4633
|
}, [e, t]), b = i((n) => {
|
|
4570
4634
|
let r = {
|
|
4571
|
-
id:
|
|
4635
|
+
id: $t(n),
|
|
4572
4636
|
type: n,
|
|
4573
|
-
label: n === "separator" ? "" : `New ${u(
|
|
4637
|
+
label: n === "separator" ? "" : `New ${u(en[n].labelKey)}`,
|
|
4574
4638
|
...n === "group" ? { children: [] } : {},
|
|
4575
4639
|
...n === "url" ? { url: "" } : {}
|
|
4576
4640
|
};
|
|
@@ -4603,21 +4667,21 @@ function nn({ items: e, onChange: t, readOnly: n = !1, showPreview: r = !0, clas
|
|
|
4603
4667
|
}, [t, s]);
|
|
4604
4668
|
return /* @__PURE__ */ Y("div", {
|
|
4605
4669
|
"data-testid": "navigation-designer",
|
|
4606
|
-
className:
|
|
4670
|
+
className: Zt("flex flex-col gap-4 sm:flex-row", a),
|
|
4607
4671
|
children: [/* @__PURE__ */ Y("div", {
|
|
4608
4672
|
className: "flex-1 space-y-3",
|
|
4609
4673
|
children: [/* @__PURE__ */ Y("div", {
|
|
4610
4674
|
className: "flex flex-wrap items-center gap-1.5",
|
|
4611
4675
|
children: [
|
|
4612
|
-
|
|
4613
|
-
let { Icon: r, color: i } =
|
|
4676
|
+
tn.map(({ type: e, labelKey: t }) => {
|
|
4677
|
+
let { Icon: r, color: i } = en[e];
|
|
4614
4678
|
return /* @__PURE__ */ Y("button", {
|
|
4615
4679
|
type: "button",
|
|
4616
4680
|
"data-testid": `nav-designer-add-${e}`,
|
|
4617
4681
|
onClick: () => b(e),
|
|
4618
4682
|
disabled: n,
|
|
4619
|
-
className:
|
|
4620
|
-
children: [/* @__PURE__ */ J(
|
|
4683
|
+
className: Zt("inline-flex items-center gap-1 rounded-md border border-gray-200 px-2.5 py-1 text-xs font-medium transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50"),
|
|
4684
|
+
children: [/* @__PURE__ */ J(ye, { className: "h-3 w-3" }), u(t)]
|
|
4621
4685
|
}, e);
|
|
4622
4686
|
}),
|
|
4623
4687
|
/* @__PURE__ */ J("span", { className: "mx-1 hidden h-4 w-px bg-gray-200 sm:block" }),
|
|
@@ -4630,9 +4694,9 @@ function nn({ items: e, onChange: t, readOnly: n = !1, showPreview: r = !0, clas
|
|
|
4630
4694
|
}),
|
|
4631
4695
|
/* @__PURE__ */ Y("label", {
|
|
4632
4696
|
"data-testid": "nav-designer-import",
|
|
4633
|
-
className:
|
|
4697
|
+
className: Zt("inline-flex cursor-pointer items-center gap-1 rounded-md border border-gray-200 px-2.5 py-1 text-xs font-medium transition-colors hover:bg-gray-50", n && "cursor-not-allowed opacity-50"),
|
|
4634
4698
|
children: [
|
|
4635
|
-
/* @__PURE__ */ J(
|
|
4699
|
+
/* @__PURE__ */ J(Pe, { className: "h-3 w-3" }),
|
|
4636
4700
|
u("appDesigner.navImportSchema"),
|
|
4637
4701
|
/* @__PURE__ */ J("input", {
|
|
4638
4702
|
ref: d,
|
|
@@ -4652,7 +4716,7 @@ function nn({ items: e, onChange: t, readOnly: n = !1, showPreview: r = !0, clas
|
|
|
4652
4716
|
}) : /* @__PURE__ */ J("ul", {
|
|
4653
4717
|
className: "space-y-1",
|
|
4654
4718
|
"data-testid": "nav-designer-tree",
|
|
4655
|
-
children: e.map((t, r) => /* @__PURE__ */ J(
|
|
4719
|
+
children: e.map((t, r) => /* @__PURE__ */ J(nn, {
|
|
4656
4720
|
item: t,
|
|
4657
4721
|
depth: 0,
|
|
4658
4722
|
index: r,
|
|
@@ -4670,7 +4734,7 @@ function nn({ items: e, onChange: t, readOnly: n = !1, showPreview: r = !0, clas
|
|
|
4670
4734
|
t: u
|
|
4671
4735
|
}, t.id))
|
|
4672
4736
|
})]
|
|
4673
|
-
}), r && /* @__PURE__ */ J(
|
|
4737
|
+
}), r && /* @__PURE__ */ J(rn, {
|
|
4674
4738
|
items: e,
|
|
4675
4739
|
t: u
|
|
4676
4740
|
})]
|
|
@@ -4678,14 +4742,14 @@ function nn({ items: e, onChange: t, readOnly: n = !1, showPreview: r = !0, clas
|
|
|
4678
4742
|
}
|
|
4679
4743
|
//#endregion
|
|
4680
4744
|
//#region src/EditorModeToggle.tsx
|
|
4681
|
-
function
|
|
4745
|
+
function sn(...e) {
|
|
4682
4746
|
return K(G(e));
|
|
4683
4747
|
}
|
|
4684
|
-
var
|
|
4748
|
+
var cn = [
|
|
4685
4749
|
{
|
|
4686
4750
|
value: "edit",
|
|
4687
4751
|
label: "Edit",
|
|
4688
|
-
Icon:
|
|
4752
|
+
Icon: U
|
|
4689
4753
|
},
|
|
4690
4754
|
{
|
|
4691
4755
|
value: "preview",
|
|
@@ -4698,34 +4762,34 @@ var an = [
|
|
|
4698
4762
|
Icon: S
|
|
4699
4763
|
}
|
|
4700
4764
|
];
|
|
4701
|
-
function
|
|
4765
|
+
function ln({ mode: e, onChange: t, disabled: n = !1, className: r }) {
|
|
4702
4766
|
return /* @__PURE__ */ J("div", {
|
|
4703
4767
|
"data-testid": "editor-mode-toggle",
|
|
4704
|
-
className:
|
|
4768
|
+
className: sn("inline-flex items-center rounded-lg border border-gray-200 bg-gray-50 p-0.5", r),
|
|
4705
4769
|
role: "radiogroup",
|
|
4706
4770
|
"aria-label": "Editor mode",
|
|
4707
|
-
children:
|
|
4771
|
+
children: cn.map(({ value: r, label: i, Icon: a }) => /* @__PURE__ */ Y("button", {
|
|
4708
4772
|
type: "button",
|
|
4709
4773
|
role: "radio",
|
|
4710
4774
|
"aria-checked": e === r,
|
|
4711
4775
|
"data-testid": `editor-mode-${r}`,
|
|
4712
4776
|
onClick: () => t(r),
|
|
4713
4777
|
disabled: n,
|
|
4714
|
-
className:
|
|
4778
|
+
className: sn("inline-flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors", e === r ? "bg-white text-gray-900 shadow-sm" : "text-gray-500 hover:text-gray-700", n && "cursor-not-allowed opacity-50"),
|
|
4715
4779
|
children: [/* @__PURE__ */ J(a, { className: "h-3.5 w-3.5" }), i]
|
|
4716
4780
|
}, r))
|
|
4717
4781
|
});
|
|
4718
4782
|
}
|
|
4719
4783
|
//#endregion
|
|
4720
4784
|
//#region src/DashboardEditor.tsx
|
|
4721
|
-
function
|
|
4785
|
+
function un(...e) {
|
|
4722
4786
|
return K(G(e));
|
|
4723
4787
|
}
|
|
4724
|
-
var
|
|
4788
|
+
var dn = [
|
|
4725
4789
|
{
|
|
4726
4790
|
type: "metric",
|
|
4727
4791
|
label: "KPI Metric",
|
|
4728
|
-
Icon:
|
|
4792
|
+
Icon: je
|
|
4729
4793
|
},
|
|
4730
4794
|
{
|
|
4731
4795
|
type: "bar",
|
|
@@ -4735,33 +4799,34 @@ var cn = [
|
|
|
4735
4799
|
{
|
|
4736
4800
|
type: "line",
|
|
4737
4801
|
label: "Line Chart",
|
|
4738
|
-
Icon:
|
|
4802
|
+
Icon: re
|
|
4739
4803
|
},
|
|
4740
4804
|
{
|
|
4741
4805
|
type: "pie",
|
|
4742
4806
|
label: "Pie Chart",
|
|
4743
|
-
Icon:
|
|
4807
|
+
Icon: _e
|
|
4744
4808
|
},
|
|
4745
4809
|
{
|
|
4746
4810
|
type: "table",
|
|
4747
4811
|
label: "Table",
|
|
4748
|
-
Icon:
|
|
4749
|
-
},
|
|
4750
|
-
{
|
|
4751
|
-
type: "grid",
|
|
4752
|
-
label: "Grid",
|
|
4753
|
-
Icon: ne
|
|
4812
|
+
Icon: Oe
|
|
4754
4813
|
}
|
|
4755
|
-
],
|
|
4756
|
-
function
|
|
4757
|
-
return
|
|
4814
|
+
], fn = 0;
|
|
4815
|
+
function pn() {
|
|
4816
|
+
return fn += 1, `widget_${Date.now()}_${fn}`;
|
|
4817
|
+
}
|
|
4818
|
+
function mn(e, t) {
|
|
4819
|
+
return Je(e, t);
|
|
4820
|
+
}
|
|
4821
|
+
function hn(e, t, n) {
|
|
4822
|
+
return Ye(e, t, n);
|
|
4758
4823
|
}
|
|
4759
|
-
function
|
|
4760
|
-
let l = e.type || "metric", u =
|
|
4824
|
+
function gn({ widget: e, index: t, total: n, selected: r, readOnly: i, onSelect: a, onRemove: o, onMoveUp: s, onMoveDown: c }) {
|
|
4825
|
+
let l = e.type || "metric", u = dn.find((e) => e.type === l) || dn[0], { language: d } = zt(), f = mn(e.title, d);
|
|
4761
4826
|
return /* @__PURE__ */ Y("div", {
|
|
4762
4827
|
"data-testid": `dashboard-widget-${e.id}`,
|
|
4763
4828
|
onClick: a,
|
|
4764
|
-
className:
|
|
4829
|
+
className: un("group cursor-pointer rounded-lg border-2 p-3 transition-colors", r ? "border-blue-500 bg-blue-50" : "border-gray-200 hover:border-gray-300"),
|
|
4765
4830
|
children: [/* @__PURE__ */ Y("div", {
|
|
4766
4831
|
className: "flex items-start justify-between",
|
|
4767
4832
|
children: [/* @__PURE__ */ Y("div", {
|
|
@@ -4771,7 +4836,7 @@ function dn({ widget: e, index: t, total: n, selected: r, readOnly: i, onSelect:
|
|
|
4771
4836
|
/* @__PURE__ */ J(u.Icon, { className: "h-4 w-4 text-gray-500" }),
|
|
4772
4837
|
/* @__PURE__ */ J("span", {
|
|
4773
4838
|
className: "text-sm font-medium text-gray-800",
|
|
4774
|
-
children:
|
|
4839
|
+
children: f || `Widget ${t + 1}`
|
|
4775
4840
|
})
|
|
4776
4841
|
]
|
|
4777
4842
|
}), !i && /* @__PURE__ */ Y("div", {
|
|
@@ -4805,7 +4870,7 @@ function dn({ widget: e, index: t, total: n, selected: r, readOnly: i, onSelect:
|
|
|
4805
4870
|
className: "rounded p-0.5 text-gray-400 hover:text-red-500",
|
|
4806
4871
|
"aria-label": "Remove widget",
|
|
4807
4872
|
"data-testid": `dashboard-widget-remove-${e.id}`,
|
|
4808
|
-
children: /* @__PURE__ */ J(
|
|
4873
|
+
children: /* @__PURE__ */ J(Ae, { className: "h-3.5 w-3.5" })
|
|
4809
4874
|
})
|
|
4810
4875
|
]
|
|
4811
4876
|
})]
|
|
@@ -4818,8 +4883,8 @@ function dn({ widget: e, index: t, total: n, selected: r, readOnly: i, onSelect:
|
|
|
4818
4883
|
})]
|
|
4819
4884
|
});
|
|
4820
4885
|
}
|
|
4821
|
-
function
|
|
4822
|
-
let { t: i } =
|
|
4886
|
+
function _n({ widget: e, readOnly: t, onChange: n, onClose: r }) {
|
|
4887
|
+
let { t: i, language: a } = zt(), o = mn(e.title, a);
|
|
4823
4888
|
return /* @__PURE__ */ Y("div", {
|
|
4824
4889
|
"data-testid": "widget-property-panel",
|
|
4825
4890
|
className: "shrink-0 space-y-4 rounded-lg border border-gray-200 bg-white p-4",
|
|
@@ -4834,7 +4899,7 @@ function fn({ widget: e, readOnly: t, onChange: n, onClose: r }) {
|
|
|
4834
4899
|
onClick: r,
|
|
4835
4900
|
className: "rounded p-0.5 text-gray-400 hover:text-gray-600",
|
|
4836
4901
|
"aria-label": "Close",
|
|
4837
|
-
children: /* @__PURE__ */ J(
|
|
4902
|
+
children: /* @__PURE__ */ J(Le, { className: "h-4 w-4" })
|
|
4838
4903
|
})]
|
|
4839
4904
|
}),
|
|
4840
4905
|
/* @__PURE__ */ Y("div", {
|
|
@@ -4847,8 +4912,10 @@ function fn({ widget: e, readOnly: t, onChange: n, onClose: r }) {
|
|
|
4847
4912
|
id: "widget-title",
|
|
4848
4913
|
"data-testid": "widget-prop-title",
|
|
4849
4914
|
type: "text",
|
|
4850
|
-
value:
|
|
4851
|
-
onChange: (
|
|
4915
|
+
value: o,
|
|
4916
|
+
onChange: (t) => {
|
|
4917
|
+
n({ title: hn(e.title, a, t.target.value) });
|
|
4918
|
+
},
|
|
4852
4919
|
disabled: t,
|
|
4853
4920
|
className: "block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50"
|
|
4854
4921
|
})]
|
|
@@ -4863,10 +4930,13 @@ function fn({ widget: e, readOnly: t, onChange: n, onClose: r }) {
|
|
|
4863
4930
|
id: "widget-type",
|
|
4864
4931
|
"data-testid": "widget-prop-type",
|
|
4865
4932
|
value: e.type ?? "metric",
|
|
4866
|
-
onChange: (e) =>
|
|
4933
|
+
onChange: (e) => {
|
|
4934
|
+
let t = dn.find((t) => t.type === e.target.value);
|
|
4935
|
+
t && n({ type: t.type });
|
|
4936
|
+
},
|
|
4867
4937
|
disabled: t,
|
|
4868
4938
|
className: "block w-full rounded-md border border-gray-300 px-2.5 py-1.5 text-sm outline-none focus:border-blue-500 focus:ring-1 focus:ring-blue-500 disabled:bg-gray-50",
|
|
4869
|
-
children:
|
|
4939
|
+
children: dn.map((e) => /* @__PURE__ */ J("option", {
|
|
4870
4940
|
value: e.type,
|
|
4871
4941
|
children: e.label
|
|
4872
4942
|
}, e.type))
|
|
@@ -4972,29 +5042,29 @@ function fn({ widget: e, readOnly: t, onChange: n, onClose: r }) {
|
|
|
4972
5042
|
]
|
|
4973
5043
|
});
|
|
4974
5044
|
}
|
|
4975
|
-
function
|
|
4976
|
-
let { t } =
|
|
5045
|
+
function vn({ schema: e }) {
|
|
5046
|
+
let { t, language: n } = zt(), r = e.widgets || [];
|
|
4977
5047
|
return /* @__PURE__ */ Y("div", {
|
|
4978
5048
|
"data-testid": "dashboard-preview",
|
|
4979
5049
|
className: "rounded-lg border border-gray-200 bg-gray-50 p-4",
|
|
4980
5050
|
children: [/* @__PURE__ */ J("h4", {
|
|
4981
5051
|
className: "mb-3 text-sm font-semibold text-gray-700",
|
|
4982
5052
|
children: e.title || t("appDesigner.dashboardPreview")
|
|
4983
|
-
}),
|
|
5053
|
+
}), r.length === 0 ? /* @__PURE__ */ J("div", {
|
|
4984
5054
|
className: "text-xs text-gray-400",
|
|
4985
5055
|
children: t("appDesigner.noWidgetsPreview")
|
|
4986
5056
|
}) : /* @__PURE__ */ J("div", {
|
|
4987
5057
|
className: "grid gap-2",
|
|
4988
5058
|
style: { gridTemplateColumns: `repeat(${e.columns ?? 2}, 1fr)` },
|
|
4989
|
-
children:
|
|
4990
|
-
let t =
|
|
5059
|
+
children: r.map((e) => {
|
|
5060
|
+
let t = dn.find((t) => t.type === (e.type || "metric")) || dn[0];
|
|
4991
5061
|
return /* @__PURE__ */ Y("div", {
|
|
4992
5062
|
className: "rounded-md border border-gray-200 bg-white p-2",
|
|
4993
5063
|
children: [/* @__PURE__ */ Y("div", {
|
|
4994
5064
|
className: "flex items-center gap-1.5",
|
|
4995
5065
|
children: [/* @__PURE__ */ J(t.Icon, { className: "h-3 w-3 text-gray-400" }), /* @__PURE__ */ J("span", {
|
|
4996
5066
|
className: "text-xs font-medium text-gray-600",
|
|
4997
|
-
children: e.title || "Untitled"
|
|
5067
|
+
children: mn(e.title, n) || "Untitled"
|
|
4998
5068
|
})]
|
|
4999
5069
|
}), /* @__PURE__ */ J("div", {
|
|
5000
5070
|
className: "mt-1 text-[10px] text-gray-400",
|
|
@@ -5005,17 +5075,17 @@ function pn({ schema: e }) {
|
|
|
5005
5075
|
})]
|
|
5006
5076
|
});
|
|
5007
5077
|
}
|
|
5008
|
-
function
|
|
5009
|
-
let { t: f } =
|
|
5078
|
+
function yn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport: a, onImport: s, selectedWidgetId: u, onWidgetSelect: d }) {
|
|
5079
|
+
let { t: f } = zt(), [p, m] = l(null), [h, g] = l(!1), _ = c(null), v = c(null), y = u !== void 0, b = y ? u : p, x = i((e) => {
|
|
5010
5080
|
d && d(e), y || m(e);
|
|
5011
5081
|
}, [
|
|
5012
5082
|
y,
|
|
5013
5083
|
d,
|
|
5014
5084
|
m
|
|
5015
|
-
]), { current: S, canUndo: C, canRedo: w, push: T, undo: E, redo: A } =
|
|
5085
|
+
]), { current: S, canUndo: C, canRedo: w, push: T, undo: E, redo: A } = it(e), j = i((e) => {
|
|
5016
5086
|
T(e), t(e);
|
|
5017
5087
|
}, [T, t]), M = S.widgets || [], N = M.find((e) => e.id === b), P = i((e) => {
|
|
5018
|
-
let t =
|
|
5088
|
+
let t = pn(), n = {
|
|
5019
5089
|
id: t,
|
|
5020
5090
|
title: "",
|
|
5021
5091
|
type: e,
|
|
@@ -5121,7 +5191,7 @@ function mn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5121
5191
|
ref: _,
|
|
5122
5192
|
tabIndex: 0,
|
|
5123
5193
|
"data-testid": "dashboard-editor",
|
|
5124
|
-
className:
|
|
5194
|
+
className: un("flex flex-col gap-4 outline-none", r),
|
|
5125
5195
|
children: [
|
|
5126
5196
|
/* @__PURE__ */ J("input", {
|
|
5127
5197
|
ref: v,
|
|
@@ -5131,7 +5201,7 @@ function mn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5131
5201
|
"data-testid": "dashboard-import-input",
|
|
5132
5202
|
onChange: ee
|
|
5133
5203
|
}),
|
|
5134
|
-
N && !h && /* @__PURE__ */ J(
|
|
5204
|
+
N && !h && /* @__PURE__ */ J(_n, {
|
|
5135
5205
|
widget: N,
|
|
5136
5206
|
readOnly: n,
|
|
5137
5207
|
onChange: L,
|
|
@@ -5146,7 +5216,7 @@ function mn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5146
5216
|
children: [/* @__PURE__ */ Y("span", {
|
|
5147
5217
|
className: "text-sm font-medium text-gray-700",
|
|
5148
5218
|
children: [f("appDesigner.addWidget"), ":"]
|
|
5149
|
-
}),
|
|
5219
|
+
}), dn.map(({ type: e, label: t, Icon: r }) => /* @__PURE__ */ Y("button", {
|
|
5150
5220
|
type: "button",
|
|
5151
5221
|
"data-testid": `dashboard-add-${e}`,
|
|
5152
5222
|
onClick: () => P(e),
|
|
@@ -5164,7 +5234,7 @@ function mn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5164
5234
|
disabled: !C,
|
|
5165
5235
|
className: "rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30",
|
|
5166
5236
|
"aria-label": f("appDesigner.undo"),
|
|
5167
|
-
children: /* @__PURE__ */ J(
|
|
5237
|
+
children: /* @__PURE__ */ J(Ne, { className: "h-4 w-4" })
|
|
5168
5238
|
}), /* @__PURE__ */ J("button", {
|
|
5169
5239
|
type: "button",
|
|
5170
5240
|
"data-testid": "dashboard-redo",
|
|
@@ -5172,7 +5242,7 @@ function mn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5172
5242
|
disabled: !w,
|
|
5173
5243
|
className: "rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30",
|
|
5174
5244
|
"aria-label": f("appDesigner.redo"),
|
|
5175
|
-
children: /* @__PURE__ */ J(
|
|
5245
|
+
children: /* @__PURE__ */ J(xe, { className: "h-4 w-4" })
|
|
5176
5246
|
})] }),
|
|
5177
5247
|
/* @__PURE__ */ J("button", {
|
|
5178
5248
|
type: "button",
|
|
@@ -5188,25 +5258,25 @@ function mn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5188
5258
|
onClick: z,
|
|
5189
5259
|
className: "rounded p-1.5 text-gray-400 hover:text-gray-700",
|
|
5190
5260
|
"aria-label": f("appDesigner.navImportSchema"),
|
|
5191
|
-
children: /* @__PURE__ */ J(
|
|
5261
|
+
children: /* @__PURE__ */ J(Pe, { className: "h-4 w-4" })
|
|
5192
5262
|
}),
|
|
5193
5263
|
/* @__PURE__ */ J("button", {
|
|
5194
5264
|
type: "button",
|
|
5195
5265
|
"data-testid": "dashboard-preview-toggle",
|
|
5196
5266
|
onClick: () => g((e) => !e),
|
|
5197
|
-
className:
|
|
5267
|
+
className: un("rounded p-1.5 transition-colors", h ? "bg-blue-100 text-blue-600" : "text-gray-400 hover:text-gray-700"),
|
|
5198
5268
|
"aria-label": f(h ? "appDesigner.modeEdit" : "appDesigner.preview"),
|
|
5199
5269
|
children: J(h ? k : O, { className: "h-4 w-4" })
|
|
5200
5270
|
})
|
|
5201
5271
|
]
|
|
5202
5272
|
})]
|
|
5203
|
-
}), h ? /* @__PURE__ */ J(
|
|
5273
|
+
}), h ? /* @__PURE__ */ J(vn, { schema: S }) : M.length === 0 ? /* @__PURE__ */ J("div", {
|
|
5204
5274
|
className: "flex h-48 items-center justify-center rounded-lg border-2 border-dashed border-gray-200 text-sm text-gray-400",
|
|
5205
5275
|
children: f("appDesigner.noWidgets")
|
|
5206
5276
|
}) : /* @__PURE__ */ J("div", {
|
|
5207
5277
|
className: "grid gap-3",
|
|
5208
5278
|
style: { gridTemplateColumns: `repeat(${S.columns ?? 2}, 1fr)` },
|
|
5209
|
-
children: M.map((e, t) => /* @__PURE__ */ J(
|
|
5279
|
+
children: M.map((e, t) => /* @__PURE__ */ J(gn, {
|
|
5210
5280
|
widget: e,
|
|
5211
5281
|
index: t,
|
|
5212
5282
|
total: M.length,
|
|
@@ -5227,7 +5297,7 @@ function mn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5227
5297
|
function $(...e) {
|
|
5228
5298
|
return K(G(e));
|
|
5229
5299
|
}
|
|
5230
|
-
var
|
|
5300
|
+
var bn = [
|
|
5231
5301
|
{
|
|
5232
5302
|
hex: "#3b82f6",
|
|
5233
5303
|
name: "Blue"
|
|
@@ -5292,7 +5362,7 @@ var hn = [
|
|
|
5292
5362
|
hex: "#0f172a",
|
|
5293
5363
|
name: "Navy"
|
|
5294
5364
|
}
|
|
5295
|
-
],
|
|
5365
|
+
], xn = [
|
|
5296
5366
|
"Inter",
|
|
5297
5367
|
"Roboto",
|
|
5298
5368
|
"Open Sans",
|
|
@@ -5303,8 +5373,8 @@ var hn = [
|
|
|
5303
5373
|
"Noto Sans",
|
|
5304
5374
|
"system-ui"
|
|
5305
5375
|
];
|
|
5306
|
-
function
|
|
5307
|
-
let { t: d } =
|
|
5376
|
+
function Sn({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1, className: a, onExport: s, onImport: u }) {
|
|
5377
|
+
let { t: d } = zt(), [f, p] = l("light"), { current: m, push: h, canUndo: g, canRedo: _, undo: v, redo: y } = it(e), b = c(!0);
|
|
5308
5378
|
o(() => {
|
|
5309
5379
|
if (b.current) {
|
|
5310
5380
|
b.current = !1;
|
|
@@ -5384,7 +5454,7 @@ function _n({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
5384
5454
|
disabled: !g || r,
|
|
5385
5455
|
className: $("inline-flex items-center gap-1 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors", g && !r ? "border-gray-300 bg-white text-gray-700 hover:bg-gray-50" : "border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed"),
|
|
5386
5456
|
title: d("appDesigner.undo"),
|
|
5387
|
-
children: [/* @__PURE__ */ J(
|
|
5457
|
+
children: [/* @__PURE__ */ J(Ne, { className: "h-3.5 w-3.5" }), d("appDesigner.undo")]
|
|
5388
5458
|
}),
|
|
5389
5459
|
/* @__PURE__ */ Y("button", {
|
|
5390
5460
|
"data-testid": "branding-redo",
|
|
@@ -5393,7 +5463,7 @@ function _n({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
5393
5463
|
disabled: !_ || r,
|
|
5394
5464
|
className: $("inline-flex items-center gap-1 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors", _ && !r ? "border-gray-300 bg-white text-gray-700 hover:bg-gray-50" : "border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed"),
|
|
5395
5465
|
title: d("appDesigner.redo"),
|
|
5396
|
-
children: [/* @__PURE__ */ J(
|
|
5466
|
+
children: [/* @__PURE__ */ J(xe, { className: "h-3.5 w-3.5" }), d("appDesigner.redo")]
|
|
5397
5467
|
}),
|
|
5398
5468
|
/* @__PURE__ */ Y("button", {
|
|
5399
5469
|
"data-testid": "branding-export",
|
|
@@ -5410,7 +5480,7 @@ function _n({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
5410
5480
|
disabled: r,
|
|
5411
5481
|
className: $("inline-flex items-center gap-1 rounded-md border px-2.5 py-1.5 text-xs font-medium shadow-sm transition-colors", r ? "border-gray-200 bg-gray-50 text-gray-400 cursor-not-allowed" : "border-gray-300 bg-white text-gray-700 hover:bg-gray-50"),
|
|
5412
5482
|
title: d("appDesigner.brandingImport"),
|
|
5413
|
-
children: [/* @__PURE__ */ J(
|
|
5483
|
+
children: [/* @__PURE__ */ J(Pe, { className: "h-3.5 w-3.5" }), d("appDesigner.brandingImport")]
|
|
5414
5484
|
})
|
|
5415
5485
|
]
|
|
5416
5486
|
}), /* @__PURE__ */ Y("div", {
|
|
@@ -5450,7 +5520,7 @@ function _n({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
5450
5520
|
className: "flex items-center gap-2",
|
|
5451
5521
|
children: [/* @__PURE__ */ Y("div", {
|
|
5452
5522
|
className: "relative flex-1",
|
|
5453
|
-
children: [/* @__PURE__ */ J(
|
|
5523
|
+
children: [/* @__PURE__ */ J(fe, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-gray-400" }), /* @__PURE__ */ J("input", {
|
|
5454
5524
|
id: "be-color",
|
|
5455
5525
|
"data-testid": "branding-color-input",
|
|
5456
5526
|
type: "text",
|
|
@@ -5477,7 +5547,7 @@ function _n({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
5477
5547
|
}), /* @__PURE__ */ J("div", {
|
|
5478
5548
|
"data-testid": "branding-color-palette",
|
|
5479
5549
|
className: "flex flex-wrap gap-1.5",
|
|
5480
|
-
children:
|
|
5550
|
+
children: bn.map((e) => /* @__PURE__ */ J("button", {
|
|
5481
5551
|
"data-testid": `branding-swatch-${e.hex.slice(1)}`,
|
|
5482
5552
|
type: "button",
|
|
5483
5553
|
onClick: () => !r && x({ primaryColor: e.hex }),
|
|
@@ -5518,7 +5588,7 @@ function _n({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
5518
5588
|
children: d("appDesigner.fontFamily")
|
|
5519
5589
|
}), /* @__PURE__ */ Y("div", {
|
|
5520
5590
|
className: "relative",
|
|
5521
|
-
children: [/* @__PURE__ */ J(
|
|
5591
|
+
children: [/* @__PURE__ */ J(Me, { className: "absolute left-2.5 top-2.5 h-4 w-4 text-gray-400" }), /* @__PURE__ */ Y("select", {
|
|
5522
5592
|
id: "be-font",
|
|
5523
5593
|
"data-testid": "branding-font-select",
|
|
5524
5594
|
value: m.fontFamily ?? "",
|
|
@@ -5528,7 +5598,7 @@ function _n({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
5528
5598
|
children: [/* @__PURE__ */ J("option", {
|
|
5529
5599
|
value: "",
|
|
5530
5600
|
children: d("appDesigner.fontDefault")
|
|
5531
|
-
}),
|
|
5601
|
+
}), xn.map((e) => /* @__PURE__ */ J("option", {
|
|
5532
5602
|
value: e,
|
|
5533
5603
|
children: e
|
|
5534
5604
|
}, e))]
|
|
@@ -5552,7 +5622,7 @@ function _n({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
5552
5622
|
type: "button",
|
|
5553
5623
|
onClick: () => p("light"),
|
|
5554
5624
|
className: $("inline-flex items-center gap-1 px-2.5 py-1 text-xs font-medium transition-colors", f === "light" ? "bg-blue-50 text-blue-700" : "bg-white text-gray-600 hover:bg-gray-50"),
|
|
5555
|
-
children: [/* @__PURE__ */ J(
|
|
5625
|
+
children: [/* @__PURE__ */ J(De, { className: "h-3.5 w-3.5" }), d("appDesigner.modeLight")]
|
|
5556
5626
|
}), /* @__PURE__ */ Y("button", {
|
|
5557
5627
|
"data-testid": "branding-mode-dark",
|
|
5558
5628
|
type: "button",
|
|
@@ -5673,15 +5743,15 @@ function _n({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
5673
5743
|
}
|
|
5674
5744
|
//#endregion
|
|
5675
5745
|
//#region src/ObjectManager.tsx
|
|
5676
|
-
function
|
|
5746
|
+
function Cn(...e) {
|
|
5677
5747
|
return K(G(e));
|
|
5678
5748
|
}
|
|
5679
|
-
var
|
|
5749
|
+
var wn = [
|
|
5680
5750
|
"Custom Objects",
|
|
5681
5751
|
"System Objects",
|
|
5682
5752
|
"Integration",
|
|
5683
5753
|
"Analytics"
|
|
5684
|
-
],
|
|
5754
|
+
], Tn = [
|
|
5685
5755
|
"Box",
|
|
5686
5756
|
"Database",
|
|
5687
5757
|
"Users",
|
|
@@ -5703,8 +5773,8 @@ var yn = [
|
|
|
5703
5773
|
"Truck",
|
|
5704
5774
|
"CreditCard"
|
|
5705
5775
|
];
|
|
5706
|
-
function
|
|
5707
|
-
let { t: u } =
|
|
5776
|
+
function En({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjects: a = !0, readOnly: o = !1, className: c }) {
|
|
5777
|
+
let { t: u } = zt(), d = at(), [f, p] = l(!1), [m, h] = l(null), g = s(() => a ? e : e.filter((e) => !e.isSystem), [e, a]), _ = s(() => new t({ items: g }), [g]), v = s(() => [
|
|
5708
5778
|
{
|
|
5709
5779
|
field: "name",
|
|
5710
5780
|
label: u("appDesigner.objectManager.objectName"),
|
|
@@ -5834,7 +5904,7 @@ function xn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
5834
5904
|
name: "icon",
|
|
5835
5905
|
label: u("appDesigner.objectManager.icon"),
|
|
5836
5906
|
type: "select",
|
|
5837
|
-
options:
|
|
5907
|
+
options: Tn.map((e) => ({
|
|
5838
5908
|
label: e,
|
|
5839
5909
|
value: e
|
|
5840
5910
|
})),
|
|
@@ -5844,7 +5914,7 @@ function xn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
5844
5914
|
name: "group",
|
|
5845
5915
|
label: u("appDesigner.objectManager.group"),
|
|
5846
5916
|
type: "select",
|
|
5847
|
-
options:
|
|
5917
|
+
options: wn.map((e) => ({
|
|
5848
5918
|
label: e,
|
|
5849
5919
|
value: e
|
|
5850
5920
|
})),
|
|
@@ -5879,7 +5949,7 @@ function xn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
5879
5949
|
]);
|
|
5880
5950
|
return /* @__PURE__ */ Y("div", {
|
|
5881
5951
|
"data-testid": "object-manager",
|
|
5882
|
-
className:
|
|
5952
|
+
className: Cn("w-full space-y-3", c),
|
|
5883
5953
|
children: [
|
|
5884
5954
|
/* @__PURE__ */ J("div", {
|
|
5885
5955
|
className: "flex items-center justify-between",
|
|
@@ -5898,7 +5968,7 @@ function xn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
5898
5968
|
]
|
|
5899
5969
|
})
|
|
5900
5970
|
}),
|
|
5901
|
-
/* @__PURE__ */ J(
|
|
5971
|
+
/* @__PURE__ */ J(Xe, {
|
|
5902
5972
|
schema: y,
|
|
5903
5973
|
dataSource: _,
|
|
5904
5974
|
onRowClick: b,
|
|
@@ -5906,8 +5976,8 @@ function xn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
5906
5976
|
onDelete: o ? void 0 : S,
|
|
5907
5977
|
onAddRecord: o ? void 0 : C
|
|
5908
5978
|
}),
|
|
5909
|
-
f && /* @__PURE__ */ J(
|
|
5910
|
-
/* @__PURE__ */ J(
|
|
5979
|
+
f && /* @__PURE__ */ J(Qe, { schema: D }),
|
|
5980
|
+
/* @__PURE__ */ J(ut, {
|
|
5911
5981
|
isOpen: d.isOpen,
|
|
5912
5982
|
title: d.title,
|
|
5913
5983
|
message: d.message,
|
|
@@ -5922,13 +5992,13 @@ function xn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
5922
5992
|
}
|
|
5923
5993
|
//#endregion
|
|
5924
5994
|
//#region src/FieldDesigner.tsx
|
|
5925
|
-
function
|
|
5995
|
+
function Dn(...e) {
|
|
5926
5996
|
return K(G(e));
|
|
5927
5997
|
}
|
|
5928
|
-
var
|
|
5998
|
+
var On = {
|
|
5929
5999
|
text: {
|
|
5930
6000
|
label: "Text",
|
|
5931
|
-
Icon:
|
|
6001
|
+
Icon: Me
|
|
5932
6002
|
},
|
|
5933
6003
|
textarea: {
|
|
5934
6004
|
label: "Text Area",
|
|
@@ -5940,7 +6010,7 @@ var Cn = {
|
|
|
5940
6010
|
},
|
|
5941
6011
|
boolean: {
|
|
5942
6012
|
label: "Checkbox",
|
|
5943
|
-
Icon:
|
|
6013
|
+
Icon: ke
|
|
5944
6014
|
},
|
|
5945
6015
|
date: {
|
|
5946
6016
|
label: "Date",
|
|
@@ -5956,7 +6026,7 @@ var Cn = {
|
|
|
5956
6026
|
},
|
|
5957
6027
|
select: {
|
|
5958
6028
|
label: "Picklist",
|
|
5959
|
-
Icon:
|
|
6029
|
+
Icon: oe
|
|
5960
6030
|
},
|
|
5961
6031
|
email: {
|
|
5962
6032
|
label: "Email",
|
|
@@ -5964,7 +6034,7 @@ var Cn = {
|
|
|
5964
6034
|
},
|
|
5965
6035
|
phone: {
|
|
5966
6036
|
label: "Phone",
|
|
5967
|
-
Icon:
|
|
6037
|
+
Icon: W
|
|
5968
6038
|
},
|
|
5969
6039
|
url: {
|
|
5970
6040
|
label: "URL",
|
|
@@ -5972,7 +6042,7 @@ var Cn = {
|
|
|
5972
6042
|
},
|
|
5973
6043
|
password: {
|
|
5974
6044
|
label: "Password",
|
|
5975
|
-
Icon:
|
|
6045
|
+
Icon: V
|
|
5976
6046
|
},
|
|
5977
6047
|
currency: {
|
|
5978
6048
|
label: "Currency",
|
|
@@ -6012,7 +6082,7 @@ var Cn = {
|
|
|
6012
6082
|
},
|
|
6013
6083
|
color: {
|
|
6014
6084
|
label: "Color",
|
|
6015
|
-
Icon:
|
|
6085
|
+
Icon: fe
|
|
6016
6086
|
},
|
|
6017
6087
|
code: {
|
|
6018
6088
|
label: "Code",
|
|
@@ -6028,13 +6098,13 @@ var Cn = {
|
|
|
6028
6098
|
},
|
|
6029
6099
|
rating: {
|
|
6030
6100
|
label: "Rating",
|
|
6031
|
-
Icon:
|
|
6101
|
+
Icon: Ee
|
|
6032
6102
|
},
|
|
6033
6103
|
slider: {
|
|
6034
6104
|
label: "Slider",
|
|
6035
|
-
Icon:
|
|
6105
|
+
Icon: we
|
|
6036
6106
|
}
|
|
6037
|
-
},
|
|
6107
|
+
}, kn = {
|
|
6038
6108
|
text: [
|
|
6039
6109
|
"text",
|
|
6040
6110
|
"textarea",
|
|
@@ -6069,7 +6139,7 @@ var Cn = {
|
|
|
6069
6139
|
"location",
|
|
6070
6140
|
"address"
|
|
6071
6141
|
]
|
|
6072
|
-
},
|
|
6142
|
+
}, An = [
|
|
6073
6143
|
"text",
|
|
6074
6144
|
"number",
|
|
6075
6145
|
"date",
|
|
@@ -6077,8 +6147,8 @@ var Cn = {
|
|
|
6077
6147
|
"relation",
|
|
6078
6148
|
"advanced"
|
|
6079
6149
|
];
|
|
6080
|
-
function
|
|
6081
|
-
let { t: c } =
|
|
6150
|
+
function jn({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, className: o }) {
|
|
6151
|
+
let { t: c } = zt(), u = at(), [d, f] = l(!1), [p, m] = l(null), [h, g] = l(""), _ = s(() => h ? n.filter((e) => e.type === h) : n, [n, h]), v = s(() => new t({ items: _ }), [_]), y = s(() => [
|
|
6082
6152
|
{
|
|
6083
6153
|
field: "name",
|
|
6084
6154
|
label: c("appDesigner.fieldDesigner.fieldName"),
|
|
@@ -6150,7 +6220,6 @@ function En({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
6150
6220
|
unique: e.unique === !0,
|
|
6151
6221
|
readonly: e.readonly === !0,
|
|
6152
6222
|
hidden: e.hidden === !0,
|
|
6153
|
-
indexed: e.indexed === !0,
|
|
6154
6223
|
externalId: e.externalId === !0,
|
|
6155
6224
|
trackHistory: e.trackHistory === !0,
|
|
6156
6225
|
defaultValue: e.defaultValue ? String(e.defaultValue) : void 0,
|
|
@@ -6171,7 +6240,6 @@ function En({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
6171
6240
|
unique: e.unique === !0,
|
|
6172
6241
|
readonly: e.readonly === !0,
|
|
6173
6242
|
hidden: e.hidden === !0,
|
|
6174
|
-
indexed: e.indexed === !0,
|
|
6175
6243
|
externalId: e.externalId === !0,
|
|
6176
6244
|
trackHistory: e.trackHistory === !0,
|
|
6177
6245
|
defaultValue: e.defaultValue ? String(e.defaultValue) : void 0,
|
|
@@ -6189,11 +6257,11 @@ function En({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
6189
6257
|
r
|
|
6190
6258
|
]), E = i((e) => {
|
|
6191
6259
|
e || (f(!1), m(null));
|
|
6192
|
-
}, []), D = s(() =>
|
|
6260
|
+
}, []), D = s(() => An.map((e) => ({
|
|
6193
6261
|
category: e,
|
|
6194
6262
|
label: c(`appDesigner.fieldDesigner.typeCategory.${e}`),
|
|
6195
|
-
options:
|
|
6196
|
-
label:
|
|
6263
|
+
options: kn[e].map((e) => ({
|
|
6264
|
+
label: On[e].label,
|
|
6197
6265
|
value: e
|
|
6198
6266
|
}))
|
|
6199
6267
|
})), [c]), O = s(() => D.flatMap((e) => e.options), [D]), k = s(() => ({
|
|
@@ -6304,12 +6372,6 @@ function En({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
6304
6372
|
collapsible: !0,
|
|
6305
6373
|
collapsed: !0,
|
|
6306
6374
|
fields: [
|
|
6307
|
-
{
|
|
6308
|
-
name: "indexed",
|
|
6309
|
-
label: c("appDesigner.fieldDesigner.indexed"),
|
|
6310
|
-
type: "boolean",
|
|
6311
|
-
disabled: a
|
|
6312
|
-
},
|
|
6313
6375
|
{
|
|
6314
6376
|
name: "externalId",
|
|
6315
6377
|
label: c("appDesigner.fieldDesigner.externalId"),
|
|
@@ -6347,7 +6409,6 @@ function En({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
6347
6409
|
unique: p.unique || !1,
|
|
6348
6410
|
readonly: p.readonly || !1,
|
|
6349
6411
|
hidden: p.hidden || !1,
|
|
6350
|
-
indexed: p.indexed || !1,
|
|
6351
6412
|
externalId: p.externalId || !1,
|
|
6352
6413
|
trackHistory: p.trackHistory || !1,
|
|
6353
6414
|
defaultValue: p.defaultValue == null ? "" : String(p.defaultValue),
|
|
@@ -6373,7 +6434,7 @@ function En({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
6373
6434
|
]);
|
|
6374
6435
|
return /* @__PURE__ */ Y("div", {
|
|
6375
6436
|
"data-testid": "field-designer",
|
|
6376
|
-
className:
|
|
6437
|
+
className: Dn("w-full space-y-3", o),
|
|
6377
6438
|
children: [
|
|
6378
6439
|
/* @__PURE__ */ Y("div", {
|
|
6379
6440
|
className: "flex items-center justify-between",
|
|
@@ -6411,15 +6472,15 @@ function En({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
6411
6472
|
}, e.category))]
|
|
6412
6473
|
})]
|
|
6413
6474
|
}),
|
|
6414
|
-
/* @__PURE__ */ J(
|
|
6475
|
+
/* @__PURE__ */ J(Xe, {
|
|
6415
6476
|
schema: b,
|
|
6416
6477
|
dataSource: v,
|
|
6417
6478
|
onEdit: a ? void 0 : x,
|
|
6418
6479
|
onDelete: a ? void 0 : S,
|
|
6419
6480
|
onAddRecord: a ? void 0 : w
|
|
6420
6481
|
}),
|
|
6421
|
-
d && /* @__PURE__ */ J(
|
|
6422
|
-
/* @__PURE__ */ J(
|
|
6482
|
+
d && /* @__PURE__ */ J(Ze, { schema: k }),
|
|
6483
|
+
/* @__PURE__ */ J(ut, {
|
|
6423
6484
|
isOpen: u.isOpen,
|
|
6424
6485
|
title: u.title,
|
|
6425
6486
|
message: u.message,
|
|
@@ -6434,12 +6495,12 @@ function En({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
6434
6495
|
}
|
|
6435
6496
|
//#endregion
|
|
6436
6497
|
//#region src/components/VersionHistory.tsx
|
|
6437
|
-
function
|
|
6498
|
+
function Mn(...e) {
|
|
6438
6499
|
return K(G(e));
|
|
6439
6500
|
}
|
|
6440
|
-
function
|
|
6501
|
+
function Nn({ versions: e, onRestore: t, className: n }) {
|
|
6441
6502
|
return /* @__PURE__ */ Y("div", {
|
|
6442
|
-
className:
|
|
6503
|
+
className: Mn("flex flex-col", n),
|
|
6443
6504
|
role: "region",
|
|
6444
6505
|
"aria-label": "Version history",
|
|
6445
6506
|
children: [/* @__PURE__ */ Y("div", {
|
|
@@ -6453,8 +6514,8 @@ function On({ versions: e, onRestore: t, className: n }) {
|
|
|
6453
6514
|
}) : /* @__PURE__ */ Y("div", {
|
|
6454
6515
|
className: "relative",
|
|
6455
6516
|
children: [/* @__PURE__ */ J("div", { className: "absolute left-5 top-0 bottom-0 w-px bg-border" }), e.map((e) => /* @__PURE__ */ Y("div", {
|
|
6456
|
-
className:
|
|
6457
|
-
children: [/* @__PURE__ */ J("div", { className:
|
|
6517
|
+
className: Mn("relative flex items-start gap-3 px-3 py-2 hover:bg-accent/50", e.isCurrent && "bg-accent/30"),
|
|
6518
|
+
children: [/* @__PURE__ */ J("div", { className: Mn("relative z-10 mt-1 h-2.5 w-2.5 rounded-full border-2 bg-background", e.isCurrent ? "border-primary" : "border-muted-foreground") }), /* @__PURE__ */ Y("div", {
|
|
6458
6519
|
className: "flex-1 min-w-0",
|
|
6459
6520
|
children: [
|
|
6460
6521
|
/* @__PURE__ */ Y("div", {
|
|
@@ -6474,13 +6535,14 @@ function On({ versions: e, onRestore: t, className: n }) {
|
|
|
6474
6535
|
/* @__PURE__ */ Y("div", {
|
|
6475
6536
|
className: "flex items-center gap-2 mt-1 text-[0.65rem] text-muted-foreground/70",
|
|
6476
6537
|
children: [
|
|
6477
|
-
/* @__PURE__ */ J(
|
|
6538
|
+
/* @__PURE__ */ J(Fe, { className: "h-2.5 w-2.5" }),
|
|
6478
6539
|
/* @__PURE__ */ J("span", { children: e.userName }),
|
|
6479
6540
|
/* @__PURE__ */ J(x, { className: "h-2.5 w-2.5 ml-1" }),
|
|
6480
6541
|
/* @__PURE__ */ J("span", { children: new Date(e.timestamp).toLocaleString() })
|
|
6481
6542
|
]
|
|
6482
6543
|
}),
|
|
6483
6544
|
!e.isCurrent && t && /* @__PURE__ */ J("button", {
|
|
6545
|
+
type: "button",
|
|
6484
6546
|
onClick: () => t(e.version),
|
|
6485
6547
|
className: "mt-1 text-[0.65rem] text-primary hover:underline",
|
|
6486
6548
|
children: "Restore this version"
|
|
@@ -6494,9 +6556,9 @@ function On({ versions: e, onRestore: t, className: n }) {
|
|
|
6494
6556
|
}
|
|
6495
6557
|
//#endregion
|
|
6496
6558
|
//#region src/pages/CreateAppPage.tsx
|
|
6497
|
-
var
|
|
6498
|
-
function
|
|
6499
|
-
let e =
|
|
6559
|
+
var Pn = "objectui-app-wizard-draft";
|
|
6560
|
+
function Fn() {
|
|
6561
|
+
let e = $e(), { appName: t } = et(), { objects: n, refresh: r } = Ke(), a = Ge(), o = (n || []).map((e) => ({
|
|
6500
6562
|
name: e.name,
|
|
6501
6563
|
label: e.label || e.name,
|
|
6502
6564
|
pluralLabel: e.pluralLabel,
|
|
@@ -6504,15 +6566,15 @@ function An() {
|
|
|
6504
6566
|
selected: !1
|
|
6505
6567
|
})), s = i(() => {
|
|
6506
6568
|
try {
|
|
6507
|
-
let e = localStorage.getItem(
|
|
6569
|
+
let e = localStorage.getItem(Pn);
|
|
6508
6570
|
if (e) return JSON.parse(e);
|
|
6509
6571
|
} catch {}
|
|
6510
6572
|
}, []), c = i(async (t) => {
|
|
6511
6573
|
try {
|
|
6512
6574
|
let n = Ue(t), i = a?.getClient();
|
|
6513
|
-
i && await i.meta.saveItem("app", t.name, n), localStorage.removeItem(
|
|
6575
|
+
i && await i.meta.saveItem("app", t.name, n), localStorage.removeItem(Pn), tt.success(`Application "${t.title}" created successfully`), await r?.(), e(`/apps/${t.name}`);
|
|
6514
6576
|
} catch (e) {
|
|
6515
|
-
|
|
6577
|
+
tt.error(e?.message || "Failed to create application");
|
|
6516
6578
|
}
|
|
6517
6579
|
}, [
|
|
6518
6580
|
e,
|
|
@@ -6522,13 +6584,13 @@ function An() {
|
|
|
6522
6584
|
e(t ? `/apps/${t}` : "/");
|
|
6523
6585
|
}, [e, t]), u = i((e) => {
|
|
6524
6586
|
try {
|
|
6525
|
-
localStorage.setItem(
|
|
6587
|
+
localStorage.setItem(Pn, JSON.stringify(e)), tt.info("Draft saved");
|
|
6526
6588
|
} catch {}
|
|
6527
6589
|
}, []);
|
|
6528
6590
|
return /* @__PURE__ */ J("div", {
|
|
6529
6591
|
className: "mx-auto max-w-4xl py-8 px-4",
|
|
6530
6592
|
"data-testid": "create-app-page",
|
|
6531
|
-
children: /* @__PURE__ */ J(
|
|
6593
|
+
children: /* @__PURE__ */ J(Xt, {
|
|
6532
6594
|
availableObjects: o,
|
|
6533
6595
|
initialDraft: s(),
|
|
6534
6596
|
onComplete: c,
|
|
@@ -6539,8 +6601,8 @@ function An() {
|
|
|
6539
6601
|
}
|
|
6540
6602
|
//#endregion
|
|
6541
6603
|
//#region src/pages/EditAppPage.tsx
|
|
6542
|
-
function
|
|
6543
|
-
let e =
|
|
6604
|
+
function In() {
|
|
6605
|
+
let e = $e(), { appName: t, editAppName: n } = et(), { apps: r, objects: a, refresh: o } = Ke(), c = Ge(), l = n || t, u = r.find((e) => e.name === l), d = (a || []).map((e) => ({
|
|
6544
6606
|
name: e.name,
|
|
6545
6607
|
label: e.label || e.name,
|
|
6546
6608
|
pluralLabel: e.pluralLabel,
|
|
@@ -6566,9 +6628,9 @@ function jn() {
|
|
|
6566
6628
|
...u,
|
|
6567
6629
|
...n
|
|
6568
6630
|
}, i = c?.getClient();
|
|
6569
|
-
i && await i.meta.saveItem("app", t.name, r),
|
|
6631
|
+
i && await i.meta.saveItem("app", t.name, r), tt.success(`Application "${t.title}" updated successfully`), await o?.(), e(`/apps/${t.name}`);
|
|
6570
6632
|
} catch (e) {
|
|
6571
|
-
|
|
6633
|
+
tt.error(e?.message || "Failed to update application");
|
|
6572
6634
|
}
|
|
6573
6635
|
}, [
|
|
6574
6636
|
e,
|
|
@@ -6579,13 +6641,13 @@ function jn() {
|
|
|
6579
6641
|
e(t ? `/apps/${t}` : "/");
|
|
6580
6642
|
}, [e, t]), h = i((e) => {
|
|
6581
6643
|
try {
|
|
6582
|
-
localStorage.setItem(`objectui-edit-draft-${l}`, JSON.stringify(e)),
|
|
6644
|
+
localStorage.setItem(`objectui-edit-draft-${l}`, JSON.stringify(e)), tt.info("Draft saved");
|
|
6583
6645
|
} catch {}
|
|
6584
6646
|
}, [l]);
|
|
6585
6647
|
return u ? /* @__PURE__ */ J("div", {
|
|
6586
6648
|
className: "mx-auto max-w-4xl py-8 px-4",
|
|
6587
6649
|
"data-testid": "edit-app-page",
|
|
6588
|
-
children: /* @__PURE__ */ J(
|
|
6650
|
+
children: /* @__PURE__ */ J(Xt, {
|
|
6589
6651
|
availableObjects: d,
|
|
6590
6652
|
initialDraft: f,
|
|
6591
6653
|
onComplete: p,
|
|
@@ -6607,8 +6669,8 @@ function jn() {
|
|
|
6607
6669
|
}
|
|
6608
6670
|
//#endregion
|
|
6609
6671
|
//#region src/pages/DashboardDesignPage.tsx
|
|
6610
|
-
function
|
|
6611
|
-
let e =
|
|
6672
|
+
function Ln() {
|
|
6673
|
+
let e = $e(), { dashboardName: t } = et(), n = Ge(), { dashboards: r, refresh: a } = Ke(), s = r?.find((e) => e.name === t), [u, f] = l(() => He(s) || {
|
|
6612
6674
|
type: "dashboard",
|
|
6613
6675
|
name: t ?? "",
|
|
6614
6676
|
title: t ?? "",
|
|
@@ -6626,21 +6688,22 @@ function Mn() {
|
|
|
6626
6688
|
t,
|
|
6627
6689
|
a
|
|
6628
6690
|
]), h = i(async (e) => {
|
|
6629
|
-
|
|
6691
|
+
let t = He(e);
|
|
6692
|
+
f(t), await m(t);
|
|
6630
6693
|
}, [m]);
|
|
6631
6694
|
o(() => {
|
|
6632
6695
|
let e = (e) => {
|
|
6633
6696
|
(e.ctrlKey || e.metaKey) && e.key === "s" && (e.preventDefault(), m(p.current).then((e) => {
|
|
6634
|
-
e &&
|
|
6697
|
+
e && tt.success("Dashboard saved");
|
|
6635
6698
|
}));
|
|
6636
6699
|
};
|
|
6637
6700
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
6638
6701
|
}, [m]);
|
|
6639
6702
|
let g = i((e) => {
|
|
6640
6703
|
let n = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), r = URL.createObjectURL(n), i = document.createElement("a");
|
|
6641
|
-
i.href = r, i.download = `${t || "dashboard"}.json`, i.click(), URL.revokeObjectURL(r),
|
|
6704
|
+
i.href = r, i.download = `${t || "dashboard"}.json`, i.click(), URL.revokeObjectURL(r), tt.success("Dashboard schema exported");
|
|
6642
6705
|
}, [t]), _ = i((e) => {
|
|
6643
|
-
|
|
6706
|
+
tt.success("Dashboard schema imported"), h(e);
|
|
6644
6707
|
}, [h]);
|
|
6645
6708
|
return s ? /* @__PURE__ */ Y("div", {
|
|
6646
6709
|
className: "h-full flex flex-col",
|
|
@@ -6660,7 +6723,7 @@ function Mn() {
|
|
|
6660
6723
|
})]
|
|
6661
6724
|
}), /* @__PURE__ */ J("div", {
|
|
6662
6725
|
className: "flex-1 overflow-auto p-4 sm:p-6",
|
|
6663
|
-
children: /* @__PURE__ */ J(
|
|
6726
|
+
children: /* @__PURE__ */ J(yn, {
|
|
6664
6727
|
schema: u,
|
|
6665
6728
|
onChange: h,
|
|
6666
6729
|
onExport: g,
|
|
@@ -6678,7 +6741,7 @@ function Mn() {
|
|
|
6678
6741
|
}
|
|
6679
6742
|
//#endregion
|
|
6680
6743
|
//#region src/MetadataObjectsPage.tsx
|
|
6681
|
-
function
|
|
6744
|
+
function Rn(e) {
|
|
6682
6745
|
let t = e.fields && typeof e.fields == "object" ? Object.keys(e.fields).length : 0;
|
|
6683
6746
|
return {
|
|
6684
6747
|
id: e.name,
|
|
@@ -6692,11 +6755,11 @@ function Nn(e) {
|
|
|
6692
6755
|
fieldCount: t
|
|
6693
6756
|
};
|
|
6694
6757
|
}
|
|
6695
|
-
function
|
|
6758
|
+
function zn({ client: e, clientConfig: t, hideSystemObjects: n = !1, readOnly: r = !1, onSelectObject: a, className: c }) {
|
|
6696
6759
|
let u = s(() => {
|
|
6697
6760
|
if (e) return e;
|
|
6698
6761
|
if (!t) throw Error("MetadataObjectsPage: provide either `client` or `clientConfig`.");
|
|
6699
|
-
return new
|
|
6762
|
+
return new nt(t);
|
|
6700
6763
|
}, [e, t]), [d, f] = l({
|
|
6701
6764
|
loading: !0,
|
|
6702
6765
|
error: null,
|
|
@@ -6726,7 +6789,7 @@ function Pn({ client: e, clientConfig: t, hideSystemObjects: n = !1, readOnly: r
|
|
|
6726
6789
|
o(() => {
|
|
6727
6790
|
p();
|
|
6728
6791
|
}, [p]);
|
|
6729
|
-
let m = s(() => Object.values(d.byName).map(
|
|
6792
|
+
let m = s(() => Object.values(d.byName).map(Rn), [d.byName]), h = i(async (e) => {
|
|
6730
6793
|
let t = d.byName, n = {};
|
|
6731
6794
|
for (let t of e) n[t.name] = t;
|
|
6732
6795
|
let r = [];
|
|
@@ -6775,7 +6838,7 @@ function Pn({ client: e, clientConfig: t, hideSystemObjects: n = !1, readOnly: r
|
|
|
6775
6838
|
"data-testid": "metadata-objects-page-error",
|
|
6776
6839
|
className: "mb-2 whitespace-pre-wrap rounded bg-red-50 p-2 text-xs text-red-700",
|
|
6777
6840
|
children: d.error
|
|
6778
|
-
}), /* @__PURE__ */ J(
|
|
6841
|
+
}), /* @__PURE__ */ J(En, {
|
|
6779
6842
|
objects: m,
|
|
6780
6843
|
onObjectsChange: (e) => {
|
|
6781
6844
|
h(e);
|
|
@@ -6788,16 +6851,16 @@ function Pn({ client: e, clientConfig: t, hideSystemObjects: n = !1, readOnly: r
|
|
|
6788
6851
|
}
|
|
6789
6852
|
//#endregion
|
|
6790
6853
|
//#region src/MetadataFieldsPage.tsx
|
|
6791
|
-
var
|
|
6792
|
-
function
|
|
6793
|
-
return e &&
|
|
6854
|
+
var Bn = new Set(Be);
|
|
6855
|
+
function Vn(e) {
|
|
6856
|
+
return e && Bn.has(e) ? e : "text";
|
|
6794
6857
|
}
|
|
6795
|
-
function
|
|
6858
|
+
function Hn(e, t) {
|
|
6796
6859
|
return {
|
|
6797
6860
|
id: e,
|
|
6798
6861
|
name: e,
|
|
6799
6862
|
label: t.label ?? e,
|
|
6800
|
-
type:
|
|
6863
|
+
type: Vn(t.type),
|
|
6801
6864
|
group: t.group,
|
|
6802
6865
|
description: t.description,
|
|
6803
6866
|
required: t.required,
|
|
@@ -6809,14 +6872,20 @@ function Ln(e, t) {
|
|
|
6809
6872
|
isSystem: t.isSystem,
|
|
6810
6873
|
externalId: t.externalId,
|
|
6811
6874
|
trackHistory: t.trackHistory,
|
|
6812
|
-
indexed: t.indexed,
|
|
6813
6875
|
referenceTo: t.referenceTo,
|
|
6814
6876
|
formula: t.formula
|
|
6815
6877
|
};
|
|
6816
6878
|
}
|
|
6817
|
-
|
|
6879
|
+
var Un = ["indexed"];
|
|
6880
|
+
function Wn(e) {
|
|
6881
|
+
if (!e) return {};
|
|
6882
|
+
let t = { ...e };
|
|
6883
|
+
for (let e of Un) delete t[e];
|
|
6884
|
+
return t;
|
|
6885
|
+
}
|
|
6886
|
+
function Gn(e, t) {
|
|
6818
6887
|
return {
|
|
6819
|
-
...t
|
|
6888
|
+
...Wn(t),
|
|
6820
6889
|
type: e.type,
|
|
6821
6890
|
label: e.label,
|
|
6822
6891
|
description: e.description,
|
|
@@ -6827,18 +6896,17 @@ function Rn(e, t) {
|
|
|
6827
6896
|
defaultValue: e.defaultValue,
|
|
6828
6897
|
placeholder: e.placeholder,
|
|
6829
6898
|
group: e.group,
|
|
6830
|
-
indexed: e.indexed,
|
|
6831
6899
|
externalId: e.externalId,
|
|
6832
6900
|
trackHistory: e.trackHistory,
|
|
6833
6901
|
referenceTo: e.referenceTo,
|
|
6834
6902
|
formula: e.formula
|
|
6835
6903
|
};
|
|
6836
6904
|
}
|
|
6837
|
-
function
|
|
6905
|
+
function Kn({ objectName: e, client: t, clientConfig: n, readOnly: r = !1, className: a }) {
|
|
6838
6906
|
let c = s(() => {
|
|
6839
6907
|
if (t) return t;
|
|
6840
6908
|
if (!n) throw Error("MetadataFieldsPage: provide either `client` or `clientConfig`.");
|
|
6841
|
-
return new
|
|
6909
|
+
return new nt(n);
|
|
6842
6910
|
}, [t, n]), [u, d] = l({
|
|
6843
6911
|
loading: !0,
|
|
6844
6912
|
error: null,
|
|
@@ -6875,10 +6943,10 @@ function zn({ objectName: e, client: t, clientConfig: n, readOnly: r = !1, class
|
|
|
6875
6943
|
o(() => {
|
|
6876
6944
|
f();
|
|
6877
6945
|
}, [f]);
|
|
6878
|
-
let p = s(() => u.raw?.fields ? Object.entries(u.raw.fields).map(([e, t]) =>
|
|
6946
|
+
let p = s(() => u.raw?.fields ? Object.entries(u.raw.fields).map(([e, t]) => Hn(e, t)) : [], [u.raw]), m = i(async (t) => {
|
|
6879
6947
|
if (!u.raw) return;
|
|
6880
6948
|
let n = u.raw.fields ?? {}, r = {};
|
|
6881
|
-
for (let e of t) r[e.name] =
|
|
6949
|
+
for (let e of t) r[e.name] = Gn(e, n[e.name]);
|
|
6882
6950
|
let i = {
|
|
6883
6951
|
...u.raw,
|
|
6884
6952
|
fields: r
|
|
@@ -6908,7 +6976,7 @@ function zn({ objectName: e, client: t, clientConfig: n, readOnly: r = !1, class
|
|
|
6908
6976
|
"data-testid": "metadata-fields-page-error",
|
|
6909
6977
|
className: "mb-2 whitespace-pre-wrap rounded bg-red-50 p-2 text-xs text-red-700",
|
|
6910
6978
|
children: u.error
|
|
6911
|
-
}), /* @__PURE__ */ J(
|
|
6979
|
+
}), /* @__PURE__ */ J(jn, {
|
|
6912
6980
|
objectName: e,
|
|
6913
6981
|
fields: p,
|
|
6914
6982
|
onFieldsChange: (e) => {
|
|
@@ -6918,7 +6986,7 @@ function zn({ objectName: e, client: t, clientConfig: n, readOnly: r = !1, class
|
|
|
6918
6986
|
})]
|
|
6919
6987
|
});
|
|
6920
6988
|
}
|
|
6921
|
-
e.register("page-designer",
|
|
6989
|
+
e.register("page-designer", St, {
|
|
6922
6990
|
namespace: "plugin-designer",
|
|
6923
6991
|
label: "Page Designer",
|
|
6924
6992
|
category: "Designer",
|
|
@@ -6952,7 +7020,7 @@ e.register("page-designer", bt, {
|
|
|
6952
7020
|
defaultValue: !1
|
|
6953
7021
|
}
|
|
6954
7022
|
]
|
|
6955
|
-
}), e.register("data-model-designer",
|
|
7023
|
+
}), e.register("data-model-designer", Ot, {
|
|
6956
7024
|
namespace: "plugin-designer",
|
|
6957
7025
|
label: "Data Model Designer",
|
|
6958
7026
|
category: "Designer",
|
|
@@ -6980,7 +7048,7 @@ e.register("page-designer", bt, {
|
|
|
6980
7048
|
defaultValue: !1
|
|
6981
7049
|
}
|
|
6982
7050
|
]
|
|
6983
|
-
}), e.register("process-designer",
|
|
7051
|
+
}), e.register("process-designer", Nt, {
|
|
6984
7052
|
namespace: "plugin-designer",
|
|
6985
7053
|
label: "Process Designer (BPMN)",
|
|
6986
7054
|
category: "Designer",
|
|
@@ -7019,7 +7087,7 @@ e.register("page-designer", bt, {
|
|
|
7019
7087
|
defaultValue: !1
|
|
7020
7088
|
}
|
|
7021
7089
|
]
|
|
7022
|
-
}), e.register("report-designer",
|
|
7090
|
+
}), e.register("report-designer", Lt, {
|
|
7023
7091
|
namespace: "plugin-designer",
|
|
7024
7092
|
label: "Report Designer",
|
|
7025
7093
|
category: "Designer",
|
|
@@ -7058,7 +7126,7 @@ e.register("page-designer", bt, {
|
|
|
7058
7126
|
defaultValue: !1
|
|
7059
7127
|
}
|
|
7060
7128
|
]
|
|
7061
|
-
}), e.register("app-creation-wizard",
|
|
7129
|
+
}), e.register("app-creation-wizard", Xt, {
|
|
7062
7130
|
namespace: "plugin-designer",
|
|
7063
7131
|
label: "App Creation Wizard",
|
|
7064
7132
|
category: "Designer",
|
|
@@ -7080,7 +7148,7 @@ e.register("page-designer", bt, {
|
|
|
7080
7148
|
defaultValue: !1
|
|
7081
7149
|
}
|
|
7082
7150
|
]
|
|
7083
|
-
}), e.register("navigation-designer",
|
|
7151
|
+
}), e.register("navigation-designer", on, {
|
|
7084
7152
|
namespace: "plugin-designer",
|
|
7085
7153
|
label: "Navigation Designer",
|
|
7086
7154
|
category: "Designer",
|
|
@@ -7103,7 +7171,7 @@ e.register("page-designer", bt, {
|
|
|
7103
7171
|
defaultValue: !1
|
|
7104
7172
|
}
|
|
7105
7173
|
]
|
|
7106
|
-
}), e.register("dashboard-editor",
|
|
7174
|
+
}), e.register("dashboard-editor", yn, {
|
|
7107
7175
|
namespace: "plugin-designer",
|
|
7108
7176
|
label: "Dashboard Editor",
|
|
7109
7177
|
category: "Designer",
|
|
@@ -7117,7 +7185,7 @@ e.register("page-designer", bt, {
|
|
|
7117
7185
|
label: "Read Only",
|
|
7118
7186
|
defaultValue: !1
|
|
7119
7187
|
}]
|
|
7120
|
-
}), e.register("branding-editor",
|
|
7188
|
+
}), e.register("branding-editor", Sn, {
|
|
7121
7189
|
namespace: "plugin-designer",
|
|
7122
7190
|
label: "Branding Editor",
|
|
7123
7191
|
category: "Designer",
|
|
@@ -7139,7 +7207,7 @@ e.register("page-designer", bt, {
|
|
|
7139
7207
|
defaultValue: !1
|
|
7140
7208
|
}
|
|
7141
7209
|
]
|
|
7142
|
-
}), e.register("object-manager",
|
|
7210
|
+
}), e.register("object-manager", En, {
|
|
7143
7211
|
namespace: "plugin-designer",
|
|
7144
7212
|
label: "Object Manager",
|
|
7145
7213
|
category: "Designer",
|
|
@@ -7162,7 +7230,7 @@ e.register("page-designer", bt, {
|
|
|
7162
7230
|
defaultValue: !1
|
|
7163
7231
|
}
|
|
7164
7232
|
]
|
|
7165
|
-
}), e.register("field-designer",
|
|
7233
|
+
}), e.register("field-designer", jn, {
|
|
7166
7234
|
namespace: "plugin-designer",
|
|
7167
7235
|
label: "Field Designer",
|
|
7168
7236
|
category: "Designer",
|
|
@@ -7186,4 +7254,4 @@ e.register("page-designer", bt, {
|
|
|
7186
7254
|
]
|
|
7187
7255
|
});
|
|
7188
7256
|
//#endregion
|
|
7189
|
-
export {
|
|
7257
|
+
export { Xt as AppCreationWizard, Sn as BrandingEditor, vt as CollaborationProvider, ut as ConfirmDialog, bt as ConnectionStatusIndicator, Fn as CreateAppPage, Rt as DESIGNER_DEFAULT_TRANSLATIONS, Ln as DashboardDesignPage, yn as DashboardEditor, Ot as DataModelDesigner, In as EditAppPage, ln as EditorModeToggle, jn as FieldDesigner, Kn as MetadataFieldsPage, zn as MetadataObjectsPage, ht as Minimap, on as NavigationDesigner, En as ObjectManager, St as PageDesigner, Nt as ProcessDesigner, ft as PropertyEditor, Lt as ReportDesigner, Nn as VersionHistory, ct as useCanvasPanZoom, st as useClipboard, at as useConfirmDialog, wt as useDesignerHistory, ot as useMultiSelect, it as useUndoRedo };
|