@truedat/dq 4.48.1 → 4.48.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.48.2] 2022-07-08
4
+
5
+ ### Changed
6
+
7
+ - [TD-4995] Support localization of template fields and fixed values
8
+
3
9
  ## [4.48.1] 2022-07-07
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.48.1",
3
+ "version": "4.48.4",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -88,8 +88,8 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.6.4",
91
- "@truedat/core": "4.48.0",
92
- "@truedat/df": "4.48.0",
91
+ "@truedat/core": "4.48.4",
92
+ "@truedat/df": "4.48.4",
93
93
  "axios": "^0.19.2",
94
94
  "graphql": "^15.5.3",
95
95
  "path-to-regexp": "^1.7.0",
@@ -110,5 +110,5 @@
110
110
  "react-dom": ">= 16.8.6 < 17",
111
111
  "semantic-ui-react": ">= 0.88.2 < 2.1"
112
112
  },
113
- "gitHead": "f9de67a5791658396a5023b8d9fe24de6d75d943"
113
+ "gitHead": "5e50a034469bf3ad8e02a64eb875ad2b710b6b03"
114
114
  }
@@ -31,9 +31,13 @@ exports[`<RemediationPlan /> matches the latest snapshot 1`] = `
31
31
  class="ui negative message"
32
32
  >
33
33
  <div
34
- class="header"
34
+ class="content"
35
35
  >
36
- Error: Invalid template
36
+ <div
37
+ class="header"
38
+ >
39
+ Error: Invalid template
40
+ </div>
37
41
  </div>
38
42
  </div>
39
43
  </div>
@@ -1,4 +1,4 @@
1
- import React, { Suspense } from "react";
1
+ import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
3
  import { waitFor } from "@testing-library/react";
4
4
  import { REFERENCE_DATASETS_HEADERS_QUERY } from "@truedat/dd/api/queries";
@@ -23,7 +23,11 @@ const referenceDatasetsMock = {
23
23
  };
24
24
  const messages = { en };
25
25
 
26
- const renderOpts = { mocks: [referenceDatasetsMock], messages };
26
+ const renderOpts = {
27
+ mocks: [referenceDatasetsMock],
28
+ messages,
29
+ fallback: "lazy",
30
+ };
27
31
 
28
32
  describe("<DatasetForm />", () => {
29
33
  const setStructures = jest.fn();
@@ -31,7 +35,7 @@ describe("<DatasetForm />", () => {
31
35
  const selector = -1;
32
36
  const setImplementationKey = jest.fn();
33
37
  const implementationKey = "Impl";
34
- const structures = [1, 2];
38
+ const structures = [{ id: 1 }, { id: 2 }];
35
39
 
36
40
  const props = {
37
41
  implementationKey,
@@ -44,9 +48,7 @@ describe("<DatasetForm />", () => {
44
48
 
45
49
  it("matches the latest snapshot", async () => {
46
50
  const { container, queryByText } = render(
47
- <Suspense fallback={null}>
48
- <DatasetForm {...props} />
49
- </Suspense>,
51
+ <DatasetForm {...props} />,
50
52
  renderOpts
51
53
  );
52
54
 
@@ -1,92 +0,0 @@
1
- import _ from "lodash/fp";
2
- import React from "react";
3
- import PropTypes from "prop-types";
4
- import { Form } from "semantic-ui-react";
5
- import { useIntl } from "react-intl";
6
-
7
- const toOptions = (
8
- formatMessage,
9
- property,
10
- translateValues,
11
- sortBy
12
- ) => values =>
13
- _.flow(
14
- _.map(v => ({
15
- text: formatMessage({ id: `${property}.${v}`, defaultMessage: v }),
16
- value: v
17
- })),
18
- sortBy ? _.sortBy(sortBy) : _.identity,
19
- _.map(translateValues ? ({ text }) => ({ text, value: text }) : _.identity),
20
- _.map.convert({ cap: false })(({ text, value }, key) => ({
21
- key,
22
- text,
23
- value
24
- }))
25
- )(values);
26
-
27
- export const DropdownI18n = ({
28
- allowAdditions,
29
- basic,
30
- label,
31
- multiple,
32
- name,
33
- onAddItem,
34
- onChange,
35
- property,
36
- required,
37
- search,
38
- selection,
39
- sortBy,
40
- translateValues = false,
41
- value,
42
- values
43
- }) => {
44
- const { formatMessage } = useIntl();
45
- return (
46
- <Form.Dropdown
47
- allowAdditions={allowAdditions}
48
- basic={basic}
49
- label={
50
- label ? formatMessage({ id: label, defaultMessage: label }) : false
51
- }
52
- multiple={multiple}
53
- name={name}
54
- onAddItem={onAddItem}
55
- onChange={onChange}
56
- options={toOptions(
57
- formatMessage,
58
- property,
59
- translateValues,
60
- sortBy
61
- )(values)}
62
- placeholder={formatMessage({
63
- id: `${property}.placeholder`,
64
- defaultMessage: " "
65
- })}
66
- required={required}
67
- search={search}
68
- selection={selection}
69
- value={value}
70
- />
71
- );
72
- };
73
-
74
- DropdownI18n.propTypes = {
75
- allowAdditions: PropTypes.bool,
76
- basic: PropTypes.bool,
77
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
78
- multiple: PropTypes.bool,
79
- name: PropTypes.string,
80
- onAddItem: PropTypes.func,
81
- onChange: PropTypes.func,
82
- property: PropTypes.string,
83
- required: PropTypes.bool,
84
- search: PropTypes.bool,
85
- selection: PropTypes.bool,
86
- sortBy: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
87
- translateValues: PropTypes.bool,
88
- value: PropTypes.string,
89
- values: PropTypes.arrayOf(PropTypes.string)
90
- };
91
-
92
- export default DropdownI18n;
@@ -1,31 +0,0 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
3
- import { intl } from "@truedat/test/intl-stub";
4
- import { DropdownI18n } from "../DropdownI18n";
5
-
6
- // workaround for enzyme issue with React.useContext
7
- // see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
8
- jest.spyOn(React, "useContext").mockImplementation(() => intl);
9
-
10
- describe("<DropdownI18n />", () => {
11
- const props = {
12
- allowAdditions: true,
13
- basic: true,
14
- label: "label",
15
- multiple: true,
16
- name: "name",
17
- onChange: jest.fn(),
18
- onAddItem: jest.fn(),
19
- options: ["foo", "bar", "baz"],
20
- property: "some.i18n.prop",
21
- required: true,
22
- search: true,
23
- selection: true,
24
- value: "foo"
25
- };
26
-
27
- it("matches the latest snapshot", () => {
28
- const wrapper = shallow(<DropdownI18n {...props} />);
29
- expect(wrapper).toMatchSnapshot();
30
- });
31
- });
@@ -1,21 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<DropdownI18n /> matches the latest snapshot 1`] = `
4
- <FormDropdown
5
- allowAdditions={true}
6
- as={[Function]}
7
- basic={true}
8
- control={[Function]}
9
- label="label"
10
- multiple={true}
11
- name="name"
12
- onAddItem={[MockFunction]}
13
- onChange={[MockFunction]}
14
- options={Array []}
15
- placeholder=" "
16
- required={true}
17
- search={true}
18
- selection={true}
19
- value="foo"
20
- />
21
- `;