@evoke-platform/ui-components 1.0.0-dev.177 → 1.0.0-dev.179
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/BuilderGrid/BuilderGrid.d.ts +4 -1
- package/dist/published/components/custom/BuilderGrid/BuilderGrid.js +11 -8
- package/dist/published/components/custom/FormField/FormField.d.ts +2 -0
- package/dist/published/components/custom/FormField/FormField.js +3 -1
- package/dist/published/components/custom/FormField/Select/Select.js +6 -2
- package/package.json +1 -1
@@ -1,5 +1,5 @@
|
|
1
|
-
/// <reference types="react" />
|
2
1
|
import { GridSortItem, GridValidRowModel, DataGridProps as MuiDataGridProps } from '@mui/x-data-grid';
|
2
|
+
import React from 'react';
|
3
3
|
import { EmptyContentSelectOptions } from './EmptyContent';
|
4
4
|
export declare type GridAction = {
|
5
5
|
label: string;
|
@@ -12,6 +12,9 @@ export declare type BuilderGridProps<T extends GridValidRowModel> = MuiDataGridP
|
|
12
12
|
emptyContentSelectOptions?: EmptyContentSelectOptions;
|
13
13
|
title?: string;
|
14
14
|
disablePagination?: boolean;
|
15
|
+
hideEmptyContent?: boolean;
|
16
|
+
hideToolbar?: boolean;
|
17
|
+
noRowsOverlay?: React.ReactElement;
|
15
18
|
};
|
16
19
|
declare const BuilderGrid: <T extends GridValidRowModel>(props: BuilderGridProps<T>) => JSX.Element;
|
17
20
|
export default BuilderGrid;
|
@@ -17,10 +17,10 @@ import BuilderGridToolbar from './BuilderGridToolbar';
|
|
17
17
|
import { EmptyContent } from './EmptyContent';
|
18
18
|
const BuilderGrid = (props) => {
|
19
19
|
var _a, _b;
|
20
|
-
const { loading, action, item, rows, initialSort, emptyContentSelectOptions, title, disablePagination } = props, rest = __rest(props, ["loading", "action", "item", "rows", "initialSort", "emptyContentSelectOptions", "title", "disablePagination"]);
|
20
|
+
const { loading, action, item, rows, initialSort, emptyContentSelectOptions, title, disablePagination, hideEmptyContent, hideToolbar, noRowsOverlay } = props, rest = __rest(props, ["loading", "action", "item", "rows", "initialSort", "emptyContentSelectOptions", "title", "disablePagination", "hideEmptyContent", "hideToolbar", "noRowsOverlay"]);
|
21
21
|
const [anchorEl, setAnchorEl] = useState();
|
22
22
|
const toolbar = useMemo(() => () => React.createElement(BuilderGridToolbar, { loading: loading, action: action, title: title }), [loading, action]);
|
23
|
-
return (React.createElement(UIThemeProvider, null, loading || rows.length ? (React.createElement(Box, { sx: {
|
23
|
+
return (React.createElement(UIThemeProvider, null, loading || rows.length || hideEmptyContent ? (React.createElement(Box, { sx: {
|
24
24
|
backgroundColor: '#fff',
|
25
25
|
borderRadius: '6px',
|
26
26
|
flexGrow: 1,
|
@@ -51,7 +51,7 @@ const BuilderGrid = (props) => {
|
|
51
51
|
backgroundColor: '#F4F6F8',
|
52
52
|
padding: '0 24px',
|
53
53
|
}, '& .MuiDataGrid-columnHeaders': {
|
54
|
-
borderTop: '1px solid #e2e2e3',
|
54
|
+
borderTop: hideToolbar ? 'none' : '1px solid #e2e2e3',
|
55
55
|
borderRadius: 0,
|
56
56
|
backgroundColor: '#f4f6f8',
|
57
57
|
}, '& .MuiDataGrid-columnHeaderTitle': {
|
@@ -59,8 +59,6 @@ const BuilderGrid = (props) => {
|
|
59
59
|
fontWeight: 700,
|
60
60
|
}, '& .MuiDataGrid-iconButtonContainer': {
|
61
61
|
marginLeft: '4px',
|
62
|
-
}, '& .MuiDataGrid-overlayWrapper': {
|
63
|
-
display: 'none',
|
64
62
|
}, height: !disablePagination ? 'calc(100vh - 240px)' : 'auto' }, rest.sx), getRowId: (row) => row.id, disableColumnMenu: true, initialState: {
|
65
63
|
sorting: {
|
66
64
|
sortModel: initialSort ? [initialSort] : [],
|
@@ -78,9 +76,14 @@ const BuilderGrid = (props) => {
|
|
78
76
|
},
|
79
77
|
},
|
80
78
|
},
|
81
|
-
},
|
82
|
-
|
83
|
-
|
79
|
+
}, slots: {
|
80
|
+
toolbar: hideToolbar ? null : toolbar,
|
81
|
+
noResultsOverlay: () => {
|
82
|
+
return React.createElement(Box, null);
|
83
|
+
},
|
84
|
+
noRowsOverlay: () => {
|
85
|
+
return noRowsOverlay ? noRowsOverlay : null;
|
86
|
+
},
|
84
87
|
}, rowHeight: 60, columnHeaderHeight: 62 })))) : (React.createElement(React.Fragment, null, rows && !rows.length && (React.createElement(Box, { sx: {
|
85
88
|
backgroundColor: '#fff',
|
86
89
|
borderRadius: '6px',
|
@@ -19,6 +19,8 @@ export declare type FormFieldProps = {
|
|
19
19
|
rows?: number;
|
20
20
|
inputMaskPlaceholderChar?: string;
|
21
21
|
queryAddresses?: Function;
|
22
|
+
isOptionEqualToValue?: Function;
|
23
|
+
renderOption?: Function;
|
22
24
|
};
|
23
25
|
declare const FormField: (props: FormFieldProps) => any;
|
24
26
|
export default FormField;
|
@@ -7,7 +7,7 @@ import InputFieldComponent from './InputFieldComponent/InputFieldComponent';
|
|
7
7
|
import Select from './Select/Select';
|
8
8
|
import TimePickerSelect from './TimePickerSelect/TimePickerSelect';
|
9
9
|
const FormField = (props) => {
|
10
|
-
const { defaultValue, error, onChange, property, readOnly, selectOptions, required, size, placeholder, errorMessage, onBlur, mask, max, min, isMultiLineText, rows, inputMaskPlaceholderChar, queryAddresses, } = props;
|
10
|
+
const { defaultValue, error, onChange, property, readOnly, selectOptions, required, size, placeholder, errorMessage, onBlur, mask, max, min, isMultiLineText, rows, inputMaskPlaceholderChar, queryAddresses, isOptionEqualToValue, renderOption, } = props;
|
11
11
|
const id = property.id;
|
12
12
|
let control;
|
13
13
|
const commonProps = {
|
@@ -25,6 +25,8 @@ const FormField = (props) => {
|
|
25
25
|
placeholder,
|
26
26
|
min,
|
27
27
|
max,
|
28
|
+
isOptionEqualToValue,
|
29
|
+
renderOption,
|
28
30
|
};
|
29
31
|
if (queryAddresses) {
|
30
32
|
control = (React.createElement(AddressFieldComponent, Object.assign({}, commonProps, { mask: mask, inputMaskPlaceholderChar: inputMaskPlaceholderChar, isMultiLineText: isMultiLineText, rows: rows, queryAddresses: queryAddresses })));
|
@@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { Autocomplete, TextField } from '../../../core';
|
3
3
|
import InputFieldComponent from '../InputFieldComponent/InputFieldComponent';
|
4
4
|
const Select = (props) => {
|
5
|
-
const { property, defaultValue, error, errorMessage, onBlur, readOnly, selectOptions, required, size } = props;
|
5
|
+
const { property, defaultValue, error, errorMessage, onBlur, readOnly, selectOptions, required, size, isOptionEqualToValue, renderOption, } = props;
|
6
6
|
const [value, setValue] = useState(defaultValue);
|
7
7
|
const [inputValue, setInputValue] = useState('');
|
8
8
|
useEffect(() => {
|
@@ -27,6 +27,10 @@ const Select = (props) => {
|
|
27
27
|
setInputValue(selectValue);
|
28
28
|
}
|
29
29
|
};
|
30
|
-
return readOnly ? (React.createElement(InputFieldComponent, Object.assign({}, props))) : (React.createElement(Autocomplete, { multiple: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? true : false, id: id, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { value: value, fullWidth: true, onBlur: onBlur })), value: value !== null && value !== void 0 ? value : ((property === null || property === void 0 ? void 0 : property.type) === 'array' ? [] : undefined), onChange: handleChange, options: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? property === null || property === void 0 ? void 0 : property.enum : selectOptions, disableClearable: true, inputValue: inputValue !== null && inputValue !== void 0 ? inputValue : '', error: error, errorMessage: errorMessage, required: required, onInputChange: handleInputValueChange, filterOptions: (option) => { var _a; return (property === null || property === void 0 ? void 0 : property.type) === 'array' ? (_a = property === null || property === void 0 ? void 0 : property.enum) === null || _a === void 0 ? void 0 : _a.filter((item) => item !== option.value) : option; }, size: size
|
30
|
+
return readOnly ? (React.createElement(InputFieldComponent, Object.assign({}, props))) : (React.createElement(Autocomplete, { multiple: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? true : false, id: id, renderInput: (params) => React.createElement(TextField, Object.assign({}, params, { value: value, fullWidth: true, onBlur: onBlur })), value: value !== null && value !== void 0 ? value : ((property === null || property === void 0 ? void 0 : property.type) === 'array' ? [] : undefined), onChange: handleChange, options: (property === null || property === void 0 ? void 0 : property.type) === 'array' ? property === null || property === void 0 ? void 0 : property.enum : selectOptions, disableClearable: true, inputValue: inputValue !== null && inputValue !== void 0 ? inputValue : '', error: error, errorMessage: errorMessage, required: required, onInputChange: handleInputValueChange, filterOptions: (option) => { var _a; return (property === null || property === void 0 ? void 0 : property.type) === 'array' ? (_a = property === null || property === void 0 ? void 0 : property.enum) === null || _a === void 0 ? void 0 : _a.filter((item) => item !== option.value) : option; }, size: size, isOptionEqualToValue: isOptionEqualToValue
|
31
|
+
? (option, value) => isOptionEqualToValue(option, value)
|
32
|
+
: undefined, renderOption: renderOption
|
33
|
+
? (props, option, state) => renderOption(props, option, state)
|
34
|
+
: undefined }));
|
31
35
|
};
|
32
36
|
export default Select;
|