@opengeoweb/form-fields 9.19.1 → 9.20.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 +200 -180
- package/package.json +3 -3
- package/src/lib/components/index.d.ts +1 -1
- package/src/lib/components/utils.d.ts +0 -1
package/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import React__default from 'react';
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
2
|
import { FormControl, FormHelperText, InputLabel, Select, RadioGroup, TextField, InputAdornment } from '@mui/material';
|
|
4
3
|
import { useFormContext, useController, useForm, FormProvider } from 'react-hook-form';
|
|
5
4
|
import { isEqual } from 'lodash';
|
|
6
5
|
import { dateUtils } from '@opengeoweb/shared';
|
|
6
|
+
import * as React from 'react';
|
|
7
7
|
import { DateTimePicker } from '@mui/x-date-pickers';
|
|
8
8
|
import { CalendarToday } from '@opengeoweb/theme';
|
|
9
9
|
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
@@ -328,7 +328,9 @@ var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty
|
|
|
328
328
|
source: 'https://github.com/zloirock/core-js'
|
|
329
329
|
});
|
|
330
330
|
|
|
331
|
-
var
|
|
331
|
+
var sharedStoreExports = sharedStore.exports;
|
|
332
|
+
|
|
333
|
+
var store$2 = sharedStoreExports;
|
|
332
334
|
|
|
333
335
|
var shared$4 = function (key, value) {
|
|
334
336
|
return store$2[key] || (store$2[key] = value || {});
|
|
@@ -570,7 +572,7 @@ var functionName = {
|
|
|
570
572
|
|
|
571
573
|
var uncurryThis$b = functionUncurryThis;
|
|
572
574
|
var isCallable$a = isCallable$g;
|
|
573
|
-
var store$1 =
|
|
575
|
+
var store$1 = sharedStoreExports;
|
|
574
576
|
|
|
575
577
|
var functionToString = uncurryThis$b(Function.toString);
|
|
576
578
|
|
|
@@ -606,7 +608,7 @@ var global$9 = global$h;
|
|
|
606
608
|
var isObject$4 = isObject$9;
|
|
607
609
|
var createNonEnumerableProperty$4 = createNonEnumerableProperty$5;
|
|
608
610
|
var hasOwn$6 = hasOwnProperty_1;
|
|
609
|
-
var shared$1 =
|
|
611
|
+
var shared$1 = sharedStoreExports;
|
|
610
612
|
var sharedKey$2 = sharedKey$3;
|
|
611
613
|
var hiddenKeys$3 = hiddenKeys$4;
|
|
612
614
|
|
|
@@ -727,9 +729,11 @@ Function.prototype.toString = makeBuiltIn$1(function toString() {
|
|
|
727
729
|
return isCallable$8(this) && getInternalState$2(this).source || inspectSource(this);
|
|
728
730
|
}, 'toString');
|
|
729
731
|
|
|
732
|
+
var makeBuiltInExports = makeBuiltIn$2.exports;
|
|
733
|
+
|
|
730
734
|
var isCallable$7 = isCallable$g;
|
|
731
735
|
var definePropertyModule$2 = objectDefineProperty;
|
|
732
|
-
var makeBuiltIn =
|
|
736
|
+
var makeBuiltIn = makeBuiltInExports;
|
|
733
737
|
var defineGlobalProperty$1 = defineGlobalProperty$3;
|
|
734
738
|
|
|
735
739
|
var defineBuiltIn$5 = function (O, key, value, options) {
|
|
@@ -1094,6 +1098,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
1094
1098
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1095
1099
|
PERFORMANCE OF THIS SOFTWARE.
|
|
1096
1100
|
***************************************************************************** */
|
|
1101
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
1102
|
+
|
|
1097
1103
|
|
|
1098
1104
|
function __rest(s, e) {
|
|
1099
1105
|
var t = {};
|
|
@@ -1773,22 +1779,6 @@ const hasIntersectionWithFIR = (geojson, intersection) => {
|
|
|
1773
1779
|
}
|
|
1774
1780
|
return true;
|
|
1775
1781
|
};
|
|
1776
|
-
const hasMaxFeaturePoints = (geojson, maxPoints = 7) => {
|
|
1777
|
-
const hasGeometry = hasValidGeometry(geojson);
|
|
1778
|
-
if (!hasGeometry) {
|
|
1779
|
-
return false;
|
|
1780
|
-
}
|
|
1781
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1782
|
-
// @ts-ignore
|
|
1783
|
-
const {
|
|
1784
|
-
coordinates,
|
|
1785
|
-
type
|
|
1786
|
-
} = geojson.features[0].geometry;
|
|
1787
|
-
if (type === 'Polygon' && coordinates[0].length > maxPoints) {
|
|
1788
|
-
return true;
|
|
1789
|
-
}
|
|
1790
|
-
return false;
|
|
1791
|
-
};
|
|
1792
1782
|
const hasMulitpleIntersections = geojson => {
|
|
1793
1783
|
const hasGeometry = hasValidGeometry(geojson);
|
|
1794
1784
|
if (!hasGeometry) {
|
|
@@ -1872,7 +1862,7 @@ const ReactHookFormFormControl = _a => {
|
|
|
1872
1862
|
size = 'medium'
|
|
1873
1863
|
} = _a,
|
|
1874
1864
|
props = __rest(_a, ["children", "errors", "isReadOnly", "sx", "className", "size"]);
|
|
1875
|
-
return
|
|
1865
|
+
return jsxs(FormControl, Object.assign({
|
|
1876
1866
|
fullWidth: true,
|
|
1877
1867
|
error: !!errors,
|
|
1878
1868
|
className: `${isReadOnly ? 'is-read-only' : ''} ${className}`,
|
|
@@ -1897,10 +1887,14 @@ const ReactHookFormFormControl = _a => {
|
|
|
1897
1887
|
border: 'transparent'
|
|
1898
1888
|
}
|
|
1899
1889
|
}), sx)
|
|
1900
|
-
}, props
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1890
|
+
}, props, {
|
|
1891
|
+
children: [children, errors && jsx(FormHelperText, Object.assign({
|
|
1892
|
+
variant: "filled",
|
|
1893
|
+
role: "alert"
|
|
1894
|
+
}, {
|
|
1895
|
+
children: getErrorMessage(errors)
|
|
1896
|
+
}))]
|
|
1897
|
+
}));
|
|
1904
1898
|
};
|
|
1905
1899
|
|
|
1906
1900
|
var aCallable$1 = aCallable$3;
|
|
@@ -2027,29 +2021,35 @@ const ReactHookFormSelect = _a => {
|
|
|
2027
2021
|
defaultValue
|
|
2028
2022
|
}, defaultProps));
|
|
2029
2023
|
const errors = getErrors(name, formErrors);
|
|
2030
|
-
return
|
|
2024
|
+
return jsxs(ReactHookFormFormControl, Object.assign({
|
|
2031
2025
|
className: className,
|
|
2032
2026
|
sx: sx,
|
|
2033
2027
|
disabled: disabled,
|
|
2034
2028
|
errors: errors,
|
|
2035
2029
|
isReadOnly: isReadOnly,
|
|
2036
2030
|
size: size
|
|
2037
|
-
},
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
onChange
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2031
|
+
}, {
|
|
2032
|
+
children: [jsx(InputLabel, Object.assign({
|
|
2033
|
+
variant: "filled",
|
|
2034
|
+
id: labelId
|
|
2035
|
+
}, {
|
|
2036
|
+
children: label
|
|
2037
|
+
})), jsx(Select, Object.assign({
|
|
2038
|
+
labelId: labelId,
|
|
2039
|
+
label: label,
|
|
2040
|
+
inputRef: ref,
|
|
2041
|
+
name: name,
|
|
2042
|
+
onChange: changeEvent => {
|
|
2043
|
+
onChangeField(changeEvent.target.value);
|
|
2044
|
+
// default props
|
|
2045
|
+
onChange(changeEvent);
|
|
2046
|
+
},
|
|
2047
|
+
value: value || '',
|
|
2048
|
+
variant: "filled"
|
|
2049
|
+
}, otherProps, {
|
|
2050
|
+
children: children
|
|
2051
|
+
}))]
|
|
2052
|
+
}));
|
|
2053
2053
|
};
|
|
2054
2054
|
|
|
2055
2055
|
const ReactHookFormRadioGroup = _a => {
|
|
@@ -2096,21 +2096,27 @@ const ReactHookFormRadioGroup = _a => {
|
|
|
2096
2096
|
}
|
|
2097
2097
|
}
|
|
2098
2098
|
}, [errors, formErrors, name]);
|
|
2099
|
-
return
|
|
2099
|
+
return jsxs(ReactHookFormFormControl, Object.assign({
|
|
2100
2100
|
disabled: disabled,
|
|
2101
2101
|
errors: errors,
|
|
2102
2102
|
isReadOnly: isReadOnly
|
|
2103
|
-
},
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2103
|
+
}, {
|
|
2104
|
+
children: [jsx(InputLabel, Object.assign({
|
|
2105
|
+
id: labelId
|
|
2106
|
+
}, {
|
|
2107
|
+
children: label
|
|
2108
|
+
})), jsx(RadioGroup, Object.assign({
|
|
2109
|
+
value: value,
|
|
2110
|
+
onChange: changeEvent => {
|
|
2111
|
+
onChangeField(changeEvent.target.value);
|
|
2112
|
+
onChange(changeEvent, changeEvent.target.value);
|
|
2113
|
+
},
|
|
2114
|
+
ref: ref,
|
|
2115
|
+
name: name
|
|
2116
|
+
}, otherProps, {
|
|
2117
|
+
children: children
|
|
2118
|
+
}))]
|
|
2119
|
+
}));
|
|
2114
2120
|
};
|
|
2115
2121
|
|
|
2116
2122
|
const convertTextInputValue = (value, inCapitals) => {
|
|
@@ -2151,34 +2157,36 @@ const ReactHookFormTextField = _a => {
|
|
|
2151
2157
|
defaultValue
|
|
2152
2158
|
}, defaultProps));
|
|
2153
2159
|
const errors = getErrors(name, formErrors);
|
|
2154
|
-
return
|
|
2160
|
+
return jsx(ReactHookFormFormControl, Object.assign({
|
|
2155
2161
|
className: className,
|
|
2156
2162
|
sx: sx,
|
|
2157
2163
|
disabled: disabled,
|
|
2158
2164
|
errors: errors,
|
|
2159
2165
|
isReadOnly: isReadOnly
|
|
2160
|
-
},
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2166
|
+
}, {
|
|
2167
|
+
children: jsx(TextField, Object.assign({
|
|
2168
|
+
label: label,
|
|
2169
|
+
error: !!errors,
|
|
2170
|
+
helperText: helperText,
|
|
2171
|
+
value: value,
|
|
2172
|
+
variant: "filled",
|
|
2173
|
+
type: "text",
|
|
2174
|
+
name: name,
|
|
2175
|
+
onChange: evt => {
|
|
2176
|
+
const {
|
|
2177
|
+
value
|
|
2178
|
+
} = evt.target;
|
|
2179
|
+
const convertedValue = convertTextInputValue(value, upperCase);
|
|
2180
|
+
onChangeField(convertedValue);
|
|
2181
|
+
onChange(null);
|
|
2182
|
+
},
|
|
2183
|
+
disabled: disabled,
|
|
2184
|
+
inputRef: ref,
|
|
2185
|
+
InputProps: Object.assign(Object.assign({}, InputProps), isReadOnly && {
|
|
2186
|
+
readOnly: true
|
|
2187
|
+
})
|
|
2188
|
+
}, otherProps))
|
|
2189
|
+
}));
|
|
2182
2190
|
};
|
|
2183
2191
|
|
|
2184
2192
|
var wellKnownSymbol$7 = wellKnownSymbol$b;
|
|
@@ -2994,46 +3002,48 @@ const ReactHookFormNumberField = _a => {
|
|
|
2994
3002
|
}
|
|
2995
3003
|
};
|
|
2996
3004
|
const [displayValue, setDisplayValue] = React.useState(value === null || isNaN(value) ? '' : value);
|
|
2997
|
-
return
|
|
3005
|
+
return jsx(ReactHookFormFormControl, Object.assign({
|
|
2998
3006
|
className: className,
|
|
2999
3007
|
sx: sx,
|
|
3000
3008
|
disabled: disabled,
|
|
3001
3009
|
errors: errors,
|
|
3002
3010
|
isReadOnly: isReadOnly
|
|
3003
|
-
},
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3011
|
+
}, {
|
|
3012
|
+
children: jsx(TextField, Object.assign({
|
|
3013
|
+
label: label,
|
|
3014
|
+
error: !!errors,
|
|
3015
|
+
helperText: helperText,
|
|
3016
|
+
inputMode: inputMode,
|
|
3017
|
+
value: displayValue,
|
|
3018
|
+
variant: "filled",
|
|
3019
|
+
type: "text",
|
|
3020
|
+
inputProps: {
|
|
3021
|
+
inputMode
|
|
3022
|
+
},
|
|
3023
|
+
name: name,
|
|
3024
|
+
size: size,
|
|
3025
|
+
onChange: evt => {
|
|
3026
|
+
const {
|
|
3027
|
+
value
|
|
3028
|
+
} = evt.target;
|
|
3029
|
+
setDisplayValue(value);
|
|
3030
|
+
onChangeField(convertNumericInputValue(value, inputMode));
|
|
3031
|
+
onChange(null);
|
|
3032
|
+
},
|
|
3033
|
+
onKeyDown: onKeyDown,
|
|
3034
|
+
disabled: disabled,
|
|
3035
|
+
inputRef: ref,
|
|
3036
|
+
// eslint-disable-next-line react/jsx-no-duplicate-props
|
|
3037
|
+
InputProps: Object.assign(Object.assign(Object.assign({}, isReadOnly && {
|
|
3038
|
+
readOnly: true
|
|
3039
|
+
}), otherProps.InputProps), {
|
|
3040
|
+
onPaste
|
|
3041
|
+
})
|
|
3042
|
+
}, otherProps))
|
|
3043
|
+
}));
|
|
3034
3044
|
};
|
|
3035
3045
|
|
|
3036
|
-
const OpenPicker = () =>
|
|
3046
|
+
const OpenPicker = () => jsx(CalendarToday, {});
|
|
3037
3047
|
const getTimezoneOffset = value => value.getTimezoneOffset() * 60000;
|
|
3038
3048
|
const makeLocalAppearUTC = value => new Date(value.getTime() + getTimezoneOffset(value));
|
|
3039
3049
|
const localToUTC = dateTime => new Date(dateTime.getTime() - getTimezoneOffset(dateTime));
|
|
@@ -3102,71 +3112,75 @@ const ReactHookKeyboardDateTimePicker = _a => {
|
|
|
3102
3112
|
const now = makeLocalAppearUTC(dateUtils.utc());
|
|
3103
3113
|
const minDateTime = disablePast ? now : null;
|
|
3104
3114
|
const maxDateTime = disableFuture ? now : null;
|
|
3105
|
-
return
|
|
3115
|
+
return jsx(ReactHookFormFormControl, Object.assign({
|
|
3106
3116
|
disabled: disabled,
|
|
3107
3117
|
errors: errors,
|
|
3108
3118
|
className: className,
|
|
3109
3119
|
sx: sx,
|
|
3110
3120
|
isReadOnly: isReadOnly
|
|
3111
|
-
},
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3121
|
+
}, {
|
|
3122
|
+
children: jsx(DateTimePicker, Object.assign({
|
|
3123
|
+
desktopModeMediaQuery: "@media (min-width: 720px)",
|
|
3124
|
+
ampm: false,
|
|
3125
|
+
format: format,
|
|
3126
|
+
label: label,
|
|
3127
|
+
value: dateValue,
|
|
3128
|
+
openTo: openTo,
|
|
3129
|
+
disabled: disabled,
|
|
3130
|
+
onChange: value => {
|
|
3131
|
+
if (!value) {
|
|
3132
|
+
onChange(null);
|
|
3133
|
+
onChangeField(null);
|
|
3134
|
+
return;
|
|
3135
|
+
}
|
|
3136
|
+
const formattedDate = getFormattedValueForDatePicker(localToUTC(value));
|
|
3137
|
+
onChangeField(formattedDate);
|
|
3138
|
+
onChange(formattedDate);
|
|
3139
|
+
},
|
|
3140
|
+
inputRef: ref,
|
|
3141
|
+
slotProps: {
|
|
3142
|
+
textField: Object.assign({
|
|
3143
|
+
variant: 'filled',
|
|
3144
|
+
helperText,
|
|
3145
|
+
error: !!errors,
|
|
3146
|
+
name,
|
|
3147
|
+
placeholder: disabled ? '' : format.toLowerCase(),
|
|
3148
|
+
InputProps: Object.assign({}, !shouldHideUTC && {
|
|
3149
|
+
endAdornment: jsx(InputAdornment, Object.assign({
|
|
3150
|
+
style: {
|
|
3151
|
+
paddingTop: '16px'
|
|
3152
|
+
},
|
|
3153
|
+
position: "end"
|
|
3154
|
+
}, {
|
|
3155
|
+
children: "UTC"
|
|
3156
|
+
}))
|
|
3157
|
+
}),
|
|
3158
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3159
|
+
// @ts-ignore
|
|
3160
|
+
'data-testid': otherProps['data-testid']
|
|
3161
|
+
}, isReadOnly && {
|
|
3162
|
+
readOnly: true
|
|
3144
3163
|
}),
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
}),
|
|
3154
|
-
openPickerButton: {
|
|
3155
|
-
size: 'small',
|
|
3156
|
-
sx: {
|
|
3157
|
-
padding: 0
|
|
3164
|
+
inputAdornment: Object.assign({}, inputAdornment || {
|
|
3165
|
+
position: 'start'
|
|
3166
|
+
}),
|
|
3167
|
+
openPickerButton: {
|
|
3168
|
+
size: 'small',
|
|
3169
|
+
sx: {
|
|
3170
|
+
padding: 0
|
|
3171
|
+
}
|
|
3158
3172
|
}
|
|
3159
|
-
}
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
}
|
|
3173
|
+
},
|
|
3174
|
+
slots: {
|
|
3175
|
+
openPickerIcon: OpenPicker
|
|
3176
|
+
},
|
|
3177
|
+
timeSteps: {
|
|
3178
|
+
minutes: 1
|
|
3179
|
+
},
|
|
3180
|
+
minDateTime: minDateTime,
|
|
3181
|
+
maxDateTime: maxDateTime
|
|
3182
|
+
}, otherProps))
|
|
3183
|
+
}));
|
|
3170
3184
|
};
|
|
3171
3185
|
|
|
3172
3186
|
const defaultFormOptions = {
|
|
@@ -3181,16 +3195,22 @@ const ReactHookFormProvider = ({
|
|
|
3181
3195
|
// added this ignore as the build is failing otherwise on: Type instantiation is excessively deep and possibly infinite.
|
|
3182
3196
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3183
3197
|
// @ts-ignore
|
|
3184
|
-
return
|
|
3198
|
+
return jsx(FormProvider, Object.assign({}, formMethods, {
|
|
3199
|
+
children: children
|
|
3200
|
+
}));
|
|
3185
3201
|
};
|
|
3186
3202
|
const ReactHookFormProviderWrapper = ({
|
|
3187
3203
|
children,
|
|
3188
3204
|
options: _options2 = defaultFormOptions
|
|
3189
|
-
}) => (
|
|
3205
|
+
}) => jsx(LocalizationProvider, Object.assign({
|
|
3190
3206
|
dateAdapter: AdapterDateFns
|
|
3191
|
-
},
|
|
3192
|
-
|
|
3193
|
-
|
|
3207
|
+
}, {
|
|
3208
|
+
children: jsx(ReactHookFormProvider, Object.assign({
|
|
3209
|
+
options: _options2
|
|
3210
|
+
}, {
|
|
3211
|
+
children: children
|
|
3212
|
+
}))
|
|
3213
|
+
}));
|
|
3194
3214
|
|
|
3195
3215
|
const ReactHookFormHiddenInput = _a => {
|
|
3196
3216
|
var {
|
|
@@ -3210,9 +3230,9 @@ const ReactHookFormHiddenInput = _a => {
|
|
|
3210
3230
|
rules,
|
|
3211
3231
|
defaultValue
|
|
3212
3232
|
}, defaultProps));
|
|
3213
|
-
return field.value !== null ? (
|
|
3233
|
+
return field.value !== null ? jsx("input", Object.assign({}, field, {
|
|
3214
3234
|
type: "hidden"
|
|
3215
|
-
}, props))
|
|
3235
|
+
}, props)) : null;
|
|
3216
3236
|
};
|
|
3217
3237
|
|
|
3218
3238
|
// hidden input helpers, should not be part of send formdata
|
|
@@ -3239,9 +3259,9 @@ const useDraftFormHelpers = (isDefaultDraft = false) => {
|
|
|
3239
3259
|
const toggleIsDraft = isDraft => setValue(HIDDEN_INPUT_HELPER_IS_DRAFT, isDraft, {
|
|
3240
3260
|
shouldDirty: false
|
|
3241
3261
|
});
|
|
3242
|
-
const DraftFieldHelper = () => (
|
|
3262
|
+
const DraftFieldHelper = () => jsx("input", Object.assign({}, register(HIDDEN_INPUT_HELPER_IS_DRAFT), {
|
|
3243
3263
|
type: "hidden"
|
|
3244
|
-
}))
|
|
3264
|
+
}));
|
|
3245
3265
|
return {
|
|
3246
3266
|
isRequired,
|
|
3247
3267
|
toggleIsDraft,
|
|
@@ -3250,4 +3270,4 @@ const useDraftFormHelpers = (isDefaultDraft = false) => {
|
|
|
3250
3270
|
};
|
|
3251
3271
|
};
|
|
3252
3272
|
|
|
3253
|
-
export { HIDDEN_INPUT_HELPER_IS_DRAFT, ReactHookKeyboardDateTimePicker as ReactHookFormDateTime, ReactHookFormFormControl, ReactHookFormHiddenInput, ReactHookFormNumberField, ReactHookFormProviderWrapper as ReactHookFormProvider, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormTextField, defaultFormOptions, errorMessages, getDateValue, getDeepProperty, getFormattedValueForDatePicker, hasIntersectionWithFIR,
|
|
3273
|
+
export { HIDDEN_INPUT_HELPER_IS_DRAFT, ReactHookKeyboardDateTimePicker as ReactHookFormDateTime, ReactHookFormFormControl, ReactHookFormHiddenInput, ReactHookFormNumberField, ReactHookFormProviderWrapper as ReactHookFormProvider, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormTextField, defaultFormOptions, errorMessages, getDateValue, getDeepProperty, getFormattedValueForDatePicker, hasIntersectionWithFIR, hasMulitpleIntersections, hasValidGeometry, isEmpty, isGeometryDirty, isInteger, isLatitude, isLongitude, isMaximumOneDrawing, isNonOrBothCoordinates, isValidGeoJsonCoordinates, isValidMax, isValidMin, isXHoursAfter, isXHoursBefore, useDraftFormHelpers };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/form-fields",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.20.1",
|
|
4
4
|
"description": "GeoWeb form-fields library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"react-hook-form": "^7.50.1",
|
|
14
14
|
"@mui/x-date-pickers": "^6.18.5",
|
|
15
15
|
"lodash": "^4.17.21",
|
|
16
|
-
"@opengeoweb/shared": "9.
|
|
16
|
+
"@opengeoweb/shared": "9.20.1"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": "18"
|
|
@@ -21,4 +21,4 @@
|
|
|
21
21
|
"module": "./index.esm.js",
|
|
22
22
|
"type": "module",
|
|
23
23
|
"main": "./index.esm.js"
|
|
24
|
-
}
|
|
24
|
+
}
|
|
@@ -8,5 +8,5 @@ export * from './ReactHookFormDateTime';
|
|
|
8
8
|
export { default as ReactHookFormProvider } from './ReactHookFormProvider';
|
|
9
9
|
export { default as ReactHookFormHiddenInput } from './ReactHookFormHiddenInput';
|
|
10
10
|
export { defaultFormOptions } from './ReactHookFormProvider';
|
|
11
|
-
export { errorMessages, isMaximumOneDrawing, isGeometryDirty, isValidGeoJsonCoordinates, hasIntersectionWithFIR, isValidMax, isValidMin, isInteger,
|
|
11
|
+
export { errorMessages, isMaximumOneDrawing, hasValidGeometry, isGeometryDirty, isValidGeoJsonCoordinates, hasIntersectionWithFIR, isValidMax, isValidMin, isInteger, hasMulitpleIntersections, isLatitude, isLongitude, isNonOrBothCoordinates, isEmpty, isXHoursAfter, isXHoursBefore, } from './utils';
|
|
12
12
|
export { getDeepProperty } from './formUtils';
|
|
@@ -28,7 +28,6 @@ export declare const hasValidGeometry: (geojson?: GeoJSON.FeatureCollection | nu
|
|
|
28
28
|
export declare const isValidGeoJsonCoordinates: (geojson: GeoJSON.FeatureCollection) => boolean;
|
|
29
29
|
export declare const isMaximumOneDrawing: (geojson: GeoJSON.FeatureCollection) => boolean;
|
|
30
30
|
export declare const hasIntersectionWithFIR: (geojson: GeoJSON.FeatureCollection, intersection: GeoJSON.FeatureCollection) => boolean;
|
|
31
|
-
export declare const hasMaxFeaturePoints: (geojson: GeoJSON.FeatureCollection, maxPoints?: number) => boolean;
|
|
32
31
|
export declare const hasMulitpleIntersections: (geojson: GeoJSON.FeatureCollection) => boolean;
|
|
33
32
|
export declare const isGeometryDirty: (geoJSON?: GeoJSON.FeatureCollection | null, formGeoJSON?: GeoJSON.FeatureCollection | null) => boolean;
|
|
34
33
|
export declare const isInteger: (value: number) => boolean;
|