@sis-cc/dotstatsuite-components 21.0.2 → 21.2.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.
@@ -61,7 +61,7 @@ import getISOWeek from "date-fns/get_iso_week";
61
61
  import makeStyles from "@mui/styles/makeStyles";
62
62
  import { useTheme } from "@mui/material/styles";
63
63
  const name$1 = "@sis-cc/dotstatsuite-components";
64
- const version$1 = "21.0.2";
64
+ const version$1 = "21.2.0";
65
65
  const meta$1 = {
66
66
  name: name$1,
67
67
  version: version$1
@@ -3787,6 +3787,7 @@ const parseMetadataSeries = (metadataJson, options2) => {
3787
3787
  ({ series: series2 = [], observation = [] }) => concat$1(series2, observation),
3788
3788
  (dims) => isEmpty$1(options2.dimensions || []) ? dims : props$1(pluck$1("id", options2.dimensions), indexBy$1(prop$1("id"), dims))
3789
3789
  )(metadataJson);
3790
+ const { notDisplayedIds = {} } = options2;
3790
3791
  const metadataSeries = pipe$1(
3791
3792
  pathOr$1({}, ["data", "dataSets", 0, "dimensionGroupAttributes"]),
3792
3793
  (series2) => reduce$1(
@@ -3812,7 +3813,8 @@ const parseMetadataSeries = (metadataJson, options2) => {
3812
3813
  addIndex$1(reduce$1)(
3813
3814
  (acc2, valueIndex, attrIndex) => {
3814
3815
  const attribute = nth$1(attrIndex, metadataAttributes);
3815
- if (isNil$1(valueIndex) && !attribute.isPresentational) {
3816
+ const isHidden = has$8(attribute.id, notDisplayedIds);
3817
+ if (isNil$1(valueIndex) && !attribute.isPresentational || isHidden) {
3816
3818
  return acc2;
3817
3819
  }
3818
3820
  const attrOptions = pathOr$1({}, ["attributes", attribute.id], options2);
@@ -4032,7 +4034,7 @@ const getMetadataCoordinates = (sdmxJson) => {
4032
4034
  return acc;
4033
4035
  }
4034
4036
  const dim = nth$1(dimIndex, dimensions);
4035
- if (isNil$1(dim)) {
4037
+ if (isNil$1(dim) || prop$1("rejected", dim)) {
4036
4038
  return acc;
4037
4039
  }
4038
4040
  const val = path$1(["values", Number(vIndex)], dim);
@@ -4553,7 +4555,7 @@ const getManyValuesDimensions = (dimensions, attributesSeries, customAttributes,
4553
4555
  const combConceptsIds = pipe$1(pluck$1("concepts"), unnest$1)(combinations);
4554
4556
  return reduce$1(
4555
4557
  (acc, dim) => {
4556
- if (dim.header || !length$3(dim.values)) {
4558
+ if (dim.header || dim.rejected) {
4557
4559
  return acc;
4558
4560
  }
4559
4561
  const enhancedValues = map$2((val) => {
@@ -4879,57 +4881,61 @@ const getLayoutPivots = (layoutEntry) => {
4879
4881
  layoutEntry
4880
4882
  );
4881
4883
  };
4882
- const comparator$1 = (a, b) => {
4883
- const size2 = length$3(a);
4884
+ const comparator$1 = (firstSerie, secondSerie) => {
4885
+ const firstIndexes = firstSerie.indexes;
4886
+ const secondIndexes = secondSerie.indexes;
4887
+ const size2 = length$3(firstIndexes);
4884
4888
  let i = 0;
4885
4889
  while (i < size2) {
4886
- if (is$1(Array, a[i])) {
4887
- const _a = a[i];
4888
- const _b = b[i];
4889
- const _size = length$3(_a);
4890
+ if (is$1(Array, firstIndexes[i])) {
4891
+ const firstSubIndexes = firstIndexes[i];
4892
+ const secondSubIndexes = secondIndexes[i];
4893
+ const _size = length$3(firstSubIndexes);
4890
4894
  let j = 0;
4891
- while (_a[j] === _b[j] && j < _size) {
4895
+ while (firstSubIndexes[j] === secondSubIndexes[j] && j < _size) {
4892
4896
  j++;
4893
4897
  }
4894
- if (_a[j] !== _b[j]) {
4895
- return _a[j] - _b[j];
4898
+ if (firstSubIndexes[j] !== secondSubIndexes[j]) {
4899
+ return firstSubIndexes[j] - secondSubIndexes[j];
4896
4900
  }
4897
- } else if (a[i] !== b[i]) {
4898
- return a[i] - b[i];
4901
+ } else if (firstIndexes[i] !== secondIndexes[i]) {
4902
+ return firstIndexes[i] - secondIndexes[i];
4899
4903
  }
4900
4904
  i++;
4901
4905
  }
4902
- return a[i] - b[i];
4906
+ return firstIndexes[i] - secondIndexes[i];
4903
4907
  };
4904
- const uniqIndexes = (indexes) => pipe$1(
4908
+ const uniqIndexes = pipe$1(
4905
4909
  reduce$1(
4906
- (acc, i) => {
4907
- const key = join$1(":", unnest$1(i));
4908
- if (has$8(key, acc.keys)) {
4909
- return acc;
4910
- }
4911
- return {
4912
- indexes: append$1(i, acc.indexes),
4913
- keys: assoc$1(key, key, acc.keys)
4914
- };
4910
+ (acc, { indexes, rejected }) => {
4911
+ const key = join$1(":", unnest$1(indexes));
4912
+ if (has$8(key, acc)) {
4913
+ return over$1(
4914
+ lensPath$1([key, "rejected"]),
4915
+ addIndex$1(map$2)((v, i) => v === nth$1(i, rejected) ? v : null)
4916
+ )(acc);
4917
+ }
4918
+ return assoc$1(key, { indexes, rejected, key }, acc);
4915
4919
  },
4916
- { indexes: [], keys: {} }
4920
+ {}
4917
4921
  ),
4918
- prop$1("indexes")
4919
- )(indexes);
4920
- const getSortedLayoutIndexes = (layout, observations) => {
4922
+ values$1
4923
+ );
4924
+ const getSortedLayoutIndexes = (layout, observations, rejectedDims = []) => {
4921
4925
  const dimIndexes = pipe$1(values$1, map$2(propOr$1([], "orderedDimIndexes")))(observations);
4922
4926
  const headerPivots = getLayoutPivots(layout.header);
4923
4927
  const sectionsPivots = getLayoutPivots(concat$1(layout.sections, layout.rows));
4928
+ const rejectedPivots = getLayoutPivots(rejectedDims);
4924
4929
  const sectionLength = length$3(layout.sections);
4925
4930
  const { header: header2, sections } = pipe$1(
4926
4931
  reduce$1(
4927
4932
  (acc, indexes) => {
4928
4933
  const headerIndexes = headerPivots(indexes);
4929
4934
  const sectionsIndexes = sectionsPivots(indexes);
4935
+ const rejectedIndexes = rejectedPivots(indexes);
4930
4936
  return {
4931
- header: append$1(headerIndexes, acc.header),
4932
- sections: append$1(sectionsIndexes, acc.sections)
4937
+ header: append$1({ indexes: headerIndexes, rejected: rejectedIndexes }, acc.header),
4938
+ sections: append$1({ indexes: sectionsIndexes, rejected: rejectedIndexes }, acc.sections)
4933
4939
  };
4934
4940
  },
4935
4941
  { header: [], sections: [] }
@@ -4942,16 +4948,26 @@ const getSortedLayoutIndexes = (layout, observations) => {
4942
4948
  (indexes) => ({
4943
4949
  ...indexes,
4944
4950
  sections: reduce$1(
4945
- (acc, i) => {
4946
- const [sectionIndexes, rowIndexes] = splitAt$1(sectionLength, i);
4947
- const previousSecIndexes = pipe$1(nth$1(-1), (i2) => isNil$1(i2) ? null : head$1(i2))(acc);
4948
- if (equals$1(unnest$1(sectionIndexes), previousSecIndexes ? unnest$1(previousSecIndexes) : null)) {
4951
+ (acc, { indexes: indexes2, rejected, key }) => {
4952
+ const [sectionIndexes, rowIndexes] = splitAt$1(sectionLength, indexes2);
4953
+ const sectionKey = join$1(":", sectionIndexes);
4954
+ const previousSecKey = pipe$1(nth$1(-1), (v) => isNil$1(v) ? null : head$1(v).key)(acc);
4955
+ if (equals$1(sectionKey, previousSecKey)) {
4949
4956
  return over$1(
4950
4957
  lensIndex$1(-1),
4951
- over$1(lensIndex$1(1), append$1(rowIndexes))
4958
+ pipe$1(
4959
+ over$1(lensIndex$1(1), append$1({ indexes: rowIndexes, rejected, key })),
4960
+ over$1(lensIndex$1(0), (v) => ({
4961
+ ...v,
4962
+ rejected: addIndex$1(map$2)((val, i) => val === nth$1(i, rejected) ? val : null, v.rejected)
4963
+ }))
4964
+ )
4952
4965
  )(acc);
4953
4966
  }
4954
- return append$1([sectionIndexes, [rowIndexes]], acc);
4967
+ return append$1([
4968
+ { indexes: sectionIndexes, rejected, key: sectionKey },
4969
+ [{ indexes: rowIndexes, rejected, key }]
4970
+ ], acc);
4955
4971
  },
4956
4972
  [],
4957
4973
  indexes.sections
@@ -5298,6 +5314,9 @@ const getCoordinates = (indexes, topCoordinates, definition) => addIndex$1(reduc
5298
5314
  }, acc, entry.dimensions);
5299
5315
  }
5300
5316
  const valInd = nth$1(index2, indexes);
5317
+ if (isNil$1(valInd)) {
5318
+ return acc;
5319
+ }
5301
5320
  return assoc$1(entry.id, path$1(["values", Math.abs(valInd), "id"], entry), acc);
5302
5321
  }, topCoordinates, definition);
5303
5322
  const getAttributesSeries = (validator, attributesSeries) => reduce$1((acc, attrs) => {
@@ -5379,9 +5398,10 @@ const getSerieDimensionsData = (serie2, definition, attributesValues, missingPar
5379
5398
  { data: [], key: "", attributes: attributesValues },
5380
5399
  definition
5381
5400
  );
5382
- const getSerieDataWithMissingLines = (serie2, definition, topCoordinates, attributesSeries, customAttributes, metadataCoordinates) => {
5401
+ const getSerieDataWithMissingLines = (serie2, definition, topCoordinates, attributesSeries, customAttributes, metadataCoordinates, rejectedDims = []) => {
5383
5402
  const lines2 = [];
5384
- const serieCoordinates = getCoordinates(serie2.indexes, topCoordinates, definition);
5403
+ const coordinates2 = getCoordinates(serie2.indexes, topCoordinates, definition);
5404
+ const serieCoordinates = getCoordinates(serie2.rejected || [], coordinates2, rejectedDims);
5385
5405
  const coordinatesValidator = getLayoutCoordinatesValidator(serieCoordinates, topCoordinates);
5386
5406
  const attributesValues = getAttributesSeries(coordinatesValidator, attributesSeries);
5387
5407
  const getMissingParents = (dataSetter) => (missingParentsIndexes, _parentsIndexes, dim, serieData2) => reduce$1(
@@ -5395,12 +5415,13 @@ const getSerieDataWithMissingLines = (serie2, definition, topCoordinates, attrib
5395
5415
  );
5396
5416
  const { attributes, ...serieData } = getSerieDimensionsData(serie2, definition, attributesValues, getMissingParents);
5397
5417
  const topCoordinatesValidator = getLayoutCoordinatesValidator(topCoordinates);
5398
- const flagsValidator = (coordinates2) => coordinatesValidator(coordinates2) && !topCoordinatesValidator(coordinates2);
5418
+ const flagsValidator = (coordinates22) => coordinatesValidator(coordinates22) && !topCoordinatesValidator(coordinates22);
5399
5419
  const { flags, sideProps } = getSerieFlagsAndSideProps(serieCoordinates, flagsValidator, attributes, customAttributes, metadataCoordinates, serieData.data);
5400
5420
  return append$1({ ...serieData, flags, sideProps, coordinates: serieCoordinates }, lines2);
5401
5421
  };
5402
- const getSerieDataWithoutMissingLines = (serie2, definition, topCoordinates, attributesSeries, customAttributes, metadataCoordinates) => {
5403
- const serieCoordinates = getCoordinates(serie2.indexes, topCoordinates, definition);
5422
+ const getSerieDataWithoutMissingLines = (serie2, definition, topCoordinates, attributesSeries, customAttributes, metadataCoordinates, rejectedDims = []) => {
5423
+ const coordinates2 = getCoordinates(serie2.indexes, topCoordinates, definition);
5424
+ const serieCoordinates = getCoordinates(serie2.rejected || [], coordinates2, rejectedDims);
5404
5425
  const coordinatesValidator = getLayoutCoordinatesValidator(serieCoordinates, topCoordinates);
5405
5426
  const attributesValues = getAttributesSeries(coordinatesValidator, attributesSeries);
5406
5427
  const getMissingParents = () => (missingParentsIndexes, _parentsIndexes, dim) => reduce$1(
@@ -5415,19 +5436,19 @@ const getSerieDataWithoutMissingLines = (serie2, definition, topCoordinates, att
5415
5436
  const { flags, sideProps } = getSerieFlagsAndSideProps(serieCoordinates, coordinatesValidator, attributes, customAttributes, metadataCoordinates, serieData.data);
5416
5437
  return { ...serieData, flags, sideProps, coordinates: serieCoordinates };
5417
5438
  };
5418
- const getLayoutData = (layoutIndexes, layout, { metadataCoordinates, attributesSeries, customAttributes, topCoordinates = {} }) => {
5439
+ const getLayoutData = (layoutIndexes, layout, { metadataCoordinates, attributesSeries, customAttributes, topCoordinates = {}, rejectedDimensions = [] }) => {
5419
5440
  const { header: header2, sections, ...rest } = layoutIndexes;
5420
5441
  const headerData = reduce$1((acc, serie2) => {
5421
- const datas = getSerieDataWithMissingLines(serie2, layout.header, topCoordinates, attributesSeries, customAttributes, metadataCoordinates);
5442
+ const datas = getSerieDataWithMissingLines(serie2, layout.header, topCoordinates, attributesSeries, customAttributes, metadataCoordinates, rejectedDimensions);
5422
5443
  return concat$1(acc, datas);
5423
5444
  }, [], header2);
5424
5445
  const sectionsData = map$2(
5425
5446
  ([sectionSerie, rowsSeries]) => {
5426
- const sectionData = getSerieDataWithoutMissingLines(sectionSerie, layout.sections, topCoordinates, attributesSeries, customAttributes, metadataCoordinates);
5447
+ const sectionData = getSerieDataWithoutMissingLines(sectionSerie, layout.sections, topCoordinates, attributesSeries, customAttributes, metadataCoordinates, rejectedDimensions);
5427
5448
  return [
5428
5449
  sectionData,
5429
5450
  reduce$1((acc, serie2) => {
5430
- const datas = getSerieDataWithMissingLines(serie2, layout.rows, propOr$1(topCoordinates, "coordinates", sectionData), attributesSeries, customAttributes, metadataCoordinates);
5451
+ const datas = getSerieDataWithMissingLines(serie2, layout.rows, propOr$1(topCoordinates, "coordinates", sectionData), attributesSeries, customAttributes, metadataCoordinates, rejectedDimensions);
5431
5452
  return concat$1(acc, datas);
5432
5453
  }, [], rowsSeries)
5433
5454
  ];
@@ -5766,6 +5787,7 @@ const prepareData$1 = (sdmxJson, { customAttributes, locale, hierarchies, datafl
5766
5787
  const attributesSeries = getAttributesSeries$1(enhancedObservations);
5767
5788
  const manyValuesDimensions = getManyValuesDimensions(refinedDimensions, attributesSeries, customAttributes, seriesCombinations);
5768
5789
  const oneValueDimensions = getOneValueDimensions(refinedDimensions, parsedAttributes);
5790
+ const rejectedDimensions = filter$1(prop$1("rejected", dimensions));
5769
5791
  const headerCoordinates = getHeaderCoordinates(oneValueDimensions);
5770
5792
  const hierarchisedDimensions = map$2((dim) => {
5771
5793
  if (isEmpty$1(propOr$1({}, dim.id, hierarchies))) {
@@ -5786,6 +5808,7 @@ const prepareData$1 = (sdmxJson, { customAttributes, locale, hierarchies, datafl
5786
5808
  attributesSeries,
5787
5809
  metadataCoordinates,
5788
5810
  attributes: refinedAttributes,
5811
+ rejectedDimensions,
5789
5812
  header: {
5790
5813
  title: headerTitle,
5791
5814
  subtitle: headerSubtitle,
@@ -5865,10 +5888,10 @@ const parseSerieIndexesHierarchies = (serieIndexes, previousSerie, dimensions, i
5865
5888
  }, { parentsIndexes: [], missingIndexes: [], isSameSerie }, serieIndexes);
5866
5889
  };
5867
5890
  const parseSeriesIndexesHierarchies = (seriesIndexes, dimensions, replicateMissing = false) => {
5868
- return reduce$1((acc, serieIndexes) => {
5891
+ return reduce$1((acc, { indexes, ...rest }) => {
5869
5892
  const previousSerie = last$1(acc) || {};
5870
- const { isSameSerie, ...parsed } = parseSerieIndexesHierarchies(serieIndexes, previousSerie, dimensions, true, replicateMissing);
5871
- return append$1(assoc$1("indexes", serieIndexes, parsed), acc);
5893
+ const { isSameSerie, ...parsed } = parseSerieIndexesHierarchies(indexes, previousSerie, dimensions, true, replicateMissing);
5894
+ return append$1({ indexes, ...parsed, ...rest }, acc);
5872
5895
  }, [], seriesIndexes);
5873
5896
  };
5874
5897
  const parseLayoutIndexesHierarchies = (layoutIndexes, layout) => {
@@ -5895,7 +5918,8 @@ const getTableProps = ({ data, layoutIds, customAttributes, limit, isTimeInverte
5895
5918
  attributesSeries,
5896
5919
  metadataCoordinates,
5897
5920
  attributes,
5898
- header: header2
5921
+ header: header2,
5922
+ rejectedDimensions = []
5899
5923
  } = data;
5900
5924
  const obsAttributes = filter$1(
5901
5925
  (a) => a.series && isEmpty$1(a.relationship) && a.display && !a.combined,
@@ -5926,13 +5950,19 @@ const getTableProps = ({ data, layoutIds, customAttributes, limit, isTimeInverte
5926
5950
  }
5927
5951
  return append$1(entry.id, acc);
5928
5952
  }, []), layout);
5929
- const layoutIndexes = getSortedLayoutIndexes(layout, dupObs);
5953
+ const layoutIndexes = getSortedLayoutIndexes(layout, dupObs, rejectedDimensions);
5930
5954
  const enhancedLayoutIndexes = parseLayoutIndexesHierarchies(
5931
5955
  layoutIndexes,
5932
5956
  layout
5933
5957
  );
5934
5958
  const refinedLayoutIndexes = refineLayoutSize({ layout, observations: dupObs, limit })(enhancedLayoutIndexes);
5935
- const layoutData = getLayoutData(refinedLayoutIndexes, layout, { metadataCoordinates, attributesSeries, customAttributes, topCoordinates: header2.coordinates });
5959
+ const layoutData = getLayoutData(refinedLayoutIndexes, layout, {
5960
+ metadataCoordinates,
5961
+ attributesSeries,
5962
+ customAttributes,
5963
+ topCoordinates: header2.coordinates,
5964
+ rejectedDimensions
5965
+ });
5936
5966
  const cellsAttributesIds = getCellsAttributesIds(layoutDimsIds, attributes);
5937
5967
  const indexedCombinations = getIndexedCombinationsByDisplay(layout, seriesCombinations);
5938
5968
  const cellsMetadataCoordinates = getCellsMetadataCoordinates(metadataCoordinates, oneValueDimensions, layoutDimsIds);
@@ -6713,10 +6743,11 @@ const dataTransformer = (dataNew, options2 = {}) => {
6713
6743
  return {
6714
6744
  observation: append$1({
6715
6745
  ...observation2,
6746
+ rejected: isAllDimHidden,
6716
6747
  display: !isHidden,
6717
6748
  __index: obsIndex,
6718
6749
  name: getName2(observation2),
6719
- values: isAllDimHidden ? [] : values4,
6750
+ values: values4,
6720
6751
  role: isTimeDimension ? TIME_PERIOD_ID : head$1(propOr$1([], "roles", observation2))
6721
6752
  })(acc.observation),
6722
6753
  dimensionsLayout: setAnnotationsLayout(
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": "21.0.2",
4
+ "version": "21.2.0",
5
5
  "type": "module",
6
6
  "module": "./dist/dotstatsuite-components.js",
7
7
  "files": [