@opengeoweb/form-fields 4.18.0 → 4.19.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 +37 -39
- package/index.umd.js +37 -38
- package/lib/components/ReactHookFormDateTime.d.ts +6 -4
- package/lib/components/index.d.ts +1 -0
- package/package.json +4 -4
package/index.esm.js
CHANGED
|
@@ -723,7 +723,11 @@ var ReactHookFormNumberField = function ReactHookFormNumberField(_a) {
|
|
|
723
723
|
}, otherProps)));
|
|
724
724
|
};
|
|
725
725
|
|
|
726
|
-
moment$1.tz.setDefault('Etc/GMT-0');
|
|
726
|
+
moment$1.tz.setDefault('Etc/GMT-0'); // TODO: remove when issue is fixed in upcoming release https://github.com/mui/mui-x/issues/8150
|
|
727
|
+
|
|
728
|
+
var temporaryStripChineseCharacters = function temporaryStripChineseCharacters(dirtyString) {
|
|
729
|
+
return dirtyString.replace(/[\u2066\u2067\u2068\u2069\u200e]/g, '');
|
|
730
|
+
};
|
|
727
731
|
var getFormattedValue = function getFormattedValue(value) {
|
|
728
732
|
var isMoment = moment$1(value).isValid();
|
|
729
733
|
return isMoment ? moment$1.utc(value).format() : value;
|
|
@@ -748,7 +752,8 @@ var ReactHookKeyboardDateTimePicker = function ReactHookKeyboardDateTimePicker(_
|
|
|
748
752
|
className = _a.className,
|
|
749
753
|
sx = _a.sx,
|
|
750
754
|
isReadOnly = _a.isReadOnly,
|
|
751
|
-
|
|
755
|
+
inputAdornment = _a.inputAdornment,
|
|
756
|
+
otherProps = __rest(_a, ["name", "rules", "disabled", "label", "format", "openTo", "defaultNullValue", "helperText", "onChange", "className", "sx", "isReadOnly", "inputAdornment"]);
|
|
752
757
|
|
|
753
758
|
var _useFormContext = useFormContext(),
|
|
754
759
|
control = _useFormContext.control;
|
|
@@ -765,7 +770,9 @@ var ReactHookKeyboardDateTimePicker = function ReactHookKeyboardDateTimePicker(_
|
|
|
765
770
|
ref = _useController$field.ref,
|
|
766
771
|
formErrors = _useController.formState.errors;
|
|
767
772
|
|
|
768
|
-
var errors = getErrors(name, formErrors);
|
|
773
|
+
var errors = getErrors(name, formErrors); // Ensure value is a Moment object
|
|
774
|
+
|
|
775
|
+
var dateValue = value ? moment$1(value) : null;
|
|
769
776
|
return /*#__PURE__*/React.createElement(ReactHookFormFormControl, {
|
|
770
777
|
disabled: disabled,
|
|
771
778
|
errors: errors,
|
|
@@ -775,10 +782,9 @@ var ReactHookKeyboardDateTimePicker = function ReactHookKeyboardDateTimePicker(_
|
|
|
775
782
|
}, /*#__PURE__*/React.createElement(DateTimePicker, Object.assign({
|
|
776
783
|
desktopModeMediaQuery: "@media (min-width: 720px)",
|
|
777
784
|
ampm: false,
|
|
778
|
-
|
|
779
|
-
inputFormat: format,
|
|
785
|
+
format: format,
|
|
780
786
|
label: label,
|
|
781
|
-
value:
|
|
787
|
+
value: dateValue,
|
|
782
788
|
openTo: openTo,
|
|
783
789
|
disabled: disabled,
|
|
784
790
|
onChange: function onChange(value) {
|
|
@@ -786,42 +792,34 @@ var ReactHookKeyboardDateTimePicker = function ReactHookKeyboardDateTimePicker(_
|
|
|
786
792
|
|
|
787
793
|
_onChange(getFormattedValue(value));
|
|
788
794
|
},
|
|
789
|
-
// if focusedView is removed, it will throw an error when switching day to month mode
|
|
790
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
791
|
-
// @ts-ignore
|
|
792
|
-
focusedView: "month",
|
|
793
795
|
inputRef: ref,
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
InputProps: Object.assign(Object.assign({
|
|
798
|
-
endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
|
|
799
|
-
style: {
|
|
800
|
-
paddingTop: '16px'
|
|
801
|
-
},
|
|
802
|
-
position: "end"
|
|
803
|
-
}, "UTC")
|
|
804
|
-
}, isReadOnly && {
|
|
805
|
-
readOnly: true
|
|
806
|
-
}), otherProps.InputProps),
|
|
807
|
-
hideTabs: false,
|
|
808
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
809
|
-
// @ts-ignore
|
|
810
|
-
// eslint-disable-next-line react/jsx-no-duplicate-props
|
|
811
|
-
inputProps: disabled ? {
|
|
812
|
-
placeholder: ''
|
|
813
|
-
} : undefined,
|
|
814
|
-
renderInput: function renderInput(_a) {
|
|
815
|
-
_a.error;
|
|
816
|
-
var props = __rest(_a, ["error"]);
|
|
817
|
-
|
|
818
|
-
return /*#__PURE__*/React.createElement(TextField, Object.assign({
|
|
796
|
+
slotProps: {
|
|
797
|
+
textField: {
|
|
798
|
+
variant: 'filled',
|
|
819
799
|
helperText: helperText,
|
|
820
800
|
error: !!errors,
|
|
821
801
|
name: name,
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
802
|
+
placeholder: disabled ? '' : format.toLowerCase(),
|
|
803
|
+
InputProps: Object.assign({
|
|
804
|
+
endAdornment: /*#__PURE__*/React.createElement(InputAdornment, {
|
|
805
|
+
style: {
|
|
806
|
+
paddingTop: '16px'
|
|
807
|
+
},
|
|
808
|
+
position: "end"
|
|
809
|
+
}, "UTC")
|
|
810
|
+
}, isReadOnly && {
|
|
811
|
+
readOnly: true
|
|
812
|
+
}),
|
|
813
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
814
|
+
// @ts-ignore
|
|
815
|
+
'data-testid': otherProps['data-testid']
|
|
816
|
+
},
|
|
817
|
+
inputAdornment: Object.assign({}, inputAdornment || {
|
|
818
|
+
position: 'start'
|
|
819
|
+
}),
|
|
820
|
+
tabs: {
|
|
821
|
+
hidden: false
|
|
822
|
+
}
|
|
825
823
|
}
|
|
826
824
|
}, otherProps)));
|
|
827
825
|
};
|
|
@@ -972,4 +970,4 @@ var useDraftFormHelpers = function useDraftFormHelpers() {
|
|
|
972
970
|
};
|
|
973
971
|
};
|
|
974
972
|
|
|
975
|
-
export { HIDDEN_INPUT_HELPER_IS_DRAFT, ReactHookKeyboardDateTimePicker as ReactHookFormDateTime, ReactHookFormFormControl, ReactHookFormHiddenInput, ReactHookFormNumberField, ReactHookFormProviderWrapper as ReactHookFormProvider, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormTextField, defaultFormOptions, errorMessages, getDeepProperty, hasIntersectionWithFIR, hasMaxFeaturePoints, hasMulitpleIntersections, isAfter, isBefore, isBetween, isEmpty, isGeometryDirty, isInteger, isLatitude, isLongitude, isMaximumOneDrawing, isNonOrBothCoordinates, isValidDate, isValidGeoJsonCoordinates, isValidMax, isValidMin, isXHoursAfter, isXHoursBefore, useDraftFormHelpers };
|
|
973
|
+
export { HIDDEN_INPUT_HELPER_IS_DRAFT, ReactHookKeyboardDateTimePicker as ReactHookFormDateTime, ReactHookFormFormControl, ReactHookFormHiddenInput, ReactHookFormNumberField, ReactHookFormProviderWrapper as ReactHookFormProvider, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormTextField, defaultFormOptions, errorMessages, getDeepProperty, hasIntersectionWithFIR, hasMaxFeaturePoints, hasMulitpleIntersections, isAfter, isBefore, isBetween, isEmpty, isGeometryDirty, isInteger, isLatitude, isLongitude, isMaximumOneDrawing, isNonOrBothCoordinates, isValidDate, isValidGeoJsonCoordinates, isValidMax, isValidMin, isXHoursAfter, isXHoursBefore, temporaryStripChineseCharacters, useDraftFormHelpers };
|
package/index.umd.js
CHANGED
|
@@ -713,7 +713,11 @@
|
|
|
713
713
|
}, otherProps)));
|
|
714
714
|
};
|
|
715
715
|
|
|
716
|
-
moment__default$1["default"].tz.setDefault('Etc/GMT-0');
|
|
716
|
+
moment__default$1["default"].tz.setDefault('Etc/GMT-0'); // TODO: remove when issue is fixed in upcoming release https://github.com/mui/mui-x/issues/8150
|
|
717
|
+
|
|
718
|
+
var temporaryStripChineseCharacters = function temporaryStripChineseCharacters(dirtyString) {
|
|
719
|
+
return dirtyString.replace(/[\u2066\u2067\u2068\u2069\u200e]/g, '');
|
|
720
|
+
};
|
|
717
721
|
var getFormattedValue = function getFormattedValue(value) {
|
|
718
722
|
var isMoment = moment__default$1["default"](value).isValid();
|
|
719
723
|
return isMoment ? moment__default$1["default"].utc(value).format() : value;
|
|
@@ -738,7 +742,8 @@
|
|
|
738
742
|
className = _a.className,
|
|
739
743
|
sx = _a.sx,
|
|
740
744
|
isReadOnly = _a.isReadOnly,
|
|
741
|
-
|
|
745
|
+
inputAdornment = _a.inputAdornment,
|
|
746
|
+
otherProps = __rest(_a, ["name", "rules", "disabled", "label", "format", "openTo", "defaultNullValue", "helperText", "onChange", "className", "sx", "isReadOnly", "inputAdornment"]);
|
|
742
747
|
|
|
743
748
|
var control = reactHookForm.useFormContext().control;
|
|
744
749
|
|
|
@@ -754,7 +759,9 @@
|
|
|
754
759
|
ref = _j.ref,
|
|
755
760
|
formErrors = _h.formState.errors;
|
|
756
761
|
|
|
757
|
-
var errors = getErrors(name, formErrors);
|
|
762
|
+
var errors = getErrors(name, formErrors); // Ensure value is a Moment object
|
|
763
|
+
|
|
764
|
+
var dateValue = value ? moment__default$1["default"](value) : null;
|
|
758
765
|
return /*#__PURE__*/React__namespace.createElement(ReactHookFormFormControl, {
|
|
759
766
|
disabled: disabled,
|
|
760
767
|
errors: errors,
|
|
@@ -764,10 +771,9 @@
|
|
|
764
771
|
}, /*#__PURE__*/React__namespace.createElement(xDatePickers.DateTimePicker, __assign({
|
|
765
772
|
desktopModeMediaQuery: "@media (min-width: 720px)",
|
|
766
773
|
ampm: false,
|
|
767
|
-
|
|
768
|
-
inputFormat: format,
|
|
774
|
+
format: format,
|
|
769
775
|
label: label,
|
|
770
|
-
value:
|
|
776
|
+
value: dateValue,
|
|
771
777
|
openTo: openTo,
|
|
772
778
|
disabled: disabled,
|
|
773
779
|
onChange: function onChange(value) {
|
|
@@ -775,42 +781,34 @@
|
|
|
775
781
|
|
|
776
782
|
_onChange(getFormattedValue(value));
|
|
777
783
|
},
|
|
778
|
-
// if focusedView is removed, it will throw an error when switching day to month mode
|
|
779
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
780
|
-
// @ts-ignore
|
|
781
|
-
focusedView: "month",
|
|
782
784
|
inputRef: ref,
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
InputProps: __assign(__assign({
|
|
787
|
-
endAdornment: /*#__PURE__*/React__namespace.createElement(material.InputAdornment, {
|
|
788
|
-
style: {
|
|
789
|
-
paddingTop: '16px'
|
|
790
|
-
},
|
|
791
|
-
position: "end"
|
|
792
|
-
}, "UTC")
|
|
793
|
-
}, isReadOnly && {
|
|
794
|
-
readOnly: true
|
|
795
|
-
}), otherProps.InputProps),
|
|
796
|
-
hideTabs: false,
|
|
797
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
798
|
-
// @ts-ignore
|
|
799
|
-
// eslint-disable-next-line react/jsx-no-duplicate-props
|
|
800
|
-
inputProps: disabled ? {
|
|
801
|
-
placeholder: ''
|
|
802
|
-
} : undefined,
|
|
803
|
-
renderInput: function renderInput(_a) {
|
|
804
|
-
_a.error;
|
|
805
|
-
var props = __rest(_a, ["error"]);
|
|
806
|
-
|
|
807
|
-
return /*#__PURE__*/React__namespace.createElement(material.TextField, __assign({
|
|
785
|
+
slotProps: {
|
|
786
|
+
textField: {
|
|
787
|
+
variant: 'filled',
|
|
808
788
|
helperText: helperText,
|
|
809
789
|
error: !!errors,
|
|
810
790
|
name: name,
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
791
|
+
placeholder: disabled ? '' : format.toLowerCase(),
|
|
792
|
+
InputProps: __assign({
|
|
793
|
+
endAdornment: /*#__PURE__*/React__namespace.createElement(material.InputAdornment, {
|
|
794
|
+
style: {
|
|
795
|
+
paddingTop: '16px'
|
|
796
|
+
},
|
|
797
|
+
position: "end"
|
|
798
|
+
}, "UTC")
|
|
799
|
+
}, isReadOnly && {
|
|
800
|
+
readOnly: true
|
|
801
|
+
}),
|
|
802
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
803
|
+
// @ts-ignore
|
|
804
|
+
'data-testid': otherProps['data-testid']
|
|
805
|
+
},
|
|
806
|
+
inputAdornment: __assign({}, inputAdornment || {
|
|
807
|
+
position: 'start'
|
|
808
|
+
}),
|
|
809
|
+
tabs: {
|
|
810
|
+
hidden: false
|
|
811
|
+
}
|
|
814
812
|
}
|
|
815
813
|
}, otherProps)));
|
|
816
814
|
};
|
|
@@ -939,6 +937,7 @@
|
|
|
939
937
|
exports.isValidMin = isValidMin;
|
|
940
938
|
exports.isXHoursAfter = isXHoursAfter;
|
|
941
939
|
exports.isXHoursBefore = isXHoursBefore;
|
|
940
|
+
exports.temporaryStripChineseCharacters = temporaryStripChineseCharacters;
|
|
942
941
|
exports.useDraftFormHelpers = useDraftFormHelpers;
|
|
943
942
|
|
|
944
943
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps, Theme } from '@mui/material';
|
|
3
3
|
import { Moment } from 'moment-timezone';
|
|
4
|
-
import { DateTimePickerProps } from '@mui/x-date-pickers';
|
|
5
|
-
import { DateTimePickerSlotsComponent } from '@mui/x-date-pickers/DateTimePicker/DateTimePicker';
|
|
4
|
+
import { DateTimePickerProps, DateTimePickerSlotsComponentsProps } from '@mui/x-date-pickers';
|
|
6
5
|
import { ReactHookFormInput } from './types';
|
|
6
|
+
export declare const temporaryStripChineseCharacters: (dirtyString: string) => string;
|
|
7
7
|
export declare const getFormattedValue: (value: Moment | string) => string | Moment;
|
|
8
|
-
declare type ReactHookKeyboardDateTimePickerProps =
|
|
8
|
+
declare type ReactHookKeyboardDateTimePickerProps = DateTimePickerProps<Moment> & DateTimePickerSlotsComponentsProps<Moment> & ReactHookFormInput<{
|
|
9
9
|
defaultNullValue?: string | null;
|
|
10
10
|
value?: string;
|
|
11
11
|
onChange?: (value: string | Moment) => void;
|
|
12
12
|
format?: string;
|
|
13
13
|
sx?: SxProps<Theme>;
|
|
14
|
-
}
|
|
14
|
+
}> & {
|
|
15
|
+
'data-testid'?: string;
|
|
16
|
+
};
|
|
15
17
|
declare const ReactHookKeyboardDateTimePicker: React.FC<ReactHookKeyboardDateTimePickerProps>;
|
|
16
18
|
export default ReactHookKeyboardDateTimePicker;
|
|
@@ -9,3 +9,4 @@ export { default as ReactHookFormHiddenInput } from './ReactHookFormHiddenInput'
|
|
|
9
9
|
export { defaultFormOptions } from './ReactHookFormProvider';
|
|
10
10
|
export { errorMessages, isMaximumOneDrawing, isGeometryDirty, isValidGeoJsonCoordinates, hasIntersectionWithFIR, isValidMax, isValidMin, isInteger, isAfter, isBefore, isBetween, isValidDate, hasMaxFeaturePoints, hasMulitpleIntersections, isXHoursBefore, isXHoursAfter, isLatitude, isLongitude, isNonOrBothCoordinates, isEmpty, } from './utils';
|
|
11
11
|
export { getDeepProperty } from './formUtils';
|
|
12
|
+
export { temporaryStripChineseCharacters } from './ReactHookFormDateTime';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/form-fields",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.19.1",
|
|
4
4
|
"description": "GeoWeb form-fields library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"peerDependencies": {
|
|
15
15
|
"react-hook-form": "^7.41.5",
|
|
16
16
|
"react": "^18.2.0",
|
|
17
|
-
"@mui/material": "^5.
|
|
18
|
-
"@opengeoweb/theme": "4.
|
|
17
|
+
"@mui/material": "^5.12.0",
|
|
18
|
+
"@opengeoweb/theme": "4.19.1",
|
|
19
|
+
"@mui/x-date-pickers": "^6.2.1",
|
|
19
20
|
"moment": "^2.29.0",
|
|
20
21
|
"moment-timezone": "^0.5.31",
|
|
21
|
-
"@mui/x-date-pickers": "^5.0.4",
|
|
22
22
|
"lodash": "^4.17.20"
|
|
23
23
|
}
|
|
24
24
|
}
|