@aurelia-mdc-web/all 9.3.0-au2 → 9.3.1-au2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chips/mdc-chip/mdc-chip.js.map +1 -1
- package/dist/data-table/mdc-data-table.js.map +1 -1
- package/dist/dialog/mdc-dialog-service.js.map +1 -1
- package/dist/expandable/mdc-expandable.js.map +1 -1
- package/dist/form-field/mdc-form-field.js.map +1 -1
- package/dist/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item.js.map +1 -1
- package/dist/list/mdc-list-item/mdc-list-item.js.map +1 -1
- package/dist/menu/mdc-menu.js.map +1 -1
- package/dist/segmented-button/mdc-segmented-button-segment/mdc-segmented-button-segment.js.map +1 -1
- package/dist/select/mdc-select-value-observer.js.map +1 -1
- package/dist/select/mdc-select.js.map +1 -1
- package/dist/text-field/mdc-text-field.js.map +1 -1
- package/dist/tree-view/mdc-tree-view.js.map +1 -1
- package/package.json +2 -2
- package/src/chips/mdc-chip/mdc-chip.ts +290 -290
- package/src/data-table/mdc-data-table.ts +432 -432
- package/src/dialog/mdc-dialog-service.ts +80 -80
- package/src/expandable/mdc-expandable.ts +104 -104
- package/src/form-field/mdc-form-field.ts +60 -60
- package/src/list/mdc-deprecated-list/mdc-deprecated-list-item/mdc-deprecated-list-item.ts +108 -108
- package/src/list/mdc-list-item/mdc-list-item.ts +136 -136
- package/src/menu/mdc-menu.ts +340 -340
- package/src/segmented-button/mdc-segmented-button-segment/mdc-segmented-button-segment.ts +170 -170
- package/src/select/mdc-select-value-observer.ts +346 -346
- package/src/select/mdc-select.ts +480 -480
- package/src/text-field/mdc-text-field.ts +535 -535
- package/src/tree-view/mdc-tree-view.ts +147 -147
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
import { cssClasses, strings } from '@material/list';
|
|
2
|
-
import { customElement, bindable, inject, INode } from 'aurelia';
|
|
3
|
-
import { booleanAttr } from '../../../base';
|
|
4
|
-
import { processContent } from '@aurelia/runtime-html';
|
|
5
|
-
import template from './mdc-deprecated-list-item.html?raw';
|
|
6
|
-
|
|
7
|
-
// let listItemId = 0;
|
|
8
|
-
|
|
9
|
-
const ENTER = 13;
|
|
10
|
-
const SPACE = 32;
|
|
11
|
-
const LIST_ITEM_ACTION = 'mdclistitem:action';
|
|
12
|
-
let id = 0;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @selector mdc-deprecated-list-item
|
|
16
|
-
*/
|
|
17
|
-
@inject(Element)
|
|
18
|
-
@customElement({ name: 'mdc-deprecated-list-item', template })
|
|
19
|
-
@processContent(function processContent(node: INode) {
|
|
20
|
-
const element = node as HTMLElement;
|
|
21
|
-
const graphic = element.querySelector('mdc-checkbox:not([mdc-deprecated-list-item-meta]),[mdc-deprecated-list-item-graphic]');
|
|
22
|
-
if (graphic) {
|
|
23
|
-
element.removeChild(graphic);
|
|
24
|
-
}
|
|
25
|
-
const meta = element.querySelector('[mdc-deprecated-list-item-meta]');
|
|
26
|
-
if (meta) {
|
|
27
|
-
element.removeChild(meta);
|
|
28
|
-
}
|
|
29
|
-
const itemText = document.createElement('span');
|
|
30
|
-
itemText.classList.add('mdc-deprecated-list-item__text');
|
|
31
|
-
const children = [].slice.call(element.childNodes) as ChildNode[];
|
|
32
|
-
for (let i = 0; i < children.length; ++i) {
|
|
33
|
-
itemText.appendChild(children[i]);
|
|
34
|
-
}
|
|
35
|
-
if (graphic) {
|
|
36
|
-
element.appendChild(graphic);
|
|
37
|
-
}
|
|
38
|
-
element.appendChild(itemText);
|
|
39
|
-
if (meta) {
|
|
40
|
-
element.appendChild(meta);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
)
|
|
44
|
-
export class MdcDeprecatedListItem {
|
|
45
|
-
constructor(public root: HTMLElement) {
|
|
46
|
-
this.root.id = `mdc-deprecated-list-item-${this.id}`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
cssClasses = cssClasses;
|
|
50
|
-
|
|
51
|
-
id = `mdc-deprecated-list-item-${++id}`;
|
|
52
|
-
|
|
53
|
-
/** Disables the list item */
|
|
54
|
-
@bindable({ set: booleanAttr })
|
|
55
|
-
disabled: boolean;
|
|
56
|
-
|
|
57
|
-
/** Styles the row in an activated state */
|
|
58
|
-
@bindable({ set: booleanAttr })
|
|
59
|
-
activated: boolean;
|
|
60
|
-
|
|
61
|
-
/** Random data associated with the list item. Passed in events payload. */
|
|
62
|
-
@bindable()
|
|
63
|
-
value: unknown;
|
|
64
|
-
|
|
65
|
-
/** Disables ripple effect */
|
|
66
|
-
@bindable({ set: booleanAttr })
|
|
67
|
-
disableRipple: boolean;
|
|
68
|
-
|
|
69
|
-
attached() {
|
|
70
|
-
// Child button/a elements are not tabbable until the list item is focused.
|
|
71
|
-
Array.from(this.root.querySelectorAll(strings.FOCUSABLE_CHILD_ELEMENTS))
|
|
72
|
-
.forEach(el => el.setAttribute('tabindex', '-1'));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
onKeydown(evt: KeyboardEvent) {
|
|
76
|
-
if ((evt.keyCode === ENTER || evt.keyCode === SPACE) && !this.disabled) {
|
|
77
|
-
this.root.dispatchEvent(new CustomEvent(LIST_ITEM_ACTION, { detail: { item: this, data: this.value }, bubbles: true }));
|
|
78
|
-
}
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
onClick() {
|
|
83
|
-
if (!this.disabled) {
|
|
84
|
-
this.root.dispatchEvent(new CustomEvent(LIST_ITEM_ACTION, { detail: { item: this, data: this.value }, bubbles: true }));
|
|
85
|
-
}
|
|
86
|
-
return true;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/** @hidden */
|
|
92
|
-
export interface IMdcListItemElement extends HTMLElement {
|
|
93
|
-
$au: {
|
|
94
|
-
'au:resource:custom-element': {
|
|
95
|
-
viewModel: MdcDeprecatedListItem;
|
|
96
|
-
};
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export interface IMdcListActionEventDetail {
|
|
101
|
-
index: number;
|
|
102
|
-
data: unknown;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** @hidden */
|
|
106
|
-
export interface IMdcListActionEvent extends Event {
|
|
107
|
-
detail: IMdcListActionEventDetail;
|
|
108
|
-
}
|
|
1
|
+
import { cssClasses, strings } from '@material/list';
|
|
2
|
+
import { customElement, bindable, inject, INode } from 'aurelia';
|
|
3
|
+
import { booleanAttr } from '../../../base';
|
|
4
|
+
import { processContent } from '@aurelia/runtime-html';
|
|
5
|
+
import template from './mdc-deprecated-list-item.html?raw';
|
|
6
|
+
|
|
7
|
+
// let listItemId = 0;
|
|
8
|
+
|
|
9
|
+
const ENTER = 13;
|
|
10
|
+
const SPACE = 32;
|
|
11
|
+
const LIST_ITEM_ACTION = 'mdclistitem:action';
|
|
12
|
+
let id = 0;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @selector mdc-deprecated-list-item
|
|
16
|
+
*/
|
|
17
|
+
@inject(Element)
|
|
18
|
+
@customElement({ name: 'mdc-deprecated-list-item', template })
|
|
19
|
+
@processContent(function processContent(node: INode) {
|
|
20
|
+
const element = node as HTMLElement;
|
|
21
|
+
const graphic = element.querySelector('mdc-checkbox:not([mdc-deprecated-list-item-meta]),[mdc-deprecated-list-item-graphic]');
|
|
22
|
+
if (graphic) {
|
|
23
|
+
element.removeChild(graphic);
|
|
24
|
+
}
|
|
25
|
+
const meta = element.querySelector('[mdc-deprecated-list-item-meta]');
|
|
26
|
+
if (meta) {
|
|
27
|
+
element.removeChild(meta);
|
|
28
|
+
}
|
|
29
|
+
const itemText = document.createElement('span');
|
|
30
|
+
itemText.classList.add('mdc-deprecated-list-item__text');
|
|
31
|
+
const children = [].slice.call(element.childNodes) as ChildNode[];
|
|
32
|
+
for (let i = 0; i < children.length; ++i) {
|
|
33
|
+
itemText.appendChild(children[i]);
|
|
34
|
+
}
|
|
35
|
+
if (graphic) {
|
|
36
|
+
element.appendChild(graphic);
|
|
37
|
+
}
|
|
38
|
+
element.appendChild(itemText);
|
|
39
|
+
if (meta) {
|
|
40
|
+
element.appendChild(meta);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
export class MdcDeprecatedListItem {
|
|
45
|
+
constructor(public root: HTMLElement) {
|
|
46
|
+
this.root.id = `mdc-deprecated-list-item-${this.id}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
cssClasses = cssClasses;
|
|
50
|
+
|
|
51
|
+
id = `mdc-deprecated-list-item-${++id}`;
|
|
52
|
+
|
|
53
|
+
/** Disables the list item */
|
|
54
|
+
@bindable({ set: booleanAttr })
|
|
55
|
+
disabled: boolean;
|
|
56
|
+
|
|
57
|
+
/** Styles the row in an activated state */
|
|
58
|
+
@bindable({ set: booleanAttr })
|
|
59
|
+
activated: boolean;
|
|
60
|
+
|
|
61
|
+
/** Random data associated with the list item. Passed in events payload. */
|
|
62
|
+
@bindable()
|
|
63
|
+
value: unknown;
|
|
64
|
+
|
|
65
|
+
/** Disables ripple effect */
|
|
66
|
+
@bindable({ set: booleanAttr })
|
|
67
|
+
disableRipple: boolean;
|
|
68
|
+
|
|
69
|
+
attached() {
|
|
70
|
+
// Child button/a elements are not tabbable until the list item is focused.
|
|
71
|
+
Array.from(this.root.querySelectorAll(strings.FOCUSABLE_CHILD_ELEMENTS))
|
|
72
|
+
.forEach(el => el.setAttribute('tabindex', '-1'));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
onKeydown(evt: KeyboardEvent) {
|
|
76
|
+
if ((evt.keyCode === ENTER || evt.keyCode === SPACE) && !this.disabled) {
|
|
77
|
+
this.root.dispatchEvent(new CustomEvent(LIST_ITEM_ACTION, { detail: { item: this, data: this.value }, bubbles: true }));
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
onClick() {
|
|
83
|
+
if (!this.disabled) {
|
|
84
|
+
this.root.dispatchEvent(new CustomEvent(LIST_ITEM_ACTION, { detail: { item: this, data: this.value }, bubbles: true }));
|
|
85
|
+
}
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** @hidden */
|
|
92
|
+
export interface IMdcListItemElement extends HTMLElement {
|
|
93
|
+
$au: {
|
|
94
|
+
'au:resource:custom-element': {
|
|
95
|
+
viewModel: MdcDeprecatedListItem;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface IMdcListActionEventDetail {
|
|
101
|
+
index: number;
|
|
102
|
+
data: unknown;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** @hidden */
|
|
106
|
+
export interface IMdcListActionEvent extends Event {
|
|
107
|
+
detail: IMdcListActionEventDetail;
|
|
108
|
+
}
|
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
import { cssClasses, strings } from '@material/list';
|
|
2
|
-
import { customElement, bindable, inject, INode } from 'aurelia';
|
|
3
|
-
import { booleanAttr } from '../../base';
|
|
4
|
-
import { processContent } from '@aurelia/runtime-html';
|
|
5
|
-
import template from './mdc-list-item.html?raw';
|
|
6
|
-
|
|
7
|
-
const ENTER = 13;
|
|
8
|
-
const SPACE = 32;
|
|
9
|
-
const LIST_ITEM_ACTION = 'mdclistitem:action';
|
|
10
|
-
let id = 0;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @selector mdc-list-item
|
|
14
|
-
*/
|
|
15
|
-
@inject(Element)
|
|
16
|
-
@customElement({ name: 'mdc-list-item', template })
|
|
17
|
-
@processContent(function processContent(node: INode) {
|
|
18
|
-
const element = node as HTMLElement;
|
|
19
|
-
const leading = element.querySelector('[mdc-list-item-leading]');
|
|
20
|
-
if (leading) {
|
|
21
|
-
element.removeChild(leading);
|
|
22
|
-
}
|
|
23
|
-
const trailing = element.querySelector('[mdc-list-item-trailing]');
|
|
24
|
-
if (trailing) {
|
|
25
|
-
element.removeChild(trailing);
|
|
26
|
-
}
|
|
27
|
-
const content = document.createElement('span');
|
|
28
|
-
content.classList.add('mdc-list-item__content');
|
|
29
|
-
const texts = element.querySelectorAll('mdc-list-item-overline-text, mdc-list-item-primary-text, mdc-list-item-secondary-text, au-slot');
|
|
30
|
-
const children = Array.from(element.childNodes);
|
|
31
|
-
if (!texts.length) {
|
|
32
|
-
const primary = document.createElement('span');
|
|
33
|
-
primary.classList.add('mdc-list-item__primary-text');
|
|
34
|
-
for (let i = 0; i < children.length; ++i) {
|
|
35
|
-
primary.appendChild(children[i]);
|
|
36
|
-
}
|
|
37
|
-
content.appendChild(primary);
|
|
38
|
-
} else {
|
|
39
|
-
for (let i = 0; i < children.length; ++i) {
|
|
40
|
-
content.appendChild(children[i]);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (leading) {
|
|
44
|
-
const start = document.createElement('span');
|
|
45
|
-
start.classList.add('mdc-list-item__start');
|
|
46
|
-
start.appendChild(leading);
|
|
47
|
-
element.appendChild(start);
|
|
48
|
-
}
|
|
49
|
-
element.appendChild(content);
|
|
50
|
-
if (trailing) {
|
|
51
|
-
const end = document.createElement('span');
|
|
52
|
-
end.classList.add('mdc-list-item__end');
|
|
53
|
-
end.appendChild(trailing);
|
|
54
|
-
element.appendChild(end);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
export class MdcListItem {
|
|
59
|
-
constructor(public root: HTMLElement) { }
|
|
60
|
-
|
|
61
|
-
cssClasses = cssClasses;
|
|
62
|
-
|
|
63
|
-
id = `mdc-list-item-${++id}`;
|
|
64
|
-
|
|
65
|
-
/** Disables the list item */
|
|
66
|
-
@bindable({ set: booleanAttr })
|
|
67
|
-
disabled: boolean;
|
|
68
|
-
|
|
69
|
-
/** Styles the row in an activated state */
|
|
70
|
-
@bindable({ set: booleanAttr })
|
|
71
|
-
activated: boolean;
|
|
72
|
-
|
|
73
|
-
/** Styles the row in an selected state */
|
|
74
|
-
@bindable({ set: booleanAttr })
|
|
75
|
-
selected: boolean;
|
|
76
|
-
|
|
77
|
-
/** Indicates a non-interactive item */
|
|
78
|
-
@bindable({ set: booleanAttr })
|
|
79
|
-
nonInteractive: boolean;
|
|
80
|
-
|
|
81
|
-
/** Indicates a two-line item */
|
|
82
|
-
@bindable({ set: booleanAttr })
|
|
83
|
-
twoLine: boolean;
|
|
84
|
-
|
|
85
|
-
/** Indicates a three-line item */
|
|
86
|
-
@bindable({ set: booleanAttr })
|
|
87
|
-
threeLine: boolean;
|
|
88
|
-
|
|
89
|
-
/** Random data associated with the list item. Passed in events payload. */
|
|
90
|
-
@bindable()
|
|
91
|
-
value: unknown;
|
|
92
|
-
|
|
93
|
-
/** Disables ripple effect */
|
|
94
|
-
@bindable({ set: booleanAttr })
|
|
95
|
-
disableRipple: boolean;
|
|
96
|
-
|
|
97
|
-
attached() {
|
|
98
|
-
// Child button/a elements are not tabbable until the list item is focused.
|
|
99
|
-
Array.from(this.root.querySelectorAll(strings.FOCUSABLE_CHILD_ELEMENTS))
|
|
100
|
-
.forEach(el => el.setAttribute('tabindex', '-1'));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
onKeydown(evt: KeyboardEvent) {
|
|
104
|
-
if ((evt.keyCode === ENTER || evt.keyCode === SPACE) && !this.disabled) {
|
|
105
|
-
this.root.dispatchEvent(new CustomEvent(LIST_ITEM_ACTION, { detail: { item: this, data: this.value }, bubbles: true }));
|
|
106
|
-
}
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
onClick() {
|
|
111
|
-
if (!this.disabled) {
|
|
112
|
-
this.root.dispatchEvent(new CustomEvent(LIST_ITEM_ACTION, { detail: { item: this, data: this.value }, bubbles: true }));
|
|
113
|
-
}
|
|
114
|
-
return true;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/** @hidden */
|
|
120
|
-
export interface IMdcListItemElement extends HTMLElement {
|
|
121
|
-
$au: {
|
|
122
|
-
'au:resource:custom-element': {
|
|
123
|
-
viewModel: MdcListItem;
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
export interface IMdcListActionEventDetail {
|
|
129
|
-
index: number;
|
|
130
|
-
data: unknown;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/** @hidden */
|
|
134
|
-
export interface IMdcListActionEvent extends Event {
|
|
135
|
-
detail: IMdcListActionEventDetail;
|
|
136
|
-
}
|
|
1
|
+
import { cssClasses, strings } from '@material/list';
|
|
2
|
+
import { customElement, bindable, inject, INode } from 'aurelia';
|
|
3
|
+
import { booleanAttr } from '../../base';
|
|
4
|
+
import { processContent } from '@aurelia/runtime-html';
|
|
5
|
+
import template from './mdc-list-item.html?raw';
|
|
6
|
+
|
|
7
|
+
const ENTER = 13;
|
|
8
|
+
const SPACE = 32;
|
|
9
|
+
const LIST_ITEM_ACTION = 'mdclistitem:action';
|
|
10
|
+
let id = 0;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @selector mdc-list-item
|
|
14
|
+
*/
|
|
15
|
+
@inject(Element)
|
|
16
|
+
@customElement({ name: 'mdc-list-item', template })
|
|
17
|
+
@processContent(function processContent(node: INode) {
|
|
18
|
+
const element = node as HTMLElement;
|
|
19
|
+
const leading = element.querySelector('[mdc-list-item-leading]');
|
|
20
|
+
if (leading) {
|
|
21
|
+
element.removeChild(leading);
|
|
22
|
+
}
|
|
23
|
+
const trailing = element.querySelector('[mdc-list-item-trailing]');
|
|
24
|
+
if (trailing) {
|
|
25
|
+
element.removeChild(trailing);
|
|
26
|
+
}
|
|
27
|
+
const content = document.createElement('span');
|
|
28
|
+
content.classList.add('mdc-list-item__content');
|
|
29
|
+
const texts = element.querySelectorAll('mdc-list-item-overline-text, mdc-list-item-primary-text, mdc-list-item-secondary-text, au-slot');
|
|
30
|
+
const children = Array.from(element.childNodes);
|
|
31
|
+
if (!texts.length) {
|
|
32
|
+
const primary = document.createElement('span');
|
|
33
|
+
primary.classList.add('mdc-list-item__primary-text');
|
|
34
|
+
for (let i = 0; i < children.length; ++i) {
|
|
35
|
+
primary.appendChild(children[i]);
|
|
36
|
+
}
|
|
37
|
+
content.appendChild(primary);
|
|
38
|
+
} else {
|
|
39
|
+
for (let i = 0; i < children.length; ++i) {
|
|
40
|
+
content.appendChild(children[i]);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (leading) {
|
|
44
|
+
const start = document.createElement('span');
|
|
45
|
+
start.classList.add('mdc-list-item__start');
|
|
46
|
+
start.appendChild(leading);
|
|
47
|
+
element.appendChild(start);
|
|
48
|
+
}
|
|
49
|
+
element.appendChild(content);
|
|
50
|
+
if (trailing) {
|
|
51
|
+
const end = document.createElement('span');
|
|
52
|
+
end.classList.add('mdc-list-item__end');
|
|
53
|
+
end.appendChild(trailing);
|
|
54
|
+
element.appendChild(end);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
export class MdcListItem {
|
|
59
|
+
constructor(public root: HTMLElement) { }
|
|
60
|
+
|
|
61
|
+
cssClasses = cssClasses;
|
|
62
|
+
|
|
63
|
+
id = `mdc-list-item-${++id}`;
|
|
64
|
+
|
|
65
|
+
/** Disables the list item */
|
|
66
|
+
@bindable({ set: booleanAttr })
|
|
67
|
+
disabled: boolean;
|
|
68
|
+
|
|
69
|
+
/** Styles the row in an activated state */
|
|
70
|
+
@bindable({ set: booleanAttr })
|
|
71
|
+
activated: boolean;
|
|
72
|
+
|
|
73
|
+
/** Styles the row in an selected state */
|
|
74
|
+
@bindable({ set: booleanAttr })
|
|
75
|
+
selected: boolean;
|
|
76
|
+
|
|
77
|
+
/** Indicates a non-interactive item */
|
|
78
|
+
@bindable({ set: booleanAttr })
|
|
79
|
+
nonInteractive: boolean;
|
|
80
|
+
|
|
81
|
+
/** Indicates a two-line item */
|
|
82
|
+
@bindable({ set: booleanAttr })
|
|
83
|
+
twoLine: boolean;
|
|
84
|
+
|
|
85
|
+
/** Indicates a three-line item */
|
|
86
|
+
@bindable({ set: booleanAttr })
|
|
87
|
+
threeLine: boolean;
|
|
88
|
+
|
|
89
|
+
/** Random data associated with the list item. Passed in events payload. */
|
|
90
|
+
@bindable()
|
|
91
|
+
value: unknown;
|
|
92
|
+
|
|
93
|
+
/** Disables ripple effect */
|
|
94
|
+
@bindable({ set: booleanAttr })
|
|
95
|
+
disableRipple: boolean;
|
|
96
|
+
|
|
97
|
+
attached() {
|
|
98
|
+
// Child button/a elements are not tabbable until the list item is focused.
|
|
99
|
+
Array.from(this.root.querySelectorAll(strings.FOCUSABLE_CHILD_ELEMENTS))
|
|
100
|
+
.forEach(el => el.setAttribute('tabindex', '-1'));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
onKeydown(evt: KeyboardEvent) {
|
|
104
|
+
if ((evt.keyCode === ENTER || evt.keyCode === SPACE) && !this.disabled) {
|
|
105
|
+
this.root.dispatchEvent(new CustomEvent(LIST_ITEM_ACTION, { detail: { item: this, data: this.value }, bubbles: true }));
|
|
106
|
+
}
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
onClick() {
|
|
111
|
+
if (!this.disabled) {
|
|
112
|
+
this.root.dispatchEvent(new CustomEvent(LIST_ITEM_ACTION, { detail: { item: this, data: this.value }, bubbles: true }));
|
|
113
|
+
}
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** @hidden */
|
|
120
|
+
export interface IMdcListItemElement extends HTMLElement {
|
|
121
|
+
$au: {
|
|
122
|
+
'au:resource:custom-element': {
|
|
123
|
+
viewModel: MdcListItem;
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface IMdcListActionEventDetail {
|
|
129
|
+
index: number;
|
|
130
|
+
data: unknown;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** @hidden */
|
|
134
|
+
export interface IMdcListActionEvent extends Event {
|
|
135
|
+
detail: IMdcListActionEventDetail;
|
|
136
|
+
}
|