bways-report 0.1.1 → 0.1.3
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/README.md +153 -51
- package/esm2022/lib/core/errors/reporting-errors.mjs +2 -2
- package/esm2022/lib/core/index.mjs +3 -1
- package/esm2022/lib/core/models/report-datasource.model.mjs +1 -1
- package/esm2022/lib/core/models/report-definition.model.mjs +1 -1
- package/esm2022/lib/core/models/report-grid.model.mjs +1 -1
- package/esm2022/lib/core/services/report-session-context.service.mjs +50 -5
- package/esm2022/lib/core/utils/data-normalization.util.mjs +56 -0
- package/esm2022/lib/core/utils/report-parameter.util.mjs +180 -0
- package/esm2022/lib/data-access/adapters/http-datasource.adapter.mjs +82 -0
- package/esm2022/lib/data-access/adapters/http-lookup.adapter.mjs +34 -9
- package/esm2022/lib/data-access/adapters/http-masterdata.adapter.mjs +38 -0
- package/esm2022/lib/data-access/adapters/http-persistence.adapter.mjs +217 -0
- package/esm2022/lib/data-access/adapters/http-schema-discovery.adapter.mjs +3 -1
- package/esm2022/lib/data-access/adapters/index.mjs +8 -3
- package/esm2022/lib/data-access/adapters/local-storage-persistence.adapter.mjs +167 -0
- package/esm2022/lib/data-access/adapters/mock-datasource.adapter.mjs +60 -0
- package/esm2022/lib/data-access/contracts/api-dtos.mjs +6 -0
- package/esm2022/lib/data-access/contracts/index.mjs +2 -1
- package/esm2022/lib/features/designer/components/design-canvas/design-canvas.component.mjs +665 -90
- package/esm2022/lib/features/designer/components/property-editor/property-editor-action.component.mjs +593 -0
- package/esm2022/lib/features/designer/components/property-editor/property-editor-datasource.component.mjs +164 -23
- package/esm2022/lib/features/designer/components/property-editor/property-editor-grid.component.mjs +458 -14
- package/esm2022/lib/features/designer/components/property-editor/property-editor.component.mjs +173 -2
- package/esm2022/lib/features/designer/components/toolbar/designer-toolbar.component.mjs +182 -6
- package/esm2022/lib/features/designer/designer.component.mjs +101 -12
- package/esm2022/lib/features/designer/index.mjs +4 -1
- package/esm2022/lib/features/designer/rpt-report-designer.component.mjs +102 -0
- package/esm2022/lib/features/designer/services/designer-state.service.mjs +10 -9
- package/esm2022/lib/features/designer/services/report-template.service.mjs +318 -0
- package/esm2022/lib/features/designer/utilities/canvas-layout.util.mjs +41 -9
- package/esm2022/lib/features/export/index.mjs +2 -2
- package/esm2022/lib/features/export/models/export.models.mjs +1 -1
- package/esm2022/lib/features/export/services/report-export.service.mjs +420 -5
- package/esm2022/lib/features/routing/components/routed-report-runtime.component.mjs +2 -2
- package/esm2022/lib/features/runtime/dynamic-renderer.component.mjs +231 -33
- package/esm2022/lib/features/runtime/index.mjs +2 -1
- package/esm2022/lib/features/runtime/report-execution.service.mjs +64 -0
- package/esm2022/lib/features/runtime/report-grid-bridge.component.mjs +224 -26
- package/esm2022/lib/features/runtime/report-runtime.component.mjs +341 -7
- package/esm2022/lib/features/runtime/rpt-report.component.mjs +537 -0
- package/esm2022/lib/primitives/components/button/rpt-button.component.mjs +26 -9
- package/esm2022/lib/primitives/components/chart-bridge/report-chart-bridge.component.mjs +18 -7
- package/esm2022/lib/primitives/components/date-range/rpt-date-range.component.mjs +346 -0
- package/esm2022/lib/primitives/components/dropdown/rpt-dropdown.component.mjs +727 -73
- package/esm2022/lib/primitives/components/icon/rpt-icon.component.mjs +8 -1
- package/esm2022/lib/primitives/components/index.mjs +2 -1
- package/esm2022/lib/primitives/register-builtins.mjs +51 -2
- package/esm2022/lib/provide-reporting.mjs +145 -24
- package/fesm2022/bways-report.mjs +8051 -1672
- package/fesm2022/bways-report.mjs.map +1 -1
- package/lib/core/index.d.ts +2 -0
- package/lib/core/models/report-datasource.model.d.ts +9 -0
- package/lib/core/models/report-definition.model.d.ts +2 -0
- package/lib/core/models/report-grid.model.d.ts +44 -0
- package/lib/core/services/report-session-context.service.d.ts +6 -1
- package/lib/core/utils/data-normalization.util.d.ts +15 -0
- package/lib/core/utils/report-parameter.util.d.ts +35 -0
- package/lib/data-access/adapters/http-datasource.adapter.d.ts +20 -0
- package/lib/data-access/adapters/http-lookup.adapter.d.ts +3 -0
- package/lib/data-access/adapters/http-masterdata.adapter.d.ts +13 -0
- package/lib/data-access/adapters/http-persistence.adapter.d.ts +27 -0
- package/lib/data-access/adapters/http-schema-discovery.adapter.d.ts +2 -0
- package/lib/data-access/adapters/index.d.ts +7 -2
- package/lib/data-access/adapters/local-storage-persistence.adapter.d.ts +19 -0
- package/lib/data-access/adapters/mock-datasource.adapter.d.ts +9 -0
- package/lib/data-access/contracts/api-dtos.d.ts +67 -0
- package/lib/data-access/contracts/index.d.ts +1 -0
- package/lib/features/designer/components/design-canvas/design-canvas.component.d.ts +24 -0
- package/lib/features/designer/components/property-editor/parameter-binding-editor.component.d.ts +1 -1
- package/lib/features/designer/components/property-editor/property-editor-action.component.d.ts +33 -0
- package/lib/features/designer/components/property-editor/property-editor-datasource.component.d.ts +4 -0
- package/lib/features/designer/components/property-editor/property-editor-grid.component.d.ts +18 -2
- package/lib/features/designer/components/property-editor/property-editor.component.d.ts +7 -0
- package/lib/features/designer/components/toolbar/designer-toolbar.component.d.ts +9 -0
- package/lib/features/designer/designer.component.d.ts +5 -0
- package/lib/features/designer/index.d.ts +4 -0
- package/lib/features/designer/rpt-report-designer.component.d.ts +38 -0
- package/lib/features/designer/services/designer-state.service.d.ts +1 -1
- package/lib/features/designer/services/report-template.service.d.ts +32 -0
- package/lib/features/designer/utilities/canvas-layout.util.d.ts +4 -0
- package/lib/features/export/index.d.ts +2 -2
- package/lib/features/export/models/export.models.d.ts +23 -0
- package/lib/features/export/services/report-export.service.d.ts +31 -2
- package/lib/features/runtime/dynamic-renderer.component.d.ts +39 -2
- package/lib/features/runtime/index.d.ts +2 -0
- package/lib/features/runtime/report-execution.service.d.ts +16 -0
- package/lib/features/runtime/report-grid-bridge.component.d.ts +129 -6
- package/lib/features/runtime/report-runtime.component.d.ts +83 -1
- package/lib/features/runtime/rpt-report.component.d.ts +66 -0
- package/lib/primitives/components/button/rpt-button.component.d.ts +5 -2
- package/lib/primitives/components/chart-bridge/report-chart-bridge.component.d.ts +1 -0
- package/lib/primitives/components/date-range/rpt-date-range.component.d.ts +43 -0
- package/lib/primitives/components/dropdown/rpt-dropdown.component.d.ts +55 -7
- package/lib/primitives/components/index.d.ts +2 -0
- package/lib/provide-reporting.d.ts +79 -26
- package/package.json +2 -1
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.js +45 -0
- package/schematics/ng-add/schema.json +17 -0
|
@@ -3,10 +3,12 @@ import { ComponentActionDefinition } from '../../../core/models/component-event.
|
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class RptButtonComponent {
|
|
5
5
|
readonly config: import("@angular/core").InputSignal<ReportComponentDefinition>;
|
|
6
|
+
readonly control: import("@angular/core").InputSignal<unknown>;
|
|
7
|
+
readonly onAction: import("@angular/core").InputSignal<((action: ComponentActionDefinition) => void) | undefined>;
|
|
6
8
|
readonly actionTriggered: import("@angular/core").OutputEmitterRef<ComponentActionDefinition>;
|
|
7
9
|
readonly elementId: import("@angular/core").Signal<string>;
|
|
8
10
|
readonly buttonLabel: import("@angular/core").Signal<string>;
|
|
9
|
-
readonly buttonHtmlType: import("@angular/core").Signal<"submit" | "button">;
|
|
11
|
+
readonly buttonHtmlType: import("@angular/core").Signal<"submit" | "button" | "reset">;
|
|
10
12
|
readonly isDisabled: import("@angular/core").Signal<boolean>;
|
|
11
13
|
readonly icon: import("@angular/core").Signal<string>;
|
|
12
14
|
readonly buttonClasses: import("@angular/core").Signal<string>;
|
|
@@ -14,6 +16,7 @@ export declare class RptButtonComponent {
|
|
|
14
16
|
readonly customHeight: import("@angular/core").Signal<string | null>;
|
|
15
17
|
readonly customWidth: import("@angular/core").Signal<string | null>;
|
|
16
18
|
onClick(event: MouseEvent): void;
|
|
19
|
+
private resolveAction;
|
|
17
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<RptButtonComponent, never>;
|
|
18
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<RptButtonComponent, "rpt-button", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; }, { "actionTriggered": "actionTriggered"; }, never, never, true, never>;
|
|
21
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RptButtonComponent, "rpt-button", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "control": { "alias": "control"; "required": false; "isSignal": true; }; "onAction": { "alias": "onAction"; "required": false; "isSignal": true; }; }, { "actionTriggered": "actionTriggered"; }, never, never, true, never>;
|
|
19
22
|
}
|
|
@@ -24,6 +24,7 @@ export declare class ReportChartBridgeComponent {
|
|
|
24
24
|
readonly maxValue: import("@angular/core").Signal<number>;
|
|
25
25
|
readonly totalValue: import("@angular/core").Signal<number>;
|
|
26
26
|
getBarPercentage(value: number): number;
|
|
27
|
+
formatValue(val: number): string;
|
|
27
28
|
readonly donutSegments: import("@angular/core").Signal<{
|
|
28
29
|
label: string;
|
|
29
30
|
color: string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { FormControl } from '@angular/forms';
|
|
3
|
+
import { ReportComponentDefinition } from '../../../core/models/report-component.model';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export interface DateRangeValue {
|
|
6
|
+
from: string;
|
|
7
|
+
to: string;
|
|
8
|
+
preset?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DateRangePreset {
|
|
11
|
+
id: string;
|
|
12
|
+
label: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class RptDateRangeComponent implements OnInit, OnDestroy {
|
|
15
|
+
readonly config: import("@angular/core").InputSignal<ReportComponentDefinition>;
|
|
16
|
+
readonly control: import("@angular/core").InputSignal<FormControl<any> | null | undefined>;
|
|
17
|
+
private readonly fallbackControl;
|
|
18
|
+
readonly formControl: import("@angular/core").Signal<FormControl<any>>;
|
|
19
|
+
readonly elementId: import("@angular/core").Signal<string>;
|
|
20
|
+
readonly minDate: import("@angular/core").Signal<string | null>;
|
|
21
|
+
readonly maxDate: import("@angular/core").Signal<string | null>;
|
|
22
|
+
readonly showPresets: import("@angular/core").Signal<boolean>;
|
|
23
|
+
readonly presets: DateRangePreset[];
|
|
24
|
+
readonly fromDate: import("@angular/core").WritableSignal<string>;
|
|
25
|
+
readonly toDate: import("@angular/core").WritableSignal<string>;
|
|
26
|
+
readonly activePreset: import("@angular/core").WritableSignal<string>;
|
|
27
|
+
readonly hasValue: import("@angular/core").Signal<boolean>;
|
|
28
|
+
readonly rangeError: import("@angular/core").Signal<"" | "'From' date cannot be after 'To' date">;
|
|
29
|
+
readonly isInvalid: import("@angular/core").Signal<boolean>;
|
|
30
|
+
readonly errorMessage: import("@angular/core").Signal<string>;
|
|
31
|
+
private controlSub?;
|
|
32
|
+
constructor();
|
|
33
|
+
ngOnInit(): void;
|
|
34
|
+
ngOnDestroy(): void;
|
|
35
|
+
private syncControlValue;
|
|
36
|
+
applyPreset(presetId: string): void;
|
|
37
|
+
onFromChange(event: Event): void;
|
|
38
|
+
onToChange(event: Event): void;
|
|
39
|
+
clearRange(event: Event): void;
|
|
40
|
+
private emitRangeChange;
|
|
41
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<RptDateRangeComponent, never>;
|
|
42
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RptDateRangeComponent, "rpt-date-range", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "control": { "alias": "control"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
43
|
+
}
|
|
@@ -1,32 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { FormControl } from '@angular/forms';
|
|
1
|
+
import { ElementRef, OnDestroy } from '@angular/core';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
3
|
import { ReportComponentDefinition } from '../../../core/models/report-component.model';
|
|
4
4
|
import * as i0 from "@angular/core";
|
|
5
5
|
export interface DropdownOption {
|
|
6
6
|
key: string | number;
|
|
7
7
|
label: string;
|
|
8
8
|
}
|
|
9
|
-
export declare class RptDropdownComponent implements
|
|
9
|
+
export declare class RptDropdownComponent implements OnDestroy {
|
|
10
10
|
private readonly masterDataProvider;
|
|
11
11
|
private readonly lookupAdapter;
|
|
12
12
|
private readonly sessionService;
|
|
13
|
+
private readonly elementRef;
|
|
13
14
|
readonly config: import("@angular/core").InputSignal<ReportComponentDefinition>;
|
|
14
|
-
readonly control: import("@angular/core").InputSignal<FormControl<any> | undefined>;
|
|
15
|
+
readonly control: import("@angular/core").InputSignal<FormControl<any> | null | undefined>;
|
|
16
|
+
readonly parentForm: import("@angular/core").InputSignal<FormGroup<any> | null>;
|
|
17
|
+
/** Designer mode: shows a small status line (Loading / N records / Waiting for…). */
|
|
18
|
+
readonly showStatus: import("@angular/core").InputSignal<boolean>;
|
|
15
19
|
private readonly fallbackControl;
|
|
16
|
-
|
|
20
|
+
readonly dynamicOptions: import("@angular/core").WritableSignal<DropdownOption[]>;
|
|
17
21
|
private lookupSub?;
|
|
18
22
|
private masterDataSub?;
|
|
23
|
+
private formChangesSub?;
|
|
24
|
+
private reloadTimer?;
|
|
25
|
+
private lastRequestKey;
|
|
26
|
+
readonly isOpen: import("@angular/core").WritableSignal<boolean>;
|
|
27
|
+
readonly opensAbove: import("@angular/core").WritableSignal<boolean>;
|
|
28
|
+
readonly searchTerm: import("@angular/core").WritableSignal<string>;
|
|
29
|
+
readonly focusedIndex: import("@angular/core").WritableSignal<number>;
|
|
30
|
+
readonly currentValue: import("@angular/core").WritableSignal<unknown>;
|
|
31
|
+
readonly comboboxWrapperEl: import("@angular/core").Signal<ElementRef<HTMLElement> | undefined>;
|
|
32
|
+
readonly searchInputEl: import("@angular/core").Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
33
|
+
readonly optionsListEl: import("@angular/core").Signal<ElementRef<HTMLElement> | undefined>;
|
|
34
|
+
private controlSub?;
|
|
19
35
|
readonly formControl: import("@angular/core").Signal<FormControl<any>>;
|
|
20
36
|
readonly elementId: import("@angular/core").Signal<string>;
|
|
21
37
|
readonly placeholder: import("@angular/core").Signal<string>;
|
|
38
|
+
readonly isSearchable: import("@angular/core").Signal<boolean>;
|
|
39
|
+
readonly isLoading: import("@angular/core").WritableSignal<boolean>;
|
|
40
|
+
readonly hasLoaded: import("@angular/core").WritableSignal<boolean>;
|
|
41
|
+
readonly loadError: import("@angular/core").WritableSignal<string | null>;
|
|
42
|
+
/** Canvas field keys that must be filled before the lookup can run. */
|
|
43
|
+
readonly waitingFor: import("@angular/core").WritableSignal<string[]>;
|
|
44
|
+
readonly isDynamicSource: import("@angular/core").Signal<boolean>;
|
|
22
45
|
readonly staticOptions: import("@angular/core").Signal<DropdownOption[]>;
|
|
23
46
|
readonly allOptions: import("@angular/core").Signal<DropdownOption[]>;
|
|
47
|
+
readonly selectedOption: import("@angular/core").Signal<DropdownOption | null>;
|
|
48
|
+
readonly filteredOptions: import("@angular/core").Signal<DropdownOption[]>;
|
|
49
|
+
readonly MAX_FILTER_RENDER = 200;
|
|
50
|
+
readonly visibleFilteredOptions: import("@angular/core").Signal<DropdownOption[]>;
|
|
51
|
+
readonly excessFilteredCount: import("@angular/core").Signal<number>;
|
|
52
|
+
readonly MAX_RENDERED_OPTIONS = 500;
|
|
53
|
+
readonly renderedOptions: import("@angular/core").Signal<DropdownOption[]>;
|
|
54
|
+
readonly hasExcessOptions: import("@angular/core").Signal<boolean>;
|
|
55
|
+
readonly excessOptionsCount: import("@angular/core").Signal<number>;
|
|
56
|
+
readonly waitingLabel: import("@angular/core").Signal<string>;
|
|
57
|
+
readonly statusKind: import("@angular/core").Signal<"error" | "idle" | "loading" | "ok" | "waiting" | "empty">;
|
|
58
|
+
readonly statusText: import("@angular/core").Signal<string>;
|
|
24
59
|
readonly isInvalid: import("@angular/core").Signal<boolean>;
|
|
25
60
|
readonly errorMessage: import("@angular/core").Signal<string>;
|
|
61
|
+
onDocumentClick(event: MouseEvent): void;
|
|
62
|
+
onEscape(): void;
|
|
63
|
+
isSelected(opt: DropdownOption): boolean;
|
|
64
|
+
toggleOpen(event?: Event): void;
|
|
65
|
+
openDropdown(): void;
|
|
66
|
+
closeDropdown(): void;
|
|
67
|
+
selectOption(opt: DropdownOption): void;
|
|
68
|
+
clearSelection(event: Event): void;
|
|
69
|
+
clearSearch(event: Event): void;
|
|
70
|
+
onSearchInput(event: Event): void;
|
|
71
|
+
onTriggerKeydown(event: KeyboardEvent): void;
|
|
72
|
+
onSearchKeydown(event: KeyboardEvent): void;
|
|
73
|
+
private scrollFocusedIntoView;
|
|
26
74
|
constructor();
|
|
27
|
-
ngOnInit(): void;
|
|
28
75
|
ngOnDestroy(): void;
|
|
76
|
+
private scheduleReload;
|
|
29
77
|
private reloadDataSourceOptions;
|
|
30
78
|
static ɵfac: i0.ɵɵFactoryDeclaration<RptDropdownComponent, never>;
|
|
31
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<RptDropdownComponent, "rpt-dropdown", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "control": { "alias": "control"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
79
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<RptDropdownComponent, "rpt-dropdown", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "control": { "alias": "control"; "required": false; "isSignal": true; }; "parentForm": { "alias": "parentForm"; "required": false; "isSignal": true; }; "showStatus": { "alias": "showStatus"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
32
80
|
}
|
|
@@ -2,6 +2,8 @@ export { RptInputComponent } from './input/rpt-input.component';
|
|
|
2
2
|
export { RptDropdownComponent } from './dropdown/rpt-dropdown.component';
|
|
3
3
|
export type { DropdownOption } from './dropdown/rpt-dropdown.component';
|
|
4
4
|
export { RptDateComponent } from './date/rpt-date.component';
|
|
5
|
+
export { RptDateRangeComponent } from './date-range/rpt-date-range.component';
|
|
6
|
+
export type { DateRangeValue, DateRangePreset } from './date-range/rpt-date-range.component';
|
|
5
7
|
export { RptNumberComponent } from './number/rpt-number.component';
|
|
6
8
|
export { RptCheckboxComponent } from './checkbox/rpt-checkbox.component';
|
|
7
9
|
export { RptButtonComponent } from './button/rpt-button.component';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Reporting library root provider function.
|
|
2
|
+
* Reporting library root provider function and feature functions.
|
|
3
3
|
*
|
|
4
4
|
* Configures the library, its tokens, and registers built-in primitives.
|
|
5
5
|
*/
|
|
6
|
-
import { EnvironmentProviders, Type } from '@angular/core';
|
|
6
|
+
import { EnvironmentProviders, Provider, Type } from '@angular/core';
|
|
7
7
|
import { ReportingConfig } from './core/tokens/reporting-config.token';
|
|
8
8
|
import { SessionContextProvider, SessionContextSource } from './core/tokens/session-context.token';
|
|
9
9
|
import { ReportDataSourceAdapter } from './data-access/contracts/data-source.contract';
|
|
@@ -12,9 +12,60 @@ import { ReportPersistenceAdapter } from './data-access/contracts/report-persist
|
|
|
12
12
|
import { ReportSchemaDiscoveryAdapter } from './data-access/contracts/schema-discovery.contract';
|
|
13
13
|
import { ReportLookupAdapter } from './data-access/contracts/lookup.contract';
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* Kinds of reporting features available in `provideBwaysReport`.
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export declare enum ReportingFeatureKind {
|
|
18
|
+
HttpAdapters = 0,
|
|
19
|
+
LocalStorage = 1
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Represents a feature that can be passed to `provideBwaysReport(...)`.
|
|
23
|
+
*/
|
|
24
|
+
export interface ReportingFeature<KindT extends ReportingFeatureKind = ReportingFeatureKind> {
|
|
25
|
+
ɵkind: KindT;
|
|
26
|
+
ɵproviders: Provider[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Options for configuring built-in HTTP adapters via `withHttpAdapters(...)`.
|
|
30
|
+
*/
|
|
31
|
+
export interface HttpAdaptersOptions {
|
|
32
|
+
/**
|
|
33
|
+
* The base URL for the backend reporting REST API endpoints.
|
|
34
|
+
* @example 'http://localhost:3000/api/reporting'
|
|
35
|
+
*/
|
|
36
|
+
apiBaseUrl: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Configures the built-in HTTP adapters for backend execution, persistence,
|
|
40
|
+
* schema discovery, lookup, and master data queries.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* provideReporting(
|
|
45
|
+
* { defaultPageSize: 50 },
|
|
46
|
+
* withHttpAdapters({ apiBaseUrl: 'http://localhost:3000/api/reporting' })
|
|
47
|
+
* )
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare function withHttpAdapters(options: HttpAdaptersOptions): ReportingFeature<ReportingFeatureKind.HttpAdapters>;
|
|
51
|
+
/**
|
|
52
|
+
* Zero-backend sandbox mode using browser LocalStorage for report definitions
|
|
53
|
+
* and mock realistic datasets for query execution.
|
|
54
|
+
*
|
|
55
|
+
* Ideal for local development, prototyping, and offline testing without spinning up backends.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* provideReporting(withLocalStorage())
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
export declare function withLocalStorage(): ReportingFeature<ReportingFeatureKind.LocalStorage>;
|
|
63
|
+
/** Alias for withLocalStorage */
|
|
64
|
+
export declare const withMockAdapters: typeof withLocalStorage;
|
|
65
|
+
/**
|
|
66
|
+
* Configuration options for `provideBwaysReport()` (and `provideReporting()`).
|
|
67
|
+
*/
|
|
68
|
+
export interface ProvideBwaysReportOptions extends Partial<ReportingConfig> {
|
|
18
69
|
/**
|
|
19
70
|
* The Angular component to use for rendering report result grids.
|
|
20
71
|
* BWays-grid is the recommended default. Host can provide any grid component.
|
|
@@ -31,45 +82,47 @@ export interface ProvideReportingOptions extends Partial<ReportingConfig> {
|
|
|
31
82
|
masterDataProvider?: Type<MasterDataProvider>;
|
|
32
83
|
/** Host's implementation of the persistence adapter. */
|
|
33
84
|
persistenceAdapter?: Type<ReportPersistenceAdapter>;
|
|
34
|
-
/** Host's implementation of the schema discovery adapter
|
|
85
|
+
/** Host's implementation of the schema discovery adapter. */
|
|
35
86
|
schemaDiscoveryAdapter?: Type<ReportSchemaDiscoveryAdapter>;
|
|
36
|
-
/** Host's implementation of the lookup adapter
|
|
87
|
+
/** Host's implementation of the lookup adapter. */
|
|
37
88
|
lookupAdapter?: Type<ReportLookupAdapter>;
|
|
89
|
+
/**
|
|
90
|
+
* Inline session context parameters or factory function:
|
|
91
|
+
* e.g. `session: () => ({ branchId: auth.branchId(), user: auth.user() })`
|
|
92
|
+
*/
|
|
93
|
+
session?: SessionContextSource | (() => Record<string, unknown>);
|
|
38
94
|
/**
|
|
39
95
|
* Host application's session context parameters (e.g. { branchId: 1, companyId: 10, userId: 'usr-1' }).
|
|
40
|
-
* Can be a static object, an Angular Signal, an Observable, or a dynamic getter function.
|
|
41
|
-
* Stored procedures automatically bind matching parameters (like @BranchId, @CompanyId) to this context.
|
|
42
96
|
*/
|
|
43
97
|
sessionContext?: SessionContextSource;
|
|
44
98
|
/**
|
|
45
99
|
* Host application service class implementing `SessionContextProvider`.
|
|
46
|
-
* Resolves session parameters dynamically at runtime (e.g. from user auth state, active branch switcher).
|
|
47
100
|
*/
|
|
48
101
|
sessionContextProvider?: Type<SessionContextProvider>;
|
|
49
102
|
/**
|
|
50
103
|
* Factory function that returns a SessionContextSource with dependency injection context.
|
|
51
|
-
* E.g. `sessionContextFactory: () => inject(AuthService).currentSessionSignal`
|
|
52
104
|
*/
|
|
53
105
|
sessionContextFactory?: () => SessionContextSource;
|
|
54
106
|
}
|
|
107
|
+
/** Backward compatibility and alternative naming aliases */
|
|
108
|
+
export type ProvideReportingOptions = ProvideBwaysReportOptions;
|
|
109
|
+
export type ProvideBwaysReportingOptions = ProvideBwaysReportOptions;
|
|
55
110
|
/**
|
|
56
|
-
* Provides the BWays-Report library to the application.
|
|
111
|
+
* Provides the BWays-Report library to the Angular application.
|
|
112
|
+
*
|
|
113
|
+
* Supports modern idiomatic feature functions, e.g.:
|
|
114
|
+
* `provideReporting({ apiBaseUrl: '/api/reporting' })`
|
|
115
|
+
* or zero-backend sandbox mode:
|
|
116
|
+
* `provideReporting(withLocalStorage())`
|
|
57
117
|
*
|
|
58
118
|
* @param options - Configuration and adapter implementations.
|
|
119
|
+
* @param features - Optional features like `withHttpAdapters(...)` or `withLocalStorage()`.
|
|
59
120
|
* @returns Environment providers for the reporting library.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```typescript
|
|
63
|
-
* // app.config.ts
|
|
64
|
-
* export const appConfig: ApplicationConfig = {
|
|
65
|
-
* providers: [
|
|
66
|
-
* provideReporting({
|
|
67
|
-
* apiBaseUrl: 'http://localhost:3000/api/reporting',
|
|
68
|
-
* gridComponent: BwaysGridComponent,
|
|
69
|
-
* defaultPageSize: 50,
|
|
70
|
-
* }),
|
|
71
|
-
* ],
|
|
72
|
-
* };
|
|
73
|
-
* ```
|
|
74
121
|
*/
|
|
75
|
-
export declare function
|
|
122
|
+
export declare function provideBwaysReport(options?: ProvideBwaysReportOptions, ...features: ReportingFeature[]): EnvironmentProviders;
|
|
123
|
+
/** Alias for provideBwaysReport */
|
|
124
|
+
export declare const provideBwaysReporting: typeof provideBwaysReport;
|
|
125
|
+
/** Backward-compatible alias for provideBwaysReport */
|
|
126
|
+
export declare const provideReporting: typeof provideBwaysReport;
|
|
127
|
+
/** Semantic alias for BWays report providers */
|
|
128
|
+
export declare const bwaysReportProviders: typeof provideBwaysReport;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bways-report",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Enterprise-grade, metadata-driven reporting engine and visual page builder for Angular 18+ ERP applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"tslib": "^2.3.0"
|
|
32
32
|
},
|
|
33
|
+
"schematics": "./schematics/collection.json",
|
|
33
34
|
"sideEffects": false,
|
|
34
35
|
"module": "fesm2022/bways-report.mjs",
|
|
35
36
|
"typings": "index.d.ts",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
|
|
3
|
+
"schematics": {
|
|
4
|
+
"ng-add": {
|
|
5
|
+
"description": "Add bways-report reporting engine and designer to an Angular project",
|
|
6
|
+
"factory": "./ng-add/index#ngAdd",
|
|
7
|
+
"schema": "./ng-add/schema.json"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
function ngAdd(options) {
|
|
2
|
+
return (tree, context) => {
|
|
3
|
+
const configPath = 'src/app/app.config.ts';
|
|
4
|
+
const apiBase = (options && options.apiBaseUrl) ? options.apiBaseUrl : '/api';
|
|
5
|
+
|
|
6
|
+
if (tree.exists(configPath)) {
|
|
7
|
+
const buffer = tree.read(configPath);
|
|
8
|
+
if (buffer) {
|
|
9
|
+
let content = buffer.toString('utf-8');
|
|
10
|
+
|
|
11
|
+
// 1. Add import if not present
|
|
12
|
+
if (!content.includes('provideReporting')) {
|
|
13
|
+
content = "import { provideReporting } from 'bways-report';\n" + content;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// 2. Add provider into ApplicationConfig providers array
|
|
17
|
+
if (!content.includes('provideReporting(')) {
|
|
18
|
+
const providersIndex = content.indexOf('providers: [');
|
|
19
|
+
if (providersIndex !== -1) {
|
|
20
|
+
const insertPos = providersIndex + 'providers: ['.length;
|
|
21
|
+
content =
|
|
22
|
+
content.slice(0, insertPos) +
|
|
23
|
+
`\n provideReporting({ apiBaseUrl: '${apiBase}' }),` +
|
|
24
|
+
content.slice(insertPos);
|
|
25
|
+
tree.overwrite(configPath, content);
|
|
26
|
+
context.logger.info(`✓ Added provideReporting({ apiBaseUrl: '${apiBase}' }) to app.config.ts`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
context.logger.warn(
|
|
32
|
+
`Could not find src/app/app.config.ts. Remember to add provideReporting({ apiBaseUrl: '${apiBase}' }) to your application providers.`
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
context.logger.info(
|
|
37
|
+
'🎉 bways-report configured successfully! You can now use <rpt-report [id]="\'reportId\'" /> or <rpt-report-designer [id]="\'reportId\'" /> in your Angular templates.'
|
|
38
|
+
);
|
|
39
|
+
return tree;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
ngAdd,
|
|
45
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$id": "BwaysReportNgAddSchema",
|
|
4
|
+
"title": "Bways Report ng-add Options",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the Angular project to configure."
|
|
10
|
+
},
|
|
11
|
+
"apiBaseUrl": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Backend API base URL for report endpoints",
|
|
14
|
+
"default": "/api"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|