@lxlib/seed
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.
16 lines (14 loc) • 3.89 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@lxlib/util"),require("@angular/common")):"function"==typeof define&&define.amd?define("@lxlib/seed/image",["exports","@angular/core","@lxlib/util","@angular/common"],t):t(((e=e||self).lxlib=e.lxlib||{},e.lxlib.seed=e.lxlib.seed||{},e.lxlib.seed.image={}),e.ng.core,e.lxlib.util,e.ng.common)}(this,(function(e,t,r,o){"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.
***************************************************************************** */var n=function(){return(n=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function i(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,i=r.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)l.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return l}function c(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(l(arguments[t]));return e}var s=function(){function e(){this.size=64,this.error="./assets/img/logo.svg"}return e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();var a=function(){function e(e,t){this.size=64,this.error="./assets/img/logo.svg",this.inited=!1,Object.assign(this,n(n({},new s),e)),this.imgEl=t.nativeElement}return e.prototype.ngOnInit=function(){this.update(),this.updateError(),this.inited=!0},e.prototype.ngOnChanges=function(e){this.inited&&(e.error&&this.updateError(),this.update())},e.prototype.update=function(){var e=this.src,t=this.size,r=this.imgEl;if(e.includes("qlogo.cn")){var o=e.split("/"),n=o[o.length-1];o[o.length-1]="0"===n||+n!==t?t.toString():n,e=o.join("/")}e=e.replace(/^(?:https?:)/i,""),r.src=e,r.height=t,r.width=t},e.prototype.updateError=function(){var e=this.imgEl,t=this.error;e.onerror=function(){this.onerror=null,this.src=t}},e.decorators=[{type:t.Directive,args:[{selector:"[_src]",exportAs:"_src"}]}],e.ctorParameters=function(){return[{type:s},{type:t.ElementRef}]},e.propDecorators={src:[{type:t.Input,args:["_src"]}],size:[{type:t.Input}],error:[{type:t.Input}]},function(e,t,r,o){var n,i=arguments.length,l=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var c=e.length-1;c>=0;c--)(n=e[c])&&(l=(i<3?n(l):i>3?n(t,r,l):n(t,r))||l);i>3&&l&&Object.defineProperty(t,r,l)}([r.InputNumber(),i("design:type",Object)],e.prototype,"size",void 0),e}();var u=[a],f=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[o.CommonModule,r.LxlibUtilModule],declarations:c(u),exports:c(u)}]}],e}();e.ImageConfig=s,e.ImageDirective=a,e.ImageModule=f,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=image.umd.min.js.map