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