Skip to content
This repository was archived by the owner on May 4, 2019. It is now read-only.

Commit 9b3b447

Browse files
committed
feat: add option in basic filter props to hide unclickable select msg
1 parent bfd83b4 commit 9b3b447

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/Filter/BasicFilter.tsx

+9-10
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,7 @@ export class BasicFilter extends React.Component<BasicFilterProps, {}> {
122122
const selected = filterOptions.find(fil => fil.isSelected === true);
123123
const selectedValue = selected ? selected.key : defaultValue;
124124

125-
let selectOptions: SelectOptionProps[] = [];
126-
selectOptions.push({
127-
disabled,
128-
selected: selectedValue === defaultValue,
129-
label: `Select ${label}`,
130-
value: defaultValue
131-
});
132-
133-
const filterSelectOptions = filterOptions.map(fo => {
125+
const selectOptions = filterOptions.map(fo => {
134126
return {
135127
disabled,
136128
selected: selectedValue === fo.key,
@@ -139,7 +131,14 @@ export class BasicFilter extends React.Component<BasicFilterProps, {}> {
139131
};
140132
});
141133

142-
selectOptions = selectOptions.concat(filterSelectOptions);
134+
if (!this.props.hideSelectMessage) {
135+
selectOptions.splice(0, 0, {
136+
disabled,
137+
selected: selectedValue === defaultValue,
138+
label: `Select ${label}`,
139+
value: defaultValue
140+
});
141+
}
143142

144143
return (
145144
<Select

src/Filter/FilterModels.ts

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export interface FilterOptionModel {
8686
export interface BasicFilterCategoryModel extends FilterCategoryModel {
8787
optionType: OptionTypeModel;
8888
placeholderText?: string;
89+
hideSelectMessage?: boolean;
8990
}
9091

9192
export interface FilterCategoryModel {

0 commit comments

Comments
 (0)