From c9f0c35cd5bfed96ec9c59157449cf3ac59dde78 Mon Sep 17 00:00:00 2001 From: Andrew Telnov Date: Wed, 13 Sep 2023 13:28:53 +0300 Subject: [PATCH] =?UTF-8?q?Progress=20bar=20with=20titles.=20Page=20name?= =?UTF-8?q?=20=E2=80=93>=20title=20fix=20#6925?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../progress/buttons/progress.component.html | 4 ++-- .../src/components/progress/ProgressButtons.vue | 4 ++-- src/knockout/components/progress/buttons.html | 2 +- src/page.ts | 3 +++ src/panel.ts | 7 +++++-- src/react/reactSurveyProgressButtons.tsx | 4 ++-- src/surveyToc.ts | 2 +- src/vue/progressButtons.vue | 4 ++-- tests/surveytests.ts | 15 +++++++++++++++ 9 files changed, 33 insertions(+), 12 deletions(-) diff --git a/packages/survey-angular-ui/src/components/progress/buttons/progress.component.html b/packages/survey-angular-ui/src/components/progress/buttons/progress.component.html index a14bb5c74d..4b63d91365 100644 --- a/packages/survey-angular-ui/src/components/progress/buttons/progress.component.html +++ b/packages/survey-angular-ui/src/components/progress/buttons/progress.component.html @@ -14,9 +14,9 @@ (click)="isListElementClickable(index) ? clickListElement(index) : null">
- {{ page.locNavigationTitle.renderedHtml || page.name }} + {{ page.renderedNavigationTitle }}
- {{ page.locNavigationTitle.renderedHtml || page.name }} + {{ page.renderedNavigationTitle }}
  • -
    +
diff --git a/src/page.ts b/src/page.ts index 55f6e72f88..25f7136eda 100644 --- a/src/page.ts +++ b/src/page.ts @@ -73,6 +73,9 @@ export class PageModel extends PanelModelBase implements IPage { this.locNavigationTitle.strChanged(); this.locNavigationDescription.strChanged(); } + public get renderedNavigationTitle(): string { + return this.locNavigationTitle.renderedHtml || this.title || this.name; + } public get passed(): boolean { return this.getPropertyValue("passed", false); } diff --git a/src/panel.ts b/src/panel.ts index e784cda253..e4453845e8 100644 --- a/src/panel.ts +++ b/src/panel.ts @@ -327,18 +327,21 @@ export class PanelModelBase extends SurveyElement (this.showDescription && this.isDesignMode && settings.designMode.showEmptyDescriptions); } - public localeChanged() { + public localeChanged(): void { super.localeChanged(); for (var i = 0; i < this.elements.length; i++) { ((this.elements[i])).localeChanged(); } } - public locStrsChanged() { + public locStrsChanged(): void { super.locStrsChanged(); for (var i = 0; i < this.elements.length; i++) { this.elements[i].locStrsChanged(); } } + public get renderedNavigationTitle(): string { + return this.title || this.name; + } /** * Returns a character or text string that indicates a required panel/page. * @see SurveyModel.requiredText diff --git a/src/react/reactSurveyProgressButtons.tsx b/src/react/reactSurveyProgressButtons.tsx index 4f97254735..30bf6d39c9 100644 --- a/src/react/reactSurveyProgressButtons.tsx +++ b/src/react/reactSurveyProgressButtons.tsx @@ -62,9 +62,9 @@ export class SurveyProgressButtons extends SurveyNavigationBase { >
- {page.navigationTitle || page.name} + {page.renderedNavigationTitle}
void) { var items = (pagesSource || []).map(page => { return new Action({ id: page.name, - title: ((page)["navigationTitle"]) || page.title || page.name, + title: page.renderedNavigationTitle, action: () => { if (typeof document !== undefined && !!document.activeElement) { !!(document.activeElement).blur && (document.activeElement).blur(); diff --git a/src/vue/progressButtons.vue b/src/vue/progressButtons.vue index bc454dc808..7315281c6a 100644 --- a/src/vue/progressButtons.vue +++ b/src/vue/progressButtons.vue @@ -21,9 +21,9 @@ >
- {{ page.locNavigationTitle.renderedHtml || page.name }} + {{ page.renderedNavigationTitle }}