formio / angular

JSON powered forms for Angular
https://formio.github.io/angular-demo
MIT License
639 stars 469 forks source link

[Question] Can I add new keys to components? #559

Closed sofiaisreis closed 8 months ago

sofiaisreis commented 4 years ago

Hello, I am trying to add to specific things, in a component. 1 - First, on the values, besides 'Label' and 'Value': The value needs to be a number, not a string. Also, I need to have two fields such as 'NA', and 'Set to 0' (the second one will force the value of that row to be always 0). 2 - Secondly, I would like to add a weight option (numeric), below "Values".

exformio

The image above illustrates what I want to do. However I tried but couldn't figure out how to do it. I'm using the builder with the angular framework, and typescript instead of javascript. I'm using formoptions to acess and edit wich values I want to ignore or use, but how can I add new custom ones?

This is part of my html:

       <form-builder [form]="form" id="formBuilder" (change)="onChange($event) 
      [options]="formOptions"  [editForm]="editForm">
        </form-builder>

And my typescript code, to edit the radio component modal is:

this.formOptions = {
  editForm: {
    radio: [
          {
            key: 'display',
            ignore: 'false',
            components:
              [
                {
                  key: 'labelPosition',
                  ignore: true
                },
                {
                  key: 'optionsLabelPosition',
                  ignore: true
                },
                {
                  key: 'description',
                  ignore: true
                },
                {
                  key: 'customClass',
                  ignore: true
                },
                {
                  key: 'tabindex',
                  ignore: true
                },
                {
                  key: 'inline',
                  ignore: true
                },
                {
                  key: 'hidden',
                  ignore: true
                },
                {
                  key: 'hideLabel',
                  ignore: true
                },
                {
                  key: 'autofocus',
                  ignore: true
                },
                {
                  key: 'disabled',
                  ignore: true
                },
                {
                  key: 'tableView',
                  ignore: true
                },
                {
                  key: 'modalEdit',
                  ignore: true
                },
                {
                  key: 'customDefaultValue',
                  ignore: true
                }
              ]
          },
          {
            key: 'data',
            ignore: false,
            components:
              [
                {
                  key: 'values',
                  ignore: false,
                  components:
                    [
                      {
                        key: 'shortcut',
                        ignore: true
                      }
                    ]
                },
                {
                  key: 'defaultValue',
                  ignore: true
                },
                {
                  key: 'persistent',
                  ignore: true
                },
                {
                  key: 'protected',
                  ignore: true
                },
                {
                  key: 'dbIndex',
                  ignore: true
                },
                {
                  key: 'encrypted',
                  ignore: true
                },
                {
                  key: 'redrawOn',
                  ignore: true
                },
                {
                  key: 'defaultValue',
                  ignore: true
                },
                {
                  key: 'clearOnHide',
                  ignore: true
                },
                {
                  key: 'customDefault',
                  ignore: true
                }, {
                  key: 'customDefaultValue',
                  ignore: true
                },
                {
                  key: 'calculateValue',
                  ignore: true
                },
                {
                  key: 'calculateServer',
                  ignore: true
                },
                {
                  key: 'allowManualOverride',
                  ignore: true
                },
                {
                  key: 'dataType',
                  ignore: true
                },
                {
                  key: 'inline',
                  ignore: true
                },
                {
                  key: 'allowCalculateOverride',
                  ignore: true
                },
                {
                  key: 'defaultValueComponent',
                  ignore: true
                }
              ]
          },
          {
            key: 'layout',
            ignore: true
          },
          {
            key: 'conditional',
            ignore: true
          },
          {
            key: 'api',
            ignore: true
          },
          {
            key: 'logic',
            ignore: true
          },
          {
            key: 'validation',
            ignore: true
          }
        ]
  }
}
cmcortez commented 4 years ago

Hello @sofiaisreis we would be happy to help you review this code as part of a support package. If you are interested in going down this road please write to support@form.io and I can discuss the options we have in place.

ZenMasterJacob20011 commented 8 months ago

Closing this thread as it is outdated. Please re-open if it is still relevant. Thank you for your contribution!