fix date fields render loop

This commit is contained in:
Sidney Alcantara
2022-11-11 14:59:07 +11:00
parent 26ea9abaf4
commit 742a992098
4 changed files with 6 additions and 11 deletions

View File

@@ -63,11 +63,7 @@ export default function Date_({
},
"& .MuiInputAdornment-root": { m: 0 },
}}
// Prevent react-data-grid showing NullEditor, which unmounts this field
onDoubleClick={(e) => e.stopPropagation()}
onKeyDown={(e) => e.stopPropagation()}
// Touch mode: make the whole field clickable
onClick={props.inputProps?.onClick as any}
onClick={(e) => e.stopPropagation()}
inputProps={{ ...props.inputProps, tabIndex }}
/>
)}
@@ -86,6 +82,7 @@ export default function Date_({
components={{ OpenPickerIcon: ChevronDown }}
disableOpenPicker={false}
disabled={disabled}
PopperProps={{ onClick: (e) => e.stopPropagation() }}
/>
);
}

View File

@@ -28,7 +28,7 @@ export const config: IFieldConfig = {
initializable: true,
icon: <DateIcon />,
description: `Formatted date. Format is configurable, default: ${DATE_FORMAT}. Edited with a visual picker.`,
TableCell: withTableCell(DisplayCell, EditorCell, "inline", {
TableCell: withTableCell(DisplayCell, EditorCell, "focus", {
disablePadding: true,
}),
SideDrawerField,

View File

@@ -68,11 +68,8 @@ export default function DateTime({
},
"& .MuiInputAdornment-root": { m: 0 },
}}
// Prevent react-data-grid showing NullEditor, which unmounts this field
onDoubleClick={(e) => e.stopPropagation()}
onKeyDown={(e) => e.stopPropagation()}
// Touch mode: make the whole field clickable
onClick={props.inputProps?.onClick as any}
onClick={(e) => e.stopPropagation()}
inputProps={{ ...props.inputProps, tabIndex }}
/>
)}
@@ -90,6 +87,7 @@ export default function DateTime({
components={{ OpenPickerIcon: ChevronDown }}
disableOpenPicker={false}
disabled={disabled}
PopperProps={{ onClick: (e) => e.stopPropagation() }}
/>
);
}

View File

@@ -36,7 +36,7 @@ export const config: IFieldConfig = {
initializable: true,
icon: <DateTimeIcon />,
description: `Formatted date & time. Format is configurable, default: ${DATE_TIME_FORMAT}. Edited with a visual picker.`,
TableCell: withTableCell(DisplayCell, EditorCell, "inline", {
TableCell: withTableCell(DisplayCell, EditorCell, "focus", {
disablePadding: true,
}),
SideDrawerField,