@sis-cc/dotstatsuite-visions 6.6.1 → 6.7.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.
- 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/Share/Mode.js +59 -13
- package/es/Share/index.js +9 -1
- package/es/TableHtml5/TableHtml5.js +18 -5
- package/es/TableHtml5/cell.js +8 -2
- package/es/TableHtml5/header.js +21 -8
- package/es/TableHtml5/section.js +21 -8
- 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/Share/Mode.js +59 -12
- package/lib/TableHtml5/TableHtml5.js +18 -5
- package/lib/TableHtml5/cell.js +11 -2
- 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/TableHtml5/section.js
CHANGED
|
@@ -5,13 +5,14 @@ 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;
|
|
@@ -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;
|
|
@@ -3,11 +3,12 @@ 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
|
-
import { getLight } from '../utils';
|
|
9
|
+
import { getLight, getIsRtl } from '../utils';
|
|
10
10
|
import Flags from './flags';
|
|
11
|
+
import SideIcon from './sideIcon';
|
|
11
12
|
|
|
12
13
|
var useStyles = makeStyles(function (theme) {
|
|
13
14
|
return {
|
|
@@ -18,7 +19,9 @@ var useStyles = makeStyles(function (theme) {
|
|
|
18
19
|
borderRight: '1px solid ' + theme.palette.grey[500],
|
|
19
20
|
padding: theme.spacing(0.5) + 'px ' + theme.spacing(1) + 'px',
|
|
20
21
|
color: theme.palette.grey['A700'],
|
|
21
|
-
verticalAlign: 'middle'
|
|
22
|
+
verticalAlign: 'middle',
|
|
23
|
+
position: 'sticky',
|
|
24
|
+
zIndex: 1
|
|
22
25
|
},
|
|
23
26
|
fillerCell: {
|
|
24
27
|
backgroundColor: theme.palette.grey[200],
|
|
@@ -48,9 +51,12 @@ var SubHeader = React.forwardRef(function (_ref, refs) {
|
|
|
48
51
|
var headerData = _ref.headerData,
|
|
49
52
|
xLayoutData = _ref.xLayoutData,
|
|
50
53
|
activeCellIds = _ref.activeCellIds,
|
|
51
|
-
subHeadCellsWidth = _ref.subHeadCellsWidth
|
|
54
|
+
subHeadCellsWidth = _ref.subHeadCellsWidth,
|
|
55
|
+
sideToggle = _ref.sideToggle;
|
|
52
56
|
|
|
53
57
|
var classes = useStyles();
|
|
58
|
+
var theme = useTheme();
|
|
59
|
+
var isRtl = getIsRtl(theme);
|
|
54
60
|
return React.createElement(
|
|
55
61
|
TableRow,
|
|
56
62
|
null,
|
|
@@ -62,7 +68,7 @@ var SubHeader = React.forwardRef(function (_ref, refs) {
|
|
|
62
68
|
className: classes.columnsTitle,
|
|
63
69
|
key: index,
|
|
64
70
|
id: 'subHeader_' + index,
|
|
65
|
-
style: {
|
|
71
|
+
style: isRtl ? { right: subHeadCellsWidth[index] } : { left: subHeadCellsWidth[index] },
|
|
66
72
|
ref: function ref(element) {
|
|
67
73
|
return refs.current[index] = element;
|
|
68
74
|
}
|
|
@@ -81,7 +87,7 @@ var SubHeader = React.forwardRef(function (_ref, refs) {
|
|
|
81
87
|
}, xLayoutData),
|
|
82
88
|
React.createElement(TableCell, {
|
|
83
89
|
className: classes.fillerCell,
|
|
84
|
-
style: { position: 'sticky', left: R.last(subHeadCellsWidth) }
|
|
90
|
+
style: isRtl ? { position: 'sticky', right: R.last(subHeadCellsWidth) } : { position: 'sticky', left: R.last(subHeadCellsWidth) }
|
|
85
91
|
}),
|
|
86
92
|
mapIndexed(function (item, index) {
|
|
87
93
|
var _cx;
|
|
@@ -92,6 +98,7 @@ var SubHeader = React.forwardRef(function (_ref, refs) {
|
|
|
92
98
|
key: index,
|
|
93
99
|
className: cx(classes.fillerCell, (_cx = {}, _cx[classes.highlight] = R.prop(index)(activeCellIds), _cx))
|
|
94
100
|
},
|
|
101
|
+
React.createElement(SideIcon, { sideProps: R.prop('sideProps', item), sideToggle: sideToggle }),
|
|
95
102
|
React.createElement(Flags, { flags: R.prop('flags', item) })
|
|
96
103
|
);
|
|
97
104
|
}, headerData)
|
|
@@ -102,6 +109,7 @@ SubHeader.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
102
109
|
activeCellIds: PropTypes.object,
|
|
103
110
|
headerData: PropTypes.array,
|
|
104
111
|
xLayoutData: PropTypes.array,
|
|
112
|
+
sideToggle: PropTypes.func,
|
|
105
113
|
subHeadCellsWidth: PropTypes.arrayOf(PropTypes.number)
|
|
106
114
|
} : {};
|
|
107
115
|
|
package/es/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { default as Button } from './Button';
|
|
|
10
10
|
export { default as ChartsConfig } from './ChartsConfig';
|
|
11
11
|
export { default as Chips } from './Chips';
|
|
12
12
|
export { default as CollapseButtons } from './CollapseButtons';
|
|
13
|
+
export { default as CollapsibleTree } from './CollapsibleTree';
|
|
13
14
|
export { default as DataEdit } from './DataEdit';
|
|
14
15
|
export { default as Dataflow } from './Dataflow';
|
|
15
16
|
export { default as DataHeader } from './DataHeader';
|
package/es/theme.js
CHANGED
|
@@ -215,6 +215,19 @@ export var sisccTheme = function sisccTheme(_ref) {
|
|
|
215
215
|
fontFamily: "'Roboto Slab', serif"
|
|
216
216
|
}
|
|
217
217
|
},
|
|
218
|
+
collapsibleTree: {
|
|
219
|
+
title: {
|
|
220
|
+
fontSize: 17,
|
|
221
|
+
fontFamily: "'PT Sans Narrow', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
|
222
|
+
color: outerPalette.textLight || innerPalette.textLight
|
|
223
|
+
},
|
|
224
|
+
buttonSublevel: {
|
|
225
|
+
color: outerPalette.textLight || innerPalette.textLight,
|
|
226
|
+
fontSize: 14,
|
|
227
|
+
fontWeight: 700,
|
|
228
|
+
fontFamily: "'PT Sans Narrow', 'Helvetica Neue', Helvetica, Arial, sans-serif"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
218
231
|
dataEdit: {
|
|
219
232
|
root: {
|
|
220
233
|
fontWeight: 400,
|
package/lib/AuthDialog/index.js
CHANGED
|
@@ -12,10 +12,6 @@ var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
|
12
12
|
|
|
13
13
|
var _ramda = require('ramda');
|
|
14
14
|
|
|
15
|
-
var _Button = require('../Button');
|
|
16
|
-
|
|
17
|
-
var _Button2 = _interopRequireDefault(_Button);
|
|
18
|
-
|
|
19
15
|
var _Checkbox = require('@material-ui/core/Checkbox');
|
|
20
16
|
|
|
21
17
|
var _Checkbox2 = _interopRequireDefault(_Checkbox);
|
|
@@ -46,6 +42,10 @@ var _Typography2 = _interopRequireDefault(_Typography);
|
|
|
46
42
|
|
|
47
43
|
var _styles = require('@material-ui/core/styles');
|
|
48
44
|
|
|
45
|
+
var _Button = require('../Button');
|
|
46
|
+
|
|
47
|
+
var _Button2 = _interopRequireDefault(_Button);
|
|
48
|
+
|
|
49
49
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
50
50
|
|
|
51
51
|
/**
|
|
@@ -69,9 +69,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
69
69
|
* onClose: PropTypes.func.isRequired,
|
|
70
70
|
* onSubmit: PropTypes.func.isRequired
|
|
71
71
|
* };
|
|
72
|
+
* @demoReady
|
|
72
73
|
*/
|
|
73
74
|
|
|
74
|
-
var useStyles = (0, _styles.makeStyles)(function (
|
|
75
|
+
var useStyles = (0, _styles.makeStyles)(function () {
|
|
75
76
|
return {
|
|
76
77
|
header: {
|
|
77
78
|
color: 'grey',
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.VARIANT_BOLD = undefined;
|
|
5
|
+
|
|
6
|
+
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; };
|
|
7
|
+
|
|
8
|
+
var _react = require('react');
|
|
9
|
+
|
|
10
|
+
var _react2 = _interopRequireDefault(_react);
|
|
11
|
+
|
|
12
|
+
var _propTypes = require('prop-types');
|
|
13
|
+
|
|
14
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
15
|
+
|
|
16
|
+
var _classnames = require('classnames');
|
|
17
|
+
|
|
18
|
+
var _classnames2 = _interopRequireDefault(_classnames);
|
|
19
|
+
|
|
20
|
+
var _ramda = require('ramda');
|
|
21
|
+
|
|
22
|
+
var _styles = require('@material-ui/core/styles');
|
|
23
|
+
|
|
24
|
+
var _Collapse = require('@material-ui/core/Collapse');
|
|
25
|
+
|
|
26
|
+
var _Collapse2 = _interopRequireDefault(_Collapse);
|
|
27
|
+
|
|
28
|
+
var _Button = require('@material-ui/core/Button');
|
|
29
|
+
|
|
30
|
+
var _Button2 = _interopRequireDefault(_Button);
|
|
31
|
+
|
|
32
|
+
var _KeyboardArrowDown = require('@material-ui/icons/KeyboardArrowDown');
|
|
33
|
+
|
|
34
|
+
var _KeyboardArrowDown2 = _interopRequireDefault(_KeyboardArrowDown);
|
|
35
|
+
|
|
36
|
+
var _KeyboardArrowUp = require('@material-ui/icons/KeyboardArrowUp');
|
|
37
|
+
|
|
38
|
+
var _KeyboardArrowUp2 = _interopRequireDefault(_KeyboardArrowUp);
|
|
39
|
+
|
|
40
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
+
|
|
42
|
+
var VARIANT_ICON = 'icon';
|
|
43
|
+
var VARIANT_BOLD = exports.VARIANT_BOLD = 'bold';
|
|
44
|
+
|
|
45
|
+
var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
46
|
+
var _ref;
|
|
47
|
+
|
|
48
|
+
return _ref = {
|
|
49
|
+
buttonExpand: {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
justifyContent: 'space-between'
|
|
52
|
+
}
|
|
53
|
+
}, _ref['button' + VARIANT_ICON] = {
|
|
54
|
+
color: theme.palette.primary.main,
|
|
55
|
+
backgroundColor: 'rgba(24, 32, 38, 0.04)',
|
|
56
|
+
margin: theme.spacing(1, 0)
|
|
57
|
+
}, _ref['button' + VARIANT_BOLD] = _extends({
|
|
58
|
+
marginBottom: theme.spacing(1),
|
|
59
|
+
padding: theme.spacing(0.5, 0, 1, 0),
|
|
60
|
+
'&:hover': {
|
|
61
|
+
backgroundColor: 'unset'
|
|
62
|
+
}
|
|
63
|
+
}, (0, _ramda.pathOr)({}, ['mixins', 'collapsibleTree', 'buttonSublevel'], theme)), _ref['collapsibleContainer' + VARIANT_BOLD] = {
|
|
64
|
+
borderTop: '2px solid black',
|
|
65
|
+
marginTop: theme.spacing(2),
|
|
66
|
+
marginBottom: theme.spacing(2)
|
|
67
|
+
}, _ref;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
var CollapseComponent = function CollapseComponent(_ref2) {
|
|
71
|
+
var label = _ref2.label,
|
|
72
|
+
isOpen = _ref2.isOpen,
|
|
73
|
+
children = _ref2.children,
|
|
74
|
+
_ref2$variant = _ref2.variant,
|
|
75
|
+
variant = _ref2$variant === undefined ? VARIANT_ICON : _ref2$variant,
|
|
76
|
+
level = _ref2.level;
|
|
77
|
+
|
|
78
|
+
var classes = useStyles();
|
|
79
|
+
var theme = (0, _styles.useTheme)();
|
|
80
|
+
|
|
81
|
+
var _React$useState = _react2.default.useState(isOpen),
|
|
82
|
+
open = _React$useState[0],
|
|
83
|
+
setOpen = _React$useState[1];
|
|
84
|
+
|
|
85
|
+
(0, _react.useEffect)(function () {
|
|
86
|
+
return setOpen(isOpen);
|
|
87
|
+
}, [isOpen]);
|
|
88
|
+
|
|
89
|
+
return _react2.default.createElement(
|
|
90
|
+
'div',
|
|
91
|
+
{
|
|
92
|
+
className: (0, _classnames2.default)(classes['collapsibleContainer' + variant]),
|
|
93
|
+
style: {
|
|
94
|
+
marginRight: theme.spacing(level * 2),
|
|
95
|
+
marginLeft: theme.spacing(level * 2)
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
_react2.default.createElement(
|
|
99
|
+
_Button2.default,
|
|
100
|
+
{
|
|
101
|
+
className: (0, _classnames2.default)(classes.buttonExpand, classes['button' + variant]),
|
|
102
|
+
onClick: function onClick() {
|
|
103
|
+
return setOpen(!open);
|
|
104
|
+
},
|
|
105
|
+
fullWidth: true
|
|
106
|
+
},
|
|
107
|
+
label,
|
|
108
|
+
open ? _react2.default.createElement(_KeyboardArrowUp2.default, { color: 'primary' }) : _react2.default.createElement(_KeyboardArrowDown2.default, { color: 'primary' })
|
|
109
|
+
),
|
|
110
|
+
_react2.default.createElement(
|
|
111
|
+
_Collapse2.default,
|
|
112
|
+
{ 'in': open, timeout: 'auto' },
|
|
113
|
+
children
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
CollapseComponent.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
119
|
+
label: _propTypes2.default.string,
|
|
120
|
+
isOpen: _propTypes2.default.bool,
|
|
121
|
+
children: _propTypes2.default.node,
|
|
122
|
+
variant: _propTypes2.default.oneOf([VARIANT_ICON, VARIANT_BOLD]),
|
|
123
|
+
level: _propTypes2.default.number
|
|
124
|
+
} : {};
|
|
125
|
+
|
|
126
|
+
exports.default = CollapseComponent;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
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; };
|
|
6
|
+
|
|
7
|
+
var _react = require('react');
|
|
8
|
+
|
|
9
|
+
var _react2 = _interopRequireDefault(_react);
|
|
10
|
+
|
|
11
|
+
var _ramda = require('ramda');
|
|
12
|
+
|
|
13
|
+
var R = _interopRequireWildcard(_ramda);
|
|
14
|
+
|
|
15
|
+
var _propTypes = require('prop-types');
|
|
16
|
+
|
|
17
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
18
|
+
|
|
19
|
+
var _Container = require('@material-ui/core/Container');
|
|
20
|
+
|
|
21
|
+
var _Container2 = _interopRequireDefault(_Container);
|
|
22
|
+
|
|
23
|
+
var _styles = require('@material-ui/core/styles');
|
|
24
|
+
|
|
25
|
+
var _Typography = require('@material-ui/core/Typography');
|
|
26
|
+
|
|
27
|
+
var _Typography2 = _interopRequireDefault(_Typography);
|
|
28
|
+
|
|
29
|
+
var _Divider = require('@material-ui/core/Divider');
|
|
30
|
+
|
|
31
|
+
var _Divider2 = _interopRequireDefault(_Divider);
|
|
32
|
+
|
|
33
|
+
var _Button = require('@material-ui/core/Button');
|
|
34
|
+
|
|
35
|
+
var _Button2 = _interopRequireDefault(_Button);
|
|
36
|
+
|
|
37
|
+
var _KeyboardArrowDown = require('@material-ui/icons/KeyboardArrowDown');
|
|
38
|
+
|
|
39
|
+
var _KeyboardArrowDown2 = _interopRequireDefault(_KeyboardArrowDown);
|
|
40
|
+
|
|
41
|
+
var _KeyboardArrowUp = require('@material-ui/icons/KeyboardArrowUp');
|
|
42
|
+
|
|
43
|
+
var _KeyboardArrowUp2 = _interopRequireDefault(_KeyboardArrowUp);
|
|
44
|
+
|
|
45
|
+
var _CircularProgress = require('@material-ui/core/CircularProgress');
|
|
46
|
+
|
|
47
|
+
var _CircularProgress2 = _interopRequireDefault(_CircularProgress);
|
|
48
|
+
|
|
49
|
+
var _Grid = require('@material-ui/core/Grid');
|
|
50
|
+
|
|
51
|
+
var _Grid2 = _interopRequireDefault(_Grid);
|
|
52
|
+
|
|
53
|
+
var _Collapse = require('./Collapse');
|
|
54
|
+
|
|
55
|
+
var _Collapse2 = _interopRequireDefault(_Collapse);
|
|
56
|
+
|
|
57
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
58
|
+
|
|
59
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
60
|
+
|
|
61
|
+
var useStyles = (0, _styles.makeStyles)(function (theme) {
|
|
62
|
+
return {
|
|
63
|
+
title: _extends({
|
|
64
|
+
fontWeight: 'bold'
|
|
65
|
+
}, R.pathOr({}, ['mixins', 'collapsibleTree', 'title'], theme)),
|
|
66
|
+
divider: {
|
|
67
|
+
marginBottom: theme.spacing(2)
|
|
68
|
+
},
|
|
69
|
+
spacingValue: {
|
|
70
|
+
marginLeft: theme.spacing(2),
|
|
71
|
+
marginRight: theme.spacing(2),
|
|
72
|
+
marginBottom: theme.spacing(2)
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
var CollapsibleTree = function CollapsibleTree(_ref) {
|
|
78
|
+
var _ref$data = _ref.data,
|
|
79
|
+
data = _ref$data === undefined ? [] : _ref$data,
|
|
80
|
+
_ref$defaultDepthLeve = _ref.defaultDepthLevel,
|
|
81
|
+
defaultDepthLevel = _ref$defaultDepthLeve === undefined ? 1 : _ref$defaultDepthLeve,
|
|
82
|
+
isLoading = _ref.isLoading,
|
|
83
|
+
children = _ref.children,
|
|
84
|
+
labels = _ref.labels,
|
|
85
|
+
_ref$testId = _ref.testId,
|
|
86
|
+
testId = _ref$testId === undefined ? 'collapsible-tree' : _ref$testId;
|
|
87
|
+
|
|
88
|
+
var classes = useStyles();
|
|
89
|
+
|
|
90
|
+
var _useState = (0, _react.useState)(defaultDepthLevel),
|
|
91
|
+
depthLevel = _useState[0],
|
|
92
|
+
setDepthLevel = _useState[1];
|
|
93
|
+
|
|
94
|
+
(0, _react.useEffect)(function () {
|
|
95
|
+
return setDepthLevel(defaultDepthLevel);
|
|
96
|
+
}, [defaultDepthLevel]);
|
|
97
|
+
|
|
98
|
+
if (isLoading) {
|
|
99
|
+
return _react2.default.createElement(
|
|
100
|
+
_Grid2.default,
|
|
101
|
+
{ container: true, item: true, justifyContent: 'center' },
|
|
102
|
+
_react2.default.createElement(_CircularProgress2.default, null)
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
var handleCollapse = function handleCollapse(isAllOpen) {
|
|
107
|
+
if (isAllOpen) return setDepthLevel(undefined);
|
|
108
|
+
return setDepthLevel(defaultDepthLevel);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
var isAllOpen = depthLevel >= defaultDepthLevel;
|
|
112
|
+
var buttonAllOpenLabel = isAllOpen ? R.prop('collapseAll', labels) : R.prop('expandAll', labels);
|
|
113
|
+
|
|
114
|
+
return _react2.default.createElement(
|
|
115
|
+
_react.Fragment,
|
|
116
|
+
null,
|
|
117
|
+
_react2.default.createElement(
|
|
118
|
+
_Container2.default,
|
|
119
|
+
{ disableGutters: true, 'data-testid': testId },
|
|
120
|
+
_react2.default.createElement(
|
|
121
|
+
_Button2.default,
|
|
122
|
+
{
|
|
123
|
+
'aria-label': buttonAllOpenLabel,
|
|
124
|
+
color: 'primary',
|
|
125
|
+
endIcon: isAllOpen ? _react2.default.createElement(_KeyboardArrowDown2.default, { color: 'primary' }) : _react2.default.createElement(_KeyboardArrowUp2.default, { color: 'primary' }),
|
|
126
|
+
onClick: function onClick() {
|
|
127
|
+
return handleCollapse(isAllOpen);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
buttonAllOpenLabel
|
|
131
|
+
),
|
|
132
|
+
children
|
|
133
|
+
),
|
|
134
|
+
R.map(function (_ref2) {
|
|
135
|
+
var id = _ref2.id,
|
|
136
|
+
label = _ref2.label,
|
|
137
|
+
_ref2$children = _ref2.children,
|
|
138
|
+
children = _ref2$children === undefined ? [] : _ref2$children;
|
|
139
|
+
|
|
140
|
+
return _react2.default.createElement(
|
|
141
|
+
_react.Fragment,
|
|
142
|
+
{ key: id },
|
|
143
|
+
_react2.default.createElement(_Divider2.default, { className: classes.divider }),
|
|
144
|
+
_react2.default.createElement(
|
|
145
|
+
_Typography2.default,
|
|
146
|
+
{ variant: 'h5', className: classes.title },
|
|
147
|
+
label
|
|
148
|
+
),
|
|
149
|
+
R.map(function (_ref3) {
|
|
150
|
+
var id = _ref3.id,
|
|
151
|
+
label = _ref3.label,
|
|
152
|
+
children = _ref3.children,
|
|
153
|
+
value = _ref3.value;
|
|
154
|
+
|
|
155
|
+
return _react2.default.createElement(
|
|
156
|
+
_Collapse2.default,
|
|
157
|
+
{ key: id, level: 0, label: label, isOpen: depthLevel >= 0 },
|
|
158
|
+
value && _react2.default.createElement(
|
|
159
|
+
_Typography2.default,
|
|
160
|
+
{ className: classes.spacingValue, variant: 'body2' },
|
|
161
|
+
value
|
|
162
|
+
),
|
|
163
|
+
children && R.map(function (_ref4) {
|
|
164
|
+
var id = _ref4.id,
|
|
165
|
+
label = _ref4.label,
|
|
166
|
+
value = _ref4.value;
|
|
167
|
+
|
|
168
|
+
return _react2.default.createElement(
|
|
169
|
+
_Collapse2.default,
|
|
170
|
+
{
|
|
171
|
+
key: id,
|
|
172
|
+
level: 1,
|
|
173
|
+
variant: _Collapse.VARIANT_BOLD,
|
|
174
|
+
label: label,
|
|
175
|
+
isOpen: depthLevel >= 1
|
|
176
|
+
},
|
|
177
|
+
_react2.default.createElement(
|
|
178
|
+
_Typography2.default,
|
|
179
|
+
{ variant: 'body2' },
|
|
180
|
+
value
|
|
181
|
+
)
|
|
182
|
+
);
|
|
183
|
+
}, children)
|
|
184
|
+
);
|
|
185
|
+
}, children)
|
|
186
|
+
);
|
|
187
|
+
}, data)
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
CollapsibleTree.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
192
|
+
data: _propTypes2.default.arrayOf(_propTypes2.default.shape({
|
|
193
|
+
id: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]).isRequired,
|
|
194
|
+
label: _propTypes2.default.string,
|
|
195
|
+
children: _propTypes2.default.arrayOf(_propTypes2.default.shape({
|
|
196
|
+
id: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]).isRequired,
|
|
197
|
+
label: _propTypes2.default.string,
|
|
198
|
+
children: _propTypes2.default.arrayOf(_propTypes2.default.shape({
|
|
199
|
+
id: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]).isRequired,
|
|
200
|
+
label: _propTypes2.default.string,
|
|
201
|
+
value: _propTypes2.default.string
|
|
202
|
+
}))
|
|
203
|
+
}))
|
|
204
|
+
})),
|
|
205
|
+
defaultDepthLevel: _propTypes2.default.number,
|
|
206
|
+
isLoading: _propTypes2.default.bool,
|
|
207
|
+
children: _propTypes2.default.node,
|
|
208
|
+
labels: _propTypes2.default.shape({
|
|
209
|
+
collapseAll: _propTypes2.default.string,
|
|
210
|
+
expandAll: _propTypes2.default.string
|
|
211
|
+
}),
|
|
212
|
+
testId: _propTypes2.default.string
|
|
213
|
+
} : {};
|
|
214
|
+
|
|
215
|
+
exports.default = CollapsibleTree;
|
|
216
|
+
module.exports = exports['default'];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
var _CollapsibleTree = require('./CollapsibleTree');
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, 'default', {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _interopRequireDefault(_CollapsibleTree).default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
module.exports = exports['default'];
|