@qn-pandora/pandora-visualization
Version:
Pandora 通用可视化库
131 lines (130 loc) • 6.98 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 _a;
import React from 'react';
import { observer } from 'mobx-react';
import { assign } from 'lodash';
import { EChartConditionType } from '@qn-pandora/app-sdk';
import SingleChartStyleConfig from './SingleChart';
import { ChartType } from '../../constants/chart-style';
import LineChartConfigForm from './LineChart';
import PieStyleConfig from './PieChart';
import MigrationStyleConfig from './MigrationChart';
import RelationStyleConfig from './RelationChart';
import SankeyStyleConfig from './SankeyChart';
import BarChartConfigForm from './BarChart';
import LineBarChartConfigForm from './CombinationChart';
import LineY2ChartConfigForm from './CombinationChart/LineY2';
import RadarStyleConfigForm from './RadarChart';
import MapStyleConfigForm from './Map';
import ScatterStyleConfigForm from './ScatterChart';
import BubbleStyleConfigForm from './BubbleChart';
import TableStyleConfigForm from './TableChart';
import SunburstConfigForm from './SunburstChart';
import OutlierConfigForm from './OutlierChart';
import TimeLineConfigForm from './TimeLineChart';
import StatusPanelConfigForm from './StatusPanelChart';
import MetricPanelConfigForm from './MetricPanelChart';
import CapsuleBarConfigForm from './CapsuleBarChart';
import MapboxForm from './MapboxChart';
import HoneycombForm from './Honeycomb';
import errorBoundary from '../../hocs/errorBoundary';
import TopologyStyleConfigForm from './TopologyChart';
import * as style from './style.mless';
export var chartStyleConfigMap = (_a = {},
_a[ChartType.Line] = LineChartConfigForm,
_a[ChartType.StackLine] = LineChartConfigForm,
_a[ChartType.PercentageLine] = LineChartConfigForm,
_a[ChartType.Area] = LineChartConfigForm,
_a[ChartType.PercentageArea] = LineChartConfigForm,
_a[ChartType.Bar] = BarChartConfigForm,
_a[ChartType.StackBar] = BarChartConfigForm,
_a[ChartType.PercentageBar] = BarChartConfigForm,
_a[ChartType.VerticalBar] = BarChartConfigForm,
_a[ChartType.StackVerticalBar] = BarChartConfigForm,
_a[ChartType.PercentageVerticalBar] = BarChartConfigForm,
_a[ChartType.LineBar] = LineBarChartConfigForm,
_a[ChartType.LineBarY2] = LineBarChartConfigForm,
_a[ChartType.LineY2] = LineY2ChartConfigForm,
_a[ChartType.SingleGauge] = SingleChartStyleConfig,
_a[ChartType.SingleValue] = SingleChartStyleConfig,
_a[ChartType.SinglePercent] = SingleChartStyleConfig,
_a[ChartType.StackArea] = LineChartConfigForm,
_a[ChartType.PieBucket] = PieStyleConfig,
_a[ChartType.PieMetric] = PieStyleConfig,
_a[ChartType.PieRingBucket] = PieStyleConfig,
_a[ChartType.PieRingMetric] = PieStyleConfig,
_a[ChartType.PieRoseBucket] = PieStyleConfig,
_a[ChartType.PieRoseMetric] = PieStyleConfig,
_a[ChartType.MigrationChina] = MigrationStyleConfig,
_a[ChartType.MigrationWorld] = MigrationStyleConfig,
_a[ChartType.MapColorChina] = MapStyleConfigForm,
_a[ChartType.MapColorWorld] = MapStyleConfigForm,
_a[ChartType.MapBubbleChina] = MapStyleConfigForm,
_a[ChartType.MapBubbleWorld] = MapStyleConfigForm,
_a[ChartType.RelationHorizontal] = RelationStyleConfig,
_a[ChartType.RelationCircular] = RelationStyleConfig,
_a[ChartType.Sankey] = SankeyStyleConfig,
_a[ChartType.RadarBucket] = RadarStyleConfigForm,
_a[ChartType.RadarMetric] = RadarStyleConfigForm,
_a[ChartType.Scatter] = ScatterStyleConfigForm,
_a[ChartType.Bubble] = BubbleStyleConfigForm,
_a[ChartType.TreeTable] = TableStyleConfigForm,
_a[ChartType.GridTable] = TableStyleConfigForm,
_a[ChartType.Sunburst] = SunburstConfigForm,
_a[ChartType.Editor] = null,
_a[ChartType.Outlier] = OutlierConfigForm,
_a[ChartType.TimeLine] = TimeLineConfigForm,
_a[ChartType.StatusPanel] = StatusPanelConfigForm,
_a[ChartType.MetricPanel] = MetricPanelConfigForm,
_a[ChartType.CapsuleBar] = CapsuleBarConfigForm,
_a[ChartType.MapboxBubble] = MapboxForm,
_a[ChartType.MapboxPath] = MapboxForm,
_a[ChartType.Honeycomb] = HoneycombForm,
_a[ChartType.TopoLogy] = TopologyStyleConfigForm,
_a);
var ChartStyleConfig = /** @class */ (function (_super) {
__extends(ChartStyleConfig, _super);
function ChartStyleConfig() {
return _super !== null && _super.apply(this, arguments) || this;
}
ChartStyleConfig.prototype.render = function () {
var _a;
var chartContainerService = this.props.chartContainerService;
var _b = chartContainerService.chartConditionService, chartType = _b.chartType, isExtendsChart = _b.isExtendsChart, chartStyleService = _b.chartStyleService, originDataset = _b.originDataset, isTableChart = _b.isTableChart, mergeDataset = _b.dataset;
var SpecifiedChartStyleConfig = chartStyleConfigMap[chartType];
if (isExtendsChart || !SpecifiedChartStyleConfig) {
return null;
}
var dataset = isTableChart
? originDataset
: assign({}, originDataset, {
fields: originDataset.fields.filter(function (field) { return field.type !== EChartConditionType.SparkLine; })
});
return (React.createElement("div", { className: style.chartStyleConfigForm },
React.createElement(SpecifiedChartStyleConfig, { themeService: chartContainerService.themeService, key: chartType, chartStyleService: chartStyleService, dataset: dataset, mergeDataset: mergeDataset, isInDrillDown: (_a = chartContainerService.chartConditionService.chartActionService) === null || _a === void 0 ? void 0 : _a.drillDownActionService.isInDrillDown })));
};
ChartStyleConfig = __decorate([
observer
], ChartStyleConfig);
return ChartStyleConfig;
}(React.Component));
export { ChartStyleConfig };
export default errorBoundary(ChartStyleConfig);