@sis-cc/dotstatsuite-components 17.29.0 → 17.30.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.
@@ -12,6 +12,9 @@ var R = _interopRequireWildcard(_ramda);
12
12
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
13
13
 
14
14
  var hasCellMetadata = exports.hasCellMetadata = function hasCellMetadata(metadataCoordinates, cellCoordinates) {
15
+ if (R.propOr('OBS_VALUE', 'OBS_ATTRIBUTES', cellCoordinates) !== 'OBS_VALUE') {
16
+ return false;
17
+ }
15
18
  return R.pipe(R.find(function (coordinates) {
16
19
  var mergedCoord = R.mergeLeft(coordinates, cellCoordinates);
17
20
  return !R.isEmpty(coordinates) && R.equals(mergedCoord, cellCoordinates);
@@ -229,7 +229,6 @@ var injectRemainingDimensionsInLayout = exports.injectRemainingDimensionsInLayou
229
229
  return !R.isNil(dimId);
230
230
  }, _layout.rows);
231
231
 
232
- console.log({ dimInRows: dimInRows, layoutIds: layoutIds, indexedCombinations: indexedCombinations, layoutDimsIds: layoutDimsIds });
233
232
  if (R.isNil(dimInRows)) {
234
233
  if (R.isEmpty(_remaining)) {
235
234
  var toTakeIn = R.isEmpty(_layout.sections) ? 'header' : 'sections';
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": "17.29.0",
4
+ "version": "17.30.0",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -1,6 +1,9 @@
1
1
  import * as R from 'ramda';
2
2
 
3
3
  export const hasCellMetadata = (metadataCoordinates, cellCoordinates) => {
4
+ if (R.propOr('OBS_VALUE', 'OBS_ATTRIBUTES', cellCoordinates) !== 'OBS_VALUE') {
5
+ return false;
6
+ }
4
7
  return R.pipe(
5
8
  R.find(coordinates => {
6
9
  const mergedCoord = R.mergeLeft(coordinates, cellCoordinates);
@@ -166,7 +166,6 @@ export const injectRemainingDimensionsInLayout = (layoutIds, remainingDims, inde
166
166
  return !R.isNil(dimId);
167
167
  }, _layout.rows);
168
168
 
169
- console.log({ dimInRows, layoutIds, indexedCombinations, layoutDimsIds });
170
169
  if (R.isNil(dimInRows)) {
171
170
  if (R.isEmpty(_remaining)) {
172
171
  const toTakeIn = R.isEmpty(_layout.sections) ? 'header' : 'sections';
@@ -115,4 +115,47 @@ describe('getCells tests', () => {
115
115
  }
116
116
  });
117
117
  });
118
+ it('metadata and OBS_ATTRIBUTES', () => {
119
+ const _customAttributes = {
120
+ flags: [],
121
+ notes: []
122
+ };
123
+
124
+ const combinations = {
125
+ cells: [],
126
+ layout: []
127
+ };
128
+
129
+ const observations = {
130
+ 'a': {
131
+ value: 'val',
132
+ formattedValue: 'val',
133
+ attributes: {},
134
+ indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' }
135
+ },
136
+ 'b': {
137
+ value: 'attr val',
138
+ formattedValue: 'attr val',
139
+ attributes: {},
140
+ indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' }
141
+ }
142
+ };
143
+ const metadataCoordinates = [{ d0: 'v0', d1: 'v0' }];
144
+ expect(getCells(_customAttributes, {}, combinations, {}, metadataCoordinates)(observations)).to.deep.equal({
145
+ 'a': {
146
+ value: 'val',
147
+ intValue: null,
148
+ indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' },
149
+ sideProps: { hasAdvancedAttributes: false, hasMetadata: true, coordinates: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'OBS_VALUE' } },
150
+ flags: []
151
+ },
152
+ 'b': {
153
+ value: 'attr val',
154
+ intValue: null,
155
+ indexedDimValIds: { d0: 'v0', d1: 'v0', OBS_ATTRIBUTES: 'A' },
156
+ sideProps: null,
157
+ flags: []
158
+ }
159
+ });
160
+ });
118
161
  });