File tree Expand file tree Collapse file tree 2 files changed +26
-12
lines changed
Expand file tree Collapse file tree 2 files changed +26
-12
lines changed Original file line number Diff line number Diff line change 11import { Component } from "@angular/core" ;
22import { Dialog } from "../dialog.component" ;
3+ import { position } from "../../utils/position" ;
34
45/**
56 * Extend the `Dialog` component to create an overflow menu.
@@ -9,16 +10,27 @@ import { Dialog } from "../dialog.component";
910@Component ( {
1011 selector : "ibm-overflow-menu-pane" ,
1112 template : `
12- <div #dialog>
13- <ul
14- class="bx--overflow-menu-options bx--overflow-menu-options--open"
15- tabindex="-1">
16- <ng-template
17- [ngTemplateOutlet]="dialogConfig.content"
18- [ngTemplateOutletContext]="{overflowMenu: this}">
19- </ng-template>
20- </ul>
21- </div>
22- `
13+ <ul
14+ #dialog
15+ class="bx--overflow-menu-options bx--overflow-menu-options--open"
16+ tabindex="-1">
17+ <ng-template
18+ [ngTemplateOutlet]="dialogConfig.content"
19+ [ngTemplateOutletContext]="{overflowMenu: this}">
20+ </ng-template>
21+ </ul>
22+ `
2323} )
24- export class OverflowMenuPane extends Dialog { }
24+ export class OverflowMenuPane extends Dialog {
25+ onDialogInit ( ) {
26+ /**
27+ * -20 shifts the menu up to compensate for the
28+ * extra offset generated by the wrapper component.
29+ *
30+ * 60 shifts the menu right to align the arrow.
31+ * (position service trys it's best to center everything,
32+ * so we need to add some compensation)
33+ */
34+ this . addGap [ "bottom" ] = pos => position . addOffset ( pos , - 20 , 60 ) ;
35+ }
36+ }
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ import { Component } from "@angular/core";
1717 template : `
1818 <div
1919 [ibmOverflowMenu]="options"
20+ [appendToBody]="true"
21+ placement="bottom"
2022 class="bx--overflow-menu"
2123 style="display: block;">
2224 <svg class="bx--overflow-menu__icon" width="3" height="15" viewBox="0 0 3 15">
You can’t perform that action at this time.
0 commit comments