UNPKG

@antv/s2-react

Version:
19 lines 991 B
import { getStrategySheetTooltipClsName as tooltipCls } from '@antv/s2'; import cls from 'classnames'; import { isFunction } from 'lodash'; import React from 'react'; import './index.less'; export const StrategySheetColCellTooltip = ({ cell, label, }) => { const meta = cell.getMeta(); // 趋势分析表叶子节点显示是指标标题, tooltip 中没必要再显示了 if (meta.isLeaf && meta.level !== 0) { return null; } const cellName = meta.spreadsheet.dataSet.getFieldName(meta.field); const customLabel = isFunction(label) ? label(cell, cellName) : label; const name = customLabel !== null && customLabel !== void 0 ? customLabel : cellName; return (React.createElement("div", { className: cls(tooltipCls(), tooltipCls('col')) }, React.createElement("span", { className: tooltipCls('name') }, name), React.createElement("span", { className: tooltipCls('value') }, meta.value))); }; //# sourceMappingURL=col-cell-tooltip.js.map