@rxap/remote-method 16.0.0-dev.1 → 16.0.0-dev.10
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 +295 -0
- package/LICENSE +621 -24
- package/LICENSE.md +621 -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 -129
- package/esm2022/directive/lib/remote-method-template.directive.mjs +45 -55
- package/esm2022/directive/lib/remote-method.directive.mjs +28 -41
- 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 +16 -39
- 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 +175 -204
- package/fesm2022/rxap-remote-method-directive.mjs.map +1 -1
- package/fesm2022/rxap-remote-method-http-directive.mjs +20 -52
- 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 +51 -42
- package/testing/index.d.ts +1 -5
- package/testing/lib/remote-method-testing-loader.d.ts +2 -2
- package/theme.css +1 -0
- 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
|
-
import { coerceBoolean,
|
|
7
|
-
import { ToggleSubject } from '@rxap/
|
|
6
|
+
import { coerceBoolean, Deprecated } from '@rxap/utilities';
|
|
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,24 +97,21 @@ 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
|
-
__decorate([
|
|
100
|
-
Required,
|
|
101
|
-
__metadata("design:type", Object)
|
|
102
|
-
], RemoteMethodDirective.prototype, "_remoteMethodOrIdOrToken", void 0);
|
|
103
103
|
__decorate([
|
|
104
104
|
Deprecated('removed'),
|
|
105
105
|
__metadata("design:type", Function),
|
|
106
106
|
__metadata("design:paramtypes", []),
|
|
107
107
|
__metadata("design:returntype", Promise)
|
|
108
108
|
], RemoteMethodDirective.prototype, "call", null);
|
|
109
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
109
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RemoteMethodDirective, decorators: [{
|
|
110
110
|
type: Directive,
|
|
111
111
|
args: [{
|
|
112
112
|
selector: '[rxapRemoteMethod]',
|
|
113
|
-
exportAs: 'rxapRemoteMethod'
|
|
113
|
+
exportAs: 'rxapRemoteMethod',
|
|
114
|
+
standalone: true,
|
|
114
115
|
}]
|
|
115
116
|
}], ctorParameters: function () { return [{ type: i1.RemoteMethodLoader, decorators: [{
|
|
116
117
|
type: Inject,
|
|
@@ -125,10 +126,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
125
126
|
}, {
|
|
126
127
|
type: Inject,
|
|
127
128
|
args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
|
|
128
|
-
}] }]; }, propDecorators: {
|
|
129
|
-
type: Input,
|
|
130
|
-
args: ['rxapRemoteMethod']
|
|
131
|
-
}], parameters: [{
|
|
129
|
+
}] }]; }, propDecorators: { parameters: [{
|
|
132
130
|
type: Input
|
|
133
131
|
}], metadata: [{
|
|
134
132
|
type: Input
|
|
@@ -143,28 +141,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
143
141
|
args: ['successful']
|
|
144
142
|
}], immediately: [{
|
|
145
143
|
type: Input
|
|
144
|
+
}], remoteMethodOrIdOrToken: [{
|
|
145
|
+
type: Input,
|
|
146
|
+
args: ['rxapRemoteMethod']
|
|
146
147
|
}], hasConfirmDirective: [{
|
|
147
148
|
type: Input,
|
|
148
149
|
args: ['rxapConfirm']
|
|
149
|
-
}],
|
|
150
|
+
}], onConfirmed: [{
|
|
150
151
|
type: HostListener,
|
|
151
152
|
args: ['confirmed']
|
|
152
153
|
}], onClick: [{
|
|
153
154
|
type: HostListener,
|
|
154
155
|
args: ['click']
|
|
155
156
|
}], 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
157
|
|
|
169
158
|
class RemoteMethodTemplateCollectionDirectiveContext {
|
|
170
159
|
constructor($implicit, index, count) {
|
|
@@ -195,54 +184,6 @@ class RecordViewTuple {
|
|
|
195
184
|
}
|
|
196
185
|
}
|
|
197
186
|
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
187
|
constructor(template, remoteMethodLoader, injector, viewContainerRef, cdr, differs, zone, remoteMethodToken) {
|
|
247
188
|
this.template = template;
|
|
248
189
|
this.remoteMethodLoader = remoteMethodLoader;
|
|
@@ -254,11 +195,6 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
254
195
|
this.remoteMethodToken = remoteMethodToken;
|
|
255
196
|
this.withoutParameters = false;
|
|
256
197
|
this._differ = null;
|
|
257
|
-
/**
|
|
258
|
-
* Holds the data that should be displayed
|
|
259
|
-
* @private
|
|
260
|
-
*/
|
|
261
|
-
this._data = null;
|
|
262
198
|
this._dirty = true;
|
|
263
199
|
/**
|
|
264
200
|
* Indicates that the remote method returned a empty collection
|
|
@@ -296,12 +232,66 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
296
232
|
* @private
|
|
297
233
|
*/
|
|
298
234
|
this._errorTemplateViewRef = null;
|
|
235
|
+
/**
|
|
236
|
+
* Holds the data that should be displayed
|
|
237
|
+
* @private
|
|
238
|
+
*/
|
|
239
|
+
this._data = null;
|
|
299
240
|
if (this.remoteMethodToken) {
|
|
300
241
|
this._remoteMethodOrIdOrToken = this.remoteMethodToken;
|
|
301
242
|
}
|
|
302
243
|
}
|
|
244
|
+
get trackBy() {
|
|
245
|
+
return this._trackByFn;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* A function that defines how to track changes for items in the iterable.
|
|
249
|
+
*
|
|
250
|
+
* When items are added, moved, or removed in the iterable,
|
|
251
|
+
* the directive must re-render the appropriate DOM nodes.
|
|
252
|
+
* To minimize churn in the DOM, only nodes that have changed
|
|
253
|
+
* are re-rendered.
|
|
254
|
+
*
|
|
255
|
+
* By default, the change detector assumes that
|
|
256
|
+
* the object instance identifies the node in the iterable.
|
|
257
|
+
* When this function is supplied, the directive uses
|
|
258
|
+
* the result of calling this function to identify the item node,
|
|
259
|
+
* rather than the identity of the object itself.
|
|
260
|
+
*
|
|
261
|
+
* The function receives two inputs,
|
|
262
|
+
* the iteration index and the node object ID.
|
|
263
|
+
*/
|
|
264
|
+
set trackBy(fn) {
|
|
265
|
+
if (isDevMode() && fn != null && typeof fn !== 'function') {
|
|
266
|
+
// TODO(vicb): use a log service once there is a public one available
|
|
267
|
+
if (console && console.warn) {
|
|
268
|
+
console.warn(`trackBy must be a function, but received ${JSON.stringify(fn)}. ` +
|
|
269
|
+
`See https://angular.io/api/common/NgForOf#change-propagation for more information.`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
this._trackByFn = fn;
|
|
273
|
+
}
|
|
274
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
275
|
+
set remoteMethodOrIdOrToken(value) {
|
|
276
|
+
if (value) {
|
|
277
|
+
this._remoteMethodOrIdOrToken = value;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
set data(data) {
|
|
281
|
+
this._data = data;
|
|
282
|
+
this._dirty = true;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Asserts the correct type of the context for the template that `NgForOf` will render.
|
|
286
|
+
*
|
|
287
|
+
* The presence of this method is a signal to the Ivy template type-check compiler that the
|
|
288
|
+
* `NgForOf` structural directive renders its template with a specific context type.
|
|
289
|
+
*/
|
|
290
|
+
static ngTemplateContextGuard(dir, ctx) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
303
293
|
ngOnChanges(changes) {
|
|
304
|
-
const parametersChanges = changes
|
|
294
|
+
const parametersChanges = changes['parameters'];
|
|
305
295
|
if (parametersChanges) {
|
|
306
296
|
this.call(parametersChanges.currentValue);
|
|
307
297
|
}
|
|
@@ -328,43 +318,6 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
328
318
|
});
|
|
329
319
|
})).subscribe();
|
|
330
320
|
}
|
|
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
321
|
/**
|
|
369
322
|
* Applies the changes when needed.
|
|
370
323
|
*/
|
|
@@ -373,7 +326,11 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
373
326
|
this.viewContainerRef.clear();
|
|
374
327
|
this._differ = null;
|
|
375
328
|
if (this.errorTemplate) {
|
|
376
|
-
this._errorTemplateViewRef = this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
329
|
+
this._errorTemplateViewRef = this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
330
|
+
$implicit: this._error,
|
|
331
|
+
message: this._error.message,
|
|
332
|
+
name: this._error.name,
|
|
333
|
+
});
|
|
377
334
|
}
|
|
378
335
|
}
|
|
379
336
|
else if (this._empty === true) {
|
|
@@ -418,18 +375,52 @@ class RemoteMethodTemplateCollectionDirective {
|
|
|
418
375
|
}
|
|
419
376
|
}
|
|
420
377
|
}
|
|
421
|
-
|
|
422
|
-
|
|
378
|
+
applyChanges(changes) {
|
|
379
|
+
const insertTuples = [];
|
|
380
|
+
changes.forEachOperation((item, adjustedPreviousIndex, currentIndex) => {
|
|
381
|
+
if (item.previousIndex == null) {
|
|
382
|
+
// NgForOf is never "null" or "undefined" here because the differ detected
|
|
383
|
+
// that a new item needs to be inserted from the iterable. This implies that
|
|
384
|
+
// there is an iterable value for "_ngForOf".
|
|
385
|
+
const view = this.viewContainerRef.createEmbeddedView(this.template, new RemoteMethodTemplateCollectionDirectiveContext(null, -1, -1), currentIndex === null ? undefined : currentIndex);
|
|
386
|
+
const tuple = new RecordViewTuple(item, view);
|
|
387
|
+
insertTuples.push(tuple);
|
|
388
|
+
}
|
|
389
|
+
else if (currentIndex == null) {
|
|
390
|
+
this.viewContainerRef.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
|
|
391
|
+
}
|
|
392
|
+
else if (adjustedPreviousIndex !== null) {
|
|
393
|
+
const view = this.viewContainerRef.get(adjustedPreviousIndex);
|
|
394
|
+
this.viewContainerRef.move(view, currentIndex);
|
|
395
|
+
const tuple = new RecordViewTuple(item, view);
|
|
396
|
+
insertTuples.push(tuple);
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
for (let i = 0; i < insertTuples.length; i++) {
|
|
400
|
+
this.perViewChange(insertTuples[i].view, insertTuples[i].record);
|
|
401
|
+
}
|
|
402
|
+
for (let i = 0, ilen = this.viewContainerRef.length; i < ilen; i++) {
|
|
403
|
+
const viewRef = this.viewContainerRef.get(i);
|
|
404
|
+
viewRef.context.index = i;
|
|
405
|
+
viewRef.context.count = ilen;
|
|
406
|
+
}
|
|
407
|
+
changes.forEachIdentityChange((record) => {
|
|
408
|
+
const viewRef = this.viewContainerRef.get(record.currentIndex);
|
|
409
|
+
viewRef.context.$implicit = record.item;
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
perViewChange(view, record) {
|
|
413
|
+
view.context.$implicit = record.item;
|
|
414
|
+
}
|
|
415
|
+
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 }); }
|
|
416
|
+
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
417
|
}
|
|
424
|
-
|
|
425
|
-
Required,
|
|
426
|
-
__metadata("design:type", Object)
|
|
427
|
-
], RemoteMethodTemplateCollectionDirective.prototype, "_remoteMethodOrIdOrToken", void 0);
|
|
428
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImport: i0, type: RemoteMethodTemplateCollectionDirective, decorators: [{
|
|
418
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RemoteMethodTemplateCollectionDirective, decorators: [{
|
|
429
419
|
type: Directive,
|
|
430
420
|
args: [{
|
|
431
421
|
selector: '[rxapRemoteMethodCollection]',
|
|
432
|
-
exportAs: 'rxapRemoteMethodCollection'
|
|
422
|
+
exportAs: 'rxapRemoteMethodCollection',
|
|
423
|
+
standalone: true,
|
|
433
424
|
}]
|
|
434
425
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
435
426
|
type: Inject,
|
|
@@ -459,13 +450,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
459
450
|
}, {
|
|
460
451
|
type: Inject,
|
|
461
452
|
args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
|
|
462
|
-
}] }]; }, propDecorators: {
|
|
463
|
-
type: Input,
|
|
464
|
-
args: ['rxapRemoteMethodCollectionCall']
|
|
465
|
-
}], trackBy: [{
|
|
466
|
-
type: Input,
|
|
467
|
-
args: ['rxapRemoteMethodCollectionTrackBy']
|
|
468
|
-
}], parameters: [{
|
|
453
|
+
}] }]; }, propDecorators: { parameters: [{
|
|
469
454
|
type: Input,
|
|
470
455
|
args: ['rxapRemoteMethodCollectionParameters']
|
|
471
456
|
}], emptyTemplate: [{
|
|
@@ -477,35 +462,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
477
462
|
}], withoutParameters: [{
|
|
478
463
|
type: Input,
|
|
479
464
|
args: ['rxapRemoteMethodCollectionWithoutParameters']
|
|
480
|
-
}],
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
type: NgModule,
|
|
488
|
-
args: [{
|
|
489
|
-
declarations: [RemoteMethodTemplateCollectionDirective],
|
|
490
|
-
exports: [RemoteMethodTemplateCollectionDirective]
|
|
491
|
-
}]
|
|
492
|
-
}] });
|
|
465
|
+
}], trackBy: [{
|
|
466
|
+
type: Input,
|
|
467
|
+
args: ['rxapRemoteMethodCollectionTrackBy']
|
|
468
|
+
}], remoteMethodOrIdOrToken: [{
|
|
469
|
+
type: Input,
|
|
470
|
+
args: ['rxapRemoteMethodCollectionCall']
|
|
471
|
+
}] } });
|
|
493
472
|
|
|
494
473
|
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
474
|
constructor(template, remoteMethodLoader, injector, viewContainerRef, cdr, remoteMethodToken) {
|
|
510
475
|
this.template = template;
|
|
511
476
|
this.remoteMethodLoader = remoteMethodLoader;
|
|
@@ -513,8 +478,16 @@ class RemoteMethodTemplateDirective {
|
|
|
513
478
|
this.viewContainerRef = viewContainerRef;
|
|
514
479
|
this.cdr = cdr;
|
|
515
480
|
this.remoteMethodToken = remoteMethodToken;
|
|
481
|
+
// TODO : remove template context Guard
|
|
482
|
+
// the template context Guard must be defined with a concrete context type
|
|
483
|
+
// else the context guard is resolved to any
|
|
484
|
+
// For each child directive that should have a template context guard
|
|
485
|
+
// the template context guard must be defined
|
|
486
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
516
487
|
this.executed$ = new EventEmitter();
|
|
488
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
517
489
|
this.failure$ = new EventEmitter();
|
|
490
|
+
// eslint-disable-next-line @angular-eslint/no-output-rename
|
|
518
491
|
this.successful$ = new EventEmitter();
|
|
519
492
|
/**
|
|
520
493
|
* true - a remote method call is in progress
|
|
@@ -526,8 +499,18 @@ class RemoteMethodTemplateDirective {
|
|
|
526
499
|
this._remoteMethodOrIdOrToken = this.remoteMethodToken;
|
|
527
500
|
}
|
|
528
501
|
}
|
|
502
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
503
|
+
set remoteMethodOrIdOrToken(value) {
|
|
504
|
+
if (value) {
|
|
505
|
+
this._remoteMethodOrIdOrToken = value;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
// !! add generation of concrete template context guard to openapi schematics !!
|
|
509
|
+
static ngTemplateContextGuard(dir, ctx) {
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
529
512
|
ngOnChanges(changes) {
|
|
530
|
-
const parametersChanges = changes
|
|
513
|
+
const parametersChanges = changes['parameters'];
|
|
531
514
|
if (parametersChanges) {
|
|
532
515
|
this.execute(parametersChanges.currentValue);
|
|
533
516
|
}
|
|
@@ -571,12 +554,6 @@ class RemoteMethodTemplateDirective {
|
|
|
571
554
|
updateParameters(parameters) {
|
|
572
555
|
this.parameters = { ...(this.parameters ?? {}), ...parameters };
|
|
573
556
|
}
|
|
574
|
-
renderLoadingTemplate() {
|
|
575
|
-
if (this.loadingTemplate) {
|
|
576
|
-
this.viewContainerRef.clear();
|
|
577
|
-
this.viewContainerRef.createEmbeddedView(this.loadingTemplate);
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
557
|
executed(result) {
|
|
581
558
|
this.executed$.emit(result);
|
|
582
559
|
}
|
|
@@ -593,31 +570,37 @@ class RemoteMethodTemplateDirective {
|
|
|
593
570
|
}
|
|
594
571
|
catch (error) {
|
|
595
572
|
if (this.errorTemplate) {
|
|
596
|
-
this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
573
|
+
this.viewContainerRef.createEmbeddedView(this.errorTemplate, {
|
|
574
|
+
$implicit: error,
|
|
575
|
+
message: error.message,
|
|
576
|
+
});
|
|
597
577
|
}
|
|
598
578
|
console.error(error.message);
|
|
599
579
|
}
|
|
600
580
|
this.embedded.emit();
|
|
601
581
|
this.cdr.detectChanges();
|
|
602
582
|
}
|
|
603
|
-
|
|
604
|
-
|
|
583
|
+
renderLoadingTemplate() {
|
|
584
|
+
if (this.loadingTemplate) {
|
|
585
|
+
this.viewContainerRef.clear();
|
|
586
|
+
this.viewContainerRef.createEmbeddedView(this.loadingTemplate);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
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 }); }
|
|
590
|
+
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
591
|
}
|
|
606
|
-
__decorate([
|
|
607
|
-
Required,
|
|
608
|
-
__metadata("design:type", Object)
|
|
609
|
-
], RemoteMethodTemplateDirective.prototype, "_remoteMethodOrIdOrToken", void 0);
|
|
610
592
|
__decorate([
|
|
611
593
|
Deprecated('removed'),
|
|
612
594
|
__metadata("design:type", Function),
|
|
613
595
|
__metadata("design:paramtypes", [Object]),
|
|
614
596
|
__metadata("design:returntype", void 0)
|
|
615
597
|
], RemoteMethodTemplateDirective.prototype, "call", null);
|
|
616
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.
|
|
598
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.4", ngImport: i0, type: RemoteMethodTemplateDirective, decorators: [{
|
|
617
599
|
type: Directive,
|
|
618
600
|
args: [{
|
|
619
601
|
selector: '[rxapRemoteMethod]',
|
|
620
|
-
exportAs: 'rxapRemoteMethod'
|
|
602
|
+
exportAs: 'rxapRemoteMethod',
|
|
603
|
+
standalone: true,
|
|
621
604
|
}]
|
|
622
605
|
}], ctorParameters: function () { return [{ type: i0.TemplateRef, decorators: [{
|
|
623
606
|
type: Inject,
|
|
@@ -641,10 +624,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
641
624
|
}, {
|
|
642
625
|
type: Inject,
|
|
643
626
|
args: [RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN]
|
|
644
|
-
}] }]; }, propDecorators: {
|
|
645
|
-
type: Input,
|
|
646
|
-
args: ['rxapRemoteMethodCall']
|
|
647
|
-
}], executed$: [{
|
|
627
|
+
}] }]; }, propDecorators: { executed$: [{
|
|
648
628
|
type: Output,
|
|
649
629
|
args: ['executed']
|
|
650
630
|
}], failure$: [{
|
|
@@ -668,21 +648,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.0.2", ngImpor
|
|
|
668
648
|
}], withoutParameters: [{
|
|
669
649
|
type: Input,
|
|
670
650
|
args: ['rxapRemoteMethodWithoutParameters']
|
|
671
|
-
}],
|
|
651
|
+
}], embedded: [{
|
|
672
652
|
type: Output
|
|
653
|
+
}], remoteMethodOrIdOrToken: [{
|
|
654
|
+
type: Input,
|
|
655
|
+
args: ['rxapRemoteMethodCall']
|
|
673
656
|
}], 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
657
|
|
|
687
658
|
class RxapRemoteMethodDirectiveError extends RxapRemoteMethodError {
|
|
688
659
|
constructor(message, code, scope) {
|
|
@@ -694,5 +665,5 @@ class RxapRemoteMethodDirectiveError extends RxapRemoteMethodError {
|
|
|
694
665
|
* Generated bundle index. Do not edit.
|
|
695
666
|
*/
|
|
696
667
|
|
|
697
|
-
export { RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, RemoteMethodDirective,
|
|
668
|
+
export { RXAP_REMOTE_METHOD_DIRECTIVE_TOKEN, RemoteMethodDirective, RemoteMethodTemplateCollectionDirective, RemoteMethodTemplateCollectionDirectiveContext, RemoteMethodTemplateDirective, RxapRemoteMethodDirectiveError };
|
|
698
669
|
//# sourceMappingURL=rxap-remote-method-directive.mjs.map
|