@rebasepro/admin 0.2.3 → 0.2.4
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/{CollectionEditorDialog-CmGXXSY9.js → CollectionEditorDialog-D0VqpLPO.js} +70 -77
- package/dist/CollectionEditorDialog-D0VqpLPO.js.map +1 -0
- package/dist/{CollectionsStudioView-DcLHT5bU.js → CollectionsStudioView-Bc3Rxxc2.js} +5 -4
- package/dist/{CollectionsStudioView-DcLHT5bU.js.map → CollectionsStudioView-Bc3Rxxc2.js.map} +1 -1
- package/dist/{ExportCollectionAction-BfN34eWX.js → ExportCollectionAction-Ckc-09BQ.js} +4 -3
- package/dist/ExportCollectionAction-Ckc-09BQ.js.map +1 -0
- package/dist/{ImportCollectionAction-SZrInjhx.js → ImportCollectionAction-BqjIrC3Z.js} +3 -2
- package/dist/{ImportCollectionAction-SZrInjhx.js.map → ImportCollectionAction-BqjIrC3Z.js.map} +1 -1
- package/dist/{PropertyEditView-Cvryrb3B.js → PropertyEditView-CvRSV-A2.js} +128 -121
- package/dist/PropertyEditView-CvRSV-A2.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.d.ts +0 -5
- package/dist/collection_editor/index.d.ts +0 -1
- package/dist/collection_editor/types/collection_editor_controller.d.ts +0 -2
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +3 -3
- package/dist/collection_editor_ui.js +3 -3
- package/dist/components/ArrayContainer.d.ts +2 -2
- package/dist/components/DefaultAppBar.d.ts +18 -1
- package/dist/components/DefaultDrawer.d.ts +51 -3
- package/dist/components/EntityCollectionTable/fields/TableStorageUpload.d.ts +2 -2
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
- package/dist/components/EntityCollectionTable/table_bindings.d.ts +4 -3
- package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +4 -3
- package/dist/components/EntityEditView.d.ts +2 -1
- package/dist/components/HomePage/HomePageDnD.d.ts +3 -3
- package/dist/components/PropertyCollectionView.d.ts +1 -1
- package/dist/components/PropertyIdCopyTooltip.d.ts +1 -1
- package/dist/components/SelectableTable/SelectionStore.d.ts +4 -1
- package/dist/components/SelectableTable/filters/BooleanFilterField.d.ts +2 -2
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -2
- package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +2 -2
- package/dist/components/admin/RolesView.d.ts +3 -3
- package/dist/components/admin/UsersView.d.ts +3 -3
- package/dist/components/app/Drawer.d.ts +8 -1
- package/dist/data_export/export/export.d.ts +3 -3
- package/dist/editor/components/editor-bubble.d.ts +5 -1
- package/dist/editor/components/image-bubble.d.ts +5 -1
- package/dist/editor/components/index.d.ts +3 -3
- package/dist/editor/components/table-bubble.d.ts +5 -1
- package/dist/editor/nodeViews/ReactNodeView.d.ts +4 -1
- package/dist/editor/useProseMirror.d.ts +2 -2
- package/dist/editor/utils/remove_classes.d.ts +1 -1
- package/dist/editor.js +15 -14
- package/dist/editor.js.map +1 -1
- package/dist/form/EntityForm.d.ts +2 -2
- package/dist/form/components/StorageUploadProgress.d.ts +2 -2
- package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
- package/dist/form/validation.d.ts +3 -3
- package/dist/hooks/navigation/useResolvedCollections.d.ts +6 -0
- package/dist/hooks/navigation/useResolvedViews.d.ts +3 -4
- package/dist/{index-PLIQXpTt.js → index-BCcLwgfe.js} +3 -2
- package/dist/{index-PLIQXpTt.js.map → index-BCcLwgfe.js.map} +1 -1
- package/dist/{index-DjduZG1T.js → index-DY2k5TtG.js} +3 -3
- package/dist/index-DY2k5TtG.js.map +1 -0
- package/dist/{index-MKPc70-v.js → index-UQOMHwt1.js} +3 -3
- package/dist/index-UQOMHwt1.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2813 -372
- package/dist/index.js.map +1 -1
- package/dist/{markdown-z2Ir7Cgo.js → markdown-DD2JDU1X.js} +2 -2
- package/dist/markdown-DD2JDU1X.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
- package/dist/types/components/EntityFormProps.d.ts +2 -2
- package/dist/types/fields.d.ts +1 -1
- package/dist/{util-DbWax_sV.js → util-ZM9gQuCv.js} +2031 -2078
- package/dist/util-ZM9gQuCv.js.map +1 -0
- package/package.json +8 -8
- package/src/collection_editor/ConfigControllerProvider.tsx +3 -13
- package/src/collection_editor/index.ts +1 -3
- package/src/collection_editor/types/collection_editor_controller.tsx +0 -3
- package/src/collection_editor/ui/EditorCollectionAction.tsx +1 -6
- package/src/collection_editor/ui/EditorCollectionActionStart.tsx +1 -6
- package/src/collection_editor/ui/EditorEntityAction.tsx +1 -6
- package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +7 -14
- package/src/collection_editor/ui/NewCollectionCard.tsx +1 -5
- package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +3 -8
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +8 -12
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +21 -21
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +4 -4
- package/src/collection_editor/ui/collection_editor/EnumForm.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +3 -3
- package/src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx +8 -8
- package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +8 -8
- package/src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx +5 -5
- package/src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx +3 -2
- package/src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +2 -2
- package/src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +1 -1
- package/src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +4 -7
- package/src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +4 -4
- package/src/components/ArrayContainer.tsx +3 -3
- package/src/components/DefaultAppBar.tsx +52 -31
- package/src/components/DefaultDrawer.tsx +279 -66
- package/src/components/DrawerNavigationItem.tsx +1 -1
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +6 -5
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +9 -7
- package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -5
- package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +12 -9
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +2 -2
- package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +1 -1
- package/src/components/EntityCollectionTable/table_bindings.tsx +5 -4
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +6 -4
- package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -1
- package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +7 -6
- package/src/components/EntityDetailView.tsx +46 -24
- package/src/components/EntityEditView.tsx +51 -28
- package/src/components/EntityEditViewFormActions.tsx +4 -4
- package/src/components/EntityPreview.tsx +9 -4
- package/src/components/HomePage/HomePageDnD.tsx +3 -2
- package/src/components/PropertyCollectionView.tsx +1 -1
- package/src/components/PropertyIdCopyTooltip.tsx +1 -1
- package/src/components/RebaseLayout.tsx +5 -1
- package/src/components/RebaseNavigation.tsx +2 -2
- package/src/components/RebaseRouteDefs.tsx +4 -7
- package/src/components/RebaseShell.tsx +16 -13
- package/src/components/SearchIconsView.tsx +1 -8
- package/src/components/SelectableTable/SelectableTable.tsx +8 -11
- package/src/components/SelectableTable/SelectionStore.ts +1 -1
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +3 -3
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +3 -3
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +5 -5
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +3 -3
- package/src/components/SideEntityProvider.tsx +2 -1
- package/src/components/admin/RolesView.tsx +7 -2
- package/src/components/admin/UsersView.tsx +12 -6
- package/src/components/app/Drawer.tsx +9 -1
- package/src/components/app/Scaffold.tsx +5 -1
- package/src/data_export/export/export.ts +17 -17
- package/src/data_import/components/DataNewPropertiesMapping.tsx +1 -1
- package/src/editor/components/editor-bubble.tsx +32 -9
- package/src/editor/components/image-bubble.tsx +27 -11
- package/src/editor/components/index.ts +3 -3
- package/src/editor/components/table-bubble.tsx +79 -17
- package/src/editor/extensions/HighlightDecorationExtension.ts +3 -2
- package/src/editor/nodeViews/ReactNodeView.tsx +1 -1
- package/src/editor/nodeViews/TaskItemComponent.tsx +9 -8
- package/src/editor/schema.ts +135 -59
- package/src/editor/selectors/link-selector.tsx +8 -5
- package/src/editor/useProseMirror.ts +2 -2
- package/src/editor/utils/remove_classes.ts +6 -5
- package/src/form/EntityForm.tsx +15 -15
- package/src/form/EntityFormActions.tsx +2 -2
- package/src/form/PropertyFieldBinding.tsx +64 -64
- package/src/form/components/FieldHelperText.tsx +4 -4
- package/src/form/components/StorageUploadProgress.tsx +2 -2
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +1 -1
- package/src/form/field_bindings/BlockFieldBinding.tsx +54 -53
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +290 -289
- package/src/form/field_bindings/MapFieldBinding.tsx +2 -2
- package/src/form/field_bindings/MultiSelectFieldBinding.tsx +2 -2
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +1 -1
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +8 -6
- package/src/form/field_bindings/RelationFieldBinding.tsx +4 -4
- package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -1
- package/src/form/field_bindings/SelectFieldBinding.tsx +1 -1
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +84 -84
- package/src/form/field_bindings/SwitchFieldBinding.tsx +16 -16
- package/src/form/field_bindings/TextFieldBinding.tsx +77 -73
- package/src/form/field_bindings/UserSelectFieldBinding.tsx +17 -17
- package/src/form/validation.ts +43 -43
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +3 -5
- package/src/hooks/navigation/useResolvedCollections.ts +27 -7
- package/src/hooks/navigation/useResolvedViews.tsx +24 -44
- package/src/index.ts +2 -0
- package/src/preview/PropertyPreview.tsx +2 -2
- package/src/preview/components/ImagePreview.tsx +2 -1
- package/src/preview/components/UrlComponentPreview.tsx +11 -2
- package/src/preview/components/UserPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +2 -2
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +4 -4
- package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +3 -3
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +3 -3
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +3 -2
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +6 -8
- package/src/preview/property_previews/ArrayPropertyEnumPreview.tsx +1 -1
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +3 -3
- package/src/preview/property_previews/MapPropertyPreview.tsx +4 -3
- package/src/preview/property_previews/NumberPropertyPreview.tsx +5 -3
- package/src/preview/property_previews/StringPropertyPreview.tsx +10 -8
- package/src/types/components/EntityFormActionsProps.tsx +1 -1
- package/src/types/components/EntityFormProps.tsx +2 -2
- package/src/types/fields.tsx +2 -2
- package/dist/CollectionEditorDialog-CmGXXSY9.js.map +0 -1
- package/dist/ContentHomePage-C7vFqKSe.js +0 -1784
- package/dist/ContentHomePage-C7vFqKSe.js.map +0 -1
- package/dist/ExportCollectionAction-BfN34eWX.js.map +0 -1
- package/dist/PropertyEditView-Cvryrb3B.js.map +0 -1
- package/dist/RoleChip-QtUFXeTp.js +0 -67
- package/dist/RoleChip-QtUFXeTp.js.map +0 -1
- package/dist/RolesView-BCb7qwWs.js +0 -437
- package/dist/RolesView-BCb7qwWs.js.map +0 -1
- package/dist/UsersView-Cex24r8H.js +0 -408
- package/dist/UsersView-Cex24r8H.js.map +0 -1
- package/dist/collection_editor/types/config_permissions.d.ts +0 -19
- package/dist/index-DjduZG1T.js.map +0 -1
- package/dist/index-MKPc70-v.js.map +0 -1
- package/dist/markdown-z2Ir7Cgo.js.map +0 -1
- package/dist/util-DbWax_sV.js.map +0 -1
- package/src/collection_editor/types/config_permissions.ts +0 -20
|
@@ -1,1784 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React__default, { useState, useRef, useEffect, useCallback, useMemo } from "react";
|
|
3
|
-
import Fuse from "fuse.js";
|
|
4
|
-
import { Chip, StarIcon, Collapse, cls, IconButton, PencilIcon, iconSize, ExpandablePanel, Typography, Markdown, ArrowRightIcon, Card, DialogTitle, TextField, DialogContent, Button, DialogActions, Dialog, Container, SearchBar, ErrorBoundary } from "@rebasepro/ui";
|
|
5
|
-
import { c } from "react-compiler-runtime";
|
|
6
|
-
import { useNavigate } from "react-router-dom";
|
|
7
|
-
import { useUserConfigurationPersistence, useTranslation, useRebaseContext, useSlot, IconForView, useCustomizationController, useAdminModeController, useRebaseRegistry, buildCollapsedDefaults, useCollapsedGroups, useRestoreScroll, BootstrapAdminBanner } from "@rebasepro/core";
|
|
8
|
-
import "fast-equals";
|
|
9
|
-
import "@rebasepro/common";
|
|
10
|
-
import "@rebasepro/formex";
|
|
11
|
-
import "zod";
|
|
12
|
-
import "@rebasepro/utils";
|
|
13
|
-
import { bm as useNavigationStateController, be as useCMSContext, b9 as useBreadcrumbsController } from "./util-DbWax_sV.js";
|
|
14
|
-
import "date-fns";
|
|
15
|
-
import "date-fns/locale";
|
|
16
|
-
import "@rebasepro/types";
|
|
17
|
-
import { useSensor, MouseSensor, TouchSensor, KeyboardSensor, useSensors, closestCenter, pointerWithin, closestCorners, getFirstCollision, rectIntersection, useDroppable, useDndMonitor, DndContext, MeasuringStrategy, DragOverlay } from "@dnd-kit/core";
|
|
18
|
-
import { restrictToVerticalAxis, restrictToWindowEdges } from "@dnd-kit/modifiers";
|
|
19
|
-
import { useSortable, arrayMove, defaultAnimateLayoutChanges, SortableContext, rectSortingStrategy, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
20
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
21
|
-
import "react-dropzone";
|
|
22
|
-
import "exceljs";
|
|
23
|
-
import "@rebasepro/schema-inference";
|
|
24
|
-
function NavigationChip(t0) {
|
|
25
|
-
const $ = c(18);
|
|
26
|
-
const {
|
|
27
|
-
entry
|
|
28
|
-
} = t0;
|
|
29
|
-
const navigate = useNavigate();
|
|
30
|
-
const userConfigurationPersistence = useUserConfigurationPersistence();
|
|
31
|
-
if (!userConfigurationPersistence) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
let t1;
|
|
35
|
-
if ($[0] !== entry.slug || $[1] !== userConfigurationPersistence.favouritePaths) {
|
|
36
|
-
t1 = userConfigurationPersistence.favouritePaths.includes(entry.slug);
|
|
37
|
-
$[0] = entry.slug;
|
|
38
|
-
$[1] = userConfigurationPersistence.favouritePaths;
|
|
39
|
-
$[2] = t1;
|
|
40
|
-
} else {
|
|
41
|
-
t1 = $[2];
|
|
42
|
-
}
|
|
43
|
-
const favourite = t1;
|
|
44
|
-
let t2;
|
|
45
|
-
if ($[3] !== entry.slug || $[4] !== favourite || $[5] !== userConfigurationPersistence) {
|
|
46
|
-
t2 = (e) => {
|
|
47
|
-
e.preventDefault();
|
|
48
|
-
e.stopPropagation();
|
|
49
|
-
if (favourite) {
|
|
50
|
-
userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p) => p !== entry.slug));
|
|
51
|
-
} else {
|
|
52
|
-
userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, entry.slug]);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
$[3] = entry.slug;
|
|
56
|
-
$[4] = favourite;
|
|
57
|
-
$[5] = userConfigurationPersistence;
|
|
58
|
-
$[6] = t2;
|
|
59
|
-
} else {
|
|
60
|
-
t2 = $[6];
|
|
61
|
-
}
|
|
62
|
-
const onIconClick = t2;
|
|
63
|
-
let t3;
|
|
64
|
-
if ($[7] !== entry.url || $[8] !== navigate) {
|
|
65
|
-
t3 = () => navigate(entry.url);
|
|
66
|
-
$[7] = entry.url;
|
|
67
|
-
$[8] = navigate;
|
|
68
|
-
$[9] = t3;
|
|
69
|
-
} else {
|
|
70
|
-
t3 = $[9];
|
|
71
|
-
}
|
|
72
|
-
const t4 = favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500";
|
|
73
|
-
let t5;
|
|
74
|
-
if ($[10] !== onIconClick || $[11] !== t4) {
|
|
75
|
-
t5 = /* @__PURE__ */ jsx(StarIcon, { onClick: onIconClick, size: "small", className: t4 });
|
|
76
|
-
$[10] = onIconClick;
|
|
77
|
-
$[11] = t4;
|
|
78
|
-
$[12] = t5;
|
|
79
|
-
} else {
|
|
80
|
-
t5 = $[12];
|
|
81
|
-
}
|
|
82
|
-
let t6;
|
|
83
|
-
if ($[13] !== entry.name || $[14] !== entry.slug || $[15] !== t3 || $[16] !== t5) {
|
|
84
|
-
t6 = /* @__PURE__ */ jsx(Chip, { onClick: t3, icon: t5, children: entry.name }, entry.slug);
|
|
85
|
-
$[13] = entry.name;
|
|
86
|
-
$[14] = entry.slug;
|
|
87
|
-
$[15] = t3;
|
|
88
|
-
$[16] = t5;
|
|
89
|
-
$[17] = t6;
|
|
90
|
-
} else {
|
|
91
|
-
t6 = $[17];
|
|
92
|
-
}
|
|
93
|
-
return t6;
|
|
94
|
-
}
|
|
95
|
-
function FavouritesView(t0) {
|
|
96
|
-
const $ = c(17);
|
|
97
|
-
const navigationStateController = useNavigationStateController();
|
|
98
|
-
const userConfigurationPersistence = useUserConfigurationPersistence();
|
|
99
|
-
if (!userConfigurationPersistence) {
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
let t1;
|
|
103
|
-
if ($[0] !== userConfigurationPersistence?.favouritePaths) {
|
|
104
|
-
t1 = userConfigurationPersistence?.favouritePaths ?? [];
|
|
105
|
-
$[0] = userConfigurationPersistence?.favouritePaths;
|
|
106
|
-
$[1] = t1;
|
|
107
|
-
} else {
|
|
108
|
-
t1 = $[1];
|
|
109
|
-
}
|
|
110
|
-
let T0;
|
|
111
|
-
let t2;
|
|
112
|
-
let t3;
|
|
113
|
-
let t4;
|
|
114
|
-
if ($[2] !== navigationStateController || $[3] !== t1) {
|
|
115
|
-
let t52;
|
|
116
|
-
if ($[8] !== navigationStateController) {
|
|
117
|
-
t52 = (path) => navigationStateController.topLevelNavigation?.navigationEntries.find((entry) => entry.slug === path);
|
|
118
|
-
$[8] = navigationStateController;
|
|
119
|
-
$[9] = t52;
|
|
120
|
-
} else {
|
|
121
|
-
t52 = $[9];
|
|
122
|
-
}
|
|
123
|
-
const favouriteCollections = t1.map(t52).filter(Boolean);
|
|
124
|
-
T0 = Collapse;
|
|
125
|
-
t4 = favouriteCollections.length > 0;
|
|
126
|
-
t2 = "flex flex-row flex-wrap gap-2 pb-2 min-h-[32px]";
|
|
127
|
-
t3 = favouriteCollections.map(_temp$1);
|
|
128
|
-
$[2] = navigationStateController;
|
|
129
|
-
$[3] = t1;
|
|
130
|
-
$[4] = T0;
|
|
131
|
-
$[5] = t2;
|
|
132
|
-
$[6] = t3;
|
|
133
|
-
$[7] = t4;
|
|
134
|
-
} else {
|
|
135
|
-
T0 = $[4];
|
|
136
|
-
t2 = $[5];
|
|
137
|
-
t3 = $[6];
|
|
138
|
-
t4 = $[7];
|
|
139
|
-
}
|
|
140
|
-
let t5;
|
|
141
|
-
if ($[10] !== t2 || $[11] !== t3) {
|
|
142
|
-
t5 = /* @__PURE__ */ jsx("div", { className: t2, children: t3 });
|
|
143
|
-
$[10] = t2;
|
|
144
|
-
$[11] = t3;
|
|
145
|
-
$[12] = t5;
|
|
146
|
-
} else {
|
|
147
|
-
t5 = $[12];
|
|
148
|
-
}
|
|
149
|
-
let t6;
|
|
150
|
-
if ($[13] !== T0 || $[14] !== t4 || $[15] !== t5) {
|
|
151
|
-
t6 = /* @__PURE__ */ jsx(T0, { in: t4, children: t5 });
|
|
152
|
-
$[13] = T0;
|
|
153
|
-
$[14] = t4;
|
|
154
|
-
$[15] = t5;
|
|
155
|
-
$[16] = t6;
|
|
156
|
-
} else {
|
|
157
|
-
t6 = $[16];
|
|
158
|
-
}
|
|
159
|
-
return t6;
|
|
160
|
-
}
|
|
161
|
-
function _temp$1(entry_0) {
|
|
162
|
-
return /* @__PURE__ */ jsx(NavigationChip, { entry: entry_0 }, entry_0.slug);
|
|
163
|
-
}
|
|
164
|
-
function NavigationGroup(t0) {
|
|
165
|
-
const $ = c(45);
|
|
166
|
-
const {
|
|
167
|
-
children,
|
|
168
|
-
group,
|
|
169
|
-
minimised,
|
|
170
|
-
isPreview,
|
|
171
|
-
isPotentialCardDropTarget,
|
|
172
|
-
onEditGroup,
|
|
173
|
-
dndDisabled,
|
|
174
|
-
collapsed,
|
|
175
|
-
onToggleCollapsed
|
|
176
|
-
} = t0;
|
|
177
|
-
const {
|
|
178
|
-
t
|
|
179
|
-
} = useTranslation();
|
|
180
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
181
|
-
let t1;
|
|
182
|
-
if ($[0] !== group || $[1] !== t) {
|
|
183
|
-
t1 = group ?? t("views_group");
|
|
184
|
-
$[0] = group;
|
|
185
|
-
$[1] = t;
|
|
186
|
-
$[2] = t1;
|
|
187
|
-
} else {
|
|
188
|
-
t1 = $[2];
|
|
189
|
-
}
|
|
190
|
-
const currentGroupName = t1;
|
|
191
|
-
const showCaret = !isPreview && !!onToggleCollapsed;
|
|
192
|
-
const t2 = isPreview ? "px-1 py-0.5" : "";
|
|
193
|
-
let t3;
|
|
194
|
-
if ($[3] !== t2) {
|
|
195
|
-
t3 = cls("flex items-center", t2);
|
|
196
|
-
$[3] = t2;
|
|
197
|
-
$[4] = t3;
|
|
198
|
-
} else {
|
|
199
|
-
t3 = $[4];
|
|
200
|
-
}
|
|
201
|
-
const t4 = isPreview ? "body2" : "caption";
|
|
202
|
-
let t5;
|
|
203
|
-
if ($[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
204
|
-
t5 = cls("px-4 py-1 rounded", "font-semibold text-[11px] uppercase tracking-wider text-surface-400 dark:text-surface-400");
|
|
205
|
-
$[5] = t5;
|
|
206
|
-
} else {
|
|
207
|
-
t5 = $[5];
|
|
208
|
-
}
|
|
209
|
-
let t6;
|
|
210
|
-
if ($[6] !== currentGroupName || $[7] !== t4) {
|
|
211
|
-
t6 = /* @__PURE__ */ jsx(Typography, { variant: t4, component: "h2", color: "secondary", className: t5, children: currentGroupName });
|
|
212
|
-
$[6] = currentGroupName;
|
|
213
|
-
$[7] = t4;
|
|
214
|
-
$[8] = t6;
|
|
215
|
-
} else {
|
|
216
|
-
t6 = $[8];
|
|
217
|
-
}
|
|
218
|
-
let t7;
|
|
219
|
-
if ($[9] !== currentGroupName || $[10] !== dndDisabled || $[11] !== isHovered || $[12] !== isPreview || $[13] !== onEditGroup) {
|
|
220
|
-
t7 = !isPreview && onEditGroup && !dndDisabled && /* @__PURE__ */ jsx(IconButton, { size: "smallest", onClick: (e) => {
|
|
221
|
-
e.stopPropagation();
|
|
222
|
-
onEditGroup(currentGroupName);
|
|
223
|
-
}, className: cls("ml-2 ", isHovered ? "opacity-100" : "opacity-0", "transition-opacity duration-100"), children: /* @__PURE__ */ jsx(PencilIcon, { size: iconSize.smallest }) });
|
|
224
|
-
$[9] = currentGroupName;
|
|
225
|
-
$[10] = dndDisabled;
|
|
226
|
-
$[11] = isHovered;
|
|
227
|
-
$[12] = isPreview;
|
|
228
|
-
$[13] = onEditGroup;
|
|
229
|
-
$[14] = t7;
|
|
230
|
-
} else {
|
|
231
|
-
t7 = $[14];
|
|
232
|
-
}
|
|
233
|
-
let t8;
|
|
234
|
-
if ($[15] !== t3 || $[16] !== t6 || $[17] !== t7) {
|
|
235
|
-
t8 = /* @__PURE__ */ jsxs("div", { className: t3, children: [
|
|
236
|
-
t6,
|
|
237
|
-
t7
|
|
238
|
-
] });
|
|
239
|
-
$[15] = t3;
|
|
240
|
-
$[16] = t6;
|
|
241
|
-
$[17] = t7;
|
|
242
|
-
$[18] = t8;
|
|
243
|
-
} else {
|
|
244
|
-
t8 = $[18];
|
|
245
|
-
}
|
|
246
|
-
const TitleContent = t8;
|
|
247
|
-
const t9 = !isPotentialCardDropTarget ? "my-10" : "my-6";
|
|
248
|
-
let t10;
|
|
249
|
-
if ($[19] !== t9) {
|
|
250
|
-
t10 = cls(t9, "transition-all duration-200 ease-in-out");
|
|
251
|
-
$[19] = t9;
|
|
252
|
-
$[20] = t10;
|
|
253
|
-
} else {
|
|
254
|
-
t10 = $[20];
|
|
255
|
-
}
|
|
256
|
-
let t11;
|
|
257
|
-
if ($[21] !== TitleContent || $[22] !== children || $[23] !== isPreview) {
|
|
258
|
-
t11 = isPreview && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
259
|
-
/* @__PURE__ */ jsx("div", { className: cls("flex items-center justify-between w-full", "p-4 py-2"), onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: TitleContent }),
|
|
260
|
-
children
|
|
261
|
-
] });
|
|
262
|
-
$[21] = TitleContent;
|
|
263
|
-
$[22] = children;
|
|
264
|
-
$[23] = isPreview;
|
|
265
|
-
$[24] = t11;
|
|
266
|
-
} else {
|
|
267
|
-
t11 = $[24];
|
|
268
|
-
}
|
|
269
|
-
let t12;
|
|
270
|
-
if ($[25] !== TitleContent || $[26] !== children || $[27] !== collapsed || $[28] !== isPreview || $[29] !== minimised || $[30] !== onToggleCollapsed || $[31] !== showCaret) {
|
|
271
|
-
t12 = !isPreview && showCaret && /* @__PURE__ */ jsx(ExpandablePanel, { invisible: true, expanded: !collapsed, onExpandedChange: (open) => {
|
|
272
|
-
if (open !== !collapsed) {
|
|
273
|
-
onToggleCollapsed?.();
|
|
274
|
-
}
|
|
275
|
-
}, className: cls("mt-6"), titleClassName: cls("min-h-0 p-0 border-none", "rounded flex items-center justify-between w-full", "hover:bg-transparent", "cursor-pointer select-none", collapsed && "bg-surface-100 dark:bg-surface-900/50"), innerClassName: cls("mt-4", !minimised ? "pt-0" : ""), title: /* @__PURE__ */ jsx("div", { onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), className: "flex items-center", children: TitleContent }), children: minimised ? /* @__PURE__ */ jsx("div", { className: cls("mt-4 p-8 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg"), style: {
|
|
276
|
-
minHeight: "50px"
|
|
277
|
-
} }) : /* @__PURE__ */ jsx("div", { className: cls("mt-4", !minimised ? "pt-0" : ""), children }) });
|
|
278
|
-
$[25] = TitleContent;
|
|
279
|
-
$[26] = children;
|
|
280
|
-
$[27] = collapsed;
|
|
281
|
-
$[28] = isPreview;
|
|
282
|
-
$[29] = minimised;
|
|
283
|
-
$[30] = onToggleCollapsed;
|
|
284
|
-
$[31] = showCaret;
|
|
285
|
-
$[32] = t12;
|
|
286
|
-
} else {
|
|
287
|
-
t12 = $[32];
|
|
288
|
-
}
|
|
289
|
-
let t13;
|
|
290
|
-
if ($[33] !== TitleContent || $[34] !== children || $[35] !== collapsed || $[36] !== isPreview || $[37] !== minimised || $[38] !== showCaret) {
|
|
291
|
-
t13 = !isPreview && !showCaret && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
292
|
-
/* @__PURE__ */ jsx("div", { className: cls("flex items-center justify-between w-full", "mt-6"), onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: TitleContent }),
|
|
293
|
-
!collapsed && (minimised ? /* @__PURE__ */ jsx("div", { className: cls("mt-4 p-8 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg"), style: {
|
|
294
|
-
minHeight: "50px"
|
|
295
|
-
} }) : /* @__PURE__ */ jsx("div", { className: cls("mt-4", !minimised ? "pt-0" : ""), children }))
|
|
296
|
-
] });
|
|
297
|
-
$[33] = TitleContent;
|
|
298
|
-
$[34] = children;
|
|
299
|
-
$[35] = collapsed;
|
|
300
|
-
$[36] = isPreview;
|
|
301
|
-
$[37] = minimised;
|
|
302
|
-
$[38] = showCaret;
|
|
303
|
-
$[39] = t13;
|
|
304
|
-
} else {
|
|
305
|
-
t13 = $[39];
|
|
306
|
-
}
|
|
307
|
-
let t14;
|
|
308
|
-
if ($[40] !== t10 || $[41] !== t11 || $[42] !== t12 || $[43] !== t13) {
|
|
309
|
-
t14 = /* @__PURE__ */ jsxs("div", { className: t10, children: [
|
|
310
|
-
t11,
|
|
311
|
-
t12,
|
|
312
|
-
t13
|
|
313
|
-
] });
|
|
314
|
-
$[40] = t10;
|
|
315
|
-
$[41] = t11;
|
|
316
|
-
$[42] = t12;
|
|
317
|
-
$[43] = t13;
|
|
318
|
-
$[44] = t14;
|
|
319
|
-
} else {
|
|
320
|
-
t14 = $[44];
|
|
321
|
-
}
|
|
322
|
-
return t14;
|
|
323
|
-
}
|
|
324
|
-
const NavigationCard = React__default.memo(function NavigationCard2(t0) {
|
|
325
|
-
const $ = c(31);
|
|
326
|
-
const {
|
|
327
|
-
name,
|
|
328
|
-
description,
|
|
329
|
-
icon,
|
|
330
|
-
actions,
|
|
331
|
-
additionalContent,
|
|
332
|
-
onClick,
|
|
333
|
-
shrink
|
|
334
|
-
} = t0;
|
|
335
|
-
const t1 = shrink && "w-full max-w-full min-h-0 scale-75";
|
|
336
|
-
let t2;
|
|
337
|
-
if ($[0] !== t1) {
|
|
338
|
-
t2 = cls("group h-full p-4 cursor-pointer transition-all duration-150 ease-in-out", "border-surface-200 dark:border-surface-700/40", "hover:shadow-md hover:shadow-black/[0.04]", "hover:border-surface-300 dark:hover:border-primary/20", t1);
|
|
339
|
-
$[0] = t1;
|
|
340
|
-
$[1] = t2;
|
|
341
|
-
} else {
|
|
342
|
-
t2 = $[1];
|
|
343
|
-
}
|
|
344
|
-
let t3;
|
|
345
|
-
if ($[2] !== onClick) {
|
|
346
|
-
t3 = () => {
|
|
347
|
-
onClick?.();
|
|
348
|
-
};
|
|
349
|
-
$[2] = onClick;
|
|
350
|
-
$[3] = t3;
|
|
351
|
-
} else {
|
|
352
|
-
t3 = $[3];
|
|
353
|
-
}
|
|
354
|
-
let t4;
|
|
355
|
-
if ($[4] !== icon) {
|
|
356
|
-
t4 = /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center w-7 h-7 rounded-lg bg-primary/8 dark:bg-primary/10 text-primary/70 dark:text-primary/60 transition-colors duration-200 group-hover:bg-primary/12 dark:group-hover:bg-primary/15 group-hover:text-primary dark:group-hover:text-primary/80", children: icon });
|
|
357
|
-
$[4] = icon;
|
|
358
|
-
$[5] = t4;
|
|
359
|
-
} else {
|
|
360
|
-
t4 = $[5];
|
|
361
|
-
}
|
|
362
|
-
let t5;
|
|
363
|
-
if ($[6] !== name) {
|
|
364
|
-
t5 = /* @__PURE__ */ jsx(Typography, { variant: "subtitle1", component: "h2", children: name });
|
|
365
|
-
$[6] = name;
|
|
366
|
-
$[7] = t5;
|
|
367
|
-
} else {
|
|
368
|
-
t5 = $[7];
|
|
369
|
-
}
|
|
370
|
-
let t6;
|
|
371
|
-
if ($[8] !== t4 || $[9] !== t5) {
|
|
372
|
-
t6 = /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
373
|
-
t4,
|
|
374
|
-
t5
|
|
375
|
-
] });
|
|
376
|
-
$[8] = t4;
|
|
377
|
-
$[9] = t5;
|
|
378
|
-
$[10] = t6;
|
|
379
|
-
} else {
|
|
380
|
-
t6 = $[10];
|
|
381
|
-
}
|
|
382
|
-
let t7;
|
|
383
|
-
if ($[11] !== actions) {
|
|
384
|
-
t7 = /* @__PURE__ */ jsx("div", { className: "flex items-center gap-0.5", onClick: _temp, children: actions });
|
|
385
|
-
$[11] = actions;
|
|
386
|
-
$[12] = t7;
|
|
387
|
-
} else {
|
|
388
|
-
t7 = $[12];
|
|
389
|
-
}
|
|
390
|
-
let t8;
|
|
391
|
-
if ($[13] !== t6 || $[14] !== t7) {
|
|
392
|
-
t8 = /* @__PURE__ */ jsxs("div", { className: "flex items-center w-full justify-between mb-1", children: [
|
|
393
|
-
t6,
|
|
394
|
-
t7
|
|
395
|
-
] });
|
|
396
|
-
$[13] = t6;
|
|
397
|
-
$[14] = t7;
|
|
398
|
-
$[15] = t8;
|
|
399
|
-
} else {
|
|
400
|
-
t8 = $[15];
|
|
401
|
-
}
|
|
402
|
-
let t9;
|
|
403
|
-
if ($[16] !== description) {
|
|
404
|
-
t9 = description && /* @__PURE__ */ jsx(Typography, { variant: "caption", color: "secondary", component: "div", children: /* @__PURE__ */ jsx(Markdown, { source: description, size: "small" }) });
|
|
405
|
-
$[16] = description;
|
|
406
|
-
$[17] = t9;
|
|
407
|
-
} else {
|
|
408
|
-
t9 = $[17];
|
|
409
|
-
}
|
|
410
|
-
let t10;
|
|
411
|
-
if ($[18] !== t9) {
|
|
412
|
-
t10 = /* @__PURE__ */ jsx("div", { className: "grow pl-[44px]", children: t9 });
|
|
413
|
-
$[18] = t9;
|
|
414
|
-
$[19] = t10;
|
|
415
|
-
} else {
|
|
416
|
-
t10 = $[19];
|
|
417
|
-
}
|
|
418
|
-
let t11;
|
|
419
|
-
if ($[20] !== additionalContent) {
|
|
420
|
-
t11 = additionalContent && /* @__PURE__ */ jsx("div", { className: "pl-[44px] pointer-events-none", children: additionalContent });
|
|
421
|
-
$[20] = additionalContent;
|
|
422
|
-
$[21] = t11;
|
|
423
|
-
} else {
|
|
424
|
-
t11 = $[21];
|
|
425
|
-
}
|
|
426
|
-
let t12;
|
|
427
|
-
if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
428
|
-
t12 = /* @__PURE__ */ jsx("div", { className: "self-end mt-1", children: /* @__PURE__ */ jsx("div", { className: "transition-transform duration-200 group-hover:translate-x-0.5", children: /* @__PURE__ */ jsx(ArrowRightIcon, { className: "text-primary" }) }) });
|
|
429
|
-
$[22] = t12;
|
|
430
|
-
} else {
|
|
431
|
-
t12 = $[22];
|
|
432
|
-
}
|
|
433
|
-
let t13;
|
|
434
|
-
if ($[23] !== t10 || $[24] !== t11 || $[25] !== t8) {
|
|
435
|
-
t13 = /* @__PURE__ */ jsxs("div", { className: "flex flex-col h-full", children: [
|
|
436
|
-
t8,
|
|
437
|
-
t10,
|
|
438
|
-
t11,
|
|
439
|
-
t12
|
|
440
|
-
] });
|
|
441
|
-
$[23] = t10;
|
|
442
|
-
$[24] = t11;
|
|
443
|
-
$[25] = t8;
|
|
444
|
-
$[26] = t13;
|
|
445
|
-
} else {
|
|
446
|
-
t13 = $[26];
|
|
447
|
-
}
|
|
448
|
-
let t14;
|
|
449
|
-
if ($[27] !== t13 || $[28] !== t2 || $[29] !== t3) {
|
|
450
|
-
t14 = /* @__PURE__ */ jsx(Card, { className: t2, onClick: t3, children: t13 });
|
|
451
|
-
$[27] = t13;
|
|
452
|
-
$[28] = t2;
|
|
453
|
-
$[29] = t3;
|
|
454
|
-
$[30] = t14;
|
|
455
|
-
} else {
|
|
456
|
-
t14 = $[30];
|
|
457
|
-
}
|
|
458
|
-
return t14;
|
|
459
|
-
});
|
|
460
|
-
function _temp(event) {
|
|
461
|
-
event.preventDefault();
|
|
462
|
-
event.stopPropagation();
|
|
463
|
-
}
|
|
464
|
-
function NavigationCardBinding(t0) {
|
|
465
|
-
const $ = c(38);
|
|
466
|
-
const {
|
|
467
|
-
slug,
|
|
468
|
-
collection,
|
|
469
|
-
view,
|
|
470
|
-
url,
|
|
471
|
-
name,
|
|
472
|
-
description,
|
|
473
|
-
onClick,
|
|
474
|
-
shrink
|
|
475
|
-
} = t0;
|
|
476
|
-
const userConfigurationPersistence = useUserConfigurationPersistence();
|
|
477
|
-
const t1 = collection ?? view;
|
|
478
|
-
let t2;
|
|
479
|
-
if ($[0] !== t1) {
|
|
480
|
-
t2 = /* @__PURE__ */ jsx(IconForView, { collectionOrView: t1 });
|
|
481
|
-
$[0] = t1;
|
|
482
|
-
$[1] = t2;
|
|
483
|
-
} else {
|
|
484
|
-
t2 = $[1];
|
|
485
|
-
}
|
|
486
|
-
const collectionIcon = t2;
|
|
487
|
-
const navigate = useNavigate();
|
|
488
|
-
const context = useRebaseContext();
|
|
489
|
-
let t3;
|
|
490
|
-
if ($[2] !== userConfigurationPersistence?.favouritePaths) {
|
|
491
|
-
t3 = userConfigurationPersistence?.favouritePaths ?? [];
|
|
492
|
-
$[2] = userConfigurationPersistence?.favouritePaths;
|
|
493
|
-
$[3] = t3;
|
|
494
|
-
} else {
|
|
495
|
-
t3 = $[3];
|
|
496
|
-
}
|
|
497
|
-
let t4;
|
|
498
|
-
if ($[4] !== slug || $[5] !== t3) {
|
|
499
|
-
t4 = t3.includes(slug);
|
|
500
|
-
$[4] = slug;
|
|
501
|
-
$[5] = t3;
|
|
502
|
-
$[6] = t4;
|
|
503
|
-
} else {
|
|
504
|
-
t4 = $[6];
|
|
505
|
-
}
|
|
506
|
-
const favourite = t4;
|
|
507
|
-
let t5;
|
|
508
|
-
if ($[7] !== favourite || $[8] !== slug || $[9] !== userConfigurationPersistence) {
|
|
509
|
-
t5 = userConfigurationPersistence ? [/* @__PURE__ */ jsx(IconButton, { size: "small", onClick: (e) => {
|
|
510
|
-
e.preventDefault();
|
|
511
|
-
e.stopPropagation();
|
|
512
|
-
if (favourite) {
|
|
513
|
-
userConfigurationPersistence.setFavouritePaths(userConfigurationPersistence.favouritePaths.filter((p) => p !== slug));
|
|
514
|
-
} else {
|
|
515
|
-
userConfigurationPersistence.setFavouritePaths([...userConfigurationPersistence.favouritePaths, slug]);
|
|
516
|
-
}
|
|
517
|
-
}, children: /* @__PURE__ */ jsx(StarIcon, { className: favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500" }) }, "favourite")] : [];
|
|
518
|
-
$[7] = favourite;
|
|
519
|
-
$[8] = slug;
|
|
520
|
-
$[9] = userConfigurationPersistence;
|
|
521
|
-
$[10] = t5;
|
|
522
|
-
} else {
|
|
523
|
-
t5 = $[10];
|
|
524
|
-
}
|
|
525
|
-
const actionsArray = t5;
|
|
526
|
-
let t6;
|
|
527
|
-
if ($[11] !== collection || $[12] !== context || $[13] !== slug) {
|
|
528
|
-
t6 = {
|
|
529
|
-
slug,
|
|
530
|
-
collection,
|
|
531
|
-
context
|
|
532
|
-
};
|
|
533
|
-
$[11] = collection;
|
|
534
|
-
$[12] = context;
|
|
535
|
-
$[13] = slug;
|
|
536
|
-
$[14] = t6;
|
|
537
|
-
} else {
|
|
538
|
-
t6 = $[14];
|
|
539
|
-
}
|
|
540
|
-
const pluginCardActions = useSlot("home.collection.actions", t6);
|
|
541
|
-
let t7;
|
|
542
|
-
if ($[15] !== collection || $[16] !== context || $[17] !== slug) {
|
|
543
|
-
t7 = {
|
|
544
|
-
slug,
|
|
545
|
-
collection,
|
|
546
|
-
context
|
|
547
|
-
};
|
|
548
|
-
$[15] = collection;
|
|
549
|
-
$[16] = context;
|
|
550
|
-
$[17] = slug;
|
|
551
|
-
$[18] = t7;
|
|
552
|
-
} else {
|
|
553
|
-
t7 = $[18];
|
|
554
|
-
}
|
|
555
|
-
const pluginCardInsights = useSlot("home.card.insight", t7);
|
|
556
|
-
let t8;
|
|
557
|
-
if ($[19] !== actionsArray || $[20] !== pluginCardActions) {
|
|
558
|
-
t8 = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
559
|
-
actionsArray,
|
|
560
|
-
pluginCardActions
|
|
561
|
-
] });
|
|
562
|
-
$[19] = actionsArray;
|
|
563
|
-
$[20] = pluginCardActions;
|
|
564
|
-
$[21] = t8;
|
|
565
|
-
} else {
|
|
566
|
-
t8 = $[21];
|
|
567
|
-
}
|
|
568
|
-
const actions = t8;
|
|
569
|
-
let t9;
|
|
570
|
-
if ($[22] !== pluginCardInsights) {
|
|
571
|
-
t9 = pluginCardInsights.length > 0 ? /* @__PURE__ */ jsx(Fragment, { children: pluginCardInsights }) : void 0;
|
|
572
|
-
$[22] = pluginCardInsights;
|
|
573
|
-
$[23] = t9;
|
|
574
|
-
} else {
|
|
575
|
-
t9 = $[23];
|
|
576
|
-
}
|
|
577
|
-
let t10;
|
|
578
|
-
if ($[24] !== navigate || $[25] !== onClick || $[26] !== slug || $[27] !== url || $[28] !== userConfigurationPersistence) {
|
|
579
|
-
t10 = () => {
|
|
580
|
-
onClick?.();
|
|
581
|
-
navigate(url);
|
|
582
|
-
if (userConfigurationPersistence) {
|
|
583
|
-
userConfigurationPersistence.setRecentlyVisitedPaths([slug, ...(userConfigurationPersistence.recentlyVisitedPaths ?? []).filter((p_0) => p_0 !== slug)]);
|
|
584
|
-
}
|
|
585
|
-
};
|
|
586
|
-
$[24] = navigate;
|
|
587
|
-
$[25] = onClick;
|
|
588
|
-
$[26] = slug;
|
|
589
|
-
$[27] = url;
|
|
590
|
-
$[28] = userConfigurationPersistence;
|
|
591
|
-
$[29] = t10;
|
|
592
|
-
} else {
|
|
593
|
-
t10 = $[29];
|
|
594
|
-
}
|
|
595
|
-
let t11;
|
|
596
|
-
if ($[30] !== actions || $[31] !== collectionIcon || $[32] !== description || $[33] !== name || $[34] !== shrink || $[35] !== t10 || $[36] !== t9) {
|
|
597
|
-
t11 = /* @__PURE__ */ jsx(NavigationCard, { icon: collectionIcon, name, description, actions, additionalContent: t9, onClick: t10, shrink });
|
|
598
|
-
$[30] = actions;
|
|
599
|
-
$[31] = collectionIcon;
|
|
600
|
-
$[32] = description;
|
|
601
|
-
$[33] = name;
|
|
602
|
-
$[34] = shrink;
|
|
603
|
-
$[35] = t10;
|
|
604
|
-
$[36] = t9;
|
|
605
|
-
$[37] = t11;
|
|
606
|
-
} else {
|
|
607
|
-
t11 = $[37];
|
|
608
|
-
}
|
|
609
|
-
return t11;
|
|
610
|
-
}
|
|
611
|
-
const animateLayoutChanges = (args) => defaultAnimateLayoutChanges({
|
|
612
|
-
...args,
|
|
613
|
-
wasDragging: true
|
|
614
|
-
});
|
|
615
|
-
const dropAnimationConfig = {};
|
|
616
|
-
const cloneSerializableNavigationEntry = (entry) => {
|
|
617
|
-
const clonedEntry = {
|
|
618
|
-
id: entry.id,
|
|
619
|
-
slug: entry.slug,
|
|
620
|
-
url: entry.url,
|
|
621
|
-
name: entry.name,
|
|
622
|
-
type: entry.type,
|
|
623
|
-
collection: entry.collection ? {
|
|
624
|
-
...entry.collection
|
|
625
|
-
} : void 0,
|
|
626
|
-
view: entry.view ? {
|
|
627
|
-
...entry.view
|
|
628
|
-
} : void 0,
|
|
629
|
-
...entry.group && {
|
|
630
|
-
group: entry.group
|
|
631
|
-
},
|
|
632
|
-
...entry.description && {
|
|
633
|
-
description: entry.description
|
|
634
|
-
}
|
|
635
|
-
};
|
|
636
|
-
return clonedEntry;
|
|
637
|
-
};
|
|
638
|
-
const cloneItemsForDnd = (items) => items.map((g) => ({
|
|
639
|
-
name: g.name,
|
|
640
|
-
entries: g.entries.map(cloneSerializableNavigationEntry)
|
|
641
|
-
}));
|
|
642
|
-
function SortableNavigationCard(t0) {
|
|
643
|
-
const $ = c(17);
|
|
644
|
-
const {
|
|
645
|
-
entry,
|
|
646
|
-
onClick
|
|
647
|
-
} = t0;
|
|
648
|
-
let t1;
|
|
649
|
-
if ($[0] !== entry.url) {
|
|
650
|
-
t1 = {
|
|
651
|
-
id: entry.url,
|
|
652
|
-
animateLayoutChanges
|
|
653
|
-
};
|
|
654
|
-
$[0] = entry.url;
|
|
655
|
-
$[1] = t1;
|
|
656
|
-
} else {
|
|
657
|
-
t1 = $[1];
|
|
658
|
-
}
|
|
659
|
-
const {
|
|
660
|
-
setNodeRef,
|
|
661
|
-
listeners,
|
|
662
|
-
attributes,
|
|
663
|
-
transform,
|
|
664
|
-
transition,
|
|
665
|
-
isDragging
|
|
666
|
-
} = useSortable(t1);
|
|
667
|
-
let t2;
|
|
668
|
-
if ($[2] !== transform) {
|
|
669
|
-
t2 = transform ? CSS.Transform.toString(transform) : void 0;
|
|
670
|
-
$[2] = transform;
|
|
671
|
-
$[3] = t2;
|
|
672
|
-
} else {
|
|
673
|
-
t2 = $[3];
|
|
674
|
-
}
|
|
675
|
-
const t3 = isDragging ? 0 : 1;
|
|
676
|
-
let t4;
|
|
677
|
-
if ($[4] !== t2 || $[5] !== t3 || $[6] !== transition) {
|
|
678
|
-
t4 = {
|
|
679
|
-
transform: t2,
|
|
680
|
-
transition,
|
|
681
|
-
opacity: t3
|
|
682
|
-
};
|
|
683
|
-
$[4] = t2;
|
|
684
|
-
$[5] = t3;
|
|
685
|
-
$[6] = transition;
|
|
686
|
-
$[7] = t4;
|
|
687
|
-
} else {
|
|
688
|
-
t4 = $[7];
|
|
689
|
-
}
|
|
690
|
-
const style = t4;
|
|
691
|
-
let t5;
|
|
692
|
-
if ($[8] !== entry || $[9] !== onClick) {
|
|
693
|
-
t5 = /* @__PURE__ */ jsx(NavigationCardBinding, { ...entry, onClick });
|
|
694
|
-
$[8] = entry;
|
|
695
|
-
$[9] = onClick;
|
|
696
|
-
$[10] = t5;
|
|
697
|
-
} else {
|
|
698
|
-
t5 = $[10];
|
|
699
|
-
}
|
|
700
|
-
let t6;
|
|
701
|
-
if ($[11] !== attributes || $[12] !== listeners || $[13] !== setNodeRef || $[14] !== style || $[15] !== t5) {
|
|
702
|
-
t6 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners, children: t5 });
|
|
703
|
-
$[11] = attributes;
|
|
704
|
-
$[12] = listeners;
|
|
705
|
-
$[13] = setNodeRef;
|
|
706
|
-
$[14] = style;
|
|
707
|
-
$[15] = t5;
|
|
708
|
-
$[16] = t6;
|
|
709
|
-
} else {
|
|
710
|
-
t6 = $[16];
|
|
711
|
-
}
|
|
712
|
-
return t6;
|
|
713
|
-
}
|
|
714
|
-
function NavigationGroupDroppable(t0) {
|
|
715
|
-
const $ = c(11);
|
|
716
|
-
const {
|
|
717
|
-
id,
|
|
718
|
-
itemIds,
|
|
719
|
-
children,
|
|
720
|
-
isPotentialCardDropTarget: t1
|
|
721
|
-
} = t0;
|
|
722
|
-
const isPotentialCardDropTarget = t1 === void 0 ? false : t1;
|
|
723
|
-
let t2;
|
|
724
|
-
if ($[0] !== id) {
|
|
725
|
-
t2 = {
|
|
726
|
-
id
|
|
727
|
-
};
|
|
728
|
-
$[0] = id;
|
|
729
|
-
$[1] = t2;
|
|
730
|
-
} else {
|
|
731
|
-
t2 = $[1];
|
|
732
|
-
}
|
|
733
|
-
const {
|
|
734
|
-
setNodeRef
|
|
735
|
-
} = useDroppable(t2);
|
|
736
|
-
const t3 = isPotentialCardDropTarget ? "p-2 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg" : void 0;
|
|
737
|
-
let t4;
|
|
738
|
-
if ($[2] !== t3) {
|
|
739
|
-
t4 = cls(t3, "transition-all duration-200 ease-in-out");
|
|
740
|
-
$[2] = t3;
|
|
741
|
-
$[3] = t4;
|
|
742
|
-
} else {
|
|
743
|
-
t4 = $[3];
|
|
744
|
-
}
|
|
745
|
-
let t5;
|
|
746
|
-
if ($[4] !== children || $[5] !== itemIds) {
|
|
747
|
-
t5 = /* @__PURE__ */ jsx(SortableContext, { items: itemIds, strategy: rectSortingStrategy, children });
|
|
748
|
-
$[4] = children;
|
|
749
|
-
$[5] = itemIds;
|
|
750
|
-
$[6] = t5;
|
|
751
|
-
} else {
|
|
752
|
-
t5 = $[6];
|
|
753
|
-
}
|
|
754
|
-
let t6;
|
|
755
|
-
if ($[7] !== setNodeRef || $[8] !== t4 || $[9] !== t5) {
|
|
756
|
-
t6 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, className: t4, children: t5 });
|
|
757
|
-
$[7] = setNodeRef;
|
|
758
|
-
$[8] = t4;
|
|
759
|
-
$[9] = t5;
|
|
760
|
-
$[10] = t6;
|
|
761
|
-
} else {
|
|
762
|
-
t6 = $[10];
|
|
763
|
-
}
|
|
764
|
-
return t6;
|
|
765
|
-
}
|
|
766
|
-
function SortableNavigationGroup(t0) {
|
|
767
|
-
const $ = c(15);
|
|
768
|
-
const {
|
|
769
|
-
groupName,
|
|
770
|
-
children,
|
|
771
|
-
disabled
|
|
772
|
-
} = t0;
|
|
773
|
-
let t1;
|
|
774
|
-
if ($[0] !== disabled || $[1] !== groupName) {
|
|
775
|
-
t1 = {
|
|
776
|
-
id: groupName,
|
|
777
|
-
animateLayoutChanges,
|
|
778
|
-
disabled
|
|
779
|
-
};
|
|
780
|
-
$[0] = disabled;
|
|
781
|
-
$[1] = groupName;
|
|
782
|
-
$[2] = t1;
|
|
783
|
-
} else {
|
|
784
|
-
t1 = $[2];
|
|
785
|
-
}
|
|
786
|
-
const {
|
|
787
|
-
attributes,
|
|
788
|
-
listeners,
|
|
789
|
-
setNodeRef,
|
|
790
|
-
transform,
|
|
791
|
-
transition,
|
|
792
|
-
isDragging
|
|
793
|
-
} = useSortable(t1);
|
|
794
|
-
let t2;
|
|
795
|
-
if ($[3] !== transform) {
|
|
796
|
-
t2 = transform ? CSS.Transform.toString(transform) : void 0;
|
|
797
|
-
$[3] = transform;
|
|
798
|
-
$[4] = t2;
|
|
799
|
-
} else {
|
|
800
|
-
t2 = $[4];
|
|
801
|
-
}
|
|
802
|
-
const t3 = isDragging ? 0 : 1;
|
|
803
|
-
let t4;
|
|
804
|
-
if ($[5] !== t2 || $[6] !== t3 || $[7] !== transition) {
|
|
805
|
-
t4 = {
|
|
806
|
-
transform: t2,
|
|
807
|
-
transition,
|
|
808
|
-
opacity: t3
|
|
809
|
-
};
|
|
810
|
-
$[5] = t2;
|
|
811
|
-
$[6] = t3;
|
|
812
|
-
$[7] = transition;
|
|
813
|
-
$[8] = t4;
|
|
814
|
-
} else {
|
|
815
|
-
t4 = $[8];
|
|
816
|
-
}
|
|
817
|
-
const style = t4;
|
|
818
|
-
let t5;
|
|
819
|
-
if ($[9] !== attributes || $[10] !== children || $[11] !== listeners || $[12] !== setNodeRef || $[13] !== style) {
|
|
820
|
-
t5 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners, children });
|
|
821
|
-
$[9] = attributes;
|
|
822
|
-
$[10] = children;
|
|
823
|
-
$[11] = listeners;
|
|
824
|
-
$[12] = setNodeRef;
|
|
825
|
-
$[13] = style;
|
|
826
|
-
$[14] = t5;
|
|
827
|
-
} else {
|
|
828
|
-
t5 = $[14];
|
|
829
|
-
}
|
|
830
|
-
return t5;
|
|
831
|
-
}
|
|
832
|
-
function useHomePageDnd({
|
|
833
|
-
items,
|
|
834
|
-
setItems,
|
|
835
|
-
disabled,
|
|
836
|
-
onCardMovedBetweenGroups,
|
|
837
|
-
onGroupMoved,
|
|
838
|
-
onNewGroupDrop,
|
|
839
|
-
onPersist
|
|
840
|
-
}) {
|
|
841
|
-
const dndItems = items;
|
|
842
|
-
const setDndItems = setItems;
|
|
843
|
-
const [activeId, setActiveId] = useState(null);
|
|
844
|
-
const [activeIsGroup, setActiveIsGroup] = useState(false);
|
|
845
|
-
const [currentDraggingGroupId, setCurrentDraggingGroupId] = useState(null);
|
|
846
|
-
const [dndKitActiveNode, setDndKitActiveNode] = useState(null);
|
|
847
|
-
const [isDraggingCardOnly, setIsDraggingCardOnly] = useState(false);
|
|
848
|
-
const [dialogOpenForGroup, setDialogOpenForGroup] = useState(null);
|
|
849
|
-
const [isHoveringNewGroupDropZone, setIsHoveringNewGroupDropZone] = useState(false);
|
|
850
|
-
const [pendingNewGroupName, setPendingNewGroupName] = useState(null);
|
|
851
|
-
const [stateBeforeNewGroup, setStateBeforeNewGroup] = useState(null);
|
|
852
|
-
const preDragItemsRef = useRef(null);
|
|
853
|
-
const interimItemsRef = useRef(null);
|
|
854
|
-
useEffect(() => {
|
|
855
|
-
interimItemsRef.current = dndItems;
|
|
856
|
-
}, [dndItems]);
|
|
857
|
-
const mouseSensor = useSensor(MouseSensor, {
|
|
858
|
-
activationConstraint: {
|
|
859
|
-
distance: 10
|
|
860
|
-
}
|
|
861
|
-
});
|
|
862
|
-
const touchSensor = useSensor(TouchSensor, {
|
|
863
|
-
activationConstraint: {
|
|
864
|
-
delay: 150,
|
|
865
|
-
tolerance: 5
|
|
866
|
-
}
|
|
867
|
-
});
|
|
868
|
-
const keyboardSensor = useSensor(KeyboardSensor);
|
|
869
|
-
const sensors = useSensors(mouseSensor, touchSensor, keyboardSensor);
|
|
870
|
-
const dndContainers = dndItems.map((g) => g.name);
|
|
871
|
-
const findDndContainer = useCallback((id) => {
|
|
872
|
-
if (!id) return void 0;
|
|
873
|
-
const group = dndItems.find((g_0) => g_0.name === id);
|
|
874
|
-
if (group) return group.name;
|
|
875
|
-
for (const g_1 of dndItems) {
|
|
876
|
-
if (g_1.entries.some((e) => e.url === id)) return g_1.name;
|
|
877
|
-
}
|
|
878
|
-
return void 0;
|
|
879
|
-
}, [dndItems]);
|
|
880
|
-
const lastOverId = useRef(null);
|
|
881
|
-
const recentlyMovedToNewContainer = useRef(false);
|
|
882
|
-
const collisionDetection = useCallback((args) => {
|
|
883
|
-
if (disabled || !activeId) return [];
|
|
884
|
-
if (activeIsGroup) {
|
|
885
|
-
const groups = args.droppableContainers.filter((c2) => dndItems.some((g_2) => g_2.name === c2.id));
|
|
886
|
-
if (!groups.length) return [];
|
|
887
|
-
return closestCenter({
|
|
888
|
-
...args,
|
|
889
|
-
droppableContainers: groups
|
|
890
|
-
});
|
|
891
|
-
}
|
|
892
|
-
const pointer = pointerWithin(args);
|
|
893
|
-
if (pointer.length) {
|
|
894
|
-
const zone = pointer.find((c_0) => c_0.id === "new-group-drop-zone");
|
|
895
|
-
if (zone) return [zone];
|
|
896
|
-
const container = pointer.find((c_1) => dndItems.some((g_3) => g_3.name === c_1.id));
|
|
897
|
-
if (container) {
|
|
898
|
-
const itemsIn = dndItems.find((g_4) => g_4.name === container.id)?.entries;
|
|
899
|
-
if (itemsIn?.length) {
|
|
900
|
-
const closest = closestCorners({
|
|
901
|
-
...args,
|
|
902
|
-
droppableContainers: args.droppableContainers.filter((c_2) => itemsIn.some((e_0) => e_0.url === c_2.id))
|
|
903
|
-
});
|
|
904
|
-
if (closest.length) return closest;
|
|
905
|
-
}
|
|
906
|
-
return [container];
|
|
907
|
-
}
|
|
908
|
-
const first = getFirstCollision(pointer, "id");
|
|
909
|
-
if (first) return [{
|
|
910
|
-
id: first
|
|
911
|
-
}];
|
|
912
|
-
}
|
|
913
|
-
const rects = rectIntersection(args);
|
|
914
|
-
const zoneRect = rects.find((c_3) => c_3.id === "new-group-drop-zone");
|
|
915
|
-
if (zoneRect) return [zoneRect];
|
|
916
|
-
let overId = getFirstCollision(rects, "id");
|
|
917
|
-
if (overId != null) {
|
|
918
|
-
const overIsContainer = dndItems.some((g_5) => g_5.name === overId);
|
|
919
|
-
if (overIsContainer) {
|
|
920
|
-
const itemsIn_0 = dndItems.find((g_6) => g_6.name === overId)?.entries;
|
|
921
|
-
if (itemsIn_0?.length) {
|
|
922
|
-
const closestItem = closestCorners({
|
|
923
|
-
...args,
|
|
924
|
-
droppableContainers: args.droppableContainers.filter((c_4) => itemsIn_0.some((e_1) => e_1.url === c_4.id))
|
|
925
|
-
})[0]?.id;
|
|
926
|
-
if (closestItem) overId = closestItem;
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
lastOverId.current = overId;
|
|
930
|
-
return [{
|
|
931
|
-
id: overId
|
|
932
|
-
}];
|
|
933
|
-
}
|
|
934
|
-
if (recentlyMovedToNewContainer.current && lastOverId.current && !activeIsGroup) return [{
|
|
935
|
-
id: lastOverId.current
|
|
936
|
-
}];
|
|
937
|
-
return [];
|
|
938
|
-
}, [activeId, dndItems, disabled, activeIsGroup]);
|
|
939
|
-
const handleDragStart = ({
|
|
940
|
-
active
|
|
941
|
-
}) => {
|
|
942
|
-
setDndKitActiveNode(active);
|
|
943
|
-
if (disabled) return;
|
|
944
|
-
preDragItemsRef.current = cloneItemsForDnd(dndItems);
|
|
945
|
-
const isGroup = dndItems.some((g_7) => g_7.name === active.id);
|
|
946
|
-
if (!active.data.current) active.data.current = {};
|
|
947
|
-
active.data.current.type = isGroup ? "group" : "item";
|
|
948
|
-
setActiveId(active.id);
|
|
949
|
-
setActiveIsGroup(isGroup);
|
|
950
|
-
setIsDraggingCardOnly(!isGroup);
|
|
951
|
-
if (isGroup) setCurrentDraggingGroupId(active.id);
|
|
952
|
-
recentlyMovedToNewContainer.current = false;
|
|
953
|
-
};
|
|
954
|
-
const handleDragOver = ({
|
|
955
|
-
active: active_0,
|
|
956
|
-
over
|
|
957
|
-
}) => {
|
|
958
|
-
if (disabled || !over) return;
|
|
959
|
-
const activeIdNow = active_0.id;
|
|
960
|
-
const overIdNow = over.id;
|
|
961
|
-
if (activeIdNow === overIdNow) return;
|
|
962
|
-
if (activeIsGroup) return;
|
|
963
|
-
const activeCont = findDndContainer(activeIdNow);
|
|
964
|
-
const overCont = findDndContainer(overIdNow);
|
|
965
|
-
if (!activeCont) return;
|
|
966
|
-
if (overCont && activeCont !== overCont) {
|
|
967
|
-
recentlyMovedToNewContainer.current = true;
|
|
968
|
-
lastOverId.current = overIdNow;
|
|
969
|
-
setDndItems((current) => {
|
|
970
|
-
const newState = cloneItemsForDnd(current);
|
|
971
|
-
const srcIdx = newState.findIndex((g_8) => g_8.name === activeCont);
|
|
972
|
-
const tgtIdx = newState.findIndex((g_9) => g_9.name === overCont);
|
|
973
|
-
if (srcIdx === -1 || tgtIdx === -1) return current;
|
|
974
|
-
const src = newState[srcIdx];
|
|
975
|
-
const tgt = newState[tgtIdx];
|
|
976
|
-
const idxInSrc = src.entries.findIndex((e_2) => e_2.url === activeIdNow);
|
|
977
|
-
if (idxInSrc === -1) return current;
|
|
978
|
-
const [moved] = src.entries.splice(idxInSrc, 1);
|
|
979
|
-
const overIsContainer_0 = overIdNow === overCont;
|
|
980
|
-
if (overIsContainer_0) {
|
|
981
|
-
tgt.entries.push(moved);
|
|
982
|
-
} else {
|
|
983
|
-
const overIdx = tgt.entries.findIndex((e_3) => e_3.url === overIdNow);
|
|
984
|
-
if (overIdx !== -1) {
|
|
985
|
-
tgt.entries.splice(overIdx, 0, moved);
|
|
986
|
-
} else {
|
|
987
|
-
tgt.entries.push(moved);
|
|
988
|
-
}
|
|
989
|
-
}
|
|
990
|
-
return newState;
|
|
991
|
-
});
|
|
992
|
-
} else if (activeCont === overCont) {
|
|
993
|
-
recentlyMovedToNewContainer.current = false;
|
|
994
|
-
}
|
|
995
|
-
};
|
|
996
|
-
const handleDragEnd = ({
|
|
997
|
-
active: active_1,
|
|
998
|
-
over: over_0
|
|
999
|
-
}) => {
|
|
1000
|
-
if (disabled || !over_0) {
|
|
1001
|
-
resetDragState();
|
|
1002
|
-
return;
|
|
1003
|
-
}
|
|
1004
|
-
const activeIdNow_0 = active_1.id;
|
|
1005
|
-
const overIdNow_0 = over_0.id;
|
|
1006
|
-
if (activeIsGroup) {
|
|
1007
|
-
if (activeIdNow_0 !== overIdNow_0 && dndItems.some((g_12) => g_12.name === overIdNow_0)) {
|
|
1008
|
-
const from = dndItems.findIndex((g_10) => g_10.name === activeIdNow_0);
|
|
1009
|
-
const to = dndItems.findIndex((g_11) => g_11.name === overIdNow_0);
|
|
1010
|
-
if (from !== -1 && to !== -1) {
|
|
1011
|
-
const newState_0 = arrayMove(dndItems, from, to);
|
|
1012
|
-
setDndItems(newState_0);
|
|
1013
|
-
onPersist?.(newState_0);
|
|
1014
|
-
onGroupMoved?.(activeIdNow_0, from, to);
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
} else {
|
|
1018
|
-
const findContainerInState = (id_0, state) => {
|
|
1019
|
-
const group_0 = state.find((g_13) => g_13.name === id_0);
|
|
1020
|
-
if (group_0) return group_0.name;
|
|
1021
|
-
for (const g_14 of state) {
|
|
1022
|
-
if (g_14.entries.some((e_4) => e_4.url === id_0)) return g_14.name;
|
|
1023
|
-
}
|
|
1024
|
-
return void 0;
|
|
1025
|
-
};
|
|
1026
|
-
const sourceState = preDragItemsRef.current || dndItems;
|
|
1027
|
-
const activeCont_0 = findContainerInState(activeIdNow_0, sourceState);
|
|
1028
|
-
findDndContainer(overIdNow_0);
|
|
1029
|
-
if (overIdNow_0 === "new-group-drop-zone") {
|
|
1030
|
-
if (activeCont_0) {
|
|
1031
|
-
setStateBeforeNewGroup(cloneItemsForDnd(dndItems));
|
|
1032
|
-
const newState_1 = cloneItemsForDnd(dndItems);
|
|
1033
|
-
const srcIdx_0 = newState_1.findIndex((g_15) => g_15.name === activeCont_0);
|
|
1034
|
-
if (srcIdx_0 !== -1) {
|
|
1035
|
-
const src_0 = newState_1[srcIdx_0];
|
|
1036
|
-
const idxInSrc_0 = src_0.entries.findIndex((e_5) => e_5.url === activeIdNow_0);
|
|
1037
|
-
if (idxInSrc_0 !== -1) {
|
|
1038
|
-
const [dragged] = src_0.entries.splice(idxInSrc_0, 1);
|
|
1039
|
-
if (src_0.entries.length === 0) newState_1.splice(srcIdx_0, 1);
|
|
1040
|
-
let tentative = "New Group";
|
|
1041
|
-
let counter = 1;
|
|
1042
|
-
while (newState_1.some((g_16) => g_16.name === tentative)) tentative = `New Group ${counter++}`;
|
|
1043
|
-
newState_1.push({
|
|
1044
|
-
name: tentative,
|
|
1045
|
-
entries: [dragged]
|
|
1046
|
-
});
|
|
1047
|
-
setDndItems(newState_1);
|
|
1048
|
-
setPendingNewGroupName(tentative);
|
|
1049
|
-
setDialogOpenForGroup(tentative);
|
|
1050
|
-
onNewGroupDrop?.();
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
} else {
|
|
1055
|
-
const overCont_1 = findDndContainer(overIdNow_0);
|
|
1056
|
-
if (activeCont_0 === overCont_1) {
|
|
1057
|
-
const grpIdx = dndItems.findIndex((g_17) => g_17.name === activeCont_0);
|
|
1058
|
-
if (grpIdx !== -1) {
|
|
1059
|
-
const group_1 = dndItems[grpIdx];
|
|
1060
|
-
const oldIdx = group_1.entries.findIndex((e_6) => e_6.url === activeIdNow_0);
|
|
1061
|
-
let newIdx = group_1.entries.findIndex((e_7) => e_7.url === overIdNow_0);
|
|
1062
|
-
if (newIdx === -1 && overIdNow_0 === activeCont_0) newIdx = group_1.entries.length - 1;
|
|
1063
|
-
if (oldIdx !== -1 && newIdx !== -1 && oldIdx !== newIdx) {
|
|
1064
|
-
const reordered = arrayMove(group_1.entries, oldIdx, newIdx);
|
|
1065
|
-
const newState_2 = [...dndItems];
|
|
1066
|
-
newState_2[grpIdx] = {
|
|
1067
|
-
...group_1,
|
|
1068
|
-
entries: reordered
|
|
1069
|
-
};
|
|
1070
|
-
setDndItems(newState_2);
|
|
1071
|
-
onPersist?.(newState_2);
|
|
1072
|
-
}
|
|
1073
|
-
}
|
|
1074
|
-
} else if (overCont_1 && activeCont_0 !== overCont_1) {
|
|
1075
|
-
const finalState = cloneItemsForDnd(sourceState);
|
|
1076
|
-
const finalOverId = lastOverId.current || overIdNow_0;
|
|
1077
|
-
const cleanOverCont = findContainerInState(finalOverId, sourceState) || overCont_1;
|
|
1078
|
-
const srcIdx_1 = finalState.findIndex((g_18) => g_18.name === activeCont_0);
|
|
1079
|
-
const tgtIdx_0 = finalState.findIndex((g_19) => g_19.name === cleanOverCont);
|
|
1080
|
-
if (srcIdx_1 !== -1 && tgtIdx_0 !== -1) {
|
|
1081
|
-
const src_1 = finalState[srcIdx_1];
|
|
1082
|
-
const tgt_0 = finalState[tgtIdx_0];
|
|
1083
|
-
const idxInSrc_1 = src_1.entries.findIndex((e_8) => e_8.url === activeIdNow_0);
|
|
1084
|
-
if (idxInSrc_1 !== -1) {
|
|
1085
|
-
const [moved_0] = src_1.entries.splice(idxInSrc_1, 1);
|
|
1086
|
-
const overIsContainer_1 = finalOverId === cleanOverCont;
|
|
1087
|
-
if (overIsContainer_1) {
|
|
1088
|
-
tgt_0.entries.push(moved_0);
|
|
1089
|
-
} else {
|
|
1090
|
-
const overIdx_0 = tgt_0.entries.findIndex((e_9) => e_9.url === finalOverId);
|
|
1091
|
-
if (overIdx_0 !== -1) {
|
|
1092
|
-
tgt_0.entries.splice(overIdx_0, 0, moved_0);
|
|
1093
|
-
} else {
|
|
1094
|
-
tgt_0.entries.push(moved_0);
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
if (src_1.entries.length === 0) {
|
|
1098
|
-
finalState.splice(srcIdx_1, 1);
|
|
1099
|
-
}
|
|
1100
|
-
setDndItems(finalState);
|
|
1101
|
-
onPersist?.(finalState);
|
|
1102
|
-
onCardMovedBetweenGroups?.(moved_0);
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
} else if (recentlyMovedToNewContainer.current) {
|
|
1106
|
-
console.error("Move between containers detected but conditions not met", {
|
|
1107
|
-
activeCont: activeCont_0,
|
|
1108
|
-
overCont: overCont_1,
|
|
1109
|
-
activeIdNow: activeIdNow_0,
|
|
1110
|
-
overIdNow: overIdNow_0
|
|
1111
|
-
});
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
resetDragState();
|
|
1116
|
-
};
|
|
1117
|
-
const resetDragState = () => {
|
|
1118
|
-
setDndKitActiveNode(null);
|
|
1119
|
-
setActiveId(null);
|
|
1120
|
-
setActiveIsGroup(false);
|
|
1121
|
-
setCurrentDraggingGroupId(null);
|
|
1122
|
-
setIsDraggingCardOnly(false);
|
|
1123
|
-
recentlyMovedToNewContainer.current = false;
|
|
1124
|
-
};
|
|
1125
|
-
const handleDragCancel = () => resetDragState();
|
|
1126
|
-
const handleRenameGroup = (oldName, newName) => {
|
|
1127
|
-
setDndItems((current_0) => {
|
|
1128
|
-
const idx = current_0.findIndex((g_20) => g_20.name === oldName);
|
|
1129
|
-
if (idx === -1) return current_0;
|
|
1130
|
-
if (current_0.some((g_21) => g_21.name === newName && g_21.name !== oldName)) return current_0;
|
|
1131
|
-
const updated = [...current_0];
|
|
1132
|
-
updated[idx] = {
|
|
1133
|
-
...updated[idx],
|
|
1134
|
-
name: newName
|
|
1135
|
-
};
|
|
1136
|
-
onPersist?.(updated);
|
|
1137
|
-
return updated;
|
|
1138
|
-
});
|
|
1139
|
-
setPendingNewGroupName(null);
|
|
1140
|
-
setStateBeforeNewGroup(null);
|
|
1141
|
-
setDialogOpenForGroup(null);
|
|
1142
|
-
};
|
|
1143
|
-
const handleDialogClose = () => {
|
|
1144
|
-
if (pendingNewGroupName && dialogOpenForGroup === pendingNewGroupName && stateBeforeNewGroup) {
|
|
1145
|
-
setDndItems(stateBeforeNewGroup);
|
|
1146
|
-
}
|
|
1147
|
-
setPendingNewGroupName(null);
|
|
1148
|
-
setStateBeforeNewGroup(null);
|
|
1149
|
-
setDialogOpenForGroup(null);
|
|
1150
|
-
};
|
|
1151
|
-
const activeItemForOverlay = disabled || !activeId || activeIsGroup ? null : dndItems.flatMap((g_22) => g_22.entries).find((e_10) => e_10.url === activeId) || null;
|
|
1152
|
-
const activeGroupData = disabled || !activeId || !activeIsGroup ? null : dndItems.find((g_23) => g_23.name === activeId) || null;
|
|
1153
|
-
return {
|
|
1154
|
-
sensors,
|
|
1155
|
-
collisionDetection,
|
|
1156
|
-
onDragStart: handleDragStart,
|
|
1157
|
-
onDragOver: handleDragOver,
|
|
1158
|
-
onDragEnd: handleDragEnd,
|
|
1159
|
-
onDragCancel: handleDragCancel,
|
|
1160
|
-
dropAnimation: dropAnimationConfig,
|
|
1161
|
-
activeItemForOverlay,
|
|
1162
|
-
activeGroupData,
|
|
1163
|
-
draggingGroupId: currentDraggingGroupId,
|
|
1164
|
-
containers: dndContainers,
|
|
1165
|
-
dndKitActiveNode,
|
|
1166
|
-
isDraggingCardOnly,
|
|
1167
|
-
dialogOpenForGroup,
|
|
1168
|
-
setDialogOpenForGroup,
|
|
1169
|
-
handleRenameGroup,
|
|
1170
|
-
handleDialogClose,
|
|
1171
|
-
isHoveringNewGroupDropZone,
|
|
1172
|
-
setIsHoveringNewGroupDropZone
|
|
1173
|
-
};
|
|
1174
|
-
}
|
|
1175
|
-
function NewGroupDropZone(t0) {
|
|
1176
|
-
const $ = c(15);
|
|
1177
|
-
const {
|
|
1178
|
-
disabled,
|
|
1179
|
-
setIsHovering
|
|
1180
|
-
} = t0;
|
|
1181
|
-
let t1;
|
|
1182
|
-
if ($[0] !== disabled) {
|
|
1183
|
-
t1 = {
|
|
1184
|
-
id: "new-group-drop-zone",
|
|
1185
|
-
disabled
|
|
1186
|
-
};
|
|
1187
|
-
$[0] = disabled;
|
|
1188
|
-
$[1] = t1;
|
|
1189
|
-
} else {
|
|
1190
|
-
t1 = $[1];
|
|
1191
|
-
}
|
|
1192
|
-
const {
|
|
1193
|
-
setNodeRef,
|
|
1194
|
-
isOver
|
|
1195
|
-
} = useDroppable(t1);
|
|
1196
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
1197
|
-
let t2;
|
|
1198
|
-
if ($[2] !== disabled) {
|
|
1199
|
-
t2 = {
|
|
1200
|
-
onDragStart(t32) {
|
|
1201
|
-
const {
|
|
1202
|
-
active
|
|
1203
|
-
} = t32;
|
|
1204
|
-
if (disabled) {
|
|
1205
|
-
return;
|
|
1206
|
-
}
|
|
1207
|
-
const tp = active.data.current?.type;
|
|
1208
|
-
setIsVisible(tp === "item");
|
|
1209
|
-
},
|
|
1210
|
-
onDragEnd() {
|
|
1211
|
-
setIsVisible(false);
|
|
1212
|
-
},
|
|
1213
|
-
onDragCancel() {
|
|
1214
|
-
setIsVisible(false);
|
|
1215
|
-
}
|
|
1216
|
-
};
|
|
1217
|
-
$[2] = disabled;
|
|
1218
|
-
$[3] = t2;
|
|
1219
|
-
} else {
|
|
1220
|
-
t2 = $[3];
|
|
1221
|
-
}
|
|
1222
|
-
useDndMonitor(t2);
|
|
1223
|
-
let t3;
|
|
1224
|
-
let t4;
|
|
1225
|
-
if ($[4] !== isOver || $[5] !== isVisible || $[6] !== setIsHovering) {
|
|
1226
|
-
t3 = () => {
|
|
1227
|
-
setIsHovering(isOver && isVisible);
|
|
1228
|
-
};
|
|
1229
|
-
t4 = [isOver, isVisible, setIsHovering];
|
|
1230
|
-
$[4] = isOver;
|
|
1231
|
-
$[5] = isVisible;
|
|
1232
|
-
$[6] = setIsHovering;
|
|
1233
|
-
$[7] = t3;
|
|
1234
|
-
$[8] = t4;
|
|
1235
|
-
} else {
|
|
1236
|
-
t3 = $[7];
|
|
1237
|
-
t4 = $[8];
|
|
1238
|
-
}
|
|
1239
|
-
useEffect(t3, t4);
|
|
1240
|
-
if (!isVisible || disabled) {
|
|
1241
|
-
return null;
|
|
1242
|
-
}
|
|
1243
|
-
const t5 = isOver ? "bg-surface-accent-100 dark:bg-surface-accent-800 border-surface-300 dark:border-surface-600" : "bg-surface-50 dark:bg-surface-900 border-surface-200 dark:border-surface-700";
|
|
1244
|
-
let t6;
|
|
1245
|
-
if ($[9] !== t5) {
|
|
1246
|
-
t6 = cls("fixed right-8 top-1/2 -translate-y-1/2 w-[200px] h-[120px] border border-dashed rounded-lg flex items-center justify-center transition-all", t5);
|
|
1247
|
-
$[9] = t5;
|
|
1248
|
-
$[10] = t6;
|
|
1249
|
-
} else {
|
|
1250
|
-
t6 = $[10];
|
|
1251
|
-
}
|
|
1252
|
-
let t7;
|
|
1253
|
-
if ($[11] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1254
|
-
t7 = /* @__PURE__ */ jsx("div", { className: "text-center p-4", children: /* @__PURE__ */ jsx("span", { className: "block font-medium text-sm", children: "Drop here to create a new group" }) });
|
|
1255
|
-
$[11] = t7;
|
|
1256
|
-
} else {
|
|
1257
|
-
t7 = $[11];
|
|
1258
|
-
}
|
|
1259
|
-
let t8;
|
|
1260
|
-
if ($[12] !== setNodeRef || $[13] !== t6) {
|
|
1261
|
-
t8 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, className: t6, children: t7 });
|
|
1262
|
-
$[12] = setNodeRef;
|
|
1263
|
-
$[13] = t6;
|
|
1264
|
-
$[14] = t8;
|
|
1265
|
-
} else {
|
|
1266
|
-
t8 = $[14];
|
|
1267
|
-
}
|
|
1268
|
-
return t8;
|
|
1269
|
-
}
|
|
1270
|
-
function RenameGroupDialog(t0) {
|
|
1271
|
-
const $ = c(56);
|
|
1272
|
-
const {
|
|
1273
|
-
open,
|
|
1274
|
-
initialName,
|
|
1275
|
-
existingGroupNames,
|
|
1276
|
-
onClose,
|
|
1277
|
-
onRename
|
|
1278
|
-
} = t0;
|
|
1279
|
-
const {
|
|
1280
|
-
t
|
|
1281
|
-
} = useTranslation();
|
|
1282
|
-
const [name, setName] = useState(initialName);
|
|
1283
|
-
const [error, setError] = useState(null);
|
|
1284
|
-
const inputRef = useRef(null);
|
|
1285
|
-
let t1;
|
|
1286
|
-
let t2;
|
|
1287
|
-
if ($[0] !== initialName || $[1] !== open) {
|
|
1288
|
-
t1 = () => {
|
|
1289
|
-
if (open) {
|
|
1290
|
-
setName(initialName);
|
|
1291
|
-
setError(null);
|
|
1292
|
-
setTimeout(() => {
|
|
1293
|
-
if (inputRef.current) {
|
|
1294
|
-
inputRef.current.focus();
|
|
1295
|
-
inputRef.current.select();
|
|
1296
|
-
}
|
|
1297
|
-
}, 100);
|
|
1298
|
-
}
|
|
1299
|
-
};
|
|
1300
|
-
t2 = [initialName, open];
|
|
1301
|
-
$[0] = initialName;
|
|
1302
|
-
$[1] = open;
|
|
1303
|
-
$[2] = t1;
|
|
1304
|
-
$[3] = t2;
|
|
1305
|
-
} else {
|
|
1306
|
-
t1 = $[2];
|
|
1307
|
-
t2 = $[3];
|
|
1308
|
-
}
|
|
1309
|
-
useEffect(t1, t2);
|
|
1310
|
-
let t3;
|
|
1311
|
-
if ($[4] !== existingGroupNames || $[5] !== t) {
|
|
1312
|
-
t3 = (event) => {
|
|
1313
|
-
const newName = event.target.value;
|
|
1314
|
-
setName(newName);
|
|
1315
|
-
if (!newName.trim()) {
|
|
1316
|
-
setError(t("group_name_empty_error"));
|
|
1317
|
-
} else {
|
|
1318
|
-
if (existingGroupNames.includes(newName.trim())) {
|
|
1319
|
-
setError(t("group_name_exists_error"));
|
|
1320
|
-
} else {
|
|
1321
|
-
setError(null);
|
|
1322
|
-
}
|
|
1323
|
-
}
|
|
1324
|
-
};
|
|
1325
|
-
$[4] = existingGroupNames;
|
|
1326
|
-
$[5] = t;
|
|
1327
|
-
$[6] = t3;
|
|
1328
|
-
} else {
|
|
1329
|
-
t3 = $[6];
|
|
1330
|
-
}
|
|
1331
|
-
const handleNameChange = t3;
|
|
1332
|
-
let t4;
|
|
1333
|
-
if ($[7] !== error || $[8] !== existingGroupNames || $[9] !== name || $[10] !== onClose || $[11] !== onRename || $[12] !== t) {
|
|
1334
|
-
t4 = () => {
|
|
1335
|
-
const trimmedName = name.trim();
|
|
1336
|
-
if (!trimmedName) {
|
|
1337
|
-
setError(t("group_name_empty_error"));
|
|
1338
|
-
return;
|
|
1339
|
-
}
|
|
1340
|
-
if (existingGroupNames.includes(trimmedName)) {
|
|
1341
|
-
setError(t("group_name_exists_error"));
|
|
1342
|
-
return;
|
|
1343
|
-
}
|
|
1344
|
-
if (!error) {
|
|
1345
|
-
onRename(trimmedName);
|
|
1346
|
-
onClose();
|
|
1347
|
-
}
|
|
1348
|
-
};
|
|
1349
|
-
$[7] = error;
|
|
1350
|
-
$[8] = existingGroupNames;
|
|
1351
|
-
$[9] = name;
|
|
1352
|
-
$[10] = onClose;
|
|
1353
|
-
$[11] = onRename;
|
|
1354
|
-
$[12] = t;
|
|
1355
|
-
$[13] = t4;
|
|
1356
|
-
} else {
|
|
1357
|
-
t4 = $[13];
|
|
1358
|
-
}
|
|
1359
|
-
const handleSave = t4;
|
|
1360
|
-
let t5;
|
|
1361
|
-
if ($[14] !== existingGroupNames || $[15] !== handleSave || $[16] !== name || $[17] !== t) {
|
|
1362
|
-
t5 = (event_0) => {
|
|
1363
|
-
if (event_0.key === "Enter") {
|
|
1364
|
-
event_0.preventDefault();
|
|
1365
|
-
const trimmedName_0 = name.trim();
|
|
1366
|
-
let currentError = null;
|
|
1367
|
-
if (!trimmedName_0) {
|
|
1368
|
-
currentError = t("group_name_empty_error");
|
|
1369
|
-
} else {
|
|
1370
|
-
if (existingGroupNames.includes(trimmedName_0)) {
|
|
1371
|
-
currentError = t("group_name_exists_error");
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
if (!currentError && trimmedName_0) {
|
|
1375
|
-
handleSave();
|
|
1376
|
-
} else {
|
|
1377
|
-
if (currentError) {
|
|
1378
|
-
setError(currentError);
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
};
|
|
1383
|
-
$[14] = existingGroupNames;
|
|
1384
|
-
$[15] = handleSave;
|
|
1385
|
-
$[16] = name;
|
|
1386
|
-
$[17] = t;
|
|
1387
|
-
$[18] = t5;
|
|
1388
|
-
} else {
|
|
1389
|
-
t5 = $[18];
|
|
1390
|
-
}
|
|
1391
|
-
const handleKeyDown = t5;
|
|
1392
|
-
if (!open) {
|
|
1393
|
-
return null;
|
|
1394
|
-
}
|
|
1395
|
-
let t6;
|
|
1396
|
-
if ($[19] !== t) {
|
|
1397
|
-
t6 = t("rename_group");
|
|
1398
|
-
$[19] = t;
|
|
1399
|
-
$[20] = t6;
|
|
1400
|
-
} else {
|
|
1401
|
-
t6 = $[20];
|
|
1402
|
-
}
|
|
1403
|
-
let t7;
|
|
1404
|
-
if ($[21] !== t6) {
|
|
1405
|
-
t7 = /* @__PURE__ */ jsx(DialogTitle, { children: t6 });
|
|
1406
|
-
$[21] = t6;
|
|
1407
|
-
$[22] = t7;
|
|
1408
|
-
} else {
|
|
1409
|
-
t7 = $[22];
|
|
1410
|
-
}
|
|
1411
|
-
let t8;
|
|
1412
|
-
if ($[23] !== t) {
|
|
1413
|
-
t8 = t("group_name_label");
|
|
1414
|
-
$[23] = t;
|
|
1415
|
-
$[24] = t8;
|
|
1416
|
-
} else {
|
|
1417
|
-
t8 = $[24];
|
|
1418
|
-
}
|
|
1419
|
-
const t9 = !!error;
|
|
1420
|
-
const t10 = error ? "group-name-error" : void 0;
|
|
1421
|
-
let t11;
|
|
1422
|
-
if ($[25] !== handleKeyDown || $[26] !== handleNameChange || $[27] !== name || $[28] !== t10 || $[29] !== t8 || $[30] !== t9) {
|
|
1423
|
-
t11 = /* @__PURE__ */ jsx(TextField, { inputRef, label: t8, value: name, onChange: handleNameChange, onKeyDown: handleKeyDown, error: t9, "aria-describedby": t10 });
|
|
1424
|
-
$[25] = handleKeyDown;
|
|
1425
|
-
$[26] = handleNameChange;
|
|
1426
|
-
$[27] = name;
|
|
1427
|
-
$[28] = t10;
|
|
1428
|
-
$[29] = t8;
|
|
1429
|
-
$[30] = t9;
|
|
1430
|
-
$[31] = t11;
|
|
1431
|
-
} else {
|
|
1432
|
-
t11 = $[31];
|
|
1433
|
-
}
|
|
1434
|
-
let t12;
|
|
1435
|
-
if ($[32] !== error) {
|
|
1436
|
-
t12 = error && /* @__PURE__ */ jsx("p", { id: "group-name-error", style: {
|
|
1437
|
-
display: "none"
|
|
1438
|
-
}, children: error });
|
|
1439
|
-
$[32] = error;
|
|
1440
|
-
$[33] = t12;
|
|
1441
|
-
} else {
|
|
1442
|
-
t12 = $[33];
|
|
1443
|
-
}
|
|
1444
|
-
let t13;
|
|
1445
|
-
if ($[34] !== t11 || $[35] !== t12) {
|
|
1446
|
-
t13 = /* @__PURE__ */ jsxs(DialogContent, { children: [
|
|
1447
|
-
t11,
|
|
1448
|
-
t12
|
|
1449
|
-
] });
|
|
1450
|
-
$[34] = t11;
|
|
1451
|
-
$[35] = t12;
|
|
1452
|
-
$[36] = t13;
|
|
1453
|
-
} else {
|
|
1454
|
-
t13 = $[36];
|
|
1455
|
-
}
|
|
1456
|
-
let t14;
|
|
1457
|
-
if ($[37] !== t) {
|
|
1458
|
-
t14 = t("cancel");
|
|
1459
|
-
$[37] = t;
|
|
1460
|
-
$[38] = t14;
|
|
1461
|
-
} else {
|
|
1462
|
-
t14 = $[38];
|
|
1463
|
-
}
|
|
1464
|
-
let t15;
|
|
1465
|
-
if ($[39] !== onClose || $[40] !== t14) {
|
|
1466
|
-
t15 = /* @__PURE__ */ jsx(Button, { onClick: onClose, variant: "text", children: t14 });
|
|
1467
|
-
$[39] = onClose;
|
|
1468
|
-
$[40] = t14;
|
|
1469
|
-
$[41] = t15;
|
|
1470
|
-
} else {
|
|
1471
|
-
t15 = $[41];
|
|
1472
|
-
}
|
|
1473
|
-
const t16 = !!error || !name.trim();
|
|
1474
|
-
let t17;
|
|
1475
|
-
if ($[42] !== t) {
|
|
1476
|
-
t17 = t("save");
|
|
1477
|
-
$[42] = t;
|
|
1478
|
-
$[43] = t17;
|
|
1479
|
-
} else {
|
|
1480
|
-
t17 = $[43];
|
|
1481
|
-
}
|
|
1482
|
-
let t18;
|
|
1483
|
-
if ($[44] !== handleSave || $[45] !== t16 || $[46] !== t17) {
|
|
1484
|
-
t18 = /* @__PURE__ */ jsx(Button, { onClick: handleSave, disabled: t16, children: t17 });
|
|
1485
|
-
$[44] = handleSave;
|
|
1486
|
-
$[45] = t16;
|
|
1487
|
-
$[46] = t17;
|
|
1488
|
-
$[47] = t18;
|
|
1489
|
-
} else {
|
|
1490
|
-
t18 = $[47];
|
|
1491
|
-
}
|
|
1492
|
-
let t19;
|
|
1493
|
-
if ($[48] !== t15 || $[49] !== t18) {
|
|
1494
|
-
t19 = /* @__PURE__ */ jsxs(DialogActions, { children: [
|
|
1495
|
-
t15,
|
|
1496
|
-
t18
|
|
1497
|
-
] });
|
|
1498
|
-
$[48] = t15;
|
|
1499
|
-
$[49] = t18;
|
|
1500
|
-
$[50] = t19;
|
|
1501
|
-
} else {
|
|
1502
|
-
t19 = $[50];
|
|
1503
|
-
}
|
|
1504
|
-
let t20;
|
|
1505
|
-
if ($[51] !== open || $[52] !== t13 || $[53] !== t19 || $[54] !== t7) {
|
|
1506
|
-
t20 = /* @__PURE__ */ jsxs(Dialog, { open, children: [
|
|
1507
|
-
t7,
|
|
1508
|
-
t13,
|
|
1509
|
-
t19
|
|
1510
|
-
] });
|
|
1511
|
-
$[51] = open;
|
|
1512
|
-
$[52] = t13;
|
|
1513
|
-
$[53] = t19;
|
|
1514
|
-
$[54] = t7;
|
|
1515
|
-
$[55] = t20;
|
|
1516
|
-
} else {
|
|
1517
|
-
t20 = $[55];
|
|
1518
|
-
}
|
|
1519
|
-
return t20;
|
|
1520
|
-
}
|
|
1521
|
-
const DEFAULT_GROUP_NAME = "Views";
|
|
1522
|
-
const ADMIN_GROUP_NAME = "Admin";
|
|
1523
|
-
function ContentHomePage({
|
|
1524
|
-
additionalActions,
|
|
1525
|
-
additionalChildrenStart,
|
|
1526
|
-
additionalChildrenEnd,
|
|
1527
|
-
sections,
|
|
1528
|
-
hiddenGroups
|
|
1529
|
-
}) {
|
|
1530
|
-
const context = useCMSContext();
|
|
1531
|
-
const {
|
|
1532
|
-
navigationStateController
|
|
1533
|
-
} = context;
|
|
1534
|
-
const customizationController = useCustomizationController();
|
|
1535
|
-
const adminModeController = useAdminModeController();
|
|
1536
|
-
const registry = useRebaseRegistry();
|
|
1537
|
-
const {
|
|
1538
|
-
resolvedSlots
|
|
1539
|
-
} = customizationController;
|
|
1540
|
-
const breadcrumbs = useBreadcrumbsController();
|
|
1541
|
-
const {
|
|
1542
|
-
t
|
|
1543
|
-
} = useTranslation();
|
|
1544
|
-
useEffect(() => {
|
|
1545
|
-
breadcrumbs.set({
|
|
1546
|
-
breadcrumbs: []
|
|
1547
|
-
});
|
|
1548
|
-
}, [breadcrumbs.set]);
|
|
1549
|
-
const {
|
|
1550
|
-
allowDragAndDrop = false,
|
|
1551
|
-
navigationEntries: unFilteredNavigationEntries = [],
|
|
1552
|
-
groups: unFilteredGroupOrder = [],
|
|
1553
|
-
onNavigationEntriesUpdate = () => {
|
|
1554
|
-
}
|
|
1555
|
-
} = navigationStateController.topLevelNavigation || {};
|
|
1556
|
-
const rawNavigationEntries = useMemo(() => {
|
|
1557
|
-
if (adminModeController.mode === "studio") {
|
|
1558
|
-
return unFilteredNavigationEntries.filter((e) => e.type === "view" || e.type === "admin");
|
|
1559
|
-
}
|
|
1560
|
-
return unFilteredNavigationEntries.filter((e_0) => e_0.type !== "view");
|
|
1561
|
-
}, [unFilteredNavigationEntries, adminModeController.mode]);
|
|
1562
|
-
const groupOrderFromNavController = useMemo(() => {
|
|
1563
|
-
const entryGroups = new Set(rawNavigationEntries.map((e_1) => e_1.group).filter(Boolean));
|
|
1564
|
-
return unFilteredGroupOrder.filter((g) => entryGroups.has(g));
|
|
1565
|
-
}, [unFilteredGroupOrder, rawNavigationEntries]);
|
|
1566
|
-
const fuse = useRef(null);
|
|
1567
|
-
const [filteredUrls, setFilteredUrls] = useState(null);
|
|
1568
|
-
const performingSearch = Boolean(filteredUrls);
|
|
1569
|
-
const filteredNavigationEntries = useMemo(() => {
|
|
1570
|
-
return filteredUrls ? rawNavigationEntries.filter((e_2) => filteredUrls.includes(e_2.url)) : rawNavigationEntries;
|
|
1571
|
-
}, [filteredUrls, rawNavigationEntries]);
|
|
1572
|
-
useEffect(() => {
|
|
1573
|
-
fuse.current = new Fuse(rawNavigationEntries, {
|
|
1574
|
-
keys: ["name", "description", "group", "path"]
|
|
1575
|
-
});
|
|
1576
|
-
}, [rawNavigationEntries]);
|
|
1577
|
-
const updateSearch = useCallback((v) => {
|
|
1578
|
-
if (!v?.trim()) {
|
|
1579
|
-
setFilteredUrls(null);
|
|
1580
|
-
return;
|
|
1581
|
-
}
|
|
1582
|
-
const results = fuse.current?.search(v.trim());
|
|
1583
|
-
setFilteredUrls(results ? results.map((x) => x.item.url) : []);
|
|
1584
|
-
}, []);
|
|
1585
|
-
const [items, setItems] = useState([]);
|
|
1586
|
-
const [adminGroupData, setAdminGroupData] = useState(null);
|
|
1587
|
-
const isDndDirtyRef = useRef(false);
|
|
1588
|
-
const dndDirtyTimeoutRef = useRef(null);
|
|
1589
|
-
const processedGroups = useMemo(() => {
|
|
1590
|
-
const src = filteredNavigationEntries;
|
|
1591
|
-
const entriesByGroup = {};
|
|
1592
|
-
src.forEach((e_3) => {
|
|
1593
|
-
const g_0 = e_3.type === "admin" ? ADMIN_GROUP_NAME : e_3.group ?? DEFAULT_GROUP_NAME;
|
|
1594
|
-
(entriesByGroup[g_0] ??= []).push(e_3);
|
|
1595
|
-
});
|
|
1596
|
-
const hasPluginAdditionalCards = customizationController.resolvedSlots.some((s) => s.slot === "home.cards");
|
|
1597
|
-
let allProcessed;
|
|
1598
|
-
if (performingSearch) {
|
|
1599
|
-
const ordered = [...new Set(src.map((e_4) => e_4.group ?? DEFAULT_GROUP_NAME))];
|
|
1600
|
-
allProcessed = ordered.map((name) => ({
|
|
1601
|
-
name,
|
|
1602
|
-
entries: entriesByGroup[name] || []
|
|
1603
|
-
})).filter((g_1) => g_1.entries.length);
|
|
1604
|
-
} else {
|
|
1605
|
-
allProcessed = groupOrderFromNavController.map((g_2) => ({
|
|
1606
|
-
name: g_2,
|
|
1607
|
-
entries: entriesByGroup[g_2] || []
|
|
1608
|
-
}));
|
|
1609
|
-
Object.keys(entriesByGroup).forEach((g_3) => {
|
|
1610
|
-
if (!groupOrderFromNavController.includes(g_3)) allProcessed.push({
|
|
1611
|
-
name: g_3,
|
|
1612
|
-
entries: entriesByGroup[g_3]
|
|
1613
|
-
});
|
|
1614
|
-
});
|
|
1615
|
-
if (hasPluginAdditionalCards && !allProcessed.some((g_4) => g_4.name === DEFAULT_GROUP_NAME)) {
|
|
1616
|
-
allProcessed.push({
|
|
1617
|
-
name: DEFAULT_GROUP_NAME,
|
|
1618
|
-
entries: []
|
|
1619
|
-
});
|
|
1620
|
-
}
|
|
1621
|
-
allProcessed = allProcessed.filter((g_5) => g_5.entries.length || g_5.name === DEFAULT_GROUP_NAME && hasPluginAdditionalCards);
|
|
1622
|
-
}
|
|
1623
|
-
const admin = allProcessed.find((g_6) => g_6.name === ADMIN_GROUP_NAME);
|
|
1624
|
-
return {
|
|
1625
|
-
adminGroupData: admin || null,
|
|
1626
|
-
items: allProcessed.filter((g_7) => g_7.name !== ADMIN_GROUP_NAME && !hiddenGroups?.includes(g_7.name))
|
|
1627
|
-
};
|
|
1628
|
-
}, [filteredNavigationEntries, performingSearch, groupOrderFromNavController, customizationController.resolvedSlots, hiddenGroups]);
|
|
1629
|
-
useEffect(() => {
|
|
1630
|
-
if (isDndDirtyRef.current) {
|
|
1631
|
-
return;
|
|
1632
|
-
}
|
|
1633
|
-
setAdminGroupData(processedGroups.adminGroupData);
|
|
1634
|
-
setItems(processedGroups.items);
|
|
1635
|
-
}, [processedGroups]);
|
|
1636
|
-
const updateItems = (updater) => {
|
|
1637
|
-
setItems(updater);
|
|
1638
|
-
};
|
|
1639
|
-
const persistNavigationGroups = (latest) => {
|
|
1640
|
-
isDndDirtyRef.current = true;
|
|
1641
|
-
if (dndDirtyTimeoutRef.current) {
|
|
1642
|
-
clearTimeout(dndDirtyTimeoutRef.current);
|
|
1643
|
-
}
|
|
1644
|
-
dndDirtyTimeoutRef.current = setTimeout(() => {
|
|
1645
|
-
isDndDirtyRef.current = false;
|
|
1646
|
-
}, 1e3);
|
|
1647
|
-
const draggable = latest.map((g_8) => ({
|
|
1648
|
-
name: g_8.name,
|
|
1649
|
-
entries: g_8.entries.map((e_5) => e_5.slug)
|
|
1650
|
-
}));
|
|
1651
|
-
const all = adminGroupData ? [...draggable, {
|
|
1652
|
-
name: adminGroupData.name,
|
|
1653
|
-
entries: adminGroupData.entries.map((e_6) => e_6.slug)
|
|
1654
|
-
}] : draggable;
|
|
1655
|
-
onNavigationEntriesUpdate(all);
|
|
1656
|
-
};
|
|
1657
|
-
const groupNames = useMemo(() => [...items.map((item) => item.name), ...adminGroupData ? [adminGroupData.name] : []], [items, adminGroupData]);
|
|
1658
|
-
const collapsedDefaults = useMemo(() => buildCollapsedDefaults(registry.cmsConfig?.navigationGroupMappings, "home"), [registry.cmsConfig?.navigationGroupMappings]);
|
|
1659
|
-
const {
|
|
1660
|
-
isGroupCollapsed,
|
|
1661
|
-
toggleGroupCollapsed
|
|
1662
|
-
} = useCollapsedGroups(groupNames, "home", collapsedDefaults);
|
|
1663
|
-
const {
|
|
1664
|
-
sensors,
|
|
1665
|
-
collisionDetection,
|
|
1666
|
-
onDragStart,
|
|
1667
|
-
onDragOver,
|
|
1668
|
-
onDragEnd,
|
|
1669
|
-
dropAnimation,
|
|
1670
|
-
activeItemForOverlay,
|
|
1671
|
-
activeGroupData,
|
|
1672
|
-
draggingGroupId,
|
|
1673
|
-
containers,
|
|
1674
|
-
dndKitActiveNode,
|
|
1675
|
-
onDragCancel,
|
|
1676
|
-
isDraggingCardOnly,
|
|
1677
|
-
dialogOpenForGroup,
|
|
1678
|
-
setDialogOpenForGroup,
|
|
1679
|
-
handleRenameGroup,
|
|
1680
|
-
handleDialogClose,
|
|
1681
|
-
isHoveringNewGroupDropZone,
|
|
1682
|
-
setIsHoveringNewGroupDropZone
|
|
1683
|
-
} = useHomePageDnd({
|
|
1684
|
-
items,
|
|
1685
|
-
setItems: updateItems,
|
|
1686
|
-
disabled: !allowDragAndDrop || performingSearch,
|
|
1687
|
-
onPersist: persistNavigationGroups,
|
|
1688
|
-
onGroupMoved: (g_9) => context.analyticsController?.onAnalyticsEvent?.("home_move_group", {
|
|
1689
|
-
name: g_9
|
|
1690
|
-
}),
|
|
1691
|
-
onCardMovedBetweenGroups: (card) => context.analyticsController?.onAnalyticsEvent?.("home_move_card", {
|
|
1692
|
-
id: card.id
|
|
1693
|
-
}),
|
|
1694
|
-
onNewGroupDrop: () => context.analyticsController?.onAnalyticsEvent?.("home_drop_new_group")
|
|
1695
|
-
});
|
|
1696
|
-
const {
|
|
1697
|
-
containerRef,
|
|
1698
|
-
direction
|
|
1699
|
-
} = useRestoreScroll();
|
|
1700
|
-
const dndDisabled = !allowDragAndDrop || performingSearch;
|
|
1701
|
-
const dndModifiers = dndKitActiveNode?.data.current?.type === "group" ? [restrictToVerticalAxis, restrictToWindowEdges] : [restrictToWindowEdges];
|
|
1702
|
-
const sectionProps = {
|
|
1703
|
-
context
|
|
1704
|
-
};
|
|
1705
|
-
const additionalPluginChildrenStart = useSlot("home.children.start", sectionProps);
|
|
1706
|
-
const additionalPluginChildrenEnd = useSlot("home.children.end", sectionProps);
|
|
1707
|
-
const additionalPluginActions = useSlot("home.actions", sectionProps);
|
|
1708
|
-
const homeCardContributions = useMemo(() => {
|
|
1709
|
-
return resolvedSlots.filter((s_0) => s_0.slot === "home.cards").sort((a, b) => (a.order ?? 50) - (b.order ?? 50));
|
|
1710
|
-
}, [resolvedSlots]);
|
|
1711
|
-
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "py-2 overflow-auto h-full w-full bg-surface-50 dark:bg-surface-800", children: [
|
|
1712
|
-
/* @__PURE__ */ jsxs(Container, { maxWidth: "6xl", children: [
|
|
1713
|
-
/* @__PURE__ */ jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsx(BootstrapAdminBanner, {}) }),
|
|
1714
|
-
/* @__PURE__ */ jsxs("div", { className: "w-full sticky py-4 transition-all duration-400 ease-in-out top-0 z-10 flex flex-row gap-4", style: {
|
|
1715
|
-
top: direction === "down" ? -84 : 0
|
|
1716
|
-
}, children: [
|
|
1717
|
-
/* @__PURE__ */ jsx(SearchBar, { onTextSearch: updateSearch, placeholder: t("search_collections"), autoFocus: true, size: "small", innerClassName: "w-full", className: "w-full grow" }),
|
|
1718
|
-
additionalActions,
|
|
1719
|
-
additionalPluginActions
|
|
1720
|
-
] }),
|
|
1721
|
-
/* @__PURE__ */ jsx(FavouritesView, { hidden: performingSearch }),
|
|
1722
|
-
additionalChildrenStart,
|
|
1723
|
-
additionalPluginChildrenStart,
|
|
1724
|
-
/* @__PURE__ */ jsxs(DndContext, { sensors, collisionDetection, measuring: {
|
|
1725
|
-
droppable: {
|
|
1726
|
-
strategy: MeasuringStrategy.Always,
|
|
1727
|
-
frequency: 500
|
|
1728
|
-
}
|
|
1729
|
-
}, onDragStart, onDragOver, onDragEnd, onDragCancel, modifiers: dndModifiers, children: [
|
|
1730
|
-
/* @__PURE__ */ jsx(SortableContext, { items: containers, strategy: verticalListSortingStrategy, children: items.map((groupData, groupIndex) => {
|
|
1731
|
-
const groupKey = groupData.name;
|
|
1732
|
-
const entriesInGroup = groupData.entries;
|
|
1733
|
-
const homeCardsProps = {
|
|
1734
|
-
group: groupKey === DEFAULT_GROUP_NAME ? void 0 : groupKey,
|
|
1735
|
-
context
|
|
1736
|
-
};
|
|
1737
|
-
const additionalCards = homeCardContributions.map((s_1, i) => /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(s_1.Component, { ...homeCardsProps, ...s_1.props ?? {} }) }, `home_cards_${groupKey}_${i}`));
|
|
1738
|
-
if (entriesInGroup.length === 0 && (additionalCards.length === 0 || performingSearch)) return null;
|
|
1739
|
-
return /* @__PURE__ */ jsx(SortableNavigationGroup, { groupName: groupKey, disabled: dndDisabled, children: /* @__PURE__ */ jsx(NavigationGroup, { group: groupKey === DEFAULT_GROUP_NAME ? void 0 : groupKey, minimised: draggingGroupId === groupKey && !isDraggingCardOnly, isPotentialCardDropTarget: isDraggingCardOnly, dndDisabled, onEditGroup: () => {
|
|
1740
|
-
if (dndDisabled) return;
|
|
1741
|
-
setDialogOpenForGroup(groupKey);
|
|
1742
|
-
}, collapsed: isGroupCollapsed(groupKey), onToggleCollapsed: () => toggleGroupCollapsed(groupKey), children: /* @__PURE__ */ jsx(NavigationGroupDroppable, { id: groupKey, itemIds: entriesInGroup.map((e_7) => e_7.url), isPotentialCardDropTarget: isDraggingCardOnly, children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ", children: [
|
|
1743
|
-
entriesInGroup.map((entry) => /* @__PURE__ */ jsx(SortableNavigationCard, { entry, onClick: () => {
|
|
1744
|
-
let event = "unmapped_event";
|
|
1745
|
-
if (entry.type === "collection") event = "home_navigate_to_collection";
|
|
1746
|
-
else if (entry.type === "view") event = "home_navigate_to_view";
|
|
1747
|
-
else if (entry.type === "admin") event = "home_navigate_to_admin_view";
|
|
1748
|
-
context.analyticsController?.onAnalyticsEvent?.(event, {
|
|
1749
|
-
path: entry.slug
|
|
1750
|
-
});
|
|
1751
|
-
} }, entry.url)),
|
|
1752
|
-
!performingSearch && groupKey.toLowerCase() !== ADMIN_GROUP_NAME.toLowerCase() && additionalCards
|
|
1753
|
-
] }) }) }) }, `group-${groupIndex}`);
|
|
1754
|
-
}) }, containers.join(",")),
|
|
1755
|
-
/* @__PURE__ */ jsx(NewGroupDropZone, { disabled: dndDisabled, setIsHovering: setIsHoveringNewGroupDropZone }),
|
|
1756
|
-
/* @__PURE__ */ jsx(DragOverlay, { adjustScale: false, dropAnimation, children: activeGroupData && draggingGroupId === activeGroupData.name ? /* @__PURE__ */ jsx("div", { className: "rounded-lg bg-transparent", style: {
|
|
1757
|
-
padding: 0,
|
|
1758
|
-
margin: 0
|
|
1759
|
-
}, children: /* @__PURE__ */ jsx(NavigationGroup, { group: activeGroupData.name === DEFAULT_GROUP_NAME ? void 0 : activeGroupData.name, isPreview: false, minimised: true }) }) : activeItemForOverlay ? /* @__PURE__ */ jsx(NavigationCardBinding, { ...activeItemForOverlay, shrink: isHoveringNewGroupDropZone }) : null })
|
|
1760
|
-
] }),
|
|
1761
|
-
!performingSearch && adminGroupData && /* @__PURE__ */ jsx(NavigationGroup, { group: adminGroupData.name, collapsed: isGroupCollapsed(adminGroupData.name), onToggleCollapsed: () => toggleGroupCollapsed(adminGroupData.name), children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ", children: adminGroupData.entries.map((entry_0) => /* @__PURE__ */ jsx(NavigationCardBinding, { ...entry_0, onClick: () => {
|
|
1762
|
-
let event_0 = "unmapped_event";
|
|
1763
|
-
if (entry_0.type === "collection") event_0 = "home_navigate_to_collection";
|
|
1764
|
-
else if (entry_0.type === "view") event_0 = "home_navigate_to_view";
|
|
1765
|
-
else if (entry_0.type === "admin") event_0 = "home_navigate_to_admin_view";
|
|
1766
|
-
context.analyticsController?.onAnalyticsEvent?.(event_0, {
|
|
1767
|
-
path: entry_0.slug
|
|
1768
|
-
});
|
|
1769
|
-
} }, entry_0.url)) }) }),
|
|
1770
|
-
sections && sections.map((section) => /* @__PURE__ */ jsx(NavigationGroup, { group: section.title, children: section.children }, section.key)),
|
|
1771
|
-
additionalPluginChildrenEnd,
|
|
1772
|
-
additionalChildrenEnd
|
|
1773
|
-
] }),
|
|
1774
|
-
dialogOpenForGroup && /* @__PURE__ */ jsx(RenameGroupDialog, { open: true, initialName: dialogOpenForGroup, existingGroupNames: items.map((g_10) => g_10.name).filter((n) => n !== dialogOpenForGroup), onClose: handleDialogClose, onRename: (newName) => {
|
|
1775
|
-
handleRenameGroup(dialogOpenForGroup, newName);
|
|
1776
|
-
} })
|
|
1777
|
-
] });
|
|
1778
|
-
}
|
|
1779
|
-
export {
|
|
1780
|
-
ADMIN_GROUP_NAME,
|
|
1781
|
-
ContentHomePage,
|
|
1782
|
-
DEFAULT_GROUP_NAME
|
|
1783
|
-
};
|
|
1784
|
-
//# sourceMappingURL=ContentHomePage-C7vFqKSe.js.map
|