@truedat/dd 7.0.3 → 7.0.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 +6 -6
- package/src/components/GrantRequest.js +1 -1
- package/src/components/StructureSelector.js +13 -2
- package/src/components/__tests__/__snapshots__/StructureSelector.spec.js.snap +2 -12
- package/src/selectors/__tests__/structureColumnsSelector.spec.js +29 -1
- package/src/selectors/index.js +1 -0
- package/src/selectors/structureColumnsSelector.js +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dd",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.5",
|
|
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.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "7.0.
|
|
37
|
+
"@truedat/test": "7.0.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",
|
|
@@ -88,9 +88,9 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@apollo/client": "^3.7.1",
|
|
91
|
-
"@truedat/auth": "7.0.
|
|
92
|
-
"@truedat/core": "7.0.
|
|
93
|
-
"@truedat/df": "7.0.
|
|
91
|
+
"@truedat/auth": "7.0.5",
|
|
92
|
+
"@truedat/core": "7.0.5",
|
|
93
|
+
"@truedat/df": "7.0.5",
|
|
94
94
|
"lodash": "^4.17.21",
|
|
95
95
|
"moment": "^2.29.4",
|
|
96
96
|
"path-to-regexp": "^1.7.0",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"react-dom": ">= 16.8.6 < 17",
|
|
116
116
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "d76d7852ddb993ed53f0266ec17858119e731bbf"
|
|
119
119
|
}
|
|
@@ -4,7 +4,7 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import { connect } from "react-redux";
|
|
5
5
|
import { Link } from "react-router-dom";
|
|
6
6
|
import { linkTo } from "@truedat/core/routes";
|
|
7
|
-
import {
|
|
7
|
+
import { useIntl } from "react-intl";
|
|
8
8
|
import { Grid, Segment, List, Label } from "semantic-ui-react";
|
|
9
9
|
import GenericCrumbs from "@truedat/core/components/GenericCrumbs";
|
|
10
10
|
import { getGrantRequestTemplate } from "../selectors";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React, { useState, useEffect } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import { connect } from "react-redux";
|
|
4
|
+
import { connect, useSelector } from "react-redux";
|
|
5
5
|
import { Segment } from "semantic-ui-react";
|
|
6
6
|
import SearchWidget from "@truedat/core/search/SearchWidget";
|
|
7
7
|
import {
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
useDataStructureFilters,
|
|
14
14
|
useDataStructureSearch,
|
|
15
15
|
} from "../hooks/useStructures";
|
|
16
|
+
import { defaultColumnsForStructureSelector } from "../selectors";
|
|
17
|
+
|
|
16
18
|
import StructuresSearchResults from "./StructuresSearchResults";
|
|
17
19
|
|
|
18
20
|
function StructureSelectorContent({
|
|
@@ -70,6 +72,13 @@ export const StructureSelector = (props) => {
|
|
|
70
72
|
const pageSize = _.prop("pageSize")(props);
|
|
71
73
|
const withGrantRequests = _.prop("withGrantRequests")(props);
|
|
72
74
|
const withDataFields = _.prop("withDataFields")(props);
|
|
75
|
+
const defaultOverwriteColumns = useSelector(
|
|
76
|
+
defaultColumnsForStructureSelector
|
|
77
|
+
);
|
|
78
|
+
const overwriteColumns = _.propOr(
|
|
79
|
+
defaultOverwriteColumns,
|
|
80
|
+
"overwriteColumns"
|
|
81
|
+
)(props);
|
|
73
82
|
|
|
74
83
|
const enrichSearchPayload = {
|
|
75
84
|
my_grant_requests: !!withGrantRequests,
|
|
@@ -90,10 +99,12 @@ export const StructureSelector = (props) => {
|
|
|
90
99
|
enrichSearchPayload,
|
|
91
100
|
};
|
|
92
101
|
|
|
102
|
+
const selectorProps = { ...props, overwriteColumns };
|
|
103
|
+
|
|
93
104
|
return (
|
|
94
105
|
<>
|
|
95
106
|
<SearchContextProvider {...searchProps}>
|
|
96
|
-
<StructureSelectorContent {...
|
|
107
|
+
<StructureSelectorContent {...selectorProps} />
|
|
97
108
|
</SearchContextProvider>
|
|
98
109
|
</>
|
|
99
110
|
);
|
|
@@ -142,12 +142,7 @@ exports[`<StructureSelector /> matches the latest snapshot 1`] = `
|
|
|
142
142
|
<td
|
|
143
143
|
class="structure-cell-overflow"
|
|
144
144
|
>
|
|
145
|
-
|
|
146
|
-
href="/structures/1"
|
|
147
|
-
title="1"
|
|
148
|
-
>
|
|
149
|
-
1
|
|
150
|
-
</a>
|
|
145
|
+
1
|
|
151
146
|
</td>
|
|
152
147
|
<td
|
|
153
148
|
class=""
|
|
@@ -179,12 +174,7 @@ exports[`<StructureSelector /> matches the latest snapshot 1`] = `
|
|
|
179
174
|
<td
|
|
180
175
|
class="structure-cell-overflow"
|
|
181
176
|
>
|
|
182
|
-
|
|
183
|
-
href="/structures/2"
|
|
184
|
-
title="2"
|
|
185
|
-
>
|
|
186
|
-
2
|
|
187
|
-
</a>
|
|
177
|
+
2
|
|
188
178
|
</td>
|
|
189
179
|
<td
|
|
190
180
|
class=""
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
defaultColumnsForStructureSelector,
|
|
3
|
+
structureColumnsSelector,
|
|
4
|
+
} from "..";
|
|
2
5
|
|
|
3
6
|
describe("selectors: structureColumnsSelector", () => {
|
|
4
7
|
it("should return default structuresColumns when present", () => {
|
|
@@ -28,3 +31,28 @@ describe("selectors: structureColumnsSelector", () => {
|
|
|
28
31
|
expect(res).toEqual([{ name: "foo" }, { name: "bar" }]);
|
|
29
32
|
});
|
|
30
33
|
});
|
|
34
|
+
|
|
35
|
+
describe("selectors: defaultColumnsForStructureSelector", () => {
|
|
36
|
+
it("should replace name from object with decorator ", () => {
|
|
37
|
+
const structuresColumns = [
|
|
38
|
+
{
|
|
39
|
+
name: "name",
|
|
40
|
+
sort: { name: "name.sort" },
|
|
41
|
+
fieldDecorator: { foo: "bar" },
|
|
42
|
+
width: 2,
|
|
43
|
+
},
|
|
44
|
+
{ name: "group", width: 1 },
|
|
45
|
+
];
|
|
46
|
+
const res = defaultColumnsForStructureSelector({ structuresColumns }, {});
|
|
47
|
+
|
|
48
|
+
expect(res).toHaveLength(2);
|
|
49
|
+
expect(res).toEqual([
|
|
50
|
+
{
|
|
51
|
+
name: "name",
|
|
52
|
+
sort: { name: "name.sort" },
|
|
53
|
+
width: 2,
|
|
54
|
+
},
|
|
55
|
+
{ name: "group", width: 1 },
|
|
56
|
+
]);
|
|
57
|
+
});
|
|
58
|
+
});
|
package/src/selectors/index.js
CHANGED
|
@@ -81,3 +81,14 @@ export const structureColumnsSelector = (state, defaultFilters, ownColumns) =>
|
|
|
81
81
|
)(columns);
|
|
82
82
|
return res;
|
|
83
83
|
})(state);
|
|
84
|
+
|
|
85
|
+
const rawName = {
|
|
86
|
+
name: "name",
|
|
87
|
+
sort: { name: "name.sort" },
|
|
88
|
+
width: 2,
|
|
89
|
+
};
|
|
90
|
+
export const defaultColumnsForStructureSelector = (state) =>
|
|
91
|
+
createSelector(
|
|
92
|
+
(state) => structureColumnsSelector(state, null, null),
|
|
93
|
+
_.map((item) => (item?.name === "name" ? rawName : item))
|
|
94
|
+
)(state);
|