Skip to content

Commit bddf217

Browse files
Merge pull request #4708 from 3drepo/ISSUE_4639
ISSUE #4639 - Sequences don't revert to a previously selected date on cancel
2 parents 2147652 + f2345da commit bddf217

File tree

4 files changed

+10
-44
lines changed

4 files changed

+10
-44
lines changed

frontend/src/v4/routes/components/dateField/dateField.component.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@
1414
* You should have received a copy of the GNU Affero General Public License
1515
* along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
*/
17-
import { ComponentType, useEffect } from 'react';
18-
import { DatePickerProps } from '@mui/lab/DatePicker';
19-
import { DateTimePickerProps } from '@mui/lab/DateTimePicker';
2017
import { TextField } from '@mui/material';
21-
import { useState } from 'react';
22-
import { StyledDatePicker, StyledDateTimePicker } from './dateField.styles';
18+
import { useEffect, useState } from 'react';
19+
import { DateTimePicker } from '@controls/inputs/datePicker/dateTimePicker.component';
20+
import { DatePicker } from '@controls/inputs/datePicker/datePicker.component';
2321

2422
interface IProps {
2523
value?: any;
@@ -44,11 +42,10 @@ export const DateField = ({
4442
placeholder,
4543
dateTime,
4644
defaultValue,
47-
className,
4845
...dateFieldProps
4946
}: IProps) => {
5047
const [value, setValue] = useState(propValue || null);
51-
const Picker: ComponentType<DatePickerProps | DateTimePickerProps> = dateTime ? StyledDateTimePicker : StyledDatePicker;
48+
const Picker = dateTime ? DateTimePicker : DatePicker;
5249

5350
const handleAccept = (newValue) => {
5451
if (newValue) {
@@ -72,14 +69,15 @@ export const DateField = ({
7269
onAccept={handleAccept}
7370
onChange={() => {}}
7471
disableHighlightToday
72+
// @ts-ignore
73+
inputProps={{ readOnly: true, placeholder }}
74+
components={{ ActionBar: null }}
7575
renderInput={(props) => (
7676
<TextField
77-
placeholder={placeholder}
7877
defaultValue={defaultValue}
7978
name={name}
80-
onBlur={onBlur}
81-
className={className}
8279
{...props}
80+
InputProps={{ endAdornment: null }}
8381
/>
8482
)}
8583
{...dateFieldProps}

frontend/src/v4/routes/components/dateField/dateField.styles.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.

frontend/src/v5/ui/controls/inputs/datePicker/baseCalendarPicker/calendarActionBar/calendarActionBar.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type ICalendarActionBar = {
2525
export const CalendarActionBar = ({ onClear, hidden }: ICalendarActionBar) => {
2626
if (hidden) return null;
2727
return (
28-
<ClearDateAction onClick={onClear} hidden={hidden}>
28+
<ClearDateAction onClick={onClear}>
2929
<FormattedMessage id="datePicker.actionBar.clear" defaultMessage="Clear date" />
3030
</ClearDateAction>
3131
);

frontend/src/v5/ui/v4Adapter/overrides/cards/sharedStyles/sequencesTab.overrides.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default css`
5252
5353
${SequenceDateActions} {
5454
bottom: -3px;
55-
left: -9px;
55+
left: -41px;
5656
top: unset;
5757
right: unset;
5858
.MuiIconButton-root {

0 commit comments

Comments
 (0)