@firecms/core 3.0.0-canary.287 → 3.0.0-canary.289
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 +624 -158
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +630 -164
- 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/EntityCollectionTable/EntityCollectionRowActions.tsx +44 -47
- 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/MapPropertyPreview.tsx +2 -2
- 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
|
@@ -2,10 +2,10 @@ import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import React__default, { useRef, useEffect, useContext, useCallback, useMemo, useState, createElement, createRef, createContext, forwardRef, useLayoutEffect } from "react";
|
|
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,
|
|
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, Badge, CircularProgress, SearchBar, 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);
|
|
@@ -6644,7 +6672,7 @@ function MapPropertyPreview(t0) {
|
|
|
6644
6672
|
const isArrayOrMap = childProperty.dataType === "map" || childProperty === "array";
|
|
6645
6673
|
return /* @__PURE__ */ jsxs("div", { className: cls(defaultBorderMixin, "last:border-b-0 border-b"), children: [
|
|
6646
6674
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row pt-0.5 pb-0.5 gap-2", children: [
|
|
6647
|
-
/* @__PURE__ */ jsx("div", { className: "min-w-[140px] w-[25%] py-1", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "
|
|
6675
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-[140px] w-[25%] py-1", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "break-words font-semibold", color: "secondary", children: childProperty.name }) }),
|
|
6648
6676
|
/* @__PURE__ */ jsx("div", { className: "flex-grow max-w-[75%]", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: !isArrayOrMap && /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: key_0, value: value[key_0], property: childProperty, size }) }) })
|
|
6649
6677
|
] }),
|
|
6650
6678
|
isArrayOrMap && /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "border-l pl-4 ml-2 my-2"), children: /* @__PURE__ */ jsx(PropertyPreview, { propertyKey: key_0, value: value[key_0], property: childProperty, size }) })
|
|
@@ -6700,7 +6728,7 @@ function _temp$o(t0) {
|
|
|
6700
6728
|
const [key, childValue] = t0;
|
|
6701
6729
|
return /* @__PURE__ */ jsxs("div", { className: cls(defaultBorderMixin, "last:border-b-0 border-b"), children: [
|
|
6702
6730
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-row pt-0.5 pb-0.5 gap-2", children: [
|
|
6703
|
-
/* @__PURE__ */ jsx("div", { className: "min-w-[140px] w-[25%] py-1", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-
|
|
6731
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-[140px] w-[25%] py-1", children: /* @__PURE__ */ jsx(Typography, { variant: "caption", className: "font-semibold break-words", color: "secondary", children: key }) }, `table-cell-title-${key}-${key}`),
|
|
6704
6732
|
/* @__PURE__ */ jsx("div", { className: "flex-grow max-w-[75%]", children: childValue && typeof childValue !== "object" && /* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(ErrorBoundary, { children: childValue.toString() }) }) })
|
|
6705
6733
|
] }),
|
|
6706
6734
|
typeof childValue === "object" && /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "border-l pl-4"), children: /* @__PURE__ */ jsx(KeyValuePreview, { value: childValue }) })
|
|
@@ -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,
|
|
@@ -9836,6 +10265,7 @@ const EntityCollectionRowActions = function EntityCollectionRowActions2({
|
|
|
9836
10265
|
const uncollapsedActions = actions.filter((a_1) => a_1.collapsed === false);
|
|
9837
10266
|
const enableLocalChangesBackup = collection ? getLocalChangesBackup(collection) : false;
|
|
9838
10267
|
const hasDraft = enableLocalChangesBackup ? getEntityFromCache(fullPath + "/" + entity.id) : false;
|
|
10268
|
+
const iconSize = largeLayout && (size === "m" || size === "l" || size == "xl") ? "medium" : "small";
|
|
9839
10269
|
return /* @__PURE__ */ jsxs("div", { className: cls("h-full flex items-center justify-center flex-col bg-surface-50 dark:bg-surface-900 bg-opacity-90 dark:bg-opacity-90 z-10", frozen ? "sticky left-0" : ""), onClick: useCallback((event) => {
|
|
9840
10270
|
event.stopPropagation();
|
|
9841
10271
|
}, []), style: {
|
|
@@ -9845,23 +10275,31 @@ const EntityCollectionRowActions = function EntityCollectionRowActions2({
|
|
|
9845
10275
|
contain: "strict"
|
|
9846
10276
|
}, children: [
|
|
9847
10277
|
(hasActions || selectionEnabled) && /* @__PURE__ */ jsxs("div", { className: "w-34 flex justify-center", children: [
|
|
9848
|
-
uncollapsedActions.map((action, index) =>
|
|
9849
|
-
|
|
9850
|
-
action.
|
|
9851
|
-
|
|
9852
|
-
|
|
9853
|
-
|
|
9854
|
-
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9860
|
-
|
|
9861
|
-
|
|
9862
|
-
|
|
9863
|
-
|
|
9864
|
-
|
|
10278
|
+
uncollapsedActions.map((action, index) => {
|
|
10279
|
+
const isEditAction = action.key === "edit";
|
|
10280
|
+
const tooltip = isEditAction && hasDraft ? "Local unsaved changes" : action.name;
|
|
10281
|
+
let iconButton = /* @__PURE__ */ jsx(IconButton, { onClick: (event_0) => {
|
|
10282
|
+
event_0.stopPropagation();
|
|
10283
|
+
action.onClick({
|
|
10284
|
+
view: "collection",
|
|
10285
|
+
entity,
|
|
10286
|
+
fullPath,
|
|
10287
|
+
fullIdPath,
|
|
10288
|
+
collection,
|
|
10289
|
+
context,
|
|
10290
|
+
selectionController,
|
|
10291
|
+
highlightEntity,
|
|
10292
|
+
unhighlightEntity,
|
|
10293
|
+
onCollectionChange,
|
|
10294
|
+
openEntityMode: openEntityMode ?? collection?.openEntityMode
|
|
10295
|
+
});
|
|
10296
|
+
}, size: iconSize, children: action.icon });
|
|
10297
|
+
if (isEditAction && hasDraft) {
|
|
10298
|
+
iconButton = /* @__PURE__ */ jsx(Badge, { color: "warning", children: iconButton });
|
|
10299
|
+
}
|
|
10300
|
+
return /* @__PURE__ */ jsx(Tooltip, { title: tooltip, asChild: true, children: iconButton }, index);
|
|
10301
|
+
}),
|
|
10302
|
+
hasCollapsedActions && /* @__PURE__ */ jsx(Menu, { trigger: /* @__PURE__ */ jsx(IconButton, { size: iconSize, children: /* @__PURE__ */ jsx(MoreVertIcon, {}) }), children: collapsedActions.map((action_0, index_0) => /* @__PURE__ */ jsxs(MenuItem, { onClick: (e) => {
|
|
9865
10303
|
e.stopPropagation();
|
|
9866
10304
|
action_0.onClick({
|
|
9867
10305
|
view: "collection",
|
|
@@ -9880,14 +10318,11 @@ const EntityCollectionRowActions = function EntityCollectionRowActions2({
|
|
|
9880
10318
|
action_0.icon,
|
|
9881
10319
|
action_0.name
|
|
9882
10320
|
] }, index_0)) }),
|
|
9883
|
-
selectionEnabled && /* @__PURE__ */ jsx(Tooltip, { title: `Select ${entity.id}`, children: /* @__PURE__ */ jsx(Checkbox, { size:
|
|
10321
|
+
selectionEnabled && /* @__PURE__ */ jsx(Tooltip, { title: `Select ${entity.id}`, children: /* @__PURE__ */ jsx(Checkbox, { size: iconSize, checked: Boolean(isSelected), onCheckedChange }) })
|
|
9884
10322
|
] }),
|
|
9885
|
-
!hideId && size !== "xs" && /* @__PURE__ */
|
|
10323
|
+
!hideId && size !== "xs" && /* @__PURE__ */ jsx("div", { className: "w-[138px] overflow-hidden truncate font-mono text-xs text-text-secondary dark:text-text-secondary-dark max-w-full text-ellipsis px-2 align-center justify-center flex items-center gap-1", onClick: (event_1) => {
|
|
9886
10324
|
event_1.stopPropagation();
|
|
9887
|
-
}, children:
|
|
9888
|
-
hasDraft && /* @__PURE__ */ jsx(Tooltip, { title: "Local unsaved changes", className: "inline", children: /* @__PURE__ */ jsx(Chip, { colorScheme: "orangeDarker", className: "p-0.5", children: /* @__PURE__ */ jsx(EditIcon, { size: 12 }) }) }),
|
|
9889
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-center", children: entity ? entity.id : /* @__PURE__ */ jsx(Skeleton, {}) })
|
|
9890
|
-
] })
|
|
10325
|
+
}, children: /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate text-center", children: entity ? entity.id : /* @__PURE__ */ jsx(Skeleton, {}) }) })
|
|
9891
10326
|
] });
|
|
9892
10327
|
};
|
|
9893
10328
|
function CollectionTableToolbar(t0) {
|
|
@@ -15171,7 +15606,7 @@ function buildSideActions$1({
|
|
|
15171
15606
|
] });
|
|
15172
15607
|
}
|
|
15173
15608
|
function LocalChangesMenu(t0) {
|
|
15174
|
-
const $ = c(
|
|
15609
|
+
const $ = c(42);
|
|
15175
15610
|
const {
|
|
15176
15611
|
localChangesData,
|
|
15177
15612
|
formex,
|
|
@@ -15184,9 +15619,7 @@ function LocalChangesMenu(t0) {
|
|
|
15184
15619
|
const [open, setOpen] = useState(false);
|
|
15185
15620
|
let t1;
|
|
15186
15621
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15187
|
-
t1 = () =>
|
|
15188
|
-
setOpen(true);
|
|
15189
|
-
};
|
|
15622
|
+
t1 = () => setOpen(true);
|
|
15190
15623
|
$[0] = t1;
|
|
15191
15624
|
} else {
|
|
15192
15625
|
t1 = $[0];
|
|
@@ -15194,9 +15627,7 @@ function LocalChangesMenu(t0) {
|
|
|
15194
15627
|
const handleOpenMenu = t1;
|
|
15195
15628
|
let t2;
|
|
15196
15629
|
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15197
|
-
t2 = () =>
|
|
15198
|
-
setOpen(false);
|
|
15199
|
-
};
|
|
15630
|
+
t2 = () => setOpen(false);
|
|
15200
15631
|
$[1] = t2;
|
|
15201
15632
|
} else {
|
|
15202
15633
|
t2 = $[1];
|
|
@@ -15220,8 +15651,8 @@ function LocalChangesMenu(t0) {
|
|
|
15220
15651
|
const touched = {
|
|
15221
15652
|
...formex.touched
|
|
15222
15653
|
};
|
|
15223
|
-
const
|
|
15224
|
-
|
|
15654
|
+
const previewKeys = flattenKeys(localChangesData);
|
|
15655
|
+
previewKeys.forEach((key) => {
|
|
15225
15656
|
touched[key] = true;
|
|
15226
15657
|
});
|
|
15227
15658
|
formex.setTouched(touched);
|
|
@@ -15281,7 +15712,7 @@ function LocalChangesMenu(t0) {
|
|
|
15281
15712
|
}
|
|
15282
15713
|
let t8;
|
|
15283
15714
|
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." });
|
|
15715
|
+
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
15716
|
$[14] = t8;
|
|
15286
15717
|
} else {
|
|
15287
15718
|
t8 = $[14];
|
|
@@ -15359,83 +15790,76 @@ function LocalChangesMenu(t0) {
|
|
|
15359
15790
|
t16 = $[27];
|
|
15360
15791
|
}
|
|
15361
15792
|
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;
|
|
15793
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15794
|
+
t17 = {
|
|
15795
|
+
maxHeight: 520,
|
|
15796
|
+
overflow: "auto"
|
|
15797
|
+
};
|
|
15798
|
+
$[28] = t17;
|
|
15377
15799
|
} else {
|
|
15378
|
-
t17 = $[
|
|
15800
|
+
t17 = $[28];
|
|
15379
15801
|
}
|
|
15380
|
-
|
|
15381
|
-
|
|
15382
|
-
|
|
15802
|
+
const t18 = properties;
|
|
15803
|
+
let t19;
|
|
15804
|
+
if ($[29] !== localChangesData || $[30] !== t18) {
|
|
15805
|
+
t19 = /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
15383
15806
|
t15,
|
|
15384
15807
|
t16,
|
|
15385
|
-
/* @__PURE__ */ jsx("div", { className: `border rounded-lg
|
|
15808
|
+
/* @__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
15809
|
] });
|
|
15387
|
-
$[
|
|
15388
|
-
$[
|
|
15810
|
+
$[29] = localChangesData;
|
|
15811
|
+
$[30] = t18;
|
|
15812
|
+
$[31] = t19;
|
|
15389
15813
|
} else {
|
|
15390
|
-
|
|
15814
|
+
t19 = $[31];
|
|
15391
15815
|
}
|
|
15392
|
-
let
|
|
15393
|
-
if ($[
|
|
15394
|
-
|
|
15395
|
-
$[
|
|
15816
|
+
let t20;
|
|
15817
|
+
if ($[32] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15818
|
+
t20 = /* @__PURE__ */ jsx(Button, { onClick: () => setPreviewDialogOpen(false), children: "Close" });
|
|
15819
|
+
$[32] = t20;
|
|
15396
15820
|
} else {
|
|
15397
|
-
|
|
15821
|
+
t20 = $[32];
|
|
15398
15822
|
}
|
|
15399
|
-
let
|
|
15400
|
-
if ($[
|
|
15401
|
-
|
|
15402
|
-
|
|
15823
|
+
let t21;
|
|
15824
|
+
if ($[33] !== handleApply) {
|
|
15825
|
+
t21 = /* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
15826
|
+
t20,
|
|
15403
15827
|
/* @__PURE__ */ jsx(Button, { variant: "filled", onClick: () => {
|
|
15404
15828
|
handleApply();
|
|
15405
15829
|
setPreviewDialogOpen(false);
|
|
15406
15830
|
}, children: "Apply changes" })
|
|
15407
15831
|
] });
|
|
15408
|
-
$[
|
|
15409
|
-
$[
|
|
15832
|
+
$[33] = handleApply;
|
|
15833
|
+
$[34] = t21;
|
|
15410
15834
|
} else {
|
|
15411
|
-
|
|
15835
|
+
t21 = $[34];
|
|
15412
15836
|
}
|
|
15413
|
-
let
|
|
15414
|
-
if ($[
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
|
|
15837
|
+
let t22;
|
|
15838
|
+
if ($[35] !== previewDialogOpen || $[36] !== t19 || $[37] !== t21) {
|
|
15839
|
+
t22 = /* @__PURE__ */ jsxs(Dialog, { open: previewDialogOpen, onOpenChange: setPreviewDialogOpen, maxWidth: "4xl", children: [
|
|
15840
|
+
t19,
|
|
15841
|
+
t21
|
|
15418
15842
|
] });
|
|
15419
|
-
$[
|
|
15420
|
-
$[
|
|
15421
|
-
$[
|
|
15422
|
-
$[
|
|
15843
|
+
$[35] = previewDialogOpen;
|
|
15844
|
+
$[36] = t19;
|
|
15845
|
+
$[37] = t21;
|
|
15846
|
+
$[38] = t22;
|
|
15423
15847
|
} else {
|
|
15424
|
-
|
|
15848
|
+
t22 = $[38];
|
|
15425
15849
|
}
|
|
15426
|
-
let
|
|
15427
|
-
if ($[
|
|
15428
|
-
|
|
15850
|
+
let t23;
|
|
15851
|
+
if ($[39] !== t14 || $[40] !== t22) {
|
|
15852
|
+
t23 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15429
15853
|
t14,
|
|
15430
|
-
|
|
15854
|
+
t22
|
|
15431
15855
|
] });
|
|
15432
|
-
$[
|
|
15433
|
-
$[
|
|
15434
|
-
$[
|
|
15856
|
+
$[39] = t14;
|
|
15857
|
+
$[40] = t22;
|
|
15858
|
+
$[41] = t23;
|
|
15435
15859
|
} else {
|
|
15436
|
-
|
|
15860
|
+
t23 = $[41];
|
|
15437
15861
|
}
|
|
15438
|
-
return
|
|
15862
|
+
return t23;
|
|
15439
15863
|
}
|
|
15440
15864
|
function extractTouchedValues(values, touched) {
|
|
15441
15865
|
let acc = {};
|
|
@@ -15449,6 +15873,56 @@ function extractTouchedValues(values, touched) {
|
|
|
15449
15873
|
});
|
|
15450
15874
|
return acc;
|
|
15451
15875
|
}
|
|
15876
|
+
function getChanges(source, comparison) {
|
|
15877
|
+
const changes = {};
|
|
15878
|
+
if (!source) {
|
|
15879
|
+
return {};
|
|
15880
|
+
}
|
|
15881
|
+
if (!comparison) {
|
|
15882
|
+
return source;
|
|
15883
|
+
}
|
|
15884
|
+
const allKeys = Array.from(/* @__PURE__ */ new Set([...Object.keys(source), ...Object.keys(comparison)]));
|
|
15885
|
+
for (const key of allKeys) {
|
|
15886
|
+
const sourceValue = source[key];
|
|
15887
|
+
const comparisonValue = comparison[key];
|
|
15888
|
+
if (equal(sourceValue, comparisonValue)) {
|
|
15889
|
+
continue;
|
|
15890
|
+
}
|
|
15891
|
+
const sourceHasKey = source && typeof source === "object" && Object.prototype.hasOwnProperty.call(source, key);
|
|
15892
|
+
const comparisonHasKey = comparison && typeof comparison === "object" && Object.prototype.hasOwnProperty.call(comparison, key);
|
|
15893
|
+
if (comparisonHasKey && !sourceHasKey) {
|
|
15894
|
+
changes[key] = void 0;
|
|
15895
|
+
} else if (Array.isArray(sourceValue)) {
|
|
15896
|
+
const comparisonArray = Array.isArray(comparisonValue) ? comparisonValue : [];
|
|
15897
|
+
if (sourceValue.length < comparisonArray.length) {
|
|
15898
|
+
changes[key] = sourceValue;
|
|
15899
|
+
continue;
|
|
15900
|
+
}
|
|
15901
|
+
const changedArray = sourceValue.map((item, index) => {
|
|
15902
|
+
const comparisonItem = comparisonArray[index];
|
|
15903
|
+
if (equal(item, comparisonItem)) {
|
|
15904
|
+
return null;
|
|
15905
|
+
}
|
|
15906
|
+
if (isObject(item) && item && isObject(comparisonItem) && comparisonItem) {
|
|
15907
|
+
const nestedChanges = getChanges(item, comparisonItem);
|
|
15908
|
+
return Object.keys(nestedChanges).length > 0 ? nestedChanges : item;
|
|
15909
|
+
}
|
|
15910
|
+
return item;
|
|
15911
|
+
});
|
|
15912
|
+
if (changedArray.some((item) => item !== null) || sourceValue.length > comparisonArray.length) {
|
|
15913
|
+
changes[key] = changedArray;
|
|
15914
|
+
}
|
|
15915
|
+
} else if (isObject(sourceValue) && sourceValue && isObject(comparisonValue) && comparisonValue) {
|
|
15916
|
+
const nestedChanges = getChanges(sourceValue, comparisonValue);
|
|
15917
|
+
if (Object.keys(nestedChanges).length > 0) {
|
|
15918
|
+
changes[key] = nestedChanges;
|
|
15919
|
+
}
|
|
15920
|
+
} else {
|
|
15921
|
+
changes[key] = sourceValue;
|
|
15922
|
+
}
|
|
15923
|
+
}
|
|
15924
|
+
return changes;
|
|
15925
|
+
}
|
|
15452
15926
|
function EntityForm({
|
|
15453
15927
|
path,
|
|
15454
15928
|
fullIdPath,
|
|
@@ -15570,16 +16044,7 @@ function EntityForm({
|
|
|
15570
16044
|
if (!localChangesDataRaw) {
|
|
15571
16045
|
return void 0;
|
|
15572
16046
|
}
|
|
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;
|
|
16047
|
+
return getChanges(localChangesDataRaw, initialValues_0);
|
|
15583
16048
|
}, [localChangesDataRaw, initialValues_0]);
|
|
15584
16049
|
const hasLocalChanges = !localChangesCleared && localChangesData && Object.keys(localChangesData).length > 0;
|
|
15585
16050
|
const formex = formexProp ?? useCreateFormex({
|
|
@@ -15595,10 +16060,10 @@ function EntityForm({
|
|
|
15595
16060
|
onValuesModified?.(false, initialValues_0);
|
|
15596
16061
|
},
|
|
15597
16062
|
onValuesChangeDeferred: (values_0, controller) => {
|
|
15598
|
-
const
|
|
16063
|
+
const key = status === "new" || status === "copy" ? path + "#new" : path + "/" + entityId;
|
|
15599
16064
|
if (controller.dirty) {
|
|
15600
16065
|
const touchedValues = extractTouchedValues(values_0, controller.touched);
|
|
15601
|
-
saveEntityToCache(
|
|
16066
|
+
saveEntityToCache(key, touchedValues);
|
|
15602
16067
|
}
|
|
15603
16068
|
},
|
|
15604
16069
|
validation: (values_1) => {
|
|
@@ -15832,11 +16297,11 @@ function EntityForm({
|
|
|
15832
16297
|
useOnAutoSave(autoSave, formex, lastSavedValues, save);
|
|
15833
16298
|
useEffect(() => {
|
|
15834
16299
|
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(
|
|
16300
|
+
Object.entries(underlyingChanges).forEach(([key_0, value_0]) => {
|
|
16301
|
+
const formValue = formex.values[key_0];
|
|
16302
|
+
if (!equal(value_0, formValue) && !formex.touched[key_0]) {
|
|
16303
|
+
console.debug("Updated value from the datasource:", key_0, value_0);
|
|
16304
|
+
formex.setFieldValue(key_0, value_0 !== void 0 ? value_0 : null);
|
|
15840
16305
|
}
|
|
15841
16306
|
});
|
|
15842
16307
|
}
|
|
@@ -15846,16 +16311,16 @@ function EntityForm({
|
|
|
15846
16311
|
if (Builder) {
|
|
15847
16312
|
return /* @__PURE__ */ jsx(Builder, { collection, entity, modifiedValues: formex.values, formContext });
|
|
15848
16313
|
}
|
|
15849
|
-
return /* @__PURE__ */ jsx(FormLayout, { children: formFieldKeys.map((
|
|
15850
|
-
const property = resolvedCollection.properties[
|
|
16314
|
+
return /* @__PURE__ */ jsx(FormLayout, { children: formFieldKeys.map((key_1) => {
|
|
16315
|
+
const property = resolvedCollection.properties[key_1];
|
|
15851
16316
|
if (property) {
|
|
15852
|
-
const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(
|
|
16317
|
+
const underlyingValueHasChanged = !!underlyingChanges && Object.keys(underlyingChanges).includes(key_1) && formex.touched[key_1];
|
|
15853
16318
|
const disabled_0 = disabledProp || !autoSave && formex.isSubmitting || isReadOnly(property) || Boolean(property.disabled);
|
|
15854
16319
|
const hidden = isHidden(property);
|
|
15855
16320
|
if (hidden) return null;
|
|
15856
16321
|
const widthPercentage = property.widthPercentage ?? 100;
|
|
15857
16322
|
const cmsFormFieldProps = {
|
|
15858
|
-
propertyKey:
|
|
16323
|
+
propertyKey: key_1,
|
|
15859
16324
|
disabled: disabled_0,
|
|
15860
16325
|
property,
|
|
15861
16326
|
includeDescription: property.description || property.longDescription,
|
|
@@ -15865,9 +16330,9 @@ function EntityForm({
|
|
|
15865
16330
|
minimalistView: false,
|
|
15866
16331
|
autoFocus: false
|
|
15867
16332
|
};
|
|
15868
|
-
return /* @__PURE__ */ jsx(FormEntry, { propertyKey:
|
|
16333
|
+
return /* @__PURE__ */ jsx(FormEntry, { propertyKey: key_1, widthPercentage, children: /* @__PURE__ */ jsx(PropertyFieldBinding, { ...cmsFormFieldProps }) }, `field_${key_1}`);
|
|
15869
16334
|
}
|
|
15870
|
-
const additionalField = resolvedCollection.additionalFields?.find((f) => f.key ===
|
|
16335
|
+
const additionalField = resolvedCollection.additionalFields?.find((f) => f.key === key_1);
|
|
15871
16336
|
if (additionalField && entity) {
|
|
15872
16337
|
const Builder_0 = additionalField.Builder;
|
|
15873
16338
|
if (!Builder_0 && !additionalField.value) {
|
|
@@ -15878,11 +16343,11 @@ function EntityForm({
|
|
|
15878
16343
|
context
|
|
15879
16344
|
})?.toString() });
|
|
15880
16345
|
return /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
|
|
15881
|
-
/* @__PURE__ */ jsx(LabelWithIconAndTooltip, { propertyKey:
|
|
16346
|
+
/* @__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
16347
|
/* @__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_${
|
|
16348
|
+
] }, `additional_${key_1}`);
|
|
15884
16349
|
}
|
|
15885
|
-
console.warn(`Property ${
|
|
16350
|
+
console.warn(`Property ${key_1} not found in collection ${resolvedCollection.name} in properties or additional fields. Skipping.`);
|
|
15886
16351
|
return null;
|
|
15887
16352
|
}).filter(Boolean) });
|
|
15888
16353
|
};
|
|
@@ -26559,6 +27024,7 @@ export {
|
|
|
26559
27024
|
isEnumValueDisabled,
|
|
26560
27025
|
isHidden,
|
|
26561
27026
|
isObject,
|
|
27027
|
+
isPlainObject,
|
|
26562
27028
|
isPropertyBuilder,
|
|
26563
27029
|
isReadOnly,
|
|
26564
27030
|
isReferenceProperty,
|