ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
23 lines (21 loc) • 40.8 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("@angular/cdk/scrolling"),require("ng-zorro-antd/core/util"),require("rxjs/operators"),require("@angular/cdk/a11y"),require("@angular/cdk/keycodes"),require("@angular/cdk/overlay"),require("@angular/cdk/platform"),require("@angular/forms"),require("ng-zorro-antd/core/animation"),require("ng-zorro-antd/core/config"),require("ng-zorro-antd/core/no-animation"),require("@angular/common"),require("ng-zorro-antd/core/outlet"),require("ng-zorro-antd/core/overlay"),require("ng-zorro-antd/core/transition-patch"),require("ng-zorro-antd/empty"),require("ng-zorro-antd/i18n"),require("ng-zorro-antd/icon")):"function"==typeof define&&define.amd?define("ng-zorro-antd/select",["exports","@angular/core","rxjs","@angular/cdk/scrolling","ng-zorro-antd/core/util","rxjs/operators","@angular/cdk/a11y","@angular/cdk/keycodes","@angular/cdk/overlay","@angular/cdk/platform","@angular/forms","ng-zorro-antd/core/animation","ng-zorro-antd/core/config","ng-zorro-antd/core/no-animation","@angular/common","ng-zorro-antd/core/outlet","ng-zorro-antd/core/overlay","ng-zorro-antd/core/transition-patch","ng-zorro-antd/empty","ng-zorro-antd/i18n","ng-zorro-antd/icon"],t):t(((e=e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].select={}),e.ng.core,e.rxjs,e.ng.cdk.scrolling,e["ng-zorro-antd"].core.util,e.rxjs.operators,e.ng.cdk.a11y,e.ng.cdk.keycodes,e.ng.cdk.overlay,e.ng.cdk.platform,e.ng.forms,e["ng-zorro-antd"].core.animation,e["ng-zorro-antd"].core.config,e["ng-zorro-antd"].core["no-animation"],e.ng.common,e["ng-zorro-antd"].core.outlet,e["ng-zorro-antd"].core.overlay,e["ng-zorro-antd"].core["transition-patch"],e["ng-zorro-antd"].empty,e["ng-zorro-antd"].i18n,e["ng-zorro-antd"].icon)}(this,(function(e,t,n,o,i,a,l,r,s,p,c,u,h,d,m,f,g,z,y,C,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.
***************************************************************************** */function I(e,t,n,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,n,o);else for(var r=e.length-1;r>=0;r--)(i=e[r])&&(l=(a<3?i(l):a>3?i(t,n,l):i(t,n))||l);return a>3&&l&&Object.defineProperty(t,n,l),l}function v(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function S(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,a=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)l.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 l}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(S(arguments[t]));return e}var V=function(){function e(){this.nzLabel=null,this.changes=new n.Subject}return e.prototype.ngOnChanges=function(){this.changes.next()},e.decorators=[{type:t.Component,args:[{selector:"nz-option-group",exportAs:"nzOptionGroup",encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,template:"\n <ng-content></ng-content>\n "}]}],e.propDecorators={nzLabel:[{type:t.Input}]},e}();var w=function(){function e(){this.notFoundContent=void 0,this.menuItemSelectedIcon=null,this.dropdownRender=null,this.activatedValue=null,this.listOfSelectedValue=[],this.mode="default",this.matchWidth=!0,this.itemSize=32,this.maxItemLength=8,this.listOfContainerItem=[],this.itemClick=new t.EventEmitter,this.scrollToBottom=new t.EventEmitter,this.scrolledIndex=0}return e.prototype.onItemClick=function(e){this.itemClick.emit(e)},e.prototype.onItemHover=function(e){this.activatedValue=e},e.prototype.trackValue=function(e,t){return t.key},e.prototype.onScrolledIndexChange=function(e){this.scrolledIndex=e,e===this.listOfContainerItem.length-this.maxItemLength&&this.scrollToBottom.emit()},e.prototype.scrollToActivatedValue=function(){var e=this,t=this.listOfContainerItem.findIndex((function(t){return e.compareWith(t.key,e.activatedValue)}));(t<this.scrolledIndex||t>=this.scrolledIndex+this.maxItemLength)&&this.cdkVirtualScrollViewport.scrollToIndex(t||0)},e.prototype.ngOnChanges=function(e){var t=e.listOfContainerItem,n=e.activatedValue;(t||n)&&this.scrollToActivatedValue()},e.prototype.ngAfterViewInit=function(){var e=this;setTimeout((function(){return e.scrollToActivatedValue()}))},e.decorators=[{type:t.Component,args:[{selector:"nz-option-container",exportAs:"nzOptionContainer",changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,preserveWhitespaces:!1,template:'\n <div>\n <div *ngIf="listOfContainerItem.length === 0" class="ant-select-item-empty">\n <nz-embed-empty nzComponentName="select" [specificContent]="notFoundContent"></nz-embed-empty>\n </div>\n <cdk-virtual-scroll-viewport\n [class.full-width]="!matchWidth"\n [itemSize]="itemSize"\n [maxBufferPx]="itemSize * maxItemLength"\n [minBufferPx]="itemSize * maxItemLength"\n (scrolledIndexChange)="onScrolledIndexChange($event)"\n [style.height.px]="listOfContainerItem.length * itemSize"\n [style.max-height.px]="itemSize * maxItemLength"\n >\n <ng-container *cdkVirtualFor="let item of listOfContainerItem; trackBy: trackValue">\n <ng-container [ngSwitch]="item.type">\n <nz-option-item-group *ngSwitchCase="\'group\'" [nzLabel]="item.groupLabel"></nz-option-item-group>\n <nz-option-item\n *ngSwitchCase="\'item\'"\n [icon]="menuItemSelectedIcon"\n [customContent]="item.nzCustomContent"\n [template]="item.template"\n [grouped]="!!item.groupLabel"\n [disabled]="item.nzDisabled"\n [showState]="mode === \'tags\' || mode === \'multiple\'"\n [label]="item.nzLabel"\n [compareWith]="compareWith"\n [activatedValue]="activatedValue"\n [listOfSelectedValue]="listOfSelectedValue"\n [value]="item.nzValue"\n (itemHover)="onItemHover($event)"\n (itemClick)="onItemClick($event)"\n ></nz-option-item>\n </ng-container>\n </ng-container>\n </cdk-virtual-scroll-viewport>\n <ng-template [ngTemplateOutlet]="dropdownRender"></ng-template>\n </div>\n ',host:{"[class.ant-select-dropdown]":"true"}}]}],e.propDecorators={notFoundContent:[{type:t.Input}],menuItemSelectedIcon:[{type:t.Input}],dropdownRender:[{type:t.Input}],activatedValue:[{type:t.Input}],listOfSelectedValue:[{type:t.Input}],compareWith:[{type:t.Input}],mode:[{type:t.Input}],matchWidth:[{type:t.Input}],itemSize:[{type:t.Input}],maxItemLength:[{type:t.Input}],listOfContainerItem:[{type:t.Input}],itemClick:[{type:t.Output}],scrollToBottom:[{type:t.Output}],cdkVirtualScrollViewport:[{type:t.ViewChild,args:[o.CdkVirtualScrollViewport,{static:!0}]}]},e}();var T=function(){function e(e){this.nzOptionGroupComponent=e,this.destroy$=new n.Subject,this.changes=new n.Subject,this.groupLabel=null,this.nzLabel=null,this.nzValue=null,this.nzDisabled=!1,this.nzHide=!1,this.nzCustomContent=!1}return e.prototype.ngOnInit=function(){var e=this;this.nzOptionGroupComponent&&this.nzOptionGroupComponent.changes.pipe(a.startWith(!0),a.takeUntil(this.destroy$)).subscribe((function(){e.groupLabel=e.nzOptionGroupComponent.nzLabel}))},e.prototype.ngOnChanges=function(){this.changes.next()},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e.decorators=[{type:t.Component,args:[{selector:"nz-option",exportAs:"nzOption",encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,template:"\n <ng-template>\n <ng-content></ng-content>\n </ng-template>\n "}]}],e.ctorParameters=function(){return[{type:V,decorators:[{type:t.Optional}]}]},e.propDecorators={template:[{type:t.ViewChild,args:[t.TemplateRef,{static:!0}]}],nzLabel:[{type:t.Input}],nzValue:[{type:t.Input}],nzDisabled:[{type:t.Input}],nzHide:[{type:t.Input}],nzCustomContent:[{type:t.Input}]},I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzDisabled",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzHide",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzCustomContent",void 0),e}();var x=function(){function e(e,n,o){this.elementRef=e,this.renderer=n,this.focusMonitor=o,this.disabled=!1,this.mirrorSync=!1,this.showInput=!0,this.focusTrigger=!1,this.value="",this.autofocus=!1,this.valueChange=new t.EventEmitter,this.isComposingChange=new t.EventEmitter}return e.prototype.setCompositionState=function(e){this.isComposingChange.next(e)},e.prototype.onValueChange=function(e){this.inputElement.nativeElement.value=e,this.value=e,this.valueChange.next(e),this.mirrorSync&&this.syncMirrorWidth()},e.prototype.clearInputValue=function(){this.onValueChange("")},e.prototype.syncMirrorWidth=function(){var e=this.mirrorElement.nativeElement,t=this.elementRef.nativeElement,n=this.inputElement.nativeElement;this.renderer.removeStyle(t,"width"),e.innerHTML=n.value+" ",this.renderer.setStyle(t,"width",e.scrollWidth+"px")},e.prototype.focus=function(){this.focusMonitor.focusVia(this.inputElement,"keyboard")},e.prototype.blur=function(){this.inputElement.nativeElement.blur()},e.prototype.ngOnChanges=function(e){var t=this.inputElement.nativeElement,n=e.focusTrigger,o=e.showInput;n&&!0===n.currentValue&&!1===n.previousValue&&t.focus(),o&&(this.showInput?this.renderer.removeAttribute(t,"readonly"):this.renderer.setAttribute(t,"readonly","readonly"))},e.prototype.ngAfterViewInit=function(){this.mirrorSync&&this.syncMirrorWidth(),this.autofocus&&this.focus()},e.decorators=[{type:t.Component,args:[{selector:"nz-select-search",encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,template:'\n <input\n #inputElement\n autocomplete="off"\n class="ant-select-selection-search-input"\n [ngModel]="value"\n [attr.autofocus]="autofocus ? \'autofocus\' : null"\n [disabled]="disabled"\n [style.opacity]="showInput ? null : 0"\n (ngModelChange)="onValueChange($event)"\n (compositionstart)="setCompositionState(true)"\n (compositionend)="setCompositionState(false)"\n />\n <span #mirrorElement *ngIf="mirrorSync" class="ant-select-selection-search-mirror"></span>\n ',host:{"[class.ant-select-selection-search]":"true"}}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:t.Renderer2},{type:l.FocusMonitor}]},e.propDecorators={disabled:[{type:t.Input}],mirrorSync:[{type:t.Input}],showInput:[{type:t.Input}],focusTrigger:[{type:t.Input}],value:[{type:t.Input}],autofocus:[{type:t.Input}],valueChange:[{type:t.Output}],isComposingChange:[{type:t.Output}],inputElement:[{type:t.ViewChild,args:["inputElement",{static:!0}]}],mirrorElement:[{type:t.ViewChild,args:["mirrorElement",{static:!1}]}]},e}();var k=function(){function e(e){this.noAnimation=e,this.showSearch=!1,this.placeHolder=null,this.open=!1,this.maxTagCount=1/0,this.autofocus=!1,this.disabled=!1,this.mode="default",this.customTemplate=null,this.maxTagPlaceholder=null,this.removeIcon=null,this.listOfTopItem=[],this.tokenSeparators=[],this.tokenize=new t.EventEmitter,this.inputValueChange=new t.EventEmitter,this.animationEnd=new t.EventEmitter,this.deleteItem=new t.EventEmitter,this.openChange=new t.EventEmitter,this.listOfSlicedItem=[],this.isShowPlaceholder=!0,this.isShowSingleLabel=!1,this.isComposing=!1,this.inputValue=null}return e.prototype.onHostClick=function(){this.disabled||this.openChange.next(!this.open)},e.prototype.onHostKeydown=function(e){var t=e.target.value;e.keyCode===r.BACKSPACE&&"default"!==this.mode&&!t&&this.listOfTopItem.length>0&&(e.preventDefault(),this.onDeleteItem(this.listOfTopItem[this.listOfTopItem.length-1]))},e.prototype.updateTemplateVariable=function(){var e=0===this.listOfTopItem.length;this.isShowPlaceholder=e&&!this.isComposing&&!this.inputValue,this.isShowSingleLabel=!e&&!this.isComposing&&!this.inputValue},e.prototype.isComposingChange=function(e){this.isComposing=e,this.updateTemplateVariable()},e.prototype.onInputValueChange=function(e){e!==this.inputValue&&(this.inputValue=e,this.updateTemplateVariable(),this.inputValueChange.emit(e),this.tokenSeparate(e,this.tokenSeparators))},e.prototype.tokenSeparate=function(e,t){var n,o,i;if(e&&e.length&&t.length&&"default"!==this.mode&&function(e,t){for(var n=0;n<t.length;++n)if(e.lastIndexOf(t[n])>0)return!0;return!1}(e,t)){var a=(n=e,o=new RegExp("["+t.join()+"]"),i=n.split(o).filter((function(e){return e})),b(new Set(i)));this.tokenize.next(a)}},e.prototype.clearInputValue=function(){this.nzSelectSearchComponent&&this.nzSelectSearchComponent.clearInputValue()},e.prototype.focus=function(){this.nzSelectSearchComponent&&this.nzSelectSearchComponent.focus()},e.prototype.blur=function(){this.nzSelectSearchComponent&&this.nzSelectSearchComponent.blur()},e.prototype.trackValue=function(e,t){return t.nzValue},e.prototype.onDeleteItem=function(e){this.disabled||e.nzDisabled||this.deleteItem.next(e)},e.prototype.onAnimationEnd=function(){this.animationEnd.next()},e.prototype.ngOnChanges=function(e){var t=this,n=e.listOfTopItem,o=e.maxTagCount,i=e.customTemplate,a=e.maxTagPlaceholder;if(n&&this.updateTemplateVariable(),n||o||i||a){var l=this.listOfTopItem.slice(0,this.maxTagCount).map((function(e){return{nzLabel:e.nzLabel,nzValue:e.nzValue,nzDisabled:e.nzDisabled,contentTemplateOutlet:t.customTemplate,contentTemplateOutletContext:e}}));if(this.listOfTopItem.length>this.maxTagCount){var r="+ "+(this.listOfTopItem.length-this.maxTagCount)+" ...",s=this.listOfTopItem.map((function(e){return e.nzValue})),p={nzLabel:r,nzValue:"$$__nz_exceeded_item",nzDisabled:!0,contentTemplateOutlet:this.maxTagPlaceholder,contentTemplateOutletContext:s.slice(this.maxTagCount)};l.push(p)}this.listOfSlicedItem=l}},e.decorators=[{type:t.Component,args:[{selector:"nz-select-top-control",exportAs:"nzSelectTopControl",preserveWhitespaces:!1,animations:[u.zoomMotion],changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,template:'\n \x3c!--single mode--\x3e\n <ng-container [ngSwitch]="mode">\n <ng-container *ngSwitchCase="\'default\'">\n <nz-select-item\n *ngIf="isShowSingleLabel"\n [deletable]="false"\n [disabled]="false"\n [removeIcon]="removeIcon"\n [label]="listOfTopItem[0].nzLabel"\n [contentTemplateOutlet]="customTemplate"\n [contentTemplateOutletContext]="listOfTopItem[0]"\n ></nz-select-item>\n <nz-select-search\n [disabled]="disabled"\n [value]="inputValue"\n [showInput]="open && showSearch"\n [mirrorSync]="false"\n [autofocus]="autofocus"\n [focusTrigger]="open"\n (isComposingChange)="isComposingChange($event)"\n (valueChange)="onInputValueChange($event)"\n ></nz-select-search>\n </ng-container>\n <ng-container *ngSwitchDefault>\n \x3c!--multiple or tags mode--\x3e\n <nz-select-item\n *ngFor="let item of listOfSlicedItem; trackBy: trackValue"\n [@zoomMotion]\n [@.disabled]="noAnimation?.nzNoAnimation"\n [nzNoAnimation]="noAnimation?.nzNoAnimation"\n [removeIcon]="removeIcon"\n [label]="item.nzLabel"\n [disabled]="item.nzDisabled || disabled"\n [contentTemplateOutlet]="item.contentTemplateOutlet"\n [deletable]="true"\n [contentTemplateOutletContext]="item.contentTemplateOutletContext"\n (@zoomMotion.done)="onAnimationEnd()"\n (delete)="onDeleteItem(item.contentTemplateOutletContext)"\n >\n </nz-select-item>\n <nz-select-search\n [disabled]="disabled"\n [value]="inputValue"\n [autofocus]="autofocus"\n [showInput]="true"\n [mirrorSync]="true"\n [focusTrigger]="open"\n (isComposingChange)="isComposingChange($event)"\n (valueChange)="onInputValueChange($event)"\n ></nz-select-search>\n </ng-container>\n </ng-container>\n <nz-select-placeholder *ngIf="isShowPlaceholder" [placeholder]="placeHolder"></nz-select-placeholder>\n ',host:{"[class.ant-select-selector]":"true","(click)":"onHostClick()","(keydown)":"onHostKeydown($event)"}}]}],e.ctorParameters=function(){return[{type:d.NzNoAnimationDirective,decorators:[{type:t.Host},{type:t.Optional}]}]},e.propDecorators={showSearch:[{type:t.Input}],placeHolder:[{type:t.Input}],open:[{type:t.Input}],maxTagCount:[{type:t.Input}],autofocus:[{type:t.Input}],disabled:[{type:t.Input}],mode:[{type:t.Input}],customTemplate:[{type:t.Input}],maxTagPlaceholder:[{type:t.Input}],removeIcon:[{type:t.Input}],listOfTopItem:[{type:t.Input}],tokenSeparators:[{type:t.Input}],tokenize:[{type:t.Output}],inputValueChange:[{type:t.Output}],animationEnd:[{type:t.Output}],deleteItem:[{type:t.Output}],openChange:[{type:t.Output}],nzSelectSearchComponent:[{type:t.ViewChild,args:[x]}]},e}();var D=function(e,t){return!(!t||!t.nzLabel)&&t.nzLabel.toLowerCase().indexOf(e.toLowerCase())>-1},E=function(){function e(e,o,i,a,l,r){this.nzConfigService=e,this.cdr=o,this.elementRef=i,this.platform=a,this.focusMonitor=l,this.noAnimation=r,this.nzSize="default",this.nzOptionHeightPx=32,this.nzOptionOverflowSize=8,this.nzDropdownClassName=null,this.nzDropdownMatchSelectWidth=!0,this.nzDropdownStyle=null,this.nzNotFoundContent=void 0,this.nzPlaceHolder=null,this.nzMaxTagCount=1/0,this.nzDropdownRender=null,this.nzCustomTemplate=null,this.nzClearIcon=null,this.nzRemoveIcon=null,this.nzMenuItemSelectedIcon=null,this.nzShowArrow=!0,this.nzTokenSeparators=[],this.nzMaxTagPlaceholder=null,this.nzMaxMultipleCount=1/0,this.nzMode="default",this.nzFilterOption=D,this.compareWith=function(e,t){return e===t},this.nzAllowClear=!1,this.nzBorderless=!1,this.nzShowSearch=!1,this.nzLoading=!1,this.nzAutoFocus=!1,this.nzAutoClearSearchValue=!0,this.nzServerSearch=!1,this.nzDisabled=!1,this.nzOpen=!1,this.nzOptions=[],this.nzOnSearch=new t.EventEmitter,this.nzScrollToBottom=new t.EventEmitter,this.nzOpenChange=new t.EventEmitter,this.nzBlur=new t.EventEmitter,this.nzFocus=new t.EventEmitter,this.listOfValue$=new n.BehaviorSubject([]),this.listOfTemplateItem$=new n.BehaviorSubject([]),this.listOfTagAndTemplateItem=[],this.searchValue="",this.isReactiveDriven=!1,this.destroy$=new n.Subject,this.onChange=function(){},this.onTouched=function(){},this.dropDownPosition="bottom",this.triggerWidth=null,this.listOfContainerItem=[],this.listOfTopItem=[],this.activatedValue=null,this.listOfValue=[]}return e.prototype.generateTagItem=function(e){return{nzValue:e,nzLabel:e,type:"item"}},e.prototype.onItemClick=function(e){var t=this;if(this.activatedValue=e,"default"===this.nzMode)0!==this.listOfValue.length&&this.compareWith(this.listOfValue[0],e)||this.updateListOfValue([e]),this.setOpenState(!1);else{var n=this.listOfValue.findIndex((function(n){return t.compareWith(n,e)}));if(-1!==n){var o=this.listOfValue.filter((function(e,t){return t!==n}));this.updateListOfValue(o)}else if(this.listOfValue.length<this.nzMaxMultipleCount){var i=b(this.listOfValue,[e]);this.updateListOfValue(i)}this.focus(),this.nzAutoClearSearchValue&&this.clearInput()}},e.prototype.onItemDelete=function(e){var t=this,n=this.listOfValue.filter((function(n){return!t.compareWith(n,e.nzValue)}));this.updateListOfValue(n),this.clearInput()},e.prototype.updateListOfContainerItem=function(){var e=this,t=this.listOfTagAndTemplateItem.filter((function(e){return!e.nzHide})).filter((function(t){return!(!e.nzServerSearch&&e.searchValue)||e.nzFilterOption(e.searchValue,t)}));if("tags"===this.nzMode&&this.searchValue&&-1===this.listOfTagAndTemplateItem.findIndex((function(t){return t.nzLabel===e.searchValue}))){var n=this.generateTagItem(this.searchValue);t=b([n],t),this.activatedValue=n.nzValue}if(0!==this.listOfValue.length&&-1===t.findIndex((function(t){return e.compareWith(t.nzValue,e.activatedValue)}))){var o=t.find((function(t){return e.compareWith(t.nzValue,e.listOfValue[0])}))||t[0];this.activatedValue=o&&o.nzValue||null}var i=[];this.isReactiveDriven?i=b(new Set(this.nzOptions.filter((function(e){return e.groupLabel})).map((function(e){return e.groupLabel})))):this.listOfNzOptionGroupComponent&&(i=this.listOfNzOptionGroupComponent.map((function(e){return e.nzLabel}))),i.forEach((function(e){var n=t.findIndex((function(t){return e===t.groupLabel})),o={groupLabel:e,type:"group",key:e};t.splice(n,0,o)})),this.listOfContainerItem=b(t),this.updateCdkConnectedOverlayPositions()},e.prototype.clearInput=function(){this.nzSelectTopControlComponent.clearInputValue()},e.prototype.updateListOfValue=function(e){var t,n=(t=e,"default"===this.nzMode?t.length>0?t[0]:null:t);this.value!==n&&(this.listOfValue=e,this.listOfValue$.next(e),this.value=n,this.onChange(this.value))},e.prototype.onTokenSeparate=function(e){var t=this,n=this.listOfTagAndTemplateItem.filter((function(t){return-1!==e.findIndex((function(e){return e===t.nzLabel}))})).map((function(e){return e.nzValue})).filter((function(e){return-1===t.listOfValue.findIndex((function(n){return t.compareWith(n,e)}))}));if("multiple"===this.nzMode)this.updateListOfValue(b(this.listOfValue,n));else if("tags"===this.nzMode){var o=e.filter((function(e){return-1===t.listOfTagAndTemplateItem.findIndex((function(t){return t.nzLabel===e}))}));this.updateListOfValue(b(this.listOfValue,n,o))}this.clearInput()},e.prototype.onKeyDown=function(e){var t=this;if(!this.nzDisabled){var n=this.listOfContainerItem.filter((function(e){return"item"===e.type})).filter((function(e){return!e.nzDisabled})),o=n.findIndex((function(e){return t.compareWith(e.nzValue,t.activatedValue)}));switch(e.keyCode){case r.UP_ARROW:if(e.preventDefault(),this.nzOpen){var i=o>0?o-1:n.length-1;this.activatedValue=n[i].nzValue}break;case r.DOWN_ARROW:if(e.preventDefault(),this.nzOpen){var a=o<n.length-1?o+1:0;this.activatedValue=n[a].nzValue}else this.setOpenState(!0);break;case r.ENTER:e.preventDefault(),this.nzOpen?this.activatedValue&&this.onItemClick(this.activatedValue):this.setOpenState(!0);break;case r.SPACE:this.nzOpen||(this.setOpenState(!0),e.preventDefault());break;case r.TAB:this.setOpenState(!1)}}},e.prototype.setOpenState=function(e){this.nzOpen!==e&&(this.nzOpen=e,this.nzOpenChange.emit(e),this.onOpenChange(),this.cdr.markForCheck())},e.prototype.onOpenChange=function(){this.updateCdkConnectedOverlayStatus(),this.clearInput()},e.prototype.onInputValueChange=function(e){this.searchValue=e,this.updateListOfContainerItem(),this.nzOnSearch.emit(e),this.updateCdkConnectedOverlayPositions()},e.prototype.onClearSelection=function(){this.updateListOfValue([])},e.prototype.focus=function(){this.nzSelectTopControlComponent.focus()},e.prototype.blur=function(){this.nzSelectTopControlComponent.blur()},e.prototype.onPositionChange=function(e){this.dropDownPosition=e.connectionPair.originY},e.prototype.updateCdkConnectedOverlayStatus=function(){this.platform.isBrowser&&this.originElement.nativeElement&&(this.triggerWidth=this.originElement.nativeElement.getBoundingClientRect().width)},e.prototype.updateCdkConnectedOverlayPositions=function(){this.cdkConnectedOverlay.overlayRef&&this.cdkConnectedOverlay.overlayRef.updatePosition()},e.prototype.writeValue=function(e){if(this.value!==e){this.value=e;var t=(n=e,o=this.nzMode,null==n?[]:"default"===o?[n]:n);this.listOfValue=t,this.listOfValue$.next(t),this.cdr.markForCheck()}var n,o},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){this.nzDisabled=e,e&&this.setOpenState(!1),this.cdr.markForCheck()},e.prototype.ngOnChanges=function(e){var n=e.nzOpen,o=e.nzDisabled,i=e.nzOptions;if(n&&this.onOpenChange(),o&&this.nzDisabled&&this.setOpenState(!1),i){this.isReactiveDriven=!0;var a=(this.nzOptions||[]).map((function(e){return{template:e.label instanceof t.TemplateRef?e.label:null,nzLabel:"string"==typeof e.label?e.label:null,nzValue:e.value,nzDisabled:e.disabled||!1,nzHide:e.hide||!1,nzCustomContent:e.label instanceof t.TemplateRef,groupLabel:e.groupLabel||null,type:"item",key:e.value}}));this.listOfTemplateItem$.next(a)}},e.prototype.ngOnInit=function(){var e=this;this.focusMonitor.monitor(this.elementRef,!0).pipe(a.takeUntil(this.destroy$)).subscribe((function(t){t?e.nzFocus.emit():(e.nzBlur.emit(),Promise.resolve().then((function(){e.onTouched()})))})),n.combineLatest([this.listOfValue$,this.listOfTemplateItem$]).pipe(a.takeUntil(this.destroy$)).subscribe((function(t){var n=S(t,2),o=n[0],i=n[1],a=o.filter((function(){return"tags"===e.nzMode})).filter((function(t){return-1===i.findIndex((function(n){return e.compareWith(n.nzValue,t)}))})).map((function(t){return e.listOfTopItem.find((function(n){return e.compareWith(n.nzValue,t)}))||e.generateTagItem(t)}));e.listOfTagAndTemplateItem=b(i,a),e.listOfTopItem=e.listOfValue.map((function(t){return b(e.listOfTagAndTemplateItem,e.listOfTopItem).find((function(n){return e.compareWith(t,n.nzValue)}))})).filter((function(e){return!!e})),e.updateListOfContainerItem()}))},e.prototype.ngAfterViewInit=function(){this.updateCdkConnectedOverlayStatus()},e.prototype.ngAfterContentInit=function(){var e=this;this.isReactiveDriven||n.merge(this.listOfNzOptionGroupComponent.changes,this.listOfNzOptionComponent.changes).pipe(a.startWith(!0),a.switchMap((function(){return n.merge.apply(void 0,b([e.listOfNzOptionComponent.changes,e.listOfNzOptionGroupComponent.changes],e.listOfNzOptionComponent.map((function(e){return e.changes})),e.listOfNzOptionGroupComponent.map((function(e){return e.changes})))).pipe(a.startWith(!0))})),a.takeUntil(this.destroy$)).subscribe((function(){var t=e.listOfNzOptionComponent.toArray().map((function(e){var t=e.template,n=e.nzLabel,o=e.nzValue;return{template:t,nzLabel:n,nzValue:o,nzDisabled:e.nzDisabled,nzHide:e.nzHide,nzCustomContent:e.nzCustomContent,groupLabel:e.groupLabel,type:"item",key:o}}));e.listOfTemplateItem$.next(t),e.cdr.markForCheck()}))},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e.decorators=[{type:t.Component,args:[{selector:"nz-select",exportAs:"nzSelect",preserveWhitespaces:!1,providers:[{provide:c.NG_VALUE_ACCESSOR,useExisting:t.forwardRef((function(){return e})),multi:!0}],changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,animations:[u.slideMotion],template:'\n <nz-select-top-control\n cdkOverlayOrigin\n #origin="cdkOverlayOrigin"\n [open]="nzOpen"\n [disabled]="nzDisabled"\n [mode]="nzMode"\n [@.disabled]="noAnimation?.nzNoAnimation"\n [nzNoAnimation]="noAnimation?.nzNoAnimation"\n [maxTagPlaceholder]="nzMaxTagPlaceholder"\n [removeIcon]="nzRemoveIcon"\n [placeHolder]="nzPlaceHolder"\n [maxTagCount]="nzMaxTagCount"\n [customTemplate]="nzCustomTemplate"\n [tokenSeparators]="nzTokenSeparators"\n [showSearch]="nzShowSearch"\n [autofocus]="nzAutoFocus"\n [listOfTopItem]="listOfTopItem"\n (inputValueChange)="onInputValueChange($event)"\n (tokenize)="onTokenSeparate($event)"\n (animationEnd)="updateCdkConnectedOverlayPositions()"\n (deleteItem)="onItemDelete($event)"\n (keydown)="onKeyDown($event)"\n (openChange)="setOpenState($event)"\n ></nz-select-top-control>\n <nz-select-clear\n *ngIf="nzAllowClear && !nzDisabled && listOfValue.length"\n [clearIcon]="nzClearIcon"\n (clear)="onClearSelection()"\n ></nz-select-clear>\n <nz-select-arrow\n *ngIf="nzShowArrow && nzMode === \'default\'"\n [loading]="nzLoading"\n [search]="nzOpen && nzShowSearch"\n [suffixIcon]="nzSuffixIcon"\n ></nz-select-arrow>\n <ng-template\n cdkConnectedOverlay\n nzConnectedOverlay\n [cdkConnectedOverlayHasBackdrop]="true"\n [cdkConnectedOverlayMinWidth]="nzDropdownMatchSelectWidth ? null : triggerWidth"\n [cdkConnectedOverlayWidth]="nzDropdownMatchSelectWidth ? triggerWidth : null"\n [cdkConnectedOverlayOrigin]="origin"\n [cdkConnectedOverlayPanelClass]="nzDropdownClassName"\n (backdropClick)="setOpenState(false)"\n (detach)="setOpenState(false)"\n (positionChange)="onPositionChange($event)"\n [cdkConnectedOverlayOpen]="nzOpen"\n >\n <nz-option-container\n [ngStyle]="nzDropdownStyle"\n [itemSize]="nzOptionHeightPx"\n [maxItemLength]="nzOptionOverflowSize"\n [matchWidth]="nzDropdownMatchSelectWidth"\n [class.ant-select-dropdown-placement-bottomLeft]="dropDownPosition === \'bottom\'"\n [class.ant-select-dropdown-placement-topLeft]="dropDownPosition === \'top\'"\n [@slideMotion]="dropDownPosition"\n [@.disabled]="noAnimation?.nzNoAnimation"\n [nzNoAnimation]="noAnimation?.nzNoAnimation"\n [listOfContainerItem]="listOfContainerItem"\n [menuItemSelectedIcon]="nzMenuItemSelectedIcon"\n [notFoundContent]="nzNotFoundContent"\n [activatedValue]="activatedValue"\n [listOfSelectedValue]="listOfValue"\n [dropdownRender]="nzDropdownRender"\n [compareWith]="compareWith"\n [mode]="nzMode"\n (keydown)="onKeyDown($event)"\n (itemClick)="onItemClick($event)"\n (scrollToBottom)="nzScrollToBottom.emit()"\n ></nz-option-container>\n </ng-template>\n ',host:{"[class.ant-select]":"true","[class.ant-select-lg]":'nzSize === "large"',"[class.ant-select-sm]":'nzSize === "small"',"[class.ant-select-show-arrow]":"nzShowArrow && nzMode === 'default'","[class.ant-select-disabled]":"nzDisabled","[class.ant-select-show-search]":"nzShowSearch || nzMode !== 'default'","[class.ant-select-allow-clear]":"nzAllowClear","[class.ant-select-borderless]":"nzBorderless","[class.ant-select-open]":"nzOpen","[class.ant-select-focused]":"nzOpen","[class.ant-select-single]":"nzMode === 'default'","[class.ant-select-multiple]":"nzMode !== 'default'"}}]}],e.ctorParameters=function(){return[{type:h.NzConfigService},{type:t.ChangeDetectorRef},{type:t.ElementRef},{type:p.Platform},{type:l.FocusMonitor},{type:d.NzNoAnimationDirective,decorators:[{type:t.Host},{type:t.Optional}]}]},e.propDecorators={nzSize:[{type:t.Input}],nzOptionHeightPx:[{type:t.Input}],nzOptionOverflowSize:[{type:t.Input}],nzDropdownClassName:[{type:t.Input}],nzDropdownMatchSelectWidth:[{type:t.Input}],nzDropdownStyle:[{type:t.Input}],nzNotFoundContent:[{type:t.Input}],nzPlaceHolder:[{type:t.Input}],nzMaxTagCount:[{type:t.Input}],nzDropdownRender:[{type:t.Input}],nzCustomTemplate:[{type:t.Input}],nzSuffixIcon:[{type:t.Input}],nzClearIcon:[{type:t.Input}],nzRemoveIcon:[{type:t.Input}],nzMenuItemSelectedIcon:[{type:t.Input}],nzShowArrow:[{type:t.Input}],nzTokenSeparators:[{type:t.Input}],nzMaxTagPlaceholder:[{type:t.Input}],nzMaxMultipleCount:[{type:t.Input}],nzMode:[{type:t.Input}],nzFilterOption:[{type:t.Input}],compareWith:[{type:t.Input}],nzAllowClear:[{type:t.Input}],nzBorderless:[{type:t.Input}],nzShowSearch:[{type:t.Input}],nzLoading:[{type:t.Input}],nzAutoFocus:[{type:t.Input}],nzAutoClearSearchValue:[{type:t.Input}],nzServerSearch:[{type:t.Input}],nzDisabled:[{type:t.Input}],nzOpen:[{type:t.Input}],nzOptions:[{type:t.Input}],nzOnSearch:[{type:t.Output}],nzScrollToBottom:[{type:t.Output}],nzOpenChange:[{type:t.Output}],nzBlur:[{type:t.Output}],nzFocus:[{type:t.Output}],originElement:[{type:t.ViewChild,args:[s.CdkOverlayOrigin,{static:!0,read:t.ElementRef}]}],cdkConnectedOverlay:[{type:t.ViewChild,args:[s.CdkConnectedOverlay,{static:!0}]}],nzSelectTopControlComponent:[{type:t.ViewChild,args:[k,{static:!0}]}],listOfNzOptionComponent:[{type:t.ContentChildren,args:[T,{descendants:!0}]}],listOfNzOptionGroupComponent:[{type:t.ContentChildren,args:[V,{descendants:!0}]}],nzOptionGroupComponentElement:[{type:t.ViewChild,args:[V,{static:!0,read:t.ElementRef}]}],nzSelectTopControlComponentElement:[{type:t.ViewChild,args:[k,{static:!0,read:t.ElementRef}]}]},I([h.WithConfig("select",null),v("design:type",Object)],e.prototype,"nzSuffixIcon",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzAllowClear",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzBorderless",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzShowSearch",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzLoading",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzAutoFocus",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzAutoClearSearchValue",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzServerSearch",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzDisabled",void 0),I([i.InputBoolean(),v("design:type",Object)],e.prototype,"nzOpen",void 0),e}();var A=function(){function e(){this.nzLabel=null}return e.decorators=[{type:t.Component,args:[{selector:"nz-option-item-group",template:'\n <ng-container *nzStringTemplateOutlet="nzLabel">{{ nzLabel }}</ng-container>\n ',changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,host:{"[class.ant-select-item]":"true","[class.ant-select-item-group]":"true"}}]}],e.propDecorators={nzLabel:[{type:t.Input}]},e}();var M=function(){function e(){this.selected=!1,this.activated=!1,this.grouped=!1,this.customContent=!1,this.template=null,this.disabled=!1,this.showState=!1,this.label=null,this.value=null,this.activatedValue=null,this.listOfSelectedValue=[],this.icon=null,this.itemClick=new t.EventEmitter,this.itemHover=new t.EventEmitter}return e.prototype.onHostMouseEnter=function(){this.disabled||this.itemHover.next(this.value)},e.prototype.onHostClick=function(){this.disabled||this.itemClick.next(this.value)},e.prototype.ngOnChanges=function(e){var t=this,n=e.value,o=e.activatedValue,i=e.listOfSelectedValue;(n||i)&&(this.selected=this.listOfSelectedValue.find((function(e){return t.compareWith(e,t.value)}))),(n||o)&&(this.activated=this.compareWith(this.activatedValue,this.value))},e.decorators=[{type:t.Component,args:[{selector:"nz-option-item",template:'\n <div class="ant-select-item-option-content">\n <ng-container *ngIf="!customContent; else template">{{ label }}</ng-container>\n </div>\n <div *ngIf="showState && selected" class="ant-select-item-option-state" style="user-select: none" unselectable="on">\n <i nz-icon nzType="check" class="ant-select-selected-icon" *ngIf="!icon; else icon"></i>\n </div>\n ',changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,host:{"[class.ant-select-item]":"true","[class.ant-select-item-option]":"true","[class.ant-select-item-option-grouped]":"grouped","[class.ant-select-item-option-selected]":"selected && !disabled","[class.ant-select-item-option-disabled]":"disabled","[class.ant-select-item-option-active]":"activated && !disabled","(mouseenter)":"onHostMouseEnter()","(click)":"onHostClick()"}}]}],e.propDecorators={grouped:[{type:t.Input}],customContent:[{type:t.Input}],template:[{type:t.Input}],disabled:[{type:t.Input}],showState:[{type:t.Input}],label:[{type:t.Input}],value:[{type:t.Input}],activatedValue:[{type:t.Input}],listOfSelectedValue:[{type:t.Input}],icon:[{type:t.Input}],compareWith:[{type:t.Input}],itemClick:[{type:t.Output}],itemHover:[{type:t.Output}]},e}();var L=function(){function e(){this.loading=!1,this.search=!1,this.suffixIcon=null}return e.decorators=[{type:t.Component,args:[{selector:"nz-select-arrow",encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,template:'\n <i nz-icon nzType="loading" *ngIf="loading; else defaultArrow"></i>\n <ng-template #defaultArrow>\n <ng-container *ngIf="!suffixIcon; else suffixTemplate">\n <i nz-icon nzType="down" *ngIf="!search"></i>\n <i nz-icon nzType="search" *ngIf="search"></i>\n </ng-container>\n <ng-template #suffixTemplate>\n <ng-container *nzStringTemplateOutlet="suffixIcon">\n <i nz-icon [nzType]="suffixIcon"></i>\n </ng-container>\n </ng-template>\n </ng-template>\n ',host:{"[class.ant-select-arrow]":"true","[class.ant-select-arrow-loading]":"loading"}}]}],e.propDecorators={loading:[{type:t.Input}],search:[{type:t.Input}],suffixIcon:[{type:t.Input}]},e}();var N=function(){function e(){this.clearIcon=null,this.clear=new t.EventEmitter}return e.prototype.onClick=function(e){e.preventDefault(),e.stopPropagation(),this.clear.emit(e)},e.decorators=[{type:t.Component,args:[{selector:"nz-select-clear",encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,template:'\n <i nz-icon nzType="close-circle" nzTheme="fill" *ngIf="!clearIcon; else clearIcon" class="ant-select-close-icon"></i>\n ',host:{"(click)":"onClick($event)","[class.ant-select-clear]":"true"}}]}],e.propDecorators={clearIcon:[{type:t.Input}],clear:[{type:t.Output}]},e}();var P=function(){function e(){this.disabled=!1,this.label=null,this.deletable=!1,this.removeIcon=null,this.contentTemplateOutletContext=null,this.contentTemplateOutlet=null,this.delete=new t.EventEmitter}return e.prototype.onDelete=function(e){e.preventDefault(),e.stopPropagation(),this.disabled||this.delete.next(e)},e.decorators=[{type:t.Component,args:[{selector:"nz-select-item",encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,template:'\n <ng-container *nzStringTemplateOutlet="contentTemplateOutlet; context: { $implicit: contentTemplateOutletContext }">\n <div class="ant-select-selection-item-content" *ngIf="deletable; else labelTemplate">{{ label }}</div>\n <ng-template #labelTemplate>{{ label }}</ng-template>\n </ng-container>\n <span *ngIf="deletable && !disabled" class="ant-select-selection-item-remove" (click)="onDelete($event)">\n <i nz-icon nzType="close" *ngIf="!removeIcon; else removeIcon"></i>\n </span>\n ',host:{"[attr.title]":"label","[class.ant-select-selection-item]":"true","[class.ant-select-selection-item-disabled]":"disabled"}}]}],e.propDecorators={disabled:[{type:t.Input}],label:[{type:t.Input}],deletable:[{type:t.Input}],removeIcon:[{type:t.Input}],contentTemplateOutletContext:[{type:t.Input}],contentTemplateOutlet:[{type:t.Input}],delete:[{type:t.Output}]},e}();var W=function(){function e(){this.placeholder=null}return e.decorators=[{type:t.Component,args:[{selector:"nz-select-placeholder",encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,template:'\n <ng-container *nzStringTemplateOutlet="placeholder">\n {{ placeholder }}\n </ng-container>\n ',host:{"[class.ant-select-selection-placeholder]":"true"}}]}],e.propDecorators={placeholder:[{type:t.Input}]},e}();var R=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[m.CommonModule,C.NzI18nModule,c.FormsModule,p.PlatformModule,s.OverlayModule,O.NzIconModule,f.NzOutletModule,y.NzEmptyModule,g.NzOverlayModule,d.NzNoAnimationModule,z.ɵNzTransitionPatchModule,o.ScrollingModule,l.A11yModule],declarations:[T,E,w,V,M,k,x,P,N,L,W,A],exports:[T,E,V,L,N,P,W,x]}]}],e}();
/**
* @license
* Copyright Alibaba.com All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://github.com/NG-ZORRO/ng-zorro-antd/blob/master/LICENSE
*/e.NzOptionComponent=T,e.NzOptionContainerComponent=w,e.NzOptionGroupComponent=V,e.NzOptionItemComponent=M,e.NzOptionItemGroupComponent=A,e.NzSelectArrowComponent=L,e.NzSelectClearComponent=N,e.NzSelectComponent=E,e.NzSelectItemComponent=P,e.NzSelectModule=R,e.NzSelectPlaceholderComponent=W,e.NzSelectSearchComponent=x,e.NzSelectTopControlComponent=k,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-select.umd.min.js.map