@object-ui/plugin-designer 6.2.0 → 6.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/index.js +262 -187
- package/dist/index.umd.cjs +2 -2
- package/dist/packages/plugin-designer/src/PageCanvasEditor.d.ts +4 -0
- package/package.json +10 -10
package/dist/index.js
CHANGED
|
@@ -5294,7 +5294,93 @@ function bn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5294
5294
|
function xn(...e) {
|
|
5295
5295
|
return K(G(e));
|
|
5296
5296
|
}
|
|
5297
|
-
|
|
5297
|
+
function Sn(e) {
|
|
5298
|
+
let t = e;
|
|
5299
|
+
return Array.isArray(t.regions) && t.regions.length > 0 ? "regions" : Array.isArray(t.body) && t.body.length > 0 ? "body" : t.children ? "children" : "empty";
|
|
5300
|
+
}
|
|
5301
|
+
function Cn(e) {
|
|
5302
|
+
let t = e, n = [], r = [];
|
|
5303
|
+
return Array.isArray(t.regions) && t.regions.length > 0 ? (t.regions.forEach((e) => {
|
|
5304
|
+
r.push({
|
|
5305
|
+
name: e.name,
|
|
5306
|
+
type: e.type,
|
|
5307
|
+
width: e.width,
|
|
5308
|
+
className: e.className
|
|
5309
|
+
}), (Array.isArray(e.components) ? e.components : []).forEach((t, r) => {
|
|
5310
|
+
n.push({
|
|
5311
|
+
id: t.id || `${e.name}_${r}_${n.length}`,
|
|
5312
|
+
type: t.type || "grid",
|
|
5313
|
+
label: t.title || t.label || t?.properties?.title || t?.properties?.label || `${t.type || "Component"} ${n.length + 1}`,
|
|
5314
|
+
props: t.properties ?? t.props ?? {},
|
|
5315
|
+
regionName: e.name,
|
|
5316
|
+
shape: "properties"
|
|
5317
|
+
});
|
|
5318
|
+
});
|
|
5319
|
+
}), {
|
|
5320
|
+
components: n,
|
|
5321
|
+
regionMeta: r
|
|
5322
|
+
}) : Array.isArray(t.body) && t.body.length > 0 ? (t.body.forEach((e, t) => {
|
|
5323
|
+
n.push({
|
|
5324
|
+
id: e.id || `body_${t}`,
|
|
5325
|
+
type: e.type || "grid",
|
|
5326
|
+
label: e.title || e.label || e?.properties?.title || `${e.type || "Component"} ${t + 1}`,
|
|
5327
|
+
props: e.properties ?? e.props ?? {},
|
|
5328
|
+
shape: "properties"
|
|
5329
|
+
});
|
|
5330
|
+
}), {
|
|
5331
|
+
components: n,
|
|
5332
|
+
regionMeta: r
|
|
5333
|
+
}) : ((t.children ? Array.isArray(t.children) ? t.children : [t.children] : []).forEach((e, t) => {
|
|
5334
|
+
n.push({
|
|
5335
|
+
id: e.id || `existing_${t}`,
|
|
5336
|
+
type: e.type || "grid",
|
|
5337
|
+
label: e.title || e.label || `Component ${t + 1}`,
|
|
5338
|
+
props: e,
|
|
5339
|
+
shape: "inline"
|
|
5340
|
+
});
|
|
5341
|
+
}), {
|
|
5342
|
+
components: n,
|
|
5343
|
+
regionMeta: r
|
|
5344
|
+
});
|
|
5345
|
+
}
|
|
5346
|
+
function wn(e) {
|
|
5347
|
+
return e.shape === "properties" ? {
|
|
5348
|
+
type: e.type,
|
|
5349
|
+
id: e.id,
|
|
5350
|
+
properties: e.props ?? {}
|
|
5351
|
+
} : {
|
|
5352
|
+
type: e.type,
|
|
5353
|
+
id: e.id,
|
|
5354
|
+
title: e.label,
|
|
5355
|
+
...e.props
|
|
5356
|
+
};
|
|
5357
|
+
}
|
|
5358
|
+
function Tn(e, t, n, r) {
|
|
5359
|
+
let i = { ...e };
|
|
5360
|
+
if (delete i.regions, delete i.body, delete i.children, n === "regions") {
|
|
5361
|
+
let e = /* @__PURE__ */ new Map();
|
|
5362
|
+
return r.forEach((t) => e.set(t.name, [])), t.forEach((t) => {
|
|
5363
|
+
let n = t.regionName ?? r[0]?.name ?? "main";
|
|
5364
|
+
e.has(n) || e.set(n, []), e.get(n).push(wn(t));
|
|
5365
|
+
}), i.regions = Array.from(e.entries()).map(([e, t]) => {
|
|
5366
|
+
let n = r.find((t) => t.name === e);
|
|
5367
|
+
return {
|
|
5368
|
+
name: e,
|
|
5369
|
+
...n?.type ? { type: n.type } : {},
|
|
5370
|
+
...n?.width == null ? {} : { width: n.width },
|
|
5371
|
+
...n?.className ? { className: n.className } : {},
|
|
5372
|
+
components: t
|
|
5373
|
+
};
|
|
5374
|
+
}), i;
|
|
5375
|
+
}
|
|
5376
|
+
return n === "body" ? (i.body = t.map(wn), i) : (i.children = t.map((e) => ({
|
|
5377
|
+
type: e.type,
|
|
5378
|
+
id: e.id,
|
|
5379
|
+
title: e.label,
|
|
5380
|
+
...e.props ?? {}
|
|
5381
|
+
})), i);
|
|
5382
|
+
}
|
|
5383
|
+
var En = [
|
|
5298
5384
|
{
|
|
5299
5385
|
type: "grid",
|
|
5300
5386
|
label: "Data Grid",
|
|
@@ -5330,18 +5416,18 @@ var Sn = [
|
|
|
5330
5416
|
label: "Grid Layout",
|
|
5331
5417
|
Icon: ie
|
|
5332
5418
|
}
|
|
5333
|
-
],
|
|
5419
|
+
], Dn = [{
|
|
5334
5420
|
value: "page",
|
|
5335
5421
|
labelKey: "appDesigner.modePage"
|
|
5336
5422
|
}, {
|
|
5337
5423
|
value: "dashboard",
|
|
5338
5424
|
labelKey: "appDesigner.modeDashboard"
|
|
5339
|
-
}],
|
|
5340
|
-
function
|
|
5341
|
-
return
|
|
5425
|
+
}], On = 0;
|
|
5426
|
+
function kn() {
|
|
5427
|
+
return On += 1, `component_${Date.now()}_${On}`;
|
|
5342
5428
|
}
|
|
5343
|
-
function
|
|
5344
|
-
let l =
|
|
5429
|
+
function An({ component: e, index: t, total: n, selected: r, readOnly: i, onSelect: a, onRemove: o, onMoveUp: s, onMoveDown: c }) {
|
|
5430
|
+
let l = En.find((t) => t.type === e.type) || En[0];
|
|
5345
5431
|
return /* @__PURE__ */ Y("div", {
|
|
5346
5432
|
"data-testid": `canvas-component-${e.id}`,
|
|
5347
5433
|
onClick: a,
|
|
@@ -5397,7 +5483,7 @@ function En({ component: e, index: t, total: n, selected: r, readOnly: i, onSele
|
|
|
5397
5483
|
]
|
|
5398
5484
|
});
|
|
5399
5485
|
}
|
|
5400
|
-
function
|
|
5486
|
+
function jn({ component: e, readOnly: t, onChange: n, onClose: r }) {
|
|
5401
5487
|
let { t: i } = Vt();
|
|
5402
5488
|
return /* @__PURE__ */ Y("div", {
|
|
5403
5489
|
"data-testid": "component-property-panel",
|
|
@@ -5439,7 +5525,7 @@ function Dn({ component: e, readOnly: t, onChange: n, onClose: r }) {
|
|
|
5439
5525
|
children: "Type"
|
|
5440
5526
|
}), /* @__PURE__ */ J("div", {
|
|
5441
5527
|
className: "rounded-md bg-gray-50 px-2.5 py-1.5 text-sm text-gray-600",
|
|
5442
|
-
children:
|
|
5528
|
+
children: En.find((t) => t.type === e.type)?.label ?? e.type
|
|
5443
5529
|
})]
|
|
5444
5530
|
}),
|
|
5445
5531
|
/* @__PURE__ */ Y("div", {
|
|
@@ -5455,7 +5541,7 @@ function Dn({ component: e, readOnly: t, onChange: n, onClose: r }) {
|
|
|
5455
5541
|
]
|
|
5456
5542
|
});
|
|
5457
5543
|
}
|
|
5458
|
-
function
|
|
5544
|
+
function Mn({ schema: e, components: t }) {
|
|
5459
5545
|
let { t: n } = Vt();
|
|
5460
5546
|
return /* @__PURE__ */ Y("div", {
|
|
5461
5547
|
"data-testid": "page-preview",
|
|
@@ -5469,7 +5555,7 @@ function On({ schema: e, components: t }) {
|
|
|
5469
5555
|
}) : /* @__PURE__ */ J("div", {
|
|
5470
5556
|
className: "space-y-2",
|
|
5471
5557
|
children: t.map((e) => {
|
|
5472
|
-
let t =
|
|
5558
|
+
let t = En.find((t) => t.type === e.type) || En[0];
|
|
5473
5559
|
return /* @__PURE__ */ Y("div", {
|
|
5474
5560
|
className: "flex items-center gap-2 rounded-md border border-gray-200 bg-white p-2",
|
|
5475
5561
|
children: [
|
|
@@ -5488,89 +5574,83 @@ function On({ schema: e, components: t }) {
|
|
|
5488
5574
|
})]
|
|
5489
5575
|
});
|
|
5490
5576
|
}
|
|
5491
|
-
function
|
|
5492
|
-
let { t:
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
type: e.type,
|
|
5502
|
-
id: e.id,
|
|
5503
|
-
title: e.label,
|
|
5504
|
-
...e.props
|
|
5505
|
-
}))
|
|
5506
|
-
});
|
|
5577
|
+
function Nn({ schema: e, onChange: t, readOnly: r = !1, className: a, onExport: s, onImport: u }) {
|
|
5578
|
+
let { t: d } = Vt(), f = c(null), p = c(null), m = n.useMemo(() => Cn(e), []), [h, g] = l(m.components), _ = c(Sn(e)), v = c(m.regionMeta), y = c(e);
|
|
5579
|
+
o(() => {
|
|
5580
|
+
if (y.current === e) return;
|
|
5581
|
+
y.current = e;
|
|
5582
|
+
let t = Cn(e);
|
|
5583
|
+
_.current = Sn(e), v.current = t.regionMeta, g(t.components);
|
|
5584
|
+
}, [e]);
|
|
5585
|
+
let [b, x] = l(null), [S, C] = l(!1), [w, T] = l("page"), E = h.find((e) => e.id === b), { canUndo: D, canRedo: j, push: M, undo: N, redo: P } = at(h), F = i((n) => {
|
|
5586
|
+
g(n), M(n), t(Tn(e, n, _.current === "empty" ? "children" : _.current, v.current));
|
|
5507
5587
|
}, [
|
|
5508
5588
|
e,
|
|
5509
5589
|
t,
|
|
5510
|
-
|
|
5511
|
-
]),
|
|
5512
|
-
let t =
|
|
5590
|
+
M
|
|
5591
|
+
]), I = i((e) => {
|
|
5592
|
+
let t = kn(), n = {
|
|
5513
5593
|
id: t,
|
|
5514
5594
|
type: e,
|
|
5515
|
-
label:
|
|
5595
|
+
label: En.find((t) => t.type === e)?.label || e
|
|
5516
5596
|
};
|
|
5517
|
-
|
|
5518
|
-
}, [
|
|
5519
|
-
|
|
5597
|
+
F([...h, n]), x(t);
|
|
5598
|
+
}, [h, F]), L = i((e) => {
|
|
5599
|
+
F(h.filter((t) => t.id !== e)), b === e && x(null);
|
|
5520
5600
|
}, [
|
|
5521
|
-
p,
|
|
5522
5601
|
h,
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5602
|
+
b,
|
|
5603
|
+
F
|
|
5604
|
+
]), R = i((e, t) => {
|
|
5605
|
+
let n = h.findIndex((t) => t.id === e);
|
|
5526
5606
|
if (n < 0) return;
|
|
5527
5607
|
let r = t === "up" ? n - 1 : n + 1;
|
|
5528
|
-
if (r < 0 || r >=
|
|
5529
|
-
let i = [...
|
|
5530
|
-
[i[n], i[r]] = [i[r], i[n]],
|
|
5531
|
-
}, [
|
|
5532
|
-
|
|
5608
|
+
if (r < 0 || r >= h.length) return;
|
|
5609
|
+
let i = [...h];
|
|
5610
|
+
[i[n], i[r]] = [i[r], i[n]], F(i);
|
|
5611
|
+
}, [h, F]), z = i((e) => {
|
|
5612
|
+
b && F(h.map((t) => t.id === b ? {
|
|
5533
5613
|
...t,
|
|
5534
5614
|
...e
|
|
5535
5615
|
} : t));
|
|
5536
5616
|
}, [
|
|
5537
|
-
p,
|
|
5538
5617
|
h,
|
|
5539
|
-
|
|
5618
|
+
b,
|
|
5619
|
+
F
|
|
5540
5620
|
]);
|
|
5541
5621
|
o(() => {
|
|
5542
|
-
let e =
|
|
5622
|
+
let e = f.current;
|
|
5543
5623
|
if (!e) return;
|
|
5544
5624
|
let t = (e) => {
|
|
5545
|
-
if (!
|
|
5625
|
+
if (!r) {
|
|
5546
5626
|
if ((e.ctrlKey || e.metaKey) && e.key === "z" && !e.shiftKey) {
|
|
5547
|
-
e.preventDefault(),
|
|
5627
|
+
e.preventDefault(), N();
|
|
5548
5628
|
return;
|
|
5549
5629
|
}
|
|
5550
5630
|
if ((e.ctrlKey || e.metaKey) && (e.key === "y" || e.key === "z" && e.shiftKey)) {
|
|
5551
|
-
e.preventDefault(),
|
|
5631
|
+
e.preventDefault(), P();
|
|
5552
5632
|
return;
|
|
5553
5633
|
}
|
|
5554
|
-
if ((e.key === "Delete" || e.key === "Backspace") &&
|
|
5634
|
+
if ((e.key === "Delete" || e.key === "Backspace") && b) {
|
|
5555
5635
|
let t = e.target;
|
|
5556
5636
|
if (t.tagName === "INPUT" || t.tagName === "SELECT" || t.tagName === "TEXTAREA") return;
|
|
5557
|
-
e.preventDefault(),
|
|
5637
|
+
e.preventDefault(), L(b);
|
|
5558
5638
|
}
|
|
5559
5639
|
}
|
|
5560
5640
|
};
|
|
5561
5641
|
return e.addEventListener("keydown", t), () => e.removeEventListener("keydown", t);
|
|
5562
5642
|
}, [
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
|
|
5566
|
-
|
|
5567
|
-
|
|
5643
|
+
r,
|
|
5644
|
+
N,
|
|
5645
|
+
P,
|
|
5646
|
+
b,
|
|
5647
|
+
L
|
|
5568
5648
|
]);
|
|
5569
|
-
let
|
|
5570
|
-
|
|
5571
|
-
}, [e,
|
|
5572
|
-
|
|
5573
|
-
}, []),
|
|
5649
|
+
let B = i(() => {
|
|
5650
|
+
s && s(e);
|
|
5651
|
+
}, [e, s]), V = i(() => {
|
|
5652
|
+
p.current?.click();
|
|
5653
|
+
}, []), H = i((e) => {
|
|
5574
5654
|
let n = e.target.files?.[0];
|
|
5575
5655
|
if (!n) return;
|
|
5576
5656
|
let r = new FileReader();
|
|
@@ -5578,34 +5658,29 @@ function kn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5578
5658
|
try {
|
|
5579
5659
|
let e = JSON.parse(r.result);
|
|
5580
5660
|
if (e && e.type === "page") {
|
|
5581
|
-
let n = (e
|
|
5582
|
-
|
|
5583
|
-
type: e.type || "grid",
|
|
5584
|
-
label: e.title || e.label || `Component ${t + 1}`,
|
|
5585
|
-
props: e
|
|
5586
|
-
}));
|
|
5587
|
-
m(n), w(n), t(e), s?.(e);
|
|
5661
|
+
let n = Cn(e);
|
|
5662
|
+
_.current = Sn(e), v.current = n.regionMeta, g(n.components), M(n.components), t(e), u?.(e);
|
|
5588
5663
|
}
|
|
5589
5664
|
} catch {}
|
|
5590
5665
|
}, r.readAsText(n), e.target.value = "";
|
|
5591
5666
|
}, [
|
|
5592
5667
|
t,
|
|
5593
|
-
|
|
5594
|
-
|
|
5668
|
+
M,
|
|
5669
|
+
u
|
|
5595
5670
|
]);
|
|
5596
5671
|
return /* @__PURE__ */ Y("div", {
|
|
5597
|
-
ref:
|
|
5672
|
+
ref: f,
|
|
5598
5673
|
tabIndex: 0,
|
|
5599
5674
|
"data-testid": "page-canvas-editor",
|
|
5600
|
-
className: xn("flex flex-col gap-4 outline-none sm:flex-row",
|
|
5675
|
+
className: xn("flex flex-col gap-4 outline-none sm:flex-row", a),
|
|
5601
5676
|
children: [
|
|
5602
5677
|
/* @__PURE__ */ J("input", {
|
|
5603
|
-
ref:
|
|
5678
|
+
ref: p,
|
|
5604
5679
|
type: "file",
|
|
5605
5680
|
accept: ".json",
|
|
5606
5681
|
className: "hidden",
|
|
5607
5682
|
"data-testid": "canvas-import-input",
|
|
5608
|
-
onChange:
|
|
5683
|
+
onChange: H
|
|
5609
5684
|
}),
|
|
5610
5685
|
/* @__PURE__ */ Y("div", {
|
|
5611
5686
|
className: "flex-1 space-y-4",
|
|
@@ -5613,14 +5688,14 @@ function kn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5613
5688
|
/* @__PURE__ */ J("div", {
|
|
5614
5689
|
className: "flex items-center gap-2 border-b border-gray-200 pb-2",
|
|
5615
5690
|
role: "tablist",
|
|
5616
|
-
children:
|
|
5691
|
+
children: Dn.map((e) => /* @__PURE__ */ J("button", {
|
|
5617
5692
|
type: "button",
|
|
5618
5693
|
role: "tab",
|
|
5619
5694
|
"data-testid": `canvas-mode-${e.value}`,
|
|
5620
|
-
"aria-selected":
|
|
5621
|
-
onClick: () =>
|
|
5622
|
-
className: xn("rounded-t-md px-3 py-1.5 text-xs font-medium transition-colors",
|
|
5623
|
-
children:
|
|
5695
|
+
"aria-selected": w === e.value,
|
|
5696
|
+
onClick: () => T(e.value),
|
|
5697
|
+
className: xn("rounded-t-md px-3 py-1.5 text-xs font-medium transition-colors", w === e.value ? "border-b-2 border-blue-500 text-blue-600" : "text-gray-500 hover:text-gray-700"),
|
|
5698
|
+
children: d(e.labelKey)
|
|
5624
5699
|
}, e.value))
|
|
5625
5700
|
}),
|
|
5626
5701
|
/* @__PURE__ */ Y("div", {
|
|
@@ -5629,99 +5704,99 @@ function kn({ schema: e, onChange: t, readOnly: n = !1, className: r, onExport:
|
|
|
5629
5704
|
className: "flex flex-wrap items-center gap-2",
|
|
5630
5705
|
children: [/* @__PURE__ */ Y("span", {
|
|
5631
5706
|
className: "text-sm font-medium text-gray-700",
|
|
5632
|
-
children: [
|
|
5633
|
-
}),
|
|
5707
|
+
children: [d("appDesigner.addComponent"), ":"]
|
|
5708
|
+
}), En.map(({ type: e, label: t, Icon: n }) => /* @__PURE__ */ Y("button", {
|
|
5634
5709
|
type: "button",
|
|
5635
5710
|
"data-testid": `canvas-add-${e}`,
|
|
5636
|
-
onClick: () =>
|
|
5637
|
-
disabled:
|
|
5711
|
+
onClick: () => I(e),
|
|
5712
|
+
disabled: r || S,
|
|
5638
5713
|
className: "inline-flex items-center gap-1.5 rounded-md border border-gray-200 px-2.5 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",
|
|
5639
|
-
children: [/* @__PURE__ */ J(
|
|
5714
|
+
children: [/* @__PURE__ */ J(n, { className: "h-3.5 w-3.5" }), t]
|
|
5640
5715
|
}, e))]
|
|
5641
5716
|
}), /* @__PURE__ */ Y("div", {
|
|
5642
5717
|
className: "flex items-center gap-1",
|
|
5643
5718
|
children: [
|
|
5644
|
-
!
|
|
5719
|
+
!r && /* @__PURE__ */ Y(q, { children: [/* @__PURE__ */ J("button", {
|
|
5645
5720
|
type: "button",
|
|
5646
5721
|
"data-testid": "canvas-undo",
|
|
5647
|
-
onClick:
|
|
5648
|
-
disabled: !
|
|
5722
|
+
onClick: N,
|
|
5723
|
+
disabled: !D,
|
|
5649
5724
|
className: "rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30",
|
|
5650
|
-
"aria-label":
|
|
5725
|
+
"aria-label": d("appDesigner.undo"),
|
|
5651
5726
|
children: /* @__PURE__ */ J(ze, { className: "h-4 w-4" })
|
|
5652
5727
|
}), /* @__PURE__ */ J("button", {
|
|
5653
5728
|
type: "button",
|
|
5654
5729
|
"data-testid": "canvas-redo",
|
|
5655
|
-
onClick:
|
|
5656
|
-
disabled: !
|
|
5730
|
+
onClick: P,
|
|
5731
|
+
disabled: !j,
|
|
5657
5732
|
className: "rounded p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-30",
|
|
5658
|
-
"aria-label":
|
|
5733
|
+
"aria-label": d("appDesigner.redo"),
|
|
5659
5734
|
children: /* @__PURE__ */ J(Ee, { className: "h-4 w-4" })
|
|
5660
5735
|
})] }),
|
|
5661
5736
|
/* @__PURE__ */ J("button", {
|
|
5662
5737
|
type: "button",
|
|
5663
5738
|
"data-testid": "canvas-export",
|
|
5664
|
-
onClick:
|
|
5739
|
+
onClick: B,
|
|
5665
5740
|
className: "rounded p-1.5 text-gray-400 hover:text-gray-700",
|
|
5666
|
-
"aria-label":
|
|
5741
|
+
"aria-label": d("appDesigner.navExportSchema"),
|
|
5667
5742
|
children: /* @__PURE__ */ J(O, { className: "h-4 w-4" })
|
|
5668
5743
|
}),
|
|
5669
|
-
!
|
|
5744
|
+
!r && /* @__PURE__ */ J("button", {
|
|
5670
5745
|
type: "button",
|
|
5671
5746
|
"data-testid": "canvas-import",
|
|
5672
|
-
onClick:
|
|
5747
|
+
onClick: V,
|
|
5673
5748
|
className: "rounded p-1.5 text-gray-400 hover:text-gray-700",
|
|
5674
|
-
"aria-label":
|
|
5749
|
+
"aria-label": d("appDesigner.navImportSchema"),
|
|
5675
5750
|
children: /* @__PURE__ */ J(Be, { className: "h-4 w-4" })
|
|
5676
5751
|
}),
|
|
5677
5752
|
/* @__PURE__ */ J("button", {
|
|
5678
5753
|
type: "button",
|
|
5679
5754
|
"data-testid": "canvas-preview-toggle",
|
|
5680
|
-
onClick: () =>
|
|
5681
|
-
className: xn("rounded p-1.5 transition-colors",
|
|
5682
|
-
"aria-label":
|
|
5683
|
-
children: J(
|
|
5755
|
+
onClick: () => C((e) => !e),
|
|
5756
|
+
className: xn("rounded p-1.5 transition-colors", S ? "bg-blue-100 text-blue-600" : "text-gray-400 hover:text-gray-700"),
|
|
5757
|
+
"aria-label": d(S ? "appDesigner.modeEdit" : "appDesigner.preview"),
|
|
5758
|
+
children: J(S ? A : k, { className: "h-4 w-4" })
|
|
5684
5759
|
})
|
|
5685
5760
|
]
|
|
5686
5761
|
})]
|
|
5687
5762
|
}),
|
|
5688
|
-
|
|
5763
|
+
S ? /* @__PURE__ */ J(Mn, {
|
|
5689
5764
|
schema: e,
|
|
5690
|
-
components:
|
|
5691
|
-
}) :
|
|
5765
|
+
components: h
|
|
5766
|
+
}) : h.length === 0 ? /* @__PURE__ */ J("div", {
|
|
5692
5767
|
className: "flex h-48 items-center justify-center rounded-lg border-2 border-dashed border-gray-200 text-sm text-gray-400",
|
|
5693
|
-
children:
|
|
5768
|
+
children: d("appDesigner.emptyPage")
|
|
5694
5769
|
}) : /* @__PURE__ */ J("div", {
|
|
5695
5770
|
className: "space-y-2",
|
|
5696
|
-
children:
|
|
5771
|
+
children: h.map((e, t) => /* @__PURE__ */ J(An, {
|
|
5697
5772
|
component: e,
|
|
5698
5773
|
index: t,
|
|
5699
|
-
total:
|
|
5700
|
-
selected: e.id ===
|
|
5701
|
-
readOnly:
|
|
5702
|
-
onSelect: () =>
|
|
5703
|
-
onRemove: () =>
|
|
5704
|
-
onMoveUp: () =>
|
|
5705
|
-
onMoveDown: () =>
|
|
5774
|
+
total: h.length,
|
|
5775
|
+
selected: e.id === b,
|
|
5776
|
+
readOnly: r,
|
|
5777
|
+
onSelect: () => x(e.id),
|
|
5778
|
+
onRemove: () => L(e.id),
|
|
5779
|
+
onMoveUp: () => R(e.id, "up"),
|
|
5780
|
+
onMoveDown: () => R(e.id, "down")
|
|
5706
5781
|
}, e.id))
|
|
5707
5782
|
})
|
|
5708
5783
|
]
|
|
5709
5784
|
}),
|
|
5710
|
-
|
|
5711
|
-
component:
|
|
5712
|
-
readOnly:
|
|
5713
|
-
onChange:
|
|
5714
|
-
onClose: () =>
|
|
5785
|
+
E && !S && /* @__PURE__ */ J(jn, {
|
|
5786
|
+
component: E,
|
|
5787
|
+
readOnly: r,
|
|
5788
|
+
onChange: z,
|
|
5789
|
+
onClose: () => x(null)
|
|
5715
5790
|
})
|
|
5716
5791
|
]
|
|
5717
5792
|
});
|
|
5718
5793
|
}
|
|
5719
5794
|
//#endregion
|
|
5720
5795
|
//#region src/ObjectViewConfigurator.tsx
|
|
5721
|
-
function
|
|
5796
|
+
function Pn(...e) {
|
|
5722
5797
|
return K(G(e));
|
|
5723
5798
|
}
|
|
5724
|
-
var
|
|
5799
|
+
var Fn = {
|
|
5725
5800
|
grid: {
|
|
5726
5801
|
label: "Grid",
|
|
5727
5802
|
Icon: ie
|
|
@@ -5750,7 +5825,7 @@ var jn = {
|
|
|
5750
5825
|
label: "Gantt",
|
|
5751
5826
|
Icon: F
|
|
5752
5827
|
}
|
|
5753
|
-
},
|
|
5828
|
+
}, In = [
|
|
5754
5829
|
{
|
|
5755
5830
|
value: "compact",
|
|
5756
5831
|
label: "Compact"
|
|
@@ -5764,7 +5839,7 @@ var jn = {
|
|
|
5764
5839
|
label: "Tall"
|
|
5765
5840
|
}
|
|
5766
5841
|
];
|
|
5767
|
-
function
|
|
5842
|
+
function Ln({ title: e, icon: t, defaultOpen: n = !0, children: r }) {
|
|
5768
5843
|
let [i, a] = l(n);
|
|
5769
5844
|
return /* @__PURE__ */ Y("div", {
|
|
5770
5845
|
className: "border-b border-gray-100 pb-3",
|
|
@@ -5786,7 +5861,7 @@ function Nn({ title: e, icon: t, defaultOpen: n = !0, children: r }) {
|
|
|
5786
5861
|
})]
|
|
5787
5862
|
});
|
|
5788
5863
|
}
|
|
5789
|
-
function
|
|
5864
|
+
function Rn({ config: e, onChange: t, availableViewTypes: n = [
|
|
5790
5865
|
"grid",
|
|
5791
5866
|
"kanban",
|
|
5792
5867
|
"calendar",
|
|
@@ -5813,27 +5888,27 @@ function Pn({ config: e, onChange: t, availableViewTypes: n = [
|
|
|
5813
5888
|
}, [e, o]), u = s(() => e.columns.filter((e) => e.visible).length, [e.columns]);
|
|
5814
5889
|
return /* @__PURE__ */ Y("div", {
|
|
5815
5890
|
"data-testid": "object-view-configurator",
|
|
5816
|
-
className:
|
|
5891
|
+
className: Pn("w-72 space-y-3 rounded-lg border border-gray-200 bg-white p-4", a),
|
|
5817
5892
|
children: [
|
|
5818
|
-
/* @__PURE__ */ J(
|
|
5893
|
+
/* @__PURE__ */ J(Ln, {
|
|
5819
5894
|
title: "View Type",
|
|
5820
5895
|
icon: /* @__PURE__ */ J(ie, { className: "h-3.5 w-3.5 text-gray-500" }),
|
|
5821
5896
|
children: /* @__PURE__ */ J("div", {
|
|
5822
5897
|
className: "flex flex-wrap gap-1.5",
|
|
5823
5898
|
children: n.map((t) => {
|
|
5824
|
-
let { label: n, Icon: i } =
|
|
5899
|
+
let { label: n, Icon: i } = Fn[t];
|
|
5825
5900
|
return /* @__PURE__ */ Y("button", {
|
|
5826
5901
|
type: "button",
|
|
5827
5902
|
"data-testid": `view-type-${t}`,
|
|
5828
5903
|
onClick: () => o({ viewType: t }),
|
|
5829
5904
|
disabled: r,
|
|
5830
|
-
className:
|
|
5905
|
+
className: Pn("inline-flex items-center gap-1 rounded-md px-2 py-1 text-xs font-medium transition-colors", e.viewType === t ? "bg-blue-100 text-blue-700" : "text-gray-600 hover:bg-gray-100", r && "cursor-not-allowed opacity-50"),
|
|
5831
5906
|
children: [/* @__PURE__ */ J(i, { className: "h-3 w-3" }), n]
|
|
5832
5907
|
}, t);
|
|
5833
5908
|
})
|
|
5834
5909
|
})
|
|
5835
5910
|
}),
|
|
5836
|
-
/* @__PURE__ */ J(
|
|
5911
|
+
/* @__PURE__ */ J(Ln, {
|
|
5837
5912
|
title: `Fields (${u}/${e.columns.length})`,
|
|
5838
5913
|
icon: /* @__PURE__ */ J(w, { className: "h-3.5 w-3.5 text-gray-500" }),
|
|
5839
5914
|
children: e.columns.length === 0 ? /* @__PURE__ */ J("p", {
|
|
@@ -5849,7 +5924,7 @@ function Pn({ config: e, onChange: t, availableViewTypes: n = [
|
|
|
5849
5924
|
type: "button",
|
|
5850
5925
|
onClick: () => c(t.name),
|
|
5851
5926
|
disabled: r,
|
|
5852
|
-
className:
|
|
5927
|
+
className: Pn("rounded p-0.5 transition-colors", t.visible ? "text-blue-500" : "text-gray-300"),
|
|
5853
5928
|
"aria-label": t.visible ? "Hide field" : "Show field",
|
|
5854
5929
|
children: t.visible ? /* @__PURE__ */ J(k, { className: "h-3 w-3" }) : /* @__PURE__ */ J(A, { className: "h-3 w-3" })
|
|
5855
5930
|
}),
|
|
@@ -5877,7 +5952,7 @@ function Pn({ config: e, onChange: t, availableViewTypes: n = [
|
|
|
5877
5952
|
}, t.name))
|
|
5878
5953
|
})
|
|
5879
5954
|
}),
|
|
5880
|
-
/* @__PURE__ */ J(
|
|
5955
|
+
/* @__PURE__ */ J(Ln, {
|
|
5881
5956
|
title: "Toolbar",
|
|
5882
5957
|
icon: /* @__PURE__ */ J(M, { className: "h-3.5 w-3.5 text-gray-500" }),
|
|
5883
5958
|
children: /* @__PURE__ */ Y("div", {
|
|
@@ -5928,7 +6003,7 @@ function Pn({ config: e, onChange: t, availableViewTypes: n = [
|
|
|
5928
6003
|
]
|
|
5929
6004
|
})
|
|
5930
6005
|
}),
|
|
5931
|
-
/* @__PURE__ */ J(
|
|
6006
|
+
/* @__PURE__ */ J(Ln, {
|
|
5932
6007
|
title: "Appearance",
|
|
5933
6008
|
icon: /* @__PURE__ */ J(ke, { className: "h-3.5 w-3.5 text-gray-500" }),
|
|
5934
6009
|
defaultOpen: !1,
|
|
@@ -5942,12 +6017,12 @@ function Pn({ config: e, onChange: t, availableViewTypes: n = [
|
|
|
5942
6017
|
children: "Row Height"
|
|
5943
6018
|
}), /* @__PURE__ */ J("div", {
|
|
5944
6019
|
className: "flex gap-1",
|
|
5945
|
-
children:
|
|
6020
|
+
children: In.map(({ value: t, label: n }) => /* @__PURE__ */ J("button", {
|
|
5946
6021
|
type: "button",
|
|
5947
6022
|
"data-testid": `view-row-height-${t}`,
|
|
5948
6023
|
onClick: () => o({ rowHeight: t }),
|
|
5949
6024
|
disabled: r,
|
|
5950
|
-
className:
|
|
6025
|
+
className: Pn("flex-1 rounded px-2 py-1 text-[10px] font-medium transition-colors", e.rowHeight === t ? "bg-blue-100 text-blue-700" : "bg-gray-50 text-gray-500 hover:bg-gray-100"),
|
|
5951
6026
|
children: n
|
|
5952
6027
|
}, t))
|
|
5953
6028
|
})]
|
|
@@ -5991,7 +6066,7 @@ function Pn({ config: e, onChange: t, availableViewTypes: n = [
|
|
|
5991
6066
|
function $(...e) {
|
|
5992
6067
|
return K(G(e));
|
|
5993
6068
|
}
|
|
5994
|
-
var
|
|
6069
|
+
var zn = [
|
|
5995
6070
|
{
|
|
5996
6071
|
hex: "#3b82f6",
|
|
5997
6072
|
name: "Blue"
|
|
@@ -6056,7 +6131,7 @@ var Fn = [
|
|
|
6056
6131
|
hex: "#0f172a",
|
|
6057
6132
|
name: "Navy"
|
|
6058
6133
|
}
|
|
6059
|
-
],
|
|
6134
|
+
], Bn = [
|
|
6060
6135
|
"Inter",
|
|
6061
6136
|
"Roboto",
|
|
6062
6137
|
"Open Sans",
|
|
@@ -6067,7 +6142,7 @@ var Fn = [
|
|
|
6067
6142
|
"Noto Sans",
|
|
6068
6143
|
"system-ui"
|
|
6069
6144
|
];
|
|
6070
|
-
function
|
|
6145
|
+
function Vn({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1, className: a, onExport: s, onImport: u }) {
|
|
6071
6146
|
let { t: d } = Vt(), [f, p] = l("light"), { current: m, push: h, canUndo: g, canRedo: _, undo: v, redo: y } = at(e), b = c(!0);
|
|
6072
6147
|
o(() => {
|
|
6073
6148
|
if (b.current) {
|
|
@@ -6241,7 +6316,7 @@ function Ln({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
6241
6316
|
}), /* @__PURE__ */ J("div", {
|
|
6242
6317
|
"data-testid": "branding-color-palette",
|
|
6243
6318
|
className: "flex flex-wrap gap-1.5",
|
|
6244
|
-
children:
|
|
6319
|
+
children: zn.map((e) => /* @__PURE__ */ J("button", {
|
|
6245
6320
|
"data-testid": `branding-swatch-${e.hex.slice(1)}`,
|
|
6246
6321
|
type: "button",
|
|
6247
6322
|
onClick: () => !r && x({ primaryColor: e.hex }),
|
|
@@ -6292,7 +6367,7 @@ function Ln({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
6292
6367
|
children: [/* @__PURE__ */ J("option", {
|
|
6293
6368
|
value: "",
|
|
6294
6369
|
children: d("appDesigner.fontDefault")
|
|
6295
|
-
}),
|
|
6370
|
+
}), Bn.map((e) => /* @__PURE__ */ J("option", {
|
|
6296
6371
|
value: e,
|
|
6297
6372
|
children: e
|
|
6298
6373
|
}, e))]
|
|
@@ -6437,15 +6512,15 @@ function Ln({ branding: e, onChange: t, appTitle: n = "My App", readOnly: r = !1
|
|
|
6437
6512
|
}
|
|
6438
6513
|
//#endregion
|
|
6439
6514
|
//#region src/ObjectManager.tsx
|
|
6440
|
-
function
|
|
6515
|
+
function Hn(...e) {
|
|
6441
6516
|
return K(G(e));
|
|
6442
6517
|
}
|
|
6443
|
-
var
|
|
6518
|
+
var Un = [
|
|
6444
6519
|
"Custom Objects",
|
|
6445
6520
|
"System Objects",
|
|
6446
6521
|
"Integration",
|
|
6447
6522
|
"Analytics"
|
|
6448
|
-
],
|
|
6523
|
+
], Wn = [
|
|
6449
6524
|
"Box",
|
|
6450
6525
|
"Database",
|
|
6451
6526
|
"Users",
|
|
@@ -6467,7 +6542,7 @@ var zn = [
|
|
|
6467
6542
|
"Truck",
|
|
6468
6543
|
"CreditCard"
|
|
6469
6544
|
];
|
|
6470
|
-
function
|
|
6545
|
+
function Gn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjects: a = !0, readOnly: o = !1, className: c }) {
|
|
6471
6546
|
let { t: u } = Vt(), d = ot(), [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(() => [
|
|
6472
6547
|
{
|
|
6473
6548
|
field: "name",
|
|
@@ -6605,7 +6680,7 @@ function Vn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
6605
6680
|
name: "icon",
|
|
6606
6681
|
label: u("appDesigner.objectManager.icon"),
|
|
6607
6682
|
type: "select",
|
|
6608
|
-
options:
|
|
6683
|
+
options: Wn.map((e) => ({
|
|
6609
6684
|
label: e,
|
|
6610
6685
|
value: e
|
|
6611
6686
|
})),
|
|
@@ -6615,7 +6690,7 @@ function Vn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
6615
6690
|
name: "group",
|
|
6616
6691
|
label: u("appDesigner.objectManager.group"),
|
|
6617
6692
|
type: "select",
|
|
6618
|
-
options:
|
|
6693
|
+
options: Un.map((e) => ({
|
|
6619
6694
|
label: e,
|
|
6620
6695
|
value: e
|
|
6621
6696
|
})),
|
|
@@ -6657,7 +6732,7 @@ function Vn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
6657
6732
|
]);
|
|
6658
6733
|
return /* @__PURE__ */ Y("div", {
|
|
6659
6734
|
"data-testid": "object-manager",
|
|
6660
|
-
className:
|
|
6735
|
+
className: Hn("w-full space-y-3", c),
|
|
6661
6736
|
children: [
|
|
6662
6737
|
/* @__PURE__ */ J("div", {
|
|
6663
6738
|
className: "flex items-center justify-between",
|
|
@@ -6700,10 +6775,10 @@ function Vn({ objects: e, onObjectsChange: n, onSelectObject: r, showSystemObjec
|
|
|
6700
6775
|
}
|
|
6701
6776
|
//#endregion
|
|
6702
6777
|
//#region src/FieldDesigner.tsx
|
|
6703
|
-
function
|
|
6778
|
+
function Kn(...e) {
|
|
6704
6779
|
return K(G(e));
|
|
6705
6780
|
}
|
|
6706
|
-
var
|
|
6781
|
+
var qn = {
|
|
6707
6782
|
text: {
|
|
6708
6783
|
label: "Text",
|
|
6709
6784
|
Icon: Re
|
|
@@ -6812,7 +6887,7 @@ var Un = {
|
|
|
6812
6887
|
label: "Slider",
|
|
6813
6888
|
Icon: Ae
|
|
6814
6889
|
}
|
|
6815
|
-
},
|
|
6890
|
+
}, Jn = {
|
|
6816
6891
|
text: [
|
|
6817
6892
|
"text",
|
|
6818
6893
|
"textarea",
|
|
@@ -6847,7 +6922,7 @@ var Un = {
|
|
|
6847
6922
|
"location",
|
|
6848
6923
|
"address"
|
|
6849
6924
|
]
|
|
6850
|
-
},
|
|
6925
|
+
}, Yn = [
|
|
6851
6926
|
"text",
|
|
6852
6927
|
"number",
|
|
6853
6928
|
"date",
|
|
@@ -6855,7 +6930,7 @@ var Un = {
|
|
|
6855
6930
|
"relation",
|
|
6856
6931
|
"advanced"
|
|
6857
6932
|
];
|
|
6858
|
-
function
|
|
6933
|
+
function Xn({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, className: o }) {
|
|
6859
6934
|
let { t: c } = Vt(), u = ot(), [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(() => [
|
|
6860
6935
|
{
|
|
6861
6936
|
field: "name",
|
|
@@ -6967,11 +7042,11 @@ function Kn({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
6967
7042
|
r
|
|
6968
7043
|
]), E = i((e) => {
|
|
6969
7044
|
e || (f(!1), m(null));
|
|
6970
|
-
}, []), D = s(() =>
|
|
7045
|
+
}, []), D = s(() => Yn.map((e) => ({
|
|
6971
7046
|
category: e,
|
|
6972
7047
|
label: c(`appDesigner.fieldDesigner.typeCategory.${e}`),
|
|
6973
|
-
options:
|
|
6974
|
-
label:
|
|
7048
|
+
options: Jn[e].map((e) => ({
|
|
7049
|
+
label: qn[e].label,
|
|
6975
7050
|
value: e
|
|
6976
7051
|
}))
|
|
6977
7052
|
})), [c]), O = s(() => D.flatMap((e) => e.options), [D]), k = s(() => ({
|
|
@@ -7157,7 +7232,7 @@ function Kn({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
7157
7232
|
]);
|
|
7158
7233
|
return /* @__PURE__ */ Y("div", {
|
|
7159
7234
|
"data-testid": "field-designer",
|
|
7160
|
-
className:
|
|
7235
|
+
className: Kn("w-full space-y-3", o),
|
|
7161
7236
|
children: [
|
|
7162
7237
|
/* @__PURE__ */ Y("div", {
|
|
7163
7238
|
className: "flex items-center justify-between",
|
|
@@ -7218,12 +7293,12 @@ function Kn({ objectName: e, fields: n, onFieldsChange: r, readOnly: a = !1, cla
|
|
|
7218
7293
|
}
|
|
7219
7294
|
//#endregion
|
|
7220
7295
|
//#region src/components/VersionHistory.tsx
|
|
7221
|
-
function
|
|
7296
|
+
function Zn(...e) {
|
|
7222
7297
|
return K(G(e));
|
|
7223
7298
|
}
|
|
7224
|
-
function
|
|
7299
|
+
function Qn({ versions: e, onRestore: t, className: n }) {
|
|
7225
7300
|
return /* @__PURE__ */ Y("div", {
|
|
7226
|
-
className:
|
|
7301
|
+
className: Zn("flex flex-col", n),
|
|
7227
7302
|
role: "region",
|
|
7228
7303
|
"aria-label": "Version history",
|
|
7229
7304
|
children: [/* @__PURE__ */ Y("div", {
|
|
@@ -7237,8 +7312,8 @@ function Jn({ versions: e, onRestore: t, className: n }) {
|
|
|
7237
7312
|
}) : /* @__PURE__ */ Y("div", {
|
|
7238
7313
|
className: "relative",
|
|
7239
7314
|
children: [/* @__PURE__ */ J("div", { className: "absolute left-5 top-0 bottom-0 w-px bg-border" }), e.map((e) => /* @__PURE__ */ Y("div", {
|
|
7240
|
-
className:
|
|
7241
|
-
children: [/* @__PURE__ */ J("div", { className:
|
|
7315
|
+
className: Zn("relative flex items-start gap-3 px-3 py-2 hover:bg-accent/50", e.isCurrent && "bg-accent/30"),
|
|
7316
|
+
children: [/* @__PURE__ */ J("div", { className: Zn("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", {
|
|
7242
7317
|
className: "flex-1 min-w-0",
|
|
7243
7318
|
children: [
|
|
7244
7319
|
/* @__PURE__ */ Y("div", {
|
|
@@ -7278,8 +7353,8 @@ function Jn({ versions: e, onRestore: t, className: n }) {
|
|
|
7278
7353
|
}
|
|
7279
7354
|
//#endregion
|
|
7280
7355
|
//#region src/pages/CreateAppPage.tsx
|
|
7281
|
-
var
|
|
7282
|
-
function
|
|
7356
|
+
var $n = "objectui-app-wizard-draft";
|
|
7357
|
+
function er() {
|
|
7283
7358
|
let e = tt(), { appName: t } = nt(), { objects: n, refresh: r } = Xe(), a = Ye(), o = (n || []).map((e) => ({
|
|
7284
7359
|
name: e.name,
|
|
7285
7360
|
label: e.label || e.name,
|
|
@@ -7287,13 +7362,13 @@ function Xn() {
|
|
|
7287
7362
|
selected: !1
|
|
7288
7363
|
})), s = i(() => {
|
|
7289
7364
|
try {
|
|
7290
|
-
let e = localStorage.getItem(
|
|
7365
|
+
let e = localStorage.getItem($n);
|
|
7291
7366
|
if (e) return JSON.parse(e);
|
|
7292
7367
|
} catch {}
|
|
7293
7368
|
}, []), c = i(async (t) => {
|
|
7294
7369
|
try {
|
|
7295
7370
|
let n = qe(t), i = a?.getClient();
|
|
7296
|
-
i && await i.meta.saveItem("app", t.name, n), localStorage.removeItem(
|
|
7371
|
+
i && await i.meta.saveItem("app", t.name, n), localStorage.removeItem($n), X.success(`Application "${t.title}" created successfully`), await r?.(), e(`/apps/${t.name}`);
|
|
7297
7372
|
} catch (e) {
|
|
7298
7373
|
X.error(e?.message || "Failed to create application");
|
|
7299
7374
|
}
|
|
@@ -7305,7 +7380,7 @@ function Xn() {
|
|
|
7305
7380
|
e(t ? `/apps/${t}` : "/");
|
|
7306
7381
|
}, [e, t]), u = i((e) => {
|
|
7307
7382
|
try {
|
|
7308
|
-
localStorage.setItem(
|
|
7383
|
+
localStorage.setItem($n, JSON.stringify(e)), X.info("Draft saved");
|
|
7309
7384
|
} catch {}
|
|
7310
7385
|
}, []);
|
|
7311
7386
|
return /* @__PURE__ */ J("div", {
|
|
@@ -7322,7 +7397,7 @@ function Xn() {
|
|
|
7322
7397
|
}
|
|
7323
7398
|
//#endregion
|
|
7324
7399
|
//#region src/pages/EditAppPage.tsx
|
|
7325
|
-
function
|
|
7400
|
+
function tr() {
|
|
7326
7401
|
let e = tt(), { appName: t, editAppName: n } = nt(), { apps: r, objects: a, refresh: o } = Xe(), c = Ye(), l = n || t, u = r.find((e) => e.name === l), d = (a || []).map((e) => ({
|
|
7327
7402
|
name: e.name,
|
|
7328
7403
|
label: e.label || e.name,
|
|
@@ -7389,7 +7464,7 @@ function Zn() {
|
|
|
7389
7464
|
}
|
|
7390
7465
|
//#endregion
|
|
7391
7466
|
//#region src/pages/PageDesignPage.tsx
|
|
7392
|
-
function
|
|
7467
|
+
function nr() {
|
|
7393
7468
|
let e = tt(), { pageName: t } = nt(), n = Ye(), { pages: r } = Xe(), a = r?.find((e) => e.name === t), [s, u] = l(() => a || {
|
|
7394
7469
|
type: "page",
|
|
7395
7470
|
name: t ?? "",
|
|
@@ -7437,7 +7512,7 @@ function Qn() {
|
|
|
7437
7512
|
})]
|
|
7438
7513
|
}), /* @__PURE__ */ J("div", {
|
|
7439
7514
|
className: "flex-1 overflow-auto p-4 sm:p-6",
|
|
7440
|
-
children: /* @__PURE__ */ J(
|
|
7515
|
+
children: /* @__PURE__ */ J(Nn, {
|
|
7441
7516
|
schema: s,
|
|
7442
7517
|
onChange: m,
|
|
7443
7518
|
onExport: h,
|
|
@@ -7455,7 +7530,7 @@ function Qn() {
|
|
|
7455
7530
|
}
|
|
7456
7531
|
//#endregion
|
|
7457
7532
|
//#region src/pages/DashboardDesignPage.tsx
|
|
7458
|
-
function
|
|
7533
|
+
function rr() {
|
|
7459
7534
|
let e = tt(), { dashboardName: t } = nt(), n = Ye(), { dashboards: r, refresh: a } = Xe(), s = r?.find((e) => e.name === t), [u, f] = l(() => s || {
|
|
7460
7535
|
type: "dashboard",
|
|
7461
7536
|
name: t ?? "",
|
|
@@ -7526,7 +7601,7 @@ function $n() {
|
|
|
7526
7601
|
}
|
|
7527
7602
|
//#endregion
|
|
7528
7603
|
//#region src/MetadataObjectsPage.tsx
|
|
7529
|
-
function
|
|
7604
|
+
function ir(e) {
|
|
7530
7605
|
let t = e.fields && typeof e.fields == "object" ? Object.keys(e.fields).length : 0;
|
|
7531
7606
|
return {
|
|
7532
7607
|
id: e.name,
|
|
@@ -7541,7 +7616,7 @@ function er(e) {
|
|
|
7541
7616
|
fieldCount: t
|
|
7542
7617
|
};
|
|
7543
7618
|
}
|
|
7544
|
-
function
|
|
7619
|
+
function ar({ client: e, clientConfig: t, hideSystemObjects: n = !1, readOnly: r = !1, onSelectObject: a, className: c }) {
|
|
7545
7620
|
let u = s(() => {
|
|
7546
7621
|
if (e) return e;
|
|
7547
7622
|
if (!t) throw Error("MetadataObjectsPage: provide either `client` or `clientConfig`.");
|
|
@@ -7575,7 +7650,7 @@ function tr({ client: e, clientConfig: t, hideSystemObjects: n = !1, readOnly: r
|
|
|
7575
7650
|
o(() => {
|
|
7576
7651
|
p();
|
|
7577
7652
|
}, [p]);
|
|
7578
|
-
let m = s(() => Object.values(d.byName).map(
|
|
7653
|
+
let m = s(() => Object.values(d.byName).map(ir), [d.byName]), h = i(async (e) => {
|
|
7579
7654
|
let t = d.byName, n = {};
|
|
7580
7655
|
for (let t of e) n[t.name] = t;
|
|
7581
7656
|
let r = [];
|
|
@@ -7625,7 +7700,7 @@ function tr({ client: e, clientConfig: t, hideSystemObjects: n = !1, readOnly: r
|
|
|
7625
7700
|
"data-testid": "metadata-objects-page-error",
|
|
7626
7701
|
className: "mb-2 whitespace-pre-wrap rounded bg-red-50 p-2 text-xs text-red-700",
|
|
7627
7702
|
children: d.error
|
|
7628
|
-
}), /* @__PURE__ */ J(
|
|
7703
|
+
}), /* @__PURE__ */ J(Gn, {
|
|
7629
7704
|
objects: m,
|
|
7630
7705
|
onObjectsChange: (e) => {
|
|
7631
7706
|
h(e);
|
|
@@ -7638,16 +7713,16 @@ function tr({ client: e, clientConfig: t, hideSystemObjects: n = !1, readOnly: r
|
|
|
7638
7713
|
}
|
|
7639
7714
|
//#endregion
|
|
7640
7715
|
//#region src/MetadataFieldsPage.tsx
|
|
7641
|
-
var
|
|
7642
|
-
function
|
|
7643
|
-
return e &&
|
|
7716
|
+
var or = new Set(/* @__PURE__ */ "text.textarea.number.boolean.date.datetime.time.select.email.phone.url.password.currency.percent.lookup.formula.autonumber.file.image.markdown.html.color.code.location.address.rating.slider".split("."));
|
|
7717
|
+
function sr(e) {
|
|
7718
|
+
return e && or.has(e) ? e : "text";
|
|
7644
7719
|
}
|
|
7645
|
-
function
|
|
7720
|
+
function cr(e, t) {
|
|
7646
7721
|
return {
|
|
7647
7722
|
id: e,
|
|
7648
7723
|
name: e,
|
|
7649
7724
|
label: t.label ?? e,
|
|
7650
|
-
type:
|
|
7725
|
+
type: sr(t.type),
|
|
7651
7726
|
group: t.group,
|
|
7652
7727
|
description: t.description,
|
|
7653
7728
|
required: t.required,
|
|
@@ -7664,7 +7739,7 @@ function ir(e, t) {
|
|
|
7664
7739
|
formula: t.formula
|
|
7665
7740
|
};
|
|
7666
7741
|
}
|
|
7667
|
-
function
|
|
7742
|
+
function lr(e, t) {
|
|
7668
7743
|
return {
|
|
7669
7744
|
...t ?? {},
|
|
7670
7745
|
type: e.type,
|
|
@@ -7684,7 +7759,7 @@ function ar(e, t) {
|
|
|
7684
7759
|
formula: e.formula
|
|
7685
7760
|
};
|
|
7686
7761
|
}
|
|
7687
|
-
function
|
|
7762
|
+
function ur({ objectName: e, client: t, clientConfig: n, readOnly: r = !1, className: a }) {
|
|
7688
7763
|
let c = s(() => {
|
|
7689
7764
|
if (t) return t;
|
|
7690
7765
|
if (!n) throw Error("MetadataFieldsPage: provide either `client` or `clientConfig`.");
|
|
@@ -7725,10 +7800,10 @@ function or({ objectName: e, client: t, clientConfig: n, readOnly: r = !1, class
|
|
|
7725
7800
|
o(() => {
|
|
7726
7801
|
f();
|
|
7727
7802
|
}, [f]);
|
|
7728
|
-
let p = s(() => u.raw?.fields ? Object.entries(u.raw.fields).map(([e, t]) =>
|
|
7803
|
+
let p = s(() => u.raw?.fields ? Object.entries(u.raw.fields).map(([e, t]) => cr(e, t)) : [], [u.raw]), m = i(async (t) => {
|
|
7729
7804
|
if (!u.raw) return;
|
|
7730
7805
|
let n = u.raw.fields ?? {}, r = {};
|
|
7731
|
-
for (let e of t) r[e.name] =
|
|
7806
|
+
for (let e of t) r[e.name] = lr(e, n[e.name]);
|
|
7732
7807
|
let i = {
|
|
7733
7808
|
...u.raw,
|
|
7734
7809
|
fields: r
|
|
@@ -7758,7 +7833,7 @@ function or({ objectName: e, client: t, clientConfig: n, readOnly: r = !1, class
|
|
|
7758
7833
|
"data-testid": "metadata-fields-page-error",
|
|
7759
7834
|
className: "mb-2 whitespace-pre-wrap rounded bg-red-50 p-2 text-xs text-red-700",
|
|
7760
7835
|
children: u.error
|
|
7761
|
-
}), /* @__PURE__ */ J(
|
|
7836
|
+
}), /* @__PURE__ */ J(Xn, {
|
|
7762
7837
|
objectName: e,
|
|
7763
7838
|
fields: p,
|
|
7764
7839
|
onFieldsChange: (e) => {
|
|
@@ -7967,7 +8042,7 @@ e.register("page-designer", Ct, {
|
|
|
7967
8042
|
label: "Read Only",
|
|
7968
8043
|
defaultValue: !1
|
|
7969
8044
|
}]
|
|
7970
|
-
}), e.register("page-canvas-editor",
|
|
8045
|
+
}), e.register("page-canvas-editor", Nn, {
|
|
7971
8046
|
namespace: "plugin-designer",
|
|
7972
8047
|
label: "Page Canvas Editor",
|
|
7973
8048
|
category: "Designer",
|
|
@@ -7981,7 +8056,7 @@ e.register("page-designer", Ct, {
|
|
|
7981
8056
|
label: "Read Only",
|
|
7982
8057
|
defaultValue: !1
|
|
7983
8058
|
}]
|
|
7984
|
-
}), e.register("object-view-configurator",
|
|
8059
|
+
}), e.register("object-view-configurator", Rn, {
|
|
7985
8060
|
namespace: "plugin-designer",
|
|
7986
8061
|
label: "Object View Configurator",
|
|
7987
8062
|
category: "Designer",
|
|
@@ -7995,7 +8070,7 @@ e.register("page-designer", Ct, {
|
|
|
7995
8070
|
label: "Read Only",
|
|
7996
8071
|
defaultValue: !1
|
|
7997
8072
|
}]
|
|
7998
|
-
}), e.register("branding-editor",
|
|
8073
|
+
}), e.register("branding-editor", Vn, {
|
|
7999
8074
|
namespace: "plugin-designer",
|
|
8000
8075
|
label: "Branding Editor",
|
|
8001
8076
|
category: "Designer",
|
|
@@ -8017,7 +8092,7 @@ e.register("page-designer", Ct, {
|
|
|
8017
8092
|
defaultValue: !1
|
|
8018
8093
|
}
|
|
8019
8094
|
]
|
|
8020
|
-
}), e.register("object-manager",
|
|
8095
|
+
}), e.register("object-manager", Gn, {
|
|
8021
8096
|
namespace: "plugin-designer",
|
|
8022
8097
|
label: "Object Manager",
|
|
8023
8098
|
category: "Designer",
|
|
@@ -8040,7 +8115,7 @@ e.register("page-designer", Ct, {
|
|
|
8040
8115
|
defaultValue: !1
|
|
8041
8116
|
}
|
|
8042
8117
|
]
|
|
8043
|
-
}), e.register("field-designer",
|
|
8118
|
+
}), e.register("field-designer", Xn, {
|
|
8044
8119
|
namespace: "plugin-designer",
|
|
8045
8120
|
label: "Field Designer",
|
|
8046
8121
|
category: "Designer",
|
|
@@ -8064,4 +8139,4 @@ e.register("page-designer", Ct, {
|
|
|
8064
8139
|
]
|
|
8065
8140
|
});
|
|
8066
8141
|
//#endregion
|
|
8067
|
-
export { $t as AppCreationWizard,
|
|
8142
|
+
export { $t as AppCreationWizard, Vn as BrandingEditor, yt as CollaborationProvider, dt as ConfirmDialog, xt as ConnectionStatusIndicator, er as CreateAppPage, rr as DashboardDesignPage, bn as DashboardEditor, kt as DataModelDesigner, tr as EditAppPage, fn as EditorModeToggle, Xn as FieldDesigner, ur as MetadataFieldsPage, ar as MetadataObjectsPage, gt as Minimap, ln as NavigationDesigner, Gn as ObjectManager, Rn as ObjectViewConfigurator, Nn as PageCanvasEditor, nr as PageDesignPage, Ct as PageDesigner, Pt as ProcessDesigner, pt as PropertyEditor, Rt as ReportDesigner, Qn as VersionHistory, lt as useCanvasPanZoom, ct as useClipboard, ot as useConfirmDialog, Tt as useDesignerHistory, st as useMultiSelect, at as useUndoRedo };
|