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

General question about the further development #1473

Closed
domhaas opened this issue Sep 25, 2019 · 4 comments
Closed

General question about the further development #1473

domhaas opened this issue Sep 25, 2019 · 4 comments
Labels
possibly close To confirm if this issue can be closed

Comments

@domhaas
Copy link

domhaas commented Sep 25, 2019

Prerequisites

Description

Hi there,
first of all: thanks for the great work making forms less annoying. Currently I'm using this lib together with symfony/form.

As I mentioned here #1461 I'm currently developing a blueprintjs extension.
Currently I got stuck on customizing for example the SchemaField, cause I think I'm refactoring some main parts of the code and I'm writing no extension, but a complete separated fork.

Second point I was stuck on was the i18n-thing - currently I'm using react-i18next with all in my projects. Currently there is no possibility to use for example translated labels or descriptions inside this project, so I need to rewrite again the SchemaField and for sure some other parts as well.


I know, this lib was developed for the kinto admin but it would be really great to have something like a defacto standard for rendering forms in the frontend, currently I don't think it's possible due to some hard-coded files (like the SchemaField).

So, what are your plans for this lib, are you going to add some features or is there any plan to make it complete customizable?

Thank you in advance,
Dominik

Version

1.8.0

@epicfaace
Copy link
Member

Hopefully the widgets, fields, templates, etc. available in withTheme should be enough to completely customize rjsf to the level needed for themes -- what exactly were you trying to customize which wasn't possible without forking? You can override SchemaField in withTheme by passing an object such as {fields: {SchemaField: ...}}.

@domhaas
Copy link
Author

domhaas commented Sep 26, 2019

Hopefully the widgets, fields, templates, etc. available in withTheme should be enough to completely customize rjsf to the level needed for themes -- what exactly were you trying to customize which wasn't possible without forking? You can override SchemaField in withTheme by passing an object such as {fields: {SchemaField: ...}}.

I'm overriding already the SchemaField and yes, everything can be overwritten by using withTheme HOC.
My current problem is that there is lots of logic inside for example the SchemaField to collect everything what is needed. And as there is a work in progress for the field-components, I would need to regularly merge changes from the main-repo to stay up to date. This could be a nasty job, because especially the SchemaField is really fragmented.

Widgets otherwise can be defined very clean and encapsulated from the logic part. The same should be done for the other components where there are bootstrap-markups inside:

import React, { Component } from 'react';
import { InputGroup } from "@blueprintjs/core";

class TextWidget extends Component {
    render() {
        const { readonly, value, onChange, label } = this.props

        return (
            <InputGroup
                label={label}
                disabled={readonly}
                defaultValue={value}
                onChange={() => onChange(value)} />
        );
    }
}

export default TextWidget;

Summarized: It can be overridden everything with the HOC to create a theme, but I don't think this can be done in a clean way. And I think only in a clean way there will be themes coming (like blueprintjs/antd/extjs) from the community.
Currently it's much more safe to just fork, customize and cherry pick important commits from the main-repo.
Much better would be for me of course to add features to this lib, not making a new one. But this depends on what your plan is - if you were using components, like react-bootstrap it would be much easier to create themes, than just using markup.

@epicfaace
Copy link
Member

epicfaace commented Sep 30, 2019

@domhaas yeah, good point. I made a suggestion for how to resolve this over here: #1222 (comment)

Do you think that would work?

@domhaas
Copy link
Author

domhaas commented Oct 2, 2019

@domhaas yeah, good point. I made a suggestion for how to resolve this over here: #1222 (comment)

Do you think that would work?

@epicfaace I think this would be much better than the current implementation. Avoiding html-tags and create independant react-components should resolve the issue to overwrite for example the FieldTemplate completely.

Anyhow, I need some more time to think about it. Currently I got many ideas to optimize this library, for example also the layout-thing to achieve responsive layout options, which I think is really missing.
Currently I'm using react-grid-system and it works like a charm, therefor I've added a new property to the schema "ui:layout":

"ui:layout": {
  "sm": 12
  "md": 6
}

I've recently updated my repo react-jsonschema-form-theme-blueprintjs and there's also a npm package: npm i react-jsonschema-form-theme-blueprintjs

Hoping to get our thoughts together to one repository.

@jacqueswho jacqueswho added the possibly close To confirm if this issue can be closed label Feb 24, 2022
@stale stale bot closed this as completed Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
possibly close To confirm if this issue can be closed
Projects
None yet
Development

No branches or pull requests

3 participants