src/group/data-table.model.ts
Properties |
|
Methods |
|
constructor(code: string, description: string, questions: [][], validations: Validation[])
|
||||||||||||||||||||
Defined in src/group/data-table.model.ts:5
|
||||||||||||||||||||
Parameters :
|
Public getQuestionByName | ||||||||
getQuestionByName(name: string)
|
||||||||
Defined in src/group/data-table.model.ts:16
|
||||||||
Parameters :
Returns :
Question<any>
|
Public getQuestionByNameAndIndex |
getQuestionByNameAndIndex(name: string, index: number)
|
Defined in src/group/data-table.model.ts:24
|
Returns :
Question<any>
|
Public isRequired |
isRequired()
|
Defined in src/group/data-table.model.ts:38
|
Returns :
boolean
|
Public validations |
validations:
|
Type : Validation[]
|
Defined in src/group/data-table.model.ts:11
|
import { Group, GroupType } from '.';
import { Question } from '../question';
import { Pattern, Validation, ValidationType } from '../validation';
export class DataTable extends Group<Question<any>[][]> {
public constructor(
code: string,
description: string,
questions: Question<any>[][],
public validations: Validation[] = []
) {
super(code, description, GroupType.DATATABLE, questions);
}
public getQuestionByName(name: string): Question<any> {
for (const question of this.questions[0]) {
if (question.name === name) {
return question;
}
}
}
public getQuestionByNameAndIndex(name: string, index: number): Question<any> {
const questions: Question<any>[] = this.questions[index];
if (!questions) {
return;
}
for (const question of questions) {
if (question.name === name) {
return question;
}
}
}
public isRequired(): boolean {
for (const validation of this.validations) {
if (ValidationType.REQUIRED === validation.type) {
return true;
}
}
return false;
}
}