@antv/s2
Version:
effective spreadsheet render core lib
16 lines • 908 B
JavaScript
import { includes } from 'lodash';
import { EXTRA_FIELD } from '../../common';
export const whetherLeafByLevel = (params) => {
var _a, _b, _c, _d;
const { spreadsheet, level, fields } = params;
const { options, dataSet } = spreadsheet;
const moreThanOneValue = dataSet.moreThanOneValue();
const isValueInCols = (_b = (_a = spreadsheet.dataCfg.fields) === null || _a === void 0 ? void 0 : _a.valueInCols) !== null && _b !== void 0 ? _b : true;
const isHideMeasure = ((_d = (_c = options === null || options === void 0 ? void 0 : options.style) === null || _c === void 0 ? void 0 : _c.colCell) === null || _d === void 0 ? void 0 : _d.hideValue) &&
isValueInCols &&
!moreThanOneValue &&
includes(fields, EXTRA_FIELD);
const extraSize = isHideMeasure ? 2 : 1;
return level === fields.length - extraSize;
};
//# sourceMappingURL=whether-leaf-by-level.js.map