-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dropdown): rollout completely rewritten bs-dropdown version (#1771)
fixes #1674, fixes #1749, fixes #1623, fixes #1415, fixes #802, fixes #569, fixes #530, fixes #6, fixes #1540, fixes #1217, fixes #591, fixes #478 feat: you can pass dropdown configuration in `forRoot()` method feat: now you can add dropdown to body by using `container="body"` BREAKING CHANGES: - `DropdownModule` renamed to `BsDropdownModule`, same to all dropdown components added `bs` prefix - `addToggleClass` option is deprecated, now you need to add `dropdown-toggle` class manually if needed - `dropdownMenu` menu become a template selector, so `*` should be added sample: `<ul dropdownMenu>` should become `<ul *dropdownMenu>` - `onToggle` event deprecated use `isOpenChange` instead - `appendToBody` deprecated, use `container="body"` instead, now dropdown behaviour and attachment params alligned with tooltips and popovers - `keyboardNav` deprecated - `disabled` renamed to `isDisabled` - `dropdownToggle` doesn't prevent default behaviour anymore
- Loading branch information
Showing
41 changed files
with
687 additions
and
1,129 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
6 changes: 3 additions & 3 deletions
6
demo/src/app/components/+dropdown/demos/alignment/menu-alignment.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
16 changes: 7 additions & 9 deletions
16
demo/src/app/components/+dropdown/demos/basic/basic-link.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 |
---|---|---|
@@ -1,10 +1,8 @@ | ||
<span dropdown (onToggle)="toggled($event)"> | ||
<a href id="simple-dropdown" dropdownToggle> | ||
Click me for a dropdown, yo! | ||
</a> | ||
<ul class="dropdown-menu" dropdownMenu aria-labelledby="simple-dropdown"> | ||
<li *ngFor="let choice of items"> | ||
<a class="dropdown-item" href="#">{{choice}}</a> | ||
</li> | ||
</ul> | ||
<span dropdown (isOpenChange)="toggled($event)"> | ||
<a href dropdownToggle (click)="false">Click me for a dropdown, yo!</a> | ||
<ul *dropdownMenu class="dropdown-menu"> | ||
<li *ngFor="let choice of items"> | ||
<a class="dropdown-item" href="#">{{choice}}</a> | ||
</li> | ||
</ul> | ||
</span> |
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,12 +1,13 @@ | ||
<div class="btn-group" dropdown> | ||
<button id="single-button" type="button" class="btn btn-primary" dropdownToggle> | ||
<button dropdownToggle type="button" class="btn btn-primary dropdown-toggle"> | ||
Button dropdown <span class="caret"></span> | ||
</button> | ||
<ul dropdownMenu role="menu" aria-labelledby="single-button"> | ||
<ul *dropdownMenu class="dropdown-menu" role="menu"> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else here</a></li> | ||
<li class="divider dropdown-divider"></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a> | ||
</li> | ||
</ul> | ||
</div> |
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,10 +1,12 @@ | ||
<div dropdown> | ||
<button type="button" class="btn btn-primary" dropdownToggle> | ||
<button dropdownToggle type="button" class="btn btn-primary dropdown-toggle"> | ||
Button dropdown <span class="caret"></span> | ||
</button> | ||
<ul dropdownMenu role="menu" aria-labelledby="single-button"> | ||
<ul *dropdownMenu class="dropdown-menu" role="menu"> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else here</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a> | ||
</li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else | ||
here</a></li> | ||
</ul> | ||
</div> |
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,16 +1,10 @@ | ||
import { Component } from '@angular/core'; | ||
import { DropdownConfig } from 'ng2-bootstrap/dropdown'; | ||
|
||
// such override allows to keep some initial values | ||
|
||
export function getDropdownConfig(): DropdownConfig { | ||
return Object.assign(new DropdownConfig(), {autoClose: 'disabled', keyboardNav: true}); | ||
} | ||
import { BsDropdownConfig } from 'ng2-bootstrap/dropdown'; | ||
|
||
@Component({ | ||
selector: 'demo-dropdown-config', | ||
templateUrl: './config.html', | ||
providers: [{provide: DropdownConfig, useFactory: getDropdownConfig}] | ||
providers: [{provide: BsDropdownConfig, useValue: {autoClose: false}}] | ||
}) | ||
export class DemoDropdownConfigComponent { | ||
} |
9 changes: 5 additions & 4 deletions
9
demo/src/app/components/+dropdown/demos/container/container.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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
<div class="btn-group" dropdown dropdown-append-to-body> | ||
<button id="btn-append-to-body" type="button" class="btn btn-primary" dropdownToggle> | ||
<div class="btn-group" dropdown container="body"> | ||
<button dropdownToggle type="button" class="btn btn-primary dropdownToggle"> | ||
Dropdown on Body <span class="caret"></span> | ||
</button> | ||
<ul class="dropdown-menu" role="menu" aria-labelledby="btn-append-to-body"> | ||
<ul *dropdownMenu class="dropdown-menu" role="menu"> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else here</a></li> | ||
<li class="divider dropdown-divider"></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a> | ||
</li> | ||
</ul> | ||
</div> |
19 changes: 12 additions & 7 deletions
19
demo/src/app/components/+dropdown/demos/disabled-menu/disabled-menu.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 |
---|---|---|
@@ -1,13 +1,18 @@ | ||
<div class="btn-group" dropdown> | ||
<button id="single-button" type="button" class="btn btn-primary" dropdownToggle [disabled]="disabled"> | ||
<div class="btn-group" dropdown [isDisabled]="disabled"> | ||
<button dropdownToggle type="button" class="btn btn-primary dropdownToggle"> | ||
Button dropdown <span class="caret"></span> | ||
</button> | ||
<ul dropdownMenu role="menu" aria-labelledby="single-button"> | ||
<ul *dropdownMenu class="dropdown-menu" role="menu"> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else here</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a> | ||
</li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else | ||
here</a></li> | ||
<li class="divider dropdown-divider"></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a> | ||
</li> | ||
</ul> | ||
</div> | ||
<button type="button" class="btn btn-warning" (click)="disabled = !disabled">Enable/Disable</button> | ||
<button type="button" class="btn btn-warning" (click)="disabled = !disabled"> | ||
Enable/Disable | ||
</button> |
80 changes: 0 additions & 80 deletions
80
demo/src/app/components/+dropdown/demos/dropdown-demo.component.html
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
demo/src/app/components/+dropdown/demos/dropdown-demo.component.ts
This file was deleted.
Oops, something went wrong.
21 changes: 12 additions & 9 deletions
21
demo/src/app/components/+dropdown/demos/dropup/dropup.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 |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<div class="btn-group dropup" dropdown> | ||
<button id="single-button" type="button" class="btn btn-primary" dropdownToggle> | ||
Dropup <span class="caret"></span> | ||
</button> | ||
<ul dropdownMenu role="menu" aria-labelledby="single-button"> | ||
<div class="btn-group dropup" dropdown dropup> | ||
<button dropdownToggle type="button" class="btn btn-primary dropdown-toggle"> | ||
Dropup <span class="caret"></span> | ||
</button> | ||
<ul *dropdownMenu class="dropdown-menu" role="menu"> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else here</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a> | ||
</li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else | ||
here</a></li> | ||
<li class="divider dropdown-divider"></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> |
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
15 changes: 9 additions & 6 deletions
15
demo/src/app/components/+dropdown/demos/keyboard/keyboard.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 |
---|---|---|
@@ -1,12 +1,15 @@ | ||
<div class="btn-group" dropdown keyboardNav="true"> | ||
<button id="simple-btn-keyboard-nav" type="button" class="btn btn-primary" dropdownToggle> | ||
<div dropdown class="btn-group" keyboardNav="true"> | ||
<button dropdownToggle type="button" class="btn btn-primary dropdown-toggle"> | ||
Dropdown with keyboard navigation <span class="caret"></span> | ||
</button> | ||
<ul class="dropdown-menu" dropdownMenu role="menu" aria-labelledby="simple-btn-keyboard-nav"> | ||
<ul *dropdownMenu class="dropdown-menu" role="menu"> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else here</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Another action</a> | ||
</li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Something else | ||
here</a></li> | ||
<li class="divider dropdown-divider"></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#">Separated link</a> | ||
</li> | ||
</ul> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
demo/src/app/components/+dropdown/demos/nested-dropdowns/nested-dropdowns.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,32 @@ | ||
<div class="btn-group" dropdown [autoClose]="false" container="body"> | ||
<button dropdownToggle type="button" class="btn btn-primary dropdown-toggle"> | ||
This dropdown has nested submenu <span class="caret"></span> | ||
</button> | ||
<ul *dropdownMenu class="dropdown-menu" role="menu"> | ||
<li role="menuitem"><a class="dropdown-item" href="#/dropdowns#nested">Action</a></li> | ||
|
||
<li role="menuitem" dropdown triggers="mouseover" placement="right" container="body"> | ||
<a dropdownToggle class="dropdown-item dropdown-toggle" | ||
(click)="false">Hover me for nested dropdown <span class="caret"></span></a> | ||
<ul *dropdownMenu class="dropdown-menu" role="menu"> | ||
<li role="menuitem"><a class="dropdown-item" href="#/dropdowns#nested">Action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#/dropdowns#nested">Action1</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#/dropdowns#nested">Action2</a></li> | ||
</ul> | ||
</li> | ||
|
||
<li role="menuitem" dropdown triggers="mouseover" placement="right" container="body"> | ||
<a dropdownToggle class="dropdown-item dropdown-toggle" | ||
(click)="false">Hover me for nested dropdown <span class="caret"></span></a> | ||
<ul *dropdownMenu class="dropdown-menu" role="menu"> | ||
<li role="menuitem"><a class="dropdown-item" href="#/dropdowns#nested">Action</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#/dropdowns#nested">Action1</a></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#/dropdowns#nested">Action2</a></li> | ||
</ul> | ||
</li> | ||
|
||
<li role="menuitem"><a class="dropdown-item" href="#/dropdowns#nested">Something else here</a></li> | ||
<li class="divider dropdown-divider"></li> | ||
<li role="menuitem"><a class="dropdown-item" href="#/dropdowns#nested">Separated link</a></li> | ||
</ul> | ||
</div> |
8 changes: 8 additions & 0 deletions
8
demo/src/app/components/+dropdown/demos/nested-dropdowns/nested-dropdowns.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,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'demo-nested-dropdowns', | ||
templateUrl: './nested-dropdowns.html' | ||
}) | ||
export class DemoNestedDropdownsComponent { | ||
} |
18 changes: 0 additions & 18 deletions
18
demo/src/app/components/+dropdown/demos/not-yet-supported.html
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.