@truedat/bg 6.2.2 → 6.3.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/package.json +6 -6
- package/src/concepts/components/ConceptCompleteness.js +7 -1
- package/src/concepts/components/ConceptCreate.js +1 -0
- package/src/concepts/components/ConceptDetails.js +4 -2
- package/src/concepts/components/ConceptEdit.js +1 -0
- package/src/concepts/components/ConceptForms.js +5 -1
- package/src/concepts/components/__tests__/ConceptForm.spec.js +9 -51
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
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": "6.2.
|
|
37
|
+
"@truedat/test": "6.2.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": "6.
|
|
90
|
-
"@truedat/df": "6.
|
|
91
|
-
"@truedat/lm": "6.
|
|
89
|
+
"@truedat/core": "6.3.0",
|
|
90
|
+
"@truedat/df": "6.3.0",
|
|
91
|
+
"@truedat/lm": "6.3.0",
|
|
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": "fadb5776768bcbaeac2ed35e6fdbef23c0a8263a"
|
|
115
115
|
}
|
|
@@ -28,6 +28,7 @@ const missingRequiredFields = (concept, content) => {
|
|
|
28
28
|
export const Completeness = ({
|
|
29
29
|
status,
|
|
30
30
|
completeness,
|
|
31
|
+
lang,
|
|
31
32
|
langLocalName,
|
|
32
33
|
concept,
|
|
33
34
|
content,
|
|
@@ -39,7 +40,10 @@ export const Completeness = ({
|
|
|
39
40
|
id="concepts.props.completeness"
|
|
40
41
|
defaultMessage="Completeness"
|
|
41
42
|
/>{" "}
|
|
42
|
-
|
|
43
|
+
<FormattedMessage
|
|
44
|
+
id={`i18n.messages.locale.${lang}`}
|
|
45
|
+
defaultMessage={langLocalName}
|
|
46
|
+
/>
|
|
43
47
|
</Header>
|
|
44
48
|
<>{}</>
|
|
45
49
|
<Progress
|
|
@@ -82,6 +86,7 @@ Completeness.propTypes = {
|
|
|
82
86
|
concept: PropTypes.object,
|
|
83
87
|
status: PropTypes.string,
|
|
84
88
|
completeness: PropTypes.number,
|
|
89
|
+
lang: PropTypes.string,
|
|
85
90
|
langLocalName: PropTypes.string,
|
|
86
91
|
content: PropTypes.object,
|
|
87
92
|
};
|
|
@@ -138,6 +143,7 @@ export const ConceptCompleteness = ({ concept }) => {
|
|
|
138
143
|
key={lang}
|
|
139
144
|
status={status}
|
|
140
145
|
completeness={completeness}
|
|
146
|
+
lang={lang}
|
|
141
147
|
langLocalName={_.size(i18nConcept) > 1 ? langLocalName : null}
|
|
142
148
|
concept={concept}
|
|
143
149
|
content={content}
|
|
@@ -63,6 +63,7 @@ const ConceptCreate = ({ action, conceptActionLoading, conceptAction }) => {
|
|
|
63
63
|
|
|
64
64
|
const i18nSendConcept = _.flow(
|
|
65
65
|
_.omit(defaultContent.lang),
|
|
66
|
+
_.omitBy(({ name, is_required }) => _.isEmpty(name) && !is_required),
|
|
66
67
|
_.mapValues((langConcept) =>
|
|
67
68
|
_.flow(_.pick(["name", "content"]), ({ name, content }) => {
|
|
68
69
|
return { name, content: _.pick(translatableKeys)(content) };
|
|
@@ -52,13 +52,15 @@ export const ConceptDetails = ({ concept }) => {
|
|
|
52
52
|
content: langContent,
|
|
53
53
|
};
|
|
54
54
|
}),
|
|
55
|
+
_.filter(({ content }) => !_.isEmpty(content)),
|
|
55
56
|
_.orderBy(["isDefault", "isRequired", "lang"], ["desc", "desc", "asc"]),
|
|
56
57
|
_.keyBy("lang")
|
|
57
58
|
)(locales);
|
|
58
59
|
|
|
59
60
|
return (
|
|
60
61
|
<Segment attached="bottom">
|
|
61
|
-
{_.
|
|
62
|
+
{!_.includes(concept.status)(["published", "versioned"]) &&
|
|
63
|
+
_.size(i18nConcept) > 1 ? (
|
|
62
64
|
<ButtonGroup floated="right">
|
|
63
65
|
{_.flow(
|
|
64
66
|
_.map(({ lang, content }) => {
|
|
@@ -77,7 +79,7 @@ export const ConceptDetails = ({ concept }) => {
|
|
|
77
79
|
) : null}
|
|
78
80
|
<DynamicFormViewer
|
|
79
81
|
template={concept.template}
|
|
80
|
-
content={i18nConcept[selectedLang]?.content}
|
|
82
|
+
content={i18nConcept[selectedLang]?.content || concept.content}
|
|
81
83
|
/>
|
|
82
84
|
</Segment>
|
|
83
85
|
);
|
|
@@ -73,6 +73,7 @@ export const ConceptEdit = ({
|
|
|
73
73
|
|
|
74
74
|
const i18nSendConcept = _.flow(
|
|
75
75
|
_.omit(defaultContent.lang),
|
|
76
|
+
_.omitBy(({ name, is_required }) => _.isEmpty(name) && !is_required),
|
|
76
77
|
_.mapValues((langConcept) =>
|
|
77
78
|
_.flow(_.pick(["name", "content"]), ({ name, content }) => {
|
|
78
79
|
return { name, content: _.pick(translatableKeys)(content) };
|
|
@@ -65,7 +65,11 @@ const ConceptForms = ({
|
|
|
65
65
|
const validDomain = () => _.isFinite(domainId);
|
|
66
66
|
|
|
67
67
|
const validNames = () =>
|
|
68
|
-
_.flow(
|
|
68
|
+
_.flow(
|
|
69
|
+
_.filter("is_required"),
|
|
70
|
+
_.map("name"),
|
|
71
|
+
_.every(isNonEmptyString)
|
|
72
|
+
)(i18nConcept);
|
|
69
73
|
|
|
70
74
|
const validTemplate = () =>
|
|
71
75
|
_.isObject(template) && isNonEmptyString(template?.name);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { Suspense } from "react";
|
|
2
2
|
import { waitFor } from "@testing-library/react";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
4
|
import { render } from "@truedat/test/render";
|
|
@@ -44,11 +44,9 @@ const props = {
|
|
|
44
44
|
onChangeConceptContent: jest.fn(),
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
// domains: [{ id: 1, name: "domain1" }],
|
|
51
|
-
// };
|
|
47
|
+
const state = {
|
|
48
|
+
// domains: [{ id: 1, name: "domain1" }],
|
|
49
|
+
};
|
|
52
50
|
const templateVariables = { scope: "bg", domainIds: [1] };
|
|
53
51
|
const domainVariables = { action: "createBusinessConcept" };
|
|
54
52
|
|
|
@@ -59,63 +57,23 @@ describe("<ConceptForm />", () => {
|
|
|
59
57
|
multipleTemplatesMock(templateVariables),
|
|
60
58
|
domainsMock(domainVariables),
|
|
61
59
|
],
|
|
62
|
-
|
|
60
|
+
state,
|
|
63
61
|
fallback: "lazy",
|
|
64
62
|
};
|
|
65
63
|
|
|
66
64
|
it("matches the latest snapshot", async () => {
|
|
67
65
|
const { container, queryByText } = render(
|
|
68
|
-
<
|
|
66
|
+
<Suspense fallback={null}>
|
|
67
|
+
<ConceptForm {...props} />
|
|
68
|
+
</Suspense>,
|
|
69
69
|
renderOpts
|
|
70
70
|
);
|
|
71
71
|
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
72
72
|
await waitFor(() =>
|
|
73
73
|
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
74
74
|
);
|
|
75
|
-
|
|
75
|
+
await waitFor(() => expect(queryByText(/bazDomain/)).toBeInTheDocument());
|
|
76
76
|
expect(container).toMatchSnapshot();
|
|
77
77
|
});
|
|
78
|
-
|
|
79
|
-
// it("renders dynamic fields when template is selected", async () => {
|
|
80
|
-
// const { findByText, getByText, queryByText, getAllByRole } = render(
|
|
81
|
-
// <ConceptForm />,
|
|
82
|
-
// renderOpts
|
|
83
|
-
// );
|
|
84
|
-
// await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
85
|
-
// await waitFor(() => expect(queryByText(/fooDomain/)).toBeInTheDocument());
|
|
86
|
-
// userEvent.click(await findByText("fooDomain"));
|
|
87
|
-
// userEvent.type(getAllByRole("textbox")[1], "name");
|
|
88
|
-
// userEvent.click(await findByText("template1"));
|
|
89
|
-
// expect(getByText("field1")).toBeInTheDocument();
|
|
90
|
-
// });
|
|
91
78
|
});
|
|
92
|
-
|
|
93
|
-
// describe("with a single template", () => {
|
|
94
|
-
// const renderOpts = {
|
|
95
|
-
// mocks: [singleTemplateMock(templateVariables)],
|
|
96
|
-
// state,
|
|
97
|
-
// fallback: "lazy",
|
|
98
|
-
// };
|
|
99
|
-
|
|
100
|
-
// it("matches the latest snapshot", async () => {
|
|
101
|
-
// const { container, queryByText } = render(<ConceptForm />, renderOpts);
|
|
102
|
-
// await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
103
|
-
// await waitFor(() =>
|
|
104
|
-
// expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
105
|
-
// );
|
|
106
|
-
// await waitFor(() =>
|
|
107
|
-
// expect(queryByText(/fooDomain/)).not.toBeInTheDocument()
|
|
108
|
-
// );
|
|
109
|
-
// expect(container).toMatchSnapshot();
|
|
110
|
-
// });
|
|
111
|
-
|
|
112
|
-
// it("contains no <TemplateSelector />", async () => {
|
|
113
|
-
// const { queryByText } = render(<ConceptForm />, renderOpts);
|
|
114
|
-
// await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
115
|
-
// await waitFor(() =>
|
|
116
|
-
// expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
117
|
-
// );
|
|
118
|
-
// expect(queryByText("template1")).not.toBeInTheDocument();
|
|
119
|
-
// });
|
|
120
|
-
// });
|
|
121
79
|
});
|