aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-08-27 13:14:12 -0400
committerbobzel <zzzman@gmail.com>2023-08-27 13:14:12 -0400
commit5f5bdc03745a05712bf3ccd68cb59c1e814d10f2 (patch)
tree4660484aa0a3d9a0c4bb10cc5987083bdd83d906 /src
parent35295e152b138e75e63161d8c644861c5c59f5a3 (diff)
added ctrl-a to select all in tableBox
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DataVizBox/components/PieChart.tsx7
-rw-r--r--src/client/views/nodes/DataVizBox/components/TableBox.tsx54
2 files changed, 32 insertions, 29 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/PieChart.tsx b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
index 30a6deea7..6ad9e0d7e 100644
--- a/src/client/views/nodes/DataVizBox/components/PieChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/PieChart.tsx
@@ -9,7 +9,6 @@ import { List } from '../../../../../fields/List';
import { listSpec } from '../../../../../fields/Schema';
import { Cast, DocCast, StrCast } from '../../../../../fields/Types';
import { Docs } from '../../../../documents/Documents';
-import { LinkManager } from '../../../../util/LinkManager';
import { undoable } from '../../../../util/UndoManager';
import { PinProps, PresBox } from '../../trails';
import './Chart.scss';
@@ -244,16 +243,16 @@ export class PieChart extends React.Component<PieChartProps> {
// drawing the slices
var selected = this.selectedData;
var arcs = g.selectAll('arc').data(pie(data)).enter().append('g');
- const possibleDataPointVals: {[x: string]: any}[] = [];
+ const possibleDataPointVals: { [x: string]: any }[] = [];
pieDataSet.forEach((each: { [x: string]: any | { valueOf(): number } }) => {
- var dataPointVal : {[x: string]: any} = {};
+ var dataPointVal: { [x: string]: any } = {};
dataPointVal[percentField] = each[percentField];
if (descriptionField) dataPointVal[descriptionField] = each[descriptionField];
try {
dataPointVal[percentField] = Number(dataPointVal[percentField].replace(/\$/g, '').replace(/\%/g, '').replace(/\#/g, '').replace(/\</g, ''));
} catch (error) {}
possibleDataPointVals.push(dataPointVal);
- })
+ });
const sliceColors = StrListCast(this.props.layoutDoc.dataViz_pie_sliceColors).map(each => each.split('::'));
arcs.append('path')
.attr('fill', (d, i) => {
diff --git a/src/client/views/nodes/DataVizBox/components/TableBox.tsx b/src/client/views/nodes/DataVizBox/components/TableBox.tsx
index c416d7764..6688bcedb 100644
--- a/src/client/views/nodes/DataVizBox/components/TableBox.tsx
+++ b/src/client/views/nodes/DataVizBox/components/TableBox.tsx
@@ -5,7 +5,7 @@ import { Doc, Field, NumListCast, StrListCast } from '../../../../../fields/Doc'
import { List } from '../../../../../fields/List';
import { listSpec } from '../../../../../fields/Schema';
import { Cast, DocCast } from '../../../../../fields/Types';
-import { emptyFunction, setupMoveUpEvents, Utils } from '../../../../../Utils';
+import { emptyFunction, numberRange, setupMoveUpEvents, Utils } from '../../../../../Utils';
import { DragManager } from '../../../../util/DragManager';
import { LinkManager } from '../../../../util/LinkManager';
import { DocumentView } from '../../DocumentView';
@@ -71,20 +71,18 @@ export class TableBox extends React.Component<TableBoxProps> {
render() {
if (this._tableData.length > 0) {
return (
- <div className={"tableBox"}>
- <div className={'selectAll-buttons'} >
- <Button
- onClick={action(() => (this.props.layoutDoc.dataViz_selectedRows = new List<number>(this._tableDataIds)))}
- text="Select All"
- type={Type.SEC}
- color={'black'}
- />
- <Button
- onClick={action(() => (this.props.layoutDoc.dataViz_selectedRows = new List<number>()))}
- text="Deselect All"
- type={Type.SEC}
- color={'black'}
- />
+ <div
+ className="tableBox"
+ tabIndex={0}
+ onKeyDown={e => {
+ if (this.props.layoutDoc && e.key === 'a' && (e.ctrlKey || e.metaKey)) {
+ e.stopPropagation();
+ this.props.layoutDoc.dataViz_selectedRows = new List<number>(this._tableDataIds);
+ }
+ }}>
+ <div className="selectAll-buttons">
+ <Button onClick={action(() => (this.props.layoutDoc.dataViz_selectedRows = new List<number>(this._tableDataIds)))} text="Select All" type={Type.SEC} color={'black'} />
+ <Button onClick={action(() => (this.props.layoutDoc.dataViz_selectedRows = new List<number>()))} text="Deselect All" type={Type.SEC} color={'black'} />
</div>
<div
className="table-container"
@@ -132,16 +130,22 @@ export class TableBox extends React.Component<TableBoxProps> {
return embedding;
};
if (this.props.docView?.() && !Utils.isClick(e.clientX, e.clientY, downX, downY, Date.now())) {
- DragManager.StartAnchorAnnoDrag(e.target instanceof HTMLElement ? [e.target] : [], new DragManager.AnchorAnnoDragData(this.props.docView()!, sourceAnchorCreator, targetCreator), downX, downY, {
- dragComplete: e => {
- if (!e.aborted && e.annoDragData && e.annoDragData.linkSourceDoc && e.annoDragData.dropDocument && e.linkDocument) {
- e.linkDocument.link_displayLine = true;
- e.linkDocument.link_matchEmbeddings = true;
- // e.annoDragData.linkSourceDoc.followLinkToggle = e.annoDragData.dropDocument.annotationOn === this.props.rootDoc;
- // e.annoDragData.linkSourceDoc.followLinkZoom = false;
- }
- },
- });
+ DragManager.StartAnchorAnnoDrag(
+ e.target instanceof HTMLElement ? [e.target] : [],
+ new DragManager.AnchorAnnoDragData(this.props.docView()!, sourceAnchorCreator, targetCreator),
+ downX,
+ downY,
+ {
+ dragComplete: e => {
+ if (!e.aborted && e.annoDragData && e.annoDragData.linkSourceDoc && e.annoDragData.dropDocument && e.linkDocument) {
+ e.linkDocument.link_displayLine = true;
+ e.linkDocument.link_matchEmbeddings = true;
+ // e.annoDragData.linkSourceDoc.followLinkToggle = e.annoDragData.dropDocument.annotationOn === this.props.rootDoc;
+ // e.annoDragData.linkSourceDoc.followLinkZoom = false;
+ }
+ },
+ }
+ );
return true;
}
return false;