Skip to content
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

array (list) input #32

Open
lkleuver opened this issue Nov 26, 2019 · 28 comments
Open

array (list) input #32

lkleuver opened this issue Nov 26, 2019 · 28 comments
Labels
help wanted Extra attention is needed

Comments

@lkleuver
Copy link

my schema has the following input:
coordinates: [Float!]!
but it seems the explorer only looks at the leaf argument type. (unwrapInputType)

Am I missing something, or is there perhaps work in progress before I start implementing it?

@FluorescentHallucinogen
Copy link
Contributor

@lkleuver PTAL at #10 (comment). 😉

@sgrove
Copy link
Contributor

sgrove commented Jan 14, 2020

@lkleuver We indeed haven't implemented array support yet - definitely a fundamental omission! if you're looking to take a crack at this, it'd be a great help!

@sgrove sgrove added the help wanted Extra attention is needed label Jan 14, 2020
@baohouse
Copy link

I'm taking a look at this. How do we want to annotate array inputs? Was thinking of using square brackets after the field name.

Screen Shot 2020-04-13 at 11 23 29 PM

@FluorescentHallucinogen
Copy link
Contributor

@baohouse Are you working on a pull request?

Was thinking of using square brackets after the field name.

PTAL at my vision: #10 (comment). It's highly inspired by Chrome DevTools.

Looks like using curly braces for objects (non-leaf fields that has childs) is also a good idea. PTAL at #10 (comment).

@FluorescentHallucinogen
Copy link
Contributor

Also it would be really nice to visually separate the input fields (arguments) from the output (asked) fields by placing input fields into round brackets. But this may out of scope of this pull request.

@baohouse
Copy link

@FluorescentHallucinogen Ah yes, it's a high priority for one of our customers, so, I am taking a stab at it. Thanks for pointing to the vision, I have a clear idea now. I also see where to start working

/* TODO: handle List types*/

@FluorescentHallucinogen
Copy link
Contributor

@baohouse Any progress?

@baohouse
Copy link

baohouse commented Apr 22, 2020

@FluorescentHallucinogen Yeah, I have a sense of how it all works together. I'm still far from completing it per the vision. Here's the tasklist:

  • core functionality (just to get things working; the basic UX is there, but will be eventually be replaced)
    • insert new element at end of list
    • remove element (by unchecking the element's checkbox, though this will eventually be replaced with drag handles, with remove being in the floating action bar)
  • action bar (floating to the right of the element)
    • insert after a given element
    • duplicate element
    • remove element
  • reorder element by drag-and-drop
  • support scalar elements
  • support object elements
  • restoring field-list back to previous list if unchecking and then rechecking it
  • allow collapsing of list without removing elements (essentially hiding details, rather than default behavior of removing the field)
    • add checkbox in front of field-list
  • put square brackets surrounding list elements (opening square bracket on the same line as the field-list name, and the closing square bracket on a new line following the last element)

Screen Shot 2020-04-22 at 11 20 14 AM

@TimLehner
Copy link
Contributor

@baohouse I am very interested in this. Please let me know if I can be of assistance. I am especially interested how this would integrate with custom graphql scalars (see my branch and PR #47)

@FluorescentHallucinogen
Copy link
Contributor

@baohouse Could you please create a WIP pull request?

allow collapsing of list without removing elements (essentially hiding details, rather than default behavior of removing the field)

BTW, this is what annoys me in the Explorer. If I open rotating triangle, Explorer adds this to the query. What if I want to just see what's inside without adding this to the query? So it would be really nice to change this behavior in Explorer globally. This may out of scope of this pull request. But we should provide consistent behavior in Explorer.

add checkbox in front of field-list

What about checkboxes in front of list item fields, not in front of list field?

IMO, we should preserve leading checkboxes for "insert all child fileds" feature i.e. check all nested checkboxes at once automatically and then manually uncheck only unnecessary instead of check them only one by one manually (this is very useful for types with a large number of fields).

See detail explanation how this might works: #10 (comment).

BTW, this implies the need of a third "indeterminate" state for checkboxes in addition to "unchecked" and "checked" (if not all child checkboxes checked).

See package, bundlephobia and downloads fields on the image here: #10 (comment).

@FluorescentHallucinogen
Copy link
Contributor

I see this pull request grows like a snowball…

@baohouse Feel free to drop (throw out) advanced features like "duplicate element" and "reorder element by drag-and-drop".

Please let me know if I can help in some way too. ;)

@TimLehner
Copy link
Contributor

IMO, we should preserve leading checkboxes for "insert all child fileds" feature i.e. check all nested checkboxes at once automatically and then manually uncheck only unnecessary instead of check them only one by one manually (this is very useful for types with a large number of fields).

Note this behaviour is currently possible (though not intuitive):
ALT+Click on a field should select all properties 1 level deep (including non-leaf properties and any required arguments)

@FluorescentHallucinogen
Copy link
Contributor

@TimLehner

Note this behaviour is currently possible (though not intuitive):
ALT+Click on a field should select all properties 1 level deep (including non-leaf properties and any required arguments)

I know about this. But currently it has low feature discoverability. How users learn about this hotkey?

@TimLehner
Copy link
Contributor

@FluorescentHallucinogen

I know about this. But currently it has low feature discoverability. How users learn about this hotkey?

I agree this is not well advertised or intuitive at all. Aside from reading the source I am not sure how you would be expected to discover this feature, which is a shame

@sgrove
Copy link
Contributor

sgrove commented Apr 25, 2020 via email

@FluorescentHallucinogen
Copy link
Contributor

@sgrove

you probably have searched enough and found out how to do so.

But it's not documented anywhere. ¯_(ツ)_/¯

If I create pull request that implements behavior described in #10 (comment) (clicking on the rotating triangles and field names still only expand child fields without checking (inserting) them), will you merge it?

@baohouse
Copy link

@FluorescentHallucinogen I'll work on migrating my work onto a clean branch off the master. I realized that not only I was working off an older version of the file, but also a Flow-to-Typescript translated file that I did for the purpose of dropping it into my app's codebase.

@FluorescentHallucinogen
Copy link
Contributor

@baohouse Any news?

@FluorescentHallucinogen
Copy link
Contributor

@baohouse Any progress? Do you need any help?

@baohouse
Copy link

@FluorescentHallucinogen Sorry, I've been swamped with work. I don't think I'll have time to properly merge in changes. The first problem was that I had converted the GraphiQL file into Typescript for my app, and "undoing" those changes to isolate the feature-specific ones was tedious. Can I send you a copy of the file in its current state?

@FluorescentHallucinogen
Copy link
Contributor

@baohouse

Can I send you a copy of the file in its current state?

Yes, please. You can use https://gist.github.com.

@baohouse
Copy link

baohouse commented Jul 11, 2020

@FluorescentHallucinogen Here's the gist
https://gist.github.com/baohouse/123c409cd1e4f56fa3b9a5e8859330d5

The main changes I made were to support object-based custom args, and list types (both object lists and scalar lists).

Screen Shot 2020-07-11 at 1 09 43 AM

@mbj36
Copy link

mbj36 commented Oct 11, 2020

Is there any progress on this ?

@nullmastermind
Copy link

Is there any progress on this?

@mmiguerodriguez
Copy link

Bumping this. @baohouse do you think you could make the snippet as a repository? What's needed for it to work completely? It seemed a bit buggy

@rubendinho
Copy link

bumping this as well - would be happy to help get this supported

@FluorescentHallucinogen
Copy link
Contributor

@rubendinho

would be happy to help get this supported

Pull requests are welcome. See #10 (comment) for what this might look like. ;)

@chathuranga95
Copy link

Bumping this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

10 participants