@firecms/core 3.0.0-canary.246 → 3.0.0-canary.248
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/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/index.es.js +113 -122
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +113 -122
- package/dist/index.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/components/ArrayContainer.tsx +1 -0
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +13 -2
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +52 -26
- package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +9 -9
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +1 -0
- package/src/components/HomePage/NavigationCardBinding.tsx +3 -1
- package/src/form/EntityForm.tsx +1 -1
- package/src/form/PropertyFieldBinding.tsx +0 -1
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +3 -2
- package/src/form/field_bindings/MapFieldBinding.tsx +5 -4
- package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -0
- package/dist/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.d.ts +0 -5
- package/src/components/EntityCollectionTable/internal/popup_field/ElementResizeListener.tsx +0 -59
|
@@ -6,4 +6,4 @@ import { FieldProps } from "../../types";
|
|
|
6
6
|
* and tables to the specified properties.
|
|
7
7
|
* @group Form fields
|
|
8
8
|
*/
|
|
9
|
-
export declare function MapFieldBinding({ propertyKey, value, showError, error, disabled, property, minimalistView: minimalistViewProp, includeDescription, autoFocus, context, onPropertyChange }: FieldProps<Record<string, any>>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function MapFieldBinding({ propertyKey, value, showError, error, disabled, property, partOfArray, minimalistView: minimalistViewProp, includeDescription, autoFocus, context, onPropertyChange }: FieldProps<Record<string, any>>): import("react/jsx-runtime").JSX.Element;
|
package/dist/index.es.js
CHANGED
|
@@ -8855,7 +8855,7 @@ const TableCellInner = (t0) => {
|
|
|
8855
8855
|
return t8;
|
|
8856
8856
|
};
|
|
8857
8857
|
const EntityTableCell = React__default.memo(function EntityTableCell2(t0) {
|
|
8858
|
-
const $ = c(
|
|
8858
|
+
const $ = c(48);
|
|
8859
8859
|
const {
|
|
8860
8860
|
children,
|
|
8861
8861
|
actions,
|
|
@@ -9084,11 +9084,11 @@ const EntityTableCell = React__default.memo(function EntityTableCell2(t0) {
|
|
|
9084
9084
|
}
|
|
9085
9085
|
let t25;
|
|
9086
9086
|
if ($[37] !== actions || $[38] !== onFocus || $[39] !== t16 || $[40] !== t19 || $[41] !== t20 || $[42] !== t23 || $[43] !== t24) {
|
|
9087
|
-
t25 = /* @__PURE__ */ jsxs("div", { className: t16, ref, style: t19, tabIndex: t20, onFocus, onMouseEnter: setOnHoverTrue, onMouseMove: setOnHoverTrue, onMouseLeave: setOnHoverFalse, children: [
|
|
9087
|
+
t25 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: t16, ref, style: t19, tabIndex: t20, onFocus, onMouseEnter: setOnHoverTrue, onMouseMove: setOnHoverTrue, onMouseLeave: setOnHoverFalse, children: [
|
|
9088
9088
|
t23,
|
|
9089
9089
|
actions,
|
|
9090
9090
|
t24
|
|
9091
|
-
] });
|
|
9091
|
+
] }) });
|
|
9092
9092
|
$[37] = actions;
|
|
9093
9093
|
$[38] = onFocus;
|
|
9094
9094
|
$[39] = t16;
|
|
@@ -9100,7 +9100,21 @@ const EntityTableCell = React__default.memo(function EntityTableCell2(t0) {
|
|
|
9100
9100
|
} else {
|
|
9101
9101
|
t25 = $[44];
|
|
9102
9102
|
}
|
|
9103
|
-
|
|
9103
|
+
const result = t25;
|
|
9104
|
+
if (showError) {
|
|
9105
|
+
const t26 = error?.message ?? "Error";
|
|
9106
|
+
let t27;
|
|
9107
|
+
if ($[45] !== result || $[46] !== t26) {
|
|
9108
|
+
t27 = /* @__PURE__ */ jsx(ErrorTooltip, { align: "start", title: t26, children: result });
|
|
9109
|
+
$[45] = result;
|
|
9110
|
+
$[46] = t26;
|
|
9111
|
+
$[47] = t27;
|
|
9112
|
+
} else {
|
|
9113
|
+
t27 = $[47];
|
|
9114
|
+
}
|
|
9115
|
+
return t27;
|
|
9116
|
+
}
|
|
9117
|
+
return result;
|
|
9104
9118
|
}, (a, b) => {
|
|
9105
9119
|
return a.error === b.error && a.value === b.value && a.disabled === b.disabled && a.saved === b.saved && a.allowScroll === b.allowScroll && a.align === b.align && a.size === b.size && a.disabledTooltip === b.disabledTooltip && a.width === b.width && a.showExpandIcon === b.showExpandIcon && a.removePadding === b.removePadding && a.fullHeight === b.fullHeight && a.selected === b.selected;
|
|
9106
9120
|
});
|
|
@@ -12946,7 +12960,7 @@ function NavigationCardBinding(t0) {
|
|
|
12946
12960
|
const favourite = t4;
|
|
12947
12961
|
let t5;
|
|
12948
12962
|
if ($[7] !== collection || $[8] !== context || $[9] !== customizationController.plugins || $[10] !== favourite || $[11] !== path || $[12] !== userConfigurationPersistence) {
|
|
12949
|
-
const actionsArray = userConfigurationPersistence ? [/* @__PURE__ */ jsx(IconButton, { onClick: (e) => {
|
|
12963
|
+
const actionsArray = userConfigurationPersistence ? [/* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e) => {
|
|
12950
12964
|
e.preventDefault();
|
|
12951
12965
|
e.stopPropagation();
|
|
12952
12966
|
if (favourite) {
|
|
@@ -12954,7 +12968,7 @@ function NavigationCardBinding(t0) {
|
|
|
12954
12968
|
} else {
|
|
12955
12969
|
userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, path]);
|
|
12956
12970
|
}
|
|
12957
|
-
}, children: /* @__PURE__ */ jsx(StarIcon, { size:
|
|
12971
|
+
}, children: /* @__PURE__ */ jsx(StarIcon, { size: "small", className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500" }) }, "favourite")] : [];
|
|
12958
12972
|
if (customizationController.plugins && collection) {
|
|
12959
12973
|
let t62;
|
|
12960
12974
|
if ($[14] !== collection || $[15] !== context || $[16] !== path) {
|
|
@@ -13714,7 +13728,7 @@ function useDraggable({
|
|
|
13714
13728
|
let relX = 0;
|
|
13715
13729
|
let relY = 0;
|
|
13716
13730
|
const listeningRef = React__default.useRef(false);
|
|
13717
|
-
const onMouseDown = (event) => {
|
|
13731
|
+
const onMouseDown = useCallback((event) => {
|
|
13718
13732
|
if (event.button !== 0 || !containerRef.current || event.defaultPrevented || event.innerClicked) {
|
|
13719
13733
|
return;
|
|
13720
13734
|
}
|
|
@@ -13728,14 +13742,14 @@ function useDraggable({
|
|
|
13728
13742
|
document.addEventListener("mouseup", onMouseUp);
|
|
13729
13743
|
document.addEventListener("selectstart", onSelect);
|
|
13730
13744
|
listeningRef.current = true;
|
|
13731
|
-
};
|
|
13732
|
-
const onMouseDownInner = (event_0) => {
|
|
13745
|
+
}, [containerRef, onMove]);
|
|
13746
|
+
const onMouseDownInner = useCallback((event_0) => {
|
|
13733
13747
|
event_0.innerClicked = true;
|
|
13734
|
-
};
|
|
13735
|
-
const onSelect = (event_1) => {
|
|
13748
|
+
}, []);
|
|
13749
|
+
const onSelect = useCallback((event_1) => {
|
|
13736
13750
|
event_1.preventDefault();
|
|
13737
13751
|
event_1.stopPropagation();
|
|
13738
|
-
};
|
|
13752
|
+
}, []);
|
|
13739
13753
|
const onMouseUp = (event_2) => {
|
|
13740
13754
|
document.removeEventListener("mousemove", onMouseMove);
|
|
13741
13755
|
document.removeEventListener("mouseup", onMouseUp);
|
|
@@ -13768,7 +13782,7 @@ function useDraggable({
|
|
|
13768
13782
|
if (current) current.removeEventListener("mousedown", onMouseDown);
|
|
13769
13783
|
if (innerCurrent) innerCurrent.removeEventListener("mousedown", onMouseDownInner);
|
|
13770
13784
|
};
|
|
13771
|
-
});
|
|
13785
|
+
}, [containerRef, innerRef, onMouseDownInner, onMouseDown]);
|
|
13772
13786
|
}
|
|
13773
13787
|
function useWindowSize() {
|
|
13774
13788
|
const $ = c(3);
|
|
@@ -13807,46 +13821,6 @@ function useWindowSize() {
|
|
|
13807
13821
|
useLayoutEffect(t1, t2);
|
|
13808
13822
|
return size;
|
|
13809
13823
|
}
|
|
13810
|
-
const ElementResizeListener = ({
|
|
13811
|
-
onResize
|
|
13812
|
-
}) => {
|
|
13813
|
-
const rafRef = useRef(0);
|
|
13814
|
-
const objectRef = useRef(null);
|
|
13815
|
-
const onResizeRef = useRef(onResize);
|
|
13816
|
-
onResizeRef.current = onResize;
|
|
13817
|
-
const _onResize = useCallback((e) => {
|
|
13818
|
-
if (rafRef.current) {
|
|
13819
|
-
cancelAnimationFrame(rafRef.current);
|
|
13820
|
-
}
|
|
13821
|
-
rafRef.current = requestAnimationFrame(() => {
|
|
13822
|
-
onResizeRef.current(e);
|
|
13823
|
-
});
|
|
13824
|
-
}, []);
|
|
13825
|
-
const onLoad = useCallback(() => {
|
|
13826
|
-
const obj = objectRef.current;
|
|
13827
|
-
if (obj && obj.contentDocument && obj.contentDocument.defaultView) {
|
|
13828
|
-
obj.contentDocument.defaultView.addEventListener("resize", _onResize);
|
|
13829
|
-
}
|
|
13830
|
-
}, [_onResize]);
|
|
13831
|
-
useEffect(() => {
|
|
13832
|
-
const obj_0 = objectRef.current;
|
|
13833
|
-
return () => {
|
|
13834
|
-
if (obj_0 && obj_0.contentDocument && obj_0.contentDocument.defaultView) {
|
|
13835
|
-
obj_0.contentDocument.defaultView.removeEventListener("resize", _onResize);
|
|
13836
|
-
}
|
|
13837
|
-
};
|
|
13838
|
-
}, [_onResize]);
|
|
13839
|
-
return /* @__PURE__ */ jsx("object", { onLoad, ref: objectRef, tabIndex: -1, type: "text/html", data: "about:blank", title: "", style: {
|
|
13840
|
-
position: "absolute",
|
|
13841
|
-
top: 0,
|
|
13842
|
-
left: 0,
|
|
13843
|
-
height: "100%",
|
|
13844
|
-
width: "100%",
|
|
13845
|
-
pointerEvents: "none",
|
|
13846
|
-
zIndex: -1,
|
|
13847
|
-
opacity: 0
|
|
13848
|
-
} });
|
|
13849
|
-
};
|
|
13850
13824
|
function CustomIdField({
|
|
13851
13825
|
customId,
|
|
13852
13826
|
entityId,
|
|
@@ -14469,7 +14443,7 @@ function EntityForm({
|
|
|
14469
14443
|
const formRef = useRef(null);
|
|
14470
14444
|
const formView = /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14471
14445
|
!Builder && /* @__PURE__ */ jsxs("div", { className: "w-full py-2 flex flex-col items-start my-4 lg:my-6", children: [
|
|
14472
|
-
/* @__PURE__ */ jsx(Typography, { className: "
|
|
14446
|
+
/* @__PURE__ */ jsx(Typography, { className: "my-4 flex-grow line-clamp-1 " + (collection.hideIdFromForm ? "mb-6" : ""), variant: "h4", children: title ?? collection.singularName ?? collection.name }),
|
|
14473
14447
|
showEntityPath && /* @__PURE__ */ jsx(Alert, { color: "base", className: "w-full", size: "small", children: /* @__PURE__ */ jsxs("code", { className: "text-xs select-all text-text-secondary dark:text-text-secondary-dark", children: [
|
|
14474
14448
|
entity?.path ?? path,
|
|
14475
14449
|
"/",
|
|
@@ -15152,7 +15126,8 @@ function ArrayOfReferencesFieldBinding({
|
|
|
15152
15126
|
!collection && /* @__PURE__ */ jsx(ErrorView, { error: "The specified collection does not exist. Check console" }),
|
|
15153
15127
|
collection && /* @__PURE__ */ jsxs("div", { className: "group", children: [
|
|
15154
15128
|
/* @__PURE__ */ jsx(ArrayContainer, { droppableId: propertyKey, value, disabled: isSubmitting, buildEntry, canAddElements: false, addLabel: property.name ? "Add reference to " + property.name : "Add reference", newDefaultEntry: property.of.defaultValue, onValueChange: (value_0) => setFieldValue(propertyKey, value_0) }),
|
|
15155
|
-
/* @__PURE__ */ jsxs(Button, { className: "my-4 justify-center text-left", variant: "text", color: "primary", disabled: isSubmitting, onClick: onEntryClick, children: [
|
|
15129
|
+
/* @__PURE__ */ jsxs(Button, { className: "ml-3.5 my-4 justify-center text-left", variant: "text", color: "primary", disabled: isSubmitting, onClick: onEntryClick, children: [
|
|
15130
|
+
/* @__PURE__ */ jsx(EditIcon, { size: "small" }),
|
|
15156
15131
|
"Edit ",
|
|
15157
15132
|
property.name
|
|
15158
15133
|
] })
|
|
@@ -16823,6 +16798,7 @@ function MapFieldBinding(t0) {
|
|
|
16823
16798
|
error,
|
|
16824
16799
|
disabled,
|
|
16825
16800
|
property,
|
|
16801
|
+
partOfArray,
|
|
16826
16802
|
minimalistView: minimalistViewProp,
|
|
16827
16803
|
includeDescription,
|
|
16828
16804
|
autoFocus,
|
|
@@ -16947,7 +16923,7 @@ function MapFieldBinding(t0) {
|
|
|
16947
16923
|
}
|
|
16948
16924
|
const t6 = minimalistView && mapFormView;
|
|
16949
16925
|
const t7 = showError ?? false;
|
|
16950
|
-
const t8 = error ? typeof error === "string" ? error : "A property of this map has an error" : void 0;
|
|
16926
|
+
const t8 = error && !partOfArray ? typeof error === "string" ? error : "A property of this map has an error" : void 0;
|
|
16951
16927
|
let t9;
|
|
16952
16928
|
if ($[31] !== disabled || $[32] !== includeDescription || $[33] !== property || $[34] !== t7 || $[35] !== t8) {
|
|
16953
16929
|
t9 = /* @__PURE__ */ jsx(FieldHelperText, { includeDescription, showError: t7, error: t8, disabled, property });
|
|
@@ -17798,6 +17774,7 @@ function RepeatFieldBinding(t0) {
|
|
|
17798
17774
|
minimalistView: false,
|
|
17799
17775
|
autoFocus: internalId === lastAddedId
|
|
17800
17776
|
};
|
|
17777
|
+
console.debug("Building entry for", index, fieldProps);
|
|
17801
17778
|
return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(PropertyFieldBinding, { ...fieldProps, index }) });
|
|
17802
17779
|
};
|
|
17803
17780
|
$[4] = context;
|
|
@@ -18434,7 +18411,7 @@ function PopupFormField(props) {
|
|
|
18434
18411
|
return t0;
|
|
18435
18412
|
}
|
|
18436
18413
|
function PopupFormFieldLoading(t0) {
|
|
18437
|
-
const $ = c(
|
|
18414
|
+
const $ = c(21);
|
|
18438
18415
|
const {
|
|
18439
18416
|
tableKey,
|
|
18440
18417
|
entityId,
|
|
@@ -18451,6 +18428,7 @@ function PopupFormFieldLoading(t0) {
|
|
|
18451
18428
|
const dataSource = useDataSource();
|
|
18452
18429
|
const [entity, setEntity] = useState(void 0);
|
|
18453
18430
|
let t1;
|
|
18431
|
+
let t2;
|
|
18454
18432
|
if ($[0] !== dataSource || $[1] !== entityId || $[2] !== inputCollection || $[3] !== path) {
|
|
18455
18433
|
t1 = () => {
|
|
18456
18434
|
if (entityId && inputCollection) {
|
|
@@ -18461,29 +18439,23 @@ function PopupFormFieldLoading(t0) {
|
|
|
18461
18439
|
}).then(setEntity);
|
|
18462
18440
|
}
|
|
18463
18441
|
};
|
|
18442
|
+
t2 = [entityId, inputCollection, dataSource, path];
|
|
18464
18443
|
$[0] = dataSource;
|
|
18465
18444
|
$[1] = entityId;
|
|
18466
18445
|
$[2] = inputCollection;
|
|
18467
18446
|
$[3] = path;
|
|
18468
18447
|
$[4] = t1;
|
|
18448
|
+
$[5] = t2;
|
|
18469
18449
|
} else {
|
|
18470
18450
|
t1 = $[4];
|
|
18471
|
-
|
|
18472
|
-
let t2;
|
|
18473
|
-
if ($[5] !== entityId || $[6] !== inputCollection) {
|
|
18474
|
-
t2 = [entityId, inputCollection];
|
|
18475
|
-
$[5] = entityId;
|
|
18476
|
-
$[6] = inputCollection;
|
|
18477
|
-
$[7] = t2;
|
|
18478
|
-
} else {
|
|
18479
|
-
t2 = $[7];
|
|
18451
|
+
t2 = $[5];
|
|
18480
18452
|
}
|
|
18481
18453
|
useEffect(t1, t2);
|
|
18482
18454
|
if (!entity) {
|
|
18483
18455
|
return null;
|
|
18484
18456
|
}
|
|
18485
18457
|
let t3;
|
|
18486
|
-
if ($[
|
|
18458
|
+
if ($[6] !== cellRect || $[7] !== container || $[8] !== customFieldValidator || $[9] !== entityId || $[10] !== inputCollection || $[11] !== onCellValueChange || $[12] !== onClose || $[13] !== open || $[14] !== path || $[15] !== propertyKey || $[16] !== tableKey) {
|
|
18487
18459
|
t3 = {
|
|
18488
18460
|
tableKey,
|
|
18489
18461
|
entityId,
|
|
@@ -18497,29 +18469,29 @@ function PopupFormFieldLoading(t0) {
|
|
|
18497
18469
|
onCellValueChange,
|
|
18498
18470
|
container
|
|
18499
18471
|
};
|
|
18500
|
-
$[
|
|
18501
|
-
$[
|
|
18502
|
-
$[
|
|
18503
|
-
$[
|
|
18504
|
-
$[
|
|
18505
|
-
$[
|
|
18506
|
-
$[
|
|
18507
|
-
$[
|
|
18508
|
-
$[
|
|
18509
|
-
$[
|
|
18510
|
-
$[
|
|
18511
|
-
$[
|
|
18472
|
+
$[6] = cellRect;
|
|
18473
|
+
$[7] = container;
|
|
18474
|
+
$[8] = customFieldValidator;
|
|
18475
|
+
$[9] = entityId;
|
|
18476
|
+
$[10] = inputCollection;
|
|
18477
|
+
$[11] = onCellValueChange;
|
|
18478
|
+
$[12] = onClose;
|
|
18479
|
+
$[13] = open;
|
|
18480
|
+
$[14] = path;
|
|
18481
|
+
$[15] = propertyKey;
|
|
18482
|
+
$[16] = tableKey;
|
|
18483
|
+
$[17] = t3;
|
|
18512
18484
|
} else {
|
|
18513
|
-
t3 = $[
|
|
18485
|
+
t3 = $[17];
|
|
18514
18486
|
}
|
|
18515
18487
|
let t4;
|
|
18516
|
-
if ($[
|
|
18488
|
+
if ($[18] !== entity || $[19] !== t3) {
|
|
18517
18489
|
t4 = /* @__PURE__ */ jsx(PopupFormFieldInternal, { ...t3, entity });
|
|
18518
|
-
$[
|
|
18519
|
-
$[
|
|
18520
|
-
$[
|
|
18490
|
+
$[18] = entity;
|
|
18491
|
+
$[19] = t3;
|
|
18492
|
+
$[20] = t4;
|
|
18521
18493
|
} else {
|
|
18522
|
-
t4 = $[
|
|
18494
|
+
t4 = $[20];
|
|
18523
18495
|
}
|
|
18524
18496
|
return t4;
|
|
18525
18497
|
}
|
|
@@ -18561,23 +18533,26 @@ function PopupFormFieldInternal({
|
|
|
18561
18533
|
y: cellRect.top < windowSize.height - cellRect.bottom ? cellRect.y + cellRect.height / 2 : cellRect.y - cellRect.height / 2
|
|
18562
18534
|
};
|
|
18563
18535
|
}, [cellRect, windowSize.height, windowSize.width]);
|
|
18564
|
-
const normalizePosition = useCallback(({
|
|
18565
|
-
|
|
18566
|
-
|
|
18567
|
-
|
|
18568
|
-
const draggableBoundingRect = draggableRef.current?.getBoundingClientRect();
|
|
18569
|
-
if (!draggableBoundingRect) throw Error("normalizePosition called before draggableBoundingRect is set");
|
|
18536
|
+
const normalizePosition = useCallback((pos, draggableBoundingRect, currentWindowSize) => {
|
|
18537
|
+
if (!draggableBoundingRect || draggableBoundingRect.width === 0 || draggableBoundingRect.height === 0) {
|
|
18538
|
+
return pos;
|
|
18539
|
+
}
|
|
18570
18540
|
return {
|
|
18571
|
-
x: Math.max(0, Math.min(x,
|
|
18572
|
-
y: Math.max(0, Math.min(y,
|
|
18541
|
+
x: Math.max(0, Math.min(pos.x, currentWindowSize.width - draggableBoundingRect.width)),
|
|
18542
|
+
y: Math.max(0, Math.min(pos.y, currentWindowSize.height - draggableBoundingRect.height))
|
|
18573
18543
|
};
|
|
18574
|
-
}, [
|
|
18575
|
-
const updatePopupLocation = useCallback((
|
|
18544
|
+
}, []);
|
|
18545
|
+
const updatePopupLocation = useCallback((newPositionCandidate) => {
|
|
18576
18546
|
const draggableBoundingRect_0 = draggableRef.current?.getBoundingClientRect();
|
|
18577
|
-
if (!cellRect || !draggableBoundingRect_0)
|
|
18578
|
-
|
|
18579
|
-
|
|
18580
|
-
|
|
18547
|
+
if (!cellRect || !draggableBoundingRect_0 || draggableBoundingRect_0.width === 0 || draggableBoundingRect_0.height === 0) {
|
|
18548
|
+
return;
|
|
18549
|
+
}
|
|
18550
|
+
const basePosition = newPositionCandidate ?? getInitialLocation();
|
|
18551
|
+
const newNormalizedPosition = normalizePosition(basePosition, draggableBoundingRect_0, windowSize);
|
|
18552
|
+
if (!popupLocation || newNormalizedPosition.x !== popupLocation.x || newNormalizedPosition.y !== popupLocation.y) {
|
|
18553
|
+
setPopupLocation(newNormalizedPosition);
|
|
18554
|
+
}
|
|
18555
|
+
}, [cellRect, getInitialLocation, normalizePosition, popupLocation, windowSize]);
|
|
18581
18556
|
useDraggable({
|
|
18582
18557
|
containerRef: draggableRef,
|
|
18583
18558
|
innerRef,
|
|
@@ -18588,15 +18563,22 @@ function PopupFormFieldInternal({
|
|
|
18588
18563
|
useEffect(() => {
|
|
18589
18564
|
initialPositionSet.current = false;
|
|
18590
18565
|
}, [propertyKey, entity]);
|
|
18591
|
-
useLayoutEffect(
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18566
|
+
useLayoutEffect(
|
|
18567
|
+
() => {
|
|
18568
|
+
if (!cellRect || initialPositionSet.current) return;
|
|
18569
|
+
const draggableBoundingRect_1 = draggableRef.current?.getBoundingClientRect();
|
|
18570
|
+
if (!draggableBoundingRect_1 || draggableBoundingRect_1.width === 0 || draggableBoundingRect_1.height === 0) {
|
|
18571
|
+
return;
|
|
18572
|
+
}
|
|
18573
|
+
updatePopupLocation();
|
|
18574
|
+
initialPositionSet.current = true;
|
|
18575
|
+
},
|
|
18576
|
+
[cellRect, updatePopupLocation]
|
|
18577
|
+
// Removed initialPositionSet.current from deps as it's a ref
|
|
18578
|
+
);
|
|
18597
18579
|
useLayoutEffect(() => {
|
|
18598
18580
|
updatePopupLocation(popupLocation);
|
|
18599
|
-
}, [windowSize, cellRect]);
|
|
18581
|
+
}, [windowSize, cellRect, updatePopupLocation, popupLocation]);
|
|
18600
18582
|
const validationSchema = useMemo(() => {
|
|
18601
18583
|
if (!collection || !entityId) return;
|
|
18602
18584
|
return getYupEntitySchema(entityId, propertyKey && collection.properties[propertyKey] ? {
|
|
@@ -18606,6 +18588,18 @@ function PopupFormFieldInternal({
|
|
|
18606
18588
|
const adaptResize = useCallback(() => {
|
|
18607
18589
|
return updatePopupLocation(popupLocation);
|
|
18608
18590
|
}, [popupLocation, updatePopupLocation]);
|
|
18591
|
+
useEffect(() => {
|
|
18592
|
+
const element = draggableRef.current;
|
|
18593
|
+
if (!element) return;
|
|
18594
|
+
const observer = new ResizeObserver(() => {
|
|
18595
|
+
adaptResize();
|
|
18596
|
+
});
|
|
18597
|
+
observer.observe(element);
|
|
18598
|
+
return () => {
|
|
18599
|
+
observer.unobserve(element);
|
|
18600
|
+
observer.disconnect();
|
|
18601
|
+
};
|
|
18602
|
+
}, [adaptResize, draggableRef]);
|
|
18609
18603
|
const saveValue = async (values) => {
|
|
18610
18604
|
setSavingError(null);
|
|
18611
18605
|
if (inputCollection && entity && onCellValueChange && propertyKey) {
|
|
@@ -18686,21 +18680,18 @@ function PopupFormFieldInternal({
|
|
|
18686
18680
|
internalForm,
|
|
18687
18681
|
savingError && /* @__PURE__ */ jsx(Typography, { color: "error", children: savingError.message })
|
|
18688
18682
|
] });
|
|
18689
|
-
const draggable = /* @__PURE__ */
|
|
18683
|
+
const draggable = /* @__PURE__ */ jsx("div", { style: {
|
|
18690
18684
|
boxShadow: "0 0 0 2px rgba(128,128,128,0.2)"
|
|
18691
|
-
}, className: `inline-block fixed z-20 shadow-outline rounded-md bg-white dark:bg-surface-950 ${!open ? "invisible" : "visible"} cursor-grab overflow-visible`, ref: draggableRef, children: [
|
|
18692
|
-
|
|
18693
|
-
/* @__PURE__ */
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18697
|
-
|
|
18698
|
-
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
}, children: /* @__PURE__ */ jsx(CloseIcon, { className: "text-white", size: "small" }) }) })
|
|
18702
|
-
] })
|
|
18703
|
-
] }, `draggable_${propertyKey}_${entityId}_${open}`);
|
|
18685
|
+
}, className: `inline-block fixed z-20 shadow-outline rounded-md bg-white dark:bg-surface-950 ${!open ? "invisible" : "visible"} cursor-grab overflow-visible`, ref: draggableRef, children: /* @__PURE__ */ jsxs("div", { className: "overflow-hidden", children: [
|
|
18686
|
+
form,
|
|
18687
|
+
/* @__PURE__ */ jsx("div", { className: "absolute -top-3.5 -right-3.5 bg-surface-500 rounded-full", style: {
|
|
18688
|
+
width: "32px",
|
|
18689
|
+
height: "32px"
|
|
18690
|
+
}, children: /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (event) => {
|
|
18691
|
+
event.stopPropagation();
|
|
18692
|
+
onClose();
|
|
18693
|
+
}, children: /* @__PURE__ */ jsx(CloseIcon, { className: "text-white", size: "small" }) }) })
|
|
18694
|
+
] }) }, `draggable_${propertyKey}_${entityId}_${open}`);
|
|
18704
18695
|
return /* @__PURE__ */ jsx(Portal.Root, { asChild: true, container, children: /* @__PURE__ */ jsx(Formex, { value: formex, children: draggable }) });
|
|
18705
18696
|
}
|
|
18706
18697
|
function ClearFilterSortButton(t0) {
|
|
@@ -19095,7 +19086,7 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
|
|
|
19095
19086
|
dependencies: [],
|
|
19096
19087
|
Builder: ({
|
|
19097
19088
|
entity: entity_3
|
|
19098
|
-
}) => /* @__PURE__ */ jsx(Button, { color: "primary", variant: "outlined", startIcon: /* @__PURE__ */ jsx(KeyboardTabIcon, { size: "small" }), onClick: (event) => {
|
|
19089
|
+
}) => /* @__PURE__ */ jsx(Button, { color: "primary", variant: "outlined", className: "max-w-full truncate justify-start", startIcon: /* @__PURE__ */ jsx(KeyboardTabIcon, { size: "small" }), onClick: (event) => {
|
|
19099
19090
|
event.stopPropagation();
|
|
19100
19091
|
navigateToEntity({
|
|
19101
19092
|
openEntityMode,
|
|
@@ -20239,7 +20230,7 @@ function ArrayContainer({
|
|
|
20239
20230
|
};
|
|
20240
20231
|
return sortable ? /* @__PURE__ */ jsx(DndContext, { sensors, modifiers: [restrictToVerticalAxis], collisionDetection: closestCenter, onDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items: internalIds, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsxs("div", { className: cls("space-y-1", className), id: droppableId, children: [
|
|
20241
20232
|
hasValue && internalIds.map((internalId_0, index_3) => /* @__PURE__ */ jsx(SortableItem, { id: internalId_0, index: index_3, size, disabled, buildEntry, remove, copy, addInIndex, canAddElements, sortable, storedProps: itemCustomPropsRef.current[internalId_0], updateItemCustomProps }, `array_field_${internalId_0}`)),
|
|
20242
|
-
canAddElements && /* @__PURE__ */ jsx("div", { className: "my-4 justify-center text-left", children: /* @__PURE__ */ jsx(Button, { variant: "text", size: size === "small" ? "small" : "medium", color: "primary", disabled: disabled || (value?.length ?? 0) >= max, startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: insertInEnd, children: addLabel ?? "Add" }) })
|
|
20233
|
+
canAddElements && /* @__PURE__ */ jsx("div", { className: "my-4 justify-center text-left", children: /* @__PURE__ */ jsx(Button, { variant: "text", size: size === "small" ? "small" : "medium", color: "primary", disabled: disabled || (value?.length ?? 0) >= max, startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: insertInEnd, className: "ml-3.5", children: addLabel ?? "Add" }) })
|
|
20243
20234
|
] }) }) }) : /* @__PURE__ */ jsxs("div", { className: cls("space-y-1", className), id: droppableId, children: [
|
|
20244
20235
|
hasValue && internalIds.map((internalId_1, index_4) => /* @__PURE__ */ jsx(ArrayContainerItem, { nodeRef: (node) => {
|
|
20245
20236
|
}, style: {}, dragHandleProps: {}, internalId: internalId_1, index: index_4, size, disabled, buildEntry, remove, copy, addInIndex, canAddElements, sortable: false, isDragging: false, storedProps: itemCustomPropsRef.current[internalId_1], updateItemCustomProps }, `array_field_${internalId_1}`)),
|