@mtes-mct/monitor-ui 24.29.2 → 24.30.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.
@@ -1,4 +1,5 @@
1
1
  import { CustomSearch } from '@libs/CustomSearch';
2
+ import { type SyntheticEvent } from 'react';
2
3
  import { type CheckTreePickerProps as RsuiteCheckTreePickerProps } from 'rsuite';
3
4
  import type { TreeOption } from './types';
4
5
  import type { Promisable } from 'type-fest';
@@ -16,6 +17,7 @@ export type CheckTreePickerProps = Omit<RsuiteCheckTreePickerProps, 'as' | 'cont
16
17
  label: string;
17
18
  name: string;
18
19
  onChange?: (nextValue: any[] | undefined) => Promisable<void>;
20
+ onSearch?: (query: string, event: SyntheticEvent<Element, Event>) => void;
19
21
  options: TreeOption[];
20
22
  popupWidth?: number | undefined;
21
23
  renderedChildrenValue?: string;
@@ -23,5 +25,5 @@ export type CheckTreePickerProps = Omit<RsuiteCheckTreePickerProps, 'as' | 'cont
23
25
  shouldShowLabels?: boolean;
24
26
  value?: TreeOption[] | undefined;
25
27
  };
26
- export declare function CheckTreePicker({ childrenKey, className, customSearch, customSearchMinQueryLength, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isMultiSelect, isRequired, isTransparent, isUndefinedWhenDisabled, label, labelKey, onChange, options, popupWidth, readOnly, renderedChildrenValue, renderedValue, shouldShowLabels, style, value, valueKey, ...originalProps }: CheckTreePickerProps): import("react/jsx-runtime").JSX.Element;
28
+ export declare function CheckTreePicker({ childrenKey, className, customSearch, customSearchMinQueryLength, disabled, error, isErrorMessageHidden, isLabelHidden, isLight, isMultiSelect, isRequired, isTransparent, isUndefinedWhenDisabled, label, labelKey, onChange, onSearch, options, popupWidth, readOnly, renderedChildrenValue, renderedValue, shouldShowLabels, style, value, valueKey, ...originalProps }: CheckTreePickerProps): import("react/jsx-runtime").JSX.Element;
27
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","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tB"}
package/index.js CHANGED
@@ -30096,7 +30096,7 @@ function getOptionsToDisplay(allOptions, selectedOptions, childrenKey = 'childre
30096
30096
  return result;
30097
30097
  }
30098
30098
 
30099
- function CheckTreePicker({ childrenKey = 'children', className, customSearch, customSearchMinQueryLength = 1, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isMultiSelect = true, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, labelKey = 'label', onChange, options, popupWidth, readOnly = false, renderedChildrenValue = 'Sous-thématique', renderedValue = 'Thématique', shouldShowLabels = true, style, value, valueKey = 'value', ...originalProps }) {
30099
+ function CheckTreePicker({ childrenKey = 'children', className, customSearch, customSearchMinQueryLength = 1, disabled = false, error, isErrorMessageHidden = false, isLabelHidden = false, isLight = false, isMultiSelect = true, isRequired = false, isTransparent = false, isUndefinedWhenDisabled = false, label, labelKey = 'label', onChange, onSearch, options, popupWidth, readOnly = false, renderedChildrenValue = 'Sous-thématique', renderedValue = 'Thématique', shouldShowLabels = true, style, value, valueKey = 'value', ...originalProps }) {
30100
30100
  // eslint-disable-next-line no-null/no-null
30101
30101
  const boxRef = useRef(null);
30102
30102
  const controlledClassName = useMemo(()=>classnames('Field-CheckTreePicker', className), [
@@ -30191,7 +30191,7 @@ function CheckTreePicker({ childrenKey = 'children', className, customSearch, cu
30191
30191
  valueKey,
30192
30192
  labelKey
30193
30193
  ]);
30194
- const handleSearch = useCallback((nextQuery)=>{
30194
+ const handleSearch = useCallback((nextQuery, event)=>{
30195
30195
  setSearchKeyword(nextQuery);
30196
30196
  if (!localCustomSearch || nextQuery.trim().length < customSearchMinQueryLength) {
30197
30197
  setControlledOptions(options);
@@ -30214,12 +30214,16 @@ function CheckTreePicker({ childrenKey = 'children', className, customSearch, cu
30214
30214
  ...selectedOptions
30215
30215
  ].map((item)=>deepCloneExtensible(item)));
30216
30216
  setControlledOptions(merged);
30217
+ if (onSearch) {
30218
+ onSearch(nextQuery, event);
30219
+ }
30217
30220
  }, [
30218
30221
  childrenKey,
30219
30222
  customSearchMinQueryLength,
30220
30223
  labelKey,
30221
30224
  localCustomSearch,
30222
30225
  mergeResultsByParent,
30226
+ onSearch,
30223
30227
  options,
30224
30228
  value,
30225
30229
  valueKey
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtes-mct/monitor-ui",
3
3
  "description": "Common React components, hooks, utilities and CSS stylesheets for MonitorFish, MonitorEnv and RapportNav.",
4
- "version": "24.29.2",
4
+ "version": "24.30.0",
5
5
  "license": "AGPL-3.0",
6
6
  "type": "module",
7
7
  "engines": {