Skip to content
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

[Feat] Enable temporal selector DatePicker #309

Merged
merged 63 commits into from
Mar 21, 2024

Conversation

nadijagraca
Copy link
Contributor

@nadijagraca nadijagraca commented Feb 14, 2024

Description

Added temporal selector DatePicker for Filter and Parameter.

DatePicker is a single model, but based on value of argument range will either return dmc.DatePicker or dmc.DateRangePicker. Default value of range is True and the model will return dmc.DateRangePicker if range is not provided, or if the selector is not defined.

Options where DateRangePicker is returned:

  1. User does not define the Filter.selector but filter column is datetime dtype.
  2. User defines vm.DatePicker as Filter.selector without specifying range argument or by setting range=True

Option where DatePicker is returned:

  1. User defines vm.DatePicker as Filter.selector and sets vm.DatePicker range argument as False.

vm.DatePicker.value supported format are all inputs that could be translated to datetime.date. See more here

Done is separate pr:

  • styling
  • docs
  • tests

Screenshot

image
image

Notice

  • I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":

    • I submit this contribution under the Apache 2.0 license and represent that I am entitled to do so on behalf of myself, my employer, or relevant third parties, as applicable.
    • I certify that (a) this contribution is my original creation and / or (b) to the extent it is not my original creation, I am authorized to submit this contribution on behalf of the original creator(s) or their licensees.
    • I certify that the use of this contribution as authorized by the Apache 2.0 license does not violate the intellectual property rights of anyone else.
    • I have not referenced individuals, products or companies in any commits, directly or indirectly.
    • I have not added data or restricted code in any commits, directly or indirectly.

Copy link
Contributor

@huong-li-nguyen huong-li-nguyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @nadijagraca - thanks for your work on this! Have a few questions and suggestions :)

vizro-core/src/vizro/models/__init__.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/types.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
@antonymilne
Copy link
Contributor

This looks great! Just some answers to your open questions and then I will do a full review next week 🙂

  • How to hand value argument in both date picker and date range picker? I followed the approach of slider and range_slider in this pr, meaning if value is not provided I take min_date allowed for date picker, and [min_date, max_date] for date range picker.

This sounds right to me 👍

  • Do we keep min_date/max_date or do we replace it with min and max as in sliders?

Let's go for min and max to match the sliders.

Definitely keep it minimal and just expose only the essential arguments like we do for slider/rangeslider. What we should do though is set values for these fields if we think the dmc defaults aren't suitable for us. But those wouldn't be configurable as model fields, just hardcoded into the component returned in the build method.

@AnnMarieW
Copy link
Contributor

Be sure to set the dropdownPosition prop. It seems to be a workaround for this issue: snehilvj/dash-mantine-components#219

vizro-core/examples/_dev/app.py Outdated Show resolved Hide resolved
vizro-core/examples/_dev/app.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
Copy link
Contributor

@huong-li-nguyen huong-li-nguyen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have mostly tidy comments left 🧹 - so ensuring consistency between the other components, docstrings etc. The rest looks good to me 👍

@nadijagraca - could you also update the PR description and title?

vizro-core/src/vizro/models/__init__.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/types.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
vizro-core/src/vizro/models/_controls/filter.py Outdated Show resolved Hide resolved
@nadijagraca nadijagraca requested a review from stichbury as a code owner March 19, 2024 12:47
@nadijagraca nadijagraca merged commit c5a4bd3 into main Mar 21, 2024
34 checks passed
@nadijagraca nadijagraca deleted the feat/components/datepicker branch March 21, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request 🤓 Issue contains a feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants