UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

52 lines (51 loc) 2.93 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 __()); }; })(); import * as React from 'react'; import { Popover } from 'antd'; import { Icon } from '@qn-pandora/pandora-component-icons'; import EmptySvg from './EmptySvg'; import errorBoundary from '../../../../hocs/errorBoundary'; import { DashboardLocale } from '../../../../constants/language/dashboard/type'; import { formatString } from '../../../../services/language'; import * as style from './style.mless'; var EmptyState = /** @class */ (function (_super) { __extends(EmptyState, _super); function EmptyState() { return _super !== null && _super.apply(this, arguments) || this; } EmptyState.prototype.render = function () { var _a = this.props, onCreateClick = _a.onCreateClick, onCreateMetricClick = _a.onCreateMetricClick, onImportClick = _a.onImportClick; var text = onCreateClick || onImportClick ? formatString(DashboardLocale.empty.text_1) : formatString(DashboardLocale.empty.default); var createText = onCreateClick || onCreateMetricClick ? (React.createElement(Popover, { content: React.createElement("div", { className: style.createPop }, onCreateMetricClick && (React.createElement("div", { className: style.createItem, onClick: onCreateMetricClick }, formatString(DashboardLocale.empty.create_metric))), onCreateClick && (React.createElement("div", { className: style.createItem, onClick: onCreateClick }, formatString(DashboardLocale.empty.create_search)))) }, React.createElement("span", { className: style.link }, formatString(DashboardLocale.empty.create)))) : null; var orText = onCreateClick && onImportClick ? formatString(DashboardLocale.empty.text_2) : null; var importText = onImportClick ? (React.createElement("span", { className: style.link, onClick: onImportClick }, formatString(DashboardLocale.empty.import))) : null; return (React.createElement("div", { className: style.root }, React.createElement(Icon, { component: EmptySvg }), React.createElement("div", { className: style.text }, text, createText, orText, importText))); }; return EmptyState; }(React.Component)); export { EmptyState }; export default errorBoundary(EmptyState);