UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

109 lines (108 loc) 6.47 kB
"use strict"; 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); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SingleValueStyleElement = void 0; var react_1 = __importDefault(require("react")); var mobx_react_1 = require("mobx-react"); var mobx_1 = require("mobx"); var errorBoundary_1 = __importDefault(require("../../../../hocs/errorBoundary")); var BasicComponent_1 = __importDefault(require("../../../Base/BasicComponent")); var Base_1 = require("../../../Base"); var type_1 = require("../../../../constants/language/single/type"); var type_2 = require("../../../../constants/language/base/type"); var bind_1 = __importDefault(require("../../../../utils/bind")); var constants_1 = require("../constants"); var SingleEmptyValue_1 = __importDefault(require("./SingleEmptyValue")); var SingleValueStyleElement = /** @class */ (function (_super) { __extends(SingleValueStyleElement, _super); function SingleValueStyleElement() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(SingleValueStyleElement.prototype, "prefixAndSuffix", { get: function () { var _a = this.props, _b = _a.chartStyleService, prefix = _b.prefix, suffix = _b.suffix, _c = _a.themeOption.gauge.singleValue, prefixStyle = _c.prefixStyle, suffixStyle = _c.suffixStyle; return { prefix: { value: prefix.value, font: __assign({}, prefix.font), defaultColor: prefixStyle.color, defaultFontSize: prefixStyle.fontSize }, suffix: { value: suffix.value, font: __assign({}, suffix.font), defaultColor: suffixStyle.color, defaultFontSize: suffixStyle.fontSize } }; }, enumerable: false, configurable: true }); SingleValueStyleElement.prototype.handleFontSizeChange = function (fontSize) { var _a = this.props.chartStyleService, titleDataFont = _a.titleDataFont, setTitleDataFont = _a.setTitleDataFont; setTitleDataFont(__assign(__assign({}, titleDataFont), { fontSize: fontSize })); }; SingleValueStyleElement.prototype.render = function () { var _a = this.props, chartStyleService = _a.chartStyleService, getPopupContainer = _a.getPopupContainer; var setPrefix = chartStyleService.setPrefix, setSuffix = chartStyleService.setSuffix, colorMode = chartStyleService.colorMode, setColorMode = chartStyleService.setColorMode, trendMode = chartStyleService.trendMode, setTrendMode = chartStyleService.setTrendMode, titleDataFont = chartStyleService.titleDataFont, gaugeEmptyValueMode = chartStyleService.gaugeEmptyValueMode, setGaugeEmptyValueMode = chartStyleService.setGaugeEmptyValueMode; return (react_1.default.createElement(react_1.default.Fragment, null, react_1.default.createElement(Base_1.SolidRadioItem, { label: type_1.SingleLocale.value.color.title, value: colorMode, onChange: setColorMode, options: constants_1.colorModeOptions }), react_1.default.createElement(Base_1.SolidRadioItem, { label: type_1.SingleLocale.value.trend.title, value: trendMode, onChange: setTrendMode, options: constants_1.trendModeOptions }), react_1.default.createElement(Base_1.NumberItem, { label: type_2.BaseLocale.title.number, value: titleDataFont.fontSize || 40, onChange: this.handleFontSizeChange, min: 0, max: 100 }), react_1.default.createElement(Base_1.SingleTextSettings, __assign({}, this.prefixAndSuffix, { getPopupContainer: getPopupContainer, setPrefix: setPrefix, setSuffix: setSuffix })), react_1.default.createElement(SingleEmptyValue_1.default, { value: gaugeEmptyValueMode, onChange: setGaugeEmptyValueMode }))); }; __decorate([ mobx_1.computed, __metadata("design:type", Object), __metadata("design:paramtypes", []) ], SingleValueStyleElement.prototype, "prefixAndSuffix", null); __decorate([ bind_1.default, __metadata("design:type", Function), __metadata("design:paramtypes", [Number]), __metadata("design:returntype", void 0) ], SingleValueStyleElement.prototype, "handleFontSizeChange", null); SingleValueStyleElement = __decorate([ mobx_react_1.observer ], SingleValueStyleElement); return SingleValueStyleElement; }(BasicComponent_1.default)); exports.SingleValueStyleElement = SingleValueStyleElement; exports.default = errorBoundary_1.default(SingleValueStyleElement);