@qn-pandora/pandora-visualization
Version:
Pandora 通用可视化库
72 lines (71 loc) • 3.2 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 __());
};
})();
import * as React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { MenuOutlined } from '@ant-design/icons';
import { DashboardLocale } from '../../../../constants/language/dashboard/type';
import { Drawer } from '../../../../components/Common';
import { isMobileDevice } from '../../../../utils/env';
import { formatString } from '../../../../services/language';
import AddActions from './AddActions';
import MoreActions from './MoreActions';
import CreateChart from './CreateChart';
import DatePicker from './DatePicker';
import Editable from './Editable';
import Export from './Export';
import ExportPDF from './ExportPDF';
import FullScreen from './FullScreen';
import Refresh from './Refresh';
import Setting from './Setting';
import Theme from './Theme';
import * as style from './style.mless';
var ActionBar = /** @class */ (function (_super) {
__extends(ActionBar, _super);
function ActionBar() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.state = {
visible: false
};
_this.toggleDrawer = function () {
_this.setState(function (state) { return ({
visible: !state.visible
}); });
};
return _this;
}
ActionBar.prototype.render = function () {
var visible = this.state.visible;
return (React.createElement("div", { className: classnames(style.root, style.actionBar, this.context.baseDashboardStore.theme) }, isMobileDevice() ? (React.createElement(React.Fragment, null,
React.createElement("div", { onClick: this.toggleDrawer, className: style.toggleButton },
React.createElement(MenuOutlined, null)),
React.createElement(Drawer, { width: "40%", visible: visible, title: formatString(DashboardLocale.more), onClose: this.toggleDrawer, className: style.operationDrawer, zIndex: 1100 }, this.props.children))) : (React.createElement(React.Fragment, null, this.props.children))));
};
ActionBar.AddActions = AddActions;
ActionBar.MoreActions = MoreActions;
ActionBar.CreateChart = CreateChart;
ActionBar.DatePicker = DatePicker;
ActionBar.Editable = Editable;
ActionBar.Export = Export;
ActionBar.ExportPDF = ExportPDF;
ActionBar.FullScreen = FullScreen;
ActionBar.Refresh = Refresh;
ActionBar.Setting = Setting;
ActionBar.Theme = Theme;
ActionBar.contextTypes = {
baseDashboardStore: PropTypes.object
};
return ActionBar;
}(React.Component));
export default ActionBar;