Skip to content

feat(material-experimental/mdc-list): Add scaffolding for MDC-based list #17906

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

Merged
merged 2 commits into from
Dec 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@
/src/material-experimental/mdc-chips/** @mmalerba
/src/material-experimental/mdc-dialog/** @devversion
/src/material-experimental/mdc-helpers/** @mmalerba
/src/material-experimental/mdc-list/** @mmalerba
/src/material-experimental/mdc-menu/** @crisbeto
/src/material-experimental/mdc-select/** @crisbeto
/src/material-experimental/mdc-progress-spinner/** @andrewseguin
/src/material-experimental/mdc-progress-bar/** @andrewseguin
# Note to implementer: please repossess
/src/material-experimental/mdc-radio/** @mmalerba
/src/material-experimental/mdc-snackbar/** @opozo
/src/material-experimental/mdc-slide-toggle/** @crisbeto
Expand Down
1 change: 1 addition & 0 deletions src/material-experimental/config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ entryPoints = [
"mdc-chips",
"mdc-chips/testing",
"mdc-helpers",
"mdc-list",
"mdc-menu",
"mdc-menu/testing",
"mdc-progress-bar",
Expand Down
91 changes: 91 additions & 0 deletions src/material-experimental/mdc-list/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package(default_visibility = ["//visibility:public"])

load("//src/e2e-app:test_suite.bzl", "e2e_test_suite")
load(
"//tools:defaults.bzl",
"ng_e2e_test_library",
"ng_module",
"ng_test_library",
"ng_web_test_suite",
"sass_binary",
"sass_library",
)

ng_module(
name = "mdc-list",
srcs = glob(
["**/*.ts"],
exclude = [
"**/*.spec.ts",
],
),
assets = [":list_scss"] + glob(["**/*.html"]),
module_name = "@angular/material-experimental/mdc-list",
deps = [
"@npm//@angular/core",
"@npm//@angular/forms",
"@npm//@material/list",
],
)

sass_library(
name = "mdc_list_scss_lib",
srcs = glob(["**/_*.scss"]),
deps = [
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
],
)

sass_binary(
name = "list_scss",
src = "list.scss",
include_paths = [
"external/npm/node_modules",
],
deps = [
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
],
)

ng_test_library(
name = "list_tests_lib",
srcs = glob(
["**/*.spec.ts"],
exclude = ["**/*.e2e.spec.ts"],
),
deps = [
":mdc-list",
"//src/cdk/testing/private",
"//src/cdk/testing/testbed",
"@npm//@angular/platform-browser",
],
)

ng_web_test_suite(
name = "unit_tests",
static_files = [
"@npm//:node_modules/@material/list/dist/mdc.list.js",
],
deps = [
":list_tests_lib",
"//src/material-experimental:mdc_require_config.js",
],
)

ng_e2e_test_library(
name = "e2e_test_sources",
srcs = glob(["**/*.e2e.spec.ts"]),
deps = [
"//src/cdk/testing/private/e2e",
],
)

e2e_test_suite(
name = "e2e_tests",
deps = [
":e2e_test_sources",
"//src/cdk/testing/private/e2e",
],
)
1 change: 1 addition & 0 deletions src/material-experimental/mdc-list/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: WIP
5 changes: 5 additions & 0 deletions src/material-experimental/mdc-list/_mdc-list.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@mixin mat-list-theme-mdc($theme) {
}

@mixin mat-list-typography-mdc($config) {
}
23 changes: 23 additions & 0 deletions src/material-experimental/mdc-list/action-list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';
import {MatListBase} from './list-base';

@Component({
selector: 'mat-action-list',
exportAs: 'matActionList',
templateUrl: 'list.html',
host: {
'class': 'mat-mdc-action-list mat-mdc-list-base',
},
styleUrls: ['list.css'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MatActionList extends MatListBase {}
9 changes: 9 additions & 0 deletions src/material-experimental/mdc-list/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

export * from './public-api';
11 changes: 11 additions & 0 deletions src/material-experimental/mdc-list/list-base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

export class MatListBase {}

export class MatListItemBase {}
1 change: 1 addition & 0 deletions src/material-experimental/mdc-list/list-item.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Implement.
1 change: 1 addition & 0 deletions src/material-experimental/mdc-list/list-option.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Implement.
3 changes: 3 additions & 0 deletions src/material-experimental/mdc-list/list.e2e.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
it('should have e2e tests', () => {
// TODO: Implement.
});
1 change: 1 addition & 0 deletions src/material-experimental/mdc-list/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Implement.
1 change: 1 addition & 0 deletions src/material-experimental/mdc-list/list.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// TODO: implement.
6 changes: 6 additions & 0 deletions src/material-experimental/mdc-list/list.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {MatList} from '@angular/material-experimental/mdc-list';

it('should have unit tests', () => {
// TODO: Implement.
expect(MatList).toBe(MatList);
});
65 changes: 65 additions & 0 deletions src/material-experimental/mdc-list/list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {ChangeDetectionStrategy, Component, Directive, ViewEncapsulation} from '@angular/core';
import {MatListBase, MatListItemBase} from './list-base';

/**
* Directive whose purpose is to add the mat- CSS styling to this selector.
* @docs-private
*/
@Directive({
selector: '[mat-list-avatar], [matListAvatar]',
host: {'class': 'mat-mdc-list-avatar'}
})
export class MatListAvatarCssMatStyler {}

/**
* Directive whose purpose is to add the mat- CSS styling to this selector.
* @docs-private
*/
@Directive({
selector: '[mat-list-icon], [matListIcon]',
host: {'class': 'mat-mdc-list-icon'}
})
export class MatListIconCssMatStyler {}

/**
* Directive whose purpose is to add the mat- CSS styling to this selector.
* @docs-private
*/
@Directive({
selector: '[mat-subheader], [matSubheader]',
host: {'class': 'mat-mdc-subheader'}
})
export class MatListSubheaderCssMatStyler {}

@Component({
selector: 'mat-list',
exportAs: 'matList',
templateUrl: 'list.html',
host: {
'class': 'mat-mdc-list mat-mdc-list-base',
},
styleUrls: ['list.css'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MatList extends MatListBase {}

@Component({
selector: 'mat-list-item, a[mat-list-item], button[mat-list-item]',
exportAs: 'matListItem',
host: {
'class': 'mat-mdc-list-item',
},
templateUrl: 'list-item.html',
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class MatListItem extends MatListItemBase {}
45 changes: 45 additions & 0 deletions src/material-experimental/mdc-list/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {NgModule} from '@angular/core';
import {MatActionList} from './action-list';
import {
MatList,
MatListAvatarCssMatStyler,
MatListIconCssMatStyler,
MatListItem,
MatListSubheaderCssMatStyler,
} from './list';
import {MatNavList} from './nav-list';
import {MatListOption, MatSelectionList} from './selection-list';

@NgModule({
exports: [
MatList,
MatActionList,
MatNavList,
MatSelectionList,
MatListItem,
MatListOption,
MatListAvatarCssMatStyler,
MatListIconCssMatStyler,
MatListSubheaderCssMatStyler,
],
declarations: [
MatList,
MatActionList,
MatNavList,
MatSelectionList,
MatListItem,
MatListOption,
MatListAvatarCssMatStyler,
MatListIconCssMatStyler,
MatListSubheaderCssMatStyler,
]
})
export class MatListModule {}
35 changes: 35 additions & 0 deletions src/material-experimental/mdc-list/nav-list.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';
import {MatList} from './list';
import {MatListBase} from './list-base';

@Component({
selector: 'mat-nav-list',
/**
* @deprecated `matList` export will be removed, use `matNavList`
* @breaking-change 11.0.0
*/
exportAs: 'matNavList, matList',
templateUrl: 'list.html',
host: {
'class': 'mat-mdc-nav-list mat-mdc-list-base',
},
styleUrls: ['list.css'],
encapsulation: ViewEncapsulation.None,
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
/**
* @deprecated Provider for `MatList` will be removed, use `MatNavList` instead.
* @breaking-change 11.0.0
*/
{provide: MatList, useExisting: MatNavList}
]
})
export class MatNavList extends MatListBase {}
13 changes: 13 additions & 0 deletions src/material-experimental/mdc-list/public-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

export * from './list';
export * from './action-list';
export * from './nav-list';
export * from './selection-list';
export * from './module';
1 change: 1 addition & 0 deletions src/material-experimental/mdc-list/selection-list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Implement.
Loading