ng2-material-dropdown
Advanced tools
Comparing version
@@ -94,6 +94,6 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
} | ||
Ng2Dropdown.prototype.toggleMenu = function () { | ||
Ng2Dropdown.prototype.toggleMenu = function (position) { | ||
if (position === void 0) { position = this.button.getPosition(); } | ||
var isVisible = this.menu.state.isVisible; | ||
isVisible ? this.menu.hide() : this.menu.show(); | ||
var position = this.button.getPosition(); | ||
this.menu.updatePosition(position); | ||
@@ -111,7 +111,10 @@ isVisible ? this.onHide.emit(this) : this.onShow.emit(this); | ||
}); | ||
if (this.button) { | ||
this.button.onMenuToggled.subscribe(function () { | ||
_this.toggleMenu(); | ||
}); | ||
} | ||
this.state.onItemSelected.subscribe(function (item) { return _this.onItemSelected.emit(item); }); | ||
}; | ||
Ng2Dropdown.prototype.ngAfterViewInit = function () { | ||
var _this = this; | ||
this.button.onMenuToggled.subscribe(function () { return _this.toggleMenu(); }); | ||
}; | ||
@@ -146,3 +149,2 @@ __decorate([ | ||
selector: 'ng2-dropdown', | ||
providers: [], | ||
styles: styles, | ||
@@ -194,3 +196,3 @@ template: template | ||
core_1.Output(), | ||
__metadata('design:type', Object) | ||
__metadata('design:type', core_1.EventEmitter) | ||
], Ng2DropdownButton.prototype, "onMenuToggled", void 0); | ||
@@ -612,3 +614,4 @@ __decorate([ | ||
} | ||
Ng2DropdownMenu.prototype.show = function () { | ||
Ng2DropdownMenu.prototype.show = function (focus) { | ||
if (focus === void 0) { focus = true; } | ||
this.state.isVisible = true; | ||
@@ -618,3 +621,5 @@ if (this.focusFirstElement) { | ||
} | ||
this.focusMenuElement(); | ||
if (focus) { | ||
this.focusMenuElement(); | ||
} | ||
}; | ||
@@ -621,0 +626,0 @@ Ng2DropdownMenu.prototype.hide = function () { |
{ | ||
"name": "ng2-material-dropdown", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Angular 2 material-like Dropdown Component", | ||
"scripts": { | ||
"typings-install": "typings install", | ||
"typings-bundle": "typings bundle --out ./dist/typings.bundle.d.ts", | ||
"postinstall": "npm run typings-install", | ||
"prepublish": "npm run typings-bundle && npm run build && ./node_modules/.bin/tsc -p tsconfig.json", | ||
"prepublish": "npm run build && ./node_modules/.bin/tsc -p tsconfig.json", | ||
"build": "webpack --inline --colors --progress --display-error-details --display-cached", | ||
@@ -87,5 +86,6 @@ "watch": "npm run build -- --watch", | ||
"index.js", | ||
"index.ts" | ||
"index.ts", | ||
"index.d.ts" | ||
], | ||
"typings": "src/typings.d.ts" | ||
"typings": "./index.d.ts" | ||
} |
@@ -53,21 +53,22 @@ # Angular2 Dropdown Component | ||
**`ng2-dropdown`** | ||
**`onItemSelected()`** - **`[(onItemSelected($event)]`** : event that emits the currently selected/hovered item | ||
**`onItemClicked()`** - **`[(onItemClicked($event)]`** : event that emits the item clicked on | ||
**`onShow()`** - **`[(onItemClicked($event)]`** : event that emits when the dropdown gets shown | ||
**`onHide()`** - **`[(onItemClicked($event)]`** : event that emits when the dropdown gets hidden | ||
`ng2-dropdown` | ||
- **`onItemSelected()`** - **`[(onItemSelected($event)]`** : event that emits the currently selected/hovered item | ||
- **`onItemClicked()`** - **`[(onItemClicked($event)]`** : event that emits the item clicked on | ||
- **`onShow()`** - **`[(onItemClicked($event)]`** : event that emits when the dropdown gets shown | ||
- **`onHide()`** - **`[(onItemClicked($event)]`** : event that emits when the dropdown gets hidden | ||
**`ng2-dropdown-menu`** | ||
**`focusFirstElement`** - **`[?boolean]`** : by default the first element is immediately focused. You can disable by setting this option to false | ||
**`width`** - **`[?number]`**: this determines the width of the menu. Possible values are 2, 4 and 6. By default, this is set to 4 | ||
`ng2-dropdown-menu` | ||
- **`focusFirstElement`** - **`[?boolean]`** : by default the first element is immediately focused. You can disable by setting this option to false | ||
- **`width`** - **`[?number]`**: this determines the width of the menu. Possible values are 2, 4 and 6. By default, this is set to 4 | ||
**`ng2-dropdown-button`** | ||
**`showCaret`** - **`[?boolean]`** : if present, a caret will be appended to the button's text | ||
`ng2-dropdown-button` | ||
- **`showCaret`** - **`[?boolean]`** : if present, a caret will be appended to the button's text | ||
**`ng2-menu-item`** | ||
**`preventClose`** - `[?boolean]` : if present, this attribute prevents the menu to hide when the menu item is clicked | ||
**`value` - `[?any]`** : any value that you may want to attach to a menu item. Useful for using this component with other components. | ||
`ng2-menu-item` | ||
- **`preventClose`** - `[?boolean]` : if present, this attribute prevents the menu to hide when the menu item is clicked | ||
- **`value` - `[?any]`** : any value that you may want to attach to a menu item. Useful for using this component with other components. | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
74
1.37%91335
-2.77%961
-6.43%