@@ -6,6 +6,7 @@ import { CellComponentProps } from "cdm/ComponentsModel";
66import { TableColumn } from "cdm/FolderModel" ;
77import { ParseService } from "services/ParseService" ;
88import { InputType } from "helpers/Constants" ;
9+ import { c } from "helpers/StylesHelper" ;
910
1011const CalendarTimeCell = ( calendarTimeProps : CellComponentProps ) => {
1112 const { defaultCell } = calendarTimeProps ;
@@ -35,7 +36,7 @@ const CalendarTimeCell = (calendarTimeProps: CellComponentProps) => {
3536 setShowDatePicker ( true ) ;
3637 }
3738
38- function handleCalendarChange ( date : Date ) {
39+ async function handleCalendarChange ( date : Date ) {
3940 const changed = date !== null ? DateTime . fromJSDate ( date ) : null ;
4041
4142 const newCell = ParseService . parseRowToLiteral (
@@ -44,7 +45,7 @@ const CalendarTimeCell = (calendarTimeProps: CellComponentProps) => {
4445 changed
4546 ) ;
4647
47- dataActions . updateCell (
48+ await dataActions . updateCell (
4849 row . index ,
4950 tableColumn ,
5051 newCell ,
@@ -62,36 +63,36 @@ const CalendarTimeCell = (calendarTimeProps: CellComponentProps) => {
6263
6364 return showDatePicker &&
6465 ( tableColumn . isMetadata === undefined || ! tableColumn . isMetadata ) ? (
65- < div className = "calendar-time" >
66- < DatePicker
67- dateFormat = { configInfo . getLocalSettings ( ) . datetime_format }
68- selected = {
69- DateTime . isDateTime ( calendarCell )
70- ? ( calendarCell as unknown as DateTime ) . toJSDate ( )
71- : null
72- }
73- onChange = { handleCalendarChange }
74- popperContainer = { CalendarContainer }
75- onBlur = { ( ) => setShowDatePicker ( false ) }
76- timeFormat = "HH:mm"
77- timeCaption = "time"
78- showTimeSelect
79- autoFocus
80- isClearable
81- clearButtonTitle = "Clear"
82- placeholderText = "Pick a moment..."
83- />
84- </ div >
66+ < DatePicker
67+ dateFormat = { configInfo . getLocalSettings ( ) . datetime_format }
68+ selected = {
69+ DateTime . isDateTime ( calendarCell )
70+ ? ( calendarCell as unknown as DateTime ) . toJSDate ( )
71+ : null
72+ }
73+ onChange = { handleCalendarChange }
74+ popperContainer = { CalendarContainer }
75+ onClickOutside = { ( ) => setShowDatePicker ( false ) }
76+ timeFormat = "HH:mm"
77+ timeCaption = "time"
78+ showTimeSelect
79+ autoFocus
80+ isClearable
81+ ariaLabelClose = "Clear"
82+ placeholderText = "Pick a moment..."
83+ />
8584 ) : (
86- < div onClick = { handleSpanOnClick } >
87- < span className = "calendar-time" style = { { width : column . getSize ( ) } } >
88- { DateTime . isDateTime ( calendarCell )
89- ? ( calendarCell as DateTime ) . toFormat (
90- configInfo . getLocalSettings ( ) . datetime_format
91- )
92- : null }
93- </ span >
94- </ div >
85+ < span
86+ className = { `${ c ( "calendar" ) } ` }
87+ style = { { width : column . getSize ( ) } }
88+ onClick = { handleSpanOnClick }
89+ >
90+ { DateTime . isDateTime ( calendarCell )
91+ ? ( calendarCell as DateTime ) . toFormat (
92+ configInfo . getLocalSettings ( ) . datetime_format
93+ )
94+ : null }
95+ </ span >
9596 ) ;
9697} ;
9798
0 commit comments