-
Notifications
You must be signed in to change notification settings - Fork 858
Added delimiter prop to EuiComboBox
#3104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
4111a91
added delimenator prop
anishagg17 ac1f76d
Entering delimeator hits enter functionality added
anishagg17 fb452c2
added docs example, CL
anishagg17 406ec71
Merge branch 'master' into deim
anishagg17 386acbb
prettified
anishagg17 a133ba6
removed console.log()
anishagg17 c3142a4
added copy functionality
anishagg17 5d2cb23
added test,snap
anishagg17 e0a58bf
removed copy button
anishagg17 e89727a
removed copy button
anishagg17 ae3ae85
Update src-docs/src/views/combo_box/combo_box_example.js
anishagg17 864f5a9
Update src/components/combo_box/combo_box.tsx
anishagg17 ff3131a
fixed only first gets entered
anishagg17 4879bda
Merge branch 'deim' of https://github.com/anishagg17/eui into deim
anishagg17 b002be1
Merge branch 'master' into deim
anishagg17 fe9b420
Merge branch 'master' into deim
anishagg17 0c08b72
updated text
anishagg17 14f6499
Merge branch 'deim' of https://github.com/anishagg17/eui into deim
anishagg17 033499a
indent fix
anishagg17 e983a61
Update combo_box_options_list.tsx
anishagg17 5eeff79
Update src/components/combo_box/combo_box_options_list/combo_box_opti…
anishagg17 368c92c
Merge branch 'master' of https://github.com/elastic/eui into deim
anishagg17 bcd13cd
removed empty string
anishagg17 14ad843
removed redundant code
anishagg17 26ee787
Merge branch 'master' into deim
anishagg17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,97 @@ | ||
| import React, { Component } from 'react'; | ||
|
|
||
| import { EuiComboBox } from '../../../../src/components'; | ||
|
|
||
| export default class extends Component { | ||
| constructor(props) { | ||
| super(props); | ||
|
|
||
| this.options = [ | ||
| { | ||
| label: 'Titan', | ||
| 'data-test-subj': 'titanOption', | ||
| }, | ||
| { | ||
| label: 'Enceladus is disabled', | ||
| disabled: true, | ||
| }, | ||
| { | ||
| label: 'Mimas', | ||
| }, | ||
| { | ||
| label: 'Dione', | ||
| }, | ||
| { | ||
| label: 'Iapetus', | ||
| }, | ||
| { | ||
| label: 'Phoebe', | ||
| }, | ||
| { | ||
| label: 'Rhea', | ||
| }, | ||
| { | ||
| label: | ||
| "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology", | ||
| }, | ||
| { | ||
| label: 'Tethys', | ||
| }, | ||
| { | ||
| label: 'Hyperion', | ||
| }, | ||
| ]; | ||
|
|
||
| this.state = { | ||
| selectedOptions: [this.options[2], this.options[4]], | ||
| }; | ||
| } | ||
|
|
||
| onChange = selectedOptions => { | ||
| this.setState({ | ||
| selectedOptions, | ||
| }); | ||
| }; | ||
|
|
||
| onCreateOption = (searchValue, flattenedOptions) => { | ||
| const normalizedSearchValue = searchValue.trim().toLowerCase(); | ||
|
|
||
| if (!normalizedSearchValue) { | ||
| return; | ||
| } | ||
|
|
||
| const newOption = { | ||
| label: searchValue, | ||
| }; | ||
|
|
||
| // Create the option if it doesn't exist. | ||
| if ( | ||
| flattenedOptions.findIndex( | ||
| option => option.label.trim().toLowerCase() === normalizedSearchValue | ||
| ) === -1 | ||
| ) { | ||
| this.options.push(newOption); | ||
| } | ||
|
|
||
| // Select the option. | ||
| this.setState(prevState => ({ | ||
| selectedOptions: prevState.selectedOptions.concat(newOption), | ||
| })); | ||
| }; | ||
|
|
||
| render() { | ||
| const { selectedOptions } = this.state; | ||
| return ( | ||
| <EuiComboBox | ||
| placeholder="Select or create options" | ||
| options={this.options} | ||
| delimiter="," | ||
| selectedOptions={selectedOptions} | ||
| onChange={this.onChange} | ||
| onCreateOption={this.onCreateOption} | ||
| isClearable={true} | ||
| data-test-subj="demoComboBox" | ||
| /> | ||
| ); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.