stimulsoft-reports-js-vuejs 2025.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/viewer.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { Stimulsoft } from "./stimulsoft.reports"
2
+ export { Stimulsoft };
3
+
4
+ type ViewerProperties = {
5
+ report?: Stimulsoft.Report.StiReport;
6
+ visible?: boolean,
7
+ options?: Stimulsoft.Viewer.StiViewerOptions,
8
+ id?: string,
9
+ }
10
+
11
+ export declare class Viewer {
12
+ $props: ViewerProperties;
13
+ }
package/viewer.js ADDED
@@ -0,0 +1,114 @@
1
+ import { watch, h, onMounted, onUnmounted, useTemplateRef } from 'vue'
2
+ import { } from "./stimulsoft.reports.engine.mjs";
3
+ import { } from "./stimulsoft.reports.chart.mjs";
4
+ import { } from "./stimulsoft.reports.export.mjs";
5
+ import { } from "./stimulsoft.reports.import.xlsx.mjs";
6
+ import { } from "./stimulsoft.reports.maps.mjs";
7
+ import { Stimulsoft } from "./stimulsoft.viewer.mjs";
8
+ export { Stimulsoft };
9
+
10
+ export const Viewer = {
11
+ props: {
12
+ report: {
13
+ type: Stimulsoft.Report.StiReport,
14
+ default: null
15
+ },
16
+ visible: {
17
+ type: Boolean,
18
+ default: true
19
+ },
20
+ options: {
21
+ type: Stimulsoft.Viewer.StiViewerOptions,
22
+ default: null
23
+ },
24
+ id: {
25
+ type: String,
26
+ default: null
27
+ }
28
+ },
29
+ emits: ["prepareVariables", "beginProcessData", "endProcessData", "printReport", "beginExportReport", "endExportReport", "interaction", "emailReport", "designReport", "showReport", "openReport", "openedReport"],
30
+ setup(props, context) {
31
+ var viewer;
32
+ var parentRef = useTemplateRef('parentRef')
33
+
34
+ const createViewer = () => {
35
+ viewer = new Stimulsoft.Viewer.StiViewer(props.options, props.id, false);
36
+ viewer.renderHtml(parentRef.value);
37
+ bindEvents();
38
+
39
+ viewer.visible = props.visible;
40
+ }
41
+
42
+ const bindEvents = () => {
43
+ viewer.onPrepareVariables = (args, callback) => context.emit("prepareVariables", args, callback);
44
+ viewer.onBeginProcessData = (args, callback) => context.emit("beginProcessData", args, callback);
45
+ viewer.onEndProcessData = (args) => context.emit("endProcessData", args);
46
+ viewer.onPrintReport = (args) => context.emit("printReport", args);
47
+ viewer.onBeginExportReport = (args) => context.emit("beginExportReport", args);
48
+ viewer.onEndExportReport = (args) => context.emit("endExportReport", args);
49
+ viewer.onInteraction = (args) => context.emit("interaction", args);
50
+ viewer.onEmailReport = (args) => context.emit("emailReport", args);
51
+ viewer.onDesignReport = (args) => context.emit("designReport", args);
52
+ viewer.onShowReport = (args) => context.emit("showReport", args);
53
+ viewer.onOpenReport = (args, callback) => {
54
+ args.preventDefault = false;
55
+ context.emit("openReport", args, callback);
56
+ }
57
+ viewer.onOpenedReport = (args, callback) => context.emit("openedReport", args, callback);
58
+ }
59
+
60
+ onMounted(() => {
61
+ setTimeout(() => {
62
+ createViewer();
63
+ viewer.report = props.report;
64
+ });
65
+ });
66
+
67
+ onUnmounted(() => {
68
+ if (viewer != null)
69
+ viewer.dispose();
70
+ });
71
+
72
+ watch(
73
+ () => props.report,
74
+ () => {
75
+ if (viewer)
76
+ viewer.report = props.report;
77
+ },
78
+ { immediate: true }
79
+ )
80
+
81
+ watch(
82
+ () => props.options,
83
+ () => {
84
+ if (viewer) {
85
+ createViewer();
86
+ viewer.report = props.report;
87
+ }
88
+ },
89
+ { immediate: true, deep: true }
90
+ )
91
+
92
+ watch(
93
+ () => props.visible,
94
+ () => {
95
+ if (viewer)
96
+ viewer.visible = props.visible;
97
+ },
98
+ { immediate: true }
99
+ )
100
+
101
+ watch(
102
+ () => props.id,
103
+ () => {
104
+ if (viewer) {
105
+ createViewer();
106
+ viewer.report = props.report;
107
+ }
108
+ },
109
+ { immediate: true}
110
+ )
111
+
112
+ return () => h('div', { ref: "parentRef" })
113
+ }
114
+ }