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

[WIP] Arrays of UI elements, type maintenance #71

Closed
wants to merge 2 commits into from

Conversation

gustaphe
Copy link

I wanted to be able to set a table of sliders and get their values out as a collection, so I started rewriting src/Builtins.jl a bit.

But I needed some specific type functionality for that, so I started working on the types for the UI elements. Both adding an abstract supertype, making most of them parametric and adjusting the concreteness of parameters and arguments.

Turns out the functionality I originally wanted would behoove me to figure out how Pluto.jl deals with binding (and specifically javascript, so that's a project for the future). But the table printing turned out pretty sweet.

The Dict based types (Select, MultiSelect and Radio) are currently broken, both for some so far unknown reason, but also due to Dicts being unordered. I'll look into what to do about that at a later time.

(Don't merge, obviously, but I'm open for comments and suggestions)

@fonsp fonsp marked this pull request as draft December 12, 2020 23:18
@fonsp
Copy link
Member

fonsp commented Dec 12, 2020

So far this only adds more scary complexity, making PlutoUI a difficult package to understand. I did not use an abstract supertype for this reason

You are right that we need a Pluto feature to support array things, once I have implemented that into Pluto I will update PlutoUI to match. See the discussion in #3 for more info

@gustaphe
Copy link
Author

I get that. I think one could probably add a supertype with minimal scary complexity though, it doesn't with the current functionality need to be parametrized, so all you need is

abstract type AbstractUIElement end

and append a <:AbstractUIElement to each struct declaration. And the show and get function for arrays are then very simple (like the ones I implemented here). The "only" problem is the JSON parsing you mention in #3, I guess I underestimated the complexity behind the scenes. It could be possible to wrap the input table in a <form> and use the inputs js property. But it would require its own hook(?) and that's a bit beyond me at this point.

@fonsp
Copy link
Member

fonsp commented Dec 13, 2020

Ah I only just now realized that you added the array feature. It's well found, but a feature like this should also work with custom inputs, like @bind x html"<input>", not just with the ones included in PlutoUI. I think I wrote something for this, let me check...

/~https://github.com/fonsp/disorganised-mess/blob/master/confirm%20combine.jl

Maybe we can put this in PlutoUI, with "confirm" and "combine" as two separate wrappers

@fonsp fonsp closed this Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants