Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrap4 beta dropdowns #1745

Closed
wants to merge 2 commits into from
Closed

Bootstrap4 beta dropdowns #1745

wants to merge 2 commits into from

Conversation

pkozlowski-opensource
Copy link
Member

This builds on top of #1743 and adds Bootstrap 4.beta specific markup changes (the show class needs to be added on the menu now).

Closes #1022

BREAKING CHANGE:

Dropdown menu now requires usage of the new `ngbDropdownMenu` directive.

Before:

```html
<div ngbDropdown>
  <button ngbDropdownToggle>Toggle dropdown</button>
  <div class="dropdown-menu">
    <a class="dropdown-item">Action</a>
  </div>
</div>
```

After (notice **ngbDropdownMenu**):

```html
<div ngbDropdown>
  <button ngbDropdownToggle>Toggle dropdown</button>
  <div ngbDropdownMenu>
    <a class="dropdown-item">Action</a>
  </div>
</div>
```
Copy link
Member

@maxokorokov maxokorokov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dropup is not working. What would be the plan to fix it?

@@ -26,7 +74,7 @@ export class NgbDropdown {
/**
* Indicates that dropdown should be closed when selecting one of dropdown items (click) or pressing ESC.
*/
@Input() autoClose: boolean;
@Input() autoClose: boolean | 'outside' | 'inside';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should update documentation for 2 new values

export class NgbDropdownMenu {
isOpen = false;

constructor(private _elementRef: ElementRef) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you inject the NgbDropdown as you do in the NgbDropDownToggle and remove internal isOpen state which is duplicated now?

Would it work if you just use [class.show]: 'dropdown.isOpen()'?
Can't see why you want to explicitly have open and show methods

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, it is much simpler indeed! Changing.

}

toggleOpen() { this.dropdown.toggle(); }
private _isEventFromMenu($event) {
if (this._menu) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be a ternary one-liner, but don't know if you like it :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeh, changing to ternary

beforeEach(() => {
jasmine.addMatchers(jasmineMatchers);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be done once in beforeAll

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will open a separate issue / PR for this as I've noticed other things in this test that need attention.

@pkozlowski-opensource
Copy link
Member Author

The dropup is not working. What would be the plan to fix it?

I will open a separate issue for this as a proper fix will require usage of the positioning service and we need to design it properly.

@pkozlowski-opensource
Copy link
Member Author

Thnx for the review @maxokorokov - great feedback. Waiting for Travis to get green and merging it. There are 2 more points needed attention:

  • dropups
  • test improvements
    but let's tackle those separately - will open issues.

@pkozlowski-opensource
Copy link
Member Author

Merged into the bootstrap4_beta branch

rmeans pushed a commit to fcsa-teamhammer/ng-bootstrap that referenced this pull request Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants