UNPKG

@antv/s2

Version:

effective spreadsheet render core lib

83 lines 2.47 kB
import { __awaiter } from "tslib"; import { TableDataCell, TableSeriesNumberCell } from '../cell'; import { S2Event } from '../common/constant'; import { TableDataSet } from '../data-set'; import { TableFacet } from '../facet'; import { SpreadSheet } from './spread-sheet'; export class TableSheet extends SpreadSheet { isCustomRowFields() { return false; } getDataSet() { const { dataSet } = this.options; if (dataSet) { return dataSet(this); } return new TableDataSet(this); } /** * Check if is pivot mode */ isPivotMode() { return false; } /** * Check if is pivot mode */ isTableMode() { return true; } /** * tree type must be in strategy mode */ isHierarchyTreeType() { return false; } /** * Scroll Freeze Row Header */ isFrozenRowHeader() { return false; } // eslint-disable-next-line no-empty-function clearDrillDownData() { return __awaiter(this, void 0, void 0, function* () { }); } /** * Check if the value is in the columns */ isValueInCols() { return false; } bindEvents() { } buildFacet() { var _a, _b, _c, _d, _e; var _f; const defaultCell = (viewMeta) => { var _a; if (((_a = this.options.seriesNumber) === null || _a === void 0 ? void 0 : _a.enable) && viewMeta.colIndex === 0) { return new TableSeriesNumberCell(viewMeta, this); } return new TableDataCell(viewMeta, this); }; (_a = (_f = this.options).dataCell) !== null && _a !== void 0 ? _a : (_f.dataCell = defaultCell); (_b = this.facet) === null || _b === void 0 ? void 0 : _b.destroy(); this.facet = (_e = (_d = (_c = this.options).facet) === null || _d === void 0 ? void 0 : _d.call(_c, this)) !== null && _e !== void 0 ? _e : new TableFacet(this); this.facet.render(); } destroy() { super.destroy(); this.off(S2Event.RANGE_SORT); this.off(S2Event.RANGE_FILTER); } groupSortByMethod(sortMethod, meta) { const { field } = meta; const sortParam = { sortFieldId: field, sortMethod, }; this.updateSortMethodMap(meta.id, sortMethod); this.emit(S2Event.RANGE_SORT, [sortParam]); } } //# sourceMappingURL=table-sheet.js.map