@sis-cc/dotstatsuite-components 21.3.0 → 21.5.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.
@@ -1,4 +1,4 @@
1
- import { get as get$2, isEmpty as isEmpty$2, isNil as isNil$2, reduce as reduce$2, has as has$9, sortBy as sortBy$2, map as map$3, head as head$2, split as split$2, omit as omit$2, keys as keys$2, each, isArray as isArray$1, find as find$2, findIndex as findIndex$1, reject as reject$2, filter as filter$2, includes as includes$2, isUndefined, fill, size, take as take$2, transform as transform$2, pick as pick$2, partition as partition$2, keyBy, flatten as flatten$3, compact, isEqual } from "lodash";
1
+ import { get as get$2, isEmpty as isEmpty$2, isNil as isNil$2, reduce as reduce$2, has as has$9, sortBy as sortBy$2, map as map$3, head as head$2, split as split$2, omit as omit$2, keys as keys$2, each, isArray as isArray$1, findIndex as findIndex$2, fill, size, find as find$2, isUndefined, reject as reject$2, take as take$2, transform as transform$2, pick as pick$2, partition as partition$2, filter as filter$2, keyBy, includes as includes$2, flatten as flatten$3, compact, isEqual } from "lodash";
2
2
  import memoizee from "memoizee";
3
3
  import numeral from "numeral";
4
4
  import { isRefAreaDimension, isTimePeriodDimension, getTimePeriodDimension, getRefAreaDimension, getDataFrequency, getNotDisplayedCombinations, getCodeOrder } from "@sis-cc/dotstatsuite-sdmxjs";
@@ -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.3.0";
64
+ const version$1 = "21.5.0";
65
65
  const meta$1 = {
66
66
  name: name$1,
67
67
  version: version$1
@@ -1542,6 +1542,44 @@ var find$1 = /* @__PURE__ */ _curry2$c(/* @__PURE__ */ _dispatchable$1(["find"],
1542
1542
  idx += 1;
1543
1543
  }
1544
1544
  }));
1545
+ var XFindIndex$1 = /* @__PURE__ */ function() {
1546
+ function XFindIndex2(f, xf) {
1547
+ this.xf = xf;
1548
+ this.f = f;
1549
+ this.idx = -1;
1550
+ this.found = false;
1551
+ }
1552
+ XFindIndex2.prototype["@@transducer/init"] = _xfBase$1.init;
1553
+ XFindIndex2.prototype["@@transducer/result"] = function(result) {
1554
+ if (!this.found) {
1555
+ result = this.xf["@@transducer/step"](result, -1);
1556
+ }
1557
+ return this.xf["@@transducer/result"](result);
1558
+ };
1559
+ XFindIndex2.prototype["@@transducer/step"] = function(result, input) {
1560
+ this.idx += 1;
1561
+ if (this.f(input)) {
1562
+ this.found = true;
1563
+ result = _reduced$1(this.xf["@@transducer/step"](result, this.idx));
1564
+ }
1565
+ return result;
1566
+ };
1567
+ return XFindIndex2;
1568
+ }();
1569
+ var _xfindIndex$1 = /* @__PURE__ */ _curry2$c(function _xfindIndex(f, xf) {
1570
+ return new XFindIndex$1(f, xf);
1571
+ });
1572
+ var findIndex$1 = /* @__PURE__ */ _curry2$c(/* @__PURE__ */ _dispatchable$1([], _xfindIndex$1, function findIndex(fn, list) {
1573
+ var idx = 0;
1574
+ var len = list.length;
1575
+ while (idx < len) {
1576
+ if (fn(list[idx])) {
1577
+ return idx;
1578
+ }
1579
+ idx += 1;
1580
+ }
1581
+ return -1;
1582
+ }));
1545
1583
  var XFindLastIndex$1 = /* @__PURE__ */ function() {
1546
1584
  function XFindLastIndex2(f, xf) {
1547
1585
  this.xf = xf;
@@ -2158,48 +2196,50 @@ function focus$3(series2, focusSelections) {
2158
2196
  return [{ ...serie2, datapoints: _datapoints }];
2159
2197
  }
2160
2198
  function dimensionValueIsValid(dimensionValue, chartDimension) {
2161
- return includes$2(
2162
- map$3(["x", "y"], (k2) => get$2(chartDimension, `${k2}Id`)),
2163
- get$2(dimensionValue, "id")
2199
+ return includes$1(
2200
+ prop$1("id", dimensionValue),
2201
+ map$2((k2) => prop$1(`${k2}Id`, chartDimension), ["x", "y"])
2164
2202
  );
2165
2203
  }
2166
2204
  function getDimensionValues$2(dimensionValuesIndexes, dimensions, dimensionsWithValuesIndexedById2, chartDimensionId, display) {
2167
- const dimensionsWithValuesIds = keys$2(dimensionsWithValuesIndexedById2);
2168
- return reduce$2(
2169
- dimensionValuesIndexes,
2170
- (m, dvi, i) => {
2171
- const dimension = get$2(dimensions, `[${i}]`);
2172
- const dimensionId = get$2(dimension, "id");
2173
- const dimensionValue = get$2(dimension, `values[${dvi}]`);
2174
- if (dimensionId !== chartDimensionId && includes$2(dimensionsWithValuesIds, dimensionId)) {
2175
- m[dimensionId] = { ...dimensionValue, name: dimensionValueDisplay$1(display)(dimensionValue) };
2205
+ const dimensionsWithValuesIds = keys$1(dimensionsWithValuesIndexedById2);
2206
+ return addIndex$1(reduce$1)(
2207
+ (acc, dvi, i) => {
2208
+ const dimension = nth$1(i, dimensions);
2209
+ const dimensionId = prop$1("id", dimension);
2210
+ const dimensionValue = nth$1(dvi, propOr$1([], "values", dimension || {}));
2211
+ if (dimensionId !== chartDimensionId && includes$1(dimensionId, dimensionsWithValuesIds)) {
2212
+ return assoc$1(
2213
+ dimensionId,
2214
+ { ...dimensionValue, name: dimensionValueDisplay$1(display)(dimensionValue) },
2215
+ acc
2216
+ );
2176
2217
  }
2177
- return m;
2218
+ return acc;
2178
2219
  },
2179
- {}
2220
+ {},
2221
+ dimensionValuesIndexes
2180
2222
  );
2181
2223
  }
2182
2224
  function getDimensionValueKey(chartDimension, dimensionValue) {
2183
- return get$2(chartDimension, "xId") === get$2(dimensionValue, "id") ? "x" : "y";
2225
+ return prop$1("xId", chartDimension) === prop$1("id", dimensionValue) ? "x" : "y";
2184
2226
  }
2185
2227
  function datapoints(observations, dimensions, dimensionsWithValuesIndexedById2, chartDimension, display, formaterAttrs) {
2186
- const chartDimensionId = get$2(chartDimension, "id");
2187
- const chartDimensionIndex = findIndex$1(dimensions, { id: chartDimensionId });
2188
- const datapoints2 = reduce$2(
2189
- observations,
2190
- (m, o3, k2) => {
2191
- const oDimensionValuesIndexes = split$2(k2, ":");
2228
+ const chartDimensionId = prop$1("id", chartDimension);
2229
+ const chartDimensionIndex = findIndex$1(propEq$1("id", chartDimensionId), dimensions);
2230
+ const datapoints2 = reduce$1(
2231
+ (acc, k2) => {
2232
+ const o3 = prop$1(k2, observations);
2233
+ const oDimensionValuesIndexes = split$1(":", k2);
2192
2234
  const oDimensionValueIndex = oDimensionValuesIndexes[chartDimensionIndex];
2193
- const oDimensionValue = get$2(
2194
- dimensions,
2195
- `[${chartDimensionIndex}].values[${oDimensionValueIndex}]`
2196
- );
2235
+ const _chartDimension = nth$1(chartDimensionIndex, dimensions);
2236
+ const oDimensionValue = nth$1(oDimensionValueIndex, propOr$1([], "values", _chartDimension || {}));
2197
2237
  if (dimensionValueIsValid(oDimensionValue, chartDimension)) {
2198
- const oPartialKey = reject$2(
2199
- oDimensionValuesIndexes,
2200
- (o22, i) => i === chartDimensionIndex
2201
- ).join("");
2202
- if (!has$9(m, oPartialKey)) {
2238
+ const oPartialKey = pipe$1(
2239
+ addIndex$1(reject$1)((_2, i) => i === chartDimensionIndex),
2240
+ join$1(":")
2241
+ )(oDimensionValuesIndexes);
2242
+ if (!has$8(oPartialKey, acc)) {
2203
2243
  const dimensionValues = getDimensionValues$2(
2204
2244
  oDimensionValuesIndexes,
2205
2245
  dimensions,
@@ -2207,26 +2247,26 @@ function datapoints(observations, dimensions, dimensionsWithValuesIndexedById2,
2207
2247
  chartDimensionId,
2208
2248
  display
2209
2249
  );
2210
- m[oPartialKey] = { dimensionValues };
2250
+ acc[oPartialKey] = { dimensionValues };
2211
2251
  }
2212
2252
  const dimensionValueKey = getDimensionValueKey(chartDimension, oDimensionValue);
2213
- m[oPartialKey][dimensionValueKey] = head$2(o3);
2214
- m[oPartialKey][`${dimensionValueKey}Format`] = getFormatedObservation(o3, formaterAttrs);
2253
+ acc[oPartialKey][dimensionValueKey] = head$1(o3);
2254
+ acc[oPartialKey][`${dimensionValueKey}Format`] = getFormatedObservation(o3, formaterAttrs);
2215
2255
  }
2216
- return m;
2256
+ return acc;
2217
2257
  },
2218
- {}
2219
- );
2220
- return filter$2(
2221
- datapoints2,
2222
- (dp) => !isNil$2(dp.x) && !isNil$2(dp.y)
2258
+ {},
2259
+ keys$1(observations)
2223
2260
  );
2261
+ return pipe$1(
2262
+ filter$1((dp) => !isNil$1(dp.x) && !isNil$1(dp.y)),
2263
+ values$1
2264
+ )(datapoints2);
2224
2265
  }
2225
2266
  const series$3 = (observations, dimensions, dimensionsWithValuesIndexedById2, chartDimension, display, formaterAttrs) => {
2226
- const xValues = get$2(dimensionsWithValuesIndexedById2, `${get$2(chartDimension, "id")}.values`, []);
2227
- const yValues = get$2(dimensionsWithValuesIndexedById2, `${get$2(chartDimension, "id")}.values`, []);
2228
- const xValue = find$2(xValues, { id: get$2(chartDimension, "xId") });
2229
- const yValue = find$2(yValues, { id: get$2(chartDimension, "yId") });
2267
+ const values4 = pipe$1(prop$1(prop$1("id", chartDimension || {})), propOr$1([], "values"))(dimensionsWithValuesIndexedById2);
2268
+ const xValue = find$1(propEq$1("id", prop$1("xId", chartDimension)), values4);
2269
+ const yValue = find$1(propEq$1("id", prop$1("yId", chartDimension)), values4);
2230
2270
  return [{
2231
2271
  dimensionValues: {
2232
2272
  x: { ...xValue, name: dimensionValueDisplay$1(display)(xValue) },
@@ -2262,31 +2302,32 @@ function focus$2(series2, focusSelections) {
2262
2302
  });
2263
2303
  return [{ ...serie2, datapoints: __datapoints }];
2264
2304
  }
2265
- const __scatterDimension = (dimensions, ids) => {
2266
- if (isEmpty$2(dimensions)) return;
2305
+ const __scatterDimension = (dimensions, { id: id2, xId, yId }) => {
2306
+ if (isEmpty$1(dimensions))
2307
+ return;
2267
2308
  let chartDimension;
2268
- const id2 = get$2(ids, "id");
2269
- if (!isNil$2(id2)) chartDimension = find$2(dimensions, { id: id2 });
2270
- if (isUndefined(chartDimension)) {
2271
- const _dimensions = reject$2(dimensions, isRefAreaDimension);
2272
- chartDimension = head$2(isEmpty$2(_dimensions) ? dimensions : _dimensions);
2273
- }
2274
- const chartDimensionId = get$2(chartDimension, "id");
2275
- const values4 = get$2(chartDimension, "values", []);
2276
- const xValue = find$2(values4, (value) => value.id === get$2(ids, "xId", null));
2277
- const yValue = find$2(values4, (value) => value.id === get$2(ids, "yId", null) && value.id !== xId);
2278
- const xId = isUndefined(xValue) ? head$2(isUndefined(yValue) ? values4 : reject$2(values4, yValue)).id : xValue.id;
2279
- const yId = isUndefined(yValue) ? find$2(values4, (value) => value.id !== xId).id : yValue.id;
2309
+ if (!isNil$1(id2))
2310
+ chartDimension = find$1(propEq$1("id", id2), dimensions);
2311
+ if (isNil$1(chartDimension)) {
2312
+ const _dimensions = reject$1(isRefAreaDimension, dimensions);
2313
+ chartDimension = head$1(isEmpty$1(_dimensions) ? dimensions : _dimensions);
2314
+ }
2315
+ const chartDimensionId = prop$1("id", chartDimension || {});
2316
+ const values4 = propOr$1([], "values", chartDimension || {});
2317
+ const xValue = find$1(propEq$1("id", xId), values4);
2318
+ const yValue = find$1((v) => propEq$1("id", yId, v) && v.id !== xId, values4);
2319
+ const _xId = isNil$1(xValue) ? pipe$1(reject$1(propEq$1("id", prop$1("id", yValue || {}))), head$1, prop$1("id"))(values4) : xValue.id;
2320
+ const _yId = isNil$1(yValue) ? pipe$1(find$1((v) => v.id !== _xId), prop$1("id"))(values4) : yValue.id;
2280
2321
  return {
2281
2322
  id: chartDimensionId,
2282
- xId,
2283
- yId
2323
+ xId: _xId,
2324
+ yId: _yId
2284
2325
  };
2285
2326
  };
2286
2327
  const series$2 = (observations, dimensions, dimensionsWithValuesIndexedById2, symbolDimension2, sortDirection, display, formaterAttrs) => {
2287
2328
  const symbolDimensionId = get$2(symbolDimension2, "id", null);
2288
2329
  if (symbolDimensionId === null) return [];
2289
- const symbolDimensionIndex = findIndex$1(dimensions, (d) => d.id === symbolDimensionId);
2330
+ const symbolDimensionIndex = findIndex$2(dimensions, (d) => d.id === symbolDimensionId);
2290
2331
  const datapoints2 = sortBy$2(
2291
2332
  reduce$2(
2292
2333
  observations,
@@ -2297,13 +2338,13 @@ const series$2 = (observations, dimensions, dimensionsWithValuesIndexedById2, sy
2297
2338
  const oDimensionValuesIndexes = split$2(observationKey, ":");
2298
2339
  const oSymbolDimensionValueIndex = Number(oDimensionValuesIndexes[symbolDimensionIndex]);
2299
2340
  const oSymbolDimensionValueId = dimensions[symbolDimensionIndex].values[oSymbolDimensionValueIndex].id;
2300
- const symbolIndex = findIndex$1(symbolDimension2.serie, (v) => v.id === oSymbolDimensionValueId);
2341
+ const symbolIndex = findIndex$2(symbolDimension2.serie, (v) => v.id === oSymbolDimensionValueId);
2301
2342
  if (symbolIndex === -1) {
2302
2343
  return memo;
2303
2344
  }
2304
2345
  const category = categoryDisplay(oDimensionValuesIndexes, dimensions, dimensionsWithValuesIndexedById2, symbolDimensionId, display);
2305
2346
  const ids = categoryDisplay(oDimensionValuesIndexes, dimensions, dimensionsWithValuesIndexedById2, symbolDimensionId, "code");
2306
- let dpIndex = findIndex$1(memo, (dp) => dp.key === ids);
2347
+ let dpIndex = findIndex$2(memo, (dp) => dp.key === ids);
2307
2348
  let dpValues = dpIndex === -1 ? fill(Array(size(symbolDimension2.serie)), null) : memo[dpIndex].values;
2308
2349
  let dpFormatedValues = dpIndex === -1 ? fill(Array(size(symbolDimension2.serie)), null) : memo[dpIndex].formatedValues;
2309
2350
  dpValues[oSymbolDimensionValueIndex] = head$2(observationValue);
@@ -2412,7 +2453,7 @@ const series$1 = (observations, dimensions, dimensionsWithValuesIndexedById2, ti
2412
2453
  if (isNil$2(key) || isEmpty$2(key)) {
2413
2454
  key = "uniq-dp";
2414
2455
  }
2415
- const serieIndex = findIndex$1(memo, (serie2) => serie2.key === key);
2456
+ const serieIndex = findIndex$2(memo, (serie2) => serie2.key === key);
2416
2457
  if (serieIndex !== -1) memo[serieIndex].datapoints.push(datapoint);
2417
2458
  else memo.push({ datapoints: [datapoint], category, key });
2418
2459
  return memo;
@@ -2450,7 +2491,7 @@ function focus$1(series2, focusSelections) {
2450
2491
  (serie2, index2) => {
2451
2492
  each(focusSelections, (focusSelection, focusKey) => {
2452
2493
  const _focusKey = `${focusKey}Index`;
2453
- const res = findIndex$1(
2494
+ const res = findIndex$2(
2454
2495
  isArray$1(focusSelection) ? focusSelection : [focusSelection],
2455
2496
  (focus2) => focus2.value === serie2.key
2456
2497
  );
@@ -7298,7 +7339,7 @@ const getTopologyAreasCollections = memoizee(_getTopologyAreasCollections);
7298
7339
  const _isNonIdealState = (data, type4, map22) => {
7299
7340
  const defaultSeries = series(data, type4, null, null, map22);
7300
7341
  if (type4 === "ChoroplethChart") {
7301
- return findIndex$1(get$2(defaultSeries, "objects.areas.geometries", []), (geometry) => get$2(geometry, "properties.value", null)) === -1;
7342
+ return findIndex$2(get$2(defaultSeries, "objects.areas.geometries", []), (geometry) => get$2(geometry, "properties.value", null)) === -1;
7302
7343
  }
7303
7344
  return isEmpty$2(get$2(defaultSeries, "[0].datapoints", []));
7304
7345
  };
@@ -20075,11 +20116,11 @@ var XFindIndex = /* @__PURE__ */ function() {
20075
20116
  };
20076
20117
  return XFindIndex2;
20077
20118
  }();
20078
- var _xfindIndex = /* @__PURE__ */ _curry2$b(function _xfindIndex2(f, xf) {
20119
+ var _xfindIndex2 = /* @__PURE__ */ _curry2$b(function _xfindIndex3(f, xf) {
20079
20120
  return new XFindIndex(f, xf);
20080
20121
  });
20081
- var findIndex = /* @__PURE__ */ _curry2$b(
20082
- /* @__PURE__ */ _dispatchable([], _xfindIndex, function findIndex2(fn, list) {
20122
+ var findIndex2 = /* @__PURE__ */ _curry2$b(
20123
+ /* @__PURE__ */ _dispatchable([], _xfindIndex2, function findIndex3(fn, list) {
20083
20124
  var idx = 0;
20084
20125
  var len = list.length;
20085
20126
  while (idx < len) {
@@ -21273,7 +21314,7 @@ const es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
21273
21314
  evolve: evolve2,
21274
21315
  filter,
21275
21316
  find: find2,
21276
- findIndex,
21317
+ findIndex: findIndex2,
21277
21318
  findLast,
21278
21319
  findLastIndex: findLastIndex2,
21279
21320
  flatten: flatten$1,
@@ -38044,10 +38085,12 @@ const Viewer = ({ type: type4, targets = {}, width, ...rest }) => {
38044
38085
  "div",
38045
38086
  {
38046
38087
  ...targets.viewer ? { ref: targets.viewer } : {},
38047
- className: [
38048
- classes.container,
38049
- type4 === "table" ? classes.tableContainer : classes.chartContainer
38050
- ],
38088
+ className: join$1(" ")(
38089
+ [
38090
+ classes.container,
38091
+ type4 === "table" ? classes.tableContainer : classes.chartContainer
38092
+ ]
38093
+ ),
38051
38094
  children: [
38052
38095
  /* @__PURE__ */ jsx(
38053
38096
  Header,
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.3.0",
4
+ "version": "21.5.0",
5
5
  "type": "module",
6
6
  "module": "./dist/dotstatsuite-components.js",
7
7
  "files": [