UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

63 lines (62 loc) 5.1 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 React from 'react'; import { observer } from 'mobx-react'; import { CheckboxList, InputNumber } from '@qn-pandora/pandora-component'; import { Form } from '../../../Common'; import { SolidRadioItem, NumberItem } from '../../../Base'; import errorBoundary from '../../../../hocs/errorBoundary'; import { TowDimensionLocale } from '../../../../constants/language/two_dimension/type'; import { valueTypeOptions, SubtotalTypeOptions, barShapeOptions, labelPositionOptions } from '../constant'; import { SubtotalType, ValueType, LabelPosition } from '../../../../constants/capsule-bar-style'; import TitleItem from '../../../Base/TitleItem'; import { CapsuleLocale } from '../../../../constants/language/capsule_bar/type'; import * as style from './style.mless'; var Item = Form.Item; var StyleElememt = /** @class */ (function (_super) { __extends(StyleElememt, _super); function StyleElememt() { return _super !== null && _super.apply(this, arguments) || this; } StyleElememt.prototype.render = function () { var chartStyleService = this.props.chartStyleService; var valueTypes = chartStyleService.valueTypes, setValueTypes = chartStyleService.setValueTypes, subtotalType = chartStyleService.subtotalType, setSubtotalType = chartStyleService.setSubtotalType, constantValue = chartStyleService.constantValue, setConstantValue = chartStyleService.setConstantValue, barShape = chartStyleService.barShape, setBarShape = chartStyleService.setBarShape, dataFont = chartStyleService.dataFont, setDataFont = chartStyleService.setDataFont, labelFont = chartStyleService.labelFont, setLabelFont = chartStyleService.setLabelFont, labelPosition = chartStyleService.labelPosition, setLabelPosition = chartStyleService.setLabelPosition, valueWidth = chartStyleService.valueWidth, setValueWidth = chartStyleService.setValueWidth, labelWidth = chartStyleService.labelWidth, setLabelWidth = chartStyleService.setLabelWidth; return (React.createElement(React.Fragment, null, React.createElement(Item, { label: TowDimensionLocale.title_overlay.show_data }, React.createElement("div", { className: style.checkboxList }, React.createElement(CheckboxList, { options: valueTypeOptions, value: valueTypes, onChange: setValueTypes }))), valueTypes.length && (React.createElement(Item, { label: CapsuleLocale.value_width }, React.createElement(InputNumber, { value: valueWidth, onChange: setValueWidth, addonAfter: '%' }))), valueTypes.includes(ValueType.Rate) && (React.createElement(SolidRadioItem, { label: CapsuleLocale.subtotal.label, options: SubtotalTypeOptions, value: subtotalType, onChange: setSubtotalType })), subtotalType === SubtotalType.Constant && (React.createElement(NumberItem, { label: CapsuleLocale.subtotal.constant, value: constantValue, onChange: setConstantValue })), React.createElement(SolidRadioItem, { label: CapsuleLocale.shape.label, options: barShapeOptions, value: barShape, onChange: setBarShape }), React.createElement(SolidRadioItem, { label: CapsuleLocale.label_position.label, options: labelPositionOptions, value: labelPosition, onChange: setLabelPosition }), labelPosition === LabelPosition.Left && (React.createElement(Item, { label: CapsuleLocale.label_width }, React.createElement(InputNumber, { value: labelWidth, onChange: setLabelWidth, addonAfter: '%' }))), React.createElement(TitleItem, { label: CapsuleLocale.value_font, value: dataFont, onChange: setDataFont }), React.createElement(TitleItem, { label: CapsuleLocale.label_font, value: labelFont, onChange: setLabelFont }))); }; StyleElememt = __decorate([ observer ], StyleElememt); return StyleElememt; }(React.Component)); export { StyleElememt }; export default errorBoundary(StyleElememt);