@luminix/mui-cms 0.0.1-beta.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/.eslintrc.cjs +18 -0
- package/README.md +30 -0
- package/bundle/mui-cms.bundle.iife.js +196 -0
- package/bundle/style.css +1 -0
- package/bundle/vite.svg +1 -0
- package/dist/mui-cms.js +3163 -0
- package/dist/vite.svg +1 -0
- package/package.json +46 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +11 -0
- package/types/components/Breadcrumbs.d.ts +3 -0
- package/types/components/DesktopPageTitle.d.ts +2 -0
- package/types/components/Layout/AppBar/MenuButton.d.ts +3 -0
- package/types/components/Layout/AppBar.d.ts +4 -0
- package/types/components/Layout/BackButton.d.ts +4 -0
- package/types/components/Layout/Drawer.d.ts +4 -0
- package/types/components/Layout/SearchBar.d.ts +4 -0
- package/types/components/Link.d.ts +7 -0
- package/types/components/LuminixCms.d.ts +4 -0
- package/types/components/ModelIndex/Filter/Content.d.ts +3 -0
- package/types/components/ModelIndex/Filter/Row.d.ts +4 -0
- package/types/components/ModelIndex/Filter/ValueInput/AsyncAutocomplete.d.ts +3 -0
- package/types/components/ModelIndex/Filter/ValueInput/DatePicker.d.ts +4 -0
- package/types/components/ModelIndex/Filter/ValueInput/Switch.d.ts +3 -0
- package/types/components/ModelIndex/Filter/ValueInput/TextField.d.ts +4 -0
- package/types/components/ModelIndex/Filter/ValueInput.d.ts +3 -0
- package/types/components/ModelIndex/Filter/useRow.d.ts +19 -0
- package/types/components/ModelIndex/Filter.d.ts +3 -0
- package/types/components/ModelIndex/InstanceActions.d.ts +5 -0
- package/types/components/ModelIndex/MassActions.d.ts +4 -0
- package/types/components/ModelIndex/Pagination.d.ts +4 -0
- package/types/components/ModelIndex/PaginationDetails.d.ts +3 -0
- package/types/components/ModelIndex/PerPageSwitch.d.ts +3 -0
- package/types/components/ModelIndex/Sort.d.ts +3 -0
- package/types/components/ModelIndex/StaticActions.d.ts +4 -0
- package/types/components/ModelIndex/Table/ShrinkedCell.d.ts +4 -0
- package/types/components/ModelIndex/Table/TableBody/Skeleton.d.ts +3 -0
- package/types/components/ModelIndex/Table/TableBody/TableRow.d.ts +4 -0
- package/types/components/ModelIndex/Table/TableBody.d.ts +4 -0
- package/types/components/ModelIndex/Table/TableFooter.d.ts +4 -0
- package/types/components/ModelIndex/Table/TableHead.d.ts +4 -0
- package/types/components/ModelIndex/Table/TableToolbar.d.ts +3 -0
- package/types/components/ModelIndex/Table.d.ts +4 -0
- package/types/components/ModelIndex/Tabs.d.ts +3 -0
- package/types/components/RecursiveList.d.ts +4 -0
- package/types/components/RecursiveMenu.d.ts +4 -0
- package/types/contexts/DialogContext.d.ts +4 -0
- package/types/contexts/LayoutContext.d.ts +4 -0
- package/types/contexts/ModelContext.d.ts +4 -0
- package/types/contexts/ModelFilterContext.d.ts +4 -0
- package/types/contexts/ModelFilterRowContext.d.ts +4 -0
- package/types/contexts/NotificationContext.d.ts +4 -0
- package/types/contexts/TableContext.d.ts +4 -0
- package/types/dist.d.ts +3 -0
- package/types/facades/Cms.d.ts +31 -0
- package/types/facades/Filter.d.ts +24 -0
- package/types/hooks/useActionEvent.d.ts +2 -0
- package/types/hooks/useBackButton.d.ts +6 -0
- package/types/hooks/useCurrentModel.d.ts +1 -0
- package/types/hooks/useDialog.d.ts +1 -0
- package/types/hooks/useDisplaceNotifications.d.ts +1 -0
- package/types/hooks/useHandleError.d.ts +1 -0
- package/types/hooks/useHasBackButton.d.ts +6 -0
- package/types/hooks/useHasSearch.d.ts +7 -0
- package/types/hooks/useIsDesktopMode.d.ts +7 -0
- package/types/hooks/useKeyChord.d.ts +1 -0
- package/types/hooks/useKeyPress.d.ts +1 -0
- package/types/hooks/useLayoutConfig.d.ts +8 -0
- package/types/hooks/useMenu.d.ts +12 -0
- package/types/hooks/useNotifications.d.ts +1 -0
- package/types/hooks/useNotify.d.ts +1 -0
- package/types/hooks/useOptimistic.d.ts +32 -0
- package/types/hooks/usePageTitle.d.ts +7 -0
- package/types/hooks/useSearch.d.ts +6 -0
- package/types/hooks/useSelection.d.ts +10 -0
- package/types/hooks/useSetPageTitle.d.ts +8 -0
- package/types/hooks/useTable.d.ts +1 -0
- package/types/index.d.ts +2 -0
- package/types/main.d.ts +0 -0
- package/types/plugins/CmsPlugin.d.ts +18 -0
- package/types/plugins/i18NextPlugin.d.ts +19 -0
- package/types/providers/DialogProvider.d.ts +4 -0
- package/types/providers/LayoutProvider.d.ts +5 -0
- package/types/providers/ModelProvider.d.ts +3 -0
- package/types/providers/NotificationProvider.d.ts +4 -0
- package/types/providers/TableProvider.d.ts +4 -0
- package/types/routes.d.ts +3 -0
- package/types/support/ModelIndex/Filter/inputs.d.ts +4 -0
- package/types/support/ModelIndex/Filter/searchParams.d.ts +18 -0
- package/types/support/ModelIndex/relation.d.ts +4 -0
- package/types/support/array.d.ts +9 -0
- package/types/support/date.d.ts +1 -0
- package/types/support/error.d.ts +2 -0
- package/types/support/handlers.d.ts +9 -0
- package/types/support/misc.d.ts +16 -0
- package/types/support/searchParams.d.ts +1 -0
- package/types/types/Config.d.ts +13 -0
- package/types/types/Contexts.d.ts +72 -0
- package/types/types/Dialog.d.ts +9 -0
- package/types/types/Filter.d.ts +20 -0
- package/types/types/Menu.d.ts +11 -0
- package/types/types/Notifications.d.ts +13 -0
- package/types/types/Plugin.d.ts +8 -0
- package/types/types/PropTypes.d.ts +100 -0
- package/types/types/Reducers.d.ts +4 -0
- package/types/types/Table.d.ts +41 -0
- package/types/types/Tabs.d.ts +4 -0
- package/types/views/Dashboard.d.ts +3 -0
- package/types/views/Error.d.ts +4 -0
- package/types/views/Layout/Layout.d.ts +4 -0
- package/types/views/ModelIndex.d.ts +3 -0
- package/types/views/ModelItem.d.ts +4 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Plugin } from '@luminix/core';
|
|
2
|
+
import { AppFacade, AppFacades } from '@luminix/core/dist/types/App';
|
|
3
|
+
import { InitOptions } from 'i18next';
|
|
4
|
+
declare class i18NextPlugin extends Plugin {
|
|
5
|
+
private options;
|
|
6
|
+
name: string;
|
|
7
|
+
constructor(options: InitOptions);
|
|
8
|
+
register(app: AppFacade): void;
|
|
9
|
+
boot({ cms, model, forms }: AppFacades): void;
|
|
10
|
+
private initI18Next;
|
|
11
|
+
private translateModelNames;
|
|
12
|
+
private translateModelColumns;
|
|
13
|
+
private translateMenuEntries;
|
|
14
|
+
private translateMassActions;
|
|
15
|
+
private translateInstanceActions;
|
|
16
|
+
private translateStaticActions;
|
|
17
|
+
private translateFormLabels;
|
|
18
|
+
}
|
|
19
|
+
export default i18NextPlugin;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Model } from '@luminix/core';
|
|
2
|
+
export declare const changeValueFromArray: (input: any) => any;
|
|
3
|
+
export declare const changeValueToArray: (input: any) => any;
|
|
4
|
+
export declare const mountRelationModelOption: (ModelClass: typeof Model, key: string, input: string[] | number[]) => Promise<Model[]>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FilterColumn, FilteredColumn } from '../../../types/Filter';
|
|
2
|
+
/**
|
|
3
|
+
* Translates the received parameters object from url 'searchParams',
|
|
4
|
+
* into an array of FilteredColumn objects.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} operation
|
|
7
|
+
* @param {any} value
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare const translateColumnsFromQuery: (columns: FilterColumn[], searchParams: any) => FilteredColumn[];
|
|
11
|
+
/**
|
|
12
|
+
* Translates the selected columns to filter,
|
|
13
|
+
* into a url 'searchParams'.
|
|
14
|
+
*
|
|
15
|
+
* @param {FilterColumn[]} columns
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare const translateColumnsToQuery: (columns: FilteredColumn[]) => URLSearchParams;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Model } from '@luminix/core';
|
|
2
|
+
import { Collection } from '@luminix/core/dist/types/Collection';
|
|
3
|
+
export declare const loadRelationOptions: (ModelClass: typeof Model, key: string, loadedOptions: Model[]) => Promise<Collection<Model>>;
|
|
4
|
+
export declare const aggregateRelationOptions: (ModelClass: typeof Model, key: string, term: string | undefined, loadedOptions: Collection<Model>) => Promise<Collection<Model>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fromIsoString: (value: Date | string) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Model } from '@luminix/core';
|
|
2
|
+
import { ActionCallbackEvent, InstanceActionCallbackEvent, MassActionCallbackEvent } from '../types/Table';
|
|
3
|
+
type MassActionHandlers = Record<string, (ModelClass: typeof Model) => (e: MassActionCallbackEvent) => void>;
|
|
4
|
+
type InstanceActionHandlers = Record<string, (ModelClass: typeof Model) => (e: InstanceActionCallbackEvent) => void>;
|
|
5
|
+
type StaticActionHandlers = Record<string, (ModelClass: typeof Model) => (e: ActionCallbackEvent) => void>;
|
|
6
|
+
export declare const massActionHandlers: MassActionHandlers;
|
|
7
|
+
export declare const instanceActionHandlers: InstanceActionHandlers;
|
|
8
|
+
export declare const staticActionHandlers: StaticActionHandlers;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated - For demo purposes
|
|
3
|
+
*
|
|
4
|
+
* Sleep for given duration
|
|
5
|
+
*
|
|
6
|
+
* @param duration in milliseconds
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare const sleep: (duration: number) => Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* Check if value is set.
|
|
12
|
+
*
|
|
13
|
+
* @param value
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
export declare const isSet: (value: unknown) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const searchParamsToObject: (searchParams: URLSearchParams) => Record<string, any>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { SetURLSearchParams } from 'react-router-dom';
|
|
3
|
+
import { Model } from '@luminix/core';
|
|
4
|
+
import { Collection } from '@luminix/core/dist/types/Collection';
|
|
5
|
+
import { CmsConfig } from './Config';
|
|
6
|
+
import { Column, MassAction } from './Table';
|
|
7
|
+
import { Notification, NotifyFunction } from './Notifications';
|
|
8
|
+
import { DialogFunction, DialogMessage } from './Dialog';
|
|
9
|
+
import { FilteredColumn } from './Filter';
|
|
10
|
+
export type LayoutContextValue = {
|
|
11
|
+
open: boolean;
|
|
12
|
+
setOpen: Dispatch<SetStateAction<boolean>>;
|
|
13
|
+
layout: CmsConfig['layout'];
|
|
14
|
+
isBreakpointUp: boolean;
|
|
15
|
+
currentPage: string;
|
|
16
|
+
setCurrentPage: Dispatch<SetStateAction<string>>;
|
|
17
|
+
showSearch: boolean;
|
|
18
|
+
setShowSearch: Dispatch<SetStateAction<boolean>>;
|
|
19
|
+
showBackButton: boolean;
|
|
20
|
+
setShowBackButton: Dispatch<SetStateAction<boolean>>;
|
|
21
|
+
};
|
|
22
|
+
export type TableContextValue = {
|
|
23
|
+
columns: Column[];
|
|
24
|
+
columnCount: number;
|
|
25
|
+
massActions: MassAction[];
|
|
26
|
+
items?: Collection<Model>;
|
|
27
|
+
loading?: boolean;
|
|
28
|
+
error: Error | null;
|
|
29
|
+
Model: typeof Model;
|
|
30
|
+
selected: Collection<Model>;
|
|
31
|
+
};
|
|
32
|
+
export type ModelContextValue = {
|
|
33
|
+
Model: typeof Model;
|
|
34
|
+
};
|
|
35
|
+
export type ModelFilterContextValue = {
|
|
36
|
+
Model: typeof Model;
|
|
37
|
+
anchorEl: any;
|
|
38
|
+
setAnchorEl: React.Dispatch<React.SetStateAction<any>>;
|
|
39
|
+
columnsFilter: FilteredColumn[];
|
|
40
|
+
setColumnsFilter: React.Dispatch<React.SetStateAction<FilteredColumn[]>>;
|
|
41
|
+
searchParams: URLSearchParams;
|
|
42
|
+
setSearchParams: SetURLSearchParams;
|
|
43
|
+
clearSearchParams: () => void;
|
|
44
|
+
clearFilters: () => void;
|
|
45
|
+
};
|
|
46
|
+
export type ModelFilterRowContextValue = {
|
|
47
|
+
key: string;
|
|
48
|
+
type: string;
|
|
49
|
+
operator: string;
|
|
50
|
+
value: any;
|
|
51
|
+
isRelation: boolean;
|
|
52
|
+
setKey: React.Dispatch<React.SetStateAction<string>>;
|
|
53
|
+
setType: React.Dispatch<React.SetStateAction<string>>;
|
|
54
|
+
setOperator: React.Dispatch<React.SetStateAction<string>>;
|
|
55
|
+
setValue: React.Dispatch<React.SetStateAction<any>>;
|
|
56
|
+
setIsRelation: React.Dispatch<React.SetStateAction<boolean>>;
|
|
57
|
+
};
|
|
58
|
+
export type NotificationContextValue = {
|
|
59
|
+
isOpen: boolean;
|
|
60
|
+
notify: NotifyFunction;
|
|
61
|
+
dismissNotification: () => void;
|
|
62
|
+
notifications: Notification[];
|
|
63
|
+
current?: Notification;
|
|
64
|
+
displacement: string;
|
|
65
|
+
setDisplacement: React.Dispatch<React.SetStateAction<string>>;
|
|
66
|
+
};
|
|
67
|
+
export type DialogContextValue = {
|
|
68
|
+
isOpen: boolean;
|
|
69
|
+
dialog: DialogFunction;
|
|
70
|
+
dismissDialog: () => void;
|
|
71
|
+
current?: DialogMessage;
|
|
72
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type DialogMessage = {
|
|
2
|
+
title?: React.ReactNode;
|
|
3
|
+
message: React.ReactNode;
|
|
4
|
+
type?: 'alert' | 'confirm';
|
|
5
|
+
dismissable?: boolean;
|
|
6
|
+
confirmText?: string;
|
|
7
|
+
cancelText?: string;
|
|
8
|
+
};
|
|
9
|
+
export type DialogFunction = (message: string | DialogMessage) => Promise<boolean>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type FilterColumn = {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
type: string;
|
|
5
|
+
is_relation: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type FilteredColumn = {
|
|
8
|
+
key: string;
|
|
9
|
+
operator: string;
|
|
10
|
+
type: string;
|
|
11
|
+
value: any;
|
|
12
|
+
is_relation: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type FilterRow = {
|
|
15
|
+
index: number;
|
|
16
|
+
column: FilteredColumn;
|
|
17
|
+
};
|
|
18
|
+
export type FilterValueInput = {
|
|
19
|
+
index?: number;
|
|
20
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type MenuItem = {
|
|
3
|
+
key: string | number;
|
|
4
|
+
text: string;
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
component?: React.ComponentType;
|
|
7
|
+
to?: string;
|
|
8
|
+
onClick?: (e: React.MouseEvent) => void;
|
|
9
|
+
children?: MenuItem[];
|
|
10
|
+
element?: React.ReactNode;
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AlertProps } from '@mui/material';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export type NotificationAction = {
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
callback: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type Notification = {
|
|
8
|
+
message: React.ReactNode;
|
|
9
|
+
severity?: AlertProps['severity'];
|
|
10
|
+
actions?: NotificationAction[];
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export type NotifyFunction = (notification: string | Notification) => void;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { Model, Plugin } from '@luminix/core';
|
|
2
|
+
import { DrawerProps as MuiDrawerProps, AppBarProps as MuiAppBarProps, BoxProps, DrawerProps, MenuProps, TableProps as MuiTableProps, StackProps, TableHeadProps as MuiTableHeadProps, TableBodyProps as MuiTableBodyProps, TableRowProps as MuiTableRowProps, ThemeOptions, BreadcrumbsOwnProps, SnackbarProps, AlertProps } from '@mui/material';
|
|
3
|
+
import { ListTypeMap } from '@mui/material/List';
|
|
4
|
+
import { DefaultComponentProps } from '@mui/material/OverridableComponent';
|
|
5
|
+
import { MenuItem } from './Menu';
|
|
6
|
+
import { ModelPaginatedResponse } from '@luminix/core/dist/types/Model';
|
|
7
|
+
import { Collection, CollectionIteratorCallback } from '@luminix/core/dist/types/Collection';
|
|
8
|
+
import { Scope } from '@luminix/core/dist/types/Builder';
|
|
9
|
+
import { InitOptions } from 'i18next';
|
|
10
|
+
export type LuminixCmsProps = {
|
|
11
|
+
theme?: ThemeOptions;
|
|
12
|
+
plugins?: Plugin[];
|
|
13
|
+
i18nOptions?: InitOptions;
|
|
14
|
+
};
|
|
15
|
+
export type LayoutProps = BoxProps & {
|
|
16
|
+
slotProps?: {
|
|
17
|
+
AppBar?: AppBarProps;
|
|
18
|
+
Drawer?: DrawerProps;
|
|
19
|
+
main?: BoxProps;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type AppBarProps = {
|
|
23
|
+
slots?: {
|
|
24
|
+
start?: React.ReactNode | string;
|
|
25
|
+
end?: React.ReactNode | string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type StyledAppBarProps = MuiAppBarProps & {
|
|
29
|
+
open?: boolean;
|
|
30
|
+
drawerWidth?: number;
|
|
31
|
+
height?: number;
|
|
32
|
+
};
|
|
33
|
+
export type StyledDrawerProps = MuiDrawerProps & {
|
|
34
|
+
open?: boolean;
|
|
35
|
+
width: number;
|
|
36
|
+
};
|
|
37
|
+
export type SearchBarProps = {
|
|
38
|
+
throttle?: number;
|
|
39
|
+
};
|
|
40
|
+
export type ErrorProps = {
|
|
41
|
+
error?: Error;
|
|
42
|
+
};
|
|
43
|
+
export type RecursiveListProps = DefaultComponentProps<ListTypeMap> & {
|
|
44
|
+
collapsed?: boolean;
|
|
45
|
+
items: MenuItem[];
|
|
46
|
+
onClick?: (e: any) => void;
|
|
47
|
+
};
|
|
48
|
+
export type RecursiveMenuProps = MenuProps & {
|
|
49
|
+
collapsed?: boolean;
|
|
50
|
+
items: MenuItem[];
|
|
51
|
+
onClick?: (e: any) => void;
|
|
52
|
+
};
|
|
53
|
+
export type ModelProviderProps = {
|
|
54
|
+
Model: typeof Model;
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
};
|
|
57
|
+
export type TableProps = MuiTableProps & {
|
|
58
|
+
items?: Collection<Model>;
|
|
59
|
+
loading?: boolean;
|
|
60
|
+
error: Error | null;
|
|
61
|
+
};
|
|
62
|
+
export type TableHeadProps = MuiTableHeadProps & {
|
|
63
|
+
slots?: {
|
|
64
|
+
before?: React.ReactNode;
|
|
65
|
+
after?: React.ReactNode;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export type TableRowProps = MuiTableRowProps & {
|
|
69
|
+
item: Model;
|
|
70
|
+
};
|
|
71
|
+
export type TableBodyProps = MuiTableBodyProps & {
|
|
72
|
+
children: React.ReactNode | CollectionIteratorCallback<Model, React.ReactNode>;
|
|
73
|
+
};
|
|
74
|
+
export type PaginationProps = StackProps & {
|
|
75
|
+
variant?: 'default' | 'compact';
|
|
76
|
+
};
|
|
77
|
+
export type ModelItemProps = {
|
|
78
|
+
create?: boolean;
|
|
79
|
+
};
|
|
80
|
+
export type QueryProviderProps = {
|
|
81
|
+
Model: typeof Model;
|
|
82
|
+
scope?: Scope<Model, ModelPaginatedResponse>;
|
|
83
|
+
dependencies?: unknown[];
|
|
84
|
+
};
|
|
85
|
+
export type ActionsProps = {
|
|
86
|
+
variant?: 'default' | 'fab';
|
|
87
|
+
};
|
|
88
|
+
export type NotificationProviderProps = SnackbarProps & {
|
|
89
|
+
variant?: AlertProps['variant'];
|
|
90
|
+
};
|
|
91
|
+
export type BreadcrumbsProps = BreadcrumbsOwnProps & {
|
|
92
|
+
parts?: {
|
|
93
|
+
name: string;
|
|
94
|
+
href?: string;
|
|
95
|
+
}[];
|
|
96
|
+
};
|
|
97
|
+
export type InputOption = {
|
|
98
|
+
key: string;
|
|
99
|
+
label: string;
|
|
100
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Model } from '@luminix/core';
|
|
2
|
+
import { RouteObject } from 'react-router-dom';
|
|
3
|
+
export type ComponentMapReducer = (components: Record<string, React.FunctionComponent>) => Record<string, React.FunctionComponent>;
|
|
4
|
+
export type CmsRoutesReducer = (routes: RouteObject[], components: Record<string, React.FunctionComponent<any>>, models: Record<string, typeof Model>) => RouteObject[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Model } from '@luminix/core';
|
|
2
|
+
import { Collection } from '@luminix/core/dist/types/Collection';
|
|
3
|
+
import { TableCellProps } from '@mui/material';
|
|
4
|
+
import { NotifyFunction } from './Notifications';
|
|
5
|
+
import { DialogFunction } from './Dialog';
|
|
6
|
+
import { TFunction } from 'i18next';
|
|
7
|
+
export type StaticAction = {
|
|
8
|
+
key?: string;
|
|
9
|
+
label: string;
|
|
10
|
+
callback: (e: ActionCallbackEvent) => void;
|
|
11
|
+
icon?: React.ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export type InstanceAction = {
|
|
14
|
+
key?: string;
|
|
15
|
+
label: string;
|
|
16
|
+
callback: (e: InstanceActionCallbackEvent) => void;
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export type MassAction = {
|
|
20
|
+
label: string;
|
|
21
|
+
key: string;
|
|
22
|
+
callback: (e: MassActionCallbackEvent) => void;
|
|
23
|
+
};
|
|
24
|
+
export type ActionCallbackEvent = {
|
|
25
|
+
navigate: (path: string) => void;
|
|
26
|
+
refresh: () => void;
|
|
27
|
+
notify: NotifyFunction;
|
|
28
|
+
dialog: DialogFunction;
|
|
29
|
+
t: TFunction;
|
|
30
|
+
};
|
|
31
|
+
export type InstanceActionCallbackEvent = ActionCallbackEvent & {
|
|
32
|
+
item: Model;
|
|
33
|
+
};
|
|
34
|
+
export type MassActionCallbackEvent = ActionCallbackEvent & {
|
|
35
|
+
selected: Collection<Model>;
|
|
36
|
+
};
|
|
37
|
+
export type Column = TableCellProps & {
|
|
38
|
+
key: string;
|
|
39
|
+
label: string;
|
|
40
|
+
sortable?: boolean;
|
|
41
|
+
};
|