@opengeoweb/form-fields 9.33.0 → 9.33.1-spike-ol.3

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
@@ -2517,11 +2517,16 @@ $$3({ target: 'Array', proto: true, forced: FORCED$1 }, {
2517
2517
  });
2518
2518
 
2519
2519
  function getDeepProperty(p, o) {
2520
- return p.reduce((xs, x) => xs && xs[x] ? xs[x] : null, o);
2520
+ return p.reduce((xs, x) => {
2521
+ if (xs && typeof xs === 'object' && x in xs) {
2522
+ return xs[x];
2523
+ }
2524
+ return null;
2525
+ }, o);
2521
2526
  }
2522
2527
  const getErrors = (name, errors) => {
2523
2528
  const nameAsArray = name.split('.');
2524
- return getDeepProperty(nameAsArray, errors);
2529
+ return getDeepProperty(nameAsArray, errors) || undefined;
2525
2530
  };
2526
2531
 
2527
2532
  const _excluded$5 = ["name", "label", "defaultValue", "children", "rules", "onChange", "disabled", "className", "sx", "isReadOnly", "size"];
@@ -2576,10 +2581,10 @@ const ReactHookFormSelect = _ref => {
2576
2581
  label: label,
2577
2582
  inputRef: ref,
2578
2583
  name: name,
2579
- onChange: changeEvent => {
2584
+ onChange: (changeEvent, child) => {
2580
2585
  onChangeField(changeEvent.target.value);
2581
2586
  // default props
2582
- onChange(changeEvent);
2587
+ onChange(changeEvent, child);
2583
2588
  },
2584
2589
  value: value || '',
2585
2590
  variant: "filled"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/form-fields",
3
- "version": "9.33.0",
3
+ "version": "9.33.1-spike-ol.3",
4
4
  "description": "GeoWeb form-fields library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -1,8 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { SelectProps } from '@mui/material';
3
3
  import { ReactHookFormInput } from './types';
4
- type ReactHookFormSelectProps = Partial<SelectProps> & ReactHookFormInput<{
5
- onChange?: (value: React.ChangeEvent<HTMLInputElement>) => void;
6
- }>;
4
+ type ReactHookFormSelectProps = Partial<SelectProps> & ReactHookFormInput<object>;
7
5
  declare const ReactHookFormSelect: React.FC<ReactHookFormSelectProps>;
8
6
  export default ReactHookFormSelect;
@@ -1,3 +1,3 @@
1
1
  import { FieldErrors } from 'react-hook-form';
2
- export declare function getDeepProperty<I>(p: string[], o: I): I;
3
- export declare const getErrors: (name: string, errors: FieldErrors) => FieldErrors;
2
+ export declare function getDeepProperty<I>(p: string[], o: I): I | null;
3
+ export declare const getErrors: (name: string, errors: FieldErrors) => FieldErrors | undefined;