@qn-pandora/pandora-visualization
Version:
Pandora 通用可视化库
115 lines (114 loc) • 5.75 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 __());
};
})();
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 { computed } from 'mobx';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import { EditOutlined } from '@ant-design/icons';
import { Tooltip } from 'antd';
import { Modal } from '../../../../components/Common';
import ModalVisibleCtl from '../../../../stores/ModalVisibleCtl';
import ChartStyleConfig from '../../../../components/ChartStyleConfig';
import errorBoundary from '../../../../hocs/errorBoundary';
import { DashboardLocale } from '../../../../constants/language/dashboard/type';
import { formatString } from '../../../../services/language';
import BasicComponent from '../../../../components/Base/BasicComponent';
import { EActionDisplayMode } from '../../../constants';
var ChartStyle = /** @class */ (function (_super) {
__extends(ChartStyle, _super);
function ChartStyle() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.modalCtl = new ModalVisibleCtl();
return _this;
}
Object.defineProperty(ChartStyle.prototype, "chartType", {
get: function () {
return this.context.chartContainerService.chartConditionService.chartType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ChartStyle.prototype, "isExtendsChart", {
get: function () {
return this.context.chartContainerService.chartConditionService
.isExtendsChart;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ChartStyle.prototype, "chartStyleService", {
get: function () {
return this.context.chartContainerService.chartConditionService
.chartStyleService;
},
enumerable: false,
configurable: true
});
Object.defineProperty(ChartStyle.prototype, "dataset", {
get: function () {
return this.context.chartContainerService.chartConditionService
.originDataset;
},
enumerable: false,
configurable: true
});
ChartStyle.prototype.render = function () {
var _a = this.props, className = _a.className, VisualizationConfigForm = _a.VisualizationConfigForm, displayMode = _a.displayMode;
var _b = this.modalCtl, visible = _b.visible, showModal = _b.showModal, hideModal = _b.hideModal;
var _c = this.context, chartContainerService = _c.chartContainerService, getPopupContainer = _c.getPopupContainer;
return (React.createElement("span", { className: className },
displayMode === EActionDisplayMode.Text ? (React.createElement("span", { onClick: showModal }, formatString(DashboardLocale.edit.chart.style))) : (React.createElement(Tooltip, { title: formatString(DashboardLocale.edit.chart.style) },
React.createElement(EditOutlined, { onClick: showModal }))),
React.createElement(Modal, { title: formatString(DashboardLocale.edit.chart.style), width: 800, onCancel: hideModal, maskClosable: true, visible: visible, footer: null, getContainer: getPopupContainer }, this.isExtendsChart ? (React.createElement(VisualizationConfigForm, { chartType: this.chartType, chartStyleService: this.chartStyleService, dataset: this.dataset })) : (React.createElement(ChartStyleConfig, { chartContainerService: chartContainerService })))));
};
ChartStyle.contextTypes = {
chartContainerService: PropTypes.object,
getPopupContainer: PropTypes.func
};
__decorate([
computed,
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], ChartStyle.prototype, "chartType", null);
__decorate([
computed,
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], ChartStyle.prototype, "isExtendsChart", null);
__decorate([
computed,
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], ChartStyle.prototype, "chartStyleService", null);
__decorate([
computed,
__metadata("design:type", Object),
__metadata("design:paramtypes", [])
], ChartStyle.prototype, "dataset", null);
ChartStyle = __decorate([
observer
], ChartStyle);
return ChartStyle;
}(BasicComponent));
export { ChartStyle };
export default errorBoundary(ChartStyle);