-
Notifications
You must be signed in to change notification settings - Fork 170
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
Importing list of values to String filter menu #419
Merged
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cee9231
Initial component refactor
adrianmroz-allegro 2902610
Code style fixes
adrianmroz-allegro 7b19a3c
overflow long string values in filter menu
adrianmroz-allegro 17ddbdd
Don't close menu on enter when in import mode
adrianmroz-allegro dc7acbc
Code style fixes
adrianmroz-allegro 5095492
Refactor PreviewStringFilter
adrianmroz-allegro b9ef6ca
Show "Matching values" label only when search text is present
adrianmroz-allegro 05d0701
Move search box to lower components
adrianmroz-allegro e1cb722
Move css around
adrianmroz-allegro 7127363
Move import-form to new component paste-form
adrianmroz-allegro c96de00
Better types
adrianmroz-allegro d5fc0ff
Handle error that shouldn't be thrown.
adrianmroz-allegro e48d7c1
search text is local state for preview string filter
adrianmroz-allegro b7908f0
Remove unnecessary copyright
adrianmroz-allegro 60c9b6c
Merge branch 'master' into feature/import-values-to-string-filter
adrianmroz 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 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,36 @@ | ||
/* | ||
* Copyright 2017-2018 Allegro.pl | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
@import '../../imports'; | ||
|
||
.paste-field { | ||
@extend %default-input; | ||
height: 280px; | ||
font-size: 13px; | ||
padding: 1px; | ||
} | ||
|
||
.paste-actions { | ||
margin-top: 12px; | ||
|
||
button { | ||
min-width: 70px; | ||
|
||
&:not(:last-child) { | ||
margin-right: 6px; | ||
} | ||
} | ||
} |
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,60 @@ | ||
/* | ||
* Copyright 2017-2018 Allegro.pl | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import { Set } from "immutable"; | ||
import * as React from "react"; | ||
import { Unary } from "../../../common/utils/functional/functional"; | ||
import { Fn } from "../../../common/utils/general/general"; | ||
import { Button } from "../button/button"; | ||
import "./paste-form.scss"; | ||
|
||
interface PasteFormProps { | ||
initialValues: Set<string>; | ||
onSelect: Unary<Set<string>, void>; | ||
onClose: Fn; | ||
} | ||
|
||
interface PasteFormState { | ||
value: string; | ||
} | ||
|
||
export class PasteForm extends React.Component<PasteFormProps, PasteFormState> { | ||
|
||
state: PasteFormState = { value: this.props.initialValues.join("\n") }; | ||
|
||
select = () => { | ||
const { onClose, onSelect } = this.props; | ||
const { value } = this.state; | ||
onSelect(Set(value.split("\n"))); | ||
onClose(); | ||
} | ||
|
||
cancel = () => this.props.onClose(); | ||
|
||
saveValue = ({ target: { value } }: React.ChangeEvent<HTMLTextAreaElement>) => this.setState({ value }); | ||
|
||
render() { | ||
const { value } = this.state; | ||
const {} = this.props; | ||
return <div> | ||
<textarea className="paste-field" value={value} onChange={this.saveValue} /> | ||
<div className="paste-actions"> | ||
<Button type="primary" title="Select" onClick={this.select} /> | ||
<Button type="secondary" title="Cancel" onClick={this.cancel} /> | ||
</div> | ||
</div>; | ||
} | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't you add
filterMode
right here? then you could switch used component only.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TSX typing issues. If I add this there,
props
will havefilterMode: FilterMode
, and switch wouldn't narrow it's type inside object so types on component's won't match. If I narrow type via switch and then add to object, it has correct type.