Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/survey-core/src/survey-events-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ export interface CurrentPageChangedEvent {
* The current question.\
* This parameter has a value only in [question-per-page mode](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionsOnPageMode).
*/
oldCurrentQuestion?: Question;
oldCurrentQuestion?: Question | PanelModel;
/**
* A question that used to be current.\
* This parameter has a value only in [question-per-page mode](https://surveyjs.io/form-library/documentation/api-reference/survey-data-model#questionsOnPageMode).
*/
newCurrentQuestion?: Question;
newCurrentQuestion?: Question | PanelModel;
}
export interface CurrentPageChangingEvent extends CurrentPageChangedEvent {
/**
Expand Down
15 changes: 7 additions & 8 deletions packages/survey-core/src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4713,7 +4713,7 @@ export class SurveyModel extends SurveyElementCore
});
this.updateButtonsVisibility();
}
private currentSingleElementValue: IElement;
private currentSingleElementValue: IElement | undefined;
private getSingleElements(includeEl?: IElement): Array<IElement> {
const res = new Array<IElement>();
const pages = this.pages;
Expand All @@ -4727,10 +4727,10 @@ export class SurveyModel extends SurveyElementCore
}
return res;
}
public get currentSingleElement(): IElement {
public get currentSingleElement(): IElement | undefined {
return !this.isShowingPreview ? this.currentSingleElementValue : undefined;
}
public set currentSingleElement(val: IElement) {
public set currentSingleElement(val: IElement | undefined) {
const oldVal = this.currentSingleElement;
if(val !== oldVal && !this.isCompleted) {
const valQuestion = val?.isQuestion ? <Question>val : undefined;
Expand All @@ -4757,12 +4757,11 @@ export class SurveyModel extends SurveyElementCore
}
}
}
public get currentSingleQuestion(): Question {
const res = this.currentSingleElement;
return !!res && res.isQuestion ? <Question>res : undefined;
public get currentSingleQuestion(): Question | IPanel {
return <any>this.currentSingleElement;
}
public set currentSingleQuestion(val: Question) {
this.currentSingleElement = val;
public set currentSingleQuestion(val: Question | IPanel) {
this.currentSingleElement = <any>val;
}
private changeCurrentSingleElementOnVisibilityChanged(): void {
const el = this.currentSingleElement;
Expand Down