@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.es.js
CHANGED
|
@@ -5,7 +5,7 @@ import React__default, { useRef, useEffect, useContext, useCallback, useMemo, us
|
|
|
5
5
|
import { getColorSchemeForSeed, CHIP_COLORS, FunctionsIcon, CircleIcon, iconKeys, coolIconKeys, Icon, Tooltip, ErrorIcon, Typography, IconButton, ContentCopyIcon, OpenInNewIcon, DescriptionIcon, cls, Skeleton, Chip, defaultBorderMixin, KeyboardTabIcon, Checkbox, AccountCircleIcon, Markdown, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, paperMixin, EditIcon, DoNotDisturbOnIcon, Menu, MenuItem, MoreVertIcon, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, CenteredView, AssignmentIcon, Label, CloseIcon, TextField, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogTitle, DialogContent, DialogActions, FileCopyIcon, DeleteIcon, AddIcon, StarIcon, Collapse, ExpandablePanel, ArrowForwardIcon, Card, cardMixin, cardClickableMixin, Container, LoadingButton, WarningIcon, KeyboardArrowDownIcon, VisibilityIcon, CheckIcon, CancelIcon, Alert, NotesIcon, InfoIcon, fieldBackgroundMixin, RemoveIcon, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, ArrowDropDownIcon, FilterListOffIcon, SearchIcon, Avatar, DarkModeIcon, LightModeIcon, BrightnessMediumIcon, LogoutIcon, HandleIcon, KeyboardArrowUpIcon, debounce, Sheet, Tab, Tabs, CodeIcon, OpenInFullIcon, ViewStreamIcon, RepeatIcon, BallotIcon, ScheduleIcon, AddLinkIcon, LinkIcon, DriveFolderUploadIcon, UploadFileIcon, FormatListNumberedIcon, NumbersIcon, PersonIcon, ListAltIcon, ListIcon, FlagIcon, MailIcon, HttpIcon, FormatQuoteIcon, SubjectIcon, ShortTextIcon, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
|
|
6
6
|
import { SnackbarProvider as SnackbarProvider$1, useSnackbar } from "notistack";
|
|
7
7
|
import hash from "object-hash";
|
|
8
|
-
import { getIn, useFormex,
|
|
8
|
+
import { getIn, useFormex, setIn, useCreateFormex, Formex, Field } from "@firecms/formex";
|
|
9
9
|
import { useNavigate, useLocation, Link, NavLink, Routes, Route, createBrowserRouter, RouterProvider } from "react-router-dom";
|
|
10
10
|
import Fuse from "fuse.js";
|
|
11
11
|
import equal from "react-fast-compare";
|
|
@@ -255,6 +255,13 @@ const pick = (obj, ...args) => ({
|
|
|
255
255
|
function isObject(item) {
|
|
256
256
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
257
257
|
}
|
|
258
|
+
function isPlainObject(obj) {
|
|
259
|
+
if (typeof obj !== "object" || obj === null || Array.isArray(obj)) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
const proto = Object.getPrototypeOf(obj);
|
|
263
|
+
return proto === Object.prototype;
|
|
264
|
+
}
|
|
258
265
|
function mergeDeep(target, source, ignoreUndefined = false) {
|
|
259
266
|
if (!isObject(target)) {
|
|
260
267
|
return target;
|
|
@@ -275,7 +282,28 @@ function mergeDeep(target, source, ignoreUndefined = false) {
|
|
|
275
282
|
if (sourceValue instanceof Date) {
|
|
276
283
|
output[key] = new Date(sourceValue.getTime());
|
|
277
284
|
} else if (Array.isArray(sourceValue)) {
|
|
278
|
-
|
|
285
|
+
if (Array.isArray(outputValue)) {
|
|
286
|
+
const newArray = [];
|
|
287
|
+
const maxLength = Math.max(outputValue.length, sourceValue.length);
|
|
288
|
+
for (let i = 0; i < maxLength; i++) {
|
|
289
|
+
const sourceItem = sourceValue[i];
|
|
290
|
+
const targetItem = outputValue[i];
|
|
291
|
+
if (i >= sourceValue.length) {
|
|
292
|
+
newArray[i] = targetItem;
|
|
293
|
+
} else if (i >= outputValue.length) {
|
|
294
|
+
newArray[i] = sourceItem;
|
|
295
|
+
} else if (sourceItem === null) {
|
|
296
|
+
newArray[i] = targetItem;
|
|
297
|
+
} else if (isObject(sourceItem) && isObject(targetItem)) {
|
|
298
|
+
newArray[i] = mergeDeep(targetItem, sourceItem, ignoreUndefined);
|
|
299
|
+
} else {
|
|
300
|
+
newArray[i] = sourceItem;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
output[key] = newArray;
|
|
304
|
+
} else {
|
|
305
|
+
output[key] = [...sourceValue];
|
|
306
|
+
}
|
|
279
307
|
} else if (isObject(sourceValue)) {
|
|
280
308
|
if (isObject(outputValue)) {
|
|
281
309
|
output[key] = mergeDeep(outputValue, sourceValue, ignoreUndefined);
|
|
@@ -6777,7 +6805,7 @@ function BooleanPreview(t0) {
|
|
|
6777
6805
|
return t3;
|
|
6778
6806
|
}
|
|
6779
6807
|
function NumberPropertyPreview(t0) {
|
|
6780
|
-
const $ = c(
|
|
6808
|
+
const $ = c(12);
|
|
6781
6809
|
const {
|
|
6782
6810
|
value,
|
|
6783
6811
|
property,
|
|
@@ -6795,38 +6823,42 @@ function NumberPropertyPreview(t0) {
|
|
|
6795
6823
|
}
|
|
6796
6824
|
const enumValues = t1;
|
|
6797
6825
|
if (!enumValues) {
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
$[
|
|
6826
|
+
const t22 = size === "small" ? "text-sm" : "";
|
|
6827
|
+
let t32;
|
|
6828
|
+
if ($[2] !== t22 || $[3] !== value) {
|
|
6829
|
+
t32 = /* @__PURE__ */ jsx("span", { className: t22, children: value });
|
|
6830
|
+
$[2] = t22;
|
|
6831
|
+
$[3] = value;
|
|
6832
|
+
$[4] = t32;
|
|
6803
6833
|
} else {
|
|
6804
|
-
|
|
6834
|
+
t32 = $[4];
|
|
6805
6835
|
}
|
|
6806
|
-
return
|
|
6836
|
+
return t32;
|
|
6807
6837
|
}
|
|
6808
6838
|
const t2 = size !== "medium" ? "small" : "medium";
|
|
6809
6839
|
let t3;
|
|
6810
|
-
if ($[
|
|
6840
|
+
if ($[5] !== enumKey || $[6] !== enumValues || $[7] !== t2) {
|
|
6811
6841
|
t3 = /* @__PURE__ */ jsx(EnumValuesChip, { enumKey, enumValues, size: t2 });
|
|
6812
|
-
$[
|
|
6813
|
-
$[
|
|
6814
|
-
$[
|
|
6815
|
-
$[
|
|
6842
|
+
$[5] = enumKey;
|
|
6843
|
+
$[6] = enumValues;
|
|
6844
|
+
$[7] = t2;
|
|
6845
|
+
$[8] = t3;
|
|
6816
6846
|
} else {
|
|
6817
|
-
t3 = $[
|
|
6847
|
+
t3 = $[8];
|
|
6818
6848
|
}
|
|
6819
6849
|
return t3;
|
|
6820
6850
|
} else {
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6851
|
+
const t1 = size === "small" ? "text-sm" : "";
|
|
6852
|
+
let t2;
|
|
6853
|
+
if ($[9] !== t1 || $[10] !== value) {
|
|
6854
|
+
t2 = /* @__PURE__ */ jsx("span", { className: t1, children: value });
|
|
6825
6855
|
$[9] = t1;
|
|
6856
|
+
$[10] = value;
|
|
6857
|
+
$[11] = t2;
|
|
6826
6858
|
} else {
|
|
6827
|
-
|
|
6859
|
+
t2 = $[11];
|
|
6828
6860
|
}
|
|
6829
|
-
return
|
|
6861
|
+
return t2;
|
|
6830
6862
|
}
|
|
6831
6863
|
}
|
|
6832
6864
|
function UserDisplay(t0) {
|
|
@@ -7375,6 +7407,389 @@ const AsyncPreviewComponent = React.memo(function AsyncPreviewComponentInternal(
|
|
|
7375
7407
|
}
|
|
7376
7408
|
return t3;
|
|
7377
7409
|
});
|
|
7410
|
+
function buildPropertyLabelAndGetProperty(properties, key) {
|
|
7411
|
+
if (!key) return {
|
|
7412
|
+
label: "",
|
|
7413
|
+
property: void 0
|
|
7414
|
+
};
|
|
7415
|
+
const segments = [];
|
|
7416
|
+
const re = /([^[.\]]+)|\[(\d+)\]/g;
|
|
7417
|
+
let m;
|
|
7418
|
+
while ((m = re.exec(key)) !== null) {
|
|
7419
|
+
if (m[1] !== void 0) segments.push(m[1]);
|
|
7420
|
+
else if (m[2] !== void 0) segments.push(Number(m[2]));
|
|
7421
|
+
}
|
|
7422
|
+
let currentProps = properties;
|
|
7423
|
+
let currentProp;
|
|
7424
|
+
let lastLabel = "";
|
|
7425
|
+
const getArrayOfProp = (p) => {
|
|
7426
|
+
if (!p || p.dataType !== "array") return void 0;
|
|
7427
|
+
return Array.isArray(p.of) ? p.of[0] : p.of;
|
|
7428
|
+
};
|
|
7429
|
+
for (const seg of segments) {
|
|
7430
|
+
if (typeof seg === "number") {
|
|
7431
|
+
lastLabel = `[${seg}]`;
|
|
7432
|
+
if (currentProp?.dataType === "array") {
|
|
7433
|
+
currentProp = getArrayOfProp(currentProp);
|
|
7434
|
+
if (currentProp?.dataType === "map" && currentProp.properties) {
|
|
7435
|
+
currentProps = currentProp.properties;
|
|
7436
|
+
} else {
|
|
7437
|
+
currentProps = void 0;
|
|
7438
|
+
}
|
|
7439
|
+
} else {
|
|
7440
|
+
currentProp = void 0;
|
|
7441
|
+
currentProps = void 0;
|
|
7442
|
+
}
|
|
7443
|
+
continue;
|
|
7444
|
+
}
|
|
7445
|
+
if (currentProps && currentProps[seg]) {
|
|
7446
|
+
const nextProp = currentProps[seg];
|
|
7447
|
+
currentProp = nextProp;
|
|
7448
|
+
lastLabel = nextProp.name || String(seg);
|
|
7449
|
+
if (nextProp.dataType === "map" && nextProp.properties) {
|
|
7450
|
+
currentProps = nextProp.properties;
|
|
7451
|
+
} else if (nextProp.dataType === "array") {
|
|
7452
|
+
currentProps = void 0;
|
|
7453
|
+
} else {
|
|
7454
|
+
currentProps = void 0;
|
|
7455
|
+
}
|
|
7456
|
+
} else {
|
|
7457
|
+
currentProp = void 0;
|
|
7458
|
+
currentProps = void 0;
|
|
7459
|
+
lastLabel = String(seg);
|
|
7460
|
+
}
|
|
7461
|
+
}
|
|
7462
|
+
return {
|
|
7463
|
+
label: lastLabel,
|
|
7464
|
+
property: currentProp
|
|
7465
|
+
};
|
|
7466
|
+
}
|
|
7467
|
+
const pathEndsWithIndex = (p) => /\[\d+\]$/.test(p);
|
|
7468
|
+
const PropertyCollectionView = (t0) => {
|
|
7469
|
+
const $ = c(89);
|
|
7470
|
+
const {
|
|
7471
|
+
data,
|
|
7472
|
+
properties,
|
|
7473
|
+
baseKey: t1,
|
|
7474
|
+
suppressHeader: t2,
|
|
7475
|
+
size: t3
|
|
7476
|
+
} = t0;
|
|
7477
|
+
const baseKey = t1 === void 0 ? "" : t1;
|
|
7478
|
+
const suppressHeader = t2 === void 0 ? false : t2;
|
|
7479
|
+
const size = t3 === void 0 ? "small" : t3;
|
|
7480
|
+
const isTopLevel = !!baseKey && !baseKey.includes(".") && !baseKey.includes("[");
|
|
7481
|
+
if (Array.isArray(data)) {
|
|
7482
|
+
let t4;
|
|
7483
|
+
if ($[0] !== baseKey || $[1] !== properties) {
|
|
7484
|
+
t4 = baseKey ? buildPropertyLabelAndGetProperty(properties, baseKey) : {
|
|
7485
|
+
label: "",
|
|
7486
|
+
property: void 0
|
|
7487
|
+
};
|
|
7488
|
+
$[0] = baseKey;
|
|
7489
|
+
$[1] = properties;
|
|
7490
|
+
$[2] = t4;
|
|
7491
|
+
} else {
|
|
7492
|
+
t4 = $[2];
|
|
7493
|
+
}
|
|
7494
|
+
const {
|
|
7495
|
+
label: arrayLabel,
|
|
7496
|
+
property
|
|
7497
|
+
} = t4;
|
|
7498
|
+
const ofProp = property?.dataType === "array" ? Array.isArray(property.of) ? property.of[0] : property.of : void 0;
|
|
7499
|
+
const isArrayOfMaps = ofProp?.dataType === "map";
|
|
7500
|
+
const isArrayOfPrimitives = property?.dataType === "array" && ofProp && ofProp.dataType !== "map";
|
|
7501
|
+
if (baseKey && property && isArrayOfPrimitives) {
|
|
7502
|
+
const t52 = `grid grid-cols-12 gap-x-4 ${isTopLevel ? "py-4" : "py-2"} items-start ${isTopLevel ? `border-b ${defaultBorderMixin}` : ""}`;
|
|
7503
|
+
let t62;
|
|
7504
|
+
if ($[3] !== arrayLabel) {
|
|
7505
|
+
t62 = /* @__PURE__ */ jsx("div", { className: "col-span-4 pr-2", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", component: "span", className: "break-words", children: arrayLabel }) });
|
|
7506
|
+
$[3] = arrayLabel;
|
|
7507
|
+
$[4] = t62;
|
|
7508
|
+
} else {
|
|
7509
|
+
t62 = $[4];
|
|
7510
|
+
}
|
|
7511
|
+
let t72;
|
|
7512
|
+
if ($[5] !== baseKey || $[6] !== data || $[7] !== property || $[8] !== size) {
|
|
7513
|
+
t72 = /* @__PURE__ */ jsx("div", { className: "col-span-8", children: /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: baseKey, value: data, property, size }) });
|
|
7514
|
+
$[5] = baseKey;
|
|
7515
|
+
$[6] = data;
|
|
7516
|
+
$[7] = property;
|
|
7517
|
+
$[8] = size;
|
|
7518
|
+
$[9] = t72;
|
|
7519
|
+
} else {
|
|
7520
|
+
t72 = $[9];
|
|
7521
|
+
}
|
|
7522
|
+
let t82;
|
|
7523
|
+
if ($[10] !== t52 || $[11] !== t62 || $[12] !== t72) {
|
|
7524
|
+
t82 = /* @__PURE__ */ jsxs("div", { className: t52, children: [
|
|
7525
|
+
t62,
|
|
7526
|
+
t72
|
|
7527
|
+
] });
|
|
7528
|
+
$[10] = t52;
|
|
7529
|
+
$[11] = t62;
|
|
7530
|
+
$[12] = t72;
|
|
7531
|
+
$[13] = t82;
|
|
7532
|
+
} else {
|
|
7533
|
+
t82 = $[13];
|
|
7534
|
+
}
|
|
7535
|
+
return t82;
|
|
7536
|
+
}
|
|
7537
|
+
const t5 = `${isTopLevel ? "py-4" : "py-1"} ${isTopLevel ? `border-b ${defaultBorderMixin}` : ""}`;
|
|
7538
|
+
let t6;
|
|
7539
|
+
if ($[14] !== arrayLabel || $[15] !== baseKey || $[16] !== suppressHeader) {
|
|
7540
|
+
t6 = baseKey && arrayLabel && !suppressHeader && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", component: "span", children: arrayLabel });
|
|
7541
|
+
$[14] = arrayLabel;
|
|
7542
|
+
$[15] = baseKey;
|
|
7543
|
+
$[16] = suppressHeader;
|
|
7544
|
+
$[17] = t6;
|
|
7545
|
+
} else {
|
|
7546
|
+
t6 = $[17];
|
|
7547
|
+
}
|
|
7548
|
+
const t7 = baseKey ? `pl-4 mt-1 border-l ${defaultBorderMixin}` : "";
|
|
7549
|
+
let t8;
|
|
7550
|
+
if ($[18] !== baseKey || $[19] !== data || $[20] !== isArrayOfMaps || $[21] !== ofProp || $[22] !== properties || $[23] !== size) {
|
|
7551
|
+
let t92;
|
|
7552
|
+
if ($[25] !== baseKey || $[26] !== isArrayOfMaps || $[27] !== ofProp || $[28] !== properties || $[29] !== size) {
|
|
7553
|
+
t92 = (item, index) => {
|
|
7554
|
+
if (item === null || item === void 0) {
|
|
7555
|
+
return null;
|
|
7556
|
+
}
|
|
7557
|
+
const currentKey = baseKey ? `${baseKey}[${index}]` : `[${index}]`;
|
|
7558
|
+
const itemHeader = isArrayOfMaps && ofProp?.name ? `${ofProp.name} [${index}]` : `[${index}]`;
|
|
7559
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-1", children: [
|
|
7560
|
+
/* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", component: "span", children: itemHeader }),
|
|
7561
|
+
/* @__PURE__ */ jsx("div", { className: `pl-4 mt-1 border-l ${defaultBorderMixin}`, children: /* @__PURE__ */ jsx(PropertyCollectionView, { data: item, properties, baseKey: currentKey, suppressHeader: true, size }) })
|
|
7562
|
+
] }, currentKey);
|
|
7563
|
+
};
|
|
7564
|
+
$[25] = baseKey;
|
|
7565
|
+
$[26] = isArrayOfMaps;
|
|
7566
|
+
$[27] = ofProp;
|
|
7567
|
+
$[28] = properties;
|
|
7568
|
+
$[29] = size;
|
|
7569
|
+
$[30] = t92;
|
|
7570
|
+
} else {
|
|
7571
|
+
t92 = $[30];
|
|
7572
|
+
}
|
|
7573
|
+
t8 = data.map(t92);
|
|
7574
|
+
$[18] = baseKey;
|
|
7575
|
+
$[19] = data;
|
|
7576
|
+
$[20] = isArrayOfMaps;
|
|
7577
|
+
$[21] = ofProp;
|
|
7578
|
+
$[22] = properties;
|
|
7579
|
+
$[23] = size;
|
|
7580
|
+
$[24] = t8;
|
|
7581
|
+
} else {
|
|
7582
|
+
t8 = $[24];
|
|
7583
|
+
}
|
|
7584
|
+
let t9;
|
|
7585
|
+
if ($[31] !== t7 || $[32] !== t8) {
|
|
7586
|
+
t9 = /* @__PURE__ */ jsx("div", { className: t7, children: t8 });
|
|
7587
|
+
$[31] = t7;
|
|
7588
|
+
$[32] = t8;
|
|
7589
|
+
$[33] = t9;
|
|
7590
|
+
} else {
|
|
7591
|
+
t9 = $[33];
|
|
7592
|
+
}
|
|
7593
|
+
let t10;
|
|
7594
|
+
if ($[34] !== t5 || $[35] !== t6 || $[36] !== t9) {
|
|
7595
|
+
t10 = /* @__PURE__ */ jsxs("div", { className: t5, children: [
|
|
7596
|
+
t6,
|
|
7597
|
+
t9
|
|
7598
|
+
] });
|
|
7599
|
+
$[34] = t5;
|
|
7600
|
+
$[35] = t6;
|
|
7601
|
+
$[36] = t9;
|
|
7602
|
+
$[37] = t10;
|
|
7603
|
+
} else {
|
|
7604
|
+
t10 = $[37];
|
|
7605
|
+
}
|
|
7606
|
+
return t10;
|
|
7607
|
+
}
|
|
7608
|
+
if (typeof data === "object" && data !== null) {
|
|
7609
|
+
let t4;
|
|
7610
|
+
if ($[38] !== baseKey || $[39] !== properties) {
|
|
7611
|
+
t4 = baseKey ? buildPropertyLabelAndGetProperty(properties, baseKey) : {
|
|
7612
|
+
label: "",
|
|
7613
|
+
property: void 0
|
|
7614
|
+
};
|
|
7615
|
+
$[38] = baseKey;
|
|
7616
|
+
$[39] = properties;
|
|
7617
|
+
$[40] = t4;
|
|
7618
|
+
} else {
|
|
7619
|
+
t4 = $[40];
|
|
7620
|
+
}
|
|
7621
|
+
const {
|
|
7622
|
+
label,
|
|
7623
|
+
property: property_0
|
|
7624
|
+
} = t4;
|
|
7625
|
+
if (baseKey && (!property_0 || property_0.dataType !== "map" || !property_0.properties)) {
|
|
7626
|
+
if (!property_0) {
|
|
7627
|
+
return null;
|
|
7628
|
+
}
|
|
7629
|
+
const t52 = `grid grid-cols-12 gap-x-4 ${isTopLevel ? "py-4" : "py-2"} items-start ${isTopLevel ? `border-b ${defaultBorderMixin}` : ""}`;
|
|
7630
|
+
let t62;
|
|
7631
|
+
if ($[41] !== label) {
|
|
7632
|
+
t62 = /* @__PURE__ */ jsx("div", { className: "col-span-4 pr-2", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", component: "span", className: "break-words", children: label }) });
|
|
7633
|
+
$[41] = label;
|
|
7634
|
+
$[42] = t62;
|
|
7635
|
+
} else {
|
|
7636
|
+
t62 = $[42];
|
|
7637
|
+
}
|
|
7638
|
+
let t72;
|
|
7639
|
+
if ($[43] !== baseKey || $[44] !== data || $[45] !== property_0 || $[46] !== size) {
|
|
7640
|
+
t72 = /* @__PURE__ */ jsx("div", { className: "col-span-8", children: /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: baseKey, value: data, property: property_0, size }) });
|
|
7641
|
+
$[43] = baseKey;
|
|
7642
|
+
$[44] = data;
|
|
7643
|
+
$[45] = property_0;
|
|
7644
|
+
$[46] = size;
|
|
7645
|
+
$[47] = t72;
|
|
7646
|
+
} else {
|
|
7647
|
+
t72 = $[47];
|
|
7648
|
+
}
|
|
7649
|
+
let t82;
|
|
7650
|
+
if ($[48] !== t52 || $[49] !== t62 || $[50] !== t72) {
|
|
7651
|
+
t82 = /* @__PURE__ */ jsxs("div", { className: t52, children: [
|
|
7652
|
+
t62,
|
|
7653
|
+
t72
|
|
7654
|
+
] });
|
|
7655
|
+
$[48] = t52;
|
|
7656
|
+
$[49] = t62;
|
|
7657
|
+
$[50] = t72;
|
|
7658
|
+
$[51] = t82;
|
|
7659
|
+
} else {
|
|
7660
|
+
t82 = $[51];
|
|
7661
|
+
}
|
|
7662
|
+
return t82;
|
|
7663
|
+
}
|
|
7664
|
+
let t5;
|
|
7665
|
+
if ($[52] !== baseKey || $[53] !== property_0 || $[54] !== suppressHeader) {
|
|
7666
|
+
t5 = baseKey && !suppressHeader && property_0?.dataType === "map" && (property_0.name || !pathEndsWithIndex(baseKey));
|
|
7667
|
+
$[52] = baseKey;
|
|
7668
|
+
$[53] = property_0;
|
|
7669
|
+
$[54] = suppressHeader;
|
|
7670
|
+
$[55] = t5;
|
|
7671
|
+
} else {
|
|
7672
|
+
t5 = $[55];
|
|
7673
|
+
}
|
|
7674
|
+
const showMapHeader = t5;
|
|
7675
|
+
const headerText = property_0?.name || label;
|
|
7676
|
+
const t6 = `${isTopLevel ? "py-4" : "py-1"} ${isTopLevel ? `border-b ${defaultBorderMixin}` : ""}`;
|
|
7677
|
+
let t7;
|
|
7678
|
+
if ($[56] !== headerText || $[57] !== showMapHeader) {
|
|
7679
|
+
t7 = showMapHeader && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", component: "span", children: headerText });
|
|
7680
|
+
$[56] = headerText;
|
|
7681
|
+
$[57] = showMapHeader;
|
|
7682
|
+
$[58] = t7;
|
|
7683
|
+
} else {
|
|
7684
|
+
t7 = $[58];
|
|
7685
|
+
}
|
|
7686
|
+
const t8 = baseKey ? `pl-4 mt-1 border-l ${defaultBorderMixin}` : "";
|
|
7687
|
+
let t9;
|
|
7688
|
+
if ($[59] !== baseKey || $[60] !== data || $[61] !== properties || $[62] !== size) {
|
|
7689
|
+
let t102;
|
|
7690
|
+
if ($[64] !== baseKey || $[65] !== properties || $[66] !== size) {
|
|
7691
|
+
t102 = (t112) => {
|
|
7692
|
+
const [key, value] = t112;
|
|
7693
|
+
if (value === null || value === void 0) {
|
|
7694
|
+
return null;
|
|
7695
|
+
}
|
|
7696
|
+
const currentKey_0 = baseKey ? `${baseKey}.${key}` : key;
|
|
7697
|
+
return /* @__PURE__ */ jsx(PropertyCollectionView, { data: value, properties, baseKey: currentKey_0, size }, currentKey_0);
|
|
7698
|
+
};
|
|
7699
|
+
$[64] = baseKey;
|
|
7700
|
+
$[65] = properties;
|
|
7701
|
+
$[66] = size;
|
|
7702
|
+
$[67] = t102;
|
|
7703
|
+
} else {
|
|
7704
|
+
t102 = $[67];
|
|
7705
|
+
}
|
|
7706
|
+
t9 = Object.entries(data).map(t102);
|
|
7707
|
+
$[59] = baseKey;
|
|
7708
|
+
$[60] = data;
|
|
7709
|
+
$[61] = properties;
|
|
7710
|
+
$[62] = size;
|
|
7711
|
+
$[63] = t9;
|
|
7712
|
+
} else {
|
|
7713
|
+
t9 = $[63];
|
|
7714
|
+
}
|
|
7715
|
+
let t10;
|
|
7716
|
+
if ($[68] !== t8 || $[69] !== t9) {
|
|
7717
|
+
t10 = /* @__PURE__ */ jsx("div", { className: t8, children: t9 });
|
|
7718
|
+
$[68] = t8;
|
|
7719
|
+
$[69] = t9;
|
|
7720
|
+
$[70] = t10;
|
|
7721
|
+
} else {
|
|
7722
|
+
t10 = $[70];
|
|
7723
|
+
}
|
|
7724
|
+
let t11;
|
|
7725
|
+
if ($[71] !== t10 || $[72] !== t6 || $[73] !== t7) {
|
|
7726
|
+
t11 = /* @__PURE__ */ jsxs("div", { className: t6, children: [
|
|
7727
|
+
t7,
|
|
7728
|
+
t10
|
|
7729
|
+
] });
|
|
7730
|
+
$[71] = t10;
|
|
7731
|
+
$[72] = t6;
|
|
7732
|
+
$[73] = t7;
|
|
7733
|
+
$[74] = t11;
|
|
7734
|
+
} else {
|
|
7735
|
+
t11 = $[74];
|
|
7736
|
+
}
|
|
7737
|
+
return t11;
|
|
7738
|
+
}
|
|
7739
|
+
if (baseKey) {
|
|
7740
|
+
let t4;
|
|
7741
|
+
if ($[75] !== baseKey || $[76] !== properties) {
|
|
7742
|
+
t4 = buildPropertyLabelAndGetProperty(properties, baseKey);
|
|
7743
|
+
$[75] = baseKey;
|
|
7744
|
+
$[76] = properties;
|
|
7745
|
+
$[77] = t4;
|
|
7746
|
+
} else {
|
|
7747
|
+
t4 = $[77];
|
|
7748
|
+
}
|
|
7749
|
+
const {
|
|
7750
|
+
label: label_0,
|
|
7751
|
+
property: property_1
|
|
7752
|
+
} = t4;
|
|
7753
|
+
if (!property_1) {
|
|
7754
|
+
return null;
|
|
7755
|
+
}
|
|
7756
|
+
const t5 = `grid grid-cols-12 gap-x-4 ${isTopLevel ? "py-4" : "py-2"} items-start ${isTopLevel ? `border-b ${defaultBorderMixin}` : ""}`;
|
|
7757
|
+
let t6;
|
|
7758
|
+
if ($[78] !== label_0) {
|
|
7759
|
+
t6 = /* @__PURE__ */ jsx("div", { className: "col-span-4 pr-2", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", component: "span", className: "break-words", children: label_0 }) });
|
|
7760
|
+
$[78] = label_0;
|
|
7761
|
+
$[79] = t6;
|
|
7762
|
+
} else {
|
|
7763
|
+
t6 = $[79];
|
|
7764
|
+
}
|
|
7765
|
+
let t7;
|
|
7766
|
+
if ($[80] !== baseKey || $[81] !== data || $[82] !== property_1 || $[83] !== size) {
|
|
7767
|
+
t7 = /* @__PURE__ */ jsx("div", { className: "col-span-8", children: /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: baseKey, value: data, property: property_1, size }) });
|
|
7768
|
+
$[80] = baseKey;
|
|
7769
|
+
$[81] = data;
|
|
7770
|
+
$[82] = property_1;
|
|
7771
|
+
$[83] = size;
|
|
7772
|
+
$[84] = t7;
|
|
7773
|
+
} else {
|
|
7774
|
+
t7 = $[84];
|
|
7775
|
+
}
|
|
7776
|
+
let t8;
|
|
7777
|
+
if ($[85] !== t5 || $[86] !== t6 || $[87] !== t7) {
|
|
7778
|
+
t8 = /* @__PURE__ */ jsxs("div", { className: t5, children: [
|
|
7779
|
+
t6,
|
|
7780
|
+
t7
|
|
7781
|
+
] });
|
|
7782
|
+
$[85] = t5;
|
|
7783
|
+
$[86] = t6;
|
|
7784
|
+
$[87] = t7;
|
|
7785
|
+
$[88] = t8;
|
|
7786
|
+
} else {
|
|
7787
|
+
t8 = $[88];
|
|
7788
|
+
}
|
|
7789
|
+
return t8;
|
|
7790
|
+
}
|
|
7791
|
+
return null;
|
|
7792
|
+
};
|
|
7378
7793
|
function EntityView({
|
|
7379
7794
|
entity,
|
|
7380
7795
|
collection,
|
|
@@ -7392,31 +7807,17 @@ function EntityView({
|
|
|
7392
7807
|
authController
|
|
7393
7808
|
}), [collection, path, entity, customizationController.propertyConfigs]);
|
|
7394
7809
|
const properties = resolvedCollection.properties;
|
|
7395
|
-
return /* @__PURE__ */ jsx("div", { className: "w-full " + className, children: /* @__PURE__ */ jsxs("div", { className: "w-full mb-4", children: [
|
|
7396
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
7397
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
7398
|
-
/* @__PURE__ */
|
|
7810
|
+
return /* @__PURE__ */ jsx("div", { className: "w-full " + className, children: /* @__PURE__ */ jsxs("div", { className: "w-full mb-4 p-4", children: [
|
|
7811
|
+
/* @__PURE__ */ jsxs("div", { className: `grid grid-cols-12 gap-x-4 py-4 items-start border-b ${defaultBorderMixin}`, children: [
|
|
7812
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-4 pr-2", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", component: "span", className: "break-words", children: "Id" }) }),
|
|
7813
|
+
/* @__PURE__ */ jsx("div", { className: "col-span-8", children: /* @__PURE__ */ jsxs("div", { className: "flex-grow text-surface-900 dark:text-white flex items-center", children: [
|
|
7399
7814
|
/* @__PURE__ */ jsx("span", { className: "flex-grow mr-2", children: entity.id }),
|
|
7400
7815
|
customizationController?.entityLinkBuilder && /* @__PURE__ */ jsx("a", { href: customizationController.entityLinkBuilder({
|
|
7401
7816
|
entity
|
|
7402
7817
|
}), rel: "noopener noreferrer", target: "_blank", children: /* @__PURE__ */ jsx(IconButton, { children: /* @__PURE__ */ jsx(OpenInNewIcon, { size: "small" }) }) })
|
|
7403
|
-
] })
|
|
7818
|
+
] }) })
|
|
7404
7819
|
] }),
|
|
7405
|
-
|
|
7406
|
-
const value = entity.values?.[key];
|
|
7407
|
-
return /* @__PURE__ */ jsxs("div", { className: cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0"), children: [
|
|
7408
|
-
/* @__PURE__ */ jsx("div", { className: "flex items-center w-1/4", children: /* @__PURE__ */ jsx("span", { className: "pl-2 text-sm text-surface-600", children: property.name }) }),
|
|
7409
|
-
/* @__PURE__ */ 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__ */ jsx(
|
|
7410
|
-
PropertyPreview,
|
|
7411
|
-
{
|
|
7412
|
-
propertyKey: key,
|
|
7413
|
-
value,
|
|
7414
|
-
property,
|
|
7415
|
-
size: "medium"
|
|
7416
|
-
}
|
|
7417
|
-
) })
|
|
7418
|
-
] }, `reference_previews_${key}`);
|
|
7419
|
-
})
|
|
7820
|
+
/* @__PURE__ */ jsx(PropertyCollectionView, { data: entity.values, properties, size: "medium" })
|
|
7420
7821
|
] }) });
|
|
7421
7822
|
}
|
|
7422
7823
|
function VirtualTableInput(props) {
|
|
@@ -9767,6 +10168,10 @@ function saveEntityToCache(path, data) {
|
|
|
9767
10168
|
try {
|
|
9768
10169
|
const key = LOCAL_STORAGE_PREFIX + path;
|
|
9769
10170
|
const entityString = JSON.stringify(data, customReplacer);
|
|
10171
|
+
console.log("Saving entity to localStorage:", {
|
|
10172
|
+
key,
|
|
10173
|
+
entityString
|
|
10174
|
+
});
|
|
9770
10175
|
localStorage.setItem(key, entityString);
|
|
9771
10176
|
} catch (error) {
|
|
9772
10177
|
console.error(`Failed to save entity for path "${path}" to localStorage:`, error);
|
|
@@ -9789,6 +10194,10 @@ function getEntityFromCache(path) {
|
|
|
9789
10194
|
const entityString = localStorage.getItem(key);
|
|
9790
10195
|
if (entityString) {
|
|
9791
10196
|
const entity = JSON.parse(entityString, customReviver);
|
|
10197
|
+
console.log("Loaded entity from localStorage:", {
|
|
10198
|
+
key,
|
|
10199
|
+
entity
|
|
10200
|
+
});
|
|
9792
10201
|
return entity;
|
|
9793
10202
|
}
|
|
9794
10203
|
} catch (error) {
|
|
@@ -9807,6 +10216,26 @@ function removeEntityFromCache(path) {
|
|
|
9807
10216
|
}
|
|
9808
10217
|
}
|
|
9809
10218
|
}
|
|
10219
|
+
function flattenKeys(obj, prefix = "", result = []) {
|
|
10220
|
+
if (isObject(obj) || Array.isArray(obj)) {
|
|
10221
|
+
const plainObject = isPlainObject(obj);
|
|
10222
|
+
if (!plainObject && prefix) {
|
|
10223
|
+
result.push(prefix);
|
|
10224
|
+
} else {
|
|
10225
|
+
for (const key in obj) {
|
|
10226
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
10227
|
+
const newKey = prefix ? Array.isArray(obj) ? `${prefix}[${key}]` : `${prefix}.${key}` : key;
|
|
10228
|
+
if (isObject(obj[key]) || Array.isArray(obj[key])) {
|
|
10229
|
+
flattenKeys(obj[key], newKey, result);
|
|
10230
|
+
} else {
|
|
10231
|
+
result.push(newKey);
|
|
10232
|
+
}
|
|
10233
|
+
}
|
|
10234
|
+
}
|
|
10235
|
+
}
|
|
10236
|
+
}
|
|
10237
|
+
return result;
|
|
10238
|
+
}
|
|
9810
10239
|
const EntityCollectionRowActions = function EntityCollectionRowActions2({
|
|
9811
10240
|
entity,
|
|
9812
10241
|
collection,
|
|
@@ -15171,7 +15600,7 @@ function buildSideActions$1({
|
|
|
15171
15600
|
] });
|
|
15172
15601
|
}
|
|
15173
15602
|
function LocalChangesMenu(t0) {
|
|
15174
|
-
const $ = c(
|
|
15603
|
+
const $ = c(42);
|
|
15175
15604
|
const {
|
|
15176
15605
|
localChangesData,
|
|
15177
15606
|
formex,
|
|
@@ -15184,9 +15613,7 @@ function LocalChangesMenu(t0) {
|
|
|
15184
15613
|
const [open, setOpen] = useState(false);
|
|
15185
15614
|
let t1;
|
|
15186
15615
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15187
|
-
t1 = () =>
|
|
15188
|
-
setOpen(true);
|
|
15189
|
-
};
|
|
15616
|
+
t1 = () => setOpen(true);
|
|
15190
15617
|
$[0] = t1;
|
|
15191
15618
|
} else {
|
|
15192
15619
|
t1 = $[0];
|
|
@@ -15194,9 +15621,7 @@ function LocalChangesMenu(t0) {
|
|
|
15194
15621
|
const handleOpenMenu = t1;
|
|
15195
15622
|
let t2;
|
|
15196
15623
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15197
|
-
t2 = () =>
|
|
15198
|
-
setOpen(false);
|
|
15199
|
-
};
|
|
15624
|
+
t2 = () => setOpen(false);
|
|
15200
15625
|
$[1] = t2;
|
|
15201
15626
|
} else {
|
|
15202
15627
|
t2 = $[1];
|
|
@@ -15220,8 +15645,8 @@ function LocalChangesMenu(t0) {
|
|
|
15220
15645
|
const touched = {
|
|
15221
15646
|
...formex.touched
|
|
15222
15647
|
};
|
|
15223
|
-
const
|
|
15224
|
-
|
|
15648
|
+
const previewKeys = flattenKeys(localChangesData);
|
|
15649
|
+
previewKeys.forEach((key) => {
|
|
15225
15650
|
touched[key] = true;
|
|
15226
15651
|
});
|
|
15227
15652
|
formex.setTouched(touched);
|
|
@@ -15281,7 +15706,7 @@ function LocalChangesMenu(t0) {
|
|
|
15281
15706
|
}
|
|
15282
15707
|
let t8;
|
|
15283
15708
|
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15284
|
-
t8 = /* @__PURE__ */ 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." });
|
|
15709
|
+
t8 = /* @__PURE__ */ 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." });
|
|
15285
15710
|
$[14] = t8;
|
|
15286
15711
|
} else {
|
|
15287
15712
|
t8 = $[14];
|
|
@@ -15359,83 +15784,76 @@ function LocalChangesMenu(t0) {
|
|
|
15359
15784
|
t16 = $[27];
|
|
15360
15785
|
}
|
|
15361
15786
|
let t17;
|
|
15362
|
-
if ($[28]
|
|
15363
|
-
t17 =
|
|
15364
|
-
|
|
15365
|
-
|
|
15366
|
-
|
|
15367
|
-
|
|
15368
|
-
}
|
|
15369
|
-
return /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-x-4 px-4 py-3 items-center", children: [
|
|
15370
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-3 text-right", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "text-gray-500 dark:text-gray-400 break-words", children: property.name || key_0 }) }),
|
|
15371
|
-
/* @__PURE__ */ jsx("div", { className: "col-span-9", children: /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: key_0, value, property, size: "small" }) })
|
|
15372
|
-
] }, key_0);
|
|
15373
|
-
});
|
|
15374
|
-
$[28] = localChangesData;
|
|
15375
|
-
$[29] = properties;
|
|
15376
|
-
$[30] = t17;
|
|
15787
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15788
|
+
t17 = {
|
|
15789
|
+
maxHeight: 520,
|
|
15790
|
+
overflow: "auto"
|
|
15791
|
+
};
|
|
15792
|
+
$[28] = t17;
|
|
15377
15793
|
} else {
|
|
15378
|
-
t17 = $[
|
|
15794
|
+
t17 = $[28];
|
|
15379
15795
|
}
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15796
|
+
const t18 = properties;
|
|
15797
|
+
let t19;
|
|
15798
|
+
if ($[29] !== localChangesData || $[30] !== t18) {
|
|
15799
|
+
t19 = /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
15383
15800
|
t15,
|
|
15384
15801
|
t16,
|
|
15385
|
-
/* @__PURE__ */ jsx("div", { className: `border rounded-lg
|
|
15802
|
+
/* @__PURE__ */ jsx("div", { className: `border rounded-lg ${defaultBorderMixin}`, style: t17, children: /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsx(PropertyCollectionView, { data: localChangesData, properties: t18 }) }) })
|
|
15386
15803
|
] });
|
|
15387
|
-
$[
|
|
15388
|
-
$[
|
|
15804
|
+
$[29] = localChangesData;
|
|
15805
|
+
$[30] = t18;
|
|
15806
|
+
$[31] = t19;
|
|
15389
15807
|
} else {
|
|
15390
|
-
|
|
15808
|
+
t19 = $[31];
|
|
15391
15809
|
}
|
|
15392
|
-
let
|
|
15393
|
-
if ($[
|
|
15394
|
-
|
|
15395
|
-
$[
|
|
15810
|
+
let t20;
|
|
15811
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15812
|
+
t20 = /* @__PURE__ */ jsx(Button, { onClick: () => setPreviewDialogOpen(false), children: "Close" });
|
|
15813
|
+
$[32] = t20;
|
|
15396
15814
|
} else {
|
|
15397
|
-
|
|
15815
|
+
t20 = $[32];
|
|
15398
15816
|
}
|
|
15399
|
-
let
|
|
15400
|
-
if ($[
|
|
15401
|
-
|
|
15402
|
-
|
|
15817
|
+
let t21;
|
|
15818
|
+
if ($[33] !== handleApply) {
|
|
15819
|
+
t21 = /* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
15820
|
+
t20,
|
|
15403
15821
|
/* @__PURE__ */ jsx(Button, { variant: "filled", onClick: () => {
|
|
15404
15822
|
handleApply();
|
|
15405
15823
|
setPreviewDialogOpen(false);
|
|
15406
15824
|
}, children: "Apply changes" })
|
|
15407
15825
|
] });
|
|
15408
|
-
$[
|
|
15409
|
-
$[
|
|
15826
|
+
$[33] = handleApply;
|
|
15827
|
+
$[34] = t21;
|
|
15410
15828
|
} else {
|
|
15411
|
-
|
|
15829
|
+
t21 = $[34];
|
|
15412
15830
|
}
|
|
15413
|
-
let
|
|
15414
|
-
if ($[
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
|
|
15831
|
+
let t22;
|
|
15832
|
+
if ($[35] !== previewDialogOpen || $[36] !== t19 || $[37] !== t21) {
|
|
15833
|
+
t22 = /* @__PURE__ */ jsxs(Dialog, { open: previewDialogOpen, onOpenChange: setPreviewDialogOpen, maxWidth: "4xl", children: [
|
|
15834
|
+
t19,
|
|
15835
|
+
t21
|
|
15418
15836
|
] });
|
|
15419
|
-
$[
|
|
15420
|
-
$[
|
|
15421
|
-
$[
|
|
15422
|
-
$[
|
|
15837
|
+
$[35] = previewDialogOpen;
|
|
15838
|
+
$[36] = t19;
|
|
15839
|
+
$[37] = t21;
|
|
15840
|
+
$[38] = t22;
|
|
15423
15841
|
} else {
|
|
15424
|
-
|
|
15842
|
+
t22 = $[38];
|
|
15425
15843
|
}
|
|
15426
|
-
let
|
|
15427
|
-
if ($[
|
|
15428
|
-
|
|
15844
|
+
let t23;
|
|
15845
|
+
if ($[39] !== t14 || $[40] !== t22) {
|
|
15846
|
+
t23 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15429
15847
|
t14,
|
|
15430
|
-
|
|
15848
|
+
t22
|
|
15431
15849
|
] });
|
|
15432
|
-
$[
|
|
15433
|
-
$[
|
|
15434
|
-
$[
|
|
15850
|
+
$[39] = t14;
|
|
15851
|
+
$[40] = t22;
|
|
15852
|
+
$[41] = t23;
|
|
15435
15853
|
} else {
|
|
15436
|
-
|
|
15854
|
+
t23 = $[41];
|
|
15437
15855
|
}
|
|
15438
|
-
return
|
|
15856
|
+
return t23;
|
|
15439
15857
|
}
|
|
15440
15858
|
function extractTouchedValues(values, touched) {
|
|
15441
15859
|
let acc = {};
|
|
@@ -15449,6 +15867,56 @@ function extractTouchedValues(values, touched) {
|
|
|
15449
15867
|
});
|
|
15450
15868
|
return acc;
|
|
15451
15869
|
}
|
|
15870
|
+
function getChanges(source, comparison) {
|
|
15871
|
+
const changes = {};
|
|
15872
|
+
if (!source) {
|
|
15873
|
+
return {};
|
|
15874
|
+
}
|
|
15875
|
+
if (!comparison) {
|
|
15876
|
+
return source;
|
|
15877
|
+
}
|
|
15878
|
+
const allKeys = Array.from(/* @__PURE__ */ new Set([...Object.keys(source), ...Object.keys(comparison)]));
|
|
15879
|
+
for (const key of allKeys) {
|
|
15880
|
+
const sourceValue = source[key];
|
|
15881
|
+
const comparisonValue = comparison[key];
|
|
15882
|
+
if (equal(sourceValue, comparisonValue)) {
|
|
15883
|
+
continue;
|
|
15884
|
+
}
|
|
15885
|
+
const sourceHasKey = source && typeof source === "object" && Object.prototype.hasOwnProperty.call(source, key);
|
|
15886
|
+
const comparisonHasKey = comparison && typeof comparison === "object" && Object.prototype.hasOwnProperty.call(comparison, key);
|
|
15887
|
+
if (comparisonHasKey && !sourceHasKey) {
|
|
15888
|
+
changes[key] = void 0;
|
|
15889
|
+
} else if (Array.isArray(sourceValue)) {
|
|
15890
|
+
const comparisonArray = Array.isArray(comparisonValue) ? comparisonValue : [];
|
|
15891
|
+
if (sourceValue.length < comparisonArray.length) {
|
|
15892
|
+
changes[key] = sourceValue;
|
|
15893
|
+
continue;
|
|
15894
|
+
}
|
|
15895
|
+
const changedArray = sourceValue.map((item, index) => {
|
|
15896
|
+
const comparisonItem = comparisonArray[index];
|
|
15897
|
+
if (equal(item, comparisonItem)) {
|
|
15898
|
+
return null;
|
|
15899
|
+
}
|
|
15900
|
+
if (isObject(item) && item && isObject(comparisonItem) && comparisonItem) {
|
|
15901
|
+
const nestedChanges = getChanges(item, comparisonItem);
|
|
15902
|
+
return Object.keys(nestedChanges).length > 0 ? nestedChanges : item;
|
|
15903
|
+
}
|
|
15904
|
+
return item;
|
|
15905
|
+
});
|
|
15906
|
+
if (changedArray.some((item) => item !== null) || sourceValue.length > comparisonArray.length) {
|
|
15907
|
+
changes[key] = changedArray;
|
|
15908
|
+
}
|
|
15909
|
+
} else if (isObject(sourceValue) && sourceValue && isObject(comparisonValue) && comparisonValue) {
|
|
15910
|
+
const nestedChanges = getChanges(sourceValue, comparisonValue);
|
|
15911
|
+
if (Object.keys(nestedChanges).length > 0) {
|
|
15912
|
+
changes[key] = nestedChanges;
|
|
15913
|
+
}
|
|
15914
|
+
} else {
|
|
15915
|
+
changes[key] = sourceValue;
|
|
15916
|
+
}
|
|
15917
|
+
}
|
|
15918
|
+
return changes;
|
|
15919
|
+
}
|
|
15452
15920
|
function EntityForm({
|
|
15453
15921
|
path,
|
|
15454
15922
|
fullIdPath,
|
|
@@ -15570,16 +16038,7 @@ function EntityForm({
|
|
|
15570
16038
|
if (!localChangesDataRaw) {
|
|
15571
16039
|
return void 0;
|
|
15572
16040
|
}
|
|
15573
|
-
|
|
15574
|
-
const flattenedKeys = flattenKeys(localChangesDataRaw);
|
|
15575
|
-
flattenedKeys.forEach((key) => {
|
|
15576
|
-
const localValue = getIn(localChangesDataRaw, key);
|
|
15577
|
-
const initialValue = getIn(initialValues_0, key);
|
|
15578
|
-
if (!equal(localValue, initialValue)) {
|
|
15579
|
-
filteredChanges = setIn(filteredChanges, key, localValue);
|
|
15580
|
-
}
|
|
15581
|
-
});
|
|
15582
|
-
return filteredChanges;
|
|
16041
|
+
return getChanges(localChangesDataRaw, initialValues_0);
|
|
15583
16042
|
}, [localChangesDataRaw, initialValues_0]);
|
|
15584
16043
|
const hasLocalChanges = !localChangesCleared && localChangesData && Object.keys(localChangesData).length > 0;
|
|
15585
16044
|
const formex = formexProp ?? useCreateFormex({
|
|
@@ -15595,10 +16054,10 @@ function EntityForm({
|
|
|
15595
16054
|
onValuesModified?.(false, initialValues_0);
|
|
15596
16055
|
},
|
|
15597
16056
|
onValuesChangeDeferred: (values_0, controller) => {
|
|
15598
|
-
const
|
|
16057
|
+
const key = status === "new" || status === "copy" ? path + "#new" : path + "/" + entityId;
|
|
15599
16058
|
if (controller.dirty) {
|
|
15600
16059
|
const touchedValues = extractTouchedValues(values_0, controller.touched);
|
|
15601
|
-
saveEntityToCache(
|
|
16060
|
+
saveEntityToCache(key, touchedValues);
|
|
15602
16061
|
}
|
|
15603
16062
|
},
|
|
15604
16063
|
validation: (values_1) => {
|
|
@@ -15832,11 +16291,11 @@ function EntityForm({
|
|
|
15832
16291
|
useOnAutoSave(autoSave, formex, lastSavedValues, save);
|
|
15833
16292
|
useEffect(() => {
|
|
15834
16293
|
if (!autoSave && !formex.isSubmitting && underlyingChanges && entity) {
|
|
15835
|
-
Object.entries(underlyingChanges).forEach(([
|
|
15836
|
-
const formValue = formex.values[
|
|
15837
|
-
if (!equal(value_0, formValue) && !formex.touched[
|
|
15838
|
-
console.debug("Updated value from the datasource:",
|
|
15839
|
-
formex.setFieldValue(
|
|
16294
|
+
Object.entries(underlyingChanges).forEach(([key_0, value_0]) => {
|
|
16295
|
+
const formValue = formex.values[key_0];
|
|
16296
|
+
if (!equal(value_0, formValue) && !formex.touched[key_0]) {
|
|
16297
|
+
console.debug("Updated value from the datasource:", key_0, value_0);
|
|
16298
|
+
formex.setFieldValue(key_0, value_0 !== void 0 ? value_0 : null);
|
|
15840
16299
|
}
|
|
15841
16300
|
});
|
|
15842
16301
|
}
|
|
@@ -15846,16 +16305,16 @@ function EntityForm({
|
|
|
15846
16305
|
if (Builder) {
|
|
15847
16306
|
return /* @__PURE__ */ jsx(Builder, { collection, entity, modifiedValues: formex.values, formContext });
|
|
15848
16307
|
}
|
|
15849
|
-
return /* @__PURE__ */ jsx(FormLayout, { children: formFieldKeys.map((
|
|
15850
|
-
const property = resolvedCollection.properties[
|
|
16308
|
+
return /* @__PURE__ */ jsx(FormLayout, { children: formFieldKeys.map((key_1) => {
|
|
16309
|
+
const property = resolvedCollection.properties[key_1];
|
|
15851
16310
|
if (property) {
|
|
15852
|
-
const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(
|
|
16311
|
+
const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(key_1) && formex.touched[key_1];
|
|
15853
16312
|
const disabled_0 = disabledProp || !autoSave && formex.isSubmitting || isReadOnly(property) || Boolean(property.disabled);
|
|
15854
16313
|
const hidden = isHidden(property);
|
|
15855
16314
|
if (hidden) return null;
|
|
15856
16315
|
const widthPercentage = property.widthPercentage ?? 100;
|
|
15857
16316
|
const cmsFormFieldProps = {
|
|
15858
|
-
propertyKey:
|
|
16317
|
+
propertyKey: key_1,
|
|
15859
16318
|
disabled: disabled_0,
|
|
15860
16319
|
property,
|
|
15861
16320
|
includeDescription: property.description || property.longDescription,
|
|
@@ -15865,9 +16324,9 @@ function EntityForm({
|
|
|
15865
16324
|
minimalistView: false,
|
|
15866
16325
|
autoFocus: false
|
|
15867
16326
|
};
|
|
15868
|
-
return /* @__PURE__ */ jsx(FormEntry, { propertyKey:
|
|
16327
|
+
return /* @__PURE__ */ jsx(FormEntry, { propertyKey: key_1, widthPercentage, children: /* @__PURE__ */ jsx(PropertyFieldBinding, { ...cmsFormFieldProps }) }, `field_${key_1}`);
|
|
15869
16328
|
}
|
|
15870
|
-
const additionalField = resolvedCollection.additionalFields?.find((f) => f.key ===
|
|
16329
|
+
const additionalField = resolvedCollection.additionalFields?.find((f) => f.key === key_1);
|
|
15871
16330
|
if (additionalField && entity) {
|
|
15872
16331
|
const Builder_0 = additionalField.Builder;
|
|
15873
16332
|
if (!Builder_0 && !additionalField.value) {
|
|
@@ -15878,11 +16337,11 @@ function EntityForm({
|
|
|
15878
16337
|
context
|
|
15879
16338
|
})?.toString() });
|
|
15880
16339
|
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
15881
|
-
/* @__PURE__ */ jsx(LabelWithIconAndTooltip, { propertyKey:
|
|
16340
|
+
/* @__PURE__ */ jsx(LabelWithIconAndTooltip, { propertyKey: key_1, icon: /* @__PURE__ */ jsx(NotesIcon, { size: "small" }), title: additionalField.name, className: "text-text-secondary dark:text-text-secondary-dark ml-3.5" }),
|
|
15882
16341
|
/* @__PURE__ */ jsx("div", { className: cls(paperMixin, "w-full min-h-14 p-4 md:p-6 overflow-x-scroll no-scrollbar"), children: /* @__PURE__ */ jsx(ErrorBoundary, { children: child }) })
|
|
15883
|
-
] }, `additional_${
|
|
16342
|
+
] }, `additional_${key_1}`);
|
|
15884
16343
|
}
|
|
15885
|
-
console.warn(`Property ${
|
|
16344
|
+
console.warn(`Property ${key_1} not found in collection ${resolvedCollection.name} in properties or additional fields. Skipping.`);
|
|
15886
16345
|
return null;
|
|
15887
16346
|
}).filter(Boolean) });
|
|
15888
16347
|
};
|
|
@@ -26559,6 +27018,7 @@ export {
|
|
|
26559
27018
|
isEnumValueDisabled,
|
|
26560
27019
|
isHidden,
|
|
26561
27020
|
isObject,
|
|
27021
|
+
isPlainObject,
|
|
26562
27022
|
isPropertyBuilder,
|
|
26563
27023
|
isReadOnly,
|
|
26564
27024
|
isReferenceProperty,
|