mat-progress-buttons
Version:
Material Design Progress Buttons
132 lines (125 loc) • 8.66 kB
JavaScript
import { Component, Input, Output, HostListener, EventEmitter, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatButtonModule, MatProgressBarModule, MatProgressSpinnerModule, MatRippleModule, MatIconModule } from '@angular/material';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var MatSpinnerButtonComponent = /** @class */ (function () {
function MatSpinnerButtonComponent() {
this.btnClick = new EventEmitter();
}
/**
* @param {?} event
* @return {?}
*/
MatSpinnerButtonComponent.prototype.onClick = /**
* @param {?} event
* @return {?}
*/
function (event) {
if (!this.options.disabled && !this.options.active) {
this.btnClick.emit(event);
}
};
MatSpinnerButtonComponent.decorators = [
{ type: Component, args: [{
// tslint:disable-next-line:component-selector
selector: 'mat-spinner-button',
template: "\n <button mat-button\n [type]=\"options.type\"\n [color]=\"options.buttonColor\"\n [class.active]=\"options.active\"\n [class.fullWidth]=\"options.fullWidth\"\n [class.mat-raised-button]=\"options.raised\"\n [class.mat-stroked-button]=\"options.stroked\"\n [class.mat-flat-button]=\"options.flat\"\n [class.mat-fab]=\"options.fab\"\n [ngClass]=\"options.customClass\"\n [disabled]=\"options.active || options.disabled\">\n\n <ng-container\n *ngIf=\"options.buttonIcon\">\n <mat-icon\n class=\"mat-button-icon\"\n [class.is-mat-icon]=\"!options.buttonIcon.fontSet\"\n [class.active]=\"options.active && !options.disabled\"\n [ngClass]=\"options.buttonIcon.customClass\"\n [fontSet]=\"options.buttonIcon.fontSet\"\n [fontIcon]=\"options.buttonIcon.fontIcon\"\n [color]=\"options.buttonIcon.color\"\n [svgIcon]=\"options.buttonIcon.svgIcon\"\n [inline]=\"options.buttonIcon.inline\">\n {{ options.buttonIcon.fontSet ? '' : options.buttonIcon.fontIcon }}\n </mat-icon>\n </ng-container>\n\n <span\n class=\"button-text\"\n *ngIf=\"!options.fab\"\n [class.active]=\"options.active && !options.disabled\">\n {{ options.text }}\n </span>\n\n <ng-container\n *ngIf=\"options.fab && options.icon\">\n <mat-icon\n [fontSet]=\"options.icon.fontSet\"\n [fontIcon]=\"options.icon.fontIcon\"\n [color]=\"options.icon.color\"\n [svgIcon]=\"options.icon.svgIcon\"\n [inline]=\"options.icon.inline\">\n {{ options.icon.fontSet ? '' : options.icon.fontIcon }}\n </mat-icon>\n </ng-container>\n\n <mat-spinner class=\"spinner\"\n [diameter]=\"options.fab ? 58 : options.spinnerSize\"\n [color]=\"options.spinnerColor\"\n [mode]=\"options.mode\"\n [value]=\"options.value\"\n [class.active]=\"options.active && !options.disabled\">\n </mat-spinner>\n </button>\n ",
styles: ["\n :host button{outline:none}:host button.active{cursor:not-allowed}:host button/deep/ .mat-button-wrapper{display:flex;align-items:center;justify-content:center}:host button.fullWidth{width:100%}:host button.mat-fab .spinner{margin-top:-15px}:host button .spinner{position:absolute;top:25%;opacity:0;transition:opacity .3s ease-in-out}:host button .spinner.active{opacity:1}:host button .button-text{opacity:1;transition:opacity .3s ease-in-out}:host button .button-text.active{opacity:0}:host button mat-icon.mat-button-icon{padding-right:5px;transition:opacity .3s ease-in-out}:host button mat-icon.mat-button-icon.is-mat-icon{font-size:18px;position:relative;top:3px}:host button mat-icon.mat-button-icon.active{opacity:0}\n "]
},] },
];
MatSpinnerButtonComponent.propDecorators = {
options: [{ type: Input }],
btnClick: [{ type: Output }],
onClick: [{ type: HostListener, args: ['click', ['$event'],] }]
};
return MatSpinnerButtonComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var MatBarButtonComponent = /** @class */ (function () {
function MatBarButtonComponent() {
this.btnClick = new EventEmitter();
}
/**
* @param {?} event
* @return {?}
*/
MatBarButtonComponent.prototype.onClick = /**
* @param {?} event
* @return {?}
*/
function (event) {
if (!this.options.disabled && !this.options.active) {
this.btnClick.emit(event);
}
};
MatBarButtonComponent.decorators = [
{ type: Component, args: [{
// tslint:disable-next-line:component-selector
selector: 'mat-bar-button',
template: "\n <button mat-button\n [type]=\"options.type\"\n [color]=\"options.buttonColor\"\n [class.active]=\"options.active\"\n [class.mat-raised-button]=\"options.raised\"\n [class.mat-stroked-button]=\"options.stroked\"\n [class.mat-flat-button]=\"options.flat\"\n [class.fullWidth]=\"options.fullWidth\"\n [ngClass]=\"options.customClass\"\n [disabled]=\"options.active || options.disabled\">\n\n <ng-container\n *ngIf=\"options.buttonIcon\">\n <mat-icon\n [class.is-mat-icon]=\"!options.buttonIcon.fontSet\"\n [ngClass]=\"options.buttonIcon.customClass\"\n [fontSet]=\"options.buttonIcon.fontSet\"\n [fontIcon]=\"options.buttonIcon.fontIcon\"\n [color]=\"options.buttonIcon.color\"\n [svgIcon]=\"options.buttonIcon.svgIcon\"\n [inline]=\"options.buttonIcon.inline\">\n {{ options.buttonIcon.fontSet ? '' : options.buttonIcon.fontIcon }}\n </mat-icon>\n </ng-container>\n\n <span>{{ options.text }}</span>\n\n <mat-progress-bar\n class=\"bar\"\n *ngIf=\"options.active && !options.disabled\"\n [color]=\"options.barColor\"\n [mode]=\"options.mode\"\n [value]=\"options.value\">\n </mat-progress-bar>\n </button>\n ",
styles: ["\n :host button.active{cursor:not-allowed}:host button.fullWidth{width:100%}:host button .bar{position:absolute;top:0;left:0}:host button mat-icon{padding-right:5px}:host button mat-icon.is-mat-icon{font-size:18px;position:relative;top:3px}\n "]
},] },
];
MatBarButtonComponent.propDecorators = {
options: [{ type: Input }],
btnClick: [{ type: Output }],
onClick: [{ type: HostListener, args: ['click', ['$event'],] }]
};
return MatBarButtonComponent;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var MatProgressButtonsModule = /** @class */ (function () {
function MatProgressButtonsModule() {
}
/**
* @return {?}
*/
MatProgressButtonsModule.forRoot = /**
* @return {?}
*/
function () {
return {
ngModule: MatProgressButtonsModule
};
};
MatProgressButtonsModule.decorators = [
{ type: NgModule, args: [{
imports: [
CommonModule,
MatButtonModule,
MatProgressBarModule,
MatProgressSpinnerModule,
MatRippleModule,
MatIconModule
],
exports: [
MatSpinnerButtonComponent,
MatBarButtonComponent
],
declarations: [
MatSpinnerButtonComponent,
MatBarButtonComponent
]
},] },
];
return MatProgressButtonsModule;
}());
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
export { MatSpinnerButtonComponent, MatBarButtonComponent, MatProgressButtonsModule };
//# sourceMappingURL=mat-progress-buttons.es5.js.map