@antv/s2-react
Version:
use S2 with react
17 lines • 1.16 kB
JavaScript
import { i18n, getStrategySheetTooltipClsName as tooltipCls, } from '@antv/s2';
import cls from 'classnames';
import { isFunction } from 'lodash';
import React from 'react';
import './index.less';
export const StrategySheetRowCellTooltip = ({ cell, label, }) => {
const { field, spreadsheet, value, extra } = cell.getMeta();
const customLabel = isFunction(label) ? label(cell, value) : label;
const rowName = customLabel !== null && customLabel !== void 0 ? customLabel : value;
const description = spreadsheet.dataSet.getFieldDescription(field) || (extra === null || extra === void 0 ? void 0 : extra['description']);
return (React.createElement("div", { className: cls(tooltipCls(), tooltipCls('row')) },
React.createElement("div", { className: tooltipCls('value') }, rowName),
description && (React.createElement("div", { className: tooltipCls('description') },
React.createElement("span", { className: tooltipCls('description-label') }, i18n('说明')),
React.createElement("span", { className: tooltipCls('description-text') }, description)))));
};
//# sourceMappingURL=row-cell-tooltip.js.map