@sis-cc/dotstatsuite-visions 7.13.1 → 7.14.2

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.
@@ -55,7 +55,8 @@ var Item = function Item(_ref) {
55
55
  index = _ref.index,
56
56
  labelRenderer = _ref.labelRenderer,
57
57
  HTMLRenderer = _ref.HTMLRenderer,
58
- hierarchicalId = _ref.hierarchicalId;
58
+ hierarchicalId = _ref.hierarchicalId,
59
+ labels = _ref.labels;
59
60
 
60
61
  var _React$useState = React.useState(false),
61
62
  isTooltipShown = _React$useState[0],
@@ -82,14 +83,14 @@ var Item = function Item(_ref) {
82
83
  },
83
84
  React.createElement(ListItemText, {
84
85
  tabIndex: 0,
85
- 'aria-label': label,
86
+ 'aria-label': isDisabled ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
86
87
  'aria-pressed': isSelected,
87
88
  'aria-disabled': isDisabled,
88
89
  primaryTypographyProps: { noWrap: true, color: 'inherit' },
89
90
  secondaryTypographyProps: { color: 'inherit' },
90
91
  classes: { root: classes.listItem },
91
92
  className: cx((_cx2 = {}, _cx2[classes.accessibilityItemHover] = accessibility, _cx2[classes.listItemSelected] = R.and(isSelected, R.not(isDisabled)), _cx2[classes.listItemHover] = R.not(isDisabled), _cx2)),
92
- title: label,
93
+ title: isDisabled ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
93
94
  primary: React.createElement(
94
95
  'div',
95
96
  {
@@ -234,7 +235,8 @@ Item.propTypes = process.env.NODE_ENV !== "production" ? {
234
235
  index: PropTypes.number,
235
236
  labelRenderer: PropTypes.func,
236
237
  HTMLRenderer: PropTypes.func,
237
- hierarchicalId: PropTypes.string
238
+ hierarchicalId: PropTypes.string,
239
+ labels: PropTypes.object
238
240
  } : {};
239
241
 
240
242
  export default Item;
@@ -110,7 +110,7 @@ var ScopeList = function ScopeList(props) {
110
110
  // ReactVirtualized__Grid ReactVirtualized__List made the scrollbar
111
111
  var scrollEl = R.path(['children', 0, 'children', 0], current);
112
112
  var isBottom = R.gte(R.add(R.prop('scrollTop')(scrollEl), R.prop('clientHeight')(scrollEl)), R.prop('scrollHeight')(scrollEl));
113
- var nextpos = (scrollTop || 0) + event.deltaY / 2;
113
+ var nextpos = (scrollTop || scrollEl.scrollTop) + event.deltaY / 2;
114
114
  if (R.or(event.deltaY < 0, event.deltaY > 0 && R.not(isBottom))) {
115
115
  setScrollTop(nextpos < 0 ? 0 : nextpos);
116
116
  }
@@ -120,6 +120,9 @@ var ScopeList = function ScopeList(props) {
120
120
  setScrollTop(undefined); // should be undefined if the user want use the normal scroll
121
121
  }
122
122
  };
123
+ if (scrollTop === 0) {
124
+ setScrollTop(undefined);
125
+ }
123
126
  if (R.isNil(current)) return;
124
127
 
125
128
  current.addEventListener('wheel', handler, { passive: false });
@@ -229,7 +232,6 @@ var ScopeList = function ScopeList(props) {
229
232
  var height = _ref.height,
230
233
  width = _ref.width;
231
234
  return React.createElement(VirtualizedList, {
232
- ref: ref,
233
235
  overscan: 10,
234
236
  tabIndex: -1,
235
237
  height: height,
@@ -258,7 +260,8 @@ var ScopeList = function ScopeList(props) {
258
260
  changeMouseSelection: changeMouseSelection,
259
261
  ariaLabel: R.prop('navigateNext')(labels),
260
262
  NavigateIcon: isRtl ? NavigateBefore : NavigateNext,
261
- accessibility: accessibility
263
+ accessibility: accessibility,
264
+ labels: labels
262
265
  }, item, {
263
266
  isDisabled: disableAccessor(item),
264
267
  label: labelRenderer(item)
@@ -297,6 +300,7 @@ ScopeList.propTypes = process.env.NODE_ENV !== "production" ? {
297
300
  childrenNavigateDesc: PropTypes.string,
298
301
  navigateNext: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
299
302
  backHelper: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
303
+ disableItemLabel: PropTypes.string,
300
304
  selection: PropTypes.shape({
301
305
  title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
302
306
  currentLevel: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
@@ -51,6 +51,7 @@
51
51
  * navigateBefore: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
52
52
  * navigateNext: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
53
53
  * backHelper: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
54
+ * disableItemLabel: PropTypes.string,
54
55
  * selection: {
55
56
  * title: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
56
57
  * currentLevel: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
@@ -175,7 +175,7 @@ export var getItemsIds = R.curry(function (disableAccessor, _ref7, items) {
175
175
 
176
176
  return R.reduce(function (acc, item) {
177
177
  if (disableAccessor(item)) return acc;
178
- if (R.equals(R.not(R.prop('isSelected', item)), isSelected)) return acc;
178
+ if (!R.prop('isSelected', item) === isSelected) return acc;
179
179
  return R.append(R.prop('id', item), acc);
180
180
  }, [])(items);
181
181
  });
@@ -382,7 +382,8 @@ export var withScopeList = function withScopeList(Component) {
382
382
  }
383
383
  if (R.prop('isUp')(mouseAction) && isMousePreSelection) {
384
384
  var items = R.pipe(getPropByIndex(R.identity), R.reject(disableAccessor))(getRangeIndexes(mouseSelection), list);
385
- _this.changeMutliSelection(id)(getItemsIds(disableAccessor)({ isSelected: R.prop('isSelected', R.head(items)) })(items))(e);
385
+ var isFirstElementSelected = !!R.prop('isSelected', R.head(items));
386
+ _this.changeMutliSelection(id)(getItemsIds(disableAccessor)({ isSelected: isFirstElementSelected })(items))(e);
386
387
  return _this.setState({
387
388
  mouseSelection: [],
388
389
  isMousePreSelection: false,
@@ -35,7 +35,6 @@ var useStyles = makeStyles(function (theme) {
35
35
  },
36
36
  containerSection: {
37
37
  display: 'flex',
38
- justifyContent: 'space-between',
39
38
  alignItems: 'center'
40
39
  },
41
40
  stickyHeaderSection: {
@@ -53,7 +52,7 @@ var useStyles = makeStyles(function (theme) {
53
52
  right: theme.spacing(1)
54
53
  },
55
54
  sectionLabelsContainer: {
56
- padding: theme.spacing(0.5, 0)
55
+ padding: theme.spacing(0.5, 0.5)
57
56
  }
58
57
  };
59
58
  });
@@ -125,8 +124,8 @@ var SectionHeader = function SectionHeader(_ref) {
125
124
  {
126
125
  className: cx(classes.flag, classes.stickyHeaderSection, classes.rightLabelPosition, classes.sectionLabelsContainer)
127
126
  },
128
- !R.isNil(SideIcon) && React.createElement(SideIcon, { sideProps: R.path([0, 'sideProps'], section) }),
129
- React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: R.path([0, 'flags'], section) })
127
+ React.createElement(Flags, { HTMLRenderer: HTMLRenderer, flags: R.path([0, 'flags'], section) }),
128
+ !R.isNil(SideIcon) && React.createElement(SideIcon, { sideProps: R.path([0, 'sideProps'], section) })
130
129
  )
131
130
  )
132
131
  )
@@ -93,7 +93,8 @@ var Item = function Item(_ref) {
93
93
  index = _ref.index,
94
94
  labelRenderer = _ref.labelRenderer,
95
95
  HTMLRenderer = _ref.HTMLRenderer,
96
- hierarchicalId = _ref.hierarchicalId;
96
+ hierarchicalId = _ref.hierarchicalId,
97
+ labels = _ref.labels;
97
98
 
98
99
  var _React$useState = _react2.default.useState(false),
99
100
  isTooltipShown = _React$useState[0],
@@ -120,14 +121,14 @@ var Item = function Item(_ref) {
120
121
  },
121
122
  _react2.default.createElement(_ListItemText2.default, {
122
123
  tabIndex: 0,
123
- 'aria-label': label,
124
+ 'aria-label': isDisabled ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
124
125
  'aria-pressed': isSelected,
125
126
  'aria-disabled': isDisabled,
126
127
  primaryTypographyProps: { noWrap: true, color: 'inherit' },
127
128
  secondaryTypographyProps: { color: 'inherit' },
128
129
  classes: { root: classes.listItem },
129
130
  className: (0, _classnames2.default)((_cx2 = {}, _cx2[classes.accessibilityItemHover] = accessibility, _cx2[classes.listItemSelected] = R.and(isSelected, R.not(isDisabled)), _cx2[classes.listItemHover] = R.not(isDisabled), _cx2)),
130
- title: label,
131
+ title: isDisabled ? R.propOr('', 'disableItemLabel')(labels) + ' ' + label : label,
131
132
  primary: _react2.default.createElement(
132
133
  'div',
133
134
  {
@@ -272,7 +273,8 @@ Item.propTypes = process.env.NODE_ENV !== "production" ? {
272
273
  index: _propTypes2.default.number,
273
274
  labelRenderer: _propTypes2.default.func,
274
275
  HTMLRenderer: _propTypes2.default.func,
275
- hierarchicalId: _propTypes2.default.string
276
+ hierarchicalId: _propTypes2.default.string,
277
+ labels: _propTypes2.default.object
276
278
  } : {};
277
279
 
278
280
  exports.default = Item;
@@ -163,7 +163,7 @@ var ScopeList = function ScopeList(props) {
163
163
  // ReactVirtualized__Grid ReactVirtualized__List made the scrollbar
164
164
  var scrollEl = R.path(['children', 0, 'children', 0], current);
165
165
  var isBottom = R.gte(R.add(R.prop('scrollTop')(scrollEl), R.prop('clientHeight')(scrollEl)), R.prop('scrollHeight')(scrollEl));
166
- var nextpos = (scrollTop || 0) + event.deltaY / 2;
166
+ var nextpos = (scrollTop || scrollEl.scrollTop) + event.deltaY / 2;
167
167
  if (R.or(event.deltaY < 0, event.deltaY > 0 && R.not(isBottom))) {
168
168
  setScrollTop(nextpos < 0 ? 0 : nextpos);
169
169
  }
@@ -173,6 +173,9 @@ var ScopeList = function ScopeList(props) {
173
173
  setScrollTop(undefined); // should be undefined if the user want use the normal scroll
174
174
  }
175
175
  };
176
+ if (scrollTop === 0) {
177
+ setScrollTop(undefined);
178
+ }
176
179
  if (R.isNil(current)) return;
177
180
 
178
181
  current.addEventListener('wheel', handler, { passive: false });
@@ -282,7 +285,6 @@ var ScopeList = function ScopeList(props) {
282
285
  var height = _ref.height,
283
286
  width = _ref.width;
284
287
  return _react2.default.createElement(_List2.default, {
285
- ref: ref,
286
288
  overscan: 10,
287
289
  tabIndex: -1,
288
290
  height: height,
@@ -311,7 +313,8 @@ var ScopeList = function ScopeList(props) {
311
313
  changeMouseSelection: changeMouseSelection,
312
314
  ariaLabel: R.prop('navigateNext')(labels),
313
315
  NavigateIcon: isRtl ? _NavigateBefore2.default : _NavigateNext2.default,
314
- accessibility: accessibility
316
+ accessibility: accessibility,
317
+ labels: labels
315
318
  }, item, {
316
319
  isDisabled: disableAccessor(item),
317
320
  label: labelRenderer(item)
@@ -350,6 +353,7 @@ ScopeList.propTypes = process.env.NODE_ENV !== "production" ? {
350
353
  childrenNavigateDesc: _propTypes2.default.string,
351
354
  navigateNext: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
352
355
  backHelper: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
356
+ disableItemLabel: _propTypes2.default.string,
353
357
  selection: _propTypes2.default.shape({
354
358
  title: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
355
359
  currentLevel: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.element]),
@@ -190,7 +190,7 @@ var getItemsIds = exports.getItemsIds = R.curry(function (disableAccessor, _ref7
190
190
 
191
191
  return R.reduce(function (acc, item) {
192
192
  if (disableAccessor(item)) return acc;
193
- if (R.equals(R.not(R.prop('isSelected', item)), isSelected)) return acc;
193
+ if (!R.prop('isSelected', item) === isSelected) return acc;
194
194
  return R.append(R.prop('id', item), acc);
195
195
  }, [])(items);
196
196
  });
@@ -397,7 +397,8 @@ var withScopeList = exports.withScopeList = function withScopeList(Component) {
397
397
  }
398
398
  if (R.prop('isUp')(mouseAction) && isMousePreSelection) {
399
399
  var items = R.pipe(getPropByIndex(R.identity), R.reject(disableAccessor))(getRangeIndexes(mouseSelection), list);
400
- _this.changeMutliSelection(id)(getItemsIds(disableAccessor)({ isSelected: R.prop('isSelected', R.head(items)) })(items))(e);
400
+ var isFirstElementSelected = !!R.prop('isSelected', R.head(items));
401
+ _this.changeMutliSelection(id)(getItemsIds(disableAccessor)({ isSelected: isFirstElementSelected })(items))(e);
401
402
  return _this.setState({
402
403
  mouseSelection: [],
403
404
  isMousePreSelection: false,
@@ -71,7 +71,6 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
71
71
  },
72
72
  containerSection: {
73
73
  display: 'flex',
74
- justifyContent: 'space-between',
75
74
  alignItems: 'center'
76
75
  },
77
76
  stickyHeaderSection: {
@@ -89,7 +88,7 @@ var useStyles = (0, _styles.makeStyles)(function (theme) {
89
88
  right: theme.spacing(1)
90
89
  },
91
90
  sectionLabelsContainer: {
92
- padding: theme.spacing(0.5, 0)
91
+ padding: theme.spacing(0.5, 0.5)
93
92
  }
94
93
  };
95
94
  });
@@ -161,8 +160,8 @@ var SectionHeader = function SectionHeader(_ref) {
161
160
  {
162
161
  className: (0, _classnames2.default)(classes.flag, classes.stickyHeaderSection, classes.rightLabelPosition, classes.sectionLabelsContainer)
163
162
  },
164
- !R.isNil(SideIcon) && _react2.default.createElement(SideIcon, { sideProps: R.path([0, 'sideProps'], section) }),
165
- _react2.default.createElement(_flags2.default, { HTMLRenderer: HTMLRenderer, flags: R.path([0, 'flags'], section) })
163
+ _react2.default.createElement(_flags2.default, { HTMLRenderer: HTMLRenderer, flags: R.path([0, 'flags'], section) }),
164
+ !R.isNil(SideIcon) && _react2.default.createElement(SideIcon, { sideProps: R.path([0, 'sideProps'], section) })
166
165
  )
167
166
  )
168
167
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-visions",
3
- "version": "7.13.1",
3
+ "version": "7.14.2",
4
4
  "description": "Library of visual components",
5
5
  "author": "OECD",
6
6
  "homepage": "https://visions-qa.siscc.org/#o",