@antv/s2
Version:
effective spreadsheet render core lib
90 lines • 2.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TableSheet = void 0;
const tslib_1 = require("tslib");
const cell_1 = require("../cell");
const constant_1 = require("../common/constant");
const data_set_1 = require("../data-set");
const facet_1 = require("../facet");
const spread_sheet_1 = require("./spread-sheet");
class TableSheet extends spread_sheet_1.SpreadSheet {
isCustomRowFields() {
return false;
}
getDataSet() {
const { dataSet } = this.options;
if (dataSet) {
return dataSet(this);
}
return new data_set_1.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;
}
isHierarchyGridTreeType() {
return false;
}
/**
* Scroll Freeze Row Header
*/
isFrozenRowHeader() {
return false;
}
// eslint-disable-next-line no-empty-function
clearDrillDownData() {
return tslib_1.__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 cell_1.TableSeriesNumberCell(viewMeta, this);
}
return new cell_1.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 facet_1.TableFacet(this);
this.facet.render();
}
destroy() {
super.destroy();
this.off(constant_1.S2Event.RANGE_SORT);
this.off(constant_1.S2Event.RANGE_FILTER);
}
groupSortByMethod(sortMethod, meta) {
const { field } = meta;
const sortParam = {
sortFieldId: field,
sortMethod,
};
this.updateSortMethodMap(meta.id, sortMethod);
this.emit(constant_1.S2Event.RANGE_SORT, [sortParam]);
}
}
exports.TableSheet = TableSheet;
//# sourceMappingURL=table-sheet.js.map