UNPKG

@angular-mdc/web

Version:
324 lines (320 loc) 9.1 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 { Directive, ElementRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, NgModule } from '@angular/core'; import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { MdcRipple } from '@angular-mdc/web/ripple'; /** * @fileoverview added by tsickle * Generated from: card/card.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ class MdcCardMediaContent { /** * @param {?} elementRef */ constructor(elementRef) { this.elementRef = elementRef; } } MdcCardMediaContent.decorators = [ { type: Directive, args: [{ selector: 'mdc-card-media-content, [mdcCardMediaContent]', exportAs: 'mdcCardMediaContent', host: { 'class': 'mdc-card__media-content' } },] }, ]; /** @nocollapse */ MdcCardMediaContent.ctorParameters = () => [ { type: ElementRef } ]; class MdcCardMedia { /** * @param {?} elementRef */ constructor(elementRef) { this.elementRef = elementRef; this._square = false; this._wide = false; } /** * @return {?} */ get square() { return this._square; } /** * @param {?} value * @return {?} */ set square(value) { this._square = coerceBooleanProperty(value); } /** * @return {?} */ get wide() { return this._wide; } /** * @param {?} value * @return {?} */ set wide(value) { this._wide = coerceBooleanProperty(value); } } MdcCardMedia.decorators = [ { type: Component, args: [{selector: 'mdc-card-media, [mdcCardMedia]', exportAs: 'mdcCardMedia', host: { 'class': 'mdc-card__media', '[class.mdc-card__media--square]': 'square', '[class.mdc-card__media--16-9]': 'wide' }, template: '<ng-content></ng-content>', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush },] }, ]; /** @nocollapse */ MdcCardMedia.ctorParameters = () => [ { type: ElementRef } ]; MdcCardMedia.propDecorators = { square: [{ type: Input }], wide: [{ type: Input }] }; class MdcCardPrimaryAction { /** * @param {?} _ripple * @param {?} elementRef */ constructor(_ripple, elementRef) { this._ripple = _ripple; this.elementRef = elementRef; this._ripple = new MdcRipple(this.elementRef); this._ripple.init(); } /** * @return {?} */ ngOnDestroy() { this._ripple.destroy(); } } MdcCardPrimaryAction.decorators = [ { type: Component, args: [{selector: 'mdc-card-primary-action, [mdcCardPrimaryAction]', exportAs: 'mdcCardPrimaryAction', host: { 'class': 'mdc-card__primary-action' }, template: '<ng-content></ng-content>', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, providers: [MdcRipple] },] }, ]; /** @nocollapse */ MdcCardPrimaryAction.ctorParameters = () => [ { type: MdcRipple }, { type: ElementRef } ]; class MdcCardActions { /** * @param {?} elementRef */ constructor(elementRef) { this.elementRef = elementRef; this._fullBleed = false; } /** * @return {?} */ get fullBleed() { return this._fullBleed; } /** * @param {?} value * @return {?} */ set fullBleed(value) { this._fullBleed = coerceBooleanProperty(value); } } MdcCardActions.decorators = [ { type: Component, args: [{selector: 'mdc-card-actions, [mdcCardActions]', template: '<ng-content></ng-content>', exportAs: 'mdcCardActions', host: { 'class': 'mdc-card__actions', '[class.mdc-card__actions--full-bleed]': 'fullBleed' }, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush },] }, ]; /** @nocollapse */ MdcCardActions.ctorParameters = () => [ { type: ElementRef } ]; MdcCardActions.propDecorators = { fullBleed: [{ type: Input }] }; class MdcCardActionButtons { /** * @param {?} elementRef */ constructor(elementRef) { this.elementRef = elementRef; } } MdcCardActionButtons.decorators = [ { type: Directive, args: [{ selector: 'mdc-card-action-buttons, [mdcCardActionButtons]', exportAs: 'mdcCardActionButtons', host: { 'class': 'mdc-card__action-buttons' } },] }, ]; /** @nocollapse */ MdcCardActionButtons.ctorParameters = () => [ { type: ElementRef } ]; class MdcCardActionIcons { /** * @param {?} elementRef */ constructor(elementRef) { this.elementRef = elementRef; } } MdcCardActionIcons.decorators = [ { type: Directive, args: [{ selector: 'mdc-card-action-icons, [mdcCardActionIcons]', exportAs: 'mdcCardActionIcons', host: { 'class': 'mdc-card__action-icons' } },] }, ]; /** @nocollapse */ MdcCardActionIcons.ctorParameters = () => [ { type: ElementRef } ]; class MdcCardAction { /** * @param {?} elementRef */ constructor(elementRef) { this.elementRef = elementRef; this._action = ''; } /** * @return {?} */ get action() { return this._action; } /** * @param {?} action * @return {?} */ set action(action) { // If the directive is set without a name (updated programatically), then this setter will // trigger with an empty string and should not overwrite the programatically set value. if (!action) { return; } if (action === 'button') { this.elementRef.nativeElement.classList.remove('mdc-card__action--icon'); this.elementRef.nativeElement.classList.add('mdc-card__action--button'); } else if (action === 'icon') { this.elementRef.nativeElement.classList.remove('mdc-card__action--button'); this.elementRef.nativeElement.classList.add('mdc-card__action--icon'); this.elementRef.nativeElement.setAttribute('tabIndex', '0'); this.elementRef.nativeElement.setAttribute('role', 'button'); } this._action = action; } } MdcCardAction.decorators = [ { type: Directive, args: [{ selector: '[mdcCardAction]', host: { 'class': 'mdc-card__action' } },] }, ]; /** @nocollapse */ MdcCardAction.ctorParameters = () => [ { type: ElementRef } ]; MdcCardAction.propDecorators = { action: [{ type: Input, args: ['mdcCardAction',] }] }; class MdcCard { /** * @param {?} elementRef */ constructor(elementRef) { this.elementRef = elementRef; this._outlined = false; } /** * @return {?} */ get outlined() { return this._outlined; } /** * @param {?} value * @return {?} */ set outlined(value) { this._outlined = coerceBooleanProperty(value); } } MdcCard.decorators = [ { type: Component, args: [{selector: 'mdc-card', exportAs: 'mdcCard', host: { 'class': 'mdc-card', '[class.mdc-card--outlined]': 'outlined' }, template: '<ng-content></ng-content>', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush },] }, ]; /** @nocollapse */ MdcCard.ctorParameters = () => [ { type: ElementRef } ]; MdcCard.propDecorators = { outlined: [{ type: Input }] }; /** * @fileoverview added by tsickle * Generated from: card/module.ts * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ const CARD_DECLARATIONS = [ MdcCard, MdcCardAction, MdcCardActionButtons, MdcCardActionIcons, MdcCardActions, MdcCardMedia, MdcCardMediaContent, MdcCardPrimaryAction ]; class MdcCardModule { } MdcCardModule.decorators = [ { type: NgModule, args: [{ exports: CARD_DECLARATIONS, declarations: CARD_DECLARATIONS, },] }, ]; export { MdcCard, MdcCardAction, MdcCardActionButtons, MdcCardActionIcons, MdcCardActions, MdcCardMedia, MdcCardMediaContent, MdcCardModule, MdcCardPrimaryAction }; //# sourceMappingURL=card.js.map