@mescius/activereportsnet-viewer 18.2.2 → 19.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mescius/activereportsnet-viewer",
3
- "version": "18.2.2",
3
+ "version": "19.0.1",
4
4
  "description": "Fast, full featured, JavaScript report viewer for ActiveReports report definition files. Features include printing, exporting, and searching.",
5
5
  "main": "./dist/jsViewer.min.js",
6
6
  "module": "./esm/jsViewer.min.js",
@@ -13,6 +13,7 @@
13
13
  "dist/custom-locale.json",
14
14
  "dist/jsViewer.chart.min.js",
15
15
  "dist/jsViewer.chart.min.css",
16
+ "dist/jsViewer.custom.styles.css",
16
17
  "esm/",
17
18
  "types/"
18
19
  ],
@@ -1,53 +1,3 @@
1
- declare class Color {
2
- R: number;
3
- G: number;
4
- B: number;
5
- A: number | undefined;
6
- constructor(r: number, g: number, b: number, a?: number | undefined);
7
- static fromHEX(color: string): Color;
8
- }
9
- type UITheme$1<T extends Record<string, string> = Record<string, string>> = {
10
- name: string;
11
- accent: Color;
12
- accentText: Color;
13
- accentSecondary: Color;
14
- accentWarning: Color;
15
- accentWarningText?: Color;
16
- accentError: Color;
17
- accentErrorText?: Color;
18
- colorContrast: Color;
19
- colorContrastText: Color;
20
- backgroundBody: Color;
21
- backgroundBodyOverlay?: Color;
22
- backgroundPanels: Color;
23
- backgroundPanelsSection?: Color;
24
- backgroundPanelsBorder?: Color;
25
- backgroundPanelsOverlay?: Color;
26
- shadow: string;
27
- shadowBorder: string;
28
- overlay: Color;
29
- textColor: Color;
30
- textFamily?: string;
31
- borderRadius: number;
32
- elemBackground: Color;
33
- elemBackgroundHover: Color;
34
- btnGroupHeader: Color;
35
- btnGroupHeaderHover: Color;
36
- dropdownBackground: Color;
37
- dropdownBackgroundHover?: Color;
38
- dropdownBorder?: Color;
39
- bindingModified?: Color;
40
- bindingBound?: Color;
41
- custom?: T;
42
- };
43
- declare const UIThemes: {
44
- default: UITheme$1<Record<string, string>> | undefined;
45
- defaultDark: UITheme$1<Record<string, string>> | undefined;
46
- darkOled: UITheme$1<Record<string, string>> | undefined;
47
- highContrast: UITheme$1<Record<string, string>> | undefined;
48
- highContrastDark: UITheme$1<Record<string, string>> | undefined;
49
- };
50
-
51
1
  /** Type representing a viewer's sidebar instance. */
52
2
  interface Sidebar {
53
3
  /**
@@ -90,7 +40,9 @@ declare enum ToolbarButtons {
90
40
  /** Galley mode switcher button. */
91
41
  GalleyMode = "$galleymode",
92
42
  /** 'Print' button. */
93
- Print = "$print"
43
+ Print = "$print",
44
+ /** Theme switcher button. */
45
+ Theme = "$theme"
94
46
  }
95
47
  /**
96
48
  * Type representing a viewer's toolbar item.
@@ -246,8 +198,77 @@ interface Toolbar {
246
198
  fullscreen: ToolbarItems;
247
199
  }
248
200
 
249
- type UITheme = UITheme$1;
201
+ /** Represents a color item with multiple shades. */
202
+ type ColorThemeShades = {
203
+ veryLight: string;
204
+ light: string;
205
+ lighter: string;
206
+ lightMedium: string;
207
+ medium: string;
208
+ base: string;
209
+ darkMedium: string;
210
+ darker: string;
211
+ dark: string;
212
+ veryDark: string;
213
+ };
214
+ /** Specifies the type of the color theme. */
215
+ type ColorThemeType = 'light' | 'dark';
216
+ /** Represents a color item in a color theme. */
217
+ type ColorThemeItem = string | ColorThemeShades;
218
+ /** Represents the UI theme settings for customizing the appearance. */
219
+ type ColorTheme = {
220
+ name: string;
221
+ type: ColorThemeType;
222
+ backgroundMain: string;
223
+ backgroundPanels: string;
224
+ primary?: ColorThemeItem;
225
+ secondary?: ColorThemeItem;
226
+ neutral?: ColorThemeItem;
227
+ error?: ColorThemeItem;
228
+ warning?: ColorThemeItem;
229
+ fontFamily?: string;
230
+ };
231
+ /** Represents the default themes */
232
+ declare const ColorThemes: {
233
+ default: ColorTheme;
234
+ defaultDark: ColorTheme;
235
+ darkOled: ColorTheme;
236
+ highContrast: ColorTheme;
237
+ highContrastDark: ColorTheme;
238
+ activeReports: ColorTheme;
239
+ activeReportsDark: ColorTheme;
240
+ };
250
241
 
242
+ /** Result of an action. */
243
+ interface ActionResult {
244
+ /** Whether the action should be canceled. */
245
+ cancel: boolean;
246
+ }
247
+ /** Information about an action. */
248
+ interface ActionInfo {
249
+ /** Type of the action. */
250
+ type: ActionType;
251
+ /** Parameters associated with the action, if any. */
252
+ parameters?: ActionParameter[];
253
+ /** Target of the action, if any. */
254
+ target?: ActionTarget;
255
+ }
256
+ /** Possible action types. */
257
+ type ActionType = 'toggle' | 'sort' | 'bookmark' | 'hyperlink' | 'drillthrough' | 'applyParameters';
258
+ /** Parameters for an action. */
259
+ type ActionParameter = {
260
+ /** Parameter name. */
261
+ name: string;
262
+ /** Type of the apply parameter. */
263
+ type?: 'Set' | 'Reset' | 'Toggle';
264
+ /** Values associated with the parameter. */
265
+ values: any[];
266
+ };
267
+ /** Target of an action. */
268
+ type ActionTarget = {
269
+ pageNumber: number;
270
+ selector?: string;
271
+ } | string;
251
272
  /** Report types. */
252
273
  declare enum ReportType {
253
274
  Section = 0,
@@ -483,6 +504,9 @@ type HoverChartAnimationOptions = {
483
504
  /** The following options can be set during initialization or at run time while working with the JS Viewer. */
484
505
  interface InitializationOptions {
485
506
  /**
507
+ * * @deprecated This property is deprecated and will be removed in future versions.
508
+ * Use the new `onAction` property instead.
509
+ *
486
510
  * The callback that is invoked before the JS Viewer opens the hyperlink, bookmark link,
487
511
  * drill down report or toggles the report control visibility.
488
512
  * @example Usage example:
@@ -490,18 +514,51 @@ interface InitializationOptions {
490
514
  * // ESM usage
491
515
  * import { createViewer } from './jsViewer.min.js';
492
516
  * const viewer = createViewer({
493
- * action: (actionType, actionParams) => console.log('Action type: ' + actionType + '; Action parameters: ' + actionParams)
517
+ * action: (actionType, actionParams, actionTarget) => console.log('Action type: ' + actionType + '; Action parameters: ' + actionParams + '; Action target: ' + actionTarget);
494
518
  * });
495
519
  * ```
496
520
  * @example Usage example:
497
521
  * ```javascript
498
522
  * // UMD usage
499
523
  * var viewer = GrapeCity.ActiveReports.JSViewer.create({
500
- * action: (actionType, actionParams) => console.log('Action type: ' + actionType + '; Action parameters: ' + actionParams)
524
+ * action: (actionType, actionParams, actionTarget) => console.log('Action type: ' + actionType + '; Action parameters: ' + actionParams + '; Action target: ' + actionTarget);
501
525
  * });
502
526
  * ```
503
527
  */
504
- action?: (actionType: string, actionParams: any[]) => void;
528
+ action?: (actionType: string, actionParams: any[], actionTarget: string) => void;
529
+ /**
530
+ * The callback that is triggered before the JS Viewer executes an action.
531
+ *
532
+ * @param action - An object containing details about the action being triggered.
533
+ * @returns A promise that resolves to an `ActionResult`, determining how the action should be handled.
534
+ *
535
+ * @example Usage example:
536
+ * ```javascript
537
+ * // ESM usage
538
+ * import { createViewer } from './jsViewer.min.js';
539
+ * const viewer = createViewer({
540
+ * onAction: async (action) => {
541
+ * if (action.type === 'hyperlink') {
542
+ * return { cancel: true }; // Prevent opening the link
543
+ * }
544
+ * return { cancel: false };
545
+ * }
546
+ * });
547
+ * ```
548
+ * @example Usage example:
549
+ * ```javascript
550
+ * // UMD usage
551
+ * var viewer = GrapeCity.ActiveReports.JSViewer.create({
552
+ * onAction: async (action) => {
553
+ * if (action.type === 'hyperlink') {
554
+ * return { cancel: true }; // Prevent opening the link
555
+ * }
556
+ * return { cancel: false };
557
+ * }
558
+ * });
559
+ * ```
560
+ */
561
+ onAction?: (action: ActionInfo) => Promise<ActionResult>;
505
562
  /** The report view animation options.
506
563
  * @example Usage example:
507
564
  * ```javascript
@@ -1063,26 +1120,86 @@ interface InitializationOptions {
1063
1120
  */
1064
1121
  silentPrint?: boolean;
1065
1122
  /**
1066
- * Viewer's UI theme.
1123
+ * Viewer's UI themes settings.
1067
1124
  * @example Pre-defined theme selection USM example:
1068
1125
  * ```javascript
1069
1126
  * // ESM usage
1070
- * import {createViewer, UIThemes} from './jsViewer.min.js';
1127
+ * import {createViewer} from './jsViewer.min.js';
1071
1128
  * const viewer = createViewer({
1072
- * element: '#root',
1073
- * theme: UIThemes.defaultDark
1129
+ * element: '#root',
1130
+ * themes: {
1131
+ * initialTheme: 'defaultDark',
1132
+ * }
1133
+ * },
1074
1134
  * });
1075
1135
  * ```
1076
1136
  *
1077
1137
  * @example Pre-defined theme selection example:
1078
1138
  * ```javascript
1079
1139
  * var viewer = GrapeCity.ActiveReports.JSViewer.create({
1080
- * theme: GrapeCity.ActiveReports.JSViewer.Themes.darkOled
1140
+ * themes: {
1141
+ * initialTheme: 'defaultDark',
1142
+ * }
1081
1143
  * });
1082
1144
  * ```
1083
1145
  */
1084
- theme?: UITheme;
1146
+ themes?: ThemeSettings;
1147
+ /**
1148
+ * Specifies custom css styles that will be applied to the report items.
1149
+ * @example Usage example:
1150
+ * ```javascript
1151
+ * // ESM usage
1152
+ * import { createViewer } from './jsViewer.min.js';
1153
+ * const viewer = createViewer({
1154
+ * reportItemsStyles: {
1155
+ * cssUri: 'custom-styles.css'
1156
+ * }
1157
+ * });
1158
+ * ```
1159
+ * @example Usage example:
1160
+ * ```javascript
1161
+ * // UMD usage
1162
+ * var viewer = GrapeCity.ActiveReports.JSViewer.create({
1163
+ * reportItemsStyles: {
1164
+ * cssUri: 'custom-styles.css'
1165
+ * }
1166
+ * });
1167
+ * ```
1168
+ */
1169
+ reportItemsStyles?: ReportItemsStyles;
1085
1170
  }
1171
+ /** Defines the viewer's themes settings. */
1172
+ type ThemeSettings = {
1173
+ /**
1174
+ * The initial theme to be applied.
1175
+ * * @default "default"
1176
+ */
1177
+ initialTheme: string;
1178
+ themeSelector?: {
1179
+ /**
1180
+ * shows Theme Picker in UI
1181
+ *
1182
+ * @default true
1183
+ */
1184
+ enabled: boolean;
1185
+ /**
1186
+ * An array of available themes that can be picked by the user.
1187
+ * These themes can be either built-in themes or custom ones.
1188
+ *
1189
+ * @default ["default", "defaultDark", "darkOled", "highContrast", "highContrastDark", "activeReports"]
1190
+ */
1191
+ availableThemes: (string | ColorTheme)[];
1192
+ };
1193
+ };
1194
+ /** Defines the report item css styles. */
1195
+ type ReportItemsStyles = {
1196
+ /**
1197
+ * Specifies the URI of a custom css that will be applied to the report items.
1198
+ * @example
1199
+ * cssUri: 'custom-styles.css'
1200
+ */
1201
+ cssUri?: string;
1202
+ };
1086
1203
  /** The following options can be set during initialization or at run time while working with the JS Viewer. */
1087
1204
  interface ExportOptions extends PrintOptions {
1088
1205
  /**
@@ -1207,10 +1324,7 @@ interface PrintOptions {
1207
1324
  reportParameters?: Parameter[];
1208
1325
  /**
1209
1326
  * The callback that is invoked when an error occurs in the process of displaying the report.
1210
- * The default error panel does not appear if the callback returns true.
1211
- * The error parameter is an object that has a message property which allows the users to customize
1212
- * the error message and details property which allows to customize error details.
1213
- * @example To hide the default error panel:
1327
+ * @example To handle an error:
1214
1328
  * ```javascript
1215
1329
  * // ESM usage
1216
1330
  * import { printReport } from './jsViewer.min.js';
@@ -1219,25 +1333,11 @@ interface PrintOptions {
1219
1333
  * if (error.message) {
1220
1334
  * // show error message.
1221
1335
  * alert("Internal error! Please ask administrator.");
1222
- * // do not show default error message.
1223
- * }
1224
- * }
1225
- * }):
1226
- * ```
1227
- * * @example To customize the error message:
1228
- * ```javascript
1229
- * // ESM usage
1230
- * import { printReport } from './jsViewer.min.js';
1231
- * printReport({
1232
- * error: (error) => {
1233
- * if (error.message) {
1234
- * // show error message.
1235
- * return {message = "Custom message", caption = "Custom caption"};
1236
1336
  * }
1237
1337
  * }
1238
1338
  * }):
1239
1339
  * ```
1240
- * @example To hide the default error panel:
1340
+ * @example To handle an error:
1241
1341
  * ```javascript
1242
1342
  * // UMD usage
1243
1343
  * GrapeCity.ActiveReports.JSViewer.print({
@@ -1245,25 +1345,12 @@ interface PrintOptions {
1245
1345
  * if (error.message) {
1246
1346
  * // show error message.
1247
1347
  * alert("Internal error! Please ask administrator.");
1248
- * // do not show default error message.
1249
- * }
1250
- * }
1251
- * }):
1252
- * ```
1253
- * * @example To customize the error message:
1254
- * ```javascript
1255
- * // UMD usage
1256
- * GrapeCity.ActiveReports.JSViewer.print({
1257
- * error: (error) => {
1258
- * if (error.message) {
1259
- * // show error message.
1260
- * return {message = "Custom message", caption = "Custom caption"};
1261
1348
  * }
1262
1349
  * }
1263
1350
  * }):
1264
1351
  * ```
1265
1352
  */
1266
- error: (error: ErrorInfo) => ErrorInfo;
1353
+ error: (error: ErrorInfo) => void;
1267
1354
  /**
1268
1355
  * Set up the settings to connect the Web API.
1269
1356
  * @example Usage example:
@@ -1635,12 +1722,12 @@ interface JSViewer {
1635
1722
  * Gets or sets the viewer UI theme.
1636
1723
  * @example Usage example ESM:
1637
1724
  * ```javascript
1638
- * import {createViewer, UIThemes} from './jsViewer.min.js';
1725
+ * import {createViewer, ColorThemes} from './jsViewer.min.js';
1639
1726
  * const viewer = createViewer({
1640
1727
  * element: '#root',
1641
1728
  * });
1642
1729
  *
1643
- * viewer.theme = UIThemes.defaultDark;
1730
+ * viewer.theme = ColorThemes.defaultDark;
1644
1731
  * ```
1645
1732
  *
1646
1733
  * @example Usage example UMD:
@@ -1648,16 +1735,16 @@ interface JSViewer {
1648
1735
  * var viewer = GrapeCity.ActiveReports.JSViewer.create({
1649
1736
  * element: '#root'
1650
1737
  * });
1651
- * viewer.theme: GrapeCity.ActiveReports.JSViewer.Themes.defaultDark
1738
+ * viewer.theme: ActiveReports.ColorThemes.defaultDark
1652
1739
  * ```
1653
1740
  */
1654
- theme?: UITheme;
1741
+ theme?: string | ColorTheme;
1655
1742
  }
1656
1743
 
1657
1744
  /**
1658
1745
  * Do export of the report without showing a viewer.
1659
1746
  * @param params The export options.
1660
- * @param isCancelRequested The function is periodically called with a check to cancel the export task.
1747
+ * @param isCancelRequested The function is periodically called with a check to cancel the export task.
1661
1748
  * @example Usage example:
1662
1749
  * ```javascript
1663
1750
  * // ESM usage
@@ -1705,4 +1792,4 @@ declare function createViewer(params: InitializationOptions): JSViewer;
1705
1792
  */
1706
1793
  declare function printReport(printOptions: PrintOptions, isCancelRequested?: () => boolean): Promise<void>;
1707
1794
 
1708
- export { type AnimationOptions, Color, type DefaultExportSettings, type ErrorInfo, type ErrorSeverity, type ExportCallback, type ExportOptions, type ExportTypes, type HoverChartAnimationOptions, type HoverTableAnimationOptions, type InitialZoomMode, type InitializationOptions, type JSViewer, type LoadChartAnimationOptions, type PageViewOptions, type PanelsLocation, type Parameter, type ParameterDescriptor, type ParametersPanelSettings, type Percentage, type PrintOptions, type RenderFormat, type RenderMode, type ReportInfo, type ReportServiceSettings, ReportType, type SearchOptions, type Sidebar, type SizeType, type Toolbar, ToolbarButtons, type UITheme, UIThemes, type ViewMode, type ViewerType, createViewer, exportReport, printReport };
1795
+ export { type ActionInfo, type ActionParameter, type ActionResult, type ActionTarget, type ActionType, type AnimationOptions, type ColorTheme, type ColorThemeShades, ColorThemes, type DefaultExportSettings, type ErrorInfo, type ErrorSeverity, type ExportCallback, type ExportOptions, type ExportTypes, type HoverChartAnimationOptions, type HoverTableAnimationOptions, type InitialZoomMode, type InitializationOptions, type JSViewer, type LoadChartAnimationOptions, type PageViewOptions, type PanelsLocation, type Parameter, type ParameterDescriptor, type ParameterValue, type ParametersPanelSettings, type Percentage, type PrintOptions, type RenderFormat, type RenderMode, type ReportInfo, type ReportItemsStyles, type ReportServiceSettings, ReportType, type SearchOptions, type Sidebar, type SizeType, type ThemeSettings, type Toolbar, ToolbarButtons, type ViewMode, type ViewerType, createViewer, exportReport, printReport };