generated from Tinkoff/angular-open-source-starter
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68d19fc
commit 98ce35e
Showing
44 changed files
with
1,380 additions
and
122 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
415 changes: 415 additions & 0 deletions
415
projects/demo-integrations/src/tests/kit/date-time/date-time-meridiem.cy.ts
Large diffs are not rendered by default.
Oops, something went wrong.
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
422 changes: 422 additions & 0 deletions
422
projects/demo-integrations/src/tests/kit/time/time-meridiem.cy.ts
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function range(from: number, to: number): number[] { | ||
return new Array(to - from + 1).fill(null).map((_, i) => from + i); | ||
} | ||
|
||
export function withCaretLabel(value: string, caretIndex: number): string { | ||
return `${value.slice(0, caretIndex)}|${value.slice(caretIndex)}`; | ||
} |
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
38 changes: 38 additions & 0 deletions
38
projects/demo/src/pages/kit/date-time/examples/5-am-pm/component.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,38 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {MaskitoDirective} from '@maskito/angular'; | ||
import {TuiInputModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy'; | ||
|
||
import mask from './mask'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'date-time-mask-doc-example-5', | ||
imports: [ | ||
FormsModule, | ||
MaskitoDirective, | ||
TuiInputModule, | ||
TuiTextfieldControllerModule, | ||
], | ||
template: ` | ||
<tui-input | ||
tuiTextfieldCustomContent="@tui.calendar" | ||
[style.max-width.rem]="30" | ||
[tuiTextfieldFiller]="filler" | ||
[(ngModel)]="value" | ||
> | ||
With 12-hour time format | ||
<input | ||
inputmode="decimal" | ||
tuiTextfieldLegacy | ||
[maskito]="mask" | ||
/> | ||
</tui-input> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class DateTimeMaskDocExample5 { | ||
protected value = '20/09/2020, 03:30 PM'; | ||
protected readonly filler = 'mm/dd/yyyy, hh:mm aa'; | ||
protected readonly mask = mask; | ||
} |
7 changes: 7 additions & 0 deletions
7
projects/demo/src/pages/kit/date-time/examples/5-am-pm/mask.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,7 @@ | ||
import {maskitoDateTimeOptionsGenerator} from '@maskito/kit'; | ||
|
||
export default maskitoDateTimeOptionsGenerator({ | ||
dateMode: 'dd/mm/yyyy', | ||
timeMode: 'HH:MM AA', | ||
dateSeparator: '/', | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
import {maskitoTimeOptionsGenerator} from '@maskito/kit'; | ||
import type {MaskitoOptions} from '@maskito/core'; | ||
import {maskitoUpdateElement} from '@maskito/core'; | ||
import {maskitoEventHandler, maskitoTimeOptionsGenerator} from '@maskito/kit'; | ||
|
||
export default maskitoTimeOptionsGenerator({ | ||
const timeOptions = maskitoTimeOptionsGenerator({ | ||
mode: 'HH:MM:SS', | ||
step: 1, | ||
}); | ||
|
||
export default { | ||
...timeOptions, | ||
plugins: [ | ||
...timeOptions.plugins, | ||
maskitoEventHandler('blur', (element) => { | ||
const [hh = '', mm = '', ss = ''] = element.value.split(':'); | ||
|
||
maskitoUpdateElement( | ||
element, | ||
[hh, mm, ss].map((segment) => segment.padEnd(2, '0')).join(':'), | ||
); | ||
}), | ||
], | ||
} satisfies MaskitoOptions; |
37 changes: 37 additions & 0 deletions
37
projects/demo/src/pages/kit/time/examples/4-time-segments-min-max/component.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,37 @@ | ||
import {ChangeDetectionStrategy, Component} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {MaskitoDirective} from '@maskito/angular'; | ||
import {TuiTextfield} from '@taiga-ui/core'; | ||
import {TuiSegmented} from '@taiga-ui/kit'; | ||
|
||
import mask from './mask'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'time-mask-doc-example-4', | ||
imports: [FormsModule, MaskitoDirective, TuiSegmented, TuiTextfield], | ||
template: ` | ||
<tui-textfield | ||
filler="HH:MM" | ||
[style.max-width.rem]="20" | ||
[tuiTextfieldCleaner]="false" | ||
> | ||
<input | ||
inputmode="decimal" | ||
tuiTextfield | ||
[maskito]="mask" | ||
[(ngModel)]="value" | ||
/> | ||
<tui-segmented> | ||
<button type="button">AM</button> | ||
<button type="button">PM</button> | ||
</tui-segmented> | ||
</tui-textfield> | ||
`, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class TimeMaskDocExample4 { | ||
protected value = '03:30'; | ||
protected readonly mask = mask; | ||
} |
7 changes: 7 additions & 0 deletions
7
projects/demo/src/pages/kit/time/examples/4-time-segments-min-max/mask.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,7 @@ | ||
import {maskitoTimeOptionsGenerator} from '@maskito/kit'; | ||
|
||
export default maskitoTimeOptionsGenerator({ | ||
mode: 'HH:MM', | ||
timeSegmentMaxValues: {hours: 12}, | ||
timeSegmentMinValues: {hours: 1}, | ||
}); |
Oops, something went wrong.