Allow removing filter on Dropdown Widget

This commit is contained in:
Aswath K 2021-03-30 22:10:23 +05:30
parent a63ea5102c
commit b447aa8345
2 changed files with 14 additions and 1 deletions

View File

@ -259,7 +259,7 @@ class DropDownComponent extends React.Component<DropDownComponentProps> {
<StyledSingleDropDown
className={this.props.isLoading ? Classes.SKELETON : ""}
items={this.props.options}
filterable={true}
filterable={this.props.isFilterable}
itemRenderer={this.renderSingleSelectItem}
onItemSelect={this.onItemSelect}
disabled={this.props.disabled}
@ -414,6 +414,7 @@ export interface DropDownComponentProps extends ComponentProps {
selectedIndexArr: number[];
options: DropdownOption[];
isLoading: boolean;
isFilterable: boolean;
width: number;
height: number;
}

View File

@ -58,6 +58,15 @@ class DropdownWidget extends BaseWidget<DropdownWidgetProps, WidgetState> {
isBindProperty: true,
isTriggerProperty: false,
},
{
propertyName: "isFilterable",
label: "Filterable",
helpText: "Makes the dropdown list filterable",
controlType: "SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
},
{
propertyName: "isRequired",
label: "Required",
@ -111,6 +120,7 @@ class DropdownWidget extends BaseWidget<DropdownWidgetProps, WidgetState> {
options: VALIDATION_TYPES.OPTIONS_DATA,
selectionType: VALIDATION_TYPES.TEXT,
isRequired: VALIDATION_TYPES.BOOLEAN,
isFilterable: VALIDATION_TYPES.BOOLEAN,
// onOptionChange: VALIDATION_TYPES.ACTION_SELECTOR,
selectedOptionValues: VALIDATION_TYPES.ARRAY,
selectedOptionLabels: VALIDATION_TYPES.ARRAY,
@ -180,6 +190,7 @@ class DropdownWidget extends BaseWidget<DropdownWidgetProps, WidgetState> {
selectedIndexArr={computedSelectedIndexArr}
label={`${this.props.label}`}
isLoading={this.props.isLoading}
isFilterable={this.props.isFilterable}
disabled={this.props.isDisabled}
/>
);
@ -277,6 +288,7 @@ export interface DropdownWidgetProps extends WidgetProps, WithMeta {
onOptionChange?: string;
defaultOptionValue?: string | string[];
isRequired: boolean;
isFilterable: boolean;
selectedOptionValue: string;
selectedOptionValueArr: string[];
selectedOptionLabels: string[];