ran formatter & fixed lint

This commit is contained in:
Elliott Marquez 2019-08-21 11:14:11 -07:00
parent 0084524798
commit b1d1640c9c
8 changed files with 25 additions and 15 deletions

View File

@ -55,7 +55,8 @@ export class DrawerBase extends BaseElement {
element.classList.contains(className),
saveFocus: () => {
// Note, casting to avoid cumbersome runtime check.
this._previousFocus = (this.getRootNode() as ShadowRoot).activeElement as HTMLElement;
this._previousFocus =
(this.getRootNode() as ShadowRoot).activeElement as HTMLElement;
},
restoreFocus: () => {
const previousFocus = this._previousFocus && this._previousFocus.focus;

View File

@ -81,12 +81,15 @@ export class RadioBase extends FormElement {
protected mdcFoundation!: MDCRadioFoundation;
/* eslint-disable @typescript-eslint/no-use-before-define */
// Note if we aren't using native shadow DOM, then we don't technically need a
// SelectionController, because our inputs will share document-scoped native
// selection groups. However, it simplifies implementation and testing to use
// one in all cases. In particular, it means we correctly manage groups before
// the first update stamps the native input.
private _selectionController = SelectionController.getController(this);
/* eslint-enable @typescript-eslint/no-use-before-define */
connectedCallback() {
super.connectedCallback();

View File

@ -130,7 +130,8 @@ export const ripple =
directive((options: RippleOptions = {}) => (part: PropertyPart) => {
const surfaceNode = part.committer.element as HTMLElement;
const interactionNode = options.interactionNode || surfaceNode;
let rippleFoundation = part.value as MDCRippleFoundation | typeof noChange;
let rippleFoundation =
part.value as MDCRippleFoundation | typeof noChange;
// if the interaction node changes, destroy and invalidate the foundation.
const existingInteractionNode =
rippleInteractionNodes.get(rippleFoundation);
@ -148,10 +149,12 @@ export const ripple =
// otherwise update settings as needed.
} else {
if (options.unbounded !== undefined) {
(rippleFoundation as MDCRippleFoundation).setUnbounded(options.unbounded);
(rippleFoundation as MDCRippleFoundation)
.setUnbounded(options.unbounded);
}
if (options.disabled !== undefined) {
(rippleFoundation as MDCRippleFoundation).setUnbounded(options.disabled);
(rippleFoundation as MDCRippleFoundation)
.setUnbounded(options.disabled);
}
}
if (options.active === true) {

View File

@ -134,7 +134,8 @@ export class TabBarBase extends BaseElement {
},
getFocusedTabIndex: () => {
const tabElements = this._getTabs();
const activeElement = (this.getRootNode() as ShadowRoot).activeElement as Tab;
const activeElement =
(this.getRootNode() as ShadowRoot).activeElement as Tab;
return tabElements.indexOf(activeElement);
},
getIndexOfTabById: (id: string) => {

View File

@ -19,7 +19,7 @@ import {classMap, html, property, query} from '@material/mwc-base/form-element.j
import {characterCounter} from '@material/mwc-textfield/character-counter/mwc-character-counter-directive.js';
import {TextFieldBase} from '@material/mwc-textfield/mwc-textfield-base.js';
export {TextFieldType} from '@material/mwc-textfield/mwc-textfield-base.js'
export {TextFieldType} from '@material/mwc-textfield/mwc-textfield-base.js';
export abstract class TextAreaBase extends TextFieldBase {
@query('textarea') protected formElement!: HTMLInputElement;

View File

@ -19,7 +19,7 @@ import {customElement} from '@material/mwc-base/form-element.js';
import {TextAreaBase} from './mwc-textarea-base.js';
import {style} from './mwc-textarea-css.js';
export {TextFieldType} from '@material/mwc-textfield/mwc-textfield-base.js'
export {TextFieldType} from '@material/mwc-textfield/mwc-textfield-base.js';
declare global {
interface HTMLElementTagNameMap {

View File

@ -129,7 +129,7 @@ export abstract class TextFieldBase extends FormElement {
@change="${this.handleInputChange}">`;
}
protected renderIcon(icon: String) {
protected renderIcon(icon: string) {
return html`<i class="material-icons mdc-text-field__icon">${icon}</i>`;
}
@ -213,11 +213,11 @@ export abstract class TextFieldBase extends FormElement {
protected getRootAdapterMethods(): MDCTextFieldRootAdapter {
return {
registerTextFieldInteractionHandler: (evtType: string, handler: any) =>
registerTextFieldInteractionHandler: (evtType, handler) =>
this.addEventListener(evtType, handler),
deregisterTextFieldInteractionHandler: (evtType: string, handler: any) =>
deregisterTextFieldInteractionHandler: (evtType, handler) =>
this.removeEventListener(evtType, handler),
registerValidationAttributeChangeHandler: (handler: any) => {
registerValidationAttributeChangeHandler: (handler) => {
const getAttributesList =
(mutationsList: MutationRecord[]): string[] => {
return mutationsList.map((mutation) => mutation.attributeName)
@ -238,11 +238,13 @@ export abstract class TextFieldBase extends FormElement {
protected getInputAdapterMethods(): MDCTextFieldInputAdapter {
return {
getNativeInput: () => this.formElement,
isFocused: () => this.shadowRoot!.activeElement === this.formElement,
registerInputInteractionHandler: (evtType: string, handler: any) =>
isFocused: () => this.shadowRoot ?
this.shadowRoot.activeElement === this.formElement :
false,
registerInputInteractionHandler: (evtType, handler) =>
this.formElement.addEventListener(
evtType, handler, {passive: evtType in passiveEvents}),
deregisterInputInteractionHandler: (evtType: string, handler: any) =>
deregisterInputInteractionHandler: (evtType, handler) =>
this.formElement.removeEventListener(evtType, handler),
};
}

View File

@ -19,7 +19,7 @@ import {customElement} from '@material/mwc-base/form-element.js';
import {TextFieldBase} from './mwc-textfield-base.js';
import {style} from './mwc-textfield-css.js';
export {TextFieldType} from './mwc-textfield-base.js'
export {TextFieldType} from './mwc-textfield-base.js';
declare global {
interface HTMLElementTagNameMap {