@firecms/core 3.0.0-canary.242 → 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 +705 -370
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +713 -381
- 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/HomePage/DefaultHomePage.tsx +1 -0
- package/src/components/VirtualTable/VirtualTable.tsx +0 -26
- package/src/components/VirtualTable/VirtualTableProps.tsx +0 -5
- 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/StorageUploadFieldBinding.tsx +222 -154
- 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
|
}
|
|
@@ -10609,8 +10612,7 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10609
10612
|
className,
|
|
10610
10613
|
endAdornment,
|
|
10611
10614
|
AddColumnComponent,
|
|
10612
|
-
initialScroll = 0
|
|
10613
|
-
debug
|
|
10615
|
+
initialScroll = 0
|
|
10614
10616
|
}) {
|
|
10615
10617
|
const sortByProperty = sortBy ? sortBy[0] : void 0;
|
|
10616
10618
|
const currentSort = sortBy ? sortBy[1] : void 0;
|
|
@@ -10654,11 +10656,9 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10654
10656
|
offsetSize: true
|
|
10655
10657
|
});
|
|
10656
10658
|
const onColumnResizeInternal = useCallback((params) => {
|
|
10657
|
-
if (debug) console.log("onColumnResizeInternal", params);
|
|
10658
10659
|
setColumns((prevColumns) => prevColumns.map((column) => column.key === params.column.key ? params.column : column));
|
|
10659
10660
|
}, []);
|
|
10660
10661
|
const onColumnResizeEndInternal = useCallback((params_0) => {
|
|
10661
|
-
if (debug) console.log("onColumnResizeEndInternal", params_0);
|
|
10662
10662
|
setColumns(columns.map((column_0) => column_0.key === params_0.column.key ? params_0.column : column_0));
|
|
10663
10663
|
if (onColumnResize) {
|
|
10664
10664
|
onColumnResize(params_0);
|
|
@@ -10666,18 +10666,15 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10666
10666
|
}, [columns, onColumnResize]);
|
|
10667
10667
|
const filterRef = useRef();
|
|
10668
10668
|
useEffect(() => {
|
|
10669
|
-
if (debug) console.log("Filter updated", filterInput);
|
|
10670
10669
|
filterRef.current = filterInput;
|
|
10671
10670
|
}, [filterInput]);
|
|
10672
10671
|
const scrollToTop = useCallback(() => {
|
|
10673
|
-
if (debug) console.log("scrollToTop");
|
|
10674
10672
|
endReachCallbackThreshold.current = 0;
|
|
10675
10673
|
if (tableRef.current) {
|
|
10676
10674
|
tableRef.current.scrollTo(tableRef.current?.scrollLeft, 0);
|
|
10677
10675
|
}
|
|
10678
10676
|
}, []);
|
|
10679
10677
|
const onColumnSort = useCallback((key) => {
|
|
10680
|
-
if (debug) console.log("onColumnSort", key);
|
|
10681
10678
|
const isDesc = sortByProperty === key && currentSort === "desc";
|
|
10682
10679
|
const isAsc = sortByProperty === key && currentSort === "asc";
|
|
10683
10680
|
const newSort = isAsc ? "desc" : isDesc ? void 0 : "asc";
|
|
@@ -10698,9 +10695,7 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10698
10695
|
scrollToTop();
|
|
10699
10696
|
}, [checkFilterCombination, currentSort, onFilterUpdate, onResetPagination, onSortByUpdate, scrollToTop, sortByProperty]);
|
|
10700
10697
|
const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);
|
|
10701
|
-
if (debug) console.log("maxScroll", maxScroll);
|
|
10702
10698
|
const onEndReachedInternal = useCallback((scrollOffset) => {
|
|
10703
|
-
if (debug) console.log("onEndReachedInternal", scrollOffset, endReachCallbackThreshold.current + endOffset);
|
|
10704
10699
|
if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + endOffset) {
|
|
10705
10700
|
endReachCallbackThreshold.current = scrollOffset;
|
|
10706
10701
|
onEndReached();
|
|
@@ -10711,11 +10706,6 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10711
10706
|
scrollOffset: scrollOffset_0,
|
|
10712
10707
|
scrollUpdateWasRequested
|
|
10713
10708
|
}) => {
|
|
10714
|
-
if (debug) console.log("onScroll", {
|
|
10715
|
-
scrollDirection,
|
|
10716
|
-
scrollOffset: scrollOffset_0,
|
|
10717
|
-
scrollUpdateWasRequested
|
|
10718
|
-
});
|
|
10719
10709
|
if (onScrollProp) {
|
|
10720
10710
|
debouncedScroll({
|
|
10721
10711
|
scrollDirection,
|
|
@@ -10726,7 +10716,6 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10726
10716
|
if (!scrollUpdateWasRequested && scrollOffset_0 >= maxScroll - endOffset) onEndReachedInternal(scrollOffset_0);
|
|
10727
10717
|
}, [maxScroll, onEndReachedInternal]);
|
|
10728
10718
|
const onFilterUpdateInternal = useCallback((column_1, filterForProperty) => {
|
|
10729
|
-
if (debug) console.log("onFilterUpdateInternal", column_1, filterForProperty);
|
|
10730
10719
|
endReachCallbackThreshold.current = 0;
|
|
10731
10720
|
const filter_0 = filterRef.current;
|
|
10732
10721
|
let newFilterValue = filter_0 ? {
|
|
@@ -10774,7 +10763,6 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10774
10763
|
endAdornment,
|
|
10775
10764
|
AddColumnComponent
|
|
10776
10765
|
};
|
|
10777
|
-
if (debug) console.log("VirtualTable render", virtualListController);
|
|
10778
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) }) });
|
|
10779
10767
|
}, equal);
|
|
10780
10768
|
function MemoizedList({
|
|
@@ -11110,8 +11098,8 @@ function StringNumberFilterField(t0) {
|
|
|
11110
11098
|
}
|
|
11111
11099
|
let t9;
|
|
11112
11100
|
if ($[34] !== dataType || $[35] !== enumValues || $[36] !== internalValue || $[37] !== multiple || $[38] !== name || $[39] !== operation || $[40] !== updateFilter) {
|
|
11113
|
-
t9 = enumValues && multiple && /* @__PURE__ */ jsx(MultiSelect, { position: "item-aligned", value: Array.isArray(internalValue) ? internalValue.map(_temp3$
|
|
11114
|
-
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);
|
|
11115
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}`)) });
|
|
11116
11104
|
$[34] = dataType;
|
|
11117
11105
|
$[35] = enumValues;
|
|
@@ -11174,10 +11162,10 @@ function StringNumberFilterField(t0) {
|
|
|
11174
11162
|
}
|
|
11175
11163
|
return t12;
|
|
11176
11164
|
}
|
|
11177
|
-
function _temp4$
|
|
11165
|
+
function _temp4$3(v) {
|
|
11178
11166
|
return parseInt(v);
|
|
11179
11167
|
}
|
|
11180
|
-
function _temp3$
|
|
11168
|
+
function _temp3$4(e_1) {
|
|
11181
11169
|
return String(e_1);
|
|
11182
11170
|
}
|
|
11183
11171
|
function _temp2$7(op_1) {
|
|
@@ -13301,7 +13289,7 @@ function DefaultHomePage(t0) {
|
|
|
13301
13289
|
if ($[7] !== additionalActions || $[8] !== additionalChildrenStart || $[9] !== containerRef || $[10] !== context || $[11] !== customizationController.plugins || $[12] !== direction || $[13] !== filteredNavigationEntries || $[14] !== filteredUrls || $[15] !== groups || $[16] !== performingSearch) {
|
|
13302
13290
|
const filteredGroups = filteredUrls ? filteredNavigationEntries.map(_temp2$5) : [];
|
|
13303
13291
|
const allGroups = filteredUrls ? filteredGroups.filter((group, index) => filteredGroups.indexOf(group) === index) : [...groups];
|
|
13304
|
-
if (filteredNavigationEntries.filter(_temp3$
|
|
13292
|
+
if (filteredNavigationEntries.filter(_temp3$3).length > 0 || filteredNavigationEntries.length === 0) {
|
|
13305
13293
|
allGroups.push(void 0);
|
|
13306
13294
|
}
|
|
13307
13295
|
let additionalPluginChildrenStart;
|
|
@@ -13311,7 +13299,7 @@ function DefaultHomePage(t0) {
|
|
|
13311
13299
|
const sectionProps = {
|
|
13312
13300
|
context
|
|
13313
13301
|
};
|
|
13314
|
-
t143 = customizationController.plugins.filter(_temp4$
|
|
13302
|
+
t143 = customizationController.plugins.filter(_temp4$2).map((plugin_0, i) => {
|
|
13315
13303
|
const section = plugin_0.homePage.includeSection(sectionProps);
|
|
13316
13304
|
return /* @__PURE__ */ jsx(NavigationGroup, { group: section.title, children: section.children }, `plugin_section_${plugin_0.key}`);
|
|
13317
13305
|
});
|
|
@@ -13332,7 +13320,7 @@ function DefaultHomePage(t0) {
|
|
|
13332
13320
|
additionalPluginSections = t153;
|
|
13333
13321
|
let t162;
|
|
13334
13322
|
if ($[34] !== customizationController.plugins) {
|
|
13335
|
-
t162 = customizationController.plugins.filter(_temp5$
|
|
13323
|
+
t162 = customizationController.plugins.filter(_temp5$2).map(_temp6$2);
|
|
13336
13324
|
$[34] = customizationController.plugins;
|
|
13337
13325
|
$[35] = t162;
|
|
13338
13326
|
} else {
|
|
@@ -13349,7 +13337,7 @@ function DefaultHomePage(t0) {
|
|
|
13349
13337
|
additionalPluginChildrenStart = t172;
|
|
13350
13338
|
let t18;
|
|
13351
13339
|
if ($[38] !== customizationController.plugins) {
|
|
13352
|
-
t18 = customizationController.plugins.filter(_temp7).map(_temp8);
|
|
13340
|
+
t18 = customizationController.plugins.filter(_temp7$1).map(_temp8);
|
|
13353
13341
|
$[38] = customizationController.plugins;
|
|
13354
13342
|
$[39] = t18;
|
|
13355
13343
|
} else {
|
|
@@ -13537,19 +13525,19 @@ function DefaultHomePage(t0) {
|
|
|
13537
13525
|
function _temp8(plugin_4, i_1) {
|
|
13538
13526
|
return /* @__PURE__ */ jsx("div", { children: plugin_4.homePage.additionalChildrenEnd }, `plugin_children_start_${i_1}`);
|
|
13539
13527
|
}
|
|
13540
|
-
function _temp7(plugin_3) {
|
|
13528
|
+
function _temp7$1(plugin_3) {
|
|
13541
13529
|
return plugin_3.homePage?.additionalChildrenEnd;
|
|
13542
13530
|
}
|
|
13543
|
-
function _temp6$
|
|
13531
|
+
function _temp6$2(plugin_2, i_0) {
|
|
13544
13532
|
return /* @__PURE__ */ jsx("div", { children: plugin_2.homePage.additionalChildrenStart }, `plugin_children_start_${i_0}`);
|
|
13545
13533
|
}
|
|
13546
|
-
function _temp5$
|
|
13534
|
+
function _temp5$2(plugin_1) {
|
|
13547
13535
|
return plugin_1.homePage?.additionalChildrenStart;
|
|
13548
13536
|
}
|
|
13549
|
-
function _temp4$
|
|
13537
|
+
function _temp4$2(plugin) {
|
|
13550
13538
|
return plugin.homePage?.includeSection;
|
|
13551
13539
|
}
|
|
13552
|
-
function _temp3$
|
|
13540
|
+
function _temp3$3(e_1) {
|
|
13553
13541
|
return !e_1.group;
|
|
13554
13542
|
}
|
|
13555
13543
|
function _temp2$5(entry) {
|
|
@@ -13901,7 +13889,9 @@ function CustomIdField({
|
|
|
13901
13889
|
] }) : void 0
|
|
13902
13890
|
};
|
|
13903
13891
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13904
|
-
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) => {
|
|
13905
13895
|
const enumConfig = enumValues.find((e_1) => e_1.id === option);
|
|
13906
13896
|
if (!enumConfig) return option;
|
|
13907
13897
|
return `${enumConfig.id} - ${enumConfig.label}`;
|
|
@@ -15412,15 +15402,161 @@ function StorageUploadFieldBinding(t0) {
|
|
|
15412
15402
|
}
|
|
15413
15403
|
return t12;
|
|
15414
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
|
+
}
|
|
15415
15553
|
function FileDropComponent(t0) {
|
|
15416
|
-
const $ = c(
|
|
15554
|
+
const $ = c(63);
|
|
15417
15555
|
const {
|
|
15418
15556
|
storage,
|
|
15419
15557
|
disabled,
|
|
15420
|
-
isDraggingOver,
|
|
15421
15558
|
onFilesAdded,
|
|
15422
15559
|
multipleFilesSupported,
|
|
15423
|
-
droppableProvided,
|
|
15424
15560
|
autoFocus,
|
|
15425
15561
|
internalValue,
|
|
15426
15562
|
property,
|
|
@@ -15428,23 +15564,23 @@ function FileDropComponent(t0) {
|
|
|
15428
15564
|
metadata,
|
|
15429
15565
|
storagePathBuilder,
|
|
15430
15566
|
onFileUploadComplete,
|
|
15431
|
-
size,
|
|
15432
15567
|
name,
|
|
15433
|
-
helpText
|
|
15568
|
+
helpText,
|
|
15569
|
+
isDndItemDragging
|
|
15434
15570
|
} = t0;
|
|
15435
15571
|
const snackbarContext = useSnackbarController();
|
|
15436
15572
|
let t1;
|
|
15437
15573
|
if ($[0] !== storage.acceptedFiles) {
|
|
15438
|
-
t1 = storage.acceptedFiles ? storage.acceptedFiles.
|
|
15574
|
+
t1 = storage.acceptedFiles ? storage.acceptedFiles.reduce(_temp2$4, {}) : void 0;
|
|
15439
15575
|
$[0] = storage.acceptedFiles;
|
|
15440
15576
|
$[1] = t1;
|
|
15441
15577
|
} else {
|
|
15442
15578
|
t1 = $[1];
|
|
15443
15579
|
}
|
|
15444
|
-
const t2 = disabled ||
|
|
15580
|
+
const t2 = disabled || isDndItemDragging;
|
|
15445
15581
|
let t3;
|
|
15446
15582
|
if ($[2] !== snackbarContext || $[3] !== storage.maxSize) {
|
|
15447
|
-
t3 = (fileRejections
|
|
15583
|
+
t3 = (fileRejections) => {
|
|
15448
15584
|
for (const fileRejection of fileRejections) {
|
|
15449
15585
|
for (const error of fileRejection.errors) {
|
|
15450
15586
|
console.error("Error uploading file: ", error);
|
|
@@ -15506,170 +15642,154 @@ function FileDropComponent(t0) {
|
|
|
15506
15642
|
}
|
|
15507
15643
|
const t6 = disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin;
|
|
15508
15644
|
const t7 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
|
|
15509
|
-
const t8 = multipleFilesSupported && internalValue.length
|
|
15645
|
+
const t8 = multipleFilesSupported && internalValue.length === 0 && "flex";
|
|
15510
15646
|
const t9 = !isDragActive;
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
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, {
|
|
15514
15651
|
[nonActiveDropClasses]: t9,
|
|
15515
15652
|
[activeDropClasses]: isDragActive,
|
|
15516
15653
|
[rejectDropClasses]: isDragReject,
|
|
15517
15654
|
[acceptDropClasses]: isDragAccept,
|
|
15518
|
-
[disabledClasses]:
|
|
15655
|
+
[disabledClasses]: t10
|
|
15519
15656
|
});
|
|
15520
|
-
$[13] =
|
|
15521
|
-
$[14] =
|
|
15522
|
-
$[15] =
|
|
15523
|
-
$[16] =
|
|
15657
|
+
$[13] = isDragAccept;
|
|
15658
|
+
$[14] = isDragActive;
|
|
15659
|
+
$[15] = isDragReject;
|
|
15660
|
+
$[16] = t10;
|
|
15524
15661
|
$[17] = t6;
|
|
15525
15662
|
$[18] = t7;
|
|
15526
15663
|
$[19] = t8;
|
|
15527
15664
|
$[20] = t9;
|
|
15528
|
-
$[21] =
|
|
15529
|
-
} else {
|
|
15530
|
-
t10 = $[21];
|
|
15531
|
-
}
|
|
15532
|
-
const t11 = droppableProvided.droppableProps;
|
|
15533
|
-
const t12 = droppableProvided.innerRef;
|
|
15534
|
-
const t13 = multipleFilesSupported && internalValue.length ? "overflow-auto" : "";
|
|
15535
|
-
const t14 = multipleFilesSupported && internalValue.length ? "min-h-[180px]" : "min-h-[250px]";
|
|
15536
|
-
let t15;
|
|
15537
|
-
if ($[22] !== t13 || $[23] !== t14) {
|
|
15538
|
-
t15 = cls("flex items-center p-1 no-scrollbar", t13, t14);
|
|
15539
|
-
$[22] = t13;
|
|
15540
|
-
$[23] = t14;
|
|
15541
|
-
$[24] = t15;
|
|
15665
|
+
$[21] = t11;
|
|
15542
15666
|
} else {
|
|
15543
|
-
|
|
15667
|
+
t11 = $[21];
|
|
15544
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]";
|
|
15545
15673
|
let t16;
|
|
15546
|
-
if ($[25] !==
|
|
15547
|
-
t16 =
|
|
15548
|
-
$[
|
|
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;
|
|
15549
15680
|
$[26] = t16;
|
|
15550
15681
|
} else {
|
|
15551
15682
|
t16 = $[26];
|
|
15552
15683
|
}
|
|
15553
15684
|
let t17;
|
|
15554
|
-
if ($[27] !==
|
|
15555
|
-
t17 =
|
|
15556
|
-
$[27] =
|
|
15557
|
-
$[28] =
|
|
15558
|
-
$[29] = t17;
|
|
15685
|
+
if ($[27] !== getInputProps) {
|
|
15686
|
+
t17 = getInputProps();
|
|
15687
|
+
$[27] = getInputProps;
|
|
15688
|
+
$[28] = t17;
|
|
15559
15689
|
} else {
|
|
15560
|
-
t17 = $[
|
|
15690
|
+
t17 = $[28];
|
|
15561
15691
|
}
|
|
15562
15692
|
let t18;
|
|
15563
|
-
if ($[
|
|
15564
|
-
|
|
15565
|
-
|
|
15566
|
-
|
|
15567
|
-
|
|
15568
|
-
|
|
15569
|
-
|
|
15570
|
-
} else {
|
|
15571
|
-
if (entry.file) {
|
|
15572
|
-
child = /* @__PURE__ */ jsx(StorageUploadProgress, { entry, metadata, storagePath: storagePathBuilder(entry.file), onFileUploadComplete, imageSize: size === "large" ? 220 : 118, simple: false });
|
|
15573
|
-
}
|
|
15574
|
-
}
|
|
15575
|
-
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: {
|
|
15576
|
-
...provided.draggableProps.style
|
|
15577
|
-
}, children: child }) }, `array_field_${name}_${entry.id}`);
|
|
15578
|
-
};
|
|
15579
|
-
$[40] = disabled;
|
|
15580
|
-
$[41] = metadata;
|
|
15581
|
-
$[42] = name;
|
|
15582
|
-
$[43] = onClear;
|
|
15583
|
-
$[44] = onFileUploadComplete;
|
|
15584
|
-
$[45] = property;
|
|
15585
|
-
$[46] = size;
|
|
15586
|
-
$[47] = storagePathBuilder;
|
|
15587
|
-
$[48] = t192;
|
|
15588
|
-
} else {
|
|
15589
|
-
t192 = $[48];
|
|
15590
|
-
}
|
|
15591
|
-
t18 = internalValue.map(t192);
|
|
15592
|
-
$[30] = disabled;
|
|
15593
|
-
$[31] = internalValue;
|
|
15594
|
-
$[32] = metadata;
|
|
15595
|
-
$[33] = name;
|
|
15596
|
-
$[34] = onClear;
|
|
15597
|
-
$[35] = onFileUploadComplete;
|
|
15598
|
-
$[36] = property;
|
|
15599
|
-
$[37] = size;
|
|
15600
|
-
$[38] = storagePathBuilder;
|
|
15601
|
-
$[39] = t18;
|
|
15602
|
-
} else {
|
|
15603
|
-
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];
|
|
15604
15700
|
}
|
|
15605
15701
|
let t19;
|
|
15606
|
-
if ($[
|
|
15607
|
-
|
|
15608
|
-
|
|
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: [
|
|
15609
15735
|
t18,
|
|
15610
|
-
|
|
15736
|
+
t19
|
|
15611
15737
|
] });
|
|
15612
|
-
$[
|
|
15613
|
-
$[
|
|
15614
|
-
$[
|
|
15615
|
-
$[
|
|
15616
|
-
$[53] = t17;
|
|
15617
|
-
$[54] = t18;
|
|
15618
|
-
$[55] = t19;
|
|
15738
|
+
$[51] = t16;
|
|
15739
|
+
$[52] = t18;
|
|
15740
|
+
$[53] = t19;
|
|
15741
|
+
$[54] = t20;
|
|
15619
15742
|
} else {
|
|
15620
|
-
|
|
15743
|
+
t20 = $[54];
|
|
15621
15744
|
}
|
|
15622
|
-
const
|
|
15623
|
-
let
|
|
15624
|
-
if ($[
|
|
15625
|
-
|
|
15626
|
-
$[
|
|
15627
|
-
$[
|
|
15628
|
-
$[
|
|
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;
|
|
15629
15752
|
} else {
|
|
15630
|
-
|
|
15753
|
+
t22 = $[57];
|
|
15631
15754
|
}
|
|
15632
|
-
let
|
|
15633
|
-
if ($[
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
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
|
|
15637
15760
|
] });
|
|
15638
|
-
$[
|
|
15639
|
-
$[
|
|
15640
|
-
$[
|
|
15641
|
-
$[
|
|
15642
|
-
$[
|
|
15761
|
+
$[58] = t11;
|
|
15762
|
+
$[59] = t20;
|
|
15763
|
+
$[60] = t22;
|
|
15764
|
+
$[61] = t5;
|
|
15765
|
+
$[62] = t23;
|
|
15643
15766
|
} else {
|
|
15644
|
-
|
|
15767
|
+
t23 = $[62];
|
|
15645
15768
|
}
|
|
15646
|
-
return
|
|
15647
|
-
}
|
|
15648
|
-
function _temp2$4(a, b) {
|
|
15649
|
-
return {
|
|
15650
|
-
...a,
|
|
15651
|
-
...b
|
|
15652
|
-
};
|
|
15769
|
+
return t23;
|
|
15653
15770
|
}
|
|
15654
|
-
function
|
|
15771
|
+
function _temp2$4(acc, ext) {
|
|
15655
15772
|
return {
|
|
15656
|
-
|
|
15773
|
+
...acc,
|
|
15774
|
+
[ext]: []
|
|
15657
15775
|
};
|
|
15658
15776
|
}
|
|
15659
|
-
function StorageUpload({
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
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;
|
|
15673
15793
|
if (multipleFilesSupported) {
|
|
15674
15794
|
const arrayProperty = property;
|
|
15675
15795
|
if (arrayProperty.of) {
|
|
@@ -15684,41 +15804,208 @@ function StorageUpload({
|
|
|
15684
15804
|
}
|
|
15685
15805
|
}
|
|
15686
15806
|
const metadata = storage?.metadata;
|
|
15687
|
-
const
|
|
15688
|
-
|
|
15689
|
-
|
|
15690
|
-
|
|
15691
|
-
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
|
|
15696
|
-
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
}
|
|
15702
|
-
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
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
|
+
}
|
|
15708
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;
|
|
15709
15952
|
} else {
|
|
15710
|
-
|
|
15711
|
-
setInternalValue([]);
|
|
15953
|
+
t8 = $[32];
|
|
15712
15954
|
}
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
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;
|
|
15722
16009
|
}
|
|
15723
16010
|
function TextFieldBinding(t0) {
|
|
15724
16011
|
const $ = c(52);
|
|
@@ -19651,227 +19938,182 @@ const buildIdsMap = (value) => value && Array.isArray(value) && value.length > 0
|
|
|
19651
19938
|
...a,
|
|
19652
19939
|
...b
|
|
19653
19940
|
}), {}) : {};
|
|
19654
|
-
function
|
|
19655
|
-
|
|
19656
|
-
|
|
19657
|
-
|
|
19658
|
-
disabled
|
|
19941
|
+
function SortableItem({
|
|
19942
|
+
id,
|
|
19943
|
+
index,
|
|
19944
|
+
size,
|
|
19945
|
+
disabled,
|
|
19659
19946
|
buildEntry,
|
|
19660
|
-
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
canAddElements
|
|
19664
|
-
sortable
|
|
19665
|
-
|
|
19666
|
-
|
|
19667
|
-
className,
|
|
19668
|
-
min = 0,
|
|
19669
|
-
max = Infinity
|
|
19947
|
+
remove,
|
|
19948
|
+
copy,
|
|
19949
|
+
addInIndex,
|
|
19950
|
+
canAddElements,
|
|
19951
|
+
sortable,
|
|
19952
|
+
storedProps,
|
|
19953
|
+
updateItemCustomProps
|
|
19670
19954
|
}) {
|
|
19671
|
-
const
|
|
19672
|
-
|
|
19673
|
-
|
|
19674
|
-
|
|
19675
|
-
|
|
19676
|
-
|
|
19677
|
-
|
|
19678
|
-
}
|
|
19679
|
-
|
|
19680
|
-
|
|
19681
|
-
|
|
19682
|
-
|
|
19683
|
-
|
|
19684
|
-
|
|
19685
|
-
|
|
19686
|
-
|
|
19687
|
-
|
|
19688
|
-
return newInternalId;
|
|
19689
|
-
}
|
|
19690
|
-
});
|
|
19691
|
-
setInternalIds(newInternalIds);
|
|
19692
|
-
}
|
|
19693
|
-
}, [hasValue, internalIds.length, value]);
|
|
19694
|
-
const insertInEnd = (e) => {
|
|
19695
|
-
e.preventDefault();
|
|
19696
|
-
if (disabled || (value ?? []).length >= max) return;
|
|
19697
|
-
const id = getRandomId();
|
|
19698
|
-
const newIds = [...internalIds, id];
|
|
19699
|
-
if (onInternalIdAdded) onInternalIdAdded(id);
|
|
19700
|
-
setInternalIds(newIds);
|
|
19701
|
-
onValueChange([...value ?? [], newDefaultEntry]);
|
|
19702
|
-
};
|
|
19703
|
-
const remove = (index_0) => {
|
|
19704
|
-
if ((value ?? []).length <= min) return;
|
|
19705
|
-
const newIds_0 = [...internalIds];
|
|
19706
|
-
newIds_0.splice(index_0, 1);
|
|
19707
|
-
setInternalIds(newIds_0);
|
|
19708
|
-
onValueChange(value.filter((_, i) => i !== index_0));
|
|
19709
|
-
};
|
|
19710
|
-
const copy = (index_1) => {
|
|
19711
|
-
if ((value ?? []).length >= max) return;
|
|
19712
|
-
const id_0 = getRandomId();
|
|
19713
|
-
const copyingItem = value[index_1];
|
|
19714
|
-
const newIds_1 = [...internalIds.slice(0, index_1 + 1), id_0, ...internalIds.slice(index_1 + 1)];
|
|
19715
|
-
if (onInternalIdAdded) onInternalIdAdded(id_0);
|
|
19716
|
-
setInternalIds(newIds_1);
|
|
19717
|
-
onValueChange([...value.slice(0, index_1 + 1), copyingItem, ...value.slice(index_1 + 1)]);
|
|
19718
|
-
};
|
|
19719
|
-
const addInIndex = (index_2) => {
|
|
19720
|
-
if ((value ?? []).length >= max) return;
|
|
19721
|
-
const id_1 = getRandomId();
|
|
19722
|
-
const newIds_2 = [...internalIds.slice(0, index_2), id_1, ...internalIds.slice(index_2)];
|
|
19723
|
-
if (onInternalIdAdded) onInternalIdAdded(id_1);
|
|
19724
|
-
setInternalIds(newIds_2);
|
|
19725
|
-
onValueChange([...value.slice(0, index_2), newDefaultEntry, ...value.slice(index_2)]);
|
|
19726
|
-
};
|
|
19727
|
-
const onDragEnd = (result) => {
|
|
19728
|
-
if (!result.destination) {
|
|
19729
|
-
return;
|
|
19730
|
-
}
|
|
19731
|
-
const sourceIndex = result.source.index;
|
|
19732
|
-
const destinationIndex = result.destination.index;
|
|
19733
|
-
const newIds_3 = [...internalIds];
|
|
19734
|
-
const temp = newIds_3[sourceIndex];
|
|
19735
|
-
newIds_3[sourceIndex] = newIds_3[destinationIndex];
|
|
19736
|
-
newIds_3[destinationIndex] = temp;
|
|
19737
|
-
setInternalIds(newIds_3);
|
|
19738
|
-
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
|
|
19739
19972
|
};
|
|
19740
|
-
|
|
19741
|
-
|
|
19742
|
-
|
|
19743
|
-
|
|
19744
|
-
|
|
19745
|
-
|
|
19746
|
-
|
|
19747
|
-
|
|
19748
|
-
|
|
19749
|
-
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" }) })
|
|
19750
|
-
] }) }) });
|
|
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 });
|
|
19751
19982
|
}
|
|
19752
19983
|
function ArrayContainerItem(t0) {
|
|
19753
19984
|
const $ = c(30);
|
|
19754
19985
|
const {
|
|
19755
|
-
|
|
19986
|
+
nodeRef,
|
|
19987
|
+
style,
|
|
19988
|
+
dragHandleProps,
|
|
19756
19989
|
index,
|
|
19757
19990
|
internalId,
|
|
19758
19991
|
size,
|
|
19759
19992
|
disabled,
|
|
19760
19993
|
buildEntry,
|
|
19761
19994
|
remove,
|
|
19995
|
+
copy,
|
|
19762
19996
|
addInIndex,
|
|
19763
19997
|
canAddElements,
|
|
19764
19998
|
sortable,
|
|
19765
|
-
copy,
|
|
19766
19999
|
isDragging,
|
|
19767
20000
|
storedProps,
|
|
19768
20001
|
updateItemCustomProps
|
|
19769
20002
|
} = t0;
|
|
19770
|
-
const t1 =
|
|
19771
|
-
|
|
19772
|
-
const t3 = provided.draggableProps.style;
|
|
19773
|
-
const t4 = `relative ${!isDragging ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 dark:hover:bg-opacity-20" : ""} rounded-md opacity-100`;
|
|
19774
|
-
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;
|
|
19775
20005
|
if ($[0] !== internalId || $[1] !== updateItemCustomProps) {
|
|
19776
|
-
|
|
20006
|
+
t2 = (props) => updateItemCustomProps(internalId, props);
|
|
19777
20007
|
$[0] = internalId;
|
|
19778
20008
|
$[1] = updateItemCustomProps;
|
|
19779
|
-
$[2] =
|
|
20009
|
+
$[2] = t2;
|
|
19780
20010
|
} else {
|
|
19781
|
-
|
|
20011
|
+
t2 = $[2];
|
|
19782
20012
|
}
|
|
19783
|
-
let
|
|
19784
|
-
if ($[3] !== buildEntry || $[4] !== index || $[5] !== internalId || $[6] !== isDragging || $[7] !== storedProps || $[8] !==
|
|
19785
|
-
|
|
20013
|
+
let t3;
|
|
20014
|
+
if ($[3] !== buildEntry || $[4] !== index || $[5] !== internalId || $[6] !== isDragging || $[7] !== storedProps || $[8] !== t2) {
|
|
20015
|
+
t3 = buildEntry({
|
|
19786
20016
|
index,
|
|
19787
20017
|
internalId,
|
|
19788
20018
|
isDragging,
|
|
19789
20019
|
storedProps,
|
|
19790
|
-
storeProps:
|
|
20020
|
+
storeProps: t2
|
|
19791
20021
|
});
|
|
19792
20022
|
$[3] = buildEntry;
|
|
19793
20023
|
$[4] = index;
|
|
19794
20024
|
$[5] = internalId;
|
|
19795
20025
|
$[6] = isDragging;
|
|
19796
20026
|
$[7] = storedProps;
|
|
19797
|
-
$[8] =
|
|
19798
|
-
$[9] =
|
|
20027
|
+
$[8] = t2;
|
|
20028
|
+
$[9] = t3;
|
|
19799
20029
|
} else {
|
|
19800
|
-
|
|
20030
|
+
t3 = $[9];
|
|
19801
20031
|
}
|
|
19802
|
-
let
|
|
19803
|
-
if ($[10] !==
|
|
19804
|
-
|
|
19805
|
-
$[10] =
|
|
19806
|
-
$[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;
|
|
19807
20037
|
} else {
|
|
19808
|
-
|
|
20038
|
+
t4 = $[11];
|
|
19809
20039
|
}
|
|
19810
|
-
const
|
|
19811
|
-
let
|
|
19812
|
-
if ($[12] !== addInIndex || $[13] !== canAddElements || $[14] !== copy || $[15] !== disabled || $[16] !==
|
|
19813
|
-
|
|
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 });
|
|
19814
20044
|
$[12] = addInIndex;
|
|
19815
20045
|
$[13] = canAddElements;
|
|
19816
20046
|
$[14] = copy;
|
|
19817
20047
|
$[15] = disabled;
|
|
19818
|
-
$[16] =
|
|
19819
|
-
$[17] =
|
|
20048
|
+
$[16] = dragHandleProps;
|
|
20049
|
+
$[17] = index;
|
|
19820
20050
|
$[18] = remove;
|
|
19821
20051
|
$[19] = sortable;
|
|
19822
|
-
$[20] =
|
|
19823
|
-
$[21] =
|
|
20052
|
+
$[20] = t5;
|
|
20053
|
+
$[21] = t6;
|
|
19824
20054
|
} else {
|
|
19825
|
-
|
|
20055
|
+
t6 = $[21];
|
|
19826
20056
|
}
|
|
19827
|
-
let
|
|
19828
|
-
if ($[22] !==
|
|
19829
|
-
|
|
19830
|
-
|
|
19831
|
-
|
|
20057
|
+
let t7;
|
|
20058
|
+
if ($[22] !== t4 || $[23] !== t6) {
|
|
20059
|
+
t7 = /* @__PURE__ */ jsxs("div", { className: "flex items-start", children: [
|
|
20060
|
+
t4,
|
|
20061
|
+
t6
|
|
19832
20062
|
] });
|
|
19833
|
-
$[22] =
|
|
19834
|
-
$[23] =
|
|
19835
|
-
$[24] =
|
|
20063
|
+
$[22] = t4;
|
|
20064
|
+
$[23] = t6;
|
|
20065
|
+
$[24] = t7;
|
|
19836
20066
|
} else {
|
|
19837
|
-
|
|
20067
|
+
t7 = $[24];
|
|
19838
20068
|
}
|
|
19839
|
-
let
|
|
19840
|
-
if ($[25] !==
|
|
19841
|
-
|
|
19842
|
-
$[25] =
|
|
19843
|
-
$[26] =
|
|
19844
|
-
$[27] =
|
|
19845
|
-
$[28] =
|
|
19846
|
-
$[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;
|
|
19847
20077
|
} else {
|
|
19848
|
-
|
|
20078
|
+
t8 = $[29];
|
|
19849
20079
|
}
|
|
19850
|
-
return
|
|
20080
|
+
return t8;
|
|
19851
20081
|
}
|
|
19852
20082
|
function ArrayItemOptions({
|
|
20083
|
+
dragHandleProps,
|
|
19853
20084
|
direction,
|
|
19854
20085
|
disabled,
|
|
19855
20086
|
remove,
|
|
19856
20087
|
index,
|
|
19857
|
-
provided,
|
|
19858
20088
|
copy,
|
|
19859
20089
|
canAddElements,
|
|
19860
20090
|
sortable,
|
|
19861
20091
|
addInIndex
|
|
19862
20092
|
}) {
|
|
19863
20093
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
19864
|
-
const iconRef =
|
|
19865
|
-
useOutsideAlerter(iconRef, () =>
|
|
19866
|
-
|
|
19867
|
-
|
|
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();
|
|
19868
20102
|
e.preventDefault();
|
|
19869
|
-
setMenuOpen(
|
|
19870
|
-
}
|
|
19871
|
-
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
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) => {
|
|
19875
20117
|
setMenuOpen(false);
|
|
19876
20118
|
remove(index);
|
|
19877
20119
|
}, children: [
|
|
@@ -19900,7 +20142,110 @@ function ArrayItemOptions({
|
|
|
19900
20142
|
"Add below"
|
|
19901
20143
|
] })
|
|
19902
20144
|
] })
|
|
19903
|
-
] })
|
|
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
|
+
] });
|
|
19904
20249
|
}
|
|
19905
20250
|
function arrayMove(value, sourceIndex, destinationIndex) {
|
|
19906
20251
|
const result = Array.from(value);
|
|
@@ -21511,7 +21856,7 @@ function EntityEditViewInner({
|
|
|
21511
21856
|
};
|
|
21512
21857
|
return /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "relative flex-1 w-full h-full overflow-auto", {
|
|
21513
21858
|
"hidden": selectedTab !== customView.key
|
|
21514
|
-
}), 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}`);
|
|
21515
21860
|
}).filter(Boolean);
|
|
21516
21861
|
const globalLoading = dataLoading && !usedEntity;
|
|
21517
21862
|
const jsonView = /* @__PURE__ */ jsx("div", { className: cls("relative flex-1 h-full overflow-auto w-full", {
|
|
@@ -21641,17 +21986,7 @@ function EntitySidePanel(props) {
|
|
|
21641
21986
|
const parentCollectionIds = useMemo(() => {
|
|
21642
21987
|
return navigationController.getParentCollectionIds(path);
|
|
21643
21988
|
}, [navigationController, path]);
|
|
21644
|
-
const collection =
|
|
21645
|
-
if (props.collection) {
|
|
21646
|
-
return props.collection;
|
|
21647
|
-
}
|
|
21648
|
-
const registryCollection = navigationController.getCollection(path);
|
|
21649
|
-
if (registryCollection) {
|
|
21650
|
-
return registryCollection;
|
|
21651
|
-
}
|
|
21652
|
-
console.error("ERROR: No collection found in path `", path, "`. Entity id: ", entityId);
|
|
21653
|
-
throw Error("ERROR: No collection found in path `" + path + "`. Make sure you have defined a collection for this path in the root navigation.");
|
|
21654
|
-
}, [navigationController, props.collection]);
|
|
21989
|
+
const collection = props.collection ?? navigationController.getCollection(path);
|
|
21655
21990
|
useEffect(() => {
|
|
21656
21991
|
function beforeunload(e) {
|
|
21657
21992
|
if (blocked && collection) {
|