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

[Datepicker] Action button #329

Open
JonkiH opened this issue Aug 8, 2024 · 7 comments
Open

[Datepicker] Action button #329

JonkiH opened this issue Aug 8, 2024 · 7 comments
Labels
area: datetimepicker Issues about datetimepicker enhancement This issue is tracking a function should be enhanced

Comments

@JonkiH
Copy link

JonkiH commented Aug 8, 2024

Just wondering if there is an possibility to have some kind of overwrite so when we are using action button it would still send event when some date is chosen in the date picker,

This could open up the possibility to have custom functionality in action button area of the date picker.

insted of this check
image
and this
image

to have some kind of variable that is possible to overwrite. to open up this possibility, this work except when we chose date in the calendar because there is no event that happened anymore
image

Best regards
Jónki

@nzbin nzbin added enhancement This issue is tracking a function should be enhanced area: datetimepicker Issues about datetimepicker labels Aug 8, 2024
@nzbin
Copy link
Member

nzbin commented Aug 19, 2024

@CnxAtanasIliev Do you have any good ideas?

@CnxAtanasIliev
Copy link
Contributor

@JonkiH Would you mind giving some example to what you want to achieve as I dont understand quite well what the desired functionality needs to be. In general you should be able to define your own buttons in the actions element and dont have to necessarily use the built-in ones. This is basically ported functionality from Angular Material itself. I dont mind expanding it more, but I dont understand the ask here.

As for the changed event in general it is tied to the buttons being there, because if they are not used it automatically closes the overlay and emits the event.

@JonkiH
Copy link
Author

JonkiH commented Aug 19, 2024

What we are trying to do is create today button but when we do we loose the normal functionality.

When you have no action button you can press day and then that day is chosen.
Then you add action button you cant to that, we have to add the apply button to be able to chose day.

We are trying to add bottoms that have custom functionality with out loose the normal functionality.

@nzbin
Copy link
Member

nzbin commented Aug 20, 2024

What we are trying to do is create today button but when we do we loose the normal functionality.

When you have no action button you can press day and then that day is chosen. Then you add action button you cant to that, we have to add the apply button to be able to chose day.

We are trying to add bottoms that have custom functionality with out loose the normal functionality.

I think you can get the methods from the datetimepicker instance

<mtx-datetimepicker #datetimepicker>
  <mtx-datetimepicker-actions>
    <button mat-button (click)="datetimepicker.close()">Close</button>
  </mtx-datetimepicker-actions>
</mtx-datetimepicker>

@CnxYankoNikolov
Copy link
Contributor

@nzbin @JonkiH One thing that comes to my mind that can be done is this:
Make the calendar dependent on a "SelectionMode" property with values 'auto' and 'manual'.
Make the property default to 'auto' if no actions are present and default to 'manual' if actions are present.
Expose the property as an Input for overriding purposes.

I kind of get what @JonkiH wants to do I think. Basically he wants to have a button 'Today', which focuses the current day (for example), but doesn't want to add an Apply button necessarily to handle the selection with a second action.

Thoughts?

@JonkiH
Copy link
Author

JonkiH commented Aug 20, 2024

@CnxYankoNikolov it exactly what I want!

If it is possibility to disable the the normal function (like it is to day, where if you have action buttons it disable the option to click day and it is chosen) with some input then also comes the possibility to create custom functionality.

For example someone want to create button that should chose always next Monday or day one week from now.

Today (Idag witch is custom functionality) works for us but we need also to have Apply (Verkställ) but we would like to skip him since the user now need to chose the day and then press Apply.
image

@CnxYankoNikolov
Copy link
Contributor

@nzbin If you are okay with the approach I think its fairly easy to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: datetimepicker Issues about datetimepicker enhancement This issue is tracking a function should be enhanced
Projects
None yet
Development

No branches or pull requests

4 participants