@truedat/df 4.48.2 → 4.48.5
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/CHANGELOG.md +12 -0
- package/package.json +4 -4
- package/src/components/DynamicFieldValue.js +8 -6
- package/src/components/DynamicForm.js +1 -1
- package/src/components/DynamicFormViewer.js +1 -1
- package/src/components/EditableDynamicFieldValue.js +8 -6
- package/src/components/FieldGroupSubSegment/__tests__/FieldGroupSubSegment.spec.js +20 -20
- package/src/components/FieldViewerValue.js +36 -14
- package/src/components/__tests__/FieldGroupCopy.spec.js +3 -3
- package/src/components/__tests__/FieldViewerValue.spec.js +5 -13
- package/src/components/__tests__/__snapshots__/FieldGroupCopy.spec.js.snap +178 -332
- package/src/components/__tests__/__snapshots__/FieldViewerValue.spec.js.snap +119 -982
- package/src/components/widgets/CheckboxField.js +1 -9
- package/src/components/widgets/RadioField.js +1 -9
- package/src/components/widgets/StandardDropdown.js +32 -22
- package/src/components/widgets/__tests__/RadioField.spec.js +1 -1
- package/src/components/widgets/__tests__/__snapshots__/CheckboxField.spec.js.snap +2 -12
- package/src/components/widgets/__tests__/__snapshots__/RadioField.spec.js.snap +5 -3
- package/src/components/widgets/__tests__/__snapshots__/StandardDropdown.spec.js.snap +31 -33
- package/src/templates/utils/__tests__/parseFieldOptions.spec.js +10 -7
- package/src/templates/utils/__tests__/parseGroups.spec.js +10 -7
- package/src/templates/utils/parseFieldOptions.js +66 -54
- package/src/templates/utils/parseGroups.js +24 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.48.5] 2022-07-11
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- [TD-5018] Support localization of fixed values
|
|
8
|
+
|
|
9
|
+
## [4.48.4] 2022-07-11
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [TD-5018] Support localization of fixed values
|
|
14
|
+
|
|
3
15
|
## [4.48.2] 2022-07-08
|
|
4
16
|
|
|
5
17
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/df",
|
|
3
|
-
"version": "4.48.
|
|
3
|
+
"version": "4.48.5",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
]
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@truedat/auth": "4.48.
|
|
91
|
-
"@truedat/core": "4.48.
|
|
90
|
+
"@truedat/auth": "4.48.5",
|
|
91
|
+
"@truedat/core": "4.48.5",
|
|
92
92
|
"axios": "^0.19.2",
|
|
93
93
|
"path-to-regexp": "^1.7.0",
|
|
94
94
|
"prop-types": "^15.8.1",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"react-dom": ">= 16.8.6 < 17",
|
|
108
108
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "668fb37a5ca8a3ca4d3009d9b6d218a8bec75d66"
|
|
111
111
|
}
|
|
@@ -32,26 +32,28 @@ export const DynamicFieldValue = ({
|
|
|
32
32
|
)
|
|
33
33
|
) : _.isArray(value) ? (
|
|
34
34
|
type == "table" ? (
|
|
35
|
-
<FieldViewerValue
|
|
35
|
+
<FieldViewerValue type={type} value={value} values={values} />
|
|
36
36
|
) : type == "system" ? (
|
|
37
37
|
<SystemPreview value={value} />
|
|
38
38
|
) : (
|
|
39
|
-
|
|
39
|
+
value.map((v, i) => (
|
|
40
40
|
<FieldViewerValue
|
|
41
41
|
key={i}
|
|
42
|
-
|
|
43
|
-
type={type}
|
|
42
|
+
label={label}
|
|
44
43
|
multiple
|
|
44
|
+
type={type}
|
|
45
|
+
value={v}
|
|
45
46
|
values={values}
|
|
46
47
|
/>
|
|
47
|
-
))
|
|
48
|
+
))
|
|
48
49
|
)
|
|
49
50
|
) : widget === "password" ? (
|
|
50
51
|
"*****"
|
|
51
52
|
) : (
|
|
52
53
|
<FieldViewerValue
|
|
53
|
-
|
|
54
|
+
label={label}
|
|
54
55
|
type={type}
|
|
56
|
+
value={value}
|
|
55
57
|
values={values}
|
|
56
58
|
widget={widget}
|
|
57
59
|
/>
|
|
@@ -93,26 +93,28 @@ export const EditableDynamicFieldValue = (props) => {
|
|
|
93
93
|
)
|
|
94
94
|
) : _.isArray(value) ? (
|
|
95
95
|
type == "table" ? (
|
|
96
|
-
<FieldViewerValue
|
|
96
|
+
<FieldViewerValue type={type} value={value} values={values} />
|
|
97
97
|
) : type == "system" ? (
|
|
98
98
|
<SystemPreview value={value} />
|
|
99
99
|
) : (
|
|
100
|
-
|
|
100
|
+
value.map((v, i) => (
|
|
101
101
|
<FieldViewerValue
|
|
102
102
|
key={i}
|
|
103
|
-
|
|
104
|
-
type={type}
|
|
103
|
+
label={label}
|
|
105
104
|
multiple
|
|
105
|
+
type={type}
|
|
106
|
+
value={v}
|
|
106
107
|
values={values}
|
|
107
108
|
/>
|
|
108
|
-
))
|
|
109
|
+
))
|
|
109
110
|
)
|
|
110
111
|
) : widget === "password" ? (
|
|
111
112
|
"*****"
|
|
112
113
|
) : (
|
|
113
114
|
<FieldViewerValue
|
|
114
|
-
|
|
115
|
+
label={label}
|
|
115
116
|
type={type}
|
|
117
|
+
value={value}
|
|
116
118
|
values={values}
|
|
117
119
|
widget={widget}
|
|
118
120
|
/>
|
|
@@ -5,7 +5,7 @@ import { FieldGroupSubSegment } from "../FieldGroupSubSegment";
|
|
|
5
5
|
describe("<FieldGroupSubSegment />", () => {
|
|
6
6
|
const setState = jest.fn();
|
|
7
7
|
const useStateSpy = jest.spyOn(React, "useState");
|
|
8
|
-
useStateSpy.mockImplementation(init => [init, setState]);
|
|
8
|
+
useStateSpy.mockImplementation((init) => [init, setState]);
|
|
9
9
|
|
|
10
10
|
const onFieldChange = jest.fn();
|
|
11
11
|
const name = "copy";
|
|
@@ -19,7 +19,7 @@ describe("<FieldGroupSubSegment />", () => {
|
|
|
19
19
|
parsedValues: undefined,
|
|
20
20
|
type: "string",
|
|
21
21
|
value: "a",
|
|
22
|
-
widget: "string"
|
|
22
|
+
widget: "string",
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
cardinality: "1",
|
|
@@ -38,11 +38,11 @@ describe("<FieldGroupSubSegment />", () => {
|
|
|
38
38
|
{ text: "template.widget.copy.fixed.column", value: "DAT" },
|
|
39
39
|
{ text: "template.widget.copy.fixed.column", value: "TXT" },
|
|
40
40
|
{ text: "template.widget.copy.fixed.column", value: "Sin formato" },
|
|
41
|
-
{ text: "template.widget.copy.without.fixed.column", value: "hola" }
|
|
42
|
-
]
|
|
41
|
+
{ text: "template.widget.copy.without.fixed.column", value: "hola" },
|
|
42
|
+
],
|
|
43
43
|
},
|
|
44
|
-
widget: "copy"
|
|
45
|
-
}
|
|
44
|
+
widget: "copy",
|
|
45
|
+
},
|
|
46
46
|
];
|
|
47
47
|
const props = { onFieldChange, name, fields, prevFields };
|
|
48
48
|
|
|
@@ -66,12 +66,12 @@ describe("<FieldGroupSubSegment />", () => {
|
|
|
66
66
|
.onChange(
|
|
67
67
|
{
|
|
68
68
|
preventDefault() {},
|
|
69
|
-
target: {}
|
|
69
|
+
target: {},
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
name: "copy",
|
|
73
73
|
value:
|
|
74
|
-
'{"fileFormat": "DAT", "compression": "brotli", "fields": [{ "name": "New54", "type": "string", "size": 40 },{ "name": "New53", "type": "string", "size": 40 }]}'
|
|
74
|
+
'{"fileFormat": "DAT", "compression": "brotli", "fields": [{ "name": "New54", "type": "string", "size": 40 },{ "name": "New53", "type": "string", "size": 40 }]}',
|
|
75
75
|
}
|
|
76
76
|
);
|
|
77
77
|
expect(wrapper.find("Segment > div Button").props().disabled).toBe(true);
|
|
@@ -86,12 +86,12 @@ describe("<FieldGroupSubSegment />", () => {
|
|
|
86
86
|
.onChange(
|
|
87
87
|
{
|
|
88
88
|
preventDefault() {},
|
|
89
|
-
target: {}
|
|
89
|
+
target: {},
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
92
|
name: "copy",
|
|
93
93
|
value:
|
|
94
|
-
'{"fileFormat": "DAT", "compression": "brotli", "fields": [{ "name": "New54", "type": "string", "size": 40 },{ "name": "New53", "type": "string", "size": 40 }]}'
|
|
94
|
+
'{"fileFormat": "DAT", "compression": "brotli", "fields": [{ "name": "New54", "type": "string", "size": 40 },{ "name": "New53", "type": "string", "size": 40 }]}',
|
|
95
95
|
}
|
|
96
96
|
);
|
|
97
97
|
expect(wrapper.find(".errorMessage").props().id).toBe(
|
|
@@ -108,12 +108,12 @@ describe("<FieldGroupSubSegment />", () => {
|
|
|
108
108
|
.onChange(
|
|
109
109
|
{
|
|
110
110
|
preventDefault() {},
|
|
111
|
-
target: {}
|
|
111
|
+
target: {},
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
114
|
name: "copy",
|
|
115
115
|
value:
|
|
116
|
-
'{"fileFormat": "DAT", "header": false, "compression": "brotli", "fields": [{ "name": "New54", "type": "string"},{ "name": "New53", "type": "string", "size": 40 }]}'
|
|
116
|
+
'{"fileFormat": "DAT", "header": false, "compression": "brotli", "fields": [{ "name": "New54", "type": "string"},{ "name": "New53", "type": "string", "size": 40 }]}',
|
|
117
117
|
}
|
|
118
118
|
);
|
|
119
119
|
expect(wrapper.find(".errorMessage").props().id).toBe(
|
|
@@ -130,12 +130,12 @@ describe("<FieldGroupSubSegment />", () => {
|
|
|
130
130
|
.onChange(
|
|
131
131
|
{
|
|
132
132
|
preventDefault() {},
|
|
133
|
-
target: {}
|
|
133
|
+
target: {},
|
|
134
134
|
},
|
|
135
135
|
{
|
|
136
136
|
name: "copy",
|
|
137
137
|
value:
|
|
138
|
-
'{"fileFormat": "DAT", "header": false, "compression": "brotli", "delimiter": "sss","fields": [{ "name": "New54", "type": "string"},{ "name": "New53", "type": "string", "size": 40 }]}'
|
|
138
|
+
'{"fileFormat": "DAT", "header": false, "compression": "brotli", "delimiter": "sss","fields": [{ "name": "New54", "type": "string"},{ "name": "New53", "type": "string", "size": 40 }]}',
|
|
139
139
|
}
|
|
140
140
|
);
|
|
141
141
|
expect(wrapper.find(".errorMessage").props().id).toBe(
|
|
@@ -152,12 +152,12 @@ describe("<FieldGroupSubSegment />", () => {
|
|
|
152
152
|
.onChange(
|
|
153
153
|
{
|
|
154
154
|
preventDefault() {},
|
|
155
|
-
target: {}
|
|
155
|
+
target: {},
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
name: "copy",
|
|
159
159
|
value:
|
|
160
|
-
'{"fileFormat": "DAT", "header": false, "compression": "brotli","fields": [{ "name": "New54.", "type": "string", "size": 40},{ "name": "New53", "type": "string", "size": 40 }]}'
|
|
160
|
+
'{"fileFormat": "DAT", "header": false, "compression": "brotli","fields": [{ "name": "New54.", "type": "string", "size": 40},{ "name": "New53", "type": "string", "size": 40 }]}',
|
|
161
161
|
}
|
|
162
162
|
);
|
|
163
163
|
expect(wrapper.find(".errorMessage").props().id).toBe(
|
|
@@ -174,12 +174,12 @@ describe("<FieldGroupSubSegment />", () => {
|
|
|
174
174
|
.onChange(
|
|
175
175
|
{
|
|
176
176
|
preventDefault() {},
|
|
177
|
-
target: {}
|
|
177
|
+
target: {},
|
|
178
178
|
},
|
|
179
179
|
{
|
|
180
180
|
name: "copy",
|
|
181
181
|
value:
|
|
182
|
-
'{"header": false, "compression": "brotli","fields": [{ "name": "New54", "type": "string", "size": 40},{ "name": "New53", "type": "string", "size": 40 }]}'
|
|
182
|
+
'{"header": false, "compression": "brotli","fields": [{ "name": "New54", "type": "string", "size": 40},{ "name": "New53", "type": "string", "size": 40 }]}',
|
|
183
183
|
}
|
|
184
184
|
);
|
|
185
185
|
expect(wrapper.find(".errorMessage").props().id).toBe(
|
|
@@ -196,12 +196,12 @@ describe("<FieldGroupSubSegment />", () => {
|
|
|
196
196
|
.onChange(
|
|
197
197
|
{
|
|
198
198
|
preventDefault() {},
|
|
199
|
-
target: {}
|
|
199
|
+
target: {},
|
|
200
200
|
},
|
|
201
201
|
{
|
|
202
202
|
name: "copy",
|
|
203
203
|
value:
|
|
204
|
-
'{"fileFormat": "DAT","header": false, "compression": "brotli","fields": [{ "name": "New54", "type": "test", "size": 40},{ "name": "New53", "type": "string", "size": 40 }]}'
|
|
204
|
+
'{"fileFormat": "DAT","header": false, "compression": "brotli","fields": [{ "name": "New54", "type": "test", "size": 40},{ "name": "New53", "type": "string", "size": 40 }]}',
|
|
205
205
|
}
|
|
206
206
|
);
|
|
207
207
|
expect(wrapper.find(".errorMessage").props().id).toBe(
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
3
4
|
import { Icon, Label, Table } from "semantic-ui-react";
|
|
4
5
|
import { SafeLink, RichTextEditor } from "@truedat/core/components";
|
|
5
6
|
import DomainPreview from "./widgets/DomainPreview";
|
|
@@ -8,7 +9,27 @@ import ImagePreview from "./widgets/ImagePreview";
|
|
|
8
9
|
import SystemPreview from "./widgets/SystemPreview";
|
|
9
10
|
import "../styles/fieldGroupDetail.less";
|
|
10
11
|
|
|
11
|
-
export const
|
|
12
|
+
export const LocalizedFieldValue = ({ label, value }) => {
|
|
13
|
+
const { formatMessage } = useIntl();
|
|
14
|
+
return formatMessage({
|
|
15
|
+
id: `fields.${label}.${value}`,
|
|
16
|
+
defaultMessage: value,
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
LocalizedFieldValue.propTypes = {
|
|
21
|
+
label: PropTypes.string,
|
|
22
|
+
value: PropTypes.any,
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const FieldViewerValue = ({
|
|
26
|
+
label,
|
|
27
|
+
multiple,
|
|
28
|
+
type,
|
|
29
|
+
value,
|
|
30
|
+
values,
|
|
31
|
+
widget,
|
|
32
|
+
}) => {
|
|
12
33
|
switch (type) {
|
|
13
34
|
case "url":
|
|
14
35
|
return (
|
|
@@ -67,29 +88,30 @@ export const FieldViewerValue = ({ value, type, multiple, values, widget }) => {
|
|
|
67
88
|
case "date":
|
|
68
89
|
case "datetime":
|
|
69
90
|
default:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
91
|
+
return multiple ? (
|
|
92
|
+
<Label>
|
|
93
|
+
<LocalizedFieldValue label={label} value={value} />
|
|
94
|
+
</Label>
|
|
95
|
+
) : (
|
|
74
96
|
<div
|
|
75
|
-
className={
|
|
76
|
-
"
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.trim()}
|
|
97
|
+
className={
|
|
98
|
+
widget === "identifier"
|
|
99
|
+
? "default-value identifier-value"
|
|
100
|
+
: "default-value"
|
|
101
|
+
}
|
|
81
102
|
>
|
|
82
|
-
{value}
|
|
103
|
+
<LocalizedFieldValue label={label} value={value} />
|
|
83
104
|
</div>
|
|
84
105
|
);
|
|
85
106
|
}
|
|
86
107
|
};
|
|
87
108
|
|
|
88
109
|
FieldViewerValue.propTypes = {
|
|
89
|
-
|
|
110
|
+
label: PropTypes.string,
|
|
111
|
+
multiple: PropTypes.bool,
|
|
90
112
|
type: PropTypes.string,
|
|
113
|
+
value: PropTypes.any,
|
|
91
114
|
values: PropTypes.any,
|
|
92
|
-
multiple: PropTypes.bool,
|
|
93
115
|
widget: PropTypes.string,
|
|
94
116
|
};
|
|
95
117
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
3
|
import { FieldGroupCopy } from "../FieldGroupCopy";
|
|
4
4
|
|
|
5
5
|
describe("<FieldGroupCopy />", () => {
|
|
@@ -8,7 +8,7 @@ describe("<FieldGroupCopy />", () => {
|
|
|
8
8
|
const props = { value };
|
|
9
9
|
|
|
10
10
|
it("matches the latest snapshot", () => {
|
|
11
|
-
const
|
|
12
|
-
expect(
|
|
11
|
+
const { container } = render(<FieldGroupCopy {...props} />);
|
|
12
|
+
expect(container).toMatchSnapshot();
|
|
13
13
|
});
|
|
14
14
|
});
|
|
@@ -3,14 +3,6 @@ import { render } from "@truedat/test/render";
|
|
|
3
3
|
import { FieldViewerValue } from "../FieldViewerValue";
|
|
4
4
|
|
|
5
5
|
describe("<FieldViewerValue />", () => {
|
|
6
|
-
const renderOpts = {
|
|
7
|
-
messages: {
|
|
8
|
-
en: {
|
|
9
|
-
"widget.copy.error.jsonformat": "Error: copy has wrong format",
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
|
|
14
6
|
const testTypes = [
|
|
15
7
|
{
|
|
16
8
|
value: { url_name: "name", url_value: "value" },
|
|
@@ -65,18 +57,18 @@ describe("<FieldViewerValue />", () => {
|
|
|
65
57
|
|
|
66
58
|
testTypes.forEach((props) =>
|
|
67
59
|
it(`matches the latest snapshot with type: ${props.type}`, () => {
|
|
68
|
-
const
|
|
69
|
-
expect(
|
|
60
|
+
const { container } = render(<FieldViewerValue {...props} />);
|
|
61
|
+
expect(container).toMatchSnapshot();
|
|
70
62
|
})
|
|
71
63
|
);
|
|
72
64
|
|
|
73
65
|
it("matches the latest snapshot for multiple", () => {
|
|
74
66
|
const props = {
|
|
75
|
-
value:
|
|
67
|
+
value: "a",
|
|
76
68
|
multiple: true,
|
|
77
69
|
type: "string",
|
|
78
70
|
};
|
|
79
|
-
const
|
|
80
|
-
expect(
|
|
71
|
+
const { container } = render(<FieldViewerValue {...props} />);
|
|
72
|
+
expect(container).toMatchSnapshot();
|
|
81
73
|
});
|
|
82
74
|
});
|