@truedat/df 4.38.1 → 4.38.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 +6 -0
- package/package.json +5 -5
- package/src/components/DynamicFieldValue.js +64 -0
- package/src/components/DynamicForm.js +7 -67
- package/src/components/DynamicFormViewer.js +10 -29
- package/src/components/EditableDynamicFieldValue.js +137 -0
- package/src/components/FieldGroupDetail.js +17 -141
- package/src/components/FieldViewerValue.js +88 -0
- package/src/components/__tests__/DynamicFieldValue.spec.js +22 -0
- package/src/components/__tests__/EditableDynamicFieldValue.spec.js +34 -0
- package/src/components/__tests__/FieldViewerValue.spec.js +76 -0
- package/src/components/__tests__/__snapshots__/DynamicFieldValue.spec.js.snap +102 -0
- package/src/components/__tests__/__snapshots__/EditableDynamicFieldValue.spec.js.snap +160 -0
- package/src/components/__tests__/__snapshots__/FieldViewerValue.spec.js.snap +963 -0
- package/src/messages/en.js +3 -0
- package/src/messages/es.js +3 -0
- package/src/styles/fieldGroupDetail.less +50 -0
- package/src/templates/utils/__tests__/parseFieldOptions.spec.js +120 -0
- package/src/templates/utils/__tests__/parseGroups.spec.js +228 -0
- package/src/templates/utils/index.js +2 -0
- package/src/templates/utils/parseFieldOptions.js +41 -0
- package/src/templates/utils/parseGroups.js +44 -0
- package/src/templates/utils/validateContent.js +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { DynamicFieldValue } from "../DynamicFieldValue";
|
|
4
|
+
|
|
5
|
+
describe("<DynamicFieldValue />", () => {
|
|
6
|
+
it("matches the latest snapshot", () => {
|
|
7
|
+
const renderOpts = {
|
|
8
|
+
messages: {
|
|
9
|
+
en: {},
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
const props = {
|
|
13
|
+
label: "label",
|
|
14
|
+
value: "value",
|
|
15
|
+
type: "string",
|
|
16
|
+
values: null,
|
|
17
|
+
widget: "text",
|
|
18
|
+
};
|
|
19
|
+
const wrapper = render(<DynamicFieldValue {...props} />, renderOpts);
|
|
20
|
+
expect(wrapper).toMatchSnapshot();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { EditableDynamicFieldValue } from "../EditableDynamicFieldValue";
|
|
4
|
+
|
|
5
|
+
describe("<EditableDynamicFieldValue />", () => {
|
|
6
|
+
it("matches the latest snapshot", () => {
|
|
7
|
+
const renderOpts = {
|
|
8
|
+
messages: {
|
|
9
|
+
en: {},
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
const props = {
|
|
13
|
+
label: "label",
|
|
14
|
+
value: "value",
|
|
15
|
+
type: "string",
|
|
16
|
+
values: null,
|
|
17
|
+
widget: "text",
|
|
18
|
+
name: "name",
|
|
19
|
+
editFunctions: {
|
|
20
|
+
onChange: jest.fn(),
|
|
21
|
+
onCancel: jest.fn(),
|
|
22
|
+
onSubmit: jest.fn(),
|
|
23
|
+
editingField: "name",
|
|
24
|
+
setEditingField: jest.fn(),
|
|
25
|
+
updateStatus: "none",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const wrapper = render(
|
|
29
|
+
<EditableDynamicFieldValue {...props} />,
|
|
30
|
+
renderOpts
|
|
31
|
+
);
|
|
32
|
+
expect(wrapper).toMatchSnapshot();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import { FieldViewerValue } from "../FieldViewerValue";
|
|
4
|
+
|
|
5
|
+
describe("<FieldViewerValue />", () => {
|
|
6
|
+
const renderOpts = {
|
|
7
|
+
messages: {
|
|
8
|
+
en: {},
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const testTypes = [
|
|
13
|
+
{
|
|
14
|
+
value: { url_name: "name", url_value: "value" },
|
|
15
|
+
type: "url",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
values: { table_columns: [{ name: "col1" }] },
|
|
19
|
+
value: [{ col1: "v1" }, { col1: "v2" }],
|
|
20
|
+
type: "table",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: "image",
|
|
24
|
+
type: "image",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
value: { id: 1, name: "name" },
|
|
28
|
+
type: "system",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
value: { id: 1, name: "name" },
|
|
32
|
+
type: "domain",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
value: "copy",
|
|
36
|
+
type: "copy",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
value: "string",
|
|
40
|
+
type: "string",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "user",
|
|
44
|
+
type: "user",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
value: "number",
|
|
48
|
+
type: "number",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: "date",
|
|
52
|
+
type: "date",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
value: "datetime",
|
|
56
|
+
type: "datetime",
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
testTypes.forEach((props) =>
|
|
61
|
+
it(`matches the latest snapshot with type: ${props.type}`, () => {
|
|
62
|
+
const wrapper = render(<FieldViewerValue {...props} />, renderOpts);
|
|
63
|
+
expect(wrapper).toMatchSnapshot();
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
it("matches the latest snapshot for multiple", () => {
|
|
68
|
+
const props = {
|
|
69
|
+
value: ["a", "b"],
|
|
70
|
+
multiple: true,
|
|
71
|
+
type: "string",
|
|
72
|
+
};
|
|
73
|
+
const wrapper = render(<FieldViewerValue {...props} />, renderOpts);
|
|
74
|
+
expect(wrapper).toMatchSnapshot();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<DynamicFieldValue /> matches the latest snapshot 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"asFragment": [Function],
|
|
6
|
+
"baseElement": <body>
|
|
7
|
+
<div>
|
|
8
|
+
<div
|
|
9
|
+
class="item"
|
|
10
|
+
role="listitem"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
class="header dynamic-field-header"
|
|
14
|
+
>
|
|
15
|
+
label
|
|
16
|
+
</div>
|
|
17
|
+
<div
|
|
18
|
+
class="description"
|
|
19
|
+
>
|
|
20
|
+
<div
|
|
21
|
+
class="default-value"
|
|
22
|
+
>
|
|
23
|
+
value
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</body>,
|
|
29
|
+
"container": <div>
|
|
30
|
+
<div
|
|
31
|
+
class="item"
|
|
32
|
+
role="listitem"
|
|
33
|
+
>
|
|
34
|
+
<div
|
|
35
|
+
class="header dynamic-field-header"
|
|
36
|
+
>
|
|
37
|
+
label
|
|
38
|
+
</div>
|
|
39
|
+
<div
|
|
40
|
+
class="description"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
class="default-value"
|
|
44
|
+
>
|
|
45
|
+
value
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>,
|
|
50
|
+
"debug": [Function],
|
|
51
|
+
"findAllByAltText": [Function],
|
|
52
|
+
"findAllByDisplayValue": [Function],
|
|
53
|
+
"findAllByLabelText": [Function],
|
|
54
|
+
"findAllByPlaceholderText": [Function],
|
|
55
|
+
"findAllByRole": [Function],
|
|
56
|
+
"findAllByTestId": [Function],
|
|
57
|
+
"findAllByText": [Function],
|
|
58
|
+
"findAllByTitle": [Function],
|
|
59
|
+
"findByAltText": [Function],
|
|
60
|
+
"findByDisplayValue": [Function],
|
|
61
|
+
"findByLabelText": [Function],
|
|
62
|
+
"findByPlaceholderText": [Function],
|
|
63
|
+
"findByRole": [Function],
|
|
64
|
+
"findByTestId": [Function],
|
|
65
|
+
"findByText": [Function],
|
|
66
|
+
"findByTitle": [Function],
|
|
67
|
+
"getAllByAltText": [Function],
|
|
68
|
+
"getAllByDisplayValue": [Function],
|
|
69
|
+
"getAllByLabelText": [Function],
|
|
70
|
+
"getAllByPlaceholderText": [Function],
|
|
71
|
+
"getAllByRole": [Function],
|
|
72
|
+
"getAllByTestId": [Function],
|
|
73
|
+
"getAllByText": [Function],
|
|
74
|
+
"getAllByTitle": [Function],
|
|
75
|
+
"getByAltText": [Function],
|
|
76
|
+
"getByDisplayValue": [Function],
|
|
77
|
+
"getByLabelText": [Function],
|
|
78
|
+
"getByPlaceholderText": [Function],
|
|
79
|
+
"getByRole": [Function],
|
|
80
|
+
"getByTestId": [Function],
|
|
81
|
+
"getByText": [Function],
|
|
82
|
+
"getByTitle": [Function],
|
|
83
|
+
"queryAllByAltText": [Function],
|
|
84
|
+
"queryAllByDisplayValue": [Function],
|
|
85
|
+
"queryAllByLabelText": [Function],
|
|
86
|
+
"queryAllByPlaceholderText": [Function],
|
|
87
|
+
"queryAllByRole": [Function],
|
|
88
|
+
"queryAllByTestId": [Function],
|
|
89
|
+
"queryAllByText": [Function],
|
|
90
|
+
"queryAllByTitle": [Function],
|
|
91
|
+
"queryByAltText": [Function],
|
|
92
|
+
"queryByDisplayValue": [Function],
|
|
93
|
+
"queryByLabelText": [Function],
|
|
94
|
+
"queryByPlaceholderText": [Function],
|
|
95
|
+
"queryByRole": [Function],
|
|
96
|
+
"queryByTestId": [Function],
|
|
97
|
+
"queryByText": [Function],
|
|
98
|
+
"queryByTitle": [Function],
|
|
99
|
+
"rerender": [Function],
|
|
100
|
+
"unmount": [Function],
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`<EditableDynamicFieldValue /> matches the latest snapshot 1`] = `
|
|
4
|
+
Object {
|
|
5
|
+
"asFragment": [Function],
|
|
6
|
+
"baseElement": <body>
|
|
7
|
+
<div>
|
|
8
|
+
<div
|
|
9
|
+
class="item"
|
|
10
|
+
role="listitem"
|
|
11
|
+
>
|
|
12
|
+
<div
|
|
13
|
+
class="header dynamic-field-header"
|
|
14
|
+
>
|
|
15
|
+
label
|
|
16
|
+
</div>
|
|
17
|
+
<div
|
|
18
|
+
class="description"
|
|
19
|
+
>
|
|
20
|
+
<div
|
|
21
|
+
class="field"
|
|
22
|
+
>
|
|
23
|
+
<label>
|
|
24
|
+
label
|
|
25
|
+
</label>
|
|
26
|
+
<div
|
|
27
|
+
class="field"
|
|
28
|
+
>
|
|
29
|
+
<div
|
|
30
|
+
class="ui input"
|
|
31
|
+
>
|
|
32
|
+
<input
|
|
33
|
+
name="name"
|
|
34
|
+
type="text"
|
|
35
|
+
value="value"
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
<div
|
|
41
|
+
class="ui container editable-dynamic-field-buttons"
|
|
42
|
+
>
|
|
43
|
+
<button
|
|
44
|
+
class="ui mini icon positive button"
|
|
45
|
+
>
|
|
46
|
+
template.field.action.save
|
|
47
|
+
</button>
|
|
48
|
+
<button
|
|
49
|
+
class="ui mini icon negative button"
|
|
50
|
+
>
|
|
51
|
+
template.field.action.cancel
|
|
52
|
+
</button>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</body>,
|
|
58
|
+
"container": <div>
|
|
59
|
+
<div
|
|
60
|
+
class="item"
|
|
61
|
+
role="listitem"
|
|
62
|
+
>
|
|
63
|
+
<div
|
|
64
|
+
class="header dynamic-field-header"
|
|
65
|
+
>
|
|
66
|
+
label
|
|
67
|
+
</div>
|
|
68
|
+
<div
|
|
69
|
+
class="description"
|
|
70
|
+
>
|
|
71
|
+
<div
|
|
72
|
+
class="field"
|
|
73
|
+
>
|
|
74
|
+
<label>
|
|
75
|
+
label
|
|
76
|
+
</label>
|
|
77
|
+
<div
|
|
78
|
+
class="field"
|
|
79
|
+
>
|
|
80
|
+
<div
|
|
81
|
+
class="ui input"
|
|
82
|
+
>
|
|
83
|
+
<input
|
|
84
|
+
name="name"
|
|
85
|
+
type="text"
|
|
86
|
+
value="value"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
<div
|
|
92
|
+
class="ui container editable-dynamic-field-buttons"
|
|
93
|
+
>
|
|
94
|
+
<button
|
|
95
|
+
class="ui mini icon positive button"
|
|
96
|
+
>
|
|
97
|
+
template.field.action.save
|
|
98
|
+
</button>
|
|
99
|
+
<button
|
|
100
|
+
class="ui mini icon negative button"
|
|
101
|
+
>
|
|
102
|
+
template.field.action.cancel
|
|
103
|
+
</button>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</div>,
|
|
108
|
+
"debug": [Function],
|
|
109
|
+
"findAllByAltText": [Function],
|
|
110
|
+
"findAllByDisplayValue": [Function],
|
|
111
|
+
"findAllByLabelText": [Function],
|
|
112
|
+
"findAllByPlaceholderText": [Function],
|
|
113
|
+
"findAllByRole": [Function],
|
|
114
|
+
"findAllByTestId": [Function],
|
|
115
|
+
"findAllByText": [Function],
|
|
116
|
+
"findAllByTitle": [Function],
|
|
117
|
+
"findByAltText": [Function],
|
|
118
|
+
"findByDisplayValue": [Function],
|
|
119
|
+
"findByLabelText": [Function],
|
|
120
|
+
"findByPlaceholderText": [Function],
|
|
121
|
+
"findByRole": [Function],
|
|
122
|
+
"findByTestId": [Function],
|
|
123
|
+
"findByText": [Function],
|
|
124
|
+
"findByTitle": [Function],
|
|
125
|
+
"getAllByAltText": [Function],
|
|
126
|
+
"getAllByDisplayValue": [Function],
|
|
127
|
+
"getAllByLabelText": [Function],
|
|
128
|
+
"getAllByPlaceholderText": [Function],
|
|
129
|
+
"getAllByRole": [Function],
|
|
130
|
+
"getAllByTestId": [Function],
|
|
131
|
+
"getAllByText": [Function],
|
|
132
|
+
"getAllByTitle": [Function],
|
|
133
|
+
"getByAltText": [Function],
|
|
134
|
+
"getByDisplayValue": [Function],
|
|
135
|
+
"getByLabelText": [Function],
|
|
136
|
+
"getByPlaceholderText": [Function],
|
|
137
|
+
"getByRole": [Function],
|
|
138
|
+
"getByTestId": [Function],
|
|
139
|
+
"getByText": [Function],
|
|
140
|
+
"getByTitle": [Function],
|
|
141
|
+
"queryAllByAltText": [Function],
|
|
142
|
+
"queryAllByDisplayValue": [Function],
|
|
143
|
+
"queryAllByLabelText": [Function],
|
|
144
|
+
"queryAllByPlaceholderText": [Function],
|
|
145
|
+
"queryAllByRole": [Function],
|
|
146
|
+
"queryAllByTestId": [Function],
|
|
147
|
+
"queryAllByText": [Function],
|
|
148
|
+
"queryAllByTitle": [Function],
|
|
149
|
+
"queryByAltText": [Function],
|
|
150
|
+
"queryByDisplayValue": [Function],
|
|
151
|
+
"queryByLabelText": [Function],
|
|
152
|
+
"queryByPlaceholderText": [Function],
|
|
153
|
+
"queryByRole": [Function],
|
|
154
|
+
"queryByTestId": [Function],
|
|
155
|
+
"queryByText": [Function],
|
|
156
|
+
"queryByTitle": [Function],
|
|
157
|
+
"rerender": [Function],
|
|
158
|
+
"unmount": [Function],
|
|
159
|
+
}
|
|
160
|
+
`;
|