bways-report 0.1.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.
Files changed (185) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +477 -0
  3. package/esm2022/bways-report.mjs +5 -0
  4. package/esm2022/lib/core/errors/index.mjs +2 -0
  5. package/esm2022/lib/core/errors/reporting-errors.mjs +65 -0
  6. package/esm2022/lib/core/index.mjs +8 -0
  7. package/esm2022/lib/core/models/component-event.model.mjs +8 -0
  8. package/esm2022/lib/core/models/index.mjs +5 -0
  9. package/esm2022/lib/core/models/report-component.model.mjs +10 -0
  10. package/esm2022/lib/core/models/report-datasource.model.mjs +9 -0
  11. package/esm2022/lib/core/models/report-definition.model.mjs +13 -0
  12. package/esm2022/lib/core/models/report-grid.model.mjs +10 -0
  13. package/esm2022/lib/core/models/report-layout.model.mjs +9 -0
  14. package/esm2022/lib/core/models/report-parameter.model.mjs +9 -0
  15. package/esm2022/lib/core/models/validation.model.mjs +8 -0
  16. package/esm2022/lib/core/registry/component-category.mjs +8 -0
  17. package/esm2022/lib/core/registry/component-registry.mjs +90 -0
  18. package/esm2022/lib/core/registry/index.mjs +2 -0
  19. package/esm2022/lib/core/registry/property-definition.model.mjs +10 -0
  20. package/esm2022/lib/core/services/dynamic-form-builder.service.mjs +55 -0
  21. package/esm2022/lib/core/services/index.mjs +3 -0
  22. package/esm2022/lib/core/services/report-session-context.service.mjs +314 -0
  23. package/esm2022/lib/core/tokens/index.mjs +3 -0
  24. package/esm2022/lib/core/tokens/reporting-config.token.mjs +26 -0
  25. package/esm2022/lib/core/tokens/session-context.token.mjs +18 -0
  26. package/esm2022/lib/core/utilities/id-generator.mjs +17 -0
  27. package/esm2022/lib/core/utilities/index.mjs +3 -0
  28. package/esm2022/lib/core/utilities/schema-migration.mjs +38 -0
  29. package/esm2022/lib/core/utils/identifier-humanizer.mjs +88 -0
  30. package/esm2022/lib/core/validation/index.mjs +2 -0
  31. package/esm2022/lib/core/validation/validation-factory.mjs +70 -0
  32. package/esm2022/lib/data-access/adapters/http-lookup.adapter.mjs +107 -0
  33. package/esm2022/lib/data-access/adapters/http-schema-discovery.adapter.mjs +119 -0
  34. package/esm2022/lib/data-access/adapters/index.mjs +3 -0
  35. package/esm2022/lib/data-access/contracts/data-source.contract.mjs +28 -0
  36. package/esm2022/lib/data-access/contracts/index.mjs +7 -0
  37. package/esm2022/lib/data-access/contracts/lookup.contract.mjs +6 -0
  38. package/esm2022/lib/data-access/contracts/master-data.provider.mjs +24 -0
  39. package/esm2022/lib/data-access/contracts/report-persistence.contract.mjs +25 -0
  40. package/esm2022/lib/data-access/contracts/schema-discovery.contract.mjs +7 -0
  41. package/esm2022/lib/data-access/contracts/translation.contract.mjs +9 -0
  42. package/esm2022/lib/data-access/index.mjs +3 -0
  43. package/esm2022/lib/features/designer/components/component-palette/component-palette.component.mjs +542 -0
  44. package/esm2022/lib/features/designer/components/design-canvas/design-canvas.component.mjs +843 -0
  45. package/esm2022/lib/features/designer/components/property-editor/parameter-binding-editor.component.mjs +556 -0
  46. package/esm2022/lib/features/designer/components/property-editor/property-editor-datasource.component.mjs +845 -0
  47. package/esm2022/lib/features/designer/components/property-editor/property-editor-general.component.mjs +185 -0
  48. package/esm2022/lib/features/designer/components/property-editor/property-editor-grid.component.mjs +452 -0
  49. package/esm2022/lib/features/designer/components/property-editor/property-editor-layout.component.mjs +350 -0
  50. package/esm2022/lib/features/designer/components/property-editor/property-editor-report.component.mjs +175 -0
  51. package/esm2022/lib/features/designer/components/property-editor/property-editor-validation.component.mjs +137 -0
  52. package/esm2022/lib/features/designer/components/property-editor/property-editor.component.mjs +608 -0
  53. package/esm2022/lib/features/designer/components/toolbar/designer-toolbar.component.mjs +225 -0
  54. package/esm2022/lib/features/designer/designer.component.mjs +285 -0
  55. package/esm2022/lib/features/designer/index.mjs +7 -0
  56. package/esm2022/lib/features/designer/services/designer-state.service.mjs +310 -0
  57. package/esm2022/lib/features/designer/services/index.mjs +2 -0
  58. package/esm2022/lib/features/designer/utilities/canvas-layout.util.mjs +124 -0
  59. package/esm2022/lib/features/export/index.mjs +2 -0
  60. package/esm2022/lib/features/export/models/export.models.mjs +2 -0
  61. package/esm2022/lib/features/export/services/report-export.service.mjs +107 -0
  62. package/esm2022/lib/features/index.mjs +6 -0
  63. package/esm2022/lib/features/persistence/index.mjs +2 -0
  64. package/esm2022/lib/features/persistence/services/index.mjs +4 -0
  65. package/esm2022/lib/features/persistence/services/report-store.service.mjs +183 -0
  66. package/esm2022/lib/features/persistence/services/report-versioning.service.mjs +81 -0
  67. package/esm2022/lib/features/persistence/services/schema-validator.service.mjs +102 -0
  68. package/esm2022/lib/features/routing/components/routed-report-designer.component.mjs +156 -0
  69. package/esm2022/lib/features/routing/components/routed-report-runtime.component.mjs +163 -0
  70. package/esm2022/lib/features/routing/index.mjs +6 -0
  71. package/esm2022/lib/features/routing/models/report-route.models.mjs +2 -0
  72. package/esm2022/lib/features/routing/report-routes.mjs +49 -0
  73. package/esm2022/lib/features/routing/resolvers/report.resolver.mjs +22 -0
  74. package/esm2022/lib/features/routing/services/report-menu.service.mjs +77 -0
  75. package/esm2022/lib/features/runtime/dynamic-renderer.component.mjs +222 -0
  76. package/esm2022/lib/features/runtime/index.mjs +4 -0
  77. package/esm2022/lib/features/runtime/report-grid-bridge.component.mjs +409 -0
  78. package/esm2022/lib/features/runtime/report-runtime.component.mjs +147 -0
  79. package/esm2022/lib/primitives/components/button/rpt-button.component.mjs +88 -0
  80. package/esm2022/lib/primitives/components/chart-bridge/report-chart-bridge.component.mjs +361 -0
  81. package/esm2022/lib/primitives/components/checkbox/rpt-checkbox.component.mjs +86 -0
  82. package/esm2022/lib/primitives/components/date/rpt-date.component.mjs +91 -0
  83. package/esm2022/lib/primitives/components/dropdown/rpt-dropdown.component.mjs +204 -0
  84. package/esm2022/lib/primitives/components/icon/rpt-icon.component.mjs +476 -0
  85. package/esm2022/lib/primitives/components/index.mjs +10 -0
  86. package/esm2022/lib/primitives/components/input/rpt-input.component.mjs +88 -0
  87. package/esm2022/lib/primitives/components/kpi-card/rpt-kpi-card.component.mjs +197 -0
  88. package/esm2022/lib/primitives/components/number/rpt-number.component.mjs +110 -0
  89. package/esm2022/lib/primitives/index.mjs +3 -0
  90. package/esm2022/lib/primitives/register-builtins.mjs +328 -0
  91. package/esm2022/lib/provide-reporting.mjs +92 -0
  92. package/esm2022/public-api.mjs +9 -0
  93. package/fesm2022/bways-report.mjs +10360 -0
  94. package/fesm2022/bways-report.mjs.map +1 -0
  95. package/index.d.ts +5 -0
  96. package/lib/core/errors/index.d.ts +1 -0
  97. package/lib/core/errors/reporting-errors.d.ts +42 -0
  98. package/lib/core/index.d.ts +7 -0
  99. package/lib/core/models/component-event.model.d.ts +37 -0
  100. package/lib/core/models/index.d.ts +11 -0
  101. package/lib/core/models/report-component.model.d.ts +95 -0
  102. package/lib/core/models/report-datasource.model.d.ts +39 -0
  103. package/lib/core/models/report-definition.model.d.ts +100 -0
  104. package/lib/core/models/report-grid.model.d.ts +73 -0
  105. package/lib/core/models/report-layout.model.d.ts +43 -0
  106. package/lib/core/models/report-parameter.model.d.ts +22 -0
  107. package/lib/core/models/validation.model.d.ts +30 -0
  108. package/lib/core/registry/component-category.d.ts +16 -0
  109. package/lib/core/registry/component-registry.d.ts +101 -0
  110. package/lib/core/registry/index.d.ts +4 -0
  111. package/lib/core/registry/property-definition.model.d.ts +38 -0
  112. package/lib/core/services/dynamic-form-builder.service.d.ts +30 -0
  113. package/lib/core/services/index.d.ts +3 -0
  114. package/lib/core/services/report-session-context.service.d.ts +87 -0
  115. package/lib/core/tokens/index.d.ts +4 -0
  116. package/lib/core/tokens/reporting-config.token.d.ts +42 -0
  117. package/lib/core/tokens/session-context.token.d.ts +36 -0
  118. package/lib/core/utilities/id-generator.d.ts +9 -0
  119. package/lib/core/utilities/index.d.ts +3 -0
  120. package/lib/core/utilities/schema-migration.d.ts +10 -0
  121. package/lib/core/utils/identifier-humanizer.d.ts +22 -0
  122. package/lib/core/validation/index.d.ts +1 -0
  123. package/lib/core/validation/validation-factory.d.ts +31 -0
  124. package/lib/data-access/adapters/http-lookup.adapter.d.ts +19 -0
  125. package/lib/data-access/adapters/http-schema-discovery.adapter.d.ts +20 -0
  126. package/lib/data-access/adapters/index.d.ts +2 -0
  127. package/lib/data-access/contracts/data-source.contract.d.ts +37 -0
  128. package/lib/data-access/contracts/index.d.ts +9 -0
  129. package/lib/data-access/contracts/lookup.contract.d.ts +32 -0
  130. package/lib/data-access/contracts/master-data.provider.d.ts +54 -0
  131. package/lib/data-access/contracts/report-persistence.contract.d.ts +36 -0
  132. package/lib/data-access/contracts/schema-discovery.contract.d.ts +52 -0
  133. package/lib/data-access/contracts/translation.contract.d.ts +16 -0
  134. package/lib/data-access/index.d.ts +2 -0
  135. package/lib/features/designer/components/component-palette/component-palette.component.d.ts +39 -0
  136. package/lib/features/designer/components/design-canvas/design-canvas.component.d.ts +42 -0
  137. package/lib/features/designer/components/property-editor/parameter-binding-editor.component.d.ts +36 -0
  138. package/lib/features/designer/components/property-editor/property-editor-datasource.component.d.ts +68 -0
  139. package/lib/features/designer/components/property-editor/property-editor-general.component.d.ts +20 -0
  140. package/lib/features/designer/components/property-editor/property-editor-grid.component.d.ts +20 -0
  141. package/lib/features/designer/components/property-editor/property-editor-layout.component.d.ts +18 -0
  142. package/lib/features/designer/components/property-editor/property-editor-report.component.d.ts +15 -0
  143. package/lib/features/designer/components/property-editor/property-editor-validation.component.d.ts +12 -0
  144. package/lib/features/designer/components/property-editor/property-editor.component.d.ts +44 -0
  145. package/lib/features/designer/components/toolbar/designer-toolbar.component.d.ts +18 -0
  146. package/lib/features/designer/designer.component.d.ts +36 -0
  147. package/lib/features/designer/index.d.ts +7 -0
  148. package/lib/features/designer/services/designer-state.service.d.ts +103 -0
  149. package/lib/features/designer/services/index.d.ts +2 -0
  150. package/lib/features/designer/utilities/canvas-layout.util.d.ts +55 -0
  151. package/lib/features/export/index.d.ts +2 -0
  152. package/lib/features/export/models/export.models.d.ts +16 -0
  153. package/lib/features/export/services/report-export.service.d.ts +27 -0
  154. package/lib/features/index.d.ts +5 -0
  155. package/lib/features/persistence/index.d.ts +1 -0
  156. package/lib/features/persistence/services/index.d.ts +5 -0
  157. package/lib/features/persistence/services/report-store.service.d.ts +53 -0
  158. package/lib/features/persistence/services/report-versioning.service.d.ts +29 -0
  159. package/lib/features/persistence/services/schema-validator.service.d.ts +34 -0
  160. package/lib/features/routing/components/routed-report-designer.component.d.ts +18 -0
  161. package/lib/features/routing/components/routed-report-runtime.component.d.ts +18 -0
  162. package/lib/features/routing/index.d.ts +6 -0
  163. package/lib/features/routing/models/report-route.models.d.ts +41 -0
  164. package/lib/features/routing/report-routes.d.ts +16 -0
  165. package/lib/features/routing/resolvers/report.resolver.d.ts +7 -0
  166. package/lib/features/routing/services/report-menu.service.d.ts +30 -0
  167. package/lib/features/runtime/dynamic-renderer.component.d.ts +30 -0
  168. package/lib/features/runtime/index.d.ts +3 -0
  169. package/lib/features/runtime/report-grid-bridge.component.d.ts +94 -0
  170. package/lib/features/runtime/report-runtime.component.d.ts +26 -0
  171. package/lib/primitives/components/button/rpt-button.component.d.ts +19 -0
  172. package/lib/primitives/components/chart-bridge/report-chart-bridge.component.d.ts +45 -0
  173. package/lib/primitives/components/checkbox/rpt-checkbox.component.d.ts +14 -0
  174. package/lib/primitives/components/date/rpt-date.component.d.ts +17 -0
  175. package/lib/primitives/components/dropdown/rpt-dropdown.component.d.ts +32 -0
  176. package/lib/primitives/components/icon/rpt-icon.component.d.ts +41 -0
  177. package/lib/primitives/components/index.d.ts +12 -0
  178. package/lib/primitives/components/input/rpt-input.component.d.ts +16 -0
  179. package/lib/primitives/components/kpi-card/rpt-kpi-card.component.d.ts +43 -0
  180. package/lib/primitives/components/number/rpt-number.component.d.ts +20 -0
  181. package/lib/primitives/index.d.ts +2 -0
  182. package/lib/primitives/register-builtins.d.ts +11 -0
  183. package/lib/provide-reporting.d.ts +75 -0
  184. package/package.json +55 -0
  185. package/public-api.d.ts +5 -0
package/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="bways-report" />
5
+ export * from './public-api';
@@ -0,0 +1 @@
1
+ export { ReportDefinitionError, ComponentNotRegisteredError, DataSourceError, SchemaVersionError, AdapterNotProvidedError, } from './reporting-errors';
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Reporting library error types.
3
+ *
4
+ * Each error type has a distinct class for targeted catching
5
+ * and clear stack traces.
6
+ */
7
+ /**
8
+ * Thrown when a report definition fails validation.
9
+ */
10
+ export declare class ReportDefinitionError extends Error {
11
+ readonly reportId?: string | undefined;
12
+ constructor(message: string, reportId?: string | undefined);
13
+ }
14
+ /**
15
+ * Thrown when a component type is not found in the registry.
16
+ */
17
+ export declare class ComponentNotRegisteredError extends Error {
18
+ readonly componentType: string;
19
+ constructor(componentType: string);
20
+ }
21
+ /**
22
+ * Thrown when a data source execution fails.
23
+ */
24
+ export declare class DataSourceError extends Error {
25
+ readonly dataSourceId?: string | undefined;
26
+ constructor(message: string, dataSourceId?: string | undefined);
27
+ }
28
+ /**
29
+ * Thrown when a report definition's schema version is not supported.
30
+ */
31
+ export declare class SchemaVersionError extends Error {
32
+ readonly currentVersion: number;
33
+ readonly supportedVersion: number;
34
+ constructor(currentVersion: number, supportedVersion: number, customMessage?: string);
35
+ }
36
+ /**
37
+ * Thrown when a required adapter/provider is not configured.
38
+ */
39
+ export declare class AdapterNotProvidedError extends Error {
40
+ readonly adapterName: string;
41
+ constructor(adapterName: string);
42
+ }
@@ -0,0 +1,7 @@
1
+ export * from './models';
2
+ export * from './registry';
3
+ export * from './tokens';
4
+ export * from './errors';
5
+ export * from './validation';
6
+ export * from './services';
7
+ export * from './utilities';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Event and action definitions for report components.
3
+ *
4
+ * Events describe what happened (user interaction).
5
+ * Actions describe what should happen in response (command pattern).
6
+ */
7
+ /**
8
+ * Binds a component event to an action.
9
+ *
10
+ * Example:
11
+ * ```json
12
+ * {
13
+ * "event": "change",
14
+ * "action": { "type": "reload-data", "target": "cityDropdown" }
15
+ * }
16
+ * ```
17
+ */
18
+ export interface ComponentEventDefinition {
19
+ /** The DOM/component event name (e.g., 'change', 'click', 'blur'). */
20
+ event: string;
21
+ /** The action to execute when the event fires. */
22
+ action: ComponentActionDefinition;
23
+ }
24
+ /**
25
+ * Describes a command to execute in response to a component event.
26
+ *
27
+ * Actions are declarative — the runtime engine interprets them.
28
+ * This avoids arbitrary function references in metadata.
29
+ */
30
+ export interface ComponentActionDefinition {
31
+ /** Action type identifier (e.g., 'reload-data', 'set-value', 'navigate', 'execute-report'). */
32
+ type: string;
33
+ /** Target component ID or key this action affects. */
34
+ target?: string;
35
+ /** Additional action parameters. */
36
+ params?: Record<string, unknown>;
37
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Barrel export for all core domain models.
3
+ */
4
+ export type { ReportDefinition, ReportSummary, ReportPermissionDefinition, } from './report-definition.model';
5
+ export type { ReportComponentDefinition, ComponentBindingDefinition, ComponentDataSourceDefinition, VisibilityDefinition, } from './report-component.model';
6
+ export type { ReportParameterDefinition, } from './report-parameter.model';
7
+ export type { ReportDataSourceDefinition, DataSourceCacheDefinition, } from './report-datasource.model';
8
+ export type { ReportGridDefinition, GridColumnDefinition, GridOptionsDefinition, } from './report-grid.model';
9
+ export type { ReportLayoutDefinition, ComponentLayoutDefinition, } from './report-layout.model';
10
+ export type { ValidationDefinition, } from './validation.model';
11
+ export type { ComponentEventDefinition, ComponentActionDefinition, } from './component-event.model';
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Report component definition — the metadata for a single UI element
3
+ * that appears on a report page.
4
+ *
5
+ * The `type` field is the registry key used to resolve the Angular component
6
+ * at runtime via `ComponentRegistry`. This avoids hard-coding component types
7
+ * in the renderer.
8
+ */
9
+ import { ComponentLayoutDefinition } from './report-layout.model';
10
+ import { ValidationDefinition } from './validation.model';
11
+ import { ComponentEventDefinition } from './component-event.model';
12
+ /**
13
+ * Binding configuration for connecting a component to a data source or parameter.
14
+ */
15
+ export interface ComponentBindingDefinition {
16
+ /** The data source ID this component reads from. */
17
+ dataSourceId?: string;
18
+ /** The field within the data source to bind to (for display components). */
19
+ field?: string;
20
+ /** The parameter key this component writes to (for input components). */
21
+ parameterKey?: string;
22
+ }
23
+ export type DropdownSourceType = 'static' | 'table' | 'procedure' | 'master';
24
+ /**
25
+ * Data source configuration for components that load their own data
26
+ * (e.g., dropdowns loading options from database tables, stored procedures, or master data).
27
+ */
28
+ export interface ComponentDataSourceDefinition {
29
+ /** Source type: 'static' | 'table' | 'procedure' | 'master' */
30
+ sourceType?: DropdownSourceType;
31
+ /** Database schema, e.g. 'dbo' (defaults to 'dbo'). */
32
+ schema?: string;
33
+ /** Database table, view, or stored procedure name (e.g. 'Customers' or 'usp_GetBranches'). */
34
+ entityName?: string;
35
+ /** Master data name for legacy master data provider resolution. */
36
+ masterName?: string;
37
+ /** Display field name in the returned data items (e.g. 'CustomerName'). */
38
+ displayField?: string;
39
+ /** Value field name in the returned data items (e.g. 'CustomerID'). */
40
+ valueField?: string;
41
+ /** Optional static filter parameters (e.g. { isActive: 1 }). */
42
+ filter?: Record<string, unknown>;
43
+ /** Stored procedure parameter mappings (e.g. { '@BranchId': '{{branchSelect}}', '@ActiveOnly': true }). */
44
+ parameterMappings?: Record<string, string | number | boolean>;
45
+ /** Keys of other form components whose values this data source depends on (for Cascading Dropdowns). */
46
+ dependsOn?: string[];
47
+ /** Cache time-to-live in seconds (default 300s). */
48
+ cacheTtl?: number;
49
+ }
50
+ /**
51
+ * Controls when a component is visible based on other component values.
52
+ */
53
+ export interface VisibilityDefinition {
54
+ /** The component key whose value determines visibility. */
55
+ dependsOn: string;
56
+ /** The operator for the condition. */
57
+ operator: 'equals' | 'notEquals' | 'contains' | 'greaterThan' | 'lessThan' | 'isNotEmpty' | 'isEmpty';
58
+ /** The value to compare against. */
59
+ value?: unknown;
60
+ }
61
+ /**
62
+ * Full metadata definition for a single component on a report page.
63
+ *
64
+ * This is the core building block of a `ReportDefinition`.
65
+ */
66
+ export interface ReportComponentDefinition {
67
+ /** Unique identifier for this component instance. */
68
+ id: string;
69
+ /** Registry key — maps to an Angular component via `ComponentRegistry`. */
70
+ type: string;
71
+ /** Form control key / parameter binding name. */
72
+ key?: string;
73
+ /** Display label (or translation key). */
74
+ label?: string;
75
+ /** Render order (lower = first). */
76
+ order?: number;
77
+ /** Position within the report layout grid. */
78
+ layout?: ComponentLayoutDefinition;
79
+ /** Component-specific configuration (e.g., placeholder, format, options). */
80
+ properties?: Record<string, unknown>;
81
+ /** Data binding configuration. */
82
+ binding?: ComponentBindingDefinition;
83
+ /** Validation rules. */
84
+ validation?: ValidationDefinition;
85
+ /** Data source for this component's options/data. */
86
+ dataSource?: ComponentDataSourceDefinition;
87
+ /** Event → action bindings. */
88
+ events?: ComponentEventDefinition[];
89
+ /** Conditional visibility rules. */
90
+ visibility?: VisibilityDefinition;
91
+ /** Whether this component is enabled. Defaults to `true`. */
92
+ enabled?: boolean;
93
+ /** CSS class names to add to the component wrapper. */
94
+ cssClass?: string;
95
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Report data source definitions.
3
+ *
4
+ * A data source describes how to fetch data for the report's result grid.
5
+ * The actual fetching is done by the host application through the
6
+ * `ReportDataSourceAdapter` contract.
7
+ */
8
+ /**
9
+ * Defines a single data source for the report.
10
+ */
11
+ export interface ReportDataSourceDefinition {
12
+ /** Unique identifier for this data source. */
13
+ id: string;
14
+ /** Human-readable name for the data source. */
15
+ name: string;
16
+ /** Endpoint identifier, stored procedure name, or query reference. */
17
+ endpoint: string;
18
+ /** HTTP method or execution method hint. */
19
+ method?: 'GET' | 'POST' | 'STORED_PROCEDURE' | 'CUSTOM';
20
+ /**
21
+ * Parameter keys that this data source requires.
22
+ * These are resolved from the report's current parameter values
23
+ * before calling the `ReportDataSourceAdapter`.
24
+ */
25
+ parameterKeys?: string[];
26
+ /** Whether to automatically execute this data source on report load. */
27
+ autoExecute?: boolean;
28
+ /** Caching strategy. */
29
+ cache?: DataSourceCacheDefinition;
30
+ }
31
+ /**
32
+ * Caching configuration for a data source.
33
+ */
34
+ export interface DataSourceCacheDefinition {
35
+ /** Whether caching is enabled for this data source. */
36
+ enabled: boolean;
37
+ /** Cache duration in seconds. */
38
+ ttlSeconds?: number;
39
+ }
@@ -0,0 +1,100 @@
1
+ /**
2
+ * ReportDefinition — the central domain object.
3
+ *
4
+ * A `ReportDefinition` is a complete, versioned, serializable description
5
+ * of a report page. It is the single source of truth for both the
6
+ * Designer and the Runtime.
7
+ *
8
+ * Key principle: **A report is data, not Angular source code.**
9
+ * The metadata is saved/loaded as JSON. Angular dynamically constructs
10
+ * the required controls, layout, and bindings at runtime.
11
+ */
12
+ import { ReportComponentDefinition } from './report-component.model';
13
+ import { ReportParameterDefinition } from './report-parameter.model';
14
+ import { ReportDataSourceDefinition } from './report-datasource.model';
15
+ import { ReportGridDefinition } from './report-grid.model';
16
+ import { ReportLayoutDefinition } from './report-layout.model';
17
+ /**
18
+ * Permission settings for a report.
19
+ */
20
+ export interface ReportPermissionDefinition {
21
+ /** Roles that can view/execute this report. */
22
+ viewRoles?: string[];
23
+ /** Roles that can edit this report in the designer. */
24
+ editRoles?: string[];
25
+ /** Whether this report is publicly accessible. */
26
+ isPublic?: boolean;
27
+ }
28
+ /**
29
+ * Summary information for listing reports (without full definition).
30
+ */
31
+ export interface ReportSummary {
32
+ /** Unique report identifier. */
33
+ id: string;
34
+ /** Report display name. */
35
+ name: string;
36
+ /** Brief description. */
37
+ description?: string;
38
+ /** Category or group for organizing reports. */
39
+ category?: string;
40
+ /** Current version number. */
41
+ version: number;
42
+ /** Whether the report is published (vs. draft). */
43
+ isPublished: boolean;
44
+ /** ISO date of last modification. */
45
+ lastModified?: string;
46
+ /** User who last modified. */
47
+ lastModifiedBy?: string;
48
+ }
49
+ /**
50
+ * Complete report definition — the source of truth.
51
+ *
52
+ * @example
53
+ * ```json
54
+ * {
55
+ * "id": "sales-register",
56
+ * "name": "Sales Register",
57
+ * "schemaVersion": 1,
58
+ * "version": 1,
59
+ * "layout": { "columns": 4, "gap": 16 },
60
+ * "components": [...],
61
+ * "parameters": [...],
62
+ * "dataSources": [...],
63
+ * "grid": { ... }
64
+ * }
65
+ * ```
66
+ */
67
+ export interface ReportDefinition {
68
+ /** Unique report identifier. */
69
+ id: string;
70
+ /** Display name. */
71
+ name: string;
72
+ /** Brief description. */
73
+ description?: string;
74
+ /** Metadata schema version — used for migration. */
75
+ schemaVersion: number;
76
+ /** Report content version — incremented on each save. */
77
+ version: number;
78
+ /** Category or group for organizing reports. */
79
+ category?: string;
80
+ /** Page layout configuration. */
81
+ layout: ReportLayoutDefinition;
82
+ /** Components (controls, buttons, display elements) on this report page. */
83
+ components: ReportComponentDefinition[];
84
+ /** Parameters that bridge inputs to data sources. */
85
+ parameters: ReportParameterDefinition[];
86
+ /** Data sources for executing queries. */
87
+ dataSources: ReportDataSourceDefinition[];
88
+ /** Result grid definition. */
89
+ grid?: ReportGridDefinition;
90
+ /** Access control settings. */
91
+ permissions?: ReportPermissionDefinition;
92
+ /** Custom metadata for host-specific extensions. */
93
+ metadata?: Record<string, unknown>;
94
+ /** ISO date of creation. */
95
+ createdAt?: string;
96
+ /** ISO date of last modification. */
97
+ updatedAt?: string;
98
+ /** User who last modified. */
99
+ updatedBy?: string;
100
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Report grid definitions.
3
+ *
4
+ * Describes the logical structure of the result grid — columns, fields,
5
+ * formatting, sorting, and filtering. This is **not** a specific grid
6
+ * library's API. The `ReportGridBridgeComponent` translates this into
7
+ * whatever the host's grid component (BWays-grid, AG Grid, etc.) expects.
8
+ */
9
+ /**
10
+ * Defines the result grid for a report.
11
+ */
12
+ export interface ReportGridDefinition {
13
+ /** The data source ID that provides data for this grid. */
14
+ dataSourceId: string;
15
+ /** Column definitions. */
16
+ columns: GridColumnDefinition[];
17
+ /** Grid-level options. */
18
+ options?: GridOptionsDefinition;
19
+ }
20
+ /**
21
+ * Defines a single column in the result grid.
22
+ */
23
+ export interface GridColumnDefinition {
24
+ /** The field name in the data row object. */
25
+ field: string;
26
+ /** Display label for the column header. */
27
+ label: string;
28
+ /** Column data type — used for formatting and sorting. */
29
+ dataType?: 'string' | 'number' | 'date' | 'boolean' | 'currency';
30
+ /** Display format (e.g., 'dd/MM/yyyy' for dates, '1.2-2' for numbers). */
31
+ format?: string;
32
+ /** Column width (CSS value, e.g., '150px', '20%'). */
33
+ width?: string;
34
+ /** Whether this column is sortable. Defaults to `true`. */
35
+ sortable?: boolean;
36
+ /** Whether this column is filterable. Defaults to `false`. */
37
+ filterable?: boolean;
38
+ /** Text alignment. */
39
+ align?: 'left' | 'center' | 'right';
40
+ /** Whether this column is visible. Defaults to `true`. */
41
+ visible?: boolean;
42
+ /** Whether this column is pinned/frozen. */
43
+ pinned?: 'left' | 'right' | false;
44
+ /** Column display order (lower = first). */
45
+ order?: number;
46
+ /** Aggregate function to display in a footer row. */
47
+ aggregate?: 'sum' | 'avg' | 'count' | 'min' | 'max' | 'none';
48
+ }
49
+ /**
50
+ * Grid-level options.
51
+ */
52
+ export interface GridOptionsDefinition {
53
+ /** Number of rows per page. */
54
+ pageSize?: number;
55
+ /** Whether pagination is enabled. */
56
+ pagination?: boolean;
57
+ /** Whether row selection is enabled. */
58
+ selectable?: boolean;
59
+ /** Selection mode when selectable is true. */
60
+ selectionMode?: 'single' | 'multiple';
61
+ /** Whether to show row numbers. */
62
+ showRowNumbers?: boolean;
63
+ /** Whether to allow column reordering. */
64
+ allowColumnReorder?: boolean;
65
+ /** Whether to allow exporting. */
66
+ allowExport?: boolean;
67
+ /** Export formats to offer. */
68
+ exportFormats?: ('csv' | 'excel' | 'pdf')[];
69
+ /** Whether to show a footer row with aggregates. */
70
+ showFooter?: boolean;
71
+ /** Height of the grid (CSS value). */
72
+ height?: string;
73
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Layout definitions for report pages and individual components.
3
+ *
4
+ * Layout metadata uses **logical** values (rows, columns, spans) —
5
+ * not CSS class strings like `col-md-3`. The renderer translates
6
+ * logical layout to CSS Grid at runtime.
7
+ */
8
+ /**
9
+ * Describes the overall page layout for a report.
10
+ */
11
+ export interface ReportLayoutDefinition {
12
+ /** Number of grid columns the report page uses. */
13
+ columns: number;
14
+ /** Gap between grid cells in pixels. */
15
+ gap?: number;
16
+ /** Optional padding around the report container in pixels. */
17
+ padding?: number;
18
+ /** Layout direction. Defaults to 'ltr'. */
19
+ direction?: 'ltr' | 'rtl';
20
+ }
21
+ /**
22
+ * Describes how a single component is positioned within the report layout grid.
23
+ */
24
+ export interface ComponentLayoutDefinition {
25
+ /** Grid row placement (1-based). */
26
+ row?: number;
27
+ /** Grid column placement (1-based). */
28
+ column?: number;
29
+ /** Number of columns this component spans. */
30
+ columnSpan?: number;
31
+ /** Number of rows this component spans. */
32
+ rowSpan?: number;
33
+ /** Explicit width override (CSS value, e.g., '200px', '50%'). */
34
+ width?: string;
35
+ /** Explicit height override (CSS value). */
36
+ height?: string;
37
+ /** Minimum height override (CSS value, e.g., '60px'). */
38
+ minHeight?: string;
39
+ /** Maximum height override (CSS value, e.g., '300px'). */
40
+ maxHeight?: string;
41
+ /** Forces this component to start on a new separate row in the grid. Defaults to false. */
42
+ newRow?: boolean;
43
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Report parameter definitions.
3
+ *
4
+ * Parameters are the values that report input controls write to
5
+ * and that data source queries read from. They serve as the bridge
6
+ * between the user's form inputs and the backend query.
7
+ */
8
+ /**
9
+ * Defines a single report parameter.
10
+ */
11
+ export interface ReportParameterDefinition {
12
+ /** Unique key identifying this parameter. */
13
+ key: string;
14
+ /** Display name for the parameter. */
15
+ label: string;
16
+ /** Data type of the parameter value. */
17
+ dataType: 'string' | 'number' | 'date' | 'boolean' | 'array';
18
+ /** Default value if the user doesn't provide one. */
19
+ defaultValue?: unknown;
20
+ /** Whether this parameter must have a value before executing the report. */
21
+ required?: boolean;
22
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Validation rule definitions for report component controls.
3
+ *
4
+ * Pure data — no Angular dependencies. The `createValidators()` function
5
+ * in the validation module converts these into Angular `ValidatorFn[]`.
6
+ */
7
+ /**
8
+ * Describes validation constraints for a single report component.
9
+ *
10
+ * Each property maps to a standard Angular validator.
11
+ * Custom validators can be referenced by name via `custom`.
12
+ */
13
+ export interface ValidationDefinition {
14
+ /** Whether the field is required. */
15
+ required?: boolean;
16
+ /** Minimum numeric value (for number inputs). */
17
+ min?: number;
18
+ /** Maximum numeric value (for number inputs). */
19
+ max?: number;
20
+ /** Minimum string length. */
21
+ minLength?: number;
22
+ /** Maximum string length. */
23
+ maxLength?: number;
24
+ /** Regex pattern the value must match. */
25
+ pattern?: string;
26
+ /** Name of a custom validator registered by the host application. */
27
+ custom?: string;
28
+ /** User-facing message overrides, keyed by validator name. */
29
+ messages?: Record<string, string>;
30
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Component category types.
3
+ *
4
+ * Categories organize components in the Designer's palette
5
+ * and help the runtime understand a component's role.
6
+ */
7
+ /**
8
+ * Predefined component categories.
9
+ *
10
+ * - `input` — Form controls that accept user input (text, dropdown, date, etc.)
11
+ * - `action` — Buttons and triggers (search, reset, export)
12
+ * - `display` — Read-only display elements (labels, KPIs, summaries)
13
+ * - `data` — Data-bound components (grids, charts)
14
+ * - `layout` — Structural components (sections, tabs, dividers)
15
+ */
16
+ export type ComponentCategory = 'input' | 'action' | 'display' | 'data' | 'layout';
@@ -0,0 +1,101 @@
1
+ /**
2
+ * ComponentRegistry — the scalable alternative to a giant `@switch` block.
3
+ *
4
+ * Instead of hard-coding component types in the renderer template:
5
+ * ```html
6
+ * @switch (comp.type) {
7
+ * @case ('input') { ... }
8
+ * @case ('dropdown') { ... }
9
+ * ...100 more cases...
10
+ * }
11
+ * ```
12
+ *
13
+ * The registry maps type strings to Angular component classes:
14
+ * ```typescript
15
+ * registry.register({ type: 'input', component: RptInputComponent, ... });
16
+ * const meta = registry.resolve('input');
17
+ * // Use meta.component with ngComponentOutlet
18
+ * ```
19
+ *
20
+ * **Host override**: The host ERP can register its own component for any type.
21
+ * If the host registers `type: 'dropdown'` with its PrimeNG-based dropdown,
22
+ * that component wins over the library's built-in dropdown.
23
+ */
24
+ import { Type } from '@angular/core';
25
+ import { ComponentCategory } from './component-category';
26
+ import { PropertyDefinition } from './property-definition.model';
27
+ import { ReportComponentDefinition } from '../models/report-component.model';
28
+ import * as i0 from "@angular/core";
29
+ /**
30
+ * Metadata describing a registered component type.
31
+ */
32
+ export interface ReportingComponentMeta {
33
+ /** Unique type key (e.g., 'input', 'dropdown', 'date', 'customer-selector'). */
34
+ type: string;
35
+ /** Human-readable name for the Designer palette. */
36
+ displayName: string;
37
+ /** Category for grouping in the Designer palette. */
38
+ category: ComponentCategory;
39
+ /** Optional icon identifier for the Designer palette. */
40
+ icon?: string;
41
+ /**
42
+ * Factory function that creates a default `ReportComponentDefinition`
43
+ * for this type. Used when dragging a new component onto the canvas.
44
+ */
45
+ createDefaultConfig(): Partial<ReportComponentDefinition>;
46
+ /** The Angular component class to render at runtime. */
47
+ component: Type<unknown>;
48
+ /**
49
+ * Property schema — describes configurable properties for the
50
+ * Designer's property editor.
51
+ */
52
+ propertySchema: PropertyDefinition[];
53
+ }
54
+ /**
55
+ * Central registry for all report component types.
56
+ *
57
+ * The registry is a simple `Map<string, ReportingComponentMeta>`.
58
+ * It does not use DI for individual components — DI is used to
59
+ * provide the registry itself.
60
+ *
61
+ * **Registration order**: Last registration wins. This allows the host
62
+ * application to override built-in components by registering after
63
+ * the library's built-in registration.
64
+ */
65
+ export declare class ComponentRegistry {
66
+ private readonly registry;
67
+ /**
68
+ * Register a component type.
69
+ *
70
+ * If a component with the same `type` is already registered,
71
+ * it is replaced. This enables host overrides.
72
+ *
73
+ * @param meta - Component metadata including the Angular component class.
74
+ */
75
+ register(meta: ReportingComponentMeta): void;
76
+ /**
77
+ * Resolve a component type to its metadata.
78
+ *
79
+ * @param type - The component type key.
80
+ * @returns The metadata, or `undefined` if not registered.
81
+ */
82
+ resolve(type: string): ReportingComponentMeta | undefined;
83
+ /**
84
+ * Check whether a component type is registered.
85
+ */
86
+ has(type: string): boolean;
87
+ /**
88
+ * Get all registered component metadata entries.
89
+ */
90
+ getAll(): ReportingComponentMeta[];
91
+ /**
92
+ * Get registered components filtered by category.
93
+ */
94
+ getByCategory(category: ComponentCategory): ReportingComponentMeta[];
95
+ /**
96
+ * Get all registered type keys.
97
+ */
98
+ getRegisteredTypes(): string[];
99
+ static ɵfac: i0.ɵɵFactoryDeclaration<ComponentRegistry, never>;
100
+ static ɵprov: i0.ɵɵInjectableDeclaration<ComponentRegistry>;
101
+ }
@@ -0,0 +1,4 @@
1
+ export { ComponentRegistry } from './component-registry';
2
+ export type { ReportingComponentMeta } from './component-registry';
3
+ export type { ComponentCategory } from './component-category';
4
+ export type { PropertyDefinition, PropertyOption } from './property-definition.model';