How to use @covalent/dynamic-forms - 10 common examples

To help you get started, we’ve selected a few @covalent/dynamic-forms examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nhsconnect / careconnect-reference-implementation / ccri-management-app / src / main / web / src / app / component / resource / resource.component.ts View on Github external
this.elements.push(nodeDSQ);
         this.elements.push(nodeDS);

         break;
       case 'token' :
         // add matches
         let nodeT1 :ITdDynamicElementConfig = {
           "label": 'System - '+param.name + ' - '+param.documentation,
           "name" : param.type+'-'+seq + '-1-'+param.name,
           "type": TdDynamicElement.Input,
           "flex" : 50
         };
         let nodeT2 :ITdDynamicElementConfig = {
           "label": 'Code - '+param.name + ' - '+param.documentation,
           "name" : param.type+'-'+seq + '-2-'+param.name,
           "type": TdDynamicElement.Input,
           "flex" : 50
         };
         this.elements.push(nodeT1);
         this.elements.push(nodeT2);
         break;
       case 'string' :
         // add matches
         let nodeOpt: ITdDynamicElementConfig = {
           "label": "match",
           "name": param.type+'-'+seq + '-1-'+param.name,
           "type": TdDynamicElement.Select,
           "selections": [
           {
             "label": "Matches",
             "value": ""
           },
github nhsconnect / careconnect-reference-implementation / ccri-management-app / src / main / web / src / app / component / resource / resource.component.ts View on Github external
},
             {
               "label": "<",
               "value": "lt"
             },
             {
               "label": "<",
               "value": "le"
             }
           ],
           "flex" : 10
         };
         let nodeDS :ITdDynamicElementConfig = {
           "label": param.name + ' - '+param.documentation,
           "name" : param.type+'-'+seq + '-2-'+param.name ,
           "type": TdDynamicElement.Datepicker,
           "required": true,
           "flex" : 90
         };

         this.elements.push(nodeDSQ);
         this.elements.push(nodeDS);

         break;
       case 'token' :
         // add matches
         let nodeT1 :ITdDynamicElementConfig = {
           "label": 'System - '+param.name + ' - '+param.documentation,
           "name" : param.type+'-'+seq + '-1-'+param.name,
           "type": TdDynamicElement.Input,
           "flex" : 50
         };
github nhsconnect / careconnect-reference-implementation / ccri-management-app / src / main / web / src / app / component / resource / resource.component.ts View on Github external
};
         let nodeT2 :ITdDynamicElementConfig = {
           "label": 'Code - '+param.name + ' - '+param.documentation,
           "name" : param.type+'-'+seq + '-2-'+param.name,
           "type": TdDynamicElement.Input,
           "flex" : 50
         };
         this.elements.push(nodeT1);
         this.elements.push(nodeT2);
         break;
       case 'string' :
         // add matches
         let nodeOpt: ITdDynamicElementConfig = {
           "label": "match",
           "name": param.type+'-'+seq + '-1-'+param.name,
           "type": TdDynamicElement.Select,
           "selections": [
           {
             "label": "Matches",
             "value": ""
           },
           {
             "label": "Exactly",
             "value": "exact"
           }
         ],
           "required": true
           ,"flex" : 20
         };

         let nodeS :ITdDynamicElementConfig = {
           "label": param.name + ' - '+param.documentation,
github Teradata / covalent / src / app / components / components / component-demos / dynamic-forms / dynamic-forms.component.ts View on Github external
validators: [
        {
          validator: (control: AbstractControl) => {
            let isValid: boolean = (!control.value && control.value !== 0) || control.value % 2 !== 0;
            return !isValid ? { odd: true } : undefined;
          },
        },
      ],
    },
  ];

  multipleValidatorTypes: ITdDynamicElementConfig[] = [
    {
      name: 'passwordElement',
      label: 'Password',
      type: TdDynamicElement.Password,
      required: true,
      validators: [
        {
          validator: (control: AbstractControl) => {
            let isValid: boolean = /\d/i.test(control.value);
            return !isValid ? { oneNumber: true } : undefined;
          },
        },
        {
          validator: (control: AbstractControl) => {
            let isValid: boolean = control.value && control.value.length >= 8 && control.value.length <= 20;
            return !isValid ? { length: true } : undefined;
          },
        },
        {
          validator: (control: AbstractControl) => {
github Teradata / covalent / src / app / components / components / dynamic-forms / dynamic-forms.component.ts View on Github external
validators: [
        {
          validator: (control: AbstractControl) => {
            const isValid: boolean = (!control.value && control.value !== 0) || control.value % 2 !== 0;
            return !isValid ? { odd: true } : undefined;
          },
        },
      ],
    },
  ];

  multipleValidatorTypes: ITdDynamicElementConfig[] = [
    {
      name: 'passwordElement',
      label: 'Password',
      type: TdDynamicElement.Password,
      required: true,
      validators: [
        {
          validator: (control: AbstractControl) => {
            const isValid: boolean = /\d/i.test(control.value);
            return !isValid ? { oneNumber: true } : undefined;
          },
        },
        {
          validator: (control: AbstractControl) => {
            const isValid: boolean = control.value && control.value.length >= 8 && control.value.length <= 20;
            return !isValid ? { length: true } : undefined;
          },
        },
        {
          validator: (control: AbstractControl) => {
github Teradata / covalent / src / app / components / components / component-demos / dynamic-forms / dynamic-forms.component.ts View on Github external
default: ['list1'],
      selections: ['list1', 'list2', 'list3'],
      flex: 100,
      validators: [
        {
          validator: (control: AbstractControl) => {
            let isValid: boolean = control.value.length <= 2;
            return !isValid ? { invalidChips: true } : undefined;
          },
        },
      ],
    },
  ];

  elementOptions: any[] = [
    TdDynamicElement.Input,
    TdDynamicType.Number,
    TdDynamicElement.Datepicker,
    TdDynamicElement.Password,
    TdDynamicElement.Textarea,
    TdDynamicElement.Slider,
    TdDynamicElement.Checkbox,
    TdDynamicElement.SlideToggle,
    TdDynamicElement.FileInput,
  ];

  showDynamicCode: boolean = false;

  type: any;

  count: number = 2;
github Teradata / covalent / src / app / components / components / dynamic-forms / dynamic-forms.component.ts View on Github external
hint: 'this is an input hint',
      type: TdDynamicElement.Input,
      required: false,
      flex: 50,
    },
    {
      name: 'required-input',
      label: 'Input Label',
      type: TdDynamicElement.Input,
      required: true,
      flex: 50,
    },
    {
      name: 'text-length',
      label: 'Text Length',
      type: TdDynamicElement.Input,
      minLength: 4,
      maxLength: 12,
      flex: 50,
    },
    {
      name: 'text',
      type: TdDynamicType.Text,
      required: false,
      default: 'Default',
      flex: 50,
      disabled: true,
    },
    {
      name: 'textarea',
      hint: 'this is a textarea hint',
      type: TdDynamicElement.Textarea,
github nhsconnect / careconnect-reference-implementation / ccri-management-app / src / main / web / src / app / component / resource / resource.component.ts View on Github external
"label": "Matches",
             "value": ""
           },
           {
             "label": "Exactly",
             "value": "exact"
           }
         ],
           "required": true
           ,"flex" : 20
         };

         let nodeS :ITdDynamicElementConfig = {
           "label": param.name + ' - '+param.documentation,
           "name" : param.type+'-'+seq + '-2-'+param.name,
           "type": TdDynamicElement.Input,
           "required": true,
           "flex" : 80
         };
          this.elements.push(nodeOpt);
         this.elements.push(nodeS);
         break;
       case 'reference' :
         let nodeR :ITdDynamicElementConfig = {
           "label": param.name + ' - '+param.documentation,
           "name" : param.type+'-'+seq + '-1-'+param.name,
           "type": TdDynamicElement.Input,
           "required": true,
         };
         this.elements.push(nodeR);
         break;
github Teradata / covalent / src / app / components / components / component-demos / dynamic-forms / dynamic-forms.component.ts View on Github external
isMinMaxLengthSupported(type: TdDynamicElement | TdDynamicType): boolean {
    return type === TdDynamicElement.Input || type === TdDynamicType.Text;
  }
github Teradata / covalent / src / app / components / components / dynamic-forms / dynamic-forms.component.ts View on Github external
default: ['list1'],
      selections: ['list1', 'list2', 'list3'],
      flex: 100,
      validators: [
        {
          validator: (control: AbstractControl) => {
            const isValid: boolean = control.value.length <= 2;
            return !isValid ? { invalidChips: true } : undefined;
          },
        },
      ],
    },
  ];

  elementOptions: any[] = [
    TdDynamicElement.Input,
    TdDynamicType.Number,
    TdDynamicElement.Datepicker,
    TdDynamicElement.Password,
    TdDynamicElement.Textarea,
    TdDynamicElement.Slider,
    TdDynamicElement.Checkbox,
    TdDynamicElement.SlideToggle,
    TdDynamicElement.FileInput,
  ];

  showDynamicCode: boolean = false;

  type: any;

  count: number = 2;