@sis-cc/dotstatsuite-visions 7.22.7 → 8.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.
- package/es/DataHeader/DataHeader.js +37 -9
- package/es/Mode/Mode.js +89 -0
- package/es/Mode/index.js +24 -0
- package/es/TableHtml5/TableHtml5.js +22 -15
- package/es/TableHtml5/cell.js +5 -3
- package/es/TableHtml5/flags.js +14 -10
- package/es/TableHtml5/header.js +14 -10
- package/es/TableHtml5/section.js +15 -9
- package/es/TableHtml5/sectionHeader.js +15 -6
- package/es/TableHtml5/subHeader.js +7 -4
- package/es/TableHtml5/utils.js +22 -0
- package/es/index.js +1 -0
- package/lib/DataHeader/DataHeader.js +37 -9
- package/lib/Mode/Mode.js +117 -0
- package/lib/Mode/index.js +16 -0
- package/lib/TableHtml5/TableHtml5.js +22 -15
- package/lib/TableHtml5/cell.js +5 -3
- package/lib/TableHtml5/flags.js +15 -10
- package/lib/TableHtml5/header.js +15 -10
- package/lib/TableHtml5/section.js +16 -9
- package/lib/TableHtml5/sectionHeader.js +16 -6
- package/lib/TableHtml5/subHeader.js +7 -4
- package/lib/TableHtml5/utils.js +31 -0
- package/lib/index.js +10 -1
- package/package.json +1 -1
|
@@ -113,7 +113,7 @@ var DataHeader = function DataHeader(_ref5) {
|
|
|
113
113
|
title = _ref5.title,
|
|
114
114
|
_ref5$subtitle = _ref5.subtitle,
|
|
115
115
|
subtitle = _ref5$subtitle === undefined ? [] : _ref5$subtitle,
|
|
116
|
-
|
|
116
|
+
combinations = _ref5.combinations,
|
|
117
117
|
disclaimer = _ref5.disclaimer,
|
|
118
118
|
sideProps = _ref5.sideProps,
|
|
119
119
|
SideIcon = _ref5.SideIcon,
|
|
@@ -129,12 +129,19 @@ var DataHeader = function DataHeader(_ref5) {
|
|
|
129
129
|
var isWidthLess = R.lt(width);
|
|
130
130
|
var classes = useStyles({ isWidthLess: isWidthLess });
|
|
131
131
|
|
|
132
|
-
var reducedContent = getReducedContent({
|
|
132
|
+
var reducedContent = getReducedContent({
|
|
133
|
+
isWidthLess: isWidthLess,
|
|
134
|
+
title: title,
|
|
135
|
+
subtitle: subtitle,
|
|
136
|
+
combinations: combinations,
|
|
137
|
+
disclaimer: disclaimer
|
|
138
|
+
});
|
|
133
139
|
|
|
134
140
|
var theme = useTheme();
|
|
135
141
|
var iconColor = R.path(['mixins', 'dataHeader', 'icon', 'color'], theme);
|
|
136
142
|
|
|
137
143
|
var subtitleLength = R.length(subtitle);
|
|
144
|
+
var combinationsLength = R.length(combinations);
|
|
138
145
|
|
|
139
146
|
return React.createElement(
|
|
140
147
|
'div',
|
|
@@ -185,11 +192,32 @@ var DataHeader = function DataHeader(_ref5) {
|
|
|
185
192
|
);
|
|
186
193
|
}))(subtitle)
|
|
187
194
|
),
|
|
188
|
-
isWidthUp(T4_BREAKPOINTS.xs3) &&
|
|
189
|
-
|
|
190
|
-
{ className: classes.
|
|
191
|
-
|
|
192
|
-
|
|
195
|
+
isWidthUp(T4_BREAKPOINTS.xs3) && combinations && R.not(R.isEmpty(combinations)) && React.createElement(
|
|
196
|
+
'div',
|
|
197
|
+
{ className: classes.wrapperSubtitle },
|
|
198
|
+
R.pipe(R.addIndex(R.map)(function (comb, index) {
|
|
199
|
+
return React.createElement(
|
|
200
|
+
'div',
|
|
201
|
+
{
|
|
202
|
+
key: 'combination-' + index,
|
|
203
|
+
className: classes.subtitle,
|
|
204
|
+
'data-testid': 'data-header-combination',
|
|
205
|
+
'aria-label': comb.header
|
|
206
|
+
},
|
|
207
|
+
React.createElement(Title, { header: comb.header }),
|
|
208
|
+
React.createElement(
|
|
209
|
+
Typography,
|
|
210
|
+
{ variant: 'inherit' },
|
|
211
|
+
comb.label
|
|
212
|
+
),
|
|
213
|
+
R.not(R.isEmpty(R.propOr([], 'flags', comb))) && React.createElement(Flags, { classes: classes, content: R.prop('flags', comb) }),
|
|
214
|
+
R.lt(index + 1, combinationsLength) && React.createElement(
|
|
215
|
+
'svg',
|
|
216
|
+
{ width: '24', height: '8' },
|
|
217
|
+
React.createElement('circle', { cx: '12', cy: '4', r: '3', stroke: iconColor, fill: iconColor })
|
|
218
|
+
)
|
|
219
|
+
);
|
|
220
|
+
}))(combinations)
|
|
193
221
|
),
|
|
194
222
|
isWidthUp(T4_BREAKPOINTS.xs3) && disclaimer && React.createElement(
|
|
195
223
|
Typography,
|
|
@@ -232,10 +260,10 @@ DataHeader.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
232
260
|
}))
|
|
233
261
|
}))
|
|
234
262
|
})),
|
|
235
|
-
|
|
263
|
+
combinations: PropTypes.arrayOf(PropTypes.shape({
|
|
236
264
|
header: PropTypes.string,
|
|
237
265
|
label: PropTypes.string
|
|
238
|
-
}),
|
|
266
|
+
})),
|
|
239
267
|
sideProps: PropTypes.object,
|
|
240
268
|
SideIcon: PropTypes.func,
|
|
241
269
|
disclaimer: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
package/es/Mode/Mode.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
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 from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import * as R from 'ramda';
|
|
6
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
7
|
+
import RadioGroup from '@material-ui/core/RadioGroup';
|
|
8
|
+
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
|
9
|
+
import Radio from '@material-ui/core/Radio';
|
|
10
|
+
import { Tooltip } from '../';
|
|
11
|
+
|
|
12
|
+
var useStyles = makeStyles(function (theme) {
|
|
13
|
+
return {
|
|
14
|
+
title: _extends({
|
|
15
|
+
padding: 0
|
|
16
|
+
}, R.pathOr({}, ['mixins', 'share', 'title'], theme)),
|
|
17
|
+
label: theme.typography.body2,
|
|
18
|
+
icon: {
|
|
19
|
+
marginLeft: theme.spacing(0.5)
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
var Warning = function Warning(_ref) {
|
|
25
|
+
var title = _ref.title,
|
|
26
|
+
children = _ref.children;
|
|
27
|
+
|
|
28
|
+
var classes = useStyles();
|
|
29
|
+
return React.createElement(
|
|
30
|
+
Tooltip,
|
|
31
|
+
{ className: classes.icon, title: title, variant: 'light' },
|
|
32
|
+
children
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
Warning.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
37
|
+
title: PropTypes.string,
|
|
38
|
+
children: PropTypes.node
|
|
39
|
+
} : {};
|
|
40
|
+
|
|
41
|
+
var Mode = function Mode(_ref2) {
|
|
42
|
+
var changeMode = _ref2.changeMode,
|
|
43
|
+
mode = _ref2.mode,
|
|
44
|
+
_ref2$modes = _ref2.modes,
|
|
45
|
+
modes = _ref2$modes === undefined ? [] : _ref2$modes,
|
|
46
|
+
children = _ref2.children;
|
|
47
|
+
|
|
48
|
+
var classes = useStyles();
|
|
49
|
+
return React.createElement(
|
|
50
|
+
RadioGroup,
|
|
51
|
+
{ onChange: function onChange(e) {
|
|
52
|
+
return changeMode(e.target.value);
|
|
53
|
+
}, value: mode },
|
|
54
|
+
R.map(function (_ref3) {
|
|
55
|
+
var label = _ref3.label,
|
|
56
|
+
value = _ref3.value,
|
|
57
|
+
popperLabel = _ref3.popperLabel;
|
|
58
|
+
return React.createElement(FormControlLabel, {
|
|
59
|
+
classes: { label: classes.label },
|
|
60
|
+
key: value,
|
|
61
|
+
control: React.createElement(Radio, { variant: 'outlined', color: 'primary' }),
|
|
62
|
+
label: React.createElement(
|
|
63
|
+
'span',
|
|
64
|
+
null,
|
|
65
|
+
label,
|
|
66
|
+
popperLabel && React.createElement(
|
|
67
|
+
Warning,
|
|
68
|
+
{ title: popperLabel },
|
|
69
|
+
children
|
|
70
|
+
)
|
|
71
|
+
),
|
|
72
|
+
value: value
|
|
73
|
+
});
|
|
74
|
+
})(modes)
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
Mode.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
79
|
+
changeMode: PropTypes.func,
|
|
80
|
+
children: PropTypes.node,
|
|
81
|
+
mode: PropTypes.string,
|
|
82
|
+
modes: PropTypes.arrayOf(PropTypes.shape({
|
|
83
|
+
label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
84
|
+
value: PropTypes.string,
|
|
85
|
+
popperLabel: PropTypes.string
|
|
86
|
+
}))
|
|
87
|
+
} : {};
|
|
88
|
+
|
|
89
|
+
export default Mode;
|
package/es/Mode/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NoData component is a basic placeholder to use when there is nothing to display.
|
|
3
|
+
*
|
|
4
|
+
* @memberOf VISIONS
|
|
5
|
+
* @name Mode
|
|
6
|
+
* @tag component
|
|
7
|
+
* @api public
|
|
8
|
+
* @props
|
|
9
|
+
* Mode.propTypes = {
|
|
10
|
+
* changeMode: PropTypes.func,
|
|
11
|
+
* mode: PropTypes.string,
|
|
12
|
+
* modes: PropTypes.arrayOf(
|
|
13
|
+
* PropTypes.shape({
|
|
14
|
+
* label: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
|
|
15
|
+
* value: PropTypes.string,
|
|
16
|
+
* popperLabel: PropTypes.string,
|
|
17
|
+
* }),
|
|
18
|
+
* ,
|
|
19
|
+
* }
|
|
20
|
+
* @theme
|
|
21
|
+
* // no custom theme there
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
export { default } from './Mode';
|
|
@@ -10,13 +10,13 @@ import SubHeader from './subHeader';
|
|
|
10
10
|
import Section from './section';
|
|
11
11
|
import Cell from './cell';
|
|
12
12
|
|
|
13
|
-
/*
|
|
14
|
-
* Accessibility.
|
|
15
|
-
* Do not use "TableHead" from Material-ui.
|
|
16
|
-
* Material-ui, add "scope" attribute for accessibility, "scope" attribute can break screen reader if use with headers.
|
|
17
|
-
* Child from TableHead will inherit a "scope" that we don't want. (not possible to turn off)
|
|
18
|
-
* We are using "headers" attribute because the table is too complexe to use "scope".
|
|
19
|
-
*/
|
|
13
|
+
/*
|
|
14
|
+
* Accessibility.
|
|
15
|
+
* Do not use "TableHead" from Material-ui.
|
|
16
|
+
* Material-ui, add "scope" attribute for accessibility, "scope" attribute can break screen reader if use with headers.
|
|
17
|
+
* Child from TableHead will inherit a "scope" that we don't want. (not possible to turn off)
|
|
18
|
+
* We are using "headers" attribute because the table is too complexe to use "scope".
|
|
19
|
+
*/
|
|
20
20
|
|
|
21
21
|
var useStyles = makeStyles(function (theme) {
|
|
22
22
|
return {
|
|
@@ -41,7 +41,7 @@ export var getEnhancedValuesHeaderData = function getEnhancedValuesHeaderData(da
|
|
|
41
41
|
// mix merge and transpose for performance
|
|
42
42
|
R.reduce(function (acc, cells) {
|
|
43
43
|
R.addIndex(R.forEach)(function (cell, rowIndex) {
|
|
44
|
-
var cellId = R.path(['value', 'id'], cell);
|
|
44
|
+
var cellId = R.has('values', cell) ? R.pipe(R.prop('values'), R.pluck('id'), R.join(','))(cell) : R.path(['value', 'id'], cell);
|
|
45
45
|
var topCell = rowIndex > 0 ? R.pipe(R.nth(rowIndex - 1), R.last)(acc) : null;
|
|
46
46
|
var cellKey = R.isNil(topCell) ? cellId : topCell.key + '-' + cellId;
|
|
47
47
|
|
|
@@ -49,7 +49,7 @@ export var getEnhancedValuesHeaderData = function getEnhancedValuesHeaderData(da
|
|
|
49
49
|
if (R.prop('key', leftCell) === cellKey && rowIndex !== colLength - 1) {
|
|
50
50
|
acc = R.over(R.lensIndex(rowIndex), R.over(R.lensIndex(-1), R.evolve({ spanCount: R.add(1) })))(acc);
|
|
51
51
|
} else {
|
|
52
|
-
acc = R.over(R.lensIndex(rowIndex), R.append(_extends({}, R.
|
|
52
|
+
acc = R.over(R.lensIndex(rowIndex), R.append(_extends({}, R.pick(['value', 'values'], cell), { key: cellKey, spanCount: 1 })))(acc);
|
|
53
53
|
}
|
|
54
54
|
})(cells);
|
|
55
55
|
return acc;
|
|
@@ -72,7 +72,9 @@ var TableHtml5 = function TableHtml5(_ref) {
|
|
|
72
72
|
SideIcon = _ref.SideIcon,
|
|
73
73
|
_ref$testId = _ref.testId,
|
|
74
74
|
testId = _ref$testId === undefined ? 'vis-table' : _ref$testId,
|
|
75
|
-
HTMLRenderer = _ref.HTMLRenderer
|
|
75
|
+
HTMLRenderer = _ref.HTMLRenderer,
|
|
76
|
+
_ref$labelAccessor = _ref.labelAccessor,
|
|
77
|
+
labelAccessor = _ref$labelAccessor === undefined ? R.prop('name') : _ref$labelAccessor;
|
|
76
78
|
|
|
77
79
|
var classes = useStyles();
|
|
78
80
|
|
|
@@ -109,7 +111,8 @@ var TableHtml5 = function TableHtml5(_ref) {
|
|
|
109
111
|
|
|
110
112
|
var isSingleObs = R.hasPath(['', '', '', 0], cells);
|
|
111
113
|
if (isSingleObs) return React.createElement(Cell, _extends({
|
|
112
|
-
HTMLRenderer: HTMLRenderer
|
|
114
|
+
HTMLRenderer: HTMLRenderer,
|
|
115
|
+
labelAccessor: labelAccessor
|
|
113
116
|
}, R.pathOr({}, ['', '', '', 0], cells), {
|
|
114
117
|
cellHandler: cellHandler,
|
|
115
118
|
isOne: true
|
|
@@ -136,7 +139,8 @@ var TableHtml5 = function TableHtml5(_ref) {
|
|
|
136
139
|
valuesHeaderData: valuesHeaderData,
|
|
137
140
|
xLayoutDataLength: xLayoutDataLength,
|
|
138
141
|
subHeadCellsWidth: subHeadCellsWidth,
|
|
139
|
-
HTMLRenderer: HTMLRenderer
|
|
142
|
+
HTMLRenderer: HTMLRenderer,
|
|
143
|
+
labelAccessor: labelAccessor
|
|
140
144
|
}),
|
|
141
145
|
React.createElement(SubHeader, {
|
|
142
146
|
headerData: headerData,
|
|
@@ -145,7 +149,8 @@ var TableHtml5 = function TableHtml5(_ref) {
|
|
|
145
149
|
SideIcon: SideIcon,
|
|
146
150
|
ref: subHeadCellsRef,
|
|
147
151
|
subHeadCellsWidth: subHeadCellsWidth,
|
|
148
|
-
HTMLRenderer: HTMLRenderer
|
|
152
|
+
HTMLRenderer: HTMLRenderer,
|
|
153
|
+
labelAccessor: labelAccessor
|
|
149
154
|
})
|
|
150
155
|
),
|
|
151
156
|
mapIndexed(function (section, index) {
|
|
@@ -163,7 +168,8 @@ var TableHtml5 = function TableHtml5(_ref) {
|
|
|
163
168
|
activeCellHandler: activeCellHandler,
|
|
164
169
|
SideIcon: SideIcon,
|
|
165
170
|
subHeadCellsWidth: subHeadCellsWidth,
|
|
166
|
-
HTMLRenderer: HTMLRenderer
|
|
171
|
+
HTMLRenderer: HTMLRenderer,
|
|
172
|
+
labelAccessor: labelAccessor
|
|
167
173
|
});
|
|
168
174
|
}, sectionsData)
|
|
169
175
|
);
|
|
@@ -178,7 +184,8 @@ TableHtml5.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
178
184
|
activeCellIds: PropTypes.object,
|
|
179
185
|
SideIcon: PropTypes.func,
|
|
180
186
|
testId: PropTypes.string,
|
|
181
|
-
HTMLRenderer: PropTypes.func
|
|
187
|
+
HTMLRenderer: PropTypes.func,
|
|
188
|
+
labelAccessor: PropTypes.func
|
|
182
189
|
} : {};
|
|
183
190
|
|
|
184
191
|
export default TableHtml5;
|
package/es/TableHtml5/cell.js
CHANGED
|
@@ -62,7 +62,8 @@ var Cell = function Cell(_ref) {
|
|
|
62
62
|
isHighlight = _ref.isHighlight,
|
|
63
63
|
sideProps = _ref.sideProps,
|
|
64
64
|
SideIcon = _ref.SideIcon,
|
|
65
|
-
HTMLRenderer = _ref.HTMLRenderer
|
|
65
|
+
HTMLRenderer = _ref.HTMLRenderer,
|
|
66
|
+
labelAccessor = _ref.labelAccessor;
|
|
66
67
|
|
|
67
68
|
var classes = useStyles();
|
|
68
69
|
var isRtl = getIsRtl(useTheme());
|
|
@@ -93,7 +94,7 @@ var Cell = function Cell(_ref) {
|
|
|
93
94
|
tabIndex: 0
|
|
94
95
|
},
|
|
95
96
|
!R.isNil(SideIcon) && React.createElement(SideIcon, { sideProps: sideProps, className: classes.value }),
|
|
96
|
-
hasFlag && React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags }),
|
|
97
|
+
hasFlag && React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags, labelAccessor: labelAccessor }),
|
|
97
98
|
uiValue
|
|
98
99
|
);
|
|
99
100
|
};
|
|
@@ -111,7 +112,8 @@ Cell.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
111
112
|
activeCellHandler: PropTypes.func,
|
|
112
113
|
sideProps: PropTypes.object,
|
|
113
114
|
SideIcon: PropTypes.func,
|
|
114
|
-
HTMLRenderer: PropTypes.func
|
|
115
|
+
HTMLRenderer: PropTypes.func,
|
|
116
|
+
labelAccessor: PropTypes.func
|
|
115
117
|
} : {};
|
|
116
118
|
|
|
117
119
|
export default Cell;
|
package/es/TableHtml5/flags.js
CHANGED
|
@@ -8,6 +8,7 @@ import { makeStyles } from '@material-ui/core/styles';
|
|
|
8
8
|
import Typography from '@material-ui/core/Typography';
|
|
9
9
|
import Tooltip from '@material-ui/core/Tooltip';
|
|
10
10
|
import { Asterisk } from '../';
|
|
11
|
+
import { getValue } from './utils';
|
|
11
12
|
|
|
12
13
|
var useStyles = makeStyles(function (theme) {
|
|
13
14
|
return {
|
|
@@ -45,7 +46,8 @@ var Flags = function Flags(_ref) {
|
|
|
45
46
|
var _ref$flags = _ref.flags,
|
|
46
47
|
flags = _ref$flags === undefined ? [] : _ref$flags,
|
|
47
48
|
isHeader = _ref.isHeader,
|
|
48
|
-
HTMLRenderer = _ref.HTMLRenderer
|
|
49
|
+
HTMLRenderer = _ref.HTMLRenderer,
|
|
50
|
+
labelAccessor = _ref.labelAccessor;
|
|
49
51
|
|
|
50
52
|
var classes = useStyles();
|
|
51
53
|
var noFlags = R.isNil(flags) || R.isEmpty(flags);
|
|
@@ -55,23 +57,27 @@ var Flags = function Flags(_ref) {
|
|
|
55
57
|
var codedIcons = R.pipe(R.reduce(function (acc, flag) {
|
|
56
58
|
return R.when(R.always(R.has('code', flag)), R.append(flag.code))(acc);
|
|
57
59
|
}, []), R.join(','))(flags);
|
|
60
|
+
|
|
61
|
+
var labels = R.map(function (flag) {
|
|
62
|
+
var value = getValue(labelAccessor)(flag);
|
|
63
|
+
return labelAccessor(flag) + ': ' + value.label;
|
|
64
|
+
}, flags);
|
|
58
65
|
var content = React.createElement(
|
|
59
66
|
'ul',
|
|
60
67
|
{ 'data-testid': 'cell-flags-footnotes-content', className: classes.content },
|
|
61
|
-
R.addIndex(R.map)(function (
|
|
62
|
-
var label = _ref2.label;
|
|
68
|
+
R.addIndex(R.map)(function (label, index) {
|
|
63
69
|
return React.createElement(
|
|
64
70
|
'li',
|
|
65
71
|
{ key: index },
|
|
66
72
|
R.is(Function, HTMLRenderer) ? React.createElement(HTMLRenderer, { html: label }) : label
|
|
67
73
|
);
|
|
68
|
-
},
|
|
74
|
+
}, labels)
|
|
69
75
|
);
|
|
70
76
|
return React.createElement(
|
|
71
77
|
Tooltip,
|
|
72
78
|
{
|
|
73
79
|
tabIndex: 0,
|
|
74
|
-
'aria-label': R.
|
|
80
|
+
'aria-label': R.join(', ', labels),
|
|
75
81
|
'aria-hidden': false,
|
|
76
82
|
title: content,
|
|
77
83
|
placement: 'top'
|
|
@@ -96,10 +102,7 @@ var Flags = function Flags(_ref) {
|
|
|
96
102
|
React.createElement(
|
|
97
103
|
Typography,
|
|
98
104
|
{ variant: 'srOnly' },
|
|
99
|
-
'* ' +
|
|
100
|
-
var label = _ref3.label;
|
|
101
|
-
return label;
|
|
102
|
-
}, flags)
|
|
105
|
+
'* ' + labels
|
|
103
106
|
)
|
|
104
107
|
)
|
|
105
108
|
)
|
|
@@ -109,7 +112,8 @@ var Flags = function Flags(_ref) {
|
|
|
109
112
|
Flags.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
110
113
|
flags: PropTypes.array,
|
|
111
114
|
isHeader: PropTypes.bool,
|
|
112
|
-
HTMLRenderer: PropTypes.func
|
|
115
|
+
HTMLRenderer: PropTypes.func,
|
|
116
|
+
labelAccessor: PropTypes.func
|
|
113
117
|
} : {};
|
|
114
118
|
|
|
115
119
|
export default Flags;
|
package/es/TableHtml5/header.js
CHANGED
|
@@ -8,6 +8,7 @@ import TableCell from '@material-ui/core/TableCell';
|
|
|
8
8
|
import TableRow from '@material-ui/core/TableRow';
|
|
9
9
|
import Flags from './flags';
|
|
10
10
|
import { getIsRtl } from '../utils';
|
|
11
|
+
import { getValue } from './utils';
|
|
11
12
|
|
|
12
13
|
var useStyles = makeStyles(function (theme) {
|
|
13
14
|
return {
|
|
@@ -54,7 +55,8 @@ var Header = function Header(_ref) {
|
|
|
54
55
|
valuesHeaderData = _ref.valuesHeaderData,
|
|
55
56
|
xLayoutDataLength = _ref.xLayoutDataLength,
|
|
56
57
|
subHeadCellsWidth = _ref.subHeadCellsWidth,
|
|
57
|
-
HTMLRenderer = _ref.HTMLRenderer
|
|
58
|
+
HTMLRenderer = _ref.HTMLRenderer,
|
|
59
|
+
labelAccessor = _ref.labelAccessor;
|
|
58
60
|
|
|
59
61
|
var classes = useStyles();
|
|
60
62
|
var theme = useTheme();
|
|
@@ -91,22 +93,23 @@ var Header = function Header(_ref) {
|
|
|
91
93
|
React.createElement(
|
|
92
94
|
Typography,
|
|
93
95
|
{ variant: 'body1', className: classes.cellLabelHeader },
|
|
94
|
-
R.path([0, 'data', index, 'dimension'
|
|
95
|
-
React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags, isHeader: true })
|
|
96
|
+
R.pipe(R.path([0, 'data', index, 'dimension']), labelAccessor)(headerData),
|
|
97
|
+
React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags, isHeader: true, labelAccessor: labelAccessor })
|
|
96
98
|
)
|
|
97
99
|
)
|
|
98
100
|
),
|
|
99
101
|
mapIndexed(function (headerItem, idx) {
|
|
100
102
|
var _cx;
|
|
101
103
|
|
|
102
|
-
var
|
|
103
|
-
var
|
|
104
|
+
var value = getValue(labelAccessor)(headerItem);
|
|
105
|
+
var flags = R.propOr([], 'flags', value);
|
|
106
|
+
var hierarchySpace = R.pipe(R.propOr([], 'parents'), R.length, R.times(function () {
|
|
104
107
|
return '·';
|
|
105
|
-
}))(
|
|
108
|
+
}))(value);
|
|
106
109
|
return React.createElement(
|
|
107
110
|
TableCell,
|
|
108
111
|
{
|
|
109
|
-
key: R.prop('id',
|
|
112
|
+
key: R.prop('id', value) + '-' + idx,
|
|
110
113
|
component: 'th',
|
|
111
114
|
className: cx(classes.tableHeadCell, (_cx = {}, _cx[classes.topCell] = R.not(R.isEmpty(flags)), _cx)),
|
|
112
115
|
id: idx + '_' + index,
|
|
@@ -134,8 +137,8 @@ var Header = function Header(_ref) {
|
|
|
134
137
|
},
|
|
135
138
|
variant: 'body1'
|
|
136
139
|
},
|
|
137
|
-
R.prop('label',
|
|
138
|
-
React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags, isHeader: true })
|
|
140
|
+
R.prop('label', value),
|
|
141
|
+
React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags, isHeader: true, labelAccessor: labelAccessor })
|
|
139
142
|
)
|
|
140
143
|
)
|
|
141
144
|
);
|
|
@@ -149,7 +152,8 @@ Header.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
149
152
|
valuesHeaderData: PropTypes.array,
|
|
150
153
|
xLayoutDataLength: PropTypes.number,
|
|
151
154
|
subHeadCellsWidth: PropTypes.array,
|
|
152
|
-
HTMLRenderer: PropTypes.func
|
|
155
|
+
HTMLRenderer: PropTypes.func,
|
|
156
|
+
labelAccessor: PropTypes.func
|
|
153
157
|
} : {};
|
|
154
158
|
|
|
155
159
|
export default Header;
|
package/es/TableHtml5/section.js
CHANGED
|
@@ -13,6 +13,7 @@ import { isTimePeriodDimension } from '@sis-cc/dotstatsuite-sdmxjs';
|
|
|
13
13
|
import SectionHeader from './sectionHeader';
|
|
14
14
|
import Cell from './cell';
|
|
15
15
|
import { getLight, getIsRtl } from '../utils';
|
|
16
|
+
import { getValue } from './utils';
|
|
16
17
|
import Flags from './flags';
|
|
17
18
|
|
|
18
19
|
var useStyles = makeStyles(function (theme) {
|
|
@@ -77,7 +78,8 @@ var Section = function Section(_ref) {
|
|
|
77
78
|
nbColumnsByRows = _ref.nbColumnsByRows,
|
|
78
79
|
SideIcon = _ref.SideIcon,
|
|
79
80
|
subHeadCellsWidth = _ref.subHeadCellsWidth,
|
|
80
|
-
HTMLRenderer = _ref.HTMLRenderer
|
|
81
|
+
HTMLRenderer = _ref.HTMLRenderer,
|
|
82
|
+
labelAccessor = _ref.labelAccessor;
|
|
81
83
|
|
|
82
84
|
var classes = useStyles();
|
|
83
85
|
var currentSection = R.path([0, 'key'], section);
|
|
@@ -96,7 +98,8 @@ var Section = function Section(_ref) {
|
|
|
96
98
|
xLayoutDataLength: xLayoutDataLength,
|
|
97
99
|
headerHeight: headerHeight,
|
|
98
100
|
SideIcon: SideIcon,
|
|
99
|
-
HTMLRenderer: HTMLRenderer
|
|
101
|
+
HTMLRenderer: HTMLRenderer,
|
|
102
|
+
labelAccessor: labelAccessor
|
|
100
103
|
}),
|
|
101
104
|
R.addIndex(R.map)(function (sectionbody, rowIndex) {
|
|
102
105
|
var _cx2;
|
|
@@ -111,15 +114,16 @@ var Section = function Section(_ref) {
|
|
|
111
114
|
mapIndexed(function (cell, index) {
|
|
112
115
|
var _cx;
|
|
113
116
|
|
|
114
|
-
var
|
|
117
|
+
var value = getValue(labelAccessor)(cell);
|
|
118
|
+
var flags = R.prop('flags', value);
|
|
115
119
|
var id = rowIndex + '_' + rowId + '_' + index;
|
|
116
120
|
|
|
117
121
|
// special space is used for hierarchy U+2007    
|
|
118
|
-
var hierarchySpace = R.pipe(R.
|
|
122
|
+
var hierarchySpace = R.pipe(R.propOr([], 'parents'), R.when(R.isNil, R.always([])), R.length,
|
|
119
123
|
// eslint-disable-next-line no-irregular-whitespace
|
|
120
124
|
R.times(function () {
|
|
121
125
|
return '· ';
|
|
122
|
-
}))(
|
|
126
|
+
}))(value);
|
|
123
127
|
|
|
124
128
|
return React.createElement(
|
|
125
129
|
TableCell,
|
|
@@ -142,8 +146,8 @@ var Section = function Section(_ref) {
|
|
|
142
146
|
React.createElement(
|
|
143
147
|
Typography,
|
|
144
148
|
{ variant: 'body1', tabIndex: 0 },
|
|
145
|
-
R.
|
|
146
|
-
React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: flags })
|
|
149
|
+
R.prop('label', value),
|
|
150
|
+
React.createElement(Flags, { HTMLRenderer: HTMLRenderer, labelAccessor: labelAccessor, flags: flags })
|
|
147
151
|
)
|
|
148
152
|
)
|
|
149
153
|
);
|
|
@@ -158,7 +162,7 @@ var Section = function Section(_ref) {
|
|
|
158
162
|
'div',
|
|
159
163
|
{ className: classes.flagContainer },
|
|
160
164
|
!R.isNil(SideIcon) && React.createElement(SideIcon, { sideProps: R.prop('sideProps', sectionbody) }),
|
|
161
|
-
React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: R.prop('flags', sectionbody) })
|
|
165
|
+
React.createElement(Flags, { HTMLRenderer: HTMLRenderer, labelAccessor: labelAccessor, flags: R.prop('flags', sectionbody) })
|
|
162
166
|
)
|
|
163
167
|
),
|
|
164
168
|
mapIndexed(function (item, columnIndex) {
|
|
@@ -174,6 +178,7 @@ var Section = function Section(_ref) {
|
|
|
174
178
|
headers: rowIds + ' ' + columnIds + ' ' + currentSection,
|
|
175
179
|
cellHandler: cellHandler,
|
|
176
180
|
HTMLRenderer: HTMLRenderer,
|
|
181
|
+
labelAccessor: labelAccessor,
|
|
177
182
|
SideIcon: SideIcon,
|
|
178
183
|
isActive: isActive,
|
|
179
184
|
isHighlight: R.any(R.identity)([R.prop(rowId)(activeCellIds), R.prop(columnIndex)(activeCellIds)]),
|
|
@@ -204,7 +209,8 @@ Section.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
204
209
|
maxColumns: PropTypes.number,
|
|
205
210
|
SideIcon: PropTypes.func,
|
|
206
211
|
subHeadCellsWidth: PropTypes.arrayOf(PropTypes.number),
|
|
207
|
-
HTMLRenderer: PropTypes.func
|
|
212
|
+
HTMLRenderer: PropTypes.func,
|
|
213
|
+
labelAccessor: PropTypes.func
|
|
208
214
|
} : {};
|
|
209
215
|
|
|
210
216
|
export default Section;
|
|
@@ -9,6 +9,7 @@ import TableCell from '@material-ui/core/TableCell';
|
|
|
9
9
|
import TableRow from '@material-ui/core/TableRow';
|
|
10
10
|
import Flags from './flags';
|
|
11
11
|
import { getDark, getIsRtl } from '../utils';
|
|
12
|
+
import { getValue } from './utils';
|
|
12
13
|
|
|
13
14
|
var useStyles = makeStyles(function (theme) {
|
|
14
15
|
return {
|
|
@@ -59,7 +60,8 @@ var SectionHeader = function SectionHeader(_ref) {
|
|
|
59
60
|
xLayoutDataLength = _ref.xLayoutDataLength,
|
|
60
61
|
headerHeight = _ref.headerHeight,
|
|
61
62
|
SideIcon = _ref.SideIcon,
|
|
62
|
-
HTMLRenderer = _ref.HTMLRenderer
|
|
63
|
+
HTMLRenderer = _ref.HTMLRenderer,
|
|
64
|
+
labelAccessor = _ref.labelAccessor;
|
|
63
65
|
|
|
64
66
|
var classes = useStyles();
|
|
65
67
|
var theme = useTheme();
|
|
@@ -99,6 +101,7 @@ var SectionHeader = function SectionHeader(_ref) {
|
|
|
99
101
|
className: cx(classes.stickyHeaderSection, classes.leftLabelPosition, classes.sectionLabelsContainer)
|
|
100
102
|
},
|
|
101
103
|
mapIndexed(function (sectionHeader, index) {
|
|
104
|
+
var value = getValue(labelAccessor)(sectionHeader);
|
|
102
105
|
return React.createElement(
|
|
103
106
|
Fragment,
|
|
104
107
|
{ key: index },
|
|
@@ -114,24 +117,29 @@ var SectionHeader = function SectionHeader(_ref) {
|
|
|
114
117
|
'data-testid': 'section-dim',
|
|
115
118
|
'aria-label': R.path(['dimension', 'id'], sectionHeader)
|
|
116
119
|
},
|
|
117
|
-
R.
|
|
120
|
+
R.pipe(R.prop('dimension'), labelAccessor)(sectionHeader),
|
|
118
121
|
':'
|
|
119
122
|
),
|
|
120
123
|
React.createElement(
|
|
121
124
|
Typography,
|
|
122
125
|
{ noWrap: true, variant: 'body1', component: 'span', tabIndex: 0 },
|
|
123
|
-
R.
|
|
126
|
+
R.prop('label', value)
|
|
124
127
|
),
|
|
125
128
|
React.createElement(Flags, {
|
|
126
129
|
HTMLRenderer: HTMLRenderer,
|
|
127
|
-
|
|
130
|
+
labelAccessor: labelAccessor,
|
|
131
|
+
flags: R.prop('flags', value)
|
|
128
132
|
})
|
|
129
133
|
);
|
|
130
134
|
}, R.path([0, 'data'], section)),
|
|
131
135
|
React.createElement(
|
|
132
136
|
'span',
|
|
133
137
|
null,
|
|
134
|
-
React.createElement(Flags, {
|
|
138
|
+
React.createElement(Flags, {
|
|
139
|
+
HTMLRenderer: HTMLRenderer,
|
|
140
|
+
flags: R.path([0, 'flags'], section),
|
|
141
|
+
labelAccessor: labelAccessor
|
|
142
|
+
})
|
|
135
143
|
)
|
|
136
144
|
)
|
|
137
145
|
)
|
|
@@ -153,7 +161,8 @@ SectionHeader.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
153
161
|
xLayoutDataLength: PropTypes.number,
|
|
154
162
|
headerHeight: PropTypes.number,
|
|
155
163
|
SideIcon: PropTypes.func,
|
|
156
|
-
HTMLRenderer: PropTypes.func
|
|
164
|
+
HTMLRenderer: PropTypes.func,
|
|
165
|
+
labelAccessor: PropTypes.func
|
|
157
166
|
} : {};
|
|
158
167
|
|
|
159
168
|
export default SectionHeader;
|
|
@@ -52,7 +52,8 @@ var SubHeader = React.forwardRef(function (_ref, refs) {
|
|
|
52
52
|
activeCellIds = _ref.activeCellIds,
|
|
53
53
|
subHeadCellsWidth = _ref.subHeadCellsWidth,
|
|
54
54
|
SideIcon = _ref.SideIcon,
|
|
55
|
-
HTMLRenderer = _ref.HTMLRenderer
|
|
55
|
+
HTMLRenderer = _ref.HTMLRenderer,
|
|
56
|
+
labelAccessor = _ref.labelAccessor;
|
|
56
57
|
|
|
57
58
|
var classes = useStyles();
|
|
58
59
|
var theme = useTheme();
|
|
@@ -83,8 +84,9 @@ var SubHeader = React.forwardRef(function (_ref, refs) {
|
|
|
83
84
|
React.createElement(
|
|
84
85
|
Typography,
|
|
85
86
|
{ variant: 'body1', tabIndex: 0, className: classes.label },
|
|
86
|
-
R.
|
|
87
|
+
R.pipe(R.prop('dimension'), labelAccessor)(rowItem),
|
|
87
88
|
React.createElement(Flags, {
|
|
89
|
+
labelAccessor: labelAccessor,
|
|
88
90
|
HTMLRenderer: HTMLRenderer,
|
|
89
91
|
flags: R.path(['dimension', 'flags'], rowItem)
|
|
90
92
|
})
|
|
@@ -106,7 +108,7 @@ var SubHeader = React.forwardRef(function (_ref, refs) {
|
|
|
106
108
|
className: cx(classes.fillerCell, (_cx = {}, _cx[classes.highlight] = R.prop(index)(activeCellIds), _cx))
|
|
107
109
|
},
|
|
108
110
|
!R.isNil(SideIcon) && React.createElement(SideIcon, { sideProps: R.prop('sideProps', item) }),
|
|
109
|
-
React.createElement(Flags, { flags: R.prop('flags', item) })
|
|
111
|
+
React.createElement(Flags, { flags: R.prop('flags', item), labelAccessor: labelAccessor, HTMLRenderer: HTMLRenderer })
|
|
110
112
|
);
|
|
111
113
|
}, headerData)
|
|
112
114
|
);
|
|
@@ -118,7 +120,8 @@ SubHeader.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
118
120
|
xLayoutData: PropTypes.array,
|
|
119
121
|
SideIcon: PropTypes.func,
|
|
120
122
|
subHeadCellsWidth: PropTypes.arrayOf(PropTypes.number),
|
|
121
|
-
HTMLRenderer: PropTypes.func
|
|
123
|
+
HTMLRenderer: PropTypes.func,
|
|
124
|
+
labelAccessor: PropTypes.func
|
|
122
125
|
} : {};
|
|
123
126
|
|
|
124
127
|
export default SubHeader;
|