Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ React.render(
<td>></td>
<td>specific the default loading icon</td>
</tr>
<tr>
<td>popupVisibleAfterSelect</td>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<td>popupVisibleAfterSelect</td>
<td>hidePopupOnSelect</td>

<td>Boolean</td>
<td>>false</td>
<td>visibility of popup overlay when finishing cascader select</td>
</tr>
</tbody>
</table>

Expand Down
5 changes: 4 additions & 1 deletion src/Cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface CascaderProps extends Pick<TriggerProps, 'getPopupContainer'> {
filedNames?: CascaderFieldNames; // typo but for compatibility
expandIcon?: React.ReactNode;
loadingIcon?: React.ReactNode;
popupVisibleAfterSelect?: boolean;
}

interface CascaderState {
Expand Down Expand Up @@ -103,6 +104,7 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
expandTrigger: 'click',
fieldNames: { label: 'label', value: 'value', children: 'children' },
expandIcon: '>',
popupVisibleAfterSelect: false,
};

static getDerivedStateFromProps(nextProps: CascaderProps, prevState: CascaderState) {
Expand Down Expand Up @@ -190,7 +192,8 @@ class Cascader extends React.Component<CascaderProps, CascaderState> {
options.map((o) => o[this.getFieldName('value')]),
options,
);
this.setPopupVisible(visible);
const { popupVisibleAfterSelect } = this.props;
this.setPopupVisible(visible || popupVisibleAfterSelect);
}
};

Expand Down