@gooddata/react-components
Version:
GoodData.UI - A powerful JavaScript library for building analytical applications
49 lines • 2.26 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
// (C) 2007-2018 GoodData Corporation
var React = require("react");
var MenuOpenedByClick_1 = require("./MenuOpenedByClick");
var MenuOpenedByHover_1 = require("./MenuOpenedByHover");
var MenuOpener = /** @class */ (function (_super) {
__extends(MenuOpener, _super);
function MenuOpener() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.getComponentByOpenAction = function () {
switch (_this.props.openAction) {
case "click":
return MenuOpenedByClick_1.default;
case "hover":
return MenuOpenedByHover_1.default;
}
};
return _this;
}
MenuOpener.prototype.render = function () {
var Component = this.getComponentByOpenAction();
return (React.createElement(Component, { opened: this.props.opened, onOpenedChange: this.props.onOpenedChange, topLevelMenu: this.props.topLevelMenu, alignment: this.props.alignment, spacing: this.props.spacing, offset: this.props.offset, toggler: this.props.toggler, togglerWrapperClassName: this.props.togglerWrapperClassName, portalTarget: this.props.portalTarget },
React.createElement("div", { className: "gd-menuOpener" }, this.props.children)));
};
MenuOpener.defaultProps = {
openAction: "hover",
alignment: ["right", "bottom"],
spacing: 0,
offset: 0,
portalTarget: document.querySelector("body"),
};
return MenuOpener;
}(React.Component));
exports.default = MenuOpener;
//# sourceMappingURL=MenuOpener.js.map