@truedat/df 4.33.10 → 4.34.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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/df",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.34.0",
|
|
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.0",
|
|
84
|
+
"@truedat/core": "4.34.0",
|
|
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": "b1fe4f405c612bd342510cf34e8e9d89de0280fb"
|
|
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;
|