@rxap/remote-method 21.0.1-dev.0 → 21.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/compodoc/changelog.html +34 -0
  3. package/compodoc/dependencies.html +3 -3
  4. package/compodoc/js/search/search_index.js +2 -2
  5. package/compodoc/properties.html +1 -1
  6. package/docs/documentation.json +197 -243
  7. package/docs/html/classes/BaseRemoteMethod.html +10 -10
  8. package/docs/html/classes/ProxyRemoteMethod.html +10 -10
  9. package/docs/html/classes/RemoteMethodLoader.html +2 -2
  10. package/docs/html/classes/RxapRemoteMethodError.html +5 -5
  11. package/docs/html/functions/RxapRemoteMethod.html +1 -1
  12. package/docs/html/hierarchy.html +1 -1
  13. package/docs/html/index.html +2 -2
  14. package/docs/html/interfaces/BaseRemoteMethodMetadata.html +2 -2
  15. package/docs/html/modules.html +1 -1
  16. package/docs/html/variables/REMOTE_METHOD_META_DATA.html +1 -1
  17. package/docs/html/variables/RXAP_PROXY_REMOTE_METHOD_TARGET.html +1 -1
  18. package/docs/markdown/README.md +1 -1
  19. package/docs/markdown/classes/BaseRemoteMethod.md +31 -31
  20. package/docs/markdown/classes/ProxyRemoteMethod.md +32 -32
  21. package/docs/markdown/classes/RemoteMethodLoader.md +5 -13
  22. package/docs/markdown/classes/RxapRemoteMethodError.md +13 -13
  23. package/docs/markdown/functions/RxapRemoteMethod.md +2 -2
  24. package/docs/markdown/globals.md +2 -2
  25. package/docs/markdown/interfaces/BaseRemoteMethodMetadata.md +4 -4
  26. package/docs/markdown/variables/REMOTE_METHOD_META_DATA.md +2 -2
  27. package/docs/markdown/variables/RXAP_PROXY_REMOTE_METHOD_TARGET.md +2 -2
  28. package/docs/wiki/Class.BaseRemoteMethod.md +30 -30
  29. package/docs/wiki/Class.ProxyRemoteMethod.md +31 -31
  30. package/docs/wiki/Class.RemoteMethodLoader.md +4 -12
  31. package/docs/wiki/Class.RxapRemoteMethodError.md +12 -12
  32. package/docs/wiki/Function.RxapRemoteMethod.md +1 -1
  33. package/docs/wiki/Interface.BaseRemoteMethodMetadata.md +3 -3
  34. package/docs/wiki/Variable.REMOTE_METHOD_META_DATA.md +1 -1
  35. package/docs/wiki/Variable.RXAP_PROXY_REMOTE_METHOD_TARGET.md +1 -1
  36. package/docs/wiki/globals.md +1 -1
  37. package/fesm2022/rxap-remote-method-directive.mjs +159 -305
  38. package/fesm2022/rxap-remote-method-directive.mjs.map +1 -1
  39. package/fesm2022/rxap-remote-method-http-directive.mjs +50 -89
  40. package/fesm2022/rxap-remote-method-http-directive.mjs.map +1 -1
  41. package/fesm2022/rxap-remote-method-http.mjs +5 -12
  42. package/fesm2022/rxap-remote-method-http.mjs.map +1 -1
  43. package/package.json +8 -8
  44. package/types/rxap-remote-method-directive.d.ts +44 -49
  45. package/types/rxap-remote-method-http-directive.d.ts +25 -20
  46. package/types/rxap-remote-method-http.d.ts +1 -2
@@ -1,8 +1,6 @@
1
- import * as i1 from '@rxap/remote-method';
2
1
  import { RxapRemoteMethodError, RemoteMethodLoader } from '@rxap/remote-method';
3
2
  import * as i0 from '@angular/core';
4
- import { InjectionToken, isDevMode, TemplateRef, INJECTOR, ViewContainerRef, ChangeDetectorRef, IterableDiffers, NgZone, Input, Inject, Optional, Self, Directive, EventEmitter, Output, Injector, HostListener } from '@angular/core';
5
- import { take, tap } from 'rxjs/operators';
3
+ import { InjectionToken, inject, TemplateRef, INJECTOR, ViewContainerRef, ChangeDetectorRef, IterableDiffers, input, isDevMode, computed, effect, untracked, Directive, output, linkedSignal, Injector } from '@angular/core';
6
4
  import { __decorate, __metadata } from 'tslib';
7
5
  import { Deprecated, coerceBoolean } from '@rxap/utilities';
8
6
  import { ToggleSubject } from '@rxap/rxjs';
@@ -44,16 +42,33 @@ class RecordViewTuple {
44
42
  }
45
43
  }
46
44
  class RemoteMethodTemplateCollectionDirective {
47
- constructor(template, remoteMethodLoader, injector, viewContainerRef, cdr, differs, zone, remoteMethodToken) {
48
- this.template = template;
49
- this.remoteMethodLoader = remoteMethodLoader;
50
- this.injector = injector;
51
- this.viewContainerRef = viewContainerRef;
52
- this.cdr = cdr;
53
- this.differs = differs;
54
- this.zone = zone;
55
- this.remoteMethodToken = remoteMethodToken;
56
- this.withoutParameters = false;
45
+ set data(data) {
46
+ this._data = data;
47
+ this._dirty = true;
48
+ }
49
+ /**
50
+ * Asserts the correct type of the context for the template that `NgForOf` will render.
51
+ *
52
+ * The presence of this method is a signal to the Ivy template type-check compiler that the
53
+ * `NgForOf` structural directive renders its template with a specific context type.
54
+ */
55
+ static ngTemplateContextGuard(dir, ctx) {
56
+ return true;
57
+ }
58
+ constructor() {
59
+ this.template = inject(TemplateRef);
60
+ this.remoteMethodLoader = inject(RemoteMethodLoader);
61
+ this.injector = inject(INJECTOR);
62
+ this.viewContainerRef = inject(ViewContainerRef);
63
+ this.cdr = inject(ChangeDetectorRef);
64
+ this.differs = inject(IterableDiffers);
65
+ this.remoteMethodToken = inject(RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, { optional: true, self: true });
66
+ this.parameters = input(undefined, { ...(ngDevMode ? { debugName: "parameters" } : /* istanbul ignore next */ {}), alias: "rxapRemoteMethodCollectionParameters" });
67
+ // eslint-disable-next-line @angular-eslint/no-input-rename
68
+ this.emptyTemplate = input(undefined, { ...(ngDevMode ? { debugName: "emptyTemplate" } : /* istanbul ignore next */ {}), alias: "rxapRemoteMethodCollectionEmpty" });
69
+ // eslint-disable-next-line @angular-eslint/no-input-rename
70
+ this.errorTemplate = input(undefined, { ...(ngDevMode ? { debugName: "errorTemplate" } : /* istanbul ignore next */ {}), alias: "rxapRemoteMethodCollectionError" });
71
+ this.withoutParameters = input(false, { ...(ngDevMode ? { debugName: "withoutParameters" } : /* istanbul ignore next */ {}), alias: "rxapRemoteMethodCollectionWithoutParameters" });
57
72
  this._differ = null;
58
73
  this._dirty = true;
59
74
  /**
@@ -92,94 +107,68 @@ class RemoteMethodTemplateCollectionDirective {
92
107
  * @private
93
108
  */
94
109
  this._errorTemplateViewRef = null;
110
+ /**
111
+ * A function that defines how to track changes for items in the iterable.
112
+ *
113
+ * When items are added, moved, or removed in the iterable,
114
+ * the directive must re-render the appropriate DOM nodes.
115
+ * To minimize churn in the DOM, only nodes that have changed
116
+ * are re-rendered.
117
+ *
118
+ * By default, the change detector assumes that
119
+ * the object instance identifies the node in the iterable.
120
+ * When this function is supplied, the directive uses
121
+ * the result of calling this function to identify the item node,
122
+ * rather than the identity of the object itself.
123
+ *
124
+ * The function receives two inputs,
125
+ * the iteration index and the node object ID.
126
+ */
127
+ this.trackBy = input(undefined, { ...(ngDevMode ? { debugName: "trackBy" } : /* istanbul ignore next */ {}), alias: 'rxapRemoteMethodCollectionTrackBy',
128
+ transform: (fn) => {
129
+ if (isDevMode() && fn != null && typeof fn !== 'function') {
130
+ console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. ` +
131
+ `See https://angular.io/api/common/NgForOf#change-propagation for more information.`);
132
+ }
133
+ return fn;
134
+ } });
135
+ this.remoteMethodOrIdOrToken = input(undefined, { ...(ngDevMode ? { debugName: "remoteMethodOrIdOrToken" } : /* istanbul ignore next */ {}), alias: 'rxapRemoteMethodCollectionCall' });
136
+ this._remoteMethodOrIdOrToken = computed(() => this.remoteMethodOrIdOrToken() || this.remoteMethodToken, ...(ngDevMode ? [{ debugName: "_remoteMethodOrIdOrToken" }] : /* istanbul ignore next */ []));
95
137
  /**
96
138
  * Holds the data that should be displayed
97
139
  * @private
98
140
  */
99
141
  this._data = null;
100
- if (this.remoteMethodToken) {
101
- this._remoteMethodOrIdOrToken = this.remoteMethodToken;
102
- }
103
- }
104
- get trackBy() {
105
- return this._trackByFn;
106
- }
107
- /**
108
- * A function that defines how to track changes for items in the iterable.
109
- *
110
- * When items are added, moved, or removed in the iterable,
111
- * the directive must re-render the appropriate DOM nodes.
112
- * To minimize churn in the DOM, only nodes that have changed
113
- * are re-rendered.
114
- *
115
- * By default, the change detector assumes that
116
- * the object instance identifies the node in the iterable.
117
- * When this function is supplied, the directive uses
118
- * the result of calling this function to identify the item node,
119
- * rather than the identity of the object itself.
120
- *
121
- * The function receives two inputs,
122
- * the iteration index and the node object ID.
123
- */
124
- set trackBy(fn) {
125
- if (isDevMode() && fn != null && typeof fn !== 'function') {
126
- // TODO(vicb): use a log service once there is a public one available
127
- if (console && console.warn) {
128
- console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. ` +
129
- `See https://angular.io/api/common/NgForOf#change-propagation for more information.`);
142
+ // re-run whenever the bound parameters change
143
+ effect(() => {
144
+ const parameters = this.parameters();
145
+ if (parameters !== undefined) {
146
+ untracked(() => this.call(parameters));
130
147
  }
131
- }
132
- this._trackByFn = fn;
133
- }
134
- // eslint-disable-next-line @angular-eslint/no-input-rename
135
- set remoteMethodOrIdOrToken(value) {
136
- if (value) {
137
- this._remoteMethodOrIdOrToken = value;
138
- }
139
- }
140
- set data(data) {
141
- this._data = data;
142
- this._dirty = true;
143
- }
144
- /**
145
- * Asserts the correct type of the context for the template that `NgForOf` will render.
146
- *
147
- * The presence of this method is a signal to the Ivy template type-check compiler that the
148
- * `NgForOf` structural directive renders its template with a specific context type.
149
- */
150
- static ngTemplateContextGuard(dir, ctx) {
151
- return true;
152
- }
153
- ngOnChanges(changes) {
154
- const parametersChanges = changes['parameters'];
155
- if (parametersChanges) {
156
- this.call(parametersChanges.currentValue);
157
- }
148
+ });
158
149
  }
159
150
  ngOnInit() {
160
- if (this.withoutParameters) {
151
+ if (this.withoutParameters()) {
161
152
  this.call();
162
153
  }
163
154
  }
164
155
  call(parameters) {
165
- this.zone.onStable.pipe(take(1), tap(() => {
166
- this.zone.run(() => {
167
- this.remoteMethodLoader
168
- .call$(this._remoteMethodOrIdOrToken, parameters, undefined, this.injector)
169
- .then(response => {
170
- // guard against non-array responses (null/undefined/scalar) to
171
- // avoid reading .length off a non-iterable and crashing
172
- const isArray = Array.isArray(response);
173
- this._empty = !isArray || response.length === 0;
174
- this._data = isArray ? response : [];
175
- this.cdr.detectChanges();
176
- })
177
- .catch(error => {
178
- this._error = error;
179
- this.cdr.detectChanges();
180
- });
181
- });
182
- })).subscribe();
156
+ this.remoteMethodLoader
157
+ .call$(this._remoteMethodOrIdOrToken(), parameters, undefined, this.injector)
158
+ .then(response => {
159
+ // guard against non-array responses (null/undefined/scalar) to
160
+ // avoid reading .length off a non-iterable and crashing
161
+ const isArray = Array.isArray(response);
162
+ // a successful call clears a previous error, otherwise the error template sticks forever
163
+ this._error = null;
164
+ this._empty = !isArray || response.length === 0;
165
+ this._data = isArray ? response : [];
166
+ this.cdr.detectChanges();
167
+ })
168
+ .catch(error => {
169
+ this._error = error;
170
+ this.cdr.detectChanges();
171
+ });
183
172
  }
184
173
  /**
185
174
  * Applies the changes when needed.
@@ -188,8 +177,9 @@ class RemoteMethodTemplateCollectionDirective {
188
177
  if (this._error !== null) {
189
178
  this.viewContainerRef.clear();
190
179
  this._differ = null;
191
- if (this.errorTemplate) {
192
- this._errorTemplateViewRef = this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
180
+ const errorTemplate = this.errorTemplate();
181
+ if (errorTemplate) {
182
+ this._errorTemplateViewRef = this.viewContainerRef.createEmbeddedView(errorTemplate, {
193
183
  $implicit: this._error,
194
184
  message: this._error.message,
195
185
  name: this._error.name,
@@ -200,8 +190,9 @@ class RemoteMethodTemplateCollectionDirective {
200
190
  this.viewContainerRef.clear();
201
191
  this._differ = null;
202
192
  // attaches the empty template if the data source is empty
203
- if (this.emptyTemplate) {
204
- this._emptyTemplateViewRef = this.viewContainerRef.createEmbeddedView(this.emptyTemplate);
193
+ const emptyTemplate = this.emptyTemplate();
194
+ if (emptyTemplate) {
195
+ this._emptyTemplateViewRef = this.viewContainerRef.createEmbeddedView(emptyTemplate);
205
196
  }
206
197
  }
207
198
  else if (this._empty === false) {
@@ -223,7 +214,7 @@ class RemoteMethodTemplateCollectionDirective {
223
214
  const value = this._data;
224
215
  if (!this._differ && value) {
225
216
  try {
226
- this._differ = this.differs.find(value).create(this.trackBy);
217
+ this._differ = this.differs.find(value).create(this.trackBy());
227
218
  }
228
219
  catch {
229
220
  throw new Error(`Cannot find a differ supporting object '${value}' of type '${getTypeName(value)}'. NgFor only supports binding to Iterables such as Arrays.`);
@@ -275,8 +266,8 @@ class RemoteMethodTemplateCollectionDirective {
275
266
  perViewChange(view, record) {
276
267
  view.context.$implicit = record.item;
277
268
  }
278
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RemoteMethodTemplateCollectionDirective, deps: [{ token: TemplateRef }, { token: RemoteMethodLoader }, { token: INJECTOR }, { token: ViewContainerRef }, { token: ChangeDetectorRef }, { token: IterableDiffers }, { token: NgZone }, { token: RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
279
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RemoteMethodTemplateCollectionDirective, isStandalone: true, selector: "[rxapRemoteMethodCollection]", inputs: { parameters: ["rxapRemoteMethodCollectionParameters", "parameters"], emptyTemplate: ["rxapRemoteMethodCollectionEmpty", "emptyTemplate"], errorTemplate: ["rxapRemoteMethodCollectionError", "errorTemplate"], withoutParameters: ["rxapRemoteMethodCollectionWithoutParameters", "withoutParameters"], trackBy: ["rxapRemoteMethodCollectionTrackBy", "trackBy"], remoteMethodOrIdOrToken: ["rxapRemoteMethodCollectionCall", "remoteMethodOrIdOrToken"] }, exportAs: ["rxapRemoteMethodCollection"], usesOnChanges: true, ngImport: i0 }); }
269
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RemoteMethodTemplateCollectionDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
270
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RemoteMethodTemplateCollectionDirective, isStandalone: true, selector: "[rxapRemoteMethodCollection]", inputs: { parameters: { classPropertyName: "parameters", publicName: "rxapRemoteMethodCollectionParameters", isSignal: true, isRequired: false, transformFunction: null }, emptyTemplate: { classPropertyName: "emptyTemplate", publicName: "rxapRemoteMethodCollectionEmpty", isSignal: true, isRequired: false, transformFunction: null }, errorTemplate: { classPropertyName: "errorTemplate", publicName: "rxapRemoteMethodCollectionError", isSignal: true, isRequired: false, transformFunction: null }, withoutParameters: { classPropertyName: "withoutParameters", publicName: "rxapRemoteMethodCollectionWithoutParameters", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "rxapRemoteMethodCollectionTrackBy", isSignal: true, isRequired: false, transformFunction: null }, remoteMethodOrIdOrToken: { classPropertyName: "remoteMethodOrIdOrToken", publicName: "rxapRemoteMethodCollectionCall", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["rxapRemoteMethodCollection"], ngImport: i0 }); }
280
271
  }
281
272
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RemoteMethodTemplateCollectionDirective, decorators: [{
282
273
  type: Directive,
@@ -285,110 +276,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
285
276
  exportAs: 'rxapRemoteMethodCollection',
286
277
  standalone: true,
287
278
  }]
288
- }], ctorParameters: () => [{ type: i0.TemplateRef, decorators: [{
289
- type: Inject,
290
- args: [TemplateRef]
291
- }] }, { type: i1.RemoteMethodLoader, decorators: [{
292
- type: Inject,
293
- args: [RemoteMethodLoader]
294
- }] }, { type: i0.Injector, decorators: [{
295
- type: Inject,
296
- args: [INJECTOR]
297
- }] }, { type: i0.ViewContainerRef, decorators: [{
298
- type: Inject,
299
- args: [ViewContainerRef]
300
- }] }, { type: i0.ChangeDetectorRef, decorators: [{
301
- type: Inject,
302
- args: [ChangeDetectorRef]
303
- }] }, { type: i0.IterableDiffers, decorators: [{
304
- type: Inject,
305
- args: [IterableDiffers]
306
- }] }, { type: i0.NgZone, decorators: [{
307
- type: Inject,
308
- args: [NgZone]
309
- }] }, { type: undefined, decorators: [{
310
- type: Optional
311
- }, {
312
- type: Self
313
- }, {
314
- type: Inject,
315
- args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
316
- }] }], propDecorators: { parameters: [{
317
- type: Input,
318
- args: ['rxapRemoteMethodCollectionParameters']
319
- }], emptyTemplate: [{
320
- type: Input,
321
- args: ['rxapRemoteMethodCollectionEmpty']
322
- }], errorTemplate: [{
323
- type: Input,
324
- args: ['rxapRemoteMethodCollectionError']
325
- }], withoutParameters: [{
326
- type: Input,
327
- args: ['rxapRemoteMethodCollectionWithoutParameters']
328
- }], trackBy: [{
329
- type: Input,
330
- args: ['rxapRemoteMethodCollectionTrackBy']
331
- }], remoteMethodOrIdOrToken: [{
332
- type: Input,
333
- args: ['rxapRemoteMethodCollectionCall']
334
- }] } });
279
+ }], ctorParameters: () => [], propDecorators: { parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodCollectionParameters", required: false }] }], emptyTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodCollectionEmpty", required: false }] }], errorTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodCollectionError", required: false }] }], withoutParameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodCollectionWithoutParameters", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodCollectionTrackBy", required: false }] }], remoteMethodOrIdOrToken: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodCollectionCall", required: false }] }] } });
335
280
 
336
281
  class RemoteMethodTemplateDirective {
337
- constructor(template, remoteMethodLoader, injector, viewContainerRef, cdr, remoteMethodToken) {
338
- this.template = template;
339
- this.remoteMethodLoader = remoteMethodLoader;
340
- this.injector = injector;
341
- this.viewContainerRef = viewContainerRef;
342
- this.cdr = cdr;
343
- this.remoteMethodToken = remoteMethodToken;
282
+ // !! add generation of concrete template context guard to openapi schematics !!
283
+ static ngTemplateContextGuard(dir, ctx) {
284
+ return true;
285
+ }
286
+ constructor() {
287
+ this.template = inject(TemplateRef);
288
+ this.remoteMethodLoader = inject(RemoteMethodLoader);
289
+ this.injector = inject(INJECTOR);
290
+ this.viewContainerRef = inject(ViewContainerRef);
291
+ this.cdr = inject(ChangeDetectorRef);
292
+ this.remoteMethodToken = inject(RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, { optional: true, self: true });
344
293
  // TODO : remove template context Guard
345
294
  // the template context Guard must be defined with a concrete context type
346
295
  // else the context guard is resolved to any
347
296
  // For each child directive that should have a template context guard
348
297
  // the template context guard must be defined
349
298
  // eslint-disable-next-line @angular-eslint/no-output-rename
350
- this.executed$ = new EventEmitter();
299
+ this.executed$ = output({ alias: 'executed' });
351
300
  // eslint-disable-next-line @angular-eslint/no-output-rename
352
- this.failure$ = new EventEmitter();
301
+ this.failure$ = output({ alias: 'failure' });
353
302
  // eslint-disable-next-line @angular-eslint/no-output-rename
354
- this.successful$ = new EventEmitter();
303
+ this.successful$ = output({ alias: 'successful' });
304
+ this.metadata = input(undefined, { ...(ngDevMode ? { debugName: "metadata" } : /* istanbul ignore next */ {}), alias: "rxapRemoteMethodMetadata" });
355
305
  /**
356
306
  * true - a remote method call is in progress
357
307
  */
358
308
  this.executing$ = new ToggleSubject();
359
- this.withoutParameters = false;
360
- this.embedded = new EventEmitter();
361
- if (this.remoteMethodToken) {
362
- this._remoteMethodOrIdOrToken = this.remoteMethodToken;
363
- }
364
- }
365
- // eslint-disable-next-line @angular-eslint/no-input-rename
366
- set remoteMethodOrIdOrToken(value) {
367
- if (value) {
368
- this._remoteMethodOrIdOrToken = value;
369
- }
370
- }
371
- // !! add generation of concrete template context guard to openapi schematics !!
372
- static ngTemplateContextGuard(dir, ctx) {
373
- return true;
374
- }
375
- ngOnChanges(changes) {
376
- const parametersChanges = changes['parameters'];
377
- if (parametersChanges) {
378
- this.execute(parametersChanges.currentValue);
379
- }
309
+ this.parameters = input(undefined, { ...(ngDevMode ? { debugName: "parameters" } : /* istanbul ignore next */ {}), alias: "rxapRemoteMethodParameters" });
310
+ this.currentParameters = linkedSignal(() => this.parameters(), ...(ngDevMode ? [{ debugName: "currentParameters" }] : /* istanbul ignore next */ []));
311
+ // eslint-disable-next-line @angular-eslint/no-input-rename
312
+ this.errorTemplate = input(undefined, { ...(ngDevMode ? { debugName: "errorTemplate" } : /* istanbul ignore next */ {}), alias: "rxapRemoteMethodError" });
313
+ // eslint-disable-next-line @angular-eslint/no-input-rename
314
+ this.loadingTemplate = input(undefined, { ...(ngDevMode ? { debugName: "loadingTemplate" } : /* istanbul ignore next */ {}), alias: "rxapRemoteMethodLoading" });
315
+ this.withoutParameters = input(false, { ...(ngDevMode ? { debugName: "withoutParameters" } : /* istanbul ignore next */ {}), alias: "rxapRemoteMethodWithoutParameters" });
316
+ this.embedded = output();
317
+ this.remoteMethodOrIdOrToken = input(undefined, { ...(ngDevMode ? { debugName: "remoteMethodOrIdOrToken" } : /* istanbul ignore next */ {}), alias: 'rxapRemoteMethodCall' });
318
+ this._remoteMethodOrIdOrToken = computed(() => this.remoteMethodOrIdOrToken() || this.remoteMethodToken, ...(ngDevMode ? [{ debugName: "_remoteMethodOrIdOrToken" }] : /* istanbul ignore next */ []));
319
+ // re-run whenever the bound parameters change
320
+ effect(() => {
321
+ const parameters = this.parameters();
322
+ if (parameters !== undefined) {
323
+ untracked(() => this.execute(parameters));
324
+ }
325
+ });
380
326
  }
381
327
  ngOnInit() {
382
328
  this.renderLoadingTemplate();
383
- if (this.withoutParameters) {
329
+ if (this.withoutParameters()) {
384
330
  this.execute();
385
331
  }
386
332
  }
387
- async execute(parameters = this.parameters) {
333
+ async execute(parameters = this.currentParameters()) {
388
334
  this.executing$.enable();
389
335
  this.renderLoadingTemplate();
390
336
  try {
391
- const result = await this.remoteMethodLoader.call$(this._remoteMethodOrIdOrToken, parameters, this.metadata, this.injector);
337
+ const result = await this.remoteMethodLoader.call$(this._remoteMethodOrIdOrToken(), parameters, this.metadata(), this.injector);
392
338
  this.executed(result);
393
339
  this.renderTemplate(result);
394
340
  this.successful(result);
@@ -415,7 +361,7 @@ class RemoteMethodTemplateDirective {
415
361
  this.updateParameters({ [parameterKey]: value });
416
362
  }
417
363
  updateParameters(parameters) {
418
- this.parameters = { ...(this.parameters ?? {}), ...parameters };
364
+ this.currentParameters.set({ ...(this.currentParameters() ?? {}), ...parameters });
419
365
  }
420
366
  executed(result) {
421
367
  this.executed$.emit(result);
@@ -432,8 +378,9 @@ class RemoteMethodTemplateDirective {
432
378
  this.viewContainerRef.createEmbeddedView(this.template, { $implicit: result });
433
379
  }
434
380
  catch (error) {
435
- if (this.errorTemplate) {
436
- this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
381
+ const errorTemplate = this.errorTemplate();
382
+ if (errorTemplate) {
383
+ this.viewContainerRef.createEmbeddedView(errorTemplate, {
437
384
  $implicit: error,
438
385
  message: error.message,
439
386
  });
@@ -444,13 +391,14 @@ class RemoteMethodTemplateDirective {
444
391
  this.cdr.detectChanges();
445
392
  }
446
393
  renderLoadingTemplate() {
447
- if (this.loadingTemplate) {
394
+ const loadingTemplate = this.loadingTemplate();
395
+ if (loadingTemplate) {
448
396
  this.viewContainerRef.clear();
449
- this.viewContainerRef.createEmbeddedView(this.loadingTemplate);
397
+ this.viewContainerRef.createEmbeddedView(loadingTemplate);
450
398
  }
451
399
  }
452
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RemoteMethodTemplateDirective, deps: [{ token: TemplateRef }, { token: RemoteMethodLoader }, { token: INJECTOR }, { token: ViewContainerRef }, { token: ChangeDetectorRef }, { token: RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
453
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RemoteMethodTemplateDirective, isStandalone: true, selector: "[rxapRemoteMethod]", inputs: { metadata: ["rxapRemoteMethodMetadata", "metadata"], parameters: ["rxapRemoteMethodParameters", "parameters"], errorTemplate: ["rxapRemoteMethodError", "errorTemplate"], loadingTemplate: ["rxapRemoteMethodLoading", "loadingTemplate"], withoutParameters: ["rxapRemoteMethodWithoutParameters", "withoutParameters"], remoteMethodOrIdOrToken: ["rxapRemoteMethodCall", "remoteMethodOrIdOrToken"] }, outputs: { executed$: "executed", failure$: "failure", successful$: "successful", embedded: "embedded" }, exportAs: ["rxapRemoteMethod"], usesOnChanges: true, ngImport: i0 }); }
400
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RemoteMethodTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
401
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RemoteMethodTemplateDirective, isStandalone: true, selector: "[rxapRemoteMethod]", inputs: { metadata: { classPropertyName: "metadata", publicName: "rxapRemoteMethodMetadata", isSignal: true, isRequired: false, transformFunction: null }, parameters: { classPropertyName: "parameters", publicName: "rxapRemoteMethodParameters", isSignal: true, isRequired: false, transformFunction: null }, errorTemplate: { classPropertyName: "errorTemplate", publicName: "rxapRemoteMethodError", isSignal: true, isRequired: false, transformFunction: null }, loadingTemplate: { classPropertyName: "loadingTemplate", publicName: "rxapRemoteMethodLoading", isSignal: true, isRequired: false, transformFunction: null }, withoutParameters: { classPropertyName: "withoutParameters", publicName: "rxapRemoteMethodWithoutParameters", isSignal: true, isRequired: false, transformFunction: null }, remoteMethodOrIdOrToken: { classPropertyName: "remoteMethodOrIdOrToken", publicName: "rxapRemoteMethodCall", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { executed$: "executed", failure$: "failure", successful$: "successful", embedded: "embedded" }, exportAs: ["rxapRemoteMethod"], ngImport: i0 }); }
454
402
  }
455
403
  __decorate([
456
404
  Deprecated('removed'),
@@ -465,91 +413,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
465
413
  exportAs: 'rxapRemoteMethod',
466
414
  standalone: true,
467
415
  }]
468
- }], ctorParameters: () => [{ type: i0.TemplateRef, decorators: [{
469
- type: Inject,
470
- args: [TemplateRef]
471
- }] }, { type: i1.RemoteMethodLoader, decorators: [{
472
- type: Inject,
473
- args: [RemoteMethodLoader]
474
- }] }, { type: i0.Injector, decorators: [{
475
- type: Inject,
476
- args: [INJECTOR]
477
- }] }, { type: i0.ViewContainerRef, decorators: [{
478
- type: Inject,
479
- args: [ViewContainerRef]
480
- }] }, { type: i0.ChangeDetectorRef, decorators: [{
481
- type: Inject,
482
- args: [ChangeDetectorRef]
483
- }] }, { type: undefined, decorators: [{
484
- type: Optional
485
- }, {
486
- type: Self
487
- }, {
488
- type: Inject,
489
- args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
490
- }] }], propDecorators: { executed$: [{
491
- type: Output,
492
- args: ['executed']
493
- }], failure$: [{
494
- type: Output,
495
- args: ['failure']
496
- }], successful$: [{
497
- type: Output,
498
- args: ['successful']
499
- }], metadata: [{
500
- type: Input,
501
- args: ['rxapRemoteMethodMetadata']
502
- }], parameters: [{
503
- type: Input,
504
- args: ['rxapRemoteMethodParameters']
505
- }], errorTemplate: [{
506
- type: Input,
507
- args: ['rxapRemoteMethodError']
508
- }], loadingTemplate: [{
509
- type: Input,
510
- args: ['rxapRemoteMethodLoading']
511
- }], withoutParameters: [{
512
- type: Input,
513
- args: ['rxapRemoteMethodWithoutParameters']
514
- }], embedded: [{
515
- type: Output
516
- }], remoteMethodOrIdOrToken: [{
517
- type: Input,
518
- args: ['rxapRemoteMethodCall']
519
- }], call: [] } });
416
+ }], ctorParameters: () => [], propDecorators: { executed$: [{ type: i0.Output, args: ["executed"] }], failure$: [{ type: i0.Output, args: ["failure"] }], successful$: [{ type: i0.Output, args: ["successful"] }], metadata: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodMetadata", required: false }] }], parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodParameters", required: false }] }], errorTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodError", required: false }] }], loadingTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodLoading", required: false }] }], withoutParameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodWithoutParameters", required: false }] }], embedded: [{ type: i0.Output, args: ["embedded"] }], remoteMethodOrIdOrToken: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethodCall", required: false }] }], call: [] } });
520
417
 
521
418
  class RemoteMethodDirective {
522
- constructor(remoteMethodLoader, injector = Injector.NULL, remoteMethodToken) {
523
- this.remoteMethodLoader = remoteMethodLoader;
524
- this.injector = injector;
525
- this.remoteMethodToken = remoteMethodToken;
419
+ constructor() {
420
+ this.remoteMethodLoader = inject(RemoteMethodLoader);
421
+ this.injector = inject(INJECTOR) ?? Injector.NULL;
422
+ this.remoteMethodToken = inject(RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, { optional: true, self: true });
423
+ this.parameters = input(...(ngDevMode ? [undefined, { debugName: "parameters" }] : /* istanbul ignore next */ []));
424
+ this.currentParameters = linkedSignal(() => this.parameters(), ...(ngDevMode ? [{ debugName: "currentParameters" }] : /* istanbul ignore next */ []));
425
+ this.metadata = input(...(ngDevMode ? [undefined, { debugName: "metadata" }] : /* istanbul ignore next */ []));
526
426
  // eslint-disable-next-line @angular-eslint/no-output-rename
527
- this.executed$ = new EventEmitter();
427
+ this.executed$ = output({ alias: 'executed' });
528
428
  // eslint-disable-next-line @angular-eslint/no-output-rename
529
- this.failure$ = new EventEmitter();
429
+ this.failure$ = output({ alias: 'failure' });
530
430
  // eslint-disable-next-line @angular-eslint/no-output-rename
531
- this.successful$ = new EventEmitter();
532
- this.immediately = false;
431
+ this.successful$ = output({ alias: 'successful' });
432
+ this.immediately = input(false, ...(ngDevMode ? [{ debugName: "immediately" }] : /* istanbul ignore next */ []));
533
433
  /**
534
434
  * true - a remote method call is in progress
535
435
  */
536
436
  this.executing$ = new ToggleSubject();
537
- this._hasConfirmDirective = false;
538
- if (this.remoteMethodToken) {
539
- this._remoteMethodOrIdOrToken = this.remoteMethodToken;
540
- }
541
- }
542
- set remoteMethodOrIdOrToken(value) {
543
- if (value) {
544
- this._remoteMethodOrIdOrToken = value;
545
- }
546
- }
547
- // eslint-disable-next-line @angular-eslint/no-input-rename
548
- set hasConfirmDirective(value) {
549
- this._hasConfirmDirective = coerceBoolean(value);
437
+ this.remoteMethodOrIdOrToken = input(undefined, { ...(ngDevMode ? { debugName: "remoteMethodOrIdOrToken" } : /* istanbul ignore next */ {}), alias: 'rxapRemoteMethod' });
438
+ this._remoteMethodOrIdOrToken = computed(() => this.remoteMethodOrIdOrToken() || this.remoteMethodToken, ...(ngDevMode ? [{ debugName: "_remoteMethodOrIdOrToken" }] : /* istanbul ignore next */ []));
439
+ this.hasConfirmDirective = input(false, { ...(ngDevMode ? { debugName: "hasConfirmDirective" } : /* istanbul ignore next */ {}), alias: 'rxapConfirm', transform: coerceBoolean });
550
440
  }
551
441
  ngOnInit() {
552
- if (this.immediately) {
442
+ if (this.immediately()) {
553
443
  this.execute();
554
444
  }
555
445
  }
@@ -557,7 +447,7 @@ class RemoteMethodDirective {
557
447
  this.execute();
558
448
  }
559
449
  onClick() {
560
- if (!this._hasConfirmDirective) {
450
+ if (!this.hasConfirmDirective()) {
561
451
  this.execute();
562
452
  }
563
453
  else {
@@ -567,7 +457,7 @@ class RemoteMethodDirective {
567
457
  async execute() {
568
458
  this.executing$.enable();
569
459
  try {
570
- const result = await this.remoteMethodLoader.call$(this._remoteMethodOrIdOrToken, this.parameters, this.metadata, this.injector);
460
+ const result = await this.remoteMethodLoader.call$(this._remoteMethodOrIdOrToken(), this.currentParameters(), this.metadata(), this.injector);
571
461
  this.executed(result);
572
462
  this.successful(result);
573
463
  }
@@ -585,7 +475,7 @@ class RemoteMethodDirective {
585
475
  this.updateParameters({ [parameterKey]: value });
586
476
  }
587
477
  updateParameters(parameters) {
588
- this.parameters = { ...(this.parameters ?? {}), ...parameters };
478
+ this.currentParameters.set({ ...(this.currentParameters() ?? {}), ...parameters });
589
479
  }
590
480
  executed(result) {
591
481
  this.executed$.emit(result);
@@ -602,12 +492,12 @@ class RemoteMethodDirective {
602
492
  */
603
493
  async call() {
604
494
  this.executing$.enable();
605
- const result = await this.remoteMethodLoader.call$(this._remoteMethodOrIdOrToken, this.parameters, this.metadata, this.injector);
495
+ const result = await this.remoteMethodLoader.call$(this._remoteMethodOrIdOrToken(), this.currentParameters(), this.metadata(), this.injector);
606
496
  this.executing$.disable();
607
497
  return result;
608
498
  }
609
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RemoteMethodDirective, deps: [{ token: RemoteMethodLoader }, { token: INJECTOR }, { token: RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
610
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.9", type: RemoteMethodDirective, isStandalone: true, selector: "[rxapRemoteMethod]", inputs: { parameters: "parameters", metadata: "metadata", immediately: "immediately", remoteMethodOrIdOrToken: ["rxapRemoteMethod", "remoteMethodOrIdOrToken"], hasConfirmDirective: ["rxapConfirm", "hasConfirmDirective"] }, outputs: { executed$: "executed", failure$: "failure", successful$: "successful" }, host: { listeners: { "confirmed": "onConfirmed()", "click": "onClick()" } }, exportAs: ["rxapRemoteMethod"], ngImport: i0 }); }
499
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: RemoteMethodDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
500
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.9", type: RemoteMethodDirective, isStandalone: true, selector: "[rxapRemoteMethod]", inputs: { parameters: { classPropertyName: "parameters", publicName: "parameters", isSignal: true, isRequired: false, transformFunction: null }, metadata: { classPropertyName: "metadata", publicName: "metadata", isSignal: true, isRequired: false, transformFunction: null }, immediately: { classPropertyName: "immediately", publicName: "immediately", isSignal: true, isRequired: false, transformFunction: null }, remoteMethodOrIdOrToken: { classPropertyName: "remoteMethodOrIdOrToken", publicName: "rxapRemoteMethod", isSignal: true, isRequired: false, transformFunction: null }, hasConfirmDirective: { classPropertyName: "hasConfirmDirective", publicName: "rxapConfirm", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { executed$: "executed", failure$: "failure", successful$: "successful" }, host: { listeners: { "confirmed": "onConfirmed()", "click": "onClick()" } }, exportAs: ["rxapRemoteMethod"], ngImport: i0 }); }
611
501
  }
612
502
  __decorate([
613
503
  Deprecated('removed'),
@@ -621,48 +511,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImpor
621
511
  selector: '[rxapRemoteMethod]',
622
512
  exportAs: 'rxapRemoteMethod',
623
513
  standalone: true,
514
+ host: {
515
+ '(confirmed)': 'onConfirmed()',
516
+ '(click)': 'onClick()',
517
+ },
624
518
  }]
625
- }], ctorParameters: () => [{ type: i1.RemoteMethodLoader, decorators: [{
626
- type: Inject,
627
- args: [RemoteMethodLoader]
628
- }] }, { type: i0.Injector, decorators: [{
629
- type: Inject,
630
- args: [INJECTOR]
631
- }] }, { type: undefined, decorators: [{
632
- type: Optional
633
- }, {
634
- type: Self
635
- }, {
636
- type: Inject,
637
- args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
638
- }] }], propDecorators: { parameters: [{
639
- type: Input
640
- }], metadata: [{
641
- type: Input
642
- }], executed$: [{
643
- type: Output,
644
- args: ['executed']
645
- }], failure$: [{
646
- type: Output,
647
- args: ['failure']
648
- }], successful$: [{
649
- type: Output,
650
- args: ['successful']
651
- }], immediately: [{
652
- type: Input
653
- }], remoteMethodOrIdOrToken: [{
654
- type: Input,
655
- args: ['rxapRemoteMethod']
656
- }], hasConfirmDirective: [{
657
- type: Input,
658
- args: ['rxapConfirm']
659
- }], onConfirmed: [{
660
- type: HostListener,
661
- args: ['confirmed']
662
- }], onClick: [{
663
- type: HostListener,
664
- args: ['click']
665
- }], call: [] } });
519
+ }], propDecorators: { parameters: [{ type: i0.Input, args: [{ isSignal: true, alias: "parameters", required: false }] }], metadata: [{ type: i0.Input, args: [{ isSignal: true, alias: "metadata", required: false }] }], executed$: [{ type: i0.Output, args: ["executed"] }], failure$: [{ type: i0.Output, args: ["failure"] }], successful$: [{ type: i0.Output, args: ["successful"] }], immediately: [{ type: i0.Input, args: [{ isSignal: true, alias: "immediately", required: false }] }], remoteMethodOrIdOrToken: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapRemoteMethod", required: false }] }], hasConfirmDirective: [{ type: i0.Input, args: [{ isSignal: true, alias: "rxapConfirm", required: false }] }], call: [] } });
666
520
 
667
521
  // region
668
522
  // endregion