@rxap/remote-method 16.0.0-dev.2 → 16.0.0-dev.4
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 +258 -0
- package/README.md +8 -73
- package/directive/index.d.ts +5 -5
- package/directive/lib/remote-method-template-collection.directive.d.ts +38 -38
- package/directive/lib/remote-method-template.directive.d.ts +7 -7
- package/directive/lib/remote-method.directive.d.ts +7 -7
- 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 +114 -110
- package/esm2022/directive/lib/remote-method-template.directive.mjs +44 -38
- package/esm2022/directive/lib/remote-method.directive.mjs +27 -24
- 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 -9
- package/esm2022/http/directive/lib/http-remote-method.directive.mjs +7 -8
- 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 +169 -153
- package/fesm2022/rxap-remote-method-directive.mjs.map +1 -1
- package/fesm2022/rxap-remote-method-http-directive.mjs +8 -8
- 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/http-remote-method.directive.d.ts +1 -1
- 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 +47 -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
|
@@ -4,26 +4,21 @@ import { InjectionToken, EventEmitter, Injector, isDevMode, INJECTOR, Directive,
|
|
|
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,12 +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
117
|
exportAs: 'rxapRemoteMethod',
|
|
114
|
-
standalone: true
|
|
118
|
+
standalone: true,
|
|
115
119
|
}]
|
|
116
120
|
}], ctorParameters: function () { return [{ type: i1.RemoteMethodLoader, decorators: [{
|
|
117
121
|
type: Inject,
|
|
@@ -126,10 +130,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
126
130
|
}, {
|
|
127
131
|
type: Inject,
|
|
128
132
|
args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
|
|
129
|
-
}] }]; }, propDecorators: {
|
|
130
|
-
type: Input,
|
|
131
|
-
args: ['rxapRemoteMethod']
|
|
132
|
-
}], parameters: [{
|
|
133
|
+
}] }]; }, propDecorators: { parameters: [{
|
|
133
134
|
type: Input
|
|
134
135
|
}], metadata: [{
|
|
135
136
|
type: Input
|
|
@@ -144,10 +145,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
144
145
|
args: ['successful']
|
|
145
146
|
}], immediately: [{
|
|
146
147
|
type: Input
|
|
148
|
+
}], _remoteMethodOrIdOrToken: [], remoteMethodOrIdOrToken: [{
|
|
149
|
+
type: Input,
|
|
150
|
+
args: ['rxapRemoteMethod']
|
|
147
151
|
}], hasConfirmDirective: [{
|
|
148
152
|
type: Input,
|
|
149
153
|
args: ['rxapConfirm']
|
|
150
|
-
}],
|
|
154
|
+
}], onConfirmed: [{
|
|
151
155
|
type: HostListener,
|
|
152
156
|
args: ['confirmed']
|
|
153
157
|
}], onClick: [{
|
|
@@ -184,54 +188,6 @@ class RecordViewTuple {
|
|
|
184
188
|
}
|
|
185
189
|
}
|
|
186
190
|
class RemoteMethodTemplateCollectionDirective {
|
|
187
|
-
/**
|
|
188
|
-
* Asserts the correct type of the context for the template that `NgForOf` will render.
|
|
189
|
-
*
|
|
190
|
-
* The presence of this method is a signal to the Ivy template type-check compiler that the
|
|
191
|
-
* `NgForOf` structural directive renders its template with a specific context type.
|
|
192
|
-
*/
|
|
193
|
-
static ngTemplateContextGuard(dir, ctx) {
|
|
194
|
-
return true;
|
|
195
|
-
}
|
|
196
|
-
set remoteMethodOrIdOrToken(value) {
|
|
197
|
-
if (value) {
|
|
198
|
-
this._remoteMethodOrIdOrToken = value;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* A function that defines how to track changes for items in the iterable.
|
|
203
|
-
*
|
|
204
|
-
* When items are added, moved, or removed in the iterable,
|
|
205
|
-
* the directive must re-render the appropriate DOM nodes.
|
|
206
|
-
* To minimize churn in the DOM, only nodes that have changed
|
|
207
|
-
* are re-rendered.
|
|
208
|
-
*
|
|
209
|
-
* By default, the change detector assumes that
|
|
210
|
-
* the object instance identifies the node in the iterable.
|
|
211
|
-
* When this function is supplied, the directive uses
|
|
212
|
-
* the result of calling this function to identify the item node,
|
|
213
|
-
* rather than the identity of the object itself.
|
|
214
|
-
*
|
|
215
|
-
* The function receives two inputs,
|
|
216
|
-
* the iteration index and the node object ID.
|
|
217
|
-
*/
|
|
218
|
-
set trackBy(fn) {
|
|
219
|
-
if (isDevMode() && fn != null && typeof fn !== 'function') {
|
|
220
|
-
// TODO(vicb): use a log service once there is a public one available
|
|
221
|
-
if (console && console.warn) {
|
|
222
|
-
console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. ` +
|
|
223
|
-
`See https://angular.io/api/common/NgForOf#change-propagation for more information.`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
this._trackByFn = fn;
|
|
227
|
-
}
|
|
228
|
-
get trackBy() {
|
|
229
|
-
return this._trackByFn;
|
|
230
|
-
}
|
|
231
|
-
set data(data) {
|
|
232
|
-
this._data = data;
|
|
233
|
-
this._dirty = true;
|
|
234
|
-
}
|
|
235
191
|
constructor(template, remoteMethodLoader, injector, viewContainerRef, cdr, differs, zone, remoteMethodToken) {
|
|
236
192
|
this.template = template;
|
|
237
193
|
this.remoteMethodLoader = remoteMethodLoader;
|
|
@@ -243,11 +199,6 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
243
199
|
this.remoteMethodToken = remoteMethodToken;
|
|
244
200
|
this.withoutParameters = false;
|
|
245
201
|
this._differ = null;
|
|
246
|
-
/**
|
|
247
|
-
* Holds the data that should be displayed
|
|
248
|
-
* @private
|
|
249
|
-
*/
|
|
250
|
-
this._data = null;
|
|
251
202
|
this._dirty = true;
|
|
252
203
|
/**
|
|
253
204
|
* Indicates that the remote method returned a empty collection
|
|
@@ -285,12 +236,66 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
285
236
|
* @private
|
|
286
237
|
*/
|
|
287
238
|
this._errorTemplateViewRef = null;
|
|
239
|
+
/**
|
|
240
|
+
* Holds the data that should be displayed
|
|
241
|
+
* @private
|
|
242
|
+
*/
|
|
243
|
+
this._data = null;
|
|
288
244
|
if (this.remoteMethodToken) {
|
|
289
245
|
this._remoteMethodOrIdOrToken = this.remoteMethodToken;
|
|
290
246
|
}
|
|
291
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
|
+
}
|
|
292
297
|
ngOnChanges(changes) {
|
|
293
|
-
const parametersChanges = changes
|
|
298
|
+
const parametersChanges = changes['parameters'];
|
|
294
299
|
if (parametersChanges) {
|
|
295
300
|
this.call(parametersChanges.currentValue);
|
|
296
301
|
}
|
|
@@ -317,43 +322,6 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
317
322
|
});
|
|
318
323
|
})).subscribe();
|
|
319
324
|
}
|
|
320
|
-
applyChanges(changes) {
|
|
321
|
-
const insertTuples = [];
|
|
322
|
-
changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
|
|
323
|
-
if (item.previousIndex == null) {
|
|
324
|
-
// NgForOf is never "null" or "undefined" here because the differ detected
|
|
325
|
-
// that a new item needs to be inserted from the iterable. This implies that
|
|
326
|
-
// there is an iterable value for "_ngForOf".
|
|
327
|
-
const view = this.viewContainerRef.createEmbeddedView(this.template, new RemoteMethodTemplateCollectionDirectiveContext(null, -1, -1), currentIndex === null ? undefined : currentIndex);
|
|
328
|
-
const tuple = new RecordViewTuple(item, view);
|
|
329
|
-
insertTuples.push(tuple);
|
|
330
|
-
}
|
|
331
|
-
else if (currentIndex == null) {
|
|
332
|
-
this.viewContainerRef.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
|
|
333
|
-
}
|
|
334
|
-
else if (adjustedPreviousIndex !== null) {
|
|
335
|
-
const view = this.viewContainerRef.get(adjustedPreviousIndex);
|
|
336
|
-
this.viewContainerRef.move(view, currentIndex);
|
|
337
|
-
const tuple = new RecordViewTuple(item, view);
|
|
338
|
-
insertTuples.push(tuple);
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
for (let i = 0; i < insertTuples.length; i++) {
|
|
342
|
-
this.perViewChange(insertTuples[i].view, insertTuples[i].record);
|
|
343
|
-
}
|
|
344
|
-
for (let i = 0, ilen = this.viewContainerRef.length; i < ilen; i++) {
|
|
345
|
-
const viewRef = this.viewContainerRef.get(i);
|
|
346
|
-
viewRef.context.index = i;
|
|
347
|
-
viewRef.context.count = ilen;
|
|
348
|
-
}
|
|
349
|
-
changes.forEachIdentityChange((record) => {
|
|
350
|
-
const viewRef = this.viewContainerRef.get(record.currentIndex);
|
|
351
|
-
viewRef.context.$implicit = record.item;
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
|
-
perViewChange(view, record) {
|
|
355
|
-
view.context.$implicit = record.item;
|
|
356
|
-
}
|
|
357
325
|
/**
|
|
358
326
|
* Applies the changes when needed.
|
|
359
327
|
*/
|
|
@@ -362,7 +330,11 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
362
330
|
this.viewContainerRef.clear();
|
|
363
331
|
this._differ = null;
|
|
364
332
|
if (this.errorTemplate) {
|
|
365
|
-
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
|
+
});
|
|
366
338
|
}
|
|
367
339
|
}
|
|
368
340
|
else if (this._empty === true) {
|
|
@@ -407,19 +379,56 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
407
379
|
}
|
|
408
380
|
}
|
|
409
381
|
}
|
|
410
|
-
|
|
411
|
-
|
|
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 }); }
|
|
412
421
|
}
|
|
413
422
|
__decorate([
|
|
414
423
|
Required,
|
|
415
424
|
__metadata("design:type", Object)
|
|
416
425
|
], RemoteMethodTemplateCollectionDirective.prototype, "_remoteMethodOrIdOrToken", void 0);
|
|
417
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
426
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RemoteMethodTemplateCollectionDirective, decorators: [{
|
|
418
427
|
type: Directive,
|
|
419
428
|
args: [{
|
|
420
429
|
selector: '[rxapRemoteMethodCollection]',
|
|
421
430
|
exportAs: 'rxapRemoteMethodCollection',
|
|
422
|
-
standalone: true
|
|
431
|
+
standalone: true,
|
|
423
432
|
}]
|
|
424
433
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
425
434
|
type: Inject,
|
|
@@ -449,13 +458,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
449
458
|
}, {
|
|
450
459
|
type: Inject,
|
|
451
460
|
args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
|
|
452
|
-
}] }]; }, propDecorators: {
|
|
453
|
-
type: Input,
|
|
454
|
-
args: ['rxapRemoteMethodCollectionCall']
|
|
455
|
-
}], trackBy: [{
|
|
456
|
-
type: Input,
|
|
457
|
-
args: ['rxapRemoteMethodCollectionTrackBy']
|
|
458
|
-
}], parameters: [{
|
|
461
|
+
}] }]; }, propDecorators: { parameters: [{
|
|
459
462
|
type: Input,
|
|
460
463
|
args: ['rxapRemoteMethodCollectionParameters']
|
|
461
464
|
}], emptyTemplate: [{
|
|
@@ -467,23 +470,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
467
470
|
}], withoutParameters: [{
|
|
468
471
|
type: Input,
|
|
469
472
|
args: ['rxapRemoteMethodCollectionWithoutParameters']
|
|
470
|
-
}],
|
|
473
|
+
}], trackBy: [{
|
|
474
|
+
type: Input,
|
|
475
|
+
args: ['rxapRemoteMethodCollectionTrackBy']
|
|
476
|
+
}], _remoteMethodOrIdOrToken: [], remoteMethodOrIdOrToken: [{
|
|
477
|
+
type: Input,
|
|
478
|
+
args: ['rxapRemoteMethodCollectionCall']
|
|
479
|
+
}] } });
|
|
471
480
|
|
|
472
481
|
class RemoteMethodTemplateDirective {
|
|
473
|
-
// TODO : remove template context Guard
|
|
474
|
-
// the template context Guard must be defined with a concrete context type
|
|
475
|
-
// else the context guard is resolved to any
|
|
476
|
-
// For each child directive that should have a template context guard
|
|
477
|
-
// the template context guard must be defined
|
|
478
|
-
// !! add generation of concrete template context guard to openapi schematics !!
|
|
479
|
-
static ngTemplateContextGuard(dir, ctx) {
|
|
480
|
-
return true;
|
|
481
|
-
}
|
|
482
|
-
set remoteMethodOrIdOrToken(value) {
|
|
483
|
-
if (value) {
|
|
484
|
-
this._remoteMethodOrIdOrToken = value;
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
482
|
constructor(template, remoteMethodLoader, injector, viewContainerRef, cdr, remoteMethodToken) {
|
|
488
483
|
this.template = template;
|
|
489
484
|
this.remoteMethodLoader = remoteMethodLoader;
|
|
@@ -491,8 +486,16 @@ class RemoteMethodTemplateDirective {
|
|
|
491
486
|
this.viewContainerRef = viewContainerRef;
|
|
492
487
|
this.cdr = cdr;
|
|
493
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
|
|
494
495
|
this.executed$ = new EventEmitter();
|
|
496
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
495
497
|
this.failure$ = new EventEmitter();
|
|
498
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
496
499
|
this.successful$ = new EventEmitter();
|
|
497
500
|
/**
|
|
498
501
|
* true - a remote method call is in progress
|
|
@@ -504,8 +507,18 @@ class RemoteMethodTemplateDirective {
|
|
|
504
507
|
this._remoteMethodOrIdOrToken = this.remoteMethodToken;
|
|
505
508
|
}
|
|
506
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
|
+
}
|
|
507
520
|
ngOnChanges(changes) {
|
|
508
|
-
const parametersChanges = changes
|
|
521
|
+
const parametersChanges = changes['parameters'];
|
|
509
522
|
if (parametersChanges) {
|
|
510
523
|
this.execute(parametersChanges.currentValue);
|
|
511
524
|
}
|
|
@@ -549,12 +562,6 @@ class RemoteMethodTemplateDirective {
|
|
|
549
562
|
updateParameters(parameters) {
|
|
550
563
|
this.parameters = { ...(this.parameters ?? {}), ...parameters };
|
|
551
564
|
}
|
|
552
|
-
renderLoadingTemplate() {
|
|
553
|
-
if (this.loadingTemplate) {
|
|
554
|
-
this.viewContainerRef.clear();
|
|
555
|
-
this.viewContainerRef.createEmbeddedView(this.loadingTemplate);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
565
|
executed(result) {
|
|
559
566
|
this.executed$.emit(result);
|
|
560
567
|
}
|
|
@@ -571,15 +578,24 @@ class RemoteMethodTemplateDirective {
|
|
|
571
578
|
}
|
|
572
579
|
catch (error) {
|
|
573
580
|
if (this.errorTemplate) {
|
|
574
|
-
this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
581
|
+
this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
582
|
+
$implicit: error,
|
|
583
|
+
message: error.message,
|
|
584
|
+
});
|
|
575
585
|
}
|
|
576
586
|
console.error(error.message);
|
|
577
587
|
}
|
|
578
588
|
this.embedded.emit();
|
|
579
589
|
this.cdr.detectChanges();
|
|
580
590
|
}
|
|
581
|
-
|
|
582
|
-
|
|
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 }); }
|
|
583
599
|
}
|
|
584
600
|
__decorate([
|
|
585
601
|
Required,
|
|
@@ -591,12 +607,12 @@ __decorate([
|
|
|
591
607
|
__metadata("design:paramtypes", [Object]),
|
|
592
608
|
__metadata("design:returntype", void 0)
|
|
593
609
|
], RemoteMethodTemplateDirective.prototype, "call", null);
|
|
594
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
610
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RemoteMethodTemplateDirective, decorators: [{
|
|
595
611
|
type: Directive,
|
|
596
612
|
args: [{
|
|
597
613
|
selector: '[rxapRemoteMethod]',
|
|
598
614
|
exportAs: 'rxapRemoteMethod',
|
|
599
|
-
standalone: true
|
|
615
|
+
standalone: true,
|
|
600
616
|
}]
|
|
601
617
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
602
618
|
type: Inject,
|
|
@@ -620,10 +636,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
620
636
|
}, {
|
|
621
637
|
type: Inject,
|
|
622
638
|
args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
|
|
623
|
-
}] }]; }, propDecorators: {
|
|
624
|
-
type: Input,
|
|
625
|
-
args: ['rxapRemoteMethodCall']
|
|
626
|
-
}], executed$: [{
|
|
639
|
+
}] }]; }, propDecorators: { executed$: [{
|
|
627
640
|
type: Output,
|
|
628
641
|
args: ['executed']
|
|
629
642
|
}], failure$: [{
|
|
@@ -647,8 +660,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
647
660
|
}], withoutParameters: [{
|
|
648
661
|
type: Input,
|
|
649
662
|
args: ['rxapRemoteMethodWithoutParameters']
|
|
650
|
-
}],
|
|
663
|
+
}], embedded: [{
|
|
651
664
|
type: Output
|
|
665
|
+
}], _remoteMethodOrIdOrToken: [], remoteMethodOrIdOrToken: [{
|
|
666
|
+
type: Input,
|
|
667
|
+
args: ['rxapRemoteMethodCall']
|
|
652
668
|
}], call: [] } });
|
|
653
669
|
|
|
654
670
|
class RxapRemoteMethodDirectiveError extends RxapRemoteMethodError {
|