ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 29.1 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/overlay"),require("@angular/cdk/platform"),require("@angular/core"),require("@angular/forms"),require("date-fns"),require("ng-zorro-antd/core/animation"),require("ng-zorro-antd/core/config"),require("ng-zorro-antd/core/logger"),require("ng-zorro-antd/core/util"),require("ng-zorro-antd/i18n"),require("@angular/common"),require("ng-zorro-antd/button"),require("ng-zorro-antd/core/outlet"),require("ng-zorro-antd/core/overlay"),require("ng-zorro-antd/icon"),require("ng-zorro-antd/core/polyfill"),require("rxjs"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("ng-zorro-antd/time-picker",["exports","@angular/cdk/overlay","@angular/cdk/platform","@angular/core","@angular/forms","date-fns","ng-zorro-antd/core/animation","ng-zorro-antd/core/config","ng-zorro-antd/core/logger","ng-zorro-antd/core/util","ng-zorro-antd/i18n","@angular/common","ng-zorro-antd/button","ng-zorro-antd/core/outlet","ng-zorro-antd/core/overlay","ng-zorro-antd/icon","ng-zorro-antd/core/polyfill","rxjs","rxjs/operators"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"]["time-picker"]={}),e.ng.cdk.overlay,e.ng.cdk.platform,e.ng.core,e.ng.forms,e.dateFns,e["ng-zorro-antd"].core.animation,e["ng-zorro-antd"].core.config,e["ng-zorro-antd"].core.logger,e["ng-zorro-antd"].core.util,e["ng-zorro-antd"].i18n,e.ng.common,e["ng-zorro-antd"].button,e["ng-zorro-antd"].core.outlet,e["ng-zorro-antd"].core.overlay,e["ng-zorro-antd"].icon,e["ng-zorro-antd"].core.polyfill,e.rxjs,e.rxjs.operators)}(this,(function(e,t,n,i,o,s,r,l,u,a,c,p,d,h,f,m,g,z,y){"use strict";
/*! *****************************************************************************
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 b(e,t,n,i){var o,s=arguments.length,r=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,n,i);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(r=(s<3?o(r):s>3?o(t,n,r):o(t,n))||r);return s>3&&r&&Object.defineProperty(t,n,r),r}function v(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create;function H(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,o,s=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)r.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(o)throw o.error}}return r}Object.create;var S=function(){function e(e,t,n,o,s,r){this.nzConfigService=e,this.element=t,this.renderer=n,this.cdr=o,this.dateHelper=s,this.platform=r,this._nzModuleName="timePicker",this.isInit=!1,this.focused=!1,this.inputValue="",this.value=null,this.preValue=null,this.overlayPositions=[{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top",offsetY:3}],this.nzSize=null,this.nzHourStep=1,this.nzMinuteStep=1,this.nzSecondStep=1,this.nzClearText="clear",this.nzPopupClassName="",this.nzPlaceHolder="",this.nzFormat="HH:mm:ss",this.nzOpen=!1,this.nzUse12Hours=!1,this.nzSuffixIcon="clock-circle",this.nzOpenChange=new i.EventEmitter,this.nzHideDisabledOptions=!1,this.nzAllowEmpty=!0,this.nzDisabled=!1,this.nzAutoFocus=!1}return e.prototype.emitValue=function(e){this.setValue(e,!0),this._onChange&&this._onChange(this.value),this._onTouched&&this._onTouched()},e.prototype.setValue=function(e,t){void 0===t&&(t=!1),t&&(this.preValue=s.isValid(e)?new Date(e):null),this.value=s.isValid(e)?new Date(e):null,this.inputValue=this.dateHelper.format(e,this.nzFormat),this.cdr.markForCheck()},e.prototype.open=function(){this.nzDisabled||this.nzOpen||(this.focus(),this.nzOpen=!0,this.nzOpenChange.emit(this.nzOpen))},e.prototype.close=function(){this.nzOpen=!1,this.cdr.markForCheck(),this.nzOpenChange.emit(this.nzOpen)},e.prototype.updateAutoFocus=function(){this.isInit&&!this.nzDisabled&&(this.nzAutoFocus?this.renderer.setAttribute(this.inputRef.nativeElement,"autofocus","autofocus"):this.renderer.removeAttribute(this.inputRef.nativeElement,"autofocus"))},e.prototype.onClickClearBtn=function(e){e.stopPropagation(),this.emitValue(null)},e.prototype.onClickOutside=function(e){this.element.nativeElement.contains(e.target)||this.setCurrentValueAndClose()},e.prototype.onFocus=function(e){this.focused=e},e.prototype.focus=function(){this.inputRef.nativeElement&&this.inputRef.nativeElement.focus()},e.prototype.blur=function(){this.inputRef.nativeElement&&this.inputRef.nativeElement.blur()},e.prototype.onKeyupEsc=function(){this.setValue(this.preValue)},e.prototype.onKeyupEnter=function(){this.nzOpen&&s.isValid(this.value)?this.setCurrentValueAndClose():this.nzOpen||this.open()},e.prototype.onInputChange=function(e){this.platform.TRIDENT||document.activeElement!==this.inputRef.nativeElement||(this.open(),this.parseTimeString(e))},e.prototype.onPanelValueChange=function(e){this.setValue(e),this.focus()},e.prototype.setCurrentValueAndClose=function(){this.emitValue(this.value),this.close()},e.prototype.ngOnInit=function(){this.inputSize=Math.max(8,this.nzFormat.length)+2,this.origin=new t.CdkOverlayOrigin(this.element)},e.prototype.ngOnChanges=function(e){var t=e.nzUse12Hours,n=e.nzFormat,i=e.nzDisabled,o=e.nzAutoFocus;if(t&&!t.previousValue&&t.currentValue&&!n&&(this.nzFormat="h:mm:ss a"),i){var s=i.currentValue,r=this.inputRef.nativeElement;s?this.renderer.setAttribute(r,"disabled",""):this.renderer.removeAttribute(r,"disabled")}o&&this.updateAutoFocus()},e.prototype.parseTimeString=function(e){var t=this.dateHelper.parseTime(e,this.nzFormat)||null;s.isValid(t)&&(this.value=t,this.cdr.markForCheck())},e.prototype.ngAfterViewInit=function(){this.isInit=!0,this.updateAutoFocus()},e.prototype.writeValue=function(e){var t;e instanceof Date?t=e:a.isNil(e)?t=null:(u.warn('Non-Date type is not recommended for time-picker, use "Date" type.'),t=new Date(e)),this.setValue(t,!0)},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}();S.decorators=[{type:i.Component,args:[{encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush,selector:"nz-time-picker",exportAs:"nzTimePicker",template:'\n <div class="ant-picker-input">\n <input\n #inputElement\n type="text"\n [size]="inputSize"\n [placeholder]="nzPlaceHolder || (\'TimePicker.placeholder\' | nzI18n)"\n [(ngModel)]="inputValue"\n [disabled]="nzDisabled"\n (focus)="onFocus(true)"\n (blur)="onFocus(false)"\n (keyup.enter)="onKeyupEnter()"\n (keyup.escape)="onKeyupEsc()"\n (ngModelChange)="onInputChange($event)"\n />\n <span class="ant-picker-suffix">\n <ng-container *nzStringTemplateOutlet="nzSuffixIcon; let suffixIcon">\n <i nz-icon [nzType]="suffixIcon"></i>\n </ng-container>\n </span>\n <span *ngIf="nzAllowEmpty && !nzDisabled && value" class="ant-picker-clear" (click)="onClickClearBtn($event)">\n <i nz-icon nzType="close-circle" nzTheme="fill" [attr.aria-label]="nzClearText" [attr.title]="nzClearText"></i>\n </span>\n </div>\n\n <ng-template\n cdkConnectedOverlay\n nzConnectedOverlay\n [cdkConnectedOverlayPositions]="overlayPositions"\n [cdkConnectedOverlayOrigin]="origin"\n [cdkConnectedOverlayOpen]="nzOpen"\n [cdkConnectedOverlayOffsetY]="-2"\n [cdkConnectedOverlayTransformOriginOn]="\'.ant-picker-dropdown\'"\n (detach)="close()"\n (overlayOutsideClick)="onClickOutside($event)"\n >\n <div [@slideMotion]="\'enter\'" class="ant-picker-dropdown">\n <div class="ant-picker-panel-container">\n <div tabindex="-1" class="ant-picker-panel">\n <nz-time-picker-panel\n [ngClass]="nzPopupClassName"\n [format]="nzFormat"\n [nzHourStep]="nzHourStep"\n [nzMinuteStep]="nzMinuteStep"\n [nzSecondStep]="nzSecondStep"\n [nzDisabledHours]="nzDisabledHours"\n [nzDisabledMinutes]="nzDisabledMinutes"\n [nzDisabledSeconds]="nzDisabledSeconds"\n [nzPlaceHolder]="nzPlaceHolder || (\'TimePicker.placeholder\' | nzI18n)"\n [nzHideDisabledOptions]="nzHideDisabledOptions"\n [nzUse12Hours]="nzUse12Hours"\n [nzDefaultOpenValue]="nzDefaultOpenValue"\n [nzAddOn]="nzAddOn"\n [nzClearText]="nzClearText"\n [nzAllowEmpty]="nzAllowEmpty"\n [(ngModel)]="value"\n (ngModelChange)="onPanelValueChange($event)"\n (closePanel)="setCurrentValueAndClose()"\n ></nz-time-picker-panel>\n </div>\n </div>\n </div>\n </ng-template>\n ',host:{"[class.ant-picker]":"true","[class.ant-picker-large]":"nzSize === 'large'","[class.ant-picker-small]":"nzSize === 'small'","[class.ant-picker-disabled]":"nzDisabled","[class.ant-picker-focused]":"focused","(click)":"open()"},animations:[r.slideMotion],providers:[{provide:o.NG_VALUE_ACCESSOR,useExisting:S,multi:!0}]}]}],S.ctorParameters=function(){return[{type:l.NzConfigService},{type:i.ElementRef},{type:i.Renderer2},{type:i.ChangeDetectorRef},{type:c.DateHelperService},{type:n.Platform}]},S.propDecorators={inputRef:[{type:i.ViewChild,args:["inputElement",{static:!0}]}],nzSize:[{type:i.Input}],nzHourStep:[{type:i.Input}],nzMinuteStep:[{type:i.Input}],nzSecondStep:[{type:i.Input}],nzClearText:[{type:i.Input}],nzPopupClassName:[{type:i.Input}],nzPlaceHolder:[{type:i.Input}],nzAddOn:[{type:i.Input}],nzDefaultOpenValue:[{type:i.Input}],nzDisabledHours:[{type:i.Input}],nzDisabledMinutes:[{type:i.Input}],nzDisabledSeconds:[{type:i.Input}],nzFormat:[{type:i.Input}],nzOpen:[{type:i.Input}],nzUse12Hours:[{type:i.Input}],nzSuffixIcon:[{type:i.Input}],nzOpenChange:[{type:i.Output}],nzHideDisabledOptions:[{type:i.Input}],nzAllowEmpty:[{type:i.Input}],nzDisabled:[{type:i.Input}],nzAutoFocus:[{type:i.Input}]},b([l.WithConfig(),v("design:type",Number)],S.prototype,"nzHourStep",void 0),b([l.WithConfig(),v("design:type",Number)],S.prototype,"nzMinuteStep",void 0),b([l.WithConfig(),v("design:type",Number)],S.prototype,"nzSecondStep",void 0),b([l.WithConfig(),v("design:type",String)],S.prototype,"nzClearText",void 0),b([l.WithConfig(),v("design:type",String)],S.prototype,"nzPopupClassName",void 0),b([l.WithConfig(),v("design:type",String)],S.prototype,"nzFormat",void 0),b([l.WithConfig(),a.InputBoolean(),v("design:type",Boolean)],S.prototype,"nzUse12Hours",void 0),b([l.WithConfig(),v("design:type",Object)],S.prototype,"nzSuffixIcon",void 0),b([a.InputBoolean(),v("design:type",Object)],S.prototype,"nzHideDisabledOptions",void 0),b([l.WithConfig(),a.InputBoolean(),v("design:type",Boolean)],S.prototype,"nzAllowEmpty",void 0),b([a.InputBoolean(),v("design:type",Object)],S.prototype,"nzDisabled",void 0),b([a.InputBoolean(),v("design:type",Object)],S.prototype,"nzAutoFocus",void 0);var k=function(){function e(){this.selected12Hours=void 0,this._use12Hours=!1,this._changes=new z.Subject}return e.prototype.setMinutes=function(e,t){return e===this.minutes||t||(this.initValue(),this.value.setMinutes(e),this.update()),this},e.prototype.setHours=function(e,t){return e===this.hours||t||(this.initValue(),this._use12Hours?"PM"===this.selected12Hours&&12!==e?this.value.setHours(e+12):"AM"===this.selected12Hours&&12===e?this.value.setHours(0):this.value.setHours(e):this.value.setHours(e),this.update()),this},e.prototype.setSeconds=function(e,t){return e===this.seconds||t||(this.initValue(),this.value.setSeconds(e),this.update()),this},e.prototype.setUse12Hours=function(e){return this._use12Hours=e,this},Object.defineProperty(e.prototype,"changes",{get:function(){return this._changes.asObservable()},enumerable:!1,configurable:!0}),e.prototype.setValue=function(e,t){return a.isNotNil(t)&&(this._use12Hours=t),e!==this.value&&(this._value=e,a.isNotNil(this.value)?this._use12Hours&&a.isNotNil(this.hours)&&(this.selected12Hours=this.hours>=12?"PM":"AM"):this._clear()),this},e.prototype.initValue=function(){a.isNil(this.value)&&this.setValue(new Date,this._use12Hours)},e.prototype.clear=function(){this._clear(),this.update()},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return!(a.isNotNil(this.hours)||a.isNotNil(this.minutes)||a.isNotNil(this.seconds))},enumerable:!1,configurable:!0}),e.prototype._clear=function(){this._value=void 0,this.selected12Hours=void 0},e.prototype.update=function(){this.isEmpty?this._value=void 0:(a.isNotNil(this.hours)&&this.value.setHours(this.hours),a.isNotNil(this.minutes)&&this.value.setMinutes(this.minutes),a.isNotNil(this.seconds)&&this.value.setSeconds(this.seconds),this._use12Hours&&("PM"===this.selected12Hours&&this.hours<12&&this.value.setHours(this.hours+12),"AM"===this.selected12Hours&&this.hours>=12&&this.value.setHours(this.hours-12))),this.changed()},e.prototype.changed=function(){this._changes.next(this.value)},Object.defineProperty(e.prototype,"viewHours",{get:function(){return this._use12Hours&&a.isNotNil(this.hours)?this.calculateViewHour(this.hours):this.hours},enumerable:!1,configurable:!0}),e.prototype.setSelected12Hours=function(e){e.toUpperCase()!==this.selected12Hours&&(this.selected12Hours=e.toUpperCase(),this.update())},Object.defineProperty(e.prototype,"value",{get:function(){return this._value||this._defaultOpenValue},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hours",{get:function(){var e;return null===(e=this.value)||void 0===e?void 0:e.getHours()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"minutes",{get:function(){var e;return null===(e=this.value)||void 0===e?void 0:e.getMinutes()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seconds",{get:function(){var e;return null===(e=this.value)||void 0===e?void 0:e.getSeconds()},enumerable:!1,configurable:!0}),e.prototype.setDefaultOpenValue=function(e){return this._defaultOpenValue=e,this},e.prototype.calculateViewHour=function(e){var t=this.selected12Hours;return"PM"===t&&e>12?e-12:"AM"===t&&0===e?12:e},e}();function O(e,t,n){return void 0===t&&(t=1),void 0===n&&(n=0),new Array(Math.ceil(e/t)).fill(0).map((function(e,i){return(i+n)*t}))}var C=function(){function e(e,t){this.cdr=e,this.dateHelper=t,this._nzHourStep=1,this._nzMinuteStep=1,this._nzSecondStep=1,this.unsubscribe$=new z.Subject,this._format="HH:mm:ss",this._disabledHours=function(){return[]},this._disabledMinutes=function(){return[]},this._disabledSeconds=function(){return[]},this._allowEmpty=!0,this.time=new k,this.hourEnabled=!0,this.minuteEnabled=!0,this.secondEnabled=!0,this.firstScrolled=!1,this.enabledColumns=3,this.nzInDatePicker=!1,this.nzHideDisabledOptions=!1,this.nzUse12Hours=!1,this.closePanel=new i.EventEmitter}return Object.defineProperty(e.prototype,"nzAllowEmpty",{get:function(){return this._allowEmpty},set:function(e){a.isNotNil(e)&&(this._allowEmpty=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabledHours",{get:function(){return this._disabledHours},set:function(e){this._disabledHours=e,this._disabledHours&&this.buildHours()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabledMinutes",{get:function(){return this._disabledMinutes},set:function(e){a.isNotNil(e)&&(this._disabledMinutes=e,this.buildMinutes())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabledSeconds",{get:function(){return this._disabledSeconds},set:function(e){a.isNotNil(e)&&(this._disabledSeconds=e,this.buildSeconds())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return this._format},set:function(e){if(a.isNotNil(e)){this._format=e,this.enabledColumns=0;var t=new Set(e);this.hourEnabled=t.has("H")||t.has("h"),this.minuteEnabled=t.has("m"),this.secondEnabled=t.has("s"),this.hourEnabled&&this.enabledColumns++,this.minuteEnabled&&this.enabledColumns++,this.secondEnabled&&this.enabledColumns++,this.nzUse12Hours&&this.build12Hours()}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nzHourStep",{get:function(){return this._nzHourStep},set:function(e){a.isNotNil(e)&&(this._nzHourStep=e,this.buildHours())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nzMinuteStep",{get:function(){return this._nzMinuteStep},set:function(e){a.isNotNil(e)&&(this._nzMinuteStep=e,this.buildMinutes())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nzSecondStep",{get:function(){return this._nzSecondStep},set:function(e){a.isNotNil(e)&&(this._nzSecondStep=e,this.buildSeconds())},enumerable:!1,configurable:!0}),e.prototype.buildHours=function(){var e,t=24,n=null===(e=this.nzDisabledHours)||void 0===e?void 0:e.call(this),i=0;if(this.nzUse12Hours&&(t=12,n&&(n="PM"===this.time.selected12Hours?n.filter((function(e){return e>=12})).map((function(e){return e>12?e-12:e})):n.filter((function(e){return e<12||24===e})).map((function(e){return 24===e||0===e?12:e}))),i=1),this.hourRange=O(t,this.nzHourStep,i).map((function(e){return{index:e,disabled:!!n&&-1!==n.indexOf(e)}})),this.nzUse12Hours&&12===this.hourRange[this.hourRange.length-1].index){var o=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(H(arguments[t]));return e}(this.hourRange);o.unshift(o[o.length-1]),o.splice(o.length-1,1),this.hourRange=o}},e.prototype.buildMinutes=function(){var e=this;this.minuteRange=O(60,this.nzMinuteStep).map((function(t){return{index:t,disabled:!!e.nzDisabledMinutes&&-1!==e.nzDisabledMinutes(e.time.hours).indexOf(t)}}))},e.prototype.buildSeconds=function(){var e=this;this.secondRange=O(60,this.nzSecondStep).map((function(t){return{index:t,disabled:!!e.nzDisabledSeconds&&-1!==e.nzDisabledSeconds(e.time.hours,e.time.minutes).indexOf(t)}}))},e.prototype.build12Hours=function(){var e=this._format.includes("A");this.use12HoursRange=[{index:0,value:e?"AM":"am"},{index:1,value:e?"PM":"pm"}]},e.prototype.buildTimes=function(){this.buildHours(),this.buildMinutes(),this.buildSeconds(),this.build12Hours()},e.prototype.scrollToTime=function(e){if(void 0===e&&(e=0),this.hourEnabled&&this.hourListElement&&this.scrollToSelected(this.hourListElement.nativeElement,this.time.viewHours,e,"hour"),this.minuteEnabled&&this.minuteListElement&&this.scrollToSelected(this.minuteListElement.nativeElement,this.time.minutes,e,"minute"),this.secondEnabled&&this.secondListElement&&this.scrollToSelected(this.secondListElement.nativeElement,this.time.seconds,e,"second"),this.nzUse12Hours&&this.use12HoursListElement){var t="AM"===this.time.selected12Hours?0:1;this.scrollToSelected(this.use12HoursListElement.nativeElement,t,e,"12-hour")}},e.prototype.selectHour=function(e){this.time.setHours(e.index,e.disabled),this._disabledMinutes&&this.buildMinutes(),(this._disabledSeconds||this._disabledMinutes)&&this.buildSeconds()},e.prototype.selectMinute=function(e){this.time.setMinutes(e.index,e.disabled),this._disabledSeconds&&this.buildSeconds()},e.prototype.selectSecond=function(e){this.time.setSeconds(e.index,e.disabled)},e.prototype.select12Hours=function(e){this.time.setSelected12Hours(e.value),this._disabledHours&&this.buildHours(),this._disabledMinutes&&this.buildMinutes(),this._disabledSeconds&&this.buildSeconds()},e.prototype.scrollToSelected=function(e,t,n,i){if(void 0===n&&(n=0),e){var o=this.translateIndex(t,i),s=e.children[o]||e.children[0];this.scrollTo(e,s.offsetTop,n)}},e.prototype.translateIndex=function(e,t){var n,i,o;return"hour"===t?this.calcIndex(null===(n=this.nzDisabledHours)||void 0===n?void 0:n.call(this),this.hourRange.map((function(e){return e.index})).indexOf(e)):"minute"===t?this.calcIndex(null===(i=this.nzDisabledMinutes)||void 0===i?void 0:i.call(this,this.time.hours),this.minuteRange.map((function(e){return e.index})).indexOf(e)):"second"===t?this.calcIndex(null===(o=this.nzDisabledSeconds)||void 0===o?void 0:o.call(this,this.time.hours,this.time.minutes),this.secondRange.map((function(e){return e.index})).indexOf(e)):this.calcIndex([],this.use12HoursRange.map((function(e){return e.index})).indexOf(e))},e.prototype.scrollTo=function(e,t,n){var i=this;if(n<=0)e.scrollTop=t;else{var o=(t-e.scrollTop)/n*10;g.reqAnimFrame((function(){e.scrollTop=e.scrollTop+o,e.scrollTop!==t&&i.scrollTo(e,t,n-10)}))}},e.prototype.calcIndex=function(e,t){return(null==e?void 0:e.length)&&this.nzHideDisabledOptions?t-e.reduce((function(e,n){return e+(n<t?1:0)}),0):t},e.prototype.changed=function(){this.onChange&&this.onChange(this.time.value)},e.prototype.touched=function(){this.onTouch&&this.onTouch()},e.prototype.timeDisabled=function(e){var t,n,i,o,s,r,l=e.getHours(),u=e.getMinutes(),a=e.getSeconds();return(null!==(n=null===(t=this.nzDisabledHours)||void 0===t?void 0:t.call(this).indexOf(l))&&void 0!==n?n:-1)>-1||(null!==(o=null===(i=this.nzDisabledMinutes)||void 0===i?void 0:i.call(this,l).indexOf(u))&&void 0!==o?o:-1)>-1||(null!==(r=null===(s=this.nzDisabledSeconds)||void 0===s?void 0:s.call(this,l,u).indexOf(a))&&void 0!==r?r:-1)>-1},e.prototype.onClickNow=function(){var e=new Date;this.timeDisabled(e)||(this.time.setValue(e),this.changed(),this.closePanel.emit())},e.prototype.onClickOk=function(){this.closePanel.emit()},e.prototype.isSelectedHour=function(e){return e.index===this.time.viewHours},e.prototype.isSelectedMinute=function(e){return e.index===this.time.minutes},e.prototype.isSelectedSecond=function(e){return e.index===this.time.seconds},e.prototype.isSelected12Hours=function(e){return e.value.toUpperCase()===this.time.selected12Hours},e.prototype.ngOnInit=function(){var e=this;this.time.changes.pipe(y.takeUntil(this.unsubscribe$)).subscribe((function(){e.changed(),e.touched(),e.scrollToTime(120)})),this.buildTimes(),setTimeout((function(){e.scrollToTime(),e.firstScrolled=!0}))},e.prototype.ngOnDestroy=function(){this.unsubscribe$.next(),this.unsubscribe$.complete()},e.prototype.ngOnChanges=function(e){var t=e.nzUse12Hours,n=e.nzDefaultOpenValue;!(null==t?void 0:t.previousValue)&&(null==t?void 0:t.currentValue)&&(this.build12Hours(),this.enabledColumns++),(null==n?void 0:n.currentValue)&&this.time.setDefaultOpenValue(this.nzDefaultOpenValue||new Date)},e.prototype.writeValue=function(e){this.time.setValue(e,this.nzUse12Hours),this.buildTimes(),e&&this.firstScrolled&&this.scrollToTime(120),this.cdr.markForCheck()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouch=e},e}();C.decorators=[{type:i.Component,args:[{encapsulation:i.ViewEncapsulation.None,changeDetection:i.ChangeDetectionStrategy.OnPush,selector:"nz-time-picker-panel",exportAs:"nzTimePickerPanel",template:'\n <div *ngIf="nzInDatePicker" class="ant-picker-header">\n <div class="ant-picker-header-view">{{ dateHelper.format($any(time?.value), format) || \' \' }}</div>\n </div>\n <div class="ant-picker-content">\n <ul *ngIf="hourEnabled" #hourListElement class="ant-picker-time-panel-column" style="position: relative;">\n <ng-container *ngFor="let hour of hourRange">\n <li\n *ngIf="!(nzHideDisabledOptions && hour.disabled)"\n class="ant-picker-time-panel-cell"\n (click)="selectHour(hour)"\n [class.ant-picker-time-panel-cell-selected]="isSelectedHour(hour)"\n [class.ant-picker-time-panel-cell-disabled]="hour.disabled"\n >\n <div class="ant-picker-time-panel-cell-inner">{{ hour.index | number: \'2.0-0\' }}</div>\n </li>\n </ng-container>\n </ul>\n <ul *ngIf="minuteEnabled" #minuteListElement class="ant-picker-time-panel-column" style="position: relative;">\n <ng-container *ngFor="let minute of minuteRange">\n <li\n *ngIf="!(nzHideDisabledOptions && minute.disabled)"\n class="ant-picker-time-panel-cell"\n (click)="selectMinute(minute)"\n [class.ant-picker-time-panel-cell-selected]="isSelectedMinute(minute)"\n [class.ant-picker-time-panel-cell-disabled]="minute.disabled"\n >\n <div class="ant-picker-time-panel-cell-inner">{{ minute.index | number: \'2.0-0\' }}</div>\n </li>\n </ng-container>\n </ul>\n <ul *ngIf="secondEnabled" #secondListElement class="ant-picker-time-panel-column" style="position: relative;">\n <ng-container *ngFor="let second of secondRange">\n <li\n *ngIf="!(nzHideDisabledOptions && second.disabled)"\n class="ant-picker-time-panel-cell"\n (click)="selectSecond(second)"\n [class.ant-picker-time-panel-cell-selected]="isSelectedSecond(second)"\n [class.ant-picker-time-panel-cell-disabled]="second.disabled"\n >\n <div class="ant-picker-time-panel-cell-inner">{{ second.index | number: \'2.0-0\' }}</div>\n </li>\n </ng-container>\n </ul>\n <ul *ngIf="nzUse12Hours" #use12HoursListElement class="ant-picker-time-panel-column" style="position: relative;">\n <ng-container *ngFor="let range of use12HoursRange">\n <li\n *ngIf="!nzHideDisabledOptions"\n (click)="select12Hours(range)"\n class="ant-picker-time-panel-cell"\n [class.ant-picker-time-panel-cell-selected]="isSelected12Hours(range)"\n >\n <div class="ant-picker-time-panel-cell-inner">{{ range.value }}</div>\n </li>\n </ng-container>\n </ul>\n </div>\n <div *ngIf="!nzInDatePicker" class="ant-picker-footer">\n <div *ngIf="nzAddOn" class="ant-picker-footer-extra">\n <ng-template [ngTemplateOutlet]="nzAddOn"></ng-template>\n </div>\n <ul class="ant-picker-ranges">\n <li class="ant-picker-now">\n <a (click)="onClickNow()">\n {{ \'Calendar.lang.now\' | nzI18n }}\n </a>\n </li>\n <li class="ant-picker-ok">\n <button nz-button type="button" nzSize="small" nzType="primary" (click)="onClickOk()">\n {{ \'Calendar.lang.ok\' | nzI18n }}\n </button>\n </li>\n </ul>\n </div>\n ',host:{"[class.ant-picker-time-panel]":"true","[class.ant-picker-time-panel-column-0]":"enabledColumns === 0 && !nzInDatePicker","[class.ant-picker-time-panel-column-1]":"enabledColumns === 1 && !nzInDatePicker","[class.ant-picker-time-panel-column-2]":"enabledColumns === 2 && !nzInDatePicker","[class.ant-picker-time-panel-column-3]":"enabledColumns === 3 && !nzInDatePicker","[class.ant-picker-time-panel-narrow]":"enabledColumns < 3","[class.ant-picker-time-panel-placement-bottomLeft]":"!nzInDatePicker"},providers:[{provide:o.NG_VALUE_ACCESSOR,useExisting:C,multi:!0}]}]}],C.ctorParameters=function(){return[{type:i.ChangeDetectorRef},{type:c.DateHelperService}]},C.propDecorators={hourListElement:[{type:i.ViewChild,args:["hourListElement",{static:!1}]}],minuteListElement:[{type:i.ViewChild,args:["minuteListElement",{static:!1}]}],secondListElement:[{type:i.ViewChild,args:["secondListElement",{static:!1}]}],use12HoursListElement:[{type:i.ViewChild,args:["use12HoursListElement",{static:!1}]}],nzInDatePicker:[{type:i.Input}],nzAddOn:[{type:i.Input}],nzHideDisabledOptions:[{type:i.Input}],nzClearText:[{type:i.Input}],nzPlaceHolder:[{type:i.Input}],nzUse12Hours:[{type:i.Input}],nzDefaultOpenValue:[{type:i.Input}],closePanel:[{type:i.Output}],nzAllowEmpty:[{type:i.Input}],nzDisabledHours:[{type:i.Input}],nzDisabledMinutes:[{type:i.Input}],nzDisabledSeconds:[{type:i.Input}],format:[{type:i.Input}],nzHourStep:[{type:i.Input}],nzMinuteStep:[{type:i.Input}],nzSecondStep:[{type:i.Input}]},b([a.InputBoolean(),v("design:type",Object)],C.prototype,"nzUse12Hours",void 0);var D=function(){};D.decorators=[{type:i.NgModule,args:[{declarations:[S,C],exports:[C,S],imports:[p.CommonModule,o.FormsModule,c.NzI18nModule,t.OverlayModule,m.NzIconModule,f.NzOverlayModule,h.NzOutletModule,d.NzButtonModule]}]}],e.NzTimePickerComponent=S,e.NzTimePickerModule=D,e.NzTimePickerPanelComponent=C,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-time-picker.umd.min.js.map