Skip to content

Commit

Permalink
fix: #5613, TreeSelect: TreeSelect component is not supporting toolti…
Browse files Browse the repository at this point in the history
…ps and is an issue in multiple select mode. (#5615)

Co-authored-by: Akshay Antony <[email protected]>
  • Loading branch information
akshayaqburst and akshayantony55 authored Dec 18, 2023
1 parent 85e69a5 commit 0983026
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/lib/treeselect/TreeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Tree } from '../tree/Tree';
import { DomHandler, IconUtils, ObjectUtils, ZIndexUtils, mergeProps } from '../utils/Utils';
import { TreeSelectBase } from './TreeSelectBase';
import { TreeSelectPanel } from './TreeSelectPanel';
import { Tooltip } from '../tooltip/Tooltip';

export const TreeSelect = React.memo(
React.forwardRef((inProps, ref) => {
Expand All @@ -33,6 +34,7 @@ export const TreeSelect = React.memo(
const hasNoOptions = ObjectUtils.isEmpty(props.options);
const isSingleSelectionMode = props.selectionMode === 'single';
const isCheckboxSelectionMode = props.selectionMode === 'checkbox';
const hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);

const metaData = {
props,
Expand Down Expand Up @@ -744,6 +746,7 @@ export const TreeSelect = React.memo(
>
{content}
</TreeSelectPanel>
{hasTooltip && <Tooltip target={elementRef} content={props.tooltip} {...props.tooltipOptions} pt={ptm('tooltip')} />}
</div>
);
})
Expand Down
15 changes: 15 additions & 0 deletions components/lib/treeselect/treeselect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { TreeNodeTemplateOptions, TreePassThroughOptions, TreeTogglerTemplateOpt
import { TreeNode } from '../treenode';
import { FormEvent } from '../ts-helpers';
import { IconType, PassThroughType } from '../utils/utils';
import { TooltipPassThroughOptions } from '../tooltip/tooltip';
import { TooltipOptions } from '../tooltip/tooltipoptions';

export declare type TreeSelectPassThroughType<T> = PassThroughType<T, TreeSelectPassThroughMethodOptions>;
export declare type TreeSelectPassThroughTransitionType = ReactCSSTransitionProps | ((options: TreeSelectPassThroughMethodOptions) => ReactCSSTransitionProps) | undefined;
Expand Down Expand Up @@ -123,6 +125,11 @@ export interface TreeSelectPassThroughOptions {
* Used to control React Transition API.
*/
transition?: TreeSelectPassThroughTransitionType;
/**
* Uses to pass attributes to the Tooltip component.
* @see {@link TooltipPassThroughOptions}
*/
tooltip?: TooltipPassThroughOptions;
}

/**
Expand Down Expand Up @@ -524,6 +531,14 @@ export interface TreeSelectProps extends Omit<React.DetailedHTMLProps<React.Inpu
* Defines the selection mode, valid values "single", "multiple", and "checkbox".
*/
selectionMode?: 'single' | 'multiple' | 'checkbox' | undefined;
/**
* Content of the tooltip.
*/
tooltip?: string | undefined;
/**
* Configuration of the tooltip, refer to the tooltip documentation for more information.
*/
tooltipOptions?: TooltipOptions | undefined;
/**
* The properties of CSSTransition can be customized, except for "nodeRef" and "in" properties.
*/
Expand Down

0 comments on commit 0983026

Please sign in to comment.