-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
feat: keep placeholder on multiselect #11289
feat: keep placeholder on multiselect #11289
Conversation
5d1c1f7
to
a2f1f75
Compare
Codecov Report
@@ Coverage Diff @@
## master #11289 +/- ##
==========================================
- Coverage 65.50% 62.06% -3.45%
==========================================
Files 874 423 -451
Lines 42344 26325 -16019
Branches 3972 0 -3972
==========================================
- Hits 27739 16339 -11400
+ Misses 14476 9986 -4490
+ Partials 129 0 -129
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
a2f1f75
to
9af6e57
Compare
placeholder={ | ||
this.props.multi | ||
? t('choose one or more column or aggregate function') | ||
: t('choose a column or aggregate function') |
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.
@junlincc to confirm, you're going to revisit this text at a later date, correct?
9af6e57
to
b4a3dcc
Compare
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.
a few comments, thanks for the re-PR!
placeholder={t('choose a column or aggregate function')} | ||
placeholder={ | ||
this.props.multi | ||
? t('choose one or more column or aggregate function') |
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.
columns or aggregate functions
?
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.
I went back and forth on that too, and didn't even find anything definitive in the grammar handbooks, but I agree that the plural sounds more natural .
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.
It doesn't seem like there IS a definitive answer... the rules conflict!
The Proximity Agreement says you should go with whichever is closer to the verb. In this case, that'd be "choose", so you would go with "column or agregate function".
However, the Notional Agreement seems to back us up here that these are cognitively a collection, so the plural treatment makes more sense.
"Don't take any notice of teachers and textbooks in such matters. Nor of logic. It is good to say 'More than one passenger was hurt,' although more than one equals at least two and therefore logically the verb ought to be plural were not singular was!"
–– CS Lewis
+1 for team plural. And yes, I'm going back to what I should be doing, now.
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.
ha, that's great. I can also comment in the code that we went with the Notional Agreement here in case anyone wonders. jk :)
@@ -267,7 +267,7 @@ export default class AdhocFilterControl extends React.Component { | |||
<OnPasteSelect | |||
isMulti | |||
name={`select-${this.props.name}`} | |||
placeholder={t('choose a column or metric')} | |||
placeholder={t('choose one or more column or metric')} |
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.
columns or metrics
?
}; | ||
placeholder: string; | ||
}; | ||
cx: (a: string | null, b: any, c: string) => string | void; |
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.
i'd imagine we can pull cx
, className
, and getStyles
attributes form a type in emotion or the superset styled library. Any thoughts @rusackas ?
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.
Most of these attribute types are pulled in from the existing type on InputProps from react-select
with the exception that I'm adding selectProps
which exists on the component, but the library doesn't have it present in the types.. a bug on their part I think. Not sure how removing any attributes would break anything down the road.
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.
Can you try if this works?
import { InputProps as ReactSelectInputProps, CommonProps } from 'react-select';
type InputProps = ReactSelectInputProps & {
placeholder?: string;
selectProps?: CommonProps<any>['selectProps'];
}
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.
Ah, those were exported. I missed them the first time around. thx. I am admittedly still leveling up my typescript chops, so this sort of worked, but I still had to declare some times for the selectProps properties below. Not sure why they didn't import correctly off the interface. It could be because I'm taking the placeholder of selectProps and assigning it to the placeholder on the input and maybe the types aren't the same, but if you have any suggestions, lmk!
0705109
to
fc7c370
Compare
c99f642
to
748951d
Compare
rebased to correct that failing cypress test. I think this should be ready for another look now. |
}: { | ||
isMulti?: boolean; | ||
value?: ValueType<any>; | ||
placeholder?: ReactNode; |
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.
I think the reason why you could't directly use selectProps
below is because you've set it as an optional prop. Changing
type InputProps = ReactSelectInputProps & {
selectProps?: SelectProps;
}
to
type InputProps = ReactSelectInputProps & {
selectProps: SelectProps;
}
should do the trick. Sorry for my misleading example!
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.
This did.. thanks! I just had one more issue with value.length that still needed to be asserted, but much better.
b2b1339
to
cd9d22e
Compare
rebase |
47b2355
to
6b68626
Compare
@ktmud I added in a story and also moved the styles to use |
1be56a6
to
ea0aa27
Compare
added license header |
retry cypress |
559b537
to
dd1e43e
Compare
Other than that this PR looks good to me. Thanks for the great work! Hope we can find some ways to re-enable the tests, but this now looks good at least from manual testing. |
That's a great point. I'll look into that. Thx! Also, @suddjian and I were looking at the type assertion on value and made a small tweak to |
Sounds good to me. |
79dd4d9
to
5235f81
Compare
@@ -33,14 +33,15 @@ describe('AdhocFilters', () => { | |||
|
|||
let numScripts = 0; | |||
|
|||
it('Should load AceEditor scripts when needed', () => { | |||
xit('Should load AceEditor scripts when needed', () => { |
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.
@kgabryje I was seeing errors on these in dev, fyi.
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.
Can we do a follow up to re-enable these tests if it's not too much trouble?
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.
yeah, I'll circle back on them.
superset-frontend/package.json
Outdated
@@ -190,7 +190,7 @@ | |||
"@storybook/addons": "^5.3.19", | |||
"@storybook/client-api": "^6.0.21", | |||
"@storybook/preset-typescript": "^3.0.0", | |||
"@storybook/react": "^6.0.13", | |||
"@storybook/react": "^6.0.28", |
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.
bumping storybook resolved some issues happening in the last day or so:
-frontend/node_modules/react-docgen-typescript/lib/parser.js:496
var properties = initializer.properties;
^
TypeError: Cannot read property 'properties' of undefined
I think we should always excluding "Select All" from counting and hide the placeholder when everything is selected. |
@eschutho thanks for looping me in. please feel free to work with Jesse directly. he is the expert in data viz and the explore control in Superset, and certainly is more knowledgeable than me when it comes to details. I am very comfortable having him making some product decisions in this area. @ktmud I hope you don't mind me deferring responsibilities to you. :) |
Thank you both for that feedback. I removed "select all" from the count. @ktmud my understanding of react-select is that it will calculate the options to show if |
I think your current approach works. The |
619ee4c
to
c35c0e8
Compare
c35c0e8
to
9540af5
Compare
rebase, squash all and remove package-lock.json |
👏 |
Thanks for all your help on this @ktmud! |
@eschutho I'm seeing sub par experience with FilterBox selects after this change: BeforeAfter
|
Thanks for notating that. I’ll see if I can reproduce tomorrow.
… On Nov 16, 2020, at 6:57 PM, Jesse Yang ***@***.***> wrote:
@eschutho I'm seeing sub par experience with FilterBox selects after this change:
Before
After
The inputs jump when focused
It triggers the browser's native autocomplete
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This reverts commit b277f19.
This reverts commit b277f19.
SUMMARY
This fixes the revert of #11181: some visual elements broke from changes during the review. It would be great to add some visual testing in the future.. will look into that!
Also, it was pointed out that the user should be able to type in the field instead of just using the popup selector. Thanks for that feedback, so I changed this to a placeholder.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
New Story:
![Select_Component_-_Interactive_Select_⋅_Storybook](https://user-images.githubusercontent.com/5186919/98172166-b92b6c80-1ea5-11eb-92f9-45d6c662d609.png)
TEST PLAN
New jest unit tests. Storybook component added.
ADDITIONAL INFORMATION