@truedat/bg 6.6.6 → 6.7.1
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 +1 -1
- package/src/concepts/components/ConceptCreate.js +6 -6
- package/src/concepts/components/ConceptForm.js +9 -2
- package/src/concepts/components/__tests__/ConcepEdit.spec.js +1 -1
- package/src/concepts/components/__tests__/ConceptCompleteness.spec.js +5 -5
- package/src/concepts/components/__tests__/ConceptDetails.spec.js +37 -8
- package/src/concepts/components/__tests__/ConceptsBulkUpdate.spec.js +4 -1
- package/src/concepts/components/__tests__/__snapshots__/ConcepEdit.spec.js.snap +7 -7
- package/src/concepts/components/__tests__/__snapshots__/ConceptCompleteness.spec.js.snap +1 -0
- package/src/concepts/components/__tests__/__snapshots__/ConceptDetails.spec.js.snap +34 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.1",
|
|
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.
|
|
37
|
+
"@truedat/test": "6.7.1",
|
|
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.7.1",
|
|
90
|
+
"@truedat/df": "6.7.1",
|
|
91
|
+
"@truedat/lm": "6.7.1",
|
|
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": "58ccce26894edb2d7b703c8cf22d62a8d993858c"
|
|
115
115
|
}
|
|
@@ -14,7 +14,7 @@ const missingRequiredFields = (concept, content) => {
|
|
|
14
14
|
_.flatMap(({ fields }) =>
|
|
15
15
|
_.filter((field) => {
|
|
16
16
|
const name = field?.name;
|
|
17
|
-
const value = _.prop(name)(content);
|
|
17
|
+
const value = _.prop("value")(_.prop(name)(content));
|
|
18
18
|
return (
|
|
19
19
|
!_.isNumber(value) &&
|
|
20
20
|
isRequired(field, content) &&
|
|
@@ -26,17 +26,17 @@ const ConceptCreate = ({ conceptActionLoading, conceptAction }) => {
|
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
const templateFields = splitTranslatableFields(template);
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const translatableFields = _.keys(templateFields.translatable);
|
|
30
|
+
const noTranslatableFields = _.keys(templateFields.noTranslatable);
|
|
31
|
+
|
|
32
|
+
setTranslatableKeys(translatableFields);
|
|
33
|
+
setNoTranslatableKeys(noTranslatableFields);
|
|
31
34
|
|
|
32
35
|
const updateI18nConcept = _.flow(
|
|
33
36
|
_.map((langContent) => ({
|
|
34
37
|
...langContent,
|
|
35
38
|
content: langContent.is_default
|
|
36
|
-
? {
|
|
37
|
-
...templateFields.translatable,
|
|
38
|
-
...templateFields.noTranslatable,
|
|
39
|
-
}
|
|
39
|
+
? { ...langContent.content }
|
|
40
40
|
: { ...templateFields.translatable },
|
|
41
41
|
})),
|
|
42
42
|
_.keyBy("lang")
|
|
@@ -79,8 +79,15 @@ const ConceptForm = ({
|
|
|
79
79
|
onChangeConceptContent(concept.lang, content);
|
|
80
80
|
|
|
81
81
|
const applySuggestions = (suggestions) => {
|
|
82
|
+
const suggestionContent = _.flow(
|
|
83
|
+
Object.entries,
|
|
84
|
+
_.reduce(
|
|
85
|
+
(acc, [key, value]) => _.set(key, { value, origin: "ai" })(acc),
|
|
86
|
+
{}
|
|
87
|
+
)
|
|
88
|
+
)(suggestions);
|
|
82
89
|
onChangeConceptContent(concept.lang, {
|
|
83
|
-
content: { ...concept?.content, ...
|
|
90
|
+
content: { ...concept?.content, ...suggestionContent },
|
|
84
91
|
});
|
|
85
92
|
};
|
|
86
93
|
|
|
@@ -165,7 +172,7 @@ ConceptForm.propTypes = {
|
|
|
165
172
|
onChangeTemplate: PropTypes.func,
|
|
166
173
|
onChangeConceptContent: PropTypes.func,
|
|
167
174
|
actionKey: PropTypes.string,
|
|
168
|
-
|
|
175
|
+
loading: PropTypes.bool,
|
|
169
176
|
};
|
|
170
177
|
|
|
171
178
|
export default ConceptForm;
|
|
@@ -101,7 +101,7 @@ describe("<ConceptEdit />", () => {
|
|
|
101
101
|
applyTemplate: jest.fn(),
|
|
102
102
|
};
|
|
103
103
|
it("matches the latest snapshot", async () => {
|
|
104
|
-
const { container, queryByText
|
|
104
|
+
const { container, queryByText } = render(
|
|
105
105
|
<Suspense fallback={null}>
|
|
106
106
|
<ConceptEdit {...props} />
|
|
107
107
|
</Suspense>,
|
|
@@ -7,7 +7,7 @@ jest.mock("@truedat/core/hooks", () => ({
|
|
|
7
7
|
loading: false,
|
|
8
8
|
locales: [
|
|
9
9
|
{
|
|
10
|
-
lang: "
|
|
10
|
+
lang: "es",
|
|
11
11
|
id: 1,
|
|
12
12
|
is_default: true,
|
|
13
13
|
is_required: true,
|
|
@@ -25,15 +25,15 @@ describe("<ConceptCompleteness />", () => {
|
|
|
25
25
|
content: [
|
|
26
26
|
{
|
|
27
27
|
fields: [
|
|
28
|
-
{ cardinality: "?", name: "field1" },
|
|
29
|
-
{ cardinality: "1", name: "field2" },
|
|
30
|
-
{ cardinality: "1", name: "field3" },
|
|
28
|
+
{ cardinality: "?", name: "field1", label: "label1" },
|
|
29
|
+
{ cardinality: "1", name: "field2", label: "label2" },
|
|
30
|
+
{ cardinality: "1", name: "field3", label: "label3" },
|
|
31
31
|
],
|
|
32
32
|
},
|
|
33
33
|
],
|
|
34
34
|
},
|
|
35
35
|
content: {
|
|
36
|
-
field3: "value",
|
|
36
|
+
field3: { value: "value", origin: "user" },
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
};
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { render } from "@truedat/test/render";
|
|
3
3
|
import { ConceptDetails } from "../ConceptDetails";
|
|
4
4
|
|
|
5
|
+
jest.mock("@truedat/core/hooks", () => ({
|
|
6
|
+
useLocales: jest.fn(() => ({
|
|
7
|
+
loading: false,
|
|
8
|
+
locales: [
|
|
9
|
+
{
|
|
10
|
+
lang: "en",
|
|
11
|
+
id: 1,
|
|
12
|
+
is_default: true,
|
|
13
|
+
is_required: true,
|
|
14
|
+
is_enabled: true,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
})),
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
const renderOpts = {
|
|
21
|
+
fallback: <div>Loading</div>,
|
|
22
|
+
};
|
|
23
|
+
|
|
5
24
|
describe("<ConceptDetails />", () => {
|
|
6
25
|
const props = {
|
|
7
26
|
concept: {
|
|
@@ -9,17 +28,27 @@ describe("<ConceptDetails />", () => {
|
|
|
9
28
|
type: "type",
|
|
10
29
|
status: "draft",
|
|
11
30
|
template: {
|
|
12
|
-
content: [
|
|
31
|
+
content: [
|
|
32
|
+
{
|
|
33
|
+
name: "foo_group",
|
|
34
|
+
fields: [
|
|
35
|
+
{ name: "field", label: "field_label", values: ["value1"] },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
content: {
|
|
41
|
+
field: { value: "value1", origin: "user" },
|
|
13
42
|
},
|
|
14
43
|
},
|
|
15
44
|
};
|
|
16
45
|
|
|
17
|
-
it("matches the latest snapshot", () => {
|
|
18
|
-
const { container } = render(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
);
|
|
46
|
+
it("matches the latest snapshot", async () => {
|
|
47
|
+
const { container, findByText } = render(<ConceptDetails {...props} />, {
|
|
48
|
+
...renderOpts,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
await findByText("field_label");
|
|
23
52
|
expect(container).toMatchSnapshot();
|
|
24
53
|
});
|
|
25
54
|
});
|
|
@@ -86,7 +86,10 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
86
86
|
await waitFor(() => {
|
|
87
87
|
expect(dispatch).toHaveBeenLastCalledWith(
|
|
88
88
|
bulkUpdate({
|
|
89
|
-
updateAttributes: {
|
|
89
|
+
updateAttributes: {
|
|
90
|
+
content: { field1: { value: "abc123456", origin: "user" } },
|
|
91
|
+
domain_id: 1,
|
|
92
|
+
},
|
|
90
93
|
searchParams: {},
|
|
91
94
|
})
|
|
92
95
|
);
|
|
@@ -80,10 +80,10 @@ exports[`<ConceptEdit /> matches the latest snapshot 1`] = `
|
|
|
80
80
|
<div
|
|
81
81
|
aria-atomic="true"
|
|
82
82
|
aria-live="polite"
|
|
83
|
-
class="divider text"
|
|
83
|
+
class="divider default text"
|
|
84
84
|
role="alert"
|
|
85
85
|
>
|
|
86
|
-
|
|
86
|
+
Select one...
|
|
87
87
|
</div>
|
|
88
88
|
<i
|
|
89
89
|
aria-hidden="true"
|
|
@@ -96,8 +96,8 @@ exports[`<ConceptEdit /> matches the latest snapshot 1`] = `
|
|
|
96
96
|
>
|
|
97
97
|
<div
|
|
98
98
|
aria-checked="false"
|
|
99
|
-
aria-selected="
|
|
100
|
-
class="item"
|
|
99
|
+
aria-selected="true"
|
|
100
|
+
class="selected item"
|
|
101
101
|
role="option"
|
|
102
102
|
style="pointer-events: all;"
|
|
103
103
|
>
|
|
@@ -121,9 +121,9 @@ exports[`<ConceptEdit /> matches the latest snapshot 1`] = `
|
|
|
121
121
|
</span>
|
|
122
122
|
</div>
|
|
123
123
|
<div
|
|
124
|
-
aria-checked="
|
|
125
|
-
aria-selected="
|
|
126
|
-
class="
|
|
124
|
+
aria-checked="false"
|
|
125
|
+
aria-selected="false"
|
|
126
|
+
class="item"
|
|
127
127
|
role="option"
|
|
128
128
|
style="pointer-events: all;"
|
|
129
129
|
>
|
|
@@ -4,7 +4,39 @@ exports[`<ConceptDetails /> matches the latest snapshot 1`] = `
|
|
|
4
4
|
<div>
|
|
5
5
|
<div
|
|
6
6
|
class="ui bottom attached segment"
|
|
7
|
-
style="
|
|
8
|
-
|
|
7
|
+
style=""
|
|
8
|
+
>
|
|
9
|
+
<div
|
|
10
|
+
class="ui horizontal divider"
|
|
11
|
+
>
|
|
12
|
+
<h3>
|
|
13
|
+
foo_group
|
|
14
|
+
</h3>
|
|
15
|
+
</div>
|
|
16
|
+
<div
|
|
17
|
+
class="ui big very relaxed list"
|
|
18
|
+
role="list"
|
|
19
|
+
>
|
|
20
|
+
<div
|
|
21
|
+
class="item"
|
|
22
|
+
role="listitem"
|
|
23
|
+
>
|
|
24
|
+
<div
|
|
25
|
+
class="header dynamic-field-header"
|
|
26
|
+
>
|
|
27
|
+
field_label
|
|
28
|
+
</div>
|
|
29
|
+
<div
|
|
30
|
+
class="description"
|
|
31
|
+
>
|
|
32
|
+
<div
|
|
33
|
+
class="default-value"
|
|
34
|
+
>
|
|
35
|
+
value1
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
9
41
|
</div>
|
|
10
42
|
`;
|