UNPKG

@angular-mdc/web

Version:
117 lines (113 loc) 4.08 kB
/** * @license * Copyright (c) Dominic Carretto * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/trimox/angular-mdc-web/blob/master/LICENSE */ import { Component, ChangeDetectionStrategy, ViewEncapsulation, ElementRef, Input, ViewChild, NgModule } from '@angular/core'; import { MdcFloatingLabel, MdcFloatingLabelModule } from '@angular-mdc/web/floating-label'; import { MDCComponent } from '@angular-mdc/web/base'; import { MDCNotchedOutlineFoundation } from '@material/notched-outline'; /** * @fileoverview added by tsickle * Generated from: notched-outline/notched-outline.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class MdcNotchedOutline extends MDCComponent { /** * @param {?} elementRef */ constructor(elementRef) { super(elementRef); this.elementRef = elementRef; } /** * @return {?} */ getDefaultFoundation() { /** @type {?} */ const adapter = { addClass: (/** * @param {?} className * @return {?} */ (className) => this.elementRef.nativeElement.classList.add(className)), removeClass: (/** * @param {?} className * @return {?} */ (className) => this.elementRef.nativeElement.classList.remove(className)), setNotchWidthProperty: (/** * @param {?} width * @return {?} */ (width) => this._notchElement.nativeElement.style.setProperty('width', `${width}px`)), removeNotchWidthProperty: (/** * @return {?} */ () => this._notchElement.nativeElement.style.removeProperty('width')) }; return new MDCNotchedOutlineFoundation(adapter); } /** * Updates classes and styles to open the notch to the specified width. * @param {?} notchWidth * @return {?} */ notch(notchWidth) { this._foundation.notch(notchWidth); } /** * Updates classes and styles to close the notch. * @return {?} */ closeNotch() { this._foundation.closeNotch(); } } MdcNotchedOutline.decorators = [ { type: Component, args: [{selector: '[mdcNotchedOutline], mdc-notched-outline', exportAs: 'mdcNotchedOutline', host: { 'class': 'mdc-notched-outline', '[class.mdc-notched-outline--upgraded]': 'label', '[class.mdc-notched-outline--no-label]': '!label' }, template: ` <span class="mdc-notched-outline__leading"></span> <span #notch class="mdc-notched-outline__notch"> <label mdcFloatingLabel [for]="for">{{label}}</label> </span> <span class="mdc-notched-outline__trailing"></span> `, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None },] }, ]; /** @nocollapse */ MdcNotchedOutline.ctorParameters = () => [ { type: ElementRef } ]; MdcNotchedOutline.propDecorators = { label: [{ type: Input }], for: [{ type: Input }], _notchElement: [{ type: ViewChild, args: ['notch', { static: false },] }], floatingLabel: [{ type: ViewChild, args: [MdcFloatingLabel, { static: false },] }] }; /** * @fileoverview added by tsickle * Generated from: notched-outline/module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class MdcNotchedOutlineModule { } MdcNotchedOutlineModule.decorators = [ { type: NgModule, args: [{ imports: [MdcFloatingLabelModule], exports: [MdcNotchedOutline], declarations: [MdcNotchedOutline] },] }, ]; export { MdcNotchedOutline, MdcNotchedOutlineModule }; //# sourceMappingURL=notched-outline.js.map