From 8928ba1f332e319cab025987a098c87de607e853 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 24 Apr 2024 19:15:35 -0400 Subject: post merge eslint cleanup --- .../views/nodes/DataVizBox/components/TableBox.tsx | 55 ++++++++++++++-------- 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'src/client/views/nodes/DataVizBox/components') diff --git a/src/client/views/nodes/DataVizBox/components/TableBox.tsx b/src/client/views/nodes/DataVizBox/components/TableBox.tsx index b0176f992..8038b2cd4 100644 --- a/src/client/views/nodes/DataVizBox/components/TableBox.tsx +++ b/src/client/views/nodes/DataVizBox/components/TableBox.tsx @@ -16,6 +16,7 @@ import { ObservableReactComponent } from '../../../ObservableReactComponent'; import { DocumentView } from '../../DocumentView'; import { DataVizView } from '../DataVizBox'; import './Chart.scss'; + const { DATA_VIZ_TABLE_ROW_HEIGHT } = require('../../../global/globalCssVariables.module.scss'); // prettier-ignore interface TableBoxProps { @@ -124,7 +125,7 @@ export class TableBox extends ObservableReactComponent { selected.splice(selected.indexOf(rowId), 1); } else selected?.push(rowId); e.stopPropagation(); - this.hasRowsToFilter = selected.length > 0 ? true : false; + this.hasRowsToFilter = selected.length > 0; }; columnPointerDown = (e: React.PointerEvent, col: string) => { @@ -164,10 +165,10 @@ export class TableBox extends ObservableReactComponent { return false; }, emptyFunction, - action(e => { - if (e.shiftKey || this.settingTitle) { + action(moveEv => { + if (moveEv.shiftKey || this.settingTitle) { if (this.settingTitle) this.settingTitle = false; - if (this._props.titleCol == col) this._props.titleCol = ''; + if (this._props.titleCol === col) this._props.titleCol = ''; else this._props.titleCol = col; this._props.selectTitleCol(this._props.titleCol); } else { @@ -185,16 +186,16 @@ export class TableBox extends ObservableReactComponent { * These functions handle the filtering popup for when the "filter" button is pressed to select rows */ filter = undoable((e: any) => { - var start: any; - var end: any; - if (this.filteringType == 'Range') { + let start: any; + let end: any; + if (this.filteringType === 'Range') { start = (this.filteringVal[0] as Number) ? Number(this.filteringVal[0]) : this.filteringVal[0]; end = (this.filteringVal[1] as Number) ? Number(this.filteringVal[1]) : this.filteringVal[0]; } this._tableDataIds.forEach(rowID => { - if (this.filteringType == 'Value') { - if (this._props.records[rowID][this.filteringColumn] == this.filteringVal[0]) { + if (this.filteringType === 'Value') { + if (this._props.records[rowID][this.filteringColumn] === this.filteringVal[0]) { if (!NumListCast(this._props.layoutDoc.dataViz_selectedRows).includes(rowID)) { this.tableRowClick(e, rowID); } @@ -231,12 +232,12 @@ export class TableBox extends ObservableReactComponent { this.filteringVal[1] = e.target.value; }); @computed get renderFiltering() { - if (this.filteringColumn === '') this.filteringColumn = this.columns[0]; + if (this.filteringColumn === '') [this.filteringColumn] = this.columns; return (
Column: - this.setFilterColumn(e)}> {this.columns.map(column => (
: - {this.filteringType == 'Value' ? ( + {this.filteringType === 'Value' ? ( { )}
-
); @@ -324,11 +325,25 @@ export class TableBox extends ObservableReactComponent { }}>
-
{this.filtering ? this.renderFiltering : null} -