@sis-cc/dotstatsuite-components 15.0.13 → 15.0.14

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.
@@ -63,8 +63,9 @@ var getSidebarData = exports.getSidebarData = function getSidebarData(attributes
63
63
  return (0, _extends3.default)({}, acc, { split: R.append('', acc.split) });
64
64
  }
65
65
  var dim = R.nth(dimIndex, dimensions);
66
- var value = R.nth(Number(valIndex), dim.values);
67
- if (!R.propOr(true, 'display', dim) || !R.propOr(true, 'display', value)) {
66
+ var values = R.propOr([], 'values', dim || {});
67
+ var value = R.nth(Number(valIndex), values);
68
+ if (!value || !R.propOr(true, 'display', dim) || !R.propOr(true, 'display', value)) {
68
69
  return (0, _extends3.default)({}, acc, { split: R.append('', acc.split) });
69
70
  }
70
71
  var dimLabel = dimensionValueDisplay(options.display)(dim);
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.13",
4
+ "version": "15.0.14",
5
5
  "main": "lib/index.js",
6
6
  "author": "OECD",
7
7
  "license": "MIT",
@@ -48,8 +48,9 @@ export const getSidebarData = (attributesSeries, metadataSeries, dataflow, dimen
48
48
  return ({ ...acc, split: R.append('', acc.split) });
49
49
  }
50
50
  const dim = R.nth(dimIndex, dimensions);
51
- const value = R.nth(Number(valIndex), dim.values);
52
- if (!R.propOr(true, 'display', dim) || !R.propOr(true, 'display', value)) {
51
+ const values = R.propOr([], 'values', dim || {});
52
+ const value = R.nth(Number(valIndex), values);
53
+ if (!value || !R.propOr(true, 'display', dim) || !R.propOr(true, 'display', value)) {
53
54
  return ({ ...acc, split: R.append('', acc.split) });
54
55
  }
55
56
  const dimLabel = dimensionValueDisplay(options.display)(dim);
@@ -113,6 +113,108 @@ describe('getSidebarData tests', () => {
113
113
  }
114
114
  ]);
115
115
  });
116
+ it('discordadnce between dimensions and metadata case', () => {
117
+ const attributes = {
118
+ '::': [
119
+ { id: 'aa0', label: 'advanced attribute 0', value: 'value' },
120
+ { id: 'aa1', label: 'advanced attribute 1', value: 'value' },
121
+ ],
122
+ '0::': [
123
+ { id: 'aa2', label: 'advanced attribute 2', value: 'value' },
124
+ { id: 'aa3', label: 'advanced attribute 3', value: 'value' },
125
+ ]
126
+ };
127
+ const metadata = {
128
+ '0::': [
129
+ { id: 'ma0', label: 'metadata attribute 0', value: 'value' },
130
+ { id: 'ma1', label: 'metadata attribute 1', value: 'value' },
131
+ ],
132
+ '0::0': [
133
+ { id: 'ma2', label: 'metadata attribute 2', value: 'value' },
134
+ { id: 'ma3', label: 'metadata attribute 3', value: 'value' },
135
+ ]
136
+ };
137
+ const options = {
138
+ display: 'code',
139
+ attributesLabel: 'Advanced Attributes'
140
+ };
141
+ const dataflow = {
142
+ id: 'DF',
143
+ name: 'Dataflow'
144
+ };
145
+ const dimensions = [
146
+ { id: 'd0', name: 'dimension 0', values: [{ id: 'd0v0', name: 'value 0' }] },
147
+ { id: 'd1', name: 'dimension 1', values: [{ id: 'd1v0', name: 'value 0' }] },
148
+ ];
149
+ expect(getSidebarData(attributes, metadata, dataflow, dimensions, options)).to.deep.equal([
150
+ {
151
+ id: '0::',
152
+ label: 'd0: d0v0',
153
+ splitCoord: ['0', '', ''],
154
+ children: [
155
+ {
156
+ id: '0::-attr',
157
+ label: 'Advanced Attributes',
158
+ children: [
159
+ {
160
+ id: 'aa2',
161
+ label: 'advanced attribute 2',
162
+ value: 'value'
163
+ },
164
+ {
165
+ id: 'aa3',
166
+ label: 'advanced attribute 3',
167
+ value: 'value'
168
+ }
169
+ ]
170
+ },
171
+ {
172
+ id: 'ma0',
173
+ label: 'metadata attribute 0',
174
+ value: 'value'
175
+ },
176
+ {
177
+ id: 'ma1',
178
+ label: 'metadata attribute 1',
179
+ value: 'value'
180
+ },
181
+ {
182
+ id: 'ma2',
183
+ label: 'metadata attribute 2',
184
+ value: 'value'
185
+ },
186
+ {
187
+ id: 'ma3',
188
+ label: 'metadata attribute 3',
189
+ value: 'value'
190
+ }
191
+ ]
192
+ },
193
+ {
194
+ id: '::',
195
+ label: 'DF',
196
+ splitCoord: ['', '', ''],
197
+ children: [
198
+ {
199
+ id: '::-attr',
200
+ label: 'Advanced Attributes',
201
+ children: [
202
+ {
203
+ id: 'aa0',
204
+ label: 'advanced attribute 0',
205
+ value: 'value'
206
+ },
207
+ {
208
+ id: 'aa1',
209
+ label: 'advanced attribute 1',
210
+ value: 'value'
211
+ }
212
+ ]
213
+ }
214
+ ]
215
+ }
216
+ ]);
217
+ });
116
218
  it('non displayed dimensions handling', () => {
117
219
  const attributes = {
118
220
  '::': [