aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/ContextMenu.tsx5
-rw-r--r--src/client/views/ContextMenuItem.tsx3
-rw-r--r--src/client/views/EditableView.tsx57
-rw-r--r--src/client/views/ScriptingRepl.scss2
-rw-r--r--src/client/views/collections/collectionSchema/SchemaCellField.tsx17
-rw-r--r--src/client/views/nodes/DataVizBox/components/TableBox.tsx18
6 files changed, 52 insertions, 50 deletions
diff --git a/src/client/views/ContextMenu.tsx b/src/client/views/ContextMenu.tsx
index 98087e224..4b67ef704 100644
--- a/src/client/views/ContextMenu.tsx
+++ b/src/client/views/ContextMenu.tsx
@@ -1,6 +1,3 @@
-/* eslint-disable react/no-array-index-key */
-/* eslint-disable react/jsx-props-no-spreading */
-/* eslint-disable default-param-last */
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { action, computed, IReactionDisposer, makeObservable, observable, runInAction } from 'mobx';
import { observer } from 'mobx-react';
@@ -277,4 +274,4 @@ export class ContextMenu extends ObservableReactComponent<{ noexpand?: boolean }
this._selectedIndex = Math.min(this.flatItems.length - 1, this._selectedIndex);
}
};
-} \ No newline at end of file
+}
diff --git a/src/client/views/ContextMenuItem.tsx b/src/client/views/ContextMenuItem.tsx
index 610032225..6f8f41bdd 100644
--- a/src/client/views/ContextMenuItem.tsx
+++ b/src/client/views/ContextMenuItem.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/jsx-props-no-spreading */
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { action, makeObservable, observable, runInAction } from 'mobx';
@@ -95,4 +94,4 @@ export class ContextMenuItem extends ObservableReactComponent<ContextMenuProps &
const submenu = this._items.map(prop => <ContextMenuItem {...prop} key={prop.description} closeMenu={this._props.closeMenu} />);
return this.props.event || this._props.noexpand ? this.renderItem(submenu) : <div className="contextMenu-inlineMenu">{submenu}</div>;
}
-} \ No newline at end of file
+}
diff --git a/src/client/views/EditableView.tsx b/src/client/views/EditableView.tsx
index 9722b2d4b..612ecee62 100644
--- a/src/client/views/EditableView.tsx
+++ b/src/client/views/EditableView.tsx
@@ -7,7 +7,6 @@ import { DocumentIconContainer } from './nodes/DocumentIcon';
import { FieldView, FieldViewProps } from './nodes/FieldView';
import { ObservableReactComponent } from './ObservableReactComponent';
import { OverlayView } from './OverlayView';
-import { Padding } from 'browndash-components';
import { SchemaFieldType } from './collections/collectionSchema/SchemaColumnHeader';
export interface EditableProps {
@@ -90,7 +89,7 @@ export class EditableView extends ObservableReactComponent<EditableProps> {
this._overlayDisposer?.();
this._overlayDisposer = OverlayView.Instance.addElement(<DocumentIconContainer />, { x: 0, y: 0 });
this._props.highlightCells?.(this._props.GetValue() ?? '');
- }
+ }
});
} else {
this._overlayDisposer?.();
@@ -200,7 +199,7 @@ export class EditableView extends ObservableReactComponent<EditableProps> {
}
}
};
-
+
@action
finalizeEdit(value: string, shiftDown: boolean, lostFocus: boolean, enterKey: boolean) {
if (this._props.SetValue(value, shiftDown, enterKey)) {
@@ -235,7 +234,7 @@ export class EditableView extends ObservableReactComponent<EditableProps> {
setIsEditing = (value: boolean) => {
this._editing = value;
return this._editing;
- }
+ };
renderEditor() {
return this._props.autosuggestProps ? (
@@ -254,11 +253,11 @@ export class EditableView extends ObservableReactComponent<EditableProps> {
onChange: this._props.autosuggestProps.onChange,
}}
/>
- ) : ( this._props.oneLine !== false && this._props.GetValue()?.toString().indexOf('\n') === -1 ? (
+ ) : this._props.oneLine !== false && this._props.GetValue()?.toString().indexOf('\n') === -1 ? (
<input
- className="editableView-input"
+ className="editableView-input"
ref={r => { this._inputref = r; }} // prettier-ignore
- style={{ display: this._props.display, overflow: 'auto', fontSize: this._props.fontSize, minWidth: 20, background: this._props.background}}
+ style={{ display: this._props.display, overflow: 'auto', fontSize: this._props.fontSize, minWidth: 20, background: this._props.background }}
placeholder={this._props.placeholder}
onBlur={e => this.finalizeEdit(e.currentTarget.value, false, true, false)}
defaultValue={this._props.GetValue()}
@@ -284,39 +283,41 @@ export class EditableView extends ObservableReactComponent<EditableProps> {
onClick={this.stopPropagation}
onPointerUp={this.stopPropagation}
/>
- ));
+ );
}
staticDisplay = () => {
let toDisplay;
const gval = this._props.GetValue()?.replace(/\n/g, '\\r\\n');
- if (this._props.schemaFieldType === SchemaFieldType.Header){
- toDisplay = <input className="editableView-input"
- value={gval}
- placeholder='Add key'
- readOnly
- style={{ display: this._props.display, overflow: 'auto', pointerEvents: 'none', fontSize: this._props.fontSize, width: '100%', margin: 0, background: this._props.background}}
- // eslint-disable-next-line jsx-a11y/no-autofocus
- />
+ if (this._props.schemaFieldType === SchemaFieldType.Header) {
+ toDisplay = (
+ <input
+ className="editableView-input"
+ value={gval}
+ placeholder="Add key"
+ readOnly
+ style={{ display: this._props.display, overflow: 'auto', pointerEvents: 'none', fontSize: this._props.fontSize, width: '100%', margin: 0, background: this._props.background }}
+ />
+ );
} else {
- toDisplay = (<span className='editableView-static'
- style={{
- fontStyle: this._props.fontStyle,
- fontSize: this._props.fontSize
- }}>
- {
- // eslint-disable-next-line react/jsx-props-no-spreading
- this._props.fieldContents ? <FieldView {...this._props.fieldContents} /> : this.props.contents ? this._props.contents?.valueOf() : '' as any
- }
- </span>)
+ toDisplay = (
+ <span
+ className="editableView-static"
+ style={{
+ fontStyle: this._props.fontStyle,
+ fontSize: this._props.fontSize,
+ }}>
+ {this._props.fieldContents ? <FieldView {...this._props.fieldContents} /> : (this.props.contents ?? '')}
+ </span>
+ );
}
return toDisplay;
- }
+ };
render() {
const gval = this._props.GetValue()?.replace(/\n/g, '\\r\\n');
- if ((this._editing && gval !== undefined)) {
+ if (this._editing && gval !== undefined) {
return this._props.sizeToContent ? (
<div style={{ display: 'grid', minWidth: 100 }}>
<div style={{ display: 'inline-block', position: 'relative', height: 0, width: '100%', overflow: 'hidden' }}>{this.renderEditor()}</div>
diff --git a/src/client/views/ScriptingRepl.scss b/src/client/views/ScriptingRepl.scss
index 5fe176920..adc82238e 100644
--- a/src/client/views/ScriptingRepl.scss
+++ b/src/client/views/ScriptingRepl.scss
@@ -35,8 +35,6 @@
opacity: 0.3;
}
-
-
.scriptingObject-icon {
padding: 3px;
cursor: pointer;
diff --git a/src/client/views/collections/collectionSchema/SchemaCellField.tsx b/src/client/views/collections/collectionSchema/SchemaCellField.tsx
index 84e7b62bf..ce41b2758 100644
--- a/src/client/views/collections/collectionSchema/SchemaCellField.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaCellField.tsx
@@ -27,6 +27,7 @@ export interface SchemaCellFieldProps {
oneLine?: boolean;
Document: Doc;
fieldKey: string;
+ // eslint-disable-next-line no-use-before-define
refSelectModeInfo: { enabled: boolean; currEditing: SchemaCellField | undefined };
highlightCells?: (text: string) => void;
GetValue(): string | undefined;
@@ -301,13 +302,14 @@ export class SchemaCellField extends ObservableReactComponent<SchemaCellFieldPro
setTimeout(() => this.setupRefSelect(this.refSelectConditionMet), 0);
break;
case ' ':
- e.stopPropagation();
- let cursorPos = 0;
- if (this.cursorPosition !== null) cursorPos = this.cursorPosition + 1;
- setTimeout(() => {
- this.setContent(this._unrenderedContent);
- setTimeout(() => this.setCursorPosition(cursorPos));
- }, 0);
+ {
+ e.stopPropagation();
+ const cursorPos = this.cursorPosition !== null ? this.cursorPosition + 1 : 0;
+ setTimeout(() => {
+ this.setContent(this._unrenderedContent);
+ setTimeout(() => this.setCursorPosition(cursorPos));
+ }, 0);
+ }
break;
case 'u': // for some reason 'u' otherwise exits the editor
e.stopPropagation();
@@ -318,7 +320,6 @@ export class SchemaCellField extends ObservableReactComponent<SchemaCellFieldPro
case 'Control':
case ':': // prettier-ignore
break;
- // eslint-disable-next-line no-fallthrough
default:
break;
}
diff --git a/src/client/views/nodes/DataVizBox/components/TableBox.tsx b/src/client/views/nodes/DataVizBox/components/TableBox.tsx
index 6cc773da0..fe596bc36 100644
--- a/src/client/views/nodes/DataVizBox/components/TableBox.tsx
+++ b/src/client/views/nodes/DataVizBox/components/TableBox.tsx
@@ -1,5 +1,3 @@
-/* eslint-disable jsx-a11y/no-noninteractive-tabindex */
-/* eslint-disable jsx-a11y/no-static-element-interactions */
import { Button, Colors, Type } from 'browndash-components';
import { IReactionDisposer, action, computed, makeObservable, observable, reaction, runInAction } from 'mobx';
import { observer } from 'mobx-react';
@@ -18,6 +16,7 @@ import { DocumentView } from '../../DocumentView';
import { DataVizView } from '../DataVizBox';
import './Chart.scss';
+// eslint-disable-next-line @typescript-eslint/no-require-imports
const { DATA_VIZ_TABLE_ROW_HEIGHT } = require('../../../global/globalCssVariables.module.scss'); // prettier-ignore
interface TableBoxProps {
@@ -416,7 +415,7 @@ export class TableBox extends ObservableReactComponent<TableBoxProps> {
? 'darkred'
: this._props.axes.length > 3 && this._props.axes[1] === col
? 'darkblue'
- : this._props.axes.lastElement() === col || (this._props.axes.length > 3 && this._props.axes[2] === col)
+ : this._props.axes.lastElement() === col || (this._props.axes.length > 3 && this._props.axes[2] === col)
? 'darkcyan'
: undefined,
background: this.settingTitle
@@ -427,7 +426,7 @@ export class TableBox extends ObservableReactComponent<TableBoxProps> {
? '#Fbdbdb'
: this._props.axes.lastElement() === col || (this._props.axes.length > 2 && this._props.axes[1] === col)
? '#c6ebf7'
- : this._props.axes.lastElement() === col || (this._props.axes.length > 3 && this._props.axes[2] === col)
+ : this._props.axes.lastElement() === col || (this._props.axes.length > 3 && this._props.axes[2] === col)
? '#c2f0f4'
: undefined,
fontWeight: 'bolder',
@@ -448,8 +447,15 @@ export class TableBox extends ObservableReactComponent<TableBoxProps> {
className={`tableBox-row ${this.columns[0]}`}
onClick={e => this.tableRowClick(e, rowId)}
style={{
- background: rowId === this._props.specHighlightedRow ? 'lightblue' : NumListCast(this._props.layoutDoc.dataViz_highlitedRows).includes(rowId) ? 'lightYellow' : NumListCast(this._props.layoutDoc.dataViz_selectedRows).includes(rowId) ? 'lightgrey' : '',
- border: rowId === this._props.specHighlightedRow ? `solid 3px ${Colors.MEDIUM_BLUE}` : ''
+ background:
+ rowId === this._props.specHighlightedRow
+ ? 'lightblue'
+ : NumListCast(this._props.layoutDoc.dataViz_highlitedRows).includes(rowId)
+ ? 'lightYellow'
+ : NumListCast(this._props.layoutDoc.dataViz_selectedRows).includes(rowId)
+ ? 'lightgrey'
+ : '',
+ border: rowId === this._props.specHighlightedRow ? `solid 3px ${Colors.MEDIUM_BLUE}` : '',
}}>
{this.columns.map(col => {
let colSelected = false;