From ab3cb88be353e53661a775792a5e2eb1b640bb17 Mon Sep 17 00:00:00 2001 From: RomanTsukanov Date: Wed, 13 Nov 2024 12:42:46 +0400 Subject: [PATCH] Add descriptions --- packages/survey-creator-core/src/creator-base.ts | 12 ++++++------ .../survey-creator-core/src/creator-events-api.ts | 9 +++++++++ packages/survey-creator-core/src/creator-options.ts | 10 +++++++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/packages/survey-creator-core/src/creator-base.ts b/packages/survey-creator-core/src/creator-base.ts index fd52a6dd2a..ab552c6b08 100644 --- a/packages/survey-creator-core/src/creator-base.ts +++ b/packages/survey-creator-core/src/creator-base.ts @@ -435,8 +435,8 @@ export class SurveyCreatorModel extends Base */ public onHtmlToMarkdown: EventBase = this.addCreatorEvent(); - /** - + /* + * An event that is raised when Survey Creator obtains the expand/collapse state of a survey element on the design surface. Handle this event to set a required state. */ public onElementGetExpandCollapseState: EventBase = this.addCreatorEvent(); /** @@ -1205,7 +1205,7 @@ export class SurveyCreatorModel extends Base const chaningOptions = { tabName: viewName, allow: allow, model: this.currentPlugin?.model }; this.onActiveTabChanging.fire(this, chaningOptions); if (!chaningOptions.allow) return; - if(!!this.currentPlugin?.deactivate && !this.currentPlugin.deactivate()) return; + if (!!this.currentPlugin?.deactivate && !this.currentPlugin.deactivate()) return; const plugin = this.activatePlugin(viewName); this.viewType = viewName; this.onActiveTabChanged.fire(this, { tabName: viewName, plugin: plugin, model: !!plugin ? plugin.model : undefined }); @@ -2191,12 +2191,12 @@ export class SurveyCreatorModel extends Base this.initSurveyWithJSON(undefined, clearState); } else { let jsonValue = trustJSON ? this.parseJSON(value) : undefined; - if(!trustJSON) { + if (!trustJSON) { const textWorker = new SurveyTextWorker(value); - if(textWorker.isJsonCorrect) { + if (textWorker.isJsonCorrect) { jsonValue = this.parseJSON(value); } - else if(!!textWorker.survey) { + else if (!!textWorker.survey) { jsonValue = textWorker.survey.toJSON(); } } diff --git a/packages/survey-creator-core/src/creator-events-api.ts b/packages/survey-creator-core/src/creator-events-api.ts index 2dfcb952f2..494d732254 100644 --- a/packages/survey-creator-core/src/creator-events-api.ts +++ b/packages/survey-creator-core/src/creator-events-api.ts @@ -89,8 +89,17 @@ export interface HtmlToMarkdownEvent { export type ElementGetExpandCollapseStateEventReason = "loading" | "collapse-all" | "expand-all" | "drag-start" | "drag-end"; export interface ElementGetExpandCollapseStateEvent { + /** + * A survey element (question, panel, or page) whose expand/collapse state you can switch. + */ element: Question | PanelModel | PageModel; + /** + * Indicates whether the element is currently collapsed or expanded. Set this parameter to `true` if you want to collapse the element or `false` to expand it. + */ collapsed: boolean; + /** + * A value that indicates what caused the event to raise: the loading of a survey JSON schema, a click on the Expand All or Collapse All button, or the beginning or end of a drag and drop operation. + */ reason: ElementGetExpandCollapseStateEventReason; } diff --git a/packages/survey-creator-core/src/creator-options.ts b/packages/survey-creator-core/src/creator-options.ts index 14fc85108e..37d6a9d189 100644 --- a/packages/survey-creator-core/src/creator-options.ts +++ b/packages/survey-creator-core/src/creator-options.ts @@ -272,6 +272,14 @@ export interface ICreatorOptions { */ pageEditMode?: "standard" | "single" | "bypage"; enableLinkFileEditor?: boolean; - + /* + * Specifies the visibility of the buttons that expand and collapse survey elements on the design surface. + * + * Possible values: + * + * - `"onhover"` (default) - Displays an expand/collapse button when a survey element is hovered over or selected. + * - `"always"` - Displays the expand/collapse buttons permanently. + * - `"never"` - Hides the expand/collapse buttons. + */ expandCollapseButtonVisibility?: "never" | "onhover" | "always"; }