UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

62 lines (61 loc) 3.38 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; }; import * as React from 'react'; import PropTypes from 'prop-types'; import { observer } from 'mobx-react'; import classnames from 'classnames'; import { EditOutlined, InfoCircleOutlined } from '@ant-design/icons'; import { Tooltip } from 'antd'; import Editor from './Editor'; import ModalVisibleCtl from '../../../../stores/ModalVisibleCtl'; import errorBoundary from '../../../../hocs/errorBoundary'; import { DashboardLocale } from '../../../../constants/language/dashboard/type'; import { formatString } from '../../../../services/language'; import * as style from './style.mless'; var Description = /** @class */ (function (_super) { __extends(Description, _super); function Description() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.modalCtl = new ModalVisibleCtl(); return _this; } Description.prototype.render = function () { var _a = this.props, className = _a.className, title = _a.title, description = _a.description, onChange = _a.onChange, disabled = _a.disabled; var _b = this.modalCtl, visible = _b.visible, showModal = _b.showModal, hideModal = _b.hideModal; var displayTitle = title || formatString(DashboardLocale.edit.name_display); var displayDesc = description; return (React.createElement("div", { className: classnames(style.root, className) }, React.createElement("div", { className: style.title, title: displayTitle }, displayTitle, displayDesc && (React.createElement(Tooltip, { title: displayDesc }, React.createElement(InfoCircleOutlined, { className: style.icon })))), !disabled && (React.createElement(EditOutlined, { className: style.icon, onClick: showModal })), visible && (React.createElement(Editor, { value: { title: title, description: description }, onChange: onChange, onClose: hideModal })))); }; Description.contextTypes = { replaceVariable: PropTypes.func }; Description = __decorate([ observer ], Description); return Description; }(React.Component)); export { Description }; export default errorBoundary(Description);