@sd-angular/core
Version:
Sd Angular Core Lib
16 lines (14 loc) • 10.7 kB
JavaScript
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core"),require("@angular/common"),require("rxjs"),require("rxjs/operators"),require("@angular/material/icon"),require("@angular/material/button"),require("@angular/material/tooltip"),require("@angular/material/progress-spinner")):"function"==typeof define&&define.amd?define("@sd-angular/core/button",["exports","@angular/core","@angular/common","rxjs","rxjs/operators","@angular/material/icon","@angular/material/button","@angular/material/tooltip","@angular/material/progress-spinner"],n):n(((t="undefined"!=typeof globalThis?globalThis:t||self)["sd-angular"]=t["sd-angular"]||{},t["sd-angular"].core=t["sd-angular"].core||{},t["sd-angular"].core.button={}),t.ng.core,t.ng.common,t.rxjs,t.rxjs.operators,t.ng.material.icon,t.ng.material.button,t.ng.material.tooltip,t.ng.material.progressSpinner)}(this,(function(t,n,o,e,a,i,r,c,u){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */Object.create;var l,s,p,b;Object.create;function d(t,n,o,e){if("a"===o&&!e)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof n?t!==n||!e:!n.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===o?e:"a"===o?e.call(t):e?e.value:n.get(t)}function g(t,n,o,e,a){if("m"===e)throw new TypeError("Private method is not writable");if("a"===e&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof n?t!==n||!a:!n.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===e?a.call(t,o):a?a.value=o:n.set(t,o),o}var m=function(){function t(t){var o=this;this.ref=t,l.set(this,!1),s.set(this,!1),this.isDisabled=!1,this.type="light",this.color="secondary",this.iconSuffix=!1,this.fontSet="material-icons",this.loading=!1,this.action=new n.EventEmitter,p.set(this,new e.Subscription),b.set(this,(function(){o.isDisabled=d(o,l),o.ref.detectChanges()})),this.onClick=function(t){o.loading||o.action.emit(t)}}return Object.defineProperty(t.prototype,"_type",{set:function(t){this.type=t||"light"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_color",{set:function(t){this.color=t||"secondary"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"disabled",{set:function(t){var n=this;g(this,l,t||!1),d(this,s)&&setTimeout((function(){d(n,b).call(n)}),0)},enumerable:!1,configurable:!0}),t.prototype.ngOnInit=function(){},t.prototype.ngAfterViewInit=function(){var t=this;setTimeout((function(){d(t,b).call(t)}),0),d(this,p).add(e.fromEvent(this.button._elementRef.nativeElement,"click").pipe(a.debounceTime(200)).subscribe((function(n){t.loading||t.action.emit(n)}))),g(this,s,!0)},t.prototype.ngOnDestroy=function(){d(this,p).unsubscribe()},t}();l=new WeakMap,s=new WeakMap,p=new WeakMap,b=new WeakMap,m.decorators=[{type:n.Component,args:[{selector:"sd-button",template:'<button *ngIf="type === \'fill\'" aria-hidden="true" [ngStyle]="{\'width\':width}" class="c-button c-fill" [class.c-square]="icon && !title"\r\n [ngClass]="{\'c-sm\': size === \'sm\', \'c-lg\': size === \'lg\'}" type="button" [color]="color" [disabled]="isDisabled"\r\n matTooltipPosition="above" [matTooltip]="tooltip" mat-flat-button #button>\r\n <ng-container *ngTemplateOutlet="buttonContent"></ng-container>\r\n</button>\r\n<button *ngIf="type === \'light\'" aria-hidden="true" [ngStyle]="{\'width\':width}" class="c-button c-light" [class.c-square]="icon && !title"\r\n [ngClass]="{\'c-sm\': size === \'sm\', \'c-lg\': size === \'lg\'}" type="button" [color]="color" [disabled]="isDisabled"\r\n matTooltipPosition="above" [matTooltip]="tooltip" mat-flat-button #button>\r\n <ng-container *ngTemplateOutlet="buttonContent"></ng-container>\r\n</button>\r\n<button *ngIf="type === \'outline\'" aria-hidden="true" [ngStyle]="{\'width\':width}" class="c-button c-outline"\r\n [class.c-square]="icon && !title" [ngClass]="{\'c-sm\': size === \'sm\', \'c-lg\': size === \'lg\'}" type="button"\r\n [color]="color" [disabled]="isDisabled" matTooltipPosition="above" [matTooltip]="tooltip" mat-stroked-button #button>\r\n <ng-container *ngTemplateOutlet="buttonContent"></ng-container>\r\n</button>\r\n<button *ngIf="type === \'link\'" aria-hidden="true" [ngStyle]="{\'width\':width}" class="c-button c-link" [class.c-square]="icon && !title"\r\n [ngClass]="{\'c-sm\': size === \'sm\', \'c-lg\': size === \'lg\'}" type="button" [color]="color" [disabled]="isDisabled"\r\n matTooltipPosition="above" [matTooltip]="tooltip" mat-button #button>\r\n <ng-container *ngTemplateOutlet="buttonContent"></ng-container>\r\n</button>\r\n<ng-template #buttonContent>\r\n <ng-container *ngIf="title">\r\n <ng-container *ngIf="!iconSuffix">\r\n <mat-spinner *ngIf="loading" strokeWidth="2" mode="indeterminate" diameter="18" value="100"\r\n class="d-inline-block"></mat-spinner>\r\n <mat-icon *ngIf="!loading && icon" [fontSet]="fontSet">{{icon}}</mat-icon>\r\n </ng-container>\r\n <span class="d-inline" [ngClass]="{\'ml-8\': icon && !iconSuffix, \'mr-8\': icon && iconSuffix}">{{title}}</span>\r\n <mat-icon *ngIf="iconSuffix && icon" [fontSet]="fontSet">{{icon}}</mat-icon>\r\n </ng-container>\r\n <ng-container *ngIf="!title">\r\n <mat-icon [fontSet]="fontSet">{{icon}}</mat-icon>\r\n </ng-container>\r\n</ng-template>',changeDetection:n.ChangeDetectionStrategy.OnPush,host:{"[attr.disabled]":"isDisabled ? true : null"},styles:[".text-black400{color:#757575}:host[disabled=true]{pointer-events:none}:host ::ng-deep button.c-button{font-size:16px;height:40px;line-height:20px;min-width:auto;padding:2px 16px!important}:host ::ng-deep button.c-button .mat-button-wrapper{align-items:center;display:flex;justify-content:center}:host ::ng-deep button.c-button.mat-button-disabled{background-color:#e9e9e9!important;color:#a6a6a6!important}:host ::ng-deep button.c-button.c-square{min-width:auto!important;padding:0!important;width:40px!important}:host ::ng-deep button.c-button.c-sm{font-size:14px!important;font-weight:400;height:32px;line-height:20px!important;padding:2px 16px!important}:host ::ng-deep button.c-button.c-sm mat-icon{font-size:16px!important;height:16px!important;width:16px!important}:host ::ng-deep button.c-button.c-sm.c-square{width:32px!important}:host ::ng-deep button.c-button.c-lg{font-size:16px!important;height:48px;line-height:20px!important;padding:2px 16px!important}:host ::ng-deep button.c-button.c-lg.c-square{width:48px!important}:host ::ng-deep button.c-button:focus{outline:none}:host ::ng-deep button.c-button.c-fill.mat-flat-button.mat-info,:host ::ng-deep button.c-button.c-fill.mat-flat-button.mat-primary{background-color:#2962ff;color:#fff}:host ::ng-deep button.c-button.c-fill.mat-flat-button.mat-success{background-color:#4caf50;color:#fff}:host ::ng-deep button.c-button.c-fill.mat-flat-button.mat-warning{background-color:#ff9600;color:#fff}:host ::ng-deep button.c-button.c-fill.mat-flat-button.mat-danger{background-color:#f82c13;color:#fff}:host ::ng-deep button.c-button.c-fill.mat-flat-button.mat-secondary{background-color:#212121;color:#fff}:host ::ng-deep button.c-button.c-fill .mat-spinner.mat-progress-spinner circle,:host ::ng-deep button.c-button.c-fill .mat-spinner.mat-spinner circle{stroke:#fff}:host ::ng-deep button.c-button.c-light.mat-flat-button.mat-info,:host ::ng-deep button.c-button.c-light.mat-flat-button.mat-primary{background-color:#e7e9ff;color:#2962ff}:host ::ng-deep button.c-button.c-light.mat-flat-button.mat-success{background-color:#dbefdc;color:#4caf50}:host ::ng-deep button.c-button.c-light.mat-flat-button.mat-warning{background-color:#ffeacc;color:#ff9600}:host ::ng-deep button.c-button.c-light.mat-flat-button.mat-danger{background-color:#fed5d0;color:#f82c13}:host ::ng-deep button.c-button.c-light.mat-flat-button.mat-secondary{background-color:#e9e9e9;color:#212121}:host ::ng-deep button.c-button.c-outline.mat-stroked-button{border-color:#d3d3d3}:host ::ng-deep button.c-button.c-outline.mat-stroked-button.mat-info,:host ::ng-deep button.c-button.c-outline.mat-stroked-button.mat-primary{color:#2962ff}:host ::ng-deep button.c-button.c-outline.mat-stroked-button.mat-success{color:#4caf50}:host ::ng-deep button.c-button.c-outline.mat-stroked-button.mat-warning{color:#ff9600}:host ::ng-deep button.c-button.c-outline.mat-stroked-button.mat-danger{color:#f82c13}:host ::ng-deep button.c-button.c-outline.mat-stroked-button.mat-secondary{color:#212121}:host ::ng-deep button.c-button.c-outline.mat-stroked-button.mat-button-disabled{background:transparent!important}:host ::ng-deep button.c-button.c-link.mat-button.mat-info,:host ::ng-deep button.c-button.c-link.mat-button.mat-primary{color:#2962ff}:host ::ng-deep button.c-button.c-link.mat-button.mat-success{color:#4caf50}:host ::ng-deep button.c-button.c-link.mat-button.mat-warning{color:#ff9600}:host ::ng-deep button.c-button.c-link.mat-button.mat-danger{color:#f82c13}:host ::ng-deep button.c-button.c-link.mat-button.mat-secondary{color:#212121}"]}]}],m.ctorParameters=function(){return[{type:n.ChangeDetectorRef}]},m.propDecorators={button:[{type:n.ViewChild,args:["button"]}],_type:[{type:n.Input,args:["type"]}],_color:[{type:n.Input,args:["color"]}],title:[{type:n.Input}],icon:[{type:n.Input}],width:[{type:n.Input}],size:[{type:n.Input}],tooltip:[{type:n.Input}],iconSuffix:[{type:n.Input}],fontSet:[{type:n.Input}],disabled:[{type:n.Input}],loading:[{type:n.Input}],action:[{type:n.Output}]};var f=function(){};f.decorators=[{type:n.NgModule,args:[{imports:[o.CommonModule,i.MatIconModule,r.MatButtonModule,u.MatProgressSpinnerModule,c.MatTooltipModule],declarations:[m],exports:[m]}]}],t.SdButton=m,t.SdButtonModule=f,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=sd-angular-core-button.umd.min.js.map