-
Notifications
You must be signed in to change notification settings - Fork 478
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(demo):
Control
add reuse component
- Loading branch information
Showing
6 changed files
with
83 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<tr> | ||
<td colspan="3"> | ||
<span tuiTitle> | ||
<strong>ControlOptions</strong> | ||
<span tuiSubtitle>Applied as a host directive</span> | ||
</span> | ||
</td> | ||
</tr> | ||
|
||
<tr | ||
*ngIf="!hiddenOptions.includes('readonly')" | ||
name="[readonly]" | ||
tuiDocAPIItem | ||
type="boolean" | ||
[(value)]="readonly" | ||
> | ||
Readonly state | ||
</tr> | ||
<tr | ||
*ngIf="!hiddenOptions.includes('disabled')" | ||
name="[disabled]" | ||
tuiDocAPIItem | ||
type="boolean" | ||
[(value)]="disabled" | ||
> | ||
Disabled state | ||
</tr> | ||
<tr | ||
*ngIf="!hiddenOptions.includes('invalid')" | ||
name="[invalid]" | ||
tuiDocAPIItem | ||
type="boolean" | ||
[(value)]="invalid" | ||
> | ||
Invalid state | ||
</tr> |
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,25 @@ | ||
import {NgIf} from '@angular/common'; | ||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; | ||
import type {AbstractControl} from '@angular/forms'; | ||
import {DemoRoute} from '@demo/routes'; | ||
import {TuiDocAPIItem} from '@taiga-ui/addon-doc'; | ||
import type {TuiLooseUnion} from '@taiga-ui/cdk'; | ||
import {TuiTitle} from '@taiga-ui/core'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'tbody[tuiDocControl]', | ||
imports: [NgIf, TuiDocAPIItem, TuiTitle], | ||
templateUrl: './index.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class TuiDocControl { | ||
protected readonly routes = DemoRoute; | ||
|
||
@Input() | ||
public hiddenOptions: Array<TuiLooseUnion<keyof AbstractControl>> = []; | ||
|
||
public readonly = false; | ||
public disabled = false; | ||
public invalid = false; | ||
} |
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