@truedat/df 7.6.0 → 7.6.2
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 +4 -4
- package/src/components/DynamicForm.js +4 -4
- package/src/components/SelectableDynamicForm.js +3 -11
- package/src/components/__tests__/DynamicForm.spec.js +2 -1
- package/src/templates/utils/__tests__/formatLegacyContent.spec.js +12 -0
- package/src/templates/utils/formatLegacyContent.js +3 -0
- package/src/templates/utils/index.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/df",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.2",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -48,14 +48,14 @@
|
|
|
48
48
|
"@testing-library/jest-dom": "^6.6.3",
|
|
49
49
|
"@testing-library/react": "^16.3.0",
|
|
50
50
|
"@testing-library/user-event": "^14.6.1",
|
|
51
|
-
"@truedat/test": "7.6.
|
|
51
|
+
"@truedat/test": "7.6.2",
|
|
52
52
|
"identity-obj-proxy": "^3.0.0",
|
|
53
53
|
"jest": "^29.7.0",
|
|
54
54
|
"redux-saga-test-plan": "^4.0.6"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@apollo/client": "^3.13.8",
|
|
58
|
-
"@truedat/core": "7.6.
|
|
58
|
+
"@truedat/core": "7.6.2",
|
|
59
59
|
"axios": "^1.9.0",
|
|
60
60
|
"graphql": "^16.11.0",
|
|
61
61
|
"is-hotkey": "^0.2.0",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
85
85
|
"swr": "^2.3.3"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "413392c768bdc4e352be8863a70b031483b9ca88"
|
|
88
88
|
}
|
|
@@ -22,7 +22,7 @@ export const DynamicForm = ({
|
|
|
22
22
|
const domainId = selectedDomain?.id;
|
|
23
23
|
|
|
24
24
|
useEffect(() => {
|
|
25
|
-
if (!_.
|
|
25
|
+
if (!_.isEmpty(template)) {
|
|
26
26
|
onChange(applyTemplate(content, domainId));
|
|
27
27
|
}
|
|
28
28
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -59,9 +59,9 @@ export const DynamicForm = ({
|
|
|
59
59
|
name={
|
|
60
60
|
name
|
|
61
61
|
? formatMessage({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
id: `templates.groups.${name}`,
|
|
63
|
+
defaultMessage: name,
|
|
64
|
+
})
|
|
65
65
|
: null
|
|
66
66
|
}
|
|
67
67
|
noTranslatableFields={noTranslatableFields}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import {
|
|
2
|
+
import { useState } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { TemplateSelector } from "@truedat/core/components";
|
|
5
|
-
import {
|
|
5
|
+
import { validateContent } from "@truedat/df/utils";
|
|
6
6
|
import DynamicForm from "./DynamicForm";
|
|
7
7
|
|
|
8
8
|
export default function SelectableDynamicForm({
|
|
@@ -16,7 +16,7 @@ export default function SelectableDynamicForm({
|
|
|
16
16
|
actionKey,
|
|
17
17
|
onChange,
|
|
18
18
|
onNameChange,
|
|
19
|
-
onTemplateChange = () => {},
|
|
19
|
+
onTemplateChange = () => { },
|
|
20
20
|
label,
|
|
21
21
|
placeholder,
|
|
22
22
|
required,
|
|
@@ -44,20 +44,12 @@ export default function SelectableDynamicForm({
|
|
|
44
44
|
onNameChange(template?.name);
|
|
45
45
|
onTemplateChange(template);
|
|
46
46
|
}
|
|
47
|
-
handleChange(
|
|
48
|
-
template ? applyTemplate(template)(content, domain?.id) : {},
|
|
49
|
-
template
|
|
50
|
-
);
|
|
51
47
|
setThisTemplate(template);
|
|
52
48
|
};
|
|
53
49
|
|
|
54
50
|
const handleSelected = (_e, { template }) => {
|
|
55
51
|
onNameChange(template?.name);
|
|
56
52
|
onTemplateChange(template);
|
|
57
|
-
handleChange(
|
|
58
|
-
template ? applyTemplate(template)(content, domain?.id) : {},
|
|
59
|
-
template
|
|
60
|
-
);
|
|
61
53
|
setThisTemplate(template);
|
|
62
54
|
};
|
|
63
55
|
|
|
@@ -135,8 +135,9 @@ describe("<DynamicForm />", () => {
|
|
|
135
135
|
};
|
|
136
136
|
const rendered = render(<DynamicForm {...props} />);
|
|
137
137
|
await waitForLoad(rendered);
|
|
138
|
-
rendered.rerender(<DynamicForm {...props} selectedDomain={{ id: 1 }} />);
|
|
139
138
|
expect(onChange).toHaveBeenCalledTimes(1);
|
|
139
|
+
rendered.rerender(<DynamicForm {...props} selectedDomain={{ id: 1 }} />);
|
|
140
|
+
expect(onChange).toHaveBeenCalledTimes(2);
|
|
140
141
|
});
|
|
141
142
|
|
|
142
143
|
it("it ignores values in prop fields to omit", async () => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { formatLegacyContent } from "..";
|
|
2
|
+
|
|
3
|
+
describe("utils: formatLegacyContent", () => {
|
|
4
|
+
it("should formats legacy contet", () => {
|
|
5
|
+
const content = { single: "foo", multiple: ["bar", "baz"] };
|
|
6
|
+
const result = formatLegacyContent(content);
|
|
7
|
+
expect(result).toEqual({
|
|
8
|
+
single: { value: "foo", origin: "user" },
|
|
9
|
+
multiple: { value: ["bar", "baz"], origin: "user" },
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
});
|