@maif/react-forms 1.0.34 → 1.0.37-rc.1
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 +1 -1
- package/lib/esm/index.js +464 -576
- package/lib/index.js +463 -575
- package/package.json +7 -2
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -10
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -10
- package/.github/workflows/build-playground.yml +0 -34
- package/.github/workflows/generate-release-note.yml +0 -48
- package/.github/workflows/release.yml +0 -73
- package/docs/asset-manifest.json +0 -24
- package/docs/index.html +0 -1
- package/docs/manifest.json +0 -25
- package/docs/robots.txt +0 -3
- package/docs/static/css/2.6902daba.chunk.css +0 -11
- package/docs/static/css/2.6902daba.chunk.css.map +0 -1
- package/docs/static/css/main.8693c9f3.chunk.css +0 -2
- package/docs/static/css/main.8693c9f3.chunk.css.map +0 -1
- package/docs/static/js/2.ff0eab5d.chunk.js +0 -3
- package/docs/static/js/2.ff0eab5d.chunk.js.LICENSE.txt +0 -147
- package/docs/static/js/2.ff0eab5d.chunk.js.map +0 -1
- package/docs/static/js/main.88803e76.chunk.js +0 -2
- package/docs/static/js/main.88803e76.chunk.js.map +0 -1
- package/docs/static/js/runtime-main.368a22f5.js +0 -2
- package/docs/static/js/runtime-main.368a22f5.js.map +0 -1
- package/docs/static/media/fa-brands-400.2285773e.woff +0 -0
- package/docs/static/media/fa-brands-400.23f19bb0.eot +0 -0
- package/docs/static/media/fa-brands-400.2f517e09.svg +0 -3717
- package/docs/static/media/fa-brands-400.527940b1.ttf +0 -0
- package/docs/static/media/fa-brands-400.d878b0a6.woff2 +0 -0
- package/docs/static/media/fa-regular-400.4689f52c.svg +0 -801
- package/docs/static/media/fa-regular-400.491974d1.ttf +0 -0
- package/docs/static/media/fa-regular-400.77206a6b.eot +0 -0
- package/docs/static/media/fa-regular-400.7a333762.woff2 +0 -0
- package/docs/static/media/fa-regular-400.bb58e57c.woff +0 -0
- package/docs/static/media/fa-solid-900.1551f4f6.woff2 +0 -0
- package/docs/static/media/fa-solid-900.7a8b4f13.svg +0 -5034
- package/docs/static/media/fa-solid-900.9bbb245e.eot +0 -0
- package/docs/static/media/fa-solid-900.be9ee23c.ttf +0 -0
- package/docs/static/media/fa-solid-900.eeccf4f6.woff +0 -0
- package/examples/.env +0 -2
- package/examples/README.md +0 -0
- package/examples/package.json +0 -43
- package/examples/public/index.html +0 -43
- package/examples/public/manifest.json +0 -25
- package/examples/public/robots.txt +0 -3
- package/examples/src/App.css +0 -10
- package/examples/src/Playground.js +0 -192
- package/examples/src/WrapperError.js +0 -21
- package/examples/src/index.css +0 -13
- package/examples/src/index.js +0 -11
- package/examples/src/reportWebVitals.js +0 -13
- package/examples/src/schema/basic.json +0 -15
- package/examples/src/schema/constrainedBasic.json +0 -28
- package/examples/src/schema/constraintsWithRef.json +0 -44
- package/examples/src/schema/dynamicForm.json +0 -57
- package/examples/src/schema/formArray.js +0 -30
- package/examples/src/schema/formInForm.json +0 -39
- package/examples/src/schema/selector.json +0 -14
- package/jest-sync.config.json +0 -17
- package/rollup.config.js +0 -64
- package/scripts/build.sh +0 -34
- package/test/array.spec.js +0 -78
- package/test/bool.spec.js +0 -29
- package/test/date.spec.js +0 -41
- package/test/number.spec.js +0 -124
- package/test/object.spec.js +0 -14
- package/test/string.spec.js +0 -87
- package/test/testUtils.js +0 -30
- package/test-setup.js +0 -9
package/lib/esm/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import React, { useState, useEffect, useRef, useImperativeHandle } from 'react';
|
|
|
3
3
|
import { yupResolver } from '@hookform/resolvers/yup';
|
|
4
4
|
import classNames from 'classnames';
|
|
5
5
|
import { Eye, EyeOff, PlusCircle, MinusCircle, Trash2, ChevronDown, ChevronUp, HelpCircle, Loader, Upload } from 'react-feather';
|
|
6
|
-
import { useForm, FormProvider,
|
|
6
|
+
import { useController, useFormContext, useForm, FormProvider, Controller, useFieldArray, useWatch } from 'react-hook-form';
|
|
7
7
|
import { DatePicker } from 'react-rainbow-components';
|
|
8
8
|
import ReactToolTip from 'react-tooltip';
|
|
9
9
|
import { v4 } from 'uuid';
|
|
@@ -29,7 +29,8 @@ var format = {
|
|
|
29
29
|
select: 'select',
|
|
30
30
|
code: 'code',
|
|
31
31
|
markdown: 'markdown',
|
|
32
|
-
text: '
|
|
32
|
+
text: 'textarea',
|
|
33
|
+
textarea: 'textarea',
|
|
33
34
|
email: 'email',
|
|
34
35
|
password: 'password',
|
|
35
36
|
hidden: 'hidden',
|
|
@@ -182,7 +183,24 @@ var _maxSize = function maxSize(ref) {
|
|
|
182
183
|
|
|
183
184
|
var _nullable = function nullable() {
|
|
184
185
|
return function (r) {
|
|
185
|
-
return r.nullable().optional()
|
|
186
|
+
return r.nullable().optional().transform(function (v) {
|
|
187
|
+
var _r$describe = r.describe(),
|
|
188
|
+
type = _r$describe.type;
|
|
189
|
+
|
|
190
|
+
switch (type) {
|
|
191
|
+
case 'string':
|
|
192
|
+
case 'number':
|
|
193
|
+
return (v || '').toString().length <= 0 ? null : v;
|
|
194
|
+
|
|
195
|
+
case 'object':
|
|
196
|
+
return Object.keys(v || {}).length === 0 ? null : v;
|
|
197
|
+
|
|
198
|
+
default:
|
|
199
|
+
return v;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return v;
|
|
203
|
+
});
|
|
186
204
|
};
|
|
187
205
|
};
|
|
188
206
|
|
|
@@ -220,12 +238,23 @@ var _oneOf = function oneOf(arrayOfValues) {
|
|
|
220
238
|
};
|
|
221
239
|
};
|
|
222
240
|
|
|
223
|
-
var
|
|
241
|
+
var _blacklist = function blacklist(arrayOfValues) {
|
|
242
|
+
var message = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "This value can't include the following values ".concat(arrayOfValues.join(', '));
|
|
243
|
+
return function (r) {
|
|
244
|
+
return r.test('blacklist' + Date.now(), message, function (value) {
|
|
245
|
+
return !arrayOfValues.some(function (f) {
|
|
246
|
+
return value.includes(f);
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
var _ref21 = function ref(_ref) {
|
|
224
253
|
return yup.ref(_ref);
|
|
225
254
|
};
|
|
226
255
|
|
|
227
256
|
var maybeRef = function maybeRef(x) {
|
|
228
|
-
return x !== null && x !== void 0 && x.ref ?
|
|
257
|
+
return x !== null && x !== void 0 && x.ref ? _ref21(x.ref) : x;
|
|
229
258
|
}; //### JSON method ###
|
|
230
259
|
|
|
231
260
|
|
|
@@ -338,8 +367,14 @@ var jsonConstraints = {
|
|
|
338
367
|
message = _ref19$message === void 0 ? "This value must be one of ".concat(arrayOfValues.join(', ')) : _ref19$message;
|
|
339
368
|
return _oneOf(arrayOfValues, message);
|
|
340
369
|
},
|
|
370
|
+
blacklist: function blacklist(_ref20) {
|
|
371
|
+
var arrayOfValues = _ref20.arrayOfValues,
|
|
372
|
+
_ref20$message = _ref20.message,
|
|
373
|
+
message = _ref20$message === void 0 ? "This value can't include the following values ".concat(arrayOfValues.join(', ')) : _ref20$message;
|
|
374
|
+
return _blacklist(arrayOfValues, message);
|
|
375
|
+
},
|
|
341
376
|
ref: function ref(val) {
|
|
342
|
-
return
|
|
377
|
+
return _ref21(val.ref);
|
|
343
378
|
},
|
|
344
379
|
nullable: function nullable() {
|
|
345
380
|
return _nullable();
|
|
@@ -368,7 +403,8 @@ var constraints = /*#__PURE__*/Object.freeze({
|
|
|
368
403
|
test: _test,
|
|
369
404
|
when: _when,
|
|
370
405
|
oneOf: _oneOf,
|
|
371
|
-
|
|
406
|
+
blacklist: _blacklist,
|
|
407
|
+
ref: _ref21,
|
|
372
408
|
jsonConstraints: jsonConstraints
|
|
373
409
|
});
|
|
374
410
|
|
|
@@ -650,6 +686,9 @@ var style = (_style = {
|
|
|
650
686
|
jc_flex_end: {
|
|
651
687
|
justifyContent: "flex-end"
|
|
652
688
|
},
|
|
689
|
+
jc_flex_start: {
|
|
690
|
+
justifyContent: "flex-start"
|
|
691
|
+
},
|
|
653
692
|
ac_center: {
|
|
654
693
|
alignContent: "center"
|
|
655
694
|
},
|
|
@@ -697,7 +736,6 @@ var style = (_style = {
|
|
|
697
736
|
marginLeft: '20px'
|
|
698
737
|
}
|
|
699
738
|
}), _defineProperty$1(_style, "nestedform__border", {
|
|
700
|
-
backgroundColor: 'ghostWhite',
|
|
701
739
|
borderLeft: '2px solid lightGray',
|
|
702
740
|
paddingLeft: '0.5rem',
|
|
703
741
|
marginLeft: '0.5rem',
|
|
@@ -882,29 +920,48 @@ var None = {
|
|
|
882
920
|
}
|
|
883
921
|
};
|
|
884
922
|
|
|
885
|
-
var deepEqual = function deepEqual(
|
|
886
|
-
if (
|
|
887
|
-
if (_typeof$1(a) !== 'object' || _typeof$1(b) !== 'object' || a === null || b === null) return false;
|
|
888
|
-
var keysA = Object.keys(a),
|
|
889
|
-
keysB = Object.keys(b);
|
|
890
|
-
if (keysA.length !== keysB.length) return false;
|
|
923
|
+
var deepEqual = function deepEqual(obj1, obj2) {
|
|
924
|
+
if (obj1 === obj2) return true;
|
|
891
925
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
926
|
+
if (_typeof$1(obj1) !== 'object' || _typeof$1(obj2) !== 'object' || obj1 == null || obj2 == null) {
|
|
927
|
+
return false;
|
|
928
|
+
}
|
|
895
929
|
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
930
|
+
var keysA = Object.keys(obj1);
|
|
931
|
+
var keysB = Object.keys(obj2);
|
|
932
|
+
|
|
933
|
+
if (keysA.length !== keysB.length) {
|
|
934
|
+
return false;
|
|
901
935
|
}
|
|
902
936
|
|
|
903
|
-
|
|
937
|
+
var result = true;
|
|
938
|
+
keysA.forEach(function (key) {
|
|
939
|
+
if (!keysB.includes(key)) {
|
|
940
|
+
result = false;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
if (typeof obj1[key] === 'function' || typeof obj2[key] === 'function') {
|
|
944
|
+
if (obj1[key].toString() !== obj2[key].toString()) {
|
|
945
|
+
result = false;
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
if (!deepEqual(obj1[key], obj2[key])) {
|
|
950
|
+
result = false;
|
|
951
|
+
}
|
|
952
|
+
});
|
|
953
|
+
return result;
|
|
904
954
|
};
|
|
905
955
|
var isPromise = function isPromise(value) {
|
|
906
956
|
return Boolean(value && typeof value.then === 'function');
|
|
907
957
|
};
|
|
958
|
+
var arrayFlatten = function arrayFlatten(array) {
|
|
959
|
+
if (array.some(Array.isArray)) {
|
|
960
|
+
return arrayFlatten(array.flat());
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
return array;
|
|
964
|
+
};
|
|
908
965
|
|
|
909
966
|
var valueToSelectOption = function valueToSelectOption(value) {
|
|
910
967
|
var possibleValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
@@ -1039,7 +1096,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
1039
1096
|
return onChange(v);
|
|
1040
1097
|
};
|
|
1041
1098
|
|
|
1042
|
-
if (props.
|
|
1099
|
+
if (props.buttons) {
|
|
1043
1100
|
return /*#__PURE__*/React.createElement("div", {
|
|
1044
1101
|
style: {
|
|
1045
1102
|
display: 'flex'
|
|
@@ -1082,6 +1139,7 @@ var SelectInput = function SelectInput(props) {
|
|
|
1082
1139
|
name: "".concat(props.label, "-search"),
|
|
1083
1140
|
isLoading: loading,
|
|
1084
1141
|
value: value,
|
|
1142
|
+
isClearable: true,
|
|
1085
1143
|
defaultValue: value,
|
|
1086
1144
|
isDisabled: props.disabled,
|
|
1087
1145
|
placeholder: props.placeholder,
|
|
@@ -23599,7 +23657,7 @@ const Emoji = {
|
|
|
23599
23657
|
}]
|
|
23600
23658
|
};
|
|
23601
23659
|
|
|
23602
|
-
const data = /*@__PURE__*/defineLanguageFacet({ block: { open: "<!--", close: "-->" } });
|
|
23660
|
+
const data$1 = /*@__PURE__*/defineLanguageFacet({ block: { open: "<!--", close: "-->" } });
|
|
23603
23661
|
const commonmark = /*@__PURE__*/parser.configure({
|
|
23604
23662
|
props: [
|
|
23605
23663
|
/*@__PURE__*/styleTags({
|
|
@@ -23635,12 +23693,12 @@ const commonmark = /*@__PURE__*/parser.configure({
|
|
|
23635
23693
|
Document: () => null
|
|
23636
23694
|
}),
|
|
23637
23695
|
/*@__PURE__*/languageDataProp.add({
|
|
23638
|
-
Document: data
|
|
23696
|
+
Document: data$1
|
|
23639
23697
|
})
|
|
23640
23698
|
]
|
|
23641
23699
|
});
|
|
23642
23700
|
function mkLang(parser) {
|
|
23643
|
-
return new Language(data, parser, parser.nodeSet.types.find(t => t.name == "Document"));
|
|
23701
|
+
return new Language(data$1, parser, parser.nodeSet.types.find(t => t.name == "Document"));
|
|
23644
23702
|
}
|
|
23645
23703
|
/**
|
|
23646
23704
|
Language support for strict CommonMark.
|
|
@@ -28428,7 +28486,7 @@ function Editor(parent, mode, onChange, value) {
|
|
|
28428
28486
|
}
|
|
28429
28487
|
} catch (_) {}
|
|
28430
28488
|
}), EditorView.editable.of(!readOnly)]),
|
|
28431
|
-
doc: _typeof(value) === 'object' ? value.value : value
|
|
28489
|
+
doc: !value ? '' : _typeof(value) === 'object' ? value.value : value
|
|
28432
28490
|
});
|
|
28433
28491
|
return new EditorView({
|
|
28434
28492
|
state: state,
|
|
@@ -28511,7 +28569,6 @@ var DaikokuExtension = function DaikokuExtension() {
|
|
|
28511
28569
|
type: 'lang',
|
|
28512
28570
|
regex: /@@@/g,
|
|
28513
28571
|
replace: function replace() {
|
|
28514
|
-
console.log('@@@');
|
|
28515
28572
|
return '</div>';
|
|
28516
28573
|
}
|
|
28517
28574
|
}; // @@@warning
|
|
@@ -28855,10 +28912,12 @@ function SingleLineCode(_ref) {
|
|
|
28855
28912
|
}
|
|
28856
28913
|
|
|
28857
28914
|
var _resolvers;
|
|
28858
|
-
var resolvers = (_resolvers = {}, _defineProperty$1(_resolvers, type.string, function () {
|
|
28859
|
-
return yup.string();
|
|
28915
|
+
var resolvers = (_resolvers = {}, _defineProperty$1(_resolvers, type.string, function (typeErrorMessage) {
|
|
28916
|
+
return yup.string().typeError(typeErrorMessage || 'Value must be a string');
|
|
28860
28917
|
}), _defineProperty$1(_resolvers, type.number, function (typeErrorMessage) {
|
|
28861
|
-
return yup.number().
|
|
28918
|
+
return yup.number().transform(function (v) {
|
|
28919
|
+
return isNaN(v) ? null : v;
|
|
28920
|
+
}).typeError(typeErrorMessage || 'Value must be a number');
|
|
28862
28921
|
}), _defineProperty$1(_resolvers, type.bool, function () {
|
|
28863
28922
|
return yup.bool();
|
|
28864
28923
|
}), _defineProperty$1(_resolvers, type.object, function () {
|
|
@@ -28955,6 +29014,79 @@ var getShapeAndDependencies = function getShapeAndDependencies(flow, schema) {
|
|
|
28955
29014
|
};
|
|
28956
29015
|
};
|
|
28957
29016
|
|
|
29017
|
+
var CustomizableInput$1 = function CustomizableInput(props) {
|
|
29018
|
+
if (props.render) {
|
|
29019
|
+
return props.render(_objectSpread2$1(_objectSpread2$1({}, props.field), {}, {
|
|
29020
|
+
error: props.error
|
|
29021
|
+
}));
|
|
29022
|
+
}
|
|
29023
|
+
|
|
29024
|
+
return props.children;
|
|
29025
|
+
};
|
|
29026
|
+
|
|
29027
|
+
var ControlledInput = function ControlledInput(_ref) {
|
|
29028
|
+
var defaultValue = _ref.defaultValue,
|
|
29029
|
+
step = _ref.step,
|
|
29030
|
+
entry = _ref.entry,
|
|
29031
|
+
children = _ref.children,
|
|
29032
|
+
component = _ref.component;
|
|
29033
|
+
|
|
29034
|
+
var _useController = useController({
|
|
29035
|
+
defaultValue: defaultValue || null,
|
|
29036
|
+
name: entry
|
|
29037
|
+
}),
|
|
29038
|
+
field = _useController.field;
|
|
29039
|
+
|
|
29040
|
+
var _useFormContext = useFormContext(),
|
|
29041
|
+
getValues = _useFormContext.getValues,
|
|
29042
|
+
_setValue = _useFormContext.setValue,
|
|
29043
|
+
errors = _useFormContext.formState.errors;
|
|
29044
|
+
|
|
29045
|
+
var functionalProperty = function functionalProperty(entry, prop) {
|
|
29046
|
+
if (typeof prop === 'function') {
|
|
29047
|
+
return prop({
|
|
29048
|
+
rawValues: getValues(),
|
|
29049
|
+
value: getValues(entry)
|
|
29050
|
+
});
|
|
29051
|
+
} else {
|
|
29052
|
+
return prop;
|
|
29053
|
+
}
|
|
29054
|
+
};
|
|
29055
|
+
|
|
29056
|
+
var props = _objectSpread2$1(_objectSpread2$1(_objectSpread2$1({}, field), step.props), {}, {
|
|
29057
|
+
id: entry,
|
|
29058
|
+
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
29059
|
+
placeholder: step.placeholder,
|
|
29060
|
+
onChange: function onChange(e) {
|
|
29061
|
+
field.onChange(!e ? null : e.target ? e.target.value || null : e);
|
|
29062
|
+
option(step.onChange).map(function (onChange) {
|
|
29063
|
+
return onChange({
|
|
29064
|
+
rawValues: getValues(),
|
|
29065
|
+
value: e.target.value,
|
|
29066
|
+
setValue: _setValue
|
|
29067
|
+
});
|
|
29068
|
+
});
|
|
29069
|
+
},
|
|
29070
|
+
value: field.value || ''
|
|
29071
|
+
});
|
|
29072
|
+
|
|
29073
|
+
var error = entry.split('.').reduce(function (acc, curr) {
|
|
29074
|
+
return acc && acc[curr];
|
|
29075
|
+
}, errors);
|
|
29076
|
+
console.log("render controlled input " + entry);
|
|
29077
|
+
return /*#__PURE__*/React.createElement(CustomizableInput$1, {
|
|
29078
|
+
render: step.render,
|
|
29079
|
+
field: _objectSpread2$1({
|
|
29080
|
+
parent: parent,
|
|
29081
|
+
setValue: function setValue(key, value) {
|
|
29082
|
+
return _setValue(key, value);
|
|
29083
|
+
},
|
|
29084
|
+
rawValues: getValues()
|
|
29085
|
+
}, field),
|
|
29086
|
+
error: error
|
|
29087
|
+
}, component ? component(field, props) : /*#__PURE__*/React.cloneElement(children, _objectSpread2$1({}, props)));
|
|
29088
|
+
};
|
|
29089
|
+
|
|
28958
29090
|
var usePrevious = function usePrevious(value) {
|
|
28959
29091
|
// The ref object is a generic container whose current property is mutable ...
|
|
28960
29092
|
// ... and can hold any value, similar to an instance property on a class
|
|
@@ -29046,33 +29178,16 @@ var CustomizableInput = function CustomizableInput(props) {
|
|
|
29046
29178
|
return props.children;
|
|
29047
29179
|
};
|
|
29048
29180
|
|
|
29049
|
-
var defaultVal = function defaultVal(t, array, defaultValue) {
|
|
29181
|
+
var defaultVal = function defaultVal(value, t, array, defaultValue) {
|
|
29050
29182
|
if (!!defaultValue) return defaultValue;
|
|
29051
29183
|
if (!!array) return [];
|
|
29052
|
-
|
|
29053
|
-
switch (t) {
|
|
29054
|
-
case type.bool:
|
|
29055
|
-
return false;
|
|
29056
|
-
|
|
29057
|
-
case type.number:
|
|
29058
|
-
return 0;
|
|
29059
|
-
|
|
29060
|
-
case type.object:
|
|
29061
|
-
return undefined;
|
|
29062
|
-
//todo: passur de moi
|
|
29063
|
-
|
|
29064
|
-
case type.string:
|
|
29065
|
-
return "";
|
|
29066
|
-
|
|
29067
|
-
default:
|
|
29068
|
-
return undefined;
|
|
29069
|
-
}
|
|
29184
|
+
return value;
|
|
29070
29185
|
};
|
|
29071
29186
|
|
|
29072
|
-
var getDefaultValues = function getDefaultValues(flow, schema) {
|
|
29187
|
+
var getDefaultValues = function getDefaultValues(flow, schema, value) {
|
|
29073
29188
|
return flow.reduce(function (acc, key) {
|
|
29074
29189
|
if (_typeof$1(key) === 'object') {
|
|
29075
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), getDefaultValues(key.flow, schema));
|
|
29190
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), getDefaultValues(key.flow, schema, value));
|
|
29076
29191
|
}
|
|
29077
29192
|
|
|
29078
29193
|
var entry = schema[key];
|
|
@@ -29081,15 +29196,25 @@ var getDefaultValues = function getDefaultValues(flow, schema) {
|
|
|
29081
29196
|
return acc;
|
|
29082
29197
|
}
|
|
29083
29198
|
|
|
29084
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, defaultVal(entry.type, entry.array || entry.isMulti, entry.defaultValue)));
|
|
29199
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, defaultVal(value ? value[key] : null, entry.type, entry.array || entry.isMulti, entry.defaultValue)));
|
|
29085
29200
|
}, {});
|
|
29086
29201
|
};
|
|
29087
29202
|
|
|
29088
|
-
var cleanInputArray = function cleanInputArray(obj, defaultValues, subSchema) {
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29203
|
+
var cleanInputArray = function cleanInputArray(obj, defaultValues, flow, subSchema) {
|
|
29204
|
+
var realFlow = option(flow).map(function (f) {
|
|
29205
|
+
return f.map(function (v) {
|
|
29206
|
+
return v.flow || v;
|
|
29207
|
+
});
|
|
29208
|
+
}).map(arrayFlatten).getOrElse(Object.keys(subSchema));
|
|
29209
|
+
return Object.entries(subSchema).filter(function (_ref2) {
|
|
29210
|
+
var _ref3 = _slicedToArray(_ref2, 1),
|
|
29211
|
+
key = _ref3[0];
|
|
29212
|
+
|
|
29213
|
+
return realFlow.includes(key);
|
|
29214
|
+
}).reduce(function (acc, _ref4) {
|
|
29215
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
|
29216
|
+
key = _ref5[0],
|
|
29217
|
+
step = _ref5[1];
|
|
29093
29218
|
|
|
29094
29219
|
var v;
|
|
29095
29220
|
if (obj) v = obj[key];
|
|
@@ -29101,10 +29226,10 @@ var cleanInputArray = function cleanInputArray(obj, defaultValues, subSchema) {
|
|
|
29101
29226
|
value: value
|
|
29102
29227
|
};
|
|
29103
29228
|
})));
|
|
29104
|
-
} else if (
|
|
29105
|
-
var _subSchema$key;
|
|
29229
|
+
} else if (_typeof$1(v) === 'object' && !(v instanceof Date) && !Array.isArray(v)) {
|
|
29230
|
+
var _subSchema$key, _subSchema$key2;
|
|
29106
29231
|
|
|
29107
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanInputArray(v, defaultValues, (
|
|
29232
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanInputArray(v, defaultValues, (_subSchema$key = subSchema[key]) === null || _subSchema$key === void 0 ? void 0 : _subSchema$key.flow, ((_subSchema$key2 = subSchema[key]) === null || _subSchema$key2 === void 0 ? void 0 : _subSchema$key2.schema) || {})));
|
|
29108
29233
|
} else {
|
|
29109
29234
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v));
|
|
29110
29235
|
}
|
|
@@ -29118,26 +29243,27 @@ var cleanOutputArray = function cleanOutputArray(obj, subSchema) {
|
|
|
29118
29243
|
v = _curr[1];
|
|
29119
29244
|
|
|
29120
29245
|
if (Array.isArray(v)) {
|
|
29121
|
-
var isArray = option(subSchema).orElse(schema)
|
|
29246
|
+
var isArray = option(subSchema) // .orElse(schema) TODO : schema is undefined
|
|
29247
|
+
.map(function (s) {
|
|
29122
29248
|
return s[key];
|
|
29123
29249
|
}).map(function (entry) {
|
|
29124
29250
|
return !!entry.array && !entry.render;
|
|
29125
29251
|
}).getOrElse(false);
|
|
29126
29252
|
|
|
29127
29253
|
if (isArray) {
|
|
29128
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v.map(function (
|
|
29129
|
-
var value =
|
|
29254
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v.map(function (_ref6) {
|
|
29255
|
+
var value = _ref6.value;
|
|
29130
29256
|
return value;
|
|
29131
29257
|
})));
|
|
29132
29258
|
}
|
|
29133
29259
|
|
|
29134
29260
|
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v));
|
|
29135
29261
|
} else if (!!v && _typeof$1(v) === 'object' && !(v instanceof Date && !Array.isArray(v))) {
|
|
29136
|
-
var _subSchema$
|
|
29262
|
+
var _subSchema$key3;
|
|
29137
29263
|
|
|
29138
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$
|
|
29264
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, cleanOutputArray(v, ((_subSchema$key3 = subSchema[key]) === null || _subSchema$key3 === void 0 ? void 0 : _subSchema$key3.schema) || {})));
|
|
29139
29265
|
} else {
|
|
29140
|
-
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v));
|
|
29266
|
+
return _objectSpread2$1(_objectSpread2$1({}, acc), {}, _defineProperty$1({}, key, v === undefined ? null : v));
|
|
29141
29267
|
}
|
|
29142
29268
|
}, {});
|
|
29143
29269
|
};
|
|
@@ -29153,20 +29279,42 @@ var validate = function validate(flow, schema, value) {
|
|
|
29153
29279
|
abortEarly: false
|
|
29154
29280
|
});
|
|
29155
29281
|
};
|
|
29156
|
-
|
|
29157
|
-
|
|
29158
|
-
|
|
29159
|
-
|
|
29160
|
-
|
|
29161
|
-
|
|
29162
|
-
|
|
29163
|
-
|
|
29164
|
-
|
|
29165
|
-
|
|
29166
|
-
|
|
29167
|
-
|
|
29168
|
-
|
|
29169
|
-
|
|
29282
|
+
|
|
29283
|
+
var Watcher = function Watcher(_ref7) {
|
|
29284
|
+
var options = _ref7.options,
|
|
29285
|
+
control = _ref7.control,
|
|
29286
|
+
schema = _ref7.schema;
|
|
29287
|
+
var data = useWatch({
|
|
29288
|
+
control: control
|
|
29289
|
+
});
|
|
29290
|
+
|
|
29291
|
+
if (options.watch) {
|
|
29292
|
+
if (typeof options.watch === 'function') {
|
|
29293
|
+
options.watch(cleanOutputArray(data, schema));
|
|
29294
|
+
} else {
|
|
29295
|
+
console.group('react-form watch');
|
|
29296
|
+
console.log(cleanOutputArray(data, schema));
|
|
29297
|
+
console.groupEnd();
|
|
29298
|
+
}
|
|
29299
|
+
}
|
|
29300
|
+
|
|
29301
|
+
return null;
|
|
29302
|
+
};
|
|
29303
|
+
|
|
29304
|
+
var Form = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
|
|
29305
|
+
var schema = _ref8.schema,
|
|
29306
|
+
flow = _ref8.flow,
|
|
29307
|
+
value = _ref8.value,
|
|
29308
|
+
inputWrapper = _ref8.inputWrapper,
|
|
29309
|
+
onSubmit = _ref8.onSubmit,
|
|
29310
|
+
_ref8$onError = _ref8.onError,
|
|
29311
|
+
onError = _ref8$onError === void 0 ? function () {} : _ref8$onError,
|
|
29312
|
+
footer = _ref8.footer,
|
|
29313
|
+
_ref8$style = _ref8.style,
|
|
29314
|
+
style = _ref8$style === void 0 ? {} : _ref8$style,
|
|
29315
|
+
className = _ref8.className,
|
|
29316
|
+
_ref8$options = _ref8.options,
|
|
29317
|
+
options = _ref8$options === void 0 ? {} : _ref8$options;
|
|
29170
29318
|
var classes = useCustomStyle(style);
|
|
29171
29319
|
var formFlow = flow || Object.keys(schema);
|
|
29172
29320
|
|
|
@@ -29185,7 +29333,7 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
|
29185
29333
|
});
|
|
29186
29334
|
};
|
|
29187
29335
|
|
|
29188
|
-
var defaultValues = getDefaultValues(formFlow, schema); //FIXME: get real schema through the switch
|
|
29336
|
+
var defaultValues = getDefaultValues(formFlow, schema, value); //FIXME: get real schema through the switch
|
|
29189
29337
|
|
|
29190
29338
|
var _resolver = function resolver(rawData) {
|
|
29191
29339
|
var _getShapeAndDependenc2 = getShapeAndDependencies(formFlow, schema, [], rawData),
|
|
@@ -29200,50 +29348,49 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
|
29200
29348
|
resolver: function resolver(data, context, options) {
|
|
29201
29349
|
return yupResolver(_resolver(data))(data, context, options);
|
|
29202
29350
|
},
|
|
29203
|
-
defaultValues: cleanInputArray(value, defaultValues, schema),
|
|
29351
|
+
defaultValues: cleanInputArray(value, defaultValues, flow, schema),
|
|
29204
29352
|
shouldFocusError: false,
|
|
29205
|
-
mode: 'onChange
|
|
29353
|
+
mode: 'onSubmit' // onChange triggers re-rendering
|
|
29354
|
+
|
|
29206
29355
|
});
|
|
29207
29356
|
var _handleSubmit = methods.handleSubmit,
|
|
29208
29357
|
_methods$formState = methods.formState,
|
|
29209
29358
|
errors = _methods$formState.errors,
|
|
29210
29359
|
dirtyFields = _methods$formState.dirtyFields,
|
|
29211
29360
|
_reset = methods.reset,
|
|
29212
|
-
watch = methods.watch,
|
|
29213
29361
|
trigger = methods.trigger,
|
|
29214
29362
|
getValues = methods.getValues;
|
|
29215
29363
|
useEffect(function () {
|
|
29364
|
+
console.log('re-render cauz trigger');
|
|
29216
29365
|
trigger();
|
|
29217
29366
|
}, [trigger]);
|
|
29218
29367
|
useEffect(function () {
|
|
29219
|
-
|
|
29220
|
-
|
|
29221
|
-
|
|
29368
|
+
console.log('re-render cauz value/reset changed');
|
|
29369
|
+
|
|
29370
|
+
_reset(cleanInputArray(value, defaultValues, flow, schema));
|
|
29222
29371
|
}, [value, _reset]);
|
|
29223
29372
|
useEffect(function () {
|
|
29224
|
-
|
|
29373
|
+
console.log('re-render cauz schema changed');
|
|
29374
|
+
|
|
29375
|
+
_reset(cleanInputArray(value, defaultValues, flow, schema));
|
|
29225
29376
|
}, [schema]);
|
|
29226
|
-
var data = watch();
|
|
29227
|
-
var prevData = usePrevious(data);
|
|
29228
|
-
useEffect(function () {
|
|
29229
|
-
//todo: with debounce
|
|
29230
|
-
if (!!options.autosubmit && JSON.stringify(data) !== JSON.stringify(prevData)) {
|
|
29231
|
-
_handleSubmit(function (data) {
|
|
29232
|
-
var clean = cleanOutputArray(data, schema);
|
|
29233
|
-
onSubmit(clean);
|
|
29234
|
-
}, onError)();
|
|
29235
|
-
}
|
|
29236
|
-
}, [data]);
|
|
29237
29377
|
|
|
29238
|
-
if (options.
|
|
29239
|
-
|
|
29240
|
-
|
|
29378
|
+
if (!!options.autosubmit) {
|
|
29379
|
+
_handleSubmit(function (data) {
|
|
29380
|
+
return onSubmit(cleanOutputArray(data, schema));
|
|
29381
|
+
}, onError)();
|
|
29382
|
+
}
|
|
29383
|
+
|
|
29384
|
+
var functionalProperty = function functionalProperty(entry, prop) {
|
|
29385
|
+
if (typeof prop === 'function') {
|
|
29386
|
+
return prop({
|
|
29387
|
+
rawValues: getValues(),
|
|
29388
|
+
value: getValues(entry)
|
|
29389
|
+
});
|
|
29241
29390
|
} else {
|
|
29242
|
-
|
|
29243
|
-
console.log(watch());
|
|
29244
|
-
console.groupEnd();
|
|
29391
|
+
return prop;
|
|
29245
29392
|
}
|
|
29246
|
-
}
|
|
29393
|
+
};
|
|
29247
29394
|
|
|
29248
29395
|
useImperativeHandle(ref, function () {
|
|
29249
29396
|
return {
|
|
@@ -29260,19 +29407,11 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
|
29260
29407
|
methods: methods
|
|
29261
29408
|
};
|
|
29262
29409
|
});
|
|
29263
|
-
|
|
29264
|
-
|
|
29265
|
-
|
|
29266
|
-
|
|
29267
|
-
|
|
29268
|
-
value: getValues(entry)
|
|
29269
|
-
});
|
|
29270
|
-
} else {
|
|
29271
|
-
return prop;
|
|
29272
|
-
}
|
|
29273
|
-
};
|
|
29274
|
-
|
|
29275
|
-
return /*#__PURE__*/React.createElement(FormProvider, methods, /*#__PURE__*/React.createElement("form", {
|
|
29410
|
+
return /*#__PURE__*/React.createElement(FormProvider, methods, /*#__PURE__*/React.createElement(Watcher, {
|
|
29411
|
+
options: options,
|
|
29412
|
+
control: methods.control,
|
|
29413
|
+
schema: schema
|
|
29414
|
+
}), /*#__PURE__*/React.createElement("form", {
|
|
29276
29415
|
className: className || "".concat(classes.pr_15, " ").concat(classes.w_100),
|
|
29277
29416
|
onSubmit: _handleSubmit(function (data) {
|
|
29278
29417
|
var clean = cleanOutputArray(data, schema);
|
|
@@ -29294,6 +29433,8 @@ var Form = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
|
29294
29433
|
}).map(function (visible) {
|
|
29295
29434
|
switch (_typeof$1(visible)) {
|
|
29296
29435
|
case 'object':
|
|
29436
|
+
console.log('watch from visibleStep');
|
|
29437
|
+
|
|
29297
29438
|
var _value = watch(step.visible.ref);
|
|
29298
29439
|
|
|
29299
29440
|
return option(step.visible.test).map(function (test) {
|
|
@@ -29373,17 +29514,18 @@ var Footer = function Footer(props) {
|
|
|
29373
29514
|
}, ((_props$actions8 = props.actions) === null || _props$actions8 === void 0 ? void 0 : (_props$actions8$submi = _props$actions8.submit) === null || _props$actions8$submi === void 0 ? void 0 : _props$actions8$submi.label) || 'Save'));
|
|
29374
29515
|
};
|
|
29375
29516
|
|
|
29376
|
-
var Step = function Step(
|
|
29377
|
-
var entry =
|
|
29378
|
-
realEntry =
|
|
29379
|
-
step =
|
|
29380
|
-
schema =
|
|
29381
|
-
inputWrapper =
|
|
29382
|
-
httpClient =
|
|
29383
|
-
defaultValue =
|
|
29384
|
-
index =
|
|
29385
|
-
functionalProperty =
|
|
29386
|
-
parent =
|
|
29517
|
+
var Step = function Step(_ref9) {
|
|
29518
|
+
var entry = _ref9.entry,
|
|
29519
|
+
realEntry = _ref9.realEntry,
|
|
29520
|
+
step = _ref9.step,
|
|
29521
|
+
schema = _ref9.schema,
|
|
29522
|
+
inputWrapper = _ref9.inputWrapper,
|
|
29523
|
+
httpClient = _ref9.httpClient,
|
|
29524
|
+
defaultValue = _ref9.defaultValue,
|
|
29525
|
+
index = _ref9.index,
|
|
29526
|
+
functionalProperty = _ref9.functionalProperty,
|
|
29527
|
+
parent = _ref9.parent,
|
|
29528
|
+
onAfterChange = _ref9.onAfterChange;
|
|
29387
29529
|
var classes = useCustomStyle();
|
|
29388
29530
|
|
|
29389
29531
|
var _useFormContext2 = useFormContext(),
|
|
@@ -29396,8 +29538,10 @@ var Step = function Step(_ref6) {
|
|
|
29396
29538
|
_useFormContext2.trigger;
|
|
29397
29539
|
var getValues = _useFormContext2.getValues,
|
|
29398
29540
|
_setValue = _useFormContext2.setValue,
|
|
29399
|
-
watch = _useFormContext2.watch
|
|
29400
|
-
|
|
29541
|
+
watch = _useFormContext2.watch;
|
|
29542
|
+
_useFormContext2.register;
|
|
29543
|
+
|
|
29544
|
+
console.log("re-render : " + entry);
|
|
29401
29545
|
|
|
29402
29546
|
if (entry && _typeof$1(entry) === 'object') {
|
|
29403
29547
|
var errored = entry.flow.some(function (step) {
|
|
@@ -29421,6 +29565,7 @@ var Step = function Step(_ref6) {
|
|
|
29421
29565
|
}).map(function (visible) {
|
|
29422
29566
|
switch (_typeof$1(visible)) {
|
|
29423
29567
|
case 'object':
|
|
29568
|
+
console.log("watch of collapse");
|
|
29424
29569
|
var value = watch(visible.ref);
|
|
29425
29570
|
return option(visible.test).map(function (test) {
|
|
29426
29571
|
return test(value, index);
|
|
@@ -29466,6 +29611,30 @@ var Step = function Step(_ref6) {
|
|
|
29466
29611
|
return acc && acc[curr];
|
|
29467
29612
|
}, touchedFields);
|
|
29468
29613
|
var errorDisplayed = !!error && (isSubmitted || isDirty || isTouched);
|
|
29614
|
+
var onAfterChangeFunc = onAfterChange || step.onAfterChange || step.on_after_change;
|
|
29615
|
+
|
|
29616
|
+
if (onAfterChangeFunc) {
|
|
29617
|
+
var _data = watch();
|
|
29618
|
+
|
|
29619
|
+
var d = entry.replace('[', '.').replace(']', '').split('.').reduce(function (acc, curr) {
|
|
29620
|
+
return acc && acc[curr];
|
|
29621
|
+
}, _data) || {};
|
|
29622
|
+
var currentData = usePrevious(cleanOutputArray(d, schema));
|
|
29623
|
+
var newData = cleanOutputArray(d, schema);
|
|
29624
|
+
if (!deepEqual(newData, currentData)) onAfterChangeFunc({
|
|
29625
|
+
entry: entry,
|
|
29626
|
+
previousValue: currentData,
|
|
29627
|
+
value: getValues(entry),
|
|
29628
|
+
getValue: function getValue(e) {
|
|
29629
|
+
return getValues(e);
|
|
29630
|
+
},
|
|
29631
|
+
rawValues: newData,
|
|
29632
|
+
setValue: _setValue,
|
|
29633
|
+
onChange: function onChange(v) {
|
|
29634
|
+
return _setValue(entry, v);
|
|
29635
|
+
}
|
|
29636
|
+
});
|
|
29637
|
+
}
|
|
29469
29638
|
|
|
29470
29639
|
if (step.array) {
|
|
29471
29640
|
return /*#__PURE__*/React.createElement(CustomizableInput, {
|
|
@@ -29484,13 +29653,14 @@ var Step = function Step(_ref6) {
|
|
|
29484
29653
|
}, /*#__PURE__*/React.createElement(ArrayStep, {
|
|
29485
29654
|
entry: entry,
|
|
29486
29655
|
step: step,
|
|
29487
|
-
defaultValue: step.defaultValue ||
|
|
29656
|
+
defaultValue: step.defaultValue || null,
|
|
29488
29657
|
disabled: functionalProperty(entry, step.disabled),
|
|
29489
29658
|
component: function component(props, idx) {
|
|
29490
29659
|
var _props$defaultValue;
|
|
29491
29660
|
|
|
29492
29661
|
return /*#__PURE__*/React.createElement(Step, {
|
|
29493
|
-
entry: "".concat(entry, "
|
|
29662
|
+
entry: "".concat(entry, ".").concat(idx, ".value"),
|
|
29663
|
+
onAfterChange: step.onAfterChange || step.on_after_change,
|
|
29494
29664
|
step: _objectSpread2$1(_objectSpread2$1({}, schema[realEntry || entry]), {}, {
|
|
29495
29665
|
render: step.itemRender,
|
|
29496
29666
|
onChange: undefined,
|
|
@@ -29508,325 +29678,126 @@ var Step = function Step(_ref6) {
|
|
|
29508
29678
|
}));
|
|
29509
29679
|
}
|
|
29510
29680
|
|
|
29511
|
-
var registeredInput = register(entry);
|
|
29512
|
-
|
|
29513
|
-
var inputProps = _objectSpread2$1(_objectSpread2$1({}, registeredInput), {}, {
|
|
29514
|
-
onChange: function onChange(e) {
|
|
29515
|
-
registeredInput.onChange(e);
|
|
29516
|
-
option(step.onChange).map(function (onChange) {
|
|
29517
|
-
return onChange({
|
|
29518
|
-
rawValues: getValues(),
|
|
29519
|
-
value: e.target.value,
|
|
29520
|
-
setValue: _setValue
|
|
29521
|
-
});
|
|
29522
|
-
});
|
|
29523
|
-
}
|
|
29524
|
-
});
|
|
29525
|
-
|
|
29526
29681
|
switch (step.type) {
|
|
29527
29682
|
case type.string:
|
|
29528
29683
|
switch (step.format) {
|
|
29529
29684
|
case format.text:
|
|
29530
|
-
return /*#__PURE__*/React.createElement(
|
|
29531
|
-
render: step.render,
|
|
29532
|
-
field: {
|
|
29533
|
-
parent: parent,
|
|
29534
|
-
setValue: function setValue(key, value) {
|
|
29535
|
-
return _setValue(key, value);
|
|
29536
|
-
},
|
|
29537
|
-
rawValues: getValues(),
|
|
29538
|
-
value: getValues(entry),
|
|
29539
|
-
onChange: function onChange(v) {
|
|
29540
|
-
return _setValue(entry, v);
|
|
29541
|
-
}
|
|
29542
|
-
},
|
|
29543
|
-
error: error
|
|
29544
|
-
}, /*#__PURE__*/React.createElement("textarea", _extends({
|
|
29545
|
-
type: "text",
|
|
29546
|
-
id: entry,
|
|
29547
|
-
className: classNames(classes.input, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29548
|
-
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null
|
|
29549
|
-
}, step.props, {
|
|
29685
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29550
29686
|
defaultValue: defaultValue,
|
|
29551
|
-
|
|
29552
|
-
|
|
29687
|
+
step: step,
|
|
29688
|
+
entry: entry
|
|
29689
|
+
}, /*#__PURE__*/React.createElement("textarea", {
|
|
29690
|
+
type: "text",
|
|
29691
|
+
className: classNames(classes.input, _defineProperty$1({}, classes.input__invalid, errorDisplayed))
|
|
29692
|
+
}));
|
|
29553
29693
|
|
|
29554
29694
|
case format.code:
|
|
29555
29695
|
case format.singleLineCode:
|
|
29556
29696
|
var Component = step.format === format.code ? CodeInput : SingleLineCode;
|
|
29557
|
-
return /*#__PURE__*/React.createElement(
|
|
29558
|
-
|
|
29559
|
-
|
|
29560
|
-
|
|
29561
|
-
|
|
29562
|
-
|
|
29563
|
-
|
|
29564
|
-
field: _objectSpread2$1({
|
|
29565
|
-
parent: parent,
|
|
29566
|
-
setValue: function setValue(key, value) {
|
|
29567
|
-
return _setValue(key, value);
|
|
29568
|
-
},
|
|
29569
|
-
rawValues: getValues()
|
|
29570
|
-
}, field),
|
|
29571
|
-
error: error
|
|
29572
|
-
}, /*#__PURE__*/React.createElement(Component, _extends({
|
|
29573
|
-
className: classNames(_defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29574
|
-
readOnly: functionalProperty(entry, step.disabled) ? true : false,
|
|
29575
|
-
onChange: function onChange(e) {
|
|
29576
|
-
field.onChange(e);
|
|
29577
|
-
option(step.onChange).map(function (onChange) {
|
|
29578
|
-
return onChange({
|
|
29579
|
-
rawValues: getValues(),
|
|
29580
|
-
value: e,
|
|
29581
|
-
setValue: _setValue
|
|
29582
|
-
});
|
|
29583
|
-
});
|
|
29584
|
-
},
|
|
29585
|
-
value: field.value,
|
|
29586
|
-
defaultValue: defaultValue
|
|
29587
|
-
}, step.props)));
|
|
29588
|
-
}
|
|
29589
|
-
});
|
|
29697
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29698
|
+
defaultValue: defaultValue,
|
|
29699
|
+
step: step,
|
|
29700
|
+
entry: entry
|
|
29701
|
+
}, /*#__PURE__*/React.createElement(Component, {
|
|
29702
|
+
className: classNames(_defineProperty$1({}, classes.input__invalid, errorDisplayed))
|
|
29703
|
+
}));
|
|
29590
29704
|
|
|
29591
29705
|
case format.markdown:
|
|
29592
|
-
return /*#__PURE__*/React.createElement(
|
|
29593
|
-
|
|
29594
|
-
|
|
29595
|
-
|
|
29596
|
-
|
|
29597
|
-
|
|
29598
|
-
|
|
29599
|
-
field: _objectSpread2$1({
|
|
29600
|
-
parent: parent,
|
|
29601
|
-
setValue: function setValue(key, value) {
|
|
29602
|
-
return _setValue(key, value);
|
|
29603
|
-
},
|
|
29604
|
-
rawValues: getValues()
|
|
29605
|
-
}, field),
|
|
29606
|
-
error: error
|
|
29607
|
-
}, /*#__PURE__*/React.createElement(MarkdownInput, _extends({}, step.props, {
|
|
29608
|
-
className: classNames(_defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29609
|
-
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
29610
|
-
onChange: function onChange(e) {
|
|
29611
|
-
field.onChange(e);
|
|
29612
|
-
option(step.onChange).map(function (onChange) {
|
|
29613
|
-
return onChange({
|
|
29614
|
-
rawValues: getValues(),
|
|
29615
|
-
value: e,
|
|
29616
|
-
setValue: _setValue
|
|
29617
|
-
});
|
|
29618
|
-
});
|
|
29619
|
-
},
|
|
29620
|
-
value: field.value,
|
|
29621
|
-
defaultValue: defaultValue
|
|
29622
|
-
}, step)));
|
|
29623
|
-
}
|
|
29624
|
-
});
|
|
29706
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29707
|
+
defaultValue: defaultValue,
|
|
29708
|
+
step: step,
|
|
29709
|
+
entry: entry
|
|
29710
|
+
}, /*#__PURE__*/React.createElement(MarkdownInput, {
|
|
29711
|
+
className: classNames(_defineProperty$1({}, classes.input__invalid, errorDisplayed))
|
|
29712
|
+
}));
|
|
29625
29713
|
|
|
29626
29714
|
case format.buttonsSelect:
|
|
29627
29715
|
case format.select:
|
|
29628
|
-
|
|
29629
|
-
|
|
29630
|
-
|
|
29631
|
-
|
|
29632
|
-
|
|
29633
|
-
|
|
29634
|
-
|
|
29635
|
-
|
|
29636
|
-
|
|
29637
|
-
|
|
29638
|
-
|
|
29639
|
-
|
|
29640
|
-
|
|
29641
|
-
|
|
29642
|
-
|
|
29643
|
-
|
|
29644
|
-
className: classNames(classes.flex_grow_1, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29645
|
-
disabled: functionalProperty(entry, step.disabled),
|
|
29646
|
-
value: field.value,
|
|
29647
|
-
possibleValues: step.options,
|
|
29648
|
-
defaultValue: defaultValue,
|
|
29649
|
-
httpClient: httpClient,
|
|
29650
|
-
onChange: function onChange(value) {
|
|
29651
|
-
field.onChange(value);
|
|
29652
|
-
option(step.onChange).map(function (onChange) {
|
|
29653
|
-
return onChange({
|
|
29654
|
-
rawValues: getValues(),
|
|
29655
|
-
value: value,
|
|
29656
|
-
setValue: _setValue
|
|
29657
|
-
});
|
|
29658
|
-
});
|
|
29659
|
-
}
|
|
29660
|
-
})));
|
|
29661
|
-
}
|
|
29662
|
-
});
|
|
29716
|
+
{
|
|
29717
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29718
|
+
defaultValue: defaultValue,
|
|
29719
|
+
step: step,
|
|
29720
|
+
entry: entry
|
|
29721
|
+
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
29722
|
+
className: classNames(classes.flex_grow_1, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29723
|
+
disabled: functionalProperty(entry, step.disabled),
|
|
29724
|
+
possibleValues: step.options,
|
|
29725
|
+
httpClient: httpClient,
|
|
29726
|
+
isMulti: step.isMulti,
|
|
29727
|
+
createOption: step.createOption,
|
|
29728
|
+
transformer: step.transformer,
|
|
29729
|
+
buttons: step.format === format.buttonsSelect
|
|
29730
|
+
}));
|
|
29731
|
+
}
|
|
29663
29732
|
|
|
29664
29733
|
default:
|
|
29665
|
-
return /*#__PURE__*/React.createElement(
|
|
29666
|
-
render: step.render,
|
|
29667
|
-
field: {
|
|
29668
|
-
parent: parent,
|
|
29669
|
-
setValue: function setValue(key, value) {
|
|
29670
|
-
return _setValue(key, value);
|
|
29671
|
-
},
|
|
29672
|
-
rawValues: getValues(),
|
|
29673
|
-
value: getValues(entry),
|
|
29674
|
-
onChange: function onChange(v) {
|
|
29675
|
-
return _setValue(entry, v, {
|
|
29676
|
-
shouldValidate: true
|
|
29677
|
-
});
|
|
29678
|
-
}
|
|
29679
|
-
},
|
|
29680
|
-
error: error
|
|
29681
|
-
}, /*#__PURE__*/React.createElement("input", _extends({
|
|
29682
|
-
type: step.format || 'text',
|
|
29683
|
-
id: entry,
|
|
29684
|
-
className: classNames(classes.input, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29685
|
-
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
29734
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29686
29735
|
defaultValue: defaultValue,
|
|
29687
|
-
|
|
29688
|
-
|
|
29736
|
+
step: step,
|
|
29737
|
+
entry: entry
|
|
29738
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
29739
|
+
type: step.format || 'text',
|
|
29740
|
+
className: classNames(classes.input, _defineProperty$1({}, classes.input__invalid, errorDisplayed))
|
|
29741
|
+
}));
|
|
29689
29742
|
}
|
|
29690
29743
|
|
|
29691
29744
|
case type.number:
|
|
29692
29745
|
switch (step.format) {
|
|
29693
29746
|
case format.buttonsSelect:
|
|
29694
29747
|
case format.select:
|
|
29695
|
-
return /*#__PURE__*/React.createElement(
|
|
29696
|
-
|
|
29697
|
-
|
|
29698
|
-
|
|
29699
|
-
|
|
29700
|
-
|
|
29701
|
-
|
|
29702
|
-
|
|
29703
|
-
|
|
29704
|
-
|
|
29705
|
-
|
|
29706
|
-
|
|
29707
|
-
|
|
29708
|
-
|
|
29709
|
-
error: error
|
|
29710
|
-
}, /*#__PURE__*/React.createElement(SelectInput, _extends({}, step.props, step, {
|
|
29711
|
-
className: classNames(classes.content, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29712
|
-
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
29713
|
-
onChange: function onChange(e) {
|
|
29714
|
-
field.onChange(e);
|
|
29715
|
-
option(step.onChange).map(function (onChange) {
|
|
29716
|
-
return onChange({
|
|
29717
|
-
rawValues: getValues(),
|
|
29718
|
-
value: e,
|
|
29719
|
-
setValue: _setValue
|
|
29720
|
-
});
|
|
29721
|
-
});
|
|
29722
|
-
},
|
|
29723
|
-
value: field.value,
|
|
29724
|
-
possibleValues: step.options,
|
|
29725
|
-
defaultValue: defaultValue,
|
|
29726
|
-
httpClient: httpClient
|
|
29727
|
-
})));
|
|
29728
|
-
}
|
|
29729
|
-
});
|
|
29748
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29749
|
+
defaultValue: defaultValue,
|
|
29750
|
+
step: step,
|
|
29751
|
+
entry: entry
|
|
29752
|
+
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
29753
|
+
className: classNames(classes.content, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29754
|
+
possibleValues: step.options,
|
|
29755
|
+
httpClient: httpClient,
|
|
29756
|
+
isMulti: step.isMulti,
|
|
29757
|
+
createOption: step.createOption,
|
|
29758
|
+
onCreateOption: step.onCreateOption,
|
|
29759
|
+
transformer: step.transformer,
|
|
29760
|
+
buttons: step.format === format.buttonsSelect
|
|
29761
|
+
}));
|
|
29730
29762
|
|
|
29731
29763
|
default:
|
|
29732
|
-
return /*#__PURE__*/React.createElement(
|
|
29733
|
-
|
|
29734
|
-
|
|
29735
|
-
|
|
29736
|
-
|
|
29737
|
-
return _setValue(key, value);
|
|
29738
|
-
},
|
|
29739
|
-
rawValues: getValues(),
|
|
29740
|
-
value: getValues(entry),
|
|
29741
|
-
onChange: function onChange(v) {
|
|
29742
|
-
return _setValue(entry, v);
|
|
29743
|
-
}
|
|
29744
|
-
},
|
|
29745
|
-
error: error
|
|
29746
|
-
}, /*#__PURE__*/React.createElement("input", _extends({}, step.props, {
|
|
29764
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29765
|
+
defaultValue: defaultValue,
|
|
29766
|
+
step: step,
|
|
29767
|
+
entry: entry
|
|
29768
|
+
}, /*#__PURE__*/React.createElement("input", {
|
|
29747
29769
|
type: step.format || 'number',
|
|
29748
|
-
|
|
29749
|
-
|
|
29750
|
-
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
29751
|
-
name: entry,
|
|
29752
|
-
placeholder: step.placeholder,
|
|
29753
|
-
defaultValue: defaultValue
|
|
29754
|
-
}, inputProps)));
|
|
29770
|
+
className: classNames(classes.input, _defineProperty$1({}, classes.input__invalid, errorDisplayed))
|
|
29771
|
+
}));
|
|
29755
29772
|
}
|
|
29756
29773
|
|
|
29757
29774
|
case type.bool:
|
|
29758
|
-
return /*#__PURE__*/React.createElement(
|
|
29759
|
-
|
|
29760
|
-
|
|
29761
|
-
|
|
29762
|
-
|
|
29763
|
-
|
|
29764
|
-
|
|
29765
|
-
field: _objectSpread2$1({
|
|
29766
|
-
parent: parent,
|
|
29767
|
-
setValue: function setValue(key, value) {
|
|
29768
|
-
return _setValue(key, value);
|
|
29769
|
-
},
|
|
29770
|
-
rawValues: getValues()
|
|
29771
|
-
}, field),
|
|
29772
|
-
error: error
|
|
29773
|
-
}, /*#__PURE__*/React.createElement(BooleanInput, _extends({}, step.props, {
|
|
29774
|
-
className: classNames(_defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29775
|
-
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
29776
|
-
onChange: function onChange(e) {
|
|
29777
|
-
field.onChange(e);
|
|
29778
|
-
option(step.onChange).map(function (onChange) {
|
|
29779
|
-
return onChange({
|
|
29780
|
-
rawValues: getValues(),
|
|
29781
|
-
value: e,
|
|
29782
|
-
setValue: _setValue
|
|
29783
|
-
});
|
|
29784
|
-
});
|
|
29785
|
-
},
|
|
29786
|
-
value: field.value
|
|
29787
|
-
})));
|
|
29788
|
-
}
|
|
29789
|
-
});
|
|
29775
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29776
|
+
defaultValue: defaultValue,
|
|
29777
|
+
step: step,
|
|
29778
|
+
entry: entry
|
|
29779
|
+
}, /*#__PURE__*/React.createElement(BooleanInput, {
|
|
29780
|
+
className: classNames(_defineProperty$1({}, classes.input__invalid, errorDisplayed))
|
|
29781
|
+
}));
|
|
29790
29782
|
|
|
29791
29783
|
case type.object:
|
|
29792
29784
|
switch (step.format) {
|
|
29793
29785
|
case format.buttonsSelect:
|
|
29794
29786
|
case format.select:
|
|
29795
|
-
return /*#__PURE__*/React.createElement(
|
|
29796
|
-
|
|
29797
|
-
|
|
29798
|
-
|
|
29799
|
-
|
|
29800
|
-
|
|
29801
|
-
|
|
29802
|
-
|
|
29803
|
-
|
|
29804
|
-
|
|
29805
|
-
|
|
29806
|
-
|
|
29807
|
-
|
|
29808
|
-
|
|
29809
|
-
}, field),
|
|
29810
|
-
error: error
|
|
29811
|
-
}, /*#__PURE__*/React.createElement(SelectInput, _extends({}, step.props, step, {
|
|
29812
|
-
className: classNames(classes.flex_grow_1, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29813
|
-
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
29814
|
-
onChange: function onChange(e) {
|
|
29815
|
-
field.onChange(e);
|
|
29816
|
-
option(step.onChange).map(function (onChange) {
|
|
29817
|
-
return onChange({
|
|
29818
|
-
rawValues: getValues(),
|
|
29819
|
-
value: e,
|
|
29820
|
-
setValue: _setValue
|
|
29821
|
-
});
|
|
29822
|
-
});
|
|
29823
|
-
},
|
|
29824
|
-
value: field.value,
|
|
29825
|
-
possibleValues: step.options,
|
|
29826
|
-
httpClient: httpClient
|
|
29827
|
-
})));
|
|
29828
|
-
}
|
|
29829
|
-
});
|
|
29787
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29788
|
+
defaultValue: defaultValue,
|
|
29789
|
+
step: step,
|
|
29790
|
+
entry: entry
|
|
29791
|
+
}, /*#__PURE__*/React.createElement(SelectInput, {
|
|
29792
|
+
className: classNames(classes.flex_grow_1, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29793
|
+
possibleValues: step.options,
|
|
29794
|
+
httpClient: httpClient,
|
|
29795
|
+
isMulti: step.isMulti,
|
|
29796
|
+
createOption: step.createOption,
|
|
29797
|
+
onCreateOption: step.onCreateOption,
|
|
29798
|
+
transformer: step.transformer,
|
|
29799
|
+
buttons: step.format === format.buttonsSelect
|
|
29800
|
+
}));
|
|
29830
29801
|
|
|
29831
29802
|
case format.form:
|
|
29832
29803
|
//todo: disabled ?
|
|
@@ -29862,35 +29833,20 @@ var Step = function Step(_ref6) {
|
|
|
29862
29833
|
}));
|
|
29863
29834
|
|
|
29864
29835
|
case format.code:
|
|
29865
|
-
return /*#__PURE__*/React.createElement(
|
|
29866
|
-
|
|
29867
|
-
|
|
29868
|
-
|
|
29869
|
-
|
|
29870
|
-
return /*#__PURE__*/React.createElement(
|
|
29871
|
-
render: step.render,
|
|
29872
|
-
field: _objectSpread2$1({
|
|
29873
|
-
parent: parent,
|
|
29874
|
-
setValue: function setValue(key, value) {
|
|
29875
|
-
return _setValue(key, value);
|
|
29876
|
-
},
|
|
29877
|
-
rawValues: getValues()
|
|
29878
|
-
}, field),
|
|
29879
|
-
error: error
|
|
29880
|
-
}, /*#__PURE__*/React.createElement(CodeInput, _extends({}, step.props, step, {
|
|
29836
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29837
|
+
defaultValue: defaultValue,
|
|
29838
|
+
step: step,
|
|
29839
|
+
entry: entry,
|
|
29840
|
+
component: function component(field, props) {
|
|
29841
|
+
return /*#__PURE__*/React.createElement(CodeInput, _extends({}, props, {
|
|
29881
29842
|
className: classNames(_defineProperty$1({}, classes.input__invalid, error)),
|
|
29882
|
-
readOnly: functionalProperty(entry, step.disabled) ? true : false,
|
|
29883
29843
|
onChange: function onChange(e) {
|
|
29884
29844
|
var v;
|
|
29885
29845
|
|
|
29886
29846
|
try {
|
|
29887
29847
|
v = JSON.parse(e);
|
|
29888
29848
|
} catch (err) {
|
|
29889
|
-
|
|
29890
|
-
type: 'manual',
|
|
29891
|
-
message: err
|
|
29892
|
-
});
|
|
29893
|
-
v = {};
|
|
29849
|
+
v = e;
|
|
29894
29850
|
}
|
|
29895
29851
|
|
|
29896
29852
|
field.onChange(v);
|
|
@@ -29902,95 +29858,41 @@ var Step = function Step(_ref6) {
|
|
|
29902
29858
|
});
|
|
29903
29859
|
});
|
|
29904
29860
|
},
|
|
29905
|
-
value: _typeof$1(field.value) === 'object' ? JSON.stringify(field.value, null, 2) : field.value
|
|
29906
|
-
|
|
29907
|
-
})));
|
|
29861
|
+
value: field.value === null ? null : _typeof$1(field.value) === 'object' ? JSON.stringify(field.value, null, 2) : field.value
|
|
29862
|
+
}));
|
|
29908
29863
|
}
|
|
29909
29864
|
});
|
|
29910
29865
|
|
|
29911
29866
|
default:
|
|
29912
|
-
return /*#__PURE__*/React.createElement(
|
|
29913
|
-
|
|
29914
|
-
|
|
29915
|
-
|
|
29916
|
-
|
|
29917
|
-
|
|
29918
|
-
|
|
29919
|
-
|
|
29920
|
-
field: _objectSpread2$1({
|
|
29921
|
-
parent: parent,
|
|
29922
|
-
setValue: function setValue(key, value) {
|
|
29923
|
-
return _setValue(key, value);
|
|
29924
|
-
},
|
|
29925
|
-
rawValues: getValues()
|
|
29926
|
-
}, field),
|
|
29927
|
-
error: error
|
|
29928
|
-
}, /*#__PURE__*/React.createElement(ObjectInput, _extends({}, step.props, step, {
|
|
29929
|
-
className: classNames(_defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29930
|
-
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
29931
|
-
onChange: function onChange(e) {
|
|
29932
|
-
field.onChange(e);
|
|
29933
|
-
option(step.onChange).map(function (onChange) {
|
|
29934
|
-
return onChange({
|
|
29935
|
-
rawValues: getValues(),
|
|
29936
|
-
value: e,
|
|
29937
|
-
setValue: _setValue
|
|
29938
|
-
});
|
|
29939
|
-
});
|
|
29940
|
-
},
|
|
29941
|
-
value: field.value,
|
|
29942
|
-
possibleValues: step.options
|
|
29943
|
-
})));
|
|
29944
|
-
}
|
|
29945
|
-
});
|
|
29867
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29868
|
+
defaultValue: defaultValue,
|
|
29869
|
+
step: step,
|
|
29870
|
+
entry: entry
|
|
29871
|
+
}, /*#__PURE__*/React.createElement(ObjectInput, {
|
|
29872
|
+
className: classNames(_defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29873
|
+
possibleValues: step.options
|
|
29874
|
+
}));
|
|
29946
29875
|
}
|
|
29947
29876
|
|
|
29948
29877
|
case type.date:
|
|
29949
|
-
return /*#__PURE__*/React.createElement(
|
|
29950
|
-
|
|
29951
|
-
|
|
29952
|
-
|
|
29953
|
-
|
|
29954
|
-
|
|
29955
|
-
|
|
29956
|
-
|
|
29957
|
-
field: _objectSpread2$1({
|
|
29958
|
-
parent: parent,
|
|
29959
|
-
setValue: function setValue(key, value) {
|
|
29960
|
-
return _setValue(key, value);
|
|
29961
|
-
},
|
|
29962
|
-
rawValues: getValues()
|
|
29963
|
-
}, field),
|
|
29964
|
-
error: error
|
|
29965
|
-
}, /*#__PURE__*/React.createElement(DatePicker, _extends({}, step.props, {
|
|
29966
|
-
id: "datePicker-1",
|
|
29967
|
-
className: classNames(classes.datepicker, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29968
|
-
readOnly: functionalProperty(entry, step.disabled) ? 'readOnly' : null,
|
|
29969
|
-
value: field.value,
|
|
29970
|
-
onChange: function onChange(e) {
|
|
29971
|
-
field.onChange(e);
|
|
29972
|
-
option(step.onChange).map(function (onChange) {
|
|
29973
|
-
return onChange({
|
|
29974
|
-
rawValues: getValues(),
|
|
29975
|
-
value: e,
|
|
29976
|
-
setValue: _setValue
|
|
29977
|
-
});
|
|
29978
|
-
});
|
|
29979
|
-
},
|
|
29980
|
-
formatStyle: "large"
|
|
29981
|
-
})));
|
|
29982
|
-
}
|
|
29983
|
-
});
|
|
29878
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29879
|
+
defaultValue: defaultValue,
|
|
29880
|
+
step: step,
|
|
29881
|
+
entry: entry
|
|
29882
|
+
}, /*#__PURE__*/React.createElement(DatePicker, {
|
|
29883
|
+
className: classNames(classes.datepicker, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
29884
|
+
formatStyle: "large"
|
|
29885
|
+
}));
|
|
29984
29886
|
|
|
29985
29887
|
case type.file:
|
|
29986
29888
|
return /*#__PURE__*/React.createElement(Controller, {
|
|
29987
29889
|
name: entry,
|
|
29988
29890
|
control: control,
|
|
29989
|
-
render: function render(
|
|
29990
|
-
var field =
|
|
29891
|
+
render: function render(_ref10) {
|
|
29892
|
+
var field = _ref10.field;
|
|
29991
29893
|
|
|
29992
|
-
var FileInput = function FileInput(
|
|
29993
|
-
var onChange =
|
|
29894
|
+
var FileInput = function FileInput(_ref11) {
|
|
29895
|
+
var onChange = _ref11.onChange;
|
|
29994
29896
|
|
|
29995
29897
|
var _useState = useState(false),
|
|
29996
29898
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -30038,28 +29940,11 @@ var Step = function Step(_ref6) {
|
|
|
30038
29940
|
}).join(" , ")));
|
|
30039
29941
|
};
|
|
30040
29942
|
|
|
30041
|
-
return /*#__PURE__*/React.createElement(
|
|
30042
|
-
|
|
30043
|
-
|
|
30044
|
-
|
|
30045
|
-
|
|
30046
|
-
return _setValue(key, value);
|
|
30047
|
-
},
|
|
30048
|
-
rawValues: getValues()
|
|
30049
|
-
}, field),
|
|
30050
|
-
error: error
|
|
30051
|
-
}, /*#__PURE__*/React.createElement(FileInput, {
|
|
30052
|
-
onChange: function onChange(e) {
|
|
30053
|
-
field.onChange(e);
|
|
30054
|
-
option(step.onChange).map(function (onChange) {
|
|
30055
|
-
return onChange({
|
|
30056
|
-
rawValues: getValues(),
|
|
30057
|
-
value: e,
|
|
30058
|
-
setValue: _setValue
|
|
30059
|
-
});
|
|
30060
|
-
});
|
|
30061
|
-
}
|
|
30062
|
-
}));
|
|
29943
|
+
return /*#__PURE__*/React.createElement(ControlledInput, {
|
|
29944
|
+
defaultValue: defaultValue,
|
|
29945
|
+
step: step,
|
|
29946
|
+
entry: entry
|
|
29947
|
+
}, /*#__PURE__*/React.createElement(FileInput, null));
|
|
30063
29948
|
}
|
|
30064
29949
|
});
|
|
30065
29950
|
|
|
@@ -30068,18 +29953,17 @@ var Step = function Step(_ref6) {
|
|
|
30068
29953
|
}
|
|
30069
29954
|
};
|
|
30070
29955
|
|
|
30071
|
-
var ArrayStep = function ArrayStep(
|
|
30072
|
-
var entry =
|
|
30073
|
-
step =
|
|
30074
|
-
component =
|
|
30075
|
-
disabled =
|
|
29956
|
+
var ArrayStep = function ArrayStep(_ref12) {
|
|
29957
|
+
var entry = _ref12.entry,
|
|
29958
|
+
step = _ref12.step,
|
|
29959
|
+
component = _ref12.component,
|
|
29960
|
+
disabled = _ref12.disabled;
|
|
30076
29961
|
var classes = useCustomStyle();
|
|
30077
29962
|
|
|
30078
29963
|
var _useFormContext3 = useFormContext(),
|
|
30079
29964
|
getValues = _useFormContext3.getValues,
|
|
30080
|
-
setValue = _useFormContext3.setValue
|
|
30081
|
-
_useFormContext3.
|
|
30082
|
-
var control = _useFormContext3.control,
|
|
29965
|
+
setValue = _useFormContext3.setValue,
|
|
29966
|
+
control = _useFormContext3.control,
|
|
30083
29967
|
trigger = _useFormContext3.trigger,
|
|
30084
29968
|
formState = _useFormContext3.formState;
|
|
30085
29969
|
|
|
@@ -30105,7 +29989,6 @@ var ArrayStep = function ArrayStep(_ref18) {
|
|
|
30105
29989
|
fields = _useFieldArray.fields,
|
|
30106
29990
|
append = _useFieldArray.append,
|
|
30107
29991
|
remove = _useFieldArray.remove;
|
|
30108
|
-
_useFieldArray.update;
|
|
30109
29992
|
|
|
30110
29993
|
return /*#__PURE__*/React.createElement(React.Fragment, null, fields.map(function (field, idx) {
|
|
30111
29994
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -30115,15 +29998,19 @@ var ArrayStep = function ArrayStep(_ref18) {
|
|
|
30115
29998
|
style: {
|
|
30116
29999
|
position: 'relative'
|
|
30117
30000
|
}
|
|
30001
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
30002
|
+
style: {
|
|
30003
|
+
width: '95%'
|
|
30004
|
+
}
|
|
30118
30005
|
}, component(_objectSpread2$1(_objectSpread2$1({
|
|
30119
30006
|
key: field.id
|
|
30120
30007
|
}, field), {}, {
|
|
30121
30008
|
defaultValue: values[idx]
|
|
30122
|
-
}), idx), /*#__PURE__*/React.createElement("button", {
|
|
30009
|
+
}), idx)), /*#__PURE__*/React.createElement("button", {
|
|
30123
30010
|
type: "button",
|
|
30124
30011
|
style: {
|
|
30125
30012
|
position: 'absolute',
|
|
30126
|
-
top: '
|
|
30013
|
+
top: '2px',
|
|
30127
30014
|
right: 0
|
|
30128
30015
|
},
|
|
30129
30016
|
className: classNames(classes.btn, classes.btn_red, classes.btn_sm, classes.ml_5),
|
|
@@ -30142,7 +30029,7 @@ var ArrayStep = function ArrayStep(_ref18) {
|
|
|
30142
30029
|
className: classNames(classes.btn, classes.btn_blue, classes.btn_sm, classes.mt_5, _defineProperty$1({}, classes.input__invalid, errorDisplayed)),
|
|
30143
30030
|
onClick: function onClick() {
|
|
30144
30031
|
append({
|
|
30145
|
-
value: step.addableDefaultValue || defaultVal(step.type)
|
|
30032
|
+
value: step.addableDefaultValue || defaultVal(null, step.type)
|
|
30146
30033
|
});
|
|
30147
30034
|
trigger(entry);
|
|
30148
30035
|
option(step.onChange).map(function (onChange) {
|
|
@@ -30159,25 +30046,25 @@ var ArrayStep = function ArrayStep(_ref18) {
|
|
|
30159
30046
|
}, error.message)));
|
|
30160
30047
|
};
|
|
30161
30048
|
|
|
30162
|
-
var NestedForm = function NestedForm(
|
|
30049
|
+
var NestedForm = function NestedForm(_ref13) {
|
|
30163
30050
|
var _classNames16;
|
|
30164
30051
|
|
|
30165
|
-
var schema =
|
|
30166
|
-
flow =
|
|
30167
|
-
parent =
|
|
30168
|
-
inputWrapper =
|
|
30169
|
-
maybeCustomHttpClient =
|
|
30170
|
-
errorDisplayed =
|
|
30171
|
-
value =
|
|
30172
|
-
step =
|
|
30173
|
-
functionalProperty =
|
|
30174
|
-
index =
|
|
30052
|
+
var schema = _ref13.schema,
|
|
30053
|
+
flow = _ref13.flow,
|
|
30054
|
+
parent = _ref13.parent,
|
|
30055
|
+
inputWrapper = _ref13.inputWrapper,
|
|
30056
|
+
maybeCustomHttpClient = _ref13.maybeCustomHttpClient,
|
|
30057
|
+
errorDisplayed = _ref13.errorDisplayed,
|
|
30058
|
+
value = _ref13.value,
|
|
30059
|
+
step = _ref13.step,
|
|
30060
|
+
functionalProperty = _ref13.functionalProperty,
|
|
30061
|
+
index = _ref13.index;
|
|
30175
30062
|
|
|
30176
30063
|
var _useFormContext4 = useFormContext(),
|
|
30177
30064
|
getValues = _useFormContext4.getValues,
|
|
30178
30065
|
setValue = _useFormContext4.setValue,
|
|
30179
|
-
watch = _useFormContext4.watch
|
|
30180
|
-
|
|
30066
|
+
watch = _useFormContext4.watch;
|
|
30067
|
+
_useFormContext4.trigger;
|
|
30181
30068
|
_useFormContext4.formState;
|
|
30182
30069
|
|
|
30183
30070
|
var _useState5 = useState(!!step.collapsed),
|
|
@@ -30185,11 +30072,12 @@ var NestedForm = function NestedForm(_ref19) {
|
|
|
30185
30072
|
collapsed = _useState6[0],
|
|
30186
30073
|
setCollapsed = _useState6[1];
|
|
30187
30074
|
|
|
30188
|
-
var classes = useCustomStyle();
|
|
30189
|
-
|
|
30190
|
-
useEffect(
|
|
30191
|
-
|
|
30192
|
-
}, [JSON.stringify(v)])
|
|
30075
|
+
var classes = useCustomStyle(); // TODO - voir ce qui se passe et à quoi ça sert
|
|
30076
|
+
// const v = getValues(parent);
|
|
30077
|
+
// useEffect(() => {
|
|
30078
|
+
// trigger(parent)
|
|
30079
|
+
// }, [JSON.stringify(v)])
|
|
30080
|
+
|
|
30193
30081
|
var schemaAndFlow = option(step.conditionalSchema).map(function (condiSchema) {
|
|
30194
30082
|
var ref = option(condiSchema.ref).map(function (ref) {
|
|
30195
30083
|
return getValues(ref);
|
|
@@ -30214,7 +30102,7 @@ var NestedForm = function NestedForm(_ref19) {
|
|
|
30214
30102
|
});
|
|
30215
30103
|
var prevSchema = usePrevious(schemaAndFlow.schema);
|
|
30216
30104
|
useEffect(function () {
|
|
30217
|
-
if (!!prevSchema &&
|
|
30105
|
+
if (!!prevSchema && !deepEqual(prevSchema, schemaAndFlow.schema)) {
|
|
30218
30106
|
var def = getDefaultValues(schemaAndFlow.flow, schemaAndFlow.schema);
|
|
30219
30107
|
setValue(parent, def, {
|
|
30220
30108
|
shouldValidate: false
|
|
@@ -30281,10 +30169,10 @@ var NestedForm = function NestedForm(_ref19) {
|
|
|
30281
30169
|
onClick: function onClick() {
|
|
30282
30170
|
return setCollapsed(!collapsed);
|
|
30283
30171
|
}
|
|
30284
|
-
}), computedSandF.map(function (
|
|
30285
|
-
var step =
|
|
30286
|
-
visibleStep =
|
|
30287
|
-
entry =
|
|
30172
|
+
}), computedSandF.map(function (_ref14, idx) {
|
|
30173
|
+
var step = _ref14.step,
|
|
30174
|
+
visibleStep = _ref14.visibleStep,
|
|
30175
|
+
entry = _ref14.entry;
|
|
30288
30176
|
|
|
30289
30177
|
if (!step && typeof entry === 'string') {
|
|
30290
30178
|
console.error("no step found for the entry \"".concat(entry, "\" in the given schema. Your form might not work properly. Please fix it"));
|