-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docs): adding timepicker range example (#390)
- Loading branch information
1 parent
04921ce
commit f90b82a
Showing
6 changed files
with
87 additions
and
2 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
10 changes: 10 additions & 0 deletions
10
packages/mosaic-examples/mosaic/timepicker/timepicker-range/timepicker-range-example.css
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,10 @@ | ||
.example-timepicker-group { | ||
display: inline-flex; | ||
flex-direction: column; | ||
} | ||
|
||
.example-timepicker-element { | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 10px; | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/mosaic-examples/mosaic/timepicker/timepicker-range/timepicker-range-example.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<div class="example-timepicker-group"> | ||
<div class="example-timepicker-element"> | ||
<label for="Time" | ||
class="flex-35 mc-form-label">Выберите время между min и max</label> | ||
<mc-form-field > | ||
<i mcPrefix mc-icon="mc-clock_16"></i> | ||
<input mcTimepicker | ||
id="Time" | ||
[min-time]="getStartTime()" | ||
[max-time]="getEndTime()" | ||
[(ngModel)]="time"> | ||
</mc-form-field> | ||
</div> | ||
|
||
<div class="example-timepicker-element"> | ||
<label for="startTime" | ||
class="flex-35 mc-form-label">min</label> | ||
<mc-form-field > | ||
<input mcTimepicker | ||
id="startTime" | ||
[(ngModel)]="startTime"> | ||
</mc-form-field> | ||
</div> | ||
|
||
<div class="example-timepicker-element"> | ||
<label for="endTime" | ||
class="flex-35 mc-form-label">max</label> | ||
<mc-form-field > | ||
<input mcTimepicker | ||
id="endTime" | ||
[(ngModel)]="endTime"> | ||
</mc-form-field> | ||
</div> | ||
</div> |
33 changes: 33 additions & 0 deletions
33
packages/mosaic-examples/mosaic/timepicker/timepicker-range/timepicker-range-example.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,33 @@ | ||
import { Component } from '@angular/core'; | ||
import * as momentImported from 'moment'; | ||
// @ts-ignore | ||
// tslint:disable-next-line:no-duplicate-imports | ||
import { default as _rollupMoment } from 'moment'; | ||
|
||
|
||
// tslint:disable-next-line | ||
const moment = _rollupMoment || momentImported; | ||
/** | ||
* @title Timepicker range | ||
*/ | ||
@Component({ | ||
selector: 'timepicker-range-example', | ||
templateUrl: 'timepicker-range-example.html', | ||
styleUrls: ['timepicker-range-example.css'] | ||
}) | ||
export class TimepickerRangeExample { | ||
moment = moment; | ||
format = 'HH:mm:ss'; | ||
|
||
startTime = this.moment().startOf('day'); | ||
endTime = this.moment(); | ||
time = this.moment().startOf('hour'); | ||
|
||
getStartTime() { | ||
return this.startTime ? this.startTime.format(this.format) : ''; | ||
} | ||
|
||
getEndTime() { | ||
return this.endTime ? this.endTime.format(this.format) : ''; | ||
} | ||
} |
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 +1,7 @@ | ||
<!-- example(timepicker-overview) --> | ||
|
||
#### Timepicker min max range | ||
Параметры min max должны быть строками определенного формата: `16:00:00`, | ||
в данном примере тип Moment приводится к нужному формату соответствующей функцией: `moment().format('HH:mm:ss')` | ||
|
||
<!-- example(timepicker-range) --> |