Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
e309406
refactor(time-picker): initial refactoring #6482
PlamenaMiteva Feb 10, 2021
0dd4ae4
Merge branch 'pickers-refactoring' of https://github.com/IgniteUI/ign…
PlamenaMiteva Feb 10, 2021
0c5adc9
refactor(time-picker): add dialog orientaation #6482
PlamenaMiteva Feb 10, 2021
54b14e0
refactor(time-picker): in/decrement and spinning refactoring #6482
PlamenaMiteva Feb 11, 2021
b7acbac
Merge branch 'pickers-refactoring' into PMiteva/time-picker-refactoring
PlamenaMiteva Feb 16, 2021
a02af40
refactor(time-picker): valueChange & validationFailed events refactor…
PlamenaMiteva Feb 16, 2021
1c80641
Merge branch 'PMiteva/time-picker-refactoring' of https://github.com/…
PlamenaMiteva Feb 16, 2021
6dc5451
chore(time-picker): fix typo in package-lock.json
PlamenaMiteva Feb 16, 2021
6f5ef51
refactor(time-picker): add validation refactoring #6482
PlamenaMiteva Feb 18, 2021
d75263b
refactor(time-picker): fix dialog header format #6482
PlamenaMiteva Feb 22, 2021
9c34e2a
refactor(time-picker): refactoring tests #6482
PlamenaMiteva Feb 26, 2021
575b01c
Merge branch 'pickers-refactoring' of https://github.com/IgniteUI/ign…
PlamenaMiteva Mar 1, 2021
43f4222
Update projects/igniteui-angular/src/lib/time-picker/time-picker.comp…
PlamenaMiteva Mar 1, 2021
efa390b
Update projects/igniteui-angular/src/lib/time-picker/time-picker.comp…
PlamenaMiteva Mar 1, 2021
c154bb6
refactor(time-picker): addressing comments #6482
PlamenaMiteva Mar 11, 2021
f93a9c9
Merge branch 'PMiteva/time-picker-refactoring' of https://github.com/…
PlamenaMiteva Mar 11, 2021
633bb0c
Merge branch 'pickers-refactoring' into PMiteva/time-picker-refactoring
PlamenaMiteva Mar 11, 2021
f116c9b
Merge branch 'pickers-refactoring' of https://github.com/IgniteUI/ign…
PlamenaMiteva Apr 2, 2021
c4d528f
refactor(time-picker): add time pipe #6482
PlamenaMiteva Apr 2, 2021
f28fda0
refactor(time-picker): container refactoring #6482
PlamenaMiteva Apr 8, 2021
be97844
Merge branch 'pickers-refactoring' of https://github.com/IgniteUI/ign…
PlamenaMiteva Apr 8, 2021
eab163d
Merge branch 'PMiteva/time-picker-refactoring' of https://github.com/…
PlamenaMiteva Apr 8, 2021
e155b2e
refactor(time-picker): incorporate ISO format implementation #6482
PlamenaMiteva Apr 9, 2021
384818f
refactor(time-picker): add input/display format validation #6482
PlamenaMiteva Apr 9, 2021
0a0e710
refactor(time-picker): add input/display format validation #6482
PlamenaMiteva Apr 9, 2021
1e40a76
Merge branch 'PMiteva/time-picker-refactoring' of https://github.com/…
PlamenaMiteva Apr 9, 2021
e9794ec
refactor(time-picker): fix typos #6482
PlamenaMiteva Apr 9, 2021
677eb48
refactor(time-picker): remove spinDelta #6482
PlamenaMiteva Apr 13, 2021
f2c8cac
test(time-picker): fix failing tests #6482
PlamenaMiteva Apr 13, 2021
304daed
refactor(time-picker): add aria attributes #6482
PlamenaMiteva Apr 14, 2021
6e0ec31
refactor(time-picker): fix lint errors #6482
PlamenaMiteva Apr 14, 2021
7e3c840
refactor(time-picker): fix lint errors #6482
PlamenaMiteva Apr 14, 2021
2071cc1
Merge branch 'PMiteva/time-picker-refactoring' of https://github.com/…
PlamenaMiteva Apr 14, 2021
d233a17
Merge branch 'pickers-refactoring' into PMiteva/time-picker-refactoring
PlamenaMiteva Apr 15, 2021
77d7e28
refactor(time-picker): addressing comments #6482
PlamenaMiteva Apr 15, 2021
c397f18
Merge branch 'PMiteva/time-picker-refactoring' of https://github.com/…
PlamenaMiteva Apr 15, 2021
9a95535
refactor(time-picker): include platformUtil #6482
PlamenaMiteva Apr 15, 2021
ef058be
refactor(time-picker): addressing comments #6482
PlamenaMiteva Apr 16, 2021
c82f73c
refactor(time-picker): fix lint errors #6482
PlamenaMiteva Apr 16, 2021
fad482d
refactor(time-picker): fix failing tests #6482
PlamenaMiteva Apr 16, 2021
ae279d8
refactor(time-picker): add aria attributes to selected items #6482
PlamenaMiteva Apr 18, 2021
7dc7fbd
refactor(time-picker): revert tabs component #6482
PlamenaMiteva Apr 19, 2021
fbdaa1a
Merge branch 'pickers-refactoring' of https://github.com/IgniteUI/ign…
PlamenaMiteva Apr 19, 2021
304a0a3
refactor(time-picker): remove fontSet #6482
PlamenaMiteva Apr 19, 2021
ac685cb
Merge branch 'pickers-refactoring' of https://github.com/IgniteUI/ign…
PlamenaMiteva Apr 19, 2021
8e24a34
refactor(time-picker): add readOnly property #6482
PlamenaMiteva Apr 19, 2021
7185716
refactor(time-picker): fix time picker settings in grid templates #6482
PlamenaMiteva Apr 19, 2021
f19b98b
refactor(time-picker): fix typos #6482
PlamenaMiteva Apr 19, 2021
4c1ef00
refactor(time-picker): addressing comments #6482
PlamenaMiteva Apr 19, 2021
1b5c9ab
refactor(time-picker): remove unnecessary event subscription #6482
PlamenaMiteva Apr 19, 2021
8e25f92
refactor(time-picker): add HostListner on keydown event #6482
PlamenaMiteva Apr 19, 2021
fa790a6
chore(time-picker): fix typos #6482
PlamenaMiteva Apr 19, 2021
92d3351
chore(time-picker): move host listener up #6482
PlamenaMiteva Apr 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export abstract class PickersBaseDirective extends DisplayDensityBase implements
* ```
*/
@Input()
public mode = InteractionMode.Dialog;
public mode: InteractionMode = InteractionMode.DropDown;

/**
* Custom overlay settings that will be used to display the calendar.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ const enum DateParts {
/** @hidden */
export abstract class DatePickerUtil {
public static readonly DEFAULT_INPUT_FORMAT = 'MM/dd/yyyy';
static DEFAULT_TIME_INPUT_FORMAT = 'hh:mm tt';
static DEFAULT_TIME_FORMAT = 'hh:mm a';
// TODO: this is the def mask for the date-picker, should remove it during refactoring
private static readonly SHORT_DATE_MASK = 'MM/dd/yy';
private static readonly SEPARATOR = 'literal';
private static readonly NUMBER_OF_MONTHS = 12;
private static readonly PROMPT_CHAR = '_';
private static readonly DEFAULT_LOCALE = 'en';

/**
* TODO: (in issue #6483) Unit tests and docs for all public methods.
*/
Expand Down Expand Up @@ -346,16 +347,16 @@ export abstract class DatePickerUtil {
* @param minValue The lowest possible value that `value` can take
* @param maxValue The largest possible value that `value` can take
*/
public static validateMinMax(value: Date, minValue: Date | string, maxValue: Date | string): ValidationErrors | null {
public static validateMinMax(value: Date, minValue: Date | string, maxValue: Date | string, includeTime = false, includeDate = true): ValidationErrors | null {
const errors = {};
const min = DatePickerUtil.parseDate(minValue);
const max = DatePickerUtil.parseDate(maxValue);
if ((min && value && DatePickerUtil.lessThanMinValue(value, min, false))
|| (min && value && DatePickerUtil.lessThanMinValue(value, min, false))) {
if ((min && value && DatePickerUtil.lessThanMinValue(value, min, includeTime, includeDate))
|| (min && value && DatePickerUtil.lessThanMinValue(value, min, includeTime, includeDate))) {
Object.assign(errors, { minValue: true });
}
if ((max && value && DatePickerUtil.greaterThanMaxValue(value, max, false))
|| (max && value && DatePickerUtil.greaterThanMaxValue(value, max, false))) {
if ((max && value && DatePickerUtil.greaterThanMaxValue(value, max, includeTime, includeDate))
|| (max && value && DatePickerUtil.greaterThanMaxValue(value, max, includeTime, includeDate))) {
Object.assign(errors, { maxValue: true });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,10 @@ export class IgxDateTimeEditorDirective extends IgxMaskDirective implements OnCh
return this.maskParser.applyMask(null, this.maskOptions);
}

private get targetDatePart(): DatePart {
/**
* @hidden @internal
*/
public get targetDatePart(): DatePart {
if (this.document.activeElement === this.nativeElement) {
return this._inputDateParts
.find(p => p.start <= this.selectionStart && this.selectionStart <= p.end && p.type !== DatePart.Literal)?.type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export interface IgxTimePickerBase {
selectedMinute: string;
selectedSeconds: string;
selectedAmPm: string;
format: string;
promptChar: string;
cleared: boolean;
mode: InteractionMode;
showHoursList: boolean;
Expand All @@ -45,6 +43,5 @@ export interface IgxTimePickerBase {
scrollSecondsIntoView(item: string): void;
scrollAmPmIntoView(item: string): void;
close(): void;
parseMask(preserveAmPm?: boolean): string;
}

Original file line number Diff line number Diff line change
@@ -1,51 +1,49 @@
<ng-template #labelTemplate>
<ng-content select="[igxLabel]"></ng-content>
</ng-template>
<igx-input-group [suppressInputAutofocus]="this.isDropdown" (click)="!this.isDropdown && open()">
<input igxInput [igxDateTimeEditor]="this.inputFormat" type="text"
[readonly]="!this.isDropdown"
[preventSpinOnWheel]="!this.isDropdown"
[disabled]="this.disabled"
[displayFormat]="this.displayFormat"
[placeholder]="this.placeholder"
role="combobox" aria-haspopup="dialog"
[attr.aria-expanded]="!toggle.collapsed"
[attr.aria-labelledby]="this.label?.id"
/>

<igx-prefix *ngIf="!this.toggleComponents.length" (click)="open()">
<ng-container *ngTemplateOutlet="defaultToggleIcon"></ng-container>
</igx-prefix>

<igx-suffix *ngIf="showClearButton" igxRipple (click)="clear()">
<ng-container *ngTemplateOutlet="defaultClearIcon"></ng-container>
</igx-suffix>

<ng-template #dropdownInputTemplate>
<igx-input-group #group (mousedown)="mouseDown($event)" [suppressInputAutofocus]="true">
<label igxLabel *ngIf="!labelDirective">Time</label>
<ng-container ngProjectAs="[igxLabel]" *ngTemplateOutlet="labelTemplate"></ng-container>
<igx-prefix (click)="openDialog(group.element.nativeElement)">
<igx-icon>access_time</igx-icon>
</igx-prefix>
<input
type="text"
[igxMask]="mask"
igxInput
[includeLiterals]="true"
[placeholder]="format"
[displayValuePipe]="displayFormat"
[focusedValuePipe]="inputFormat"
[promptChar]="promptChar"
[value]="displayValue"
[igxTextSelection]="true"
(input)="onInput($event)"
(blur)="onBlur($event)"
(focus)="onFocus($event)"
(wheel)="spinOnEdit($event)"
[disabled]="disabled" />
<igx-suffix *ngIf="showClearButton" igxRipple (click)="clear()">
<igx-icon>clear</igx-icon>
</igx-suffix>
<ng-container ngProjectAs="[igxLabel]">
<ng-content select="[igxLabel]"></ng-content>
</ng-container>
<ng-container ngProjectAs="igx-prefix">
<ng-content select="igx-prefix,[igxPrefix]"></ng-content>
</ng-container>
<ng-container ngProjectAs="igx-suffix">
<ng-content select="igx-suffix,[igxSuffix]"></ng-content>
</ng-container>
<ng-container ngProjectAs="igx-hint">
<ng-content select="igx-hint,[igxHint]"></ng-content>
</ng-container>
</igx-input-group>


<ng-template #defaultToggleIcon>
<igx-icon fontSet="material">
access_time
</igx-icon>
</ng-template>
<ng-template #defaultTimePickerTemplate>
<igx-input-group (click)="openDialog()" (mousedown)="mouseDown($event)">
<igx-prefix>
<igx-icon>access_time</igx-icon>
</igx-prefix>
<label igxLabel *ngIf="!labelDirective">Time</label>
<ng-container ngProjectAs="[igxLabel]" *ngTemplateOutlet="labelTemplate"></ng-container>
<input
igxInput
[value]="displayTime || ''"
[disabled]="disabled"
tabindex="0" readonly
(blur)="onBlur($event)" />
</igx-input-group>

<ng-template #defaultClearIcon>
<igx-icon fontSet="material">
clear
</igx-icon>
</ng-template>
<ng-container *ngTemplateOutlet="template; context: context"></ng-container>

<ng-template #defaultTimePickerActions>
<div *ngIf="cancelButtonLabel || okButtonLabel" class="igx-time-picker__buttons">
Expand All @@ -57,35 +55,37 @@
</button>
</div>
</ng-template>
<div igxToggle class="igx-time-picker"
[ngClass]="{'igx-time-picker--dropdown': mode === 'dropdown', 'igx-time-picker--vertical': vertical && mode === 'dialog'}">
<div *ngIf="mode === 'dialog'" class="igx-time-picker__header">


<div #toggle="toggle" igxToggle class="igx-time-picker"
[ngClass]="{'igx-time-picker--dropdown': this.isDropdown, 'igx-time-picker--vertical': this.isVertical && !this.isDropdown}">
<div *ngIf="!this.isDropdown" class="igx-time-picker__header">
<h5 class="igx-time-picker__header-ampm">{{ selectedAmPm }}</h5>
<h2 class="igx-time-picker__header-hour">
<span>{{ selectedHour }}</span>:<span>{{ selectedMinute }}</span>:<span>{{ selectedSeconds }}</span>
<span *ngIf="showHoursList">{{ selectedHour }}</span><span *ngIf="showMinutesList">:{{ selectedMinute }}</span><span *ngIf="showSecondsList">:{{ selectedSeconds }}</span>
</h2>
</div>
<div class="igx-time-picker__main">
<div class="igx-time-picker__body">
<div *ngIf="showHoursList" #hourList [igxItemList]="'hourList'">
<span [igxHourItem]="hour"
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(timeParts.Hour, hour)}"
*ngFor="let hour of hourView">{{ hour }}</span>
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(timeParts.Hour, hour)}"
*ngFor="let hour of hourView">{{ hour }}</span>
</div>
<div *ngIf="showMinutesList" #minuteList [igxItemList]="'minuteList'">
<span [igxMinuteItem]="minute"
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(timeParts.Minute, minute)}"
*ngFor="let minute of minuteView" >{{ minute }}</span>
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(timeParts.Minute, minute)}"
*ngFor="let minute of minuteView">{{ minute }}</span>
</div>
<div *ngIf="showSecondsList" #secondsList [igxItemList]="'secondsList'">
<span [igxSecondsItem]="seconds"
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(timeParts.Seconds, seconds)}"
*ngFor="let seconds of secondsView">{{ seconds }}</span>
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(timeParts.Seconds, seconds)}"
*ngFor="let seconds of secondsView">{{ seconds }}</span>
</div>
<div *ngIf="showAmPmList" #ampmList [igxItemList]="'ampmList'">
<span [igxAmPmItem]="ampm"
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(timeParts.AMPM, ampm)}"
*ngFor="let ampm of ampmView">{{ ampm }}</span>
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(timeParts.AMPM, ampm)}"
*ngFor="let ampm of ampmView">{{ ampm }}</span>
</div>
</div>
<ng-container
Expand Down
Loading