@truedat/bg 5.6.2 → 5.6.3
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/concepts/components/ConceptSelectedFiltersPublished.js +2 -0
- package/src/concepts/components/ConceptsUpdateButton.js +11 -11
- package/src/concepts/components/__tests__/ConceptFilters.spec.js +4 -1
- package/src/concepts/reducers/__tests__/conceptFilters.spec.js +10 -10
- package/src/concepts/reducers/conceptFilters.js +1 -3
- package/src/concepts/selectors/__tests__/getConceptAvailableFilters.spec.js +4 -4
- package/src/concepts/selectors/__tests__/getConceptFilterTypes.spec.js +19 -0
- package/src/concepts/selectors/__tests__/getConceptSelectedFilterValues.spec.js +4 -4
- package/src/concepts/selectors/__tests__/mapSelectedFilterStateToPropsByStatus.spec.js +2 -2
- package/src/concepts/selectors/getConceptAvailableFilters.js +1 -1
- package/src/concepts/selectors/getConceptFilterTypes.js +7 -0
- package/src/concepts/selectors/getConceptSelectedFilterActiveValues.js +2 -8
- package/src/concepts/selectors/getConceptSelectedFilterValues.js +2 -2
- package/src/concepts/selectors/index.js +1 -0
- package/src/concepts/selectors/mapSelectedFilterStateToPropsByStatus.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "5.6.
|
|
3
|
+
"version": "5.6.3",
|
|
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.16.5",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "5.6.
|
|
37
|
+
"@truedat/test": "5.6.3",
|
|
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",
|
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
]
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@truedat/core": "5.6.
|
|
90
|
-
"@truedat/df": "5.6.
|
|
91
|
-
"@truedat/lm": "5.6.
|
|
89
|
+
"@truedat/core": "5.6.3",
|
|
90
|
+
"@truedat/df": "5.6.3",
|
|
91
|
+
"@truedat/lm": "5.6.3",
|
|
92
92
|
"decode-uri-component": "^0.2.2",
|
|
93
93
|
"file-saver": "^2.0.5",
|
|
94
94
|
"moment": "^2.29.4",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"react-dom": ">= 16.8.6 < 17",
|
|
112
112
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "c79bc612b29e41c6c600c2e029ae762b36147193"
|
|
115
115
|
}
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
getConceptSelectedFilterActiveValues,
|
|
19
19
|
getConceptSelectedFilters,
|
|
20
20
|
getConceptSelectedFilterValues,
|
|
21
|
+
getConceptFilterTypes,
|
|
21
22
|
} from "../selectors";
|
|
22
23
|
import { translations } from "../utils/filterOptions";
|
|
23
24
|
|
|
@@ -36,6 +37,7 @@ export const mapStateToProps = (state, ownProps) => {
|
|
|
36
37
|
return {
|
|
37
38
|
activeFilters,
|
|
38
39
|
loading,
|
|
40
|
+
filterTypes: getConceptFilterTypes(state),
|
|
39
41
|
selectedFilter,
|
|
40
42
|
selectedFilters: _.flow(
|
|
41
43
|
getConceptSelectedFilters,
|
|
@@ -31,32 +31,32 @@ export const ConceptsUpdateButton = ({ updateUrl }) => {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
ConceptsUpdateButton.propTypes = {
|
|
34
|
-
updateUrl: PropTypes.string
|
|
34
|
+
updateUrl: PropTypes.string,
|
|
35
35
|
};
|
|
36
36
|
|
|
37
|
-
const withoutTemplate = filters =>
|
|
37
|
+
const withoutTemplate = (filters) =>
|
|
38
38
|
_.negate(_.isEmpty)(filters) && _.negate(_.has("template"))(filters);
|
|
39
39
|
|
|
40
|
-
const singleTemplate = filters =>
|
|
41
|
-
_.flow(_.propOr([],
|
|
40
|
+
const singleTemplate = (filters, key) =>
|
|
41
|
+
_.flow(_.propOr([], key), verifyTemplateSize)(filters);
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const existingTemplate = (conceptFilters, conceptActiveFilters) =>
|
|
44
44
|
withoutTemplate(conceptFilters) ||
|
|
45
|
-
singleTemplate(conceptActiveFilters) ||
|
|
46
|
-
singleTemplate(conceptFilters);
|
|
47
|
-
const verifyTemplateSize = template => _.size(template) === 1;
|
|
45
|
+
singleTemplate(conceptActiveFilters, "template") ||
|
|
46
|
+
singleTemplate(conceptFilters, "template.values");
|
|
47
|
+
const verifyTemplateSize = (template) => _.size(template) === 1;
|
|
48
48
|
|
|
49
49
|
const mapStateToProps = ({
|
|
50
50
|
conceptActiveFilters,
|
|
51
51
|
conceptFilters,
|
|
52
52
|
conceptCount,
|
|
53
|
-
conceptsLoading
|
|
53
|
+
conceptsLoading,
|
|
54
54
|
}) => ({
|
|
55
55
|
updateUrl:
|
|
56
56
|
conceptCount !== 0 &&
|
|
57
57
|
!conceptsLoading &&
|
|
58
|
-
|
|
59
|
-
CONCEPTS_BULK_UPDATE
|
|
58
|
+
existingTemplate(conceptFilters, conceptActiveFilters) &&
|
|
59
|
+
CONCEPTS_BULK_UPDATE,
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
export default connect(mapStateToProps)(ConceptsUpdateButton);
|
|
@@ -3,7 +3,10 @@ import { render } from "@truedat/test/render";
|
|
|
3
3
|
import ConceptFilters from "../ConceptFilters";
|
|
4
4
|
|
|
5
5
|
const state = {
|
|
6
|
-
conceptFilters: {
|
|
6
|
+
conceptFilters: {
|
|
7
|
+
domain_id: { values: [1, 2] },
|
|
8
|
+
confidential: { values: ["yes", "no"] },
|
|
9
|
+
},
|
|
7
10
|
conceptActiveFilters: { domain_id: [1] },
|
|
8
11
|
};
|
|
9
12
|
const renderOpts = { state };
|
|
@@ -17,28 +17,28 @@ describe("reducers: conceptFilters", () => {
|
|
|
17
17
|
).toEqual(initialState);
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
it("should handle the fetchConceptFilters.REQUEST action", () => {
|
|
21
|
-
expect(
|
|
22
|
-
conceptFilters(fooState, { type: fetchConceptFilters.REQUEST })
|
|
23
|
-
).toEqual(initialState);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
20
|
it("should handle the fetchConceptFilters.SUCCESS action", () => {
|
|
27
|
-
const data = {
|
|
21
|
+
const data = {
|
|
22
|
+
filter1: { values: ["value1", "value2"] },
|
|
23
|
+
filter2: { values: ["value1"] },
|
|
24
|
+
};
|
|
28
25
|
expect(
|
|
29
26
|
conceptFilters(fooState, {
|
|
30
27
|
type: fetchConceptFilters.SUCCESS,
|
|
31
|
-
payload: { data }
|
|
28
|
+
payload: { data },
|
|
32
29
|
})
|
|
33
30
|
).toEqual(data);
|
|
34
31
|
});
|
|
35
32
|
|
|
36
33
|
it("should handle the fetchConceptFilters.SUCCESS action and omit field current", () => {
|
|
37
|
-
const data = {
|
|
34
|
+
const data = {
|
|
35
|
+
filter1: { values: ["value1", "value2"] },
|
|
36
|
+
current: { values: ["value1"] },
|
|
37
|
+
};
|
|
38
38
|
expect(
|
|
39
39
|
conceptFilters(fooState, {
|
|
40
40
|
type: fetchConceptFilters.SUCCESS,
|
|
41
|
-
payload: { data }
|
|
41
|
+
payload: { data },
|
|
42
42
|
})
|
|
43
43
|
).toEqual(_.omit(["current"])(data));
|
|
44
44
|
});
|
|
@@ -7,13 +7,11 @@ const conceptFilters = (state = initialState, { type, payload }) => {
|
|
|
7
7
|
switch (type) {
|
|
8
8
|
case clearConceptFilters.TRIGGER:
|
|
9
9
|
return initialState;
|
|
10
|
-
case fetchConceptFilters.REQUEST:
|
|
11
|
-
return initialState;
|
|
12
10
|
case fetchConceptFilters.SUCCESS:
|
|
13
11
|
return _.flow(
|
|
14
12
|
_.propOr({}, "data"),
|
|
15
13
|
_.omit(["current", "domain_ids"]),
|
|
16
|
-
_.omitBy(_.isEmpty)
|
|
14
|
+
_.omitBy(_.flow(_.getOr([], "values"), _.isEmpty))
|
|
17
15
|
)(payload);
|
|
18
16
|
default:
|
|
19
17
|
return state;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getConceptAvailableFilters } from "..";
|
|
2
2
|
|
|
3
|
-
const foo = ["foo1", "foo2"];
|
|
4
|
-
const bar = ["bar1", "bar2"];
|
|
5
|
-
const bay = ["bay1"];
|
|
6
|
-
const baz = ["baz1", "baz2"];
|
|
3
|
+
const foo = { values: ["foo1", "foo2"] };
|
|
4
|
+
const bar = { values: ["bar1", "bar2"] };
|
|
5
|
+
const bay = { values: ["bay1"] };
|
|
6
|
+
const baz = { values: ["baz1", "baz2"] };
|
|
7
7
|
|
|
8
8
|
describe("selectors: getConceptAvailableFilters", () => {
|
|
9
9
|
const conceptFilters = { foo, bar, bay, baz };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getConceptFilterTypes } from "..";
|
|
2
|
+
|
|
3
|
+
const foo = { type: "fooType", values: ["foo1", "foo2"] };
|
|
4
|
+
const bar = { type: "barType", values: ["bar1", "bar2"] };
|
|
5
|
+
const bay = { values: ["bay1"] };
|
|
6
|
+
|
|
7
|
+
describe("selectors: getConceptFilterTypes", () => {
|
|
8
|
+
const state = { conceptFilters: { foo, bar, bay } };
|
|
9
|
+
|
|
10
|
+
const expected = {
|
|
11
|
+
foo: "fooType",
|
|
12
|
+
bar: "barType",
|
|
13
|
+
bay: undefined,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
it("should return a map with filter types", () => {
|
|
17
|
+
expect(getConceptFilterTypes(state)).toEqual(expected);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getConceptSelectedFilterValues } from "..";
|
|
2
2
|
|
|
3
|
-
const foo = ["foo1", "foo2"];
|
|
4
|
-
const bar = ["bar1", "bar2"];
|
|
5
|
-
const baz = ["baz1", "baz2"];
|
|
3
|
+
const foo = { values: ["foo1", "foo2"] };
|
|
4
|
+
const bar = { values: ["bar1", "bar2"] };
|
|
5
|
+
const baz = { values: ["baz1", "baz2"] };
|
|
6
6
|
|
|
7
7
|
describe("selectors: getConceptSelectedFilterValues", () => {
|
|
8
8
|
const conceptFilters = { foo, bar, baz };
|
|
@@ -10,6 +10,6 @@ describe("selectors: getConceptSelectedFilterValues", () => {
|
|
|
10
10
|
const state = { conceptFilters, conceptSelectedFilter };
|
|
11
11
|
|
|
12
12
|
it("should return the values of the currently selected concept filters", () => {
|
|
13
|
-
expect(getConceptSelectedFilterValues(state)).toEqual(foo);
|
|
13
|
+
expect(getConceptSelectedFilterValues(state)).toEqual(foo.values);
|
|
14
14
|
});
|
|
15
15
|
});
|
|
@@ -7,7 +7,7 @@ describe("selectors: mapSelectedFilterStateToPropsByStatus", () => {
|
|
|
7
7
|
const statuses = ["s1", "s2"];
|
|
8
8
|
const state = {
|
|
9
9
|
conceptSelectedFilter: "status",
|
|
10
|
-
conceptFilters: { status: ["s1", "s2"] },
|
|
10
|
+
conceptFilters: { status: { values: ["s1", "s2"] } },
|
|
11
11
|
};
|
|
12
12
|
expect(
|
|
13
13
|
mapSelectedFilterStateToPropsByStatus(statuses)(state, ownProps)
|
|
@@ -23,7 +23,7 @@ describe("selectors: mapSelectedFilterStateToPropsByStatus", () => {
|
|
|
23
23
|
const statuses = ["s1", "s2"];
|
|
24
24
|
const state = {
|
|
25
25
|
conceptSelectedFilter: "status",
|
|
26
|
-
conceptFilters: { status: ["s1", "s2"] },
|
|
26
|
+
conceptFilters: { status: { values: ["s1", "s2"] } },
|
|
27
27
|
};
|
|
28
28
|
expect(
|
|
29
29
|
mapSelectedFilterStateToPropsByStatus(statuses)(state)
|
|
@@ -8,7 +8,7 @@ export const getConceptAvailableFilters = createSelector(
|
|
|
8
8
|
[getConceptFilters, getConceptSelectedFilters],
|
|
9
9
|
(conceptFilters, conceptSelectedFilters) =>
|
|
10
10
|
_.flow(
|
|
11
|
-
_.omitBy((values) => _.size(values) < 2),
|
|
11
|
+
_.omitBy(({ values }) => _.size(values) < 2),
|
|
12
12
|
_.keys,
|
|
13
13
|
_.without(conceptSelectedFilters)
|
|
14
14
|
)(conceptFilters)
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import { createSelector } from "reselect";
|
|
3
|
-
import { toFilterValues } from "@truedat/core/services/filters";
|
|
4
|
-
import { getConceptSelectedFilterValues } from "./getConceptSelectedFilterValues";
|
|
5
3
|
|
|
6
4
|
export const getConceptSelectedFilterActiveValues = createSelector(
|
|
7
5
|
_.prop("conceptSelectedFilter"),
|
|
8
6
|
_.prop("conceptActiveFilters"),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
_.flow(
|
|
12
|
-
_.propOr([], conceptSelectedFilter),
|
|
13
|
-
_.intersection(toFilterValues(selectedFilterValues))
|
|
14
|
-
)(conceptActiveFilters)
|
|
7
|
+
(conceptSelectedFilter, conceptActiveFilters) =>
|
|
8
|
+
_.flow(_.propOr([], conceptSelectedFilter))(conceptActiveFilters)
|
|
15
9
|
);
|
|
@@ -6,7 +6,7 @@ export const getConceptSelectedFilterValues = createSelector(
|
|
|
6
6
|
[_.prop("conceptSelectedFilter"), _.prop("conceptFilters")],
|
|
7
7
|
(conceptSelectedFilter, conceptFilters) =>
|
|
8
8
|
_.flow(
|
|
9
|
-
_.propOr([], conceptSelectedFilter),
|
|
10
|
-
formatFilterValues
|
|
9
|
+
_.propOr({ values: [] }, conceptSelectedFilter),
|
|
10
|
+
formatFilterValues
|
|
11
11
|
)(conceptFilters)
|
|
12
12
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { getConceptsRows, getConceptColumns } from "./getConceptColumns";
|
|
2
2
|
export { getConceptAvailableFilters } from "./getConceptAvailableFilters";
|
|
3
3
|
export { getConceptDomainPath } from "./getConceptDomainPath";
|
|
4
|
+
export { getConceptFilterTypes } from "./getConceptFilterTypes";
|
|
4
5
|
export { getConceptSelectedFilters } from "./getConceptSelectedFilters";
|
|
5
6
|
export { getConceptSelectedFilterActiveValues } from "./getConceptSelectedFilterActiveValues";
|
|
6
7
|
export { getConceptSelectedFilterValues } from "./getConceptSelectedFilterValues";
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
getConceptSelectedFilters,
|
|
6
6
|
getConceptSelectedFilterValues,
|
|
7
7
|
getConceptSelectedFilterActiveValues,
|
|
8
|
+
getConceptFilterTypes,
|
|
8
9
|
} from ".";
|
|
9
10
|
|
|
10
11
|
export const mapSelectedFilterStateToPropsByStatus =
|
|
@@ -33,6 +34,7 @@ export const mapSelectedFilterStateToPropsByStatus =
|
|
|
33
34
|
return {
|
|
34
35
|
activeFilters,
|
|
35
36
|
loading,
|
|
37
|
+
filterTypes: getConceptFilterTypes(state),
|
|
36
38
|
selectedFilter,
|
|
37
39
|
selectedFilters,
|
|
38
40
|
selectedFilterActiveValues,
|