@angular-mdc/web
Version:
333 lines (329 loc) • 11.1 kB
JavaScript
/**
* @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, ViewEncapsulation, ChangeDetectionStrategy, ElementRef, Input, Directive, 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
*/
var MdcCardMediaContent = /** @class */ (function () {
function MdcCardMediaContent(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 = function () { return [
{ type: ElementRef }
]; };
return MdcCardMediaContent;
}());
var MdcCardMedia = /** @class */ (function () {
function MdcCardMedia(elementRef) {
this.elementRef = elementRef;
this._square = false;
this._wide = false;
}
Object.defineProperty(MdcCardMedia.prototype, "square", {
get: /**
* @return {?}
*/
function () {
return this._square;
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._square = coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MdcCardMedia.prototype, "wide", {
get: /**
* @return {?}
*/
function () {
return this._wide;
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._wide = coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
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 = function () { return [
{ type: ElementRef }
]; };
MdcCardMedia.propDecorators = {
square: [{ type: Input }],
wide: [{ type: Input }]
};
return MdcCardMedia;
}());
var MdcCardPrimaryAction = /** @class */ (function () {
function MdcCardPrimaryAction(_ripple, elementRef) {
this._ripple = _ripple;
this.elementRef = elementRef;
this._ripple = new MdcRipple(this.elementRef);
this._ripple.init();
}
/**
* @return {?}
*/
MdcCardPrimaryAction.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
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 = function () { return [
{ type: MdcRipple },
{ type: ElementRef }
]; };
return MdcCardPrimaryAction;
}());
var MdcCardActions = /** @class */ (function () {
function MdcCardActions(elementRef) {
this.elementRef = elementRef;
this._fullBleed = false;
}
Object.defineProperty(MdcCardActions.prototype, "fullBleed", {
get: /**
* @return {?}
*/
function () {
return this._fullBleed;
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._fullBleed = coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
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 = function () { return [
{ type: ElementRef }
]; };
MdcCardActions.propDecorators = {
fullBleed: [{ type: Input }]
};
return MdcCardActions;
}());
var MdcCardActionButtons = /** @class */ (function () {
function MdcCardActionButtons(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 = function () { return [
{ type: ElementRef }
]; };
return MdcCardActionButtons;
}());
var MdcCardActionIcons = /** @class */ (function () {
function MdcCardActionIcons(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 = function () { return [
{ type: ElementRef }
]; };
return MdcCardActionIcons;
}());
var MdcCardAction = /** @class */ (function () {
function MdcCardAction(elementRef) {
this.elementRef = elementRef;
this._action = '';
}
Object.defineProperty(MdcCardAction.prototype, "action", {
get: /**
* @return {?}
*/
function () {
return this._action;
},
set: /**
* @param {?} action
* @return {?}
*/
function (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;
},
enumerable: true,
configurable: true
});
MdcCardAction.decorators = [
{ type: Directive, args: [{
selector: '[mdcCardAction]',
host: { 'class': 'mdc-card__action' }
},] },
];
/** @nocollapse */
MdcCardAction.ctorParameters = function () { return [
{ type: ElementRef }
]; };
MdcCardAction.propDecorators = {
action: [{ type: Input, args: ['mdcCardAction',] }]
};
return MdcCardAction;
}());
var MdcCard = /** @class */ (function () {
function MdcCard(elementRef) {
this.elementRef = elementRef;
this._outlined = false;
}
Object.defineProperty(MdcCard.prototype, "outlined", {
get: /**
* @return {?}
*/
function () {
return this._outlined;
},
set: /**
* @param {?} value
* @return {?}
*/
function (value) {
this._outlined = coerceBooleanProperty(value);
},
enumerable: true,
configurable: true
});
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 = function () { return [
{ type: ElementRef }
]; };
MdcCard.propDecorators = {
outlined: [{ type: Input }]
};
return MdcCard;
}());
/**
* @fileoverview added by tsickle
* Generated from: card/module.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var CARD_DECLARATIONS = [
MdcCard,
MdcCardAction,
MdcCardActionButtons,
MdcCardActionIcons,
MdcCardActions,
MdcCardMedia,
MdcCardMediaContent,
MdcCardPrimaryAction
];
var MdcCardModule = /** @class */ (function () {
function MdcCardModule() {
}
MdcCardModule.decorators = [
{ type: NgModule, args: [{
exports: CARD_DECLARATIONS,
declarations: CARD_DECLARATIONS,
},] },
];
return MdcCardModule;
}());
export { MdcCard, MdcCardAction, MdcCardActionButtons, MdcCardActionIcons, MdcCardActions, MdcCardMedia, MdcCardMediaContent, MdcCardModule, MdcCardPrimaryAction };
//# sourceMappingURL=card.es5.js.map