@truedat/dd 4.46.10 → 4.47.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.
- package/CHANGELOG.md +13 -0
- package/package.json +6 -6
- package/src/components/StructureFieldsDropdown.js +4 -23
- package/src/components/StructureNav.js +9 -2
- package/src/components/StructureSummary.js +5 -1
- package/src/components/__tests__/StructureNav.spec.js +25 -1
- package/src/components/__tests__/__snapshots__/ValueConditionStructure.spec.js.snap +8 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.47.0] 2022-06-22
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- [TD-4392] "Request grant" button is only displayed if the structure's has been
|
|
8
|
+
classified as `_grantable`
|
|
9
|
+
|
|
10
|
+
## [4.46.12] 2022-06-20
|
|
11
|
+
|
|
12
|
+
### Removed
|
|
13
|
+
|
|
14
|
+
- [TD-4894] Multiple column operator in implementation creation
|
|
15
|
+
|
|
3
16
|
## [4.46.6] 2022-06-20
|
|
4
17
|
|
|
5
18
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.47.0",
|
|
4
4
|
"description": "Truedat Web Data Dictionary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.4",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.46.
|
|
37
|
+
"@truedat/test": "4.46.12",
|
|
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",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@apollo/client": "^3.6.4",
|
|
91
|
-
"@truedat/auth": "4.46.
|
|
92
|
-
"@truedat/core": "4.46.
|
|
93
|
-
"@truedat/df": "4.46.
|
|
91
|
+
"@truedat/auth": "4.46.13",
|
|
92
|
+
"@truedat/core": "4.46.13",
|
|
93
|
+
"@truedat/df": "4.46.13",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"path-to-regexp": "^1.7.0",
|
|
96
96
|
"prop-types": "^15.8.1",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"react-dom": ">= 16.8.6 < 17",
|
|
113
113
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "ef34abe3f66b5ef61faeafb3a2c46732783ebe5c"
|
|
116
116
|
}
|
|
@@ -11,37 +11,23 @@ export const StructureFieldsDropdown = ({
|
|
|
11
11
|
fluid,
|
|
12
12
|
inline,
|
|
13
13
|
onSelectField,
|
|
14
|
-
onSelectFields,
|
|
15
14
|
structureFields,
|
|
16
15
|
filters,
|
|
17
16
|
value,
|
|
18
17
|
typeCastModifiers,
|
|
19
|
-
multiple,
|
|
20
18
|
}) => {
|
|
21
19
|
const { formatMessage } = useIntl();
|
|
22
20
|
const onClick = ({ value, modifier }) => {
|
|
23
|
-
onSelectField(dropdownItemToField(value), modifier);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const onChangeStructureFieldsDropdown = (valueOrValues) => {
|
|
27
|
-
return _.flow(
|
|
28
|
-
_.map((value) => {
|
|
29
|
-
return dropdownItemToField(value);
|
|
30
|
-
}),
|
|
31
|
-
multiple ? onSelectFields : onSelectField
|
|
32
|
-
)(Array.isArray(valueOrValues) ? valueOrValues : [valueOrValues]);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const dropdownItemToField = (value) => {
|
|
36
21
|
const [data_structure_id, parent_index] = _.isString(value)
|
|
37
22
|
? value.split("/").map(Number)
|
|
38
23
|
: [value, undefined];
|
|
39
|
-
|
|
24
|
+
const field = _.isNil(parent_index)
|
|
40
25
|
? _.find({ data_structure_id: data_structure_id })(structureFields)
|
|
41
26
|
: _.find({
|
|
42
27
|
data_structure_id: data_structure_id,
|
|
43
28
|
parent_index: parent_index,
|
|
44
29
|
})(structureFields);
|
|
30
|
+
onSelectField(field, modifier);
|
|
45
31
|
};
|
|
46
32
|
|
|
47
33
|
const formatOption = (field) => {
|
|
@@ -76,15 +62,14 @@ export const StructureFieldsDropdown = ({
|
|
|
76
62
|
}),
|
|
77
63
|
};
|
|
78
64
|
};
|
|
79
|
-
const toFieldOption = (field) =>
|
|
80
|
-
|
|
65
|
+
const toFieldOption = (field) =>
|
|
66
|
+
_.has("options")(field)
|
|
81
67
|
? {
|
|
82
68
|
icon: "table",
|
|
83
69
|
label: field.label,
|
|
84
70
|
options: _.map(formatOption)(field.options),
|
|
85
71
|
}
|
|
86
72
|
: formatOption(field);
|
|
87
|
-
};
|
|
88
73
|
|
|
89
74
|
const getOptions = _.flow(
|
|
90
75
|
_.sortBy(_.flow(_.prop("name"), _.toLower)),
|
|
@@ -115,13 +100,11 @@ export const StructureFieldsDropdown = ({
|
|
|
115
100
|
|
|
116
101
|
return (
|
|
117
102
|
<OptionGroup
|
|
118
|
-
multiple={multiple}
|
|
119
103
|
fluid={fluid}
|
|
120
104
|
inline={inline}
|
|
121
105
|
label={label}
|
|
122
106
|
value={value}
|
|
123
107
|
onClick={onClick}
|
|
124
|
-
onChange={onChangeStructureFieldsDropdown}
|
|
125
108
|
placeholder={formatMessage({
|
|
126
109
|
id: "structureFields.dropdown.placeholder",
|
|
127
110
|
})}
|
|
@@ -137,10 +120,8 @@ StructureFieldsDropdown.propTypes = {
|
|
|
137
120
|
value: PropTypes.number,
|
|
138
121
|
structureFields: PropTypes.array,
|
|
139
122
|
onSelectField: PropTypes.func,
|
|
140
|
-
onSelectFields: PropTypes.func,
|
|
141
123
|
filters: PropTypes.object,
|
|
142
124
|
typeCastModifiers: PropTypes.array,
|
|
143
|
-
multiple: PropTypes.bool,
|
|
144
125
|
};
|
|
145
126
|
|
|
146
127
|
const mapStateToProps = (state, props) => ({
|
|
@@ -7,10 +7,17 @@ import StructureItem from "./StructureItem";
|
|
|
7
7
|
import StructureItems from "./StructureItems";
|
|
8
8
|
import StructureNavClassified from "./StructureNavClassified";
|
|
9
9
|
|
|
10
|
+
export const navClasses = _.flow(
|
|
11
|
+
_.prop("classes"),
|
|
12
|
+
_.keys,
|
|
13
|
+
_.without(["_grantable"])
|
|
14
|
+
);
|
|
15
|
+
export const hasNavClass = _.flow(navClasses, _.negate(_.isEmpty));
|
|
16
|
+
|
|
10
17
|
export const StructureNav = ({ childStructures, parentStructure }) => {
|
|
11
|
-
const firstWithClasses = _.find(
|
|
18
|
+
const firstWithClasses = _.find(hasNavClass)(childStructures);
|
|
12
19
|
const classifier = firstWithClasses
|
|
13
|
-
?
|
|
20
|
+
? _.flow(navClasses, _.head)(firstWithClasses)
|
|
14
21
|
: undefined;
|
|
15
22
|
|
|
16
23
|
return (
|
|
@@ -55,6 +55,7 @@ const dateProperties = (deleted_at, updatedAt) =>
|
|
|
55
55
|
|
|
56
56
|
export const StructureSummary = ({
|
|
57
57
|
class: structureClass,
|
|
58
|
+
classes: structureClasses,
|
|
58
59
|
name,
|
|
59
60
|
published_note,
|
|
60
61
|
description,
|
|
@@ -79,7 +80,9 @@ export const StructureSummary = ({
|
|
|
79
80
|
{_.isEmpty(published_note?.alias)
|
|
80
81
|
? name
|
|
81
82
|
: published_note.alias}
|
|
82
|
-
|
|
83
|
+
{structureClasses?._grantable ? (
|
|
84
|
+
<StructureGrantButton />
|
|
85
|
+
) : null}
|
|
83
86
|
{!_.isEmpty(published_note?.alias) && (
|
|
84
87
|
<Header.Subheader>{name}</Header.Subheader>
|
|
85
88
|
)}
|
|
@@ -117,6 +120,7 @@ export const StructureSummary = ({
|
|
|
117
120
|
|
|
118
121
|
StructureSummary.propTypes = {
|
|
119
122
|
class: PropTypes.string,
|
|
123
|
+
classes: PropTypes.object,
|
|
120
124
|
name: PropTypes.string,
|
|
121
125
|
published_note: PropTypes.object,
|
|
122
126
|
description: PropTypes.string,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { render } from "@truedat/test/render";
|
|
3
|
-
import { StructureNav } from "../StructureNav";
|
|
3
|
+
import { StructureNav, hasNavClass, navClasses } from "../StructureNav";
|
|
4
4
|
|
|
5
5
|
const renderOpts = {
|
|
6
6
|
messages: {
|
|
@@ -25,3 +25,27 @@ describe("<StructureNav />", () => {
|
|
|
25
25
|
expect(container).toMatchSnapshot();
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
+
|
|
29
|
+
describe("navClasses", () => {
|
|
30
|
+
it("returns all classes keys except _grantable", () => {
|
|
31
|
+
expect(navClasses({ classes: { foo: "foo" } })).toEqual(["foo"]);
|
|
32
|
+
expect(navClasses({ classes: { b: "b", _grantable: "x" } })).toEqual(["b"]);
|
|
33
|
+
expect(navClasses({})).toEqual([]);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
describe("hasNavClass", () => {
|
|
38
|
+
it("returns true for an item with a class other than _grantable", () => {
|
|
39
|
+
expect(hasNavClass({ classes: { foo: "foo" } })).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("returns false for an item with only _grantable class", () => {
|
|
43
|
+
expect(hasNavClass({ classes: { _grantable: "foo" } })).toBe(false);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it("returns false for an item with no classes", () => {
|
|
47
|
+
expect(hasNavClass({ classes: {} })).toBe(false);
|
|
48
|
+
expect(hasNavClass({ classes: null })).toBe(false);
|
|
49
|
+
expect(hasNavClass({})).toBe(false);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -36,31 +36,21 @@ exports[`<ValueConditionStructure /> matches the latest snapshot 1`] = `
|
|
|
36
36
|
role="listbox"
|
|
37
37
|
>
|
|
38
38
|
<div
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
style="pointer-events: all;"
|
|
39
|
+
class="divider"
|
|
40
|
+
/>
|
|
41
|
+
<div
|
|
42
|
+
class="header"
|
|
44
43
|
>
|
|
45
|
-
<
|
|
46
|
-
|
|
44
|
+
<i
|
|
45
|
+
aria-hidden="true"
|
|
46
|
+
class="table icon"
|
|
47
47
|
/>
|
|
48
|
-
|
|
49
|
-
class="header"
|
|
50
|
-
>
|
|
51
|
-
<i
|
|
52
|
-
aria-hidden="true"
|
|
53
|
-
class="table icon"
|
|
54
|
-
/>
|
|
55
|
-
bar
|
|
56
|
-
</div>
|
|
48
|
+
bar
|
|
57
49
|
</div>
|
|
58
50
|
<div
|
|
59
|
-
aria-checked="false"
|
|
60
51
|
aria-selected="false"
|
|
61
52
|
class="item group"
|
|
62
53
|
role="option"
|
|
63
|
-
style="pointer-events: all;"
|
|
64
54
|
>
|
|
65
55
|
<i
|
|
66
56
|
aria-hidden="true"
|