@lxlib/seed
Version:
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.
16 lines (14 loc) • 7.65 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@lxlib/theme"),require("@lxlib/util"),require("@angular/common"),require("ng-zorro-antd/badge"),require("ng-zorro-antd/dropdown"),require("ng-zorro-antd/icon"),require("ng-zorro-antd/list"),require("ng-zorro-antd/spin"),require("ng-zorro-antd/tabs"),require("ng-zorro-antd/tag")):"function"==typeof define&&define.amd?define("@lxlib/seed/notice-icon",["exports","@angular/core","@lxlib/theme","@lxlib/util","@angular/common","ng-zorro-antd/badge","ng-zorro-antd/dropdown","ng-zorro-antd/icon","ng-zorro-antd/list","ng-zorro-antd/spin","ng-zorro-antd/tabs","ng-zorro-antd/tag"],t):t(((e=e||self).lxlib=e.lxlib||{},e.lxlib.seed=e.lxlib.seed||{},e.lxlib.seed["notice-icon"]={}),e.ng.core,e.lxlib.theme,e.lxlib.util,e.ng.common,e["ng-zorro-antd/badge"],e["ng-zorro-antd/dropdown"],e["ng-zorro-antd/icon"],e["ng-zorro-antd/list"],e["ng-zorro-antd/spin"],e["ng-zorro-antd/tabs"],e["ng-zorro-antd/tag"])}(this,(function(e,t,n,o,i,a,r,l,c,s,p,d){"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 u(e,t,n,o){var i,a=arguments.length,r=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,o);else for(var l=e.length-1;l>=0;l--)(i=e[l])&&(r=(a<3?i(r):a>3?i(t,n,r):i(t,n))||r);return a>3&&r&&Object.defineProperty(t,n,r),r}function g(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function m(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,a=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)r.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return r}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(m(arguments[t]));return e}var z=function(){function e(){this.locale={},this.select=new t.EventEmitter,this.clear=new t.EventEmitter}return e.prototype.onClick=function(e){this.select.emit({title:this.data.title,item:e})},e.prototype.onClear=function(){this.clear.emit(this.data.title)},e.decorators=[{type:t.Component,args:[{selector:"notice-icon-tab",exportAs:"noticeIconTab",template:'<div *ngIf="data.list?.length === 0; else listTpl" class="notice-icon__notfound">\n <img class="notice-icon__notfound-img" *ngIf="data.emptyImage" src="{{data.emptyImage}}" alt="not found" />\n <p>{{data.emptyText || locale.emptyText}}</p>\n</div>\n<ng-template #listTpl>\n <nz-list [nzDataSource]="data.list" [nzRenderItem]="item">\n <ng-template #item let-item>\n <nz-list-item (click)="onClick(item)" [ngClass]="{\'notice-icon__item-read\': item.read}">\n <nz-list-item-meta [nzTitle]="nzTitle" [nzDescription]="nzDescription" [nzAvatar]="item.avatar">\n <ng-template #nzTitle>\n {{item.title}}\n <div class="notice-icon__item-extra" *ngIf="item.extra">\n <nz-tag [nzColor]="item.color">{{item.extra}}</nz-tag>\n </div>\n </ng-template>\n <ng-template #nzDescription>\n <div *ngIf="item.description" class="notice-icon__item-desc">{{item.description}}</div>\n <div *ngIf="item.datetime" class="notice-icon__item-time">{{item.datetime}}</div>\n </ng-template>\n </nz-list-item-meta>\n </nz-list-item>\n </ng-template>\n </nz-list>\n <div class="notice-icon__clear" (click)="onClear()">{{ data.clearText || locale.clearText }}</div>\n</ng-template>\n',preserveWhitespaces:!1,encapsulation:t.ViewEncapsulation.None}]}],e.propDecorators={locale:[{type:t.Input}],data:[{type:t.Input}],select:[{type:t.Output}],clear:[{type:t.Output}]},e}();var f=function(){function e(e,n){this.i18n=e,this.cdr=n,this.locale={},this.data=[],this.loading=!1,this.popoverVisible=!1,this.btnClass="",this.btnIconClass="",this.select=new t.EventEmitter,this.clear=new t.EventEmitter,this.popoverVisibleChange=new t.EventEmitter}return e.prototype.onVisibleChange=function(e){this.popoverVisibleChange.emit(e)},e.prototype.onSelect=function(e){this.select.emit(e)},e.prototype.onClear=function(e){this.clear.emit(e)},e.prototype.ngOnInit=function(){var e=this;this.i18n$=this.i18n.change.subscribe((function(){e.locale=e.i18n.getData("noticeIcon"),e.cdr.markForCheck()}))},e.prototype.ngOnChanges=function(){this.cdr.markForCheck()},e.prototype.ngOnDestroy=function(){this.i18n$.unsubscribe()},e.decorators=[{type:t.Component,args:[{selector:"notice-icon",exportAs:"noticeIcon",template:'<ng-template #badgeTpl>\n <nz-badge [nzCount]="count" [ngClass]="btnClass" [nzStyle]="{ \'box-shadow\': \'none\' }">\n <i nz-icon nzType="bell" [ngClass]="btnIconClass"></i>\n </nz-badge>\n</ng-template>\n<div *ngIf="data?.length === 0">\n <ng-template [ngTemplateOutlet]="badgeTpl"></ng-template>\n</div>\n<div *ngIf="data?.length > 0" nz-dropdown\n [nzVisible]="popoverVisible"\n (nzVisibleChange)="onVisibleChange($event)"\n nzTrigger="click"\n nzPlacement="bottomRight"\n [nzOverlayClassName]="[\'header-dropdown\', \'notice-icon\']"\n [nzDropdownMenu]="noticeMenu">\n <ng-template [ngTemplateOutlet]="badgeTpl"></ng-template>\n</div>\n<nz-dropdown-menu #noticeMenu="nzDropdownMenu">\n <nz-spin [nzSpinning]="loading" [nzDelay]="0">\n <nz-tabset nzSelectedIndex="0">\n <nz-tab *ngFor="let i of data" [nzTitle]="i.title">\n <notice-icon-tab [locale]="locale" [data]="i" (select)="onSelect($event)" (clear)="onClear($event)"></notice-icon-tab>\n </nz-tab>\n </nz-tabset>\n </nz-spin>\n</nz-dropdown-menu>\n',host:{"[class.notice-icon__btn]":"true"},preserveWhitespaces:!1,changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None}]}],e.ctorParameters=function(){return[{type:n.LxlibLocaleService},{type:t.ChangeDetectorRef}]},e.propDecorators={data:[{type:t.Input}],count:[{type:t.Input}],loading:[{type:t.Input}],popoverVisible:[{type:t.Input}],btnClass:[{type:t.Input}],btnIconClass:[{type:t.Input}],select:[{type:t.Output}],clear:[{type:t.Output}],popoverVisibleChange:[{type:t.Output}]},u([o.InputNumber(),g("design:type",Number)],e.prototype,"count",void 0),u([o.InputBoolean(),g("design:type",Object)],e.prototype,"loading",void 0),u([o.InputBoolean(),g("design:type",Object)],e.prototype,"popoverVisible",void 0),e}();var h=[f],y=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[i.CommonModule,n.LxlibLocaleModule,a.NzBadgeModule,r.NzDropDownModule,l.NzIconModule,c.NzListModule,s.NzSpinModule,p.NzTabsModule,d.NzTagModule],declarations:b(h,[z]),exports:b(h)}]}],e}();e.NoticeIconComponent=f,e.NoticeIconModule=y,e.NoticeIconTabComponent=z,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=noticeIcon.umd.min.js.map