import { Event, Question, SurveyModel } from "survey-core";
import { ICalculationResult, VisualizerBase } from "./visualizerBase";
import { ISelectBaseVisualizerOptions } from "./selectBase";
import { AlternativeVisualizersWrapper } from "./alternativeVizualizersWrapper";
import { IVisualizerPanelElement, IState, IPermission } from "./config";
import { LayoutEngine } from "./layout-engine";
import { DataProvider } from "./dataProvider";
import "./visualizationPanel.scss";
export interface IVisualizerPanelRenderedElement extends IVisualizerPanelElement {
visualizerInstance?: VisualizerBase;
renderedElement?: HTMLElement;
}
export declare class PanelElement implements IVisualizerPanelRenderedElement {
protected getStateProperties(): string[];
setState(elementState: any): void;
getState(): any;
constructor(name: string, displayName?: string);
/**
* A unique identifier for the dashboard item.
*
* If the [`questions`](https://surveyjs.io/dashboard/documentation/api-reference/idashboardoptions#questions) array is specified when initializing the Dashboard, item names are generated automatically based on the associated question names.
* @since 3.0.0
*/
name: string;
displayName: string;
isVisible: boolean;
isPublic: boolean;
visualizerInstance?: VisualizerBase;
renderedElement?: HTMLElement;
question?: Question;
questions?: Question[];
}
/**
* Obsolete. Use the [`IDashboardOptions`](https://surveyjs.io/dashboard/documentation/api-reference/idashboardoptions) configuration object and the [`Dashboard`](https://surveyjs.io/dashboard/documentation/api-reference/dashboard) class instead.
* @deprecated
*/
export interface IVisualizationPanelOptions extends ISelectBaseVisualizerOptions {
/**
* Maximum label length before truncation starts. Set to `-1` to disable truncation.
*
* Default value: `27`
*/
labelTruncateLength?: number;
allowMakeQuestionsPrivate?: boolean;
seriesValues?: string[];
seriesLabels?: string[];
useValuesAsLabels?: boolean;
/**
* A survey instance used to apply survey localization settings to the Dashboard UI.
*
* [View Demo](https://surveyjs.io/dashboard/examples/localize-survey-data-dashboard-ui/ (linkStyle))
*/
survey?: SurveyModel;
dataProvider?: DataProvider;
/**
* Enables users to hide individual dashboard items. Adds a **Hide** button to each item.
*
* Default value: `true`
*/
allowHideQuestions?: boolean;
/**
* Enables automatic layout based on available screen space and allows users to reorder items via drag and drop.
*
* If disabled, items are rendered sequentially (one below another), and drag-and-drop reordering is disabled. To disable only drag-and-drop while keeping dynamic layout, set [`allowDragDrop`](#allowDragDrop) to `false`.
*
* Default value: `true`
*
* [How to Disable the Layout Engine](https://github.com/surveyjs/surveyjs-howtos-and-troubleshooting/blob/50a2f6f755193afb4733435e2942f80c98731e84/categories/data-visualization/custom-layout.md (linkStyle))
* @see layoutEngine
*/
allowDynamicLayout?: boolean;
/**
* Enables drag-and-drop reordering of dashboard items. Applies only if [`allowDynamicLayout`](#allowDynamicLayout) is `true`.
*
* Default value: `true`
* @see layoutEngine
*/
allowDragDrop?: boolean;
/**
* A layout engine implementation used to arrange dashboard items. Use this property to integrate a third-party layout engine.
* @see allowDynamicLayout
*/
layoutEngine?: LayoutEngine;
haveCommercialLicense?: boolean;
allowExperimentalFeatures?: boolean;
defaultChartType?: string;
/**
* Enables cross-filtering between dashboard items. When enabled, selecting a data point filters other dashboard items accordingly.
*
* Default value: `true`
*/
allowSelection?: boolean;
renderContent?: Function;
destroyContent?: Function;
/**
* Removes HTML markup from survey element titles before rendering.
*
* Since survey titles may contain user-defined HTML, keeping this property enabled helps prevent potential injection of malicious code.
*
* Default value: `true`
*/
stripHtmlFromTitles?: boolean;
/**
* Enables switching between different visualizer types.
*
* Default value: `true`
* @since 2.3.8
*/
allowChangeVisualizerType?: boolean;
/**
* Specifies whether to display the toolbar.
*
* Default value: `true`
* @since 3.0.0
*/
showToolbar?: boolean;
}
/**
* Obsolete. Use the [`Dashboard`](/dashboard/documentation/api-reference/dashboard) class instead.
* @deprecated
*/
export declare class VisualizationPanel
extends VisualizerBase {
protected questions: Array;
private _isRoot;
static LayoutEngine: new (allowed: boolean, itemSelector: string, dragEnabled?: boolean) => LayoutEngine;
private _renderedQuestionsCount;
private _resetFilterButton;
protected _elements: Array;
private updateResetFilterButtonDisabled;
constructor(questions: Array, data: Array<{
[index: string]: any;
}>, options?: IVisualizationPanelOptions, elements?: Array, _isRoot?: boolean, type?: string);
get visualizers(): Array;
resetFilter(): void;
reorderVisibleElements(order: string[]): void;
private onAfterRenderQuestionCallback;
private onStateChangedCallback;
onAlternativeVisualizerChanged: Event<(sender: AlternativeVisualizersWrapper, options: any) => any, AlternativeVisualizersWrapper, any>;
private onAlternativeVisualizerChangedCallback;
private createHideButtonElement;
private createDragAreaElement;
private createHeaderElement;
protected onDataChanged(): void;
protected showElementCore(element: IVisualizerPanelRenderedElement, elementIndex?: number): void;
showElement(elementName: string): void;
protected hideElementCore(element: IVisualizerPanelRenderedElement): void;
hideElement(elementName: string): void;
hideAllElements(): void;
showAllElements(): void;
addElement(element: IVisualizerPanelElement | P, index?: number): void;
removeElement(element: P | string): void;
protected makeElementPrivate(element: IVisualizerPanelElement): void;
protected makeElementPublic(element: IVisualizerPanelElement): void;
protected moveVisibleElement(fromVisibleIndex: number, toVisibleIndex: number): void;
protected moveElement(fromIndex: number, toIndex: number): void;
protected setBackgroundColorCore(color: string): void;
protected setupVisualizer(visualizer: VisualizerBase, question: Question): void;
protected buildVisualizer(element: P, questions: Array): void;
private destroyElementVisualizer;
private destroyVisualizers;
protected setLocale(newLocale: string): void;
/**
* Returns the [`allowDynamicLayout`](https://surveyjs.io/dashboard/documentation/api-reference/idashboardoptions#allowDynamicLayout) property value passed to the constructor.
*/
get allowDynamicLayout(): boolean;
/**
* Returns the [`allowDragDrop`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizationpaneloptions#allowDragDrop) property value passed to the constructor.
*/
get allowDragDrop(): boolean;
/**
* Returns the [`allowHideQuestions`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizationpaneloptions#allowHideQuestions) property value passed to the constructor.
*/
get allowHideQuestions(): boolean;
get allowMakeQuestionsPrivate(): boolean;
get haveSeveralChildren(): boolean;
private _layoutEngine;
/**
* Returns a [`LayoutEngine`](https://surveyjs.io/dashboard/documentation/api-reference/layoutengine) instance that arranges visualization items within the dashboard.
* @hidefor Dashboard
*/
get layoutEngine(): LayoutEngine;
protected createElement(element: IVisualizerPanelElement, question?: Question): P;
protected buildElements(questions: Question[], elements?: Array): P[];
/**
* Returns an array of [`IVisualizerPanelElement`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizerpanelelement) objects with information about visualization items.
* @param questionNames Question [names](https://surveyjs.io/form-library/documentation/api-reference/question#name). Do not specify this parameter to get an array of all visualization items.
* @see visibleElements
* @see hiddenElements
* @hidefor Dashboard
*/
getElements(questionNames?: Array): IVisualizerPanelElement[];
/**
* Returns an array of [`IVisualizerPanelElement`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizerpanelelement) objects with information about currently visible visualization items.
*
* If you want to disallow users to hide visualization items, set the [`allowHideQuestions`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizationpaneloptions#allowHideQuestions) property to `false`.
* @see hiddenElements
* @see getElements
* @hidefor Dashboard
*/
get visibleElements(): P[];
/**
* Returns an array of [`IVisualizerPanelElement`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizerpanelelement) objects with information about currently hidden visualization items.
*
* If you want to disallow users to hide visualization items, set the [`allowHideQuestions`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizationpaneloptions#allowHideQuestions) property to `false`.
* @see visibleElements
* @see getElements
* @hidefor Dashboard
*/
get hiddenElements(): P[];
get publicElements(): P[];
get privateElements(): P[];
protected get locales(): any;
/**
* Returns a visualization item with a specified question name.
* @param name A question [name](https://surveyjs.io/form-library/documentation/api-reference/question#name).
* @hidefor Dashboard
*/
getElement(questionName: string): P;
/**
* Returns a [visualizer](https://surveyjs.io/dashboard/documentation/api-reference/visualizerbase) that visualizes a specified survey question.
* @param questionName A question [name](https://surveyjs.io/form-library/documentation/api-reference/question#name).
* @hidefor Dashboard
*/
getVisualizer(questionName: string): VisualizerBase;
/**
* @deprecated Use [`onElementShown`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel#onElementShown), [`onElementHidden`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel#onElementHidden), or [`onElementMoved`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel#onElementMoved) instead.
* @hidden
*/
onVisibleElementsChanged: Event<(sender: VisualizationPanel, options: any) => any, VisualizationPanel, any>;
/**
* An event that is raised when users [show a visualization item](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizationpaneloptions#allowHideQuestions).
*
* Parameters:
*
* - `sender`: [`VisualizationPanel`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel)\
* A `VisualizationPanel` that raised the event.
*
* - `options.elements`: Array\<[`IVisualizerPanelElement`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizerpanelelement)\>\
* Information about all visualization items rendered by this `VisualizationPanel`.
*
* - `options.element`: [`IVisualizerPanelElement`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizerpanelelement)\
* A visualization item that has been shown.
* @hidefor Dashboard
*/
onElementShown: Event<(sender: VisualizationPanel, options: any) => any, VisualizationPanel, any>;
/**
* An event that is raised when users [hide a visualization item](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizationpaneloptions#allowHideQuestions).
*
* Parameters:
*
* - `sender`: [`VisualizationPanel`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel)\
* A `VisualizationPanel` that raised the event.
*
* - `options.elements`: Array\<[`IVisualizerPanelElement`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizerpanelelement)\>\
* Information about all visualization items rendered by this `VisualizationPanel`.
*
* - `options.element`: [`IVisualizerPanelElement`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizerpanelelement)\
* A visualization item that has been hidden.
* @hidefor Dashboard
*/
onElementHidden: Event<(sender: VisualizationPanel, options: any) => any, VisualizationPanel, any>;
/**
* An event that is raised when users [move a visualization item](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizationpaneloptions#allowDynamicLayout).
*
* Parameters:
*
* - `sender`: [`VisualizationPanel`](https://surveyjs.io/dashboard/documentation/api-reference/visualizationpanel)\
* A `VisualizationPanel` that raised the event.
*
* - `options.elements`: Array\<[`IVisualizerPanelElement`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizerpanelelement)\>\
* Information about all visualization items rendered by this `VisualizationPanel`.
*
* - `options.element`: [`IVisualizerPanelElement`](https://surveyjs.io/dashboard/documentation/api-reference/ivisualizerpanelelement)\
* A visualization item that has been moved.
* @hidefor Dashboard
*/
onElementMoved: Event<(sender: VisualizationPanel, options: any) => any, VisualizationPanel, any>;
protected visibleElementsChanged(element: IVisualizerPanelElement, reason: string): void;
onPermissionsChangedCallback: any;
protected renderPanelElement(element: IVisualizerPanelRenderedElement, container: HTMLElement): HTMLElement;
protected renderBanner(container: HTMLElement): void;
protected renderToolbar(container: HTMLElement): void;
renderContent(container: HTMLElement): void;
protected destroyContent(container: HTMLElement): void;
/**
* Redraws the dashboard and all its content.
*/
refresh(): void;
layout(): void;
/**
* Filters visualized data based on a specified question name and value. This method is called when a user clicks a chart point.
* @param questionName A question [name](https://surveyjs.io/form-library/documentation/api-reference/question#name).
* @param selectedValue A filter value.
*/
setFilter(questionName: string, selectedValue: any): void;
getState(): IState;
/**
* Gets or sets the Dashboard state.
*
* The state includes configuration of dashboard items and the current locale.
*
* [View Demo](https://surveyjs.io/dashboard/examples/save-dashboard-state-to-local-storage/ (linkStyle))
* @see onStateChanged
*/
get state(): IState;
set state(newState: IState);
resetState(): void;
get permissions(): IPermission[];
set permissions(permissions: IPermission[]);
protected getCalculatedValuesCore(): ICalculationResult;
protected onThemeChanged(): void;
destroy(): void;
}