@firecms/core 3.0.0-canary.241 → 3.0.0-canary.244
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 -12
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +0 -4
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -9
- package/dist/index.es.js +713 -376
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +721 -387
- package/dist/index.umd.js.map +1 -1
- package/dist/types/collections.d.ts +4 -0
- package/package.json +8 -6
- package/src/components/ArrayContainer.tsx +408 -294
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +1 -0
- package/src/components/HomePage/DefaultHomePage.tsx +1 -0
- package/src/components/VirtualTable/VirtualTable.tsx +2 -27
- package/src/components/VirtualTable/VirtualTableProps.tsx +0 -5
- package/src/components/VirtualTable/fields/VirtualTableInput.tsx +0 -1
- package/src/core/EntityEditView.tsx +1 -0
- package/src/core/EntitySidePanel.tsx +1 -13
- package/src/form/components/CustomIdField.tsx +3 -1
- package/src/form/field_bindings/MultiSelectFieldBinding.tsx +1 -1
- package/src/form/field_bindings/SelectFieldBinding.tsx +2 -1
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +222 -154
- package/src/preview/property_previews/StringPropertyPreview.tsx +1 -1
- package/src/types/collections.ts +5 -0
package/dist/index.es.js
CHANGED
|
@@ -14,7 +14,10 @@ import * as locales from "date-fns/locale";
|
|
|
14
14
|
import useMeasure from "react-use-measure";
|
|
15
15
|
import * as yup from "yup";
|
|
16
16
|
import { FixedSizeList } from "react-window";
|
|
17
|
-
import {
|
|
17
|
+
import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from "@dnd-kit/core";
|
|
18
|
+
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
|
19
|
+
import { sortableKeyboardCoordinates, SortableContext, horizontalListSortingStrategy, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
20
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
18
21
|
import { useDropzone } from "react-dropzone";
|
|
19
22
|
import Resizer from "react-image-file-resizer";
|
|
20
23
|
import { FireCMSEditor } from "@firecms/editor";
|
|
@@ -4307,7 +4310,7 @@ function useEntityFetch(t0) {
|
|
|
4307
4310
|
}
|
|
4308
4311
|
} else {
|
|
4309
4312
|
onEntityUpdate(void 0);
|
|
4310
|
-
return _temp3$
|
|
4313
|
+
return _temp3$5;
|
|
4311
4314
|
}
|
|
4312
4315
|
}
|
|
4313
4316
|
};
|
|
@@ -4348,7 +4351,7 @@ function useEntityFetch(t0) {
|
|
|
4348
4351
|
}
|
|
4349
4352
|
return t5;
|
|
4350
4353
|
}
|
|
4351
|
-
function _temp3$
|
|
4354
|
+
function _temp3$5() {
|
|
4352
4355
|
}
|
|
4353
4356
|
function _temp2$d() {
|
|
4354
4357
|
}
|
|
@@ -5701,7 +5704,7 @@ function StringPropertyPreview(t0) {
|
|
|
5701
5704
|
let t1;
|
|
5702
5705
|
if ($[17] !== size || $[18] !== value) {
|
|
5703
5706
|
const lines = value.split("\n");
|
|
5704
|
-
t1 = value && value.includes("\n") ? /* @__PURE__ */ jsx("div", { className: cls("overflow-x-scroll", size === "small" ? "text-sm" : ""), children: lines.map((str, index) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
5707
|
+
t1 = value && value.includes("\n") ? /* @__PURE__ */ jsx("div", { className: cls("overflow-x-scroll overflow-hidden", size === "small" ? "text-sm" : ""), children: lines.map((str, index) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
5705
5708
|
/* @__PURE__ */ jsx("span", { children: str }),
|
|
5706
5709
|
index !== lines.length - 1 && /* @__PURE__ */ jsx("br", {})
|
|
5707
5710
|
] }, `string_preview_${index}`)) }) : size === "small" ? /* @__PURE__ */ jsx("span", { className: "text-sm", children: value }) : /* @__PURE__ */ jsx(Fragment, { children: value });
|
|
@@ -7267,7 +7270,6 @@ function VirtualTableInput(props) {
|
|
|
7267
7270
|
width: "100%",
|
|
7268
7271
|
color: "unset",
|
|
7269
7272
|
fontWeight: "unset",
|
|
7270
|
-
lineHeight: 1.7142857,
|
|
7271
7273
|
fontSize: "unset",
|
|
7272
7274
|
fontFamily: "unset",
|
|
7273
7275
|
background: "unset",
|
|
@@ -10610,8 +10612,7 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10610
10612
|
className,
|
|
10611
10613
|
endAdornment,
|
|
10612
10614
|
AddColumnComponent,
|
|
10613
|
-
initialScroll = 0
|
|
10614
|
-
debug
|
|
10615
|
+
initialScroll = 0
|
|
10615
10616
|
}) {
|
|
10616
10617
|
const sortByProperty = sortBy ? sortBy[0] : void 0;
|
|
10617
10618
|
const currentSort = sortBy ? sortBy[1] : void 0;
|
|
@@ -10621,7 +10622,10 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10621
10622
|
const debouncedScroll = useDebounceCallback(onScrollProp, 200);
|
|
10622
10623
|
useEffect(() => {
|
|
10623
10624
|
if (tableRef.current && initialScroll) {
|
|
10624
|
-
|
|
10625
|
+
const {
|
|
10626
|
+
scrollLeft
|
|
10627
|
+
} = tableRef.current;
|
|
10628
|
+
tableRef.current.scrollTo(scrollLeft, initialScroll);
|
|
10625
10629
|
}
|
|
10626
10630
|
}, [tableRef, initialScroll]);
|
|
10627
10631
|
useEffect(() => {
|
|
@@ -10652,11 +10656,9 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10652
10656
|
offsetSize: true
|
|
10653
10657
|
});
|
|
10654
10658
|
const onColumnResizeInternal = useCallback((params) => {
|
|
10655
|
-
if (debug) console.log("onColumnResizeInternal", params);
|
|
10656
10659
|
setColumns((prevColumns) => prevColumns.map((column) => column.key === params.column.key ? params.column : column));
|
|
10657
10660
|
}, []);
|
|
10658
10661
|
const onColumnResizeEndInternal = useCallback((params_0) => {
|
|
10659
|
-
if (debug) console.log("onColumnResizeEndInternal", params_0);
|
|
10660
10662
|
setColumns(columns.map((column_0) => column_0.key === params_0.column.key ? params_0.column : column_0));
|
|
10661
10663
|
if (onColumnResize) {
|
|
10662
10664
|
onColumnResize(params_0);
|
|
@@ -10664,18 +10666,15 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10664
10666
|
}, [columns, onColumnResize]);
|
|
10665
10667
|
const filterRef = useRef();
|
|
10666
10668
|
useEffect(() => {
|
|
10667
|
-
if (debug) console.log("Filter updated", filterInput);
|
|
10668
10669
|
filterRef.current = filterInput;
|
|
10669
10670
|
}, [filterInput]);
|
|
10670
10671
|
const scrollToTop = useCallback(() => {
|
|
10671
|
-
if (debug) console.log("scrollToTop");
|
|
10672
10672
|
endReachCallbackThreshold.current = 0;
|
|
10673
10673
|
if (tableRef.current) {
|
|
10674
10674
|
tableRef.current.scrollTo(tableRef.current?.scrollLeft, 0);
|
|
10675
10675
|
}
|
|
10676
10676
|
}, []);
|
|
10677
10677
|
const onColumnSort = useCallback((key) => {
|
|
10678
|
-
if (debug) console.log("onColumnSort", key);
|
|
10679
10678
|
const isDesc = sortByProperty === key && currentSort === "desc";
|
|
10680
10679
|
const isAsc = sortByProperty === key && currentSort === "asc";
|
|
10681
10680
|
const newSort = isAsc ? "desc" : isDesc ? void 0 : "asc";
|
|
@@ -10696,9 +10695,7 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10696
10695
|
scrollToTop();
|
|
10697
10696
|
}, [checkFilterCombination, currentSort, onFilterUpdate, onResetPagination, onSortByUpdate, scrollToTop, sortByProperty]);
|
|
10698
10697
|
const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);
|
|
10699
|
-
if (debug) console.log("maxScroll", maxScroll);
|
|
10700
10698
|
const onEndReachedInternal = useCallback((scrollOffset) => {
|
|
10701
|
-
if (debug) console.log("onEndReachedInternal", scrollOffset, endReachCallbackThreshold.current + endOffset);
|
|
10702
10699
|
if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + endOffset) {
|
|
10703
10700
|
endReachCallbackThreshold.current = scrollOffset;
|
|
10704
10701
|
onEndReached();
|
|
@@ -10709,11 +10706,6 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10709
10706
|
scrollOffset: scrollOffset_0,
|
|
10710
10707
|
scrollUpdateWasRequested
|
|
10711
10708
|
}) => {
|
|
10712
|
-
if (debug) console.log("onScroll", {
|
|
10713
|
-
scrollDirection,
|
|
10714
|
-
scrollOffset: scrollOffset_0,
|
|
10715
|
-
scrollUpdateWasRequested
|
|
10716
|
-
});
|
|
10717
10709
|
if (onScrollProp) {
|
|
10718
10710
|
debouncedScroll({
|
|
10719
10711
|
scrollDirection,
|
|
@@ -10724,7 +10716,6 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10724
10716
|
if (!scrollUpdateWasRequested && scrollOffset_0 >= maxScroll - endOffset) onEndReachedInternal(scrollOffset_0);
|
|
10725
10717
|
}, [maxScroll, onEndReachedInternal]);
|
|
10726
10718
|
const onFilterUpdateInternal = useCallback((column_1, filterForProperty) => {
|
|
10727
|
-
if (debug) console.log("onFilterUpdateInternal", column_1, filterForProperty);
|
|
10728
10719
|
endReachCallbackThreshold.current = 0;
|
|
10729
10720
|
const filter_0 = filterRef.current;
|
|
10730
10721
|
let newFilterValue = filter_0 ? {
|
|
@@ -10772,7 +10763,6 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10772
10763
|
endAdornment,
|
|
10773
10764
|
AddColumnComponent
|
|
10774
10765
|
};
|
|
10775
|
-
if (debug) console.log("VirtualTable render", virtualListController);
|
|
10776
10766
|
return /* @__PURE__ */ jsx("div", { ref: measureRef, style, className: cls("h-full w-full", className), children: /* @__PURE__ */ jsx(VirtualListContext.Provider, { value: virtualListController, children: /* @__PURE__ */ jsx(MemoizedList, { outerRef: tableRef, width: bounds.width, height: bounds.height, itemCount: (data?.length ?? 0) + (endAdornment ? 1 : 0), onScroll, includeAddColumn: Boolean(AddColumnComponent), itemSize: rowHeight }, rowHeight) }) });
|
|
10777
10767
|
}, equal);
|
|
10778
10768
|
function MemoizedList({
|
|
@@ -11108,8 +11098,8 @@ function StringNumberFilterField(t0) {
|
|
|
11108
11098
|
}
|
|
11109
11099
|
let t9;
|
|
11110
11100
|
if ($[34] !== dataType || $[35] !== enumValues || $[36] !== internalValue || $[37] !== multiple || $[38] !== name || $[39] !== operation || $[40] !== updateFilter) {
|
|
11111
|
-
t9 = enumValues && multiple && /* @__PURE__ */ jsx(MultiSelect, { position: "item-aligned", value: Array.isArray(internalValue) ? internalValue.map(_temp3$
|
|
11112
|
-
updateFilter(operation, dataType === "number" ? value_2.map(_temp4$
|
|
11101
|
+
t9 = enumValues && multiple && /* @__PURE__ */ jsx(MultiSelect, { position: "item-aligned", value: Array.isArray(internalValue) ? internalValue.map(_temp3$4) : [], onValueChange: (value_2) => {
|
|
11102
|
+
updateFilter(operation, dataType === "number" ? value_2.map(_temp4$3) : value_2);
|
|
11113
11103
|
}, multiple, endAdornment: internalValue && /* @__PURE__ */ jsx(IconButton, { className: "absolute right-2 top-3", onClick: (e_2) => updateFilter(operation, void 0), children: /* @__PURE__ */ jsx(CloseIcon, {}) }), children: enumValues.map((enumConfig_0) => /* @__PURE__ */ jsx(MultiSelectItem, { value: String(enumConfig_0.id), children: /* @__PURE__ */ jsx(EnumValuesChip, { enumKey: String(enumConfig_0.id), enumValues, size: "small" }) }, `select_value_${name}_${enumConfig_0.id}`)) });
|
|
11114
11104
|
$[34] = dataType;
|
|
11115
11105
|
$[35] = enumValues;
|
|
@@ -11172,10 +11162,10 @@ function StringNumberFilterField(t0) {
|
|
|
11172
11162
|
}
|
|
11173
11163
|
return t12;
|
|
11174
11164
|
}
|
|
11175
|
-
function _temp4$
|
|
11165
|
+
function _temp4$3(v) {
|
|
11176
11166
|
return parseInt(v);
|
|
11177
11167
|
}
|
|
11178
|
-
function _temp3$
|
|
11168
|
+
function _temp3$4(e_1) {
|
|
11179
11169
|
return String(e_1);
|
|
11180
11170
|
}
|
|
11181
11171
|
function _temp2$7(op_1) {
|
|
@@ -13299,7 +13289,7 @@ function DefaultHomePage(t0) {
|
|
|
13299
13289
|
if ($[7] !== additionalActions || $[8] !== additionalChildrenStart || $[9] !== containerRef || $[10] !== context || $[11] !== customizationController.plugins || $[12] !== direction || $[13] !== filteredNavigationEntries || $[14] !== filteredUrls || $[15] !== groups || $[16] !== performingSearch) {
|
|
13300
13290
|
const filteredGroups = filteredUrls ? filteredNavigationEntries.map(_temp2$5) : [];
|
|
13301
13291
|
const allGroups = filteredUrls ? filteredGroups.filter((group, index) => filteredGroups.indexOf(group) === index) : [...groups];
|
|
13302
|
-
if (filteredNavigationEntries.filter(_temp3$
|
|
13292
|
+
if (filteredNavigationEntries.filter(_temp3$3).length > 0 || filteredNavigationEntries.length === 0) {
|
|
13303
13293
|
allGroups.push(void 0);
|
|
13304
13294
|
}
|
|
13305
13295
|
let additionalPluginChildrenStart;
|
|
@@ -13309,7 +13299,7 @@ function DefaultHomePage(t0) {
|
|
|
13309
13299
|
const sectionProps = {
|
|
13310
13300
|
context
|
|
13311
13301
|
};
|
|
13312
|
-
t143 = customizationController.plugins.filter(_temp4$
|
|
13302
|
+
t143 = customizationController.plugins.filter(_temp4$2).map((plugin_0, i) => {
|
|
13313
13303
|
const section = plugin_0.homePage.includeSection(sectionProps);
|
|
13314
13304
|
return /* @__PURE__ */ jsx(NavigationGroup, { group: section.title, children: section.children }, `plugin_section_${plugin_0.key}`);
|
|
13315
13305
|
});
|
|
@@ -13330,7 +13320,7 @@ function DefaultHomePage(t0) {
|
|
|
13330
13320
|
additionalPluginSections = t153;
|
|
13331
13321
|
let t162;
|
|
13332
13322
|
if ($[34] !== customizationController.plugins) {
|
|
13333
|
-
t162 = customizationController.plugins.filter(_temp5$
|
|
13323
|
+
t162 = customizationController.plugins.filter(_temp5$2).map(_temp6$2);
|
|
13334
13324
|
$[34] = customizationController.plugins;
|
|
13335
13325
|
$[35] = t162;
|
|
13336
13326
|
} else {
|
|
@@ -13347,7 +13337,7 @@ function DefaultHomePage(t0) {
|
|
|
13347
13337
|
additionalPluginChildrenStart = t172;
|
|
13348
13338
|
let t18;
|
|
13349
13339
|
if ($[38] !== customizationController.plugins) {
|
|
13350
|
-
t18 = customizationController.plugins.filter(_temp7).map(_temp8);
|
|
13340
|
+
t18 = customizationController.plugins.filter(_temp7$1).map(_temp8);
|
|
13351
13341
|
$[38] = customizationController.plugins;
|
|
13352
13342
|
$[39] = t18;
|
|
13353
13343
|
} else {
|
|
@@ -13535,19 +13525,19 @@ function DefaultHomePage(t0) {
|
|
|
13535
13525
|
function _temp8(plugin_4, i_1) {
|
|
13536
13526
|
return /* @__PURE__ */ jsx("div", { children: plugin_4.homePage.additionalChildrenEnd }, `plugin_children_start_${i_1}`);
|
|
13537
13527
|
}
|
|
13538
|
-
function _temp7(plugin_3) {
|
|
13528
|
+
function _temp7$1(plugin_3) {
|
|
13539
13529
|
return plugin_3.homePage?.additionalChildrenEnd;
|
|
13540
13530
|
}
|
|
13541
|
-
function _temp6$
|
|
13531
|
+
function _temp6$2(plugin_2, i_0) {
|
|
13542
13532
|
return /* @__PURE__ */ jsx("div", { children: plugin_2.homePage.additionalChildrenStart }, `plugin_children_start_${i_0}`);
|
|
13543
13533
|
}
|
|
13544
|
-
function _temp5$
|
|
13534
|
+
function _temp5$2(plugin_1) {
|
|
13545
13535
|
return plugin_1.homePage?.additionalChildrenStart;
|
|
13546
13536
|
}
|
|
13547
|
-
function _temp4$
|
|
13537
|
+
function _temp4$2(plugin) {
|
|
13548
13538
|
return plugin.homePage?.includeSection;
|
|
13549
13539
|
}
|
|
13550
|
-
function _temp3$
|
|
13540
|
+
function _temp3$3(e_1) {
|
|
13551
13541
|
return !e_1.group;
|
|
13552
13542
|
}
|
|
13553
13543
|
function _temp2$5(entry) {
|
|
@@ -13899,7 +13889,9 @@ function CustomIdField({
|
|
|
13899
13889
|
] }) : void 0
|
|
13900
13890
|
};
|
|
13901
13891
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13902
|
-
enumValues && /* @__PURE__ */ jsx(Select, { size: "large", error, fullWidth: true, onValueChange: (v) =>
|
|
13892
|
+
enumValues && /* @__PURE__ */ jsx(Select, { size: "large", error, fullWidth: true, onValueChange: (v) => {
|
|
13893
|
+
onChange(v);
|
|
13894
|
+
}, ...fieldProps, renderValue: (option) => {
|
|
13903
13895
|
const enumConfig = enumValues.find((e_1) => e_1.id === option);
|
|
13904
13896
|
if (!enumConfig) return option;
|
|
13905
13897
|
return `${enumConfig.id} - ${enumConfig.label}`;
|
|
@@ -14967,7 +14959,7 @@ function SelectFieldBinding(t0) {
|
|
|
14967
14959
|
}
|
|
14968
14960
|
let t13;
|
|
14969
14961
|
if ($[20] !== disabled || $[21] !== handleClearClick || $[22] !== property.clearable) {
|
|
14970
|
-
t13 = property.clearable && !disabled && /* @__PURE__ */ jsx(IconButton, { onClick: handleClearClick, children: /* @__PURE__ */ jsx(CloseIcon, {}) });
|
|
14962
|
+
t13 = property.clearable && !disabled && /* @__PURE__ */ jsx(IconButton, { size: "small", onClick: handleClearClick, children: /* @__PURE__ */ jsx(CloseIcon, { size: "small" }) });
|
|
14971
14963
|
$[20] = disabled;
|
|
14972
14964
|
$[21] = handleClearClick;
|
|
14973
14965
|
$[22] = property.clearable;
|
|
@@ -15080,7 +15072,7 @@ function MultiSelectFieldBinding({
|
|
|
15080
15072
|
] }, enumKey);
|
|
15081
15073
|
}, [enumValues, setValue, value]);
|
|
15082
15074
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
15083
|
-
/* @__PURE__ */ jsx(MultiSelect, { className: "w-full mt-2", size, value: validValue ? value.map((v_0) => v_0
|
|
15075
|
+
/* @__PURE__ */ jsx(MultiSelect, { className: "w-full mt-2", size, value: validValue ? value.map((v_0) => v_0?.toString()) : [], disabled, modalPopover: true, label: /* @__PURE__ */ jsx(LabelWithIconAndTooltip, { propertyKey, icon: getIconForProperty(property, "small"), required: property.validation?.required, title: property.name, className: "h-8 text-text-secondary dark:text-text-secondary-dark ml-3.5" }), onValueChange: (updatedValue) => {
|
|
15084
15076
|
let newValue;
|
|
15085
15077
|
if (of && of?.dataType === "number") {
|
|
15086
15078
|
newValue = updatedValue ? updatedValue.map((e_1) => parseFloat(e_1)) : [];
|
|
@@ -15410,15 +15402,161 @@ function StorageUploadFieldBinding(t0) {
|
|
|
15410
15402
|
}
|
|
15411
15403
|
return t12;
|
|
15412
15404
|
}
|
|
15405
|
+
function SortableStorageItem(t0) {
|
|
15406
|
+
const $ = c(35);
|
|
15407
|
+
const {
|
|
15408
|
+
id,
|
|
15409
|
+
entry,
|
|
15410
|
+
property,
|
|
15411
|
+
metadata,
|
|
15412
|
+
storagePathBuilder,
|
|
15413
|
+
onFileUploadComplete,
|
|
15414
|
+
onClear,
|
|
15415
|
+
disabled
|
|
15416
|
+
} = t0;
|
|
15417
|
+
let t1;
|
|
15418
|
+
if ($[0] !== id) {
|
|
15419
|
+
t1 = {
|
|
15420
|
+
id
|
|
15421
|
+
};
|
|
15422
|
+
$[0] = id;
|
|
15423
|
+
$[1] = t1;
|
|
15424
|
+
} else {
|
|
15425
|
+
t1 = $[1];
|
|
15426
|
+
}
|
|
15427
|
+
const {
|
|
15428
|
+
attributes,
|
|
15429
|
+
listeners: listeners2,
|
|
15430
|
+
setNodeRef,
|
|
15431
|
+
transform,
|
|
15432
|
+
transition,
|
|
15433
|
+
isDragging
|
|
15434
|
+
} = useSortable(t1);
|
|
15435
|
+
let t2;
|
|
15436
|
+
if ($[2] !== transform) {
|
|
15437
|
+
t2 = CSS.Transform.toString(transform);
|
|
15438
|
+
$[2] = transform;
|
|
15439
|
+
$[3] = t2;
|
|
15440
|
+
} else {
|
|
15441
|
+
t2 = $[3];
|
|
15442
|
+
}
|
|
15443
|
+
const t3 = isDragging ? 100 : void 0;
|
|
15444
|
+
const t4 = isDragging ? 0.8 : 1;
|
|
15445
|
+
let t5;
|
|
15446
|
+
if ($[4] !== t2 || $[5] !== t3 || $[6] !== t4 || $[7] !== transition) {
|
|
15447
|
+
t5 = {
|
|
15448
|
+
transform: t2,
|
|
15449
|
+
transition,
|
|
15450
|
+
zIndex: t3,
|
|
15451
|
+
opacity: t4
|
|
15452
|
+
};
|
|
15453
|
+
$[4] = t2;
|
|
15454
|
+
$[5] = t3;
|
|
15455
|
+
$[6] = t4;
|
|
15456
|
+
$[7] = transition;
|
|
15457
|
+
$[8] = t5;
|
|
15458
|
+
} else {
|
|
15459
|
+
t5 = $[8];
|
|
15460
|
+
}
|
|
15461
|
+
const style = t5;
|
|
15462
|
+
const getImageSizeNumber = _temp$a;
|
|
15463
|
+
let child;
|
|
15464
|
+
if (entry.storagePathOrDownloadUrl) {
|
|
15465
|
+
const t62 = `storage_preview_${entry.storagePathOrDownloadUrl}`;
|
|
15466
|
+
let t72;
|
|
15467
|
+
if ($[9] !== entry.storagePathOrDownloadUrl || $[10] !== onClear) {
|
|
15468
|
+
t72 = () => onClear(entry.storagePathOrDownloadUrl);
|
|
15469
|
+
$[9] = entry.storagePathOrDownloadUrl;
|
|
15470
|
+
$[10] = onClear;
|
|
15471
|
+
$[11] = t72;
|
|
15472
|
+
} else {
|
|
15473
|
+
t72 = $[11];
|
|
15474
|
+
}
|
|
15475
|
+
let t8;
|
|
15476
|
+
if ($[12] !== disabled || $[13] !== entry.size || $[14] !== entry.storagePathOrDownloadUrl || $[15] !== property || $[16] !== t62 || $[17] !== t72) {
|
|
15477
|
+
t8 = /* @__PURE__ */ jsx(StorageItemPreview, { name: t62, property, disabled, value: entry.storagePathOrDownloadUrl, onRemove: t72, size: entry.size });
|
|
15478
|
+
$[12] = disabled;
|
|
15479
|
+
$[13] = entry.size;
|
|
15480
|
+
$[14] = entry.storagePathOrDownloadUrl;
|
|
15481
|
+
$[15] = property;
|
|
15482
|
+
$[16] = t62;
|
|
15483
|
+
$[17] = t72;
|
|
15484
|
+
$[18] = t8;
|
|
15485
|
+
} else {
|
|
15486
|
+
t8 = $[18];
|
|
15487
|
+
}
|
|
15488
|
+
child = t8;
|
|
15489
|
+
} else {
|
|
15490
|
+
if (entry.file) {
|
|
15491
|
+
let t62;
|
|
15492
|
+
if ($[19] !== entry.file || $[20] !== storagePathBuilder) {
|
|
15493
|
+
t62 = storagePathBuilder(entry.file);
|
|
15494
|
+
$[19] = entry.file;
|
|
15495
|
+
$[20] = storagePathBuilder;
|
|
15496
|
+
$[21] = t62;
|
|
15497
|
+
} else {
|
|
15498
|
+
t62 = $[21];
|
|
15499
|
+
}
|
|
15500
|
+
const t72 = getImageSizeNumber(entry.size);
|
|
15501
|
+
let t8;
|
|
15502
|
+
if ($[22] !== entry || $[23] !== metadata || $[24] !== onFileUploadComplete || $[25] !== t62 || $[26] !== t72) {
|
|
15503
|
+
t8 = /* @__PURE__ */ jsx(StorageUploadProgress, { entry, metadata, storagePath: t62, onFileUploadComplete, imageSize: t72, simple: false });
|
|
15504
|
+
$[22] = entry;
|
|
15505
|
+
$[23] = metadata;
|
|
15506
|
+
$[24] = onFileUploadComplete;
|
|
15507
|
+
$[25] = t62;
|
|
15508
|
+
$[26] = t72;
|
|
15509
|
+
$[27] = t8;
|
|
15510
|
+
} else {
|
|
15511
|
+
t8 = $[27];
|
|
15512
|
+
}
|
|
15513
|
+
child = t8;
|
|
15514
|
+
}
|
|
15515
|
+
}
|
|
15516
|
+
let t6;
|
|
15517
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15518
|
+
t6 = cls("rounded-md m-1");
|
|
15519
|
+
$[28] = t6;
|
|
15520
|
+
} else {
|
|
15521
|
+
t6 = $[28];
|
|
15522
|
+
}
|
|
15523
|
+
let t7;
|
|
15524
|
+
if ($[29] !== attributes || $[30] !== child || $[31] !== listeners2 || $[32] !== setNodeRef || $[33] !== style) {
|
|
15525
|
+
t7 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners2, className: t6, tabIndex: -1, children: child });
|
|
15526
|
+
$[29] = attributes;
|
|
15527
|
+
$[30] = child;
|
|
15528
|
+
$[31] = listeners2;
|
|
15529
|
+
$[32] = setNodeRef;
|
|
15530
|
+
$[33] = style;
|
|
15531
|
+
$[34] = t7;
|
|
15532
|
+
} else {
|
|
15533
|
+
t7 = $[34];
|
|
15534
|
+
}
|
|
15535
|
+
return t7;
|
|
15536
|
+
}
|
|
15537
|
+
function _temp$a(previewSize) {
|
|
15538
|
+
switch (previewSize) {
|
|
15539
|
+
case "small": {
|
|
15540
|
+
return 40;
|
|
15541
|
+
}
|
|
15542
|
+
case "medium": {
|
|
15543
|
+
return 118;
|
|
15544
|
+
}
|
|
15545
|
+
case "large": {
|
|
15546
|
+
return 220;
|
|
15547
|
+
}
|
|
15548
|
+
default: {
|
|
15549
|
+
return 118;
|
|
15550
|
+
}
|
|
15551
|
+
}
|
|
15552
|
+
}
|
|
15413
15553
|
function FileDropComponent(t0) {
|
|
15414
|
-
const $ = c(
|
|
15554
|
+
const $ = c(63);
|
|
15415
15555
|
const {
|
|
15416
15556
|
storage,
|
|
15417
15557
|
disabled,
|
|
15418
|
-
isDraggingOver,
|
|
15419
15558
|
onFilesAdded,
|
|
15420
15559
|
multipleFilesSupported,
|
|
15421
|
-
droppableProvided,
|
|
15422
15560
|
autoFocus,
|
|
15423
15561
|
internalValue,
|
|
15424
15562
|
property,
|
|
@@ -15426,23 +15564,23 @@ function FileDropComponent(t0) {
|
|
|
15426
15564
|
metadata,
|
|
15427
15565
|
storagePathBuilder,
|
|
15428
15566
|
onFileUploadComplete,
|
|
15429
|
-
size,
|
|
15430
15567
|
name,
|
|
15431
|
-
helpText
|
|
15568
|
+
helpText,
|
|
15569
|
+
isDndItemDragging
|
|
15432
15570
|
} = t0;
|
|
15433
15571
|
const snackbarContext = useSnackbarController();
|
|
15434
15572
|
let t1;
|
|
15435
15573
|
if ($[0] !== storage.acceptedFiles) {
|
|
15436
|
-
t1 = storage.acceptedFiles ? storage.acceptedFiles.
|
|
15574
|
+
t1 = storage.acceptedFiles ? storage.acceptedFiles.reduce(_temp2$4, {}) : void 0;
|
|
15437
15575
|
$[0] = storage.acceptedFiles;
|
|
15438
15576
|
$[1] = t1;
|
|
15439
15577
|
} else {
|
|
15440
15578
|
t1 = $[1];
|
|
15441
15579
|
}
|
|
15442
|
-
const t2 = disabled ||
|
|
15580
|
+
const t2 = disabled || isDndItemDragging;
|
|
15443
15581
|
let t3;
|
|
15444
15582
|
if ($[2] !== snackbarContext || $[3] !== storage.maxSize) {
|
|
15445
|
-
t3 = (fileRejections
|
|
15583
|
+
t3 = (fileRejections) => {
|
|
15446
15584
|
for (const fileRejection of fileRejections) {
|
|
15447
15585
|
for (const error of fileRejection.errors) {
|
|
15448
15586
|
console.error("Error uploading file: ", error);
|
|
@@ -15504,170 +15642,154 @@ function FileDropComponent(t0) {
|
|
|
15504
15642
|
}
|
|
15505
15643
|
const t6 = disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin;
|
|
15506
15644
|
const t7 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
|
|
15507
|
-
const t8 = multipleFilesSupported && internalValue.length
|
|
15645
|
+
const t8 = multipleFilesSupported && internalValue.length === 0 && "flex";
|
|
15508
15646
|
const t9 = !isDragActive;
|
|
15509
|
-
|
|
15510
|
-
|
|
15511
|
-
|
|
15647
|
+
const t10 = disabled || isDndItemDragging;
|
|
15648
|
+
let t11;
|
|
15649
|
+
if ($[13] !== isDragAccept || $[14] !== isDragActive || $[15] !== isDragReject || $[16] !== t10 || $[17] !== t6 || $[18] !== t7 || $[19] !== t8 || $[20] !== t9) {
|
|
15650
|
+
t11 = cls(fieldBackgroundMixin, t6, t7, dropZoneClasses, t8, {
|
|
15512
15651
|
[nonActiveDropClasses]: t9,
|
|
15513
15652
|
[activeDropClasses]: isDragActive,
|
|
15514
15653
|
[rejectDropClasses]: isDragReject,
|
|
15515
15654
|
[acceptDropClasses]: isDragAccept,
|
|
15516
|
-
[disabledClasses]:
|
|
15655
|
+
[disabledClasses]: t10
|
|
15517
15656
|
});
|
|
15518
|
-
$[13] =
|
|
15519
|
-
$[14] =
|
|
15520
|
-
$[15] =
|
|
15521
|
-
$[16] =
|
|
15657
|
+
$[13] = isDragAccept;
|
|
15658
|
+
$[14] = isDragActive;
|
|
15659
|
+
$[15] = isDragReject;
|
|
15660
|
+
$[16] = t10;
|
|
15522
15661
|
$[17] = t6;
|
|
15523
15662
|
$[18] = t7;
|
|
15524
15663
|
$[19] = t8;
|
|
15525
15664
|
$[20] = t9;
|
|
15526
|
-
$[21] =
|
|
15527
|
-
} else {
|
|
15528
|
-
t10 = $[21];
|
|
15529
|
-
}
|
|
15530
|
-
const t11 = droppableProvided.droppableProps;
|
|
15531
|
-
const t12 = droppableProvided.innerRef;
|
|
15532
|
-
const t13 = multipleFilesSupported && internalValue.length ? "overflow-auto" : "";
|
|
15533
|
-
const t14 = multipleFilesSupported && internalValue.length ? "min-h-[180px]" : "min-h-[250px]";
|
|
15534
|
-
let t15;
|
|
15535
|
-
if ($[22] !== t13 || $[23] !== t14) {
|
|
15536
|
-
t15 = cls("flex items-center p-1 no-scrollbar", t13, t14);
|
|
15537
|
-
$[22] = t13;
|
|
15538
|
-
$[23] = t14;
|
|
15539
|
-
$[24] = t15;
|
|
15665
|
+
$[21] = t11;
|
|
15540
15666
|
} else {
|
|
15541
|
-
|
|
15667
|
+
t11 = $[21];
|
|
15542
15668
|
}
|
|
15669
|
+
const t12 = multipleFilesSupported && internalValue.length ? "flex-row overflow-x-auto" : "flex-col";
|
|
15670
|
+
const t13 = internalValue.length === 0 && "min-h-[250px] justify-center";
|
|
15671
|
+
const t14 = multipleFilesSupported && internalValue.length > 0 && "min-h-[180px]";
|
|
15672
|
+
const t15 = !multipleFilesSupported && internalValue.length > 0 && "min-h-[250px]";
|
|
15543
15673
|
let t16;
|
|
15544
|
-
if ($[25] !==
|
|
15545
|
-
t16 =
|
|
15546
|
-
$[
|
|
15674
|
+
if ($[22] !== t12 || $[23] !== t13 || $[24] !== t14 || $[25] !== t15) {
|
|
15675
|
+
t16 = cls("flex items-center p-1 no-scrollbar", t12, t13, t14, t15);
|
|
15676
|
+
$[22] = t12;
|
|
15677
|
+
$[23] = t13;
|
|
15678
|
+
$[24] = t14;
|
|
15679
|
+
$[25] = t15;
|
|
15547
15680
|
$[26] = t16;
|
|
15548
15681
|
} else {
|
|
15549
15682
|
t16 = $[26];
|
|
15550
15683
|
}
|
|
15551
15684
|
let t17;
|
|
15552
|
-
if ($[27] !==
|
|
15553
|
-
t17 =
|
|
15554
|
-
$[27] =
|
|
15555
|
-
$[28] =
|
|
15556
|
-
$[29] = t17;
|
|
15685
|
+
if ($[27] !== getInputProps) {
|
|
15686
|
+
t17 = getInputProps();
|
|
15687
|
+
$[27] = getInputProps;
|
|
15688
|
+
$[28] = t17;
|
|
15557
15689
|
} else {
|
|
15558
|
-
t17 = $[
|
|
15690
|
+
t17 = $[28];
|
|
15559
15691
|
}
|
|
15560
15692
|
let t18;
|
|
15561
|
-
if ($[
|
|
15562
|
-
|
|
15563
|
-
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
} else {
|
|
15569
|
-
if (entry.file) {
|
|
15570
|
-
child = /* @__PURE__ */ jsx(StorageUploadProgress, { entry, metadata, storagePath: storagePathBuilder(entry.file), onFileUploadComplete, imageSize: size === "large" ? 220 : 118, simple: false });
|
|
15571
|
-
}
|
|
15572
|
-
}
|
|
15573
|
-
return /* @__PURE__ */ jsx(Draggable, { draggableId: `array_field_${name}_${entry.id}`, index, children: (provided, snapshot) => /* @__PURE__ */ jsx("div", { tabIndex: -1, ref: provided.innerRef, ...provided.draggableProps, ...provided.dragHandleProps, className: cls("rounded-md"), style: {
|
|
15574
|
-
...provided.draggableProps.style
|
|
15575
|
-
}, children: child }) }, `array_field_${name}_${entry.id}`);
|
|
15576
|
-
};
|
|
15577
|
-
$[40] = disabled;
|
|
15578
|
-
$[41] = metadata;
|
|
15579
|
-
$[42] = name;
|
|
15580
|
-
$[43] = onClear;
|
|
15581
|
-
$[44] = onFileUploadComplete;
|
|
15582
|
-
$[45] = property;
|
|
15583
|
-
$[46] = size;
|
|
15584
|
-
$[47] = storagePathBuilder;
|
|
15585
|
-
$[48] = t192;
|
|
15586
|
-
} else {
|
|
15587
|
-
t192 = $[48];
|
|
15588
|
-
}
|
|
15589
|
-
t18 = internalValue.map(t192);
|
|
15590
|
-
$[30] = disabled;
|
|
15591
|
-
$[31] = internalValue;
|
|
15592
|
-
$[32] = metadata;
|
|
15593
|
-
$[33] = name;
|
|
15594
|
-
$[34] = onClear;
|
|
15595
|
-
$[35] = onFileUploadComplete;
|
|
15596
|
-
$[36] = property;
|
|
15597
|
-
$[37] = size;
|
|
15598
|
-
$[38] = storagePathBuilder;
|
|
15599
|
-
$[39] = t18;
|
|
15600
|
-
} else {
|
|
15601
|
-
t18 = $[39];
|
|
15693
|
+
if ($[29] !== autoFocus || $[30] !== t17) {
|
|
15694
|
+
t18 = /* @__PURE__ */ jsx("input", { autoFocus, ...t17 });
|
|
15695
|
+
$[29] = autoFocus;
|
|
15696
|
+
$[30] = t17;
|
|
15697
|
+
$[31] = t18;
|
|
15698
|
+
} else {
|
|
15699
|
+
t18 = $[31];
|
|
15602
15700
|
}
|
|
15603
15701
|
let t19;
|
|
15604
|
-
if ($[
|
|
15605
|
-
|
|
15606
|
-
|
|
15702
|
+
if ($[32] !== disabled || $[33] !== internalValue || $[34] !== metadata || $[35] !== multipleFilesSupported || $[36] !== name || $[37] !== onClear || $[38] !== onFileUploadComplete || $[39] !== property || $[40] !== storagePathBuilder) {
|
|
15703
|
+
let t202;
|
|
15704
|
+
if ($[42] !== disabled || $[43] !== metadata || $[44] !== multipleFilesSupported || $[45] !== name || $[46] !== onClear || $[47] !== onFileUploadComplete || $[48] !== property || $[49] !== storagePathBuilder) {
|
|
15705
|
+
t202 = (entry) => /* @__PURE__ */ jsx(SortableStorageItem, { id: entry.id, entry, property, name, metadata, storagePathBuilder, onFileUploadComplete, onClear, disabled, isSortable: multipleFilesSupported }, entry.id);
|
|
15706
|
+
$[42] = disabled;
|
|
15707
|
+
$[43] = metadata;
|
|
15708
|
+
$[44] = multipleFilesSupported;
|
|
15709
|
+
$[45] = name;
|
|
15710
|
+
$[46] = onClear;
|
|
15711
|
+
$[47] = onFileUploadComplete;
|
|
15712
|
+
$[48] = property;
|
|
15713
|
+
$[49] = storagePathBuilder;
|
|
15714
|
+
$[50] = t202;
|
|
15715
|
+
} else {
|
|
15716
|
+
t202 = $[50];
|
|
15717
|
+
}
|
|
15718
|
+
t19 = internalValue.map(t202);
|
|
15719
|
+
$[32] = disabled;
|
|
15720
|
+
$[33] = internalValue;
|
|
15721
|
+
$[34] = metadata;
|
|
15722
|
+
$[35] = multipleFilesSupported;
|
|
15723
|
+
$[36] = name;
|
|
15724
|
+
$[37] = onClear;
|
|
15725
|
+
$[38] = onFileUploadComplete;
|
|
15726
|
+
$[39] = property;
|
|
15727
|
+
$[40] = storagePathBuilder;
|
|
15728
|
+
$[41] = t19;
|
|
15729
|
+
} else {
|
|
15730
|
+
t19 = $[41];
|
|
15731
|
+
}
|
|
15732
|
+
let t20;
|
|
15733
|
+
if ($[51] !== t16 || $[52] !== t18 || $[53] !== t19) {
|
|
15734
|
+
t20 = /* @__PURE__ */ jsxs("div", { className: t16, children: [
|
|
15607
15735
|
t18,
|
|
15608
|
-
|
|
15736
|
+
t19
|
|
15609
15737
|
] });
|
|
15610
|
-
$[
|
|
15611
|
-
$[
|
|
15612
|
-
$[
|
|
15613
|
-
$[
|
|
15614
|
-
$[53] = t17;
|
|
15615
|
-
$[54] = t18;
|
|
15616
|
-
$[55] = t19;
|
|
15738
|
+
$[51] = t16;
|
|
15739
|
+
$[52] = t18;
|
|
15740
|
+
$[53] = t19;
|
|
15741
|
+
$[54] = t20;
|
|
15617
15742
|
} else {
|
|
15618
|
-
|
|
15743
|
+
t20 = $[54];
|
|
15619
15744
|
}
|
|
15620
|
-
const
|
|
15621
|
-
let
|
|
15622
|
-
if ($[
|
|
15623
|
-
|
|
15624
|
-
$[
|
|
15625
|
-
$[
|
|
15626
|
-
$[
|
|
15745
|
+
const t21 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
|
|
15746
|
+
let t22;
|
|
15747
|
+
if ($[55] !== helpText || $[56] !== t21) {
|
|
15748
|
+
t22 = /* @__PURE__ */ jsx("div", { className: "flex-grow min-h-[38px] box-border m-2 text-center", children: /* @__PURE__ */ jsx(Typography, { align: "center", variant: "label", className: t21, children: helpText }) });
|
|
15749
|
+
$[55] = helpText;
|
|
15750
|
+
$[56] = t21;
|
|
15751
|
+
$[57] = t22;
|
|
15627
15752
|
} else {
|
|
15628
|
-
|
|
15753
|
+
t22 = $[57];
|
|
15629
15754
|
}
|
|
15630
|
-
let
|
|
15631
|
-
if ($[
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15755
|
+
let t23;
|
|
15756
|
+
if ($[58] !== t11 || $[59] !== t20 || $[60] !== t22 || $[61] !== t5) {
|
|
15757
|
+
t23 = /* @__PURE__ */ jsxs("div", { ...t5, className: t11, children: [
|
|
15758
|
+
t20,
|
|
15759
|
+
t22
|
|
15635
15760
|
] });
|
|
15636
|
-
$[
|
|
15637
|
-
$[
|
|
15638
|
-
$[
|
|
15639
|
-
$[
|
|
15640
|
-
$[
|
|
15761
|
+
$[58] = t11;
|
|
15762
|
+
$[59] = t20;
|
|
15763
|
+
$[60] = t22;
|
|
15764
|
+
$[61] = t5;
|
|
15765
|
+
$[62] = t23;
|
|
15641
15766
|
} else {
|
|
15642
|
-
|
|
15767
|
+
t23 = $[62];
|
|
15643
15768
|
}
|
|
15644
|
-
return
|
|
15645
|
-
}
|
|
15646
|
-
function _temp2$4(a, b) {
|
|
15647
|
-
return {
|
|
15648
|
-
...a,
|
|
15649
|
-
...b
|
|
15650
|
-
};
|
|
15769
|
+
return t23;
|
|
15651
15770
|
}
|
|
15652
|
-
function
|
|
15771
|
+
function _temp2$4(acc, ext) {
|
|
15653
15772
|
return {
|
|
15654
|
-
|
|
15773
|
+
...acc,
|
|
15774
|
+
[ext]: []
|
|
15655
15775
|
};
|
|
15656
15776
|
}
|
|
15657
|
-
function StorageUpload({
|
|
15658
|
-
|
|
15659
|
-
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15777
|
+
function StorageUpload(t0) {
|
|
15778
|
+
const $ = c(44);
|
|
15779
|
+
const {
|
|
15780
|
+
property,
|
|
15781
|
+
name,
|
|
15782
|
+
value,
|
|
15783
|
+
setInternalValue,
|
|
15784
|
+
onChange,
|
|
15785
|
+
multipleFilesSupported,
|
|
15786
|
+
onFileUploadComplete,
|
|
15787
|
+
disabled,
|
|
15788
|
+
onFilesAdded,
|
|
15789
|
+
autoFocus,
|
|
15790
|
+
storage,
|
|
15791
|
+
storagePathBuilder
|
|
15792
|
+
} = t0;
|
|
15671
15793
|
if (multipleFilesSupported) {
|
|
15672
15794
|
const arrayProperty = property;
|
|
15673
15795
|
if (arrayProperty.of) {
|
|
@@ -15682,41 +15804,208 @@ function StorageUpload({
|
|
|
15682
15804
|
}
|
|
15683
15805
|
}
|
|
15684
15806
|
const metadata = storage?.metadata;
|
|
15685
|
-
const
|
|
15686
|
-
|
|
15687
|
-
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
}
|
|
15700
|
-
|
|
15701
|
-
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15807
|
+
const [isDndItemDragging, setIsDndItemDragging] = useState(false);
|
|
15808
|
+
let t1;
|
|
15809
|
+
if ($[0] !== multipleFilesSupported || $[1] !== onChange || $[2] !== setInternalValue || $[3] !== value) {
|
|
15810
|
+
t1 = (fromIndex, toIndex) => {
|
|
15811
|
+
if (!multipleFilesSupported || fromIndex === toIndex) {
|
|
15812
|
+
return;
|
|
15813
|
+
}
|
|
15814
|
+
const newValue = [...value];
|
|
15815
|
+
const item = newValue[fromIndex];
|
|
15816
|
+
newValue.splice(fromIndex, 1);
|
|
15817
|
+
newValue.splice(toIndex, 0, item);
|
|
15818
|
+
setInternalValue(newValue);
|
|
15819
|
+
const fieldValue = newValue.filter(_temp3$2).map(_temp4$1);
|
|
15820
|
+
onChange(fieldValue);
|
|
15821
|
+
};
|
|
15822
|
+
$[0] = multipleFilesSupported;
|
|
15823
|
+
$[1] = onChange;
|
|
15824
|
+
$[2] = setInternalValue;
|
|
15825
|
+
$[3] = value;
|
|
15826
|
+
$[4] = t1;
|
|
15827
|
+
} else {
|
|
15828
|
+
t1 = $[4];
|
|
15829
|
+
}
|
|
15830
|
+
const moveItem = t1;
|
|
15831
|
+
let t2;
|
|
15832
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15833
|
+
t2 = {
|
|
15834
|
+
activationConstraint: {
|
|
15835
|
+
distance: 5
|
|
15836
|
+
}
|
|
15837
|
+
};
|
|
15838
|
+
$[5] = t2;
|
|
15839
|
+
} else {
|
|
15840
|
+
t2 = $[5];
|
|
15841
|
+
}
|
|
15842
|
+
let t3;
|
|
15843
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15844
|
+
t3 = {
|
|
15845
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
15846
|
+
};
|
|
15847
|
+
$[6] = t3;
|
|
15848
|
+
} else {
|
|
15849
|
+
t3 = $[6];
|
|
15850
|
+
}
|
|
15851
|
+
const sensors = useSensors(useSensor(PointerSensor, t2), useSensor(KeyboardSensor, t3));
|
|
15852
|
+
let t4;
|
|
15853
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15854
|
+
t4 = (event) => {
|
|
15855
|
+
setIsDndItemDragging(true);
|
|
15856
|
+
};
|
|
15857
|
+
$[7] = t4;
|
|
15858
|
+
} else {
|
|
15859
|
+
t4 = $[7];
|
|
15860
|
+
}
|
|
15861
|
+
const handleDragStart = t4;
|
|
15862
|
+
let t5;
|
|
15863
|
+
if ($[8] !== moveItem || $[9] !== value) {
|
|
15864
|
+
t5 = (event_0) => {
|
|
15865
|
+
setIsDndItemDragging(false);
|
|
15866
|
+
const {
|
|
15867
|
+
active,
|
|
15868
|
+
over
|
|
15869
|
+
} = event_0;
|
|
15870
|
+
if (over && active.id !== over.id) {
|
|
15871
|
+
const oldIndex = value.findIndex((item_0) => item_0.id === active.id);
|
|
15872
|
+
const newIndex = value.findIndex((item_1) => item_1.id === over.id);
|
|
15873
|
+
if (oldIndex !== -1 && newIndex !== -1) {
|
|
15874
|
+
moveItem(oldIndex, newIndex);
|
|
15875
|
+
}
|
|
15876
|
+
}
|
|
15877
|
+
};
|
|
15878
|
+
$[8] = moveItem;
|
|
15879
|
+
$[9] = value;
|
|
15880
|
+
$[10] = t5;
|
|
15881
|
+
} else {
|
|
15882
|
+
t5 = $[10];
|
|
15883
|
+
}
|
|
15884
|
+
const handleDragEnd = t5;
|
|
15885
|
+
let t6;
|
|
15886
|
+
if ($[11] !== multipleFilesSupported || $[12] !== onChange || $[13] !== setInternalValue || $[14] !== value) {
|
|
15887
|
+
t6 = (clearedStoragePathOrDownloadUrl) => {
|
|
15888
|
+
let newValue_0;
|
|
15889
|
+
if (multipleFilesSupported) {
|
|
15890
|
+
newValue_0 = value.filter((v) => v.storagePathOrDownloadUrl !== clearedStoragePathOrDownloadUrl);
|
|
15891
|
+
onChange(newValue_0.filter(_temp5$1).map(_temp6$1));
|
|
15892
|
+
} else {
|
|
15893
|
+
newValue_0 = [];
|
|
15894
|
+
onChange(null);
|
|
15895
|
+
}
|
|
15706
15896
|
setInternalValue(newValue_0);
|
|
15897
|
+
};
|
|
15898
|
+
$[11] = multipleFilesSupported;
|
|
15899
|
+
$[12] = onChange;
|
|
15900
|
+
$[13] = setInternalValue;
|
|
15901
|
+
$[14] = value;
|
|
15902
|
+
$[15] = t6;
|
|
15903
|
+
} else {
|
|
15904
|
+
t6 = $[15];
|
|
15905
|
+
}
|
|
15906
|
+
const onClear = t6;
|
|
15907
|
+
const helpText = multipleFilesSupported ? "Drag 'n' drop some files here, or click to select files. Drag to reorder." : "Drag 'n' drop a file here, or click to select one";
|
|
15908
|
+
const renderProperty = multipleFilesSupported ? property.of : property;
|
|
15909
|
+
let t7;
|
|
15910
|
+
if ($[16] !== autoFocus || $[17] !== disabled || $[18] !== helpText || $[19] !== isDndItemDragging || $[20] !== metadata || $[21] !== multipleFilesSupported || $[22] !== name || $[23] !== onClear || $[24] !== onFileUploadComplete || $[25] !== onFilesAdded || $[26] !== renderProperty || $[27] !== storage || $[28] !== storagePathBuilder || $[29] !== value) {
|
|
15911
|
+
t7 = {
|
|
15912
|
+
storage,
|
|
15913
|
+
disabled,
|
|
15914
|
+
onFilesAdded,
|
|
15915
|
+
multipleFilesSupported,
|
|
15916
|
+
autoFocus,
|
|
15917
|
+
internalValue: value,
|
|
15918
|
+
property: renderProperty,
|
|
15919
|
+
onClear,
|
|
15920
|
+
metadata,
|
|
15921
|
+
storagePathBuilder,
|
|
15922
|
+
onFileUploadComplete,
|
|
15923
|
+
name,
|
|
15924
|
+
helpText,
|
|
15925
|
+
isDndItemDragging
|
|
15926
|
+
};
|
|
15927
|
+
$[16] = autoFocus;
|
|
15928
|
+
$[17] = disabled;
|
|
15929
|
+
$[18] = helpText;
|
|
15930
|
+
$[19] = isDndItemDragging;
|
|
15931
|
+
$[20] = metadata;
|
|
15932
|
+
$[21] = multipleFilesSupported;
|
|
15933
|
+
$[22] = name;
|
|
15934
|
+
$[23] = onClear;
|
|
15935
|
+
$[24] = onFileUploadComplete;
|
|
15936
|
+
$[25] = onFilesAdded;
|
|
15937
|
+
$[26] = renderProperty;
|
|
15938
|
+
$[27] = storage;
|
|
15939
|
+
$[28] = storagePathBuilder;
|
|
15940
|
+
$[29] = value;
|
|
15941
|
+
$[30] = t7;
|
|
15942
|
+
} else {
|
|
15943
|
+
t7 = $[30];
|
|
15944
|
+
}
|
|
15945
|
+
const fileDropProps = t7;
|
|
15946
|
+
if (multipleFilesSupported) {
|
|
15947
|
+
let t8;
|
|
15948
|
+
if ($[31] !== value) {
|
|
15949
|
+
t8 = value.map(_temp7);
|
|
15950
|
+
$[31] = value;
|
|
15951
|
+
$[32] = t8;
|
|
15707
15952
|
} else {
|
|
15708
|
-
|
|
15709
|
-
setInternalValue([]);
|
|
15953
|
+
t8 = $[32];
|
|
15710
15954
|
}
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15955
|
+
let t9;
|
|
15956
|
+
if ($[33] !== fileDropProps) {
|
|
15957
|
+
t9 = /* @__PURE__ */ jsx(FileDropComponent, { ...fileDropProps });
|
|
15958
|
+
$[33] = fileDropProps;
|
|
15959
|
+
$[34] = t9;
|
|
15960
|
+
} else {
|
|
15961
|
+
t9 = $[34];
|
|
15962
|
+
}
|
|
15963
|
+
let t10;
|
|
15964
|
+
if ($[35] !== t8 || $[36] !== t9) {
|
|
15965
|
+
t10 = /* @__PURE__ */ jsx(SortableContext, { items: t8, strategy: horizontalListSortingStrategy, children: t9 });
|
|
15966
|
+
$[35] = t8;
|
|
15967
|
+
$[36] = t9;
|
|
15968
|
+
$[37] = t10;
|
|
15969
|
+
} else {
|
|
15970
|
+
t10 = $[37];
|
|
15971
|
+
}
|
|
15972
|
+
let t11;
|
|
15973
|
+
if ($[38] !== handleDragEnd || $[39] !== sensors || $[40] !== t10) {
|
|
15974
|
+
t11 = /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: t10 });
|
|
15975
|
+
$[38] = handleDragEnd;
|
|
15976
|
+
$[39] = sensors;
|
|
15977
|
+
$[40] = t10;
|
|
15978
|
+
$[41] = t11;
|
|
15979
|
+
} else {
|
|
15980
|
+
t11 = $[41];
|
|
15981
|
+
}
|
|
15982
|
+
return t11;
|
|
15983
|
+
} else {
|
|
15984
|
+
let t8;
|
|
15985
|
+
if ($[42] !== fileDropProps) {
|
|
15986
|
+
t8 = /* @__PURE__ */ jsx(FileDropComponent, { ...fileDropProps, isDndItemDragging: false });
|
|
15987
|
+
$[42] = fileDropProps;
|
|
15988
|
+
$[43] = t8;
|
|
15989
|
+
} else {
|
|
15990
|
+
t8 = $[43];
|
|
15991
|
+
}
|
|
15992
|
+
return t8;
|
|
15993
|
+
}
|
|
15994
|
+
}
|
|
15995
|
+
function _temp7(v_2) {
|
|
15996
|
+
return v_2.id;
|
|
15997
|
+
}
|
|
15998
|
+
function _temp6$1(v_1) {
|
|
15999
|
+
return v_1.storagePathOrDownloadUrl;
|
|
16000
|
+
}
|
|
16001
|
+
function _temp5$1(v_0) {
|
|
16002
|
+
return !!v_0.storagePathOrDownloadUrl;
|
|
16003
|
+
}
|
|
16004
|
+
function _temp4$1(e_0) {
|
|
16005
|
+
return e_0.storagePathOrDownloadUrl;
|
|
16006
|
+
}
|
|
16007
|
+
function _temp3$2(e) {
|
|
16008
|
+
return !!e.storagePathOrDownloadUrl;
|
|
15720
16009
|
}
|
|
15721
16010
|
function TextFieldBinding(t0) {
|
|
15722
16011
|
const $ = c(52);
|
|
@@ -18918,7 +19207,7 @@ const EntityCollectionView = React__default.memo(function EntityCollectionView2(
|
|
|
18918
19207
|
deleteEntityClicked && /* @__PURE__ */ jsx(DeleteEntityDialog, { entityOrEntitiesToDelete: deleteEntityClicked, path: fullPath, collection, callbacks: collection.callbacks, open: Boolean(deleteEntityClicked), onEntityDelete: internalOnEntityDelete, onMultipleEntitiesDelete: internalOnMultipleEntitiesDelete, onClose: () => setDeleteEntityClicked(void 0) })
|
|
18919
19208
|
] });
|
|
18920
19209
|
}, (a, b) => {
|
|
18921
|
-
return equal(a.path, b.path) && equal(a.parentCollectionIds, b.parentCollectionIds) && equal(a.isSubCollection, b.isSubCollection) && equal(a.className, b.className) && equal(a.properties, b.properties) && equal(a.propertiesOrder, b.propertiesOrder) && equal(a.hideIdFromCollection, b.hideIdFromCollection) && equal(a.inlineEditing, b.inlineEditing) && equal(a.selectionEnabled, b.selectionEnabled) && equal(a.selectionController, b.selectionController) && equal(a.Actions, b.Actions) && equal(a.defaultSize, b.defaultSize) && equal(a.initialFilter, b.initialFilter) && equal(a.initialSort, b.initialSort) && equal(a.textSearchEnabled, b.textSearchEnabled) && equal(a.additionalFields, b.additionalFields) && equal(a.sideDialogWidth, b.sideDialogWidth) && equal(a.openEntityMode, b.openEntityMode) && equal(a.exportable, b.exportable) && equal(a.history, b.history) && equal(a.forceFilter, b.forceFilter);
|
|
19210
|
+
return equal(a.path, b.path) && equal(a.parentCollectionIds, b.parentCollectionIds) && equal(a.isSubCollection, b.isSubCollection) && equal(a.className, b.className) && equal(a.properties, b.properties) && equal(a.propertiesOrder, b.propertiesOrder) && equal(a.hideIdFromCollection, b.hideIdFromCollection) && equal(a.inlineEditing, b.inlineEditing) && equal(a.selectionEnabled, b.selectionEnabled) && equal(a.selectionController, b.selectionController) && equal(a.Actions, b.Actions) && equal(a.defaultSize, b.defaultSize) && equal(a.initialFilter, b.initialFilter) && equal(a.initialSort, b.initialSort) && equal(a.includeJsonView, b.includeJsonView) && equal(a.textSearchEnabled, b.textSearchEnabled) && equal(a.additionalFields, b.additionalFields) && equal(a.sideDialogWidth, b.sideDialogWidth) && equal(a.openEntityMode, b.openEntityMode) && equal(a.exportable, b.exportable) && equal(a.history, b.history) && equal(a.forceFilter, b.forceFilter);
|
|
18922
19211
|
});
|
|
18923
19212
|
function EntitiesCount({
|
|
18924
19213
|
fullPath,
|
|
@@ -19649,227 +19938,182 @@ const buildIdsMap = (value) => value && Array.isArray(value) && value.length > 0
|
|
|
19649
19938
|
...a,
|
|
19650
19939
|
...b
|
|
19651
19940
|
}), {}) : {};
|
|
19652
|
-
function
|
|
19653
|
-
|
|
19654
|
-
|
|
19655
|
-
|
|
19656
|
-
disabled
|
|
19941
|
+
function SortableItem({
|
|
19942
|
+
id,
|
|
19943
|
+
index,
|
|
19944
|
+
size,
|
|
19945
|
+
disabled,
|
|
19657
19946
|
buildEntry,
|
|
19658
|
-
|
|
19659
|
-
|
|
19660
|
-
|
|
19661
|
-
canAddElements
|
|
19662
|
-
sortable
|
|
19663
|
-
|
|
19664
|
-
|
|
19665
|
-
className,
|
|
19666
|
-
min = 0,
|
|
19667
|
-
max = Infinity
|
|
19947
|
+
remove,
|
|
19948
|
+
copy,
|
|
19949
|
+
addInIndex,
|
|
19950
|
+
canAddElements,
|
|
19951
|
+
sortable,
|
|
19952
|
+
storedProps,
|
|
19953
|
+
updateItemCustomProps
|
|
19668
19954
|
}) {
|
|
19669
|
-
const
|
|
19670
|
-
|
|
19671
|
-
|
|
19672
|
-
|
|
19673
|
-
|
|
19674
|
-
|
|
19675
|
-
|
|
19676
|
-
}
|
|
19677
|
-
|
|
19678
|
-
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
19683
|
-
|
|
19684
|
-
|
|
19685
|
-
|
|
19686
|
-
return newInternalId;
|
|
19687
|
-
}
|
|
19688
|
-
});
|
|
19689
|
-
setInternalIds(newInternalIds);
|
|
19690
|
-
}
|
|
19691
|
-
}, [hasValue, internalIds.length, value]);
|
|
19692
|
-
const insertInEnd = (e) => {
|
|
19693
|
-
e.preventDefault();
|
|
19694
|
-
if (disabled || (value ?? []).length >= max) return;
|
|
19695
|
-
const id = getRandomId();
|
|
19696
|
-
const newIds = [...internalIds, id];
|
|
19697
|
-
if (onInternalIdAdded) onInternalIdAdded(id);
|
|
19698
|
-
setInternalIds(newIds);
|
|
19699
|
-
onValueChange([...value ?? [], newDefaultEntry]);
|
|
19700
|
-
};
|
|
19701
|
-
const remove = (index_0) => {
|
|
19702
|
-
if ((value ?? []).length <= min) return;
|
|
19703
|
-
const newIds_0 = [...internalIds];
|
|
19704
|
-
newIds_0.splice(index_0, 1);
|
|
19705
|
-
setInternalIds(newIds_0);
|
|
19706
|
-
onValueChange(value.filter((_, i) => i !== index_0));
|
|
19707
|
-
};
|
|
19708
|
-
const copy = (index_1) => {
|
|
19709
|
-
if ((value ?? []).length >= max) return;
|
|
19710
|
-
const id_0 = getRandomId();
|
|
19711
|
-
const copyingItem = value[index_1];
|
|
19712
|
-
const newIds_1 = [...internalIds.slice(0, index_1 + 1), id_0, ...internalIds.slice(index_1 + 1)];
|
|
19713
|
-
if (onInternalIdAdded) onInternalIdAdded(id_0);
|
|
19714
|
-
setInternalIds(newIds_1);
|
|
19715
|
-
onValueChange([...value.slice(0, index_1 + 1), copyingItem, ...value.slice(index_1 + 1)]);
|
|
19716
|
-
};
|
|
19717
|
-
const addInIndex = (index_2) => {
|
|
19718
|
-
if ((value ?? []).length >= max) return;
|
|
19719
|
-
const id_1 = getRandomId();
|
|
19720
|
-
const newIds_2 = [...internalIds.slice(0, index_2), id_1, ...internalIds.slice(index_2)];
|
|
19721
|
-
if (onInternalIdAdded) onInternalIdAdded(id_1);
|
|
19722
|
-
setInternalIds(newIds_2);
|
|
19723
|
-
onValueChange([...value.slice(0, index_2), newDefaultEntry, ...value.slice(index_2)]);
|
|
19724
|
-
};
|
|
19725
|
-
const onDragEnd = (result) => {
|
|
19726
|
-
if (!result.destination) {
|
|
19727
|
-
return;
|
|
19728
|
-
}
|
|
19729
|
-
const sourceIndex = result.source.index;
|
|
19730
|
-
const destinationIndex = result.destination.index;
|
|
19731
|
-
const newIds_3 = [...internalIds];
|
|
19732
|
-
const temp = newIds_3[sourceIndex];
|
|
19733
|
-
newIds_3[sourceIndex] = newIds_3[destinationIndex];
|
|
19734
|
-
newIds_3[destinationIndex] = temp;
|
|
19735
|
-
setInternalIds(newIds_3);
|
|
19736
|
-
onValueChange(arrayMove(value, sourceIndex, destinationIndex));
|
|
19955
|
+
const {
|
|
19956
|
+
attributes,
|
|
19957
|
+
listeners: listeners2,
|
|
19958
|
+
setNodeRef,
|
|
19959
|
+
transform,
|
|
19960
|
+
transition,
|
|
19961
|
+
isDragging
|
|
19962
|
+
} = sortable ? useSortable({
|
|
19963
|
+
id
|
|
19964
|
+
}) : {
|
|
19965
|
+
attributes: {},
|
|
19966
|
+
listeners: {},
|
|
19967
|
+
setNodeRef: (node) => {
|
|
19968
|
+
},
|
|
19969
|
+
transform: null,
|
|
19970
|
+
transition: void 0,
|
|
19971
|
+
isDragging: false
|
|
19737
19972
|
};
|
|
19738
|
-
|
|
19739
|
-
|
|
19740
|
-
|
|
19741
|
-
|
|
19742
|
-
|
|
19743
|
-
|
|
19744
|
-
|
|
19745
|
-
|
|
19746
|
-
|
|
19747
|
-
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 >= max, startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: insertInEnd, children: addLabel ?? "Add" }) })
|
|
19748
|
-
] }) }) });
|
|
19973
|
+
const style = transform ? {
|
|
19974
|
+
transform: CSS.Transform.toString(transform),
|
|
19975
|
+
transition
|
|
19976
|
+
} : {};
|
|
19977
|
+
const dragHandleProps = sortable ? {
|
|
19978
|
+
...listeners2,
|
|
19979
|
+
...attributes
|
|
19980
|
+
} : {};
|
|
19981
|
+
return /* @__PURE__ */ jsx(ArrayContainerItem, { nodeRef: setNodeRef, style, dragHandleProps, internalId: id, index, size, disabled, buildEntry, remove, copy, addInIndex, canAddElements, sortable, isDragging, storedProps, updateItemCustomProps });
|
|
19749
19982
|
}
|
|
19750
19983
|
function ArrayContainerItem(t0) {
|
|
19751
19984
|
const $ = c(30);
|
|
19752
19985
|
const {
|
|
19753
|
-
|
|
19986
|
+
nodeRef,
|
|
19987
|
+
style,
|
|
19988
|
+
dragHandleProps,
|
|
19754
19989
|
index,
|
|
19755
19990
|
internalId,
|
|
19756
19991
|
size,
|
|
19757
19992
|
disabled,
|
|
19758
19993
|
buildEntry,
|
|
19759
19994
|
remove,
|
|
19995
|
+
copy,
|
|
19760
19996
|
addInIndex,
|
|
19761
19997
|
canAddElements,
|
|
19762
19998
|
sortable,
|
|
19763
|
-
copy,
|
|
19764
19999
|
isDragging,
|
|
19765
20000
|
storedProps,
|
|
19766
20001
|
updateItemCustomProps
|
|
19767
20002
|
} = t0;
|
|
19768
|
-
const t1 =
|
|
19769
|
-
|
|
19770
|
-
const t3 = provided.draggableProps.style;
|
|
19771
|
-
const t4 = `relative ${!isDragging ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 dark:hover:bg-opacity-20" : ""} rounded-md opacity-100`;
|
|
19772
|
-
let t5;
|
|
20003
|
+
const t1 = `relative ${!isDragging ? "hover\\:bg-surface-accent-50 dark\\:hover\\:bg-surface-800 dark\\:hover\\:bg-opacity-20" : ""} rounded-md opacity-100`;
|
|
20004
|
+
let t2;
|
|
19773
20005
|
if ($[0] !== internalId || $[1] !== updateItemCustomProps) {
|
|
19774
|
-
|
|
20006
|
+
t2 = (props) => updateItemCustomProps(internalId, props);
|
|
19775
20007
|
$[0] = internalId;
|
|
19776
20008
|
$[1] = updateItemCustomProps;
|
|
19777
|
-
$[2] =
|
|
20009
|
+
$[2] = t2;
|
|
19778
20010
|
} else {
|
|
19779
|
-
|
|
20011
|
+
t2 = $[2];
|
|
19780
20012
|
}
|
|
19781
|
-
let
|
|
19782
|
-
if ($[3] !== buildEntry || $[4] !== index || $[5] !== internalId || $[6] !== isDragging || $[7] !== storedProps || $[8] !==
|
|
19783
|
-
|
|
20013
|
+
let t3;
|
|
20014
|
+
if ($[3] !== buildEntry || $[4] !== index || $[5] !== internalId || $[6] !== isDragging || $[7] !== storedProps || $[8] !== t2) {
|
|
20015
|
+
t3 = buildEntry({
|
|
19784
20016
|
index,
|
|
19785
20017
|
internalId,
|
|
19786
20018
|
isDragging,
|
|
19787
20019
|
storedProps,
|
|
19788
|
-
storeProps:
|
|
20020
|
+
storeProps: t2
|
|
19789
20021
|
});
|
|
19790
20022
|
$[3] = buildEntry;
|
|
19791
20023
|
$[4] = index;
|
|
19792
20024
|
$[5] = internalId;
|
|
19793
20025
|
$[6] = isDragging;
|
|
19794
20026
|
$[7] = storedProps;
|
|
19795
|
-
$[8] =
|
|
19796
|
-
$[9] =
|
|
20027
|
+
$[8] = t2;
|
|
20028
|
+
$[9] = t3;
|
|
19797
20029
|
} else {
|
|
19798
|
-
|
|
20030
|
+
t3 = $[9];
|
|
19799
20031
|
}
|
|
19800
|
-
let
|
|
19801
|
-
if ($[10] !==
|
|
19802
|
-
|
|
19803
|
-
$[10] =
|
|
19804
|
-
$[11] =
|
|
20032
|
+
let t4;
|
|
20033
|
+
if ($[10] !== t3) {
|
|
20034
|
+
t4 = /* @__PURE__ */ jsx("div", { className: "flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark", children: t3 });
|
|
20035
|
+
$[10] = t3;
|
|
20036
|
+
$[11] = t4;
|
|
19805
20037
|
} else {
|
|
19806
|
-
|
|
20038
|
+
t4 = $[11];
|
|
19807
20039
|
}
|
|
19808
|
-
const
|
|
19809
|
-
let
|
|
19810
|
-
if ($[12] !== addInIndex || $[13] !== canAddElements || $[14] !== copy || $[15] !== disabled || $[16] !==
|
|
19811
|
-
|
|
20040
|
+
const t5 = size === "small" ? "row" : "column";
|
|
20041
|
+
let t6;
|
|
20042
|
+
if ($[12] !== addInIndex || $[13] !== canAddElements || $[14] !== copy || $[15] !== disabled || $[16] !== dragHandleProps || $[17] !== index || $[18] !== remove || $[19] !== sortable || $[20] !== t5) {
|
|
20043
|
+
t6 = /* @__PURE__ */ jsx(ArrayItemOptions, { dragHandleProps, direction: t5, disabled, remove, index, copy, canAddElements, sortable, addInIndex });
|
|
19812
20044
|
$[12] = addInIndex;
|
|
19813
20045
|
$[13] = canAddElements;
|
|
19814
20046
|
$[14] = copy;
|
|
19815
20047
|
$[15] = disabled;
|
|
19816
|
-
$[16] =
|
|
19817
|
-
$[17] =
|
|
20048
|
+
$[16] = dragHandleProps;
|
|
20049
|
+
$[17] = index;
|
|
19818
20050
|
$[18] = remove;
|
|
19819
20051
|
$[19] = sortable;
|
|
19820
|
-
$[20] =
|
|
19821
|
-
$[21] =
|
|
20052
|
+
$[20] = t5;
|
|
20053
|
+
$[21] = t6;
|
|
19822
20054
|
} else {
|
|
19823
|
-
|
|
20055
|
+
t6 = $[21];
|
|
19824
20056
|
}
|
|
19825
|
-
let
|
|
19826
|
-
if ($[22] !==
|
|
19827
|
-
|
|
19828
|
-
|
|
19829
|
-
|
|
20057
|
+
let t7;
|
|
20058
|
+
if ($[22] !== t4 || $[23] !== t6) {
|
|
20059
|
+
t7 = /* @__PURE__ */ jsxs("div", { className: "flex items-start", children: [
|
|
20060
|
+
t4,
|
|
20061
|
+
t6
|
|
19830
20062
|
] });
|
|
19831
|
-
$[22] =
|
|
19832
|
-
$[23] =
|
|
19833
|
-
$[24] =
|
|
20063
|
+
$[22] = t4;
|
|
20064
|
+
$[23] = t6;
|
|
20065
|
+
$[24] = t7;
|
|
19834
20066
|
} else {
|
|
19835
|
-
|
|
20067
|
+
t7 = $[24];
|
|
19836
20068
|
}
|
|
19837
|
-
let
|
|
19838
|
-
if ($[25] !==
|
|
19839
|
-
|
|
19840
|
-
$[25] =
|
|
19841
|
-
$[26] =
|
|
19842
|
-
$[27] =
|
|
19843
|
-
$[28] =
|
|
19844
|
-
$[29] =
|
|
20069
|
+
let t8;
|
|
20070
|
+
if ($[25] !== nodeRef || $[26] !== style || $[27] !== t1 || $[28] !== t7) {
|
|
20071
|
+
t8 = /* @__PURE__ */ jsx("div", { ref: nodeRef, style, className: t1, children: t7 });
|
|
20072
|
+
$[25] = nodeRef;
|
|
20073
|
+
$[26] = style;
|
|
20074
|
+
$[27] = t1;
|
|
20075
|
+
$[28] = t7;
|
|
20076
|
+
$[29] = t8;
|
|
19845
20077
|
} else {
|
|
19846
|
-
|
|
20078
|
+
t8 = $[29];
|
|
19847
20079
|
}
|
|
19848
|
-
return
|
|
20080
|
+
return t8;
|
|
19849
20081
|
}
|
|
19850
20082
|
function ArrayItemOptions({
|
|
20083
|
+
dragHandleProps,
|
|
19851
20084
|
direction,
|
|
19852
20085
|
disabled,
|
|
19853
20086
|
remove,
|
|
19854
20087
|
index,
|
|
19855
|
-
provided,
|
|
19856
20088
|
copy,
|
|
19857
20089
|
canAddElements,
|
|
19858
20090
|
sortable,
|
|
19859
20091
|
addInIndex
|
|
19860
20092
|
}) {
|
|
19861
20093
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
19862
|
-
const iconRef =
|
|
19863
|
-
useOutsideAlerter(iconRef, () =>
|
|
19864
|
-
|
|
19865
|
-
|
|
20094
|
+
const iconRef = useRef(null);
|
|
20095
|
+
useOutsideAlerter(iconRef, () => {
|
|
20096
|
+
if (menuOpen) setMenuOpen(false);
|
|
20097
|
+
});
|
|
20098
|
+
const showMenu = canAddElements ?? false;
|
|
20099
|
+
const handleIconButtonClick = (e) => {
|
|
20100
|
+
if (showMenu) {
|
|
20101
|
+
e.stopPropagation();
|
|
19866
20102
|
e.preventDefault();
|
|
19867
|
-
setMenuOpen(
|
|
19868
|
-
}
|
|
19869
|
-
|
|
19870
|
-
|
|
19871
|
-
|
|
19872
|
-
|
|
20103
|
+
setMenuOpen((o) => !o);
|
|
20104
|
+
} else if (sortable) ;
|
|
20105
|
+
else {
|
|
20106
|
+
e.stopPropagation();
|
|
20107
|
+
e.preventDefault();
|
|
20108
|
+
}
|
|
20109
|
+
};
|
|
20110
|
+
const title = !disabled && sortable && showMenu ? "Drag to move. Click for options" : !disabled && showMenu ? "Click for options" : !disabled && sortable ? "Drag to move" : void 0;
|
|
20111
|
+
return /* @__PURE__ */ jsxs("div", { ref: iconRef, className: `pl-2 pt-1 pb-1 flex ${direction === "row" ? "flex-row-reverse" : "flex-col"} items-center`, children: [
|
|
20112
|
+
/* @__PURE__ */ jsx(Tooltip, { delayDuration: 400, open: menuOpen ? false : void 0, side: direction === "column" ? "left" : void 0, title, children: /* @__PURE__ */ jsx(IconButton, { size: "small", disabled: disabled || !showMenu && !sortable, ...sortable ? dragHandleProps : {}, onClick: handleIconButtonClick, onFocus: () => {
|
|
20113
|
+
if (sortable && menuOpen) setMenuOpen(false);
|
|
20114
|
+
}, className: cls(disabled || !sortable && !showMenu ? "cursor-inherit" : "", sortable && !disabled ? "cursor-grab" : "", !sortable && showMenu && !disabled ? "cursor-pointer" : ""), children: /* @__PURE__ */ jsx(HandleIcon, {}) }) }),
|
|
20115
|
+
showMenu && /* @__PURE__ */ jsxs(Menu, { portalContainer: iconRef.current, open: menuOpen, trigger: /* @__PURE__ */ jsx("div", { tabIndex: -1 }), children: [
|
|
20116
|
+
/* @__PURE__ */ jsxs(MenuItem, { dense: true, onClick: (e_0) => {
|
|
19873
20117
|
setMenuOpen(false);
|
|
19874
20118
|
remove(index);
|
|
19875
20119
|
}, children: [
|
|
@@ -19898,7 +20142,110 @@ function ArrayItemOptions({
|
|
|
19898
20142
|
"Add below"
|
|
19899
20143
|
] })
|
|
19900
20144
|
] })
|
|
19901
|
-
] })
|
|
20145
|
+
] });
|
|
20146
|
+
}
|
|
20147
|
+
function ArrayContainer({
|
|
20148
|
+
droppableId,
|
|
20149
|
+
addLabel,
|
|
20150
|
+
value,
|
|
20151
|
+
disabled = false,
|
|
20152
|
+
buildEntry,
|
|
20153
|
+
size = "medium",
|
|
20154
|
+
onInternalIdAdded,
|
|
20155
|
+
includeAddButton: deprecatedIncludeAddButton,
|
|
20156
|
+
canAddElements: canAddElementsProp = true,
|
|
20157
|
+
sortable = true,
|
|
20158
|
+
newDefaultEntry,
|
|
20159
|
+
onValueChange,
|
|
20160
|
+
className,
|
|
20161
|
+
min = 0,
|
|
20162
|
+
max = Infinity
|
|
20163
|
+
}) {
|
|
20164
|
+
const canAddElements = (canAddElementsProp === void 0 ? true : canAddElementsProp) && // Default canAddElementsProp to true if undefined
|
|
20165
|
+
(deprecatedIncludeAddButton === void 0 || deprecatedIncludeAddButton);
|
|
20166
|
+
const hasValue = value && Array.isArray(value) && value.length > 0;
|
|
20167
|
+
const internalIdsRef = useRef(buildIdsMap(value));
|
|
20168
|
+
const [internalIds, setInternalIds] = useState(hasValue ? Object.values(internalIdsRef.current) : []);
|
|
20169
|
+
const itemCustomPropsRef = useRef({});
|
|
20170
|
+
const updateItemCustomProps = useCallback((internalId, customProps) => {
|
|
20171
|
+
itemCustomPropsRef.current[internalId] = customProps;
|
|
20172
|
+
}, []);
|
|
20173
|
+
const pointerSensor = useSensor(PointerSensor, {
|
|
20174
|
+
activationConstraint: {
|
|
20175
|
+
distance: 5
|
|
20176
|
+
}
|
|
20177
|
+
});
|
|
20178
|
+
const keyboardSensor = useSensor(KeyboardSensor, {});
|
|
20179
|
+
const sensors = useSensors(pointerSensor, keyboardSensor);
|
|
20180
|
+
useEffect(() => {
|
|
20181
|
+
if (hasValue && value && value.length !== internalIds.length) {
|
|
20182
|
+
const newInternalIds = value.map((v, index) => {
|
|
20183
|
+
const hashValue = getHashValue(v) + index;
|
|
20184
|
+
if (hashValue in internalIdsRef.current) {
|
|
20185
|
+
return internalIdsRef.current[hashValue];
|
|
20186
|
+
} else {
|
|
20187
|
+
const newInternalId = getRandomId();
|
|
20188
|
+
internalIdsRef.current[hashValue] = newInternalId;
|
|
20189
|
+
return newInternalId;
|
|
20190
|
+
}
|
|
20191
|
+
});
|
|
20192
|
+
setInternalIds(newInternalIds);
|
|
20193
|
+
}
|
|
20194
|
+
}, [hasValue, internalIds.length, value]);
|
|
20195
|
+
const insertInEnd = (e) => {
|
|
20196
|
+
e.preventDefault();
|
|
20197
|
+
if (disabled || (value ?? []).length >= max) return;
|
|
20198
|
+
const id = getRandomId();
|
|
20199
|
+
const newIds = [...internalIds, id];
|
|
20200
|
+
if (onInternalIdAdded) onInternalIdAdded(id);
|
|
20201
|
+
setInternalIds(newIds);
|
|
20202
|
+
onValueChange([...value ?? [], newDefaultEntry]);
|
|
20203
|
+
};
|
|
20204
|
+
const remove = (index_0) => {
|
|
20205
|
+
if ((value ?? []).length <= min) return;
|
|
20206
|
+
const newIds_0 = [...internalIds];
|
|
20207
|
+
newIds_0.splice(index_0, 1);
|
|
20208
|
+
setInternalIds(newIds_0);
|
|
20209
|
+
onValueChange(value.filter((_, i) => i !== index_0));
|
|
20210
|
+
};
|
|
20211
|
+
const copy = (index_1) => {
|
|
20212
|
+
if ((value ?? []).length >= max) return;
|
|
20213
|
+
const id_0 = getRandomId();
|
|
20214
|
+
const copyingItem = value[index_1];
|
|
20215
|
+
const newIds_1 = [...internalIds.slice(0, index_1 + 1), id_0, ...internalIds.slice(index_1 + 1)];
|
|
20216
|
+
if (onInternalIdAdded) onInternalIdAdded(id_0);
|
|
20217
|
+
setInternalIds(newIds_1);
|
|
20218
|
+
onValueChange([...value.slice(0, index_1 + 1), copyingItem, ...value.slice(index_1 + 1)]);
|
|
20219
|
+
};
|
|
20220
|
+
const addInIndex = (index_2) => {
|
|
20221
|
+
if ((value ?? []).length >= max) return;
|
|
20222
|
+
const id_1 = getRandomId();
|
|
20223
|
+
const newIds_2 = [...internalIds.slice(0, index_2), id_1, ...internalIds.slice(index_2)];
|
|
20224
|
+
if (onInternalIdAdded) onInternalIdAdded(id_1);
|
|
20225
|
+
setInternalIds(newIds_2);
|
|
20226
|
+
onValueChange([...value.slice(0, index_2), newDefaultEntry, ...value.slice(index_2)]);
|
|
20227
|
+
};
|
|
20228
|
+
const onDragEnd = (event) => {
|
|
20229
|
+
const {
|
|
20230
|
+
active,
|
|
20231
|
+
over
|
|
20232
|
+
} = event;
|
|
20233
|
+
if (!over || active.id === over.id) return;
|
|
20234
|
+
const oldIndex = internalIds.indexOf(active.id);
|
|
20235
|
+
const newIndex = internalIds.indexOf(over.id);
|
|
20236
|
+
if (oldIndex === -1 || newIndex === -1) return;
|
|
20237
|
+
const newIds_3 = arrayMove(internalIds, oldIndex, newIndex);
|
|
20238
|
+
setInternalIds(newIds_3);
|
|
20239
|
+
onValueChange(arrayMove(value, oldIndex, newIndex));
|
|
20240
|
+
};
|
|
20241
|
+
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: [
|
|
20242
|
+
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}`)),
|
|
20243
|
+
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" }) })
|
|
20244
|
+
] }) }) }) : /* @__PURE__ */ jsxs("div", { className: cls("space-y-1", className), id: droppableId, children: [
|
|
20245
|
+
hasValue && internalIds.map((internalId_1, index_4) => /* @__PURE__ */ jsx(ArrayContainerItem, { nodeRef: (node) => {
|
|
20246
|
+
}, 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}`)),
|
|
20247
|
+
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" }) })
|
|
20248
|
+
] });
|
|
19902
20249
|
}
|
|
19903
20250
|
function arrayMove(value, sourceIndex, destinationIndex) {
|
|
19904
20251
|
const result = Array.from(value);
|
|
@@ -21509,7 +21856,7 @@ function EntityEditViewInner({
|
|
|
21509
21856
|
};
|
|
21510
21857
|
return /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "relative flex-1 w-full h-full overflow-auto", {
|
|
21511
21858
|
"hidden": selectedTab !== customView.key
|
|
21512
|
-
}), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: usedFormContext && /* @__PURE__ */ jsx(Builder, { collection, entity: usedEntity, modifiedValues: usedFormContext?.formex?.values ?? usedEntity?.values, formContext: usedFormContext }) }) }, `custom_view_${customView.key}`);
|
|
21859
|
+
}), role: "tabpanel", children: /* @__PURE__ */ jsx(ErrorBoundary, { children: usedFormContext && /* @__PURE__ */ jsx(Builder, { collection, parentCollectionIds, entity: usedEntity, modifiedValues: usedFormContext?.formex?.values ?? usedEntity?.values, formContext: usedFormContext }) }) }, `custom_view_${customView.key}`);
|
|
21513
21860
|
}).filter(Boolean);
|
|
21514
21861
|
const globalLoading = dataLoading && !usedEntity;
|
|
21515
21862
|
const jsonView = /* @__PURE__ */ jsx("div", { className: cls("relative flex-1 h-full overflow-auto w-full", {
|
|
@@ -21639,17 +21986,7 @@ function EntitySidePanel(props) {
|
|
|
21639
21986
|
const parentCollectionIds = useMemo(() => {
|
|
21640
21987
|
return navigationController.getParentCollectionIds(path);
|
|
21641
21988
|
}, [navigationController, path]);
|
|
21642
|
-
const collection =
|
|
21643
|
-
if (props.collection) {
|
|
21644
|
-
return props.collection;
|
|
21645
|
-
}
|
|
21646
|
-
const registryCollection = navigationController.getCollection(path);
|
|
21647
|
-
if (registryCollection) {
|
|
21648
|
-
return registryCollection;
|
|
21649
|
-
}
|
|
21650
|
-
console.error("ERROR: No collection found in path `", path, "`. Entity id: ", entityId);
|
|
21651
|
-
throw Error("ERROR: No collection found in path `" + path + "`. Make sure you have defined a collection for this path in the root navigation.");
|
|
21652
|
-
}, [navigationController, props.collection]);
|
|
21989
|
+
const collection = props.collection ?? navigationController.getCollection(path);
|
|
21653
21990
|
useEffect(() => {
|
|
21654
21991
|
function beforeunload(e) {
|
|
21655
21992
|
if (blocked && collection) {
|