diff --git a/packages/wrappers-angular/src/components/reveal-view/reveal-view.component.ts b/packages/wrappers-angular/src/components/reveal-view/reveal-view.component.ts index 384e249..6abb528 100644 --- a/packages/wrappers-angular/src/components/reveal-view/reveal-view.component.ts +++ b/packages/wrappers-angular/src/components/reveal-view/reveal-view.component.ts @@ -97,4 +97,12 @@ export class RevealViewComponent { public getRVDashboard(): any { return this.revealView.nativeElement.getRVDashboard(); } + + public copy(input: string | number): void { + this.revealView.nativeElement.copy(input); + } + + public paste(target?: RvRevealView): void { + this.revealView.nativeElement.paste(target); + } } \ No newline at end of file diff --git a/packages/wrappers/src/components/reveal-view/reveal-view.component.ts b/packages/wrappers/src/components/reveal-view/reveal-view.component.ts index 1a8d14c..2eea6e1 100644 --- a/packages/wrappers/src/components/reveal-view/reveal-view.component.ts +++ b/packages/wrappers/src/components/reveal-view/reveal-view.component.ts @@ -362,14 +362,6 @@ export class RvRevealView extends LitElement { } } - /** - * Adds a visualization to the dashboard. - * @returns {void} - */ - addVisualization(): void { - this._revealView._dashboardView._delegate.addWidgetTriggered(); - } - /** * Adds a textbox visualization to the dashboard. * @returns {void} @@ -382,11 +374,26 @@ export class RvRevealView extends LitElement { } /** - * Gets the RVDashboard instance from the underlying RevealView object. - * @returns {RVDashboard} The RVDashboard instance. + * Adds a visualization to the dashboard. + * @returns {void} */ - getRVDashboard(): any { - return this._revealView ? this._revealView.dashboard : null; + addVisualization(): void { + this._revealView._dashboardView._delegate.addWidgetTriggered(); + } + + /** + * Copies a visualization to the clipboard. + * If a string ID is provided, the visualization with that ID is copied. + * If a number index is provided, the visualization at that index is copied. + * @param {string | number} input The ID or index of the visualization to copy + * @returns {void} + */ + copy(input: string | number): void { + const widgets = this._revealView._dashboardView.__widgets; + const sourceWidget = typeof input === "string" ? widgets.find((widget: any) => widget._widget._id === input) : widgets[input]; + if (sourceWidget) { + this._revealView._dashboardView.widgetCopied(sourceWidget._widget); + } } /** @@ -445,6 +452,24 @@ export class RvRevealView extends LitElement { this._revealView._dashboardView.exportToFormat("pptx"); } + /** + * Gets the RVDashboard instance from the underlying RevealView object. + * @returns {RVDashboard} The RVDashboard instance. + */ + getRVDashboard(): any { + return this._revealView ? this._revealView.dashboard : null; + } + + /** + * Pastes a visualization from the clipboard. + * If a target RevealView component is provided, the visualization is pasted to that component. + * @param {RvRevealView} target The target RevealView component to paste the visualization to. + * @returns {void} + */ + paste(target?: RvRevealView): void { + target?.paste() ?? this._revealView._dashboardView.pasteWidget(); + } + /** * Refreshes the data in the dashboard. * If no parameter is provided, the entire dashboard is refreshed.