Skip to content

Commit 0096d9a

Browse files
authored
react-material: Support multiple prop in MuiSelect
1 parent d3ee13a commit 0096d9a

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/material-renderers/src/mui-controls/MuiSelect.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@ import { EnumCellProps, WithClassname } from '@jsonforms/core';
2828
import { MenuItem, Select } from '@mui/material';
2929
import merge from 'lodash/merge';
3030
import { TranslateProps } from '@jsonforms/react';
31-
import { i18nDefaults, WithInputProps } from '../util';
31+
import { i18nDefaults, WithInputProps, WithSelectProps } from '../util';
3232

3333
export const MuiSelect = React.memo(function MuiSelect(
34-
props: EnumCellProps & WithClassname & TranslateProps & WithInputProps
34+
props: EnumCellProps &
35+
WithClassname &
36+
TranslateProps &
37+
WithInputProps &
38+
WithSelectProps
3539
) {
3640
const {
3741
data,
@@ -46,6 +50,7 @@ export const MuiSelect = React.memo(function MuiSelect(
4650
config,
4751
label,
4852
t,
53+
multiple,
4954
} = props;
5055
const appliedUiSchemaOptions = merge({}, config, uischema.options);
5156
const noneOptionLabel = useMemo(
@@ -63,6 +68,7 @@ export const MuiSelect = React.memo(function MuiSelect(
6368
value={data !== undefined ? data : ''}
6469
onChange={(ev) => handleChange(path, ev.target.value || undefined)}
6570
fullWidth={true}
71+
multiple={multiple || false}
6672
>
6773
{[
6874
<MenuItem value={''} key='jsonforms.enum.none'>

packages/material-renderers/src/util/theme.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export interface WithInputProps {
4646
label?: string;
4747
}
4848

49+
export interface WithSelectProps {
50+
multiple?: boolean;
51+
}
52+
4953
const variantToInput = {
5054
standard: Input,
5155
filled: FilledInput,

0 commit comments

Comments
 (0)