@sis-cc/dotstatsuite-visions 10.19.0 → 10.21.0

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,11 +2,11 @@ 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, { useMemo, useState } from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import * as R from 'ramda';
8
8
  import cx from 'classnames';
9
- import { getEvolvedDisableAccessor, getHierarchicalId, getScopeGetters } from '../VirtualizedTree/utils';
9
+ import { getEvolvedDisableAccessor, getHierarchicalId, getScopeGetters, isItemSelected } from '../VirtualizedTree/utils';
10
10
  import IconButton from '@material-ui/core/Button';
11
11
  import Dialog from '@material-ui/core/Dialog';
12
12
  import DialogTitle from '@material-ui/core/DialogTitle';
@@ -16,26 +16,17 @@ import Paper from '@material-ui/core/Paper';
16
16
  import Grid from '@material-ui/core/Grid';
17
17
  import Typography from '@material-ui/core/Typography';
18
18
  import CloseIcon from '@material-ui/icons/Close';
19
- import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
20
- import ExpandLessIcon from '@material-ui/icons/ExpandLess';
21
19
  import Draggable from 'react-draggable';
22
- import SelectionModeMenu from './SelectionModeMenu';
23
- import { Button, Spotlight, VirtualizedTree } from '..';
20
+ import { Button, Spotlight, Tooltip, VirtualizedTree } from '..';
24
21
  import { withExpansionTree } from '../VirtualizedTree/withExpansionTree';
25
22
  import { withSpotlight } from '../VirtualizedTree/withSpotlight';
26
23
  import { makeStyles } from '@material-ui/core/styles';
27
-
24
+ import HintIcon from '@material-ui/icons/EmojiObjects';
28
25
  import singleImg from './images/single-selection.png';
29
26
  import childrenImg from './images/children-selection.png';
30
27
  import branchImg from './images/branch-selection.png';
31
28
  import levelImg from './images/level-selection.png';
32
- import allImg from './images/all-selection.png';
33
-
34
- import singleIcon from './images/small-single-selection.png';
35
- import childrenIcon from './images/small-children-selection.png';
36
- import branchIcon from './images/small-branch-selection.png';
37
- import levelIcon from './images/small-level-selection.png';
38
- import allIcon from './images/small-all-selection.png';
29
+ import { Divider } from '@material-ui/core';
39
30
 
40
31
  var PaperComponent = function PaperComponent(props) {
41
32
  return React.createElement(
@@ -55,8 +46,10 @@ var useStyles = makeStyles(function (theme) {
55
46
  width: '100%'
56
47
  },
57
48
  headerLabel: {
58
- display: 'flex',
59
- alignItems: 'center'
49
+ fontSize: '16px',
50
+ font: 'PT Sans Narrow',
51
+ fontWeight: '700',
52
+ color: theme.palette.grey[700]
60
53
  },
61
54
  closeButton: {
62
55
  color: 'grey !important',
@@ -68,11 +61,6 @@ var useStyles = makeStyles(function (theme) {
68
61
  height: 32
69
62
  }
70
63
  },
71
- topElements: {
72
- display: 'flex',
73
- flexDirection: 'row',
74
- alignItems: 'center'
75
- },
76
64
  narrowTop: {
77
65
  flexDirection: 'column',
78
66
  alignItems: 'flex-start'
@@ -119,42 +107,42 @@ var useStyles = makeStyles(function (theme) {
119
107
  selectModeItem: {
120
108
  boxShadow: 'none',
121
109
  display: 'flex',
122
- width: 110,
123
- height: 200,
124
110
  backgroundColor: 'inherit',
125
- color: 'inherit',
126
- flexDirection: 'column',
127
- justifyContent: 'space-between',
111
+ flexDirection: 'row-reverse',
112
+ alignItems: 'center',
113
+ '& p': {
114
+ fontSize: '12px',
115
+ font: 'Helvetica Neue',
116
+ color: '#0549AB',
117
+ fontWeight: '500px'
118
+ },
128
119
  '& img': {
129
- width: 110,
130
- height: 140
120
+ width: 21,
121
+ height: 24
131
122
  }
132
123
  },
133
124
  hint: {
134
- marginLeft: 10,
135
- marginRight: 10,
136
125
  display: 'flex',
137
- flexDirection: 'row'
126
+ flexDirection: 'row',
127
+ alignItems: 'center'
128
+ },
129
+ divider: {
130
+ backgroundColor: theme.palette.primary.light
138
131
  },
139
132
  actions: {
140
- justifyContent: 'space-between'
133
+ justifyContent: 'flex-end'
141
134
  },
142
135
  ellipsis: {
143
136
  whiteSpace: 'nowrap',
144
137
  overflow: 'hidden',
145
138
  textOverflow: 'ellipsis'
139
+ },
140
+ tooltip: {
141
+ backgroundColor: theme.palette.action.hover
146
142
  }
147
143
  };
148
144
  });
149
145
 
150
- var icons = {
151
- single: singleIcon,
152
- children: childrenIcon,
153
- branch: branchIcon,
154
- level: levelIcon,
155
- all: allIcon
156
- };
157
-
158
146
  var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
159
147
  var _cx;
160
148
 
@@ -181,19 +169,19 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
181
169
  selectionMode = _useState[0],
182
170
  setSelectionMode = _useState[1];
183
171
 
184
- var _useState2 = useState(false),
185
- isOpenSelectionMenu = _useState2[0],
186
- setIsOpenSelectionMenu = _useState2[1];
187
-
188
- var _useState3 = useState({}),
189
- selection = _useState3[0],
190
- setSelection = _useState3[1];
172
+ var _useState2 = useState({}),
173
+ selection = _useState2[0],
174
+ setSelection = _useState2[1];
191
175
 
192
176
  var classes = useStyles();
193
177
 
194
- var _useState4 = useState(0),
195
- height = _useState4[0],
196
- setHeight = _useState4[1];
178
+ var _useState3 = useState(0),
179
+ height = _useState3[0],
180
+ setHeight = _useState3[1];
181
+
182
+ var _useState4 = useState({}),
183
+ selectIds = _useState4[0],
184
+ setSelectIds = _useState4[1];
197
185
 
198
186
  var measureRef = React.useCallback(function (node) {
199
187
  if (node !== null) {
@@ -225,10 +213,6 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
225
213
  value: 'level',
226
214
  label: R.prop('levelSelection', labels),
227
215
  img: levelImg
228
- }, {
229
- value: 'all',
230
- label: R.prop('allSelection', labels),
231
- img: allImg
232
216
  }];
233
217
 
234
218
  var _allGroupedItems = R.pipe(R.map(function (item) {
@@ -263,13 +247,37 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
263
247
  }, selection, ids);
264
248
  setSelection(nextSelection);
265
249
  };
266
-
267
250
  var handleSubmit = function handleSubmit() {
268
251
  changeSelection(id, R.values(selection), { expandedIds: expandedIds, spotlight: spotlight });
269
252
  setSelection({});
270
253
  setSpotlight({ term: '' });
271
254
  };
272
255
 
256
+ var _useMemo = useMemo(function () {
257
+ var refinedItems = R.map(function (item) {
258
+ return _extends({}, item, {
259
+ isSelected: isItemSelected(selectIds)(item),
260
+ isGreyed: R.is(Function, isDisabled) ? isDisabled(item) : false,
261
+ isDisabled: R.is(Function, _disableAccessor) ? _disableAccessor(item, selectIds) : false
262
+ });
263
+ }, selectionItems);
264
+ var indexedItemsById = R.indexBy(getHierarchicalId, refinedItems);
265
+ var groupedItemsByParentId = R.groupBy(R.propOr('#ROOT', 'parentId'), refinedItems);
266
+ return { indexedItemsById: indexedItemsById, groupedItemsByParentId: groupedItemsByParentId };
267
+ }, [selectionItems, selectIds]),
268
+ indexedItemsById = _useMemo.indexedItemsById,
269
+ groupedItemsByParentId = _useMemo.groupedItemsByParentId;
270
+
271
+ var rejectonlyDisabledItems = function rejectonlyDisabledItems(item) {
272
+ return R.prop('isDisabled')(item) && !R.has('isForced')(item);
273
+ };
274
+ var selectAll = function selectAll() {
275
+ var ids = R.pluck('id', R.reject(rejectonlyDisabledItems, R.values(indexedItemsById)));
276
+ var nextSelection = R.reduce(function (acc, id) {
277
+ return R.has(id, acc) ? acc : R.assoc(id, id, acc);
278
+ }, selection, ids);
279
+ setSelection(nextSelection);
280
+ };
273
281
  return React.createElement(
274
282
  Dialog,
275
283
  {
@@ -291,10 +299,70 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
291
299
  '\xA0',
292
300
  title
293
301
  ),
294
- onClose && React.createElement(
295
- IconButton,
296
- { className: classes.closeButton, onClick: onClose },
297
- React.createElement(CloseIcon, null)
302
+ React.createElement(
303
+ 'div',
304
+ { className: classes.selectModeContainer },
305
+ React.createElement(
306
+ 'div',
307
+ { className: classes.hint },
308
+ React.createElement(
309
+ Tooltip,
310
+ {
311
+ variant: 'light',
312
+ title: React.createElement(
313
+ Typography,
314
+ { variant: 'body2' },
315
+ R.prop('hint', labels)
316
+ )
317
+ },
318
+ React.createElement(HintIcon, null)
319
+ ),
320
+ React.createElement(
321
+ Typography,
322
+ { variant: 'body2' },
323
+ R.prop('selectionMode', labels)
324
+ )
325
+ ),
326
+ R.map(function (_ref) {
327
+ var value = _ref.value,
328
+ label = _ref.label,
329
+ img = _ref.img;
330
+ return React.createElement(
331
+ Tooltip,
332
+ {
333
+ key: value,
334
+ classes: { tooltip: classes.tooltip },
335
+ title: React.createElement('img', { style: { width: '72px', height: '90px' }, src: img, alt: value })
336
+ },
337
+ React.createElement(
338
+ Button,
339
+ {
340
+ className: classes.selectButton,
341
+ selected: value === selectionMode,
342
+ onClick: function onClick() {
343
+ setSelectionMode(value);
344
+ },
345
+ 'aria-pressed': value === selectionMode,
346
+ 'aria-label': label
347
+ },
348
+ React.createElement(
349
+ Paper,
350
+ { className: classes.selectModeItem, key: value },
351
+ React.createElement(
352
+ Typography,
353
+ { variant: 'body2' },
354
+ label
355
+ ),
356
+ !R.isNil(img) && R.is(String, img) && React.createElement('img', { src: img, alt: value })
357
+ )
358
+ )
359
+ );
360
+ }, selectionOptions),
361
+ onClose && React.createElement(
362
+ IconButton,
363
+ { className: classes.closeButton, onClick: onClose },
364
+ React.createElement(CloseIcon, null)
365
+ )
298
366
  )
299
367
  )
300
368
  ),
@@ -321,58 +389,35 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
321
389
  ),
322
390
  React.createElement(
323
391
  'div',
324
- { className: classes.selection },
392
+ null,
325
393
  React.createElement(
326
394
  Button,
327
- {
328
- 'aria-label': 'selection mode',
329
- className: isNarrow ? classes.narrowSelectionButton : classes.selectionButton,
330
- onClick: function onClick() {
331
- return setIsOpenSelectionMenu(!isOpenSelectionMenu);
332
- },
333
- color: 'primary',
334
- variant: 'contained',
335
- alternative: 'siscc',
336
- selected: isOpenSelectionMenu
337
- },
338
- React.createElement(
339
- Typography,
340
- { variant: 'body2', className: classes.ellipsis },
341
- R.prop('selectionMode', labels)
342
- ),
343
- '\xA0',
344
- isOpenSelectionMenu ? React.createElement(ExpandLessIcon, { fontSize: 'small' }) : React.createElement(ExpandMoreIcon, { fontSize: 'small' })
395
+ { onClick: collapseAll, color: 'primary' },
396
+ R.prop('colapseAll', labels)
397
+ ),
398
+ React.createElement(
399
+ Button,
400
+ { style: { marginLeft: 10 }, onClick: expandAll, color: 'primary' },
401
+ R.prop('expandAll', labels)
345
402
  ),
346
- '\xA0',
347
- R.prop(selectionMode + 'Selection', labels),
348
- !R.isNil(R.prop(selectionMode, icons)) && R.is(String, R.prop(selectionMode, icons)) && React.createElement(
349
- Fragment,
350
- null,
351
- '\xA0',
352
- React.createElement('img', {
353
- style: { marginLeft: 15 },
354
- src: R.prop(selectionMode, icons),
355
- alt: selectionMode
356
- })
403
+ React.createElement(
404
+ Button,
405
+ { onClick: selectAll, color: 'primary' },
406
+ R.prop('selectAll', labels)
407
+ ),
408
+ React.createElement(
409
+ Button,
410
+ { style: { marginLeft: 10 }, onClick: function onClick() {
411
+ return setSelection({});
412
+ }, color: 'primary' },
413
+ R.prop('deselectAll', labels)
357
414
  )
358
- )
415
+ ),
416
+ React.createElement(Divider, { className: classes.divider })
359
417
  ),
360
418
  React.createElement(
361
419
  Grid,
362
420
  { item: true, xs: 12 },
363
- React.createElement(SelectionModeMenu, {
364
- classes: classes,
365
- isOpen: isOpenSelectionMenu,
366
- isNarrow: isNarrow,
367
- options: selectionOptions,
368
- onSelect: function onSelect(value) {
369
- setSelectionMode(value);
370
- setIsOpenSelectionMenu(false);
371
- },
372
- selected: selectionMode,
373
- hint: R.prop('hint', labels),
374
- maxHeight: listHeight
375
- }),
376
421
  React.createElement(VirtualizedTree, _extends({}, rest, {
377
422
  disableAccessor: _disableAccessor,
378
423
  isGreyed: isDisabled,
@@ -381,9 +426,13 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
381
426
  items: selectionItems,
382
427
  changeSelection: onChangeSelection,
383
428
  withExpandControl: true,
429
+ setSelectIds: setSelectIds,
430
+ selectIds: selectIds,
384
431
  treeHeight: listHeight,
385
432
  scopeGetter: scopeGetter,
386
- expandedIds: expandedIds
433
+ expandedIds: expandedIds,
434
+ indexedItemsById: indexedItemsById,
435
+ groupedItemsByParentId: groupedItemsByParentId
387
436
  }))
388
437
  )
389
438
  )
@@ -391,20 +440,6 @@ var AdvancedFilterDialog = function AdvancedFilterDialog(props) {
391
440
  React.createElement(
392
441
  DialogActions,
393
442
  { className: classes.actions },
394
- React.createElement(
395
- 'div',
396
- null,
397
- React.createElement(
398
- Button,
399
- { onClick: collapseAll, color: 'primary' },
400
- R.prop('colapseAll', labels)
401
- ),
402
- React.createElement(
403
- Button,
404
- { style: { marginLeft: 10 }, onClick: expandAll, color: 'primary' },
405
- R.prop('expandAll', labels)
406
- )
407
- ),
408
443
  React.createElement(
409
444
  'div',
410
445
  null,
@@ -454,7 +489,8 @@ AdvancedFilterDialog.propTypes = process.env.NODE_ENV !== "production" ? {
454
489
  childrenSelection: PropTypes.string,
455
490
  branchSelection: PropTypes.string,
456
491
  levelSelection: PropTypes.string,
457
- allSelection: PropTypes.string,
492
+ selectAll: PropTypes.string,
493
+ deselectAll: PropTypes.string,
458
494
  apply: PropTypes.string,
459
495
  cancel: PropTypes.string
460
496
  }),
@@ -29,6 +29,8 @@ var Spotlight = function Spotlight(_ref) {
29
29
  action = _ref.action,
30
30
  fullWidth = _ref.fullWidth,
31
31
  className = _ref.className,
32
+ _ref$withAutoFocus = _ref.withAutoFocus,
33
+ withAutoFocus = _ref$withAutoFocus === undefined ? false : _ref$withAutoFocus,
32
34
  _ref$testId = _ref.testId,
33
35
  testId = _ref$testId === undefined ? 'spotlight' : _ref$testId;
34
36
 
@@ -78,6 +80,8 @@ var Spotlight = function Spotlight(_ref) {
78
80
  onBlur: function onBlur() {
79
81
  return setFocus(false);
80
82
  }
83
+ // eslint-disable-next-line jsx-a11y/no-autofocus
84
+ , autoFocus: withAutoFocus
81
85
  }),
82
86
  hasClearAll && !R.isEmpty(value) ? React.createElement(
83
87
  IconButton,
@@ -135,7 +139,8 @@ Spotlight.propTypes = process.env.NODE_ENV !== "production" ? {
135
139
  withBorder: PropTypes.bool,
136
140
  fullWidth: PropTypes.bool,
137
141
  classes: PropTypes.object,
138
- className: PropTypes.object
142
+ className: PropTypes.object,
143
+ withAutoFocus: PropTypes.bool
139
144
  } : {};
140
145
 
141
146
  export default Spotlight;
@@ -60,13 +60,12 @@ var CustomTooltip = function CustomTooltip(_ref) {
60
60
  }
61
61
  // open={true}
62
62
  // interactive={true}
63
- , enterNextDelay: 100
64
- }, props, {
63
+ , enterNextDelay: 100,
65
64
  classes: {
66
65
  popper: classes.popper,
67
66
  tooltip: cx(R.prop(variant + 'Tooltip')(classes), classes.tooltip)
68
67
  }
69
- }),
68
+ }, props),
70
69
  children
71
70
  );
72
71
  };
@@ -118,11 +118,6 @@ export var getEvolvedDisableAccessor = function getEvolvedDisableAccessor(groupe
118
118
  };
119
119
 
120
120
  export var getScopeGetters = {
121
- all: function all(items) {
122
- return function () {
123
- return R.reject(R.prop('isDisabled'), R.values(items.indexedItemsById));
124
- };
125
- },
126
121
  single: function single() {
127
122
  return function (item) {
128
123
  return [item];