-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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(selection-list): Selection-list initial version all code(without demo) #5562
feat(selection-list): Selection-list initial version all code(without demo) #5562
Conversation
src/lib/list/list-option.html
Outdated
@@ -0,0 +1,11 @@ | |||
<div [ngClass]="(checkboxPosition == 'before')?'mat-list-item-content' : 'mat-list-item-content-reverse'" > | |||
<!--<div class="mat-list-item-content">--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented out code
src/lib/list/list.ts
Outdated
@@ -175,3 +204,122 @@ export class MdListItem implements AfterContentInit { | |||
return this._element.nativeElement; | |||
} | |||
} | |||
|
|||
@Component({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class needs a JsDoc description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added doc for 'md-selection-option'
src/lib/list/list-option.html
Outdated
@@ -0,0 +1,11 @@ | |||
<div [ngClass]="(checkboxPosition == 'before')?'mat-list-item-content' : 'mat-list-item-content-reverse'" > |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using ngClass
and applying one of two classes, you should be able to have the default styles always applied and then apply the "reverse" styles when the condition is met like this:
<div [class.mat-list-option-reverse]="checkboxPosition == 'after'">
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed '[ngClass]' to '<div [class.mat-list-option-reverse]="checkboxPosition == 'after'">'
src/lib/list/list.ts
Outdated
|
||
@Input() checkboxPosition: 'before' | 'after' = 'after'; | ||
|
||
@ViewChild('autocheckbox') pCheckbox; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need this @ViewChild
(and all associated code), since the state of the pseudo-checkbox should be set via binding in the template
src/lib/list/list.ts
Outdated
constructor(private _renderer: Renderer2, | ||
private _element: ElementRef, | ||
@Optional() private _slist: MdSelectionList, | ||
@Optional() navList: MdNavListCssMatStyler, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this deal with a nav-list? MdListOption
should only be used in a selection list. Getting rid of this should let you also get rid of _isNavList
and _isSelectionList
(should be assumed that this is always inside of a selection list)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted navList in selection-list-option
src/lib/list/list.ts
Outdated
console.log('checked or not: ' + this.pCheckbox.state + ', isSelected or not: ' + this.isSelected); | ||
if(this.isSelected == false) { | ||
this.isSelected = true; | ||
this.selectionList.checkedItems.select(this._element.nativeElement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than using the HTMLElement
as the selected value, it should use either the option itself (this
).
src/lib/list/list.ts
Outdated
}) | ||
export class MdSelectionListCheckboxer { | ||
|
||
checkedItems: SelectionModel<HTMLElement> = new SelectionModel<HTMLElement>(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checkedItems
-> _selectedOptions
This property should also live directly on MdSelectionList
(you shouldn't need this class at all)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed checkedItems
to selectedOptions
. And deleted MdSelectionListCheckboxer
class
src/lib/list/list.ts
Outdated
styleUrls: ['list.css'], | ||
encapsulation: ViewEncapsulation.None | ||
}) | ||
export class MdSelectionList { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In another PR after this one, we'll need to add support for the MdSelectionList
being a form control, similar to the md-select
src/lib/list/list.ts
Outdated
selector: 'md-selection-list, mat-selection-list', | ||
host: {'class': 'mat-selection-list'} | ||
}) | ||
export class MdSelectionListCssMatStyler {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need this class; you can add the mat-selection-list
class in MdSelectionList
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted 'MdSelectionListCssMatStyler' class.
src/lib/list/list.ts
Outdated
'(click)': 'onchange()', | ||
'(keydown)':'onKeydown($event)', | ||
'[tabIndex]': 'disabled ? -1 : 0', | ||
'[attr.aria-selected]': '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing binding expression for aria-selected
. The expression needs to resolve to a string of either 'true'
or 'false'
(see how existing MdOption
does this).
You'll also need a binding for aria-disabled
based on the disabled state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added binding expression for 'attr.aria-selected' and 'attr.aria-disabled'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments addressed. Please take another look 👍
src/lib/list/list.ts
Outdated
private _disableRipple: boolean = false; | ||
private _isNavList: boolean = false; | ||
private _isSelectionList: boolean = false; | ||
isSelected: boolean = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed isSelected
to selected
. And added @Input(selected)
for it.(Using coerceBooleanProperty
)
src/lib/list/list.ts
Outdated
|
||
constructor(private _renderer: Renderer2, | ||
private _element: ElementRef, | ||
@Optional() private _slist: MdSelectionList, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed _slist
to selectionList
and deleted MdSelectionListCheckboxer
class
src/lib/list/list.ts
Outdated
constructor(private _renderer: Renderer2, | ||
private _element: ElementRef, | ||
@Optional() private _slist: MdSelectionList, | ||
@Optional() navList: MdNavListCssMatStyler, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted navList in selection-list-option
src/lib/list/list.ts
Outdated
this._lineSetter = new MdLineSetter(this._lines, this._renderer, this._element); | ||
} | ||
|
||
onchange(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed 'onchange()' to 'toggle()' and added doc for it.
src/lib/list/list.ts
Outdated
}) | ||
export class MdSelectionListCheckboxer { | ||
|
||
checkedItems: SelectionModel<HTMLElement> = new SelectionModel<HTMLElement>(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed checkedItems
to selectedOptions
. And deleted MdSelectionListCheckboxer
class
src/lib/list/list.ts
Outdated
} | ||
|
||
onchange(): void { | ||
console.log('checked or not: ' + this.pCheckbox.state + ', isSelected or not: ' + this.isSelected); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed console.log
src/lib/list/list.ts
Outdated
selector: 'md-list-option', | ||
host: { | ||
'role': 'option', | ||
'class': 'mat-list-item', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add mat-list-option
to this as well it will be easier to write styles for the option specifically. For example, instead of .mat-selection-list .mat-list-item
you could just have mat-list-option
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added .mat-list-option
class in css files
src/lib/list/list.scss
Outdated
padding: 0 $mat-list-side-padding; | ||
position: relative; | ||
flex-direction: row-reverse; | ||
-webkit-justify-content: space-around; /* Safari */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need the -webkit-justify-content
, since Safari 9 and 10 both support all of the flex properties unprefixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure~
Deleted -webkit-justify-content
in CSS file
src/lib/list/list.scss
Outdated
@@ -43,6 +43,19 @@ $mat-dense-list-icon-size: 20px; | |||
position: relative; | |||
} | |||
|
|||
.mat-list-item-content-reverse { | |||
display: flex; | |||
//flex-direction: row; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed commented line
<md-pseudo-checkbox [state]="selected ? 'checked' : 'unchecked'" #autocheckbox [disabled]="disabled"></md-pseudo-checkbox> | ||
<div class="mat-list-text"><ng-content></ng-content></div> | ||
|
||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you configure your IDE to add newlines at the end of files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new line at each file
src/lib/list/list.scss
Outdated
@@ -60,18 +73,18 @@ $mat-dense-list-icon-size: 20px; | |||
height: $avatar-height; | |||
} | |||
|
|||
&.mat-2-line .mat-list-item-content { | |||
&.mat-2-line .mat-list-item-content .mat-list-item-content-reverse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need to add mat-list-item-content-reverse
to these existing styles; the mat-list-item-content-reverse
class should only have the extra styles you need to reverse the display
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted 'mat-list-item-content-reverse' to these existing styles;
src/lib/list/list.ts
Outdated
this.selectionList.selectedOptions.deselect(this); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The toggle function by itself can just be
toggle() {
this.selected = !this.selected;
this.selectionList.selectedOption.toggle(this);
}
The logic that a disabled option should do anything on click should be specifically tied to the click handler rather than being in the more general toggle()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Great!
src/lib/list/list.ts
Outdated
host: {'role': 'listbox', | ||
'[attr.tabindex]': '_tabIndex', | ||
'class': 'mat-selection-list', | ||
// Events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for category comments inside host
; the different syntax makes it clear enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
@Component({ | ||
moduleId: module.id, | ||
selector: 'md-selection-list, mat-selection-list', | ||
host: {'role': 'listbox', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Format like
host: {
'role': 'listbox',
...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
options: QueryList<MdListOption>; | ||
|
||
// options which are selected. | ||
selectedOptions: SelectionModel<any> = new SelectionModel<any>(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SelectionModel<MdListOption>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
// Always prevent space from scrolling the page since the list has focus | ||
event.preventDefault(); | ||
break; | ||
case LEFT_ARROW: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The selection-list shouldn't need shortcuts for left/right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted shortcuts for left/right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments Addressed~. Please take another look~ 👍
<md-pseudo-checkbox [state]="selected ? 'checked' : 'unchecked'" #autocheckbox [disabled]="disabled"></md-pseudo-checkbox> | ||
<div class="mat-list-text"><ng-content></ng-content></div> | ||
|
||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new line at each file
src/lib/list/list.scss
Outdated
@@ -43,6 +43,19 @@ $mat-dense-list-icon-size: 20px; | |||
position: relative; | |||
} | |||
|
|||
.mat-list-item-content-reverse { | |||
display: flex; | |||
//flex-direction: row; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed commented line
src/lib/list/list.scss
Outdated
padding: 0 $mat-list-side-padding; | ||
position: relative; | ||
flex-direction: row-reverse; | ||
-webkit-justify-content: space-around; /* Safari */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure~
Deleted -webkit-justify-content
in CSS file
src/lib/list/list.scss
Outdated
@@ -60,18 +73,18 @@ $mat-dense-list-icon-size: 20px; | |||
height: $avatar-height; | |||
} | |||
|
|||
&.mat-2-line .mat-list-item-content { | |||
&.mat-2-line .mat-list-item-content .mat-list-item-content-reverse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted 'mat-list-item-content-reverse' to these existing styles;
src/lib/list/list.scss
Outdated
@@ -182,3 +195,31 @@ $mat-dense-list-icon-size: 20px; | |||
} | |||
} | |||
} | |||
|
|||
.mat-selection-list { | |||
a { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted <a>
element
src/lib/list/list.ts
Outdated
this.selectionList.selectedOptions.deselect(this); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Great!
src/lib/list/list.ts
Outdated
@Component({ | ||
moduleId: module.id, | ||
selector: 'md-selection-list, mat-selection-list', | ||
host: {'role': 'listbox', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
host: {'role': 'listbox', | ||
'[attr.tabindex]': '_tabIndex', | ||
'class': 'mat-selection-list', | ||
// Events |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
options: QueryList<MdListOption>; | ||
|
||
// options which are selected. | ||
selectedOptions: SelectionModel<any> = new SelectionModel<any>(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
// Always prevent space from scrolling the page since the list has focus | ||
event.preventDefault(); | ||
break; | ||
case LEFT_ARROW: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted shortcuts for left/right
package-lock.json
Outdated
@@ -305,6 +305,26 @@ | |||
"integrity": "sha1-dO6TaJbaXkU8NBzygEQ0LBqazrc=", | |||
"dev": true | |||
}, | |||
"@gulp-sourcemaps/identity-map": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Reverted~
src/lib/list/list.scss
Outdated
@@ -182,3 +214,8 @@ $mat-dense-list-icon-size: 20px; | |||
} | |||
} | |||
} | |||
|
|||
.mat-selection-list { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted that empty class
src/lib/list/list.ts
Outdated
@@ -159,7 +501,8 @@ export class MdListItem implements AfterContentInit { | |||
|
|||
/** Whether this list item should show a ripple effect when clicked. */ | |||
isRippleEnabled() { | |||
return !this.disableRipple && this._isNavList && !this._list.disableRipple; | |||
return !this.disableRipple && (this._isNavList) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted changes
src/lib/list/list.ts
Outdated
import {CommonModule} from '@angular/common'; | ||
import {coerceBooleanProperty, MdLine, MdLineSetter, MdPseudoCheckbox, MdSelectionModule, SelectionModel} from '../core'; | ||
import {FocusKeyManager} from '../core/a11y/focus-key-manager'; | ||
import {MdCheckbox} from '../checkbox'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unused imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed unused imports
src/lib/list/list.ts
Outdated
'[attr.aria-disabled]': 'disabled.toString()', | ||
}, | ||
templateUrl: 'list-option.html', | ||
encapsulation: ViewEncapsulation.None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we also make this changeDetection: ChangeDetectionStrategy.OnPush
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make md-list-option
'changeDetection: ChangeDetectionStrategy.OnPush
', add chengeDetector
src/lib/list/list.ts
Outdated
/** The option components contained within this selection-list. */ | ||
options: QueryList<MdListOption>; | ||
|
||
// options which are selected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: use /** */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
|
||
/** | ||
* Whether the ripple effect should be disabled on the list-items or not. | ||
* This flag only has an effect for `md-nav-list` components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mat-selection-list
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes~ 👍 it's should be mat-selection-list
src/lib/list/list.ts
Outdated
get disableRipple() { return this._disableRipple; } | ||
set disableRipple(value: boolean) { this._disableRipple = coerceBooleanProperty(value); } | ||
|
||
// Whether the selection-list is disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Use /**
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
this._subscribeOptions(this.options); | ||
|
||
// When the list changes, re-subscribe | ||
this.options.changes.subscribe((options: QueryList<MdListOption>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also unsubscribe this in ngOnDestroy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added unsubscribe for 'this.options.changes.subscribe((options: QueryList)' in onDistory();
src/lib/list/list.ts
Outdated
switch (event.keyCode) { | ||
case SPACE: | ||
// If we are selectable, toggle the focused option | ||
if (this.selectable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove this if
since you check this.selectable
in _toggleSelectOnFocusedOption
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Removed if (this.selectable)
check
ab78883
to
8524538
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments Addressed~ Please take another look 👍
src/lib/list/list.scss
Outdated
@@ -182,3 +214,8 @@ $mat-dense-list-icon-size: 20px; | |||
} | |||
} | |||
} | |||
|
|||
.mat-selection-list { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted that empty class
src/lib/list/list.ts
Outdated
import {CommonModule} from '@angular/common'; | ||
import {coerceBooleanProperty, MdLine, MdLineSetter, MdPseudoCheckbox, MdSelectionModule, SelectionModel} from '../core'; | ||
import {FocusKeyManager} from '../core/a11y/focus-key-manager'; | ||
import {MdCheckbox} from '../checkbox'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed unused imports
src/lib/list/list.ts
Outdated
'[attr.aria-disabled]': 'disabled.toString()', | ||
}, | ||
templateUrl: 'list-option.html', | ||
encapsulation: ViewEncapsulation.None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make md-list-option
'changeDetection: ChangeDetectionStrategy.OnPush
', add chengeDetector
src/lib/list/list.ts
Outdated
/** The option components contained within this selection-list. */ | ||
options: QueryList<MdListOption>; | ||
|
||
// options which are selected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
|
||
/** | ||
* Whether the ripple effect should be disabled on the list-items or not. | ||
* This flag only has an effect for `md-nav-list` components. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes~ 👍 it's should be mat-selection-list
src/lib/list/list.ts
Outdated
get disableRipple() { return this._disableRipple; } | ||
set disableRipple(value: boolean) { this._disableRipple = coerceBooleanProperty(value); } | ||
|
||
// Whether the selection-list is disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
this._subscribeOptions(this.options); | ||
|
||
// When the list changes, re-subscribe | ||
this.options.changes.subscribe((options: QueryList<MdListOption>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added unsubscribe for 'this.options.changes.subscribe((options: QueryList)' in onDistory();
src/lib/list/list.ts
Outdated
switch (event.keyCode) { | ||
case SPACE: | ||
// If we are selectable, toggle the focused option | ||
if (this.selectable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Removed if (this.selectable)
check
src/lib/list/list.ts
Outdated
@@ -159,7 +501,8 @@ export class MdListItem implements AfterContentInit { | |||
|
|||
/** Whether this list item should show a ripple effect when clicked. */ | |||
isRippleEnabled() { | |||
return !this.disableRipple && this._isNavList && !this._list.disableRipple; | |||
return !this.disableRipple && (this._isNavList) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted changes
src/lib/list/list.ts
Outdated
get disabled() { return (this.selectionList && this.selectionList.disabled) || this._disabled; } | ||
set disabled(value: any) { this._disabled = coerceBooleanProperty(value); } | ||
|
||
@Input('value') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use @Input()
here
src/lib/list/list.ts
Outdated
get value() { return this._value; } | ||
set value( val: any) { this._value = coerceBooleanProperty(val); } | ||
|
||
@Input('selected') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
src/lib/list/list.ts
Outdated
toggle(): void { | ||
if(this._disabled == false) { | ||
this.selected = !this.selected; | ||
this._changeDetector.markForCheck(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need markForCheck
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the position of markForCheck
to the end of this function
src/lib/list/list.ts
Outdated
|
||
_handleFocus() { | ||
this._hasFocus = true; | ||
this._renderer.addClass(this._element.nativeElement, 'mat-list-item-focus'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: make mat-list-item-focus
a const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added const 'FOCUSED_STYLE'
src/lib/list/_list-theme.scss
Outdated
@@ -29,6 +33,22 @@ | |||
background: mat-color($background, 'hover'); | |||
} | |||
} | |||
|
|||
.mat-selection-list .mat-list-item { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these styles just be moved to .mat-list-option
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved styles in .mat-selection-list .mat-list-item
to .mat-list-option
src/lib/list/list.scss
Outdated
position: relative; | ||
flex-direction: row-reverse; | ||
justify-content: space-around; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do position, box-sizing, and height need to be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted position, box-sizing, and height
src/lib/list/list.ts
Outdated
|
||
/** Whether the label should appear after or before the checkbox. Defaults to 'after' */ | ||
|
||
@Input() checkboxPosition: 'before' | 'after' = 'after'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tested this in RTL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it works.
src/lib/list/list.ts
Outdated
@ContentChildren(MdLine) _lines: QueryList<MdLine>; | ||
|
||
/** Whether the label should appear after or before the checkbox. Defaults to 'after' */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omit blank line between JsDoc and the property it describes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
|
||
@Input() checkboxPosition: 'before' | 'after' = 'after'; | ||
|
||
/** Whether the checkbox is disabled. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"checkbox" -> "option"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
// otherwise pass to our key manager | ||
if (target && (target.classList.contains('mat-selection-list') || | ||
target.classList.contains('mat-list-item') || | ||
target.classList.contains('mat-list-option'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this check on the target? If this component receives a keydown, don't you always want to handle it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted check on the target.
src/lib/list/list.ts
Outdated
|
||
let focusedIndex = this._keyManager.activeItemIndex; | ||
|
||
if (typeof focusedIndex === 'number' && this._isValidIndex(focusedIndex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need this typeof
check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because focusedIndex = this._keyManager.activeItemIndex
and the type of keyManager.activeItemIndex
is 'number | null
'. If I do not check typeof
, it will run out an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check whether focusedIndex is null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, checking for == null
is more typical
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to check 'focusedIndex != null'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments Addressed. Please take another look 👍
src/lib/list/_list-theme.scss
Outdated
@@ -29,6 +33,22 @@ | |||
background: mat-color($background, 'hover'); | |||
} | |||
} | |||
|
|||
.mat-selection-list .mat-list-item { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved styles in .mat-selection-list .mat-list-item
to .mat-list-option
src/lib/list/list.scss
Outdated
position: relative; | ||
flex-direction: row-reverse; | ||
justify-content: space-around; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted position, box-sizing, and height
src/lib/list/list.ts
Outdated
@ContentChildren(MdLine) _lines: QueryList<MdLine>; | ||
|
||
/** Whether the label should appear after or before the checkbox. Defaults to 'after' */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
|
||
/** Whether the label should appear after or before the checkbox. Defaults to 'after' */ | ||
|
||
@Input() checkboxPosition: 'before' | 'after' = 'after'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it works.
src/lib/list/list.ts
Outdated
|
||
@Input() checkboxPosition: 'before' | 'after' = 'after'; | ||
|
||
/** Whether the checkbox is disabled. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list.ts
Outdated
// otherwise pass to our key manager | ||
if (target && (target.classList.contains('mat-selection-list') || | ||
target.classList.contains('mat-list-item') || | ||
target.classList.contains('mat-list-option'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleted check on the target.
src/lib/list/list.ts
Outdated
|
||
let focusedIndex = this._keyManager.activeItemIndex; | ||
|
||
if (typeof focusedIndex === 'number' && this._isValidIndex(focusedIndex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because focusedIndex = this._keyManager.activeItemIndex
and the type of keyManager.activeItemIndex
is 'number | null
'. If I do not check typeof
, it will run out an error.
src/lib/list/list.ts
Outdated
'(focus)': 'focus()', | ||
'(keydown)': 'keydown($event)'}, | ||
queries: { | ||
options: new ContentChildren(MdListOption) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you add queries
here instead of using @ContentChildren
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to use @ContentChildren
src/lib/list/list.ts
Outdated
|
||
let focusedIndex = this._keyManager.activeItemIndex; | ||
|
||
if (typeof focusedIndex === 'number' && this._isValidIndex(focusedIndex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, checking for == null
is more typical
src/lib/list/list.ts
Outdated
encapsulation: ViewEncapsulation.None, | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class MdSelectionList implements AfterContentInit, OnDestroy { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can md-selection-list
and md-list-option
go in separate files? (selection-list.ts
and list-option.ts
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 made md-selection-list
and md-list-option
go in separate files? (selection-list.ts
and list-option.ts
)
Comments Addressed 👍 |
src/lib/list/selection-list.ts
Outdated
'[attr.tabindex]': '_tabIndex', | ||
'class': 'mat-selection-list', | ||
'(focus)': 'focus()', | ||
'(keydown)': 'keydown($event)'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a binding for aria-disabled
to reflect its disabled state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Binded aria-disabled
src/lib/list/selection-list.ts
Outdated
selector: 'md-selection-list, mat-selection-list', | ||
host: { | ||
'role': 'listbox', | ||
'[attr.tabindex]': '_tabIndex', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tabindex
should be -1
when the selection-list is disabled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Set The tabindex of list option as -1 when the selection-list is disabled
src/lib/list/selection-list.ts
Outdated
/** Whether the selection-list is disabled */ | ||
@Input() | ||
get disabled() { return this._disabled; } | ||
set disabled(value: any) { this._disabled = coerceBooleanProperty(value); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of defining the disabled
getter/setter yourself, you can include it via mixin. Check out button.ts
for an example of how to apply a mixin (there's some boilerplate involved but it ultimately reduces code duplication).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied mixin on disabled
👍
src/lib/list/selection-list.ts
Outdated
// it back to the first option when the user tabs out. | ||
this._tabOutSubscription = this._keyManager.tabOut.subscribe(() => { | ||
this._tabIndex = -1; | ||
setTimeout(() => this._tabIndex = 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you're doing this with tabindex. AFAIK, the tabindex
of the selection list should always be 0
if it is enabled and -1
if it is disabled. The individual options should all have tabindex="-1"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this part is not being needed. I've deleted this part
src/lib/list/selection-list.ts
Outdated
private _tabOutSubscription: Subscription; | ||
|
||
/** Subscription to option changes from the selection-list. */ | ||
private _optionSubscription: Subscription; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe _optionsChangeSubscription
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed to '_optionsChangeSubscription
'
src/lib/list/selection-list.ts
Outdated
get selectable(): boolean { return this._selectable; } | ||
set selectable(value: boolean) { | ||
this._selectable = coerceBooleanProperty(value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this selectable
property is in the wrong class, but also not necessary for option
and should probably be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed selectable
property
src/lib/list/list.scss
Outdated
@@ -139,10 +147,20 @@ $mat-dense-list-icon-size: 20px; | |||
$mat-list-icon-size | |||
); | |||
} | |||
|
|||
.mat-list-option { | |||
@include mat-line-base( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean mat-list-item-base
here? The mat-line-base
mixin only takes one arg, so this will prevent it from building.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! It should be mat-list-item-base
src/lib/list/list-option.ts
Outdated
selector: 'md-list-option, mat-list-option', | ||
host: { | ||
'role': 'option', | ||
'class': 'mat-list-item, mat-list-option', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comma is a typo? Don't want a comma between class names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 change ['class': 'mat-list-item, mat-list-option',] to ['class': 'mat-list-item mat-list-option',]; Removed the comma between class names.
src/lib/list/list-option.ts
Outdated
|
||
/** | ||
* Whether the ripple effect on click should be disabled. This applies only to list items that are | ||
* part of a nav list. The value of `disableRipple` on the `md-nav-list` overrides this flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List-options are only on selection-lists, right? The comment talks about nav lists, so it looks like this might need to be updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the comments.
src/lib/list/selection-list.ts
Outdated
|
||
/** | ||
* Whether or not this option is selectable. When a option is not selectable, | ||
* it's selected state is always ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: it's
-> its
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/selection-list.ts
Outdated
option.onFocus.subscribe(() => { | ||
let optionIndex: number = this.options.toArray().indexOf(option); | ||
|
||
if (this._isValidIndex(optionIndex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the validity of the index necessary to check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Deleted unnecessaey this._isValidIndex(optionIndex)
check
src/lib/list/selection-list.ts
Outdated
*/ | ||
protected _addOption(option: MdListOption) { | ||
// If we've already been subscribed to a parent, do nothing | ||
if (this._subscribed.has(option)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Finally make it work.
@kara @tinayuangao Thank you so much for your help~~! 🥇
43b88c6
to
ba0d581
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments Addressed 👍
Please take another look.
src/lib/list/selection-list.ts
Outdated
selector: 'md-selection-list, mat-selection-list', | ||
host: { | ||
'role': 'listbox', | ||
'[attr.tabindex]': '_tabIndex', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Set The tabindex of list option as -1 when the selection-list is disabled
src/lib/list/list-option.ts
Outdated
selector: 'md-list-option, mat-list-option', | ||
host: { | ||
'role': 'option', | ||
'class': 'mat-list-item, mat-list-option', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 change ['class': 'mat-list-item, mat-list-option',] to ['class': 'mat-list-item mat-list-option',]; Removed the comma between class names.
src/lib/list/list-option.ts
Outdated
|
||
/** | ||
* Whether the ripple effect on click should be disabled. This applies only to list items that are | ||
* part of a nav list. The value of `disableRipple` on the `md-nav-list` overrides this flag. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated the comments.
src/lib/list/list.scss
Outdated
@@ -139,10 +147,20 @@ $mat-dense-list-icon-size: 20px; | |||
$mat-list-icon-size | |||
); | |||
} | |||
|
|||
.mat-list-option { | |||
@include mat-line-base( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! It should be mat-list-item-base
src/lib/list/selection-list.ts
Outdated
'[attr.tabindex]': '_tabIndex', | ||
'class': 'mat-selection-list', | ||
'(focus)': 'focus()', | ||
'(keydown)': 'keydown($event)'}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Binded aria-disabled
src/lib/list/selection-list.ts
Outdated
|
||
/** | ||
* Whether or not this option is selectable. When a option is not selectable, | ||
* it's selected state is always ignored. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/selection-list.ts
Outdated
/** Whether the selection-list is disabled */ | ||
@Input() | ||
get disabled() { return this._disabled; } | ||
set disabled(value: any) { this._disabled = coerceBooleanProperty(value); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied mixin on disabled
👍
src/lib/list/selection-list.ts
Outdated
get selectable(): boolean { return this._selectable; } | ||
set selectable(value: boolean) { | ||
this._selectable = coerceBooleanProperty(value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed selectable
property
src/lib/list/selection-list.ts
Outdated
option.onFocus.subscribe(() => { | ||
let optionIndex: number = this.options.toArray().indexOf(option); | ||
|
||
if (this._isValidIndex(optionIndex)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Deleted unnecessaey this._isValidIndex(optionIndex)
check
src/lib/list/selection-list.ts
Outdated
*/ | ||
protected _addOption(option: MdListOption) { | ||
// If we've already been subscribed to a parent, do nothing | ||
if (this._subscribed.has(option)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Finally make it work.
@kara @tinayuangao Thank you so much for your help~~! 🥇
9c2d9d6
to
a97c924
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No other major comments on the implementation, just needs unit tests now
src/lib/list/selection-list.ts
Outdated
import {merge} from 'rxjs/operator/merge'; | ||
import {Observable} from 'rxjs/Observable'; | ||
import 'rxjs/add/operator/switchMap'; | ||
import 'rxjs/add/operator/startWith'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main components can't use the rxjs /add/
imports (and there should be a lint failure for doing so). You can use RxChain
instead
It looks like you have some other lint errors as well; you can see them locally with gulp tslint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to use 'RxChain
' instead of directly importing 'observer/add/
'Changed to use 'RxChain' instead of directly importing 'observer/add/'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/lib/list/_list-theme.scss
Outdated
.mat-subheader { | ||
@include mat-typography-level-to-styles($config, body-2); | ||
} | ||
|
||
.mat-list-item-disabled { | ||
background: #ededed; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This color needs to take whether we're in a light or dark theme into account; ideally it would come from the background color palette on the theme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to background-color: mat-color($background, disabled-list-option);
src/lib/list/list-option.ts
Outdated
} | ||
|
||
toggle(): void { | ||
if (this._disabled == false && this.selectionList.disabled == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need to compare against false; you would just do
if (!this.disabled) {
...
}
(the disabled getter already takes the selectionList state into account)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 changed to :
if (!this.disabled) {
...
}
src/lib/list/list-option.ts
Outdated
this._lineSetter = new MdLineSetter(this._lines, this._renderer, this._element); | ||
|
||
if (this.selectionList.disabled) { | ||
this._disabled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better not to mutate the option disabled state based on the parent state; this can be error prone, as it's easy to miss updating one when the other changes. It's better to rely on the disabled getter for the option to account for the parent state.
src/lib/list/list-option.ts
Outdated
onFocus = new EventEmitter<MdSelectionListOptionEvent>(); | ||
|
||
/** Emitted when the option is selected. */ | ||
@Output() select = new EventEmitter<MdSelectionListOptionEvent>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select
-> selected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems selected
has already been defined.
@Input()
get selected() { return this._selected; }
set selected( val: boolean) { this._selected = coerceBooleanProperty(val); }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or rename it to selectChange
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to selectChange
src/lib/list/list-option.ts
Outdated
@Output() select = new EventEmitter<MdSelectionListOptionEvent>(); | ||
|
||
/** Emitted when the option is deselected. */ | ||
@Output() deselect = new EventEmitter<MdSelectionListOptionEvent>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deselect
-> deselected
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed deselect -> deselected
src/lib/list/selection-list.ts
Outdated
/** | ||
* Map all the options' destroy event subscriptions and merge them into one stream. | ||
*/ | ||
onDestroySubscription(): Subscription { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed it to 'private _onDestroySubscription()'
src/lib/list/selection-list.ts
Outdated
/** | ||
* Map all the options' onFocus event subscriptions and merge them into one stream. | ||
*/ | ||
onFocusSubscription(): Subscription { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to 'private _onFocusSubscription()'
src/lib/list/selection-list.ts
Outdated
} | ||
|
||
/** Passes relevant key presses to our key manager. */ | ||
keydown(event: KeyboardEvent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be internal (start with an _
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to '_keydown'
src/lib/list/selection-list.ts
Outdated
} | ||
|
||
/** Toggles the selected state of the currently focused option. */ | ||
protected _toggleSelectOnFocusedOption(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method should be private
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to 'private'
src/lib/list/selection-list.spec.ts
Outdated
import {UP_ARROW, DOWN_ARROW, SPACE} from '../core/keyboard/keycodes'; | ||
import {Platform} from '../core/platform/index'; | ||
|
||
describe('test normal selection list with list option', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can wrap all of these child describe
blocks in one top-level block:
describe('MdSelectionList', () => {
...
});
Then, each describe block has a name that modifies the selection list, e.g.
describe('MdSelectionList', () => {
describe('with multiple options', () => {
...
});
describe('with one option', () => {
...
});
describe('with disabled state', () => {
...
});
});
This will make the test failures report like
MdSelectionList with one option should select an option
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed the structure like that~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments Addressed 👍
Please take another look
src/lib/list/list-option.ts
Outdated
onFocus = new EventEmitter<MdSelectionListOptionEvent>(); | ||
|
||
/** Emitted when the option is selected. */ | ||
@Output() select = new EventEmitter<MdSelectionListOptionEvent>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems selected
has already been defined.
@Input()
get selected() { return this._selected; }
set selected( val: boolean) { this._selected = coerceBooleanProperty(val); }
src/lib/list/list-option.ts
Outdated
@Output() select = new EventEmitter<MdSelectionListOptionEvent>(); | ||
|
||
/** Emitted when the option is deselected. */ | ||
@Output() deselect = new EventEmitter<MdSelectionListOptionEvent>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed deselect -> deselected
src/lib/list/list-option.ts
Outdated
@Output() deselect = new EventEmitter<MdSelectionListOptionEvent>(); | ||
|
||
/** Emitted when the option is destroyed. */ | ||
@Output() destroy = new EventEmitter<MdSelectionListOptionEvent>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
src/lib/list/list-option.ts
Outdated
} | ||
|
||
toggle(): void { | ||
if (this._disabled == false && this.selectionList.disabled == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 changed to :
if (!this.disabled) {
...
}
src/lib/list/list-option.ts
Outdated
this._lineSetter = new MdLineSetter(this._lines, this._renderer, this._element); | ||
|
||
if (this.selectionList.disabled) { | ||
this._disabled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to :
if (!this.disabled) {
...
}
src/lib/list/selection-list.spec.ts
Outdated
import {UP_ARROW, DOWN_ARROW, SPACE} from '../core/keyboard/keycodes'; | ||
import {Platform} from '../core/platform/index'; | ||
|
||
describe('test normal selection list with list option', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed the structure like that~
src/lib/list/selection-list.ts
Outdated
/** | ||
* Map all the options' destroy event subscriptions and merge them into one stream. | ||
*/ | ||
onDestroySubscription(): Subscription { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed it to 'private _onDestroySubscription()'
src/lib/list/selection-list.ts
Outdated
/** | ||
* Map all the options' onFocus event subscriptions and merge them into one stream. | ||
*/ | ||
onFocusSubscription(): Subscription { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to 'private _onFocusSubscription()'
src/lib/list/selection-list.ts
Outdated
} | ||
|
||
/** Passes relevant key presses to our key manager. */ | ||
keydown(event: KeyboardEvent) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to '_keydown'
src/lib/list/selection-list.ts
Outdated
} | ||
|
||
/** Toggles the selected state of the currently focused option. */ | ||
protected _toggleSelectOnFocusedOption(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to 'private'
src/lib/core/theming/_palette.scss
Outdated
@@ -659,6 +659,7 @@ $mat-light-theme-background: ( | |||
selected-button: map_get($mat-grey, 300), | |||
selected-disabled-button: map_get($mat-grey, 400), | |||
disabled-button-toggle: map_get($mat-grey, 200), | |||
disabled-list-option: map_get($mat-grey, 200), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Deleted indent
src/lib/list/list-option.ts
Outdated
onFocus = new EventEmitter<MdSelectionListOptionEvent>(); | ||
|
||
/** Emitted when the option is selected. */ | ||
@Output() select = new EventEmitter<MdSelectionListOptionEvent>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or rename it to selectChange
?
src/lib/core/theming/_palette.scss
Outdated
@@ -659,6 +659,7 @@ $mat-light-theme-background: ( | |||
selected-button: map_get($mat-grey, 300), | |||
selected-disabled-button: map_get($mat-grey, 400), | |||
disabled-button-toggle: map_get($mat-grey, 200), | |||
disabled-list-option: map_get($mat-grey, 200), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Deleted indent
src/lib/list/list-option.ts
Outdated
this._lineSetter = new MdLineSetter(this._lines, this._renderer, this._element); | ||
|
||
if (this.selectionList.disabled) { | ||
this._disabled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to delete if (this.selectionList.disabled) {...}
part
src/lib/list/list-option.ts
Outdated
} | ||
|
||
toggle(): void { | ||
if (!this._disabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this.disabled
to consider the case when parent selectionList is disabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to this.disabled
src/lib/list/list.scss
Outdated
@@ -182,3 +212,5 @@ $mat-dense-list-icon-size: 20px; | |||
} | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: too many empty lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Deleted empty lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments Addressed 👍
Please take another look~
src/lib/core/theming/_palette.scss
Outdated
@@ -659,6 +659,7 @@ $mat-light-theme-background: ( | |||
selected-button: map_get($mat-grey, 300), | |||
selected-disabled-button: map_get($mat-grey, 400), | |||
disabled-button-toggle: map_get($mat-grey, 200), | |||
disabled-list-option: map_get($mat-grey, 200), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Deleted indent
src/lib/core/theming/_palette.scss
Outdated
@@ -659,6 +659,7 @@ $mat-light-theme-background: ( | |||
selected-button: map_get($mat-grey, 300), | |||
selected-disabled-button: map_get($mat-grey, 400), | |||
disabled-button-toggle: map_get($mat-grey, 200), | |||
disabled-list-option: map_get($mat-grey, 200), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Deleted indent
src/lib/list/list-option.ts
Outdated
onFocus = new EventEmitter<MdSelectionListOptionEvent>(); | ||
|
||
/** Emitted when the option is selected. */ | ||
@Output() select = new EventEmitter<MdSelectionListOptionEvent>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to selectChange
src/lib/list/list-option.ts
Outdated
this._lineSetter = new MdLineSetter(this._lines, this._renderer, this._element); | ||
|
||
if (this.selectionList.disabled) { | ||
this._disabled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted if (this.selectionList.disabled) {...}
part in toggle()
, and put theif (this.selectionList.disabled) {...}
part into a new function which is '_handleClick()'
.
src/lib/list/list-option.ts
Outdated
} | ||
|
||
toggle(): void { | ||
if (!this._disabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Changed to this.disabled
src/lib/list/list.scss
Outdated
@@ -182,3 +212,5 @@ $mat-dense-list-icon-size: 20px; | |||
} | |||
} | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Deleted empty lines
LGTM. Please sync and rebase. |
# This is the 1st commit message: add lib files for sticky-header add chose parent add support to 'optional 'cdkStickyRegion' input ' add app-demo for sticky-header fix bugs and deleted unused tag id in HTML files modify fix some code according to PR review comments change some format to pass TSlint check add '_' before private elements delete @Injectable for StickyHeaderDirective. Because we do not need @Injectable refine code encapsulate 'set style for element' change @input() Delete 'Observable.fromEvent(this.upperScrollableContainer, 'scroll')' add const STICK_START_CLASS and STICK_END_CLASS Add doc for [cdkStickyRegion] and 'unstuckElement()'. Delete 'detach()' function, add its content into 'ngOnDestroy()'. change 'MdStickyHeaderModule' to 'CdkStickyHeaderModule'; encapsulate reset css style operation for sticky header. delete unnecessary gloable variables sticky-header-rebased add one test && fixed bug 'sticky-header not working on iPhone', and bug 'reshape too obviously when being sticked'. && made some change according to the design doc('md-stick --> cdkSticky') make the sticky element being scrolled up smoothly when being unsticked Add code to support optional parentRegion input add add unit test for sticky-header add e2e/sticky-header files e2e test clear code master sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code fix encapsulate reset css style operation for sticky header. sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code master sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code fix delete unused files encapsulate reset css style operation for sticky header. sticky-header-rebased Add code to support optional parentRegion input add unit test for sticky-header add e2e/sticky-header files e2e test clear code master sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code fix encapsulate reset css style operation for sticky header. sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code master sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code fix clean unused files delete sticky-header delete styicky-heade demo delete sticky-header lib revert public_api delete sticky-header e2e files delete.firebasesrc revert revert revert revert add css styles for selection-list add selection-list structures in list.ts initial version of selection-list all src/lib code fix tslint error fix tslint error applied '[class.mat-list-item-content-reverse]="checkboxPosition == 'after'"', deleted comments in code Deleted 'MdSelectionListCssMatStyler' class Added doc for 'md-selection-option' Added binding expression for 'attr.aria-selected' and 'attr.aria-disabled' Added a value and a disabled @input() property Changed 'isSelected' to 'selected'. And added '@input(selected)' for it.(Using 'coerceBooleanProperty') changed '_slist' to 'selectionList' and deleted 'MdSelectionListCheckboxer' class Deleted navList in selection-list-option changed 'onchange()' to toggle(). And added doc for it checkedItems -> selectedOptions deleted 'pCheckbox' and store 'this' instead of HTMLelement in 'optionlist' optimized toggle() with 'this._selected = !this._selected' Added 'Tab' moves focus on selection-list, 'UP_ARROW' and 'DOWN_ARROW' moves focus within selection-list. And use 'SPACE' to select checkbox Added another empty line at the end of each file remove comment line in CSS file Deleted 'webkit-justify-content' in CSS file Deleted 'mat-list-item-content-reverse' to these existing styles; the 'mat-list-item-content-reverse' class should only have the extra styles you need to reverse the display Deleted 'mat-list-item-content' and 'mat-list-item-content-reverse' and '<a>' styles in '.mat-selection-list' Deleted unused 'mat-checkbox' class add ".mat-list-option" class in css file added 'mat-list-option' class fix toggle() disabled Deleted empty class Deleted unused import Removed 'if (this.selectable)' check moved styles in '.mat-selection-list .mat-list-item' to '.mat-list-option'. Deleted position, box-sizing, and height in '.mat-list-item-content-reverse' in list.scss file put md-selection-list and md-list-option in separate files(selection-list.ts and list-option.ts) # This is the commit message angular#2: nit # This is the commit message angular#3: correct imports in index.ts # This is the commit message angular#4: use ' @ContentChildren(MdListOption) options;' instead of QueryList
add chose parent add support to 'optional 'cdkStickyRegion' input ' add app-demo for sticky-header fix bugs and deleted unused tag id in HTML files modify fix some code according to PR review comments change some format to pass TSlint check add '_' before private elements delete @Injectable for StickyHeaderDirective. Because we do not need @Injectable refine code encapsulate 'set style for element' change @input() Delete 'Observable.fromEvent(this.upperScrollableContainer, 'scroll')' add const STICK_START_CLASS and STICK_END_CLASS Add doc for [cdkStickyRegion] and 'unstuckElement()'. Delete 'detach()' function, add its content into 'ngOnDestroy()'. change 'MdStickyHeaderModule' to 'CdkStickyHeaderModule'; encapsulate reset css style operation for sticky header. delete unnecessary gloable variables sticky-header-rebased add one test && fixed bug 'sticky-header not working on iPhone', and bug 'reshape too obviously when being sticked'. && made some change according to the design doc('md-stick --> cdkSticky') make the sticky element being scrolled up smoothly when being unsticked Add code to support optional parentRegion input add add unit test for sticky-header add e2e/sticky-header files e2e test clear code master sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code fix encapsulate reset css style operation for sticky header. sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code master sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code fix delete unused files encapsulate reset css style operation for sticky header. sticky-header-rebased Add code to support optional parentRegion input add unit test for sticky-header add e2e/sticky-header files e2e test clear code master sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code fix encapsulate reset css style operation for sticky header. sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code master sticky-header-rebased Add code to support optional parentRegion input add e2e/sticky-header files e2e test clear code fix clean unused files delete sticky-header delete styicky-heade demo delete sticky-header lib revert public_api delete sticky-header e2e files delete.firebasesrc revert revert revert revert add css styles for selection-list add selection-list structures in list.ts initial version of selection-list all src/lib code fix tslint error fix tslint error applied '[class.mat-list-item-content-reverse]="checkboxPosition == 'after'"', deleted comments in code Deleted 'MdSelectionListCssMatStyler' class Added doc for 'md-selection-option' Added binding expression for 'attr.aria-selected' and 'attr.aria-disabled' Added a value and a disabled @input() property Changed 'isSelected' to 'selected'. And added '@input(selected)' for it.(Using 'coerceBooleanProperty') changed '_slist' to 'selectionList' and deleted 'MdSelectionListCheckboxer' class Deleted navList in selection-list-option changed 'onchange()' to toggle(). And added doc for it checkedItems -> selectedOptions deleted 'pCheckbox' and store 'this' instead of HTMLelement in 'optionlist' optimized toggle() with 'this._selected = !this._selected' Added 'Tab' moves focus on selection-list, 'UP_ARROW' and 'DOWN_ARROW' moves focus within selection-list. And use 'SPACE' to select checkbox Added another empty line at the end of each file remove comment line in CSS file Deleted 'webkit-justify-content' in CSS file Deleted 'mat-list-item-content-reverse' to these existing styles; the 'mat-list-item-content-reverse' class should only have the extra styles you need to reverse the display Deleted 'mat-list-item-content' and 'mat-list-item-content-reverse' and '<a>' styles in '.mat-selection-list' Deleted unused 'mat-checkbox' class add ".mat-list-option" class in css file added 'mat-list-option' class fix toggle() disabled Deleted empty class Deleted unused import Removed 'if (this.selectable)' check moved styles in '.mat-selection-list .mat-list-item' to '.mat-list-option'. Deleted position, box-sizing, and height in '.mat-list-item-content-reverse' in list.scss file put md-selection-list and md-list-option in separate files(selection-list.ts and list-option.ts) nit correct imports in index.ts use ' @ContentChildren(MdListOption) options;' instead of QueryList change to check 'focusedIndex != null'. Set The tabindex of list option as -1 when the selection-list is disabled change ['class': 'mat-list-item, mat-list-option',] to ['class': 'mat-list-item mat-list-option',]; Don't want a comma between class names. fix typo in comments fix Binded 'aria-disabled' for selection-list.ts rename to '_optionsChangeSubscription' typo Instead of defining the disabled getter/setter yourself, you can include it via mixin. Removed ' selectable' property Deleted unnecessary 'this._isValidIndex(optionIndex)' check import switchMap Added SwitchMerge nit revert revert revert2 revert3 r4 r5 r2 r3 r4 r5 revert fix rxjs import Changed to use 'RxChain' instead of directly importing 'observer/add/' delete unusd import Added exports for selectionlist fix tslint check fix tslint check fix tslint check Add tests for selection-list and list-option fix typo in test Added new test on native element's focus & blur Added check expect(selectList.selected.length).toBe(0);before the toggle nit Added test on desecting an option fix tslink check fix typo in doc refine docs fix 'What happens if the selection list is disabled later? Would the list option become disabled?' Changed all the test name to the format of 'should ...' rename Deleted unused '_tabOutSubscription' return RxChain.from(this.options.changes)... fix tsLint check fix tslint fix tslint error test can not pass on travel CI fix travelCI check try to fix nativeElement focus test revert fix test fix travis CI error fixing travis fixed~! update fix fix fix fix2 fix added test check on 'aria-selected' Added test checkou on 'aria-disabled' reformat structure changed to 'if (!fixture.componentInstance.isIE) { ... }' Change 'platform.SAFARI || platform.EDGE || platform.FIREFOX' to '!platform.IS_TRIDENT' fix travis check Added aris-disabled test fix travis test put disabled style in theme.scss use background color for disabled items deselect --> deselected destory -> destoryed optimize changed to "if (!this.disabled) { ... }" restructured test cases change function to private _keydown protected -> private indent change 'select' to 'selectChange' Better to delete if (this.selectionList.disabled) {...} part Use this.disabled to consider the case when parent selectionList is disabled? Deleted emty lines It would be better not to mutate the option disabled state based on the parent state; this can be error prone, as it's easy to miss updating one when the other changes. It's better to rely on the disabled getter for the option to account for the parent state.
2098fc6
to
7f72853
Compare
👍 synced and rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@sllethe seems like the unit tests are failing |
fixed failing tests~ |
src/lib/list/selection-list.ts
Outdated
constructor(private _renderer: Renderer2, | ||
private _element: ElementRef, | ||
private _changeDetector: ChangeDetectorRef, | ||
@Self() @Optional() @Inject(forwardRef(() => MdSelectionList)) public selectionList: MdSelectionList) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for @Self()
here, and Inject
needs to be added to imports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Deleted @Self()
and added import for Inject
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.