CEC-2545 Fix/can signals context (#210)

This commit is contained in:
arpanetus
2022-10-03 20:50:15 +06:00
committed by GitHub
parent d2a467d22b
commit 84fbf57daa
17 changed files with 347 additions and 205 deletions

View File

@@ -1,36 +1,6 @@
import PropTypes from "prop-types";
import {FormControl} from "@material-ui/core";
import useStyles from "../../useStyles";
import {MuiPickersUtilsProvider} from "@material-ui/pickers";
import DateFnsUtils from "@date-io/date-fns";
export const Dates = (
{
startDateFunc,
endDateFunc,
startDate,
handleStartChange,
endDate,
handleEndChange,
}) => {
if (startDateFunc && endDateFunc) {
return (<MuiPickersUtilsProvider utils={DateFnsUtils}>
{startDateFunc(startDate, handleStartChange)}
{endDateFunc(endDate, handleEndChange, startDate)}
</MuiPickersUtilsProvider>);
}
return null;
}
Dates.propTypes = {
startDateFunc: PropTypes.func,
endDateFunc: PropTypes.func,
startDate: PropTypes.instanceOf(Date),
handleStartChange: PropTypes.func,
endDate: PropTypes.instanceOf(Date),
handleEndChange: PropTypes.func
}
export const Parameters = (props) => {
const {params} = props;
@@ -42,22 +12,12 @@ export const Parameters = (props) => {
}
const {data, handleDataChange} = props;
const {startDate, handleStartChange} = props;
const {endDate, handleEndChange} = props;
return (
<FormControl size="small" className={classes.formControl}>
<div style={{width: "300px", marginTop: "1em"}}>
{params.dataFunc(data, handleDataChange)}
</div>
<Dates
startDateFunc={params.startDateFunc}
endDateFunc={params.endDateFunc}
startDate={startDate}
handleStartChange={handleStartChange}
endDate={endDate}
handleEndChange={handleEndChange}
></Dates>
</FormControl>
)
}
@@ -66,8 +26,4 @@ Parameters.propTypes = {
params: PropTypes.any,
data: PropTypes.any,
handleDataChange: PropTypes.func,
startDate: PropTypes.instanceOf(Date),
handleStartChange: PropTypes.func,
endDate: PropTypes.instanceOf(Date),
handleEndChange: PropTypes.func
};