ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 5.16 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("ng-zorro-antd/core/animation"),require("ng-zorro-antd/core/logger"),require("ng-zorro-antd/core/util"),require("@angular/common"),require("@angular/forms"),require("ng-zorro-antd/icon")):"function"==typeof define&&define.amd?define("ng-zorro-antd/tag",["exports","@angular/core","ng-zorro-antd/core/animation","ng-zorro-antd/core/logger","ng-zorro-antd/core/util","@angular/common","@angular/forms","ng-zorro-antd/icon"],t):t(((e=e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].tag={}),e.ng.core,e["ng-zorro-antd"].core.animation,e["ng-zorro-antd"].core.logger,e["ng-zorro-antd"].core.util,e.ng.common,e.ng.forms,e["ng-zorro-antd"].icon)}(this,(function(e,t,n,o,r,a,i,s){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function c(e,t,n,o){var r,a=arguments.length,i=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,o);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(i=(a<3?r(i):a>3?r(t,n,i):r(t,n))||i);return a>3&&i&&Object.defineProperty(t,n,i),i}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}var d=function(){function e(e,n){this.renderer=e,this.elementRef=n,this.presetColor=!1,this.cacheClassName=null,this.nzMode="default",this.nzChecked=!1,this.nzNoAnimation=!1,this.nzAfterClose=new t.EventEmitter,this.nzOnClose=new t.EventEmitter,this.nzCheckedChange=new t.EventEmitter}return e.prototype.isPresetColor=function(e){return!!e&&(/^(pink|red|yellow|orange|cyan|green|blue|purple|geekblue|magenta|volcano|gold|lime)(-inverse)?$/.test(e)||/^(success|processing|error|default|warning)$/.test(e))},e.prototype.updateClassMap=function(){this.presetColor=this.isPresetColor(this.nzColor),this.cacheClassName&&this.renderer.removeClass(this.elementRef.nativeElement,this.cacheClassName),this.presetColor&&(this.cacheClassName="ant-tag-"+this.nzColor,this.renderer.addClass(this.elementRef.nativeElement,this.cacheClassName))},e.prototype.updateCheckedStatus=function(){"checkable"===this.nzMode&&(this.nzChecked=!this.nzChecked,this.nzCheckedChange.emit(this.nzChecked),this.updateClassMap())},e.prototype.closeTag=function(e){this.nzOnClose.emit(e),e.defaultPrevented||this.renderer.removeChild(this.renderer.parentNode(this.elementRef.nativeElement),this.elementRef.nativeElement)},e.prototype.afterAnimation=function(e){"void"===e.toState&&(this.nzAfterClose.emit(),this.nzAfterClose.observers.length&&o.warnDeprecation("'(nzAfterClose)' Output is going to be removed in 9.0.0. Please use '(nzOnClose)' instead."))},e.prototype.ngOnInit=function(){this.updateClassMap()},e.prototype.ngOnChanges=function(){this.updateClassMap()},e.decorators=[{type:t.Component,args:[{selector:"nz-tag",exportAs:"nzTag",preserveWhitespaces:!1,animations:[n.fadeMotion],template:'\n <ng-content></ng-content>\n <i nz-icon nzType="close" *ngIf="nzMode === \'closeable\'" tabindex="-1" (click)="closeTag($event)"></i>\n ',changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,host:{"[@fadeMotion]":"","[@.disabled]":"nzNoAnimation","[style.background-color]":"presetColor ? null : nzColor","[class.ant-tag]":"true","[class.ant-tag-has-color]":"nzColor && !presetColor","[class.ant-tag-checkable]":"nzMode === 'checkable'","[class.ant-tag-checkable-checked]":"nzChecked","(click)":"updateCheckedStatus()","(@fadeMotion.done)":"afterAnimation($event)"}}]}],e.ctorParameters=function(){return[{type:t.Renderer2},{type:t.ElementRef}]},e.propDecorators={nzMode:[{type:t.Input}],nzColor:[{type:t.Input}],nzChecked:[{type:t.Input}],nzNoAnimation:[{type:t.Input}],nzAfterClose:[{type:t.Output}],nzOnClose:[{type:t.Output}],nzCheckedChange:[{type:t.Output}]},c([r.InputBoolean(),l("design:type",Object)],e.prototype,"nzChecked",void 0),c([r.InputBoolean(),l("design:type",Object)],e.prototype,"nzNoAnimation",void 0),e}();var p=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[a.CommonModule,i.FormsModule,s.NzIconModule],declarations:[d],exports:[d]}]}],e}();e.NzTagComponent=d,e.NzTagModule=p,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-tag.umd.min.js.map