@evoke-platform/ui-components 1.0.0-dev.109 → 1.0.0-dev.111
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/dist/published/components/custom/CriteriaBuilder/CriteriaBuilder.js +16 -2
- package/dist/published/components/custom/DataGrid/DataGrid.d.ts +6 -0
- package/dist/published/components/custom/DataGrid/DataGrid.js +69 -0
- package/dist/published/components/custom/DataGrid/Toolbar.d.ts +9 -0
- package/dist/published/components/custom/DataGrid/Toolbar.js +57 -0
- package/dist/published/components/custom/DataGrid/index.d.ts +3 -0
- package/dist/published/components/custom/DataGrid/index.js +3 -0
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.d.ts +2 -1
- package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js +1 -1
- package/dist/published/components/custom/index.d.ts +1 -0
- package/dist/published/components/custom/index.js +1 -0
- package/dist/published/index.d.ts +1 -1
- package/dist/published/index.js +1 -1
- package/package.json +5 -4
@@ -5,6 +5,7 @@ import 'react-querybuilder/dist/query-builder.css';
|
|
5
5
|
import { RemoveCircleOutline } from '../../../icons';
|
6
6
|
import { Autocomplete, Button, DatePicker, IconButton, LocalizationProvider, MenuItem, TextField, Typography, } from '../../core';
|
7
7
|
import { Box } from '../../layout';
|
8
|
+
import { NumericFormat } from '../FormField/InputFieldComponent';
|
8
9
|
const ALL_OPERATORS = [
|
9
10
|
{ name: '=', label: '=' },
|
10
11
|
{ name: '!=', label: '!=' },
|
@@ -132,7 +133,9 @@ const dynamicContentInputEditor = (props) => {
|
|
132
133
|
const DynamicContentInput = (_a = props.context) === null || _a === void 0 ? void 0 : _a.dynamicContentInput.component;
|
133
134
|
let valueEditor;
|
134
135
|
if (DynamicContentInput) {
|
135
|
-
valueEditor = (React.createElement(DynamicContentInput, { values: ['null', 'notNull'].includes(operator) ? '' : value, setValues:
|
136
|
+
valueEditor = (React.createElement(DynamicContentInput, { values: ['null', 'notNull'].includes(operator) ? '' : value, setValues: (e) => {
|
137
|
+
handleOnChange(e !== null && e !== void 0 ? e : '');
|
138
|
+
}, disabled: ['null', 'notNull'].includes(operator), size: 'small', previousSteps: (_c = (_b = props.context) === null || _b === void 0 ? void 0 : _b.dynamicContentInput.previousSteps) !== null && _c !== void 0 ? _c : [], isSingleValue: true, width: '33%', useStringInterpolation: true }));
|
136
139
|
}
|
137
140
|
return determineValueEditor(valueEditor, props);
|
138
141
|
};
|
@@ -147,6 +150,17 @@ const determineValueEditor = (baseValueEditor, props) => {
|
|
147
150
|
handleOnChange(value);
|
148
151
|
}, renderInput: (params) => (React.createElement(TextField, Object.assign({}, params, { placeholder: "Value", size: "small", style: { width: '33%' } }))) })));
|
149
152
|
break;
|
153
|
+
case 'integer':
|
154
|
+
valueEditor = (React.createElement(TextField, { value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => {
|
155
|
+
handleOnChange(isNaN(parseInt(e.target.value)) ? '' : parseInt(e.target.value));
|
156
|
+
}, type: "number", placeholder: "Value", size: "small", sx: { width: '33%' } }));
|
157
|
+
break;
|
158
|
+
case 'number':
|
159
|
+
valueEditor = (React.createElement(TextField, { value: ['null', 'notNull'].includes(operator) ? '' : value, disabled: ['null', 'notNull'].includes(operator), onChange: (e) => {
|
160
|
+
var _a;
|
161
|
+
handleOnChange((_a = e.target.value) !== null && _a !== void 0 ? _a : '');
|
162
|
+
}, InputProps: { inputComponent: NumericFormat }, placeholder: "Value", size: "small", sx: { width: '33%' } }));
|
163
|
+
break;
|
150
164
|
case 'array':
|
151
165
|
valueEditor = (React.createElement(Autocomplete, { multiple: true, options: values || [], getOptionLabel: (option) => (option.label ? option.label : ''), value: Array.isArray(value) ? (disabled ? [] : value) : [], disabled: disabled, onChange: (event, newValue) => {
|
152
166
|
const uniqueSelections = Array.from(new Set(newValue.map((item) => item.label))).map((label) => {
|
@@ -245,7 +259,7 @@ const CriteriaBuilder = (props) => {
|
|
245
259
|
React.createElement(QueryBuilderMaterial, null,
|
246
260
|
React.createElement(QueryBuilder, { query: !criteria ? { combinator: 'and', rules: [] } : query, fields: fields, onQueryChange: (q) => {
|
247
261
|
handleQueryChange(q);
|
248
|
-
}, showCombinatorsBetweenRules: true, listsAsArrays: true, controlElements: {
|
262
|
+
}, showCombinatorsBetweenRules: true, listsAsArrays: true, addRuleToNewGroups: true, controlElements: {
|
249
263
|
combinatorSelector: customCombinator,
|
250
264
|
fieldSelector: customSelector,
|
251
265
|
operatorSelector: customSelector,
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { DataGridProps as MuiDataGridProps, GridValidRowModel } from '@mui/x-data-grid';
|
3
|
+
export declare type DataGridProps<T extends GridValidRowModel> = MuiDataGridProps<T> & {
|
4
|
+
onRefresh?: () => void;
|
5
|
+
};
|
6
|
+
export default function <T extends GridValidRowModel>(props: DataGridProps<T>): JSX.Element;
|
@@ -0,0 +1,69 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
12
|
+
import { DataGrid as MuiDataGrid } from '@mui/x-data-grid';
|
13
|
+
import React, { useMemo, useState } from 'react';
|
14
|
+
import Toolbar from './Toolbar';
|
15
|
+
import UIThemeProvider from '../../../theme';
|
16
|
+
export default function (props) {
|
17
|
+
const { onRefresh, loading } = props, rest = __rest(props, ["onRefresh", "loading"]);
|
18
|
+
const [anchorEl, setAnchorEl] = useState();
|
19
|
+
const toolbar = useMemo(() => () => React.createElement(Toolbar, { onRefresh: onRefresh, setAnchorEl: setAnchorEl, loading: loading }), [onRefresh, loading]);
|
20
|
+
return (React.createElement(UIThemeProvider, null,
|
21
|
+
React.createElement(MuiDataGrid, Object.assign({ loading: loading }, rest, { sx: {
|
22
|
+
borderRadius: '8px',
|
23
|
+
border: 'none',
|
24
|
+
'& .MuiDataGrid-columnHeaders': {
|
25
|
+
backgroundColor: '#F4F6F8',
|
26
|
+
color: '#637381',
|
27
|
+
borderRadius: '8px 8px 0 0'
|
28
|
+
},
|
29
|
+
'& .MuiDataGrid-virtualScrollerContent': {
|
30
|
+
borderRight: '1px solid #eee',
|
31
|
+
borderLeft: '1px solid #eee',
|
32
|
+
},
|
33
|
+
'& .MuiDataGrid-toolbarContainer': {
|
34
|
+
padding: '7px 0',
|
35
|
+
fontColor: '#212B36'
|
36
|
+
},
|
37
|
+
'& .MuiDataGrid-row': {
|
38
|
+
borderBottom: '1px solid #eee',
|
39
|
+
},
|
40
|
+
'& .MuiDataGrid-cell': {
|
41
|
+
border: 'none'
|
42
|
+
},
|
43
|
+
'& .MuiDataGrid-footerContainer': {
|
44
|
+
border: '1px solid #eee',
|
45
|
+
borderRadius: '0 0 8px 8px'
|
46
|
+
},
|
47
|
+
height: 'calc(100vh - 240px)'
|
48
|
+
}, localeText: {
|
49
|
+
toolbarColumns: '',
|
50
|
+
toolbarDensity: '',
|
51
|
+
toolbarFilters: '',
|
52
|
+
toolbarExport: 'Download'
|
53
|
+
}, componentsProps: {
|
54
|
+
panel: {
|
55
|
+
anchorEl: anchorEl,
|
56
|
+
placement: 'bottom-end',
|
57
|
+
sx: {
|
58
|
+
'& .MuiPaper-root': {
|
59
|
+
borderRadius: '8px',
|
60
|
+
boxShadow: '0px 24px 48px rgba(145, 158, 171, 0.4)',
|
61
|
+
padding: '8px',
|
62
|
+
stop: -120
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
}, components: {
|
67
|
+
Toolbar: toolbar,
|
68
|
+
} }))));
|
69
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { GridToolbarProps as MuiGridToolbarProps } from '@mui/x-data-grid';
|
3
|
+
export declare type GridToolbarProps = MuiGridToolbarProps & {
|
4
|
+
onRefresh?: () => void;
|
5
|
+
setAnchorEl?: (anchorEl: HTMLAnchorElement | null) => void;
|
6
|
+
loading?: boolean;
|
7
|
+
};
|
8
|
+
declare function Toolbar(props: GridToolbarProps): JSX.Element;
|
9
|
+
export default Toolbar;
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import { FileDownloadRounded, FilterAlt, Refresh, TableChartRounded, TableRowsRounded, } from '../../../icons';
|
2
|
+
import { GridToolbarColumnsButton, GridToolbarContainer, GridToolbarDensitySelector, GridToolbarExport, GridToolbarFilterButton, GridToolbarQuickFilter, } from '@mui/x-data-grid';
|
3
|
+
import React from 'react';
|
4
|
+
import { Grid } from '../../layout';
|
5
|
+
import { IconButton } from '../../core';
|
6
|
+
import UIThemeProvider from '../../../theme';
|
7
|
+
const styles = {
|
8
|
+
container: { display: 'flex', justifyContent: 'space-between', margin: '0 0 15px 0' },
|
9
|
+
iconButton: {
|
10
|
+
minWidth: '36px',
|
11
|
+
height: '36px',
|
12
|
+
backgroundColor: 'rgba(145, 158, 171, 0.12)',
|
13
|
+
},
|
14
|
+
icon: {
|
15
|
+
marginLeft: '8px',
|
16
|
+
},
|
17
|
+
quickFilter: {
|
18
|
+
'& fieldset': {
|
19
|
+
borderRadius: '8px',
|
20
|
+
color: '#919EAB',
|
21
|
+
borderColor: 'rgba(145, 158, 171, 0.32)',
|
22
|
+
},
|
23
|
+
},
|
24
|
+
};
|
25
|
+
function Toolbar(props) {
|
26
|
+
const { onRefresh, setAnchorEl, loading } = props;
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
28
|
+
const setAnchor = (event) => {
|
29
|
+
if (setAnchorEl) {
|
30
|
+
setAnchorEl(event.target);
|
31
|
+
}
|
32
|
+
};
|
33
|
+
return (React.createElement(UIThemeProvider, null,
|
34
|
+
React.createElement(GridToolbarContainer, { sx: { padding: '0' } },
|
35
|
+
React.createElement(Grid, { container: true, sx: styles.container },
|
36
|
+
React.createElement(Grid, { item: true, xs: 6 },
|
37
|
+
React.createElement(GridToolbarQuickFilter, { variant: "outlined", size: "small", sx: styles.quickFilter })),
|
38
|
+
React.createElement(Grid, { item: true },
|
39
|
+
React.createElement(Grid, { container: true, spacing: 1, sx: styles.icon },
|
40
|
+
React.createElement(Grid, { item: true, sx: { paddingRight: '15px' } },
|
41
|
+
React.createElement(GridToolbarExport, { sx: { color: '#212B36' }, startIcon: React.createElement(FileDownloadRounded, null) })),
|
42
|
+
React.createElement(Grid, { item: true },
|
43
|
+
React.createElement(GridToolbarFilterButton, { componentsProps: {
|
44
|
+
button: {
|
45
|
+
startIcon: React.createElement(FilterAlt, { sx: styles.icon }),
|
46
|
+
sx: styles.iconButton,
|
47
|
+
},
|
48
|
+
}, onClickCapture: setAnchor })),
|
49
|
+
React.createElement(Grid, { item: true },
|
50
|
+
React.createElement(GridToolbarColumnsButton, { startIcon: React.createElement(TableChartRounded, { sx: styles.icon }), sx: styles.iconButton, onClickCapture: setAnchor })),
|
51
|
+
React.createElement(Grid, { item: true },
|
52
|
+
React.createElement(GridToolbarDensitySelector, { startIcon: React.createElement(TableRowsRounded, { sx: { marginLeft: '8px' } }), sx: styles.iconButton, onClickCapture: setAnchor })),
|
53
|
+
onRefresh && (React.createElement(Grid, { item: true },
|
54
|
+
React.createElement(IconButton, { onClick: onRefresh, disabled: loading, sx: { borderRadius: '4px' } },
|
55
|
+
React.createElement(Refresh, null))))))))));
|
56
|
+
}
|
57
|
+
export default Toolbar;
|
package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
import { FunctionComponent } from 'react';
|
2
2
|
import { FormFieldProps } from '../FormField';
|
3
|
+
export declare const NumericFormat: FunctionComponent<any>;
|
3
4
|
declare const InputFieldComponent: (props: FormFieldProps) => JSX.Element;
|
4
5
|
export default InputFieldComponent;
|
package/dist/published/components/custom/FormField/InputFieldComponent/InputFieldComponent.js
CHANGED
@@ -14,7 +14,7 @@ import NumberFormat from 'react-number-format';
|
|
14
14
|
import { Autocomplete, TextField } from '../../../core';
|
15
15
|
import InputMask from 'react-input-mask';
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
17
|
-
const NumericFormat = (props) => {
|
17
|
+
export const NumericFormat = (props) => {
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
19
19
|
const { inputRef, onChange, defaultValue } = props, other = __rest(props, ["inputRef", "onChange", "defaultValue"]);
|
20
20
|
return (React.createElement(NumberFormat, Object.assign({}, other, { getInputRef: inputRef, onValueChange: (values) => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export { ClickAwayListener, FormControlProps, FormHelperTextProps, GridSize, Toolbar } from '@mui/material';
|
2
2
|
export { CalendarPicker, DateTimePicker, MonthPicker, PickersDay, StaticDateTimePicker, StaticTimePicker, TimePicker, YearPicker, } from '@mui/x-date-pickers';
|
3
3
|
export * from './components/core';
|
4
|
-
export { CriteriaBuilder, FormField, MenuBar, MultiSelect, RepeatableField } from './components/custom';
|
4
|
+
export { CriteriaBuilder, DataGrid, FormField, MenuBar, MultiSelect, RepeatableField } from './components/custom';
|
5
5
|
export { Box, Container, Grid, Stack } from './components/layout';
|
6
6
|
export * from './util';
|
package/dist/published/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
export { ClickAwayListener, Toolbar } from '@mui/material';
|
2
2
|
export { CalendarPicker, DateTimePicker, MonthPicker, PickersDay, StaticDateTimePicker, StaticTimePicker, TimePicker, YearPicker, } from '@mui/x-date-pickers';
|
3
3
|
export * from './components/core';
|
4
|
-
export { CriteriaBuilder, FormField, MenuBar, MultiSelect, RepeatableField } from './components/custom';
|
4
|
+
export { CriteriaBuilder, DataGrid, FormField, MenuBar, MultiSelect, RepeatableField } from './components/custom';
|
5
5
|
export { Box, Container, Grid, Stack } from './components/layout';
|
6
6
|
export * from './util';
|
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.111",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/published/index.js",
|
6
6
|
"module": "dist/published/index.js",
|
@@ -67,14 +67,15 @@
|
|
67
67
|
"@mui/icons-material": "^5.8.4",
|
68
68
|
"@mui/lab": "^5.0.0-alpha.105",
|
69
69
|
"@mui/material": "^5.10.11",
|
70
|
+
"@mui/x-data-grid": "^6.2.1",
|
70
71
|
"@mui/x-date-pickers": "^5.0.13",
|
71
72
|
"@react-querybuilder/dnd": "^5.4.1",
|
72
73
|
"@react-querybuilder/material": "^5.4.1",
|
73
74
|
"lodash-es": "^4.17.21",
|
74
75
|
"react-dropzone": "^14.2.2",
|
75
76
|
"react-input-mask": "^3.0.0-alpha.2",
|
76
|
-
"react-
|
77
|
-
"react-
|
77
|
+
"react-querybuilder": "^6.0.2",
|
78
|
+
"react-number-format": "^4.9.3"
|
78
79
|
},
|
79
80
|
"lint-staged": {
|
80
81
|
"*": "prettier --write"
|
@@ -83,4 +84,4 @@
|
|
83
84
|
"verbose": true,
|
84
85
|
"testEnvironment": "jsdom"
|
85
86
|
}
|
86
|
-
}
|
87
|
+
}
|