Skip to content

Commit

Permalink
fix: primefaces#5613, TreeSelect: TreeSelect component is not support…
Browse files Browse the repository at this point in the history
…ing tooltips and is an issue in multiple select mode
  • Loading branch information
melloware committed Jan 9, 2024
1 parent 5c5ebb1 commit 33fbffa
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 @@ -7,6 +7,7 @@ import { SearchIcon } from '../icons/search';
import { TimesIcon } from '../icons/times';
import { OverlayService } from '../overlayservice/OverlayService';
import { Ripple } from '../ripple/Ripple';
import { Tooltip } from '../tooltip/Tooltip';
import { Tree } from '../tree/Tree';
import { DomHandler, IconUtils, ObjectUtils, ZIndexUtils, mergeProps } from '../utils/Utils';
import { TreeSelectBase } from './TreeSelectBase';
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 @@ -12,6 +12,8 @@ import { CSSTransitionProps as ReactCSSTransitionProps } from 'react-transition-
import { ComponentHooks } from '../componentbase/componentbase';
import { CSSTransitionProps } from '../csstransition';
import { PassThroughOptions } from '../passthrough';
import { TooltipPassThroughOptions } from '../tooltip/tooltip';
import { TooltipOptions } from '../tooltip/tooltipoptions';
import { TreeNodeTemplateOptions, TreePassThroughOptions, TreeTogglerTemplateOptions } from '../tree/tree';
import { TreeNode } from '../treenode';
import { FormEvent } from '../ts-helpers';
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 33fbffa

Please sign in to comment.