datastake-daf 0.6.272 → 0.6.274
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/dist/components/index.js +112 -281
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/src/@daf/core/components/EditForm/EditForm.stories.js +0 -1
- package/src/@daf/core/components/EditForm/_index.scss +18 -64
- package/src/@daf/core/components/EditForm/form.jsx +2 -3
- package/src/@daf/core/components/ViewForm/ViewForm.stories.js +0 -1
- package/src/@daf/core/components/ViewForm/content.jsx +346 -386
- package/src/@daf/utils/tooltip.js +2 -2
- package/.env +0 -8
- package/.vscode/settings.json +0 -13
|
@@ -1,411 +1,371 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
|
-
import { Tabs, Alert } from
|
|
3
|
-
import React, { useEffect, useState } from
|
|
4
|
-
import Group from
|
|
5
|
-
import Input from
|
|
6
|
-
import { getInputLabel } from
|
|
7
|
-
import { getToken } from
|
|
8
|
-
import RepeatableGroup from
|
|
9
|
-
import RepeatableModals from
|
|
10
|
-
import { repeatObjects, isGroupInput, groupSubsections, getLastRow, showHideInput } from
|
|
11
|
-
import GetIcon from
|
|
2
|
+
import { Tabs, Alert } from 'antd';
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import Group from './components/group';
|
|
5
|
+
import Input from './components/input';
|
|
6
|
+
import { getInputLabel } from './config';
|
|
7
|
+
import { getToken } from '../../../../helpers/Token';
|
|
8
|
+
import RepeatableGroup from './components/repeatableGroup';
|
|
9
|
+
import RepeatableModals from './components/repeatableModals';
|
|
10
|
+
import { repeatObjects, isGroupInput, groupSubsections, getLastRow, showHideInput } from './helper';
|
|
11
|
+
import GetIcon from '../Icon/index.jsx';
|
|
12
12
|
|
|
13
13
|
const Content = ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
fullWidth = false,
|
|
14
|
+
style = {},
|
|
15
|
+
form = {},
|
|
16
|
+
data = {},
|
|
17
|
+
groupConfig = {},
|
|
18
|
+
versionsDatapoints,
|
|
19
|
+
linkingData = {},
|
|
20
|
+
linkingForms = {},
|
|
21
|
+
ajaxOptions = [],
|
|
22
|
+
// ADDED
|
|
23
|
+
t,
|
|
24
|
+
app,
|
|
25
|
+
ajaxForms,
|
|
26
|
+
language,
|
|
27
|
+
changeAjaxForms,
|
|
28
|
+
getApiBaseUrl,
|
|
29
|
+
getAppHeader,
|
|
30
|
+
user,
|
|
31
|
+
evaluationConfig = [],
|
|
33
32
|
}) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
33
|
+
const groupSingle = (grps) => {
|
|
34
|
+
const form = Object.keys(grps).reduce((f, gKey) => {
|
|
35
|
+
if (
|
|
36
|
+
grps[gKey].type !== 'modal' &&
|
|
37
|
+
!isGroupInput(grps[gKey], false, data) &&
|
|
38
|
+
!isGroupInput(grps[gKey], true, data) &&
|
|
39
|
+
grps[gKey].display !== 'group' &&
|
|
40
|
+
!grps[gKey].viewGroup &&
|
|
41
|
+
!grps[gKey].component) {
|
|
42
|
+
if (grps[gKey].group && !f[grps[gKey].group]) {
|
|
43
|
+
f[grps[gKey].group] = {};
|
|
44
|
+
Object.assign(f[grps[gKey].group], { [gKey]: grps[gKey] });
|
|
45
|
+
} else if (grps[gKey].group && f[grps[gKey].group]) {
|
|
46
|
+
Object.assign(f[grps[gKey].group], { [gKey]: grps[gKey] });
|
|
47
|
+
}
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
if (grps[gKey]?.meta?.group && !f[grps[gKey]?.meta?.group]) {
|
|
50
|
+
f[grps[gKey]?.meta?.group] = {};
|
|
51
|
+
Object.assign(f[grps[gKey].meta.group], { [gKey]: grps[gKey] });
|
|
52
|
+
} else if (grps[gKey]?.meta?.group && f[grps[gKey]?.meta?.group]) {
|
|
53
|
+
Object.assign(f[grps[gKey].meta.group], { [gKey]: grps[gKey] });
|
|
54
|
+
}
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
56
|
+
if (grps[gKey].section && !f[grps[gKey].section]) {
|
|
57
|
+
f[grps[gKey].section] = {};
|
|
58
|
+
Object.assign(f[grps[gKey].section], { [gKey]: grps[gKey] });
|
|
59
|
+
} else if (grps[gKey].section && f[grps[gKey].section]) {
|
|
60
|
+
Object.assign(f[grps[gKey].section], { [gKey]: grps[gKey] });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return f;
|
|
64
|
+
}, {});
|
|
65
|
+
return form;
|
|
66
|
+
}
|
|
69
67
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
68
|
+
const getDisplayGroupConfig = (groups, key) => {
|
|
69
|
+
return Object.keys(groups).reduce((items, gKey) => {
|
|
70
|
+
if (groups[gKey].viewGroup === key) {
|
|
71
|
+
// eslint-disable-next-line no-unused-vars
|
|
72
|
+
const { viewGroup, ...gCfg } = groups[gKey];
|
|
73
|
+
items[gKey] = gCfg;
|
|
74
|
+
}
|
|
75
|
+
return items;
|
|
76
|
+
}, {});
|
|
77
|
+
}
|
|
80
78
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
};
|
|
79
|
+
const getComponent = (component, key, config) => {
|
|
80
|
+
switch (component) {
|
|
81
|
+
case 'repeatableModals':
|
|
82
|
+
return <RepeatableModals
|
|
83
|
+
app={app}
|
|
84
|
+
key={key}
|
|
85
|
+
t={t}
|
|
86
|
+
ajaxForms={ajaxForms}
|
|
87
|
+
changeAjaxForms={changeAjaxForms}
|
|
88
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
89
|
+
getAppHeader={getAppHeader}
|
|
90
|
+
user={user}
|
|
91
|
+
getToken={getToken}
|
|
92
|
+
name={key}
|
|
93
|
+
data={data}
|
|
94
|
+
config={config}
|
|
95
|
+
linkingData={linkingData}
|
|
96
|
+
linkingForms={linkingForms}
|
|
97
|
+
ajaxOptions={ajaxOptions}
|
|
98
|
+
/>;
|
|
99
|
+
default:
|
|
100
|
+
return <p>Component</p>;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
107
103
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
104
|
+
const isDisplayGroup = (input) => input.display && input.display === 'group';
|
|
105
|
+
const isSingleModal = (input) => input.type && input.type === 'modal';
|
|
106
|
+
const hasComponent = (input) => input.component && typeof input.component === 'string';
|
|
111
107
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
const typeRender = (groups, singleGroupsKeys, addedContent) => {
|
|
109
|
+
const _length = Object.keys(groups || {}).length;
|
|
110
|
+
const isEven = _length % 2 === 0;
|
|
115
111
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
const groupped = Object.keys(groups).reduce((all, key) => {
|
|
113
|
+
const _val = groups[key];
|
|
114
|
+
const group = _val.group || _val?.meta?.group || _val.section;
|
|
119
115
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
116
|
+
if (all[group]) {
|
|
117
|
+
all[group][key] = _val;
|
|
118
|
+
} else {
|
|
119
|
+
all[group] = { [key]: _val };
|
|
120
|
+
}
|
|
125
121
|
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
return all;
|
|
123
|
+
}, {});
|
|
128
124
|
|
|
129
|
-
return Object.keys(groupped).map((key) => {
|
|
130
|
-
const groups = groupped[key];
|
|
131
125
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
{repeatObjects(groups, (key, ind) => {
|
|
135
|
-
// normal group
|
|
136
|
-
return hasComponent(groups[key]) ? (
|
|
137
|
-
getComponent(groups[key].component, key, groups[key])
|
|
138
|
-
) : isGroupInput(groups[key], false, data) ? (
|
|
139
|
-
<Group
|
|
140
|
-
t={t}
|
|
141
|
-
key={key}
|
|
142
|
-
name={key}
|
|
143
|
-
linkingData={linkingData}
|
|
144
|
-
config={groups[key]}
|
|
145
|
-
data={data}
|
|
146
|
-
allData={data}
|
|
147
|
-
linkingForms={linkingForms}
|
|
148
|
-
cols={2}
|
|
149
|
-
ajaxForms={ajaxForms}
|
|
150
|
-
changeAjaxForms={changeAjaxForms}
|
|
151
|
-
getApiBaseUrl={getApiBaseUrl}
|
|
152
|
-
getAppHeader={getAppHeader}
|
|
153
|
-
user={user}
|
|
154
|
-
getToken={getToken}
|
|
155
|
-
evaluationConfig={evaluationConfig}
|
|
156
|
-
ajaxOptions={ajaxOptions}
|
|
157
|
-
></Group>
|
|
158
|
-
) : // repeatable group
|
|
159
|
-
isGroupInput(groups[key], true, data) ? (
|
|
160
|
-
<RepeatableGroup
|
|
161
|
-
app={app}
|
|
162
|
-
key={key}
|
|
163
|
-
t={t}
|
|
164
|
-
ajaxForms={ajaxForms}
|
|
165
|
-
changeAjaxForms={changeAjaxForms}
|
|
166
|
-
getApiBaseUrl={getApiBaseUrl}
|
|
167
|
-
getAppHeader={getAppHeader}
|
|
168
|
-
user={user}
|
|
169
|
-
getToken={getToken}
|
|
170
|
-
name={key}
|
|
171
|
-
config={groups[key]}
|
|
172
|
-
data={data}
|
|
173
|
-
allData={data}
|
|
174
|
-
linkingData={linkingData}
|
|
175
|
-
linkingForms={linkingForms}
|
|
176
|
-
ajaxOptions={ajaxOptions}
|
|
177
|
-
></RepeatableGroup>
|
|
178
|
-
) : // single inputs grouped
|
|
179
|
-
singleGroupsKeys.includes(key) ? (
|
|
180
|
-
(() => {
|
|
181
|
-
if (!addedContent.includes(key)) {
|
|
182
|
-
const currentGroup = Object.keys(groupSingle(groups)).find(
|
|
183
|
-
(k) => Object.keys(groupSingle(groups)[k]).includes(key),
|
|
184
|
-
);
|
|
185
|
-
addedContent.push(
|
|
186
|
-
...Object.keys(groupSingle(groups)[currentGroup]),
|
|
187
|
-
);
|
|
188
|
-
const config = groupSingle(groups)[currentGroup];
|
|
189
|
-
if (
|
|
190
|
-
groups[key].viewShowIf ||
|
|
191
|
-
groups[key]?.meta?.excludeFromView
|
|
192
|
-
) {
|
|
193
|
-
if (!showHideInput(groups[key], data)) {
|
|
194
|
-
return null;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
126
|
+
return Object.keys(groupped).map((key) => {
|
|
127
|
+
const groups = groupped[key];
|
|
197
128
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
<div className="title">
|
|
259
|
-
<h1>
|
|
260
|
-
{groups[key].outputLabel ||
|
|
261
|
-
getInputLabel(groups[key], data)}
|
|
262
|
-
</h1>
|
|
263
|
-
</div>
|
|
264
|
-
<Input
|
|
265
|
-
app={app}
|
|
266
|
-
t={t}
|
|
267
|
-
key={key}
|
|
268
|
-
ajaxForms={ajaxForms}
|
|
269
|
-
changeAjaxForms={changeAjaxForms}
|
|
270
|
-
getApiBaseUrl={getApiBaseUrl}
|
|
271
|
-
getAppHeader={getAppHeader}
|
|
272
|
-
user={user}
|
|
273
|
-
getToken={getToken}
|
|
274
|
-
versionsDatapoints={versionsDatapoints}
|
|
275
|
-
parent={key}
|
|
276
|
-
name={groups[key].dataId || key}
|
|
277
|
-
config={groups[key]}
|
|
278
|
-
className="last"
|
|
279
|
-
data={data}
|
|
280
|
-
allData={data}
|
|
281
|
-
linkingData={linkingData}
|
|
282
|
-
linkingForms={linkingForms}
|
|
283
|
-
ajaxOptions={ajaxOptions}
|
|
284
|
-
evaluationConfig={evaluationConfig}
|
|
285
|
-
cols={2}
|
|
286
|
-
></Input>
|
|
287
|
-
</div>
|
|
288
|
-
) : null;
|
|
289
|
-
})}
|
|
290
|
-
</React.Fragment>
|
|
291
|
-
);
|
|
292
|
-
});
|
|
293
|
-
};
|
|
129
|
+
return (
|
|
130
|
+
<React.Fragment key={key}>
|
|
131
|
+
{repeatObjects(groups, (key, ind) => {
|
|
132
|
+
// normal group
|
|
133
|
+
return hasComponent(groups[key]) ? getComponent(groups[key].component, key, groups[key]) : isGroupInput(groups[key], false, data)
|
|
134
|
+
? (
|
|
135
|
+
<Group
|
|
136
|
+
t={t}
|
|
137
|
+
key={key}
|
|
138
|
+
name={key}
|
|
139
|
+
linkingData={linkingData}
|
|
140
|
+
config={groups[key]}
|
|
141
|
+
data={data}
|
|
142
|
+
allData={data}
|
|
143
|
+
linkingForms={linkingForms}
|
|
144
|
+
cols={2}
|
|
145
|
+
ajaxForms={ajaxForms}
|
|
146
|
+
changeAjaxForms={changeAjaxForms}
|
|
147
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
148
|
+
getAppHeader={getAppHeader}
|
|
149
|
+
user={user}
|
|
150
|
+
getToken={getToken}
|
|
151
|
+
evaluationConfig={evaluationConfig}
|
|
152
|
+
ajaxOptions={ajaxOptions}
|
|
153
|
+
>
|
|
154
|
+
</Group>
|
|
155
|
+
)
|
|
156
|
+
// repeatable group
|
|
157
|
+
: isGroupInput(groups[key], true, data)
|
|
158
|
+
? <RepeatableGroup
|
|
159
|
+
app={app}
|
|
160
|
+
key={key}
|
|
161
|
+
t={t}
|
|
162
|
+
ajaxForms={ajaxForms}
|
|
163
|
+
changeAjaxForms={changeAjaxForms}
|
|
164
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
165
|
+
getAppHeader={getAppHeader}
|
|
166
|
+
user={user}
|
|
167
|
+
getToken={getToken}
|
|
168
|
+
name={key}
|
|
169
|
+
config={groups[key]}
|
|
170
|
+
data={data}
|
|
171
|
+
allData={data}
|
|
172
|
+
linkingData={linkingData}
|
|
173
|
+
linkingForms={linkingForms}
|
|
174
|
+
ajaxOptions={ajaxOptions}
|
|
175
|
+
>
|
|
176
|
+
</RepeatableGroup>
|
|
177
|
+
// single inputs grouped
|
|
178
|
+
: singleGroupsKeys.includes(key) ? (() => {
|
|
179
|
+
if (!addedContent.includes(key)) {
|
|
180
|
+
const currentGroup = Object.keys(groupSingle(groups))
|
|
181
|
+
.find(k => Object.keys(groupSingle(groups)[k]).includes(key));
|
|
182
|
+
addedContent.push(...Object.keys(groupSingle(groups)[currentGroup]));
|
|
183
|
+
const config = groupSingle(groups)[currentGroup];
|
|
184
|
+
if (groups[key].viewShowIf || groups[key]?.meta?.excludeFromView) {
|
|
185
|
+
if (!showHideInput(groups[key], data)) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
294
189
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
190
|
+
return <div className="group" id={currentGroup} key={`${currentGroup}-${Date.now()}`}>
|
|
191
|
+
{groupConfig[currentGroup] ? <div className="title">
|
|
192
|
+
<h1>{groupConfig[currentGroup][language]}</h1>
|
|
193
|
+
</div> : null}
|
|
194
|
+
<Input
|
|
195
|
+
app={app}
|
|
196
|
+
t={t}
|
|
197
|
+
ajaxForms={ajaxForms}
|
|
198
|
+
changeAjaxForms={changeAjaxForms}
|
|
199
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
200
|
+
getAppHeader={getAppHeader}
|
|
201
|
+
user={user}
|
|
202
|
+
getToken={getToken}
|
|
203
|
+
versionsDatapoints={versionsDatapoints}
|
|
204
|
+
key={key}
|
|
205
|
+
name={config.dataId || key}
|
|
206
|
+
config={config}
|
|
207
|
+
data={data}
|
|
208
|
+
allData={data}
|
|
209
|
+
linkingData={linkingData}
|
|
210
|
+
className={
|
|
211
|
+
isEven ? (
|
|
212
|
+
(ind === _length - 1 || ind === _length - 2) ? 'last' : undefined
|
|
213
|
+
) : ind === _length - 1 ? 'last' : undefined}
|
|
214
|
+
linkingForms={linkingForms}
|
|
215
|
+
ajaxOptions={ajaxOptions}
|
|
216
|
+
evaluationConfig={evaluationConfig}
|
|
217
|
+
cols={2}
|
|
218
|
+
>
|
|
219
|
+
</Input>
|
|
220
|
+
</div>
|
|
221
|
+
}
|
|
222
|
+
})()
|
|
223
|
+
// display group
|
|
224
|
+
: isDisplayGroup(groups[key])
|
|
225
|
+
? (
|
|
226
|
+
<div className="group display" key={key}>
|
|
227
|
+
<div className="title">
|
|
228
|
+
<h1>{groups[key].label}</h1>
|
|
229
|
+
</div>
|
|
230
|
+
{typeRender(getDisplayGroupConfig(groups, key), singleGroupsKeys, addedContent)}
|
|
231
|
+
</div>
|
|
232
|
+
)
|
|
233
|
+
// single modal
|
|
234
|
+
: isSingleModal(groups[key])
|
|
235
|
+
? (
|
|
236
|
+
<div className="group" key={key}>
|
|
237
|
+
<div className="title">
|
|
238
|
+
<h1>{groups[key].outputLabel || getInputLabel(groups[key], data)}</h1>
|
|
239
|
+
</div>
|
|
240
|
+
<Input
|
|
241
|
+
app={app}
|
|
242
|
+
t={t}
|
|
243
|
+
key={key}
|
|
244
|
+
ajaxForms={ajaxForms}
|
|
245
|
+
changeAjaxForms={changeAjaxForms}
|
|
246
|
+
getApiBaseUrl={getApiBaseUrl}
|
|
247
|
+
getAppHeader={getAppHeader}
|
|
248
|
+
user={user}
|
|
249
|
+
getToken={getToken}
|
|
250
|
+
versionsDatapoints={versionsDatapoints}
|
|
251
|
+
parent={key}
|
|
252
|
+
name={groups[key].dataId || key}
|
|
253
|
+
config={groups[key]}
|
|
254
|
+
className="last"
|
|
255
|
+
data={data}
|
|
256
|
+
allData={data}
|
|
257
|
+
linkingData={linkingData}
|
|
258
|
+
linkingForms={linkingForms}
|
|
259
|
+
ajaxOptions={ajaxOptions}
|
|
260
|
+
evaluationConfig={evaluationConfig}
|
|
261
|
+
cols={2}
|
|
262
|
+
>
|
|
263
|
+
</Input>
|
|
264
|
+
</div>
|
|
265
|
+
)
|
|
266
|
+
: null;
|
|
267
|
+
})}
|
|
268
|
+
</React.Fragment>
|
|
269
|
+
)
|
|
270
|
+
})
|
|
271
|
+
}
|
|
327
272
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
273
|
+
useEffect(() => {
|
|
274
|
+
setTimeout(() => {
|
|
275
|
+
const groups = Array.from(document.getElementsByClassName('group'));
|
|
276
|
+
const rows = Array.from(document.querySelectorAll('.repetable-row-extra'));
|
|
277
|
+
rows.forEach(row => {
|
|
278
|
+
const inputs = Array.from(row.querySelectorAll('.input'));
|
|
279
|
+
const lasts = getLastRow(inputs.map((i, ind) => ind), 4);
|
|
280
|
+
if (lasts) {
|
|
281
|
+
lasts.forEach(index => inputs[index].classList.add('last'));
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
groups.forEach(group => {
|
|
285
|
+
// const isRepeatable = Array.from(group.classList).includes('repeatable');
|
|
286
|
+
const inputs = Array.from(group.querySelectorAll('.input'));
|
|
287
|
+
// if (inputs.length && !isRepeatable) {
|
|
288
|
+
// if (inputs.length % 2 === 0) {
|
|
289
|
+
// inputs[inputs.length - 1].classList.add('last');
|
|
290
|
+
// inputs[inputs.length - 2].classList.add('last');
|
|
291
|
+
// } else {
|
|
292
|
+
// inputs[inputs.length - 1].classList.add('last');
|
|
293
|
+
// }
|
|
294
|
+
// }
|
|
295
|
+
// remove groups without inputs
|
|
296
|
+
if (!inputs.length) {
|
|
297
|
+
group.remove();
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}, 200)
|
|
301
|
+
}, [form, data])
|
|
332
302
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return <Alert message={f.alertConf.text} type={f.alertConf.type} showIcon />;
|
|
338
|
-
}
|
|
339
|
-
let { label, icon, position, ...groups } = f;
|
|
340
|
-
groups = Object.keys(groups).reduce((items, key) => {
|
|
341
|
-
if (!groups[key]?.meta?.excludeFromView) {
|
|
342
|
-
items[key] = groups[key];
|
|
343
|
-
}
|
|
344
|
-
return items;
|
|
345
|
-
}, {});
|
|
346
|
-
const addedContent = [];
|
|
347
|
-
const singleGroupsKeys = [].concat(
|
|
348
|
-
...Object.keys(groupSingle(groups)).map((key) =>
|
|
349
|
-
Object.keys(groupSingle(groups)[key]),
|
|
350
|
-
),
|
|
351
|
-
);
|
|
303
|
+
const [extraRequestSent, setExtraRequestSent] = useState({});
|
|
304
|
+
const [extraRequestLoading, setExtraRequestLoading] = useState({});
|
|
305
|
+
const [extraRequestData, setExtraRequestData] = useState({});
|
|
306
|
+
const hasSubSections = false;
|
|
352
307
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
</>
|
|
370
|
-
);
|
|
371
|
-
}
|
|
372
|
-
};
|
|
308
|
+
const renderContent = (f, showTitle = true) => {
|
|
309
|
+
if (f) {
|
|
310
|
+
const alertType = ['error', 'warning', 'info', 'success'];
|
|
311
|
+
if (f.alertConf && f.alertConf.type === 'warning') {
|
|
312
|
+
return <Alert message={f.alertConf.text} type={f.alertConf.type} showIcon />
|
|
313
|
+
}
|
|
314
|
+
let { label, icon, position, ...groups } = f;
|
|
315
|
+
groups = Object.keys(groups).reduce((items, key) => {
|
|
316
|
+
if (!groups[key]?.meta?.excludeFromView) {
|
|
317
|
+
items[key] = groups[key];
|
|
318
|
+
}
|
|
319
|
+
return items;
|
|
320
|
+
}, {});
|
|
321
|
+
const addedContent = [];
|
|
322
|
+
const singleGroupsKeys = [].concat(...Object.keys(groupSingle(groups))
|
|
323
|
+
.map(key => Object.keys(groupSingle(groups)[key])));
|
|
373
324
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
325
|
+
return <>
|
|
326
|
+
<div className="wrapper" key={Date.now()} style={{ width: 700 }}>
|
|
327
|
+
{f.alertConf ? <Alert className="w-100" style={{ marginBottom: '20px' }} message={f.alertConf.text} type={
|
|
328
|
+
alertType.includes(f.alertConf.type) ? f.alertConf.type : 'info'
|
|
329
|
+
} showIcon /> : null}
|
|
330
|
+
{typeRender(groups, singleGroupsKeys, addedContent)}
|
|
331
|
+
</div>
|
|
332
|
+
</>
|
|
333
|
+
}
|
|
334
|
+
}
|
|
378
335
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
) : (
|
|
384
|
-
<React.Fragment>
|
|
385
|
-
<h1 className="title">{form ? getInputLabel(form, data) : ""}</h1>
|
|
386
|
-
<Tabs
|
|
387
|
-
className="section-tabs"
|
|
388
|
-
items={repeatObjects(groupSections, (key) => {
|
|
389
|
-
const section = groupSections[key];
|
|
336
|
+
let groupSections = [];
|
|
337
|
+
if (hasSubSections) {
|
|
338
|
+
groupSections = groupSubsections(form);
|
|
339
|
+
}
|
|
390
340
|
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
341
|
+
return (
|
|
342
|
+
<div className="content" style={style}>
|
|
343
|
+
{!hasSubSections ? renderContent(form) : (
|
|
344
|
+
<React.Fragment>
|
|
345
|
+
<h1 className="title">{form ? getInputLabel(form, data) : ''}</h1>
|
|
346
|
+
<Tabs
|
|
347
|
+
className="section-tabs"
|
|
348
|
+
items={repeatObjects(groupSections, (key) => {
|
|
349
|
+
const section = groupSections[key];
|
|
350
|
+
|
|
351
|
+
return {
|
|
352
|
+
style: { maxHeight: 'calc(100vh - 100px)', overflowY: 'auto' },
|
|
353
|
+
label: (
|
|
354
|
+
<span>
|
|
355
|
+
{section.icon ?
|
|
356
|
+
<GetIcon icon={section.icon} /> : null} {getInputLabel(section, data)}
|
|
357
|
+
</span>
|
|
358
|
+
),
|
|
359
|
+
key: key,
|
|
360
|
+
tabKey: key,
|
|
361
|
+
children: renderContent(groupSections[key], false),
|
|
362
|
+
};
|
|
363
|
+
})}
|
|
364
|
+
/>
|
|
365
|
+
</React.Fragment>
|
|
366
|
+
)}
|
|
367
|
+
</div>
|
|
368
|
+
);
|
|
369
|
+
}
|
|
410
370
|
|
|
411
371
|
export default Content;
|