From 257400f23a3e5ec1fa369b802a036d910532a1c3 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Wed, 8 Sep 2021 11:19:11 +1000 Subject: [PATCH] partial update mui pickers from lab --- src/App.tsx | 298 ++++++++++++----------- src/components/fields/Date/TableCell.tsx | 93 ++++--- 2 files changed, 209 insertions(+), 182 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 525815d1..f613cefc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,5 +1,7 @@ import { lazy, Suspense } from "react"; import { Route, Switch, Link, Redirect } from "react-router-dom"; +import LocalizationProvider from "@material-ui/lab/LocalizationProvider"; +import AdapterDateFns from "@material-ui/lab/AdapterDateFns"; import { StyledEngineProvider } from "@material-ui/core/styles"; import { Button } from "@material-ui/core"; @@ -50,155 +52,161 @@ export default function App() { return ( - - - - - - - }> - - } - /> - } - /> - } - /> - } - /> - } - /> + + + + + + + + }> + + } + /> + } + /> + } + /> + } + /> + } + /> - } /> + } + /> - ( - - - ( - - } + ( + + + ( + + } + > + + + )} + /> + } + /> + } + /> + + ( + + )} + /> + ( + + + + )} + /> + ( + + + + )} + /> + ( + + + + )} + /> + + + )} + /> + + ( + } + > + - - - )} + Go Home + + } + fullScreen + style={{ marginTop: -64 }} /> - } - /> - } - /> - - ( - - )} - /> - ( - - - - )} - /> - ( - - - - )} - /> - ( - - - - )} - /> - - - )} - /> - - ( - } - > - - Go Home - - } - fullScreen - style={{ marginTop: -64 }} - /> - - )} - /> - - - - - - - + + )} + /> + + + + + + + + ); diff --git a/src/components/fields/Date/TableCell.tsx b/src/components/fields/Date/TableCell.tsx index 024beb70..9f098cfb 100644 --- a/src/components/fields/Date/TableCell.tsx +++ b/src/components/fields/Date/TableCell.tsx @@ -1,6 +1,8 @@ import { IHeavyCellProps } from "../types"; import { makeStyles, createStyles } from "@material-ui/styles"; +import MobileDatePicker from "@material-ui/lab/MobileDatePicker"; +import { TextField } from "@material-ui/core"; import { transformValue } from "./utils"; @@ -48,9 +50,9 @@ const useStyles = makeStyles((theme) => }) ); -export default function Date_({ column, value }: IHeavyCellProps) { +export default function Date_({ column, value, disabled }: IHeavyCellProps) { const classes = useStyles(); - const {} = useProjectContext(); + const { updateCell } = useProjectContext(); const transformedValue = transformValue(value); @@ -66,40 +68,57 @@ export default function Date_({ column, value }: IHeavyCellProps) { // 500 // ); - // if (disabled) - return ( -
- -
- ); + if (disabled) + return ( +
+ +
+ ); - // return ( - // - // e.stopPropagation()} - // format={column.config?.format ?? DATE_FORMAT} - // fullWidth - // clearable - // keyboardIcon={} - // className={clsx("cell-collapse-padding", classes.root)} - // inputVariant="standard" - // InputProps={{ - // disableUnderline: true, - // classes: { root: classes.inputBase, input: classes.input }, - // }} - // InputAdornmentProps={{ - // position: "start", - // classes: { root: classes.inputAdornment }, - // }} - // KeyboardButtonProps={{ - // size: "small", - // classes: { root: !disabled ? "row-hover-iconButton" : undefined }, - // }} - // DialogProps={{ onClick: (e) => e.stopPropagation() }} - // disabled={disabled} - // /> - // - // ); + return ( + ( + + )} + value={transformedValue} + onChange={console.log} + // onChange={handleDateChange} + // onClick={(e) => e.stopPropagation()} + // format={column.config?.format ?? DATE_FORMAT} + clearable + // keyboardIcon={} + // className={clsx("cell-collapse-padding", classes.root)} + // inputVariant="standard" + // InputProps={{ + // disableUnderline: true, + // classes: { root: classes.inputBase, input: classes.input }, + // }} + // InputAdornmentProps={{ + // position: "start", + // classes: { root: classes.inputAdornment }, + // }} + // KeyboardButtonProps={{ + // size: "small", + // classes: { root: !disabled ? "row-hover-iconButton" : undefined }, + // }} + // DialogProps={{ onClick: (e) => e.stopPropagation() }} + // disabled={disabled} + /> + ); }