aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/components/TableBox.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2024-04-24 19:15:35 -0400
committerbobzel <zzzman@gmail.com>2024-04-24 19:15:35 -0400
commit8928ba1f332e319cab025987a098c87de607e853 (patch)
treef3c3ed84556286e00cea69e86134fdb094d38c2a /src/client/views/nodes/DataVizBox/components/TableBox.tsx
parentb9825ff743ea853139a4072ce871d36d00227c4b (diff)
post merge eslint cleanup
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/TableBox.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/components/TableBox.tsx55
1 files changed, 35 insertions, 20 deletions
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<TableBoxProps> {
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<TableBoxProps> {
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<TableBoxProps> {
* 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<TableBoxProps> {
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 (
<div className="tableBox-filterPopup" style={{ right: this._props.width * 0.05 }}>
<div className="tableBox-filterPopup-selectColumn">
Column:
- <select className="tableBox-filterPopup-selectColumn-each" value={this.filteringColumn != '' ? this.filteringColumn : this.columns[0]} onChange={e => this.setFilterColumn(e)}>
+ <select className="tableBox-filterPopup-selectColumn-each" value={this.filteringColumn !== '' ? this.filteringColumn : this.columns[0]} onChange={e => this.setFilterColumn(e)}>
{this.columns.map(column => (
<option className="" key={column} value={column}>
{' '}
@@ -247,17 +248,17 @@ export class TableBox extends ObservableReactComponent<TableBoxProps> {
</div>
<div className="tableBox-filterPopup-setValue">
<select className="tableBox-filterPopup-setValue-each" value={this.filteringType} onChange={e => this.setFilterType(e)}>
- <option className="" key={'Value'} value={'Value'}>
+ <option className="" key="Value" value="Value">
{' '}
{'Value'}{' '}
</option>
- <option className="" key={'Range'} value={'Range'}>
+ <option className="" key="Range" value="Range">
{' '}
{'Range'}{' '}
</option>
</select>
:
- {this.filteringType == 'Value' ? (
+ {this.filteringType === 'Value' ? (
<input
className="tableBox-filterPopup-setValue-input"
defaultValue=""
@@ -303,7 +304,7 @@ export class TableBox extends ObservableReactComponent<TableBoxProps> {
)}
</div>
<div className="tableBox-filterPopup-setFilter">
- <Button onClick={action(e => this.filter(e))} text="Set Filter" type={Type.SEC} color={'black'} />
+ <Button onClick={action(e => this.filter(e))} text="Set Filter" type={Type.SEC} color="black" />
</div>
</div>
);
@@ -324,11 +325,25 @@ export class TableBox extends ObservableReactComponent<TableBoxProps> {
}}>
<div className="tableBox-selectButtons">
<div className="tableBox-selectTitle">
- <Button onClick={action(() => (this.settingTitle = !this.settingTitle))} text="Select Title Column" type={Type.SEC} color={'black'} />
+ <Button
+ onClick={action(() => {
+ this.settingTitle = !this.settingTitle;
+ })}
+ text="Select Title Column"
+ type={Type.SEC}
+ color="black"
+ />
</div>
<div className="tableBox-filtering">
{this.filtering ? this.renderFiltering : null}
- <Button onClick={action(() => (this.filtering = !this.filtering))} text="Filter" type={Type.SEC} color={'black'} />
+ <Button
+ onClick={action(() => {
+ this.filtering = !this.filtering;
+ })}
+ text="Filter"
+ type={Type.SEC}
+ color="black"
+ />
<div className="tableBox-filterAll">
{this.hasRowsToFilter ? (
<Button
@@ -338,7 +353,7 @@ export class TableBox extends ObservableReactComponent<TableBoxProps> {
})}
text="Deselect All"
type={Type.SEC}
- color={'black'}
+ color="black"
tooltip="Select rows to be displayed in any DataViz boxes dragged off of this one."
/>
) : (
@@ -349,7 +364,7 @@ export class TableBox extends ObservableReactComponent<TableBoxProps> {
})}
text="Select All"
type={Type.SEC}
- color={'black'}
+ color="black"
tooltip="Select rows to be displayed in any DataViz boxes dragged off of this one."
/>
)}
@@ -402,7 +417,7 @@ export class TableBox extends ObservableReactComponent<TableBoxProps> {
? '#E3fbdb'
: this._props.axes.length > 2 && this._props.axes.lastElement() === col
? '#Fbdbdb'
- : this._props.axes.lastElement() === col || (this._props.axes.length > 2 && this._props.axes[1] == col)
+ : this._props.axes.lastElement() === col || (this._props.axes.length > 2 && this._props.axes[1] === col)
? '#c6ebf7'
: undefined,
fontWeight: 'bolder',