@alimetry/report-viewer-widget 0.0.0-stage → 1.0.0-dev.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.
package/README.md CHANGED
@@ -1,3 +1,24 @@
1
- # Temporary Holding Version
1
+ # ReportWidget
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.1.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project report-widget` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project report-widget`.
8
+ > Note: Don't forget to add `--project report-widget` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build report-widget` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build report-widget`, go to the dist folder `cd dist/report-widget` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test report-widget` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWxpbWV0cnktcmVwb3J0LXZpZXdlci13aWRnZXQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi93aWRnZXRzL3JlcG9ydC13aWRnZXQvc3JjL2FsaW1ldHJ5LXJlcG9ydC12aWV3ZXItd2lkZ2V0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=
@@ -0,0 +1,95 @@
1
+ import { Component, Input, } from '@angular/core';
2
+ import { ServicesConfigService, ServicesService } from '@alimetry/widget-core';
3
+ import { BehaviorSubject, catchError, distinctUntilChanged, EMPTY, filter, map, merge, Subject, switchMap, takeUntil, } from 'rxjs';
4
+ import { REPORT_WIDGET_VERSION } from './version';
5
+ import * as i0 from "@angular/core";
6
+ import * as i1 from "@alimetry/widget-core";
7
+ import * as i2 from "@angular/common";
8
+ export class ReportWidgetComponent {
9
+ constructor(servicesConfig, services, kvDiffers, itDiffers) {
10
+ this.servicesConfig = servicesConfig;
11
+ this.services = services;
12
+ this.kvDiffers = kvDiffers;
13
+ this.itDiffers = itDiffers;
14
+ this.version = REPORT_WIDGET_VERSION;
15
+ this.configError = null;
16
+ // the owner the widget is showing, null while the host has not settled on one
17
+ this.ownerId$ = new BehaviorSubject(null);
18
+ this.refresh$ = new Subject();
19
+ this.destroy$ = new Subject();
20
+ // the two things that fetch a report: the host settling on a different owner, and a manual
21
+ // refresh, which just re-emits the owner already on screen
22
+ merge(
23
+ // distinctUntilChanged so an unrelated config change does not re-fetch the same owner
24
+ this.ownerId$.pipe(distinctUntilChanged()), this.refresh$.pipe(map(() => this.ownerId$.value)))
25
+ .pipe(filter((ownerId) => !!ownerId),
26
+ // switchMap so a newly selected owner cancels the fetch still running for the previous one
27
+ switchMap((ownerId) => this.services.getSessionDataByOwner(ownerId).pipe(catchError(() => {
28
+ this.sessionData = undefined;
29
+ return EMPTY;
30
+ }))), takeUntil(this.destroy$))
31
+ .subscribe((sessionData) => {
32
+ this.sessionData = sessionData;
33
+ });
34
+ }
35
+ init() {
36
+ const deviceDataModelId = this.config?.deviceDataModelId?.trim() ?? '';
37
+ const apiUrl = this.config?.apiUrl?.trim() ?? '';
38
+ if (!deviceDataModelId || !apiUrl) {
39
+ this.configError =
40
+ 'This widget is missing required configuration values. Please check the widget configuration.';
41
+ this.sessionData = undefined;
42
+ this.ownerId$.next(null);
43
+ return;
44
+ }
45
+ this.configError = null;
46
+ // hand the values the services layer needs to it through dependency injection
47
+ this.servicesConfig.setConfig({ deviceDataModelId, apiUrl });
48
+ // owners is the host filter's selection list; the widget shows the first one
49
+ const ownerId = this.config?.owners?.[0]?.trim() ?? '';
50
+ if (!ownerId) {
51
+ // the host only pushes an owner once one is selected, so this is the normal first-render state
52
+ this.configError = 'No owner selected. Please select an owner to view the report.';
53
+ this.sessionData = undefined;
54
+ this.ownerId$.next(null);
55
+ return;
56
+ }
57
+ this.ownerId$.next(ownerId);
58
+ }
59
+ ngOnInit() {
60
+ // initalise differs for config and owners
61
+ if (this.config && !this.configDiffer) {
62
+ this.configDiffer = this.kvDiffers.find(this.config).create();
63
+ }
64
+ if (this.config?.owners && !this.ownersDiffer) {
65
+ this.ownersDiffer = this.itDiffers.find(this.config.owners).create();
66
+ }
67
+ }
68
+ ngDoCheck() {
69
+ const configChanges = this.configDiffer?.diff(this.config);
70
+ const ownersChanges = this.ownersDiffer?.diff(this.config?.owners);
71
+ if (configChanges || ownersChanges) {
72
+ this.init();
73
+ }
74
+ }
75
+ ngOnDestroy() {
76
+ this.destroy$.next();
77
+ this.destroy$.complete();
78
+ }
79
+ // the host drives this from its refresh control, through the widget's ViewChild reference
80
+ onRefresh() {
81
+ // re-read the config first, so a refresh picks up a new owner or a config error, then re-fetch
82
+ // whichever owner that left selected
83
+ this.init();
84
+ this.refresh$.next();
85
+ }
86
+ }
87
+ ReportWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetComponent, deps: [{ token: i1.ServicesConfigService }, { token: i1.ServicesService }, { token: i0.KeyValueDiffers }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Component });
88
+ ReportWidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ReportWidgetComponent, selector: "lib-report-widget", inputs: { config: "config" }, providers: [ServicesConfigService, ServicesService], ngImport: i0, template: "<p *ngIf=\"configError; else reportViewer\" class=\"report-widget__error\" role=\"alert\">\n {{ configError }}\n</p>\n<ng-template #reportViewer>\n <lib-report-viewer [sessionData]=\"sessionData\"></lib-report-viewer>\n</ng-template>\n<lib-version-footer [version]=\"version\"></lib-version-footer>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ReportViewerComponent, selector: "lib-report-viewer", inputs: ["sessionData"], outputs: ["reportLoaded"] }, { kind: "component", type: i1.VersionFooterComponent, selector: "lib-version-footer", inputs: ["version"] }] });
89
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetComponent, decorators: [{
90
+ type: Component,
91
+ args: [{ selector: 'lib-report-widget', providers: [ServicesConfigService, ServicesService], template: "<p *ngIf=\"configError; else reportViewer\" class=\"report-widget__error\" role=\"alert\">\n {{ configError }}\n</p>\n<ng-template #reportViewer>\n <lib-report-viewer [sessionData]=\"sessionData\"></lib-report-viewer>\n</ng-template>\n<lib-version-footer [version]=\"version\"></lib-version-footer>\n" }]
92
+ }], ctorParameters: function () { return [{ type: i1.ServicesConfigService }, { type: i1.ServicesService }, { type: i0.KeyValueDiffers }, { type: i0.IterableDiffers }]; }, propDecorators: { config: [{
93
+ type: Input
94
+ }] } });
95
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVwb3J0LXdpZGdldC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi93aWRnZXRzL3JlcG9ydC13aWRnZXQvc3JjL2xpYi9yZXBvcnQtd2lkZ2V0LmNvbXBvbmVudC50cyIsIi4uL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j5cbiJdfQ==
@@ -0,0 +1,19 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { CommonModule } from '@angular/common';
3
+ import { ComponentsModule } from '@alimetry/widget-core';
4
+ import { ReportWidgetComponent } from './report-widget.component';
5
+ import * as i0 from "@angular/core";
6
+ export class ReportWidgetModule {
7
+ }
8
+ ReportWidgetModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
9
+ ReportWidgetModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, declarations: [ReportWidgetComponent], imports: [CommonModule, ComponentsModule], exports: [ReportWidgetComponent] });
10
+ ReportWidgetModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, imports: [CommonModule, ComponentsModule] });
11
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, decorators: [{
12
+ type: NgModule,
13
+ args: [{
14
+ declarations: [ReportWidgetComponent],
15
+ imports: [CommonModule, ComponentsModule],
16
+ exports: [ReportWidgetComponent],
17
+ }]
18
+ }] });
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVwb3J0LXdpZGdldC5tb2R1bGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi93aWRnZXRzL3JlcG9ydC13aWRnZXQvc3JjL2xpYi9yZXBvcnQtd2lkZ2V0Lm1vZHVsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3pDLE9BQU8sRUFBRSxZQUFZLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQzt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2V0TW9kdWxlIHt9XG4iXX0=
@@ -0,0 +1,4 @@
1
+ // keep in step with "version" in widgets/report-widget/package.json, which ng-packagr won't let
2
+ // src import
3
+ export const REPORT_WIDGET_VERSION = '1.0.0-dev.0';
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3dpZGdldHMvcmVwb3J0LXdpZGdldC9zcmMvbGliL3ZlcnNpb24udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0dBQWdHO0FBQ2hHLGFBQWE7QUFDYixNQUFNLENBQUMsTUFBTSxxQkFBcUIsR0FBRyxhQUFhLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBrZWVwIGluIHN0ZXAgd2l0aCBcInZlcnNpb25cIiBpbiB3aWRnZXRzL3JlcG9ydC13aWRnZXQvcGFja2FnZS5qc29uLCB3aGljaCBuZy1wYWNrYWdyIHdvbid0IGxldFxuLy8gc3JjIGltcG9ydFxuZXhwb3J0IGNvbnN0IFJFUE9SVF9XSURHRVRfVkVSU0lPTiA9ICcxLjAuMC1kZXYuMCc7XG4iXX0=
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Public API Surface of report-widget
3
+ */
4
+ export * from './lib/report-widget.component';
5
+ export * from './lib/report-widget.module';
6
+ export * from './lib/version';
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3dpZGdldHMvcmVwb3J0LXdpZGdldC9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsK0JBQStCLENBQUM7QUFDOUMsY0FBYyw0QkFBNEIsQ0FBQztBQUMzQyxjQUFjLGVBQWUsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXG4gKiBQdWJsaWMgQVBJIFN1cmZhY2Ugb2YgcmVwb3J0LXdpZGdldFxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vbGliL3JlcG9ydC13aWRnZXQuY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3JlcG9ydC13aWRnZXQubW9kdWxlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL3ZlcnNpb24nO1xuIl19
@@ -0,0 +1,127 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, Input, NgModule } from '@angular/core';
3
+ import * as i1 from '@alimetry/widget-core';
4
+ import { ServicesConfigService, ServicesService, ComponentsModule } from '@alimetry/widget-core';
5
+ import { BehaviorSubject, Subject, merge, distinctUntilChanged, map, filter, switchMap, catchError, EMPTY, takeUntil } from 'rxjs';
6
+ import * as i2 from '@angular/common';
7
+ import { CommonModule } from '@angular/common';
8
+
9
+ // keep in step with "version" in widgets/report-widget/package.json, which ng-packagr won't let
10
+ // src import
11
+ const REPORT_WIDGET_VERSION = '1.0.0-dev.0';
12
+
13
+ class ReportWidgetComponent {
14
+ constructor(servicesConfig, services, kvDiffers, itDiffers) {
15
+ this.servicesConfig = servicesConfig;
16
+ this.services = services;
17
+ this.kvDiffers = kvDiffers;
18
+ this.itDiffers = itDiffers;
19
+ this.version = REPORT_WIDGET_VERSION;
20
+ this.configError = null;
21
+ // the owner the widget is showing, null while the host has not settled on one
22
+ this.ownerId$ = new BehaviorSubject(null);
23
+ this.refresh$ = new Subject();
24
+ this.destroy$ = new Subject();
25
+ // the two things that fetch a report: the host settling on a different owner, and a manual
26
+ // refresh, which just re-emits the owner already on screen
27
+ merge(
28
+ // distinctUntilChanged so an unrelated config change does not re-fetch the same owner
29
+ this.ownerId$.pipe(distinctUntilChanged()), this.refresh$.pipe(map(() => this.ownerId$.value)))
30
+ .pipe(filter((ownerId) => !!ownerId),
31
+ // switchMap so a newly selected owner cancels the fetch still running for the previous one
32
+ switchMap((ownerId) => this.services.getSessionDataByOwner(ownerId).pipe(catchError(() => {
33
+ this.sessionData = undefined;
34
+ return EMPTY;
35
+ }))), takeUntil(this.destroy$))
36
+ .subscribe((sessionData) => {
37
+ this.sessionData = sessionData;
38
+ });
39
+ }
40
+ init() {
41
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
42
+ const deviceDataModelId = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.deviceDataModelId) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
43
+ const apiUrl = (_f = (_e = (_d = this.config) === null || _d === void 0 ? void 0 : _d.apiUrl) === null || _e === void 0 ? void 0 : _e.trim()) !== null && _f !== void 0 ? _f : '';
44
+ if (!deviceDataModelId || !apiUrl) {
45
+ this.configError =
46
+ 'This widget is missing required configuration values. Please check the widget configuration.';
47
+ this.sessionData = undefined;
48
+ this.ownerId$.next(null);
49
+ return;
50
+ }
51
+ this.configError = null;
52
+ // hand the values the services layer needs to it through dependency injection
53
+ this.servicesConfig.setConfig({ deviceDataModelId, apiUrl });
54
+ // owners is the host filter's selection list; the widget shows the first one
55
+ const ownerId = (_k = (_j = (_h = (_g = this.config) === null || _g === void 0 ? void 0 : _g.owners) === null || _h === void 0 ? void 0 : _h[0]) === null || _j === void 0 ? void 0 : _j.trim()) !== null && _k !== void 0 ? _k : '';
56
+ if (!ownerId) {
57
+ // the host only pushes an owner once one is selected, so this is the normal first-render state
58
+ this.configError = 'No owner selected. Please select an owner to view the report.';
59
+ this.sessionData = undefined;
60
+ this.ownerId$.next(null);
61
+ return;
62
+ }
63
+ this.ownerId$.next(ownerId);
64
+ }
65
+ ngOnInit() {
66
+ var _a;
67
+ // initalise differs for config and owners
68
+ if (this.config && !this.configDiffer) {
69
+ this.configDiffer = this.kvDiffers.find(this.config).create();
70
+ }
71
+ if (((_a = this.config) === null || _a === void 0 ? void 0 : _a.owners) && !this.ownersDiffer) {
72
+ this.ownersDiffer = this.itDiffers.find(this.config.owners).create();
73
+ }
74
+ }
75
+ ngDoCheck() {
76
+ var _a, _b, _c;
77
+ const configChanges = (_a = this.configDiffer) === null || _a === void 0 ? void 0 : _a.diff(this.config);
78
+ const ownersChanges = (_b = this.ownersDiffer) === null || _b === void 0 ? void 0 : _b.diff((_c = this.config) === null || _c === void 0 ? void 0 : _c.owners);
79
+ if (configChanges || ownersChanges) {
80
+ this.init();
81
+ }
82
+ }
83
+ ngOnDestroy() {
84
+ this.destroy$.next();
85
+ this.destroy$.complete();
86
+ }
87
+ // the host drives this from its refresh control, through the widget's ViewChild reference
88
+ onRefresh() {
89
+ // re-read the config first, so a refresh picks up a new owner or a config error, then re-fetch
90
+ // whichever owner that left selected
91
+ this.init();
92
+ this.refresh$.next();
93
+ }
94
+ }
95
+ ReportWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetComponent, deps: [{ token: i1.ServicesConfigService }, { token: i1.ServicesService }, { token: i0.KeyValueDiffers }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Component });
96
+ ReportWidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ReportWidgetComponent, selector: "lib-report-widget", inputs: { config: "config" }, providers: [ServicesConfigService, ServicesService], ngImport: i0, template: "<p *ngIf=\"configError; else reportViewer\" class=\"report-widget__error\" role=\"alert\">\n {{ configError }}\n</p>\n<ng-template #reportViewer>\n <lib-report-viewer [sessionData]=\"sessionData\"></lib-report-viewer>\n</ng-template>\n<lib-version-footer [version]=\"version\"></lib-version-footer>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ReportViewerComponent, selector: "lib-report-viewer", inputs: ["sessionData"], outputs: ["reportLoaded"] }, { kind: "component", type: i1.VersionFooterComponent, selector: "lib-version-footer", inputs: ["version"] }] });
97
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetComponent, decorators: [{
98
+ type: Component,
99
+ args: [{ selector: 'lib-report-widget', providers: [ServicesConfigService, ServicesService], template: "<p *ngIf=\"configError; else reportViewer\" class=\"report-widget__error\" role=\"alert\">\n {{ configError }}\n</p>\n<ng-template #reportViewer>\n <lib-report-viewer [sessionData]=\"sessionData\"></lib-report-viewer>\n</ng-template>\n<lib-version-footer [version]=\"version\"></lib-version-footer>\n" }]
100
+ }], ctorParameters: function () { return [{ type: i1.ServicesConfigService }, { type: i1.ServicesService }, { type: i0.KeyValueDiffers }, { type: i0.IterableDiffers }]; }, propDecorators: { config: [{
101
+ type: Input
102
+ }] } });
103
+
104
+ class ReportWidgetModule {
105
+ }
106
+ ReportWidgetModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
107
+ ReportWidgetModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, declarations: [ReportWidgetComponent], imports: [CommonModule, ComponentsModule], exports: [ReportWidgetComponent] });
108
+ ReportWidgetModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, imports: [CommonModule, ComponentsModule] });
109
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, decorators: [{
110
+ type: NgModule,
111
+ args: [{
112
+ declarations: [ReportWidgetComponent],
113
+ imports: [CommonModule, ComponentsModule],
114
+ exports: [ReportWidgetComponent],
115
+ }]
116
+ }] });
117
+
118
+ /*
119
+ * Public API Surface of report-widget
120
+ */
121
+
122
+ /**
123
+ * Generated bundle index. Do not edit.
124
+ */
125
+
126
+ export { REPORT_WIDGET_VERSION, ReportWidgetComponent, ReportWidgetModule };
127
+ //# sourceMappingURL=alimetry-report-viewer-widget.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alimetry-report-viewer-widget.mjs","sources":["../../../widgets/report-widget/src/lib/version.ts","../../../widgets/report-widget/src/lib/report-widget.component.ts","../../../widgets/report-widget/src/lib/report-widget.component.html","../../../widgets/report-widget/src/lib/report-widget.module.ts","../../../widgets/report-widget/src/public-api.ts","../../../widgets/report-widget/src/alimetry-report-viewer-widget.ts"],"sourcesContent":["// keep in step with \"version\" in widgets/report-widget/package.json, which ng-packagr won't let\n// src import\nexport const REPORT_WIDGET_VERSION = '1.0.0-dev.0';\n","import {\n Component,\n DoCheck,\n OnInit,\n OnDestroy,\n Input,\n KeyValueDiffers,\n IterableDiffers,\n KeyValueDiffer,\n IterableDiffer,\n} from '@angular/core';\nimport { DeviceData, ServicesConfigService, ServicesService } from '@alimetry/widget-core';\nimport {\n BehaviorSubject,\n catchError,\n distinctUntilChanged,\n EMPTY,\n filter,\n map,\n merge,\n Subject,\n switchMap,\n takeUntil,\n} from 'rxjs';\nimport { REPORT_WIDGET_VERSION } from './version';\n\n@Component({\n selector: 'lib-report-widget',\n templateUrl: './report-widget.component.html',\n providers: [ServicesConfigService, ServicesService],\n})\nexport class ReportWidgetComponent implements OnInit, DoCheck, OnDestroy {\n // TODO: change the type of the input to not be any\n @Input() config: any;\n\n readonly version = REPORT_WIDGET_VERSION;\n\n sessionData?: DeviceData;\n configError: string | null = null;\n\n private configDiffer?: KeyValueDiffer<any, any>;\n private ownersDiffer?: IterableDiffer<string>;\n\n // the owner the widget is showing, null while the host has not settled on one\n private readonly ownerId$ = new BehaviorSubject<string | null>(null);\n private readonly refresh$ = new Subject<void>();\n private readonly destroy$ = new Subject<void>();\n\n constructor(\n private servicesConfig: ServicesConfigService,\n private services: ServicesService,\n private kvDiffers: KeyValueDiffers,\n private itDiffers: IterableDiffers,\n ) {\n // the two things that fetch a report: the host settling on a different owner, and a manual\n // refresh, which just re-emits the owner already on screen\n merge(\n // distinctUntilChanged so an unrelated config change does not re-fetch the same owner\n this.ownerId$.pipe(distinctUntilChanged()),\n this.refresh$.pipe(map(() => this.ownerId$.value)),\n )\n .pipe(\n filter((ownerId): ownerId is string => !!ownerId),\n // switchMap so a newly selected owner cancels the fetch still running for the previous one\n switchMap((ownerId) =>\n this.services.getSessionDataByOwner(ownerId).pipe(\n catchError(() => {\n this.sessionData = undefined;\n return EMPTY;\n }),\n ),\n ),\n takeUntil(this.destroy$),\n )\n .subscribe((sessionData) => {\n this.sessionData = sessionData;\n });\n }\n\n init() {\n const deviceDataModelId: string = this.config?.deviceDataModelId?.trim() ?? '';\n const apiUrl: string = this.config?.apiUrl?.trim() ?? '';\n\n if (!deviceDataModelId || !apiUrl) {\n this.configError =\n 'This widget is missing required configuration values. Please check the widget configuration.';\n this.sessionData = undefined;\n this.ownerId$.next(null);\n return;\n }\n\n this.configError = null;\n // hand the values the services layer needs to it through dependency injection\n this.servicesConfig.setConfig({ deviceDataModelId, apiUrl });\n\n // owners is the host filter's selection list; the widget shows the first one\n const ownerId: string = this.config?.owners?.[0]?.trim() ?? '';\n if (!ownerId) {\n // the host only pushes an owner once one is selected, so this is the normal first-render state\n this.configError = 'No owner selected. Please select an owner to view the report.';\n this.sessionData = undefined;\n this.ownerId$.next(null);\n return;\n }\n\n this.ownerId$.next(ownerId);\n }\n\n ngOnInit(): void {\n // initalise differs for config and owners\n if (this.config && !this.configDiffer) {\n this.configDiffer = this.kvDiffers.find(this.config).create();\n }\n if (this.config?.owners && !this.ownersDiffer) {\n this.ownersDiffer = this.itDiffers.find(this.config.owners).create();\n }\n }\n\n ngDoCheck() {\n const configChanges = this.configDiffer?.diff(this.config);\n const ownersChanges = this.ownersDiffer?.diff(this.config?.owners);\n\n if (configChanges || ownersChanges) {\n this.init();\n }\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n // the host drives this from its refresh control, through the widget's ViewChild reference\n onRefresh(): void {\n // re-read the config first, so a refresh picks up a new owner or a config error, then re-fetch\n // whichever owner that left selected\n this.init();\n this.refresh$.next();\n }\n}\n","<p *ngIf=\"configError; else reportViewer\" class=\"report-widget__error\" role=\"alert\">\n {{ configError }}\n</p>\n<ng-template #reportViewer>\n <lib-report-viewer [sessionData]=\"sessionData\"></lib-report-viewer>\n</ng-template>\n<lib-version-footer [version]=\"version\"></lib-version-footer>\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ComponentsModule } from '@alimetry/widget-core';\nimport { ReportWidgetComponent } from './report-widget.component';\n\n@NgModule({\n declarations: [ReportWidgetComponent],\n imports: [CommonModule, ComponentsModule],\n exports: [ReportWidgetComponent],\n})\nexport class ReportWidgetModule {}\n","/*\n * Public API Surface of report-widget\n */\n\nexport * from './lib/report-widget.component';\nexport * from './lib/report-widget.module';\nexport * from './lib/version';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AACO,MAAM,qBAAqB,GAAG;;MC6BxB,qBAAqB,CAAA;AAiBhC,IAAA,WAAA,CACU,cAAqC,EACrC,QAAyB,EACzB,SAA0B,EAC1B,SAA0B,EAAA;AAH1B,QAAA,IAAc,CAAA,cAAA,GAAd,cAAc,CAAuB;AACrC,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAiB;AACzB,QAAA,IAAS,CAAA,SAAA,GAAT,SAAS,CAAiB;AAC1B,QAAA,IAAS,CAAA,SAAA,GAAT,SAAS,CAAiB;AAjB3B,QAAA,IAAO,CAAA,OAAA,GAAG,qBAAqB,CAAC;AAGzC,QAAA,IAAW,CAAA,WAAA,GAAkB,IAAI,CAAC;;QAMjB,IAAA,CAAA,QAAQ,GAAG,IAAI,eAAe,CAAgB,IAAI,CAAC,CAAC;AACpD,QAAA,IAAA,CAAA,QAAQ,GAAG,IAAI,OAAO,EAAQ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AA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,mBAAmB,EAElB,SAAA,EAAA,CAAC,qBAAqB,EAAE,eAAe,CAAC,EAAA,QAAA,EAAA,gTAAA,EAAA,CAAA;sMAI1C,MAAM,EAAA,CAAA;sBAAd,KAAK;;;MEvBK,kBAAkB,CAAA;;gHAAlB,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAlB,kBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,iBAJd,qBAAqB,CAAA,EAAA,OAAA,EAAA,CAC1B,YAAY,EAAE,gBAAgB,aAC9B,qBAAqB,CAAA,EAAA,CAAA,CAAA;iHAEpB,kBAAkB,EAAA,OAAA,EAAA,CAHnB,YAAY,EAAE,gBAAgB,CAAA,EAAA,CAAA,CAAA;4FAG7B,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAL9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,YAAY,EAAE,CAAC,qBAAqB,CAAC;AACrC,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;oBACzC,OAAO,EAAE,CAAC,qBAAqB,CAAC;iBACjC,CAAA;;;ACTD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -0,0 +1,124 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, Input, NgModule } from '@angular/core';
3
+ import * as i1 from '@alimetry/widget-core';
4
+ import { ServicesConfigService, ServicesService, ComponentsModule } from '@alimetry/widget-core';
5
+ import { BehaviorSubject, Subject, merge, distinctUntilChanged, map, filter, switchMap, catchError, EMPTY, takeUntil } from 'rxjs';
6
+ import * as i2 from '@angular/common';
7
+ import { CommonModule } from '@angular/common';
8
+
9
+ // keep in step with "version" in widgets/report-widget/package.json, which ng-packagr won't let
10
+ // src import
11
+ const REPORT_WIDGET_VERSION = '1.0.0-dev.0';
12
+
13
+ class ReportWidgetComponent {
14
+ constructor(servicesConfig, services, kvDiffers, itDiffers) {
15
+ this.servicesConfig = servicesConfig;
16
+ this.services = services;
17
+ this.kvDiffers = kvDiffers;
18
+ this.itDiffers = itDiffers;
19
+ this.version = REPORT_WIDGET_VERSION;
20
+ this.configError = null;
21
+ // the owner the widget is showing, null while the host has not settled on one
22
+ this.ownerId$ = new BehaviorSubject(null);
23
+ this.refresh$ = new Subject();
24
+ this.destroy$ = new Subject();
25
+ // the two things that fetch a report: the host settling on a different owner, and a manual
26
+ // refresh, which just re-emits the owner already on screen
27
+ merge(
28
+ // distinctUntilChanged so an unrelated config change does not re-fetch the same owner
29
+ this.ownerId$.pipe(distinctUntilChanged()), this.refresh$.pipe(map(() => this.ownerId$.value)))
30
+ .pipe(filter((ownerId) => !!ownerId),
31
+ // switchMap so a newly selected owner cancels the fetch still running for the previous one
32
+ switchMap((ownerId) => this.services.getSessionDataByOwner(ownerId).pipe(catchError(() => {
33
+ this.sessionData = undefined;
34
+ return EMPTY;
35
+ }))), takeUntil(this.destroy$))
36
+ .subscribe((sessionData) => {
37
+ this.sessionData = sessionData;
38
+ });
39
+ }
40
+ init() {
41
+ const deviceDataModelId = this.config?.deviceDataModelId?.trim() ?? '';
42
+ const apiUrl = this.config?.apiUrl?.trim() ?? '';
43
+ if (!deviceDataModelId || !apiUrl) {
44
+ this.configError =
45
+ 'This widget is missing required configuration values. Please check the widget configuration.';
46
+ this.sessionData = undefined;
47
+ this.ownerId$.next(null);
48
+ return;
49
+ }
50
+ this.configError = null;
51
+ // hand the values the services layer needs to it through dependency injection
52
+ this.servicesConfig.setConfig({ deviceDataModelId, apiUrl });
53
+ // owners is the host filter's selection list; the widget shows the first one
54
+ const ownerId = this.config?.owners?.[0]?.trim() ?? '';
55
+ if (!ownerId) {
56
+ // the host only pushes an owner once one is selected, so this is the normal first-render state
57
+ this.configError = 'No owner selected. Please select an owner to view the report.';
58
+ this.sessionData = undefined;
59
+ this.ownerId$.next(null);
60
+ return;
61
+ }
62
+ this.ownerId$.next(ownerId);
63
+ }
64
+ ngOnInit() {
65
+ // initalise differs for config and owners
66
+ if (this.config && !this.configDiffer) {
67
+ this.configDiffer = this.kvDiffers.find(this.config).create();
68
+ }
69
+ if (this.config?.owners && !this.ownersDiffer) {
70
+ this.ownersDiffer = this.itDiffers.find(this.config.owners).create();
71
+ }
72
+ }
73
+ ngDoCheck() {
74
+ const configChanges = this.configDiffer?.diff(this.config);
75
+ const ownersChanges = this.ownersDiffer?.diff(this.config?.owners);
76
+ if (configChanges || ownersChanges) {
77
+ this.init();
78
+ }
79
+ }
80
+ ngOnDestroy() {
81
+ this.destroy$.next();
82
+ this.destroy$.complete();
83
+ }
84
+ // the host drives this from its refresh control, through the widget's ViewChild reference
85
+ onRefresh() {
86
+ // re-read the config first, so a refresh picks up a new owner or a config error, then re-fetch
87
+ // whichever owner that left selected
88
+ this.init();
89
+ this.refresh$.next();
90
+ }
91
+ }
92
+ ReportWidgetComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetComponent, deps: [{ token: i1.ServicesConfigService }, { token: i1.ServicesService }, { token: i0.KeyValueDiffers }, { token: i0.IterableDiffers }], target: i0.ɵɵFactoryTarget.Component });
93
+ ReportWidgetComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ReportWidgetComponent, selector: "lib-report-widget", inputs: { config: "config" }, providers: [ServicesConfigService, ServicesService], ngImport: i0, template: "<p *ngIf=\"configError; else reportViewer\" class=\"report-widget__error\" role=\"alert\">\n {{ configError }}\n</p>\n<ng-template #reportViewer>\n <lib-report-viewer [sessionData]=\"sessionData\"></lib-report-viewer>\n</ng-template>\n<lib-version-footer [version]=\"version\"></lib-version-footer>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.ReportViewerComponent, selector: "lib-report-viewer", inputs: ["sessionData"], outputs: ["reportLoaded"] }, { kind: "component", type: i1.VersionFooterComponent, selector: "lib-version-footer", inputs: ["version"] }] });
94
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetComponent, decorators: [{
95
+ type: Component,
96
+ args: [{ selector: 'lib-report-widget', providers: [ServicesConfigService, ServicesService], template: "<p *ngIf=\"configError; else reportViewer\" class=\"report-widget__error\" role=\"alert\">\n {{ configError }}\n</p>\n<ng-template #reportViewer>\n <lib-report-viewer [sessionData]=\"sessionData\"></lib-report-viewer>\n</ng-template>\n<lib-version-footer [version]=\"version\"></lib-version-footer>\n" }]
97
+ }], ctorParameters: function () { return [{ type: i1.ServicesConfigService }, { type: i1.ServicesService }, { type: i0.KeyValueDiffers }, { type: i0.IterableDiffers }]; }, propDecorators: { config: [{
98
+ type: Input
99
+ }] } });
100
+
101
+ class ReportWidgetModule {
102
+ }
103
+ ReportWidgetModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
104
+ ReportWidgetModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, declarations: [ReportWidgetComponent], imports: [CommonModule, ComponentsModule], exports: [ReportWidgetComponent] });
105
+ ReportWidgetModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, imports: [CommonModule, ComponentsModule] });
106
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ReportWidgetModule, decorators: [{
107
+ type: NgModule,
108
+ args: [{
109
+ declarations: [ReportWidgetComponent],
110
+ imports: [CommonModule, ComponentsModule],
111
+ exports: [ReportWidgetComponent],
112
+ }]
113
+ }] });
114
+
115
+ /*
116
+ * Public API Surface of report-widget
117
+ */
118
+
119
+ /**
120
+ * Generated bundle index. Do not edit.
121
+ */
122
+
123
+ export { REPORT_WIDGET_VERSION, ReportWidgetComponent, ReportWidgetModule };
124
+ //# sourceMappingURL=alimetry-report-viewer-widget.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alimetry-report-viewer-widget.mjs","sources":["../../../widgets/report-widget/src/lib/version.ts","../../../widgets/report-widget/src/lib/report-widget.component.ts","../../../widgets/report-widget/src/lib/report-widget.component.html","../../../widgets/report-widget/src/lib/report-widget.module.ts","../../../widgets/report-widget/src/public-api.ts","../../../widgets/report-widget/src/alimetry-report-viewer-widget.ts"],"sourcesContent":["// keep in step with \"version\" in widgets/report-widget/package.json, which ng-packagr won't let\n// src import\nexport const REPORT_WIDGET_VERSION = '1.0.0-dev.0';\n","import {\n Component,\n DoCheck,\n OnInit,\n OnDestroy,\n Input,\n KeyValueDiffers,\n IterableDiffers,\n KeyValueDiffer,\n IterableDiffer,\n} from '@angular/core';\nimport { DeviceData, ServicesConfigService, ServicesService } from '@alimetry/widget-core';\nimport {\n BehaviorSubject,\n catchError,\n distinctUntilChanged,\n EMPTY,\n filter,\n map,\n merge,\n Subject,\n switchMap,\n takeUntil,\n} from 'rxjs';\nimport { REPORT_WIDGET_VERSION } from './version';\n\n@Component({\n selector: 'lib-report-widget',\n templateUrl: './report-widget.component.html',\n providers: [ServicesConfigService, ServicesService],\n})\nexport class ReportWidgetComponent implements OnInit, DoCheck, OnDestroy {\n // TODO: change the type of the input to not be any\n @Input() config: any;\n\n readonly version = REPORT_WIDGET_VERSION;\n\n sessionData?: DeviceData;\n configError: string | null = null;\n\n private configDiffer?: KeyValueDiffer<any, any>;\n private ownersDiffer?: IterableDiffer<string>;\n\n // the owner the widget is showing, null while the host has not settled on one\n private readonly ownerId$ = new BehaviorSubject<string | null>(null);\n private readonly refresh$ = new Subject<void>();\n private readonly destroy$ = new Subject<void>();\n\n constructor(\n private servicesConfig: ServicesConfigService,\n private services: ServicesService,\n private kvDiffers: KeyValueDiffers,\n private itDiffers: IterableDiffers,\n ) {\n // the two things that fetch a report: the host settling on a different owner, and a manual\n // refresh, which just re-emits the owner already on screen\n merge(\n // distinctUntilChanged so an unrelated config change does not re-fetch the same owner\n this.ownerId$.pipe(distinctUntilChanged()),\n this.refresh$.pipe(map(() => this.ownerId$.value)),\n )\n .pipe(\n filter((ownerId): ownerId is string => !!ownerId),\n // switchMap so a newly selected owner cancels the fetch still running for the previous one\n switchMap((ownerId) =>\n this.services.getSessionDataByOwner(ownerId).pipe(\n catchError(() => {\n this.sessionData = undefined;\n return EMPTY;\n }),\n ),\n ),\n takeUntil(this.destroy$),\n )\n .subscribe((sessionData) => {\n this.sessionData = sessionData;\n });\n }\n\n init() {\n const deviceDataModelId: string = this.config?.deviceDataModelId?.trim() ?? '';\n const apiUrl: string = this.config?.apiUrl?.trim() ?? '';\n\n if (!deviceDataModelId || !apiUrl) {\n this.configError =\n 'This widget is missing required configuration values. Please check the widget configuration.';\n this.sessionData = undefined;\n this.ownerId$.next(null);\n return;\n }\n\n this.configError = null;\n // hand the values the services layer needs to it through dependency injection\n this.servicesConfig.setConfig({ deviceDataModelId, apiUrl });\n\n // owners is the host filter's selection list; the widget shows the first one\n const ownerId: string = this.config?.owners?.[0]?.trim() ?? '';\n if (!ownerId) {\n // the host only pushes an owner once one is selected, so this is the normal first-render state\n this.configError = 'No owner selected. Please select an owner to view the report.';\n this.sessionData = undefined;\n this.ownerId$.next(null);\n return;\n }\n\n this.ownerId$.next(ownerId);\n }\n\n ngOnInit(): void {\n // initalise differs for config and owners\n if (this.config && !this.configDiffer) {\n this.configDiffer = this.kvDiffers.find(this.config).create();\n }\n if (this.config?.owners && !this.ownersDiffer) {\n this.ownersDiffer = this.itDiffers.find(this.config.owners).create();\n }\n }\n\n ngDoCheck() {\n const configChanges = this.configDiffer?.diff(this.config);\n const ownersChanges = this.ownersDiffer?.diff(this.config?.owners);\n\n if (configChanges || ownersChanges) {\n this.init();\n }\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n // the host drives this from its refresh control, through the widget's ViewChild reference\n onRefresh(): void {\n // re-read the config first, so a refresh picks up a new owner or a config error, then re-fetch\n // whichever owner that left selected\n this.init();\n this.refresh$.next();\n }\n}\n","<p *ngIf=\"configError; else reportViewer\" class=\"report-widget__error\" role=\"alert\">\n {{ configError }}\n</p>\n<ng-template #reportViewer>\n <lib-report-viewer [sessionData]=\"sessionData\"></lib-report-viewer>\n</ng-template>\n<lib-version-footer [version]=\"version\"></lib-version-footer>\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ComponentsModule } from '@alimetry/widget-core';\nimport { ReportWidgetComponent } from './report-widget.component';\n\n@NgModule({\n declarations: [ReportWidgetComponent],\n imports: [CommonModule, ComponentsModule],\n exports: [ReportWidgetComponent],\n})\nexport class ReportWidgetModule {}\n","/*\n * Public API Surface of report-widget\n */\n\nexport * from './lib/report-widget.component';\nexport * from './lib/report-widget.module';\nexport * from './lib/version';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;AAAA;AACA;AACO,MAAM,qBAAqB,GAAG;;MC6BxB,qBAAqB,CAAA;AAiBhC,IAAA,WAAA,CACU,cAAqC,EACrC,QAAyB,EACzB,SAA0B,EAC1B,SAA0B,EAAA;QAH1B,IAAc,CAAA,cAAA,GAAd,cAAc,CAAuB;QACrC,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAiB;QACzB,IAAS,CAAA,SAAA,GAAT,SAAS,CAAiB;QAC1B,IAAS,CAAA,SAAA,GAAT,SAAS,CAAiB;QAjB3B,IAAO,CAAA,OAAA,GAAG,qBAAqB,CAAC;QAGzC,IAAW,CAAA,WAAA,GAAkB,IAAI,CAAC;;AAMj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undle index. Do not edit.
3
+ */
4
+ /// <amd-module name="@alimetry/report-viewer-widget" />
5
+ export * from './public-api';
@@ -0,0 +1,26 @@
1
+ import { DoCheck, OnInit, OnDestroy, KeyValueDiffers, IterableDiffers } from '@angular/core';
2
+ import { DeviceData, ServicesConfigService, ServicesService } from '@alimetry/widget-core';
3
+ import * as i0 from "@angular/core";
4
+ export declare class ReportWidgetComponent implements OnInit, DoCheck, OnDestroy {
5
+ private servicesConfig;
6
+ private services;
7
+ private kvDiffers;
8
+ private itDiffers;
9
+ config: any;
10
+ readonly version = "1.0.0-dev.0";
11
+ sessionData?: DeviceData;
12
+ configError: string | null;
13
+ private configDiffer?;
14
+ private ownersDiffer?;
15
+ private readonly ownerId$;
16
+ private readonly refresh$;
17
+ private readonly destroy$;
18
+ constructor(servicesConfig: ServicesConfigService, services: ServicesService, kvDiffers: KeyValueDiffers, itDiffers: IterableDiffers);
19
+ init(): void;
20
+ ngOnInit(): void;
21
+ ngDoCheck(): void;
22
+ ngOnDestroy(): void;
23
+ onRefresh(): void;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReportWidgetComponent, never>;
25
+ static ɵcmp: i0.ɵɵComponentDeclaration<ReportWidgetComponent, "lib-report-widget", never, { "config": "config"; }, {}, never, never, false, never>;
26
+ }
@@ -0,0 +1,9 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./report-widget.component";
3
+ import * as i2 from "@angular/common";
4
+ import * as i3 from "@alimetry/widget-core";
5
+ export declare class ReportWidgetModule {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<ReportWidgetModule, never>;
7
+ static ɵmod: i0.ɵɵNgModuleDeclaration<ReportWidgetModule, [typeof i1.ReportWidgetComponent], [typeof i2.CommonModule, typeof i3.ComponentsModule], [typeof i1.ReportWidgetComponent]>;
8
+ static ɵinj: i0.ɵɵInjectorDeclaration<ReportWidgetModule>;
9
+ }
@@ -0,0 +1 @@
1
+ export declare const REPORT_WIDGET_VERSION = "1.0.0-dev.0";
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "@alimetry/report-viewer-widget",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0-dev.0",
4
+ "peerDependencies": {
5
+ "@angular/common": "^15.1.0",
6
+ "@angular/core": "^15.1.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0",
10
+ "@alimetry/widget-core": "1.0.0-dev.0"
11
+ },
12
+ "sideEffects": false,
13
+ "publishConfig": {
14
+ "access": "public"
15
+ },
16
+ "module": "fesm2015/alimetry-report-viewer-widget.mjs",
17
+ "es2020": "fesm2020/alimetry-report-viewer-widget.mjs",
18
+ "esm2020": "esm2020/alimetry-report-viewer-widget.mjs",
19
+ "fesm2020": "fesm2020/alimetry-report-viewer-widget.mjs",
20
+ "fesm2015": "fesm2015/alimetry-report-viewer-widget.mjs",
21
+ "typings": "index.d.ts",
22
+ "exports": {
23
+ "./package.json": {
24
+ "default": "./package.json"
25
+ },
26
+ ".": {
27
+ "types": "./index.d.ts",
28
+ "esm2020": "./esm2020/alimetry-report-viewer-widget.mjs",
29
+ "es2020": "./fesm2020/alimetry-report-viewer-widget.mjs",
30
+ "es2015": "./fesm2015/alimetry-report-viewer-widget.mjs",
31
+ "node": "./fesm2015/alimetry-report-viewer-widget.mjs",
32
+ "default": "./fesm2020/alimetry-report-viewer-widget.mjs"
33
+ }
34
+ }
6
35
  }
@@ -0,0 +1,3 @@
1
+ export * from './lib/report-widget.component';
2
+ export * from './lib/report-widget.module';
3
+ export * from './lib/version';