-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use react-virtualized to virtualize EuiComboBox options list (#670)
* use react-virtualized to virtualize combo box options list * use smaller width and height * include group label in matching options list * add better text for example description * dynamically set width and height * Massage group title padding. Truncate text instead of wrapping it. Add title attribute to options for usability. (#1) * remove console.log and fix spelling * fix problems with settig focus on active option * more keyboard accessiblity work * Combo box focus state and text overflow (#2) * Call setState instead of setting activeOptionIndex directly. * Clear activeOptionIndex when you click the input. * Prevent a lot of input from overflowing the container. * Allow disabled options to be focused but not selected. * add throttle to incrementActiveOptionIndex to avoid keypresses getting UI out of sync * rowHeight prop * remove unneeded const * fix spacing in example text, fix lodash import * skip disabled options when using keyboard * Revert "skip disabled options when using keyboard" This reverts commit 47fa3ef.
- Loading branch information
Showing
14 changed files
with
281 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React, { Component } from 'react'; | ||
|
||
import { | ||
EuiComboBox, | ||
} from '../../../../src/components'; | ||
|
||
export default class extends Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.options = []; | ||
let groupOptions = []; | ||
for (let i=1; i < 5000; i++) { | ||
groupOptions.push({ label: `option${i}` }); | ||
if (i % 25 === 0) { | ||
this.options.push({ | ||
label: `Options ${i - (groupOptions.length - 1)} to ${i}`, | ||
options: groupOptions | ||
}); | ||
groupOptions = []; | ||
} | ||
} | ||
|
||
this.state = { | ||
selectedOptions: [], | ||
}; | ||
} | ||
|
||
onChange = (selectedOptions) => { | ||
this.setState({ | ||
selectedOptions, | ||
}); | ||
}; | ||
|
||
render() { | ||
const { selectedOptions } = this.state; | ||
return ( | ||
<EuiComboBox | ||
placeholder="Select or create options" | ||
options={this.options} | ||
selectedOptions={selectedOptions} | ||
onChange={this.onChange} | ||
/> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.