-
Notifications
You must be signed in to change notification settings - Fork 463
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
Showing
27 changed files
with
946 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {FormControl, Validators} from '@angular/forms'; | ||
import {TuiSizeL, TuiSizeS} from '@taiga-ui/core'; | ||
|
||
import {AbstractExampleTuiControl} from './control'; | ||
|
||
export abstract class AbstractExampleTuiMulti extends AbstractExampleTuiControl { | ||
readonly control = new FormControl([], Validators.required); | ||
|
||
override readonly sizeVariants: ReadonlyArray<TuiSizeL | TuiSizeS> = [`s`, `m`, `l`]; | ||
override size: TuiSizeL | TuiSizeS = this.sizeVariants[this.sizeVariants.length - 1]; | ||
|
||
readonly rowsVariants = [Infinity, 100, 10, 3, 2]; | ||
rows = this.rowsVariants[1]; | ||
|
||
expandable = false; | ||
|
||
editable = true; | ||
|
||
uniqueTags = true; | ||
|
||
inputHidden = false; | ||
|
||
search: string | null = ``; | ||
} |
9 changes: 9 additions & 0 deletions
9
projects/demo/src/modules/components/input-date-multi/examples/1/index.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,9 @@ | ||
<form [formGroup]="testForm"> | ||
<tui-input-date | ||
formControlName="testValue" | ||
multiple | ||
[tuiTextfieldLabelOutside]="true" | ||
> | ||
Choose a dates | ||
</tui-input-date> | ||
</form> |
21 changes: 21 additions & 0 deletions
21
projects/demo/src/modules/components/input-date-multi/examples/1/index.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,21 @@ | ||
import {Component} from '@angular/core'; | ||
import {FormControl, FormGroup} from '@angular/forms'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {encapsulation} from '@demo/emulate/encapsulation'; | ||
import {TuiDay} from '@taiga-ui/cdk'; | ||
|
||
@Component({ | ||
selector: 'tui-input-date-multi-example-1', | ||
templateUrl: './index.html', | ||
changeDetection, | ||
encapsulation, | ||
}) | ||
export class TuiInputDateMultiExample1 { | ||
readonly testForm = new FormGroup({ | ||
testValue: new FormControl([ | ||
new TuiDay(2017, 0, 7), | ||
new TuiDay(2017, 0, 10), | ||
new TuiDay(2017, 0, 15), | ||
]), | ||
}); | ||
} |
12 changes: 12 additions & 0 deletions
12
...ts/demo/src/modules/components/input-date-multi/examples/import/declare-form.md
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,12 @@ | ||
```ts | ||
import {FormControl, FormGroup} from '@angular/forms'; | ||
|
||
@Component({ | ||
// ... | ||
}) | ||
export class MyComponent { | ||
testForm = new FormGroup({ | ||
testValue: new FormControl([]), | ||
}); | ||
} | ||
``` |
14 changes: 14 additions & 0 deletions
14
...s/demo/src/modules/components/input-date-multi/examples/import/import-module.md
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,14 @@ | ||
```ts | ||
import {ReactiveFormsModule} from '@angular/forms'; | ||
import {TuiInputDateModule} from '@taiga-ui/kit'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
// ... | ||
ReactiveFormsModule, | ||
TuiInputDateModule, | ||
], | ||
// ... | ||
}) | ||
export class MyModule {} | ||
``` |
10 changes: 10 additions & 0 deletions
10
...demo/src/modules/components/input-date-multi/examples/import/insert-template.md
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 @@ | ||
```html | ||
<form [formGroup]="testForm"> | ||
<tui-input-date | ||
formControlName="testValue" | ||
multiple | ||
> | ||
Choose a date | ||
</tui-input-date> | ||
</form> | ||
``` |
78 changes: 78 additions & 0 deletions
78
projects/demo/src/modules/components/input-date-multi/input-date-multi.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,78 @@ | ||
import {Component, forwardRef} from '@angular/core'; | ||
import {changeDetection} from '@demo/emulate/change-detection'; | ||
import {TuiDocExample} from '@taiga-ui/addon-doc'; | ||
import { | ||
ALWAYS_FALSE_HANDLER, | ||
TUI_FIRST_DAY, | ||
TUI_LAST_DAY, | ||
TuiBooleanHandler, | ||
TuiDay, | ||
} from '@taiga-ui/cdk'; | ||
import {TUI_DEFAULT_MARKER_HANDLER, TuiMarkerHandler} from '@taiga-ui/core'; | ||
import {TuiNamedDay} from '@taiga-ui/kit'; | ||
|
||
import {ABSTRACT_PROPS_ACCESSOR} from '../abstract/inherited-documentation/abstract-props-accessor'; | ||
import {AbstractExampleTuiMulti} from '../abstract/multi'; | ||
|
||
const TWO_DOTS: [string, string] = ['var(--tui-primary)', 'var(--tui-info-fill)']; | ||
const ONE_DOT: [string] = ['var(--tui-success-fill)']; | ||
|
||
@Component({ | ||
selector: 'example-tui-input-date-multi', | ||
templateUrl: './input-date-multi.template.html', | ||
changeDetection, | ||
providers: [ | ||
{ | ||
provide: ABSTRACT_PROPS_ACCESSOR, | ||
useExisting: forwardRef(() => ExampleTuiInputDateMultiComponent), | ||
}, | ||
], | ||
}) | ||
export class ExampleTuiInputDateMultiComponent extends AbstractExampleTuiMulti { | ||
readonly exampleForm = import('./examples/import/declare-form.md?raw'); | ||
readonly exampleModule = import('./examples/import/import-module.md?raw'); | ||
readonly exampleHtml = import('./examples/import/insert-template.md?raw'); | ||
|
||
readonly example1: TuiDocExample = { | ||
TypeScript: import('./examples/1/index.ts?raw'), | ||
HTML: import('./examples/1/index.html?raw'), | ||
}; | ||
|
||
minVariants = [ | ||
TUI_FIRST_DAY, | ||
new TuiDay(2017, 2, 5), | ||
new TuiDay(1900, 0, 1), | ||
new TuiDay(new Date().getFullYear() + 3, 1, 1), | ||
]; | ||
|
||
min = this.minVariants[0]; | ||
|
||
maxVariants = [ | ||
TUI_LAST_DAY, | ||
new TuiDay(2017, 11, 11), | ||
new TuiDay(2020, 2, 5), | ||
new TuiDay(2300, 0, 1), | ||
]; | ||
|
||
max = this.maxVariants[0]; | ||
|
||
readonly disabledItemHandlerVariants: ReadonlyArray<TuiBooleanHandler<TuiDay>> = [ | ||
ALWAYS_FALSE_HANDLER, | ||
]; | ||
|
||
disabledItemHandler = this.disabledItemHandlerVariants[0]; | ||
|
||
readonly itemsVariants = [ | ||
[], | ||
[new TuiNamedDay(TUI_LAST_DAY.append({year: -1}), 'Until today')], | ||
]; | ||
|
||
readonly markerHandlerVariants: readonly TuiMarkerHandler[] = [ | ||
TUI_DEFAULT_MARKER_HANDLER, | ||
(day: TuiDay) => (day.day % 2 === 0 ? TWO_DOTS : ONE_DOT), | ||
]; | ||
|
||
markerHandler: TuiMarkerHandler = this.markerHandlerVariants[0]; | ||
|
||
items = this.itemsVariants[0]; | ||
} |
31 changes: 31 additions & 0 deletions
31
projects/demo/src/modules/components/input-date-multi/input-date-multi.module.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,31 @@ | ||
import {CommonModule} from '@angular/common'; | ||
import {NgModule} from '@angular/core'; | ||
import {ReactiveFormsModule} from '@angular/forms'; | ||
import {TuiAddonDocModule, tuiGetDocModules} from '@taiga-ui/addon-doc'; | ||
import { | ||
TuiDropdownModule, | ||
TuiHintModule, | ||
TuiTextfieldControllerModule, | ||
} from '@taiga-ui/core'; | ||
import {TuiInputDateModule} from '@taiga-ui/kit'; | ||
|
||
import {InheritedDocumentationModule} from '../abstract/inherited-documentation/inherited-documentation.module'; | ||
import {TuiInputDateMultiExample1} from './examples/1'; | ||
import {ExampleTuiInputDateMultiComponent} from './input-date-multi.component'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
ReactiveFormsModule, | ||
TuiInputDateModule, | ||
TuiHintModule, | ||
TuiDropdownModule, | ||
TuiAddonDocModule, | ||
TuiTextfieldControllerModule, | ||
InheritedDocumentationModule, | ||
tuiGetDocModules(ExampleTuiInputDateMultiComponent), | ||
], | ||
declarations: [ExampleTuiInputDateMultiComponent, TuiInputDateMultiExample1], | ||
exports: [ExampleTuiInputDateMultiComponent], | ||
}) | ||
export class ExampleTuiInputDateMultiModule {} |
Oops, something went wrong.