ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
2 lines • 28.1 kB
JavaScript
!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"),require("ng-zorro-antd/i18n"),require("rxjs"),require("rxjs/operators"),require("@angular/common"),require("ng-zorro-antd/icon")):"function"==typeof define&&define.amd?define("ng-zorro-antd/time-picker",["exports","@angular/cdk/overlay","@angular/core","@angular/forms","ng-zorro-antd/core","ng-zorro-antd/i18n","rxjs","rxjs/operators","@angular/common","ng-zorro-antd/icon"],t):t((e["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,e["ng-zorro-antd"].i18n,e.rxjs,e.rxjs.operators,e.ng.common,e["ng-zorro-antd"].icon)}(this,function(e,t,s,n,o,i,r,u,l,a){"use strict";var c=function(){function e(e,t,n,i){this.element=e,this.renderer=t,this.updateCls=n,this.cdr=i,this._disabled=!1,this._value=null,this._allowEmpty=!0,this._autoFocus=!1,this._hideDisabledOptions=!1,this.isInit=!1,this.overlayPositions=[{originX:"start",originY:"top",overlayX:"end",overlayY:"top",offsetX:0,offsetY:0}],this.nzSize=null,this.nzHourStep=1,this.nzMinuteStep=1,this.nzSecondStep=1,this.nzClearText="clear",this.nzPopupClassName="",this.nzPlaceHolder="",this.nzDefaultOpenValue=new Date,this.nzFormat="HH:mm:ss",this.nzOpen=!1,this.nzUse12Hours=!1,this.nzOpenChange=new s.EventEmitter}return Object.defineProperty(e.prototype,"nzHideDisabledOptions",{get:function(){return this._hideDisabledOptions},set:function(e){this._hideDisabledOptions=o.toBoolean(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzAllowEmpty",{get:function(){return this._allowEmpty},set:function(e){this._allowEmpty=o.toBoolean(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzAutoFocus",{get:function(){return this._autoFocus},set:function(e){this._autoFocus=o.toBoolean(e),this.updateAutoFocus()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabled",{get:function(){return this._disabled},set:function(e){this._disabled=o.toBoolean(e);var t=this.inputRef.nativeElement;this._disabled?this.renderer.setAttribute(t,"disabled",""):this.renderer.removeAttribute(t,"disabled")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){this._value=e,this._onChange&&this._onChange(this.value),this._onTouched&&this._onTouched()},enumerable:!0,configurable:!0}),e.prototype.open=function(){this.nzDisabled||(this.nzOpen=!0,this.nzOpenChange.emit(this.nzOpen))},e.prototype.close=function(){this.nzOpen=!1,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(){this.value=null},e.prototype.setClassMap=function(){var e;this.updateCls.updateHostClass(this.element.nativeElement,((e={})["ant-time-picker"]=!0,e["ant-time-picker-"+this.nzSize]=o.isNotNil(this.nzSize),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.setClassMap(),this.origin=new t.CdkOverlayOrigin(this.element)},e.prototype.ngOnChanges=function(e){var t=e.nzUse12Hours,n=e.nzFormat;t&&!t.previousValue&&t.currentValue&&!n&&(this.nzFormat="h:mm:ss a")},e.prototype.ngAfterViewInit=function(){this.isInit=!0,this.updateAutoFocus()},e.prototype.writeValue=function(e){this._value=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:s.Component,args:[{encapsulation:s.ViewEncapsulation.None,changeDetection:s.ChangeDetectionStrategy.OnPush,selector:"nz-time-picker",exportAs:"nzTimePicker",template:'<input\n type="text"\n [nzTime]="nzFormat"\n class="ant-time-picker-input"\n [placeholder]="nzPlaceHolder || (\'TimePicker.placeholder\' | nzI18n)"\n [(ngModel)]="value"\n readonly="readonly"\n (click)="open()"\n #inputElement>\n<span class="ant-time-picker-icon">\n <i nz-icon type="clock-circle"></i>\n</span>\n<i\n *ngIf="nzAllowEmpty && value"\n nz-icon\n type="close-circle"\n theme="fill"\n class="anticon anticon-close-circle ant-time-picker-clear"\n tabindex="-1"\n [attr.aria-label]="nzClearText"\n [attr.title]="nzClearText"\n (click)="onClickClearBtn()"\n></i>\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 <nz-time-picker-panel\n [ngClass]="nzPopupClassName"\n [@slideMotion]="\'bottom\'"\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 [opened]="nzOpen"\n [nzClearText]="nzClearText"\n [nzAllowEmpty]="nzAllowEmpty"\n [(ngModel)]="value">\n </nz-time-picker-panel>\n</ng-template>\n\n',animations:[o.slideMotion],providers:[o.NzUpdateHostClassService,{provide:n.NG_VALUE_ACCESSOR,useExisting:e,multi:!0}]}]}],e.ctorParameters=function(){return[{type:s.ElementRef},{type:s.Renderer2},{type:o.NzUpdateHostClassService},{type:s.ChangeDetectorRef}]},e.propDecorators={inputRef:[{type:s.ViewChild,args:["inputElement"]}],nzSize:[{type:s.Input}],nzHourStep:[{type:s.Input}],nzMinuteStep:[{type:s.Input}],nzSecondStep:[{type:s.Input}],nzClearText:[{type:s.Input}],nzPopupClassName:[{type:s.Input}],nzPlaceHolder:[{type:s.Input}],nzAddOn:[{type:s.Input}],nzDefaultOpenValue:[{type:s.Input}],nzDisabledHours:[{type:s.Input}],nzDisabledMinutes:[{type:s.Input}],nzDisabledSeconds:[{type:s.Input}],nzFormat:[{type:s.Input}],nzOpen:[{type:s.Input}],nzUse12Hours:[{type:s.Input}],nzOpenChange:[{type:s.Output}],nzHideDisabledOptions:[{type:s.Input}],nzAllowEmpty:[{type:s.Input}],nzAutoFocus:[{type:s.Input}],nzDisabled:[{type:s.Input}]},e}();function d(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,s,o=n.call(e),r=[];try{for(;(void 0===t||0<t--)&&!(i=o.next()).done;)r.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=o["return"])&&n.call(o)}finally{if(s)throw s.error}}return r}var p=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._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:s.Directive,args:[{selector:"input[nzTime]",exportAs:"nzTime",providers:[{provide:n.NG_VALUE_ACCESSOR,useExisting:e,multi:!0}]}]}],e.ctorParameters=function(){return[{type:i.DateHelperService},{type:s.ElementRef}]},e.propDecorators={nzTime:[{type:s.Input}],keyup:[{type:s.HostListener,args:["keyup"]}],blur:[{type:s.HostListener,args:["blur"]}]},e}(),h=function(){function e(){this._seconds=undefined,this._hours=undefined,this._minutes=undefined,this._selected12Hours=undefined,this._use12Hours=!1,this._defaultOpenValue=new Date,this._changes=new r.Subject}return e.prototype.setDefaultValueIfNil=function(){o.isNotNil(this._value)||(this._value=new Date(this.defaultOpenValue))},e.prototype.setMinutes=function(e,t){return t||(this.setDefaultValueIfNil(),this.minutes=e),this},e.prototype.setHours=function(e,t){return t||(this.setDefaultValueIfNil(),this.hours=e),this},e.prototype.setSeconds=function(e,t){return t||(this.setDefaultValueIfNil(),this.seconds=e),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}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(e){e!==this._value&&(this._value=e,o.isNotNil(this._value)?(this._hours=this._value.getHours(),this._minutes=this._value.getMinutes(),this._seconds=this._value.getSeconds(),this._use12Hours&&o.isNotNil(this._hours)&&(this._selected12Hours=12<=this._hours?"PM":"AM")):this._clear())},enumerable:!0,configurable:!0}),e.prototype.setValue=function(e,t){return o.isNotNil(t)&&(this._use12Hours=t),this.value=e,this},e.prototype.clear=function(){this._clear(),this.update()},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return!(o.isNotNil(this._hours)||o.isNotNil(this._minutes)||o.isNotNil(this._seconds))},enumerable:!0,configurable:!0}),e.prototype._clear=function(){this._hours=undefined,this._minutes=undefined,this._seconds=undefined,this._selected12Hours=undefined},e.prototype.update=function(){this.isEmpty?this._value=undefined:(o.isNotNil(this._hours)?this._value.setHours(this.hours):this._hours=this.defaultHours,o.isNotNil(this._minutes)?this._value.setMinutes(this.minutes):this._minutes=this.defaultMinutes,o.isNotNil(this._seconds)?this._value.setSeconds(this.seconds):this._seconds=this.defaultSeconds,this._use12Hours&&(o.isNotNil(this._selected12Hours)||(this._selected12Hours=this.default12Hours),"PM"===this.selected12Hours&&this._hours<12&&(this._hours+=12,this._value.setHours(this._hours)),"AM"===this.selected12Hours&&12<=this._hours&&(this._hours-=12,this._value.setHours(this._hours))),this._value=new Date(this._value)),this.changed()},e.prototype.changed=function(){this._changes.next(this._value)},Object.defineProperty(e.prototype,"viewHours",{get:function(){return this._use12Hours&&o.isNotNil(this._hours)?this.calculateViewHour(this._hours):this._hours},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"realHours",{get:function(){return this._hours},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hours",{get:function(){return this._hours},set:function(e){e!==this._hours&&(this._use12Hours?"PM"===this.selected12Hours&&12!==e?this._hours=e+12:"AM"===this.selected12Hours&&12===e?this._hours=0:this._hours=e:this._hours=e,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minutes",{get:function(){return this._minutes},set:function(e){e!==this._minutes&&(this._minutes=e,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"seconds",{get:function(){return this._seconds},set:function(e){e!==this._seconds&&(this._seconds=e,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selected12Hours",{get:function(){return this._selected12Hours},set:function(e){e.toUpperCase()!==this._selected12Hours&&(this._selected12Hours=e.toUpperCase(),this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultOpenValue",{get:function(){return this._defaultOpenValue},set:function(e){this._defaultOpenValue!==e&&(this._defaultOpenValue=e,this.update())},enumerable:!0,configurable:!0}),e.prototype.setDefaultOpenValue=function(e){return this.defaultOpenValue=e,this},Object.defineProperty(e.prototype,"defaultViewHours",{get:function(){var e=this._defaultOpenValue.getHours();return this._use12Hours&&o.isNotNil(e)?this.calculateViewHour(e):e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultRealHours",{get:function(){return this._defaultOpenValue.getHours()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultHours",{get:function(){return this._defaultOpenValue.getHours()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultMinutes",{get:function(){return this._defaultOpenValue.getMinutes()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultSeconds",{get:function(){return this._defaultOpenValue.getSeconds()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"default12Hours",{get:function(){return 12<=this._defaultOpenValue.getHours()?"PM":"AM"},enumerable:!0,configurable:!0}),e.prototype.calculateViewHour=function(e){var t=this._selected12Hours||this.default12Hours;return"PM"===t&&12<e?e-12:"AM"===t&&0===e?12:e},e}();function f(e,n,i){return void 0===n&&(n=1),void 0===i&&(i=0),new Array(Math.ceil(e/n)).fill(0).map(function(e,t){return(t+i)*n})}var m=function(){function e(e,t,n){this.element=e,this.updateCls=t,this.cdr=n,this._nzHourStep=1,this._nzMinuteStep=1,this._nzSecondStep=1,this.unsubscribe$=new r.Subject,this._format="HH:mm:ss",this._defaultOpenValue=new Date,this._opened=!1,this._allowEmpty=!0,this.prefixCls="ant-time-picker-panel",this.time=new h,this.hourEnabled=!0,this.minuteEnabled=!0,this.secondEnabled=!0,this.enabledColumns=3,this.nzInDatePicker=!1,this.nzHideDisabledOptions=!1,this.nzUse12Hours=!1}return Object.defineProperty(e.prototype,"nzAllowEmpty",{get:function(){return this._allowEmpty},set:function(e){o.isNotNil(e)&&(this._allowEmpty=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"opened",{get:function(){return this._opened},set:function(e){this._opened=e,this.opened&&(this.initPosition(),this.selectInputRange())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzDefaultOpenValue",{get:function(){return this._defaultOpenValue},set:function(e){o.isNotNil(e)&&(this._defaultOpenValue=e,this.time.setDefaultOpenValue(this.nzDefaultOpenValue))},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){o.isNotNil(e)&&(this._disabledMinutes=e,this.buildMinutes())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabledSeconds",{get:function(){return this._disabledSeconds},set:function(e){o.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(o.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){o.isNotNil(e)&&(this._nzHourStep=e,this.buildHours())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzMinuteStep",{get:function(){return this._nzMinuteStep},set:function(e){o.isNotNil(e)&&(this._nzMinuteStep=e,this.buildMinutes())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzSecondStep",{get:function(){return this._nzSecondStep},set:function(e){o.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 t=this,e=24,n=this.nzDisabledHours&&this.nzDisabledHours(),i=0;if(this.nzUse12Hours&&(e=12,n&&(n="PM"===this.time.selected12Hours?n.filter(function(e){return 12<=e}).map(function(e){return 12<e?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=f(e,this.nzHourStep,i).map(function(e){return{index:e,disabled:t.nzDisabledHours&&-1!==n.indexOf(e)}}),this.nzUse12Hours&&12===this.hourRange[this.hourRange.length-1].index){var s=function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(d(arguments[t]));return e}(this.hourRange);s.unshift(s[s.length-1]),s.splice(s.length-1,1),this.hourRange=s}},e.prototype.buildMinutes=function(){var t=this;this.minuteRange=f(60,this.nzMinuteStep).map(function(e){return{index:e,disabled:t.nzDisabledMinutes&&-1!==t.nzDisabledMinutes(t.time.hours).indexOf(e)}})},e.prototype.buildSeconds=function(){var t=this;this.secondRange=f(60,this.nzSecondStep).map(function(e){return{index:e,disabled:t.nzDisabledSeconds&&-1!==t.nzDisabledSeconds(t.time.hours,t.time.minutes).indexOf(e)}})},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.selectHour=function(e){this.time.setHours(e.index,e.disabled),this.scrollToSelected(this.hourListElement.nativeElement,e.index,120,"hour"),this._disabledMinutes&&this.buildMinutes(),(this._disabledSeconds||this._disabledMinutes)&&this.buildSeconds()},e.prototype.selectMinute=function(e){this.time.setMinutes(e.index,e.disabled),this.scrollToSelected(this.minuteListElement.nativeElement,e.index,120,"minute"),this._disabledSeconds&&this.buildSeconds()},e.prototype.selectSecond=function(e){this.time.setSeconds(e.index,e.disabled),this.scrollToSelected(this.secondListElement.nativeElement,e.index,120,"second")},e.prototype.select12Hours=function(e){this.time.selected12Hours=e.value,this._disabledHours&&this.buildHours(),this._disabledMinutes&&this.buildMinutes(),this._disabledSeconds&&this.buildSeconds(),this.scrollToSelected(this.use12HoursListElement.nativeElement,e.index,120,"12-hour")},e.prototype.scrollToSelected=function(e,t,n,i){void 0===n&&(n=0);var s=this.translateIndex(t,i),o=e.children[0].children[s]||e.children[0].children[0];this.scrollTo(e,o.offsetTop,n)},e.prototype.translateIndex=function(e,t){if("hour"===t){var n=this.nzDisabledHours&&this.nzDisabledHours();return this.calcIndex(n,this.hourRange.map(function(e){return e.index}).indexOf(e))}if("minute"===t){var i=this.nzDisabledMinutes&&this.nzDisabledMinutes(this.time.hours);return this.calcIndex(i,this.minuteRange.map(function(e){return e.index}).indexOf(e))}if("second"===t){var s=this.nzDisabledSeconds&&this.nzDisabledSeconds(this.time.hours,this.time.minutes);return this.calcIndex(s,this.secondRange.map(function(e){return e.index}).indexOf(e))}return 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 s=(t-e.scrollTop)/n*10;o.reqAnimFrame(function(){e.scrollTop=e.scrollTop+s,e.scrollTop!==t&&i.scrollTo(e,t,n-10)})}},e.prototype.calcIndex=function(e,n){return e&&e.length&&this.nzHideDisabledOptions?n-e.reduce(function(e,t){return e+(t<n?1:0)},0):n},e.prototype.changed=function(){this.onChange&&this.onChange(this.time.value)},e.prototype.touched=function(){this.onTouch&&this.onTouch()},e.prototype.setClassMap=function(){var e;this.updateCls.updateHostClass(this.element.nativeElement,((e={})[""+this.prefixCls]=!0,e[this.prefixCls+"-column-"+this.enabledColumns]=!this.nzInDatePicker,e[this.prefixCls+"-narrow"]=this.enabledColumns<3,e[this.prefixCls+"-placement-bottomLeft"]=!this.nzInDatePicker,e))},e.prototype.isSelectedHour=function(e){return e.index===this.time.viewHours||!o.isNotNil(this.time.viewHours)&&e.index===this.time.defaultViewHours},e.prototype.isSelectedMinute=function(e){return e.index===this.time.minutes||!o.isNotNil(this.time.minutes)&&e.index===this.time.defaultMinutes},e.prototype.isSelectedSecond=function(e){return e.index===this.time.seconds||!o.isNotNil(this.time.seconds)&&e.index===this.time.defaultSeconds},e.prototype.isSelected12Hours=function(e){return e.value.toUpperCase()===this.time.selected12Hours||!o.isNotNil(this.time.selected12Hours)&&e.value.toUpperCase()===this.time.default12Hours},e.prototype.initPosition=function(){var t=this;setTimeout(function(){if(t.hourEnabled&&t.hourListElement&&(o.isNotNil(t.time.viewHours)?t.scrollToSelected(t.hourListElement.nativeElement,t.time.viewHours,0,"hour"):t.scrollToSelected(t.hourListElement.nativeElement,t.time.defaultViewHours,0,"hour")),t.minuteEnabled&&t.minuteListElement&&(o.isNotNil(t.time.minutes)?t.scrollToSelected(t.minuteListElement.nativeElement,t.time.minutes,0,"minute"):t.scrollToSelected(t.minuteListElement.nativeElement,t.time.defaultMinutes,0,"minute")),t.secondEnabled&&t.secondListElement&&(o.isNotNil(t.time.seconds)?t.scrollToSelected(t.secondListElement.nativeElement,t.time.seconds,0,"second"):t.scrollToSelected(t.secondListElement.nativeElement,t.time.defaultSeconds,0,"second")),t.nzUse12Hours&&t.use12HoursListElement){var e="AM"===(o.isNotNil(t.time.selected12Hours)?t.time.selected12Hours:t.time.default12Hours)?0:1;t.scrollToSelected(t.use12HoursListElement.nativeElement,e,0,"12-hour")}})},e.prototype.ngOnInit=function(){var e=this;this.nzInDatePicker&&(this.prefixCls="ant-calendar-time-picker"),this.time.changes.pipe(u.takeUntil(this.unsubscribe$)).subscribe(function(){e.changed(),e.touched()}),this.buildTimes(),this.setClassMap()},e.prototype.ngOnDestroy=function(){this.unsubscribe$.next(),this.unsubscribe$.complete()},e.prototype.ngOnChanges=function(e){var t=e.nzUse12Hours;t&&!t.previousValue&&t.currentValue&&(this.build12Hours(),this.enabledColumns++)},e.prototype.writeValue=function(e){this.time.setValue(e,this.nzUse12Hours),this.buildTimes(),this.cdr.markForCheck()},e.prototype.registerOnChange=function(e){this.onChange=e},e.prototype.registerOnTouched=function(e){this.onTouch=e},e.decorators=[{type:s.Component,args:[{encapsulation:s.ViewEncapsulation.None,changeDetection:s.ChangeDetectionStrategy.OnPush,selector:"nz-time-picker-panel",exportAs:"nzTimePickerPanel",template:'<div class="{{ nzInDatePicker ? prefixCls + \'-panel\' : \'\' }}">\n <div\n class="{{ prefixCls }}-inner {{ nzInDatePicker ? prefixCls + \'-column-\' + enabledColumns : \'\' }}"\n [style.width.px]="nzInDatePicker ? null : enabledColumns * 56">\n <div class="{{ prefixCls }}-input-wrap">\n <input\n type="text"\n class="{{ prefixCls }}-input"\n [placeholder]="nzPlaceHolder"\n [nzTime]="format"\n [(ngModel)]="time.value"\n (blur)="time.changed()">\n </div>\n <div class="{{ prefixCls }}-combobox">\n <div\n *ngIf="hourEnabled"\n #hourListElement\n class="{{ prefixCls }}-select">\n <ul>\n <ng-container *ngFor="let hour of hourRange">\n <li\n *ngIf="!(nzHideDisabledOptions && hour.disabled)"\n (click)="selectHour(hour)"\n class="\n {{ isSelectedHour(hour) ? prefixCls + \'-select-option-selected\' : \'\' }}\n {{ hour.disabled ? prefixCls + \'-select-option-disabled\' : \'\' }}\n "\n >\n {{ hour.index | number:\'2.0-0\' }}\n </li>\n </ng-container>\n </ul>\n </div>\n <div\n *ngIf="minuteEnabled"\n #minuteListElement\n class="{{ prefixCls }}-select">\n <ul>\n <ng-container *ngFor="let minute of minuteRange">\n <li\n *ngIf="!(nzHideDisabledOptions && minute.disabled)"\n (click)="selectMinute(minute)"\n class="\n {{ isSelectedMinute(minute) ? prefixCls + \'-select-option-selected\' : \'\' }}\n {{ minute.disabled ? prefixCls + \'-select-option-disabled\' : \'\' }}\n "\n >\n {{ minute.index | number:\'2.0-0\' }}\n </li>\n </ng-container>\n </ul>\n </div>\n <div\n *ngIf="secondEnabled"\n #secondListElement\n class="{{ prefixCls }}-select">\n <ul>\n <ng-container *ngFor="let second of secondRange">\n <li\n *ngIf="!(nzHideDisabledOptions && second.disabled)"\n (click)="selectSecond(second)"\n class="\n {{ isSelectedSecond(second) ? prefixCls + \'-select-option-selected\' : \'\' }}\n {{ second.disabled ? prefixCls + \'-select-option-disabled\' : \'\' }}\n "\n >\n {{ second.index | number:\'2.0-0\' }}\n </li>\n </ng-container>\n </ul>\n </div>\n <div\n *ngIf="nzUse12Hours"\n #use12HoursListElement\n class="{{ prefixCls }}-select">\n <ul>\n <ng-container *ngFor="let range of use12HoursRange ">\n <li\n *ngIf="!nzHideDisabledOptions"\n (click)="select12Hours(range)"\n class="\n {{ isSelected12Hours(range) ? prefixCls + \'-select-option-selected\' : \'\' }}\n "\n >\n {{ range.value }}\n </li>\n </ng-container>\n </ul>\n </div>\n </div>\n <div class="{{ prefixCls }}-addon" *ngIf="nzAddOn">\n <ng-template [ngTemplateOutlet]="nzAddOn"></ng-template>\n </div>\n </div>\n</div>',providers:[o.NzUpdateHostClassService,{provide:n.NG_VALUE_ACCESSOR,useExisting:e,multi:!0}]}]}],e.ctorParameters=function(){return[{type:s.ElementRef},{type:o.NzUpdateHostClassService},{type:s.ChangeDetectorRef}]},e.propDecorators={nzTimeValueAccessorDirective:[{type:s.ViewChild,args:[p]}],hourListElement:[{type:s.ViewChild,args:["hourListElement"]}],minuteListElement:[{type:s.ViewChild,args:["minuteListElement"]}],secondListElement:[{type:s.ViewChild,args:["secondListElement"]}],use12HoursListElement:[{type:s.ViewChild,args:["use12HoursListElement"]}],nzInDatePicker:[{type:s.Input}],nzAddOn:[{type:s.Input}],nzHideDisabledOptions:[{type:s.Input}],nzClearText:[{type:s.Input}],nzPlaceHolder:[{type:s.Input}],nzUse12Hours:[{type:s.Input}],nzAllowEmpty:[{type:s.Input}],opened:[{type:s.Input}],nzDefaultOpenValue:[{type:s.Input}],nzDisabledHours:[{type:s.Input}],nzDisabledMinutes:[{type:s.Input}],nzDisabledSeconds:[{type:s.Input}],format:[{type:s.Input}],nzHourStep:[{type:s.Input}],nzMinuteStep:[{type:s.Input}],nzSecondStep:[{type:s.Input}]},function(e,t,n,i){var s,o=arguments.length,r=o<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 u=e.length-1;0<=u;u--)(s=e[u])&&(r=(o<3?s(r):3<o?s(t,n,r):s(t,n))||r);3<o&&r&&Object.defineProperty(t,n,r)}([o.InputBoolean(),function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}("design:type",Object)],e.prototype,"nzUse12Hours",void 0),e}(),b=function(){function e(){}return e.decorators=[{type:s.NgModule,args:[{declarations:[c,m,p],exports:[m,c],imports:[l.CommonModule,n.FormsModule,i.NzI18nModule,t.OverlayModule,a.NzIconModule,o.NzOverlayModule],entryComponents:[]}]}],e}();e.NzTimePickerComponent=c,e.NzTimePickerModule=b,e.NzTimePickerPanelComponent=m,e.NzTimeValueAccessorDirective=p,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-time-picker.umd.min.js.map