From 39695ce1dacec9c456eab0818b060afd976843b9 Mon Sep 17 00:00:00 2001 From: Melloware Date: Tue, 17 Oct 2023 07:28:27 -0400 Subject: [PATCH] Fix #5102: TreeSelect filterTemplate typescript (#5105) --- components/lib/treeselect/treeselect.d.ts | 58 +++++++++++++++++++++-- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/components/lib/treeselect/treeselect.d.ts b/components/lib/treeselect/treeselect.d.ts index 3c739f2cdd..10a30ec2c4 100644 --- a/components/lib/treeselect/treeselect.d.ts +++ b/components/lib/treeselect/treeselect.d.ts @@ -277,15 +277,65 @@ interface TreeSelectFilterValueChangeEvent { value: string; } +/** + * Custom filter template options. + */ +interface TreeSelectFilterTemplateOptions { + /** + * Style class of the filter. + */ + className: string; + /** + * Whether the option is disabled or not + */ + disabled?: boolean; + /** + * The filter element. + */ + element: HTMLDivElement; + /** + * The filter. + */ + filter?: string; + /** + * Icon of the filter. + */ + filterIcon?: IconType | string; + /** + * Style class of the filter icon. + */ + filterIconClassName: string; + /** + * Browser change event for the filter input element. + */ + filterInputChange?: React.ChangeEvent; + /** + * The props of the filter input element. + */ + filterInputProps?: any; + /** + * The filter input options. + */ + filterOptions?: TreeSelectFilterOptions; + /** + * The placeholder of the filter element. + */ + filterPlaceholder?: string; + /** + * Custom filter template. + */ + filterTemplate?: React.ReactNode | ((options: TreeSelectFilterTemplateOptions) => React.ReactNode); +} + /** * Custom filter options. */ interface TreeSelectFilterOptions { /** * Used to filter options - * @param {KeyboardEvent} event - Browser event. + * @param { React.ChangeEvent} event - Browser event. */ - filter?: (event?: KeyboardEvent) => void; + filter?: (event?: React.ChangeEvent) => void; /** * Used to reset the filtered options */ @@ -384,9 +434,9 @@ export interface TreeSelectProps extends Omit React.ReactNode); + filterTemplate?: React.ReactNode | ((options: TreeSelectFilterTemplateOptions) => React.ReactNode); /** * When filtering is enabled, the value of input field. */