UNPKG

@qn-pandora/pandora-visualization

Version:

Pandora 通用可视化库

34 lines (33 loc) 1.62 kB
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); }; import React, { useMemo } from 'react'; import Affix from '../Affix'; import * as styles from './style.mless'; export default function ValueContent(props) { var prefixStyle = props.prefixStyle, suffixStyle = props.suffixStyle, prefix = props.prefix, suffix = props.suffix, chartColor = props.chartColor, displayData = props.displayData, defaulTitleStyle = props.defaulTitleStyle, trendView = props.trendView, minWidth = props.minWidth; var valueSpanStyle = useMemo(function () { return __assign(__assign({}, defaulTitleStyle), { color: 'inherit' }); }, [defaulTitleStyle]); var currentStyle = useMemo(function () { return minWidth ? { minWidth: minWidth } : {}; }, [minWidth]); return (React.createElement("div", { className: styles.singleChartCurrentValue, style: currentStyle }, React.createElement("span", { style: { color: chartColor } }, React.createElement(Affix, { affix: prefix, defaultStyle: prefixStyle }), React.createElement("span", { style: valueSpanStyle }, displayData), React.createElement(Affix, { affix: suffix, defaultStyle: suffixStyle }), trendView && trendView))); }