fix(striker-ui): expose readonly in SelectWithLabel
This commit is contained in:
parent
9d010b7b90
commit
1aacb7eae2
@ -2,6 +2,7 @@ import { FC, ReactNode } from 'react';
|
|||||||
import {
|
import {
|
||||||
Checkbox as MUICheckbox,
|
Checkbox as MUICheckbox,
|
||||||
FormControl as MUIFormControl,
|
FormControl as MUIFormControl,
|
||||||
|
selectClasses as muiSelectClasses,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
|
|
||||||
import InputMessageBox from './InputMessageBox';
|
import InputMessageBox from './InputMessageBox';
|
||||||
@ -26,6 +27,7 @@ type SelectWithLabelOptionalProps = {
|
|||||||
disableItem?: ((value: string) => boolean) | null;
|
disableItem?: ((value: string) => boolean) | null;
|
||||||
hideItem?: ((value: string) => boolean) | null;
|
hideItem?: ((value: string) => boolean) | null;
|
||||||
isCheckableItems?: boolean;
|
isCheckableItems?: boolean;
|
||||||
|
isReadOnly?: boolean;
|
||||||
inputLabelProps?: Partial<OutlinedInputLabelProps>;
|
inputLabelProps?: Partial<OutlinedInputLabelProps>;
|
||||||
label?: string | null;
|
label?: string | null;
|
||||||
messageBoxProps?: Partial<MessageBoxProps>;
|
messageBoxProps?: Partial<MessageBoxProps>;
|
||||||
@ -42,6 +44,7 @@ const SELECT_WITH_LABEL_DEFAULT_PROPS: Required<SelectWithLabelOptionalProps> =
|
|||||||
checkItem: null,
|
checkItem: null,
|
||||||
disableItem: null,
|
disableItem: null,
|
||||||
hideItem: null,
|
hideItem: null,
|
||||||
|
isReadOnly: false,
|
||||||
isCheckableItems: false,
|
isCheckableItems: false,
|
||||||
inputLabelProps: {},
|
inputLabelProps: {},
|
||||||
label: null,
|
label: null,
|
||||||
@ -57,6 +60,7 @@ const SelectWithLabel: FC<SelectWithLabelProps> = ({
|
|||||||
disableItem,
|
disableItem,
|
||||||
hideItem,
|
hideItem,
|
||||||
inputLabelProps,
|
inputLabelProps,
|
||||||
|
isReadOnly,
|
||||||
messageBoxProps,
|
messageBoxProps,
|
||||||
selectProps,
|
selectProps,
|
||||||
isCheckableItems = selectProps?.multiple,
|
isCheckableItems = selectProps?.multiple,
|
||||||
@ -71,7 +75,17 @@ const SelectWithLabel: FC<SelectWithLabelProps> = ({
|
|||||||
{...{
|
{...{
|
||||||
id,
|
id,
|
||||||
input: <OutlinedInput {...{ label }} />,
|
input: <OutlinedInput {...{ label }} />,
|
||||||
|
readOnly: isReadOnly,
|
||||||
...selectProps,
|
...selectProps,
|
||||||
|
sx: isReadOnly
|
||||||
|
? {
|
||||||
|
[`& .${muiSelectClasses.icon}`]: {
|
||||||
|
visibility: 'hidden',
|
||||||
|
},
|
||||||
|
|
||||||
|
...selectProps?.sx,
|
||||||
|
}
|
||||||
|
: selectProps?.sx,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{selectItems.map(({ value, displayValue = value }) => (
|
{selectItems.map(({ value, displayValue = value }) => (
|
||||||
|
Loading…
Reference in New Issue
Block a user