@sis-cc/dotstatsuite-components 15.0.2 → 15.0.5

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.
@@ -310,7 +310,7 @@ var toProperties = exports.toProperties = function toProperties(props, state, _o
310
310
  onChange: function onChange(value) {
311
311
  return _onChange({ title: value });
312
312
  },
313
- value: (0, _getHeaderProps.getTitleLabel)(props, state),
313
+ value: R.isNil(state.title) || R.isEmpty(state.title) ? R.pathOr('', ['title', 'label'], props) : state.title,
314
314
  onReset: R.isNil(state.title) ? null : function () {
315
315
  return _onChange({ title: null });
316
316
  }
@@ -322,7 +322,7 @@ var toProperties = exports.toProperties = function toProperties(props, state, _o
322
322
  onChange: function onChange(value) {
323
323
  return _onChange({ subtitle: value });
324
324
  },
325
- value: R.pipe(_getHeaderProps.getSubtitle, _getStringifiedSubtitle.stringifySubtitle)(props, state),
325
+ value: R.isNil(state.subtitle) || R.isEmpty(state.subtitle) ? (0, _getStringifiedSubtitle.stringifySubtitle)(props.subtitle || []) : state.subtitle,
326
326
  onReset: R.isNil(state.subtitle) ? null : function () {
327
327
  return _onChange({ subtitle: null });
328
328
  }
@@ -92,6 +92,6 @@ var getSideProps = function getSideProps(_ref2, customAttributes, metadataCoordi
92
92
 
93
93
  var getCells = exports.getCells = function getCells(data, display, customAttributes, unitsProps, metadataCoordinates) {
94
94
  return R.mapObjIndexed(function (observation) {
95
- return R.pipe(R.set(R.lensProp('flags'), getFlags(customAttributes, (0, _dimensionUtils.dimensionValueDisplay)(display), unitsProps)(observation)), R.set(R.lensProp('intValue'), R.prop('value', observation)), R.set(R.lensProp('value'), R.prop('formattedValue', observation)), R.assoc('indexedDimValIds', R.prop('indexedDimValIds', observation)), R.assoc('sideProps', getSideProps(observation, customAttributes, metadataCoordinates)), R.set(R.lensProp('key'), R.prop('key', observation)))({});
95
+ return R.pipe(R.set(R.lensProp('flags'), getFlags(customAttributes, (0, _dimensionUtils.dimensionValueDisplay)(display), unitsProps)(observation)), R.set(R.lensProp('intValue'), R.is(Number, observation.value) ? observation.value : null), R.set(R.lensProp('value'), R.prop('formattedValue', observation)), R.assoc('indexedDimValIds', R.prop('indexedDimValIds', observation)), R.assoc('sideProps', getSideProps(observation, customAttributes, metadataCoordinates)), R.set(R.lensProp('key'), R.prop('key', observation)))({});
96
96
  }, R.propOr({}, 'observations', data));
97
97
  };
@@ -86,9 +86,7 @@ var prepareData = exports.prepareData = function prepareData(sdmxJson, customAtt
86
86
  //------------------------------------------------------------------
87
87
  var unitsArtefacts = (0, _getUnitsArtefacts.getUnitsArtefacts)({ unitsDefinitionCodes: unitsDefinitionCodes, data: sdmxJson });
88
88
  var headerUnits = (0, _getHeaderUnits.getHeaderUnits)({ unitsArtefacts: unitsArtefacts, unitsDefinitionCodes: unitsDefinitionCodes, rejectedValueIds: rejectedValueIds });
89
- var _dimensions = R.pipe(R.pathOr([], ['data', 'structure', 'dimensions', 'observation']), R.addIndex(R.map)(function (dim, index) {
90
- return R.assoc('index', index, dim);
91
- }), R.indexBy(R.prop('id')))(sdmxJson);
89
+ var _dimensions = R.pipe(R.pathOr([], ['data', 'structure', 'dimensions', 'observation']), R.indexBy(R.prop('id')))(sdmxJson);
92
90
  var attachmentSeriesIndexes = (0, _getAttachmentSeriesIndexes.getAttachmentSeriesIndexes)({ dimensions: _dimensions, unitsArtefacts: unitsArtefacts });
93
91
  //------------------------------------------------------------------
94
92
 
@@ -21,5 +21,5 @@ var getAttachmentSeriesIndexes = exports.getAttachmentSeriesIndexes = function g
21
21
 
22
22
  return R.pipe(R.props(R.concat(unitsDimensionsCodes, targettedDimensionsCodes)), R.filter(function (dim) {
23
23
  return !R.isNil(dim);
24
- }), R.pluck('index'), R.uniq, R.sortBy(R.identity))(dimensions);
24
+ }), R.pluck('__index'), R.uniq, R.sortBy(R.identity))(dimensions);
25
25
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sis-cc/dotstatsuite-components",
3
3
  "description": "Set components based on React.",
4
- "version": "15.0.2",
4
+ "version": "15.0.5",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -319,7 +319,8 @@ export const toProperties = (props, state, onChange) => ({
319
319
  isActive: isChart(props.type),
320
320
  isDefault: R.isNil(state.title),
321
321
  onChange: (value) => onChange({ title: value }),
322
- value: getTitleLabel(props, state),
322
+ value: R.isNil(state.title) || R.isEmpty(state.title)
323
+ ? R.pathOr('', ['title', 'label'], props) : state.title,
323
324
  onReset: R.isNil(state.title)
324
325
  ? null : () => onChange({ title: null })
325
326
  },
@@ -328,7 +329,8 @@ export const toProperties = (props, state, onChange) => ({
328
329
  isActive: isChart(props.type),
329
330
  isDefault: R.isNil(state.subtitle),
330
331
  onChange: (value) => onChange({ subtitle: value }),
331
- value: R.pipe(getSubtitle, stringifySubtitle)(props, state),
332
+ value: R.isNil(state.subtitle) || R.isEmpty(state.subtitle)
333
+ ? stringifySubtitle(props.subtitle || []) : state.subtitle,
332
334
  onReset: R.isNil(state.subtitle)
333
335
  ? null : () => onChange({ subtitle: null })
334
336
  },
@@ -92,7 +92,7 @@ export const getCells = (data, display, customAttributes, unitsProps, metadataCo
92
92
  customAttributes, dimensionValueDisplay(display), unitsProps
93
93
  )(observation)
94
94
  ),
95
- R.set(R.lensProp('intValue'), R.prop('value', observation)),
95
+ R.set(R.lensProp('intValue'), R.is(Number, observation.value) ? observation.value : null),
96
96
  R.set(R.lensProp('value'), R.prop('formattedValue', observation)),
97
97
  R.assoc('indexedDimValIds', R.prop('indexedDimValIds', observation)),
98
98
  R.assoc('sideProps', getSideProps(observation, customAttributes, metadataCoordinates)),
@@ -50,7 +50,6 @@ export const prepareData = (sdmxJson, customAttributes, unitsProps={}, _options=
50
50
  const headerUnits = getHeaderUnits({ unitsArtefacts, unitsDefinitionCodes, rejectedValueIds });
51
51
  const _dimensions = R.pipe(
52
52
  R.pathOr([], ['data', 'structure', 'dimensions', 'observation']),
53
- R.addIndex(R.map)((dim, index) => R.assoc('index', index, dim)),
54
53
  R.indexBy(R.prop('id'))
55
54
  )(sdmxJson);
56
55
  const attachmentSeriesIndexes = getAttachmentSeriesIndexes({ dimensions: _dimensions, unitsArtefacts });
@@ -2,7 +2,7 @@ import * as R from 'ramda';
2
2
 
3
3
  export const getAttachmentSeriesIndexes = ({
4
4
  unitsArtefacts,
5
- dimensions // { id: { index, ...dim } }
5
+ dimensions // { id: { __index, ...dim } }
6
6
  }) => {
7
7
  const targettedDimensionsCodes = R.pipe(
8
8
  R.pathOr({}, ['attributes', 'series']),
@@ -20,7 +20,7 @@ export const getAttachmentSeriesIndexes = ({
20
20
  return R.pipe(
21
21
  R.props(R.concat(unitsDimensionsCodes, targettedDimensionsCodes)),
22
22
  R.filter(dim => !R.isNil(dim)),
23
- R.pluck('index'),
23
+ R.pluck('__index'),
24
24
  R.uniq,
25
25
  R.sortBy(R.identity)
26
26
  )(dimensions);