Skip to content

Commit

Permalink
Fixed #1459 - Add panelClassName and panelStyle for MultiSelect
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Sep 19, 2020
1 parent b955668 commit de8af2e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/components/multiselect/MultiSelect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ interface MultiSelectProps {
optionValue?: string;
style?: object;
className?: string;
panelClassName?: string;
panelStyle?: object;
scrollHeight?: string;
placeholder?: string;
fixedPlaceholder?: boolean;
Expand Down
6 changes: 5 additions & 1 deletion src/components/multiselect/MultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export class MultiSelect extends Component {
optionValue: null,
style: null,
className: null,
panelClassName: null,
panelStyle: null,
scrollHeight: '200px',
placeholder: null,
fixedPlaceholder: false,
Expand Down Expand Up @@ -59,6 +61,8 @@ export class MultiSelect extends Component {
optionValue: PropTypes.string,
style: PropTypes.object,
className: PropTypes.string,
panelClassName: PropTypes.string,
panelStyle: PropTypes.object,
scrollHeight: PropTypes.string,
placeholder: PropTypes.string,
fixedPlaceholder: PropTypes.bool,
Expand Down Expand Up @@ -637,7 +641,7 @@ export class MultiSelect extends Component {
<CSSTransition classNames="p-connected-overlay" in={this.state.overlayVisible} timeout={{ enter: 120, exit: 100 }}
unmountOnExit onEnter={this.onOverlayEnter} onEntered={this.onOverlayEntered} onExit={this.onOverlayExit} onExited={this.onOverlayExited}>
<MultiSelectPanel ref={el => this.panel = el} header={header} appendTo={this.props.appendTo}
scrollHeight={this.props.scrollHeight}>
scrollHeight={this.props.scrollHeight} panelClassName={this.props.panelClassName} panelStyle={this.props.panelStyle}>
{items}
</MultiSelectPanel>
</CSSTransition>
Expand Down
12 changes: 9 additions & 3 deletions src/components/multiselect/MultiSelectPanel.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import ReactDOM from 'react-dom';
import classNames from 'classnames';

export class MultiSelectPanel extends Component {

static defaultProps = {
appendTo: null,
header: null,
onClick: null,
scrollHeight: null
scrollHeight: null,
panelClassName: null,
panelStyle: null,
};

static propTypes = {
appendTo: PropTypes.object,
header: PropTypes.any,
onClick: PropTypes.func,
scrollHeight: PropTypes.string
scrollHeight: PropTypes.string,
panelClassName: PropTypes.string,
panelStyle: PropTypes.object,
};

renderElement() {
const panelClassName = classNames('p-multiselect-panel p-component', this.props.panelClassName);
return (
<div className="p-multiselect-panel p-component"
<div className={panelClassName} style={this.props.panelStyle}
ref={(el) => this.element = el} onClick={this.props.onClick}>
{this.props.header}
<div className="p-multiselect-items-wrapper" style={{ maxHeight: this.props.scrollHeight }}>
Expand Down

0 comments on commit de8af2e

Please sign in to comment.