@firecms/core 3.0.1 → 3.1.0-canary.24c8270
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/README.md +1 -1
- package/dist/components/AIIcon.d.ts +16 -0
- package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +7 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
- package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +14 -0
- package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +6 -0
- package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +5 -4
- package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +6 -0
- package/dist/components/EntityCollectionTable/internal/popup_field/useDraggable.d.ts +2 -2
- package/dist/components/EntityCollectionView/Board.d.ts +2 -0
- package/dist/components/EntityCollectionView/BoardColumn.d.ts +42 -0
- package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +9 -0
- package/dist/components/EntityCollectionView/BoardSortableList.d.ts +14 -0
- package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +26 -0
- package/dist/components/EntityCollectionView/EntityCard.d.ts +19 -0
- package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +20 -0
- package/dist/components/EntityCollectionView/EntityCollectionCardView.d.ts +31 -0
- package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +2 -2
- package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +7 -3
- package/dist/components/EntityCollectionView/FiltersDialog.d.ts +14 -0
- package/dist/components/EntityCollectionView/ViewModeToggle.d.ts +44 -0
- package/dist/components/EntityCollectionView/board_types.d.ts +105 -0
- package/dist/components/EntityCollectionView/useBoardDataController.d.ts +60 -0
- package/dist/components/ErrorBoundary.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +5 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/VirtualTable/VirtualTableCell.d.ts +6 -0
- package/dist/components/VirtualTable/VirtualTableHeader.d.ts +3 -1
- package/dist/components/VirtualTable/VirtualTableHeaderRow.d.ts +1 -1
- package/dist/components/VirtualTable/VirtualTableProps.d.ts +11 -0
- package/dist/components/VirtualTable/fields/VirtualTableDateField.d.ts +1 -0
- package/dist/components/VirtualTable/types.d.ts +2 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/contexts/index.d.ts +10 -0
- package/dist/core/DrawerNavigationGroup.d.ts +45 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/form/components/ErrorFocus.d.ts +1 -1
- package/dist/form/validation.d.ts +3 -2
- package/dist/hooks/useBreadcrumbsController.d.ts +16 -0
- package/dist/hooks/useCollapsedGroups.d.ts +4 -1
- package/dist/index.es.js +5316 -1592
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +5309 -1586
- package/dist/index.umd.js.map +1 -1
- package/dist/internal/useRestoreScroll.d.ts +1 -1
- package/dist/preview/PropertyPreviewProps.d.ts +5 -0
- package/dist/preview/components/DatePreview.d.ts +13 -3
- package/dist/preview/components/ImagePreview.d.ts +5 -1
- package/dist/preview/components/StorageThumbnail.d.ts +2 -1
- package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
- package/dist/types/analytics.d.ts +1 -1
- package/dist/types/collections.d.ts +50 -2
- package/dist/types/datasource.d.ts +0 -1
- package/dist/types/plugins.d.ts +62 -1
- package/dist/types/properties.d.ts +259 -4
- package/dist/util/__tests__/conditions.test.d.ts +1 -0
- package/dist/util/__tests__/objects.test.d.ts +1 -0
- package/dist/util/conditions.d.ts +26 -0
- package/dist/util/entities.d.ts +2 -3
- package/dist/util/index.d.ts +2 -1
- package/dist/util/property_utils.d.ts +2 -1
- package/dist/util/resolutions.d.ts +3 -3
- package/package.json +14 -11
- package/src/app/Scaffold.tsx +14 -15
- package/src/components/AIIcon.tsx +39 -0
- package/src/components/ArrayContainer.tsx +1 -4
- package/src/components/ClearFilterSortButton.tsx +19 -16
- package/src/components/ConfirmationDialog.tsx +0 -2
- package/src/components/DeleteEntityDialog.tsx +2 -4
- package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +74 -41
- package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +130 -79
- package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +121 -104
- package/src/components/EntityCollectionTable/PropertyTableCell.tsx +132 -103
- package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +20 -42
- package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +90 -49
- package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +1 -1
- package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +11 -11
- package/src/components/EntityCollectionView/Board.tsx +324 -0
- package/src/components/EntityCollectionView/BoardColumn.tsx +158 -0
- package/src/components/EntityCollectionView/BoardColumnTitle.tsx +45 -0
- package/src/components/EntityCollectionView/BoardSortableList.tsx +172 -0
- package/src/components/EntityCollectionView/EntityBoardCard.tsx +212 -0
- package/src/components/EntityCollectionView/EntityCard.tsx +235 -0
- package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +733 -0
- package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +244 -0
- package/src/components/EntityCollectionView/EntityCollectionView.tsx +519 -203
- package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +31 -19
- package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +84 -15
- package/src/components/EntityCollectionView/FiltersDialog.tsx +249 -0
- package/src/components/EntityCollectionView/ViewModeToggle.tsx +199 -0
- package/src/components/EntityCollectionView/board_types.ts +113 -0
- package/src/components/EntityCollectionView/useBoardDataController.tsx +490 -0
- package/src/components/ErrorTooltip.tsx +2 -1
- package/src/components/HomePage/DefaultHomePage.tsx +47 -10
- package/src/components/HomePage/HomePageDnD.tsx +56 -41
- package/src/components/HomePage/NavigationCard.tsx +20 -18
- package/src/components/HomePage/NavigationGroup.tsx +17 -16
- package/src/components/HomePage/RenameGroupDialog.tsx +0 -2
- package/src/components/HomePage/SmallNavigationCard.tsx +10 -9
- package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +3 -10
- package/src/components/ReferenceWidget.tsx +2 -4
- package/src/components/SelectableTable/SelectableTable.tsx +75 -67
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +7 -6
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +39 -40
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +38 -38
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +49 -58
- package/src/components/UnsavedChangesDialog.tsx +0 -2
- package/src/components/UserDisplay.tsx +4 -4
- package/src/components/VirtualTable/VirtualTable.tsx +272 -118
- package/src/components/VirtualTable/VirtualTableCell.tsx +18 -2
- package/src/components/VirtualTable/VirtualTableHeader.tsx +59 -50
- package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +158 -42
- package/src/components/VirtualTable/VirtualTableProps.tsx +14 -1
- package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
- package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +3 -0
- package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +19 -6
- package/src/components/VirtualTable/types.tsx +2 -0
- package/src/components/common/useColumnsIds.tsx +95 -3
- package/src/components/common/useDataSourceTableController.tsx +21 -4
- package/src/components/index.tsx +4 -0
- package/src/contexts/BreacrumbsContext.tsx +15 -8
- package/src/contexts/index.ts +10 -0
- package/src/core/DefaultAppBar.tsx +40 -27
- package/src/core/DefaultDrawer.tsx +42 -56
- package/src/core/DrawerNavigationGroup.tsx +118 -0
- package/src/core/DrawerNavigationItem.tsx +4 -3
- package/src/core/EntityEditView.tsx +41 -43
- package/src/core/EntitySidePanel.tsx +28 -26
- package/src/core/SideDialogs.tsx +4 -2
- package/src/core/field_configs.tsx +14 -9
- package/src/core/index.tsx +1 -0
- package/src/form/EntityForm.tsx +69 -60
- package/src/form/PropertyFieldBinding.tsx +61 -46
- package/src/form/components/ErrorFocus.tsx +3 -3
- package/src/form/components/StorageItemPreview.tsx +2 -1
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +0 -1
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -16
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +0 -1
- package/src/form/field_bindings/MapFieldBinding.tsx +69 -67
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +22 -18
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +83 -83
- package/src/form/field_bindings/TextFieldBinding.tsx +71 -35
- package/src/form/validation.ts +245 -160
- package/src/hooks/useBreadcrumbsController.tsx +18 -0
- package/src/hooks/useBuildNavigationController.tsx +71 -28
- package/src/hooks/useCollapsedGroups.ts +12 -4
- package/src/hooks/useValidateAuthenticator.tsx +1 -1
- package/src/internal/useBuildDataSource.ts +68 -34
- package/src/internal/useBuildSideDialogsController.tsx +11 -8
- package/src/internal/useBuildSideEntityController.tsx +24 -24
- package/src/internal/useRestoreScroll.tsx +26 -14
- package/src/preview/PropertyPreview.tsx +41 -32
- package/src/preview/PropertyPreviewProps.tsx +6 -0
- package/src/preview/components/DatePreview.tsx +72 -4
- package/src/preview/components/EmptyValue.tsx +1 -1
- package/src/preview/components/ImagePreview.tsx +37 -21
- package/src/preview/components/StorageThumbnail.tsx +16 -12
- package/src/preview/components/UrlComponentPreview.tsx +28 -25
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +9 -7
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +11 -9
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +26 -24
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +61 -56
- package/src/routes/CustomCMSRoute.tsx +1 -0
- package/src/routes/FireCMSRoute.tsx +26 -13
- package/src/types/analytics.ts +10 -0
- package/src/types/collections.ts +57 -3
- package/src/types/datasource.ts +54 -56
- package/src/types/plugins.tsx +69 -1
- package/src/types/properties.ts +347 -27
- package/src/util/__tests__/conditions.test.ts +506 -0
- package/src/util/__tests__/objects.test.ts +196 -0
- package/src/util/callbacks.ts +6 -3
- package/src/util/collections.ts +51 -6
- package/src/util/conditions.ts +339 -0
- package/src/util/entities.ts +29 -30
- package/src/util/entity_cache.ts +2 -1
- package/src/util/index.ts +2 -1
- package/src/util/join_collections.ts +10 -8
- package/src/util/objects.ts +31 -13
- package/src/util/{references.ts → previews.ts} +16 -2
- package/src/util/property_utils.tsx +37 -11
- package/src/util/resolutions.ts +62 -58
- /package/dist/util/{references.d.ts → previews.d.ts} +0 -0
|
@@ -29,7 +29,7 @@ import { CSS } from "@dnd-kit/utilities";
|
|
|
29
29
|
|
|
30
30
|
import { NavigationCardBinding } from "./NavigationCardBinding";
|
|
31
31
|
import { NavigationEntry } from "../../types";
|
|
32
|
-
import { cls } from "@firecms/ui";
|
|
32
|
+
import { cls, defaultBorderMixin } from "@firecms/ui";
|
|
33
33
|
|
|
34
34
|
const animateLayoutChanges: AnimateLayoutChanges = (args) =>
|
|
35
35
|
defaultAnimateLayoutChanges({
|
|
@@ -65,9 +65,9 @@ const cloneItemsForDnd = (items: { name: string; entries: NavigationEntry[] }[])
|
|
|
65
65
|
|
|
66
66
|
/* ─────────────────────────────────────────────────────────── */
|
|
67
67
|
export function SortableNavigationCard({
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
entry,
|
|
69
|
+
onClick
|
|
70
|
+
}: {
|
|
71
71
|
entry: NavigationEntry;
|
|
72
72
|
onClick?: () => void;
|
|
73
73
|
}) {
|
|
@@ -92,17 +92,17 @@ export function SortableNavigationCard({
|
|
|
92
92
|
|
|
93
93
|
return (
|
|
94
94
|
<div ref={setNodeRef} style={style} {...attributes} {...listeners}>
|
|
95
|
-
<NavigationCardBinding {...entry} onClick={onClick}/>
|
|
95
|
+
<NavigationCardBinding {...entry} onClick={onClick} />
|
|
96
96
|
</div>
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
export function NavigationGroupDroppable({
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
id,
|
|
102
|
+
itemIds,
|
|
103
|
+
children,
|
|
104
|
+
isPotentialCardDropTarget = false
|
|
105
|
+
}: {
|
|
106
106
|
id: UniqueIdentifier;
|
|
107
107
|
itemIds: UniqueIdentifier[];
|
|
108
108
|
children: React.ReactNode;
|
|
@@ -128,10 +128,10 @@ export function NavigationGroupDroppable({
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
export function SortableNavigationGroup({
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
groupName,
|
|
132
|
+
children,
|
|
133
|
+
disabled
|
|
134
|
+
}: {
|
|
135
135
|
groupName: string;
|
|
136
136
|
children: React.ReactNode;
|
|
137
137
|
disabled?: boolean;
|
|
@@ -164,21 +164,21 @@ export function SortableNavigationGroup({
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
export function useHomePageDnd({
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
167
|
+
items,
|
|
168
|
+
setItems,
|
|
169
|
+
disabled,
|
|
170
|
+
onCardMovedBetweenGroups,
|
|
171
|
+
onGroupMoved,
|
|
172
|
+
onNewGroupDrop,
|
|
173
|
+
onPersist
|
|
174
|
+
}: {
|
|
175
175
|
items: { name: string; entries: NavigationEntry[] }[];
|
|
176
176
|
setItems: (
|
|
177
177
|
newItemsOrUpdater:
|
|
178
178
|
| { name: string; entries: NavigationEntry[] }[]
|
|
179
179
|
| ((
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
currentItems: { name: string; entries: NavigationEntry[] }[]
|
|
181
|
+
) => { name: string; entries: NavigationEntry[] }[])
|
|
182
182
|
) => void;
|
|
183
183
|
disabled: boolean;
|
|
184
184
|
onCardMovedBetweenGroups?: (card: NavigationEntry) => void;
|
|
@@ -344,9 +344,9 @@ export function useHomePageDnd({
|
|
|
344
344
|
};
|
|
345
345
|
|
|
346
346
|
const handleDragOver = ({
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
347
|
+
active,
|
|
348
|
+
over
|
|
349
|
+
}: { active: Active; over: any }) => {
|
|
350
350
|
if (disabled || !over) return;
|
|
351
351
|
|
|
352
352
|
const activeIdNow = active.id;
|
|
@@ -395,9 +395,9 @@ export function useHomePageDnd({
|
|
|
395
395
|
};
|
|
396
396
|
|
|
397
397
|
const handleDragEnd = ({
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
398
|
+
active,
|
|
399
|
+
over
|
|
400
|
+
}: { active: Active; over: any }) => {
|
|
401
401
|
if (disabled || !over) {
|
|
402
402
|
resetDragState();
|
|
403
403
|
return;
|
|
@@ -505,10 +505,10 @@ export function useHomePageDnd({
|
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
} else if (overCont && activeCont !== overCont) {
|
|
508
|
-
// Card moved between different groups - use CLEAN pre-drag state
|
|
508
|
+
// Card moved between different groups - use CLEAN pre-drag state for the MOVE
|
|
509
|
+
// but use current dndItems for the POSITION
|
|
509
510
|
const finalState = cloneItemsForDnd(sourceState);
|
|
510
511
|
|
|
511
|
-
// Find target container from clean state too
|
|
512
512
|
const finalOverId = lastOverId.current || overIdNow;
|
|
513
513
|
const cleanOverCont = findContainerInState(finalOverId as string, sourceState) || overCont;
|
|
514
514
|
|
|
@@ -524,17 +524,32 @@ export function useHomePageDnd({
|
|
|
524
524
|
// Remove from source
|
|
525
525
|
const [moved] = src.entries.splice(idxInSrc, 1);
|
|
526
526
|
|
|
527
|
-
// Calculate insertion position
|
|
527
|
+
// Calculate insertion position using CURRENT dndItems (visual state after handleDragOver)
|
|
528
|
+
// because that's where the user visually dropped it
|
|
529
|
+
const currentTgt = dndItems.find((g) => g.name === cleanOverCont);
|
|
528
530
|
const overIsContainer = finalOverId === cleanOverCont;
|
|
531
|
+
|
|
529
532
|
if (overIsContainer) {
|
|
530
533
|
tgt.entries.push(moved);
|
|
531
|
-
} else {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
534
|
+
} else if (currentTgt) {
|
|
535
|
+
// Find position in current visual state
|
|
536
|
+
const currentOverIdx = currentTgt.entries.findIndex((e) => e.url === finalOverId);
|
|
537
|
+
if (currentOverIdx !== -1) {
|
|
538
|
+
// Find the card at that position in currentTgt, get its URL
|
|
539
|
+
// Then find that same card in tgt (pre-drag state) and insert before it
|
|
540
|
+
const cardAtPosition = currentTgt.entries[currentOverIdx];
|
|
541
|
+
const tgtOverIdx = tgt.entries.findIndex((e) => e.url === cardAtPosition.url);
|
|
542
|
+
if (tgtOverIdx !== -1) {
|
|
543
|
+
tgt.entries.splice(tgtOverIdx, 0, moved);
|
|
544
|
+
} else {
|
|
545
|
+
// Card might have been the dragged one in current state, just push
|
|
546
|
+
tgt.entries.push(moved);
|
|
547
|
+
}
|
|
535
548
|
} else {
|
|
536
549
|
tgt.entries.push(moved);
|
|
537
550
|
}
|
|
551
|
+
} else {
|
|
552
|
+
tgt.entries.push(moved);
|
|
538
553
|
}
|
|
539
554
|
|
|
540
555
|
// Remove empty source group if needed
|
|
@@ -648,9 +663,9 @@ export function useHomePageDnd({
|
|
|
648
663
|
}
|
|
649
664
|
|
|
650
665
|
export function NewGroupDropZone({
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
666
|
+
disabled,
|
|
667
|
+
setIsHovering
|
|
668
|
+
}: {
|
|
654
669
|
disabled: boolean;
|
|
655
670
|
setIsHovering: (v: boolean) => void;
|
|
656
671
|
}) {
|
|
@@ -690,7 +705,7 @@ export function NewGroupDropZone({
|
|
|
690
705
|
"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",
|
|
691
706
|
isOver
|
|
692
707
|
? "bg-surface-accent-100 dark:bg-surface-accent-800 border-surface-300 dark:border-surface-600"
|
|
693
|
-
: "bg-surface-50 dark:bg-surface-900
|
|
708
|
+
: "bg-surface-50 dark:bg-surface-900 " + defaultBorderMixin
|
|
694
709
|
)}>
|
|
695
710
|
<div className="text-center p-4">
|
|
696
711
|
<span className="block font-medium text-sm">
|
|
@@ -12,18 +12,19 @@ export type NavigationCardProps = {
|
|
|
12
12
|
|
|
13
13
|
// Wrap the component with React.memo
|
|
14
14
|
export const NavigationCard = React.memo(function NavigationCard({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
name,
|
|
16
|
+
description,
|
|
17
|
+
icon,
|
|
18
|
+
actions,
|
|
19
|
+
onClick,
|
|
20
|
+
shrink
|
|
21
|
+
}: NavigationCardProps) {
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<Card
|
|
25
25
|
className={cls(
|
|
26
|
-
"h-full
|
|
26
|
+
"h-full px-4 py-3 cursor-pointer min-h-[160px] transition-all duration-200 ease-in-out",
|
|
27
|
+
"hover:-translate-y-0.5 hover:shadow-md hover:shadow-primary/5",
|
|
27
28
|
shrink && "w-full max-w-full min-h-0 scale-75"
|
|
28
29
|
)}
|
|
29
30
|
onClick={() => {
|
|
@@ -36,12 +37,12 @@ export const NavigationCard = React.memo(function NavigationCard({
|
|
|
36
37
|
className="flex-grow w-full">
|
|
37
38
|
|
|
38
39
|
<div
|
|
39
|
-
className="h-
|
|
40
|
+
className="h-8 flex items-center w-full justify-between text-surface-300 dark:text-surface-600">
|
|
40
41
|
|
|
41
42
|
{icon}
|
|
42
43
|
|
|
43
44
|
<div
|
|
44
|
-
className="flex items-center gap-
|
|
45
|
+
className="flex items-center gap-0.5"
|
|
45
46
|
onClick={(event: React.MouseEvent) => {
|
|
46
47
|
event.preventDefault();
|
|
47
48
|
event.stopPropagation();
|
|
@@ -53,22 +54,23 @@ export const NavigationCard = React.memo(function NavigationCard({
|
|
|
53
54
|
|
|
54
55
|
</div>
|
|
55
56
|
|
|
56
|
-
<Typography gutterBottom variant="
|
|
57
|
-
|
|
57
|
+
<Typography gutterBottom variant="subtitle1"
|
|
58
|
+
className="font-medium mt-1"
|
|
59
|
+
component="h2">
|
|
58
60
|
{name}
|
|
59
61
|
</Typography>
|
|
60
62
|
|
|
61
|
-
{description && <Typography variant="
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
<Markdown source={description} size={"small"}/>
|
|
63
|
+
{description && <Typography variant="caption"
|
|
64
|
+
color="secondary"
|
|
65
|
+
component="div">
|
|
66
|
+
<Markdown source={description} size={"small"} />
|
|
65
67
|
</Typography>}
|
|
66
68
|
</div>
|
|
67
69
|
|
|
68
70
|
<div style={{ alignSelf: "flex-end" }}>
|
|
69
71
|
|
|
70
|
-
<div className={"p-
|
|
71
|
-
<ArrowForwardIcon className="text-primary"/>
|
|
72
|
+
<div className={"p-2"}>
|
|
73
|
+
<ArrowForwardIcon className="text-primary" size={"small"} />
|
|
72
74
|
</div>
|
|
73
75
|
</div>
|
|
74
76
|
|
|
@@ -2,16 +2,16 @@ import React, { PropsWithChildren, useState } from "react";
|
|
|
2
2
|
import { cls, EditIcon, IconButton, Typography, ExpandablePanel } from "@firecms/ui";
|
|
3
3
|
|
|
4
4
|
export function NavigationGroup({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
children,
|
|
6
|
+
group,
|
|
7
|
+
minimised,
|
|
8
|
+
isPreview,
|
|
9
|
+
isPotentialCardDropTarget,
|
|
10
|
+
onEditGroup,
|
|
11
|
+
dndDisabled,
|
|
12
|
+
collapsed,
|
|
13
|
+
onToggleCollapsed
|
|
14
|
+
}: PropsWithChildren<{
|
|
15
15
|
group: string | undefined,
|
|
16
16
|
minimised?: boolean,
|
|
17
17
|
isPreview?: boolean,
|
|
@@ -52,7 +52,7 @@ export function NavigationGroup({
|
|
|
52
52
|
}}
|
|
53
53
|
className={cls("ml-2 ", isHovered ? "opacity-100" : "opacity-0", "transition-opacity duration-100")}
|
|
54
54
|
>
|
|
55
|
-
<EditIcon size="smallest"/>
|
|
55
|
+
<EditIcon size="smallest" />
|
|
56
56
|
</IconButton>
|
|
57
57
|
)}
|
|
58
58
|
</div>
|
|
@@ -70,7 +70,7 @@ export function NavigationGroup({
|
|
|
70
70
|
<div
|
|
71
71
|
className={cls(
|
|
72
72
|
"flex items-center justify-between w-full",
|
|
73
|
-
|
|
73
|
+
"p-4 py-2"
|
|
74
74
|
)}
|
|
75
75
|
onMouseEnter={() => setIsHovered(true)}
|
|
76
76
|
onMouseLeave={() => setIsHovered(false)}
|
|
@@ -94,9 +94,10 @@ export function NavigationGroup({
|
|
|
94
94
|
className={cls("mt-6")}
|
|
95
95
|
titleClassName={cls(
|
|
96
96
|
"min-h-0 p-0 border-none",
|
|
97
|
-
"rounded
|
|
97
|
+
"rounded flex items-center justify-between w-full",
|
|
98
98
|
"hover:bg-transparent",
|
|
99
|
-
"cursor-pointer select-none"
|
|
99
|
+
"cursor-pointer select-none",
|
|
100
|
+
collapsed && "bg-surface-100 dark:bg-surface-800/50"
|
|
100
101
|
)}
|
|
101
102
|
innerClassName={cls("mt-4", !minimised ? "pt-0" : "")}
|
|
102
103
|
title={
|
|
@@ -111,7 +112,7 @@ export function NavigationGroup({
|
|
|
111
112
|
>
|
|
112
113
|
{minimised ? (
|
|
113
114
|
<div className={cls("mt-4 p-8 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg")}
|
|
114
|
-
|
|
115
|
+
style={{ minHeight: "50px" }}>
|
|
115
116
|
</div>
|
|
116
117
|
) : (
|
|
117
118
|
<div className={cls("mt-4", !minimised ? "pt-0" : "")}>
|
|
@@ -138,7 +139,7 @@ export function NavigationGroup({
|
|
|
138
139
|
{!collapsed && (
|
|
139
140
|
minimised ? (
|
|
140
141
|
<div className={cls("mt-4 p-8 bg-surface-accent-200 dark:bg-surface-accent-800 rounded-lg")}
|
|
141
|
-
|
|
142
|
+
style={{ minHeight: "50px" }}>
|
|
142
143
|
</div>
|
|
143
144
|
) : (
|
|
144
145
|
<div className={cls("mt-4", !minimised ? "pt-0" : "")}>
|
|
@@ -108,12 +108,10 @@ export function RenameGroupDialog({
|
|
|
108
108
|
</DialogContent>
|
|
109
109
|
<DialogActions>
|
|
110
110
|
<Button onClick={onClose}
|
|
111
|
-
color={"primary"}
|
|
112
111
|
variant="text">
|
|
113
112
|
Cancel
|
|
114
113
|
</Button>
|
|
115
114
|
<Button onClick={handleSave}
|
|
116
|
-
color={"primary"}
|
|
117
115
|
disabled={!!error || !name.trim()}>
|
|
118
116
|
Save
|
|
119
117
|
</Button>
|
|
@@ -9,10 +9,10 @@ export type SmallNavigationCardProps = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export function SmallNavigationCard({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
name,
|
|
13
|
+
url,
|
|
14
|
+
icon,
|
|
15
|
+
}: SmallNavigationCardProps) {
|
|
16
16
|
|
|
17
17
|
return (
|
|
18
18
|
<>
|
|
@@ -28,17 +28,18 @@ export function SmallNavigationCard({
|
|
|
28
28
|
<div className="flex flex-row items-center flex-grow gap-2 ">
|
|
29
29
|
{icon}
|
|
30
30
|
|
|
31
|
-
<Typography gutterBottom variant="
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
<Typography gutterBottom variant="subtitle1"
|
|
32
|
+
component="h2"
|
|
33
|
+
className="mb-0 ml-3 font-medium">
|
|
34
34
|
{name}
|
|
35
35
|
</Typography>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
|
-
<div className={"p-
|
|
39
|
-
<ArrowForwardIcon color="primary"/>
|
|
38
|
+
<div className={"p-2"}>
|
|
39
|
+
<ArrowForwardIcon color="primary" size={"small"} />
|
|
40
40
|
</div>
|
|
41
41
|
</Link>
|
|
42
42
|
|
|
43
43
|
</>);
|
|
44
44
|
}
|
|
45
|
+
|
|
@@ -326,7 +326,6 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
|
|
|
326
326
|
</Typography>}
|
|
327
327
|
<Button
|
|
328
328
|
onClick={onDone}
|
|
329
|
-
color="primary"
|
|
330
329
|
variant="filled">
|
|
331
330
|
Done
|
|
332
331
|
</Button>
|
|
@@ -363,24 +362,18 @@ function ReferenceDialogActions({
|
|
|
363
362
|
onClick && (largeLayout
|
|
364
363
|
? <Button
|
|
365
364
|
onClick={onClick}
|
|
366
|
-
startIcon={<AddIcon/>}
|
|
367
|
-
variant="outlined"
|
|
368
|
-
color="primary">
|
|
365
|
+
startIcon={<AddIcon/>}>
|
|
369
366
|
Add {collection.singularName ?? collection.name}
|
|
370
367
|
</Button>
|
|
371
368
|
: <Button
|
|
372
|
-
onClick={onClick}
|
|
373
|
-
variant="outlined"
|
|
374
|
-
color="primary"
|
|
375
|
-
>
|
|
369
|
+
onClick={onClick}>
|
|
376
370
|
<AddIcon/>
|
|
377
371
|
</Button>);
|
|
378
372
|
|
|
379
373
|
return (
|
|
380
374
|
<>
|
|
381
375
|
<Button onClick={onClear}
|
|
382
|
-
variant={"text"}
|
|
383
|
-
color="primary">
|
|
376
|
+
variant={"text"}>
|
|
384
377
|
Clear
|
|
385
378
|
</Button>
|
|
386
379
|
{addButton}
|
|
@@ -136,16 +136,14 @@ export function ReferenceWidget<M extends Record<string, any>>({
|
|
|
136
136
|
"min-w-80 flex flex-col gap-4",
|
|
137
137
|
"relative transition-colors duration-200 ease-in rounded font-medium",
|
|
138
138
|
disabled ? "bg-opacity-50" : "hover:bg-opacity-75",
|
|
139
|
-
"text-opacity-50 dark:text-white dark:text-opacity-50",
|
|
139
|
+
"text-opacity-50 text-text-primary/50 dark:text-white dark:text-opacity-50 dark:text-white/50",
|
|
140
140
|
className
|
|
141
141
|
)}
|
|
142
142
|
>
|
|
143
143
|
|
|
144
144
|
{child}
|
|
145
145
|
{!value && <div className="justify-center text-left">
|
|
146
|
-
<Button
|
|
147
|
-
color="primary"
|
|
148
|
-
disabled={disabled}
|
|
146
|
+
<Button disabled={disabled}
|
|
149
147
|
onClick={onEntryClick}>
|
|
150
148
|
Edit {name}
|
|
151
149
|
</Button>
|
|
@@ -93,6 +93,11 @@ export type SelectableTableProps<M extends Record<string, any>> = {
|
|
|
93
93
|
endAdornment?: React.ReactNode;
|
|
94
94
|
|
|
95
95
|
AddColumnComponent?: React.ComponentType;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Callback when columns are reordered via drag-and-drop
|
|
99
|
+
*/
|
|
100
|
+
onColumnsOrderChange?: (columns: VirtualTableColumn[]) => void;
|
|
96
101
|
}
|
|
97
102
|
|
|
98
103
|
/**
|
|
@@ -120,41 +125,42 @@ export type SelectableTableProps<M extends Record<string, any>> = {
|
|
|
120
125
|
* @group Components
|
|
121
126
|
*/
|
|
122
127
|
export const SelectableTable = function SelectableTable<M extends Record<string, any>>
|
|
123
|
-
({
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
128
|
+
({
|
|
129
|
+
onValueChange,
|
|
130
|
+
cellRenderer,
|
|
131
|
+
onEntityClick,
|
|
132
|
+
onColumnResize,
|
|
133
|
+
hoverRow = true,
|
|
134
|
+
size = "m",
|
|
135
|
+
inlineEditing = false,
|
|
136
|
+
tableController:
|
|
137
|
+
{
|
|
138
|
+
data,
|
|
139
|
+
dataLoading,
|
|
140
|
+
noMoreToLoad,
|
|
141
|
+
dataLoadingError,
|
|
142
|
+
filterValues,
|
|
143
|
+
setFilterValues,
|
|
144
|
+
sortBy,
|
|
145
|
+
setSortBy,
|
|
146
|
+
itemCount,
|
|
147
|
+
setItemCount,
|
|
148
|
+
pageSize = 50,
|
|
149
|
+
paginationEnabled,
|
|
150
|
+
checkFilterCombination,
|
|
151
|
+
setPopupCell
|
|
152
|
+
},
|
|
153
|
+
filterable = true,
|
|
154
|
+
onScroll,
|
|
155
|
+
initialScroll,
|
|
156
|
+
emptyComponent,
|
|
157
|
+
columns,
|
|
158
|
+
forceFilter,
|
|
159
|
+
highlightedRow,
|
|
160
|
+
endAdornment,
|
|
161
|
+
AddColumnComponent,
|
|
162
|
+
onColumnsOrderChange
|
|
163
|
+
}: SelectableTableProps<M>) {
|
|
158
164
|
|
|
159
165
|
const ref = useRef<HTMLDivElement>(null);
|
|
160
166
|
|
|
@@ -224,7 +230,7 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
224
230
|
<SelectableTableContext.Provider
|
|
225
231
|
value={contextValue}>
|
|
226
232
|
<div className="h-full w-full flex flex-col bg-white dark:bg-surface-950"
|
|
227
|
-
|
|
233
|
+
ref={ref}>
|
|
228
234
|
|
|
229
235
|
<VirtualTable
|
|
230
236
|
data={data}
|
|
@@ -247,12 +253,13 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
247
253
|
checkFilterCombination={checkFilterCombination}
|
|
248
254
|
createFilterField={filterable ? createFilterField : undefined}
|
|
249
255
|
rowClassName={useCallback((entity: Entity<M>) => {
|
|
250
|
-
return highlightedRow?.(entity) ? "bg-surface-100 bg-opacity-75 dark:bg-surface-800 dark:bg-opacity-75" : "";
|
|
256
|
+
return highlightedRow?.(entity) ? "bg-surface-100 bg-opacity-75 bg-surface-100/75 dark:bg-surface-800 dark:bg-opacity-75 dark:bg-surface-800/75" : "";
|
|
251
257
|
}, [highlightedRow])}
|
|
252
258
|
className="flex-grow"
|
|
253
259
|
emptyComponent={emptyComponent}
|
|
254
260
|
endAdornment={endAdornment}
|
|
255
261
|
AddColumnComponent={AddColumnComponent}
|
|
262
|
+
onColumnsOrderChange={onColumnsOrderChange}
|
|
256
263
|
/>
|
|
257
264
|
|
|
258
265
|
</div>
|
|
@@ -262,13 +269,13 @@ export const SelectableTable = function SelectableTable<M extends Record<string,
|
|
|
262
269
|
};
|
|
263
270
|
|
|
264
271
|
function createFilterField({
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
+
id,
|
|
273
|
+
filterValue,
|
|
274
|
+
setFilterValue,
|
|
275
|
+
column,
|
|
276
|
+
hidden,
|
|
277
|
+
setHidden
|
|
278
|
+
}: FilterFormFieldProps<{
|
|
272
279
|
resolvedProperty: ResolvedProperty,
|
|
273
280
|
disabled: boolean,
|
|
274
281
|
}>): React.ReactNode {
|
|
@@ -286,40 +293,41 @@ function createFilterField({
|
|
|
286
293
|
}
|
|
287
294
|
if (baseProperty.dataType === "reference") {
|
|
288
295
|
return <ReferenceFilterField value={filterValue}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
setValue={setFilterValue}
|
|
297
|
+
name={id as string}
|
|
298
|
+
isArray={isArray}
|
|
299
|
+
path={baseProperty.path}
|
|
300
|
+
title={resolvedProperty?.name}
|
|
301
|
+
includeId={baseProperty.includeId}
|
|
302
|
+
previewProperties={baseProperty?.previewProperties}
|
|
303
|
+
hidden={hidden}
|
|
304
|
+
setHidden={setHidden} />;
|
|
298
305
|
} else if (baseProperty.dataType === "number" || baseProperty.dataType === "string") {
|
|
299
306
|
const name = baseProperty.name;
|
|
300
307
|
const enumValues = baseProperty.enumValues ? enumToObjectEntries(baseProperty.enumValues) : undefined;
|
|
301
308
|
return <StringNumberFilterField value={filterValue}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
309
|
+
setValue={setFilterValue}
|
|
310
|
+
name={id as string}
|
|
311
|
+
dataType={baseProperty.dataType}
|
|
312
|
+
isArray={isArray}
|
|
313
|
+
enumValues={enumValues}
|
|
314
|
+
title={name} />;
|
|
308
315
|
} else if (baseProperty.dataType === "boolean") {
|
|
309
316
|
const name = baseProperty.name;
|
|
310
317
|
return <BooleanFilterField value={filterValue}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
318
|
+
setValue={setFilterValue}
|
|
319
|
+
name={id as string}
|
|
320
|
+
title={name} />;
|
|
314
321
|
|
|
315
322
|
} else if (baseProperty.dataType === "date") {
|
|
316
323
|
const title = baseProperty.name;
|
|
317
324
|
return <DateTimeFilterField value={filterValue}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
325
|
+
setValue={setFilterValue}
|
|
326
|
+
name={id as string}
|
|
327
|
+
mode={baseProperty.mode}
|
|
328
|
+
isArray={isArray}
|
|
329
|
+
timezone={baseProperty.timezone}
|
|
330
|
+
title={title} />;
|
|
323
331
|
}
|
|
324
332
|
|
|
325
333
|
return (
|