@react-form-builder/core
Version:
React JSON Schema Form Builder to create complex, validated, reusable forms with no deep React knowledge required
47 lines (46 loc) • 1.33 kB
JavaScript
import { AsyncFunction as o } from "../../utils/AsyncFunction.js";
class c {
/**
* Creates a new instance of the ActionDefinition class.
* @param func the function of an action.
* @param body the source code of the Action.
* @param params the parameters of the Action.
*/
constructor(t, r, s = {}) {
this.func = t, this.body = r, this.params = s;
}
func;
body;
params;
/**
* Creates an action from the function.
* @param func the function of an action.
* @param params the parameters of the Action.
* @returns the new instance of the ActionDefinition class.
*/
static functionalAction(t, r = {}) {
return new c(t, void 0, r);
}
/**
* Creates an action from the source code.
* @param body the source code of the Action.
* @param params the parameters of the Action.
* @returns the new instance of the ActionDefinition class.
*/
static sourceAction(t, r = {}) {
const s = o("e, args", t);
return new c(s, t, r);
}
/**
* Correctly creates the {@link ActionDefinition} from deserialized data.
* @param value the deserialized data.
* @returns the ActionDefinition instance.
*/
static createFromObject(t) {
return c.sourceAction(t.body, t.params);
}
}
export {
c as ActionDefinition
};
//# sourceMappingURL=ActionDefinition.js.map