ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 31 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/bidi"),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("ng-zorro-antd/i18n"),require("rxjs"),require("rxjs/operators"),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/bidi","@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","ng-zorro-antd/i18n","rxjs","rxjs/operators","@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="undefined"!=typeof globalThis?globalThis:e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"].cascader={}),e.ng.cdk.bidi,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["ng-zorro-antd"].i18n,e.rxjs,e.rxjs.operators,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,d,u,h,g,y,m,f,v,z){"use strict";function S(e){return"boolean"!=typeof e}function O(e){return e.isLeaf||!e.children||!e.children.length}function b(e){return!!e.children&&!!e.children.length&&!e.isLeaf}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function C(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 T(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create;function w(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 I(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(w(arguments[t]));return e}Object.create;var x=function(){function e(e,t,n){this.cdr=e,this.optionTemplate=null,this.activated=!1,this.nzLabelProperty="label",this.expandIcon="",this.dir="ltr",n.addClass(t.nativeElement,"ant-cascader-menu-item"),this.nativeElement=t.nativeElement}return e.prototype.ngOnInit=function(){""===this.expandIcon&&"rtl"===this.dir?this.expandIcon="left":""===this.expandIcon&&(this.expandIcon="right")},Object.defineProperty(e.prototype,"optionLabel",{get:function(){return this.option[this.nzLabelProperty]},enumerable:!1,configurable:!0}),e.prototype.markForCheck=function(){this.cdr.markForCheck()},e}();x.decorators=[{type:o.Component,args:[{changeDetection:o.ChangeDetectionStrategy.OnPush,encapsulation:o.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 *ngIf="option.loading; else icon" nz-icon nzType="loading"></i>\n <ng-template #icon>\n <ng-container *nzStringTemplateOutlet="expandIcon">\n <i nz-icon [nzType]="$any(expandIcon)"></i>\n </ng-container>\n </ng-template>\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"}}]}],x.ctorParameters=function(){return[{type:o.ChangeDetectorRef},{type:o.ElementRef},{type:o.Renderer2}]},x.propDecorators={optionTemplate:[{type:o.Input}],option:[{type:o.Input}],activated:[{type:o.Input}],highlightText:[{type:o.Input}],nzLabelProperty:[{type:o.Input}],columnIndex:[{type:o.Input}],expandIcon:[{type:o.Input}],dir:[{type:o.Input}]};var M=function(){function e(){this.activatedOptions=[],this.columns=[],this.inSearchingMode=!1,this.selectedOptions=[],this.values=[],this.$loading=new u.BehaviorSubject(!1),this.$redraw=new u.Subject,this.$optionSelected=new u.Subject,this.$quitSearching=new u.Subject,this.columnsSnapshot=[[]],this.activatedOptionsSnapshot=[]}return Object.defineProperty(e.prototype,"nzOptions",{get:function(){return this.columns[0]},enumerable:!1,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(p.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=I(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),b(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=I(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=I(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=I(t.columnsSnapshot),t.activatedOptions=I(t.selectedOptions)}),200)},e.prototype.prepareSearchOptions=function(e){var t=this,n=[],i=[],o=this.cascaderComponent.nzShowSearch,r=S(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=S(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 O(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=I(this.activatedOptions),this.activatedOptions=[],this.selectedOptions=[],this.$redraw.next()):(this.activatedOptions=I(this.activatedOptionsSnapshot),this.selectedOptions=I(this.activatedOptions),this.columns=I(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];p.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}();M.decorators=[{type:o.Injectable}];var A="cascader",E=function(e){return e.join(" / ")},k=E,L=function(){function e(e,t,n,i,r,a,s,c){this.cascaderService=e,this.nzConfigService=t,this.cdr=n,this.i18nService=i,this.directionality=s,this.noAnimation=c,this._nzModuleName=A,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.nzLabelRender=null,this.nzLabelProperty="label",this.nzSize="default",this.nzShowSearch=!1,this.nzPlaceHolder="",this.nzMenuStyle=null,this.nzMouseEnterDelay=150,this.nzMouseLeaveDelay=150,this.nzTriggerAction=["click"],this.nzSuffixIcon="down",this.nzExpandIcon="",this.nzVisibleChange=new o.EventEmitter,this.nzSelectionChange=new o.EventEmitter,this.nzSelect=new o.EventEmitter,this.nzClear=new o.EventEmitter,this.shouldShowEmpty=!1,this.menuVisible=!1,this.isLoading=!1,this.labelRenderContext={},this.onChange=Function.prototype,this.onTouched=Function.prototype,this.positions=I(l.DEFAULT_CASCADER_POSITIONS),this.dropdownHeightStyle="",this.isFocused=!1,this.dir="ltr",this.destroy$=new u.Subject,this.inputString="",this.isOpening=!1,this.delayMenuTimer=null,this.delaySelectTimer=null,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:!1,configurable:!0}),Object.defineProperty(e.prototype,"inSearchingMode",{get:function(){return this.cascaderService.inSearchingMode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inputValue",{get:function(){return this.inputString},set:function(e){this.inputString=e,this.toggleSearchingMode(!!e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"menuCls",{get:function(){var e;return(e={})[""+this.nzMenuClassName]=!!this.nzMenuClassName,e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"menuColumnCls",{get:function(){var e;return(e={})[""+this.nzColumnClassName]=!!this.nzColumnClassName,e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasInput",{get:function(){return!!this.inputValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasValue",{get:function(){return this.cascaderService.values&&this.cascaderService.values.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"showPlaceholder",{get:function(){return!(this.hasInput||this.hasValue)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearIconVisible",{get:function(){return this.nzAllowClear&&!this.nzDisabled&&(this.hasValue||this.hasInput)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLabelRenderTemplate",{get:function(){return!!this.nzLabelRender},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){var e,t=this,n=this.cascaderService;n.$redraw.pipe(h.takeUntil(this.destroy$)).subscribe((function(){t.checkChildren(),t.setDisplayLabel(),t.reposition(),t.setDropdownStyles(),t.cdr.markForCheck()})),n.$loading.pipe(h.takeUntil(this.destroy$)).subscribe((function(e){t.isLoading=e})),n.$optionSelected.pipe(h.takeUntil(this.destroy$)).subscribe((function(e){if(e){var n=e.option,i=e.index;(n.isLeaf||t.nzChangeOnSelect&&"hover"===t.nzExpandTrigger)&&t.delaySetMenuVisible(!1),t.onChange(t.cascaderService.values),t.nzSelectionChange.emit(t.cascaderService.selectedOptions),t.nzSelect.emit({option:n,index:i}),t.cdr.markForCheck()}else t.onChange([]),t.nzSelect.emit(null),t.nzSelectionChange.emit([])})),n.$quitSearching.pipe(h.takeUntil(this.destroy$)).subscribe((function(){t.inputString="",t.dropdownWidthStyle=""})),this.i18nService.localeChange.pipe(h.startWith(),h.takeUntil(this.destroy$)).subscribe((function(){t.setLocale()})),this.nzConfigService.getConfigChangeEventForComponent(A).pipe(h.takeUntil(this.destroy$)).subscribe((function(){t.cdr.markForCheck()})),this.dir=this.directionality.value,null===(e=this.directionality.change)||void 0===e||e.pipe(h.takeUntil(this.destroy$)).subscribe((function(){t.dir=t.directionality.value,n.$redraw.next()}))},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=p.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.scrollToActivatedOptions()),e||(this.inputValue=""),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 t=e.keyCode;if(t===n.DOWN_ARROW||t===n.UP_ARROW||t===n.LEFT_ARROW||t===n.RIGHT_ARROW||t===n.ENTER||t===n.BACKSPACE||t===n.ESCAPE)return this.menuVisible||t===n.BACKSPACE||t===n.ESCAPE?void((!this.inSearchingMode||t!==n.BACKSPACE&&t!==n.LEFT_ARROW&&t!==n.RIGHT_ARROW)&&this.menuVisible&&(e.preventDefault(),t===n.DOWN_ARROW?this.moveUpOrDown(!1):t===n.UP_ARROW?this.moveUpOrDown(!0):t===n.LEFT_ARROW?this.moveLeft():t===n.RIGHT_ARROW?this.moveRight():t===n.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.onClickOutside=function(e){this.el.contains(e.target)||this.closeMenu()},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.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=E.call(this,n)},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.prototype.scrollToActivatedOptions=function(){var e=this;Promise.resolve().then((function(){e.cascaderItems.toArray().filter((function(e){return e.activated})).forEach((function(e){var t;null===(t=e.nativeElement)||void 0===t||t.scrollIntoView({block:"start",inline:"nearest"})}))}))},e}();L.decorators=[{type:o.Component,args:[{changeDetection:o.ChangeDetectionStrategy.OnPush,encapsulation:o.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 <ng-container *nzStringTemplateOutlet="nzSuffixIcon">\n <i\n *ngIf="nzShowArrow && !isLoading"\n nz-icon\n [nzType]="$any(nzSuffixIcon)"\n class="ant-cascader-picker-arrow"\n [class.ant-cascader-picker-arrow-expand]="menuVisible"\n ></i>\n </ng-container>\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-picker-show-search]="!!nzShowSearch"\n [class.ant-cascader-picker-focused]="!!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 [cdkConnectedOverlayOrigin]="origin"\n [cdkConnectedOverlayPositions]="positions"\n [cdkConnectedOverlayTransformOriginOn]="\'.ant-cascader-menus\'"\n [cdkConnectedOverlayOpen]="menuVisible"\n (overlayOutsideClick)="onClickOutside($event)"\n (detach)="closeMenu()"\n >\n <div\n #menu\n class="ant-cascader-menus"\n [class.ant-cascader-menu-rtl]="dir === \'rtl\'"\n [class.ant-cascader-menus-hidden]="!menuVisible"\n [ngClass]="menuCls"\n [ngStyle]="nzMenuStyle"\n [@.disabled]="noAnimation?.nzNoAnimation"\n [nzNoAnimation]="noAnimation?.nzNoAnimation"\n [@slideMotion]="\'enter\'"\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 [expandIcon]="nzExpandIcon"\n [columnIndex]="i"\n [nzLabelProperty]="nzLabelProperty"\n [optionTemplate]="nzOptionRender"\n [activated]="isOptionActivated(option, i)"\n [highlightText]="inSearchingMode ? inputValue : \'\'"\n [option]="option"\n [dir]="dir"\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:[a.slideMotion],providers:[{provide:r.NG_VALUE_ACCESSOR,useExisting:o.forwardRef((function(){return L})),multi:!0},M],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","[class.ant-cascader-picker-rtl]":"dir ==='rtl'"}}]}],L.ctorParameters=function(){return[{type:M},{type:s.NzConfigService},{type:o.ChangeDetectorRef},{type:d.NzI18nService},{type:o.ElementRef},{type:o.Renderer2},{type:t.Directionality,decorators:[{type:o.Optional}]},{type:c.NzNoAnimationDirective,decorators:[{type:o.Host},{type:o.Optional}]}]},L.propDecorators={input:[{type:o.ViewChild,args:["input",{static:!1}]}],menu:[{type:o.ViewChild,args:["menu",{static:!1}]}],overlay:[{type:o.ViewChild,args:[i.CdkConnectedOverlay,{static:!1}]}],cascaderItems:[{type:o.ViewChildren,args:[x]}],nzOptionRender:[{type:o.Input}],nzShowInput:[{type:o.Input}],nzShowArrow:[{type:o.Input}],nzAllowClear:[{type:o.Input}],nzAutoFocus:[{type:o.Input}],nzChangeOnSelect:[{type:o.Input}],nzDisabled:[{type:o.Input}],nzColumnClassName:[{type:o.Input}],nzExpandTrigger:[{type:o.Input}],nzValueProperty:[{type:o.Input}],nzLabelRender:[{type:o.Input}],nzLabelProperty:[{type:o.Input}],nzNotFoundContent:[{type:o.Input}],nzSize:[{type:o.Input}],nzShowSearch:[{type:o.Input}],nzPlaceHolder:[{type:o.Input}],nzMenuClassName:[{type:o.Input}],nzMenuStyle:[{type:o.Input}],nzMouseEnterDelay:[{type:o.Input}],nzMouseLeaveDelay:[{type:o.Input}],nzTriggerAction:[{type:o.Input}],nzChangeOn:[{type:o.Input}],nzLoadData:[{type:o.Input}],nzSuffixIcon:[{type:o.Input}],nzExpandIcon:[{type:o.Input}],nzOptions:[{type:o.Input}],nzVisibleChange:[{type:o.Output}],nzSelectionChange:[{type:o.Output}],nzSelect:[{type:o.Output}],nzClear:[{type:o.Output}],onKeyDown:[{type:o.HostListener,args:["keydown",["$event"]]}],onTriggerClick:[{type:o.HostListener,args:["click"]}],onTriggerMouseEnter:[{type:o.HostListener,args:["mouseenter"]}],onTriggerMouseLeave:[{type:o.HostListener,args:["mouseleave",["$event"]]}]},C([p.InputBoolean(),T("design:type",Object)],L.prototype,"nzShowInput",void 0),C([p.InputBoolean(),T("design:type",Object)],L.prototype,"nzShowArrow",void 0),C([p.InputBoolean(),T("design:type",Object)],L.prototype,"nzAllowClear",void 0),C([p.InputBoolean(),T("design:type",Object)],L.prototype,"nzAutoFocus",void 0),C([p.InputBoolean(),T("design:type",Object)],L.prototype,"nzChangeOnSelect",void 0),C([p.InputBoolean(),T("design:type",Object)],L.prototype,"nzDisabled",void 0),C([s.WithConfig(),T("design:type",String)],L.prototype,"nzSize",void 0);var D=function(){};D.decorators=[{type:o.NgModule,args:[{imports:[t.BidiModule,g.CommonModule,r.FormsModule,i.OverlayModule,m.NzOutletModule,f.NzEmptyModule,y.NzHighlightModule,v.NzIconModule,z.NzInputModule,c.NzNoAnimationModule,l.NzOverlayModule],declarations:[L,x],exports:[L]}]}],e.NzCascaderComponent=L,e.NzCascaderModule=D,e.NzCascaderOptionComponent=x,e.NzCascaderService=M,e.isChildOption=O,e.isParentOption=b,e.isShowSearchObject=S,e.ɵ0=k,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-cascader.umd.min.js.map