Skip to content
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

Merged
merged 13 commits into from
Aug 12, 2017
4 changes: 3 additions & 1 deletion src/lib/core/theming/_palette.scss
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ $mat-light-theme-background: (
selected-disabled-button: map_get($mat-grey, 400),
disabled-button-toggle: map_get($mat-grey, 200),
unselected-chip: map_get($mat-grey, 300),
disabled-list-option: map_get($mat-grey, 200),
);

// Background palette for dark themes.
Expand All @@ -675,8 +676,9 @@ $mat-dark-theme-background: (
focused-button: $white-6-opacity,
selected-button: map_get($mat-grey, 900),
selected-disabled-button: map_get($mat-grey, 800),
disabled-button-toggle: map_get($mat-grey, 1000),
disabled-button-toggle: black,
unselected-chip: map_get($mat-grey, 700),
disabled-list-option: black,
);

// Foreground palette for light themes.
Expand Down
36 changes: 33 additions & 3 deletions src/lib/list/_list-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,24 @@
$background: map-get($theme, background);
$foreground: map-get($theme, foreground);

.mat-list, .mat-nav-list {
.mat-list, .mat-nav-list, .mat-selection-list {
.mat-list-item {
color: mat-color($foreground, text);
}

.mat-list-option {
color: mat-color($foreground, text);
}

.mat-subheader {
color: mat-color($foreground, secondary-text);
}
}

.mat-list-item-disabled {
background-color: mat-color($background, disabled-list-option);
}

.mat-divider {
border-top-color: mat-color($foreground, divider);
}
Expand All @@ -29,6 +37,14 @@
background: mat-color($background, 'hover');
}
}

.mat-list-option {
outline: none;

&:hover, &.mat-list-item-focus {
background: mat-color($background, 'hover');
}
}
}

@mixin mat-list-typography($config) {
Expand All @@ -38,13 +54,22 @@
font-family: $font-family;
}

.mat-list-option {
font-family: $font-family;
}

// Default list
.mat-list, .mat-nav-list {
.mat-list, .mat-nav-list, .mat-selection-list {
.mat-list-item {
font-size: mat-font-size($config, subheading-2);
@include mat-line-base(mat-font-size($config, body-1));
}

.mat-list-option {
font-size: mat-font-size($config, subheading-2);
@include mat-line-base(mat-font-size($config, body-1));
}

.mat-subheader {
font-family: mat-font-family($config, body-2);
font-size: mat-font-size($config, body-2);
Expand All @@ -53,12 +78,17 @@
}

// Dense list
.mat-list[dense], .mat-nav-list[dense] {
.mat-list[dense], .mat-nav-list[dense], .mat-selection-list[dense] {
.mat-list-item {
font-size: mat-font-size($config, caption);
@include mat-line-base(mat-font-size($config, caption));
}

.mat-list-option {
font-size: mat-font-size($config, caption);
@include mat-line-base(mat-font-size($config, caption));
}

.mat-subheader {
font-family: $font-family;
font-size: mat-font-size($config, caption);
Expand Down
14 changes: 11 additions & 3 deletions src/lib/list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
*/

import {NgModule} from '@angular/core';
import {MdLineModule, MdRippleModule, MdCommonModule} from '../core';
import {MdLineModule, MdRippleModule, MdCommonModule, MdSelectionModule} from '../core';
import {CommonModule} from '@angular/common';
import {
MdList,
MdListItem,
Expand All @@ -17,12 +18,13 @@ import {
MdListCssMatStyler,
MdNavListCssMatStyler,
MdDividerCssMatStyler,
MdListSubheaderCssMatStyler,
MdListSubheaderCssMatStyler
} from './list';
import {MdSelectionList, MdListOption} from './selection-list';


@NgModule({
imports: [MdLineModule, MdRippleModule, MdCommonModule],
imports: [MdLineModule, MdRippleModule, MdCommonModule, MdSelectionModule, CommonModule],
exports: [
MdList,
MdListItem,
Expand All @@ -35,6 +37,9 @@ import {
MdNavListCssMatStyler,
MdDividerCssMatStyler,
MdListSubheaderCssMatStyler,
MdSelectionModule,
MdSelectionList,
MdListOption
],
declarations: [
MdList,
Expand All @@ -46,9 +51,12 @@ import {
MdNavListCssMatStyler,
MdDividerCssMatStyler,
MdListSubheaderCssMatStyler,
MdSelectionList,
MdListOption
],
})
export class MdListModule {}


export * from './list';
export * from './selection-list';
10 changes: 10 additions & 0 deletions src/lib/list/list-option.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div class="mat-list-item-content" [class.mat-list-item-content-reverse]="checkboxPosition == 'after'" [class.mat-list-item-disabled]="disabled">
<div class="mat-list-item-ripple" md-ripple
[mdRippleTrigger]="_getHostElement()"
[mdRippleDisabled]="!isRippleEnabled()">
</div>

<md-pseudo-checkbox [state]="selected ? 'checked' : 'unchecked'" #autocheckbox [disabled]="disabled"></md-pseudo-checkbox>
<div class="mat-list-text"><ng-content></ng-content></div>

</div>
33 changes: 31 additions & 2 deletions src/lib/list/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ $mat-dense-list-icon-size: 20px;
position: relative;
}

.mat-list-item-content-reverse {
display: flex;
align-items: center;
padding: 0 $mat-list-side-padding;
flex-direction: row-reverse;
justify-content: space-around;
}
Copy link
Member

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?

Copy link
Contributor Author

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


.mat-list-item-ripple {
position: absolute;
left: 0;
Expand Down Expand Up @@ -128,7 +136,7 @@ $mat-dense-list-icon-size: 20px;
}
}

.mat-list, .mat-nav-list {
.mat-list, .mat-nav-list, .mat-selection-list {
padding-top: $mat-list-top-padding;
display: block;

Expand All @@ -145,10 +153,21 @@ $mat-dense-list-icon-size: 20px;
$mat-list-icon-size
);
}

.mat-list-option {
@include mat-list-item-base(
$mat-list-base-height,
$mat-list-avatar-height,
$mat-list-two-line-height,
$mat-list-three-line-height,
$mat-list-icon-size
);
}
}


.mat-list[dense], .mat-nav-list[dense] {
.mat-list[dense], .mat-nav-list[dense], .mat-selection-list[dense] {

padding-top: $mat-dense-top-padding;
display: block;

Expand All @@ -165,6 +184,16 @@ $mat-dense-list-icon-size: 20px;
$mat-dense-list-icon-size
);
}

.mat-list-option {
@include mat-list-item-base(
$mat-dense-base-height,
$mat-dense-avatar-height,
$mat-dense-two-line-height,
$mat-dense-three-line-height,
$mat-dense-list-icon-size
);
}
}

.mat-divider {
Expand Down
1 change: 1 addition & 0 deletions src/lib/list/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const _MdListMixinBase = mixinDisableRipple(MdListBase);
export class MdListItemBase {}
export const _MdListItemMixinBase = mixinDisableRipple(MdListItemBase);


@Directive({
selector: 'md-divider, mat-divider',
host: {
Expand Down
Loading