UNPKG

@antv/s2-react

Version:
22 lines 1.68 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StrategySheetRowCellTooltip = void 0; const tslib_1 = require("tslib"); const s2_1 = require("@antv/s2"); const classnames_1 = tslib_1.__importDefault(require("classnames")); const lodash_1 = require("lodash"); const react_1 = tslib_1.__importDefault(require("react")); require("./index.less"); const StrategySheetRowCellTooltip = ({ cell, label, }) => { const { field, spreadsheet, value, extra } = cell.getMeta(); const customLabel = (0, lodash_1.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_1.default.createElement("div", { className: (0, classnames_1.default)((0, s2_1.getStrategySheetTooltipClsName)(), (0, s2_1.getStrategySheetTooltipClsName)('row')) }, react_1.default.createElement("div", { className: (0, s2_1.getStrategySheetTooltipClsName)('value') }, rowName), description && (react_1.default.createElement("div", { className: (0, s2_1.getStrategySheetTooltipClsName)('description') }, react_1.default.createElement("span", { className: (0, s2_1.getStrategySheetTooltipClsName)('description-label') }, (0, s2_1.i18n)('说明')), react_1.default.createElement("span", { className: (0, s2_1.getStrategySheetTooltipClsName)('description-text') }, description))))); }; exports.StrategySheetRowCellTooltip = StrategySheetRowCellTooltip; //# sourceMappingURL=row-cell-tooltip.js.map