Skip to content

Commit

Permalink
Refactor fillSingleInputQuestionsInContainer function
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Feb 27, 2025
1 parent 8a62733 commit abdd75e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/survey-core/src/question.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ export class Question extends SurveyElement<Question>
protected getSingleInputQuestions(): Array<Question> {
return this.getNestedQuestions(true, false);
}
protected fillSingleInputQuestionsInContainer(res: Array<Question>): void {}
protected fillSingleInputQuestionsInContainer(res: Array<Question>, innerQuestion: Question): void {}
protected getSingleInputQuestionsForDynamic(): Array<Question> {
const res = new Array<Question>();
const q = this.getPropertyValue("singleInputQuestion");
Expand Down
11 changes: 4 additions & 7 deletions packages/survey-core/src/question_matrixdynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,10 @@ export class QuestionMatrixDynamicModel extends QuestionMatrixDropdownModelBase
}
return this.getSingleInputQuestionsForDynamic();
}
protected fillSingleInputQuestionsInContainer(res: Array<Question>): void {
const q = this.getPropertyValue("singleInputQuestion");
if(!!q && q !== this) {
const row = this.getRowByQuestion(q);
if(row) {
row.questions.forEach(q => q.addNestedQuestion(res, true, false));
}
protected fillSingleInputQuestionsInContainer(res: Array<Question>, innerQuestion: Question): void {
const row = this.getRowByQuestion(innerQuestion);
if(row) {
row.questions.forEach(q => q.addNestedQuestion(res, true, false));
}
}

Expand Down
11 changes: 4 additions & 7 deletions packages/survey-core/src/question_paneldynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1187,13 +1187,10 @@ export class QuestionPanelDynamicModel extends Question
this.onFirstRendering();
return this.getSingleInputQuestionsForDynamic();
}
protected fillSingleInputQuestionsInContainer(res: Array<Question>): void {
const q = this.getPropertyValue("singleInputQuestion");
if(!!q && q !== this) {
const panel = this.getPanelByQuestion(q);
if(panel) {
panel.questions.forEach(q => q.addNestedQuestion(res, true, false));
}
protected fillSingleInputQuestionsInContainer(res: Array<Question>, innerQuestion: Question): void {
const panel = this.getPanelByQuestion(innerQuestion);
if(panel) {
panel.questions.forEach(q => q.addNestedQuestion(res, true, false));
}
}
protected getSingleQuestionLocTitleCore(): LocalizableString {
Expand Down

0 comments on commit abdd75e

Please sign in to comment.