@truedat/bg 8.6.7 → 8.7.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.7.0",
|
|
4
4
|
"description": "Truedat Web Business Glossary",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@testing-library/jest-dom": "^6.6.3",
|
|
55
55
|
"@testing-library/react": "^16.3.0",
|
|
56
56
|
"@testing-library/user-event": "^14.6.1",
|
|
57
|
-
"@truedat/test": "8.
|
|
57
|
+
"@truedat/test": "8.7.0",
|
|
58
58
|
"identity-obj-proxy": "^3.0.0",
|
|
59
59
|
"jest": "^29.7.0",
|
|
60
60
|
"redux-saga-test-plan": "^4.0.6"
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
88
88
|
"swr": "^2.3.3"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "375298315086154cea326bfaebc504d6e45873ed"
|
|
91
91
|
}
|
|
@@ -5,6 +5,7 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import { connect } from "react-redux";
|
|
6
6
|
import { useLanguage } from "@truedat/core/i18n";
|
|
7
7
|
import { splitTranslatableFields } from "@truedat/core/services/i18nContent";
|
|
8
|
+
import { applyTemplate } from "@truedat/df/utils";
|
|
8
9
|
import { conceptAction } from "../routines";
|
|
9
10
|
import { useConceptVersionsActions } from "../hooks/useConcepts";
|
|
10
11
|
import ConceptForm from "./ConceptForm";
|
|
@@ -20,16 +21,24 @@ const ConceptCreate = ({ conceptActionLoading, conceptAction }) => {
|
|
|
20
21
|
const [template, setTemplate] = useState();
|
|
21
22
|
|
|
22
23
|
useEffect(() => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
if (!template) return;
|
|
25
|
+
|
|
26
|
+
const translatableKeys = _.keys(
|
|
27
|
+
splitTranslatableFields(template).translatable,
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
const updateI18nConcept = _.mapValues((langContent) => {
|
|
31
|
+
const filled = applyTemplate(template)(
|
|
32
|
+
langContent.content || {},
|
|
33
|
+
domainId,
|
|
34
|
+
);
|
|
35
|
+
return {
|
|
26
36
|
...langContent,
|
|
27
37
|
content: langContent.is_default
|
|
28
|
-
?
|
|
29
|
-
:
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
)(i18nConcept);
|
|
38
|
+
? filled
|
|
39
|
+
: _.pick(translatableKeys, filled),
|
|
40
|
+
};
|
|
41
|
+
})(i18nConcept);
|
|
33
42
|
|
|
34
43
|
if (!_.isEqual(i18nConcept, updateI18nConcept)) {
|
|
35
44
|
setI18nConcept(updateI18nConcept);
|
|
@@ -98,6 +98,10 @@ export const ConceptEditLoader = (props) => {
|
|
|
98
98
|
const template = _.prop("template")(data);
|
|
99
99
|
const processedContent = applyTemplate(template);
|
|
100
100
|
|
|
101
|
+
const translatableKeys = _.keys(
|
|
102
|
+
splitTranslatableFields(template).translatable,
|
|
103
|
+
);
|
|
104
|
+
|
|
101
105
|
const i18nContent = _.flow(
|
|
102
106
|
_.filter(({ is_enabled }) => is_enabled),
|
|
103
107
|
_.map(({ id, lang, is_default, is_required }) => {
|
|
@@ -105,10 +109,10 @@ export const ConceptEditLoader = (props) => {
|
|
|
105
109
|
|
|
106
110
|
const langContent = is_default
|
|
107
111
|
? propContent
|
|
108
|
-
:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
: _.pick(
|
|
113
|
+
translatableKeys,
|
|
114
|
+
processedContent(contentLang?.content || {}, domain?.id),
|
|
115
|
+
);
|
|
112
116
|
const langName = is_default ? propName : contentLang?.name || "";
|
|
113
117
|
|
|
114
118
|
return {
|
|
@@ -70,10 +70,10 @@ const ConceptForm = ({
|
|
|
70
70
|
const handleI18nNameChange = (lang, name) =>
|
|
71
71
|
setI18nConcept(_.set(`${lang}.name`, name, i18nConcept));
|
|
72
72
|
const handleI18nConceptContentChange = (lang, { content }) => {
|
|
73
|
-
setI18nConcept({
|
|
74
|
-
...
|
|
75
|
-
[lang]: { ...
|
|
76
|
-
});
|
|
73
|
+
setI18nConcept((prev) => ({
|
|
74
|
+
...prev,
|
|
75
|
+
[lang]: { ...prev[lang], content: { ...content } },
|
|
76
|
+
}));
|
|
77
77
|
};
|
|
78
78
|
const checkCanTranslate = () => {
|
|
79
79
|
if (!disable_td_ai && templateId && domainId) {
|