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(MatDateRangePicker): add ability to use a custom component inside a dialog/popup #20613

Open
theorlovsky opened this issue Sep 21, 2020 · 9 comments
Labels
area: material/datepicker feature This issue represents a new feature or feature request rather than a bug or bug fix P2 The issue is important to a large percentage of users, with a workaround

Comments

@theorlovsky
Copy link

Feature Description

At the moment, the component that is used by the MatDatepickerBase._openAsDialog and MatDatepickerBase._openAsPopup methods is hardcoded. And you can't extend those because they are private.

If, instead, MatDatepickerContent was injected, we would have the ability to provide a component with extended functionality, e.g. with predefined date ranges. So, in the MatDatepickerBase we should have something like that:

constructor(
  // ...
  @Inject(MAT_DATEPICKER_CONTENT) private datepickerContent: MatDatepickerContentBase,
) {
  // ...
}

// ...

private _openAsDialog(): void {
  // ...
  this._dialogRef = this._dialog.open<MatDatepickerContentBase<S, D>>(this.datepickerContent, /* ... */);
  // ...
}

We can then import MatDatepickerContentBase, extend it and provide our own component to be used in a dialog or popup.

Use Case

Add predefined ranges, use two calendars instead of one, add buttons etc.
For example, check the ngx-daterangepicker-material package:
image

@theorlovsky theorlovsky added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team labels Sep 21, 2020
@mmalerba mmalerba added P2 The issue is important to a large percentage of users, with a workaround area: material/datepicker and removed needs triage This issue needs to be triaged by the team labels Sep 22, 2020
@mmalerba
Copy link
Contributor

This is something that we want to add support for, we don't have a timeline yet though

EricPoul pushed a commit to EricPoul/components that referenced this issue Jan 15, 2021
…ntent

Add a feature in the Angular Material `datepicker` component to customize datepicker content. With this feature, we can add some preset buttons or other templates to datepicker.

Closes angular#20613
EricPoul pushed a commit to EricPoul/components that referenced this issue Jan 15, 2021
…ntent

Add a feature in the Angular Material `datepicker` component
to customize datepicker content. With this feature, we can
add some preset buttons or other templates to datepicker.

Closes angular#20613
EricPoul pushed a commit to EricPoul/components that referenced this issue Jan 16, 2021
…ntent

Add a feature in the Angular Material `datepicker` component
to customize datepicker content. With this feature, we can
add some preset buttons or other templates to datepicker.

Closes angular#20613
EricPoul added a commit to EricPoul/components that referenced this issue Jan 16, 2021
…ntent

Add a feature in the Angular Material `datepicker` component
to customize datepicker content. With this feature, we can
add some preset buttons or other templates to datepicker.

Closes angular#20613
EricPoul added a commit to EricPoul/components that referenced this issue Jan 16, 2021
…ntent

Add a feature in the Angular Material `datepicker` component
to customize datepicker content. With this feature, we can
add some preset buttons or other templates to datepicker.

Closes angular#20613
@niklissad
Copy link

any updates for the issue and PR?

@Splaktar
Copy link
Member

any updates for the issue and PR?

We want to do some refactoring of the datepicker component before we finalize the APIs and design for this feature. It's still something we plan to support, but likely not this quarter.

@theorlovsky
Copy link
Author

@Splaktar In that case, why don't you review and merge the PR that is already there? And after that you can do your refactoring whenever you want without making us wait for an unknown amount of time.

@Splaktar
Copy link
Member

@theorlovsky because without the refactoring happening first, we don't think that we can get an API and implementation that we're willing to support. With our breaking change policy, it would take us 12-18 months to get that refactoring released if it included a breaking change to an API added now.

@angular-robot
Copy link
Contributor

angular-robot bot commented Feb 23, 2022

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

@angular-robot
Copy link
Contributor

angular-robot bot commented Mar 15, 2022

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

@jgutierrez-ayt
Copy link

Hi guys. What's the actual status of the requested feature?

@ctilley83
Copy link

It would be useful to display more than one calendar per input field for a couple use cases.

  1. For cases where the desired date is commonly in the previous month or the current month (in reports for ex).
  2. It would make selecting date ranges more intuitive when your date range crosses into the next month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: material/datepicker feature This issue represents a new feature or feature request rather than a bug or bug fix P2 The issue is important to a large percentage of users, with a workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants