Skip to content

Commit 5f70905

Browse files
committed
fix(time-picker): More code refactoring. #3978
1 parent 29eb672 commit 5f70905

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

projects/igniteui-angular/src/lib/time-picker/time-picker.common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface IgxTimePickerBase {
4141
}
4242

4343
/** @hidden */
44-
export const enum TimeParts {
44+
export enum TimeParts {
4545
Hour = 'hour',
4646
Minute = 'minute',
4747
Seconds = 'seconds',

projects/igniteui-angular/src/lib/time-picker/time-picker.component.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,22 @@ <h2 class="igx-time-picker__header-hour">
6262
<div class="igx-time-picker__body">
6363
<div *ngIf="showHoursList" #hourList [igxItemList]="'hourList'">
6464
<span [igxHourItem]="hour"
65-
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem('hour', hour)}"
65+
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(TimeParts.Hour, hour)}"
6666
*ngFor="let hour of hourView">{{ hour }}</span>
6767
</div>
6868
<div *ngIf="showMinutesList" #minuteList [igxItemList]="'minuteList'">
6969
<span [igxMinuteItem]="minute"
70-
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem('minute', minute)}"
70+
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(TimeParts.Minute, minute)}"
7171
*ngFor="let minute of minuteView" >{{ minute }}</span>
7272
</div>
7373
<div *ngIf="showSecondsList" #secondsList [igxItemList]="'secondsList'">
7474
<span [igxSecondsItem]="seconds"
75-
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem('seconds', seconds)}"
75+
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(TimeParts.Seconds, seconds)}"
7676
*ngFor="let seconds of secondsView">{{ seconds }}</span>
7777
</div>
7878
<div *ngIf="showAmPmList" #ampmList [igxItemList]="'ampmList'">
7979
<span [igxAmPmItem]="ampm"
80-
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem('ampm', ampm)}"
80+
[ngClass]="{'igx-time-picker__item--disabled': applyDisabledStyleForItem(TimeParts.amPM, ampm)}"
8181
*ngFor="let ampm of ampmView">{{ ampm }}</span>
8282
</div>
8383
</div>

projects/igniteui-angular/src/lib/time-picker/time-picker.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ const noop = () => { };
9999
}`
100100
]
101101
})
102+
102103
export class IgxTimePickerComponent implements
103104
IgxTimePickerBase,
104105
ControlValueAccessor,
@@ -153,6 +154,7 @@ export class IgxTimePickerComponent implements
153154
this.onValidationFailed.emit(args);
154155
}
155156
}
157+
TimeParts: any = Object.assign({}, TimeParts);
156158

157159
/**
158160
* An accessor that returns the value of `igx-time-picker` component.

0 commit comments

Comments
 (0)