Skip to content

Commit

Permalink
Fix #5102: TreeSelect filterTemplate typescript (#5105)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Oct 17, 2023
1 parent bf5ba6f commit 39695ce
Showing 1 changed file with 54 additions and 4 deletions.
58 changes: 54 additions & 4 deletions components/lib/treeselect/treeselect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<TreeSelect> | string;
/**
* Style class of the filter icon.
*/
filterIconClassName: string;
/**
* Browser change event for the filter input element.
*/
filterInputChange?: React.ChangeEvent<HTMLInputElement>;
/**
* 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<HTMLInputElement>} event - Browser event.
*/
filter?: (event?: KeyboardEvent) => void;
filter?: (event?: React.ChangeEvent<HTMLInputElement>) => void;
/**
* Used to reset the filtered options
*/
Expand Down Expand Up @@ -384,9 +434,9 @@ export interface TreeSelectProps extends Omit<React.DetailedHTMLProps<React.Inpu
*/
filterPlaceholder?: string | undefined;
/**
* The template for filter element.
* Custom template for the filter element.
*/
filterTemplate?: React.ReactNode | ((options: TreeSelectFilterOptions) => React.ReactNode);
filterTemplate?: React.ReactNode | ((options: TreeSelectFilterTemplateOptions) => React.ReactNode);
/**
* When filtering is enabled, the value of input field.
*/
Expand Down

0 comments on commit 39695ce

Please sign in to comment.