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

FIO-9055: separate rowPath from componentPath in getComponentActualValue fn #153

Merged
merged 2 commits into from
Sep 23, 2024

Conversation

brendanbond
Copy link
Contributor

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-9055

Description

Previously, nested data components (e.g. edit grid, container, data grid, etc.) did not handle the case of a conditional component that was outside of the component's contextual row value. In other words, an edit grid component that contains a child text field that itself contains a conditional based on a parent-level component:

    const form = {
      display: 'form',
      components: [
        {
          label: 'Select',
          widget: 'choicesjs',
          tableView: true,
          data: {
            values: [
              {
                label: 'Action1',
                value: 'action1',
              },
              {
                label: 'Custom',
                value: 'custom',
              },
            ],
          },
          key: 'select',
          type: 'select',
          input: true,
        },
        {
          label: 'Edit Grid',
          tableView: false,
          rowDrafts: false,
          key: 'editGrid',
          type: 'editgrid',
          displayAsTable: false,
          input: true,
          components: [
            {
              label: 'Text Field',
              applyMaskOn: 'change',
              tableView: true,
              key: 'textField',
              conditional: {
                show: true,
                conjunction: 'all',
                conditions: [
                  {
                    component: 'select',
                    operator: 'isEqual',
                    value: 'custom',
                  },
                ],
              },
              type: 'textfield',
              input: true,
            },
          ],
        },
        {
          type: 'button',
          label: 'Submit',
          key: 'submit',
          disableOnInvalid: true,
          input: true,
          tableView: false,
        },
      ],
    };

could not reach outside of its contextual row context to get the correct value. This PR updates the getComponentActualValue method so that rowPath and a full componentPath are separate.

Breaking Changes / Backwards Compatibility

n/a

Dependencies

n/a

How has this PR been tested?

Manually + automated testing; formio and formio-server tests pass

Checklist:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@johnformio johnformio merged commit 08026b7 into master Sep 23, 2024
8 checks passed
lane-formio pushed a commit that referenced this pull request Sep 25, 2024
…lue fn (#153)

* separate rowPath from componentPath in getComponentActualValue fn

* update tests for edge case
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