@firecms/core 3.0.0-canary.169 → 3.0.0-canary.170
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/ArrayContainer.d.ts +7 -3
- package/dist/index.es.js +41 -34
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +41 -34
- package/dist/index.umd.js.map +1 -1
- package/dist/types/dialogs_controller.d.ts +7 -3
- package/package.json +5 -7
- package/src/components/ArrayContainer.tsx +47 -28
- package/src/contexts/DialogsProvider.tsx +3 -2
- package/src/core/DefaultDrawer.tsx +1 -1
- package/src/hooks/useBuildNavigationController.tsx +1 -0
- package/src/internal/useBuildSideDialogsController.tsx +0 -1
- package/src/types/dialogs_controller.tsx +7 -3
package/dist/index.umd.js
CHANGED
|
@@ -3705,7 +3705,7 @@
|
|
|
3705
3705
|
if ($[7] !== close || $[8] !== dialogEntries) {
|
|
3706
3706
|
let t72;
|
|
3707
3707
|
if ($[10] !== close) {
|
|
3708
|
-
t72 = (entry, i) => /* @__PURE__ */ jsxRuntime.jsx(entry.Component, { open: true, closeDialog: close }, `dialog_${i}`);
|
|
3708
|
+
t72 = (entry, i) => /* @__PURE__ */ jsxRuntime.jsx(entry.Component, { open: true, closeDialog: close, ...entry.props }, `dialog_${i}`);
|
|
3709
3709
|
$[10] = close;
|
|
3710
3710
|
$[11] = t72;
|
|
3711
3711
|
} else {
|
|
@@ -13626,7 +13626,9 @@
|
|
|
13626
13626
|
includeAddButton,
|
|
13627
13627
|
newDefaultEntry,
|
|
13628
13628
|
onValueChange,
|
|
13629
|
-
className
|
|
13629
|
+
className,
|
|
13630
|
+
min = 0,
|
|
13631
|
+
max = Infinity
|
|
13630
13632
|
}) {
|
|
13631
13633
|
const hasValue = value && Array.isArray(value) && value.length > 0;
|
|
13632
13634
|
const internalIdsRef = React.useRef(buildIdsMap(value));
|
|
@@ -13652,7 +13654,7 @@
|
|
|
13652
13654
|
}, [hasValue, internalIds.length, value]);
|
|
13653
13655
|
const insertInEnd = (e) => {
|
|
13654
13656
|
e.preventDefault();
|
|
13655
|
-
if (disabled) return;
|
|
13657
|
+
if (disabled || value.length >= max) return;
|
|
13656
13658
|
const id = getRandomId$1();
|
|
13657
13659
|
const newIds = [...internalIds, id];
|
|
13658
13660
|
if (onInternalIdAdded) onInternalIdAdded(id);
|
|
@@ -13660,22 +13662,25 @@
|
|
|
13660
13662
|
onValueChange([...value ?? [], newDefaultEntry]);
|
|
13661
13663
|
};
|
|
13662
13664
|
const remove = (index_0) => {
|
|
13665
|
+
if (value.length <= min) return;
|
|
13663
13666
|
const newIds_0 = [...internalIds];
|
|
13664
13667
|
newIds_0.splice(index_0, 1);
|
|
13665
13668
|
setInternalIds(newIds_0);
|
|
13666
13669
|
onValueChange(value.filter((_, i) => i !== index_0));
|
|
13667
13670
|
};
|
|
13668
13671
|
const copy = (index_1) => {
|
|
13672
|
+
if (value.length >= max) return;
|
|
13669
13673
|
const id_0 = getRandomId$1();
|
|
13670
13674
|
const copyingItem = value[index_1];
|
|
13671
|
-
const newIds_1 = [...internalIds.
|
|
13675
|
+
const newIds_1 = [...internalIds.slice(0, index_1 + 1), id_0, ...internalIds.slice(index_1 + 1)];
|
|
13672
13676
|
if (onInternalIdAdded) onInternalIdAdded(id_0);
|
|
13673
13677
|
setInternalIds(newIds_1);
|
|
13674
13678
|
onValueChange([...value.slice(0, index_1 + 1), copyingItem, ...value.slice(index_1 + 1)]);
|
|
13675
13679
|
};
|
|
13676
13680
|
const addInIndex = (index_2) => {
|
|
13681
|
+
if (value.length >= max) return;
|
|
13677
13682
|
const id_1 = getRandomId$1();
|
|
13678
|
-
const newIds_2 = [...internalIds.
|
|
13683
|
+
const newIds_2 = [...internalIds.slice(0, index_2), id_1, ...internalIds.slice(index_2)];
|
|
13679
13684
|
if (onInternalIdAdded) onInternalIdAdded(id_1);
|
|
13680
13685
|
setInternalIds(newIds_2);
|
|
13681
13686
|
onValueChange([...value.slice(0, index_2), newDefaultEntry, ...value.slice(index_2)]);
|
|
@@ -13696,17 +13701,17 @@
|
|
|
13696
13701
|
return /* @__PURE__ */ jsxRuntime.jsx(dnd.DragDropContext, { onDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(dnd.Droppable, { droppableId, renderClone: (provided, snapshot, rubric) => {
|
|
13697
13702
|
const index_3 = rubric.source.index;
|
|
13698
13703
|
const internalId_0 = internalIds[index_3];
|
|
13699
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ArrayContainerItem, { provided, internalId: internalId_0, index: index_3, size, disabled, buildEntry, remove, copy, isDragging: snapshot.isDragging, storedProps: itemCustomPropsRef.current[internalId_0], updateItemCustomProps, addInIndex });
|
|
13704
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ArrayContainerItem, { provided, internalId: internalId_0, index: index_3, size, disabled, buildEntry, remove, copy, isDragging: snapshot.isDragging, storedProps: itemCustomPropsRef.current[internalId_0], updateItemCustomProps, addInIndex, includeAddButton });
|
|
13700
13705
|
}, children: (droppableProvided, droppableSnapshot) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cls("space-y-1", className), ...droppableProvided.droppableProps, ref: droppableProvided.innerRef, children: [
|
|
13701
13706
|
hasValue && internalIds.map((internalId_1, index_4) => {
|
|
13702
|
-
return /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: `array_field_${internalId_1}`, isDragDisabled: disabled, index: index_4, children: (provided_0, snapshot_0) => /* @__PURE__ */ jsxRuntime.jsx(ArrayContainerItem, { provided: provided_0, internalId: internalId_1, index: index_4, size, disabled, buildEntry, remove, copy, isDragging: snapshot_0.isDragging, storedProps: itemCustomPropsRef.current[internalId_1], updateItemCustomProps, addInIndex }) }, `array_field_${internalId_1}`);
|
|
13707
|
+
return /* @__PURE__ */ jsxRuntime.jsx(dnd.Draggable, { draggableId: `array_field_${internalId_1}`, isDragDisabled: disabled, index: index_4, children: (provided_0, snapshot_0) => /* @__PURE__ */ jsxRuntime.jsx(ArrayContainerItem, { provided: provided_0, internalId: internalId_1, index: index_4, size, disabled, buildEntry, remove, copy, isDragging: snapshot_0.isDragging, storedProps: itemCustomPropsRef.current[internalId_1], updateItemCustomProps, addInIndex, includeAddButton }) }, `array_field_${internalId_1}`);
|
|
13703
13708
|
}),
|
|
13704
13709
|
droppableProvided.placeholder,
|
|
13705
|
-
includeAddButton && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "
|
|
13710
|
+
includeAddButton && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-4 justify-center text-left", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", size: size === "small" ? "small" : "medium", color: "primary", disabled: disabled || value.length >= max, startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: insertInEnd, children: addLabel ?? "Add" }) })
|
|
13706
13711
|
] }) }) });
|
|
13707
13712
|
}
|
|
13708
13713
|
function ArrayContainerItem(t0) {
|
|
13709
|
-
const $ = reactCompilerRuntime.c(
|
|
13714
|
+
const $ = reactCompilerRuntime.c(29);
|
|
13710
13715
|
const {
|
|
13711
13716
|
provided,
|
|
13712
13717
|
index,
|
|
@@ -13716,6 +13721,7 @@
|
|
|
13716
13721
|
buildEntry,
|
|
13717
13722
|
remove,
|
|
13718
13723
|
addInIndex,
|
|
13724
|
+
includeAddButton,
|
|
13719
13725
|
copy,
|
|
13720
13726
|
isDragging,
|
|
13721
13727
|
storedProps,
|
|
@@ -13763,41 +13769,42 @@
|
|
|
13763
13769
|
}
|
|
13764
13770
|
const t8 = size === "small" ? "row" : "column";
|
|
13765
13771
|
let t9;
|
|
13766
|
-
if ($[12] !== addInIndex || $[13] !== copy || $[14] !== disabled || $[15] !==
|
|
13767
|
-
t9 = /* @__PURE__ */ jsxRuntime.jsx(ArrayItemOptions, { direction: t8, disabled, remove, index, provided, addInIndex, copy });
|
|
13772
|
+
if ($[12] !== addInIndex || $[13] !== copy || $[14] !== disabled || $[15] !== includeAddButton || $[16] !== index || $[17] !== provided || $[18] !== remove || $[19] !== t8) {
|
|
13773
|
+
t9 = /* @__PURE__ */ jsxRuntime.jsx(ArrayItemOptions, { direction: t8, disabled, remove, index, provided, addInIndex, includeAddButton, copy });
|
|
13768
13774
|
$[12] = addInIndex;
|
|
13769
13775
|
$[13] = copy;
|
|
13770
13776
|
$[14] = disabled;
|
|
13771
|
-
$[15] =
|
|
13772
|
-
$[16] =
|
|
13773
|
-
$[17] =
|
|
13774
|
-
$[18] =
|
|
13775
|
-
$[19] =
|
|
13777
|
+
$[15] = includeAddButton;
|
|
13778
|
+
$[16] = index;
|
|
13779
|
+
$[17] = provided;
|
|
13780
|
+
$[18] = remove;
|
|
13781
|
+
$[19] = t8;
|
|
13782
|
+
$[20] = t9;
|
|
13776
13783
|
} else {
|
|
13777
|
-
t9 = $[
|
|
13784
|
+
t9 = $[20];
|
|
13778
13785
|
}
|
|
13779
13786
|
let t10;
|
|
13780
|
-
if ($[
|
|
13787
|
+
if ($[21] !== t7 || $[22] !== t9) {
|
|
13781
13788
|
t10 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start", children: [
|
|
13782
13789
|
t7,
|
|
13783
13790
|
t9
|
|
13784
13791
|
] });
|
|
13785
|
-
$[
|
|
13786
|
-
$[
|
|
13787
|
-
$[
|
|
13792
|
+
$[21] = t7;
|
|
13793
|
+
$[22] = t9;
|
|
13794
|
+
$[23] = t10;
|
|
13788
13795
|
} else {
|
|
13789
|
-
t10 = $[
|
|
13796
|
+
t10 = $[23];
|
|
13790
13797
|
}
|
|
13791
13798
|
let t11;
|
|
13792
|
-
if ($[
|
|
13799
|
+
if ($[24] !== provided.draggableProps || $[25] !== provided.innerRef || $[26] !== t10 || $[27] !== t4) {
|
|
13793
13800
|
t11 = /* @__PURE__ */ jsxRuntime.jsx("div", { ref: t1, ...t2, style: t3, className: t4, children: t10 });
|
|
13794
|
-
$[
|
|
13795
|
-
$[
|
|
13796
|
-
$[
|
|
13797
|
-
$[
|
|
13798
|
-
$[
|
|
13801
|
+
$[24] = provided.draggableProps;
|
|
13802
|
+
$[25] = provided.innerRef;
|
|
13803
|
+
$[26] = t10;
|
|
13804
|
+
$[27] = t4;
|
|
13805
|
+
$[28] = t11;
|
|
13799
13806
|
} else {
|
|
13800
|
-
t11 = $[
|
|
13807
|
+
t11 = $[28];
|
|
13801
13808
|
}
|
|
13802
13809
|
return t11;
|
|
13803
13810
|
}
|
|
@@ -13808,6 +13815,7 @@
|
|
|
13808
13815
|
index,
|
|
13809
13816
|
provided,
|
|
13810
13817
|
copy,
|
|
13818
|
+
includeAddButton,
|
|
13811
13819
|
addInIndex
|
|
13812
13820
|
}) {
|
|
13813
13821
|
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
@@ -13835,14 +13843,14 @@
|
|
|
13835
13843
|
/* @__PURE__ */ jsxRuntime.jsx(ui.ContentCopyIcon, { size: "small" }),
|
|
13836
13844
|
"Copy"
|
|
13837
13845
|
] }),
|
|
13838
|
-
addInIndex && /* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { dense: true, onClick: () => {
|
|
13846
|
+
includeAddButton && addInIndex && /* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { dense: true, onClick: () => {
|
|
13839
13847
|
setMenuOpen(false);
|
|
13840
13848
|
addInIndex(index);
|
|
13841
13849
|
}, children: [
|
|
13842
13850
|
/* @__PURE__ */ jsxRuntime.jsx(ui.KeyboardArrowUpIcon, { size: "small" }),
|
|
13843
13851
|
"Add on top"
|
|
13844
13852
|
] }),
|
|
13845
|
-
addInIndex && /* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { dense: true, onClick: () => {
|
|
13853
|
+
includeAddButton && addInIndex && /* @__PURE__ */ jsxRuntime.jsxs(ui.MenuItem, { dense: true, onClick: () => {
|
|
13846
13854
|
setMenuOpen(false);
|
|
13847
13855
|
addInIndex(index + 1);
|
|
13848
13856
|
}, children: [
|
|
@@ -14436,7 +14444,7 @@
|
|
|
14436
14444
|
return encodeURIComponent(removeInitialAndTrailingSlashes(input)).replaceAll("%2F", "/").replaceAll("%23", "#");
|
|
14437
14445
|
}
|
|
14438
14446
|
function filterOutNotAllowedCollections(resolvedCollections, authController) {
|
|
14439
|
-
return resolvedCollections.filter((c) => {
|
|
14447
|
+
return resolvedCollections.filter((c) => Boolean(c.path)).filter((c) => {
|
|
14440
14448
|
if (!c.permissions) return true;
|
|
14441
14449
|
const resolvedPermissions = resolvePermissions(c, authController, c.path, null);
|
|
14442
14450
|
return resolvedPermissions?.read !== false;
|
|
@@ -21863,7 +21871,6 @@
|
|
|
21863
21871
|
let t7;
|
|
21864
21872
|
if ($[15] !== location || $[16] !== navigate || $[17] !== sidePanels) {
|
|
21865
21873
|
t7 = (panelProps_0) => {
|
|
21866
|
-
console.log("replace", panelProps_0);
|
|
21867
21874
|
const newPanels_2 = Array.isArray(panelProps_0) ? panelProps_0 : [panelProps_0];
|
|
21868
21875
|
newPanels_2.forEach((panel_1) => {
|
|
21869
21876
|
routesStore.current[panel_1.key] = panel_1;
|
|
@@ -22679,7 +22686,7 @@
|
|
|
22679
22686
|
}
|
|
22680
22687
|
let t4;
|
|
22681
22688
|
if ($[3] !== drawerOpen || $[4] !== logo) {
|
|
22682
|
-
t4 = logo ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: "Logo", className: ui.cls("max-w-full max-h-full transition-all", drawerOpen ? "w-[96px] h-[96px]" : "w-[32px] h-[32px]") }) : /* @__PURE__ */ jsxRuntime.jsx(FireCMSLogo, {});
|
|
22689
|
+
t4 = logo ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo, alt: "Logo", className: ui.cls("max-w-full max-h-full transition-all object-contain", drawerOpen ? "w-[96px] h-[96px]" : "w-[32px] h-[32px]") }) : /* @__PURE__ */ jsxRuntime.jsx(FireCMSLogo, {});
|
|
22683
22690
|
$[3] = drawerOpen;
|
|
22684
22691
|
$[4] = logo;
|
|
22685
22692
|
$[5] = t4;
|