-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(demo):
Dropdown
add reuse component & migrate example to new …
…approach
- Loading branch information
Showing
4 changed files
with
145 additions
and
21 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,75 @@ | ||
<tr> | ||
<td colspan="3"> | ||
<span tuiTitle> | ||
<a | ||
tuiLink | ||
[routerLink]="routes.Dropdown" | ||
> | ||
<strong>Dropdown</strong> | ||
</a> | ||
<span tuiSubtitle>Applied as a host directive</span> | ||
</span> | ||
</td> | ||
</tr> | ||
<tr | ||
name="[(tuiDropdownOpen)]" | ||
tuiDocAPIItem | ||
type="boolean" | ||
[(value)]="open" | ||
> | ||
Manual control/monitor for the dropdown being visible | ||
</tr> | ||
<tr | ||
name="[tuiDropdownAlign]" | ||
tuiDocAPIItem | ||
type="tuiDropdownAlign" | ||
[items]="aligns" | ||
[(value)]="align" | ||
> | ||
Align of dropdown (does not work together with | ||
<code>limitWidth === 'fixed'</code> | ||
) | ||
</tr> | ||
<tr | ||
name="[tuiDropdownDirection]" | ||
tuiDocAPIItem | ||
type="TuiVerticalDirection | null" | ||
[items]="directions" | ||
[(value)]="direction" | ||
> | ||
Set a vertical direction of dropdown | ||
</tr> | ||
<tr | ||
name="[tuiDropdownLimitWidth]" | ||
tuiDocAPIItem | ||
type="TuiDropdownWidth" | ||
[items]="limitWidths" | ||
[(value)]="limitWidth" | ||
> | ||
Limit width of dropdown | ||
</tr> | ||
<tr | ||
name="[tuiDropdownMinHeight]" | ||
tuiDocAPIItem | ||
type="number" | ||
[(value)]="minHeight" | ||
> | ||
Minimum height to calculate that dropdown fits to set | ||
<code>tuiDropdownDirection</code> | ||
</tr> | ||
<tr | ||
name="[tuiDropdownMaxHeight]" | ||
tuiDocAPIItem | ||
type="number" | ||
[(value)]="maxHeight" | ||
> | ||
Maximum height of dropdown | ||
</tr> | ||
<tr | ||
name="[tuiDropdownOffset]" | ||
tuiDocAPIItem | ||
type="number" | ||
[(value)]="offset" | ||
> | ||
Dropdown offset | ||
</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,44 @@ | ||
import {ChangeDetectionStrategy, Component, Input} from '@angular/core'; | ||
import {RouterLink} from '@angular/router'; | ||
import {DemoRoute} from '@demo/routes'; | ||
import {TuiDocAPIItem} from '@taiga-ui/addon-doc'; | ||
import { | ||
TuiDropdown, | ||
type TuiDropdownAlign, | ||
type TuiDropdownWidth, | ||
TuiLink, | ||
TuiTitle, | ||
type TuiVerticalDirection, | ||
} from '@taiga-ui/core'; | ||
|
||
@Component({ | ||
standalone: true, | ||
selector: 'tbody[tuiDocDropdown]', | ||
imports: [RouterLink, TuiDocAPIItem, TuiDropdown, TuiLink, TuiTitle], | ||
templateUrl: './index.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
}) | ||
export class TuiDocDropdown { | ||
protected readonly routes = DemoRoute; | ||
|
||
protected readonly aligns: readonly TuiDropdownAlign[] = ['left', 'right', 'center']; | ||
protected readonly directions: TuiVerticalDirection[] = ['bottom', 'top']; | ||
protected readonly limitWidths: readonly TuiDropdownWidth[] = [ | ||
'auto', | ||
'min', | ||
'fixed', | ||
]; | ||
|
||
@Input() | ||
public tuiDocDropdown: readonly string[] | '' = ''; | ||
|
||
public open = false; | ||
|
||
public align: TuiDropdownAlign = 'left'; | ||
public direction: TuiVerticalDirection | null = null; | ||
public limitWidth: TuiDropdownWidth = 'fixed'; | ||
public minHeight = 80; | ||
public maxHeight = 400; | ||
public offset = 4; | ||
public appearance = ''; | ||
} |
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