@firecms/core 3.0.0-canary.242 → 3.0.0-canary.245
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 +731 -397
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +739 -408
- 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/hooks/data/save.ts +0 -6
- package/src/types/collections.ts +5 -0
- package/src/util/objects.ts +53 -20
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";
|
|
@@ -248,31 +251,36 @@ function isObject(item) {
|
|
|
248
251
|
return item && typeof item === "object" && !Array.isArray(item);
|
|
249
252
|
}
|
|
250
253
|
function mergeDeep(target, source, ignoreUndefined = false) {
|
|
251
|
-
|
|
252
|
-
|
|
254
|
+
if (!isObject(target)) {
|
|
255
|
+
return target;
|
|
256
|
+
}
|
|
257
|
+
const output = {
|
|
253
258
|
...target
|
|
254
|
-
}
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
259
|
+
};
|
|
260
|
+
if (!isObject(source)) {
|
|
261
|
+
return output;
|
|
262
|
+
}
|
|
263
|
+
for (const key in source) {
|
|
264
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
265
|
+
const sourceValue = source[key];
|
|
266
|
+
const outputValue = output[key];
|
|
267
|
+
if (ignoreUndefined && sourceValue === void 0) {
|
|
268
|
+
continue;
|
|
260
269
|
}
|
|
261
|
-
if (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
} else if (isObject(
|
|
266
|
-
if (
|
|
267
|
-
[key]
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
+
if (sourceValue instanceof Date) {
|
|
271
|
+
output[key] = new Date(sourceValue.getTime());
|
|
272
|
+
} else if (Array.isArray(sourceValue)) {
|
|
273
|
+
output[key] = [...sourceValue];
|
|
274
|
+
} else if (isObject(sourceValue)) {
|
|
275
|
+
if (isObject(outputValue)) {
|
|
276
|
+
output[key] = mergeDeep(outputValue, sourceValue, ignoreUndefined);
|
|
277
|
+
} else {
|
|
278
|
+
output[key] = sourceValue;
|
|
279
|
+
}
|
|
270
280
|
} else {
|
|
271
|
-
|
|
272
|
-
[key]: sourceElement
|
|
273
|
-
});
|
|
281
|
+
output[key] = sourceValue;
|
|
274
282
|
}
|
|
275
|
-
}
|
|
283
|
+
}
|
|
276
284
|
}
|
|
277
285
|
return output;
|
|
278
286
|
}
|
|
@@ -4307,7 +4315,7 @@ function useEntityFetch(t0) {
|
|
|
4307
4315
|
}
|
|
4308
4316
|
} else {
|
|
4309
4317
|
onEntityUpdate(void 0);
|
|
4310
|
-
return _temp3$
|
|
4318
|
+
return _temp3$5;
|
|
4311
4319
|
}
|
|
4312
4320
|
}
|
|
4313
4321
|
};
|
|
@@ -4348,7 +4356,7 @@ function useEntityFetch(t0) {
|
|
|
4348
4356
|
}
|
|
4349
4357
|
return t5;
|
|
4350
4358
|
}
|
|
4351
|
-
function _temp3$
|
|
4359
|
+
function _temp3$5() {
|
|
4352
4360
|
}
|
|
4353
4361
|
function _temp2$d() {
|
|
4354
4362
|
}
|
|
@@ -4403,11 +4411,6 @@ async function saveEntityWithCallbacks({
|
|
|
4403
4411
|
} else {
|
|
4404
4412
|
updatedValues = values;
|
|
4405
4413
|
}
|
|
4406
|
-
console.debug("Saving entity", {
|
|
4407
|
-
entityId,
|
|
4408
|
-
updatedValues,
|
|
4409
|
-
collection
|
|
4410
|
-
});
|
|
4411
4414
|
return dataSource.saveEntity({
|
|
4412
4415
|
collection,
|
|
4413
4416
|
path: resolvedPath,
|
|
@@ -4442,7 +4445,6 @@ async function saveEntityWithCallbacks({
|
|
|
4442
4445
|
}
|
|
4443
4446
|
if (onSaveSuccess) onSaveSuccess(entity);
|
|
4444
4447
|
}).catch((e) => {
|
|
4445
|
-
console.error("!!!", e);
|
|
4446
4448
|
if (callbacks?.onSaveFailure) {
|
|
4447
4449
|
const resolvedCollection = resolveCollection({
|
|
4448
4450
|
collection,
|
|
@@ -10609,8 +10611,7 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10609
10611
|
className,
|
|
10610
10612
|
endAdornment,
|
|
10611
10613
|
AddColumnComponent,
|
|
10612
|
-
initialScroll = 0
|
|
10613
|
-
debug
|
|
10614
|
+
initialScroll = 0
|
|
10614
10615
|
}) {
|
|
10615
10616
|
const sortByProperty = sortBy ? sortBy[0] : void 0;
|
|
10616
10617
|
const currentSort = sortBy ? sortBy[1] : void 0;
|
|
@@ -10654,11 +10655,9 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10654
10655
|
offsetSize: true
|
|
10655
10656
|
});
|
|
10656
10657
|
const onColumnResizeInternal = useCallback((params) => {
|
|
10657
|
-
if (debug) console.log("onColumnResizeInternal", params);
|
|
10658
10658
|
setColumns((prevColumns) => prevColumns.map((column) => column.key === params.column.key ? params.column : column));
|
|
10659
10659
|
}, []);
|
|
10660
10660
|
const onColumnResizeEndInternal = useCallback((params_0) => {
|
|
10661
|
-
if (debug) console.log("onColumnResizeEndInternal", params_0);
|
|
10662
10661
|
setColumns(columns.map((column_0) => column_0.key === params_0.column.key ? params_0.column : column_0));
|
|
10663
10662
|
if (onColumnResize) {
|
|
10664
10663
|
onColumnResize(params_0);
|
|
@@ -10666,18 +10665,15 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10666
10665
|
}, [columns, onColumnResize]);
|
|
10667
10666
|
const filterRef = useRef();
|
|
10668
10667
|
useEffect(() => {
|
|
10669
|
-
if (debug) console.log("Filter updated", filterInput);
|
|
10670
10668
|
filterRef.current = filterInput;
|
|
10671
10669
|
}, [filterInput]);
|
|
10672
10670
|
const scrollToTop = useCallback(() => {
|
|
10673
|
-
if (debug) console.log("scrollToTop");
|
|
10674
10671
|
endReachCallbackThreshold.current = 0;
|
|
10675
10672
|
if (tableRef.current) {
|
|
10676
10673
|
tableRef.current.scrollTo(tableRef.current?.scrollLeft, 0);
|
|
10677
10674
|
}
|
|
10678
10675
|
}, []);
|
|
10679
10676
|
const onColumnSort = useCallback((key) => {
|
|
10680
|
-
if (debug) console.log("onColumnSort", key);
|
|
10681
10677
|
const isDesc = sortByProperty === key && currentSort === "desc";
|
|
10682
10678
|
const isAsc = sortByProperty === key && currentSort === "asc";
|
|
10683
10679
|
const newSort = isAsc ? "desc" : isDesc ? void 0 : "asc";
|
|
@@ -10698,9 +10694,7 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10698
10694
|
scrollToTop();
|
|
10699
10695
|
}, [checkFilterCombination, currentSort, onFilterUpdate, onResetPagination, onSortByUpdate, scrollToTop, sortByProperty]);
|
|
10700
10696
|
const maxScroll = Math.max((data?.length ?? 0) * rowHeight - bounds.height, 0);
|
|
10701
|
-
if (debug) console.log("maxScroll", maxScroll);
|
|
10702
10697
|
const onEndReachedInternal = useCallback((scrollOffset) => {
|
|
10703
|
-
if (debug) console.log("onEndReachedInternal", scrollOffset, endReachCallbackThreshold.current + endOffset);
|
|
10704
10698
|
if (onEndReached && (data?.length ?? 0) > 0 && scrollOffset > endReachCallbackThreshold.current + endOffset) {
|
|
10705
10699
|
endReachCallbackThreshold.current = scrollOffset;
|
|
10706
10700
|
onEndReached();
|
|
@@ -10711,11 +10705,6 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10711
10705
|
scrollOffset: scrollOffset_0,
|
|
10712
10706
|
scrollUpdateWasRequested
|
|
10713
10707
|
}) => {
|
|
10714
|
-
if (debug) console.log("onScroll", {
|
|
10715
|
-
scrollDirection,
|
|
10716
|
-
scrollOffset: scrollOffset_0,
|
|
10717
|
-
scrollUpdateWasRequested
|
|
10718
|
-
});
|
|
10719
10708
|
if (onScrollProp) {
|
|
10720
10709
|
debouncedScroll({
|
|
10721
10710
|
scrollDirection,
|
|
@@ -10726,7 +10715,6 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10726
10715
|
if (!scrollUpdateWasRequested && scrollOffset_0 >= maxScroll - endOffset) onEndReachedInternal(scrollOffset_0);
|
|
10727
10716
|
}, [maxScroll, onEndReachedInternal]);
|
|
10728
10717
|
const onFilterUpdateInternal = useCallback((column_1, filterForProperty) => {
|
|
10729
|
-
if (debug) console.log("onFilterUpdateInternal", column_1, filterForProperty);
|
|
10730
10718
|
endReachCallbackThreshold.current = 0;
|
|
10731
10719
|
const filter_0 = filterRef.current;
|
|
10732
10720
|
let newFilterValue = filter_0 ? {
|
|
@@ -10774,7 +10762,6 @@ const VirtualTable = React__default.memo(function VirtualTable2({
|
|
|
10774
10762
|
endAdornment,
|
|
10775
10763
|
AddColumnComponent
|
|
10776
10764
|
};
|
|
10777
|
-
if (debug) console.log("VirtualTable render", virtualListController);
|
|
10778
10765
|
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
10766
|
}, equal);
|
|
10780
10767
|
function MemoizedList({
|
|
@@ -11110,8 +11097,8 @@ function StringNumberFilterField(t0) {
|
|
|
11110
11097
|
}
|
|
11111
11098
|
let t9;
|
|
11112
11099
|
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$
|
|
11100
|
+
t9 = enumValues && multiple && /* @__PURE__ */ jsx(MultiSelect, { position: "item-aligned", value: Array.isArray(internalValue) ? internalValue.map(_temp3$4) : [], onValueChange: (value_2) => {
|
|
11101
|
+
updateFilter(operation, dataType === "number" ? value_2.map(_temp4$3) : value_2);
|
|
11115
11102
|
}, 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
11103
|
$[34] = dataType;
|
|
11117
11104
|
$[35] = enumValues;
|
|
@@ -11174,10 +11161,10 @@ function StringNumberFilterField(t0) {
|
|
|
11174
11161
|
}
|
|
11175
11162
|
return t12;
|
|
11176
11163
|
}
|
|
11177
|
-
function _temp4$
|
|
11164
|
+
function _temp4$3(v) {
|
|
11178
11165
|
return parseInt(v);
|
|
11179
11166
|
}
|
|
11180
|
-
function _temp3$
|
|
11167
|
+
function _temp3$4(e_1) {
|
|
11181
11168
|
return String(e_1);
|
|
11182
11169
|
}
|
|
11183
11170
|
function _temp2$7(op_1) {
|
|
@@ -13301,7 +13288,7 @@ function DefaultHomePage(t0) {
|
|
|
13301
13288
|
if ($[7] !== additionalActions || $[8] !== additionalChildrenStart || $[9] !== containerRef || $[10] !== context || $[11] !== customizationController.plugins || $[12] !== direction || $[13] !== filteredNavigationEntries || $[14] !== filteredUrls || $[15] !== groups || $[16] !== performingSearch) {
|
|
13302
13289
|
const filteredGroups = filteredUrls ? filteredNavigationEntries.map(_temp2$5) : [];
|
|
13303
13290
|
const allGroups = filteredUrls ? filteredGroups.filter((group, index) => filteredGroups.indexOf(group) === index) : [...groups];
|
|
13304
|
-
if (filteredNavigationEntries.filter(_temp3$
|
|
13291
|
+
if (filteredNavigationEntries.filter(_temp3$3).length > 0 || filteredNavigationEntries.length === 0) {
|
|
13305
13292
|
allGroups.push(void 0);
|
|
13306
13293
|
}
|
|
13307
13294
|
let additionalPluginChildrenStart;
|
|
@@ -13311,7 +13298,7 @@ function DefaultHomePage(t0) {
|
|
|
13311
13298
|
const sectionProps = {
|
|
13312
13299
|
context
|
|
13313
13300
|
};
|
|
13314
|
-
t143 = customizationController.plugins.filter(_temp4$
|
|
13301
|
+
t143 = customizationController.plugins.filter(_temp4$2).map((plugin_0, i) => {
|
|
13315
13302
|
const section = plugin_0.homePage.includeSection(sectionProps);
|
|
13316
13303
|
return /* @__PURE__ */ jsx(NavigationGroup, { group: section.title, children: section.children }, `plugin_section_${plugin_0.key}`);
|
|
13317
13304
|
});
|
|
@@ -13332,7 +13319,7 @@ function DefaultHomePage(t0) {
|
|
|
13332
13319
|
additionalPluginSections = t153;
|
|
13333
13320
|
let t162;
|
|
13334
13321
|
if ($[34] !== customizationController.plugins) {
|
|
13335
|
-
t162 = customizationController.plugins.filter(_temp5$
|
|
13322
|
+
t162 = customizationController.plugins.filter(_temp5$2).map(_temp6$2);
|
|
13336
13323
|
$[34] = customizationController.plugins;
|
|
13337
13324
|
$[35] = t162;
|
|
13338
13325
|
} else {
|
|
@@ -13349,7 +13336,7 @@ function DefaultHomePage(t0) {
|
|
|
13349
13336
|
additionalPluginChildrenStart = t172;
|
|
13350
13337
|
let t18;
|
|
13351
13338
|
if ($[38] !== customizationController.plugins) {
|
|
13352
|
-
t18 = customizationController.plugins.filter(_temp7).map(_temp8);
|
|
13339
|
+
t18 = customizationController.plugins.filter(_temp7$1).map(_temp8);
|
|
13353
13340
|
$[38] = customizationController.plugins;
|
|
13354
13341
|
$[39] = t18;
|
|
13355
13342
|
} else {
|
|
@@ -13537,19 +13524,19 @@ function DefaultHomePage(t0) {
|
|
|
13537
13524
|
function _temp8(plugin_4, i_1) {
|
|
13538
13525
|
return /* @__PURE__ */ jsx("div", { children: plugin_4.homePage.additionalChildrenEnd }, `plugin_children_start_${i_1}`);
|
|
13539
13526
|
}
|
|
13540
|
-
function _temp7(plugin_3) {
|
|
13527
|
+
function _temp7$1(plugin_3) {
|
|
13541
13528
|
return plugin_3.homePage?.additionalChildrenEnd;
|
|
13542
13529
|
}
|
|
13543
|
-
function _temp6$
|
|
13530
|
+
function _temp6$2(plugin_2, i_0) {
|
|
13544
13531
|
return /* @__PURE__ */ jsx("div", { children: plugin_2.homePage.additionalChildrenStart }, `plugin_children_start_${i_0}`);
|
|
13545
13532
|
}
|
|
13546
|
-
function _temp5$
|
|
13533
|
+
function _temp5$2(plugin_1) {
|
|
13547
13534
|
return plugin_1.homePage?.additionalChildrenStart;
|
|
13548
13535
|
}
|
|
13549
|
-
function _temp4$
|
|
13536
|
+
function _temp4$2(plugin) {
|
|
13550
13537
|
return plugin.homePage?.includeSection;
|
|
13551
13538
|
}
|
|
13552
|
-
function _temp3$
|
|
13539
|
+
function _temp3$3(e_1) {
|
|
13553
13540
|
return !e_1.group;
|
|
13554
13541
|
}
|
|
13555
13542
|
function _temp2$5(entry) {
|
|
@@ -13901,7 +13888,9 @@ function CustomIdField({
|
|
|
13901
13888
|
] }) : void 0
|
|
13902
13889
|
};
|
|
13903
13890
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13904
|
-
enumValues && /* @__PURE__ */ jsx(Select, { size: "large", error, fullWidth: true, onValueChange: (v) =>
|
|
13891
|
+
enumValues && /* @__PURE__ */ jsx(Select, { size: "large", error, fullWidth: true, onValueChange: (v) => {
|
|
13892
|
+
onChange(v);
|
|
13893
|
+
}, ...fieldProps, renderValue: (option) => {
|
|
13905
13894
|
const enumConfig = enumValues.find((e_1) => e_1.id === option);
|
|
13906
13895
|
if (!enumConfig) return option;
|
|
13907
13896
|
return `${enumConfig.id} - ${enumConfig.label}`;
|
|
@@ -15412,15 +15401,161 @@ function StorageUploadFieldBinding(t0) {
|
|
|
15412
15401
|
}
|
|
15413
15402
|
return t12;
|
|
15414
15403
|
}
|
|
15404
|
+
function SortableStorageItem(t0) {
|
|
15405
|
+
const $ = c(35);
|
|
15406
|
+
const {
|
|
15407
|
+
id,
|
|
15408
|
+
entry,
|
|
15409
|
+
property,
|
|
15410
|
+
metadata,
|
|
15411
|
+
storagePathBuilder,
|
|
15412
|
+
onFileUploadComplete,
|
|
15413
|
+
onClear,
|
|
15414
|
+
disabled
|
|
15415
|
+
} = t0;
|
|
15416
|
+
let t1;
|
|
15417
|
+
if ($[0] !== id) {
|
|
15418
|
+
t1 = {
|
|
15419
|
+
id
|
|
15420
|
+
};
|
|
15421
|
+
$[0] = id;
|
|
15422
|
+
$[1] = t1;
|
|
15423
|
+
} else {
|
|
15424
|
+
t1 = $[1];
|
|
15425
|
+
}
|
|
15426
|
+
const {
|
|
15427
|
+
attributes,
|
|
15428
|
+
listeners: listeners2,
|
|
15429
|
+
setNodeRef,
|
|
15430
|
+
transform,
|
|
15431
|
+
transition,
|
|
15432
|
+
isDragging
|
|
15433
|
+
} = useSortable(t1);
|
|
15434
|
+
let t2;
|
|
15435
|
+
if ($[2] !== transform) {
|
|
15436
|
+
t2 = CSS.Transform.toString(transform);
|
|
15437
|
+
$[2] = transform;
|
|
15438
|
+
$[3] = t2;
|
|
15439
|
+
} else {
|
|
15440
|
+
t2 = $[3];
|
|
15441
|
+
}
|
|
15442
|
+
const t3 = isDragging ? 100 : void 0;
|
|
15443
|
+
const t4 = isDragging ? 0.8 : 1;
|
|
15444
|
+
let t5;
|
|
15445
|
+
if ($[4] !== t2 || $[5] !== t3 || $[6] !== t4 || $[7] !== transition) {
|
|
15446
|
+
t5 = {
|
|
15447
|
+
transform: t2,
|
|
15448
|
+
transition,
|
|
15449
|
+
zIndex: t3,
|
|
15450
|
+
opacity: t4
|
|
15451
|
+
};
|
|
15452
|
+
$[4] = t2;
|
|
15453
|
+
$[5] = t3;
|
|
15454
|
+
$[6] = t4;
|
|
15455
|
+
$[7] = transition;
|
|
15456
|
+
$[8] = t5;
|
|
15457
|
+
} else {
|
|
15458
|
+
t5 = $[8];
|
|
15459
|
+
}
|
|
15460
|
+
const style = t5;
|
|
15461
|
+
const getImageSizeNumber = _temp$a;
|
|
15462
|
+
let child;
|
|
15463
|
+
if (entry.storagePathOrDownloadUrl) {
|
|
15464
|
+
const t62 = `storage_preview_${entry.storagePathOrDownloadUrl}`;
|
|
15465
|
+
let t72;
|
|
15466
|
+
if ($[9] !== entry.storagePathOrDownloadUrl || $[10] !== onClear) {
|
|
15467
|
+
t72 = () => onClear(entry.storagePathOrDownloadUrl);
|
|
15468
|
+
$[9] = entry.storagePathOrDownloadUrl;
|
|
15469
|
+
$[10] = onClear;
|
|
15470
|
+
$[11] = t72;
|
|
15471
|
+
} else {
|
|
15472
|
+
t72 = $[11];
|
|
15473
|
+
}
|
|
15474
|
+
let t8;
|
|
15475
|
+
if ($[12] !== disabled || $[13] !== entry.size || $[14] !== entry.storagePathOrDownloadUrl || $[15] !== property || $[16] !== t62 || $[17] !== t72) {
|
|
15476
|
+
t8 = /* @__PURE__ */ jsx(StorageItemPreview, { name: t62, property, disabled, value: entry.storagePathOrDownloadUrl, onRemove: t72, size: entry.size });
|
|
15477
|
+
$[12] = disabled;
|
|
15478
|
+
$[13] = entry.size;
|
|
15479
|
+
$[14] = entry.storagePathOrDownloadUrl;
|
|
15480
|
+
$[15] = property;
|
|
15481
|
+
$[16] = t62;
|
|
15482
|
+
$[17] = t72;
|
|
15483
|
+
$[18] = t8;
|
|
15484
|
+
} else {
|
|
15485
|
+
t8 = $[18];
|
|
15486
|
+
}
|
|
15487
|
+
child = t8;
|
|
15488
|
+
} else {
|
|
15489
|
+
if (entry.file) {
|
|
15490
|
+
let t62;
|
|
15491
|
+
if ($[19] !== entry.file || $[20] !== storagePathBuilder) {
|
|
15492
|
+
t62 = storagePathBuilder(entry.file);
|
|
15493
|
+
$[19] = entry.file;
|
|
15494
|
+
$[20] = storagePathBuilder;
|
|
15495
|
+
$[21] = t62;
|
|
15496
|
+
} else {
|
|
15497
|
+
t62 = $[21];
|
|
15498
|
+
}
|
|
15499
|
+
const t72 = getImageSizeNumber(entry.size);
|
|
15500
|
+
let t8;
|
|
15501
|
+
if ($[22] !== entry || $[23] !== metadata || $[24] !== onFileUploadComplete || $[25] !== t62 || $[26] !== t72) {
|
|
15502
|
+
t8 = /* @__PURE__ */ jsx(StorageUploadProgress, { entry, metadata, storagePath: t62, onFileUploadComplete, imageSize: t72, simple: false });
|
|
15503
|
+
$[22] = entry;
|
|
15504
|
+
$[23] = metadata;
|
|
15505
|
+
$[24] = onFileUploadComplete;
|
|
15506
|
+
$[25] = t62;
|
|
15507
|
+
$[26] = t72;
|
|
15508
|
+
$[27] = t8;
|
|
15509
|
+
} else {
|
|
15510
|
+
t8 = $[27];
|
|
15511
|
+
}
|
|
15512
|
+
child = t8;
|
|
15513
|
+
}
|
|
15514
|
+
}
|
|
15515
|
+
let t6;
|
|
15516
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15517
|
+
t6 = cls("rounded-md m-1");
|
|
15518
|
+
$[28] = t6;
|
|
15519
|
+
} else {
|
|
15520
|
+
t6 = $[28];
|
|
15521
|
+
}
|
|
15522
|
+
let t7;
|
|
15523
|
+
if ($[29] !== attributes || $[30] !== child || $[31] !== listeners2 || $[32] !== setNodeRef || $[33] !== style) {
|
|
15524
|
+
t7 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners2, className: t6, tabIndex: -1, children: child });
|
|
15525
|
+
$[29] = attributes;
|
|
15526
|
+
$[30] = child;
|
|
15527
|
+
$[31] = listeners2;
|
|
15528
|
+
$[32] = setNodeRef;
|
|
15529
|
+
$[33] = style;
|
|
15530
|
+
$[34] = t7;
|
|
15531
|
+
} else {
|
|
15532
|
+
t7 = $[34];
|
|
15533
|
+
}
|
|
15534
|
+
return t7;
|
|
15535
|
+
}
|
|
15536
|
+
function _temp$a(previewSize) {
|
|
15537
|
+
switch (previewSize) {
|
|
15538
|
+
case "small": {
|
|
15539
|
+
return 40;
|
|
15540
|
+
}
|
|
15541
|
+
case "medium": {
|
|
15542
|
+
return 118;
|
|
15543
|
+
}
|
|
15544
|
+
case "large": {
|
|
15545
|
+
return 220;
|
|
15546
|
+
}
|
|
15547
|
+
default: {
|
|
15548
|
+
return 118;
|
|
15549
|
+
}
|
|
15550
|
+
}
|
|
15551
|
+
}
|
|
15415
15552
|
function FileDropComponent(t0) {
|
|
15416
|
-
const $ = c(
|
|
15553
|
+
const $ = c(63);
|
|
15417
15554
|
const {
|
|
15418
15555
|
storage,
|
|
15419
15556
|
disabled,
|
|
15420
|
-
isDraggingOver,
|
|
15421
15557
|
onFilesAdded,
|
|
15422
15558
|
multipleFilesSupported,
|
|
15423
|
-
droppableProvided,
|
|
15424
15559
|
autoFocus,
|
|
15425
15560
|
internalValue,
|
|
15426
15561
|
property,
|
|
@@ -15428,23 +15563,23 @@ function FileDropComponent(t0) {
|
|
|
15428
15563
|
metadata,
|
|
15429
15564
|
storagePathBuilder,
|
|
15430
15565
|
onFileUploadComplete,
|
|
15431
|
-
size,
|
|
15432
15566
|
name,
|
|
15433
|
-
helpText
|
|
15567
|
+
helpText,
|
|
15568
|
+
isDndItemDragging
|
|
15434
15569
|
} = t0;
|
|
15435
15570
|
const snackbarContext = useSnackbarController();
|
|
15436
15571
|
let t1;
|
|
15437
15572
|
if ($[0] !== storage.acceptedFiles) {
|
|
15438
|
-
t1 = storage.acceptedFiles ? storage.acceptedFiles.
|
|
15573
|
+
t1 = storage.acceptedFiles ? storage.acceptedFiles.reduce(_temp2$4, {}) : void 0;
|
|
15439
15574
|
$[0] = storage.acceptedFiles;
|
|
15440
15575
|
$[1] = t1;
|
|
15441
15576
|
} else {
|
|
15442
15577
|
t1 = $[1];
|
|
15443
15578
|
}
|
|
15444
|
-
const t2 = disabled ||
|
|
15579
|
+
const t2 = disabled || isDndItemDragging;
|
|
15445
15580
|
let t3;
|
|
15446
15581
|
if ($[2] !== snackbarContext || $[3] !== storage.maxSize) {
|
|
15447
|
-
t3 = (fileRejections
|
|
15582
|
+
t3 = (fileRejections) => {
|
|
15448
15583
|
for (const fileRejection of fileRejections) {
|
|
15449
15584
|
for (const error of fileRejection.errors) {
|
|
15450
15585
|
console.error("Error uploading file: ", error);
|
|
@@ -15506,170 +15641,154 @@ function FileDropComponent(t0) {
|
|
|
15506
15641
|
}
|
|
15507
15642
|
const t6 = disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin;
|
|
15508
15643
|
const t7 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
|
|
15509
|
-
const t8 = multipleFilesSupported && internalValue.length
|
|
15644
|
+
const t8 = multipleFilesSupported && internalValue.length === 0 && "flex";
|
|
15510
15645
|
const t9 = !isDragActive;
|
|
15511
|
-
|
|
15512
|
-
|
|
15513
|
-
|
|
15646
|
+
const t10 = disabled || isDndItemDragging;
|
|
15647
|
+
let t11;
|
|
15648
|
+
if ($[13] !== isDragAccept || $[14] !== isDragActive || $[15] !== isDragReject || $[16] !== t10 || $[17] !== t6 || $[18] !== t7 || $[19] !== t8 || $[20] !== t9) {
|
|
15649
|
+
t11 = cls(fieldBackgroundMixin, t6, t7, dropZoneClasses, t8, {
|
|
15514
15650
|
[nonActiveDropClasses]: t9,
|
|
15515
15651
|
[activeDropClasses]: isDragActive,
|
|
15516
15652
|
[rejectDropClasses]: isDragReject,
|
|
15517
15653
|
[acceptDropClasses]: isDragAccept,
|
|
15518
|
-
[disabledClasses]:
|
|
15654
|
+
[disabledClasses]: t10
|
|
15519
15655
|
});
|
|
15520
|
-
$[13] =
|
|
15521
|
-
$[14] =
|
|
15522
|
-
$[15] =
|
|
15523
|
-
$[16] =
|
|
15656
|
+
$[13] = isDragAccept;
|
|
15657
|
+
$[14] = isDragActive;
|
|
15658
|
+
$[15] = isDragReject;
|
|
15659
|
+
$[16] = t10;
|
|
15524
15660
|
$[17] = t6;
|
|
15525
15661
|
$[18] = t7;
|
|
15526
15662
|
$[19] = t8;
|
|
15527
15663
|
$[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;
|
|
15664
|
+
$[21] = t11;
|
|
15542
15665
|
} else {
|
|
15543
|
-
|
|
15666
|
+
t11 = $[21];
|
|
15544
15667
|
}
|
|
15668
|
+
const t12 = multipleFilesSupported && internalValue.length ? "flex-row overflow-x-auto" : "flex-col";
|
|
15669
|
+
const t13 = internalValue.length === 0 && "min-h-[250px] justify-center";
|
|
15670
|
+
const t14 = multipleFilesSupported && internalValue.length > 0 && "min-h-[180px]";
|
|
15671
|
+
const t15 = !multipleFilesSupported && internalValue.length > 0 && "min-h-[250px]";
|
|
15545
15672
|
let t16;
|
|
15546
|
-
if ($[25] !==
|
|
15547
|
-
t16 =
|
|
15548
|
-
$[
|
|
15673
|
+
if ($[22] !== t12 || $[23] !== t13 || $[24] !== t14 || $[25] !== t15) {
|
|
15674
|
+
t16 = cls("flex items-center p-1 no-scrollbar", t12, t13, t14, t15);
|
|
15675
|
+
$[22] = t12;
|
|
15676
|
+
$[23] = t13;
|
|
15677
|
+
$[24] = t14;
|
|
15678
|
+
$[25] = t15;
|
|
15549
15679
|
$[26] = t16;
|
|
15550
15680
|
} else {
|
|
15551
15681
|
t16 = $[26];
|
|
15552
15682
|
}
|
|
15553
15683
|
let t17;
|
|
15554
|
-
if ($[27] !==
|
|
15555
|
-
t17 =
|
|
15556
|
-
$[27] =
|
|
15557
|
-
$[28] =
|
|
15558
|
-
$[29] = t17;
|
|
15684
|
+
if ($[27] !== getInputProps) {
|
|
15685
|
+
t17 = getInputProps();
|
|
15686
|
+
$[27] = getInputProps;
|
|
15687
|
+
$[28] = t17;
|
|
15559
15688
|
} else {
|
|
15560
|
-
t17 = $[
|
|
15689
|
+
t17 = $[28];
|
|
15561
15690
|
}
|
|
15562
15691
|
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];
|
|
15692
|
+
if ($[29] !== autoFocus || $[30] !== t17) {
|
|
15693
|
+
t18 = /* @__PURE__ */ jsx("input", { autoFocus, ...t17 });
|
|
15694
|
+
$[29] = autoFocus;
|
|
15695
|
+
$[30] = t17;
|
|
15696
|
+
$[31] = t18;
|
|
15697
|
+
} else {
|
|
15698
|
+
t18 = $[31];
|
|
15604
15699
|
}
|
|
15605
15700
|
let t19;
|
|
15606
|
-
if ($[
|
|
15607
|
-
|
|
15608
|
-
|
|
15701
|
+
if ($[32] !== disabled || $[33] !== internalValue || $[34] !== metadata || $[35] !== multipleFilesSupported || $[36] !== name || $[37] !== onClear || $[38] !== onFileUploadComplete || $[39] !== property || $[40] !== storagePathBuilder) {
|
|
15702
|
+
let t202;
|
|
15703
|
+
if ($[42] !== disabled || $[43] !== metadata || $[44] !== multipleFilesSupported || $[45] !== name || $[46] !== onClear || $[47] !== onFileUploadComplete || $[48] !== property || $[49] !== storagePathBuilder) {
|
|
15704
|
+
t202 = (entry) => /* @__PURE__ */ jsx(SortableStorageItem, { id: entry.id, entry, property, name, metadata, storagePathBuilder, onFileUploadComplete, onClear, disabled, isSortable: multipleFilesSupported }, entry.id);
|
|
15705
|
+
$[42] = disabled;
|
|
15706
|
+
$[43] = metadata;
|
|
15707
|
+
$[44] = multipleFilesSupported;
|
|
15708
|
+
$[45] = name;
|
|
15709
|
+
$[46] = onClear;
|
|
15710
|
+
$[47] = onFileUploadComplete;
|
|
15711
|
+
$[48] = property;
|
|
15712
|
+
$[49] = storagePathBuilder;
|
|
15713
|
+
$[50] = t202;
|
|
15714
|
+
} else {
|
|
15715
|
+
t202 = $[50];
|
|
15716
|
+
}
|
|
15717
|
+
t19 = internalValue.map(t202);
|
|
15718
|
+
$[32] = disabled;
|
|
15719
|
+
$[33] = internalValue;
|
|
15720
|
+
$[34] = metadata;
|
|
15721
|
+
$[35] = multipleFilesSupported;
|
|
15722
|
+
$[36] = name;
|
|
15723
|
+
$[37] = onClear;
|
|
15724
|
+
$[38] = onFileUploadComplete;
|
|
15725
|
+
$[39] = property;
|
|
15726
|
+
$[40] = storagePathBuilder;
|
|
15727
|
+
$[41] = t19;
|
|
15728
|
+
} else {
|
|
15729
|
+
t19 = $[41];
|
|
15730
|
+
}
|
|
15731
|
+
let t20;
|
|
15732
|
+
if ($[51] !== t16 || $[52] !== t18 || $[53] !== t19) {
|
|
15733
|
+
t20 = /* @__PURE__ */ jsxs("div", { className: t16, children: [
|
|
15609
15734
|
t18,
|
|
15610
|
-
|
|
15735
|
+
t19
|
|
15611
15736
|
] });
|
|
15612
|
-
$[
|
|
15613
|
-
$[
|
|
15614
|
-
$[
|
|
15615
|
-
$[
|
|
15616
|
-
$[53] = t17;
|
|
15617
|
-
$[54] = t18;
|
|
15618
|
-
$[55] = t19;
|
|
15737
|
+
$[51] = t16;
|
|
15738
|
+
$[52] = t18;
|
|
15739
|
+
$[53] = t19;
|
|
15740
|
+
$[54] = t20;
|
|
15619
15741
|
} else {
|
|
15620
|
-
|
|
15742
|
+
t20 = $[54];
|
|
15621
15743
|
}
|
|
15622
|
-
const
|
|
15623
|
-
let
|
|
15624
|
-
if ($[
|
|
15625
|
-
|
|
15626
|
-
$[
|
|
15627
|
-
$[
|
|
15628
|
-
$[
|
|
15744
|
+
const t21 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
|
|
15745
|
+
let t22;
|
|
15746
|
+
if ($[55] !== helpText || $[56] !== t21) {
|
|
15747
|
+
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 }) });
|
|
15748
|
+
$[55] = helpText;
|
|
15749
|
+
$[56] = t21;
|
|
15750
|
+
$[57] = t22;
|
|
15629
15751
|
} else {
|
|
15630
|
-
|
|
15752
|
+
t22 = $[57];
|
|
15631
15753
|
}
|
|
15632
|
-
let
|
|
15633
|
-
if ($[
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15754
|
+
let t23;
|
|
15755
|
+
if ($[58] !== t11 || $[59] !== t20 || $[60] !== t22 || $[61] !== t5) {
|
|
15756
|
+
t23 = /* @__PURE__ */ jsxs("div", { ...t5, className: t11, children: [
|
|
15757
|
+
t20,
|
|
15758
|
+
t22
|
|
15637
15759
|
] });
|
|
15638
|
-
$[
|
|
15639
|
-
$[
|
|
15640
|
-
$[
|
|
15641
|
-
$[
|
|
15642
|
-
$[
|
|
15760
|
+
$[58] = t11;
|
|
15761
|
+
$[59] = t20;
|
|
15762
|
+
$[60] = t22;
|
|
15763
|
+
$[61] = t5;
|
|
15764
|
+
$[62] = t23;
|
|
15643
15765
|
} else {
|
|
15644
|
-
|
|
15766
|
+
t23 = $[62];
|
|
15645
15767
|
}
|
|
15646
|
-
return
|
|
15647
|
-
}
|
|
15648
|
-
function _temp2$4(a, b) {
|
|
15649
|
-
return {
|
|
15650
|
-
...a,
|
|
15651
|
-
...b
|
|
15652
|
-
};
|
|
15768
|
+
return t23;
|
|
15653
15769
|
}
|
|
15654
|
-
function
|
|
15770
|
+
function _temp2$4(acc, ext) {
|
|
15655
15771
|
return {
|
|
15656
|
-
|
|
15772
|
+
...acc,
|
|
15773
|
+
[ext]: []
|
|
15657
15774
|
};
|
|
15658
15775
|
}
|
|
15659
|
-
function StorageUpload({
|
|
15660
|
-
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
|
|
15670
|
-
|
|
15671
|
-
|
|
15672
|
-
|
|
15776
|
+
function StorageUpload(t0) {
|
|
15777
|
+
const $ = c(44);
|
|
15778
|
+
const {
|
|
15779
|
+
property,
|
|
15780
|
+
name,
|
|
15781
|
+
value,
|
|
15782
|
+
setInternalValue,
|
|
15783
|
+
onChange,
|
|
15784
|
+
multipleFilesSupported,
|
|
15785
|
+
onFileUploadComplete,
|
|
15786
|
+
disabled,
|
|
15787
|
+
onFilesAdded,
|
|
15788
|
+
autoFocus,
|
|
15789
|
+
storage,
|
|
15790
|
+
storagePathBuilder
|
|
15791
|
+
} = t0;
|
|
15673
15792
|
if (multipleFilesSupported) {
|
|
15674
15793
|
const arrayProperty = property;
|
|
15675
15794
|
if (arrayProperty.of) {
|
|
@@ -15684,41 +15803,208 @@ function StorageUpload({
|
|
|
15684
15803
|
}
|
|
15685
15804
|
}
|
|
15686
15805
|
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
|
-
|
|
15806
|
+
const [isDndItemDragging, setIsDndItemDragging] = useState(false);
|
|
15807
|
+
let t1;
|
|
15808
|
+
if ($[0] !== multipleFilesSupported || $[1] !== onChange || $[2] !== setInternalValue || $[3] !== value) {
|
|
15809
|
+
t1 = (fromIndex, toIndex) => {
|
|
15810
|
+
if (!multipleFilesSupported || fromIndex === toIndex) {
|
|
15811
|
+
return;
|
|
15812
|
+
}
|
|
15813
|
+
const newValue = [...value];
|
|
15814
|
+
const item = newValue[fromIndex];
|
|
15815
|
+
newValue.splice(fromIndex, 1);
|
|
15816
|
+
newValue.splice(toIndex, 0, item);
|
|
15817
|
+
setInternalValue(newValue);
|
|
15818
|
+
const fieldValue = newValue.filter(_temp3$2).map(_temp4$1);
|
|
15819
|
+
onChange(fieldValue);
|
|
15820
|
+
};
|
|
15821
|
+
$[0] = multipleFilesSupported;
|
|
15822
|
+
$[1] = onChange;
|
|
15823
|
+
$[2] = setInternalValue;
|
|
15824
|
+
$[3] = value;
|
|
15825
|
+
$[4] = t1;
|
|
15826
|
+
} else {
|
|
15827
|
+
t1 = $[4];
|
|
15828
|
+
}
|
|
15829
|
+
const moveItem = t1;
|
|
15830
|
+
let t2;
|
|
15831
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15832
|
+
t2 = {
|
|
15833
|
+
activationConstraint: {
|
|
15834
|
+
distance: 5
|
|
15835
|
+
}
|
|
15836
|
+
};
|
|
15837
|
+
$[5] = t2;
|
|
15838
|
+
} else {
|
|
15839
|
+
t2 = $[5];
|
|
15840
|
+
}
|
|
15841
|
+
let t3;
|
|
15842
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15843
|
+
t3 = {
|
|
15844
|
+
coordinateGetter: sortableKeyboardCoordinates
|
|
15845
|
+
};
|
|
15846
|
+
$[6] = t3;
|
|
15847
|
+
} else {
|
|
15848
|
+
t3 = $[6];
|
|
15849
|
+
}
|
|
15850
|
+
const sensors = useSensors(useSensor(PointerSensor, t2), useSensor(KeyboardSensor, t3));
|
|
15851
|
+
let t4;
|
|
15852
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
15853
|
+
t4 = (event) => {
|
|
15854
|
+
setIsDndItemDragging(true);
|
|
15855
|
+
};
|
|
15856
|
+
$[7] = t4;
|
|
15857
|
+
} else {
|
|
15858
|
+
t4 = $[7];
|
|
15859
|
+
}
|
|
15860
|
+
const handleDragStart = t4;
|
|
15861
|
+
let t5;
|
|
15862
|
+
if ($[8] !== moveItem || $[9] !== value) {
|
|
15863
|
+
t5 = (event_0) => {
|
|
15864
|
+
setIsDndItemDragging(false);
|
|
15865
|
+
const {
|
|
15866
|
+
active,
|
|
15867
|
+
over
|
|
15868
|
+
} = event_0;
|
|
15869
|
+
if (over && active.id !== over.id) {
|
|
15870
|
+
const oldIndex = value.findIndex((item_0) => item_0.id === active.id);
|
|
15871
|
+
const newIndex = value.findIndex((item_1) => item_1.id === over.id);
|
|
15872
|
+
if (oldIndex !== -1 && newIndex !== -1) {
|
|
15873
|
+
moveItem(oldIndex, newIndex);
|
|
15874
|
+
}
|
|
15875
|
+
}
|
|
15876
|
+
};
|
|
15877
|
+
$[8] = moveItem;
|
|
15878
|
+
$[9] = value;
|
|
15879
|
+
$[10] = t5;
|
|
15880
|
+
} else {
|
|
15881
|
+
t5 = $[10];
|
|
15882
|
+
}
|
|
15883
|
+
const handleDragEnd = t5;
|
|
15884
|
+
let t6;
|
|
15885
|
+
if ($[11] !== multipleFilesSupported || $[12] !== onChange || $[13] !== setInternalValue || $[14] !== value) {
|
|
15886
|
+
t6 = (clearedStoragePathOrDownloadUrl) => {
|
|
15887
|
+
let newValue_0;
|
|
15888
|
+
if (multipleFilesSupported) {
|
|
15889
|
+
newValue_0 = value.filter((v) => v.storagePathOrDownloadUrl !== clearedStoragePathOrDownloadUrl);
|
|
15890
|
+
onChange(newValue_0.filter(_temp5$1).map(_temp6$1));
|
|
15891
|
+
} else {
|
|
15892
|
+
newValue_0 = [];
|
|
15893
|
+
onChange(null);
|
|
15894
|
+
}
|
|
15708
15895
|
setInternalValue(newValue_0);
|
|
15896
|
+
};
|
|
15897
|
+
$[11] = multipleFilesSupported;
|
|
15898
|
+
$[12] = onChange;
|
|
15899
|
+
$[13] = setInternalValue;
|
|
15900
|
+
$[14] = value;
|
|
15901
|
+
$[15] = t6;
|
|
15902
|
+
} else {
|
|
15903
|
+
t6 = $[15];
|
|
15904
|
+
}
|
|
15905
|
+
const onClear = t6;
|
|
15906
|
+
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";
|
|
15907
|
+
const renderProperty = multipleFilesSupported ? property.of : property;
|
|
15908
|
+
let t7;
|
|
15909
|
+
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) {
|
|
15910
|
+
t7 = {
|
|
15911
|
+
storage,
|
|
15912
|
+
disabled,
|
|
15913
|
+
onFilesAdded,
|
|
15914
|
+
multipleFilesSupported,
|
|
15915
|
+
autoFocus,
|
|
15916
|
+
internalValue: value,
|
|
15917
|
+
property: renderProperty,
|
|
15918
|
+
onClear,
|
|
15919
|
+
metadata,
|
|
15920
|
+
storagePathBuilder,
|
|
15921
|
+
onFileUploadComplete,
|
|
15922
|
+
name,
|
|
15923
|
+
helpText,
|
|
15924
|
+
isDndItemDragging
|
|
15925
|
+
};
|
|
15926
|
+
$[16] = autoFocus;
|
|
15927
|
+
$[17] = disabled;
|
|
15928
|
+
$[18] = helpText;
|
|
15929
|
+
$[19] = isDndItemDragging;
|
|
15930
|
+
$[20] = metadata;
|
|
15931
|
+
$[21] = multipleFilesSupported;
|
|
15932
|
+
$[22] = name;
|
|
15933
|
+
$[23] = onClear;
|
|
15934
|
+
$[24] = onFileUploadComplete;
|
|
15935
|
+
$[25] = onFilesAdded;
|
|
15936
|
+
$[26] = renderProperty;
|
|
15937
|
+
$[27] = storage;
|
|
15938
|
+
$[28] = storagePathBuilder;
|
|
15939
|
+
$[29] = value;
|
|
15940
|
+
$[30] = t7;
|
|
15941
|
+
} else {
|
|
15942
|
+
t7 = $[30];
|
|
15943
|
+
}
|
|
15944
|
+
const fileDropProps = t7;
|
|
15945
|
+
if (multipleFilesSupported) {
|
|
15946
|
+
let t8;
|
|
15947
|
+
if ($[31] !== value) {
|
|
15948
|
+
t8 = value.map(_temp7);
|
|
15949
|
+
$[31] = value;
|
|
15950
|
+
$[32] = t8;
|
|
15709
15951
|
} else {
|
|
15710
|
-
|
|
15711
|
-
setInternalValue([]);
|
|
15952
|
+
t8 = $[32];
|
|
15712
15953
|
}
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15717
|
-
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15954
|
+
let t9;
|
|
15955
|
+
if ($[33] !== fileDropProps) {
|
|
15956
|
+
t9 = /* @__PURE__ */ jsx(FileDropComponent, { ...fileDropProps });
|
|
15957
|
+
$[33] = fileDropProps;
|
|
15958
|
+
$[34] = t9;
|
|
15959
|
+
} else {
|
|
15960
|
+
t9 = $[34];
|
|
15961
|
+
}
|
|
15962
|
+
let t10;
|
|
15963
|
+
if ($[35] !== t8 || $[36] !== t9) {
|
|
15964
|
+
t10 = /* @__PURE__ */ jsx(SortableContext, { items: t8, strategy: horizontalListSortingStrategy, children: t9 });
|
|
15965
|
+
$[35] = t8;
|
|
15966
|
+
$[36] = t9;
|
|
15967
|
+
$[37] = t10;
|
|
15968
|
+
} else {
|
|
15969
|
+
t10 = $[37];
|
|
15970
|
+
}
|
|
15971
|
+
let t11;
|
|
15972
|
+
if ($[38] !== handleDragEnd || $[39] !== sensors || $[40] !== t10) {
|
|
15973
|
+
t11 = /* @__PURE__ */ jsx(DndContext, { sensors, collisionDetection: closestCenter, onDragStart: handleDragStart, onDragEnd: handleDragEnd, children: t10 });
|
|
15974
|
+
$[38] = handleDragEnd;
|
|
15975
|
+
$[39] = sensors;
|
|
15976
|
+
$[40] = t10;
|
|
15977
|
+
$[41] = t11;
|
|
15978
|
+
} else {
|
|
15979
|
+
t11 = $[41];
|
|
15980
|
+
}
|
|
15981
|
+
return t11;
|
|
15982
|
+
} else {
|
|
15983
|
+
let t8;
|
|
15984
|
+
if ($[42] !== fileDropProps) {
|
|
15985
|
+
t8 = /* @__PURE__ */ jsx(FileDropComponent, { ...fileDropProps, isDndItemDragging: false });
|
|
15986
|
+
$[42] = fileDropProps;
|
|
15987
|
+
$[43] = t8;
|
|
15988
|
+
} else {
|
|
15989
|
+
t8 = $[43];
|
|
15990
|
+
}
|
|
15991
|
+
return t8;
|
|
15992
|
+
}
|
|
15993
|
+
}
|
|
15994
|
+
function _temp7(v_2) {
|
|
15995
|
+
return v_2.id;
|
|
15996
|
+
}
|
|
15997
|
+
function _temp6$1(v_1) {
|
|
15998
|
+
return v_1.storagePathOrDownloadUrl;
|
|
15999
|
+
}
|
|
16000
|
+
function _temp5$1(v_0) {
|
|
16001
|
+
return !!v_0.storagePathOrDownloadUrl;
|
|
16002
|
+
}
|
|
16003
|
+
function _temp4$1(e_0) {
|
|
16004
|
+
return e_0.storagePathOrDownloadUrl;
|
|
16005
|
+
}
|
|
16006
|
+
function _temp3$2(e) {
|
|
16007
|
+
return !!e.storagePathOrDownloadUrl;
|
|
15722
16008
|
}
|
|
15723
16009
|
function TextFieldBinding(t0) {
|
|
15724
16010
|
const $ = c(52);
|
|
@@ -19651,227 +19937,182 @@ const buildIdsMap = (value) => value && Array.isArray(value) && value.length > 0
|
|
|
19651
19937
|
...a,
|
|
19652
19938
|
...b
|
|
19653
19939
|
}), {}) : {};
|
|
19654
|
-
function
|
|
19655
|
-
|
|
19656
|
-
|
|
19657
|
-
|
|
19658
|
-
disabled
|
|
19940
|
+
function SortableItem({
|
|
19941
|
+
id,
|
|
19942
|
+
index,
|
|
19943
|
+
size,
|
|
19944
|
+
disabled,
|
|
19659
19945
|
buildEntry,
|
|
19660
|
-
|
|
19661
|
-
|
|
19662
|
-
|
|
19663
|
-
canAddElements
|
|
19664
|
-
sortable
|
|
19665
|
-
|
|
19666
|
-
|
|
19667
|
-
className,
|
|
19668
|
-
min = 0,
|
|
19669
|
-
max = Infinity
|
|
19946
|
+
remove,
|
|
19947
|
+
copy,
|
|
19948
|
+
addInIndex,
|
|
19949
|
+
canAddElements,
|
|
19950
|
+
sortable,
|
|
19951
|
+
storedProps,
|
|
19952
|
+
updateItemCustomProps
|
|
19670
19953
|
}) {
|
|
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));
|
|
19954
|
+
const {
|
|
19955
|
+
attributes,
|
|
19956
|
+
listeners: listeners2,
|
|
19957
|
+
setNodeRef,
|
|
19958
|
+
transform,
|
|
19959
|
+
transition,
|
|
19960
|
+
isDragging
|
|
19961
|
+
} = sortable ? useSortable({
|
|
19962
|
+
id
|
|
19963
|
+
}) : {
|
|
19964
|
+
attributes: {},
|
|
19965
|
+
listeners: {},
|
|
19966
|
+
setNodeRef: (node) => {
|
|
19967
|
+
},
|
|
19968
|
+
transform: null,
|
|
19969
|
+
transition: void 0,
|
|
19970
|
+
isDragging: false
|
|
19739
19971
|
};
|
|
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
|
-
] }) }) });
|
|
19972
|
+
const style = transform ? {
|
|
19973
|
+
transform: CSS.Transform.toString(transform),
|
|
19974
|
+
transition
|
|
19975
|
+
} : {};
|
|
19976
|
+
const dragHandleProps = sortable ? {
|
|
19977
|
+
...listeners2,
|
|
19978
|
+
...attributes
|
|
19979
|
+
} : {};
|
|
19980
|
+
return /* @__PURE__ */ jsx(ArrayContainerItem, { nodeRef: setNodeRef, style, dragHandleProps, internalId: id, index, size, disabled, buildEntry, remove, copy, addInIndex, canAddElements, sortable, isDragging, storedProps, updateItemCustomProps });
|
|
19751
19981
|
}
|
|
19752
19982
|
function ArrayContainerItem(t0) {
|
|
19753
19983
|
const $ = c(30);
|
|
19754
19984
|
const {
|
|
19755
|
-
|
|
19985
|
+
nodeRef,
|
|
19986
|
+
style,
|
|
19987
|
+
dragHandleProps,
|
|
19756
19988
|
index,
|
|
19757
19989
|
internalId,
|
|
19758
19990
|
size,
|
|
19759
19991
|
disabled,
|
|
19760
19992
|
buildEntry,
|
|
19761
19993
|
remove,
|
|
19994
|
+
copy,
|
|
19762
19995
|
addInIndex,
|
|
19763
19996
|
canAddElements,
|
|
19764
19997
|
sortable,
|
|
19765
|
-
copy,
|
|
19766
19998
|
isDragging,
|
|
19767
19999
|
storedProps,
|
|
19768
20000
|
updateItemCustomProps
|
|
19769
20001
|
} = 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;
|
|
20002
|
+
const t1 = `relative ${!isDragging ? "hover\\:bg-surface-accent-50 dark\\:hover\\:bg-surface-800 dark\\:hover\\:bg-opacity-20" : ""} rounded-md opacity-100`;
|
|
20003
|
+
let t2;
|
|
19775
20004
|
if ($[0] !== internalId || $[1] !== updateItemCustomProps) {
|
|
19776
|
-
|
|
20005
|
+
t2 = (props) => updateItemCustomProps(internalId, props);
|
|
19777
20006
|
$[0] = internalId;
|
|
19778
20007
|
$[1] = updateItemCustomProps;
|
|
19779
|
-
$[2] =
|
|
20008
|
+
$[2] = t2;
|
|
19780
20009
|
} else {
|
|
19781
|
-
|
|
20010
|
+
t2 = $[2];
|
|
19782
20011
|
}
|
|
19783
|
-
let
|
|
19784
|
-
if ($[3] !== buildEntry || $[4] !== index || $[5] !== internalId || $[6] !== isDragging || $[7] !== storedProps || $[8] !==
|
|
19785
|
-
|
|
20012
|
+
let t3;
|
|
20013
|
+
if ($[3] !== buildEntry || $[4] !== index || $[5] !== internalId || $[6] !== isDragging || $[7] !== storedProps || $[8] !== t2) {
|
|
20014
|
+
t3 = buildEntry({
|
|
19786
20015
|
index,
|
|
19787
20016
|
internalId,
|
|
19788
20017
|
isDragging,
|
|
19789
20018
|
storedProps,
|
|
19790
|
-
storeProps:
|
|
20019
|
+
storeProps: t2
|
|
19791
20020
|
});
|
|
19792
20021
|
$[3] = buildEntry;
|
|
19793
20022
|
$[4] = index;
|
|
19794
20023
|
$[5] = internalId;
|
|
19795
20024
|
$[6] = isDragging;
|
|
19796
20025
|
$[7] = storedProps;
|
|
19797
|
-
$[8] =
|
|
19798
|
-
$[9] =
|
|
20026
|
+
$[8] = t2;
|
|
20027
|
+
$[9] = t3;
|
|
19799
20028
|
} else {
|
|
19800
|
-
|
|
20029
|
+
t3 = $[9];
|
|
19801
20030
|
}
|
|
19802
|
-
let
|
|
19803
|
-
if ($[10] !==
|
|
19804
|
-
|
|
19805
|
-
$[10] =
|
|
19806
|
-
$[11] =
|
|
20031
|
+
let t4;
|
|
20032
|
+
if ($[10] !== t3) {
|
|
20033
|
+
t4 = /* @__PURE__ */ jsx("div", { className: "flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark", children: t3 });
|
|
20034
|
+
$[10] = t3;
|
|
20035
|
+
$[11] = t4;
|
|
19807
20036
|
} else {
|
|
19808
|
-
|
|
20037
|
+
t4 = $[11];
|
|
19809
20038
|
}
|
|
19810
|
-
const
|
|
19811
|
-
let
|
|
19812
|
-
if ($[12] !== addInIndex || $[13] !== canAddElements || $[14] !== copy || $[15] !== disabled || $[16] !==
|
|
19813
|
-
|
|
20039
|
+
const t5 = size === "small" ? "row" : "column";
|
|
20040
|
+
let t6;
|
|
20041
|
+
if ($[12] !== addInIndex || $[13] !== canAddElements || $[14] !== copy || $[15] !== disabled || $[16] !== dragHandleProps || $[17] !== index || $[18] !== remove || $[19] !== sortable || $[20] !== t5) {
|
|
20042
|
+
t6 = /* @__PURE__ */ jsx(ArrayItemOptions, { dragHandleProps, direction: t5, disabled, remove, index, copy, canAddElements, sortable, addInIndex });
|
|
19814
20043
|
$[12] = addInIndex;
|
|
19815
20044
|
$[13] = canAddElements;
|
|
19816
20045
|
$[14] = copy;
|
|
19817
20046
|
$[15] = disabled;
|
|
19818
|
-
$[16] =
|
|
19819
|
-
$[17] =
|
|
20047
|
+
$[16] = dragHandleProps;
|
|
20048
|
+
$[17] = index;
|
|
19820
20049
|
$[18] = remove;
|
|
19821
20050
|
$[19] = sortable;
|
|
19822
|
-
$[20] =
|
|
19823
|
-
$[21] =
|
|
20051
|
+
$[20] = t5;
|
|
20052
|
+
$[21] = t6;
|
|
19824
20053
|
} else {
|
|
19825
|
-
|
|
20054
|
+
t6 = $[21];
|
|
19826
20055
|
}
|
|
19827
|
-
let
|
|
19828
|
-
if ($[22] !==
|
|
19829
|
-
|
|
19830
|
-
|
|
19831
|
-
|
|
20056
|
+
let t7;
|
|
20057
|
+
if ($[22] !== t4 || $[23] !== t6) {
|
|
20058
|
+
t7 = /* @__PURE__ */ jsxs("div", { className: "flex items-start", children: [
|
|
20059
|
+
t4,
|
|
20060
|
+
t6
|
|
19832
20061
|
] });
|
|
19833
|
-
$[22] =
|
|
19834
|
-
$[23] =
|
|
19835
|
-
$[24] =
|
|
20062
|
+
$[22] = t4;
|
|
20063
|
+
$[23] = t6;
|
|
20064
|
+
$[24] = t7;
|
|
19836
20065
|
} else {
|
|
19837
|
-
|
|
20066
|
+
t7 = $[24];
|
|
19838
20067
|
}
|
|
19839
|
-
let
|
|
19840
|
-
if ($[25] !==
|
|
19841
|
-
|
|
19842
|
-
$[25] =
|
|
19843
|
-
$[26] =
|
|
19844
|
-
$[27] =
|
|
19845
|
-
$[28] =
|
|
19846
|
-
$[29] =
|
|
20068
|
+
let t8;
|
|
20069
|
+
if ($[25] !== nodeRef || $[26] !== style || $[27] !== t1 || $[28] !== t7) {
|
|
20070
|
+
t8 = /* @__PURE__ */ jsx("div", { ref: nodeRef, style, className: t1, children: t7 });
|
|
20071
|
+
$[25] = nodeRef;
|
|
20072
|
+
$[26] = style;
|
|
20073
|
+
$[27] = t1;
|
|
20074
|
+
$[28] = t7;
|
|
20075
|
+
$[29] = t8;
|
|
19847
20076
|
} else {
|
|
19848
|
-
|
|
20077
|
+
t8 = $[29];
|
|
19849
20078
|
}
|
|
19850
|
-
return
|
|
20079
|
+
return t8;
|
|
19851
20080
|
}
|
|
19852
20081
|
function ArrayItemOptions({
|
|
20082
|
+
dragHandleProps,
|
|
19853
20083
|
direction,
|
|
19854
20084
|
disabled,
|
|
19855
20085
|
remove,
|
|
19856
20086
|
index,
|
|
19857
|
-
provided,
|
|
19858
20087
|
copy,
|
|
19859
20088
|
canAddElements,
|
|
19860
20089
|
sortable,
|
|
19861
20090
|
addInIndex
|
|
19862
20091
|
}) {
|
|
19863
20092
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
19864
|
-
const iconRef =
|
|
19865
|
-
useOutsideAlerter(iconRef, () =>
|
|
19866
|
-
|
|
19867
|
-
|
|
20093
|
+
const iconRef = useRef(null);
|
|
20094
|
+
useOutsideAlerter(iconRef, () => {
|
|
20095
|
+
if (menuOpen) setMenuOpen(false);
|
|
20096
|
+
});
|
|
20097
|
+
const showMenu = canAddElements ?? false;
|
|
20098
|
+
const handleIconButtonClick = (e) => {
|
|
20099
|
+
if (showMenu) {
|
|
20100
|
+
e.stopPropagation();
|
|
19868
20101
|
e.preventDefault();
|
|
19869
|
-
setMenuOpen(
|
|
19870
|
-
}
|
|
19871
|
-
|
|
19872
|
-
|
|
19873
|
-
|
|
19874
|
-
|
|
20102
|
+
setMenuOpen((o) => !o);
|
|
20103
|
+
} else if (sortable) ;
|
|
20104
|
+
else {
|
|
20105
|
+
e.stopPropagation();
|
|
20106
|
+
e.preventDefault();
|
|
20107
|
+
}
|
|
20108
|
+
};
|
|
20109
|
+
const title = !disabled && sortable && showMenu ? "Drag to move. Click for options" : !disabled && showMenu ? "Click for options" : !disabled && sortable ? "Drag to move" : void 0;
|
|
20110
|
+
return /* @__PURE__ */ jsxs("div", { ref: iconRef, className: `pl-2 pt-1 pb-1 flex ${direction === "row" ? "flex-row-reverse" : "flex-col"} items-center`, children: [
|
|
20111
|
+
/* @__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: () => {
|
|
20112
|
+
if (sortable && menuOpen) setMenuOpen(false);
|
|
20113
|
+
}, className: cls(disabled || !sortable && !showMenu ? "cursor-inherit" : "", sortable && !disabled ? "cursor-grab" : "", !sortable && showMenu && !disabled ? "cursor-pointer" : ""), children: /* @__PURE__ */ jsx(HandleIcon, {}) }) }),
|
|
20114
|
+
showMenu && /* @__PURE__ */ jsxs(Menu, { portalContainer: iconRef.current, open: menuOpen, trigger: /* @__PURE__ */ jsx("div", { tabIndex: -1 }), children: [
|
|
20115
|
+
/* @__PURE__ */ jsxs(MenuItem, { dense: true, onClick: (e_0) => {
|
|
19875
20116
|
setMenuOpen(false);
|
|
19876
20117
|
remove(index);
|
|
19877
20118
|
}, children: [
|
|
@@ -19900,7 +20141,110 @@ function ArrayItemOptions({
|
|
|
19900
20141
|
"Add below"
|
|
19901
20142
|
] })
|
|
19902
20143
|
] })
|
|
19903
|
-
] })
|
|
20144
|
+
] });
|
|
20145
|
+
}
|
|
20146
|
+
function ArrayContainer({
|
|
20147
|
+
droppableId,
|
|
20148
|
+
addLabel,
|
|
20149
|
+
value,
|
|
20150
|
+
disabled = false,
|
|
20151
|
+
buildEntry,
|
|
20152
|
+
size = "medium",
|
|
20153
|
+
onInternalIdAdded,
|
|
20154
|
+
includeAddButton: deprecatedIncludeAddButton,
|
|
20155
|
+
canAddElements: canAddElementsProp = true,
|
|
20156
|
+
sortable = true,
|
|
20157
|
+
newDefaultEntry,
|
|
20158
|
+
onValueChange,
|
|
20159
|
+
className,
|
|
20160
|
+
min = 0,
|
|
20161
|
+
max = Infinity
|
|
20162
|
+
}) {
|
|
20163
|
+
const canAddElements = (canAddElementsProp === void 0 ? true : canAddElementsProp) && // Default canAddElementsProp to true if undefined
|
|
20164
|
+
(deprecatedIncludeAddButton === void 0 || deprecatedIncludeAddButton);
|
|
20165
|
+
const hasValue = value && Array.isArray(value) && value.length > 0;
|
|
20166
|
+
const internalIdsRef = useRef(buildIdsMap(value));
|
|
20167
|
+
const [internalIds, setInternalIds] = useState(hasValue ? Object.values(internalIdsRef.current) : []);
|
|
20168
|
+
const itemCustomPropsRef = useRef({});
|
|
20169
|
+
const updateItemCustomProps = useCallback((internalId, customProps) => {
|
|
20170
|
+
itemCustomPropsRef.current[internalId] = customProps;
|
|
20171
|
+
}, []);
|
|
20172
|
+
const pointerSensor = useSensor(PointerSensor, {
|
|
20173
|
+
activationConstraint: {
|
|
20174
|
+
distance: 5
|
|
20175
|
+
}
|
|
20176
|
+
});
|
|
20177
|
+
const keyboardSensor = useSensor(KeyboardSensor, {});
|
|
20178
|
+
const sensors = useSensors(pointerSensor, keyboardSensor);
|
|
20179
|
+
useEffect(() => {
|
|
20180
|
+
if (hasValue && value && value.length !== internalIds.length) {
|
|
20181
|
+
const newInternalIds = value.map((v, index) => {
|
|
20182
|
+
const hashValue = getHashValue(v) + index;
|
|
20183
|
+
if (hashValue in internalIdsRef.current) {
|
|
20184
|
+
return internalIdsRef.current[hashValue];
|
|
20185
|
+
} else {
|
|
20186
|
+
const newInternalId = getRandomId();
|
|
20187
|
+
internalIdsRef.current[hashValue] = newInternalId;
|
|
20188
|
+
return newInternalId;
|
|
20189
|
+
}
|
|
20190
|
+
});
|
|
20191
|
+
setInternalIds(newInternalIds);
|
|
20192
|
+
}
|
|
20193
|
+
}, [hasValue, internalIds.length, value]);
|
|
20194
|
+
const insertInEnd = (e) => {
|
|
20195
|
+
e.preventDefault();
|
|
20196
|
+
if (disabled || (value ?? []).length >= max) return;
|
|
20197
|
+
const id = getRandomId();
|
|
20198
|
+
const newIds = [...internalIds, id];
|
|
20199
|
+
if (onInternalIdAdded) onInternalIdAdded(id);
|
|
20200
|
+
setInternalIds(newIds);
|
|
20201
|
+
onValueChange([...value ?? [], newDefaultEntry]);
|
|
20202
|
+
};
|
|
20203
|
+
const remove = (index_0) => {
|
|
20204
|
+
if ((value ?? []).length <= min) return;
|
|
20205
|
+
const newIds_0 = [...internalIds];
|
|
20206
|
+
newIds_0.splice(index_0, 1);
|
|
20207
|
+
setInternalIds(newIds_0);
|
|
20208
|
+
onValueChange(value.filter((_, i) => i !== index_0));
|
|
20209
|
+
};
|
|
20210
|
+
const copy = (index_1) => {
|
|
20211
|
+
if ((value ?? []).length >= max) return;
|
|
20212
|
+
const id_0 = getRandomId();
|
|
20213
|
+
const copyingItem = value[index_1];
|
|
20214
|
+
const newIds_1 = [...internalIds.slice(0, index_1 + 1), id_0, ...internalIds.slice(index_1 + 1)];
|
|
20215
|
+
if (onInternalIdAdded) onInternalIdAdded(id_0);
|
|
20216
|
+
setInternalIds(newIds_1);
|
|
20217
|
+
onValueChange([...value.slice(0, index_1 + 1), copyingItem, ...value.slice(index_1 + 1)]);
|
|
20218
|
+
};
|
|
20219
|
+
const addInIndex = (index_2) => {
|
|
20220
|
+
if ((value ?? []).length >= max) return;
|
|
20221
|
+
const id_1 = getRandomId();
|
|
20222
|
+
const newIds_2 = [...internalIds.slice(0, index_2), id_1, ...internalIds.slice(index_2)];
|
|
20223
|
+
if (onInternalIdAdded) onInternalIdAdded(id_1);
|
|
20224
|
+
setInternalIds(newIds_2);
|
|
20225
|
+
onValueChange([...value.slice(0, index_2), newDefaultEntry, ...value.slice(index_2)]);
|
|
20226
|
+
};
|
|
20227
|
+
const onDragEnd = (event) => {
|
|
20228
|
+
const {
|
|
20229
|
+
active,
|
|
20230
|
+
over
|
|
20231
|
+
} = event;
|
|
20232
|
+
if (!over || active.id === over.id) return;
|
|
20233
|
+
const oldIndex = internalIds.indexOf(active.id);
|
|
20234
|
+
const newIndex = internalIds.indexOf(over.id);
|
|
20235
|
+
if (oldIndex === -1 || newIndex === -1) return;
|
|
20236
|
+
const newIds_3 = arrayMove(internalIds, oldIndex, newIndex);
|
|
20237
|
+
setInternalIds(newIds_3);
|
|
20238
|
+
onValueChange(arrayMove(value, oldIndex, newIndex));
|
|
20239
|
+
};
|
|
20240
|
+
return sortable ? /* @__PURE__ */ jsx(DndContext, { sensors, modifiers: [restrictToVerticalAxis], collisionDetection: closestCenter, onDragEnd, children: /* @__PURE__ */ jsx(SortableContext, { items: internalIds, strategy: verticalListSortingStrategy, children: /* @__PURE__ */ jsxs("div", { className: cls("space-y-1", className), id: droppableId, children: [
|
|
20241
|
+
hasValue && internalIds.map((internalId_0, index_3) => /* @__PURE__ */ jsx(SortableItem, { id: internalId_0, index: index_3, size, disabled, buildEntry, remove, copy, addInIndex, canAddElements, sortable, storedProps: itemCustomPropsRef.current[internalId_0], updateItemCustomProps }, `array_field_${internalId_0}`)),
|
|
20242
|
+
canAddElements && /* @__PURE__ */ jsx("div", { className: "my-4 justify-center text-left", children: /* @__PURE__ */ jsx(Button, { variant: "text", size: size === "small" ? "small" : "medium", color: "primary", disabled: disabled || (value?.length ?? 0) >= max, startIcon: /* @__PURE__ */ jsx(AddIcon, {}), onClick: insertInEnd, children: addLabel ?? "Add" }) })
|
|
20243
|
+
] }) }) }) : /* @__PURE__ */ jsxs("div", { className: cls("space-y-1", className), id: droppableId, children: [
|
|
20244
|
+
hasValue && internalIds.map((internalId_1, index_4) => /* @__PURE__ */ jsx(ArrayContainerItem, { nodeRef: (node) => {
|
|
20245
|
+
}, 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}`)),
|
|
20246
|
+
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" }) })
|
|
20247
|
+
] });
|
|
19904
20248
|
}
|
|
19905
20249
|
function arrayMove(value, sourceIndex, destinationIndex) {
|
|
19906
20250
|
const result = Array.from(value);
|
|
@@ -21511,7 +21855,7 @@ function EntityEditViewInner({
|
|
|
21511
21855
|
};
|
|
21512
21856
|
return /* @__PURE__ */ jsx("div", { className: cls(defaultBorderMixin, "relative flex-1 w-full h-full overflow-auto", {
|
|
21513
21857
|
"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}`);
|
|
21858
|
+
}), 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
21859
|
}).filter(Boolean);
|
|
21516
21860
|
const globalLoading = dataLoading && !usedEntity;
|
|
21517
21861
|
const jsonView = /* @__PURE__ */ jsx("div", { className: cls("relative flex-1 h-full overflow-auto w-full", {
|
|
@@ -21641,17 +21985,7 @@ function EntitySidePanel(props) {
|
|
|
21641
21985
|
const parentCollectionIds = useMemo(() => {
|
|
21642
21986
|
return navigationController.getParentCollectionIds(path);
|
|
21643
21987
|
}, [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]);
|
|
21988
|
+
const collection = props.collection ?? navigationController.getCollection(path);
|
|
21655
21989
|
useEffect(() => {
|
|
21656
21990
|
function beforeunload(e) {
|
|
21657
21991
|
if (blocked && collection) {
|