@opengeoweb/form-fields 9.9.0 → 9.10.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.
Files changed (2) hide show
  1. package/index.esm.js +30 -4
  2. package/package.json +2 -2
package/index.esm.js CHANGED
@@ -195,8 +195,13 @@ var hasIntersectionWithFIR = function hasIntersectionWithFIR(geojson, intersecti
195
195
  }
196
196
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
197
197
  // @ts-ignore
198
- var coordinates = intersection.features[0].geometry.coordinates;
199
- if (coordinates.length > 0 && coordinates[0].length === 0) {
198
+ var _intersection$feature = intersection.features[0].geometry,
199
+ coordinates = _intersection$feature.coordinates,
200
+ type = _intersection$feature.type;
201
+ if (type === 'Point' && coordinates.length === 0) {
202
+ return false;
203
+ }
204
+ if (type !== 'Point' && coordinates.length > 0 && coordinates[0].length === 0) {
200
205
  return false;
201
206
  }
202
207
  return true;
@@ -626,7 +631,26 @@ var ReactHookFormNumberField = function ReactHookFormNumberField(_a) {
626
631
  formErrors = _useController.formState.errors;
627
632
  var errors = getErrors(name, formErrors);
628
633
  var allowedKeyes = getAllowedKeys(inputMode);
634
+ var onPaste = function onPaste(event) {
635
+ var clipboardText = event.clipboardData.getData('text/plain');
636
+ var inputElement = event.target;
637
+ var before = inputElement.value.slice(0, inputElement.selectionStart);
638
+ var after = inputElement.value.slice(inputElement.selectionEnd);
639
+ var newValue = before + clipboardText + after;
640
+ if (inputMode === 'numeric' && !newValue.match(/^\-?[0-9]+$/)) {
641
+ event.preventDefault();
642
+ }
643
+ if (inputMode === 'decimal' && !newValue.match(/^\-?[0-9]*(\.[0-9]+)?$/)) {
644
+ event.preventDefault();
645
+ }
646
+ };
629
647
  var onKeyDown = function onKeyDown(event) {
648
+ var isMac = window.navigator.userAgent.includes(' Mac ');
649
+ if (isMac && event.metaKey || !isMac && event.ctrlKey) {
650
+ if (['c', 'v', 'x'].includes(event.key.toLowerCase())) {
651
+ return;
652
+ }
653
+ }
630
654
  if (!allowedKeyes.includes(event.key) ||
631
655
  // only allow one seperator
632
656
  event.key === '.' && event.target.value.includes('.') ||
@@ -668,9 +692,11 @@ var ReactHookFormNumberField = function ReactHookFormNumberField(_a) {
668
692
  disabled: disabled,
669
693
  inputRef: ref,
670
694
  // eslint-disable-next-line react/jsx-no-duplicate-props
671
- InputProps: Object.assign(Object.assign({}, isReadOnly && {
695
+ InputProps: Object.assign(Object.assign(Object.assign({}, isReadOnly && {
672
696
  readOnly: true
673
- }), otherProps.InputProps)
697
+ }), otherProps.InputProps), {
698
+ onPaste: onPaste
699
+ })
674
700
  }, otherProps)));
675
701
  };
676
702
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/form-fields",
3
- "version": "9.9.0",
3
+ "version": "9.10.1",
4
4
  "description": "GeoWeb form-fields library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -8,7 +8,7 @@
8
8
  "url": "git@gitlab.com:opengeoweb/opengeoweb.git"
9
9
  },
10
10
  "dependencies": {
11
- "@mui/material": "5.12.0",
11
+ "@mui/material": "~5.15.11",
12
12
  "@opengeoweb/theme": "*",
13
13
  "react-hook-form": "^7.50.1",
14
14
  "moment": "^2.29.4",