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