forked from firefox-devtools/profiler
-
Notifications
You must be signed in to change notification settings - Fork 1
/
TreeView.js
762 lines (700 loc) · 22.5 KB
/
TreeView.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// @flow
// This file uses extensive use of Object generic trait bounds, which is a false
// positive for this rule.
/* eslint-disable flowtype/no-weak-types */
import * as React from 'react';
import classNames from 'classnames';
import memoize from 'memoize-immutable';
import { Localized } from '@fluent/react';
import { VirtualList } from './VirtualList';
import { ContextMenuTrigger } from './ContextMenuTrigger';
import type { CssPixels } from 'firefox-profiler/types';
import './TreeView.css';
/**
* This number is used to decide how many lines the selection moves when the
* user presses PageUp or PageDown.
* It's big enough to be useful, but small enough to always be less than one
* window. Of course the correct number should depend on the height of the
* viewport, but this is more complex, and an hardcoded number is good enough in
* this case.
*/
const PAGE_KEYS_DELTA = 15;
/**
* A component that accepts falsy values as the `id` prop for `Localized`.
* `Localized` throws a warning if the `id` field is empty or null. This is made
* to silence those warnings by directy rendering the children for that case instead.
*/
function PermissiveLocalized(props: React.ElementConfig<typeof Localized>) {
const { children, id } = props;
return id ? <Localized {...props}>{children}</Localized> : children;
}
// This is used for the result of RegExp.prototype.exec because Flow doesn't do it.
// See https://github.com/facebook/flow/issues/4099
type RegExpResult = null | ({ index: number, input: string } & string[]);
type NodeIndex = number;
export type Column<DisplayData: Object> = {|
+propName: string,
+titleL10nId: string,
+component?: React.ComponentType<{|
displayData: DisplayData,
|}>,
|};
type TreeViewHeaderProps<DisplayData: Object> = {|
+fixedColumns: Column<DisplayData>[],
+mainColumn: Column<DisplayData>,
|};
const TreeViewHeader = <DisplayData: Object>({
fixedColumns,
mainColumn,
}: TreeViewHeaderProps<DisplayData>) => {
if (fixedColumns.length === 0 && !mainColumn.titleL10nId) {
// If there is nothing to display in the header, do not render it.
return null;
}
return (
<div className="treeViewHeader">
{fixedColumns.map((col) => (
<PermissiveLocalized
id={col.titleL10nId}
attrs={{ title: true }}
key={col.propName}
>
<span
className={`treeViewHeaderColumn treeViewFixedColumn ${col.propName}`}
></span>
</PermissiveLocalized>
))}
<PermissiveLocalized id={mainColumn.titleL10nId} attrs={{ title: true }}>
<span
className={`treeViewHeaderColumn treeViewMainColumn ${mainColumn.propName}`}
></span>
</PermissiveLocalized>
</div>
);
};
function reactStringWithHighlightedSubstrings(
string: string,
regExp: RegExp | null,
className: string
) {
if (!regExp) {
return string;
}
// Since the regexp is reused and likely global, let's make sure we reset it.
regExp.lastIndex = 0;
const highlighted = [];
let lastOccurrence = 0;
let result;
while ((result = regExp.exec(string))) {
const typedResult: RegExpResult = result;
if (typedResult === null) {
break;
}
highlighted.push(string.substring(lastOccurrence, typedResult.index));
lastOccurrence = regExp.lastIndex;
highlighted.push(
<span key={typedResult.index} className={className}>
{typedResult[0]}
</span>
);
}
highlighted.push(string.substring(lastOccurrence));
return highlighted;
}
type TreeViewRowFixedColumnsProps<DisplayData: Object> = {|
+displayData: DisplayData,
+nodeId: NodeIndex,
+columns: Column<DisplayData>[],
+index: number,
+isSelected: boolean,
+isRightClicked: boolean,
+onClick: (NodeIndex, SyntheticMouseEvent<>) => mixed,
+highlightRegExp: RegExp | null,
+rowHeightStyle: { height: CssPixels, lineHeight: string },
|};
class TreeViewRowFixedColumns<DisplayData: Object> extends React.PureComponent<
TreeViewRowFixedColumnsProps<DisplayData>
> {
_onClick = (event: SyntheticMouseEvent<>) => {
const { nodeId, onClick } = this.props;
onClick(nodeId, event);
};
render() {
const {
displayData,
columns,
index,
isSelected,
isRightClicked,
highlightRegExp,
rowHeightStyle,
} = this.props;
return (
<div
className={classNames('treeViewRow', 'treeViewRowFixedColumns', {
even: index % 2 === 0,
odd: index % 2 !== 0,
isSelected,
isRightClicked,
})}
style={rowHeightStyle}
onMouseDown={this._onClick}
>
{columns.map((col) => {
const RenderComponent = col.component;
const text = displayData[col.propName] || '';
return (
<span
className={`treeViewRowColumn treeViewFixedColumn ${col.propName}`}
key={col.propName}
title={text}
>
{RenderComponent ? (
<RenderComponent displayData={displayData} />
) : (
reactStringWithHighlightedSubstrings(
text,
highlightRegExp,
'treeViewHighlighting'
)
)}
</span>
);
})}
</div>
);
}
}
type TreeViewRowScrolledColumnsProps<DisplayData: Object> = {|
+displayData: DisplayData,
+nodeId: NodeIndex,
+depth: number,
+mainColumn: Column<DisplayData>,
+appendageColumn?: Column<DisplayData>,
+index: number,
+canBeExpanded: boolean,
+isExpanded: boolean,
+isSelected: boolean,
+isRightClicked: boolean,
+onToggle: (NodeIndex, boolean, boolean) => mixed,
+onClick: (NodeIndex, SyntheticMouseEvent<>) => mixed,
+highlightRegExp: RegExp | null,
// React converts height into 'px' values, while lineHeight is valid in
// non-'px' units.
+rowHeightStyle: { height: CssPixels, lineHeight: string },
+indentWidth: CssPixels,
|};
// This is a false-positive, as it's used as a generic trait bounds.
class TreeViewRowScrolledColumns<
DisplayData: Object
> extends React.PureComponent<TreeViewRowScrolledColumnsProps<DisplayData>> {
/**
* In this mousedown handler, we use event delegation so we have to use
* `target` instead of `currentTarget`.
*/
_onMouseDown = (
event: { target: Element } & SyntheticMouseEvent<Element>
) => {
const { nodeId, onClick } = this.props;
if (!event.target.classList.contains('treeRowToggleButton')) {
onClick(nodeId, event);
}
};
_onToggleClick = (
event: { target: Element } & SyntheticMouseEvent<Element>
) => {
const { nodeId, isExpanded, onToggle } = this.props;
onToggle(nodeId, !isExpanded, event.altKey === true);
};
render() {
const {
displayData,
depth,
mainColumn,
appendageColumn,
index,
canBeExpanded,
isExpanded,
isSelected,
isRightClicked,
highlightRegExp,
rowHeightStyle,
indentWidth,
nodeId,
} = this.props;
const RenderComponent = mainColumn.component;
// By default there's no 'aria-expanded' attribute.
let ariaExpanded = null;
// if a node can be expanded (has children), and is not expanded yet,
// aria-expanded is false.
if (canBeExpanded) {
ariaExpanded = false;
}
// If a node is expanded, ariaExpanded is true.
if (isExpanded) {
ariaExpanded = true;
}
// Cleaning up self time display so we can use it in aria-label below.
let selfDisplay = displayData.selfTimeUnit;
if (selfDisplay === '—') {
selfDisplay = '0ms';
}
return (
<div
className={classNames('treeViewRow', 'treeViewRowScrolledColumns', {
even: index % 2 === 0,
odd: index % 2 !== 0,
isSelected,
isRightClicked,
})}
style={rowHeightStyle}
onMouseDown={this._onMouseDown}
// The following attributes are important for accessibility.
aria-expanded={ariaExpanded}
aria-level={depth + 1}
aria-selected={isSelected}
aria-label={displayData.ariaLabel}
// The role and id attributes are used along with aria-activedescendant
// (set on the parent), to manage the virtual focus of the tree items.
// The "virtual" focus changes with the arrow keys.
role="treeitem"
id={`treeViewRow-${nodeId}`}
>
<span
className="treeRowIndentSpacer"
style={{ width: `${depth * indentWidth}px` }}
/>
<span
className={`treeRowToggleButton ${
isExpanded ? 'expanded' : 'collapsed'
} ${canBeExpanded ? 'canBeExpanded' : 'leaf'}`}
onClick={this._onToggleClick}
/>
{
/* The category square is out of the treeview column element because we
reduce the opacity for that element in some cases (with the "dim"
class).
*/
displayData.categoryColor && displayData.categoryName ? (
<span
className={`colored-square category-color-${displayData.categoryColor}`}
title={displayData.categoryName}
/>
) : null
}
<span
className={classNames(
'treeViewRowColumn',
'treeViewMainColumn',
mainColumn.propName,
{
dim: displayData.isFrameLabel,
}
)}
>
{RenderComponent ? (
<RenderComponent displayData={displayData} />
) : (
reactStringWithHighlightedSubstrings(
displayData[mainColumn.propName],
highlightRegExp,
'treeViewHighlighting'
)
)}
</span>
{appendageColumn ? (
<span
className={`treeViewRowColumn treeViewAppendageColumn ${appendageColumn.propName}`}
>
{reactStringWithHighlightedSubstrings(
displayData[appendageColumn.propName],
highlightRegExp,
'treeViewHighlighting'
)}
</span>
) : null}
</div>
);
}
}
interface Tree<DisplayData: Object> {
getDepth(NodeIndex): number;
getRoots(): NodeIndex[];
getDisplayData(NodeIndex): DisplayData;
getParent(NodeIndex): NodeIndex;
getChildren(NodeIndex): NodeIndex[];
hasChildren(NodeIndex): boolean;
getAllDescendants(NodeIndex): Set<NodeIndex>;
}
type TreeViewProps<DisplayData> = {|
+fixedColumns: Column<DisplayData>[],
+mainColumn: Column<DisplayData>,
+tree: Tree<DisplayData>,
+expandedNodeIds: Array<NodeIndex | null>,
+selectedNodeId: NodeIndex | null,
+rightClickedNodeId?: NodeIndex | null,
+onExpandedNodesChange: (Array<NodeIndex | null>) => mixed,
+highlightRegExp?: RegExp | null,
+appendageColumn?: Column<DisplayData>,
+disableOverscan?: boolean,
+contextMenu?: React.Element<any>,
+contextMenuId?: string,
+maxNodeDepth: number,
+onSelectionChange: (NodeIndex) => mixed,
+onRightClickSelection?: (NodeIndex) => mixed,
+onEnterKey?: (NodeIndex) => mixed,
+rowHeight: CssPixels,
+indentWidth: CssPixels,
+onKeyDown?: (SyntheticKeyboardEvent<>) => void,
|};
export class TreeView<DisplayData: Object> extends React.PureComponent<
TreeViewProps<DisplayData>
> {
_list: VirtualList<NodeIndex> | null = null;
_takeListRef = (list: VirtualList<NodeIndex> | null) => (this._list = list);
// The tuple `specialItems` always contains 2 elements: the first element is
// the selected node id (if any), and the second element is the right clicked
// id (if any).
_computeSpecialItemsMemoized = memoize(
(
selectedNodeId: NodeIndex | null,
rightClickedNodeId: ?NodeIndex
): [NodeIndex | void, NodeIndex | void] => [
selectedNodeId ?? undefined,
rightClickedNodeId ?? undefined,
],
{ limit: 1 }
);
_computeExpandedNodesMemoized = memoize(
(expandedNodeIds: Array<NodeIndex | null>) =>
new Set<NodeIndex | null>(expandedNodeIds),
{ limit: 1 }
);
_computeAllVisibleRowsMemoized = memoize(
(tree: Tree<DisplayData>, expandedNodes: Set<NodeIndex | null>) => {
function _addVisibleRowsFromNode(tree, expandedNodes, arr, nodeId) {
arr.push(nodeId);
if (!expandedNodes.has(nodeId)) {
return;
}
const children = tree.getChildren(nodeId);
for (let i = 0; i < children.length; i++) {
_addVisibleRowsFromNode(tree, expandedNodes, arr, children[i]);
}
}
const roots = tree.getRoots();
const allRows = [];
for (let i = 0; i < roots.length; i++) {
_addVisibleRowsFromNode(tree, expandedNodes, allRows, roots[i]);
}
return allRows;
},
{ limit: 1 }
);
/* This method is used by users of this component. */
/* eslint-disable-next-line react/no-unused-class-component-methods */
scrollSelectionIntoView() {
const { selectedNodeId, tree } = this.props;
if (this._list && selectedNodeId !== null) {
const list = this._list; // this temp variable so that flow knows that it's non-null
const rowIndex = this._getAllVisibleRows().indexOf(selectedNodeId);
const depth = tree.getDepth(selectedNodeId);
list.scrollItemIntoView(rowIndex, depth * 10);
}
}
_renderRow = (nodeId: NodeIndex, index: number, columnIndex: number) => {
const {
tree,
fixedColumns,
mainColumn,
appendageColumn,
selectedNodeId,
rightClickedNodeId,
highlightRegExp,
rowHeight,
indentWidth,
} = this.props;
const displayData = tree.getDisplayData(nodeId);
// React converts height into 'px' values, while lineHeight is valid in
// non-'px' units.
const rowHeightStyle = { height: rowHeight, lineHeight: `${rowHeight}px` };
if (columnIndex === 0) {
return (
<TreeViewRowFixedColumns
displayData={displayData}
columns={fixedColumns}
nodeId={nodeId}
index={index}
isSelected={nodeId === selectedNodeId}
isRightClicked={nodeId === rightClickedNodeId}
onClick={this._onRowClicked}
highlightRegExp={highlightRegExp || null}
rowHeightStyle={rowHeightStyle}
/>
);
}
const canBeExpanded = tree.hasChildren(nodeId);
const isExpanded = canBeExpanded && !this._isCollapsed(nodeId);
return (
<TreeViewRowScrolledColumns
rowHeightStyle={rowHeightStyle}
displayData={displayData}
mainColumn={mainColumn}
appendageColumn={appendageColumn}
depth={tree.getDepth(nodeId)}
nodeId={nodeId}
index={index}
canBeExpanded={canBeExpanded}
isExpanded={isExpanded}
isSelected={nodeId === selectedNodeId}
isRightClicked={nodeId === rightClickedNodeId}
onToggle={this._toggle}
onClick={this._onRowClicked}
highlightRegExp={highlightRegExp || null}
indentWidth={indentWidth}
/>
);
};
_getExpandedNodes(): Set<NodeIndex | null> {
return this._computeExpandedNodesMemoized(this.props.expandedNodeIds);
}
_getAllVisibleRows(): NodeIndex[] {
const { tree } = this.props;
return this._computeAllVisibleRowsMemoized(tree, this._getExpandedNodes());
}
_getSpecialItems(): [NodeIndex | void, NodeIndex | void] {
const { selectedNodeId, rightClickedNodeId } = this.props;
return this._computeSpecialItemsMemoized(
selectedNodeId,
rightClickedNodeId
);
}
_isCollapsed(nodeId: NodeIndex): boolean {
return !this._getExpandedNodes().has(nodeId);
}
_toggle = (
nodeId: NodeIndex,
newExpanded: boolean = this._isCollapsed(nodeId),
toggleAll: boolean = false
) => {
const newSet = new Set(this._getExpandedNodes());
if (newExpanded) {
newSet.add(nodeId);
if (toggleAll) {
for (const descendant of this.props.tree.getAllDescendants(nodeId)) {
newSet.add(descendant);
}
}
} else {
newSet.delete(nodeId);
}
this.props.onExpandedNodesChange(Array.from(newSet.values()));
};
_toggleAll(
nodeId: NodeIndex,
newExpanded: boolean = this._isCollapsed(nodeId)
) {
this._toggle(nodeId, newExpanded, true);
}
_select(nodeId: NodeIndex) {
this.props.onSelectionChange(nodeId);
}
_rightClickSelect(nodeId: NodeIndex) {
if (this.props.onRightClickSelection) {
this.props.onRightClickSelection(nodeId);
} else {
this._select(nodeId);
}
}
_onRowClicked = (nodeId: NodeIndex, event: SyntheticMouseEvent<>) => {
if (event.button === 0) {
this._select(nodeId);
} else if (event.button === 2) {
this._rightClickSelect(nodeId);
}
if (event.detail === 2 && event.button === 0) {
// double click
this._toggle(nodeId);
}
};
_onCopy = (event: ClipboardEvent) => {
event.preventDefault();
const { tree, selectedNodeId, mainColumn } = this.props;
if (selectedNodeId) {
const displayData = tree.getDisplayData(selectedNodeId);
const clipboardData: DataTransfer = (event: any).clipboardData;
clipboardData.setData('text/plain', displayData[mainColumn.propName]);
}
};
_onKeyDown = (event: SyntheticKeyboardEvent<>) => {
if (this.props.onKeyDown) {
this.props.onKeyDown(event);
}
const hasModifier = event.ctrlKey || event.altKey;
const isNavigationKey =
event.key.startsWith('Arrow') ||
event.key.startsWith('Page') ||
event.key === 'Home' ||
event.key === 'End';
const isAsteriskKey = event.key === '*';
const isEnterKey = event.key === 'Enter';
if (hasModifier || (!isNavigationKey && !isAsteriskKey && !isEnterKey)) {
// No key events that we care about were found, so don't try and handle them.
return;
}
event.stopPropagation();
event.preventDefault();
const selected = this.props.selectedNodeId;
const visibleRows = this._getAllVisibleRows();
const selectedRowIndex = visibleRows.findIndex(
(nodeId) => nodeId === selected
);
if (selected === null || selectedRowIndex === -1) {
// the first condition is redundant, but it makes flow happy
this._select(visibleRows[0]);
return;
}
if (isNavigationKey) {
switch (event.key) {
case 'ArrowUp': {
if (event.metaKey) {
// On MacOS this is a common shortcut for the Home gesture
this._select(visibleRows[0]);
break;
}
if (selectedRowIndex > 0) {
this._select(visibleRows[selectedRowIndex - 1]);
}
break;
}
case 'ArrowDown': {
if (event.metaKey) {
// On MacOS this is a common shortcut for the End gesture
this._select(visibleRows[visibleRows.length - 1]);
break;
}
if (selectedRowIndex < visibleRows.length - 1) {
this._select(visibleRows[selectedRowIndex + 1]);
}
break;
}
case 'PageUp': {
if (selectedRowIndex > 0) {
const nextRow = Math.max(0, selectedRowIndex - PAGE_KEYS_DELTA);
this._select(visibleRows[nextRow]);
}
break;
}
case 'PageDown': {
if (selectedRowIndex < visibleRows.length - 1) {
const nextRow = Math.min(
visibleRows.length - 1,
selectedRowIndex + PAGE_KEYS_DELTA
);
this._select(visibleRows[nextRow]);
}
break;
}
case 'Home': {
this._select(visibleRows[0]);
break;
}
case 'End': {
this._select(visibleRows[visibleRows.length - 1]);
break;
}
case 'ArrowLeft': {
const isCollapsed = this._isCollapsed(selected);
if (!isCollapsed) {
this._toggle(selected);
} else {
const parent = this.props.tree.getParent(selected);
if (parent !== -1) {
this._select(parent);
}
}
break;
}
case 'ArrowRight': {
const isCollapsed = this._isCollapsed(selected);
if (isCollapsed) {
this._toggle(selected);
} else {
// Do KEY_DOWN only if the next element is a child
if (this.props.tree.hasChildren(selected)) {
this._select(this.props.tree.getChildren(selected)[0]);
}
}
break;
}
default:
throw new Error('Unhandled navigation key.');
}
}
if (isAsteriskKey) {
this._toggleAll(selected);
}
if (isEnterKey) {
const { onEnterKey, selectedNodeId } = this.props;
if (onEnterKey && selectedNodeId !== null) {
onEnterKey(selectedNodeId);
}
}
};
/* This method is used by users of this component. */
/* eslint-disable-next-line react/no-unused-class-component-methods */
focus() {
if (this._list) {
this._list.focus();
}
}
render() {
const {
fixedColumns,
mainColumn,
disableOverscan,
contextMenu,
contextMenuId,
maxNodeDepth,
rowHeight,
selectedNodeId,
} = this.props;
return (
<div className="treeView">
<TreeViewHeader fixedColumns={fixedColumns} mainColumn={mainColumn} />
<ContextMenuTrigger
id={contextMenuId}
attributes={{ className: 'treeViewContextMenu' }}
>
<VirtualList
className="treeViewBody"
ariaRole="tree"
ariaLabel="Call tree"
// This attribute exposes the current active child element,
// while keeping focus on the parent (call tree).
ariaActiveDescendant={
selectedNodeId !== null ? `treeViewRow-${selectedNodeId}` : null
}
items={this._getAllVisibleRows()}
renderItem={this._renderRow}
itemHeight={rowHeight}
columnCount={2}
focusable={true}
onKeyDown={this._onKeyDown}
specialItems={this._getSpecialItems()}
disableOverscan={!!disableOverscan}
onCopy={this._onCopy}
// If there is a deep call node depth, expand the width, or else keep it
// at 3000 wide.
containerWidth={Math.max(3000, maxNodeDepth * 10 + 2000)}
ref={this._takeListRef}
/>
</ContextMenuTrigger>
{contextMenu}
</div>
);
}
}