@maif/react-forms 1.1.4 → 1.2.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/README.md +26 -14
- package/lib/esm/index.js +502 -113
- package/lib/index.css +6 -14
- package/lib/index.d.ts +25 -12
- package/lib/index.js +513 -122
- package/package.json +9 -3
package/lib/esm/index.js
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import * as yup from 'yup';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { useState, useRef, useEffect, useCallback, useImperativeHandle } from 'react';
|
|
3
|
+
import React__default, { forwardRef, useState, useRef, useEffect, useCallback, useImperativeHandle } from 'react';
|
|
4
4
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
5
5
|
import classNames from 'classnames';
|
|
6
6
|
import deepEqual from 'fast-deep-equal';
|
|
7
|
-
import
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
8
|
import { useFormContext, useController, useWatch, useForm, FormProvider, Controller, useFieldArray } from 'react-hook-form';
|
|
9
|
-
import { DatePicker } from 'react-rainbow-components';
|
|
10
9
|
import ReactToolTip from 'react-tooltip';
|
|
11
10
|
import { v4 } from 'uuid';
|
|
12
11
|
import debounce from 'lodash.debounce';
|
|
12
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
13
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
14
|
+
import { DatePicker } from '@mui/x-date-pickers/DatePicker';
|
|
15
|
+
import { TimePicker } from '@mui/x-date-pickers/TimePicker';
|
|
16
|
+
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
17
|
+
import TextField from '@mui/material/TextField';
|
|
13
18
|
import CreatableSelect from 'react-select/creatable';
|
|
14
19
|
import Select from 'react-select';
|
|
15
20
|
import hash$1 from 'object-hash';
|
|
16
21
|
import showdown from 'showdown';
|
|
17
22
|
import '@fortawesome/fontawesome-free/css/all.css';
|
|
18
23
|
import 'highlight.js/styles/monokai.css';
|
|
19
|
-
import hljs from 'highlight.js';
|
|
24
|
+
import hljs from 'highlight.js/lib/core';
|
|
20
25
|
|
|
21
26
|
const type = {
|
|
22
27
|
string: "string",
|
|
@@ -44,7 +49,9 @@ const format = {
|
|
|
44
49
|
hidden: "hidden",
|
|
45
50
|
form: "form",
|
|
46
51
|
buttonsSelect: "buttons",
|
|
47
|
-
singleLineCode: "singleLineCode"
|
|
52
|
+
singleLineCode: "singleLineCode",
|
|
53
|
+
datetime: "datetime-local",
|
|
54
|
+
time: "time"
|
|
48
55
|
};
|
|
49
56
|
function stringTuple(...data) {
|
|
50
57
|
return data;
|
|
@@ -172,25 +179,365 @@ var constraints = /*#__PURE__*/Object.freeze({
|
|
|
172
179
|
jsonConstraints: jsonConstraints
|
|
173
180
|
});
|
|
174
181
|
|
|
175
|
-
|
|
182
|
+
function _extends$8() { _extends$8 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
|
|
183
|
+
|
|
184
|
+
function _objectWithoutProperties$8(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$8(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
185
|
+
|
|
186
|
+
function _objectWithoutPropertiesLoose$8(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
187
|
+
var HelpCircle = forwardRef(function (_ref, ref) {
|
|
188
|
+
var _ref$color = _ref.color,
|
|
189
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
190
|
+
_ref$size = _ref.size,
|
|
191
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
192
|
+
rest = _objectWithoutProperties$8(_ref, ["color", "size"]);
|
|
193
|
+
|
|
194
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$8({
|
|
195
|
+
ref: ref,
|
|
196
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
197
|
+
width: size,
|
|
198
|
+
height: size,
|
|
199
|
+
viewBox: "0 0 24 24",
|
|
200
|
+
fill: "none",
|
|
201
|
+
stroke: color,
|
|
202
|
+
strokeWidth: "2",
|
|
203
|
+
strokeLinecap: "round",
|
|
204
|
+
strokeLinejoin: "round"
|
|
205
|
+
}, rest), /*#__PURE__*/React__default.createElement("circle", {
|
|
206
|
+
cx: "12",
|
|
207
|
+
cy: "12",
|
|
208
|
+
r: "10"
|
|
209
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
210
|
+
d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"
|
|
211
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
212
|
+
x1: "12",
|
|
213
|
+
y1: "17",
|
|
214
|
+
x2: "12.01",
|
|
215
|
+
y2: "17"
|
|
216
|
+
}));
|
|
217
|
+
});
|
|
218
|
+
HelpCircle.propTypes = {
|
|
219
|
+
color: PropTypes.string,
|
|
220
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
221
|
+
};
|
|
222
|
+
HelpCircle.displayName = 'HelpCircle';
|
|
223
|
+
|
|
224
|
+
function _extends$7() { _extends$7 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
|
|
225
|
+
|
|
226
|
+
function _objectWithoutProperties$7(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$7(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
227
|
+
|
|
228
|
+
function _objectWithoutPropertiesLoose$7(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
229
|
+
var Loader = forwardRef(function (_ref, ref) {
|
|
230
|
+
var _ref$color = _ref.color,
|
|
231
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
232
|
+
_ref$size = _ref.size,
|
|
233
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
234
|
+
rest = _objectWithoutProperties$7(_ref, ["color", "size"]);
|
|
235
|
+
|
|
236
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$7({
|
|
237
|
+
ref: ref,
|
|
238
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
239
|
+
width: size,
|
|
240
|
+
height: size,
|
|
241
|
+
viewBox: "0 0 24 24",
|
|
242
|
+
fill: "none",
|
|
243
|
+
stroke: color,
|
|
244
|
+
strokeWidth: "2",
|
|
245
|
+
strokeLinecap: "round",
|
|
246
|
+
strokeLinejoin: "round"
|
|
247
|
+
}, rest), /*#__PURE__*/React__default.createElement("line", {
|
|
248
|
+
x1: "12",
|
|
249
|
+
y1: "2",
|
|
250
|
+
x2: "12",
|
|
251
|
+
y2: "6"
|
|
252
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
253
|
+
x1: "12",
|
|
254
|
+
y1: "18",
|
|
255
|
+
x2: "12",
|
|
256
|
+
y2: "22"
|
|
257
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
258
|
+
x1: "4.93",
|
|
259
|
+
y1: "4.93",
|
|
260
|
+
x2: "7.76",
|
|
261
|
+
y2: "7.76"
|
|
262
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
263
|
+
x1: "16.24",
|
|
264
|
+
y1: "16.24",
|
|
265
|
+
x2: "19.07",
|
|
266
|
+
y2: "19.07"
|
|
267
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
268
|
+
x1: "2",
|
|
269
|
+
y1: "12",
|
|
270
|
+
x2: "6",
|
|
271
|
+
y2: "12"
|
|
272
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
273
|
+
x1: "18",
|
|
274
|
+
y1: "12",
|
|
275
|
+
x2: "22",
|
|
276
|
+
y2: "12"
|
|
277
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
278
|
+
x1: "4.93",
|
|
279
|
+
y1: "19.07",
|
|
280
|
+
x2: "7.76",
|
|
281
|
+
y2: "16.24"
|
|
282
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
283
|
+
x1: "16.24",
|
|
284
|
+
y1: "7.76",
|
|
285
|
+
x2: "19.07",
|
|
286
|
+
y2: "4.93"
|
|
287
|
+
}));
|
|
288
|
+
});
|
|
289
|
+
Loader.propTypes = {
|
|
290
|
+
color: PropTypes.string,
|
|
291
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
292
|
+
};
|
|
293
|
+
Loader.displayName = 'Loader';
|
|
294
|
+
|
|
295
|
+
function _extends$6() { _extends$6 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
|
|
296
|
+
|
|
297
|
+
function _objectWithoutProperties$6(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$6(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
298
|
+
|
|
299
|
+
function _objectWithoutPropertiesLoose$6(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
300
|
+
var Upload = forwardRef(function (_ref, ref) {
|
|
301
|
+
var _ref$color = _ref.color,
|
|
302
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
303
|
+
_ref$size = _ref.size,
|
|
304
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
305
|
+
rest = _objectWithoutProperties$6(_ref, ["color", "size"]);
|
|
306
|
+
|
|
307
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$6({
|
|
308
|
+
ref: ref,
|
|
309
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
310
|
+
width: size,
|
|
311
|
+
height: size,
|
|
312
|
+
viewBox: "0 0 24 24",
|
|
313
|
+
fill: "none",
|
|
314
|
+
stroke: color,
|
|
315
|
+
strokeWidth: "2",
|
|
316
|
+
strokeLinecap: "round",
|
|
317
|
+
strokeLinejoin: "round"
|
|
318
|
+
}, rest), /*#__PURE__*/React__default.createElement("path", {
|
|
319
|
+
d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"
|
|
320
|
+
}), /*#__PURE__*/React__default.createElement("polyline", {
|
|
321
|
+
points: "17 8 12 3 7 8"
|
|
322
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
323
|
+
x1: "12",
|
|
324
|
+
y1: "3",
|
|
325
|
+
x2: "12",
|
|
326
|
+
y2: "15"
|
|
327
|
+
}));
|
|
328
|
+
});
|
|
329
|
+
Upload.propTypes = {
|
|
330
|
+
color: PropTypes.string,
|
|
331
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
332
|
+
};
|
|
333
|
+
Upload.displayName = 'Upload';
|
|
334
|
+
|
|
335
|
+
function _extends$5() { _extends$5 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
|
|
336
|
+
|
|
337
|
+
function _objectWithoutProperties$5(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$5(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
338
|
+
|
|
339
|
+
function _objectWithoutPropertiesLoose$5(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
340
|
+
var ChevronDown = forwardRef(function (_ref, ref) {
|
|
341
|
+
var _ref$color = _ref.color,
|
|
342
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
343
|
+
_ref$size = _ref.size,
|
|
344
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
345
|
+
rest = _objectWithoutProperties$5(_ref, ["color", "size"]);
|
|
346
|
+
|
|
347
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$5({
|
|
348
|
+
ref: ref,
|
|
349
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
350
|
+
width: size,
|
|
351
|
+
height: size,
|
|
352
|
+
viewBox: "0 0 24 24",
|
|
353
|
+
fill: "none",
|
|
354
|
+
stroke: color,
|
|
355
|
+
strokeWidth: "2",
|
|
356
|
+
strokeLinecap: "round",
|
|
357
|
+
strokeLinejoin: "round"
|
|
358
|
+
}, rest), /*#__PURE__*/React__default.createElement("polyline", {
|
|
359
|
+
points: "6 9 12 15 18 9"
|
|
360
|
+
}));
|
|
361
|
+
});
|
|
362
|
+
ChevronDown.propTypes = {
|
|
363
|
+
color: PropTypes.string,
|
|
364
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
365
|
+
};
|
|
366
|
+
ChevronDown.displayName = 'ChevronDown';
|
|
367
|
+
|
|
368
|
+
function _extends$4() { _extends$4 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
|
|
369
|
+
|
|
370
|
+
function _objectWithoutProperties$4(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$4(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
371
|
+
|
|
372
|
+
function _objectWithoutPropertiesLoose$4(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
373
|
+
var ChevronUp = forwardRef(function (_ref, ref) {
|
|
374
|
+
var _ref$color = _ref.color,
|
|
375
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
376
|
+
_ref$size = _ref.size,
|
|
377
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
378
|
+
rest = _objectWithoutProperties$4(_ref, ["color", "size"]);
|
|
379
|
+
|
|
380
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$4({
|
|
381
|
+
ref: ref,
|
|
382
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
383
|
+
width: size,
|
|
384
|
+
height: size,
|
|
385
|
+
viewBox: "0 0 24 24",
|
|
386
|
+
fill: "none",
|
|
387
|
+
stroke: color,
|
|
388
|
+
strokeWidth: "2",
|
|
389
|
+
strokeLinecap: "round",
|
|
390
|
+
strokeLinejoin: "round"
|
|
391
|
+
}, rest), /*#__PURE__*/React__default.createElement("polyline", {
|
|
392
|
+
points: "18 15 12 9 6 15"
|
|
393
|
+
}));
|
|
394
|
+
});
|
|
395
|
+
ChevronUp.propTypes = {
|
|
396
|
+
color: PropTypes.string,
|
|
397
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
398
|
+
};
|
|
399
|
+
ChevronUp.displayName = 'ChevronUp';
|
|
400
|
+
|
|
401
|
+
function _extends$3() { _extends$3 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
|
|
402
|
+
|
|
403
|
+
function _objectWithoutProperties$3(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$3(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
404
|
+
|
|
405
|
+
function _objectWithoutPropertiesLoose$3(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
406
|
+
var Trash2 = forwardRef(function (_ref, ref) {
|
|
407
|
+
var _ref$color = _ref.color,
|
|
408
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
409
|
+
_ref$size = _ref.size,
|
|
410
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
411
|
+
rest = _objectWithoutProperties$3(_ref, ["color", "size"]);
|
|
412
|
+
|
|
413
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$3({
|
|
414
|
+
ref: ref,
|
|
415
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
416
|
+
width: size,
|
|
417
|
+
height: size,
|
|
418
|
+
viewBox: "0 0 24 24",
|
|
419
|
+
fill: "none",
|
|
420
|
+
stroke: color,
|
|
421
|
+
strokeWidth: "2",
|
|
422
|
+
strokeLinecap: "round",
|
|
423
|
+
strokeLinejoin: "round"
|
|
424
|
+
}, rest), /*#__PURE__*/React__default.createElement("polyline", {
|
|
425
|
+
points: "3 6 5 6 21 6"
|
|
426
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
427
|
+
d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"
|
|
428
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
429
|
+
x1: "10",
|
|
430
|
+
y1: "11",
|
|
431
|
+
x2: "10",
|
|
432
|
+
y2: "17"
|
|
433
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
434
|
+
x1: "14",
|
|
435
|
+
y1: "11",
|
|
436
|
+
x2: "14",
|
|
437
|
+
y2: "17"
|
|
438
|
+
}));
|
|
439
|
+
});
|
|
440
|
+
Trash2.propTypes = {
|
|
441
|
+
color: PropTypes.string,
|
|
442
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
443
|
+
};
|
|
444
|
+
Trash2.displayName = 'Trash2';
|
|
445
|
+
|
|
446
|
+
const BooleanInput = ({ onChange, value, readOnly, className, errorDisplayed }) => {
|
|
176
447
|
const handleClick = (value) => {
|
|
177
448
|
if (!readOnly) {
|
|
178
449
|
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
179
450
|
}
|
|
180
451
|
};
|
|
181
|
-
let
|
|
452
|
+
let classes = classNames("mrf-content_switch", className, {
|
|
182
453
|
"mrf-content_switch_button_on": !!value,
|
|
183
454
|
"mrf-content_switch_button_off": !value && value !== null,
|
|
184
455
|
"mrf-content_switch_button_null": value === null,
|
|
185
456
|
"mrf-cursor_pointer": !readOnly,
|
|
186
457
|
"mrf-cursor_not_allowed": readOnly,
|
|
458
|
+
"mrf-input__invalid": !!errorDisplayed
|
|
187
459
|
});
|
|
188
460
|
let callback = () => handleClick(true);
|
|
189
461
|
if (!!value) {
|
|
190
462
|
callback = () => handleClick(false);
|
|
191
463
|
}
|
|
192
|
-
return React__default.createElement("input", { type: "checkbox", className:
|
|
464
|
+
return React__default.createElement("input", { type: "checkbox", className: classes, onChange: callback });
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
468
|
+
|
|
469
|
+
function _objectWithoutProperties$2(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$2(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
470
|
+
|
|
471
|
+
function _objectWithoutPropertiesLoose$2(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
472
|
+
var EyeOff = forwardRef(function (_ref, ref) {
|
|
473
|
+
var _ref$color = _ref.color,
|
|
474
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
475
|
+
_ref$size = _ref.size,
|
|
476
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
477
|
+
rest = _objectWithoutProperties$2(_ref, ["color", "size"]);
|
|
478
|
+
|
|
479
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$2({
|
|
480
|
+
ref: ref,
|
|
481
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
482
|
+
width: size,
|
|
483
|
+
height: size,
|
|
484
|
+
viewBox: "0 0 24 24",
|
|
485
|
+
fill: "none",
|
|
486
|
+
stroke: color,
|
|
487
|
+
strokeWidth: "2",
|
|
488
|
+
strokeLinecap: "round",
|
|
489
|
+
strokeLinejoin: "round"
|
|
490
|
+
}, rest), /*#__PURE__*/React__default.createElement("path", {
|
|
491
|
+
d: "M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"
|
|
492
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
493
|
+
x1: "1",
|
|
494
|
+
y1: "1",
|
|
495
|
+
x2: "23",
|
|
496
|
+
y2: "23"
|
|
497
|
+
}));
|
|
193
498
|
});
|
|
499
|
+
EyeOff.propTypes = {
|
|
500
|
+
color: PropTypes.string,
|
|
501
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
502
|
+
};
|
|
503
|
+
EyeOff.displayName = 'EyeOff';
|
|
504
|
+
|
|
505
|
+
function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
506
|
+
|
|
507
|
+
function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
508
|
+
|
|
509
|
+
function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
510
|
+
var Eye = forwardRef(function (_ref, ref) {
|
|
511
|
+
var _ref$color = _ref.color,
|
|
512
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
513
|
+
_ref$size = _ref.size,
|
|
514
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
515
|
+
rest = _objectWithoutProperties$1(_ref, ["color", "size"]);
|
|
516
|
+
|
|
517
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends$1({
|
|
518
|
+
ref: ref,
|
|
519
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
520
|
+
width: size,
|
|
521
|
+
height: size,
|
|
522
|
+
viewBox: "0 0 24 24",
|
|
523
|
+
fill: "none",
|
|
524
|
+
stroke: color,
|
|
525
|
+
strokeWidth: "2",
|
|
526
|
+
strokeLinecap: "round",
|
|
527
|
+
strokeLinejoin: "round"
|
|
528
|
+
}, rest), /*#__PURE__*/React__default.createElement("path", {
|
|
529
|
+
d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"
|
|
530
|
+
}), /*#__PURE__*/React__default.createElement("circle", {
|
|
531
|
+
cx: "12",
|
|
532
|
+
cy: "12",
|
|
533
|
+
r: "3"
|
|
534
|
+
}));
|
|
535
|
+
});
|
|
536
|
+
Eye.propTypes = {
|
|
537
|
+
color: PropTypes.string,
|
|
538
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
539
|
+
};
|
|
540
|
+
Eye.displayName = 'Eye';
|
|
194
541
|
|
|
195
542
|
const Collapse = (props) => {
|
|
196
543
|
const [collapsed, setCollapsed] = useState(props.initCollapsed || props.collapsed);
|
|
@@ -340,12 +687,14 @@ const SelectInput = (props) => {
|
|
|
340
687
|
}
|
|
341
688
|
const possibleValues = (props.possibleValues || [])
|
|
342
689
|
.map(v => transformOption(v));
|
|
343
|
-
const [loading, setLoading] = useState(
|
|
690
|
+
const [loading, setLoading] = useState(true);
|
|
344
691
|
const [values, setValues] = useState(possibleValues);
|
|
345
|
-
const [value, setValue] = useState(
|
|
692
|
+
const [value, setValue] = useState();
|
|
346
693
|
useEffect(() => {
|
|
347
|
-
|
|
348
|
-
|
|
694
|
+
if (!loading && values.length) {
|
|
695
|
+
setValue(valueToSelectOption(props.value || props.defaultValue, values, props.isMulti));
|
|
696
|
+
}
|
|
697
|
+
}, [props.value, values, props.defaultValue, loading]);
|
|
349
698
|
useEffect(() => {
|
|
350
699
|
if (props.optionsFrom) {
|
|
351
700
|
const cond = option(props.fetchCondition)
|
|
@@ -365,9 +714,7 @@ const SelectInput = (props) => {
|
|
|
365
714
|
promise = props.httpClient(props.optionsFrom, 'GET').then(r => r.json());
|
|
366
715
|
}
|
|
367
716
|
promise
|
|
368
|
-
.then((values) =>
|
|
369
|
-
return values.map(x => transformOption(x));
|
|
370
|
-
})
|
|
717
|
+
.then((values) => values.map(x => transformOption(x)))
|
|
371
718
|
.then((values) => {
|
|
372
719
|
setValues(values);
|
|
373
720
|
setValue(values.find((item) => {
|
|
@@ -385,6 +732,7 @@ const SelectInput = (props) => {
|
|
|
385
732
|
else {
|
|
386
733
|
setValues((props.possibleValues || [])
|
|
387
734
|
.map(v => transformOption(v)));
|
|
735
|
+
setTimeout(() => setLoading(false), 250);
|
|
388
736
|
}
|
|
389
737
|
}, [props.optionsFrom, props.possibleValues]);
|
|
390
738
|
const onChange = (changes) => {
|
|
@@ -429,13 +777,58 @@ const SelectInput = (props) => {
|
|
|
429
777
|
})));
|
|
430
778
|
}
|
|
431
779
|
if (props.createOption) {
|
|
432
|
-
return (React__default.createElement(CreatableSelect, Object.assign({}, props, { name: `${props.label}-search`, isLoading: loading, value: value, isDisabled: props.disabled, placeholder: props.placeholder, onChange: onChange, options: values, onCreateOption: option => handleCreate(option, props.onCreateOption), classNamePrefix: "react-form-select", className: props.className })));
|
|
780
|
+
return (React__default.createElement(CreatableSelect, Object.assign({}, props, { name: `${props.label}-search`, isLoading: loading, value: value, isDisabled: loading || props.disabled, placeholder: props.placeholder, onChange: onChange, options: values, onCreateOption: option => handleCreate(option, props.onCreateOption), classNamePrefix: "react-form-select", className: props.className })));
|
|
433
781
|
}
|
|
434
782
|
else {
|
|
435
|
-
return (React__default.createElement(Select, Object.assign({}, props, { name: `${props.label}-search`, isLoading: loading, value: value, defaultValue: value, isDisabled: props.disabled, placeholder: props.placeholder, options: values, onChange: onChange, classNamePrefix: "react-form-select", className: props.className })));
|
|
783
|
+
return (React__default.createElement(Select, Object.assign({}, props, { name: `${props.label}-search`, isLoading: loading, value: value, defaultValue: value, isDisabled: loading || props.disabled, placeholder: props.placeholder, options: values, onChange: onChange, classNamePrefix: "react-form-select", className: props.className })));
|
|
436
784
|
}
|
|
437
785
|
};
|
|
438
786
|
|
|
787
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
788
|
+
|
|
789
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
790
|
+
|
|
791
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
792
|
+
var PlusCircle = forwardRef(function (_ref, ref) {
|
|
793
|
+
var _ref$color = _ref.color,
|
|
794
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
795
|
+
_ref$size = _ref.size,
|
|
796
|
+
size = _ref$size === void 0 ? 24 : _ref$size,
|
|
797
|
+
rest = _objectWithoutProperties(_ref, ["color", "size"]);
|
|
798
|
+
|
|
799
|
+
return /*#__PURE__*/React__default.createElement("svg", _extends({
|
|
800
|
+
ref: ref,
|
|
801
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
802
|
+
width: size,
|
|
803
|
+
height: size,
|
|
804
|
+
viewBox: "0 0 24 24",
|
|
805
|
+
fill: "none",
|
|
806
|
+
stroke: color,
|
|
807
|
+
strokeWidth: "2",
|
|
808
|
+
strokeLinecap: "round",
|
|
809
|
+
strokeLinejoin: "round"
|
|
810
|
+
}, rest), /*#__PURE__*/React__default.createElement("circle", {
|
|
811
|
+
cx: "12",
|
|
812
|
+
cy: "12",
|
|
813
|
+
r: "10"
|
|
814
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
815
|
+
x1: "12",
|
|
816
|
+
y1: "8",
|
|
817
|
+
x2: "12",
|
|
818
|
+
y2: "16"
|
|
819
|
+
}), /*#__PURE__*/React__default.createElement("line", {
|
|
820
|
+
x1: "8",
|
|
821
|
+
y1: "12",
|
|
822
|
+
x2: "16",
|
|
823
|
+
y2: "12"
|
|
824
|
+
}));
|
|
825
|
+
});
|
|
826
|
+
PlusCircle.propTypes = {
|
|
827
|
+
color: PropTypes.string,
|
|
828
|
+
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
|
829
|
+
};
|
|
830
|
+
PlusCircle.displayName = 'PlusCircle';
|
|
831
|
+
|
|
439
832
|
const ObjectInput = (props) => {
|
|
440
833
|
const [internalState, setInternalState] = useState({});
|
|
441
834
|
useEffect(() => {
|
|
@@ -495,7 +888,7 @@ const ObjectInput = (props) => {
|
|
|
495
888
|
React.createElement("input", { disabled: props.disabled, type: "text", className: 'mrf-w_50 mrf-input', placeholder: props.placeholderKey, value: key, onChange: e => changeKey(id, e.target.value) }),
|
|
496
889
|
React.createElement("input", { disabled: props.disabled, type: "text", className: 'mrf-w_50 mrf-input', placeholder: props.placeholderValue, value: value, onChange: e => changeValue(id, e.target.value) }),
|
|
497
890
|
React.createElement("button", { disabled: props.disabled, type: "button", className: 'mrf-flex mrf-btn mrf-btn_red mrf-btn_sm mrf-ml_10', onClick: () => remove(id) },
|
|
498
|
-
React.createElement(
|
|
891
|
+
React.createElement(PlusCircle, null)),
|
|
499
892
|
idx === Object.keys(internalState).length - 1 && (React.createElement("button", { disabled: props.disabled, type: "button", className: 'mrf-flex mrf-btn mrf-btn_blue mrf-btn_sm mrf-ml_5', onClick: addNext },
|
|
500
893
|
React.createElement(PlusCircle, null))))))));
|
|
501
894
|
};
|
|
@@ -27638,7 +28031,7 @@ function CodeInput({ onChange, value, mode = 'javascript', tabSize = 2, readOnly
|
|
|
27638
28031
|
width: '-1',
|
|
27639
28032
|
minWidth: '-1',
|
|
27640
28033
|
maxWidth: '-1',
|
|
27641
|
-
}, setRef }) {
|
|
28034
|
+
}, className, setRef }) {
|
|
27642
28035
|
const ref = useRef();
|
|
27643
28036
|
const [editor, setEditor] = useState();
|
|
27644
28037
|
useEffect(() => {
|
|
@@ -27668,7 +28061,7 @@ function CodeInput({ onChange, value, mode = 'javascript', tabSize = 2, readOnly
|
|
|
27668
28061
|
});
|
|
27669
28062
|
}
|
|
27670
28063
|
}, [value]);
|
|
27671
|
-
return React__default.createElement("div", { ref: ref });
|
|
28064
|
+
return React__default.createElement("div", { className: className, ref: ref });
|
|
27672
28065
|
}
|
|
27673
28066
|
|
|
27674
28067
|
const converter = new showdown.Converter({
|
|
@@ -27903,7 +28296,7 @@ const getShapeAndDependencies = (flow, schema, dependencies = [], rawData = {})
|
|
|
27903
28296
|
|
|
27904
28297
|
const CustomizableInput$1 = React.memo((props) => {
|
|
27905
28298
|
if (props.render) {
|
|
27906
|
-
return (props.render(Object.assign(Object.assign({}, props.field), { error: props.error })));
|
|
28299
|
+
return (props.render(Object.assign(Object.assign({}, props.field), { error: props.error, informations: props.informations })));
|
|
27907
28300
|
}
|
|
27908
28301
|
return props.children;
|
|
27909
28302
|
}, (prev, next) => {
|
|
@@ -27913,15 +28306,16 @@ const CustomizableInput$1 = React.memo((props) => {
|
|
|
27913
28306
|
return (prev.field.value === next.field.value && next.errorDisplayed === prev.errorDisplayed && cleanHash(next.step) === cleanHash(prev.step));
|
|
27914
28307
|
});
|
|
27915
28308
|
const ControlledInput = (inputProps) => {
|
|
27916
|
-
const { step, entry, children, component, errorDisplayed = false } = inputProps;
|
|
28309
|
+
const { step, entry, children, component, errorDisplayed = false, informations } = inputProps;
|
|
27917
28310
|
const { field } = useController({
|
|
27918
28311
|
defaultValue: isDefined(step.defaultValue) ? step.defaultValue : null,
|
|
27919
28312
|
name: entry
|
|
27920
28313
|
});
|
|
27921
28314
|
const { getValues, setValue, formState: { errors } } = useFormContext();
|
|
28315
|
+
const error = entry.split('.').reduce((acc, curr) => acc && acc[curr], errors);
|
|
27922
28316
|
const functionalProperty = (entry, prop) => {
|
|
27923
28317
|
if (typeof prop === 'function') {
|
|
27924
|
-
return prop({ rawValues: getValues(), value: getValues(entry) });
|
|
28318
|
+
return prop({ rawValues: getValues(), value: getValues(entry), informations, error, getValue: (key) => getValues(key) });
|
|
27925
28319
|
}
|
|
27926
28320
|
else {
|
|
27927
28321
|
return prop;
|
|
@@ -27949,8 +28343,7 @@ const ControlledInput = (inputProps) => {
|
|
|
27949
28343
|
option(step.onChange)
|
|
27950
28344
|
.map(onChange => onChange({ rawValues: getValues(), value, setValue }));
|
|
27951
28345
|
}, value: field.value });
|
|
27952
|
-
|
|
27953
|
-
return React.createElement(CustomizableInput$1, { render: step.render, step: step, field: Object.assign({ parent, setValue: (key, value) => setValue(key, value), rawValues: getValues() }, field), error: error, errorDisplayed: errorDisplayed }, component ? component(field, props) : React.cloneElement(children, Object.assign({}, props)));
|
|
28346
|
+
return React.createElement(CustomizableInput$1, { render: step.render, step: step, field: Object.assign({ setValue: (key, value) => setValue(key, value), rawValues: getValues(), getValue: (key) => getValues(key) }, field), error: error, errorDisplayed: errorDisplayed, informations: informations }, component ? component(field, props) : React.cloneElement(children, Object.assign({}, props)));
|
|
27954
28347
|
};
|
|
27955
28348
|
|
|
27956
28349
|
const usePrevious = (value) => {
|
|
@@ -27964,36 +28357,22 @@ const usePrevious = (value) => {
|
|
|
27964
28357
|
// Return previous value (happens before update in useEffect above)
|
|
27965
28358
|
return ref.current;
|
|
27966
28359
|
};
|
|
27967
|
-
const BasicWrapper = ({ entry, children, render, functionalProperty, step }) => {
|
|
27968
|
-
const { formState
|
|
28360
|
+
const BasicWrapper = ({ entry, children, render, functionalProperty, step, informations }) => {
|
|
28361
|
+
const { formState } = useFormContext();
|
|
27969
28362
|
if (typeof entry === 'object') {
|
|
27970
28363
|
return children;
|
|
27971
28364
|
}
|
|
27972
|
-
const visibleStep = option(step)
|
|
27973
|
-
.map(s => s.visible)
|
|
27974
|
-
.map(visible => {
|
|
27975
|
-
let value;
|
|
27976
|
-
switch (typeof visible) {
|
|
27977
|
-
case 'object':
|
|
27978
|
-
value = watch(visible.ref);
|
|
27979
|
-
return option(visible.test).map(test => test(value)).getOrElse(value);
|
|
27980
|
-
case 'boolean':
|
|
27981
|
-
return visible;
|
|
27982
|
-
default:
|
|
27983
|
-
return true;
|
|
27984
|
-
}
|
|
27985
|
-
})
|
|
27986
|
-
.getOrElse(true);
|
|
27987
|
-
if (!visibleStep) {
|
|
27988
|
-
return null;
|
|
27989
|
-
}
|
|
27990
|
-
const computedLabel = functionalProperty(entry, (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry);
|
|
27991
|
-
const id = v4();
|
|
27992
28365
|
// FIXME not sure it works as intended with more two or more parts
|
|
27993
28366
|
const error = entry.split('.').reduce((acc, curr) => acc && acc[curr], formState.errors);
|
|
27994
28367
|
const isDirty = entry.split('.').reduce((acc, curr) => acc && acc[curr], formState.dirtyFields);
|
|
27995
28368
|
const isTouched = entry.split('.').reduce((acc, curr) => acc && acc[curr], formState.touchedFields);
|
|
27996
28369
|
const errorDisplayed = formState.isSubmitted || isDirty || isTouched;
|
|
28370
|
+
const visibleStep = functionalProperty(entry, (step === null || step === void 0 ? void 0 : step.visible) === undefined ? true : step.visible, informations, error);
|
|
28371
|
+
if (!visibleStep) {
|
|
28372
|
+
return null;
|
|
28373
|
+
}
|
|
28374
|
+
const computedLabel = functionalProperty(entry, (step === null || step === void 0 ? void 0 : step.label) === null ? null : (step === null || step === void 0 ? void 0 : step.label) || entry, informations);
|
|
28375
|
+
const id = v4();
|
|
27997
28376
|
if (render) {
|
|
27998
28377
|
return render({ entry, label: computedLabel, error, help: step === null || step === void 0 ? void 0 : step.help, children });
|
|
27999
28378
|
}
|
|
@@ -28009,7 +28388,7 @@ const BasicWrapper = ({ entry, children, render, functionalProperty, step }) =>
|
|
|
28009
28388
|
};
|
|
28010
28389
|
const CustomizableInput = (props) => {
|
|
28011
28390
|
if (props.render) {
|
|
28012
|
-
return (props.render(Object.assign(Object.assign({}, props
|
|
28391
|
+
return (props.render(Object.assign(Object.assign({}, props), { error: props.error })));
|
|
28013
28392
|
}
|
|
28014
28393
|
return props.children;
|
|
28015
28394
|
};
|
|
@@ -28170,7 +28549,7 @@ const Form = React__default.forwardRef(function Form({ schema, flow, value, inpu
|
|
|
28170
28549
|
// reset(cleanInputArray(value, defaultValues, flow, schema))
|
|
28171
28550
|
// setReset(true)
|
|
28172
28551
|
// }, [reset])
|
|
28173
|
-
const { handleSubmit,
|
|
28552
|
+
const { handleSubmit, reset, trigger, getValues } = methods;
|
|
28174
28553
|
useEffect(() => {
|
|
28175
28554
|
if (!!options.showErrorsOnStart) {
|
|
28176
28555
|
trigger();
|
|
@@ -28179,9 +28558,9 @@ const Form = React__default.forwardRef(function Form({ schema, flow, value, inpu
|
|
|
28179
28558
|
useHashEffect(() => {
|
|
28180
28559
|
reset(Object.assign({}, cleanInputArray(value, defaultValues, flow, schema)));
|
|
28181
28560
|
}, [value, schema]);
|
|
28182
|
-
const functionalProperty = (entry, prop) => {
|
|
28561
|
+
const functionalProperty = (entry, prop, informations, error) => {
|
|
28183
28562
|
if (typeof prop === 'function') {
|
|
28184
|
-
return prop({ rawValues: getValues(), value: getValues(entry)
|
|
28563
|
+
return prop({ rawValues: getValues(), value: getValues(entry), informations, getValue: (key) => getValues(key), error });
|
|
28185
28564
|
}
|
|
28186
28565
|
else {
|
|
28187
28566
|
return prop;
|
|
@@ -28202,13 +28581,17 @@ const Form = React__default.forwardRef(function Form({ schema, flow, value, inpu
|
|
|
28202
28581
|
onSubmit(clean);
|
|
28203
28582
|
}, onError) },
|
|
28204
28583
|
formFlow.map((entry, idx) => {
|
|
28205
|
-
|
|
28584
|
+
if (typeof entry === 'object') {
|
|
28585
|
+
return (React__default.createElement(CollapsedStep, { key: idx, entry: entry, schema: schema, inputWrapper: inputWrapper, httpClient: maybeCustomHttpClient, functionalProperty: functionalProperty }));
|
|
28586
|
+
}
|
|
28587
|
+
const step = schema[entry];
|
|
28206
28588
|
if (!step && typeof entry === 'string') {
|
|
28207
28589
|
console.error(`no step found for the entry "${entry}" in the given schema. Your form might not work properly. Please fix it`);
|
|
28208
28590
|
return null;
|
|
28209
28591
|
}
|
|
28210
|
-
|
|
28211
|
-
|
|
28592
|
+
const informations = { path: entry };
|
|
28593
|
+
return (React__default.createElement(BasicWrapper, { key: `${entry}-${idx}`, entry: entry, functionalProperty: functionalProperty, render: inputWrapper, step: step, informations: informations },
|
|
28594
|
+
React__default.createElement(Step, { key: idx, entry: entry, step: step, schema: schema, inputWrapper: inputWrapper, httpClient: maybeCustomHttpClient, functionalProperty: functionalProperty, informations: informations })));
|
|
28212
28595
|
}),
|
|
28213
28596
|
React__default.createElement(Footer, { render: footer, reset: () => reset(defaultValues), valid: handleSubmit(data => onSubmit(cleanOutputArray(data, schema)), onError), actions: options.actions }))));
|
|
28214
28597
|
});
|
|
@@ -28223,26 +28606,32 @@ const Footer = (props) => {
|
|
|
28223
28606
|
((_k = (_j = props.actions) === null || _j === void 0 ? void 0 : _j.reset) === null || _k === void 0 ? void 0 : _k.display) && React__default.createElement("button", { className: 'mrf-btn mrf-btn_red', type: "button", onClick: props.reset }, ((_m = (_l = props.actions) === null || _l === void 0 ? void 0 : _l.reset) === null || _m === void 0 ? void 0 : _m.label) || 'Reset'),
|
|
28224
28607
|
isSubmitDisplayed && React__default.createElement("button", { className: 'mrf-btn mrf-btn_green mrf-ml_10', type: "submit" }, ((_p = (_o = props.actions) === null || _o === void 0 ? void 0 : _o.submit) === null || _p === void 0 ? void 0 : _p.label) || 'Save')));
|
|
28225
28608
|
};
|
|
28609
|
+
const CollapsedStep = (props) => {
|
|
28610
|
+
let { entry, schema, inputWrapper, httpClient, functionalProperty } = props;
|
|
28611
|
+
const { formState: { errors, dirtyFields, touchedFields } } = useFormContext();
|
|
28612
|
+
const errored = extractFlowString(entry).some(step => !!errors[step] && (dirtyFields[step] || touchedFields[step]));
|
|
28613
|
+
//FIXME: get collapse errors
|
|
28614
|
+
return (React__default.createElement(Collapse, Object.assign({}, entry, { errored: errored }), entry.flow.map((en, entryIdx) => {
|
|
28615
|
+
if (typeof en === 'object') {
|
|
28616
|
+
return (React__default.createElement(CollapsedStep, Object.assign({ key: entryIdx }, props, { entry: en })));
|
|
28617
|
+
}
|
|
28618
|
+
const stp = schema[en];
|
|
28619
|
+
if (!stp && typeof en === 'string') {
|
|
28620
|
+
console.error(`no step found for the entry "${en}" in the given schema. Your form might not work properly. Please fix it`);
|
|
28621
|
+
return null;
|
|
28622
|
+
}
|
|
28623
|
+
const informations = { path: en };
|
|
28624
|
+
return (React__default.createElement(BasicWrapper, { key: `collapse-${en}-${entryIdx}`, entry: en, functionalProperty: functionalProperty, step: stp, render: inputWrapper, informations: informations },
|
|
28625
|
+
React__default.createElement(Step, { entry: en, step: stp, schema: schema, inputWrapper: inputWrapper, httpClient: httpClient, defaultValue: stp === null || stp === void 0 ? void 0 : stp.defaultValue, functionalProperty: functionalProperty, informations: informations })));
|
|
28626
|
+
})));
|
|
28627
|
+
};
|
|
28226
28628
|
const Step = (props) => {
|
|
28227
|
-
let { entry, realEntry, step, schema, inputWrapper, httpClient, defaultValue, index, functionalProperty,
|
|
28629
|
+
let { entry, realEntry, step, schema, inputWrapper, httpClient, defaultValue, index, functionalProperty, informations } = props;
|
|
28228
28630
|
const { formState: { errors, dirtyFields, touchedFields, isSubmitted }, control, getValues, setValue, watch } = useFormContext();
|
|
28229
|
-
if (entry && typeof entry === 'object') {
|
|
28230
|
-
const errored = extractFlowString(entry).some(step => !!errors[step] && (dirtyFields[step] || touchedFields[step]));
|
|
28231
|
-
return (React__default.createElement(Collapse, Object.assign({}, entry, { errored: errored }), entry.flow.map((en, entryIdx) => {
|
|
28232
|
-
const stp = typeof en === "object" ? undefined : schema[en]; // TODO Factorise this logic
|
|
28233
|
-
if (!stp && typeof en === 'string') {
|
|
28234
|
-
console.error(`no step found for the entry "${en}" in the given schema. Your form might not work properly. Please fix it`);
|
|
28235
|
-
return null;
|
|
28236
|
-
}
|
|
28237
|
-
return (React__default.createElement(BasicWrapper, { key: `collapse-${en}-${entryIdx}`, entry: en, functionalProperty: functionalProperty, step: stp, render: inputWrapper },
|
|
28238
|
-
React__default.createElement(Step, { entry: en, step: stp, schema: schema, inputWrapper: inputWrapper, httpClient: httpClient, defaultValue: stp === null || stp === void 0 ? void 0 : stp.defaultValue, functionalProperty: functionalProperty, parentInformations: parentInformations })));
|
|
28239
|
-
})));
|
|
28240
|
-
}
|
|
28241
28631
|
const error = entry.split('.').reduce((acc, curr) => acc && acc[curr], errors);
|
|
28242
28632
|
const isDirty = entry.split('.').reduce((acc, curr) => acc && acc[curr], dirtyFields);
|
|
28243
28633
|
const isTouched = entry.split('.').reduce((acc, curr) => acc && acc[curr], touchedFields);
|
|
28244
28634
|
const errorDisplayed = (!!error && (isSubmitted || isDirty || isTouched));
|
|
28245
|
-
const informations = { path: entry, parent: parentInformations, index };
|
|
28246
28635
|
step = step;
|
|
28247
28636
|
if (step.onAfterChange) {
|
|
28248
28637
|
const data = watch();
|
|
@@ -28265,64 +28654,60 @@ const Step = (props) => {
|
|
|
28265
28654
|
});
|
|
28266
28655
|
}
|
|
28267
28656
|
if (step.array) {
|
|
28268
|
-
return (React__default.createElement(CustomizableInput, { render: step.render,
|
|
28269
|
-
|
|
28270
|
-
}, error: !!error },
|
|
28271
|
-
React__default.createElement(ArrayStep, { entry: entry, step: step, disabled: functionalProperty(entry, step.disabled || false), component: ((props, idx) => {
|
|
28657
|
+
return (React__default.createElement(CustomizableInput, { render: step.render, rawValues: getValues(), value: getValues(entry), onChange: (v) => setValue(entry, v), setValue: (key, value) => setValue(key, value), getValue: (key) => getValues(key), informations: informations, error: !!error },
|
|
28658
|
+
React__default.createElement(ArrayStep, { entry: entry, step: step, disabled: functionalProperty(entry, step.disabled || false, informations, error), component: ((props, idx) => {
|
|
28272
28659
|
var _a;
|
|
28273
|
-
return (React__default.createElement(Step, { entry: `${entry}.${idx}.value`, step: Object.assign(Object.assign({}, (schema[realEntry || entry])), { render: step.itemRender, onChange: undefined, array: false, onAfterChange: step.onAfterChange }), schema: schema, inputWrapper: inputWrapper, httpClient: httpClient, defaultValue: (_a = props.defaultValue) === null || _a === void 0 ? void 0 : _a.value, index: idx, functionalProperty: functionalProperty,
|
|
28660
|
+
return (React__default.createElement(Step, { entry: `${entry}.${idx}.value`, step: Object.assign(Object.assign({}, (schema[realEntry || entry])), { render: step.itemRender, onChange: undefined, array: false, onAfterChange: step.onAfterChange }), schema: schema, inputWrapper: inputWrapper, httpClient: httpClient, defaultValue: (_a = props.defaultValue) === null || _a === void 0 ? void 0 : _a.value, index: idx, functionalProperty: functionalProperty, informations: { path: entry, parent: informations, index: idx } }));
|
|
28274
28661
|
}) })));
|
|
28275
28662
|
}
|
|
28276
28663
|
switch (step.type) {
|
|
28277
28664
|
case type.string:
|
|
28278
28665
|
switch (step.format) {
|
|
28279
28666
|
case format.text:
|
|
28280
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28667
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28281
28668
|
React__default.createElement("textarea", { className: classNames('mrf-input', step.className, { 'mrf-mrf-input__invalid': !!errorDisplayed }) })));
|
|
28282
28669
|
case format.code:
|
|
28283
28670
|
case format.singleLineCode:
|
|
28284
28671
|
const Component = step.format === format.code ? CodeInput : SingleLineCode;
|
|
28285
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28286
|
-
React__default.createElement(Component
|
|
28672
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28673
|
+
React__default.createElement(Component, { className: classNames(step === null || step === void 0 ? void 0 : step.className, { 'mrf-input__invalid': !!error }) })));
|
|
28287
28674
|
case format.markdown:
|
|
28288
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28675
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28289
28676
|
React__default.createElement(MarkdownInput, { className: classNames(step.className, { 'mrf-input__invalid': !!errorDisplayed }) })));
|
|
28290
28677
|
case format.buttonsSelect:
|
|
28291
28678
|
case format.select: {
|
|
28292
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28293
|
-
React__default.createElement(SelectInput, Object.assign({ className: classNames('mrf-flex_grow_1', step.className, { 'mrf-input__invalid': !!errorDisplayed }), disabled: functionalProperty(entry, step.disabled || false) }, step.props, { possibleValues: step.options, httpClient: httpClient, isMulti: step.isMulti, createOption: step.createOption, onCreateOption: step.onCreateOption, transformer: step.transformer, buttons: step.format === format.buttonsSelect, optionsFrom: step.optionsFrom }))));
|
|
28679
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28680
|
+
React__default.createElement(SelectInput, Object.assign({ className: classNames('mrf-flex_grow_1', step.className, { 'mrf-input__invalid': !!errorDisplayed }), disabled: functionalProperty(entry, step.disabled || false, informations, error) }, step.props, { possibleValues: step.options, httpClient: httpClient, isMulti: step.isMulti, createOption: step.createOption, onCreateOption: step.onCreateOption, transformer: step.transformer, buttons: step.format === format.buttonsSelect, optionsFrom: step.optionsFrom }))));
|
|
28294
28681
|
}
|
|
28295
28682
|
default:
|
|
28296
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28683
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28297
28684
|
React__default.createElement("input", { type: step.format || 'text', className: classNames('mrf-input', step.className, { 'mrf-input__invalid': !!errorDisplayed }) })));
|
|
28298
28685
|
}
|
|
28299
28686
|
case type.number:
|
|
28300
28687
|
switch (step.format) {
|
|
28301
28688
|
case format.buttonsSelect:
|
|
28302
28689
|
case format.select:
|
|
28303
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28690
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28304
28691
|
React__default.createElement(SelectInput, Object.assign({ className: classNames('mrf-content', step.className, { 'mrf-input__invalid': !!errorDisplayed }) }, step.props, { possibleValues: step.options, httpClient: httpClient, isMulti: step.isMulti, createOption: step.createOption, onCreateOption: step.onCreateOption, transformer: step.transformer, buttons: step.format === format.buttonsSelect, optionsFrom: step.optionsFrom }))));
|
|
28305
28692
|
default:
|
|
28306
|
-
return React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28693
|
+
return React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28307
28694
|
React__default.createElement("input", { type: step.format || 'number', className: classNames('mrf-input', step.className, { 'mrf-input__invalid': !!errorDisplayed }) }));
|
|
28308
28695
|
}
|
|
28309
28696
|
case type.bool:
|
|
28310
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28311
|
-
React__default.createElement(BooleanInput
|
|
28697
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28698
|
+
React__default.createElement(BooleanInput, { className: step.className, errorDisplayed: errorDisplayed })));
|
|
28312
28699
|
case type.object:
|
|
28313
28700
|
switch (step.format) {
|
|
28314
28701
|
case format.buttonsSelect:
|
|
28315
28702
|
case format.select:
|
|
28316
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28703
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28317
28704
|
React__default.createElement(SelectInput, Object.assign({ className: classNames('mrf-flex_grow_1', step.className, { 'mrf-input__invalid': !!errorDisplayed }) }, step.props, { possibleValues: step.options, httpClient: httpClient, isMulti: step.isMulti, createOption: step.createOption, onCreateOption: step.onCreateOption, transformer: step.transformer, buttons: step.format === format.buttonsSelect, optionsFrom: step.optionsFrom }))));
|
|
28318
28705
|
case format.form: //todo: disabled ?
|
|
28319
28706
|
const flow = option(step.flow).getOrElse(option(step.schema).map(s => Object.keys(s)).getOrElse([]));
|
|
28320
|
-
return (React__default.createElement(CustomizableInput, { render: step.render,
|
|
28707
|
+
return (React__default.createElement(CustomizableInput, { render: step.render, rawValues: getValues(), value: getValues(entry), onChange: (v) => setValue(entry, v, { shouldValidate: true }), setValue: (key, value) => setValue(key, value), getValue: (key) => getValues(key), informations: informations },
|
|
28321
28708
|
React__default.createElement(NestedForm, { schema: step.schema, flow: flow, step: step, parent: entry, inputWrapper: inputWrapper, maybeCustomHttpClient: httpClient, value: getValues(entry) || defaultValue, functionalProperty: functionalProperty, errorDisplayed: errorDisplayed, informations: informations })));
|
|
28322
28709
|
case format.code:
|
|
28323
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, component: (field, props) => (React__default.createElement(CodeInput, Object.assign({}, props, {
|
|
28324
|
-
/* TODO className={classNames(step.className, { 'mrf-input__invalid': !!error })}*/
|
|
28325
|
-
onChange: (e) => {
|
|
28710
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations, component: (field, props) => (React__default.createElement(CodeInput, Object.assign({}, props, { className: classNames(step === null || step === void 0 ? void 0 : step.className, { 'mrf-input__invalid': !!error }), onChange: (e) => {
|
|
28326
28711
|
let v;
|
|
28327
28712
|
try {
|
|
28328
28713
|
v = JSON.parse(e);
|
|
@@ -28335,12 +28720,28 @@ const Step = (props) => {
|
|
|
28335
28720
|
.map(onChange => onChange({ rawValues: getValues(), value: v, setValue }));
|
|
28336
28721
|
}, value: field.value === null ? null : ((typeof field.value === 'object') ? JSON.stringify(field.value, null, 2) : field.value) }))) }));
|
|
28337
28722
|
default:
|
|
28338
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28723
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28339
28724
|
React__default.createElement(ObjectInput, { className: classNames(step.className, { 'mrf-input__invalid': !!errorDisplayed }) })));
|
|
28340
28725
|
}
|
|
28341
28726
|
case type.date:
|
|
28342
|
-
|
|
28343
|
-
|
|
28727
|
+
switch (step.format) {
|
|
28728
|
+
case format.datetime:
|
|
28729
|
+
console.debug('datetime');
|
|
28730
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, informations: informations, component: (field) => {
|
|
28731
|
+
return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns },
|
|
28732
|
+
React__default.createElement(DateTimePicker, { value: field.value, onChange: field.onChange, renderInput: (params) => React__default.createElement(TextField, Object.assign({}, params)) })));
|
|
28733
|
+
} }));
|
|
28734
|
+
case format.time:
|
|
28735
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, informations: informations, component: (field) => {
|
|
28736
|
+
return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns },
|
|
28737
|
+
React__default.createElement(TimePicker, { value: field.value, onChange: field.onChange, renderInput: (params) => React__default.createElement(TextField, Object.assign({}, params)) })));
|
|
28738
|
+
} }));
|
|
28739
|
+
default:
|
|
28740
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, informations: informations, component: (field) => {
|
|
28741
|
+
return (React__default.createElement(LocalizationProvider, { dateAdapter: AdapterDateFns },
|
|
28742
|
+
React__default.createElement(DatePicker, { value: field.value, onChange: field.onChange, renderInput: (params) => React__default.createElement(TextField, Object.assign({}, params)) })));
|
|
28743
|
+
} }));
|
|
28744
|
+
}
|
|
28344
28745
|
case type.file:
|
|
28345
28746
|
return (React__default.createElement(Controller, { name: entry, control: control, render: ({ field }) => {
|
|
28346
28747
|
const FileInput = ({ onChange }) => {
|
|
@@ -28358,19 +28759,17 @@ const Step = (props) => {
|
|
|
28358
28759
|
const files = field.value || [];
|
|
28359
28760
|
return (React__default.createElement("div", { className: classNames('mrf-flex', 'mrf-ai_center', step === null || step === void 0 ? void 0 : step.className, { 'mrf-input__invalid': !!error }) },
|
|
28360
28761
|
React__default.createElement("input", { ref: (r) => setInput(r), type: "file", multiple: true, className: 'mrf-d_none', onChange: setFiles }),
|
|
28361
|
-
React__default.createElement("button", { type: "button", className: 'mrf-btn mrf-btn_sm mrf-flex mrf-ai_center', disabled: uploading || functionalProperty(entry, (step === null || step === void 0 ? void 0 : step.disabled) || false), onClick: trigger },
|
|
28762
|
+
React__default.createElement("button", { type: "button", className: 'mrf-btn mrf-btn_sm mrf-flex mrf-ai_center', disabled: uploading || functionalProperty(entry, (step === null || step === void 0 ? void 0 : step.disabled) || false, informations, error), onClick: trigger },
|
|
28362
28763
|
uploading && React__default.createElement(Loader, null),
|
|
28363
28764
|
!uploading && React__default.createElement(Upload, null),
|
|
28364
28765
|
React__default.createElement("span", { className: 'mrf-ml_5' }, "Select file(s)")),
|
|
28365
28766
|
React__default.createElement("span", { className: 'mrf-ml_5' }, files.length <= 0 ? 'No files selected' : files.map(r => r.name).join(" , "))));
|
|
28366
28767
|
};
|
|
28367
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed },
|
|
28768
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, errorDisplayed: errorDisplayed, informations: informations },
|
|
28368
28769
|
React__default.createElement(FileInput, null)));
|
|
28369
28770
|
} }));
|
|
28370
28771
|
case type.json:
|
|
28371
|
-
return (React__default.createElement(ControlledInput, { step: step, entry: entry, component: (field, props) => (React__default.createElement(CodeInput, Object.assign({}, props, {
|
|
28372
|
-
/* TODO className={classNames({ 'mrf-input__invalid': !!error })} */
|
|
28373
|
-
onChange: (v) => {
|
|
28772
|
+
return (React__default.createElement(ControlledInput, { step: step, entry: entry, informations: informations, component: (field, props) => (React__default.createElement(CodeInput, Object.assign({}, props, { className: classNames(step === null || step === void 0 ? void 0 : step.className, { 'mrf-input__invalid': !!error }), onChange: (v) => {
|
|
28374
28773
|
field.onChange(v);
|
|
28375
28774
|
option(step === null || step === void 0 ? void 0 : step.onChange)
|
|
28376
28775
|
.map(onChange => onChange({ rawValues: getValues(), value: v, setValue }));
|
|
@@ -28441,31 +28840,21 @@ const NestedForm = ({ schema, flow, parent, inputWrapper, maybeCustomHttpClient,
|
|
|
28441
28840
|
return [...acc, { step, entry }];
|
|
28442
28841
|
}, []);
|
|
28443
28842
|
const bordered = computedSandF.length >= 1 && step.label !== null;
|
|
28444
|
-
return (React__default.createElement("div", { className: classNames({ ['mrf-nestedform__border']: bordered, ['mrf-border__error']: !!errorDisplayed }), style: { position: 'relative' } },
|
|
28843
|
+
return (React__default.createElement("div", { className: classNames(step.className, { ['mrf-nestedform__border']: bordered, ['mrf-border__error']: !!errorDisplayed }), style: { position: 'relative' } },
|
|
28445
28844
|
!!step.collapsable && schemaAndFlow.flow.length > 1 && collapsed &&
|
|
28446
28845
|
React__default.createElement(ChevronDown, { size: 30, className: 'mrf-cursor_pointer', style: { position: 'absolute', top: -35, right: 0, zIndex: 100 }, strokeWidth: "2", onClick: () => setCollapsed(!collapsed) }),
|
|
28447
28846
|
!!step.collapsable && schemaAndFlow.flow.length > 1 && !collapsed &&
|
|
28448
28847
|
React__default.createElement(ChevronUp, { size: 30, className: 'mrf-cursor_pointer', style: { position: 'absolute', top: -35, right: 0, zIndex: 100 }, strokeWidth: "2", onClick: () => setCollapsed(!collapsed) }),
|
|
28449
28848
|
computedSandF.map(({ step, entry }, idx) => {
|
|
28849
|
+
if (typeof entry === 'object') {
|
|
28850
|
+
return (React__default.createElement(CollapsedStep, { key: idx, entry: entry, schema: schema, inputWrapper: inputWrapper, httpClient: maybeCustomHttpClient, functionalProperty: functionalProperty }));
|
|
28851
|
+
}
|
|
28450
28852
|
if (!step && typeof entry === 'string') {
|
|
28451
28853
|
console.error(`no step found for the entry "${entry}" in the given schema. Your form might not work properly. Please fix it`);
|
|
28452
28854
|
return null;
|
|
28453
28855
|
}
|
|
28454
|
-
|
|
28455
|
-
|
|
28456
|
-
return React__default.createElement(Collapse, Object.assign({}, entry, { errored: errored }), entry.flow.map((en, entryIdx) => {
|
|
28457
|
-
const stp = typeof en === "object" ? undefined : schema[en];
|
|
28458
|
-
if (!stp && typeof en === 'string') {
|
|
28459
|
-
console.error(`no step found for the entry "${en}" in the given schema. Your form might not work properly. Please fix it`);
|
|
28460
|
-
return null;
|
|
28461
|
-
}
|
|
28462
|
-
return (React__default.createElement(BasicWrapper, { key: `collapse-${en}-${entryIdx}`, entry: en, functionalProperty: functionalProperty, step: stp, render: inputWrapper },
|
|
28463
|
-
React__default.createElement(Step, { entry: en, step: stp, schema: schema, inputWrapper: inputWrapper, httpClient: maybeCustomHttpClient, defaultValue: stp === null || stp === void 0 ? void 0 : stp.defaultValue, functionalProperty: functionalProperty })));
|
|
28464
|
-
}));
|
|
28465
|
-
// TODO return collapse, then entry will always be a string in below return
|
|
28466
|
-
}
|
|
28467
|
-
return (React__default.createElement(BasicWrapper, { key: `${entry}.${idx}`, className: classNames({ ['mrf-display__none']: (collapsed && !step.visibleOnCollapse) }), entry: `${parent}.${entry}`, functionalProperty: functionalProperty, step: step, render: inputWrapper },
|
|
28468
|
-
React__default.createElement(Step, { key: `step.${entry}.${idx}`, entry: `${parent}.${entry}`, realEntry: entry, step: schemaAndFlow.schema[entry], parent: parent, schema: schemaAndFlow.schema, inputWrapper: inputWrapper, httpClient: maybeCustomHttpClient, defaultValue: value && value[entry], functionalProperty: functionalProperty, parentInformations: informations })));
|
|
28856
|
+
return (React__default.createElement(BasicWrapper, { key: `${entry}.${idx}`, className: classNames({ ['mrf-display__none']: (collapsed && !step.visibleOnCollapse) }), entry: `${parent}.${entry}`, functionalProperty: functionalProperty, step: step, render: inputWrapper, informations: { path: entry, parent: informations } },
|
|
28857
|
+
React__default.createElement(Step, { key: `step.${entry}.${idx}`, entry: `${parent}.${entry}`, realEntry: entry, step: schemaAndFlow.schema[entry], schema: schemaAndFlow.schema, inputWrapper: inputWrapper, httpClient: maybeCustomHttpClient, defaultValue: value && value[entry], functionalProperty: functionalProperty, informations: { path: entry, parent: informations } })));
|
|
28469
28858
|
})));
|
|
28470
28859
|
};
|
|
28471
28860
|
function extractFlowString(entry) {
|