UNPKG

@antv/s2-react

Version:
27 lines 1.01 kB
import { ColCell, drawCustomContent, safeJsonParse, } from '@antv/s2'; import { isArray } from 'lodash'; /** * Cell for StrategySheet * ------------------------------------- * | root label | * | label1 label2 label3 | * -------------------------------------- */ export class StrategySheetColCell extends ColCell { constructor(meta, spreadsheet, headerConfig) { super(meta, spreadsheet, headerConfig); } drawTextShape() { const meta = this.getMeta(); const value = safeJsonParse(meta === null || meta === void 0 ? void 0 : meta.value); if (!isArray(value)) { return super.drawTextShape(); } const { formattedValue } = this.getFormattedFieldValue(); const displayValues = formattedValue !== (meta === null || meta === void 0 ? void 0 : meta.value) ? [[formattedValue]] : [value]; drawCustomContent(this, { values: displayValues, }, false); } } //# sourceMappingURL=col-cell.js.map