ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
24 lines (22 loc) • 29.5 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/keycodes"),require("@angular/cdk/overlay"),require("@angular/core"),require("@angular/forms"),require("ng-zorro-antd/core/animation"),require("ng-zorro-antd/core/config"),require("ng-zorro-antd/core/no-animation"),require("ng-zorro-antd/core/overlay"),require("ng-zorro-antd/core/util"),require("rxjs"),require("rxjs/operators"),require("ng-zorro-antd/i18n"),require("@angular/common"),require("ng-zorro-antd/core/highlight"),require("ng-zorro-antd/core/outlet"),require("ng-zorro-antd/empty"),require("ng-zorro-antd/icon"),require("ng-zorro-antd/input")):"function"==typeof define&&define.amd?define("ng-zorro-antd/cascader",["exports","@angular/cdk/keycodes","@angular/cdk/overlay","@angular/core","@angular/forms","ng-zorro-antd/core/animation","ng-zorro-antd/core/config","ng-zorro-antd/core/no-animation","ng-zorro-antd/core/overlay","ng-zorro-antd/core/util","rxjs","rxjs/operators","ng-zorro-antd/i18n","@angular/common","ng-zorro-antd/core/highlight","ng-zorro-antd/core/outlet","ng-zorro-antd/empty","ng-zorro-antd/icon","ng-zorro-antd/input"],t):t(((e=e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].cascader={}),e.ng.cdk.keycodes,e.ng.cdk.overlay,e.ng.core,e.ng.forms,e["ng-zorro-antd"].core.animation,e["ng-zorro-antd"].core.config,e["ng-zorro-antd"].core["no-animation"],e["ng-zorro-antd"].core.overlay,e["ng-zorro-antd"].core.util,e.rxjs,e.rxjs.operators,e["ng-zorro-antd"].i18n,e.ng.common,e["ng-zorro-antd"].core.highlight,e["ng-zorro-antd"].core.outlet,e["ng-zorro-antd"].empty,e["ng-zorro-antd"].icon,e["ng-zorro-antd"].input)}(this,(function(e,t,n,i,o,r,a,s,c,l,p,u,d,h,g,y,m,f,v){"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 z(e,t,n,i){var o,r=arguments.length,a=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(r<3?o(a):r>3?o(t,n,a):o(t,n))||a);return r>3&&a&&Object.defineProperty(t,n,a),a}function S(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function O(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,r=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function b(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(O(arguments[t]));return e}function C(e){return"boolean"!=typeof 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
*/
function w(e){return e.isLeaf||!e.children||!e.children.length}function T(e){return!!e.children&&!!e.children.length&&!e.isLeaf}var M=function(){function e(e,t,n){this.cdr=e,this.optionTemplate=null,this.activated=!1,this.nzLabelProperty="label",n.addClass(t.nativeElement,"ant-cascader-menu-item")}return Object.defineProperty(e.prototype,"optionLabel",{get:function(){return this.option[this.nzLabelProperty]},enumerable:!0,configurable:!0}),e.prototype.markForCheck=function(){this.cdr.markForCheck()},e.decorators=[{type:i.Component,args:[{changeDetection:i.ChangeDetectionStrategy.OnPush,encapsulation:i.ViewEncapsulation.None,selector:"[nz-cascader-option]",exportAs:"nzCascaderOption",template:'\n <ng-container *ngIf="optionTemplate; else defaultOptionTemplate">\n <ng-template [ngTemplateOutlet]="optionTemplate" [ngTemplateOutletContext]="{ $implicit: option, index: columnIndex }"></ng-template>\n </ng-container>\n <ng-template #defaultOptionTemplate>\n <span [innerHTML]="optionLabel | nzHighlight: highlightText:\'g\':\'ant-cascader-menu-item-keyword\'"></span>\n </ng-template>\n <span *ngIf="!option.isLeaf || option.children?.length || option.loading" class="ant-cascader-menu-item-expand-icon">\n <i nz-icon [nzType]="option.loading ? \'loading\' : \'right\'"></i>\n </span>\n ',host:{"[attr.title]":"option.title || optionLabel","[class.ant-cascader-menu-item-active]":"activated","[class.ant-cascader-menu-item-expand]":"!option.isLeaf","[class.ant-cascader-menu-item-disabled]":"option.disabled"}}]}],e.ctorParameters=function(){return[{type:i.ChangeDetectorRef},{type:i.ElementRef},{type:i.Renderer2}]},e.propDecorators={optionTemplate:[{type:i.Input}],option:[{type:i.Input}],activated:[{type:i.Input}],highlightText:[{type:i.Input}],nzLabelProperty:[{type:i.Input}],columnIndex:[{type:i.Input}]},e}();var A=function(){function e(){this.activatedOptions=[],this.columns=[],this.inSearchingMode=!1,this.selectedOptions=[],this.values=[],this.$loading=new p.BehaviorSubject(!1),this.$redraw=new p.Subject,this.$optionSelected=new p.Subject,this.$quitSearching=new p.Subject,this.columnsSnapshot=[[]],this.activatedOptionsSnapshot=[]}return Object.defineProperty(e.prototype,"nzOptions",{get:function(){return this.columns[0]},enumerable:!0,configurable:!0}),e.prototype.ngOnDestroy=function(){this.$redraw.complete(),this.$quitSearching.complete(),this.$optionSelected.complete(),this.$loading.complete()},e.prototype.syncOptions=function(e){var t=this;void 0===e&&(e=!1);var n=this.values,i=n&&n.length,o=n.length-1,r=function(e){var i=function(){var i,a=n[e];if(l.isNotNil(a)){var s=t.findOptionWithValue(e,n[e])||("object"==typeof a?a:((i={})[""+t.cascaderComponent.nzValueProperty]=a,i[""+t.cascaderComponent.nzLabelProperty]=a,i));t.setOptionActivated(s,e,!1,!1),e<o?r(e+1):(t.dropBehindColumns(e),t.selectedOptions=b(t.activatedOptions),t.$redraw.next())}else t.$redraw.next()};if(t.isLoaded(e)||!t.cascaderComponent.nzLoadData)i();else{var a=t.activatedOptions[e-1]||{};t.loadChildren(a,e-1,i)}};this.activatedOptions=[],this.selectedOptions=[],e&&this.cascaderComponent.nzLoadData&&!i?this.$redraw.next():r(0)},e.prototype.withComponent=function(e){this.cascaderComponent=e},e.prototype.withOptions=function(e){this.columnsSnapshot=this.columns=e&&e.length?[e]:[],this.inSearchingMode?this.prepareSearchOptions(this.cascaderComponent.inputValue):this.columns.length&&this.syncOptions()},e.prototype.setOptionActivated=function(e,t,n,i){(void 0===n&&(n=!1),void 0===i&&(i=!0),e.disabled)||(this.activatedOptions[t]=e,this.trackAncestorActivatedOptions(t),this.dropBehindActivatedOptions(t),T(e)?this.setColumnData(e.children,t+1,e):!e.isLeaf&&i?this.loadChildren(e,t):e.isLeaf&&this.dropBehindColumns(t),n&&this.setOptionSelected(e,t),this.$redraw.next())},e.prototype.setOptionSelected=function(e,t){var n,i,o=this.cascaderComponent.nzChangeOn;(e.isLeaf||this.cascaderComponent.nzChangeOnSelect||(n=e,i=t,"function"==typeof o&&o(n,i)))&&(this.selectedOptions=b(this.activatedOptions),this.prepareEmitValue(),this.$redraw.next(),this.$optionSelected.next({option:e,index:t}))},e.prototype.setOptionDeactivatedSinceColumn=function(e){this.dropBehindActivatedOptions(e-1),this.dropBehindColumns(e),this.$redraw.next()},e.prototype.setSearchOptionSelected=function(e){var t=this;this.activatedOptions=[e],this.selectedOptions=b(e.path),this.prepareEmitValue(),this.$redraw.next(),this.$optionSelected.next({option:e,index:0}),setTimeout((function(){t.$quitSearching.next(),t.$redraw.next(),t.inSearchingMode=!1,t.columns=b(t.columnsSnapshot),t.activatedOptions=b(t.selectedOptions)}),200)},e.prototype.prepareSearchOptions=function(e){var t=this,n=[],i=[],o=this.cascaderComponent.nzShowSearch,r=C(o)&&o.filter?o.filter:function(e,n){return n.some((function(n){var i=t.getOptionLabel(n);return!!i&&-1!==i.indexOf(e)}))},a=C(o)&&o.sorter?o.sorter:null,s=function(o,a){var s;void 0===a&&(a=!1),i.push(o);var c=Array.from(i);if(r(e,c)){var l=((s={disabled:a||o.disabled,isLeaf:!0,path:c})[t.cascaderComponent.nzLabelProperty]=c.map((function(e){return t.getOptionLabel(e)})).join(" / "),s);n.push(l)}i.pop()},c=function(e,t){void 0===t&&(t=!1);var n=t||e.disabled;i.push(e),e.children.forEach((function(t){t.parent||(t.parent=e),t.isLeaf||c(t,n),!t.isLeaf&&t.children&&t.children.length||s(t,n)})),i.pop()};this.columnsSnapshot.length?(this.columnsSnapshot[0].forEach((function(e){return w(e)?s(e):c(e)})),a&&n.sort((function(t,n){return a(t.path,n.path,e)})),this.columns=[n],this.$redraw.next()):this.columns=[[]]},e.prototype.toggleSearchingMode=function(e){this.inSearchingMode=e,e?(this.activatedOptionsSnapshot=b(this.activatedOptions),this.activatedOptions=[],this.selectedOptions=[],this.$redraw.next()):(this.activatedOptions=b(this.activatedOptionsSnapshot),this.selectedOptions=b(this.activatedOptions),this.columns=b(this.columnsSnapshot),this.syncOptions(),this.$redraw.next())},e.prototype.clear=function(){this.values=[],this.selectedOptions=[],this.activatedOptions=[],this.dropBehindColumns(0),this.prepareEmitValue(),this.$redraw.next(),this.$optionSelected.next(null)},e.prototype.getOptionLabel=function(e){return e[this.cascaderComponent.nzLabelProperty||"label"]},e.prototype.getOptionValue=function(e){return e[this.cascaderComponent.nzValueProperty||"value"]},e.prototype.setColumnData=function(e,t,n){var i=this.columns[t];l.arraysEqual(i,e)||(e.forEach((function(e){return e.parent=n})),this.columns[t]=e,this.dropBehindColumns(t))},e.prototype.trackAncestorActivatedOptions=function(e){for(var t=e-1;t>=0;t--)this.activatedOptions[t]||(this.activatedOptions[t]=this.activatedOptions[t+1].parent)},e.prototype.dropBehindActivatedOptions=function(e){this.activatedOptions=this.activatedOptions.splice(0,e+1)},e.prototype.dropBehindColumns=function(e){e<this.columns.length-1&&(this.columns=this.columns.slice(0,e+1))},e.prototype.loadChildren=function(e,t,n,i){var o=this,r=this.cascaderComponent.nzLoadData;r&&(this.$loading.next(t<0),"object"==typeof e&&(e.loading=!0),r(e,t).then((function(){e.loading=!1,e.children&&o.setColumnData(e.children,t+1,e),n&&n(),o.$loading.next(!1),o.$redraw.next()}),(function(){e.loading=!1,e.isLeaf=!0,i&&i(),o.$redraw.next()})))},e.prototype.isLoaded=function(e){return this.columns[e]&&this.columns[e].length>0},e.prototype.findOptionWithValue=function(e,t){var n=this,i=this.columns[e];if(i){var o="object"==typeof t?this.getOptionValue(t):t;return i.find((function(e){return o===n.getOptionValue(e)}))}return null},e.prototype.prepareEmitValue=function(){var e=this;this.values=this.selectedOptions.map((function(t){return e.getOptionValue(t)}))},e.decorators=[{type:i.Injectable}],e}();var D=function(e){return e.join(" / ")},I=function(){function e(e,t,n,o,r,a,s){this.cascaderService=e,this.i18nService=t,this.nzConfigService=n,this.cdr=o,this.noAnimation=s,this.nzOptionRender=null,this.nzShowInput=!0,this.nzShowArrow=!0,this.nzAllowClear=!0,this.nzAutoFocus=!1,this.nzChangeOnSelect=!1,this.nzDisabled=!1,this.nzExpandTrigger="click",this.nzValueProperty="value",this.nzLabelProperty="label",this.nzMouseEnterDelay=150,this.nzMouseLeaveDelay=150,this.nzTriggerAction=["click"],this.nzVisibleChange=new i.EventEmitter,this.nzSelectionChange=new i.EventEmitter,this.nzSelect=new i.EventEmitter,this.nzClear=new i.EventEmitter,this.shouldShowEmpty=!1,this.dropDownPosition="bottom",this.menuVisible=!1,this.isLoading=!1,this.labelRenderContext={},this.onChange=Function.prototype,this.onTouched=Function.prototype,this.positions=b(c.DEFAULT_CASCADER_POSITIONS),this.dropdownHeightStyle="",this.isFocused=!1,this.destroy$=new p.Subject,this.inputString="",this.isOpening=!1,this.el=r.nativeElement,this.cascaderService.withComponent(this),a.addClass(r.nativeElement,"ant-cascader"),a.addClass(r.nativeElement,"ant-cascader-picker")}return Object.defineProperty(e.prototype,"nzOptions",{get:function(){return this.cascaderService.nzOptions},set:function(e){this.cascaderService.withOptions(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inSearchingMode",{get:function(){return this.cascaderService.inSearchingMode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputValue",{get:function(){return this.inputString},set:function(e){this.inputString=e,this.toggleSearchingMode(!!e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"menuCls",{get:function(){var e;return(e={})[""+this.nzMenuClassName]=!!this.nzMenuClassName,e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"menuColumnCls",{get:function(){var e;return(e={})[""+this.nzColumnClassName]=!!this.nzColumnClassName,e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasInput",{get:function(){return!!this.inputValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasValue",{get:function(){return this.cascaderService.values&&this.cascaderService.values.length>0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"showPlaceholder",{get:function(){return!(this.hasInput||this.hasValue)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"clearIconVisible",{get:function(){return this.nzAllowClear&&!this.nzDisabled&&(this.hasValue||this.hasInput)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLabelRenderTemplate",{get:function(){return!!this.nzLabelRender},enumerable:!0,configurable:!0}),e.prototype.ngOnInit=function(){var e=this,t=this.cascaderService;t.$redraw.pipe(u.takeUntil(this.destroy$)).subscribe((function(){e.checkChildren(),e.setDisplayLabel(),e.reposition(),e.setDropdownStyles(),e.cdr.markForCheck()})),t.$loading.pipe(u.takeUntil(this.destroy$)).subscribe((function(t){e.isLoading=t})),t.$optionSelected.pipe(u.takeUntil(this.destroy$)).subscribe((function(t){if(t){var n=t.option,i=t.index;n.isLeaf&&e.delaySetMenuVisible(!1),e.onChange(e.cascaderService.values),e.nzSelectionChange.emit(e.cascaderService.selectedOptions),e.nzSelect.emit({option:n,index:i}),e.cdr.markForCheck()}else e.onChange([]),e.nzSelect.emit(null),e.nzSelectionChange.emit([])})),t.$quitSearching.pipe(u.takeUntil(this.destroy$)).subscribe((function(){e.inputString="",e.dropdownWidthStyle=""})),this.i18nService.localeChange.pipe(u.startWith(),u.takeUntil(this.destroy$)).subscribe((function(){e.setLocale()})),this.nzConfigService.getConfigChangeEventForComponent("cascader").pipe(u.takeUntil(this.destroy$)).subscribe((function(){e.cdr.markForCheck()}))},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete(),this.clearDelayMenuTimer(),this.clearDelaySelectTimer()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouched=e},e.prototype.writeValue=function(e){this.cascaderService.values=l.toArray(e),this.cascaderService.syncOptions(!0)},e.prototype.delaySetMenuVisible=function(e,t,n){var i=this;void 0===t&&(t=100),void 0===n&&(n=!1),this.clearDelayMenuTimer(),t?(e&&n&&(this.isOpening=!0),this.delayMenuTimer=setTimeout((function(){i.setMenuVisible(e),i.cdr.detectChanges(),i.clearDelayMenuTimer(),e&&setTimeout((function(){i.isOpening=!1}),100)}),t)):this.setMenuVisible(e)},e.prototype.setMenuVisible=function(e){this.nzDisabled||this.menuVisible===e||(e&&this.cascaderService.syncOptions(),this.menuVisible=e,this.nzVisibleChange.emit(e),this.cdr.detectChanges())},e.prototype.clearDelayMenuTimer=function(){this.delayMenuTimer&&(clearTimeout(this.delayMenuTimer),this.delayMenuTimer=null)},e.prototype.clearSelection=function(e){e&&(e.preventDefault(),e.stopPropagation()),this.labelRenderText="",this.labelRenderContext={},this.inputValue="",this.setMenuVisible(!1),this.cascaderService.clear()},e.prototype.getSubmitValue=function(){var e=this;return this.cascaderService.selectedOptions.map((function(t){return e.cascaderService.getOptionValue(t)}))},e.prototype.focus=function(){this.isFocused||((this.input?this.input.nativeElement:this.el).focus(),this.isFocused=!0)},e.prototype.blur=function(){this.isFocused&&((this.input?this.input.nativeElement:this.el).blur(),this.isFocused=!1)},e.prototype.handleInputBlur=function(){this.menuVisible?this.focus():this.blur()},e.prototype.handleInputFocus=function(){this.focus()},e.prototype.onKeyDown=function(e){var n=e.keyCode;if(n===t.DOWN_ARROW||n===t.UP_ARROW||n===t.LEFT_ARROW||n===t.RIGHT_ARROW||n===t.ENTER||n===t.BACKSPACE||n===t.ESCAPE)return this.menuVisible||n===t.BACKSPACE||n===t.ESCAPE?void((!this.inSearchingMode||n!==t.BACKSPACE&&n!==t.LEFT_ARROW&&n!==t.RIGHT_ARROW)&&this.menuVisible&&(e.preventDefault(),n===t.DOWN_ARROW?this.moveUpOrDown(!1):n===t.UP_ARROW?this.moveUpOrDown(!0):n===t.LEFT_ARROW?this.moveLeft():n===t.RIGHT_ARROW?this.moveRight():n===t.ENTER&&this.onEnter())):this.setMenuVisible(!0)},e.prototype.onTriggerClick=function(){this.nzDisabled||(this.nzShowSearch&&this.focus(),this.isActionTrigger("click")&&this.delaySetMenuVisible(!this.menuVisible,100),this.onTouched())},e.prototype.onTriggerMouseEnter=function(){!this.nzDisabled&&this.isActionTrigger("hover")&&this.delaySetMenuVisible(!0,this.nzMouseEnterDelay,!0)},e.prototype.onTriggerMouseLeave=function(e){if(!this.nzDisabled&&this.menuVisible&&!this.isOpening&&this.isActionTrigger("hover")){var t=e.relatedTarget,n=this.el,i=this.menu&&this.menu.nativeElement;n.contains(t)||i&&i.contains(t)||this.delaySetMenuVisible(!1,this.nzMouseLeaveDelay)}else e.preventDefault()},e.prototype.onOptionMouseEnter=function(e,t,n){n.preventDefault(),"hover"===this.nzExpandTrigger&&(e.isLeaf?this.cascaderService.setOptionDeactivatedSinceColumn(t):this.delaySetOptionActivated(e,t,!1))},e.prototype.onOptionMouseLeave=function(e,t,n){n.preventDefault(),"hover"!==this.nzExpandTrigger||e.isLeaf||this.clearDelaySelectTimer()},e.prototype.onOptionClick=function(e,t,n){n&&n.preventDefault(),e&&e.disabled||(this.el.focus(),this.inSearchingMode?this.cascaderService.setSearchOptionSelected(e):this.cascaderService.setOptionActivated(e,t,!0))},e.prototype.isActionTrigger=function(e){return"string"==typeof this.nzTriggerAction?this.nzTriggerAction===e:-1!==this.nzTriggerAction.indexOf(e)},e.prototype.onEnter=function(){var e=Math.max(this.cascaderService.activatedOptions.length-1,0),t=this.cascaderService.activatedOptions[e];t&&!t.disabled&&(this.inSearchingMode?this.cascaderService.setSearchOptionSelected(t):this.cascaderService.setOptionActivated(t,e,!0))},e.prototype.moveUpOrDown=function(e){var t=Math.max(this.cascaderService.activatedOptions.length-1,0),n=this.cascaderService.activatedOptions[t],i=this.cascaderService.columns[t]||[],o=i.length,r=-1;for(r=n?i.indexOf(n):e?o:-1;!((r=e?r-1:r+1)<0||r>=o);){var a=i[r];if(a&&!a.disabled){this.cascaderService.setOptionActivated(a,t);break}}},e.prototype.moveLeft=function(){var e=this.cascaderService.activatedOptions;e.length&&e.pop()},e.prototype.moveRight=function(){var e=this.cascaderService.activatedOptions.length,t=this.cascaderService.columns[e];if(t&&t.length){var n=t.find((function(e){return!e.disabled}));n&&this.cascaderService.setOptionActivated(n,e)}},e.prototype.clearDelaySelectTimer=function(){this.delaySelectTimer&&(clearTimeout(this.delaySelectTimer),this.delaySelectTimer=null)},e.prototype.delaySetOptionActivated=function(e,t,n){var i=this;this.clearDelaySelectTimer(),this.delaySelectTimer=setTimeout((function(){i.cascaderService.setOptionActivated(e,t,n),i.delaySelectTimer=null}),150)},e.prototype.toggleSearchingMode=function(e){this.inSearchingMode!==e&&this.cascaderService.toggleSearchingMode(e),this.inSearchingMode&&this.cascaderService.prepareSearchOptions(this.inputValue)},e.prototype.isOptionActivated=function(e,t){return this.cascaderService.activatedOptions[t]===e},e.prototype.setDisabledState=function(e){e&&this.closeMenu(),this.nzDisabled=e},e.prototype.closeMenu=function(){this.blur(),this.clearDelayMenuTimer(),this.setMenuVisible(!1)},e.prototype.onPositionChange=function(e){var t="bottom"===e.connectionPair.originY?"bottom":"top";this.dropDownPosition!==t&&(this.dropDownPosition=t,this.cdr.detectChanges())},e.prototype.reposition=function(){var e=this;this.overlay&&this.overlay.overlayRef&&this.menuVisible&&Promise.resolve().then((function(){e.overlay.overlayRef.updatePosition()}))},e.prototype.checkChildren=function(){this.cascaderItems&&this.cascaderItems.forEach((function(e){return e.markForCheck()}))},e.prototype.setDisplayLabel=function(){var e=this,t=this.cascaderService.selectedOptions,n=t.map((function(t){return e.cascaderService.getOptionLabel(t)}));this.isLabelRenderTemplate?this.labelRenderContext={labels:n,selectedOptions:t}:this.labelRenderText=D.call(this,n,t)},e.prototype.setDropdownStyles=function(){var e=this.cascaderService.columns[0];this.shouldShowEmpty=this.inSearchingMode&&(!e||!e.length)||!(this.nzOptions&&this.nzOptions.length)&&!this.nzLoadData,this.dropdownHeightStyle=this.shouldShowEmpty?"auto":"",this.input&&(this.dropdownWidthStyle=this.inSearchingMode||this.shouldShowEmpty?this.input.nativeElement.offsetWidth+"px":"")},e.prototype.setLocale=function(){this.locale=this.i18nService.getLocaleData("global"),this.cdr.markForCheck()},e.decorators=[{type:i.Component,args:[{changeDetection:i.ChangeDetectionStrategy.OnPush,encapsulation:i.ViewEncapsulation.None,selector:"nz-cascader, [nz-cascader]",exportAs:"nzCascader",preserveWhitespaces:!1,template:'\n <div cdkOverlayOrigin #origin="cdkOverlayOrigin" #trigger>\n <div *ngIf="nzShowInput">\n <input\n #input\n nz-input\n class="ant-cascader-input"\n [class.ant-cascader-input-disabled]="nzDisabled"\n [class.ant-cascader-input-lg]="nzSize === \'large\'"\n [class.ant-cascader-input-sm]="nzSize === \'small\'"\n [attr.autoComplete]="\'off\'"\n [attr.placeholder]="showPlaceholder ? nzPlaceHolder || locale?.placeholder : null"\n [attr.autofocus]="nzAutoFocus ? \'autofocus\' : null"\n [readonly]="!nzShowSearch"\n [disabled]="nzDisabled"\n [nzSize]="nzSize"\n [(ngModel)]="inputValue"\n (blur)="handleInputBlur()"\n (focus)="handleInputFocus()"\n (change)="$event.stopPropagation()"\n />\n <i\n *ngIf="clearIconVisible"\n nz-icon\n nzType="close-circle"\n nzTheme="fill"\n class="ant-cascader-picker-clear"\n (click)="clearSelection($event)"\n ></i>\n <i\n *ngIf="nzShowArrow && !isLoading"\n nz-icon\n nzType="down"\n class="ant-cascader-picker-arrow"\n [class.ant-cascader-picker-arrow-expand]="menuVisible"\n >\n </i>\n <i *ngIf="isLoading" nz-icon nzType="loading" class="ant-cascader-picker-arrow"></i>\n <span\n class="ant-cascader-picker-label"\n [class.ant-cascader-show-search]="!!nzShowSearch"\n [class.ant-focusd]="!!nzShowSearch && isFocused && !inputValue"\n >\n <ng-container *ngIf="!isLabelRenderTemplate; else labelTemplate">{{ labelRenderText }}</ng-container>\n <ng-template #labelTemplate>\n <ng-template [ngTemplateOutlet]="nzLabelRender" [ngTemplateOutletContext]="labelRenderContext"></ng-template>\n </ng-template>\n </span>\n </div>\n <ng-content></ng-content>\n </div>\n <ng-template\n cdkConnectedOverlay\n nzConnectedOverlay\n cdkConnectedOverlayHasBackdrop\n [cdkConnectedOverlayOrigin]="origin"\n [cdkConnectedOverlayPositions]="positions"\n (backdropClick)="closeMenu()"\n (detach)="closeMenu()"\n (positionChange)="onPositionChange($event)"\n [cdkConnectedOverlayOpen]="menuVisible"\n >\n <div\n #menu\n class="ant-cascader-menus"\n [class.ant-cascader-menus-hidden]="!menuVisible"\n [ngClass]="menuCls"\n [ngStyle]="nzMenuStyle"\n [@.disabled]="noAnimation?.nzNoAnimation"\n [nzNoAnimation]="noAnimation?.nzNoAnimation"\n [@slideMotion]="dropDownPosition"\n (mouseleave)="onTriggerMouseLeave($event)"\n >\n <ul\n *ngIf="shouldShowEmpty; else hasOptionsTemplate"\n class="ant-cascader-menu"\n [style.width]="dropdownWidthStyle"\n [style.height]="dropdownHeightStyle"\n >\n <li class="ant-cascader-menu-item ant-cascader-menu-item-expanded ant-cascader-menu-item-disabled">\n <nz-embed-empty [nzComponentName]="\'cascader\'" [specificContent]="nzNotFoundContent"></nz-embed-empty>\n </li>\n </ul>\n <ng-template #hasOptionsTemplate>\n <ul\n *ngFor="let options of cascaderService.columns; let i = index"\n class="ant-cascader-menu"\n [ngClass]="menuColumnCls"\n [style.height]="dropdownHeightStyle"\n [style.width]="dropdownWidthStyle"\n >\n <li\n nz-cascader-option\n *ngFor="let option of options"\n [columnIndex]="i"\n [nzLabelProperty]="nzLabelProperty"\n [optionTemplate]="nzOptionRender"\n [activated]="isOptionActivated(option, i)"\n [highlightText]="inSearchingMode ? inputValue : \'\'"\n [option]="option"\n (mouseenter)="onOptionMouseEnter(option, i, $event)"\n (mouseleave)="onOptionMouseLeave(option, i, $event)"\n (click)="onOptionClick(option, i, $event)"\n ></li>\n </ul>\n </ng-template>\n </div>\n </ng-template>\n ',animations:[r.slideMotion],providers:[{provide:o.NG_VALUE_ACCESSOR,useExisting:i.forwardRef((function(){return e})),multi:!0},A],host:{"[attr.tabIndex]":'"0"',"[class.ant-cascader-lg]":'nzSize === "large"',"[class.ant-cascader-sm]":'nzSize === "small"',"[class.ant-cascader-picker-disabled]":"nzDisabled","[class.ant-cascader-picker-open]":"menuVisible","[class.ant-cascader-picker-with-value]":"!!inputValue","[class.ant-cascader-focused]":"isFocused"}}]}],e.ctorParameters=function(){return[{type:A},{type:d.NzI18nService},{type:a.NzConfigService},{type:i.ChangeDetectorRef},{type:i.ElementRef},{type:i.Renderer2},{type:s.NzNoAnimationDirective,decorators:[{type:i.Host},{type:i.Optional}]}]},e.propDecorators={input:[{type:i.ViewChild,args:["input",{static:!1}]}],menu:[{type:i.ViewChild,args:["menu",{static:!1}]}],overlay:[{type:i.ViewChild,args:[n.CdkConnectedOverlay,{static:!1}]}],cascaderItems:[{type:i.ViewChildren,args:[M]}],nzOptionRender:[{type:i.Input}],nzShowInput:[{type:i.Input}],nzShowArrow:[{type:i.Input}],nzAllowClear:[{type:i.Input}],nzAutoFocus:[{type:i.Input}],nzChangeOnSelect:[{type:i.Input}],nzDisabled:[{type:i.Input}],nzColumnClassName:[{type:i.Input}],nzExpandTrigger:[{type:i.Input}],nzValueProperty:[{type:i.Input}],nzLabelRender:[{type:i.Input}],nzLabelProperty:[{type:i.Input}],nzNotFoundContent:[{type:i.Input}],nzSize:[{type:i.Input}],nzShowSearch:[{type:i.Input}],nzPlaceHolder:[{type:i.Input}],nzMenuClassName:[{type:i.Input}],nzMenuStyle:[{type:i.Input}],nzMouseEnterDelay:[{type:i.Input}],nzMouseLeaveDelay:[{type:i.Input}],nzTriggerAction:[{type:i.Input}],nzChangeOn:[{type:i.Input}],nzLoadData:[{type:i.Input}],nzOptions:[{type:i.Input}],nzVisibleChange:[{type:i.Output}],nzSelectionChange:[{type:i.Output}],nzSelect:[{type:i.Output}],nzClear:[{type:i.Output}],onKeyDown:[{type:i.HostListener,args:["keydown",["$event"]]}],onTriggerClick:[{type:i.HostListener,args:["click"]}],onTriggerMouseEnter:[{type:i.HostListener,args:["mouseenter"]}],onTriggerMouseLeave:[{type:i.HostListener,args:["mouseleave",["$event"]]}]},z([l.InputBoolean(),S("design:type",Object)],e.prototype,"nzShowInput",void 0),z([l.InputBoolean(),S("design:type",Object)],e.prototype,"nzShowArrow",void 0),z([l.InputBoolean(),S("design:type",Object)],e.prototype,"nzAllowClear",void 0),z([l.InputBoolean(),S("design:type",Object)],e.prototype,"nzAutoFocus",void 0),z([l.InputBoolean(),S("design:type",Object)],e.prototype,"nzChangeOnSelect",void 0),z([l.InputBoolean(),S("design:type",Object)],e.prototype,"nzDisabled",void 0),z([a.WithConfig("cascader","default"),S("design:type",String)],e.prototype,"nzSize",void 0),e}();var L=function(){function e(){}return e.decorators=[{type:i.NgModule,args:[{imports:[h.CommonModule,o.FormsModule,n.OverlayModule,y.NzOutletModule,m.NzEmptyModule,g.NzHighlightModule,f.NzIconModule,v.NzInputModule,s.NzNoAnimationModule,c.NzOverlayModule],declarations:[I,M],exports:[I]}]}],e}();e.NzCascaderComponent=I,e.NzCascaderModule=L,e.NzCascaderOptionComponent=M,e.NzCascaderService=A,e.isChildOption=w,e.isParentOption=T,e.isShowSearchObject=C,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-cascader.umd.min.js.map