ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
16 lines (14 loc) • 30.5 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/bidi"),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("rxjs"),require("rxjs/operators"),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")):"function"==typeof define&&define.amd?define("ng-zorro-antd/time-picker",["exports","@angular/cdk/bidi","@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","rxjs","rxjs/operators","@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"],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.bidi,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.rxjs,e.rxjs.operators,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)}(this,(function(e,t,n,i,o,s,r,l,u,a,c,p,d,h,f,m,y,g,z,b){"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 v(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 H(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create;function k(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,i,s,r,l,u,a){this.nzConfigService=e,this.i18n=t,this.element=n,this.renderer=i,this.cdr=s,this.dateHelper=r,this.platform=l,this.elementRef=u,this.directionality=a,this._nzModuleName="timePicker",this.destroy$=new d.Subject,this.isInit=!1,this.focused=!1,this.inputValue="",this.value=null,this.preValue=null,this.i18nPlaceHolder$=d.of(void 0),this.overlayPositions=[{originX:"start",originY:"bottom",overlayX:"start",overlayY:"top",offsetY:3}],this.dir="ltr",this.nzId=null,this.nzSize=null,this.nzHourStep=1,this.nzMinuteStep=1,this.nzSecondStep=1,this.nzClearText="clear",this.nzNowText="",this.nzOkText="",this.nzPopupClassName="",this.nzPlaceHolder="",this.nzFormat="HH:mm:ss",this.nzOpen=!1,this.nzUse12Hours=!1,this.nzSuffixIcon="clock-circle",this.nzOpenChange=new o.EventEmitter,this.nzHideDisabledOptions=!1,this.nzAllowEmpty=!0,this.nzDisabled=!1,this.nzAutoFocus=!1,this.elementRef.nativeElement.classList.add("ant-picker")}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=r.isValid(e)?new Date(e):null),this.value=r.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&&r.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(){var e,t=this;this.inputSize=Math.max(8,this.nzFormat.length)+2,this.origin=new n.CdkOverlayOrigin(this.element),this.i18nPlaceHolder$=this.i18n.localeChange.pipe(h.map((function(e){return e.TimePicker.placeholder}))),this.dir=this.directionality.value,null===(e=this.directionality.change)||void 0===e||e.pipe(h.takeUntil(this.destroy$)).subscribe((function(e){t.dir=e}))},e.prototype.ngOnDestroy=function(){this.destroy$.next(),this.destroy$.complete()},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;r.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:c.isNil(e)?t=null:(a.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:o.Component,args:[{encapsulation:o.ViewEncapsulation.None,changeDetection:o.ChangeDetectionStrategy.OnPush,selector:"nz-time-picker",exportAs:"nzTimePicker",template:'\n <div class="ant-picker-input">\n <input\n #inputElement\n [attr.id]="nzId"\n type="text"\n [size]="inputSize"\n [placeholder]="nzPlaceHolder || (i18nPlaceHolder$ | async)"\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 || (i18nPlaceHolder$ | async)"\n [nzHideDisabledOptions]="nzHideDisabledOptions"\n [nzUse12Hours]="nzUse12Hours"\n [nzDefaultOpenValue]="nzDefaultOpenValue"\n [nzAddOn]="nzAddOn"\n [nzClearText]="nzClearText"\n [nzNowText]="nzNowText"\n [nzOkText]="nzOkText"\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-large]":"nzSize === 'large'","[class.ant-picker-small]":"nzSize === 'small'","[class.ant-picker-disabled]":"nzDisabled","[class.ant-picker-focused]":"focused","[class.ant-picker-rtl]":"dir === 'rtl'","(click)":"open()"},animations:[l.slideMotion],providers:[{provide:s.NG_VALUE_ACCESSOR,useExisting:S,multi:!0}]}]}],S.ctorParameters=function(){return[{type:u.NzConfigService},{type:p.NzI18nService},{type:o.ElementRef},{type:o.Renderer2},{type:o.ChangeDetectorRef},{type:p.DateHelperService},{type:i.Platform},{type:o.ElementRef},{type:t.Directionality,decorators:[{type:o.Optional}]}]},S.propDecorators={inputRef:[{type:o.ViewChild,args:["inputElement",{static:!0}]}],nzId:[{type:o.Input}],nzSize:[{type:o.Input}],nzHourStep:[{type:o.Input}],nzMinuteStep:[{type:o.Input}],nzSecondStep:[{type:o.Input}],nzClearText:[{type:o.Input}],nzNowText:[{type:o.Input}],nzOkText:[{type:o.Input}],nzPopupClassName:[{type:o.Input}],nzPlaceHolder:[{type:o.Input}],nzAddOn:[{type:o.Input}],nzDefaultOpenValue:[{type:o.Input}],nzDisabledHours:[{type:o.Input}],nzDisabledMinutes:[{type:o.Input}],nzDisabledSeconds:[{type:o.Input}],nzFormat:[{type:o.Input}],nzOpen:[{type:o.Input}],nzUse12Hours:[{type:o.Input}],nzSuffixIcon:[{type:o.Input}],nzOpenChange:[{type:o.Output}],nzHideDisabledOptions:[{type:o.Input}],nzAllowEmpty:[{type:o.Input}],nzDisabled:[{type:o.Input}],nzAutoFocus:[{type:o.Input}]},v([u.WithConfig(),H("design:type",Number)],S.prototype,"nzHourStep",void 0),v([u.WithConfig(),H("design:type",Number)],S.prototype,"nzMinuteStep",void 0),v([u.WithConfig(),H("design:type",Number)],S.prototype,"nzSecondStep",void 0),v([u.WithConfig(),H("design:type",String)],S.prototype,"nzClearText",void 0),v([u.WithConfig(),H("design:type",String)],S.prototype,"nzNowText",void 0),v([u.WithConfig(),H("design:type",String)],S.prototype,"nzOkText",void 0),v([u.WithConfig(),H("design:type",String)],S.prototype,"nzPopupClassName",void 0),v([u.WithConfig(),H("design:type",String)],S.prototype,"nzFormat",void 0),v([u.WithConfig(),c.InputBoolean(),H("design:type",Boolean)],S.prototype,"nzUse12Hours",void 0),v([u.WithConfig(),H("design:type",Object)],S.prototype,"nzSuffixIcon",void 0),v([c.InputBoolean(),H("design:type",Object)],S.prototype,"nzHideDisabledOptions",void 0),v([u.WithConfig(),c.InputBoolean(),H("design:type",Boolean)],S.prototype,"nzAllowEmpty",void 0),v([c.InputBoolean(),H("design:type",Object)],S.prototype,"nzDisabled",void 0),v([c.InputBoolean(),H("design:type",Object)],S.prototype,"nzAutoFocus",void 0);var O=function(){function e(){this.selected12Hours=void 0,this._use12Hours=!1,this._changes=new d.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 c.isNotNil(t)&&(this._use12Hours=t),e!==this.value&&(this._value=e,c.isNotNil(this.value)?this._use12Hours&&c.isNotNil(this.hours)&&(this.selected12Hours=this.hours>=12?"PM":"AM"):this._clear()),this},e.prototype.initValue=function(){c.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!(c.isNotNil(this.hours)||c.isNotNil(this.minutes)||c.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:(c.isNotNil(this.hours)&&this.value.setHours(this.hours),c.isNotNil(this.minutes)&&this.value.setMinutes(this.minutes),c.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&&c.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 C(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 I=function(){function e(e,t,n){this.cdr=e,this.dateHelper=t,this.elementRef=n,this._nzHourStep=1,this._nzMinuteStep=1,this._nzSecondStep=1,this.unsubscribe$=new d.Subject,this._format="HH:mm:ss",this._disabledHours=function(){return[]},this._disabledMinutes=function(){return[]},this._disabledSeconds=function(){return[]},this._allowEmpty=!0,this.time=new O,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 o.EventEmitter,this.elementRef.nativeElement.classList.add("ant-picker-time-panel")}return Object.defineProperty(e.prototype,"nzAllowEmpty",{get:function(){return this._allowEmpty},set:function(e){c.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){c.isNotNil(e)&&(this._disabledMinutes=e,this.buildMinutes())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabledSeconds",{get:function(){return this._disabledSeconds},set:function(e){c.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(c.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){c.isNotNil(e)&&(this._nzHourStep=e,this.buildHours())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nzMinuteStep",{get:function(){return this._nzMinuteStep},set:function(e){c.isNotNil(e)&&(this._nzMinuteStep=e,this.buildMinutes())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nzSecondStep",{get:function(){return this._nzSecondStep},set:function(e){c.isNotNil(e)&&(this._nzSecondStep=e,this.buildSeconds())},enumerable:!1,configurable:!0}),e.prototype.trackByFn=function(e){return e},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=C(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(k(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=C(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=C(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;b.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(h.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.prototype.onMousedown=function(e){e.preventDefault()},e}();I.decorators=[{type:o.Component,args:[{encapsulation:o.ViewEncapsulation.None,changeDetection:o.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; trackBy: trackByFn">\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; trackBy: trackByFn">\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; trackBy: trackByFn">\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 {{ nzNowText || (\'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 {{ nzOkText || (\'Calendar.lang.ok\' | nzI18n) }}\n </button>\n </li>\n </ul>\n </div>\n ',host:{"[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","(mousedown)":"onMousedown($event)"},providers:[{provide:s.NG_VALUE_ACCESSOR,useExisting:I,multi:!0}]}]}],I.ctorParameters=function(){return[{type:o.ChangeDetectorRef},{type:p.DateHelperService},{type:o.ElementRef}]},I.propDecorators={hourListElement:[{type:o.ViewChild,args:["hourListElement",{static:!1}]}],minuteListElement:[{type:o.ViewChild,args:["minuteListElement",{static:!1}]}],secondListElement:[{type:o.ViewChild,args:["secondListElement",{static:!1}]}],use12HoursListElement:[{type:o.ViewChild,args:["use12HoursListElement",{static:!1}]}],nzInDatePicker:[{type:o.Input}],nzAddOn:[{type:o.Input}],nzHideDisabledOptions:[{type:o.Input}],nzClearText:[{type:o.Input}],nzNowText:[{type:o.Input}],nzOkText:[{type:o.Input}],nzPlaceHolder:[{type:o.Input}],nzUse12Hours:[{type:o.Input}],nzDefaultOpenValue:[{type:o.Input}],closePanel:[{type:o.Output}],nzAllowEmpty:[{type:o.Input}],nzDisabledHours:[{type:o.Input}],nzDisabledMinutes:[{type:o.Input}],nzDisabledSeconds:[{type:o.Input}],format:[{type:o.Input}],nzHourStep:[{type:o.Input}],nzMinuteStep:[{type:o.Input}],nzSecondStep:[{type:o.Input}]},v([c.InputBoolean(),H("design:type",Object)],I.prototype,"nzUse12Hours",void 0);var D=function(){};D.decorators=[{type:o.NgModule,args:[{declarations:[S,I],exports:[I,S],imports:[t.BidiModule,f.CommonModule,s.FormsModule,p.NzI18nModule,n.OverlayModule,z.NzIconModule,g.NzOverlayModule,y.NzOutletModule,m.NzButtonModule]}]}],e.NzTimePickerComponent=S,e.NzTimePickerModule=D,e.NzTimePickerPanelComponent=I,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=ng-zorro-antd-time-picker.umd.min.js.map