@truedat/dd 4.40.6 → 4.40.7
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 +6 -0
- package/package.json +5 -5
- package/src/components/StructureItem.js +9 -4
- package/src/components/__tests__/StructureItem.spec.js +6 -4
- package/src/components/__tests__/__snapshots__/StructureItem.spec.js.snap +3 -0
- package/src/components/__tests__/__snapshots__/StructureNavClassified.spec.js.snap +2 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.40.
|
|
3
|
+
"version": "4.40.7",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@truedat/auth": "4.40.
|
|
88
|
-
"@truedat/core": "4.40.
|
|
89
|
-
"@truedat/df": "4.40.
|
|
87
|
+
"@truedat/auth": "4.40.7",
|
|
88
|
+
"@truedat/core": "4.40.7",
|
|
89
|
+
"@truedat/df": "4.40.7",
|
|
90
90
|
"lodash": "^4.17.21",
|
|
91
91
|
"path-to-regexp": "^1.7.0",
|
|
92
92
|
"prop-types": "^15.7.2",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"react-dom": ">= 16.8.6 < 17",
|
|
108
108
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "57ce60d30f6238ab63207ae402dfc0bc0e5c934a"
|
|
111
111
|
}
|
|
@@ -10,14 +10,15 @@ import { STRUCTURES, linkTo } from "@truedat/core/routes";
|
|
|
10
10
|
const getIcon = (formatMessage, type) =>
|
|
11
11
|
formatMessage({
|
|
12
12
|
id: `structure.type.${type}.icon`,
|
|
13
|
-
defaultMessage: "question circle outline"
|
|
13
|
+
defaultMessage: "question circle outline",
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
export const StructureItem = ({ name, id, type, active, deleted_at }) => {
|
|
17
17
|
const { formatMessage } = useIntl();
|
|
18
18
|
return (
|
|
19
19
|
<List.Item
|
|
20
|
-
as={active ?
|
|
20
|
+
as={active ? "a" : Link}
|
|
21
|
+
title={name}
|
|
21
22
|
to={
|
|
22
23
|
active
|
|
23
24
|
? undefined
|
|
@@ -39,8 +40,11 @@ export const StructureItem = ({ name, id, type, active, deleted_at }) => {
|
|
|
39
40
|
};
|
|
40
41
|
|
|
41
42
|
StructureItem.propTypes = {
|
|
43
|
+
active: PropTypes.bool,
|
|
44
|
+
deleted_at: PropTypes.string,
|
|
45
|
+
id: PropTypes.number,
|
|
42
46
|
name: PropTypes.string,
|
|
43
|
-
|
|
47
|
+
type: PropTypes.string,
|
|
44
48
|
};
|
|
45
49
|
|
|
46
50
|
export const mapStateToProps = (
|
|
@@ -50,7 +54,8 @@ export const mapStateToProps = (
|
|
|
50
54
|
const id = data_structure_id || structureId;
|
|
51
55
|
return {
|
|
52
56
|
id: id,
|
|
53
|
-
active:
|
|
57
|
+
active:
|
|
58
|
+
type !== "system" && _.isFinite(id) && _.propEq("id", id)(structure),
|
|
54
59
|
};
|
|
55
60
|
};
|
|
56
61
|
|
|
@@ -36,14 +36,16 @@ describe("<StructureItem />", () => {
|
|
|
36
36
|
const wrapper = shallow(<StructureItem {...props} />);
|
|
37
37
|
expect(wrapper.prop("as")).toBe(Link);
|
|
38
38
|
expect(wrapper.prop("to")).toEqual("/structures");
|
|
39
|
+
expect(wrapper.prop("title")).toBeTruthy();
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
it("renders as an
|
|
42
|
+
it("renders as an anchor tag if active is true", () => {
|
|
42
43
|
const props = { id, name, active: true };
|
|
43
44
|
const wrapper = shallow(<StructureItem {...props} />);
|
|
44
|
-
expect(wrapper.prop("as")).
|
|
45
|
+
expect(wrapper.prop("as")).toBe("a");
|
|
45
46
|
expect(wrapper.prop("to")).toBeUndefined();
|
|
46
47
|
expect(wrapper.prop("active")).toBeTruthy();
|
|
48
|
+
expect(wrapper.prop("title")).toBeTruthy();
|
|
47
49
|
});
|
|
48
50
|
|
|
49
51
|
describe("mapStateToProps", () => {
|
|
@@ -55,7 +57,7 @@ describe("<StructureItem />", () => {
|
|
|
55
57
|
|
|
56
58
|
expect(mapStateToProps(state, ownProps)).toMatchObject({
|
|
57
59
|
id: data_structure_id,
|
|
58
|
-
active: false
|
|
60
|
+
active: false,
|
|
59
61
|
});
|
|
60
62
|
});
|
|
61
63
|
|
|
@@ -65,7 +67,7 @@ describe("<StructureItem />", () => {
|
|
|
65
67
|
const state = { structure };
|
|
66
68
|
|
|
67
69
|
expect(mapStateToProps(state, ownProps)).toMatchObject({
|
|
68
|
-
active: true
|
|
70
|
+
active: true,
|
|
69
71
|
});
|
|
70
72
|
});
|
|
71
73
|
});
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
exports[`<StructureItem /> matches the latest snapshot (active state) 1`] = `
|
|
4
4
|
<ListItem
|
|
5
5
|
active={true}
|
|
6
|
+
as="a"
|
|
7
|
+
title="foo"
|
|
6
8
|
>
|
|
7
9
|
<ListIcon
|
|
8
10
|
name="question circle outline"
|
|
@@ -32,6 +34,7 @@ exports[`<StructureItem /> matches the latest snapshot 1`] = `
|
|
|
32
34
|
"render": [Function],
|
|
33
35
|
}
|
|
34
36
|
}
|
|
37
|
+
title="foo"
|
|
35
38
|
to="/structures/1"
|
|
36
39
|
>
|
|
37
40
|
<ListIcon
|
|
@@ -20,7 +20,7 @@ exports[`<StructureNavClassified /> matches the latest snapshot (leaf class expa
|
|
|
20
20
|
</div>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
|
-
<
|
|
23
|
+
<a
|
|
24
24
|
class="active item"
|
|
25
25
|
role="listitem"
|
|
26
26
|
>
|
|
@@ -35,7 +35,7 @@ exports[`<StructureNavClassified /> matches the latest snapshot (leaf class expa
|
|
|
35
35
|
class="description"
|
|
36
36
|
/>
|
|
37
37
|
</div>
|
|
38
|
-
</
|
|
38
|
+
</a>
|
|
39
39
|
<div
|
|
40
40
|
class="item"
|
|
41
41
|
role="listitem"
|