@reactables/react-forms 0.7.0-alpha.1 → 0.7.0-alpha.11
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/Components/Field.d.ts +1 -1
- package/dist/Components/index.d.ts +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +3 -8
- package/package.json +2 -2
- package/dist/Hooks/index.d.ts +0 -1
- package/dist/Hooks/useForm.d.ts +0 -3
|
@@ -20,7 +20,7 @@ export interface WrappedFieldProps {
|
|
|
20
20
|
meta: ControlModels.FormControl<unknown>;
|
|
21
21
|
}
|
|
22
22
|
export interface FieldProps {
|
|
23
|
-
component: React.JSXElementConstructor<
|
|
23
|
+
component: React.JSXElementConstructor<any>;
|
|
24
24
|
name?: string;
|
|
25
25
|
[key: string]: unknown;
|
|
26
26
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { Form } from './Form';
|
|
2
|
-
export { Field } from './Field';
|
|
3
|
-
export { FormArray } from './FormArray';
|
|
2
|
+
export { Field, WrappedFieldInputProps, WrappedFieldProps, FieldProps } from './Field';
|
|
3
|
+
export { FormArray, FormArrayChildrenProps, FormArrayProps } from './FormArray';
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var forms = require('@reactables/forms');
|
|
7
|
-
var reactHelpers = require('@reactables/react-helpers');
|
|
8
7
|
|
|
9
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
9
|
|
|
@@ -63,6 +62,9 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
63
62
|
var Field = function (_a) {
|
|
64
63
|
var Component = _a.component, _b = _a.name, name = _b === void 0 ? 'root' : _b, props = __rest(_a, ["component", "name"]);
|
|
65
64
|
var _c = React.useContext(FormContext), state = _c[0], _d = _c[1], markControlAsTouched = _d.markControlAsTouched, updateValues = _d.updateValues;
|
|
65
|
+
if (!state[name]) {
|
|
66
|
+
throw "Control '".concat(name, "' can not be found");
|
|
67
|
+
}
|
|
66
68
|
var _e = state[name], controlRef = _e.controlRef, touched = _e.touched, value = _e.value;
|
|
67
69
|
var inputProps = {
|
|
68
70
|
name: name,
|
|
@@ -111,16 +113,9 @@ var FormArray = function (_a) {
|
|
|
111
113
|
return React__default["default"].createElement("div", null, children && children(formArrayChildrenProps));
|
|
112
114
|
};
|
|
113
115
|
|
|
114
|
-
var useForm = function (config) {
|
|
115
|
-
var form = React.useMemo(function () { return forms.build(config); }, []);
|
|
116
|
-
var rxForm = reactHelpers.useReactable(form);
|
|
117
|
-
return rxForm;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
116
|
exports.Field = Field;
|
|
121
117
|
exports.Form = Form;
|
|
122
118
|
exports.FormArray = FormArray;
|
|
123
|
-
exports.useForm = useForm;
|
|
124
119
|
Object.keys(forms).forEach(function (k) {
|
|
125
120
|
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
126
121
|
enumerable: true,
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@reactables/core": "*",
|
|
20
|
-
"@reactables/forms": "^0.7.0-alpha.
|
|
20
|
+
"@reactables/forms": "^0.7.0-alpha.11",
|
|
21
21
|
"@reactables/react-helpers": "*"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
@@ -25,5 +25,5 @@
|
|
|
25
25
|
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
26
26
|
"rxjs": "^6.0.0 || ^7.0.0"
|
|
27
27
|
},
|
|
28
|
-
"version": "0.7.0-alpha.
|
|
28
|
+
"version": "0.7.0-alpha.11"
|
|
29
29
|
}
|
package/dist/Hooks/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useForm } from './useForm';
|
package/dist/Hooks/useForm.d.ts
DELETED