UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

86 lines (85 loc) 4 kB
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 __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import * as React from 'react'; import classnames from 'classnames'; import PropTypes from 'prop-types'; import { observer } from 'mobx-react'; import BasicComponent from '../../../components/Base/BasicComponent'; import Description from './Description'; import bind from '../../../utils/bind'; import ActionBar from './ActionBar'; import errorBoundary from '../../../hocs/errorBoundary'; import * as style from './style.mless'; var OperationBar = /** @class */ (function (_super) { __extends(OperationBar, _super); function OperationBar() { return _super !== null && _super.apply(this, arguments) || this; } OperationBar.prototype.getChildContext = function () { return { getPopupContainer: this.getRootDOM }; }; OperationBar.prototype.handleChange = function (value) { var onChange = this.props.onChange; if (onChange) { onChange(value); } }; OperationBar.prototype.render = function () { var _a; var _b = this.props, className = _b.className, title = _b.title, description = _b.description, actionbar = _b.actionbar, funcbtn = _b.funcbtn, autoHide = _b.autoHide, children = _b.children; var _c = this.context .baseDashboardStore, isEditing = _c.isEditing, theme = _c.theme, isFullscreen = _c.isFullscreen; var rootCls = classnames(style.root, className, style[theme], (_a = {}, _a[style.fullScreen] = isFullscreen, _a[style.autoHide] = autoHide, _a)); return (React.createElement("div", { className: rootCls }, React.createElement("div", { className: style.main }, funcbtn, React.createElement("div", { className: style.property }, React.createElement(Description, { className: style.desc, title: title || '', description: description || '', disabled: !isEditing, onChange: this.handleChange })), actionbar), children)); }; OperationBar.ActionBar = ActionBar; OperationBar.contextTypes = { baseDashboardStore: PropTypes.object }; OperationBar.childContextTypes = { getPopupContainer: PropTypes.func }; __decorate([ bind, __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0) ], OperationBar.prototype, "handleChange", null); OperationBar = __decorate([ observer ], OperationBar); return OperationBar; }(BasicComponent)); export { OperationBar }; export default errorBoundary(OperationBar);