ngssm-remote-data 22.1.0 → 22.2.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.
@@ -1,646 +1,1081 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, makeEnvironmentProviders, inject, Injectable, signal, input, effect, Component, EnvironmentInjector, runInInjectionContext, Injector } from '@angular/core';
3
- import { __decorate } from 'tslib';
4
- import update from 'immutability-helper';
5
- import { NgSsmFeatureState, Store, createSignal, NGSSM_STATE_INITIALIZER, provideReducer, provideEffects, provideReducers, Logger } from 'ngssm-store';
6
- import { DatePipe } from '@angular/common';
7
- import * as i2 from '@angular/material/icon';
8
- import { MatIconModule } from '@angular/material/icon';
9
- import * as i2$1 from '@angular/material/button';
10
- import { MatButtonModule } from '@angular/material/button';
11
- import * as i3 from '@angular/material/tooltip';
12
- import { MatTooltipModule } from '@angular/material/tooltip';
13
- import * as i4 from '@angular/material/progress-spinner';
14
- import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
15
- import * as i1 from '@angular/material/dialog';
16
- import { MatDialogModule, MatDialog } from '@angular/material/dialog';
17
- import * as i3$1 from '@angular/material/table';
18
- import { MatTableModule } from '@angular/material/table';
19
- import { NgssmNotifierService } from 'ngssm-toolkit';
20
-
1
+ import * as i0 from "@angular/core";
2
+ import { Component, EnvironmentInjector, Injectable, InjectionToken, Injector, effect, inject, input, makeEnvironmentProviders, runInInjectionContext, signal } from "@angular/core";
3
+ import { __decorate } from "tslib";
4
+ import update from "immutability-helper";
5
+ import { Logger, NGSSM_STATE_INITIALIZER, NgSsmFeatureState, Store, createSignal, provideEffects, provideReducer, provideReducers } from "ngssm-store";
6
+ import { DatePipe } from "@angular/common";
7
+ import * as i1$1 from "@angular/material/icon";
8
+ import { MatIconModule } from "@angular/material/icon";
9
+ import * as i2 from "@angular/material/button";
10
+ import { MatButtonModule } from "@angular/material/button";
11
+ import * as i3$1 from "@angular/material/tooltip";
12
+ import { MatTooltipModule } from "@angular/material/tooltip";
13
+ import * as i4 from "@angular/material/progress-spinner";
14
+ import { MatProgressSpinnerModule } from "@angular/material/progress-spinner";
15
+ import * as i1 from "@angular/material/dialog";
16
+ import { MatDialog, MatDialogModule } from "@angular/material/dialog";
17
+ import * as i3 from "@angular/material/table";
18
+ import { MatTableModule } from "@angular/material/table";
19
+ import { NgssmNotifierService } from "ngssm-toolkit";
21
20
  var DataStatus;
22
- (function (DataStatus) {
23
- DataStatus["none"] = "None";
24
- DataStatus["loading"] = "Loading";
25
- DataStatus["loaded"] = "Loaded";
26
- DataStatus["notFound"] = "NotFound";
27
- DataStatus["error"] = "Error";
21
+ (function(DataStatus) {
22
+ DataStatus["none"] = "None";
23
+ DataStatus["loading"] = "Loading";
24
+ DataStatus["loaded"] = "Loaded";
25
+ DataStatus["notFound"] = "NotFound";
26
+ DataStatus["error"] = "Error";
28
27
  })(DataStatus || (DataStatus = {}));
29
-
30
28
  const getDefaultRemoteData = (defaultValue, defaultStatus = DataStatus.none) => ({
31
- status: defaultStatus,
32
- data: defaultValue
29
+ status: defaultStatus,
30
+ data: defaultValue
33
31
  });
34
-
35
- const NGSSM_REMOTE_DATA_PROVIDER = new InjectionToken('NGSSM_REMOTE_DATA_PROVIDER');
32
+ const NGSSM_REMOTE_DATA_PROVIDER = new InjectionToken("NGSSM_REMOTE_DATA_PROVIDER");
36
33
  const provideRemoteDataProviders = (...providers) => {
37
- return makeEnvironmentProviders(providers.map((provider) => ({ provide: NGSSM_REMOTE_DATA_PROVIDER, useClass: provider, multi: true })));
34
+ return makeEnvironmentProviders(providers.map((provider) => ({
35
+ provide: NGSSM_REMOTE_DATA_PROVIDER,
36
+ useClass: provider,
37
+ multi: true
38
+ })));
38
39
  };
39
40
  const provideRemoteDataFunc = (remoteDataKey, remoteDataLoadingFunc, cacheDurationInSeconds) => {
40
- return makeEnvironmentProviders([
41
- {
42
- provide: NGSSM_REMOTE_DATA_PROVIDER,
43
- useFactory: () => {
44
- const provider = {
45
- remoteDataKey,
46
- cacheDurationInSeconds,
47
- get: remoteDataLoadingFunc
48
- };
49
- return provider;
50
- },
51
- multi: true
52
- }
53
- ]);
41
+ return makeEnvironmentProviders([{
42
+ provide: NGSSM_REMOTE_DATA_PROVIDER,
43
+ useFactory: () => {
44
+ return {
45
+ remoteDataKey,
46
+ cacheDurationInSeconds,
47
+ get: remoteDataLoadingFunc
48
+ };
49
+ },
50
+ multi: true
51
+ }]);
54
52
  };
55
-
56
53
  const selectRemoteDataState = (state) => state[RemoteDataStateSpecification.featureStateKey];
57
- const updateRemoteDataState = (state, command) => update(state, {
58
- [RemoteDataStateSpecification.featureStateKey]: command
59
- });
54
+ const updateRemoteDataState = (state, command) => update(state, { [RemoteDataStateSpecification.featureStateKey]: command });
60
55
  let RemoteDataStateSpecification = class RemoteDataStateSpecification {
61
- static featureStateKey = 'remote-data-state';
62
- static initialState = {};
56
+ static featureStateKey = "remote-data-state";
57
+ static initialState = {};
63
58
  };
64
- RemoteDataStateSpecification = __decorate([
65
- NgSsmFeatureState({
66
- featureStateKey: RemoteDataStateSpecification.featureStateKey,
67
- initialState: RemoteDataStateSpecification.initialState
68
- })
69
- ], RemoteDataStateSpecification);
70
-
59
+ RemoteDataStateSpecification = __decorate([NgSsmFeatureState({
60
+ featureStateKey: RemoteDataStateSpecification.featureStateKey,
61
+ initialState: RemoteDataStateSpecification.initialState
62
+ })], RemoteDataStateSpecification);
71
63
  const selectRemoteData = (state, remoteDataKey) => selectRemoteDataState(state)[remoteDataKey];
72
-
73
64
  var RemoteDataActionType;
74
- (function (RemoteDataActionType) {
75
- RemoteDataActionType["loadRemoteData"] = "[RemoteDataActionType] loadRemoteData";
76
- RemoteDataActionType["registerLoadedRemoteData"] = "[RemoteDataActionType] registerLoadedRemoteData";
77
- RemoteDataActionType["displayCaches"] = "[RemoteDataActionType] displayCaches";
78
- RemoteDataActionType["closeCachesComponent"] = "[RemoteDataActionType] closeCachesComponent";
65
+ (function(RemoteDataActionType) {
66
+ RemoteDataActionType["loadRemoteData"] = "[RemoteDataActionType] loadRemoteData";
67
+ RemoteDataActionType["registerLoadedRemoteData"] = "[RemoteDataActionType] registerLoadedRemoteData";
68
+ RemoteDataActionType["displayCaches"] = "[RemoteDataActionType] displayCaches";
69
+ RemoteDataActionType["closeCachesComponent"] = "[RemoteDataActionType] closeCachesComponent";
79
70
  })(RemoteDataActionType || (RemoteDataActionType = {}));
80
-
81
- class LoadRemoteDataAction {
82
- remoteDataKey;
83
- params;
84
- type = RemoteDataActionType.loadRemoteData;
85
- constructor(remoteDataKey, params) {
86
- this.remoteDataKey = remoteDataKey;
87
- this.params = params;
88
- }
89
- }
90
-
91
- class RegisterLoadedRemoteDataAction {
92
- remoteDataKey;
93
- status;
94
- data;
95
- message;
96
- remoteCallError;
97
- type = RemoteDataActionType.registerLoadedRemoteData;
98
- constructor(remoteDataKey, status, data, message, remoteCallError) {
99
- this.remoteDataKey = remoteDataKey;
100
- this.status = status;
101
- this.data = data;
102
- this.message = message;
103
- this.remoteCallError = remoteCallError;
104
- }
105
- }
106
-
107
- class RemoteDataLoadingGuard {
108
- store = inject(Store);
109
- canActivate(route) {
110
- const parameters = route.data;
111
- (parameters?.remoteDataItems ?? []).forEach((item) => {
112
- this.store.dispatchAction(new LoadRemoteDataAction(item.remoteDataKey, { forceReload: item.forceReload === true }));
113
- });
114
- return true;
115
- }
116
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataLoadingGuard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
117
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataLoadingGuard, providedIn: 'root' });
118
- }
119
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataLoadingGuard, decorators: [{
120
- type: Injectable,
121
- args: [{
122
- providedIn: 'root'
123
- }]
124
- }] });
71
+ var LoadRemoteDataAction = class {
72
+ remoteDataKey;
73
+ params;
74
+ type = RemoteDataActionType.loadRemoteData;
75
+ constructor(remoteDataKey, params) {
76
+ this.remoteDataKey = remoteDataKey;
77
+ this.params = params;
78
+ }
79
+ };
80
+ var RegisterLoadedRemoteDataAction = class {
81
+ remoteDataKey;
82
+ status;
83
+ data;
84
+ message;
85
+ remoteCallError;
86
+ type = RemoteDataActionType.registerLoadedRemoteData;
87
+ constructor(remoteDataKey, status, data, message, remoteCallError) {
88
+ this.remoteDataKey = remoteDataKey;
89
+ this.status = status;
90
+ this.data = data;
91
+ this.message = message;
92
+ this.remoteCallError = remoteCallError;
93
+ }
94
+ };
95
+ var RemoteDataLoadingGuard = class RemoteDataLoadingGuard {
96
+ store = inject(Store);
97
+ canActivate(route) {
98
+ (route.data?.remoteDataItems ?? []).forEach((item) => {
99
+ this.store.dispatchAction(new LoadRemoteDataAction(item.remoteDataKey, { forceReload: item.forceReload === true }));
100
+ });
101
+ return true;
102
+ }
103
+ static ɵfac = i0.ɵɵngDeclareFactory({
104
+ minVersion: "12.0.0",
105
+ version: "22.2.0",
106
+ ngImport: i0,
107
+ type: RemoteDataLoadingGuard,
108
+ deps: [],
109
+ target: i0.ɵɵFactoryTarget.Injectable
110
+ });
111
+ static ɵprov = i0.ɵɵngDeclareInjectable({
112
+ minVersion: "12.0.0",
113
+ version: "22.2.0",
114
+ ngImport: i0,
115
+ type: RemoteDataLoadingGuard,
116
+ providedIn: "root"
117
+ });
118
+ };
119
+ i0.ɵɵngDeclareClassMetadata({
120
+ minVersion: "12.0.0",
121
+ version: "22.2.0",
122
+ ngImport: i0,
123
+ type: RemoteDataLoadingGuard,
124
+ decorators: [{
125
+ type: Injectable,
126
+ args: [{ providedIn: "root" }]
127
+ }]
128
+ });
125
129
  const ngssmReloadRemoteData = (remoteDataKey, params = { forceReload: true }) => {
126
- return () => {
127
- inject(Store).dispatchAction(new LoadRemoteDataAction(remoteDataKey, params));
128
- return true;
129
- };
130
+ return () => {
131
+ inject(Store).dispatchAction(new LoadRemoteDataAction(remoteDataKey, params));
132
+ return true;
133
+ };
130
134
  };
131
-
132
- const datePipe = new DatePipe('en-US');
133
- class NgssmRemoteDataReloadButtonComponent {
134
- tooltipMessage = signal('', /* @ts-ignore */
135
- ...(ngDevMode ? [{ debugName: "tooltipMessage" }] : /* istanbul ignore next */ []));
136
- disabled = signal(true, /* @ts-ignore */
137
- ...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
138
- inLoadingStatus = signal(false, /* @ts-ignore */
139
- ...(ngDevMode ? [{ debugName: "inLoadingStatus" }] : /* istanbul ignore next */ []));
140
- actionTypes = input([], /* @ts-ignore */
141
- ...(ngDevMode ? [{ debugName: "actionTypes" }] : /* istanbul ignore next */ []));
142
- remoteDataKeys = input([], /* @ts-ignore */
143
- ...(ngDevMode ? [{ debugName: "remoteDataKeys" }] : /* istanbul ignore next */ []));
144
- store = inject(Store);
145
- remoteDataState = createSignal((state) => selectRemoteDataState(state));
146
- constructor() {
147
- effect(() => {
148
- const remoteDataState = this.remoteDataState();
149
- const keys = this.remoteDataKeys();
150
- this.inLoadingStatus.set(keys.findIndex((v) => remoteDataState[v]?.status === DataStatus.loading) !== -1);
151
- this.disabled.set(this.inLoadingStatus() === true || keys.findIndex((v) => !!remoteDataState[v]) === -1);
152
- let timestamp;
153
- keys.forEach((key) => {
154
- const keyTimestamp = remoteDataState[key]?.timestamp;
155
- if (keyTimestamp) {
156
- if (!timestamp || timestamp.getTime() > keyTimestamp.getTime()) {
157
- timestamp = keyTimestamp;
158
- }
159
- }
160
- });
161
- let tooltiMessage = 'Reload data.';
162
- if (timestamp) {
163
- tooltiMessage = [tooltiMessage, `Loaded at ${datePipe.transform(timestamp, 'mediumTime')}`].join('\n');
164
- }
165
- this.tooltipMessage.set(tooltiMessage);
166
- });
167
- }
168
- reload() {
169
- this.remoteDataKeys().forEach((key) => this.store.dispatchAction(new LoadRemoteDataAction(key, { forceReload: true, keepStoredGetterParams: true })));
170
- this.actionTypes().forEach((type) => this.store.dispatchActionType(type));
171
- }
172
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmRemoteDataReloadButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
173
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: NgssmRemoteDataReloadButtonComponent, isStandalone: true, selector: "ngssm-remote-data-reload-button", inputs: { actionTypes: { classPropertyName: "actionTypes", publicName: "actionTypes", isSignal: true, isRequired: false, transformFunction: null }, remoteDataKeys: { classPropertyName: "remoteDataKeys", publicName: "remoteDataKeys", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0, template: "<button\n mat-icon-button\n color=\"primary\"\n (click)=\"reload()\"\n [matTooltip]=\"tooltipMessage()\"\n [disabled]=\"disabled() === true\"\n id=\"reloadButton\">\n @if (inLoadingStatus()) {\n <mat-spinner [diameter]=\"24\" id=\"loadingSpinner\"></mat-spinner>\n } @else {\n <mat-icon class=\"fa-solid fa-rotate-right\"></mat-icon>\n }\n</button>\n", dependencies: [{ kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] });
174
- }
175
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmRemoteDataReloadButtonComponent, decorators: [{
176
- type: Component,
177
- args: [{ selector: 'ngssm-remote-data-reload-button', imports: [MatIconModule, MatButtonModule, MatTooltipModule, MatProgressSpinnerModule], template: "<button\n mat-icon-button\n color=\"primary\"\n (click)=\"reload()\"\n [matTooltip]=\"tooltipMessage()\"\n [disabled]=\"disabled() === true\"\n id=\"reloadButton\">\n @if (inLoadingStatus()) {\n <mat-spinner [diameter]=\"24\" id=\"loadingSpinner\"></mat-spinner>\n } @else {\n <mat-icon class=\"fa-solid fa-rotate-right\"></mat-icon>\n }\n</button>\n" }]
178
- }], ctorParameters: () => [], propDecorators: { actionTypes: [{ type: i0.Input, args: [{ isSignal: true, alias: "actionTypes", required: false }] }], remoteDataKeys: [{ type: i0.Input, args: [{ isSignal: true, alias: "remoteDataKeys", required: false }] }] } });
179
-
180
- class NgssmCachesDisplayButtonComponent {
181
- store = inject(Store);
182
- displayCaches() {
183
- this.store.dispatchActionType(RemoteDataActionType.displayCaches);
184
- }
185
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmCachesDisplayButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
186
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.1.1", type: NgssmCachesDisplayButtonComponent, isStandalone: true, selector: "ngssm-caches-display-button", ngImport: i0, template: "<button mat-icon-button matTooltip=\"Display caches\" (click)=\"displayCaches()\">\n <mat-icon class=\"fa-solid fa-cloud-bolt\"></mat-icon>\n</button>\n", dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i3.MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }] });
187
- }
188
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmCachesDisplayButtonComponent, decorators: [{
189
- type: Component,
190
- args: [{ selector: 'ngssm-caches-display-button', imports: [MatButtonModule, MatIconModule, MatTooltipModule], template: "<button mat-icon-button matTooltip=\"Display caches\" (click)=\"displayCaches()\">\n <mat-icon class=\"fa-solid fa-cloud-bolt\"></mat-icon>\n</button>\n" }]
191
- }] });
192
-
193
- class NgssmCachesComponent {
194
- caches = createSignal((state) => {
195
- const remoteDataState = selectRemoteDataState(state);
196
- return Object.keys(remoteDataState).map((key) => ({
197
- key,
198
- value: remoteDataState[key]
199
- }));
200
- });
201
- dataStatus = DataStatus;
202
- store = inject(Store);
203
- close() {
204
- this.store.dispatchActionType(RemoteDataActionType.closeCachesComponent);
205
- }
206
- reloadCache(cache) {
207
- this.store.dispatchAction(new LoadRemoteDataAction(cache.key, { forceReload: true, keepStoredGetterParams: true }));
208
- }
209
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmCachesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
210
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: NgssmCachesComponent, isStandalone: true, selector: "ngssm-caches", ngImport: i0, template: "<h1 mat-dialog-title>List of caches</h1>\n<mat-dialog-content class=\"flex-column-stretch fxFlex\">\n <mat-table [dataSource]=\"caches()\" class=\"fxFlex\">\n <ng-container matColumnDef=\"actions\">\n <mat-header-cell *matHeaderCellDef> </mat-header-cell>\n <mat-cell *matCellDef=\"let element\">\n <button\n mat-icon-button\n [disabled]=\"element.value.status === dataStatus.loading\"\n (click)=\"reloadCache(element)\"\n color=\"primary\"\n id=\"reload_{{ element.key }}\">\n <mat-icon class=\"fa-solid fa-rotate-right\"></mat-icon>\n </button>\n </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"key\">\n <mat-header-cell *matHeaderCellDef> Key </mat-header-cell>\n <mat-cell *matCellDef=\"let element\"> {{ element.key }} </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"status\">\n <mat-header-cell *matHeaderCellDef> Status </mat-header-cell>\n <mat-cell *matCellDef=\"let element\">\n @switch (element.value.status) {\n @case (dataStatus.none) {\n <mat-icon class=\"fa-solid fa-minus\"></mat-icon>\n }\n @case (dataStatus.loaded) {\n <mat-icon class=\"fa-solid fa-check\" color=\"primary\"></mat-icon>\n }\n @case (dataStatus.error) {\n <mat-icon class=\"fa-solid fa-xmark\" color=\"warn\"></mat-icon>\n }\n @case (dataStatus.notFound) {\n <mat-icon class=\"fa-solid fa-xmark\" color=\"warn\"></mat-icon>\n }\n @case (dataStatus.loading) {\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n }\n }\n </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"timestamp\">\n <mat-header-cell *matHeaderCellDef> Timestamp </mat-header-cell>\n <mat-cell *matCellDef=\"let element\"> {{ element.value.timestamp }} </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"['actions', 'status', 'key', 'timestamp']; sticky: true\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: ['actions', 'status', 'key', 'timestamp']\"></mat-row>\n </mat-table>\n</mat-dialog-content>\n<mat-dialog-actions class=\"flex-row-center\">\n <span class=\"fxFlex\"></span>\n <button mat-button (click)=\"close()\" id=\"closeButton\">Close</button>\n</mat-dialog-actions>\n", styles: [":host{display:flex;flex-direction:column;min-width:800px;max-width:80vw;min-height:500px;max-height:80vh}:host .mat-column-actions{min-width:50px;max-width:50px;padding-left:0!important}:host .mat-column-status{min-width:60px;max-width:60px}\n"], dependencies: [{ kind: "ngmodule", type: MatDialogModule }, { kind: "directive", type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "directive", type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatButton, selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ", inputs: ["matButton"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatTableModule }, { kind: "component", type: i3$1.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i3$1.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i3$1.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i3$1.MatColumnDef, selector: "[matColumnDef]", inputs: ["matColumnDef"] }, { kind: "directive", type: i3$1.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i3$1.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i3$1.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i3$1.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i3$1.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i3$1.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatProgressSpinnerModule }, { kind: "component", type: i4.MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }] });
211
- }
212
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmCachesComponent, decorators: [{
213
- type: Component,
214
- args: [{ selector: 'ngssm-caches', imports: [MatDialogModule, MatButtonModule, MatTableModule, MatIconModule, MatProgressSpinnerModule], template: "<h1 mat-dialog-title>List of caches</h1>\n<mat-dialog-content class=\"flex-column-stretch fxFlex\">\n <mat-table [dataSource]=\"caches()\" class=\"fxFlex\">\n <ng-container matColumnDef=\"actions\">\n <mat-header-cell *matHeaderCellDef> </mat-header-cell>\n <mat-cell *matCellDef=\"let element\">\n <button\n mat-icon-button\n [disabled]=\"element.value.status === dataStatus.loading\"\n (click)=\"reloadCache(element)\"\n color=\"primary\"\n id=\"reload_{{ element.key }}\">\n <mat-icon class=\"fa-solid fa-rotate-right\"></mat-icon>\n </button>\n </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"key\">\n <mat-header-cell *matHeaderCellDef> Key </mat-header-cell>\n <mat-cell *matCellDef=\"let element\"> {{ element.key }} </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"status\">\n <mat-header-cell *matHeaderCellDef> Status </mat-header-cell>\n <mat-cell *matCellDef=\"let element\">\n @switch (element.value.status) {\n @case (dataStatus.none) {\n <mat-icon class=\"fa-solid fa-minus\"></mat-icon>\n }\n @case (dataStatus.loaded) {\n <mat-icon class=\"fa-solid fa-check\" color=\"primary\"></mat-icon>\n }\n @case (dataStatus.error) {\n <mat-icon class=\"fa-solid fa-xmark\" color=\"warn\"></mat-icon>\n }\n @case (dataStatus.notFound) {\n <mat-icon class=\"fa-solid fa-xmark\" color=\"warn\"></mat-icon>\n }\n @case (dataStatus.loading) {\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n }\n }\n </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"timestamp\">\n <mat-header-cell *matHeaderCellDef> Timestamp </mat-header-cell>\n <mat-cell *matCellDef=\"let element\"> {{ element.value.timestamp }} </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"['actions', 'status', 'key', 'timestamp']; sticky: true\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: ['actions', 'status', 'key', 'timestamp']\"></mat-row>\n </mat-table>\n</mat-dialog-content>\n<mat-dialog-actions class=\"flex-row-center\">\n <span class=\"fxFlex\"></span>\n <button mat-button (click)=\"close()\" id=\"closeButton\">Close</button>\n</mat-dialog-actions>\n", styles: [":host{display:flex;flex-direction:column;min-width:800px;max-width:80vw;min-height:500px;max-height:80vh}:host .mat-column-actions{min-width:50px;max-width:50px;padding-left:0!important}:host .mat-column-status{min-width:60px;max-width:60px}\n"] }]
215
- }] });
216
-
217
- class CachesDisplayEffect {
218
- processedActions = [RemoteDataActionType.displayCaches, RemoteDataActionType.closeCachesComponent];
219
- matDialog = inject(MatDialog);
220
- dialog;
221
- processAction(actiondispatcher, state, action) {
222
- switch (action.type) {
223
- case RemoteDataActionType.displayCaches: {
224
- this.dialog = this.matDialog.open(NgssmCachesComponent, {
225
- disableClose: true
226
- });
227
- break;
228
- }
229
- case RemoteDataActionType.closeCachesComponent: {
230
- this.dialog?.close();
231
- this.dialog = undefined;
232
- break;
233
- }
234
- }
235
- }
236
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: CachesDisplayEffect, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
237
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: CachesDisplayEffect });
238
- }
239
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: CachesDisplayEffect, decorators: [{
240
- type: Injectable
241
- }] });
242
-
243
- class RemoteDataLoadingEffect {
244
- processedActions = [RemoteDataActionType.loadRemoteData];
245
- remoteDataProviders = inject(NGSSM_REMOTE_DATA_PROVIDER, {
246
- optional: true
247
- });
248
- notifierService = inject(NgssmNotifierService);
249
- injector = inject(EnvironmentInjector);
250
- remoteDataProvidersPerKey;
251
- constructor() {
252
- this.remoteDataProvidersPerKey = new Map((this.remoteDataProviders ?? []).map((r) => [r.remoteDataKey, r]));
253
- }
254
- processAction(actiondispatcher, state, action) {
255
- const loadRemoteDataAction = action;
256
- const item = selectRemoteDataState(state)[loadRemoteDataAction.remoteDataKey];
257
- const provider = this.remoteDataProvidersPerKey.get(loadRemoteDataAction.remoteDataKey);
258
- if (!item || !provider || item.status !== DataStatus.loading) {
259
- return;
260
- }
261
- runInInjectionContext(this.injector, () => {
262
- provider.get(item.getterParams).subscribe({
263
- next: (value) => {
264
- actiondispatcher.dispatchAction(new RegisterLoadedRemoteDataAction(loadRemoteDataAction.remoteDataKey, DataStatus.loaded, value));
265
- if (item.getterParams?.callbackAction) {
266
- actiondispatcher.dispatchActionType(item.getterParams.callbackAction);
267
- }
268
- },
269
- error: (error) => {
270
- console.error(`Unable to load data for '${loadRemoteDataAction.remoteDataKey}'`, error);
271
- if (item.getterParams?.errorNotificationMessage) {
272
- this.notifierService.notifyError(item.getterParams.errorNotificationMessage(error?.error));
273
- }
274
- actiondispatcher.dispatchAction(new RegisterLoadedRemoteDataAction(loadRemoteDataAction.remoteDataKey, DataStatus.error, undefined, error?.error));
275
- }
276
- });
277
- });
278
- }
279
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataLoadingEffect, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
280
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataLoadingEffect });
281
- }
282
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataLoadingEffect, decorators: [{
283
- type: Injectable
284
- }], ctorParameters: () => [] });
285
-
286
- class RemoteDataReducer {
287
- processedActions = [RemoteDataActionType.loadRemoteData, RemoteDataActionType.registerLoadedRemoteData];
288
- remoteDataProviders = inject(NGSSM_REMOTE_DATA_PROVIDER, {
289
- optional: true
290
- });
291
- remoteDataProvidersPerKey;
292
- constructor() {
293
- this.remoteDataProvidersPerKey = new Map((this.remoteDataProviders ?? []).map((r) => [r.remoteDataKey, r]));
294
- }
295
- updateState(state, action) {
296
- switch (action.type) {
297
- case RemoteDataActionType.loadRemoteData: {
298
- const loadRemoteDataAction = action;
299
- const item = selectRemoteDataState(state)[loadRemoteDataAction.remoteDataKey];
300
- if (!item) {
301
- return state;
302
- }
303
- const provider = this.remoteDataProvidersPerKey.get(loadRemoteDataAction.remoteDataKey);
304
- if (!provider) {
305
- return state;
306
- }
307
- if (!provider.cacheDurationInSeconds ||
308
- loadRemoteDataAction.params?.forceReload === true ||
309
- item.status === DataStatus.none ||
310
- item.status === DataStatus.error ||
311
- item.status === DataStatus.notFound ||
312
- !item.timestamp ||
313
- new Date().getTime() - item.timestamp.getTime() >= 1000 * provider.cacheDurationInSeconds) {
314
- return updateRemoteDataState(state, {
315
- [loadRemoteDataAction.remoteDataKey]: {
316
- status: { $set: DataStatus.loading },
317
- getterParams: {
318
- $apply: (value) => {
319
- if (!loadRemoteDataAction.params || loadRemoteDataAction.params.keepStoredGetterParams !== true) {
320
- return loadRemoteDataAction.params?.params;
321
- }
322
- return value;
323
- }
324
- }
325
- }
326
- });
327
- }
328
- break;
329
- }
330
- case RemoteDataActionType.registerLoadedRemoteData: {
331
- const registerLoadedRemoteDataAction = action;
332
- if (this.remoteDataProvidersPerKey.has(registerLoadedRemoteDataAction.remoteDataKey)) {
333
- return updateRemoteDataState(state, {
334
- [registerLoadedRemoteDataAction.remoteDataKey]: {
335
- status: { $set: registerLoadedRemoteDataAction.status },
336
- data: { $set: registerLoadedRemoteDataAction.data },
337
- timestamp: { $set: new Date() },
338
- message: { $set: registerLoadedRemoteDataAction.message },
339
- error: { $set: registerLoadedRemoteDataAction.remoteCallError }
340
- }
341
- });
342
- }
343
- break;
344
- }
345
- }
346
- return state;
347
- }
348
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
349
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataReducer });
350
- }
351
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataReducer, decorators: [{
352
- type: Injectable
353
- }], ctorParameters: () => [] });
354
-
355
- class RemoteDataStateInitializer {
356
- remoteDataProviders = inject(NGSSM_REMOTE_DATA_PROVIDER, {
357
- optional: true
358
- });
359
- initializeState(state) {
360
- const tempState = state;
361
- return (this.remoteDataProviders ?? []).reduce((s, provider) => updateRemoteDataState(s, { [provider.remoteDataKey]: { $set: { status: DataStatus.none } } }), tempState);
362
- }
363
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataStateInitializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
364
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataStateInitializer });
365
- }
366
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteDataStateInitializer, decorators: [{
367
- type: Injectable
368
- }] });
369
-
135
+ const datePipe = new DatePipe("en-US");
136
+ var NgssmRemoteDataReloadButtonComponent = class NgssmRemoteDataReloadButtonComponent {
137
+ tooltipMessage = signal("", ...ngDevMode ? [{ debugName: "tooltipMessage" }] : /* istanbul ignore next */ []);
138
+ disabled = signal(true, ...ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []);
139
+ inLoadingStatus = signal(false, ...ngDevMode ? [{ debugName: "inLoadingStatus" }] : /* istanbul ignore next */ []);
140
+ actionTypes = input([], ...ngDevMode ? [{ debugName: "actionTypes" }] : /* istanbul ignore next */ []);
141
+ remoteDataKeys = input([], ...ngDevMode ? [{ debugName: "remoteDataKeys" }] : /* istanbul ignore next */ []);
142
+ store = inject(Store);
143
+ remoteDataState = createSignal((state) => selectRemoteDataState(state));
144
+ constructor() {
145
+ effect(() => {
146
+ const remoteDataState = this.remoteDataState();
147
+ const keys = this.remoteDataKeys();
148
+ this.inLoadingStatus.set(keys.findIndex((v) => remoteDataState[v]?.status === DataStatus.loading) !== -1);
149
+ this.disabled.set(this.inLoadingStatus() === true || keys.findIndex((v) => !!remoteDataState[v]) === -1);
150
+ let timestamp;
151
+ keys.forEach((key) => {
152
+ const keyTimestamp = remoteDataState[key]?.timestamp;
153
+ if (keyTimestamp) {
154
+ if (!timestamp || timestamp.getTime() > keyTimestamp.getTime()) timestamp = keyTimestamp;
155
+ }
156
+ });
157
+ let tooltiMessage = "Reload data.";
158
+ if (timestamp) tooltiMessage = [tooltiMessage, `Loaded at ${datePipe.transform(timestamp, "mediumTime")}`].join("\n");
159
+ this.tooltipMessage.set(tooltiMessage);
160
+ });
161
+ }
162
+ reload() {
163
+ this.remoteDataKeys().forEach((key) => this.store.dispatchAction(new LoadRemoteDataAction(key, {
164
+ forceReload: true,
165
+ keepStoredGetterParams: true
166
+ })));
167
+ this.actionTypes().forEach((type) => this.store.dispatchActionType(type));
168
+ }
169
+ static ɵfac = i0.ɵɵngDeclareFactory({
170
+ minVersion: "12.0.0",
171
+ version: "22.2.0",
172
+ ngImport: i0,
173
+ type: NgssmRemoteDataReloadButtonComponent,
174
+ deps: [],
175
+ target: i0.ɵɵFactoryTarget.Component
176
+ });
177
+ static ɵcmp = i0.ɵɵngDeclareComponent({
178
+ minVersion: "17.0.0",
179
+ version: "22.2.0",
180
+ type: NgssmRemoteDataReloadButtonComponent,
181
+ isStandalone: true,
182
+ selector: "ngssm-remote-data-reload-button",
183
+ inputs: {
184
+ actionTypes: {
185
+ classPropertyName: "actionTypes",
186
+ publicName: "actionTypes",
187
+ isSignal: true,
188
+ isRequired: false,
189
+ transformFunction: null
190
+ },
191
+ remoteDataKeys: {
192
+ classPropertyName: "remoteDataKeys",
193
+ publicName: "remoteDataKeys",
194
+ isSignal: true,
195
+ isRequired: false,
196
+ transformFunction: null
197
+ }
198
+ },
199
+ ngImport: i0,
200
+ template: "<button\n mat-icon-button\n color=\"primary\"\n (click)=\"reload()\"\n [matTooltip]=\"tooltipMessage()\"\n [disabled]=\"disabled() === true\"\n id=\"reloadButton\">\n @if (inLoadingStatus()) {\n <mat-spinner [diameter]=\"24\" id=\"loadingSpinner\"></mat-spinner>\n } @else {\n <mat-icon class=\"fa-solid fa-rotate-right\"></mat-icon>\n }\n</button>\n",
201
+ dependencies: [
202
+ {
203
+ kind: "ngmodule",
204
+ type: MatIconModule
205
+ },
206
+ {
207
+ kind: "component",
208
+ type: i1$1.MatIcon,
209
+ selector: "mat-icon",
210
+ inputs: [
211
+ "color",
212
+ "inline",
213
+ "svgIcon",
214
+ "fontSet",
215
+ "fontIcon"
216
+ ],
217
+ exportAs: ["matIcon"]
218
+ },
219
+ {
220
+ kind: "ngmodule",
221
+ type: MatButtonModule
222
+ },
223
+ {
224
+ kind: "component",
225
+ type: i2.MatIconButton,
226
+ selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
227
+ exportAs: ["matButton", "matAnchor"]
228
+ },
229
+ {
230
+ kind: "ngmodule",
231
+ type: MatTooltipModule
232
+ },
233
+ {
234
+ kind: "directive",
235
+ type: i3$1.MatTooltip,
236
+ selector: "[matTooltip]",
237
+ inputs: [
238
+ "matTooltipPosition",
239
+ "matTooltipPositionAtOrigin",
240
+ "matTooltipDisabled",
241
+ "matTooltipShowDelay",
242
+ "matTooltipHideDelay",
243
+ "matTooltipTouchGestures",
244
+ "matTooltip",
245
+ "matTooltipClass"
246
+ ],
247
+ exportAs: ["matTooltip"]
248
+ },
249
+ {
250
+ kind: "ngmodule",
251
+ type: MatProgressSpinnerModule
252
+ },
253
+ {
254
+ kind: "component",
255
+ type: i4.MatProgressSpinner,
256
+ selector: "mat-progress-spinner, mat-spinner",
257
+ inputs: [
258
+ "color",
259
+ "mode",
260
+ "value",
261
+ "diameter",
262
+ "strokeWidth"
263
+ ],
264
+ exportAs: ["matProgressSpinner"]
265
+ }
266
+ ]
267
+ });
268
+ };
269
+ i0.ɵɵngDeclareClassMetadata({
270
+ minVersion: "12.0.0",
271
+ version: "22.2.0",
272
+ ngImport: i0,
273
+ type: NgssmRemoteDataReloadButtonComponent,
274
+ decorators: [{
275
+ type: Component,
276
+ args: [{
277
+ selector: "ngssm-remote-data-reload-button",
278
+ imports: [
279
+ MatIconModule,
280
+ MatButtonModule,
281
+ MatTooltipModule,
282
+ MatProgressSpinnerModule
283
+ ],
284
+ template: "<button\n mat-icon-button\n color=\"primary\"\n (click)=\"reload()\"\n [matTooltip]=\"tooltipMessage()\"\n [disabled]=\"disabled() === true\"\n id=\"reloadButton\">\n @if (inLoadingStatus()) {\n <mat-spinner [diameter]=\"24\" id=\"loadingSpinner\"></mat-spinner>\n } @else {\n <mat-icon class=\"fa-solid fa-rotate-right\"></mat-icon>\n }\n</button>\n"
285
+ }]
286
+ }],
287
+ ctorParameters: () => [],
288
+ propDecorators: {
289
+ actionTypes: [{
290
+ type: i0.Input,
291
+ args: [{
292
+ isSignal: true,
293
+ alias: "actionTypes",
294
+ required: false
295
+ }]
296
+ }],
297
+ remoteDataKeys: [{
298
+ type: i0.Input,
299
+ args: [{
300
+ isSignal: true,
301
+ alias: "remoteDataKeys",
302
+ required: false
303
+ }]
304
+ }]
305
+ }
306
+ });
307
+ var NgssmCachesDisplayButtonComponent = class NgssmCachesDisplayButtonComponent {
308
+ store = inject(Store);
309
+ displayCaches() {
310
+ this.store.dispatchActionType(RemoteDataActionType.displayCaches);
311
+ }
312
+ static ɵfac = i0.ɵɵngDeclareFactory({
313
+ minVersion: "12.0.0",
314
+ version: "22.2.0",
315
+ ngImport: i0,
316
+ type: NgssmCachesDisplayButtonComponent,
317
+ deps: [],
318
+ target: i0.ɵɵFactoryTarget.Component
319
+ });
320
+ static ɵcmp = i0.ɵɵngDeclareComponent({
321
+ minVersion: "14.0.0",
322
+ version: "22.2.0",
323
+ type: NgssmCachesDisplayButtonComponent,
324
+ isStandalone: true,
325
+ selector: "ngssm-caches-display-button",
326
+ ngImport: i0,
327
+ template: "<button mat-icon-button matTooltip=\"Display caches\" (click)=\"displayCaches()\">\n <mat-icon class=\"fa-solid fa-cloud-bolt\"></mat-icon>\n</button>\n",
328
+ dependencies: [
329
+ {
330
+ kind: "ngmodule",
331
+ type: MatButtonModule
332
+ },
333
+ {
334
+ kind: "component",
335
+ type: i2.MatIconButton,
336
+ selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
337
+ exportAs: ["matButton", "matAnchor"]
338
+ },
339
+ {
340
+ kind: "ngmodule",
341
+ type: MatIconModule
342
+ },
343
+ {
344
+ kind: "component",
345
+ type: i1$1.MatIcon,
346
+ selector: "mat-icon",
347
+ inputs: [
348
+ "color",
349
+ "inline",
350
+ "svgIcon",
351
+ "fontSet",
352
+ "fontIcon"
353
+ ],
354
+ exportAs: ["matIcon"]
355
+ },
356
+ {
357
+ kind: "ngmodule",
358
+ type: MatTooltipModule
359
+ },
360
+ {
361
+ kind: "directive",
362
+ type: i3$1.MatTooltip,
363
+ selector: "[matTooltip]",
364
+ inputs: [
365
+ "matTooltipPosition",
366
+ "matTooltipPositionAtOrigin",
367
+ "matTooltipDisabled",
368
+ "matTooltipShowDelay",
369
+ "matTooltipHideDelay",
370
+ "matTooltipTouchGestures",
371
+ "matTooltip",
372
+ "matTooltipClass"
373
+ ],
374
+ exportAs: ["matTooltip"]
375
+ }
376
+ ]
377
+ });
378
+ };
379
+ i0.ɵɵngDeclareClassMetadata({
380
+ minVersion: "12.0.0",
381
+ version: "22.2.0",
382
+ ngImport: i0,
383
+ type: NgssmCachesDisplayButtonComponent,
384
+ decorators: [{
385
+ type: Component,
386
+ args: [{
387
+ selector: "ngssm-caches-display-button",
388
+ imports: [
389
+ MatButtonModule,
390
+ MatIconModule,
391
+ MatTooltipModule
392
+ ],
393
+ template: "<button mat-icon-button matTooltip=\"Display caches\" (click)=\"displayCaches()\">\n <mat-icon class=\"fa-solid fa-cloud-bolt\"></mat-icon>\n</button>\n"
394
+ }]
395
+ }]
396
+ });
397
+ var NgssmCachesComponent = class NgssmCachesComponent {
398
+ caches = createSignal((state) => {
399
+ const remoteDataState = selectRemoteDataState(state);
400
+ return Object.keys(remoteDataState).map((key) => ({
401
+ key,
402
+ value: remoteDataState[key]
403
+ }));
404
+ });
405
+ dataStatus = DataStatus;
406
+ store = inject(Store);
407
+ close() {
408
+ this.store.dispatchActionType(RemoteDataActionType.closeCachesComponent);
409
+ }
410
+ reloadCache(cache) {
411
+ this.store.dispatchAction(new LoadRemoteDataAction(cache.key, {
412
+ forceReload: true,
413
+ keepStoredGetterParams: true
414
+ }));
415
+ }
416
+ static ɵfac = i0.ɵɵngDeclareFactory({
417
+ minVersion: "12.0.0",
418
+ version: "22.2.0",
419
+ ngImport: i0,
420
+ type: NgssmCachesComponent,
421
+ deps: [],
422
+ target: i0.ɵɵFactoryTarget.Component
423
+ });
424
+ static ɵcmp = i0.ɵɵngDeclareComponent({
425
+ minVersion: "17.0.0",
426
+ version: "22.2.0",
427
+ type: NgssmCachesComponent,
428
+ isStandalone: true,
429
+ selector: "ngssm-caches",
430
+ ngImport: i0,
431
+ template: "<h1 mat-dialog-title>List of caches</h1>\n<mat-dialog-content class=\"flex-column-stretch fxFlex\">\n <mat-table [dataSource]=\"caches()\" class=\"fxFlex\">\n <ng-container matColumnDef=\"actions\">\n <mat-header-cell *matHeaderCellDef> </mat-header-cell>\n <mat-cell *matCellDef=\"let element\">\n <button\n mat-icon-button\n [disabled]=\"element.value.status === dataStatus.loading\"\n (click)=\"reloadCache(element)\"\n color=\"primary\"\n id=\"reload_{{ element.key }}\">\n <mat-icon class=\"fa-solid fa-rotate-right\"></mat-icon>\n </button>\n </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"key\">\n <mat-header-cell *matHeaderCellDef> Key </mat-header-cell>\n <mat-cell *matCellDef=\"let element\"> {{ element.key }} </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"status\">\n <mat-header-cell *matHeaderCellDef> Status </mat-header-cell>\n <mat-cell *matCellDef=\"let element\">\n @switch (element.value.status) {\n @case (dataStatus.none) {\n <mat-icon class=\"fa-solid fa-minus\"></mat-icon>\n }\n @case (dataStatus.loaded) {\n <mat-icon class=\"fa-solid fa-check\" color=\"primary\"></mat-icon>\n }\n @case (dataStatus.error) {\n <mat-icon class=\"fa-solid fa-xmark\" color=\"warn\"></mat-icon>\n }\n @case (dataStatus.notFound) {\n <mat-icon class=\"fa-solid fa-xmark\" color=\"warn\"></mat-icon>\n }\n @case (dataStatus.loading) {\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n }\n }\n </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"timestamp\">\n <mat-header-cell *matHeaderCellDef> Timestamp </mat-header-cell>\n <mat-cell *matCellDef=\"let element\"> {{ element.value.timestamp }} </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"['actions', 'status', 'key', 'timestamp']; sticky: true\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: ['actions', 'status', 'key', 'timestamp']\"></mat-row>\n </mat-table>\n</mat-dialog-content>\n<mat-dialog-actions class=\"flex-row-center\">\n <span class=\"fxFlex\"></span>\n <button mat-button (click)=\"close()\" id=\"closeButton\">Close</button>\n</mat-dialog-actions>\n",
432
+ styles: [":host{display:flex;flex-direction:column;min-width:800px;max-width:80vw;min-height:500px;max-height:80vh}:host .mat-column-actions{min-width:50px;max-width:50px;padding-left:0!important}:host .mat-column-status{min-width:60px;max-width:60px}\n"],
433
+ dependencies: [
434
+ {
435
+ kind: "ngmodule",
436
+ type: MatDialogModule
437
+ },
438
+ {
439
+ kind: "directive",
440
+ type: i1.MatDialogTitle,
441
+ selector: "[mat-dialog-title], [matDialogTitle]",
442
+ inputs: ["id"],
443
+ exportAs: ["matDialogTitle"]
444
+ },
445
+ {
446
+ kind: "directive",
447
+ type: i1.MatDialogActions,
448
+ selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",
449
+ inputs: ["align"]
450
+ },
451
+ {
452
+ kind: "directive",
453
+ type: i1.MatDialogContent,
454
+ selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]"
455
+ },
456
+ {
457
+ kind: "ngmodule",
458
+ type: MatButtonModule
459
+ },
460
+ {
461
+ kind: "component",
462
+ type: i2.MatButton,
463
+ selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
464
+ inputs: ["matButton"],
465
+ exportAs: ["matButton", "matAnchor"]
466
+ },
467
+ {
468
+ kind: "component",
469
+ type: i2.MatIconButton,
470
+ selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
471
+ exportAs: ["matButton", "matAnchor"]
472
+ },
473
+ {
474
+ kind: "ngmodule",
475
+ type: MatTableModule
476
+ },
477
+ {
478
+ kind: "component",
479
+ type: i3.MatTable,
480
+ selector: "mat-table, table[mat-table]",
481
+ exportAs: ["matTable"]
482
+ },
483
+ {
484
+ kind: "directive",
485
+ type: i3.MatHeaderCellDef,
486
+ selector: "[matHeaderCellDef]"
487
+ },
488
+ {
489
+ kind: "directive",
490
+ type: i3.MatHeaderRowDef,
491
+ selector: "[matHeaderRowDef]",
492
+ inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"]
493
+ },
494
+ {
495
+ kind: "directive",
496
+ type: i3.MatColumnDef,
497
+ selector: "[matColumnDef]",
498
+ inputs: ["matColumnDef"]
499
+ },
500
+ {
501
+ kind: "directive",
502
+ type: i3.MatCellDef,
503
+ selector: "[matCellDef]"
504
+ },
505
+ {
506
+ kind: "directive",
507
+ type: i3.MatRowDef,
508
+ selector: "[matRowDef]",
509
+ inputs: ["matRowDefColumns", "matRowDefWhen"]
510
+ },
511
+ {
512
+ kind: "directive",
513
+ type: i3.MatHeaderCell,
514
+ selector: "mat-header-cell, th[mat-header-cell]"
515
+ },
516
+ {
517
+ kind: "directive",
518
+ type: i3.MatCell,
519
+ selector: "mat-cell, td[mat-cell]"
520
+ },
521
+ {
522
+ kind: "component",
523
+ type: i3.MatHeaderRow,
524
+ selector: "mat-header-row, tr[mat-header-row]",
525
+ exportAs: ["matHeaderRow"]
526
+ },
527
+ {
528
+ kind: "component",
529
+ type: i3.MatRow,
530
+ selector: "mat-row, tr[mat-row]",
531
+ exportAs: ["matRow"]
532
+ },
533
+ {
534
+ kind: "ngmodule",
535
+ type: MatIconModule
536
+ },
537
+ {
538
+ kind: "component",
539
+ type: i1$1.MatIcon,
540
+ selector: "mat-icon",
541
+ inputs: [
542
+ "color",
543
+ "inline",
544
+ "svgIcon",
545
+ "fontSet",
546
+ "fontIcon"
547
+ ],
548
+ exportAs: ["matIcon"]
549
+ },
550
+ {
551
+ kind: "ngmodule",
552
+ type: MatProgressSpinnerModule
553
+ },
554
+ {
555
+ kind: "component",
556
+ type: i4.MatProgressSpinner,
557
+ selector: "mat-progress-spinner, mat-spinner",
558
+ inputs: [
559
+ "color",
560
+ "mode",
561
+ "value",
562
+ "diameter",
563
+ "strokeWidth"
564
+ ],
565
+ exportAs: ["matProgressSpinner"]
566
+ }
567
+ ]
568
+ });
569
+ };
570
+ i0.ɵɵngDeclareClassMetadata({
571
+ minVersion: "12.0.0",
572
+ version: "22.2.0",
573
+ ngImport: i0,
574
+ type: NgssmCachesComponent,
575
+ decorators: [{
576
+ type: Component,
577
+ args: [{
578
+ selector: "ngssm-caches",
579
+ imports: [
580
+ MatDialogModule,
581
+ MatButtonModule,
582
+ MatTableModule,
583
+ MatIconModule,
584
+ MatProgressSpinnerModule
585
+ ],
586
+ template: "<h1 mat-dialog-title>List of caches</h1>\n<mat-dialog-content class=\"flex-column-stretch fxFlex\">\n <mat-table [dataSource]=\"caches()\" class=\"fxFlex\">\n <ng-container matColumnDef=\"actions\">\n <mat-header-cell *matHeaderCellDef> </mat-header-cell>\n <mat-cell *matCellDef=\"let element\">\n <button\n mat-icon-button\n [disabled]=\"element.value.status === dataStatus.loading\"\n (click)=\"reloadCache(element)\"\n color=\"primary\"\n id=\"reload_{{ element.key }}\">\n <mat-icon class=\"fa-solid fa-rotate-right\"></mat-icon>\n </button>\n </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"key\">\n <mat-header-cell *matHeaderCellDef> Key </mat-header-cell>\n <mat-cell *matCellDef=\"let element\"> {{ element.key }} </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"status\">\n <mat-header-cell *matHeaderCellDef> Status </mat-header-cell>\n <mat-cell *matCellDef=\"let element\">\n @switch (element.value.status) {\n @case (dataStatus.none) {\n <mat-icon class=\"fa-solid fa-minus\"></mat-icon>\n }\n @case (dataStatus.loaded) {\n <mat-icon class=\"fa-solid fa-check\" color=\"primary\"></mat-icon>\n }\n @case (dataStatus.error) {\n <mat-icon class=\"fa-solid fa-xmark\" color=\"warn\"></mat-icon>\n }\n @case (dataStatus.notFound) {\n <mat-icon class=\"fa-solid fa-xmark\" color=\"warn\"></mat-icon>\n }\n @case (dataStatus.loading) {\n <mat-spinner [diameter]=\"20\"></mat-spinner>\n }\n }\n </mat-cell>\n </ng-container>\n\n <ng-container matColumnDef=\"timestamp\">\n <mat-header-cell *matHeaderCellDef> Timestamp </mat-header-cell>\n <mat-cell *matCellDef=\"let element\"> {{ element.value.timestamp }} </mat-cell>\n </ng-container>\n\n <mat-header-row *matHeaderRowDef=\"['actions', 'status', 'key', 'timestamp']; sticky: true\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: ['actions', 'status', 'key', 'timestamp']\"></mat-row>\n </mat-table>\n</mat-dialog-content>\n<mat-dialog-actions class=\"flex-row-center\">\n <span class=\"fxFlex\"></span>\n <button mat-button (click)=\"close()\" id=\"closeButton\">Close</button>\n</mat-dialog-actions>\n",
587
+ styles: [":host{display:flex;flex-direction:column;min-width:800px;max-width:80vw;min-height:500px;max-height:80vh}:host .mat-column-actions{min-width:50px;max-width:50px;padding-left:0!important}:host .mat-column-status{min-width:60px;max-width:60px}\n"]
588
+ }]
589
+ }]
590
+ });
591
+ var CachesDisplayEffect = class CachesDisplayEffect {
592
+ processedActions = [RemoteDataActionType.displayCaches, RemoteDataActionType.closeCachesComponent];
593
+ matDialog = inject(MatDialog);
594
+ dialog;
595
+ processAction(actiondispatcher, state, action) {
596
+ switch (action.type) {
597
+ case RemoteDataActionType.displayCaches:
598
+ this.dialog = this.matDialog.open(NgssmCachesComponent, { disableClose: true });
599
+ break;
600
+ case RemoteDataActionType.closeCachesComponent:
601
+ this.dialog?.close();
602
+ this.dialog = void 0;
603
+ }
604
+ }
605
+ static ɵfac = i0.ɵɵngDeclareFactory({
606
+ minVersion: "12.0.0",
607
+ version: "22.2.0",
608
+ ngImport: i0,
609
+ type: CachesDisplayEffect,
610
+ deps: [],
611
+ target: i0.ɵɵFactoryTarget.Injectable
612
+ });
613
+ static ɵprov = i0.ɵɵngDeclareInjectable({
614
+ minVersion: "12.0.0",
615
+ version: "22.2.0",
616
+ ngImport: i0,
617
+ type: CachesDisplayEffect
618
+ });
619
+ };
620
+ i0.ɵɵngDeclareClassMetadata({
621
+ minVersion: "12.0.0",
622
+ version: "22.2.0",
623
+ ngImport: i0,
624
+ type: CachesDisplayEffect,
625
+ decorators: [{ type: Injectable }]
626
+ });
627
+ var RemoteDataLoadingEffect = class RemoteDataLoadingEffect {
628
+ processedActions = [RemoteDataActionType.loadRemoteData];
629
+ remoteDataProviders = inject(NGSSM_REMOTE_DATA_PROVIDER, { optional: true });
630
+ notifierService = inject(NgssmNotifierService);
631
+ injector = inject(EnvironmentInjector);
632
+ remoteDataProvidersPerKey;
633
+ constructor() {
634
+ this.remoteDataProvidersPerKey = new Map((this.remoteDataProviders ?? []).map((r) => [r.remoteDataKey, r]));
635
+ }
636
+ processAction(actiondispatcher, state, action) {
637
+ const loadRemoteDataAction = action;
638
+ const item = selectRemoteDataState(state)[loadRemoteDataAction.remoteDataKey];
639
+ const provider = this.remoteDataProvidersPerKey.get(loadRemoteDataAction.remoteDataKey);
640
+ if (!item || !provider || item.status !== DataStatus.loading) return;
641
+ runInInjectionContext(this.injector, () => {
642
+ provider.get(item.getterParams).subscribe({
643
+ next: (value) => {
644
+ actiondispatcher.dispatchAction(new RegisterLoadedRemoteDataAction(loadRemoteDataAction.remoteDataKey, DataStatus.loaded, value));
645
+ if (item.getterParams?.callbackAction) actiondispatcher.dispatchActionType(item.getterParams.callbackAction);
646
+ },
647
+ error: (error) => {
648
+ console.error(`Unable to load data for '${loadRemoteDataAction.remoteDataKey}'`, error);
649
+ if (item.getterParams?.errorNotificationMessage) this.notifierService.notifyError(item.getterParams.errorNotificationMessage(error?.error));
650
+ actiondispatcher.dispatchAction(new RegisterLoadedRemoteDataAction(loadRemoteDataAction.remoteDataKey, DataStatus.error, void 0, error?.error));
651
+ }
652
+ });
653
+ });
654
+ }
655
+ static ɵfac = i0.ɵɵngDeclareFactory({
656
+ minVersion: "12.0.0",
657
+ version: "22.2.0",
658
+ ngImport: i0,
659
+ type: RemoteDataLoadingEffect,
660
+ deps: [],
661
+ target: i0.ɵɵFactoryTarget.Injectable
662
+ });
663
+ static ɵprov = i0.ɵɵngDeclareInjectable({
664
+ minVersion: "12.0.0",
665
+ version: "22.2.0",
666
+ ngImport: i0,
667
+ type: RemoteDataLoadingEffect
668
+ });
669
+ };
670
+ i0.ɵɵngDeclareClassMetadata({
671
+ minVersion: "12.0.0",
672
+ version: "22.2.0",
673
+ ngImport: i0,
674
+ type: RemoteDataLoadingEffect,
675
+ decorators: [{ type: Injectable }],
676
+ ctorParameters: () => []
677
+ });
678
+ var RemoteDataReducer = class RemoteDataReducer {
679
+ processedActions = [RemoteDataActionType.loadRemoteData, RemoteDataActionType.registerLoadedRemoteData];
680
+ remoteDataProviders = inject(NGSSM_REMOTE_DATA_PROVIDER, { optional: true });
681
+ remoteDataProvidersPerKey;
682
+ constructor() {
683
+ this.remoteDataProvidersPerKey = new Map((this.remoteDataProviders ?? []).map((r) => [r.remoteDataKey, r]));
684
+ }
685
+ updateState(state, action) {
686
+ switch (action.type) {
687
+ case RemoteDataActionType.loadRemoteData: {
688
+ const loadRemoteDataAction = action;
689
+ const item = selectRemoteDataState(state)[loadRemoteDataAction.remoteDataKey];
690
+ if (!item) return state;
691
+ const provider = this.remoteDataProvidersPerKey.get(loadRemoteDataAction.remoteDataKey);
692
+ if (!provider) return state;
693
+ if (!provider.cacheDurationInSeconds || loadRemoteDataAction.params?.forceReload === true || item.status === DataStatus.none || item.status === DataStatus.error || item.status === DataStatus.notFound || !item.timestamp || (/* @__PURE__ */ new Date()).getTime() - item.timestamp.getTime() >= 1e3 * provider.cacheDurationInSeconds) return updateRemoteDataState(state, { [loadRemoteDataAction.remoteDataKey]: {
694
+ status: { $set: DataStatus.loading },
695
+ getterParams: { $apply: (value) => {
696
+ if (!loadRemoteDataAction.params || loadRemoteDataAction.params.keepStoredGetterParams !== true) return loadRemoteDataAction.params?.params;
697
+ return value;
698
+ } }
699
+ } });
700
+ break;
701
+ }
702
+ case RemoteDataActionType.registerLoadedRemoteData: {
703
+ const registerLoadedRemoteDataAction = action;
704
+ if (this.remoteDataProvidersPerKey.has(registerLoadedRemoteDataAction.remoteDataKey)) return updateRemoteDataState(state, { [registerLoadedRemoteDataAction.remoteDataKey]: {
705
+ status: { $set: registerLoadedRemoteDataAction.status },
706
+ data: { $set: registerLoadedRemoteDataAction.data },
707
+ timestamp: { $set: /* @__PURE__ */ new Date() },
708
+ message: { $set: registerLoadedRemoteDataAction.message },
709
+ error: { $set: registerLoadedRemoteDataAction.remoteCallError }
710
+ } });
711
+ break;
712
+ }
713
+ }
714
+ return state;
715
+ }
716
+ static ɵfac = i0.ɵɵngDeclareFactory({
717
+ minVersion: "12.0.0",
718
+ version: "22.2.0",
719
+ ngImport: i0,
720
+ type: RemoteDataReducer,
721
+ deps: [],
722
+ target: i0.ɵɵFactoryTarget.Injectable
723
+ });
724
+ static ɵprov = i0.ɵɵngDeclareInjectable({
725
+ minVersion: "12.0.0",
726
+ version: "22.2.0",
727
+ ngImport: i0,
728
+ type: RemoteDataReducer
729
+ });
730
+ };
731
+ i0.ɵɵngDeclareClassMetadata({
732
+ minVersion: "12.0.0",
733
+ version: "22.2.0",
734
+ ngImport: i0,
735
+ type: RemoteDataReducer,
736
+ decorators: [{ type: Injectable }],
737
+ ctorParameters: () => []
738
+ });
739
+ var RemoteDataStateInitializer = class RemoteDataStateInitializer {
740
+ remoteDataProviders = inject(NGSSM_REMOTE_DATA_PROVIDER, { optional: true });
741
+ initializeState(state) {
742
+ const tempState = state;
743
+ return (this.remoteDataProviders ?? []).reduce((s, provider) => updateRemoteDataState(s, { [provider.remoteDataKey]: { $set: { status: DataStatus.none } } }), tempState);
744
+ }
745
+ static ɵfac = i0.ɵɵngDeclareFactory({
746
+ minVersion: "12.0.0",
747
+ version: "22.2.0",
748
+ ngImport: i0,
749
+ type: RemoteDataStateInitializer,
750
+ deps: [],
751
+ target: i0.ɵɵFactoryTarget.Injectable
752
+ });
753
+ static ɵprov = i0.ɵɵngDeclareInjectable({
754
+ minVersion: "12.0.0",
755
+ version: "22.2.0",
756
+ ngImport: i0,
757
+ type: RemoteDataStateInitializer
758
+ });
759
+ };
760
+ i0.ɵɵngDeclareClassMetadata({
761
+ minVersion: "12.0.0",
762
+ version: "22.2.0",
763
+ ngImport: i0,
764
+ type: RemoteDataStateInitializer,
765
+ decorators: [{ type: Injectable }]
766
+ });
370
767
  const provideNgssmRemoteData = () => {
371
- return makeEnvironmentProviders([
372
- provideReducer(RemoteDataReducer),
373
- provideEffects(CachesDisplayEffect, RemoteDataLoadingEffect),
374
- { provide: NGSSM_STATE_INITIALIZER, useClass: RemoteDataStateInitializer, multi: true }
375
- ]);
768
+ return makeEnvironmentProviders([
769
+ provideReducer(RemoteDataReducer),
770
+ provideEffects(CachesDisplayEffect, RemoteDataLoadingEffect),
771
+ {
772
+ provide: NGSSM_STATE_INITIALIZER,
773
+ useClass: RemoteDataStateInitializer,
774
+ multi: true
775
+ }
776
+ ]);
376
777
  };
377
-
378
- /*
379
- * Public API Surface of ngssm-remote-data
380
- */
381
-
382
- /**
383
- * Represents an action that encapsulates the result of a remote call.
384
- *
385
- * This action is typically dispatched when a remote call completes,
386
- * carrying both the action type and the associated remote call data.
387
- *
388
- * @remarks
389
- * Implements the `Action` interface.
390
- *
391
- * @param type - The type of the action.
392
- * @param remoteCall - The remote call instance containing the result details.
393
- */
394
- class NgssmRemoteCallResultAction {
395
- type;
396
- remoteCall;
397
- constructor(type, remoteCall) {
398
- this.type = type;
399
- this.remoteCall = remoteCall;
400
- }
401
- }
402
- /**
403
- * Injection token for providing NGSSM remote call configuration.
404
- * Used to register and inject RemoteCallConfig objects in Angular's dependency injection system.
405
- */
406
- const NGSSM_REMOTE_CALL_CONFIG = new InjectionToken('NGSSM_REMOTE_CALL_CONFIG');
407
- /**
408
- * Provides the configuration for NGSSM remote calls as an Angular provider.
409
- *
410
- * @param config - The remote call configuration object to be provided.
411
- * @returns An Angular provider object that supplies the given configuration for NGSSM remote calls.
412
- *
413
- * @remarks
414
- * This function is intended to be used in Angular module providers to register
415
- * multiple remote call configurations using the `multi: true` option.
416
- */
778
+ var NgssmRemoteCallResultAction = class {
779
+ type;
780
+ remoteCall;
781
+ constructor(type, remoteCall) {
782
+ this.type = type;
783
+ this.remoteCall = remoteCall;
784
+ }
785
+ };
786
+ const NGSSM_REMOTE_CALL_CONFIG = new InjectionToken("NGSSM_REMOTE_CALL_CONFIG");
417
787
  const provideNgssmRemoteCallConfig = (config) => ({
418
- provide: NGSSM_REMOTE_CALL_CONFIG,
419
- useValue: config,
420
- multi: true
788
+ provide: NGSSM_REMOTE_CALL_CONFIG,
789
+ useValue: config,
790
+ multi: true
421
791
  });
422
-
423
- // Represents the possible statuses of a remote call.
424
792
  var RemoteCallStatus;
425
- (function (RemoteCallStatus) {
426
- RemoteCallStatus["none"] = "None";
427
- RemoteCallStatus["inProgress"] = "In progress";
428
- RemoteCallStatus["done"] = "Done";
429
- RemoteCallStatus["ko"] = "Ko"; // The remote call failed
793
+ (function(RemoteCallStatus) {
794
+ RemoteCallStatus["none"] = "None";
795
+ RemoteCallStatus["inProgress"] = "In progress";
796
+ RemoteCallStatus["done"] = "Done";
797
+ RemoteCallStatus["ko"] = "Ko";
430
798
  })(RemoteCallStatus || (RemoteCallStatus = {}));
431
- /**
432
- * Returns a default RemoteCall object with the specified status (defaults to 'none').
433
- * @param status The status to set for the remote call.
434
- * @returns A RemoteCall object with the given status.
435
- */
436
799
  const getDefaultRemoteCall = (status = RemoteCallStatus.none) => ({ status });
437
-
438
800
  const selectNgssmRemoteCallState = (state) => state[NgssmRemoteCallStateSpecification.featureStateKey];
439
- const updateNgssmRemoteCallState = (state, command) => update(state, {
440
- [NgssmRemoteCallStateSpecification.featureStateKey]: command
441
- });
801
+ const updateNgssmRemoteCallState = (state, command) => update(state, { [NgssmRemoteCallStateSpecification.featureStateKey]: command });
442
802
  let NgssmRemoteCallStateSpecification = class NgssmRemoteCallStateSpecification {
443
- static featureStateKey = 'ngssm-remote-call-state';
444
- static initialState = {
445
- remoteCalls: {}
446
- };
803
+ static featureStateKey = "ngssm-remote-call-state";
804
+ static initialState = { remoteCalls: {} };
447
805
  };
448
- NgssmRemoteCallStateSpecification = __decorate([
449
- NgSsmFeatureState({
450
- featureStateKey: NgssmRemoteCallStateSpecification.featureStateKey,
451
- initialState: NgssmRemoteCallStateSpecification.initialState
452
- })
453
- ], NgssmRemoteCallStateSpecification);
454
-
455
- class NgssmRemoteCallStateInitializer {
456
- remoteCallConfigs = inject(NGSSM_REMOTE_CALL_CONFIG, {
457
- optional: true
458
- });
459
- initializeState(state) {
460
- const tempState = state;
461
- return (this.remoteCallConfigs ?? []).reduce((s, config) => updateNgssmRemoteCallState(s, { remoteCalls: { [config.id]: { $set: { status: RemoteCallStatus.none } } } }), tempState);
462
- }
463
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmRemoteCallStateInitializer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
464
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmRemoteCallStateInitializer });
465
- }
466
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmRemoteCallStateInitializer, decorators: [{
467
- type: Injectable
468
- }] });
469
-
470
- class RemoteCallReducer {
471
- processedActions = [];
472
- remoteCallConfigs = inject(NGSSM_REMOTE_CALL_CONFIG, {
473
- optional: true
474
- });
475
- constructor() {
476
- (this.remoteCallConfigs ?? []).forEach((c) => this.processedActions.push(...[...c.triggeredActionTypes, ...c.resultActionTypes]));
477
- }
478
- updateState(state, action) {
479
- const configs = (this.remoteCallConfigs ?? []).filter((c) => c.triggeredActionTypes.includes(action.type) || c.resultActionTypes.includes(action.type));
480
- let output = state;
481
- configs.forEach((config) => {
482
- if (config.triggeredActionTypes.includes(action.type)) {
483
- output = updateNgssmRemoteCallState(output, {
484
- remoteCalls: {
485
- [config.id]: { $set: getDefaultRemoteCall(RemoteCallStatus.inProgress) }
486
- }
487
- });
488
- }
489
- else {
490
- const ngssmRemoteCallResultAction = action;
491
- output = updateNgssmRemoteCallState(output, {
492
- remoteCalls: {
493
- [config.id]: { $set: ngssmRemoteCallResultAction.remoteCall }
494
- }
495
- });
496
- }
497
- });
498
- return output;
499
- }
500
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteCallReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
501
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteCallReducer });
502
- }
503
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteCallReducer, decorators: [{
504
- type: Injectable
505
- }], ctorParameters: () => [] });
506
-
806
+ NgssmRemoteCallStateSpecification = __decorate([NgSsmFeatureState({
807
+ featureStateKey: NgssmRemoteCallStateSpecification.featureStateKey,
808
+ initialState: NgssmRemoteCallStateSpecification.initialState
809
+ })], NgssmRemoteCallStateSpecification);
810
+ var NgssmRemoteCallStateInitializer = class NgssmRemoteCallStateInitializer {
811
+ remoteCallConfigs = inject(NGSSM_REMOTE_CALL_CONFIG, { optional: true });
812
+ initializeState(state) {
813
+ const tempState = state;
814
+ return (this.remoteCallConfigs ?? []).reduce((s, config) => updateNgssmRemoteCallState(s, { remoteCalls: { [config.id]: { $set: { status: RemoteCallStatus.none } } } }), tempState);
815
+ }
816
+ static ɵfac = i0.ɵɵngDeclareFactory({
817
+ minVersion: "12.0.0",
818
+ version: "22.2.0",
819
+ ngImport: i0,
820
+ type: NgssmRemoteCallStateInitializer,
821
+ deps: [],
822
+ target: i0.ɵɵFactoryTarget.Injectable
823
+ });
824
+ static ɵprov = i0.ɵɵngDeclareInjectable({
825
+ minVersion: "12.0.0",
826
+ version: "22.2.0",
827
+ ngImport: i0,
828
+ type: NgssmRemoteCallStateInitializer
829
+ });
830
+ };
831
+ i0.ɵɵngDeclareClassMetadata({
832
+ minVersion: "12.0.0",
833
+ version: "22.2.0",
834
+ ngImport: i0,
835
+ type: NgssmRemoteCallStateInitializer,
836
+ decorators: [{ type: Injectable }]
837
+ });
838
+ var RemoteCallReducer = class RemoteCallReducer {
839
+ processedActions = [];
840
+ remoteCallConfigs = inject(NGSSM_REMOTE_CALL_CONFIG, { optional: true });
841
+ constructor() {
842
+ (this.remoteCallConfigs ?? []).forEach((c) => this.processedActions.push(...[...c.triggeredActionTypes, ...c.resultActionTypes]));
843
+ }
844
+ updateState(state, action) {
845
+ const configs = (this.remoteCallConfigs ?? []).filter((c) => c.triggeredActionTypes.includes(action.type) || c.resultActionTypes.includes(action.type));
846
+ let output = state;
847
+ configs.forEach((config) => {
848
+ if (config.triggeredActionTypes.includes(action.type)) output = updateNgssmRemoteCallState(output, { remoteCalls: { [config.id]: { $set: getDefaultRemoteCall(RemoteCallStatus.inProgress) } } });
849
+ else {
850
+ const ngssmRemoteCallResultAction = action;
851
+ output = updateNgssmRemoteCallState(output, { remoteCalls: { [config.id]: { $set: ngssmRemoteCallResultAction.remoteCall } } });
852
+ }
853
+ });
854
+ return output;
855
+ }
856
+ static ɵfac = i0.ɵɵngDeclareFactory({
857
+ minVersion: "12.0.0",
858
+ version: "22.2.0",
859
+ ngImport: i0,
860
+ type: RemoteCallReducer,
861
+ deps: [],
862
+ target: i0.ɵɵFactoryTarget.Injectable
863
+ });
864
+ static ɵprov = i0.ɵɵngDeclareInjectable({
865
+ minVersion: "12.0.0",
866
+ version: "22.2.0",
867
+ ngImport: i0,
868
+ type: RemoteCallReducer
869
+ });
870
+ };
871
+ i0.ɵɵngDeclareClassMetadata({
872
+ minVersion: "12.0.0",
873
+ version: "22.2.0",
874
+ ngImport: i0,
875
+ type: RemoteCallReducer,
876
+ decorators: [{ type: Injectable }],
877
+ ctorParameters: () => []
878
+ });
507
879
  var NgssmRemoteCallActionType;
508
- (function (NgssmRemoteCallActionType) {
509
- NgssmRemoteCallActionType["setRemoteCall"] = "[NgssmRemoteCallActionType] setRemoteCall";
880
+ (function(NgssmRemoteCallActionType) {
881
+ NgssmRemoteCallActionType["setRemoteCall"] = "[NgssmRemoteCallActionType] setRemoteCall";
510
882
  })(NgssmRemoteCallActionType || (NgssmRemoteCallActionType = {}));
511
- class SetRemoteCallAction {
512
- remoteCallId;
513
- remoteCall;
514
- type = NgssmRemoteCallActionType.setRemoteCall;
515
- constructor(remoteCallId, remoteCall) {
516
- this.remoteCallId = remoteCallId;
517
- this.remoteCall = remoteCall;
518
- }
519
- }
520
-
521
- class RemoteCallSetterReducer {
522
- processedActions = [NgssmRemoteCallActionType.setRemoteCall];
523
- updateState(state, action) {
524
- switch (action.type) {
525
- case NgssmRemoteCallActionType.setRemoteCall: {
526
- const setRemoteCallAction = action;
527
- return updateNgssmRemoteCallState(state, {
528
- remoteCalls: {
529
- [setRemoteCallAction.remoteCallId]: { $set: setRemoteCallAction.remoteCall }
530
- }
531
- });
532
- }
533
- }
534
- return state;
535
- }
536
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteCallSetterReducer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
537
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteCallSetterReducer });
538
- }
539
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteCallSetterReducer, decorators: [{
540
- type: Injectable
541
- }] });
542
-
883
+ var SetRemoteCallAction = class {
884
+ remoteCallId;
885
+ remoteCall;
886
+ type = NgssmRemoteCallActionType.setRemoteCall;
887
+ constructor(remoteCallId, remoteCall) {
888
+ this.remoteCallId = remoteCallId;
889
+ this.remoteCall = remoteCall;
890
+ }
891
+ };
892
+ var RemoteCallSetterReducer = class RemoteCallSetterReducer {
893
+ processedActions = [NgssmRemoteCallActionType.setRemoteCall];
894
+ updateState(state, action) {
895
+ switch (action.type) {
896
+ case NgssmRemoteCallActionType.setRemoteCall: {
897
+ const setRemoteCallAction = action;
898
+ return updateNgssmRemoteCallState(state, { remoteCalls: { [setRemoteCallAction.remoteCallId]: { $set: setRemoteCallAction.remoteCall } } });
899
+ }
900
+ }
901
+ return state;
902
+ }
903
+ static ɵfac = i0.ɵɵngDeclareFactory({
904
+ minVersion: "12.0.0",
905
+ version: "22.2.0",
906
+ ngImport: i0,
907
+ type: RemoteCallSetterReducer,
908
+ deps: [],
909
+ target: i0.ɵɵFactoryTarget.Injectable
910
+ });
911
+ static ɵprov = i0.ɵɵngDeclareInjectable({
912
+ minVersion: "12.0.0",
913
+ version: "22.2.0",
914
+ ngImport: i0,
915
+ type: RemoteCallSetterReducer
916
+ });
917
+ };
918
+ i0.ɵɵngDeclareClassMetadata({
919
+ minVersion: "12.0.0",
920
+ version: "22.2.0",
921
+ ngImport: i0,
922
+ type: RemoteCallSetterReducer,
923
+ decorators: [{ type: Injectable }]
924
+ });
543
925
  const provideNgssmRemoteCall = () => {
544
- return makeEnvironmentProviders([
545
- { provide: NGSSM_STATE_INITIALIZER, useClass: NgssmRemoteCallStateInitializer, multi: true },
546
- provideReducers(RemoteCallSetterReducer, RemoteCallReducer)
547
- ]);
926
+ return makeEnvironmentProviders([{
927
+ provide: NGSSM_STATE_INITIALIZER,
928
+ useClass: NgssmRemoteCallStateInitializer,
929
+ multi: true
930
+ }, provideReducers(RemoteCallSetterReducer, RemoteCallReducer)]);
548
931
  };
549
-
550
932
  const selectRemoteCall = (state, id) => selectNgssmRemoteCallState(state).remoteCalls[id] ?? getDefaultRemoteCall();
551
- /**
552
- * Returns true if the specified remote call is currently in progress, false otherwise.
553
- * @param state The global application state.
554
- * @param remoteCallId The unique id of the remote call.
555
- */
556
933
  const isNgssmRemoteCallInProgress = (state, remoteCallId) => selectRemoteCall(state, remoteCallId)?.status === RemoteCallStatus.inProgress;
557
-
558
- class RemoteCallResultProcessor {
559
- logger = inject(Logger);
560
- // Inject Injector instead of Store because Effects are injected into Store and this class may be used by Effects
561
- injector = inject(Injector);
562
- notifier = inject(NgssmNotifierService);
563
- processRemoteCallError(remoteCallId, error, errorMessage) {
564
- this.logger.error(errorMessage, error);
565
- this.notifier.notifyError(errorMessage, error.message);
566
- this.injector
567
- .get(Store)
568
- .dispatchAction(new SetRemoteCallAction(remoteCallId, { status: RemoteCallStatus.ko, httpErrorResponse: error, message: errorMessage }));
569
- }
570
- processRemoteCallSuccess(remoteCallId, message) {
571
- this.logger.information(message);
572
- this.notifier.notifySuccess(message);
573
- this.injector.get(Store).dispatchAction(new SetRemoteCallAction(remoteCallId, { status: RemoteCallStatus.done }));
574
- }
575
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteCallResultProcessor, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
576
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteCallResultProcessor, providedIn: 'root' });
577
- }
578
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: RemoteCallResultProcessor, decorators: [{
579
- type: Injectable,
580
- args: [{
581
- providedIn: 'root'
582
- }]
583
- }] });
584
- /**
585
- * Helper method to process http error.
586
- *
587
- * Use instead the service RemoteCallResultProcessor.
588
- *
589
- * @param error The http error response.
590
- * @param errorMessage The custom error message.
591
- * @param remoteCallId The remote call identifier.
592
- * @param actionDispatcher The action dispatcher.
593
- * @param logger The logger.
594
- * @param notifier The message notifier.
595
- */
934
+ var RemoteCallResultProcessor = class RemoteCallResultProcessor {
935
+ logger = inject(Logger);
936
+ injector = inject(Injector);
937
+ notifier = inject(NgssmNotifierService);
938
+ processRemoteCallError(remoteCallId, error, errorMessage) {
939
+ this.logger.error(errorMessage, error);
940
+ this.notifier.notifyError(errorMessage, error.message);
941
+ this.injector.get(Store).dispatchAction(new SetRemoteCallAction(remoteCallId, {
942
+ status: RemoteCallStatus.ko,
943
+ httpErrorResponse: error,
944
+ message: errorMessage
945
+ }));
946
+ }
947
+ processRemoteCallSuccess(remoteCallId, message) {
948
+ this.logger.information(message);
949
+ this.notifier.notifySuccess(message);
950
+ this.injector.get(Store).dispatchAction(new SetRemoteCallAction(remoteCallId, { status: RemoteCallStatus.done }));
951
+ }
952
+ static ɵfac = i0.ɵɵngDeclareFactory({
953
+ minVersion: "12.0.0",
954
+ version: "22.2.0",
955
+ ngImport: i0,
956
+ type: RemoteCallResultProcessor,
957
+ deps: [],
958
+ target: i0.ɵɵFactoryTarget.Injectable
959
+ });
960
+ static ɵprov = i0.ɵɵngDeclareInjectable({
961
+ minVersion: "12.0.0",
962
+ version: "22.2.0",
963
+ ngImport: i0,
964
+ type: RemoteCallResultProcessor,
965
+ providedIn: "root"
966
+ });
967
+ };
968
+ i0.ɵɵngDeclareClassMetadata({
969
+ minVersion: "12.0.0",
970
+ version: "22.2.0",
971
+ ngImport: i0,
972
+ type: RemoteCallResultProcessor,
973
+ decorators: [{
974
+ type: Injectable,
975
+ args: [{ providedIn: "root" }]
976
+ }]
977
+ });
596
978
  const processRemoteCallError = (error, errorMessage, remoteCallId, actionDispatcher, logger, notifier) => {
597
- logger.error(errorMessage, error);
598
- notifier.notifyError(errorMessage, error.error?.title);
599
- actionDispatcher.dispatchAction(new SetRemoteCallAction(remoteCallId, { status: RemoteCallStatus.ko, error: error.error }));
979
+ logger.error(errorMessage, error);
980
+ notifier.notifyError(errorMessage, error.error?.title);
981
+ actionDispatcher.dispatchAction(new SetRemoteCallAction(remoteCallId, {
982
+ status: RemoteCallStatus.ko,
983
+ error: error.error
984
+ }));
600
985
  };
601
-
602
- class NgssmRemoteCallErrorComponent {
603
- remoteCallId = input('', /* @ts-ignore */
604
- ...(ngDevMode ? [{ debugName: "remoteCallId" }] : /* istanbul ignore next */ []));
605
- errorContainerRendered = signal(false, /* @ts-ignore */
606
- ...(ngDevMode ? [{ debugName: "errorContainerRendered" }] : /* istanbul ignore next */ []));
607
- errorDescription = signal('', /* @ts-ignore */
608
- ...(ngDevMode ? [{ debugName: "errorDescription" }] : /* istanbul ignore next */ []));
609
- remoteCalls = createSignal((state) => selectNgssmRemoteCallState(state).remoteCalls);
610
- constructor() {
611
- effect(() => {
612
- const id = this.remoteCallId();
613
- const remoteCall = this.remoteCalls()[id];
614
- this.errorContainerRendered.set(remoteCall?.status === RemoteCallStatus.ko);
615
- const description = remoteCall?.status !== RemoteCallStatus.ko
616
- ? ''
617
- : remoteCall.message
618
- ? remoteCall.message
619
- : remoteCall.httpErrorResponse
620
- ? JSON.stringify(remoteCall.httpErrorResponse, null, 2)
621
- : remoteCall.error
622
- ? JSON.stringify(remoteCall.error, null, 2)
623
- : 'No error description provided!';
624
- this.errorDescription.set(description);
625
- });
626
- }
627
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmRemoteCallErrorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
628
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: NgssmRemoteCallErrorComponent, isStandalone: true, selector: "ngssm-remote-call-error", inputs: { remoteCallId: { classPropertyName: "remoteCallId", publicName: "remoteCallId", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "ngssm-remote-call-error" }, ngImport: i0, template: "@if (errorContainerRendered()) {\n <div class=\"ngssm-remote-call-error-container\">\n {{ errorDescription() }}\n\n <button mat-icon-button color=\"warn\" class=\"ngssm-remote-call-error-close-button\" (click)=\"errorContainerRendered.set(false)\">\n <mat-icon class=\"fa-solid fa-square-xmark\"></mat-icon>\n </button>\n </div>\n}\n", dependencies: [{ kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2$1.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }] });
629
- }
630
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: NgssmRemoteCallErrorComponent, decorators: [{
631
- type: Component,
632
- args: [{ selector: 'ngssm-remote-call-error', imports: [MatButtonModule, MatIconModule], host: {
633
- class: 'ngssm-remote-call-error'
634
- }, template: "@if (errorContainerRendered()) {\n <div class=\"ngssm-remote-call-error-container\">\n {{ errorDescription() }}\n\n <button mat-icon-button color=\"warn\" class=\"ngssm-remote-call-error-close-button\" (click)=\"errorContainerRendered.set(false)\">\n <mat-icon class=\"fa-solid fa-square-xmark\"></mat-icon>\n </button>\n </div>\n}\n" }]
635
- }], ctorParameters: () => [], propDecorators: { remoteCallId: [{ type: i0.Input, args: [{ isSignal: true, alias: "remoteCallId", required: false }] }] } });
636
-
637
- /*
638
- * Public API Surface of ngssm-remote-data
639
- */
640
-
641
- /**
642
- * Generated bundle index. Do not edit.
643
- */
644
-
986
+ var NgssmRemoteCallErrorComponent = class NgssmRemoteCallErrorComponent {
987
+ remoteCallId = input("", ...ngDevMode ? [{ debugName: "remoteCallId" }] : /* istanbul ignore next */ []);
988
+ errorContainerRendered = signal(false, ...ngDevMode ? [{ debugName: "errorContainerRendered" }] : /* istanbul ignore next */ []);
989
+ errorDescription = signal("", ...ngDevMode ? [{ debugName: "errorDescription" }] : /* istanbul ignore next */ []);
990
+ remoteCalls = createSignal((state) => selectNgssmRemoteCallState(state).remoteCalls);
991
+ constructor() {
992
+ effect(() => {
993
+ const id = this.remoteCallId();
994
+ const remoteCall = this.remoteCalls()[id];
995
+ this.errorContainerRendered.set(remoteCall?.status === RemoteCallStatus.ko);
996
+ const description = remoteCall?.status !== RemoteCallStatus.ko ? "" : remoteCall.message ? remoteCall.message : remoteCall.httpErrorResponse ? JSON.stringify(remoteCall.httpErrorResponse, null, 2) : remoteCall.error ? JSON.stringify(remoteCall.error, null, 2) : "No error description provided!";
997
+ this.errorDescription.set(description);
998
+ });
999
+ }
1000
+ static ɵfac = i0.ɵɵngDeclareFactory({
1001
+ minVersion: "12.0.0",
1002
+ version: "22.2.0",
1003
+ ngImport: i0,
1004
+ type: NgssmRemoteCallErrorComponent,
1005
+ deps: [],
1006
+ target: i0.ɵɵFactoryTarget.Component
1007
+ });
1008
+ static ɵcmp = i0.ɵɵngDeclareComponent({
1009
+ minVersion: "17.0.0",
1010
+ version: "22.2.0",
1011
+ type: NgssmRemoteCallErrorComponent,
1012
+ isStandalone: true,
1013
+ selector: "ngssm-remote-call-error",
1014
+ inputs: { remoteCallId: {
1015
+ classPropertyName: "remoteCallId",
1016
+ publicName: "remoteCallId",
1017
+ isSignal: true,
1018
+ isRequired: false,
1019
+ transformFunction: null
1020
+ } },
1021
+ host: { classAttribute: "ngssm-remote-call-error" },
1022
+ ngImport: i0,
1023
+ template: "@if (errorContainerRendered()) {\n <div class=\"ngssm-remote-call-error-container\">\n {{ errorDescription() }}\n\n <button mat-icon-button color=\"warn\" class=\"ngssm-remote-call-error-close-button\" (click)=\"errorContainerRendered.set(false)\">\n <mat-icon class=\"fa-solid fa-square-xmark\"></mat-icon>\n </button>\n </div>\n}\n",
1024
+ dependencies: [
1025
+ {
1026
+ kind: "ngmodule",
1027
+ type: MatButtonModule
1028
+ },
1029
+ {
1030
+ kind: "component",
1031
+ type: i2.MatIconButton,
1032
+ selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
1033
+ exportAs: ["matButton", "matAnchor"]
1034
+ },
1035
+ {
1036
+ kind: "ngmodule",
1037
+ type: MatIconModule
1038
+ },
1039
+ {
1040
+ kind: "component",
1041
+ type: i1$1.MatIcon,
1042
+ selector: "mat-icon",
1043
+ inputs: [
1044
+ "color",
1045
+ "inline",
1046
+ "svgIcon",
1047
+ "fontSet",
1048
+ "fontIcon"
1049
+ ],
1050
+ exportAs: ["matIcon"]
1051
+ }
1052
+ ]
1053
+ });
1054
+ };
1055
+ i0.ɵɵngDeclareClassMetadata({
1056
+ minVersion: "12.0.0",
1057
+ version: "22.2.0",
1058
+ ngImport: i0,
1059
+ type: NgssmRemoteCallErrorComponent,
1060
+ decorators: [{
1061
+ type: Component,
1062
+ args: [{
1063
+ selector: "ngssm-remote-call-error",
1064
+ imports: [MatButtonModule, MatIconModule],
1065
+ host: { class: "ngssm-remote-call-error" },
1066
+ template: "@if (errorContainerRendered()) {\n <div class=\"ngssm-remote-call-error-container\">\n {{ errorDescription() }}\n\n <button mat-icon-button color=\"warn\" class=\"ngssm-remote-call-error-close-button\" (click)=\"errorContainerRendered.set(false)\">\n <mat-icon class=\"fa-solid fa-square-xmark\"></mat-icon>\n </button>\n </div>\n}\n"
1067
+ }]
1068
+ }],
1069
+ ctorParameters: () => [],
1070
+ propDecorators: { remoteCallId: [{
1071
+ type: i0.Input,
1072
+ args: [{
1073
+ isSignal: true,
1074
+ alias: "remoteCallId",
1075
+ required: false
1076
+ }]
1077
+ }] }
1078
+ });
645
1079
  export { DataStatus, LoadRemoteDataAction, NGSSM_REMOTE_CALL_CONFIG, NGSSM_REMOTE_DATA_PROVIDER, NgssmCachesComponent, NgssmCachesDisplayButtonComponent, NgssmRemoteCallActionType, NgssmRemoteCallErrorComponent, NgssmRemoteCallResultAction, NgssmRemoteCallStateInitializer, NgssmRemoteCallStateSpecification, NgssmRemoteDataReloadButtonComponent, RegisterLoadedRemoteDataAction, RemoteCallResultProcessor, RemoteCallStatus, RemoteDataActionType, RemoteDataLoadingGuard, RemoteDataStateSpecification, SetRemoteCallAction, getDefaultRemoteCall, getDefaultRemoteData, isNgssmRemoteCallInProgress, ngssmReloadRemoteData, processRemoteCallError, provideNgssmRemoteCall, provideNgssmRemoteCallConfig, provideNgssmRemoteData, provideRemoteDataFunc, provideRemoteDataProviders, selectNgssmRemoteCallState, selectRemoteCall, selectRemoteData, selectRemoteDataState, updateNgssmRemoteCallState, updateRemoteDataState };
646
- //# sourceMappingURL=ngssm-remote-data.mjs.map
1080
+
1081
+ //# sourceMappingURL=ngssm-remote-data.mjs.map