@sis-cc/dotstatsuite-components 21.5.0 → 21.6.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.5.0";
64
+ const version$1 = "21.6.0";
65
65
  const meta$1 = {
66
66
  name: name$1,
67
67
  version: version$1
@@ -5681,47 +5681,8 @@ const addParentId = (id2, ids) => {
5681
5681
  const last2 = last$1(ids);
5682
5682
  return append$1(isNil$1(last2) ? id2 : `${last2}.${id2}`, ids);
5683
5683
  };
5684
- const refineUnconfirmedPaths = (paths3) => {
5685
- let confirmedPaths = filter$1((p) => p.length === 1, paths3);
5686
- if (!isEmpty$1(confirmedPaths)) {
5687
- confirmedPaths = reduce$1((acc, k2) => {
5688
- if (has$8(k2, acc)) {
5689
- return acc;
5690
- }
5691
- const ps = prop$1(k2, paths3);
5692
- const flatConfirmed = unnest$1(values$1(acc));
5693
- const filtered = filter$1((p) => !!find$1((cP) => includes$1(p, cP) || includes$1(cP, p), flatConfirmed), ps);
5694
- if (!isEmpty$1(filtered)) {
5695
- return assoc$1(k2, [head$1(filtered)], acc);
5696
- }
5697
- return acc;
5698
- }, confirmedPaths, keys$1(paths3));
5699
- }
5700
- const remainingIds = reject$1((id2) => has$8(id2, confirmedPaths), keys$1(paths3));
5701
- const getCommonPaths = (ids) => {
5702
- const { commonPaths, rejectedIds } = reduce$1(
5703
- (acc, id2) => {
5704
- const ps = prop$1(id2, paths3);
5705
- if (isEmpty$1(acc.commonPaths)) {
5706
- return assoc$1("commonPaths", ps, acc);
5707
- }
5708
- const common = intersection$1(acc.commonPaths, ps);
5709
- return isEmpty$1(common) ? assoc$1("rejectedChildrenIds", id2, acc) : assoc$1("commonPaths", common, acc);
5710
- },
5711
- { commonPaths: [], rejectedIds: [] }
5712
- )(ids);
5713
- if (!isEmpty$1(rejectedIds)) {
5714
- return append$1(head$1(commonPaths), getCommonPaths(rejectedIds));
5715
- }
5716
- return [head$1(commonPaths)];
5717
- };
5718
- const commons = getCommonPaths(remainingIds);
5719
- return reduce$1(
5720
- (acc, id2) => assoc$1(id2, intersection$1(commons, prop$1(id2, paths3)), acc),
5721
- confirmedPaths,
5722
- remainingIds
5723
- );
5724
- };
5684
+ const _refineUnconfirmedPaths = (paths3) => map$2((p) => [head$1(p)], paths3);
5685
+ const getHierId = (v) => isNil$1(v.parent) || isEmpty$1(v.parent) ? v.id : `${v.parent}.${v.id}`;
5725
5686
  const applyHierarchicalCodesToDim = (hCodes, dim) => {
5726
5687
  const confirmedHierarchisedChilds = /* @__PURE__ */ new Set([]);
5727
5688
  let unconfirmedPaths = {};
@@ -5763,25 +5724,35 @@ const applyHierarchicalCodesToDim = (hCodes, dim) => {
5763
5724
  reject$1((id2) => confirmedHierarchisedChilds.has(id2)),
5764
5725
  (ids) => pick$1(ids, unconfirmedPaths)
5765
5726
  )(keys$1(unconfirmedPaths));
5766
- const refinedUnconfirmedPaths = refineUnconfirmedPaths(_unconfirmedPaths);
5727
+ const refinedUnconfirmedPaths = _refineUnconfirmedPaths(_unconfirmedPaths);
5767
5728
  const flattenDescendants = reduce$1((acc, val) => {
5768
5729
  const children = flattenDescendants(val.children || []);
5769
5730
  return concat$1(acc, prepend$1(val, children));
5770
5731
  }, []);
5771
- const isValid = (val) => !val.unconfirmed || includes$1(val.path, propOr$1([], val.id, refinedUnconfirmedPaths));
5732
+ const isValid = (val) => !val.unconfirmed || val.path === head$1(refinedUnconfirmedPaths[val.id] || []);
5772
5733
  const refineCodes = reduce$1((acc, hC) => {
5773
5734
  const _flatDescendants = flattenDescendants(hC.children);
5774
5735
  const flatDescendants = prepend$1(hC, _flatDescendants);
5775
- const validDescendant = find$1(isValid, flatDescendants);
5776
- if (!validDescendant) {
5736
+ const valids = filter$1(isValid, flatDescendants);
5737
+ if (isEmpty$1(valids)) {
5777
5738
  return acc;
5778
5739
  }
5779
5740
  const refined2 = pipe$1(
5780
- map$2((v) => {
5741
+ reduce$1((_acc, v) => {
5781
5742
  confirmedHierarchisedChilds.add(v.id);
5782
- return omit$1(["unconfirmed", "children", "path"], v);
5783
- })
5784
- )(flatDescendants);
5743
+ const prev = last$1(_acc);
5744
+ const parents = pipe$1(
5745
+ (p) => isNil$1(p) ? [] : append$1(getHierId(p), prev.parents || []),
5746
+ filter$1((id2) => includes$1(id2, v.parents))
5747
+ )(prev);
5748
+ const rV = {
5749
+ ...omit$1(["unconfirmed", "children", "path"], v),
5750
+ parents,
5751
+ parent: isEmpty$1(parents) ? void 0 : last$1(parents)
5752
+ };
5753
+ return append$1(rV, _acc);
5754
+ }, [])
5755
+ )(valids);
5785
5756
  return concat$1(acc, refined2);
5786
5757
  }, []);
5787
5758
  const refined = refineCodes(parsed);
@@ -5797,10 +5768,10 @@ const applyHierarchicalCodesToDim = (hCodes, dim) => {
5797
5768
  concat$1,
5798
5769
  addIndex$1(map$2)((v, ind) => {
5799
5770
  const parents = props$1(v.parents, hierarchicalIndexes);
5800
- const hierId = last$1(v.parents) ? `${last$1(v.parents)}.${v.id}` : v.id;
5771
+ const hierId = getHierId(v);
5801
5772
  hierarchicalIndexes[hierId] = ind;
5802
5773
  return {
5803
- ...v,
5774
+ ...dissoc$1("path", v),
5804
5775
  parents,
5805
5776
  __indexPosition: ind
5806
5777
  };
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.5.0",
4
+ "version": "21.6.0",
5
5
  "type": "module",
6
6
  "module": "./dist/dotstatsuite-components.js",
7
7
  "files": [