@truedat/dq 4.53.0 → 4.53.1
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 +9 -0
- package/package.json +5 -5
- package/src/components/ConditionSummary.js +6 -1
- package/src/components/__tests__/__fixtures__/NewRuleImplementationProps.js +1 -1
- package/src/components/__tests__/__fixtures__/newRuleImplementationHelper.js +1 -1
- package/src/components/ruleImplementationForm/FieldModifier.js +52 -35
- package/src/components/ruleImplementationForm/FiltersField.js +7 -4
- package/src/components/ruleImplementationForm/FiltersFormGroup.js +10 -8
- package/src/components/ruleImplementationForm/operators.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.53.1] 2022-10-05
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- [TD-5098] Improve modifiers behaviour
|
|
8
|
+
- Fix field type selector for StructureFieldsDrowdown
|
|
9
|
+
- Fix fields applied modifiers for StructureFieldsDrowdown
|
|
10
|
+
- Allow multiple modifiers in ruleImplementationOperators reducer
|
|
11
|
+
|
|
3
12
|
## [4.53.0] 2022-10-04
|
|
4
13
|
|
|
5
14
|
### Added
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/dq",
|
|
3
|
-
"version": "4.53.
|
|
3
|
+
"version": "4.53.1",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.4",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.53.
|
|
37
|
+
"@truedat/test": "4.53.1",
|
|
38
38
|
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
},
|
|
94
94
|
"dependencies": {
|
|
95
95
|
"@apollo/client": "^3.6.4",
|
|
96
|
-
"@truedat/core": "4.53.
|
|
97
|
-
"@truedat/df": "4.53.
|
|
96
|
+
"@truedat/core": "4.53.1",
|
|
97
|
+
"@truedat/df": "4.53.1",
|
|
98
98
|
"graphql": "^15.5.3",
|
|
99
99
|
"path-to-regexp": "^1.7.0",
|
|
100
100
|
"prop-types": "^15.8.1",
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"react-dom": ">= 16.8.6 < 17",
|
|
115
115
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "aec23f8f32a131dfa84620ec6e14c31916118d44"
|
|
118
118
|
}
|
|
@@ -4,6 +4,7 @@ import PropTypes from "prop-types";
|
|
|
4
4
|
import { Header, Icon, Segment, Table } from "semantic-ui-react";
|
|
5
5
|
import { Link } from "react-router-dom";
|
|
6
6
|
import { FormattedMessage } from "react-intl";
|
|
7
|
+
import { useIntl } from "react-intl";
|
|
7
8
|
import { linkTo } from "@truedat/core/routes";
|
|
8
9
|
|
|
9
10
|
const concatValues = (values, link) => _.join(link)(values);
|
|
@@ -131,6 +132,7 @@ const ConditionCell = ({ row, alias }) => {
|
|
|
131
132
|
|
|
132
133
|
const values = getValues(row);
|
|
133
134
|
const operator = _.prop("operator")(row);
|
|
135
|
+
const { formatMessage } = useIntl();
|
|
134
136
|
return (
|
|
135
137
|
<Table.Row>
|
|
136
138
|
<Table.Cell width={5}>
|
|
@@ -163,7 +165,10 @@ const ConditionCell = ({ row, alias }) => {
|
|
|
163
165
|
_.toPairs,
|
|
164
166
|
_.map(([key, value]) => (
|
|
165
167
|
<div key={key} className="smaller">
|
|
166
|
-
{
|
|
168
|
+
{`${formatMessage({
|
|
169
|
+
id: `filtersGrid.field.modifier.${row.modifier.name}.${key}`,
|
|
170
|
+
defaultMessage: key,
|
|
171
|
+
})}: ${value}`}
|
|
167
172
|
</div>
|
|
168
173
|
))
|
|
169
174
|
)(row)}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { getOr } from "lodash/fp";
|
|
1
|
+
import { getOr, isEmpty } from "lodash/fp";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
2
3
|
import React from "react";
|
|
3
4
|
import { useIntl } from "react-intl";
|
|
4
|
-
import { Form, Icon } from "semantic-ui-react";
|
|
5
|
+
import { Form, Icon, Segment } from "semantic-ui-react";
|
|
5
6
|
|
|
6
7
|
export default function FieldModifier({
|
|
7
8
|
modifier,
|
|
@@ -12,40 +13,56 @@ export default function FieldModifier({
|
|
|
12
13
|
const { formatMessage } = useIntl();
|
|
13
14
|
|
|
14
15
|
return (
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
)(modifier).map((param, key) => (
|
|
24
|
-
<input
|
|
25
|
-
key={key}
|
|
26
|
-
placeholder={formatMessage({
|
|
27
|
-
id: `filtersGrid.field.modifier.${modifier.name}.${param.name}`,
|
|
28
|
-
})}
|
|
29
|
-
value={getOr("", `params.${param.name}`)(value)}
|
|
30
|
-
onChange={({ target }) => {
|
|
31
|
-
onChange({
|
|
32
|
-
...value,
|
|
33
|
-
params: {
|
|
34
|
-
...getOr({}, "params")(value),
|
|
35
|
-
[param.name]: target.value,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
}}
|
|
16
|
+
<Form.Field className={"flex-column-align-end"}>
|
|
17
|
+
<label>
|
|
18
|
+
{formatMessage({ id: `filtersGrid.field.modifier.${modifier.name}` })}
|
|
19
|
+
{removable ? (
|
|
20
|
+
<Icon
|
|
21
|
+
name="delete"
|
|
22
|
+
className="selectable force-margin-bottom"
|
|
23
|
+
onClick={() => onChange(null)}
|
|
39
24
|
/>
|
|
40
|
-
)
|
|
41
|
-
</
|
|
42
|
-
{
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
25
|
+
) : null}
|
|
26
|
+
</label>
|
|
27
|
+
{isEmpty(modifier?.params) ? null : (
|
|
28
|
+
<Segment>
|
|
29
|
+
{getOr(
|
|
30
|
+
[],
|
|
31
|
+
"params"
|
|
32
|
+
)(modifier).map((param, key) => (
|
|
33
|
+
<>
|
|
34
|
+
<label>
|
|
35
|
+
{formatMessage({
|
|
36
|
+
id: `filtersGrid.field.modifier.${modifier.name}.${param.name}`,
|
|
37
|
+
})}
|
|
38
|
+
</label>
|
|
39
|
+
<input
|
|
40
|
+
key={key}
|
|
41
|
+
placeholder={formatMessage({
|
|
42
|
+
id: `filtersGrid.field.modifier.${modifier.name}.${param.name}`,
|
|
43
|
+
})}
|
|
44
|
+
value={getOr("", `params.${param.name}`)(value)}
|
|
45
|
+
onChange={({ target }) => {
|
|
46
|
+
onChange({
|
|
47
|
+
...value,
|
|
48
|
+
params: {
|
|
49
|
+
...getOr({}, "params")(value),
|
|
50
|
+
[param.name]: target.value,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</>
|
|
56
|
+
))}
|
|
57
|
+
</Segment>
|
|
48
58
|
)}
|
|
49
|
-
</
|
|
59
|
+
</Form.Field>
|
|
50
60
|
);
|
|
51
61
|
}
|
|
62
|
+
|
|
63
|
+
FieldModifier.propTypes = {
|
|
64
|
+
modifier: PropTypes.object,
|
|
65
|
+
value: PropTypes.object,
|
|
66
|
+
onChange: PropTypes.func,
|
|
67
|
+
removable: PropTypes.bool,
|
|
68
|
+
};
|
|
@@ -107,6 +107,7 @@ export const FiltersField = ({
|
|
|
107
107
|
case "field":
|
|
108
108
|
case "field_list":
|
|
109
109
|
const structureFields = getStructureFields(parentStructures);
|
|
110
|
+
const isFieldList = value_type === "field_list";
|
|
110
111
|
return value_type_filter == "any" ? (
|
|
111
112
|
<StructureSelectorInputField
|
|
112
113
|
active={active}
|
|
@@ -128,15 +129,17 @@ export const FiltersField = ({
|
|
|
128
129
|
) : (
|
|
129
130
|
<>
|
|
130
131
|
<StructureFieldsDropdown
|
|
131
|
-
multiple={
|
|
132
|
+
multiple={isFieldList}
|
|
132
133
|
label={label}
|
|
133
134
|
inline={false}
|
|
134
135
|
parentStructures={parentStructures}
|
|
135
136
|
structureFields={structureFields}
|
|
136
|
-
typeCastModifiers={
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
typeCastModifiers={
|
|
138
|
+
isFieldList
|
|
139
|
+
? _.filter(({ params }) => _.isEmpty(params))(typeCastModifiers)
|
|
140
|
+
: typeCastModifiers
|
|
139
141
|
}
|
|
142
|
+
filters={{ field_type: [fieldType] }}
|
|
140
143
|
onSelectField={(value, modifier) => {
|
|
141
144
|
onChange(
|
|
142
145
|
null,
|
|
@@ -34,9 +34,9 @@ export const FiltersFormGroup = ({
|
|
|
34
34
|
const structureFieldType = clause?.structure?.field_type;
|
|
35
35
|
const modifiers = _.path(`${structureFieldType}.modifiers`)(operators);
|
|
36
36
|
const modifierValue = clause?.modifier;
|
|
37
|
-
const
|
|
37
|
+
const selectedModifier = _.find({ name: modifierValue?.name })(modifiers);
|
|
38
38
|
|
|
39
|
-
const fieldType =
|
|
39
|
+
const fieldType = selectedModifier?.type || structureFieldType;
|
|
40
40
|
const nestedCondition = !_.isEmpty(siblings);
|
|
41
41
|
const structureFields = getStructureFields(parentStructures);
|
|
42
42
|
|
|
@@ -70,7 +70,9 @@ export const FiltersFormGroup = ({
|
|
|
70
70
|
/>
|
|
71
71
|
)}
|
|
72
72
|
</Form.Field>
|
|
73
|
-
{clause?.structure &&
|
|
73
|
+
{clause?.structure &&
|
|
74
|
+
!_.isEmpty(modifiers) &&
|
|
75
|
+
_.isEmpty(selectedModifier) ? (
|
|
74
76
|
<Dropdown
|
|
75
77
|
className={"icon-dropdown-margin"}
|
|
76
78
|
size="mini"
|
|
@@ -81,9 +83,9 @@ export const FiltersFormGroup = ({
|
|
|
81
83
|
<Dropdown.Item
|
|
82
84
|
key={key}
|
|
83
85
|
icon={
|
|
84
|
-
modifier.
|
|
86
|
+
modifier.type
|
|
85
87
|
? formatMessage({
|
|
86
|
-
id: `field_type.icon.${modifier.
|
|
88
|
+
id: `field_type.icon.${modifier.type}`,
|
|
87
89
|
defaultMessage: "hashtag",
|
|
88
90
|
})
|
|
89
91
|
: null
|
|
@@ -98,11 +100,11 @@ export const FiltersFormGroup = ({
|
|
|
98
100
|
))}
|
|
99
101
|
</Dropdown.Menu>
|
|
100
102
|
</Dropdown>
|
|
101
|
-
)}
|
|
103
|
+
) : null}
|
|
102
104
|
</div>
|
|
103
|
-
{
|
|
105
|
+
{selectedModifier && (
|
|
104
106
|
<FieldModifier
|
|
105
|
-
modifier={
|
|
107
|
+
modifier={selectedModifier}
|
|
106
108
|
value={modifierValue}
|
|
107
109
|
onChange={(value) => onModifierChange(index, value)}
|
|
108
110
|
removable
|
|
@@ -71,7 +71,7 @@ export default (operators, type, nested, scope, formatMessage) => {
|
|
|
71
71
|
_.map((m) => ({ ...m, sourceType: key }))(value.modifiers || [])
|
|
72
72
|
),
|
|
73
73
|
_.flatten,
|
|
74
|
-
_.filter(
|
|
74
|
+
_.filter({ type: type })
|
|
75
75
|
)(operators);
|
|
76
76
|
|
|
77
77
|
return {
|