zhu-jiang-yi-yuan-bigscreen
Version:
南方医科大学珠江医院大屏端
57 lines (51 loc) • 1.97 kB
JavaScript
import { OnValue } from '..';
import { Const } from '../../utils';
import { NConst } from 'nsn-const';
import { NNum, NType } from 'nsn-util';
import React from 'react';
import './index.less';
var CLS_PREFIX = "".concat(Const.CLS_PREFIX, "-indicators");
var Indicators = function Indicators(props) {
var title = props.title,
value = props.value,
valueLabel = props.valueLabel,
yearOnYearValue = props.yearOnYearValue,
monthOnMonthValue = props.monthOnMonthValue,
yearOnYearValuePercent = props.yearOnYearValuePercent,
monthOnMonthValuePercent = props.monthOnMonthValuePercent,
percent = props.percent;
var num = {
value: value || NConst.DASHED,
unit: NConst.EMPTY
};
if (value && !valueLabel) {
var vunit = ["0", NConst.EMPTY];
if (NType.isString(value)) {
vunit = NNum.splitUnit(NNum.translate(parseFloat(value)));
} else if (NType.isNumber(value)) {
vunit = NNum.splitUnit(NNum.translate(value));
}
num.value = vunit[0];
num.unit = vunit[1];
num.perc = percent;
}
return /*#__PURE__*/React.createElement("div", {
className: CLS_PREFIX
}, /*#__PURE__*/React.createElement("div", {
className: "title"
}, title), /*#__PURE__*/React.createElement("div", {
className: "value"
}, /*#__PURE__*/React.createElement("span", null, num.value), /*#__PURE__*/React.createElement("span", {
className: "unit"
}, num.unit), /*#__PURE__*/React.createElement("span", null, num.perc && (value ? '%' : NConst.EMPTY))), NType.isNumber(yearOnYearValue) ? /*#__PURE__*/React.createElement(OnValue, {
value: yearOnYearValue,
isYearOnYear: true,
className: "onvalue",
notPercent: yearOnYearValuePercent
}) : NConst.EMPTY, NType.isNumber(monthOnMonthValue) ? /*#__PURE__*/React.createElement(OnValue, {
value: monthOnMonthValue,
className: "onvalue",
notPercent: monthOnMonthValuePercent
}) : NConst.EMPTY);
};
export { Indicators };