@sis-cc/dotstatsuite-visions 7.20.3 → 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);
@@ -57,7 +57,7 @@ var Flags = function Flags(_ref) {
57
57
  }, []), R.join(','))(flags);
58
58
  var content = React.createElement(
59
59
  'ul',
60
- { className: classes.content },
60
+ { 'data-testid': 'cell-flags-footnotes-content', className: classes.content },
61
61
  R.addIndex(R.map)(function (_ref2, index) {
62
62
  var label = _ref2.label;
63
63
  return React.createElement(
@@ -78,7 +78,10 @@ var Flags = function Flags(_ref) {
78
78
  },
79
79
  React.createElement(
80
80
  'span',
81
- { className: cx(classes.flags, (_cx = {}, _cx[classes.header] = isHeader, _cx)) },
81
+ {
82
+ 'data-testid': 'cell-flags-footnotes-icon',
83
+ className: cx(classes.flags, (_cx = {}, _cx[classes.header] = isHeader, _cx))
84
+ },
82
85
  R.not(R.isEmpty(codedIcons)) && codedIcons,
83
86
  R.and(R.not(R.isEmpty(codedIcons)), hasUncoded) && React.createElement(
84
87
  React.Fragment,
@@ -113,6 +113,13 @@ var Header = function Header(_ref) {
113
113
  React.createElement(
114
114
  'div',
115
115
  { className: classes.cellContentCenter },
116
+ !R.isEmpty(hierarchySpace) && mapIndexed(function (space, idx) {
117
+ return React.createElement(
118
+ 'div',
119
+ { key: idx },
120
+ space
121
+ );
122
+ })(hierarchySpace),
116
123
  React.createElement(
117
124
  Typography,
118
125
  {
@@ -123,13 +130,6 @@ var Header = function Header(_ref) {
123
130
  },
124
131
  variant: 'body1'
125
132
  },
126
- !R.isEmpty(hierarchySpace) && mapIndexed(function (space, idx) {
127
- return React.createElement(
128
- 'div',
129
- { key: idx },
130
- space
131
- );
132
- })(hierarchySpace),
133
133
  R.prop('label', headerItem),
134
134
  React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags, isHeader: true })
135
135
  )
@@ -81,7 +81,7 @@ var SectionHeader = function SectionHeader(_ref) {
81
81
  },
82
82
  React.createElement(
83
83
  Grid,
84
- { container: true, alignItems: 'center', spacing: 5 },
84
+ { container: true, alignItems: 'center' },
85
85
  React.createElement(
86
86
  Grid,
87
87
  { item: true },
@@ -128,7 +128,7 @@ var SectionHeader = function SectionHeader(_ref) {
128
128
  ),
129
129
  !R.isNil(SideIcon) && React.createElement(
130
130
  Grid,
131
- { item: true },
131
+ { item: true, style: { marginLeft: 40 } },
132
132
  React.createElement(SideIcon, { sideProps: R.path([0, 'sideProps'], section) })
133
133
  )
134
134
  )
@@ -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,