@opengeoweb/form-fields 4.7.0 → 4.7.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.
- package/index.esm.js +21 -10
- package/index.umd.js +4 -10
- package/lib/components/ReactHookFormHiddenInput.d.ts +1 -1
- package/package.json +2 -2
package/index.esm.js
CHANGED
|
@@ -852,26 +852,37 @@ var ReactHookFormProviderWrapper = function ReactHookFormProviderWrapper(_ref2)
|
|
|
852
852
|
}, children));
|
|
853
853
|
};
|
|
854
854
|
|
|
855
|
+
/* *
|
|
856
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
857
|
+
* you may not use this file except in compliance with the License.
|
|
858
|
+
* You may obtain a copy of the License at
|
|
859
|
+
*
|
|
860
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
861
|
+
*
|
|
862
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
863
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
864
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
865
|
+
* See the License for the specific language governing permissions and
|
|
866
|
+
* limitations under the License.
|
|
867
|
+
*
|
|
868
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
869
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
870
|
+
* */
|
|
871
|
+
|
|
855
872
|
var ReactHookFormHiddenInput = function ReactHookFormHiddenInput(_ref) {
|
|
856
873
|
var name = _ref.name,
|
|
857
874
|
_ref$defaultValue = _ref.defaultValue,
|
|
858
|
-
defaultValue = _ref$defaultValue === void 0 ?
|
|
875
|
+
defaultValue = _ref$defaultValue === void 0 ? null : _ref$defaultValue,
|
|
859
876
|
rules = _ref.rules;
|
|
860
877
|
|
|
861
878
|
var _useFormContext = useFormContext(),
|
|
862
879
|
control = _useFormContext.control;
|
|
863
880
|
|
|
864
881
|
return /*#__PURE__*/React.createElement(Controller, {
|
|
865
|
-
render: function render(
|
|
866
|
-
|
|
867
|
-
field = __rest(_a, ["value"]);
|
|
868
|
-
|
|
869
|
-
var fieldValue = value || '';
|
|
870
|
-
return /*#__PURE__*/React.createElement("input", Object.assign({
|
|
871
|
-
value: fieldValue
|
|
872
|
-
}, field, {
|
|
882
|
+
render: function render(field) {
|
|
883
|
+
return field.value !== null ? /*#__PURE__*/React.createElement("input", Object.assign({}, field, {
|
|
873
884
|
type: "hidden"
|
|
874
|
-
}));
|
|
885
|
+
})) : null;
|
|
875
886
|
},
|
|
876
887
|
name: name,
|
|
877
888
|
control: control,
|
package/index.umd.js
CHANGED
|
@@ -877,20 +877,14 @@
|
|
|
877
877
|
var ReactHookFormHiddenInput = function ReactHookFormHiddenInput(_a) {
|
|
878
878
|
var name = _a.name,
|
|
879
879
|
_b = _a.defaultValue,
|
|
880
|
-
defaultValue = _b === void 0 ?
|
|
880
|
+
defaultValue = _b === void 0 ? null : _b,
|
|
881
881
|
rules = _a.rules;
|
|
882
882
|
var control = reactHookForm.useFormContext().control;
|
|
883
883
|
return /*#__PURE__*/React__namespace.createElement(reactHookForm.Controller, {
|
|
884
|
-
render: function render(
|
|
885
|
-
|
|
886
|
-
field = __rest(_a, ["value"]);
|
|
887
|
-
|
|
888
|
-
var fieldValue = value || '';
|
|
889
|
-
return /*#__PURE__*/React__namespace.createElement("input", __assign({
|
|
890
|
-
value: fieldValue
|
|
891
|
-
}, field, {
|
|
884
|
+
render: function render(field) {
|
|
885
|
+
return field.value !== null ? /*#__PURE__*/React__namespace.createElement("input", __assign({}, field, {
|
|
892
886
|
type: "hidden"
|
|
893
|
-
}));
|
|
887
|
+
})) : null;
|
|
894
888
|
},
|
|
895
889
|
name: name,
|
|
896
890
|
control: control,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ReactHookFormInput } from './types';
|
|
3
3
|
declare type ReactHookFormHiddenInputProps = ReactHookFormInput<{
|
|
4
|
-
defaultValue?:
|
|
4
|
+
defaultValue?: unknown;
|
|
5
5
|
}>;
|
|
6
6
|
declare const ReactHookFormHiddenInput: React.FC<ReactHookFormHiddenInputProps>;
|
|
7
7
|
export default ReactHookFormHiddenInput;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/form-fields",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "GeoWeb form-fields library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"react-hook-form": "^6.12.1",
|
|
16
16
|
"react": "^17.0.2",
|
|
17
17
|
"@mui/material": "^5.10.8",
|
|
18
|
-
"@opengeoweb/theme": "4.7.
|
|
18
|
+
"@opengeoweb/theme": "4.7.1",
|
|
19
19
|
"moment": "^2.29.0",
|
|
20
20
|
"moment-timezone": "^0.5.31",
|
|
21
21
|
"@mui/x-date-pickers": "^5.0.4",
|