@truedat/bg 4.41.0 → 4.41.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.41.1] 2022-03-25
4
+
5
+ ### Changed
6
+
7
+ - [TD-4617] Improve UX for domainMenuSelector
8
+
3
9
  ## [4.40.12] 2021-03-21
4
10
 
5
11
  ### Changed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/bg",
3
- "version": "4.41.0",
3
+ "version": "4.41.1",
4
4
  "description": "Truedat Web Business Glossary",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.14.1",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.41.0",
37
+ "@truedat/test": "4.41.1",
38
38
  "babel-jest": "^27.0.6",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -83,8 +83,8 @@
83
83
  ]
84
84
  },
85
85
  "dependencies": {
86
- "@truedat/core": "4.41.0",
87
- "@truedat/df": "4.41.0",
86
+ "@truedat/core": "4.41.1",
87
+ "@truedat/df": "4.41.1",
88
88
  "file-saver": "^2.0.5",
89
89
  "moment": "^2.24.0",
90
90
  "path-to-regexp": "^1.7.0",
@@ -104,5 +104,5 @@
104
104
  "react-dom": ">= 16.8.6 < 17",
105
105
  "semantic-ui-react": ">= 0.88.2 < 2.1"
106
106
  },
107
- "gitHead": "f4d8bc5e536b847c7b562a84bfa70955a93166ea"
107
+ "gitHead": "6e19abfaa3541bfad20ea093e6666cbdbecf7b55"
108
108
  }
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useState } from "react";
2
+ import React, { useState, useEffect } from "react";
3
3
  import { connect } from "react-redux";
4
4
  import { Dropdown, Form, Icon, Input, Label } from "semantic-ui-react";
5
5
  import PropTypes from "prop-types";
@@ -24,6 +24,22 @@ export const DomainMenuSelector = ({
24
24
  const [displayed, setDisplayed] = useState([]);
25
25
  const { formatMessage } = useIntl();
26
26
 
27
+ useEffect(() => {
28
+ const selectIds = (key, fromIds) =>
29
+ _.flow(
30
+ _.filter(({ id }) => _.contains(id)(fromIds)),
31
+ _.map(key),
32
+ _.flatten,
33
+ _.map("id"),
34
+ _.uniq
35
+ );
36
+
37
+ const ancestorIds = selectIds("ancestors", value)(options);
38
+ setOpen(_.union(open)(ancestorIds));
39
+
40
+ const childrenIds = selectIds("children", ancestorIds)(options);
41
+ setDisplayed(_.union(displayed)(childrenIds));
42
+ }, [options]);
27
43
  const handleOpen = (domainId) => {
28
44
  const domain = _.find({ id: domainId })(options);
29
45
  const isOpen = _.contains(domainId)(open);