Skip to content

Commit

Permalink
Merge branch 'master' into feature/5328-ranking-items-to-order
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-kurmanov committed May 30, 2023
2 parents 26eb2d1 + 66b2051 commit c9317ad
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/localization/polish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export var polishSurveyStrings = {
timerLimitAll: "Spędziłeś {0} z {1} na tej stronie a w sumie {2} z {3}.",
timerLimitPage: "Spędziłeś {0} z {1} na tej stronie",
timerLimitSurvey: "Spędziłeś {0} z {1}.",
clearCaption: "Jasne",
clearCaption: "Wyczyść",
signaturePlaceHolder: "Podpisz tutaj",
chooseFileCaption: "Wybierz plik",
removeFileCaption: "Usuń ten plik",
Expand Down
6 changes: 4 additions & 2 deletions src/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,8 @@ export class PanelModelBase extends SurveyElement<Question>
return null;
}
/**
* Sets focus on the input of the first question in this panel/page.
* Focuses the first question in this panel/page.
* @see focusFirstErrorQuestion
*/
public focusFirstQuestion() {
var q = this.getFirstQuestionToFocus();
Expand All @@ -851,8 +852,9 @@ export class PanelModelBase extends SurveyElement<Question>
}
}
/**
* Sets focus on the input of the first question in this panel/page that has an error.
* Focuses the first question with a validation error in this panel/page.
* @see validate
* @see focusFirstQuestion
*/
public focusFirstErrorQuestion() {
var q = this.getFirstQuestionToFocus(true);
Expand Down
34 changes: 25 additions & 9 deletions src/survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,17 @@ export class SurveyModel extends SurveyElementCore
public onAfterRenderPanel: EventBase<SurveyModel, AfterRenderPanelEvent> = this.addEvent<SurveyModel, AfterRenderPanelEvent>();

/**
* The event occurs when an element within a question gets focus.
* An event that is raised when an element (input field, checkbox, radio button) within a question gets focus.
* @see onFocusInPanel
* @see focusFirstQuestionAutomatic
* @see focusQuestion
*/
public onFocusInQuestion: EventBase<SurveyModel, FocusInQuestionEvent> = this.addEvent<SurveyModel, FocusInQuestionEvent>();
/**
* The event occurs when an element within a panel gets focus.
* An event that is raised when an element within a panel gets focus.
* @see onFocusInQuestion
* @see focusFirstQuestionAutomatic
* @see focusQuestion
*/
public onFocusInPanel: EventBase<SurveyModel, FocusInPanelEvent> = this.addEvent<SurveyModel, FocusInPanelEvent>();

Expand Down Expand Up @@ -1227,7 +1231,12 @@ export class SurveyModel extends SurveyElementCore
this.setPropertyValue("surveyShowDataSaving", val);
}
/**
* Gets or sets whether the first input is focused on showing a next or a previous page.
* Specifies whether to focus the first question on the page on survey startup or when users switch between pages.
*
* Default value: `true`
* @see focusOnFirstError
* @see focusFirstQuestion
* @see focusQuestion
*/
public get focusFirstQuestionAutomatic(): boolean {
return this.getPropertyValue("focusFirstQuestionAutomatic");
Expand All @@ -1236,8 +1245,11 @@ export class SurveyModel extends SurveyElementCore
this.setPropertyValue("focusFirstQuestionAutomatic", val);
}
/**
* Gets or sets whether the first input is focused if the current page has errors.
* Set this property to `false` (the default value is `true`) if you do not want to bring the focus to the first question that has error on the page.
* Specifies whether to focus the first question with a validation error on the current page.
*
* Default value: `true`
* @see validate
* @see focusFirstQuestionAutomatic
*/
public get focusOnFirstError(): boolean {
return this.getPropertyValue("focusOnFirstError");
Expand Down Expand Up @@ -2965,7 +2977,9 @@ export class SurveyModel extends SurveyElementCore
}

/**
* Sets the input focus to the first question with the input field.
* Focuses the first question on the current page.
* @see focusQuestion
* @see focusFirstQuestionAutomatic
*/
public focusFirstQuestion() {
if (this.isFocusingQuestion) return;
Expand Down Expand Up @@ -6755,9 +6769,11 @@ export class SurveyModel extends SurveyElementCore
private skippedPages: Array<{ from: any, to: any }> = [];

/**
* Focus question by its name. If needed change the current page on the page where question is located.
* Function returns false if there is no question with this name or question is invisible, otherwise it returns true.
* @param name question name
* Focuses a question with a specified name. Switches the current page if needed.
* @param name A question name.
* @returns `false` if the survey does not contain a question with a specified name or this question is hidden; otherwise, `true`.
* @see focusFirstQuestion
* @see focusFirstQuestionAutomatic
*/
public focusQuestion(name: string): boolean {
var question = this.getQuestionByName(name, true);
Expand Down

0 comments on commit c9317ad

Please sign in to comment.