@mui-toolpad-extended-tuni/core 3.0.0
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 +99 -0
- package/dist/Dialogs/DialogOpener.d.ts +12 -0
- package/dist/Dialogs/Dialogs.d.ts +6 -0
- package/dist/Dialogs/ExtendedDialog.d.ts +8 -0
- package/dist/Dialogs/FormDialog.d.ts +15 -0
- package/dist/Dialogs/dialogRegistry.d.ts +5 -0
- package/dist/Events/EventBus.d.ts +34 -0
- package/dist/Events/UserBus.d.ts +110 -0
- package/dist/Events/hooks/useCurrentUser.d.ts +11 -0
- package/dist/Events/hooks/useUserActions.d.ts +15 -0
- package/dist/Events/hooks/useUserPreferences.d.ts +22 -0
- package/dist/Events/index.d.ts +10 -0
- package/dist/Events/types.d.ts +16 -0
- package/dist/Events/userTypes.d.ts +79 -0
- package/dist/Navigation/NavigationBuilder.d.ts +7 -0
- package/dist/Navigation/NavigationFilter.d.ts +1 -0
- package/dist/Navigation/NavigationRegistry.d.ts +116 -0
- package/dist/Navigation/hooks/useMicroserviceNavigation.d.ts +4 -0
- package/dist/Navigation/hooks/useMicroserviceRoutes.d.ts +6 -0
- package/dist/Navigation/hooks/useNavigationSectionManager.d.ts +23 -0
- package/dist/Navigation/hooks/useSyncNavigationFilters.d.ts +1 -0
- package/dist/Navigation/store/microserviceUtils.d.ts +9 -0
- package/dist/Navigation/store/navigationCalculator.d.ts +11 -0
- package/dist/Navigation/store/sectionManager.d.ts +9 -0
- package/dist/Navigation/store/types.d.ts +90 -0
- package/dist/Navigation/store/useNavigationFilterStore.d.ts +6 -0
- package/dist/Navigation/store/useNavigationStore.d.ts +50 -0
- package/dist/Notifications/Notifications.d.ts +3 -0
- package/dist/Notifications/store/useNotificationsStore.d.ts +22 -0
- package/dist/common/components/index.d.ts +2 -0
- package/dist/common/components/layout/GridLayout/GridItem.d.ts +17 -0
- package/dist/common/components/layout/GridLayout/GridItemContext.d.ts +26 -0
- package/dist/common/components/layout/GridLayout/ResponsiveGridLayout.d.ts +16 -0
- package/dist/common/components/layout/GridLayout/Tools/BreakpointIndicator.d.ts +8 -0
- package/dist/common/components/layout/GridLayout/Tools/EditModeToggler.d.ts +7 -0
- package/dist/common/components/layout/GridLayout/hooks/useGridLayoutManagement.d.ts +27 -0
- package/dist/common/components/layout/GridLayout/index.d.ts +12 -0
- package/dist/common/components/layout/GridLayout/layoutStorageUtils.d.ts +52 -0
- package/dist/common/components/layout/GridLayout/layoutUtils.d.ts +78 -0
- package/dist/common/components/layout/GridLayout/store/usePanelStore.d.ts +27 -0
- package/dist/common/components/layout/GridLayout/useGridLayout.d.ts +11 -0
- package/dist/common/components/layout/index.d.ts +1 -0
- package/dist/common/components/ui/CenteredHeading/CenteredHeading.d.ts +7 -0
- package/dist/common/components/ui/CollapsingButtons/CollapsingButtons.d.ts +11 -0
- package/dist/common/components/ui/CompoundPanel/CompoundPanel.d.ts +86 -0
- package/dist/common/components/ui/LoadingScreen/LoadingScreen.d.ts +2 -0
- package/dist/common/components/ui/Panel/Expandable/Expandable.d.ts +4 -0
- package/dist/common/components/ui/Panel/Expandable/context/ExpandableContextProvider.d.ts +10 -0
- package/dist/common/components/ui/Panel/Expandable/hooks/useCollapseHandler.d.ts +2 -0
- package/dist/common/components/ui/Panel/Expandable/hooks/useExpandable.d.ts +17 -0
- package/dist/common/components/ui/Panel/Expandable/hooks/useExpansionAnimation.d.ts +5 -0
- package/dist/common/components/ui/Panel/Expandable/hooks/useInitialSetup.d.ts +6 -0
- package/dist/common/components/ui/Panel/Expandable/hooks/useResizeHandler.d.ts +1 -0
- package/dist/common/components/ui/Panel/Expandable/store/useExpandablePanelStore.d.ts +7 -0
- package/dist/common/components/ui/Panel/Main/Context/PanelContextProvider.d.ts +50 -0
- package/dist/common/components/ui/Panel/Main/Panel.d.ts +3 -0
- package/dist/common/components/ui/Panel/Main/hooks/useDimensionManagement.d.ts +13 -0
- package/dist/common/components/ui/Panel/Main/hooks/usePersistentDimensions.d.ts +19 -0
- package/dist/common/components/ui/Panel/Main/tools/BlurOverlay.d.ts +6 -0
- package/dist/common/components/ui/Panel/Main/tools/ToolsContainer.d.ts +11 -0
- package/dist/common/components/ui/Panel/Movable/DraggableItem.d.ts +6 -0
- package/dist/common/components/ui/Panel/Movable/MovablePanel.d.ts +9 -0
- package/dist/common/components/ui/Panel/Movable/MoveToggler.d.ts +3 -0
- package/dist/common/components/ui/Panel/Movable/context/MovableContextProvider.d.ts +10 -0
- package/dist/common/components/ui/Panel/Movable/hooks/usePersistentOrder.d.ts +3 -0
- package/dist/common/components/ui/Panel/Resizable/Context/ResizableContextProvider.d.ts +27 -0
- package/dist/common/components/ui/Panel/Resizable/Hooks/useResizeHandlers.d.ts +26 -0
- package/dist/common/components/ui/Panel/Resizable/Hooks/useResponsiveResize.d.ts +14 -0
- package/dist/common/components/ui/Panel/Resizable/Resizable.d.ts +3 -0
- package/dist/common/components/ui/Panel/Resizable/ResizeHandlers.d.ts +7 -0
- package/dist/common/components/ui/Panel/Resizable/ResizeIndicator.d.ts +9 -0
- package/dist/common/components/ui/Panel/Scrollable/InternalScrolling.d.ts +11 -0
- package/dist/common/components/ui/Panel/Scrollable/PaginationDots.d.ts +13 -0
- package/dist/common/components/ui/Panel/Scrollable/Scrollable.d.ts +5 -0
- package/dist/common/components/ui/Panel/Scrollable/context/ScrollerContextProvider.d.ts +15 -0
- package/dist/common/components/ui/Panel/Scrollable/hooks/useScrollControls.d.ts +28 -0
- package/dist/common/components/ui/Panel/TBR/PanelContent.d.ts +24 -0
- package/dist/common/components/ui/Panel/TBR/ResizablePanel.d.ts +3 -0
- package/dist/common/components/ui/Panel/TBR/ResizeHandlers.d.ts +10 -0
- package/dist/common/components/ui/Panel/TBR/ResizeIndicator.d.ts +10 -0
- package/dist/common/components/ui/Panel/TBR/useResizablePanel.d.ts +32 -0
- package/dist/common/components/ui/Panel/types.d.ts +9 -0
- package/dist/common/components/ui/Scroller/PaginationDots.d.ts +13 -0
- package/dist/common/components/ui/Scroller/Scroller.d.ts +14 -0
- package/dist/common/components/ui/Scroller/context/ScrollerContextProvider.d.ts +15 -0
- package/dist/common/components/ui/Scroller/hooks/useScrollControls.d.ts +28 -0
- package/dist/common/components/ui/Scroller/types.d.ts +1 -0
- package/dist/common/components/ui/SpeedDialButton/SpeedDialButton.d.ts +20 -0
- package/dist/common/components/ui/index.d.ts +14 -0
- package/dist/common/hooks/index.d.ts +1 -0
- package/dist/common/hooks/useRetry.d.ts +12 -0
- package/dist/common/index.d.ts +2 -0
- package/dist/constants.d.ts +24 -0
- package/dist/core.css +1 -0
- package/dist/index.cjs +219 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.es.js +25836 -0
- package/dist/interfaces.d.ts +1 -0
- package/dist/utils/apiPrefix.d.ts +3 -0
- package/dist/utils/caseConverter.d.ts +17 -0
- package/dist/utils/cookieUtils.d.ts +27 -0
- package/dist/utils/parseDate.d.ts +2 -0
- package/dist/utils/slugify.d.ts +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { SvgIconComponent } from '@mui/icons-material';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface NavigationItemBase {
|
|
4
|
+
kind: "header" | "page" | "divider";
|
|
5
|
+
title?: string;
|
|
6
|
+
actionFC?: React.FC;
|
|
7
|
+
}
|
|
8
|
+
export interface ToolMetadata {
|
|
9
|
+
description?: string;
|
|
10
|
+
forRoles?: string[];
|
|
11
|
+
isRootTool?: boolean;
|
|
12
|
+
underHeader?: string;
|
|
13
|
+
microservices?: string[];
|
|
14
|
+
}
|
|
15
|
+
export interface NavigationHeaderItem extends NavigationItemBase {
|
|
16
|
+
kind: "header";
|
|
17
|
+
title: string;
|
|
18
|
+
}
|
|
19
|
+
export interface NavigationDividerItem extends NavigationItemBase {
|
|
20
|
+
kind: "divider";
|
|
21
|
+
}
|
|
22
|
+
export interface NavigationPageStoreItem extends NavigationItemBase {
|
|
23
|
+
kind: "page";
|
|
24
|
+
segment: string;
|
|
25
|
+
iconFC?: SvgIconComponent;
|
|
26
|
+
icon?: React.ReactElement;
|
|
27
|
+
children?: NavigationPageStoreItem[];
|
|
28
|
+
view?: React.ComponentType;
|
|
29
|
+
action?: React.ReactElement;
|
|
30
|
+
showTitle?: boolean;
|
|
31
|
+
metadata?: ToolMetadata;
|
|
32
|
+
}
|
|
33
|
+
export type NavigationStoreItem = NavigationHeaderItem | NavigationPageStoreItem | NavigationDividerItem;
|
|
34
|
+
/**
|
|
35
|
+
* Updated addSectionProps type.
|
|
36
|
+
* Now you provide a header (underHeader) and an array of page configs.
|
|
37
|
+
*/
|
|
38
|
+
export type addSectionProps = {
|
|
39
|
+
underHeader: string;
|
|
40
|
+
keepVisible?: boolean;
|
|
41
|
+
pages: Array<{
|
|
42
|
+
segment: string;
|
|
43
|
+
title: string;
|
|
44
|
+
Icon?: SvgIconComponent;
|
|
45
|
+
description?: string;
|
|
46
|
+
instances?: string[];
|
|
47
|
+
microservices?: string[];
|
|
48
|
+
actionFC?: React.FC;
|
|
49
|
+
}>;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* New interface for a navigation section.
|
|
53
|
+
* Each section is keyed by its header (or unique id) and contains:
|
|
54
|
+
* - header: the header item (NavigationHeaderItem)
|
|
55
|
+
* - pages: a dictionary of pages keyed by their segment
|
|
56
|
+
* - pageOrder: an array of page keys (segments) to preserve ordering
|
|
57
|
+
*/
|
|
58
|
+
export interface NavigationSection {
|
|
59
|
+
header: NavigationHeaderItem;
|
|
60
|
+
pages: Record<string, NavigationPageStoreItem>;
|
|
61
|
+
pageOrder: string[];
|
|
62
|
+
}
|
|
63
|
+
export type ViewStore = {
|
|
64
|
+
navigation: NavigationStoreItem[];
|
|
65
|
+
sections: Record<string, NavigationSection>;
|
|
66
|
+
sectionOrder: string[];
|
|
67
|
+
/**
|
|
68
|
+
* App-level microservice navigation items only.
|
|
69
|
+
* These are typically registered via NavigationRegistry for app-level routes.
|
|
70
|
+
*/
|
|
71
|
+
allMicroserviceNavigation: NavigationPageStoreItem[];
|
|
72
|
+
addSection: (props: addSectionProps) => void;
|
|
73
|
+
removeHeader: (header: string) => void;
|
|
74
|
+
addMicroserviceNavigation: (microserviceNavigation: NavigationPageStoreItem) => void;
|
|
75
|
+
addStandaloneNavigation: (navigation: NavigationPageStoreItem) => void;
|
|
76
|
+
updateMicroserviceNavigationForSections: () => void;
|
|
77
|
+
recalculateNavigation: () => void;
|
|
78
|
+
visibleSections: Record<string, boolean>;
|
|
79
|
+
setVisibleSections: (options: Record<string, boolean>) => void;
|
|
80
|
+
collapsedSections: Record<string, boolean>;
|
|
81
|
+
setCollapsedSections: (options: Record<string, boolean>) => void;
|
|
82
|
+
toggleSectionCollapse: (sectionKey: string) => void;
|
|
83
|
+
/**
|
|
84
|
+
* Externally registered microservice navigation items.
|
|
85
|
+
* These are provided by external components (like CourseMicroservice) via setExternalMicroservices.
|
|
86
|
+
* The store is microservice-agnostic - it doesn't know or care about specific microservice types.
|
|
87
|
+
*/
|
|
88
|
+
externalMicroservices: NavigationPageStoreItem[];
|
|
89
|
+
setExternalMicroservices: (microservices: NavigationPageStoreItem[]) => void;
|
|
90
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface NavigationFilterState {
|
|
2
|
+
filterOptions: Record<string, boolean>;
|
|
3
|
+
setFilterOptions: (optionsOrUpdater: Record<string, boolean> | ((prev: Record<string, boolean>) => Record<string, boolean>)) => void;
|
|
4
|
+
initializeFilters: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useNavigationFilterStore: import('zustand').UseBoundStore<import('zustand').StoreApi<NavigationFilterState>>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { NavigationStoreItem, ViewStore } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Navigation management store with enhanced section management and filtering capabilities.
|
|
4
|
+
*
|
|
5
|
+
* @version 3.1.0
|
|
6
|
+
* @updates
|
|
7
|
+
* - Complete rewrite of navigation structure using sections
|
|
8
|
+
* - Added section-based visibility filtering
|
|
9
|
+
* - Enhanced microservice integration with automatic updates
|
|
10
|
+
* - Added support for dividers in navigation
|
|
11
|
+
* - Introduced flexible section management with ordered headers
|
|
12
|
+
* - Added action components support in navigation items
|
|
13
|
+
* - Clear separation: app-level navigation only (course microservices handled separately)
|
|
14
|
+
* - Refactored: Extracted types, utilities, and complex logic into separate modules
|
|
15
|
+
*
|
|
16
|
+
* @breaking-changes
|
|
17
|
+
* - Removed updateSection and updateCourseInstanceSection methods
|
|
18
|
+
* - Changed addSection API to use header-based organization
|
|
19
|
+
* - Sections are now managed through a structured record instead of flat array
|
|
20
|
+
* - Navigation items require explicit header assignment
|
|
21
|
+
* - Changed microservice update mechanism to be section-aware
|
|
22
|
+
*
|
|
23
|
+
* @scope
|
|
24
|
+
* This store handles navigation for the application:
|
|
25
|
+
* - Global sections (Help, Contact, etc.)
|
|
26
|
+
* - App-level microservices registered via NavigationRegistry
|
|
27
|
+
* - External microservices provided via setExternalMicroservices (e.g., from CourseMicroservice)
|
|
28
|
+
*
|
|
29
|
+
* @structure
|
|
30
|
+
* Navigation is now organized into sections:
|
|
31
|
+
* - Each section has a header, pages, and maintained order
|
|
32
|
+
* - Pages can have nested children (for instances or microservices)
|
|
33
|
+
* - Sections can be individually shown/hidden through visibleSections
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* useNavigationStore.getState().addSection({
|
|
38
|
+
* underHeader: "Courses",
|
|
39
|
+
* pages: [{
|
|
40
|
+
* segment: "course-1",
|
|
41
|
+
* title: "Course 1",
|
|
42
|
+
* description: "Example course",
|
|
43
|
+
* microservices: ["attendance", "grades"]
|
|
44
|
+
* }]
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare const useNavigationStore: import('zustand').UseBoundStore<import('zustand').StoreApi<ViewStore>>;
|
|
49
|
+
export declare const filterNavigationByRole: (role: string) => NavigationStoreItem[];
|
|
50
|
+
export type { NavigationItemBase, ToolMetadata, NavigationHeaderItem, NavigationDividerItem, NavigationPageStoreItem, NavigationStoreItem, addSectionProps, NavigationSection, } from './types';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
export type NotificationRaw = {
|
|
3
|
+
type: string;
|
|
4
|
+
message: string;
|
|
5
|
+
singular?: boolean;
|
|
6
|
+
singularId?: string;
|
|
7
|
+
};
|
|
8
|
+
export type Notification = {
|
|
9
|
+
type: string;
|
|
10
|
+
message: string;
|
|
11
|
+
id: string;
|
|
12
|
+
singular?: boolean;
|
|
13
|
+
singularId?: string;
|
|
14
|
+
};
|
|
15
|
+
type NotificationStore = {
|
|
16
|
+
notifications: Notification[] | [];
|
|
17
|
+
addNotificationData: (notificationData: NotificationRaw) => void;
|
|
18
|
+
removeNotificationData: (notificationId: number) => void;
|
|
19
|
+
clearNotificationsByType: (type: string) => void;
|
|
20
|
+
};
|
|
21
|
+
export declare const useNotificationStore: import('zustand').UseBoundStore<import('zustand').StoreApi<NotificationStore>>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
export interface GridItemProps {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
id: string;
|
|
5
|
+
isFlexContainer?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Grid item component that applies consistent styling and resize visual feedback.
|
|
9
|
+
*
|
|
10
|
+
* Features:
|
|
11
|
+
* - Visual indication when in resize or move mode
|
|
12
|
+
* - Consistent styling for all grid items
|
|
13
|
+
* - Optional flex container for content that needs to fill the space
|
|
14
|
+
* - Content is non-interactable when in edit mode (using BlurOverlay)
|
|
15
|
+
*/
|
|
16
|
+
declare const GridItem: React.FC<GridItemProps>;
|
|
17
|
+
export default GridItem;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { Layout } from 'react-grid-layout';
|
|
3
|
+
export interface GridItem {
|
|
4
|
+
id: string;
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
layout?: Layout;
|
|
7
|
+
}
|
|
8
|
+
export interface GridItemEntry {
|
|
9
|
+
id: string;
|
|
10
|
+
content: ReactNode;
|
|
11
|
+
layout?: Layout;
|
|
12
|
+
}
|
|
13
|
+
interface GridItemContextType {
|
|
14
|
+
gridItems: GridItemEntry[];
|
|
15
|
+
registerGridItem: (id: string, content: ReactNode, layout?: Layout) => void;
|
|
16
|
+
unregisterGridItem: (id: string) => void;
|
|
17
|
+
getGridItem: (id: string) => GridItemEntry | undefined;
|
|
18
|
+
getAllGridItems: () => GridItemEntry[];
|
|
19
|
+
}
|
|
20
|
+
declare const GridItemContext: React.Context<GridItemContextType | undefined>;
|
|
21
|
+
export declare const useGridItemContext: () => GridItemContextType;
|
|
22
|
+
interface GridItemProviderProps {
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare const GridItemProvider: React.FC<GridItemProviderProps>;
|
|
26
|
+
export default GridItemContext;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { Layout } from 'react-grid-layout';
|
|
3
|
+
export interface GridItem {
|
|
4
|
+
id: string;
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
layout?: Layout;
|
|
7
|
+
}
|
|
8
|
+
export interface GridLayoutProps {
|
|
9
|
+
items: GridItem[];
|
|
10
|
+
storageKey: string;
|
|
11
|
+
defaultLayouts: {
|
|
12
|
+
[key: string]: Layout[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare const ResponsiveGridLayout: React.FC<GridLayoutProps>;
|
|
16
|
+
export default ResponsiveGridLayout;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Layout, Layouts } from 'react-grid-layout';
|
|
2
|
+
/**
|
|
3
|
+
* Options for the useGridLayoutManagement hook
|
|
4
|
+
*/
|
|
5
|
+
interface UseGridLayoutManagementOptions {
|
|
6
|
+
/** Storage key for persisting layouts */
|
|
7
|
+
storageKey: string;
|
|
8
|
+
/** Default layouts to use if none found in storage */
|
|
9
|
+
defaultLayouts: Layouts;
|
|
10
|
+
/** Function to run when layout changes */
|
|
11
|
+
onLayoutChangeCallback?: (layouts: Layouts) => void;
|
|
12
|
+
/** Debounce time for saving to localStorage (ms) */
|
|
13
|
+
debounceTime?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hook for managing grid layouts, including persistence, updates, and preset handling
|
|
17
|
+
*
|
|
18
|
+
* @param options Configuration options
|
|
19
|
+
* @returns Layout management utilities
|
|
20
|
+
*/
|
|
21
|
+
export declare function useGridLayoutManagement({ storageKey, defaultLayouts, onLayoutChangeCallback, debounceTime, }: UseGridLayoutManagementOptions): {
|
|
22
|
+
layouts: Layouts;
|
|
23
|
+
onLayoutChange: (_: Layout[], allLayouts: Layouts) => void;
|
|
24
|
+
applyLayout: (newLayouts: Layouts) => void;
|
|
25
|
+
resetToDefault: () => void;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
export * from './GridItemContext';
|
|
3
|
+
export * from './layoutUtils';
|
|
4
|
+
export { default as GridItem } from './GridItem';
|
|
5
|
+
export { default as ResponsiveGridLayout } from './ResponsiveGridLayout';
|
|
6
|
+
export type { GridItem as GridItemType, GridLayoutProps } from './ResponsiveGridLayout';
|
|
7
|
+
export { default as useGridLayout } from './useGridLayout';
|
|
8
|
+
export * from './layoutStorageUtils';
|
|
9
|
+
export * from './hooks/useGridLayoutManagement';
|
|
10
|
+
export { default as EditModeToggler } from './Tools/EditModeToggler';
|
|
11
|
+
export { default as BreakpointIndicator } from './Tools/BreakpointIndicator';
|
|
12
|
+
export * from './store/usePanelStore';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Layouts } from 'react-grid-layout';
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get layout from localStorage
|
|
4
|
+
* @param key Storage key for the layout
|
|
5
|
+
* @returns The stored layout or null if not found
|
|
6
|
+
*/
|
|
7
|
+
export declare function getFromLS(key: string): Layouts | null;
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to save layout to localStorage
|
|
10
|
+
* @param key Storage key for the layout
|
|
11
|
+
* @param value The layout to store
|
|
12
|
+
*/
|
|
13
|
+
export declare function saveToLS(key: string, value: Layouts): void;
|
|
14
|
+
export declare const USER_PRESETS_KEY = "user-layout-presets";
|
|
15
|
+
/**
|
|
16
|
+
* Layout preset interface
|
|
17
|
+
*/
|
|
18
|
+
export interface LayoutPreset {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
layouts: Layouts;
|
|
22
|
+
createdAt?: number;
|
|
23
|
+
updatedAt?: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Helper function to get user presets from localStorage
|
|
27
|
+
* @returns Array of user-defined layout presets
|
|
28
|
+
*/
|
|
29
|
+
export declare function getUserPresets(): LayoutPreset[];
|
|
30
|
+
/**
|
|
31
|
+
* Helper function to save a user preset to localStorage
|
|
32
|
+
* @param name Name of the preset
|
|
33
|
+
* @param layouts Layout configuration to save
|
|
34
|
+
* @returns ID of the newly created preset
|
|
35
|
+
*/
|
|
36
|
+
export declare function saveUserPreset(name: string, layouts: Layouts): string;
|
|
37
|
+
/**
|
|
38
|
+
* Helper function to delete a user preset from localStorage
|
|
39
|
+
* @param presetId ID of the preset to delete
|
|
40
|
+
* @returns true if deletion was successful, false otherwise
|
|
41
|
+
*/
|
|
42
|
+
export declare function deleteUserPreset(presetId: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Helper function to update a user preset in localStorage
|
|
45
|
+
* @param presetId ID of the preset to update
|
|
46
|
+
* @param updates Object with properties to update
|
|
47
|
+
* @returns true if update was successful, false otherwise
|
|
48
|
+
*/
|
|
49
|
+
export declare function updateUserPreset(presetId: string, updates: Partial<{
|
|
50
|
+
name: string;
|
|
51
|
+
layouts: Layouts;
|
|
52
|
+
}>): boolean;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Layout } from 'react-grid-layout';
|
|
2
|
+
/**
|
|
3
|
+
* Options for creating a grid item layout.
|
|
4
|
+
* All properties are optional, allowing for flexible grid item creation.
|
|
5
|
+
*/
|
|
6
|
+
export interface CreateGridItemOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Unique identifier for the grid item.
|
|
9
|
+
* If not provided, a unique ID will be generated.
|
|
10
|
+
*/
|
|
11
|
+
id?: string;
|
|
12
|
+
/**
|
|
13
|
+
* X position in the grid (column index).
|
|
14
|
+
* Defaults to 0 if not specified.
|
|
15
|
+
*/
|
|
16
|
+
x?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Y position in the grid (row index).
|
|
19
|
+
* Defaults to 0 if not specified.
|
|
20
|
+
*/
|
|
21
|
+
y?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Width of the grid item in grid units.
|
|
24
|
+
* If null, the item will span the full width of the grid.
|
|
25
|
+
* Defaults to 1 if not specified.
|
|
26
|
+
*/
|
|
27
|
+
w?: number | null;
|
|
28
|
+
/**
|
|
29
|
+
* Height of the grid item in grid units.
|
|
30
|
+
* Defaults to 1 if not specified.
|
|
31
|
+
*/
|
|
32
|
+
h?: number | null;
|
|
33
|
+
/**
|
|
34
|
+
* Minimum width constraint.
|
|
35
|
+
* Defaults to 1 if not specified.
|
|
36
|
+
*/
|
|
37
|
+
minW?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Maximum width constraint.
|
|
40
|
+
* If null, no maximum width constraint.
|
|
41
|
+
*/
|
|
42
|
+
maxW?: number | null;
|
|
43
|
+
/**
|
|
44
|
+
* Minimum height constraint.
|
|
45
|
+
* Defaults to 1 if not specified.
|
|
46
|
+
*/
|
|
47
|
+
minH?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Maximum height constraint.
|
|
50
|
+
* If null, no maximum height constraint.
|
|
51
|
+
*/
|
|
52
|
+
maxH?: number | null;
|
|
53
|
+
/**
|
|
54
|
+
* Whether the item is static (cannot be moved or resized).
|
|
55
|
+
* Defaults to false.
|
|
56
|
+
*/
|
|
57
|
+
static?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Creates a grid item layout configuration.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Create a grid item with default settings
|
|
64
|
+
* createGridItem({ id: "my-item" });
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // Create a grid item with specific dimensions
|
|
68
|
+
* createGridItem({ id: "my-item", x: 0, y: 0, w: 7, h: 5 });
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // Create a full-width grid item
|
|
72
|
+
* createGridItem({
|
|
73
|
+
* id: "my-item",
|
|
74
|
+
* w: null, // null means full width
|
|
75
|
+
* h: 5
|
|
76
|
+
* });
|
|
77
|
+
*/
|
|
78
|
+
export declare function createGridItem(options: CreateGridItemOptions): Layout;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
interface PanelState {
|
|
3
|
+
editMode: boolean;
|
|
4
|
+
toggleEditMode: () => void;
|
|
5
|
+
resizeMode: boolean;
|
|
6
|
+
toggleResizeMode: () => void;
|
|
7
|
+
moveMode: boolean;
|
|
8
|
+
toggleMoveMode: () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Store for managing panel state related to grid layouts.
|
|
12
|
+
*
|
|
13
|
+
* This uses a single editMode that enables both dragging and resizing.
|
|
14
|
+
* It also manages saved layout presets.
|
|
15
|
+
*/
|
|
16
|
+
export declare const usePanelStore: import('zustand').UseBoundStore<Omit<import('zustand').StoreApi<PanelState>, "persist"> & {
|
|
17
|
+
persist: {
|
|
18
|
+
setOptions: (options: Partial<import('zustand/middleware').PersistOptions<PanelState, PanelState>>) => void;
|
|
19
|
+
clearStorage: () => void;
|
|
20
|
+
rehydrate: () => Promise<void> | void;
|
|
21
|
+
hasHydrated: () => boolean;
|
|
22
|
+
onHydrate: (fn: (state: PanelState) => void) => () => void;
|
|
23
|
+
onFinishHydration: (fn: (state: PanelState) => void) => () => void;
|
|
24
|
+
getOptions: () => Partial<import('zustand/middleware').PersistOptions<PanelState, PanelState>>;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
export default usePanelStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GridLayout';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface CollapsingButtonsProps {
|
|
3
|
+
collapseIcon: React.ReactNode;
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
collapseWidth: number;
|
|
6
|
+
delay?: number;
|
|
7
|
+
tooltipTitle?: string;
|
|
8
|
+
fullWidth?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const CollapsingButtons: ({ collapseIcon, children, collapseWidth, delay, tooltipTitle, fullWidth, }: CollapsingButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { PanelProps } from '../Panel/Main/Context/PanelContextProvider';
|
|
3
|
+
export interface CompoundPanelProps extends PanelProps {
|
|
4
|
+
/**
|
|
5
|
+
* Content to be displayed in the panel
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the panel should display in a horizontal scroller
|
|
10
|
+
*/
|
|
11
|
+
horizontalScroll?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the panel should display in a vertical scroller
|
|
14
|
+
*/
|
|
15
|
+
verticalScroll?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Optional title for the panel's horizontal scroller
|
|
18
|
+
*/
|
|
19
|
+
title?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Priority level for title styling
|
|
22
|
+
*/
|
|
23
|
+
priority?: "high" | "low" | "normal";
|
|
24
|
+
/**
|
|
25
|
+
* Automatically arrange children as sections (useful for course sections)
|
|
26
|
+
* Each direct child will be rendered as a horizontal section inside a vertical scroller
|
|
27
|
+
*/
|
|
28
|
+
sections?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* CompoundPanel - An all-in-one panel component that encapsulates all functionality
|
|
32
|
+
* needed for panels in the LMS system, including scrolling, expanding, and resizing.
|
|
33
|
+
*
|
|
34
|
+
* @example - Simple scrolling panel
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <CompoundPanel
|
|
37
|
+
* id="my-panel"
|
|
38
|
+
* defaultWidth={300}
|
|
39
|
+
* defaultHeight={200}
|
|
40
|
+
* horizontalScroll={true}
|
|
41
|
+
* title="My Panel"
|
|
42
|
+
* >
|
|
43
|
+
* <Item1 />
|
|
44
|
+
* <Item2 />
|
|
45
|
+
* </CompoundPanel>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @example - Sectioned panel (auto-creates horizontal sections within vertical scroll)
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <CompoundPanel
|
|
51
|
+
* id="sections-panel"
|
|
52
|
+
* sections={true}
|
|
53
|
+
* >
|
|
54
|
+
* <Section title="Section 1" priority="high">
|
|
55
|
+
* <Item1 />
|
|
56
|
+
* <Item2 />
|
|
57
|
+
* </Section>
|
|
58
|
+
* <Section title="Section 2">
|
|
59
|
+
* <Item3 />
|
|
60
|
+
* <Item4 />
|
|
61
|
+
* </Section>
|
|
62
|
+
* </CompoundPanel>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare const CompoundPanel: React.FC<CompoundPanelProps>;
|
|
66
|
+
export interface SectionProps {
|
|
67
|
+
title?: string;
|
|
68
|
+
priority?: "high" | "low" | "normal";
|
|
69
|
+
children: React.ReactNode;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Section - A component that defines a horizontal section within a CompoundPanel.
|
|
73
|
+
* Used with CompoundPanel's sections={true} property.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* <CompoundPanel sections={true}>
|
|
78
|
+
* <Section title="My Section" priority="high">
|
|
79
|
+
* <Item1 />
|
|
80
|
+
* <Item2 />
|
|
81
|
+
* </Section>
|
|
82
|
+
* </CompoundPanel>
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const Section: React.FC<SectionProps>;
|
|
86
|
+
export default CompoundPanel;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
interface ExpandableContextType {
|
|
3
|
+
isExpanded: boolean;
|
|
4
|
+
setIsExpanded: React.Dispatch<React.SetStateAction<boolean>>;
|
|
5
|
+
}
|
|
6
|
+
export declare const ExpandableContextProvider: ({ children, }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const useExpandableContext: () => ExpandableContextType;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { PanelRef } from '../../types';
|
|
2
|
+
export declare const useCollapseHandler: (isExpanded: boolean, expandedPanelId: string | null, id: string, panelRef: PanelRef, setExtendedStyle: (style: React.CSSProperties) => void, setExtendedContainerStyle: (style: React.CSSProperties) => void, setIsExpanded: (expanded: boolean) => void) => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
interface UseExpandableOptions {
|
|
3
|
+
initialExpanded?: boolean;
|
|
4
|
+
onExpand?: () => void;
|
|
5
|
+
onCollapse?: () => void;
|
|
6
|
+
}
|
|
7
|
+
interface UseExpandableReturn {
|
|
8
|
+
isExpanded: boolean;
|
|
9
|
+
toggle: () => void;
|
|
10
|
+
expand: () => void;
|
|
11
|
+
collapse: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Hook for managing expandable panel state
|
|
15
|
+
*/
|
|
16
|
+
export declare const useExpandable: ({ initialExpanded, onExpand, onCollapse, }?: UseExpandableOptions) => UseExpandableReturn;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PanelRef } from '../../types';
|
|
2
|
+
export declare const useExpansionAnimation: (readyForExpansion: boolean, panelRef: PanelRef, parentRef: PanelRef, setExtendedStyle: (style: React.CSSProperties) => void, setExtendedContainerStyle: (style: React.CSSProperties) => void, setIsExpanded: (expanded: boolean) => void, setReadyForExpansion: (ready: boolean) => void) => {
|
|
3
|
+
animateExpansion: boolean;
|
|
4
|
+
setAnimateExpansion: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
5
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Position, PanelRef } from '../../types';
|
|
2
|
+
export declare const useInitialSetup: (expandedPanelId: string | null, id: string, panelRef: PanelRef, setExtendedStyle: (style: React.CSSProperties) => void) => {
|
|
3
|
+
readyForExpansion: boolean;
|
|
4
|
+
setReadyForExpansion: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
5
|
+
initialPosition: Position;
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useResizeHandler: (isExpanded: boolean) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** @format */
|
|
2
|
+
interface ExpandablePanelState {
|
|
3
|
+
expandedPanelId: string | null;
|
|
4
|
+
setExpandedPanelId: (id: string | null) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useExpandablePanelStore: import('zustand').UseBoundStore<import('zustand').StoreApi<ExpandablePanelState>>;
|
|
7
|
+
export {};
|