@reactables/react-forms 0.7.0-alpha.8 → 0.7.1-alpha.1

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.
@@ -20,7 +20,7 @@ export interface WrappedFieldProps {
20
20
  meta: ControlModels.FormControl<unknown>;
21
21
  }
22
22
  export interface FieldProps {
23
- component: React.JSXElementConstructor<WrappedFieldProps>;
23
+ component: React.JSXElementConstructor<any>;
24
24
  name?: string;
25
25
  [key: string]: unknown;
26
26
  }
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { AbstractControlConfig, ControlRef, ControlModels } from '@reactables/forms';
2
+ import { AbstractControlConfig, ControlModels } from '@reactables/forms';
3
3
  export interface FormArrayChildrenProps {
4
4
  items: ControlModels.FormControl<unknown>[];
5
5
  pushControl: (config: AbstractControlConfig) => void;
6
- removeControl: (controlRef: ControlRef) => void;
6
+ removeControl: (index: number) => void;
7
7
  }
8
8
  export interface FormArrayProps {
9
9
  name?: string;
package/dist/index.js CHANGED
@@ -62,6 +62,9 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
62
62
  var Field = function (_a) {
63
63
  var Component = _a.component, _b = _a.name, name = _b === void 0 ? 'root' : _b, props = __rest(_a, ["component", "name"]);
64
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
+ }
65
68
  var _e = state[name], controlRef = _e.controlRef, touched = _e.touched, value = _e.value;
66
69
  var inputProps = {
67
70
  name: name,
@@ -105,7 +108,7 @@ var FormArray = function (_a) {
105
108
  pushControl: function (config) {
106
109
  pushControl({ controlRef: controlRef, config: config });
107
110
  },
108
- removeControl: removeControl
111
+ removeControl: function (index) { return removeControl(controlRef.concat(index)); }
109
112
  };
110
113
  return React__default["default"].createElement("div", null, children && children(formArrayChildrenProps));
111
114
  };
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.8",
20
+ "@reactables/forms": "^0.7.1-alpha.1",
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.8"
28
+ "version": "0.7.1-alpha.1"
29
29
  }