Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#6335 SurveyCreator: Rename properties related to the Preview tab #6353

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class TabTestPlugin implements ICreatorPlugin {

constructor(private creator: SurveyCreatorModel) {
creator.addPluginTab("test", this);
this.setPreviewTheme(this.creator.themeForPreview);
this.setPreviewTheme(this.creator.previewTheme);
this.createActions().forEach(action => creator.toolbar.actions.push(action));
}
public activate(): void {
Expand Down Expand Up @@ -227,7 +227,7 @@ export class TabTestPlugin implements ICreatorPlugin {
});
let availableThemesToItems = this.getAvailableThemes(themeMapper);

if (this.creator.allowChangeThemeInPreview && availableThemesToItems.length > 1 && !this.creator.showThemeTab) {
if (this.creator.previewAllowSelectTheme && availableThemesToItems.length > 1 && !this.creator.showThemeTab) {
this.changeThemeModel = new ListModel(
availableThemesToItems,
(item: any) => {
Expand Down
46 changes: 41 additions & 5 deletions packages/survey-creator-core/src/creator-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,12 @@ export class SurveyCreatorModel extends Base
*
* Default value: `true`
*/
public get previewAllowSelectPage(): boolean { return this.showPagesInTestSurveyTab; }
public set previewAllowSelectPage(val: boolean) { this.showPagesInTestSurveyTab = val; }
/**
* Obsolete. Use the [`previewAllowSelectPage`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#previewAllowSelectPage) property instead.
* @deprecated
*/
public get showPagesInPreviewTab(): boolean { return this.showPagesInTestSurveyTab; }
public set showPagesInPreviewTab(val: boolean) { this.showPagesInTestSurveyTab = val; }

Expand All @@ -940,18 +946,29 @@ export class SurveyCreatorModel extends Base
*
* Default value: `true`
*/
public get previewAllowSimulateDevices(): boolean { return this.showSimulatorInTestSurveyTab; }
public set previewAllowSimulateDevices(val: boolean) { this.showSimulatorInTestSurveyTab = val; }
/**
* Obsolete. Use the [`previewAllowSimulateDevices`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#previewAllowSimulateDevices) property instead.
* @deprecated
*/
public get showSimulatorInPreviewTab(): boolean { return this.showSimulatorInTestSurveyTab; }
public set showSimulatorInPreviewTab(val: boolean) { this.showSimulatorInTestSurveyTab = val; }

/**
* A [UI theme](https://surveyjs.io/Documentation/Library?id=get-started-react#configure-styles) used to display the survey in the Preview tab.
*
* Accepted values: `"modern"`, `"default"`, `"defaultV2"`
*
* Default value: `"defaultV2"`
* @see allowChangeThemeInPreview
* @see previewAllowSelectTheme
*/
public previewTheme: string = "defaultV2";
/**
* Obsolete. Use the [`previewTheme`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#previewTheme) property instead.
* @deprecated
*/
public themeForPreview: string = "defaultV2";
public get themeForPreview() { return this.previewTheme; }
public set themeForPreview(val) { this.previewTheme = val; }

//#region Theme

Expand Down Expand Up @@ -1072,6 +1089,12 @@ export class SurveyCreatorModel extends Base
*
* [Localization & Globalization](https://surveyjs.io/survey-creator/documentation/survey-localization-translate-surveys-to-different-languages (linkStyle))
*/
public get previewAllowSelectLanguage(): boolean | string { return this.showDefaultLanguageInTestSurveyTab; }
public set previewAllowSelectLanguage(val: boolean | string) { this.showDefaultLanguageInTestSurveyTab = val; }
/**
* Obsolete. Use the [`previewAllowSelectLanguage`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#previewAllowSelectLanguage) property instead.
* @deprecated
*/
public get showDefaultLanguageInPreviewTab(): boolean | string { return this.showDefaultLanguageInTestSurveyTab; }
public set showDefaultLanguageInPreviewTab(val: boolean | string) { this.showDefaultLanguageInTestSurveyTab = val; }

Expand All @@ -1081,6 +1104,12 @@ export class SurveyCreatorModel extends Base
*
* Default value: `true`
*/
public get previewAllowHiddenElements(): boolean { return this.showInvisibleElementsInTestSurveyTab; }
public set previewAllowHiddenElements(val: boolean) { this.showInvisibleElementsInTestSurveyTab = val; }
/**
* Obsolete. Use the [`previewAllowHiddenElements`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#previewAllowHiddenElements) property instead.
* @deprecated
*/
public get showInvisibleElementsInPreviewTab(): boolean { return this.showInvisibleElementsInTestSurveyTab; }
public set showInvisibleElementsInPreviewTab(val: boolean) { this.showInvisibleElementsInTestSurveyTab = val; }

Expand All @@ -1090,9 +1119,16 @@ export class SurveyCreatorModel extends Base
* Default value: `true`
*
* [View Demo](https://surveyjs.io/Examples/Creator?id=theme-switcher (linkStyle))
* @see themeForPreview
* @see previewTheme
*/
public allowChangeThemeInPreview = true;
public previewAllowSelectTheme = true;
/**
* Obsolete. Use the [`previewAllowSelectTheme`](https://surveyjs.io/survey-creator/documentation/api-reference/survey-creator#previewAllowSelectTheme) property instead.
* @deprecated
*/
get allowChangeThemeInPreview() { return this.previewAllowSelectTheme; }
set allowChangeThemeInPreview(val) { this.previewAllowSelectTheme = val; }

private _tabResponsivenessMode: "menu" | "icons" = "menu";
public get tabResponsivenessMode(): "menu" | "icons" {
return this._tabResponsivenessMode;
Expand Down
30 changes: 30 additions & 0 deletions packages/survey-creator-core/src/creator-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ export interface ICreatorOptions {
*
* Default value: `true`
*/
previewAllowSelectPage?: boolean;
/**
* Obsolete. Use the [`previewAllowSelectPage`](https://surveyjs.io/survey-creator/documentation/api-reference/icreatoroptions#previewAllowSelectPage) property instead.
* @deprecated
*/
showPagesInPreviewTab?: boolean;
/**
* A [UI theme](https://surveyjs.io/Documentation/Library?id=get-started-react#configure-styles) used to display the survey in the Preview tab.
Expand All @@ -120,12 +125,22 @@ export interface ICreatorOptions {
*
* Default value: `"defaultV2"`
*/
previewTheme?: string;
/**
* Obsolete. Use the [`previewTheme`](https://surveyjs.io/survey-creator/documentation/api-reference/icreatoroptions#previewTheme) property instead.
* @deprecated
*/
themeForPreview?: string;
/**
* Specifies whether the Preview tab displays the Device button that allows users to preview the survey on different device types.
*
* Default value: `true`
*/
previewAllowSimulateDevices?: boolean;
/**
* Obsolete. Use the [`previewAllowSimulateDevices`](https://surveyjs.io/survey-creator/documentation/api-reference/icreatoroptions#previewAllowSimulateDevices) property instead.
* @deprecated
*/
showSimulatorInPreviewTab?: boolean;
/**
* Specifies whether the Preview tab displays the language selector.
Expand All @@ -146,12 +161,22 @@ export interface ICreatorOptions {
*
* **See also**: [Localization & Globalization](https://surveyjs.io/Documentation/Survey-Creator?id=localization)
*/
previewAllowSelectLanguage?: boolean | string;
/**
* Obsolete. Use the [`previewAllowSelectLanguage`](https://surveyjs.io/survey-creator/documentation/api-reference/icreatoroptions#previewAllowSelectLanguage) property instead.
* @deprecated
*/
showDefaultLanguageInPreviewTab?: boolean | string;
/**
* Specifies whether the Preview tab displays a checkbox that allows users to show or hide invisible survey elements.
*
* Default value: `true`
*/
previewAllowHiddenElements?: boolean;
/**
* Obsolete. Use the [`previewAllowHiddenElements`](https://surveyjs.io/survey-creator/documentation/api-reference/icreatoroptions#previewAllowHiddenElements) property instead.
* @deprecated
*/
showInvisibleElementsInPreviewTab?: boolean;
/**
* Specifies whether UI elements display survey, page, and question titles instead of their names.
Expand Down Expand Up @@ -229,6 +254,11 @@ export interface ICreatorOptions {
*
* [View Demo](https://surveyjs.io/Examples/Creator?id=theme-switcher (linkStyle))
*/
previewAllowSelectTheme?: boolean;
/**
* Obsolete. Use the [`previewAllowSelectTheme`](https://surveyjs.io/survey-creator/documentation/api-reference/icreatoroptions#previewAllowSelectTheme) property instead.
* @deprecated
*/
allowChangeThemeInPreview?: boolean;
/**
* Specifies a default device for survey preview in the Preview tab.
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-creator-core/tests/tabs/test.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ test("Change theme action hidden", (): any => {
let testPlugin: TabTestPlugin = <TabTestPlugin>creator.getPlugin("test");
testPlugin.activate();
expect(testPlugin["changeThemeAction"]).toBeDefined();
creator = new CreatorTester({ allowChangeThemeInPreview: false });
creator = new CreatorTester({ previewAllowSelectTheme: false });
testPlugin = <TabTestPlugin>creator.getPlugin("test");
testPlugin.activate();
expect(testPlugin["changeThemeAction"]).toBeUndefined();
Expand Down
Loading