mgh-components 1.0.14 → 1.1.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 +167 -53
- package/dist/components/CustomNoRowsOverlay/CustomNoRowsOverlay.types.d.ts +0 -0
- package/dist/components/Label/styles.d.ts +10 -6
- package/dist/components/MGHDataGrid/MGHDataGrid.d.ts +3 -2
- package/dist/components/MGHDataGrid/MGHDataGrid.types.d.ts +1 -1
- package/dist/components/MGHGrid/MGHGrid.d.ts +7 -0
- package/dist/components/MGHGrid/MGHGrid.styles.d.ts +10 -0
- package/dist/components/MGHGrid/MGHGrid.types.d.ts +708 -0
- package/dist/components/MGHGrid/components/ActionsCell.d.ts +22 -0
- package/dist/components/MGHGrid/components/ColumnMenu.d.ts +12 -0
- package/dist/components/MGHGrid/components/ColumnsPanel.d.ts +2 -0
- package/dist/components/MGHGrid/components/FilterPanel.d.ts +2 -0
- package/dist/components/MGHGrid/components/Footer.d.ts +3 -0
- package/dist/components/MGHGrid/components/Overlays.d.ts +5 -0
- package/dist/components/MGHGrid/components/Toolbar.d.ts +30 -0
- package/dist/components/MGHGrid/components/primitives.d.ts +81 -0
- package/dist/components/MGHGrid/context.d.ts +40 -0
- package/dist/components/MGHGrid/export.d.ts +18 -0
- package/dist/components/MGHGrid/grouping.d.ts +40 -0
- package/dist/components/MGHGrid/hooks.d.ts +23 -0
- package/dist/components/MGHGrid/icons.d.ts +32 -0
- package/dist/components/MGHGrid/index.d.ts +20 -0
- package/dist/components/MGHGrid/utils.d.ts +62 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MGHGridThemeMode } from '../MGHGrid.types';
|
|
3
|
+
export interface MGHGridActionsCellItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> {
|
|
4
|
+
icon?: React.ReactElement;
|
|
5
|
+
label: string;
|
|
6
|
+
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
7
|
+
/** Render the action inside the "more" menu instead of inline. */
|
|
8
|
+
showInMenu?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Drop-in replacement for MUI's GridActionsCellItem. Use it from `colDef.getActions`. */
|
|
12
|
+
export declare function MGHGridActionsCellItem({ icon, label, onClick, showInMenu, disabled, className, ...rest }: MGHGridActionsCellItemProps): React.JSX.Element;
|
|
13
|
+
export declare namespace MGHGridActionsCellItem {
|
|
14
|
+
var displayName: string;
|
|
15
|
+
}
|
|
16
|
+
interface ActionsCellProps {
|
|
17
|
+
actions: React.ReactElement[];
|
|
18
|
+
themeMode: MGHGridThemeMode;
|
|
19
|
+
moreLabel: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function ActionsCell({ actions, themeMode, moreLabel }: ActionsCellProps): React.JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MGHGridColDef, MGHGridThemeMode } from '../MGHGrid.types';
|
|
3
|
+
export interface MGHGridColumnMenuProps {
|
|
4
|
+
column: MGHGridColDef;
|
|
5
|
+
anchorEl: HTMLElement | null;
|
|
6
|
+
open: boolean;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
themeMode: MGHGridThemeMode;
|
|
9
|
+
/** Anchor for panels opened from the menu (usually the toolbar button or the header cell). */
|
|
10
|
+
panelAnchorEl?: HTMLElement | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function MGHGridColumnMenu({ column, anchorEl, open, onClose, themeMode, panelAnchorEl }: MGHGridColumnMenuProps): React.JSX.Element;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MGHGridLoadingOverlayProps, MGHGridNoRowsOverlayProps } from '../MGHGrid.types';
|
|
3
|
+
/** Default "no rows" overlay. Mirrors the legacy CustomNoRowsOverlay but has no MUI dependency. */
|
|
4
|
+
export declare function MGHGridNoRowsOverlay({ text, imageSrc }: MGHGridNoRowsOverlayProps): React.JSX.Element;
|
|
5
|
+
export declare function MGHGridLoadingOverlay({ text }: MGHGridLoadingOverlayProps): React.JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MGHGridCsvExportOptions, MGHGridExcelExportOptions, MGHGridPrintExportOptions, MGHGridToolbarProps } from '../MGHGrid.types';
|
|
3
|
+
import { MenuItemProps } from './primitives';
|
|
4
|
+
export declare function MGHGridColumnsButton(): React.JSX.Element;
|
|
5
|
+
export declare function MGHGridFiltersButton(): React.JSX.Element;
|
|
6
|
+
export declare function MGHGridDensitySelector(): React.JSX.Element;
|
|
7
|
+
export interface MGHGridExportMenuItemProps extends MenuItemProps {
|
|
8
|
+
/** Injected by MGHGridExportMenu; call it to close the menu after your action. */
|
|
9
|
+
hideMenu?: () => void;
|
|
10
|
+
}
|
|
11
|
+
/** Menu item for custom export actions. Drop-in for MUI's GridExportMenuItemProps pattern. */
|
|
12
|
+
export declare const MGHGridExportMenuItem: React.ForwardRefExoticComponent<MGHGridExportMenuItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
13
|
+
export interface MGHGridExportMenuProps {
|
|
14
|
+
csvOptions?: MGHGridCsvExportOptions;
|
|
15
|
+
excelOptions?: MGHGridExcelExportOptions;
|
|
16
|
+
printOptions?: MGHGridPrintExportOptions;
|
|
17
|
+
showCsvOption?: boolean;
|
|
18
|
+
showExcelOption?: boolean;
|
|
19
|
+
showPrintOption?: boolean;
|
|
20
|
+
customMenuItem?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export declare function MGHGridExportMenu({ csvOptions, excelOptions, printOptions, showCsvOption, showExcelOption, showPrintOption, customMenuItem, }: MGHGridExportMenuProps): React.JSX.Element;
|
|
23
|
+
export interface MGHGridQuickFilterProps {
|
|
24
|
+
placeholder?: string;
|
|
25
|
+
debounceMs?: number;
|
|
26
|
+
/** Always show the expanded input. */
|
|
27
|
+
alwaysExpanded?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare function MGHGridQuickFilter({ placeholder, debounceMs, alwaysExpanded }: MGHGridQuickFilterProps): React.JSX.Element;
|
|
30
|
+
export declare function MGHGridToolbar({ showColumnsButton, showFilterButton, showExportButton, showQuickFilter, showDensitySelector, showCsvOption, showExcelOption, showPrintOption, csvOptions, excelOptions, printOptions, renderOtherButtons, renderDateRange, customMenuItem, quickFilterPlaceholder, quickFilterDebounceMs, }: MGHGridToolbarProps): React.JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MGHGridThemeMode } from '../MGHGrid.types';
|
|
3
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
variant?: 'text' | 'primary' | 'contained';
|
|
5
|
+
size?: 'small' | 'medium';
|
|
6
|
+
startIcon?: React.ReactNode;
|
|
7
|
+
endIcon?: React.ReactNode;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
11
|
+
export interface IconButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
12
|
+
size?: 'small' | 'medium';
|
|
13
|
+
active?: boolean;
|
|
14
|
+
/** Tooltip (native title) and aria-label. */
|
|
15
|
+
label?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
export interface BadgeProps {
|
|
19
|
+
count?: number;
|
|
20
|
+
variant?: 'dot' | 'count';
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export declare const Badge: ({ count, variant, children }: BadgeProps) => React.JSX.Element;
|
|
24
|
+
export interface TextInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
25
|
+
size?: 'small' | 'medium';
|
|
26
|
+
}
|
|
27
|
+
export declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
28
|
+
export interface SelectProps extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
29
|
+
size?: 'small' | 'medium';
|
|
30
|
+
}
|
|
31
|
+
export declare const Select: React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLSelectElement>>;
|
|
32
|
+
export interface FieldProps {
|
|
33
|
+
label?: React.ReactNode;
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
className?: string;
|
|
36
|
+
htmlFor?: string;
|
|
37
|
+
}
|
|
38
|
+
export declare const Field: ({ label, children, className, htmlFor }: FieldProps) => React.JSX.Element;
|
|
39
|
+
export interface CheckboxProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
40
|
+
indeterminate?: boolean;
|
|
41
|
+
label?: string;
|
|
42
|
+
}
|
|
43
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLInputElement>>;
|
|
44
|
+
export declare const Spinner: ({ className }: {
|
|
45
|
+
className?: string;
|
|
46
|
+
}) => React.JSX.Element;
|
|
47
|
+
export type PopoverPlacement = 'bottom-start' | 'bottom-end' | 'bottom' | 'right-start';
|
|
48
|
+
export interface PopoverProps {
|
|
49
|
+
open: boolean;
|
|
50
|
+
anchorEl: HTMLElement | null | undefined;
|
|
51
|
+
onClose: (reason: 'backdrop' | 'escape') => void;
|
|
52
|
+
children: React.ReactNode;
|
|
53
|
+
placement?: PopoverPlacement;
|
|
54
|
+
themeMode?: MGHGridThemeMode;
|
|
55
|
+
className?: string;
|
|
56
|
+
style?: React.CSSProperties;
|
|
57
|
+
offset?: number;
|
|
58
|
+
role?: string;
|
|
59
|
+
autoFocus?: boolean;
|
|
60
|
+
/** Additional elements considered "inside" for outside-click detection. */
|
|
61
|
+
ignoreOutsideClickOn?: Array<React.RefObject<HTMLElement | null>>;
|
|
62
|
+
}
|
|
63
|
+
export declare function Popover({ open, anchorEl, onClose, children, placement, themeMode, className, style, offset, role, autoFocus, ignoreOutsideClickOn, }: PopoverProps): React.ReactPortal | null;
|
|
64
|
+
export interface MenuProps extends React.HTMLAttributes<HTMLUListElement> {
|
|
65
|
+
children: React.ReactNode;
|
|
66
|
+
}
|
|
67
|
+
export declare const Menu: ({ children, className, onKeyDown, ...rest }: MenuProps) => React.JSX.Element;
|
|
68
|
+
export interface MenuItemProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
|
|
69
|
+
icon?: React.ReactNode;
|
|
70
|
+
selected?: boolean;
|
|
71
|
+
/** Injected by menus that should close after the click. */
|
|
72
|
+
hideMenu?: () => void;
|
|
73
|
+
}
|
|
74
|
+
export declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
75
|
+
export declare const MenuDivider: () => React.JSX.Element;
|
|
76
|
+
export declare const MenuHeader: ({ children }: {
|
|
77
|
+
children: React.ReactNode;
|
|
78
|
+
}) => React.JSX.Element;
|
|
79
|
+
export declare const MenuSection: ({ children }: {
|
|
80
|
+
children: React.ReactNode;
|
|
81
|
+
}) => React.JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MGHGridAggregationFunction, MGHGridApi, MGHGridColDef, MGHGridLocaleText, MGHGridState, MGHGridThemeMode, MGHGridValidRowModel } from './MGHGrid.types';
|
|
3
|
+
export interface MGHGridRootProps {
|
|
4
|
+
header?: React.ReactNode;
|
|
5
|
+
pagination: boolean;
|
|
6
|
+
pageSizeOptions: number[];
|
|
7
|
+
hideFooterPagination: boolean;
|
|
8
|
+
hideFooterRowCount: boolean;
|
|
9
|
+
hideFooterSelectedRowCount: boolean;
|
|
10
|
+
disableColumnFilter: boolean;
|
|
11
|
+
disableColumnSelector: boolean;
|
|
12
|
+
disableDensitySelector: boolean;
|
|
13
|
+
disableColumnPinning: boolean;
|
|
14
|
+
disableColumnSorting: boolean;
|
|
15
|
+
disableMultipleColumnsSorting: boolean;
|
|
16
|
+
disableMultipleColumnsFiltering: boolean;
|
|
17
|
+
disableRowGrouping: boolean;
|
|
18
|
+
disableAggregation: boolean;
|
|
19
|
+
checkboxSelection: boolean;
|
|
20
|
+
aggregationFunctions: Record<string, MGHGridAggregationFunction>;
|
|
21
|
+
quickFilterDebounceMs: number;
|
|
22
|
+
}
|
|
23
|
+
export interface MGHGridContextValue {
|
|
24
|
+
api: MGHGridApi;
|
|
25
|
+
state: MGHGridState;
|
|
26
|
+
localeText: MGHGridLocaleText;
|
|
27
|
+
themeMode: MGHGridThemeMode;
|
|
28
|
+
rootProps: MGHGridRootProps;
|
|
29
|
+
/** All user columns (ordered, including hidden). */
|
|
30
|
+
columns: MGHGridColDef[];
|
|
31
|
+
/** Visible user columns. */
|
|
32
|
+
visibleColumns: MGHGridColDef[];
|
|
33
|
+
}
|
|
34
|
+
export declare const MGHGridContext: React.Context<MGHGridContextValue | null>;
|
|
35
|
+
export declare const useMGHGridContext: () => MGHGridContextValue;
|
|
36
|
+
/** Access the grid API from custom toolbars, menu items, cells, etc. */
|
|
37
|
+
export declare const useMGHGridApiContext: <R extends MGHGridValidRowModel = any>() => MGHGridApi<R>;
|
|
38
|
+
export declare const useMGHGridLocaleText: () => MGHGridLocaleText;
|
|
39
|
+
/** Creates a ref to hold the grid API; pass it to `<MGHGrid apiRef={apiRef} />`. */
|
|
40
|
+
export declare const useMGHGridApiRef: <R extends MGHGridValidRowModel = any>() => React.MutableRefObject<MGHGridApi<R> | null>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { MGHGridApi, MGHGridColDef, MGHGridCsvExportOptions, MGHGridExcelExportOptions, MGHGridExportOptions, MGHGridPrintExportOptions } from './MGHGrid.types';
|
|
2
|
+
export interface ExportCell {
|
|
3
|
+
raw: any;
|
|
4
|
+
formatted: string;
|
|
5
|
+
col: MGHGridColDef;
|
|
6
|
+
}
|
|
7
|
+
export interface ExportTable {
|
|
8
|
+
columns: MGHGridColDef[];
|
|
9
|
+
headers: string[];
|
|
10
|
+
rows: ExportCell[][];
|
|
11
|
+
}
|
|
12
|
+
export declare const resolveExportColumns: (api: MGHGridApi, options: MGHGridExportOptions) => MGHGridColDef[];
|
|
13
|
+
export declare const buildExportTable: (api: MGHGridApi, options: MGHGridExportOptions) => ExportTable;
|
|
14
|
+
export declare const getDataAsCsv: (api: MGHGridApi, options?: MGHGridCsvExportOptions) => string;
|
|
15
|
+
export declare const exportDataAsCsv: (api: MGHGridApi, options?: MGHGridCsvExportOptions) => void;
|
|
16
|
+
export declare const buildXlsx: (api: MGHGridApi, options?: MGHGridExcelExportOptions) => Uint8Array;
|
|
17
|
+
export declare const exportDataAsExcel: (api: MGHGridApi, options?: MGHGridExcelExportOptions) => Promise<void>;
|
|
18
|
+
export declare const exportDataAsPrint: (api: MGHGridApi, options?: MGHGridPrintExportOptions) => void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { MGHGridAggregationFunction, MGHGridAggregationModel, MGHGridApi, MGHGridColDef, MGHGridGroupNode, MGHGridLeafNode, MGHGridRowId, MGHGridValidRowModel } from './MGHGrid.types';
|
|
2
|
+
export interface RowEntry<R extends MGHGridValidRowModel = any> {
|
|
3
|
+
id: MGHGridRowId;
|
|
4
|
+
row: R;
|
|
5
|
+
}
|
|
6
|
+
/** Internal tree node used while grouping. */
|
|
7
|
+
export interface GroupTreeNode<R extends MGHGridValidRowModel = any> {
|
|
8
|
+
id: MGHGridRowId;
|
|
9
|
+
depth: number;
|
|
10
|
+
parent: MGHGridRowId | null;
|
|
11
|
+
groupingField: string;
|
|
12
|
+
groupingKey: any;
|
|
13
|
+
groupingLabel: string;
|
|
14
|
+
childGroups: GroupTreeNode<R>[];
|
|
15
|
+
/** Direct leaf children (only populated at the deepest level). */
|
|
16
|
+
leaves: RowEntry<R>[];
|
|
17
|
+
/** Every descendant leaf, in display order after sorting. */
|
|
18
|
+
descendants: RowEntry<R>[];
|
|
19
|
+
}
|
|
20
|
+
export interface DisplayRow<R extends MGHGridValidRowModel = any> {
|
|
21
|
+
id: MGHGridRowId;
|
|
22
|
+
type: 'leaf' | 'group';
|
|
23
|
+
row: R | null;
|
|
24
|
+
node: MGHGridLeafNode | MGHGridGroupNode;
|
|
25
|
+
depth: number;
|
|
26
|
+
group?: GroupTreeNode<R>;
|
|
27
|
+
}
|
|
28
|
+
export declare const GROUP_ID_PREFIX = "auto-generated-row-";
|
|
29
|
+
export declare const buildGroupTree: <R extends MGHGridValidRowModel>(entries: RowEntry<R>[], groupingFields: string[], columnsByField: Map<string, MGHGridColDef<R>>, api: MGHGridApi<R>, emptyLabel?: string) => GroupTreeNode<R>[];
|
|
30
|
+
export type GroupComparator<R extends MGHGridValidRowModel = any> = (a: GroupTreeNode<R>, b: GroupTreeNode<R>) => number;
|
|
31
|
+
/** Sorts groups (with the given comparator) and leaves (with the given sorter), recursively. */
|
|
32
|
+
export declare const sortGroupTree: <R extends MGHGridValidRowModel>(roots: GroupTreeNode<R>[], compareGroups: ((depth: number) => GroupComparator<R> | null) | null, sortLeaves: (leaves: RowEntry<R>[]) => RowEntry<R>[]) => GroupTreeNode<R>[];
|
|
33
|
+
export declare const collectTreeLeaves: <R extends MGHGridValidRowModel>(roots: GroupTreeNode<R>[]) => RowEntry<R>[];
|
|
34
|
+
export declare const toGroupNode: <R extends MGHGridValidRowModel>(node: GroupTreeNode<R>, isExpanded: boolean) => MGHGridGroupNode;
|
|
35
|
+
/** Flattens the tree into display rows, honouring expansion state. Also fills `nodesById` with every node. */
|
|
36
|
+
export declare const flattenGroupTree: <R extends MGHGridValidRowModel>(roots: GroupTreeNode<R>[], isExpanded: (node: GroupTreeNode<R>) => boolean, nodesById: Map<MGHGridRowId, MGHGridLeafNode | MGHGridGroupNode>, groupsById: Map<MGHGridRowId, GroupTreeNode<R>>) => DisplayRow<R>[];
|
|
37
|
+
export declare const aggregateRows: <R extends MGHGridValidRowModel>(rows: R[], aggregationModel: MGHGridAggregationModel, columnsByField: Map<string, MGHGridColDef<R>>, functions: Record<string, MGHGridAggregationFunction>, api: MGHGridApi<R>) => Record<string, {
|
|
38
|
+
value: any;
|
|
39
|
+
fn: string;
|
|
40
|
+
}>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** Keeps a ref always pointing at the latest value (assigned during render). */
|
|
3
|
+
export declare function useLatestRef<T>(value: T): React.RefObject<T>;
|
|
4
|
+
/** Returns a stable function that always calls the latest `fn`. */
|
|
5
|
+
export declare function useEventCallback<T extends (...args: any[]) => any>(fn: T): T;
|
|
6
|
+
/**
|
|
7
|
+
* Controlled / uncontrolled state helper. When `controlled` is defined the internal state is
|
|
8
|
+
* ignored and every change is reported through `onChange` only.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useControlledState<T>(controlled: T | undefined, defaultValue: T, onChange?: (value: T) => void): [T, (next: T | ((prev: T) => T)) => void];
|
|
11
|
+
export interface ElementSize {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
/** Observes the client size of an element. */
|
|
16
|
+
export declare function useElementSize<T extends HTMLElement>(ref: React.RefObject<T | null>, enabled?: boolean): ElementSize;
|
|
17
|
+
/** `window.matchMedia` as a hook. Always false on the server. */
|
|
18
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
19
|
+
/** Debounced version of a callback. The returned function is stable. */
|
|
20
|
+
export declare function useDebouncedCallback<T extends (...args: any[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
|
|
21
|
+
export declare function useForceUpdate(): () => void;
|
|
22
|
+
/** Stable unique id per component instance (React.useId fallback for older Reacts). */
|
|
23
|
+
export declare function useStableId(prefix: string): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface MGHGridIconProps extends React.SVGProps<SVGSVGElement> {
|
|
3
|
+
size?: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const ViewColumnIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
6
|
+
export declare const FilterListIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
7
|
+
export declare const SearchIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
8
|
+
export declare const CloseIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
9
|
+
export declare const DownloadIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
10
|
+
export declare const ArrowUpwardIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
11
|
+
export declare const ArrowDownwardIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
12
|
+
export declare const MoreVertIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
13
|
+
export declare const CheckIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
14
|
+
export declare const ExpandMoreIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
15
|
+
export declare const ChevronRightIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
16
|
+
export declare const ChevronLeftIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
17
|
+
export declare const FirstPageIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
18
|
+
export declare const LastPageIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
19
|
+
export declare const PushPinIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
20
|
+
export declare const DeleteIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
21
|
+
export declare const AddIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
22
|
+
export declare const DensitySmallIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
23
|
+
export declare const DensityMediumIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
24
|
+
export declare const DensityLargeIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
25
|
+
export declare const DragIndicatorIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
26
|
+
export declare const PrintIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
27
|
+
export declare const TableChartIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
28
|
+
export declare const DescriptionIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
29
|
+
export declare const VisibilityOffIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
30
|
+
export declare const FunctionsIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
31
|
+
export declare const WorkspacesIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
32
|
+
export declare const EmptyBoxIcon: React.ForwardRefExoticComponent<Omit<MGHGridIconProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { default } from './MGHGrid';
|
|
2
|
+
export { default as MGHGrid } from './MGHGrid';
|
|
3
|
+
export * from './MGHGrid.types';
|
|
4
|
+
export { MGHGridContext, useMGHGridApiContext, useMGHGridApiRef, useMGHGridContext, useMGHGridLocaleText } from './context';
|
|
5
|
+
export type { MGHGridContextValue, MGHGridRootProps } from './context';
|
|
6
|
+
export { MGH_GRID_CSS, MGH_GRID_STYLE_ID, useMGHGridStyles } from './MGHGrid.styles';
|
|
7
|
+
export { MGHGridToolbar, MGHGridQuickFilter, MGHGridExportMenu, MGHGridExportMenuItem, MGHGridColumnsButton, MGHGridFiltersButton, MGHGridDensitySelector, } from './components/Toolbar';
|
|
8
|
+
export type { MGHGridExportMenuProps, MGHGridExportMenuItemProps, MGHGridQuickFilterProps } from './components/Toolbar';
|
|
9
|
+
export { MGHGridFooter, MGHGridPagination } from './components/Footer';
|
|
10
|
+
export { MGHGridColumnsPanel } from './components/ColumnsPanel';
|
|
11
|
+
export { MGHGridFilterPanel } from './components/FilterPanel';
|
|
12
|
+
export { MGHGridColumnMenu } from './components/ColumnMenu';
|
|
13
|
+
export type { MGHGridColumnMenuProps } from './components/ColumnMenu';
|
|
14
|
+
export { MGHGridNoRowsOverlay, MGHGridLoadingOverlay } from './components/Overlays';
|
|
15
|
+
export { MGHGridActionsCellItem } from './components/ActionsCell';
|
|
16
|
+
export type { MGHGridActionsCellItemProps } from './components/ActionsCell';
|
|
17
|
+
export { Button as MGHGridButton, IconButton as MGHGridIconButton, Menu as MGHGridMenu, MenuItem as MGHGridMenuItem, MenuDivider as MGHGridMenuDivider, Popover as MGHGridPopover, Checkbox as MGHGridCheckbox, TextInput as MGHGridTextInput, Select as MGHGridSelect, } from './components/primitives';
|
|
18
|
+
export * as MGHGridIcons from './icons';
|
|
19
|
+
export { GROUPING_COLUMN_FIELD as MGH_GRID_GROUPING_COLUMN_FIELD, CHECKBOX_FIELD as MGH_GRID_CHECKBOX_FIELD, DETAIL_PANEL_TOGGLE_FIELD as MGH_GRID_DETAIL_PANEL_TOGGLE_FIELD, DEFAULT_LOCALE_TEXT as MGH_GRID_DEFAULT_LOCALE_TEXT, BUILT_IN_AGGREGATION_FUNCTIONS as MGH_GRID_AGGREGATION_FUNCTIONS, stringFilterOperators as mghGridStringFilterOperators, numberFilterOperators as mghGridNumberFilterOperators, booleanFilterOperators as mghGridBooleanFilterOperators, singleSelectFilterOperators as mghGridSingleSelectFilterOperators, getDateFilterOperators as mghGridGetDateFilterOperators, } from './utils';
|
|
20
|
+
export { getDataAsCsv as mghGridGetDataAsCsv, buildXlsx as mghGridBuildXlsx } from './export';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { MGHGridAggregationFunction, MGHGridApi, MGHGridColDef, MGHGridColType, MGHGridComparatorFn, MGHGridFilterOperator, MGHGridLocaleText, MGHGridRowId, MGHGridRowSelectionModel, MGHGridRowSelectionModelInput, MGHGridValidRowModel, MGHGridValueOption, MGHGridValueOptionObject } from './MGHGrid.types';
|
|
2
|
+
export declare const GROUPING_COLUMN_FIELD = "__row_group_by_columns_group__";
|
|
3
|
+
export declare const CHECKBOX_FIELD = "__check__";
|
|
4
|
+
export declare const DETAIL_PANEL_TOGGLE_FIELD = "__detail_panel_toggle__";
|
|
5
|
+
export declare const AGGREGATION_FOOTER_ID = "__aggregation_footer__";
|
|
6
|
+
export declare const INTERNAL_FIELDS: Set<string>;
|
|
7
|
+
export declare const DENSITY_FACTORS: {
|
|
8
|
+
readonly compact: 0.7;
|
|
9
|
+
readonly standard: 1;
|
|
10
|
+
readonly comfortable: 1.3;
|
|
11
|
+
};
|
|
12
|
+
export declare const DEFAULT_ROW_HEIGHT = 52;
|
|
13
|
+
export declare const DEFAULT_HEADER_HEIGHT = 56;
|
|
14
|
+
export declare const DEFAULT_COLUMN_WIDTH = 100;
|
|
15
|
+
export declare const DEFAULT_COLUMN_MIN_WIDTH = 50;
|
|
16
|
+
export declare const CHECKBOX_COLUMN_WIDTH = 50;
|
|
17
|
+
export declare const DETAIL_TOGGLE_COLUMN_WIDTH = 50;
|
|
18
|
+
export declare const GROUPING_COLUMN_WIDTH = 220;
|
|
19
|
+
export declare const isInternalField: (field: string) => boolean;
|
|
20
|
+
export declare const isNil: (value: unknown) => value is null | undefined;
|
|
21
|
+
export declare const isEmptyValue: (value: unknown) => boolean;
|
|
22
|
+
export declare const clamp: (value: number, min: number, max: number) => number;
|
|
23
|
+
export declare const cx: (...classNames: Array<string | false | null | undefined>) => string;
|
|
24
|
+
export declare const arraysEqual: <T>(a: T[] | undefined, b: T[] | undefined) => boolean;
|
|
25
|
+
export declare const moveItem: <T>(list: T[], from: number, to: number) => T[];
|
|
26
|
+
export declare const uniqueId: (prefix?: string) => string;
|
|
27
|
+
export declare const canUseLocalStorage: () => boolean;
|
|
28
|
+
export declare const readLocalStorage: <T>(key: string) => T | null;
|
|
29
|
+
export declare const writeLocalStorage: (key: string, value: unknown) => void;
|
|
30
|
+
export declare const getRowIdFromRow: <R extends MGHGridValidRowModel>(row: R, getRowId?: (row: R) => MGHGridRowId) => MGHGridRowId;
|
|
31
|
+
export declare const normalizeSelectionModel: (input: MGHGridRowSelectionModelInput | undefined, allIds?: MGHGridRowId[]) => MGHGridRowSelectionModel;
|
|
32
|
+
export declare const selectionModelsEqual: (a: MGHGridRowSelectionModel, b: MGHGridRowSelectionModel) => boolean;
|
|
33
|
+
export declare const toDate: (value: unknown) => Date | null;
|
|
34
|
+
export declare const formatDate: (value: unknown, withTime: boolean) => string;
|
|
35
|
+
export declare const isValueOptionObject: (option: MGHGridValueOption) => option is MGHGridValueOptionObject;
|
|
36
|
+
export declare const getOptionValue: (col: MGHGridColDef, option: MGHGridValueOption) => any;
|
|
37
|
+
export declare const getOptionLabel: (col: MGHGridColDef, option: MGHGridValueOption) => string;
|
|
38
|
+
export declare const resolveValueOptions: (col: MGHGridColDef, row?: MGHGridValidRowModel, id?: MGHGridRowId) => MGHGridValueOption[];
|
|
39
|
+
export declare const getCellValue: (row: MGHGridValidRowModel, col: MGHGridColDef, api: MGHGridApi) => any;
|
|
40
|
+
export declare const getGroupingValue: (row: MGHGridValidRowModel, col: MGHGridColDef, api: MGHGridApi) => any;
|
|
41
|
+
export declare const defaultFormatValue: (value: any, col: MGHGridColDef, row?: MGHGridValidRowModel, id?: MGHGridRowId) => string;
|
|
42
|
+
export declare const getFormattedValue: (value: any, row: MGHGridValidRowModel, col: MGHGridColDef, api: MGHGridApi, id?: MGHGridRowId) => any;
|
|
43
|
+
export declare const formattedValueToString: (formatted: any) => string;
|
|
44
|
+
export declare const parseEditValue: (raw: any, col: MGHGridColDef) => any;
|
|
45
|
+
export declare const numberComparator: MGHGridComparatorFn;
|
|
46
|
+
export declare const stringComparator: MGHGridComparatorFn;
|
|
47
|
+
export declare const stringOrNumberComparator: MGHGridComparatorFn;
|
|
48
|
+
export declare const dateComparator: MGHGridComparatorFn;
|
|
49
|
+
export declare const booleanComparator: MGHGridComparatorFn;
|
|
50
|
+
export declare const getDefaultComparator: (type: MGHGridColType | undefined) => MGHGridComparatorFn;
|
|
51
|
+
export declare const stringFilterOperators: MGHGridFilterOperator[];
|
|
52
|
+
export declare const numberFilterOperators: MGHGridFilterOperator[];
|
|
53
|
+
export declare const getDateFilterOperators: (withTime: boolean) => MGHGridFilterOperator[];
|
|
54
|
+
export declare const booleanFilterOperators: MGHGridFilterOperator[];
|
|
55
|
+
export declare const singleSelectFilterOperators: MGHGridFilterOperator[];
|
|
56
|
+
export declare const getDefaultFilterOperators: (type: MGHGridColType | undefined) => MGHGridFilterOperator[];
|
|
57
|
+
export declare const getColumnFilterOperators: (col: MGHGridColDef) => MGHGridFilterOperator<any, any>[];
|
|
58
|
+
export declare const normalizeColumn: <R extends MGHGridValidRowModel>(col: MGHGridColDef<R>) => MGHGridColDef<R>;
|
|
59
|
+
export declare const BUILT_IN_AGGREGATION_FUNCTIONS: Record<string, MGHGridAggregationFunction>;
|
|
60
|
+
export declare const DEFAULT_LOCALE_TEXT: MGHGridLocaleText;
|
|
61
|
+
export declare const measureText: (text: string, font: string) => number;
|
|
62
|
+
export declare const downloadBlob: (blob: Blob, fileName: string) => void;
|