-
-
Notifications
You must be signed in to change notification settings - Fork 493
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
Add new element JSONEditor #1474
Conversation
I think this is probably ready for a code review. One feature which hasn't been implemented yet is themes. I am not sure how the maintainers would like to structure the css themes provided with the library. These would allow for light mode and dark mode applications. Would these be stored in |
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.
@natankeddem Thanks for this pull request! Even though it seems to be a rather specific UI element, it might come in handy for development and prototyping UIs when working on JSON configurations.
I reviewed your code and did some improvements here and there. There's just one concern remaining: I had to limit the select event types to "text", "key" and "value" because there's also "multi" and possibly others that don't map to the current Python events. So I wonder if it was more useful to simply send generic select events and keep event arguments in a dictionary so that we don't have to have classes for every event. Or is it better to use dedicated event argument classes with proper typing? What do you think?
If you think a generic dictionary is acceptable, I am in agreement. I think it is better to have a single It appears like this library is a reboot of a previous project and is still being actively changes so it might be best to allow more flexibility. I understand the advantage of the event types with type hinting and being generally more explicit which is obviously a positive. Those positives need to be weighed against complexity and maintainability of the codebase in my opinion. I can alter the PR to make the generic dictionary change you have proposed. I will change to a single |
@natankeddem That sounds great! Thanks! |
If you like that height as a default we could put that in the CSS if you want? Also, did you want to do anything with trying to figure out utilizing the built in theme css file handling? Or we could push that to a later PR if needed. |
You mean The built-in theme handling sounds like a good subject for another PR. To be honest, I haven't looked into it yet. |
Thanks again for your contribution, @natankeddem! Looks really nice. 😊 |
A pleasure as always, thank you @falkoschindler ! |
Documentation and demo is live at https://nicegui.io/documentation/json_editor |
This element introduces a JSON targeted graphical text editor. It is useful for editing configuration files which maybe in JSON format or forming JSON data to pass to other elements.
Configuration and data is handled similarly to
chart
andechart
utilizing a single dictionaryproperties
. I have implementedon_select
andon_change
events to facilitate data return from the editor element.I haven't done much testing on this element yet but it appears to have some functionality as implemented.