UNPKG

ng-zorro-antd

Version:

An enterprise-class UI components based on Ant Design and Angular

16 lines (14 loc) 28.3 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,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/logger"),require("ng-zorro-antd/core/util"),require("@angular/common"),require("ng-zorro-antd/core/outlet"),require("ng-zorro-antd/core/overlay"),require("ng-zorro-antd/i18n"),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/core","@angular/forms","ng-zorro-antd/core/animation","ng-zorro-antd/core/config","ng-zorro-antd/core/logger","ng-zorro-antd/core/util","@angular/common","ng-zorro-antd/core/outlet","ng-zorro-antd/core/overlay","ng-zorro-antd/i18n","ng-zorro-antd/icon","ng-zorro-antd/core/polyfill","rxjs","rxjs/operators"],t):t(((e=e||self)["ng-zorro-antd"]=e["ng-zorro-antd"]||{},e["ng-zorro-antd"]["time-picker"]={}),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.logger,e["ng-zorro-antd"].core.util,e.ng.common,e["ng-zorro-antd"].core.outlet,e["ng-zorro-antd"].core.overlay,e["ng-zorro-antd"].i18n,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,m,f){"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 g(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 y(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 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}var b=function(){function e(e,t,i,o){this.nzConfigService=e,this.element=t,this.renderer=i,this.cdr=o,this.isInit=!1,this.focused=!1,this.value=null,this.overlayPositions=[{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top",offsetX:0,offsetY:3}],this.nzSize=null,this.nzPlaceHolder="",this.nzOpen=!1,this.nzOpenChange=new n.EventEmitter,this.nzHideDisabledOptions=!1,this.nzDisabled=!1,this.nzAutoFocus=!1}return e.prototype.setValue=function(e){this.value=e?new Date(e):null,this._onChange&&this._onChange(this.value),this._onTouched&&this._onTouched()},e.prototype.open=function(){this.nzDisabled||(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.setValue(null)},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.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.ngAfterViewInit=function(){this.isInit=!0,this.updateAutoFocus()},e.prototype.writeValue=function(e){e instanceof Date?this.value=e:l.isNil(e)?this.value=null:(r.warn('Non-Date type is not recommended for time-picker, use "Date" type.'),this.value=new Date(e)),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.decorators=[{type:n.Component,args:[{encapsulation:n.ViewEncapsulation.None,changeDetection:n.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 [nzTime]="nzFormat"\n [placeholder]="nzPlaceHolder || (\'TimePicker.placeholder\' | nzI18n)"\n [(ngModel)]="value"\n [disabled]="nzDisabled"\n (focus)="onFocus(true)"\n (blur)="onFocus(false)"\n />\n <span class="ant-picker-suffix">\n <ng-container *nzStringTemplateOutlet="nzSuffixIcon">\n <i nz-icon [nzType]="nzSuffixIcon"></i>\n </ng-container>\n </span>\n <span *ngIf="nzAllowEmpty && 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 cdkConnectedOverlayHasBackdrop\n [cdkConnectedOverlayPositions]="overlayPositions"\n [cdkConnectedOverlayOrigin]="origin"\n [cdkConnectedOverlayOpen]="nzOpen"\n [cdkConnectedOverlayOffsetY]="-2"\n (detach)="close()"\n (backdropClick)="close()"\n >\n <div [@slideMotion]="\'bottom\'" 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)="setValue($event)"\n (closePanel)="close()"\n >\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:[o.slideMotion],providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:e,multi:!0}]}]}],e.ctorParameters=function(){return[{type:s.NzConfigService},{type:n.ElementRef},{type:n.Renderer2},{type:n.ChangeDetectorRef}]},e.propDecorators={inputRef:[{type:n.ViewChild,args:["inputElement",{static:!0}]}],nzSize:[{type:n.Input}],nzHourStep:[{type:n.Input}],nzMinuteStep:[{type:n.Input}],nzSecondStep:[{type:n.Input}],nzClearText:[{type:n.Input}],nzPopupClassName:[{type:n.Input}],nzPlaceHolder:[{type:n.Input}],nzAddOn:[{type:n.Input}],nzDefaultOpenValue:[{type:n.Input}],nzDisabledHours:[{type:n.Input}],nzDisabledMinutes:[{type:n.Input}],nzDisabledSeconds:[{type:n.Input}],nzFormat:[{type:n.Input}],nzOpen:[{type:n.Input}],nzUse12Hours:[{type:n.Input}],nzSuffixIcon:[{type:n.Input}],nzOpenChange:[{type:n.Output}],nzHideDisabledOptions:[{type:n.Input}],nzAllowEmpty:[{type:n.Input}],nzDisabled:[{type:n.Input}],nzAutoFocus:[{type:n.Input}]},g([s.WithConfig("timePicker",1),y("design:type",Number)],e.prototype,"nzHourStep",void 0),g([s.WithConfig("timePicker",1),y("design:type",Number)],e.prototype,"nzMinuteStep",void 0),g([s.WithConfig("timePicker",1),y("design:type",Number)],e.prototype,"nzSecondStep",void 0),g([s.WithConfig("timePicker","clear"),y("design:type",String)],e.prototype,"nzClearText",void 0),g([s.WithConfig("timePicker"),y("design:type",String)],e.prototype,"nzPopupClassName",void 0),g([s.WithConfig("timePicker","HH:mm:ss"),y("design:type",String)],e.prototype,"nzFormat",void 0),g([s.WithConfig("timePicker",!1),l.InputBoolean(),y("design:type",Boolean)],e.prototype,"nzUse12Hours",void 0),g([s.WithConfig("timePicker","clock-circle"),y("design:type",Object)],e.prototype,"nzSuffixIcon",void 0),g([l.InputBoolean(),y("design:type",Object)],e.prototype,"nzHideDisabledOptions",void 0),g([s.WithConfig("timePicker",!0),l.InputBoolean(),y("design:type",Boolean)],e.prototype,"nzAllowEmpty",void 0),g([l.InputBoolean(),y("design:type",Object)],e.prototype,"nzDisabled",void 0),g([l.InputBoolean(),y("design:type",Object)],e.prototype,"nzAutoFocus",void 0),e}();var v=function(){function e(){this.selected12Hours=void 0,this._use12Hours=!1,this._changes=new m.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:!0,configurable:!0}),e.prototype.setValue=function(e,t){return l.isNotNil(t)&&(this._use12Hours=t),e!==this.value&&(this._value=e,l.isNotNil(this.value)?this._use12Hours&&l.isNotNil(this.hours)&&(this.selected12Hours=this.hours>=12?"PM":"AM"):this._clear()),this},e.prototype.initValue=function(){l.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!(l.isNotNil(this.hours)||l.isNotNil(this.minutes)||l.isNotNil(this.seconds))},enumerable:!0,configurable:!0}),e.prototype._clear=function(){this._value=void 0,this.selected12Hours=void 0},e.prototype.update=function(){this.isEmpty?this._value=void 0:(l.isNotNil(this.hours)&&this.value.setHours(this.hours),l.isNotNil(this.minutes)&&this.value.setMinutes(this.minutes),l.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&&l.isNotNil(this.hours)?this.calculateViewHour(this.hours):this.hours},enumerable:!0,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:!0,configurable:!0}),Object.defineProperty(e.prototype,"hours",{get:function(){var e;return null===(e=this.value)||void 0===e?void 0:e.getHours()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minutes",{get:function(){var e;return null===(e=this.value)||void 0===e?void 0:e.getMinutes()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"seconds",{get:function(){var e;return null===(e=this.value)||void 0===e?void 0:e.getSeconds()},enumerable:!0,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}();var H=function(){function e(e,t){this.dateHelper=e,this.elementRef=t}return e.prototype.keyup=function(){this.changed()},e.prototype.blur=function(){this.touched()},e.prototype.changed=function(){if(this._onChange){var e=this.dateHelper.parseTime(this.elementRef.nativeElement.value,this.nzTime);this._onChange(e)}},e.prototype.touched=function(){this._onTouch&&this._onTouch()},e.prototype.setRange=function(){this.elementRef.nativeElement.focus(),this.elementRef.nativeElement.setSelectionRange(0,this.elementRef.nativeElement.value.length)},e.prototype.writeValue=function(e){this.elementRef.nativeElement.value=this.dateHelper.format(e,this.nzTime)},e.prototype.registerOnChange=function(e){this._onChange=e},e.prototype.registerOnTouched=function(e){this._onTouch=e},e.decorators=[{type:n.Directive,args:[{selector:"input[nzTime]",exportAs:"nzTime",providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:e,multi:!0}]}]}],e.ctorParameters=function(){return[{type:p.DateHelperService},{type:n.ElementRef}]},e.propDecorators={nzTime:[{type:n.Input}],keyup:[{type:n.HostListener,args:["keyup"]}],blur:[{type:n.HostListener,args:["blur"]}]},e}();function S(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 k=function(){function e(e,t){this.cdr=e,this.dateHelper=t,this._nzHourStep=1,this._nzMinuteStep=1,this._nzSecondStep=1,this.unsubscribe$=new m.Subject,this._format="HH:mm:ss",this._allowEmpty=!0,this.time=new v,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 n.EventEmitter}return Object.defineProperty(e.prototype,"nzAllowEmpty",{get:function(){return this._allowEmpty},set:function(e){l.isNotNil(e)&&(this._allowEmpty=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabledHours",{get:function(){return this._disabledHours},set:function(e){this._disabledHours=e,this._disabledHours&&this.buildHours()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabledMinutes",{get:function(){return this._disabledMinutes},set:function(e){l.isNotNil(e)&&(this._disabledMinutes=e,this.buildMinutes())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabledSeconds",{get:function(){return this._disabledSeconds},set:function(e){l.isNotNil(e)&&(this._disabledSeconds=e,this.buildSeconds())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"format",{get:function(){return this._format},set:function(e){if(l.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:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzHourStep",{get:function(){return this._nzHourStep},set:function(e){l.isNotNil(e)&&(this._nzHourStep=e,this.buildHours())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzMinuteStep",{get:function(){return this._nzMinuteStep},set:function(e){l.isNotNil(e)&&(this._nzMinuteStep=e,this.buildMinutes())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzSecondStep",{get:function(){return this._nzSecondStep},set:function(e){l.isNotNil(e)&&(this._nzSecondStep=e,this.buildSeconds())},enumerable:!0,configurable:!0}),e.prototype.selectInputRange=function(){var e=this;setTimeout((function(){e.nzTimeValueAccessorDirective&&e.nzTimeValueAccessorDirective.setRange()}))},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=S(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(z(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=S(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=S(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;h.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=e.getHours(),n=e.getMinutes(),i=e.getSeconds();return(this.nzDisabledHours&&this.nzDisabledHours().indexOf(t))>-1||(this.nzDisabledMinutes&&this.nzDisabledMinutes(t).indexOf(n))>-1||(this.nzDisabledSeconds&&this.nzDisabledSeconds(t,n).indexOf(i))>-1},e.prototype.onClickNow=function(){var e=new Date;this.timeDisabled(e)||(this.time.setValue(e),this.changed(),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(f.takeUntil(this.unsubscribe$)).subscribe((function(){e.changed(),e.touched()})),this.buildTimes(),this.selectInputRange(),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.decorators=[{type:n.Component,args:[{encapsulation:n.ViewEncapsulation.None,changeDetection:n.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(time?.value, format) || \'&nbsp;\' }}</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.now\' | nzI18n }}\n </a>\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:i.NG_VALUE_ACCESSOR,useExisting:e,multi:!0}]}]}],e.ctorParameters=function(){return[{type:n.ChangeDetectorRef},{type:p.DateHelperService}]},e.propDecorators={nzTimeValueAccessorDirective:[{type:n.ViewChild,args:[H,{static:!1}]}],hourListElement:[{type:n.ViewChild,args:["hourListElement",{static:!1}]}],minuteListElement:[{type:n.ViewChild,args:["minuteListElement",{static:!1}]}],secondListElement:[{type:n.ViewChild,args:["secondListElement",{static:!1}]}],use12HoursListElement:[{type:n.ViewChild,args:["use12HoursListElement",{static:!1}]}],nzInDatePicker:[{type:n.Input}],nzAddOn:[{type:n.Input}],nzHideDisabledOptions:[{type:n.Input}],nzClearText:[{type:n.Input}],nzPlaceHolder:[{type:n.Input}],nzUse12Hours:[{type:n.Input}],nzDefaultOpenValue:[{type:n.Input}],closePanel:[{type:n.Output}],nzAllowEmpty:[{type:n.Input}],nzDisabledHours:[{type:n.Input}],nzDisabledMinutes:[{type:n.Input}],nzDisabledSeconds:[{type:n.Input}],format:[{type:n.Input}],nzHourStep:[{type:n.Input}],nzMinuteStep:[{type:n.Input}],nzSecondStep:[{type:n.Input}]},g([l.InputBoolean(),y("design:type",Object)],e.prototype,"nzUse12Hours",void 0),e}();var O=function(){function e(){}return e.decorators=[{type:n.NgModule,args:[{declarations:[b,k,H],exports:[k,b],imports:[u.CommonModule,i.FormsModule,p.NzI18nModule,t.OverlayModule,d.NzIconModule,c.NzOverlayModule,a.NzOutletModule]}]}],e}();e.NzTimePickerComponent=b,e.NzTimePickerModule=O,e.NzTimePickerPanelComponent=k,e.NzTimeValueAccessorDirective=H,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=ng-zorro-antd-time-picker.umd.min.js.map