@nodeject/ui-components
Version:
UI library for non-trivial components
52 lines (51 loc) • 2.48 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 (Object.prototype.hasOwnProperty.call(b, 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 __());
};
})();
/**
* A menu with visualization options for the HierarchyChart
*/
import * as React from 'react';
import { Checkbox } from 'antd';
import styles from './WidgetMenu.module.less';
var WidgetMenu = /** @class */ (function (_super) {
__extends(WidgetMenu, _super);
function WidgetMenu() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
enablePanzoom: _this.props.enablePanzoom,
enableEditMode: _this.props.enableEditMode
};
_this.onChangePanzoom = function (e) {
_this.setState({
enablePanzoom: e.target.checked
}, function () { return _this.props.onPanzoomToggle(e.target.checked); });
};
_this.onChangeEditMode = function (e) {
_this.setState({
enableEditMode: e.target.checked
}, function () { return _this.props.onEditModeToggle(e.target.checked); });
};
return _this;
}
WidgetMenu.prototype.render = function () {
var panzoomButton = this.props.showPanzoomButton && (React.createElement(Checkbox, { onChange: this.onChangePanzoom, defaultChecked: this.props.enablePanzoom }, "Panzoom"));
var editModeButton = this.props.showEditModeButton && (React.createElement(Checkbox, { onChange: this.onChangeEditMode, defaultChecked: this.props.enableEditMode }, "Edit"));
this.props.debugMessages &&
console.log("\n ===============================\n ================================\n WidgetMenu\n " + JSON.stringify(this.props) + "\n ");
return (React.createElement("div", { className: styles.widgetMenu },
panzoomButton,
editModeButton));
};
return WidgetMenu;
}(React.Component));
export { WidgetMenu };