@truedat/df 6.5.4 → 6.5.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/df",
3
- "version": "6.5.4",
3
+ "version": "6.5.5",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.5",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "6.5.4",
37
+ "@truedat/test": "6.5.5",
38
38
  "babel-jest": "^28.1.0",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -87,8 +87,8 @@
87
87
  },
88
88
  "dependencies": {
89
89
  "@apollo/client": "^3.7.1",
90
- "@truedat/auth": "6.5.4",
91
- "@truedat/core": "6.5.4",
90
+ "@truedat/auth": "6.5.5",
91
+ "@truedat/core": "6.5.5",
92
92
  "decode-uri-component": "^0.2.2",
93
93
  "path-to-regexp": "^1.7.0",
94
94
  "prop-types": "^15.8.1",
@@ -109,5 +109,5 @@
109
109
  "react-dom": ">= 16.8.6 < 17",
110
110
  "semantic-ui-react": ">= 2.0.3 < 2.2"
111
111
  },
112
- "gitHead": "ca29de8f75c143bb950bb8c9fc8a4d96c97464fb"
112
+ "gitHead": "b55faef0ee852d0d2282c29272d3c7cb530be45a"
113
113
  }
@@ -19,7 +19,6 @@ export const DynamicFieldValue = ({
19
19
  isChanged,
20
20
  }) => {
21
21
  const { formatMessage } = useIntl();
22
-
23
22
  return (
24
23
  <List.Item>
25
24
  <List.Header
@@ -1,12 +1,43 @@
1
1
  import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import PropTypes from "prop-types";
4
- import { Label } from "semantic-ui-react";
4
+ import {
5
+ Label,
6
+ Popup,
7
+ PopupContent,
8
+ PopupHeader,
9
+ List,
10
+ ListItem,
11
+ } from "semantic-ui-react";
5
12
 
6
- export const HierarchyPreview = ({ hierarchyValue }) =>
13
+ const createBulletedList = (path) => {
14
+ if (!path) return null;
15
+ const items = path.split("/").filter((item) => item.trim() !== "");
16
+
17
+ const bultListedItems = (index) => {
18
+ if (index === items.length - 2) {
19
+ return <ListItem>{items[index]}</ListItem>;
20
+ } else {
21
+ return (
22
+ <ListItem>
23
+ {items[index]}
24
+ <List.List>{bultListedItems(index + 1)}</List.List>
25
+ </ListItem>
26
+ );
27
+ }
28
+ };
29
+ return <List size="tiny">{bultListedItems(0)}</List>;
30
+ };
31
+
32
+ const HierarchyPreview = ({ hierarchyValue }) =>
7
33
  _.flow(
8
34
  _.reject(_.isNull),
9
- _.map(({ id, name }) => <Label key={id}>{name}</Label>)
35
+ _.map(({ id, name, path }) => (
36
+ <Popup key={id} trigger={<Label content={name} />}>
37
+ <PopupHeader></PopupHeader>
38
+ <PopupContent>{createBulletedList(path)}</PopupContent>
39
+ </Popup>
40
+ ))
10
41
  )(hierarchyValue);
11
42
 
12
43
  HierarchyPreview.propTypes = {
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import { render } from "@truedat/test/render";
3
+ import { waitFor } from "@testing-library/react";
4
+ import userEvent from "@testing-library/user-event";
5
+ import HierarchyPreview from "../HierarchyPreview";
6
+
7
+ describe("<HierarchyPreview />", () => {
8
+ const props = {
9
+ hierarchyValue: [
10
+ {
11
+ id: "1",
12
+ name: "xyz",
13
+ path: "/foo foo/bar/baz/xyz",
14
+ },
15
+ ],
16
+ };
17
+ it("matches the latest snapshot", () => {
18
+ const { container } = render(<HierarchyPreview {...props} />);
19
+ expect(container).toMatchSnapshot();
20
+ });
21
+
22
+ it("show tooltip", async () => {
23
+ const { getByText, debug } = render(<HierarchyPreview {...props} />);
24
+ userEvent.hover(await getByText("xyz"));
25
+ await waitFor(() => expect(getByText("baz")).toBeInTheDocument());
26
+ debug();
27
+ });
28
+ });
@@ -0,0 +1,11 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<HierarchyPreview /> matches the latest snapshot 1`] = `
4
+ <div>
5
+ <div
6
+ class="ui label"
7
+ >
8
+ xyz
9
+ </div>
10
+ </div>
11
+ `;