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