Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30,695 changes: 27,798 additions & 2,897 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
"peerDependencies": {
"prop-types": "^15.5.10",
"react": "^16.0.0",
"react-jsonschema-form": "^1.0.0"
"@rjsf/core": "^3.1.0"
},
"dependencies": {
"deepcopy": "^0.6.3",
"deepcopy": "^2.1.0",
"selectn": "^1.1.2"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion playground/app/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Form from "react-jsonschema-form";
import Form from "@rjsf/core";
import applyRules from "../../src/applyRules";
import conf from "./conf";

Expand Down
18 changes: 15 additions & 3 deletions src/applyRules.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import { deepEquals } from "react-jsonschema-form/lib/utils";
import { deepEquals } from "@rjsf/core/lib/utils";
import { isDevelopment, toError } from "./utils";
import rulesRunner from "./rulesRunner";

Expand Down Expand Up @@ -73,6 +73,9 @@ export default function applyRules(
this.shouldUpdate = false;
this.state = { schema, uiSchema };
this.updateConf(formData);

this.submit = this.submit.bind(this);
this.formComponent = null;
}

componentWillReceiveProps(nextProps) {
Expand Down Expand Up @@ -133,9 +136,18 @@ export default function applyRules(
// Assignment order is important
let formConf = Object.assign({}, this.props, this.state, {
onChange: this.handleChange,
formData: this.formData,
formData: this.formData
});
return <FormComponent {...formConf} />;
let refCallbackFn = formComponent => {
this.formComponent = formComponent;
};
return <FormComponent {...formConf} ref={refCallbackFn} />;
}

submit() {
if (this.formComponent) {
this.formComponent.submit();
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/rulesRunner.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import execute from "./actions";
import deepcopy from "deepcopy";
import { deepEquals } from "react-jsonschema-form/lib/utils";
import { deepEquals } from "@rjsf/core/lib/utils";

function doRunRules(engine, formData, schema, uiSchema, extraActions = {}) {
let schemaCopy = deepcopy(schema);
Expand Down
2 changes: 1 addition & 1 deletion test/applyRules.render.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Form from "react-jsonschema-form";
import Form from "@rjsf/core";
import Engine from "json-rules-engine-simplified";
import applyRules from "../src";
import sinon from "sinon";
Expand Down
2 changes: 1 addition & 1 deletion test/applyRules.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Form from "react-jsonschema-form";
import Form from "@rjsf/core";
import Engine from "json-rules-engine-simplified";
import applyRules from "../src";
import sinon from "sinon";
Expand Down
2 changes: 1 addition & 1 deletion test/calculatedField.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Form from "react-jsonschema-form";
import Form from "@rjsf/core";
import Engine from "json-rules-engine-simplified";
import applyRules from "../src";
import sinon from "sinon";
Expand Down
2 changes: 1 addition & 1 deletion test/issues/46.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import Form from "react-jsonschema-form";
import Form from "@rjsf/core";
import Engine from "json-rules-engine-simplified";
import applyRules from "../../src";
import sinon from "sinon";
Expand Down
2 changes: 1 addition & 1 deletion test/issues/47.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Form from "react-jsonschema-form";
import Form from "@rjsf/core";
import Engine from "json-rules-engine-simplified";
import applyRules from "../../src";

Expand Down
Loading