You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The select and centerChange actions are already passed through the publicAPI but it's impossible to implement complicated selection logic on top of the default actions.
For instance, if the addon wants to perform multiple selections in a power-calendar-multiple, this is currently not possible on top of the current actions.select.
Elaboration: Imagine the user passes in a power-calendar-multipleonSelect handler but uses an addon selections child component. Ideally, the user would expect the onSelect action form the parent to be used by the addon selector component. So far so good, the handler is wrapped in the publicAPI.actions.select method and passed to the addon component. However, some default logic is implemented in the select action. select takes in a single date object, then merges it with the currently selected set of dates to produce the updated set that is then passed to the onSelect handler supplied to the power-calendar-multiple component. This is a convenient action handler, but there is no way to add multiple items to the selected list that is passed to the onSelect method. Therefore, because the onSelect handler is not passed through the publicAPI, there is no way to perform a selection state update that looks like [1, 2, 3] -> [1, 2, 3, 4, 5].
This is only one example of how not passing the handler restricts addons. For example consider the case of implementing a new selection mode in the power-calendar-range component. It would not be possible without having direct access to the user provided handlers because the default range selection logic is in the select action.
By directly exposing the handlers passed by the user, more direct, less coupled logic can be used by client addons.
The text was updated successfully, but these errors were encountered:
The
select
andcenterChange
actions are already passed through thepublicAPI
but it's impossible to implement complicated selection logic on top of the default actions.For instance, if the addon wants to perform multiple selections in a
power-calendar-multiple
, this is currently not possible on top of the currentactions.select
.Elaboration: Imagine the user passes in a
power-calendar-multiple
onSelect
handler but uses an addon selections child component. Ideally, the user would expect theonSelect
action form the parent to be used by the addon selector component. So far so good, the handler is wrapped in thepublicAPI.actions.select
method and passed to the addon component. However, some default logic is implemented in theselect
action.select
takes in a single date object, then merges it with the currently selected set of dates to produce the updated set that is then passed to theonSelect
handler supplied to thepower-calendar-multiple
component. This is a convenient action handler, but there is no way to add multiple items to the selected list that is passed to theonSelect
method. Therefore, because theonSelect
handler is not passed through thepublicAPI
, there is no way to perform a selection state update that looks like[1, 2, 3] -> [1, 2, 3, 4, 5]
.This is only one example of how not passing the handler restricts addons. For example consider the case of implementing a new selection mode in the
power-calendar-range
component. It would not be possible without having direct access to the user provided handlers because the default range selection logic is in theselect
action.By directly exposing the handlers passed by the user, more direct, less coupled logic can be used by client addons.
The text was updated successfully, but these errors were encountered: