@opengeoweb/form-fields 14.5.2 → 15.0.0
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
CHANGED
|
@@ -430,7 +430,7 @@ var ReactHookFormFormControl = function ReactHookFormFormControl(_ref) {
|
|
|
430
430
|
}));
|
|
431
431
|
};
|
|
432
432
|
|
|
433
|
-
var _excluded$5 = ["name", "label", "defaultValue", "children", "rules", "onChange", "disabled", "className", "sx", "isReadOnly", "size"];
|
|
433
|
+
var _excluded$5 = ["name", "label", "defaultValue", "children", "rules", "onBeforeChange", "onChange", "disabled", "className", "sx", "isReadOnly", "size"];
|
|
434
434
|
var ReactHookFormSelect = function ReactHookFormSelect(_ref) {
|
|
435
435
|
var name = _ref.name,
|
|
436
436
|
label = _ref.label,
|
|
@@ -438,6 +438,8 @@ var ReactHookFormSelect = function ReactHookFormSelect(_ref) {
|
|
|
438
438
|
defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
|
|
439
439
|
children = _ref.children,
|
|
440
440
|
rules = _ref.rules,
|
|
441
|
+
_ref$onBeforeChange = _ref.onBeforeChange,
|
|
442
|
+
onBeforeChange = _ref$onBeforeChange === void 0 ? function () {} : _ref$onBeforeChange,
|
|
441
443
|
_ref$onChange = _ref.onChange,
|
|
442
444
|
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
443
445
|
disabled = _ref.disabled,
|
|
@@ -479,6 +481,7 @@ var ReactHookFormSelect = function ReactHookFormSelect(_ref) {
|
|
|
479
481
|
labelId: labelId,
|
|
480
482
|
name: name,
|
|
481
483
|
onChange: function onChange(changeEvent, child) {
|
|
484
|
+
onBeforeChange();
|
|
482
485
|
onChangeField(changeEvent.target.value);
|
|
483
486
|
// default props
|
|
484
487
|
_onChange(changeEvent, child);
|
|
@@ -622,7 +625,7 @@ var ReactHookFormTextField = function ReactHookFormTextField(_ref) {
|
|
|
622
625
|
});
|
|
623
626
|
};
|
|
624
627
|
|
|
625
|
-
var _excluded$2 = ["name", "label", "defaultValue", "rules", "disabled", "inputMode", "helperText", "className", "size", "sx", "onChange", "isReadOnly"];
|
|
628
|
+
var _excluded$2 = ["name", "label", "defaultValue", "rules", "disabled", "inputMode", "helperText", "className", "size", "sx", "onBeforeChange", "onChange", "isReadOnly"];
|
|
626
629
|
var convertNumericInputValue = function convertNumericInputValue(value, inputMode) {
|
|
627
630
|
if (value !== '' && !isNaN(parseFloat(value))) {
|
|
628
631
|
return inputMode === 'numeric' ? parseInt(value, 10) : parseFloat(value);
|
|
@@ -653,6 +656,8 @@ var ReactHookFormNumberField = function ReactHookFormNumberField(_ref) {
|
|
|
653
656
|
_ref$size = _ref.size,
|
|
654
657
|
size = _ref$size === void 0 ? 'medium' : _ref$size,
|
|
655
658
|
sx = _ref.sx,
|
|
659
|
+
_ref$onBeforeChange = _ref.onBeforeChange,
|
|
660
|
+
onBeforeChange = _ref$onBeforeChange === void 0 ? function () {} : _ref$onBeforeChange,
|
|
656
661
|
_ref$onChange = _ref.onChange,
|
|
657
662
|
_onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
|
|
658
663
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -771,6 +776,7 @@ var ReactHookFormNumberField = function ReactHookFormNumberField(_ref) {
|
|
|
771
776
|
// Convert to number for form value
|
|
772
777
|
var numericValue = convertNumericInputValue(inputValue, inputMode);
|
|
773
778
|
lastSetValueRef.current = numericValue;
|
|
779
|
+
onBeforeChange();
|
|
774
780
|
onChangeField(numericValue);
|
|
775
781
|
_onChange(null);
|
|
776
782
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/form-fields",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"description": "GeoWeb form-fields library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/theme": "
|
|
11
|
+
"@opengeoweb/theme": "15.0.0",
|
|
12
12
|
"react-hook-form": "^7.50.1",
|
|
13
13
|
"@mui/x-date-pickers": "^8.11.2",
|
|
14
14
|
"lodash": "^4.17.21",
|
|
15
|
-
"@opengeoweb/shared": "
|
|
15
|
+
"@opengeoweb/shared": "15.0.0",
|
|
16
16
|
"react-i18next": "^15.1.1",
|
|
17
17
|
"@mui/material": "^7.0.1",
|
|
18
18
|
"i18next": "^25.0.1",
|
|
@@ -6,6 +6,7 @@ export declare const convertNumericInputValue: (value: string, inputMode: InputM
|
|
|
6
6
|
export declare const getAllowedKeys: (inputMode?: InputMode) => string[];
|
|
7
7
|
type ReactHookFormNumberFieldProps = Partial<TextFieldProps> & ReactHookFormInput<{
|
|
8
8
|
inputMode?: InputMode;
|
|
9
|
+
onBeforeChange?: () => void;
|
|
9
10
|
}>;
|
|
10
11
|
declare const ReactHookFormNumberField: React.FC<ReactHookFormNumberFieldProps>;
|
|
11
12
|
export default ReactHookFormNumberField;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { SelectProps } from '@mui/material';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { ReactHookFormInput } from './types';
|
|
4
|
-
type ReactHookFormSelectProps = Partial<SelectProps> & ReactHookFormInput<
|
|
4
|
+
type ReactHookFormSelectProps = Partial<SelectProps> & ReactHookFormInput<{
|
|
5
|
+
onBeforeChange?: () => void;
|
|
6
|
+
}>;
|
|
5
7
|
declare const ReactHookFormSelect: React.FC<ReactHookFormSelectProps>;
|
|
6
8
|
export default ReactHookFormSelect;
|