@mescius/activereportsnet-designer 18.0.0

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.
@@ -0,0 +1,165 @@
1
+ # ActiveReports Web Designer Reference
2
+
3
+ This document provides information on how to set up Web Designer.
4
+
5
+ - [ActiveReports Web Designer Reference](#activereports-web-designer-reference)
6
+ - [Code Snippets](#code-snippets)
7
+ - [General](#general)
8
+ - [Custom Localization](#custom-localization)
9
+ - [Basic Sample Custom Localization JSON](#basic-sample-custom-localization-json)
10
+ - [Common](#common)
11
+ - [Name Templates](#name-templates)
12
+ - [Parameters](#parameters)
13
+
14
+ ## Code Snippets
15
+
16
+ ### General
17
+
18
+ ```html
19
+ <!DOCTYPE html>
20
+ <html lang="en">
21
+
22
+ <head>
23
+
24
+ <title>ActiveReports Web Designer</title>
25
+ <meta charset="utf-8">
26
+ <meta name="viewport" content="width=device-width, initial-scale=1">
27
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
28
+
29
+ <link rel="stylesheet" href="vendor/css/bootstrap.css" />
30
+ <link rel="stylesheet" href="vendor/css/fonts-googleapis.css" type="text/css">
31
+
32
+ <!-- Optional: Required for Report Viewer -->
33
+ <link rel="stylesheet" href="jsViewer.min.css" />
34
+
35
+ <link rel="stylesheet" href="web-designer.css" />
36
+
37
+ </head>
38
+
39
+ <body>
40
+
41
+ <!-- Optional: Required for Report Viewer -->
42
+ <script src="jsViewer.min.js"></script>
43
+
44
+ <script src="web-designer.js"></script>
45
+
46
+ <div id="designer-id" style="width: 100%; height: 100%;"></div>
47
+
48
+ <script>
49
+
50
+ var designerOptions = GrapeCity.ActiveReports.WebDesigner.createDesignerOptions();
51
+ designerOptions.server.url = 'api';
52
+
53
+ /* Optional: Open Report */
54
+ designerOptions.openButton.visible = true;
55
+
56
+ /* Optional: Save Report */
57
+ designerOptions.saveButton.visible = true;
58
+
59
+ /* Optional: Save Report As */
60
+ designerOptions.saveAsButton.visible = true;
61
+
62
+ /* Optional: Add/Edit/Remove Data Sets */
63
+ designerOptions.dataTab.dataSets.canModify = true;
64
+
65
+ /* Optional: Add/Edit/Remove Data Sources */
66
+ designerOptions.dataTab.dataSources.canModify = true;
67
+
68
+ /* Optional: Required for Report Viewer */
69
+ var viewer = null;
70
+ designerOptions.openViewer = function(options) {
71
+ if (viewer) {
72
+ viewer.openReport(options.reportInfo.id);
73
+ return;
74
+ }
75
+
76
+ viewer = GrapeCity.ActiveReports.JSViewer.create({
77
+ locale: options.locale,
78
+ element: '#' + options.element,
79
+ reportService: {
80
+ url: 'api/reporting',
81
+ },
82
+ reportID: options.reportInfo.id,
83
+ settings: {
84
+ zoomType: 'FitPage',
85
+ },
86
+ });
87
+ };
88
+
89
+ GrapeCity.ActiveReports.WebDesigner.renderApplication('designer-id', designerOptions);
90
+
91
+ </script>
92
+
93
+ </body>
94
+
95
+ </html>
96
+ ```
97
+
98
+ ## Custom Localization
99
+
100
+ ### Basic Sample Custom Localization JSON
101
+
102
+ Here *data-set-picker* namespace is used as an example for the **Custom Localization** feature.
103
+
104
+ * **"ns"** property is a **namespace** – it shouldn't be translated - it is required for proper work of the **Custom Localization** feature
105
+ * **"lng"** property is a **locale** - it should be replaced with a proper locale - for example, "es" for Spanish
106
+ * **"resources"** property contains localization resources used in the corresponding namespace - contents of this property require translation
107
+
108
+ ```json
109
+ [
110
+ {
111
+ "ns": "data-set-picker",
112
+ "lng": "<custom-locale>",
113
+ "resources": {
114
+ "add": "Add",
115
+ "cancel": "Cancel",
116
+ "gettingContent": "Getting the resource content...",
117
+ "gettingDataResources": "Getting the list of available data resources...",
118
+ "header": "Pick a Data Set",
119
+ "noDataResourcesAvailable": "No data resources available",
120
+ "searchBoxPlaceholder": "enter data resource name here..."
121
+ }
122
+ }
123
+ ]
124
+ ```
125
+
126
+ ### Common
127
+
128
+ If you would like to utilize the **Custom Localization** feature:
129
+ 1. You need to translate the **resources** sections from the **designer-custom-localization.json** file.
130
+ 2. Also it is required to replace **custom-locale** stub with your locale.
131
+ 3. Pass the translated **designer-custom-localization.json** contents to the **localeData** property of the created **designerOptions**.
132
+
133
+ **Example:**
134
+
135
+ ```javascript
136
+ var designerOptions = GrapeCity.ActiveReports.WebDesigner.createDesignerOptions();
137
+
138
+ designerOptions.localeData = [
139
+ {
140
+ "ns": "data-set-picker",
141
+ "lng": "es",
142
+ "resources": {
143
+ "add": "Agregar",
144
+ "cancel": "Cancelar",
145
+ // ... other translated localization resources
146
+ }
147
+ }
148
+ ];
149
+
150
+ GrapeCity.ActiveReports.WebDesigner.renderApplication('designer-id', designerOptions);
151
+ ```
152
+
153
+ ### Name Templates
154
+
155
+ In *designer-custom-localization.json* **"resources"** sections there are **"nameTemplates"** sub-sections. Values in these sections are expected to be alphanumeric identifiers. I.e., they can contain only **letters** and **digits** but cannot start with a digit. The same is applicable to **"dataSourceNameTemplate"** property from *data-source-editor* namespace **"resources"** section.
156
+
157
+ ### Parameters
158
+
159
+ Please note some resource strings have parameters - they are in curly braces {} - you don't need to translate parameter labels:
160
+
161
+ ```javascript
162
+ "versionLabel": "Version: {versionNumber}"
163
+ /* {versionNumber} is a parameter - it doesn't require translation - only text is translated */
164
+ "versionLabel": "Versión: {versionNumber}"
165
+ ```