@rxap/remote-method 16.0.0-dev.1 → 16.0.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +252 -0
- package/README.md +8 -73
- package/directive/index.d.ts +5 -5
- package/directive/lib/remote-method-template-collection.directive.d.ts +38 -43
- package/directive/lib/remote-method-template.directive.d.ts +7 -12
- package/directive/lib/remote-method.directive.d.ts +7 -12
- package/esm2022/directive/index.mjs +6 -0
- package/esm2022/directive/lib/error.mjs +1 -1
- package/esm2022/directive/lib/remote-method-template-collection.directive.mjs +115 -123
- package/esm2022/directive/lib/remote-method-template.directive.mjs +45 -51
- package/esm2022/directive/lib/remote-method.directive.mjs +28 -37
- package/esm2022/directive/lib/tokens.mjs +1 -1
- package/esm2022/directive/rxap-remote-method-directive.mjs +2 -2
- package/esm2022/http/directive/index.mjs +3 -0
- package/esm2022/http/directive/lib/contenteditable.directive.mjs +8 -24
- package/esm2022/http/directive/lib/http-remote-method.directive.mjs +8 -21
- package/esm2022/http/directive/rxap-remote-method-http-directive.mjs +2 -2
- package/esm2022/http/index.mjs +4 -0
- package/esm2022/http/lib/base-http.remote-method.mjs +19 -20
- package/esm2022/http/lib/http-remote-method.loader.mjs +7 -8
- package/esm2022/http/lib/http.remote-method.mjs +31 -22
- package/esm2022/http/rxap-remote-method-http.mjs +2 -2
- package/esm2022/index.mjs +1 -1
- package/esm2022/lib/base.remote-method.mjs +8 -9
- package/esm2022/lib/error.mjs +1 -1
- package/esm2022/lib/proxy.remote-method.mjs +8 -9
- package/esm2022/lib/remote-method-loader.mjs +7 -8
- package/esm2022/lib/tokens.mjs +1 -1
- package/esm2022/rxap-remote-method.mjs +1 -1
- package/esm2022/testing/index.mjs +2 -0
- package/esm2022/testing/lib/remote-method-testing-loader.mjs +3 -3
- package/esm2022/testing/rxap-remote-method-testing.mjs +2 -2
- package/fesm2022/rxap-remote-method-directive.mjs +174 -191
- package/fesm2022/rxap-remote-method-directive.mjs.map +1 -1
- package/fesm2022/rxap-remote-method-http-directive.mjs +11 -36
- package/fesm2022/rxap-remote-method-http-directive.mjs.map +1 -1
- package/fesm2022/rxap-remote-method-http.mjs +43 -33
- package/fesm2022/rxap-remote-method-http.mjs.map +1 -1
- package/fesm2022/rxap-remote-method-testing.mjs +1 -1
- package/fesm2022/rxap-remote-method-testing.mjs.map +1 -1
- package/fesm2022/rxap-remote-method.mjs +10 -10
- package/fesm2022/rxap-remote-method.mjs.map +1 -1
- package/http/directive/index.d.ts +2 -5
- package/http/directive/lib/contenteditable.directive.d.ts +1 -9
- package/http/directive/lib/http-remote-method.directive.d.ts +2 -7
- package/http/index.d.ts +3 -5
- package/http/lib/base-http.remote-method.d.ts +3 -3
- package/http/lib/http-remote-method.loader.d.ts +2 -2
- package/http/lib/http.remote-method.d.ts +3 -3
- package/lib/base.remote-method.d.ts +2 -2
- package/lib/proxy.remote-method.d.ts +1 -1
- package/lib/remote-method-loader.d.ts +1 -1
- package/package.json +46 -42
- package/testing/index.d.ts +1 -5
- package/testing/lib/remote-method-testing-loader.d.ts +2 -2
- package/LICENSE +0 -24
- package/collection.json +0 -25
- package/directive/public_api.d.ts +0 -5
- package/esm2022/directive/public_api.mjs +0 -6
- package/esm2022/http/directive/public_api.mjs +0 -3
- package/esm2022/http/public_api.mjs +0 -4
- package/esm2022/testing/public_api.mjs +0 -2
- package/http/directive/public_api.d.ts +0 -2
- package/http/public_api.d.ts +0 -3
- package/migration.json +0 -4
- package/src/schematics/base/files/__name@dasherize__.remote-method.ts.template +0 -14
- package/src/schematics/base/index.d.ts +0 -12
- package/src/schematics/base/index.js +0 -116
- package/src/schematics/base/index.js.map +0 -1
- package/src/schematics/base/schema.json +0 -54
- package/src/schematics/directive/index.d.ts +0 -18
- package/src/schematics/directive/index.js +0 -346
- package/src/schematics/directive/index.js.map +0 -1
- package/src/schematics/directive/schema.json +0 -50
- package/src/schematics/http/files/__name@dasherize__.remote-method.ts.template +0 -16
- package/src/schematics/http/index.d.ts +0 -3
- package/src/schematics/http/index.js +0 -26
- package/src/schematics/http/index.js.map +0 -1
- package/src/schematics/http/schema.json +0 -30
- package/src/schematics/ng-add/index.d.ts +0 -2
- package/src/schematics/ng-add/index.js +0 -8
- package/src/schematics/ng-add/index.js.map +0 -1
- package/src/schematics/ng-add/schema.json +0 -7
- package/testing/public_api.d.ts +0 -1
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
import { __decorate, __metadata } from 'tslib';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, EventEmitter, Injector, isDevMode, INJECTOR, Directive, Inject, Optional, Self, Input, Output, HostListener,
|
|
3
|
+
import { InjectionToken, EventEmitter, Injector, isDevMode, INJECTOR, Directive, Inject, Optional, Self, Input, Output, HostListener, TemplateRef, ViewContainerRef, ChangeDetectorRef, IterableDiffers, NgZone } from '@angular/core';
|
|
4
4
|
import * as i1 from '@rxap/remote-method';
|
|
5
5
|
import { RemoteMethodLoader, RxapRemoteMethodError } from '@rxap/remote-method';
|
|
6
6
|
import { coerceBoolean, Required, Deprecated } from '@rxap/utilities';
|
|
7
|
-
import { ToggleSubject } from '@rxap/
|
|
7
|
+
import { ToggleSubject } from '@rxap/rxjs';
|
|
8
8
|
import { take, tap } from 'rxjs/operators';
|
|
9
9
|
|
|
10
10
|
const RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN = new InjectionToken('rxap/remote-method/directive/token');
|
|
11
11
|
|
|
12
12
|
class RemoteMethodDirective {
|
|
13
|
-
set remoteMethodOrIdOrToken(value) {
|
|
14
|
-
if (value) {
|
|
15
|
-
this._remoteMethodOrIdOrToken = value;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
set hasConfirmDirective(value) {
|
|
19
|
-
this._hasConfirmDirective = coerceBoolean(value);
|
|
20
|
-
}
|
|
21
13
|
constructor(remoteMethodLoader, injector = Injector.NULL, remoteMethodToken) {
|
|
22
14
|
this.remoteMethodLoader = remoteMethodLoader;
|
|
23
15
|
this.injector = injector;
|
|
24
16
|
this.remoteMethodToken = remoteMethodToken;
|
|
17
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
25
18
|
this.executed$ = new EventEmitter();
|
|
19
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
26
20
|
this.failure$ = new EventEmitter();
|
|
21
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
27
22
|
this.successful$ = new EventEmitter();
|
|
28
23
|
this.immediately = false;
|
|
29
24
|
/**
|
|
@@ -35,6 +30,15 @@ class RemoteMethodDirective {
|
|
|
35
30
|
this._remoteMethodOrIdOrToken = this.remoteMethodToken;
|
|
36
31
|
}
|
|
37
32
|
}
|
|
33
|
+
set remoteMethodOrIdOrToken(value) {
|
|
34
|
+
if (value) {
|
|
35
|
+
this._remoteMethodOrIdOrToken = value;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
39
|
+
set hasConfirmDirective(value) {
|
|
40
|
+
this._hasConfirmDirective = coerceBoolean(value);
|
|
41
|
+
}
|
|
38
42
|
ngOnInit() {
|
|
39
43
|
if (this.immediately) {
|
|
40
44
|
this.execute();
|
|
@@ -93,8 +97,8 @@ class RemoteMethodDirective {
|
|
|
93
97
|
this.executing$.disable();
|
|
94
98
|
return result;
|
|
95
99
|
}
|
|
96
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.
|
|
97
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.
|
|
100
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RemoteMethodDirective, deps: [{ token: RemoteMethodLoader }, { token: INJECTOR }, { token: RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, optional: true, self: true }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
101
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", 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 }); }
|
|
98
102
|
}
|
|
99
103
|
__decorate([
|
|
100
104
|
Required,
|
|
@@ -106,11 +110,12 @@ __decorate([
|
|
|
106
110
|
__metadata("design:paramtypes", []),
|
|
107
111
|
__metadata("design:returntype", Promise)
|
|
108
112
|
], RemoteMethodDirective.prototype, "call", null);
|
|
109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RemoteMethodDirective, decorators: [{
|
|
110
114
|
type: Directive,
|
|
111
115
|
args: [{
|
|
112
116
|
selector: '[rxapRemoteMethod]',
|
|
113
|
-
exportAs: 'rxapRemoteMethod'
|
|
117
|
+
exportAs: 'rxapRemoteMethod',
|
|
118
|
+
standalone: true,
|
|
114
119
|
}]
|
|
115
120
|
}], ctorParameters: function () { return [{ type: i1.RemoteMethodLoader, decorators: [{
|
|
116
121
|
type: Inject,
|
|
@@ -125,10 +130,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
125
130
|
}, {
|
|
126
131
|
type: Inject,
|
|
127
132
|
args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
|
|
128
|
-
}] }]; }, propDecorators: {
|
|
129
|
-
type: Input,
|
|
130
|
-
args: ['rxapRemoteMethod']
|
|
131
|
-
}], parameters: [{
|
|
133
|
+
}] }]; }, propDecorators: { parameters: [{
|
|
132
134
|
type: Input
|
|
133
135
|
}], metadata: [{
|
|
134
136
|
type: Input
|
|
@@ -143,28 +145,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
143
145
|
args: ['successful']
|
|
144
146
|
}], immediately: [{
|
|
145
147
|
type: Input
|
|
148
|
+
}], _remoteMethodOrIdOrToken: [], remoteMethodOrIdOrToken: [{
|
|
149
|
+
type: Input,
|
|
150
|
+
args: ['rxapRemoteMethod']
|
|
146
151
|
}], hasConfirmDirective: [{
|
|
147
152
|
type: Input,
|
|
148
153
|
args: ['rxapConfirm']
|
|
149
|
-
}],
|
|
154
|
+
}], onConfirmed: [{
|
|
150
155
|
type: HostListener,
|
|
151
156
|
args: ['confirmed']
|
|
152
157
|
}], onClick: [{
|
|
153
158
|
type: HostListener,
|
|
154
159
|
args: ['click']
|
|
155
160
|
}], call: [] } });
|
|
156
|
-
class RemoteMethodDirectiveModule {
|
|
157
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: RemoteMethodDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
158
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: RemoteMethodDirectiveModule, declarations: [RemoteMethodDirective], exports: [RemoteMethodDirective] }); }
|
|
159
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: RemoteMethodDirectiveModule }); }
|
|
160
|
-
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: RemoteMethodDirectiveModule, decorators: [{
|
|
162
|
-
type: NgModule,
|
|
163
|
-
args: [{
|
|
164
|
-
declarations: [RemoteMethodDirective],
|
|
165
|
-
exports: [RemoteMethodDirective]
|
|
166
|
-
}]
|
|
167
|
-
}] });
|
|
168
161
|
|
|
169
162
|
class RemoteMethodTemplateCollectionDirectiveContext {
|
|
170
163
|
constructor($implicit, index, count) {
|
|
@@ -195,54 +188,6 @@ class RecordViewTuple {
|
|
|
195
188
|
}
|
|
196
189
|
}
|
|
197
190
|
class RemoteMethodTemplateCollectionDirective {
|
|
198
|
-
/**
|
|
199
|
-
* Asserts the correct type of the context for the template that `NgForOf` will render.
|
|
200
|
-
*
|
|
201
|
-
* The presence of this method is a signal to the Ivy template type-check compiler that the
|
|
202
|
-
* `NgForOf` structural directive renders its template with a specific context type.
|
|
203
|
-
*/
|
|
204
|
-
static ngTemplateContextGuard(dir, ctx) {
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
set remoteMethodOrIdOrToken(value) {
|
|
208
|
-
if (value) {
|
|
209
|
-
this._remoteMethodOrIdOrToken = value;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* A function that defines how to track changes for items in the iterable.
|
|
214
|
-
*
|
|
215
|
-
* When items are added, moved, or removed in the iterable,
|
|
216
|
-
* the directive must re-render the appropriate DOM nodes.
|
|
217
|
-
* To minimize churn in the DOM, only nodes that have changed
|
|
218
|
-
* are re-rendered.
|
|
219
|
-
*
|
|
220
|
-
* By default, the change detector assumes that
|
|
221
|
-
* the object instance identifies the node in the iterable.
|
|
222
|
-
* When this function is supplied, the directive uses
|
|
223
|
-
* the result of calling this function to identify the item node,
|
|
224
|
-
* rather than the identity of the object itself.
|
|
225
|
-
*
|
|
226
|
-
* The function receives two inputs,
|
|
227
|
-
* the iteration index and the node object ID.
|
|
228
|
-
*/
|
|
229
|
-
set trackBy(fn) {
|
|
230
|
-
if (isDevMode() && fn != null && typeof fn !== 'function') {
|
|
231
|
-
// TODO(vicb): use a log service once there is a public one available
|
|
232
|
-
if (console && console.warn) {
|
|
233
|
-
console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. ` +
|
|
234
|
-
`See https://angular.io/api/common/NgForOf#change-propagation for more information.`);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
this._trackByFn = fn;
|
|
238
|
-
}
|
|
239
|
-
get trackBy() {
|
|
240
|
-
return this._trackByFn;
|
|
241
|
-
}
|
|
242
|
-
set data(data) {
|
|
243
|
-
this._data = data;
|
|
244
|
-
this._dirty = true;
|
|
245
|
-
}
|
|
246
191
|
constructor(template, remoteMethodLoader, injector, viewContainerRef, cdr, differs, zone, remoteMethodToken) {
|
|
247
192
|
this.template = template;
|
|
248
193
|
this.remoteMethodLoader = remoteMethodLoader;
|
|
@@ -254,11 +199,6 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
254
199
|
this.remoteMethodToken = remoteMethodToken;
|
|
255
200
|
this.withoutParameters = false;
|
|
256
201
|
this._differ = null;
|
|
257
|
-
/**
|
|
258
|
-
* Holds the data that should be displayed
|
|
259
|
-
* @private
|
|
260
|
-
*/
|
|
261
|
-
this._data = null;
|
|
262
202
|
this._dirty = true;
|
|
263
203
|
/**
|
|
264
204
|
* Indicates that the remote method returned a empty collection
|
|
@@ -296,12 +236,66 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
296
236
|
* @private
|
|
297
237
|
*/
|
|
298
238
|
this._errorTemplateViewRef = null;
|
|
239
|
+
/**
|
|
240
|
+
* Holds the data that should be displayed
|
|
241
|
+
* @private
|
|
242
|
+
*/
|
|
243
|
+
this._data = null;
|
|
299
244
|
if (this.remoteMethodToken) {
|
|
300
245
|
this._remoteMethodOrIdOrToken = this.remoteMethodToken;
|
|
301
246
|
}
|
|
302
247
|
}
|
|
248
|
+
get trackBy() {
|
|
249
|
+
return this._trackByFn;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* A function that defines how to track changes for items in the iterable.
|
|
253
|
+
*
|
|
254
|
+
* When items are added, moved, or removed in the iterable,
|
|
255
|
+
* the directive must re-render the appropriate DOM nodes.
|
|
256
|
+
* To minimize churn in the DOM, only nodes that have changed
|
|
257
|
+
* are re-rendered.
|
|
258
|
+
*
|
|
259
|
+
* By default, the change detector assumes that
|
|
260
|
+
* the object instance identifies the node in the iterable.
|
|
261
|
+
* When this function is supplied, the directive uses
|
|
262
|
+
* the result of calling this function to identify the item node,
|
|
263
|
+
* rather than the identity of the object itself.
|
|
264
|
+
*
|
|
265
|
+
* The function receives two inputs,
|
|
266
|
+
* the iteration index and the node object ID.
|
|
267
|
+
*/
|
|
268
|
+
set trackBy(fn) {
|
|
269
|
+
if (isDevMode() && fn != null && typeof fn !== 'function') {
|
|
270
|
+
// TODO(vicb): use a log service once there is a public one available
|
|
271
|
+
if (console && console.warn) {
|
|
272
|
+
console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. ` +
|
|
273
|
+
`See https://angular.io/api/common/NgForOf#change-propagation for more information.`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
this._trackByFn = fn;
|
|
277
|
+
}
|
|
278
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
279
|
+
set remoteMethodOrIdOrToken(value) {
|
|
280
|
+
if (value) {
|
|
281
|
+
this._remoteMethodOrIdOrToken = value;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
set data(data) {
|
|
285
|
+
this._data = data;
|
|
286
|
+
this._dirty = true;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Asserts the correct type of the context for the template that `NgForOf` will render.
|
|
290
|
+
*
|
|
291
|
+
* The presence of this method is a signal to the Ivy template type-check compiler that the
|
|
292
|
+
* `NgForOf` structural directive renders its template with a specific context type.
|
|
293
|
+
*/
|
|
294
|
+
static ngTemplateContextGuard(dir, ctx) {
|
|
295
|
+
return true;
|
|
296
|
+
}
|
|
303
297
|
ngOnChanges(changes) {
|
|
304
|
-
const parametersChanges = changes
|
|
298
|
+
const parametersChanges = changes['parameters'];
|
|
305
299
|
if (parametersChanges) {
|
|
306
300
|
this.call(parametersChanges.currentValue);
|
|
307
301
|
}
|
|
@@ -328,43 +322,6 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
328
322
|
});
|
|
329
323
|
})).subscribe();
|
|
330
324
|
}
|
|
331
|
-
applyChanges(changes) {
|
|
332
|
-
const insertTuples = [];
|
|
333
|
-
changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
|
|
334
|
-
if (item.previousIndex == null) {
|
|
335
|
-
// NgForOf is never "null" or "undefined" here because the differ detected
|
|
336
|
-
// that a new item needs to be inserted from the iterable. This implies that
|
|
337
|
-
// there is an iterable value for "_ngForOf".
|
|
338
|
-
const view = this.viewContainerRef.createEmbeddedView(this.template, new RemoteMethodTemplateCollectionDirectiveContext(null, -1, -1), currentIndex === null ? undefined : currentIndex);
|
|
339
|
-
const tuple = new RecordViewTuple(item, view);
|
|
340
|
-
insertTuples.push(tuple);
|
|
341
|
-
}
|
|
342
|
-
else if (currentIndex == null) {
|
|
343
|
-
this.viewContainerRef.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
|
|
344
|
-
}
|
|
345
|
-
else if (adjustedPreviousIndex !== null) {
|
|
346
|
-
const view = this.viewContainerRef.get(adjustedPreviousIndex);
|
|
347
|
-
this.viewContainerRef.move(view, currentIndex);
|
|
348
|
-
const tuple = new RecordViewTuple(item, view);
|
|
349
|
-
insertTuples.push(tuple);
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
for (let i = 0; i < insertTuples.length; i++) {
|
|
353
|
-
this.perViewChange(insertTuples[i].view, insertTuples[i].record);
|
|
354
|
-
}
|
|
355
|
-
for (let i = 0, ilen = this.viewContainerRef.length; i < ilen; i++) {
|
|
356
|
-
const viewRef = this.viewContainerRef.get(i);
|
|
357
|
-
viewRef.context.index = i;
|
|
358
|
-
viewRef.context.count = ilen;
|
|
359
|
-
}
|
|
360
|
-
changes.forEachIdentityChange((record) => {
|
|
361
|
-
const viewRef = this.viewContainerRef.get(record.currentIndex);
|
|
362
|
-
viewRef.context.$implicit = record.item;
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
perViewChange(view, record) {
|
|
366
|
-
view.context.$implicit = record.item;
|
|
367
|
-
}
|
|
368
325
|
/**
|
|
369
326
|
* Applies the changes when needed.
|
|
370
327
|
*/
|
|
@@ -373,7 +330,11 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
373
330
|
this.viewContainerRef.clear();
|
|
374
331
|
this._differ = null;
|
|
375
332
|
if (this.errorTemplate) {
|
|
376
|
-
this._errorTemplateViewRef = this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
333
|
+
this._errorTemplateViewRef = this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
334
|
+
$implicit: this._error,
|
|
335
|
+
message: this._error.message,
|
|
336
|
+
name: this._error.name,
|
|
337
|
+
});
|
|
377
338
|
}
|
|
378
339
|
}
|
|
379
340
|
else if (this._empty === true) {
|
|
@@ -418,18 +379,56 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
418
379
|
}
|
|
419
380
|
}
|
|
420
381
|
}
|
|
421
|
-
|
|
422
|
-
|
|
382
|
+
applyChanges(changes) {
|
|
383
|
+
const insertTuples = [];
|
|
384
|
+
changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
|
|
385
|
+
if (item.previousIndex == null) {
|
|
386
|
+
// NgForOf is never "null" or "undefined" here because the differ detected
|
|
387
|
+
// that a new item needs to be inserted from the iterable. This implies that
|
|
388
|
+
// there is an iterable value for "_ngForOf".
|
|
389
|
+
const view = this.viewContainerRef.createEmbeddedView(this.template, new RemoteMethodTemplateCollectionDirectiveContext(null, -1, -1), currentIndex === null ? undefined : currentIndex);
|
|
390
|
+
const tuple = new RecordViewTuple(item, view);
|
|
391
|
+
insertTuples.push(tuple);
|
|
392
|
+
}
|
|
393
|
+
else if (currentIndex == null) {
|
|
394
|
+
this.viewContainerRef.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
|
|
395
|
+
}
|
|
396
|
+
else if (adjustedPreviousIndex !== null) {
|
|
397
|
+
const view = this.viewContainerRef.get(adjustedPreviousIndex);
|
|
398
|
+
this.viewContainerRef.move(view, currentIndex);
|
|
399
|
+
const tuple = new RecordViewTuple(item, view);
|
|
400
|
+
insertTuples.push(tuple);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
for (let i = 0; i < insertTuples.length; i++) {
|
|
404
|
+
this.perViewChange(insertTuples[i].view, insertTuples[i].record);
|
|
405
|
+
}
|
|
406
|
+
for (let i = 0, ilen = this.viewContainerRef.length; i < ilen; i++) {
|
|
407
|
+
const viewRef = this.viewContainerRef.get(i);
|
|
408
|
+
viewRef.context.index = i;
|
|
409
|
+
viewRef.context.count = ilen;
|
|
410
|
+
}
|
|
411
|
+
changes.forEachIdentityChange((record) => {
|
|
412
|
+
const viewRef = this.viewContainerRef.get(record.currentIndex);
|
|
413
|
+
viewRef.context.$implicit = record.item;
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
perViewChange(view, record) {
|
|
417
|
+
view.context.$implicit = record.item;
|
|
418
|
+
}
|
|
419
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", 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 }); }
|
|
420
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", 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 }); }
|
|
423
421
|
}
|
|
424
422
|
__decorate([
|
|
425
423
|
Required,
|
|
426
424
|
__metadata("design:type", Object)
|
|
427
425
|
], RemoteMethodTemplateCollectionDirective.prototype, "_remoteMethodOrIdOrToken", void 0);
|
|
428
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RemoteMethodTemplateCollectionDirective, decorators: [{
|
|
429
427
|
type: Directive,
|
|
430
428
|
args: [{
|
|
431
429
|
selector: '[rxapRemoteMethodCollection]',
|
|
432
|
-
exportAs: 'rxapRemoteMethodCollection'
|
|
430
|
+
exportAs: 'rxapRemoteMethodCollection',
|
|
431
|
+
standalone: true,
|
|
433
432
|
}]
|
|
434
433
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
435
434
|
type: Inject,
|
|
@@ -459,13 +458,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
459
458
|
}, {
|
|
460
459
|
type: Inject,
|
|
461
460
|
args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
|
|
462
|
-
}] }]; }, propDecorators: {
|
|
463
|
-
type: Input,
|
|
464
|
-
args: ['rxapRemoteMethodCollectionCall']
|
|
465
|
-
}], trackBy: [{
|
|
466
|
-
type: Input,
|
|
467
|
-
args: ['rxapRemoteMethodCollectionTrackBy']
|
|
468
|
-
}], parameters: [{
|
|
461
|
+
}] }]; }, propDecorators: { parameters: [{
|
|
469
462
|
type: Input,
|
|
470
463
|
args: ['rxapRemoteMethodCollectionParameters']
|
|
471
464
|
}], emptyTemplate: [{
|
|
@@ -477,35 +470,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
477
470
|
}], withoutParameters: [{
|
|
478
471
|
type: Input,
|
|
479
472
|
args: ['rxapRemoteMethodCollectionWithoutParameters']
|
|
480
|
-
}],
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
type: NgModule,
|
|
488
|
-
args: [{
|
|
489
|
-
declarations: [RemoteMethodTemplateCollectionDirective],
|
|
490
|
-
exports: [RemoteMethodTemplateCollectionDirective]
|
|
491
|
-
}]
|
|
492
|
-
}] });
|
|
473
|
+
}], trackBy: [{
|
|
474
|
+
type: Input,
|
|
475
|
+
args: ['rxapRemoteMethodCollectionTrackBy']
|
|
476
|
+
}], _remoteMethodOrIdOrToken: [], remoteMethodOrIdOrToken: [{
|
|
477
|
+
type: Input,
|
|
478
|
+
args: ['rxapRemoteMethodCollectionCall']
|
|
479
|
+
}] } });
|
|
493
480
|
|
|
494
481
|
class RemoteMethodTemplateDirective {
|
|
495
|
-
// TODO : remove template context Guard
|
|
496
|
-
// the template context Guard must be defined with a concrete context type
|
|
497
|
-
// else the context guard is resolved to any
|
|
498
|
-
// For each child directive that should have a template context guard
|
|
499
|
-
// the template context guard must be defined
|
|
500
|
-
// !! add generation of concrete template context guard to openapi schematics !!
|
|
501
|
-
static ngTemplateContextGuard(dir, ctx) {
|
|
502
|
-
return true;
|
|
503
|
-
}
|
|
504
|
-
set remoteMethodOrIdOrToken(value) {
|
|
505
|
-
if (value) {
|
|
506
|
-
this._remoteMethodOrIdOrToken = value;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
482
|
constructor(template, remoteMethodLoader, injector, viewContainerRef, cdr, remoteMethodToken) {
|
|
510
483
|
this.template = template;
|
|
511
484
|
this.remoteMethodLoader = remoteMethodLoader;
|
|
@@ -513,8 +486,16 @@ class RemoteMethodTemplateDirective {
|
|
|
513
486
|
this.viewContainerRef = viewContainerRef;
|
|
514
487
|
this.cdr = cdr;
|
|
515
488
|
this.remoteMethodToken = remoteMethodToken;
|
|
489
|
+
// TODO : remove template context Guard
|
|
490
|
+
// the template context Guard must be defined with a concrete context type
|
|
491
|
+
// else the context guard is resolved to any
|
|
492
|
+
// For each child directive that should have a template context guard
|
|
493
|
+
// the template context guard must be defined
|
|
494
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
516
495
|
this.executed$ = new EventEmitter();
|
|
496
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
517
497
|
this.failure$ = new EventEmitter();
|
|
498
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
518
499
|
this.successful$ = new EventEmitter();
|
|
519
500
|
/**
|
|
520
501
|
* true - a remote method call is in progress
|
|
@@ -526,8 +507,18 @@ class RemoteMethodTemplateDirective {
|
|
|
526
507
|
this._remoteMethodOrIdOrToken = this.remoteMethodToken;
|
|
527
508
|
}
|
|
528
509
|
}
|
|
510
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
511
|
+
set remoteMethodOrIdOrToken(value) {
|
|
512
|
+
if (value) {
|
|
513
|
+
this._remoteMethodOrIdOrToken = value;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
// !! add generation of concrete template context guard to openapi schematics !!
|
|
517
|
+
static ngTemplateContextGuard(dir, ctx) {
|
|
518
|
+
return true;
|
|
519
|
+
}
|
|
529
520
|
ngOnChanges(changes) {
|
|
530
|
-
const parametersChanges = changes
|
|
521
|
+
const parametersChanges = changes['parameters'];
|
|
531
522
|
if (parametersChanges) {
|
|
532
523
|
this.execute(parametersChanges.currentValue);
|
|
533
524
|
}
|
|
@@ -571,12 +562,6 @@ class RemoteMethodTemplateDirective {
|
|
|
571
562
|
updateParameters(parameters) {
|
|
572
563
|
this.parameters = { ...(this.parameters ?? {}), ...parameters };
|
|
573
564
|
}
|
|
574
|
-
renderLoadingTemplate() {
|
|
575
|
-
if (this.loadingTemplate) {
|
|
576
|
-
this.viewContainerRef.clear();
|
|
577
|
-
this.viewContainerRef.createEmbeddedView(this.loadingTemplate);
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
565
|
executed(result) {
|
|
581
566
|
this.executed$.emit(result);
|
|
582
567
|
}
|
|
@@ -593,15 +578,24 @@ class RemoteMethodTemplateDirective {
|
|
|
593
578
|
}
|
|
594
579
|
catch (error) {
|
|
595
580
|
if (this.errorTemplate) {
|
|
596
|
-
this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
581
|
+
this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
582
|
+
$implicit: error,
|
|
583
|
+
message: error.message,
|
|
584
|
+
});
|
|
597
585
|
}
|
|
598
586
|
console.error(error.message);
|
|
599
587
|
}
|
|
600
588
|
this.embedded.emit();
|
|
601
589
|
this.cdr.detectChanges();
|
|
602
590
|
}
|
|
603
|
-
|
|
604
|
-
|
|
591
|
+
renderLoadingTemplate() {
|
|
592
|
+
if (this.loadingTemplate) {
|
|
593
|
+
this.viewContainerRef.clear();
|
|
594
|
+
this.viewContainerRef.createEmbeddedView(this.loadingTemplate);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.4", 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 }); }
|
|
598
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.4", 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 }); }
|
|
605
599
|
}
|
|
606
600
|
__decorate([
|
|
607
601
|
Required,
|
|
@@ -613,11 +607,12 @@ __decorate([
|
|
|
613
607
|
__metadata("design:paramtypes", [Object]),
|
|
614
608
|
__metadata("design:returntype", void 0)
|
|
615
609
|
], RemoteMethodTemplateDirective.prototype, "call", null);
|
|
616
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RemoteMethodTemplateDirective, decorators: [{
|
|
617
611
|
type: Directive,
|
|
618
612
|
args: [{
|
|
619
613
|
selector: '[rxapRemoteMethod]',
|
|
620
|
-
exportAs: 'rxapRemoteMethod'
|
|
614
|
+
exportAs: 'rxapRemoteMethod',
|
|
615
|
+
standalone: true,
|
|
621
616
|
}]
|
|
622
617
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
623
618
|
type: Inject,
|
|
@@ -641,10 +636,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
641
636
|
}, {
|
|
642
637
|
type: Inject,
|
|
643
638
|
args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
|
|
644
|
-
}] }]; }, propDecorators: {
|
|
645
|
-
type: Input,
|
|
646
|
-
args: ['rxapRemoteMethodCall']
|
|
647
|
-
}], executed$: [{
|
|
639
|
+
}] }]; }, propDecorators: { executed$: [{
|
|
648
640
|
type: Output,
|
|
649
641
|
args: ['executed']
|
|
650
642
|
}], failure$: [{
|
|
@@ -668,21 +660,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
668
660
|
}], withoutParameters: [{
|
|
669
661
|
type: Input,
|
|
670
662
|
args: ['rxapRemoteMethodWithoutParameters']
|
|
671
|
-
}],
|
|
663
|
+
}], embedded: [{
|
|
672
664
|
type: Output
|
|
665
|
+
}], _remoteMethodOrIdOrToken: [], remoteMethodOrIdOrToken: [{
|
|
666
|
+
type: Input,
|
|
667
|
+
args: ['rxapRemoteMethodCall']
|
|
673
668
|
}], call: [] } });
|
|
674
|
-
class RemoteMethodTemplateDirectiveModule {
|
|
675
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: RemoteMethodTemplateDirectiveModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
676
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.0.2", ngImport: i0, type: RemoteMethodTemplateDirectiveModule, declarations: [RemoteMethodTemplateDirective], exports: [RemoteMethodTemplateDirective] }); }
|
|
677
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: RemoteMethodTemplateDirectiveModule }); }
|
|
678
|
-
}
|
|
679
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: RemoteMethodTemplateDirectiveModule, decorators: [{
|
|
680
|
-
type: NgModule,
|
|
681
|
-
args: [{
|
|
682
|
-
declarations: [RemoteMethodTemplateDirective],
|
|
683
|
-
exports: [RemoteMethodTemplateDirective]
|
|
684
|
-
}]
|
|
685
|
-
}] });
|
|
686
669
|
|
|
687
670
|
class RxapRemoteMethodDirectiveError extends RxapRemoteMethodError {
|
|
688
671
|
constructor(message, code, scope) {
|
|
@@ -694,5 +677,5 @@ class RxapRemoteMethodDirectiveError extends RxapRemoteMethodError {
|
|
|
694
677
|
* Generated bundle index. Do not edit.
|
|
695
678
|
*/
|
|
696
679
|
|
|
697
|
-
export { RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, RemoteMethodDirective,
|
|
680
|
+
export { RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, RemoteMethodDirective, RemoteMethodTemplateCollectionDirective, RemoteMethodTemplateCollectionDirectiveContext, RemoteMethodTemplateDirective, RxapRemoteMethodDirectiveError };
|
|
698
681
|
//# sourceMappingURL=rxap-remote-method-directive.mjs.map
|