antd
Version:
An enterprise-class UI design language and React components implementation
51 lines (45 loc) • 1.83 kB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import * as React from 'react';
import classNames from 'classnames';
import { withConfigConsumer } from '../config-provider';
import StatisticNumber from './Number';
var Statistic = function Statistic(props) {
var prefixCls = props.prefixCls,
className = props.className,
style = props.style,
valueStyle = props.valueStyle,
_props$value = props.value,
value = _props$value === void 0 ? 0 : _props$value,
title = props.title,
valueRender = props.valueRender,
prefix = props.prefix,
suffix = props.suffix;
var valueNode = React.createElement(StatisticNumber, _extends({}, props, {
value: value
}));
if (valueRender) {
valueNode = valueRender(valueNode);
}
return React.createElement("div", {
className: classNames(prefixCls, className),
style: style
}, title && React.createElement("div", {
className: "".concat(prefixCls, "-title")
}, title), React.createElement("div", {
style: valueStyle,
className: "".concat(prefixCls, "-content")
}, prefix && React.createElement("span", {
className: "".concat(prefixCls, "-content-prefix")
}, prefix), valueNode, suffix && React.createElement("span", {
className: "".concat(prefixCls, "-content-suffix")
}, suffix)));
};
Statistic.defaultProps = {
decimalSeparator: '.',
groupSeparator: ','
};
var WrapperStatistic = withConfigConsumer({
prefixCls: 'statistic'
})(Statistic);
export default WrapperStatistic;
//# sourceMappingURL=Statistic.js.map