mgh-components 1.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/.prettierignore +9 -0
- package/.prettierrc +7 -0
- package/dist/components/CustomGridToolbarExport.d.ts +10 -0
- package/dist/components/CustomNoRowsOverlay.d.ts +9 -0
- package/dist/components/MGHDataGrid.d.ts +50 -0
- package/dist/components/MGHGridToolbar.d.ts +12 -0
- package/dist/hooks/useResponsive.d.ts +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +304 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +304 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -0
- package/rollup.config.js +37 -0
- package/src/components/CustomGridToolbarExport.tsx +41 -0
- package/src/components/CustomNoRowsOverlay.tsx +56 -0
- package/src/components/MGHDataGrid.tsx +170 -0
- package/src/components/MGHGridToolbar.tsx +44 -0
- package/src/hooks/useResponsive.ts +54 -0
- package/src/index.d.ts +4 -0
- package/src/index.ts +4 -0
- package/tsconfig.json +29 -0
package/.prettierignore
ADDED
package/.prettierrc
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GridCsvExportOptions, GridExportDisplayOptions, GridExcelExportOptions, GridPrintExportOptions } from '@mui/x-data-grid-premium';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
interface ExportContainerProps {
|
|
4
|
+
csvOptions?: GridCsvExportOptions & GridExportDisplayOptions;
|
|
5
|
+
excelOptions?: GridExcelExportOptions & GridExportDisplayOptions;
|
|
6
|
+
printOptions?: GridPrintExportOptions & GridExportDisplayOptions;
|
|
7
|
+
customMenuItem?: JSX.Element | undefined;
|
|
8
|
+
}
|
|
9
|
+
export default function CustomGridToolbarExport({ csvOptions, excelOptions, printOptions, customMenuItem, ...other }: ExportContainerProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NoRowsOverlayPropsOverrides } from '@mui/x-data-grid-premium';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
declare module '@mui/x-data-grid-premium' {
|
|
4
|
+
interface NoRowsOverlayPropsOverrides {
|
|
5
|
+
text: string;
|
|
6
|
+
useSettingsContext: any;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export default function CustomNoRowsOverlay({ text, useSettingsContext }: NoRowsOverlayPropsOverrides): React.JSX.Element;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { DateRange } from '@mui/x-date-pickers-pro';
|
|
3
|
+
import { Theme, SxProps } from '@mui/material';
|
|
4
|
+
import { GridInitialStatePremium } from '@mui/x-data-grid-premium/models/gridStatePremium';
|
|
5
|
+
import { GridColDef, GridRowParams, GridToolbarProps, GridEventListener, GridSlotsComponent, GridCallbackDetails, GridRowSelectionModel, ToolbarPropsOverrides, GridRowClassNameParams, GridSlotsComponentsProps, GridColumnVisibilityModel, GridInputRowSelectionModel } from '@mui/x-data-grid-premium';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
interface CustomToolbarProps {
|
|
8
|
+
dateValues: React.SetStateAction<DateRange<dayjs.Dayjs>>;
|
|
9
|
+
setDateValues: React.Dispatch<React.SetStateAction<DateRange<dayjs.Dayjs>>>;
|
|
10
|
+
renderDateRange?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
interface MGHDataGridProps {
|
|
13
|
+
rows: any[];
|
|
14
|
+
columns: GridColDef[];
|
|
15
|
+
onRowClick?: GridEventListener<'rowClick'>;
|
|
16
|
+
onRowDoubleClick?: GridEventListener<'rowDoubleClick'>;
|
|
17
|
+
header: string;
|
|
18
|
+
pagination?: boolean;
|
|
19
|
+
pageSize?: number;
|
|
20
|
+
pageSizeOptions?: number[];
|
|
21
|
+
slots?: Partial<GridSlotsComponent>;
|
|
22
|
+
slotProps?: GridSlotsComponentsProps & {
|
|
23
|
+
toolbar?: Partial<GridToolbarProps & ToolbarPropsOverrides & CustomToolbarProps>;
|
|
24
|
+
};
|
|
25
|
+
toolbarProps?: any;
|
|
26
|
+
initialState?: GridInitialStatePremium;
|
|
27
|
+
sx?: SxProps<Theme>;
|
|
28
|
+
cardSx?: SxProps<Theme>;
|
|
29
|
+
columnVisibilityModel?: GridColumnVisibilityModel;
|
|
30
|
+
disableDensitySelector?: boolean;
|
|
31
|
+
disableRowSelectionOnClick?: boolean;
|
|
32
|
+
disableColumnFilter?: boolean;
|
|
33
|
+
disableColumnMenu?: boolean;
|
|
34
|
+
disableColumnSelector?: boolean;
|
|
35
|
+
renderHeaderEndContent?: JSX.Element;
|
|
36
|
+
renderHeaderCenterContent?: JSX.Element;
|
|
37
|
+
noRowsText?: string;
|
|
38
|
+
checkboxSelection?: boolean;
|
|
39
|
+
checkboxSelectionVisibleOnly?: boolean;
|
|
40
|
+
onRowSelectionModelChange?: ((rowSelectionModel: GridRowSelectionModel, details: GridCallbackDetails<any>) => void) | undefined;
|
|
41
|
+
rowSelectionModel?: GridInputRowSelectionModel | undefined;
|
|
42
|
+
getRowClassName?: ((params: GridRowClassNameParams<any>) => string) | undefined;
|
|
43
|
+
getDetailPanelContent?: (params: GridRowParams<any>) => React.ReactNode;
|
|
44
|
+
getDetailPanelHeight?: () => number;
|
|
45
|
+
loading?: boolean;
|
|
46
|
+
defaultGroupingExpansionDepth?: number;
|
|
47
|
+
getRowHeight?: any;
|
|
48
|
+
}
|
|
49
|
+
export default function MGHDataGrid({ header, rows, columns, onRowClick, onRowDoubleClick, pagination, pageSize, slots, slotProps, toolbarProps, initialState, pageSizeOptions, sx, cardSx, columnVisibilityModel, disableDensitySelector, disableRowSelectionOnClick, disableColumnFilter, disableColumnMenu, disableColumnSelector, checkboxSelectionVisibleOnly, renderHeaderEndContent, renderHeaderCenterContent, noRowsText, checkboxSelection, onRowSelectionModelChange, rowSelectionModel, getRowClassName, getDetailPanelContent, getDetailPanelHeight, loading, defaultGroupingExpansionDepth, getRowHeight, }: MGHDataGridProps): React.JSX.Element;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface MGHGridToolbarProps {
|
|
3
|
+
showColumnsButton?: boolean;
|
|
4
|
+
showFilterButton?: boolean;
|
|
5
|
+
showExportButton?: boolean;
|
|
6
|
+
showQuickFilter?: boolean;
|
|
7
|
+
renderOtherButtons?: JSX.Element;
|
|
8
|
+
renderDateRange?: JSX.Element;
|
|
9
|
+
customMenuItem?: JSX.Element;
|
|
10
|
+
}
|
|
11
|
+
export default function MGHGridToolbar({ showColumnsButton, showFilterButton, showExportButton, showQuickFilter, renderOtherButtons, renderDateRange, customMenuItem, }: MGHGridToolbarProps): React.JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Breakpoint } from '@mui/material/styles';
|
|
2
|
+
type ReturnType = boolean;
|
|
3
|
+
export type Query = 'up' | 'down' | 'between' | 'only';
|
|
4
|
+
export type Value = Breakpoint | number;
|
|
5
|
+
export declare function useResponsive(query: Query, start?: Value, end?: Value): ReturnType;
|
|
6
|
+
export declare function useWidth(): "xs" | "sm" | "md" | "lg" | "xl";
|
|
7
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as MGHDataGrid } from './components/MGHDataGrid';
|
|
2
|
+
export { default as MGHGridToolbar } from './components/MGHGridToolbar';
|
|
3
|
+
export { default as CustomNoRowsOverlay } from './components/CustomNoRowsOverlay';
|
|
4
|
+
export { useResponsive } from './hooks/useResponsive';
|