@scenid/react-formulator 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +31 -35
- package/dist/index.esm.js +31 -35
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -83543,7 +83543,7 @@ var validate = /*#__PURE__*/function () {
|
|
|
83543
83543
|
asyncErrors = oldAsyncErrors;
|
|
83544
83544
|
|
|
83545
83545
|
if (!asyncValidators) {
|
|
83546
|
-
_context2.next =
|
|
83546
|
+
_context2.next = 12;
|
|
83547
83547
|
break;
|
|
83548
83548
|
}
|
|
83549
83549
|
|
|
@@ -83558,20 +83558,16 @@ var validate = /*#__PURE__*/function () {
|
|
|
83558
83558
|
});
|
|
83559
83559
|
|
|
83560
83560
|
if (!(activeValidators.length > 0)) {
|
|
83561
|
-
_context2.next =
|
|
83561
|
+
_context2.next = 12;
|
|
83562
83562
|
break;
|
|
83563
83563
|
}
|
|
83564
83564
|
|
|
83565
83565
|
newFieldStates = JSON.parse(JSON.stringify(fieldStates));
|
|
83566
|
-
activeValidators.forEach(function (_ref4) {
|
|
83567
|
-
var path = _ref4.path;
|
|
83568
|
-
newFieldStates[path].validating = true;
|
|
83569
|
-
});
|
|
83570
83566
|
ee.emit('fieldStates', newFieldStates);
|
|
83571
|
-
_context2.next =
|
|
83572
|
-
return Promise.all(activeValidators.map(function (
|
|
83573
|
-
var path =
|
|
83574
|
-
func =
|
|
83567
|
+
_context2.next = 10;
|
|
83568
|
+
return Promise.all(activeValidators.map(function (_ref4) {
|
|
83569
|
+
var path = _ref4.path,
|
|
83570
|
+
func = _ref4.func;
|
|
83575
83571
|
|
|
83576
83572
|
if (data[path]) {
|
|
83577
83573
|
return asyncValidatorEnvelope(path, function () {
|
|
@@ -83582,13 +83578,13 @@ var validate = /*#__PURE__*/function () {
|
|
|
83582
83578
|
return Promise.resolve(true);
|
|
83583
83579
|
}));
|
|
83584
83580
|
|
|
83585
|
-
case
|
|
83581
|
+
case 10:
|
|
83586
83582
|
asyncResults = _context2.sent;
|
|
83587
83583
|
asyncErrors = asyncResults.filter(function (m) {
|
|
83588
83584
|
return m !== true;
|
|
83589
83585
|
});
|
|
83590
83586
|
|
|
83591
|
-
case
|
|
83587
|
+
case 12:
|
|
83592
83588
|
mergedErrors = [].concat(_toConsumableArray(errors), _toConsumableArray(asyncErrors));
|
|
83593
83589
|
mergedResults = _objectSpread({}, results);
|
|
83594
83590
|
asyncErrors.forEach(function (e) {
|
|
@@ -83605,7 +83601,7 @@ var validate = /*#__PURE__*/function () {
|
|
|
83605
83601
|
fieldStates: fieldStates
|
|
83606
83602
|
}));
|
|
83607
83603
|
|
|
83608
|
-
case
|
|
83604
|
+
case 16:
|
|
83609
83605
|
case "end":
|
|
83610
83606
|
return _context2.stop();
|
|
83611
83607
|
}
|
|
@@ -83769,14 +83765,14 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
83769
83765
|
|
|
83770
83766
|
var newFieldStates = _objectSpread({}, fieldStates);
|
|
83771
83767
|
|
|
83772
|
-
transientData.forEach(function (
|
|
83773
|
-
var name =
|
|
83774
|
-
value =
|
|
83768
|
+
transientData.forEach(function (_ref7) {
|
|
83769
|
+
var name = _ref7.name,
|
|
83770
|
+
value = _ref7.value;
|
|
83775
83771
|
var finalValue = value;
|
|
83776
83772
|
if (schema.properties[name].type === 'boolean') finalValue = oldData[name] !== true;
|
|
83777
83773
|
var isDirty = initData[name] !== value;
|
|
83778
|
-
newAsyncErrors = asyncErrors.filter(function (
|
|
83779
|
-
var path =
|
|
83774
|
+
newAsyncErrors = asyncErrors.filter(function (_ref8) {
|
|
83775
|
+
var path = _ref8.path;
|
|
83780
83776
|
return path !== name;
|
|
83781
83777
|
}).concat(newAsyncErrors);
|
|
83782
83778
|
newFieldStates[name] = _objectSpread(_objectSpread({}, fieldStates[name]), {}, {
|
|
@@ -83805,8 +83801,8 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
83805
83801
|
fieldStates = _this$state3.fieldStates;
|
|
83806
83802
|
if (preSubmitValidation || disabled) return;
|
|
83807
83803
|
var isDirty = initData[name] !== value;
|
|
83808
|
-
var newAsyncErrors = asyncErrors.filter(function (
|
|
83809
|
-
var path =
|
|
83804
|
+
var newAsyncErrors = asyncErrors.filter(function (_ref9) {
|
|
83805
|
+
var path = _ref9.path;
|
|
83810
83806
|
return path !== name;
|
|
83811
83807
|
});
|
|
83812
83808
|
validate(this.ee, schema, _objectSpread(_objectSpread({}, oldData), {}, _defineProperty({}, name, value)), newAsyncErrors, _objectSpread(_objectSpread({}, fieldStates), {}, _defineProperty({}, name, _objectSpread(_objectSpread({}, fieldStates[name]), {}, {
|
|
@@ -83816,11 +83812,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
83816
83812
|
}
|
|
83817
83813
|
}, {
|
|
83818
83814
|
key: "handleValidation",
|
|
83819
|
-
value: function handleValidation(
|
|
83820
|
-
var hasErrors =
|
|
83821
|
-
fieldStates =
|
|
83822
|
-
errors =
|
|
83823
|
-
result = _objectWithoutProperties(
|
|
83815
|
+
value: function handleValidation(_ref10) {
|
|
83816
|
+
var hasErrors = _ref10.hasErrors,
|
|
83817
|
+
fieldStates = _ref10.fieldStates,
|
|
83818
|
+
errors = _ref10.errors,
|
|
83819
|
+
result = _objectWithoutProperties(_ref10, _excluded2);
|
|
83824
83820
|
|
|
83825
83821
|
var _this$props5 = this.props,
|
|
83826
83822
|
onSubmit = _this$props5.onSubmit,
|
|
@@ -83970,11 +83966,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
83970
83966
|
|
|
83971
83967
|
if (_onReset) _onReset();
|
|
83972
83968
|
}
|
|
83973
|
-
}, renderSchema.title && /*#__PURE__*/React__default["default"].createElement("h5", null, renderSchema.title), renderSchema.description && /*#__PURE__*/React__default["default"].createElement("h5", null, renderSchema.description), renderSchema.groups.map(function (
|
|
83974
|
-
var sectionId =
|
|
83975
|
-
label =
|
|
83976
|
-
description =
|
|
83977
|
-
fields =
|
|
83969
|
+
}, renderSchema.title && /*#__PURE__*/React__default["default"].createElement("h5", null, renderSchema.title), renderSchema.description && /*#__PURE__*/React__default["default"].createElement("h5", null, renderSchema.description), renderSchema.groups.map(function (_ref11) {
|
|
83970
|
+
var sectionId = _ref11.id,
|
|
83971
|
+
label = _ref11.label,
|
|
83972
|
+
description = _ref11.description,
|
|
83973
|
+
fields = _ref11.fields;
|
|
83978
83974
|
|
|
83979
83975
|
if (readOnly && Array.isArray(obscuredGroups) && obscuredGroups.includes(sectionId)) {
|
|
83980
83976
|
return /*#__PURE__*/React__default["default"].createElement(HiddenData, {
|
|
@@ -84011,11 +84007,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
84011
84007
|
});
|
|
84012
84008
|
}), listErrors && hasErrors && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
84013
84009
|
className: "errors"
|
|
84014
|
-
}, errors.map(function (
|
|
84015
|
-
var path =
|
|
84016
|
-
message =
|
|
84017
|
-
options =
|
|
84018
|
-
eVal =
|
|
84010
|
+
}, errors.map(function (_ref12) {
|
|
84011
|
+
var path = _ref12.path,
|
|
84012
|
+
message = _ref12.message,
|
|
84013
|
+
options = _ref12.options,
|
|
84014
|
+
eVal = _ref12.validator;
|
|
84019
84015
|
var finalMessage = message;
|
|
84020
84016
|
if (options && options.human) finalMessage = options.human;else if (errorMessages[eVal]) finalMessage = render(errorMessages[eVal], options);
|
|
84021
84017
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
package/dist/index.esm.js
CHANGED
|
@@ -83475,7 +83475,7 @@ var validate = /*#__PURE__*/function () {
|
|
|
83475
83475
|
asyncErrors = oldAsyncErrors;
|
|
83476
83476
|
|
|
83477
83477
|
if (!asyncValidators) {
|
|
83478
|
-
_context2.next =
|
|
83478
|
+
_context2.next = 12;
|
|
83479
83479
|
break;
|
|
83480
83480
|
}
|
|
83481
83481
|
|
|
@@ -83490,20 +83490,16 @@ var validate = /*#__PURE__*/function () {
|
|
|
83490
83490
|
});
|
|
83491
83491
|
|
|
83492
83492
|
if (!(activeValidators.length > 0)) {
|
|
83493
|
-
_context2.next =
|
|
83493
|
+
_context2.next = 12;
|
|
83494
83494
|
break;
|
|
83495
83495
|
}
|
|
83496
83496
|
|
|
83497
83497
|
newFieldStates = JSON.parse(JSON.stringify(fieldStates));
|
|
83498
|
-
activeValidators.forEach(function (_ref4) {
|
|
83499
|
-
var path = _ref4.path;
|
|
83500
|
-
newFieldStates[path].validating = true;
|
|
83501
|
-
});
|
|
83502
83498
|
ee.emit('fieldStates', newFieldStates);
|
|
83503
|
-
_context2.next =
|
|
83504
|
-
return Promise.all(activeValidators.map(function (
|
|
83505
|
-
var path =
|
|
83506
|
-
func =
|
|
83499
|
+
_context2.next = 10;
|
|
83500
|
+
return Promise.all(activeValidators.map(function (_ref4) {
|
|
83501
|
+
var path = _ref4.path,
|
|
83502
|
+
func = _ref4.func;
|
|
83507
83503
|
|
|
83508
83504
|
if (data[path]) {
|
|
83509
83505
|
return asyncValidatorEnvelope(path, function () {
|
|
@@ -83514,13 +83510,13 @@ var validate = /*#__PURE__*/function () {
|
|
|
83514
83510
|
return Promise.resolve(true);
|
|
83515
83511
|
}));
|
|
83516
83512
|
|
|
83517
|
-
case
|
|
83513
|
+
case 10:
|
|
83518
83514
|
asyncResults = _context2.sent;
|
|
83519
83515
|
asyncErrors = asyncResults.filter(function (m) {
|
|
83520
83516
|
return m !== true;
|
|
83521
83517
|
});
|
|
83522
83518
|
|
|
83523
|
-
case
|
|
83519
|
+
case 12:
|
|
83524
83520
|
mergedErrors = [].concat(_toConsumableArray(errors), _toConsumableArray(asyncErrors));
|
|
83525
83521
|
mergedResults = _objectSpread({}, results);
|
|
83526
83522
|
asyncErrors.forEach(function (e) {
|
|
@@ -83537,7 +83533,7 @@ var validate = /*#__PURE__*/function () {
|
|
|
83537
83533
|
fieldStates: fieldStates
|
|
83538
83534
|
}));
|
|
83539
83535
|
|
|
83540
|
-
case
|
|
83536
|
+
case 16:
|
|
83541
83537
|
case "end":
|
|
83542
83538
|
return _context2.stop();
|
|
83543
83539
|
}
|
|
@@ -83701,14 +83697,14 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
83701
83697
|
|
|
83702
83698
|
var newFieldStates = _objectSpread({}, fieldStates);
|
|
83703
83699
|
|
|
83704
|
-
transientData.forEach(function (
|
|
83705
|
-
var name =
|
|
83706
|
-
value =
|
|
83700
|
+
transientData.forEach(function (_ref7) {
|
|
83701
|
+
var name = _ref7.name,
|
|
83702
|
+
value = _ref7.value;
|
|
83707
83703
|
var finalValue = value;
|
|
83708
83704
|
if (schema.properties[name].type === 'boolean') finalValue = oldData[name] !== true;
|
|
83709
83705
|
var isDirty = initData[name] !== value;
|
|
83710
|
-
newAsyncErrors = asyncErrors.filter(function (
|
|
83711
|
-
var path =
|
|
83706
|
+
newAsyncErrors = asyncErrors.filter(function (_ref8) {
|
|
83707
|
+
var path = _ref8.path;
|
|
83712
83708
|
return path !== name;
|
|
83713
83709
|
}).concat(newAsyncErrors);
|
|
83714
83710
|
newFieldStates[name] = _objectSpread(_objectSpread({}, fieldStates[name]), {}, {
|
|
@@ -83737,8 +83733,8 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
83737
83733
|
fieldStates = _this$state3.fieldStates;
|
|
83738
83734
|
if (preSubmitValidation || disabled) return;
|
|
83739
83735
|
var isDirty = initData[name] !== value;
|
|
83740
|
-
var newAsyncErrors = asyncErrors.filter(function (
|
|
83741
|
-
var path =
|
|
83736
|
+
var newAsyncErrors = asyncErrors.filter(function (_ref9) {
|
|
83737
|
+
var path = _ref9.path;
|
|
83742
83738
|
return path !== name;
|
|
83743
83739
|
});
|
|
83744
83740
|
validate(this.ee, schema, _objectSpread(_objectSpread({}, oldData), {}, _defineProperty({}, name, value)), newAsyncErrors, _objectSpread(_objectSpread({}, fieldStates), {}, _defineProperty({}, name, _objectSpread(_objectSpread({}, fieldStates[name]), {}, {
|
|
@@ -83748,11 +83744,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
83748
83744
|
}
|
|
83749
83745
|
}, {
|
|
83750
83746
|
key: "handleValidation",
|
|
83751
|
-
value: function handleValidation(
|
|
83752
|
-
var hasErrors =
|
|
83753
|
-
fieldStates =
|
|
83754
|
-
errors =
|
|
83755
|
-
result = _objectWithoutProperties(
|
|
83747
|
+
value: function handleValidation(_ref10) {
|
|
83748
|
+
var hasErrors = _ref10.hasErrors,
|
|
83749
|
+
fieldStates = _ref10.fieldStates,
|
|
83750
|
+
errors = _ref10.errors,
|
|
83751
|
+
result = _objectWithoutProperties(_ref10, _excluded2);
|
|
83756
83752
|
|
|
83757
83753
|
var _this$props5 = this.props,
|
|
83758
83754
|
onSubmit = _this$props5.onSubmit,
|
|
@@ -83902,11 +83898,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
83902
83898
|
|
|
83903
83899
|
if (_onReset) _onReset();
|
|
83904
83900
|
}
|
|
83905
|
-
}, renderSchema.title && /*#__PURE__*/React__default.createElement("h5", null, renderSchema.title), renderSchema.description && /*#__PURE__*/React__default.createElement("h5", null, renderSchema.description), renderSchema.groups.map(function (
|
|
83906
|
-
var sectionId =
|
|
83907
|
-
label =
|
|
83908
|
-
description =
|
|
83909
|
-
fields =
|
|
83901
|
+
}, renderSchema.title && /*#__PURE__*/React__default.createElement("h5", null, renderSchema.title), renderSchema.description && /*#__PURE__*/React__default.createElement("h5", null, renderSchema.description), renderSchema.groups.map(function (_ref11) {
|
|
83902
|
+
var sectionId = _ref11.id,
|
|
83903
|
+
label = _ref11.label,
|
|
83904
|
+
description = _ref11.description,
|
|
83905
|
+
fields = _ref11.fields;
|
|
83910
83906
|
|
|
83911
83907
|
if (readOnly && Array.isArray(obscuredGroups) && obscuredGroups.includes(sectionId)) {
|
|
83912
83908
|
return /*#__PURE__*/React__default.createElement(HiddenData, {
|
|
@@ -83943,11 +83939,11 @@ var FormulatorForm = /*#__PURE__*/function (_React$Component) {
|
|
|
83943
83939
|
});
|
|
83944
83940
|
}), listErrors && hasErrors && /*#__PURE__*/React__default.createElement("div", {
|
|
83945
83941
|
className: "errors"
|
|
83946
|
-
}, errors.map(function (
|
|
83947
|
-
var path =
|
|
83948
|
-
message =
|
|
83949
|
-
options =
|
|
83950
|
-
eVal =
|
|
83942
|
+
}, errors.map(function (_ref12) {
|
|
83943
|
+
var path = _ref12.path,
|
|
83944
|
+
message = _ref12.message,
|
|
83945
|
+
options = _ref12.options,
|
|
83946
|
+
eVal = _ref12.validator;
|
|
83951
83947
|
var finalMessage = message;
|
|
83952
83948
|
if (options && options.human) finalMessage = options.human;else if (errorMessages[eVal]) finalMessage = render(errorMessages[eVal], options);
|
|
83953
83949
|
return /*#__PURE__*/React__default.createElement("div", {
|