@truedat/df 8.12.1 → 8.12.4
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/__tests__/SelectableDynamicForm.spec.js +19 -0
- package/src/components/widgets/TextField.js +1 -1
- package/src/selectors/getOptions.js +7 -3
- package/src/templates/components/TemplatesContext.js +2 -3
- package/src/templates/components/templateForm/DefaultValue.js +2 -6
- package/src/templates/components/templateForm/TableValuesForm.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/df",
|
|
3
|
-
"version": "8.12.
|
|
3
|
+
"version": "8.12.4",
|
|
4
4
|
"description": "Truedat Web Data Quality Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"module": "src/index.js",
|
|
@@ -54,14 +54,14 @@
|
|
|
54
54
|
"@testing-library/jest-dom": "^6.6.3",
|
|
55
55
|
"@testing-library/react": "^16.3.0",
|
|
56
56
|
"@testing-library/user-event": "^14.6.1",
|
|
57
|
-
"@truedat/test": "8.12.
|
|
57
|
+
"@truedat/test": "8.12.4",
|
|
58
58
|
"identity-obj-proxy": "^3.0.0",
|
|
59
59
|
"jest": "^29.7.0",
|
|
60
60
|
"redux-saga-test-plan": "^4.0.6"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@apollo/client": "^3.13.8",
|
|
64
|
-
"@truedat/core": "8.12.
|
|
64
|
+
"@truedat/core": "8.12.4",
|
|
65
65
|
"axios": "^1.15.0",
|
|
66
66
|
"graphql": "^16.11.0",
|
|
67
67
|
"is-hotkey": "^0.2.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"semantic-ui-react": "^3.0.0-beta.2",
|
|
91
91
|
"swr": "^2.3.3"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "d5bc1af84c4d828bdec676b0da58385cf0d6015f"
|
|
94
94
|
}
|
|
@@ -119,6 +119,23 @@ describe("<SelectableDynamicForm />", () => {
|
|
|
119
119
|
await waitForLoad(rendered);
|
|
120
120
|
expect(rendered.container).toMatchSnapshot();
|
|
121
121
|
});
|
|
122
|
+
|
|
123
|
+
it("does not auto-select a template when none is default", async () => {
|
|
124
|
+
const onNameChange = jest.fn();
|
|
125
|
+
const thisProps = {
|
|
126
|
+
...props,
|
|
127
|
+
onNameChange,
|
|
128
|
+
};
|
|
129
|
+
const rendered = render(
|
|
130
|
+
<SelectableDynamicForm {...thisProps} />,
|
|
131
|
+
renderOpts,
|
|
132
|
+
);
|
|
133
|
+
await waitForLoad(rendered);
|
|
134
|
+
expect(onNameChange).not.toHaveBeenCalled();
|
|
135
|
+
expect(rendered.getByRole("alert")).toHaveTextContent(
|
|
136
|
+
/template\.selector\.placeholder/i,
|
|
137
|
+
);
|
|
138
|
+
});
|
|
122
139
|
});
|
|
123
140
|
|
|
124
141
|
describe("with single template", () => {
|
|
@@ -201,6 +218,7 @@ describe("<SelectableDynamicForm />", () => {
|
|
|
201
218
|
disableSelector
|
|
202
219
|
selectedTemplate={selectedTemplate}
|
|
203
220
|
/>,
|
|
221
|
+
{ mocks: [multipleTemplatesMock(variables)] },
|
|
204
222
|
);
|
|
205
223
|
await waitForLoad(rendered);
|
|
206
224
|
expect(
|
|
@@ -218,6 +236,7 @@ describe("<SelectableDynamicForm />", () => {
|
|
|
218
236
|
disableSelector
|
|
219
237
|
selectedTemplate={selectedTemplate}
|
|
220
238
|
/>,
|
|
239
|
+
{ mocks: [multipleTemplatesMock(variables)] },
|
|
221
240
|
);
|
|
222
241
|
await waitForLoad(rendered);
|
|
223
242
|
expect(rendered.container).toMatchSnapshot();
|
|
@@ -2,7 +2,7 @@ import PropTypes from "prop-types";
|
|
|
2
2
|
import { Form } from "semantic-ui-react";
|
|
3
3
|
|
|
4
4
|
export const TextField = ({ field: { name, value }, onChange }) => (
|
|
5
|
-
<Form.TextArea value={value} name={name} onChange={onChange} />
|
|
5
|
+
<Form.TextArea value={value ?? ""} name={name} onChange={onChange} />
|
|
6
6
|
);
|
|
7
7
|
|
|
8
8
|
TextField.propTypes = {
|
|
@@ -12,9 +12,13 @@ const transformValues = (systems) =>
|
|
|
12
12
|
)(systems);
|
|
13
13
|
|
|
14
14
|
export const getDropdownOptions = createSelector(
|
|
15
|
-
({ systems }
|
|
16
|
-
|
|
17
|
-
_
|
|
15
|
+
({ systems }) => systems,
|
|
16
|
+
(_, { field }) => field?.type,
|
|
17
|
+
(_, { field }) => field?.parsedValues,
|
|
18
|
+
(systems, type, parsedValues) =>
|
|
19
|
+
_.sortBy("text")(
|
|
20
|
+
type === "system" ? transformValues(systems) : parsedValues,
|
|
21
|
+
),
|
|
18
22
|
);
|
|
19
23
|
|
|
20
24
|
export const makeGetDropdownOptions = () => getDropdownOptions;
|
|
@@ -14,9 +14,8 @@ export default function TemplatesContextProvider(props) {
|
|
|
14
14
|
const initialSortColumn = _.prop("initialSortColumn")(props);
|
|
15
15
|
const initialSortDirection = _.prop("initialSortDirection")(props);
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
);
|
|
17
|
+
const templates = useSelector((state) => state.templates);
|
|
18
|
+
const loading = useSelector((state) => state.templatesLoading);
|
|
20
19
|
|
|
21
20
|
const [query, setQuery] = useState("");
|
|
22
21
|
const [scope, setScope] = useState();
|
|
@@ -7,12 +7,8 @@ import DateField from "../../../components/widgets/DateField";
|
|
|
7
7
|
|
|
8
8
|
const defaultValueFormat = (d) => (_.isArray(d) ? _.first(d) : d);
|
|
9
9
|
const multipleDefaultValueFormat = (d) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return [];
|
|
13
|
-
default:
|
|
14
|
-
return !_.isArray(d) ? [d] : d;
|
|
15
|
-
}
|
|
10
|
+
if (d === "" || _.isNil(d)) return [];
|
|
11
|
+
return !_.isArray(d) ? [d] : d;
|
|
16
12
|
};
|
|
17
13
|
|
|
18
14
|
export const DefaultValue = ({
|
|
@@ -116,7 +116,7 @@ export const TableValuesForm = ({
|
|
|
116
116
|
}) => {
|
|
117
117
|
const fieldCount = _.size(values);
|
|
118
118
|
const [activeField, setActiveField] = useState();
|
|
119
|
-
const [fieldValue, setFieldValue] = useState();
|
|
119
|
+
const [fieldValue, setFieldValue] = useState("");
|
|
120
120
|
const { formatMessage } = useIntl();
|
|
121
121
|
|
|
122
122
|
const swap = (targetKey, sourceKey) => {
|