-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pickers] Add DigitalClock
to DesktopDateTimePicker
#8946
[pickers] Add DigitalClock
to DesktopDateTimePicker
#8946
Conversation
Netlify deploy previewNetlify deploy preview: https://deploy-preview-8946--material-ui-x.netlify.app/ Updated pages
These are the results for the performance tests:
|
Will it be possible to hide digital clock? So that our users will be able to pick date from calendar and put time manually? As it is right now for DesktopDateTimePicker |
Yes, you'd get the current behavior back by reverting to the current configuration: viewRenderers: {
hours: null,
minutes: null,
seconds: null,
meridiem: null // we'll see if it's possible to avoid the need of specifying this one
} |
…derers` for time views
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
componentsProps: { toolbar: { hidden: true } }, | ||
} | ||
: { slotProps: { toolbar: { hidden: true } } }), | ||
slotProps: { toolbar: { hidden: true } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just cleaned some old 🗑️
packages/x-date-pickers/src/tests/describeValue/testControlledUnControlled.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a huge piece of works, congrats ! 🥳
|
||
const viewRenderers: PickerViewRendererLookup<TDate | null, DateOrTimeViewWithMeridiem, any, {}> = | ||
// we can only ensure the expected two-column layout if none of the renderers are overridden | ||
shouldUseNewRenderer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a way to at least drop this condition on v7
That's probably part of #8989, how can a renderer (here renderDesktopDateTimeView
when used on a date view) be aware of which other views are using it.
In other words, how could renderDesktopDateTimeView
adapt when used only for date views, if someone wants to use the TimeClock
.
Or do we just say that in v7 people will have to also override the date views to set the renderDateView
renderer.
packages/x-date-pickers/src/DesktopDateTimePicker/DesktopDateTimePicker.tsx
Outdated
Show resolved
Hide resolved
skipDisabled, | ||
timeViewsCount, | ||
}: DateTimeViewRendererProps<TDate>) => { | ||
const isActionBarVisible = !!resolveComponentProps( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK that's super not sexy...
But not sure how to do better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. 🙈
But given layout, I didn't see other options of how to cleanly avoid having the unwanted divider/border when no actions are present. 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the hard work integrating the digital clock on the pickers, @LukasTy!
A couple of notes:
- I noticed when you select the last items on the list, they won't scroll to the top. Is this a technical limitation particular to the DateTime? (It's working on the TimePicker)
![image](https://private-user-images.githubusercontent.com/550141/239896970-69b53673-9563-4170-9125-b3065d5e875f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA4OTk0NzYsIm5iZiI6MTcyMDg5OTE3NiwicGF0aCI6Ii81NTAxNDEvMjM5ODk2OTcwLTY5YjUzNjczLTk1NjMtNDE3MC05MTI1LWIzMDY1ZDVlODc1Zi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxM1QxOTMyNTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNGQ1NjRlNWI0NDkzN2E5ODNlMjhkY2Y2MTY5MjYwN2I0NzczNTRhNmUwYjdiNzI0MGFiMGY4MDdlZjZmYTZiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.bTvifXYaUsH1jl61aKA-vsxzIbS7QA7j5C4d5QWKmns)
-
Auto-close on Meridiem:
Selecting a Meridiem should not always close the view.
I wonder what we can do here to get a proper auto-closing strategy that considers the selection of the other sections of the date. -
Discrepancy between field and view
I noticed that if you add "seconds" to theviews
property, it displays correctly, but perhaps we should consider reflecting this automatically on the field as well; unless the user provides a specific format.
![image](https://private-user-images.githubusercontent.com/550141/239890648-b1505787-f68d-4ce7-91be-36d2e4410821.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA4OTk0NzYsIm5iZiI6MTcyMDg5OTE3NiwicGF0aCI6Ii81NTAxNDEvMjM5ODkwNjQ4LWIxNTA1Nzg3LWY2OGQtNGNlNy05MWJlLTM2ZDJlNDQxMDgyMS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzEzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxM1QxOTMyNTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05MjI1MzllNDY3ZDUwYmRiN2Y5ODA3ZmRlM2Q5M2ZmYWVlMTcyZjMxNDczYzE2YmU0MjdkYTg3ZmI4ZGQyZWM2JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.vXZVDl56He1Y0fOFQ6sLy6-eBRRNVMyAtvOEMFv3_Gg)
Right now, the "smart format" is only something applied on the But note, that if people do strange formats, the UI will not follow the order of the sections present on the format. |
Thank you for the feedback @joserodolfofreitas
Indeed, that is an issue of a naive implementation on the
Well, it's the same logic that we have for the TimePicker, in this case, it's probably a little bit more obvious.
I believe that we've cleared this point during a meeting and confirmed that it is a separate issue that will be tacked via a separate PR. 👌 |
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
@joserodolfofreitas I've made some styling adjustments to properly account for the possibility of different container height of the I'd be interested in releasing this change without the #8851 because the styling updates are taking longer than expected to correctly implement and finalize. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering the scope of integrating the Digital clock on the DesktopDateTimePicker, I believe we're good to merge this one.
We'll need follow-ups to polish:
- the auto-closing strategy on both TimePicker and DateTimePicker
- the discrepancy between field and picker UI
but those can be easily broken down on different PRs.
Great work bringing the digital clock to the DateTimePicker!
Fixes #8819
The design update syncing is pending and will be done after #8851 is merged.
dateTimeViewRenderer
with two column layoutdateTimeViewRenderer
for all views inDesktopDateTimePicker
in case there are no customviewRenderers
provideddate
views have entries to benefit from legacy layoutDateTimePickerToolbar
styling in case the newdateTimeViewRenderer
s are usedviewRenderers
behaves as expected