@rmwc/menu
Advanced tools
Comparing version 5.0.8-alpha.0 to 5.0.11-alpha.0
@@ -25,2 +25,3 @@ import * as RMWC from '@rmwc/types'; | ||
export declare class MenuSurface extends FoundationComponent<MenuSurfaceProps> { | ||
static shouldDebounce: boolean; | ||
private root; | ||
@@ -27,0 +28,0 @@ anchorElement: HTMLElement | null; |
@@ -98,3 +98,3 @@ "use strict"; | ||
set: function (value) { | ||
if (value) { | ||
if (value && this.foundation && !this.foundation.isOpen()) { | ||
var focusableElements = this.root.ref | ||
@@ -109,8 +109,8 @@ ? this.root.ref.querySelectorAll(menu_surface_1.MDCMenuSurfaceFoundation.strings.FOCUSABLE_ELEMENTS) | ||
: null; | ||
this.registerBodyClickListener(); | ||
this.foundation.open(); | ||
} | ||
else { | ||
this.deregisterBodyClickListener(); | ||
this.foundation.close(); | ||
if (this.foundation && this.foundation.isOpen()) { | ||
this.foundation.close(); | ||
} | ||
} | ||
@@ -123,8 +123,20 @@ }, | ||
var _this = this; | ||
return new menu_surface_1.MDCMenuSurfaceFoundation(__assign({ addClass: function (className) { return _this.root.addClass(className); }, removeClass: function (className) { return _this.root.removeClass(className); }, hasClass: function (className) { | ||
return new menu_surface_1.MDCMenuSurfaceFoundation(__assign({ addClass: function (className) { | ||
_this.root.addClass(className); | ||
}, removeClass: function (className) { | ||
_this.root.removeClass(className); | ||
}, hasClass: function (className) { | ||
return className === 'mdc-menu-surface' ? true : _this.root.hasClass(className); | ||
}, hasAnchor: function () { return !!_this.anchorElement; }, notifyClose: function () { | ||
_this.emit('onClose', {}); | ||
_this.deregisterBodyClickListener(); | ||
// an annoying hack... this is the only | ||
// place to catch bot the normal close and bodyClick handler | ||
// and correct it if we still want to be open. | ||
if (_this.props.open) { | ||
_this.open = _this.props.open; | ||
} | ||
}, notifyOpen: function () { | ||
_this.emit('onOpen', {}); | ||
_this.registerBodyClickListener(); | ||
}, isElementInContainer: function (el) { | ||
@@ -222,3 +234,3 @@ return _this.root.ref === el || (_this.root.ref && _this.root.ref.contains(el)); | ||
// open | ||
this.syncProp(!!props.open, this.open, function () { | ||
this.syncProp(props.open, prevProps.open, function () { | ||
_this.open = !!props.open; | ||
@@ -248,2 +260,3 @@ }); | ||
this.props.onKeyDown && this.props.onKeyDown(evt); | ||
this.foundation.handleKeydown(evt); | ||
}; | ||
@@ -254,2 +267,3 @@ MenuSurface.prototype.render = function () { | ||
}; | ||
MenuSurface.shouldDebounce = false; | ||
return MenuSurface; | ||
@@ -256,0 +270,0 @@ }(base_1.FoundationComponent)); |
@@ -24,2 +24,3 @@ import * as RMWC from '@rmwc/types'; | ||
export declare class Menu extends FoundationComponent<MenuProps> { | ||
static shouldDebounce: boolean; | ||
static displayName: string; | ||
@@ -26,0 +27,0 @@ list: List | null; |
@@ -171,2 +171,3 @@ "use strict"; | ||
}; | ||
Menu.shouldDebounce = false; | ||
Menu.displayName = 'Menu'; | ||
@@ -173,0 +174,0 @@ return Menu; |
@@ -25,2 +25,3 @@ import * as RMWC from '@rmwc/types'; | ||
export declare class MenuSurface extends FoundationComponent<MenuSurfaceProps> { | ||
static shouldDebounce: boolean; | ||
private root; | ||
@@ -27,0 +28,0 @@ anchorElement: HTMLElement | null; |
@@ -91,3 +91,3 @@ var __extends = (this && this.__extends) || (function () { | ||
set: function (value) { | ||
if (value) { | ||
if (value && this.foundation && !this.foundation.isOpen()) { | ||
var focusableElements = this.root.ref | ||
@@ -102,8 +102,8 @@ ? this.root.ref.querySelectorAll(MDCMenuSurfaceFoundation.strings.FOCUSABLE_ELEMENTS) | ||
: null; | ||
this.registerBodyClickListener(); | ||
this.foundation.open(); | ||
} | ||
else { | ||
this.deregisterBodyClickListener(); | ||
this.foundation.close(); | ||
if (this.foundation && this.foundation.isOpen()) { | ||
this.foundation.close(); | ||
} | ||
} | ||
@@ -116,8 +116,20 @@ }, | ||
var _this = this; | ||
return new MDCMenuSurfaceFoundation(__assign({ addClass: function (className) { return _this.root.addClass(className); }, removeClass: function (className) { return _this.root.removeClass(className); }, hasClass: function (className) { | ||
return new MDCMenuSurfaceFoundation(__assign({ addClass: function (className) { | ||
_this.root.addClass(className); | ||
}, removeClass: function (className) { | ||
_this.root.removeClass(className); | ||
}, hasClass: function (className) { | ||
return className === 'mdc-menu-surface' ? true : _this.root.hasClass(className); | ||
}, hasAnchor: function () { return !!_this.anchorElement; }, notifyClose: function () { | ||
_this.emit('onClose', {}); | ||
_this.deregisterBodyClickListener(); | ||
// an annoying hack... this is the only | ||
// place to catch bot the normal close and bodyClick handler | ||
// and correct it if we still want to be open. | ||
if (_this.props.open) { | ||
_this.open = _this.props.open; | ||
} | ||
}, notifyOpen: function () { | ||
_this.emit('onOpen', {}); | ||
_this.registerBodyClickListener(); | ||
}, isElementInContainer: function (el) { | ||
@@ -215,3 +227,3 @@ return _this.root.ref === el || (_this.root.ref && _this.root.ref.contains(el)); | ||
// open | ||
this.syncProp(!!props.open, this.open, function () { | ||
this.syncProp(props.open, prevProps.open, function () { | ||
_this.open = !!props.open; | ||
@@ -241,2 +253,3 @@ }); | ||
this.props.onKeyDown && this.props.onKeyDown(evt); | ||
this.foundation.handleKeydown(evt); | ||
}; | ||
@@ -247,2 +260,3 @@ MenuSurface.prototype.render = function () { | ||
}; | ||
MenuSurface.shouldDebounce = false; | ||
return MenuSurface; | ||
@@ -249,0 +263,0 @@ }(FoundationComponent)); |
@@ -24,2 +24,3 @@ import * as RMWC from '@rmwc/types'; | ||
export declare class Menu extends FoundationComponent<MenuProps> { | ||
static shouldDebounce: boolean; | ||
static displayName: string; | ||
@@ -26,0 +27,0 @@ list: List | null; |
@@ -162,2 +162,3 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
Menu.shouldDebounce = false; | ||
Menu.displayName = 'Menu'; | ||
@@ -164,0 +165,0 @@ return Menu; |
{ | ||
"name": "@rmwc/menu", | ||
"version": "5.0.8-alpha.0", | ||
"version": "5.0.11-alpha.0", | ||
"description": "RMWC Menu component", | ||
@@ -36,6 +36,6 @@ "main": "dist/index.js", | ||
"@material/menu-surface": "^0.43.0", | ||
"@rmwc/base": "^5.0.8-alpha.0", | ||
"@rmwc/list": "^5.0.8-alpha.0" | ||
"@rmwc/base": "^5.0.10-alpha.0", | ||
"@rmwc/list": "^5.0.11-alpha.0" | ||
}, | ||
"gitHead": "372100cfa817fbd673e29fded29dd1820c111e81" | ||
"gitHead": "ed387e289df7d0c78951c30f1ff7f62a33bafe46" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
283781
10254
Updated@rmwc/base@^5.0.10-alpha.0
Updated@rmwc/list@^5.0.11-alpha.0