Skip to content

Commit 49b9e1c

Browse files
committed
Gantt: Add global range selection sync to Gantt chart with toggle button
Signed-off-by: Anh Hoang Nguyen <[email protected]>
1 parent c4c38ec commit 49b9e1c

File tree

6 files changed

+667
-44
lines changed

6 files changed

+667
-44
lines changed

packages/react-components/src/components/abstract-gantt-output-component.tsx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ export abstract class AbstractGanttOutputComponent<
9696
private vscrollLayer: TimeGraphVerticalScrollbar;
9797
private chartCursors: TimeGraphChartCursors;
9898
private markerChartCursors: TimeGraphChartCursors;
99-
private arrowLayer: TimeGraphChartArrows;
100-
private rangeEventsLayer: TimeGraphRangeEventsLayer;
99+
protected arrowLayer: TimeGraphChartArrows;
100+
protected rangeEventsLayer: TimeGraphRangeEventsLayer;
101101

102102
private horizontalContainer: React.RefObject<HTMLDivElement>;
103103
protected chartTreeRef: React.RefObject<HTMLDivElement>;
104104
protected markerTreeRef: React.RefObject<HTMLDivElement>;
105105
private containerRef: React.RefObject<ReactTimeGraphContainer>;
106106

107-
private tspDataProvider: TspDataProvider;
107+
protected tspDataProvider: TspDataProvider;
108108
private styleProvider: StyleProvider;
109109
private styleMap = new Map<string, TimeGraphStateStyle>();
110110

@@ -116,7 +116,7 @@ export abstract class AbstractGanttOutputComponent<
116116
this.doHandleContextMenuContributed(payload);
117117
protected onOrderChange = (ids: number[]) => this.doHandleOrderChange(ids);
118118
protected onOrderReset = () => this.doHandleOrderReset();
119-
private pendingSelection: TimeGraphEntry | undefined;
119+
protected pendingSelection: TimeGraphEntry | undefined;
120120

121121
private _debouncedUpdateChart = debounce(() => {
122122
this.chartLayer.updateChart(this.filterExpressionsMap());
@@ -435,7 +435,7 @@ export abstract class AbstractGanttOutputComponent<
435435
}
436436
}
437437

438-
private updateTotalHeight() {
438+
protected updateTotalHeight() {
439439
const visibleEntries = [...this.state.chartTree].filter(entry => this.isVisible(entry));
440440
this.totalHeight = visibleEntries.length * this.props.style.rowHeight;
441441
this.rowController.totalHeight = this.totalHeight;
@@ -679,15 +679,7 @@ export abstract class AbstractGanttOutputComponent<
679679
renderChart(): React.ReactNode {
680680
return (
681681
<React.Fragment>
682-
<div
683-
id={this.props.chartId}
684-
className="ps__child--consume"
685-
onWheel={ev => {
686-
ev.preventDefault();
687-
ev.stopPropagation();
688-
}}
689-
style={{ height: 'auto' }}
690-
>
682+
<div id={this.props.chartId} className="ps__child--consume" style={{ height: 'auto' }}>
691683
{this.renderAbstractGanttContent(`${this.props.chartId}-content`)}
692684
</div>
693685
{this.state.outputStatus === ResponseStatus.RUNNING && (
@@ -706,7 +698,7 @@ export abstract class AbstractGanttOutputComponent<
706698
return this.state.chartTree.length === 0;
707699
}
708700

709-
private isFilteredIn(row: TimelineChart.TimeGraphRowModel, strategy?: string): boolean {
701+
protected isFilteredIn(row: TimelineChart.TimeGraphRowModel, strategy?: string): boolean {
710702
if (row.states.length === 1 && row.states[0].range.start === row.states[0].range.end) {
711703
// intentionally empty row should be visible
712704
return true;
@@ -1016,13 +1008,13 @@ export abstract class AbstractGanttOutputComponent<
10161008
}
10171009
}
10181010

1019-
private getTimegraphRowIds() {
1011+
protected getTimegraphRowIds() {
10201012
const { chartTree, columns, collapsedNodes } = this.state;
10211013
const rowIds = getAllExpandedNodeIds(listToTree(chartTree, columns), collapsedNodes);
10221014
return { rowIds };
10231015
}
10241016

1025-
private async fetchChartData(
1017+
protected async fetchChartData(
10261018
range: TimelineChart.TimeGraphRange,
10271019
resolution: number,
10281020
fetchArrows: boolean,
@@ -1101,7 +1093,7 @@ export abstract class AbstractGanttOutputComponent<
11011093
};
11021094
}
11031095

1104-
private updateMarkersData(
1096+
protected updateMarkersData(
11051097
rangeEvents: TimelineChart.TimeGraphAnnotation[],
11061098
newRange: TimelineChart.TimeGraphRange,
11071099
newResolution: number
@@ -1589,7 +1581,7 @@ export abstract class AbstractGanttOutputComponent<
15891581
this.setState({ multiSelectedRows: shiftClickedRows });
15901582
};
15911583

1592-
private selectAndReveal(item: TimeGraphEntry) {
1584+
protected selectAndReveal(item: TimeGraphEntry) {
15931585
const rowIndex = getIndexOfNode(
15941586
item.id,
15951587
listToTree(this.state.chartTree, this.state.columns),

0 commit comments

Comments
 (0)