Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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": ""
},
},
{
"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
};
};
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,
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) => {
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) => {
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;
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,
"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;
isMinMaxLengthSupported(type: TdDynamicElement | TdDynamicType): boolean {
return type === TdDynamicElement.Input || type === TdDynamicType.Text;
}
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;