@firecms/core 3.0.0-canary.287 → 3.0.0-canary.288
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/PropertyCollectionView.d.ts +23 -0
- package/dist/form/EntityForm.d.ts +1 -0
- package/dist/index.es.js +592 -132
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +599 -139
- package/dist/index.umd.js.map +1 -1
- package/dist/util/entity_cache.d.ts +1 -0
- package/dist/util/objects.d.ts +1 -0
- package/package.json +5 -5
- package/src/components/EntityView.tsx +29 -40
- package/src/components/PropertyCollectionView.tsx +329 -0
- package/src/form/EntityForm.tsx +63 -11
- package/src/form/components/LocalChangesMenu.tsx +38 -55
- package/src/preview/property_previews/NumberPropertyPreview.tsx +2 -2
- package/src/util/entity_cache.ts +35 -0
- package/src/util/objects.ts +40 -2
package/dist/index.umd.js
CHANGED
|
@@ -253,6 +253,13 @@
|
|
|
253
253
|
function isObject(item) {
|
|
254
254
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
255
255
|
}
|
|
256
|
+
function isPlainObject(obj) {
|
|
257
|
+
if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
|
|
258
|
+
return false;
|
|
259
|
+
}
|
|
260
|
+
const proto = Object.getPrototypeOf(obj);
|
|
261
|
+
return proto === Object.prototype;
|
|
262
|
+
}
|
|
256
263
|
function mergeDeep(target, source, ignoreUndefined = false) {
|
|
257
264
|
if (!isObject(target)) {
|
|
258
265
|
return target;
|
|
@@ -273,7 +280,28 @@
|
|
|
273
280
|
if (sourceValue instanceof Date) {
|
|
274
281
|
output[key] = new Date(sourceValue.getTime());
|
|
275
282
|
} else if (Array.isArray(sourceValue)) {
|
|
276
|
-
|
|
283
|
+
if (Array.isArray(outputValue)) {
|
|
284
|
+
const newArray = [];
|
|
285
|
+
const maxLength = Math.max(outputValue.length, sourceValue.length);
|
|
286
|
+
for (let i = 0; i < maxLength; i++) {
|
|
287
|
+
const sourceItem = sourceValue[i];
|
|
288
|
+
const targetItem = outputValue[i];
|
|
289
|
+
if (i >= sourceValue.length) {
|
|
290
|
+
newArray[i] = targetItem;
|
|
291
|
+
} else if (i >= outputValue.length) {
|
|
292
|
+
newArray[i] = sourceItem;
|
|
293
|
+
} else if (sourceItem === null) {
|
|
294
|
+
newArray[i] = targetItem;
|
|
295
|
+
} else if (isObject(sourceItem) && isObject(targetItem)) {
|
|
296
|
+
newArray[i] = mergeDeep(targetItem, sourceItem, ignoreUndefined);
|
|
297
|
+
} else {
|
|
298
|
+
newArray[i] = sourceItem;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
output[key] = newArray;
|
|
302
|
+
} else {
|
|
303
|
+
output[key] = [...sourceValue];
|
|
304
|
+
}
|
|
277
305
|
} else if (isObject(sourceValue)) {
|
|
278
306
|
if (isObject(outputValue)) {
|
|
279
307
|
output[key] = mergeDeep(outputValue, sourceValue, ignoreUndefined);
|
|
@@ -6775,7 +6803,7 @@
|
|
|
6775
6803
|
return t3;
|
|
6776
6804
|
}
|
|
6777
6805
|
function NumberPropertyPreview(t0) {
|
|
6778
|
-
const $ = reactCompilerRuntime.c(
|
|
6806
|
+
const $ = reactCompilerRuntime.c(12);
|
|
6779
6807
|
const {
|
|
6780
6808
|
value,
|
|
6781
6809
|
property,
|
|
@@ -6793,38 +6821,42 @@
|
|
|
6793
6821
|
}
|
|
6794
6822
|
const enumValues = t1;
|
|
6795
6823
|
if (!enumValues) {
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
$[
|
|
6824
|
+
const t22 = size === "small" ? "text-sm" : "";
|
|
6825
|
+
let t32;
|
|
6826
|
+
if ($[2] !== t22 || $[3] !== value) {
|
|
6827
|
+
t32 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t22, children: value });
|
|
6828
|
+
$[2] = t22;
|
|
6829
|
+
$[3] = value;
|
|
6830
|
+
$[4] = t32;
|
|
6801
6831
|
} else {
|
|
6802
|
-
|
|
6832
|
+
t32 = $[4];
|
|
6803
6833
|
}
|
|
6804
|
-
return
|
|
6834
|
+
return t32;
|
|
6805
6835
|
}
|
|
6806
6836
|
const t2 = size !== "medium" ? "small" : "medium";
|
|
6807
6837
|
let t3;
|
|
6808
|
-
if ($[
|
|
6838
|
+
if ($[5] !== enumKey || $[6] !== enumValues || $[7] !== t2) {
|
|
6809
6839
|
t3 = /* @__PURE__ */ jsxRuntime.jsx(EnumValuesChip, { enumKey, enumValues, size: t2 });
|
|
6810
|
-
$[
|
|
6811
|
-
$[
|
|
6812
|
-
$[
|
|
6813
|
-
$[
|
|
6840
|
+
$[5] = enumKey;
|
|
6841
|
+
$[6] = enumValues;
|
|
6842
|
+
$[7] = t2;
|
|
6843
|
+
$[8] = t3;
|
|
6814
6844
|
} else {
|
|
6815
|
-
t3 = $[
|
|
6845
|
+
t3 = $[8];
|
|
6816
6846
|
}
|
|
6817
6847
|
return t3;
|
|
6818
6848
|
} else {
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6849
|
+
const t1 = size === "small" ? "text-sm" : "";
|
|
6850
|
+
let t2;
|
|
6851
|
+
if ($[9] !== t1 || $[10] !== value) {
|
|
6852
|
+
t2 = /* @__PURE__ */ jsxRuntime.jsx("span", { className: t1, children: value });
|
|
6823
6853
|
$[9] = t1;
|
|
6854
|
+
$[10] = value;
|
|
6855
|
+
$[11] = t2;
|
|
6824
6856
|
} else {
|
|
6825
|
-
|
|
6857
|
+
t2 = $[11];
|
|
6826
6858
|
}
|
|
6827
|
-
return
|
|
6859
|
+
return t2;
|
|
6828
6860
|
}
|
|
6829
6861
|
}
|
|
6830
6862
|
function UserDisplay(t0) {
|
|
@@ -7373,6 +7405,389 @@
|
|
|
7373
7405
|
}
|
|
7374
7406
|
return t3;
|
|
7375
7407
|
});
|
|
7408
|
+
function buildPropertyLabelAndGetProperty(properties, key) {
|
|
7409
|
+
if (!key) return {
|
|
7410
|
+
label: "",
|
|
7411
|
+
property: void 0
|
|
7412
|
+
};
|
|
7413
|
+
const segments = [];
|
|
7414
|
+
const re = /([^[.\]]+)|\[(\d+)\]/g;
|
|
7415
|
+
let m;
|
|
7416
|
+
while ((m = re.exec(key)) !== null) {
|
|
7417
|
+
if (m[1] !== void 0) segments.push(m[1]);
|
|
7418
|
+
else if (m[2] !== void 0) segments.push(Number(m[2]));
|
|
7419
|
+
}
|
|
7420
|
+
let currentProps = properties;
|
|
7421
|
+
let currentProp;
|
|
7422
|
+
let lastLabel = "";
|
|
7423
|
+
const getArrayOfProp = (p) => {
|
|
7424
|
+
if (!p || p.dataType !== "array") return void 0;
|
|
7425
|
+
return Array.isArray(p.of) ? p.of[0] : p.of;
|
|
7426
|
+
};
|
|
7427
|
+
for (const seg of segments) {
|
|
7428
|
+
if (typeof seg === "number") {
|
|
7429
|
+
lastLabel = `[${seg}]`;
|
|
7430
|
+
if (currentProp?.dataType === "array") {
|
|
7431
|
+
currentProp = getArrayOfProp(currentProp);
|
|
7432
|
+
if (currentProp?.dataType === "map" && currentProp.properties) {
|
|
7433
|
+
currentProps = currentProp.properties;
|
|
7434
|
+
} else {
|
|
7435
|
+
currentProps = void 0;
|
|
7436
|
+
}
|
|
7437
|
+
} else {
|
|
7438
|
+
currentProp = void 0;
|
|
7439
|
+
currentProps = void 0;
|
|
7440
|
+
}
|
|
7441
|
+
continue;
|
|
7442
|
+
}
|
|
7443
|
+
if (currentProps && currentProps[seg]) {
|
|
7444
|
+
const nextProp = currentProps[seg];
|
|
7445
|
+
currentProp = nextProp;
|
|
7446
|
+
lastLabel = nextProp.name || String(seg);
|
|
7447
|
+
if (nextProp.dataType === "map" && nextProp.properties) {
|
|
7448
|
+
currentProps = nextProp.properties;
|
|
7449
|
+
} else if (nextProp.dataType === "array") {
|
|
7450
|
+
currentProps = void 0;
|
|
7451
|
+
} else {
|
|
7452
|
+
currentProps = void 0;
|
|
7453
|
+
}
|
|
7454
|
+
} else {
|
|
7455
|
+
currentProp = void 0;
|
|
7456
|
+
currentProps = void 0;
|
|
7457
|
+
lastLabel = String(seg);
|
|
7458
|
+
}
|
|
7459
|
+
}
|
|
7460
|
+
return {
|
|
7461
|
+
label: lastLabel,
|
|
7462
|
+
property: currentProp
|
|
7463
|
+
};
|
|
7464
|
+
}
|
|
7465
|
+
const pathEndsWithIndex = (p) => /\[\d+\]$/.test(p);
|
|
7466
|
+
const PropertyCollectionView = (t0) => {
|
|
7467
|
+
const $ = reactCompilerRuntime.c(89);
|
|
7468
|
+
const {
|
|
7469
|
+
data,
|
|
7470
|
+
properties,
|
|
7471
|
+
baseKey: t1,
|
|
7472
|
+
suppressHeader: t2,
|
|
7473
|
+
size: t3
|
|
7474
|
+
} = t0;
|
|
7475
|
+
const baseKey = t1 === void 0 ? "" : t1;
|
|
7476
|
+
const suppressHeader = t2 === void 0 ? false : t2;
|
|
7477
|
+
const size = t3 === void 0 ? "small" : t3;
|
|
7478
|
+
const isTopLevel = !!baseKey && !baseKey.includes(".") && !baseKey.includes("[");
|
|
7479
|
+
if (Array.isArray(data)) {
|
|
7480
|
+
let t4;
|
|
7481
|
+
if ($[0] !== baseKey || $[1] !== properties) {
|
|
7482
|
+
t4 = baseKey ? buildPropertyLabelAndGetProperty(properties, baseKey) : {
|
|
7483
|
+
label: "",
|
|
7484
|
+
property: void 0
|
|
7485
|
+
};
|
|
7486
|
+
$[0] = baseKey;
|
|
7487
|
+
$[1] = properties;
|
|
7488
|
+
$[2] = t4;
|
|
7489
|
+
} else {
|
|
7490
|
+
t4 = $[2];
|
|
7491
|
+
}
|
|
7492
|
+
const {
|
|
7493
|
+
label: arrayLabel,
|
|
7494
|
+
property
|
|
7495
|
+
} = t4;
|
|
7496
|
+
const ofProp = property?.dataType === "array" ? Array.isArray(property.of) ? property.of[0] : property.of : void 0;
|
|
7497
|
+
const isArrayOfMaps = ofProp?.dataType === "map";
|
|
7498
|
+
const isArrayOfPrimitives = property?.dataType === "array" && ofProp && ofProp.dataType !== "map";
|
|
7499
|
+
if (baseKey && property && isArrayOfPrimitives) {
|
|
7500
|
+
const t52 = `grid grid-cols-12 gap-x-4 ${isTopLevel ? "py-4" : "py-2"} items-start ${isTopLevel ? `border-b ${ui.defaultBorderMixin}` : ""}`;
|
|
7501
|
+
let t62;
|
|
7502
|
+
if ($[3] !== arrayLabel) {
|
|
7503
|
+
t62 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-4 pr-2", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", component: "span", className: "break-words", children: arrayLabel }) });
|
|
7504
|
+
$[3] = arrayLabel;
|
|
7505
|
+
$[4] = t62;
|
|
7506
|
+
} else {
|
|
7507
|
+
t62 = $[4];
|
|
7508
|
+
}
|
|
7509
|
+
let t72;
|
|
7510
|
+
if ($[5] !== baseKey || $[6] !== data || $[7] !== property || $[8] !== size) {
|
|
7511
|
+
t72 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-8", children: /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { propertyKey: baseKey, value: data, property, size }) });
|
|
7512
|
+
$[5] = baseKey;
|
|
7513
|
+
$[6] = data;
|
|
7514
|
+
$[7] = property;
|
|
7515
|
+
$[8] = size;
|
|
7516
|
+
$[9] = t72;
|
|
7517
|
+
} else {
|
|
7518
|
+
t72 = $[9];
|
|
7519
|
+
}
|
|
7520
|
+
let t82;
|
|
7521
|
+
if ($[10] !== t52 || $[11] !== t62 || $[12] !== t72) {
|
|
7522
|
+
t82 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t52, children: [
|
|
7523
|
+
t62,
|
|
7524
|
+
t72
|
|
7525
|
+
] });
|
|
7526
|
+
$[10] = t52;
|
|
7527
|
+
$[11] = t62;
|
|
7528
|
+
$[12] = t72;
|
|
7529
|
+
$[13] = t82;
|
|
7530
|
+
} else {
|
|
7531
|
+
t82 = $[13];
|
|
7532
|
+
}
|
|
7533
|
+
return t82;
|
|
7534
|
+
}
|
|
7535
|
+
const t5 = `${isTopLevel ? "py-4" : "py-1"} ${isTopLevel ? `border-b ${ui.defaultBorderMixin}` : ""}`;
|
|
7536
|
+
let t6;
|
|
7537
|
+
if ($[14] !== arrayLabel || $[15] !== baseKey || $[16] !== suppressHeader) {
|
|
7538
|
+
t6 = baseKey && arrayLabel && !suppressHeader && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", component: "span", children: arrayLabel });
|
|
7539
|
+
$[14] = arrayLabel;
|
|
7540
|
+
$[15] = baseKey;
|
|
7541
|
+
$[16] = suppressHeader;
|
|
7542
|
+
$[17] = t6;
|
|
7543
|
+
} else {
|
|
7544
|
+
t6 = $[17];
|
|
7545
|
+
}
|
|
7546
|
+
const t7 = baseKey ? `pl-4 mt-1 border-l ${ui.defaultBorderMixin}` : "";
|
|
7547
|
+
let t8;
|
|
7548
|
+
if ($[18] !== baseKey || $[19] !== data || $[20] !== isArrayOfMaps || $[21] !== ofProp || $[22] !== properties || $[23] !== size) {
|
|
7549
|
+
let t92;
|
|
7550
|
+
if ($[25] !== baseKey || $[26] !== isArrayOfMaps || $[27] !== ofProp || $[28] !== properties || $[29] !== size) {
|
|
7551
|
+
t92 = (item, index) => {
|
|
7552
|
+
if (item === null || item === void 0) {
|
|
7553
|
+
return null;
|
|
7554
|
+
}
|
|
7555
|
+
const currentKey = baseKey ? `${baseKey}[${index}]` : `[${index}]`;
|
|
7556
|
+
const itemHeader = isArrayOfMaps && ofProp?.name ? `${ofProp.name} [${index}]` : `[${index}]`;
|
|
7557
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "py-1", children: [
|
|
7558
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", component: "span", children: itemHeader }),
|
|
7559
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `pl-4 mt-1 border-l ${ui.defaultBorderMixin}`, children: /* @__PURE__ */ jsxRuntime.jsx(PropertyCollectionView, { data: item, properties, baseKey: currentKey, suppressHeader: true, size }) })
|
|
7560
|
+
] }, currentKey);
|
|
7561
|
+
};
|
|
7562
|
+
$[25] = baseKey;
|
|
7563
|
+
$[26] = isArrayOfMaps;
|
|
7564
|
+
$[27] = ofProp;
|
|
7565
|
+
$[28] = properties;
|
|
7566
|
+
$[29] = size;
|
|
7567
|
+
$[30] = t92;
|
|
7568
|
+
} else {
|
|
7569
|
+
t92 = $[30];
|
|
7570
|
+
}
|
|
7571
|
+
t8 = data.map(t92);
|
|
7572
|
+
$[18] = baseKey;
|
|
7573
|
+
$[19] = data;
|
|
7574
|
+
$[20] = isArrayOfMaps;
|
|
7575
|
+
$[21] = ofProp;
|
|
7576
|
+
$[22] = properties;
|
|
7577
|
+
$[23] = size;
|
|
7578
|
+
$[24] = t8;
|
|
7579
|
+
} else {
|
|
7580
|
+
t8 = $[24];
|
|
7581
|
+
}
|
|
7582
|
+
let t9;
|
|
7583
|
+
if ($[31] !== t7 || $[32] !== t8) {
|
|
7584
|
+
t9 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: t7, children: t8 });
|
|
7585
|
+
$[31] = t7;
|
|
7586
|
+
$[32] = t8;
|
|
7587
|
+
$[33] = t9;
|
|
7588
|
+
} else {
|
|
7589
|
+
t9 = $[33];
|
|
7590
|
+
}
|
|
7591
|
+
let t10;
|
|
7592
|
+
if ($[34] !== t5 || $[35] !== t6 || $[36] !== t9) {
|
|
7593
|
+
t10 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t5, children: [
|
|
7594
|
+
t6,
|
|
7595
|
+
t9
|
|
7596
|
+
] });
|
|
7597
|
+
$[34] = t5;
|
|
7598
|
+
$[35] = t6;
|
|
7599
|
+
$[36] = t9;
|
|
7600
|
+
$[37] = t10;
|
|
7601
|
+
} else {
|
|
7602
|
+
t10 = $[37];
|
|
7603
|
+
}
|
|
7604
|
+
return t10;
|
|
7605
|
+
}
|
|
7606
|
+
if (typeof data === "object" && data !== null) {
|
|
7607
|
+
let t4;
|
|
7608
|
+
if ($[38] !== baseKey || $[39] !== properties) {
|
|
7609
|
+
t4 = baseKey ? buildPropertyLabelAndGetProperty(properties, baseKey) : {
|
|
7610
|
+
label: "",
|
|
7611
|
+
property: void 0
|
|
7612
|
+
};
|
|
7613
|
+
$[38] = baseKey;
|
|
7614
|
+
$[39] = properties;
|
|
7615
|
+
$[40] = t4;
|
|
7616
|
+
} else {
|
|
7617
|
+
t4 = $[40];
|
|
7618
|
+
}
|
|
7619
|
+
const {
|
|
7620
|
+
label,
|
|
7621
|
+
property: property_0
|
|
7622
|
+
} = t4;
|
|
7623
|
+
if (baseKey && (!property_0 || property_0.dataType !== "map" || !property_0.properties)) {
|
|
7624
|
+
if (!property_0) {
|
|
7625
|
+
return null;
|
|
7626
|
+
}
|
|
7627
|
+
const t52 = `grid grid-cols-12 gap-x-4 ${isTopLevel ? "py-4" : "py-2"} items-start ${isTopLevel ? `border-b ${ui.defaultBorderMixin}` : ""}`;
|
|
7628
|
+
let t62;
|
|
7629
|
+
if ($[41] !== label) {
|
|
7630
|
+
t62 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-4 pr-2", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", component: "span", className: "break-words", children: label }) });
|
|
7631
|
+
$[41] = label;
|
|
7632
|
+
$[42] = t62;
|
|
7633
|
+
} else {
|
|
7634
|
+
t62 = $[42];
|
|
7635
|
+
}
|
|
7636
|
+
let t72;
|
|
7637
|
+
if ($[43] !== baseKey || $[44] !== data || $[45] !== property_0 || $[46] !== size) {
|
|
7638
|
+
t72 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-8", children: /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { propertyKey: baseKey, value: data, property: property_0, size }) });
|
|
7639
|
+
$[43] = baseKey;
|
|
7640
|
+
$[44] = data;
|
|
7641
|
+
$[45] = property_0;
|
|
7642
|
+
$[46] = size;
|
|
7643
|
+
$[47] = t72;
|
|
7644
|
+
} else {
|
|
7645
|
+
t72 = $[47];
|
|
7646
|
+
}
|
|
7647
|
+
let t82;
|
|
7648
|
+
if ($[48] !== t52 || $[49] !== t62 || $[50] !== t72) {
|
|
7649
|
+
t82 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t52, children: [
|
|
7650
|
+
t62,
|
|
7651
|
+
t72
|
|
7652
|
+
] });
|
|
7653
|
+
$[48] = t52;
|
|
7654
|
+
$[49] = t62;
|
|
7655
|
+
$[50] = t72;
|
|
7656
|
+
$[51] = t82;
|
|
7657
|
+
} else {
|
|
7658
|
+
t82 = $[51];
|
|
7659
|
+
}
|
|
7660
|
+
return t82;
|
|
7661
|
+
}
|
|
7662
|
+
let t5;
|
|
7663
|
+
if ($[52] !== baseKey || $[53] !== property_0 || $[54] !== suppressHeader) {
|
|
7664
|
+
t5 = baseKey && !suppressHeader && property_0?.dataType === "map" && (property_0.name || !pathEndsWithIndex(baseKey));
|
|
7665
|
+
$[52] = baseKey;
|
|
7666
|
+
$[53] = property_0;
|
|
7667
|
+
$[54] = suppressHeader;
|
|
7668
|
+
$[55] = t5;
|
|
7669
|
+
} else {
|
|
7670
|
+
t5 = $[55];
|
|
7671
|
+
}
|
|
7672
|
+
const showMapHeader = t5;
|
|
7673
|
+
const headerText = property_0?.name || label;
|
|
7674
|
+
const t6 = `${isTopLevel ? "py-4" : "py-1"} ${isTopLevel ? `border-b ${ui.defaultBorderMixin}` : ""}`;
|
|
7675
|
+
let t7;
|
|
7676
|
+
if ($[56] !== headerText || $[57] !== showMapHeader) {
|
|
7677
|
+
t7 = showMapHeader && /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", component: "span", children: headerText });
|
|
7678
|
+
$[56] = headerText;
|
|
7679
|
+
$[57] = showMapHeader;
|
|
7680
|
+
$[58] = t7;
|
|
7681
|
+
} else {
|
|
7682
|
+
t7 = $[58];
|
|
7683
|
+
}
|
|
7684
|
+
const t8 = baseKey ? `pl-4 mt-1 border-l ${ui.defaultBorderMixin}` : "";
|
|
7685
|
+
let t9;
|
|
7686
|
+
if ($[59] !== baseKey || $[60] !== data || $[61] !== properties || $[62] !== size) {
|
|
7687
|
+
let t102;
|
|
7688
|
+
if ($[64] !== baseKey || $[65] !== properties || $[66] !== size) {
|
|
7689
|
+
t102 = (t112) => {
|
|
7690
|
+
const [key, value] = t112;
|
|
7691
|
+
if (value === null || value === void 0) {
|
|
7692
|
+
return null;
|
|
7693
|
+
}
|
|
7694
|
+
const currentKey_0 = baseKey ? `${baseKey}.${key}` : key;
|
|
7695
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PropertyCollectionView, { data: value, properties, baseKey: currentKey_0, size }, currentKey_0);
|
|
7696
|
+
};
|
|
7697
|
+
$[64] = baseKey;
|
|
7698
|
+
$[65] = properties;
|
|
7699
|
+
$[66] = size;
|
|
7700
|
+
$[67] = t102;
|
|
7701
|
+
} else {
|
|
7702
|
+
t102 = $[67];
|
|
7703
|
+
}
|
|
7704
|
+
t9 = Object.entries(data).map(t102);
|
|
7705
|
+
$[59] = baseKey;
|
|
7706
|
+
$[60] = data;
|
|
7707
|
+
$[61] = properties;
|
|
7708
|
+
$[62] = size;
|
|
7709
|
+
$[63] = t9;
|
|
7710
|
+
} else {
|
|
7711
|
+
t9 = $[63];
|
|
7712
|
+
}
|
|
7713
|
+
let t10;
|
|
7714
|
+
if ($[68] !== t8 || $[69] !== t9) {
|
|
7715
|
+
t10 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: t8, children: t9 });
|
|
7716
|
+
$[68] = t8;
|
|
7717
|
+
$[69] = t9;
|
|
7718
|
+
$[70] = t10;
|
|
7719
|
+
} else {
|
|
7720
|
+
t10 = $[70];
|
|
7721
|
+
}
|
|
7722
|
+
let t11;
|
|
7723
|
+
if ($[71] !== t10 || $[72] !== t6 || $[73] !== t7) {
|
|
7724
|
+
t11 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t6, children: [
|
|
7725
|
+
t7,
|
|
7726
|
+
t10
|
|
7727
|
+
] });
|
|
7728
|
+
$[71] = t10;
|
|
7729
|
+
$[72] = t6;
|
|
7730
|
+
$[73] = t7;
|
|
7731
|
+
$[74] = t11;
|
|
7732
|
+
} else {
|
|
7733
|
+
t11 = $[74];
|
|
7734
|
+
}
|
|
7735
|
+
return t11;
|
|
7736
|
+
}
|
|
7737
|
+
if (baseKey) {
|
|
7738
|
+
let t4;
|
|
7739
|
+
if ($[75] !== baseKey || $[76] !== properties) {
|
|
7740
|
+
t4 = buildPropertyLabelAndGetProperty(properties, baseKey);
|
|
7741
|
+
$[75] = baseKey;
|
|
7742
|
+
$[76] = properties;
|
|
7743
|
+
$[77] = t4;
|
|
7744
|
+
} else {
|
|
7745
|
+
t4 = $[77];
|
|
7746
|
+
}
|
|
7747
|
+
const {
|
|
7748
|
+
label: label_0,
|
|
7749
|
+
property: property_1
|
|
7750
|
+
} = t4;
|
|
7751
|
+
if (!property_1) {
|
|
7752
|
+
return null;
|
|
7753
|
+
}
|
|
7754
|
+
const t5 = `grid grid-cols-12 gap-x-4 ${isTopLevel ? "py-4" : "py-2"} items-start ${isTopLevel ? `border-b ${ui.defaultBorderMixin}` : ""}`;
|
|
7755
|
+
let t6;
|
|
7756
|
+
if ($[78] !== label_0) {
|
|
7757
|
+
t6 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-4 pr-2", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", component: "span", className: "break-words", children: label_0 }) });
|
|
7758
|
+
$[78] = label_0;
|
|
7759
|
+
$[79] = t6;
|
|
7760
|
+
} else {
|
|
7761
|
+
t6 = $[79];
|
|
7762
|
+
}
|
|
7763
|
+
let t7;
|
|
7764
|
+
if ($[80] !== baseKey || $[81] !== data || $[82] !== property_1 || $[83] !== size) {
|
|
7765
|
+
t7 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-8", children: /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { propertyKey: baseKey, value: data, property: property_1, size }) });
|
|
7766
|
+
$[80] = baseKey;
|
|
7767
|
+
$[81] = data;
|
|
7768
|
+
$[82] = property_1;
|
|
7769
|
+
$[83] = size;
|
|
7770
|
+
$[84] = t7;
|
|
7771
|
+
} else {
|
|
7772
|
+
t7 = $[84];
|
|
7773
|
+
}
|
|
7774
|
+
let t8;
|
|
7775
|
+
if ($[85] !== t5 || $[86] !== t6 || $[87] !== t7) {
|
|
7776
|
+
t8 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: t5, children: [
|
|
7777
|
+
t6,
|
|
7778
|
+
t7
|
|
7779
|
+
] });
|
|
7780
|
+
$[85] = t5;
|
|
7781
|
+
$[86] = t6;
|
|
7782
|
+
$[87] = t7;
|
|
7783
|
+
$[88] = t8;
|
|
7784
|
+
} else {
|
|
7785
|
+
t8 = $[88];
|
|
7786
|
+
}
|
|
7787
|
+
return t8;
|
|
7788
|
+
}
|
|
7789
|
+
return null;
|
|
7790
|
+
};
|
|
7376
7791
|
function EntityView({
|
|
7377
7792
|
entity,
|
|
7378
7793
|
collection,
|
|
@@ -7390,31 +7805,17 @@
|
|
|
7390
7805
|
authController
|
|
7391
7806
|
}), [collection, path, entity, customizationController.propertyConfigs]);
|
|
7392
7807
|
const properties = resolvedCollection.properties;
|
|
7393
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full " + className, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full mb-4", children: [
|
|
7394
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
7395
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
7396
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7808
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full " + className, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full mb-4 p-4", children: [
|
|
7809
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `grid grid-cols-12 gap-x-4 py-4 items-start border-b ${ui.defaultBorderMixin}`, children: [
|
|
7810
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-4 pr-2", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", color: "secondary", component: "span", className: "break-words", children: "Id" }) }),
|
|
7811
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-grow text-surface-900 dark:text-white flex items-center", children: [
|
|
7397
7812
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-grow mr-2", children: entity.id }),
|
|
7398
7813
|
customizationController?.entityLinkBuilder && /* @__PURE__ */ jsxRuntime.jsx("a", { href: customizationController.entityLinkBuilder({
|
|
7399
7814
|
entity
|
|
7400
7815
|
}), rel: "noopener noreferrer", target: "_blank", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.OpenInNewIcon, { size: "small" }) }) })
|
|
7401
|
-
] })
|
|
7816
|
+
] }) })
|
|
7402
7817
|
] }),
|
|
7403
|
-
|
|
7404
|
-
const value = entity.values?.[key];
|
|
7405
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls(ui.defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0"), children: [
|
|
7406
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center w-1/4", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pl-2 text-sm text-surface-600", children: property.name }) }),
|
|
7407
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow p-2 ml-2 w-3/4 text-surface-900 dark:text-white min-h-[56px] flex items-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7408
|
-
PropertyPreview,
|
|
7409
|
-
{
|
|
7410
|
-
propertyKey: key,
|
|
7411
|
-
value,
|
|
7412
|
-
property,
|
|
7413
|
-
size: "medium"
|
|
7414
|
-
}
|
|
7415
|
-
) })
|
|
7416
|
-
] }, `reference_previews_${key}`);
|
|
7417
|
-
})
|
|
7818
|
+
/* @__PURE__ */ jsxRuntime.jsx(PropertyCollectionView, { data: entity.values, properties, size: "medium" })
|
|
7418
7819
|
] }) });
|
|
7419
7820
|
}
|
|
7420
7821
|
function VirtualTableInput(props) {
|
|
@@ -9765,6 +10166,10 @@
|
|
|
9765
10166
|
try {
|
|
9766
10167
|
const key = LOCAL_STORAGE_PREFIX + path;
|
|
9767
10168
|
const entityString = JSON.stringify(data, customReplacer);
|
|
10169
|
+
console.log("Saving entity to localStorage:", {
|
|
10170
|
+
key,
|
|
10171
|
+
entityString
|
|
10172
|
+
});
|
|
9768
10173
|
localStorage.setItem(key, entityString);
|
|
9769
10174
|
} catch (error) {
|
|
9770
10175
|
console.error(`Failed to save entity for path "${path}" to localStorage:`, error);
|
|
@@ -9787,6 +10192,10 @@
|
|
|
9787
10192
|
const entityString = localStorage.getItem(key);
|
|
9788
10193
|
if (entityString) {
|
|
9789
10194
|
const entity = JSON.parse(entityString, customReviver);
|
|
10195
|
+
console.log("Loaded entity from localStorage:", {
|
|
10196
|
+
key,
|
|
10197
|
+
entity
|
|
10198
|
+
});
|
|
9790
10199
|
return entity;
|
|
9791
10200
|
}
|
|
9792
10201
|
} catch (error) {
|
|
@@ -9805,6 +10214,26 @@
|
|
|
9805
10214
|
}
|
|
9806
10215
|
}
|
|
9807
10216
|
}
|
|
10217
|
+
function flattenKeys(obj, prefix = "", result = []) {
|
|
10218
|
+
if (isObject(obj) || Array.isArray(obj)) {
|
|
10219
|
+
const plainObject = isPlainObject(obj);
|
|
10220
|
+
if (!plainObject && prefix) {
|
|
10221
|
+
result.push(prefix);
|
|
10222
|
+
} else {
|
|
10223
|
+
for (const key in obj) {
|
|
10224
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
10225
|
+
const newKey = prefix ? Array.isArray(obj) ? `${prefix}[${key}]` : `${prefix}.${key}` : key;
|
|
10226
|
+
if (isObject(obj[key]) || Array.isArray(obj[key])) {
|
|
10227
|
+
flattenKeys(obj[key], newKey, result);
|
|
10228
|
+
} else {
|
|
10229
|
+
result.push(newKey);
|
|
10230
|
+
}
|
|
10231
|
+
}
|
|
10232
|
+
}
|
|
10233
|
+
}
|
|
10234
|
+
}
|
|
10235
|
+
return result;
|
|
10236
|
+
}
|
|
9808
10237
|
const EntityCollectionRowActions = function EntityCollectionRowActions2({
|
|
9809
10238
|
entity,
|
|
9810
10239
|
collection,
|
|
@@ -15169,10 +15598,10 @@
|
|
|
15169
15598
|
] });
|
|
15170
15599
|
}
|
|
15171
15600
|
function LocalChangesMenu(t0) {
|
|
15172
|
-
const $ = reactCompilerRuntime.c(
|
|
15601
|
+
const $ = reactCompilerRuntime.c(42);
|
|
15173
15602
|
const {
|
|
15174
15603
|
localChangesData,
|
|
15175
|
-
formex:
|
|
15604
|
+
formex: formex2,
|
|
15176
15605
|
onClearLocalChanges,
|
|
15177
15606
|
cacheKey,
|
|
15178
15607
|
properties
|
|
@@ -15182,9 +15611,7 @@
|
|
|
15182
15611
|
const [open, setOpen] = React.useState(false);
|
|
15183
15612
|
let t1;
|
|
15184
15613
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15185
|
-
t1 = () =>
|
|
15186
|
-
setOpen(true);
|
|
15187
|
-
};
|
|
15614
|
+
t1 = () => setOpen(true);
|
|
15188
15615
|
$[0] = t1;
|
|
15189
15616
|
} else {
|
|
15190
15617
|
t1 = $[0];
|
|
@@ -15192,9 +15619,7 @@
|
|
|
15192
15619
|
const handleOpenMenu = t1;
|
|
15193
15620
|
let t2;
|
|
15194
15621
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15195
|
-
t2 = () =>
|
|
15196
|
-
setOpen(false);
|
|
15197
|
-
};
|
|
15622
|
+
t2 = () => setOpen(false);
|
|
15198
15623
|
$[1] = t2;
|
|
15199
15624
|
} else {
|
|
15200
15625
|
t2 = $[1];
|
|
@@ -15212,18 +15637,18 @@
|
|
|
15212
15637
|
}
|
|
15213
15638
|
const handlePreview = t3;
|
|
15214
15639
|
let t4;
|
|
15215
|
-
if ($[3] !==
|
|
15640
|
+
if ($[3] !== formex2 || $[4] !== localChangesData || $[5] !== onClearLocalChanges || $[6] !== snackbarController) {
|
|
15216
15641
|
t4 = () => {
|
|
15217
|
-
const mergedValues = mergeDeep(
|
|
15642
|
+
const mergedValues = mergeDeep(formex2.values, localChangesData);
|
|
15218
15643
|
const touched = {
|
|
15219
|
-
...
|
|
15644
|
+
...formex2.touched
|
|
15220
15645
|
};
|
|
15221
|
-
const
|
|
15222
|
-
|
|
15646
|
+
const previewKeys = flattenKeys(localChangesData);
|
|
15647
|
+
previewKeys.forEach((key) => {
|
|
15223
15648
|
touched[key] = true;
|
|
15224
15649
|
});
|
|
15225
|
-
|
|
15226
|
-
|
|
15650
|
+
formex2.setTouched(touched);
|
|
15651
|
+
formex2.setValues(mergedValues);
|
|
15227
15652
|
snackbarController.open({
|
|
15228
15653
|
type: "info",
|
|
15229
15654
|
message: "Local changes applied to the form"
|
|
@@ -15231,7 +15656,7 @@
|
|
|
15231
15656
|
handleCloseMenu();
|
|
15232
15657
|
onClearLocalChanges?.();
|
|
15233
15658
|
};
|
|
15234
|
-
$[3] =
|
|
15659
|
+
$[3] = formex2;
|
|
15235
15660
|
$[4] = localChangesData;
|
|
15236
15661
|
$[5] = onClearLocalChanges;
|
|
15237
15662
|
$[6] = snackbarController;
|
|
@@ -15279,7 +15704,7 @@
|
|
|
15279
15704
|
}
|
|
15280
15705
|
let t8;
|
|
15281
15706
|
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15282
|
-
t8 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-xs px-4 py-4 text-sm text-gray-700 dark:text-gray-300", children: "This document was edited locally and has unsaved changes." });
|
|
15707
|
+
t8 = /* @__PURE__ */ jsxRuntime.jsx("div", { className: "max-w-xs px-4 py-4 text-sm text-gray-700 dark:text-gray-300", children: "This document was edited locally and has unsaved changes. These local changes will be lost if you don't apply them." });
|
|
15283
15708
|
$[14] = t8;
|
|
15284
15709
|
} else {
|
|
15285
15710
|
t8 = $[14];
|
|
@@ -15357,83 +15782,76 @@
|
|
|
15357
15782
|
t16 = $[27];
|
|
15358
15783
|
}
|
|
15359
15784
|
let t17;
|
|
15360
|
-
if ($[28]
|
|
15361
|
-
t17 =
|
|
15362
|
-
|
|
15363
|
-
|
|
15364
|
-
|
|
15365
|
-
|
|
15366
|
-
}
|
|
15367
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-12 gap-x-4 px-4 py-3 items-center", children: [
|
|
15368
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-3 text-right", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "caption", className: "text-gray-500 dark:text-gray-400 break-words", children: property.name || key_0 }) }),
|
|
15369
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "col-span-9", children: /* @__PURE__ */ jsxRuntime.jsx(PropertyPreview, { propertyKey: key_0, value, property, size: "small" }) })
|
|
15370
|
-
] }, key_0);
|
|
15371
|
-
});
|
|
15372
|
-
$[28] = localChangesData;
|
|
15373
|
-
$[29] = properties;
|
|
15374
|
-
$[30] = t17;
|
|
15785
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15786
|
+
t17 = {
|
|
15787
|
+
maxHeight: 520,
|
|
15788
|
+
overflow: "auto"
|
|
15789
|
+
};
|
|
15790
|
+
$[28] = t17;
|
|
15375
15791
|
} else {
|
|
15376
|
-
t17 = $[
|
|
15792
|
+
t17 = $[28];
|
|
15377
15793
|
}
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15794
|
+
const t18 = properties;
|
|
15795
|
+
let t19;
|
|
15796
|
+
if ($[29] !== localChangesData || $[30] !== t18) {
|
|
15797
|
+
t19 = /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogContent, { children: [
|
|
15381
15798
|
t15,
|
|
15382
15799
|
t16,
|
|
15383
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `border rounded-lg
|
|
15800
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `border rounded-lg ${ui.defaultBorderMixin}`, style: t17, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxRuntime.jsx(PropertyCollectionView, { data: localChangesData, properties: t18 }) }) })
|
|
15384
15801
|
] });
|
|
15385
|
-
$[
|
|
15386
|
-
$[
|
|
15802
|
+
$[29] = localChangesData;
|
|
15803
|
+
$[30] = t18;
|
|
15804
|
+
$[31] = t19;
|
|
15387
15805
|
} else {
|
|
15388
|
-
|
|
15806
|
+
t19 = $[31];
|
|
15389
15807
|
}
|
|
15390
|
-
let
|
|
15391
|
-
if ($[
|
|
15392
|
-
|
|
15393
|
-
$[
|
|
15808
|
+
let t20;
|
|
15809
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15810
|
+
t20 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: () => setPreviewDialogOpen(false), children: "Close" });
|
|
15811
|
+
$[32] = t20;
|
|
15394
15812
|
} else {
|
|
15395
|
-
|
|
15813
|
+
t20 = $[32];
|
|
15396
15814
|
}
|
|
15397
|
-
let
|
|
15398
|
-
if ($[
|
|
15399
|
-
|
|
15400
|
-
|
|
15815
|
+
let t21;
|
|
15816
|
+
if ($[33] !== handleApply) {
|
|
15817
|
+
t21 = /* @__PURE__ */ jsxRuntime.jsxs(ui.DialogActions, { children: [
|
|
15818
|
+
t20,
|
|
15401
15819
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "filled", onClick: () => {
|
|
15402
15820
|
handleApply();
|
|
15403
15821
|
setPreviewDialogOpen(false);
|
|
15404
15822
|
}, children: "Apply changes" })
|
|
15405
15823
|
] });
|
|
15406
|
-
$[
|
|
15407
|
-
$[
|
|
15824
|
+
$[33] = handleApply;
|
|
15825
|
+
$[34] = t21;
|
|
15408
15826
|
} else {
|
|
15409
|
-
|
|
15827
|
+
t21 = $[34];
|
|
15410
15828
|
}
|
|
15411
|
-
let
|
|
15412
|
-
if ($[
|
|
15413
|
-
|
|
15414
|
-
|
|
15415
|
-
|
|
15829
|
+
let t22;
|
|
15830
|
+
if ($[35] !== previewDialogOpen || $[36] !== t19 || $[37] !== t21) {
|
|
15831
|
+
t22 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Dialog, { open: previewDialogOpen, onOpenChange: setPreviewDialogOpen, maxWidth: "4xl", children: [
|
|
15832
|
+
t19,
|
|
15833
|
+
t21
|
|
15416
15834
|
] });
|
|
15417
|
-
$[
|
|
15418
|
-
$[
|
|
15419
|
-
$[
|
|
15420
|
-
$[
|
|
15835
|
+
$[35] = previewDialogOpen;
|
|
15836
|
+
$[36] = t19;
|
|
15837
|
+
$[37] = t21;
|
|
15838
|
+
$[38] = t22;
|
|
15421
15839
|
} else {
|
|
15422
|
-
|
|
15840
|
+
t22 = $[38];
|
|
15423
15841
|
}
|
|
15424
|
-
let
|
|
15425
|
-
if ($[
|
|
15426
|
-
|
|
15842
|
+
let t23;
|
|
15843
|
+
if ($[39] !== t14 || $[40] !== t22) {
|
|
15844
|
+
t23 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
15427
15845
|
t14,
|
|
15428
|
-
|
|
15846
|
+
t22
|
|
15429
15847
|
] });
|
|
15430
|
-
$[
|
|
15431
|
-
$[
|
|
15432
|
-
$[
|
|
15848
|
+
$[39] = t14;
|
|
15849
|
+
$[40] = t22;
|
|
15850
|
+
$[41] = t23;
|
|
15433
15851
|
} else {
|
|
15434
|
-
|
|
15852
|
+
t23 = $[41];
|
|
15435
15853
|
}
|
|
15436
|
-
return
|
|
15854
|
+
return t23;
|
|
15437
15855
|
}
|
|
15438
15856
|
function extractTouchedValues(values, touched) {
|
|
15439
15857
|
let acc = {};
|
|
@@ -15447,6 +15865,56 @@
|
|
|
15447
15865
|
});
|
|
15448
15866
|
return acc;
|
|
15449
15867
|
}
|
|
15868
|
+
function getChanges(source, comparison) {
|
|
15869
|
+
const changes = {};
|
|
15870
|
+
if (!source) {
|
|
15871
|
+
return {};
|
|
15872
|
+
}
|
|
15873
|
+
if (!comparison) {
|
|
15874
|
+
return source;
|
|
15875
|
+
}
|
|
15876
|
+
const allKeys = Array.from(/* @__PURE__ */ new Set([...Object.keys(source), ...Object.keys(comparison)]));
|
|
15877
|
+
for (const key of allKeys) {
|
|
15878
|
+
const sourceValue = source[key];
|
|
15879
|
+
const comparisonValue = comparison[key];
|
|
15880
|
+
if (equal(sourceValue, comparisonValue)) {
|
|
15881
|
+
continue;
|
|
15882
|
+
}
|
|
15883
|
+
const sourceHasKey = source && typeof source === "object" && Object.prototype.hasOwnProperty.call(source, key);
|
|
15884
|
+
const comparisonHasKey = comparison && typeof comparison === "object" && Object.prototype.hasOwnProperty.call(comparison, key);
|
|
15885
|
+
if (comparisonHasKey && !sourceHasKey) {
|
|
15886
|
+
changes[key] = void 0;
|
|
15887
|
+
} else if (Array.isArray(sourceValue)) {
|
|
15888
|
+
const comparisonArray = Array.isArray(comparisonValue) ? comparisonValue : [];
|
|
15889
|
+
if (sourceValue.length < comparisonArray.length) {
|
|
15890
|
+
changes[key] = sourceValue;
|
|
15891
|
+
continue;
|
|
15892
|
+
}
|
|
15893
|
+
const changedArray = sourceValue.map((item, index) => {
|
|
15894
|
+
const comparisonItem = comparisonArray[index];
|
|
15895
|
+
if (equal(item, comparisonItem)) {
|
|
15896
|
+
return null;
|
|
15897
|
+
}
|
|
15898
|
+
if (isObject(item) && item && isObject(comparisonItem) && comparisonItem) {
|
|
15899
|
+
const nestedChanges = getChanges(item, comparisonItem);
|
|
15900
|
+
return Object.keys(nestedChanges).length > 0 ? nestedChanges : item;
|
|
15901
|
+
}
|
|
15902
|
+
return item;
|
|
15903
|
+
});
|
|
15904
|
+
if (changedArray.some((item) => item !== null) || sourceValue.length > comparisonArray.length) {
|
|
15905
|
+
changes[key] = changedArray;
|
|
15906
|
+
}
|
|
15907
|
+
} else if (isObject(sourceValue) && sourceValue && isObject(comparisonValue) && comparisonValue) {
|
|
15908
|
+
const nestedChanges = getChanges(sourceValue, comparisonValue);
|
|
15909
|
+
if (Object.keys(nestedChanges).length > 0) {
|
|
15910
|
+
changes[key] = nestedChanges;
|
|
15911
|
+
}
|
|
15912
|
+
} else {
|
|
15913
|
+
changes[key] = sourceValue;
|
|
15914
|
+
}
|
|
15915
|
+
}
|
|
15916
|
+
return changes;
|
|
15917
|
+
}
|
|
15450
15918
|
function EntityForm({
|
|
15451
15919
|
path,
|
|
15452
15920
|
fullIdPath,
|
|
@@ -15568,22 +16036,13 @@
|
|
|
15568
16036
|
if (!localChangesDataRaw) {
|
|
15569
16037
|
return void 0;
|
|
15570
16038
|
}
|
|
15571
|
-
|
|
15572
|
-
const flattenedKeys = formex.flattenKeys(localChangesDataRaw);
|
|
15573
|
-
flattenedKeys.forEach((key) => {
|
|
15574
|
-
const localValue = formex.getIn(localChangesDataRaw, key);
|
|
15575
|
-
const initialValue = formex.getIn(initialValues_0, key);
|
|
15576
|
-
if (!equal(localValue, initialValue)) {
|
|
15577
|
-
filteredChanges = formex.setIn(filteredChanges, key, localValue);
|
|
15578
|
-
}
|
|
15579
|
-
});
|
|
15580
|
-
return filteredChanges;
|
|
16039
|
+
return getChanges(localChangesDataRaw, initialValues_0);
|
|
15581
16040
|
}, [localChangesDataRaw, initialValues_0]);
|
|
15582
16041
|
const hasLocalChanges = !localChangesCleared && localChangesData && Object.keys(localChangesData).length > 0;
|
|
15583
16042
|
const formex$1 = formexProp ?? formex.useCreateFormex({
|
|
15584
16043
|
initialValues: initialValues_0,
|
|
15585
16044
|
initialDirty: initialDirty_0,
|
|
15586
|
-
initialTouched: initialDirtyValues ?
|
|
16045
|
+
initialTouched: initialDirtyValues ? flattenKeys(initialDirtyValues).reduce((previousValue, currentValue) => ({
|
|
15587
16046
|
...previousValue,
|
|
15588
16047
|
[currentValue]: true
|
|
15589
16048
|
}), {}) : {},
|
|
@@ -15593,10 +16052,10 @@
|
|
|
15593
16052
|
onValuesModified?.(false, initialValues_0);
|
|
15594
16053
|
},
|
|
15595
16054
|
onValuesChangeDeferred: (values_0, controller) => {
|
|
15596
|
-
const
|
|
16055
|
+
const key = status === "new" || status === "copy" ? path + "#new" : path + "/" + entityId;
|
|
15597
16056
|
if (controller.dirty) {
|
|
15598
16057
|
const touchedValues = extractTouchedValues(values_0, controller.touched);
|
|
15599
|
-
saveEntityToCache(
|
|
16058
|
+
saveEntityToCache(key, touchedValues);
|
|
15600
16059
|
}
|
|
15601
16060
|
},
|
|
15602
16061
|
validation: (values_1) => {
|
|
@@ -15830,11 +16289,11 @@
|
|
|
15830
16289
|
useOnAutoSave(autoSave, formex$1, lastSavedValues, save);
|
|
15831
16290
|
React.useEffect(() => {
|
|
15832
16291
|
if (!autoSave && !formex$1.isSubmitting && underlyingChanges && entity) {
|
|
15833
|
-
Object.entries(underlyingChanges).forEach(([
|
|
15834
|
-
const formValue = formex$1.values[
|
|
15835
|
-
if (!equal(value_0, formValue) && !formex$1.touched[
|
|
15836
|
-
console.debug("Updated value from the datasource:",
|
|
15837
|
-
formex$1.setFieldValue(
|
|
16292
|
+
Object.entries(underlyingChanges).forEach(([key_0, value_0]) => {
|
|
16293
|
+
const formValue = formex$1.values[key_0];
|
|
16294
|
+
if (!equal(value_0, formValue) && !formex$1.touched[key_0]) {
|
|
16295
|
+
console.debug("Updated value from the datasource:", key_0, value_0);
|
|
16296
|
+
formex$1.setFieldValue(key_0, value_0 !== void 0 ? value_0 : null);
|
|
15838
16297
|
}
|
|
15839
16298
|
});
|
|
15840
16299
|
}
|
|
@@ -15844,16 +16303,16 @@
|
|
|
15844
16303
|
if (Builder) {
|
|
15845
16304
|
return /* @__PURE__ */ jsxRuntime.jsx(Builder, { collection, entity, modifiedValues: formex$1.values, formContext });
|
|
15846
16305
|
}
|
|
15847
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { children: formFieldKeys.map((
|
|
15848
|
-
const property = resolvedCollection.properties[
|
|
16306
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FormLayout, { children: formFieldKeys.map((key_1) => {
|
|
16307
|
+
const property = resolvedCollection.properties[key_1];
|
|
15849
16308
|
if (property) {
|
|
15850
|
-
const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(
|
|
16309
|
+
const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(key_1) && formex$1.touched[key_1];
|
|
15851
16310
|
const disabled_0 = disabledProp || !autoSave && formex$1.isSubmitting || isReadOnly(property) || Boolean(property.disabled);
|
|
15852
16311
|
const hidden = isHidden(property);
|
|
15853
16312
|
if (hidden) return null;
|
|
15854
16313
|
const widthPercentage = property.widthPercentage ?? 100;
|
|
15855
16314
|
const cmsFormFieldProps = {
|
|
15856
|
-
propertyKey:
|
|
16315
|
+
propertyKey: key_1,
|
|
15857
16316
|
disabled: disabled_0,
|
|
15858
16317
|
property,
|
|
15859
16318
|
includeDescription: property.description || property.longDescription,
|
|
@@ -15863,9 +16322,9 @@
|
|
|
15863
16322
|
minimalistView: false,
|
|
15864
16323
|
autoFocus: false
|
|
15865
16324
|
};
|
|
15866
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FormEntry, { propertyKey:
|
|
16325
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FormEntry, { propertyKey: key_1, widthPercentage, children: /* @__PURE__ */ jsxRuntime.jsx(PropertyFieldBinding, { ...cmsFormFieldProps }) }, `field_${key_1}`);
|
|
15867
16326
|
}
|
|
15868
|
-
const additionalField = resolvedCollection.additionalFields?.find((f) => f.key ===
|
|
16327
|
+
const additionalField = resolvedCollection.additionalFields?.find((f) => f.key === key_1);
|
|
15869
16328
|
if (additionalField && entity) {
|
|
15870
16329
|
const Builder_0 = additionalField.Builder;
|
|
15871
16330
|
if (!Builder_0 && !additionalField.value) {
|
|
@@ -15876,11 +16335,11 @@
|
|
|
15876
16335
|
context
|
|
15877
16336
|
})?.toString() });
|
|
15878
16337
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full", children: [
|
|
15879
|
-
/* @__PURE__ */ jsxRuntime.jsx(LabelWithIconAndTooltip, { propertyKey:
|
|
16338
|
+
/* @__PURE__ */ jsxRuntime.jsx(LabelWithIconAndTooltip, { propertyKey: key_1, icon: /* @__PURE__ */ jsxRuntime.jsx(ui.NotesIcon, { size: "small" }), title: additionalField.name, className: "text-text-secondary dark:text-text-secondary-dark ml-3.5" }),
|
|
15880
16339
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cls(ui.paperMixin, "w-full min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar"), children: /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { children: child }) })
|
|
15881
|
-
] }, `additional_${
|
|
16340
|
+
] }, `additional_${key_1}`);
|
|
15882
16341
|
}
|
|
15883
|
-
console.warn(`Property ${
|
|
16342
|
+
console.warn(`Property ${key_1} not found in collection ${resolvedCollection.name} in properties or additional fields. Skipping.`);
|
|
15884
16343
|
return null;
|
|
15885
16344
|
}).filter(Boolean) });
|
|
15886
16345
|
};
|
|
@@ -26556,6 +27015,7 @@
|
|
|
26556
27015
|
exports2.isEnumValueDisabled = isEnumValueDisabled;
|
|
26557
27016
|
exports2.isHidden = isHidden;
|
|
26558
27017
|
exports2.isObject = isObject;
|
|
27018
|
+
exports2.isPlainObject = isPlainObject;
|
|
26559
27019
|
exports2.isPropertyBuilder = isPropertyBuilder;
|
|
26560
27020
|
exports2.isReadOnly = isReadOnly;
|
|
26561
27021
|
exports2.isReferenceProperty = isReferenceProperty;
|