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
{{ message }}
Repository navigation
Make all @Output names, property names, and event class names consistent #6677
select: Change to selected. Select is a native event emitted when text is selected by the cursor.
deselect => deselected.
destroy => destroyed
onRemove => removed
Date Picker
selectedChanged - @jelbourn any reason why this wouldn't just be changed?
userSelection => userSelected
dateChange => dateChanged
selectedValueChange => changed?
Menu
close => closed
onMenuOpen => menuOpened or opened
onMenuClose => menuClosed or closed
Paginator
page => paged
Select
onOpen => opened
onClose => closed
valueChange => valueChanged
Sidenav
onOpen => opened
onClose => closed
onPositionChanged => positionChanged
onAlignChanged => alignChanged
Sort
mdSortChange => mdSortChanged
Tabs
selectedIndexChange => selectedIndexChanged
focusChange => focusChanged
selectChange => selectChanged
onCentering => centering
onCentered => centered
@jelbourn - do we want to convert change to changed? Also there is several places that have changed prefixed like mdSortChange, do we want to consolidate those to change or would we like to go the other way and prefix everything?
Reacted by Rafael Santana, Benjamin Charity, Anto Antony, Alec, LoongYaFu, Yulian Karapetkov and Siva
Are you going to do a separate pass for event class names? (e.g., radio buttons emit MdRadioChange but mdSort emits just Sort).
Are there any places where the past-tense event name conflicts with another property or method in the class? I recall that being the reason for some members being onSomething
Most of the changes seem fine, but some are off
The datepicker ones seem weird, cc @mmalerba. userSelected is definitely not right.
For tabs, why is focusChange a thing? Wouldn't some combination of focus/blur/focusin/focusout cover everything? Maybe that should be internal. cc @andrewseguin
The @Output names should be prefixed with mdSomething when the directive selector is camelCase. So for e.g. sort, the output name should be mdSortChanged
The actual class property names should all be unprefixed always. So you'd end up with, e.g.,
cc @angular/angular-material since this affects everything
If we move forward with this, it would be good to do one PR per component; this will make it easier to get the changed into Google. For the more widely-used components, we'll probably need a window of backwards compatibility.
For datepicker, selectedChanged and userSelection are used on internal pieces that aren't really meant for users. Those outputs are to help us coordinate behavior among the various sub-components that make up the datepicker popup. selectedChanged is essentially just a de-duped version of userSelection so we can probably use a single Observable and do stream operations to de-dup.
Also dateChange and dateInput on the datepicker input were meant to mimic native input's standard change and input events. I don't know what's more important consistency with those native events or consistency with our other components, but just wanted to point this out.
A note on the valueChange from md-select: that one has to stay as valueChange in order for the two-way binding for value to work. It is already marked as private and we can potentially underscore it.
Sure, I can do a separate pass for that. I wasn't really focusing class names in this but we should def do that too. I actually think they should have some prefix on them, you might end up in a situation where you import 2 different components and lets say they both have a 'Change' event now you would 2 conflicting names.
I think in the case where there is conflicts, it probably needs to be prefixed w/ a _ or better name. I did not check for conflicts during this pass.
As part of the pass, I looked at ALL event names not just externals. So are you suggesting if a event name is used internally but never propagated that we _ it?
On @crisbeto point, the 2 way binding relies on the input names having a suffix of change on them for it to work. We might want to reconsider the past tense given we would deviate from that and have 2 different naming conventions.
Yeah, if an event is only used by us (not meant to be a public API), then it should start with an underscore.
For the event class names, I'd think they should all be something like MdRadioChange, MdSortChange, etc.
In places where we add an output only for two-way binding, can we still get away with marking those as internal (underscore property name, @Output alias for the name that matches).
Proposed selected is already used as a input. Possible alternatives could be: selectedChange, selectedChange, chipSelected, mdChipSelected. Using the change could leverage the 2 way binding standard.
Date Picker
Proposed selectedValueChange feels like it should be Changed to stay w/ the pattern. Also, selectedValueChange might infer there is a selectedValue input based on the angular 2way binding pattern.
Paginator
Proposed page feels like it should be paged. If we were to make it pageChange, we could switch pageIndex to just page and leverage the 2 way binding standard.
Select
Proposed valueChange is already the name of the output. This might infer there is a value input though based on the angular 2-way binding naming standard.
Sidenav
Proposed positionChange, should this be past tense? This also might infer position is 2-way binding naming.
Proposed alignChange, should this be past tense? This also might infer align is 2-way binding naming.
Sort
Proposed mdSortChange, this prefix standard isn't used anywhere else. How about sortChange?
Overall
I feel like using Change as a suffix might infer there is 2-way binding going on. On the other hand, using Change stays with the overall theme but it deviates from the past tense concept. My suggestion would be:
If the name is referring to a value, it should always end in Change. So for example: selectedChange.
If the name is referring to a action, it should always end in past tense since the action has already taken place. Example menuClosed.
If we take the approach for naming actions to past tense it differs in tense from the rule change suffix rule. In the Angular Style Guide rule I mentioned above, they use past tense in that example so I think its the right move but they don't follow that rule with internally w/ the change suffix rule.
We don't necessarily follow the Angular style guide- there's some stuff that I disagree with in there anyway.
I would keep change as present-tense universally
Any directive that uses camelCase properties needs a fully qualified prefix, e.g. mdSortChange. I think this is the only one right now because mdTooltip and mdTextAreaAutosize don't emit any events
I would do selectionChange over selectedChange
I'm not too concerned with people thinking there would be two-way binding; I'm skeptical most people even know that's how two-way binding is set-up.
Ah I see, I didn't realize you were trying to get 2-way binding to work. Ok in that case either opened and openedChange or open and openChange are fine by me
Activity
amcdnl commentedon Sep 3, 2017
Here is my initial audit and proposals before I make any changes.
selecttoselectedonSelect- Angular Style GuideChip
select: Change toselected. Select is a native event emitted when text is selected by the cursor.deselect=>deselected.destroy=>destroyedonRemove=>removedDate Picker
selectedChanged- @jelbourn any reason why this wouldn't just bechanged?userSelection=>userSelecteddateChange=>dateChangedselectedValueChange=>changed?Menu
close=>closedonMenuOpen=>menuOpenedoropenedonMenuClose=>menuClosedorclosedPaginator
page=>pagedSelect
onOpen=>openedonClose=>closedvalueChange=>valueChangedSidenav
onOpen=>openedonClose=>closedonPositionChanged=>positionChangedonAlignChanged=>alignChangedSort
mdSortChange=>mdSortChangedTabs
selectedIndexChange=>selectedIndexChangedfocusChange=>focusChangedselectChange=>selectChangedonCentering=>centeringonCentered=>centered@jelbourn - do we want to convert
changetochanged? Also there is several places that have changed prefixed likemdSortChange, do we want to consolidate those tochangeor would we like to go the other way and prefix everything?jelbourn commentedon Sep 6, 2017
MdRadioChangebutmdSortemits justSort).onSomethinguserSelectedis definitely not right.focusChangea thing? Wouldn't some combination offocus/blur/focusin/focusoutcover everything? Maybe that should be internal. cc @andrewseguin@Outputnames should be prefixed withmdSomethingwhen the directive selector is camelCase. So for e.g. sort, the output name should bemdSortChangedcc @angular/angular-material since this affects everything
If we move forward with this, it would be good to do one PR per component; this will make it easier to get the changed into Google. For the more widely-used components, we'll probably need a window of backwards compatibility.
mmalerba commentedon Sep 6, 2017
For datepicker,
selectedChangedanduserSelectionare used on internal pieces that aren't really meant for users. Those outputs are to help us coordinate behavior among the various sub-components that make up the datepicker popup.selectedChangedis essentially just a de-duped version ofuserSelectionso we can probably use a single Observable and do stream operations to de-dup.Also
dateChangeanddateInputon the datepicker input were meant to mimic native input's standardchangeandinputevents. I don't know what's more important consistency with those native events or consistency with our other components, but just wanted to point this out.jelbourn commentedon Sep 6, 2017
We should mark those two with an
_then.I'd be okay with
dateChangedto be consistent with other components, but I'd leavedateInput(since "input" is acceptable for past-tense as well)crisbeto commentedon Sep 6, 2017
A note on the
valueChangefrommd-select: that one has to stay asvalueChangein order for the two-way binding forvalueto work. It is already marked as private and we can potentially underscore it.amcdnl commentedon Sep 6, 2017
@jelbourn -
_or better name. I did not check for conflicts during this pass._it?On @crisbeto point, the 2 way binding relies on the input names having a suffix of
changeon them for it to work. We might want to reconsider the past tense given we would deviate from that and have 2 different naming conventions.jelbourn commentedon Sep 6, 2017
Yeah, if an event is only used by us (not meant to be a public API), then it should start with an underscore.
For the event class names, I'd think they should all be something like
MdRadioChange,MdSortChange, etc.In places where we add an output only for two-way binding, can we still get away with marking those as internal (underscore property name,
@Outputalias for the name that matches).amcdnl commentedon Sep 7, 2017
Are we good to move forward?
@jelbourn - Do you want these in distinct PRs for each component? Should I support backwards compatibility?
mmalerba commentedon Sep 7, 2017
+1 to
*Changeinstead of*Changed, shorter & works with 2-way binding syntaxjelbourn commentedon Sep 7, 2017
Maybe saying always past-tense is overboard.
How about
Chip
select: =>selecteddeselect=>deselecteddestroy=>destroyedonRemove=>removedDate Picker
selectedChanged-_selectedChanged(internal)userSelection=>_userSelection(internal)dateChangedateInputselectedValueChangeMenu
close=>closedonMenuOpen=>menuOpenedonMenuClose=>menuClosedPaginator
pageSelect
onOpen=>openedonClose=>closedvalueChangeSidenav
onOpen=>openedonClose=>closedonPositionChanged=>positionChangeonAlignChanged=>alignChangeSort
mdSortChangeTabs
selectedIndexChangefocusChange=>_focusChange(internal)selectChange=>selectedTabChangeonCentering=>_onCentering(internal)onCentered=>_onCentered(internal)So every
somethingChangestays the same.amcdnl commentedon Sep 11, 2017
My thoughts from the suggestions:
Chip
selectedis already used as a input. Possible alternatives could be:selectedChange,selectedChange,chipSelected,mdChipSelected. Using thechangecould leverage the 2 way binding standard.Date Picker
selectedValueChangefeels like it should beChangedto stay w/ the pattern. Also,selectedValueChangemight infer there is aselectedValueinput based on the angular 2way binding pattern.Paginator
pagefeels like it should bepaged. If we were to make itpageChange, we could switchpageIndexto justpageand leverage the 2 way binding standard.Select
valueChangeis already the name of the output. This might infer there is avalueinput though based on the angular 2-way binding naming standard.Sidenav
positionChange, should this be past tense? This also might inferpositionis 2-way binding naming.alignChange, should this be past tense? This also might inferalignis 2-way binding naming.Sort
mdSortChange, this prefix standard isn't used anywhere else. How aboutsortChange?Overall
I feel like using
Changeas a suffix might infer there is 2-way binding going on. On the other hand, usingChangestays with the overall theme but it deviates from the past tense concept. My suggestion would be:Change. So for example:selectedChange.menuClosed.If we take the approach for naming actions to past tense it differs in tense from the rule
changesuffix rule. In the Angular Style Guide rule I mentioned above, they use past tense in that example so I think its the right move but they don't follow that rule with internally w/ thechangesuffix rule.jelbourn commentedon Sep 11, 2017
We don't necessarily follow the Angular style guide- there's some stuff that I disagree with in there anyway.
changeas present-tense universallymdSortChange. I think this is the only one right now because mdTooltip and mdTextAreaAutosize don't emit any eventsselectionChangeoverselectedChange13 remaining items
mmalerba commentedon Sep 19, 2017
Ah I see, I didn't realize you were trying to get 2-way binding to work. Ok in that case either
openedandopenedChangeoropenandopenChangeare fine by mechore(chips): update chip output names for consistency (#7156)
chore(api): new output api angular#6677
chore(api): new output api #6677 (#7450)
fix(select): make @output names consistent angular#6677
fix(menu): make @output names consistent angular#6677
fix(menu): make @output names consistent #6677
fix(select): make @output names consistent #6677
fix(menu): make @output names consistent #6677 (#8053)
fix(select): make @output names consistent #6677 (#8052)
angular-automatic-lock-bot commentedon Sep 7, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.