Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private selectedRegionTransform = (region: IRegion) => {
// convert cell selection to row selection
if (Regions.getRegionCardinality(region) === RegionCardinality.CELLS) {
return Regions.row(region.rows[0], region.rows[1]);
}
return region;
};
}
private getEnabledSelectionModes() {
const selectionModes: RegionCardinality[] = [];
if (this.state.enableFullTableSelection) {
selectionModes.push(RegionCardinality.FULL_TABLE);
}
if (this.state.enableColumnSelection) {
selectionModes.push(RegionCardinality.FULL_COLUMNS);
}
if (this.state.enableRowSelection) {
selectionModes.push(RegionCardinality.FULL_ROWS);
}
if (this.state.enableCellSelection) {
selectionModes.push(RegionCardinality.CELLS);
}
return selectionModes;
}
enableColumnSelection: true,
enableContextMenu: false,
enableFullTableSelection: true,
enableLayoutBoundary: false,
enableMultiSelection: true,
enableRowReordering: false,
enableRowResizing: false,
enableRowSelection: true,
enableSlowLayout: false,
numCols: COLUMN_COUNTS[COLUMN_COUNT_DEFAULT_INDEX],
numFrozenCols: FROZEN_COLUMN_COUNTS[FROZEN_COLUMN_COUNT_DEFAULT_INDEX],
numFrozenRows: FROZEN_ROW_COUNTS[FROZEN_ROW_COUNT_DEFAULT_INDEX],
numRows: ROW_COUNTS[ROW_COUNT_DEFAULT_INDEX],
renderMode: RenderMode.BATCH_ON_UPDATE,
scrollToColumnIndex: 0,
scrollToRegionType: RegionCardinality.CELLS,
scrollToRowIndex: 0,
selectedFocusStyle: FocusStyle.TAB,
selectedRegionTransformPreset: SelectedRegionTransformPreset.CELL,
selectedRegions: [],
showCallbackLogs: true,
showCellsLoading: false,
showColumnHeadersLoading: false,
showColumnMenus: false,
showCustomRegions: false,
showFocusCell: false,
showGhostCells: true,
showInline: false,
showRowHeaders: true,
showRowHeadersLoading: false,
showTableInteractionBar: false,
showZebraStriping: false,
CELL = "cell",
ROW = "row",
COLUMN = "column",
}
type IMutableStateUpdateCallback = (
stateKey: keyof IMutableTableState,
) => (event: React.FormEvent) => void;
const COLUMN_COUNTS = [0, 1, 5, 20, 100, 1000];
const ROW_COUNTS = [0, 1, 5, 20, 100, 1000, 100000];
const FROZEN_COLUMN_COUNTS = [0, 1, 2, 5, 20, 100, 1000];
const FROZEN_ROW_COUNTS = [0, 1, 2, 5, 20, 100, 1000];
const REGION_CARDINALITIES: RegionCardinality[] = [
RegionCardinality.CELLS,
RegionCardinality.FULL_ROWS,
RegionCardinality.FULL_COLUMNS,
RegionCardinality.FULL_TABLE,
];
const RENDER_MODES: RenderMode[] = [RenderMode.BATCH_ON_UPDATE, RenderMode.BATCH, RenderMode.NONE];
const SELECTION_MODES: SelectedRegionTransformPreset[] = [
SelectedRegionTransformPreset.CELL,
SelectedRegionTransformPreset.ROW,
SelectedRegionTransformPreset.COLUMN,
];
const CELL_CONTENTS: CellContent[] = [
CellContent.EMPTY,
CellContent.CELL_NAMES,