@evoke-platform/ui-components 1.0.0-dev.208 → 1.0.0-dev.209
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.
@@ -45,6 +45,7 @@ export { Popover } from './Popover';
|
|
45
45
|
export { Popper } from './Popper';
|
46
46
|
export { SvgIcon, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TableSortLabel, ListItemButton, ListItemText, CardActions, CardActionArea, CardContent, CardMedia, CardHeader, Input, InputLabel, InputAdornment, } from '@mui/material';
|
47
47
|
export { LoadingButton, TabContext, TabList, TabPanel, TreeItem, TreeView } from '@mui/lab';
|
48
|
+
export { useGridApiRef } from '@mui/x-data-grid';
|
48
49
|
export type { GridSize } from '@mui/material';
|
49
50
|
export type { AutocompleteOption } from './Autocomplete/Autocomplete';
|
50
|
-
export type { GridCellParams, GridColDef, GridValueFormatterParams, GridValueGetterParams, GridEventListener, } from '@mui/x-data-grid';
|
51
|
+
export type { GridCellParams, GridColDef, GridFilterModel, GridValueFormatterParams, GridValueGetterParams, GridEventListener, } from '@mui/x-data-grid';
|
@@ -46,3 +46,4 @@ export { Popper } from './Popper';
|
|
46
46
|
//TODO: Review following components. They also need theme control:
|
47
47
|
export { SvgIcon, TableBody, TableCell, TableContainer, TableHead, TablePagination, TableRow, TableSortLabel, ListItemButton, ListItemText, CardActions, CardActionArea, CardContent, CardMedia, CardHeader, Input, InputLabel, InputAdornment, } from '@mui/material';
|
48
48
|
export { LoadingButton, TabContext, TabList, TabPanel, TreeItem, TreeView } from '@mui/lab';
|
49
|
+
export { useGridApiRef } from '@mui/x-data-grid';
|
@@ -11,5 +11,9 @@ export declare type DataGridProps<T extends GridValidRowModel> = MuiDataGridProp
|
|
11
11
|
theme?: Theme;
|
12
12
|
title?: string;
|
13
13
|
bulkAction?: BulkAction;
|
14
|
+
filterSettings?: {
|
15
|
+
mode: 'client' | 'server';
|
16
|
+
maxRows?: number;
|
17
|
+
};
|
14
18
|
};
|
15
19
|
export default function <T extends GridValidRowModel>(props: DataGridProps<T>): JSX.Element;
|
@@ -9,16 +9,30 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
9
9
|
}
|
10
10
|
return t;
|
11
11
|
};
|
12
|
-
import { DataGrid as MuiDataGrid } from '@mui/x-data-grid';
|
13
|
-
import React, {
|
12
|
+
import { DataGrid as MuiDataGrid, getGridStringOperators, getGridDateOperators, getGridSingleSelectOperators, getGridBooleanOperators, GridPagination, getGridNumericOperators, } from '@mui/x-data-grid';
|
13
|
+
import React, { useState } from 'react';
|
14
14
|
import Toolbar from './Toolbar';
|
15
15
|
import UIThemeProvider from '../../../theme';
|
16
|
+
import { Box, Typography } from '@mui/material';
|
16
17
|
export default function (props) {
|
17
|
-
|
18
|
+
var _a;
|
19
|
+
const { onRefresh, loading, theme, title, bulkAction, filterSettings, columns, rows } = props, rest = __rest(props, ["onRefresh", "loading", "theme", "title", "bulkAction", "filterSettings", "columns", "rows"]);
|
18
20
|
const [anchorEl, setAnchorEl] = useState();
|
19
|
-
const
|
21
|
+
const addColumnFilterOperators = (columns) => {
|
22
|
+
return (filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.mode) === 'server'
|
23
|
+
? columns.map((column) => (Object.assign(Object.assign({}, column), { filterOperators: column.type === 'string'
|
24
|
+
? getGridStringOperators().filter((o) => !['isEmpty', 'isNotEmpty', 'isAny'].includes(o.value))
|
25
|
+
: column.type === 'date' || column.type === 'dateTime'
|
26
|
+
? getGridDateOperators(column.type === 'dateTime').filter((o) => !['isEmpty', 'isNotEmpty'].includes(o.value))
|
27
|
+
: column.type === 'number'
|
28
|
+
? getGridNumericOperators().filter((o) => !['isEmpty', 'isNotEmpty'].includes(o.value))
|
29
|
+
: column.type === 'singleSelect'
|
30
|
+
? getGridSingleSelectOperators().filter((o) => !['isEmpty', 'isNotEmpty', 'isAnyOf'].includes(o.value))
|
31
|
+
: getGridBooleanOperators().filter((o) => !['isEmpty', 'isNotEmpty'].includes(o.value)) })))
|
32
|
+
: columns;
|
33
|
+
};
|
20
34
|
return (React.createElement(UIThemeProvider, { args: { theme: theme } },
|
21
|
-
React.createElement(MuiDataGrid, Object.assign({ onMenuOpen: (env) => setAnchorEl(env.target), loading: loading }, rest, { sx: Object.assign({ borderRadius: '8px', border: 'none', '& .MuiDataGrid-columnHeaders': {
|
35
|
+
React.createElement(MuiDataGrid, Object.assign({ onMenuOpen: (env) => setAnchorEl(env.target), loading: loading, filterMode: (_a = filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.mode) !== null && _a !== void 0 ? _a : 'client', rows: rows }, rest, { columns: addColumnFilterOperators(columns), sx: Object.assign({ borderRadius: '8px', border: 'none', '& .MuiDataGrid-columnHeaders': {
|
22
36
|
backgroundColor: '#F4F6F8',
|
23
37
|
color: '#637381',
|
24
38
|
borderRadius: '8px 8px 0 0',
|
@@ -49,6 +63,14 @@ export default function (props) {
|
|
49
63
|
toolbarFilters: '',
|
50
64
|
toolbarExport: 'Download',
|
51
65
|
}, componentsProps: {
|
66
|
+
toolbar: {
|
67
|
+
onRefresh,
|
68
|
+
setAnchorEl,
|
69
|
+
loading,
|
70
|
+
theme,
|
71
|
+
title,
|
72
|
+
bulkAction,
|
73
|
+
},
|
52
74
|
panel: {
|
53
75
|
anchorEl: anchorEl,
|
54
76
|
placement: 'bottom-end',
|
@@ -62,6 +84,12 @@ export default function (props) {
|
|
62
84
|
},
|
63
85
|
},
|
64
86
|
}, components: {
|
65
|
-
Toolbar:
|
87
|
+
Toolbar: Toolbar,
|
88
|
+
Footer: () => {
|
89
|
+
return (React.createElement(Box, { display: 'flex', alignItems: 'center', justifyContent: 'space-between', sx: { border: '1px solid #eee', borderRadius: '0 0 6px 6px' } },
|
90
|
+
React.createElement(Box, null, (filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.mode) === 'server' && (filterSettings === null || filterSettings === void 0 ? void 0 : filterSettings.maxRows) === (rows === null || rows === void 0 ? void 0 : rows.length) && (React.createElement(Typography, { marginLeft: '8px', color: '#8f8c8c', fontSize: '14px' }, `You are viewing ${filterSettings.maxRows} records. If you can't find a record, please refine your
|
91
|
+
search.`))),
|
92
|
+
React.createElement(GridPagination, null)));
|
93
|
+
},
|
66
94
|
} }))));
|
67
95
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@evoke-platform/ui-components",
|
3
|
-
"version": "1.0.0-dev.
|
3
|
+
"version": "1.0.0-dev.209",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/published/index.js",
|
6
6
|
"module": "dist/published/index.js",
|
@@ -92,7 +92,7 @@
|
|
92
92
|
"@mui/icons-material": "^5.8.4",
|
93
93
|
"@mui/lab": "^5.0.0-alpha.105",
|
94
94
|
"@mui/material": "^5.10.11",
|
95
|
-
"@mui/x-data-grid": "^6.
|
95
|
+
"@mui/x-data-grid": "^6.4.0",
|
96
96
|
"@mui/x-date-pickers": "^5.0.13",
|
97
97
|
"@react-querybuilder/dnd": "^5.4.1",
|
98
98
|
"@react-querybuilder/material": "^6.5.0",
|