@truedat/df 4.33.8 → 4.34.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/CHANGELOG.md +12 -0
- package/package.json +5 -5
- package/src/components/DynamicFormViewer.js +14 -8
- package/src/components/FieldGroupDetail.js +42 -21
- package/src/messages/en.js +2 -0
- package/src/messages/es.js +2 -0
- package/src/templates/components/templateForm/TemplateForm.js +1 -1
- package/src/templates/components/templateForm/__tests__/__snapshots__/TemplateForm.spec.js.snap +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.34.0] 2021-12-02
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- [TD-4295] Added new `DynamicFormViewer` compact layout
|
|
8
|
+
|
|
9
|
+
## [4.33.9] 2021-11-29
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- [TD-4306] New template scope for Quality Executions (`qe`)
|
|
14
|
+
|
|
3
15
|
## [4.31.1] 2021-10-20
|
|
4
16
|
|
|
5
17
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/df",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.34.2",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/plugin-transform-modules-commonjs": "^7.15.0",
|
|
31
31
|
"@babel/preset-env": "^7.15.0",
|
|
32
32
|
"@babel/preset-react": "^7.14.5",
|
|
33
|
-
"@truedat/test": "4.
|
|
33
|
+
"@truedat/test": "4.34.0",
|
|
34
34
|
"babel-jest": "^27.0.6",
|
|
35
35
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
36
36
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
]
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@truedat/auth": "4.
|
|
84
|
-
"@truedat/core": "4.
|
|
83
|
+
"@truedat/auth": "4.34.2",
|
|
84
|
+
"@truedat/core": "4.34.2",
|
|
85
85
|
"axios": "^0.19.2",
|
|
86
86
|
"path-to-regexp": "^1.7.0",
|
|
87
87
|
"prop-types": "^15.7.2",
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"react-dom": ">= 16.8.6 < 17",
|
|
101
101
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "8b28a5faca902e9cab3e8b5ab2bc1f8626e3ec7b"
|
|
104
104
|
}
|
|
@@ -5,7 +5,7 @@ import { FormattedMessage } from "react-intl";
|
|
|
5
5
|
import { Message } from "semantic-ui-react";
|
|
6
6
|
import FieldGroupDetail from "./FieldGroupDetail";
|
|
7
7
|
|
|
8
|
-
const hasDependentKeys = field =>
|
|
8
|
+
const hasDependentKeys = (field) =>
|
|
9
9
|
!_.isNil(_.path("depends.to_be")(field)) &&
|
|
10
10
|
!_.isNil(_.path("depends.on")(field));
|
|
11
11
|
|
|
@@ -13,11 +13,11 @@ const checkDependency = (field, content) => {
|
|
|
13
13
|
const on = _.prop(_.path("depends.on")(field))(content);
|
|
14
14
|
const to_be = _.path("depends.to_be")(field);
|
|
15
15
|
return _.isArray(on)
|
|
16
|
-
? _.some(d => to_be.includes(d))(on)
|
|
16
|
+
? _.some((d) => to_be.includes(d))(on)
|
|
17
17
|
: to_be.includes(on);
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export const DynamicFormViewer = ({ template, content }) => {
|
|
20
|
+
export const DynamicFormViewer = ({ template, content, boxLayout }) => {
|
|
21
21
|
if (!template)
|
|
22
22
|
return (
|
|
23
23
|
<Message negative>
|
|
@@ -28,16 +28,16 @@ export const DynamicFormViewer = ({ template, content }) => {
|
|
|
28
28
|
);
|
|
29
29
|
|
|
30
30
|
const parsedGroups = _.flow(
|
|
31
|
-
_.map(group => {
|
|
31
|
+
_.map((group) => {
|
|
32
32
|
const fields = _.flow(
|
|
33
33
|
_.filter(
|
|
34
|
-
field =>
|
|
34
|
+
(field) =>
|
|
35
35
|
(!("depends" in field) ||
|
|
36
36
|
(hasDependentKeys(field) && checkDependency(field, content))) &&
|
|
37
37
|
(!(field.values && "switch" in field.values) ||
|
|
38
38
|
content[field.values.switch.on] in field.values.switch.values)
|
|
39
39
|
),
|
|
40
|
-
_.map(field => ({ ...field, value: content[field.name] }))
|
|
40
|
+
_.map((field) => ({ ...field, value: content[field.name] }))
|
|
41
41
|
)(group.fields);
|
|
42
42
|
return { ...group, fields };
|
|
43
43
|
}),
|
|
@@ -47,7 +47,12 @@ export const DynamicFormViewer = ({ template, content }) => {
|
|
|
47
47
|
return (
|
|
48
48
|
<>
|
|
49
49
|
{parsedGroups.map(({ name, fields }, i) => (
|
|
50
|
-
<FieldGroupDetail
|
|
50
|
+
<FieldGroupDetail
|
|
51
|
+
key={i}
|
|
52
|
+
name={name}
|
|
53
|
+
fields={fields}
|
|
54
|
+
boxLayout={boxLayout}
|
|
55
|
+
/>
|
|
51
56
|
))}
|
|
52
57
|
</>
|
|
53
58
|
);
|
|
@@ -55,7 +60,8 @@ export const DynamicFormViewer = ({ template, content }) => {
|
|
|
55
60
|
|
|
56
61
|
DynamicFormViewer.propTypes = {
|
|
57
62
|
template: PropTypes.object,
|
|
58
|
-
content: PropTypes.object
|
|
63
|
+
content: PropTypes.object,
|
|
64
|
+
boxLayout: PropTypes.bool,
|
|
59
65
|
};
|
|
60
66
|
|
|
61
67
|
export default DynamicFormViewer;
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Divider,
|
|
6
|
+
Icon,
|
|
7
|
+
Label,
|
|
8
|
+
List,
|
|
9
|
+
Button,
|
|
10
|
+
Table,
|
|
11
|
+
Segment,
|
|
12
|
+
} from "semantic-ui-react";
|
|
5
13
|
import DomainPreview from "./widgets/DomainPreview";
|
|
6
14
|
import FieldGroupCopy from "./FieldGroupCopy";
|
|
7
15
|
import ImagePreview from "./widgets/ImagePreview";
|
|
@@ -69,13 +77,13 @@ ValueRenderByType.propTypes = {
|
|
|
69
77
|
value: PropTypes.any,
|
|
70
78
|
type: PropTypes.string,
|
|
71
79
|
values: PropTypes.any,
|
|
72
|
-
multiple: PropTypes.bool
|
|
80
|
+
multiple: PropTypes.bool,
|
|
73
81
|
};
|
|
74
82
|
|
|
75
|
-
const parseField = field => {
|
|
83
|
+
const parseField = (field) => {
|
|
76
84
|
const { value, values } = field;
|
|
77
85
|
if (_.has("fixed_tuple")(values)) {
|
|
78
|
-
const translateValue = value =>
|
|
86
|
+
const translateValue = (value) =>
|
|
79
87
|
_.flow(
|
|
80
88
|
_.prop("fixed_tuple"),
|
|
81
89
|
_.find({ value }),
|
|
@@ -86,7 +94,7 @@ const parseField = field => {
|
|
|
86
94
|
...field,
|
|
87
95
|
value: _.isArray(value)
|
|
88
96
|
? _.map(translateValue)(value)
|
|
89
|
-
: translateValue(value)
|
|
97
|
+
: translateValue(value),
|
|
90
98
|
};
|
|
91
99
|
} else {
|
|
92
100
|
return field;
|
|
@@ -131,27 +139,40 @@ DynamicFieldValue.propTypes = {
|
|
|
131
139
|
value: PropTypes.any,
|
|
132
140
|
type: PropTypes.string,
|
|
133
141
|
values: PropTypes.any,
|
|
134
|
-
widget: PropTypes.string
|
|
142
|
+
widget: PropTypes.string,
|
|
135
143
|
};
|
|
136
144
|
|
|
137
|
-
export const FieldGroupDetail = ({ name, fields }) =>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
<
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
145
|
+
export const FieldGroupDetail = ({ name, fields, boxLayout }) =>
|
|
146
|
+
boxLayout ? (
|
|
147
|
+
<>
|
|
148
|
+
<Segment>
|
|
149
|
+
{name && name !== "undefined" && <h4>{name}</h4>}
|
|
150
|
+
<List>
|
|
151
|
+
{fields.map(parseField).map((f, i) => (
|
|
152
|
+
<DynamicFieldValue key={i} {...f} />
|
|
153
|
+
))}
|
|
154
|
+
</List>
|
|
155
|
+
</Segment>
|
|
156
|
+
</>
|
|
157
|
+
) : (
|
|
158
|
+
<>
|
|
159
|
+
{name && name !== "undefined" && (
|
|
160
|
+
<Divider horizontal>
|
|
161
|
+
<h3>{name}</h3>
|
|
162
|
+
</Divider>
|
|
163
|
+
)}
|
|
164
|
+
<List size="big" relaxed="very">
|
|
165
|
+
{fields.map(parseField).map((f, i) => (
|
|
166
|
+
<DynamicFieldValue key={i} {...f} />
|
|
167
|
+
))}
|
|
168
|
+
</List>
|
|
169
|
+
</>
|
|
170
|
+
);
|
|
151
171
|
|
|
152
172
|
FieldGroupDetail.propTypes = {
|
|
153
173
|
name: PropTypes.string,
|
|
154
|
-
fields: PropTypes.array
|
|
174
|
+
fields: PropTypes.array,
|
|
175
|
+
boxLayout: PropTypes.bool,
|
|
155
176
|
};
|
|
156
177
|
|
|
157
178
|
export default FieldGroupDetail;
|
package/src/messages/en.js
CHANGED
|
@@ -86,6 +86,7 @@ export default {
|
|
|
86
86
|
"template.scope.gr": "Grants",
|
|
87
87
|
"template.scope.ri": "Quality Implementation",
|
|
88
88
|
"template.scope.ie": "Data Request",
|
|
89
|
+
"template.scope.qe": "Quality Executions",
|
|
89
90
|
"template.form.subsegment.info.popup":
|
|
90
91
|
"Please, you must enter a format (fileFormat) in order to edit this field",
|
|
91
92
|
"template.form.subsegment.error.requiredparam":
|
|
@@ -115,6 +116,7 @@ export default {
|
|
|
115
116
|
"templates.tabs.gr": "Grant request",
|
|
116
117
|
"templates.tabs.ri": "Quality Implementation",
|
|
117
118
|
"templates.tabs.ie": "Data Request",
|
|
119
|
+
"templates.tabs.qe": "Quality Executions",
|
|
118
120
|
"template.error.content.repeated.field": "Template with repeated fields",
|
|
119
121
|
"template.error.content.repeated.group": "Template with repeated groups",
|
|
120
122
|
"template.error.content.invalid.type":
|
package/src/messages/es.js
CHANGED
|
@@ -86,6 +86,7 @@ export default {
|
|
|
86
86
|
"template.scope.gr": "Acceso a datos",
|
|
87
87
|
"template.scope.ri": "Implementación de calidad",
|
|
88
88
|
"template.scope.ie": "Solicitud de datos",
|
|
89
|
+
"template.scope.qe": "Ejecuciones de calidad",
|
|
89
90
|
"template.form.subsegment.info.popup":
|
|
90
91
|
"Por favor, introduce un formato (fileFormat) para poder editar este campo",
|
|
91
92
|
"template.form.subsegment.error.requiredparam":
|
|
@@ -116,6 +117,7 @@ export default {
|
|
|
116
117
|
"templates.tabs.gr": "Acceso a datos",
|
|
117
118
|
"templates.tabs.ri": "Implementaciones",
|
|
118
119
|
"templates.tabs.ie": "Solicitud de datos",
|
|
120
|
+
"templates.tabs.qe": "Ejecuciones de calidad",
|
|
119
121
|
"template.error.content.repeated.field": "Plantilla con campos repetidos",
|
|
120
122
|
"template.error.content.repeated.group": "Plantilla con grupos repetidos",
|
|
121
123
|
"template.error.content.invalid.type":
|
|
@@ -16,7 +16,7 @@ const scopeOptions = (formatMessage) =>
|
|
|
16
16
|
value,
|
|
17
17
|
})),
|
|
18
18
|
_.sortBy("text")
|
|
19
|
-
)(["bg", "dd", "dq", "gr", "ie", "ri"]);
|
|
19
|
+
)(["bg", "dd", "dq", "gr", "ie", "ri", "qe"]);
|
|
20
20
|
|
|
21
21
|
export const TemplateForm = ({ loading, template, onSubmit, onDelete }) => {
|
|
22
22
|
const { formatMessage } = useIntl();
|
package/src/templates/components/templateForm/__tests__/__snapshots__/TemplateForm.spec.js.snap
CHANGED
|
@@ -158,6 +158,19 @@ exports[`<TemplateForm /> matches the latest snapshot (loading) 1`] = `
|
|
|
158
158
|
ri
|
|
159
159
|
</span>
|
|
160
160
|
</div>
|
|
161
|
+
<div
|
|
162
|
+
aria-checked="false"
|
|
163
|
+
aria-selected="false"
|
|
164
|
+
class="item"
|
|
165
|
+
role="option"
|
|
166
|
+
style="pointer-events: all;"
|
|
167
|
+
>
|
|
168
|
+
<span
|
|
169
|
+
class="text"
|
|
170
|
+
>
|
|
171
|
+
template.scope.qe
|
|
172
|
+
</span>
|
|
173
|
+
</div>
|
|
161
174
|
</div>
|
|
162
175
|
</div>
|
|
163
176
|
</div>
|
|
@@ -378,6 +391,19 @@ exports[`<TemplateForm /> matches the latest snapshot 1`] = `
|
|
|
378
391
|
ri
|
|
379
392
|
</span>
|
|
380
393
|
</div>
|
|
394
|
+
<div
|
|
395
|
+
aria-checked="false"
|
|
396
|
+
aria-selected="false"
|
|
397
|
+
class="item"
|
|
398
|
+
role="option"
|
|
399
|
+
style="pointer-events: all;"
|
|
400
|
+
>
|
|
401
|
+
<span
|
|
402
|
+
class="text"
|
|
403
|
+
>
|
|
404
|
+
template.scope.qe
|
|
405
|
+
</span>
|
|
406
|
+
</div>
|
|
381
407
|
</div>
|
|
382
408
|
</div>
|
|
383
409
|
</div>
|