1 | import { CommonModule } from '@angular/common';
|
---|
2 | import { InjectionToken, Component, ViewEncapsulation, ChangeDetectionStrategy, ElementRef, Directive, ChangeDetectorRef, Optional, Inject, ContentChildren, ContentChild, Input, forwardRef, EventEmitter, Output, ViewChild, Attribute, NgModule } from '@angular/core';
|
---|
3 | import { mixinDisabled, mixinDisableRipple, setLines, MatLine, MatLineModule, MatRippleModule, MatCommonModule, MatPseudoCheckboxModule } from '@angular/material/core';
|
---|
4 | import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
---|
5 | import { Subject } from 'rxjs';
|
---|
6 | import { takeUntil, startWith } from 'rxjs/operators';
|
---|
7 | import { FocusKeyManager, FocusMonitor } from '@angular/cdk/a11y';
|
---|
8 | import { SelectionModel } from '@angular/cdk/collections';
|
---|
9 | import { hasModifierKey, A, ENTER, SPACE, UP_ARROW, DOWN_ARROW } from '@angular/cdk/keycodes';
|
---|
10 | import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
---|
11 | import { MatDividerModule } from '@angular/material/divider';
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * @license
|
---|
15 | * Copyright Google LLC All Rights Reserved.
|
---|
16 | *
|
---|
17 | * Use of this source code is governed by an MIT-style license that can be
|
---|
18 | * found in the LICENSE file at https://angular.io/license
|
---|
19 | */
|
---|
20 | // Boilerplate for applying mixins to MatList.
|
---|
21 | /** @docs-private */
|
---|
22 | const _MatListBase = mixinDisabled(mixinDisableRipple(class {
|
---|
23 | }));
|
---|
24 | // Boilerplate for applying mixins to MatListItem.
|
---|
25 | /** @docs-private */
|
---|
26 | const _MatListItemMixinBase = mixinDisableRipple(class {
|
---|
27 | });
|
---|
28 | /**
|
---|
29 | * Injection token that can be used to inject instances of `MatList`. It serves as
|
---|
30 | * alternative token to the actual `MatList` class which could cause unnecessary
|
---|
31 | * retention of the class and its component metadata.
|
---|
32 | */
|
---|
33 | const MAT_LIST = new InjectionToken('MatList');
|
---|
34 | /**
|
---|
35 | * Injection token that can be used to inject instances of `MatNavList`. It serves as
|
---|
36 | * alternative token to the actual `MatNavList` class which could cause unnecessary
|
---|
37 | * retention of the class and its component metadata.
|
---|
38 | */
|
---|
39 | const MAT_NAV_LIST = new InjectionToken('MatNavList');
|
---|
40 | class MatNavList extends _MatListBase {
|
---|
41 | constructor() {
|
---|
42 | super(...arguments);
|
---|
43 | /** Emits when the state of the list changes. */
|
---|
44 | this._stateChanges = new Subject();
|
---|
45 | }
|
---|
46 | ngOnChanges() {
|
---|
47 | this._stateChanges.next();
|
---|
48 | }
|
---|
49 | ngOnDestroy() {
|
---|
50 | this._stateChanges.complete();
|
---|
51 | }
|
---|
52 | }
|
---|
53 | MatNavList.decorators = [
|
---|
54 | { type: Component, args: [{
|
---|
55 | selector: 'mat-nav-list',
|
---|
56 | exportAs: 'matNavList',
|
---|
57 | host: {
|
---|
58 | 'role': 'navigation',
|
---|
59 | 'class': 'mat-nav-list mat-list-base'
|
---|
60 | },
|
---|
61 | template: "<ng-content></ng-content>\n\n",
|
---|
62 | inputs: ['disableRipple', 'disabled'],
|
---|
63 | encapsulation: ViewEncapsulation.None,
|
---|
64 | changeDetection: ChangeDetectionStrategy.OnPush,
|
---|
65 | providers: [{ provide: MAT_NAV_LIST, useExisting: MatNavList }],
|
---|
66 | styles: [".mat-subheader{display:flex;box-sizing:border-box;padding:16px;align-items:center}.mat-list-base .mat-subheader{margin:0}.mat-list-base{padding-top:8px;display:block;-webkit-tap-highlight-color:transparent}.mat-list-base .mat-subheader{height:48px;line-height:16px}.mat-list-base .mat-subheader:first-child{margin-top:-8px}.mat-list-base .mat-list-item,.mat-list-base .mat-list-option{display:block;height:48px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base .mat-list-item .mat-list-item-content,.mat-list-base .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base .mat-list-item .mat-list-item-content-reverse,.mat-list-base .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base .mat-list-item .mat-list-item-ripple,.mat-list-base .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar,.mat-list-base .mat-list-option.mat-list-item-with-avatar{height:56px}.mat-list-base .mat-list-item.mat-2-line,.mat-list-base .mat-list-option.mat-2-line{height:72px}.mat-list-base .mat-list-item.mat-3-line,.mat-list-base .mat-list-option.mat-3-line{height:88px}.mat-list-base .mat-list-item.mat-multi-line,.mat-list-base .mat-list-option.mat-multi-line{height:auto}.mat-list-base .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base .mat-list-item .mat-list-text,.mat-list-base .mat-list-option .mat-list-text{display:flex;flex-direction:column;flex:auto;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base .mat-list-item .mat-list-text>*,.mat-list-base .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-list-base .mat-list-item .mat-list-text:empty,.mat-list-base .mat-list-option .mat-list-text:empty{display:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base .mat-list-item .mat-list-avatar,.mat-list-base .mat-list-option .mat-list-avatar{flex-shrink:0;width:40px;height:40px;border-radius:50%;object-fit:cover}.mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:72px;width:calc(100% - 72px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:72px}.mat-list-base .mat-list-item .mat-list-icon,.mat-list-base .mat-list-option .mat-list-icon{flex-shrink:0;width:24px;height:24px;font-size:24px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:64px;width:calc(100% - 64px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:64px}.mat-list-base .mat-list-item .mat-divider,.mat-list-base .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base .mat-list-item .mat-divider,[dir=rtl] .mat-list-base .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-list-base[dense]{padding-top:4px;display:block}.mat-list-base[dense] .mat-subheader{height:40px;line-height:8px}.mat-list-base[dense] .mat-subheader:first-child{margin-top:-4px}.mat-list-base[dense] .mat-list-item,.mat-list-base[dense] .mat-list-option{display:block;height:40px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-item-content,.mat-list-base[dense] .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base[dense] .mat-list-item .mat-list-item-content-reverse,.mat-list-base[dense] .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base[dense] .mat-list-item .mat-list-item-ripple,.mat-list-base[dense] .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar{height:48px}.mat-list-base[dense] .mat-list-item.mat-2-line,.mat-list-base[dense] .mat-list-option.mat-2-line{height:60px}.mat-list-base[dense] .mat-list-item.mat-3-line,.mat-list-base[dense] .mat-list-option.mat-3-line{height:76px}.mat-list-base[dense] .mat-list-item.mat-multi-line,.mat-list-base[dense] .mat-list-option.mat-multi-line{height:auto}.mat-list-base[dense] .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base[dense] .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base[dense] .mat-list-item .mat-list-text,.mat-list-base[dense] .mat-list-option .mat-list-text{display:flex;flex-direction:column;flex:auto;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-text>*,.mat-list-base[dense] .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-list-base[dense] .mat-list-item .mat-list-text:empty,.mat-list-base[dense] .mat-list-option .mat-list-text:empty{display:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base[dense] .mat-list-item .mat-list-avatar,.mat-list-base[dense] .mat-list-option .mat-list-avatar{flex-shrink:0;width:36px;height:36px;border-radius:50%;object-fit:cover}.mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:68px;width:calc(100% - 68px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:68px}.mat-list-base[dense] .mat-list-item .mat-list-icon,.mat-list-base[dense] .mat-list-option .mat-list-icon{flex-shrink:0;width:20px;height:20px;font-size:20px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:60px;width:calc(100% - 60px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:60px}.mat-list-base[dense] .mat-list-item .mat-divider,.mat-list-base[dense] .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-divider,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base[dense] .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-nav-list a{text-decoration:none;color:inherit}.mat-nav-list .mat-list-item{cursor:pointer;outline:none}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:transparent;text-align:left}[dir=rtl] mat-action-list button{text-align:right}mat-action-list button::-moz-focus-inner{border:0}mat-action-list .mat-list-item{cursor:pointer;outline:inherit}.mat-list-option:not(.mat-list-item-disabled){cursor:pointer;outline:none}.mat-list-item-disabled{pointer-events:none}.cdk-high-contrast-active .mat-list-item-disabled{opacity:.5}.cdk-high-contrast-active :host .mat-list-item-disabled{opacity:.5}.cdk-high-contrast-active .mat-selection-list:focus{outline-style:dotted}.cdk-high-contrast-active .mat-list-option:hover,.cdk-high-contrast-active .mat-list-option:focus,.cdk-high-contrast-active .mat-nav-list .mat-list-item:hover,.cdk-high-contrast-active .mat-nav-list .mat-list-item:focus,.cdk-high-contrast-active mat-action-list .mat-list-item:hover,.cdk-high-contrast-active mat-action-list .mat-list-item:focus{outline:dotted 1px;z-index:1}.cdk-high-contrast-active .mat-list-single-selected-option::after{content:\"\";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}.cdk-high-contrast-active [dir=rtl] .mat-list-single-selected-option::after{right:auto;left:16px}@media(hover: none){.mat-list-option:not(.mat-list-single-selected-option):not(.mat-list-item-disabled):hover,.mat-nav-list .mat-list-item:not(.mat-list-item-disabled):hover,.mat-action-list .mat-list-item:not(.mat-list-item-disabled):hover{background:none}}\n"]
|
---|
67 | },] }
|
---|
68 | ];
|
---|
69 | class MatList extends _MatListBase {
|
---|
70 | constructor(_elementRef) {
|
---|
71 | super();
|
---|
72 | this._elementRef = _elementRef;
|
---|
73 | /** Emits when the state of the list changes. */
|
---|
74 | this._stateChanges = new Subject();
|
---|
75 | if (this._getListType() === 'action-list') {
|
---|
76 | _elementRef.nativeElement.classList.add('mat-action-list');
|
---|
77 | }
|
---|
78 | }
|
---|
79 | _getListType() {
|
---|
80 | const nodeName = this._elementRef.nativeElement.nodeName.toLowerCase();
|
---|
81 | if (nodeName === 'mat-list') {
|
---|
82 | return 'list';
|
---|
83 | }
|
---|
84 | if (nodeName === 'mat-action-list') {
|
---|
85 | return 'action-list';
|
---|
86 | }
|
---|
87 | return null;
|
---|
88 | }
|
---|
89 | ngOnChanges() {
|
---|
90 | this._stateChanges.next();
|
---|
91 | }
|
---|
92 | ngOnDestroy() {
|
---|
93 | this._stateChanges.complete();
|
---|
94 | }
|
---|
95 | }
|
---|
96 | MatList.decorators = [
|
---|
97 | { type: Component, args: [{
|
---|
98 | selector: 'mat-list, mat-action-list',
|
---|
99 | exportAs: 'matList',
|
---|
100 | template: "<ng-content></ng-content>\n\n",
|
---|
101 | host: {
|
---|
102 | 'class': 'mat-list mat-list-base'
|
---|
103 | },
|
---|
104 | inputs: ['disableRipple', 'disabled'],
|
---|
105 | encapsulation: ViewEncapsulation.None,
|
---|
106 | changeDetection: ChangeDetectionStrategy.OnPush,
|
---|
107 | providers: [{ provide: MAT_LIST, useExisting: MatList }],
|
---|
108 | styles: [".mat-subheader{display:flex;box-sizing:border-box;padding:16px;align-items:center}.mat-list-base .mat-subheader{margin:0}.mat-list-base{padding-top:8px;display:block;-webkit-tap-highlight-color:transparent}.mat-list-base .mat-subheader{height:48px;line-height:16px}.mat-list-base .mat-subheader:first-child{margin-top:-8px}.mat-list-base .mat-list-item,.mat-list-base .mat-list-option{display:block;height:48px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base .mat-list-item .mat-list-item-content,.mat-list-base .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base .mat-list-item .mat-list-item-content-reverse,.mat-list-base .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base .mat-list-item .mat-list-item-ripple,.mat-list-base .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar,.mat-list-base .mat-list-option.mat-list-item-with-avatar{height:56px}.mat-list-base .mat-list-item.mat-2-line,.mat-list-base .mat-list-option.mat-2-line{height:72px}.mat-list-base .mat-list-item.mat-3-line,.mat-list-base .mat-list-option.mat-3-line{height:88px}.mat-list-base .mat-list-item.mat-multi-line,.mat-list-base .mat-list-option.mat-multi-line{height:auto}.mat-list-base .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base .mat-list-item .mat-list-text,.mat-list-base .mat-list-option .mat-list-text{display:flex;flex-direction:column;flex:auto;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base .mat-list-item .mat-list-text>*,.mat-list-base .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-list-base .mat-list-item .mat-list-text:empty,.mat-list-base .mat-list-option .mat-list-text:empty{display:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base .mat-list-item .mat-list-avatar,.mat-list-base .mat-list-option .mat-list-avatar{flex-shrink:0;width:40px;height:40px;border-radius:50%;object-fit:cover}.mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:72px;width:calc(100% - 72px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:72px}.mat-list-base .mat-list-item .mat-list-icon,.mat-list-base .mat-list-option .mat-list-icon{flex-shrink:0;width:24px;height:24px;font-size:24px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:64px;width:calc(100% - 64px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:64px}.mat-list-base .mat-list-item .mat-divider,.mat-list-base .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base .mat-list-item .mat-divider,[dir=rtl] .mat-list-base .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-list-base[dense]{padding-top:4px;display:block}.mat-list-base[dense] .mat-subheader{height:40px;line-height:8px}.mat-list-base[dense] .mat-subheader:first-child{margin-top:-4px}.mat-list-base[dense] .mat-list-item,.mat-list-base[dense] .mat-list-option{display:block;height:40px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-item-content,.mat-list-base[dense] .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base[dense] .mat-list-item .mat-list-item-content-reverse,.mat-list-base[dense] .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base[dense] .mat-list-item .mat-list-item-ripple,.mat-list-base[dense] .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar{height:48px}.mat-list-base[dense] .mat-list-item.mat-2-line,.mat-list-base[dense] .mat-list-option.mat-2-line{height:60px}.mat-list-base[dense] .mat-list-item.mat-3-line,.mat-list-base[dense] .mat-list-option.mat-3-line{height:76px}.mat-list-base[dense] .mat-list-item.mat-multi-line,.mat-list-base[dense] .mat-list-option.mat-multi-line{height:auto}.mat-list-base[dense] .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base[dense] .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base[dense] .mat-list-item .mat-list-text,.mat-list-base[dense] .mat-list-option .mat-list-text{display:flex;flex-direction:column;flex:auto;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-text>*,.mat-list-base[dense] .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-list-base[dense] .mat-list-item .mat-list-text:empty,.mat-list-base[dense] .mat-list-option .mat-list-text:empty{display:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base[dense] .mat-list-item .mat-list-avatar,.mat-list-base[dense] .mat-list-option .mat-list-avatar{flex-shrink:0;width:36px;height:36px;border-radius:50%;object-fit:cover}.mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:68px;width:calc(100% - 68px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:68px}.mat-list-base[dense] .mat-list-item .mat-list-icon,.mat-list-base[dense] .mat-list-option .mat-list-icon{flex-shrink:0;width:20px;height:20px;font-size:20px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:60px;width:calc(100% - 60px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:60px}.mat-list-base[dense] .mat-list-item .mat-divider,.mat-list-base[dense] .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-divider,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base[dense] .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-nav-list a{text-decoration:none;color:inherit}.mat-nav-list .mat-list-item{cursor:pointer;outline:none}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:transparent;text-align:left}[dir=rtl] mat-action-list button{text-align:right}mat-action-list button::-moz-focus-inner{border:0}mat-action-list .mat-list-item{cursor:pointer;outline:inherit}.mat-list-option:not(.mat-list-item-disabled){cursor:pointer;outline:none}.mat-list-item-disabled{pointer-events:none}.cdk-high-contrast-active .mat-list-item-disabled{opacity:.5}.cdk-high-contrast-active :host .mat-list-item-disabled{opacity:.5}.cdk-high-contrast-active .mat-selection-list:focus{outline-style:dotted}.cdk-high-contrast-active .mat-list-option:hover,.cdk-high-contrast-active .mat-list-option:focus,.cdk-high-contrast-active .mat-nav-list .mat-list-item:hover,.cdk-high-contrast-active .mat-nav-list .mat-list-item:focus,.cdk-high-contrast-active mat-action-list .mat-list-item:hover,.cdk-high-contrast-active mat-action-list .mat-list-item:focus{outline:dotted 1px;z-index:1}.cdk-high-contrast-active .mat-list-single-selected-option::after{content:\"\";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}.cdk-high-contrast-active [dir=rtl] .mat-list-single-selected-option::after{right:auto;left:16px}@media(hover: none){.mat-list-option:not(.mat-list-single-selected-option):not(.mat-list-item-disabled):hover,.mat-nav-list .mat-list-item:not(.mat-list-item-disabled):hover,.mat-action-list .mat-list-item:not(.mat-list-item-disabled):hover{background:none}}\n"]
|
---|
109 | },] }
|
---|
110 | ];
|
---|
111 | MatList.ctorParameters = () => [
|
---|
112 | { type: ElementRef }
|
---|
113 | ];
|
---|
114 | /**
|
---|
115 | * Directive whose purpose is to add the mat- CSS styling to this selector.
|
---|
116 | * @docs-private
|
---|
117 | */
|
---|
118 | class MatListAvatarCssMatStyler {
|
---|
119 | }
|
---|
120 | MatListAvatarCssMatStyler.decorators = [
|
---|
121 | { type: Directive, args: [{
|
---|
122 | selector: '[mat-list-avatar], [matListAvatar]',
|
---|
123 | host: { 'class': 'mat-list-avatar' }
|
---|
124 | },] }
|
---|
125 | ];
|
---|
126 | /**
|
---|
127 | * Directive whose purpose is to add the mat- CSS styling to this selector.
|
---|
128 | * @docs-private
|
---|
129 | */
|
---|
130 | class MatListIconCssMatStyler {
|
---|
131 | }
|
---|
132 | MatListIconCssMatStyler.decorators = [
|
---|
133 | { type: Directive, args: [{
|
---|
134 | selector: '[mat-list-icon], [matListIcon]',
|
---|
135 | host: { 'class': 'mat-list-icon' }
|
---|
136 | },] }
|
---|
137 | ];
|
---|
138 | /**
|
---|
139 | * Directive whose purpose is to add the mat- CSS styling to this selector.
|
---|
140 | * @docs-private
|
---|
141 | */
|
---|
142 | class MatListSubheaderCssMatStyler {
|
---|
143 | }
|
---|
144 | MatListSubheaderCssMatStyler.decorators = [
|
---|
145 | { type: Directive, args: [{
|
---|
146 | selector: '[mat-subheader], [matSubheader]',
|
---|
147 | host: { 'class': 'mat-subheader' }
|
---|
148 | },] }
|
---|
149 | ];
|
---|
150 | /** An item within a Material Design list. */
|
---|
151 | class MatListItem extends _MatListItemMixinBase {
|
---|
152 | constructor(_element, _changeDetectorRef, navList, list) {
|
---|
153 | super();
|
---|
154 | this._element = _element;
|
---|
155 | this._isInteractiveList = false;
|
---|
156 | this._destroyed = new Subject();
|
---|
157 | this._disabled = false;
|
---|
158 | this._isInteractiveList = !!(navList || (list && list._getListType() === 'action-list'));
|
---|
159 | this._list = navList || list;
|
---|
160 | // If no type attribute is specified for <button>, set it to "button".
|
---|
161 | // If a type attribute is already specified, do nothing.
|
---|
162 | const element = this._getHostElement();
|
---|
163 | if (element.nodeName.toLowerCase() === 'button' && !element.hasAttribute('type')) {
|
---|
164 | element.setAttribute('type', 'button');
|
---|
165 | }
|
---|
166 | if (this._list) {
|
---|
167 | // React to changes in the state of the parent list since
|
---|
168 | // some of the item's properties depend on it (e.g. `disableRipple`).
|
---|
169 | this._list._stateChanges.pipe(takeUntil(this._destroyed)).subscribe(() => {
|
---|
170 | _changeDetectorRef.markForCheck();
|
---|
171 | });
|
---|
172 | }
|
---|
173 | }
|
---|
174 | /** Whether the option is disabled. */
|
---|
175 | get disabled() { return this._disabled || !!(this._list && this._list.disabled); }
|
---|
176 | set disabled(value) {
|
---|
177 | this._disabled = coerceBooleanProperty(value);
|
---|
178 | }
|
---|
179 | ngAfterContentInit() {
|
---|
180 | setLines(this._lines, this._element);
|
---|
181 | }
|
---|
182 | ngOnDestroy() {
|
---|
183 | this._destroyed.next();
|
---|
184 | this._destroyed.complete();
|
---|
185 | }
|
---|
186 | /** Whether this list item should show a ripple effect when clicked. */
|
---|
187 | _isRippleDisabled() {
|
---|
188 | return !this._isInteractiveList || this.disableRipple ||
|
---|
189 | !!(this._list && this._list.disableRipple);
|
---|
190 | }
|
---|
191 | /** Retrieves the DOM element of the component host. */
|
---|
192 | _getHostElement() {
|
---|
193 | return this._element.nativeElement;
|
---|
194 | }
|
---|
195 | }
|
---|
196 | MatListItem.decorators = [
|
---|
197 | { type: Component, args: [{
|
---|
198 | selector: 'mat-list-item, a[mat-list-item], button[mat-list-item]',
|
---|
199 | exportAs: 'matListItem',
|
---|
200 | host: {
|
---|
201 | 'class': 'mat-list-item mat-focus-indicator',
|
---|
202 | '[class.mat-list-item-disabled]': 'disabled',
|
---|
203 | // @breaking-change 8.0.0 Remove `mat-list-item-avatar` in favor of `mat-list-item-with-avatar`.
|
---|
204 | '[class.mat-list-item-avatar]': '_avatar || _icon',
|
---|
205 | '[class.mat-list-item-with-avatar]': '_avatar || _icon',
|
---|
206 | },
|
---|
207 | inputs: ['disableRipple'],
|
---|
208 | template: "<div class=\"mat-list-item-content\">\n <div class=\"mat-list-item-ripple\" mat-ripple\n [matRippleTrigger]=\"_getHostElement()\"\n [matRippleDisabled]=\"_isRippleDisabled()\">\n </div>\n\n <ng-content select=\"[mat-list-avatar], [mat-list-icon], [matListAvatar], [matListIcon]\">\n </ng-content>\n\n <div class=\"mat-list-text\"><ng-content select=\"[mat-line], [matLine]\"></ng-content></div>\n\n <ng-content></ng-content>\n</div>\n",
|
---|
209 | encapsulation: ViewEncapsulation.None,
|
---|
210 | changeDetection: ChangeDetectionStrategy.OnPush
|
---|
211 | },] }
|
---|
212 | ];
|
---|
213 | MatListItem.ctorParameters = () => [
|
---|
214 | { type: ElementRef },
|
---|
215 | { type: ChangeDetectorRef },
|
---|
216 | { type: MatNavList, decorators: [{ type: Optional }, { type: Inject, args: [MAT_NAV_LIST,] }] },
|
---|
217 | { type: MatList, decorators: [{ type: Optional }, { type: Inject, args: [MAT_LIST,] }] }
|
---|
218 | ];
|
---|
219 | MatListItem.propDecorators = {
|
---|
220 | _lines: [{ type: ContentChildren, args: [MatLine, { descendants: true },] }],
|
---|
221 | _avatar: [{ type: ContentChild, args: [MatListAvatarCssMatStyler,] }],
|
---|
222 | _icon: [{ type: ContentChild, args: [MatListIconCssMatStyler,] }],
|
---|
223 | disabled: [{ type: Input }]
|
---|
224 | };
|
---|
225 |
|
---|
226 | /**
|
---|
227 | * @license
|
---|
228 | * Copyright Google LLC All Rights Reserved.
|
---|
229 | *
|
---|
230 | * Use of this source code is governed by an MIT-style license that can be
|
---|
231 | * found in the LICENSE file at https://angular.io/license
|
---|
232 | */
|
---|
233 | const _MatSelectionListBase = mixinDisableRipple(class {
|
---|
234 | });
|
---|
235 | const _MatListOptionBase = mixinDisableRipple(class {
|
---|
236 | });
|
---|
237 | /** @docs-private */
|
---|
238 | const MAT_SELECTION_LIST_VALUE_ACCESSOR = {
|
---|
239 | provide: NG_VALUE_ACCESSOR,
|
---|
240 | useExisting: forwardRef(() => MatSelectionList),
|
---|
241 | multi: true
|
---|
242 | };
|
---|
243 | /** Change event that is being fired whenever the selected state of an option changes. */
|
---|
244 | class MatSelectionListChange {
|
---|
245 | constructor(
|
---|
246 | /** Reference to the selection list that emitted the event. */
|
---|
247 | source,
|
---|
248 | /**
|
---|
249 | * Reference to the option that has been changed.
|
---|
250 | * @deprecated Use `options` instead, because some events may change more than one option.
|
---|
251 | * @breaking-change 12.0.0
|
---|
252 | */
|
---|
253 | option,
|
---|
254 | /** Reference to the options that have been changed. */
|
---|
255 | options) {
|
---|
256 | this.source = source;
|
---|
257 | this.option = option;
|
---|
258 | this.options = options;
|
---|
259 | }
|
---|
260 | }
|
---|
261 | /**
|
---|
262 | * Component for list-options of selection-list. Each list-option can automatically
|
---|
263 | * generate a checkbox and can put current item into the selectionModel of selection-list
|
---|
264 | * if the current item is selected.
|
---|
265 | */
|
---|
266 | class MatListOption extends _MatListOptionBase {
|
---|
267 | constructor(_element, _changeDetector,
|
---|
268 | /** @docs-private */
|
---|
269 | selectionList) {
|
---|
270 | super();
|
---|
271 | this._element = _element;
|
---|
272 | this._changeDetector = _changeDetector;
|
---|
273 | this.selectionList = selectionList;
|
---|
274 | this._selected = false;
|
---|
275 | this._disabled = false;
|
---|
276 | this._hasFocus = false;
|
---|
277 | /**
|
---|
278 | * Emits when the selected state of the option has changed.
|
---|
279 | * Use to facilitate two-data binding to the `selected` property.
|
---|
280 | * @docs-private
|
---|
281 | */
|
---|
282 | this.selectedChange = new EventEmitter();
|
---|
283 | /** Whether the label should appear before or after the checkbox. Defaults to 'after' */
|
---|
284 | this.checkboxPosition = 'after';
|
---|
285 | /**
|
---|
286 | * This is set to true after the first OnChanges cycle so we don't clear the value of `selected`
|
---|
287 | * in the first cycle.
|
---|
288 | */
|
---|
289 | this._inputsInitialized = false;
|
---|
290 | }
|
---|
291 | /** Theme color of the list option. This sets the color of the checkbox. */
|
---|
292 | get color() { return this._color || this.selectionList.color; }
|
---|
293 | set color(newValue) { this._color = newValue; }
|
---|
294 | /** Value of the option */
|
---|
295 | get value() { return this._value; }
|
---|
296 | set value(newValue) {
|
---|
297 | if (this.selected &&
|
---|
298 | !this.selectionList.compareWith(newValue, this.value) &&
|
---|
299 | this._inputsInitialized) {
|
---|
300 | this.selected = false;
|
---|
301 | }
|
---|
302 | this._value = newValue;
|
---|
303 | }
|
---|
304 | /** Whether the option is disabled. */
|
---|
305 | get disabled() { return this._disabled || (this.selectionList && this.selectionList.disabled); }
|
---|
306 | set disabled(value) {
|
---|
307 | const newValue = coerceBooleanProperty(value);
|
---|
308 | if (newValue !== this._disabled) {
|
---|
309 | this._disabled = newValue;
|
---|
310 | this._changeDetector.markForCheck();
|
---|
311 | }
|
---|
312 | }
|
---|
313 | /** Whether the option is selected. */
|
---|
314 | get selected() { return this.selectionList.selectedOptions.isSelected(this); }
|
---|
315 | set selected(value) {
|
---|
316 | const isSelected = coerceBooleanProperty(value);
|
---|
317 | if (isSelected !== this._selected) {
|
---|
318 | this._setSelected(isSelected);
|
---|
319 | if (isSelected || this.selectionList.multiple) {
|
---|
320 | this.selectionList._reportValueChange();
|
---|
321 | }
|
---|
322 | }
|
---|
323 | }
|
---|
324 | ngOnInit() {
|
---|
325 | const list = this.selectionList;
|
---|
326 | if (list._value && list._value.some(value => list.compareWith(value, this._value))) {
|
---|
327 | this._setSelected(true);
|
---|
328 | }
|
---|
329 | const wasSelected = this._selected;
|
---|
330 | // List options that are selected at initialization can't be reported properly to the form
|
---|
331 | // control. This is because it takes some time until the selection-list knows about all
|
---|
332 | // available options. Also it can happen that the ControlValueAccessor has an initial value
|
---|
333 | // that should be used instead. Deferring the value change report to the next tick ensures
|
---|
334 | // that the form control value is not being overwritten.
|
---|
335 | Promise.resolve().then(() => {
|
---|
336 | if (this._selected || wasSelected) {
|
---|
337 | this.selected = true;
|
---|
338 | this._changeDetector.markForCheck();
|
---|
339 | }
|
---|
340 | });
|
---|
341 | this._inputsInitialized = true;
|
---|
342 | }
|
---|
343 | ngAfterContentInit() {
|
---|
344 | setLines(this._lines, this._element);
|
---|
345 | }
|
---|
346 | ngOnDestroy() {
|
---|
347 | if (this.selected) {
|
---|
348 | // We have to delay this until the next tick in order
|
---|
349 | // to avoid changed after checked errors.
|
---|
350 | Promise.resolve().then(() => {
|
---|
351 | this.selected = false;
|
---|
352 | });
|
---|
353 | }
|
---|
354 | const hadFocus = this._hasFocus;
|
---|
355 | const newActiveItem = this.selectionList._removeOptionFromList(this);
|
---|
356 | // Only move focus if this option was focused at the time it was destroyed.
|
---|
357 | if (hadFocus && newActiveItem) {
|
---|
358 | newActiveItem.focus();
|
---|
359 | }
|
---|
360 | }
|
---|
361 | /** Toggles the selection state of the option. */
|
---|
362 | toggle() {
|
---|
363 | this.selected = !this.selected;
|
---|
364 | }
|
---|
365 | /** Allows for programmatic focusing of the option. */
|
---|
366 | focus() {
|
---|
367 | this._element.nativeElement.focus();
|
---|
368 | }
|
---|
369 | /**
|
---|
370 | * Returns the list item's text label. Implemented as a part of the FocusKeyManager.
|
---|
371 | * @docs-private
|
---|
372 | */
|
---|
373 | getLabel() {
|
---|
374 | return this._text ? (this._text.nativeElement.textContent || '') : '';
|
---|
375 | }
|
---|
376 | /** Whether this list item should show a ripple effect when clicked. */
|
---|
377 | _isRippleDisabled() {
|
---|
378 | return this.disabled || this.disableRipple || this.selectionList.disableRipple;
|
---|
379 | }
|
---|
380 | _handleClick() {
|
---|
381 | if (!this.disabled && (this.selectionList.multiple || !this.selected)) {
|
---|
382 | this.toggle();
|
---|
383 | // Emit a change event if the selected state of the option changed through user interaction.
|
---|
384 | this.selectionList._emitChangeEvent([this]);
|
---|
385 | }
|
---|
386 | }
|
---|
387 | _handleFocus() {
|
---|
388 | this.selectionList._setFocusedOption(this);
|
---|
389 | this._hasFocus = true;
|
---|
390 | }
|
---|
391 | _handleBlur() {
|
---|
392 | this.selectionList._onTouched();
|
---|
393 | this._hasFocus = false;
|
---|
394 | }
|
---|
395 | /** Retrieves the DOM element of the component host. */
|
---|
396 | _getHostElement() {
|
---|
397 | return this._element.nativeElement;
|
---|
398 | }
|
---|
399 | /** Sets the selected state of the option. Returns whether the value has changed. */
|
---|
400 | _setSelected(selected) {
|
---|
401 | if (selected === this._selected) {
|
---|
402 | return false;
|
---|
403 | }
|
---|
404 | this._selected = selected;
|
---|
405 | if (selected) {
|
---|
406 | this.selectionList.selectedOptions.select(this);
|
---|
407 | }
|
---|
408 | else {
|
---|
409 | this.selectionList.selectedOptions.deselect(this);
|
---|
410 | }
|
---|
411 | this.selectedChange.emit(selected);
|
---|
412 | this._changeDetector.markForCheck();
|
---|
413 | return true;
|
---|
414 | }
|
---|
415 | /**
|
---|
416 | * Notifies Angular that the option needs to be checked in the next change detection run. Mainly
|
---|
417 | * used to trigger an update of the list option if the disabled state of the selection list
|
---|
418 | * changed.
|
---|
419 | */
|
---|
420 | _markForCheck() {
|
---|
421 | this._changeDetector.markForCheck();
|
---|
422 | }
|
---|
423 | }
|
---|
424 | MatListOption.decorators = [
|
---|
425 | { type: Component, args: [{
|
---|
426 | selector: 'mat-list-option',
|
---|
427 | exportAs: 'matListOption',
|
---|
428 | inputs: ['disableRipple'],
|
---|
429 | host: {
|
---|
430 | 'role': 'option',
|
---|
431 | 'class': 'mat-list-item mat-list-option mat-focus-indicator',
|
---|
432 | '(focus)': '_handleFocus()',
|
---|
433 | '(blur)': '_handleBlur()',
|
---|
434 | '(click)': '_handleClick()',
|
---|
435 | '[class.mat-list-item-disabled]': 'disabled',
|
---|
436 | '[class.mat-list-item-with-avatar]': '_avatar || _icon',
|
---|
437 | // Manually set the "primary" or "warn" class if the color has been explicitly
|
---|
438 | // set to "primary" or "warn". The pseudo checkbox picks up these classes for
|
---|
439 | // its theme.
|
---|
440 | '[class.mat-primary]': 'color === "primary"',
|
---|
441 | // Even though accent is the default, we need to set this class anyway, because the list might
|
---|
442 | // be placed inside a parent that has one of the other colors with a higher specificity.
|
---|
443 | '[class.mat-accent]': 'color !== "primary" && color !== "warn"',
|
---|
444 | '[class.mat-warn]': 'color === "warn"',
|
---|
445 | '[class.mat-list-single-selected-option]': 'selected && !selectionList.multiple',
|
---|
446 | '[attr.aria-selected]': 'selected',
|
---|
447 | '[attr.aria-disabled]': 'disabled',
|
---|
448 | '[attr.tabindex]': '-1',
|
---|
449 | },
|
---|
450 | template: "<div class=\"mat-list-item-content\"\n [class.mat-list-item-content-reverse]=\"checkboxPosition == 'after'\">\n\n <div mat-ripple\n class=\"mat-list-item-ripple\"\n [matRippleTrigger]=\"_getHostElement()\"\n [matRippleDisabled]=\"_isRippleDisabled()\"></div>\n\n <mat-pseudo-checkbox\n *ngIf=\"selectionList.multiple\"\n [state]=\"selected ? 'checked' : 'unchecked'\"\n [disabled]=\"disabled\"></mat-pseudo-checkbox>\n\n <div class=\"mat-list-text\" #text><ng-content></ng-content></div>\n\n <ng-content select=\"[mat-list-avatar], [mat-list-icon], [matListAvatar], [matListIcon]\">\n </ng-content>\n\n</div>\n",
|
---|
451 | encapsulation: ViewEncapsulation.None,
|
---|
452 | changeDetection: ChangeDetectionStrategy.OnPush
|
---|
453 | },] }
|
---|
454 | ];
|
---|
455 | MatListOption.ctorParameters = () => [
|
---|
456 | { type: ElementRef },
|
---|
457 | { type: ChangeDetectorRef },
|
---|
458 | { type: MatSelectionList, decorators: [{ type: Inject, args: [forwardRef(() => MatSelectionList),] }] }
|
---|
459 | ];
|
---|
460 | MatListOption.propDecorators = {
|
---|
461 | _avatar: [{ type: ContentChild, args: [MatListAvatarCssMatStyler,] }],
|
---|
462 | _icon: [{ type: ContentChild, args: [MatListIconCssMatStyler,] }],
|
---|
463 | _lines: [{ type: ContentChildren, args: [MatLine, { descendants: true },] }],
|
---|
464 | selectedChange: [{ type: Output }],
|
---|
465 | _text: [{ type: ViewChild, args: ['text',] }],
|
---|
466 | checkboxPosition: [{ type: Input }],
|
---|
467 | color: [{ type: Input }],
|
---|
468 | value: [{ type: Input }],
|
---|
469 | disabled: [{ type: Input }],
|
---|
470 | selected: [{ type: Input }]
|
---|
471 | };
|
---|
472 | /**
|
---|
473 | * Material Design list component where each item is a selectable option. Behaves as a listbox.
|
---|
474 | */
|
---|
475 | class MatSelectionList extends _MatSelectionListBase {
|
---|
476 | constructor(_element,
|
---|
477 | // @breaking-change 11.0.0 Remove `tabIndex` parameter.
|
---|
478 | tabIndex, _changeDetector,
|
---|
479 | // @breaking-change 11.0.0 `_focusMonitor` parameter to become required.
|
---|
480 | _focusMonitor) {
|
---|
481 | super();
|
---|
482 | this._element = _element;
|
---|
483 | this._changeDetector = _changeDetector;
|
---|
484 | this._focusMonitor = _focusMonitor;
|
---|
485 | this._multiple = true;
|
---|
486 | this._contentInitialized = false;
|
---|
487 | /** Emits a change event whenever the selected state of an option changes. */
|
---|
488 | this.selectionChange = new EventEmitter();
|
---|
489 | /**
|
---|
490 | * Tabindex of the selection list.
|
---|
491 | * @breaking-change 11.0.0 Remove `tabIndex` input.
|
---|
492 | */
|
---|
493 | this.tabIndex = 0;
|
---|
494 | /** Theme color of the selection list. This sets the checkbox color for all list options. */
|
---|
495 | this.color = 'accent';
|
---|
496 | /**
|
---|
497 | * Function used for comparing an option against the selected value when determining which
|
---|
498 | * options should appear as selected. The first argument is the value of an options. The second
|
---|
499 | * one is a value from the selected value. A boolean must be returned.
|
---|
500 | */
|
---|
501 | this.compareWith = (a1, a2) => a1 === a2;
|
---|
502 | this._disabled = false;
|
---|
503 | /** The currently selected options. */
|
---|
504 | this.selectedOptions = new SelectionModel(this._multiple);
|
---|
505 | /** The tabindex of the selection list. */
|
---|
506 | this._tabIndex = -1;
|
---|
507 | /** View to model callback that should be called whenever the selected options change. */
|
---|
508 | this._onChange = (_) => { };
|
---|
509 | /** Emits when the list has been destroyed. */
|
---|
510 | this._destroyed = new Subject();
|
---|
511 | /** View to model callback that should be called if the list or its options lost focus. */
|
---|
512 | this._onTouched = () => { };
|
---|
513 | }
|
---|
514 | /** Whether the selection list is disabled. */
|
---|
515 | get disabled() { return this._disabled; }
|
---|
516 | set disabled(value) {
|
---|
517 | this._disabled = coerceBooleanProperty(value);
|
---|
518 | // The `MatSelectionList` and `MatListOption` are using the `OnPush` change detection
|
---|
519 | // strategy. Therefore the options will not check for any changes if the `MatSelectionList`
|
---|
520 | // changed its state. Since we know that a change to `disabled` property of the list affects
|
---|
521 | // the state of the options, we manually mark each option for check.
|
---|
522 | this._markOptionsForCheck();
|
---|
523 | }
|
---|
524 | /** Whether selection is limited to one or multiple items (default multiple). */
|
---|
525 | get multiple() { return this._multiple; }
|
---|
526 | set multiple(value) {
|
---|
527 | const newValue = coerceBooleanProperty(value);
|
---|
528 | if (newValue !== this._multiple) {
|
---|
529 | if (this._contentInitialized && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
---|
530 | throw new Error('Cannot change `multiple` mode of mat-selection-list after initialization.');
|
---|
531 | }
|
---|
532 | this._multiple = newValue;
|
---|
533 | this.selectedOptions = new SelectionModel(this._multiple, this.selectedOptions.selected);
|
---|
534 | }
|
---|
535 | }
|
---|
536 | ngAfterContentInit() {
|
---|
537 | var _a;
|
---|
538 | this._contentInitialized = true;
|
---|
539 | this._keyManager = new FocusKeyManager(this.options)
|
---|
540 | .withWrap()
|
---|
541 | .withTypeAhead()
|
---|
542 | .withHomeAndEnd()
|
---|
543 | // Allow disabled items to be focusable. For accessibility reasons, there must be a way for
|
---|
544 | // screenreader users, that allows reading the different options of the list.
|
---|
545 | .skipPredicate(() => false)
|
---|
546 | .withAllowedModifierKeys(['shiftKey']);
|
---|
547 | if (this._value) {
|
---|
548 | this._setOptionsFromValues(this._value);
|
---|
549 | }
|
---|
550 | // If the user attempts to tab out of the selection list, allow focus to escape.
|
---|
551 | this._keyManager.tabOut.pipe(takeUntil(this._destroyed)).subscribe(() => {
|
---|
552 | this._allowFocusEscape();
|
---|
553 | });
|
---|
554 | // When the number of options change, update the tabindex of the selection list.
|
---|
555 | this.options.changes.pipe(startWith(null), takeUntil(this._destroyed)).subscribe(() => {
|
---|
556 | this._updateTabIndex();
|
---|
557 | });
|
---|
558 | // Sync external changes to the model back to the options.
|
---|
559 | this.selectedOptions.changed.pipe(takeUntil(this._destroyed)).subscribe(event => {
|
---|
560 | if (event.added) {
|
---|
561 | for (let item of event.added) {
|
---|
562 | item.selected = true;
|
---|
563 | }
|
---|
564 | }
|
---|
565 | if (event.removed) {
|
---|
566 | for (let item of event.removed) {
|
---|
567 | item.selected = false;
|
---|
568 | }
|
---|
569 | }
|
---|
570 | });
|
---|
571 | // @breaking-change 11.0.0 Remove null assertion once _focusMonitor is required.
|
---|
572 | (_a = this._focusMonitor) === null || _a === void 0 ? void 0 : _a.monitor(this._element).pipe(takeUntil(this._destroyed)).subscribe(origin => {
|
---|
573 | var _a;
|
---|
574 | if (origin === 'keyboard' || origin === 'program') {
|
---|
575 | let toFocus = 0;
|
---|
576 | for (let i = 0; i < this.options.length; i++) {
|
---|
577 | if ((_a = this.options.get(i)) === null || _a === void 0 ? void 0 : _a.selected) {
|
---|
578 | toFocus = i;
|
---|
579 | break;
|
---|
580 | }
|
---|
581 | }
|
---|
582 | this._keyManager.setActiveItem(toFocus);
|
---|
583 | }
|
---|
584 | });
|
---|
585 | }
|
---|
586 | ngOnChanges(changes) {
|
---|
587 | const disableRippleChanges = changes['disableRipple'];
|
---|
588 | const colorChanges = changes['color'];
|
---|
589 | if ((disableRippleChanges && !disableRippleChanges.firstChange) ||
|
---|
590 | (colorChanges && !colorChanges.firstChange)) {
|
---|
591 | this._markOptionsForCheck();
|
---|
592 | }
|
---|
593 | }
|
---|
594 | ngOnDestroy() {
|
---|
595 | var _a;
|
---|
596 | // @breaking-change 11.0.0 Remove null assertion once _focusMonitor is required.
|
---|
597 | (_a = this._focusMonitor) === null || _a === void 0 ? void 0 : _a.stopMonitoring(this._element);
|
---|
598 | this._destroyed.next();
|
---|
599 | this._destroyed.complete();
|
---|
600 | this._isDestroyed = true;
|
---|
601 | }
|
---|
602 | /** Focuses the selection list. */
|
---|
603 | focus(options) {
|
---|
604 | this._element.nativeElement.focus(options);
|
---|
605 | }
|
---|
606 | /** Selects all of the options. Returns the options that changed as a result. */
|
---|
607 | selectAll() {
|
---|
608 | return this._setAllOptionsSelected(true);
|
---|
609 | }
|
---|
610 | /** Deselects all of the options. Returns the options that changed as a result. */
|
---|
611 | deselectAll() {
|
---|
612 | return this._setAllOptionsSelected(false);
|
---|
613 | }
|
---|
614 | /** Sets the focused option of the selection-list. */
|
---|
615 | _setFocusedOption(option) {
|
---|
616 | this._keyManager.updateActiveItem(option);
|
---|
617 | }
|
---|
618 | /**
|
---|
619 | * Removes an option from the selection list and updates the active item.
|
---|
620 | * @returns Currently-active item.
|
---|
621 | */
|
---|
622 | _removeOptionFromList(option) {
|
---|
623 | const optionIndex = this._getOptionIndex(option);
|
---|
624 | if (optionIndex > -1 && this._keyManager.activeItemIndex === optionIndex) {
|
---|
625 | // Check whether the option is the last item
|
---|
626 | if (optionIndex > 0) {
|
---|
627 | this._keyManager.updateActiveItem(optionIndex - 1);
|
---|
628 | }
|
---|
629 | else if (optionIndex === 0 && this.options.length > 1) {
|
---|
630 | this._keyManager.updateActiveItem(Math.min(optionIndex + 1, this.options.length - 1));
|
---|
631 | }
|
---|
632 | }
|
---|
633 | return this._keyManager.activeItem;
|
---|
634 | }
|
---|
635 | /** Passes relevant key presses to our key manager. */
|
---|
636 | _keydown(event) {
|
---|
637 | const keyCode = event.keyCode;
|
---|
638 | const manager = this._keyManager;
|
---|
639 | const previousFocusIndex = manager.activeItemIndex;
|
---|
640 | const hasModifier = hasModifierKey(event);
|
---|
641 | switch (keyCode) {
|
---|
642 | case SPACE:
|
---|
643 | case ENTER:
|
---|
644 | if (!hasModifier && !manager.isTyping()) {
|
---|
645 | this._toggleFocusedOption();
|
---|
646 | // Always prevent space from scrolling the page since the list has focus
|
---|
647 | event.preventDefault();
|
---|
648 | }
|
---|
649 | break;
|
---|
650 | default:
|
---|
651 | // The "A" key gets special treatment, because it's used for the "select all" functionality.
|
---|
652 | if (keyCode === A && this.multiple && hasModifierKey(event, 'ctrlKey') &&
|
---|
653 | !manager.isTyping()) {
|
---|
654 | const shouldSelect = this.options.some(option => !option.disabled && !option.selected);
|
---|
655 | this._setAllOptionsSelected(shouldSelect, true, true);
|
---|
656 | event.preventDefault();
|
---|
657 | }
|
---|
658 | else {
|
---|
659 | manager.onKeydown(event);
|
---|
660 | }
|
---|
661 | }
|
---|
662 | if (this.multiple && (keyCode === UP_ARROW || keyCode === DOWN_ARROW) && event.shiftKey &&
|
---|
663 | manager.activeItemIndex !== previousFocusIndex) {
|
---|
664 | this._toggleFocusedOption();
|
---|
665 | }
|
---|
666 | }
|
---|
667 | /** Reports a value change to the ControlValueAccessor */
|
---|
668 | _reportValueChange() {
|
---|
669 | // Stop reporting value changes after the list has been destroyed. This avoids
|
---|
670 | // cases where the list might wrongly reset its value once it is removed, but
|
---|
671 | // the form control is still live.
|
---|
672 | if (this.options && !this._isDestroyed) {
|
---|
673 | const value = this._getSelectedOptionValues();
|
---|
674 | this._onChange(value);
|
---|
675 | this._value = value;
|
---|
676 | }
|
---|
677 | }
|
---|
678 | /** Emits a change event if the selected state of an option changed. */
|
---|
679 | _emitChangeEvent(options) {
|
---|
680 | this.selectionChange.emit(new MatSelectionListChange(this, options[0], options));
|
---|
681 | }
|
---|
682 | /** Implemented as part of ControlValueAccessor. */
|
---|
683 | writeValue(values) {
|
---|
684 | this._value = values;
|
---|
685 | if (this.options) {
|
---|
686 | this._setOptionsFromValues(values || []);
|
---|
687 | }
|
---|
688 | }
|
---|
689 | /** Implemented as a part of ControlValueAccessor. */
|
---|
690 | setDisabledState(isDisabled) {
|
---|
691 | this.disabled = isDisabled;
|
---|
692 | }
|
---|
693 | /** Implemented as part of ControlValueAccessor. */
|
---|
694 | registerOnChange(fn) {
|
---|
695 | this._onChange = fn;
|
---|
696 | }
|
---|
697 | /** Implemented as part of ControlValueAccessor. */
|
---|
698 | registerOnTouched(fn) {
|
---|
699 | this._onTouched = fn;
|
---|
700 | }
|
---|
701 | /** Sets the selected options based on the specified values. */
|
---|
702 | _setOptionsFromValues(values) {
|
---|
703 | this.options.forEach(option => option._setSelected(false));
|
---|
704 | values.forEach(value => {
|
---|
705 | const correspondingOption = this.options.find(option => {
|
---|
706 | // Skip options that are already in the model. This allows us to handle cases
|
---|
707 | // where the same primitive value is selected multiple times.
|
---|
708 | return option.selected ? false : this.compareWith(option.value, value);
|
---|
709 | });
|
---|
710 | if (correspondingOption) {
|
---|
711 | correspondingOption._setSelected(true);
|
---|
712 | }
|
---|
713 | });
|
---|
714 | }
|
---|
715 | /** Returns the values of the selected options. */
|
---|
716 | _getSelectedOptionValues() {
|
---|
717 | return this.options.filter(option => option.selected).map(option => option.value);
|
---|
718 | }
|
---|
719 | /** Toggles the state of the currently focused option if enabled. */
|
---|
720 | _toggleFocusedOption() {
|
---|
721 | let focusedIndex = this._keyManager.activeItemIndex;
|
---|
722 | if (focusedIndex != null && this._isValidIndex(focusedIndex)) {
|
---|
723 | let focusedOption = this.options.toArray()[focusedIndex];
|
---|
724 | if (focusedOption && !focusedOption.disabled && (this._multiple || !focusedOption.selected)) {
|
---|
725 | focusedOption.toggle();
|
---|
726 | // Emit a change event because the focused option changed its state through user
|
---|
727 | // interaction.
|
---|
728 | this._emitChangeEvent([focusedOption]);
|
---|
729 | }
|
---|
730 | }
|
---|
731 | }
|
---|
732 | /**
|
---|
733 | * Sets the selected state on all of the options
|
---|
734 | * and emits an event if anything changed.
|
---|
735 | */
|
---|
736 | _setAllOptionsSelected(isSelected, skipDisabled, isUserInput) {
|
---|
737 | // Keep track of whether anything changed, because we only want to
|
---|
738 | // emit the changed event when something actually changed.
|
---|
739 | const changedOptions = [];
|
---|
740 | this.options.forEach(option => {
|
---|
741 | if ((!skipDisabled || !option.disabled) && option._setSelected(isSelected)) {
|
---|
742 | changedOptions.push(option);
|
---|
743 | }
|
---|
744 | });
|
---|
745 | if (changedOptions.length) {
|
---|
746 | this._reportValueChange();
|
---|
747 | if (isUserInput) {
|
---|
748 | this._emitChangeEvent(changedOptions);
|
---|
749 | }
|
---|
750 | }
|
---|
751 | return changedOptions;
|
---|
752 | }
|
---|
753 | /**
|
---|
754 | * Utility to ensure all indexes are valid.
|
---|
755 | * @param index The index to be checked.
|
---|
756 | * @returns True if the index is valid for our list of options.
|
---|
757 | */
|
---|
758 | _isValidIndex(index) {
|
---|
759 | return index >= 0 && index < this.options.length;
|
---|
760 | }
|
---|
761 | /** Returns the index of the specified list option. */
|
---|
762 | _getOptionIndex(option) {
|
---|
763 | return this.options.toArray().indexOf(option);
|
---|
764 | }
|
---|
765 | /** Marks all the options to be checked in the next change detection run. */
|
---|
766 | _markOptionsForCheck() {
|
---|
767 | if (this.options) {
|
---|
768 | this.options.forEach(option => option._markForCheck());
|
---|
769 | }
|
---|
770 | }
|
---|
771 | /**
|
---|
772 | * Removes the tabindex from the selection list and resets it back afterwards, allowing the user
|
---|
773 | * to tab out of it. This prevents the list from capturing focus and redirecting it back within
|
---|
774 | * the list, creating a focus trap if it user tries to tab away.
|
---|
775 | */
|
---|
776 | _allowFocusEscape() {
|
---|
777 | this._tabIndex = -1;
|
---|
778 | setTimeout(() => {
|
---|
779 | this._tabIndex = 0;
|
---|
780 | this._changeDetector.markForCheck();
|
---|
781 | });
|
---|
782 | }
|
---|
783 | /** Updates the tabindex based upon if the selection list is empty. */
|
---|
784 | _updateTabIndex() {
|
---|
785 | this._tabIndex = (this.options.length === 0) ? -1 : 0;
|
---|
786 | }
|
---|
787 | }
|
---|
788 | MatSelectionList.decorators = [
|
---|
789 | { type: Component, args: [{
|
---|
790 | selector: 'mat-selection-list',
|
---|
791 | exportAs: 'matSelectionList',
|
---|
792 | inputs: ['disableRipple'],
|
---|
793 | host: {
|
---|
794 | 'role': 'listbox',
|
---|
795 | 'class': 'mat-selection-list mat-list-base',
|
---|
796 | '(keydown)': '_keydown($event)',
|
---|
797 | '[attr.aria-multiselectable]': 'multiple',
|
---|
798 | '[attr.aria-disabled]': 'disabled.toString()',
|
---|
799 | '[attr.tabindex]': '_tabIndex',
|
---|
800 | },
|
---|
801 | template: '<ng-content></ng-content>',
|
---|
802 | encapsulation: ViewEncapsulation.None,
|
---|
803 | providers: [MAT_SELECTION_LIST_VALUE_ACCESSOR],
|
---|
804 | changeDetection: ChangeDetectionStrategy.OnPush,
|
---|
805 | styles: [".mat-subheader{display:flex;box-sizing:border-box;padding:16px;align-items:center}.mat-list-base .mat-subheader{margin:0}.mat-list-base{padding-top:8px;display:block;-webkit-tap-highlight-color:transparent}.mat-list-base .mat-subheader{height:48px;line-height:16px}.mat-list-base .mat-subheader:first-child{margin-top:-8px}.mat-list-base .mat-list-item,.mat-list-base .mat-list-option{display:block;height:48px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base .mat-list-item .mat-list-item-content,.mat-list-base .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base .mat-list-item .mat-list-item-content-reverse,.mat-list-base .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base .mat-list-item .mat-list-item-ripple,.mat-list-base .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar,.mat-list-base .mat-list-option.mat-list-item-with-avatar{height:56px}.mat-list-base .mat-list-item.mat-2-line,.mat-list-base .mat-list-option.mat-2-line{height:72px}.mat-list-base .mat-list-item.mat-3-line,.mat-list-base .mat-list-option.mat-3-line{height:88px}.mat-list-base .mat-list-item.mat-multi-line,.mat-list-base .mat-list-option.mat-multi-line{height:auto}.mat-list-base .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base .mat-list-item .mat-list-text,.mat-list-base .mat-list-option .mat-list-text{display:flex;flex-direction:column;flex:auto;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base .mat-list-item .mat-list-text>*,.mat-list-base .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-list-base .mat-list-item .mat-list-text:empty,.mat-list-base .mat-list-option .mat-list-text:empty{display:none}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base .mat-list-item .mat-list-avatar,.mat-list-base .mat-list-option .mat-list-avatar{flex-shrink:0;width:40px;height:40px;border-radius:50%;object-fit:cover}.mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:72px;width:calc(100% - 72px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:72px}.mat-list-base .mat-list-item .mat-list-icon,.mat-list-base .mat-list-option .mat-list-icon{flex-shrink:0;width:24px;height:24px;font-size:24px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:64px;width:calc(100% - 64px)}[dir=rtl] .mat-list-base .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:64px}.mat-list-base .mat-list-item .mat-divider,.mat-list-base .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base .mat-list-item .mat-divider,[dir=rtl] .mat-list-base .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-list-base[dense]{padding-top:4px;display:block}.mat-list-base[dense] .mat-subheader{height:40px;line-height:8px}.mat-list-base[dense] .mat-subheader:first-child{margin-top:-4px}.mat-list-base[dense] .mat-list-item,.mat-list-base[dense] .mat-list-option{display:block;height:40px;-webkit-tap-highlight-color:transparent;width:100%;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-item-content,.mat-list-base[dense] .mat-list-option .mat-list-item-content{display:flex;flex-direction:row;align-items:center;box-sizing:border-box;padding:0 16px;position:relative;height:inherit}.mat-list-base[dense] .mat-list-item .mat-list-item-content-reverse,.mat-list-base[dense] .mat-list-option .mat-list-item-content-reverse{display:flex;align-items:center;padding:0 16px;flex-direction:row-reverse;justify-content:space-around}.mat-list-base[dense] .mat-list-item .mat-list-item-ripple,.mat-list-base[dense] .mat-list-option .mat-list-item-ripple{top:0;left:0;right:0;bottom:0;position:absolute;pointer-events:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar{height:48px}.mat-list-base[dense] .mat-list-item.mat-2-line,.mat-list-base[dense] .mat-list-option.mat-2-line{height:60px}.mat-list-base[dense] .mat-list-item.mat-3-line,.mat-list-base[dense] .mat-list-option.mat-3-line{height:76px}.mat-list-base[dense] .mat-list-item.mat-multi-line,.mat-list-base[dense] .mat-list-option.mat-multi-line{height:auto}.mat-list-base[dense] .mat-list-item.mat-multi-line .mat-list-item-content,.mat-list-base[dense] .mat-list-option.mat-multi-line .mat-list-item-content{padding-top:16px;padding-bottom:16px}.mat-list-base[dense] .mat-list-item .mat-list-text,.mat-list-base[dense] .mat-list-option .mat-list-text{display:flex;flex-direction:column;flex:auto;box-sizing:border-box;overflow:hidden;padding:0}.mat-list-base[dense] .mat-list-item .mat-list-text>*,.mat-list-base[dense] .mat-list-option .mat-list-text>*{margin:0;padding:0;font-weight:normal;font-size:inherit}.mat-list-base[dense] .mat-list-item .mat-list-text:empty,.mat-list-base[dense] .mat-list-option .mat-list-text:empty{display:none}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:0;padding-left:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:0}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-left:0;padding-right:16px}[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-item.mat-list-option .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar .mat-list-item-content-reverse .mat-list-text,[dir=rtl] .mat-list-base[dense] .mat-list-option.mat-list-option .mat-list-item-content-reverse .mat-list-text{padding-right:0;padding-left:16px}.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-item.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content-reverse .mat-list-text,.mat-list-base[dense] .mat-list-option.mat-list-item-with-avatar.mat-list-option .mat-list-item-content .mat-list-text{padding-right:16px;padding-left:16px}.mat-list-base[dense] .mat-list-item .mat-list-avatar,.mat-list-base[dense] .mat-list-option .mat-list-avatar{flex-shrink:0;width:36px;height:36px;border-radius:50%;object-fit:cover}.mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:68px;width:calc(100% - 68px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-avatar~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-avatar~.mat-divider-inset{margin-left:auto;margin-right:68px}.mat-list-base[dense] .mat-list-item .mat-list-icon,.mat-list-base[dense] .mat-list-option .mat-list-icon{flex-shrink:0;width:20px;height:20px;font-size:20px;box-sizing:content-box;border-radius:50%;padding:4px}.mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:60px;width:calc(100% - 60px)}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-list-icon~.mat-divider-inset,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-list-icon~.mat-divider-inset{margin-left:auto;margin-right:60px}.mat-list-base[dense] .mat-list-item .mat-divider,.mat-list-base[dense] .mat-list-option .mat-divider{position:absolute;bottom:0;left:0;width:100%;margin:0}[dir=rtl] .mat-list-base[dense] .mat-list-item .mat-divider,[dir=rtl] .mat-list-base[dense] .mat-list-option .mat-divider{margin-left:auto;margin-right:0}.mat-list-base[dense] .mat-list-item .mat-divider.mat-divider-inset,.mat-list-base[dense] .mat-list-option .mat-divider.mat-divider-inset{position:absolute}.mat-nav-list a{text-decoration:none;color:inherit}.mat-nav-list .mat-list-item{cursor:pointer;outline:none}mat-action-list button{background:none;color:inherit;border:none;font:inherit;outline:inherit;-webkit-tap-highlight-color:transparent;text-align:left}[dir=rtl] mat-action-list button{text-align:right}mat-action-list button::-moz-focus-inner{border:0}mat-action-list .mat-list-item{cursor:pointer;outline:inherit}.mat-list-option:not(.mat-list-item-disabled){cursor:pointer;outline:none}.mat-list-item-disabled{pointer-events:none}.cdk-high-contrast-active .mat-list-item-disabled{opacity:.5}.cdk-high-contrast-active :host .mat-list-item-disabled{opacity:.5}.cdk-high-contrast-active .mat-selection-list:focus{outline-style:dotted}.cdk-high-contrast-active .mat-list-option:hover,.cdk-high-contrast-active .mat-list-option:focus,.cdk-high-contrast-active .mat-nav-list .mat-list-item:hover,.cdk-high-contrast-active .mat-nav-list .mat-list-item:focus,.cdk-high-contrast-active mat-action-list .mat-list-item:hover,.cdk-high-contrast-active mat-action-list .mat-list-item:focus{outline:dotted 1px;z-index:1}.cdk-high-contrast-active .mat-list-single-selected-option::after{content:\"\";position:absolute;top:50%;right:16px;transform:translateY(-50%);width:10px;height:0;border-bottom:solid 10px;border-radius:10px}.cdk-high-contrast-active [dir=rtl] .mat-list-single-selected-option::after{right:auto;left:16px}@media(hover: none){.mat-list-option:not(.mat-list-single-selected-option):not(.mat-list-item-disabled):hover,.mat-nav-list .mat-list-item:not(.mat-list-item-disabled):hover,.mat-action-list .mat-list-item:not(.mat-list-item-disabled):hover{background:none}}\n"]
|
---|
806 | },] }
|
---|
807 | ];
|
---|
808 | MatSelectionList.ctorParameters = () => [
|
---|
809 | { type: ElementRef },
|
---|
810 | { type: String, decorators: [{ type: Attribute, args: ['tabindex',] }] },
|
---|
811 | { type: ChangeDetectorRef },
|
---|
812 | { type: FocusMonitor }
|
---|
813 | ];
|
---|
814 | MatSelectionList.propDecorators = {
|
---|
815 | options: [{ type: ContentChildren, args: [MatListOption, { descendants: true },] }],
|
---|
816 | selectionChange: [{ type: Output }],
|
---|
817 | tabIndex: [{ type: Input }],
|
---|
818 | color: [{ type: Input }],
|
---|
819 | compareWith: [{ type: Input }],
|
---|
820 | disabled: [{ type: Input }],
|
---|
821 | multiple: [{ type: Input }]
|
---|
822 | };
|
---|
823 |
|
---|
824 | /**
|
---|
825 | * @license
|
---|
826 | * Copyright Google LLC All Rights Reserved.
|
---|
827 | *
|
---|
828 | * Use of this source code is governed by an MIT-style license that can be
|
---|
829 | * found in the LICENSE file at https://angular.io/license
|
---|
830 | */
|
---|
831 | class MatListModule {
|
---|
832 | }
|
---|
833 | MatListModule.decorators = [
|
---|
834 | { type: NgModule, args: [{
|
---|
835 | imports: [MatLineModule, MatRippleModule, MatCommonModule, MatPseudoCheckboxModule, CommonModule],
|
---|
836 | exports: [
|
---|
837 | MatList,
|
---|
838 | MatNavList,
|
---|
839 | MatListItem,
|
---|
840 | MatListAvatarCssMatStyler,
|
---|
841 | MatLineModule,
|
---|
842 | MatCommonModule,
|
---|
843 | MatListIconCssMatStyler,
|
---|
844 | MatListSubheaderCssMatStyler,
|
---|
845 | MatPseudoCheckboxModule,
|
---|
846 | MatSelectionList,
|
---|
847 | MatListOption,
|
---|
848 | MatDividerModule
|
---|
849 | ],
|
---|
850 | declarations: [
|
---|
851 | MatList,
|
---|
852 | MatNavList,
|
---|
853 | MatListItem,
|
---|
854 | MatListAvatarCssMatStyler,
|
---|
855 | MatListIconCssMatStyler,
|
---|
856 | MatListSubheaderCssMatStyler,
|
---|
857 | MatSelectionList,
|
---|
858 | MatListOption
|
---|
859 | ],
|
---|
860 | },] }
|
---|
861 | ];
|
---|
862 |
|
---|
863 | /**
|
---|
864 | * @license
|
---|
865 | * Copyright Google LLC All Rights Reserved.
|
---|
866 | *
|
---|
867 | * Use of this source code is governed by an MIT-style license that can be
|
---|
868 | * found in the LICENSE file at https://angular.io/license
|
---|
869 | */
|
---|
870 |
|
---|
871 | /**
|
---|
872 | * Generated bundle index. Do not edit.
|
---|
873 | */
|
---|
874 |
|
---|
875 | export { MAT_LIST, MAT_NAV_LIST, MAT_SELECTION_LIST_VALUE_ACCESSOR, MatList, MatListAvatarCssMatStyler, MatListIconCssMatStyler, MatListItem, MatListModule, MatListOption, MatListSubheaderCssMatStyler, MatNavList, MatSelectionList, MatSelectionListChange };
|
---|
876 | //# sourceMappingURL=list.js.map
|
---|