@sis-cc/dotstatsuite-visions 7.10.1 → 7.11.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.
@@ -54,7 +54,8 @@ var Item = function Item(_ref) {
54
54
  accessibility = _ref.accessibility,
55
55
  index = _ref.index,
56
56
  labelRenderer = _ref.labelRenderer,
57
- HTMLRenderer = _ref.HTMLRenderer;
57
+ HTMLRenderer = _ref.HTMLRenderer,
58
+ hierarchicalId = _ref.hierarchicalId;
58
59
 
59
60
  var _React$useState = React.useState(false),
60
61
  isTooltipShown = _React$useState[0],
@@ -171,7 +172,7 @@ var Item = function Item(_ref) {
171
172
  className: classes.containerArrow,
172
173
  tabIndex: 0,
173
174
  onClick: function onClick() {
174
- return changeList(id);
175
+ return changeList(hierarchicalId || id);
175
176
  },
176
177
  onKeyPress: function onKeyPress(e) {
177
178
  if (e.key === 'Enter') {
@@ -232,7 +233,8 @@ Item.propTypes = process.env.NODE_ENV !== "production" ? {
232
233
  accessibility: PropTypes.bool,
233
234
  index: PropTypes.number,
234
235
  labelRenderer: PropTypes.func,
235
- HTMLRenderer: PropTypes.func
236
+ HTMLRenderer: PropTypes.func,
237
+ hierarchicalId: PropTypes.string
236
238
  } : {};
237
239
 
238
240
  export default Item;
@@ -85,7 +85,7 @@ export var getPlaceholder = function getPlaceholder(_ref2) {
85
85
  //----------------------------------------------------------------------------------------------List
86
86
  export var withHasChild = function withHasChild(itemsByParentId) {
87
87
  return function (item) {
88
- return R.assoc('hasChild', R.pipe(R.prop(item.id), R.isNil, R.not)(itemsByParentId))(item);
88
+ return R.assoc('hasChild', R.pipe(R.prop(item.hierarchicalId || item.id), R.isNil, R.not)(itemsByParentId))(item);
89
89
  };
90
90
  };
91
91
  export var getCurrentList = function getCurrentList(_ref3) {
@@ -110,7 +110,7 @@ export var getList = function getList(_ref4) {
110
110
  hasPath = _ref4.hasPath,
111
111
  displayAccessor = _ref4.displayAccessor;
112
112
 
113
- var currentItemId = currentItem ? R.prop('id')(currentItem) : null;
113
+ var currentItemId = currentItem ? currentItem.hierarchicalId || currentItem.id : null;
114
114
  if (R.or(R.isEmpty(term), R.isNil(R.prop('defaultSpotlight')(topElementProps)))) {
115
115
  var itemsByParentIdDisplayed = getItemsIndexedByParentId(displayAccessor)(items);
116
116
  if (R.isNil(currentItemId)) return R.pipe(getMainList, R.map(function (item) {
@@ -270,7 +270,7 @@ export var withScopeList = function withScopeList(Component) {
270
270
  isMousePreSelection: false,
271
271
  applyToShiftSelected: R.identity
272
272
  }, _this.changeList = function (id) {
273
- return _this.setState({ currentItem: R.prop(id)(_this.state.itemsById), term: '' });
273
+ return _this.setState({ currentItem: R.prop(id)(_this.state.itemsByHierarchicalId), term: '' });
274
274
  }, _this.changeSelection = function (panelId) {
275
275
  return function (id) {
276
276
  return function (event) {
@@ -416,6 +416,7 @@ export var withScopeList = function withScopeList(Component) {
416
416
  term = _this$state.term,
417
417
  itemsByParentId = _this$state.itemsByParentId,
418
418
  itemsById = _this$state.itemsById,
419
+ itemsByHierarchicalId = _this$state.itemsByHierarchicalId,
419
420
  shiftSelection = _this$state.shiftSelection,
420
421
  ctrlSelection = _this$state.ctrlSelection,
421
422
  mouseSelection = _this$state.mouseSelection,
@@ -426,6 +427,7 @@ export var withScopeList = function withScopeList(Component) {
426
427
  items: items,
427
428
  itemsByParentId: itemsByParentId,
428
429
  itemsById: itemsById,
430
+ itemsByHierarchicalId: itemsByHierarchicalId,
429
431
  topElementProps: topElementProps,
430
432
  currentItem: currentItem,
431
433
  term: term,
@@ -445,7 +447,7 @@ export var withScopeList = function withScopeList(Component) {
445
447
  isActivePanel: isActivePanel,
446
448
  currentItem: currentItem,
447
449
  items: items,
448
- itemsById: itemsById,
450
+ itemsById: itemsByHierarchicalId,
449
451
  hasPath: hasPath
450
452
  }),
451
453
  action: _this.changeSpotlight,
@@ -480,6 +482,9 @@ export var withScopeList = function withScopeList(Component) {
480
482
  }(React.Component), _class.getDerivedStateFromProps = function (props, state) {
481
483
  return _extends({}, state, {
482
484
  itemsById: R.indexBy(R.prop('id'), props.items),
485
+ itemsByHierarchicalId: R.indexBy(function (item) {
486
+ return item.hierarchicalId || item.id;
487
+ }, props.items),
483
488
  itemsByParentId: getItemsIndexedByParentId(props.displayAccessor)(props.items) // only use for hasChild, same keys are overide
484
489
  });
485
490
  }, _temp2;
@@ -165,9 +165,8 @@ var Section = function Section(_ref) {
165
165
 
166
166
  var intersectionCellId = rowId + '/' + columnIndex;
167
167
  var isActive = R.pipe(R.propOr({}, 'intersectionCellId'), R.equals(intersectionCellId))(activeCellIds);
168
- return React.createElement(Cell, _extends({
169
- key: intersectionCellId
170
- }, R.pathOr({ value: '..' }, [item.key, currentSection, sectionbody.key, 0], cells), {
168
+ return React.createElement(Cell, _extends({}, R.pathOr({ value: '..' }, [item.key, currentSection, sectionbody.key, 0], cells), {
169
+ key: intersectionCellId,
171
170
  headers: rowIds + ' ' + columnIds + ' ' + currentSection,
172
171
  cellHandler: cellHandler,
173
172
  HTMLRenderer: HTMLRenderer,
@@ -92,7 +92,8 @@ var Item = function Item(_ref) {
92
92
  accessibility = _ref.accessibility,
93
93
  index = _ref.index,
94
94
  labelRenderer = _ref.labelRenderer,
95
- HTMLRenderer = _ref.HTMLRenderer;
95
+ HTMLRenderer = _ref.HTMLRenderer,
96
+ hierarchicalId = _ref.hierarchicalId;
96
97
 
97
98
  var _React$useState = _react2.default.useState(false),
98
99
  isTooltipShown = _React$useState[0],
@@ -209,7 +210,7 @@ var Item = function Item(_ref) {
209
210
  className: classes.containerArrow,
210
211
  tabIndex: 0,
211
212
  onClick: function onClick() {
212
- return changeList(id);
213
+ return changeList(hierarchicalId || id);
213
214
  },
214
215
  onKeyPress: function onKeyPress(e) {
215
216
  if (e.key === 'Enter') {
@@ -270,7 +271,8 @@ Item.propTypes = process.env.NODE_ENV !== "production" ? {
270
271
  accessibility: _propTypes2.default.bool,
271
272
  index: _propTypes2.default.number,
272
273
  labelRenderer: _propTypes2.default.func,
273
- HTMLRenderer: _propTypes2.default.func
274
+ HTMLRenderer: _propTypes2.default.func,
275
+ hierarchicalId: _propTypes2.default.string
274
276
  } : {};
275
277
 
276
278
  exports.default = Item;
@@ -100,7 +100,7 @@ var getPlaceholder = exports.getPlaceholder = function getPlaceholder(_ref2) {
100
100
  //----------------------------------------------------------------------------------------------List
101
101
  var withHasChild = exports.withHasChild = function withHasChild(itemsByParentId) {
102
102
  return function (item) {
103
- return R.assoc('hasChild', R.pipe(R.prop(item.id), R.isNil, R.not)(itemsByParentId))(item);
103
+ return R.assoc('hasChild', R.pipe(R.prop(item.hierarchicalId || item.id), R.isNil, R.not)(itemsByParentId))(item);
104
104
  };
105
105
  };
106
106
  var getCurrentList = exports.getCurrentList = function getCurrentList(_ref3) {
@@ -125,7 +125,7 @@ var getList = exports.getList = function getList(_ref4) {
125
125
  hasPath = _ref4.hasPath,
126
126
  displayAccessor = _ref4.displayAccessor;
127
127
 
128
- var currentItemId = currentItem ? R.prop('id')(currentItem) : null;
128
+ var currentItemId = currentItem ? currentItem.hierarchicalId || currentItem.id : null;
129
129
  if (R.or(R.isEmpty(term), R.isNil(R.prop('defaultSpotlight')(topElementProps)))) {
130
130
  var itemsByParentIdDisplayed = getItemsIndexedByParentId(displayAccessor)(items);
131
131
  if (R.isNil(currentItemId)) return R.pipe(getMainList, R.map(function (item) {
@@ -285,7 +285,7 @@ var withScopeList = exports.withScopeList = function withScopeList(Component) {
285
285
  isMousePreSelection: false,
286
286
  applyToShiftSelected: R.identity
287
287
  }, _this.changeList = function (id) {
288
- return _this.setState({ currentItem: R.prop(id)(_this.state.itemsById), term: '' });
288
+ return _this.setState({ currentItem: R.prop(id)(_this.state.itemsByHierarchicalId), term: '' });
289
289
  }, _this.changeSelection = function (panelId) {
290
290
  return function (id) {
291
291
  return function (event) {
@@ -431,6 +431,7 @@ var withScopeList = exports.withScopeList = function withScopeList(Component) {
431
431
  term = _this$state.term,
432
432
  itemsByParentId = _this$state.itemsByParentId,
433
433
  itemsById = _this$state.itemsById,
434
+ itemsByHierarchicalId = _this$state.itemsByHierarchicalId,
434
435
  shiftSelection = _this$state.shiftSelection,
435
436
  ctrlSelection = _this$state.ctrlSelection,
436
437
  mouseSelection = _this$state.mouseSelection,
@@ -441,6 +442,7 @@ var withScopeList = exports.withScopeList = function withScopeList(Component) {
441
442
  items: items,
442
443
  itemsByParentId: itemsByParentId,
443
444
  itemsById: itemsById,
445
+ itemsByHierarchicalId: itemsByHierarchicalId,
444
446
  topElementProps: topElementProps,
445
447
  currentItem: currentItem,
446
448
  term: term,
@@ -460,7 +462,7 @@ var withScopeList = exports.withScopeList = function withScopeList(Component) {
460
462
  isActivePanel: isActivePanel,
461
463
  currentItem: currentItem,
462
464
  items: items,
463
- itemsById: itemsById,
465
+ itemsById: itemsByHierarchicalId,
464
466
  hasPath: hasPath
465
467
  }),
466
468
  action: _this.changeSpotlight,
@@ -495,6 +497,9 @@ var withScopeList = exports.withScopeList = function withScopeList(Component) {
495
497
  }(_react2.default.Component), _class.getDerivedStateFromProps = function (props, state) {
496
498
  return _extends({}, state, {
497
499
  itemsById: R.indexBy(R.prop('id'), props.items),
500
+ itemsByHierarchicalId: R.indexBy(function (item) {
501
+ return item.hierarchicalId || item.id;
502
+ }, props.items),
498
503
  itemsByParentId: getItemsIndexedByParentId(props.displayAccessor)(props.items) // only use for hasChild, same keys are overide
499
504
  });
500
505
  }, _temp2;
@@ -207,9 +207,8 @@ var Section = function Section(_ref) {
207
207
 
208
208
  var intersectionCellId = rowId + '/' + columnIndex;
209
209
  var isActive = R.pipe(R.propOr({}, 'intersectionCellId'), R.equals(intersectionCellId))(activeCellIds);
210
- return _react2.default.createElement(_cell2.default, _extends({
211
- key: intersectionCellId
212
- }, R.pathOr({ value: '..' }, [item.key, currentSection, sectionbody.key, 0], cells), {
210
+ return _react2.default.createElement(_cell2.default, _extends({}, R.pathOr({ value: '..' }, [item.key, currentSection, sectionbody.key, 0], cells), {
211
+ key: intersectionCellId,
213
212
  headers: rowIds + ' ' + columnIds + ' ' + currentSection,
214
213
  cellHandler: cellHandler,
215
214
  HTMLRenderer: HTMLRenderer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-visions",
3
- "version": "7.10.1",
3
+ "version": "7.11.0",
4
4
  "description": "Library of visual components",
5
5
  "author": "OECD",
6
6
  "homepage": "https://visions-qa.siscc.org/#o",