react-jsonschema-form-conditionals 0.3.16 → 0.3.17

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/lib/applyRules.js CHANGED
@@ -16,9 +16,7 @@ var _propTypes = require("prop-types");
16
16
 
17
17
  var _propTypes2 = _interopRequireDefault(_propTypes);
18
18
 
19
- var _utils = require("react-jsonschema-form/lib/utils");
20
-
21
- var _utils2 = require("./utils");
19
+ var _utils = require("./utils");
22
20
 
23
21
  var _rulesRunner = require("./rulesRunner");
24
22
 
@@ -41,7 +39,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
41
39
  function applyRules(schema, uiSchema, rules, Engine) {
42
40
  var extraActions = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
43
41
 
44
- if ((0, _utils2.isDevelopment)()) {
42
+ if ((0, _utils.isDevelopment)()) {
45
43
  var propTypes = {
46
44
  Engine: _propTypes2.default.func.isRequired,
47
45
  rules: _propTypes2.default.arrayOf(_propTypes2.default.shape({
@@ -68,7 +66,7 @@ function applyRules(schema, uiSchema, rules, Engine) {
68
66
  // Find associated action
69
67
  var action = extraActions[type] ? extraActions[type] : _actions.DEFAULT_ACTIONS[type];
70
68
  if (action === undefined) {
71
- (0, _utils2.toError)("Rule contains invalid action \"" + type + "\"");
69
+ (0, _utils.toError)("Rule contains invalid action \"" + type + "\"");
72
70
  return;
73
71
  }
74
72
 
@@ -93,12 +91,7 @@ function applyRules(schema, uiSchema, rules, Engine) {
93
91
  formData = _this$props$formData === undefined ? {} : _this$props$formData;
94
92
 
95
93
 
96
- _this.state = {
97
- schema: schema,
98
- uiSchema: uiSchema,
99
- formData: formData
100
- };
101
-
94
+ _this.state = { schema: schema, uiSchema: uiSchema, formData: formData };
102
95
  _this.updateConf(formData);
103
96
  return _this;
104
97
  }
@@ -114,21 +107,11 @@ function applyRules(schema, uiSchema, rules, Engine) {
114
107
  var _this2 = this;
115
108
 
116
109
  return runRules(formData).then(function (conf) {
117
- var dataChanged = !(0, _utils.deepEquals)(formData, conf.formData);
118
-
119
- var newState = {
120
- schema: conf.schema,
121
- uiSchema: conf.uiSchema,
122
- formData: formData
123
- };
124
- var _state = _this2.state,
125
- schema = _state.schema,
126
- uiSchema = _state.uiSchema;
127
-
110
+ var newConf = JSON.stringify(conf);
111
+ var oldConf = JSON.stringify(_this2.state);
128
112
 
129
- var confChanged = !(0, _utils.deepEquals)(newState, { schema: schema, uiSchema: uiSchema });
130
- if (dataChanged || confChanged) {
131
- _this2.setState(newState);
113
+ if (newConf !== oldConf) {
114
+ _this2.setState(conf);
132
115
  }
133
116
 
134
117
  return conf;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Extension of react-jsonschema-form with conditional field support",
4
4
  "private": false,
5
5
  "author": "mavarazy@gmail.com",
6
- "version": "0.3.16",
6
+ "version": "0.3.17",
7
7
  "scripts": {
8
8
  "build:lib": "rimraf lib && cross-env NODE_ENV=production babel -d lib/ src/",
9
9
  "build:dist": "rimraf dist && cross-env NODE_ENV=production webpack --config webpack.config.dist.js --optimize-minimize",