From 7d062c94d7249bbbea425727b88f687c0ee6e2d8 Mon Sep 17 00:00:00 2001 From: Aleksey Novikov Date: Wed, 25 Dec 2024 15:51:21 +0300 Subject: [PATCH] #6329 Rename showOneCategoryInPropertyGrid Fixes #6329 --- packages/survey-creator-core/src/creator-base.ts | 10 ++++++++++ packages/survey-creator-core/src/creator-options.ts | 5 +++++ .../survey-creator-core/tests/creator-base.tests.ts | 13 +++++++++++++ 3 files changed, 28 insertions(+) diff --git a/packages/survey-creator-core/src/creator-base.ts b/packages/survey-creator-core/src/creator-base.ts index 39bbdf64cd..c4472246a4 100644 --- a/packages/survey-creator-core/src/creator-base.ts +++ b/packages/survey-creator-core/src/creator-base.ts @@ -201,6 +201,16 @@ export class SurveyCreatorModel extends Base } }); } + /** + * + * + */ + get propertyGridNavigationMode(): "buttons" | "accordion" { + return this.showOneCategoryInPropertyGrid ? "buttons" : "accordion"; + } + set propertyGridNavigationMode(newValue: "buttons" | "accordion") { + this.showOneCategoryInPropertyGrid = newValue === "buttons"; + } get allowEditSurveyTitle(): boolean { return this.getPropertyValue("allowEditSurveyTitle", true); diff --git a/packages/survey-creator-core/src/creator-options.ts b/packages/survey-creator-core/src/creator-options.ts index c07b2e2272..b6e4d7d52d 100644 --- a/packages/survey-creator-core/src/creator-options.ts +++ b/packages/survey-creator-core/src/creator-options.ts @@ -327,4 +327,9 @@ export interface ICreatorOptions { * @see expandCollapseButtonVisibility */ collapseQuestions?: boolean; + /** + * + * + */ + propertyGridNavigationMode?: "buttons" | "accordion"; } diff --git a/packages/survey-creator-core/tests/creator-base.tests.ts b/packages/survey-creator-core/tests/creator-base.tests.ts index c3f2212054..4d3df09fce 100644 --- a/packages/survey-creator-core/tests/creator-base.tests.ts +++ b/packages/survey-creator-core/tests/creator-base.tests.ts @@ -4806,4 +4806,17 @@ test("ZoomIn/ZoomOut actions limits", (): any => { zoom100Action.action(); expect(designerTabModel["surfaceScale"]).toBe(100); expect(creator.survey.widthScale).toBe(100); +}); + +test("propertyGridNavigationMode property", (): any => { + const creator = new CreatorTester(); + creator.propertyGridNavigationMode = "buttons"; + expect(creator.showOneCategoryInPropertyGrid).toBeTruthy(); + creator.propertyGridNavigationMode = "accordion"; + expect(creator.showOneCategoryInPropertyGrid).toBeFalsy(); + + creator.showOneCategoryInPropertyGrid = true; + expect(creator.propertyGridNavigationMode).toBe("buttons"); + creator.showOneCategoryInPropertyGrid = false; + expect(creator.propertyGridNavigationMode).toBe("accordion"); }); \ No newline at end of file