@antv/s2-react
Version:
use S2 with react
31 lines • 1.17 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StrategySheetColCell = void 0;
const s2_1 = require("@antv/s2");
const lodash_1 = require("lodash");
/**
* Cell for StrategySheet
* -------------------------------------
* | root label |
* | label1 label2 label3 |
* --------------------------------------
*/
class StrategySheetColCell extends s2_1.ColCell {
constructor(meta, spreadsheet, headerConfig) {
super(meta, spreadsheet, headerConfig);
}
drawTextShape() {
const meta = this.getMeta();
const value = (0, s2_1.safeJsonParse)(meta === null || meta === void 0 ? void 0 : meta.value);
if (!(0, lodash_1.isArray)(value)) {
return super.drawTextShape();
}
const { formattedValue } = this.getFormattedFieldValue();
const displayValues = formattedValue !== (meta === null || meta === void 0 ? void 0 : meta.value) ? [[formattedValue]] : [value];
(0, s2_1.drawCustomContent)(this, {
values: displayValues,
}, false);
}
}
exports.StrategySheetColCell = StrategySheetColCell;
//# sourceMappingURL=col-cell.js.map