UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

118 lines (117 loc) 6.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 __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; 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 { computed } from 'mobx'; import { observer } from 'mobx-react'; import { get } from 'lodash'; import { InputNumber } from '@qn-pandora/pandora-component'; import { TowDimensionLocale } from '../../../../constants/language/two_dimension/type'; import { BaseLocale } from '../../../../constants/language/base/type'; import { formatString } from '../../../../services/language'; import bind from '../../../../utils/bind'; import errorBoundary from '../../../../hocs/errorBoundary'; import { SolidRadioItem } from '../../../Base'; import { Form, Selector } from '../../../Common'; import { EPoint } from '../../../../constants'; import { enableOptions } from '../../constants'; import { pointOptions, lineOptions, valueLabelOptions, toolTipOptions } from '../../LineChart/constants'; var Item = Form.Item, RowContainer = Form.RowContainer; var StyleElement = /** @class */ (function (_super) { __extends(StyleElement, _super); function StyleElement() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(StyleElement.prototype, "pointType", { get: function () { var _a = this.props, chartStyleService = _a.chartStyleService, line = _a.themeOption.line; var point = chartStyleService.point; return point.type || get(line, 'symbol'); }, enumerable: false, configurable: true }); Object.defineProperty(StyleElement.prototype, "pointSize", { get: function () { var _a = this.props, chartStyleService = _a.chartStyleService, line = _a.themeOption.line; var point = chartStyleService.point; return point.size || get(line, 'symbolSize'); }, enumerable: false, configurable: true }); StyleElement.prototype.handlePointChange = function (value, key) { var _a; var _b = this.props.chartStyleService, point = _b.point, setPoint = _b.setPoint; setPoint(__assign(__assign({}, point), (_a = {}, _a[key] = value, _a))); }; StyleElement.prototype.render = function () { var _this = this; var _a = this.props.chartStyleService, smoothLine = _a.smoothLine, setSmoothLine = _a.setSmoothLine, markPointType = _a.markPointType, setMarkPointType = _a.setMarkPointType, showToolBox = _a.showToolBox, setShowToolBox = _a.setShowToolBox, tooltipType = _a.tooltipType, setTooltipType = _a.setTooltipType; return (React.createElement(React.Fragment, null, React.createElement(SolidRadioItem, { label: TowDimensionLocale.line.line_style.title, options: lineOptions, value: smoothLine, onChange: setSmoothLine }), React.createElement(Item, { label: formatString(BaseLocale.point.title) }, React.createElement(RowContainer, { sizes: [12, 12], gutter: 8 }, React.createElement(Selector, { value: this.pointType, onChange: function (value) { _this.handlePointChange(value, 'type'); }, options: pointOptions }), React.createElement(InputNumber, { value: this.pointSize, onChange: function (value) { _this.handlePointChange(value, 'size'); }, addonAfter: 'px' }))), this.pointType !== EPoint.None && (React.createElement(SolidRadioItem, { label: TowDimensionLocale.line.valueLabelShow.title, options: valueLabelOptions, value: markPointType, onChange: setMarkPointType })), React.createElement(SolidRadioItem, { label: TowDimensionLocale.data_zoom.zoom, options: enableOptions, value: showToolBox, onChange: setShowToolBox }), React.createElement(SolidRadioItem, { label: BaseLocale.tooltip_order, options: toolTipOptions, value: tooltipType, onChange: setTooltipType }))); }; __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], StyleElement.prototype, "pointType", null); __decorate([ computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], StyleElement.prototype, "pointSize", null); __decorate([ bind, __metadata("design:type", Function), __metadata("design:paramtypes", [Object, String]), __metadata("design:returntype", void 0) ], StyleElement.prototype, "handlePointChange", null); StyleElement = __decorate([ observer ], StyleElement); return StyleElement; }(React.Component)); export { StyleElement }; export default errorBoundary(StyleElement);