-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(list): add new '<mat-action-list>' #12415
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
Changes from all commits
36dd04b
257ca2f
3f84eb9
28b7145
90fdc16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
border: 1px solid rgba(0, 0, 0, 0.12); | ||
width: 350px; | ||
margin: 20px 20px 0 0; | ||
|
||
} | ||
h2 { | ||
margin-top: 20px; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,6 +268,22 @@ $mat-list-item-inset-divider-offset: 72px; | |
} | ||
} | ||
|
||
mat-action-list { | ||
//remove the native button look and make it look like a list item | ||
button { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this apply to all There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As we talked, we added mat-action-list specifically for action list to make it more clear, so the idea is to let user use it under mat-action-list. |
||
background: none; | ||
color: inherit; | ||
border: none; | ||
font: inherit; | ||
outline: inherit; | ||
} | ||
|
||
.mat-list-item { | ||
cursor: pointer; | ||
outline: inherit; | ||
} | ||
} | ||
|
||
.mat-list-option:not(.mat-list-item-disabled) { | ||
cursor: pointer; | ||
outline: none; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,7 +56,7 @@ export class MatNavList extends _MatListMixinBase implements CanDisableRipple {} | |
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'mat-list', | ||
selector: 'mat-list, mat-action-list', | ||
exportAs: 'matList', | ||
templateUrl: 'list.html', | ||
host: {'class': 'mat-list'}, | ||
|
@@ -100,7 +100,7 @@ export class MatListSubheaderCssMatStyler {} | |
/** An item within a Material Design list. */ | ||
@Component({ | ||
moduleId: module.id, | ||
selector: 'mat-list-item, a[mat-list-item]', | ||
selector: 'mat-list-item, a[mat-list-item], button[mat-list-item]', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll need to add documentation for the new list variant to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One last thing that occurred to me just now- we should default all buttons with |
||
exportAs: 'matListItem', | ||
host: { | ||
'class': 'mat-list-item', | ||
|
@@ -127,6 +127,14 @@ export class MatListItem extends _MatListItemMixinBase implements AfterContentIn | |
@Optional() private _navList: MatNavList) { | ||
super(); | ||
this._isNavList = !!_navList; | ||
|
||
// If no type attributed is specified for <button>, set it to "button". | ||
// If a type attribute is already specified, do nothing. | ||
const element = this._getHostElement(); | ||
if (element.nodeName && element.nodeName.toLowerCase() === 'button' | ||
&& !element.hasAttribute('type')) { | ||
element.setAttribute('type', 'button'); | ||
} | ||
} | ||
|
||
ngAfterContentInit() { | ||
|
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 use a snack bar instead?
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.
A snack bar will look nicer. It can be done later in my opinion. I am new to angular, so try to do small check in without taking too long to deal with merge conflict etc.
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 app is only for our own development, so it doesn't really matter what the action does.