Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-tree-dropdown-",
"version": "2.1.2",
"version": "3.1.0",
"description": "Lightweight, customizable and fast Dropdown Tree Select component for React",
"keywords": [
"react",
Expand All @@ -25,8 +25,6 @@
"scripts": {
"build": "rimraf dist/**/* && cross-env NODE_ENV=production webpack --config webpack.config.js --bail --mode=production",
"build:docs": "yarn build && cross-env NODE_ENV=production webpack --config docs/webpack.config.js --bail --mode=production",
"commit": "git-cz",
"commitmsg": "commitlint -e $GIT_PARAMS",
"coveralls": "nyc npm test && nyc report --reporter=text-lcov | coveralls",
"demo": "rimraf ./docs/bundle.js && webpack-serve --content ./docs --port 3000 --open --config docs/webpack.config.js",
"prepublishOnly": "npm run build",
Expand All @@ -44,13 +42,11 @@
"dependencies": {
"array.partial": "^1.0.4",
"classnames": "^2.2.6",
"react-infinite-scroll-component": "^4.0.2"
"react-infinite-scroll-component": "^6.1.0"
},
"devDependencies": {
"@babel/plugin-syntax-jsx": "7.0.0-beta.46",
"@babel/preset-stage-3": "7.0.0-beta.46",
"@commitlint/cli": "^7.0.0",
"@commitlint/config-conventional": "^7.0.0",
"all-contributors-cli": "^5.4.1",
"ava": "1.0.0-beta.4",
"babel-core": "6.24.1",
Expand All @@ -77,7 +73,6 @@
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0",
"github-markdown-css": "^2.10.0",
"husky": "^0.14.3",
"ignore-styles": "^5.0.1",
"jsdom": "^11.2.0",
"jsdom-global": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class DropdownTreeSelect extends Component {
}}
>
<div className="dropdown">
<a className={dropdownTriggerClassname} onClick={!this.props.disabled && this.handleClick}>
<a className={dropdownTriggerClassname} onClick={!this.props.disabled ? this.handleClick : undefined}>
<Input
inputRef={el => {
this.searchInput = el
Expand Down
1 change: 1 addition & 0 deletions src/input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const getTags = (tags = [], onDelete, readOnly, tagRenderer) =>
<Tag
label={label}
id={_id}
originalObject={tag}
onDelete={onDelete}
readOnly={readOnly}
tagRenderer={tagRenderer}
Expand Down
7 changes: 4 additions & 3 deletions src/tag/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Tag extends PureComponent {
static propTypes = {
id: PropTypes.string.isRequired,
label: PropTypes.string.isRequired,
originalObject: PropTypes.object,
onDelete: PropTypes.func,
tagRenderer: PropTypes.func,
readOnly: PropTypes.bool
Expand All @@ -23,13 +24,13 @@ class Tag extends PureComponent {
}

render() {
const { label, readOnly, tagRenderer } = this.props
const { label, originalObject, readOnly, tagRenderer } = this.props

return tagRenderer
? tagRenderer(label, this.handleClick)
? tagRenderer(originalObject, this.handleClick)
: <span className={cx('tag')}>
{label}
<button onClick={!readOnly && this.handleClick} className={cx('tag-remove', { readOnly })} type="button">
<button onClick={!readOnly ? this.handleClick : undefined} className={cx('tag-remove', { readOnly })} type="button">
x
</button>
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/tree-node/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Action extends PureComponent {
const { title, className, text, readOnly } = this.props

return (
<i title={title} className={className} onClick={!readOnly && this.handleClick}>
<i title={title} className={className} onClick={!readOnly ? this.handleClick : undefined}>
{text}
</i>
)
Expand Down
2 changes: 1 addition & 1 deletion src/tree/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class Tree extends Component {
dataLength={this.state.items.length}
next={this.loadMore}
hasMore={this.hasMore()}
loader={<span className="searchLoader">Loading...</span>}
loader={null}
scrollableTarget={this.state.scrollableTarget}
>
{this.state.items}
Expand Down
8 changes: 7 additions & 1 deletion src/utils/isOutsideClick.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@ const getPath = e => {
export default (e, className) => {
if (!(e instanceof Event)) return false
const completeClassName = className ? `${className} react-dropdown-tree-select` : 'react-dropdown-tree-select'
return !getPath(e).some(node => node.className && node.className.indexOf(completeClassName) >= 0)
return !getPath(e).some(node => {
const { className } = node
if (className && !!className.indexOf) {
return node.className.indexOf(completeClassName) >= 0
}
return false
})
}
Loading