UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

16 lines (14 loc) 10.3 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/platform"),require("@angular/core"),require("@ant-design/icons-angular"),require("ng-zorro-antd/core/util"),require("@angular/common"),require("@angular/common/http"),require("@angular/platform-browser"),require("ng-zorro-antd/core/config"),require("ng-zorro-antd/core/logger"),require("rxjs"),require("@ant-design/icons-angular/icons")):"function"==typeof define&&define.amd?define("ng-zorro-antd/icon",["exports","@angular/cdk/platform","@angular/core","@ant-design/icons-angular","ng-zorro-antd/core/util","@angular/common","@angular/common/http","@angular/platform-browser","ng-zorro-antd/core/config","ng-zorro-antd/core/logger","rxjs","@ant-design/icons-angular/icons"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].icon={}),e.ng.cdk.platform,e.ng.core,e.iconsAngular,e["ng-zorro-antd"].core.util,e.ng.common,e.ng.common.http,e.ng.platformBrowser,e["ng-zorro-antd"].core.config,e["ng-zorro-antd"].core.logger,e.rxjs,e.icons)}(this,(function(e,t,n,o,r,i,c,a,l,s,u,p){"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. ***************************************************************************** */var f=function(e,t){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function h(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}f(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function d(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create;function g(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),c=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)c.push(o.value)}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return c}Object.create;var y=[p.BarsOutline,p.CalendarOutline,p.CaretUpFill,p.CaretUpOutline,p.CaretDownFill,p.CaretDownOutline,p.CheckCircleFill,p.CheckCircleOutline,p.CheckOutline,p.ClockCircleOutline,p.CloseCircleOutline,p.CloseCircleFill,p.CloseOutline,p.CopyOutline,p.DoubleLeftOutline,p.DoubleRightOutline,p.DownOutline,p.EditOutline,p.EllipsisOutline,p.ExclamationCircleFill,p.ExclamationCircleOutline,p.EyeOutline,p.FileFill,p.FileOutline,p.FilterFill,p.InfoCircleFill,p.InfoCircleOutline,p.LeftOutline,p.LoadingOutline,p.PaperClipOutline,p.QuestionCircleOutline,p.RightOutline,p.RotateRightOutline,p.RotateLeftOutline,p.StarFill,p.SearchOutline,p.StarFill,p.UploadOutline,p.VerticalAlignTopOutline,p.UpOutline,p.SwapRightOutline,p.ZoomInOutline,p.ZoomOutOutline],m=new n.InjectionToken("nz_icons"),C=new n.InjectionToken("nz_icon_default_twotone_color"),O="#1890ff",v=function(e){function t(t,n,o,r,i,c){var a=e.call(this,t,r,i,n)||this;return a.nzConfigService=o,a.configUpdated$=new u.Subject,a.iconfontCache=new Set,a.onConfigChange(),a.addIcon.apply(a,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}(y,c||[])),a.configDefaultTwotoneColor(),a.configDefaultTheme(),a}return h(t,e),t.prototype.normalizeSvgElement=function(e){e.getAttribute("viewBox")||this._renderer.setAttribute(e,"viewBox","0 0 1024 1024"),e.getAttribute("width")&&e.getAttribute("height")||(this._renderer.setAttribute(e,"width","1em"),this._renderer.setAttribute(e,"height","1em")),e.getAttribute("fill")||this._renderer.setAttribute(e,"fill","currentColor")},t.prototype.fetchFromIconfont=function(e){var t=e.scriptUrl;if(this._document&&!this.iconfontCache.has(t)){var n=this._renderer.createElement("script");this._renderer.setAttribute(n,"src",t),this._renderer.setAttribute(n,"data-namespace",t.replace(/^(https?|http):/g,"")),this._renderer.appendChild(this._document.body,n),this.iconfontCache.add(t)}},t.prototype.createIconfontIcon=function(e){return this._createSVGElementFromString('<svg><use xlink:href="'+e+'"></svg>')},t.prototype.onConfigChange=function(){var e=this;this.nzConfigService.getConfigChangeEventForComponent("icon").subscribe((function(){e.configDefaultTwotoneColor(),e.configDefaultTheme(),e.configUpdated$.next()}))},t.prototype.configDefaultTheme=function(){var e=this.getConfig();this.defaultTheme=e.nzTheme||"outline"},t.prototype.configDefaultTwotoneColor=function(){var e=this.getConfig().nzTwotoneColor||O,t=O;e&&(e.startsWith("#")?t=e:s.warn("Twotone color must be a hex color!")),this.twoToneColor={primaryColor:t}},t.prototype.getConfig=function(){return this.nzConfigService.getConfigForComponent("icon")||{}},t}(o.IconService);v.ɵprov=n.ɵɵdefineInjectable({factory:function(){return new v(n.ɵɵinject(n.RendererFactory2),n.ɵɵinject(a.DomSanitizer),n.ɵɵinject(l.NzConfigService),n.ɵɵinject(c.HttpBackend,8),n.ɵɵinject(i.DOCUMENT,8),n.ɵɵinject(m,8))},token:v,providedIn:"root"}),v.decorators=[{type:n.Injectable,args:[{providedIn:"root"}]}],v.ctorParameters=function(){return[{type:n.RendererFactory2},{type:a.DomSanitizer},{type:l.NzConfigService},{type:c.HttpBackend,decorators:[{type:n.Optional}]},{type:void 0,decorators:[{type:n.Optional},{type:n.Inject,args:[i.DOCUMENT]}]},{type:Array,decorators:[{type:n.Optional},{type:n.Inject,args:[m]}]}]};var b=new n.InjectionToken("nz_icons_patch"),z=function(){function e(e,t){this.extraIcons=e,this.rootIconService=t,this.patched=!1}return e.prototype.doPatch=function(){var e=this;this.patched||(this.extraIcons.forEach((function(t){return e.rootIconService.addIcon(t)})),this.patched=!0)},e}();z.decorators=[{type:n.Injectable}],z.ctorParameters=function(){return[{type:Array,decorators:[{type:n.Self},{type:n.Inject,args:[b]}]},{type:v}]};var I=function(e){function t(t,n,o,r){var i=e.call(this,n,t,o)||this;return i.iconService=n,i.renderer=o,i.cacheClassName=null,i.nzRotate=0,i.spin=!1,r&&r.doPatch(),i.el=t.nativeElement,i}return h(t,e),Object.defineProperty(t.prototype,"nzSpin",{set:function(e){this.spin=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nzType",{set:function(e){this.type=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nzTheme",{set:function(e){this.theme=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nzTwotoneColor",{set:function(e){this.twoToneColor=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nzIconfont",{set:function(e){this.iconfont=e},enumerable:!1,configurable:!0}),t.prototype.ngOnChanges=function(e){var t=e.nzType,n=e.nzTwotoneColor,o=e.nzSpin,r=e.nzTheme,i=e.nzRotate;t||n||o||r?this.changeIcon2():i?this.handleRotate(this.el.firstChild):this._setSVGElement(this.iconService.createIconfontIcon("#"+this.iconfont))},t.prototype.ngOnInit=function(){this.renderer.setAttribute(this.el,"class",("anticon "+this.el.className).trim())},t.prototype.ngAfterContentChecked=function(){if(!this.type){var e=this.el.children,t=e.length;if(!this.type&&e.length)for(;t--;){var n=e[t];"svg"===n.tagName.toLowerCase()&&this.iconService.normalizeSvgElement(n)}}},t.prototype.changeIcon2=function(){var e=this;this.setClassName(),this._changeIcon().then((function(t){t&&(e.setSVGData(t),e.handleSpin(t),e.handleRotate(t))}))},t.prototype.handleSpin=function(e){this.spin||"loading"===this.type?this.renderer.addClass(e,"anticon-spin"):this.renderer.removeClass(e,"anticon-spin")},t.prototype.handleRotate=function(e){this.nzRotate?this.renderer.setAttribute(e,"style","transform: rotate("+this.nzRotate+"deg)"):this.renderer.removeAttribute(e,"style")},t.prototype.setClassName=function(){this.cacheClassName&&this.renderer.removeClass(this.el,this.cacheClassName),this.cacheClassName="anticon-"+this.type,this.renderer.addClass(this.el,this.cacheClassName)},t.prototype.setSVGData=function(e){this.renderer.setAttribute(e,"data-icon",this.type),this.renderer.setAttribute(e,"aria-hidden","true")},t}(o.IconDirective);I.decorators=[{type:n.Directive,args:[{selector:"[nz-icon]",exportAs:"nzIcon",host:{"[class.anticon]":"true"}}]}],I.ctorParameters=function(){return[{type:n.ElementRef},{type:v},{type:n.Renderer2},{type:z,decorators:[{type:n.Optional}]}]},I.propDecorators={nzSpin:[{type:n.Input}],nzRotate:[{type:n.Input}],nzType:[{type:n.Input}],nzTheme:[{type:n.Input}],nzTwotoneColor:[{type:n.Input}],nzIconfont:[{type:n.Input}]},function(e,t,n,o){var r,i=arguments.length,c=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,n,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(c=(i<3?r(c):i>3?r(t,n,c):r(t,n))||c);i>3&&c&&Object.defineProperty(t,n,c)}([r.InputBoolean(),d("design:type",Boolean),d("design:paramtypes",[Boolean])],I.prototype,"nzSpin",null);var _=function(){function e(){}return e.forRoot=function(t){return{ngModule:e,providers:[{provide:m,useValue:t}]}},e.forChild=function(t){return{ngModule:e,providers:[z,{provide:b,useValue:t}]}},e}();_.decorators=[{type:n.NgModule,args:[{exports:[I],declarations:[I],imports:[t.PlatformModule]}]}],e.DEFAULT_TWOTONE_COLOR=O,e.NZ_ICONS=m,e.NZ_ICONS_PATCH=b,e.NZ_ICONS_USED_BY_ZORRO=y,e.NZ_ICON_DEFAULT_TWOTONE_COLOR=C,e.NzIconDirective=I,e.NzIconModule=_,e.NzIconPatchService=z,e.NzIconService=v,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=ng-zorro-antd-icon.umd.min.js.map