@sis-cc/dotstatsuite-visions 8.1.0 → 8.3.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.
@@ -5,7 +5,7 @@ import PropTypes from 'prop-types';
5
5
  import * as R from 'ramda';
6
6
  import Container from '@material-ui/core/Container';
7
7
  import PlaylistAddCheckIcon from '@material-ui/icons/PlaylistAddCheck';
8
- import { ExpansionPanel, Tag as InternalTag, VerticalButton, Spotlight, VirtualizedTree } from '../';
8
+ import { ExpansionPanel, Tag as InternalTag, VerticalButton, Spotlight, VirtualizedTree, Tooltip } from '../';
9
9
  import { withExpansionTree } from '../VirtualizedTree/withExpansionTree';
10
10
  import { withSpotlight } from '../VirtualizedTree/withSpotlight';
11
11
  import { useStyles } from '../ScopeList/styles';
@@ -83,13 +83,22 @@ var HierarchicalFilter = function HierarchicalFilter(props) {
83
83
  action: setSpotlight
84
84
  }),
85
85
  R.is(Function, toggleBulk) && hasSpotlight && React.createElement(
86
- VerticalButton,
86
+ Tooltip,
87
87
  {
88
- 'aria-label': R.prop('advancedSelection')(labels),
89
- classes: { root: classes.bulkSelectionIcon },
90
- onClick: onAdvancedToggle
88
+ title: R.prop('iconLabel')(labels),
89
+ key: id,
90
+ placement: 'bottom',
91
+ variant: 'light'
91
92
  },
92
- React.createElement(PlaylistAddCheckIcon, { color: 'primary' })
93
+ React.createElement(
94
+ VerticalButton,
95
+ {
96
+ 'aria-label': R.prop('advancedSelection')(labels),
97
+ classes: { root: classes.bulkSelectionIcon },
98
+ onClick: onAdvancedToggle
99
+ },
100
+ React.createElement(PlaylistAddCheckIcon, { color: 'primary' })
101
+ )
93
102
  )
94
103
  )
95
104
  ),
@@ -10,6 +10,8 @@ import SubHeader from './subHeader';
10
10
  import Section from './section';
11
11
  import Cell from './cell';
12
12
  import { defaultLabelAccessor } from './utils';
13
+ import { useMemo } from 'react';
14
+ import { useCallback } from 'react';
13
15
 
14
16
  /*
15
17
  * Accessibility.
@@ -24,7 +26,8 @@ var useStyles = makeStyles(function (theme) {
24
26
  table: {
25
27
  borderCollapse: 'separate',
26
28
  borderLeft: 'thin solid ' + theme.palette.grey[500],
27
- borderTop: 'thin solid ' + theme.palette.grey[500]
29
+ borderTop: 'thin solid ' + theme.palette.grey[500],
30
+ padding: '0px 0px'
28
31
  },
29
32
  stickyHeader: {
30
33
  position: 'sticky',
@@ -91,6 +94,8 @@ var TableHtml5 = function TableHtml5(_ref) {
91
94
  var headerRef = useRef(null);
92
95
  var subHeadCellsRef = useRef([]);
93
96
 
97
+ var labelAccessorhandler = useCallback(labelAccessor, []);
98
+
94
99
  useEffect(function () {
95
100
  setHeaderHeight(R.pathOr(0, ['current', 'clientHeight'], headerRef));
96
101
  setSubHeadCellsWidth(getCellsWidth(R.prop('current', subHeadCellsRef)));
@@ -111,6 +116,17 @@ var TableHtml5 = function TableHtml5(_ref) {
111
116
  };
112
117
  }, []);
113
118
 
119
+ var xLayoutData = R.pathOr([], [0, 1, 0, 'data'], sectionsData);
120
+ var xLayoutDataLength = R.length(xLayoutData);
121
+
122
+ var _useMemo = useMemo(function () {
123
+ var valuesHeaderData = getEnhancedValuesHeaderData(headerData);
124
+ var nbColumnsByRows = R.map(R.length)(valuesHeaderData);
125
+ return { valuesHeaderData: valuesHeaderData, nbColumnsByRows: nbColumnsByRows };
126
+ }, [headerData]),
127
+ valuesHeaderData = _useMemo.valuesHeaderData,
128
+ nbColumnsByRows = _useMemo.nbColumnsByRows;
129
+
114
130
  var isSingleObs = R.hasPath(['', '', '', 0], cells);
115
131
  if (isSingleObs) return React.createElement(Cell, _extends({
116
132
  HTMLRenderer: HTMLRenderer,
@@ -120,19 +136,9 @@ var TableHtml5 = function TableHtml5(_ref) {
120
136
  isOne: true
121
137
  }));
122
138
 
123
- var xLayoutData = R.pathOr([], [0, 1, 0, 'data'], sectionsData);
124
- var xLayoutDataLength = R.length(xLayoutData);
125
- var valuesHeaderData = getEnhancedValuesHeaderData(headerData);
126
- var nbColumnsByRows = R.map(R.length)(valuesHeaderData);
127
139
  return React.createElement(
128
140
  Table,
129
- {
130
- className: classes.table,
131
- 'aria-label': 'table',
132
- size: 'small',
133
- style: { padding: '0px 0px' },
134
- 'data-testid': testId
135
- },
141
+ { className: classes.table, 'aria-label': 'table', size: 'small', 'data-testid': testId },
136
142
  React.createElement(
137
143
  'thead',
138
144
  { ref: headerRef, className: classes.stickyHeader },
@@ -142,7 +148,7 @@ var TableHtml5 = function TableHtml5(_ref) {
142
148
  xLayoutDataLength: xLayoutDataLength,
143
149
  subHeadCellsWidth: subHeadCellsWidth,
144
150
  HTMLRenderer: HTMLRenderer,
145
- labelAccessor: labelAccessor
151
+ labelAccessor: labelAccessorhandler
146
152
  }),
147
153
  React.createElement(SubHeader, {
148
154
  headerData: headerData,
@@ -152,12 +158,12 @@ var TableHtml5 = function TableHtml5(_ref) {
152
158
  ref: subHeadCellsRef,
153
159
  subHeadCellsWidth: subHeadCellsWidth,
154
160
  HTMLRenderer: HTMLRenderer,
155
- labelAccessor: labelAccessor
161
+ labelAccessor: labelAccessorhandler
156
162
  })
157
163
  ),
158
164
  mapIndexed(function (section, index) {
159
165
  return React.createElement(Section, {
160
- key: index,
166
+ key: 'section-' + index,
161
167
  sectionIndex: index,
162
168
  headerHeight: headerHeight,
163
169
  nbColumnsByRows: nbColumnsByRows,
@@ -171,7 +177,7 @@ var TableHtml5 = function TableHtml5(_ref) {
171
177
  SideIcon: SideIcon,
172
178
  subHeadCellsWidth: subHeadCellsWidth,
173
179
  HTMLRenderer: HTMLRenderer,
174
- labelAccessor: labelAccessor,
180
+ labelAccessor: labelAccessorhandler,
175
181
  isNoWrap: isNoWrap
176
182
  });
177
183
  }, sectionsData)
@@ -14,6 +14,7 @@ import Cell from './cell';
14
14
  import { getLight, getIsRtl } from '../utils';
15
15
  import { getValue } from './utils';
16
16
  import Flags from './flags';
17
+ import { memo } from 'react';
17
18
 
18
19
  var useStyles = makeStyles(function (theme) {
19
20
  return {
@@ -222,4 +223,4 @@ Section.propTypes = process.env.NODE_ENV !== "production" ? {
222
223
  isNoWrap: PropTypes.func
223
224
  } : {};
224
225
 
225
- export default Section;
226
+ export default memo(Section);
@@ -111,13 +111,22 @@ var HierarchicalFilter = function HierarchicalFilter(props) {
111
111
  action: setSpotlight
112
112
  }),
113
113
  R.is(Function, toggleBulk) && hasSpotlight && _react2.default.createElement(
114
- _.VerticalButton,
114
+ _.Tooltip,
115
115
  {
116
- 'aria-label': R.prop('advancedSelection')(labels),
117
- classes: { root: classes.bulkSelectionIcon },
118
- onClick: onAdvancedToggle
116
+ title: R.prop('iconLabel')(labels),
117
+ key: id,
118
+ placement: 'bottom',
119
+ variant: 'light'
119
120
  },
120
- _react2.default.createElement(_PlaylistAddCheck2.default, { color: 'primary' })
121
+ _react2.default.createElement(
122
+ _.VerticalButton,
123
+ {
124
+ 'aria-label': R.prop('advancedSelection')(labels),
125
+ classes: { root: classes.bulkSelectionIcon },
126
+ onClick: onAdvancedToggle
127
+ },
128
+ _react2.default.createElement(_PlaylistAddCheck2.default, { color: 'primary' })
129
+ )
121
130
  )
122
131
  )
123
132
  ),
@@ -58,7 +58,8 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
58
58
  table: {
59
59
  borderCollapse: 'separate',
60
60
  borderLeft: 'thin solid ' + theme.palette.grey[500],
61
- borderTop: 'thin solid ' + theme.palette.grey[500]
61
+ borderTop: 'thin solid ' + theme.palette.grey[500],
62
+ padding: '0px 0px'
62
63
  },
63
64
  stickyHeader: {
64
65
  position: 'sticky',
@@ -125,6 +126,8 @@ var TableHtml5 = function TableHtml5(_ref) {
125
126
  var headerRef = (0, _react.useRef)(null);
126
127
  var subHeadCellsRef = (0, _react.useRef)([]);
127
128
 
129
+ var labelAccessorhandler = (0, _react.useCallback)(labelAccessor, []);
130
+
128
131
  (0, _react.useEffect)(function () {
129
132
  setHeaderHeight(R.pathOr(0, ['current', 'clientHeight'], headerRef));
130
133
  setSubHeadCellsWidth(getCellsWidth(R.prop('current', subHeadCellsRef)));
@@ -145,6 +148,17 @@ var TableHtml5 = function TableHtml5(_ref) {
145
148
  };
146
149
  }, []);
147
150
 
151
+ var xLayoutData = R.pathOr([], [0, 1, 0, 'data'], sectionsData);
152
+ var xLayoutDataLength = R.length(xLayoutData);
153
+
154
+ var _useMemo = (0, _react.useMemo)(function () {
155
+ var valuesHeaderData = getEnhancedValuesHeaderData(headerData);
156
+ var nbColumnsByRows = R.map(R.length)(valuesHeaderData);
157
+ return { valuesHeaderData: valuesHeaderData, nbColumnsByRows: nbColumnsByRows };
158
+ }, [headerData]),
159
+ valuesHeaderData = _useMemo.valuesHeaderData,
160
+ nbColumnsByRows = _useMemo.nbColumnsByRows;
161
+
148
162
  var isSingleObs = R.hasPath(['', '', '', 0], cells);
149
163
  if (isSingleObs) return _react2.default.createElement(_cell2.default, _extends({
150
164
  HTMLRenderer: HTMLRenderer,
@@ -154,19 +168,9 @@ var TableHtml5 = function TableHtml5(_ref) {
154
168
  isOne: true
155
169
  }));
156
170
 
157
- var xLayoutData = R.pathOr([], [0, 1, 0, 'data'], sectionsData);
158
- var xLayoutDataLength = R.length(xLayoutData);
159
- var valuesHeaderData = getEnhancedValuesHeaderData(headerData);
160
- var nbColumnsByRows = R.map(R.length)(valuesHeaderData);
161
171
  return _react2.default.createElement(
162
172
  _Table2.default,
163
- {
164
- className: classes.table,
165
- 'aria-label': 'table',
166
- size: 'small',
167
- style: { padding: '0px 0px' },
168
- 'data-testid': testId
169
- },
173
+ { className: classes.table, 'aria-label': 'table', size: 'small', 'data-testid': testId },
170
174
  _react2.default.createElement(
171
175
  'thead',
172
176
  { ref: headerRef, className: classes.stickyHeader },
@@ -176,7 +180,7 @@ var TableHtml5 = function TableHtml5(_ref) {
176
180
  xLayoutDataLength: xLayoutDataLength,
177
181
  subHeadCellsWidth: subHeadCellsWidth,
178
182
  HTMLRenderer: HTMLRenderer,
179
- labelAccessor: labelAccessor
183
+ labelAccessor: labelAccessorhandler
180
184
  }),
181
185
  _react2.default.createElement(_subHeader2.default, {
182
186
  headerData: headerData,
@@ -186,12 +190,12 @@ var TableHtml5 = function TableHtml5(_ref) {
186
190
  ref: subHeadCellsRef,
187
191
  subHeadCellsWidth: subHeadCellsWidth,
188
192
  HTMLRenderer: HTMLRenderer,
189
- labelAccessor: labelAccessor
193
+ labelAccessor: labelAccessorhandler
190
194
  })
191
195
  ),
192
196
  mapIndexed(function (section, index) {
193
197
  return _react2.default.createElement(_section2.default, {
194
- key: index,
198
+ key: 'section-' + index,
195
199
  sectionIndex: index,
196
200
  headerHeight: headerHeight,
197
201
  nbColumnsByRows: nbColumnsByRows,
@@ -205,7 +209,7 @@ var TableHtml5 = function TableHtml5(_ref) {
205
209
  SideIcon: SideIcon,
206
210
  subHeadCellsWidth: subHeadCellsWidth,
207
211
  HTMLRenderer: HTMLRenderer,
208
- labelAccessor: labelAccessor,
212
+ labelAccessor: labelAccessorhandler,
209
213
  isNoWrap: isNoWrap
210
214
  });
211
215
  }, sectionsData)
@@ -265,5 +265,5 @@ Section.propTypes = process.env.NODE_ENV !== "production" ? {
265
265
  isNoWrap: _propTypes2.default.func
266
266
  } : {};
267
267
 
268
- exports.default = Section;
268
+ exports.default = (0, _react.memo)(Section);
269
269
  module.exports = exports['default'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-visions",
3
- "version": "8.1.0",
3
+ "version": "8.3.0",
4
4
  "description": "Library of visual components",
5
5
  "author": "OECD",
6
6
  "homepage": "https://visions-qa.siscc.org/#o",