feat(datepicker): add apply and cancel buttons #6638
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New feature description
This feature adds the option to enable an "Apply" and "Cancel" button to the datepicker. When enabled, the datepicker does not emit the change event from the view to the model until the value is applied by the new apply button. If the user chooses to cancel, the datepicker's value is reset back to the value of the model.
When this option is enabled it also keeps the datepicker open until the user applies, cancels, or dismisses the picker. This change improves the pickers behaviour when showTimePicker is also enabled as it allows the user to adjust both the date and time without the datepicker closing automatically after the date is updated. An issue discussed in #4203 .
The following new related config options have been added:
The css has also been slightly tweaked to improve appearance when all buttons are enabled. (Today, Clear, Apply and Cancel).
PR Checklist
Before creating new PR, please take a look at checklist below to make sure that you've done everything that needs to be done before we can merge it.