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("@angular/common"),require("ng-zorro-antd/i18n"),require("ng-zorro-antd/icon"),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","@angular/common","ng-zorro-antd/i18n","ng-zorro-antd/icon","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,e.ng.common,e["ng-zorro-antd"].i18n,e["ng-zorro-antd"].icon,e.rxjs,e.rxjs.operators)}(this,function(e,t,n,i,s,o,r,u,l,a){"use strict";function c(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;u>=0;u--)(s=e[u])&&(r=(o<3?s(r):o>3?s(t,n,r):s(t,n))||r);return o>3&&r&&Object.defineProperty(t,n,r),r}function p(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}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||t-- >0)&&!(i=o.next()).done;)r.push(i.value)}catch(e){s={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(s)throw s.error}}return r}var h=function(){function e(e,t,i,s,o){this.nzConfigService=e,this.element=t,this.renderer=i,this.updateCls=s,this.cdr=o,this._value=null,this.isInit=!1,this.overlayPositions=[{originX:"start",originY:"top",overlayX:"end",overlayY:"top",offsetX:0,offsetY:0}],this.nzSize=null,this.nzPlaceHolder="",this.nzDefaultOpenValue=new Date,this.nzOpen=!1,this.nzOpenChange=new n.EventEmitter,this.nzHideDisabledOptions=!1,this.nzDisabled=!1,this.nzAutoFocus=!1}return 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.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(){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]=s.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,i=e.nzDisabled,s=e.nzAutoFocus;if(t&&!t.previousValue&&t.currentValue&&!n&&(this.nzFormat="h:mm:ss a"),i){var o=i.currentValue,r=this.inputRef.nativeElement;o?this.renderer.setAttribute(r,"disabled",""):this.renderer.removeAttribute(r,"disabled")}s&&this.updateAutoFocus()},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:n.Component,args:[{encapsulation:n.ViewEncapsulation.None,changeDetection:n.ChangeDetectionStrategy.OnPush,selector:"nz-time-picker",exportAs:"nzTimePicker",template:'<input\n #inputElement\n nzType="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<span class="ant-time-picker-icon">\n <i nz-icon nzType="clock-circle"></i>\n</span>\n<i\n *ngIf="nzAllowEmpty && value"\n nz-icon\n nzType="close-circle"\n nzTheme="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:[s.slideMotion],providers:[s.NzUpdateHostClassService,{provide:i.NG_VALUE_ACCESSOR,useExisting:e,multi:!0}]}]}],e.ctorParameters=function(){return[{type:s.NzConfigService},{type:n.ElementRef},{type:n.Renderer2},{type:s.NzUpdateHostClassService},{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}],nzOpenChange:[{type:n.Output}],nzHideDisabledOptions:[{type:n.Input}],nzAllowEmpty:[{type:n.Input}],nzDisabled:[{type:n.Input}],nzAutoFocus:[{type:n.Input}]},c([s.WithConfig(1),p("design:type",Number)],e.prototype,"nzHourStep",void 0),c([s.WithConfig(1),p("design:type",Number)],e.prototype,"nzMinuteStep",void 0),c([s.WithConfig(1),p("design:type",Number)],e.prototype,"nzSecondStep",void 0),c([s.WithConfig("clear"),p("design:type",String)],e.prototype,"nzClearText",void 0),c([s.WithConfig(),p("design:type",String)],e.prototype,"nzPopupClassName",void 0),c([s.WithConfig("HH:mm:ss"),p("design:type",String)],e.prototype,"nzFormat",void 0),c([s.WithConfig(!1),s.InputBoolean(),p("design:type",Boolean)],e.prototype,"nzUse12Hours",void 0),c([s.InputBoolean(),p("design:type",Object)],e.prototype,"nzHideDisabledOptions",void 0),c([s.WithConfig(!0),s.InputBoolean(),p("design:type",Boolean)],e.prototype,"nzAllowEmpty",void 0),c([s.InputBoolean(),p("design:type",Object)],e.prototype,"nzDisabled",void 0),c([s.InputBoolean(),p("design:type",Object)],e.prototype,"nzAutoFocus",void 0),e}();var f=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:n.Directive,args:[{selector:"input[nzTime]",exportAs:"nzTime",providers:[{provide:i.NG_VALUE_ACCESSOR,useExisting:e,multi:!0}]}]}],e.ctorParameters=function(){return[{type:r.DateHelperService},{type:n.ElementRef}]},e.propDecorators={nzTime:[{type:n.Input}],keyup:[{type:n.HostListener,args:["keyup"]}],blur:[{type:n.HostListener,args:["blur"]}]},e}();var m=function(){function e(){this._seconds=void 0,this._hours=void 0,this._minutes=void 0,this._selected12Hours=void 0,this._use12Hours=!1,this._defaultOpenValue=new Date,this._changes=new l.Subject}return e.prototype.setDefaultValueIfNil=function(){s.isNotNil(this._value)||(this._value=new Date(this.defaultOpenValue))},e.prototype.setMinutes=function(e,t){return t?this:(this.setDefaultValueIfNil(),this.minutes=e,this)},e.prototype.setHours=function(e,t){return t?this:(this.setDefaultValueIfNil(),this.hours=e,this)},e.prototype.setSeconds=function(e,t){return t?this:(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,s.isNotNil(this._value)?(this._hours=this._value.getHours(),this._minutes=this._value.getMinutes(),this._seconds=this._value.getSeconds(),this._use12Hours&&s.isNotNil(this._hours)&&(this._selected12Hours=this._hours>=12?"PM":"AM")):this._clear())},enumerable:!0,configurable:!0}),e.prototype.setValue=function(e,t){return s.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!(s.isNotNil(this._hours)||s.isNotNil(this._minutes)||s.isNotNil(this._seconds))},enumerable:!0,configurable:!0}),e.prototype._clear=function(){this._hours=void 0,this._minutes=void 0,this._seconds=void 0,this._selected12Hours=void 0},e.prototype.update=function(){this.isEmpty?this._value=void 0:(s.isNotNil(this._hours)?this._value.setHours(this.hours):this._hours=this.defaultHours,s.isNotNil(this._minutes)?this._value.setMinutes(this.minutes):this._minutes=this.defaultMinutes,s.isNotNil(this._seconds)?this._value.setSeconds(this.seconds):this._seconds=this.defaultSeconds,this._use12Hours&&(s.isNotNil(this._selected12Hours)||(this._selected12Hours=this.default12Hours),"PM"===this.selected12Hours&&this._hours<12&&(this._hours+=12,this._value.setHours(this._hours)),"AM"===this.selected12Hours&&this._hours>=12&&(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&&s.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&&s.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 this._defaultOpenValue.getHours()>=12?"PM":"AM"},enumerable:!0,configurable:!0}),e.prototype.calculateViewHour=function(e){var t=this._selected12Hours||this.default12Hours;return"PM"===t&&e>12?e-12:"AM"===t&&0===e?12:e},e}();function y(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 b=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 l.Subject,this._format="HH:mm:ss",this._allowEmpty=!0,this.prefixCls="ant-time-picker-panel",this.time=new m,this.hourEnabled=!0,this.minuteEnabled=!0,this.secondEnabled=!0,this.enabledColumns=3,this.nzInDatePicker=!1,this.nzHideDisabledOptions=!1,this.nzUse12Hours=!1,this.opened=!1,this.nzDefaultOpenValue=new Date}return Object.defineProperty(e.prototype,"nzAllowEmpty",{get:function(){return this._allowEmpty},set:function(e){s.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){s.isNotNil(e)&&(this._disabledMinutes=e,this.buildMinutes())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzDisabledSeconds",{get:function(){return this._disabledSeconds},set:function(e){s.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(s.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){s.isNotNil(e)&&(this._nzHourStep=e,this.buildHours())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzMinuteStep",{get:function(){return this._nzMinuteStep},set:function(e){s.isNotNil(e)&&(this._nzMinuteStep=e,this.buildMinutes())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nzSecondStep",{get:function(){return this._nzSecondStep},set:function(e){s.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=this,t=24,n=this.nzDisabledHours&&this.nzDisabledHours(),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=y(t,this.nzHourStep,i).map(function(t){return{index:t,disabled:e.nzDisabledHours&&-1!==n.indexOf(t)}}),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 e=this;this.minuteRange=y(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=y(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.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 o=(t-e.scrollTop)/n*10;s.reqAnimFrame(function(){e.scrollTop=e.scrollTop+o,e.scrollTop!==t&&i.scrollTo(e,t,n-10)})}},e.prototype.calcIndex=function(e,t){return e&&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.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||!s.isNotNil(this.time.viewHours)&&e.index===this.time.defaultViewHours},e.prototype.isSelectedMinute=function(e){return e.index===this.time.minutes||!s.isNotNil(this.time.minutes)&&e.index===this.time.defaultMinutes},e.prototype.isSelectedSecond=function(e){return e.index===this.time.seconds||!s.isNotNil(this.time.seconds)&&e.index===this.time.defaultSeconds},e.prototype.isSelected12Hours=function(e){return e.value.toUpperCase()===this.time.selected12Hours||!s.isNotNil(this.time.selected12Hours)&&e.value.toUpperCase()===this.time.default12Hours},e.prototype.initPosition=function(){var e=this;setTimeout(function(){if(e.hourEnabled&&e.hourListElement&&(s.isNotNil(e.time.viewHours)?e.scrollToSelected(e.hourListElement.nativeElement,e.time.viewHours,0,"hour"):e.scrollToSelected(e.hourListElement.nativeElement,e.time.defaultViewHours,0,"hour")),e.minuteEnabled&&e.minuteListElement&&(s.isNotNil(e.time.minutes)?e.scrollToSelected(e.minuteListElement.nativeElement,e.time.minutes,0,"minute"):e.scrollToSelected(e.minuteListElement.nativeElement,e.time.defaultMinutes,0,"minute")),e.secondEnabled&&e.secondListElement&&(s.isNotNil(e.time.seconds)?e.scrollToSelected(e.secondListElement.nativeElement,e.time.seconds,0,"second"):e.scrollToSelected(e.secondListElement.nativeElement,e.time.defaultSeconds,0,"second")),e.nzUse12Hours&&e.use12HoursListElement){var t="AM"===(s.isNotNil(e.time.selected12Hours)?e.time.selected12Hours:e.time.default12Hours)?0:1;e.scrollToSelected(e.use12HoursListElement.nativeElement,t,0,"12-hour")}})},e.prototype.ngOnInit=function(){var e=this;this.nzInDatePicker&&(this.prefixCls="ant-calendar-time-picker"),this.time.changes.pipe(a.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,n=e.opened,i=e.nzDefaultOpenValue;if(t&&!t.previousValue&&t.currentValue&&(this.build12Hours(),this.enabledColumns++),n&&n.currentValue&&(this.initPosition(),this.selectInputRange()),i){var o=i.currentValue;s.isNotNil(o)&&this.time.setDefaultOpenValue(this.nzDefaultOpenValue)}},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:n.Component,args:[{encapsulation:n.ViewEncapsulation.None,changeDetection:n.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:[s.NzUpdateHostClassService,{provide:i.NG_VALUE_ACCESSOR,useExisting:e,multi:!0}]}]}],e.ctorParameters=function(){return[{type:n.ElementRef},{type:s.NzUpdateHostClassService},{type:n.ChangeDetectorRef}]},e.propDecorators={nzTimeValueAccessorDirective:[{type:n.ViewChild,args:[f,{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}],opened:[{type:n.Input}],nzDefaultOpenValue:[{type:n.Input}],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}]},c([s.InputBoolean(),p("design:type",Object)],e.prototype,"nzUse12Hours",void 0),e}();var g=function(){function e(){}return e.decorators=[{type:n.NgModule,args:[{declarations:[h,b,f],exports:[b,h],imports:[o.CommonModule,i.FormsModule,r.NzI18nModule,t.OverlayModule,u.NzIconModule,s.NzOverlayModule]}]}],e}();e.NzTimePickerComponent=h,e.NzTimePickerModule=g,e.NzTimePickerPanelComponent=b,e.NzTimeValueAccessorDirective=f,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ng-zorro-antd-time-picker.umd.min.js.map