mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 05:10:45 +00:00
QQQ-32 udpating styles on query; record list & view sections; record labels; apps in nav; updated breadcrumb; updated navigation
This commit is contained in:
@ -36,24 +36,33 @@ interface Props
|
||||
{
|
||||
label: string;
|
||||
name: string;
|
||||
type: string;
|
||||
isEditable?: boolean;
|
||||
[key: string]: any;
|
||||
bulkEditMode?: boolean;
|
||||
bulkEditSwitchChangeHandler?: any
|
||||
}
|
||||
|
||||
function QDynamicFormField({
|
||||
label, name, bulkEditMode, bulkEditSwitchChangeHandler, ...rest
|
||||
label, name, bulkEditMode, bulkEditSwitchChangeHandler, type, isEditable, ...rest
|
||||
}: Props): JSX.Element
|
||||
{
|
||||
const [switchChecked, setSwitchChecked] = useState(false);
|
||||
const [isDisabled, setIsDisabled] = useState(bulkEditMode);
|
||||
const [isDisabled, setIsDisabled] = useState(!isEditable || bulkEditMode);
|
||||
|
||||
const inputLabelProps = {};
|
||||
if (type.toLowerCase().match("(date|time)"))
|
||||
{
|
||||
// @ts-ignore
|
||||
inputLabelProps.shrink = true;
|
||||
}
|
||||
|
||||
const field = () => (
|
||||
<>
|
||||
<Field {...rest} name={name} as={MDInput} variant="standard" label={label} fullWidth disabled={isDisabled} />
|
||||
<Field {...rest} name={name} type={type} as={MDInput} variant="standard" label={label} InputLabelProps={inputLabelProps} fullWidth disabled={isDisabled} />
|
||||
<MDBox mt={0.75}>
|
||||
<MDTypography component="div" variant="caption" color="error" fontWeight="regular">
|
||||
{!isDisabled && <ErrorMessage name={name} />}
|
||||
{!isDisabled && <div className="fieldErrorMessage"><ErrorMessage name={name} /></div>}
|
||||
</MDTypography>
|
||||
</MDBox>
|
||||
</>
|
||||
@ -100,6 +109,7 @@ function QDynamicFormField({
|
||||
|
||||
QDynamicFormField.defaultProps = {
|
||||
bulkEditMode: false,
|
||||
isEditable: true,
|
||||
bulkEditSwitchChangeHandler: () =>
|
||||
{},
|
||||
};
|
||||
|
Reference in New Issue
Block a user