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

paging merge #13

Closed
zboldyga opened this issue Jun 30, 2017 · 2 comments
Closed

paging merge #13

zboldyga opened this issue Jun 30, 2017 · 2 comments
Assignees

Comments

@zboldyga
Copy link
Contributor

zboldyga commented Jun 30, 2017

Sandeep expressed a need for us to be able to show/hide tabs based on conditions. In order to accomplish this we might want your conditional module to have the ability to act on the ui:tabID property I've added in the pagination project (e.g. have a condition effect all fields with a specific ui:tabID value.

I see currently that your rules are defined on a per-field basis. Maybe we can add a mechanism for defining a rule for a ui:tabID?

We're also going to run into a similar situation with having to show/hide groups of fields - in the healthcare context it seems that it's usually going to be whole sections of a form that show/hide based on the input of some field. In this situation we'll have a similar issue - we can explicitly define a rule for every component in the group, but it might make more sense to have a concise handle that acts on a whole group of components.

I think the groups will just be Widgets, as defined in the Mozilla project. So we may want conditional rules to apply to Widgets as well... We may want to defer thinking about the Widgets until we get a little further though.

What do you think?

@mavarazy mavarazy self-assigned this Jul 2, 2017
@mavarazy
Copy link
Contributor

mavarazy commented Jul 2, 2017

I've opened an #15, to support group of fields in actions.

I was thinking that group of fields will be something like field of type address that will be displayed as city, state, zip, e t.c.,

That way by defining action on per-field basis you can support group of fields as well, but this is if they are combined in a field of some type.

@mavarazy
Copy link
Contributor

mavarazy commented Jul 2, 2017

After fixing #15 & #8 , we can safely close this issue, since now an action does not have to be per-field basis and can have any side effect, we need.

For example we can define actions: "closeTab", and write it down like this:

{
   closeTab: ({ tab }, schema, uiSchema) => {
      Object.keys(uiSchema).map((key) => {
          if (uiSchema[key]["ui:TabId"] === tab) {
               delete schema.properties[key];
          }
   }
}

which can be triggered like this:

let rules = [{
   conditions: { firstName: "empty" },
   events: { type: "closeTab",  params: { tab: 1 }}
}]

@mavarazy mavarazy closed this as completed Jul 2, 2017
nbroda-carecloud pushed a commit to nbroda-carecloud/react-jsonschema-form-conditionals that referenced this issue Jun 6, 2018
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

No branches or pull requests

2 participants