ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 38.2 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("ng-zorro-antd/core"),require("rxjs"),require("rxjs/operators"),require("@angular/cdk/keycodes"),require("@angular/cdk/overlay"),require("@angular/cdk/platform"),require("@angular/forms"),require("@angular/common"),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","ng-zorro-antd/core","rxjs","rxjs/operators","@angular/cdk/keycodes","@angular/cdk/overlay","@angular/cdk/platform","@angular/forms","@angular/common","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["ng-zorro-antd"].core,e.rxjs,e.rxjs.operators,e.ng.cdk.keycodes,e.ng.cdk.overlay,e.ng.cdk.platform,e.ng.forms,e.ng.common,e["ng-zorro-antd"].empty,e["ng-zorro-antd"].i18n,e["ng-zorro-antd"].icon)}(this,function(e,t,n,o,i,r,l,a,c,s,p,u,d){"use strict";function h(e,t,n,o){var i,r=arguments.length,l=r<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 a=e.length-1;a>=0;a--)(i=e[a])&&(l=(r<3?i(l):r>3?i(t,n,l):i(t,n))||l);return r>3&&l&&Object.defineProperty(t,n,l),l}function f(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function z(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,i,r=n.call(e),l=[];try{for(;(void 0===t||t-- >0)&&!(o=r.next()).done;)l.push(o.value)}catch(e){i={error:e}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return l}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(z(arguments[t]));return e}var O=function(){function e(){this.changes=new o.Subject,this.nzDisabled=!1,this.nzHide=!1,this.nzCustomContent=!1}return e.prototype.ngOnChanges=function(){this.changes.next()},e.decorators=[{type:t.Component,args:[{selector:"nz-option",exportAs:"nzOption",encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,template:"<ng-template>\n <ng-content></ng-content>\n</ng-template>"}]}],e.propDecorators={template:[{type:t.ViewChild,args:[t.TemplateRef,{static:!1}]}],nzLabel:[{type:t.Input}],nzValue:[{type:t.Input}],nzDisabled:[{type:t.Input}],nzHide:[{type:t.Input}],nzCustomContent:[{type:t.Input}]},h([n.InputBoolean(),f("design:type",Object)],e.prototype,"nzDisabled",void 0),h([n.InputBoolean(),f("design:type",Object)],e.prototype,"nzHide",void 0),h([n.InputBoolean(),f("design:type",Object)],e.prototype,"nzCustomContent",void 0),e}();var S=function(){function e(){this.isLabelString=!1}return Object.defineProperty(e.prototype,"nzLabel",{get:function(){return this.label},set:function(e){this.label=e,this.isLabelString=!(this.nzLabel instanceof t.TemplateRef)},enumerable:!0,configurable:!0}),e.decorators=[{type:t.Component,args:[{selector:"nz-option-group",exportAs:"nzOptionGroup",encapsulation:t.ViewEncapsulation.None,changeDetection:t.ChangeDetectionStrategy.OnPush,template:"<ng-content></ng-content>"}]}],e.propDecorators={listOfNzOptionComponent:[{type:t.ContentChildren,args:[O]}],nzLabel:[{type:t.Input}]},e}();var g=function(){function e(){}return e.prototype.transform=function(e,t,n,o){return o||!t?e:e.filter(function(e){return n(t,e)})},e.decorators=[{type:t.Pipe,args:[{name:"nzFilterOption"}]}],e}(),y=function(){function e(){}return e.prototype.transform=function(e,t,n,o){return o||!t?e:e.filter(function(e){return e.listOfNzOptionComponent.some(function(e){return n(t,e)})})},e.decorators=[{type:t.Pipe,args:[{name:"nzFilterGroupOption"}]}],e}();function v(e,t){return!(!t||!t.nzLabel)&&t.nzLabel.toLowerCase().indexOf(e.toLowerCase())>-1}var C=function(){function e(){var e=this;this.autoClearSearchValue=!0,this.serverSearch=!1,this.filterOption=v,this.mode="default",this.maxMultipleCount=1/0,this.disabled=!1,this.compareWith=function(e,t){return e===t},this.listOfSelectedValueWithEmit$=new o.BehaviorSubject({value:[],emit:!1}),this.mapOfTemplateOption$=new o.BehaviorSubject({listOfNzOptionComponent:[],listOfNzOptionGroupComponent:[]}),this.searchValueRaw$=new o.BehaviorSubject(""),this.listOfFilteredOption=[],this.openRaw$=new o.Subject,this.checkRaw$=new o.Subject,this.open=!1,this.clearInput$=new o.Subject,this.searchValue="",this.isShowNotFound=!1,this.animationEvent$=new o.Subject,this.open$=this.openRaw$.pipe(i.distinctUntilChanged()),this.activatedOption$=new o.ReplaySubject(1),this.listOfSelectedValue$=this.listOfSelectedValueWithEmit$.pipe(i.map(function(e){return e.value})),this.modelChange$=this.listOfSelectedValueWithEmit$.pipe(i.filter(function(e){return e.emit}),i.map(function(t){var n=t.value,o=null;return e.isSingleMode?n.length&&(o=n[0]):o=n,o})),this.searchValue$=this.searchValueRaw$.pipe(i.distinctUntilChanged(),i.skip(1),i.share(),i.tap(function(t){e.searchValue=t,t&&e.updateActivatedOption(e.listOfFilteredOption[0]),e.updateListOfFilteredOption()})),this.listOfSelectedValue=[],this.listOfTemplateOption=[],this.listOfTagOption=[],this.listOfTagAndTemplateOption=[],this.listOfNzOptionComponent=[],this.listOfNzOptionGroupComponent=[],this.listOfCachedSelectedOption=[],this.valueOrOption$=o.combineLatest([this.listOfSelectedValue$,this.mapOfTemplateOption$]).pipe(i.tap(function(t){var n=z(t,2),o=n[0],i=n[1];e.listOfSelectedValue=o,e.listOfNzOptionComponent=i.listOfNzOptionComponent,e.listOfNzOptionGroupComponent=i.listOfNzOptionGroupComponent,e.listOfTemplateOption=e.listOfNzOptionComponent.concat(e.listOfNzOptionGroupComponent.reduce(function(e,t){return m(e,t.listOfNzOptionComponent.toArray())},[])),e.updateListOfTagOption(),e.updateListOfFilteredOption(),e.resetActivatedOptionIfNeeded(),e.updateListOfCachedOption()}),i.share()),this.check$=o.merge(this.checkRaw$,this.valueOrOption$,this.searchValue$,this.activatedOption$,this.open$,this.modelChange$).pipe(i.share())}return e.prototype.clickOption=function(e){var t=this;if(!e.nzDisabled){this.updateActivatedOption(e);var o=m(this.listOfSelectedValue);if(this.isMultipleOrTags){var i=o.find(function(n){return t.compareWith(n,e.nzValue)});n.isNotNil(i)?(o.splice(o.indexOf(i),1),this.updateListOfSelectedValue(o,!0)):o.length<this.maxMultipleCount&&(o.push(e.nzValue),this.updateListOfSelectedValue(o,!0))}else this.compareWith(o[0],e.nzValue)||(o=[e.nzValue],this.updateListOfSelectedValue(o,!0));this.isSingleMode?this.setOpenState(!1):this.autoClearSearchValue&&this.clearInput()}},e.prototype.updateListOfCachedOption=function(){var e=this;if(this.isSingleMode){var t=this.listOfTemplateOption.find(function(t){return e.compareWith(t.nzValue,e.listOfSelectedValue[0])});n.isNil(t)||(this.listOfCachedSelectedOption=[t])}else{var o=[];this.listOfSelectedValue.forEach(function(t){var n=m(e.listOfTagAndTemplateOption,e.listOfCachedSelectedOption).find(function(n){return e.compareWith(n.nzValue,t)});n&&o.push(n)}),this.listOfCachedSelectedOption=o}},e.prototype.updateListOfTagOption=function(){var e=this;if(this.isTagsMode){var t=this.listOfSelectedValue.filter(function(t){return!e.listOfTemplateOption.find(function(n){return e.compareWith(n.nzValue,t)})});this.listOfTagOption=t.map(function(t){var n=e.listOfCachedSelectedOption.find(function(n){return e.compareWith(n.nzValue,t)});if(n)return n;var o=new O;return o.nzValue=t,o.nzLabel=t,o}),this.listOfTagAndTemplateOption=m(this.listOfTemplateOption.concat(this.listOfTagOption))}else this.listOfTagAndTemplateOption=m(this.listOfTemplateOption)},e.prototype.updateAddTagOption=function(){var e=this,t=this.listOfTagAndTemplateOption.find(function(t){return t.nzLabel===e.searchValue});if(this.isTagsMode&&this.searchValue&&!t){var n=new O;n.nzValue=this.searchValue,n.nzLabel=this.searchValue,this.addedTagOption=n,this.updateActivatedOption(n)}else this.addedTagOption=null},e.prototype.updateListOfFilteredOption=function(){this.updateAddTagOption();var e=(new g).transform(this.listOfTagAndTemplateOption,this.searchValue,this.filterOption,this.serverSearch);this.listOfFilteredOption=this.addedTagOption?m([this.addedTagOption],e):m(e),this.isShowNotFound=!this.isTagsMode&&!this.listOfFilteredOption.length},e.prototype.clearInput=function(){this.clearInput$.next()},e.prototype.updateListOfSelectedValue=function(e,t){this.listOfSelectedValueWithEmit$.next({value:e,emit:t})},e.prototype.updateActivatedOption=function(e){this.activatedOption$.next(e),this.activatedOption=e},e.prototype.tokenSeparate=function(e,t){if(e&&e.length&&t.length&&this.isMultipleOrTags&&this.includesSeparators(e,t)){var n=this.splitBySeparators(e,t);this.updateSelectedValueByLabelList(n),this.clearInput()}},e.prototype.includesSeparators=function(e,t){for(var n=0;n<t.length;++n)if(e.lastIndexOf(t[n])>0)return!0;return!1},e.prototype.splitBySeparators=function(e,t){var n=new RegExp("["+t.join()+"]"),o=e.split(n).filter(function(e){return e});return Array.from(new Set(o))},e.prototype.resetActivatedOptionIfNeeded=function(){var e=this,t=function(){var t=e.listOfFilteredOption.find(function(t){return e.compareWith(t.nzValue,e.listOfSelectedValue[0])});e.updateActivatedOption(t||null)};this.activatedOption&&this.listOfFilteredOption.find(function(t){return e.compareWith(t.nzValue,e.activatedOption.nzValue)})&&this.listOfSelectedValue.find(function(t){return e.compareWith(t,e.activatedOption.nzValue)})||t()},e.prototype.updateTemplateOption=function(e,t){this.mapOfTemplateOption$.next({listOfNzOptionComponent:e,listOfNzOptionGroupComponent:t})},e.prototype.updateSearchValue=function(e){this.searchValueRaw$.next(e)},e.prototype.updateSelectedValueByLabelList=function(e){var t=this,o=m(this.listOfSelectedValue),i=this.listOfTagAndTemplateOption.filter(function(t){return-1!==e.indexOf(t.nzLabel)}).map(function(e){return e.nzValue}).filter(function(e){return!n.isNotNil(t.listOfSelectedValue.find(function(n){return t.compareWith(n,e)}))});if(this.isMultipleMode)this.updateListOfSelectedValue(m(o,i),!0);else{var r=e.filter(function(e){return-1===t.listOfTagAndTemplateOption.map(function(e){return e.nzLabel}).indexOf(e)});this.updateListOfSelectedValue(m(o,i,r),!0)}},e.prototype.onKeyDown=function(e){var t=this;if(!this.disabled){var n=e.keyCode,o=e.target,i=this.listOfFilteredOption.filter(function(e){return!e.nzDisabled}),l=i.findIndex(function(e){return e===t.activatedOption});switch(n){case r.UP_ARROW:e.preventDefault();var a=l>0?l-1:i.length-1;this.updateActivatedOption(i[a]);break;case r.DOWN_ARROW:e.preventDefault();var c=l<i.length-1?l+1:0;this.updateActivatedOption(i[c]),this.disabled||this.open||this.setOpenState(!0);break;case r.ENTER:e.preventDefault(),this.open?this.activatedOption&&!this.activatedOption.nzDisabled&&this.clickOption(this.activatedOption):this.setOpenState(!0);break;case r.BACKSPACE:this.isMultipleOrTags&&!o.value&&this.listOfCachedSelectedOption.length&&(e.preventDefault(),this.removeValueFormSelected(this.listOfCachedSelectedOption[this.listOfCachedSelectedOption.length-1]));break;case r.SPACE:this.disabled||this.open||(this.setOpenState(!0),e.preventDefault());break;case r.TAB:this.setOpenState(!1)}}},e.prototype.removeValueFormSelected=function(e){var t=this;if(!this.disabled&&!e.nzDisabled){var n=this.listOfSelectedValue.filter(function(n){return!t.compareWith(n,e.nzValue)});this.updateListOfSelectedValue(n,!0),this.clearInput()}},e.prototype.setOpenState=function(e){this.openRaw$.next(e),this.open=e},e.prototype.check=function(){this.checkRaw$.next()},Object.defineProperty(e.prototype,"isSingleMode",{get:function(){return"default"===this.mode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isTagsMode",{get:function(){return"tags"===this.mode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMultipleMode",{get:function(){return"multiple"===this.mode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isMultipleOrTags",{get:function(){return"tags"===this.mode||"multiple"===this.mode},enumerable:!0,configurable:!0}),e.decorators=[{type:t.Injectable}],e}();var b=function(){function e(e,t,n,i){this.elementRef=e,this.nzSelectService=t,this.cdr=n,this.el=this.elementRef.nativeElement,this.selected=!1,this.active=!1,this.destroy$=new o.Subject,i.addClass(e.nativeElement,"ant-select-dropdown-menu-item")}return e.prototype.clickOption=function(){this.nzSelectService.clickOption(this.nzOption)},e.prototype.ngOnInit=function(){var e=this;this.nzSelectService.listOfSelectedValue$.pipe(i.takeUntil(this.destroy$)).subscribe(function(t){e.selected=n.isNotNil(t.find(function(t){return e.nzSelectService.compareWith(t,e.nzOption.nzValue)})),e.cdr.markForCheck()}),this.nzSelectService.activatedOption$.pipe(i.takeUntil(this.destroy$)).subscribe(function(t){e.active=!!t&&e.nzSelectService.compareWith(t.nzValue,e.nzOption.nzValue),e.cdr.markForCheck()})},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e.decorators=[{type:t.Component,args:[{selector:"[nz-option-li]",exportAs:"nzOptionLi",template:'<ng-container *ngIf="!nzOption.nzCustomContent; else nzOption.template">\n {{nzOption.nzLabel}}\n</ng-container>\n<ng-container *ngIf="nzSelectService.isMultipleOrTags">\n <i nz-icon nzType="check" class="ant-select-selected-icon" *ngIf="!nzMenuItemSelectedIcon; else nzMenuItemSelectedIcon"></i>\n</ng-container>\n',changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,host:{"[class.ant-select-dropdown-menu-item-selected]":"selected && !nzOption.nzDisabled","[class.ant-select-dropdown-menu-item-disabled]":"nzOption.nzDisabled","[class.ant-select-dropdown-menu-item-active]":"active && !nzOption.nzDisabled","[attr.unselectable]":'"unselectable"',"[style.user-select]":'"none"',"(click)":"clickOption()","(mousedown)":"$event.preventDefault()"}}]}],e.ctorParameters=function(){return[{type:t.ElementRef},{type:C},{type:t.ChangeDetectorRef},{type:t.Renderer2}]},e.propDecorators={nzOption:[{type:t.Input}],nzMenuItemSelectedIcon:[{type:t.Input}]},e}();var w=function(){function e(e,n,i){this.nzSelectService=e,this.cdr=n,this.ngZone=i,this.destroy$=new o.Subject,this.lastScrollTop=0,this.nzScrollToBottom=new t.EventEmitter}return e.prototype.scrollIntoViewIfNeeded=function(e){var t=this;setTimeout(function(){if(t.listOfNzOptionLiComponent&&t.listOfNzOptionLiComponent.length&&e){var n=t.listOfNzOptionLiComponent.find(function(n){return t.nzSelectService.compareWith(n.nzOption.nzValue,e.nzValue)});n&&n.el&&n.el.scrollIntoViewIfNeeded&&n.el.scrollIntoViewIfNeeded(!1)}})},e.prototype.trackLabel=function(e,t){return t.nzLabel},e.prototype.trackValue=function(e,t){return t.nzValue},e.prototype.ngOnInit=function(){var e=this;this.nzSelectService.activatedOption$.pipe(i.takeUntil(this.destroy$)).subscribe(function(t){e.scrollIntoViewIfNeeded(t)}),this.nzSelectService.check$.pipe(i.takeUntil(this.destroy$)).subscribe(function(){e.cdr.markForCheck()}),this.ngZone.runOutsideAngular(function(){var t=e.dropdownUl.nativeElement;o.fromEvent(t,"scroll").pipe(i.takeUntil(e.destroy$)).subscribe(function(n){n.preventDefault(),n.stopPropagation(),t&&t.scrollTop>e.lastScrollTop&&t.scrollHeight<t.clientHeight+t.scrollTop+10&&(e.lastScrollTop=t.scrollTop,e.ngZone.run(function(){e.nzScrollToBottom.emit()}))})})},e.prototype.ngAfterViewInit=function(){var e=this;this.listOfNzOptionLiComponent.changes.pipe(i.map(function(e){return e.length}),i.pairwise(),i.filter(function(e){var t=z(e,2),n=t[0];return t[1]<n}),i.takeUntil(this.destroy$)).subscribe(function(){return e.lastScrollTop=0})},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e.decorators=[{type:t.Component,args:[{selector:"[nz-option-container]",exportAs:"nzOptionContainer",changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,preserveWhitespaces:!1,template:'<ul #dropdownUl\n class="ant-select-dropdown-menu ant-select-dropdown-menu-root ant-select-dropdown-menu-vertical"\n role="menu"\n tabindex="0">\n <li *ngIf="nzSelectService.isShowNotFound"\n nz-select-unselectable\n class="ant-select-dropdown-menu-item ant-select-dropdown-menu-item-disabled">\n <nz-embed-empty [nzComponentName]="\'select\'" [specificContent]="nzNotFoundContent"></nz-embed-empty>\n </li>\n <li nz-option-li\n *ngIf="nzSelectService.addedTagOption"\n [nzMenuItemSelectedIcon]="nzMenuItemSelectedIcon"\n [nzOption]="nzSelectService.addedTagOption">\n </li>\n <ng-container *ngFor="let option of nzSelectService.listOfNzOptionComponent | nzFilterOption : nzSelectService.searchValue : nzSelectService.filterOption : nzSelectService.serverSearch; trackBy: trackValue">\n <li nz-option-li\n *ngIf="!option.nzHide"\n [nzMenuItemSelectedIcon]="nzMenuItemSelectedIcon"\n [nzOption]="option">\n </li>\n </ng-container>\n <li class="ant-select-dropdown-menu-item-group"\n *ngFor="let group of nzSelectService.listOfNzOptionGroupComponent | nzFilterGroupOption : nzSelectService.searchValue : nzSelectService.filterOption :nzSelectService.serverSearch; trackBy: trackLabel">\n <div class="ant-select-dropdown-menu-item-group-title"\n [attr.title]="group.isLabelString ? group.nzLabel : \'\'">\n <ng-container *nzStringTemplateOutlet="group.nzLabel"> {{group.nzLabel}} </ng-container>\n </div>\n <ul class="ant-select-dropdown-menu-item-group-list">\n <ng-container *ngFor="let option of group.listOfNzOptionComponent | nzFilterOption : nzSelectService.searchValue : nzSelectService.filterOption :nzSelectService.serverSearch; trackBy: trackValue">\n <li nz-option-li\n *ngIf="!option.nzHide"\n [nzMenuItemSelectedIcon]="nzMenuItemSelectedIcon"\n [nzOption]="option">\n </li>\n </ng-container>\n </ul>\n </li>\n <li nz-option-li\n *ngFor="let option of nzSelectService.listOfTagOption | nzFilterOption : nzSelectService.searchValue : nzSelectService.filterOption : nzSelectService.serverSearch; trackBy: trackValue "\n [nzMenuItemSelectedIcon]="nzMenuItemSelectedIcon"\n [nzOption]="option">\n </li>\n</ul>\n'}]}],e.ctorParameters=function(){return[{type:C},{type:t.ChangeDetectorRef},{type:t.NgZone}]},e.propDecorators={listOfNzOptionLiComponent:[{type:t.ViewChildren,args:[b]}],dropdownUl:[{type:t.ViewChild,args:["dropdownUl",{static:!0}]}],nzNotFoundContent:[{type:t.Input}],nzMenuItemSelectedIcon:[{type:t.Input}],nzScrollToBottom:[{type:t.Output}]},e}();var I=function(){function e(e,t,n,i){this.renderer=e,this.nzSelectService=t,this.cdr=n,this.noAnimation=i,this.isComposing=!1,this.destroy$=new o.Subject,this.nzShowSearch=!1,this.nzOpen=!1,this.nzAllowClear=!1,this.nzShowArrow=!0,this.nzLoading=!1,this.nzTokenSeparators=[]}return e.prototype.onClearSelection=function(e){e.stopPropagation(),this.nzSelectService.updateListOfSelectedValue([],!0)},e.prototype.setInputValue=function(e){this.inputDOM&&!e&&(this.inputDOM.value=e),this.inputValue=e,this.updateWidth(),this.nzSelectService.updateSearchValue(e),this.nzSelectService.tokenSeparate(this.inputValue,this.nzTokenSeparators)},Object.defineProperty(e.prototype,"mirrorDOM",{get:function(){return this.mirrorElement&&this.mirrorElement.nativeElement},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputDOM",{get:function(){return this.inputElement&&this.inputElement.nativeElement},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"placeHolderDisplay",{get:function(){return this.inputValue||this.isComposing||this.nzSelectService.listOfSelectedValue.length?"none":"block"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectedValueStyle",{get:function(){var e=!1,t=1;return this.nzShowSearch&&this.nzOpen?(e=!(this.inputValue||this.isComposing))&&(t=.4):e=!0,{display:e?"block":"none",opacity:""+t}},enumerable:!0,configurable:!0}),e.prototype.trackValue=function(e,t){return t.nzValue},e.prototype.updateWidth=function(){this.mirrorDOM&&this.inputDOM&&this.inputDOM.value?(this.mirrorDOM.innerText=this.inputDOM.value+" ",this.renderer.removeStyle(this.inputDOM,"width"),this.renderer.setStyle(this.inputDOM,"width",this.mirrorDOM.clientWidth+"px")):this.inputDOM&&(this.renderer.removeStyle(this.inputDOM,"width"),this.mirrorDOM.innerText="")},e.prototype.removeSelectedValue=function(e,t){this.nzSelectService.removeValueFormSelected(e),t.stopPropagation()},e.prototype.animationEnd=function(){this.nzSelectService.animationEvent$.next()},e.prototype.ngOnInit=function(){var e=this;this.nzSelectService.open$.pipe(i.takeUntil(this.destroy$)).subscribe(function(t){e.inputElement&&t&&setTimeout(function(){return e.inputDOM.focus()})}),this.nzSelectService.clearInput$.pipe(i.takeUntil(this.destroy$)).subscribe(function(){e.setInputValue("")}),this.nzSelectService.check$.pipe(i.takeUntil(this.destroy$)).subscribe(function(){e.cdr.markForCheck()})},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e.decorators=[{type:t.Component,args:[{selector:"[nz-select-top-control]",exportAs:"nzSelectTopControl",preserveWhitespaces:!1,animations:[n.zoomMotion],changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,template:'<ng-template #inputTemplate>\n <input #inputElement\n autocomplete="something-new"\n class="ant-select-search__field"\n (compositionstart)="isComposing = true"\n (compositionend)="isComposing = false"\n [ngModel]="inputValue"\n (ngModelChange)="setInputValue($event)"\n [disabled]="nzSelectService.disabled">\n <span #mirrorElement class="ant-select-search__field__mirror"></span>\n</ng-template>\n<div class="ant-select-selection__rendered">\n <div *ngIf="nzPlaceHolder"\n nz-select-unselectable\n [style.display]="placeHolderDisplay"\n class="ant-select-selection__placeholder">{{ nzPlaceHolder }}</div>\n \x3c!--single mode--\x3e\n <ng-container *ngIf="nzSelectService.isSingleMode">\n \x3c!--selected label--\x3e\n <div *ngIf="nzSelectService.listOfCachedSelectedOption.length && nzSelectService.listOfSelectedValue.length"\n class="ant-select-selection-selected-value"\n [attr.title]="nzSelectService.listOfCachedSelectedOption[0]?.nzLabel"\n [ngStyle]="selectedValueStyle">\n <ng-container *nzStringTemplateOutlet="nzCustomTemplate; context: { $implicit: nzSelectService.listOfCachedSelectedOption[0] }">\n <ng-container>{{ nzSelectService.listOfCachedSelectedOption[0]?.nzLabel }}</ng-container>\n </ng-container>\n </div>\n \x3c!--show search--\x3e\n <div *ngIf="nzShowSearch"\n class="ant-select-search ant-select-search--inline" [style.display]="nzOpen ? \'block\' : \'none\'">\n <div class="ant-select-search__field__wrap">\n <ng-template [ngTemplateOutlet]="inputTemplate"></ng-template>\n </div>\n </div>\n </ng-container>\n \x3c!--multiple or tags mode--\x3e\n <ul *ngIf="nzSelectService.isMultipleOrTags">\n <ng-container *ngFor="let option of nzSelectService.listOfCachedSelectedOption | slice: 0 : nzMaxTagCount;trackBy:trackValue; let index = index">\n <li [@zoomMotion]\n [@.disabled]="noAnimation?.nzNoAnimation"\n [nzNoAnimation]="noAnimation?.nzNoAnimation"\n [attr.title]="option.nzLabel"\n [class.ant-select-selection__choice__disabled]="option.nzDisabled"\n (@zoomMotion.done)="animationEnd()"\n class="ant-select-selection__choice">\n <ng-container *nzStringTemplateOutlet="nzCustomTemplate; context:{ $implicit: nzSelectService.listOfCachedSelectedOption[index] }">\n <div class="ant-select-selection__choice__content">{{ option.nzLabel }}</div>\n </ng-container>\n <span *ngIf="!option.nzDisabled"\n class="ant-select-selection__choice__remove"\n (mousedown)="$event.preventDefault()"\n (click)="removeSelectedValue(option, $event)">\n <i nz-icon nzType="close" class="ant-select-remove-icon" *ngIf="!nzRemoveIcon; else nzRemoveIcon"></i>\n </span>\n </li>\n </ng-container>\n <li *ngIf="nzSelectService.listOfCachedSelectedOption.length > nzMaxTagCount"\n [@zoomMotion]\n [@.disabled]="noAnimation?.nzNoAnimation"\n [nzNoAnimation]="noAnimation?.nzNoAnimation"\n (@zoomMotion.done)="animationEnd()"\n class="ant-select-selection__choice">\n <div class="ant-select-selection__choice__content">\n <ng-container *ngIf="nzMaxTagPlaceholder">\n <ng-template\n [ngTemplateOutlet]="nzMaxTagPlaceholder"\n [ngTemplateOutletContext]="{ $implicit: nzSelectService.listOfSelectedValue | slice: nzMaxTagCount}">\n </ng-template>\n </ng-container>\n <ng-container *ngIf="!nzMaxTagPlaceholder">\n + {{ nzSelectService.listOfCachedSelectedOption.length - nzMaxTagCount }} ...\n </ng-container>\n </div>\n </li>\n <li class="ant-select-search ant-select-search--inline">\n <ng-template [ngTemplateOutlet]="inputTemplate"></ng-template>\n </li>\n </ul>\n</div>\n<span *ngIf="nzAllowClear && nzSelectService.listOfSelectedValue.length"\n class="ant-select-selection__clear"\n nz-select-unselectable\n (mousedown)="$event.preventDefault()"\n (click)="onClearSelection($event)">\n <i nz-icon nzType="close-circle" nzTheme="fill" *ngIf="!nzClearIcon; else nzClearIcon" class="ant-select-close-icon"></i>\n </span>\n<span class="ant-select-arrow" nz-select-unselectable *ngIf="nzShowArrow">\n <i nz-icon nzType="loading" *ngIf="nzLoading; else defaultArrow"></i>\n <ng-template #defaultArrow>\n <i nz-icon nzType="down" class="ant-select-arrow-icon" *ngIf="!nzSuffixIcon; else nzSuffixIcon"></i>\n </ng-template>\n</span>'}]}],e.ctorParameters=function(){return[{type:t.Renderer2},{type:C},{type:t.ChangeDetectorRef},{type:n.NzNoAnimationDirective,decorators:[{type:t.Host},{type:t.Optional}]}]},e.propDecorators={inputElement:[{type:t.ViewChild,args:["inputElement",{static:!1}]}],mirrorElement:[{type:t.ViewChild,args:["mirrorElement",{static:!1}]}],nzShowSearch:[{type:t.Input}],nzPlaceHolder:[{type:t.Input}],nzOpen:[{type:t.Input}],nzMaxTagCount:[{type:t.Input}],nzAllowClear:[{type:t.Input}],nzShowArrow:[{type:t.Input}],nzLoading:[{type:t.Input}],nzCustomTemplate:[{type:t.Input}],nzSuffixIcon:[{type:t.Input}],nzClearIcon:[{type:t.Input}],nzRemoveIcon:[{type:t.Input}],nzMaxTagPlaceholder:[{type:t.Input}],nzTokenSeparators:[{type:t.Input}]},e}();var T=function(){function e(e,n,i,r,l,a){this.nzSelectService=n,this.cdr=i,this.platform=r,this.noAnimation=a,this.open=!1,this.onChange=function(){return null},this.onTouched=function(){return null},this.dropDownPosition="bottom",this._disabled=!1,this.isInit=!1,this.destroy$=new o.Subject,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.nzSize="default",this.nzDropdownMatchSelectWidth=!0,this.nzAllowClear=!1,this.nzShowSearch=!1,this.nzLoading=!1,this.nzAutoFocus=!1,this.nzShowArrow=!0,this.nzTokenSeparators=[],e.addClass(l.nativeElement,"ant-select")}return Object.defineProperty(e.prototype,"nzAutoClearSearchValue",{set:function(e){this.nzSelectService.autoClearSearchValue=n.toBoolean(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzMaxMultipleCount",{set:function(e){this.nzSelectService.maxMultipleCount=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzServerSearch",{set:function(e){this.nzSelectService.serverSearch=n.toBoolean(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzMode",{set:function(e){this.nzSelectService.mode=e,this.nzSelectService.check()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzFilterOption",{set:function(e){this.nzSelectService.filterOption=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"compareWith",{set:function(e){this.nzSelectService.compareWith=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzOpen",{set:function(e){this.open=e,this.nzSelectService.setOpenState(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabled",{get:function(){return this._disabled},set:function(e){this._disabled=n.toBoolean(e),this.nzSelectService.disabled=this._disabled,this.nzSelectService.check(),this.nzDisabled&&this.isInit&&this.closeDropDown()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzSelectTopControlDOM",{get:function(){return this.nzSelectTopControlElement&&this.nzSelectTopControlElement.nativeElement},enumerable:!0,configurable:!0}),e.prototype.updateAutoFocus=function(){this.nzSelectTopControlDOM&&this.nzAutoFocus&&this.nzSelectTopControlDOM.focus()},e.prototype.focus=function(){this.nzSelectTopControlDOM&&this.nzSelectTopControlDOM.focus()},e.prototype.blur=function(){this.nzSelectTopControlDOM&&this.nzSelectTopControlDOM.blur()},e.prototype.onFocus=function(){this.nzFocus.emit()},e.prototype.onBlur=function(){this.nzBlur.emit()},e.prototype.onKeyDown=function(e){this.nzSelectService.onKeyDown(e)},e.prototype.toggleDropDown=function(){this.nzDisabled||this.nzSelectService.setOpenState(!this.open)},e.prototype.closeDropDown=function(){this.nzSelectService.setOpenState(!1)},e.prototype.onPositionChange=function(e){this.dropDownPosition=e.connectionPair.originY},e.prototype.updateCdkConnectedOverlayStatus=function(){this.platform.isBrowser&&(this.triggerWidth=this.cdkOverlayOrigin.elementRef.nativeElement.getBoundingClientRect().width)},e.prototype.updateCdkConnectedOverlayPositions=function(){var e=this;setTimeout(function(){e.cdkConnectedOverlay&&e.cdkConnectedOverlay.overlayRef&&e.cdkConnectedOverlay.overlayRef.updatePosition()})},e.prototype.writeValue=function(e){this.value=e;var t=[];n.isNotNil(e)&&(t=this.nzSelectService.isMultipleOrTags?e:[e]),this.nzSelectService.updateListOfSelectedValue(t,!1),this.cdr.markForCheck()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.setDisabledState=function(e){this.nzDisabled=e,this.cdr.markForCheck()},e.prototype.ngOnInit=function(){var e=this;this.nzSelectService.animationEvent$.pipe(i.takeUntil(this.destroy$)).subscribe(function(){return e.updateCdkConnectedOverlayPositions()}),this.nzSelectService.searchValue$.pipe(i.takeUntil(this.destroy$)).subscribe(function(t){e.nzOnSearch.emit(t),e.updateCdkConnectedOverlayPositions()}),this.nzSelectService.modelChange$.pipe(i.takeUntil(this.destroy$)).subscribe(function(t){e.value!==t&&(e.value=t,e.onChange(e.value))}),this.nzSelectService.open$.pipe(i.takeUntil(this.destroy$)).subscribe(function(t){e.open!==t&&e.nzOpenChange.emit(t),t?(e.focus(),e.updateCdkConnectedOverlayStatus()):(e.blur(),e.onTouched()),e.open=t,e.nzSelectService.clearInput()}),this.nzSelectService.check$.pipe(i.takeUntil(this.destroy$)).subscribe(function(){e.cdr.markForCheck()})},e.prototype.ngAfterViewInit=function(){this.updateCdkConnectedOverlayStatus(),this.updateAutoFocus(),this.isInit=!0},e.prototype.ngAfterContentInit=function(){var e=this;this.listOfNzOptionGroupComponent.changes.pipe(i.startWith(!0),i.flatMap(function(){return o.merge.apply(void 0,m([e.listOfNzOptionGroupComponent.changes,e.listOfNzOptionComponent.changes],e.listOfNzOptionComponent.map(function(e){return e.changes}),e.listOfNzOptionGroupComponent.map(function(e){return e.listOfNzOptionComponent?e.listOfNzOptionComponent.changes:o.EMPTY}))).pipe(i.startWith(!0))})).subscribe(function(){e.nzSelectService.updateTemplateOption(e.listOfNzOptionComponent.toArray(),e.listOfNzOptionGroupComponent.toArray())})},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},e.decorators=[{type:t.Component,args:[{selector:"nz-select",exportAs:"nzSelect",preserveWhitespaces:!1,providers:[C,{provide:c.NG_VALUE_ACCESSOR,useExisting:t.forwardRef(function(){return e}),multi:!0}],changeDetection:t.ChangeDetectionStrategy.OnPush,encapsulation:t.ViewEncapsulation.None,animations:[n.slideMotion],template:'<div cdkOverlayOrigin\n nz-select-top-control\n tabindex="0"\n class="ant-select-selection"\n [nzOpen]="open"\n [@.disabled]="noAnimation?.nzNoAnimation"\n [nzNoAnimation]="noAnimation?.nzNoAnimation"\n [nzMaxTagPlaceholder]="nzMaxTagPlaceholder"\n [nzPlaceHolder]="nzPlaceHolder"\n [nzAllowClear]="nzAllowClear"\n [nzMaxTagCount]="nzMaxTagCount"\n [nzShowArrow]="nzShowArrow"\n [nzLoading]="nzLoading"\n [nzCustomTemplate]="nzCustomTemplate"\n [nzSuffixIcon]="nzSuffixIcon"\n [nzClearIcon]="nzClearIcon"\n [nzRemoveIcon]="nzRemoveIcon"\n [nzShowSearch]="nzShowSearch"\n [nzTokenSeparators]="nzTokenSeparators"\n [class.ant-select-selection--single]="nzSelectService.isSingleMode"\n [class.ant-select-selection--multiple]="nzSelectService.isMultipleOrTags"\n (focus)="onFocus()"\n (blur)="onBlur()"\n (keydown)="onKeyDown($event)">\n</div>\n<ng-template\n cdkConnectedOverlay\n nzConnectedOverlay\n [cdkConnectedOverlayHasBackdrop]="true"\n [cdkConnectedOverlayMinWidth]="nzDropdownMatchSelectWidth? null : triggerWidth"\n [cdkConnectedOverlayWidth]="nzDropdownMatchSelectWidth? triggerWidth : null"\n [cdkConnectedOverlayOrigin]="cdkOverlayOrigin"\n (backdropClick)="closeDropDown()"\n (detach)="closeDropDown();"\n (positionChange)="onPositionChange($event)"\n [cdkConnectedOverlayOpen]="open">\n <div\n class="ant-select-dropdown"\n [class.ant-select-dropdown--single]="nzSelectService.isSingleMode"\n [class.ant-select-dropdown--multiple]="nzSelectService.isMultipleOrTags"\n [class.ant-select-dropdown-placement-bottomLeft]="dropDownPosition === \'bottom\'"\n [class.ant-select-dropdown-placement-topLeft]="dropDownPosition === \'top\'"\n [nzClassListAdd]="[nzDropdownClassName]"\n [@slideMotion]="dropDownPosition"\n [@.disabled]="noAnimation?.nzNoAnimation"\n [nzNoAnimation]="noAnimation?.nzNoAnimation"\n [ngStyle]="nzDropdownStyle">\n <div nz-option-container\n style="overflow: auto;transform: translateZ(0px);"\n (keydown)="onKeyDown($event)"\n [nzMenuItemSelectedIcon]="nzMenuItemSelectedIcon"\n [nzNotFoundContent]="nzNotFoundContent"\n (nzScrollToBottom)="nzScrollToBottom.emit()">\n </div>\n <ng-template [ngTemplateOutlet]="nzDropdownRender"></ng-template>\n </div>\n</ng-template>\n\x3c!--can not use ViewChild since it will match sub options in option group --\x3e\n<ng-template>\n <ng-content></ng-content>\n</ng-template>',host:{"[class.ant-select-lg]":'nzSize==="large"',"[class.ant-select-sm]":'nzSize==="small"',"[class.ant-select-enabled]":"!nzDisabled","[class.ant-select-no-arrow]":"!nzShowArrow","[class.ant-select-disabled]":"nzDisabled","[class.ant-select-allow-clear]":"nzAllowClear","[class.ant-select-open]":"open","(click)":"toggleDropDown()"},styles:["\n .ant-select-dropdown {\n top: 100%;\n left: 0;\n position: relative;\n width: 100%;\n margin-top: 4px;\n margin-bottom: 4px;\n }\n "]}]}],e.ctorParameters=function(){return[{type:t.Renderer2},{type:C},{type:t.ChangeDetectorRef},{type:a.Platform},{type:t.ElementRef},{type:n.NzNoAnimationDirective,decorators:[{type:t.Host},{type:t.Optional}]}]},e.propDecorators={cdkOverlayOrigin:[{type:t.ViewChild,args:[l.CdkOverlayOrigin,{static:!1}]}],cdkConnectedOverlay:[{type:t.ViewChild,args:[l.CdkConnectedOverlay,{static:!1}]}],nzSelectTopControlComponent:[{type:t.ViewChild,args:[I,{static:!0}]}],nzSelectTopControlElement:[{type:t.ViewChild,args:[I,{static:!0,read:t.ElementRef}]}],listOfNzOptionComponent:[{type:t.ContentChildren,args:[O]}],listOfNzOptionGroupComponent:[{type:t.ContentChildren,args:[S]}],nzOnSearch:[{type:t.Output}],nzScrollToBottom:[{type:t.Output}],nzOpenChange:[{type:t.Output}],nzBlur:[{type:t.Output}],nzFocus:[{type:t.Output}],nzSize:[{type:t.Input}],nzDropdownClassName:[{type:t.Input}],nzDropdownMatchSelectWidth:[{type:t.Input}],nzDropdownStyle:[{type:t.Input}],nzNotFoundContent:[{type:t.Input}],nzAllowClear:[{type:t.Input}],nzShowSearch:[{type:t.Input}],nzLoading:[{type:t.Input}],nzAutoFocus:[{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}],nzAutoClearSearchValue:[{type:t.Input}],nzMaxMultipleCount:[{type:t.Input}],nzServerSearch:[{type:t.Input}],nzMode:[{type:t.Input}],nzFilterOption:[{type:t.Input}],compareWith:[{type:t.Input}],nzOpen:[{type:t.Input}],nzDisabled:[{type:t.Input}]},h([n.InputBoolean(),f("design:type",Object)],e.prototype,"nzAllowClear",void 0),h([n.InputBoolean(),f("design:type",Object)],e.prototype,"nzShowSearch",void 0),h([n.InputBoolean(),f("design:type",Object)],e.prototype,"nzLoading",void 0),h([n.InputBoolean(),f("design:type",Object)],e.prototype,"nzAutoFocus",void 0),e}();var V=function(){function e(){}return e.decorators=[{type:t.Directive,args:[{selector:"[nz-select-unselectable]",exportAs:"nzSelectUnselectable",host:{"[attr.unselectable]":'"unselectable"',"[style.user-select]":'"none"'}}]}],e}(),k=function(){function e(){}return e.decorators=[{type:t.NgModule,args:[{imports:[s.CommonModule,u.NzI18nModule,c.FormsModule,a.PlatformModule,l.OverlayModule,d.NzIconModule,n.NzAddOnModule,p.NzEmptyModule,n.NzOverlayModule,n.NzNoAnimationModule],declarations:[y,g,O,T,w,S,b,I,V],exports:[O,T,w,S,I]}]}],e}();e.NzFilterGroupOptionPipe=y,e.NzFilterOptionPipe=g,e.NzOptionComponent=O,e.NzOptionContainerComponent=w,e.NzOptionGroupComponent=S,e.NzOptionLiComponent=b,e.NzSelectComponent=T,e.NzSelectModule=k,e.NzSelectService=C,e.NzSelectTopControlComponent=I,e.NzSelectUnselectableDirective=V,e.defaultFilterOption=v,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-select.umd.min.js.map