-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feature/issue51: add minutesGap input * feature/issue51: add minutesGap tests * feature/issue51: add minutes formatter pipe * ref(timepicker clock face): move logic from component template to ts * feature/issue51: add minutesGap feature to examples and update version
- Loading branch information
Showing
19 changed files
with
206 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...er/components/timepicker-minutes-face/ngx-material-timepicker-minutes-face.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<ngx-material-timepicker-face [faceTime]="minutesList" [selectedTime]="selectedMinute" | ||
[minutesGap]="minutesGap" | ||
(timeChange)="minuteChange.next($event)" [unit]="timeUnit.MINUTE"></ngx-material-timepicker-face> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/app/material-timepicker/pipes/minutes-formatter.pipe.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import {MinutesFormatterPipe} from './minutes-formatter.pipe'; | ||
|
||
describe('MinutesFormatterPipe', () => { | ||
let pipe: MinutesFormatterPipe; | ||
|
||
beforeEach(() => { | ||
pipe = new MinutesFormatterPipe(); | ||
}); | ||
|
||
it('should create an instance', () => { | ||
expect(pipe).toBeTruthy(); | ||
}); | ||
|
||
it('should return undefined or null without formatting', () => { | ||
expect(pipe.transform(undefined)).toBeUndefined(); | ||
expect(pipe.transform(null)).toBeNull(); | ||
}); | ||
|
||
it('should return minute', () => { | ||
expect(pipe.transform(3, 3)).toBe(3); | ||
}); | ||
|
||
it('should return empty string', () => { | ||
expect(pipe.transform(3)).toBe(''); | ||
}); | ||
}); |
16 changes: 16 additions & 0 deletions
16
src/app/material-timepicker/pipes/minutes-formatter.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {Pipe, PipeTransform} from '@angular/core'; | ||
|
||
@Pipe({ | ||
name: 'minutesFormatter' | ||
}) | ||
export class MinutesFormatterPipe implements PipeTransform { | ||
|
||
transform(minute: number, gap = 5): number | string { | ||
if (!minute) { | ||
return minute; | ||
} | ||
|
||
return minute % gap === 0 ? minute : ''; | ||
} | ||
|
||
} |
Oops, something went wrong.