@sis-cc/dotstatsuite-visions 7.20.4 → 7.20.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
2
2
 
3
3
  function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
4
4
 
5
- import React, { useState, Fragment } from 'react';
5
+ import React, { useEffect, useState, Fragment } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import * as R from 'ramda';
8
8
  import cx from 'classnames';
@@ -22,6 +22,7 @@ import CloseIcon from '@material-ui/icons/Close';
22
22
  import HintIcon from '@material-ui/icons/EmojiObjects';
23
23
  import Draggable from 'react-draggable';
24
24
  import { Button, Spotlight, VirtualizedTree } from '..';
25
+ import { withExpansionTree } from '../VirtualizedTree/withExpansionTree';
25
26
  import { makeStyles } from '@material-ui/core/styles';
26
27
  import singleImg from './images/single-selection.png';
27
28
  import childrenImg from './images/children-selection.png';
@@ -39,7 +40,7 @@ var PaperComponent = function PaperComponent(props) {
39
40
  return React.createElement(
40
41
  Draggable,
41
42
  { handle: '#draggable-dialog-title', cancel: '[class*="MuiDialogContent-root"]' },
42
- React.createElement(Paper, _extends({ style: { minWidth: '75%', height: 700 } }, props))
43
+ React.createElement(Paper, _extends({ style: { minWidth: '75%', height: '75%' } }, props))
43
44
  );
44
45
  };
45
46
 
@@ -83,16 +84,19 @@ var useStyles = makeStyles(function (theme) {
83
84
  narrowSpotlight: { width: '100%' },
84
85
  selectionButton: {
85
86
  marginLeft: 24,
87
+ marginRight: 15,
86
88
  height: 32
87
89
  },
88
90
  narrowSelectionButton: {
89
91
  height: 32,
90
- marginTop: 5
92
+ marginTop: 5,
93
+ marginRight: 15
91
94
  },
92
95
  selectionMenu: {
93
96
  width: '50%',
97
+ maxHeight: '100%',
94
98
  position: 'absolute',
95
- top: 105,
99
+ top: 110,
96
100
  right: 48,
97
101
  zIndex: 1
98
102
  },
@@ -111,12 +115,6 @@ var useStyles = makeStyles(function (theme) {
111
115
  backgroundColor: theme.palette.action.hover
112
116
  }
113
117
  },
114
- selectedButton: {
115
- backgroundColor: theme.palette.secondary.main,
116
- '&:hover': {
117
- backgroundColor: theme.palette.action.selected
118
- }
119
- },
120
118
  selectModeItem: {
121
119
  boxShadow: 'none',
122
120
  display: 'flex',
@@ -136,6 +134,9 @@ var useStyles = makeStyles(function (theme) {
136
134
  marginRight: 10,
137
135
  display: 'flex',
138
136
  flexDirection: 'row'
137
+ },
138
+ actions: {
139
+ justifyContent: 'space-between'
139
140
  }
140
141
  };
141
142
  });
@@ -178,7 +179,8 @@ var SelectionModeMenu = function SelectionModeMenu(_ref) {
178
179
  selected = _ref.selected,
179
180
  classes = _ref.classes,
180
181
  isNarrow = _ref.isNarrow,
181
- hint = _ref.hint;
182
+ hint = _ref.hint,
183
+ maxHeight = _ref.maxHeight;
182
184
 
183
185
  if (!isOpen) {
184
186
  return null;
@@ -188,26 +190,24 @@ var SelectionModeMenu = function SelectionModeMenu(_ref) {
188
190
  { className: isNarrow ? classes.narrowSelectionMenu : classes.selectionMenu },
189
191
  React.createElement(
190
192
  Card,
191
- null,
193
+ { style: { maxHeight: maxHeight - 5, overflow: 'auto' } },
192
194
  React.createElement(
193
195
  CardContent,
194
196
  { className: classes.selectModeContainer },
195
197
  R.map(function (_ref2) {
196
- var _cx;
197
-
198
198
  var value = _ref2.value,
199
199
  label = _ref2.label,
200
200
  img = _ref2.img;
201
201
  return React.createElement(
202
202
  Button,
203
- _extends({
204
- className: cx(classes.selectButton, (_cx = {}, _cx[classes.selectedButton] = value === selected, _cx))
205
- }, value === selected ? { variant: 'contained', color: 'secondary' } : {}, {
203
+ {
204
+ className: classes.selectButton,
205
+ selected: value === selected,
206
206
  key: value,
207
207
  onClick: function onClick() {
208
208
  return onSelect(value);
209
209
  }
210
- }),
210
+ },
211
211
  React.createElement(
212
212
  Paper,
213
213
  { className: classes.selectModeItem, key: value },
@@ -241,7 +241,8 @@ SelectionModeMenu.propTypes = process.env.NODE_ENV !== "production" ? {
241
241
  isOpen: PropTypes.bool,
242
242
  onSelect: PropTypes.func,
243
243
  options: PropTypes.array,
244
- selected: PropTypes.string
244
+ selected: PropTypes.string,
245
+ maxHeight: PropTypes.number
245
246
  } : {};
246
247
 
247
248
  var icons = {
@@ -253,7 +254,7 @@ var icons = {
253
254
  };
254
255
 
255
256
  var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
256
- var _cx2;
257
+ var _cx;
257
258
 
258
259
  var id = props.id,
259
260
  title = props.title,
@@ -265,9 +266,13 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
265
266
  isNarrow = props.isNarrow,
266
267
  labels = props.labels,
267
268
  disableAccessor = props.disableAccessor,
268
- rest = _objectWithoutProperties(props, ['id', 'title', 'items', 'labelRenderer', 'onClose', 'changeSelection', 'isOpen', 'isNarrow', 'labels', 'disableAccessor']);
269
+ expandAll = props.expandAll,
270
+ collapseAll = props.collapseAll,
271
+ defaultSpotlight = props.defaultSpotlight,
272
+ expandedIds = props.expandedIds,
273
+ rest = _objectWithoutProperties(props, ['id', 'title', 'items', 'labelRenderer', 'onClose', 'changeSelection', 'isOpen', 'isNarrow', 'labels', 'disableAccessor', 'expandAll', 'collapseAll', 'defaultSpotlight', 'expandedIds']);
269
274
 
270
- var _useState = useState(''),
275
+ var _useState = useState({ term: '' }),
271
276
  term = _useState[0].term,
272
277
  setSpotlight = _useState[1];
273
278
 
@@ -285,6 +290,23 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
285
290
 
286
291
  var classes = useStyles();
287
292
 
293
+ var _useState5 = useState(0),
294
+ height = _useState5[0],
295
+ setHeight = _useState5[1];
296
+
297
+ var measureRef = React.useCallback(function (node) {
298
+ if (node !== null) {
299
+ setHeight(node.getBoundingClientRect().height * 75 / 100);
300
+ }
301
+ });
302
+ useEffect(function () {
303
+ if (!R.isNil(defaultSpotlight) && !R.isEmpty(defaultSpotlight)) {
304
+ setSpotlight(defaultSpotlight);
305
+ }
306
+ }, [defaultSpotlight]);
307
+
308
+ var listHeight = height - 170;
309
+
288
310
  var groupedItemsByParentId = R.groupBy(R.propOr('#ROOT', 'parentId'), items);
289
311
 
290
312
  var recurse = R.filter(function (item) {
@@ -344,8 +366,9 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
344
366
  };
345
367
 
346
368
  var handleSubmit = function handleSubmit() {
347
- changeSelection(id, R.values(selection));
369
+ changeSelection(id, R.values(selection), { expandedIds: expandedIds, spotlight: { term: term } });
348
370
  setSelection({});
371
+ setSpotlight({ term: '' });
349
372
  };
350
373
 
351
374
  return React.createElement(
@@ -354,7 +377,8 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
354
377
  open: isOpen,
355
378
  PaperComponent: PaperComponent,
356
379
  'aria-labelledby': 'draggable-dialog-title',
357
- onClose: onClose
380
+ onClose: onClose,
381
+ ref: measureRef
358
382
  },
359
383
  React.createElement(
360
384
  DialogTitle,
@@ -384,11 +408,12 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
384
408
  { container: true },
385
409
  React.createElement(
386
410
  Grid,
387
- { item: true, xs: 12, className: cx(classes.topElements, (_cx2 = {}, _cx2[classes.narrowTop] = isNarrow, _cx2)) },
411
+ { item: true, xs: 12, className: cx(classes.topElements, (_cx = {}, _cx[classes.narrowTop] = isNarrow, _cx)) },
388
412
  React.createElement(
389
413
  'div',
390
414
  { className: isNarrow ? classes.narrowSpotlight : classes.spotlight },
391
415
  React.createElement(Spotlight, {
416
+ hasClearAll: true,
392
417
  placeholder: R.prop('placeholder', labels),
393
418
  term: term,
394
419
  hasCommit: false,
@@ -419,7 +444,11 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
419
444
  Fragment,
420
445
  null,
421
446
  '\xA0',
422
- React.createElement('img', { src: R.prop(selectionMode, icons), alt: selectionMode })
447
+ React.createElement('img', {
448
+ style: { marginLeft: 15 },
449
+ src: R.prop(selectionMode, icons),
450
+ alt: selectionMode
451
+ })
423
452
  )
424
453
  )
425
454
  ),
@@ -436,7 +465,8 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
436
465
  setIsOpenSelectionMenu(false);
437
466
  },
438
467
  selected: selectionMode,
439
- hint: R.prop('hint', labels)
468
+ hint: R.prop('hint', labels),
469
+ maxHeight: listHeight
440
470
  }),
441
471
  React.createElement(VirtualizedTree, _extends({}, rest, {
442
472
  disableAccessor: disableAccessor,
@@ -445,36 +475,57 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
445
475
  items: selectionItems,
446
476
  changeSelection: onChangeSelection,
447
477
  withExpandControl: true,
448
- maxTreeHeight: 490,
449
- getItemScope: R.prop(selectionMode, scopeGetters)
478
+ maxTreeHeight: listHeight,
479
+ getItemScope: R.prop(selectionMode, scopeGetters),
480
+ expandedIds: expandedIds
450
481
  }))
451
482
  )
452
483
  )
453
484
  ),
454
485
  React.createElement(
455
486
  DialogActions,
456
- null,
457
- R.is(Function, onClose) && React.createElement(
458
- Button,
459
- {
460
- onClick: function onClick() {
461
- onClose();
462
- setSelection({});
463
- },
464
- color: 'primary'
465
- },
466
- R.prop('cancel', labels)
487
+ { className: classes.actions },
488
+ React.createElement(
489
+ 'div',
490
+ null,
491
+ React.createElement(
492
+ Button,
493
+ { onClick: collapseAll, color: 'primary' },
494
+ R.prop('colapseAll', labels)
495
+ ),
496
+ React.createElement(
497
+ Button,
498
+ { style: { marginLeft: 10 }, onClick: expandAll, color: 'primary' },
499
+ R.prop('expandAll', labels)
500
+ )
467
501
  ),
468
- R.is(Function, changeSelection) && React.createElement(
469
- Button,
470
- {
471
- disabled: R.isEmpty(selection),
472
- onClick: handleSubmit,
473
- color: 'primary',
474
- variant: 'contained',
475
- alternative: 'siscc'
476
- },
477
- R.prop('apply', labels)
502
+ React.createElement(
503
+ 'div',
504
+ null,
505
+ R.is(Function, onClose) && React.createElement(
506
+ Button,
507
+ {
508
+ onClick: function onClick() {
509
+ onClose();
510
+ setSelection({});
511
+ setSpotlight({ term: '' });
512
+ },
513
+ color: 'primary'
514
+ },
515
+ R.prop('cancel', labels)
516
+ ),
517
+ R.is(Function, changeSelection) && React.createElement(
518
+ Button,
519
+ {
520
+ disabled: R.isEmpty(selection),
521
+ onClick: handleSubmit,
522
+ color: 'primary',
523
+ variant: 'contained',
524
+ alternative: 'siscc',
525
+ style: { marginLeft: 10 }
526
+ },
527
+ R.prop('apply', labels)
528
+ )
478
529
  )
479
530
  )
480
531
  );
@@ -503,7 +554,11 @@ AdvancedFilterDialog.propTypes = process.env.NODE_ENV !== "production" ? {
503
554
  }),
504
555
  onClose: PropTypes.func,
505
556
  labelRenderer: PropTypes.func,
506
- title: PropTypes.string
557
+ title: PropTypes.string,
558
+ expandAll: PropTypes.func,
559
+ collapseAll: PropTypes.func,
560
+ defaultSpotlight: PropTypes.object,
561
+ expandedIds: PropTypes.object
507
562
  } : {};
508
563
 
509
- export default AdvancedFilterDialog;
564
+ export default withExpansionTree(AdvancedFilterDialog);
@@ -6,9 +6,11 @@ import * as R from 'ramda';
6
6
  import Container from '@material-ui/core/Container';
7
7
  import PlaylistAddCheckIcon from '@material-ui/icons/PlaylistAddCheck';
8
8
  import { ExpansionPanel, Tag as InternalTag, VerticalButton, Spotlight, VirtualizedTree } from '../';
9
+ import { withExpansionTree } from '../VirtualizedTree/withExpansionTree';
9
10
  import { useStyles } from '../ScopeList/styles';
10
11
  import { useTheme } from '@material-ui/core';
11
12
  import { getIsRtl } from '../utils';
13
+ import { useEffect } from 'react';
12
14
 
13
15
  var getCounter = function getCounter(items, displayAccessor, tagAccessor) {
14
16
  var count = R.pipe(R.filter(R.prop('isSelected')), R.length)(items);
@@ -36,12 +38,19 @@ var HierarchicalFilter = function HierarchicalFilter(props) {
36
38
  label = props.label,
37
39
  labels = props.labels,
38
40
  tagAccessor = props.tagAccessor,
39
- displayAccessor = props.displayAccessor;
41
+ displayAccessor = props.displayAccessor,
42
+ expandedIds = props.expandedIds,
43
+ defaultSpotlight = props.defaultSpotlight;
40
44
 
41
45
  var _useState = useState({ term: '' }),
42
46
  term = _useState[0].term,
43
47
  setSpotlight = _useState[1];
44
48
 
49
+ useEffect(function () {
50
+ if (!R.isNil(defaultSpotlight) && !R.isEmpty(defaultSpotlight)) {
51
+ setSpotlight(defaultSpotlight);
52
+ }
53
+ }, [defaultSpotlight]);
45
54
  var classes = useStyles({ accessibility: accessibility });
46
55
  var theme = useTheme();
47
56
  var isRtl = getIsRtl(theme);
@@ -68,6 +77,11 @@ var HierarchicalFilter = function HierarchicalFilter(props) {
68
77
  var onSelect = function onSelect(values) {
69
78
  changeSelection(id, values);
70
79
  };
80
+
81
+ var onAdvancedToggle = function onAdvancedToggle() {
82
+ toggleBulk({ expandedIds: expandedIds, spotlight: { term: term } });
83
+ };
84
+
71
85
  return React.createElement(
72
86
  ExpansionPanel,
73
87
  _extends({
@@ -98,7 +112,7 @@ var HierarchicalFilter = function HierarchicalFilter(props) {
98
112
  {
99
113
  'aria-label': R.prop('advancedSelection')(labels),
100
114
  classes: { root: classes.bulkSelectionIcon },
101
- onClick: toggleBulk
115
+ onClick: onAdvancedToggle
102
116
  },
103
117
  React.createElement(PlaylistAddCheckIcon, { color: 'primary' })
104
118
  )
@@ -136,7 +150,9 @@ HierarchicalFilter.propTypes = process.env.NODE_ENV !== "production" ? {
136
150
  testId: PropTypes.string,
137
151
  expansionPanelProps: PropTypes.object,
138
152
  toggleBulk: PropTypes.func,
139
- tagAccessor: PropTypes.func
153
+ tagAccessor: PropTypes.func,
154
+ expandedIds: PropTypes.object,
155
+ defaultSpotlight: PropTypes.object
140
156
  } : {};
141
157
 
142
- export default HierarchicalFilter;
158
+ export default withExpansionTree(HierarchicalFilter);
@@ -85,6 +85,7 @@ var Item = function Item(_ref) {
85
85
  secondaryTypographyProps: { color: 'inherit' },
86
86
  classes: { root: classes.listItem },
87
87
  className: cx((_cx = {}, _cx[classes.accessibilityItemHover] = accessibility, _cx[classes.listItemSelected] = R.and(isSelected, R.not(isDisabled)), _cx[classes.listItemHover] = R.not(isDisabled), _cx[classes.disabledLabel] = isDisabled, _cx)),
88
+ onClick: isDisabled ? null : callbacks.onClick,
88
89
  onMouseDown: isDisabled || isTooltipShown ? null : callbacks.onMouseDown,
89
90
  onMouseUp: isDisabled || isTooltipShown ? null : callbacks.onMouseUp,
90
91
  onMouseEnter: isDisabled || isTooltipShown ? null : callbacks.onMouseEnter
@@ -119,6 +120,7 @@ var Item = function Item(_ref) {
119
120
  return e.stopPropagation();
120
121
  } }),
121
122
  enterDelay: 400,
123
+ enterNextDelay: 400,
122
124
  tabIndex: 0,
123
125
  'aria-label': description,
124
126
  'aria-hidden': false,
@@ -1,11 +1,10 @@
1
1
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
2
 
3
- import React, { Fragment, useRef, useEffect, useState, useMemo } from 'react';
3
+ import React, { useRef, useEffect, useState, useMemo } from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import * as R from 'ramda';
6
6
  import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';
7
7
  import VirtualizedList from 'react-virtualized/dist/commonjs/List';
8
- import Button from '@material-ui/core/Button';
9
8
  import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
10
9
  import ExpandLessIcon from '@material-ui/icons/ExpandLess';
11
10
  import List from '@material-ui/core/List';
@@ -62,7 +61,9 @@ var VirtualizedTree = function VirtualizedTree(props) {
62
61
  items = props.items,
63
62
  labelRenderer = props.labelRenderer,
64
63
  labels = props.labels,
65
- withExpandControl = props.withExpandControl,
64
+ expandedIds = props.expandedIds,
65
+ expand = props.expand,
66
+ collapse = props.collapse,
66
67
  _props$maxTreeHeight = props.maxTreeHeight,
67
68
  maxTreeHeight = _props$maxTreeHeight === undefined ? 250 : _props$maxTreeHeight,
68
69
  _props$getItemScope = props.getItemScope,
@@ -70,25 +71,21 @@ var VirtualizedTree = function VirtualizedTree(props) {
70
71
 
71
72
  var theme = useTheme();
72
73
 
73
- var _useState = useState({}),
74
- expandedIds = _useState[0],
75
- setExpandedIds = _useState[1];
74
+ var _useState = useState(undefined),
75
+ scrollTop = _useState[0],
76
+ setScrollTop = _useState[1];
76
77
 
77
- var _useState2 = useState(undefined),
78
- scrollTop = _useState2[0],
79
- setScrollTop = _useState2[1];
78
+ var _useState2 = useState([]),
79
+ shiftIndexes = _useState2[0],
80
+ setShiftIndexes = _useState2[1];
80
81
 
81
- var _useState3 = useState([]),
82
- shiftIndexes = _useState3[0],
83
- setShiftIndexes = _useState3[1];
82
+ var _useState3 = useState({}),
83
+ selectIds = _useState3[0],
84
+ setSelectIds = _useState3[1];
84
85
 
85
- var _useState4 = useState({}),
86
- selectIds = _useState4[0],
87
- setSelectIds = _useState4[1];
88
-
89
- var _useState5 = useState(false),
90
- isMouseDown = _useState5[0],
91
- setIsMouseDown = _useState5[1];
86
+ var _useState4 = useState(false),
87
+ isMouseDown = _useState4[0],
88
+ setIsMouseDown = _useState4[1];
92
89
 
93
90
  var _useMemo = useMemo(function () {
94
91
  var indexedItemsById = R.indexBy(getHierarchicalId, items);
@@ -156,21 +153,26 @@ var VirtualizedTree = function VirtualizedTree(props) {
156
153
  apply();
157
154
  } : null,
158
155
  onMouseDown: function onMouseDown(e) {
159
- if (e.ctrlKey) {
160
- multiSelect(id);
161
- } else if (e.shiftKey) {
162
- shiftSelect(index);
163
- } else {
164
- multiSelect(id);
165
- setIsMouseDown(true);
156
+ if (e.ctrlKey || e.shiftKey) {
157
+ return;
166
158
  }
159
+ multiSelect(id);
160
+ setIsMouseDown(true);
167
161
  },
168
162
  onMouseEnter: isMouseDown ? function (e) {
169
163
  if (e.ctrlKey || e.shiftKey) {
170
164
  return;
171
165
  }
172
166
  multiSelect(id);
173
- } : null
167
+ } : null,
168
+ onClick: function onClick(e) {
169
+ e.preventDefault();
170
+ if (e.ctrlKey) {
171
+ multiSelect(id);
172
+ } else if (e.shiftKey) {
173
+ shiftSelect(index);
174
+ }
175
+ }
174
176
  };
175
177
  };
176
178
  var onKeyUp = function onKeyUp(e) {
@@ -222,99 +224,68 @@ var VirtualizedTree = function VirtualizedTree(props) {
222
224
  }, [scrollTop]);
223
225
  var maxHeight = R.pipe(R.length, R.multiply(rowHeight), R.ifElse(R.gt(maxTreeHeight), R.add(10), R.always(maxTreeHeight)))(list);
224
226
 
225
- var expand = function expand(index) {
226
- var parentId = R.nth(index, list);
227
- setExpandedIds(R.assoc(parentId, parentId, expandedIds));
228
- };
229
-
230
- var collapse = function collapse(index) {
231
- var parentId = R.nth(index, list);
232
- setExpandedIds(R.dissoc(parentId, expandedIds));
233
- };
234
-
235
- var expandAll = function expandAll() {
236
- setExpandedIds(indexedItemsById);
237
- };
238
-
239
- var collapseAll = function collapseAll() {
240
- setExpandedIds({});
241
- };
242
-
243
227
  if (R.isEmpty(list)) {
244
228
  return null;
245
229
  }
246
230
  var isRtl = getIsRtl(theme);
247
-
248
231
  return React.createElement(
249
- Fragment,
250
- null,
232
+ List,
233
+ {
234
+ disablePadding: true,
235
+ style: { height: maxHeight + 2 },
236
+ onKeyUp: onKeyUp,
237
+ onMouseLeave: isMouseDown ? apply : null,
238
+ ref: ref
239
+ },
251
240
  React.createElement(
252
- List,
253
- { disablePadding: true, style: { height: maxHeight + 2 }, onKeyUp: onKeyUp, ref: ref },
254
- React.createElement(
255
- AutoSizer,
256
- null,
257
- function (_ref) {
258
- var height = _ref.height,
259
- width = _ref.width;
260
- return React.createElement(VirtualizedList, {
261
- overscan: 10,
262
- tabIndex: -1,
263
- height: height + 2,
264
- width: width,
265
- scrollTop: scrollTop // control scroll position with ctrl or shift key
266
- , rowCount: R.length(list),
267
- rowHeight: R.add(1)(rowHeight) // 1 is space between elements
268
- , rowRenderer: function rowRenderer(_ref2) {
269
- var index = _ref2.index,
270
- style = _ref2.style;
271
-
272
- var itemId = R.nth(index, list);
273
- var item = R.prop(itemId, indexedItemsById);
274
- return React.createElement(Item, _extends({}, item, {
275
- id: getHierarchicalId(item),
276
- label: labelRenderer(item),
277
- key: getHierarchicalId(item),
278
- depth: getDepth(indexedItemsById)(item),
279
- hasChild: R.has(itemId, groupedItemsByParentId),
280
- hasChildrenOnLevel: getHasChildrenOnLevel(groupedItemsByParentId)(item),
281
- changeList: R.has(itemId, expandedIds) ? function () {
282
- return collapse(index);
283
- } : function () {
284
- return expand(index);
285
- },
286
- NavigateIcon: R.has(itemId, expandedIds) ? ExpandLessIcon : ExpandMoreIcon,
287
- isRtl: isRtl,
288
- isDisabled: R.is(Function, disableAccessor) ? disableAccessor(item) : false,
289
- eventsCallbacks: eventsCallbacks,
290
- isSelected: isItemSelected(item, index),
291
- HTMLRenderer: HTMLRenderer,
292
- classes: classes,
293
- labels: labels,
294
- index: index,
295
- style: style,
296
- accessibility: accessibility,
297
- ariaLabel: R.prop('navigateNext')(labels),
298
- theme: theme
299
- }));
300
- }
301
- });
302
- }
303
- )
304
- ),
305
- withExpandControl && React.createElement(
306
- 'div',
241
+ AutoSizer,
307
242
  null,
308
- React.createElement(
309
- Button,
310
- { onClick: collapseAll, color: 'primary' },
311
- R.prop('colapseAll', labels)
312
- ),
313
- React.createElement(
314
- Button,
315
- { onClick: expandAll, color: 'primary' },
316
- R.prop('expandAll', labels)
317
- )
243
+ function (_ref) {
244
+ var height = _ref.height,
245
+ width = _ref.width;
246
+ return React.createElement(VirtualizedList, {
247
+ overscan: 10,
248
+ tabIndex: -1,
249
+ height: height + 2,
250
+ width: width,
251
+ scrollTop: scrollTop // control scroll position with ctrl or shift key
252
+ , rowCount: R.length(list),
253
+ rowHeight: R.add(1)(rowHeight) // 1 is space between elements
254
+ , rowRenderer: function rowRenderer(_ref2) {
255
+ var index = _ref2.index,
256
+ style = _ref2.style;
257
+
258
+ var itemId = R.nth(index, list);
259
+ var item = R.prop(itemId, indexedItemsById);
260
+ return React.createElement(Item, _extends({}, item, {
261
+ id: getHierarchicalId(item),
262
+ label: labelRenderer(item),
263
+ key: getHierarchicalId(item),
264
+ depth: getDepth(indexedItemsById)(item),
265
+ hasChild: R.has(itemId, groupedItemsByParentId),
266
+ hasChildrenOnLevel: getHasChildrenOnLevel(groupedItemsByParentId)(item),
267
+ changeList: R.has(itemId, expandedIds) ? function () {
268
+ return collapse(getHierarchicalId(item));
269
+ } : function () {
270
+ return expand(getHierarchicalId(item));
271
+ },
272
+ NavigateIcon: R.has(itemId, expandedIds) ? ExpandLessIcon : ExpandMoreIcon,
273
+ isRtl: isRtl,
274
+ isDisabled: R.is(Function, disableAccessor) ? disableAccessor(item) : false,
275
+ eventsCallbacks: eventsCallbacks,
276
+ isSelected: isItemSelected(item, index),
277
+ HTMLRenderer: HTMLRenderer,
278
+ classes: classes,
279
+ labels: labels,
280
+ index: index,
281
+ style: style,
282
+ accessibility: accessibility,
283
+ ariaLabel: R.prop('navigateNext')(labels),
284
+ theme: theme
285
+ }));
286
+ }
287
+ });
288
+ }
318
289
  )
319
290
  );
320
291
  };
@@ -334,7 +305,10 @@ VirtualizedTree.propTypes = process.env.NODE_ENV !== "production" ? {
334
305
  }),
335
306
  labelRenderer: PropTypes.func,
336
307
  withExpandControl: PropTypes.bool,
337
- maxTreeHeight: PropTypes.number
308
+ maxTreeHeight: PropTypes.number,
309
+ expandedIds: PropTypes.object,
310
+ expand: PropTypes.func,
311
+ collapse: PropTypes.func
338
312
  } : {};
339
313
 
340
314
  export default VirtualizedTree;