@sis-cc/dotstatsuite-visions 6.6.2 → 6.7.1
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.
- package/es/AuthDialog/index.js +3 -2
- package/es/CollapsibleTree/Collapse.js +97 -0
- package/es/CollapsibleTree/CollapsibleTree.js +171 -0
- package/es/CollapsibleTree/index.js +44 -0
- package/es/DataEdit/Input.js +1 -1
- package/es/TableHtml5/TableHtml5.js +18 -5
- package/es/TableHtml5/cell.js +8 -2
- package/es/TableHtml5/flags.js +2 -0
- package/es/TableHtml5/header.js +21 -8
- package/es/TableHtml5/section.js +22 -9
- package/es/TableHtml5/sectionHeader.js +6 -2
- package/es/TableHtml5/sideIcon.js +44 -0
- package/es/TableHtml5/subHeader.js +14 -6
- package/es/index.js +1 -0
- package/es/theme.js +13 -0
- package/lib/AuthDialog/index.js +6 -5
- package/lib/CollapsibleTree/Collapse.js +126 -0
- package/lib/CollapsibleTree/CollapsibleTree.js +216 -0
- package/lib/CollapsibleTree/index.js +16 -0
- package/lib/DataEdit/Input.js +1 -1
- package/lib/TableHtml5/TableHtml5.js +18 -5
- package/lib/TableHtml5/cell.js +11 -2
- package/lib/TableHtml5/flags.js +2 -0
- package/lib/TableHtml5/header.js +21 -7
- package/lib/TableHtml5/section.js +22 -6
- package/lib/TableHtml5/sectionHeader.js +9 -2
- package/lib/TableHtml5/sideIcon.js +68 -0
- package/lib/TableHtml5/subHeader.js +15 -4
- package/lib/index.js +10 -1
- package/lib/theme.js +13 -0
- package/package.json +2 -2
package/es/AuthDialog/index.js
CHANGED
|
@@ -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 (
|
|
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';
|
package/es/DataEdit/Input.js
CHANGED
|
@@ -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 (
|
|
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
|
|
|
@@ -110,22 +113,29 @@ var TableHtml5 = function TableHtml5(_ref) {
|
|
|
110
113
|
var xLayoutDataLength = R.length(xLayoutData);
|
|
111
114
|
var valuesHeaderData = getEnhancedValuesHeaderData(headerData);
|
|
112
115
|
var nbColumnsByRows = R.map(R.length)(valuesHeaderData);
|
|
113
|
-
|
|
114
116
|
return React.createElement(
|
|
115
117
|
Table,
|
|
116
|
-
{
|
|
118
|
+
{
|
|
119
|
+
className: classes.table,
|
|
120
|
+
'aria-label': 'table',
|
|
121
|
+
size: 'small',
|
|
122
|
+
style: { padding: '0px 0px' },
|
|
123
|
+
'data-testid': testId
|
|
124
|
+
},
|
|
117
125
|
React.createElement(
|
|
118
126
|
'thead',
|
|
119
127
|
{ ref: headerRef, className: classes.stickyHeader },
|
|
120
128
|
React.createElement(Header, {
|
|
121
129
|
headerData: headerData,
|
|
122
130
|
valuesHeaderData: valuesHeaderData,
|
|
123
|
-
xLayoutDataLength: xLayoutDataLength
|
|
131
|
+
xLayoutDataLength: xLayoutDataLength,
|
|
132
|
+
subHeadCellsWidth: subHeadCellsWidth
|
|
124
133
|
}),
|
|
125
134
|
React.createElement(SubHeader, {
|
|
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;
|
package/es/TableHtml5/cell.js
CHANGED
|
@@ -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;
|
package/es/TableHtml5/flags.js
CHANGED
|
@@ -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,
|
package/es/TableHtml5/header.js
CHANGED
|
@@ -3,10 +3,11 @@ import * as R from 'ramda';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import Typography from '@material-ui/core/Typography';
|
|
6
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
6
|
+
import { makeStyles, useTheme } from '@material-ui/core/styles';
|
|
7
7
|
import TableCell from '@material-ui/core/TableCell';
|
|
8
8
|
import TableRow from '@material-ui/core/TableRow';
|
|
9
9
|
import Flags from './flags';
|
|
10
|
+
import { getIsRtl } from '../utils';
|
|
10
11
|
|
|
11
12
|
var useStyles = makeStyles(function (theme) {
|
|
12
13
|
return {
|
|
@@ -40,9 +41,7 @@ var useStyles = makeStyles(function (theme) {
|
|
|
40
41
|
paddingTop: 0
|
|
41
42
|
},
|
|
42
43
|
stickyLabel: {
|
|
43
|
-
position: 'sticky'
|
|
44
|
-
left: theme.spacing(1),
|
|
45
|
-
right: theme.spacing(1)
|
|
44
|
+
position: 'sticky'
|
|
46
45
|
}
|
|
47
46
|
};
|
|
48
47
|
});
|
|
@@ -53,9 +52,15 @@ var mapIndexed = R.addIndex(R.map);
|
|
|
53
52
|
var Header = function Header(_ref) {
|
|
54
53
|
var headerData = _ref.headerData,
|
|
55
54
|
valuesHeaderData = _ref.valuesHeaderData,
|
|
56
|
-
xLayoutDataLength = _ref.xLayoutDataLength
|
|
55
|
+
xLayoutDataLength = _ref.xLayoutDataLength,
|
|
56
|
+
subHeadCellsWidth = _ref.subHeadCellsWidth;
|
|
57
57
|
|
|
58
58
|
var classes = useStyles();
|
|
59
|
+
var theme = useTheme();
|
|
60
|
+
var isRtl = getIsRtl(theme);
|
|
61
|
+
|
|
62
|
+
var stickyLabelPosition = R.last(subHeadCellsWidth) + 30 + theme.spacing(1);
|
|
63
|
+
|
|
59
64
|
if (R.compose(R.anyPass([R.isNil, R.isEmpty]), R.path([0, 'data']))(headerData)) return null;
|
|
60
65
|
return timesIndexed(function (index) {
|
|
61
66
|
var _cx;
|
|
@@ -75,7 +80,7 @@ var Header = function Header(_ref) {
|
|
|
75
80
|
colSpan: R.inc(xLayoutDataLength),
|
|
76
81
|
id: id,
|
|
77
82
|
tabIndex: 0,
|
|
78
|
-
style: { position: 'sticky',
|
|
83
|
+
style: isRtl ? { position: 'sticky', zIndex: 1, right: 0 } : { position: 'sticky', zIndex: 1, left: 0 }
|
|
79
84
|
},
|
|
80
85
|
React.createElement(
|
|
81
86
|
'div',
|
|
@@ -108,7 +113,14 @@ var Header = function Header(_ref) {
|
|
|
108
113
|
{ className: classes.cellContentCenter },
|
|
109
114
|
React.createElement(
|
|
110
115
|
Typography,
|
|
111
|
-
{
|
|
116
|
+
{
|
|
117
|
+
className: classes.stickyLabel,
|
|
118
|
+
style: {
|
|
119
|
+
left: isRtl ? theme.spacing(1) : stickyLabelPosition,
|
|
120
|
+
right: isRtl ? stickyLabelPosition : theme.spacing(1)
|
|
121
|
+
},
|
|
122
|
+
variant: 'body1'
|
|
123
|
+
},
|
|
112
124
|
R.prop('label', headerItem),
|
|
113
125
|
React.createElement(Flags, { flags: flags, isHeader: true })
|
|
114
126
|
)
|
|
@@ -122,7 +134,8 @@ var Header = function Header(_ref) {
|
|
|
122
134
|
Header.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
123
135
|
headerData: PropTypes.array,
|
|
124
136
|
valuesHeaderData: PropTypes.array,
|
|
125
|
-
xLayoutDataLength: PropTypes.number
|
|
137
|
+
xLayoutDataLength: PropTypes.number,
|
|
138
|
+
subHeadCellsWidth: PropTypes.array
|
|
126
139
|
} : {};
|
|
127
140
|
|
|
128
141
|
export default Header;
|
package/es/TableHtml5/section.js
CHANGED
|
@@ -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
|
|
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,11 +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: {
|
|
126
|
+
style: isRtl ? { right: subHeadCellsWidth[index] } : { left: subHeadCellsWidth[index] }
|
|
117
127
|
},
|
|
118
128
|
React.createElement(
|
|
119
129
|
'div',
|
|
@@ -136,11 +146,12 @@ var Section = function Section(_ref) {
|
|
|
136
146
|
TableCell,
|
|
137
147
|
{
|
|
138
148
|
className: cx(classes.fillerCell, (_cx2 = {}, _cx2[classes.highlight] = R.prop(rowId)(activeCellIds), _cx2)),
|
|
139
|
-
style: {
|
|
149
|
+
style: isRtl ? { right: R.last(subHeadCellsWidth) } : { left: R.last(subHeadCellsWidth) }
|
|
140
150
|
},
|
|
141
151
|
React.createElement(
|
|
142
152
|
'div',
|
|
143
153
|
{ className: classes.flagContainer },
|
|
154
|
+
React.createElement(SideIcon, { sideProps: R.prop('sideProps', sectionbody), sideToggle: sideToggle }),
|
|
144
155
|
React.createElement(Flags, { flags: R.prop('flags', sectionbody) })
|
|
145
156
|
)
|
|
146
157
|
),
|
|
@@ -157,6 +168,7 @@ var Section = function Section(_ref) {
|
|
|
157
168
|
}, R.pathOr({ value: '..' }, [item.key, currentSection, sectionbody.key, 0], cells), {
|
|
158
169
|
headers: rowIds + ' ' + columnIds + ' ' + currentSection,
|
|
159
170
|
cellHandler: cellHandler,
|
|
171
|
+
sideToggle: sideToggle,
|
|
160
172
|
isActive: isActive,
|
|
161
173
|
isHighlight: R.any(R.identity)([R.prop(rowId)(activeCellIds), R.prop(columnIndex)(activeCellIds)]),
|
|
162
174
|
activeCellHandler: R.is(Function)(activeCellHandler) ? function () {
|
|
@@ -184,6 +196,7 @@ Section.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
184
196
|
headerNumberRows: PropTypes.number,
|
|
185
197
|
nbColumnsByRows: PropTypes.array,
|
|
186
198
|
maxColumns: PropTypes.number,
|
|
199
|
+
sideToggle: PropTypes.func,
|
|
187
200
|
subHeadCellsWidth: PropTypes.arrayOf(PropTypes.number)
|
|
188
201
|
} : {};
|
|
189
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;
|