@sis-cc/dotstatsuite-visions 6.6.3 → 7.0.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.
Files changed (54) hide show
  1. package/es/AuthDialog/index.js +3 -2
  2. package/es/CollapsibleTree/Collapse.js +97 -0
  3. package/es/CollapsibleTree/CollapsibleTree.js +171 -0
  4. package/es/CollapsibleTree/index.js +44 -0
  5. package/es/DataEdit/Input.js +1 -1
  6. package/es/TableHtml5/TableHtml5.js +16 -3
  7. package/es/TableHtml5/cell.js +8 -2
  8. package/es/TableHtml5/flags.js +2 -0
  9. package/es/TableHtml5/header.js +2 -2
  10. package/es/TableHtml5/section.js +22 -18
  11. package/es/TableHtml5/sectionHeader.js +6 -2
  12. package/es/TableHtml5/sideIcon.js +44 -0
  13. package/es/TableHtml5/subHeader.js +14 -15
  14. package/es/index.js +1 -1
  15. package/es/theme.js +13 -0
  16. package/lib/AuthDialog/index.js +6 -5
  17. package/lib/CollapsibleTree/Collapse.js +126 -0
  18. package/lib/CollapsibleTree/CollapsibleTree.js +216 -0
  19. package/lib/{Table → CollapsibleTree}/index.js +2 -2
  20. package/lib/DataEdit/Input.js +1 -1
  21. package/lib/TableHtml5/TableHtml5.js +16 -3
  22. package/lib/TableHtml5/cell.js +11 -2
  23. package/lib/TableHtml5/flags.js +2 -0
  24. package/lib/TableHtml5/header.js +2 -2
  25. package/lib/TableHtml5/section.js +22 -15
  26. package/lib/TableHtml5/sectionHeader.js +9 -2
  27. package/lib/TableHtml5/sideIcon.js +68 -0
  28. package/lib/TableHtml5/subHeader.js +15 -13
  29. package/lib/index.js +10 -10
  30. package/lib/theme.js +13 -0
  31. package/package.json +6 -7
  32. package/es/Table/Table.js +0 -170
  33. package/es/Table/header.js +0 -91
  34. package/es/Table/index.js +0 -56
  35. package/es/Table/itemCell.js +0 -54
  36. package/es/Table/row-header.js +0 -84
  37. package/es/Table/section-header.js +0 -115
  38. package/es/Table/section-rows.js +0 -101
  39. package/es/Table/styles.js +0 -52
  40. package/es/Table/tableCell.js +0 -29
  41. package/es/Table/tooltip.js +0 -85
  42. package/es/Table/useStyles.js +0 -34
  43. package/es/Table/valueCell.js +0 -63
  44. package/lib/Table/Table.js +0 -203
  45. package/lib/Table/header.js +0 -116
  46. package/lib/Table/itemCell.js +0 -74
  47. package/lib/Table/row-header.js +0 -113
  48. package/lib/Table/section-header.js +0 -145
  49. package/lib/Table/section-rows.js +0 -134
  50. package/lib/Table/styles.js +0 -69
  51. package/lib/Table/tableCell.js +0 -50
  52. package/lib/Table/tooltip.js +0 -104
  53. package/lib/Table/useStyles.js +0 -41
  54. package/lib/Table/valueCell.js +0 -86
@@ -19,12 +19,12 @@
19
19
  * onClose: PropTypes.func.isRequired,
20
20
  * onSubmit: PropTypes.func.isRequired
21
21
  * };
22
+ * @demoReady
22
23
  */
23
24
 
24
25
  import React, { useState } from 'react';
25
26
  import PropTypes from 'prop-types';
26
27
  import { isEmpty } from 'ramda';
27
- import Button from '../Button';
28
28
  import Checkbox from '@material-ui/core/Checkbox';
29
29
  import CloseIcon from '@material-ui/icons/Close';
30
30
  import Dialog from '@material-ui/core/Dialog';
@@ -33,8 +33,9 @@ import PersonIcon from '@material-ui/icons/Person';
33
33
  import TextField from '@material-ui/core/TextField';
34
34
  import Typography from '@material-ui/core/Typography';
35
35
  import { makeStyles } from '@material-ui/core/styles';
36
+ import Button from '../Button';
36
37
 
37
- var useStyles = makeStyles(function (theme) {
38
+ var useStyles = makeStyles(function () {
38
39
  return {
39
40
  header: {
40
41
  color: 'grey',
@@ -0,0 +1,97 @@
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
+
3
+ import React, { useEffect } from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import cx from 'classnames';
6
+ import { pathOr } from 'ramda';
7
+ import { makeStyles, useTheme } from '@material-ui/core/styles';
8
+ import Collapse from '@material-ui/core/Collapse';
9
+ import Button from '@material-ui/core/Button';
10
+ import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown';
11
+ import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp';
12
+
13
+ var VARIANT_ICON = 'icon';
14
+ export var VARIANT_BOLD = 'bold';
15
+
16
+ var useStyles = makeStyles(function (theme) {
17
+ var _ref;
18
+
19
+ return _ref = {
20
+ buttonExpand: {
21
+ display: 'flex',
22
+ justifyContent: 'space-between'
23
+ }
24
+ }, _ref['button' + VARIANT_ICON] = {
25
+ color: theme.palette.primary.main,
26
+ backgroundColor: 'rgba(24, 32, 38, 0.04)',
27
+ margin: theme.spacing(1, 0)
28
+ }, _ref['button' + VARIANT_BOLD] = _extends({
29
+ marginBottom: theme.spacing(1),
30
+ padding: theme.spacing(0.5, 0, 1, 0),
31
+ '&:hover': {
32
+ backgroundColor: 'unset'
33
+ }
34
+ }, pathOr({}, ['mixins', 'collapsibleTree', 'buttonSublevel'], theme)), _ref['collapsibleContainer' + VARIANT_BOLD] = {
35
+ borderTop: '2px solid black',
36
+ marginTop: theme.spacing(2),
37
+ marginBottom: theme.spacing(2)
38
+ }, _ref;
39
+ });
40
+
41
+ var CollapseComponent = function CollapseComponent(_ref2) {
42
+ var label = _ref2.label,
43
+ isOpen = _ref2.isOpen,
44
+ children = _ref2.children,
45
+ _ref2$variant = _ref2.variant,
46
+ variant = _ref2$variant === undefined ? VARIANT_ICON : _ref2$variant,
47
+ level = _ref2.level;
48
+
49
+ var classes = useStyles();
50
+ var theme = useTheme();
51
+
52
+ var _React$useState = React.useState(isOpen),
53
+ open = _React$useState[0],
54
+ setOpen = _React$useState[1];
55
+
56
+ useEffect(function () {
57
+ return setOpen(isOpen);
58
+ }, [isOpen]);
59
+
60
+ return React.createElement(
61
+ 'div',
62
+ {
63
+ className: cx(classes['collapsibleContainer' + variant]),
64
+ style: {
65
+ marginRight: theme.spacing(level * 2),
66
+ marginLeft: theme.spacing(level * 2)
67
+ }
68
+ },
69
+ React.createElement(
70
+ Button,
71
+ {
72
+ className: cx(classes.buttonExpand, classes['button' + variant]),
73
+ onClick: function onClick() {
74
+ return setOpen(!open);
75
+ },
76
+ fullWidth: true
77
+ },
78
+ label,
79
+ open ? React.createElement(KeyboardArrowUpIcon, { color: 'primary' }) : React.createElement(KeyboardArrowDownIcon, { color: 'primary' })
80
+ ),
81
+ React.createElement(
82
+ Collapse,
83
+ { 'in': open, timeout: 'auto' },
84
+ children
85
+ )
86
+ );
87
+ };
88
+
89
+ CollapseComponent.propTypes = process.env.NODE_ENV !== "production" ? {
90
+ label: PropTypes.string,
91
+ isOpen: PropTypes.bool,
92
+ children: PropTypes.node,
93
+ variant: PropTypes.oneOf([VARIANT_ICON, VARIANT_BOLD]),
94
+ level: PropTypes.number
95
+ } : {};
96
+
97
+ export default CollapseComponent;
@@ -0,0 +1,171 @@
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
+
3
+ import React, { useState, Fragment, useEffect } from 'react';
4
+ import * as R from 'ramda';
5
+ import PropTypes from 'prop-types';
6
+ import Container from '@material-ui/core/Container';
7
+ import { makeStyles } from '@material-ui/core/styles';
8
+ import Typography from '@material-ui/core/Typography';
9
+ import Divider from '@material-ui/core/Divider';
10
+ import Button from '@material-ui/core/Button';
11
+ import KeyboardArrowDownIcon from '@material-ui/icons/KeyboardArrowDown';
12
+ import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp';
13
+ import CircularProgress from '@material-ui/core/CircularProgress';
14
+ import Grid from '@material-ui/core/Grid';
15
+ import Collapse, { VARIANT_BOLD } from './Collapse';
16
+
17
+ var useStyles = makeStyles(function (theme) {
18
+ return {
19
+ title: _extends({
20
+ fontWeight: 'bold'
21
+ }, R.pathOr({}, ['mixins', 'collapsibleTree', 'title'], theme)),
22
+ divider: {
23
+ marginBottom: theme.spacing(2)
24
+ },
25
+ spacingValue: {
26
+ marginLeft: theme.spacing(2),
27
+ marginRight: theme.spacing(2),
28
+ marginBottom: theme.spacing(2)
29
+ }
30
+ };
31
+ });
32
+
33
+ var CollapsibleTree = function CollapsibleTree(_ref) {
34
+ var _ref$data = _ref.data,
35
+ data = _ref$data === undefined ? [] : _ref$data,
36
+ _ref$defaultDepthLeve = _ref.defaultDepthLevel,
37
+ defaultDepthLevel = _ref$defaultDepthLeve === undefined ? 1 : _ref$defaultDepthLeve,
38
+ isLoading = _ref.isLoading,
39
+ children = _ref.children,
40
+ labels = _ref.labels,
41
+ _ref$testId = _ref.testId,
42
+ testId = _ref$testId === undefined ? 'collapsible-tree' : _ref$testId;
43
+
44
+ var classes = useStyles();
45
+
46
+ var _useState = useState(defaultDepthLevel),
47
+ depthLevel = _useState[0],
48
+ setDepthLevel = _useState[1];
49
+
50
+ useEffect(function () {
51
+ return setDepthLevel(defaultDepthLevel);
52
+ }, [defaultDepthLevel]);
53
+
54
+ if (isLoading) {
55
+ return React.createElement(
56
+ Grid,
57
+ { container: true, item: true, justifyContent: 'center' },
58
+ React.createElement(CircularProgress, null)
59
+ );
60
+ }
61
+
62
+ var handleCollapse = function handleCollapse(isAllOpen) {
63
+ if (isAllOpen) return setDepthLevel(undefined);
64
+ return setDepthLevel(defaultDepthLevel);
65
+ };
66
+
67
+ var isAllOpen = depthLevel >= defaultDepthLevel;
68
+ var buttonAllOpenLabel = isAllOpen ? R.prop('collapseAll', labels) : R.prop('expandAll', labels);
69
+
70
+ return React.createElement(
71
+ Fragment,
72
+ null,
73
+ React.createElement(
74
+ Container,
75
+ { disableGutters: true, 'data-testid': testId },
76
+ React.createElement(
77
+ Button,
78
+ {
79
+ 'aria-label': buttonAllOpenLabel,
80
+ color: 'primary',
81
+ endIcon: isAllOpen ? React.createElement(KeyboardArrowDownIcon, { color: 'primary' }) : React.createElement(KeyboardArrowUpIcon, { color: 'primary' }),
82
+ onClick: function onClick() {
83
+ return handleCollapse(isAllOpen);
84
+ }
85
+ },
86
+ buttonAllOpenLabel
87
+ ),
88
+ children
89
+ ),
90
+ R.map(function (_ref2) {
91
+ var id = _ref2.id,
92
+ label = _ref2.label,
93
+ _ref2$children = _ref2.children,
94
+ children = _ref2$children === undefined ? [] : _ref2$children;
95
+
96
+ return React.createElement(
97
+ Fragment,
98
+ { key: id },
99
+ React.createElement(Divider, { className: classes.divider }),
100
+ React.createElement(
101
+ Typography,
102
+ { variant: 'h5', className: classes.title },
103
+ label
104
+ ),
105
+ R.map(function (_ref3) {
106
+ var id = _ref3.id,
107
+ label = _ref3.label,
108
+ children = _ref3.children,
109
+ value = _ref3.value;
110
+
111
+ return React.createElement(
112
+ Collapse,
113
+ { key: id, level: 0, label: label, isOpen: depthLevel >= 0 },
114
+ value && React.createElement(
115
+ Typography,
116
+ { className: classes.spacingValue, variant: 'body2' },
117
+ value
118
+ ),
119
+ children && R.map(function (_ref4) {
120
+ var id = _ref4.id,
121
+ label = _ref4.label,
122
+ value = _ref4.value;
123
+
124
+ return React.createElement(
125
+ Collapse,
126
+ {
127
+ key: id,
128
+ level: 1,
129
+ variant: VARIANT_BOLD,
130
+ label: label,
131
+ isOpen: depthLevel >= 1
132
+ },
133
+ React.createElement(
134
+ Typography,
135
+ { variant: 'body2' },
136
+ value
137
+ )
138
+ );
139
+ }, children)
140
+ );
141
+ }, children)
142
+ );
143
+ }, data)
144
+ );
145
+ };
146
+
147
+ CollapsibleTree.propTypes = process.env.NODE_ENV !== "production" ? {
148
+ data: PropTypes.arrayOf(PropTypes.shape({
149
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
150
+ label: PropTypes.string,
151
+ children: PropTypes.arrayOf(PropTypes.shape({
152
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
153
+ label: PropTypes.string,
154
+ children: PropTypes.arrayOf(PropTypes.shape({
155
+ id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
156
+ label: PropTypes.string,
157
+ value: PropTypes.string
158
+ }))
159
+ }))
160
+ })),
161
+ defaultDepthLevel: PropTypes.number,
162
+ isLoading: PropTypes.bool,
163
+ children: PropTypes.node,
164
+ labels: PropTypes.shape({
165
+ collapseAll: PropTypes.string,
166
+ expandAll: PropTypes.string
167
+ }),
168
+ testId: PropTypes.string
169
+ } : {};
170
+
171
+ export default CollapsibleTree;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * CollapsibleTree is a component that show you a tree structure with a button to expand/collapse each node.
3
+ * defaultDepthLevel is the maximum level that will be open by "collapse all" button value could be 0|1. set to 1 by default.
4
+ *
5
+ * @memberOf VISIONS
6
+ * @name CollapsibleTree
7
+ * @tag component
8
+ * @api public
9
+ * @props
10
+ * CollapsibleTree.propTypes = {
11
+ * data: PropTypes.arrayOf(PropTypes.shape({
12
+ * id: PropTypes.string.isRequired,
13
+ * label: PropTypes.string,
14
+ * children: PropTypes.arrayOf(PropTypes.shape({
15
+ * id: PropTypes.string.isRequired,
16
+ * label: PropTypes.string,
17
+ * children: PropTypes.arrayOf(PropTypes.shape({
18
+ * id: PropTypes.string.isRequired,
19
+ * label: PropTypes.string,
20
+ * value: PropTypes.string,
21
+ * })),
22
+ * }))
23
+ * })),
24
+ * defaultDepthLevel: PropTypes.number,
25
+ * testId: PropTypes.string,
26
+ *};
27
+ * @theme
28
+ * {
29
+ * palette: {
30
+ * primary: {
31
+ * main: // color label button
32
+ * },
33
+ * }
34
+ * mixins: {
35
+ * CollapsibleTree: {
36
+ * title: {
37
+ * // font, color, of titles
38
+ * },
39
+ * }
40
+ * @demoReady
41
+ *
42
+ */
43
+
44
+ export { default } from './CollapsibleTree';
@@ -12,7 +12,7 @@ import IconButton from '@material-ui/core/IconButton';
12
12
  import Done from '@material-ui/icons/Done';
13
13
  import RotateLeftIcon from '@material-ui/icons/RotateLeft';
14
14
 
15
- var useStyles = makeStyles(function (theme) {
15
+ var useStyles = makeStyles(function () {
16
16
  return {
17
17
  visibility: {
18
18
  visibility: 'hidden'
@@ -68,7 +68,10 @@ var TableHtml5 = function TableHtml5(_ref) {
68
68
  sectionsData = _ref$sectionsData === undefined ? [] : _ref$sectionsData,
69
69
  cellHandler = _ref.cellHandler,
70
70
  activeCellIds = _ref.activeCellIds,
71
- activeCellHandler = _ref.activeCellHandler;
71
+ activeCellHandler = _ref.activeCellHandler,
72
+ sideToggle = _ref.sideToggle,
73
+ _ref$testId = _ref.testId,
74
+ testId = _ref$testId === undefined ? 'vis-table' : _ref$testId;
72
75
 
73
76
  var classes = useStyles();
74
77
 
@@ -112,7 +115,13 @@ var TableHtml5 = function TableHtml5(_ref) {
112
115
  var nbColumnsByRows = R.map(R.length)(valuesHeaderData);
113
116
  return React.createElement(
114
117
  Table,
115
- { className: classes.table, 'aria-label': 'table', size: 'small', style: { padding: '0px 0px' } },
118
+ {
119
+ className: classes.table,
120
+ 'aria-label': 'table',
121
+ size: 'small',
122
+ style: { padding: '0px 0px' },
123
+ 'data-testid': testId
124
+ },
116
125
  React.createElement(
117
126
  'thead',
118
127
  { ref: headerRef, className: classes.stickyHeader },
@@ -126,6 +135,7 @@ var TableHtml5 = function TableHtml5(_ref) {
126
135
  headerData: headerData,
127
136
  xLayoutData: xLayoutData,
128
137
  activeCellIds: activeCellIds,
138
+ sideToggle: sideToggle,
129
139
  ref: subHeadCellsRef,
130
140
  subHeadCellsWidth: subHeadCellsWidth
131
141
  })
@@ -143,6 +153,7 @@ var TableHtml5 = function TableHtml5(_ref) {
143
153
  cellHandler: cellHandler,
144
154
  activeCellIds: activeCellIds,
145
155
  activeCellHandler: activeCellHandler,
156
+ sideToggle: sideToggle,
146
157
  subHeadCellsWidth: subHeadCellsWidth
147
158
  });
148
159
  }, sectionsData)
@@ -155,7 +166,9 @@ TableHtml5.propTypes = process.env.NODE_ENV !== "production" ? {
155
166
  sectionsData: PropTypes.array,
156
167
  cellHandler: PropTypes.func,
157
168
  activeCellHandler: PropTypes.func,
158
- activeCellIds: PropTypes.object
169
+ activeCellIds: PropTypes.object,
170
+ sideToggle: PropTypes.func,
171
+ testId: PropTypes.string
159
172
  } : {};
160
173
 
161
174
  export default TableHtml5;
@@ -6,6 +6,7 @@ import { makeStyles } from '@material-ui/core/styles';
6
6
  import TableCell from '@material-ui/core/TableCell';
7
7
  import Typography from '@material-ui/core/Typography';
8
8
  import Link from '@material-ui/core/Link';
9
+ import SideIcon from './sideIcon';
9
10
  import Flags from './flags';
10
11
 
11
12
  var useStyles = makeStyles(function (theme) {
@@ -47,7 +48,9 @@ var Cell = function Cell(_ref) {
47
48
  cellHandler = _ref.cellHandler,
48
49
  activeCellHandler = _ref.activeCellHandler,
49
50
  isActive = _ref.isActive,
50
- isHighlight = _ref.isHighlight;
51
+ isHighlight = _ref.isHighlight,
52
+ sideProps = _ref.sideProps,
53
+ sideToggle = _ref.sideToggle;
51
54
 
52
55
  var classes = useStyles();
53
56
  var hasFlag = R.not(R.isEmpty(flags));
@@ -80,6 +83,7 @@ var Cell = function Cell(_ref) {
80
83
  React.createElement(
81
84
  Typography,
82
85
  { variant: 'body1', tabIndex: 0, noWrap: hasFlag },
86
+ React.createElement(SideIcon, { sideProps: sideProps, sideToggle: sideToggle }),
83
87
  hasFlag && React.createElement(Flags, { flags: flags }),
84
88
  uiValue
85
89
  )
@@ -96,7 +100,9 @@ Cell.propTypes = process.env.NODE_ENV !== "production" ? {
96
100
  cellHandler: PropTypes.func,
97
101
  isActive: PropTypes.bool,
98
102
  isHighlight: PropTypes.bool,
99
- activeCellHandler: PropTypes.func
103
+ activeCellHandler: PropTypes.func,
104
+ sideProps: PropTypes.object,
105
+ sideToggle: PropTypes.func
100
106
  } : {};
101
107
 
102
108
  export default Cell;
@@ -25,6 +25,7 @@ var useStyles = makeStyles(function (theme) {
25
25
  borderColor: 'inherit',
26
26
  margin: theme.spacing(0, 0.5),
27
27
  whiteSpace: 'nowrap',
28
+ display: 'inline',
28
29
  fontWeight: 'bold',
29
30
  fontStyle: 'normal',
30
31
  textTransform: 'uppercase'
@@ -87,6 +88,7 @@ var Flags = function Flags(_ref) {
87
88
  hasUncoded && React.createElement(
88
89
  Fragment,
89
90
  null,
91
+ '\xA0',
90
92
  React.createElement(Asterisk, { className: classes.svg, style: { fontSize: 11 } }),
91
93
  React.createElement(
92
94
  Typography,
@@ -59,7 +59,7 @@ var Header = function Header(_ref) {
59
59
  var theme = useTheme();
60
60
  var isRtl = getIsRtl(theme);
61
61
 
62
- var stickyLabelPosition = R.sum(subHeadCellsWidth) + 30 + theme.spacing(1);
62
+ var stickyLabelPosition = R.last(subHeadCellsWidth) + 30 + theme.spacing(1);
63
63
 
64
64
  if (R.compose(R.anyPass([R.isNil, R.isEmpty]), R.path([0, 'data']))(headerData)) return null;
65
65
  return timesIndexed(function (index) {
@@ -80,7 +80,7 @@ var Header = function Header(_ref) {
80
80
  colSpan: R.inc(xLayoutDataLength),
81
81
  id: id,
82
82
  tabIndex: 0,
83
- style: { position: 'sticky', left: 0, right: 0, zIndex: 1 }
83
+ style: isRtl ? { position: 'sticky', zIndex: 1, right: 0 } : { position: 'sticky', zIndex: 1, left: 0 }
84
84
  },
85
85
  React.createElement(
86
86
  'div',
@@ -1,17 +1,18 @@
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 from 'react';
3
+ import React, { Fragment } from 'react';
4
4
  import * as R from 'ramda';
5
5
  import PropTypes from 'prop-types';
6
6
  import cx from 'classnames';
7
7
  import Typography from '@material-ui/core/Typography';
8
- import { makeStyles } from '@material-ui/core/styles';
8
+ import { makeStyles, useTheme } from '@material-ui/core/styles';
9
9
  import TableBody from '@material-ui/core/TableBody';
10
10
  import TableCell from '@material-ui/core/TableCell';
11
11
  import TableRow from '@material-ui/core/TableRow';
12
12
  import SectionHeader from './sectionHeader';
13
13
  import Cell from './cell';
14
- import { getLight } from '../utils';
14
+ import SideIcon from './sideIcon';
15
+ import { getLight, getIsRtl } from '../utils';
15
16
  import Flags from './flags';
16
17
 
17
18
  var useStyles = makeStyles(function (theme) {
@@ -32,7 +33,8 @@ var useStyles = makeStyles(function (theme) {
32
33
  border: 'inherit',
33
34
  borderBottom: '1px solid ' + theme.palette.grey[500],
34
35
  borderRight: '1px solid ' + theme.palette.grey[500],
35
- padding: theme.spacing(0.5) + 'px ' + theme.spacing(1) + 'px'
36
+ padding: theme.spacing(0.5) + 'px ' + theme.spacing(1) + 'px',
37
+ position: 'sticky'
36
38
  },
37
39
  cellContent: {
38
40
  display: 'flex',
@@ -49,7 +51,11 @@ var useStyles = makeStyles(function (theme) {
49
51
  hierarchySpace: {
50
52
  marginBottom: 'auto'
51
53
  },
52
- highlight: theme.mixins.table.cellHighlight
54
+ highlight: theme.mixins.table.cellHighlight,
55
+ stickyHeader: {
56
+ position: 'sticky',
57
+ zIndex: 1
58
+ }
53
59
  };
54
60
  });
55
61
  var mapIndexed = R.addIndex(R.map);
@@ -65,12 +71,15 @@ var Section = function Section(_ref) {
65
71
  headerHeight = _ref.headerHeight,
66
72
  sectionIndex = _ref.sectionIndex,
67
73
  nbColumnsByRows = _ref.nbColumnsByRows,
74
+ sideToggle = _ref.sideToggle,
68
75
  subHeadCellsWidth = _ref.subHeadCellsWidth;
69
76
 
70
77
  var classes = useStyles();
71
78
  var currentSection = R.path([0, 'key'], section);
72
79
  var headerNumberRows = R.length(nbColumnsByRows);
73
80
  var maxColumns = R.last(nbColumnsByRows);
81
+ var theme = useTheme();
82
+ var isRtl = getIsRtl(theme);
74
83
 
75
84
  return React.createElement(
76
85
  TableBody,
@@ -80,7 +89,8 @@ var Section = function Section(_ref) {
80
89
  section: section,
81
90
  currentSection: currentSection,
82
91
  xLayoutDataLength: xLayoutDataLength,
83
- headerHeight: headerHeight
92
+ headerHeight: headerHeight,
93
+ sideToggle: sideToggle
84
94
  }),
85
95
  R.map(function (sectionbody) {
86
96
  var _cx2;
@@ -109,16 +119,11 @@ var Section = function Section(_ref) {
109
119
  TableCell,
110
120
  {
111
121
  key: id,
112
- className: cx(classes.rowTitle, (_cx = {}, _cx[classes.topCell] = R.not(R.isEmpty(flags)), _cx[classes.highlight] = R.prop(rowId)(activeCellIds), _cx)),
122
+ className: cx(classes.rowTitle, classes.stickyHeader, (_cx = {}, _cx[classes.topCell] = R.not(R.isEmpty(flags)), _cx[classes.highlight] = R.prop(rowId)(activeCellIds), _cx)),
113
123
  id: id,
114
124
  headers: 'subHeader_' + index + ' ' + currentSection,
115
125
  component: 'th',
116
- style: {
117
- position: 'sticky',
118
- left: subHeadCellsWidth[index],
119
- right: subHeadCellsWidth[index],
120
- zIndex: 1
121
- }
126
+ style: isRtl ? { right: subHeadCellsWidth[index] } : { left: subHeadCellsWidth[index] }
122
127
  },
123
128
  React.createElement(
124
129
  'div',
@@ -141,15 +146,12 @@ var Section = function Section(_ref) {
141
146
  TableCell,
142
147
  {
143
148
  className: cx(classes.fillerCell, (_cx2 = {}, _cx2[classes.highlight] = R.prop(rowId)(activeCellIds), _cx2)),
144
- style: {
145
- position: 'sticky',
146
- left: R.last(subHeadCellsWidth),
147
- right: R.last(subHeadCellsWidth)
148
- }
149
+ style: isRtl ? { right: R.last(subHeadCellsWidth) } : { left: R.last(subHeadCellsWidth) }
149
150
  },
150
151
  React.createElement(
151
152
  'div',
152
153
  { className: classes.flagContainer },
154
+ React.createElement(SideIcon, { sideProps: R.prop('sideProps', sectionbody), sideToggle: sideToggle }),
153
155
  React.createElement(Flags, { flags: R.prop('flags', sectionbody) })
154
156
  )
155
157
  ),
@@ -166,6 +168,7 @@ var Section = function Section(_ref) {
166
168
  }, R.pathOr({ value: '..' }, [item.key, currentSection, sectionbody.key, 0], cells), {
167
169
  headers: rowIds + ' ' + columnIds + ' ' + currentSection,
168
170
  cellHandler: cellHandler,
171
+ sideToggle: sideToggle,
169
172
  isActive: isActive,
170
173
  isHighlight: R.any(R.identity)([R.prop(rowId)(activeCellIds), R.prop(columnIndex)(activeCellIds)]),
171
174
  activeCellHandler: R.is(Function)(activeCellHandler) ? function () {
@@ -193,6 +196,7 @@ Section.propTypes = process.env.NODE_ENV !== "production" ? {
193
196
  headerNumberRows: PropTypes.number,
194
197
  nbColumnsByRows: PropTypes.array,
195
198
  maxColumns: PropTypes.number,
199
+ sideToggle: PropTypes.func,
196
200
  subHeadCellsWidth: PropTypes.arrayOf(PropTypes.number)
197
201
  } : {};
198
202
 
@@ -8,6 +8,7 @@ import { makeStyles } from '@material-ui/core/styles';
8
8
  import Lens from '@material-ui/icons/Lens';
9
9
  import TableCell from '@material-ui/core/TableCell';
10
10
  import TableRow from '@material-ui/core/TableRow';
11
+ import SideIcon from './sideIcon';
11
12
  import Flags from './flags';
12
13
  import { getDark } from '../utils';
13
14
 
@@ -54,7 +55,8 @@ var SectionHeader = function SectionHeader(_ref) {
54
55
  section = _ref.section,
55
56
  currentSection = _ref.currentSection,
56
57
  xLayoutDataLength = _ref.xLayoutDataLength,
57
- headerHeight = _ref.headerHeight;
58
+ headerHeight = _ref.headerHeight,
59
+ sideToggle = _ref.sideToggle;
58
60
 
59
61
  var classes = useStyles();
60
62
  if (R.compose(R.anyPass([R.isNil, R.isEmpty]), R.path([0, 'data']))(section)) return null;
@@ -109,6 +111,7 @@ var SectionHeader = function SectionHeader(_ref) {
109
111
  React.createElement(
110
112
  'div',
111
113
  { className: classes.flag },
114
+ React.createElement(SideIcon, { sideProps: R.path([0, 'sideProps'], section), sideToggle: sideToggle }),
112
115
  React.createElement(Flags, { flags: R.path([0, 'flags'], section) })
113
116
  )
114
117
  )
@@ -121,7 +124,8 @@ SectionHeader.propTypes = process.env.NODE_ENV !== "production" ? {
121
124
  section: PropTypes.array,
122
125
  currentSection: PropTypes.string,
123
126
  xLayoutDataLength: PropTypes.number,
124
- headerHeight: PropTypes.number
127
+ headerHeight: PropTypes.number,
128
+ sideToggle: PropTypes.func
125
129
  } : {};
126
130
 
127
131
  export default SectionHeader;
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import * as R from 'ramda';
3
+ import PropTypes from 'prop-types';
4
+ import { makeStyles } from '@material-ui/core/styles';
5
+ import InfoIcon from '@material-ui/icons//Info';
6
+ import IconButton from '@material-ui/core/IconButton';
7
+
8
+ var useStyles = makeStyles(function (theme) {
9
+ return {
10
+ icon: {
11
+ color: theme.palette.primary.main,
12
+ padding: 0
13
+ }
14
+ };
15
+ });
16
+
17
+ var SideIcon = function SideIcon(_ref) {
18
+ var sideProps = _ref.sideProps,
19
+ sideToggle = _ref.sideToggle;
20
+
21
+ var classes = useStyles();
22
+ if (R.isNil(sideProps) || !R.is(Function, sideToggle)) {
23
+ return null;
24
+ }
25
+ return React.createElement(
26
+ IconButton,
27
+ {
28
+ size: 'small',
29
+ className: classes.icon,
30
+ onClick: function onClick() {
31
+ return sideToggle(sideProps);
32
+ },
33
+ 'data-testid': 'ref-md-info'
34
+ },
35
+ React.createElement(InfoIcon, { fontSize: 'small' })
36
+ );
37
+ };
38
+
39
+ SideIcon.propTypes = process.env.NODE_ENV !== "production" ? {
40
+ sideProps: PropTypes.object,
41
+ sideToggle: PropTypes.func
42
+ } : {};
43
+
44
+ export default SideIcon;