Skip to content

Commit

Permalink
Fix primefaces#4716: TreeSelect showClear and clearIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Aug 14, 2023
1 parent 8ffc9fe commit 12f1e83
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/lib/dropdown/Dropdown.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import PrimeReact, { FilterService } from '../api/Api';
import { PrimeReactContext } from '../api/Api';
import PrimeReact, { FilterService, PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMountEffect, useOverlayListener, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { ChevronDownIcon } from '../icons/chevrondown';
import { TimesIcon } from '../icons/times';
Expand All @@ -9,7 +9,6 @@ import { Tooltip } from '../tooltip/Tooltip';
import { DomHandler, IconUtils, ObjectUtils, ZIndexUtils, mergeProps } from '../utils/Utils';
import { DropdownBase } from './DropdownBase';
import { DropdownPanel } from './DropdownPanel';
import { useHandleStyle } from '../componentbase/ComponentBase';

export const Dropdown = React.memo(
React.forwardRef((inProps, ref) => {
Expand Down Expand Up @@ -624,6 +623,7 @@ export const Dropdown = React.memo(
props,
show,
hide,
clear,
focus: () => DomHandler.focus(focusInputRef.current),
getElement: () => elementRef.current,
getOverlay: () => overlayRef.current,
Expand Down
12 changes: 12 additions & 0 deletions components/lib/dropdown/dropdown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,18 @@ export declare class Dropdown extends React.Component<DropdownProps, any> {
* Used to focus the component.
*/
public focus(): void;
/**
* Clear the currently selected value.
*/
public clear(): void;
/**
* Show the dropdown overlay panel.
*/
public show(): void;
/**
* Hide the dropdown overlay panel.
*/
public hide(): void;
/**
* Used to get container element.
* @return {HTMLDivElement} Container element
Expand Down
3 changes: 3 additions & 0 deletions components/lib/treeselect/TreeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ export const TreeSelect = React.memo(

React.useImperativeHandle(ref, () => ({
props,
clear,
show,
hide,
focus: () => DomHandler.focus(focusInputRef.current),
getElement: () => elementRef.current
}));
Expand Down
12 changes: 12 additions & 0 deletions components/lib/treeselect/treeselect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,18 @@ export declare class TreeSelect extends React.Component<TreeSelectProps, any> {
* Used to focus the component.
*/
public focus(): void;
/**
* Clear the currently selected value.
*/
public clear(): void;
/**
* Show the dropdown overlay panel.
*/
public show(): void;
/**
* Hide the dropdown overlay panel.
*/
public hide(): void;
/**
* Used to get container element.
* @return {HTMLDivElement} Container element
Expand Down

0 comments on commit 12f1e83

Please sign in to comment.