Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 1x 1x 1x 1x 1x 6x 6x 6x 6x 6x 6x 6x 3x 1x 7x 7x 7x 7x 1x 7x 6x 6x 1x 3x 1x 3x 1x 2x 2x 1x 2x 1x | import { Directive, Optional, ElementRef, Inject, AfterViewInit, LOCALE_ID, Self, EventEmitter, Input, HostBinding, HostListener, OnChanges } from '@angular/core'; import {TENANT_MERIDIEM, TENANT_TIMEZONE_STRING} from '../../common/interfaces/Tokens'; import {ControlValueAccessor, NgControl} from '@angular/forms'; @Directive({ selector: 'anj-input[anjTimePicker]', exportAs: 'anjTimepickerInput' }) export class TimePickerDirective implements AfterViewInit, ControlValueAccessor { public readonly valueChange: EventEmitter<string | null>; @HostBinding('value') public value: string; constructor(private _element: ElementRef, @Optional() @Self() private ngControl?: NgControl, @Optional() @Inject(LOCALE_ID) private _locale?: string, @Optional() @Inject(TENANT_TIMEZONE_STRING) private _timezone?: string, @Optional() @Inject(TENANT_MERIDIEM) private _meridiem?: string) { this.valueChange = new EventEmitter<string | null>(); if (this.ngControl) { this.ngControl.valueAccessor = this; } } ngAfterViewInit() { const picker = this._element.nativeElement.children[0]; picker.setAttribute('locale', this._locale); picker.setAttribute('meridiem', this._meridiem); picker.setAttribute('timezone', this._timezone); } // // Start: ControlValueAccessor requirements public writeValue(newValue: string): void { this.value = newValue; } public onChange: Function = () => { } public onTouch: Function = () => { } public registerOnChange(fn: any): void { this.onChange = fn; } public registerOnTouched(fn: any): void { this.onTouch = fn; } // // End: ControlValueAccessor requirements @HostListener('anjTimeChanged', ['$event']) public onInput(event: any) { this.value = event.detail; if (this.ngControl) { this.ngControl.control.setValue(this.value); } this.valueChange.emit(this.value); } } |