UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

73 lines (72 loc) 4.18 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; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import React from 'react'; import { observer } from 'mobx-react'; import { computed } from 'mobx'; import BasicComponent from '../../../../components/Base/BasicComponent'; import { MetricItem, UnitItem, NumberItem } from '../../../../components/Base'; import errorBoundary from '../../../../hocs/errorBoundary'; import { BaseLocale } from '../../../../constants/language/base/type'; import { UnitLocale } from '../../../../constants/language/unit/type'; import Form from '../../../../components/Common/Form'; import { Selector } from '../../../../components/Common'; import { RelationLocale } from '../../../../constants/language/relation/type'; var Item = Form.Item; var DataElement = /** @class */ (function (_super) { __extends(DataElement, _super); function DataElement() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(DataElement.prototype, "fieldsSelectOptions", { get: function () { var dataset = this.props.dataset; return dataset.fields.map(function (e) { return ({ text: e.name, value: e.key }); }); }, enumerable: false, configurable: true }); DataElement.prototype.render = function () { var chartStyleService = this.props.chartStyleService; var currentMetrics = chartStyleService.currentMetrics, setCurrentMetrics = chartStyleService.setCurrentMetrics, unit = chartStyleService.unit, setUnit = chartStyleService.setUnit, currentBuckets = chartStyleService.currentBuckets, setCurrentBuckets = chartStyleService.setCurrentBuckets, precision = chartStyleService.precision, setPrecision = chartStyleService.setPrecision; return (React.createElement(React.Fragment, null, React.createElement(Item, { label: RelationLocale.node }, React.createElement(Selector, { value: currentBuckets, mode: "multiple", onChange: setCurrentBuckets, options: this.fieldsSelectOptions, allowClear: true, showSearch: true })), React.createElement(MetricItem, { label: BaseLocale.metric, metricOptions: this.fieldsSelectOptions, metrics: currentMetrics, onChange: setCurrentMetrics, allowClear: true }), React.createElement(UnitItem, { label: UnitLocale.title, value: unit, onChange: setUnit }), React.createElement(NumberItem, { label: BaseLocale.precision, value: precision, onChange: setPrecision }))); }; __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], DataElement.prototype, "fieldsSelectOptions", null); DataElement = __decorate([ observer ], DataElement); return DataElement; }(BasicComponent)); export { DataElement }; export default errorBoundary(DataElement);